History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Cross-merge networking fixes after downstream PR (net-6.17-rc4). No conflicts. Adjacent changes: drivers/net/ethernet/intel/idpf/idpf_txrx.c 02614eee26fb ("idpf: do not linearize big TSO packets") 6c4e68480238 ("idpf: remove obsolete stashing code")

Jakub Kicinski committed 1 year ago

Commit d23ad542 parents 29828b8 9c736ac393 files · +3892 −2259Browse files

Unified · Split

393 files
  1. .mailmap +2 −0
  2. CREDITS +7 −0
  3. Documentation/admin-guide/cgroup-v2.rst +2 −2
  4. Documentation/devicetree/bindings/regulator/infineon,ir38060.yaml +1 −1
  5. Documentation/devicetree/bindings/vendor-prefixes.yaml +2 −0
  6. Documentation/process/security-bugs.rst +16 −9
  7. Documentation/userspace-api/iommufd.rst +2 −2
  8. MAINTAINERS +37 −8
  9. Makefile +1 −1
  10. arch/mips/boot/dts/lantiq/danube_easy50712.dts +4 −1
  11. arch/mips/lantiq/xway/sysctrl.c +5 −5
  12. arch/powerpc/boot/Makefile +3 −3
  13. arch/powerpc/boot/install.sh +7 −7
  14. arch/powerpc/kernel/Makefile +3 −1
  15. arch/powerpc/kernel/kvm.c +4 −4
  16. arch/powerpc/kernel/prom_init_check.sh +8 −8
  17. arch/powerpc/kernel/setup_64.c +1 −4
  18. arch/powerpc/kvm/powerpc.c +1 −1
  19. arch/powerpc/platforms/8xx/cpm1-ic.c +1 −2
  20. arch/powerpc/platforms/Kconfig.cputype +4 −9
  21. arch/powerpc/sysdev/fsl_msi.c +2 −3
  22. arch/s390/boot/vmem.c +3 −0
  23. arch/s390/configs/debug_defconfig +16 −17
  24. arch/s390/configs/defconfig +15 −19
  25. arch/s390/configs/zfcpdump_defconfig +2 −1
  26. arch/s390/hypfs/hypfs_dbfs.c +12 −7
  27. arch/x86/include/asm/xen/hypercall.h +3 −2
  28. arch/x86/kernel/cpu/amd.c +6 −2
  29. arch/x86/kernel/cpu/bugs.c +1 −3
  30. arch/x86/kernel/cpu/hygon.c +3 −0
  31. block/blk-core.c +1 −1
  32. block/blk-mq-debugfs.c +1 −0
  33. block/blk-mq.c +9 −4
  34. block/blk-rq-qos.c +4 −4
  35. block/blk-rq-qos.h +31 −17
  36. block/blk-settings.c +6 −6
  37. drivers/accel/habanalabs/gaudi2/gaudi2.c +1 −1
  38. drivers/acpi/apei/einj-core.c +7 −10
  39. drivers/acpi/pfr_update.c +1 −1
  40. drivers/atm/atmtcp.c +14 −3
  41. drivers/base/power/main.c +2 −2
  42. drivers/block/loop.c +21 −18
  43. drivers/cdx/controller/cdx_rpmsg.c +1 −2
  44. drivers/comedi/comedi_fops.c +5 −0
  45. drivers/comedi/drivers.c +12 −11
  46. drivers/comedi/drivers/pcl726.c +2 −1
  47. drivers/cpuidle/governors/menu.c +12 −17
  48. drivers/fpga/zynq-fpga.c +4 −4
  49. drivers/gpio/gpiolib-acpi-quirks.c +14 −0
  50. drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +1 −1
  51. drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +2 −1
  52. drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 −1
  53. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 −0
  54. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c +19 −0
  55. drivers/gpu/drm/amd/display/dc/bios/bios_parser.c +1 −4
  56. drivers/gpu/drm/amd/display/dc/bios/command_table.c +1 −1
  57. drivers/gpu/drm/amd/display/dc/clk_mgr/dce100/dce_clk_mgr.c +5 −9
  58. drivers/gpu/drm/amd/display/dc/clk_mgr/dce110/dce110_clk_mgr.c +23 −17
  59. drivers/gpu/drm/amd/display/dc/clk_mgr/dce60/dce60_clk_mgr.c +9 −22
  60. drivers/gpu/drm/amd/display/dc/core/dc.c +14 −1
  61. drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c +4 −4
  62. drivers/gpu/drm/amd/display/dc/dce/dmub_replay.c +3 −40
  63. drivers/gpu/drm/amd/display/dc/dce/dmub_replay.h +1 −1
  64. drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c +1 −1
  65. drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h +0 −20
  66. drivers/gpu/drm/amd/display/modules/hdcp/hdcp_psp.c +3 −0
  67. drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +25 −5
  68. drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +2 −2
  69. drivers/gpu/drm/drm_gpuvm.c +2 −0
  70. drivers/gpu/drm/drm_panic_qr.rs +21 −1
  71. drivers/gpu/drm/hisilicon/hibmc/dp/dp_link.c +12 −2
  72. drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c +13 −9
  73. drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h +1 −0
  74. drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_i2c.c +5 −0
  75. drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c +8 −3
  76. drivers/gpu/drm/i915/display/intel_display_irq.c +4 −0
  77. drivers/gpu/drm/i915/display/intel_tc.c +75 −18
  78. drivers/gpu/drm/i915/gt/intel_workarounds.c +11 −9
  79. drivers/gpu/drm/nouveau/nouveau_exec.c +3 −3
  80. drivers/gpu/drm/nouveau/nvif/vmm.c +2 −1
  81. drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/rpc.c +2 −2
  82. drivers/gpu/drm/nova/file.rs +2 −1
  83. drivers/gpu/drm/rockchip/Kconfig +1 −0
  84. drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +5 −4
  85. drivers/gpu/drm/tests/drm_format_helper_test.c +2 −1
  86. drivers/gpu/drm/xe/xe_migrate.c +1 −1
  87. drivers/gpu/drm/xe/xe_pxp_submit.c +1 −1
  88. drivers/gpu/drm/xe/xe_vm.c +23 −25
  89. drivers/gpu/drm/xe/xe_vm.h +1 −1
  90. drivers/i2c/busses/i2c-rtl9300.c +12 −8
  91. drivers/iio/accel/sca3300.c +1 −1
  92. drivers/iio/adc/Kconfig +1 −1
  93. drivers/iio/adc/ad7124.c +7 −7
  94. drivers/iio/adc/ad7173.c +75 −12
  95. drivers/iio/adc/ad7380.c +1 −0
  96. drivers/iio/adc/rzg2l_adc.c +10 −23
  97. drivers/iio/imu/inv_icm42600/inv_icm42600_temp.c +5 −1
  98. drivers/iio/light/as73211.c +1 −1
  99. drivers/iio/pressure/bmp280-core.c +5 −4
  100. drivers/iio/proximity/isl29501.c +11 −5
  101. drivers/iio/temperature/maxim_thermocouple.c +16 −10
  102. drivers/infiniband/core/umem_odp.c +2 −2
  103. drivers/infiniband/hw/bnxt_re/ib_verbs.c +2 −6
  104. drivers/infiniband/hw/bnxt_re/main.c +23 −0
  105. drivers/infiniband/hw/bnxt_re/qplib_fp.c +1 −29
  106. drivers/infiniband/hw/bnxt_re/qplib_fp.h +0 −2
  107. drivers/infiniband/hw/bnxt_re/qplib_res.c +2 −0
  108. drivers/infiniband/hw/erdma/erdma_verbs.c +5 −1
  109. drivers/infiniband/hw/hns/hns_roce_hw_v2.c +3 −3
  110. drivers/infiniband/hw/hns/hns_roce_restrack.c +8 −1
  111. drivers/infiniband/sw/rxe/rxe_net.c +8 −21
  112. drivers/infiniband/sw/rxe/rxe_qp.c +1 −1
  113. drivers/iommu/amd/init.c +2 −2
  114. drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +1 −1
  115. drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c +5 −3
  116. drivers/iommu/iommufd/viommu.c +2 −2
  117. drivers/iommu/riscv/iommu.c +1 −1
  118. drivers/iommu/virtio-iommu.c +9 −6
  119. drivers/isdn/hardware/mISDN/hfcpci.c +5 −7
  120. drivers/md/md.c +92 −30
  121. drivers/media/i2c/alvium-csi2.c +0 −1
  122. drivers/media/i2c/ccs/ccs-core.c +1 −6
  123. drivers/media/i2c/dw9768.c +0 −1
  124. drivers/media/i2c/gc0308.c +0 −3
  125. drivers/media/i2c/gc2145.c +0 −3
  126. drivers/media/i2c/imx219.c +0 −2
  127. drivers/media/i2c/imx283.c +0 −3
  128. drivers/media/i2c/imx290.c +0 −3
  129. drivers/media/i2c/imx296.c +0 −1
  130. drivers/media/i2c/imx415.c +0 −1
  131. drivers/media/i2c/mt9m114.c +0 −6
  132. drivers/media/i2c/ov4689.c +0 −3
  133. drivers/media/i2c/ov5640.c +0 −4
  134. drivers/media/i2c/ov5645.c +0 −3
  135. drivers/media/i2c/ov64a40.c +1 −6
  136. drivers/media/i2c/ov8858.c +0 −2
  137. drivers/media/i2c/st-mipid02.c +0 −2
  138. drivers/media/i2c/tc358746.c +0 −5
  139. drivers/media/i2c/thp7312.c +0 −4
  140. drivers/media/i2c/vd55g1.c +0 −4
  141. drivers/media/i2c/vd56g3.c +0 −4
  142. drivers/media/i2c/video-i2c.c +0 −4
  143. drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c +0 −4
  144. drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c +0 −5
  145. drivers/media/platform/nvidia/tegra-vde/h264.c +0 −2
  146. drivers/media/platform/qcom/iris/iris_hfi_queue.c +0 −1
  147. drivers/media/platform/raspberrypi/pisp_be/pisp_be.c +0 −2
  148. drivers/media/platform/rockchip/rkvdec/rkvdec.c +9 −8
  149. drivers/media/platform/verisilicon/hantro_drv.c +0 −1
  150. drivers/media/rc/gpio-ir-recv.c +1 −3
  151. drivers/memstick/core/memstick.c +0 −1
  152. drivers/memstick/host/rtsx_usb_ms.c +1 −0
  153. drivers/mmc/host/sdhci-of-arasan.c +31 −2
  154. drivers/mmc/host/sdhci-pci-gli.c +21 −16
  155. drivers/mmc/host/sdhci_am654.c +18 −0
  156. drivers/most/core.c +1 −1
  157. drivers/net/ethernet/broadcom/bnxt/bnxt.c +30 −6
  158. drivers/net/ethernet/cadence/macb_main.c +4 −7
  159. drivers/net/ethernet/dlink/dl2k.c +1 −1
  160. drivers/net/ethernet/intel/ice/ice.h +1 −0
  161. drivers/net/ethernet/intel/ice/ice_adapter.c +38 −11
  162. drivers/net/ethernet/intel/ice/ice_adapter.h +2 −2
  163. drivers/net/ethernet/intel/ice/ice_ddp.c +32 −12
  164. drivers/net/ethernet/intel/ice/ice_idc.c +6 −4
  165. drivers/net/ethernet/intel/ice/ice_main.c +11 −5
  166. drivers/net/ethernet/intel/ice/ice_txrx.c +1 −1
  167. drivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c +57 −4
  168. drivers/net/ethernet/intel/idpf/idpf_txrx.c +266 −457
  169. drivers/net/ethernet/intel/idpf/idpf_txrx.h +33 −54
  170. drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c +1 −1
  171. drivers/net/ethernet/intel/ixgbe/ixgbe_type_e610.h +1 −1
  172. drivers/net/ethernet/marvell/octeontx2/af/cgx.c +7 −0
  173. drivers/net/ethernet/marvell/octeontx2/af/rvu.h +14 −0
  174. drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +3 −1
  175. drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +1 −0
  176. drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +3 −0
  177. drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c +10 −0
  178. drivers/net/ethernet/marvell/octeontx2/nic/rep.c +12 −1
  179. drivers/net/ethernet/marvell/octeontx2/nic/rep.h +1 −0
  180. drivers/net/ethernet/mellanox/mlx5/core/devlink.c +1 −1
  181. drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c +2 −1
  182. drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.h +12 −0
  183. drivers/net/ethernet/mellanox/mlx5/core/en_main.c +18 −1
  184. drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +7 −8
  185. drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c +73 −53
  186. drivers/net/ethernet/mellanox/mlx5/core/fw_reset.h +1 −0
  187. drivers/net/ethernet/mellanox/mlx5/core/sf/devlink.c +10 −0
  188. drivers/net/ethernet/mellanox/mlx5/core/sf/sf.h +6 −0
  189. drivers/net/ethernet/mellanox/mlx5/core/steering/hws/action.c +1 −1
  190. drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pat_arg.c +4 −2
  191. drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pool.c +1 −0
  192. drivers/net/ethernet/meta/fbnic/fbnic_netdev.c +4 −0
  193. drivers/net/ethernet/meta/fbnic/fbnic_pci.c +6 −9
  194. drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +11 −2
  195. drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +5 −4
  196. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +4 −2
  197. drivers/net/hyperv/netvsc.c +8 −9
  198. drivers/net/hyperv/rndis_filter.c +16 −7
  199. drivers/net/phy/mscc/mscc.h +4 −0
  200. drivers/net/phy/mscc/mscc_main.c +1 −3
  201. drivers/net/phy/mscc/mscc_ptp.c +21 −13
  202. drivers/net/usb/qmi_wwan.c +3 −0
  203. drivers/net/virtio_net.c +4 −3
  204. drivers/of/device.c +2 −2
  205. drivers/of/dynamic.c +7 −2
  206. drivers/of/of_reserved_mem.c +13 −4
  207. drivers/pinctrl/Kconfig +1 −0
  208. drivers/pinctrl/mediatek/pinctrl-airoha.c +4 −4
  209. drivers/pinctrl/meson/pinctrl-amlogic-a4.c +1 −1
  210. drivers/platform/x86/amd/hsmp/acpi.c +1 −1
  211. drivers/platform/x86/amd/hsmp/hsmp.c +5 −0
  212. drivers/platform/x86/amd/pmc/pmc-quirks.c +34 −20
  213. drivers/platform/x86/amd/pmc/pmc.c +0 −13
  214. drivers/platform/x86/dell/dell-smbios-base.c +9 −10
  215. drivers/platform/x86/dell/dell-smbios-smm.c +1 −2
  216. drivers/platform/x86/dell/dell-smbios-wmi.c +1 −3
  217. drivers/platform/x86/dell/dell-smbios.h +1 −1
  218. drivers/platform/x86/hp/hp-wmi.c +2 −2
  219. drivers/platform/x86/intel/int3472/discrete.c +6 −0
  220. drivers/platform/x86/intel/uncore-frequency/uncore-frequency-tpmi.c +5 −0
  221. drivers/regulator/pca9450-regulator.c +5 −8
  222. drivers/regulator/tps65219-regulator.c +6 −6
  223. drivers/s390/char/sclp.c +9 −2
  224. drivers/scsi/fnic/fnic.h +0 −2
  225. drivers/scsi/qla4xxx/ql4_os.c +2 −0
  226. drivers/spi/spi-fsl-lpspi.c +3 −5
  227. drivers/spi/spi-mem.c +4 −0
  228. drivers/spi/spi-qpic-snand.c +15 −7
  229. drivers/spi/spi-st-ssc4.c +5 −5
  230. drivers/ufs/core/ufshcd.c +44 −32
  231. drivers/ufs/host/ufs-qcom.c +15 −24
  232. drivers/ufs/host/ufshcd-pci.c +1 −0
  233. drivers/usb/chipidea/ci_hdrc_imx.c +2 −1
  234. drivers/usb/chipidea/usbmisc_imx.c +16 −7
  235. drivers/usb/core/hcd.c +16 −12
  236. drivers/usb/core/quirks.c +1 −0
  237. drivers/usb/dwc3/dwc3-pci.c +2 −0
  238. drivers/usb/dwc3/ep0.c +16 −4
  239. drivers/usb/dwc3/gadget.c +17 −2
  240. drivers/usb/gadget/udc/tegra-xudc.c +7 −2
  241. drivers/usb/host/xhci-hub.c +1 −2
  242. drivers/usb/host/xhci-mem.c +11 −11
  243. drivers/usb/host/xhci-pci-renesas.c +4 −3
  244. drivers/usb/host/xhci-ring.c +7 −2
  245. drivers/usb/host/xhci.c +16 −7
  246. drivers/usb/host/xhci.h +2 −1
  247. drivers/usb/storage/realtek_cr.c +1 −1
  248. drivers/usb/storage/unusual_devs.h +29 −0
  249. drivers/usb/typec/tcpm/fusb302.c +8 −4
  250. drivers/usb/typec/tcpm/maxim_contaminant.c +58 −0
  251. drivers/usb/typec/tcpm/tcpci_maxim.h +1 −0
  252. drivers/vhost/net.c +7 −2
  253. drivers/virtio/virtio_input.c +4 −0
  254. drivers/virtio/virtio_pci_legacy_dev.c +2 −2
  255. drivers/virtio/virtio_pci_modern_dev.c +2 −2
  256. drivers/xen/xenbus/xenbus_xs.c +0 −23
  257. fs/debugfs/inode.c +10 −1
  258. fs/nfs/pagelist.c +5 −4
  259. fs/nfs/write.c +10 −19
  260. fs/smb/client/smb2ops.c +1 −1
  261. fs/squashfs/super.c +7 −7
  262. include/linux/atmdev.h +1 −0
  263. include/linux/blkdev.h +1 −0
  264. include/linux/compiler.h +0 −8
  265. include/linux/dma-map-ops.h +3 −0
  266. include/linux/iosys-map.h +1 −6
  267. include/linux/iov_iter.h +11 −9
  268. include/linux/kcov.h +9 −38
  269. include/linux/memblock.h +3 −2
  270. include/linux/migrate.h +5 −0
  271. include/linux/nfs_page.h +1 −0
  272. include/linux/platform_data/x86/int3472.h +1 −0
  273. include/linux/skbuff.h +2 −0
  274. include/linux/virtio_config.h +0 −2
  275. include/net/bluetooth/hci_sync.h +1 −1
  276. include/net/rose.h +17 −1
  277. include/sound/cs35l56.h +3 −2
  278. include/sound/tas2781-tlv.h +3 −3
  279. include/uapi/linux/pfrut.h +1 −0
  280. include/uapi/linux/raid/md_p.h +1 −1
  281. include/uapi/linux/vhost.h +2 −2
  282. io_uring/futex.c +3 −0
  283. io_uring/io_uring.c +1 −0
  284. kernel/Kconfig.kexec +1 −0
  285. kernel/cgroup/cpuset.c +5 −6
  286. kernel/cgroup/rstat.c +3 −0
  287. kernel/dma/contiguous.c +0 −2
  288. kernel/dma/pool.c +2 −2
  289. kernel/events/core.c +6 −0
  290. kernel/kexec_handover.c +25 −4
  291. kernel/params.c +4 −3
  292. kernel/sched/ext.c +4 −0
  293. kernel/trace/fgraph.c +1 −0
  294. kernel/trace/ftrace.c +10 −9
  295. kernel/trace/ring_buffer.c +1 −1
  296. kernel/trace/trace.c +14 −8
  297. kernel/trace/trace.h +7 −1
  298. kernel/trace/trace_functions_graph.c +16 −6
  299. mm/balloon_compaction.c +6 −0
  300. mm/damon/core.c +14 −1
  301. mm/damon/sysfs-schemes.c +1 −1
  302. mm/debug_vm_pgtable.c +7 −2
  303. mm/memblock.c +13 −6
  304. mm/memory-failure.c +8 −0
  305. mm/migrate.c +30 −8
  306. mm/mremap.c +47 −35
  307. mm/numa_emulation.c +2 −2
  308. mm/numa_memblks.c +3 −3
  309. mm/vmscan.c +2 −2
  310. mm/zsmalloc.c +10 −0
  311. net/atm/common.c +12 −3
  312. net/bluetooth/hci_conn.c +41 −17
  313. net/bluetooth/hci_event.c +23 −2
  314. net/bluetooth/hci_sync.c +3 −3
  315. net/bluetooth/mgmt.c +7 −2
  316. net/core/datagram.c +14 −0
  317. net/core/page_pool.c +4 −2
  318. net/ipv4/route.c +7 −3
  319. net/l2tp/l2tp_ppp.c +8 −17
  320. net/rose/af_rose.c +7 −6
  321. net/rose/rose_in.c +6 −6
  322. net/rose/rose_route.c +38 −24
  323. net/rose/rose_timer.c +1 −1
  324. net/sctp/ipv6.c +2 −0
  325. net/vmw_vsock/virtio_transport_common.c +5 −3
  326. rust/kernel/alloc/allocator.rs +18 −12
  327. rust/kernel/alloc/allocator_test.rs +11 −0
  328. rust/kernel/device.rs +184 −24
  329. rust/kernel/devres.rs +18 −9
  330. rust/kernel/driver.rs +87 −2
  331. rust/kernel/drm/device.rs +25 −7
  332. rust/kernel/faux.rs +1 −1
  333. sound/core/timer.c +2 −2
  334. sound/hda/codecs/realtek/alc269.c +22 −9
  335. sound/hda/codecs/side-codecs/tas2781_hda_i2c.c +2 −2
  336. sound/hda/codecs/side-codecs/tas2781_hda_spi.c +4 −2
  337. sound/soc/codecs/cs35l56-sdw.c +0 −69
  338. sound/soc/codecs/cs35l56-shared.c +26 −3
  339. sound/soc/codecs/cs35l56.c +1 −1
  340. sound/soc/codecs/cs35l56.h +0 −3
  341. sound/soc/codecs/es8389.c +1 −1
  342. sound/soc/codecs/tas2781-i2c.c +2 −2
  343. sound/usb/stream.c +1 −1
  344. sound/usb/validate.c +1 −1
  345. tools/arch/arm64/include/asm/cputype.h +28 −0
  346. tools/arch/powerpc/include/uapi/asm/kvm.h +0 −13
  347. tools/arch/x86/include/asm/cpufeatures.h +9 −1
  348. tools/arch/x86/include/asm/msr-index.h +7 −0
  349. tools/arch/x86/include/uapi/asm/kvm.h +7 −1
  350. tools/include/linux/args.h +28 −0
  351. tools/include/linux/bits.h +6 −23
  352. tools/include/linux/cfi_types.h +23 −0
  353. tools/include/uapi/asm-generic/unistd.h +7 −1
  354. tools/include/uapi/linux/kvm.h +27 −0
  355. tools/perf/arch/arm/entry/syscalls/syscall.tbl +2 −0
  356. tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl +2 −0
  357. tools/perf/arch/powerpc/entry/syscalls/syscall.tbl +2 −0
  358. tools/perf/arch/s390/entry/syscalls/syscall.tbl +2 −0
  359. tools/perf/arch/sh/entry/syscalls/syscall.tbl +2 −0
  360. tools/perf/arch/sparc/entry/syscalls/syscall.tbl +2 −0
  361. tools/perf/arch/x86/entry/syscalls/syscall_32.tbl +2 −0
  362. tools/perf/arch/x86/entry/syscalls/syscall_64.tbl +2 −0
  363. tools/perf/arch/x86/tests/topdown.c +1 −0
  364. tools/perf/arch/xtensa/entry/syscalls/syscall.tbl +2 −0
  365. tools/perf/bench/inject-buildid.c +1 −1
  366. tools/perf/builtin-buildid-cache.c +4 −4
  367. tools/perf/builtin-inject.c +2 −2
  368. tools/perf/tests/sdt.c +1 −1
  369. tools/perf/trace/beauty/include/uapi/linux/fcntl.h +18 −0
  370. tools/perf/trace/beauty/include/uapi/linux/fs.h +88 −0
  371. tools/perf/trace/beauty/include/uapi/linux/prctl.h +8 −1
  372. tools/perf/trace/beauty/include/uapi/linux/vhost.h +35 −0
  373. tools/perf/util/build-id.c +2 −2
  374. tools/perf/util/debuginfo.c +6 −2
  375. tools/perf/util/dsos.c +2 −2
  376. tools/perf/util/symbol-elf.c +5 −4
  377. tools/perf/util/symbol-minimal.c +29 −30
  378. tools/perf/util/symbol.c +4 −4
  379. tools/perf/util/symbol.h +1 −1
  380. tools/perf/util/synthetic-events.c +1 −1
  381. tools/power/cpupower/man/cpupower-set.1 +4 −3
  382. tools/power/cpupower/utils/cpufreq-info.c +15 −1
  383. tools/power/cpupower/utils/cpupower-set.c +3 −2
  384. tools/power/cpupower/utils/helpers/helpers.h +7 −7
  385. tools/power/cpupower/utils/helpers/misc.c +54 −22
  386. tools/scripts/syscall.tbl +2 −0
  387. tools/testing/selftests/damon/Makefile +1 −0
  388. tools/testing/selftests/mm/mremap_test.c +261 −3
  389. tools/testing/selftests/sched_ext/hotplug.c +0 −1
  390. tools/testing/selftests/ublk/kublk.c +2 −2
  391. tools/testing/shared/linux/idr.h +4 −0
  392. tools/tracing/latency/Makefile.config +8 −0
  393. tools/tracing/rtla/Makefile.config +8 −0
.mailmap+2−0
@@ -226,6 +226,8 @@ Domen Puncer <domen@coderock.org> · 225 unmodified lines
226226 Douglas Gilbert <dougg@torque.net>
227227 Drew Fustini <fustini@kernel.org> <drew@pdp7.com>
228228 <duje@dujemihanovic.xyz> <duje.mihanovic@skole.hr>
229+Easwar Hariharan <easwar.hariharan@linux.microsoft.com> <easwar.hariharan@intel.com>
230+Easwar Hariharan <easwar.hariharan@linux.microsoft.com> <eahariha@linux.microsoft.com>
229231 Ed L. Cashin <ecashin@coraid.com>
230232 Elliot Berman <quic_eberman@quicinc.com> <eberman@codeaurora.org>
231233 Enric Balletbo i Serra <eballetbo@kernel.org> <enric.balletbo@collabora.com>
CREDITS+7−0
@@ -3222,6 +3222,10 @@ D: AIC5800 IEEE 1394, RAW I/O on 1394 · 3221 unmodified lines
32223222 D: Starter of Linux1394 effort
32233223 S: ask per mail for current address
32243224
3225+N: Boris Pismenny
3226+E: borisp@mellanox.com
3227+D: Kernel TLS implementation and offload support.
3228+
32253229 N: Nicolas Pitre
32263230 E: nico@fluxnic.net
32273231 D: StrongARM SA1100 support integrator & hacker
@@ -4168,6 +4172,9 @@ S: 1513 Brewster Dr. · 940 unmodified lines
41684172 S: Carrollton, TX 75010
41694173 S: USA
41704174
4175+N: Dave Watson
4176+D: Kernel TLS implementation.
4177+
41714178 N: Tim Waugh
41724179 E: tim@cyberelk.net
41734180 D: Co-architect of the parallel-port sharing system
Documentation/admin-guide/cgroup-v2.rst+2−2
@@ -435,8 +435,8 @@ both cgroups. · 434 unmodified lines
435435 Controlling Controllers
436436 -----------------------
437437
438−Availablity
439−~~~~~~~~~~~
438+Availability
439+~~~~~~~~~~~~
440440
441441 A controller is available in a cgroup when it is supported by the kernel (i.e.,
442442 compiled in, not disabled and not attached to a v1 hierarchy) and listed in the
Documentation/devicetree/bindings/regulator/infineon,ir38060.yaml+1−1
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# · 6 unmodified lines
77 title: Infineon Buck Regulators with PMBUS interfaces
88
99 maintainers:
10− - Not Me.
10+ - Guenter Roeck <linux@roeck-us.net>
1111
1212 allOf:
1313 - $ref: regulator.yaml#
Documentation/devicetree/bindings/vendor-prefixes.yaml+2−0
@@ -507,6 +507,8 @@ patternProperties: · 506 unmodified lines
507507 description: Espressif Systems Co. Ltd.
508508 "^est,.*":
509509 description: ESTeem Wireless Modems
510+ "^eswin,.*":
511+ description: Beijing ESWIN Technology Group Co. Ltd.
510512 "^ettus,.*":
511513 description: NI Ettus Research
512514 "^eukrea,.*":
Documentation/process/security-bugs.rst+16−9
@@ -8,8 +8,22 @@ like to know when a security bug is found so that it can be fixed and · 7 unmodified lines
88 disclosed as quickly as possible. Please report security bugs to the
99 Linux kernel security team.
1010
11−Contact
12−-------
11+The security team and maintainers almost always require additional
12+information beyond what was initially provided in a report and rely on
13+active and efficient collaboration with the reporter to perform further
14+testing (e.g., verifying versions, configuration options, mitigations, or
15+patches). Before contacting the security team, the reporter must ensure
16+they are available to explain their findings, engage in discussions, and
17+run additional tests. Reports where the reporter does not respond promptly
18+or cannot effectively discuss their findings may be abandoned if the
19+communication does not quickly improve.
20+
21+As it is with any bug, the more information provided the easier it
22+will be to diagnose and fix. Please review the procedure outlined in
23+'Documentation/admin-guide/reporting-issues.rst' if you are unclear about what
24+information is helpful. Any exploit code is very helpful and will not
25+be released without consent from the reporter unless it has already been
26+made public.
1327
1428 The Linux kernel security team can be contacted by email at
1529 <security@kernel.org>. This is a private list of security officers
@@ -19,13 +33,6 @@ that can speed up the process considerably. It is possible that the · 3 unmodified lines
1933 security team will bring in extra help from area maintainers to
2034 understand and fix the security vulnerability.
2135
22−As it is with any bug, the more information provided the easier it
23−will be to diagnose and fix. Please review the procedure outlined in
24−'Documentation/admin-guide/reporting-issues.rst' if you are unclear about what
25−information is helpful. Any exploit code is very helpful and will not
26−be released without consent from the reporter unless it has already been
27−made public.
28−
2936 Please send plain text emails without attachments where possible.
3037 It is much harder to have a context-quoted discussion about a complex
3138 issue if all the details are hidden away in attachments. Think of it like a
Documentation/userspace-api/iommufd.rst+2−2
@@ -43,7 +43,7 @@ Following IOMMUFD objects are exposed to userspace: · 42 unmodified lines
4343
4444 - IOMMUFD_OBJ_HWPT_PAGING, representing an actual hardware I/O page table
4545 (i.e. a single struct iommu_domain) managed by the iommu driver. "PAGING"
46− primarly indicates this type of HWPT should be linked to an IOAS. It also
46+ primarily indicates this type of HWPT should be linked to an IOAS. It also
4747 indicates that it is backed by an iommu_domain with __IOMMU_DOMAIN_PAGING
4848 feature flag. This can be either an UNMANAGED stage-1 domain for a device
4949 running in the user space, or a nesting parent stage-2 domain for mappings
@@ -76,7 +76,7 @@ Following IOMMUFD objects are exposed to userspace: · 26 unmodified lines
7676
7777 * Security namespace for guest owned ID, e.g. guest-controlled cache tags
7878 * Non-device-affiliated event reporting, e.g. invalidation queue errors
79− * Access to a sharable nesting parent pagetable across physical IOMMUs
79+ * Access to a shareable nesting parent pagetable across physical IOMMUs
8080 * Virtualization of various platforms IDs, e.g. RIDs and others
8181 * Delivery of paravirtualized invalidation
8282 * Direct assigned invalidation queues
MAINTAINERS+37−8
@@ -937,7 +937,7 @@ S: Maintained · 936 unmodified lines
937937 F: drivers/gpio/gpio-altera.c
938938
939939 ALTERA TRIPLE SPEED ETHERNET DRIVER
940−M: Joyce Ooi <joyce.ooi@intel.com>
940+M: Boon Khai Ng <boon.khai.ng@altera.com>
941941 L: netdev@vger.kernel.org
942942 S: Maintained
943943 F: drivers/net/ethernet/altera/
@@ -4216,7 +4216,7 @@ F: drivers/md/bcache/ · 3272 unmodified lines
42164216 BCACHEFS
42174217 M: Kent Overstreet <kent.overstreet@linux.dev>
42184218 L: linux-bcachefs@vger.kernel.org
4219−S: Supported
4219+S: Externally maintained
42204220 C: irc://irc.oftc.net/bcache
42214221 P: Documentation/filesystems/bcachefs/SubmittingPatches.rst
42224222 T: git https://evilpiepirate.org/git/bcachefs.git
@@ -8427,6 +8427,17 @@ T: git https://gitlab.freedesktop.org/drm/misc/kernel.git · 4204 unmodified lines
84278427 F: drivers/gpu/drm/scheduler/
84288428 F: include/drm/gpu_scheduler.h
84298429
8430+DRM GPUVM
8431+M: Danilo Krummrich <dakr@kernel.org>
8432+R: Matthew Brost <matthew.brost@intel.com>
8433+R: Thomas Hellström <thomas.hellstrom@linux.intel.com>
8434+R: Alice Ryhl <aliceryhl@google.com>
8435+L: dri-devel@lists.freedesktop.org
8436+S: Supported
8437+T: git https://gitlab.freedesktop.org/drm/misc/kernel.git
8438+F: drivers/gpu/drm/drm_gpuvm.c
8439+F: include/drm/drm_gpuvm.h
8440+
84308441 DRM LOG
84318442 M: Jocelyn Falempe <jfalempe@redhat.com>
84328443 M: Javier Martinez Canillas <javierm@redhat.com>
@@ -10656,7 +10667,8 @@ S: Maintained · 2223 unmodified lines
1065610667 F: block/partitions/efi.*
1065710668
1065810669 HABANALABS PCI DRIVER
10659−M: Yaron Avizrat <yaron.avizrat@intel.com>
10670+M: Koby Elbaz <koby.elbaz@intel.com>
10671+M: Konstantin Sinyuk <konstantin.sinyuk@intel.com>
1066010672 L: dri-devel@lists.freedesktop.org
1066110673 S: Supported
1066210674 C: irc://irc.oftc.net/dri-devel
@@ -11014,7 +11026,7 @@ F: Documentation/admin-guide/perf/hns3-pmu.rst · 351 unmodified lines
1101411026 F: drivers/perf/hisilicon/hns3_pmu.c
1101511027
1101611028 HISILICON I2C CONTROLLER DRIVER
11017−M: Yicong Yang <yangyicong@hisilicon.com>
11029+M: Devyn Liu <liudingyuan@h-partners.com>
1101811030 L: linux-i2c@vger.kernel.org
1101911031 S: Maintained
1102011032 W: https://www.hisilicon.com
@@ -12282,7 +12294,6 @@ F: include/linux/avf/virtchnl.h · 1261 unmodified lines
1228212294 F: include/linux/net/intel/*/
1228312295
1228412296 INTEL ETHERNET PROTOCOL DRIVER FOR RDMA
12285−M: Mustafa Ismail <mustafa.ismail@intel.com>
1228612297 M: Tatyana Nikolova <tatyana.e.nikolova@intel.com>
1228712298 L: linux-rdma@vger.kernel.org
1228812299 S: Supported
@@ -16059,6 +16070,23 @@ F: mm/mempolicy.c · 3770 unmodified lines
1605916070 F: mm/migrate.c
1606016071 F: mm/migrate_device.c
1606116072
16073+MEMORY MANAGEMENT - MGLRU (MULTI-GEN LRU)
16074+M: Andrew Morton <akpm@linux-foundation.org>
16075+M: Axel Rasmussen <axelrasmussen@google.com>
16076+M: Yuanchu Xie <yuanchu@google.com>
16077+R: Wei Xu <weixugc@google.com>
16078+L: linux-mm@kvack.org
16079+S: Maintained
16080+W: http://www.linux-mm.org
16081+T: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
16082+F: Documentation/admin-guide/mm/multigen_lru.rst
16083+F: Documentation/mm/multigen_lru.rst
16084+F: include/linux/mm_inline.h
16085+F: include/linux/mmzone.h
16086+F: mm/swap.c
16087+F: mm/vmscan.c
16088+F: mm/workingset.c
16089+
1606216090 MEMORY MANAGEMENT - MISC
1606316091 M: Andrew Morton <akpm@linux-foundation.org>
1606416092 M: David Hildenbrand <david@redhat.com>
@@ -16249,8 +16277,10 @@ S: Maintained · 184 unmodified lines
1624916277 W: http://www.linux-mm.org
1625016278 T: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
1625116279 F: rust/helpers/mm.c
16280+F: rust/helpers/page.c
1625216281 F: rust/kernel/mm.rs
1625316282 F: rust/kernel/mm/
16283+F: rust/kernel/page.rs
1625416284
1625516285 MEMORY MAPPING
1625616286 M: Andrew Morton <akpm@linux-foundation.org>
@@ -17819,7 +17849,6 @@ F: net/ipv6/syncookies.c · 1562 unmodified lines
1781917849 F: net/ipv6/tcp*.c
1782017850
1782117851 NETWORKING [TLS]
17822−M: Boris Pismenny <borisp@nvidia.com>
1782317852 M: John Fastabend <john.fastabend@gmail.com>
1782417853 M: Jakub Kicinski <kuba@kernel.org>
1782517854 L: netdev@vger.kernel.org
@@ -20857,8 +20886,8 @@ S: Maintained · 3031 unmodified lines
2085720886 F: drivers/firmware/qcom/qcom_qseecom_uefisecapp.c
2085820887
2085920888 QUALCOMM RMNET DRIVER
20860−M: Subash Abhinov Kasiviswanathan <quic_subashab@quicinc.com>
20861−M: Sean Tranchetti <quic_stranche@quicinc.com>
20889+M: Subash Abhinov Kasiviswanathan <subash.a.kasiviswanathan@oss.qualcomm.com>
20890+M: Sean Tranchetti <sean.tranchetti@oss.qualcomm.com>
2086220891 L: netdev@vger.kernel.org
2086320892 S: Maintained
2086420893 F: Documentation/networking/device_drivers/cellular/qualcomm/rmnet.rst
Makefile+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 VERSION = 6
33 PATCHLEVEL = 17
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc2
5+EXTRAVERSION = -rc3
66 NAME = Baby Opossum Posse
77
88 # *DOCUMENTATION*
arch/mips/boot/dts/lantiq/danube_easy50712.dts+4−1
@@ -82,13 +82,16 @@ · 81 unmodified lines
8282 };
8383 };
8484
85− etop@e180000 {
85+ ethernet@e180000 {
8686 compatible = "lantiq,etop-xway";
8787 reg = <0xe180000 0x40000>;
8888 interrupt-parent = <&icu0>;
8989 interrupts = <73 78>;
90+ interrupt-names = "tx", "rx";
9091 phy-mode = "rmii";
9192 mac-address = [ 00 11 22 33 44 55 ];
93+ lantiq,rx-burst-length = <4>;
94+ lantiq,tx-burst-length = <4>;
9295 };
9396
9497 stp0: stp@e100bb0 {
arch/mips/lantiq/xway/sysctrl.c+5−5
@@ -497,7 +497,7 @@ void __init ltq_soc_init(void) · 496 unmodified lines
497497 ifccr = CGU_IFCCR_VR9;
498498 pcicr = CGU_PCICR_VR9;
499499 } else {
500− clkdev_add_pmu("1e180000.etop", NULL, 1, 0, PMU_PPE);
500+ clkdev_add_pmu("1e180000.ethernet", NULL, 1, 0, PMU_PPE);
501501 }
502502
503503 if (!of_machine_is_compatible("lantiq,ase"))
@@ -531,9 +531,9 @@ void __init ltq_soc_init(void) · 27 unmodified lines
531531 CLOCK_133M, CLOCK_133M);
532532 clkdev_add_pmu("1e101000.usb", "otg", 1, 0, PMU_USB0);
533533 clkdev_add_pmu("1f203018.usb2-phy", "phy", 1, 0, PMU_USB0_P);
534− clkdev_add_pmu("1e180000.etop", "ppe", 1, 0, PMU_PPE);
535− clkdev_add_cgu("1e180000.etop", "ephycgu", CGU_EPHY);
536− clkdev_add_pmu("1e180000.etop", "ephy", 1, 0, PMU_EPHY);
534+ clkdev_add_pmu("1e180000.ethernet", "ppe", 1, 0, PMU_PPE);
535+ clkdev_add_cgu("1e180000.ethernet", "ephycgu", CGU_EPHY);
536+ clkdev_add_pmu("1e180000.ethernet", "ephy", 1, 0, PMU_EPHY);
537537 clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_ASE_SDIO);
538538 clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE);
539539 } else if (of_machine_is_compatible("lantiq,grx390")) {
@@ -592,7 +592,7 @@ void __init ltq_soc_init(void) · 52 unmodified lines
592592 clkdev_add_pmu("1e101000.usb", "otg", 1, 0, PMU_USB0 | PMU_AHBM);
593593 clkdev_add_pmu("1f203034.usb2-phy", "phy", 1, 0, PMU_USB1_P);
594594 clkdev_add_pmu("1e106000.usb", "otg", 1, 0, PMU_USB1 | PMU_AHBM);
595− clkdev_add_pmu("1e180000.etop", "switch", 1, 0, PMU_SWITCH);
595+ clkdev_add_pmu("1e180000.ethernet", "switch", 1, 0, PMU_SWITCH);
596596 clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_SDIO);
597597 clkdev_add_pmu("1e103100.deu", NULL, 1, 0, PMU_DEU);
598598 clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE);
arch/powerpc/boot/Makefile+3−3
@@ -243,13 +243,13 @@ $(obj)/wrapper.a: $(obj-wlib) FORCE · 242 unmodified lines
243243 hostprogs := addnote hack-coff mktree
244244
245245 targets += $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a) zImage.lds
246−extra-y := $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \
246+always-y := $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \
247247 $(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds
248248
249249 dtstree := $(src)/dts
250250
251251 wrapper := $(src)/wrapper
252−wrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree) \
252+wrapperbits := $(always-y) $(addprefix $(obj)/,addnote hack-coff mktree) \
253253 $(wrapper) FORCE
254254
255255 #############
@@ -456,7 +456,7 @@ WRAPPER_DTSDIR := /usr/lib/kernel-wrapper/dts · 200 unmodified lines
456456 WRAPPER_BINDIR := /usr/sbin
457457 INSTALL := install
458458
459−extra-installed := $(patsubst $(obj)/%, $(DESTDIR)$(WRAPPER_OBJDIR)/%, $(extra-y))
459+extra-installed := $(patsubst $(obj)/%, $(DESTDIR)$(WRAPPER_OBJDIR)/%, $(always-y))
460460 hostprogs-installed := $(patsubst %, $(DESTDIR)$(WRAPPER_BINDIR)/%, $(hostprogs))
461461 wrapper-installed := $(DESTDIR)$(WRAPPER_BINDIR)/wrapper
462462 dts-installed := $(patsubst $(dtstree)/%, $(DESTDIR)$(WRAPPER_DTSDIR)/%, $(wildcard $(dtstree)/*.dts))
arch/powerpc/boot/install.sh+7−7
@@ -19,19 +19,19 @@ · 18 unmodified lines
1919 set -e
2020
2121 # this should work for both the pSeries zImage and the iSeries vmlinux.sm
22−image_name=`basename $2`
22+image_name=$(basename "$2")
2323
2424
2525 echo "Warning: '${INSTALLKERNEL}' command not available... Copying" \
2626 "directly to $4/$image_name-$1" >&2
2727
28−if [ -f $4/$image_name-$1 ]; then
29− mv $4/$image_name-$1 $4/$image_name-$1.old
28+if [ -f "$4"/"$image_name"-"$1" ]; then
29+ mv "$4"/"$image_name"-"$1" "$4"/"$image_name"-"$1".old
3030 fi
3131
32−if [ -f $4/System.map-$1 ]; then
33− mv $4/System.map-$1 $4/System-$1.old
32+if [ -f "$4"/System.map-"$1" ]; then
33+ mv "$4"/System.map-"$1" "$4"/System-"$1".old
3434 fi
3535
36−cat $2 > $4/$image_name-$1
37−cp $3 $4/System.map-$1
36+cat "$2" > "$4"/"$image_name"-"$1"
37+cp "$3" "$4"/System.map-"$1"
arch/powerpc/kernel/Makefile+3−1
@@ -199,7 +199,9 @@ obj-$(CONFIG_ALTIVEC) += vector.o · 198 unmodified lines
199199
200200 obj-$(CONFIG_PPC_OF_BOOT_TRAMPOLINE) += prom_init.o
201201 obj64-$(CONFIG_PPC_OF_BOOT_TRAMPOLINE) += prom_entry_64.o
202−extra-$(CONFIG_PPC_OF_BOOT_TRAMPOLINE) += prom_init_check
202+ifdef KBUILD_BUILTIN
203+always-$(CONFIG_PPC_OF_BOOT_TRAMPOLINE) += prom_init_check
204+endif
203205
204206 obj-$(CONFIG_PPC64) += $(obj64-y)
205207 obj-$(CONFIG_PPC32) += $(obj32-y)
arch/powerpc/kernel/kvm.c+4−4
@@ -632,19 +632,19 @@ static void __init kvm_check_ins(u32 *inst, u32 features) · 631 unmodified lines
632632 #endif
633633 }
634634
635− switch (inst_no_rt & ~KVM_MASK_RB) {
636635 #ifdef CONFIG_PPC_BOOK3S_32
636+ switch (inst_no_rt & ~KVM_MASK_RB) {
637637 case KVM_INST_MTSRIN:
638638 if (features & KVM_MAGIC_FEAT_SR) {
639639 u32 inst_rb = _inst & KVM_MASK_RB;
640640 kvm_patch_ins_mtsrin(inst, inst_rt, inst_rb);
641641 }
642642 break;
643−#endif
644643 }
644+#endif
645645
646− switch (_inst) {
647646 #ifdef CONFIG_BOOKE
647+ switch (_inst) {
648648 case KVM_INST_WRTEEI_0:
649649 kvm_patch_ins_wrteei_0(inst);
650650 break;
@@ -652,8 +652,8 @@ static void __init kvm_check_ins(u32 *inst, u32 features) · 1 unmodified line
652652 case KVM_INST_WRTEEI_1:
653653 kvm_patch_ins_wrtee(inst, 0, 1);
654654 break;
655−#endif
656655 }
656+#endif
657657 }
658658
659659 extern u32 kvm_template_start[];
arch/powerpc/kernel/prom_init_check.sh+8−8
@@ -15,8 +15,8 @@ · 14 unmodified lines
1515
1616 has_renamed_memintrinsics()
1717 {
18− grep -q "^CONFIG_KASAN=y$" ${KCONFIG_CONFIG} && \
19− ! grep -q "^CONFIG_CC_HAS_KASAN_MEMINTRINSIC_PREFIX=y" ${KCONFIG_CONFIG}
18+ grep -q "^CONFIG_KASAN=y$" "${KCONFIG_CONFIG}" && \
19+ ! grep -q "^CONFIG_CC_HAS_KASAN_MEMINTRINSIC_PREFIX=y" "${KCONFIG_CONFIG}"
2020 }
2121
2222 if has_renamed_memintrinsics
@@ -42,15 +42,15 @@ check_section() · 19 unmodified lines
4242 {
4343 file=$1
4444 section=$2
45− size=$(objdump -h -j $section $file 2>/dev/null | awk "\$2 == \"$section\" {print \$3}")
45+ size=$(objdump -h -j "$section" "$file" 2>/dev/null | awk "\$2 == \"$section\" {print \$3}")
4646 size=${size:-0}
47− if [ $size -ne 0 ]; then
47+ if [ "$size" -ne 0 ]; then
4848 ERROR=1
4949 echo "Error: Section $section not empty in prom_init.c" >&2
5050 fi
5151 }
5252
53−for UNDEF in $($NM -u $OBJ | awk '{print $2}')
53+for UNDEF in $($NM -u "$OBJ" | awk '{print $2}')
5454 do
5555 # On 64-bit nm gives us the function descriptors, which have
5656 # a leading . on the name, so strip it off here.
@@ -87,8 +87,8 @@ do · 30 unmodified lines
8787 fi
8888 done
8989
90−check_section $OBJ .data
91−check_section $OBJ .bss
92−check_section $OBJ .init.data
90+check_section "$OBJ" .data
91+check_section "$OBJ" .bss
92+check_section "$OBJ" .init.data
9393
9494 exit $ERROR
arch/powerpc/kernel/setup_64.c+1−4
@@ -141,10 +141,7 @@ void __init check_smt_enabled(void) · 140 unmodified lines
141141 smt_enabled_at_boot = 0;
142142 else {
143143 int smt;
144− int rc;
145−
146− rc = kstrtoint(smt_enabled_cmdline, 10, &smt);
147− if (!rc)
144+ if (!kstrtoint(smt_enabled_cmdline, 10, &smt))
148145 smt_enabled_at_boot =
149146 min(threads_per_core, smt);
150147 }
arch/powerpc/kvm/powerpc.c+1−1
@@ -69,7 +69,7 @@ int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu) · 68 unmodified lines
6969
7070 /*
7171 * Common checks before entering the guest world. Call with interrupts
72− * disabled.
72+ * enabled.
7373 *
7474 * returns:
7575 *
arch/powerpc/platforms/8xx/cpm1-ic.c+1−2
@@ -110,8 +110,7 @@ static int cpm_pic_probe(struct platform_device *pdev) · 109 unmodified lines
110110
111111 out_be32(&data->reg->cpic_cimr, 0);
112112
113− data->host = irq_domain_create_linear(of_fwnode_handle(dev->of_node),
114− 64, &cpm_pic_host_ops, data);
113+ data->host = irq_domain_create_linear(dev_fwnode(dev), 64, &cpm_pic_host_ops, data);
115114 if (!data->host)
116115 return -ENODEV;
117116
arch/powerpc/platforms/Kconfig.cputype+4−9
@@ -122,16 +122,11 @@ choice · 121 unmodified lines
122122 If unsure, select Generic.
123123
124124 config POWERPC64_CPU
125− bool "Generic (POWER5 and PowerPC 970 and above)"
126− depends on PPC_BOOK3S_64 && !CPU_LITTLE_ENDIAN
127− select PPC_64S_HASH_MMU
128−
129−config POWERPC64_CPU
130− bool "Generic (POWER8 and above)"
131− depends on PPC_BOOK3S_64 && CPU_LITTLE_ENDIAN
132− select ARCH_HAS_FAST_MULTIPLIER
125+ bool "Generic 64 bits powerpc"
126+ depends on PPC_BOOK3S_64
127+ select ARCH_HAS_FAST_MULTIPLIER if CPU_LITTLE_ENDIAN
133128 select PPC_64S_HASH_MMU
134− select PPC_HAS_LBARX_LHARX
129+ select PPC_HAS_LBARX_LHARX if CPU_LITTLE_ENDIAN
135130
136131 config POWERPC_CPU
137132 bool "Generic 32 bits powerpc"
arch/powerpc/sysdev/fsl_msi.c+2−3
@@ -412,9 +412,8 @@ static int fsl_of_msi_probe(struct platform_device *dev) · 411 unmodified lines
412412 }
413413 platform_set_drvdata(dev, msi);
414414
415− msi->irqhost = irq_domain_create_linear(of_fwnode_handle(dev->dev.of_node),
416− NR_MSI_IRQS_MAX, &fsl_msi_host_ops, msi);
417−
415+ msi->irqhost = irq_domain_create_linear(dev_fwnode(&dev->dev), NR_MSI_IRQS_MAX,
416+ &fsl_msi_host_ops, msi);
418417 if (msi->irqhost == NULL) {
419418 dev_err(&dev->dev, "No memory for MSI irqhost\n");
420419 err = -ENOMEM;
arch/s390/boot/vmem.c+3−0
@@ -530,6 +530,9 @@ void setup_vmem(unsigned long kernel_start, unsigned long kernel_end, unsigned l · 529 unmodified lines
530530 lowcore_address + sizeof(struct lowcore),
531531 POPULATE_LOWCORE);
532532 for_each_physmem_usable_range(i, &start, &end) {
533+ /* Do not map lowcore with identity mapping */
534+ if (!start)
535+ start = sizeof(struct lowcore);
533536 pgtable_populate((unsigned long)__identity_va(start),
534537 (unsigned long)__identity_va(end),
535538 POPULATE_IDENTITY);
arch/s390/configs/debug_defconfig+16−17
@@ -5,6 +5,7 @@ CONFIG_WATCH_QUEUE=y · 4 unmodified lines
55 CONFIG_AUDIT=y
66 CONFIG_NO_HZ_IDLE=y
77 CONFIG_HIGH_RES_TIMERS=y
8+CONFIG_POSIX_AUX_CLOCKS=y
89 CONFIG_BPF_SYSCALL=y
910 CONFIG_BPF_JIT=y
1011 CONFIG_BPF_JIT_ALWAYS_ON=y
@@ -19,6 +20,7 @@ CONFIG_TASK_XACCT=y · 8 unmodified lines
1920 CONFIG_TASK_IO_ACCOUNTING=y
2021 CONFIG_IKCONFIG=y
2122 CONFIG_IKCONFIG_PROC=y
23+CONFIG_SCHED_PROXY_EXEC=y
2224 CONFIG_NUMA_BALANCING=y
2325 CONFIG_MEMCG=y
2426 CONFIG_BLK_CGROUP=y
@@ -42,6 +44,7 @@ CONFIG_PROFILING=y · 17 unmodified lines
4244 CONFIG_KEXEC=y
4345 CONFIG_KEXEC_FILE=y
4446 CONFIG_KEXEC_SIG=y
47+CONFIG_CRASH_DM_CRYPT=y
4548 CONFIG_LIVEPATCH=y
4649 CONFIG_MARCH_Z13=y
4750 CONFIG_NR_CPUS=512
@@ -105,6 +108,7 @@ CONFIG_CMA_AREAS=7 · 57 unmodified lines
105108 CONFIG_MEM_SOFT_DIRTY=y
106109 CONFIG_DEFERRED_STRUCT_PAGE_INIT=y
107110 CONFIG_IDLE_PAGE_TRACKING=y
111+CONFIG_ZONE_DEVICE=y
108112 CONFIG_PERCPU_STATS=y
109113 CONFIG_GUP_TEST=y
110114 CONFIG_ANON_VMA_NAME=y
@@ -223,17 +227,19 @@ CONFIG_NETFILTER_XT_TARGET_CONNMARK=m · 112 unmodified lines
223227 CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=m
224228 CONFIG_NETFILTER_XT_TARGET_CT=m
225229 CONFIG_NETFILTER_XT_TARGET_DSCP=m
230+CONFIG_NETFILTER_XT_TARGET_HL=m
226231 CONFIG_NETFILTER_XT_TARGET_HMARK=m
227232 CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m
228233 CONFIG_NETFILTER_XT_TARGET_LOG=m
229234 CONFIG_NETFILTER_XT_TARGET_MARK=m
235+CONFIG_NETFILTER_XT_NAT=m
230236 CONFIG_NETFILTER_XT_TARGET_NETMAP=m
231237 CONFIG_NETFILTER_XT_TARGET_NFLOG=m
232238 CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
233239 CONFIG_NETFILTER_XT_TARGET_REDIRECT=m
240+CONFIG_NETFILTER_XT_TARGET_MASQUERADE=m
234241 CONFIG_NETFILTER_XT_TARGET_TEE=m
235242 CONFIG_NETFILTER_XT_TARGET_TPROXY=m
236−CONFIG_NETFILTER_XT_TARGET_TRACE=m
237243 CONFIG_NETFILTER_XT_TARGET_SECMARK=m
238244 CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
239245 CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m
@@ -248,6 +254,7 @@ CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m · 8 unmodified lines
248254 CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
249255 CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
250256 CONFIG_NETFILTER_XT_MATCH_CPU=m
257+CONFIG_NETFILTER_XT_MATCH_DCCP=m
251258 CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m
252259 CONFIG_NETFILTER_XT_MATCH_DSCP=m
253260 CONFIG_NETFILTER_XT_MATCH_ESP=m
@@ -318,16 +325,8 @@ CONFIG_IP_NF_MATCH_AH=m · 64 unmodified lines
318325 CONFIG_IP_NF_MATCH_ECN=m
319326 CONFIG_IP_NF_MATCH_RPFILTER=m
320327 CONFIG_IP_NF_MATCH_TTL=m
321−CONFIG_IP_NF_FILTER=m
322328 CONFIG_IP_NF_TARGET_REJECT=m
323−CONFIG_IP_NF_NAT=m
324−CONFIG_IP_NF_TARGET_MASQUERADE=m
325−CONFIG_IP_NF_MANGLE=m
326329 CONFIG_IP_NF_TARGET_ECN=m
327−CONFIG_IP_NF_TARGET_TTL=m
328−CONFIG_IP_NF_RAW=m
329−CONFIG_IP_NF_SECURITY=m
330−CONFIG_IP_NF_ARPFILTER=m
331330 CONFIG_IP_NF_ARP_MANGLE=m
332331 CONFIG_NFT_FIB_IPV6=m
333332 CONFIG_IP6_NF_IPTABLES=m
@@ -340,15 +339,9 @@ CONFIG_IP6_NF_MATCH_IPV6HEADER=m · 6 unmodified lines
340339 CONFIG_IP6_NF_MATCH_MH=m
341340 CONFIG_IP6_NF_MATCH_RPFILTER=m
342341 CONFIG_IP6_NF_MATCH_RT=m
343−CONFIG_IP6_NF_TARGET_HL=m
344−CONFIG_IP6_NF_FILTER=m
345342 CONFIG_IP6_NF_TARGET_REJECT=m
346−CONFIG_IP6_NF_MANGLE=m
347−CONFIG_IP6_NF_RAW=m
348−CONFIG_IP6_NF_SECURITY=m
349−CONFIG_IP6_NF_NAT=m
350−CONFIG_IP6_NF_TARGET_MASQUERADE=m
351343 CONFIG_NF_TABLES_BRIDGE=m
344+CONFIG_IP_SCTP=m
352345 CONFIG_RDS=m
353346 CONFIG_RDS_RDMA=m
354347 CONFIG_RDS_TCP=m
@@ -383,6 +376,7 @@ CONFIG_NET_SCH_FQ_CODEL=m · 28 unmodified lines
383376 CONFIG_NET_SCH_INGRESS=m
384377 CONFIG_NET_SCH_PLUG=m
385378 CONFIG_NET_SCH_ETS=m
379+CONFIG_NET_SCH_DUALPI2=m
386380 CONFIG_NET_CLS_BASIC=m
387381 CONFIG_NET_CLS_ROUTE4=m
388382 CONFIG_NET_CLS_FW=m
@@ -504,6 +498,7 @@ CONFIG_DM_VDO=m · 115 unmodified lines
504498 CONFIG_NETDEVICES=y
505499 CONFIG_BONDING=m
506500 CONFIG_DUMMY=m
501+CONFIG_OVPN=m
507502 CONFIG_EQUALIZER=m
508503 CONFIG_IFB=m
509504 CONFIG_MACVLAN=m
@@ -641,6 +636,7 @@ CONFIG_VP_VDPA=m · 131 unmodified lines
641636 CONFIG_VHOST_NET=m
642637 CONFIG_VHOST_VSOCK=m
643638 CONFIG_VHOST_VDPA=m
639+CONFIG_DEV_DAX=m
644640 CONFIG_EXT4_FS=y
645641 CONFIG_EXT4_FS_POSIX_ACL=y
646642 CONFIG_EXT4_FS_SECURITY=y
@@ -665,6 +661,7 @@ CONFIG_NILFS2_FS=m · 18 unmodified lines
665661 CONFIG_BCACHEFS_FS=y
666662 CONFIG_BCACHEFS_QUOTA=y
667663 CONFIG_BCACHEFS_POSIX_ACL=y
664+CONFIG_FS_DAX=y
668665 CONFIG_EXPORTFS_BLOCK_OPS=y
669666 CONFIG_FS_ENCRYPTION=y
670667 CONFIG_FS_VERITY=y
@@ -755,6 +752,8 @@ CONFIG_HARDENED_USERCOPY=y · 84 unmodified lines
755752 CONFIG_BUG_ON_DATA_CORRUPTION=y
756753 CONFIG_CRYPTO_USER=m
757754 CONFIG_CRYPTO_SELFTESTS=y
755+CONFIG_CRYPTO_SELFTESTS_FULL=y
756+CONFIG_CRYPTO_NULL=y
758757 CONFIG_CRYPTO_PCRYPT=m
759758 CONFIG_CRYPTO_CRYPTD=m
760759 CONFIG_CRYPTO_BENCHMARK=m
@@ -783,7 +782,6 @@ CONFIG_CRYPTO_HCTR2=m · 22 unmodified lines
783782 CONFIG_CRYPTO_LRW=m
784783 CONFIG_CRYPTO_PCBC=m
785784 CONFIG_CRYPTO_AEGIS128=m
786−CONFIG_CRYPTO_CHACHA20POLY1305=m
787785 CONFIG_CRYPTO_GCM=y
788786 CONFIG_CRYPTO_SEQIV=y
789787 CONFIG_CRYPTO_MD4=m
@@ -822,6 +820,7 @@ CONFIG_SYSTEM_BLACKLIST_KEYRING=y · 32 unmodified lines
822820 CONFIG_CRYPTO_KRB5=m
823821 CONFIG_CRYPTO_KRB5_SELFTESTS=y
824822 CONFIG_CORDIC=m
823+CONFIG_TRACE_MMIO_ACCESS=y
825824 CONFIG_RANDOM32_SELFTEST=y
826825 CONFIG_XZ_DEC_MICROLZMA=y
827826 CONFIG_DMA_CMA=y
arch/s390/configs/defconfig+15−19
@@ -4,6 +4,7 @@ CONFIG_WATCH_QUEUE=y · 3 unmodified lines
44 CONFIG_AUDIT=y
55 CONFIG_NO_HZ_IDLE=y
66 CONFIG_HIGH_RES_TIMERS=y
7+CONFIG_POSIX_AUX_CLOCKS=y
78 CONFIG_BPF_SYSCALL=y
89 CONFIG_BPF_JIT=y
910 CONFIG_BPF_JIT_ALWAYS_ON=y
@@ -17,6 +18,7 @@ CONFIG_TASK_XACCT=y · 7 unmodified lines
1718 CONFIG_TASK_IO_ACCOUNTING=y
1819 CONFIG_IKCONFIG=y
1920 CONFIG_IKCONFIG_PROC=y
21+CONFIG_SCHED_PROXY_EXEC=y
2022 CONFIG_NUMA_BALANCING=y
2123 CONFIG_MEMCG=y
2224 CONFIG_BLK_CGROUP=y
@@ -40,11 +42,12 @@ CONFIG_PROFILING=y · 17 unmodified lines
4042 CONFIG_KEXEC=y
4143 CONFIG_KEXEC_FILE=y
4244 CONFIG_KEXEC_SIG=y
45+CONFIG_CRASH_DM_CRYPT=y
4346 CONFIG_LIVEPATCH=y
4447 CONFIG_MARCH_Z13=y
4548 CONFIG_NR_CPUS=512
4649 CONFIG_NUMA=y
47−CONFIG_HZ_100=y
50+CONFIG_HZ_1000=y
4851 CONFIG_CERT_STORE=y
4952 CONFIG_EXPOLINE=y
5053 CONFIG_EXPOLINE_AUTO=y
@@ -97,6 +100,7 @@ CONFIG_CMA_AREAS=7 · 46 unmodified lines
97100 CONFIG_MEM_SOFT_DIRTY=y
98101 CONFIG_DEFERRED_STRUCT_PAGE_INIT=y
99102 CONFIG_IDLE_PAGE_TRACKING=y
103+CONFIG_ZONE_DEVICE=y
100104 CONFIG_PERCPU_STATS=y
101105 CONFIG_ANON_VMA_NAME=y
102106 CONFIG_USERFAULTFD=y
@@ -214,17 +218,19 @@ CONFIG_NETFILTER_XT_TARGET_CONNMARK=m · 111 unmodified lines
214218 CONFIG_NETFILTER_XT_TARGET_CONNSECMARK=m
215219 CONFIG_NETFILTER_XT_TARGET_CT=m
216220 CONFIG_NETFILTER_XT_TARGET_DSCP=m
221+CONFIG_NETFILTER_XT_TARGET_HL=m
217222 CONFIG_NETFILTER_XT_TARGET_HMARK=m
218223 CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m
219224 CONFIG_NETFILTER_XT_TARGET_LOG=m
220225 CONFIG_NETFILTER_XT_TARGET_MARK=m
226+CONFIG_NETFILTER_XT_NAT=m
221227 CONFIG_NETFILTER_XT_TARGET_NETMAP=m
222228 CONFIG_NETFILTER_XT_TARGET_NFLOG=m
223229 CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
224230 CONFIG_NETFILTER_XT_TARGET_REDIRECT=m
231+CONFIG_NETFILTER_XT_TARGET_MASQUERADE=m
225232 CONFIG_NETFILTER_XT_TARGET_TEE=m
226233 CONFIG_NETFILTER_XT_TARGET_TPROXY=m
227−CONFIG_NETFILTER_XT_TARGET_TRACE=m
228234 CONFIG_NETFILTER_XT_TARGET_SECMARK=m
229235 CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
230236 CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m
@@ -239,6 +245,7 @@ CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m · 8 unmodified lines
239245 CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
240246 CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
241247 CONFIG_NETFILTER_XT_MATCH_CPU=m
248+CONFIG_NETFILTER_XT_MATCH_DCCP=m
242249 CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m
243250 CONFIG_NETFILTER_XT_MATCH_DSCP=m
244251 CONFIG_NETFILTER_XT_MATCH_ESP=m
@@ -309,16 +316,8 @@ CONFIG_IP_NF_MATCH_AH=m · 64 unmodified lines
309316 CONFIG_IP_NF_MATCH_ECN=m
310317 CONFIG_IP_NF_MATCH_RPFILTER=m
311318 CONFIG_IP_NF_MATCH_TTL=m
312−CONFIG_IP_NF_FILTER=m
313319 CONFIG_IP_NF_TARGET_REJECT=m
314−CONFIG_IP_NF_NAT=m
315−CONFIG_IP_NF_TARGET_MASQUERADE=m
316−CONFIG_IP_NF_MANGLE=m
317320 CONFIG_IP_NF_TARGET_ECN=m
318−CONFIG_IP_NF_TARGET_TTL=m
319−CONFIG_IP_NF_RAW=m
320−CONFIG_IP_NF_SECURITY=m
321−CONFIG_IP_NF_ARPFILTER=m
322321 CONFIG_IP_NF_ARP_MANGLE=m
323322 CONFIG_NFT_FIB_IPV6=m
324323 CONFIG_IP6_NF_IPTABLES=m
@@ -331,15 +330,9 @@ CONFIG_IP6_NF_MATCH_IPV6HEADER=m · 6 unmodified lines
331330 CONFIG_IP6_NF_MATCH_MH=m
332331 CONFIG_IP6_NF_MATCH_RPFILTER=m
333332 CONFIG_IP6_NF_MATCH_RT=m
334−CONFIG_IP6_NF_TARGET_HL=m
335−CONFIG_IP6_NF_FILTER=m
336333 CONFIG_IP6_NF_TARGET_REJECT=m
337−CONFIG_IP6_NF_MANGLE=m
338−CONFIG_IP6_NF_RAW=m
339−CONFIG_IP6_NF_SECURITY=m
340−CONFIG_IP6_NF_NAT=m
341−CONFIG_IP6_NF_TARGET_MASQUERADE=m
342334 CONFIG_NF_TABLES_BRIDGE=m
335+CONFIG_IP_SCTP=m
343336 CONFIG_RDS=m
344337 CONFIG_RDS_RDMA=m
345338 CONFIG_RDS_TCP=m
@@ -373,6 +366,7 @@ CONFIG_NET_SCH_FQ_CODEL=m · 27 unmodified lines
373366 CONFIG_NET_SCH_INGRESS=m
374367 CONFIG_NET_SCH_PLUG=m
375368 CONFIG_NET_SCH_ETS=m
369+CONFIG_NET_SCH_DUALPI2=m
376370 CONFIG_NET_CLS_BASIC=m
377371 CONFIG_NET_CLS_ROUTE4=m
378372 CONFIG_NET_CLS_FW=m
@@ -494,6 +488,7 @@ CONFIG_DM_VDO=m · 115 unmodified lines
494488 CONFIG_NETDEVICES=y
495489 CONFIG_BONDING=m
496490 CONFIG_DUMMY=m
491+CONFIG_OVPN=m
497492 CONFIG_EQUALIZER=m
498493 CONFIG_IFB=m
499494 CONFIG_MACVLAN=m
@@ -631,6 +626,7 @@ CONFIG_VP_VDPA=m · 131 unmodified lines
631626 CONFIG_VHOST_NET=m
632627 CONFIG_VHOST_VSOCK=m
633628 CONFIG_VHOST_VDPA=m
629+CONFIG_DEV_DAX=m
634630 CONFIG_EXT4_FS=y
635631 CONFIG_EXT4_FS_POSIX_ACL=y
636632 CONFIG_EXT4_FS_SECURITY=y
@@ -652,6 +648,7 @@ CONFIG_NILFS2_FS=m · 15 unmodified lines
652648 CONFIG_BCACHEFS_FS=m
653649 CONFIG_BCACHEFS_QUOTA=y
654650 CONFIG_BCACHEFS_POSIX_ACL=y
651+CONFIG_FS_DAX=y
655652 CONFIG_EXPORTFS_BLOCK_OPS=y
656653 CONFIG_FS_ENCRYPTION=y
657654 CONFIG_FS_VERITY=y
@@ -683,7 +680,6 @@ CONFIG_TMPFS_POSIX_ACL=y · 25 unmodified lines
683680 CONFIG_TMPFS_INODE64=y
684681 CONFIG_TMPFS_QUOTA=y
685682 CONFIG_HUGETLBFS=y
686−CONFIG_CONFIGFS_FS=m
687683 CONFIG_ECRYPT_FS=m
688684 CONFIG_CRAMFS=m
689685 CONFIG_SQUASHFS=m
@@ -741,6 +737,7 @@ CONFIG_BUG_ON_DATA_CORRUPTION=y · 51 unmodified lines
741737 CONFIG_CRYPTO_FIPS=y
742738 CONFIG_CRYPTO_USER=m
743739 CONFIG_CRYPTO_SELFTESTS=y
740+CONFIG_CRYPTO_NULL=y
744741 CONFIG_CRYPTO_PCRYPT=m
745742 CONFIG_CRYPTO_CRYPTD=m
746743 CONFIG_CRYPTO_BENCHMARK=m
@@ -769,7 +766,6 @@ CONFIG_CRYPTO_HCTR2=m · 22 unmodified lines
769766 CONFIG_CRYPTO_LRW=m
770767 CONFIG_CRYPTO_PCBC=m
771768 CONFIG_CRYPTO_AEGIS128=m
772−CONFIG_CRYPTO_CHACHA20POLY1305=m
773769 CONFIG_CRYPTO_GCM=y
774770 CONFIG_CRYPTO_SEQIV=y
775771 CONFIG_CRYPTO_MD4=m
arch/s390/configs/zfcpdump_defconfig+2−1
@@ -1,5 +1,6 @@
11 CONFIG_NO_HZ_IDLE=y
22 CONFIG_HIGH_RES_TIMERS=y
3+CONFIG_POSIX_AUX_CLOCKS=y
34 CONFIG_BPF_SYSCALL=y
45 # CONFIG_CPU_ISOLATION is not set
56 # CONFIG_UTS_NS is not set
@@ -11,7 +12,7 @@ CONFIG_CC_OPTIMIZE_FOR_SIZE=y · 5 unmodified lines
1112 CONFIG_KEXEC=y
1213 CONFIG_MARCH_Z13=y
1314 CONFIG_NR_CPUS=2
14−CONFIG_HZ_100=y
15+CONFIG_HZ_1000=y
1516 # CONFIG_CHSC_SCH is not set
1617 # CONFIG_SCM_BUS is not set
1718 # CONFIG_AP is not set
arch/s390/hypfs/hypfs_dbfs.c+12−7
@@ -6,6 +6,7 @@ · 5 unmodified lines
66 * Author(s): Michael Holzheu <holzheu@linux.vnet.ibm.com>
77 */
88
9+#include <linux/security.h>
910 #include <linux/slab.h>
1011 #include "hypfs.h"
1112
@@ -66,23 +67,27 @@ static long dbfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg) · 54 unmodified lines
6667 long rc;
6768
6869 mutex_lock(&df->lock);
69− if (df->unlocked_ioctl)
70− rc = df->unlocked_ioctl(file, cmd, arg);
71− else
72− rc = -ENOTTY;
70+ rc = df->unlocked_ioctl(file, cmd, arg);
7371 mutex_unlock(&df->lock);
7472 return rc;
7573 }
7674
77−static const struct file_operations dbfs_ops = {
75+static const struct file_operations dbfs_ops_ioctl = {
7876 .read = dbfs_read,
7977 .unlocked_ioctl = dbfs_ioctl,
8078 };
8179
80+static const struct file_operations dbfs_ops = {
81+ .read = dbfs_read,
82+};
83+
8284 void hypfs_dbfs_create_file(struct hypfs_dbfs_file *df)
8385 {
84− df->dentry = debugfs_create_file(df->name, 0400, dbfs_dir, df,
85− &dbfs_ops);
86+ const struct file_operations *fops = &dbfs_ops;
87+
88+ if (df->unlocked_ioctl && !security_locked_down(LOCKDOWN_DEBUGFS))
89+ fops = &dbfs_ops_ioctl;
90+ df->dentry = debugfs_create_file(df->name, 0400, dbfs_dir, df, fops);
8691 mutex_init(&df->lock);
8792 }
8893
arch/x86/include/asm/xen/hypercall.h+3−2
@@ -94,12 +94,13 @@ DECLARE_STATIC_CALL(xen_hypercall, xen_hypercall_func); · 93 unmodified lines
9494 #ifdef MODULE
9595 #define __ADDRESSABLE_xen_hypercall
9696 #else
97−#define __ADDRESSABLE_xen_hypercall __ADDRESSABLE_ASM_STR(__SCK__xen_hypercall)
97+#define __ADDRESSABLE_xen_hypercall \
98+ __stringify(.global STATIC_CALL_KEY(xen_hypercall);)
9899 #endif
99100
100101 #define __HYPERCALL \
101102 __ADDRESSABLE_xen_hypercall \
102− "call __SCT__xen_hypercall"
103+ __stringify(call STATIC_CALL_TRAMP(xen_hypercall))
103104
104105 #define __HYPERCALL_ENTRY(x) "a" (x)
105106
arch/x86/kernel/cpu/amd.c+6−2
@@ -1326,8 +1326,8 @@ static const char * const s5_reset_reason_txt[] = { · 1325 unmodified lines
13261326
13271327 static __init int print_s5_reset_status_mmio(void)
13281328 {
1329− unsigned long value;
13301329 void __iomem *addr;
1330+ u32 value;
13311331 int i;
13321332
13331333 if (!cpu_feature_enabled(X86_FEATURE_ZEN))
@@ -1340,12 +1340,16 @@ static __init int print_s5_reset_status_mmio(void) · 6 unmodified lines
13401340 value = ioread32(addr);
13411341 iounmap(addr);
13421342
1343+ /* Value with "all bits set" is an error response and should be ignored. */
1344+ if (value == U32_MAX)
1345+ return 0;
1346+
13431347 for (i = 0; i < ARRAY_SIZE(s5_reset_reason_txt); i++) {
13441348 if (!(value & BIT(i)))
13451349 continue;
13461350
13471351 if (s5_reset_reason_txt[i]) {
1348− pr_info("x86/amd: Previous system reset reason [0x%08lx]: %s\n",
1352+ pr_info("x86/amd: Previous system reset reason [0x%08x]: %s\n",
13491353 value, s5_reset_reason_txt[i]);
13501354 }
13511355 }
arch/x86/kernel/cpu/bugs.c+1−3
@@ -1068,10 +1068,8 @@ static void __init gds_select_mitigation(void) · 1067 unmodified lines
10681068 if (gds_mitigation == GDS_MITIGATION_AUTO) {
10691069 if (should_mitigate_vuln(X86_BUG_GDS))
10701070 gds_mitigation = GDS_MITIGATION_FULL;
1071− else {
1071+ else
10721072 gds_mitigation = GDS_MITIGATION_OFF;
1073− return;
1074− }
10751073 }
10761074
10771075 /* No microcode */
arch/x86/kernel/cpu/hygon.c+3−0
@@ -16,6 +16,7 @@ · 15 unmodified lines
1616 #include <asm/spec-ctrl.h>
1717 #include <asm/delay.h>
1818 #include <asm/msr.h>
19+#include <asm/resctrl.h>
1920
2021 #include "cpu.h"
2122
@@ -117,6 +118,8 @@ static void bsp_init_hygon(struct cpuinfo_x86 *c) · 95 unmodified lines
117118 x86_amd_ls_cfg_ssbd_mask = 1ULL << 10;
118119 }
119120 }
121+
122+ resctrl_cpu_detect(c);
120123 }
121124
122125 static void early_init_hygon(struct cpuinfo_x86 *c)
block/blk-core.c+1−1
@@ -557,7 +557,7 @@ static inline int bio_check_eod(struct bio *bio) · 556 unmodified lines
557557 sector_t maxsector = bdev_nr_sectors(bio->bi_bdev);
558558 unsigned int nr_sectors = bio_sectors(bio);
559559
560− if (nr_sectors &&
560+ if (nr_sectors && maxsector &&
561561 (nr_sectors > maxsector ||
562562 bio->bi_iter.bi_sector > maxsector - nr_sectors)) {
563563 pr_info_ratelimited("%s: attempt to access beyond end of device\n"
block/blk-mq-debugfs.c+1−0
@@ -95,6 +95,7 @@ static const char *const blk_queue_flag_name[] = { · 94 unmodified lines
9595 QUEUE_FLAG_NAME(SQ_SCHED),
9696 QUEUE_FLAG_NAME(DISABLE_WBT_DEF),
9797 QUEUE_FLAG_NAME(NO_ELV_SWITCH),
98+ QUEUE_FLAG_NAME(QOS_ENABLED),
9899 };
99100 #undef QUEUE_FLAG_NAME
100101
block/blk-mq.c+9−4
@@ -5033,6 +5033,7 @@ static void __blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, · 5032 unmodified lines
50335033 unsigned int memflags;
50345034 int i;
50355035 struct xarray elv_tbl, et_tbl;
5036+ bool queues_frozen = false;
50365037
50375038 lockdep_assert_held(&set->tag_list_lock);
50385039
@@ -5056,9 +5057,6 @@ static void __blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, · 17 unmodified lines
50565057 blk_mq_sysfs_unregister_hctxs(q);
50575058 }
50585059
5059− list_for_each_entry(q, &set->tag_list, tag_set_list)
5060− blk_mq_freeze_queue_nomemsave(q);
5061−
50625060 /*
50635061 * Switch IO scheduler to 'none', cleaning up the data associated
50645062 * with the previous scheduler. We will switch back once we are done
@@ -5068,6 +5066,9 @@ static void __blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, · 3 unmodified lines
50685066 if (blk_mq_elv_switch_none(q, &elv_tbl))
50695067 goto switch_back;
50705068
5069+ list_for_each_entry(q, &set->tag_list, tag_set_list)
5070+ blk_mq_freeze_queue_nomemsave(q);
5071+ queues_frozen = true;
50715072 if (blk_mq_realloc_tag_set_tags(set, nr_hw_queues) < 0)
50725073 goto switch_back;
50735074
@@ -5091,8 +5092,12 @@ fallback: · 17 unmodified lines
50915092 }
50925093 switch_back:
50935094 /* The blk_mq_elv_switch_back unfreezes queue for us. */
5094− list_for_each_entry(q, &set->tag_list, tag_set_list)
5095+ list_for_each_entry(q, &set->tag_list, tag_set_list) {
5096+ /* switch_back expects queue to be frozen */
5097+ if (!queues_frozen)
5098+ blk_mq_freeze_queue_nomemsave(q);
50955099 blk_mq_elv_switch_back(q, &elv_tbl, &et_tbl);
5100+ }
50965101
50975102 list_for_each_entry(q, &set->tag_list, tag_set_list) {
50985103 blk_mq_sysfs_register_hctxs(q);
block/blk-rq-qos.c+4−4
@@ -2,8 +2,6 @@ · 1 unmodified line
22
33 #include "blk-rq-qos.h"
44
5−__read_mostly DEFINE_STATIC_KEY_FALSE(block_rq_qos);
6−
75 /*
86 * Increment 'v', if 'v' is below 'below'. Returns true if we succeeded,
97 * false if 'v' + 1 would be bigger than 'below'.
@@ -319,8 +317,8 @@ void rq_qos_exit(struct request_queue *q) · 309 unmodified lines
319317 struct rq_qos *rqos = q->rq_qos;
320318 q->rq_qos = rqos->next;
321319 rqos->ops->exit(rqos);
322− static_branch_dec(&block_rq_qos);
323320 }
321+ blk_queue_flag_clear(QUEUE_FLAG_QOS_ENABLED, q);
324322 mutex_unlock(&q->rq_qos_mutex);
325323 }
326324
@@ -346,7 +344,7 @@ int rq_qos_add(struct rq_qos *rqos, struct gendisk *disk, enum rq_qos_id id, · 19 unmodified lines
346344 goto ebusy;
347345 rqos->next = q->rq_qos;
348346 q->rq_qos = rqos;
349− static_branch_inc(&block_rq_qos);
347+ blk_queue_flag_set(QUEUE_FLAG_QOS_ENABLED, q);
350348
351349 blk_mq_unfreeze_queue(q, memflags);
352350
@@ -377,6 +375,8 @@ void rq_qos_del(struct rq_qos *rqos) · 24 unmodified lines
377375 break;
378376 }
379377 }
378+ if (!q->rq_qos)
379+ blk_queue_flag_clear(QUEUE_FLAG_QOS_ENABLED, q);
380380 blk_mq_unfreeze_queue(q, memflags);
381381
382382 mutex_lock(&q->debugfs_mutex);
block/blk-rq-qos.h+31−17
@@ -12,7 +12,6 @@ · 11 unmodified lines
1212 #include "blk-mq-debugfs.h"
1313
1414 struct blk_mq_debugfs_attr;
15−extern struct static_key_false block_rq_qos;
1615
1716 enum rq_qos_id {
1817 RQ_QOS_WBT,
@@ -113,43 +112,55 @@ void __rq_qos_queue_depth_changed(struct rq_qos *rqos); · 94 unmodified lines
113112
114113 static inline void rq_qos_cleanup(struct request_queue *q, struct bio *bio)
115114 {
116− if (static_branch_unlikely(&block_rq_qos) && q->rq_qos)
115+ if (unlikely(test_bit(QUEUE_FLAG_QOS_ENABLED, &q->queue_flags)) &&
116+ q->rq_qos)
117117 __rq_qos_cleanup(q->rq_qos, bio);
118118 }
119119
120120 static inline void rq_qos_done(struct request_queue *q, struct request *rq)
121121 {
122− if (static_branch_unlikely(&block_rq_qos) && q->rq_qos &&
123− !blk_rq_is_passthrough(rq))
122+ if (unlikely(test_bit(QUEUE_FLAG_QOS_ENABLED, &q->queue_flags)) &&
123+ q->rq_qos && !blk_rq_is_passthrough(rq))
124124 __rq_qos_done(q->rq_qos, rq);
125125 }
126126
127127 static inline void rq_qos_issue(struct request_queue *q, struct request *rq)
128128 {
129− if (static_branch_unlikely(&block_rq_qos) && q->rq_qos)
129+ if (unlikely(test_bit(QUEUE_FLAG_QOS_ENABLED, &q->queue_flags)) &&
130+ q->rq_qos)
130131 __rq_qos_issue(q->rq_qos, rq);
131132 }
132133
133134 static inline void rq_qos_requeue(struct request_queue *q, struct request *rq)
134135 {
135− if (static_branch_unlikely(&block_rq_qos) && q->rq_qos)
136+ if (unlikely(test_bit(QUEUE_FLAG_QOS_ENABLED, &q->queue_flags)) &&
137+ q->rq_qos)
136138 __rq_qos_requeue(q->rq_qos, rq);
137139 }
138140
139141 static inline void rq_qos_done_bio(struct bio *bio)
140142 {
141− if (static_branch_unlikely(&block_rq_qos) &&
142− bio->bi_bdev && (bio_flagged(bio, BIO_QOS_THROTTLED) ||
143− bio_flagged(bio, BIO_QOS_MERGED))) {
144− struct request_queue *q = bdev_get_queue(bio->bi_bdev);
145− if (q->rq_qos)
146− __rq_qos_done_bio(q->rq_qos, bio);
147− }
143+ struct request_queue *q;
144+
145+ if (!bio->bi_bdev || (!bio_flagged(bio, BIO_QOS_THROTTLED) &&
146+ !bio_flagged(bio, BIO_QOS_MERGED)))
147+ return;
148+
149+ q = bdev_get_queue(bio->bi_bdev);
150+
151+ /*
152+ * If a bio has BIO_QOS_xxx set, it implicitly implies that
153+ * q->rq_qos is present. So, we skip re-checking q->rq_qos
154+ * here as an extra optimization and directly call
155+ * __rq_qos_done_bio().
156+ */
157+ __rq_qos_done_bio(q->rq_qos, bio);
148158 }
149159
150160 static inline void rq_qos_throttle(struct request_queue *q, struct bio *bio)
151161 {
152− if (static_branch_unlikely(&block_rq_qos) && q->rq_qos) {
162+ if (unlikely(test_bit(QUEUE_FLAG_QOS_ENABLED, &q->queue_flags)) &&
163+ q->rq_qos) {
153164 bio_set_flag(bio, BIO_QOS_THROTTLED);
154165 __rq_qos_throttle(q->rq_qos, bio);
155166 }
@@ -158,14 +169,16 @@ static inline void rq_qos_throttle(struct request_queue *q, struct bio *bio) · 2 unmodified lines
158169 static inline void rq_qos_track(struct request_queue *q, struct request *rq,
159170 struct bio *bio)
160171 {
161− if (static_branch_unlikely(&block_rq_qos) && q->rq_qos)
172+ if (unlikely(test_bit(QUEUE_FLAG_QOS_ENABLED, &q->queue_flags)) &&
173+ q->rq_qos)
162174 __rq_qos_track(q->rq_qos, rq, bio);
163175 }
164176
165177 static inline void rq_qos_merge(struct request_queue *q, struct request *rq,
166178 struct bio *bio)
167179 {
168− if (static_branch_unlikely(&block_rq_qos) && q->rq_qos) {
180+ if (unlikely(test_bit(QUEUE_FLAG_QOS_ENABLED, &q->queue_flags)) &&
181+ q->rq_qos) {
169182 bio_set_flag(bio, BIO_QOS_MERGED);
170183 __rq_qos_merge(q->rq_qos, rq, bio);
171184 }
@@ -173,7 +186,8 @@ static inline void rq_qos_merge(struct request_queue *q, struct request *rq, · 1 unmodified line
173186
174187 static inline void rq_qos_queue_depth_changed(struct request_queue *q)
175188 {
176− if (static_branch_unlikely(&block_rq_qos) && q->rq_qos)
189+ if (unlikely(test_bit(QUEUE_FLAG_QOS_ENABLED, &q->queue_flags)) &&
190+ q->rq_qos)
177191 __rq_qos_queue_depth_changed(q->rq_qos);
178192 }
179193
block/blk-settings.c+6−6
@@ -157,16 +157,14 @@ static int blk_validate_integrity_limits(struct queue_limits *lim) · 156 unmodified lines
157157 switch (bi->csum_type) {
158158 case BLK_INTEGRITY_CSUM_NONE:
159159 if (bi->pi_tuple_size) {
160− pr_warn("pi_tuple_size must be 0 when checksum type \
161− is none\n");
160+ pr_warn("pi_tuple_size must be 0 when checksum type is none\n");
162161 return -EINVAL;
163162 }
164163 break;
165164 case BLK_INTEGRITY_CSUM_CRC:
166165 case BLK_INTEGRITY_CSUM_IP:
167166 if (bi->pi_tuple_size != sizeof(struct t10_pi_tuple)) {
168− pr_warn("pi_tuple_size mismatch for T10 PI: expected \
169− %zu, got %u\n",
167+ pr_warn("pi_tuple_size mismatch for T10 PI: expected %zu, got %u\n",
170168 sizeof(struct t10_pi_tuple),
171169 bi->pi_tuple_size);
172170 return -EINVAL;
@@ -174,8 +172,7 @@ static int blk_validate_integrity_limits(struct queue_limits *lim) · 1 unmodified line
174172 break;
175173 case BLK_INTEGRITY_CSUM_CRC64:
176174 if (bi->pi_tuple_size != sizeof(struct crc64_pi_tuple)) {
177− pr_warn("pi_tuple_size mismatch for CRC64 PI: \
178− expected %zu, got %u\n",
175+ pr_warn("pi_tuple_size mismatch for CRC64 PI: expected %zu, got %u\n",
179176 sizeof(struct crc64_pi_tuple),
180177 bi->pi_tuple_size);
181178 return -EINVAL;
@@ -972,6 +969,8 @@ bool queue_limits_stack_integrity(struct queue_limits *t, · 790 unmodified lines
972969 goto incompatible;
973970 if (ti->csum_type != bi->csum_type)
974971 goto incompatible;
972+ if (ti->pi_tuple_size != bi->pi_tuple_size)
973+ goto incompatible;
975974 if ((ti->flags & BLK_INTEGRITY_REF_TAG) !=
976975 (bi->flags & BLK_INTEGRITY_REF_TAG))
977976 goto incompatible;
@@ -980,6 +979,7 @@ bool queue_limits_stack_integrity(struct queue_limits *t, · 2 unmodified lines
980979 ti->flags |= (bi->flags & BLK_INTEGRITY_DEVICE_CAPABLE) |
981980 (bi->flags & BLK_INTEGRITY_REF_TAG);
982981 ti->csum_type = bi->csum_type;
982+ ti->pi_tuple_size = bi->pi_tuple_size;
983983 ti->metadata_size = bi->metadata_size;
984984 ti->pi_offset = bi->pi_offset;
985985 ti->interval_exp = bi->interval_exp;
drivers/accel/habanalabs/gaudi2/gaudi2.c+1−1
@@ -10437,7 +10437,7 @@ end: · 10436 unmodified lines
1043710437 (u64 *)(lin_dma_pkts_arr), DEBUGFS_WRITE64);
1043810438 WREG32(sob_addr, 0);
1043910439
10440− kfree(lin_dma_pkts_arr);
10440+ kvfree(lin_dma_pkts_arr);
1044110441
1044210442 return rc;
1044310443 }
drivers/acpi/apei/einj-core.c+7−10
@@ -315,7 +315,7 @@ static void __iomem *einj_get_parameter_address(void) · 314 unmodified lines
315315 memcpy_fromio(&v5param, p, v5param_size);
316316 acpi5 = 1;
317317 check_vendor_extension(pa_v5, &v5param);
318− if (available_error_type & ACPI65_EINJV2_SUPP) {
318+ if (is_v2 && available_error_type & ACPI65_EINJV2_SUPP) {
319319 len = v5param.einjv2_struct.length;
320320 offset = offsetof(struct einjv2_extension_struct, component_arr);
321321 max_nr_components = (len - offset) /
@@ -540,6 +540,9 @@ static int __einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2, · 218 unmodified lines
540540 struct set_error_type_with_address *v5param;
541541
542542 v5param = kmalloc(v5param_size, GFP_KERNEL);
543+ if (!v5param)
544+ return -ENOMEM;
545+
543546 memcpy_fromio(v5param, einj_param, v5param_size);
544547 v5param->type = type;
545548 if (type & ACPI5_VENDOR_BIT) {
@@ -1091,7 +1094,7 @@ err_put_table: · 545 unmodified lines
10911094 return rc;
10921095 }
10931096
1094−static void __exit einj_remove(struct faux_device *fdev)
1097+static void einj_remove(struct faux_device *fdev)
10951098 {
10961099 struct apei_exec_context ctx;
10971100
@@ -1114,15 +1117,9 @@ static void __exit einj_remove(struct faux_device *fdev) · 16 unmodified lines
11141117 }
11151118
11161119 static struct faux_device *einj_dev;
1117−/*
1118− * einj_remove() lives in .exit.text. For drivers registered via
1119− * platform_driver_probe() this is ok because they cannot get unbound at
1120− * runtime. So mark the driver struct with __refdata to prevent modpost
1121− * triggering a section mismatch warning.
1122− */
1123−static struct faux_device_ops einj_device_ops __refdata = {
1120+static struct faux_device_ops einj_device_ops = {
11241121 .probe = einj_probe,
1125− .remove = __exit_p(einj_remove),
1122+ .remove = einj_remove,
11261123 };
11271124
11281125 static int __init einj_init(void)
drivers/acpi/pfr_update.c+1−1
@@ -329,7 +329,7 @@ static bool applicable_image(const void *data, struct pfru_update_cap_info *cap, · 328 unmodified lines
329329 if (type == PFRU_CODE_INJECT_TYPE)
330330 return payload_hdr->rt_ver >= cap->code_rt_version;
331331
332− return payload_hdr->rt_ver >= cap->drv_rt_version;
332+ return payload_hdr->svn_ver >= cap->drv_svn;
333333 }
334334
335335 static void print_update_debug_info(struct pfru_updated_result *result,
drivers/atm/atmtcp.c+14−3
@@ -279,6 +279,19 @@ static struct atm_vcc *find_vcc(struct atm_dev *dev, short vpi, int vci) · 278 unmodified lines
279279 return NULL;
280280 }
281281
282+static int atmtcp_c_pre_send(struct atm_vcc *vcc, struct sk_buff *skb)
283+{
284+ struct atmtcp_hdr *hdr;
285+
286+ if (skb->len < sizeof(struct atmtcp_hdr))
287+ return -EINVAL;
288+
289+ hdr = (struct atmtcp_hdr *)skb->data;
290+ if (hdr->length == ATMTCP_HDR_MAGIC)
291+ return -EINVAL;
292+
293+ return 0;
294+}
282295
283296 static int atmtcp_c_send(struct atm_vcc *vcc,struct sk_buff *skb)
284297 {
@@ -288,9 +301,6 @@ static int atmtcp_c_send(struct atm_vcc *vcc,struct sk_buff *skb) · 3 unmodified lines
288301 struct sk_buff *new_skb;
289302 int result = 0;
290303
291− if (skb->len < sizeof(struct atmtcp_hdr))
292− goto done;
293−
294304 dev = vcc->dev_data;
295305 hdr = (struct atmtcp_hdr *) skb->data;
296306 if (hdr->length == ATMTCP_HDR_MAGIC) {
@@ -347,6 +357,7 @@ static const struct atmdev_ops atmtcp_v_dev_ops = { · 50 unmodified lines
347357
348358 static const struct atmdev_ops atmtcp_c_dev_ops = {
349359 .close = atmtcp_c_close,
360+ .pre_send = atmtcp_c_pre_send,
350361 .send = atmtcp_c_send
351362 };
352363
drivers/base/power/main.c+2−2
@@ -675,7 +675,7 @@ static void dpm_async_resume_subordinate(struct device *dev, async_func_t func) · 674 unmodified lines
675675 idx = device_links_read_lock();
676676
677677 /* Start processing the device's "async" consumers. */
678− list_for_each_entry_rcu(link, &dev->links.consumers, s_node)
678+ list_for_each_entry_rcu_locked(link, &dev->links.consumers, s_node)
679679 if (READ_ONCE(link->status) != DL_STATE_DORMANT)
680680 dpm_async_with_cleanup(link->consumer, func);
681681
@@ -1330,7 +1330,7 @@ static void dpm_async_suspend_superior(struct device *dev, async_func_t func) · 648 unmodified lines
13301330 idx = device_links_read_lock();
13311331
13321332 /* Start processing the device's "async" suppliers. */
1333− list_for_each_entry_rcu(link, &dev->links.suppliers, c_node)
1333+ list_for_each_entry_rcu_locked(link, &dev->links.suppliers, c_node)
13341334 if (READ_ONCE(link->status) != DL_STATE_DORMANT)
13351335 dpm_async_with_cleanup(link->supplier, func);
13361336
drivers/block/loop.c+21−18
@@ -137,20 +137,29 @@ static void loop_global_unlock(struct loop_device *lo, bool global) · 136 unmodified lines
137137 static int max_part;
138138 static int part_shift;
139139
140−static loff_t get_size(loff_t offset, loff_t sizelimit, struct file *file)
140+static loff_t lo_calculate_size(struct loop_device *lo, struct file *file)
141141 {
142+ struct kstat stat;
142143 loff_t loopsize;
144+ int ret;
143145
144− /* Compute loopsize in bytes */
145− loopsize = i_size_read(file->f_mapping->host);
146− if (offset > 0)
147− loopsize -= offset;
146+ /*
147+ * Get the accurate file size. This provides better results than
148+ * cached inode data, particularly for network filesystems where
149+ * metadata may be stale.
150+ */
151+ ret = vfs_getattr_nosec(&file->f_path, &stat, STATX_SIZE, 0);
152+ if (ret)
153+ return 0;
154+
155+ loopsize = stat.size;
156+ if (lo->lo_offset > 0)
157+ loopsize -= lo->lo_offset;
148158 /* offset is beyond i_size, weird but possible */
149159 if (loopsize < 0)
150160 return 0;
151−
152− if (sizelimit > 0 && sizelimit < loopsize)
153− loopsize = sizelimit;
161+ if (lo->lo_sizelimit > 0 && lo->lo_sizelimit < loopsize)
162+ loopsize = lo->lo_sizelimit;
154163 /*
155164 * Unfortunately, if we want to do I/O on the device,
156165 * the number of 512-byte sectors has to fit into a sector_t.
@@ -158,11 +167,6 @@ static loff_t get_size(loff_t offset, loff_t sizelimit, struct file *file) · 1 unmodified line
158167 return loopsize >> 9;
159168 }
160169
161−static loff_t get_loop_size(struct loop_device *lo, struct file *file)
162−{
163− return get_size(lo->lo_offset, lo->lo_sizelimit, file);
164−}
165−
166170 /*
167171 * We support direct I/O only if lo_offset is aligned with the logical I/O size
168172 * of backing device, and the logical block size of loop is bigger than that of
@@ -569,7 +573,7 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev, · 400 unmodified lines
569573 error = -EINVAL;
570574
571575 /* size of the new backing store needs to be the same */
572− if (get_loop_size(lo, file) != get_loop_size(lo, old_file))
576+ if (lo_calculate_size(lo, file) != lo_calculate_size(lo, old_file))
573577 goto out_err;
574578
575579 /*
@@ -1063,7 +1067,7 @@ static int loop_configure(struct loop_device *lo, blk_mode_t mode, · 487 unmodified lines
10631067 loop_update_dio(lo);
10641068 loop_sysfs_init(lo);
10651069
1066− size = get_loop_size(lo, file);
1070+ size = lo_calculate_size(lo, file);
10671071 loop_set_size(lo, size);
10681072
10691073 /* Order wrt reading lo_state in loop_validate_file(). */
@@ -1255,8 +1259,7 @@ out_unfreeze: · 185 unmodified lines
12551259 if (partscan)
12561260 clear_bit(GD_SUPPRESS_PART_SCAN, &lo->lo_disk->state);
12571261 if (!err && size_changed) {
1258− loff_t new_size = get_size(lo->lo_offset, lo->lo_sizelimit,
1259− lo->lo_backing_file);
1262+ loff_t new_size = lo_calculate_size(lo, lo->lo_backing_file);
12601263 loop_set_size(lo, new_size);
12611264 }
12621265 out_unlock:
@@ -1399,7 +1402,7 @@ static int loop_set_capacity(struct loop_device *lo) · 136 unmodified lines
13991402 if (unlikely(lo->lo_state != Lo_bound))
14001403 return -ENXIO;
14011404
1402− size = get_loop_size(lo, lo->lo_backing_file);
1405+ size = lo_calculate_size(lo, lo->lo_backing_file);
14031406 loop_set_size(lo, size);
14041407
14051408 return 0;
drivers/cdx/controller/cdx_rpmsg.c+1−2
@@ -129,8 +129,7 @@ static int cdx_rpmsg_probe(struct rpmsg_device *rpdev) · 128 unmodified lines
129129
130130 chinfo.src = RPMSG_ADDR_ANY;
131131 chinfo.dst = rpdev->dst;
132− strscpy(chinfo.name, cdx_rpmsg_id_table[0].name,
133− strlen(cdx_rpmsg_id_table[0].name));
132+ strscpy(chinfo.name, cdx_rpmsg_id_table[0].name, sizeof(chinfo.name));
134133
135134 cdx_mcdi->ept = rpmsg_create_ept(rpdev, cdx_rpmsg_cb, NULL, chinfo);
136135 if (!cdx_mcdi->ept) {
drivers/comedi/comedi_fops.c+5−0
@@ -1587,6 +1587,9 @@ static int do_insnlist_ioctl(struct comedi_device *dev, · 1586 unmodified lines
15871587 memset(&data[n], 0, (MIN_SAMPLES - n) *
15881588 sizeof(unsigned int));
15891589 }
1590+ } else {
1591+ memset(data, 0, max_t(unsigned int, n, MIN_SAMPLES) *
1592+ sizeof(unsigned int));
15901593 }
15911594 ret = parse_insn(dev, insns + i, data, file);
15921595 if (ret < 0)
@@ -1670,6 +1673,8 @@ static int do_insn_ioctl(struct comedi_device *dev, · 77 unmodified lines
16701673 memset(&data[insn->n], 0,
16711674 (MIN_SAMPLES - insn->n) * sizeof(unsigned int));
16721675 }
1676+ } else {
1677+ memset(data, 0, n_data * sizeof(unsigned int));
16731678 }
16741679 ret = parse_insn(dev, insn, data, file);
16751680 if (ret < 0)
drivers/comedi/drivers.c+12−11
@@ -620,11 +620,9 @@ static int insn_rw_emulate_bits(struct comedi_device *dev, · 619 unmodified lines
620620 unsigned int chan = CR_CHAN(insn->chanspec);
621621 unsigned int base_chan = (chan < 32) ? 0 : chan;
622622 unsigned int _data[2];
623+ unsigned int i;
623624 int ret;
624625
625− if (insn->n == 0)
626− return 0;
627−
628626 memset(_data, 0, sizeof(_data));
629627 memset(&_insn, 0, sizeof(_insn));
630628 _insn.insn = INSN_BITS;
@@ -635,18 +633,21 @@ static int insn_rw_emulate_bits(struct comedi_device *dev, · 4 unmodified lines
635633 if (insn->insn == INSN_WRITE) {
636634 if (!(s->subdev_flags & SDF_WRITABLE))
637635 return -EINVAL;
638− _data[0] = 1U << (chan - base_chan); /* mask */
639− _data[1] = data[0] ? (1U << (chan - base_chan)) : 0; /* bits */
636+ _data[0] = 1U << (chan - base_chan); /* mask */
640637 }
638+ for (i = 0; i < insn->n; i++) {
639+ if (insn->insn == INSN_WRITE)
640+ _data[1] = data[i] ? _data[0] : 0; /* bits */
641641
642− ret = s->insn_bits(dev, s, &_insn, _data);
643− if (ret < 0)
644− return ret;
642+ ret = s->insn_bits(dev, s, &_insn, _data);
643+ if (ret < 0)
644+ return ret;
645645
646− if (insn->insn == INSN_READ)
647− data[0] = (_data[1] >> (chan - base_chan)) & 1;
646+ if (insn->insn == INSN_READ)
647+ data[i] = (_data[1] >> (chan - base_chan)) & 1;
648+ }
648649
649− return 1;
650+ return insn->n;
650651 }
651652
652653 static int __comedi_device_postconfig_async(struct comedi_device *dev,
drivers/comedi/drivers/pcl726.c+2−1
@@ -328,7 +328,8 @@ static int pcl726_attach(struct comedi_device *dev, · 327 unmodified lines
328328 * Hook up the external trigger source interrupt only if the
329329 * user config option is valid and the board supports interrupts.
330330 */
331− if (it->options[1] && (board->irq_mask & (1 << it->options[1]))) {
331+ if (it->options[1] > 0 && it->options[1] < 16 &&
332+ (board->irq_mask & (1U << it->options[1]))) {
332333 ret = request_irq(it->options[1], pcl726_interrupt, 0,
333334 dev->board_name, dev);
334335 if (ret == 0) {
drivers/cpuidle/governors/menu.c+12−17
@@ -287,20 +287,15 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev, · 286 unmodified lines
287287 return 0;
288288 }
289289
290− if (tick_nohz_tick_stopped()) {
291− /*
292− * If the tick is already stopped, the cost of possible short
293− * idle duration misprediction is much higher, because the CPU
294− * may be stuck in a shallow idle state for a long time as a
295− * result of it. In that case say we might mispredict and use
296− * the known time till the closest timer event for the idle
297− * state selection.
298− */
299− if (predicted_ns < TICK_NSEC)
300− predicted_ns = data->next_timer_ns;
301− } else if (latency_req > predicted_ns) {
302− latency_req = predicted_ns;
303− }
290+ /*
291+ * If the tick is already stopped, the cost of possible short idle
292+ * duration misprediction is much higher, because the CPU may be stuck
293+ * in a shallow idle state for a long time as a result of it. In that
294+ * case, say we might mispredict and use the known time till the closest
295+ * timer event for the idle state selection.
296+ */
297+ if (tick_nohz_tick_stopped() && predicted_ns < TICK_NSEC)
298+ predicted_ns = data->next_timer_ns;
304299
305300 /*
306301 * Find the idle state with the lowest power while satisfying
@@ -316,13 +311,15 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev, · 9 unmodified lines
316311 if (idx == -1)
317312 idx = i; /* first enabled state */
318313
314+ if (s->exit_latency_ns > latency_req)
315+ break;
316+
319317 if (s->target_residency_ns > predicted_ns) {
320318 /*
321319 * Use a physical idle state, not busy polling, unless
322320 * a timer is going to trigger soon enough.
323321 */
324322 if ((drv->states[idx].flags & CPUIDLE_FLAG_POLLING) &&
325− s->exit_latency_ns <= latency_req &&
326323 s->target_residency_ns <= data->next_timer_ns) {
327324 predicted_ns = s->target_residency_ns;
328325 idx = i;
@@ -354,8 +351,6 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev, · 25 unmodified lines
354351
355352 return idx;
356353 }
357− if (s->exit_latency_ns > latency_req)
358− break;
359354
360355 idx = i;
361356 }
drivers/fpga/zynq-fpga.c+4−4
@@ -405,12 +405,12 @@ static int zynq_fpga_ops_write(struct fpga_manager *mgr, struct sg_table *sgt) · 404 unmodified lines
405405 }
406406 }
407407
408− priv->dma_nelms =
409− dma_map_sgtable(mgr->dev.parent, sgt, DMA_TO_DEVICE, 0);
410− if (priv->dma_nelms == 0) {
408+ err = dma_map_sgtable(mgr->dev.parent, sgt, DMA_TO_DEVICE, 0);
409+ if (err) {
411410 dev_err(&mgr->dev, "Unable to DMA map (TO_DEVICE)\n");
412− return -ENOMEM;
411+ return err;
413412 }
413+ priv->dma_nelms = sgt->nents;
414414
415415 /* enable clock */
416416 err = clk_enable(priv->clk);
drivers/gpio/gpiolib-acpi-quirks.c+14−0
@@ -344,6 +344,20 @@ static const struct dmi_system_id gpiolib_acpi_quirks[] __initconst = { · 343 unmodified lines
344344 .ignore_interrupt = "AMDI0030:00@8",
345345 },
346346 },
347+ {
348+ /*
349+ * Spurious wakeups from TP_ATTN# pin
350+ * Found in BIOS 5.35
351+ * https://gitlab.freedesktop.org/drm/amd/-/issues/4482
352+ */
353+ .matches = {
354+ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
355+ DMI_MATCH(DMI_PRODUCT_FAMILY, "ProArt PX13"),
356+ },
357+ .driver_data = &(struct acpi_gpiolib_dmi_quirk) {
358+ .ignore_wake = "ASCP1A00:00@8",
359+ },
360+ },
347361 {} /* Terminating entry */
348362 };
349363
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c+1−1
@@ -514,7 +514,7 @@ bool amdgpu_dmabuf_is_xgmi_accessible(struct amdgpu_device *adev, · 513 unmodified lines
514514 return false;
515515
516516 if (drm_gem_is_imported(obj)) {
517− struct dma_buf *dma_buf = obj->dma_buf;
517+ struct dma_buf *dma_buf = obj->import_attach->dmabuf;
518518
519519 if (dma_buf->ops != &amdgpu_dmabuf_ops)
520520 /* No XGMI with non AMD GPUs */
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c+2−1
@@ -317,7 +317,8 @@ static int amdgpu_gem_object_open(struct drm_gem_object *obj, · 316 unmodified lines
317317 */
318318 if (!vm->is_compute_context || !vm->process_info)
319319 return 0;
320− if (!drm_gem_is_imported(obj) || !dma_buf_is_dynamic(obj->dma_buf))
320+ if (!drm_gem_is_imported(obj) ||
321+ !dma_buf_is_dynamic(obj->import_attach->dmabuf))
321322 return 0;
322323 mutex_lock_nested(&vm->process_info->lock, 1);
323324 if (!WARN_ON(!vm->process_info->eviction_fence)) {
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c+1−1
@@ -1283,7 +1283,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, struct amdgpu_bo_va *bo_va, · 1282 unmodified lines
12831283 struct drm_gem_object *obj = &bo->tbo.base;
12841284
12851285 if (drm_gem_is_imported(obj) && bo_va->is_xgmi) {
1286− struct dma_buf *dma_buf = obj->dma_buf;
1286+ struct dma_buf *dma_buf = obj->import_attach->dmabuf;
12871287 struct drm_gem_object *gobj = dma_buf->priv;
12881288 struct amdgpu_bo *abo = gem_to_amdgpu_bo(gobj);
12891289
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c+3−0
@@ -7792,6 +7792,9 @@ amdgpu_dm_connector_atomic_check(struct drm_connector *conn, · 7791 unmodified lines
77927792 struct amdgpu_dm_connector *aconn = to_amdgpu_dm_connector(conn);
77937793 int ret;
77947794
7795+ if (WARN_ON(unlikely(!old_con_state || !new_con_state)))
7796+ return -EINVAL;
7797+
77957798 trace_amdgpu_dm_connector_atomic_check(new_con_state);
77967799
77977800 if (conn->connector_type == DRM_MODE_CONNECTOR_DisplayPort) {
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c+19−0
@@ -299,6 +299,25 @@ static inline int amdgpu_dm_crtc_set_vblank(struct drm_crtc *crtc, bool enable) · 298 unmodified lines
299299 irq_type = amdgpu_display_crtc_idx_to_irq_type(adev, acrtc->crtc_id);
300300
301301 if (enable) {
302+ struct dc *dc = adev->dm.dc;
303+ struct drm_vblank_crtc *vblank = drm_crtc_vblank_crtc(crtc);
304+ struct psr_settings *psr = &acrtc_state->stream->link->psr_settings;
305+ struct replay_settings *pr = &acrtc_state->stream->link->replay_settings;
306+ bool sr_supported = (psr->psr_version != DC_PSR_VERSION_UNSUPPORTED) ||
307+ pr->config.replay_supported;
308+
309+ /*
310+ * IPS & self-refresh feature can cause vblank counter resets between
311+ * vblank disable and enable.
312+ * It may cause system stuck due to waiting for the vblank counter.
313+ * Call this function to estimate missed vblanks by using timestamps and
314+ * update the vblank counter in DRM.
315+ */
316+ if (dc->caps.ips_support &&
317+ dc->config.disable_ips != DMUB_IPS_DISABLE_ALL &&
318+ sr_supported && vblank->config.disable_immediate)
319+ drm_crtc_vblank_restore(crtc);
320+
302321 /* vblank irq on -> Only need vupdate irq in vrr mode */
303322 if (amdgpu_dm_crtc_vrr_active(acrtc_state))
304323 rc = amdgpu_dm_crtc_set_vupdate_irq(crtc, true);
drivers/gpu/drm/amd/display/dc/bios/bios_parser.c+1−4
@@ -174,11 +174,8 @@ static struct graphics_object_id bios_parser_get_connector_id( · 173 unmodified lines
174174 return object_id;
175175 }
176176
177− if (tbl->ucNumberOfObjects <= i) {
178− dm_error("Can't find connector id %d in connector table of size %d.\n",
179− i, tbl->ucNumberOfObjects);
177+ if (tbl->ucNumberOfObjects <= i)
180178 return object_id;
181− }
182179
183180 id = le16_to_cpu(tbl->asObjects[i].usObjectID);
184181 object_id = object_id_from_bios_object_id(id);
drivers/gpu/drm/amd/display/dc/bios/command_table.c+1−1
@@ -993,7 +993,7 @@ static enum bp_result set_pixel_clock_v3( · 992 unmodified lines
993993 allocation.sPCLKInput.usFbDiv =
994994 cpu_to_le16((uint16_t)bp_params->feedback_divider);
995995 allocation.sPCLKInput.ucFracFbDiv =
996− (uint8_t)bp_params->fractional_feedback_divider;
996+ (uint8_t)(bp_params->fractional_feedback_divider / 100000);
997997 allocation.sPCLKInput.ucPostDiv =
998998 (uint8_t)bp_params->pixel_clock_post_divider;
999999
drivers/gpu/drm/amd/display/dc/clk_mgr/dce100/dce_clk_mgr.c+5−9
@@ -72,9 +72,9 @@ static const struct state_dependent_clocks dce80_max_clks_by_state[] = { · 71 unmodified lines
7272 /* ClocksStateLow */
7373 { .display_clk_khz = 352000, .pixel_clk_khz = 330000},
7474 /* ClocksStateNominal */
75−{ .display_clk_khz = 600000, .pixel_clk_khz = 400000 },
75+{ .display_clk_khz = 625000, .pixel_clk_khz = 400000 },
7676 /* ClocksStatePerformance */
77−{ .display_clk_khz = 600000, .pixel_clk_khz = 400000 } };
77+{ .display_clk_khz = 625000, .pixel_clk_khz = 400000 } };
7878
7979 int dentist_get_divider_from_did(int did)
8080 {
@@ -391,8 +391,6 @@ static void dce_pplib_apply_display_requirements( · 310 unmodified lines
391391 {
392392 struct dm_pp_display_configuration *pp_display_cfg = &context->pp_display_cfg;
393393
394− pp_display_cfg->avail_mclk_switch_time_us = dce110_get_min_vblank_time_us(context);
395−
396394 dce110_fill_display_configs(context, pp_display_cfg);
397395
398396 if (memcmp(&dc->current_state->pp_display_cfg, pp_display_cfg, sizeof(*pp_display_cfg)) != 0)
@@ -405,11 +403,9 @@ static void dce_update_clocks(struct clk_mgr *clk_mgr_base, · 6 unmodified lines
405403 {
406404 struct clk_mgr_internal *clk_mgr_dce = TO_CLK_MGR_INTERNAL(clk_mgr_base);
407405 struct dm_pp_power_level_change_request level_change_req;
408− int patched_disp_clk = context->bw_ctx.bw.dce.dispclk_khz;
409−
410− /*TODO: W/A for dal3 linux, investigate why this works */
411− if (!clk_mgr_dce->dfs_bypass_active)
412− patched_disp_clk = patched_disp_clk * 115 / 100;
406+ const int max_disp_clk =
407+ clk_mgr_dce->max_clks_by_state[DM_PP_CLOCKS_STATE_PERFORMANCE].display_clk_khz;
408+ int patched_disp_clk = MIN(max_disp_clk, context->bw_ctx.bw.dce.dispclk_khz);
413409
414410 level_change_req.power_level = dce_get_required_clocks_state(clk_mgr_base, context);
415411 /* get max clock state from PPLIB */
drivers/gpu/drm/amd/display/dc/clk_mgr/dce110/dce110_clk_mgr.c+23−17
@@ -120,9 +120,15 @@ void dce110_fill_display_configs( · 119 unmodified lines
120120 const struct dc_state *context,
121121 struct dm_pp_display_configuration *pp_display_cfg)
122122 {
123+ struct dc *dc = context->clk_mgr->ctx->dc;
123124 int j;
124125 int num_cfgs = 0;
125126
127+ pp_display_cfg->avail_mclk_switch_time_us = dce110_get_min_vblank_time_us(context);
128+ pp_display_cfg->disp_clk_khz = dc->clk_mgr->clks.dispclk_khz;
129+ pp_display_cfg->avail_mclk_switch_time_in_disp_active_us = 0;
130+ pp_display_cfg->crtc_index = dc->res_pool->res_cap->num_timing_generator;
131+
126132 for (j = 0; j < context->stream_count; j++) {
127133 int k;
128134
@@ -164,6 +170,23 @@ void dce110_fill_display_configs( · 35 unmodified lines
164170 cfg->v_refresh /= stream->timing.h_total;
165171 cfg->v_refresh = (cfg->v_refresh + stream->timing.v_total / 2)
166172 / stream->timing.v_total;
173+
174+ /* Find first CRTC index and calculate its line time.
175+ * This is necessary for DPM on SI GPUs.
176+ */
177+ if (cfg->pipe_idx < pp_display_cfg->crtc_index) {
178+ const struct dc_crtc_timing *timing =
179+ &context->streams[0]->timing;
180+
181+ pp_display_cfg->crtc_index = cfg->pipe_idx;
182+ pp_display_cfg->line_time_in_us =
183+ timing->h_total * 10000 / timing->pix_clk_100hz;
184+ }
185+ }
186+
187+ if (!num_cfgs) {
188+ pp_display_cfg->crtc_index = 0;
189+ pp_display_cfg->line_time_in_us = 0;
167190 }
168191
169192 pp_display_cfg->display_count = num_cfgs;
@@ -223,25 +246,8 @@ void dce11_pplib_apply_display_requirements( · 53 unmodified lines
223246 pp_display_cfg->min_engine_clock_deep_sleep_khz
224247 = context->bw_ctx.bw.dce.sclk_deep_sleep_khz;
225248
226− pp_display_cfg->avail_mclk_switch_time_us =
227− dce110_get_min_vblank_time_us(context);
228− /* TODO: dce11.2*/
229− pp_display_cfg->avail_mclk_switch_time_in_disp_active_us = 0;
230−
231− pp_display_cfg->disp_clk_khz = dc->clk_mgr->clks.dispclk_khz;
232−
233249 dce110_fill_display_configs(context, pp_display_cfg);
234250
235− /* TODO: is this still applicable?*/
236− if (pp_display_cfg->display_count == 1) {
237− const struct dc_crtc_timing *timing =
238− &context->streams[0]->timing;
239−
240− pp_display_cfg->crtc_index =
241− pp_display_cfg->disp_configs[0].pipe_idx;
242− pp_display_cfg->line_time_in_us = timing->h_total * 10000 / timing->pix_clk_100hz;
243− }
244−
245251 if (memcmp(&dc->current_state->pp_display_cfg, pp_display_cfg, sizeof(*pp_display_cfg)) != 0)
246252 dm_pp_apply_display_requirements(dc->ctx, pp_display_cfg);
247253 }
drivers/gpu/drm/amd/display/dc/clk_mgr/dce60/dce60_clk_mgr.c+9−22
@@ -83,22 +83,13 @@ static const struct state_dependent_clocks dce60_max_clks_by_state[] = { · 82 unmodified lines
8383 static int dce60_get_dp_ref_freq_khz(struct clk_mgr *clk_mgr_base)
8484 {
8585 struct clk_mgr_internal *clk_mgr = TO_CLK_MGR_INTERNAL(clk_mgr_base);
86− int dprefclk_wdivider;
87− int dp_ref_clk_khz;
88− int target_div;
86+ struct dc_context *ctx = clk_mgr_base->ctx;
87+ int dp_ref_clk_khz = 0;
8988
90− /* DCE6 has no DPREFCLK_CNTL to read DP Reference Clock source */
91−
92− /* Read the mmDENTIST_DISPCLK_CNTL to get the currently
93− * programmed DID DENTIST_DPREFCLK_WDIVIDER*/
94− REG_GET(DENTIST_DISPCLK_CNTL, DENTIST_DPREFCLK_WDIVIDER, &dprefclk_wdivider);
95−
96− /* Convert DENTIST_DPREFCLK_WDIVIDERto actual divider*/
97− target_div = dentist_get_divider_from_did(dprefclk_wdivider);
98−
99− /* Calculate the current DFS clock, in kHz.*/
100− dp_ref_clk_khz = (DENTIST_DIVIDER_RANGE_SCALE_FACTOR
101− * clk_mgr->base.dentist_vco_freq_khz) / target_div;
89+ if (ASIC_REV_IS_TAHITI_P(ctx->asic_id.hw_internal_rev))
90+ dp_ref_clk_khz = ctx->dc_bios->fw_info.default_display_engine_pll_frequency;
91+ else
92+ dp_ref_clk_khz = clk_mgr_base->clks.dispclk_khz;
10293
10394 return dce_adjust_dp_ref_freq_for_ss(clk_mgr, dp_ref_clk_khz);
10495 }
@@ -109,8 +100,6 @@ static void dce60_pplib_apply_display_requirements( · 4 unmodified lines
109100 {
110101 struct dm_pp_display_configuration *pp_display_cfg = &context->pp_display_cfg;
111102
112− pp_display_cfg->avail_mclk_switch_time_us = dce110_get_min_vblank_time_us(context);
113−
114103 dce110_fill_display_configs(context, pp_display_cfg);
115104
116105 if (memcmp(&dc->current_state->pp_display_cfg, pp_display_cfg, sizeof(*pp_display_cfg)) != 0)
@@ -123,11 +112,9 @@ static void dce60_update_clocks(struct clk_mgr *clk_mgr_base, · 6 unmodified lines
123112 {
124113 struct clk_mgr_internal *clk_mgr_dce = TO_CLK_MGR_INTERNAL(clk_mgr_base);
125114 struct dm_pp_power_level_change_request level_change_req;
126− int patched_disp_clk = context->bw_ctx.bw.dce.dispclk_khz;
127−
128− /*TODO: W/A for dal3 linux, investigate why this works */
129− if (!clk_mgr_dce->dfs_bypass_active)
130− patched_disp_clk = patched_disp_clk * 115 / 100;
115+ const int max_disp_clk =
116+ clk_mgr_dce->max_clks_by_state[DM_PP_CLOCKS_STATE_PERFORMANCE].display_clk_khz;
117+ int patched_disp_clk = MIN(max_disp_clk, context->bw_ctx.bw.dce.dispclk_khz);
131118
132119 level_change_req.power_level = dce_get_required_clocks_state(clk_mgr_base, context);
133120 /* get max clock state from PPLIB */
drivers/gpu/drm/amd/display/dc/core/dc.c+14−1
@@ -217,11 +217,24 @@ static bool create_links( · 216 unmodified lines
217217 connectors_num,
218218 num_virtual_links);
219219
220− // condition loop on link_count to allow skipping invalid indices
220+ /* When getting the number of connectors, the VBIOS reports the number of valid indices,
221+ * but it doesn't say which indices are valid, and not every index has an actual connector.
222+ * So, if we don't find a connector on an index, that is not an error.
223+ *
224+ * - There is no guarantee that the first N indices will be valid
225+ * - VBIOS may report a higher amount of valid indices than there are actual connectors
226+ * - Some VBIOS have valid configurations for more connectors than there actually are
227+ * on the card. This may be because the manufacturer used the same VBIOS for different
228+ * variants of the same card.
229+ */
221230 for (i = 0; dc->link_count < connectors_num && i < MAX_LINKS; i++) {
231+ struct graphics_object_id connector_id = bios->funcs->get_connector_id(bios, i);
222232 struct link_init_data link_init_params = {0};
223233 struct dc_link *link;
224234
235+ if (connector_id.id == CONNECTOR_ID_UNKNOWN)
236+ continue;
237+
225238 DC_LOG_DC("BIOS object table - printing link object info for connector number: %d, link_index: %d", i, dc->link_count);
226239
227240 link_init_params.ctx = dc->ctx;
drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c+4−4
@@ -896,13 +896,13 @@ void dce110_link_encoder_construct( · 895 unmodified lines
896896 enc110->base.id, &bp_cap_info);
897897
898898 /* Override features with DCE-specific values */
899− if (BP_RESULT_OK == result) {
899+ if (result == BP_RESULT_OK) {
900900 enc110->base.features.flags.bits.IS_HBR2_CAPABLE =
901901 bp_cap_info.DP_HBR2_EN;
902902 enc110->base.features.flags.bits.IS_HBR3_CAPABLE =
903903 bp_cap_info.DP_HBR3_EN;
904904 enc110->base.features.flags.bits.HDMI_6GB_EN = bp_cap_info.HDMI_6GB_EN;
905− } else {
905+ } else if (result != BP_RESULT_NORECORD) {
906906 DC_LOG_WARNING("%s: Failed to get encoder_cap_info from VBIOS with error code %d!\n",
907907 __func__,
908908 result);
@@ -1798,13 +1798,13 @@ void dce60_link_encoder_construct( · 889 unmodified lines
17981798 enc110->base.id, &bp_cap_info);
17991799
18001800 /* Override features with DCE-specific values */
1801− if (BP_RESULT_OK == result) {
1801+ if (result == BP_RESULT_OK) {
18021802 enc110->base.features.flags.bits.IS_HBR2_CAPABLE =
18031803 bp_cap_info.DP_HBR2_EN;
18041804 enc110->base.features.flags.bits.IS_HBR3_CAPABLE =
18051805 bp_cap_info.DP_HBR3_EN;
18061806 enc110->base.features.flags.bits.HDMI_6GB_EN = bp_cap_info.HDMI_6GB_EN;
1807− } else {
1807+ } else if (result != BP_RESULT_NORECORD) {
18081808 DC_LOG_WARNING("%s: Failed to get encoder_cap_info from VBIOS with error code %d!\n",
18091809 __func__,
18101810 result);
drivers/gpu/drm/amd/display/dc/dce/dmub_replay.c+3−40
@@ -4,7 +4,6 @@ · 3 unmodified lines
44
55 #include "dc.h"
66 #include "dc_dmub_srv.h"
7−#include "dc_dp_types.h"
87 #include "dmub/dmub_srv.h"
98 #include "core_types.h"
109 #include "dmub_replay.h"
@@ -44,45 +43,21 @@ static void dmub_replay_get_state(struct dmub_replay *dmub, enum replay_state *s · 33 unmodified lines
4443 /*
4544 * Enable/Disable Replay.
4645 */
47−static void dmub_replay_enable(struct dmub_replay *dmub, bool enable, bool wait, uint8_t panel_inst,
48− struct dc_link *link)
46+static void dmub_replay_enable(struct dmub_replay *dmub, bool enable, bool wait, uint8_t panel_inst)
4947 {
5048 union dmub_rb_cmd cmd;
5149 struct dc_context *dc = dmub->ctx;
5250 uint32_t retry_count;
5351 enum replay_state state = REPLAY_STATE_0;
54− struct pipe_ctx *pipe_ctx = NULL;
55− struct resource_context *res_ctx = &link->ctx->dc->current_state->res_ctx;
56− uint8_t i;
5752
5853 memset(&cmd, 0, sizeof(cmd));
5954 cmd.replay_enable.header.type = DMUB_CMD__REPLAY;
6055 cmd.replay_enable.data.panel_inst = panel_inst;
6156
6257 cmd.replay_enable.header.sub_type = DMUB_CMD__REPLAY_ENABLE;
63− if (enable) {
58+ if (enable)
6459 cmd.replay_enable.data.enable = REPLAY_ENABLE;
65− // hpo stream/link encoder assignments are not static, need to update everytime we try to enable replay
66− if (link->cur_link_settings.link_rate >= LINK_RATE_UHBR10) {
67− for (i = 0; i < MAX_PIPES; i++) {
68− if (res_ctx &&
69− res_ctx->pipe_ctx[i].stream &&
70− res_ctx->pipe_ctx[i].stream->link &&
71− res_ctx->pipe_ctx[i].stream->link == link &&
72− res_ctx->pipe_ctx[i].stream->link->connector_signal == SIGNAL_TYPE_EDP) {
73− pipe_ctx = &res_ctx->pipe_ctx[i];
74− //TODO: refactor for multi edp support
75− break;
76− }
77− }
78−
79− if (!pipe_ctx)
80− return;
81−
82− cmd.replay_enable.data.hpo_stream_enc_inst = pipe_ctx->stream_res.hpo_dp_stream_enc->inst;
83− cmd.replay_enable.data.hpo_link_enc_inst = pipe_ctx->link_res.hpo_dp_link_enc->inst;
84− }
85− } else
60+ else
8661 cmd.replay_enable.data.enable = REPLAY_DISABLE;
8762
8863 cmd.replay_enable.header.payload_bytes = sizeof(struct dmub_rb_cmd_replay_enable_data);
@@ -174,17 +149,6 @@ static bool dmub_replay_copy_settings(struct dmub_replay *dmub, · 85 unmodified lines
174149 copy_settings_data->digbe_inst = replay_context->digbe_inst;
175150 copy_settings_data->digfe_inst = replay_context->digfe_inst;
176151
177− if (link->cur_link_settings.link_rate >= LINK_RATE_UHBR10) {
178− if (pipe_ctx->stream_res.hpo_dp_stream_enc)
179− copy_settings_data->hpo_stream_enc_inst = pipe_ctx->stream_res.hpo_dp_stream_enc->inst;
180− else
181− copy_settings_data->hpo_stream_enc_inst = 0;
182− if (pipe_ctx->link_res.hpo_dp_link_enc)
183− copy_settings_data->hpo_link_enc_inst = pipe_ctx->link_res.hpo_dp_link_enc->inst;
184− else
185− copy_settings_data->hpo_link_enc_inst = 0;
186− }
187−
188152 if (pipe_ctx->plane_res.dpp)
189153 copy_settings_data->dpp_inst = pipe_ctx->plane_res.dpp->inst;
190154 else
@@ -247,7 +211,6 @@ static void dmub_replay_set_coasting_vtotal(struct dmub_replay *dmub, · 56 unmodified lines
247211 pCmd->header.type = DMUB_CMD__REPLAY;
248212 pCmd->header.sub_type = DMUB_CMD__REPLAY_SET_COASTING_VTOTAL;
249213 pCmd->header.payload_bytes = sizeof(struct dmub_cmd_replay_set_coasting_vtotal_data);
250− pCmd->replay_set_coasting_vtotal_data.panel_inst = panel_inst;
251214 pCmd->replay_set_coasting_vtotal_data.coasting_vtotal = (coasting_vtotal & 0xFFFF);
252215 pCmd->replay_set_coasting_vtotal_data.coasting_vtotal_high = (coasting_vtotal & 0xFFFF0000) >> 16;
253216
drivers/gpu/drm/amd/display/dc/dce/dmub_replay.h+1−1
@@ -19,7 +19,7 @@ struct dmub_replay_funcs { · 18 unmodified lines
1919 void (*replay_get_state)(struct dmub_replay *dmub, enum replay_state *state,
2020 uint8_t panel_inst);
2121 void (*replay_enable)(struct dmub_replay *dmub, bool enable, bool wait,
22− uint8_t panel_inst, struct dc_link *link);
22+ uint8_t panel_inst);
2323 bool (*replay_copy_settings)(struct dmub_replay *dmub, struct dc_link *link,
2424 struct replay_context *replay_context, uint8_t panel_inst);
2525 void (*replay_set_power_opt)(struct dmub_replay *dmub, unsigned int power_opt,
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c+1−1
@@ -944,7 +944,7 @@ bool edp_set_replay_allow_active(struct dc_link *link, const bool *allow_active, · 943 unmodified lines
944944 // TODO: Handle mux change case if force_static is set
945945 // If force_static is set, just change the replay_allow_active state directly
946946 if (replay != NULL && link->replay_settings.replay_feature_enabled)
947− replay->funcs->replay_enable(replay, *allow_active, wait, panel_inst, link);
947+ replay->funcs->replay_enable(replay, *allow_active, wait, panel_inst);
948948 link->replay_settings.replay_allow_active = *allow_active;
949949 }
950950
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h+0−20
@@ -4047,14 +4047,6 @@ struct dmub_cmd_replay_copy_settings_data { · 4046 unmodified lines
40474047 * DIG BE HW instance.
40484048 */
40494049 uint8_t digbe_inst;
4050− /**
4051− * @hpo_stream_enc_inst: HPO stream encoder instance
4052− */
4053− uint8_t hpo_stream_enc_inst;
4054− /**
4055− * @hpo_link_enc_inst: HPO link encoder instance
4056− */
4057− uint8_t hpo_link_enc_inst;
40584050 /**
40594051 * AUX HW instance.
40604052 */
@@ -4159,18 +4151,6 @@ struct dmub_rb_cmd_replay_enable_data { · 98 unmodified lines
41594151 * This does not support HDMI/DP2 for now.
41604152 */
41614153 uint8_t phy_rate;
4162− /**
4163− * @hpo_stream_enc_inst: HPO stream encoder instance
4164− */
4165− uint8_t hpo_stream_enc_inst;
4166− /**
4167− * @hpo_link_enc_inst: HPO link encoder instance
4168− */
4169− uint8_t hpo_link_enc_inst;
4170− /**
4171− * @pad: Align structure to 4 byte boundary.
4172− */
4173− uint8_t pad[2];
41744154 };
41754155
41764156 /**
drivers/gpu/drm/amd/display/modules/hdcp/hdcp_psp.c+3−0
@@ -260,6 +260,9 @@ enum mod_hdcp_status mod_hdcp_hdcp1_create_session(struct mod_hdcp *hdcp) · 259 unmodified lines
260260 return MOD_HDCP_STATUS_FAILURE;
261261 }
262262
263+ if (!display)
264+ return MOD_HDCP_STATUS_DISPLAY_NOT_FOUND;
265+
263266 hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.context.mem_context.shared_buf;
264267
265268 mutex_lock(&psp->hdcp_context.mutex);
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c+25−5
@@ -1697,9 +1697,11 @@ static int smu_v14_0_2_get_power_limit(struct smu_context *smu, · 1696 unmodified lines
16971697 uint32_t *min_power_limit)
16981698 {
16991699 struct smu_table_context *table_context = &smu->smu_table;
1700+ struct smu_14_0_2_powerplay_table *powerplay_table =
1701+ table_context->power_play_table;
17001702 PPTable_t *pptable = table_context->driver_pptable;
17011703 CustomSkuTable_t *skutable = &pptable->CustomSkuTable;
1702− uint32_t power_limit;
1704+ uint32_t power_limit, od_percent_upper = 0, od_percent_lower = 0;
17031705 uint32_t msg_limit = pptable->SkuTable.MsgLimits.Power[PPT_THROTTLER_PPT0][POWER_SOURCE_AC];
17041706
17051707 if (smu_v14_0_get_current_power_limit(smu, &power_limit))
@@ -1712,11 +1714,29 @@ static int smu_v14_0_2_get_power_limit(struct smu_context *smu, · 6 unmodified lines
17121714 if (default_power_limit)
17131715 *default_power_limit = power_limit;
17141716
1715− if (max_power_limit)
1716− *max_power_limit = msg_limit;
1717+ if (powerplay_table) {
1718+ if (smu->od_enabled &&
1719+ smu_v14_0_2_is_od_feature_supported(smu, PP_OD_FEATURE_PPT_BIT)) {
1720+ od_percent_upper = pptable->SkuTable.OverDriveLimitsBasicMax.Ppt;
1721+ od_percent_lower = pptable->SkuTable.OverDriveLimitsBasicMin.Ppt;
1722+ } else if (smu_v14_0_2_is_od_feature_supported(smu, PP_OD_FEATURE_PPT_BIT)) {
1723+ od_percent_upper = 0;
1724+ od_percent_lower = pptable->SkuTable.OverDriveLimitsBasicMin.Ppt;
1725+ }
1726+ }
1727+
1728+ dev_dbg(smu->adev->dev, "od percent upper:%d, od percent lower:%d (default power: %d)\n",
1729+ od_percent_upper, od_percent_lower, power_limit);
1730+
1731+ if (max_power_limit) {
1732+ *max_power_limit = msg_limit * (100 + od_percent_upper);
1733+ *max_power_limit /= 100;
1734+ }
17171735
1718− if (min_power_limit)
1719− *min_power_limit = 0;
1736+ if (min_power_limit) {
1737+ *min_power_limit = power_limit * (100 + od_percent_lower);
1738+ *min_power_limit /= 100;
1739+ }
17201740
17211741 return 0;
17221742 }
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c+2−2
@@ -1474,8 +1474,8 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data) · 1473 unmodified lines
14741474
14751475 dp = devm_drm_bridge_alloc(dev, struct analogix_dp_device, bridge,
14761476 &analogix_dp_bridge_funcs);
1477− if (!dp)
1478− return ERR_PTR(-ENOMEM);
1477+ if (IS_ERR(dp))
1478+ return ERR_CAST(dp);
14791479
14801480 dp->dev = &pdev->dev;
14811481 dp->dpms_mode = DRM_MODE_DPMS_OFF;
drivers/gpu/drm/drm_gpuvm.c+2−0
@@ -2432,6 +2432,8 @@ static const struct drm_gpuvm_ops lock_ops = { · 2431 unmodified lines
24322432 *
24332433 * The expected usage is:
24342434 *
2435+ * .. code-block:: c
2436+ *
24352437 * vm_bind {
24362438 * struct drm_exec exec;
24372439 *
drivers/gpu/drm/drm_panic_qr.rs+21−1
@@ -381,6 +381,26 @@ struct DecFifo { · 380 unmodified lines
381381 len: usize,
382382 }
383383
384+// On arm32 architecture, dividing an `u64` by a constant will generate a call
385+// to `__aeabi_uldivmod` which is not present in the kernel.
386+// So use the multiply by inverse method for this architecture.
387+fn div10(val: u64) -> u64 {
388+ if cfg!(target_arch = "arm") {
389+ let val_h = val >> 32;
390+ let val_l = val & 0xFFFFFFFF;
391+ let b_h: u64 = 0x66666666;
392+ let b_l: u64 = 0x66666667;
393+
394+ let tmp1 = val_h * b_l + ((val_l * b_l) >> 32);
395+ let tmp2 = val_l * b_h + (tmp1 & 0xffffffff);
396+ let tmp3 = val_h * b_h + (tmp1 >> 32) + (tmp2 >> 32);
397+
398+ tmp3 >> 2
399+ } else {
400+ val / 10
401+ }
402+}
403+
384404 impl DecFifo {
385405 fn push(&mut self, data: u64, len: usize) {
386406 let mut chunk = data;
@@ -389,7 +409,7 @@ impl DecFifo { · 2 unmodified lines
389409 }
390410 for i in 0..len {
391411 self.decimals[i] = (chunk % 10) as u8;
392− chunk /= 10;
412+ chunk = div10(chunk);
393413 }
394414 self.len += len;
395415 }
drivers/gpu/drm/hisilicon/hibmc/dp/dp_link.c+12−2
@@ -325,6 +325,17 @@ static int hibmc_dp_link_downgrade_training_eq(struct hibmc_dp_dev *dp) · 324 unmodified lines
325325 return hibmc_dp_link_reduce_rate(dp);
326326 }
327327
328+static void hibmc_dp_update_caps(struct hibmc_dp_dev *dp)
329+{
330+ dp->link.cap.link_rate = dp->dpcd[DP_MAX_LINK_RATE];
331+ if (dp->link.cap.link_rate > DP_LINK_BW_8_1 || !dp->link.cap.link_rate)
332+ dp->link.cap.link_rate = DP_LINK_BW_8_1;
333+
334+ dp->link.cap.lanes = dp->dpcd[DP_MAX_LANE_COUNT] & DP_MAX_LANE_COUNT_MASK;
335+ if (dp->link.cap.lanes > HIBMC_DP_LANE_NUM_MAX)
336+ dp->link.cap.lanes = HIBMC_DP_LANE_NUM_MAX;
337+}
338+
328339 int hibmc_dp_link_training(struct hibmc_dp_dev *dp)
329340 {
330341 struct hibmc_dp_link *link = &dp->link;
@@ -334,8 +345,7 @@ int hibmc_dp_link_training(struct hibmc_dp_dev *dp) · 3 unmodified lines
334345 if (ret)
335346 drm_err(dp->dev, "dp aux read dpcd failed, ret: %d\n", ret);
336347
337− dp->link.cap.link_rate = dp->dpcd[DP_MAX_LINK_RATE];
338− dp->link.cap.lanes = 0x2;
348+ hibmc_dp_update_caps(dp);
339349
340350 ret = hibmc_dp_get_serdes_rate_cfg(dp);
341351 if (ret < 0)
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c+13−9
@@ -32,7 +32,7 @@ · 31 unmodified lines
3232
3333 DEFINE_DRM_GEM_FOPS(hibmc_fops);
3434
35−static const char *g_irqs_names_map[HIBMC_MAX_VECTORS] = { "vblank", "hpd" };
35+static const char *g_irqs_names_map[HIBMC_MAX_VECTORS] = { "hibmc-vblank", "hibmc-hpd" };
3636
3737 static irqreturn_t hibmc_interrupt(int irq, void *arg)
3838 {
@@ -115,6 +115,8 @@ static const struct drm_mode_config_funcs hibmc_mode_funcs = { · 76 unmodified lines
115115 static int hibmc_kms_init(struct hibmc_drm_private *priv)
116116 {
117117 struct drm_device *dev = &priv->dev;
118+ struct drm_encoder *encoder;
119+ u32 clone_mask = 0;
118120 int ret;
119121
120122 ret = drmm_mode_config_init(dev);
@@ -154,6 +156,12 @@ static int hibmc_kms_init(struct hibmc_drm_private *priv) · 33 unmodified lines
154156 return ret;
155157 }
156158
159+ drm_for_each_encoder(encoder, dev)
160+ clone_mask |= drm_encoder_mask(encoder);
161+
162+ drm_for_each_encoder(encoder, dev)
163+ encoder->possible_clones = clone_mask;
164+
157165 return 0;
158166 }
159167
@@ -277,7 +285,6 @@ static void hibmc_unload(struct drm_device *dev) · 117 unmodified lines
277285 static int hibmc_msi_init(struct drm_device *dev)
278286 {
279287 struct pci_dev *pdev = to_pci_dev(dev->dev);
280− char name[32] = {0};
281288 int valid_irq_num;
282289 int irq;
283290 int ret;
@@ -292,9 +299,6 @@ static int hibmc_msi_init(struct drm_device *dev) · 8 unmodified lines
292299 valid_irq_num = ret;
293300
294301 for (int i = 0; i < valid_irq_num; i++) {
295− snprintf(name, ARRAY_SIZE(name) - 1, "%s-%s-%s",
296− dev->driver->name, pci_name(pdev), g_irqs_names_map[i]);
297−
298302 irq = pci_irq_vector(pdev, i);
299303
300304 if (i)
@@ -302,10 +306,10 @@ static int hibmc_msi_init(struct drm_device *dev) · 1 unmodified line
302306 ret = devm_request_threaded_irq(&pdev->dev, irq,
303307 hibmc_dp_interrupt,
304308 hibmc_dp_hpd_isr,
305− IRQF_SHARED, name, dev);
309+ IRQF_SHARED, g_irqs_names_map[i], dev);
306310 else
307311 ret = devm_request_irq(&pdev->dev, irq, hibmc_interrupt,
308− IRQF_SHARED, name, dev);
312+ IRQF_SHARED, g_irqs_names_map[i], dev);
309313 if (ret) {
310314 drm_err(dev, "install irq failed: %d\n", ret);
311315 return ret;
@@ -323,13 +327,13 @@ static int hibmc_load(struct drm_device *dev) · 11 unmodified lines
323327
324328 ret = hibmc_hw_init(priv);
325329 if (ret)
326− goto err;
330+ return ret;
327331
328332 ret = drmm_vram_helper_init(dev, pci_resource_start(pdev, 0),
329333 pci_resource_len(pdev, 0));
330334 if (ret) {
331335 drm_err(dev, "Error initializing VRAM MM; %d\n", ret);
332− goto err;
336+ return ret;
333337 }
334338
335339 ret = hibmc_kms_init(priv);
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h+1−0
@@ -69,6 +69,7 @@ int hibmc_de_init(struct hibmc_drm_private *priv); · 68 unmodified lines
6969 int hibmc_vdac_init(struct hibmc_drm_private *priv);
7070
7171 int hibmc_ddc_create(struct drm_device *drm_dev, struct hibmc_vdac *connector);
72+void hibmc_ddc_del(struct hibmc_vdac *vdac);
7273
7374 int hibmc_dp_init(struct hibmc_drm_private *priv);
7475
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_i2c.c+5−0
@@ -95,3 +95,8 @@ int hibmc_ddc_create(struct drm_device *drm_dev, struct hibmc_vdac *vdac) · 94 unmodified lines
9595
9696 return i2c_bit_add_bus(&vdac->adapter);
9797 }
98+
99+void hibmc_ddc_del(struct hibmc_vdac *vdac)
100+{
101+ i2c_del_adapter(&vdac->adapter);
102+}
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c+8−3
@@ -53,7 +53,7 @@ static void hibmc_connector_destroy(struct drm_connector *connector) · 52 unmodified lines
5353 {
5454 struct hibmc_vdac *vdac = to_hibmc_vdac(connector);
5555
56− i2c_del_adapter(&vdac->adapter);
56+ hibmc_ddc_del(vdac);
5757 drm_connector_cleanup(connector);
5858 }
5959
@@ -110,7 +110,7 @@ int hibmc_vdac_init(struct hibmc_drm_private *priv) · 50 unmodified lines
110110 ret = drmm_encoder_init(dev, encoder, NULL, DRM_MODE_ENCODER_DAC, NULL);
111111 if (ret) {
112112 drm_err(dev, "failed to init encoder: %d\n", ret);
113− return ret;
113+ goto err;
114114 }
115115
116116 drm_encoder_helper_add(encoder, &hibmc_encoder_helper_funcs);
@@ -121,7 +121,7 @@ int hibmc_vdac_init(struct hibmc_drm_private *priv) · 4 unmodified lines
121121 &vdac->adapter);
122122 if (ret) {
123123 drm_err(dev, "failed to init connector: %d\n", ret);
124− return ret;
124+ goto err;
125125 }
126126
127127 drm_connector_helper_add(connector, &hibmc_connector_helper_funcs);
@@ -131,4 +131,9 @@ int hibmc_vdac_init(struct hibmc_drm_private *priv) · 3 unmodified lines
131131 connector->polled = DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT;
132132
133133 return 0;
134+
135+err:
136+ hibmc_ddc_del(vdac);
137+
138+ return ret;
134139 }
drivers/gpu/drm/i915/display/intel_display_irq.c+4−0
@@ -1506,10 +1506,14 @@ u32 gen11_gu_misc_irq_ack(struct intel_display *display, const u32 master_ctl) · 1505 unmodified lines
15061506 if (!(master_ctl & GEN11_GU_MISC_IRQ))
15071507 return 0;
15081508
1509+ intel_display_rpm_assert_block(display);
1510+
15091511 iir = intel_de_read(display, GEN11_GU_MISC_IIR);
15101512 if (likely(iir))
15111513 intel_de_write(display, GEN11_GU_MISC_IIR, iir);
15121514
1515+ intel_display_rpm_assert_unblock(display);
1516+
15131517 return iir;
15141518 }
15151519
drivers/gpu/drm/i915/display/intel_tc.c+75−18
@@ -23,6 +23,7 @@ · 22 unmodified lines
2323 #include "intel_modeset_lock.h"
2424 #include "intel_tc.h"
2525
26+#define DP_PIN_ASSIGNMENT_NONE 0x0
2627 #define DP_PIN_ASSIGNMENT_C 0x3
2728 #define DP_PIN_ASSIGNMENT_D 0x4
2829 #define DP_PIN_ASSIGNMENT_E 0x5
@@ -66,6 +67,7 @@ struct intel_tc_port { · 37 unmodified lines
6667 enum tc_port_mode init_mode;
6768 enum phy_fia phy_fia;
6869 u8 phy_fia_idx;
70+ u8 max_lane_count;
6971 };
7072
7173 static enum intel_display_power_domain
@@ -307,6 +309,8 @@ static int lnl_tc_port_get_max_lane_count(struct intel_digital_port *dig_port) · 235 unmodified lines
307309 REG_FIELD_GET(TCSS_DDI_STATUS_PIN_ASSIGNMENT_MASK, val);
308310
309311 switch (pin_assignment) {
312+ case DP_PIN_ASSIGNMENT_NONE:
313+ return 0;
310314 default:
311315 MISSING_CASE(pin_assignment);
312316 fallthrough;
@@ -365,12 +369,12 @@ static int intel_tc_port_get_max_lane_count(struct intel_digital_port *dig_port) · 52 unmodified lines
365369 }
366370 }
367371
368−int intel_tc_port_max_lane_count(struct intel_digital_port *dig_port)
372+static int get_max_lane_count(struct intel_tc_port *tc)
369373 {
370− struct intel_display *display = to_intel_display(dig_port);
371− struct intel_tc_port *tc = to_tc_port(dig_port);
374+ struct intel_display *display = to_intel_display(tc->dig_port);
375+ struct intel_digital_port *dig_port = tc->dig_port;
372376
373− if (!intel_encoder_is_tc(&dig_port->base) || tc->mode != TC_PORT_DP_ALT)
377+ if (tc->mode != TC_PORT_DP_ALT)
374378 return 4;
375379
376380 assert_tc_cold_blocked(tc);
@@ -384,6 +388,25 @@ int intel_tc_port_max_lane_count(struct intel_digital_port *dig_port) · 7 unmodified lines
384388 return intel_tc_port_get_max_lane_count(dig_port);
385389 }
386390
391+static void read_pin_configuration(struct intel_tc_port *tc)
392+{
393+ tc->max_lane_count = get_max_lane_count(tc);
394+}
395+
396+int intel_tc_port_max_lane_count(struct intel_digital_port *dig_port)
397+{
398+ struct intel_display *display = to_intel_display(dig_port);
399+ struct intel_tc_port *tc = to_tc_port(dig_port);
400+
401+ if (!intel_encoder_is_tc(&dig_port->base))
402+ return 4;
403+
404+ if (DISPLAY_VER(display) < 20)
405+ return get_max_lane_count(tc);
406+
407+ return tc->max_lane_count;
408+}
409+
387410 void intel_tc_port_set_fia_lane_count(struct intel_digital_port *dig_port,
388411 int required_lanes)
389412 {
@@ -596,9 +619,12 @@ static void icl_tc_phy_get_hw_state(struct intel_tc_port *tc) · 206 unmodified lines
596619 tc_cold_wref = __tc_cold_block(tc, &domain);
597620
598621 tc->mode = tc_phy_get_current_mode(tc);
599− if (tc->mode != TC_PORT_DISCONNECTED)
622+ if (tc->mode != TC_PORT_DISCONNECTED) {
600623 tc->lock_wakeref = tc_cold_block(tc);
601624
625+ read_pin_configuration(tc);
626+ }
627+
602628 __tc_cold_unblock(tc, domain, tc_cold_wref);
603629 }
604630
@@ -656,8 +682,11 @@ static bool icl_tc_phy_connect(struct intel_tc_port *tc, · 51 unmodified lines
656682
657683 tc->lock_wakeref = tc_cold_block(tc);
658684
659− if (tc->mode == TC_PORT_TBT_ALT)
685+ if (tc->mode == TC_PORT_TBT_ALT) {
686+ read_pin_configuration(tc);
687+
660688 return true;
689+ }
661690
662691 if ((!tc_phy_is_ready(tc) ||
663692 !icl_tc_phy_take_ownership(tc, true)) &&
@@ -668,6 +697,7 @@ static bool icl_tc_phy_connect(struct intel_tc_port *tc, · 4 unmodified lines
668697 goto out_unblock_tc_cold;
669698 }
670699
700+ read_pin_configuration(tc);
671701
672702 if (!tc_phy_verify_legacy_or_dp_alt_mode(tc, required_lanes))
673703 goto out_release_phy;
@@ -858,9 +888,12 @@ static void adlp_tc_phy_get_hw_state(struct intel_tc_port *tc) · 184 unmodified lines
858888 port_wakeref = intel_display_power_get(display, port_power_domain);
859889
860890 tc->mode = tc_phy_get_current_mode(tc);
861− if (tc->mode != TC_PORT_DISCONNECTED)
891+ if (tc->mode != TC_PORT_DISCONNECTED) {
862892 tc->lock_wakeref = tc_cold_block(tc);
863893
894+ read_pin_configuration(tc);
895+ }
896+
864897 intel_display_power_put(display, port_power_domain, port_wakeref);
865898 }
866899
@@ -873,6 +906,9 @@ static bool adlp_tc_phy_connect(struct intel_tc_port *tc, int required_lanes) · 6 unmodified lines
873906
874907 if (tc->mode == TC_PORT_TBT_ALT) {
875908 tc->lock_wakeref = tc_cold_block(tc);
909+
910+ read_pin_configuration(tc);
911+
876912 return true;
877913 }
878914
@@ -894,6 +930,8 @@ static bool adlp_tc_phy_connect(struct intel_tc_port *tc, int required_lanes) · 15 unmodified lines
894930
895931 tc->lock_wakeref = tc_cold_block(tc);
896932
933+ read_pin_configuration(tc);
934+
897935 if (!tc_phy_verify_legacy_or_dp_alt_mode(tc, required_lanes))
898936 goto out_unblock_tc_cold;
899937
@@ -1124,9 +1162,18 @@ static void xelpdp_tc_phy_get_hw_state(struct intel_tc_port *tc) · 224 unmodified lines
11241162 tc_cold_wref = __tc_cold_block(tc, &domain);
11251163
11261164 tc->mode = tc_phy_get_current_mode(tc);
1127− if (tc->mode != TC_PORT_DISCONNECTED)
1165+ if (tc->mode != TC_PORT_DISCONNECTED) {
11281166 tc->lock_wakeref = tc_cold_block(tc);
11291167
1168+ read_pin_configuration(tc);
1169+ /*
1170+ * Set a valid lane count value for a DP-alt sink which got
1171+ * disconnected. The driver can only disable the output on this PHY.
1172+ */
1173+ if (tc->max_lane_count == 0)
1174+ tc->max_lane_count = 4;
1175+ }
1176+
11301177 drm_WARN_ON(display->drm,
11311178 (tc->mode == TC_PORT_DP_ALT || tc->mode == TC_PORT_LEGACY) &&
11321179 !xelpdp_tc_phy_tcss_power_is_enabled(tc));
@@ -1138,14 +1185,19 @@ static bool xelpdp_tc_phy_connect(struct intel_tc_port *tc, int required_lanes) · 5 unmodified lines
11381185 {
11391186 tc->lock_wakeref = tc_cold_block(tc);
11401187
1141− if (tc->mode == TC_PORT_TBT_ALT)
1188+ if (tc->mode == TC_PORT_TBT_ALT) {
1189+ read_pin_configuration(tc);
1190+
11421191 return true;
1192+ }
11431193
11441194 if (!xelpdp_tc_phy_enable_tcss_power(tc, true))
11451195 goto out_unblock_tccold;
11461196
11471197 xelpdp_tc_phy_take_ownership(tc, true);
11481198
1199+ read_pin_configuration(tc);
1200+
11491201 if (!tc_phy_verify_legacy_or_dp_alt_mode(tc, required_lanes))
11501202 goto out_release_phy;
11511203
@@ -1226,14 +1278,19 @@ static void tc_phy_get_hw_state(struct intel_tc_port *tc) · 74 unmodified lines
12261278 tc->phy_ops->get_hw_state(tc);
12271279 }
12281280
1229−static bool tc_phy_is_ready_and_owned(struct intel_tc_port *tc,
1230− bool phy_is_ready, bool phy_is_owned)
1281+/* Is the PHY owned by display i.e. is it in legacy or DP-alt mode? */
1282+static bool tc_phy_owned_by_display(struct intel_tc_port *tc,
1283+ bool phy_is_ready, bool phy_is_owned)
12311284 {
12321285 struct intel_display *display = to_intel_display(tc->dig_port);
12331286
1234− drm_WARN_ON(display->drm, phy_is_owned && !phy_is_ready);
1287+ if (DISPLAY_VER(display) < 20) {
1288+ drm_WARN_ON(display->drm, phy_is_owned && !phy_is_ready);
12351289
1236− return phy_is_ready && phy_is_owned;
1290+ return phy_is_ready && phy_is_owned;
1291+ } else {
1292+ return phy_is_owned;
1293+ }
12371294 }
12381295
12391296 static bool tc_phy_is_connected(struct intel_tc_port *tc,
@@ -1244,7 +1301,7 @@ static bool tc_phy_is_connected(struct intel_tc_port *tc, · 4 unmodified lines
12441301 bool phy_is_owned = tc_phy_is_owned(tc);
12451302 bool is_connected;
12461303
1247− if (tc_phy_is_ready_and_owned(tc, phy_is_ready, phy_is_owned))
1304+ if (tc_phy_owned_by_display(tc, phy_is_ready, phy_is_owned))
12481305 is_connected = port_pll_type == ICL_PORT_DPLL_MG_PHY;
12491306 else
12501307 is_connected = port_pll_type == ICL_PORT_DPLL_DEFAULT;
@@ -1352,7 +1409,7 @@ tc_phy_get_current_mode(struct intel_tc_port *tc) · 101 unmodified lines
13521409 phy_is_ready = tc_phy_is_ready(tc);
13531410 phy_is_owned = tc_phy_is_owned(tc);
13541411
1355− if (!tc_phy_is_ready_and_owned(tc, phy_is_ready, phy_is_owned)) {
1412+ if (!tc_phy_owned_by_display(tc, phy_is_ready, phy_is_owned)) {
13561413 mode = get_tc_mode_in_phy_not_owned_state(tc, live_mode);
13571414 } else {
13581415 drm_WARN_ON(display->drm, live_mode == TC_PORT_TBT_ALT);
@@ -1441,11 +1498,11 @@ static void intel_tc_port_reset_mode(struct intel_tc_port *tc, · 82 unmodified lines
14411498 intel_display_power_flush_work(display);
14421499 if (!intel_tc_cold_requires_aux_pw(dig_port)) {
14431500 enum intel_display_power_domain aux_domain;
1444− bool aux_powered;
14451501
14461502 aux_domain = intel_aux_power_domain(dig_port);
1447− aux_powered = intel_display_power_is_enabled(display, aux_domain);
1448− drm_WARN_ON(display->drm, aux_powered);
1503+ if (intel_display_power_is_enabled(display, aux_domain))
1504+ drm_dbg_kms(display->drm, "Port %s: AUX unexpectedly powered\n",
1505+ tc->port_name);
14491506 }
14501507
14511508 tc_phy_disconnect(tc);
drivers/gpu/drm/i915/gt/intel_workarounds.c+11−9
@@ -634,6 +634,8 @@ static void cfl_ctx_workarounds_init(struct intel_engine_cs *engine, · 633 unmodified lines
634634 static void icl_ctx_workarounds_init(struct intel_engine_cs *engine,
635635 struct i915_wa_list *wal)
636636 {
637+ struct drm_i915_private *i915 = engine->i915;
638+
637639 /* Wa_1406697149 (WaDisableBankHangMode:icl) */
638640 wa_write(wal, GEN8_L3CNTLREG, GEN8_ERRDETBCTRL);
639641
@@ -669,6 +671,15 @@ static void icl_ctx_workarounds_init(struct intel_engine_cs *engine, · 29 unmodified lines
669671
670672 /* Wa_1406306137:icl,ehl */
671673 wa_mcr_masked_en(wal, GEN9_ROW_CHICKEN4, GEN11_DIS_PICK_2ND_EU);
674+
675+ if (IS_JASPERLAKE(i915) || IS_ELKHARTLAKE(i915)) {
676+ /*
677+ * Disable Repacking for Compression (masked R/W access)
678+ * before rendering compressed surfaces for display.
679+ */
680+ wa_masked_en(wal, CACHE_MODE_0_GEN7,
681+ DISABLE_REPACKING_FOR_COMPRESSION);
682+ }
672683 }
673684
674685 /*
@@ -2306,15 +2317,6 @@ rcs_engine_wa_init(struct intel_engine_cs *engine, struct i915_wa_list *wal) · 1631 unmodified lines
23062317 GEN8_RC_SEMA_IDLE_MSG_DISABLE);
23072318 }
23082319
2309− if (IS_JASPERLAKE(i915) || IS_ELKHARTLAKE(i915)) {
2310− /*
2311− * "Disable Repacking for Compression (masked R/W access)
2312− * before rendering compressed surfaces for display."
2313− */
2314− wa_masked_en(wal, CACHE_MODE_0_GEN7,
2315− DISABLE_REPACKING_FOR_COMPRESSION);
2316− }
2317−
23182320 if (GRAPHICS_VER(i915) == 11) {
23192321 /* This is not an Wa. Enable for better image quality */
23202322 wa_masked_en(wal,
drivers/gpu/drm/nouveau/nouveau_exec.c+3−3
@@ -60,14 +60,14 @@ · 59 unmodified lines
6060 * virtual address in the GPU's VA space there is no guarantee that the actual
6161 * mappings are created in the GPU's MMU. If the given memory is swapped out
6262 * at the time the bind operation is executed the kernel will stash the mapping
63− * details into it's internal alloctor and create the actual MMU mappings once
63+ * details into it's internal allocator and create the actual MMU mappings once
6464 * the memory is swapped back in. While this is transparent for userspace, it is
6565 * guaranteed that all the backing memory is swapped back in and all the memory
6666 * mappings, as requested by userspace previously, are actually mapped once the
6767 * DRM_NOUVEAU_EXEC ioctl is called to submit an exec job.
6868 *
6969 * A VM_BIND job can be executed either synchronously or asynchronously. If
70− * exectued asynchronously, userspace may provide a list of syncobjs this job
70+ * executed asynchronously, userspace may provide a list of syncobjs this job
7171 * will wait for and/or a list of syncobj the kernel will signal once the
7272 * VM_BIND job finished execution. If executed synchronously the ioctl will
7373 * block until the bind job is finished. For synchronous jobs the kernel will
@@ -82,7 +82,7 @@ · 8 unmodified lines
8282 * Since VM_BIND jobs update the GPU's VA space on job submit, EXEC jobs do have
8383 * an up to date view of the VA space. However, the actual mappings might still
8484 * be pending. Hence, EXEC jobs require to have the particular fences - of
85− * the corresponding VM_BIND jobs they depent on - attached to them.
85+ * the corresponding VM_BIND jobs they depend on - attached to them.
8686 */
8787
8888 static int
drivers/gpu/drm/nouveau/nvif/vmm.c+2−1
@@ -219,7 +219,8 @@ nvif_vmm_ctor(struct nvif_mmu *mmu, const char *name, s32 oclass, · 218 unmodified lines
219219 case RAW: args->type = NVIF_VMM_V0_TYPE_RAW; break;
220220 default:
221221 WARN_ON(1);
222− return -EINVAL;
222+ ret = -EINVAL;
223+ goto done;
223224 }
224225
225226 memcpy(args->data, argv, argc);
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/rpc.c+2−2
@@ -325,7 +325,7 @@ r535_gsp_msgq_recv(struct nvkm_gsp *gsp, u32 gsp_rpc_len, int *retries) · 324 unmodified lines
325325
326326 rpc = r535_gsp_msgq_peek(gsp, sizeof(*rpc), info.retries);
327327 if (IS_ERR_OR_NULL(rpc)) {
328− kfree(buf);
328+ kvfree(buf);
329329 return rpc;
330330 }
331331
@@ -334,7 +334,7 @@ r535_gsp_msgq_recv(struct nvkm_gsp *gsp, u32 gsp_rpc_len, int *retries) · 2 unmodified lines
334334
335335 rpc = r535_gsp_msgq_recv_one_elem(gsp, &info);
336336 if (IS_ERR_OR_NULL(rpc)) {
337− kfree(buf);
337+ kvfree(buf);
338338 return rpc;
339339 }
340340
drivers/gpu/drm/nova/file.rs+2−1
@@ -39,7 +39,8 @@ impl File { · 38 unmodified lines
3939 _ => return Err(EINVAL),
4040 };
4141
42− getparam.set_value(value);
42+ #[allow(clippy::useless_conversion)]
43+ getparam.set_value(value.into());
4344
4445 Ok(0)
4546 }
drivers/gpu/drm/rockchip/Kconfig+1−0
@@ -53,6 +53,7 @@ config ROCKCHIP_CDN_DP · 52 unmodified lines
5353 bool "Rockchip cdn DP"
5454 depends on EXTCON=y || (EXTCON=m && DRM_ROCKCHIP=m)
5555 select DRM_DISPLAY_HELPER
56+ select DRM_BRIDGE_CONNECTOR
5657 select DRM_DISPLAY_DP_HELPER
5758 help
5859 This selects support for Rockchip SoC specific extensions
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c+5−4
@@ -2579,12 +2579,13 @@ static int vop2_win_init(struct vop2 *vop2) · 2578 unmodified lines
25792579 }
25802580
25812581 /*
2582− * The window registers are only updated when config done is written.
2583− * Until that they read back the old value. As we read-modify-write
2584− * these registers mark them as non-volatile. This makes sure we read
2585− * the new values from the regmap register cache.
2582+ * The window and video port registers are only updated when config
2583+ * done is written. Until that they read back the old value. As we
2584+ * read-modify-write these registers mark them as non-volatile. This
2585+ * makes sure we read the new values from the regmap register cache.
25862586 */
25872587 static const struct regmap_range vop2_nonvolatile_range[] = {
2588+ regmap_reg_range(RK3568_VP0_CTRL_BASE, RK3588_VP3_CTRL_BASE + 255),
25882589 regmap_reg_range(0x1000, 0x23ff),
25892590 };
25902591
drivers/gpu/drm/tests/drm_format_helper_test.c+2−1
@@ -1033,13 +1033,14 @@ static void drm_test_fb_xrgb8888_to_xrgb2101010(struct kunit *test) · 1032 unmodified lines
10331033 NULL : &result->dst_pitch;
10341034
10351035 drm_fb_xrgb8888_to_xrgb2101010(&dst, dst_pitch, &src, &fb, &params->clip, &fmtcnv_state);
1036− buf = le32buf_to_cpu(test, buf, dst_size / sizeof(u32));
1036+ buf = le32buf_to_cpu(test, (__force const __le32 *)buf, dst_size / sizeof(u32));
10371037 KUNIT_EXPECT_MEMEQ(test, buf, result->expected, dst_size);
10381038
10391039 buf = dst.vaddr; /* restore original value of buf */
10401040 memset(buf, 0, dst_size);
10411041
10421042 drm_fb_xrgb8888_to_xrgb2101010(&dst, dst_pitch, &src, &fb, &params->clip, &fmtcnv_state);
1043+ buf = le32buf_to_cpu(test, (__force const __le32 *)buf, dst_size / sizeof(u32));
10431044 KUNIT_EXPECT_MEMEQ(test, buf, result->expected, dst_size);
10441045 }
10451046
drivers/gpu/drm/xe/xe_migrate.c+1−1
@@ -408,7 +408,7 @@ struct xe_migrate *xe_migrate_init(struct xe_tile *tile) · 407 unmodified lines
408408
409409 /* Special layout, prepared below.. */
410410 vm = xe_vm_create(xe, XE_VM_FLAG_MIGRATION |
411− XE_VM_FLAG_SET_TILE_ID(tile));
411+ XE_VM_FLAG_SET_TILE_ID(tile), NULL);
412412 if (IS_ERR(vm))
413413 return ERR_CAST(vm);
414414
drivers/gpu/drm/xe/xe_pxp_submit.c+1−1
@@ -101,7 +101,7 @@ static int allocate_gsc_client_resources(struct xe_gt *gt, · 100 unmodified lines
101101 xe_assert(xe, hwe);
102102
103103 /* PXP instructions must be issued from PPGTT */
104− vm = xe_vm_create(xe, XE_VM_FLAG_GSC);
104+ vm = xe_vm_create(xe, XE_VM_FLAG_GSC, NULL);
105105 if (IS_ERR(vm))
106106 return PTR_ERR(vm);
107107
drivers/gpu/drm/xe/xe_vm.c+23−25
@@ -1640,7 +1640,7 @@ static void xe_vm_free_scratch(struct xe_vm *vm) · 1639 unmodified lines
16401640 }
16411641 }
16421642
1643−struct xe_vm *xe_vm_create(struct xe_device *xe, u32 flags)
1643+struct xe_vm *xe_vm_create(struct xe_device *xe, u32 flags, struct xe_file *xef)
16441644 {
16451645 struct drm_gem_object *vm_resv_obj;
16461646 struct xe_vm *vm;
@@ -1661,9 +1661,10 @@ struct xe_vm *xe_vm_create(struct xe_device *xe, u32 flags) · 14 unmodified lines
16611661 vm->xe = xe;
16621662
16631663 vm->size = 1ull << xe->info.va_bits;
1664−
16651664 vm->flags = flags;
16661665
1666+ if (xef)
1667+ vm->xef = xe_file_get(xef);
16671668 /**
16681669 * GSC VMs are kernel-owned, only used for PXP ops and can sometimes be
16691670 * manipulated under the PXP mutex. However, the PXP mutex can be taken
@@ -1794,6 +1795,20 @@ struct xe_vm *xe_vm_create(struct xe_device *xe, u32 flags) · 124 unmodified lines
17941795 if (number_tiles > 1)
17951796 vm->composite_fence_ctx = dma_fence_context_alloc(1);
17961797
1798+ if (xef && xe->info.has_asid) {
1799+ u32 asid;
1800+
1801+ down_write(&xe->usm.lock);
1802+ err = xa_alloc_cyclic(&xe->usm.asid_to_vm, &asid, vm,
1803+ XA_LIMIT(1, XE_MAX_ASID - 1),
1804+ &xe->usm.next_asid, GFP_KERNEL);
1805+ up_write(&xe->usm.lock);
1806+ if (err < 0)
1807+ goto err_unlock_close;
1808+
1809+ vm->usm.asid = asid;
1810+ }
1811+
17971812 trace_xe_vm_create(vm);
17981813
17991814 return vm;
@@ -1814,6 +1829,8 @@ err_no_resv: · 14 unmodified lines
18141829 for_each_tile(tile, xe, id)
18151830 xe_range_fence_tree_fini(&vm->rftree[id]);
18161831 ttm_lru_bulk_move_fini(&xe->ttm, &vm->lru_bulk_move);
1832+ if (vm->xef)
1833+ xe_file_put(vm->xef);
18171834 kfree(vm);
18181835 if (flags & XE_VM_FLAG_LR_MODE)
18191836 xe_pm_runtime_put(xe);
@@ -2059,9 +2076,8 @@ int xe_vm_create_ioctl(struct drm_device *dev, void *data, · 239 unmodified lines
20592076 struct xe_device *xe = to_xe_device(dev);
20602077 struct xe_file *xef = to_xe_file(file);
20612078 struct drm_xe_vm_create *args = data;
2062− struct xe_tile *tile;
20632079 struct xe_vm *vm;
2064− u32 id, asid;
2080+ u32 id;
20652081 int err;
20662082 u32 flags = 0;
20672083
@@ -2097,29 +2113,10 @@ int xe_vm_create_ioctl(struct drm_device *dev, void *data, · 29 unmodified lines
20972113 if (args->flags & DRM_XE_VM_CREATE_FLAG_FAULT_MODE)
20982114 flags |= XE_VM_FLAG_FAULT_MODE;
20992115
2100− vm = xe_vm_create(xe, flags);
2116+ vm = xe_vm_create(xe, flags, xef);
21012117 if (IS_ERR(vm))
21022118 return PTR_ERR(vm);
21032119
2104− if (xe->info.has_asid) {
2105− down_write(&xe->usm.lock);
2106− err = xa_alloc_cyclic(&xe->usm.asid_to_vm, &asid, vm,
2107− XA_LIMIT(1, XE_MAX_ASID - 1),
2108− &xe->usm.next_asid, GFP_KERNEL);
2109− up_write(&xe->usm.lock);
2110− if (err < 0)
2111− goto err_close_and_put;
2112−
2113− vm->usm.asid = asid;
2114− }
2115−
2116− vm->xef = xe_file_get(xef);
2117−
2118− /* Record BO memory for VM pagetable created against client */
2119− for_each_tile(tile, xe, id)
2120− if (vm->pt_root[id])
2121− xe_drm_client_add_bo(vm->xef->client, vm->pt_root[id]->bo);
2122−
21232120 #if IS_ENABLED(CONFIG_DRM_XE_DEBUG_MEM)
21242121 /* Warning: Security issue - never enable by default */
21252122 args->reserved[0] = xe_bo_main_addr(vm->pt_root[0]->bo, XE_PAGE_SIZE);
@@ -3421,6 +3418,7 @@ static int vm_bind_ioctl_check_args(struct xe_device *xe, struct xe_vm *vm, · 1295 unmodified lines
34213418 free_bind_ops:
34223419 if (args->num_binds > 1)
34233420 kvfree(*bind_ops);
3421+ *bind_ops = NULL;
34243422 return err;
34253423 }
34263424
@@ -3527,7 +3525,7 @@ int xe_vm_bind_ioctl(struct drm_device *dev, void *data, struct drm_file *file) · 100 unmodified lines
35273525 struct xe_exec_queue *q = NULL;
35283526 u32 num_syncs, num_ufence = 0;
35293527 struct xe_sync_entry *syncs = NULL;
3530− struct drm_xe_vm_bind_op *bind_ops;
3528+ struct drm_xe_vm_bind_op *bind_ops = NULL;
35313529 struct xe_vma_ops vops;
35323530 struct dma_fence *fence;
35333531 int err;
drivers/gpu/drm/xe/xe_vm.h+1−1
@@ -26,7 +26,7 @@ struct xe_sync_entry; · 25 unmodified lines
2626 struct xe_svm_range;
2727 struct drm_exec;
2828
29−struct xe_vm *xe_vm_create(struct xe_device *xe, u32 flags);
29+struct xe_vm *xe_vm_create(struct xe_device *xe, u32 flags, struct xe_file *xef);
3030
3131 struct xe_vm *xe_vm_lookup(struct xe_file *xef, u32 id);
3232 int xe_vma_cmp_vma_cb(const void *key, const struct rb_node *node);
drivers/i2c/busses/i2c-rtl9300.c+12−8
@@ -143,10 +143,10 @@ static int rtl9300_i2c_write(struct rtl9300_i2c *i2c, u8 *buf, int len) · 142 unmodified lines
143143 return -EIO;
144144
145145 for (i = 0; i < len; i++) {
146− if (i % 4 == 0)
147− vals[i/4] = 0;
148− vals[i/4] <<= 8;
149− vals[i/4] |= buf[i];
146+ unsigned int shift = (i % 4) * 8;
147+ unsigned int reg = i / 4;
148+
149+ vals[reg] |= buf[i] << shift;
150150 }
151151
152152 return regmap_bulk_write(i2c->regmap, i2c->reg_base + RTL9300_I2C_MST_DATA_WORD0,
@@ -175,7 +175,7 @@ static int rtl9300_i2c_execute_xfer(struct rtl9300_i2c *i2c, char read_write, · 22 unmodified lines
175175 return ret;
176176
177177 ret = regmap_read_poll_timeout(i2c->regmap, i2c->reg_base + RTL9300_I2C_MST_CTRL1,
178− val, !(val & RTL9300_I2C_MST_CTRL1_I2C_TRIG), 100, 2000);
178+ val, !(val & RTL9300_I2C_MST_CTRL1_I2C_TRIG), 100, 100000);
179179 if (ret)
180180 return ret;
181181
@@ -281,15 +281,19 @@ static int rtl9300_i2c_smbus_xfer(struct i2c_adapter *adap, u16 addr, unsigned s · 99 unmodified lines
281281 ret = rtl9300_i2c_reg_addr_set(i2c, command, 1);
282282 if (ret)
283283 goto out_unlock;
284− ret = rtl9300_i2c_config_xfer(i2c, chan, addr, data->block[0]);
284+ if (data->block[0] < 1 || data->block[0] > I2C_SMBUS_BLOCK_MAX) {
285+ ret = -EINVAL;
286+ goto out_unlock;
287+ }
288+ ret = rtl9300_i2c_config_xfer(i2c, chan, addr, data->block[0] + 1);
285289 if (ret)
286290 goto out_unlock;
287291 if (read_write == I2C_SMBUS_WRITE) {
288− ret = rtl9300_i2c_write(i2c, &data->block[1], data->block[0]);
292+ ret = rtl9300_i2c_write(i2c, &data->block[0], data->block[0] + 1);
289293 if (ret)
290294 goto out_unlock;
291295 }
292− len = data->block[0];
296+ len = data->block[0] + 1;
293297 break;
294298
295299 default:
drivers/iio/accel/sca3300.c+1−1
@@ -477,7 +477,7 @@ static irqreturn_t sca3300_trigger_handler(int irq, void *p) · 476 unmodified lines
477477 struct iio_dev *indio_dev = pf->indio_dev;
478478 struct sca3300_data *data = iio_priv(indio_dev);
479479 int bit, ret, val, i = 0;
480− IIO_DECLARE_BUFFER_WITH_TS(s16, channels, SCA3300_SCAN_MAX);
480+ IIO_DECLARE_BUFFER_WITH_TS(s16, channels, SCA3300_SCAN_MAX) = { };
481481
482482 iio_for_each_active_channel(indio_dev, bit) {
483483 ret = sca3300_read_reg(data, indio_dev->channels[bit].address, &val);
drivers/iio/adc/Kconfig+1−1
@@ -1300,7 +1300,7 @@ config RN5T618_ADC · 1299 unmodified lines
13001300
13011301 config ROHM_BD79124
13021302 tristate "Rohm BD79124 ADC driver"
1303− depends on I2C
1303+ depends on I2C && GPIOLIB
13041304 select REGMAP_I2C
13051305 select IIO_ADC_HELPER
13061306 help
drivers/iio/adc/ad7124.c+7−7
@@ -849,7 +849,7 @@ enum { · 848 unmodified lines
849849 static int ad7124_syscalib_locked(struct ad7124_state *st, const struct iio_chan_spec *chan)
850850 {
851851 struct device *dev = &st->sd.spi->dev;
852− struct ad7124_channel *ch = &st->channels[chan->channel];
852+ struct ad7124_channel *ch = &st->channels[chan->address];
853853 int ret;
854854
855855 if (ch->syscalib_mode == AD7124_SYSCALIB_ZERO_SCALE) {
@@ -865,8 +865,8 @@ static int ad7124_syscalib_locked(struct ad7124_state *st, const struct iio_chan · 9 unmodified lines
865865 if (ret < 0)
866866 return ret;
867867
868− dev_dbg(dev, "offset for channel %d after zero-scale calibration: 0x%x\n",
869− chan->channel, ch->cfg.calibration_offset);
868+ dev_dbg(dev, "offset for channel %lu after zero-scale calibration: 0x%x\n",
869+ chan->address, ch->cfg.calibration_offset);
870870 } else {
871871 ch->cfg.calibration_gain = st->gain_default;
872872
@@ -880,8 +880,8 @@ static int ad7124_syscalib_locked(struct ad7124_state *st, const struct iio_chan · 7 unmodified lines
880880 if (ret < 0)
881881 return ret;
882882
883− dev_dbg(dev, "gain for channel %d after full-scale calibration: 0x%x\n",
884− chan->channel, ch->cfg.calibration_gain);
883+ dev_dbg(dev, "gain for channel %lu after full-scale calibration: 0x%x\n",
884+ chan->address, ch->cfg.calibration_gain);
885885 }
886886
887887 return 0;
@@ -924,7 +924,7 @@ static int ad7124_set_syscalib_mode(struct iio_dev *indio_dev, · 36 unmodified lines
924924 {
925925 struct ad7124_state *st = iio_priv(indio_dev);
926926
927− st->channels[chan->channel].syscalib_mode = mode;
927+ st->channels[chan->address].syscalib_mode = mode;
928928
929929 return 0;
930930 }
@@ -934,7 +934,7 @@ static int ad7124_get_syscalib_mode(struct iio_dev *indio_dev, · 3 unmodified lines
934934 {
935935 struct ad7124_state *st = iio_priv(indio_dev);
936936
937− return st->channels[chan->channel].syscalib_mode;
937+ return st->channels[chan->address].syscalib_mode;
938938 }
939939
940940 static const struct iio_enum ad7124_syscalib_mode_enum = {
drivers/iio/adc/ad7173.c+75−12
@@ -200,7 +200,7 @@ struct ad7173_channel_config { · 199 unmodified lines
200200 /*
201201 * Following fields are used to compare equality. If you
202202 * make adaptations in it, you most likely also have to adapt
203− * ad7173_find_live_config(), too.
203+ * ad7173_is_setup_equal(), too.
204204 */
205205 struct_group(config_props,
206206 bool bipolar;
@@ -561,12 +561,19 @@ static void ad7173_reset_usage_cnts(struct ad7173_state *st) · 354 unmodified lines
561561 st->config_usage_counter = 0;
562562 }
563563
564−static struct ad7173_channel_config *
565−ad7173_find_live_config(struct ad7173_state *st, struct ad7173_channel_config *cfg)
564+/**
565+ * ad7173_is_setup_equal - Compare two channel setups
566+ * @cfg1: First channel configuration
567+ * @cfg2: Second channel configuration
568+ *
569+ * Compares all configuration options that affect the registers connected to
570+ * SETUP_SEL, namely CONFIGx, FILTERx, GAINx and OFFSETx.
571+ *
572+ * Returns: true if the setups are identical, false otherwise
573+ */
574+static bool ad7173_is_setup_equal(const struct ad7173_channel_config *cfg1,
575+ const struct ad7173_channel_config *cfg2)
566576 {
567− struct ad7173_channel_config *cfg_aux;
568− int i;
569−
570577 /*
571578 * This is just to make sure that the comparison is adapted after
572579 * struct ad7173_channel_config was changed.
@@ -579,14 +586,22 @@ ad7173_find_live_config(struct ad7173_state *st, struct ad7173_channel_config *c · 6 unmodified lines
579586 u8 ref_sel;
580587 }));
581588
589+ return cfg1->bipolar == cfg2->bipolar &&
590+ cfg1->input_buf == cfg2->input_buf &&
591+ cfg1->odr == cfg2->odr &&
592+ cfg1->ref_sel == cfg2->ref_sel;
593+}
594+
595+static struct ad7173_channel_config *
596+ad7173_find_live_config(struct ad7173_state *st, struct ad7173_channel_config *cfg)
597+{
598+ struct ad7173_channel_config *cfg_aux;
599+ int i;
600+
582601 for (i = 0; i < st->num_channels; i++) {
583602 cfg_aux = &st->channels[i].cfg;
584603
585− if (cfg_aux->live &&
586− cfg->bipolar == cfg_aux->bipolar &&
587− cfg->input_buf == cfg_aux->input_buf &&
588− cfg->odr == cfg_aux->odr &&
589− cfg->ref_sel == cfg_aux->ref_sel)
604+ if (cfg_aux->live && ad7173_is_setup_equal(cfg, cfg_aux))
590605 return cfg_aux;
591606 }
592607 return NULL;
@@ -1228,7 +1243,7 @@ static int ad7173_update_scan_mode(struct iio_dev *indio_dev, · 635 unmodified lines
12281243 const unsigned long *scan_mask)
12291244 {
12301245 struct ad7173_state *st = iio_priv(indio_dev);
1231− int i, ret;
1246+ int i, j, k, ret;
12321247
12331248 for (i = 0; i < indio_dev->num_channels; i++) {
12341249 if (test_bit(i, scan_mask))
@@ -1239,6 +1254,54 @@ static int ad7173_update_scan_mode(struct iio_dev *indio_dev, · 4 unmodified lines
12391254 return ret;
12401255 }
12411256
1257+ /*
1258+ * On some chips, there are more channels that setups, so if there were
1259+ * more unique setups requested than the number of available slots,
1260+ * ad7173_set_channel() will have written over some of the slots. We
1261+ * can detect this by making sure each assigned cfg_slot matches the
1262+ * requested configuration. If it doesn't, we know that the slot was
1263+ * overwritten by a different channel.
1264+ */
1265+ for_each_set_bit(i, scan_mask, indio_dev->num_channels) {
1266+ const struct ad7173_channel_config *cfg1, *cfg2;
1267+
1268+ cfg1 = &st->channels[i].cfg;
1269+
1270+ for_each_set_bit(j, scan_mask, indio_dev->num_channels) {
1271+ cfg2 = &st->channels[j].cfg;
1272+
1273+ /*
1274+ * Only compare configs that are assigned to the same
1275+ * SETUP_SEL slot and don't compare channel to itself.
1276+ */
1277+ if (i == j || cfg1->cfg_slot != cfg2->cfg_slot)
1278+ continue;
1279+
1280+ /*
1281+ * If we find two different configs trying to use the
1282+ * same SETUP_SEL slot, then we know that the that we
1283+ * have too many unique configurations requested for
1284+ * the available slots and at least one was overwritten.
1285+ */
1286+ if (!ad7173_is_setup_equal(cfg1, cfg2)) {
1287+ /*
1288+ * At this point, there isn't a way to tell
1289+ * which setups are actually programmed in the
1290+ * ADC anymore, so we could read them back to
1291+ * see, but it is simpler to just turn off all
1292+ * of the live flags so that everything gets
1293+ * reprogramed on the next attempt read a sample.
1294+ */
1295+ for (k = 0; k < st->num_channels; k++)
1296+ st->channels[k].cfg.live = false;
1297+
1298+ dev_err(&st->sd.spi->dev,
1299+ "Too many unique channel configurations requested for scan\n");
1300+ return -EINVAL;
1301+ }
1302+ }
1303+ }
1304+
12421305 return 0;
12431306 }
12441307
drivers/iio/adc/ad7380.c+1−0
@@ -873,6 +873,7 @@ static const struct ad7380_chip_info adaq4381_4_chip_info = { · 872 unmodified lines
873873 .has_hardware_gain = true,
874874 .available_scan_masks = ad7380_4_channel_scan_masks,
875875 .timing_specs = &ad7380_4_timing,
876+ .max_conversion_rate_hz = 4 * MEGA,
876877 };
877878
878879 static const struct spi_offload_config ad7380_offload_config = {
drivers/iio/adc/rzg2l_adc.c+10−23
@@ -89,7 +89,6 @@ struct rzg2l_adc { · 88 unmodified lines
8989 struct completion completion;
9090 struct mutex lock;
9191 u16 last_val[RZG2L_ADC_MAX_CHANNELS];
92− bool was_rpm_active;
9392 };
9493
9594 /**
@@ -428,6 +427,8 @@ static int rzg2l_adc_probe(struct platform_device *pdev) · 332 unmodified lines
428427 if (!indio_dev)
429428 return -ENOMEM;
430429
430+ platform_set_drvdata(pdev, indio_dev);
431+
431432 adc = iio_priv(indio_dev);
432433
433434 adc->hw_params = device_get_match_data(dev);
@@ -460,8 +461,6 @@ static int rzg2l_adc_probe(struct platform_device *pdev) · 26 unmodified lines
460461 if (ret)
461462 return ret;
462463
463− platform_set_drvdata(pdev, indio_dev);
464−
465464 ret = rzg2l_adc_hw_init(dev, adc);
466465 if (ret)
467466 return dev_err_probe(&pdev->dev, ret,
@@ -541,14 +540,9 @@ static int rzg2l_adc_suspend(struct device *dev) · 73 unmodified lines
541540 };
542541 int ret;
543542
544− if (pm_runtime_suspended(dev)) {
545− adc->was_rpm_active = false;
546− } else {
547− ret = pm_runtime_force_suspend(dev);
548− if (ret)
549− return ret;
550− adc->was_rpm_active = true;
551− }
543+ ret = pm_runtime_force_suspend(dev);
544+ if (ret)
545+ return ret;
552546
553547 ret = reset_control_bulk_assert(ARRAY_SIZE(resets), resets);
554548 if (ret)
@@ -557,9 +551,7 @@ static int rzg2l_adc_suspend(struct device *dev) · 2 unmodified lines
557551 return 0;
558552
559553 rpm_restore:
560− if (adc->was_rpm_active)
561− pm_runtime_force_resume(dev);
562−
554+ pm_runtime_force_resume(dev);
563555 return ret;
564556 }
565557
@@ -577,11 +569,9 @@ static int rzg2l_adc_resume(struct device *dev) · 11 unmodified lines
577569 if (ret)
578570 return ret;
579571
580− if (adc->was_rpm_active) {
581− ret = pm_runtime_force_resume(dev);
582− if (ret)
583− goto resets_restore;
584− }
572+ ret = pm_runtime_force_resume(dev);
573+ if (ret)
574+ goto resets_restore;
585575
586576 ret = rzg2l_adc_hw_init(dev, adc);
587577 if (ret)
@@ -590,10 +580,7 @@ static int rzg2l_adc_resume(struct device *dev) · 2 unmodified lines
590580 return 0;
591581
592582 rpm_restore:
593− if (adc->was_rpm_active) {
594− pm_runtime_mark_last_busy(dev);
595− pm_runtime_put_autosuspend(dev);
596− }
583+ pm_runtime_force_suspend(dev);
597584 resets_restore:
598585 reset_control_bulk_assert(ARRAY_SIZE(resets), resets);
599586 return ret;
drivers/iio/imu/inv_icm42600/inv_icm42600_temp.c+5−1
@@ -32,8 +32,12 @@ static int inv_icm42600_temp_read(struct inv_icm42600_state *st, s16 *temp) · 31 unmodified lines
3232 goto exit;
3333
3434 *temp = (s16)be16_to_cpup(raw);
35+ /*
36+ * Temperature data is invalid if both accel and gyro are off.
37+ * Return -EBUSY in this case.
38+ */
3539 if (*temp == INV_ICM42600_DATA_INVALID)
36− ret = -EINVAL;
40+ ret = -EBUSY;
3741
3842 exit:
3943 mutex_unlock(&st->lock);
drivers/iio/light/as73211.c+1−1
@@ -639,7 +639,7 @@ static irqreturn_t as73211_trigger_handler(int irq __always_unused, void *p) · 638 unmodified lines
639639 struct {
640640 __le16 chan[4];
641641 aligned_s64 ts;
642− } scan;
642+ } scan = { };
643643 int data_result, ret;
644644
645645 mutex_lock(&data->mutex);
drivers/iio/pressure/bmp280-core.c+5−4
@@ -3213,11 +3213,12 @@ int bmp280_common_probe(struct device *dev, · 3212 unmodified lines
32133213
32143214 /* Bring chip out of reset if there is an assigned GPIO line */
32153215 gpiod = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
3216+ if (IS_ERR(gpiod))
3217+ return dev_err_probe(dev, PTR_ERR(gpiod), "failed to get reset GPIO\n");
3218+
32163219 /* Deassert the signal */
3217− if (gpiod) {
3218− dev_info(dev, "release reset\n");
3219− gpiod_set_value(gpiod, 0);
3220− }
3220+ dev_info(dev, "release reset\n");
3221+ gpiod_set_value(gpiod, 0);
32213222
32223223 data->regmap = regmap;
32233224
drivers/iio/proximity/isl29501.c+11−5
@@ -938,12 +938,18 @@ static irqreturn_t isl29501_trigger_handler(int irq, void *p) · 937 unmodified lines
938938 struct iio_dev *indio_dev = pf->indio_dev;
939939 struct isl29501_private *isl29501 = iio_priv(indio_dev);
940940 const unsigned long *active_mask = indio_dev->active_scan_mask;
941− u32 buffer[4] __aligned(8) = {}; /* 1x16-bit + naturally aligned ts */
942−
943− if (test_bit(ISL29501_DISTANCE_SCAN_INDEX, active_mask))
944− isl29501_register_read(isl29501, REG_DISTANCE, buffer);
941+ u32 value;
942+ struct {
943+ u16 data;
944+ aligned_s64 ts;
945+ } scan = { };
946+
947+ if (test_bit(ISL29501_DISTANCE_SCAN_INDEX, active_mask)) {
948+ isl29501_register_read(isl29501, REG_DISTANCE, &value);
949+ scan.data = value;
950+ }
945951
946− iio_push_to_buffers_with_timestamp(indio_dev, buffer, pf->timestamp);
952+ iio_push_to_buffers_with_timestamp(indio_dev, &scan, pf->timestamp);
947953 iio_trigger_notify_done(indio_dev->trig);
948954
949955 return IRQ_HANDLED;
drivers/iio/temperature/maxim_thermocouple.c+16−10
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111 #include <linux/module.h>
1212 #include <linux/err.h>
1313 #include <linux/spi/spi.h>
14+#include <linux/types.h>
1415 #include <linux/iio/iio.h>
1516 #include <linux/iio/sysfs.h>
1617 #include <linux/iio/trigger.h>
@@ -121,8 +122,15 @@ struct maxim_thermocouple_data { · 104 unmodified lines
121122 struct spi_device *spi;
122123 const struct maxim_thermocouple_chip *chip;
123124 char tc_type;
124−
125− u8 buffer[16] __aligned(IIO_DMA_MINALIGN);
125+ /* Buffer for reading up to 2 hardware channels. */
126+ struct {
127+ union {
128+ __be16 raw16;
129+ __be32 raw32;
130+ __be16 raw[2];
131+ };
132+ aligned_s64 timestamp;
133+ } buffer __aligned(IIO_DMA_MINALIGN);
126134 };
127135
128136 static int maxim_thermocouple_read(struct maxim_thermocouple_data *data,
@@ -130,18 +138,16 @@ static int maxim_thermocouple_read(struct maxim_thermocouple_data *data, · 1 unmodified line
130138 {
131139 unsigned int storage_bytes = data->chip->read_size;
132140 unsigned int shift = chan->scan_type.shift + (chan->address * 8);
133− __be16 buf16;
134− __be32 buf32;
135141 int ret;
136142
137143 switch (storage_bytes) {
138144 case 2:
139− ret = spi_read(data->spi, (void *)&buf16, storage_bytes);
140− *val = be16_to_cpu(buf16);
145+ ret = spi_read(data->spi, &data->buffer.raw16, storage_bytes);
146+ *val = be16_to_cpu(data->buffer.raw16);
141147 break;
142148 case 4:
143− ret = spi_read(data->spi, (void *)&buf32, storage_bytes);
144− *val = be32_to_cpu(buf32);
149+ ret = spi_read(data->spi, &data->buffer.raw32, storage_bytes);
150+ *val = be32_to_cpu(data->buffer.raw32);
145151 break;
146152 default:
147153 ret = -EINVAL;
@@ -166,9 +172,9 @@ static irqreturn_t maxim_thermocouple_trigger_handler(int irq, void *private) · 18 unmodified lines
166172 struct maxim_thermocouple_data *data = iio_priv(indio_dev);
167173 int ret;
168174
169− ret = spi_read(data->spi, data->buffer, data->chip->read_size);
175+ ret = spi_read(data->spi, data->buffer.raw, data->chip->read_size);
170176 if (!ret) {
171− iio_push_to_buffers_with_ts(indio_dev, data->buffer,
177+ iio_push_to_buffers_with_ts(indio_dev, &data->buffer,
172178 sizeof(data->buffer),
173179 iio_get_time_ns(indio_dev));
174180 }
drivers/infiniband/core/umem_odp.c+2−2
@@ -115,7 +115,7 @@ static int ib_init_umem_odp(struct ib_umem_odp *umem_odp, · 114 unmodified lines
115115
116116 out_free_map:
117117 if (ib_uses_virt_dma(dev))
118− kfree(map->pfn_list);
118+ kvfree(map->pfn_list);
119119 else
120120 hmm_dma_map_free(dev->dma_device, map);
121121 return ret;
@@ -287,7 +287,7 @@ static void ib_umem_odp_free(struct ib_umem_odp *umem_odp) · 165 unmodified lines
287287 mutex_unlock(&umem_odp->umem_mutex);
288288 mmu_interval_notifier_remove(&umem_odp->notifier);
289289 if (ib_uses_virt_dma(dev))
290− kfree(umem_odp->map.pfn_list);
290+ kvfree(umem_odp->map.pfn_list);
291291 else
292292 hmm_dma_map_free(dev->dma_device, &umem_odp->map);
293293 }
drivers/infiniband/hw/bnxt_re/ib_verbs.c+2−6
@@ -1921,7 +1921,6 @@ int bnxt_re_modify_srq(struct ib_srq *ib_srq, struct ib_srq_attr *srq_attr, · 1920 unmodified lines
19211921 struct bnxt_re_srq *srq = container_of(ib_srq, struct bnxt_re_srq,
19221922 ib_srq);
19231923 struct bnxt_re_dev *rdev = srq->rdev;
1924− int rc;
19251924
19261925 switch (srq_attr_mask) {
19271926 case IB_SRQ_MAX_WR:
@@ -1933,11 +1932,8 @@ int bnxt_re_modify_srq(struct ib_srq *ib_srq, struct ib_srq_attr *srq_attr, · 5 unmodified lines
19331932 return -EINVAL;
19341933
19351934 srq->qplib_srq.threshold = srq_attr->srq_limit;
1936− rc = bnxt_qplib_modify_srq(&rdev->qplib_res, &srq->qplib_srq);
1937− if (rc) {
1938− ibdev_err(&rdev->ibdev, "Modify HW SRQ failed!");
1939− return rc;
1940− }
1935+ bnxt_qplib_srq_arm_db(&srq->qplib_srq.dbinfo, srq->qplib_srq.threshold);
1936+
19411937 /* On success, update the shadow */
19421938 srq->srq_limit = srq_attr->srq_limit;
19431939 /* No need to Build and send response back to udata */
drivers/infiniband/hw/bnxt_re/main.c+23−0
@@ -2017,6 +2017,28 @@ static void bnxt_re_free_nqr_mem(struct bnxt_re_dev *rdev) · 2016 unmodified lines
20172017 rdev->nqr = NULL;
20182018 }
20192019
2020+/* When DEL_GID fails, driver is not freeing GID ctx memory.
2021+ * To avoid the memory leak, free the memory during unload
2022+ */
2023+static void bnxt_re_free_gid_ctx(struct bnxt_re_dev *rdev)
2024+{
2025+ struct bnxt_qplib_sgid_tbl *sgid_tbl = &rdev->qplib_res.sgid_tbl;
2026+ struct bnxt_re_gid_ctx *ctx, **ctx_tbl;
2027+ int i;
2028+
2029+ if (!sgid_tbl->active)
2030+ return;
2031+
2032+ ctx_tbl = sgid_tbl->ctx;
2033+ for (i = 0; i < sgid_tbl->max; i++) {
2034+ if (sgid_tbl->hw_id[i] == 0xFFFF)
2035+ continue;
2036+
2037+ ctx = ctx_tbl[i];
2038+ kfree(ctx);
2039+ }
2040+}
2041+
20202042 static void bnxt_re_dev_uninit(struct bnxt_re_dev *rdev, u8 op_type)
20212043 {
20222044 u8 type;
@@ -2030,6 +2052,7 @@ static void bnxt_re_dev_uninit(struct bnxt_re_dev *rdev, u8 op_type) · 7 unmodified lines
20302052 if (test_and_clear_bit(BNXT_RE_FLAG_QOS_WORK_REG, &rdev->flags))
20312053 cancel_delayed_work_sync(&rdev->worker);
20322054
2055+ bnxt_re_free_gid_ctx(rdev);
20332056 if (test_and_clear_bit(BNXT_RE_FLAG_RESOURCES_INITIALIZED,
20342057 &rdev->flags))
20352058 bnxt_re_cleanup_res(rdev);
drivers/infiniband/hw/bnxt_re/qplib_fp.c+1−29
@@ -705,9 +705,7 @@ int bnxt_qplib_create_srq(struct bnxt_qplib_res *res, · 704 unmodified lines
705705 srq->dbinfo.db = srq->dpi->dbr;
706706 srq->dbinfo.max_slot = 1;
707707 srq->dbinfo.priv_db = res->dpi_tbl.priv_db;
708− if (srq->threshold)
709− bnxt_qplib_armen_db(&srq->dbinfo, DBC_DBC_TYPE_SRQ_ARMENA);
710− srq->arm_req = false;
708+ bnxt_qplib_armen_db(&srq->dbinfo, DBC_DBC_TYPE_SRQ_ARMENA);
711709
712710 return 0;
713711 fail:
@@ -717,24 +715,6 @@ fail: · 3 unmodified lines
717715 return rc;
718716 }
719717
720−int bnxt_qplib_modify_srq(struct bnxt_qplib_res *res,
721− struct bnxt_qplib_srq *srq)
722−{
723− struct bnxt_qplib_hwq *srq_hwq = &srq->hwq;
724− u32 count;
725−
726− count = __bnxt_qplib_get_avail(srq_hwq);
727− if (count > srq->threshold) {
728− srq->arm_req = false;
729− bnxt_qplib_srq_arm_db(&srq->dbinfo, srq->threshold);
730− } else {
731− /* Deferred arming */
732− srq->arm_req = true;
733− }
734−
735− return 0;
736−}
737−
738718 int bnxt_qplib_query_srq(struct bnxt_qplib_res *res,
739719 struct bnxt_qplib_srq *srq)
740720 {
@@ -776,7 +756,6 @@ int bnxt_qplib_post_srq_recv(struct bnxt_qplib_srq *srq, · 35 unmodified lines
776756 struct bnxt_qplib_hwq *srq_hwq = &srq->hwq;
777757 struct rq_wqe *srqe;
778758 struct sq_sge *hw_sge;
779− u32 count = 0;
780759 int i, next;
781760
782761 spin_lock(&srq_hwq->lock);
@@ -808,15 +787,8 @@ int bnxt_qplib_post_srq_recv(struct bnxt_qplib_srq *srq, · 25 unmodified lines
808787
809788 bnxt_qplib_hwq_incr_prod(&srq->dbinfo, srq_hwq, srq->dbinfo.max_slot);
810789
811− spin_lock(&srq_hwq->lock);
812− count = __bnxt_qplib_get_avail(srq_hwq);
813− spin_unlock(&srq_hwq->lock);
814790 /* Ring DB */
815791 bnxt_qplib_ring_prod_db(&srq->dbinfo, DBC_DBC_TYPE_SRQ);
816− if (srq->arm_req == true && count > srq->threshold) {
817− srq->arm_req = false;
818− bnxt_qplib_srq_arm_db(&srq->dbinfo, srq->threshold);
819− }
820792
821793 return 0;
822794 }
drivers/infiniband/hw/bnxt_re/qplib_fp.h+0−2
@@ -546,8 +546,6 @@ int bnxt_qplib_enable_nq(struct pci_dev *pdev, struct bnxt_qplib_nq *nq, · 545 unmodified lines
546546 srqn_handler_t srq_handler);
547547 int bnxt_qplib_create_srq(struct bnxt_qplib_res *res,
548548 struct bnxt_qplib_srq *srq);
549−int bnxt_qplib_modify_srq(struct bnxt_qplib_res *res,
550− struct bnxt_qplib_srq *srq);
551549 int bnxt_qplib_query_srq(struct bnxt_qplib_res *res,
552550 struct bnxt_qplib_srq *srq);
553551 void bnxt_qplib_destroy_srq(struct bnxt_qplib_res *res,
drivers/infiniband/hw/bnxt_re/qplib_res.c+2−0
@@ -121,6 +121,7 @@ static int __alloc_pbl(struct bnxt_qplib_res *res, · 120 unmodified lines
121121 pbl->pg_arr = vmalloc_array(pages, sizeof(void *));
122122 if (!pbl->pg_arr)
123123 return -ENOMEM;
124+ memset(pbl->pg_arr, 0, pages * sizeof(void *));
124125
125126 pbl->pg_map_arr = vmalloc_array(pages, sizeof(dma_addr_t));
126127 if (!pbl->pg_map_arr) {
@@ -128,6 +129,7 @@ static int __alloc_pbl(struct bnxt_qplib_res *res, · 1 unmodified line
128129 pbl->pg_arr = NULL;
129130 return -ENOMEM;
130131 }
132+ memset(pbl->pg_map_arr, 0, pages * sizeof(dma_addr_t));
131133 pbl->pg_count = 0;
132134 pbl->pg_size = sginfo->pgsize;
133135
drivers/infiniband/hw/erdma/erdma_verbs.c+5−1
@@ -994,6 +994,8 @@ int erdma_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *attrs, · 993 unmodified lines
994994 old_entry = xa_store(&dev->qp_xa, 1, qp, GFP_KERNEL);
995995 if (xa_is_err(old_entry))
996996 ret = xa_err(old_entry);
997+ else
998+ qp->ibqp.qp_num = 1;
997999 } else {
9981000 ret = xa_alloc_cyclic(&dev->qp_xa, &qp->ibqp.qp_num, qp,
9991001 XA_LIMIT(1, dev->attrs.max_qp - 1),
@@ -1031,7 +1033,9 @@ int erdma_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *attrs, · 31 unmodified lines
10311033 if (ret)
10321034 goto err_out_cmd;
10331035 } else {
1034− init_kernel_qp(dev, qp, attrs);
1036+ ret = init_kernel_qp(dev, qp, attrs);
1037+ if (ret)
1038+ goto err_out_xa;
10351039 }
10361040
10371041 qp->attrs.max_send_sge = attrs->cap.max_send_sge;
drivers/infiniband/hw/hns/hns_roce_hw_v2.c+3−3
@@ -3043,7 +3043,7 @@ static void hns_roce_v2_exit(struct hns_roce_dev *hr_dev) · 3042 unmodified lines
30433043 if (!hr_dev->is_vf)
30443044 hns_roce_free_link_table(hr_dev);
30453045
3046− if (hr_dev->pci_dev->revision == PCI_REVISION_ID_HIP09)
3046+ if (hr_dev->pci_dev->revision >= PCI_REVISION_ID_HIP09)
30473047 free_dip_entry(hr_dev);
30483048 }
30493049
@@ -5476,7 +5476,7 @@ out: · 2426 unmodified lines
54765476 return ret;
54775477 }
54785478
5479−static int hns_roce_v2_query_sccc(struct hns_roce_dev *hr_dev, u32 qpn,
5479+static int hns_roce_v2_query_sccc(struct hns_roce_dev *hr_dev, u32 sccn,
54805480 void *buffer)
54815481 {
54825482 struct hns_roce_v2_scc_context *context;
@@ -5488,7 +5488,7 @@ static int hns_roce_v2_query_sccc(struct hns_roce_dev *hr_dev, u32 qpn, · 5 unmodified lines
54885488 return PTR_ERR(mailbox);
54895489
54905490 ret = hns_roce_cmd_mbox(hr_dev, 0, mailbox->dma, HNS_ROCE_CMD_QUERY_SCCC,
5491− qpn);
5491+ sccn);
54925492 if (ret)
54935493 goto out;
54945494
drivers/infiniband/hw/hns/hns_roce_restrack.c+8−1
@@ -100,6 +100,7 @@ int hns_roce_fill_res_qp_entry_raw(struct sk_buff *msg, struct ib_qp *ib_qp) · 99 unmodified lines
100100 struct hns_roce_v2_qp_context qpc;
101101 struct hns_roce_v2_scc_context sccc;
102102 } context = {};
103+ u32 sccn = hr_qp->qpn;
103104 int ret;
104105
105106 if (!hr_dev->hw->query_qpc)
@@ -116,7 +117,13 @@ int hns_roce_fill_res_qp_entry_raw(struct sk_buff *msg, struct ib_qp *ib_qp) · 10 unmodified lines
116117 !hr_dev->hw->query_sccc)
117118 goto out;
118119
119− ret = hr_dev->hw->query_sccc(hr_dev, hr_qp->qpn, &context.sccc);
120+ if (hr_qp->cong_type == CONG_TYPE_DIP) {
121+ if (!hr_qp->dip)
122+ goto out;
123+ sccn = hr_qp->dip->dip_idx;
124+ }
125+
126+ ret = hr_dev->hw->query_sccc(hr_dev, sccn, &context.sccc);
120127 if (ret)
121128 ibdev_warn_ratelimited(&hr_dev->ib_dev,
122129 "failed to query SCCC, ret = %d.\n",
drivers/infiniband/sw/rxe/rxe_net.c+8−21
@@ -345,33 +345,15 @@ int rxe_prepare(struct rxe_av *av, struct rxe_pkt_info *pkt, · 344 unmodified lines
345345
346346 static void rxe_skb_tx_dtor(struct sk_buff *skb)
347347 {
348− struct net_device *ndev = skb->dev;
349− struct rxe_dev *rxe;
350− unsigned int qp_index;
351− struct rxe_qp *qp;
348+ struct rxe_qp *qp = skb->sk->sk_user_data;
352349 int skb_out;
353350
354− rxe = rxe_get_dev_from_net(ndev);
355− if (!rxe && is_vlan_dev(ndev))
356− rxe = rxe_get_dev_from_net(vlan_dev_real_dev(ndev));
357− if (WARN_ON(!rxe))
358− return;
359−
360− qp_index = (int)(uintptr_t)skb->sk->sk_user_data;
361− if (!qp_index)
362− return;
363−
364− qp = rxe_pool_get_index(&rxe->qp_pool, qp_index);
365− if (!qp)
366− goto put_dev;
367−
368351 skb_out = atomic_dec_return(&qp->skb_out);
369− if (qp->need_req_skb && skb_out < RXE_INFLIGHT_SKBS_PER_QP_LOW)
352+ if (unlikely(qp->need_req_skb &&
353+ skb_out < RXE_INFLIGHT_SKBS_PER_QP_LOW))
370354 rxe_sched_task(&qp->send_task);
371355
372356 rxe_put(qp);
373−put_dev:
374− ib_device_put(&rxe->ib_dev);
375357 sock_put(skb->sk);
376358 }
377359
@@ -383,6 +365,7 @@ static int rxe_send(struct sk_buff *skb, struct rxe_pkt_info *pkt) · 5 unmodified lines
383365 sock_hold(sk);
384366 skb->sk = sk;
385367 skb->destructor = rxe_skb_tx_dtor;
368+ rxe_get(pkt->qp);
386369 atomic_inc(&pkt->qp->skb_out);
387370
388371 if (skb->protocol == htons(ETH_P_IP))
@@ -405,6 +388,7 @@ static int rxe_loopback(struct sk_buff *skb, struct rxe_pkt_info *pkt) · 16 unmodified lines
405388 sock_hold(sk);
406389 skb->sk = sk;
407390 skb->destructor = rxe_skb_tx_dtor;
391+ rxe_get(pkt->qp);
408392 atomic_inc(&pkt->qp->skb_out);
409393
410394 if (skb->protocol == htons(ETH_P_IP))
@@ -497,6 +481,9 @@ struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av, · 86 unmodified lines
497481 goto out;
498482 }
499483
484+ /* Add time stamp to skb. */
485+ skb->tstamp = ktime_get();
486+
500487 skb_reserve(skb, hdr_len + LL_RESERVED_SPACE(ndev));
501488
502489 /* FIXME: hold reference to this netdev until life of this skb. */
drivers/infiniband/sw/rxe/rxe_qp.c+1−1
@@ -244,7 +244,7 @@ static int rxe_qp_init_req(struct rxe_dev *rxe, struct rxe_qp *qp, · 243 unmodified lines
244244 err = sock_create_kern(&init_net, AF_INET, SOCK_DGRAM, 0, &qp->sk);
245245 if (err < 0)
246246 return err;
247− qp->sk->sk->sk_user_data = (void *)(uintptr_t)qp->elem.index;
247+ qp->sk->sk->sk_user_data = qp;
248248
249249 /* pick a source UDP port number for this QP based on
250250 * the source QPN. this spreads traffic for different QPs
drivers/iommu/amd/init.c+2−2
@@ -3638,7 +3638,7 @@ static int __init parse_ivrs_acpihid(char *str) · 3637 unmodified lines
36383638 {
36393639 u32 seg = 0, bus, dev, fn;
36403640 char *hid, *uid, *p, *addr;
3641− char acpiid[ACPIID_LEN] = {0};
3641+ char acpiid[ACPIID_LEN + 1] = { }; /* size with NULL terminator */
36423642 int i;
36433643
36443644 addr = strchr(str, '@');
@@ -3664,7 +3664,7 @@ static int __init parse_ivrs_acpihid(char *str) · 19 unmodified lines
36643664 /* We have the '@', make it the terminator to get just the acpiid */
36653665 *addr++ = 0;
36663666
3667− if (strlen(str) > ACPIID_LEN + 1)
3667+ if (strlen(str) > ACPIID_LEN)
36683668 goto not_found;
36693669
36703670 if (sscanf(str, "=%s", acpiid) != 1)
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c+1−1
@@ -2997,9 +2997,9 @@ void arm_smmu_attach_commit(struct arm_smmu_attach_state *state) · 2996 unmodified lines
29972997 /* ATS is being switched off, invalidate the entire ATC */
29982998 arm_smmu_atc_inv_master(master, IOMMU_NO_PASID);
29992999 }
3000− master->ats_enabled = state->ats_enabled;
30013000
30023001 arm_smmu_remove_master_domain(master, state->old_domain, state->ssid);
3002+ master->ats_enabled = state->ats_enabled;
30033003 }
30043004
30053005 static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c+5−3
@@ -301,9 +301,11 @@ static void tegra241_vintf_user_handle_error(struct tegra241_vintf *vintf) · 300 unmodified lines
301301 struct iommu_vevent_tegra241_cmdqv vevent_data;
302302 int i;
303303
304− for (i = 0; i < LVCMDQ_ERR_MAP_NUM_64; i++)
305− vevent_data.lvcmdq_err_map[i] =
306− readq_relaxed(REG_VINTF(vintf, LVCMDQ_ERR_MAP_64(i)));
304+ for (i = 0; i < LVCMDQ_ERR_MAP_NUM_64; i++) {
305+ u64 err = readq_relaxed(REG_VINTF(vintf, LVCMDQ_ERR_MAP_64(i)));
306+
307+ vevent_data.lvcmdq_err_map[i] = cpu_to_le64(err);
308+ }
307309
308310 iommufd_viommu_report_event(viommu, IOMMU_VEVENTQ_TYPE_TEGRA241_CMDQV,
309311 &vevent_data, sizeof(vevent_data));
drivers/iommu/iommufd/viommu.c+2−2
@@ -339,7 +339,7 @@ iommufd_hw_queue_alloc_phys(struct iommu_hw_queue_alloc *cmd, · 338 unmodified lines
339339 }
340340
341341 *base_pa = (page_to_pfn(pages[0]) << PAGE_SHIFT) + offset;
342− kfree(pages);
342+ kvfree(pages);
343343 return access;
344344
345345 out_unpin:
@@ -349,7 +349,7 @@ out_detach: · 3 unmodified lines
349349 out_destroy:
350350 iommufd_access_destroy_internal(viommu->ictx, access);
351351 out_free:
352− kfree(pages);
352+ kvfree(pages);
353353 return ERR_PTR(rc);
354354 }
355355
drivers/iommu/riscv/iommu.c+1−1
@@ -1283,7 +1283,7 @@ static phys_addr_t riscv_iommu_iova_to_phys(struct iommu_domain *iommu_domain, · 1282 unmodified lines
12831283 unsigned long *ptr;
12841284
12851285 ptr = riscv_iommu_pte_fetch(domain, iova, &pte_size);
1286− if (_io_pte_none(*ptr) || !_io_pte_present(*ptr))
1286+ if (!ptr)
12871287 return 0;
12881288
12891289 return pfn_to_phys(__page_val_to_pfn(*ptr)) | (iova & (pte_size - 1));
drivers/iommu/virtio-iommu.c+9−6
@@ -998,8 +998,7 @@ static void viommu_get_resv_regions(struct device *dev, struct list_head *head) · 997 unmodified lines
998998 iommu_dma_get_resv_regions(dev, head);
999999 }
10001000
1001−static const struct iommu_ops viommu_ops;
1002−static struct virtio_driver virtio_iommu_drv;
1001+static const struct bus_type *virtio_bus_type;
10031002
10041003 static int viommu_match_node(struct device *dev, const void *data)
10051004 {
@@ -1008,8 +1007,9 @@ static int viommu_match_node(struct device *dev, const void *data) · 2 unmodified lines
10081007
10091008 static struct viommu_dev *viommu_get_by_fwnode(struct fwnode_handle *fwnode)
10101009 {
1011− struct device *dev = driver_find_device(&virtio_iommu_drv.driver, NULL,
1012− fwnode, viommu_match_node);
1010+ struct device *dev = bus_find_device(virtio_bus_type, NULL, fwnode,
1011+ viommu_match_node);
1012+
10131013 put_device(dev);
10141014
10151015 return dev ? dev_to_virtio(dev)->priv : NULL;
@@ -1160,6 +1160,9 @@ static int viommu_probe(struct virtio_device *vdev) · 144 unmodified lines
11601160 if (!viommu)
11611161 return -ENOMEM;
11621162
1163+ /* Borrow this for easy lookups later */
1164+ virtio_bus_type = dev->bus;
1165+
11631166 spin_lock_init(&viommu->request_lock);
11641167 ida_init(&viommu->domain_ids);
11651168 viommu->dev = dev;
@@ -1229,10 +1232,10 @@ static int viommu_probe(struct virtio_device *vdev) · 63 unmodified lines
12291232 if (ret)
12301233 goto err_free_vqs;
12311234
1232− iommu_device_register(&viommu->iommu, &viommu_ops, parent_dev);
1233−
12341235 vdev->priv = viommu;
12351236
1237+ iommu_device_register(&viommu->iommu, &viommu_ops, parent_dev);
1238+
12361239 dev_info(dev, "input address: %u bits\n",
12371240 order_base_2(viommu->geometry.aperture_end));
12381241 dev_info(dev, "page mask: %#llx\n", viommu->pgsize_bitmap);
drivers/isdn/hardware/mISDN/hfcpci.c+5−7
@@ -39,12 +39,13 @@ · 38 unmodified lines
3939
4040 #include "hfc_pci.h"
4141
42+static void hfcpci_softirq(struct timer_list *unused);
4243 static const char *hfcpci_revision = "2.0";
4344
4445 static int HFC_cnt;
4546 static uint debug;
4647 static uint poll, tics;
47−static struct timer_list hfc_tl;
48+static DEFINE_TIMER(hfc_tl, hfcpci_softirq);
4849 static unsigned long hfc_jiffies;
4950
5051 MODULE_AUTHOR("Karsten Keil");
@@ -2305,8 +2306,7 @@ hfcpci_softirq(struct timer_list *unused) · 2254 unmodified lines
23052306 hfc_jiffies = jiffies + 1;
23062307 else
23072308 hfc_jiffies += tics;
2308− hfc_tl.expires = hfc_jiffies;
2309− add_timer(&hfc_tl);
2309+ mod_timer(&hfc_tl, hfc_jiffies);
23102310 }
23112311
23122312 static int __init
@@ -2332,10 +2332,8 @@ HFC_init(void) · 19 unmodified lines
23322332 if (poll != HFCPCI_BTRANS_THRESHOLD) {
23332333 printk(KERN_INFO "%s: Using alternative poll value of %d\n",
23342334 __func__, poll);
2335− timer_setup(&hfc_tl, hfcpci_softirq, 0);
2336− hfc_tl.expires = jiffies + tics;
2337− hfc_jiffies = hfc_tl.expires;
2338− add_timer(&hfc_tl);
2335+ hfc_jiffies = jiffies + tics;
2336+ mod_timer(&hfc_tl, hfc_jiffies);
23392337 } else
23402338 tics = 0; /* indicate the use of controller's timer */
23412339
drivers/md/md.c+92−30
@@ -339,6 +339,7 @@ static int start_readonly; · 338 unmodified lines
339339 * so all the races disappear.
340340 */
341341 static bool create_on_open = true;
342+static bool legacy_async_del_gendisk = true;
342343
343344 /*
344345 * We have a system wide 'event count' that is incremented
@@ -877,15 +878,18 @@ void mddev_unlock(struct mddev *mddev) · 532 unmodified lines
877878 export_rdev(rdev, mddev);
878879 }
879880
880− /* Call del_gendisk after release reconfig_mutex to avoid
881− * deadlock (e.g. call del_gendisk under the lock and an
882− * access to sysfs files waits the lock)
883− * And MD_DELETED is only used for md raid which is set in
884− * do_md_stop. dm raid only uses md_stop to stop. So dm raid
885− * doesn't need to check MD_DELETED when getting reconfig lock
886− */
887− if (test_bit(MD_DELETED, &mddev->flags))
888− del_gendisk(mddev->gendisk);
881+ if (!legacy_async_del_gendisk) {
882+ /*
883+ * Call del_gendisk after release reconfig_mutex to avoid
884+ * deadlock (e.g. call del_gendisk under the lock and an
885+ * access to sysfs files waits the lock)
886+ * And MD_DELETED is only used for md raid which is set in
887+ * do_md_stop. dm raid only uses md_stop to stop. So dm raid
888+ * doesn't need to check MD_DELETED when getting reconfig lock
889+ */
890+ if (test_bit(MD_DELETED, &mddev->flags))
891+ del_gendisk(mddev->gendisk);
892+ }
889893 }
890894 EXPORT_SYMBOL_GPL(mddev_unlock);
891895
@@ -1419,7 +1423,7 @@ static int super_90_validate(struct mddev *mddev, struct md_rdev *freshest, stru · 527 unmodified lines
14191423 else {
14201424 if (sb->events_hi == sb->cp_events_hi &&
14211425 sb->events_lo == sb->cp_events_lo) {
1422− mddev->resync_offset = sb->resync_offset;
1426+ mddev->resync_offset = sb->recovery_cp;
14231427 } else
14241428 mddev->resync_offset = 0;
14251429 }
@@ -1547,13 +1551,13 @@ static void super_90_sync(struct mddev *mddev, struct md_rdev *rdev) · 121 unmodified lines
15471551 mddev->minor_version = sb->minor_version;
15481552 if (mddev->in_sync)
15491553 {
1550− sb->resync_offset = mddev->resync_offset;
1554+ sb->recovery_cp = mddev->resync_offset;
15511555 sb->cp_events_hi = (mddev->events>>32);
15521556 sb->cp_events_lo = (u32)mddev->events;
15531557 if (mddev->resync_offset == MaxSector)
15541558 sb->state = (1<< MD_SB_CLEAN);
15551559 } else
1556− sb->resync_offset = 0;
1560+ sb->recovery_cp = 0;
15571561
15581562 sb->layout = mddev->layout;
15591563 sb->chunk_size = mddev->chunk_sectors << 9;
@@ -4835,9 +4839,42 @@ out_unlock: · 3275 unmodified lines
48354839 static struct md_sysfs_entry md_metadata =
48364840 __ATTR_PREALLOC(metadata_version, S_IRUGO|S_IWUSR, metadata_show, metadata_store);
48374841
4842+static bool rdev_needs_recovery(struct md_rdev *rdev, sector_t sectors)
4843+{
4844+ return rdev->raid_disk >= 0 &&
4845+ !test_bit(Journal, &rdev->flags) &&
4846+ !test_bit(Faulty, &rdev->flags) &&
4847+ !test_bit(In_sync, &rdev->flags) &&
4848+ rdev->recovery_offset < sectors;
4849+}
4850+
4851+static enum sync_action md_get_active_sync_action(struct mddev *mddev)
4852+{
4853+ struct md_rdev *rdev;
4854+ bool is_recover = false;
4855+
4856+ if (mddev->resync_offset < MaxSector)
4857+ return ACTION_RESYNC;
4858+
4859+ if (mddev->reshape_position != MaxSector)
4860+ return ACTION_RESHAPE;
4861+
4862+ rcu_read_lock();
4863+ rdev_for_each_rcu(rdev, mddev) {
4864+ if (rdev_needs_recovery(rdev, MaxSector)) {
4865+ is_recover = true;
4866+ break;
4867+ }
4868+ }
4869+ rcu_read_unlock();
4870+
4871+ return is_recover ? ACTION_RECOVER : ACTION_IDLE;
4872+}
4873+
48384874 enum sync_action md_sync_action(struct mddev *mddev)
48394875 {
48404876 unsigned long recovery = mddev->recovery;
4877+ enum sync_action active_action;
48414878
48424879 /*
48434880 * frozen has the highest priority, means running sync_thread will be
@@ -4861,8 +4898,17 @@ enum sync_action md_sync_action(struct mddev *mddev) · 17 unmodified lines
48614898 !test_bit(MD_RECOVERY_NEEDED, &recovery))
48624899 return ACTION_IDLE;
48634900
4864− if (test_bit(MD_RECOVERY_RESHAPE, &recovery) ||
4865− mddev->reshape_position != MaxSector)
4901+ /*
4902+ * Check if any sync operation (resync/recover/reshape) is
4903+ * currently active. This ensures that only one sync operation
4904+ * can run at a time. Returns the type of active operation, or
4905+ * ACTION_IDLE if none are active.
4906+ */
4907+ active_action = md_get_active_sync_action(mddev);
4908+ if (active_action != ACTION_IDLE)
4909+ return active_action;
4910+
4911+ if (test_bit(MD_RECOVERY_RESHAPE, &recovery))
48664912 return ACTION_RESHAPE;
48674913
48684914 if (test_bit(MD_RECOVERY_RECOVER, &recovery))
@@ -5818,6 +5864,13 @@ static void md_kobj_release(struct kobject *ko) · 949 unmodified lines
58185864 {
58195865 struct mddev *mddev = container_of(ko, struct mddev, kobj);
58205866
5867+ if (legacy_async_del_gendisk) {
5868+ if (mddev->sysfs_state)
5869+ sysfs_put(mddev->sysfs_state);
5870+ if (mddev->sysfs_level)
5871+ sysfs_put(mddev->sysfs_level);
5872+ del_gendisk(mddev->gendisk);
5873+ }
58215874 put_disk(mddev->gendisk);
58225875 }
58235876
@@ -6021,6 +6074,9 @@ static int md_alloc_and_put(dev_t dev, char *name) · 197 unmodified lines
60216074 {
60226075 struct mddev *mddev = md_alloc(dev, name);
60236076
6077+ if (legacy_async_del_gendisk)
6078+ pr_warn("md: async del_gendisk mode will be removed in future, please upgrade to mdadm-4.5+\n");
6079+
60246080 if (IS_ERR(mddev))
60256081 return PTR_ERR(mddev);
60266082 mddev_put(mddev);
@@ -6431,10 +6487,22 @@ static void md_clean(struct mddev *mddev) · 404 unmodified lines
64316487 mddev->persistent = 0;
64326488 mddev->level = LEVEL_NONE;
64336489 mddev->clevel[0] = 0;
6434− /* if UNTIL_STOP is set, it's cleared here */
6435− mddev->hold_active = 0;
6436− /* Don't clear MD_CLOSING, or mddev can be opened again. */
6437− mddev->flags &= BIT_ULL_MASK(MD_CLOSING);
6490+
6491+ /*
6492+ * For legacy_async_del_gendisk mode, it can stop the array in the
6493+ * middle of assembling it, then it still can access the array. So
6494+ * it needs to clear MD_CLOSING. If not legacy_async_del_gendisk,
6495+ * it can't open the array again after stopping it. So it doesn't
6496+ * clear MD_CLOSING.
6497+ */
6498+ if (legacy_async_del_gendisk && mddev->hold_active) {
6499+ clear_bit(MD_CLOSING, &mddev->flags);
6500+ } else {
6501+ /* if UNTIL_STOP is set, it's cleared here */
6502+ mddev->hold_active = 0;
6503+ /* Don't clear MD_CLOSING, or mddev can be opened again. */
6504+ mddev->flags &= BIT_ULL_MASK(MD_CLOSING);
6505+ }
64386506 mddev->sb_flags = 0;
64396507 mddev->ro = MD_RDWR;
64406508 mddev->metadata_type[0] = 0;
@@ -6658,7 +6726,8 @@ static int do_md_stop(struct mddev *mddev, int mode) · 217 unmodified lines
66586726
66596727 export_array(mddev);
66606728 md_clean(mddev);
6661− set_bit(MD_DELETED, &mddev->flags);
6729+ if (!legacy_async_del_gendisk)
6730+ set_bit(MD_DELETED, &mddev->flags);
66626731 }
66636732 md_new_event();
66646733 sysfs_notify_dirent_safe(mddev->sysfs_state);
@@ -8968,11 +9037,7 @@ static sector_t md_sync_position(struct mddev *mddev, enum sync_action action) · 2303 unmodified lines
89689037 start = MaxSector;
89699038 rcu_read_lock();
89709039 rdev_for_each_rcu(rdev, mddev)
8971− if (rdev->raid_disk >= 0 &&
8972− !test_bit(Journal, &rdev->flags) &&
8973− !test_bit(Faulty, &rdev->flags) &&
8974− !test_bit(In_sync, &rdev->flags) &&
8975− rdev->recovery_offset < start)
9040+ if (rdev_needs_recovery(rdev, start))
89769041 start = rdev->recovery_offset;
89779042 rcu_read_unlock();
89789043
@@ -9331,12 +9396,8 @@ void md_do_sync(struct md_thread *thread) · 352 unmodified lines
93319396 test_bit(MD_RECOVERY_RECOVER, &mddev->recovery)) {
93329397 rcu_read_lock();
93339398 rdev_for_each_rcu(rdev, mddev)
9334− if (rdev->raid_disk >= 0 &&
9335− mddev->delta_disks >= 0 &&
9336− !test_bit(Journal, &rdev->flags) &&
9337− !test_bit(Faulty, &rdev->flags) &&
9338− !test_bit(In_sync, &rdev->flags) &&
9339− rdev->recovery_offset < mddev->curr_resync)
9399+ if (mddev->delta_disks >= 0 &&
9400+ rdev_needs_recovery(rdev, mddev->curr_resync))
93409401 rdev->recovery_offset = mddev->curr_resync;
93419402 rcu_read_unlock();
93429403 }
@@ -10392,6 +10453,7 @@ module_param_call(start_ro, set_ro, get_ro, NULL, S_IRUSR|S_IWUSR); · 1049 unmodified lines
1039210453 module_param(start_dirty_degraded, int, S_IRUGO|S_IWUSR);
1039310454 module_param_call(new_array, add_named_array, NULL, NULL, S_IWUSR);
1039410455 module_param(create_on_open, bool, S_IRUSR|S_IWUSR);
10456+module_param(legacy_async_del_gendisk, bool, 0600);
1039510457
1039610458 MODULE_LICENSE("GPL");
1039710459 MODULE_DESCRIPTION("MD RAID framework");
drivers/media/i2c/alvium-csi2.c+0−1
@@ -1841,7 +1841,6 @@ static int alvium_s_stream(struct v4l2_subdev *sd, int enable) · 1840 unmodified lines
18411841
18421842 } else {
18431843 alvium_set_stream_mipi(alvium, enable);
1844− pm_runtime_mark_last_busy(&client->dev);
18451844 pm_runtime_put_autosuspend(&client->dev);
18461845 }
18471846
drivers/media/i2c/ccs/ccs-core.c+1−6
@@ -787,10 +787,8 @@ static int ccs_set_ctrl(struct v4l2_ctrl *ctrl) · 786 unmodified lines
787787 rval = -EINVAL;
788788 }
789789
790− if (pm_status > 0) {
791− pm_runtime_mark_last_busy(&client->dev);
790+ if (pm_status > 0)
792791 pm_runtime_put_autosuspend(&client->dev);
793− }
794792
795793 return rval;
796794 }
@@ -1914,7 +1912,6 @@ static int ccs_set_stream(struct v4l2_subdev *subdev, int enable) · 1117 unmodified lines
19141912 if (!enable) {
19151913 ccs_stop_streaming(sensor);
19161914 sensor->streaming = false;
1917− pm_runtime_mark_last_busy(&client->dev);
19181915 pm_runtime_put_autosuspend(&client->dev);
19191916
19201917 return 0;
@@ -1929,7 +1926,6 @@ static int ccs_set_stream(struct v4l2_subdev *subdev, int enable) · 8 unmodified lines
19291926 rval = ccs_start_streaming(sensor);
19301927 if (rval < 0) {
19311928 sensor->streaming = false;
1932− pm_runtime_mark_last_busy(&client->dev);
19331929 pm_runtime_put_autosuspend(&client->dev);
19341930 }
19351931
@@ -2677,7 +2673,6 @@ nvm_show(struct device *dev, struct device_attribute *attr, char *buf) · 741 unmodified lines
26772673 return -ENODEV;
26782674 }
26792675
2680− pm_runtime_mark_last_busy(&client->dev);
26812676 pm_runtime_put_autosuspend(&client->dev);
26822677
26832678 /*
drivers/media/i2c/dw9768.c+0−1
@@ -374,7 +374,6 @@ static int dw9768_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) · 373 unmodified lines
374374
375375 static int dw9768_close(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
376376 {
377− pm_runtime_mark_last_busy(sd->dev);
378377 pm_runtime_put_autosuspend(sd->dev);
379378
380379 return 0;
drivers/media/i2c/gc0308.c+0−3
@@ -974,7 +974,6 @@ static int gc0308_s_ctrl(struct v4l2_ctrl *ctrl) · 973 unmodified lines
974974 if (ret)
975975 dev_err(gc0308->dev, "failed to set control: %d\n", ret);
976976
977− pm_runtime_mark_last_busy(gc0308->dev);
978977 pm_runtime_put_autosuspend(gc0308->dev);
979978
980979 return ret;
@@ -1157,14 +1156,12 @@ static int gc0308_start_stream(struct gc0308 *gc0308) · 176 unmodified lines
11571156 return 0;
11581157
11591158 disable_pm:
1160− pm_runtime_mark_last_busy(gc0308->dev);
11611159 pm_runtime_put_autosuspend(gc0308->dev);
11621160 return ret;
11631161 }
11641162
11651163 static int gc0308_stop_stream(struct gc0308 *gc0308)
11661164 {
1167− pm_runtime_mark_last_busy(gc0308->dev);
11681165 pm_runtime_put_autosuspend(gc0308->dev);
11691166 return 0;
11701167 }
drivers/media/i2c/gc2145.c+0−3
@@ -963,7 +963,6 @@ static int gc2145_enable_streams(struct v4l2_subdev *sd, · 962 unmodified lines
963963 return 0;
964964
965965 err_rpm_put:
966− pm_runtime_mark_last_busy(&client->dev);
967966 pm_runtime_put_autosuspend(&client->dev);
968967 return ret;
969968 }
@@ -985,7 +984,6 @@ static int gc2145_disable_streams(struct v4l2_subdev *sd, · 15 unmodified lines
985984 if (ret)
986985 dev_err(&client->dev, "%s failed to write regs\n", __func__);
987986
988− pm_runtime_mark_last_busy(&client->dev);
989987 pm_runtime_put_autosuspend(&client->dev);
990988
991989 return ret;
@@ -1193,7 +1191,6 @@ static int gc2145_s_ctrl(struct v4l2_ctrl *ctrl) · 201 unmodified lines
11931191 break;
11941192 }
11951193
1196− pm_runtime_mark_last_busy(&client->dev);
11971194 pm_runtime_put_autosuspend(&client->dev);
11981195
11991196 return ret;
drivers/media/i2c/imx219.c+0−2
@@ -771,7 +771,6 @@ static int imx219_enable_streams(struct v4l2_subdev *sd, · 770 unmodified lines
771771 return 0;
772772
773773 err_rpm_put:
774− pm_runtime_mark_last_busy(&client->dev);
775774 pm_runtime_put_autosuspend(&client->dev);
776775 return ret;
777776 }
@@ -793,7 +792,6 @@ static int imx219_disable_streams(struct v4l2_subdev *sd, · 15 unmodified lines
793792 __v4l2_ctrl_grab(imx219->vflip, false);
794793 __v4l2_ctrl_grab(imx219->hflip, false);
795794
796− pm_runtime_mark_last_busy(&client->dev);
797795 pm_runtime_put_autosuspend(&client->dev);
798796
799797 return ret;
drivers/media/i2c/imx283.c+0−3
@@ -1143,7 +1143,6 @@ static int imx283_enable_streams(struct v4l2_subdev *sd, · 1142 unmodified lines
11431143 return 0;
11441144
11451145 err_rpm_put:
1146− pm_runtime_mark_last_busy(imx283->dev);
11471146 pm_runtime_put_autosuspend(imx283->dev);
11481147
11491148 return ret;
@@ -1163,7 +1162,6 @@ static int imx283_disable_streams(struct v4l2_subdev *sd, · 13 unmodified lines
11631162 if (ret)
11641163 dev_err(imx283->dev, "Failed to stop stream\n");
11651164
1166− pm_runtime_mark_last_busy(imx283->dev);
11671165 pm_runtime_put_autosuspend(imx283->dev);
11681166
11691167 return ret;
@@ -1558,7 +1556,6 @@ static int imx283_probe(struct i2c_client *client) · 388 unmodified lines
15581556 * Decrease the PM usage count. The device will get suspended after the
15591557 * autosuspend delay, turning the power off.
15601558 */
1561− pm_runtime_mark_last_busy(imx283->dev);
15621559 pm_runtime_put_autosuspend(imx283->dev);
15631560
15641561 return 0;
drivers/media/i2c/imx290.c+0−3
@@ -869,7 +869,6 @@ static int imx290_set_ctrl(struct v4l2_ctrl *ctrl) · 868 unmodified lines
869869 break;
870870 }
871871
872− pm_runtime_mark_last_busy(imx290->dev);
873872 pm_runtime_put_autosuspend(imx290->dev);
874873
875874 return ret;
@@ -1099,7 +1098,6 @@ static int imx290_set_stream(struct v4l2_subdev *sd, int enable) · 223 unmodified lines
10991098 }
11001099 } else {
11011100 imx290_stop_streaming(imx290);
1102− pm_runtime_mark_last_busy(imx290->dev);
11031101 pm_runtime_put_autosuspend(imx290->dev);
11041102 }
11051103
@@ -1294,7 +1292,6 @@ static int imx290_subdev_init(struct imx290 *imx290) · 188 unmodified lines
12941292 * will already be prevented even before the delay.
12951293 */
12961294 v4l2_i2c_subdev_init(&imx290->sd, client, &imx290_subdev_ops);
1297− pm_runtime_mark_last_busy(imx290->dev);
12981295 pm_runtime_put_autosuspend(imx290->dev);
12991296
13001297 imx290->sd.internal_ops = &imx290_internal_ops;
drivers/media/i2c/imx296.c+0−1
@@ -604,7 +604,6 @@ static int imx296_s_stream(struct v4l2_subdev *sd, int enable) · 603 unmodified lines
604604 if (!enable) {
605605 ret = imx296_stream_off(sensor);
606606
607− pm_runtime_mark_last_busy(sensor->dev);
608607 pm_runtime_put_autosuspend(sensor->dev);
609608
610609 goto unlock;
drivers/media/i2c/imx415.c+0−1
@@ -952,7 +952,6 @@ static int imx415_s_stream(struct v4l2_subdev *sd, int enable) · 951 unmodified lines
952952 if (!enable) {
953953 ret = imx415_stream_off(sensor);
954954
955− pm_runtime_mark_last_busy(sensor->dev);
956955 pm_runtime_put_autosuspend(sensor->dev);
957956
958957 goto unlock;
drivers/media/i2c/mt9m114.c+0−6
@@ -974,7 +974,6 @@ static int mt9m114_start_streaming(struct mt9m114 *sensor, · 973 unmodified lines
974974 return 0;
975975
976976 error:
977− pm_runtime_mark_last_busy(&sensor->client->dev);
978977 pm_runtime_put_autosuspend(&sensor->client->dev);
979978
980979 return ret;
@@ -988,7 +987,6 @@ static int mt9m114_stop_streaming(struct mt9m114 *sensor) · 7 unmodified lines
988987
989988 ret = mt9m114_set_state(sensor, MT9M114_SYS_STATE_ENTER_SUSPEND);
990989
991− pm_runtime_mark_last_busy(&sensor->client->dev);
992990 pm_runtime_put_autosuspend(&sensor->client->dev);
993991
994992 return ret;
@@ -1046,7 +1044,6 @@ static int mt9m114_pa_g_ctrl(struct v4l2_ctrl *ctrl) · 51 unmodified lines
10461044 break;
10471045 }
10481046
1049− pm_runtime_mark_last_busy(&sensor->client->dev);
10501047 pm_runtime_put_autosuspend(&sensor->client->dev);
10511048
10521049 return ret;
@@ -1113,7 +1110,6 @@ static int mt9m114_pa_s_ctrl(struct v4l2_ctrl *ctrl) · 60 unmodified lines
11131110 break;
11141111 }
11151112
1116− pm_runtime_mark_last_busy(&sensor->client->dev);
11171113 pm_runtime_put_autosuspend(&sensor->client->dev);
11181114
11191115 return ret;
@@ -1565,7 +1561,6 @@ static int mt9m114_ifp_s_ctrl(struct v4l2_ctrl *ctrl) · 445 unmodified lines
15651561 break;
15661562 }
15671563
1568− pm_runtime_mark_last_busy(&sensor->client->dev);
15691564 pm_runtime_put_autosuspend(&sensor->client->dev);
15701565
15711566 return ret;
@@ -2472,7 +2467,6 @@ static int mt9m114_probe(struct i2c_client *client) · 900 unmodified lines
24722467 * Decrease the PM usage count. The device will get suspended after the
24732468 * autosuspend delay, turning the power off.
24742469 */
2475− pm_runtime_mark_last_busy(dev);
24762470 pm_runtime_put_autosuspend(dev);
24772471
24782472 return 0;
drivers/media/i2c/ov4689.c+0−3
@@ -497,7 +497,6 @@ static int ov4689_s_stream(struct v4l2_subdev *sd, int on) · 496 unmodified lines
497497 } else {
498498 cci_write(ov4689->regmap, OV4689_REG_CTRL_MODE,
499499 OV4689_MODE_SW_STANDBY, NULL);
500− pm_runtime_mark_last_busy(dev);
501500 pm_runtime_put_autosuspend(dev);
502501 }
503502
@@ -702,7 +701,6 @@ static int ov4689_set_ctrl(struct v4l2_ctrl *ctrl) · 198 unmodified lines
702701 break;
703702 }
704703
705− pm_runtime_mark_last_busy(dev);
706704 pm_runtime_put_autosuspend(dev);
707705
708706 return ret;
@@ -999,7 +997,6 @@ static int ov4689_probe(struct i2c_client *client) · 290 unmodified lines
999997 goto err_clean_subdev_pm;
1000998 }
1001999
1002− pm_runtime_mark_last_busy(dev);
10031000 pm_runtime_put_autosuspend(dev);
10041001
10051002 return 0;
drivers/media/i2c/ov5640.c+0−4
@@ -3341,7 +3341,6 @@ static int ov5640_g_volatile_ctrl(struct v4l2_ctrl *ctrl) · 3340 unmodified lines
33413341 break;
33423342 }
33433343
3344− pm_runtime_mark_last_busy(&sensor->i2c_client->dev);
33453344 pm_runtime_put_autosuspend(&sensor->i2c_client->dev);
33463345
33473346 return 0;
@@ -3417,7 +3416,6 @@ static int ov5640_s_ctrl(struct v4l2_ctrl *ctrl) · 69 unmodified lines
34173416 break;
34183417 }
34193418
3420− pm_runtime_mark_last_busy(&sensor->i2c_client->dev);
34213419 pm_runtime_put_autosuspend(&sensor->i2c_client->dev);
34223420
34233421 return ret;
@@ -3754,7 +3752,6 @@ out: · 330 unmodified lines
37543752 mutex_unlock(&sensor->lock);
37553753
37563754 if (!enable || ret) {
3757− pm_runtime_mark_last_busy(&sensor->i2c_client->dev);
37583755 pm_runtime_put_autosuspend(&sensor->i2c_client->dev);
37593756 }
37603757
@@ -3965,7 +3962,6 @@ static int ov5640_probe(struct i2c_client *client) · 204 unmodified lines
39653962
39663963 pm_runtime_set_autosuspend_delay(dev, 1000);
39673964 pm_runtime_use_autosuspend(dev);
3968− pm_runtime_mark_last_busy(dev);
39693965 pm_runtime_put_autosuspend(dev);
39703966
39713967 return 0;
drivers/media/i2c/ov5645.c+0−3
@@ -808,7 +808,6 @@ static int ov5645_s_ctrl(struct v4l2_ctrl *ctrl) · 807 unmodified lines
808808 break;
809809 }
810810
811− pm_runtime_mark_last_busy(ov5645->dev);
812811 pm_runtime_put_autosuspend(ov5645->dev);
813812
814813 return ret;
@@ -979,7 +978,6 @@ static int ov5645_disable_streams(struct v4l2_subdev *sd, · 164 unmodified lines
979978 OV5645_SYSTEM_CTRL0_STOP);
980979
981980 rpm_put:
982− pm_runtime_mark_last_busy(ov5645->dev);
983981 pm_runtime_put_autosuspend(ov5645->dev);
984982
985983 return ret;
@@ -1196,7 +1194,6 @@ static int ov5645_probe(struct i2c_client *client) · 210 unmodified lines
11961194
11971195 pm_runtime_set_autosuspend_delay(dev, 1000);
11981196 pm_runtime_use_autosuspend(dev);
1199− pm_runtime_mark_last_busy(dev);
12001197 pm_runtime_put_autosuspend(dev);
12011198
12021199 return 0;
drivers/media/i2c/ov64a40.c+1−6
@@ -2990,7 +2990,6 @@ static int ov64a40_start_streaming(struct ov64a40 *ov64a40, · 2989 unmodified lines
29902990 return 0;
29912991
29922992 error_power_off:
2993− pm_runtime_mark_last_busy(ov64a40->dev);
29942993 pm_runtime_put_autosuspend(ov64a40->dev);
29952994
29962995 return ret;
@@ -3000,7 +2999,6 @@ static int ov64a40_stop_streaming(struct ov64a40 *ov64a40, · 3 unmodified lines
30002999 struct v4l2_subdev_state *state)
30013000 {
30023001 cci_update_bits(ov64a40->cci, OV64A40_REG_SMIA, BIT(0), 0, NULL);
3003− pm_runtime_mark_last_busy(ov64a40->dev);
30043002 pm_runtime_put_autosuspend(ov64a40->dev);
30053003
30063004 __v4l2_ctrl_grab(ov64a40->link_freq, false);
@@ -3329,10 +3327,8 @@ static int ov64a40_set_ctrl(struct v4l2_ctrl *ctrl) · 322 unmodified lines
33293327 break;
33303328 }
33313329
3332− if (pm_status > 0) {
3333− pm_runtime_mark_last_busy(ov64a40->dev);
3330+ if (pm_status > 0)
33343331 pm_runtime_put_autosuspend(ov64a40->dev);
3335− }
33363332
33373333 return ret;
33383334 }
@@ -3622,7 +3618,6 @@ static int ov64a40_probe(struct i2c_client *client) · 283 unmodified lines
36223618 goto error_subdev_cleanup;
36233619 }
36243620
3625− pm_runtime_mark_last_busy(&client->dev);
36263621 pm_runtime_put_autosuspend(&client->dev);
36273622
36283623 return 0;
drivers/media/i2c/ov8858.c+0−2
@@ -1391,7 +1391,6 @@ static int ov8858_s_stream(struct v4l2_subdev *sd, int on) · 1390 unmodified lines
13911391 }
13921392 } else {
13931393 ov8858_stop_stream(ov8858);
1394− pm_runtime_mark_last_busy(&client->dev);
13951394 pm_runtime_put_autosuspend(&client->dev);
13961395 }
13971396
@@ -1945,7 +1944,6 @@ static int ov8858_probe(struct i2c_client *client) · 547 unmodified lines
19451944 goto err_power_off;
19461945 }
19471946
1948− pm_runtime_mark_last_busy(dev);
19491947 pm_runtime_put_autosuspend(dev);
19501948
19511949 return 0;
drivers/media/i2c/st-mipid02.c+0−2
@@ -465,7 +465,6 @@ static int mipid02_disable_streams(struct v4l2_subdev *sd, · 464 unmodified lines
465465 if (ret)
466466 goto error;
467467
468− pm_runtime_mark_last_busy(&client->dev);
469468 pm_runtime_put_autosuspend(&client->dev);
470469
471470 error:
@@ -542,7 +541,6 @@ error: · 70 unmodified lines
542541 cci_write(bridge->regmap, MIPID02_DATA_LANE0_REG1, 0, &ret);
543542 cci_write(bridge->regmap, MIPID02_DATA_LANE1_REG1, 0, &ret);
544543
545− pm_runtime_mark_last_busy(&client->dev);
546544 pm_runtime_put_autosuspend(&client->dev);
547545 return ret;
548546 }
drivers/media/i2c/tc358746.c+0−5
@@ -816,7 +816,6 @@ static int tc358746_s_stream(struct v4l2_subdev *sd, int enable) · 815 unmodified lines
816816 return 0;
817817
818818 err_out:
819− pm_runtime_mark_last_busy(sd->dev);
820819 pm_runtime_put_sync_autosuspend(sd->dev);
821820
822821 return err;
@@ -838,7 +837,6 @@ err_out: · 15 unmodified lines
838837 if (err)
839838 return err;
840839
841− pm_runtime_mark_last_busy(sd->dev);
842840 pm_runtime_put_sync_autosuspend(sd->dev);
843841
844842 return v4l2_subdev_call(src, video, s_stream, 0);
@@ -1016,7 +1014,6 @@ tc358746_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) · 171 unmodified lines
10161014 err = tc358746_read(tc358746, reg->reg, &val);
10171015 reg->val = val;
10181016
1019− pm_runtime_mark_last_busy(sd->dev);
10201017 pm_runtime_put_sync_autosuspend(sd->dev);
10211018
10221019 return err;
@@ -1032,7 +1029,6 @@ tc358746_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg) · 9 unmodified lines
10321029
10331030 tc358746_write(tc358746, (u32)reg->reg, (u32)reg->val);
10341031
1035− pm_runtime_mark_last_busy(sd->dev);
10361032 pm_runtime_put_sync_autosuspend(sd->dev);
10371033
10381034 return 0;
@@ -1395,7 +1391,6 @@ static int tc358746_init_hw(struct tc358746 *tc358746) · 356 unmodified lines
13951391 }
13961392
13971393 err = tc358746_read(tc358746, CHIPID_REG, &val);
1398− pm_runtime_mark_last_busy(dev);
13991394 pm_runtime_put_sync_autosuspend(dev);
14001395 if (err)
14011396 return -ENODEV;
drivers/media/i2c/thp7312.c+0−4
@@ -808,7 +808,6 @@ static int thp7312_s_stream(struct v4l2_subdev *sd, int enable) · 807 unmodified lines
808808 if (!enable) {
809809 thp7312_stream_enable(thp7312, false);
810810
811− pm_runtime_mark_last_busy(thp7312->dev);
812811 pm_runtime_put_autosuspend(thp7312->dev);
813812
814813 v4l2_subdev_unlock_state(sd_state);
@@ -839,7 +838,6 @@ static int thp7312_s_stream(struct v4l2_subdev *sd, int enable) · 24 unmodified lines
839838 goto finish_unlock;
840839
841840 finish_pm:
842− pm_runtime_mark_last_busy(thp7312->dev);
843841 pm_runtime_put_autosuspend(thp7312->dev);
844842 finish_unlock:
845843 v4l2_subdev_unlock_state(sd_state);
@@ -1147,7 +1145,6 @@ static int thp7312_s_ctrl(struct v4l2_ctrl *ctrl) · 301 unmodified lines
11471145 break;
11481146 }
11491147
1150− pm_runtime_mark_last_busy(thp7312->dev);
11511148 pm_runtime_put_autosuspend(thp7312->dev);
11521149
11531150 return ret;
@@ -2183,7 +2180,6 @@ static int thp7312_probe(struct i2c_client *client) · 1029 unmodified lines
21832180 * Decrease the PM usage count. The device will get suspended after the
21842181 * autosuspend delay, turning the power off.
21852182 */
2186− pm_runtime_mark_last_busy(dev);
21872183 pm_runtime_put_autosuspend(dev);
21882184
21892185 dev_info(dev, "THP7312 firmware version %02u.%02u\n",
drivers/media/i2c/vd55g1.c+0−4
@@ -1104,7 +1104,6 @@ static int vd55g1_disable_streams(struct v4l2_subdev *sd, · 1103 unmodified lines
11041104
11051105 vd55g1_grab_ctrls(sensor, false);
11061106
1107− pm_runtime_mark_last_busy(sensor->dev);
11081107 pm_runtime_put_autosuspend(sensor->dev);
11091108
11101109 return ret;
@@ -1338,7 +1337,6 @@ static int vd55g1_g_volatile_ctrl(struct v4l2_ctrl *ctrl) · 227 unmodified lines
13381337 break;
13391338 }
13401339
1341− pm_runtime_mark_last_busy(sensor->dev);
13421340 pm_runtime_put_autosuspend(sensor->dev);
13431341
13441342 return ret;
@@ -1433,7 +1431,6 @@ static int vd55g1_s_ctrl(struct v4l2_ctrl *ctrl) · 88 unmodified lines
14331431 break;
14341432 }
14351433
1436− pm_runtime_mark_last_busy(sensor->dev);
14371434 pm_runtime_put_autosuspend(sensor->dev);
14381435
14391436 return ret;
@@ -1895,7 +1892,6 @@ static int vd55g1_probe(struct i2c_client *client) · 455 unmodified lines
18951892 pm_runtime_enable(dev);
18961893 pm_runtime_set_autosuspend_delay(dev, 4000);
18971894 pm_runtime_use_autosuspend(dev);
1898− pm_runtime_mark_last_busy(dev);
18991895 pm_runtime_put_autosuspend(dev);
19001896
19011897 ret = vd55g1_subdev_init(sensor);
drivers/media/i2c/vd56g3.c+0−4
@@ -493,7 +493,6 @@ static int vd56g3_g_volatile_ctrl(struct v4l2_ctrl *ctrl) · 492 unmodified lines
493493 break;
494494 }
495495
496− pm_runtime_mark_last_busy(sensor->dev);
497496 pm_runtime_put_autosuspend(sensor->dev);
498497
499498 return ret;
@@ -577,7 +576,6 @@ static int vd56g3_s_ctrl(struct v4l2_ctrl *ctrl) · 77 unmodified lines
577576 break;
578577 }
579578
580− pm_runtime_mark_last_busy(sensor->dev);
581579 pm_runtime_put_autosuspend(sensor->dev);
582580
583581 return ret;
@@ -1021,7 +1019,6 @@ static int vd56g3_disable_streams(struct v4l2_subdev *sd, · 437 unmodified lines
10211019 __v4l2_ctrl_grab(sensor->vflip_ctrl, false);
10221020 __v4l2_ctrl_grab(sensor->patgen_ctrl, false);
10231021
1024− pm_runtime_mark_last_busy(sensor->dev);
10251022 pm_runtime_put_autosuspend(sensor->dev);
10261023
10271024 return ret;
@@ -1527,7 +1524,6 @@ static int vd56g3_probe(struct i2c_client *client) · 499 unmodified lines
15271524 }
15281525
15291526 /* Sensor could now be powered off (after the autosuspend delay) */
1530− pm_runtime_mark_last_busy(dev);
15311527 pm_runtime_put_autosuspend(dev);
15321528
15331529 dev_dbg(dev, "Successfully probe %s sensor\n",
drivers/media/i2c/video-i2c.c+0−4
@@ -288,7 +288,6 @@ static int amg88xx_read(struct device *dev, enum hwmon_sensor_types type, · 287 unmodified lines
288288 return tmp;
289289
290290 tmp = regmap_bulk_read(data->regmap, AMG88XX_REG_TTHL, &buf, 2);
291− pm_runtime_mark_last_busy(regmap_get_device(data->regmap));
292291 pm_runtime_put_autosuspend(regmap_get_device(data->regmap));
293292 if (tmp)
294293 return tmp;
@@ -527,7 +526,6 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count) · 232 unmodified lines
527526 return 0;
528527
529528 error_rpm_put:
530− pm_runtime_mark_last_busy(dev);
531529 pm_runtime_put_autosuspend(dev);
532530 error_del_list:
533531 video_i2c_del_list(vq, VB2_BUF_STATE_QUEUED);
@@ -544,7 +542,6 @@ static void stop_streaming(struct vb2_queue *vq) · 10 unmodified lines
544542
545543 kthread_stop(data->kthread_vid_cap);
546544 data->kthread_vid_cap = NULL;
547− pm_runtime_mark_last_busy(regmap_get_device(data->regmap));
548545 pm_runtime_put_autosuspend(regmap_get_device(data->regmap));
549546
550547 video_i2c_del_list(vq, VB2_BUF_STATE_ERROR);
@@ -853,7 +850,6 @@ static int video_i2c_probe(struct i2c_client *client) · 302 unmodified lines
853850 if (ret < 0)
854851 goto error_pm_disable;
855852
856− pm_runtime_mark_last_busy(&client->dev);
857853 pm_runtime_put_autosuspend(&client->dev);
858854
859855 return 0;
drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c+0−4
@@ -451,7 +451,6 @@ static void wave5_vpu_dec_finish_decode(struct vpu_instance *inst) · 450 unmodified lines
451451 if (q_status.report_queue_count == 0 &&
452452 (q_status.instance_queue_count == 0 || dec_info.sequence_changed)) {
453453 dev_dbg(inst->dev->dev, "%s: finishing job.\n", __func__);
454− pm_runtime_mark_last_busy(inst->dev->dev);
455454 pm_runtime_put_autosuspend(inst->dev->dev);
456455 v4l2_m2m_job_finish(inst->v4l2_m2m_dev, m2m_ctx);
457456 }
@@ -1364,7 +1363,6 @@ static int wave5_vpu_dec_start_streaming(struct vb2_queue *q, unsigned int count · 906 unmodified lines
13641363 }
13651364
13661365 }
1367− pm_runtime_mark_last_busy(inst->dev->dev);
13681366 pm_runtime_put_autosuspend(inst->dev->dev);
13691367 return ret;
13701368
@@ -1498,7 +1496,6 @@ static void wave5_vpu_dec_stop_streaming(struct vb2_queue *q) · 127 unmodified lines
14981496 else
14991497 streamoff_capture(q);
15001498
1501− pm_runtime_mark_last_busy(inst->dev->dev);
15021499 pm_runtime_put_autosuspend(inst->dev->dev);
15031500 }
15041501
@@ -1662,7 +1659,6 @@ static void wave5_vpu_dec_device_run(void *priv) · 157 unmodified lines
16621659
16631660 finish_job_and_return:
16641661 dev_dbg(inst->dev->dev, "%s: leave and finish job", __func__);
1665− pm_runtime_mark_last_busy(inst->dev->dev);
16661662 pm_runtime_put_autosuspend(inst->dev->dev);
16671663 v4l2_m2m_job_finish(inst->v4l2_m2m_dev, m2m_ctx);
16681664 }
drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c+0−5
@@ -1391,12 +1391,10 @@ static int wave5_vpu_enc_start_streaming(struct vb2_queue *q, unsigned int count · 1390 unmodified lines
13911391 if (ret)
13921392 goto return_buffers;
13931393
1394− pm_runtime_mark_last_busy(inst->dev->dev);
13951394 pm_runtime_put_autosuspend(inst->dev->dev);
13961395 return 0;
13971396 return_buffers:
13981397 wave5_return_bufs(q, VB2_BUF_STATE_QUEUED);
1399− pm_runtime_mark_last_busy(inst->dev->dev);
14001398 pm_runtime_put_autosuspend(inst->dev->dev);
14011399 return ret;
14021400 }
@@ -1465,7 +1463,6 @@ static void wave5_vpu_enc_stop_streaming(struct vb2_queue *q) · 62 unmodified lines
14651463 else
14661464 streamoff_capture(inst, q);
14671465
1468− pm_runtime_mark_last_busy(inst->dev->dev);
14691466 pm_runtime_put_autosuspend(inst->dev->dev);
14701467 }
14711468
@@ -1520,7 +1517,6 @@ static void wave5_vpu_enc_device_run(void *priv) · 48 unmodified lines
15201517 break;
15211518 }
15221519 dev_dbg(inst->dev->dev, "%s: leave with active job", __func__);
1523− pm_runtime_mark_last_busy(inst->dev->dev);
15241520 pm_runtime_put_autosuspend(inst->dev->dev);
15251521 return;
15261522 default:
@@ -1529,7 +1525,6 @@ static void wave5_vpu_enc_device_run(void *priv) · 2 unmodified lines
15291525 break;
15301526 }
15311527 dev_dbg(inst->dev->dev, "%s: leave and finish job", __func__);
1532− pm_runtime_mark_last_busy(inst->dev->dev);
15331528 pm_runtime_put_autosuspend(inst->dev->dev);
15341529 v4l2_m2m_job_finish(inst->v4l2_m2m_dev, m2m_ctx);
15351530 }
drivers/media/platform/nvidia/tegra-vde/h264.c+0−2
@@ -585,7 +585,6 @@ static int tegra_vde_decode_begin(struct tegra_vde *vde, · 584 unmodified lines
585585 return 0;
586586
587587 put_runtime_pm:
588− pm_runtime_mark_last_busy(dev);
589588 pm_runtime_put_autosuspend(dev);
590589
591590 unlock:
@@ -612,7 +611,6 @@ static void tegra_vde_decode_abort(struct tegra_vde *vde) · 20 unmodified lines
612611 if (err)
613612 dev_err(dev, "DEC end: Failed to assert HW reset: %d\n", err);
614613
615− pm_runtime_mark_last_busy(dev);
616614 pm_runtime_put_autosuspend(dev);
617615
618616 mutex_unlock(&vde->lock);
drivers/media/platform/qcom/iris/iris_hfi_queue.c+0−1
@@ -142,7 +142,6 @@ int iris_hfi_queue_cmd_write(struct iris_core *core, void *pkt, u32 pkt_size) · 141 unmodified lines
142142 }
143143 mutex_unlock(&core->lock);
144144
145− pm_runtime_mark_last_busy(core->dev);
146145 pm_runtime_put_autosuspend(core->dev);
147146
148147 return 0;
drivers/media/platform/raspberrypi/pisp_be/pisp_be.c+0−2
@@ -950,7 +950,6 @@ static void pispbe_node_stop_streaming(struct vb2_queue *q) · 949 unmodified lines
950950 kfree(job);
951951 }
952952
953− pm_runtime_mark_last_busy(pispbe->dev);
954953 pm_runtime_put_autosuspend(pispbe->dev);
955954
956955 dev_dbg(pispbe->dev, "Nodes streaming now 0x%x\n",
@@ -1742,7 +1741,6 @@ static int pispbe_probe(struct platform_device *pdev) · 785 unmodified lines
17421741 if (ret)
17431742 goto disable_devs_err;
17441743
1745− pm_runtime_mark_last_busy(pispbe->dev);
17461744 pm_runtime_put_autosuspend(pispbe->dev);
17471745
17481746 return 0;
drivers/media/platform/rockchip/rkvdec/rkvdec.c+9−8
@@ -765,7 +765,6 @@ static void rkvdec_job_finish(struct rkvdec_ctx *ctx, · 764 unmodified lines
765765 {
766766 struct rkvdec_dev *rkvdec = ctx->dev;
767767
768− pm_runtime_mark_last_busy(rkvdec->dev);
769768 pm_runtime_put_autosuspend(rkvdec->dev);
770769 rkvdec_job_finish_no_pm(ctx, result);
771770 }
@@ -1159,13 +1158,6 @@ static int rkvdec_probe(struct platform_device *pdev) · 387 unmodified lines
11591158 return ret;
11601159 }
11611160
1162− if (iommu_get_domain_for_dev(&pdev->dev)) {
1163− rkvdec->empty_domain = iommu_paging_domain_alloc(rkvdec->dev);
1164−
1165− if (!rkvdec->empty_domain)
1166− dev_warn(rkvdec->dev, "cannot alloc new empty domain\n");
1167− }
1168−
11691161 vb2_dma_contig_set_max_seg_size(&pdev->dev, DMA_BIT_MASK(32));
11701162
11711163 irq = platform_get_irq(pdev, 0);
@@ -1188,6 +1180,15 @@ static int rkvdec_probe(struct platform_device *pdev) · 16 unmodified lines
11881180 if (ret)
11891181 goto err_disable_runtime_pm;
11901182
1183+ if (iommu_get_domain_for_dev(&pdev->dev)) {
1184+ rkvdec->empty_domain = iommu_paging_domain_alloc(rkvdec->dev);
1185+
1186+ if (IS_ERR(rkvdec->empty_domain)) {
1187+ rkvdec->empty_domain = NULL;
1188+ dev_warn(rkvdec->dev, "cannot alloc new empty domain\n");
1189+ }
1190+ }
1191+
11911192 return 0;
11921193
11931194 err_disable_runtime_pm:
drivers/media/platform/verisilicon/hantro_drv.c+0−1
@@ -89,7 +89,6 @@ static void hantro_job_finish(struct hantro_dev *vpu, · 88 unmodified lines
8989 struct hantro_ctx *ctx,
9090 enum vb2_buffer_state result)
9191 {
92− pm_runtime_mark_last_busy(vpu->dev);
9392 pm_runtime_put_autosuspend(vpu->dev);
9493
9594 clk_bulk_disable(vpu->variant->num_clocks, vpu->clocks);
drivers/media/rc/gpio-ir-recv.c+1−3
@@ -48,10 +48,8 @@ static irqreturn_t gpio_ir_recv_irq(int irq, void *dev_id) · 47 unmodified lines
4848 if (val >= 0)
4949 ir_raw_event_store_edge(gpio_dev->rcdev, val == 1);
5050
51− if (pmdev) {
52− pm_runtime_mark_last_busy(pmdev);
51+ if (pmdev)
5352 pm_runtime_put_autosuspend(pmdev);
54− }
5553
5654 return IRQ_HANDLED;
5755 }
drivers/memstick/core/memstick.c+0−1
@@ -555,7 +555,6 @@ EXPORT_SYMBOL(memstick_add_host); · 554 unmodified lines
555555 */
556556 void memstick_remove_host(struct memstick_host *host)
557557 {
558− host->removing = 1;
559558 flush_workqueue(workqueue);
560559 mutex_lock(&host->lock);
561560 if (host->card)
drivers/memstick/host/rtsx_usb_ms.c+1−0
@@ -812,6 +812,7 @@ static void rtsx_usb_ms_drv_remove(struct platform_device *pdev) · 811 unmodified lines
812812 int err;
813813
814814 host->eject = true;
815+ msh->removing = true;
815816 cancel_work_sync(&host->handle_req);
816817 cancel_delayed_work_sync(&host->poll_card);
817818
drivers/mmc/host/sdhci-of-arasan.c+31−2
@@ -99,6 +99,9 @@ · 98 unmodified lines
9999 #define HIWORD_UPDATE(val, mask, shift) \
100100 ((val) << (shift) | (mask) << ((shift) + 16))
101101
102+#define CD_STABLE_TIMEOUT_US 1000000
103+#define CD_STABLE_MAX_SLEEP_US 10
104+
102105 /**
103106 * struct sdhci_arasan_soc_ctl_field - Field used in sdhci_arasan_soc_ctl_map
104107 *
@@ -206,12 +209,15 @@ struct sdhci_arasan_data { · 101 unmodified lines
206209 * 19MHz instead
207210 */
208211 #define SDHCI_ARASAN_QUIRK_CLOCK_25_BROKEN BIT(2)
212+/* Enable CD stable check before power-up */
213+#define SDHCI_ARASAN_QUIRK_ENSURE_CD_STABLE BIT(3)
209214 };
210215
211216 struct sdhci_arasan_of_data {
212217 const struct sdhci_arasan_soc_ctl_map *soc_ctl_map;
213218 const struct sdhci_pltfm_data *pdata;
214219 const struct sdhci_arasan_clk_ops *clk_ops;
220+ u32 quirks;
215221 };
216222
217223 static const struct sdhci_arasan_soc_ctl_map rk3399_soc_ctl_map = {
@@ -514,6 +520,24 @@ static int sdhci_arasan_voltage_switch(struct mmc_host *mmc, · 296 unmodified lines
514520 return -EINVAL;
515521 }
516522
523+static void sdhci_arasan_set_power_and_bus_voltage(struct sdhci_host *host, unsigned char mode,
524+ unsigned short vdd)
525+{
526+ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
527+ struct sdhci_arasan_data *sdhci_arasan = sdhci_pltfm_priv(pltfm_host);
528+ u32 reg;
529+
530+ /*
531+ * Ensure that the card detect logic has stabilized before powering up, this is
532+ * necessary after a host controller reset.
533+ */
534+ if (mode == MMC_POWER_UP && sdhci_arasan->quirks & SDHCI_ARASAN_QUIRK_ENSURE_CD_STABLE)
535+ read_poll_timeout(sdhci_readl, reg, reg & SDHCI_CD_STABLE, CD_STABLE_MAX_SLEEP_US,
536+ CD_STABLE_TIMEOUT_US, false, host, SDHCI_PRESENT_STATE);
537+
538+ sdhci_set_power_and_bus_voltage(host, mode, vdd);
539+}
540+
517541 static const struct sdhci_ops sdhci_arasan_ops = {
518542 .set_clock = sdhci_arasan_set_clock,
519543 .get_max_clock = sdhci_pltfm_clk_get_max_clock,
@@ -521,7 +545,7 @@ static const struct sdhci_ops sdhci_arasan_ops = { · 1 unmodified line
521545 .set_bus_width = sdhci_set_bus_width,
522546 .reset = sdhci_arasan_reset,
523547 .set_uhs_signaling = sdhci_set_uhs_signaling,
524− .set_power = sdhci_set_power_and_bus_voltage,
548+ .set_power = sdhci_arasan_set_power_and_bus_voltage,
525549 .hw_reset = sdhci_arasan_hw_reset,
526550 };
527551
@@ -570,7 +594,7 @@ static const struct sdhci_ops sdhci_arasan_cqe_ops = { · 42 unmodified lines
570594 .set_bus_width = sdhci_set_bus_width,
571595 .reset = sdhci_arasan_reset,
572596 .set_uhs_signaling = sdhci_set_uhs_signaling,
573− .set_power = sdhci_set_power_and_bus_voltage,
597+ .set_power = sdhci_arasan_set_power_and_bus_voltage,
574598 .irq = sdhci_arasan_cqhci_irq,
575599 };
576600
@@ -1447,6 +1471,7 @@ static const struct sdhci_arasan_clk_ops zynqmp_clk_ops = { · 870 unmodified lines
14471471 static struct sdhci_arasan_of_data sdhci_arasan_zynqmp_data = {
14481472 .pdata = &sdhci_arasan_zynqmp_pdata,
14491473 .clk_ops = &zynqmp_clk_ops,
1474+ .quirks = SDHCI_ARASAN_QUIRK_ENSURE_CD_STABLE,
14501475 };
14511476
14521477 static const struct sdhci_arasan_clk_ops versal_clk_ops = {
@@ -1457,6 +1482,7 @@ static const struct sdhci_arasan_clk_ops versal_clk_ops = { · 4 unmodified lines
14571482 static struct sdhci_arasan_of_data sdhci_arasan_versal_data = {
14581483 .pdata = &sdhci_arasan_zynqmp_pdata,
14591484 .clk_ops = &versal_clk_ops,
1485+ .quirks = SDHCI_ARASAN_QUIRK_ENSURE_CD_STABLE,
14601486 };
14611487
14621488 static const struct sdhci_arasan_clk_ops versal_net_clk_ops = {
@@ -1467,6 +1493,7 @@ static const struct sdhci_arasan_clk_ops versal_net_clk_ops = { · 4 unmodified lines
14671493 static struct sdhci_arasan_of_data sdhci_arasan_versal_net_data = {
14681494 .pdata = &sdhci_arasan_versal_net_pdata,
14691495 .clk_ops = &versal_net_clk_ops,
1496+ .quirks = SDHCI_ARASAN_QUIRK_ENSURE_CD_STABLE,
14701497 };
14711498
14721499 static struct sdhci_arasan_of_data intel_keembay_emmc_data = {
@@ -1937,6 +1964,8 @@ static int sdhci_arasan_probe(struct platform_device *pdev) · 464 unmodified lines
19371964 if (of_device_is_compatible(np, "rockchip,rk3399-sdhci-5.1"))
19381965 sdhci_arasan_update_clockmultiplier(host, 0x0);
19391966
1967+ sdhci_arasan->quirks |= data->quirks;
1968+
19401969 if (of_device_is_compatible(np, "intel,keembay-sdhci-5.1-emmc") ||
19411970 of_device_is_compatible(np, "intel,keembay-sdhci-5.1-sd") ||
19421971 of_device_is_compatible(np, "intel,keembay-sdhci-5.1-sdio")) {
drivers/mmc/host/sdhci-pci-gli.c+21−16
@@ -287,6 +287,20 @@ · 286 unmodified lines
287287 #define GLI_MAX_TUNING_LOOP 40
288288
289289 /* Genesys Logic chipset */
290+static void sdhci_gli_mask_replay_timer_timeout(struct pci_dev *pdev)
291+{
292+ int aer;
293+ u32 value;
294+
295+ /* mask the replay timer timeout of AER */
296+ aer = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ERR);
297+ if (aer) {
298+ pci_read_config_dword(pdev, aer + PCI_ERR_COR_MASK, &value);
299+ value |= PCI_ERR_COR_REP_TIMER;
300+ pci_write_config_dword(pdev, aer + PCI_ERR_COR_MASK, value);
301+ }
302+}
303+
290304 static inline void gl9750_wt_on(struct sdhci_host *host)
291305 {
292306 u32 wt_value;
@@ -607,7 +621,6 @@ static void gl9750_hw_setting(struct sdhci_host *host) · 314 unmodified lines
607621 {
608622 struct sdhci_pci_slot *slot = sdhci_priv(host);
609623 struct pci_dev *pdev;
610− int aer;
611624 u32 value;
612625
613626 pdev = slot->chip->pdev;
@@ -626,12 +639,7 @@ static void gl9750_hw_setting(struct sdhci_host *host) · 12 unmodified lines
626639 pci_set_power_state(pdev, PCI_D0);
627640
628641 /* mask the replay timer timeout of AER */
629− aer = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ERR);
630− if (aer) {
631− pci_read_config_dword(pdev, aer + PCI_ERR_COR_MASK, &value);
632− value |= PCI_ERR_COR_REP_TIMER;
633− pci_write_config_dword(pdev, aer + PCI_ERR_COR_MASK, value);
634− }
642+ sdhci_gli_mask_replay_timer_timeout(pdev);
635643
636644 gl9750_wt_off(host);
637645 }
@@ -806,7 +814,6 @@ static void sdhci_gl9755_set_clock(struct sdhci_host *host, unsigned int clock) · 168 unmodified lines
806814 static void gl9755_hw_setting(struct sdhci_pci_slot *slot)
807815 {
808816 struct pci_dev *pdev = slot->chip->pdev;
809− int aer;
810817 u32 value;
811818
812819 gl9755_wt_on(pdev);
@@ -841,12 +848,7 @@ static void gl9755_hw_setting(struct sdhci_pci_slot *slot) · 28 unmodified lines
841848 pci_set_power_state(pdev, PCI_D0);
842849
843850 /* mask the replay timer timeout of AER */
844− aer = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ERR);
845− if (aer) {
846− pci_read_config_dword(pdev, aer + PCI_ERR_COR_MASK, &value);
847− value |= PCI_ERR_COR_REP_TIMER;
848− pci_write_config_dword(pdev, aer + PCI_ERR_COR_MASK, value);
849− }
851+ sdhci_gli_mask_replay_timer_timeout(pdev);
850852
851853 gl9755_wt_off(pdev);
852854 }
@@ -1751,7 +1753,7 @@ cleanup: · 898 unmodified lines
17511753 return ret;
17521754 }
17531755
1754−static void gli_set_gl9763e(struct sdhci_pci_slot *slot)
1756+static void gl9763e_hw_setting(struct sdhci_pci_slot *slot)
17551757 {
17561758 struct pci_dev *pdev = slot->chip->pdev;
17571759 u32 value;
@@ -1780,6 +1782,9 @@ static void gli_set_gl9763e(struct sdhci_pci_slot *slot) · 22 unmodified lines
17801782 value |= FIELD_PREP(GLI_9763E_HS400_RXDLY, GLI_9763E_HS400_RXDLY_5);
17811783 pci_write_config_dword(pdev, PCIE_GLI_9763E_CLKRXDLY, value);
17821784
1785+ /* mask the replay timer timeout of AER */
1786+ sdhci_gli_mask_replay_timer_timeout(pdev);
1787+
17831788 pci_read_config_dword(pdev, PCIE_GLI_9763E_VHS, &value);
17841789 value &= ~GLI_9763E_VHS_REV;
17851790 value |= FIELD_PREP(GLI_9763E_VHS_REV, GLI_9763E_VHS_REV_R);
@@ -1923,7 +1928,7 @@ static int gli_probe_slot_gl9763e(struct sdhci_pci_slot *slot) · 137 unmodified lines
19231928 gli_pcie_enable_msi(slot);
19241929 host->mmc_host_ops.hs400_enhanced_strobe =
19251930 gl9763e_hs400_enhanced_strobe;
1926− gli_set_gl9763e(slot);
1931+ gl9763e_hw_setting(slot);
19271932 sdhci_enable_v4_mode(host);
19281933
19291934 return 0;
drivers/mmc/host/sdhci_am654.c+18−0
@@ -156,6 +156,7 @@ struct sdhci_am654_data { · 155 unmodified lines
156156
157157 #define SDHCI_AM654_QUIRK_FORCE_CDTEST BIT(0)
158158 #define SDHCI_AM654_QUIRK_SUPPRESS_V1P8_ENA BIT(1)
159+#define SDHCI_AM654_QUIRK_DISABLE_HS400 BIT(2)
159160 };
160161
161162 struct window {
@@ -765,6 +766,7 @@ static int sdhci_am654_init(struct sdhci_host *host) · 603 unmodified lines
765766 {
766767 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
767768 struct sdhci_am654_data *sdhci_am654 = sdhci_pltfm_priv(pltfm_host);
769+ struct device *dev = mmc_dev(host->mmc);
768770 u32 ctl_cfg_2 = 0;
769771 u32 mask;
770772 u32 val;
@@ -820,6 +822,12 @@ static int sdhci_am654_init(struct sdhci_host *host) · 49 unmodified lines
820822 if (ret)
821823 goto err_cleanup_host;
822824
825+ if (sdhci_am654->quirks & SDHCI_AM654_QUIRK_DISABLE_HS400 &&
826+ host->mmc->caps2 & (MMC_CAP2_HS400 | MMC_CAP2_HS400_ES)) {
827+ dev_info(dev, "HS400 mode not supported on this silicon revision, disabling it\n");
828+ host->mmc->caps2 &= ~(MMC_CAP2_HS400 | MMC_CAP2_HS400_ES);
829+ }
830+
823831 ret = __sdhci_add_host(host);
824832 if (ret)
825833 goto err_cleanup_host;
@@ -883,6 +891,12 @@ static int sdhci_am654_get_of_property(struct platform_device *pdev, · 57 unmodified lines
883891 return 0;
884892 }
885893
894+static const struct soc_device_attribute sdhci_am654_descope_hs400[] = {
895+ { .family = "AM62PX", .revision = "SR1.0" },
896+ { .family = "AM62PX", .revision = "SR1.1" },
897+ { /* sentinel */ }
898+};
899+
886900 static const struct of_device_id sdhci_am654_of_match[] = {
887901 {
888902 .compatible = "ti,am654-sdhci-5.1",
@@ -970,6 +984,10 @@ static int sdhci_am654_probe(struct platform_device *pdev) · 81 unmodified lines
970984 if (ret)
971985 return dev_err_probe(dev, ret, "parsing dt failed\n");
972986
987+ soc = soc_device_match(sdhci_am654_descope_hs400);
988+ if (soc)
989+ sdhci_am654->quirks |= SDHCI_AM654_QUIRK_DISABLE_HS400;
990+
973991 host->mmc_host_ops.start_signal_voltage_switch = sdhci_am654_start_signal_voltage_switch;
974992 host->mmc_host_ops.execute_tuning = sdhci_am654_execute_tuning;
975993
drivers/most/core.c+1−1
@@ -538,8 +538,8 @@ static struct most_channel *get_channel(char *mdev, char *mdev_ch) · 537 unmodified lines
538538 dev = bus_find_device_by_name(&mostbus, NULL, mdev);
539539 if (!dev)
540540 return NULL;
541− put_device(dev);
542541 iface = dev_get_drvdata(dev);
542+ put_device(dev);
543543 list_for_each_entry_safe(c, tmp, &iface->p->channel_list, list) {
544544 if (!strcmp(dev_name(&c->dev), mdev_ch))
545545 return c;
drivers/net/ethernet/broadcom/bnxt/bnxt.c+30−6
@@ -8022,7 +8022,8 @@ static int __bnxt_reserve_rings(struct bnxt *bp) · 8021 unmodified lines
80228022 }
80238023 rx_rings = min_t(int, rx_rings, hwr.grp);
80248024 hwr.cp = min_t(int, hwr.cp, bp->cp_nr_rings);
8025− if (hwr.stat > bnxt_get_ulp_stat_ctxs(bp))
8025+ if (bnxt_ulp_registered(bp->edev) &&
8026+ hwr.stat > bnxt_get_ulp_stat_ctxs(bp))
80268027 hwr.stat -= bnxt_get_ulp_stat_ctxs(bp);
80278028 hwr.cp = min_t(int, hwr.cp, hwr.stat);
80288029 rc = bnxt_trim_rings(bp, &rx_rings, &hwr.tx, hwr.cp, sh);
@@ -8030,6 +8031,11 @@ static int __bnxt_reserve_rings(struct bnxt *bp) · 1 unmodified line
80308031 hwr.rx = rx_rings << 1;
80318032 tx_cp = bnxt_num_tx_to_cp(bp, hwr.tx);
80328033 hwr.cp = sh ? max_t(int, tx_cp, rx_rings) : tx_cp + rx_rings;
8034+ if (hwr.tx != bp->tx_nr_rings) {
8035+ netdev_warn(bp->dev,
8036+ "Able to reserve only %d out of %d requested TX rings\n",
8037+ hwr.tx, bp->tx_nr_rings);
8038+ }
80338039 bp->tx_nr_rings = hwr.tx;
80348040
80358041 /* If we cannot reserve all the RX rings, reset the RSS map only
@@ -12857,6 +12863,17 @@ static int bnxt_set_xps_mapping(struct bnxt *bp) · 4821 unmodified lines
1285712863 return rc;
1285812864 }
1285912865
12866+static int bnxt_tx_nr_rings(struct bnxt *bp)
12867+{
12868+ return bp->num_tc ? bp->tx_nr_rings_per_tc * bp->num_tc :
12869+ bp->tx_nr_rings_per_tc;
12870+}
12871+
12872+static int bnxt_tx_nr_rings_per_tc(struct bnxt *bp)
12873+{
12874+ return bp->num_tc ? bp->tx_nr_rings / bp->num_tc : bp->tx_nr_rings;
12875+}
12876+
1286012877 static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
1286112878 {
1286212879 int rc = 0;
@@ -12874,6 +12891,13 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init) · 11 unmodified lines
1287412891 if (rc)
1287512892 return rc;
1287612893
12894+ /* Make adjustments if reserved TX rings are less than requested */
12895+ bp->tx_nr_rings -= bp->tx_nr_rings_xdp;
12896+ bp->tx_nr_rings_per_tc = bnxt_tx_nr_rings_per_tc(bp);
12897+ if (bp->tx_nr_rings_xdp) {
12898+ bp->tx_nr_rings_xdp = bp->tx_nr_rings_per_tc;
12899+ bp->tx_nr_rings += bp->tx_nr_rings_xdp;
12900+ }
1287712901 rc = bnxt_alloc_mem(bp, irq_re_init);
1287812902 if (rc) {
1287912903 netdev_err(bp->dev, "bnxt_alloc_mem err: %x\n", rc);
@@ -16329,7 +16353,7 @@ static void bnxt_trim_dflt_sh_rings(struct bnxt *bp) · 3449 unmodified lines
1632916353 bp->cp_nr_rings = min_t(int, bp->tx_nr_rings_per_tc, bp->rx_nr_rings);
1633016354 bp->rx_nr_rings = bp->cp_nr_rings;
1633116355 bp->tx_nr_rings_per_tc = bp->cp_nr_rings;
16332− bp->tx_nr_rings = bp->tx_nr_rings_per_tc;
16356+ bp->tx_nr_rings = bnxt_tx_nr_rings(bp);
1633316357 }
1633416358
1633516359 static int bnxt_set_dflt_rings(struct bnxt *bp, bool sh)
@@ -16361,7 +16385,7 @@ static int bnxt_set_dflt_rings(struct bnxt *bp, bool sh) · 25 unmodified lines
1636116385 bnxt_trim_dflt_sh_rings(bp);
1636216386 else
1636316387 bp->cp_nr_rings = bp->tx_nr_rings_per_tc + bp->rx_nr_rings;
16364− bp->tx_nr_rings = bp->tx_nr_rings_per_tc;
16388+ bp->tx_nr_rings = bnxt_tx_nr_rings(bp);
1636516389
1636616390 avail_msix = bnxt_get_max_func_irqs(bp) - bp->cp_nr_rings;
1636716391 if (avail_msix >= BNXT_MIN_ROCE_CP_RINGS) {
@@ -16374,7 +16398,7 @@ static int bnxt_set_dflt_rings(struct bnxt *bp, bool sh) · 6 unmodified lines
1637416398 rc = __bnxt_reserve_rings(bp);
1637516399 if (rc && rc != -ENODEV)
1637616400 netdev_warn(bp->dev, "Unable to reserve tx rings\n");
16377− bp->tx_nr_rings_per_tc = bp->tx_nr_rings;
16401+ bp->tx_nr_rings_per_tc = bnxt_tx_nr_rings_per_tc(bp);
1637816402 if (sh)
1637916403 bnxt_trim_dflt_sh_rings(bp);
1638016404
@@ -16383,7 +16407,7 @@ static int bnxt_set_dflt_rings(struct bnxt *bp, bool sh) · 2 unmodified lines
1638316407 rc = __bnxt_reserve_rings(bp);
1638416408 if (rc && rc != -ENODEV)
1638516409 netdev_warn(bp->dev, "2nd rings reservation failed.\n");
16386− bp->tx_nr_rings_per_tc = bp->tx_nr_rings;
16410+ bp->tx_nr_rings_per_tc = bnxt_tx_nr_rings_per_tc(bp);
1638716411 }
1638816412 if (BNXT_CHIP_TYPE_NITRO_A0(bp)) {
1638916413 bp->rx_nr_rings++;
@@ -16417,7 +16441,7 @@ static int bnxt_init_dflt_ring_mode(struct bnxt *bp) · 27 unmodified lines
1641716441 if (rc)
1641816442 goto init_dflt_ring_err;
1641916443
16420− bp->tx_nr_rings_per_tc = bp->tx_nr_rings;
16444+ bp->tx_nr_rings_per_tc = bnxt_tx_nr_rings_per_tc(bp);
1642116445
1642216446 bnxt_set_dflt_rfs(bp);
1642316447
drivers/net/ethernet/cadence/macb_main.c+4−7
@@ -3091,7 +3091,7 @@ static void gem_update_stats(struct macb *bp) · 3090 unmodified lines
30913091 /* Add GEM_OCTTXH, GEM_OCTRXH */
30923092 val = bp->macb_reg_readl(bp, offset + 4);
30933093 bp->ethtool_stats[i] += ((u64)val) << 32;
3094− *(p++) += ((u64)val) << 32;
3094+ *p += ((u64)val) << 32;
30953095 }
30963096 }
30973097
@@ -5636,19 +5636,16 @@ static void macb_remove(struct platform_device *pdev) · 2538 unmodified lines
56365636
56375637 if (dev) {
56385638 bp = netdev_priv(dev);
5639+ unregister_netdev(dev);
56395640 phy_exit(bp->sgmii_phy);
56405641 mdiobus_unregister(bp->mii_bus);
56415642 mdiobus_free(bp->mii_bus);
56425643
5643− unregister_netdev(dev);
5644+ device_set_wakeup_enable(&bp->pdev->dev, 0);
56445645 cancel_work_sync(&bp->hresp_err_bh_work);
56455646 pm_runtime_disable(&pdev->dev);
56465647 pm_runtime_dont_use_autosuspend(&pdev->dev);
5647− if (!pm_runtime_suspended(&pdev->dev)) {
5648− macb_clks_disable(bp->pclk, bp->hclk, bp->tx_clk,
5649− bp->rx_clk, bp->tsu_clk);
5650− pm_runtime_set_suspended(&pdev->dev);
5651− }
5648+ pm_runtime_set_suspended(&pdev->dev);
56525649 phylink_destroy(bp->phylink);
56535650 free_netdev(dev);
56545651 }
drivers/net/ethernet/dlink/dl2k.c+1−1
@@ -1099,7 +1099,7 @@ get_stats (struct net_device *dev) · 1098 unmodified lines
10991099 dev->stats.rx_bytes += dr32(OctetRcvOk);
11001100 dev->stats.tx_bytes += dr32(OctetXmtOk);
11011101
1102− dev->stats.multicast = dr32(McstFramesRcvdOk);
1102+ dev->stats.multicast += dr32(McstFramesRcvdOk);
11031103 dev->stats.collisions += dr32(SingleColFrames)
11041104 + dr32(MultiColFrames);
11051105
drivers/net/ethernet/intel/ice/ice.h+1−0
@@ -511,6 +511,7 @@ enum ice_pf_flags { · 510 unmodified lines
511511 ICE_FLAG_LINK_LENIENT_MODE_ENA,
512512 ICE_FLAG_PLUG_AUX_DEV,
513513 ICE_FLAG_UNPLUG_AUX_DEV,
514+ ICE_FLAG_AUX_DEV_CREATED,
514515 ICE_FLAG_MTU_CHANGED,
515516 ICE_FLAG_GNSS, /* GNSS successfully initialized */
516517 ICE_FLAG_DPLL, /* SyncE/PTP dplls initialized */
drivers/net/ethernet/intel/ice/ice_adapter.c+38−11
@@ -13,16 +13,45 @@ · 12 unmodified lines
1313 static DEFINE_XARRAY(ice_adapters);
1414 static DEFINE_MUTEX(ice_adapters_mutex);
1515
16−static unsigned long ice_adapter_index(u64 dsn)
16+#define ICE_ADAPTER_FIXED_INDEX BIT_ULL(63)
17+
18+#define ICE_ADAPTER_INDEX_E825C \
19+ (ICE_DEV_ID_E825C_BACKPLANE | ICE_ADAPTER_FIXED_INDEX)
20+
21+static u64 ice_adapter_index(struct pci_dev *pdev)
1722 {
23+ switch (pdev->device) {
24+ case ICE_DEV_ID_E825C_BACKPLANE:
25+ case ICE_DEV_ID_E825C_QSFP:
26+ case ICE_DEV_ID_E825C_SFP:
27+ case ICE_DEV_ID_E825C_SGMII:
28+ /* E825C devices have multiple NACs which are connected to the
29+ * same clock source, and which must share the same
30+ * ice_adapter structure. We can't use the serial number since
31+ * each NAC has its own NVM generated with its own unique
32+ * Device Serial Number. Instead, rely on the embedded nature
33+ * of the E825C devices, and use a fixed index. This relies on
34+ * the fact that all E825C physical functions in a given
35+ * system are part of the same overall device.
36+ */
37+ return ICE_ADAPTER_INDEX_E825C;
38+ default:
39+ return pci_get_dsn(pdev) & ~ICE_ADAPTER_FIXED_INDEX;
40+ }
41+}
42+
43+static unsigned long ice_adapter_xa_index(struct pci_dev *pdev)
44+{
45+ u64 index = ice_adapter_index(pdev);
46+
1847 #if BITS_PER_LONG == 64
19− return dsn;
48+ return index;
2049 #else
21− return (u32)dsn ^ (u32)(dsn >> 32);
50+ return (u32)index ^ (u32)(index >> 32);
2251 #endif
2352 }
2453
25−static struct ice_adapter *ice_adapter_new(u64 dsn)
54+static struct ice_adapter *ice_adapter_new(struct pci_dev *pdev)
2655 {
2756 struct ice_adapter *adapter;
2857
@@ -30,7 +59,7 @@ static struct ice_adapter *ice_adapter_new(u64 dsn) · 1 unmodified line
3059 if (!adapter)
3160 return NULL;
3261
33− adapter->device_serial_number = dsn;
62+ adapter->index = ice_adapter_index(pdev);
3463 spin_lock_init(&adapter->ptp_gltsyn_time_lock);
3564 spin_lock_init(&adapter->txq_ctx_lock);
3665 refcount_set(&adapter->refcount, 1);
@@ -64,24 +93,23 @@ static void ice_adapter_free(struct ice_adapter *adapter) · 27 unmodified lines
6493 */
6594 struct ice_adapter *ice_adapter_get(struct pci_dev *pdev)
6695 {
67− u64 dsn = pci_get_dsn(pdev);
6896 struct ice_adapter *adapter;
6997 unsigned long index;
7098 int err;
7199
72− index = ice_adapter_index(dsn);
100+ index = ice_adapter_xa_index(pdev);
73101 scoped_guard(mutex, &ice_adapters_mutex) {
74102 err = xa_insert(&ice_adapters, index, NULL, GFP_KERNEL);
75103 if (err == -EBUSY) {
76104 adapter = xa_load(&ice_adapters, index);
77105 refcount_inc(&adapter->refcount);
78− WARN_ON_ONCE(adapter->device_serial_number != dsn);
106+ WARN_ON_ONCE(adapter->index != ice_adapter_index(pdev));
79107 return adapter;
80108 }
81109 if (err)
82110 return ERR_PTR(err);
83111
84− adapter = ice_adapter_new(dsn);
112+ adapter = ice_adapter_new(pdev);
85113 if (!adapter)
86114 return ERR_PTR(-ENOMEM);
87115 xa_store(&ice_adapters, index, adapter, GFP_KERNEL);
@@ -100,11 +128,10 @@ struct ice_adapter *ice_adapter_get(struct pci_dev *pdev) · 12 unmodified lines
100128 */
101129 void ice_adapter_put(struct pci_dev *pdev)
102130 {
103− u64 dsn = pci_get_dsn(pdev);
104131 struct ice_adapter *adapter;
105132 unsigned long index;
106133
107− index = ice_adapter_index(dsn);
134+ index = ice_adapter_xa_index(pdev);
108135 scoped_guard(mutex, &ice_adapters_mutex) {
109136 adapter = xa_load(&ice_adapters, index);
110137 if (WARN_ON(!adapter))
drivers/net/ethernet/intel/ice/ice_adapter.h+2−2
@@ -33,7 +33,7 @@ struct ice_port_list { · 32 unmodified lines
3333 * @txq_ctx_lock: Spinlock protecting access to the GLCOMM_QTX_CNTX_CTL register
3434 * @ctrl_pf: Control PF of the adapter
3535 * @ports: Ports list
36− * @device_serial_number: DSN cached for collision detection on 32bit systems
36+ * @index: 64-bit index cached for collision detection on 32bit systems
3737 */
3838 struct ice_adapter {
3939 refcount_t refcount;
@@ -44,7 +44,7 @@ struct ice_adapter { · 4 unmodified lines
4444
4545 struct ice_pf *ctrl_pf;
4646 struct ice_port_list ports;
47− u64 device_serial_number;
47+ u64 index;
4848 };
4949
5050 struct ice_adapter *ice_adapter_get(struct pci_dev *pdev);
drivers/net/ethernet/intel/ice/ice_ddp.c+32−12
@@ -2377,7 +2377,13 @@ ice_get_set_tx_topo(struct ice_hw *hw, u8 *buf, u16 buf_size, · 2376 unmodified lines
23772377 * The function will apply the new Tx topology from the package buffer
23782378 * if available.
23792379 *
2380− * Return: zero when update was successful, negative values otherwise.
2380+ * Return:
2381+ * * 0 - Successfully applied topology configuration.
2382+ * * -EBUSY - Failed to acquire global configuration lock.
2383+ * * -EEXIST - Topology configuration has already been applied.
2384+ * * -EIO - Unable to apply topology configuration.
2385+ * * -ENODEV - Failed to re-initialize device after applying configuration.
2386+ * * Other negative error codes indicate unexpected failures.
23812387 */
23822388 int ice_cfg_tx_topo(struct ice_hw *hw, const void *buf, u32 len)
23832389 {
@@ -2410,7 +2416,7 @@ int ice_cfg_tx_topo(struct ice_hw *hw, const void *buf, u32 len) · 26 unmodified lines
24102416
24112417 if (status) {
24122418 ice_debug(hw, ICE_DBG_INIT, "Get current topology is failed\n");
2413− return status;
2419+ return -EIO;
24142420 }
24152421
24162422 /* Is default topology already applied ? */
@@ -2497,31 +2503,45 @@ update_topo: · 80 unmodified lines
24972503 ICE_GLOBAL_CFG_LOCK_TIMEOUT);
24982504 if (status) {
24992505 ice_debug(hw, ICE_DBG_INIT, "Failed to acquire global lock\n");
2500− return status;
2506+ return -EBUSY;
25012507 }
25022508
25032509 /* Check if reset was triggered already. */
25042510 reg = rd32(hw, GLGEN_RSTAT);
25052511 if (reg & GLGEN_RSTAT_DEVSTATE_M) {
2506− /* Reset is in progress, re-init the HW again */
25072512 ice_debug(hw, ICE_DBG_INIT, "Reset is in progress. Layer topology might be applied already\n");
25082513 ice_check_reset(hw);
2509− return 0;
2514+ /* Reset is in progress, re-init the HW again */
2515+ goto reinit_hw;
25102516 }
25112517
25122518 /* Set new topology */
25132519 status = ice_get_set_tx_topo(hw, new_topo, size, NULL, NULL, true);
25142520 if (status) {
2515− ice_debug(hw, ICE_DBG_INIT, "Failed setting Tx topology\n");
2516− return status;
2521+ ice_debug(hw, ICE_DBG_INIT, "Failed to set Tx topology, status %pe\n",
2522+ ERR_PTR(status));
2523+ /* only report -EIO here as the caller checks the error value
2524+ * and reports an informational error message informing that
2525+ * the driver failed to program Tx topology.
2526+ */
2527+ status = -EIO;
25172528 }
25182529
2519− /* New topology is updated, delay 1 second before issuing the CORER */
2530+ /* Even if Tx topology config failed, we need to CORE reset here to
2531+ * clear the global configuration lock. Delay 1 second to allow
2532+ * hardware to settle then issue a CORER
2533+ */
25202534 msleep(1000);
25212535 ice_reset(hw, ICE_RESET_CORER);
2522− /* CORER will clear the global lock, so no explicit call
2523− * required for release.
2524− */
2536+ ice_check_reset(hw);
2537+
2538+reinit_hw:
2539+ /* Since we triggered a CORER, re-initialize hardware */
2540+ ice_deinit_hw(hw);
2541+ if (ice_init_hw(hw)) {
2542+ ice_debug(hw, ICE_DBG_INIT, "Failed to re-init hardware after setting Tx topology\n");
2543+ return -ENODEV;
2544+ }
25252545
2526− return 0;
2546+ return status;
25272547 }
drivers/net/ethernet/intel/ice/ice_idc.c+6−4
@@ -336,6 +336,7 @@ int ice_plug_aux_dev(struct ice_pf *pf) · 335 unmodified lines
336336 mutex_lock(&pf->adev_mutex);
337337 cdev->adev = adev;
338338 mutex_unlock(&pf->adev_mutex);
339+ set_bit(ICE_FLAG_AUX_DEV_CREATED, pf->flags);
339340
340341 return 0;
341342 }
@@ -347,15 +348,16 @@ void ice_unplug_aux_dev(struct ice_pf *pf) · 5 unmodified lines
347348 {
348349 struct auxiliary_device *adev;
349350
351+ if (!test_and_clear_bit(ICE_FLAG_AUX_DEV_CREATED, pf->flags))
352+ return;
353+
350354 mutex_lock(&pf->adev_mutex);
351355 adev = pf->cdev_info->adev;
352356 pf->cdev_info->adev = NULL;
353357 mutex_unlock(&pf->adev_mutex);
354358
355− if (adev) {
356− auxiliary_device_delete(adev);
357− auxiliary_device_uninit(adev);
358− }
359+ auxiliary_device_delete(adev);
360+ auxiliary_device_uninit(adev);
359361 }
360362
361363 /**
drivers/net/ethernet/intel/ice/ice_main.c+11−5
@@ -4536,17 +4536,23 @@ ice_init_tx_topology(struct ice_hw *hw, const struct firmware *firmware) · 4535 unmodified lines
45364536 dev_info(dev, "Tx scheduling layers switching feature disabled\n");
45374537 else
45384538 dev_info(dev, "Tx scheduling layers switching feature enabled\n");
4539− /* if there was a change in topology ice_cfg_tx_topo triggered
4540− * a CORER and we need to re-init hw
4539+ return 0;
4540+ } else if (err == -ENODEV) {
4541+ /* If we failed to re-initialize the device, we can no longer
4542+ * continue loading.
45414543 */
4542− ice_deinit_hw(hw);
4543− err = ice_init_hw(hw);
4544−
4544+ dev_warn(dev, "Failed to initialize hardware after applying Tx scheduling configuration.\n");
45454545 return err;
45464546 } else if (err == -EIO) {
45474547 dev_info(dev, "DDP package does not support Tx scheduling layers switching feature - please update to the latest DDP package and try again\n");
4548+ return 0;
4549+ } else if (err == -EEXIST) {
4550+ return 0;
45484551 }
45494552
4553+ /* Do not treat this as a fatal error. */
4554+ dev_info(dev, "Failed to apply Tx scheduling configuration, err %pe\n",
4555+ ERR_PTR(err));
45504556 return 0;
45514557 }
45524558
drivers/net/ethernet/intel/ice/ice_txrx.c+1−1
@@ -1352,7 +1352,7 @@ construct_skb: · 1351 unmodified lines
13521352 skb = ice_construct_skb(rx_ring, xdp);
13531353 /* exit if we failed to retrieve a buffer */
13541354 if (!skb) {
1355− rx_ring->ring_stats->rx_stats.alloc_page_failed++;
1355+ rx_ring->ring_stats->rx_stats.alloc_buf_failed++;
13561356 xdp_verdict = ICE_XDP_CONSUMED;
13571357 }
13581358 ice_put_rx_mbuf(rx_ring, xdp, &xdp_xmit, ntc, xdp_verdict);
drivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c+57−4
@@ -179,6 +179,58 @@ static int idpf_tx_singleq_csum(struct sk_buff *skb, · 178 unmodified lines
179179 return 1;
180180 }
181181
182+/**
183+ * idpf_tx_singleq_dma_map_error - handle TX DMA map errors
184+ * @txq: queue to send buffer on
185+ * @skb: send buffer
186+ * @first: original first buffer info buffer for packet
187+ * @idx: starting point on ring to unwind
188+ */
189+static void idpf_tx_singleq_dma_map_error(struct idpf_tx_queue *txq,
190+ struct sk_buff *skb,
191+ struct idpf_tx_buf *first, u16 idx)
192+{
193+ struct libeth_sq_napi_stats ss = { };
194+ struct libeth_cq_pp cp = {
195+ .dev = txq->dev,
196+ .ss = &ss,
197+ };
198+
199+ u64_stats_update_begin(&txq->stats_sync);
200+ u64_stats_inc(&txq->q_stats.dma_map_errs);
201+ u64_stats_update_end(&txq->stats_sync);
202+
203+ /* clear dma mappings for failed tx_buf map */
204+ for (;;) {
205+ struct idpf_tx_buf *tx_buf;
206+
207+ tx_buf = &txq->tx_buf[idx];
208+ libeth_tx_complete(tx_buf, &cp);
209+ if (tx_buf == first)
210+ break;
211+ if (idx == 0)
212+ idx = txq->desc_count;
213+ idx--;
214+ }
215+
216+ if (skb_is_gso(skb)) {
217+ union idpf_tx_flex_desc *tx_desc;
218+
219+ /* If we failed a DMA mapping for a TSO packet, we will have
220+ * used one additional descriptor for a context
221+ * descriptor. Reset that here.
222+ */
223+ tx_desc = &txq->flex_tx[idx];
224+ memset(tx_desc, 0, sizeof(*tx_desc));
225+ if (idx == 0)
226+ idx = txq->desc_count;
227+ idx--;
228+ }
229+
230+ /* Update tail in case netdev_xmit_more was previously true */
231+ idpf_tx_buf_hw_update(txq, idx, false);
232+}
233+
182234 /**
183235 * idpf_tx_singleq_map - Build the Tx base descriptor
184236 * @tx_q: queue to send buffer on
@@ -219,8 +271,9 @@ static void idpf_tx_singleq_map(struct idpf_tx_queue *tx_q, · 34 unmodified lines
219271 for (frag = &skb_shinfo(skb)->frags[0];; frag++) {
220272 unsigned int max_data = IDPF_TX_MAX_DESC_DATA_ALIGNED;
221273
222− if (dma_mapping_error(tx_q->dev, dma))
223− return idpf_tx_dma_map_error(tx_q, skb, first, i);
274+ if (unlikely(dma_mapping_error(tx_q->dev, dma)))
275+ return idpf_tx_singleq_dma_map_error(tx_q, skb,
276+ first, i);
224277
225278 /* record length, and DMA address */
226279 dma_unmap_len_set(tx_buf, len, size);
@@ -362,11 +415,11 @@ netdev_tx_t idpf_tx_singleq_frame(struct sk_buff *skb, · 135 unmodified lines
362415 {
363416 struct idpf_tx_offload_params offload = { };
364417 struct idpf_tx_buf *first;
418+ u32 count, buf_count = 1;
365419 int csum, tso, needed;
366− unsigned int count;
367420 __be16 protocol;
368421
369− count = idpf_tx_desc_count_required(tx_q, skb);
422+ count = idpf_tx_res_count_required(tx_q, skb, &buf_count);
370423 if (unlikely(!count))
371424 return idpf_tx_drop_skb(tx_q, skb);
372425
drivers/net/ethernet/intel/idpf/idpf_txrx.c+266−457
@@ -8,12 +8,7 @@ · 7 unmodified lines
88 #include "idpf_ptp.h"
99 #include "idpf_virtchnl.h"
1010
11−struct idpf_tx_stash {
12− struct hlist_node hlist;
13− struct libeth_sqe buf;
14−};
15−
16−#define idpf_tx_buf_compl_tag(buf) (*(u32 *)&(buf)->priv)
11+#define idpf_tx_buf_next(buf) (*(u32 *)&(buf)->priv)
1712 LIBETH_SQE_CHECK_PRIV(u32);
1813
1914 /**
@@ -39,36 +34,6 @@ static bool idpf_chk_linearize(const struct sk_buff *skb, · 19 unmodified lines
3934 return true;
4035 }
4136
42−/**
43− * idpf_buf_lifo_push - push a buffer pointer onto stack
44− * @stack: pointer to stack struct
45− * @buf: pointer to buf to push
46− *
47− * Returns 0 on success, negative on failure
48− **/
49−static int idpf_buf_lifo_push(struct idpf_buf_lifo *stack,
50− struct idpf_tx_stash *buf)
51−{
52− if (unlikely(stack->top == stack->size))
53− return -ENOSPC;
54−
55− stack->bufs[stack->top++] = buf;
56−
57− return 0;
58−}
59−
60−/**
61− * idpf_buf_lifo_pop - pop a buffer pointer from stack
62− * @stack: pointer to stack struct
63− **/
64−static struct idpf_tx_stash *idpf_buf_lifo_pop(struct idpf_buf_lifo *stack)
65−{
66− if (unlikely(!stack->top))
67− return NULL;
68−
69− return stack->bufs[--stack->top];
70−}
71−
7237 /**
7338 * idpf_tx_timeout - Respond to a Tx Hang
7439 * @netdev: network interface device structure
@@ -97,52 +62,22 @@ void idpf_tx_timeout(struct net_device *netdev, unsigned int txqueue) · 22 unmodified lines
9762 static void idpf_tx_buf_rel_all(struct idpf_tx_queue *txq)
9863 {
9964 struct libeth_sq_napi_stats ss = { };
100− struct idpf_buf_lifo *buf_stack;
101− struct idpf_tx_stash *stash;
10265 struct libeth_cq_pp cp = {
10366 .dev = txq->dev,
10467 .ss = &ss,
10568 };
106− struct hlist_node *tmp;
107− u32 i, tag;
69+ u32 i;
10870
10971 /* Buffers already cleared, nothing to do */
11072 if (!txq->tx_buf)
11173 return;
11274
11375 /* Free all the Tx buffer sk_buffs */
114− for (i = 0; i < txq->desc_count; i++)
76+ for (i = 0; i < txq->buf_pool_size; i++)
11577 libeth_tx_complete(&txq->tx_buf[i], &cp);
11678
11779 kfree(txq->tx_buf);
11880 txq->tx_buf = NULL;
119−
120− if (!idpf_queue_has(FLOW_SCH_EN, txq))
121− return;
122−
123− buf_stack = &txq->stash->buf_stack;
124− if (!buf_stack->bufs)
125− return;
126−
127− /*
128− * If a Tx timeout occurred, there are potentially still bufs in the
129− * hash table, free them here.
130− */
131− hash_for_each_safe(txq->stash->sched_buf_hash, tag, tmp, stash,
132− hlist) {
133− if (!stash)
134− continue;
135−
136− libeth_tx_complete(&stash->buf, &cp);
137− hash_del(&stash->hlist);
138− idpf_buf_lifo_push(buf_stack, stash);
139− }
140−
141− for (i = 0; i < buf_stack->size; i++)
142− kfree(buf_stack->bufs[i]);
143−
144− kfree(buf_stack->bufs);
145− buf_stack->bufs = NULL;
14681 }
14782
14883 /**
@@ -159,6 +94,9 @@ static void idpf_tx_desc_rel(struct idpf_tx_queue *txq) · 10 unmodified lines
15994 if (!txq->desc_ring)
16095 return;
16196
97+ if (txq->refillq)
98+ kfree(txq->refillq->ring);
99+
162100 dmam_free_coherent(txq->dev, txq->size, txq->desc_ring, txq->dma);
163101 txq->desc_ring = NULL;
164102 txq->next_to_use = 0;
@@ -215,41 +153,18 @@ static void idpf_tx_desc_rel_all(struct idpf_vport *vport) · 50 unmodified lines
215153 */
216154 static int idpf_tx_buf_alloc_all(struct idpf_tx_queue *tx_q)
217155 {
218− struct idpf_buf_lifo *buf_stack;
219− int buf_size;
220− int i;
221−
222156 /* Allocate book keeping buffers only. Buffers to be supplied to HW
223157 * are allocated by kernel network stack and received as part of skb
224158 */
225− buf_size = sizeof(struct idpf_tx_buf) * tx_q->desc_count;
226− tx_q->tx_buf = kzalloc(buf_size, GFP_KERNEL);
159+ if (idpf_queue_has(FLOW_SCH_EN, tx_q))
160+ tx_q->buf_pool_size = U16_MAX;
161+ else
162+ tx_q->buf_pool_size = tx_q->desc_count;
163+ tx_q->tx_buf = kcalloc(tx_q->buf_pool_size, sizeof(*tx_q->tx_buf),
164+ GFP_KERNEL);
227165 if (!tx_q->tx_buf)
228166 return -ENOMEM;
229167
230− if (!idpf_queue_has(FLOW_SCH_EN, tx_q))
231− return 0;
232−
233− buf_stack = &tx_q->stash->buf_stack;
234−
235− /* Initialize tx buf stack for out-of-order completions if
236− * flow scheduling offload is enabled
237− */
238− buf_stack->bufs = kcalloc(tx_q->desc_count, sizeof(*buf_stack->bufs),
239− GFP_KERNEL);
240− if (!buf_stack->bufs)
241− return -ENOMEM;
242−
243− buf_stack->size = tx_q->desc_count;
244− buf_stack->top = tx_q->desc_count;
245−
246− for (i = 0; i < tx_q->desc_count; i++) {
247− buf_stack->bufs[i] = kzalloc(sizeof(*buf_stack->bufs[i]),
248− GFP_KERNEL);
249− if (!buf_stack->bufs[i])
250− return -ENOMEM;
251− }
252−
253168 return 0;
254169 }
255170
@@ -264,6 +179,7 @@ static int idpf_tx_desc_alloc(const struct idpf_vport *vport, · 8 unmodified lines
264179 struct idpf_tx_queue *tx_q)
265180 {
266181 struct device *dev = tx_q->dev;
182+ struct idpf_sw_queue *refillq;
267183 int err;
268184
269185 err = idpf_tx_buf_alloc_all(tx_q);
@@ -287,6 +203,31 @@ static int idpf_tx_desc_alloc(const struct idpf_vport *vport, · 17 unmodified lines
287203 tx_q->next_to_clean = 0;
288204 idpf_queue_set(GEN_CHK, tx_q);
289205
206+ if (!idpf_queue_has(FLOW_SCH_EN, tx_q))
207+ return 0;
208+
209+ refillq = tx_q->refillq;
210+ refillq->desc_count = tx_q->buf_pool_size;
211+ refillq->ring = kcalloc(refillq->desc_count, sizeof(u32),
212+ GFP_KERNEL);
213+ if (!refillq->ring) {
214+ err = -ENOMEM;
215+ goto err_alloc;
216+ }
217+
218+ for (unsigned int i = 0; i < refillq->desc_count; i++)
219+ refillq->ring[i] =
220+ FIELD_PREP(IDPF_RFL_BI_BUFID_M, i) |
221+ FIELD_PREP(IDPF_RFL_BI_GEN_M,
222+ idpf_queue_has(GEN_CHK, refillq));
223+
224+ /* Go ahead and flip the GEN bit since this counts as filling
225+ * up the ring, i.e. we already ring wrapped.
226+ */
227+ idpf_queue_change(GEN_CHK, refillq);
228+
229+ tx_q->last_re = tx_q->desc_count - IDPF_TX_SPLITQ_RE_MIN_GAP;
230+
290231 return 0;
291232
292233 err_alloc:
@@ -337,8 +278,6 @@ static int idpf_tx_desc_alloc_all(struct idpf_vport *vport) · 44 unmodified lines
337278 for (i = 0; i < vport->num_txq_grp; i++) {
338279 for (j = 0; j < vport->txq_grps[i].num_txq; j++) {
339280 struct idpf_tx_queue *txq = vport->txq_grps[i].txqs[j];
340− u8 gen_bits = 0;
341− u16 bufidx_mask;
342281
343282 err = idpf_tx_desc_alloc(vport, txq);
344283 if (err) {
@@ -347,34 +286,6 @@ static int idpf_tx_desc_alloc_all(struct idpf_vport *vport) · 2 unmodified lines
347286 i);
348287 goto err_out;
349288 }
350−
351− if (!idpf_is_queue_model_split(vport->txq_model))
352− continue;
353−
354− txq->compl_tag_cur_gen = 0;
355−
356− /* Determine the number of bits in the bufid
357− * mask and add one to get the start of the
358− * generation bits
359− */
360− bufidx_mask = txq->desc_count - 1;
361− while (bufidx_mask >> 1) {
362− txq->compl_tag_gen_s++;
363− bufidx_mask = bufidx_mask >> 1;
364− }
365− txq->compl_tag_gen_s++;
366−
367− gen_bits = IDPF_TX_SPLITQ_COMPL_TAG_WIDTH -
368− txq->compl_tag_gen_s;
369− txq->compl_tag_gen_max = GETMAXVAL(gen_bits);
370−
371− /* Set bufid mask based on location of first
372− * gen bit; it cannot simply be the descriptor
373− * ring size-1 since we can have size values
374− * where not all of those bits are set.
375− */
376− txq->compl_tag_bufid_m =
377− GETMAXVAL(txq->compl_tag_gen_s);
378289 }
379290
380291 if (!idpf_is_queue_model_split(vport->txq_model))
@@ -623,18 +534,18 @@ static int idpf_rx_hdr_buf_alloc_all(struct idpf_buf_queue *bufq) · 242 unmodified lines
623534 }
624535
625536 /**
626− * idpf_rx_post_buf_refill - Post buffer id to refill queue
537+ * idpf_post_buf_refill - Post buffer id to refill queue
627538 * @refillq: refill queue to post to
628539 * @buf_id: buffer id to post
629540 */
630−static void idpf_rx_post_buf_refill(struct idpf_sw_queue *refillq, u16 buf_id)
541+static void idpf_post_buf_refill(struct idpf_sw_queue *refillq, u16 buf_id)
631542 {
632543 u32 nta = refillq->next_to_use;
633544
634545 /* store the buffer ID and the SW maintained GEN bit to the refillq */
635546 refillq->ring[nta] =
636− FIELD_PREP(IDPF_RX_BI_BUFID_M, buf_id) |
637− FIELD_PREP(IDPF_RX_BI_GEN_M,
547+ FIELD_PREP(IDPF_RFL_BI_BUFID_M, buf_id) |
548+ FIELD_PREP(IDPF_RFL_BI_GEN_M,
638549 idpf_queue_has(GEN_CHK, refillq));
639550
640551 if (unlikely(++nta == refillq->desc_count)) {
@@ -1015,6 +926,11 @@ static void idpf_txq_group_rel(struct idpf_vport *vport) · 374 unmodified lines
1015926 struct idpf_txq_group *txq_grp = &vport->txq_grps[i];
1016927
1017928 for (j = 0; j < txq_grp->num_txq; j++) {
929+ if (flow_sch_en) {
930+ kfree(txq_grp->txqs[j]->refillq);
931+ txq_grp->txqs[j]->refillq = NULL;
932+ }
933+
1018934 kfree(txq_grp->txqs[j]);
1019935 txq_grp->txqs[j] = NULL;
1020936 }
@@ -1024,9 +940,6 @@ static void idpf_txq_group_rel(struct idpf_vport *vport) · 3 unmodified lines
1024940
1025941 kfree(txq_grp->complq);
1026942 txq_grp->complq = NULL;
1027−
1028− if (flow_sch_en)
1029− kfree(txq_grp->stashes);
1030943 }
1031944 kfree(vport->txq_grps);
1032945 vport->txq_grps = NULL;
@@ -1387,7 +1300,6 @@ static int idpf_txq_group_alloc(struct idpf_vport *vport, u16 num_txq) · 354 unmodified lines
13871300 for (i = 0; i < vport->num_txq_grp; i++) {
13881301 struct idpf_txq_group *tx_qgrp = &vport->txq_grps[i];
13891302 struct idpf_adapter *adapter = vport->adapter;
1390− struct idpf_txq_stash *stashes;
13911303 int j;
13921304
13931305 tx_qgrp->vport = vport;
@@ -1400,15 +1312,6 @@ static int idpf_txq_group_alloc(struct idpf_vport *vport, u16 num_txq) · 6 unmodified lines
14001312 goto err_alloc;
14011313 }
14021314
1403− if (split && flow_sch_en) {
1404− stashes = kcalloc(num_txq, sizeof(*stashes),
1405− GFP_KERNEL);
1406− if (!stashes)
1407− goto err_alloc;
1408−
1409− tx_qgrp->stashes = stashes;
1410− }
1411−
14121315 for (j = 0; j < tx_qgrp->num_txq; j++) {
14131316 struct idpf_tx_queue *q = tx_qgrp->txqs[j];
14141317
@@ -1428,12 +1331,14 @@ static int idpf_txq_group_alloc(struct idpf_vport *vport, u16 num_txq) · 13 unmodified lines
14281331 if (!flow_sch_en)
14291332 continue;
14301333
1431− if (split) {
1432− q->stash = &stashes[j];
1433− hash_init(q->stash->sched_buf_hash);
1434− }
1435−
14361334 idpf_queue_set(FLOW_SCH_EN, q);
1335+
1336+ q->refillq = kzalloc(sizeof(*q->refillq), GFP_KERNEL);
1337+ if (!q->refillq)
1338+ goto err_alloc;
1339+
1340+ idpf_queue_set(GEN_CHK, q->refillq);
1341+ idpf_queue_set(RFL_GEN_CHK, q->refillq);
14371342 }
14381343
14391344 if (!split)
@@ -1717,87 +1622,6 @@ static void idpf_tx_read_tstamp(struct idpf_tx_queue *txq, struct sk_buff *skb) · 277 unmodified lines
17171622 spin_unlock_bh(&tx_tstamp_caps->status_lock);
17181623 }
17191624
1720−/**
1721− * idpf_tx_clean_stashed_bufs - clean bufs that were stored for
1722− * out of order completions
1723− * @txq: queue to clean
1724− * @compl_tag: completion tag of packet to clean (from completion descriptor)
1725− * @cleaned: pointer to stats struct to track cleaned packets/bytes
1726− * @budget: Used to determine if we are in netpoll
1727− */
1728−static void idpf_tx_clean_stashed_bufs(struct idpf_tx_queue *txq,
1729− u16 compl_tag,
1730− struct libeth_sq_napi_stats *cleaned,
1731− int budget)
1732−{
1733− struct idpf_tx_stash *stash;
1734− struct hlist_node *tmp_buf;
1735− struct libeth_cq_pp cp = {
1736− .dev = txq->dev,
1737− .ss = cleaned,
1738− .napi = budget,
1739− };
1740−
1741− /* Buffer completion */
1742− hash_for_each_possible_safe(txq->stash->sched_buf_hash, stash, tmp_buf,
1743− hlist, compl_tag) {
1744− if (unlikely(idpf_tx_buf_compl_tag(&stash->buf) != compl_tag))
1745− continue;
1746−
1747− hash_del(&stash->hlist);
1748−
1749− if (stash->buf.type == LIBETH_SQE_SKB &&
1750− (skb_shinfo(stash->buf.skb)->tx_flags & SKBTX_IN_PROGRESS))
1751− idpf_tx_read_tstamp(txq, stash->buf.skb);
1752−
1753− libeth_tx_complete(&stash->buf, &cp);
1754−
1755− /* Push shadow buf back onto stack */
1756− idpf_buf_lifo_push(&txq->stash->buf_stack, stash);
1757− }
1758−}
1759−
1760−/**
1761− * idpf_stash_flow_sch_buffers - store buffer parameters info to be freed at a
1762− * later time (only relevant for flow scheduling mode)
1763− * @txq: Tx queue to clean
1764− * @tx_buf: buffer to store
1765− */
1766−static int idpf_stash_flow_sch_buffers(struct idpf_tx_queue *txq,
1767− struct idpf_tx_buf *tx_buf)
1768−{
1769− struct idpf_tx_stash *stash;
1770−
1771− if (unlikely(tx_buf->type <= LIBETH_SQE_CTX))
1772− return 0;
1773−
1774− stash = idpf_buf_lifo_pop(&txq->stash->buf_stack);
1775− if (unlikely(!stash)) {
1776− net_err_ratelimited("%s: No out-of-order TX buffers left!\n",
1777− netdev_name(txq->netdev));
1778−
1779− return -ENOMEM;
1780− }
1781−
1782− /* Store buffer params in shadow buffer */
1783− stash->buf.skb = tx_buf->skb;
1784− stash->buf.bytes = tx_buf->bytes;
1785− stash->buf.packets = tx_buf->packets;
1786− stash->buf.type = tx_buf->type;
1787− stash->buf.nr_frags = tx_buf->nr_frags;
1788− dma_unmap_addr_set(&stash->buf, dma, dma_unmap_addr(tx_buf, dma));
1789− dma_unmap_len_set(&stash->buf, len, dma_unmap_len(tx_buf, len));
1790− idpf_tx_buf_compl_tag(&stash->buf) = idpf_tx_buf_compl_tag(tx_buf);
1791−
1792− /* Add buffer to buf_hash table to be freed later */
1793− hash_add(txq->stash->sched_buf_hash, &stash->hlist,
1794− idpf_tx_buf_compl_tag(&stash->buf));
1795−
1796− tx_buf->type = LIBETH_SQE_EMPTY;
1797−
1798− return 0;
1799−}
1800−
18011625 #define idpf_tx_splitq_clean_bump_ntc(txq, ntc, desc, buf) \
18021626 do { \
18031627 if (unlikely(++(ntc) == (txq)->desc_count)) { \
@@ -1825,14 +1649,8 @@ do { \ · 21 unmodified lines
18251649 * Separate packet completion events will be reported on the completion queue,
18261650 * and the buffers will be cleaned separately. The stats are not updated from
18271651 * this function when using flow-based scheduling.
1828− *
1829− * Furthermore, in flow scheduling mode, check to make sure there are enough
1830− * reserve buffers to stash the packet. If there are not, return early, which
1831− * will leave next_to_clean pointing to the packet that failed to be stashed.
1832− *
1833− * Return: false in the scenario above, true otherwise.
18341652 */
1835−static bool idpf_tx_splitq_clean(struct idpf_tx_queue *tx_q, u16 end,
1653+static void idpf_tx_splitq_clean(struct idpf_tx_queue *tx_q, u16 end,
18361654 int napi_budget,
18371655 struct libeth_sq_napi_stats *cleaned,
18381656 bool descs_only)
@@ -1846,7 +1664,12 @@ static bool idpf_tx_splitq_clean(struct idpf_tx_queue *tx_q, u16 end, · 7 unmodified lines
18461664 .napi = napi_budget,
18471665 };
18481666 struct idpf_tx_buf *tx_buf;
1849− bool clean_complete = true;
1667+
1668+ if (descs_only) {
1669+ /* Bump ring index to mark as cleaned. */
1670+ tx_q->next_to_clean = end;
1671+ return;
1672+ }
18501673
18511674 tx_desc = &tx_q->flex_tx[ntc];
18521675 next_pending_desc = &tx_q->flex_tx[end];
@@ -1866,136 +1689,61 @@ static bool idpf_tx_splitq_clean(struct idpf_tx_queue *tx_q, u16 end, · 13 unmodified lines
18661689 break;
18671690
18681691 eop_idx = tx_buf->rs_idx;
1692+ libeth_tx_complete(tx_buf, &cp);
18691693
1870− if (descs_only) {
1871− if (IDPF_TX_BUF_RSV_UNUSED(tx_q) < tx_buf->nr_frags) {
1872− clean_complete = false;
1873− goto tx_splitq_clean_out;
1874− }
1875−
1876− idpf_stash_flow_sch_buffers(tx_q, tx_buf);
1694+ /* unmap remaining buffers */
1695+ while (ntc != eop_idx) {
1696+ idpf_tx_splitq_clean_bump_ntc(tx_q, ntc,
1697+ tx_desc, tx_buf);
18771698
1878− while (ntc != eop_idx) {
1879− idpf_tx_splitq_clean_bump_ntc(tx_q, ntc,
1880− tx_desc, tx_buf);
1881− idpf_stash_flow_sch_buffers(tx_q, tx_buf);
1882− }
1883− } else {
1699+ /* unmap any remaining paged data */
18841700 libeth_tx_complete(tx_buf, &cp);
1885−
1886− /* unmap remaining buffers */
1887− while (ntc != eop_idx) {
1888− idpf_tx_splitq_clean_bump_ntc(tx_q, ntc,
1889− tx_desc, tx_buf);
1890−
1891− /* unmap any remaining paged data */
1892− libeth_tx_complete(tx_buf, &cp);
1893− }
18941701 }
18951702
18961703 fetch_next_txq_desc:
18971704 idpf_tx_splitq_clean_bump_ntc(tx_q, ntc, tx_desc, tx_buf);
18981705 }
18991706
1900−tx_splitq_clean_out:
19011707 tx_q->next_to_clean = ntc;
1902−
1903− return clean_complete;
19041708 }
19051709
1906−#define idpf_tx_clean_buf_ring_bump_ntc(txq, ntc, buf) \
1907−do { \
1908− (buf)++; \
1909− (ntc)++; \
1910− if (unlikely((ntc) == (txq)->desc_count)) { \
1911− buf = (txq)->tx_buf; \
1912− ntc = 0; \
1913− } \
1914−} while (0)
1915−
19161710 /**
1917− * idpf_tx_clean_buf_ring - clean flow scheduling TX queue buffers
1711+ * idpf_tx_clean_bufs - clean flow scheduling TX queue buffers
19181712 * @txq: queue to clean
1919− * @compl_tag: completion tag of packet to clean (from completion descriptor)
1713+ * @buf_id: packet's starting buffer ID, from completion descriptor
19201714 * @cleaned: pointer to stats struct to track cleaned packets/bytes
19211715 * @budget: Used to determine if we are in netpoll
19221716 *
1923− * Cleans all buffers associated with the input completion tag either from the
1924− * TX buffer ring or from the hash table if the buffers were previously
1925− * stashed. Returns the byte/segment count for the cleaned packet associated
1926− * this completion tag.
1717+ * Clean all buffers associated with the packet starting at buf_id. Returns the
1718+ * byte/segment count for the cleaned packet.
19271719 */
1928−static bool idpf_tx_clean_buf_ring(struct idpf_tx_queue *txq, u16 compl_tag,
1929− struct libeth_sq_napi_stats *cleaned,
1930− int budget)
1720+static void idpf_tx_clean_bufs(struct idpf_tx_queue *txq, u32 buf_id,
1721+ struct libeth_sq_napi_stats *cleaned,
1722+ int budget)
19311723 {
1932− u16 idx = compl_tag & txq->compl_tag_bufid_m;
19331724 struct idpf_tx_buf *tx_buf = NULL;
19341725 struct libeth_cq_pp cp = {
19351726 .dev = txq->dev,
19361727 .ss = cleaned,
19371728 .napi = budget,
19381729 };
1939− u16 ntc, orig_idx = idx;
1940−
1941− tx_buf = &txq->tx_buf[idx];
1942−
1943− if (unlikely(tx_buf->type <= LIBETH_SQE_CTX ||
1944− idpf_tx_buf_compl_tag(tx_buf) != compl_tag))
1945− return false;
19461730
1731+ tx_buf = &txq->tx_buf[buf_id];
19471732 if (tx_buf->type == LIBETH_SQE_SKB) {
19481733 if (skb_shinfo(tx_buf->skb)->tx_flags & SKBTX_IN_PROGRESS)
19491734 idpf_tx_read_tstamp(txq, tx_buf->skb);
19501735
19511736 libeth_tx_complete(tx_buf, &cp);
1737+ idpf_post_buf_refill(txq->refillq, buf_id);
19521738 }
19531739
1954− idpf_tx_clean_buf_ring_bump_ntc(txq, idx, tx_buf);
1740+ while (idpf_tx_buf_next(tx_buf) != IDPF_TXBUF_NULL) {
1741+ buf_id = idpf_tx_buf_next(tx_buf);
19551742
1956− while (idpf_tx_buf_compl_tag(tx_buf) == compl_tag) {
1743+ tx_buf = &txq->tx_buf[buf_id];
19571744 libeth_tx_complete(tx_buf, &cp);
1958− idpf_tx_clean_buf_ring_bump_ntc(txq, idx, tx_buf);
1745+ idpf_post_buf_refill(txq->refillq, buf_id);
19591746 }
1960−
1961− /*
1962− * It's possible the packet we just cleaned was an out of order
1963− * completion, which means we can stash the buffers starting from
1964− * the original next_to_clean and reuse the descriptors. We need
1965− * to compare the descriptor ring next_to_clean packet's "first" buffer
1966− * to the "first" buffer of the packet we just cleaned to determine if
1967− * this is the case. Howevever, next_to_clean can point to either a
1968− * reserved buffer that corresponds to a context descriptor used for the
1969− * next_to_clean packet (TSO packet) or the "first" buffer (single
1970− * packet). The orig_idx from the packet we just cleaned will always
1971− * point to the "first" buffer. If next_to_clean points to a reserved
1972− * buffer, let's bump ntc once and start the comparison from there.
1973− */
1974− ntc = txq->next_to_clean;
1975− tx_buf = &txq->tx_buf[ntc];
1976−
1977− if (tx_buf->type == LIBETH_SQE_CTX)
1978− idpf_tx_clean_buf_ring_bump_ntc(txq, ntc, tx_buf);
1979−
1980− /*
1981− * If ntc still points to a different "first" buffer, clean the
1982− * descriptor ring and stash all of the buffers for later cleaning. If
1983− * we cannot stash all of the buffers, next_to_clean will point to the
1984− * "first" buffer of the packet that could not be stashed and cleaning
1985− * will start there next time.
1986− */
1987− if (unlikely(tx_buf != &txq->tx_buf[orig_idx] &&
1988− !idpf_tx_splitq_clean(txq, orig_idx, budget, cleaned,
1989− true)))
1990− return true;
1991−
1992− /*
1993− * Otherwise, update next_to_clean to reflect the cleaning that was
1994− * done above.
1995− */
1996− txq->next_to_clean = idx;
1997−
1998− return true;
19991747 }
20001748
20011749 /**
@@ -2014,22 +1762,17 @@ static void idpf_tx_handle_rs_completion(struct idpf_tx_queue *txq, · 12 unmodified lines
20141762 struct libeth_sq_napi_stats *cleaned,
20151763 int budget)
20161764 {
2017− u16 compl_tag;
1765+ /* RS completion contains queue head for queue based scheduling or
1766+ * completion tag for flow based scheduling.
1767+ */
1768+ u16 rs_compl_val = le16_to_cpu(desc->q_head_compl_tag.q_head);
20181769
20191770 if (!idpf_queue_has(FLOW_SCH_EN, txq)) {
2020− u16 head = le16_to_cpu(desc->q_head_compl_tag.q_head);
2021−
2022− idpf_tx_splitq_clean(txq, head, budget, cleaned, false);
1771+ idpf_tx_splitq_clean(txq, rs_compl_val, budget, cleaned, false);
20231772 return;
20241773 }
20251774
2026− compl_tag = le16_to_cpu(desc->q_head_compl_tag.compl_tag);
2027−
2028− /* If we didn't clean anything on the ring, this packet must be
2029− * in the hash table. Go clean it there.
2030− */
2031− if (!idpf_tx_clean_buf_ring(txq, compl_tag, cleaned, budget))
2032− idpf_tx_clean_stashed_bufs(txq, compl_tag, cleaned, budget);
1775+ idpf_tx_clean_bufs(txq, rs_compl_val, cleaned, budget);
20331776 }
20341777
20351778 /**
@@ -2146,8 +1889,7 @@ fetch_next_desc: · 110 unmodified lines
21461889 /* Update BQL */
21471890 nq = netdev_get_tx_queue(tx_q->netdev, tx_q->idx);
21481891
2149− dont_wake = !complq_ok || IDPF_TX_BUF_RSV_LOW(tx_q) ||
2150− np->state != __IDPF_VPORT_UP ||
1892+ dont_wake = !complq_ok || np->state != __IDPF_VPORT_UP ||
21511893 !netif_carrier_ok(tx_q->netdev);
21521894 /* Check if the TXQ needs to and can be restarted */
21531895 __netif_txq_completed_wake(nq, tx_q->cleaned_pkts, tx_q->cleaned_bytes,
@@ -2204,15 +1946,21 @@ void idpf_tx_splitq_build_flow_desc(union idpf_tx_flex_desc *desc, · 50 unmodified lines
22041946 desc->flow.qw1.compl_tag = cpu_to_le16(params->compl_tag);
22051947 }
22061948
2207−/* Global conditions to tell whether the txq (and related resources)
2208− * has room to allow the use of "size" descriptors.
1949+/**
1950+ * idpf_tx_splitq_has_room - check if enough Tx splitq resources are available
1951+ * @tx_q: the queue to be checked
1952+ * @descs_needed: number of descriptors required for this packet
1953+ * @bufs_needed: number of Tx buffers required for this packet
1954+ *
1955+ * Return: 0 if no room available, 1 otherwise
22091956 */
2210−static int idpf_txq_has_room(struct idpf_tx_queue *tx_q, u32 size)
1957+static int idpf_txq_has_room(struct idpf_tx_queue *tx_q, u32 descs_needed,
1958+ u32 bufs_needed)
22111959 {
2212− if (IDPF_DESC_UNUSED(tx_q) < size ||
1960+ if (IDPF_DESC_UNUSED(tx_q) < descs_needed ||
22131961 IDPF_TX_COMPLQ_PENDING(tx_q->txq_grp) >
22141962 IDPF_TX_COMPLQ_OVERFLOW_THRESH(tx_q->txq_grp->complq) ||
2215− IDPF_TX_BUF_RSV_LOW(tx_q))
1963+ idpf_tx_splitq_get_free_bufs(tx_q->refillq) < bufs_needed)
22161964 return 0;
22171965 return 1;
22181966 }
@@ -2221,14 +1969,21 @@ static int idpf_txq_has_room(struct idpf_tx_queue *tx_q, u32 size) · 2 unmodified lines
22211969 * idpf_tx_maybe_stop_splitq - 1st level check for Tx splitq stop conditions
22221970 * @tx_q: the queue to be checked
22231971 * @descs_needed: number of descriptors required for this packet
1972+ * @bufs_needed: number of buffers needed for this packet
22241973 *
2225− * Returns 0 if stop is not needed
1974+ * Return: 0 if stop is not needed
22261975 */
22271976 static int idpf_tx_maybe_stop_splitq(struct idpf_tx_queue *tx_q,
2228− unsigned int descs_needed)
1977+ u32 descs_needed,
1978+ u32 bufs_needed)
22291979 {
1980+ /* Since we have multiple resources to check for splitq, our
1981+ * start,stop_thrs becomes a boolean check instead of a count
1982+ * threshold.
1983+ */
22301984 if (netif_subqueue_maybe_stop(tx_q->netdev, tx_q->idx,
2231− idpf_txq_has_room(tx_q, descs_needed),
1985+ idpf_txq_has_room(tx_q, descs_needed,
1986+ bufs_needed),
22321987 1, 1))
22331988 return 0;
22341989
@@ -2270,14 +2025,16 @@ void idpf_tx_buf_hw_update(struct idpf_tx_queue *tx_q, u32 val, · 35 unmodified lines
22702025 }
22712026
22722027 /**
2273− * idpf_tx_desc_count_required - calculate number of Tx descriptors needed
2028+ * idpf_tx_res_count_required - get number of Tx resources needed for this pkt
22742029 * @txq: queue to send buffer on
22752030 * @skb: send buffer
2031+ * @bufs_needed: (output) number of buffers needed for this skb.
22762032 *
2277− * Returns number of data descriptors needed for this skb.
2033+ * Return: number of data descriptors and buffers needed for this skb.
22782034 */
2279−unsigned int idpf_tx_desc_count_required(struct idpf_tx_queue *txq,
2280− struct sk_buff *skb)
2035+unsigned int idpf_tx_res_count_required(struct idpf_tx_queue *txq,
2036+ struct sk_buff *skb,
2037+ u32 *bufs_needed)
22812038 {
22822039 const struct skb_shared_info *shinfo;
22832040 unsigned int count = 0, i;
@@ -2288,6 +2045,7 @@ unsigned int idpf_tx_desc_count_required(struct idpf_tx_queue *txq, · 4 unmodified lines
22882045 return count;
22892046
22902047 shinfo = skb_shinfo(skb);
2048+ *bufs_needed += shinfo->nr_frags;
22912049 for (i = 0; i < shinfo->nr_frags; i++) {
22922050 unsigned int size;
22932051
@@ -2317,71 +2075,89 @@ unsigned int idpf_tx_desc_count_required(struct idpf_tx_queue *txq, · 23 unmodified lines
23172075 }
23182076
23192077 /**
2320− * idpf_tx_dma_map_error - handle TX DMA map errors
2321− * @txq: queue to send buffer on
2322− * @skb: send buffer
2323− * @first: original first buffer info buffer for packet
2324− * @idx: starting point on ring to unwind
2078+ * idpf_tx_splitq_bump_ntu - adjust NTU and generation
2079+ * @txq: the tx ring to wrap
2080+ * @ntu: ring index to bump
23252081 */
2326−void idpf_tx_dma_map_error(struct idpf_tx_queue *txq, struct sk_buff *skb,
2327− struct idpf_tx_buf *first, u16 idx)
2082+static unsigned int idpf_tx_splitq_bump_ntu(struct idpf_tx_queue *txq, u16 ntu)
23282083 {
2329− struct libeth_sq_napi_stats ss = { };
2330− struct libeth_cq_pp cp = {
2331− .dev = txq->dev,
2332− .ss = &ss,
2333− };
2084+ ntu++;
23342085
2335− u64_stats_update_begin(&txq->stats_sync);
2336− u64_stats_inc(&txq->q_stats.dma_map_errs);
2337− u64_stats_update_end(&txq->stats_sync);
2086+ if (ntu == txq->desc_count)
2087+ ntu = 0;
23382088
2339− /* clear dma mappings for failed tx_buf map */
2340− for (;;) {
2341− struct idpf_tx_buf *tx_buf;
2089+ return ntu;
2090+}
23422091
2343− tx_buf = &txq->tx_buf[idx];
2344− libeth_tx_complete(tx_buf, &cp);
2345− if (tx_buf == first)
2346− break;
2347− if (idx == 0)
2348− idx = txq->desc_count;
2349− idx--;
2350− }
2092+/**
2093+ * idpf_tx_get_free_buf_id - get a free buffer ID from the refill queue
2094+ * @refillq: refill queue to get buffer ID from
2095+ * @buf_id: return buffer ID
2096+ *
2097+ * Return: true if a buffer ID was found, false if not
2098+ */
2099+static bool idpf_tx_get_free_buf_id(struct idpf_sw_queue *refillq,
2100+ u32 *buf_id)
2101+{
2102+ u32 ntc = refillq->next_to_clean;
2103+ u32 refill_desc;
23512104
2352− if (skb_is_gso(skb)) {
2353− union idpf_tx_flex_desc *tx_desc;
2105+ refill_desc = refillq->ring[ntc];
23542106
2355− /* If we failed a DMA mapping for a TSO packet, we will have
2356− * used one additional descriptor for a context
2357− * descriptor. Reset that here.
2358− */
2359− tx_desc = &txq->flex_tx[idx];
2360− memset(tx_desc, 0, sizeof(*tx_desc));
2361− if (idx == 0)
2362− idx = txq->desc_count;
2363− idx--;
2107+ if (unlikely(idpf_queue_has(RFL_GEN_CHK, refillq) !=
2108+ !!(refill_desc & IDPF_RFL_BI_GEN_M)))
2109+ return false;
2110+
2111+ *buf_id = FIELD_GET(IDPF_RFL_BI_BUFID_M, refill_desc);
2112+
2113+ if (unlikely(++ntc == refillq->desc_count)) {
2114+ idpf_queue_change(RFL_GEN_CHK, refillq);
2115+ ntc = 0;
23642116 }
23652117
2366− /* Update tail in case netdev_xmit_more was previously true */
2367− idpf_tx_buf_hw_update(txq, idx, false);
2118+ refillq->next_to_clean = ntc;
2119+
2120+ return true;
23682121 }
23692122
23702123 /**
2371− * idpf_tx_splitq_bump_ntu - adjust NTU and generation
2372− * @txq: the tx ring to wrap
2373− * @ntu: ring index to bump
2124+ * idpf_tx_splitq_pkt_err_unmap - Unmap buffers and bump tail in case of error
2125+ * @txq: Tx queue to unwind
2126+ * @params: pointer to splitq params struct
2127+ * @first: starting buffer for packet to unmap
23742128 */
2375−static unsigned int idpf_tx_splitq_bump_ntu(struct idpf_tx_queue *txq, u16 ntu)
2129+static void idpf_tx_splitq_pkt_err_unmap(struct idpf_tx_queue *txq,
2130+ struct idpf_tx_splitq_params *params,
2131+ struct idpf_tx_buf *first)
23762132 {
2377− ntu++;
2133+ struct idpf_sw_queue *refillq = txq->refillq;
2134+ struct libeth_sq_napi_stats ss = { };
2135+ struct idpf_tx_buf *tx_buf = first;
2136+ struct libeth_cq_pp cp = {
2137+ .dev = txq->dev,
2138+ .ss = &ss,
2139+ };
23782140
2379− if (ntu == txq->desc_count) {
2380− ntu = 0;
2381− txq->compl_tag_cur_gen = IDPF_TX_ADJ_COMPL_TAG_GEN(txq);
2141+ u64_stats_update_begin(&txq->stats_sync);
2142+ u64_stats_inc(&txq->q_stats.dma_map_errs);
2143+ u64_stats_update_end(&txq->stats_sync);
2144+
2145+ libeth_tx_complete(tx_buf, &cp);
2146+ while (idpf_tx_buf_next(tx_buf) != IDPF_TXBUF_NULL) {
2147+ tx_buf = &txq->tx_buf[idpf_tx_buf_next(tx_buf)];
2148+ libeth_tx_complete(tx_buf, &cp);
23822149 }
23832150
2384− return ntu;
2151+ /* Update tail in case netdev_xmit_more was previously true. */
2152+ idpf_tx_buf_hw_update(txq, params->prev_ntu, false);
2153+
2154+ if (!refillq)
2155+ return;
2156+
2157+ /* Restore refillq state to avoid leaking tags. */
2158+ if (params->prev_refill_gen != idpf_queue_has(RFL_GEN_CHK, refillq))
2159+ idpf_queue_change(RFL_GEN_CHK, refillq);
2160+ refillq->next_to_clean = params->prev_refill_ntc;
23852161 }
23862162
23872163 /**
@@ -2405,6 +2181,7 @@ static void idpf_tx_splitq_map(struct idpf_tx_queue *tx_q, · 17 unmodified lines
24052181 struct netdev_queue *nq;
24062182 struct sk_buff *skb;
24072183 skb_frag_t *frag;
2184+ u32 next_buf_id;
24082185 u16 td_cmd = 0;
24092186 dma_addr_t dma;
24102187
@@ -2422,17 +2199,16 @@ static void idpf_tx_splitq_map(struct idpf_tx_queue *tx_q, · 11 unmodified lines
24222199 tx_buf = first;
24232200 first->nr_frags = 0;
24242201
2425− params->compl_tag =
2426− (tx_q->compl_tag_cur_gen << tx_q->compl_tag_gen_s) | i;
2427−
24282202 for (frag = &skb_shinfo(skb)->frags[0];; frag++) {
24292203 unsigned int max_data = IDPF_TX_MAX_DESC_DATA_ALIGNED;
24302204
2431− if (dma_mapping_error(tx_q->dev, dma))
2432− return idpf_tx_dma_map_error(tx_q, skb, first, i);
2205+ if (unlikely(dma_mapping_error(tx_q->dev, dma))) {
2206+ idpf_tx_buf_next(tx_buf) = IDPF_TXBUF_NULL;
2207+ return idpf_tx_splitq_pkt_err_unmap(tx_q, params,
2208+ first);
2209+ }
24332210
24342211 first->nr_frags++;
2435− idpf_tx_buf_compl_tag(tx_buf) = params->compl_tag;
24362212 tx_buf->type = LIBETH_SQE_FRAG;
24372213
24382214 /* record length, and DMA address */
@@ -2488,29 +2264,12 @@ static void idpf_tx_splitq_map(struct idpf_tx_queue *tx_q, · 49 unmodified lines
24882264 max_data);
24892265
24902266 if (unlikely(++i == tx_q->desc_count)) {
2491− tx_buf = tx_q->tx_buf;
24922267 tx_desc = &tx_q->flex_tx[0];
24932268 i = 0;
2494− tx_q->compl_tag_cur_gen =
2495− IDPF_TX_ADJ_COMPL_TAG_GEN(tx_q);
24962269 } else {
2497− tx_buf++;
24982270 tx_desc++;
24992271 }
25002272
2501− /* Since this packet has a buffer that is going to span
2502− * multiple descriptors, it's going to leave holes in
2503− * to the TX buffer ring. To ensure these holes do not
2504− * cause issues in the cleaning routines, we will clear
2505− * them of any stale data and assign them the same
2506− * completion tag as the current packet. Then when the
2507− * packet is being cleaned, the cleaning routines will
2508− * simply pass over these holes and finish cleaning the
2509− * rest of the packet.
2510− */
2511− tx_buf->type = LIBETH_SQE_EMPTY;
2512− idpf_tx_buf_compl_tag(tx_buf) = params->compl_tag;
2513−
25142273 /* Adjust the DMA offset and the remaining size of the
25152274 * fragment. On the first iteration of this loop,
25162275 * max_data will be >= 12K and <= 16K-1. On any
@@ -2535,15 +2294,25 @@ static void idpf_tx_splitq_map(struct idpf_tx_queue *tx_q, · 18 unmodified lines
25352294 idpf_tx_splitq_build_desc(tx_desc, params, td_cmd, size);
25362295
25372296 if (unlikely(++i == tx_q->desc_count)) {
2538− tx_buf = tx_q->tx_buf;
25392297 tx_desc = &tx_q->flex_tx[0];
25402298 i = 0;
2541− tx_q->compl_tag_cur_gen = IDPF_TX_ADJ_COMPL_TAG_GEN(tx_q);
25422299 } else {
2543− tx_buf++;
25442300 tx_desc++;
25452301 }
25462302
2303+ if (idpf_queue_has(FLOW_SCH_EN, tx_q)) {
2304+ if (unlikely(!idpf_tx_get_free_buf_id(tx_q->refillq,
2305+ &next_buf_id))) {
2306+ idpf_tx_buf_next(tx_buf) = IDPF_TXBUF_NULL;
2307+ return idpf_tx_splitq_pkt_err_unmap(tx_q, params,
2308+ first);
2309+ }
2310+ } else {
2311+ next_buf_id = i;
2312+ }
2313+ idpf_tx_buf_next(tx_buf) = next_buf_id;
2314+ tx_buf = &tx_q->tx_buf[next_buf_id];
2315+
25472316 size = skb_frag_size(frag);
25482317 data_len -= size;
25492318
@@ -2558,6 +2327,7 @@ static void idpf_tx_splitq_map(struct idpf_tx_queue *tx_q, · 8 unmodified lines
25582327
25592328 /* write last descriptor with RS and EOP bits */
25602329 first->rs_idx = i;
2330+ idpf_tx_buf_next(tx_buf) = IDPF_TXBUF_NULL;
25612331 td_cmd |= params->eop_cmd;
25622332 idpf_tx_splitq_build_desc(tx_desc, params, td_cmd, size);
25632333 i = idpf_tx_splitq_bump_ntu(tx_q, i);
@@ -2661,8 +2431,6 @@ idpf_tx_splitq_get_ctx_desc(struct idpf_tx_queue *txq) · 97 unmodified lines
26612431 union idpf_flex_tx_ctx_desc *desc;
26622432 int i = txq->next_to_use;
26632433
2664− txq->tx_buf[i].type = LIBETH_SQE_CTX;
2665−
26662434 /* grab the next descriptor */
26672435 desc = &txq->flex_ctx[i];
26682436 txq->next_to_use = idpf_tx_splitq_bump_ntu(txq, i);
@@ -2755,6 +2523,21 @@ static void idpf_tx_set_tstamp_desc(union idpf_flex_tx_ctx_desc *ctx_desc, · 86 unmodified lines
27552523 { }
27562524 #endif /* CONFIG_PTP_1588_CLOCK */
27572525
2526+/**
2527+ * idpf_tx_splitq_need_re - check whether RE bit needs to be set
2528+ * @tx_q: pointer to Tx queue
2529+ *
2530+ * Return: true if RE bit needs to be set, false otherwise
2531+ */
2532+static bool idpf_tx_splitq_need_re(struct idpf_tx_queue *tx_q)
2533+{
2534+ int gap = tx_q->next_to_use - tx_q->last_re;
2535+
2536+ gap += (gap < 0) ? tx_q->desc_count : 0;
2537+
2538+ return gap >= IDPF_TX_SPLITQ_RE_MIN_GAP;
2539+}
2540+
27582541 /**
27592542 * idpf_tx_splitq_frame - Sends buffer on Tx ring using flex descriptors
27602543 * @skb: send buffer
@@ -2765,13 +2548,16 @@ static void idpf_tx_set_tstamp_desc(union idpf_flex_tx_ctx_desc *ctx_desc, · 4 unmodified lines
27652548 static netdev_tx_t idpf_tx_splitq_frame(struct sk_buff *skb,
27662549 struct idpf_tx_queue *tx_q)
27672550 {
2768− struct idpf_tx_splitq_params tx_params = { };
2551+ struct idpf_tx_splitq_params tx_params = {
2552+ .prev_ntu = tx_q->next_to_use,
2553+ };
27692554 union idpf_flex_tx_ctx_desc *ctx_desc;
27702555 struct idpf_tx_buf *first;
2771− unsigned int count;
2556+ u32 count, buf_count = 1;
27722557 int tso, idx;
2558+ u32 buf_id;
27732559
2774− count = idpf_tx_desc_count_required(tx_q, skb);
2560+ count = idpf_tx_res_count_required(tx_q, skb, &buf_count);
27752561 if (unlikely(!count))
27762562 return idpf_tx_drop_skb(tx_q, skb);
27772563
@@ -2781,7 +2567,7 @@ static netdev_tx_t idpf_tx_splitq_frame(struct sk_buff *skb, · 3 unmodified lines
27812567
27822568 /* Check for splitq specific TX resources */
27832569 count += (IDPF_TX_DESCS_PER_CACHE_LINE + tso);
2784− if (idpf_tx_maybe_stop_splitq(tx_q, count)) {
2570+ if (idpf_tx_maybe_stop_splitq(tx_q, count, buf_count)) {
27852571 idpf_tx_buf_hw_update(tx_q, tx_q->next_to_use, false);
27862572
27872573 return NETDEV_TX_BUSY;
@@ -2813,36 +2599,47 @@ static netdev_tx_t idpf_tx_splitq_frame(struct sk_buff *skb, · 25 unmodified lines
28132599 idpf_tx_set_tstamp_desc(ctx_desc, idx);
28142600 }
28152601
2816− /* record the location of the first descriptor for this packet */
2817− first = &tx_q->tx_buf[tx_q->next_to_use];
2818− first->skb = skb;
2602+ if (idpf_queue_has(FLOW_SCH_EN, tx_q)) {
2603+ struct idpf_sw_queue *refillq = tx_q->refillq;
28192604
2820− if (tso) {
2821− first->packets = tx_params.offload.tso_segs;
2822− first->bytes = skb->len +
2823− ((first->packets - 1) * tx_params.offload.tso_hdr_len);
2824− } else {
2825− first->packets = 1;
2826− first->bytes = max_t(unsigned int, skb->len, ETH_ZLEN);
2827− }
2605+ /* Save refillq state in case of a packet rollback. Otherwise,
2606+ * the tags will be leaked since they will be popped from the
2607+ * refillq but never reposted during cleaning.
2608+ */
2609+ tx_params.prev_refill_gen =
2610+ idpf_queue_has(RFL_GEN_CHK, refillq);
2611+ tx_params.prev_refill_ntc = refillq->next_to_clean;
2612+
2613+ if (unlikely(!idpf_tx_get_free_buf_id(tx_q->refillq,
2614+ &buf_id))) {
2615+ if (tx_params.prev_refill_gen !=
2616+ idpf_queue_has(RFL_GEN_CHK, refillq))
2617+ idpf_queue_change(RFL_GEN_CHK, refillq);
2618+ refillq->next_to_clean = tx_params.prev_refill_ntc;
2619+
2620+ tx_q->next_to_use = tx_params.prev_ntu;
2621+ return idpf_tx_drop_skb(tx_q, skb);
2622+ }
2623+ tx_params.compl_tag = buf_id;
28282624
2829− if (idpf_queue_has(FLOW_SCH_EN, tx_q)) {
28302625 tx_params.dtype = IDPF_TX_DESC_DTYPE_FLEX_FLOW_SCHE;
28312626 tx_params.eop_cmd = IDPF_TXD_FLEX_FLOW_CMD_EOP;
2832− /* Set the RE bit to catch any packets that may have not been
2833− * stashed during RS completion cleaning. MIN_GAP is set to
2834− * MIN_RING size to ensure it will be set at least once each
2835− * time around the ring.
2627+ /* Set the RE bit to periodically "clean" the descriptor ring.
2628+ * MIN_GAP is set to MIN_RING size to ensure it will be set at
2629+ * least once each time around the ring.
28362630 */
2837− if (!(tx_q->next_to_use % IDPF_TX_SPLITQ_RE_MIN_GAP)) {
2631+ if (idpf_tx_splitq_need_re(tx_q)) {
28382632 tx_params.eop_cmd |= IDPF_TXD_FLEX_FLOW_CMD_RE;
28392633 tx_q->txq_grp->num_completions_pending++;
2634+ tx_q->last_re = tx_q->next_to_use;
28402635 }
28412636
28422637 if (skb->ip_summed == CHECKSUM_PARTIAL)
28432638 tx_params.offload.td_cmd |= IDPF_TXD_FLEX_FLOW_CMD_CS_EN;
28442639
28452640 } else {
2641+ buf_id = tx_q->next_to_use;
2642+
28462643 tx_params.dtype = IDPF_TX_DESC_DTYPE_FLEX_L2TAG1_L2TAG2;
28472644 tx_params.eop_cmd = IDPF_TXD_LAST_DESC_CMD;
28482645
@@ -2850,6 +2647,18 @@ static netdev_tx_t idpf_tx_splitq_frame(struct sk_buff *skb, · 1 unmodified line
28502647 tx_params.offload.td_cmd |= IDPF_TX_FLEX_DESC_CMD_CS_EN;
28512648 }
28522649
2650+ first = &tx_q->tx_buf[buf_id];
2651+ first->skb = skb;
2652+
2653+ if (tso) {
2654+ first->packets = tx_params.offload.tso_segs;
2655+ first->bytes = skb->len +
2656+ ((first->packets - 1) * tx_params.offload.tso_hdr_len);
2657+ } else {
2658+ first->packets = 1;
2659+ first->bytes = max_t(unsigned int, skb->len, ETH_ZLEN);
2660+ }
2661+
28532662 idpf_tx_splitq_map(tx_q, &tx_params, first);
28542663
28552664 return NETDEV_TX_OK;
@@ -3387,7 +3196,7 @@ payload: · 531 unmodified lines
33873196 skip_data:
33883197 rx_buf->netmem = 0;
33893198
3390− idpf_rx_post_buf_refill(refillq, buf_id);
3199+ idpf_post_buf_refill(refillq, buf_id);
33913200 IDPF_RX_BUMP_NTC(rxq, ntc);
33923201
33933202 /* skip if it is non EOP desc */
@@ -3495,10 +3304,10 @@ static void idpf_rx_clean_refillq(struct idpf_buf_queue *bufq, · 101 unmodified lines
34953304 bool failure;
34963305
34973306 if (idpf_queue_has(RFL_GEN_CHK, refillq) !=
3498− !!(refill_desc & IDPF_RX_BI_GEN_M))
3307+ !!(refill_desc & IDPF_RFL_BI_GEN_M))
34993308 break;
35003309
3501− buf_id = FIELD_GET(IDPF_RX_BI_BUFID_M, refill_desc);
3310+ buf_id = FIELD_GET(IDPF_RFL_BI_BUFID_M, refill_desc);
35023311 failure = idpf_rx_update_bufq_desc(bufq, buf_id, buf_desc);
35033312 if (failure)
35043313 break;
drivers/net/ethernet/intel/idpf/idpf_txrx.h+33−54
@@ -108,8 +108,8 @@ do { \ · 107 unmodified lines
108108 */
109109 #define IDPF_TX_SPLITQ_RE_MIN_GAP 64
110110
111−#define IDPF_RX_BI_GEN_M BIT(16)
112−#define IDPF_RX_BI_BUFID_M GENMASK(15, 0)
111+#define IDPF_RFL_BI_GEN_M BIT(16)
112+#define IDPF_RFL_BI_BUFID_M GENMASK(15, 0)
113113
114114 #define IDPF_RXD_EOF_SPLITQ VIRTCHNL2_RX_FLEX_DESC_ADV_STATUS0_EOF_M
115115 #define IDPF_RXD_EOF_SINGLEQ VIRTCHNL2_RX_BASE_DESC_STATUS_EOF_M
@@ -118,10 +118,6 @@ do { \ · 2 unmodified lines
118118 ((((txq)->next_to_clean > (txq)->next_to_use) ? 0 : (txq)->desc_count) + \
119119 (txq)->next_to_clean - (txq)->next_to_use - 1)
120120
121−#define IDPF_TX_BUF_RSV_UNUSED(txq) ((txq)->stash->buf_stack.top)
122−#define IDPF_TX_BUF_RSV_LOW(txq) (IDPF_TX_BUF_RSV_UNUSED(txq) < \
123− (txq)->desc_count >> 2)
124−
125121 #define IDPF_TX_COMPLQ_OVERFLOW_THRESH(txcq) ((txcq)->desc_count >> 1)
126122 /* Determine the absolute number of completions pending, i.e. the number of
127123 * completions that are expected to arrive on the TX completion queue.
@@ -131,11 +127,7 @@ do { \ · 3 unmodified lines
131127 0 : U32_MAX) + \
132128 (txq)->num_completions_pending - (txq)->complq->num_completions)
133129
134−#define IDPF_TX_SPLITQ_COMPL_TAG_WIDTH 16
135−/* Adjust the generation for the completion tag and wrap if necessary */
136−#define IDPF_TX_ADJ_COMPL_TAG_GEN(txq) \
137− ((++(txq)->compl_tag_cur_gen) >= (txq)->compl_tag_gen_max ? \
138− 0 : (txq)->compl_tag_cur_gen)
130+#define IDPF_TXBUF_NULL U32_MAX
139131
140132 #define IDPF_TXD_LAST_DESC_CMD (IDPF_TX_DESC_CMD_EOP | IDPF_TX_DESC_CMD_RS)
141133
@@ -152,18 +144,6 @@ union idpf_tx_flex_desc { · 10 unmodified lines
152144
153145 #define idpf_tx_buf libeth_sqe
154146
155−/**
156− * struct idpf_buf_lifo - LIFO for managing OOO completions
157− * @top: Used to know how many buffers are left
158− * @size: Total size of LIFO
159− * @bufs: Backing array
160− */
161−struct idpf_buf_lifo {
162− u16 top;
163− u16 size;
164− struct idpf_tx_stash **bufs;
165−};
166−
167147 /**
168148 * struct idpf_tx_offload_params - Offload parameters for a given packet
169149 * @tx_flags: Feature flags enabled for this packet
@@ -196,6 +176,9 @@ struct idpf_tx_offload_params { · 26 unmodified lines
196176 * @compl_tag: Associated tag for completion
197177 * @td_tag: Descriptor tunneling tag
198178 * @offload: Offload parameters
179+ * @prev_ntu: stored TxQ next_to_use in case of rollback
180+ * @prev_refill_ntc: stored refillq next_to_clean in case of packet rollback
181+ * @prev_refill_gen: stored refillq generation bit in case of packet rollback
199182 */
200183 struct idpf_tx_splitq_params {
201184 enum idpf_tx_desc_dtype_value dtype;
@@ -206,6 +189,10 @@ struct idpf_tx_splitq_params { · 4 unmodified lines
206189 };
207190
208191 struct idpf_tx_offload_params offload;
192+
193+ u16 prev_ntu;
194+ u16 prev_refill_ntc;
195+ bool prev_refill_gen;
209196 };
210197
211198 enum idpf_tx_ctx_desc_eipt_offload {
@@ -467,17 +454,6 @@ struct idpf_tx_queue_stats { · 255 unmodified lines
467454 #define IDPF_ITR_IDX_SPACING(spacing, dflt) (spacing ? spacing : dflt)
468455 #define IDPF_DIM_DEFAULT_PROFILE_IX 1
469456
470−/**
471− * struct idpf_txq_stash - Tx buffer stash for Flow-based scheduling mode
472− * @buf_stack: Stack of empty buffers to store buffer info for out of order
473− * buffer completions. See struct idpf_buf_lifo
474− * @sched_buf_hash: Hash table to store buffers
475− */
476−struct idpf_txq_stash {
477− struct idpf_buf_lifo buf_stack;
478− DECLARE_HASHTABLE(sched_buf_hash, 12);
479−} ____cacheline_aligned;
480−
481457 /**
482458 * struct idpf_rx_queue - software structure representing a receive queue
483459 * @rx: universal receive descriptor array
@@ -610,6 +586,8 @@ libeth_cacheline_set_assert(struct idpf_rx_queue, 64, · 126 unmodified lines
610586 * @netdev: &net_device corresponding to this queue
611587 * @next_to_use: Next descriptor to use
612588 * @next_to_clean: Next descriptor to clean
589+ * @last_re: last descriptor index that RE bit was set
590+ * @tx_max_bufs: Max buffers that can be transmitted with scatter-gather
613591 * @cleaned_bytes: Splitq only, TXQ only: When a TX completion is received on
614592 * the TX completion queue, it can be for any TXQ associated
615593 * with that completion queue. This means we can clean up to
@@ -620,11 +598,7 @@ libeth_cacheline_set_assert(struct idpf_rx_queue, 64, · 4 unmodified lines
620598 * only once at the end of the cleaning routine.
621599 * @clean_budget: singleq only, queue cleaning budget
622600 * @cleaned_pkts: Number of packets cleaned for the above said case
623− * @tx_max_bufs: Max buffers that can be transmitted with scatter-gather
624− * @stash: Tx buffer stash for Flow-based scheduling mode
625− * @compl_tag_bufid_m: Completion tag buffer id mask
626− * @compl_tag_cur_gen: Used to keep track of current completion tag generation
627− * @compl_tag_gen_max: To determine when compl_tag_cur_gen should be reset
601+ * @refillq: Pointer to refill queue
628602 * @cached_tstamp_caps: Tx timestamp capabilities negotiated with the CP
629603 * @tstamp_task: Work that handles Tx timestamp read
630604 * @stats_sync: See struct u64_stats_sync
@@ -633,6 +607,7 @@ libeth_cacheline_set_assert(struct idpf_rx_queue, 64, · 2 unmodified lines
633607 * @size: Length of descriptor ring in bytes
634608 * @dma: Physical address of ring
635609 * @q_vector: Backreference to associated vector
610+ * @buf_pool_size: Total number of idpf_tx_buf
636611 */
637612 struct idpf_tx_queue {
638613 __cacheline_group_begin_aligned(read_mostly);
@@ -654,7 +629,6 @@ struct idpf_tx_queue { · 15 unmodified lines
654629 u16 desc_count;
655630
656631 u16 tx_min_pkt_len;
657− u16 compl_tag_gen_s;
658632
659633 struct net_device *netdev;
660634 __cacheline_group_end_aligned(read_mostly);
@@ -662,6 +636,8 @@ struct idpf_tx_queue { · 1 unmodified line
662636 __cacheline_group_begin_aligned(read_write);
663637 u16 next_to_use;
664638 u16 next_to_clean;
639+ u16 last_re;
640+ u16 tx_max_bufs;
665641
666642 union {
667643 u32 cleaned_bytes;
@@ -669,12 +645,7 @@ struct idpf_tx_queue { · 1 unmodified line
669645 };
670646 u16 cleaned_pkts;
671647
672− u16 tx_max_bufs;
673− struct idpf_txq_stash *stash;
674−
675− u16 compl_tag_bufid_m;
676− u16 compl_tag_cur_gen;
677− u16 compl_tag_gen_max;
648+ struct idpf_sw_queue *refillq;
678649
679650 struct idpf_ptp_vport_tx_tstamp_caps *cached_tstamp_caps;
680651 struct work_struct *tstamp_task;
@@ -689,11 +660,12 @@ struct idpf_tx_queue { · 8 unmodified lines
689660 dma_addr_t dma;
690661
691662 struct idpf_q_vector *q_vector;
663+ u32 buf_pool_size;
692664 __cacheline_group_end_aligned(cold);
693665 };
694666 libeth_cacheline_set_assert(struct idpf_tx_queue, 64,
695− 112 + sizeof(struct u64_stats_sync),
696− 24);
667+ 104 + sizeof(struct u64_stats_sync),
668+ 32);
697669
698670 /**
699671 * struct idpf_buf_queue - software structure representing a buffer queue
@@ -903,7 +875,6 @@ struct idpf_rxq_group { · 203 unmodified lines
903875 * @vport: Vport back pointer
904876 * @num_txq: Number of TX queues associated
905877 * @txqs: Array of TX queue pointers
906− * @stashes: array of OOO stashes for the queues
907878 * @complq: Associated completion queue pointer, split queue only
908879 * @num_completions_pending: Total number of completions pending for the
909880 * completion queue, acculumated for all TX queues
@@ -918,7 +889,6 @@ struct idpf_txq_group { · 8 unmodified lines
918889
919890 u16 num_txq;
920891 struct idpf_tx_queue *txqs[IDPF_LARGE_MAX_Q];
921− struct idpf_txq_stash *stashes;
922892
923893 struct idpf_compl_queue *complq;
924894
@@ -1011,6 +981,17 @@ static inline void idpf_vport_intr_set_wb_on_itr(struct idpf_q_vector *q_vector) · 86 unmodified lines
1011981 reg->dyn_ctl);
1012982 }
1013983
984+/**
985+ * idpf_tx_splitq_get_free_bufs - get number of free buf_ids in refillq
986+ * @refillq: pointer to refillq containing buf_ids
987+ */
988+static inline u32 idpf_tx_splitq_get_free_bufs(struct idpf_sw_queue *refillq)
989+{
990+ return (refillq->next_to_use > refillq->next_to_clean ?
991+ 0 : refillq->desc_count) +
992+ refillq->next_to_use - refillq->next_to_clean - 1;
993+}
994+
1014995 int idpf_vport_singleq_napi_poll(struct napi_struct *napi, int budget);
1015996 void idpf_vport_init_num_qs(struct idpf_vport *vport,
1016997 struct virtchnl2_create_vport *vport_msg);
@@ -1038,10 +1019,8 @@ void idpf_tx_buf_hw_update(struct idpf_tx_queue *tx_q, u32 val, · 21 unmodified lines
10381019 bool xmit_more);
10391020 unsigned int idpf_size_to_txd_count(unsigned int size);
10401021 netdev_tx_t idpf_tx_drop_skb(struct idpf_tx_queue *tx_q, struct sk_buff *skb);
1041−void idpf_tx_dma_map_error(struct idpf_tx_queue *txq, struct sk_buff *skb,
1042− struct idpf_tx_buf *first, u16 ring_idx);
1043−unsigned int idpf_tx_desc_count_required(struct idpf_tx_queue *txq,
1044− struct sk_buff *skb);
1022+unsigned int idpf_tx_res_count_required(struct idpf_tx_queue *txq,
1023+ struct sk_buff *skb, u32 *buf_count);
10451024 void idpf_tx_timeout(struct net_device *netdev, unsigned int txqueue);
10461025 netdev_tx_t idpf_tx_singleq_frame(struct sk_buff *skb,
10471026 struct idpf_tx_queue *tx_q);
drivers/net/ethernet/intel/ixgbe/ixgbe_e610.c+1−1
@@ -3125,7 +3125,7 @@ static int ixgbe_get_orom_ver_info(struct ixgbe_hw *hw, · 3124 unmodified lines
31253125 if (err)
31263126 return err;
31273127
3128− combo_ver = le32_to_cpu(civd.combo_ver);
3128+ combo_ver = get_unaligned_le32(&civd.combo_ver);
31293129
31303130 orom->major = (u8)FIELD_GET(IXGBE_OROM_VER_MASK, combo_ver);
31313131 orom->patch = (u8)FIELD_GET(IXGBE_OROM_VER_PATCH_MASK, combo_ver);
drivers/net/ethernet/intel/ixgbe/ixgbe_type_e610.h+1−1
@@ -932,7 +932,7 @@ struct ixgbe_orom_civd_info { · 931 unmodified lines
932932 __le32 combo_ver; /* Combo Image Version number */
933933 u8 combo_name_len; /* Length of the unicode combo image version string, max of 32 */
934934 __le16 combo_name[32]; /* Unicode string representing the Combo Image version */
935−};
935+} __packed;
936936
937937 /* Function specific capabilities */
938938 struct ixgbe_hw_func_caps {
drivers/net/ethernet/marvell/octeontx2/af/cgx.c+7−0
@@ -1978,6 +1978,13 @@ static int cgx_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 1977 unmodified lines
19781978 goto err_release_regions;
19791979 }
19801980
1981+ if (!is_cn20k(pdev) &&
1982+ !is_cgx_mapped_to_nix(pdev->subsystem_device, cgx->cgx_id)) {
1983+ dev_notice(dev, "CGX %d not mapped to NIX, skipping probe\n",
1984+ cgx->cgx_id);
1985+ goto err_release_regions;
1986+ }
1987+
19811988 cgx->lmac_count = cgx->mac_ops->get_nr_lmacs(cgx);
19821989 if (!cgx->lmac_count) {
19831990 dev_notice(dev, "CGX %d LMAC count is zero, skipping probe\n", cgx->cgx_id);
drivers/net/ethernet/marvell/octeontx2/af/rvu.h+14−0
@@ -783,6 +783,20 @@ static inline bool is_cn10kb(struct rvu *rvu) · 782 unmodified lines
783783 return false;
784784 }
785785
786+static inline bool is_cgx_mapped_to_nix(unsigned short id, u8 cgx_id)
787+{
788+ /* On CNF10KA and CNF10KB silicons only two CGX blocks are connected
789+ * to NIX.
790+ */
791+ if (id == PCI_SUBSYS_DEVID_CNF10K_A || id == PCI_SUBSYS_DEVID_CNF10K_B)
792+ return cgx_id <= 1;
793+
794+ return !(cgx_id && !(id == PCI_SUBSYS_DEVID_96XX ||
795+ id == PCI_SUBSYS_DEVID_98XX ||
796+ id == PCI_SUBSYS_DEVID_CN10K_A ||
797+ id == PCI_SUBSYS_DEVID_CN10K_B));
798+}
799+
786800 static inline bool is_rvu_npc_hash_extract_en(struct rvu *rvu)
787801 {
788802 u64 npc_const3;
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c+3−1
@@ -124,7 +124,9 @@ void otx2_get_dev_stats(struct otx2_nic *pfvf) · 123 unmodified lines
124124 dev_stats->rx_ucast_frames;
125125
126126 dev_stats->tx_bytes = OTX2_GET_TX_STATS(TX_OCTS);
127− dev_stats->tx_drops = OTX2_GET_TX_STATS(TX_DROP);
127+ dev_stats->tx_drops = OTX2_GET_TX_STATS(TX_DROP) +
128+ (unsigned long)atomic_long_read(&dev_stats->tx_discards);
129+
128130 dev_stats->tx_bcast_frames = OTX2_GET_TX_STATS(TX_BCAST);
129131 dev_stats->tx_mcast_frames = OTX2_GET_TX_STATS(TX_MCAST);
130132 dev_stats->tx_ucast_frames = OTX2_GET_TX_STATS(TX_UCAST);
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h+1−0
@@ -153,6 +153,7 @@ struct otx2_dev_stats { · 152 unmodified lines
153153 u64 tx_bcast_frames;
154154 u64 tx_mcast_frames;
155155 u64 tx_drops;
156+ atomic_long_t tx_discards;
156157 };
157158
158159 /* Driver counted stats */
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c+3−0
@@ -2220,6 +2220,7 @@ static netdev_tx_t otx2_xmit(struct sk_buff *skb, struct net_device *netdev) · 2219 unmodified lines
22202220 {
22212221 struct otx2_nic *pf = netdev_priv(netdev);
22222222 int qidx = skb_get_queue_mapping(skb);
2223+ struct otx2_dev_stats *dev_stats;
22232224 struct otx2_snd_queue *sq;
22242225 struct netdev_queue *txq;
22252226 int sq_idx;
@@ -2232,6 +2233,8 @@ static netdev_tx_t otx2_xmit(struct sk_buff *skb, struct net_device *netdev) · 6 unmodified lines
22322233 /* Check for minimum and maximum packet length */
22332234 if (skb->len <= ETH_HLEN ||
22342235 (!skb_shinfo(skb)->gso_size && skb->len > pf->tx_max_pktlen)) {
2236+ dev_stats = &pf->hw.dev_stats;
2237+ atomic_long_inc(&dev_stats->tx_discards);
22352238 dev_kfree_skb(skb);
22362239 return NETDEV_TX_OK;
22372240 }
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c+10−0
@@ -417,9 +417,19 @@ static netdev_tx_t otx2vf_xmit(struct sk_buff *skb, struct net_device *netdev) · 416 unmodified lines
417417 {
418418 struct otx2_nic *vf = netdev_priv(netdev);
419419 int qidx = skb_get_queue_mapping(skb);
420+ struct otx2_dev_stats *dev_stats;
420421 struct otx2_snd_queue *sq;
421422 struct netdev_queue *txq;
422423
424+ /* Check for minimum and maximum packet length */
425+ if (skb->len <= ETH_HLEN ||
426+ (!skb_shinfo(skb)->gso_size && skb->len > vf->tx_max_pktlen)) {
427+ dev_stats = &vf->hw.dev_stats;
428+ atomic_long_inc(&dev_stats->tx_discards);
429+ dev_kfree_skb(skb);
430+ return NETDEV_TX_OK;
431+ }
432+
423433 sq = &vf->qset.sq[qidx];
424434 txq = netdev_get_tx_queue(netdev, qidx);
425435
drivers/net/ethernet/marvell/octeontx2/nic/rep.c+12−1
@@ -371,7 +371,8 @@ static void rvu_rep_get_stats(struct work_struct *work) · 370 unmodified lines
371371 stats->rx_mcast_frames = rsp->rx.mcast;
372372 stats->tx_bytes = rsp->tx.octs;
373373 stats->tx_frames = rsp->tx.ucast + rsp->tx.bcast + rsp->tx.mcast;
374− stats->tx_drops = rsp->tx.drop;
374+ stats->tx_drops = rsp->tx.drop +
375+ (unsigned long)atomic_long_read(&stats->tx_discards);
375376 exit:
376377 mutex_unlock(&priv->mbox.lock);
377378 }
@@ -418,6 +419,16 @@ static netdev_tx_t rvu_rep_xmit(struct sk_buff *skb, struct net_device *dev) · 40 unmodified lines
418419 struct otx2_nic *pf = rep->mdev;
419420 struct otx2_snd_queue *sq;
420421 struct netdev_queue *txq;
422+ struct rep_stats *stats;
423+
424+ /* Check for minimum and maximum packet length */
425+ if (skb->len <= ETH_HLEN ||
426+ (!skb_shinfo(skb)->gso_size && skb->len > pf->tx_max_pktlen)) {
427+ stats = &rep->stats;
428+ atomic_long_inc(&stats->tx_discards);
429+ dev_kfree_skb(skb);
430+ return NETDEV_TX_OK;
431+ }
421432
422433 sq = &pf->qset.sq[rep->rep_id];
423434 txq = netdev_get_tx_queue(dev, 0);
drivers/net/ethernet/marvell/octeontx2/nic/rep.h+1−0
@@ -27,6 +27,7 @@ struct rep_stats { · 26 unmodified lines
2727 u64 tx_bytes;
2828 u64 tx_frames;
2929 u64 tx_drops;
30+ atomic_long_t tx_discards;
3031 };
3132
3233 struct rep_dev {
drivers/net/ethernet/mellanox/mlx5/core/devlink.c+1−1
@@ -160,7 +160,7 @@ static int mlx5_devlink_reload_fw_activate(struct devlink *devlink, struct netli · 159 unmodified lines
160160 if (err)
161161 return err;
162162
163− mlx5_unload_one_devl_locked(dev, true);
163+ mlx5_sync_reset_unload_flow(dev, true);
164164 err = mlx5_health_wait_pci_up(dev);
165165 if (err)
166166 NL_SET_ERR_MSG_MOD(extack, "FW activate aborted, PCI reads fail after reset");
drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c+2−1
@@ -575,7 +575,6 @@ int mlx5e_port_manual_buffer_config(struct mlx5e_priv *priv, · 574 unmodified lines
575575 if (err)
576576 return err;
577577 }
578− priv->dcbx.xoff = xoff;
579578
580579 /* Apply the settings */
581580 if (update_buffer) {
@@ -584,6 +583,8 @@ int mlx5e_port_manual_buffer_config(struct mlx5e_priv *priv, · 2 unmodified lines
584583 return err;
585584 }
586585
586+ priv->dcbx.xoff = xoff;
587+
587588 if (update_prio2buffer)
588589 err = mlx5e_port_set_priority2buffer(priv->mdev, prio2buffer);
589590
drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.h+12−0
@@ -66,11 +66,23 @@ struct mlx5e_port_buffer { · 65 unmodified lines
6666 struct mlx5e_bufferx_reg buffer[MLX5E_MAX_NETWORK_BUFFER];
6767 };
6868
69+#ifdef CONFIG_MLX5_CORE_EN_DCB
6970 int mlx5e_port_manual_buffer_config(struct mlx5e_priv *priv,
7071 u32 change, unsigned int mtu,
7172 struct ieee_pfc *pfc,
7273 u32 *buffer_size,
7374 u8 *prio2buffer);
75+#else
76+static inline int
77+mlx5e_port_manual_buffer_config(struct mlx5e_priv *priv,
78+ u32 change, unsigned int mtu,
79+ void *pfc,
80+ u32 *buffer_size,
81+ u8 *prio2buffer)
82+{
83+ return 0;
84+}
85+#endif
7486
7587 int mlx5e_port_query_buffer(struct mlx5e_priv *priv,
7688 struct mlx5e_port_buffer *port_buffer);
drivers/net/ethernet/mellanox/mlx5/core/en_main.c+18−1
@@ -49,6 +49,7 @@ · 48 unmodified lines
4949 #include "en.h"
5050 #include "en/dim.h"
5151 #include "en/txrx.h"
52+#include "en/port_buffer.h"
5253 #include "en_tc.h"
5354 #include "en_rep.h"
5455 #include "en_accel/ipsec.h"
@@ -138,6 +139,8 @@ void mlx5e_update_carrier(struct mlx5e_priv *priv) · 83 unmodified lines
138139 if (up) {
139140 netdev_info(priv->netdev, "Link up\n");
140141 netif_carrier_on(priv->netdev);
142+ mlx5e_port_manual_buffer_config(priv, 0, priv->netdev->mtu,
143+ NULL, NULL, NULL);
141144 } else {
142145 netdev_info(priv->netdev, "Link down\n");
143146 netif_carrier_off(priv->netdev);
@@ -3040,9 +3043,11 @@ int mlx5e_set_dev_port_mtu(struct mlx5e_priv *priv) · 2896 unmodified lines
30403043 struct mlx5e_params *params = &priv->channels.params;
30413044 struct net_device *netdev = priv->netdev;
30423045 struct mlx5_core_dev *mdev = priv->mdev;
3043− u16 mtu;
3046+ u16 mtu, prev_mtu;
30443047 int err;
30453048
3049+ mlx5e_query_mtu(mdev, params, &prev_mtu);
3050+
30463051 err = mlx5e_set_mtu(mdev, params, params->sw_mtu);
30473052 if (err)
30483053 return err;
@@ -3052,6 +3057,18 @@ int mlx5e_set_dev_port_mtu(struct mlx5e_priv *priv) · 3 unmodified lines
30523057 netdev_warn(netdev, "%s: VPort MTU %d is different than netdev mtu %d\n",
30533058 __func__, mtu, params->sw_mtu);
30543059
3060+ if (mtu != prev_mtu && MLX5_BUFFER_SUPPORTED(mdev)) {
3061+ err = mlx5e_port_manual_buffer_config(priv, 0, mtu,
3062+ NULL, NULL, NULL);
3063+ if (err) {
3064+ netdev_warn(netdev, "%s: Failed to set Xon/Xoff values with MTU %d (err %d), setting back to previous MTU %d\n",
3065+ __func__, mtu, err, prev_mtu);
3066+
3067+ mlx5e_set_mtu(mdev, params, prev_mtu);
3068+ return err;
3069+ }
3070+ }
3071+
30553072 params->sw_mtu = mtu;
30563073 return 0;
30573074 }
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c+7−8
@@ -3734,6 +3734,13 @@ static int mlx5_fs_mode_validate(struct devlink *devlink, u32 id, · 3733 unmodified lines
37343734 char *value = val.vstr;
37353735 u8 eswitch_mode;
37363736
3737+ eswitch_mode = mlx5_eswitch_mode(dev);
3738+ if (eswitch_mode == MLX5_ESWITCH_OFFLOADS) {
3739+ NL_SET_ERR_MSG_FMT_MOD(extack,
3740+ "Changing fs mode is not supported when eswitch offloads enabled.");
3741+ return -EOPNOTSUPP;
3742+ }
3743+
37373744 if (!strcmp(value, "dmfs"))
37383745 return 0;
37393746
@@ -3759,14 +3766,6 @@ static int mlx5_fs_mode_validate(struct devlink *devlink, u32 id, · 19 unmodified lines
37593766 return -EINVAL;
37603767 }
37613768
3762− eswitch_mode = mlx5_eswitch_mode(dev);
3763− if (eswitch_mode == MLX5_ESWITCH_OFFLOADS) {
3764− NL_SET_ERR_MSG_FMT_MOD(extack,
3765− "Moving to %s is not supported when eswitch offloads enabled.",
3766− value);
3767− return -EOPNOTSUPP;
3768− }
3769−
37703769 return 0;
37713770 }
37723771
drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c+73−53
@@ -6,13 +6,15 @@ · 5 unmodified lines
66 #include "fw_reset.h"
77 #include "diag/fw_tracer.h"
88 #include "lib/tout.h"
9+#include "sf/sf.h"
910
1011 enum {
1112 MLX5_FW_RESET_FLAGS_RESET_REQUESTED,
1213 MLX5_FW_RESET_FLAGS_NACK_RESET_REQUEST,
1314 MLX5_FW_RESET_FLAGS_PENDING_COMP,
1415 MLX5_FW_RESET_FLAGS_DROP_NEW_REQUESTS,
15− MLX5_FW_RESET_FLAGS_RELOAD_REQUIRED
16+ MLX5_FW_RESET_FLAGS_RELOAD_REQUIRED,
17+ MLX5_FW_RESET_FLAGS_UNLOAD_EVENT,
1618 };
1719
1820 struct mlx5_fw_reset {
@@ -219,7 +221,7 @@ int mlx5_fw_reset_set_live_patch(struct mlx5_core_dev *dev) · 200 unmodified lines
219221 return mlx5_reg_mfrl_set(dev, MLX5_MFRL_REG_RESET_LEVEL0, 0, 0, false);
220222 }
221223
222−static void mlx5_fw_reset_complete_reload(struct mlx5_core_dev *dev, bool unloaded)
224+static void mlx5_fw_reset_complete_reload(struct mlx5_core_dev *dev)
223225 {
224226 struct mlx5_fw_reset *fw_reset = dev->priv.fw_reset;
225227 struct devlink *devlink = priv_to_devlink(dev);
@@ -228,8 +230,7 @@ static void mlx5_fw_reset_complete_reload(struct mlx5_core_dev *dev, bool unload · 2 unmodified lines
228230 if (test_bit(MLX5_FW_RESET_FLAGS_PENDING_COMP, &fw_reset->reset_flags)) {
229231 complete(&fw_reset->done);
230232 } else {
231− if (!unloaded)
232− mlx5_unload_one(dev, false);
233+ mlx5_sync_reset_unload_flow(dev, false);
233234 if (mlx5_health_wait_pci_up(dev))
234235 mlx5_core_err(dev, "reset reload flow aborted, PCI reads still not working\n");
235236 else
@@ -272,7 +273,7 @@ static void mlx5_sync_reset_reload_work(struct work_struct *work) · 36 unmodified lines
272273
273274 mlx5_sync_reset_clear_reset_requested(dev, false);
274275 mlx5_enter_error_state(dev, true);
275− mlx5_fw_reset_complete_reload(dev, false);
276+ mlx5_fw_reset_complete_reload(dev);
276277 }
277278
278279 #define MLX5_RESET_POLL_INTERVAL (HZ / 10)
@@ -428,6 +429,11 @@ static bool mlx5_is_reset_now_capable(struct mlx5_core_dev *dev, · 149 unmodified lines
428429 return false;
429430 }
430431
432+ if (!mlx5_core_is_ecpf(dev) && !mlx5_sf_table_empty(dev)) {
433+ mlx5_core_warn(dev, "SFs should be removed before reset\n");
434+ return false;
435+ }
436+
431437 #if IS_ENABLED(CONFIG_HOTPLUG_PCI_PCIE)
432438 if (reset_method != MLX5_MFRL_REG_PCI_RESET_METHOD_HOT_RESET) {
433439 err = mlx5_check_hotplug_interrupt(dev, bridge);
@@ -586,6 +592,65 @@ static int mlx5_sync_pci_reset(struct mlx5_core_dev *dev, u8 reset_method) · 152 unmodified lines
586592 return err;
587593 }
588594
595+void mlx5_sync_reset_unload_flow(struct mlx5_core_dev *dev, bool locked)
596+{
597+ struct mlx5_fw_reset *fw_reset = dev->priv.fw_reset;
598+ unsigned long timeout;
599+ int poll_freq = 20;
600+ bool reset_action;
601+ u8 rst_state;
602+ int err;
603+
604+ if (locked)
605+ mlx5_unload_one_devl_locked(dev, false);
606+ else
607+ mlx5_unload_one(dev, false);
608+
609+ if (!test_bit(MLX5_FW_RESET_FLAGS_UNLOAD_EVENT, &fw_reset->reset_flags))
610+ return;
611+
612+ mlx5_set_fw_rst_ack(dev);
613+ mlx5_core_warn(dev, "Sync Reset Unload done, device reset expected\n");
614+
615+ reset_action = false;
616+ timeout = jiffies + msecs_to_jiffies(mlx5_tout_ms(dev, RESET_UNLOAD));
617+ do {
618+ rst_state = mlx5_get_fw_rst_state(dev);
619+ if (rst_state == MLX5_FW_RST_STATE_TOGGLE_REQ ||
620+ rst_state == MLX5_FW_RST_STATE_IDLE) {
621+ reset_action = true;
622+ break;
623+ }
624+ if (rst_state == MLX5_FW_RST_STATE_DROP_MODE) {
625+ mlx5_core_info(dev, "Sync Reset Drop mode ack\n");
626+ mlx5_set_fw_rst_ack(dev);
627+ poll_freq = 1000;
628+ }
629+ msleep(poll_freq);
630+ } while (!time_after(jiffies, timeout));
631+
632+ if (!reset_action) {
633+ mlx5_core_err(dev, "Got timeout waiting for sync reset action, state = %u\n",
634+ rst_state);
635+ fw_reset->ret = -ETIMEDOUT;
636+ goto done;
637+ }
638+
639+ mlx5_core_warn(dev, "Sync Reset, got reset action. rst_state = %u\n",
640+ rst_state);
641+ if (rst_state == MLX5_FW_RST_STATE_TOGGLE_REQ) {
642+ err = mlx5_sync_pci_reset(dev, fw_reset->reset_method);
643+ if (err) {
644+ mlx5_core_warn(dev, "mlx5_sync_pci_reset failed, err %d\n",
645+ err);
646+ fw_reset->ret = err;
647+ }
648+ }
649+
650+done:
651+ clear_bit(MLX5_FW_RESET_FLAGS_UNLOAD_EVENT, &fw_reset->reset_flags);
652+}
653+
589654 static void mlx5_sync_reset_now_event(struct work_struct *work)
590655 {
591656 struct mlx5_fw_reset *fw_reset = container_of(work, struct mlx5_fw_reset,
@@ -613,17 +678,13 @@ static void mlx5_sync_reset_now_event(struct work_struct *work) · 21 unmodified lines
613678 mlx5_enter_error_state(dev, true);
614679 done:
615680 fw_reset->ret = err;
616− mlx5_fw_reset_complete_reload(dev, false);
681+ mlx5_fw_reset_complete_reload(dev);
617682 }
618683
619684 static void mlx5_sync_reset_unload_event(struct work_struct *work)
620685 {
621686 struct mlx5_fw_reset *fw_reset;
622687 struct mlx5_core_dev *dev;
623− unsigned long timeout;
624− int poll_freq = 20;
625− bool reset_action;
626− u8 rst_state;
627688 int err;
628689
629690 fw_reset = container_of(work, struct mlx5_fw_reset, reset_unload_work);
@@ -632,6 +693,7 @@ static void mlx5_sync_reset_unload_event(struct work_struct *work) · 2 unmodified lines
632693 if (mlx5_sync_reset_clear_reset_requested(dev, false))
633694 return;
634695
696+ set_bit(MLX5_FW_RESET_FLAGS_UNLOAD_EVENT, &fw_reset->reset_flags);
635697 mlx5_core_warn(dev, "Sync Reset Unload. Function is forced down.\n");
636698
637699 err = mlx5_cmd_fast_teardown_hca(dev);
@@ -640,49 +702,7 @@ static void mlx5_sync_reset_unload_event(struct work_struct *work) · 2 unmodified lines
640702 else
641703 mlx5_enter_error_state(dev, true);
642704
643− if (test_bit(MLX5_FW_RESET_FLAGS_PENDING_COMP, &fw_reset->reset_flags))
644− mlx5_unload_one_devl_locked(dev, false);
645− else
646− mlx5_unload_one(dev, false);
647−
648− mlx5_set_fw_rst_ack(dev);
649− mlx5_core_warn(dev, "Sync Reset Unload done, device reset expected\n");
650−
651− reset_action = false;
652− timeout = jiffies + msecs_to_jiffies(mlx5_tout_ms(dev, RESET_UNLOAD));
653− do {
654− rst_state = mlx5_get_fw_rst_state(dev);
655− if (rst_state == MLX5_FW_RST_STATE_TOGGLE_REQ ||
656− rst_state == MLX5_FW_RST_STATE_IDLE) {
657− reset_action = true;
658− break;
659− }
660− if (rst_state == MLX5_FW_RST_STATE_DROP_MODE) {
661− mlx5_core_info(dev, "Sync Reset Drop mode ack\n");
662− mlx5_set_fw_rst_ack(dev);
663− poll_freq = 1000;
664− }
665− msleep(poll_freq);
666− } while (!time_after(jiffies, timeout));
667−
668− if (!reset_action) {
669− mlx5_core_err(dev, "Got timeout waiting for sync reset action, state = %u\n",
670− rst_state);
671− fw_reset->ret = -ETIMEDOUT;
672− goto done;
673− }
674−
675− mlx5_core_warn(dev, "Sync Reset, got reset action. rst_state = %u\n", rst_state);
676− if (rst_state == MLX5_FW_RST_STATE_TOGGLE_REQ) {
677− err = mlx5_sync_pci_reset(dev, fw_reset->reset_method);
678− if (err) {
679− mlx5_core_warn(dev, "mlx5_sync_pci_reset failed, err %d\n", err);
680− fw_reset->ret = err;
681− }
682− }
683−
684−done:
685− mlx5_fw_reset_complete_reload(dev, true);
705+ mlx5_fw_reset_complete_reload(dev);
686706 }
687707
688708 static void mlx5_sync_reset_abort_event(struct work_struct *work)
drivers/net/ethernet/mellanox/mlx5/core/fw_reset.h+1−0
@@ -12,6 +12,7 @@ int mlx5_fw_reset_set_reset_sync(struct mlx5_core_dev *dev, u8 reset_type_sel, · 11 unmodified lines
1212 int mlx5_fw_reset_set_live_patch(struct mlx5_core_dev *dev);
1313
1414 int mlx5_fw_reset_wait_reset_done(struct mlx5_core_dev *dev);
15+void mlx5_sync_reset_unload_flow(struct mlx5_core_dev *dev, bool locked);
1516 int mlx5_fw_reset_verify_fw_complete(struct mlx5_core_dev *dev,
1617 struct netlink_ext_ack *extack);
1718 void mlx5_fw_reset_events_start(struct mlx5_core_dev *dev);
drivers/net/ethernet/mellanox/mlx5/core/sf/devlink.c+10−0
@@ -518,3 +518,13 @@ void mlx5_sf_table_cleanup(struct mlx5_core_dev *dev) · 517 unmodified lines
518518 WARN_ON(!xa_empty(&table->function_ids));
519519 kfree(table);
520520 }
521+
522+bool mlx5_sf_table_empty(const struct mlx5_core_dev *dev)
523+{
524+ struct mlx5_sf_table *table = dev->priv.sf_table;
525+
526+ if (!table)
527+ return true;
528+
529+ return xa_empty(&table->function_ids);
530+}
drivers/net/ethernet/mellanox/mlx5/core/sf/sf.h+6−0
@@ -17,6 +17,7 @@ void mlx5_sf_hw_table_destroy(struct mlx5_core_dev *dev); · 16 unmodified lines
1717
1818 int mlx5_sf_table_init(struct mlx5_core_dev *dev);
1919 void mlx5_sf_table_cleanup(struct mlx5_core_dev *dev);
20+bool mlx5_sf_table_empty(const struct mlx5_core_dev *dev);
2021
2122 int mlx5_devlink_sf_port_new(struct devlink *devlink,
2223 const struct devlink_port_new_attrs *add_attr,
@@ -61,6 +62,11 @@ static inline void mlx5_sf_table_cleanup(struct mlx5_core_dev *dev) · 38 unmodified lines
6162 {
6263 }
6364
65+static inline bool mlx5_sf_table_empty(const struct mlx5_core_dev *dev)
66+{
67+ return true;
68+}
69+
6470 #endif
6571
6672 #endif
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/action.c+1−1
@@ -117,7 +117,7 @@ static int hws_action_get_shared_stc_nic(struct mlx5hws_context *ctx, · 116 unmodified lines
117117 mlx5hws_err(ctx, "No such stc_type: %d\n", stc_type);
118118 pr_warn("HWS: Invalid stc_type: %d\n", stc_type);
119119 ret = -EINVAL;
120− goto unlock_and_out;
120+ goto free_shared_stc;
121121 }
122122
123123 ret = mlx5hws_action_alloc_single_stc(ctx, &stc_attr, tbl_type,
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pat_arg.c+4−2
@@ -279,7 +279,7 @@ int mlx5hws_pat_get_pattern(struct mlx5hws_context *ctx, · 278 unmodified lines
279279 return ret;
280280
281281 clean_pattern:
282− mlx5hws_cmd_header_modify_pattern_destroy(ctx->mdev, *pattern_id);
282+ mlx5hws_cmd_header_modify_pattern_destroy(ctx->mdev, ptrn_id);
283283 out_unlock:
284284 mutex_unlock(&ctx->pattern_cache->lock);
285285 return ret;
@@ -527,7 +527,6 @@ int mlx5hws_pat_calc_nop(__be64 *pattern, size_t num_actions, · 241 unmodified lines
527527 u32 *nop_locations, __be64 *new_pat)
528528 {
529529 u16 prev_src_field = INVALID_FIELD, prev_dst_field = INVALID_FIELD;
530− u16 src_field, dst_field;
531530 u8 action_type;
532531 bool dependent;
533532 size_t i, j;
@@ -539,6 +538,9 @@ int mlx5hws_pat_calc_nop(__be64 *pattern, size_t num_actions, · 5 unmodified lines
539538 return 0;
540539
541540 for (i = 0, j = 0; i < num_actions; i++, j++) {
541+ u16 src_field = INVALID_FIELD;
542+ u16 dst_field = INVALID_FIELD;
543+
542544 if (j >= max_actions)
543545 return -EINVAL;
544546
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pool.c+1−0
@@ -124,6 +124,7 @@ static int hws_pool_buddy_init(struct mlx5hws_pool *pool) · 123 unmodified lines
124124 mlx5hws_err(pool->ctx, "Failed to create resource type: %d size %zu\n",
125125 pool->type, pool->alloc_log_sz);
126126 mlx5hws_buddy_cleanup(buddy);
127+ kfree(buddy);
127128 return -ENOMEM;
128129 }
129130
drivers/net/ethernet/meta/fbnic/fbnic_netdev.c+4−0
@@ -52,6 +52,8 @@ int __fbnic_open(struct fbnic_net *fbn) · 51 unmodified lines
5252 fbnic_bmc_rpc_init(fbd);
5353 fbnic_rss_reinit(fbd, fbn);
5454
55+ phylink_resume(fbn->phylink);
56+
5557 return 0;
5658 time_stop:
5759 fbnic_time_stop(fbn);
@@ -84,6 +86,8 @@ static int fbnic_stop(struct net_device *netdev) · 26 unmodified lines
8486 {
8587 struct fbnic_net *fbn = netdev_priv(netdev);
8688
89+ phylink_suspend(fbn->phylink, fbnic_bmc_present(fbn->fbd));
90+
8791 fbnic_down(fbn);
8892 fbnic_pcs_free_irq(fbn->fbd);
8993
drivers/net/ethernet/meta/fbnic/fbnic_pci.c+6−9
@@ -118,14 +118,12 @@ static void fbnic_service_task_start(struct fbnic_net *fbn) · 117 unmodified lines
118118 struct fbnic_dev *fbd = fbn->fbd;
119119
120120 schedule_delayed_work(&fbd->service_task, HZ);
121− phylink_resume(fbn->phylink);
122121 }
123122
124123 static void fbnic_service_task_stop(struct fbnic_net *fbn)
125124 {
126125 struct fbnic_dev *fbd = fbn->fbd;
127126
128− phylink_suspend(fbn->phylink, fbnic_bmc_present(fbd));
129127 cancel_delayed_work(&fbd->service_task);
130128 }
131129
@@ -444,11 +442,10 @@ static int __fbnic_pm_resume(struct device *dev) · 312 unmodified lines
444442
445443 /* Re-enable mailbox */
446444 err = fbnic_fw_request_mbx(fbd);
445+ devl_unlock(priv_to_devlink(fbd));
447446 if (err)
448447 goto err_free_irqs;
449448
450− devl_unlock(priv_to_devlink(fbd));
451−
452449 /* Only send log history if log buffer is empty to prevent duplicate
453450 * log entries.
454451 */
@@ -465,20 +462,20 @@ static int __fbnic_pm_resume(struct device *dev) · 10 unmodified lines
465462
466463 rtnl_lock();
467464
468− if (netif_running(netdev)) {
465+ if (netif_running(netdev))
469466 err = __fbnic_open(fbn);
470− if (err)
471− goto err_free_mbx;
472− }
473467
474468 rtnl_unlock();
469+ if (err)
470+ goto err_free_mbx;
475471
476472 return 0;
477473 err_free_mbx:
478474 fbnic_fw_log_disable(fbd);
479475
480− rtnl_unlock();
476+ devl_lock(priv_to_devlink(fbd));
481477 fbnic_fw_free_mbx(fbd);
478+ devl_unlock(priv_to_devlink(fbd));
482479 err_free_irqs:
483480 fbnic_free_irqs(fbd);
484481 err_invalidate_uc_addr:
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c+11−2
@@ -49,6 +49,14 @@ static void dwxgmac2_core_init(struct mac_device_info *hw, · 48 unmodified lines
4949 writel(XGMAC_INT_DEFAULT_EN, ioaddr + XGMAC_INT_EN);
5050 }
5151
52+static void dwxgmac2_update_caps(struct stmmac_priv *priv)
53+{
54+ if (!priv->dma_cap.mbps_10_100)
55+ priv->hw->link.caps &= ~(MAC_10 | MAC_100);
56+ else if (!priv->dma_cap.half_duplex)
57+ priv->hw->link.caps &= ~(MAC_10HD | MAC_100HD);
58+}
59+
5260 static void dwxgmac2_set_mac(void __iomem *ioaddr, bool enable)
5361 {
5462 u32 tx = readl(ioaddr + XGMAC_TX_CONFIG);
@@ -1424,6 +1432,7 @@ static void dwxgmac2_set_arp_offload(struct mac_device_info *hw, bool en, · 1369 unmodified lines
14241432
14251433 const struct stmmac_ops dwxgmac210_ops = {
14261434 .core_init = dwxgmac2_core_init,
1435+ .update_caps = dwxgmac2_update_caps,
14271436 .set_mac = dwxgmac2_set_mac,
14281437 .rx_ipc = dwxgmac2_rx_ipc,
14291438 .rx_queue_enable = dwxgmac2_rx_queue_enable,
@@ -1532,8 +1541,8 @@ int dwxgmac2_setup(struct stmmac_priv *priv) · 102 unmodified lines
15321541 mac->mcast_bits_log2 = ilog2(mac->multicast_filter_bins);
15331542
15341543 mac->link.caps = MAC_ASYM_PAUSE | MAC_SYM_PAUSE |
1535− MAC_1000FD | MAC_2500FD | MAC_5000FD |
1536− MAC_10000FD;
1544+ MAC_10 | MAC_100 | MAC_1000FD |
1545+ MAC_2500FD | MAC_5000FD | MAC_10000FD;
15371546 mac->link.duplex = 0;
15381547 mac->link.speed10 = XGMAC_CONFIG_SS_10_MII;
15391548 mac->link.speed100 = XGMAC_CONFIG_SS_100_MII;
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c+5−4
@@ -203,10 +203,6 @@ static void dwxgmac2_dma_rx_mode(struct stmmac_priv *priv, void __iomem *ioaddr, · 202 unmodified lines
203203 }
204204
205205 writel(value, ioaddr + XGMAC_MTL_RXQ_OPMODE(channel));
206−
207− /* Enable MTL RX overflow */
208− value = readl(ioaddr + XGMAC_MTL_QINTEN(channel));
209− writel(value | XGMAC_RXOIE, ioaddr + XGMAC_MTL_QINTEN(channel));
210206 }
211207
212208 static void dwxgmac2_dma_tx_mode(struct stmmac_priv *priv, void __iomem *ioaddr,
@@ -386,8 +382,11 @@ static int dwxgmac2_dma_interrupt(struct stmmac_priv *priv, · 173 unmodified lines
386382 static int dwxgmac2_get_hw_feature(void __iomem *ioaddr,
387383 struct dma_features *dma_cap)
388384 {
385+ struct stmmac_priv *priv;
389386 u32 hw_cap;
390387
388+ priv = container_of(dma_cap, struct stmmac_priv, dma_cap);
389+
391390 /* MAC HW feature 0 */
392391 hw_cap = readl(ioaddr + XGMAC_HW_FEATURE0);
393392 dma_cap->edma = (hw_cap & XGMAC_HWFEAT_EDMA) >> 31;
@@ -410,6 +409,8 @@ static int dwxgmac2_get_hw_feature(void __iomem *ioaddr, · 16 unmodified lines
410409 dma_cap->vlhash = (hw_cap & XGMAC_HWFEAT_VLHASH) >> 4;
411410 dma_cap->half_duplex = (hw_cap & XGMAC_HWFEAT_HDSEL) >> 3;
412411 dma_cap->mbps_1000 = (hw_cap & XGMAC_HWFEAT_GMIISEL) >> 1;
412+ if (dma_cap->mbps_1000 && priv->synopsys_id >= DWXGMAC_CORE_2_20)
413+ dma_cap->mbps_10_100 = 1;
413414
414415 /* MAC HW feature 1 */
415416 hw_cap = readl(ioaddr + XGMAC_HW_FEATURE1);
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+4−2
@@ -2586,6 +2586,7 @@ static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget) · 2585 unmodified lines
25862586 struct netdev_queue *nq = netdev_get_tx_queue(priv->dev, queue);
25872587 struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue];
25882588 struct stmmac_txq_stats *txq_stats = &priv->xstats.txq_stats[queue];
2589+ bool csum = !priv->plat->tx_queues_cfg[queue].coe_unsupported;
25892590 struct xsk_buff_pool *pool = tx_q->xsk_pool;
25902591 unsigned int entry = tx_q->cur_tx;
25912592 struct dma_desc *tx_desc = NULL;
@@ -2673,7 +2674,7 @@ static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget) · 81 unmodified lines
26732674 }
26742675
26752676 stmmac_prepare_tx_desc(priv, tx_desc, 1, xdp_desc.len,
2676− true, priv->mode, true, true,
2677+ csum, priv->mode, true, true,
26772678 xdp_desc.len);
26782679
26792680 stmmac_enable_dma_transmission(priv, priv->ioaddr, queue);
@@ -4988,6 +4989,7 @@ static int stmmac_xdp_xmit_xdpf(struct stmmac_priv *priv, int queue, · 2308 unmodified lines
49884989 {
49894990 struct stmmac_txq_stats *txq_stats = &priv->xstats.txq_stats[queue];
49904991 struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue];
4992+ bool csum = !priv->plat->tx_queues_cfg[queue].coe_unsupported;
49914993 unsigned int entry = tx_q->cur_tx;
49924994 struct dma_desc *tx_desc;
49934995 dma_addr_t dma_addr;
@@ -5039,7 +5041,7 @@ static int stmmac_xdp_xmit_xdpf(struct stmmac_priv *priv, int queue, · 45 unmodified lines
50395041 stmmac_set_desc_addr(priv, tx_desc, dma_addr);
50405042
50415043 stmmac_prepare_tx_desc(priv, tx_desc, 1, xdpf->len,
5042− true, priv->mode, true, true,
5044+ csum, priv->mode, true, true,
50435045 xdpf->len);
50445046
50455047 tx_q->tx_count_frames++;
drivers/net/hyperv/netvsc.c+8−9
@@ -1812,6 +1812,11 @@ struct netvsc_device *netvsc_device_add(struct hv_device *device, · 1811 unmodified lines
18121812
18131813 /* Enable NAPI handler before init callbacks */
18141814 netif_napi_add(ndev, &net_device->chan_table[0].napi, netvsc_poll);
1815+ napi_enable(&net_device->chan_table[0].napi);
1816+ netif_queue_set_napi(ndev, 0, NETDEV_QUEUE_TYPE_RX,
1817+ &net_device->chan_table[0].napi);
1818+ netif_queue_set_napi(ndev, 0, NETDEV_QUEUE_TYPE_TX,
1819+ &net_device->chan_table[0].napi);
18151820
18161821 /* Open the channel */
18171822 device->channel->next_request_id_callback = vmbus_next_request_id;
@@ -1831,12 +1836,6 @@ struct netvsc_device *netvsc_device_add(struct hv_device *device, · 13 unmodified lines
18311836 /* Channel is opened */
18321837 netdev_dbg(ndev, "hv_netvsc channel opened successfully\n");
18331838
1834− napi_enable(&net_device->chan_table[0].napi);
1835− netif_queue_set_napi(ndev, 0, NETDEV_QUEUE_TYPE_RX,
1836− &net_device->chan_table[0].napi);
1837− netif_queue_set_napi(ndev, 0, NETDEV_QUEUE_TYPE_TX,
1838− &net_device->chan_table[0].napi);
1839−
18401839 /* Connect with the NetVsp */
18411840 ret = netvsc_connect_vsp(device, net_device, device_info);
18421841 if (ret != 0) {
@@ -1854,14 +1853,14 @@ struct netvsc_device *netvsc_device_add(struct hv_device *device, · 11 unmodified lines
18541853
18551854 close:
18561855 RCU_INIT_POINTER(net_device_ctx->nvdev, NULL);
1857− netif_queue_set_napi(ndev, 0, NETDEV_QUEUE_TYPE_TX, NULL);
1858− netif_queue_set_napi(ndev, 0, NETDEV_QUEUE_TYPE_RX, NULL);
1859− napi_disable(&net_device->chan_table[0].napi);
18601856
18611857 /* Now, we can close the channel safely */
18621858 vmbus_close(device->channel);
18631859
18641860 cleanup:
1861+ netif_queue_set_napi(ndev, 0, NETDEV_QUEUE_TYPE_TX, NULL);
1862+ netif_queue_set_napi(ndev, 0, NETDEV_QUEUE_TYPE_RX, NULL);
1863+ napi_disable(&net_device->chan_table[0].napi);
18651864 netif_napi_del(&net_device->chan_table[0].napi);
18661865
18671866 cleanup2:
drivers/net/hyperv/rndis_filter.c+16−7
@@ -1252,17 +1252,26 @@ static void netvsc_sc_open(struct vmbus_channel *new_sc) · 1251 unmodified lines
12521252 new_sc->rqstor_size = netvsc_rqstor_size(netvsc_ring_bytes);
12531253 new_sc->max_pkt_size = NETVSC_MAX_PKT_SIZE;
12541254
1255+ /* Enable napi before opening the vmbus channel to avoid races
1256+ * as the host placing data on the host->guest ring may be left
1257+ * out if napi was not enabled.
1258+ */
1259+ napi_enable(&nvchan->napi);
1260+ netif_queue_set_napi(ndev, chn_index, NETDEV_QUEUE_TYPE_RX,
1261+ &nvchan->napi);
1262+ netif_queue_set_napi(ndev, chn_index, NETDEV_QUEUE_TYPE_TX,
1263+ &nvchan->napi);
1264+
12551265 ret = vmbus_open(new_sc, netvsc_ring_bytes,
12561266 netvsc_ring_bytes, NULL, 0,
12571267 netvsc_channel_cb, nvchan);
1258− if (ret == 0) {
1259− napi_enable(&nvchan->napi);
1260− netif_queue_set_napi(ndev, chn_index, NETDEV_QUEUE_TYPE_RX,
1261− &nvchan->napi);
1262− netif_queue_set_napi(ndev, chn_index, NETDEV_QUEUE_TYPE_TX,
1263− &nvchan->napi);
1264− } else {
1268+ if (ret != 0) {
12651269 netdev_notice(ndev, "sub channel open failed: %d\n", ret);
1270+ netif_queue_set_napi(ndev, chn_index, NETDEV_QUEUE_TYPE_TX,
1271+ NULL);
1272+ netif_queue_set_napi(ndev, chn_index, NETDEV_QUEUE_TYPE_RX,
1273+ NULL);
1274+ napi_disable(&nvchan->napi);
12661275 }
12671276
12681277 if (atomic_inc_return(&nvscdev->open_chn) == nvscdev->num_chn)
drivers/net/phy/mscc/mscc.h+4−0
@@ -484,6 +484,7 @@ static inline void vsc8584_config_macsec_intr(struct phy_device *phydev) · 483 unmodified lines
484484 void vsc85xx_link_change_notify(struct phy_device *phydev);
485485 void vsc8584_config_ts_intr(struct phy_device *phydev);
486486 int vsc8584_ptp_init(struct phy_device *phydev);
487+void vsc8584_ptp_deinit(struct phy_device *phydev);
487488 int vsc8584_ptp_probe_once(struct phy_device *phydev);
488489 int vsc8584_ptp_probe(struct phy_device *phydev);
489490 irqreturn_t vsc8584_handle_ts_interrupt(struct phy_device *phydev);
@@ -498,6 +499,9 @@ static inline int vsc8584_ptp_init(struct phy_device *phydev) · 8 unmodified lines
498499 {
499500 return 0;
500501 }
502+static inline void vsc8584_ptp_deinit(struct phy_device *phydev)
503+{
504+}
501505 static inline int vsc8584_ptp_probe_once(struct phy_device *phydev)
502506 {
503507 return 0;
drivers/net/phy/mscc/mscc_main.c+1−3
@@ -2359,9 +2359,7 @@ static int vsc85xx_probe(struct phy_device *phydev) · 2358 unmodified lines
23592359
23602360 static void vsc85xx_remove(struct phy_device *phydev)
23612361 {
2362− struct vsc8531_private *priv = phydev->priv;
2363−
2364− skb_queue_purge(&priv->rx_skbs_list);
2362+ vsc8584_ptp_deinit(phydev);
23652363 }
23662364
23672365 /* Microsemi VSC85xx PHYs */
drivers/net/phy/mscc/mscc_ptp.c+21−13
@@ -1298,7 +1298,6 @@ static void vsc8584_set_input_clk_configured(struct phy_device *phydev) · 1297 unmodified lines
12981298
12991299 static int __vsc8584_init_ptp(struct phy_device *phydev)
13001300 {
1301− struct vsc8531_private *vsc8531 = phydev->priv;
13021301 static const u32 ltc_seq_e[] = { 0, 400000, 0, 0, 0 };
13031302 static const u8 ltc_seq_a[] = { 8, 6, 5, 4, 2 };
13041303 u32 val;
@@ -1515,17 +1514,7 @@ static int __vsc8584_init_ptp(struct phy_device *phydev) · 210 unmodified lines
15151514
15161515 vsc85xx_ts_eth_cmp1_sig(phydev);
15171516
1518− vsc8531->mii_ts.rxtstamp = vsc85xx_rxtstamp;
1519− vsc8531->mii_ts.txtstamp = vsc85xx_txtstamp;
1520− vsc8531->mii_ts.hwtstamp = vsc85xx_hwtstamp;
1521− vsc8531->mii_ts.ts_info = vsc85xx_ts_info;
1522− phydev->mii_ts = &vsc8531->mii_ts;
1523−
1524− memcpy(&vsc8531->ptp->caps, &vsc85xx_clk_caps, sizeof(vsc85xx_clk_caps));
1525−
1526− vsc8531->ptp->ptp_clock = ptp_clock_register(&vsc8531->ptp->caps,
1527− &phydev->mdio.dev);
1528− return PTR_ERR_OR_ZERO(vsc8531->ptp->ptp_clock);
1517+ return 0;
15291518 }
15301519
15311520 void vsc8584_config_ts_intr(struct phy_device *phydev)
@@ -1552,6 +1541,16 @@ int vsc8584_ptp_init(struct phy_device *phydev) · 20 unmodified lines
15521541 return 0;
15531542 }
15541543
1544+void vsc8584_ptp_deinit(struct phy_device *phydev)
1545+{
1546+ struct vsc8531_private *vsc8531 = phydev->priv;
1547+
1548+ if (vsc8531->ptp->ptp_clock) {
1549+ ptp_clock_unregister(vsc8531->ptp->ptp_clock);
1550+ skb_queue_purge(&vsc8531->rx_skbs_list);
1551+ }
1552+}
1553+
15551554 irqreturn_t vsc8584_handle_ts_interrupt(struct phy_device *phydev)
15561555 {
15571556 struct vsc8531_private *priv = phydev->priv;
@@ -1612,7 +1611,16 @@ int vsc8584_ptp_probe(struct phy_device *phydev) · 54 unmodified lines
16121611
16131612 vsc8531->ptp->phydev = phydev;
16141613
1615− return 0;
1614+ vsc8531->mii_ts.rxtstamp = vsc85xx_rxtstamp;
1615+ vsc8531->mii_ts.txtstamp = vsc85xx_txtstamp;
1616+ vsc8531->mii_ts.hwtstamp = vsc85xx_hwtstamp;
1617+ vsc8531->mii_ts.ts_info = vsc85xx_ts_info;
1618+ phydev->mii_ts = &vsc8531->mii_ts;
1619+
1620+ memcpy(&vsc8531->ptp->caps, &vsc85xx_clk_caps, sizeof(vsc85xx_clk_caps));
1621+ vsc8531->ptp->ptp_clock = ptp_clock_register(&vsc8531->ptp->caps,
1622+ &phydev->mdio.dev);
1623+ return PTR_ERR_OR_ZERO(vsc8531->ptp->ptp_clock);
16161624 }
16171625
16181626 int vsc8584_ptp_probe_once(struct phy_device *phydev)
drivers/net/usb/qmi_wwan.c+3−0
@@ -1355,6 +1355,9 @@ static const struct usb_device_id products[] = { · 1354 unmodified lines
13551355 {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */
13561356 {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */
13571357 {QMI_QUIRK_SET_DTR(0x1bc7, 0x1031, 3)}, /* Telit LE910C1-EUX */
1358+ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1034, 2)}, /* Telit LE910C4-WWX */
1359+ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1037, 4)}, /* Telit LE910C4-WWX */
1360+ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1038, 3)}, /* Telit LE910C4-WWX */
13581361 {QMI_QUIRK_SET_DTR(0x1bc7, 0x103a, 0)}, /* Telit LE910C4-WWX */
13591362 {QMI_QUIRK_SET_DTR(0x1bc7, 0x1040, 2)}, /* Telit LE922A */
13601363 {QMI_QUIRK_SET_DTR(0x1bc7, 0x1050, 2)}, /* Telit FN980 */
drivers/net/virtio_net.c+4−3
@@ -5758,14 +5758,15 @@ static void virtnet_freeze_down(struct virtio_device *vdev) · 5757 unmodified lines
57585758 disable_rx_mode_work(vi);
57595759 flush_work(&vi->rx_mode_work);
57605760
5761− netif_tx_lock_bh(vi->dev);
5762− netif_device_detach(vi->dev);
5763− netif_tx_unlock_bh(vi->dev);
57645761 if (netif_running(vi->dev)) {
57655762 rtnl_lock();
57665763 virtnet_close(vi->dev);
57675764 rtnl_unlock();
57685765 }
5766+
5767+ netif_tx_lock_bh(vi->dev);
5768+ netif_device_detach(vi->dev);
5769+ netif_tx_unlock_bh(vi->dev);
57695770 }
57705771
57715772 static int init_vqs(struct virtnet_info *vi);
drivers/of/device.c+2−2
@@ -17,8 +17,8 @@ · 16 unmodified lines
1717
1818 /**
1919 * of_match_device - Tell if a struct device matches an of_device_id list
20− * @matches: array of of device match structures to search in
21− * @dev: the of device structure to match against
20+ * @matches: array of of_device_id match structures to search in
21+ * @dev: the OF device structure to match against
2222 *
2323 * Used by a driver to check whether an platform_device present in the
2424 * system is in its list of supported devices.
drivers/of/dynamic.c+7−2
@@ -935,10 +935,15 @@ static int of_changeset_add_prop_helper(struct of_changeset *ocs, · 934 unmodified lines
935935 return -ENOMEM;
936936
937937 ret = of_changeset_add_property(ocs, np, new_pp);
938− if (ret)
938+ if (ret) {
939939 __of_prop_free(new_pp);
940+ return ret;
941+ }
940942
941− return ret;
943+ new_pp->next = np->deadprops;
944+ np->deadprops = new_pp;
945+
946+ return 0;
942947 }
943948
944949 /**
drivers/of/of_reserved_mem.c+13−4
@@ -25,6 +25,7 @@ · 24 unmodified lines
2525 #include <linux/memblock.h>
2626 #include <linux/kmemleak.h>
2727 #include <linux/cma.h>
28+#include <linux/dma-map-ops.h>
2829
2930 #include "of_private.h"
3031
@@ -175,13 +176,17 @@ static int __init __reserved_mem_reserve_reg(unsigned long node, · 144 unmodified lines
175176 base = dt_mem_next_cell(dt_root_addr_cells, &prop);
176177 size = dt_mem_next_cell(dt_root_size_cells, &prop);
177178
178− if (size &&
179− early_init_dt_reserve_memory(base, size, nomap) == 0)
179+ if (size && early_init_dt_reserve_memory(base, size, nomap) == 0) {
180+ /* Architecture specific contiguous memory fixup. */
181+ if (of_flat_dt_is_compatible(node, "shared-dma-pool") &&
182+ of_get_flat_dt_prop(node, "reusable", NULL))
183+ dma_contiguous_early_fixup(base, size);
180184 pr_debug("Reserved memory: reserved region for node '%s': base %pa, size %lu MiB\n",
181185 uname, &base, (unsigned long)(size / SZ_1M));
182− else
186+ } else {
183187 pr_err("Reserved memory: failed to reserve memory for node '%s': base %pa, size %lu MiB\n",
184188 uname, &base, (unsigned long)(size / SZ_1M));
189+ }
185190
186191 len -= t_len;
187192 }
@@ -472,7 +477,10 @@ static int __init __reserved_mem_alloc_size(unsigned long node, const char *unam · 284 unmodified lines
472477 uname, (unsigned long)(size / SZ_1M));
473478 return -ENOMEM;
474479 }
475−
480+ /* Architecture specific contiguous memory fixup. */
481+ if (of_flat_dt_is_compatible(node, "shared-dma-pool") &&
482+ of_get_flat_dt_prop(node, "reusable", NULL))
483+ dma_contiguous_early_fixup(base, size);
476484 /* Save region in the reserved_mem array */
477485 fdt_reserved_mem_save_node(node, uname, base, size);
478486 return 0;
@@ -771,6 +779,7 @@ int of_reserved_mem_region_to_resource(const struct device_node *np, · 292 unmodified lines
771779 return -EINVAL;
772780
773781 resource_set_range(res, rmem->base, rmem->size);
782+ res->flags = IORESOURCE_MEM;
774783 res->name = rmem->name;
775784 return 0;
776785 }
drivers/pinctrl/Kconfig+1−0
@@ -539,6 +539,7 @@ config PINCTRL_STMFX · 538 unmodified lines
539539 tristate "STMicroelectronics STMFX GPIO expander pinctrl driver"
540540 depends on I2C
541541 depends on OF_GPIO
542+ depends on HAS_IOMEM
542543 select GENERIC_PINCONF
543544 select GPIOLIB_IRQCHIP
544545 select MFD_STMFX
drivers/pinctrl/mediatek/pinctrl-airoha.c+4−4
@@ -2696,7 +2696,7 @@ static int airoha_pinconf_get(struct pinctrl_dev *pctrl_dev, · 2695 unmodified lines
26962696 arg = 1;
26972697 break;
26982698 default:
2699− return -EOPNOTSUPP;
2699+ return -ENOTSUPP;
27002700 }
27012701
27022702 *config = pinconf_to_config_packed(param, arg);
@@ -2788,7 +2788,7 @@ static int airoha_pinconf_set(struct pinctrl_dev *pctrl_dev, · 85 unmodified lines
27882788 break;
27892789 }
27902790 default:
2791− return -EOPNOTSUPP;
2791+ return -ENOTSUPP;
27922792 }
27932793 }
27942794
@@ -2805,10 +2805,10 @@ static int airoha_pinconf_group_get(struct pinctrl_dev *pctrl_dev, · 10 unmodified lines
28052805 if (airoha_pinconf_get(pctrl_dev,
28062806 airoha_pinctrl_groups[group].pins[i],
28072807 config))
2808− return -EOPNOTSUPP;
2808+ return -ENOTSUPP;
28092809
28102810 if (i && cur_config != *config)
2811− return -EOPNOTSUPP;
2811+ return -ENOTSUPP;
28122812
28132813 cur_config = *config;
28142814 }
drivers/pinctrl/meson/pinctrl-amlogic-a4.c+1−1
@@ -1093,7 +1093,7 @@ static const struct of_device_id aml_pctl_of_match[] = { · 1092 unmodified lines
10931093 { .compatible = "amlogic,pinctrl-s6", .data = &s6_priv_data, },
10941094 { /* sentinel */ }
10951095 };
1096−MODULE_DEVICE_TABLE(of, aml_pctl_dt_match);
1096+MODULE_DEVICE_TABLE(of, aml_pctl_of_match);
10971097
10981098 static struct platform_driver aml_pctl_driver = {
10991099 .driver = {
drivers/platform/x86/amd/hsmp/acpi.c+1−1
@@ -504,7 +504,7 @@ static int init_acpi(struct device *dev) · 503 unmodified lines
504504
505505 dev_set_drvdata(dev, &hsmp_pdev->sock[sock_ind]);
506506
507− return ret;
507+ return 0;
508508 }
509509
510510 static const struct bin_attribute hsmp_metric_tbl_attr = {
drivers/platform/x86/amd/hsmp/hsmp.c+5−0
@@ -356,6 +356,11 @@ ssize_t hsmp_metric_tbl_read(struct hsmp_socket *sock, char *buf, size_t size) · 355 unmodified lines
356356 if (!sock || !buf)
357357 return -EINVAL;
358358
359+ if (!sock->metric_tbl_addr) {
360+ dev_err(sock->dev, "Metrics table address not available\n");
361+ return -ENOMEM;
362+ }
363+
359364 /* Do not support lseek(), also don't allow more than the size of metric table */
360365 if (size != sizeof(struct hsmp_metric_table)) {
361366 dev_err(sock->dev, "Wrong buffer size\n");
drivers/platform/x86/amd/pmc/pmc-quirks.c+34−20
@@ -28,10 +28,15 @@ static struct quirk_entry quirk_spurious_8042 = { · 27 unmodified lines
2828 .spurious_8042 = true,
2929 };
3030
31+static struct quirk_entry quirk_s2idle_spurious_8042 = {
32+ .s2idle_bug_mmio = FCH_PM_BASE + FCH_PM_SCRATCH,
33+ .spurious_8042 = true,
34+};
35+
3136 static const struct dmi_system_id fwbug_list[] = {
3237 {
3338 .ident = "L14 Gen2 AMD",
34− .driver_data = &quirk_s2idle_bug,
39+ .driver_data = &quirk_s2idle_spurious_8042,
3540 .matches = {
3641 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
3742 DMI_MATCH(DMI_PRODUCT_NAME, "20X5"),
@@ -39,7 +44,7 @@ static const struct dmi_system_id fwbug_list[] = { · 1 unmodified line
3944 },
4045 {
4146 .ident = "T14s Gen2 AMD",
42− .driver_data = &quirk_s2idle_bug,
47+ .driver_data = &quirk_s2idle_spurious_8042,
4348 .matches = {
4449 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
4550 DMI_MATCH(DMI_PRODUCT_NAME, "20XF"),
@@ -47,7 +52,7 @@ static const struct dmi_system_id fwbug_list[] = { · 1 unmodified line
4752 },
4853 {
4954 .ident = "X13 Gen2 AMD",
50− .driver_data = &quirk_s2idle_bug,
55+ .driver_data = &quirk_s2idle_spurious_8042,
5156 .matches = {
5257 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
5358 DMI_MATCH(DMI_PRODUCT_NAME, "20XH"),
@@ -55,7 +60,7 @@ static const struct dmi_system_id fwbug_list[] = { · 1 unmodified line
5560 },
5661 {
5762 .ident = "T14 Gen2 AMD",
58− .driver_data = &quirk_s2idle_bug,
63+ .driver_data = &quirk_s2idle_spurious_8042,
5964 .matches = {
6065 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
6166 DMI_MATCH(DMI_PRODUCT_NAME, "20XK"),
@@ -63,7 +68,7 @@ static const struct dmi_system_id fwbug_list[] = { · 1 unmodified line
6368 },
6469 {
6570 .ident = "T14 Gen1 AMD",
66− .driver_data = &quirk_s2idle_bug,
71+ .driver_data = &quirk_s2idle_spurious_8042,
6772 .matches = {
6873 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
6974 DMI_MATCH(DMI_PRODUCT_NAME, "20UD"),
@@ -71,7 +76,7 @@ static const struct dmi_system_id fwbug_list[] = { · 1 unmodified line
7176 },
7277 {
7378 .ident = "T14 Gen1 AMD",
74− .driver_data = &quirk_s2idle_bug,
79+ .driver_data = &quirk_s2idle_spurious_8042,
7580 .matches = {
7681 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
7782 DMI_MATCH(DMI_PRODUCT_NAME, "20UE"),
@@ -79,7 +84,7 @@ static const struct dmi_system_id fwbug_list[] = { · 1 unmodified line
7984 },
8085 {
8186 .ident = "T14s Gen1 AMD",
82− .driver_data = &quirk_s2idle_bug,
87+ .driver_data = &quirk_s2idle_spurious_8042,
8388 .matches = {
8489 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
8590 DMI_MATCH(DMI_PRODUCT_NAME, "20UH"),
@@ -87,7 +92,7 @@ static const struct dmi_system_id fwbug_list[] = { · 1 unmodified line
8792 },
8893 {
8994 .ident = "T14s Gen1 AMD",
90− .driver_data = &quirk_s2idle_bug,
95+ .driver_data = &quirk_s2idle_spurious_8042,
9196 .matches = {
9297 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
9398 DMI_MATCH(DMI_PRODUCT_NAME, "20UJ"),
@@ -95,7 +100,7 @@ static const struct dmi_system_id fwbug_list[] = { · 1 unmodified line
95100 },
96101 {
97102 .ident = "P14s Gen1 AMD",
98− .driver_data = &quirk_s2idle_bug,
103+ .driver_data = &quirk_s2idle_spurious_8042,
99104 .matches = {
100105 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
101106 DMI_MATCH(DMI_PRODUCT_NAME, "20Y1"),
@@ -103,7 +108,7 @@ static const struct dmi_system_id fwbug_list[] = { · 1 unmodified line
103108 },
104109 {
105110 .ident = "P14s Gen2 AMD",
106− .driver_data = &quirk_s2idle_bug,
111+ .driver_data = &quirk_s2idle_spurious_8042,
107112 .matches = {
108113 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
109114 DMI_MATCH(DMI_PRODUCT_NAME, "21A0"),
@@ -111,7 +116,7 @@ static const struct dmi_system_id fwbug_list[] = { · 1 unmodified line
111116 },
112117 {
113118 .ident = "P14s Gen2 AMD",
114− .driver_data = &quirk_s2idle_bug,
119+ .driver_data = &quirk_s2idle_spurious_8042,
115120 .matches = {
116121 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
117122 DMI_MATCH(DMI_PRODUCT_NAME, "21A1"),
@@ -152,7 +157,7 @@ static const struct dmi_system_id fwbug_list[] = { · 34 unmodified lines
152157 },
153158 {
154159 .ident = "IdeaPad 1 14AMN7",
155− .driver_data = &quirk_s2idle_bug,
160+ .driver_data = &quirk_s2idle_spurious_8042,
156161 .matches = {
157162 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
158163 DMI_MATCH(DMI_PRODUCT_NAME, "82VF"),
@@ -160,7 +165,7 @@ static const struct dmi_system_id fwbug_list[] = { · 1 unmodified line
160165 },
161166 {
162167 .ident = "IdeaPad 1 15AMN7",
163− .driver_data = &quirk_s2idle_bug,
168+ .driver_data = &quirk_s2idle_spurious_8042,
164169 .matches = {
165170 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
166171 DMI_MATCH(DMI_PRODUCT_NAME, "82VG"),
@@ -168,7 +173,7 @@ static const struct dmi_system_id fwbug_list[] = { · 1 unmodified line
168173 },
169174 {
170175 .ident = "IdeaPad 1 15AMN7",
171− .driver_data = &quirk_s2idle_bug,
176+ .driver_data = &quirk_s2idle_spurious_8042,
172177 .matches = {
173178 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
174179 DMI_MATCH(DMI_PRODUCT_NAME, "82X5"),
@@ -176,7 +181,7 @@ static const struct dmi_system_id fwbug_list[] = { · 1 unmodified line
176181 },
177182 {
178183 .ident = "IdeaPad Slim 3 14AMN8",
179− .driver_data = &quirk_s2idle_bug,
184+ .driver_data = &quirk_s2idle_spurious_8042,
180185 .matches = {
181186 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
182187 DMI_MATCH(DMI_PRODUCT_NAME, "82XN"),
@@ -184,7 +189,7 @@ static const struct dmi_system_id fwbug_list[] = { · 1 unmodified line
184189 },
185190 {
186191 .ident = "IdeaPad Slim 3 15AMN8",
187− .driver_data = &quirk_s2idle_bug,
192+ .driver_data = &quirk_s2idle_spurious_8042,
188193 .matches = {
189194 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
190195 DMI_MATCH(DMI_PRODUCT_NAME, "82XQ"),
@@ -193,7 +198,7 @@ static const struct dmi_system_id fwbug_list[] = { · 2 unmodified lines
193198 /* https://gitlab.freedesktop.org/drm/amd/-/issues/4434 */
194199 {
195200 .ident = "Lenovo Yoga 6 13ALC6",
196− .driver_data = &quirk_s2idle_bug,
201+ .driver_data = &quirk_s2idle_spurious_8042,
197202 .matches = {
198203 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
199204 DMI_MATCH(DMI_PRODUCT_NAME, "82ND"),
@@ -202,7 +207,7 @@ static const struct dmi_system_id fwbug_list[] = { · 2 unmodified lines
202207 /* https://gitlab.freedesktop.org/drm/amd/-/issues/2684 */
203208 {
204209 .ident = "HP Laptop 15s-eq2xxx",
205− .driver_data = &quirk_s2idle_bug,
210+ .driver_data = &quirk_s2idle_spurious_8042,
206211 .matches = {
207212 DMI_MATCH(DMI_SYS_VENDOR, "HP"),
208213 DMI_MATCH(DMI_PRODUCT_NAME, "HP Laptop 15s-eq2xxx"),
@@ -285,6 +290,16 @@ void amd_pmc_quirks_init(struct amd_pmc_dev *dev) · 76 unmodified lines
285290 {
286291 const struct dmi_system_id *dmi_id;
287292
293+ /*
294+ * IRQ1 may cause an interrupt during resume even without a keyboard
295+ * press.
296+ *
297+ * Affects Renoir, Cezanne and Barcelo SoCs
298+ *
299+ * A solution is available in PMFW 64.66.0, but it must be activated by
300+ * SBIOS. If SBIOS is known to have the fix a quirk can be added for
301+ * a given system to avoid workaround.
302+ */
288303 if (dev->cpu_id == AMD_CPU_ID_CZN)
289304 dev->disable_8042_wakeup = true;
290305
@@ -295,6 +310,5 @@ void amd_pmc_quirks_init(struct amd_pmc_dev *dev) · 4 unmodified lines
295310 if (dev->quirks->s2idle_bug_mmio)
296311 pr_info("Using s2idle quirk to avoid %s platform firmware bug\n",
297312 dmi_id->ident);
298− if (dev->quirks->spurious_8042)
299− dev->disable_8042_wakeup = true;
313+ dev->disable_8042_wakeup = dev->quirks->spurious_8042;
300314 }
drivers/platform/x86/amd/pmc/pmc.c+0−13
@@ -530,19 +530,6 @@ static int amd_pmc_get_os_hint(struct amd_pmc_dev *dev) · 529 unmodified lines
530530 static int amd_pmc_wa_irq1(struct amd_pmc_dev *pdev)
531531 {
532532 struct device *d;
533− int rc;
534−
535− /* cezanne platform firmware has a fix in 64.66.0 */
536− if (pdev->cpu_id == AMD_CPU_ID_CZN) {
537− if (!pdev->major) {
538− rc = amd_pmc_get_smu_version(pdev);
539− if (rc)
540− return rc;
541− }
542−
543− if (pdev->major > 64 || (pdev->major == 64 && pdev->minor > 65))
544− return 0;
545− }
546533
547534 d = bus_find_device_by_name(&serio_bus, NULL, "serio0");
548535 if (!d)
drivers/platform/x86/dell/dell-smbios-base.c+9−10
@@ -39,6 +39,7 @@ struct token_sysfs_data { · 38 unmodified lines
3939 struct smbios_device {
4040 struct list_head list;
4141 struct device *device;
42+ int priority;
4243 int (*call_fn)(struct calling_interface_buffer *arg);
4344 };
4445
@@ -145,7 +146,7 @@ int dell_smbios_error(int value) · 100 unmodified lines
145146 }
146147 EXPORT_SYMBOL_GPL(dell_smbios_error);
147148
148−int dell_smbios_register_device(struct device *d, void *call_fn)
149+int dell_smbios_register_device(struct device *d, int priority, void *call_fn)
149150 {
150151 struct smbios_device *priv;
151152
@@ -154,6 +155,7 @@ int dell_smbios_register_device(struct device *d, void *call_fn) · 2 unmodified lines
154155 return -ENOMEM;
155156 get_device(d);
156157 priv->device = d;
158+ priv->priority = priority;
157159 priv->call_fn = call_fn;
158160 mutex_lock(&smbios_mutex);
159161 list_add_tail(&priv->list, &smbios_device_list);
@@ -292,28 +294,25 @@ EXPORT_SYMBOL_GPL(dell_smbios_call_filter); · 132 unmodified lines
292294
293295 int dell_smbios_call(struct calling_interface_buffer *buffer)
294296 {
295− int (*call_fn)(struct calling_interface_buffer *) = NULL;
296− struct device *selected_dev = NULL;
297+ struct smbios_device *selected = NULL;
297298 struct smbios_device *priv;
298299 int ret;
299300
300301 mutex_lock(&smbios_mutex);
301302 list_for_each_entry(priv, &smbios_device_list, list) {
302− if (!selected_dev || priv->device->id >= selected_dev->id) {
303− dev_dbg(priv->device, "Trying device ID: %d\n",
304− priv->device->id);
305− call_fn = priv->call_fn;
306− selected_dev = priv->device;
303+ if (!selected || priv->priority >= selected->priority) {
304+ dev_dbg(priv->device, "Trying device ID: %d\n", priv->priority);
305+ selected = priv;
307306 }
308307 }
309308
310− if (!selected_dev) {
309+ if (!selected) {
311310 ret = -ENODEV;
312311 pr_err("No dell-smbios drivers are loaded\n");
313312 goto out_smbios_call;
314313 }
315314
316− ret = call_fn(buffer);
315+ ret = selected->call_fn(buffer);
317316
318317 out_smbios_call:
319318 mutex_unlock(&smbios_mutex);
drivers/platform/x86/dell/dell-smbios-smm.c+1−2
@@ -125,8 +125,7 @@ int init_dell_smbios_smm(void) · 124 unmodified lines
125125 if (ret)
126126 goto fail_platform_device_add;
127127
128− ret = dell_smbios_register_device(&platform_device->dev,
129− &dell_smbios_smm_call);
128+ ret = dell_smbios_register_device(&platform_device->dev, 0, &dell_smbios_smm_call);
130129 if (ret)
131130 goto fail_register;
132131
drivers/platform/x86/dell/dell-smbios-wmi.c+1−3
@@ -264,9 +264,7 @@ static int dell_smbios_wmi_probe(struct wmi_device *wdev, const void *context) · 263 unmodified lines
264264 if (ret)
265265 return ret;
266266
267− /* ID is used by dell-smbios to set priority of drivers */
268− wdev->dev.id = 1;
269− ret = dell_smbios_register_device(&wdev->dev, &dell_smbios_wmi_call);
267+ ret = dell_smbios_register_device(&wdev->dev, 1, &dell_smbios_wmi_call);
270268 if (ret)
271269 return ret;
272270
drivers/platform/x86/dell/dell-smbios.h+1−1
@@ -64,7 +64,7 @@ struct calling_interface_structure { · 63 unmodified lines
6464 struct calling_interface_token tokens[];
6565 } __packed;
6666
67−int dell_smbios_register_device(struct device *d, void *call_fn);
67+int dell_smbios_register_device(struct device *d, int priority, void *call_fn);
6868 void dell_smbios_unregister_device(struct device *d);
6969
7070 int dell_smbios_error(int value);
drivers/platform/x86/hp/hp-wmi.c+2−2
@@ -92,9 +92,9 @@ static const char * const victus_thermal_profile_boards[] = { · 91 unmodified lines
9292 "8A25"
9393 };
9494
95−/* DMI Board names of Victus 16-s1000 laptops */
95+/* DMI Board names of Victus 16-r1000 and Victus 16-s1000 laptops */
9696 static const char * const victus_s_thermal_profile_boards[] = {
97− "8C9C"
97+ "8C99", "8C9C"
9898 };
9999
100100 enum hp_wmi_radio {
drivers/platform/x86/intel/int3472/discrete.c+6−0
@@ -193,6 +193,10 @@ static void int3472_get_con_id_and_polarity(struct int3472_discrete_device *int3 · 192 unmodified lines
193193 *con_id = "privacy-led";
194194 *gpio_flags = GPIO_ACTIVE_HIGH;
195195 break;
196+ case INT3472_GPIO_TYPE_HOTPLUG_DETECT:
197+ *con_id = "hpd";
198+ *gpio_flags = GPIO_ACTIVE_HIGH;
199+ break;
196200 case INT3472_GPIO_TYPE_POWER_ENABLE:
197201 *con_id = "avdd";
198202 *gpio_flags = GPIO_ACTIVE_HIGH;
@@ -223,6 +227,7 @@ static void int3472_get_con_id_and_polarity(struct int3472_discrete_device *int3 · 24 unmodified lines
223227 * 0x0b Power enable
224228 * 0x0c Clock enable
225229 * 0x0d Privacy LED
230+ * 0x13 Hotplug detect
226231 *
227232 * There are some known platform specific quirks where that does not quite
228233 * hold up; for example where a pin with type 0x01 (Power down) is mapped to
@@ -292,6 +297,7 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares, · 63 unmodified lines
292297 switch (type) {
293298 case INT3472_GPIO_TYPE_RESET:
294299 case INT3472_GPIO_TYPE_POWERDOWN:
300+ case INT3472_GPIO_TYPE_HOTPLUG_DETECT:
295301 ret = skl_int3472_map_gpio_to_sensor(int3472, agpio, con_id, gpio_flags);
296302 if (ret)
297303 err_msg = "Failed to map GPIO pin to sensor\n";
drivers/platform/x86/intel/uncore-frequency/uncore-frequency-tpmi.c+5−0
@@ -192,9 +192,14 @@ static int uncore_read_control_freq(struct uncore_data *data, unsigned int *valu · 191 unmodified lines
192192 static int write_eff_lat_ctrl(struct uncore_data *data, unsigned int val, enum uncore_index index)
193193 {
194194 struct tpmi_uncore_cluster_info *cluster_info;
195+ struct tpmi_uncore_struct *uncore_root;
195196 u64 control;
196197
197198 cluster_info = container_of(data, struct tpmi_uncore_cluster_info, uncore_data);
199+ uncore_root = cluster_info->uncore_root;
200+
201+ if (uncore_root->write_blocked)
202+ return -EPERM;
198203
199204 if (cluster_info->root_domain)
200205 return -ENODATA;
drivers/regulator/pca9450-regulator.c+5−8
@@ -40,7 +40,6 @@ struct pca9450 { · 39 unmodified lines
4040 struct device *dev;
4141 struct regmap *regmap;
4242 struct gpio_desc *sd_vsel_gpio;
43− struct notifier_block restart_nb;
4443 enum pca9450_chip_type type;
4544 unsigned int rcnt;
4645 int irq;
@@ -1100,10 +1099,9 @@ static irqreturn_t pca9450_irq_handler(int irq, void *data) · 1053 unmodified lines
11001099 return IRQ_HANDLED;
11011100 }
11021101
1103−static int pca9450_i2c_restart_handler(struct notifier_block *nb,
1104− unsigned long action, void *data)
1102+static int pca9450_i2c_restart_handler(struct sys_off_data *data)
11051103 {
1106− struct pca9450 *pca9450 = container_of(nb, struct pca9450, restart_nb);
1104+ struct pca9450 *pca9450 = data->cb_data;
11071105 struct i2c_client *i2c = container_of(pca9450->dev, struct i2c_client, dev);
11081106
11091107 dev_dbg(&i2c->dev, "Restarting device..\n");
@@ -1261,10 +1259,9 @@ static int pca9450_i2c_probe(struct i2c_client *i2c) · 151 unmodified lines
12611259 pca9450->sd_vsel_fixed_low =
12621260 of_property_read_bool(ldo5->dev.of_node, "nxp,sd-vsel-fixed-low");
12631261
1264− pca9450->restart_nb.notifier_call = pca9450_i2c_restart_handler;
1265− pca9450->restart_nb.priority = PCA9450_RESTART_HANDLER_PRIORITY;
1266−
1267− if (register_restart_handler(&pca9450->restart_nb))
1262+ if (devm_register_sys_off_handler(&i2c->dev, SYS_OFF_MODE_RESTART,
1263+ PCA9450_RESTART_HANDLER_PRIORITY,
1264+ pca9450_i2c_restart_handler, pca9450))
12681265 dev_warn(&i2c->dev, "Failed to register restart handler\n");
12691266
12701267 dev_info(&i2c->dev, "%s probed.\n",
drivers/regulator/tps65219-regulator.c+6−6
@@ -454,9 +454,9 @@ static int tps65219_regulator_probe(struct platform_device *pdev) · 453 unmodified lines
454454 irq_type->irq_name,
455455 irq_data);
456456 if (error)
457− return dev_err_probe(tps->dev, PTR_ERR(rdev),
458− "Failed to request %s IRQ %d: %d\n",
459− irq_type->irq_name, irq, error);
457+ return dev_err_probe(tps->dev, error,
458+ "Failed to request %s IRQ %d\n",
459+ irq_type->irq_name, irq);
460460 }
461461
462462 for (i = 0; i < pmic->dev_irq_size; ++i) {
@@ -477,9 +477,9 @@ static int tps65219_regulator_probe(struct platform_device *pdev) · 14 unmodified lines
477477 irq_type->irq_name,
478478 irq_data);
479479 if (error)
480− return dev_err_probe(tps->dev, PTR_ERR(rdev),
481− "Failed to request %s IRQ %d: %d\n",
482− irq_type->irq_name, irq, error);
480+ return dev_err_probe(tps->dev, error,
481+ "Failed to request %s IRQ %d\n",
482+ irq_type->irq_name, irq);
483483 }
484484
485485 return 0;
drivers/s390/char/sclp.c+9−2
@@ -77,6 +77,13 @@ unsigned long sclp_console_full; · 76 unmodified lines
7777 /* The currently active SCLP command word. */
7878 static sclp_cmdw_t active_cmd;
7979
80+static inline struct sccb_header *sclpint_to_sccb(u32 sccb_int)
81+{
82+ if (sccb_int)
83+ return __va(sccb_int);
84+ return NULL;
85+}
86+
8087 static inline void sclp_trace(int prio, char *id, u32 a, u64 b, bool err)
8188 {
8289 struct sclp_trace_entry e;
@@ -620,7 +627,7 @@ __sclp_find_req(u32 sccb) · 537 unmodified lines
620627
621628 static bool ok_response(u32 sccb_int, sclp_cmdw_t cmd)
622629 {
623− struct sccb_header *sccb = (struct sccb_header *)__va(sccb_int);
630+ struct sccb_header *sccb = sclpint_to_sccb(sccb_int);
624631 struct evbuf_header *evbuf;
625632 u16 response;
626633
@@ -659,7 +666,7 @@ static void sclp_interrupt_handler(struct ext_code ext_code, · 32 unmodified lines
659666
660667 /* INT: Interrupt received (a=intparm, b=cmd) */
661668 sclp_trace_sccb(0, "INT", param32, active_cmd, active_cmd,
662− (struct sccb_header *)__va(finished_sccb),
669+ sclpint_to_sccb(finished_sccb),
663670 !ok_response(finished_sccb, active_cmd));
664671
665672 if (finished_sccb) {
drivers/scsi/fnic/fnic.h+0−2
@@ -323,8 +323,6 @@ enum fnic_state { · 322 unmodified lines
323323 FNIC_IN_ETH_TRANS_FC_MODE,
324324 };
325325
326−struct mempool;
327−
328326 enum fnic_role_e {
329327 FNIC_ROLE_FCP_INITIATOR = 0,
330328 };
drivers/scsi/qla4xxx/ql4_os.c+2−0
@@ -6606,6 +6606,8 @@ static struct iscsi_endpoint *qla4xxx_get_ep_fwdb(struct scsi_qla_host *ha, · 6605 unmodified lines
66066606
66076607 ep = qla4xxx_ep_connect(ha->host, (struct sockaddr *)dst_addr, 0);
66086608 vfree(dst_addr);
6609+ if (IS_ERR(ep))
6610+ return NULL;
66096611 return ep;
66106612 }
66116613
drivers/spi/spi-fsl-lpspi.c+3−5
@@ -330,13 +330,11 @@ static int fsl_lpspi_set_bitrate(struct fsl_lpspi_data *fsl_lpspi) · 329 unmodified lines
330330 }
331331
332332 if (config.speed_hz > perclk_rate / 2) {
333− dev_err(fsl_lpspi->dev,
334− "per-clk should be at least two times of transfer speed");
335− return -EINVAL;
333+ div = 2;
334+ } else {
335+ div = DIV_ROUND_UP(perclk_rate, config.speed_hz);
336336 }
337337
338− div = DIV_ROUND_UP(perclk_rate, config.speed_hz);
339−
340338 for (prescale = 0; prescale <= prescale_max; prescale++) {
341339 scldiv = div / (1 << prescale) - 2;
342340 if (scldiv >= 0 && scldiv < 256) {
drivers/spi/spi-mem.c+4−0
@@ -265,6 +265,9 @@ static bool spi_mem_internal_supports_op(struct spi_mem *mem, · 264 unmodified lines
265265 */
266266 bool spi_mem_supports_op(struct spi_mem *mem, const struct spi_mem_op *op)
267267 {
268+ /* Make sure the operation frequency is correct before going futher */
269+ spi_mem_adjust_op_freq(mem, (struct spi_mem_op *)op);
270+
268271 if (spi_mem_check_op(op))
269272 return false;
270273
@@ -577,6 +580,7 @@ EXPORT_SYMBOL_GPL(spi_mem_adjust_op_freq); · 306 unmodified lines
577580 * spi_mem_calc_op_duration() - Derives the theoretical length (in ns) of an
578581 * operation. This helps finding the best variant
579582 * among a list of possible choices.
583+ * @mem: the SPI memory
580584 * @op: the operation to benchmark
581585 *
582586 * Some chips have per-op frequency limitations, PCBs usually have their own
drivers/spi/spi-qpic-snand.c+15−7
@@ -210,13 +210,21 @@ static int qcom_spi_ooblayout_ecc(struct mtd_info *mtd, int section, · 209 unmodified lines
210210 struct qcom_nand_controller *snandc = nand_to_qcom_snand(nand);
211211 struct qpic_ecc *qecc = snandc->qspi->ecc;
212212
213− if (section > 1)
214− return -ERANGE;
215−
216− oobregion->length = qecc->ecc_bytes_hw + qecc->spare_bytes;
217− oobregion->offset = mtd->oobsize - oobregion->length;
213+ switch (section) {
214+ case 0:
215+ oobregion->offset = 0;
216+ oobregion->length = qecc->bytes * (qecc->steps - 1) +
217+ qecc->bbm_size;
218+ return 0;
219+ case 1:
220+ oobregion->offset = qecc->bytes * (qecc->steps - 1) +
221+ qecc->bbm_size +
222+ qecc->steps * 4;
223+ oobregion->length = mtd->oobsize - oobregion->offset;
224+ return 0;
225+ }
218226
219− return 0;
227+ return -ERANGE;
220228 }
221229
222230 static int qcom_spi_ooblayout_free(struct mtd_info *mtd, int section,
@@ -1196,7 +1204,7 @@ static int qcom_spi_program_oob(struct qcom_nand_controller *snandc, · 973 unmodified lines
11961204 u32 cfg0, cfg1, ecc_bch_cfg, ecc_buf_cfg;
11971205
11981206 cfg0 = (ecc_cfg->cfg0 & ~CW_PER_PAGE_MASK) |
1199− FIELD_PREP(CW_PER_PAGE_MASK, num_cw - 1);
1207+ FIELD_PREP(CW_PER_PAGE_MASK, 0);
12001208 cfg1 = ecc_cfg->cfg1;
12011209 ecc_bch_cfg = ecc_cfg->ecc_bch_cfg;
12021210 ecc_buf_cfg = ecc_cfg->ecc_buf_cfg;
drivers/spi/spi-st-ssc4.c+5−5
@@ -378,7 +378,7 @@ static void spi_st_remove(struct platform_device *pdev) · 377 unmodified lines
378378 pinctrl_pm_select_sleep_state(&pdev->dev);
379379 }
380380
381−static int __maybe_unused spi_st_runtime_suspend(struct device *dev)
381+static int spi_st_runtime_suspend(struct device *dev)
382382 {
383383 struct spi_controller *host = dev_get_drvdata(dev);
384384 struct spi_st *spi_st = spi_controller_get_devdata(host);
@@ -391,7 +391,7 @@ static int __maybe_unused spi_st_runtime_suspend(struct device *dev) · 6 unmodified lines
391391 return 0;
392392 }
393393
394−static int __maybe_unused spi_st_runtime_resume(struct device *dev)
394+static int spi_st_runtime_resume(struct device *dev)
395395 {
396396 struct spi_controller *host = dev_get_drvdata(dev);
397397 struct spi_st *spi_st = spi_controller_get_devdata(host);
@@ -428,8 +428,8 @@ static int __maybe_unused spi_st_resume(struct device *dev) · 30 unmodified lines
428428 }
429429
430430 static const struct dev_pm_ops spi_st_pm = {
431− SET_SYSTEM_SLEEP_PM_OPS(spi_st_suspend, spi_st_resume)
432− SET_RUNTIME_PM_OPS(spi_st_runtime_suspend, spi_st_runtime_resume, NULL)
431+ SYSTEM_SLEEP_PM_OPS(spi_st_suspend, spi_st_resume)
432+ RUNTIME_PM_OPS(spi_st_runtime_suspend, spi_st_runtime_resume, NULL)
433433 };
434434
435435 static const struct of_device_id stm_spi_match[] = {
@@ -441,7 +441,7 @@ MODULE_DEVICE_TABLE(of, stm_spi_match); · 5 unmodified lines
441441 static struct platform_driver spi_st_driver = {
442442 .driver = {
443443 .name = "spi-st",
444− .pm = pm_sleep_ptr(&spi_st_pm),
444+ .pm = pm_ptr(&spi_st_pm),
445445 .of_match_table = of_match_ptr(stm_spi_match),
446446 },
447447 .probe = spi_st_probe,
drivers/ufs/core/ufshcd.c+44−32
@@ -1303,7 +1303,7 @@ static u32 ufshcd_pending_cmds(struct ufs_hba *hba) · 1302 unmodified lines
13031303 *
13041304 * Return: 0 upon success; -EBUSY upon timeout.
13051305 */
1306−static int ufshcd_wait_for_doorbell_clr(struct ufs_hba *hba,
1306+static int ufshcd_wait_for_pending_cmds(struct ufs_hba *hba,
13071307 u64 wait_timeout_us)
13081308 {
13091309 int ret = 0;
@@ -1431,7 +1431,7 @@ static int ufshcd_clock_scaling_prepare(struct ufs_hba *hba, u64 timeout_us) · 121 unmodified lines
14311431 down_write(&hba->clk_scaling_lock);
14321432
14331433 if (!hba->clk_scaling.is_allowed ||
1434− ufshcd_wait_for_doorbell_clr(hba, timeout_us)) {
1434+ ufshcd_wait_for_pending_cmds(hba, timeout_us)) {
14351435 ret = -EBUSY;
14361436 up_write(&hba->clk_scaling_lock);
14371437 mutex_unlock(&hba->wb_mutex);
@@ -3199,7 +3199,8 @@ ufshcd_dev_cmd_completion(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) · 1761 unmodified lines
31993199 }
32003200
32013201 /*
3202− * Return: 0 upon success; < 0 upon failure.
3202+ * Return: 0 upon success; > 0 in case the UFS device reported an OCS error;
3203+ * < 0 if another error occurred.
32033204 */
32043205 static int ufshcd_wait_for_dev_cmd(struct ufs_hba *hba,
32053206 struct ufshcd_lrb *lrbp, int max_timeout)
@@ -3275,7 +3276,6 @@ retry: · 69 unmodified lines
32753276 }
32763277 }
32773278
3278− WARN_ONCE(err > 0, "Incorrect return value %d > 0\n", err);
32793279 return err;
32803280 }
32813281
@@ -3294,7 +3294,8 @@ static void ufshcd_dev_man_unlock(struct ufs_hba *hba) · 12 unmodified lines
32943294 }
32953295
32963296 /*
3297− * Return: 0 upon success; < 0 upon failure.
3297+ * Return: 0 upon success; > 0 in case the UFS device reported an OCS error;
3298+ * < 0 if another error occurred.
32983299 */
32993300 static int ufshcd_issue_dev_cmd(struct ufs_hba *hba, struct ufshcd_lrb *lrbp,
33003301 const u32 tag, int timeout)
@@ -3317,7 +3318,8 @@ static int ufshcd_issue_dev_cmd(struct ufs_hba *hba, struct ufshcd_lrb *lrbp, · 16 unmodified lines
33173318 * @cmd_type: specifies the type (NOP, Query...)
33183319 * @timeout: timeout in milliseconds
33193320 *
3320− * Return: 0 upon success; < 0 upon failure.
3321+ * Return: 0 upon success; > 0 in case the UFS device reported an OCS error;
3322+ * < 0 if another error occurred.
33213323 *
33223324 * NOTE: Since there is only one available tag for device management commands,
33233325 * it is expected you hold the hba->dev_cmd.lock mutex.
@@ -3363,6 +3365,10 @@ static inline void ufshcd_init_query(struct ufs_hba *hba, · 39 unmodified lines
33633365 (*request)->upiu_req.selector = selector;
33643366 }
33653367
3368+/*
3369+ * Return: 0 upon success; > 0 in case the UFS device reported an OCS error;
3370+ * < 0 if another error occurred.
3371+ */
33663372 static int ufshcd_query_flag_retry(struct ufs_hba *hba,
33673373 enum query_opcode opcode, enum flag_idn idn, u8 index, bool *flag_res)
33683374 {
@@ -3383,7 +3389,6 @@ static int ufshcd_query_flag_retry(struct ufs_hba *hba, · 14 unmodified lines
33833389 dev_err(hba->dev,
33843390 "%s: query flag, opcode %d, idn %d, failed with error %d after %d retries\n",
33853391 __func__, opcode, idn, ret, retries);
3386− WARN_ONCE(ret > 0, "Incorrect return value %d > 0\n", ret);
33873392 return ret;
33883393 }
33893394
@@ -3395,7 +3400,8 @@ static int ufshcd_query_flag_retry(struct ufs_hba *hba, · 5 unmodified lines
33953400 * @index: flag index to access
33963401 * @flag_res: the flag value after the query request completes
33973402 *
3398− * Return: 0 for success; < 0 upon failure.
3403+ * Return: 0 upon success; > 0 in case the UFS device reported an OCS error;
3404+ * < 0 if another error occurred.
33993405 */
34003406 int ufshcd_query_flag(struct ufs_hba *hba, enum query_opcode opcode,
34013407 enum flag_idn idn, u8 index, bool *flag_res)
@@ -3451,7 +3457,6 @@ int ufshcd_query_flag(struct ufs_hba *hba, enum query_opcode opcode, · 49 unmodified lines
34513457
34523458 out_unlock:
34533459 ufshcd_dev_man_unlock(hba);
3454− WARN_ONCE(err > 0, "Incorrect return value %d > 0\n", err);
34553460 return err;
34563461 }
34573462
@@ -3464,8 +3469,9 @@ out_unlock: · 6 unmodified lines
34643469 * @selector: selector field
34653470 * @attr_val: the attribute value after the query request completes
34663471 *
3467− * Return: 0 upon success; < 0 upon failure.
3468−*/
3472+ * Return: 0 upon success; > 0 in case the UFS device reported an OCS error;
3473+ * < 0 if another error occurred.
3474+ */
34693475 int ufshcd_query_attr(struct ufs_hba *hba, enum query_opcode opcode,
34703476 enum attr_idn idn, u8 index, u8 selector, u32 *attr_val)
34713477 {
@@ -3513,7 +3519,6 @@ int ufshcd_query_attr(struct ufs_hba *hba, enum query_opcode opcode, · 41 unmodified lines
35133519
35143520 out_unlock:
35153521 ufshcd_dev_man_unlock(hba);
3516− WARN_ONCE(err > 0, "Incorrect return value %d > 0\n", err);
35173522 return err;
35183523 }
35193524
@@ -3528,8 +3533,9 @@ out_unlock: · 8 unmodified lines
35283533 * @attr_val: the attribute value after the query request
35293534 * completes
35303535 *
3531− * Return: 0 for success; < 0 upon failure.
3532−*/
3536+ * Return: 0 upon success; > 0 in case the UFS device reported an OCS error;
3537+ * < 0 if another error occurred.
3538+ */
35333539 int ufshcd_query_attr_retry(struct ufs_hba *hba,
35343540 enum query_opcode opcode, enum attr_idn idn, u8 index, u8 selector,
35353541 u32 *attr_val)
@@ -3551,12 +3557,12 @@ int ufshcd_query_attr_retry(struct ufs_hba *hba, · 15 unmodified lines
35513557 dev_err(hba->dev,
35523558 "%s: query attribute, idn %d, failed with error %d after %d retries\n",
35533559 __func__, idn, ret, QUERY_REQ_RETRIES);
3554− WARN_ONCE(ret > 0, "Incorrect return value %d > 0\n", ret);
35553560 return ret;
35563561 }
35573562
35583563 /*
3559− * Return: 0 if successful; < 0 upon failure.
3564+ * Return: 0 upon success; > 0 in case the UFS device reported an OCS error;
3565+ * < 0 if another error occurred.
35603566 */
35613567 static int __ufshcd_query_descriptor(struct ufs_hba *hba,
35623568 enum query_opcode opcode, enum desc_idn idn, u8 index,
@@ -3615,7 +3621,6 @@ static int __ufshcd_query_descriptor(struct ufs_hba *hba, · 52 unmodified lines
36153621 out_unlock:
36163622 hba->dev_cmd.query.descriptor = NULL;
36173623 ufshcd_dev_man_unlock(hba);
3618− WARN_ONCE(err > 0, "Incorrect return value %d > 0\n", err);
36193624 return err;
36203625 }
36213626
@@ -3632,7 +3637,8 @@ out_unlock: · 10 unmodified lines
36323637 * The buf_len parameter will contain, on return, the length parameter
36333638 * received on the response.
36343639 *
3635− * Return: 0 for success; < 0 upon failure.
3640+ * Return: 0 upon success; > 0 in case the UFS device reported an OCS error;
3641+ * < 0 if another error occurred.
36363642 */
36373643 int ufshcd_query_descriptor_retry(struct ufs_hba *hba,
36383644 enum query_opcode opcode,
@@ -3650,7 +3656,6 @@ int ufshcd_query_descriptor_retry(struct ufs_hba *hba, · 11 unmodified lines
36503656 break;
36513657 }
36523658
3653− WARN_ONCE(err > 0, "Incorrect return value %d > 0\n", err);
36543659 return err;
36553660 }
36563661
@@ -3663,7 +3668,8 @@ int ufshcd_query_descriptor_retry(struct ufs_hba *hba, · 6 unmodified lines
36633668 * @param_read_buf: pointer to buffer where parameter would be read
36643669 * @param_size: sizeof(param_read_buf)
36653670 *
3666− * Return: 0 in case of success; < 0 upon failure.
3671+ * Return: 0 upon success; > 0 in case the UFS device reported an OCS error;
3672+ * < 0 if another error occurred.
36673673 */
36683674 int ufshcd_read_desc_param(struct ufs_hba *hba,
36693675 enum desc_idn desc_id,
@@ -3730,7 +3736,6 @@ int ufshcd_read_desc_param(struct ufs_hba *hba, · 60 unmodified lines
37303736 out:
37313737 if (is_kmalloc)
37323738 kfree(desc_buf);
3733− WARN_ONCE(ret > 0, "Incorrect return value %d > 0\n", ret);
37343739 return ret;
37353740 }
37363741
@@ -4781,7 +4786,8 @@ EXPORT_SYMBOL_GPL(ufshcd_config_pwr_mode); · 1044 unmodified lines
47814786 *
47824787 * Set fDeviceInit flag and poll until device toggles it.
47834788 *
4784− * Return: 0 upon success; < 0 upon failure.
4789+ * Return: 0 upon success; > 0 in case the UFS device reported an OCS error;
4790+ * < 0 if another error occurred.
47854791 */
47864792 static int ufshcd_complete_dev_init(struct ufs_hba *hba)
47874793 {
@@ -5135,7 +5141,8 @@ out: · 347 unmodified lines
51355141 * not respond with NOP IN UPIU within timeout of %NOP_OUT_TIMEOUT
51365142 * and we retry sending NOP OUT for %NOP_OUT_RETRIES iterations.
51375143 *
5138− * Return: 0 upon success; < 0 upon failure.
5144+ * Return: 0 upon success; > 0 in case the UFS device reported an OCS error;
5145+ * < 0 if another error occurred.
51395146 */
51405147 static int ufshcd_verify_dev_init(struct ufs_hba *hba)
51415148 {
@@ -5559,9 +5566,9 @@ static irqreturn_t ufshcd_uic_cmd_compl(struct ufs_hba *hba, u32 intr_status) · 417 unmodified lines
55595566 irqreturn_t retval = IRQ_NONE;
55605567 struct uic_command *cmd;
55615568
5562− spin_lock(hba->host->host_lock);
5569+ guard(spinlock_irqsave)(hba->host->host_lock);
55635570 cmd = hba->active_uic_cmd;
5564− if (WARN_ON_ONCE(!cmd))
5571+ if (!cmd)
55655572 goto unlock;
55665573
55675574 if (ufshcd_is_auto_hibern8_error(hba, intr_status))
@@ -5586,8 +5593,6 @@ static irqreturn_t ufshcd_uic_cmd_compl(struct ufs_hba *hba, u32 intr_status) · 18 unmodified lines
55865593 ufshcd_add_uic_command_trace(hba, cmd, UFS_CMD_COMP);
55875594
55885595 unlock:
5589− spin_unlock(hba->host->host_lock);
5590−
55915596 return retval;
55925597 }
55935598
@@ -5869,7 +5874,8 @@ static inline int ufshcd_enable_ee(struct ufs_hba *hba, u16 mask) · 275 unmodified lines
58695874 * as the device is allowed to manage its own way of handling background
58705875 * operations.
58715876 *
5872− * Return: zero on success, non-zero on failure.
5877+ * Return: 0 upon success; > 0 in case the UFS device reported an OCS error;
5878+ * < 0 if another error occurred.
58735879 */
58745880 static int ufshcd_enable_auto_bkops(struct ufs_hba *hba)
58755881 {
@@ -5908,7 +5914,8 @@ out: · 32 unmodified lines
59085914 * host is idle so that BKOPS are managed effectively without any negative
59095915 * impacts.
59105916 *
5911− * Return: zero on success, non-zero on failure.
5917+ * Return: 0 upon success; > 0 in case the UFS device reported an OCS error;
5918+ * < 0 if another error occurred.
59125919 */
59135920 static int ufshcd_disable_auto_bkops(struct ufs_hba *hba)
59145921 {
@@ -6058,6 +6065,10 @@ out: · 143 unmodified lines
60586065 __func__, err);
60596066 }
60606067
6068+/*
6069+ * Return: 0 upon success; > 0 in case the UFS device reported an OCS error;
6070+ * < 0 if another error occurred.
6071+ */
60616072 int ufshcd_read_device_lvl_exception_id(struct ufs_hba *hba, u64 *exception_id)
60626073 {
60636074 struct utp_upiu_query_v4_0 *upiu_resp;
@@ -6920,7 +6931,7 @@ static irqreturn_t ufshcd_check_errors(struct ufs_hba *hba, u32 intr_status) · 856 unmodified lines
69206931 bool queue_eh_work = false;
69216932 irqreturn_t retval = IRQ_NONE;
69226933
6923− spin_lock(hba->host->host_lock);
6934+ guard(spinlock_irqsave)(hba->host->host_lock);
69246935 hba->errors |= UFSHCD_ERROR_MASK & intr_status;
69256936
69266937 if (hba->errors & INT_FATAL_ERRORS) {
@@ -6979,7 +6990,7 @@ static irqreturn_t ufshcd_check_errors(struct ufs_hba *hba, u32 intr_status) · 52 unmodified lines
69796990 */
69806991 hba->errors = 0;
69816992 hba->uic_error = 0;
6982− spin_unlock(hba->host->host_lock);
6993+
69836994 return retval;
69846995 }
69856996
@@ -7454,7 +7465,8 @@ int ufshcd_exec_raw_upiu_cmd(struct ufs_hba *hba, · 468 unmodified lines
74547465 * @sg_list: Pointer to SG list when DATA IN/OUT UPIU is required in ARPMB operation
74557466 * @dir: DMA direction
74567467 *
7457− * Return: zero on success, non-zero on failure.
7468+ * Return: 0 upon success; > 0 in case the UFS device reported an OCS error;
7469+ * < 0 if another error occurred.
74587470 */
74597471 int ufshcd_advanced_rpmb_req_handler(struct ufs_hba *hba, struct utp_upiu_req *req_upiu,
74607472 struct utp_upiu_req *rsp_upiu, struct ufs_ehs *req_ehs,
drivers/ufs/host/ufs-qcom.c+15−24
@@ -2070,17 +2070,6 @@ static irqreturn_t ufs_qcom_mcq_esi_handler(int irq, void *data) · 2069 unmodified lines
20702070 return IRQ_HANDLED;
20712071 }
20722072
2073−static void ufs_qcom_irq_free(struct ufs_qcom_irq *uqi)
2074−{
2075− for (struct ufs_qcom_irq *q = uqi; q->irq; q++)
2076− devm_free_irq(q->hba->dev, q->irq, q->hba);
2077−
2078− platform_device_msi_free_irqs_all(uqi->hba->dev);
2079− devm_kfree(uqi->hba->dev, uqi);
2080−}
2081−
2082−DEFINE_FREE(ufs_qcom_irq, struct ufs_qcom_irq *, if (_T) ufs_qcom_irq_free(_T))
2083−
20842073 static int ufs_qcom_config_esi(struct ufs_hba *hba)
20852074 {
20862075 struct ufs_qcom_host *host = ufshcd_get_variant(hba);
@@ -2095,18 +2084,18 @@ static int ufs_qcom_config_esi(struct ufs_hba *hba) · 8 unmodified lines
20952084 */
20962085 nr_irqs = hba->nr_hw_queues - hba->nr_queues[HCTX_TYPE_POLL];
20972086
2098− struct ufs_qcom_irq *qi __free(ufs_qcom_irq) =
2099− devm_kcalloc(hba->dev, nr_irqs, sizeof(*qi), GFP_KERNEL);
2100− if (!qi)
2101− return -ENOMEM;
2102− /* Preset so __free() has a pointer to hba in all error paths */
2103− qi[0].hba = hba;
2104−
21052087 ret = platform_device_msi_init_and_alloc_irqs(hba->dev, nr_irqs,
21062088 ufs_qcom_write_msi_msg);
21072089 if (ret) {
2108− dev_err(hba->dev, "Failed to request Platform MSI %d\n", ret);
2109− return ret;
2090+ dev_warn(hba->dev, "Platform MSI not supported or failed, continuing without ESI\n");
2091+ return ret; /* Continue without ESI */
2092+ }
2093+
2094+ struct ufs_qcom_irq *qi = devm_kcalloc(hba->dev, nr_irqs, sizeof(*qi), GFP_KERNEL);
2095+
2096+ if (!qi) {
2097+ platform_device_msi_free_irqs_all(hba->dev);
2098+ return -ENOMEM;
21102099 }
21112100
21122101 for (int idx = 0; idx < nr_irqs; idx++) {
@@ -2117,15 +2106,17 @@ static int ufs_qcom_config_esi(struct ufs_hba *hba) · 4 unmodified lines
21172106 ret = devm_request_irq(hba->dev, qi[idx].irq, ufs_qcom_mcq_esi_handler,
21182107 IRQF_SHARED, "qcom-mcq-esi", qi + idx);
21192108 if (ret) {
2120− dev_err(hba->dev, "%s: Fail to request IRQ for %d, err = %d\n",
2109+ dev_err(hba->dev, "%s: Failed to request IRQ for %d, err = %d\n",
21212110 __func__, qi[idx].irq, ret);
2122− qi[idx].irq = 0;
2111+ /* Free previously allocated IRQs */
2112+ for (int j = 0; j < idx; j++)
2113+ devm_free_irq(hba->dev, qi[j].irq, qi + j);
2114+ platform_device_msi_free_irqs_all(hba->dev);
2115+ devm_kfree(hba->dev, qi);
21232116 return ret;
21242117 }
21252118 }
21262119
2127− retain_and_null_ptr(qi);
2128−
21292120 if (host->hw_ver.major >= 6) {
21302121 ufshcd_rmwl(hba, ESI_VEC_MASK, FIELD_PREP(ESI_VEC_MASK, MAX_ESI_VEC - 1),
21312122 REG_UFS_CFG3);
drivers/ufs/host/ufshcd-pci.c+1−0
@@ -630,6 +630,7 @@ static const struct pci_device_id ufshcd_pci_tbl[] = { · 629 unmodified lines
630630 { PCI_VDEVICE(INTEL, 0xA847), (kernel_ulong_t)&ufs_intel_mtl_hba_vops },
631631 { PCI_VDEVICE(INTEL, 0x7747), (kernel_ulong_t)&ufs_intel_mtl_hba_vops },
632632 { PCI_VDEVICE(INTEL, 0xE447), (kernel_ulong_t)&ufs_intel_mtl_hba_vops },
633+ { PCI_VDEVICE(INTEL, 0x4D47), (kernel_ulong_t)&ufs_intel_mtl_hba_vops },
633634 { } /* terminate list */
634635 };
635636
drivers/usb/chipidea/ci_hdrc_imx.c+2−1
@@ -338,7 +338,8 @@ static int ci_hdrc_imx_notify_event(struct ci_hdrc *ci, unsigned int event) · 337 unmodified lines
338338 schedule_work(&ci->usb_phy->chg_work);
339339 break;
340340 case CI_HDRC_CONTROLLER_PULLUP_EVENT:
341− if (ci->role == CI_ROLE_GADGET)
341+ if (ci->role == CI_ROLE_GADGET &&
342+ ci->gadget.speed == USB_SPEED_HIGH)
342343 imx_usbmisc_pullup(data->usbmisc_data,
343344 ci->gadget.connected);
344345 break;
drivers/usb/chipidea/usbmisc_imx.c+16−7
@@ -1068,15 +1068,24 @@ static void usbmisc_imx7d_pullup(struct imx_usbmisc_data *data, bool on) · 1067 unmodified lines
10681068 unsigned long flags;
10691069 u32 val;
10701070
1071+ if (on)
1072+ return;
1073+
10711074 spin_lock_irqsave(&usbmisc->lock, flags);
10721075 val = readl(usbmisc->base + MX7D_USBNC_USB_CTRL2);
1073− if (!on) {
1074− val &= ~MX7D_USBNC_USB_CTRL2_OPMODE_OVERRIDE_MASK;
1075− val |= MX7D_USBNC_USB_CTRL2_OPMODE(1);
1076− val |= MX7D_USBNC_USB_CTRL2_OPMODE_OVERRIDE_EN;
1077− } else {
1078− val &= ~MX7D_USBNC_USB_CTRL2_OPMODE_OVERRIDE_EN;
1079− }
1076+ val &= ~MX7D_USBNC_USB_CTRL2_OPMODE_OVERRIDE_MASK;
1077+ val |= MX7D_USBNC_USB_CTRL2_OPMODE(1);
1078+ val |= MX7D_USBNC_USB_CTRL2_OPMODE_OVERRIDE_EN;
1079+ writel(val, usbmisc->base + MX7D_USBNC_USB_CTRL2);
1080+ spin_unlock_irqrestore(&usbmisc->lock, flags);
1081+
1082+ /* Last for at least 1 micro-frame to let host see disconnect signal */
1083+ usleep_range(125, 150);
1084+
1085+ spin_lock_irqsave(&usbmisc->lock, flags);
1086+ val &= ~MX7D_USBNC_USB_CTRL2_OPMODE_OVERRIDE_MASK;
1087+ val |= MX7D_USBNC_USB_CTRL2_OPMODE(0);
1088+ val &= ~MX7D_USBNC_USB_CTRL2_OPMODE_OVERRIDE_EN;
10801089 writel(val, usbmisc->base + MX7D_USBNC_USB_CTRL2);
10811090 spin_unlock_irqrestore(&usbmisc->lock, flags);
10821091 }
drivers/usb/core/hcd.c+16−12
@@ -1636,7 +1636,6 @@ static void __usb_hcd_giveback_urb(struct urb *urb) · 1635 unmodified lines
16361636 struct usb_hcd *hcd = bus_to_hcd(urb->dev->bus);
16371637 struct usb_anchor *anchor = urb->anchor;
16381638 int status = urb->unlinked;
1639− unsigned long flags;
16401639
16411640 urb->hcpriv = NULL;
16421641 if (unlikely((urb->transfer_flags & URB_SHORT_NOT_OK) &&
@@ -1654,14 +1653,13 @@ static void __usb_hcd_giveback_urb(struct urb *urb) · 11 unmodified lines
16541653 /* pass ownership to the completion handler */
16551654 urb->status = status;
16561655 /*
1657− * Only collect coverage in the softirq context and disable interrupts
1658− * to avoid scenarios with nested remote coverage collection sections
1659− * that KCOV does not support.
1660− * See the comment next to kcov_remote_start_usb_softirq() for details.
1656+ * This function can be called in task context inside another remote
1657+ * coverage collection section, but kcov doesn't support that kind of
1658+ * recursion yet. Only collect coverage in softirq context for now.
16611659 */
1662− flags = kcov_remote_start_usb_softirq((u64)urb->dev->bus->busnum);
1660+ kcov_remote_start_usb_softirq((u64)urb->dev->bus->busnum);
16631661 urb->complete(urb);
1664− kcov_remote_stop_softirq(flags);
1662+ kcov_remote_stop_softirq();
16651663
16661664 usb_anchor_resume_wakeups(anchor);
16671665 atomic_dec(&urb->use_count);
@@ -1719,10 +1717,10 @@ static void usb_giveback_urb_bh(struct work_struct *work) · 51 unmodified lines
17191717 * @urb: urb being returned to the USB device driver.
17201718 * @status: completion status code for the URB.
17211719 *
1722− * Context: atomic. The completion callback is invoked in caller's context.
1723− * For HCDs with HCD_BH flag set, the completion callback is invoked in BH
1724− * context (except for URBs submitted to the root hub which always complete in
1725− * caller's context).
1720+ * Context: atomic. The completion callback is invoked either in a work queue
1721+ * (BH) context or in the caller's context, depending on whether the HCD_BH
1722+ * flag is set in the @hcd structure, except that URBs submitted to the
1723+ * root hub always complete in BH context.
17261724 *
17271725 * This hands the URB from HCD to its USB device driver, using its
17281726 * completion function. The HCD has freed all per-urb resources
@@ -2166,7 +2164,7 @@ static struct urb *request_single_step_set_feature_urb( · 437 unmodified lines
21662164 urb->complete = usb_ehset_completion;
21672165 urb->status = -EINPROGRESS;
21682166 urb->actual_length = 0;
2169− urb->transfer_flags = URB_DIR_IN;
2167+ urb->transfer_flags = URB_DIR_IN | URB_NO_TRANSFER_DMA_MAP;
21702168 usb_get_urb(urb);
21712169 atomic_inc(&urb->use_count);
21722170 atomic_inc(&urb->dev->urbnum);
@@ -2230,9 +2228,15 @@ int ehset_single_step_set_feature(struct usb_hcd *hcd, int port) · 57 unmodified lines
22302228
22312229 /* Complete remaining DATA and STATUS stages using the same URB */
22322230 urb->status = -EINPROGRESS;
2231+ urb->transfer_flags &= ~URB_NO_TRANSFER_DMA_MAP;
22332232 usb_get_urb(urb);
22342233 atomic_inc(&urb->use_count);
22352234 atomic_inc(&urb->dev->urbnum);
2235+ if (map_urb_for_dma(hcd, urb, GFP_KERNEL)) {
2236+ usb_put_urb(urb);
2237+ goto out1;
2238+ }
2239+
22362240 retval = hcd->driver->submit_single_step_set_feature(hcd, urb, 0);
22372241 if (!retval && !wait_for_completion_timeout(&done,
22382242 msecs_to_jiffies(2000))) {
drivers/usb/core/quirks.c+1−0
@@ -371,6 +371,7 @@ static const struct usb_device_id usb_quirk_list[] = { · 370 unmodified lines
371371 { USB_DEVICE(0x0781, 0x5591), .driver_info = USB_QUIRK_NO_LPM },
372372
373373 /* SanDisk Corp. SanDisk 3.2Gen1 */
374+ { USB_DEVICE(0x0781, 0x5596), .driver_info = USB_QUIRK_DELAY_INIT },
374375 { USB_DEVICE(0x0781, 0x55a3), .driver_info = USB_QUIRK_DELAY_INIT },
375376
376377 /* SanDisk Extreme 55AE */
drivers/usb/dwc3/dwc3-pci.c+2−0
@@ -41,6 +41,7 @@ · 40 unmodified lines
4141 #define PCI_DEVICE_ID_INTEL_TGPLP 0xa0ee
4242 #define PCI_DEVICE_ID_INTEL_TGPH 0x43ee
4343 #define PCI_DEVICE_ID_INTEL_JSP 0x4dee
44+#define PCI_DEVICE_ID_INTEL_WCL 0x4d7e
4445 #define PCI_DEVICE_ID_INTEL_ADL 0x460e
4546 #define PCI_DEVICE_ID_INTEL_ADL_PCH 0x51ee
4647 #define PCI_DEVICE_ID_INTEL_ADLN 0x465e
@@ -431,6 +432,7 @@ static const struct pci_device_id dwc3_pci_id_table[] = { · 384 unmodified lines
431432 { PCI_DEVICE_DATA(INTEL, TGPLP, &dwc3_pci_intel_swnode) },
432433 { PCI_DEVICE_DATA(INTEL, TGPH, &dwc3_pci_intel_swnode) },
433434 { PCI_DEVICE_DATA(INTEL, JSP, &dwc3_pci_intel_swnode) },
435+ { PCI_DEVICE_DATA(INTEL, WCL, &dwc3_pci_intel_swnode) },
434436 { PCI_DEVICE_DATA(INTEL, ADL, &dwc3_pci_intel_swnode) },
435437 { PCI_DEVICE_DATA(INTEL, ADL_PCH, &dwc3_pci_intel_swnode) },
436438 { PCI_DEVICE_DATA(INTEL, ADLN, &dwc3_pci_intel_swnode) },
drivers/usb/dwc3/ep0.c+16−4
@@ -288,7 +288,9 @@ void dwc3_ep0_out_start(struct dwc3 *dwc) · 287 unmodified lines
288288 dwc3_ep0_prepare_one_trb(dep, dwc->ep0_trb_addr, 8,
289289 DWC3_TRBCTL_CONTROL_SETUP, false);
290290 ret = dwc3_ep0_start_trans(dep);
291− WARN_ON(ret < 0);
291+ if (ret < 0)
292+ dev_err(dwc->dev, "ep0 out start transfer failed: %d\n", ret);
293+
292294 for (i = 2; i < DWC3_ENDPOINTS_NUM; i++) {
293295 struct dwc3_ep *dwc3_ep;
294296
@@ -1061,7 +1063,9 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc, · 766 unmodified lines
10611063 ret = dwc3_ep0_start_trans(dep);
10621064 }
10631065
1064− WARN_ON(ret < 0);
1066+ if (ret < 0)
1067+ dev_err(dwc->dev,
1068+ "ep0 data phase start transfer failed: %d\n", ret);
10651069 }
10661070
10671071 static int dwc3_ep0_start_control_status(struct dwc3_ep *dep)
@@ -1078,7 +1082,12 @@ static int dwc3_ep0_start_control_status(struct dwc3_ep *dep) · 10 unmodified lines
10781082
10791083 static void __dwc3_ep0_do_control_status(struct dwc3 *dwc, struct dwc3_ep *dep)
10801084 {
1081− WARN_ON(dwc3_ep0_start_control_status(dep));
1085+ int ret;
1086+
1087+ ret = dwc3_ep0_start_control_status(dep);
1088+ if (ret)
1089+ dev_err(dwc->dev,
1090+ "ep0 status phase start transfer failed: %d\n", ret);
10821091 }
10831092
10841093 static void dwc3_ep0_do_control_status(struct dwc3 *dwc,
@@ -1121,7 +1130,10 @@ void dwc3_ep0_end_control_data(struct dwc3 *dwc, struct dwc3_ep *dep) · 36 unmodified lines
11211130 cmd |= DWC3_DEPCMD_PARAM(dep->resource_index);
11221131 memset(&params, 0, sizeof(params));
11231132 ret = dwc3_send_gadget_ep_cmd(dep, cmd, &params);
1124− WARN_ON_ONCE(ret);
1133+ if (ret)
1134+ dev_err_ratelimited(dwc->dev,
1135+ "ep0 data phase end transfer failed: %d\n", ret);
1136+
11251137 dep->resource_index = 0;
11261138 }
11271139
drivers/usb/dwc3/gadget.c+17−2
@@ -1772,7 +1772,11 @@ static int __dwc3_stop_active_transfer(struct dwc3_ep *dep, bool force, bool int · 1771 unmodified lines
17721772 dep->flags |= DWC3_EP_DELAY_STOP;
17731773 return 0;
17741774 }
1775− WARN_ON_ONCE(ret);
1775+
1776+ if (ret)
1777+ dev_err_ratelimited(dep->dwc->dev,
1778+ "end transfer failed: %d\n", ret);
1779+
17761780 dep->resource_index = 0;
17771781
17781782 if (!interrupt)
@@ -3777,6 +3781,15 @@ static void dwc3_gadget_endpoint_transfer_complete(struct dwc3_ep *dep, · 1998 unmodified lines
37773781 static void dwc3_gadget_endpoint_transfer_not_ready(struct dwc3_ep *dep,
37783782 const struct dwc3_event_depevt *event)
37793783 {
3784+ /*
3785+ * During a device-initiated disconnect, a late xferNotReady event can
3786+ * be generated after the End Transfer command resets the event filter,
3787+ * but before the controller is halted. Ignore it to prevent a new
3788+ * transfer from starting.
3789+ */
3790+ if (!dep->dwc->connected)
3791+ return;
3792+
37803793 dwc3_gadget_endpoint_frame_from_event(dep, event);
37813794
37823795 /*
@@ -4039,7 +4052,9 @@ static void dwc3_clear_stall_all_ep(struct dwc3 *dwc) · 256 unmodified lines
40394052 dep->flags &= ~DWC3_EP_STALL;
40404053
40414054 ret = dwc3_send_clear_stall_ep_cmd(dep);
4042− WARN_ON_ONCE(ret);
4055+ if (ret)
4056+ dev_err_ratelimited(dwc->dev,
4057+ "failed to clear STALL on %s\n", dep->name);
40434058 }
40444059 }
40454060
drivers/usb/gadget/udc/tegra-xudc.c+7−2
@@ -502,6 +502,7 @@ struct tegra_xudc { · 501 unmodified lines
502502 struct clk_bulk_data *clks;
503503
504504 bool device_mode;
505+ bool current_device_mode;
505506 struct work_struct usb_role_sw_work;
506507
507508 struct phy **usb3_phy;
@@ -715,6 +716,8 @@ static void tegra_xudc_device_mode_on(struct tegra_xudc *xudc) · 207 unmodified lines
715716
716717 phy_set_mode_ext(xudc->curr_utmi_phy, PHY_MODE_USB_OTG,
717718 USB_ROLE_DEVICE);
719+
720+ xudc->current_device_mode = true;
718721 }
719722
720723 static void tegra_xudc_device_mode_off(struct tegra_xudc *xudc)
@@ -725,6 +728,8 @@ static void tegra_xudc_device_mode_off(struct tegra_xudc *xudc) · 4 unmodified lines
725728
726729 dev_dbg(xudc->dev, "device mode off\n");
727730
731+ xudc->current_device_mode = false;
732+
728733 connected = !!(xudc_readl(xudc, PORTSC) & PORTSC_CCS);
729734
730735 reinit_completion(&xudc->disconnect_complete);
@@ -4044,10 +4049,10 @@ static int __maybe_unused tegra_xudc_resume(struct device *dev) · 3313 unmodified lines
40444049
40454050 spin_lock_irqsave(&xudc->lock, flags);
40464051 xudc->suspended = false;
4052+ if (xudc->device_mode != xudc->current_device_mode)
4053+ schedule_work(&xudc->usb_role_sw_work);
40474054 spin_unlock_irqrestore(&xudc->lock, flags);
40484055
4049− schedule_work(&xudc->usb_role_sw_work);
4050−
40514056 pm_runtime_enable(dev);
40524057
40534058 return 0;
drivers/usb/host/xhci-hub.c+1−2
@@ -704,8 +704,7 @@ static int xhci_enter_test_mode(struct xhci_hcd *xhci, · 703 unmodified lines
704704 if (!xhci->devs[i])
705705 continue;
706706
707− retval = xhci_disable_slot(xhci, i);
708− xhci_free_virt_device(xhci, i);
707+ retval = xhci_disable_and_free_slot(xhci, i);
709708 if (retval)
710709 xhci_err(xhci, "Failed to disable slot %d, %d. Enter test mode anyway\n",
711710 i, retval);
drivers/usb/host/xhci-mem.c+11−11
@@ -865,21 +865,20 @@ free_tts: · 864 unmodified lines
865865 * will be manipulated by the configure endpoint, allocate device, or update
866866 * hub functions while this function is removing the TT entries from the list.
867867 */
868−void xhci_free_virt_device(struct xhci_hcd *xhci, int slot_id)
868+void xhci_free_virt_device(struct xhci_hcd *xhci, struct xhci_virt_device *dev,
869+ int slot_id)
869870 {
870− struct xhci_virt_device *dev;
871871 int i;
872872 int old_active_eps = 0;
873873
874874 /* Slot ID 0 is reserved */
875− if (slot_id == 0 || !xhci->devs[slot_id])
875+ if (slot_id == 0 || !dev)
876876 return;
877877
878− dev = xhci->devs[slot_id];
879−
880− xhci->dcbaa->dev_context_ptrs[slot_id] = 0;
881− if (!dev)
882− return;
878+ /* If device ctx array still points to _this_ device, clear it */
879+ if (dev->out_ctx &&
880+ xhci->dcbaa->dev_context_ptrs[slot_id] == cpu_to_le64(dev->out_ctx->dma))
881+ xhci->dcbaa->dev_context_ptrs[slot_id] = 0;
883882
884883 trace_xhci_free_virt_device(dev);
885884
@@ -920,8 +919,9 @@ void xhci_free_virt_device(struct xhci_hcd *xhci, int slot_id) · 34 unmodified lines
920919 dev->udev->slot_id = 0;
921920 if (dev->rhub_port && dev->rhub_port->slot_id == slot_id)
922921 dev->rhub_port->slot_id = 0;
923− kfree(xhci->devs[slot_id]);
924− xhci->devs[slot_id] = NULL;
922+ if (xhci->devs[slot_id] == dev)
923+ xhci->devs[slot_id] = NULL;
924+ kfree(dev);
925925 }
926926
927927 /*
@@ -962,7 +962,7 @@ static void xhci_free_virt_devices_depth_first(struct xhci_hcd *xhci, int slot_i · 34 unmodified lines
962962 out:
963963 /* we are now at a leaf device */
964964 xhci_debugfs_remove_slot(xhci, slot_id);
965− xhci_free_virt_device(xhci, slot_id);
965+ xhci_free_virt_device(xhci, vdev, slot_id);
966966 }
967967
968968 int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id,
drivers/usb/host/xhci-pci-renesas.c+4−3
@@ -47,8 +47,9 @@ · 46 unmodified lines
4747 #define RENESAS_ROM_ERASE_MAGIC 0x5A65726F
4848 #define RENESAS_ROM_WRITE_MAGIC 0x53524F4D
4949
50−#define RENESAS_RETRY 10000
51−#define RENESAS_DELAY 10
50+#define RENESAS_RETRY 50000 /* 50000 * RENESAS_DELAY ~= 500ms */
51+#define RENESAS_CHIP_ERASE_RETRY 500000 /* 500000 * RENESAS_DELAY ~= 5s */
52+#define RENESAS_DELAY 10
5253
5354 #define RENESAS_FW_NAME "renesas_usb_fw.mem"
5455
@@ -407,7 +408,7 @@ static void renesas_rom_erase(struct pci_dev *pdev) · 352 unmodified lines
407408 /* sleep a bit while ROM is erased */
408409 msleep(20);
409410
410− for (i = 0; i < RENESAS_RETRY; i++) {
411+ for (i = 0; i < RENESAS_CHIP_ERASE_RETRY; i++) {
411412 retval = pci_read_config_byte(pdev, RENESAS_ROM_STATUS,
412413 &status);
413414 status &= RENESAS_ROM_STATUS_ERASE;
drivers/usb/host/xhci-ring.c+7−2
@@ -1592,7 +1592,8 @@ static void xhci_handle_cmd_enable_slot(int slot_id, struct xhci_command *comman · 1591 unmodified lines
15921592 command->slot_id = 0;
15931593 }
15941594
1595−static void xhci_handle_cmd_disable_slot(struct xhci_hcd *xhci, int slot_id)
1595+static void xhci_handle_cmd_disable_slot(struct xhci_hcd *xhci, int slot_id,
1596+ u32 cmd_comp_code)
15961597 {
15971598 struct xhci_virt_device *virt_dev;
15981599 struct xhci_slot_ctx *slot_ctx;
@@ -1607,6 +1608,10 @@ static void xhci_handle_cmd_disable_slot(struct xhci_hcd *xhci, int slot_id) · 8 unmodified lines
16071608 if (xhci->quirks & XHCI_EP_LIMIT_QUIRK)
16081609 /* Delete default control endpoint resources */
16091610 xhci_free_device_endpoint_resources(xhci, virt_dev, true);
1611+ if (cmd_comp_code == COMP_SUCCESS) {
1612+ xhci->dcbaa->dev_context_ptrs[slot_id] = 0;
1613+ xhci->devs[slot_id] = NULL;
1614+ }
16101615 }
16111616
16121617 static void xhci_handle_cmd_config_ep(struct xhci_hcd *xhci, int slot_id)
@@ -1856,7 +1861,7 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, · 243 unmodified lines
18561861 xhci_handle_cmd_enable_slot(slot_id, cmd, cmd_comp_code);
18571862 break;
18581863 case TRB_DISABLE_SLOT:
1859− xhci_handle_cmd_disable_slot(xhci, slot_id);
1864+ xhci_handle_cmd_disable_slot(xhci, slot_id, cmd_comp_code);
18601865 break;
18611866 case TRB_CONFIG_EP:
18621867 if (!cmd->completion)
drivers/usb/host/xhci.c+16−7
@@ -309,6 +309,7 @@ int xhci_enable_interrupter(struct xhci_interrupter *ir) · 308 unmodified lines
309309 return -EINVAL;
310310
311311 iman = readl(&ir->ir_set->iman);
312+ iman &= ~IMAN_IP;
312313 iman |= IMAN_IE;
313314 writel(iman, &ir->ir_set->iman);
314315
@@ -325,6 +326,7 @@ int xhci_disable_interrupter(struct xhci_hcd *xhci, struct xhci_interrupter *ir) · 10 unmodified lines
325326 return -EINVAL;
326327
327328 iman = readl(&ir->ir_set->iman);
329+ iman &= ~IMAN_IP;
328330 iman &= ~IMAN_IE;
329331 writel(iman, &ir->ir_set->iman);
330332
@@ -3932,8 +3934,7 @@ static int xhci_discover_or_reset_device(struct usb_hcd *hcd, · 3601 unmodified lines
39323934 * Obtaining a new device slot to inform the xHCI host that
39333935 * the USB device has been reset.
39343936 */
3935− ret = xhci_disable_slot(xhci, udev->slot_id);
3936− xhci_free_virt_device(xhci, udev->slot_id);
3937+ ret = xhci_disable_and_free_slot(xhci, udev->slot_id);
39373938 if (!ret) {
39383939 ret = xhci_alloc_dev(hcd, udev);
39393940 if (ret == 1)
@@ -4090,7 +4091,7 @@ static void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev) · 150 unmodified lines
40904091 xhci_disable_slot(xhci, udev->slot_id);
40914092
40924093 spin_lock_irqsave(&xhci->lock, flags);
4093− xhci_free_virt_device(xhci, udev->slot_id);
4094+ xhci_free_virt_device(xhci, virt_dev, udev->slot_id);
40944095 spin_unlock_irqrestore(&xhci->lock, flags);
40954096
40964097 }
@@ -4139,6 +4140,16 @@ int xhci_disable_slot(struct xhci_hcd *xhci, u32 slot_id) · 42 unmodified lines
41394140 return 0;
41404141 }
41414142
4143+int xhci_disable_and_free_slot(struct xhci_hcd *xhci, u32 slot_id)
4144+{
4145+ struct xhci_virt_device *vdev = xhci->devs[slot_id];
4146+ int ret;
4147+
4148+ ret = xhci_disable_slot(xhci, slot_id);
4149+ xhci_free_virt_device(xhci, vdev, slot_id);
4150+ return ret;
4151+}
4152+
41424153 /*
41434154 * Checks if we have enough host controller resources for the default control
41444155 * endpoint.
@@ -4245,8 +4256,7 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev) · 100 unmodified lines
42454256 return 1;
42464257
42474258 disable_slot:
4248− xhci_disable_slot(xhci, udev->slot_id);
4249− xhci_free_virt_device(xhci, udev->slot_id);
4259+ xhci_disable_and_free_slot(xhci, udev->slot_id);
42504260
42514261 return 0;
42524262 }
@@ -4382,8 +4392,7 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev, · 129 unmodified lines
43824392 dev_warn(&udev->dev, "Device not responding to setup %s.\n", act);
43834393
43844394 mutex_unlock(&xhci->mutex);
4385− ret = xhci_disable_slot(xhci, udev->slot_id);
4386− xhci_free_virt_device(xhci, udev->slot_id);
4395+ ret = xhci_disable_and_free_slot(xhci, udev->slot_id);
43874396 if (!ret) {
43884397 if (xhci_alloc_dev(hcd, udev) == 1)
43894398 xhci_setup_addressable_virt_dev(xhci, udev);
drivers/usb/host/xhci.h+2−1
@@ -1791,7 +1791,7 @@ void xhci_dbg_trace(struct xhci_hcd *xhci, void (*trace)(struct va_format *), · 1790 unmodified lines
17911791 /* xHCI memory management */
17921792 void xhci_mem_cleanup(struct xhci_hcd *xhci);
17931793 int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags);
1794−void xhci_free_virt_device(struct xhci_hcd *xhci, int slot_id);
1794+void xhci_free_virt_device(struct xhci_hcd *xhci, struct xhci_virt_device *dev, int slot_id);
17951795 int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id, struct usb_device *udev, gfp_t flags);
17961796 int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *udev);
17971797 void xhci_copy_ep0_dequeue_into_input_ctx(struct xhci_hcd *xhci,
@@ -1888,6 +1888,7 @@ void xhci_reset_bandwidth(struct usb_hcd *hcd, struct usb_device *udev); · 90 unmodified lines
18881888 int xhci_update_hub_device(struct usb_hcd *hcd, struct usb_device *hdev,
18891889 struct usb_tt *tt, gfp_t mem_flags);
18901890 int xhci_disable_slot(struct xhci_hcd *xhci, u32 slot_id);
1891+int xhci_disable_and_free_slot(struct xhci_hcd *xhci, u32 slot_id);
18911892 int xhci_ext_cap_init(struct xhci_hcd *xhci);
18921893
18931894 int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup);
drivers/usb/storage/realtek_cr.c+1−1
@@ -252,7 +252,7 @@ static int rts51x_bulk_transport(struct us_data *us, u8 lun, · 251 unmodified lines
252252 return USB_STOR_TRANSPORT_ERROR;
253253 }
254254
255− residue = bcs->Residue;
255+ residue = le32_to_cpu(bcs->Residue);
256256 if (bcs->Tag != us->tag)
257257 return USB_STOR_TRANSPORT_ERROR;
258258
drivers/usb/storage/unusual_devs.h+29−0
@@ -934,6 +934,13 @@ UNUSUAL_DEV( 0x05e3, 0x0723, 0x9451, 0x9451, · 933 unmodified lines
934934 USB_SC_DEVICE, USB_PR_DEVICE, NULL,
935935 US_FL_SANE_SENSE ),
936936
937+/* Added by Maël GUERIN <mael.guerin@murena.io> */
938+UNUSUAL_DEV( 0x0603, 0x8611, 0x0000, 0xffff,
939+ "Novatek",
940+ "NTK96550-based camera",
941+ USB_SC_SCSI, USB_PR_BULK, NULL,
942+ US_FL_BULK_IGNORE_TAG ),
943+
937944 /*
938945 * Reported by Hanno Boeck <hanno@gmx.de>
939946 * Taken from the Lycoris Kernel
@@ -1494,6 +1501,28 @@ UNUSUAL_DEV( 0x0bc2, 0x3332, 0x0000, 0x9999, · 554 unmodified lines
14941501 USB_SC_DEVICE, USB_PR_DEVICE, NULL,
14951502 US_FL_NO_WP_DETECT ),
14961503
1504+/*
1505+ * Reported by Zenm Chen <zenmchen@gmail.com>
1506+ * Ignore driver CD mode, otherwise usb_modeswitch may fail to switch
1507+ * the device into Wi-Fi mode.
1508+ */
1509+UNUSUAL_DEV( 0x0bda, 0x1a2b, 0x0000, 0xffff,
1510+ "Realtek",
1511+ "DISK",
1512+ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
1513+ US_FL_IGNORE_DEVICE ),
1514+
1515+/*
1516+ * Reported by Zenm Chen <zenmchen@gmail.com>
1517+ * Ignore driver CD mode, otherwise usb_modeswitch may fail to switch
1518+ * the device into Wi-Fi mode.
1519+ */
1520+UNUSUAL_DEV( 0x0bda, 0xa192, 0x0000, 0xffff,
1521+ "Realtek",
1522+ "DISK",
1523+ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
1524+ US_FL_IGNORE_DEVICE ),
1525+
14971526 UNUSUAL_DEV( 0x0d49, 0x7310, 0x0000, 0x9999,
14981527 "Maxtor",
14991528 "USB to SATA",
drivers/usb/typec/tcpm/fusb302.c+8−4
@@ -1485,6 +1485,9 @@ static irqreturn_t fusb302_irq_intn(int irq, void *dev_id) · 1484 unmodified lines
14851485 struct fusb302_chip *chip = dev_id;
14861486 unsigned long flags;
14871487
1488+ /* Disable our level triggered IRQ until our irq_work has cleared it */
1489+ disable_irq_nosync(chip->gpio_int_n_irq);
1490+
14881491 spin_lock_irqsave(&chip->irq_lock, flags);
14891492 if (chip->irq_suspended)
14901493 chip->irq_while_suspended = true;
@@ -1627,6 +1630,7 @@ static void fusb302_irq_work(struct work_struct *work) · 136 unmodified lines
16271630 }
16281631 done:
16291632 mutex_unlock(&chip->lock);
1633+ enable_irq(chip->gpio_int_n_irq);
16301634 }
16311635
16321636 static int init_gpio(struct fusb302_chip *chip)
@@ -1751,10 +1755,9 @@ static int fusb302_probe(struct i2c_client *client) · 118 unmodified lines
17511755 goto destroy_workqueue;
17521756 }
17531757
1754− ret = devm_request_threaded_irq(dev, chip->gpio_int_n_irq,
1755− NULL, fusb302_irq_intn,
1756− IRQF_ONESHOT | IRQF_TRIGGER_LOW,
1757− "fsc_interrupt_int_n", chip);
1758+ ret = request_irq(chip->gpio_int_n_irq, fusb302_irq_intn,
1759+ IRQF_ONESHOT | IRQF_TRIGGER_LOW,
1760+ "fsc_interrupt_int_n", chip);
17581761 if (ret < 0) {
17591762 dev_err(dev, "cannot request IRQ for GPIO Int_N, ret=%d", ret);
17601763 goto tcpm_unregister_port;
@@ -1779,6 +1782,7 @@ static void fusb302_remove(struct i2c_client *client) · 18 unmodified lines
17791782 struct fusb302_chip *chip = i2c_get_clientdata(client);
17801783
17811784 disable_irq_wake(chip->gpio_int_n_irq);
1785+ free_irq(chip->gpio_int_n_irq, chip);
17821786 cancel_work_sync(&chip->irq_work);
17831787 cancel_delayed_work_sync(&chip->bc_lvl_handler);
17841788 tcpm_unregister_port(chip->tcpm_port);
drivers/usb/typec/tcpm/maxim_contaminant.c+58−0
@@ -188,6 +188,11 @@ static int max_contaminant_read_comparators(struct max_tcpci_chip *chip, u8 *ven · 187 unmodified lines
188188 if (ret < 0)
189189 return ret;
190190
191+ /* Disable low power mode */
192+ ret = regmap_update_bits(regmap, TCPC_VENDOR_CC_CTRL2, CCLPMODESEL,
193+ FIELD_PREP(CCLPMODESEL,
194+ LOW_POWER_MODE_DISABLE));
195+
191196 /* Sleep to allow comparators settle */
192197 usleep_range(5000, 6000);
193198 ret = regmap_update_bits(regmap, TCPC_TCPC_CTRL, TCPC_TCPC_CTRL_ORIENTATION, PLUG_ORNT_CC1);
@@ -324,6 +329,39 @@ static int max_contaminant_enable_dry_detection(struct max_tcpci_chip *chip) · 130 unmodified lines
324329 return 0;
325330 }
326331
332+static int max_contaminant_enable_toggling(struct max_tcpci_chip *chip)
333+{
334+ struct regmap *regmap = chip->data.regmap;
335+ int ret;
336+
337+ /* Disable dry detection if enabled. */
338+ ret = regmap_update_bits(regmap, TCPC_VENDOR_CC_CTRL2, CCLPMODESEL,
339+ FIELD_PREP(CCLPMODESEL,
340+ LOW_POWER_MODE_DISABLE));
341+ if (ret)
342+ return ret;
343+
344+ ret = regmap_update_bits(regmap, TCPC_VENDOR_CC_CTRL1, CCCONNDRY, 0);
345+ if (ret)
346+ return ret;
347+
348+ ret = max_tcpci_write8(chip, TCPC_ROLE_CTRL, TCPC_ROLE_CTRL_DRP |
349+ FIELD_PREP(TCPC_ROLE_CTRL_CC1,
350+ TCPC_ROLE_CTRL_CC_RD) |
351+ FIELD_PREP(TCPC_ROLE_CTRL_CC2,
352+ TCPC_ROLE_CTRL_CC_RD));
353+ if (ret)
354+ return ret;
355+
356+ ret = regmap_update_bits(regmap, TCPC_TCPC_CTRL,
357+ TCPC_TCPC_CTRL_EN_LK4CONN_ALRT,
358+ TCPC_TCPC_CTRL_EN_LK4CONN_ALRT);
359+ if (ret)
360+ return ret;
361+
362+ return max_tcpci_write8(chip, TCPC_COMMAND, TCPC_CMD_LOOK4CONNECTION);
363+}
364+
327365 bool max_contaminant_is_contaminant(struct max_tcpci_chip *chip, bool disconnect_while_debounce,
328366 bool *cc_handled)
329367 {
@@ -340,6 +378,12 @@ bool max_contaminant_is_contaminant(struct max_tcpci_chip *chip, bool disconnect · 10 unmodified lines
340378 if (ret < 0)
341379 return false;
342380
381+ if (cc_status & TCPC_CC_STATUS_TOGGLING) {
382+ if (chip->contaminant_state == DETECTED)
383+ return true;
384+ return false;
385+ }
386+
343387 if (chip->contaminant_state == NOT_DETECTED || chip->contaminant_state == SINK) {
344388 if (!disconnect_while_debounce)
345389 msleep(100);
@@ -372,6 +416,12 @@ bool max_contaminant_is_contaminant(struct max_tcpci_chip *chip, bool disconnect · 26 unmodified lines
372416 max_contaminant_enable_dry_detection(chip);
373417 return true;
374418 }
419+
420+ ret = max_contaminant_enable_toggling(chip);
421+ if (ret)
422+ dev_err(chip->dev,
423+ "Failed to enable toggling, ret=%d",
424+ ret);
375425 }
376426 } else if (chip->contaminant_state == DETECTED) {
377427 if (!(cc_status & TCPC_CC_STATUS_TOGGLING)) {
@@ -379,6 +429,14 @@ bool max_contaminant_is_contaminant(struct max_tcpci_chip *chip, bool disconnect · 1 unmodified line
379429 if (chip->contaminant_state == DETECTED) {
380430 max_contaminant_enable_dry_detection(chip);
381431 return true;
432+ } else {
433+ ret = max_contaminant_enable_toggling(chip);
434+ if (ret) {
435+ dev_err(chip->dev,
436+ "Failed to enable toggling, ret=%d",
437+ ret);
438+ return true;
439+ }
382440 }
383441 }
384442 }
drivers/usb/typec/tcpm/tcpci_maxim.h+1−0
@@ -21,6 +21,7 @@ · 20 unmodified lines
2121 #define CCOVPDIS BIT(6)
2222 #define SBURPCTRL BIT(5)
2323 #define CCLPMODESEL GENMASK(4, 3)
24+#define LOW_POWER_MODE_DISABLE 0
2425 #define ULTRA_LOW_POWER_MODE 1
2526 #define CCRPCTRL GENMASK(2, 0)
2627 #define UA_1_SRC 1
drivers/vhost/net.c+7−2
@@ -99,6 +99,7 @@ struct vhost_net_ubuf_ref { · 98 unmodified lines
9999 atomic_t refcount;
100100 wait_queue_head_t wait;
101101 struct vhost_virtqueue *vq;
102+ struct rcu_head rcu;
102103 };
103104
104105 #define VHOST_NET_BATCH 64
@@ -250,9 +251,13 @@ vhost_net_ubuf_alloc(struct vhost_virtqueue *vq, bool zcopy) · 145 unmodified lines
250251
251252 static int vhost_net_ubuf_put(struct vhost_net_ubuf_ref *ubufs)
252253 {
253− int r = atomic_sub_return(1, &ubufs->refcount);
254+ int r;
255+
256+ rcu_read_lock();
257+ r = atomic_sub_return(1, &ubufs->refcount);
254258 if (unlikely(!r))
255259 wake_up(&ubufs->wait);
260+ rcu_read_unlock();
256261 return r;
257262 }
258263
@@ -265,7 +270,7 @@ static void vhost_net_ubuf_put_and_wait(struct vhost_net_ubuf_ref *ubufs) · 6 unmodified lines
265270 static void vhost_net_ubuf_put_wait_and_free(struct vhost_net_ubuf_ref *ubufs)
266271 {
267272 vhost_net_ubuf_put_and_wait(ubufs);
268− kfree(ubufs);
273+ kfree_rcu(ubufs, rcu);
269274 }
270275
271276 static void vhost_net_clear_ubuf_info(struct vhost_net *n)
drivers/virtio/virtio_input.c+4−0
@@ -360,11 +360,15 @@ static int virtinput_freeze(struct virtio_device *vdev) · 359 unmodified lines
360360 {
361361 struct virtio_input *vi = vdev->priv;
362362 unsigned long flags;
363+ void *buf;
363364
364365 spin_lock_irqsave(&vi->lock, flags);
365366 vi->ready = false;
366367 spin_unlock_irqrestore(&vi->lock, flags);
367368
369+ virtio_reset_device(vdev);
370+ while ((buf = virtqueue_detach_unused_buf(vi->sts)) != NULL)
371+ kfree(buf);
368372 vdev->config->del_vqs(vdev);
369373 return 0;
370374 }
drivers/virtio/virtio_pci_legacy_dev.c+2−2
@@ -140,9 +140,9 @@ EXPORT_SYMBOL_GPL(vp_legacy_set_status); · 139 unmodified lines
140140 * vp_legacy_queue_vector - set the MSIX vector for a specific virtqueue
141141 * @ldev: the legacy virtio-pci device
142142 * @index: queue index
143− * @vector: the config vector
143+ * @vector: the queue vector
144144 *
145− * Returns the config vector read from the device
145+ * Returns the queue vector read from the device
146146 */
147147 u16 vp_legacy_queue_vector(struct virtio_pci_legacy_device *ldev,
148148 u16 index, u16 vector)
drivers/virtio/virtio_pci_modern_dev.c+2−2
@@ -546,9 +546,9 @@ EXPORT_SYMBOL_GPL(vp_modern_set_queue_reset); · 545 unmodified lines
546546 * vp_modern_queue_vector - set the MSIX vector for a specific virtqueue
547547 * @mdev: the modern virtio-pci device
548548 * @index: queue index
549− * @vector: the config vector
549+ * @vector: the queue vector
550550 *
551− * Returns the config vector read from the device
551+ * Returns the queue vector read from the device
552552 */
553553 u16 vp_modern_queue_vector(struct virtio_pci_modern_device *mdev,
554554 u16 index, u16 vector)
drivers/xen/xenbus/xenbus_xs.c+0−23
@@ -718,26 +718,6 @@ int xs_watch_msg(struct xs_watch_event *event) · 717 unmodified lines
718718 return 0;
719719 }
720720
721−/*
722− * Certain older XenBus toolstack cannot handle reading values that are
723− * not populated. Some Xen 3.4 installation are incapable of doing this
724− * so if we are running on anything older than 4 do not attempt to read
725− * control/platform-feature-xs_reset_watches.
726− */
727−static bool xen_strict_xenbus_quirk(void)
728−{
729−#ifdef CONFIG_X86
730− uint32_t eax, ebx, ecx, edx, base;
731−
732− base = xen_cpuid_base();
733− cpuid(base + 1, &eax, &ebx, &ecx, &edx);
734−
735− if ((eax >> 16) < 4)
736− return true;
737−#endif
738− return false;
739−
740−}
741721 static void xs_reset_watches(void)
742722 {
743723 int err;
@@ -745,9 +725,6 @@ static void xs_reset_watches(void) · 1 unmodified line
745725 if (!xen_hvm_domain() || xen_initial_domain())
746726 return;
747727
748− if (xen_strict_xenbus_quirk())
749− return;
750−
751728 if (!xenbus_read_unsigned("control",
752729 "platform-feature-xs_reset_watches", 0))
753730 return;
fs/debugfs/inode.c+10−1
@@ -183,6 +183,9 @@ static int debugfs_reconfigure(struct fs_context *fc) · 182 unmodified lines
183183 struct debugfs_fs_info *sb_opts = sb->s_fs_info;
184184 struct debugfs_fs_info *new_opts = fc->s_fs_info;
185185
186+ if (!new_opts)
187+ return 0;
188+
186189 sync_filesystem(sb);
187190
188191 /* structure copy of new mount options to sb */
@@ -282,10 +285,16 @@ static int debugfs_fill_super(struct super_block *sb, struct fs_context *fc) · 93 unmodified lines
282285
283286 static int debugfs_get_tree(struct fs_context *fc)
284287 {
288+ int err;
289+
285290 if (!(debugfs_allow & DEBUGFS_ALLOW_API))
286291 return -EPERM;
287292
288− return get_tree_single(fc, debugfs_fill_super);
293+ err = get_tree_single(fc, debugfs_fill_super);
294+ if (err)
295+ return err;
296+
297+ return debugfs_reconfigure(fc);
289298 }
290299
291300 static void debugfs_free_fc(struct fs_context *fc)
fs/nfs/pagelist.c+5−4
@@ -253,13 +253,14 @@ nfs_page_group_unlock(struct nfs_page *req) · 252 unmodified lines
253253 nfs_page_clear_headlock(req);
254254 }
255255
256−/*
257− * nfs_page_group_sync_on_bit_locked
256+/**
257+ * nfs_page_group_sync_on_bit_locked - Test if all requests have @bit set
258+ * @req: request in page group
259+ * @bit: PG_* bit that is used to sync page group
258260 *
259261 * must be called with page group lock held
260262 */
261−static bool
262−nfs_page_group_sync_on_bit_locked(struct nfs_page *req, unsigned int bit)
263+bool nfs_page_group_sync_on_bit_locked(struct nfs_page *req, unsigned int bit)
263264 {
264265 struct nfs_page *head = req->wb_head;
265266 struct nfs_page *tmp;
fs/nfs/write.c+10−19
@@ -153,20 +153,10 @@ nfs_page_set_inode_ref(struct nfs_page *req, struct inode *inode) · 152 unmodified lines
153153 }
154154 }
155155
156−static int
157−nfs_cancel_remove_inode(struct nfs_page *req, struct inode *inode)
156+static void nfs_cancel_remove_inode(struct nfs_page *req, struct inode *inode)
158157 {
159− int ret;
160−
161− if (!test_bit(PG_REMOVE, &req->wb_flags))
162− return 0;
163− ret = nfs_page_group_lock(req);
164− if (ret)
165− return ret;
166158 if (test_and_clear_bit(PG_REMOVE, &req->wb_flags))
167159 nfs_page_set_inode_ref(req, inode);
168− nfs_page_group_unlock(req);
169− return 0;
170160 }
171161
172162 /**
@@ -585,19 +575,18 @@ retry: · 412 unmodified lines
585575 }
586576 }
587577
578+ ret = nfs_page_group_lock(head);
579+ if (ret < 0)
580+ goto out_unlock;
581+
588582 /* Ensure that nobody removed the request before we locked it */
589583 if (head != folio->private) {
584+ nfs_page_group_unlock(head);
590585 nfs_unlock_and_release_request(head);
591586 goto retry;
592587 }
593588
594− ret = nfs_cancel_remove_inode(head, inode);
595− if (ret < 0)
596− goto out_unlock;
597−
598− ret = nfs_page_group_lock(head);
599− if (ret < 0)
600− goto out_unlock;
589+ nfs_cancel_remove_inode(head, inode);
601590
602591 /* lock each request in the page group */
603592 for (subreq = head->wb_this_page;
@@ -786,7 +775,8 @@ static void nfs_inode_remove_request(struct nfs_page *req) · 182 unmodified lines
786775 {
787776 struct nfs_inode *nfsi = NFS_I(nfs_page_to_inode(req));
788777
789− if (nfs_page_group_sync_on_bit(req, PG_REMOVE)) {
778+ nfs_page_group_lock(req);
779+ if (nfs_page_group_sync_on_bit_locked(req, PG_REMOVE)) {
790780 struct folio *folio = nfs_page_to_folio(req->wb_head);
791781 struct address_space *mapping = folio->mapping;
792782
@@ -798,6 +788,7 @@ static void nfs_inode_remove_request(struct nfs_page *req) · 5 unmodified lines
798788 }
799789 spin_unlock(&mapping->i_private_lock);
800790 }
791+ nfs_page_group_unlock(req);
801792
802793 if (test_and_clear_bit(PG_INODE_REF, &req->wb_flags)) {
803794 atomic_long_dec(&nfsi->nrequests);
fs/smb/client/smb2ops.c+1−1
@@ -4496,7 +4496,7 @@ smb3_init_transform_rq(struct TCP_Server_Info *server, int num_rqst, · 4495 unmodified lines
44964496 for (int i = 1; i < num_rqst; i++) {
44974497 struct smb_rqst *old = &old_rq[i - 1];
44984498 struct smb_rqst *new = &new_rq[i];
4499− struct folio_queue *buffer;
4499+ struct folio_queue *buffer = NULL;
45004500 size_t size = iov_iter_count(&old->rq_iter);
45014501
45024502 orig_len += smb_rqst_len(server, old);
fs/squashfs/super.c+7−7
@@ -187,10 +187,15 @@ static int squashfs_fill_super(struct super_block *sb, struct fs_context *fc) · 186 unmodified lines
187187 unsigned short flags;
188188 unsigned int fragments;
189189 u64 lookup_table_start, xattr_id_table_start, next_table;
190− int err;
190+ int err, devblksize = sb_min_blocksize(sb, SQUASHFS_DEVBLK_SIZE);
191191
192192 TRACE("Entered squashfs_fill_superblock\n");
193193
194+ if (!devblksize) {
195+ errorf(fc, "squashfs: unable to set blocksize\n");
196+ return -EINVAL;
197+ }
198+
194199 sb->s_fs_info = kzalloc(sizeof(*msblk), GFP_KERNEL);
195200 if (sb->s_fs_info == NULL) {
196201 ERROR("Failed to allocate squashfs_sb_info\n");
@@ -201,12 +206,7 @@ static int squashfs_fill_super(struct super_block *sb, struct fs_context *fc) · 4 unmodified lines
201206
202207 msblk->panic_on_errors = (opts->errors == Opt_errors_panic);
203208
204− msblk->devblksize = sb_min_blocksize(sb, SQUASHFS_DEVBLK_SIZE);
205− if (!msblk->devblksize) {
206− errorf(fc, "squashfs: unable to set blocksize\n");
207− return -EINVAL;
208− }
209−
209+ msblk->devblksize = devblksize;
210210 msblk->devblksize_log2 = ffz(~msblk->devblksize);
211211
212212 mutex_init(&msblk->meta_index_mutex);
include/linux/atmdev.h+1−0
@@ -185,6 +185,7 @@ struct atmdev_ops { /* only send is required */ · 184 unmodified lines
185185 int (*compat_ioctl)(struct atm_dev *dev,unsigned int cmd,
186186 void __user *arg);
187187 #endif
188+ int (*pre_send)(struct atm_vcc *vcc, struct sk_buff *skb);
188189 int (*send)(struct atm_vcc *vcc,struct sk_buff *skb);
189190 int (*send_bh)(struct atm_vcc *vcc, struct sk_buff *skb);
190191 int (*send_oam)(struct atm_vcc *vcc,void *cell,int flags);
include/linux/blkdev.h+1−0
@@ -656,6 +656,7 @@ enum { · 655 unmodified lines
656656 QUEUE_FLAG_SQ_SCHED, /* single queue style io dispatch */
657657 QUEUE_FLAG_DISABLE_WBT_DEF, /* for sched to disable/enable wbt */
658658 QUEUE_FLAG_NO_ELV_SWITCH, /* can't switch elevator any more */
659+ QUEUE_FLAG_QOS_ENABLED, /* qos is enabled */
659660 QUEUE_FLAG_MAX
660661 };
661662
include/linux/compiler.h+0−8
@@ -288,14 +288,6 @@ static inline void *offset_to_ptr(const int *off) · 287 unmodified lines
288288 #define __ADDRESSABLE(sym) \
289289 ___ADDRESSABLE(sym, __section(".discard.addressable"))
290290
291−#define __ADDRESSABLE_ASM(sym) \
292− .pushsection .discard.addressable,"aw"; \
293− .align ARCH_SEL(8,4); \
294− ARCH_SEL(.quad, .long) __stringify(sym); \
295− .popsection;
296−
297−#define __ADDRESSABLE_ASM_STR(sym) __stringify(__ADDRESSABLE_ASM(sym))
298−
299291 /*
300292 * This returns a constant expression while determining if an argument is
301293 * a constant expression, most importantly without evaluating the argument.
include/linux/dma-map-ops.h+3−0
@@ -153,6 +153,9 @@ static inline void dma_free_contiguous(struct device *dev, struct page *page, · 152 unmodified lines
153153 {
154154 __free_pages(page, get_order(size));
155155 }
156+static inline void dma_contiguous_early_fixup(phys_addr_t base, unsigned long size)
157+{
158+}
156159 #endif /* CONFIG_DMA_CMA*/
157160
158161 #ifdef CONFIG_DMA_DECLARE_COHERENT
include/linux/iosys-map.h+1−6
@@ -264,12 +264,7 @@ static inline bool iosys_map_is_set(const struct iosys_map *map) · 263 unmodified lines
264264 */
265265 static inline void iosys_map_clear(struct iosys_map *map)
266266 {
267− if (map->is_iomem) {
268− map->vaddr_iomem = NULL;
269− map->is_iomem = false;
270− } else {
271− map->vaddr = NULL;
272− }
267+ memset(map, 0, sizeof(*map));
273268 }
274269
275270 /**
include/linux/iov_iter.h+11−9
@@ -160,7 +160,7 @@ size_t iterate_folioq(struct iov_iter *iter, size_t len, void *priv, void *priv2 · 159 unmodified lines
160160
161161 do {
162162 struct folio *folio = folioq_folio(folioq, slot);
163− size_t part, remain, consumed;
163+ size_t part, remain = 0, consumed;
164164 size_t fsize;
165165 void *base;
166166
@@ -168,14 +168,16 @@ size_t iterate_folioq(struct iov_iter *iter, size_t len, void *priv, void *priv2 · 1 unmodified line
168168 break;
169169
170170 fsize = folioq_folio_size(folioq, slot);
171− base = kmap_local_folio(folio, skip);
172− part = umin(len, PAGE_SIZE - skip % PAGE_SIZE);
173− remain = step(base, progress, part, priv, priv2);
174− kunmap_local(base);
175− consumed = part - remain;
176− len -= consumed;
177− progress += consumed;
178− skip += consumed;
171+ if (skip < fsize) {
172+ base = kmap_local_folio(folio, skip);
173+ part = umin(len, PAGE_SIZE - skip % PAGE_SIZE);
174+ remain = step(base, progress, part, priv, priv2);
175+ kunmap_local(base);
176+ consumed = part - remain;
177+ len -= consumed;
178+ progress += consumed;
179+ skip += consumed;
180+ }
179181 if (skip >= fsize) {
180182 skip = 0;
181183 slot++;
include/linux/kcov.h+9−38
@@ -57,47 +57,21 @@ static inline void kcov_remote_start_usb(u64 id) · 56 unmodified lines
5757
5858 /*
5959 * The softirq flavor of kcov_remote_*() functions is introduced as a temporary
60− * workaround for KCOV's lack of nested remote coverage sections support.
61− *
62− * Adding support is tracked in https://bugzilla.kernel.org/show_bug.cgi?id=210337.
63− *
64− * kcov_remote_start_usb_softirq():
65− *
66− * 1. Only collects coverage when called in the softirq context. This allows
67− * avoiding nested remote coverage collection sections in the task context.
68− * For example, USB/IP calls usb_hcd_giveback_urb() in the task context
69− * within an existing remote coverage collection section. Thus, KCOV should
70− * not attempt to start collecting coverage within the coverage collection
71− * section in __usb_hcd_giveback_urb() in this case.
72− *
73− * 2. Disables interrupts for the duration of the coverage collection section.
74− * This allows avoiding nested remote coverage collection sections in the
75− * softirq context (a softirq might occur during the execution of a work in
76− * the BH workqueue, which runs with in_serving_softirq() > 0).
77− * For example, usb_giveback_urb_bh() runs in the BH workqueue with
78− * interrupts enabled, so __usb_hcd_giveback_urb() might be interrupted in
79− * the middle of its remote coverage collection section, and the interrupt
80− * handler might invoke __usb_hcd_giveback_urb() again.
60+ * work around for kcov's lack of nested remote coverage sections support in
61+ * task context. Adding support for nested sections is tracked in:
62+ * https://bugzilla.kernel.org/show_bug.cgi?id=210337
8163 */
8264
83−static inline unsigned long kcov_remote_start_usb_softirq(u64 id)
65+static inline void kcov_remote_start_usb_softirq(u64 id)
8466 {
85− unsigned long flags = 0;
86−
87− if (in_serving_softirq()) {
88− local_irq_save(flags);
67+ if (in_serving_softirq() && !in_hardirq())
8968 kcov_remote_start_usb(id);
90− }
91−
92− return flags;
9369 }
9470
95−static inline void kcov_remote_stop_softirq(unsigned long flags)
71+static inline void kcov_remote_stop_softirq(void)
9672 {
97− if (in_serving_softirq()) {
73+ if (in_serving_softirq() && !in_hardirq())
9874 kcov_remote_stop();
99− local_irq_restore(flags);
100− }
10175 }
10276
10377 #ifdef CONFIG_64BIT
@@ -131,11 +105,8 @@ static inline u64 kcov_common_handle(void) · 27 unmodified lines
131105 }
132106 static inline void kcov_remote_start_common(u64 id) {}
133107 static inline void kcov_remote_start_usb(u64 id) {}
134−static inline unsigned long kcov_remote_start_usb_softirq(u64 id)
135−{
136− return 0;
137−}
138−static inline void kcov_remote_stop_softirq(unsigned long flags) {}
108+static inline void kcov_remote_start_usb_softirq(u64 id) {}
109+static inline void kcov_remote_stop_softirq(void) {}
139110
140111 #endif /* CONFIG_KCOV */
141112 #endif /* _LINUX_KCOV_H */
include/linux/memblock.h+3−2
@@ -40,8 +40,9 @@ extern unsigned long long max_possible_pfn; · 39 unmodified lines
4040 * via a driver, and never indicated in the firmware-provided memory map as
4141 * system RAM. This corresponds to IORESOURCE_SYSRAM_DRIVER_MANAGED in the
4242 * kernel resource tree.
43− * @MEMBLOCK_RSRV_NOINIT: memory region for which struct pages are
44− * not initialized (only for reserved regions).
43+ * @MEMBLOCK_RSRV_NOINIT: reserved memory region for which struct pages are not
44+ * fully initialized. Users of this flag are responsible to properly initialize
45+ * struct pages of this region
4546 * @MEMBLOCK_RSRV_KERN: memory region that is reserved for kernel use,
4647 * either explictitly with memblock_reserve_kern() or via memblock
4748 * allocation APIs. All memblock allocations set this flag.
include/linux/migrate.h+5−0
@@ -79,6 +79,7 @@ void migration_entry_wait_on_locked(swp_entry_t entry, spinlock_t *ptl) · 78 unmodified lines
7979 void folio_migrate_flags(struct folio *newfolio, struct folio *folio);
8080 int folio_migrate_mapping(struct address_space *mapping,
8181 struct folio *newfolio, struct folio *folio, int extra_count);
82+int set_movable_ops(const struct movable_operations *ops, enum pagetype type);
8283
8384 #else
8485
@@ -100,6 +101,10 @@ static inline int migrate_huge_page_move_mapping(struct address_space *mapping, · 15 unmodified lines
100101 {
101102 return -ENOSYS;
102103 }
104+static inline int set_movable_ops(const struct movable_operations *ops, enum pagetype type)
105+{
106+ return -ENOSYS;
107+}
103108
104109 #endif /* CONFIG_MIGRATION */
105110
include/linux/nfs_page.h+1−0
@@ -160,6 +160,7 @@ extern void nfs_join_page_group(struct nfs_page *head, · 159 unmodified lines
160160 extern int nfs_page_group_lock(struct nfs_page *);
161161 extern void nfs_page_group_unlock(struct nfs_page *);
162162 extern bool nfs_page_group_sync_on_bit(struct nfs_page *, unsigned int);
163+extern bool nfs_page_group_sync_on_bit_locked(struct nfs_page *, unsigned int);
163164 extern int nfs_page_set_headlock(struct nfs_page *req);
164165 extern void nfs_page_clear_headlock(struct nfs_page *req);
165166 extern bool nfs_async_iocounter_wait(struct rpc_task *, struct nfs_lock_context *);
include/linux/platform_data/x86/int3472.h+1−0
@@ -27,6 +27,7 @@ · 26 unmodified lines
2727 #define INT3472_GPIO_TYPE_CLK_ENABLE 0x0c
2828 #define INT3472_GPIO_TYPE_PRIVACY_LED 0x0d
2929 #define INT3472_GPIO_TYPE_HANDSHAKE 0x12
30+#define INT3472_GPIO_TYPE_HOTPLUG_DETECT 0x13
3031
3132 #define INT3472_PDEV_MAX_NAME_LEN 23
3233 #define INT3472_MAX_SENSOR_GPIOS 3
include/linux/skbuff.h+2−0
@@ -4213,6 +4213,8 @@ int skb_copy_and_crc32c_datagram_iter(const struct sk_buff *skb, int offset, · 4212 unmodified lines
42134213 struct iov_iter *to, int len, u32 *crcp);
42144214 int skb_copy_datagram_from_iter(struct sk_buff *skb, int offset,
42154215 struct iov_iter *from, int len);
4216+int skb_copy_datagram_from_iter_full(struct sk_buff *skb, int offset,
4217+ struct iov_iter *from, int len);
42164218 int zerocopy_sg_from_iter(struct sk_buff *skb, struct iov_iter *frm);
42174219 void skb_free_datagram(struct sock *sk, struct sk_buff *skb);
42184220 int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, unsigned int flags);
include/linux/virtio_config.h+0−2
@@ -328,8 +328,6 @@ static inline · 327 unmodified lines
328328 bool virtio_get_shm_region(struct virtio_device *vdev,
329329 struct virtio_shm_region *region, u8 id)
330330 {
331− if (!region->len)
332− return false;
333331 if (!vdev->config->get_shm_region)
334332 return false;
335333 return vdev->config->get_shm_region(vdev, region, id);
include/net/bluetooth/hci_sync.h+1−1
@@ -93,7 +93,7 @@ int hci_update_class_sync(struct hci_dev *hdev); · 92 unmodified lines
9393
9494 int hci_update_eir_sync(struct hci_dev *hdev);
9595 int hci_update_class_sync(struct hci_dev *hdev);
96−int hci_update_name_sync(struct hci_dev *hdev);
96+int hci_update_name_sync(struct hci_dev *hdev, const u8 *name);
9797 int hci_write_ssp_mode_sync(struct hci_dev *hdev, u8 mode);
9898
9999 int hci_get_random_address(struct hci_dev *hdev, bool require_privacy,
include/net/rose.h+17−1
@@ -8,6 +8,7 @@ · 7 unmodified lines
88 #ifndef _ROSE_H
99 #define _ROSE_H
1010
11+#include <linux/refcount.h>
1112 #include <linux/rose.h>
1213 #include <net/ax25.h>
1314 #include <net/sock.h>
@@ -96,7 +97,7 @@ struct rose_neigh { · 82 unmodified lines
9697 ax25_cb *ax25;
9798 struct net_device *dev;
9899 unsigned short count;
99− unsigned short use;
100+ refcount_t use;
100101 unsigned int number;
101102 char restarted;
102103 char dce_mode;
@@ -151,6 +152,21 @@ struct rose_sock { · 48 unmodified lines
151152
152153 #define rose_sk(sk) ((struct rose_sock *)(sk))
153154
155+static inline void rose_neigh_hold(struct rose_neigh *rose_neigh)
156+{
157+ refcount_inc(&rose_neigh->use);
158+}
159+
160+static inline void rose_neigh_put(struct rose_neigh *rose_neigh)
161+{
162+ if (refcount_dec_and_test(&rose_neigh->use)) {
163+ if (rose_neigh->ax25)
164+ ax25_cb_put(rose_neigh->ax25);
165+ kfree(rose_neigh->digipeat);
166+ kfree(rose_neigh);
167+ }
168+}
169+
154170 /* af_rose.c */
155171 extern ax25_address rose_callsign;
156172 extern int sysctl_rose_restart_request_timeout;
include/sound/cs35l56.h+3−2
@@ -107,8 +107,8 @@ · 106 unmodified lines
107107 #define CS35L56_DSP1_PMEM_5114 0x3804FE8
108108
109109 #define CS35L63_DSP1_FW_VER CS35L56_DSP1_FW_VER
110−#define CS35L63_DSP1_HALO_STATE 0x280396C
111−#define CS35L63_DSP1_PM_CUR_STATE 0x28042C8
110+#define CS35L63_DSP1_HALO_STATE 0x2803C04
111+#define CS35L63_DSP1_PM_CUR_STATE 0x2804518
112112 #define CS35L63_PROTECTION_STATUS 0x340009C
113113 #define CS35L63_TRANSDUCER_ACTUAL_PS 0x34000F4
114114 #define CS35L63_MAIN_RENDER_USER_MUTE 0x3400020
@@ -306,6 +306,7 @@ struct cs35l56_base { · 191 unmodified lines
306306 struct gpio_desc *reset_gpio;
307307 struct cs35l56_spi_payload *spi_payload_buf;
308308 const struct cs35l56_fw_reg *fw_reg;
309+ const struct cirrus_amp_cal_controls *calibration_controls;
309310 };
310311
311312 static inline bool cs35l56_is_otp_register(unsigned int reg)
include/sound/tas2781-tlv.h+3−3
@@ -2,7 +2,7 @@ · 1 unmodified line
22 //
33 // ALSA SoC Texas Instruments TAS2781 Audio Smart Amplifier
44 //
5−// Copyright (C) 2022 - 2024 Texas Instruments Incorporated
5+// Copyright (C) 2022 - 2025 Texas Instruments Incorporated
66 // https://www.ti.com
77 //
88 // The TAS2781 driver implements a flexible and configurable
@@ -15,7 +15,7 @@ · 6 unmodified lines
1515 #ifndef __TAS2781_TLV_H__
1616 #define __TAS2781_TLV_H__
1717
18−static const __maybe_unused DECLARE_TLV_DB_SCALE(dvc_tlv, -10000, 50, 0);
19−static const __maybe_unused DECLARE_TLV_DB_SCALE(amp_vol_tlv, 1100, 50, 0);
18+static const __maybe_unused DECLARE_TLV_DB_SCALE(tas2781_dvc_tlv, -10000, 50, 0);
19+static const __maybe_unused DECLARE_TLV_DB_SCALE(tas2781_amp_tlv, 1100, 50, 0);
2020
2121 #endif
include/uapi/linux/pfrut.h+1−0
@@ -89,6 +89,7 @@ struct pfru_payload_hdr { · 88 unmodified lines
8989 __u32 hw_ver;
9090 __u32 rt_ver;
9191 __u8 platform_id[16];
92+ __u32 svn_ver;
9293 };
9394
9495 enum pfru_dsm_status {
include/uapi/linux/raid/md_p.h+1−1
@@ -173,7 +173,7 @@ typedef struct mdp_superblock_s { · 172 unmodified lines
173173 #else
174174 #error unspecified endianness
175175 #endif
176− __u32 resync_offset; /* 11 resync checkpoint sector count */
176+ __u32 recovery_cp; /* 11 resync checkpoint sector count */
177177 /* There are only valid for minor_version > 90 */
178178 __u64 reshape_position; /* 12,13 next address in array-space for reshape */
179179 __u32 new_level; /* 14 new level we are reshaping to */
include/uapi/linux/vhost.h+2−2
@@ -260,7 +260,7 @@ · 259 unmodified lines
260260 * When fork_owner is set to VHOST_FORK_OWNER_KTHREAD:
261261 * - Vhost will create vhost workers as kernel threads.
262262 */
263−#define VHOST_SET_FORK_FROM_OWNER _IOW(VHOST_VIRTIO, 0x83, __u8)
263+#define VHOST_SET_FORK_FROM_OWNER _IOW(VHOST_VIRTIO, 0x84, __u8)
264264
265265 /**
266266 * VHOST_GET_FORK_OWNER - Get the current fork_owner flag for the vhost device.
@@ -268,6 +268,6 @@ · 1 unmodified line
268268 *
269269 * @return: An 8-bit value indicating the current thread mode.
270270 */
271−#define VHOST_GET_FORK_FROM_OWNER _IOR(VHOST_VIRTIO, 0x84, __u8)
271+#define VHOST_GET_FORK_FROM_OWNER _IOR(VHOST_VIRTIO, 0x85, __u8)
272272
273273 #endif
io_uring/futex.c+3−0
@@ -288,6 +288,7 @@ int io_futex_wait(struct io_kiocb *req, unsigned int issue_flags) · 287 unmodified lines
288288 goto done_unlock;
289289 }
290290
291+ req->flags |= REQ_F_ASYNC_DATA;
291292 req->async_data = ifd;
292293 ifd->q = futex_q_init;
293294 ifd->q.bitset = iof->futex_mask;
@@ -309,6 +310,8 @@ done: · 15 unmodified lines
309310 if (ret < 0)
310311 req_set_fail(req);
311312 io_req_set_res(req, ret, 0);
313+ req->async_data = NULL;
314+ req->flags &= ~REQ_F_ASYNC_DATA;
312315 kfree(ifd);
313316 return IOU_COMPLETE;
314317 }
io_uring/io_uring.c+1−0
@@ -2119,6 +2119,7 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req, · 2118 unmodified lines
21192119 req->file = NULL;
21202120 req->tctx = current->io_uring;
21212121 req->cancel_seq_set = false;
2122+ req->async_data = NULL;
21222123
21232124 if (unlikely(opcode >= IORING_OP_LAST)) {
21242125 req->opcode = 0;
kernel/Kconfig.kexec+1−0
@@ -97,6 +97,7 @@ config KEXEC_JUMP · 96 unmodified lines
9797 config KEXEC_HANDOVER
9898 bool "kexec handover"
9999 depends on ARCH_SUPPORTS_KEXEC_HANDOVER && ARCH_SUPPORTS_KEXEC_FILE
100+ depends on !DEFERRED_STRUCT_PAGE_INIT
100101 select MEMBLOCK_KHO_SCRATCH
101102 select KEXEC_FILE
102103 select DEBUG_FS
kernel/cgroup/cpuset.c+5−6
@@ -280,7 +280,7 @@ static inline void check_insane_mems_config(nodemask_t *nodes) · 279 unmodified lines
280280 {
281281 if (!cpusets_insane_config() &&
282282 movable_only_nodes(nodes)) {
283− static_branch_enable(&cpusets_insane_config_key);
283+ static_branch_enable_cpuslocked(&cpusets_insane_config_key);
284284 pr_info("Unsupported (movable nodes only) cpuset configuration detected (nmask=%*pbl)!\n"
285285 "Cpuset allocations might fail even with a lot of memory available.\n",
286286 nodemask_pr_args(nodes));
@@ -1843,7 +1843,7 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd, · 1556 unmodified lines
18431843 if (is_partition_valid(cs))
18441844 adding = cpumask_and(tmp->addmask,
18451845 xcpus, parent->effective_xcpus);
1846− } else if (is_partition_invalid(cs) &&
1846+ } else if (is_partition_invalid(cs) && !cpumask_empty(xcpus) &&
18471847 cpumask_subset(xcpus, parent->effective_xcpus)) {
18481848 struct cgroup_subsys_state *css;
18491849 struct cpuset *child;
@@ -3358,14 +3358,12 @@ static ssize_t cpuset_partition_write(struct kernfs_open_file *of, char *buf, · 1508 unmodified lines
33583358 else
33593359 return -EINVAL;
33603360
3361− css_get(&cs->css);
33623361 cpus_read_lock();
33633362 mutex_lock(&cpuset_mutex);
33643363 if (is_cpuset_online(cs))
33653364 retval = update_prstate(cs, val);
33663365 mutex_unlock(&cpuset_mutex);
33673366 cpus_read_unlock();
3368− css_put(&cs->css);
33693367 return retval ?: nbytes;
33703368 }
33713369
@@ -3870,9 +3868,10 @@ retry: · 498 unmodified lines
38703868 partcmd = partcmd_invalidate;
38713869 /*
38723870 * On the other hand, an invalid partition root may be transitioned
3873− * back to a regular one.
3871+ * back to a regular one with a non-empty effective xcpus.
38743872 */
3875− else if (is_partition_valid(parent) && is_partition_invalid(cs))
3873+ else if (is_partition_valid(parent) && is_partition_invalid(cs) &&
3874+ !cpumask_empty(cs->effective_xcpus))
38763875 partcmd = partcmd_update;
38773876
38783877 if (partcmd >= 0) {
kernel/cgroup/rstat.c+3−0
@@ -479,6 +479,9 @@ void css_rstat_exit(struct cgroup_subsys_state *css) · 478 unmodified lines
479479 if (!css_uses_rstat(css))
480480 return;
481481
482+ if (!css->rstat_cpu)
483+ return;
484+
482485 css_rstat_flush(css);
483486
484487 /* sanity check */
kernel/dma/contiguous.c+0−2
@@ -483,8 +483,6 @@ static int __init rmem_cma_setup(struct reserved_mem *rmem) · 482 unmodified lines
483483 pr_err("Reserved memory: unable to setup CMA region\n");
484484 return err;
485485 }
486− /* Architecture specific contiguous memory fixup. */
487− dma_contiguous_early_fixup(rmem->base, rmem->size);
488486
489487 if (default_cma)
490488 dma_contiguous_default_area = cma;
kernel/dma/pool.c+2−2
@@ -102,8 +102,8 @@ static int atomic_pool_expand(struct gen_pool *pool, size_t pool_size, · 101 unmodified lines
102102
103103 #ifdef CONFIG_DMA_DIRECT_REMAP
104104 addr = dma_common_contiguous_remap(page, pool_size,
105− pgprot_dmacoherent(PAGE_KERNEL),
106− __builtin_return_address(0));
105+ pgprot_decrypted(pgprot_dmacoherent(PAGE_KERNEL)),
106+ __builtin_return_address(0));
107107 if (!addr)
108108 goto free_page;
109109 #else
kernel/events/core.c+6−0
@@ -2665,6 +2665,9 @@ static void perf_log_itrace_start(struct perf_event *event); · 2664 unmodified lines
26652665
26662666 static void perf_event_unthrottle(struct perf_event *event, bool start)
26672667 {
2668+ if (event->state != PERF_EVENT_STATE_ACTIVE)
2669+ return;
2670+
26682671 event->hw.interrupts = 0;
26692672 if (start)
26702673 event->pmu->start(event, 0);
@@ -2674,6 +2677,9 @@ static void perf_event_unthrottle(struct perf_event *event, bool start) · 3 unmodified lines
26742677
26752678 static void perf_event_throttle(struct perf_event *event)
26762679 {
2680+ if (event->state != PERF_EVENT_STATE_ACTIVE)
2681+ return;
2682+
26772683 event->hw.interrupts = MAX_INTERRUPTS;
26782684 event->pmu->stop(event, 0);
26792685 if (event == event->group_leader)
kernel/kexec_handover.c+25−4
@@ -144,14 +144,34 @@ static int __kho_preserve_order(struct kho_mem_track *track, unsigned long pfn, · 143 unmodified lines
144144 unsigned int order)
145145 {
146146 struct kho_mem_phys_bits *bits;
147− struct kho_mem_phys *physxa;
147+ struct kho_mem_phys *physxa, *new_physxa;
148148 const unsigned long pfn_high = pfn >> order;
149149
150150 might_sleep();
151151
152− physxa = xa_load_or_alloc(&track->orders, order, sizeof(*physxa));
153− if (IS_ERR(physxa))
154− return PTR_ERR(physxa);
152+ physxa = xa_load(&track->orders, order);
153+ if (!physxa) {
154+ int err;
155+
156+ new_physxa = kzalloc(sizeof(*physxa), GFP_KERNEL);
157+ if (!new_physxa)
158+ return -ENOMEM;
159+
160+ xa_init(&new_physxa->phys_bits);
161+ physxa = xa_cmpxchg(&track->orders, order, NULL, new_physxa,
162+ GFP_KERNEL);
163+
164+ err = xa_err(physxa);
165+ if (err || physxa) {
166+ xa_destroy(&new_physxa->phys_bits);
167+ kfree(new_physxa);
168+
169+ if (err)
170+ return err;
171+ } else {
172+ physxa = new_physxa;
173+ }
174+ }
155175
156176 bits = xa_load_or_alloc(&physxa->phys_bits, pfn_high / PRESERVE_BITS,
157177 sizeof(*bits));
@@ -544,6 +564,7 @@ err_free_scratch_areas: · 386 unmodified lines
544564 err_free_scratch_desc:
545565 memblock_free(kho_scratch, kho_scratch_cnt * sizeof(*kho_scratch));
546566 err_disable_kho:
567+ pr_warn("Failed to reserve scratch area, disabling kexec handover\n");
547568 kho_enable = false;
548569 }
549570
kernel/params.c+4−3
@@ -513,13 +513,14 @@ EXPORT_SYMBOL(param_array_ops); · 512 unmodified lines
513513 int param_set_copystring(const char *val, const struct kernel_param *kp)
514514 {
515515 const struct kparam_string *kps = kp->str;
516+ const size_t len = strnlen(val, kps->maxlen);
516517
517− if (strnlen(val, kps->maxlen) == kps->maxlen) {
518+ if (len == kps->maxlen) {
518519 pr_err("%s: string doesn't fit in %u chars.\n",
519520 kp->name, kps->maxlen-1);
520521 return -ENOSPC;
521522 }
522− strcpy(kps->string, val);
523+ memcpy(kps->string, val, len + 1);
523524 return 0;
524525 }
525526 EXPORT_SYMBOL(param_set_copystring);
@@ -841,7 +842,7 @@ static void __init param_sysfs_builtin(void) · 315 unmodified lines
841842 dot = strchr(kp->name, '.');
842843 if (!dot) {
843844 /* This happens for core_param() */
844− strcpy(modname, "kernel");
845+ strscpy(modname, "kernel");
845846 name_len = 0;
846847 } else {
847848 name_len = dot - kp->name + 1;
kernel/sched/ext.c+4−0
@@ -5749,6 +5749,9 @@ static int scx_enable(struct sched_ext_ops *ops, struct bpf_link *link) · 5748 unmodified lines
57495749 __setscheduler_class(p->policy, p->prio);
57505750 struct sched_enq_and_set_ctx ctx;
57515751
5752+ if (!tryget_task_struct(p))
5753+ continue;
5754+
57525755 if (old_class != new_class && p->se.sched_delayed)
57535756 dequeue_task(task_rq(p), p, DEQUEUE_SLEEP | DEQUEUE_DELAYED);
57545757
@@ -5761,6 +5764,7 @@ static int scx_enable(struct sched_ext_ops *ops, struct bpf_link *link) · 6 unmodified lines
57615764 sched_enq_and_set_task(&ctx);
57625765
57635766 check_class_changed(task_rq(p), p, old_class, p->prio);
5767+ put_task_struct(p);
57645768 }
57655769 scx_task_iter_stop(&sti);
57665770 percpu_up_write(&scx_fork_rwsem);
kernel/trace/fgraph.c+1−0
@@ -1397,6 +1397,7 @@ error: · 1396 unmodified lines
13971397 ftrace_graph_active--;
13981398 gops->saved_func = NULL;
13991399 fgraph_lru_release_index(i);
1400+ unregister_pm_notifier(&ftrace_suspend_notifier);
14001401 }
14011402 return ret;
14021403 }
kernel/trace/ftrace.c+10−9
@@ -4661,13 +4661,17 @@ ftrace_regex_open(struct ftrace_ops *ops, int flag, · 4660 unmodified lines
46614661 } else {
46624662 iter->hash = alloc_and_copy_ftrace_hash(size_bits, hash);
46634663 }
4664+ } else {
4665+ if (hash)
4666+ iter->hash = alloc_and_copy_ftrace_hash(hash->size_bits, hash);
4667+ else
4668+ iter->hash = EMPTY_HASH;
4669+ }
46644670
4665− if (!iter->hash) {
4666− trace_parser_put(&iter->parser);
4667− goto out_unlock;
4668− }
4669− } else
4670− iter->hash = hash;
4671+ if (!iter->hash) {
4672+ trace_parser_put(&iter->parser);
4673+ goto out_unlock;
4674+ }
46714675
46724676 ret = 0;
46734677
@@ -6543,9 +6547,6 @@ int ftrace_regex_release(struct inode *inode, struct file *file) · 1869 unmodified lines
65436547 ftrace_hash_move_and_update_ops(iter->ops, orig_hash,
65446548 iter->hash, filter_hash);
65456549 mutex_unlock(&ftrace_lock);
6546− } else {
6547− /* For read only, the hash is the ops hash */
6548− iter->hash = NULL;
65496550 }
65506551
65516552 mutex_unlock(&iter->ops->func_hash->regex_lock);
kernel/trace/ring_buffer.c+1−1
@@ -7666,7 +7666,7 @@ static __init int test_ringbuffer(void) · 7665 unmodified lines
76667666 rb_test_started = true;
76677667
76687668 set_current_state(TASK_INTERRUPTIBLE);
7669− /* Just run for 10 seconds */;
7669+ /* Just run for 10 seconds */
76707670 schedule_timeout(10 * HZ);
76717671
76727672 kthread_stop(rb_hammer);
kernel/trace/trace.c+14−8
@@ -1816,7 +1816,7 @@ int trace_get_user(struct trace_parser *parser, const char __user *ubuf, · 1815 unmodified lines
18161816
18171817 ret = get_user(ch, ubuf++);
18181818 if (ret)
1819− return ret;
1819+ goto fail;
18201820
18211821 read++;
18221822 cnt--;
@@ -1830,7 +1830,7 @@ int trace_get_user(struct trace_parser *parser, const char __user *ubuf, · 7 unmodified lines
18301830 while (cnt && isspace(ch)) {
18311831 ret = get_user(ch, ubuf++);
18321832 if (ret)
1833− return ret;
1833+ goto fail;
18341834 read++;
18351835 cnt--;
18361836 }
@@ -1848,12 +1848,14 @@ int trace_get_user(struct trace_parser *parser, const char __user *ubuf, · 11 unmodified lines
18481848 while (cnt && !isspace(ch) && ch) {
18491849 if (parser->idx < parser->size - 1)
18501850 parser->buffer[parser->idx++] = ch;
1851− else
1852− return -EINVAL;
1851+ else {
1852+ ret = -EINVAL;
1853+ goto fail;
1854+ }
18531855
18541856 ret = get_user(ch, ubuf++);
18551857 if (ret)
1856− return ret;
1858+ goto fail;
18571859 read++;
18581860 cnt--;
18591861 }
@@ -1868,11 +1870,15 @@ int trace_get_user(struct trace_parser *parser, const char __user *ubuf, · 8 unmodified lines
18681870 /* Make sure the parsed string always terminates with '\0'. */
18691871 parser->buffer[parser->idx] = 0;
18701872 } else {
1871− return -EINVAL;
1873+ ret = -EINVAL;
1874+ goto fail;
18721875 }
18731876
18741877 *ppos += read;
18751878 return read;
1879+fail:
1880+ trace_parser_fail(parser);
1881+ return ret;
18761882 }
18771883
18781884 /* TODO add a seq_buf_to_buffer() */
@@ -10632,10 +10638,10 @@ static void ftrace_dump_one(struct trace_array *tr, enum ftrace_dump_mode dump_m · 8753 unmodified lines
1063210638 ret = print_trace_line(&iter);
1063310639 if (ret != TRACE_TYPE_NO_CONSUME)
1063410640 trace_consume(&iter);
10641+
10642+ trace_printk_seq(&iter.seq);
1063510643 }
1063610644 touch_nmi_watchdog();
10637−
10638− trace_printk_seq(&iter.seq);
1063910645 }
1064010646
1064110647 if (!cnt)
kernel/trace/trace.h+7−1
@@ -1292,6 +1292,7 @@ bool ftrace_event_is_function(struct trace_event_call *call); · 1291 unmodified lines
12921292 */
12931293 struct trace_parser {
12941294 bool cont;
1295+ bool fail;
12951296 char *buffer;
12961297 unsigned idx;
12971298 unsigned size;
@@ -1299,7 +1300,7 @@ struct trace_parser { · 1 unmodified line
12991300
13001301 static inline bool trace_parser_loaded(struct trace_parser *parser)
13011302 {
1302− return (parser->idx != 0);
1303+ return !parser->fail && parser->idx != 0;
13031304 }
13041305
13051306 static inline bool trace_parser_cont(struct trace_parser *parser)
@@ -1313,6 +1314,11 @@ static inline void trace_parser_clear(struct trace_parser *parser) · 7 unmodified lines
13131314 parser->idx = 0;
13141315 }
13151316
1317+static inline void trace_parser_fail(struct trace_parser *parser)
1318+{
1319+ parser->fail = true;
1320+}
1321+
13161322 extern int trace_parser_get_init(struct trace_parser *parser, int size);
13171323 extern void trace_parser_put(struct trace_parser *parser);
13181324 extern int trace_get_user(struct trace_parser *parser, const char __user *ubuf,
kernel/trace/trace_functions_graph.c+16−6
@@ -27,14 +27,21 @@ struct fgraph_cpu_data { · 26 unmodified lines
2727 unsigned long enter_funcs[FTRACE_RETFUNC_DEPTH];
2828 };
2929
30+struct fgraph_ent_args {
31+ struct ftrace_graph_ent_entry ent;
32+ /* Force the sizeof of args[] to have FTRACE_REGS_MAX_ARGS entries */
33+ unsigned long args[FTRACE_REGS_MAX_ARGS];
34+};
35+
3036 struct fgraph_data {
3137 struct fgraph_cpu_data __percpu *cpu_data;
3238
3339 /* Place to preserve last processed entry. */
3440 union {
35− struct ftrace_graph_ent_entry ent;
41+ struct fgraph_ent_args ent;
42+ /* TODO allow retaddr to have args */
3643 struct fgraph_retaddr_ent_entry rent;
37− } ent;
44+ };
3845 struct ftrace_graph_ret_entry ret;
3946 int failed;
4047 int cpu;
@@ -627,10 +634,13 @@ get_return_for_leaf(struct trace_iterator *iter, · 586 unmodified lines
627634 * Save current and next entries for later reference
628635 * if the output fails.
629636 */
630− if (unlikely(curr->ent.type == TRACE_GRAPH_RETADDR_ENT))
631− data->ent.rent = *(struct fgraph_retaddr_ent_entry *)curr;
632− else
633− data->ent.ent = *curr;
637+ if (unlikely(curr->ent.type == TRACE_GRAPH_RETADDR_ENT)) {
638+ data->rent = *(struct fgraph_retaddr_ent_entry *)curr;
639+ } else {
640+ int size = min((int)sizeof(data->ent), (int)iter->ent_size);
641+
642+ memcpy(&data->ent, curr, size);
643+ }
634644 /*
635645 * If the next event is not a return type, then
636646 * we only care about what type it is. Otherwise we can
mm/balloon_compaction.c+6−0
@@ -254,4 +254,10 @@ const struct movable_operations balloon_mops = { · 253 unmodified lines
254254 .putback_page = balloon_page_putback,
255255 };
256256
257+static int __init balloon_init(void)
258+{
259+ return set_movable_ops(&balloon_mops, PGTY_offline);
260+}
261+core_initcall(balloon_init);
262+
257263 #endif /* CONFIG_BALLOON_COMPACTION */
mm/damon/core.c+14−1
@@ -845,6 +845,18 @@ static struct damos_filter *damos_nth_filter(int n, struct damos *s) · 844 unmodified lines
845845 return NULL;
846846 }
847847
848+static struct damos_filter *damos_nth_ops_filter(int n, struct damos *s)
849+{
850+ struct damos_filter *filter;
851+ int i = 0;
852+
853+ damos_for_each_ops_filter(filter, s) {
854+ if (i++ == n)
855+ return filter;
856+ }
857+ return NULL;
858+}
859+
848860 static void damos_commit_filter_arg(
849861 struct damos_filter *dst, struct damos_filter *src)
850862 {
@@ -871,6 +883,7 @@ static void damos_commit_filter( · 20 unmodified lines
871883 {
872884 dst->type = src->type;
873885 dst->matching = src->matching;
886+ dst->allow = src->allow;
874887 damos_commit_filter_arg(dst, src);
875888 }
876889
@@ -908,7 +921,7 @@ static int damos_commit_ops_filters(struct damos *dst, struct damos *src) · 31 unmodified lines
908921 int i = 0, j = 0;
909922
910923 damos_for_each_ops_filter_safe(dst_filter, next, dst) {
911− src_filter = damos_nth_filter(i++, src);
924+ src_filter = damos_nth_ops_filter(i++, src);
912925 if (src_filter)
913926 damos_commit_filter(dst_filter, src_filter);
914927 else
mm/damon/sysfs-schemes.c+1−1
@@ -2158,8 +2158,8 @@ static void damon_sysfs_scheme_rm_dirs(struct damon_sysfs_scheme *scheme) · 2157 unmodified lines
21582158 {
21592159 damon_sysfs_access_pattern_rm_dirs(scheme->access_pattern);
21602160 kobject_put(&scheme->access_pattern->kobj);
2161− kobject_put(&scheme->dests->kobj);
21622161 damos_sysfs_dests_rm_dirs(scheme->dests);
2162+ kobject_put(&scheme->dests->kobj);
21632163 damon_sysfs_quotas_rm_dirs(scheme->quotas);
21642164 kobject_put(&scheme->quotas->kobj);
21652165 kobject_put(&scheme->watermarks->kobj);
mm/debug_vm_pgtable.c+7−2
@@ -990,29 +990,34 @@ static void __init destroy_args(struct pgtable_debug_args *args) · 989 unmodified lines
990990
991991 /* Free page table entries */
992992 if (args->start_ptep) {
993+ pmd_clear(args->pmdp);
993994 pte_free(args->mm, args->start_ptep);
994995 mm_dec_nr_ptes(args->mm);
995996 }
996997
997998 if (args->start_pmdp) {
999+ pud_clear(args->pudp);
9981000 pmd_free(args->mm, args->start_pmdp);
9991001 mm_dec_nr_pmds(args->mm);
10001002 }
10011003
10021004 if (args->start_pudp) {
1005+ p4d_clear(args->p4dp);
10031006 pud_free(args->mm, args->start_pudp);
10041007 mm_dec_nr_puds(args->mm);
10051008 }
10061009
1007− if (args->start_p4dp)
1010+ if (args->start_p4dp) {
1011+ pgd_clear(args->pgdp);
10081012 p4d_free(args->mm, args->start_p4dp);
1013+ }
10091014
10101015 /* Free vma and mm struct */
10111016 if (args->vma)
10121017 vm_area_free(args->vma);
10131018
10141019 if (args->mm)
1015− mmdrop(args->mm);
1020+ mmput(args->mm);
10161021 }
10171022
10181023 static struct page * __init
mm/memblock.c+13−6
@@ -780,9 +780,9 @@ bool __init_memblock memblock_validate_numa_coverage(unsigned long threshold_byt · 779 unmodified lines
780780 }
781781
782782 if ((nr_pages << PAGE_SHIFT) > threshold_bytes) {
783− mem_size_mb = memblock_phys_mem_size() >> 20;
783+ mem_size_mb = memblock_phys_mem_size() / SZ_1M;
784784 pr_err("NUMA: no nodes coverage for %luMB of %luMB RAM\n",
785− (nr_pages << PAGE_SHIFT) >> 20, mem_size_mb);
785+ (nr_pages << PAGE_SHIFT) / SZ_1M, mem_size_mb);
786786 return false;
787787 }
788788
@@ -1091,13 +1091,20 @@ int __init_memblock memblock_clear_nomap(phys_addr_t base, phys_addr_t size) · 302 unmodified lines
10911091
10921092 /**
10931093 * memblock_reserved_mark_noinit - Mark a reserved memory region with flag
1094− * MEMBLOCK_RSRV_NOINIT which results in the struct pages not being initialized
1095− * for this region.
1094+ * MEMBLOCK_RSRV_NOINIT
1095+ *
10961096 * @base: the base phys addr of the region
10971097 * @size: the size of the region
10981098 *
1099− * struct pages will not be initialized for reserved memory regions marked with
1100− * %MEMBLOCK_RSRV_NOINIT.
1099+ * The struct pages for the reserved regions marked %MEMBLOCK_RSRV_NOINIT will
1100+ * not be fully initialized to allow the caller optimize their initialization.
1101+ *
1102+ * When %CONFIG_DEFERRED_STRUCT_PAGE_INIT is enabled, setting this flag
1103+ * completely bypasses the initialization of struct pages for such region.
1104+ *
1105+ * When %CONFIG_DEFERRED_STRUCT_PAGE_INIT is disabled, struct pages in this
1106+ * region will be initialized with default values but won't be marked as
1107+ * reserved.
11011108 *
11021109 * Return: 0 on success, -errno on failure.
11031110 */
mm/memory-failure.c+8−0
@@ -853,9 +853,17 @@ static int hwpoison_hugetlb_range(pte_t *ptep, unsigned long hmask, · 852 unmodified lines
853853 #define hwpoison_hugetlb_range NULL
854854 #endif
855855
856+static int hwpoison_test_walk(unsigned long start, unsigned long end,
857+ struct mm_walk *walk)
858+{
859+ /* We also want to consider pages mapped into VM_PFNMAP. */
860+ return 0;
861+}
862+
856863 static const struct mm_walk_ops hwpoison_walk_ops = {
857864 .pmd_entry = hwpoison_pte_range,
858865 .hugetlb_entry = hwpoison_hugetlb_range,
866+ .test_walk = hwpoison_test_walk,
859867 .walk_lock = PGWALK_RDLOCK,
860868 };
861869
mm/migrate.c+30−8
@@ -43,8 +43,6 @@ · 42 unmodified lines
4343 #include <linux/sched/sysctl.h>
4444 #include <linux/memory-tiers.h>
4545 #include <linux/pagewalk.h>
46−#include <linux/balloon_compaction.h>
47−#include <linux/zsmalloc.h>
4846
4947 #include <asm/tlbflush.h>
5048
@@ -53,6 +51,33 @@ · 2 unmodified lines
5351 #include "internal.h"
5452 #include "swap.h"
5553
54+static const struct movable_operations *offline_movable_ops;
55+static const struct movable_operations *zsmalloc_movable_ops;
56+
57+int set_movable_ops(const struct movable_operations *ops, enum pagetype type)
58+{
59+ /*
60+ * We only allow for selected types and don't handle concurrent
61+ * registration attempts yet.
62+ */
63+ switch (type) {
64+ case PGTY_offline:
65+ if (offline_movable_ops && ops)
66+ return -EBUSY;
67+ offline_movable_ops = ops;
68+ break;
69+ case PGTY_zsmalloc:
70+ if (zsmalloc_movable_ops && ops)
71+ return -EBUSY;
72+ zsmalloc_movable_ops = ops;
73+ break;
74+ default:
75+ return -EINVAL;
76+ }
77+ return 0;
78+}
79+EXPORT_SYMBOL_GPL(set_movable_ops);
80+
5681 static const struct movable_operations *page_movable_ops(struct page *page)
5782 {
5883 VM_WARN_ON_ONCE_PAGE(!page_has_movable_ops(page), page);
@@ -62,15 +87,12 @@ static const struct movable_operations *page_movable_ops(struct page *page) · 3 unmodified lines
6287 * it as movable, the page type must be sticky until the page gets freed
6388 * back to the buddy.
6489 */
65−#ifdef CONFIG_BALLOON_COMPACTION
6690 if (PageOffline(page))
6791 /* Only balloon compaction sets PageOffline pages movable. */
68− return &balloon_mops;
69−#endif /* CONFIG_BALLOON_COMPACTION */
70−#if defined(CONFIG_ZSMALLOC) && defined(CONFIG_COMPACTION)
92+ return offline_movable_ops;
7193 if (PageZsmalloc(page))
72− return &zsmalloc_mops;
73−#endif /* defined(CONFIG_ZSMALLOC) && defined(CONFIG_COMPACTION) */
94+ return zsmalloc_movable_ops;
95+
7496 return NULL;
7597 }
7698
mm/mremap.c+47−35
@@ -323,6 +323,25 @@ static inline bool arch_supports_page_table_move(void) · 322 unmodified lines
323323 }
324324 #endif
325325
326+static inline bool uffd_supports_page_table_move(struct pagetable_move_control *pmc)
327+{
328+ /*
329+ * If we are moving a VMA that has uffd-wp registered but with
330+ * remap events disabled (new VMA will not be registered with uffd), we
331+ * need to ensure that the uffd-wp state is cleared from all pgtables.
332+ * This means recursing into lower page tables in move_page_tables().
333+ *
334+ * We might get called with VMAs reversed when recovering from a
335+ * failed page table move. In that case, the
336+ * "old"-but-actually-"originally new" VMA during recovery will not have
337+ * a uffd context. Recursing into lower page tables during the original
338+ * move but not during the recovery move will cause trouble, because we
339+ * run into already-existing page tables. So check both VMAs.
340+ */
341+ return !vma_has_uffd_without_event_remap(pmc->old) &&
342+ !vma_has_uffd_without_event_remap(pmc->new);
343+}
344+
326345 #ifdef CONFIG_HAVE_MOVE_PMD
327346 static bool move_normal_pmd(struct pagetable_move_control *pmc,
328347 pmd_t *old_pmd, pmd_t *new_pmd)
@@ -335,6 +354,8 @@ static bool move_normal_pmd(struct pagetable_move_control *pmc, · 6 unmodified lines
335354
336355 if (!arch_supports_page_table_move())
337356 return false;
357+ if (!uffd_supports_page_table_move(pmc))
358+ return false;
338359 /*
339360 * The destination pmd shouldn't be established, free_pgtables()
340361 * should have released it.
@@ -361,15 +382,6 @@ static bool move_normal_pmd(struct pagetable_move_control *pmc, · 20 unmodified lines
361382 if (WARN_ON_ONCE(!pmd_none(*new_pmd)))
362383 return false;
363384
364− /* If this pmd belongs to a uffd vma with remap events disabled, we need
365− * to ensure that the uffd-wp state is cleared from all pgtables. This
366− * means recursing into lower page tables in move_page_tables(), and we
367− * can reuse the existing code if we simply treat the entry as "not
368− * moved".
369− */
370− if (vma_has_uffd_without_event_remap(vma))
371− return false;
372−
373385 /*
374386 * We don't have to worry about the ordering of src and dst
375387 * ptlocks because exclusive mmap_lock prevents deadlock.
@@ -418,6 +430,8 @@ static bool move_normal_pud(struct pagetable_move_control *pmc, · 42 unmodified lines
418430
419431 if (!arch_supports_page_table_move())
420432 return false;
433+ if (!uffd_supports_page_table_move(pmc))
434+ return false;
421435 /*
422436 * The destination pud shouldn't be established, free_pgtables()
423437 * should have released it.
@@ -425,15 +439,6 @@ static bool move_normal_pud(struct pagetable_move_control *pmc, · 1 unmodified line
425439 if (WARN_ON_ONCE(!pud_none(*new_pud)))
426440 return false;
427441
428− /* If this pud belongs to a uffd vma with remap events disabled, we need
429− * to ensure that the uffd-wp state is cleared from all pgtables. This
430− * means recursing into lower page tables in move_page_tables(), and we
431− * can reuse the existing code if we simply treat the entry as "not
432− * moved".
433− */
434− if (vma_has_uffd_without_event_remap(vma))
435− return false;
436−
437442 /*
438443 * We don't have to worry about the ordering of src and dst
439444 * ptlocks because exclusive mmap_lock prevents deadlock.
@@ -1620,7 +1625,7 @@ static void notify_uffd(struct vma_remap_struct *vrm, bool failed) · 1180 unmodified lines
16201625
16211626 static bool vma_multi_allowed(struct vm_area_struct *vma)
16221627 {
1623− struct file *file;
1628+ struct file *file = vma->vm_file;
16241629
16251630 /*
16261631 * We can't support moving multiple uffd VMAs as notify requires
@@ -1633,15 +1638,17 @@ static bool vma_multi_allowed(struct vm_area_struct *vma) · 6 unmodified lines
16331638 * Custom get unmapped area might result in MREMAP_FIXED not
16341639 * being obeyed.
16351640 */
1636− file = vma->vm_file;
1637− if (file && !vma_is_shmem(vma) && !is_vm_hugetlb_page(vma)) {
1638− const struct file_operations *fop = file->f_op;
1639−
1640− if (fop->get_unmapped_area)
1641− return false;
1642− }
1641+ if (!file || !file->f_op->get_unmapped_area)
1642+ return true;
1643+ /* Known good. */
1644+ if (vma_is_shmem(vma))
1645+ return true;
1646+ if (is_vm_hugetlb_page(vma))
1647+ return true;
1648+ if (file->f_op->get_unmapped_area == thp_get_unmapped_area)
1649+ return true;
16431650
1644− return true;
1651+ return false;
16451652 }
16461653
16471654 static int check_prep_vma(struct vma_remap_struct *vrm)
@@ -1818,10 +1825,11 @@ static unsigned long remap_move(struct vma_remap_struct *vrm) · 170 unmodified lines
18181825 unsigned long start = vrm->addr;
18191826 unsigned long end = vrm->addr + vrm->old_len;
18201827 unsigned long new_addr = vrm->new_addr;
1821− bool allowed = true, seen_vma = false;
18221828 unsigned long target_addr = new_addr;
18231829 unsigned long res = -EFAULT;
18241830 unsigned long last_end;
1831+ bool seen_vma = false;
1832+
18251833 VMA_ITERATOR(vmi, current->mm, start);
18261834
18271835 /*
@@ -1834,9 +1842,7 @@ static unsigned long remap_move(struct vma_remap_struct *vrm) · 6 unmodified lines
18341842 unsigned long addr = max(vma->vm_start, start);
18351843 unsigned long len = min(end, vma->vm_end) - addr;
18361844 unsigned long offset, res_vma;
1837−
1838− if (!allowed)
1839− return -EFAULT;
1845+ bool multi_allowed;
18401846
18411847 /* No gap permitted at the start of the range. */
18421848 if (!seen_vma && start < vma->vm_start)
@@ -1865,9 +1871,15 @@ static unsigned long remap_move(struct vma_remap_struct *vrm) · 22 unmodified lines
18651871 vrm->new_addr = target_addr + offset;
18661872 vrm->old_len = vrm->new_len = len;
18671873
1868− allowed = vma_multi_allowed(vma);
1869− if (seen_vma && !allowed)
1870− return -EFAULT;
1874+ multi_allowed = vma_multi_allowed(vma);
1875+ if (!multi_allowed) {
1876+ /* This is not the first VMA, abort immediately. */
1877+ if (seen_vma)
1878+ return -EFAULT;
1879+ /* This is the first, but there are more, abort. */
1880+ if (vma->vm_end < end)
1881+ return -EFAULT;
1882+ }
18711883
18721884 res_vma = check_prep_vma(vrm);
18731885 if (!res_vma)
@@ -1876,7 +1888,7 @@ static unsigned long remap_move(struct vma_remap_struct *vrm) · 2 unmodified lines
18761888 return res_vma;
18771889
18781890 if (!seen_vma) {
1879− VM_WARN_ON_ONCE(allowed && res_vma != new_addr);
1891+ VM_WARN_ON_ONCE(multi_allowed && res_vma != new_addr);
18801892 res = res_vma;
18811893 }
18821894
mm/numa_emulation.c+2−2
@@ -73,7 +73,7 @@ static int __init emu_setup_memblk(struct numa_meminfo *ei, · 72 unmodified lines
7373 }
7474
7575 printk(KERN_INFO "Faking node %d at [mem %#018Lx-%#018Lx] (%LuMB)\n",
76− nid, eb->start, eb->end - 1, (eb->end - eb->start) >> 20);
76+ nid, eb->start, eb->end - 1, (eb->end - eb->start) / SZ_1M);
7777 return 0;
7878 }
7979
@@ -264,7 +264,7 @@ static int __init split_nodes_size_interleave_uniform(struct numa_meminfo *ei, · 184 unmodified lines
264264 min_size = ALIGN(max(min_size, FAKE_NODE_MIN_SIZE), FAKE_NODE_MIN_SIZE);
265265 if (size < min_size) {
266266 pr_err("Fake node size %LuMB too small, increasing to %LuMB\n",
267− size >> 20, min_size >> 20);
267+ size / SZ_1M, min_size / SZ_1M);
268268 size = min_size;
269269 }
270270 size = ALIGN_DOWN(size, FAKE_NODE_MIN_SIZE);
mm/numa_memblks.c+3−3
@@ -76,7 +76,7 @@ static int __init numa_alloc_distance(void) · 75 unmodified lines
7676 for (j = 0; j < cnt; j++)
7777 numa_distance[i * cnt + j] = i == j ?
7878 LOCAL_DISTANCE : REMOTE_DISTANCE;
79− printk(KERN_DEBUG "NUMA: Initialized distance table, cnt=%d\n", cnt);
79+ pr_debug("NUMA: Initialized distance table, cnt=%d\n", cnt);
8080
8181 return 0;
8282 }
@@ -427,9 +427,9 @@ static int __init numa_register_meminfo(struct numa_meminfo *mi) · 344 unmodified lines
427427 unsigned long pfn_align = node_map_pfn_alignment();
428428
429429 if (pfn_align && pfn_align < PAGES_PER_SECTION) {
430− unsigned long node_align_mb = PFN_PHYS(pfn_align) >> 20;
430+ unsigned long node_align_mb = PFN_PHYS(pfn_align) / SZ_1M;
431431
432− unsigned long sect_align_mb = PFN_PHYS(PAGES_PER_SECTION) >> 20;
432+ unsigned long sect_align_mb = PFN_PHYS(PAGES_PER_SECTION) / SZ_1M;
433433
434434 pr_warn("Node alignment %luMB < min %luMB, rejecting NUMA config\n",
435435 node_align_mb, sect_align_mb);
mm/vmscan.c+2−2
@@ -5772,9 +5772,9 @@ static int __init init_lru_gen(void) · 5771 unmodified lines
57725772 if (sysfs_create_group(mm_kobj, &lru_gen_attr_group))
57735773 pr_err("lru_gen: failed to create sysfs group\n");
57745774
5775− debugfs_create_file_aux_num("lru_gen", 0644, NULL, NULL, 1,
5775+ debugfs_create_file_aux_num("lru_gen", 0644, NULL, NULL, false,
57765776 &lru_gen_rw_fops);
5777− debugfs_create_file_aux_num("lru_gen_full", 0444, NULL, NULL, 0,
5777+ debugfs_create_file_aux_num("lru_gen_full", 0444, NULL, NULL, true,
57785778 &lru_gen_ro_fops);
57795779
57805780 return 0;
mm/zsmalloc.c+10−0
@@ -2246,8 +2246,15 @@ EXPORT_SYMBOL_GPL(zs_destroy_pool); · 2245 unmodified lines
22462246
22472247 static int __init zs_init(void)
22482248 {
2249+ int rc __maybe_unused;
2250+
22492251 #ifdef CONFIG_ZPOOL
22502252 zpool_register_driver(&zs_zpool_driver);
2253+#endif
2254+#ifdef CONFIG_COMPACTION
2255+ rc = set_movable_ops(&zsmalloc_mops, PGTY_zsmalloc);
2256+ if (rc)
2257+ return rc;
22512258 #endif
22522259 zs_stat_init();
22532260 return 0;
@@ -2257,6 +2264,9 @@ static void __exit zs_exit(void) · 3 unmodified lines
22572264 {
22582265 #ifdef CONFIG_ZPOOL
22592266 zpool_unregister_driver(&zs_zpool_driver);
2267+#endif
2268+#ifdef CONFIG_COMPACTION
2269+ set_movable_ops(NULL, PGTY_zsmalloc);
22602270 #endif
22612271 zs_stat_exit();
22622272 }
net/atm/common.c+12−3
@@ -635,18 +635,27 @@ int vcc_sendmsg(struct socket *sock, struct msghdr *m, size_t size) · 634 unmodified lines
635635
636636 skb->dev = NULL; /* for paths shared with net_device interfaces */
637637 if (!copy_from_iter_full(skb_put(skb, size), size, &m->msg_iter)) {
638− atm_return_tx(vcc, skb);
639− kfree_skb(skb);
640638 error = -EFAULT;
641− goto out;
639+ goto free_skb;
642640 }
643641 if (eff != size)
644642 memset(skb->data + size, 0, eff-size);
643+
644+ if (vcc->dev->ops->pre_send) {
645+ error = vcc->dev->ops->pre_send(vcc, skb);
646+ if (error)
647+ goto free_skb;
648+ }
649+
645650 error = vcc->dev->ops->send(vcc, skb);
646651 error = error ? error : size;
647652 out:
648653 release_sock(sk);
649654 return error;
655+free_skb:
656+ atm_return_tx(vcc, skb);
657+ kfree_skb(skb);
658+ goto out;
650659 }
651660
652661 __poll_t vcc_poll(struct file *file, struct socket *sock, poll_table *wait)
net/bluetooth/hci_conn.c+41−17
@@ -149,8 +149,6 @@ static void hci_conn_cleanup(struct hci_conn *conn) · 148 unmodified lines
149149
150150 hci_chan_list_flush(conn);
151151
152− hci_conn_hash_del(hdev, conn);
153−
154152 if (HCI_CONN_HANDLE_UNSET(conn->handle))
155153 ida_free(&hdev->unset_handle_ida, conn->handle);
156154
@@ -1152,28 +1150,54 @@ void hci_conn_del(struct hci_conn *conn) · 995 unmodified lines
11521150 disable_delayed_work_sync(&conn->auto_accept_work);
11531151 disable_delayed_work_sync(&conn->idle_work);
11541152
1155− if (conn->type == ACL_LINK) {
1156− /* Unacked frames */
1157− hdev->acl_cnt += conn->sent;
1158− } else if (conn->type == LE_LINK) {
1159− cancel_delayed_work(&conn->le_conn_timeout);
1153+ /* Remove the connection from the list so unacked logic can detect when
1154+ * a certain pool is not being utilized.
1155+ */
1156+ hci_conn_hash_del(hdev, conn);
11601157
1161− if (hdev->le_pkts)
1162− hdev->le_cnt += conn->sent;
1158+ /* Handle unacked frames:
1159+ *
1160+ * - In case there are no connection, or if restoring the buffers
1161+ * considered in transist would overflow, restore all buffers to the
1162+ * pool.
1163+ * - Otherwise restore just the buffers considered in transit for the
1164+ * hci_conn
1165+ */
1166+ switch (conn->type) {
1167+ case ACL_LINK:
1168+ if (!hci_conn_num(hdev, ACL_LINK) ||
1169+ hdev->acl_cnt + conn->sent > hdev->acl_pkts)
1170+ hdev->acl_cnt = hdev->acl_pkts;
11631171 else
11641172 hdev->acl_cnt += conn->sent;
1165− } else {
1166− /* Unacked ISO frames */
1167− if (conn->type == CIS_LINK ||
1168− conn->type == BIS_LINK ||
1169− conn->type == PA_LINK) {
1170− if (hdev->iso_pkts)
1171− hdev->iso_cnt += conn->sent;
1172− else if (hdev->le_pkts)
1173+ break;
1174+ case LE_LINK:
1175+ cancel_delayed_work(&conn->le_conn_timeout);
1176+
1177+ if (hdev->le_pkts) {
1178+ if (!hci_conn_num(hdev, LE_LINK) ||
1179+ hdev->le_cnt + conn->sent > hdev->le_pkts)
1180+ hdev->le_cnt = hdev->le_pkts;
1181+ else
11731182 hdev->le_cnt += conn->sent;
1183+ } else {
1184+ if ((!hci_conn_num(hdev, LE_LINK) &&
1185+ !hci_conn_num(hdev, ACL_LINK)) ||
1186+ hdev->acl_cnt + conn->sent > hdev->acl_pkts)
1187+ hdev->acl_cnt = hdev->acl_pkts;
11741188 else
11751189 hdev->acl_cnt += conn->sent;
11761190 }
1191+ break;
1192+ case CIS_LINK:
1193+ case BIS_LINK:
1194+ case PA_LINK:
1195+ if (!hci_iso_count(hdev) ||
1196+ hdev->iso_cnt + conn->sent > hdev->iso_pkts)
1197+ hdev->iso_cnt = hdev->iso_pkts;
1198+ else
1199+ hdev->iso_cnt += conn->sent;
1200+ break;
11771201 }
11781202
11791203 skb_queue_purge(&conn->data_q);
net/bluetooth/hci_event.c+23−2
@@ -2703,7 +2703,7 @@ static void hci_cs_disconnect(struct hci_dev *hdev, u8 status) · 2702 unmodified lines
27032703 if (!conn)
27042704 goto unlock;
27052705
2706− if (status) {
2706+ if (status && status != HCI_ERROR_UNKNOWN_CONN_ID) {
27072707 mgmt_disconnect_failed(hdev, &conn->dst, conn->type,
27082708 conn->dst_type, status);
27092709
@@ -2718,6 +2718,12 @@ static void hci_cs_disconnect(struct hci_dev *hdev, u8 status) · 8 unmodified lines
27182718 goto done;
27192719 }
27202720
2721+ /* During suspend, mark connection as closed immediately
2722+ * since we might not receive HCI_EV_DISCONN_COMPLETE
2723+ */
2724+ if (hdev->suspended)
2725+ conn->state = BT_CLOSED;
2726+
27212727 mgmt_conn = test_and_clear_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags);
27222728
27232729 if (conn->type == ACL_LINK) {
@@ -4398,7 +4404,17 @@ static void hci_num_comp_pkts_evt(struct hci_dev *hdev, void *data, · 1674 unmodified lines
43984404 if (!conn)
43994405 continue;
44004406
4401− conn->sent -= count;
4407+ /* Check if there is really enough packets outstanding before
4408+ * attempting to decrease the sent counter otherwise it could
4409+ * underflow..
4410+ */
4411+ if (conn->sent >= count) {
4412+ conn->sent -= count;
4413+ } else {
4414+ bt_dev_warn(hdev, "hcon %p sent %u < count %u",
4415+ conn, conn->sent, count);
4416+ conn->sent = 0;
4417+ }
44024418
44034419 for (i = 0; i < count; ++i)
44044420 hci_conn_tx_dequeue(conn);
@@ -7008,6 +7024,7 @@ static void hci_le_big_sync_lost_evt(struct hci_dev *hdev, void *data, · 2603 unmodified lines
70087024 {
70097025 struct hci_evt_le_big_sync_lost *ev = data;
70107026 struct hci_conn *bis, *conn;
7027+ bool mgmt_conn;
70117028
70127029 bt_dev_dbg(hdev, "big handle 0x%2.2x", ev->handle);
70137030
@@ -7026,6 +7043,10 @@ static void hci_le_big_sync_lost_evt(struct hci_dev *hdev, void *data, · 12 unmodified lines
70267043 while ((bis = hci_conn_hash_lookup_big_state(hdev, ev->handle,
70277044 BT_CONNECTED,
70287045 HCI_ROLE_SLAVE))) {
7046+ mgmt_conn = test_and_clear_bit(HCI_CONN_MGMT_CONNECTED, &bis->flags);
7047+ mgmt_device_disconnected(hdev, &bis->dst, bis->type, bis->dst_type,
7048+ ev->reason, mgmt_conn);
7049+
70297050 clear_bit(HCI_CONN_BIG_SYNC, &bis->flags);
70307051 hci_disconn_cfm(bis, ev->reason);
70317052 hci_conn_del(bis);
net/bluetooth/hci_sync.c+3−3
@@ -3481,13 +3481,13 @@ int hci_update_scan_sync(struct hci_dev *hdev) · 3480 unmodified lines
34813481 return hci_write_scan_enable_sync(hdev, scan);
34823482 }
34833483
3484−int hci_update_name_sync(struct hci_dev *hdev)
3484+int hci_update_name_sync(struct hci_dev *hdev, const u8 *name)
34853485 {
34863486 struct hci_cp_write_local_name cp;
34873487
34883488 memset(&cp, 0, sizeof(cp));
34893489
3490− memcpy(cp.name, hdev->dev_name, sizeof(cp.name));
3490+ memcpy(cp.name, name, sizeof(cp.name));
34913491
34923492 return __hci_cmd_sync_status(hdev, HCI_OP_WRITE_LOCAL_NAME,
34933493 sizeof(cp), &cp,
@@ -3540,7 +3540,7 @@ int hci_powered_update_sync(struct hci_dev *hdev) · 46 unmodified lines
35403540 hci_write_fast_connectable_sync(hdev, false);
35413541 hci_update_scan_sync(hdev);
35423542 hci_update_class_sync(hdev);
3543− hci_update_name_sync(hdev);
3543+ hci_update_name_sync(hdev, hdev->dev_name);
35443544 hci_update_eir_sync(hdev);
35453545 }
35463546
net/bluetooth/mgmt.c+7−2
@@ -3892,8 +3892,11 @@ static void set_name_complete(struct hci_dev *hdev, void *data, int err) · 3891 unmodified lines
38923892
38933893 static int set_name_sync(struct hci_dev *hdev, void *data)
38943894 {
3895+ struct mgmt_pending_cmd *cmd = data;
3896+ struct mgmt_cp_set_local_name *cp = cmd->param;
3897+
38953898 if (lmp_bredr_capable(hdev)) {
3896− hci_update_name_sync(hdev);
3899+ hci_update_name_sync(hdev, cp->name);
38973900 hci_update_eir_sync(hdev);
38983901 }
38993902
@@ -9705,7 +9708,9 @@ void mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, · 5805 unmodified lines
97059708 if (!mgmt_connected)
97069709 return;
97079710
9708− if (link_type != ACL_LINK && link_type != LE_LINK)
9711+ if (link_type != ACL_LINK &&
9712+ link_type != LE_LINK &&
9713+ link_type != BIS_LINK)
97099714 return;
97109715
97119716 bacpy(&ev.addr.bdaddr, bdaddr);
net/core/datagram.c+14−0
@@ -618,6 +618,20 @@ fault: · 617 unmodified lines
618618 }
619619 EXPORT_SYMBOL(skb_copy_datagram_from_iter);
620620
621+int skb_copy_datagram_from_iter_full(struct sk_buff *skb, int offset,
622+ struct iov_iter *from, int len)
623+{
624+ struct iov_iter_state state;
625+ int ret;
626+
627+ iov_iter_save_state(from, &state);
628+ ret = skb_copy_datagram_from_iter(skb, offset, from, len);
629+ if (ret)
630+ iov_iter_restore(from, &state);
631+ return ret;
632+}
633+EXPORT_SYMBOL(skb_copy_datagram_from_iter_full);
634+
621635 int zerocopy_fill_skb_from_iter(struct sk_buff *skb,
622636 struct iov_iter *from, size_t length)
623637 {
net/core/page_pool.c+4−2
@@ -287,8 +287,10 @@ static int page_pool_init(struct page_pool *pool, · 286 unmodified lines
287287 }
288288
289289 if (pool->mp_ops) {
290− if (!pool->dma_map || !pool->dma_sync)
291− return -EOPNOTSUPP;
290+ if (!pool->dma_map || !pool->dma_sync) {
291+ err = -EOPNOTSUPP;
292+ goto free_ptr_ring;
293+ }
292294
293295 if (WARN_ON(!is_kernel_rodata((unsigned long)pool->mp_ops))) {
294296 err = -EFAULT;
net/ipv4/route.c+7−3
@@ -2576,12 +2576,16 @@ static struct rtable *__mkroute_output(const struct fib_result *res, · 2575 unmodified lines
25762576 !netif_is_l3_master(dev_out))
25772577 return ERR_PTR(-EINVAL);
25782578
2579− if (ipv4_is_lbcast(fl4->daddr))
2579+ if (ipv4_is_lbcast(fl4->daddr)) {
25802580 type = RTN_BROADCAST;
2581− else if (ipv4_is_multicast(fl4->daddr))
2581+
2582+ /* reset fi to prevent gateway resolution */
2583+ fi = NULL;
2584+ } else if (ipv4_is_multicast(fl4->daddr)) {
25822585 type = RTN_MULTICAST;
2583− else if (ipv4_is_zeronet(fl4->daddr))
2586+ } else if (ipv4_is_zeronet(fl4->daddr)) {
25842587 return ERR_PTR(-EINVAL);
2588+ }
25852589
25862590 if (dev_out->flags & IFF_LOOPBACK)
25872591 flags |= RTCF_LOCAL;
net/l2tp/l2tp_ppp.c+8−17
@@ -129,22 +129,12 @@ static const struct ppp_channel_ops pppol2tp_chan_ops = { · 128 unmodified lines
129129
130130 static const struct proto_ops pppol2tp_ops;
131131
132−/* Retrieves the pppol2tp socket associated to a session.
133− * A reference is held on the returned socket, so this function must be paired
134− * with sock_put().
135− */
132+/* Retrieves the pppol2tp socket associated to a session. */
136133 static struct sock *pppol2tp_session_get_sock(struct l2tp_session *session)
137134 {
138135 struct pppol2tp_session *ps = l2tp_session_priv(session);
139− struct sock *sk;
140−
141− rcu_read_lock();
142− sk = rcu_dereference(ps->sk);
143− if (sk)
144− sock_hold(sk);
145− rcu_read_unlock();
146136
147− return sk;
137+ return rcu_dereference(ps->sk);
148138 }
149139
150140 /* Helpers to obtain tunnel/session contexts from sockets.
@@ -206,14 +196,13 @@ end: · 55 unmodified lines
206196
207197 static void pppol2tp_recv(struct l2tp_session *session, struct sk_buff *skb, int data_len)
208198 {
209− struct pppol2tp_session *ps = l2tp_session_priv(session);
210− struct sock *sk = NULL;
199+ struct sock *sk;
211200
212201 /* If the socket is bound, send it in to PPP's input queue. Otherwise
213202 * queue it on the session socket.
214203 */
215204 rcu_read_lock();
216− sk = rcu_dereference(ps->sk);
205+ sk = pppol2tp_session_get_sock(session);
217206 if (!sk)
218207 goto no_sock;
219208
@@ -510,13 +499,14 @@ static void pppol2tp_show(struct seq_file *m, void *arg) · 290 unmodified lines
510499 struct l2tp_session *session = arg;
511500 struct sock *sk;
512501
502+ rcu_read_lock();
513503 sk = pppol2tp_session_get_sock(session);
514504 if (sk) {
515505 struct pppox_sock *po = pppox_sk(sk);
516506
517507 seq_printf(m, " interface %s\n", ppp_dev_name(&po->chan));
518− sock_put(sk);
519508 }
509+ rcu_read_unlock();
520510 }
521511
522512 static void pppol2tp_session_init(struct l2tp_session *session)
@@ -1530,6 +1520,7 @@ static void pppol2tp_seq_session_show(struct seq_file *m, void *v) · 1007 unmodified lines
15301520 port = ntohs(inet->inet_sport);
15311521 }
15321522
1523+ rcu_read_lock();
15331524 sk = pppol2tp_session_get_sock(session);
15341525 if (sk) {
15351526 state = sk->sk_state;
@@ -1565,8 +1556,8 @@ static void pppol2tp_seq_session_show(struct seq_file *m, void *v) · 29 unmodified lines
15651556 struct pppox_sock *po = pppox_sk(sk);
15661557
15671558 seq_printf(m, " interface %s\n", ppp_dev_name(&po->chan));
1568− sock_put(sk);
15691559 }
1560+ rcu_read_unlock();
15701561 }
15711562
15721563 static int pppol2tp_seq_show(struct seq_file *m, void *v)
net/rose/af_rose.c+7−6
@@ -170,7 +170,7 @@ void rose_kill_by_neigh(struct rose_neigh *neigh) · 169 unmodified lines
170170
171171 if (rose->neighbour == neigh) {
172172 rose_disconnect(s, ENETUNREACH, ROSE_OUT_OF_ORDER, 0);
173− rose->neighbour->use--;
173+ rose_neigh_put(rose->neighbour);
174174 rose->neighbour = NULL;
175175 }
176176 }
@@ -212,7 +212,7 @@ start: · 35 unmodified lines
212212 if (rose->device == dev) {
213213 rose_disconnect(sk, ENETUNREACH, ROSE_OUT_OF_ORDER, 0);
214214 if (rose->neighbour)
215− rose->neighbour->use--;
215+ rose_neigh_put(rose->neighbour);
216216 netdev_put(rose->device, &rose->dev_tracker);
217217 rose->device = NULL;
218218 }
@@ -655,7 +655,7 @@ static int rose_release(struct socket *sock) · 436 unmodified lines
655655 break;
656656
657657 case ROSE_STATE_2:
658− rose->neighbour->use--;
658+ rose_neigh_put(rose->neighbour);
659659 release_sock(sk);
660660 rose_disconnect(sk, 0, -1, -1);
661661 lock_sock(sk);
@@ -823,6 +823,7 @@ static int rose_connect(struct socket *sock, struct sockaddr *uaddr, int addr_le · 161 unmodified lines
823823 rose->lci = rose_new_lci(rose->neighbour);
824824 if (!rose->lci) {
825825 err = -ENETUNREACH;
826+ rose_neigh_put(rose->neighbour);
826827 goto out_release;
827828 }
828829
@@ -834,12 +835,14 @@ static int rose_connect(struct socket *sock, struct sockaddr *uaddr, int addr_le · 5 unmodified lines
834835 dev = rose_dev_first();
835836 if (!dev) {
836837 err = -ENETUNREACH;
838+ rose_neigh_put(rose->neighbour);
837839 goto out_release;
838840 }
839841
840842 user = ax25_findbyuid(current_euid());
841843 if (!user) {
842844 err = -EINVAL;
845+ rose_neigh_put(rose->neighbour);
843846 dev_put(dev);
844847 goto out_release;
845848 }
@@ -874,8 +877,6 @@ static int rose_connect(struct socket *sock, struct sockaddr *uaddr, int addr_le · 28 unmodified lines
874877
875878 rose->state = ROSE_STATE_1;
876879
877− rose->neighbour->use++;
878−
879880 rose_write_internal(sk, ROSE_CALL_REQUEST);
880881 rose_start_heartbeat(sk);
881882 rose_start_t1timer(sk);
@@ -1077,7 +1078,7 @@ int rose_rx_call_request(struct sk_buff *skb, struct net_device *dev, struct ros · 195 unmodified lines
10771078 GFP_ATOMIC);
10781079 make_rose->facilities = facilities;
10791080
1080− make_rose->neighbour->use++;
1081+ rose_neigh_hold(make_rose->neighbour);
10811082
10821083 if (rose_sk(sk)->defer) {
10831084 make_rose->state = ROSE_STATE_5;
net/rose/rose_in.c+6−6
@@ -56,7 +56,7 @@ static int rose_state1_machine(struct sock *sk, struct sk_buff *skb, int framety · 55 unmodified lines
5656 case ROSE_CLEAR_REQUEST:
5757 rose_write_internal(sk, ROSE_CLEAR_CONFIRMATION);
5858 rose_disconnect(sk, ECONNREFUSED, skb->data[3], skb->data[4]);
59− rose->neighbour->use--;
59+ rose_neigh_put(rose->neighbour);
6060 break;
6161
6262 default:
@@ -79,12 +79,12 @@ static int rose_state2_machine(struct sock *sk, struct sk_buff *skb, int framety · 16 unmodified lines
7979 case ROSE_CLEAR_REQUEST:
8080 rose_write_internal(sk, ROSE_CLEAR_CONFIRMATION);
8181 rose_disconnect(sk, 0, skb->data[3], skb->data[4]);
82− rose->neighbour->use--;
82+ rose_neigh_put(rose->neighbour);
8383 break;
8484
8585 case ROSE_CLEAR_CONFIRMATION:
8686 rose_disconnect(sk, 0, -1, -1);
87− rose->neighbour->use--;
87+ rose_neigh_put(rose->neighbour);
8888 break;
8989
9090 default:
@@ -121,7 +121,7 @@ static int rose_state3_machine(struct sock *sk, struct sk_buff *skb, int framety · 30 unmodified lines
121121 case ROSE_CLEAR_REQUEST:
122122 rose_write_internal(sk, ROSE_CLEAR_CONFIRMATION);
123123 rose_disconnect(sk, 0, skb->data[3], skb->data[4]);
124− rose->neighbour->use--;
124+ rose_neigh_put(rose->neighbour);
125125 break;
126126
127127 case ROSE_RR:
@@ -234,7 +234,7 @@ static int rose_state4_machine(struct sock *sk, struct sk_buff *skb, int framety · 106 unmodified lines
234234 case ROSE_CLEAR_REQUEST:
235235 rose_write_internal(sk, ROSE_CLEAR_CONFIRMATION);
236236 rose_disconnect(sk, 0, skb->data[3], skb->data[4]);
237− rose->neighbour->use--;
237+ rose_neigh_put(rose->neighbour);
238238 break;
239239
240240 default:
@@ -254,7 +254,7 @@ static int rose_state5_machine(struct sock *sk, struct sk_buff *skb, int framety · 13 unmodified lines
254254 if (frametype == ROSE_CLEAR_REQUEST) {
255255 rose_write_internal(sk, ROSE_CLEAR_CONFIRMATION);
256256 rose_disconnect(sk, 0, skb->data[3], skb->data[4]);
257− rose_sk(sk)->neighbour->use--;
257+ rose_neigh_put(rose_sk(sk)->neighbour);
258258 }
259259
260260 return 0;
net/rose/rose_route.c+38−24
@@ -93,11 +93,11 @@ static int __must_check rose_add_node(struct rose_route_struct *rose_route, · 92 unmodified lines
9393 rose_neigh->ax25 = NULL;
9494 rose_neigh->dev = dev;
9595 rose_neigh->count = 0;
96− rose_neigh->use = 0;
9796 rose_neigh->dce_mode = 0;
9897 rose_neigh->loopback = 0;
9998 rose_neigh->number = rose_neigh_no++;
10099 rose_neigh->restarted = 0;
100+ refcount_set(&rose_neigh->use, 1);
101101
102102 skb_queue_head_init(&rose_neigh->queue);
103103
@@ -178,6 +178,7 @@ static int __must_check rose_add_node(struct rose_route_struct *rose_route, · 74 unmodified lines
178178 }
179179 }
180180 rose_neigh->count++;
181+ rose_neigh_hold(rose_neigh);
181182
182183 goto out;
183184 }
@@ -187,6 +188,7 @@ static int __must_check rose_add_node(struct rose_route_struct *rose_route, · 3 unmodified lines
187188 rose_node->neighbour[rose_node->count] = rose_neigh;
188189 rose_node->count++;
189190 rose_neigh->count++;
191+ rose_neigh_hold(rose_neigh);
190192 }
191193
192194 out:
@@ -234,20 +236,12 @@ static void rose_remove_neigh(struct rose_neigh *rose_neigh) · 41 unmodified lines
234236
235237 if ((s = rose_neigh_list) == rose_neigh) {
236238 rose_neigh_list = rose_neigh->next;
237− if (rose_neigh->ax25)
238− ax25_cb_put(rose_neigh->ax25);
239− kfree(rose_neigh->digipeat);
240− kfree(rose_neigh);
241239 return;
242240 }
243241
244242 while (s != NULL && s->next != NULL) {
245243 if (s->next == rose_neigh) {
246244 s->next = rose_neigh->next;
247− if (rose_neigh->ax25)
248− ax25_cb_put(rose_neigh->ax25);
249− kfree(rose_neigh->digipeat);
250− kfree(rose_neigh);
251245 return;
252246 }
253247
@@ -263,10 +257,10 @@ static void rose_remove_route(struct rose_route *rose_route) · 9 unmodified lines
263257 struct rose_route *s;
264258
265259 if (rose_route->neigh1 != NULL)
266− rose_route->neigh1->use--;
260+ rose_neigh_put(rose_route->neigh1);
267261
268262 if (rose_route->neigh2 != NULL)
269− rose_route->neigh2->use--;
263+ rose_neigh_put(rose_route->neigh2);
270264
271265 if ((s = rose_route_list) == rose_route) {
272266 rose_route_list = rose_route->next;
@@ -330,9 +324,12 @@ static int rose_del_node(struct rose_route_struct *rose_route, · 57 unmodified lines
330324 for (i = 0; i < rose_node->count; i++) {
331325 if (rose_node->neighbour[i] == rose_neigh) {
332326 rose_neigh->count--;
327+ rose_neigh_put(rose_neigh);
333328
334− if (rose_neigh->count == 0 && rose_neigh->use == 0)
329+ if (rose_neigh->count == 0) {
335330 rose_remove_neigh(rose_neigh);
331+ rose_neigh_put(rose_neigh);
332+ }
336333
337334 rose_node->count--;
338335
@@ -381,11 +378,11 @@ void rose_add_loopback_neigh(void) · 42 unmodified lines
381378 sn->ax25 = NULL;
382379 sn->dev = NULL;
383380 sn->count = 0;
384− sn->use = 0;
385381 sn->dce_mode = 1;
386382 sn->loopback = 1;
387383 sn->number = rose_neigh_no++;
388384 sn->restarted = 1;
385+ refcount_set(&sn->use, 1);
389386
390387 skb_queue_head_init(&sn->queue);
391388
@@ -436,6 +433,7 @@ int rose_add_loopback_node(const rose_address *address) · 44 unmodified lines
436433 rose_node_list = rose_node;
437434
438435 rose_loopback_neigh->count++;
436+ rose_neigh_hold(rose_loopback_neigh);
439437
440438 out:
441439 spin_unlock_bh(&rose_node_list_lock);
@@ -467,6 +465,7 @@ void rose_del_loopback_node(const rose_address *address) · 25 unmodified lines
467465 rose_remove_node(rose_node);
468466
469467 rose_loopback_neigh->count--;
468+ rose_neigh_put(rose_loopback_neigh);
470469
471470 out:
472471 spin_unlock_bh(&rose_node_list_lock);
@@ -506,6 +505,7 @@ void rose_rt_device_down(struct net_device *dev) · 33 unmodified lines
506505 memmove(&t->neighbour[i], &t->neighbour[i + 1],
507506 sizeof(t->neighbour[0]) *
508507 (t->count - i));
508+ rose_neigh_put(s);
509509 }
510510
511511 if (t->count <= 0)
@@ -513,6 +513,7 @@ void rose_rt_device_down(struct net_device *dev) · 1 unmodified line
513513 }
514514
515515 rose_remove_neigh(s);
516+ rose_neigh_put(s);
516517 }
517518 spin_unlock_bh(&rose_neigh_list_lock);
518519 spin_unlock_bh(&rose_node_list_lock);
@@ -548,6 +549,7 @@ static int rose_clear_routes(void) · 29 unmodified lines
548549 {
549550 struct rose_neigh *s, *rose_neigh;
550551 struct rose_node *t, *rose_node;
552+ int i;
551553
552554 spin_lock_bh(&rose_node_list_lock);
553555 spin_lock_bh(&rose_neigh_list_lock);
@@ -558,17 +560,21 @@ static int rose_clear_routes(void) · 4 unmodified lines
558560 while (rose_node != NULL) {
559561 t = rose_node;
560562 rose_node = rose_node->next;
561− if (!t->loopback)
563+
564+ if (!t->loopback) {
565+ for (i = 0; i < t->count; i++)
566+ rose_neigh_put(t->neighbour[i]);
562567 rose_remove_node(t);
568+ }
563569 }
564570
565571 while (rose_neigh != NULL) {
566572 s = rose_neigh;
567573 rose_neigh = rose_neigh->next;
568574
569− if (s->use == 0 && !s->loopback) {
570− s->count = 0;
575+ if (!s->loopback) {
571576 rose_remove_neigh(s);
577+ rose_neigh_put(s);
572578 }
573579 }
574580
@@ -684,6 +690,7 @@ struct rose_neigh *rose_get_neigh(rose_address *addr, unsigned char *cause, · 109 unmodified lines
684690 for (i = 0; i < node->count; i++) {
685691 if (node->neighbour[i]->restarted) {
686692 res = node->neighbour[i];
693+ rose_neigh_hold(node->neighbour[i]);
687694 goto out;
688695 }
689696 }
@@ -695,6 +702,7 @@ struct rose_neigh *rose_get_neigh(rose_address *addr, unsigned char *cause, · 5 unmodified lines
695702 for (i = 0; i < node->count; i++) {
696703 if (!rose_ftimer_running(node->neighbour[i])) {
697704 res = node->neighbour[i];
705+ rose_neigh_hold(node->neighbour[i]);
698706 goto out;
699707 }
700708 failed = 1;
@@ -784,13 +792,13 @@ static void rose_del_route_by_neigh(struct rose_neigh *rose_neigh) · 83 unmodified lines
784792 }
785793
786794 if (rose_route->neigh1 == rose_neigh) {
787− rose_route->neigh1->use--;
795+ rose_neigh_put(rose_route->neigh1);
788796 rose_route->neigh1 = NULL;
789797 rose_transmit_clear_request(rose_route->neigh2, rose_route->lci2, ROSE_OUT_OF_ORDER, 0);
790798 }
791799
792800 if (rose_route->neigh2 == rose_neigh) {
793− rose_route->neigh2->use--;
801+ rose_neigh_put(rose_route->neigh2);
794802 rose_route->neigh2 = NULL;
795803 rose_transmit_clear_request(rose_route->neigh1, rose_route->lci1, ROSE_OUT_OF_ORDER, 0);
796804 }
@@ -919,7 +927,7 @@ int rose_route_frame(struct sk_buff *skb, ax25_cb *ax25) · 122 unmodified lines
919927 rose_clear_queues(sk);
920928 rose->cause = ROSE_NETWORK_CONGESTION;
921929 rose->diagnostic = 0;
922− rose->neighbour->use--;
930+ rose_neigh_put(rose->neighbour);
923931 rose->neighbour = NULL;
924932 rose->lci = 0;
925933 rose->state = ROSE_STATE_0;
@@ -1044,12 +1052,12 @@ int rose_route_frame(struct sk_buff *skb, ax25_cb *ax25) · 118 unmodified lines
10441052
10451053 if ((new_lci = rose_new_lci(new_neigh)) == 0) {
10461054 rose_transmit_clear_request(rose_neigh, lci, ROSE_NETWORK_CONGESTION, 71);
1047− goto out;
1055+ goto put_neigh;
10481056 }
10491057
10501058 if ((rose_route = kmalloc(sizeof(*rose_route), GFP_ATOMIC)) == NULL) {
10511059 rose_transmit_clear_request(rose_neigh, lci, ROSE_NETWORK_CONGESTION, 120);
1052− goto out;
1060+ goto put_neigh;
10531061 }
10541062
10551063 rose_route->lci1 = lci;
@@ -1062,8 +1070,8 @@ int rose_route_frame(struct sk_buff *skb, ax25_cb *ax25) · 6 unmodified lines
10621070 rose_route->lci2 = new_lci;
10631071 rose_route->neigh2 = new_neigh;
10641072
1065− rose_route->neigh1->use++;
1066− rose_route->neigh2->use++;
1073+ rose_neigh_hold(rose_route->neigh1);
1074+ rose_neigh_hold(rose_route->neigh2);
10671075
10681076 rose_route->next = rose_route_list;
10691077 rose_route_list = rose_route;
@@ -1075,6 +1083,8 @@ int rose_route_frame(struct sk_buff *skb, ax25_cb *ax25) · 5 unmodified lines
10751083 rose_transmit_link(skb, rose_route->neigh2);
10761084 res = 1;
10771085
1086+put_neigh:
1087+ rose_neigh_put(new_neigh);
10781088 out:
10791089 spin_unlock_bh(&rose_route_list_lock);
10801090 spin_unlock_bh(&rose_neigh_list_lock);
@@ -1190,7 +1200,7 @@ static int rose_neigh_show(struct seq_file *seq, void *v) · 109 unmodified lines
11901200 (rose_neigh->loopback) ? "RSLOOP-0" : ax2asc(buf, &rose_neigh->callsign),
11911201 rose_neigh->dev ? rose_neigh->dev->name : "???",
11921202 rose_neigh->count,
1193− rose_neigh->use,
1203+ refcount_read(&rose_neigh->use) - rose_neigh->count - 1,
11941204 (rose_neigh->dce_mode) ? "DCE" : "DTE",
11951205 (rose_neigh->restarted) ? "yes" : "no",
11961206 ax25_display_timer(&rose_neigh->t0timer) / HZ,
@@ -1295,18 +1305,22 @@ void __exit rose_rt_free(void) · 98 unmodified lines
12951305 struct rose_neigh *s, *rose_neigh = rose_neigh_list;
12961306 struct rose_node *t, *rose_node = rose_node_list;
12971307 struct rose_route *u, *rose_route = rose_route_list;
1308+ int i;
12981309
12991310 while (rose_neigh != NULL) {
13001311 s = rose_neigh;
13011312 rose_neigh = rose_neigh->next;
13021313
13031314 rose_remove_neigh(s);
1315+ rose_neigh_put(s);
13041316 }
13051317
13061318 while (rose_node != NULL) {
13071319 t = rose_node;
13081320 rose_node = rose_node->next;
13091321
1322+ for (i = 0; i < t->count; i++)
1323+ rose_neigh_put(t->neighbour[i]);
13101324 rose_remove_node(t);
13111325 }
13121326
net/rose/rose_timer.c+1−1
@@ -180,7 +180,7 @@ static void rose_timer_expiry(struct timer_list *t) · 179 unmodified lines
180180 break;
181181
182182 case ROSE_STATE_2: /* T3 */
183− rose->neighbour->use--;
183+ rose_neigh_put(rose->neighbour);
184184 rose_disconnect(sk, ETIMEDOUT, -1, -1);
185185 break;
186186
net/sctp/ipv6.c+2−0
@@ -547,7 +547,9 @@ static void sctp_v6_from_sk(union sctp_addr *addr, struct sock *sk) · 546 unmodified lines
547547 {
548548 addr->v6.sin6_family = AF_INET6;
549549 addr->v6.sin6_port = 0;
550+ addr->v6.sin6_flowinfo = 0;
550551 addr->v6.sin6_addr = sk->sk_v6_rcv_saddr;
552+ addr->v6.sin6_scope_id = 0;
551553 }
552554
553555 /* Initialize sk->sk_rcv_saddr from sctp_addr. */
net/vmw_vsock/virtio_transport_common.c+5−3
@@ -105,12 +105,14 @@ static int virtio_transport_fill_skb(struct sk_buff *skb, · 104 unmodified lines
105105 size_t len,
106106 bool zcopy)
107107 {
108+ struct msghdr *msg = info->msg;
109+
108110 if (zcopy)
109− return __zerocopy_sg_from_iter(info->msg, NULL, skb,
110− &info->msg->msg_iter, len, NULL);
111+ return __zerocopy_sg_from_iter(msg, NULL, skb,
112+ &msg->msg_iter, len, NULL);
111113
112114 virtio_vsock_skb_put(skb, len);
113− return skb_copy_datagram_from_iter(skb, 0, &info->msg->msg_iter, len);
115+ return skb_copy_datagram_from_iter_full(skb, 0, &msg->msg_iter, len);
114116 }
115117
116118 static void virtio_transport_init_hdr(struct sk_buff *skb,
rust/kernel/alloc/allocator.rs+18−12
@@ -43,17 +43,6 @@ pub struct Vmalloc; · 42 unmodified lines
4343 /// For more details see [self].
4444 pub struct KVmalloc;
4545
46−/// Returns a proper size to alloc a new object aligned to `new_layout`'s alignment.
47−fn aligned_size(new_layout: Layout) -> usize {
48− // Customized layouts from `Layout::from_size_align()` can have size < align, so pad first.
49− let layout = new_layout.pad_to_align();
50−
51− // Note that `layout.size()` (after padding) is guaranteed to be a multiple of `layout.align()`
52− // which together with the slab guarantees means the `krealloc` will return a properly aligned
53− // object (see comments in `kmalloc()` for more information).
54− layout.size()
55−}
56−
5746 /// # Invariants
5847 ///
5948 /// One of the following: `krealloc`, `vrealloc`, `kvrealloc`.
@@ -88,7 +77,7 @@ impl ReallocFunc { · 28 unmodified lines
8877 old_layout: Layout,
8978 flags: Flags,
9079 ) -> Result<NonNull<[u8]>, AllocError> {
91− let size = aligned_size(layout);
80+ let size = layout.size();
9281 let ptr = match ptr {
9382 Some(ptr) => {
9483 if old_layout.size() == 0 {
@@ -123,6 +112,17 @@ impl ReallocFunc { · 28 unmodified lines
123112 }
124113 }
125114
115+impl Kmalloc {
116+ /// Returns a [`Layout`] that makes [`Kmalloc`] fulfill the requested size and alignment of
117+ /// `layout`.
118+ pub fn aligned_layout(layout: Layout) -> Layout {
119+ // Note that `layout.size()` (after padding) is guaranteed to be a multiple of
120+ // `layout.align()` which together with the slab guarantees means that `Kmalloc` will return
121+ // a properly aligned object (see comments in `kmalloc()` for more information).
122+ layout.pad_to_align()
123+ }
124+}
125+
126126 // SAFETY: `realloc` delegates to `ReallocFunc::call`, which guarantees that
127127 // - memory remains valid until it is explicitly freed,
128128 // - passing a pointer to a valid memory allocation is OK,
@@ -135,6 +135,8 @@ unsafe impl Allocator for Kmalloc { · 6 unmodified lines
135135 old_layout: Layout,
136136 flags: Flags,
137137 ) -> Result<NonNull<[u8]>, AllocError> {
138+ let layout = Kmalloc::aligned_layout(layout);
139+
138140 // SAFETY: `ReallocFunc::call` has the same safety requirements as `Allocator::realloc`.
139141 unsafe { ReallocFunc::KREALLOC.call(ptr, layout, old_layout, flags) }
140142 }
@@ -176,6 +178,10 @@ unsafe impl Allocator for KVmalloc { · 35 unmodified lines
176178 old_layout: Layout,
177179 flags: Flags,
178180 ) -> Result<NonNull<[u8]>, AllocError> {
181+ // `KVmalloc` may use the `Kmalloc` backend, hence we have to enforce a `Kmalloc`
182+ // compatible layout.
183+ let layout = Kmalloc::aligned_layout(layout);
184+
179185 // TODO: Support alignments larger than PAGE_SIZE.
180186 if layout.align() > bindings::PAGE_SIZE {
181187 pr_warn!("KVmalloc does not support alignments larger than PAGE_SIZE yet.\n");
rust/kernel/alloc/allocator_test.rs+11−0
@@ -22,6 +22,17 @@ pub type Kmalloc = Cmalloc; · 21 unmodified lines
2222 pub type Vmalloc = Kmalloc;
2323 pub type KVmalloc = Kmalloc;
2424
25+impl Cmalloc {
26+ /// Returns a [`Layout`] that makes [`Kmalloc`] fulfill the requested size and alignment of
27+ /// `layout`.
28+ pub fn aligned_layout(layout: Layout) -> Layout {
29+ // Note that `layout.size()` (after padding) is guaranteed to be a multiple of
30+ // `layout.align()` which together with the slab guarantees means that `Kmalloc` will return
31+ // a properly aligned object (see comments in `kmalloc()` for more information).
32+ layout.pad_to_align()
33+ }
34+}
35+
2536 extern "C" {
2637 #[link_name = "aligned_alloc"]
2738 fn libc_aligned_alloc(align: usize, size: usize) -> *mut crate::ffi::c_void;
rust/kernel/device.rs+184−24
@@ -15,23 +15,130 @@ use crate::c_str; · 14 unmodified lines
1515
1616 pub mod property;
1717
18−/// A reference-counted device.
18+/// The core representation of a device in the kernel's driver model.
1919 ///
20−/// This structure represents the Rust abstraction for a C `struct device`. This implementation
21−/// abstracts the usage of an already existing C `struct device` within Rust code that we get
22−/// passed from the C side.
20+/// This structure represents the Rust abstraction for a C `struct device`. A [`Device`] can either
21+/// exist as temporary reference (see also [`Device::from_raw`]), which is only valid within a
22+/// certain scope or as [`ARef<Device>`], owning a dedicated reference count.
2323 ///
24−/// An instance of this abstraction can be obtained temporarily or permanent.
24+/// # Device Types
2525 ///
26−/// A temporary one is bound to the lifetime of the C `struct device` pointer used for creation.
27−/// A permanent instance is always reference-counted and hence not restricted by any lifetime
28−/// boundaries.
26+/// A [`Device`] can represent either a bus device or a class device.
2927 ///
30−/// For subsystems it is recommended to create a permanent instance to wrap into a subsystem
31−/// specific device structure (e.g. `pci::Device`). This is useful for passing it to drivers in
32−/// `T::probe()`, such that a driver can store the `ARef<Device>` (equivalent to storing a
33−/// `struct device` pointer in a C driver) for arbitrary purposes, e.g. allocating DMA coherent
34−/// memory.
28+/// ## Bus Devices
29+///
30+/// A bus device is a [`Device`] that is associated with a physical or virtual bus. Examples of
31+/// buses include PCI, USB, I2C, and SPI. Devices attached to a bus are registered with a specific
32+/// bus type, which facilitates matching devices with appropriate drivers based on IDs or other
33+/// identifying information. Bus devices are visible in sysfs under `/sys/bus/<bus-name>/devices/`.
34+///
35+/// ## Class Devices
36+///
37+/// A class device is a [`Device`] that is associated with a logical category of functionality
38+/// rather than a physical bus. Examples of classes include block devices, network interfaces, sound
39+/// cards, and input devices. Class devices are grouped under a common class and exposed to
40+/// userspace via entries in `/sys/class/<class-name>/`.
41+///
42+/// # Device Context
43+///
44+/// [`Device`] references are generic over a [`DeviceContext`], which represents the type state of
45+/// a [`Device`].
46+///
47+/// As the name indicates, this type state represents the context of the scope the [`Device`]
48+/// reference is valid in. For instance, the [`Bound`] context guarantees that the [`Device`] is
49+/// bound to a driver for the entire duration of the existence of a [`Device<Bound>`] reference.
50+///
51+/// Other [`DeviceContext`] types besides [`Bound`] are [`Normal`], [`Core`] and [`CoreInternal`].
52+///
53+/// Unless selected otherwise [`Device`] defaults to the [`Normal`] [`DeviceContext`], which by
54+/// itself has no additional requirements.
55+///
56+/// It is always up to the caller of [`Device::from_raw`] to select the correct [`DeviceContext`]
57+/// type for the corresponding scope the [`Device`] reference is created in.
58+///
59+/// All [`DeviceContext`] types other than [`Normal`] are intended to be used with
60+/// [bus devices](#bus-devices) only.
61+///
62+/// # Implementing Bus Devices
63+///
64+/// This section provides a guideline to implement bus specific devices, such as [`pci::Device`] or
65+/// [`platform::Device`].
66+///
67+/// A bus specific device should be defined as follows.
68+///
69+/// ```ignore
70+/// #[repr(transparent)]
71+/// pub struct Device<Ctx: device::DeviceContext = device::Normal>(
72+/// Opaque<bindings::bus_device_type>,
73+/// PhantomData<Ctx>,
74+/// );
75+/// ```
76+///
77+/// Since devices are reference counted, [`AlwaysRefCounted`] should be implemented for `Device`
78+/// (i.e. `Device<Normal>`). Note that [`AlwaysRefCounted`] must not be implemented for any other
79+/// [`DeviceContext`], since all other device context types are only valid within a certain scope.
80+///
81+/// In order to be able to implement the [`DeviceContext`] dereference hierarchy, bus device
82+/// implementations should call the [`impl_device_context_deref`] macro as shown below.
83+///
84+/// ```ignore
85+/// // SAFETY: `Device` is a transparent wrapper of a type that doesn't depend on `Device`'s
86+/// // generic argument.
87+/// kernel::impl_device_context_deref!(unsafe { Device });
88+/// ```
89+///
90+/// In order to convert from a any [`Device<Ctx>`] to [`ARef<Device>`], bus devices can implement
91+/// the following macro call.
92+///
93+/// ```ignore
94+/// kernel::impl_device_context_into_aref!(Device);
95+/// ```
96+///
97+/// Bus devices should also implement the following [`AsRef`] implementation, such that users can
98+/// easily derive a generic [`Device`] reference.
99+///
100+/// ```ignore
101+/// impl<Ctx: device::DeviceContext> AsRef<device::Device<Ctx>> for Device<Ctx> {
102+/// fn as_ref(&self) -> &device::Device<Ctx> {
103+/// ...
104+/// }
105+/// }
106+/// ```
107+///
108+/// # Implementing Class Devices
109+///
110+/// Class device implementations require less infrastructure and depend slightly more on the
111+/// specific subsystem.
112+///
113+/// An example implementation for a class device could look like this.
114+///
115+/// ```ignore
116+/// #[repr(C)]
117+/// pub struct Device<T: class::Driver> {
118+/// dev: Opaque<bindings::class_device_type>,
119+/// data: T::Data,
120+/// }
121+/// ```
122+///
123+/// This class device uses the sub-classing pattern to embed the driver's private data within the
124+/// allocation of the class device. For this to be possible the class device is generic over the
125+/// class specific `Driver` trait implementation.
126+///
127+/// Just like any device, class devices are reference counted and should hence implement
128+/// [`AlwaysRefCounted`] for `Device`.
129+///
130+/// Class devices should also implement the following [`AsRef`] implementation, such that users can
131+/// easily derive a generic [`Device`] reference.
132+///
133+/// ```ignore
134+/// impl<T: class::Driver> AsRef<device::Device> for Device<T> {
135+/// fn as_ref(&self) -> &device::Device {
136+/// ...
137+/// }
138+/// }
139+/// ```
140+///
141+/// An example for a class device implementation is [`drm::Device`].
35142 ///
36143 /// # Invariants
37144 ///
@@ -42,6 +149,12 @@ pub mod property; · 4 unmodified lines
42149 ///
43150 /// `bindings::device::release` is valid to be called from any thread, hence `ARef<Device>` can be
44151 /// dropped from any thread.
152+///
153+/// [`AlwaysRefCounted`]: kernel::types::AlwaysRefCounted
154+/// [`drm::Device`]: kernel::drm::Device
155+/// [`impl_device_context_deref`]: kernel::impl_device_context_deref
156+/// [`pci::Device`]: kernel::pci::Device
157+/// [`platform::Device`]: kernel::platform::Device
45158 #[repr(transparent)]
46159 pub struct Device<Ctx: DeviceContext = Normal>(Opaque<bindings::device>, PhantomData<Ctx>);
47160
@@ -311,28 +424,75 @@ unsafe impl Send for Device {} · 263 unmodified lines
311424 // synchronization in `struct device`.
312425 unsafe impl Sync for Device {}
313426
314−/// Marker trait for the context of a bus specific device.
427+/// Marker trait for the context or scope of a bus specific device.
428+///
429+/// [`DeviceContext`] is a marker trait for types representing the context of a bus specific
430+/// [`Device`].
431+///
432+/// The specific device context types are: [`CoreInternal`], [`Core`], [`Bound`] and [`Normal`].
315433 ///
316−/// Some functions of a bus specific device should only be called from a certain context, i.e. bus
317−/// callbacks, such as `probe()`.
434+/// [`DeviceContext`] types are hierarchical, which means that there is a strict hierarchy that
435+/// defines which [`DeviceContext`] type can be derived from another. For instance, any
436+/// [`Device<Core>`] can dereference to a [`Device<Bound>`].
318437 ///
319−/// This is the marker trait for structures representing the context of a bus specific device.
438+/// The following enumeration illustrates the dereference hierarchy of [`DeviceContext`] types.
439+///
440+/// - [`CoreInternal`] => [`Core`] => [`Bound`] => [`Normal`]
441+///
442+/// Bus devices can automatically implement the dereference hierarchy by using
443+/// [`impl_device_context_deref`].
444+///
445+/// Note that the guarantee for a [`Device`] reference to have a certain [`DeviceContext`] comes
446+/// from the specific scope the [`Device`] reference is valid in.
447+///
448+/// [`impl_device_context_deref`]: kernel::impl_device_context_deref
320449 pub trait DeviceContext: private::Sealed {}
321450
322−/// The [`Normal`] context is the context of a bus specific device when it is not an argument of
323−/// any bus callback.
451+/// The [`Normal`] context is the default [`DeviceContext`] of any [`Device`].
452+///
453+/// The normal context does not indicate any specific context. Any `Device<Ctx>` is also a valid
454+/// [`Device<Normal>`]. It is the only [`DeviceContext`] for which it is valid to implement
455+/// [`AlwaysRefCounted`] for.
456+///
457+/// [`AlwaysRefCounted`]: kernel::types::AlwaysRefCounted
324458 pub struct Normal;
325459
326−/// The [`Core`] context is the context of a bus specific device when it is supplied as argument of
327−/// any of the bus callbacks, such as `probe()`.
460+/// The [`Core`] context is the context of a bus specific device when it appears as argument of
461+/// any bus specific callback, such as `probe()`.
462+///
463+/// The core context indicates that the [`Device<Core>`] reference's scope is limited to the bus
464+/// callback it appears in. It is intended to be used for synchronization purposes. Bus device
465+/// implementations can implement methods for [`Device<Core>`], such that they can only be called
466+/// from bus callbacks.
328467 pub struct Core;
329468
330−/// Semantically the same as [`Core`] but reserved for internal usage of the corresponding bus
469+/// Semantically the same as [`Core`], but reserved for internal usage of the corresponding bus
331470 /// abstraction.
471+///
472+/// The internal core context is intended to be used in exactly the same way as the [`Core`]
473+/// context, with the difference that this [`DeviceContext`] is internal to the corresponding bus
474+/// abstraction.
475+///
476+/// This context mainly exists to share generic [`Device`] infrastructure that should only be called
477+/// from bus callbacks with bus abstractions, but without making them accessible for drivers.
332478 pub struct CoreInternal;
333479
334−/// The [`Bound`] context is the context of a bus specific device reference when it is guaranteed to
335−/// be bound for the duration of its lifetime.
480+/// The [`Bound`] context is the [`DeviceContext`] of a bus specific device when it is guaranteed to
481+/// be bound to a driver.
482+///
483+/// The bound context indicates that for the entire duration of the lifetime of a [`Device<Bound>`]
484+/// reference, the [`Device`] is guaranteed to be bound to a driver.
485+///
486+/// Some APIs, such as [`dma::CoherentAllocation`] or [`Devres`] rely on the [`Device`] to be bound,
487+/// which can be proven with the [`Bound`] device context.
488+///
489+/// Any abstraction that can guarantee a scope where the corresponding bus device is bound, should
490+/// provide a [`Device<Bound>`] reference to its users for this scope. This allows users to benefit
491+/// from optimizations for accessing device resources, see also [`Devres::access`].
492+///
493+/// [`Devres`]: kernel::devres::Devres
494+/// [`Devres::access`]: kernel::devres::Devres::access
495+/// [`dma::CoherentAllocation`]: kernel::dma::CoherentAllocation
336496 pub struct Bound;
337497
338498 mod private {
rust/kernel/devres.rs+18−9
@@ -115,10 +115,11 @@ pub struct Devres<T: Send> { · 114 unmodified lines
115115 /// Contains all the fields shared with [`Self::callback`].
116116 // TODO: Replace with `UnsafePinned`, once available.
117117 //
118− // Subsequently, the `drop_in_place()` in `Devres::drop` and the explicit `Send` and `Sync'
119− // impls can be removed.
118+ // Subsequently, the `drop_in_place()` in `Devres::drop` and `Devres::new` as well as the
119+ // explicit `Send` and `Sync' impls can be removed.
120120 #[pin]
121121 inner: Opaque<Inner<T>>,
122+ _add_action: (),
122123 }
123124
124125 impl<T: Send> Devres<T> {
@@ -140,7 +141,15 @@ impl<T: Send> Devres<T> { · 15 unmodified lines
140141 dev: dev.into(),
141142 callback,
142143 // INVARIANT: `inner` is properly initialized.
143− inner <- {
144+ inner <- Opaque::pin_init(try_pin_init!(Inner {
145+ devm <- Completion::new(),
146+ revoke <- Completion::new(),
147+ data <- Revocable::new(data),
148+ })),
149+ // TODO: Replace with "initializer code blocks" [1] once available.
150+ //
151+ // [1] https://github.com/Rust-for-Linux/pin-init/pull/69
152+ _add_action: {
144153 // SAFETY: `this` is a valid pointer to uninitialized memory.
145154 let inner = unsafe { &raw mut (*this.as_ptr()).inner };
146155
@@ -152,13 +161,13 @@ impl<T: Send> Devres<T> { · 5 unmodified lines
152161 // live at least as long as the returned `impl PinInit<Self, Error>`.
153162 to_result(unsafe {
154163 bindings::devm_add_action(dev.as_raw(), Some(callback), inner.cast())
155− })?;
164+ }).inspect_err(|_| {
165+ let inner = Opaque::cast_into(inner);
156166
157− Opaque::pin_init(try_pin_init!(Inner {
158− devm <- Completion::new(),
159− revoke <- Completion::new(),
160− data <- Revocable::new(data),
161− }))
167+ // SAFETY: `inner` is a valid pointer to an `Inner<T>` and valid for both reads
168+ // and writes.
169+ unsafe { core::ptr::drop_in_place(inner) };
170+ })?;
162171 },
163172 })
164173 }
rust/kernel/driver.rs+87−2
@@ -2,8 +2,93 @@ · 1 unmodified line
22
33 //! Generic support for drivers of different buses (e.g., PCI, Platform, Amba, etc.).
44 //!
5−//! Each bus / subsystem is expected to implement [`RegistrationOps`], which allows drivers to
6−//! register using the [`Registration`] class.
5+//! This documentation describes how to implement a bus specific driver API and how to align it with
6+//! the design of (bus specific) devices.
7+//!
8+//! Note: Readers are expected to know the content of the documentation of [`Device`] and
9+//! [`DeviceContext`].
10+//!
11+//! # Driver Trait
12+//!
13+//! The main driver interface is defined by a bus specific driver trait. For instance:
14+//!
15+//! ```ignore
16+//! pub trait Driver: Send {
17+//! /// The type holding information about each device ID supported by the driver.
18+//! type IdInfo: 'static;
19+//!
20+//! /// The table of OF device ids supported by the driver.
21+//! const OF_ID_TABLE: Option<of::IdTable<Self::IdInfo>> = None;
22+//!
23+//! /// The table of ACPI device ids supported by the driver.
24+//! const ACPI_ID_TABLE: Option<acpi::IdTable<Self::IdInfo>> = None;
25+//!
26+//! /// Driver probe.
27+//! fn probe(dev: &Device<device::Core>, id_info: &Self::IdInfo) -> Result<Pin<KBox<Self>>>;
28+//!
29+//! /// Driver unbind (optional).
30+//! fn unbind(dev: &Device<device::Core>, this: Pin<&Self>) {
31+//! let _ = (dev, this);
32+//! }
33+//! }
34+//! ```
35+//!
36+//! For specific examples see [`auxiliary::Driver`], [`pci::Driver`] and [`platform::Driver`].
37+//!
38+//! The `probe()` callback should return a `Result<Pin<KBox<Self>>>`, i.e. the driver's private
39+//! data. The bus abstraction should store the pointer in the corresponding bus device. The generic
40+//! [`Device`] infrastructure provides common helpers for this purpose on its
41+//! [`Device<CoreInternal>`] implementation.
42+//!
43+//! All driver callbacks should provide a reference to the driver's private data. Once the driver
44+//! is unbound from the device, the bus abstraction should take back the ownership of the driver's
45+//! private data from the corresponding [`Device`] and [`drop`] it.
46+//!
47+//! All driver callbacks should provide a [`Device<Core>`] reference (see also [`device::Core`]).
48+//!
49+//! # Adapter
50+//!
51+//! The adapter implementation of a bus represents the abstraction layer between the C bus
52+//! callbacks and the Rust bus callbacks. It therefore has to be generic over an implementation of
53+//! the [driver trait](#driver-trait).
54+//!
55+//! ```ignore
56+//! pub struct Adapter<T: Driver>;
57+//! ```
58+//!
59+//! There's a common [`Adapter`] trait that can be implemented to inherit common driver
60+//! infrastructure, such as finding the ID info from an [`of::IdTable`] or [`acpi::IdTable`].
61+//!
62+//! # Driver Registration
63+//!
64+//! In order to register C driver types (such as `struct platform_driver`) the [adapter](#adapter)
65+//! should implement the [`RegistrationOps`] trait.
66+//!
67+//! This trait implementation can be used to create the actual registration with the common
68+//! [`Registration`] type.
69+//!
70+//! Typically, bus abstractions want to provide a bus specific `module_bus_driver!` macro, which
71+//! creates a kernel module with exactly one [`Registration`] for the bus specific adapter.
72+//!
73+//! The generic driver infrastructure provides a helper for this with the [`module_driver`] macro.
74+//!
75+//! # Device IDs
76+//!
77+//! Besides the common device ID types, such as [`of::DeviceId`] and [`acpi::DeviceId`], most buses
78+//! may need to implement their own device ID types.
79+//!
80+//! For this purpose the generic infrastructure in [`device_id`] should be used.
81+//!
82+//! [`auxiliary::Driver`]: kernel::auxiliary::Driver
83+//! [`Core`]: device::Core
84+//! [`Device`]: device::Device
85+//! [`Device<Core>`]: device::Device<device::Core>
86+//! [`Device<CoreInternal>`]: device::Device<device::CoreInternal>
87+//! [`DeviceContext`]: device::DeviceContext
88+//! [`device_id`]: kernel::device_id
89+//! [`module_driver`]: kernel::module_driver
90+//! [`pci::Driver`]: kernel::pci::Driver
91+//! [`platform::Driver`]: kernel::platform::Driver
792
893 use crate::error::{Error, Result};
994 use crate::{acpi, device, of, str::CStr, try_pin_init, types::Opaque, ThisModule};
rust/kernel/drm/device.rs+25−7
@@ -5,6 +5,7 @@ · 4 unmodified lines
55 //! C header: [`include/linux/drm/drm_device.h`](srctree/include/linux/drm/drm_device.h)
66
77 use crate::{
8+ alloc::allocator::Kmalloc,
89 bindings, device, drm,
910 drm::driver::AllocImpl,
1011 error::from_err_ptr,
@@ -12,7 +13,7 @@ use crate::{ · 1 unmodified line
1213 prelude::*,
1314 types::{ARef, AlwaysRefCounted, Opaque},
1415 };
15−use core::{mem, ops::Deref, ptr, ptr::NonNull};
16+use core::{alloc::Layout, mem, ops::Deref, ptr, ptr::NonNull};
1617
1718 #[cfg(CONFIG_DRM_LEGACY)]
1819 macro_rules! drm_legacy_fields {
@@ -53,10 +54,8 @@ macro_rules! drm_legacy_fields { · 34 unmodified lines
5354 ///
5455 /// `self.dev` is a valid instance of a `struct device`.
5556 #[repr(C)]
56−#[pin_data]
5757 pub struct Device<T: drm::Driver> {
5858 dev: Opaque<bindings::drm_device>,
59− #[pin]
6059 data: T::Data,
6160 }
6261
@@ -96,6 +95,10 @@ impl<T: drm::Driver> Device<T> { · 33 unmodified lines
9695
9796 /// Create a new `drm::Device` for a `drm::Driver`.
9897 pub fn new(dev: &device::Device, data: impl PinInit<T::Data, Error>) -> Result<ARef<Self>> {
98+ // `__drm_dev_alloc` uses `kmalloc()` to allocate memory, hence ensure a `kmalloc()`
99+ // compatible `Layout`.
100+ let layout = Kmalloc::aligned_layout(Layout::new::<Self>());
101+
99102 // SAFETY:
100103 // - `VTABLE`, as a `const` is pinned to the read-only section of the compilation,
101104 // - `dev` is valid by its type invarants,
@@ -103,7 +106,7 @@ impl<T: drm::Driver> Device<T> { · 1 unmodified line
103106 bindings::__drm_dev_alloc(
104107 dev.as_raw(),
105108 &Self::VTABLE,
106− mem::size_of::<Self>(),
109+ layout.size(),
107110 mem::offset_of!(Self, dev),
108111 )
109112 }
@@ -117,9 +120,13 @@ impl<T: drm::Driver> Device<T> { · 7 unmodified lines
117120 // - `raw_data` is a valid pointer to uninitialized memory.
118121 // - `raw_data` will not move until it is dropped.
119122 unsafe { data.__pinned_init(raw_data) }.inspect_err(|_| {
120− // SAFETY: `__drm_dev_alloc()` was successful, hence `raw_drm` must be valid and the
123+ // SAFETY: `raw_drm` is a valid pointer to `Self`, given that `__drm_dev_alloc` was
124+ // successful.
125+ let drm_dev = unsafe { Self::into_drm_device(raw_drm) };
126+
127+ // SAFETY: `__drm_dev_alloc()` was successful, hence `drm_dev` must be valid and the
121128 // refcount must be non-zero.
122− unsafe { bindings::drm_dev_put(ptr::addr_of_mut!((*raw_drm.as_ptr()).dev).cast()) };
129+ unsafe { bindings::drm_dev_put(drm_dev) };
123130 })?;
124131
125132 // SAFETY: The reference count is one, and now we take ownership of that reference as a
@@ -140,6 +147,14 @@ impl<T: drm::Driver> Device<T> { · 14 unmodified lines
140147 unsafe { crate::container_of!(Opaque::cast_from(ptr), Self, dev) }.cast_mut()
141148 }
142149
150+ /// # Safety
151+ ///
152+ /// `ptr` must be a valid pointer to `Self`.
153+ unsafe fn into_drm_device(ptr: NonNull<Self>) -> *mut bindings::drm_device {
154+ // SAFETY: By the safety requirements of this function, `ptr` is a valid pointer to `Self`.
155+ unsafe { &raw mut (*ptr.as_ptr()).dev }.cast()
156+ }
157+
143158 /// Not intended to be called externally, except via declare_drm_ioctls!()
144159 ///
145160 /// # Safety
@@ -189,8 +204,11 @@ unsafe impl<T: drm::Driver> AlwaysRefCounted for Device<T> { · 43 unmodified lines
189204 }
190205
191206 unsafe fn dec_ref(obj: NonNull<Self>) {
207+ // SAFETY: `obj` is a valid pointer to `Self`.
208+ let drm_dev = unsafe { Self::into_drm_device(obj) };
209+
192210 // SAFETY: The safety requirements guarantee that the refcount is non-zero.
193− unsafe { bindings::drm_dev_put(obj.cast().as_ptr()) };
211+ unsafe { bindings::drm_dev_put(drm_dev) };
194212 }
195213 }
196214
rust/kernel/faux.rs+1−1
@@ -4,7 +4,7 @@ · 3 unmodified lines
44 //!
55 //! This module provides bindings for working with faux devices in kernel modules.
66 //!
7−//! C header: [`include/linux/device/faux.h`]
7+//! C header: [`include/linux/device/faux.h`](srctree/include/linux/device/faux.h)
88
99 use crate::{bindings, device, error::code::*, prelude::*};
1010 use core::ptr::{addr_of_mut, null, null_mut, NonNull};
sound/core/timer.c+2−2
@@ -2139,14 +2139,14 @@ static int snd_utimer_create(struct snd_timer_uinfo *utimer_info, · 2138 unmodified lines
21392139 goto err_take_id;
21402140 }
21412141
2142+ utimer->id = utimer_id;
2143+
21422144 utimer->name = kasprintf(GFP_KERNEL, "snd-utimer%d", utimer_id);
21432145 if (!utimer->name) {
21442146 err = -ENOMEM;
21452147 goto err_get_name;
21462148 }
21472149
2148− utimer->id = utimer_id;
2149−
21502150 tid.dev_sclass = SNDRV_TIMER_SCLASS_APPLICATION;
21512151 tid.dev_class = SNDRV_TIMER_CLASS_GLOBAL;
21522152 tid.card = -1;
sound/hda/codecs/realtek/alc269.c+22−9
@@ -510,6 +510,15 @@ static void alc256_shutup(struct hda_codec *codec) · 509 unmodified lines
510510 hp_pin = 0x21;
511511
512512 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
513+
514+ /* 3k pull low control for Headset jack. */
515+ /* NOTE: call this before clearing the pin, otherwise codec stalls */
516+ /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
517+ * when booting with headset plugged. So skip setting it for the codec alc257
518+ */
519+ if (spec->en_3kpull_low)
520+ alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
521+
513522 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
514523
515524 if (hp_pin_sense) {
@@ -520,14 +529,6 @@ static void alc256_shutup(struct hda_codec *codec) · 4 unmodified lines
520529
521530 msleep(75);
522531
523− /* 3k pull low control for Headset jack. */
524− /* NOTE: call this before clearing the pin, otherwise codec stalls */
525− /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
526− * when booting with headset plugged. So skip setting it for the codec alc257
527− */
528− if (spec->en_3kpull_low)
529− alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
530−
531532 if (!spec->no_shutup_pins)
532533 snd_hda_codec_write(codec, hp_pin, 0,
533534 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
@@ -3579,6 +3580,7 @@ enum { · 3045 unmodified lines
35793580 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
35803581 ALC294_FIXUP_ASUS_MIC,
35813582 ALC294_FIXUP_ASUS_HEADSET_MIC,
3583+ ALC294_FIXUP_ASUS_I2C_HEADSET_MIC,
35823584 ALC294_FIXUP_ASUS_SPK,
35833585 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
35843586 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
@@ -4889,6 +4891,15 @@ static const struct hda_fixup alc269_fixups[] = { · 1304 unmodified lines
48894891 .chained = true,
48904892 .chain_id = ALC269_FIXUP_HEADSET_MIC
48914893 },
4894+ [ALC294_FIXUP_ASUS_I2C_HEADSET_MIC] = {
4895+ .type = HDA_FIXUP_PINS,
4896+ .v.pins = (const struct hda_pintbl[]) {
4897+ { 0x19, 0x03a19020 }, /* use as headset mic */
4898+ { }
4899+ },
4900+ .chained = true,
4901+ .chain_id = ALC287_FIXUP_CS35L41_I2C_2
4902+ },
48924903 [ALC294_FIXUP_ASUS_SPK] = {
48934904 .type = HDA_FIXUP_VERBS,
48944905 .v.verbs = (const struct hda_verb[]) {
@@ -6368,6 +6379,8 @@ static const struct hda_quirk alc269_fixup_tbl[] = { · 1473 unmodified lines
63686379 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
63696380 SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
63706381 SND_PCI_QUIRK(0x103c, 0x8537, "HP ProBook 440 G6", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
6382+ SND_PCI_QUIRK(0x103c, 0x8548, "HP EliteBook x360 830 G6", ALC285_FIXUP_HP_GPIO_LED),
6383+ SND_PCI_QUIRK(0x103c, 0x854a, "HP EliteBook 830 G6", ALC285_FIXUP_HP_GPIO_LED),
63716384 SND_PCI_QUIRK(0x103c, 0x85c6, "HP Pavilion x360 Convertible 14-dy1xxx", ALC295_FIXUP_HP_MUTE_LED_COEFBIT11),
63726385 SND_PCI_QUIRK(0x103c, 0x85de, "HP Envy x360 13-ar0xxx", ALC285_FIXUP_HP_ENVY_X360),
63736386 SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
@@ -6728,7 +6741,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = { · 354 unmodified lines
67286741 SND_PCI_QUIRK(0x1043, 0x1b13, "ASUS U41SV/GA403U", ALC285_FIXUP_ASUS_GA403U_HEADSET_MIC),
67296742 SND_PCI_QUIRK(0x1043, 0x1b93, "ASUS G614JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2),
67306743 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
6731− SND_PCI_QUIRK(0x1043, 0x1c03, "ASUS UM3406HA", ALC287_FIXUP_CS35L41_I2C_2),
6744+ SND_PCI_QUIRK(0x1043, 0x1c03, "ASUS UM3406HA", ALC294_FIXUP_ASUS_I2C_HEADSET_MIC),
67326745 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
67336746 SND_PCI_QUIRK(0x1043, 0x1c33, "ASUS UX5304MA", ALC245_FIXUP_CS35L41_SPI_2),
67346747 SND_PCI_QUIRK(0x1043, 0x1c43, "ASUS UX8406MA", ALC245_FIXUP_CS35L41_SPI_2),
sound/hda/codecs/side-codecs/tas2781_hda_i2c.c+2−2
@@ -267,7 +267,7 @@ static const struct snd_kcontrol_new tas2770_snd_controls[] = { · 266 unmodified lines
267267 static const struct snd_kcontrol_new tas2781_snd_controls[] = {
268268 ACARD_SINGLE_RANGE_EXT_TLV("Speaker Analog Volume", TAS2781_AMP_LEVEL,
269269 1, 0, 20, 0, tas2781_amp_getvol,
270− tas2781_amp_putvol, amp_vol_tlv),
270+ tas2781_amp_putvol, tas2781_amp_tlv),
271271 ACARD_SINGLE_BOOL_EXT("Speaker Force Firmware Load", 0,
272272 tas2781_force_fwload_get, tas2781_force_fwload_put),
273273 };
@@ -305,7 +305,7 @@ static int tas2563_save_calibration(struct tas2781_hda *h) · 31 unmodified lines
305305 efi_char16_t efi_name[TAS2563_CAL_VAR_NAME_MAX];
306306 unsigned long max_size = TAS2563_CAL_DATA_SIZE;
307307 unsigned char var8[TAS2563_CAL_VAR_NAME_MAX];
308− struct tasdevice_priv *p = h->hda_priv;
308+ struct tasdevice_priv *p = h->priv;
309309 struct calidata *cd = &p->cali_data;
310310 struct cali_reg *r = &cd->cali_reg_array;
311311 unsigned int offset = 0;
sound/hda/codecs/side-codecs/tas2781_hda_spi.c+4−2
@@ -494,9 +494,11 @@ static int tas2781_force_fwload_put(struct snd_kcontrol *kcontrol, · 493 unmodified lines
494494
495495 static struct snd_kcontrol_new tas2781_snd_ctls[] = {
496496 ACARD_SINGLE_RANGE_EXT_TLV(NULL, TAS2781_AMP_LEVEL, 1, 0, 20, 0,
497− tas2781_amp_getvol, tas2781_amp_putvol, amp_vol_tlv),
497+ tas2781_amp_getvol, tas2781_amp_putvol,
498+ tas2781_amp_tlv),
498499 ACARD_SINGLE_RANGE_EXT_TLV(NULL, TAS2781_DVC_LVL, 0, 0, 200, 1,
499− tas2781_digital_getvol, tas2781_digital_putvol, dvc_tlv),
500+ tas2781_digital_getvol, tas2781_digital_putvol,
501+ tas2781_dvc_tlv),
500502 ACARD_SINGLE_BOOL_EXT(NULL, 0, tas2781_force_fwload_get,
501503 tas2781_force_fwload_put),
502504 };
sound/soc/codecs/cs35l56-sdw.c+0−69
@@ -393,74 +393,6 @@ static int cs35l56_sdw_update_status(struct sdw_slave *peripheral, · 392 unmodified lines
393393 return 0;
394394 }
395395
396−static int cs35l63_sdw_kick_divider(struct cs35l56_private *cs35l56,
397− struct sdw_slave *peripheral)
398−{
399− unsigned int curr_scale_reg, next_scale_reg;
400− int curr_scale, next_scale, ret;
401−
402− if (!cs35l56->base.init_done)
403− return 0;
404−
405− if (peripheral->bus->params.curr_bank) {
406− curr_scale_reg = SDW_SCP_BUSCLOCK_SCALE_B1;
407− next_scale_reg = SDW_SCP_BUSCLOCK_SCALE_B0;
408− } else {
409− curr_scale_reg = SDW_SCP_BUSCLOCK_SCALE_B0;
410− next_scale_reg = SDW_SCP_BUSCLOCK_SCALE_B1;
411− }
412−
413− /*
414− * Current clock scale value must be different to new value.
415− * Modify current to guarantee this. If next still has the dummy
416− * value we wrote when it was current, the core code has not set
417− * a new scale so restore its original good value
418− */
419− curr_scale = sdw_read_no_pm(peripheral, curr_scale_reg);
420− if (curr_scale < 0) {
421− dev_err(cs35l56->base.dev, "Failed to read current clock scale: %d\n", curr_scale);
422− return curr_scale;
423− }
424−
425− next_scale = sdw_read_no_pm(peripheral, next_scale_reg);
426− if (next_scale < 0) {
427− dev_err(cs35l56->base.dev, "Failed to read next clock scale: %d\n", next_scale);
428− return next_scale;
429− }
430−
431− if (next_scale == CS35L56_SDW_INVALID_BUS_SCALE) {
432− next_scale = cs35l56->old_sdw_clock_scale;
433− ret = sdw_write_no_pm(peripheral, next_scale_reg, next_scale);
434− if (ret < 0) {
435− dev_err(cs35l56->base.dev, "Failed to modify current clock scale: %d\n",
436− ret);
437− return ret;
438− }
439− }
440−
441− cs35l56->old_sdw_clock_scale = curr_scale;
442− ret = sdw_write_no_pm(peripheral, curr_scale_reg, CS35L56_SDW_INVALID_BUS_SCALE);
443− if (ret < 0) {
444− dev_err(cs35l56->base.dev, "Failed to modify current clock scale: %d\n", ret);
445− return ret;
446− }
447−
448− dev_dbg(cs35l56->base.dev, "Next bus scale: %#x\n", next_scale);
449−
450− return 0;
451−}
452−
453−static int cs35l56_sdw_bus_config(struct sdw_slave *peripheral,
454− struct sdw_bus_params *params)
455−{
456− struct cs35l56_private *cs35l56 = dev_get_drvdata(&peripheral->dev);
457−
458− if ((cs35l56->base.type == 0x63) && (cs35l56->base.rev < 0xa1))
459− return cs35l63_sdw_kick_divider(cs35l56, peripheral);
460−
461− return 0;
462−}
463−
464396 static int __maybe_unused cs35l56_sdw_clk_stop(struct sdw_slave *peripheral,
465397 enum sdw_clk_stop_mode mode,
466398 enum sdw_clk_stop_type type)
@@ -476,7 +408,6 @@ static const struct sdw_slave_ops cs35l56_sdw_ops = { · 9 unmodified lines
476408 .read_prop = cs35l56_sdw_read_prop,
477409 .interrupt_callback = cs35l56_sdw_interrupt,
478410 .update_status = cs35l56_sdw_update_status,
479− .bus_config = cs35l56_sdw_bus_config,
480411 #ifdef DEBUG
481412 .clk_stop = cs35l56_sdw_clk_stop,
482413 #endif
sound/soc/codecs/cs35l56-shared.c+26−3
@@ -838,6 +838,15 @@ const struct cirrus_amp_cal_controls cs35l56_calibration_controls = { · 837 unmodified lines
838838 };
839839 EXPORT_SYMBOL_NS_GPL(cs35l56_calibration_controls, "SND_SOC_CS35L56_SHARED");
840840
841+static const struct cirrus_amp_cal_controls cs35l63_calibration_controls = {
842+ .alg_id = 0xbf210,
843+ .mem_region = WMFW_ADSP2_YM,
844+ .ambient = "CAL_AMBIENT",
845+ .calr = "CAL_R",
846+ .status = "CAL_STATUS",
847+ .checksum = "CAL_CHECKSUM",
848+};
849+
841850 int cs35l56_get_calibration(struct cs35l56_base *cs35l56_base)
842851 {
843852 u64 silicon_uid = 0;
@@ -912,19 +921,31 @@ EXPORT_SYMBOL_NS_GPL(cs35l56_read_prot_status, "SND_SOC_CS35L56_SHARED"); · 68 unmodified lines
912921 void cs35l56_log_tuning(struct cs35l56_base *cs35l56_base, struct cs_dsp *cs_dsp)
913922 {
914923 __be32 pid, sid, tid;
924+ unsigned int alg_id;
915925 int ret;
916926
927+ switch (cs35l56_base->type) {
928+ case 0x54:
929+ case 0x56:
930+ case 0x57:
931+ alg_id = 0x9f212;
932+ break;
933+ default:
934+ alg_id = 0xbf212;
935+ break;
936+ }
937+
917938 scoped_guard(mutex, &cs_dsp->pwr_lock) {
918939 ret = cs_dsp_coeff_read_ctrl(cs_dsp_get_ctl(cs_dsp, "AS_PRJCT_ID",
919− WMFW_ADSP2_XM, 0x9f212),
940+ WMFW_ADSP2_XM, alg_id),
920941 0, &pid, sizeof(pid));
921942 if (!ret)
922943 ret = cs_dsp_coeff_read_ctrl(cs_dsp_get_ctl(cs_dsp, "AS_CHNNL_ID",
923− WMFW_ADSP2_XM, 0x9f212),
944+ WMFW_ADSP2_XM, alg_id),
924945 0, &sid, sizeof(sid));
925946 if (!ret)
926947 ret = cs_dsp_coeff_read_ctrl(cs_dsp_get_ctl(cs_dsp, "AS_SNPSHT_ID",
927− WMFW_ADSP2_XM, 0x9f212),
948+ WMFW_ADSP2_XM, alg_id),
928949 0, &tid, sizeof(tid));
929950 }
930951
@@ -974,8 +995,10 @@ int cs35l56_hw_init(struct cs35l56_base *cs35l56_base) · 43 unmodified lines
974995 case 0x35A54:
975996 case 0x35A56:
976997 case 0x35A57:
998+ cs35l56_base->calibration_controls = &cs35l56_calibration_controls;
977999 break;
9781000 case 0x35A630:
1001+ cs35l56_base->calibration_controls = &cs35l63_calibration_controls;
9791002 devid = devid >> 4;
9801003 break;
9811004 default:
sound/soc/codecs/cs35l56.c+1−1
@@ -695,7 +695,7 @@ static int cs35l56_write_cal(struct cs35l56_private *cs35l56) · 694 unmodified lines
695695 return ret;
696696
697697 ret = cs_amp_write_cal_coeffs(&cs35l56->dsp.cs_dsp,
698− &cs35l56_calibration_controls,
698+ cs35l56->base.calibration_controls,
699699 &cs35l56->base.cal_data);
700700
701701 wm_adsp_stop(&cs35l56->dsp);
sound/soc/codecs/cs35l56.h+0−3
@@ -20,8 +20,6 @@ · 19 unmodified lines
2020 #define CS35L56_SDW_GEN_INT_MASK_1 0xc1
2121 #define CS35L56_SDW_INT_MASK_CODEC_IRQ BIT(0)
2222
23−#define CS35L56_SDW_INVALID_BUS_SCALE 0xf
24−
2523 #define CS35L56_RX_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE)
2624 #define CS35L56_TX_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE \
2725 | SNDRV_PCM_FMTBIT_S32_LE)
@@ -52,7 +50,6 @@ struct cs35l56_private { · 24 unmodified lines
5250 u8 asp_slot_count;
5351 bool tdm_mode;
5452 bool sysclk_set;
55− u8 old_sdw_clock_scale;
5653 u8 sdw_link_num;
5754 u8 sdw_unique_id;
5855 };
sound/soc/codecs/es8389.c+1−1
@@ -636,7 +636,7 @@ static int es8389_set_bias_level(struct snd_soc_component *component, · 635 unmodified lines
636636 regmap_write(es8389->regmap, ES8389_ANA_CTL1, 0x59);
637637 regmap_write(es8389->regmap, ES8389_ADC_EN, 0x00);
638638 regmap_write(es8389->regmap, ES8389_CLK_OFF1, 0x00);
639− regmap_write(es8389->regmap, ES8389_RESET, 0x7E);
639+ regmap_write(es8389->regmap, ES8389_RESET, 0x3E);
640640 regmap_update_bits(es8389->regmap, ES8389_DAC_INV, 0x80, 0x80);
641641 usleep_range(8000, 8500);
642642 regmap_update_bits(es8389->regmap, ES8389_DAC_INV, 0x80, 0x00);
sound/soc/codecs/tas2781-i2c.c+2−2
@@ -910,10 +910,10 @@ static const struct snd_kcontrol_new tasdevice_cali_controls[] = { · 909 unmodified lines
910910 static const struct snd_kcontrol_new tas2781_snd_controls[] = {
911911 SOC_SINGLE_RANGE_EXT_TLV("Speaker Analog Volume", TAS2781_AMP_LEVEL,
912912 1, 0, 20, 0, tas2781_amp_getvol,
913− tas2781_amp_putvol, amp_vol_tlv),
913+ tas2781_amp_putvol, tas2781_amp_tlv),
914914 SOC_SINGLE_RANGE_EXT_TLV("Speaker Digital Volume", TAS2781_DVC_LVL,
915915 0, 0, 200, 1, tas2781_digital_getvol,
916− tas2781_digital_putvol, dvc_tlv),
916+ tas2781_digital_putvol, tas2781_dvc_tlv),
917917 };
918918
919919 static const struct snd_kcontrol_new tas2781_cali_controls[] = {
sound/usb/stream.c+1−1
@@ -349,7 +349,7 @@ snd_pcm_chmap_elem *convert_chmap_v3(struct uac3_cluster_header_descriptor · 348 unmodified lines
349349 u16 cs_len;
350350 u8 cs_type;
351351
352− if (len < sizeof(*p))
352+ if (len < sizeof(*cs_desc))
353353 break;
354354 cs_len = le16_to_cpu(cs_desc->wLength);
355355 if (len < cs_len)
sound/usb/validate.c+1−1
@@ -285,7 +285,7 @@ static const struct usb_desc_validator audio_validators[] = { · 284 unmodified lines
285285 /* UAC_VERSION_3, UAC3_EXTENDED_TERMINAL: not implemented yet */
286286 FUNC(UAC_VERSION_3, UAC3_MIXER_UNIT, validate_mixer_unit),
287287 FUNC(UAC_VERSION_3, UAC3_SELECTOR_UNIT, validate_selector_unit),
288− FUNC(UAC_VERSION_3, UAC_FEATURE_UNIT, validate_uac3_feature_unit),
288+ FUNC(UAC_VERSION_3, UAC3_FEATURE_UNIT, validate_uac3_feature_unit),
289289 /* UAC_VERSION_3, UAC3_EFFECT_UNIT: not implemented yet */
290290 FUNC(UAC_VERSION_3, UAC3_PROCESSING_UNIT, validate_processing_unit),
291291 FUNC(UAC_VERSION_3, UAC3_EXTENSION_UNIT, validate_processing_unit),
tools/arch/arm64/include/asm/cputype.h+28−0
@@ -75,11 +75,13 @@ · 74 unmodified lines
7575 #define ARM_CPU_PART_CORTEX_A76 0xD0B
7676 #define ARM_CPU_PART_NEOVERSE_N1 0xD0C
7777 #define ARM_CPU_PART_CORTEX_A77 0xD0D
78+#define ARM_CPU_PART_CORTEX_A76AE 0xD0E
7879 #define ARM_CPU_PART_NEOVERSE_V1 0xD40
7980 #define ARM_CPU_PART_CORTEX_A78 0xD41
8081 #define ARM_CPU_PART_CORTEX_A78AE 0xD42
8182 #define ARM_CPU_PART_CORTEX_X1 0xD44
8283 #define ARM_CPU_PART_CORTEX_A510 0xD46
84+#define ARM_CPU_PART_CORTEX_X1C 0xD4C
8385 #define ARM_CPU_PART_CORTEX_A520 0xD80
8486 #define ARM_CPU_PART_CORTEX_A710 0xD47
8587 #define ARM_CPU_PART_CORTEX_A715 0xD4D
@@ -119,9 +121,11 @@ · 33 unmodified lines
119121 #define QCOM_CPU_PART_KRYO 0x200
120122 #define QCOM_CPU_PART_KRYO_2XX_GOLD 0x800
121123 #define QCOM_CPU_PART_KRYO_2XX_SILVER 0x801
124+#define QCOM_CPU_PART_KRYO_3XX_GOLD 0x802
122125 #define QCOM_CPU_PART_KRYO_3XX_SILVER 0x803
123126 #define QCOM_CPU_PART_KRYO_4XX_GOLD 0x804
124127 #define QCOM_CPU_PART_KRYO_4XX_SILVER 0x805
128+#define QCOM_CPU_PART_ORYON_X1 0x001
125129
126130 #define NVIDIA_CPU_PART_DENVER 0x003
127131 #define NVIDIA_CPU_PART_CARMEL 0x004
@@ -129,6 +133,7 @@ · 1 unmodified line
129133 #define FUJITSU_CPU_PART_A64FX 0x001
130134
131135 #define HISI_CPU_PART_TSV110 0xD01
136+#define HISI_CPU_PART_HIP09 0xD02
132137 #define HISI_CPU_PART_HIP12 0xD06
133138
134139 #define APPLE_CPU_PART_M1_ICESTORM 0x022
@@ -159,11 +164,13 @@ · 24 unmodified lines
159164 #define MIDR_CORTEX_A76 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A76)
160165 #define MIDR_NEOVERSE_N1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_N1)
161166 #define MIDR_CORTEX_A77 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A77)
167+#define MIDR_CORTEX_A76AE MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A76AE)
162168 #define MIDR_NEOVERSE_V1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_V1)
163169 #define MIDR_CORTEX_A78 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A78)
164170 #define MIDR_CORTEX_A78AE MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A78AE)
165171 #define MIDR_CORTEX_X1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X1)
166172 #define MIDR_CORTEX_A510 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A510)
173+#define MIDR_CORTEX_X1C MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X1C)
167174 #define MIDR_CORTEX_A520 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A520)
168175 #define MIDR_CORTEX_A710 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A710)
169176 #define MIDR_CORTEX_A715 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A715)
@@ -196,13 +203,26 @@ · 26 unmodified lines
196203 #define MIDR_QCOM_KRYO MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO)
197204 #define MIDR_QCOM_KRYO_2XX_GOLD MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_2XX_GOLD)
198205 #define MIDR_QCOM_KRYO_2XX_SILVER MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_2XX_SILVER)
206+#define MIDR_QCOM_KRYO_3XX_GOLD MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_3XX_GOLD)
199207 #define MIDR_QCOM_KRYO_3XX_SILVER MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_3XX_SILVER)
200208 #define MIDR_QCOM_KRYO_4XX_GOLD MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_4XX_GOLD)
201209 #define MIDR_QCOM_KRYO_4XX_SILVER MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_4XX_SILVER)
210+#define MIDR_QCOM_ORYON_X1 MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_ORYON_X1)
211+
212+/*
213+ * NOTES:
214+ * - Qualcomm Kryo 5XX Prime / Gold ID themselves as MIDR_CORTEX_A77
215+ * - Qualcomm Kryo 5XX Silver IDs itself as MIDR_QCOM_KRYO_4XX_SILVER
216+ * - Qualcomm Kryo 6XX Prime IDs itself as MIDR_CORTEX_X1
217+ * - Qualcomm Kryo 6XX Gold IDs itself as ARM_CPU_PART_CORTEX_A78
218+ * - Qualcomm Kryo 6XX Silver IDs itself as MIDR_CORTEX_A55
219+ */
220+
202221 #define MIDR_NVIDIA_DENVER MIDR_CPU_MODEL(ARM_CPU_IMP_NVIDIA, NVIDIA_CPU_PART_DENVER)
203222 #define MIDR_NVIDIA_CARMEL MIDR_CPU_MODEL(ARM_CPU_IMP_NVIDIA, NVIDIA_CPU_PART_CARMEL)
204223 #define MIDR_FUJITSU_A64FX MIDR_CPU_MODEL(ARM_CPU_IMP_FUJITSU, FUJITSU_CPU_PART_A64FX)
205224 #define MIDR_HISI_TSV110 MIDR_CPU_MODEL(ARM_CPU_IMP_HISI, HISI_CPU_PART_TSV110)
225+#define MIDR_HISI_HIP09 MIDR_CPU_MODEL(ARM_CPU_IMP_HISI, HISI_CPU_PART_HIP09)
206226 #define MIDR_HISI_HIP12 MIDR_CPU_MODEL(ARM_CPU_IMP_HISI, HISI_CPU_PART_HIP12)
207227 #define MIDR_APPLE_M1_ICESTORM MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_ICESTORM)
208228 #define MIDR_APPLE_M1_FIRESTORM MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_FIRESTORM)
@@ -291,6 +311,14 @@ static inline u32 __attribute_const__ read_cpuid_id(void) · 82 unmodified lines
291311 return read_cpuid(MIDR_EL1);
292312 }
293313
314+struct target_impl_cpu {
315+ u64 midr;
316+ u64 revidr;
317+ u64 aidr;
318+};
319+
320+bool cpu_errata_set_target_impl(u64 num, void *impl_cpus);
321+
294322 static inline u64 __attribute_const__ read_cpuid_mpidr(void)
295323 {
296324 return read_cpuid(MPIDR_EL1);
tools/arch/powerpc/include/uapi/asm/kvm.h+0−13
@@ -1,18 +1,5 @@
11 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
22 /*
3− * This program is free software; you can redistribute it and/or modify
4− * it under the terms of the GNU General Public License, version 2, as
5− * published by the Free Software Foundation.
6− *
7− * This program is distributed in the hope that it will be useful,
8− * but WITHOUT ANY WARRANTY; without even the implied warranty of
9− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10− * GNU General Public License for more details.
11− *
12− * You should have received a copy of the GNU General Public License
13− * along with this program; if not, write to the Free Software
14− * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15− *
163 * Copyright IBM Corp. 2007
174 *
185 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
tools/arch/x86/include/asm/cpufeatures.h+9−1
@@ -218,6 +218,7 @@ · 217 unmodified lines
218218 #define X86_FEATURE_FLEXPRIORITY ( 8*32+ 1) /* "flexpriority" Intel FlexPriority */
219219 #define X86_FEATURE_EPT ( 8*32+ 2) /* "ept" Intel Extended Page Table */
220220 #define X86_FEATURE_VPID ( 8*32+ 3) /* "vpid" Intel Virtual Processor ID */
221+#define X86_FEATURE_COHERENCY_SFW_NO ( 8*32+ 4) /* SNP cache coherency software work around not needed */
221222
222223 #define X86_FEATURE_VMMCALL ( 8*32+15) /* "vmmcall" Prefer VMMCALL to VMCALL */
223224 #define X86_FEATURE_XENPV ( 8*32+16) /* Xen paravirtual guest */
@@ -456,10 +457,14 @@ · 232 unmodified lines
456457 #define X86_FEATURE_NO_NESTED_DATA_BP (20*32+ 0) /* No Nested Data Breakpoints */
457458 #define X86_FEATURE_WRMSR_XX_BASE_NS (20*32+ 1) /* WRMSR to {FS,GS,KERNEL_GS}_BASE is non-serializing */
458459 #define X86_FEATURE_LFENCE_RDTSC (20*32+ 2) /* LFENCE always serializing / synchronizes RDTSC */
460+#define X86_FEATURE_VERW_CLEAR (20*32+ 5) /* The memory form of VERW mitigates TSA */
459461 #define X86_FEATURE_NULL_SEL_CLR_BASE (20*32+ 6) /* Null Selector Clears Base */
462+
460463 #define X86_FEATURE_AUTOIBRS (20*32+ 8) /* Automatic IBRS */
461464 #define X86_FEATURE_NO_SMM_CTL_MSR (20*32+ 9) /* SMM_CTL MSR is not present */
462465
466+#define X86_FEATURE_GP_ON_USER_CPUID (20*32+17) /* User CPUID faulting */
467+
463468 #define X86_FEATURE_PREFETCHI (20*32+20) /* Prefetch Data/Instruction to Cache Level */
464469 #define X86_FEATURE_SBPB (20*32+27) /* Selective Branch Prediction Barrier */
465470 #define X86_FEATURE_IBPB_BRTYPE (20*32+28) /* MSR_PRED_CMD[IBPB] flushes all branch type predictions */
@@ -487,6 +492,9 @@ · 21 unmodified lines
487492 #define X86_FEATURE_PREFER_YMM (21*32+ 8) /* Avoid ZMM registers due to downclocking */
488493 #define X86_FEATURE_APX (21*32+ 9) /* Advanced Performance Extensions */
489494 #define X86_FEATURE_INDIRECT_THUNK_ITS (21*32+10) /* Use thunk for indirect branches in lower half of cacheline */
495+#define X86_FEATURE_TSA_SQ_NO (21*32+11) /* AMD CPU not vulnerable to TSA-SQ */
496+#define X86_FEATURE_TSA_L1_NO (21*32+12) /* AMD CPU not vulnerable to TSA-L1 */
497+#define X86_FEATURE_CLEAR_CPU_BUF_VM (21*32+13) /* Clear CPU buffers using VERW before VMRUN */
490498
491499 /*
492500 * BUG word(s)
@@ -542,5 +550,5 @@ · 49 unmodified lines
542550 #define X86_BUG_OLD_MICROCODE X86_BUG( 1*32+ 6) /* "old_microcode" CPU has old microcode, it is surely vulnerable to something */
543551 #define X86_BUG_ITS X86_BUG( 1*32+ 7) /* "its" CPU is affected by Indirect Target Selection */
544552 #define X86_BUG_ITS_NATIVE_ONLY X86_BUG( 1*32+ 8) /* "its_native_only" CPU is affected by ITS, VMX is not affected */
545−
553+#define X86_BUG_TSA X86_BUG( 1*32+ 9) /* "tsa" CPU is affected by Transient Scheduler Attacks */
546554 #endif /* _ASM_X86_CPUFEATURES_H */
tools/arch/x86/include/asm/msr-index.h+7−0
@@ -419,6 +419,7 @@ · 418 unmodified lines
419419 #define DEBUGCTLMSR_FREEZE_PERFMON_ON_PMI (1UL << 12)
420420 #define DEBUGCTLMSR_FREEZE_IN_SMM_BIT 14
421421 #define DEBUGCTLMSR_FREEZE_IN_SMM (1UL << DEBUGCTLMSR_FREEZE_IN_SMM_BIT)
422+#define DEBUGCTLMSR_RTM_DEBUG BIT(15)
422423
423424 #define MSR_PEBS_FRONTEND 0x000003f7
424425
@@ -733,6 +734,11 @@ · 308 unmodified lines
733734 #define MSR_AMD64_PERF_CNTR_GLOBAL_CTL 0xc0000301
734735 #define MSR_AMD64_PERF_CNTR_GLOBAL_STATUS_CLR 0xc0000302
735736
737+/* AMD Hardware Feedback Support MSRs */
738+#define MSR_AMD_WORKLOAD_CLASS_CONFIG 0xc0000500
739+#define MSR_AMD_WORKLOAD_CLASS_ID 0xc0000501
740+#define MSR_AMD_WORKLOAD_HRST 0xc0000502
741+
736742 /* AMD Last Branch Record MSRs */
737743 #define MSR_AMD64_LBR_SELECT 0xc000010e
738744
@@ -831,6 +837,7 @@ · 92 unmodified lines
831837 #define MSR_K7_HWCR_SMMLOCK BIT_ULL(MSR_K7_HWCR_SMMLOCK_BIT)
832838 #define MSR_K7_HWCR_IRPERF_EN_BIT 30
833839 #define MSR_K7_HWCR_IRPERF_EN BIT_ULL(MSR_K7_HWCR_IRPERF_EN_BIT)
840+#define MSR_K7_HWCR_CPUID_USER_DIS_BIT 35
834841 #define MSR_K7_FID_VID_CTL 0xc0010041
835842 #define MSR_K7_FID_VID_STATUS 0xc0010042
836843 #define MSR_K7_HWCR_CPB_DIS_BIT 25
tools/arch/x86/include/uapi/asm/kvm.h+7−1
@@ -965,7 +965,13 @@ struct kvm_tdx_cmd { · 964 unmodified lines
965965 struct kvm_tdx_capabilities {
966966 __u64 supported_attrs;
967967 __u64 supported_xfam;
968− __u64 reserved[254];
968+
969+ __u64 kernel_tdvmcallinfo_1_r11;
970+ __u64 user_tdvmcallinfo_1_r11;
971+ __u64 kernel_tdvmcallinfo_1_r12;
972+ __u64 user_tdvmcallinfo_1_r12;
973+
974+ __u64 reserved[250];
969975
970976 /* Configurable CPUID bits for userspace */
971977 struct kvm_cpuid2 cpuid;
tools/include/linux/args.h+28−0
@@ -0,0 +1,28 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+
3+#ifndef _LINUX_ARGS_H
4+#define _LINUX_ARGS_H
5+
6+/*
7+ * How do these macros work?
8+ *
9+ * In __COUNT_ARGS() _0 to _12 are just placeholders from the start
10+ * in order to make sure _n is positioned over the correct number
11+ * from 12 to 0 (depending on X, which is a variadic argument list).
12+ * They serve no purpose other than occupying a position. Since each
13+ * macro parameter must have a distinct identifier, those identifiers
14+ * are as good as any.
15+ *
16+ * In COUNT_ARGS() we use actual integers, so __COUNT_ARGS() returns
17+ * that as _n.
18+ */
19+
20+/* This counts to 15. Any more, it will return 16th argument. */
21+#define __COUNT_ARGS(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _n, X...) _n
22+#define COUNT_ARGS(X...) __COUNT_ARGS(, ##X, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
23+
24+/* Concatenate two parameters, but allow them to be expanded beforehand. */
25+#define __CONCAT(a, b) a ## b
26+#define CONCATENATE(a, b) __CONCAT(a, b)
27+
28+#endif /* _LINUX_ARGS_H */
tools/include/linux/bits.h+6−23
@@ -2,10 +2,8 @@ · 1 unmodified line
22 #ifndef __LINUX_BITS_H
33 #define __LINUX_BITS_H
44
5−#include <linux/const.h>
65 #include <vdso/bits.h>
76 #include <uapi/linux/bits.h>
8−#include <asm/bitsperlong.h>
97
108 #define BIT_MASK(nr) (UL(1) << ((nr) % BITS_PER_LONG))
119 #define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
@@ -50,10 +48,14 @@ · 38 unmodified lines
5048 (type_max(t) << (l) & \
5149 type_max(t) >> (BITS_PER_TYPE(t) - 1 - (h)))))
5250
51+#define GENMASK(h, l) GENMASK_TYPE(unsigned long, h, l)
52+#define GENMASK_ULL(h, l) GENMASK_TYPE(unsigned long long, h, l)
53+
5354 #define GENMASK_U8(h, l) GENMASK_TYPE(u8, h, l)
5455 #define GENMASK_U16(h, l) GENMASK_TYPE(u16, h, l)
5556 #define GENMASK_U32(h, l) GENMASK_TYPE(u32, h, l)
5657 #define GENMASK_U64(h, l) GENMASK_TYPE(u64, h, l)
58+#define GENMASK_U128(h, l) GENMASK_TYPE(u128, h, l)
5759
5860 /*
5961 * Fixed-type variants of BIT(), with additional checks like GENMASK_TYPE(). The
@@ -79,28 +81,9 @@ · 19 unmodified lines
7981 * BUILD_BUG_ON_ZERO is not available in h files included from asm files,
8082 * disable the input check if that is the case.
8183 */
82−#define GENMASK_INPUT_CHECK(h, l) 0
84+#define GENMASK(h, l) __GENMASK(h, l)
85+#define GENMASK_ULL(h, l) __GENMASK_ULL(h, l)
8386
8487 #endif /* !defined(__ASSEMBLY__) */
8588
86−#define GENMASK(h, l) \
87− (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
88−#define GENMASK_ULL(h, l) \
89− (GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l))
90−
91−#if !defined(__ASSEMBLY__)
92−/*
93− * Missing asm support
94− *
95− * __GENMASK_U128() depends on _BIT128() which would not work
96− * in the asm code, as it shifts an 'unsigned __int128' data
97− * type instead of direct representation of 128 bit constants
98− * such as long and unsigned long. The fundamental problem is
99− * that a 128 bit constant will get silently truncated by the
100− * gcc compiler.
101− */
102−#define GENMASK_U128(h, l) \
103− (GENMASK_INPUT_CHECK(h, l) + __GENMASK_U128(h, l))
104−#endif
105−
10689 #endif /* __LINUX_BITS_H */
tools/include/linux/cfi_types.h+23−0
@@ -41,5 +41,28 @@ · 40 unmodified lines
4141 SYM_TYPED_START(name, SYM_L_GLOBAL, SYM_A_ALIGN)
4242 #endif
4343
44+#else /* __ASSEMBLY__ */
45+
46+#ifdef CONFIG_CFI_CLANG
47+#define DEFINE_CFI_TYPE(name, func) \
48+ /* \
49+ * Force a reference to the function so the compiler generates \
50+ * __kcfi_typeid_<func>. \
51+ */ \
52+ __ADDRESSABLE(func); \
53+ /* u32 name __ro_after_init = __kcfi_typeid_<func> */ \
54+ extern u32 name; \
55+ asm ( \
56+ " .pushsection .data..ro_after_init,\"aw\",\%progbits \n" \
57+ " .type " #name ",\%object \n" \
58+ " .globl " #name " \n" \
59+ " .p2align 2, 0x0 \n" \
60+ #name ": \n" \
61+ " .4byte __kcfi_typeid_" #func " \n" \
62+ " .size " #name ", 4 \n" \
63+ " .popsection \n" \
64+ );
65+#endif
66+
4467 #endif /* __ASSEMBLY__ */
4568 #endif /* _LINUX_CFI_TYPES_H */
tools/include/uapi/asm-generic/unistd.h+7−1
@@ -852,8 +852,14 @@ __SYSCALL(__NR_removexattrat, sys_removexattrat) · 851 unmodified lines
852852 #define __NR_open_tree_attr 467
853853 __SYSCALL(__NR_open_tree_attr, sys_open_tree_attr)
854854
855+/* fs/inode.c */
856+#define __NR_file_getattr 468
857+__SYSCALL(__NR_file_getattr, sys_file_getattr)
858+#define __NR_file_setattr 469
859+__SYSCALL(__NR_file_setattr, sys_file_setattr)
860+
855861 #undef __NR_syscalls
856−#define __NR_syscalls 468
862+#define __NR_syscalls 470
857863
858864 /*
859865 * 32 bit systems traditionally used different
tools/include/uapi/linux/kvm.h+27−0
@@ -178,6 +178,7 @@ struct kvm_xen_exit { · 177 unmodified lines
178178 #define KVM_EXIT_NOTIFY 37
179179 #define KVM_EXIT_LOONGARCH_IOCSR 38
180180 #define KVM_EXIT_MEMORY_FAULT 39
181+#define KVM_EXIT_TDX 40
181182
182183 /* For KVM_EXIT_INTERNAL_ERROR */
183184 /* Emulate instruction failed. */
@@ -447,6 +448,31 @@ struct kvm_run { · 263 unmodified lines
447448 __u64 gpa;
448449 __u64 size;
449450 } memory_fault;
451+ /* KVM_EXIT_TDX */
452+ struct {
453+ __u64 flags;
454+ __u64 nr;
455+ union {
456+ struct {
457+ __u64 ret;
458+ __u64 data[5];
459+ } unknown;
460+ struct {
461+ __u64 ret;
462+ __u64 gpa;
463+ __u64 size;
464+ } get_quote;
465+ struct {
466+ __u64 ret;
467+ __u64 leaf;
468+ __u64 r11, r12, r13, r14;
469+ } get_tdvmcall_info;
470+ struct {
471+ __u64 ret;
472+ __u64 vector;
473+ } setup_event_notify;
474+ };
475+ } tdx;
450476 /* Fix the size of the union. */
451477 char padding[256];
452478 };
@@ -935,6 +961,7 @@ struct kvm_enable_cap { · 482 unmodified lines
935961 #define KVM_CAP_ARM_EL2 240
936962 #define KVM_CAP_ARM_EL2_E2H0 241
937963 #define KVM_CAP_RISCV_MP_STATE_RESET 242
964+#define KVM_CAP_ARM_CACHEABLE_PFNMAP_SUPPORTED 243
938965
939966 struct kvm_irq_routing_irqchip {
940967 __u32 irqchip;
tools/perf/arch/arm/entry/syscalls/syscall.tbl+2−0
@@ -482,3 +482,5 @@ · 481 unmodified lines
482482 465 common listxattrat sys_listxattrat
483483 466 common removexattrat sys_removexattrat
484484 467 common open_tree_attr sys_open_tree_attr
485+468 common file_getattr sys_file_getattr
486+469 common file_setattr sys_file_setattr
tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl+2−0
@@ -382,3 +382,5 @@ · 381 unmodified lines
382382 465 n64 listxattrat sys_listxattrat
383383 466 n64 removexattrat sys_removexattrat
384384 467 n64 open_tree_attr sys_open_tree_attr
385+468 n64 file_getattr sys_file_getattr
386+469 n64 file_setattr sys_file_setattr
tools/perf/arch/powerpc/entry/syscalls/syscall.tbl+2−0
@@ -558,3 +558,5 @@ · 557 unmodified lines
558558 465 common listxattrat sys_listxattrat
559559 466 common removexattrat sys_removexattrat
560560 467 common open_tree_attr sys_open_tree_attr
561+468 common file_getattr sys_file_getattr
562+469 common file_setattr sys_file_setattr
tools/perf/arch/s390/entry/syscalls/syscall.tbl+2−0
@@ -470,3 +470,5 @@ · 469 unmodified lines
470470 465 common listxattrat sys_listxattrat sys_listxattrat
471471 466 common removexattrat sys_removexattrat sys_removexattrat
472472 467 common open_tree_attr sys_open_tree_attr sys_open_tree_attr
473+468 common file_getattr sys_file_getattr sys_file_getattr
474+469 common file_setattr sys_file_setattr sys_file_setattr
tools/perf/arch/sh/entry/syscalls/syscall.tbl+2−0
@@ -471,3 +471,5 @@ · 470 unmodified lines
471471 465 common listxattrat sys_listxattrat
472472 466 common removexattrat sys_removexattrat
473473 467 common open_tree_attr sys_open_tree_attr
474+468 common file_getattr sys_file_getattr
475+469 common file_setattr sys_file_setattr
tools/perf/arch/sparc/entry/syscalls/syscall.tbl+2−0
@@ -513,3 +513,5 @@ · 512 unmodified lines
513513 465 common listxattrat sys_listxattrat
514514 466 common removexattrat sys_removexattrat
515515 467 common open_tree_attr sys_open_tree_attr
516+468 common file_getattr sys_file_getattr
517+469 common file_setattr sys_file_setattr
tools/perf/arch/x86/entry/syscalls/syscall_32.tbl+2−0
@@ -473,3 +473,5 @@ · 472 unmodified lines
473473 465 i386 listxattrat sys_listxattrat
474474 466 i386 removexattrat sys_removexattrat
475475 467 i386 open_tree_attr sys_open_tree_attr
476+468 i386 file_getattr sys_file_getattr
477+469 i386 file_setattr sys_file_setattr
tools/perf/arch/x86/entry/syscalls/syscall_64.tbl+2−0
@@ -391,6 +391,8 @@ · 390 unmodified lines
391391 465 common listxattrat sys_listxattrat
392392 466 common removexattrat sys_removexattrat
393393 467 common open_tree_attr sys_open_tree_attr
394+468 common file_getattr sys_file_getattr
395+469 common file_setattr sys_file_setattr
394396
395397 #
396398 # Due to a historical design error, certain syscalls are numbered differently
tools/perf/arch/x86/tests/topdown.c+1−0
@@ -1,6 +1,7 @@
11 // SPDX-License-Identifier: GPL-2.0
22 #include "arch-tests.h"
33 #include "../util/topdown.h"
4+#include "debug.h"
45 #include "evlist.h"
56 #include "parse-events.h"
67 #include "pmu.h"
tools/perf/arch/xtensa/entry/syscalls/syscall.tbl+2−0
@@ -438,3 +438,5 @@ · 437 unmodified lines
438438 465 common listxattrat sys_listxattrat
439439 466 common removexattrat sys_removexattrat
440440 467 common open_tree_attr sys_open_tree_attr
441+468 common file_getattr sys_file_getattr
442+469 common file_setattr sys_file_setattr
tools/perf/bench/inject-buildid.c+1−1
@@ -85,7 +85,7 @@ static int add_dso(const char *fpath, const struct stat *sb __maybe_unused, · 84 unmodified lines
8585 if (typeflag == FTW_D || typeflag == FTW_SL)
8686 return 0;
8787
88− if (filename__read_build_id(fpath, &bid) < 0)
88+ if (filename__read_build_id(fpath, &bid, /*block=*/true) < 0)
8989 return 0;
9090
9191 dso->name = realpath(fpath, NULL);
tools/perf/builtin-buildid-cache.c+4−4
@@ -180,7 +180,7 @@ static int build_id_cache__add_file(const char *filename, struct nsinfo *nsi) · 179 unmodified lines
180180 struct nscookie nsc;
181181
182182 nsinfo__mountns_enter(nsi, &nsc);
183− err = filename__read_build_id(filename, &bid);
183+ err = filename__read_build_id(filename, &bid, /*block=*/true);
184184 nsinfo__mountns_exit(&nsc);
185185 if (err < 0) {
186186 pr_debug("Couldn't read a build-id in %s\n", filename);
@@ -204,7 +204,7 @@ static int build_id_cache__remove_file(const char *filename, struct nsinfo *nsi) · 17 unmodified lines
204204 int err;
205205
206206 nsinfo__mountns_enter(nsi, &nsc);
207− err = filename__read_build_id(filename, &bid);
207+ err = filename__read_build_id(filename, &bid, /*block=*/true);
208208 nsinfo__mountns_exit(&nsc);
209209 if (err < 0) {
210210 pr_debug("Couldn't read a build-id in %s\n", filename);
@@ -280,7 +280,7 @@ static bool dso__missing_buildid_cache(struct dso *dso, int parm __maybe_unused) · 69 unmodified lines
280280 if (!dso__build_id_filename(dso, filename, sizeof(filename), false))
281281 return true;
282282
283− if (filename__read_build_id(filename, &bid) == -1) {
283+ if (filename__read_build_id(filename, &bid, /*block=*/true) == -1) {
284284 if (errno == ENOENT)
285285 return false;
286286
@@ -309,7 +309,7 @@ static int build_id_cache__update_file(const char *filename, struct nsinfo *nsi) · 22 unmodified lines
309309 int err;
310310
311311 nsinfo__mountns_enter(nsi, &nsc);
312− err = filename__read_build_id(filename, &bid);
312+ err = filename__read_build_id(filename, &bid, /*block=*/true);
313313 nsinfo__mountns_exit(&nsc);
314314 if (err < 0) {
315315 pr_debug("Couldn't read a build-id in %s\n", filename);
tools/perf/builtin-inject.c+2−2
@@ -680,12 +680,12 @@ static int dso__read_build_id(struct dso *dso) · 679 unmodified lines
680680
681681 mutex_lock(dso__lock(dso));
682682 nsinfo__mountns_enter(dso__nsinfo(dso), &nsc);
683− if (filename__read_build_id(dso__long_name(dso), &bid) > 0)
683+ if (filename__read_build_id(dso__long_name(dso), &bid, /*block=*/true) > 0)
684684 dso__set_build_id(dso, &bid);
685685 else if (dso__nsinfo(dso)) {
686686 char *new_name = dso__filename_with_chroot(dso, dso__long_name(dso));
687687
688− if (new_name && filename__read_build_id(new_name, &bid) > 0)
688+ if (new_name && filename__read_build_id(new_name, &bid, /*block=*/true) > 0)
689689 dso__set_build_id(dso, &bid);
690690 free(new_name);
691691 }
tools/perf/tests/sdt.c+1−1
@@ -31,7 +31,7 @@ static int build_id_cache__add_file(const char *filename) · 30 unmodified lines
3131 struct build_id bid = { .size = 0, };
3232 int err;
3333
34− err = filename__read_build_id(filename, &bid);
34+ err = filename__read_build_id(filename, &bid, /*block=*/true);
3535 if (err < 0) {
3636 pr_debug("Failed to read build id of %s\n", filename);
3737 return err;
tools/perf/trace/beauty/include/uapi/linux/fcntl.h+18−0
@@ -90,10 +90,28 @@ · 89 unmodified lines
9090 #define DN_ATTRIB 0x00000020 /* File changed attibutes */
9191 #define DN_MULTISHOT 0x80000000 /* Don't remove notifier */
9292
93+/* Reserved kernel ranges [-100], [-10000, -40000]. */
9394 #define AT_FDCWD -100 /* Special value for dirfd used to
9495 indicate openat should use the
9596 current working directory. */
9697
98+/*
99+ * The concept of process and threads in userland and the kernel is a confusing
100+ * one - within the kernel every thread is a 'task' with its own individual PID,
101+ * however from userland's point of view threads are grouped by a single PID,
102+ * which is that of the 'thread group leader', typically the first thread
103+ * spawned.
104+ *
105+ * To cut the Gideon knot, for internal kernel usage, we refer to
106+ * PIDFD_SELF_THREAD to refer to the current thread (or task from a kernel
107+ * perspective), and PIDFD_SELF_THREAD_GROUP to refer to the current thread
108+ * group leader...
109+ */
110+#define PIDFD_SELF_THREAD -10000 /* Current thread. */
111+#define PIDFD_SELF_THREAD_GROUP -10001 /* Current thread group leader. */
112+
113+#define FD_PIDFS_ROOT -10002 /* Root of the pidfs filesystem */
114+#define FD_INVALID -10009 /* Invalid file descriptor: -10000 - EBADF = -10009 */
97115
98116 /* Generic flags for the *at(2) family of syscalls. */
99117
tools/perf/trace/beauty/include/uapi/linux/fs.h+88−0
@@ -60,6 +60,17 @@ · 59 unmodified lines
6060 #define RENAME_EXCHANGE (1 << 1) /* Exchange source and dest */
6161 #define RENAME_WHITEOUT (1 << 2) /* Whiteout source */
6262
63+/*
64+ * The root inode of procfs is guaranteed to always have the same inode number.
65+ * For programs that make heavy use of procfs, verifying that the root is a
66+ * real procfs root and using openat2(RESOLVE_{NO_{XDEV,MAGICLINKS},BENEATH})
67+ * will allow you to make sure you are never tricked into operating on the
68+ * wrong procfs file.
69+ */
70+enum procfs_ino {
71+ PROCFS_ROOT_INO = 1,
72+};
73+
6374 struct file_clone_range {
6475 __s64 src_fd;
6576 __u64 src_offset;
@@ -91,6 +102,63 @@ struct fs_sysfs_path { · 25 unmodified lines
91102 __u8 name[128];
92103 };
93104
105+/* Protection info capability flags */
106+#define LBMD_PI_CAP_INTEGRITY (1 << 0)
107+#define LBMD_PI_CAP_REFTAG (1 << 1)
108+
109+/* Checksum types for Protection Information */
110+#define LBMD_PI_CSUM_NONE 0
111+#define LBMD_PI_CSUM_IP 1
112+#define LBMD_PI_CSUM_CRC16_T10DIF 2
113+#define LBMD_PI_CSUM_CRC64_NVME 4
114+
115+/* sizeof first published struct */
116+#define LBMD_SIZE_VER0 16
117+
118+/*
119+ * Logical block metadata capability descriptor
120+ * If the device does not support metadata, all the fields will be zero.
121+ * Applications must check lbmd_flags to determine whether metadata is
122+ * supported or not.
123+ */
124+struct logical_block_metadata_cap {
125+ /* Bitmask of logical block metadata capability flags */
126+ __u32 lbmd_flags;
127+ /*
128+ * The amount of data described by each unit of logical block
129+ * metadata
130+ */
131+ __u16 lbmd_interval;
132+ /*
133+ * Size in bytes of the logical block metadata associated with each
134+ * interval
135+ */
136+ __u8 lbmd_size;
137+ /*
138+ * Size in bytes of the opaque block tag associated with each
139+ * interval
140+ */
141+ __u8 lbmd_opaque_size;
142+ /*
143+ * Offset in bytes of the opaque block tag within the logical block
144+ * metadata
145+ */
146+ __u8 lbmd_opaque_offset;
147+ /* Size in bytes of the T10 PI tuple associated with each interval */
148+ __u8 lbmd_pi_size;
149+ /* Offset in bytes of T10 PI tuple within the logical block metadata */
150+ __u8 lbmd_pi_offset;
151+ /* T10 PI guard tag type */
152+ __u8 lbmd_guard_tag_type;
153+ /* Size in bytes of the T10 PI application tag */
154+ __u8 lbmd_app_tag_size;
155+ /* Size in bytes of the T10 PI reference tag */
156+ __u8 lbmd_ref_tag_size;
157+ /* Size in bytes of the T10 PI storage tag */
158+ __u8 lbmd_storage_tag_size;
159+ __u8 pad;
160+};
161+
94162 /* extent-same (dedupe) ioctls; these MUST match the btrfs ioctl definitions */
95163 #define FILE_DEDUPE_RANGE_SAME 0
96164 #define FILE_DEDUPE_RANGE_DIFFERS 1
@@ -148,6 +216,24 @@ struct fsxattr { · 51 unmodified lines
148216 unsigned char fsx_pad[8];
149217 };
150218
219+/*
220+ * Variable size structure for file_[sg]et_attr().
221+ *
222+ * Note. This is alternative to the structure 'struct file_kattr'/'struct fsxattr'.
223+ * As this structure is passed to/from userspace with its size, this can
224+ * be versioned based on the size.
225+ */
226+struct file_attr {
227+ __u64 fa_xflags; /* xflags field value (get/set) */
228+ __u32 fa_extsize; /* extsize field value (get/set)*/
229+ __u32 fa_nextents; /* nextents field value (get) */
230+ __u32 fa_projid; /* project identifier (get/set) */
231+ __u32 fa_cowextsize; /* CoW extsize field value (get/set) */
232+};
233+
234+#define FILE_ATTR_SIZE_VER0 24
235+#define FILE_ATTR_SIZE_LATEST FILE_ATTR_SIZE_VER0
236+
151237 /*
152238 * Flags for the fsx_xflags field
153239 */
@@ -247,6 +333,8 @@ struct fsxattr { · 93 unmodified lines
247333 * also /sys/kernel/debug/ for filesystems with debugfs exports
248334 */
249335 #define FS_IOC_GETFSSYSFSPATH _IOR(0x15, 1, struct fs_sysfs_path)
336+/* Get logical block metadata capability details */
337+#define FS_IOC_GETLBMD_CAP _IOWR(0x15, 2, struct logical_block_metadata_cap)
250338
251339 /*
252340 * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS)
tools/perf/trace/beauty/include/uapi/linux/prctl.h+8−1
@@ -244,6 +244,8 @@ struct prctl_mm_map { · 243 unmodified lines
244244 # define PR_MTE_TAG_MASK (0xffffUL << PR_MTE_TAG_SHIFT)
245245 /* Unused; kept only for source compatibility */
246246 # define PR_MTE_TCF_SHIFT 1
247+/* MTE tag check store only */
248+# define PR_MTE_STORE_ONLY (1UL << 19)
247249 /* RISC-V pointer masking tag length */
248250 # define PR_PMLEN_SHIFT 24
249251 # define PR_PMLEN_MASK (0x7fUL << PR_PMLEN_SHIFT)
@@ -255,7 +257,12 @@ struct prctl_mm_map { · 5 unmodified lines
255257 /* Dispatch syscalls to a userspace handler */
256258 #define PR_SET_SYSCALL_USER_DISPATCH 59
257259 # define PR_SYS_DISPATCH_OFF 0
258−# define PR_SYS_DISPATCH_ON 1
260+/* Enable dispatch except for the specified range */
261+# define PR_SYS_DISPATCH_EXCLUSIVE_ON 1
262+/* Enable dispatch for the specified range */
263+# define PR_SYS_DISPATCH_INCLUSIVE_ON 2
264+/* Legacy name for backwards compatibility */
265+# define PR_SYS_DISPATCH_ON PR_SYS_DISPATCH_EXCLUSIVE_ON
259266 /* The control values for the user space selector when dispatch is enabled */
260267 # define SYSCALL_DISPATCH_FILTER_ALLOW 0
261268 # define SYSCALL_DISPATCH_FILTER_BLOCK 1
tools/perf/trace/beauty/include/uapi/linux/vhost.h+35−0
@@ -235,4 +235,39 @@ · 234 unmodified lines
235235 */
236236 #define VHOST_VDPA_GET_VRING_SIZE _IOWR(VHOST_VIRTIO, 0x82, \
237237 struct vhost_vring_state)
238+
239+/* Extended features manipulation */
240+#define VHOST_GET_FEATURES_ARRAY _IOR(VHOST_VIRTIO, 0x83, \
241+ struct vhost_features_array)
242+#define VHOST_SET_FEATURES_ARRAY _IOW(VHOST_VIRTIO, 0x83, \
243+ struct vhost_features_array)
244+
245+/* fork_owner values for vhost */
246+#define VHOST_FORK_OWNER_KTHREAD 0
247+#define VHOST_FORK_OWNER_TASK 1
248+
249+/**
250+ * VHOST_SET_FORK_FROM_OWNER - Set the fork_owner flag for the vhost device,
251+ * This ioctl must called before VHOST_SET_OWNER.
252+ * Only available when CONFIG_VHOST_ENABLE_FORK_OWNER_CONTROL=y
253+ *
254+ * @param fork_owner: An 8-bit value that determines the vhost thread mode
255+ *
256+ * When fork_owner is set to VHOST_FORK_OWNER_TASK(default value):
257+ * - Vhost will create vhost worker as tasks forked from the owner,
258+ * inheriting all of the owner's attributes.
259+ *
260+ * When fork_owner is set to VHOST_FORK_OWNER_KTHREAD:
261+ * - Vhost will create vhost workers as kernel threads.
262+ */
263+#define VHOST_SET_FORK_FROM_OWNER _IOW(VHOST_VIRTIO, 0x84, __u8)
264+
265+/**
266+ * VHOST_GET_FORK_OWNER - Get the current fork_owner flag for the vhost device.
267+ * Only available when CONFIG_VHOST_ENABLE_FORK_OWNER_CONTROL=y
268+ *
269+ * @return: An 8-bit value indicating the current thread mode.
270+ */
271+#define VHOST_GET_FORK_FROM_OWNER _IOR(VHOST_VIRTIO, 0x85, __u8)
272+
238273 #endif
tools/perf/util/build-id.c+2−2
@@ -115,7 +115,7 @@ int filename__snprintf_build_id(const char *pathname, char *sbuild_id, size_t sb · 114 unmodified lines
115115 struct build_id bid = { .size = 0, };
116116 int ret;
117117
118− ret = filename__read_build_id(pathname, &bid);
118+ ret = filename__read_build_id(pathname, &bid, /*block=*/true);
119119 if (ret < 0)
120120 return ret;
121121
@@ -841,7 +841,7 @@ static int filename__read_build_id_ns(const char *filename, · 719 unmodified lines
841841 int ret;
842842
843843 nsinfo__mountns_enter(nsi, &nsc);
844− ret = filename__read_build_id(filename, bid);
844+ ret = filename__read_build_id(filename, bid, /*block=*/true);
845845 nsinfo__mountns_exit(&nsc);
846846
847847 return ret;
tools/perf/util/debuginfo.c+6−2
@@ -110,8 +110,12 @@ struct debuginfo *debuginfo__new(const char *path) · 109 unmodified lines
110110 if (!dso)
111111 goto out;
112112
113− /* Set the build id for DSO_BINARY_TYPE__BUILDID_DEBUGINFO */
114− if (is_regular_file(path) && filename__read_build_id(path, &bid) > 0)
113+ /*
114+ * Set the build id for DSO_BINARY_TYPE__BUILDID_DEBUGINFO. Don't block
115+ * incase the path isn't for a regular file.
116+ */
117+ assert(!dso__has_build_id(dso));
118+ if (filename__read_build_id(path, &bid, /*block=*/false) > 0)
115119 dso__set_build_id(dso, &bid);
116120
117121 for (type = distro_dwarf_types;
tools/perf/util/dsos.c+2−2
@@ -81,13 +81,13 @@ static int dsos__read_build_ids_cb(struct dso *dso, void *data) · 80 unmodified lines
8181 return 0;
8282 }
8383 nsinfo__mountns_enter(dso__nsinfo(dso), &nsc);
84− if (filename__read_build_id(dso__long_name(dso), &bid) > 0) {
84+ if (filename__read_build_id(dso__long_name(dso), &bid, /*block=*/true) > 0) {
8585 dso__set_build_id(dso, &bid);
8686 args->have_build_id = true;
8787 } else if (errno == ENOENT && dso__nsinfo(dso)) {
8888 char *new_name = dso__filename_with_chroot(dso, dso__long_name(dso));
8989
90− if (new_name && filename__read_build_id(new_name, &bid) > 0) {
90+ if (new_name && filename__read_build_id(new_name, &bid, /*block=*/true) > 0) {
9191 dso__set_build_id(dso, &bid);
9292 args->have_build_id = true;
9393 }
tools/perf/util/symbol-elf.c+5−4
@@ -902,7 +902,7 @@ out_close: · 901 unmodified lines
902902
903903 #else // HAVE_LIBBFD_BUILDID_SUPPORT
904904
905−static int read_build_id(const char *filename, struct build_id *bid)
905+static int read_build_id(const char *filename, struct build_id *bid, bool block)
906906 {
907907 size_t size = sizeof(bid->data);
908908 int fd, err = -1;
@@ -911,7 +911,7 @@ static int read_build_id(const char *filename, struct build_id *bid) · 2 unmodified lines
911911 if (size < BUILD_ID_SIZE)
912912 goto out;
913913
914− fd = open(filename, O_RDONLY);
914+ fd = open(filename, block ? O_RDONLY : (O_RDONLY | O_NONBLOCK));
915915 if (fd < 0)
916916 goto out;
917917
@@ -934,7 +934,7 @@ out: · 16 unmodified lines
934934
935935 #endif // HAVE_LIBBFD_BUILDID_SUPPORT
936936
937−int filename__read_build_id(const char *filename, struct build_id *bid)
937+int filename__read_build_id(const char *filename, struct build_id *bid, bool block)
938938 {
939939 struct kmod_path m = { .name = NULL, };
940940 char path[PATH_MAX];
@@ -958,9 +958,10 @@ int filename__read_build_id(const char *filename, struct build_id *bid) · 17 unmodified lines
958958 }
959959 close(fd);
960960 filename = path;
961+ block = true;
961962 }
962963
963− err = read_build_id(filename, bid);
964+ err = read_build_id(filename, bid, block);
964965
965966 if (m.comp)
966967 unlink(filename);
tools/perf/util/symbol-minimal.c+29−30
@@ -4,7 +4,6 @@ · 3 unmodified lines
44
55 #include <errno.h>
66 #include <unistd.h>
7−#include <stdio.h>
87 #include <fcntl.h>
98 #include <string.h>
109 #include <stdlib.h>
@@ -86,13 +85,10 @@ int filename__read_debuglink(const char *filename __maybe_unused, · 75 unmodified lines
8685 /*
8786 * Just try PT_NOTE header otherwise fails
8887 */
89−int filename__read_build_id(const char *filename, struct build_id *bid)
88+int filename__read_build_id(const char *filename, struct build_id *bid, bool block)
9089 {
91− FILE *fp;
92− int ret = -1;
90+ int fd, ret = -1;
9391 bool need_swap = false, elf32;
94− u8 e_ident[EI_NIDENT];
95− int i;
9692 union {
9793 struct {
9894 Elf32_Ehdr ehdr32;
@@ -103,28 +99,27 @@ int filename__read_build_id(const char *filename, struct build_id *bid) · 4 unmodified lines
10399 Elf64_Phdr *phdr64;
104100 };
105101 } hdrs;
106− void *phdr;
107− size_t phdr_size;
108− void *buf = NULL;
109− size_t buf_size = 0;
102+ void *phdr, *buf = NULL;
103+ ssize_t phdr_size, ehdr_size, buf_size = 0;
110104
111− fp = fopen(filename, "r");
112− if (fp == NULL)
105+ fd = open(filename, block ? O_RDONLY : (O_RDONLY | O_NONBLOCK));
106+ if (fd < 0)
113107 return -1;
114108
115− if (fread(e_ident, sizeof(e_ident), 1, fp) != 1)
109+ if (read(fd, hdrs.ehdr32.e_ident, EI_NIDENT) != EI_NIDENT)
116110 goto out;
117111
118− if (memcmp(e_ident, ELFMAG, SELFMAG) ||
119− e_ident[EI_VERSION] != EV_CURRENT)
112+ if (memcmp(hdrs.ehdr32.e_ident, ELFMAG, SELFMAG) ||
113+ hdrs.ehdr32.e_ident[EI_VERSION] != EV_CURRENT)
120114 goto out;
121115
122− need_swap = check_need_swap(e_ident[EI_DATA]);
123− elf32 = e_ident[EI_CLASS] == ELFCLASS32;
116+ need_swap = check_need_swap(hdrs.ehdr32.e_ident[EI_DATA]);
117+ elf32 = hdrs.ehdr32.e_ident[EI_CLASS] == ELFCLASS32;
118+ ehdr_size = (elf32 ? sizeof(hdrs.ehdr32) : sizeof(hdrs.ehdr64)) - EI_NIDENT;
124119
125− if (fread(elf32 ? (void *)&hdrs.ehdr32 : (void *)&hdrs.ehdr64,
126− elf32 ? sizeof(hdrs.ehdr32) : sizeof(hdrs.ehdr64),
127− 1, fp) != 1)
120+ if (read(fd,
121+ (elf32 ? (void *)&hdrs.ehdr32 : (void *)&hdrs.ehdr64) + EI_NIDENT,
122+ ehdr_size) != ehdr_size)
128123 goto out;
129124
130125 if (need_swap) {
@@ -138,14 +133,18 @@ int filename__read_build_id(const char *filename, struct build_id *bid) · 7 unmodified lines
138133 hdrs.ehdr64.e_phnum = bswap_16(hdrs.ehdr64.e_phnum);
139134 }
140135 }
141− phdr_size = elf32 ? hdrs.ehdr32.e_phentsize * hdrs.ehdr32.e_phnum
142− : hdrs.ehdr64.e_phentsize * hdrs.ehdr64.e_phnum;
136+ if ((elf32 && hdrs.ehdr32.e_phentsize != sizeof(Elf32_Phdr)) ||
137+ (!elf32 && hdrs.ehdr64.e_phentsize != sizeof(Elf64_Phdr)))
138+ goto out;
139+
140+ phdr_size = elf32 ? sizeof(Elf32_Phdr) * hdrs.ehdr32.e_phnum
141+ : sizeof(Elf64_Phdr) * hdrs.ehdr64.e_phnum;
143142 phdr = malloc(phdr_size);
144143 if (phdr == NULL)
145144 goto out;
146145
147− fseek(fp, elf32 ? hdrs.ehdr32.e_phoff : hdrs.ehdr64.e_phoff, SEEK_SET);
148− if (fread(phdr, phdr_size, 1, fp) != 1)
146+ lseek(fd, elf32 ? hdrs.ehdr32.e_phoff : hdrs.ehdr64.e_phoff, SEEK_SET);
147+ if (read(fd, phdr, phdr_size) != phdr_size)
149148 goto out_free;
150149
151150 if (elf32)
@@ -153,8 +152,8 @@ int filename__read_build_id(const char *filename, struct build_id *bid) · 1 unmodified line
153152 else
154153 hdrs.phdr64 = phdr;
155154
156− for (i = 0; i < elf32 ? hdrs.ehdr32.e_phnum : hdrs.ehdr64.e_phnum; i++) {
157− size_t p_filesz;
155+ for (int i = 0; i < (elf32 ? hdrs.ehdr32.e_phnum : hdrs.ehdr64.e_phnum); i++) {
156+ ssize_t p_filesz;
158157
159158 if (need_swap) {
160159 if (elf32) {
@@ -180,8 +179,8 @@ int filename__read_build_id(const char *filename, struct build_id *bid) · 19 unmodified lines
180179 goto out_free;
181180 buf = tmp;
182181 }
183− fseek(fp, elf32 ? hdrs.phdr32[i].p_offset : hdrs.phdr64[i].p_offset, SEEK_SET);
184− if (fread(buf, p_filesz, 1, fp) != 1)
182+ lseek(fd, elf32 ? hdrs.phdr32[i].p_offset : hdrs.phdr64[i].p_offset, SEEK_SET);
183+ if (read(fd, buf, p_filesz) != p_filesz)
185184 goto out_free;
186185
187186 ret = read_build_id(buf, p_filesz, bid, need_swap);
@@ -194,7 +193,7 @@ out_free: · 6 unmodified lines
194193 free(buf);
195194 free(phdr);
196195 out:
197− fclose(fp);
196+ close(fd);
198197 return ret;
199198 }
200199
@@ -324,7 +323,7 @@ int dso__load_sym(struct dso *dso, struct map *map __maybe_unused, · 123 unmodified lines
324323 if (ret >= 0)
325324 RC_CHK_ACCESS(dso)->is_64_bit = ret;
326325
327− if (filename__read_build_id(ss->name, &bid) > 0)
326+ if (filename__read_build_id(ss->name, &bid, /*block=*/true) > 0)
328327 dso__set_build_id(dso, &bid);
329328 return 0;
330329 }
tools/perf/util/symbol.c+4−4
@@ -1869,14 +1869,14 @@ int dso__load(struct dso *dso, struct map *map) · 1868 unmodified lines
18691869
18701870 /*
18711871 * Read the build id if possible. This is required for
1872− * DSO_BINARY_TYPE__BUILDID_DEBUGINFO to work
1872+ * DSO_BINARY_TYPE__BUILDID_DEBUGINFO to work. Don't block in case path
1873+ * isn't for a regular file.
18731874 */
1874− if (!dso__has_build_id(dso) &&
1875− is_regular_file(dso__long_name(dso))) {
1875+ if (!dso__has_build_id(dso)) {
18761876 struct build_id bid = { .size = 0, };
18771877
18781878 __symbol__join_symfs(name, PATH_MAX, dso__long_name(dso));
1879− if (filename__read_build_id(name, &bid) > 0)
1879+ if (filename__read_build_id(name, &bid, /*block=*/false) > 0)
18801880 dso__set_build_id(dso, &bid);
18811881 }
18821882
tools/perf/util/symbol.h+1−1
@@ -140,7 +140,7 @@ struct symbol *dso__next_symbol(struct symbol *sym); · 139 unmodified lines
140140
141141 enum dso_type dso__type_fd(int fd);
142142
143−int filename__read_build_id(const char *filename, struct build_id *id);
143+int filename__read_build_id(const char *filename, struct build_id *id, bool block);
144144 int sysfs__read_build_id(const char *filename, struct build_id *bid);
145145 int modules__parse(const char *filename, void *arg,
146146 int (*process_module)(void *arg, const char *name,
tools/perf/util/synthetic-events.c+1−1
@@ -401,7 +401,7 @@ static void perf_record_mmap2__read_build_id(struct perf_record_mmap2 *event, · 400 unmodified lines
401401 nsi = nsinfo__new(event->pid);
402402 nsinfo__mountns_enter(nsi, &nc);
403403
404− rc = filename__read_build_id(event->filename, &bid) > 0 ? 0 : -1;
404+ rc = filename__read_build_id(event->filename, &bid, /*block=*/false) > 0 ? 0 : -1;
405405
406406 nsinfo__mountns_exit(&nc);
407407 nsinfo__put(nsi);
tools/power/cpupower/man/cpupower-set.1+4−3
@@ -81,10 +81,11 @@ Refer to the AMD P-State kernel documentation for further information. · 80 unmodified lines
8181 .RE
8282
8383 .PP
84−\-\-turbo\-boost, \-t
84+\-\-turbo\-boost, \-\-boost, \-t
8585 .RS 4
86−This option is used to enable or disable the turbo boost feature on
87−supported Intel and AMD processors.
86+This option is used to enable or disable the boost feature on
87+supported Intel and AMD processors, and other boost supported systems.
88+(The --boost option is an alias for the --turbo-boost option)
8889
8990 This option takes as parameter either \fB1\fP to enable, or \fB0\fP to disable the feature.
9091
tools/power/cpupower/utils/cpufreq-info.c+15−1
@@ -128,7 +128,7 @@ static int get_boost_mode_x86(unsigned int cpu) · 127 unmodified lines
128128 /* ToDo: Make this more global */
129129 unsigned long pstates[MAX_HW_PSTATES] = {0,};
130130
131− ret = cpufreq_has_boost_support(cpu, &support, &active, &b_states);
131+ ret = cpufreq_has_x86_boost_support(cpu, &support, &active, &b_states);
132132 if (ret) {
133133 printf(_("Error while evaluating Boost Capabilities"
134134 " on CPU %d -- are you root?\n"), cpu);
@@ -204,6 +204,18 @@ static int get_boost_mode_x86(unsigned int cpu) · 69 unmodified lines
204204 return 0;
205205 }
206206
207+static int get_boost_mode_generic(unsigned int cpu)
208+{
209+ bool active;
210+
211+ if (!cpufreq_has_generic_boost_support(&active)) {
212+ printf(_(" boost state support:\n"));
213+ printf(_(" Active: %s\n"), active ? _("yes") : _("no"));
214+ }
215+
216+ return 0;
217+}
218+
207219 /* --boost / -b */
208220
209221 static int get_boost_mode(unsigned int cpu)
@@ -214,6 +226,8 @@ static int get_boost_mode(unsigned int cpu) · 4 unmodified lines
214226 cpupower_cpu_info.vendor == X86_VENDOR_HYGON ||
215227 cpupower_cpu_info.vendor == X86_VENDOR_INTEL)
216228 return get_boost_mode_x86(cpu);
229+ else
230+ get_boost_mode_generic(cpu);
217231
218232 freqs = cpufreq_get_boost_frequencies(cpu);
219233 if (freqs) {
tools/power/cpupower/utils/cpupower-set.c+3−2
@@ -21,6 +21,7 @@ static struct option set_opts[] = { · 20 unmodified lines
2121 {"epp", required_argument, NULL, 'e'},
2222 {"amd-pstate-mode", required_argument, NULL, 'm'},
2323 {"turbo-boost", required_argument, NULL, 't'},
24+ {"boost", required_argument, NULL, 't'},
2425 { },
2526 };
2627
@@ -62,8 +63,8 @@ int cmd_set(int argc, char **argv) · 35 unmodified lines
6263
6364 params.params = 0;
6465 /* parameter parsing */
65− while ((ret = getopt_long(argc, argv, "b:e:m:",
66− set_opts, NULL)) != -1) {
66+ while ((ret = getopt_long(argc, argv, "b:e:m:t:",
67+ set_opts, NULL)) != -1) {
6768 switch (ret) {
6869 case 'b':
6970 if (params.perf_bias)
tools/power/cpupower/utils/helpers/helpers.h+7−7
@@ -103,6 +103,9 @@ extern struct cpupower_cpu_info cpupower_cpu_info; · 102 unmodified lines
103103
104104 /* cpuid and cpuinfo helpers **************************/
105105
106+int cpufreq_has_generic_boost_support(bool *active);
107+int cpupower_set_turbo_boost(int turbo_boost);
108+
106109 /* X86 ONLY ****************************************/
107110 #if defined(__i386__) || defined(__x86_64__)
108111
@@ -118,7 +121,6 @@ extern unsigned long long msr_intel_get_turbo_ratio(unsigned int cpu); · 9 unmodified lines
118121
119122 extern int cpupower_set_epp(unsigned int cpu, char *epp);
120123 extern int cpupower_set_amd_pstate_mode(char *mode);
121−extern int cpupower_set_turbo_boost(int turbo_boost);
122124
123125 /* Read/Write msr ****************************/
124126
@@ -139,8 +141,8 @@ extern int decode_pstates(unsigned int cpu, int boost_states, · 14 unmodified lines
139141
140142 /* AMD HW pstate decoding **************************/
141143
142−extern int cpufreq_has_boost_support(unsigned int cpu, int *support,
143− int *active, int * states);
144+int cpufreq_has_x86_boost_support(unsigned int cpu, int *support,
145+ int *active, int *states);
144146
145147 /* AMD P-State stuff **************************/
146148 bool cpupower_amd_pstate_enabled(void);
@@ -181,13 +183,11 @@ static inline int cpupower_set_epp(unsigned int cpu, char *epp) · 34 unmodified lines
181183 { return -1; };
182184 static inline int cpupower_set_amd_pstate_mode(char *mode)
183185 { return -1; };
184−static inline int cpupower_set_turbo_boost(int turbo_boost)
185−{ return -1; };
186186
187187 /* Read/Write msr ****************************/
188188
189−static inline int cpufreq_has_boost_support(unsigned int cpu, int *support,
190− int *active, int * states)
189+static inline int cpufreq_has_x86_boost_support(unsigned int cpu, int *support,
190+ int *active, int *states)
191191 { return -1; }
192192
193193 static inline bool cpupower_amd_pstate_enabled(void)
tools/power/cpupower/utils/helpers/misc.c+54−22
@@ -8,15 +8,14 @@ · 7 unmodified lines
88 #include "helpers/helpers.h"
99 #include "helpers/sysfs.h"
1010 #include "cpufreq.h"
11+#include "cpupower_intern.h"
1112
1213 #if defined(__i386__) || defined(__x86_64__)
1314
14−#include "cpupower_intern.h"
15−
1615 #define MSR_AMD_HWCR 0xc0010015
1716
18−int cpufreq_has_boost_support(unsigned int cpu, int *support, int *active,
19− int *states)
17+int cpufreq_has_x86_boost_support(unsigned int cpu, int *support, int *active,
18+ int *states)
2019 {
2120 int ret;
2221 unsigned long long val;
@@ -124,24 +123,6 @@ int cpupower_set_amd_pstate_mode(char *mode) · 101 unmodified lines
124123 return 0;
125124 }
126125
127−int cpupower_set_turbo_boost(int turbo_boost)
128−{
129− char path[SYSFS_PATH_MAX];
130− char linebuf[2] = {};
131−
132− snprintf(path, sizeof(path), PATH_TO_CPU "cpufreq/boost");
133−
134− if (!is_valid_path(path))
135− return -1;
136−
137− snprintf(linebuf, sizeof(linebuf), "%d", turbo_boost);
138−
139− if (cpupower_write_sysfs(path, linebuf, 2) <= 0)
140− return -1;
141−
142− return 0;
143−}
144−
145126 bool cpupower_amd_pstate_enabled(void)
146127 {
147128 char *driver = cpufreq_get_driver(0);
@@ -160,6 +141,39 @@ bool cpupower_amd_pstate_enabled(void) · 12 unmodified lines
160141
161142 #endif /* #if defined(__i386__) || defined(__x86_64__) */
162143
144+int cpufreq_has_generic_boost_support(bool *active)
145+{
146+ char path[SYSFS_PATH_MAX];
147+ char linebuf[2] = {};
148+ unsigned long val;
149+ char *endp;
150+
151+ snprintf(path, sizeof(path), PATH_TO_CPU "cpufreq/boost");
152+
153+ if (!is_valid_path(path))
154+ return -EACCES;
155+
156+ if (cpupower_read_sysfs(path, linebuf, 2) <= 0)
157+ return -EINVAL;
158+
159+ val = strtoul(linebuf, &endp, 0);
160+ if (endp == linebuf || errno == ERANGE)
161+ return -EINVAL;
162+
163+ switch (val) {
164+ case 0:
165+ *active = false;
166+ break;
167+ case 1:
168+ *active = true;
169+ break;
170+ default:
171+ return -EINVAL;
172+ }
173+
174+ return 0;
175+}
176+
163177 /* get_cpustate
164178 *
165179 * Gather the information of all online CPUs into bitmask struct
@@ -259,3 +273,21 @@ void print_speed(unsigned long speed, int no_rounding) · 93 unmodified lines
259273 }
260274 }
261275 }
276+
277+int cpupower_set_turbo_boost(int turbo_boost)
278+{
279+ char path[SYSFS_PATH_MAX];
280+ char linebuf[2] = {};
281+
282+ snprintf(path, sizeof(path), PATH_TO_CPU "cpufreq/boost");
283+
284+ if (!is_valid_path(path))
285+ return -1;
286+
287+ snprintf(linebuf, sizeof(linebuf), "%d", turbo_boost);
288+
289+ if (cpupower_write_sysfs(path, linebuf, 2) <= 0)
290+ return -1;
291+
292+ return 0;
293+}
tools/scripts/syscall.tbl+2−0
@@ -408,3 +408,5 @@ · 407 unmodified lines
408408 465 common listxattrat sys_listxattrat
409409 466 common removexattrat sys_removexattrat
410410 467 common open_tree_attr sys_open_tree_attr
411+468 common file_getattr sys_file_getattr
412+469 common file_setattr sys_file_setattr
tools/testing/selftests/damon/Makefile+1−0
@@ -4,6 +4,7 @@ · 3 unmodified lines
44 TEST_GEN_FILES += access_memory access_memory_even
55
66 TEST_FILES = _damon_sysfs.py
7+TEST_FILES += drgn_dump_damon_status.py
78
89 # functionality tests
910 TEST_PROGS += sysfs.sh
tools/testing/selftests/mm/mremap_test.c+261−3
@@ -5,10 +5,14 @@ · 4 unmodified lines
55 #define _GNU_SOURCE
66
77 #include <errno.h>
8+#include <fcntl.h>
9+#include <linux/userfaultfd.h>
810 #include <stdlib.h>
911 #include <stdio.h>
1012 #include <string.h>
13+#include <sys/ioctl.h>
1114 #include <sys/mman.h>
15+#include <syscall.h>
1216 #include <time.h>
1317 #include <stdbool.h>
1418
@@ -168,6 +172,7 @@ static bool is_range_mapped(FILE *maps_fp, unsigned long start, · 153 unmodified lines
168172
169173 if (first_val <= start && second_val >= end) {
170174 success = true;
175+ fflush(maps_fp);
171176 break;
172177 }
173178 }
@@ -175,6 +180,15 @@ static bool is_range_mapped(FILE *maps_fp, unsigned long start, · 1 unmodified line
175180 return success;
176181 }
177182
183+/* Check if [ptr, ptr + size) mapped in /proc/self/maps. */
184+static bool is_ptr_mapped(FILE *maps_fp, void *ptr, unsigned long size)
185+{
186+ unsigned long start = (unsigned long)ptr;
187+ unsigned long end = start + size;
188+
189+ return is_range_mapped(maps_fp, start, end);
190+}
191+
178192 /*
179193 * Returns the start address of the mapping on success, else returns
180194 * NULL on failure.
@@ -733,6 +747,249 @@ out: · 552 unmodified lines
733747 dont_unmap ? " [dontunnmap]" : "");
734748 }
735749
750+#ifdef __NR_userfaultfd
751+static void mremap_move_multi_invalid_vmas(FILE *maps_fp,
752+ unsigned long page_size)
753+{
754+ char *test_name = "mremap move multiple invalid vmas";
755+ const size_t size = 10 * page_size;
756+ bool success = true;
757+ char *ptr, *tgt_ptr;
758+ int uffd, err, i;
759+ void *res;
760+ struct uffdio_api api = {
761+ .api = UFFD_API,
762+ .features = UFFD_EVENT_PAGEFAULT,
763+ };
764+
765+ uffd = syscall(__NR_userfaultfd, O_NONBLOCK);
766+ if (uffd == -1) {
767+ err = errno;
768+ perror("userfaultfd");
769+ if (err == EPERM) {
770+ ksft_test_result_skip("%s - missing uffd", test_name);
771+ return;
772+ }
773+ success = false;
774+ goto out;
775+ }
776+ if (ioctl(uffd, UFFDIO_API, &api)) {
777+ perror("ioctl UFFDIO_API");
778+ success = false;
779+ goto out_close_uffd;
780+ }
781+
782+ ptr = mmap(NULL, size, PROT_READ | PROT_WRITE,
783+ MAP_PRIVATE | MAP_ANON, -1, 0);
784+ if (ptr == MAP_FAILED) {
785+ perror("mmap");
786+ success = false;
787+ goto out_close_uffd;
788+ }
789+
790+ tgt_ptr = mmap(NULL, size, PROT_NONE, MAP_PRIVATE | MAP_ANON, -1, 0);
791+ if (tgt_ptr == MAP_FAILED) {
792+ perror("mmap");
793+ success = false;
794+ goto out_close_uffd;
795+ }
796+ if (munmap(tgt_ptr, size)) {
797+ perror("munmap");
798+ success = false;
799+ goto out_unmap;
800+ }
801+
802+ /*
803+ * Unmap so we end up with:
804+ *
805+ * 0 2 4 6 8 10 offset in buffer
806+ * |*| |*| |*| |*| |*|
807+ * |*| |*| |*| |*| |*|
808+ *
809+ * Additionally, register each with UFFD.
810+ */
811+ for (i = 0; i < 10; i += 2) {
812+ void *unmap_ptr = &ptr[(i + 1) * page_size];
813+ unsigned long start = (unsigned long)&ptr[i * page_size];
814+ struct uffdio_register reg = {
815+ .range = {
816+ .start = start,
817+ .len = page_size,
818+ },
819+ .mode = UFFDIO_REGISTER_MODE_MISSING,
820+ };
821+
822+ if (ioctl(uffd, UFFDIO_REGISTER, &reg) == -1) {
823+ perror("ioctl UFFDIO_REGISTER");
824+ success = false;
825+ goto out_unmap;
826+ }
827+ if (munmap(unmap_ptr, page_size)) {
828+ perror("munmap");
829+ success = false;
830+ goto out_unmap;
831+ }
832+ }
833+
834+ /*
835+ * Now try to move the entire range which is invalid for multi VMA move.
836+ *
837+ * This will fail, and no VMA should be moved, as we check this ahead of
838+ * time.
839+ */
840+ res = mremap(ptr, size, size, MREMAP_MAYMOVE | MREMAP_FIXED, tgt_ptr);
841+ err = errno;
842+ if (res != MAP_FAILED) {
843+ fprintf(stderr, "mremap() succeeded for multi VMA uffd armed\n");
844+ success = false;
845+ goto out_unmap;
846+ }
847+ if (err != EFAULT) {
848+ errno = err;
849+ perror("mrmeap() unexpected error");
850+ success = false;
851+ goto out_unmap;
852+ }
853+ if (is_ptr_mapped(maps_fp, tgt_ptr, page_size)) {
854+ fprintf(stderr,
855+ "Invalid uffd-armed VMA at start of multi range moved\n");
856+ success = false;
857+ goto out_unmap;
858+ }
859+
860+ /*
861+ * Now try to move a single VMA, this should succeed as not multi VMA
862+ * move.
863+ */
864+ res = mremap(ptr, page_size, page_size,
865+ MREMAP_MAYMOVE | MREMAP_FIXED, tgt_ptr);
866+ if (res == MAP_FAILED) {
867+ perror("mremap single invalid-multi VMA");
868+ success = false;
869+ goto out_unmap;
870+ }
871+
872+ /*
873+ * Unmap the VMA, and remap a non-uffd registered (therefore, multi VMA
874+ * move valid) VMA at the start of ptr range.
875+ */
876+ if (munmap(tgt_ptr, page_size)) {
877+ perror("munmap");
878+ success = false;
879+ goto out_unmap;
880+ }
881+ res = mmap(ptr, page_size, PROT_READ | PROT_WRITE,
882+ MAP_PRIVATE | MAP_ANON | MAP_FIXED, -1, 0);
883+ if (res == MAP_FAILED) {
884+ perror("mmap");
885+ success = false;
886+ goto out_unmap;
887+ }
888+
889+ /*
890+ * Now try to move the entire range, we should succeed in moving the
891+ * first VMA, but no others, and report a failure.
892+ */
893+ res = mremap(ptr, size, size, MREMAP_MAYMOVE | MREMAP_FIXED, tgt_ptr);
894+ err = errno;
895+ if (res != MAP_FAILED) {
896+ fprintf(stderr, "mremap() succeeded for multi VMA uffd armed\n");
897+ success = false;
898+ goto out_unmap;
899+ }
900+ if (err != EFAULT) {
901+ errno = err;
902+ perror("mrmeap() unexpected error");
903+ success = false;
904+ goto out_unmap;
905+ }
906+ if (!is_ptr_mapped(maps_fp, tgt_ptr, page_size)) {
907+ fprintf(stderr, "Valid VMA not moved\n");
908+ success = false;
909+ goto out_unmap;
910+ }
911+
912+ /*
913+ * Unmap the VMA, and map valid VMA at start of ptr range, and replace
914+ * all existing multi-move invalid VMAs, except the last, with valid
915+ * multi-move VMAs.
916+ */
917+ if (munmap(tgt_ptr, page_size)) {
918+ perror("munmap");
919+ success = false;
920+ goto out_unmap;
921+ }
922+ if (munmap(ptr, size - 2 * page_size)) {
923+ perror("munmap");
924+ success = false;
925+ goto out_unmap;
926+ }
927+ for (i = 0; i < 8; i += 2) {
928+ res = mmap(&ptr[i * page_size], page_size,
929+ PROT_READ | PROT_WRITE,
930+ MAP_PRIVATE | MAP_ANON | MAP_FIXED, -1, 0);
931+ if (res == MAP_FAILED) {
932+ perror("mmap");
933+ success = false;
934+ goto out_unmap;
935+ }
936+ }
937+
938+ /*
939+ * Now try to move the entire range, we should succeed in moving all but
940+ * the last VMA, and report a failure.
941+ */
942+ res = mremap(ptr, size, size, MREMAP_MAYMOVE | MREMAP_FIXED, tgt_ptr);
943+ err = errno;
944+ if (res != MAP_FAILED) {
945+ fprintf(stderr, "mremap() succeeded for multi VMA uffd armed\n");
946+ success = false;
947+ goto out_unmap;
948+ }
949+ if (err != EFAULT) {
950+ errno = err;
951+ perror("mrmeap() unexpected error");
952+ success = false;
953+ goto out_unmap;
954+ }
955+
956+ for (i = 0; i < 10; i += 2) {
957+ bool is_mapped = is_ptr_mapped(maps_fp,
958+ &tgt_ptr[i * page_size], page_size);
959+
960+ if (i < 8 && !is_mapped) {
961+ fprintf(stderr, "Valid VMA not moved at %d\n", i);
962+ success = false;
963+ goto out_unmap;
964+ } else if (i == 8 && is_mapped) {
965+ fprintf(stderr, "Invalid VMA moved at %d\n", i);
966+ success = false;
967+ goto out_unmap;
968+ }
969+ }
970+
971+out_unmap:
972+ if (munmap(tgt_ptr, size))
973+ perror("munmap tgt");
974+ if (munmap(ptr, size))
975+ perror("munmap src");
976+out_close_uffd:
977+ close(uffd);
978+out:
979+ if (success)
980+ ksft_test_result_pass("%s\n", test_name);
981+ else
982+ ksft_test_result_fail("%s\n", test_name);
983+}
984+#else
985+static void mremap_move_multi_invalid_vmas(FILE *maps_fp, unsigned long page_size)
986+{
987+ char *test_name = "mremap move multiple invalid vmas";
988+
989+ ksft_test_result_skip("%s - missing uffd", test_name);
990+}
991+#endif /* __NR_userfaultfd */
992+
736993 /* Returns the time taken for the remap on success else returns -1. */
737994 static long long remap_region(struct config c, unsigned int threshold_mb,
738995 char *rand_addr)
@@ -1074,7 +1331,7 @@ int main(int argc, char **argv) · 335 unmodified lines
10741331 char *rand_addr;
10751332 size_t rand_size;
10761333 int num_expand_tests = 2;
1077− int num_misc_tests = 8;
1334+ int num_misc_tests = 9;
10781335 struct test test_cases[MAX_TEST] = {};
10791336 struct test perf_test_cases[MAX_PERF_TEST];
10801337 int page_size;
@@ -1197,8 +1454,6 @@ int main(int argc, char **argv) · 116 unmodified lines
11971454 mremap_expand_merge(maps_fp, page_size);
11981455 mremap_expand_merge_offset(maps_fp, page_size);
11991456
1200− fclose(maps_fp);
1201−
12021457 mremap_move_within_range(pattern_seed, rand_addr);
12031458 mremap_move_1mb_from_start(pattern_seed, rand_addr);
12041459 mremap_shrink_multiple_vmas(page_size, /* inplace= */true);
@@ -1207,6 +1462,9 @@ int main(int argc, char **argv) · 2 unmodified lines
12071462 mremap_move_multiple_vmas(pattern_seed, page_size, /* dontunmap= */ true);
12081463 mremap_move_multiple_vmas_split(pattern_seed, page_size, /* dontunmap= */ false);
12091464 mremap_move_multiple_vmas_split(pattern_seed, page_size, /* dontunmap= */ true);
1465+ mremap_move_multi_invalid_vmas(maps_fp, page_size);
1466+
1467+ fclose(maps_fp);
12101468
12111469 if (run_perf_tests) {
12121470 ksft_print_msg("\n%s\n",
tools/testing/selftests/sched_ext/hotplug.c+0−1
@@ -6,7 +6,6 @@ · 5 unmodified lines
66 #include <bpf/bpf.h>
77 #include <sched.h>
88 #include <scx/common.h>
9−#include <sched.h>
109 #include <sys/wait.h>
1110 #include <unistd.h>
1211
tools/testing/selftests/ublk/kublk.c+2−2
@@ -1400,7 +1400,7 @@ static int cmd_dev_get_features(void) · 1399 unmodified lines
14001400
14011401 if (!((1ULL << i) & features))
14021402 continue;
1403− if (i < sizeof(feat_map) / sizeof(feat_map[0]))
1403+ if (i < ARRAY_SIZE(feat_map))
14041404 feat = feat_map[i];
14051405 else
14061406 feat = "unknown";
@@ -1477,7 +1477,7 @@ static void __cmd_create_help(char *exe, bool recovery) · 70 unmodified lines
14771477 printf("\tdefault: nr_queues=2(max 32), depth=128(max 1024), dev_id=-1(auto allocation)\n");
14781478 printf("\tdefault: nthreads=nr_queues");
14791479
1480− for (i = 0; i < sizeof(tgt_ops_list) / sizeof(tgt_ops_list[0]); i++) {
1480+ for (i = 0; i < ARRAY_SIZE(tgt_ops_list); i++) {
14811481 const struct ublk_tgt_ops *ops = tgt_ops_list[i];
14821482
14831483 if (ops->usage)
tools/testing/shared/linux/idr.h+4−0
@@ -1 +1,5 @@
1+/* Avoid duplicate definitions due to system headers. */
2+#ifdef __CONCAT
3+#undef __CONCAT
4+#endif
15 #include "../../../../include/linux/idr.h"
tools/tracing/latency/Makefile.config+8−0
@@ -1,7 +1,15 @@
11 # SPDX-License-Identifier: GPL-2.0-only
22
3+include $(srctree)/tools/scripts/utilities.mak
4+
35 STOP_ERROR :=
46
7+ifndef ($(NO_LIBTRACEEVENT),1)
8+ ifeq ($(call get-executable,$(PKG_CONFIG)),)
9+ $(error Error: $(PKG_CONFIG) needed by libtraceevent/libtracefs is missing on this system, please install it)
10+ endif
11+endif
12+
513 define lib_setup
614 $(eval LIB_INCLUDES += $(shell sh -c "$(PKG_CONFIG) --cflags lib$(1)"))
715 $(eval LDFLAGS += $(shell sh -c "$(PKG_CONFIG) --libs-only-L lib$(1)"))
tools/tracing/rtla/Makefile.config+8−0
@@ -1,10 +1,18 @@
11 # SPDX-License-Identifier: GPL-2.0-only
22
3+include $(srctree)/tools/scripts/utilities.mak
4+
35 STOP_ERROR :=
46
57 LIBTRACEEVENT_MIN_VERSION = 1.5
68 LIBTRACEFS_MIN_VERSION = 1.6
79
10+ifndef ($(NO_LIBTRACEEVENT),1)
11+ ifeq ($(call get-executable,$(PKG_CONFIG)),)
12+ $(error Error: $(PKG_CONFIG) needed by libtraceevent/libtracefs is missing on this system, please install it)
13+ endif
14+endif
15+
816 define lib_setup
917 $(eval LIB_INCLUDES += $(shell sh -c "$(PKG_CONFIG) --cflags lib$(1)"))
1018 $(eval LDFLAGS += $(shell sh -c "$(PKG_CONFIG) --libs-only-L lib$(1)"))