History

Merge 6.17-rc3 into char-misc-next

We need the char/misc/iio fixes in here as well to build on.

Greg Kroah-Hartman committed 1 year ago

Commit 5b9057c2 parents 73c9417 1b237f1375 files · +4394 −1812Browse files

Unified · Split

375 files
  1. .mailmap +2 −0
  2. Documentation/admin-guide/cgroup-v2.rst +2 −2
  3. Documentation/core-api/symbol-namespaces.rst +6 −5
  4. Documentation/devicetree/bindings/regulator/infineon,ir38060.yaml +1 −1
  5. Documentation/networking/mptcp-sysctl.rst +2 −0
  6. Documentation/process/security-bugs.rst +16 −9
  7. Documentation/userspace-api/iommufd.rst +2 −2
  8. MAINTAINERS +34 −4
  9. Makefile +1 −1
  10. arch/loongarch/Makefile +6 −0
  11. arch/loongarch/include/asm/stackframe.h +1 −1
  12. arch/loongarch/include/uapi/asm/setup.h +8 −0
  13. arch/loongarch/kernel/module-sections.c +18 −18
  14. arch/loongarch/kernel/signal.c +5 −5
  15. arch/loongarch/kernel/time.c +22 −0
  16. arch/loongarch/kvm/intc/eiointc.c +6 −1
  17. arch/loongarch/kvm/intc/ipi.c +4 −4
  18. arch/loongarch/kvm/intc/pch_pic.c +10 −0
  19. arch/loongarch/kvm/vcpu.c +5 −3
  20. arch/mips/boot/dts/lantiq/danube_easy50712.dts +4 −1
  21. arch/mips/lantiq/xway/sysctrl.c +5 −5
  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/block/loop.c +21 −18
  41. drivers/bluetooth/btmtk.c +1 −6
  42. drivers/bluetooth/btnxpuart.c +4 −4
  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/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +1 −1
  50. drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +2 −1
  51. drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 −1
  52. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 −0
  53. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c +19 −0
  54. drivers/gpu/drm/amd/display/dc/bios/bios_parser.c +1 −4
  55. drivers/gpu/drm/amd/display/dc/bios/command_table.c +1 −1
  56. drivers/gpu/drm/amd/display/dc/clk_mgr/dce100/dce_clk_mgr.c +5 −9
  57. drivers/gpu/drm/amd/display/dc/clk_mgr/dce110/dce110_clk_mgr.c +23 −17
  58. drivers/gpu/drm/amd/display/dc/clk_mgr/dce60/dce60_clk_mgr.c +9 −22
  59. drivers/gpu/drm/amd/display/dc/core/dc.c +14 −1
  60. drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c +4 −4
  61. drivers/gpu/drm/amd/display/dc/dce/dmub_replay.c +3 −40
  62. drivers/gpu/drm/amd/display/dc/dce/dmub_replay.h +1 −1
  63. drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c +1 −1
  64. drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h +0 −20
  65. drivers/gpu/drm/amd/display/modules/hdcp/hdcp_psp.c +3 −0
  66. drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +25 −5
  67. drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +2 −2
  68. drivers/gpu/drm/drm_gpuvm.c +2 −0
  69. drivers/gpu/drm/drm_panic_qr.rs +21 −1
  70. drivers/gpu/drm/hisilicon/hibmc/dp/dp_link.c +12 −2
  71. drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c +13 −9
  72. drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h +1 −0
  73. drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_i2c.c +5 −0
  74. drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c +8 −3
  75. drivers/gpu/drm/i915/display/intel_display_irq.c +4 −0
  76. drivers/gpu/drm/i915/display/intel_tc.c +75 −18
  77. drivers/gpu/drm/i915/gt/intel_workarounds.c +11 −9
  78. drivers/gpu/drm/nouveau/nouveau_exec.c +3 −3
  79. drivers/gpu/drm/nouveau/nvif/vmm.c +2 −1
  80. drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/rpc.c +2 −2
  81. drivers/gpu/drm/nova/file.rs +2 −1
  82. drivers/gpu/drm/rockchip/Kconfig +1 −0
  83. drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +5 −4
  84. drivers/gpu/drm/tests/drm_format_helper_test.c +2 −1
  85. drivers/gpu/drm/xe/xe_migrate.c +1 −1
  86. drivers/gpu/drm/xe/xe_pxp_submit.c +1 −1
  87. drivers/gpu/drm/xe/xe_vm.c +23 −25
  88. drivers/gpu/drm/xe/xe_vm.h +1 −1
  89. drivers/i2c/busses/i2c-rtl9300.c +12 −8
  90. drivers/iio/accel/sca3300.c +1 −1
  91. drivers/iio/adc/Kconfig +1 −1
  92. drivers/iio/adc/ad7124.c +7 −7
  93. drivers/iio/adc/ad7173.c +75 −12
  94. drivers/iio/adc/ad7380.c +1 −0
  95. drivers/iio/adc/rzg2l_adc.c +10 −23
  96. drivers/iio/imu/inv_icm42600/inv_icm42600_temp.c +5 −1
  97. drivers/iio/light/as73211.c +1 −1
  98. drivers/iio/pressure/bmp280-core.c +5 −4
  99. drivers/iio/proximity/isl29501.c +11 −5
  100. drivers/iio/temperature/maxim_thermocouple.c +16 −10
  101. drivers/infiniband/core/umem_odp.c +2 −2
  102. drivers/infiniband/hw/bnxt_re/ib_verbs.c +2 −6
  103. drivers/infiniband/hw/bnxt_re/main.c +23 −0
  104. drivers/infiniband/hw/bnxt_re/qplib_fp.c +1 −29
  105. drivers/infiniband/hw/bnxt_re/qplib_fp.h +0 −2
  106. drivers/infiniband/hw/bnxt_re/qplib_res.c +2 −0
  107. drivers/infiniband/hw/erdma/erdma_verbs.c +5 −1
  108. drivers/infiniband/hw/hns/hns_roce_hw_v2.c +3 −3
  109. drivers/infiniband/hw/hns/hns_roce_restrack.c +8 −1
  110. drivers/infiniband/sw/rxe/rxe_net.c +8 −21
  111. drivers/infiniband/sw/rxe/rxe_qp.c +1 −1
  112. drivers/iommu/amd/init.c +2 −2
  113. drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +1 −1
  114. drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c +5 −3
  115. drivers/iommu/iommufd/viommu.c +2 −2
  116. drivers/iommu/riscv/iommu.c +1 −1
  117. drivers/iommu/virtio-iommu.c +9 −6
  118. drivers/md/md.c +92 −30
  119. drivers/memstick/core/memstick.c +0 −1
  120. drivers/memstick/host/rtsx_usb_ms.c +1 −0
  121. drivers/mmc/host/sdhci-of-arasan.c +31 −2
  122. drivers/mmc/host/sdhci-pci-gli.c +21 −16
  123. drivers/mmc/host/sdhci_am654.c +18 −0
  124. drivers/most/core.c +1 −1
  125. drivers/net/bonding/bond_3ad.c +49 −18
  126. drivers/net/bonding/bond_options.c +1 −0
  127. drivers/net/dsa/b53/b53_common.c +1 −1
  128. drivers/net/dsa/microchip/ksz_common.c +6 −0
  129. drivers/net/ethernet/airoha/airoha_ppe.c +1 −3
  130. drivers/net/ethernet/broadcom/bnxt/bnxt.c +1 −1
  131. drivers/net/ethernet/cadence/macb_main.c +2 −1
  132. drivers/net/ethernet/google/gve/gve_main.c +2 −0
  133. drivers/net/ethernet/intel/igc/igc_main.c +7 −7
  134. drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +11 −23
  135. drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c +3 −1
  136. drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c +2 −2
  137. drivers/net/ethernet/mediatek/mtk_ppe_offload.c +2 −0
  138. drivers/net/ethernet/mellanox/mlx5/core/en/dcbnl.h +0 −1
  139. drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c +8 −10
  140. drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs_hmfs.c +2 −0
  141. drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c +9 −3
  142. drivers/net/ethernet/mellanox/mlx5/core/esw/devlink_port.c +3 −1
  143. drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c +98 −85
  144. drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +0 −5
  145. drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h +2 −0
  146. drivers/net/ethernet/mellanox/mlx5/core/port.c +20 −0
  147. drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c +62 −19
  148. drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc_complex.c +28 −13
  149. drivers/net/ethernet/mellanox/mlx5/core/steering/hws/cmd.c +1 −0
  150. drivers/net/ethernet/mellanox/mlx5/core/steering/hws/cmd.h +1 −0
  151. drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c +1 −0
  152. drivers/net/ethernet/mellanox/mlx5/core/steering/hws/matcher.c +4 −1
  153. drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws.h +1 −0
  154. drivers/net/ethernet/mellanox/mlx5/core/steering/hws/send.c +0 −1
  155. drivers/net/ethernet/mellanox/mlx5/core/steering/hws/table.c +10 −3
  156. drivers/net/ethernet/mellanox/mlx5/core/steering/hws/table.h +2 −1
  157. drivers/net/ethernet/mellanox/mlxsw/spectrum.c +2 −0
  158. drivers/net/ethernet/mellanox/mlxsw/trap.h +1 −0
  159. drivers/net/ethernet/microchip/lan865x/lan865x.c +21 −0
  160. drivers/net/ethernet/realtek/rtase/rtase.h +1 −1
  161. drivers/net/ethernet/stmicro/stmmac/dwmac-thead.c +8 −1
  162. drivers/net/ethernet/ti/icssg/icssg_prueth.c +41 −31
  163. drivers/net/ethernet/wangxun/libwx/wx_vf_lib.c +1 −1
  164. drivers/net/ethernet/xilinx/xilinx_axienet_main.c +6 −2
  165. drivers/net/phy/mscc/mscc.h +12 −0
  166. drivers/net/phy/mscc/mscc_main.c +12 −0
  167. drivers/net/phy/mscc/mscc_ptp.c +37 −12
  168. drivers/net/ppp/ppp_generic.c +11 −6
  169. drivers/net/pse-pd/pd692x0.c +48 −15
  170. drivers/net/usb/asix_devices.c +1 −1
  171. drivers/net/usb/cdc_ncm.c +7 −0
  172. drivers/pci/controller/pcie-xilinx.c +1 −1
  173. drivers/pci/controller/vmd.c +0 −3
  174. drivers/platform/x86/amd/hsmp/acpi.c +1 −1
  175. drivers/platform/x86/amd/hsmp/hsmp.c +5 −0
  176. drivers/platform/x86/amd/pmc/pmc-quirks.c +34 −20
  177. drivers/platform/x86/amd/pmc/pmc.c +0 −13
  178. drivers/platform/x86/dell/dell-smbios-base.c +9 −10
  179. drivers/platform/x86/dell/dell-smbios-smm.c +1 −2
  180. drivers/platform/x86/dell/dell-smbios-wmi.c +1 −3
  181. drivers/platform/x86/dell/dell-smbios.h +1 −1
  182. drivers/platform/x86/hp/hp-wmi.c +2 −2
  183. drivers/platform/x86/intel/uncore-frequency/uncore-frequency-tpmi.c +5 −0
  184. drivers/regulator/pca9450-regulator.c +5 −8
  185. drivers/regulator/tps65219-regulator.c +6 −6
  186. drivers/s390/char/sclp.c +9 −2
  187. drivers/scsi/fnic/fnic.h +0 −2
  188. drivers/scsi/qla4xxx/ql4_os.c +2 −0
  189. drivers/spi/spi-fsl-lpspi.c +3 −5
  190. drivers/spi/spi-mem.c +4 −0
  191. drivers/spi/spi-qpic-snand.c +15 −7
  192. drivers/spi/spi-st-ssc4.c +5 −5
  193. drivers/tty/serial/8250/8250_rsa.c +4 −4
  194. drivers/ufs/core/ufshcd.c +44 −32
  195. drivers/ufs/host/ufs-qcom.c +15 −24
  196. drivers/ufs/host/ufshcd-pci.c +1 −0
  197. drivers/usb/chipidea/ci_hdrc_imx.c +2 −1
  198. drivers/usb/chipidea/usbmisc_imx.c +16 −7
  199. drivers/usb/core/hcd.c +16 −12
  200. drivers/usb/core/quirks.c +1 −0
  201. drivers/usb/dwc3/dwc3-pci.c +2 −0
  202. drivers/usb/dwc3/ep0.c +16 −4
  203. drivers/usb/dwc3/gadget.c +17 −2
  204. drivers/usb/gadget/udc/tegra-xudc.c +7 −2
  205. drivers/usb/host/xhci-hub.c +1 −2
  206. drivers/usb/host/xhci-mem.c +11 −11
  207. drivers/usb/host/xhci-pci-renesas.c +4 −3
  208. drivers/usb/host/xhci-ring.c +7 −2
  209. drivers/usb/host/xhci.c +16 −7
  210. drivers/usb/host/xhci.h +2 −1
  211. drivers/usb/storage/realtek_cr.c +1 −1
  212. drivers/usb/storage/unusual_devs.h +29 −0
  213. drivers/usb/typec/tcpm/fusb302.c +8 −4
  214. drivers/usb/typec/tcpm/maxim_contaminant.c +58 −0
  215. drivers/usb/typec/tcpm/tcpci_maxim.h +1 −0
  216. drivers/xen/xenbus/xenbus_xs.c +0 −23
  217. fs/anon_inodes.c +1 −1
  218. fs/btrfs/extent_io.c +19 −5
  219. fs/btrfs/inode.c +19 −10
  220. fs/btrfs/subpage.c +18 −1
  221. fs/btrfs/super.c +8 −5
  222. fs/btrfs/zoned.c +99 −34
  223. fs/buffer.c +1 −1
  224. fs/coredump.c +1 −1
  225. fs/debugfs/inode.c +10 −1
  226. fs/ext4/fsmap.c +20 −3
  227. fs/ext4/indirect.c +2 −2
  228. fs/ext4/inode.c +2 −2
  229. fs/ext4/namei.c +0 −4
  230. fs/ext4/orphan.c +3 −2
  231. fs/ext4/page-io.c +1 −1
  232. fs/ext4/super.c +8 −4
  233. fs/fhandle.c +1 −1
  234. fs/fs-writeback.c +5 −4
  235. fs/fuse/inode.c +0 −5
  236. fs/iomap/direct-io.c +7 −7
  237. fs/jbd2/checkpoint.c +1 −0
  238. fs/kernfs/inode.c +2 −2
  239. fs/namespace.c +44 −32
  240. fs/netfs/read_collect.c +3 −1
  241. fs/netfs/write_collect.c +8 −2
  242. fs/netfs/write_issue.c +2 −2
  243. fs/nfs/pagelist.c +5 −4
  244. fs/nfs/write.c +10 −19
  245. fs/overlayfs/dir.c +1 −1
  246. fs/overlayfs/util.c +2 −1
  247. fs/pidfs.c +1 −1
  248. fs/pnode.c +6 −4
  249. fs/smb/client/smb2ops.c +1 −1
  250. fs/smb/server/connection.c +2 −1
  251. fs/smb/server/connection.h +6 −1
  252. fs/smb/server/oplock.c +10 −3
  253. fs/smb/server/transport_rdma.c +4 −1
  254. fs/smb/server/transport_rdma.h +3 −1
  255. fs/smb/server/transport_tcp.c +23 −3
  256. fs/splice.c +3 −0
  257. fs/squashfs/super.c +7 −7
  258. include/linux/blkdev.h +1 −0
  259. include/linux/compiler.h +0 −8
  260. include/linux/cpuhotplug.h +1 −0
  261. include/linux/export.h +1 −1
  262. include/linux/iosys-map.h +1 −6
  263. include/linux/iov_iter.h +11 −9
  264. include/linux/kcov.h +9 −38
  265. include/linux/migrate.h +5 −0
  266. include/linux/netfs.h +1 −0
  267. include/linux/nfs_page.h +1 −0
  268. include/net/bluetooth/bluetooth.h +2 −2
  269. include/net/bluetooth/hci_core.h +38 −6
  270. include/net/bond_3ad.h +1 −0
  271. include/net/sch_generic.h +8 −3
  272. include/sound/cs35l56.h +3 −2
  273. include/sound/tas2781-tlv.h +3 −3
  274. include/uapi/linux/pfrut.h +1 −0
  275. include/uapi/linux/raid/md_p.h +1 −1
  276. io_uring/futex.c +3 −0
  277. io_uring/io_uring.c +1 −0
  278. kernel/Kconfig.kexec +1 −0
  279. kernel/cgroup/cpuset.c +5 −6
  280. kernel/cgroup/rstat.c +3 −0
  281. kernel/events/core.c +6 −0
  282. kernel/kexec_handover.c +25 −4
  283. kernel/params.c +4 −3
  284. kernel/sched/ext.c +4 −0
  285. kernel/signal.c +5 −1
  286. kernel/trace/fgraph.c +1 −0
  287. kernel/trace/ftrace.c +10 −9
  288. kernel/trace/ring_buffer.c +1 −1
  289. kernel/trace/trace.c +14 −8
  290. kernel/trace/trace.h +8 −2
  291. kernel/trace/trace_functions_graph.c +16 −6
  292. lib/crypto/Kconfig +5 −5
  293. lib/crypto/Makefile +4 −4
  294. mm/balloon_compaction.c +6 −0
  295. mm/damon/core.c +14 −1
  296. mm/damon/sysfs-schemes.c +1 −1
  297. mm/debug_vm_pgtable.c +7 −2
  298. mm/memory-failure.c +8 −0
  299. mm/migrate.c +30 −8
  300. mm/mremap.c +47 −35
  301. mm/vmscan.c +2 −2
  302. mm/zsmalloc.c +10 −0
  303. net/bluetooth/hci_conn.c +14 −3
  304. net/bluetooth/hci_event.c +10 −5
  305. net/bluetooth/hci_sync.c +16 −9
  306. net/bluetooth/iso.c +8 −8
  307. net/bluetooth/mgmt.c +6 −6
  308. net/bridge/br_multicast.c +16 −0
  309. net/bridge/br_private.h +2 −0
  310. net/core/dev.c +12 −0
  311. net/hsr/hsr_slave.c +7 −1
  312. net/ipv4/netfilter/nf_reject_ipv4.c +2 −4
  313. net/ipv6/netfilter/nf_reject_ipv6.c +2 −3
  314. net/ipv6/seg6_hmac.c +5 −1
  315. net/mptcp/options.c +4 −2
  316. net/mptcp/pm.c +12 −6
  317. net/mptcp/pm_kernel.c +0 −1
  318. net/sched/sch_cake.c +12 −2
  319. net/sched/sch_codel.c +7 −5
  320. net/sched/sch_dualpi2.c +3 −2
  321. net/sched/sch_fq.c +7 −5
  322. net/sched/sch_fq_codel.c +7 −5
  323. net/sched/sch_fq_pie.c +7 −5
  324. net/sched/sch_hhf.c +7 −5
  325. net/sched/sch_htb.c +1 −1
  326. net/sched/sch_pie.c +7 −5
  327. net/smc/af_smc.c +2 −1
  328. net/tls/tls_sw.c +6 −1
  329. rust/kernel/alloc/allocator.rs +18 −12
  330. rust/kernel/alloc/allocator_test.rs +11 −0
  331. rust/kernel/device.rs +184 −24
  332. rust/kernel/devres.rs +18 −9
  333. rust/kernel/driver.rs +87 −2
  334. rust/kernel/drm/device.rs +25 −7
  335. rust/kernel/faux.rs +1 −1
  336. sound/core/timer.c +2 −2
  337. sound/hda/codecs/realtek/alc269.c +22 −9
  338. sound/hda/codecs/side-codecs/tas2781_hda_i2c.c +2 −2
  339. sound/hda/codecs/side-codecs/tas2781_hda_spi.c +4 −2
  340. sound/soc/codecs/cs35l56-sdw.c +0 −69
  341. sound/soc/codecs/cs35l56-shared.c +26 −3
  342. sound/soc/codecs/cs35l56.c +1 −1
  343. sound/soc/codecs/cs35l56.h +0 −3
  344. sound/soc/codecs/es8389.c +1 −1
  345. sound/soc/codecs/tas2781-i2c.c +2 −2
  346. sound/usb/stream.c +1 −1
  347. sound/usb/validate.c +1 −1
  348. tools/bootconfig/main.c +2 −2
  349. tools/include/linux/args.h +28 −0
  350. tools/objtool/arch/loongarch/special.c +23 −0
  351. tools/power/cpupower/man/cpupower-set.1 +4 −3
  352. tools/power/cpupower/utils/cpufreq-info.c +15 −1
  353. tools/power/cpupower/utils/cpupower-set.c +3 −2
  354. tools/power/cpupower/utils/helpers/helpers.h +7 −7
  355. tools/power/cpupower/utils/helpers/misc.c +54 −22
  356. tools/testing/selftests/coredump/stackdump_test.c +0 −3
  357. tools/testing/selftests/damon/Makefile +1 −0
  358. tools/testing/selftests/drivers/net/bonding/Makefile +2 −1
  359. tools/testing/selftests/drivers/net/bonding/bond_passive_lacp.sh +105 −0
  360. tools/testing/selftests/drivers/net/bonding/config +1 −0
  361. tools/testing/selftests/mm/mremap_test.c +261 −3
  362. tools/testing/selftests/mount_setattr/mount_setattr_test.c +64 −13
  363. tools/testing/selftests/net/forwarding/router.sh +29 −0
  364. tools/testing/selftests/net/mptcp/mptcp_connect.c +3 −2
  365. tools/testing/selftests/net/mptcp/mptcp_inq.c +3 −2
  366. tools/testing/selftests/net/mptcp/mptcp_join.sh +1 −0
  367. tools/testing/selftests/net/mptcp/mptcp_sockopt.c +3 −2
  368. tools/testing/selftests/net/mptcp/pm_netlink.sh +1 −0
  369. tools/testing/selftests/net/tls.c +300 −12
  370. tools/testing/selftests/sched_ext/hotplug.c +0 −1
  371. tools/testing/selftests/tc-testing/tc-tests/infra/qdiscs.json +198 −0
  372. tools/testing/selftests/ublk/kublk.c +2 −2
  373. tools/testing/shared/linux/idr.h +4 −0
  374. tools/tracing/latency/Makefile.config +8 −0
  375. 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>
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/core-api/symbol-namespaces.rst+6−5
@@ -76,20 +76,21 @@ unit as preprocessor statement. The above example would then read:: · 75 unmodified lines
7676 within the corresponding compilation unit before the #include for
7777 <linux/export.h>. Typically it's placed before the first #include statement.
7878
79−Using the EXPORT_SYMBOL_GPL_FOR_MODULES() macro
80−-----------------------------------------------
79+Using the EXPORT_SYMBOL_FOR_MODULES() macro
80+-------------------------------------------
8181
8282 Symbols exported using this macro are put into a module namespace. This
83−namespace cannot be imported.
83+namespace cannot be imported. These exports are GPL-only as they are only
84+intended for in-tree modules.
8485
8586 The macro takes a comma separated list of module names, allowing only those
8687 modules to access this symbol. Simple tail-globs are supported.
8788
8889 For example::
8990
90− EXPORT_SYMBOL_GPL_FOR_MODULES(preempt_notifier_inc, "kvm,kvm-*")
91+ EXPORT_SYMBOL_FOR_MODULES(preempt_notifier_inc, "kvm,kvm-*")
9192
92−will limit usage of this symbol to modules whoes name matches the given
93+will limit usage of this symbol to modules whose name matches the given
9394 patterns.
9495
9596 How to use Symbols exported in Namespaces
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/networking/mptcp-sysctl.rst+2−0
@@ -12,6 +12,8 @@ add_addr_timeout - INTEGER (seconds) · 11 unmodified lines
1212 resent to an MPTCP peer that has not acknowledged a previous
1313 ADD_ADDR message.
1414
15+ Do not retransmit if set to 0.
16+
1517 The default value matches TCP_RTO_MAX. This is a per-namespace
1618 sysctl.
1719
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+34−4
@@ -8427,6 +8427,17 @@ T: git https://gitlab.freedesktop.org/drm/misc/kernel.git · 8426 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>
@@ -22175,7 +22205,7 @@ F: arch/s390/mm · 5918 unmodified lines
2217522205
2217622206 S390 NETWORK DRIVERS
2217722207 M: Alexandra Winter <wintera@linux.ibm.com>
22178−M: Thorsten Winkler <twinkler@linux.ibm.com>
22208+R: Aswin Karuvally <aswin@linux.ibm.com>
2217922209 L: linux-s390@vger.kernel.org
2218022210 L: netdev@vger.kernel.org
2218122211 S: Supported
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/loongarch/Makefile+6−0
@@ -102,7 +102,13 @@ KBUILD_CFLAGS += $(call cc-option,-mthin-add-sub) $(call cc-option,-Wa$(comma) · 101 unmodified lines
102102
103103 ifdef CONFIG_OBJTOOL
104104 ifdef CONFIG_CC_HAS_ANNOTATE_TABLEJUMP
105+# The annotate-tablejump option can not be passed to LLVM backend when LTO is enabled.
106+# Ensure it is aware of linker with LTO, '--loongarch-annotate-tablejump' also needs to
107+# be passed via '-mllvm' to ld.lld.
105108 KBUILD_CFLAGS += -mannotate-tablejump
109+ifdef CONFIG_LTO_CLANG
110+KBUILD_LDFLAGS += -mllvm --loongarch-annotate-tablejump
111+endif
106112 else
107113 KBUILD_CFLAGS += -fno-jump-tables # keep compatibility with older compilers
108114 endif
arch/loongarch/include/asm/stackframe.h+1−1
@@ -58,7 +58,7 @@ · 57 unmodified lines
5858 .endm
5959
6060 .macro STACKLEAK_ERASE
61−#ifdef CONFIG_GCC_PLUGIN_STACKLEAK
61+#ifdef CONFIG_KSTACK_ERASE
6262 bl stackleak_erase_on_task_stack
6363 #endif
6464 .endm
arch/loongarch/include/uapi/asm/setup.h+8−0
@@ -0,0 +1,8 @@
1+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2+
3+#ifndef _UAPI_ASM_LOONGARCH_SETUP_H
4+#define _UAPI_ASM_LOONGARCH_SETUP_H
5+
6+#define COMMAND_LINE_SIZE 4096
7+
8+#endif /* _UAPI_ASM_LOONGARCH_SETUP_H */
arch/loongarch/kernel/module-sections.c+18−18
@@ -8,6 +8,7 @@ · 7 unmodified lines
88 #include <linux/module.h>
99 #include <linux/moduleloader.h>
1010 #include <linux/ftrace.h>
11+#include <linux/sort.h>
1112
1213 Elf_Addr module_emit_got_entry(struct module *mod, Elf_Shdr *sechdrs, Elf_Addr val)
1314 {
@@ -61,39 +62,38 @@ Elf_Addr module_emit_plt_entry(struct module *mod, Elf_Shdr *sechdrs, Elf_Addr v · 47 unmodified lines
6162 return (Elf_Addr)&plt[nr];
6263 }
6364
64−static int is_rela_equal(const Elf_Rela *x, const Elf_Rela *y)
65−{
66− return x->r_info == y->r_info && x->r_addend == y->r_addend;
67−}
65+#define cmp_3way(a, b) ((a) < (b) ? -1 : (a) > (b))
6866
69−static bool duplicate_rela(const Elf_Rela *rela, int idx)
67+static int compare_rela(const void *x, const void *y)
7068 {
71− int i;
69+ int ret;
70+ const Elf_Rela *rela_x = x, *rela_y = y;
7271
73− for (i = 0; i < idx; i++) {
74− if (is_rela_equal(&rela[i], &rela[idx]))
75− return true;
76− }
72+ ret = cmp_3way(rela_x->r_info, rela_y->r_info);
73+ if (ret == 0)
74+ ret = cmp_3way(rela_x->r_addend, rela_y->r_addend);
7775
78− return false;
76+ return ret;
7977 }
8078
8179 static void count_max_entries(Elf_Rela *relas, int num,
8280 unsigned int *plts, unsigned int *gots)
8381 {
84− unsigned int i, type;
82+ unsigned int i;
83+
84+ sort(relas, num, sizeof(Elf_Rela), compare_rela, NULL);
8585
8686 for (i = 0; i < num; i++) {
87− type = ELF_R_TYPE(relas[i].r_info);
88− switch (type) {
87+ if (i && !compare_rela(&relas[i-1], &relas[i]))
88+ continue;
89+
90+ switch (ELF_R_TYPE(relas[i].r_info)) {
8991 case R_LARCH_SOP_PUSH_PLT_PCREL:
9092 case R_LARCH_B26:
91− if (!duplicate_rela(relas, i))
92− (*plts)++;
93+ (*plts)++;
9394 break;
9495 case R_LARCH_GOT_PC_HI20:
95− if (!duplicate_rela(relas, i))
96− (*gots)++;
96+ (*gots)++;
9797 break;
9898 default:
9999 break; /* Do nothing. */
arch/loongarch/kernel/signal.c+5−5
@@ -677,6 +677,11 @@ static int setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, · 676 unmodified lines
677677 for (i = 1; i < 32; i++)
678678 err |= __put_user(regs->regs[i], &sc->sc_regs[i]);
679679
680+#ifdef CONFIG_CPU_HAS_LBT
681+ if (extctx->lbt.addr)
682+ err |= protected_save_lbt_context(extctx);
683+#endif
684+
680685 if (extctx->lasx.addr)
681686 err |= protected_save_lasx_context(extctx);
682687 else if (extctx->lsx.addr)
@@ -684,11 +689,6 @@ static int setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, · 1 unmodified line
684689 else if (extctx->fpu.addr)
685690 err |= protected_save_fpu_context(extctx);
686691
687−#ifdef CONFIG_CPU_HAS_LBT
688− if (extctx->lbt.addr)
689− err |= protected_save_lbt_context(extctx);
690−#endif
691−
692692 /* Set the "end" magic */
693693 info = (struct sctx_info *)extctx->end.addr;
694694 err |= __put_user(0, &info->magic);
arch/loongarch/kernel/time.c+22−0
@@ -5,6 +5,7 @@ · 4 unmodified lines
55 * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
66 */
77 #include <linux/clockchips.h>
8+#include <linux/cpuhotplug.h>
89 #include <linux/delay.h>
910 #include <linux/export.h>
1011 #include <linux/init.h>
@@ -102,6 +103,23 @@ static int constant_timer_next_event(unsigned long delta, struct clock_event_dev · 91 unmodified lines
102103 return 0;
103104 }
104105
106+static int arch_timer_starting(unsigned int cpu)
107+{
108+ set_csr_ecfg(ECFGF_TIMER);
109+
110+ return 0;
111+}
112+
113+static int arch_timer_dying(unsigned int cpu)
114+{
115+ constant_set_state_shutdown(this_cpu_ptr(&constant_clockevent_device));
116+
117+ /* Clear Timer Interrupt */
118+ write_csr_tintclear(CSR_TINTCLR_TI);
119+
120+ return 0;
121+}
122+
105123 static unsigned long get_loops_per_jiffy(void)
106124 {
107125 unsigned long lpj = (unsigned long)const_clock_freq;
@@ -172,6 +190,10 @@ int constant_clockevent_init(void) · 64 unmodified lines
172190 lpj_fine = get_loops_per_jiffy();
173191 pr_info("Constant clock event device register\n");
174192
193+ cpuhp_setup_state(CPUHP_AP_LOONGARCH_ARCH_TIMER_STARTING,
194+ "clockevents/loongarch/timer:starting",
195+ arch_timer_starting, arch_timer_dying);
196+
175197 return 0;
176198 }
177199
arch/loongarch/kvm/intc/eiointc.c+6−1
@@ -45,7 +45,12 @@ static void eiointc_update_irq(struct loongarch_eiointc *s, int irq, int level) · 44 unmodified lines
4545 }
4646
4747 cpu = s->sw_coremap[irq];
48− vcpu = kvm_get_vcpu(s->kvm, cpu);
48+ vcpu = kvm_get_vcpu_by_id(s->kvm, cpu);
49+ if (unlikely(vcpu == NULL)) {
50+ kvm_err("%s: invalid target cpu: %d\n", __func__, cpu);
51+ return;
52+ }
53+
4954 if (level) {
5055 /* if not enable return false */
5156 if (!test_bit(irq, (unsigned long *)s->enable.reg_u32))
arch/loongarch/kvm/intc/ipi.c+4−4
@@ -99,7 +99,7 @@ static void write_mailbox(struct kvm_vcpu *vcpu, int offset, uint64_t data, int · 98 unmodified lines
9999 static int send_ipi_data(struct kvm_vcpu *vcpu, gpa_t addr, uint64_t data)
100100 {
101101 int i, idx, ret;
102− uint32_t val = 0, mask = 0;
102+ uint64_t val = 0, mask = 0;
103103
104104 /*
105105 * Bit 27-30 is mask for byte writing.
@@ -108,7 +108,7 @@ static int send_ipi_data(struct kvm_vcpu *vcpu, gpa_t addr, uint64_t data) · 2 unmodified lines
108108 if ((data >> 27) & 0xf) {
109109 /* Read the old val */
110110 idx = srcu_read_lock(&vcpu->kvm->srcu);
111− ret = kvm_io_bus_read(vcpu, KVM_IOCSR_BUS, addr, sizeof(val), &val);
111+ ret = kvm_io_bus_read(vcpu, KVM_IOCSR_BUS, addr, 4, &val);
112112 srcu_read_unlock(&vcpu->kvm->srcu, idx);
113113 if (unlikely(ret)) {
114114 kvm_err("%s: : read data from addr %llx failed\n", __func__, addr);
@@ -124,7 +124,7 @@ static int send_ipi_data(struct kvm_vcpu *vcpu, gpa_t addr, uint64_t data) · 9 unmodified lines
124124 }
125125 val |= ((uint32_t)(data >> 32) & ~mask);
126126 idx = srcu_read_lock(&vcpu->kvm->srcu);
127− ret = kvm_io_bus_write(vcpu, KVM_IOCSR_BUS, addr, sizeof(val), &val);
127+ ret = kvm_io_bus_write(vcpu, KVM_IOCSR_BUS, addr, 4, &val);
128128 srcu_read_unlock(&vcpu->kvm->srcu, idx);
129129 if (unlikely(ret))
130130 kvm_err("%s: : write data to addr %llx failed\n", __func__, addr);
@@ -298,7 +298,7 @@ static int kvm_ipi_regs_access(struct kvm_device *dev, · 167 unmodified lines
298298 cpu = (attr->attr >> 16) & 0x3ff;
299299 addr = attr->attr & 0xff;
300300
301− vcpu = kvm_get_vcpu(dev->kvm, cpu);
301+ vcpu = kvm_get_vcpu_by_id(dev->kvm, cpu);
302302 if (unlikely(vcpu == NULL)) {
303303 kvm_err("%s: invalid target cpu: %d\n", __func__, cpu);
304304 return -EINVAL;
arch/loongarch/kvm/intc/pch_pic.c+10−0
@@ -195,6 +195,11 @@ static int kvm_pch_pic_read(struct kvm_vcpu *vcpu, · 194 unmodified lines
195195 return -EINVAL;
196196 }
197197
198+ if (addr & (len - 1)) {
199+ kvm_err("%s: pch pic not aligned addr %llx len %d\n", __func__, addr, len);
200+ return -EINVAL;
201+ }
202+
198203 /* statistics of pch pic reading */
199204 vcpu->stat.pch_pic_read_exits++;
200205 ret = loongarch_pch_pic_read(s, addr, len, val);
@@ -302,6 +307,11 @@ static int kvm_pch_pic_write(struct kvm_vcpu *vcpu, · 101 unmodified lines
302307 return -EINVAL;
303308 }
304309
310+ if (addr & (len - 1)) {
311+ kvm_err("%s: pch pic not aligned addr %llx len %d\n", __func__, addr, len);
312+ return -EINVAL;
313+ }
314+
305315 /* statistics of pch pic writing */
306316 vcpu->stat.pch_pic_write_exits++;
307317 ret = loongarch_pch_pic_write(s, addr, len, val);
arch/loongarch/kvm/vcpu.c+5−3
@@ -1283,9 +1283,11 @@ int kvm_own_lbt(struct kvm_vcpu *vcpu) · 1282 unmodified lines
12831283 return -EINVAL;
12841284
12851285 preempt_disable();
1286− set_csr_euen(CSR_EUEN_LBTEN);
1287− _restore_lbt(&vcpu->arch.lbt);
1288− vcpu->arch.aux_inuse |= KVM_LARCH_LBT;
1286+ if (!(vcpu->arch.aux_inuse & KVM_LARCH_LBT)) {
1287+ set_csr_euen(CSR_EUEN_LBTEN);
1288+ _restore_lbt(&vcpu->arch.lbt);
1289+ vcpu->arch.aux_inuse |= KVM_LARCH_LBT;
1290+ }
12891291 preempt_enable();
12901292
12911293 return 0;
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/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/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/bluetooth/btmtk.c+1−6
@@ -642,12 +642,7 @@ static int btmtk_usb_hci_wmt_sync(struct hci_dev *hdev, · 641 unmodified lines
642642 * WMT command.
643643 */
644644 err = wait_on_bit_timeout(&data->flags, BTMTK_TX_WAIT_VND_EVT,
645− TASK_INTERRUPTIBLE, HCI_INIT_TIMEOUT);
646− if (err == -EINTR) {
647− bt_dev_err(hdev, "Execution of wmt command interrupted");
648− clear_bit(BTMTK_TX_WAIT_VND_EVT, &data->flags);
649− goto err_free_wc;
650− }
645+ TASK_UNINTERRUPTIBLE, HCI_INIT_TIMEOUT);
651646
652647 if (err) {
653648 bt_dev_err(hdev, "Execution of wmt command timed out");
drivers/bluetooth/btnxpuart.c+4−4
@@ -543,10 +543,10 @@ static int ps_setup(struct hci_dev *hdev) · 542 unmodified lines
543543 }
544544
545545 if (psdata->wakeup_source) {
546− ret = devm_request_irq(&serdev->dev, psdata->irq_handler,
547− ps_host_wakeup_irq_handler,
548− IRQF_ONESHOT | IRQF_TRIGGER_FALLING,
549− dev_name(&serdev->dev), nxpdev);
546+ ret = devm_request_threaded_irq(&serdev->dev, psdata->irq_handler,
547+ NULL, ps_host_wakeup_irq_handler,
548+ IRQF_ONESHOT,
549+ dev_name(&serdev->dev), nxpdev);
550550 if (ret)
551551 bt_dev_info(hdev, "error setting wakeup IRQ handler, ignoring\n");
552552 disable_irq(psdata->irq_handler);
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/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/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/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/bonding/bond_3ad.c+49−18
@@ -95,13 +95,13 @@ static int ad_marker_send(struct port *port, struct bond_marker *marker); · 94 unmodified lines
9595 static void ad_mux_machine(struct port *port, bool *update_slave_arr);
9696 static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port);
9797 static void ad_tx_machine(struct port *port);
98−static void ad_periodic_machine(struct port *port, struct bond_params *bond_params);
98+static void ad_periodic_machine(struct port *port);
9999 static void ad_port_selection_logic(struct port *port, bool *update_slave_arr);
100100 static void ad_agg_selection_logic(struct aggregator *aggregator,
101101 bool *update_slave_arr);
102102 static void ad_clear_agg(struct aggregator *aggregator);
103103 static void ad_initialize_agg(struct aggregator *aggregator);
104−static void ad_initialize_port(struct port *port, int lacp_fast);
104+static void ad_initialize_port(struct port *port, const struct bond_params *bond_params);
105105 static void ad_enable_collecting(struct port *port);
106106 static void ad_disable_distributing(struct port *port,
107107 bool *update_slave_arr);
@@ -1307,10 +1307,16 @@ static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port) · 1199 unmodified lines
13071307 * case of EXPIRED even if LINK_DOWN didn't arrive for
13081308 * the port.
13091309 */
1310− port->partner_oper.port_state &= ~LACP_STATE_SYNCHRONIZATION;
13111310 port->sm_vars &= ~AD_PORT_MATCHED;
1311+ /* Based on IEEE 8021AX-2014, Figure 6-18 - Receive
1312+ * machine state diagram, the statue should be
1313+ * Partner_Oper_Port_State.Synchronization = FALSE;
1314+ * Partner_Oper_Port_State.LACP_Timeout = Short Timeout;
1315+ * start current_while_timer(Short Timeout);
1316+ * Actor_Oper_Port_State.Expired = TRUE;
1317+ */
1318+ port->partner_oper.port_state &= ~LACP_STATE_SYNCHRONIZATION;
13121319 port->partner_oper.port_state |= LACP_STATE_LACP_TIMEOUT;
1313− port->partner_oper.port_state |= LACP_STATE_LACP_ACTIVITY;
13141320 port->sm_rx_timer_counter = __ad_timer_to_ticks(AD_CURRENT_WHILE_TIMER, (u16)(AD_SHORT_TIMEOUT));
13151321 port->actor_oper_port_state |= LACP_STATE_EXPIRED;
13161322 port->sm_vars |= AD_PORT_CHURNED;
@@ -1417,11 +1423,10 @@ static void ad_tx_machine(struct port *port) · 100 unmodified lines
14171423 /**
14181424 * ad_periodic_machine - handle a port's periodic state machine
14191425 * @port: the port we're looking at
1420− * @bond_params: bond parameters we will use
14211426 *
14221427 * Turn ntt flag on priodically to perform periodic transmission of lacpdu's.
14231428 */
1424−static void ad_periodic_machine(struct port *port, struct bond_params *bond_params)
1429+static void ad_periodic_machine(struct port *port)
14251430 {
14261431 periodic_states_t last_state;
14271432
@@ -1430,8 +1435,7 @@ static void ad_periodic_machine(struct port *port, struct bond_params *bond_para · 2 unmodified lines
14301435
14311436 /* check if port was reinitialized */
14321437 if (((port->sm_vars & AD_PORT_BEGIN) || !(port->sm_vars & AD_PORT_LACP_ENABLED) || !port->is_enabled) ||
1433− (!(port->actor_oper_port_state & LACP_STATE_LACP_ACTIVITY) && !(port->partner_oper.port_state & LACP_STATE_LACP_ACTIVITY)) ||
1434− !bond_params->lacp_active) {
1438+ (!(port->actor_oper_port_state & LACP_STATE_LACP_ACTIVITY) && !(port->partner_oper.port_state & LACP_STATE_LACP_ACTIVITY))) {
14351439 port->sm_periodic_state = AD_NO_PERIODIC;
14361440 }
14371441 /* check if state machine should change state */
@@ -1955,16 +1959,16 @@ static void ad_initialize_agg(struct aggregator *aggregator) · 517 unmodified lines
19551959 /**
19561960 * ad_initialize_port - initialize a given port's parameters
19571961 * @port: the port we're looking at
1958− * @lacp_fast: boolean. whether fast periodic should be used
1962+ * @bond_params: bond parameters we will use
19591963 */
1960−static void ad_initialize_port(struct port *port, int lacp_fast)
1964+static void ad_initialize_port(struct port *port, const struct bond_params *bond_params)
19611965 {
19621966 static const struct port_params tmpl = {
19631967 .system_priority = 0xffff,
19641968 .key = 1,
19651969 .port_number = 1,
19661970 .port_priority = 0xff,
1967− .port_state = 1,
1971+ .port_state = 0,
19681972 };
19691973 static const struct lacpdu lacpdu = {
19701974 .subtype = 0x01,
@@ -1982,12 +1986,14 @@ static void ad_initialize_port(struct port *port, int lacp_fast) · 11 unmodified lines
19821986 port->actor_port_priority = 0xff;
19831987 port->actor_port_aggregator_identifier = 0;
19841988 port->ntt = false;
1985− port->actor_admin_port_state = LACP_STATE_AGGREGATION |
1986− LACP_STATE_LACP_ACTIVITY;
1987− port->actor_oper_port_state = LACP_STATE_AGGREGATION |
1988− LACP_STATE_LACP_ACTIVITY;
1989+ port->actor_admin_port_state = LACP_STATE_AGGREGATION;
1990+ port->actor_oper_port_state = LACP_STATE_AGGREGATION;
1991+ if (bond_params->lacp_active) {
1992+ port->actor_admin_port_state |= LACP_STATE_LACP_ACTIVITY;
1993+ port->actor_oper_port_state |= LACP_STATE_LACP_ACTIVITY;
1994+ }
19891995
1990− if (lacp_fast)
1996+ if (bond_params->lacp_fast)
19911997 port->actor_oper_port_state |= LACP_STATE_LACP_TIMEOUT;
19921998
19931999 memcpy(&port->partner_admin, &tmpl, sizeof(tmpl));
@@ -2201,7 +2207,7 @@ void bond_3ad_bind_slave(struct slave *slave) · 207 unmodified lines
22012207 /* port initialization */
22022208 port = &(SLAVE_AD_INFO(slave)->port);
22032209
2204− ad_initialize_port(port, bond->params.lacp_fast);
2210+ ad_initialize_port(port, &bond->params);
22052211
22062212 port->slave = slave;
22072213 port->actor_port_number = SLAVE_AD_INFO(slave)->id;
@@ -2513,7 +2519,7 @@ void bond_3ad_state_machine_handler(struct work_struct *work) · 305 unmodified lines
25132519 }
25142520
25152521 ad_rx_machine(NULL, port);
2516− ad_periodic_machine(port, &bond->params);
2522+ ad_periodic_machine(port);
25172523 ad_port_selection_logic(port, &update_slave_arr);
25182524 ad_mux_machine(port, &update_slave_arr);
25192525 ad_tx_machine(port);
@@ -2883,6 +2889,31 @@ void bond_3ad_update_lacp_rate(struct bonding *bond) · 363 unmodified lines
28832889 spin_unlock_bh(&bond->mode_lock);
28842890 }
28852891
2892+/**
2893+ * bond_3ad_update_lacp_active - change the lacp active
2894+ * @bond: bonding struct
2895+ *
2896+ * Update actor_oper_port_state when lacp_active is modified.
2897+ */
2898+void bond_3ad_update_lacp_active(struct bonding *bond)
2899+{
2900+ struct port *port = NULL;
2901+ struct list_head *iter;
2902+ struct slave *slave;
2903+ int lacp_active;
2904+
2905+ lacp_active = bond->params.lacp_active;
2906+ spin_lock_bh(&bond->mode_lock);
2907+ bond_for_each_slave(bond, slave, iter) {
2908+ port = &(SLAVE_AD_INFO(slave)->port);
2909+ if (lacp_active)
2910+ port->actor_oper_port_state |= LACP_STATE_LACP_ACTIVITY;
2911+ else
2912+ port->actor_oper_port_state &= ~LACP_STATE_LACP_ACTIVITY;
2913+ }
2914+ spin_unlock_bh(&bond->mode_lock);
2915+}
2916+
28862917 size_t bond_3ad_stats_size(void)
28872918 {
28882919 return nla_total_size_64bit(sizeof(u64)) + /* BOND_3AD_STAT_LACPDU_RX */
drivers/net/bonding/bond_options.c+1−0
@@ -1660,6 +1660,7 @@ static int bond_option_lacp_active_set(struct bonding *bond, · 1659 unmodified lines
16601660 netdev_dbg(bond->dev, "Setting LACP active to %s (%llu)\n",
16611661 newval->string, newval->value);
16621662 bond->params.lacp_active = newval->value;
1663+ bond_3ad_update_lacp_active(bond);
16631664
16641665 return 0;
16651666 }
drivers/net/dsa/b53/b53_common.c+1−1
@@ -2078,7 +2078,7 @@ int b53_fdb_dump(struct dsa_switch *ds, int port, · 2077 unmodified lines
20782078
20792079 /* Start search operation */
20802080 reg = ARL_SRCH_STDN;
2081− b53_write8(priv, offset, B53_ARL_SRCH_CTL, reg);
2081+ b53_write8(priv, B53_ARLIO_PAGE, offset, reg);
20822082
20832083 do {
20842084 ret = b53_arl_search_wait(priv);
drivers/net/dsa/microchip/ksz_common.c+6−0
@@ -2457,6 +2457,12 @@ static void ksz_update_port_member(struct ksz_device *dev, int port) · 2456 unmodified lines
24572457 dev->dev_ops->cfg_port_member(dev, i, val | cpu_port);
24582458 }
24592459
2460+ /* HSR ports are setup once so need to use the assigned membership
2461+ * when the port is enabled.
2462+ */
2463+ if (!port_member && p->stp_state == BR_STATE_FORWARDING &&
2464+ (dev->hsr_ports & BIT(port)))
2465+ port_member = dev->hsr_ports;
24602466 dev->dev_ops->cfg_port_member(dev, port, port_member | cpu_port);
24612467 }
24622468
drivers/net/ethernet/airoha/airoha_ppe.c+1−3
@@ -736,10 +736,8 @@ static void airoha_ppe_foe_insert_entry(struct airoha_ppe *ppe, · 735 unmodified lines
736736 continue;
737737 }
738738
739− if (commit_done || !airoha_ppe_foe_compare_entry(e, hwe)) {
740− e->hash = 0xffff;
739+ if (!airoha_ppe_foe_compare_entry(e, hwe))
741740 continue;
742− }
743741
744742 airoha_ppe_foe_commit_entry(ppe, &e->data, hash);
745743 commit_done = true;
drivers/net/ethernet/broadcom/bnxt/bnxt.c+1−1
@@ -5332,7 +5332,7 @@ static void bnxt_free_ntp_fltrs(struct bnxt *bp, bool all) · 5331 unmodified lines
53325332 {
53335333 int i;
53345334
5335− netdev_assert_locked(bp->dev);
5335+ netdev_assert_locked_or_invisible(bp->dev);
53365336
53375337 /* Under netdev instance lock and all our NAPIs have been disabled.
53385338 * It's safe to delete the hash table.
drivers/net/ethernet/cadence/macb_main.c+2−1
@@ -5113,7 +5113,8 @@ static const struct macb_config sama7g5_gem_config = { · 5112 unmodified lines
51135113
51145114 static const struct macb_config sama7g5_emac_config = {
51155115 .caps = MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII |
5116− MACB_CAPS_MIIONRGMII | MACB_CAPS_GEM_HAS_PTP,
5116+ MACB_CAPS_USRIO_HAS_CLKEN | MACB_CAPS_MIIONRGMII |
5117+ MACB_CAPS_GEM_HAS_PTP,
51175118 .dma_burst_length = 16,
51185119 .clk_init = macb_clk_init,
51195120 .init = macb_init,
drivers/net/ethernet/google/gve/gve_main.c+2−0
@@ -2870,6 +2870,8 @@ static void gve_shutdown(struct pci_dev *pdev) · 2869 unmodified lines
28702870 struct gve_priv *priv = netdev_priv(netdev);
28712871 bool was_up = netif_running(priv->dev);
28722872
2873+ netif_device_detach(netdev);
2874+
28732875 rtnl_lock();
28742876 netdev_lock(netdev);
28752877 if (was_up && gve_close(priv->dev)) {
drivers/net/ethernet/intel/igc/igc_main.c+7−7
@@ -7149,6 +7149,13 @@ static int igc_probe(struct pci_dev *pdev, · 7148 unmodified lines
71497149 adapter->port_num = hw->bus.func;
71507150 adapter->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE);
71517151
7152+ /* PCI config space info */
7153+ hw->vendor_id = pdev->vendor;
7154+ hw->device_id = pdev->device;
7155+ hw->revision_id = pdev->revision;
7156+ hw->subsystem_vendor_id = pdev->subsystem_vendor;
7157+ hw->subsystem_device_id = pdev->subsystem_device;
7158+
71527159 /* Disable ASPM L1.2 on I226 devices to avoid packet loss */
71537160 if (igc_is_device_id_i226(hw))
71547161 pci_disable_link_state(pdev, PCIE_LINK_STATE_L1_2);
@@ -7175,13 +7182,6 @@ static int igc_probe(struct pci_dev *pdev, · 20 unmodified lines
71757182 netdev->mem_start = pci_resource_start(pdev, 0);
71767183 netdev->mem_end = pci_resource_end(pdev, 0);
71777184
7178− /* PCI config space info */
7179− hw->vendor_id = pdev->vendor;
7180− hw->device_id = pdev->device;
7181− hw->revision_id = pdev->revision;
7182− hw->subsystem_vendor_id = pdev->subsystem_vendor;
7183− hw->subsystem_device_id = pdev->subsystem_device;
7184−
71857185 /* Copy the default MAC and PHY function pointers */
71867186 memcpy(&hw->mac.ops, ei->mac_ops, sizeof(hw->mac.ops));
71877187 memcpy(&hw->phy.ops, ei->phy_ops, sizeof(hw->phy.ops));
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c+11−23
@@ -968,10 +968,6 @@ static void ixgbe_update_xoff_rx_lfc(struct ixgbe_adapter *adapter) · 967 unmodified lines
968968 for (i = 0; i < adapter->num_tx_queues; i++)
969969 clear_bit(__IXGBE_HANG_CHECK_ARMED,
970970 &adapter->tx_ring[i]->state);
971−
972− for (i = 0; i < adapter->num_xdp_queues; i++)
973− clear_bit(__IXGBE_HANG_CHECK_ARMED,
974− &adapter->xdp_ring[i]->state);
975971 }
976972
977973 static void ixgbe_update_xoff_received(struct ixgbe_adapter *adapter)
@@ -1214,7 +1210,7 @@ static void ixgbe_pf_handle_tx_hang(struct ixgbe_ring *tx_ring, · 236 unmodified lines
12141210 struct ixgbe_adapter *adapter = netdev_priv(tx_ring->netdev);
12151211 struct ixgbe_hw *hw = &adapter->hw;
12161212
1217− e_err(drv, "Detected Tx Unit Hang%s\n"
1213+ e_err(drv, "Detected Tx Unit Hang\n"
12181214 " Tx Queue <%d>\n"
12191215 " TDH, TDT <%x>, <%x>\n"
12201216 " next_to_use <%x>\n"
@@ -1222,16 +1218,14 @@ static void ixgbe_pf_handle_tx_hang(struct ixgbe_ring *tx_ring, · 1 unmodified line
12221218 "tx_buffer_info[next_to_clean]\n"
12231219 " time_stamp <%lx>\n"
12241220 " jiffies <%lx>\n",
1225− ring_is_xdp(tx_ring) ? " (XDP)" : "",
12261221 tx_ring->queue_index,
12271222 IXGBE_READ_REG(hw, IXGBE_TDH(tx_ring->reg_idx)),
12281223 IXGBE_READ_REG(hw, IXGBE_TDT(tx_ring->reg_idx)),
12291224 tx_ring->next_to_use, next,
12301225 tx_ring->tx_buffer_info[next].time_stamp, jiffies);
12311226
1232− if (!ring_is_xdp(tx_ring))
1233− netif_stop_subqueue(tx_ring->netdev,
1234− tx_ring->queue_index);
1227+ netif_stop_subqueue(tx_ring->netdev,
1228+ tx_ring->queue_index);
12351229 }
12361230
12371231 /**
@@ -1451,6 +1445,9 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector, · 213 unmodified lines
14511445 total_bytes);
14521446 adapter->tx_ipsec += total_ipsec;
14531447
1448+ if (ring_is_xdp(tx_ring))
1449+ return !!budget;
1450+
14541451 if (check_for_tx_hang(tx_ring) && ixgbe_check_tx_hang(tx_ring)) {
14551452 if (adapter->hw.mac.type == ixgbe_mac_e610)
14561453 ixgbe_handle_mdd_event(adapter, tx_ring);
@@ -1468,9 +1465,6 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector, · 11 unmodified lines
14681465 return true;
14691466 }
14701467
1471− if (ring_is_xdp(tx_ring))
1472− return !!budget;
1473−
14741468 #define TX_WAKE_THRESHOLD (DESC_NEEDED * 2)
14751469 txq = netdev_get_tx_queue(tx_ring->netdev, tx_ring->queue_index);
14761470 if (!__netif_txq_completed_wake(txq, total_packets, total_bytes,
@@ -7974,12 +7968,9 @@ static void ixgbe_check_hang_subtask(struct ixgbe_adapter *adapter) · 6497 unmodified lines
79747968 return;
79757969
79767970 /* Force detection of hung controller */
7977− if (netif_carrier_ok(adapter->netdev)) {
7971+ if (netif_carrier_ok(adapter->netdev))
79787972 for (i = 0; i < adapter->num_tx_queues; i++)
79797973 set_check_for_tx_hang(adapter->tx_ring[i]);
7980− for (i = 0; i < adapter->num_xdp_queues; i++)
7981− set_check_for_tx_hang(adapter->xdp_ring[i]);
7982− }
79837974
79847975 if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED)) {
79857976 /*
@@ -8199,13 +8190,6 @@ static bool ixgbe_ring_tx_pending(struct ixgbe_adapter *adapter) · 213 unmodified lines
81998190 return true;
82008191 }
82018192
8202− for (i = 0; i < adapter->num_xdp_queues; i++) {
8203− struct ixgbe_ring *ring = adapter->xdp_ring[i];
8204−
8205− if (ring->next_to_use != ring->next_to_clean)
8206− return true;
8207− }
8208−
82098193 return false;
82108194 }
82118195
@@ -11005,6 +10989,10 @@ static int ixgbe_xdp_xmit(struct net_device *dev, int n, · 2793 unmodified lines
1100510989 if (unlikely(test_bit(__IXGBE_DOWN, &adapter->state)))
1100610990 return -ENETDOWN;
1100710991
10992+ if (!netif_carrier_ok(adapter->netdev) ||
10993+ !netif_running(adapter->netdev))
10994+ return -ENETDOWN;
10995+
1100810996 if (unlikely(flags & ~XDP_XMIT_FLAGS_MASK))
1100910997 return -EINVAL;
1101010998
drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c+3−1
@@ -398,7 +398,7 @@ static bool ixgbe_xmit_zc(struct ixgbe_ring *xdp_ring, unsigned int budget) · 397 unmodified lines
398398 dma_addr_t dma;
399399 u32 cmd_type;
400400
401− while (budget-- > 0) {
401+ while (likely(budget)) {
402402 if (unlikely(!ixgbe_desc_unused(xdp_ring))) {
403403 work_done = false;
404404 break;
@@ -433,6 +433,8 @@ static bool ixgbe_xmit_zc(struct ixgbe_ring *xdp_ring, unsigned int budget) · 28 unmodified lines
433433 xdp_ring->next_to_use++;
434434 if (xdp_ring->next_to_use == xdp_ring->count)
435435 xdp_ring->next_to_use = 0;
436+
437+ budget--;
436438 }
437439
438440 if (tx_desc) {
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c+2−2
@@ -606,8 +606,8 @@ static void npc_set_features(struct rvu *rvu, int blkaddr, u8 intf) · 605 unmodified lines
606606 if (!npc_check_field(rvu, blkaddr, NPC_LB, intf))
607607 *features &= ~BIT_ULL(NPC_OUTER_VID);
608608
609− /* Set SPI flag only if AH/ESP and IPSEC_SPI are in the key */
610− if (npc_check_field(rvu, blkaddr, NPC_IPSEC_SPI, intf) &&
609+ /* Allow extracting SPI field from AH and ESP headers at same offset */
610+ if (npc_is_field_present(rvu, NPC_IPSEC_SPI, intf) &&
611611 (*features & (BIT_ULL(NPC_IPPROTO_ESP) | BIT_ULL(NPC_IPPROTO_AH))))
612612 *features |= BIT_ULL(NPC_IPSEC_SPI);
613613
drivers/net/ethernet/mediatek/mtk_ppe_offload.c+2−0
@@ -101,7 +101,9 @@ mtk_flow_get_wdma_info(struct net_device *dev, const u8 *addr, struct mtk_wdma_i · 100 unmodified lines
101101 if (!IS_ENABLED(CONFIG_NET_MEDIATEK_SOC_WED))
102102 return -1;
103103
104+ rcu_read_lock();
104105 err = dev_fill_forward_path(dev, addr, &stack);
106+ rcu_read_unlock();
105107 if (err)
106108 return err;
107109
drivers/net/ethernet/mellanox/mlx5/core/en/dcbnl.h+0−1
@@ -26,7 +26,6 @@ struct mlx5e_dcbx { · 25 unmodified lines
2626 u8 cap;
2727
2828 /* Buffer configuration */
29− bool manual_buffer;
3029 u32 cable_len;
3130 u32 xoff;
3231 u16 port_buff_cell_sz;
drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c+8−10
@@ -272,8 +272,8 @@ static int port_update_shared_buffer(struct mlx5_core_dev *mdev, · 271 unmodified lines
272272 /* Total shared buffer size is split in a ratio of 3:1 between
273273 * lossy and lossless pools respectively.
274274 */
275− lossy_epool_size = (shared_buffer_size / 4) * 3;
276275 lossless_ipool_size = shared_buffer_size / 4;
276+ lossy_epool_size = shared_buffer_size - lossless_ipool_size;
277277
278278 mlx5e_port_set_sbpr(mdev, 0, MLX5_EGRESS_DIR, MLX5_LOSSY_POOL, 0,
279279 lossy_epool_size);
@@ -288,14 +288,12 @@ static int port_set_buffer(struct mlx5e_priv *priv, · 8 unmodified lines
288288 u16 port_buff_cell_sz = priv->dcbx.port_buff_cell_sz;
289289 struct mlx5_core_dev *mdev = priv->mdev;
290290 int sz = MLX5_ST_SZ_BYTES(pbmc_reg);
291− u32 new_headroom_size = 0;
292− u32 current_headroom_size;
291+ u32 current_headroom_cells = 0;
292+ u32 new_headroom_cells = 0;
293293 void *in;
294294 int err;
295295 int i;
296296
297− current_headroom_size = port_buffer->headroom_size;
298−
299297 in = kzalloc(sz, GFP_KERNEL);
300298 if (!in)
301299 return -ENOMEM;
@@ -306,12 +304,14 @@ static int port_set_buffer(struct mlx5e_priv *priv, · 4 unmodified lines
306304
307305 for (i = 0; i < MLX5E_MAX_NETWORK_BUFFER; i++) {
308306 void *buffer = MLX5_ADDR_OF(pbmc_reg, in, buffer[i]);
307+ current_headroom_cells += MLX5_GET(bufferx_reg, buffer, size);
308+
309309 u64 size = port_buffer->buffer[i].size;
310310 u64 xoff = port_buffer->buffer[i].xoff;
311311 u64 xon = port_buffer->buffer[i].xon;
312312
313− new_headroom_size += size;
314313 do_div(size, port_buff_cell_sz);
314+ new_headroom_cells += size;
315315 do_div(xoff, port_buff_cell_sz);
316316 do_div(xon, port_buff_cell_sz);
317317 MLX5_SET(bufferx_reg, buffer, size, size);
@@ -320,10 +320,8 @@ static int port_set_buffer(struct mlx5e_priv *priv, · 2 unmodified lines
320320 MLX5_SET(bufferx_reg, buffer, xon_threshold, xon);
321321 }
322322
323− new_headroom_size /= port_buff_cell_sz;
324− current_headroom_size /= port_buff_cell_sz;
325− err = port_update_shared_buffer(priv->mdev, current_headroom_size,
326− new_headroom_size);
323+ err = port_update_shared_buffer(priv->mdev, current_headroom_cells,
324+ new_headroom_cells);
327325 if (err)
328326 goto out;
329327
drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs_hmfs.c+2−0
@@ -173,6 +173,8 @@ static void mlx5_ct_fs_hmfs_fill_rule_actions(struct mlx5_ct_fs_hmfs *fs_hmfs, · 172 unmodified lines
173173
174174 memset(rule_actions, 0, NUM_CT_HMFS_RULES * sizeof(*rule_actions));
175175 rule_actions[0].action = mlx5_fc_get_hws_action(fs_hmfs->ctx, attr->counter);
176+ rule_actions[0].counter.offset =
177+ attr->counter->id - attr->counter->bulk->base_id;
176178 /* Modify header is special, it may require extra arguments outside the action itself. */
177179 if (mh_action->mh_data) {
178180 rule_actions[1].modify_header.offset = mh_action->mh_data->offset;
drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c+9−3
@@ -362,6 +362,7 @@ static int mlx5e_dcbnl_ieee_getpfc(struct net_device *dev, · 361 unmodified lines
362362 static int mlx5e_dcbnl_ieee_setpfc(struct net_device *dev,
363363 struct ieee_pfc *pfc)
364364 {
365+ u8 buffer_ownership = MLX5_BUF_OWNERSHIP_UNKNOWN;
365366 struct mlx5e_priv *priv = netdev_priv(dev);
366367 struct mlx5_core_dev *mdev = priv->mdev;
367368 u32 old_cable_len = priv->dcbx.cable_len;
@@ -389,7 +390,14 @@ static int mlx5e_dcbnl_ieee_setpfc(struct net_device *dev, · 21 unmodified lines
389390
390391 if (MLX5_BUFFER_SUPPORTED(mdev)) {
391392 pfc_new.pfc_en = (changed & MLX5E_PORT_BUFFER_PFC) ? pfc->pfc_en : curr_pfc_en;
392− if (priv->dcbx.manual_buffer)
393+ ret = mlx5_query_port_buffer_ownership(mdev,
394+ &buffer_ownership);
395+ if (ret)
396+ netdev_err(dev,
397+ "%s, Failed to get buffer ownership: %d\n",
398+ __func__, ret);
399+
400+ if (buffer_ownership == MLX5_BUF_OWNERSHIP_SW_OWNED)
393401 ret = mlx5e_port_manual_buffer_config(priv, changed,
394402 dev->mtu, &pfc_new,
395403 NULL, NULL);
@@ -982,7 +990,6 @@ static int mlx5e_dcbnl_setbuffer(struct net_device *dev, · 586 unmodified lines
982990 if (!changed)
983991 return 0;
984992
985− priv->dcbx.manual_buffer = true;
986993 err = mlx5e_port_manual_buffer_config(priv, changed, dev->mtu, NULL,
987994 buffer_size, prio2buffer);
988995 return err;
@@ -1252,7 +1259,6 @@ void mlx5e_dcbnl_initialize(struct mlx5e_priv *priv) · 263 unmodified lines
12521259 priv->dcbx.cap |= DCB_CAP_DCBX_HOST;
12531260
12541261 priv->dcbx.port_buff_cell_sz = mlx5e_query_port_buffers_cell_size(priv);
1255− priv->dcbx.manual_buffer = false;
12561262 priv->dcbx.cable_len = MLX5E_DEFAULT_CABLE_LEN;
12571263
12581264 mlx5e_ets_init(priv);
drivers/net/ethernet/mellanox/mlx5/core/esw/devlink_port.c+3−1
@@ -47,10 +47,12 @@ static void mlx5_esw_offloads_pf_vf_devlink_port_attrs_set(struct mlx5_eswitch * · 46 unmodified lines
4747 devlink_port_attrs_pci_vf_set(dl_port, controller_num, pfnum,
4848 vport_num - 1, external);
4949 } else if (mlx5_core_is_ec_vf_vport(esw->dev, vport_num)) {
50+ u16 base_vport = mlx5_core_ec_vf_vport_base(dev);
51+
5052 memcpy(dl_port->attrs.switch_id.id, ppid.id, ppid.id_len);
5153 dl_port->attrs.switch_id.id_len = ppid.id_len;
5254 devlink_port_attrs_pci_vf_set(dl_port, 0, pfnum,
53− vport_num - 1, false);
55+ vport_num - base_vport, false);
5456 }
5557 }
5658
drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c+98−85
@@ -102,6 +102,8 @@ struct mlx5_esw_sched_node { · 101 unmodified lines
102102 u8 level;
103103 /* Valid only when this node represents a traffic class. */
104104 u8 tc;
105+ /* Valid only for a TC arbiter node or vport TC arbiter. */
106+ u32 tc_bw[DEVLINK_RATE_TCS_MAX];
105107 };
106108
107109 static void esw_qos_node_attach_to_parent(struct mlx5_esw_sched_node *node)
@@ -462,6 +464,7 @@ static int · 354 unmodified lines
462464 esw_qos_vport_create_sched_element(struct mlx5_esw_sched_node *vport_node,
463465 struct netlink_ext_ack *extack)
464466 {
467+ struct mlx5_esw_sched_node *parent = vport_node->parent;
465468 u32 sched_ctx[MLX5_ST_SZ_DW(scheduling_context)] = {};
466469 struct mlx5_core_dev *dev = vport_node->esw->dev;
467470 void *attr;
@@ -477,7 +480,7 @@ esw_qos_vport_create_sched_element(struct mlx5_esw_sched_node *vport_node, · 9 unmodified lines
477480 attr = MLX5_ADDR_OF(scheduling_context, sched_ctx, element_attributes);
478481 MLX5_SET(vport_element, attr, vport_number, vport_node->vport->vport);
479482 MLX5_SET(scheduling_context, sched_ctx, parent_element_id,
480− vport_node->parent->ix);
483+ parent ? parent->ix : vport_node->esw->qos.root_tsar_ix);
481484 MLX5_SET(scheduling_context, sched_ctx, max_average_bw,
482485 vport_node->max_rate);
483486
@@ -608,10 +611,7 @@ static void · 124 unmodified lines
608611 esw_qos_tc_arbiter_get_bw_shares(struct mlx5_esw_sched_node *tc_arbiter_node,
609612 u32 *tc_bw)
610613 {
611− struct mlx5_esw_sched_node *vports_tc_node;
612−
613− list_for_each_entry(vports_tc_node, &tc_arbiter_node->children, entry)
614− tc_bw[vports_tc_node->tc] = vports_tc_node->bw_share;
614+ memcpy(tc_bw, tc_arbiter_node->tc_bw, sizeof(tc_arbiter_node->tc_bw));
615615 }
616616
617617 static void
@@ -628,6 +628,7 @@ esw_qos_set_tc_arbiter_bw_shares(struct mlx5_esw_sched_node *tc_arbiter_node, · 10 unmodified lines
628628 u8 tc = vports_tc_node->tc;
629629 u32 bw_share;
630630
631+ tc_arbiter_node->tc_bw[tc] = tc_bw[tc];
631632 bw_share = tc_bw[tc] * fw_max_bw_share;
632633 bw_share = esw_qos_calc_bw_share(bw_share, divider,
633634 fw_max_bw_share);
@@ -786,48 +787,15 @@ static int esw_qos_create(struct mlx5_eswitch *esw, struct netlink_ext_ack *exta · 152 unmodified lines
786787 return err;
787788 }
788789
789− if (MLX5_CAP_QOS(dev, log_esw_max_sched_depth)) {
790− esw->qos.node0 = __esw_qos_create_vports_sched_node(esw, NULL, extack);
791− } else {
792− /* The eswitch doesn't support scheduling nodes.
793− * Create a software-only node0 using the root TSAR to attach vport QoS to.
794− */
795− if (!__esw_qos_alloc_node(esw,
796− esw->qos.root_tsar_ix,
797− SCHED_NODE_TYPE_VPORTS_TSAR,
798− NULL))
799− esw->qos.node0 = ERR_PTR(-ENOMEM);
800− else
801− list_add_tail(&esw->qos.node0->entry,
802− &esw->qos.domain->nodes);
803− }
804− if (IS_ERR(esw->qos.node0)) {
805− err = PTR_ERR(esw->qos.node0);
806− esw_warn(dev, "E-Switch create rate node 0 failed (%d)\n", err);
807− goto err_node0;
808− }
809790 refcount_set(&esw->qos.refcnt, 1);
810791
811792 return 0;
812−
813−err_node0:
814− if (mlx5_destroy_scheduling_element_cmd(esw->dev, SCHEDULING_HIERARCHY_E_SWITCH,
815− esw->qos.root_tsar_ix))
816− esw_warn(esw->dev, "E-Switch destroy root TSAR failed.\n");
817−
818− return err;
819793 }
820794
821795 static void esw_qos_destroy(struct mlx5_eswitch *esw)
822796 {
823797 int err;
824798
825− if (esw->qos.node0->ix != esw->qos.root_tsar_ix)
826− __esw_qos_destroy_node(esw->qos.node0, NULL);
827− else
828− __esw_qos_free_node(esw->qos.node0);
829− esw->qos.node0 = NULL;
830−
831799 err = mlx5_destroy_scheduling_element_cmd(esw->dev,
832800 SCHEDULING_HIERARCHY_E_SWITCH,
833801 esw->qos.root_tsar_ix);
@@ -990,13 +958,16 @@ esw_qos_vport_tc_enable(struct mlx5_vport *vport, enum sched_node_type type, · 156 unmodified lines
990958 struct netlink_ext_ack *extack)
991959 {
992960 struct mlx5_esw_sched_node *vport_node = vport->qos.sched_node;
993− int err, new_level, max_level;
961+ struct mlx5_esw_sched_node *parent = vport_node->parent;
962+ int err;
994963
995964 if (type == SCHED_NODE_TYPE_TC_ARBITER_TSAR) {
965+ int new_level, max_level;
966+
996967 /* Increase the parent's level by 2 to account for both the
997968 * TC arbiter and the vports TC scheduling element.
998969 */
999− new_level = vport_node->parent->level + 2;
970+ new_level = (parent ? parent->level : 2) + 2;
1000971 max_level = 1 << MLX5_CAP_QOS(vport_node->esw->dev,
1001972 log_esw_max_sched_depth);
1002973 if (new_level > max_level) {
@@ -1033,9 +1004,7 @@ esw_qos_vport_tc_enable(struct mlx5_vport *vport, enum sched_node_type type, · 30 unmodified lines
10331004 err_sched_nodes:
10341005 if (type == SCHED_NODE_TYPE_RATE_LIMITER) {
10351006 esw_qos_node_destroy_sched_element(vport_node, NULL);
1036− list_add_tail(&vport_node->entry,
1037− &vport_node->parent->children);
1038− vport_node->level = vport_node->parent->level + 1;
1007+ esw_qos_node_attach_to_parent(vport_node);
10391008 } else {
10401009 esw_qos_tc_arbiter_scheduling_teardown(vport_node, NULL);
10411010 }
@@ -1083,7 +1052,6 @@ err_out: · 41 unmodified lines
10831052 static void esw_qos_vport_disable(struct mlx5_vport *vport, struct netlink_ext_ack *extack)
10841053 {
10851054 struct mlx5_esw_sched_node *vport_node = vport->qos.sched_node;
1086− struct mlx5_esw_sched_node *parent = vport_node->parent;
10871055 enum sched_node_type curr_type = vport_node->type;
10881056
10891057 if (curr_type == SCHED_NODE_TYPE_VPORT)
@@ -1092,8 +1060,9 @@ static void esw_qos_vport_disable(struct mlx5_vport *vport, struct netlink_ext_a · 2 unmodified lines
10921060 esw_qos_vport_tc_disable(vport, extack);
10931061
10941062 vport_node->bw_share = 0;
1063+ memset(vport_node->tc_bw, 0, sizeof(vport_node->tc_bw));
10951064 list_del_init(&vport_node->entry);
1096− esw_qos_normalize_min_rate(parent->esw, parent, extack);
1065+ esw_qos_normalize_min_rate(vport_node->esw, vport_node->parent, extack);
10971066
10981067 trace_mlx5_esw_vport_qos_destroy(vport_node->esw->dev, vport);
10991068 }
@@ -1103,25 +1072,23 @@ static int esw_qos_vport_enable(struct mlx5_vport *vport, · 3 unmodified lines
11031072 struct mlx5_esw_sched_node *parent,
11041073 struct netlink_ext_ack *extack)
11051074 {
1075+ struct mlx5_esw_sched_node *vport_node = vport->qos.sched_node;
11061076 int err;
11071077
11081078 esw_assert_qos_lock_held(vport->dev->priv.eswitch);
11091079
1110− esw_qos_node_set_parent(vport->qos.sched_node, parent);
1111− if (type == SCHED_NODE_TYPE_VPORT) {
1112− err = esw_qos_vport_create_sched_element(vport->qos.sched_node,
1113− extack);
1114− } else {
1080+ esw_qos_node_set_parent(vport_node, parent);
1081+ if (type == SCHED_NODE_TYPE_VPORT)
1082+ err = esw_qos_vport_create_sched_element(vport_node, extack);
1083+ else
11151084 err = esw_qos_vport_tc_enable(vport, type, extack);
1116− }
11171085 if (err)
11181086 return err;
11191087
1120− vport->qos.sched_node->type = type;
1121− esw_qos_normalize_min_rate(parent->esw, parent, extack);
1122− trace_mlx5_esw_vport_qos_create(vport->dev, vport,
1123− vport->qos.sched_node->max_rate,
1124− vport->qos.sched_node->bw_share);
1088+ vport_node->type = type;
1089+ esw_qos_normalize_min_rate(vport_node->esw, parent, extack);
1090+ trace_mlx5_esw_vport_qos_create(vport->dev, vport, vport_node->max_rate,
1091+ vport_node->bw_share);
11251092
11261093 return 0;
11271094 }
@@ -1132,6 +1099,7 @@ static int mlx5_esw_qos_vport_enable(struct mlx5_vport *vport, enum sched_node_t · 4 unmodified lines
11321099 {
11331100 struct mlx5_eswitch *esw = vport->dev->priv.eswitch;
11341101 struct mlx5_esw_sched_node *sched_node;
1102+ struct mlx5_eswitch *parent_esw;
11351103 int err;
11361104
11371105 esw_assert_qos_lock_held(esw);
@@ -1139,10 +1107,14 @@ static int mlx5_esw_qos_vport_enable(struct mlx5_vport *vport, enum sched_node_t · 1 unmodified line
11391107 if (err)
11401108 return err;
11411109
1142− parent = parent ?: esw->qos.node0;
1143− sched_node = __esw_qos_alloc_node(parent->esw, 0, type, parent);
1144− if (!sched_node)
1110+ parent_esw = parent ? parent->esw : esw;
1111+ sched_node = __esw_qos_alloc_node(parent_esw, 0, type, parent);
1112+ if (!sched_node) {
1113+ esw_qos_put(esw);
11451114 return -ENOMEM;
1115+ }
1116+ if (!parent)
1117+ list_add_tail(&sched_node->entry, &esw->qos.domain->nodes);
11461118
11471119 sched_node->max_rate = max_rate;
11481120 sched_node->min_rate = min_rate;
@@ -1150,6 +1122,7 @@ static int mlx5_esw_qos_vport_enable(struct mlx5_vport *vport, enum sched_node_t · 1 unmodified line
11501122 vport->qos.sched_node = sched_node;
11511123 err = esw_qos_vport_enable(vport, type, parent, extack);
11521124 if (err) {
1125+ __esw_qos_free_node(sched_node);
11531126 esw_qos_put(esw);
11541127 vport->qos.sched_node = NULL;
11551128 }
@@ -1157,6 +1130,19 @@ static int mlx5_esw_qos_vport_enable(struct mlx5_vport *vport, enum sched_node_t · 1 unmodified line
11571130 return err;
11581131 }
11591132
1133+static void mlx5_esw_qos_vport_disable_locked(struct mlx5_vport *vport)
1134+{
1135+ struct mlx5_eswitch *esw = vport->dev->priv.eswitch;
1136+
1137+ esw_assert_qos_lock_held(esw);
1138+ if (!vport->qos.sched_node)
1139+ return;
1140+
1141+ esw_qos_vport_disable(vport, NULL);
1142+ mlx5_esw_qos_vport_qos_free(vport);
1143+ esw_qos_put(esw);
1144+}
1145+
11601146 void mlx5_esw_qos_vport_disable(struct mlx5_vport *vport)
11611147 {
11621148 struct mlx5_eswitch *esw = vport->dev->priv.eswitch;
@@ -1168,11 +1154,9 @@ void mlx5_esw_qos_vport_disable(struct mlx5_vport *vport) · 5 unmodified lines
11681154 goto unlock;
11691155
11701156 parent = vport->qos.sched_node->parent;
1171− WARN(parent != esw->qos.node0, "Disabling QoS on port before detaching it from node");
1157+ WARN(parent, "Disabling QoS on port before detaching it from node");
11721158
1173− esw_qos_vport_disable(vport, NULL);
1174− mlx5_esw_qos_vport_qos_free(vport);
1175− esw_qos_put(esw);
1159+ mlx5_esw_qos_vport_disable_locked(vport);
11761160 unlock:
11771161 esw_qos_unlock(esw);
11781162 }
@@ -1262,13 +1246,13 @@ static int esw_qos_vport_update(struct mlx5_vport *vport, · 83 unmodified lines
12621246 struct mlx5_esw_sched_node *parent,
12631247 struct netlink_ext_ack *extack)
12641248 {
1265− struct mlx5_esw_sched_node *curr_parent = vport->qos.sched_node->parent;
1266− enum sched_node_type curr_type = vport->qos.sched_node->type;
1249+ struct mlx5_esw_sched_node *vport_node = vport->qos.sched_node;
1250+ struct mlx5_esw_sched_node *curr_parent = vport_node->parent;
1251+ enum sched_node_type curr_type = vport_node->type;
12671252 u32 curr_tc_bw[DEVLINK_RATE_TCS_MAX] = {0};
12681253 int err;
12691254
12701255 esw_assert_qos_lock_held(vport->dev->priv.eswitch);
1271− parent = parent ?: curr_parent;
12721256 if (curr_type == type && curr_parent == parent)
12731257 return 0;
12741258
@@ -1276,10 +1260,8 @@ static int esw_qos_vport_update(struct mlx5_vport *vport, · 1 unmodified line
12761260 if (err)
12771261 return err;
12781262
1279− if (curr_type == SCHED_NODE_TYPE_TC_ARBITER_TSAR && curr_type == type) {
1280− esw_qos_tc_arbiter_get_bw_shares(vport->qos.sched_node,
1281− curr_tc_bw);
1282− }
1263+ if (curr_type == SCHED_NODE_TYPE_TC_ARBITER_TSAR && curr_type == type)
1264+ esw_qos_tc_arbiter_get_bw_shares(vport_node, curr_tc_bw);
12831265
12841266 esw_qos_vport_disable(vport, extack);
12851267
@@ -1290,8 +1272,8 @@ static int esw_qos_vport_update(struct mlx5_vport *vport, · 4 unmodified lines
12901272 }
12911273
12921274 if (curr_type == SCHED_NODE_TYPE_TC_ARBITER_TSAR && curr_type == type) {
1293− esw_qos_set_tc_arbiter_bw_shares(vport->qos.sched_node,
1294− curr_tc_bw, extack);
1275+ esw_qos_set_tc_arbiter_bw_shares(vport_node, curr_tc_bw,
1276+ extack);
12951277 }
12961278
12971279 return err;
@@ -1306,16 +1288,16 @@ static int esw_qos_vport_update_parent(struct mlx5_vport *vport, struct mlx5_esw · 8 unmodified lines
13061288
13071289 esw_assert_qos_lock_held(esw);
13081290 curr_parent = vport->qos.sched_node->parent;
1309− parent = parent ?: esw->qos.node0;
13101291 if (curr_parent == parent)
13111292 return 0;
13121293
13131294 /* Set vport QoS type based on parent node type if different from
13141295 * default QoS; otherwise, use the vport's current QoS type.
13151296 */
1316− if (parent->type == SCHED_NODE_TYPE_TC_ARBITER_TSAR)
1297+ if (parent && parent->type == SCHED_NODE_TYPE_TC_ARBITER_TSAR)
13171298 type = SCHED_NODE_TYPE_RATE_LIMITER;
1318− else if (curr_parent->type == SCHED_NODE_TYPE_TC_ARBITER_TSAR)
1299+ else if (curr_parent &&
1300+ curr_parent->type == SCHED_NODE_TYPE_TC_ARBITER_TSAR)
13191301 type = SCHED_NODE_TYPE_VPORT;
13201302 else
13211303 type = vport->qos.sched_node->type;
@@ -1654,9 +1636,10 @@ static bool esw_qos_validate_unsupported_tc_bw(struct mlx5_eswitch *esw, · 332 unmodified lines
16541636 static bool esw_qos_vport_validate_unsupported_tc_bw(struct mlx5_vport *vport,
16551637 u32 *tc_bw)
16561638 {
1657− struct mlx5_eswitch *esw = vport->qos.sched_node ?
1658− vport->qos.sched_node->parent->esw :
1659− vport->dev->priv.eswitch;
1639+ struct mlx5_esw_sched_node *node = vport->qos.sched_node;
1640+ struct mlx5_eswitch *esw = vport->dev->priv.eswitch;
1641+
1642+ esw = (node && node->parent) ? node->parent->esw : esw;
16601643
16611644 return esw_qos_validate_unsupported_tc_bw(esw, tc_bw);
16621645 }
@@ -1673,6 +1656,21 @@ static bool esw_qos_tc_bw_disabled(u32 *tc_bw) · 10 unmodified lines
16731656 return true;
16741657 }
16751658
1659+static void esw_vport_qos_prune_empty(struct mlx5_vport *vport)
1660+{
1661+ struct mlx5_esw_sched_node *vport_node = vport->qos.sched_node;
1662+
1663+ esw_assert_qos_lock_held(vport->dev->priv.eswitch);
1664+ if (!vport_node)
1665+ return;
1666+
1667+ if (vport_node->parent || vport_node->max_rate ||
1668+ vport_node->min_rate || !esw_qos_tc_bw_disabled(vport_node->tc_bw))
1669+ return;
1670+
1671+ mlx5_esw_qos_vport_disable_locked(vport);
1672+}
1673+
16761674 int mlx5_esw_qos_init(struct mlx5_eswitch *esw)
16771675 {
16781676 if (esw->qos.domain)
@@ -1706,6 +1704,10 @@ int mlx5_esw_devlink_rate_leaf_tx_share_set(struct devlink_rate *rate_leaf, void · 27 unmodified lines
17061704
17071705 esw_qos_lock(esw);
17081706 err = mlx5_esw_qos_set_vport_min_rate(vport, tx_share, extack);
1707+ if (err)
1708+ goto out;
1709+ esw_vport_qos_prune_empty(vport);
1710+out:
17091711 esw_qos_unlock(esw);
17101712 return err;
17111713 }
@@ -1727,6 +1729,10 @@ int mlx5_esw_devlink_rate_leaf_tx_max_set(struct devlink_rate *rate_leaf, void * · 15 unmodified lines
17271729
17281730 esw_qos_lock(esw);
17291731 err = mlx5_esw_qos_set_vport_max_rate(vport, tx_max, extack);
1732+ if (err)
1733+ goto out;
1734+ esw_vport_qos_prune_empty(vport);
1735+out:
17301736 esw_qos_unlock(esw);
17311737 return err;
17321738 }
@@ -1763,7 +1769,8 @@ int mlx5_esw_devlink_rate_leaf_tc_bw_set(struct devlink_rate *rate_leaf, · 30 unmodified lines
17631769 if (disable) {
17641770 if (vport_node->type == SCHED_NODE_TYPE_TC_ARBITER_TSAR)
17651771 err = esw_qos_vport_update(vport, SCHED_NODE_TYPE_VPORT,
1766− NULL, extack);
1772+ vport_node->parent, extack);
1773+ esw_vport_qos_prune_empty(vport);
17671774 goto unlock;
17681775 }
17691776
@@ -1775,7 +1782,7 @@ int mlx5_esw_devlink_rate_leaf_tc_bw_set(struct devlink_rate *rate_leaf, · 5 unmodified lines
17751782 } else {
17761783 err = esw_qos_vport_update(vport,
17771784 SCHED_NODE_TYPE_TC_ARBITER_TSAR,
1778− NULL, extack);
1785+ vport_node->parent, extack);
17791786 }
17801787 if (!err)
17811788 esw_qos_set_tc_arbiter_bw_shares(vport_node, tc_bw, extack);
@@ -1924,14 +1931,20 @@ int mlx5_esw_devlink_rate_leaf_parent_set(struct devlink_rate *devlink_rate, · 142 unmodified lines
19241931 void *priv, void *parent_priv,
19251932 struct netlink_ext_ack *extack)
19261933 {
1927− struct mlx5_esw_sched_node *node;
1934+ struct mlx5_esw_sched_node *node = parent ? parent_priv : NULL;
19281935 struct mlx5_vport *vport = priv;
1936+ int err;
19291937
1930− if (!parent)
1931− return mlx5_esw_qos_vport_update_parent(vport, NULL, extack);
1938+ err = mlx5_esw_qos_vport_update_parent(vport, node, extack);
1939+ if (!err) {
1940+ struct mlx5_eswitch *esw = vport->dev->priv.eswitch;
1941+
1942+ esw_qos_lock(esw);
1943+ esw_vport_qos_prune_empty(vport);
1944+ esw_qos_unlock(esw);
1945+ }
19321946
1933− node = parent_priv;
1934− return mlx5_esw_qos_vport_update_parent(vport, node, extack);
1947+ return err;
19351948 }
19361949
19371950 static bool esw_qos_is_node_empty(struct mlx5_esw_sched_node *node)
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h+0−5
@@ -373,11 +373,6 @@ struct mlx5_eswitch { · 372 unmodified lines
373373 refcount_t refcnt;
374374 u32 root_tsar_ix;
375375 struct mlx5_qos_domain *domain;
376− /* Contains all vports with QoS enabled but no explicit node.
377− * Cannot be NULL if QoS is enabled, but may be a fake node
378− * referencing the root TSAR if the esw doesn't support nodes.
379− */
380− struct mlx5_esw_sched_node *node0;
381376 } qos;
382377
383378 struct mlx5_esw_bridge_offloads *br_offloads;
drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h+2−0
@@ -367,6 +367,8 @@ int mlx5_query_port_dcbx_param(struct mlx5_core_dev *mdev, u32 *out); · 366 unmodified lines
367367 int mlx5_set_port_dcbx_param(struct mlx5_core_dev *mdev, u32 *in);
368368 int mlx5_set_trust_state(struct mlx5_core_dev *mdev, u8 trust_state);
369369 int mlx5_query_trust_state(struct mlx5_core_dev *mdev, u8 *trust_state);
370+int mlx5_query_port_buffer_ownership(struct mlx5_core_dev *mdev,
371+ u8 *buffer_ownership);
370372 int mlx5_set_dscp2prio(struct mlx5_core_dev *mdev, u8 dscp, u8 prio);
371373 int mlx5_query_dscp2prio(struct mlx5_core_dev *mdev, u8 *dscp2prio);
372374
drivers/net/ethernet/mellanox/mlx5/core/port.c+20−0
@@ -968,6 +968,26 @@ int mlx5_query_trust_state(struct mlx5_core_dev *mdev, u8 *trust_state) · 967 unmodified lines
968968 return err;
969969 }
970970
971+int mlx5_query_port_buffer_ownership(struct mlx5_core_dev *mdev,
972+ u8 *buffer_ownership)
973+{
974+ u32 out[MLX5_ST_SZ_DW(pfcc_reg)] = {};
975+ int err;
976+
977+ if (!MLX5_CAP_PCAM_FEATURE(mdev, buffer_ownership)) {
978+ *buffer_ownership = MLX5_BUF_OWNERSHIP_UNKNOWN;
979+ return 0;
980+ }
981+
982+ err = mlx5_query_pfcc_reg(mdev, out, sizeof(out));
983+ if (err)
984+ return err;
985+
986+ *buffer_ownership = MLX5_GET(pfcc_reg, out, buf_ownership);
987+
988+ return 0;
989+}
990+
971991 int mlx5_set_dscp2prio(struct mlx5_core_dev *mdev, u8 dscp, u8 prio)
972992 {
973993 int sz = MLX5_ST_SZ_BYTES(qpdpm_reg);
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c+62−19
@@ -74,9 +74,9 @@ static void hws_bwc_matcher_init_attr(struct mlx5hws_bwc_matcher *bwc_matcher, · 73 unmodified lines
7474 static int
7575 hws_bwc_matcher_move_all_simple(struct mlx5hws_bwc_matcher *bwc_matcher)
7676 {
77− bool move_error = false, poll_error = false, drain_error = false;
7877 struct mlx5hws_context *ctx = bwc_matcher->matcher->tbl->ctx;
7978 struct mlx5hws_matcher *matcher = bwc_matcher->matcher;
79+ int drain_error = 0, move_error = 0, poll_error = 0;
8080 u16 bwc_queues = mlx5hws_bwc_queues(ctx);
8181 struct mlx5hws_rule_attr rule_attr;
8282 struct mlx5hws_bwc_rule *bwc_rule;
@@ -84,6 +84,7 @@ hws_bwc_matcher_move_all_simple(struct mlx5hws_bwc_matcher *bwc_matcher) · 1 unmodified line
8484 struct list_head *rules_list;
8585 u32 pending_rules;
8686 int i, ret = 0;
87+ bool drain;
8788
8889 mlx5hws_bwc_rule_fill_attr(bwc_matcher, 0, 0, &rule_attr);
8990
@@ -99,23 +100,37 @@ hws_bwc_matcher_move_all_simple(struct mlx5hws_bwc_matcher *bwc_matcher) · 9 unmodified lines
99100 ret = mlx5hws_matcher_resize_rule_move(matcher,
100101 bwc_rule->rule,
101102 &rule_attr);
102− if (unlikely(ret && !move_error)) {
103− mlx5hws_err(ctx,
104− "Moving BWC rule: move failed (%d), attempting to move rest of the rules\n",
105− ret);
106− move_error = true;
103+ if (unlikely(ret)) {
104+ if (!move_error) {
105+ mlx5hws_err(ctx,
106+ "Moving BWC rule: move failed (%d), attempting to move rest of the rules\n",
107+ ret);
108+ move_error = ret;
109+ }
110+ /* Rule wasn't queued, no need to poll */
111+ continue;
107112 }
108113
109114 pending_rules++;
115+ drain = pending_rules >=
116+ hws_bwc_get_burst_th(ctx, rule_attr.queue_id);
110117 ret = mlx5hws_bwc_queue_poll(ctx,
111118 rule_attr.queue_id,
112119 &pending_rules,
113− false);
114− if (unlikely(ret && !poll_error)) {
115− mlx5hws_err(ctx,
116− "Moving BWC rule: poll failed (%d), attempting to move rest of the rules\n",
117− ret);
118− poll_error = true;
120+ drain);
121+ if (unlikely(ret)) {
122+ if (ret == -ETIMEDOUT) {
123+ mlx5hws_err(ctx,
124+ "Moving BWC rule: timeout polling for completions (%d), aborting rehash\n",
125+ ret);
126+ return ret;
127+ }
128+ if (!poll_error) {
129+ mlx5hws_err(ctx,
130+ "Moving BWC rule: polling for completions failed (%d), attempting to move rest of the rules\n",
131+ ret);
132+ poll_error = ret;
133+ }
119134 }
120135 }
121136
@@ -126,17 +141,30 @@ hws_bwc_matcher_move_all_simple(struct mlx5hws_bwc_matcher *bwc_matcher) · 4 unmodified lines
126141 rule_attr.queue_id,
127142 &pending_rules,
128143 true);
129− if (unlikely(ret && !drain_error)) {
130− mlx5hws_err(ctx,
131− "Moving BWC rule: drain failed (%d), attempting to move rest of the rules\n",
132− ret);
133− drain_error = true;
144+ if (unlikely(ret)) {
145+ if (ret == -ETIMEDOUT) {
146+ mlx5hws_err(ctx,
147+ "Moving bwc rule: timeout draining completions (%d), aborting rehash\n",
148+ ret);
149+ return ret;
150+ }
151+ if (!drain_error) {
152+ mlx5hws_err(ctx,
153+ "Moving bwc rule: drain failed (%d), attempting to move rest of the rules\n",
154+ ret);
155+ drain_error = ret;
156+ }
134157 }
135158 }
136159 }
137160
138− if (move_error || poll_error || drain_error)
139− ret = -EINVAL;
161+ /* Return the first error that happened */
162+ if (unlikely(move_error))
163+ return move_error;
164+ if (unlikely(poll_error))
165+ return poll_error;
166+ if (unlikely(drain_error))
167+ return drain_error;
140168
141169 return ret;
142170 }
@@ -1035,6 +1063,21 @@ int mlx5hws_bwc_rule_create_simple(struct mlx5hws_bwc_rule *bwc_rule, · 892 unmodified lines
10351063 return 0; /* rule inserted successfully */
10361064 }
10371065
1066+ /* Rule insertion could fail due to queue being full, timeout, or
1067+ * matcher in resize. In such cases, no point in trying to rehash.
1068+ */
1069+ if (ret == -EBUSY || ret == -ETIMEDOUT || ret == -EAGAIN) {
1070+ mutex_unlock(queue_lock);
1071+ mlx5hws_err(ctx,
1072+ "BWC rule insertion failed - %s (%d)\n",
1073+ ret == -EBUSY ? "queue is full" :
1074+ ret == -ETIMEDOUT ? "timeout" :
1075+ ret == -EAGAIN ? "matcher in resize" : "N/A",
1076+ ret);
1077+ hws_bwc_rule_cnt_dec(bwc_rule);
1078+ return ret;
1079+ }
1080+
10381081 /* At this point the rule wasn't added.
10391082 * It could be because there was collision, or some other problem.
10401083 * Try rehash by size and insert rule again - last chance.
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc_complex.c+28−13
@@ -1328,11 +1328,11 @@ mlx5hws_bwc_matcher_move_all_complex(struct mlx5hws_bwc_matcher *bwc_matcher) · 1327 unmodified lines
13281328 {
13291329 struct mlx5hws_context *ctx = bwc_matcher->matcher->tbl->ctx;
13301330 struct mlx5hws_matcher *matcher = bwc_matcher->matcher;
1331− bool move_error = false, poll_error = false;
13321331 u16 bwc_queues = mlx5hws_bwc_queues(ctx);
13331332 struct mlx5hws_bwc_rule *tmp_bwc_rule;
13341333 struct mlx5hws_rule_attr rule_attr;
13351334 struct mlx5hws_table *isolated_tbl;
1335+ int move_error = 0, poll_error = 0;
13361336 struct mlx5hws_rule *tmp_rule;
13371337 struct list_head *rules_list;
13381338 u32 expected_completions = 1;
@@ -1391,11 +1391,15 @@ mlx5hws_bwc_matcher_move_all_complex(struct mlx5hws_bwc_matcher *bwc_matcher) · 52 unmodified lines
13911391 ret = mlx5hws_matcher_resize_rule_move(matcher,
13921392 tmp_rule,
13931393 &rule_attr);
1394− if (unlikely(ret && !move_error)) {
1395− mlx5hws_err(ctx,
1396− "Moving complex BWC rule failed (%d), attempting to move rest of the rules\n",
1397− ret);
1398− move_error = true;
1394+ if (unlikely(ret)) {
1395+ if (!move_error) {
1396+ mlx5hws_err(ctx,
1397+ "Moving complex BWC rule: move failed (%d), attempting to move rest of the rules\n",
1398+ ret);
1399+ move_error = ret;
1400+ }
1401+ /* Rule wasn't queued, no need to poll */
1402+ continue;
13991403 }
14001404
14011405 expected_completions = 1;
@@ -1403,11 +1407,19 @@ mlx5hws_bwc_matcher_move_all_complex(struct mlx5hws_bwc_matcher *bwc_matcher) · 1 unmodified line
14031407 rule_attr.queue_id,
14041408 &expected_completions,
14051409 true);
1406− if (unlikely(ret && !poll_error)) {
1407− mlx5hws_err(ctx,
1408− "Moving complex BWC rule: poll failed (%d), attempting to move rest of the rules\n",
1409− ret);
1410− poll_error = true;
1410+ if (unlikely(ret)) {
1411+ if (ret == -ETIMEDOUT) {
1412+ mlx5hws_err(ctx,
1413+ "Moving complex BWC rule: timeout polling for completions (%d), aborting rehash\n",
1414+ ret);
1415+ return ret;
1416+ }
1417+ if (!poll_error) {
1418+ mlx5hws_err(ctx,
1419+ "Moving complex BWC rule: polling for completions failed (%d), attempting to move rest of the rules\n",
1420+ ret);
1421+ poll_error = ret;
1422+ }
14111423 }
14121424
14131425 /* Done moving the rule to the new matcher,
@@ -1422,8 +1434,11 @@ mlx5hws_bwc_matcher_move_all_complex(struct mlx5hws_bwc_matcher *bwc_matcher) · 8 unmodified lines
14221434 }
14231435 }
14241436
1425− if (move_error || poll_error)
1426− ret = -EINVAL;
1437+ /* Return the first error that happened */
1438+ if (unlikely(move_error))
1439+ return move_error;
1440+ if (unlikely(poll_error))
1441+ return poll_error;
14271442
14281443 return ret;
14291444 }
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/cmd.c+1−0
@@ -55,6 +55,7 @@ int mlx5hws_cmd_flow_table_create(struct mlx5_core_dev *mdev, · 54 unmodified lines
5555
5656 MLX5_SET(create_flow_table_in, in, opcode, MLX5_CMD_OP_CREATE_FLOW_TABLE);
5757 MLX5_SET(create_flow_table_in, in, table_type, ft_attr->type);
58+ MLX5_SET(create_flow_table_in, in, uid, ft_attr->uid);
5859
5960 ft_ctx = MLX5_ADDR_OF(create_flow_table_in, in, flow_table_context);
6061 MLX5_SET(flow_table_context, ft_ctx, level, ft_attr->level);
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/cmd.h+1−0
@@ -36,6 +36,7 @@ struct mlx5hws_cmd_set_fte_attr { · 35 unmodified lines
3636 struct mlx5hws_cmd_ft_create_attr {
3737 u8 type;
3838 u8 level;
39+ u16 uid;
3940 bool rtc_valid;
4041 bool decap_en;
4142 bool reformat_en;
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c+1−0
@@ -267,6 +267,7 @@ static int mlx5_cmd_hws_create_flow_table(struct mlx5_flow_root_namespace *ns, · 266 unmodified lines
267267
268268 tbl_attr.type = MLX5HWS_TABLE_TYPE_FDB;
269269 tbl_attr.level = ft_attr->level;
270+ tbl_attr.uid = ft_attr->uid;
270271 tbl = mlx5hws_table_create(ctx, &tbl_attr);
271272 if (!tbl) {
272273 mlx5_core_err(ns->dev, "Failed creating hws flow_table\n");
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/matcher.c+4−1
@@ -85,6 +85,7 @@ static int hws_matcher_create_end_ft_isolated(struct mlx5hws_matcher *matcher) · 84 unmodified lines
8585
8686 ret = mlx5hws_table_create_default_ft(tbl->ctx->mdev,
8787 tbl,
88+ 0,
8889 &matcher->end_ft_id);
8990 if (ret) {
9091 mlx5hws_err(tbl->ctx, "Isolated matcher: failed to create end flow table\n");
@@ -112,7 +113,9 @@ static int hws_matcher_create_end_ft(struct mlx5hws_matcher *matcher) · 21 unmodified lines
112113 if (mlx5hws_matcher_is_isolated(matcher))
113114 ret = hws_matcher_create_end_ft_isolated(matcher);
114115 else
115− ret = mlx5hws_table_create_default_ft(tbl->ctx->mdev, tbl,
116+ ret = mlx5hws_table_create_default_ft(tbl->ctx->mdev,
117+ tbl,
118+ 0,
116119 &matcher->end_ft_id);
117120
118121 if (ret) {
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws.h+1−0
@@ -75,6 +75,7 @@ struct mlx5hws_context_attr { · 74 unmodified lines
7575 struct mlx5hws_table_attr {
7676 enum mlx5hws_table_type type;
7777 u32 level;
78+ u16 uid;
7879 };
7980
8081 enum mlx5hws_matcher_flow_src {
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/send.c+0−1
@@ -964,7 +964,6 @@ static int hws_send_ring_open_cq(struct mlx5_core_dev *mdev, · 963 unmodified lines
964964 return -ENOMEM;
965965
966966 MLX5_SET(cqc, cqc_data, uar_page, mdev->priv.uar->index);
967− MLX5_SET(cqc, cqc_data, cqe_sz, queue->num_entries);
968967 MLX5_SET(cqc, cqc_data, log_cq_size, ilog2(queue->num_entries));
969968
970969 err = hws_send_ring_alloc_cq(mdev, numa_node, queue, cqc_data, cq);
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/table.c+10−3
@@ -9,6 +9,7 @@ u32 mlx5hws_table_get_id(struct mlx5hws_table *tbl) · 8 unmodified lines
99 }
1010
1111 static void hws_table_init_next_ft_attr(struct mlx5hws_table *tbl,
12+ u16 uid,
1213 struct mlx5hws_cmd_ft_create_attr *ft_attr)
1314 {
1415 ft_attr->type = tbl->fw_ft_type;
@@ -16,7 +17,9 @@ static void hws_table_init_next_ft_attr(struct mlx5hws_table *tbl, · 1 unmodified line
1617 ft_attr->level = tbl->ctx->caps->fdb_ft.max_level - 1;
1718 else
1819 ft_attr->level = tbl->ctx->caps->nic_ft.max_level - 1;
20+
1921 ft_attr->rtc_valid = true;
22+ ft_attr->uid = uid;
2023 }
2124
2225 static void hws_table_set_cap_attr(struct mlx5hws_table *tbl,
@@ -119,12 +122,12 @@ static int hws_table_connect_to_default_miss_tbl(struct mlx5hws_table *tbl, u32 · 96 unmodified lines
119122
120123 int mlx5hws_table_create_default_ft(struct mlx5_core_dev *mdev,
121124 struct mlx5hws_table *tbl,
122− u32 *ft_id)
125+ u16 uid, u32 *ft_id)
123126 {
124127 struct mlx5hws_cmd_ft_create_attr ft_attr = {0};
125128 int ret;
126129
127− hws_table_init_next_ft_attr(tbl, &ft_attr);
130+ hws_table_init_next_ft_attr(tbl, uid, &ft_attr);
128131 hws_table_set_cap_attr(tbl, &ft_attr);
129132
130133 ret = mlx5hws_cmd_flow_table_create(mdev, &ft_attr, ft_id);
@@ -189,7 +192,10 @@ static int hws_table_init(struct mlx5hws_table *tbl) · 58 unmodified lines
189192 }
190193
191194 mutex_lock(&ctx->ctrl_lock);
192− ret = mlx5hws_table_create_default_ft(tbl->ctx->mdev, tbl, &tbl->ft_id);
195+ ret = mlx5hws_table_create_default_ft(tbl->ctx->mdev,
196+ tbl,
197+ tbl->uid,
198+ &tbl->ft_id);
193199 if (ret) {
194200 mlx5hws_err(tbl->ctx, "Failed to create flow table object\n");
195201 mutex_unlock(&ctx->ctrl_lock);
@@ -239,6 +245,7 @@ struct mlx5hws_table *mlx5hws_table_create(struct mlx5hws_context *ctx, · 43 unmodified lines
239245 tbl->ctx = ctx;
240246 tbl->type = attr->type;
241247 tbl->level = attr->level;
248+ tbl->uid = attr->uid;
242249
243250 ret = hws_table_init(tbl);
244251 if (ret) {
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/table.h+2−1
@@ -18,6 +18,7 @@ struct mlx5hws_table { · 17 unmodified lines
1818 enum mlx5hws_table_type type;
1919 u32 fw_ft_type;
2020 u32 level;
21+ u16 uid;
2122 struct list_head matchers_list;
2223 struct list_head tbl_list_node;
2324 struct mlx5hws_default_miss default_miss;
@@ -47,7 +48,7 @@ u32 mlx5hws_table_get_res_fw_ft_type(enum mlx5hws_table_type tbl_type, · 23 unmodified lines
4748
4849 int mlx5hws_table_create_default_ft(struct mlx5_core_dev *mdev,
4950 struct mlx5hws_table *tbl,
50− u32 *ft_id);
51+ u16 uid, u32 *ft_id);
5152
5253 void mlx5hws_table_destroy_default_ft(struct mlx5hws_table *tbl,
5354 u32 ft_id);
drivers/net/ethernet/mellanox/mlxsw/spectrum.c+2−0
@@ -2375,6 +2375,8 @@ static const struct mlxsw_listener mlxsw_sp_listener[] = { · 2374 unmodified lines
23752375 ROUTER_EXP, false),
23762376 MLXSW_SP_RXL_NO_MARK(DISCARD_ING_ROUTER_DIP_LINK_LOCAL, FORWARD,
23772377 ROUTER_EXP, false),
2378+ MLXSW_SP_RXL_NO_MARK(DISCARD_ING_ROUTER_SIP_LINK_LOCAL, FORWARD,
2379+ ROUTER_EXP, false),
23782380 /* Multicast Router Traps */
23792381 MLXSW_SP_RXL_MARK(ACL1, TRAP_TO_CPU, MULTICAST, false),
23802382 MLXSW_SP_RXL_L3_MARK(ACL2, TRAP_TO_CPU, MULTICAST, false),
drivers/net/ethernet/mellanox/mlxsw/trap.h+1−0
@@ -94,6 +94,7 @@ enum { · 93 unmodified lines
9494 MLXSW_TRAP_ID_DISCARD_ING_ROUTER_IPV4_SIP_BC = 0x16A,
9595 MLXSW_TRAP_ID_DISCARD_ING_ROUTER_IPV4_DIP_LOCAL_NET = 0x16B,
9696 MLXSW_TRAP_ID_DISCARD_ING_ROUTER_DIP_LINK_LOCAL = 0x16C,
97+ MLXSW_TRAP_ID_DISCARD_ING_ROUTER_SIP_LINK_LOCAL = 0x16D,
9798 MLXSW_TRAP_ID_DISCARD_ROUTER_IRIF_EN = 0x178,
9899 MLXSW_TRAP_ID_DISCARD_ROUTER_ERIF_EN = 0x179,
99100 MLXSW_TRAP_ID_DISCARD_ROUTER_LPM4 = 0x17B,
drivers/net/ethernet/microchip/lan865x/lan865x.c+21−0
@@ -32,6 +32,10 @@ · 31 unmodified lines
3232 /* MAC Specific Addr 1 Top Reg */
3333 #define LAN865X_REG_MAC_H_SADDR1 0x00010023
3434
35+/* MAC TSU Timer Increment Register */
36+#define LAN865X_REG_MAC_TSU_TIMER_INCR 0x00010077
37+#define MAC_TSU_TIMER_INCR_COUNT_NANOSECONDS 0x0028
38+
3539 struct lan865x_priv {
3640 struct work_struct multicast_work;
3741 struct net_device *netdev;
@@ -311,6 +315,8 @@ static int lan865x_net_open(struct net_device *netdev) · 273 unmodified lines
311315
312316 phy_start(netdev->phydev);
313317
318+ netif_start_queue(netdev);
319+
314320 return 0;
315321 }
316322
@@ -344,6 +350,21 @@ static int lan865x_probe(struct spi_device *spi) · 27 unmodified lines
344350 goto free_netdev;
345351 }
346352
353+ /* LAN865x Rev.B0/B1 configuration parameters from AN1760
354+ * As per the Configuration Application Note AN1760 published in the
355+ * link, https://www.microchip.com/en-us/application-notes/an1760
356+ * Revision F (DS60001760G - June 2024), configure the MAC to set time
357+ * stamping at the end of the Start of Frame Delimiter (SFD) and set the
358+ * Timer Increment reg to 40 ns to be used as a 25 MHz internal clock.
359+ */
360+ ret = oa_tc6_write_register(priv->tc6, LAN865X_REG_MAC_TSU_TIMER_INCR,
361+ MAC_TSU_TIMER_INCR_COUNT_NANOSECONDS);
362+ if (ret) {
363+ dev_err(&spi->dev, "Failed to config TSU Timer Incr reg: %d\n",
364+ ret);
365+ goto oa_tc6_exit;
366+ }
367+
347368 /* As per the point s3 in the below errata, SPI receive Ethernet frame
348369 * transfer may halt when starting the next frame in the same data block
349370 * (chunk) as the end of a previous frame. The RFA field should be
drivers/net/ethernet/realtek/rtase/rtase.h+1−1
@@ -241,7 +241,7 @@ union rtase_rx_desc { · 240 unmodified lines
241241 #define RTASE_RX_RES BIT(20)
242242 #define RTASE_RX_RUNT BIT(19)
243243 #define RTASE_RX_RWT BIT(18)
244−#define RTASE_RX_CRC BIT(16)
244+#define RTASE_RX_CRC BIT(17)
245245 #define RTASE_RX_V6F BIT(31)
246246 #define RTASE_RX_V4F BIT(30)
247247 #define RTASE_RX_UDPT BIT(29)
drivers/net/ethernet/stmicro/stmmac/dwmac-thead.c+8−1
@@ -152,7 +152,7 @@ static int thead_set_clk_tx_rate(void *bsp_priv, struct clk *clk_tx_i, · 151 unmodified lines
152152 static int thead_dwmac_enable_clk(struct plat_stmmacenet_data *plat)
153153 {
154154 struct thead_dwmac *dwmac = plat->bsp_priv;
155− u32 reg;
155+ u32 reg, div;
156156
157157 switch (plat->mac_interface) {
158158 case PHY_INTERFACE_MODE_MII:
@@ -164,6 +164,13 @@ static int thead_dwmac_enable_clk(struct plat_stmmacenet_data *plat) · 5 unmodified lines
164164 case PHY_INTERFACE_MODE_RGMII_RXID:
165165 case PHY_INTERFACE_MODE_RGMII_TXID:
166166 /* use pll */
167+ div = clk_get_rate(plat->stmmac_clk) / rgmii_clock(SPEED_1000);
168+ reg = FIELD_PREP(GMAC_PLLCLK_DIV_EN, 1) |
169+ FIELD_PREP(GMAC_PLLCLK_DIV_NUM, div);
170+
171+ writel(0, dwmac->apb_base + GMAC_PLLCLK_DIV);
172+ writel(reg, dwmac->apb_base + GMAC_PLLCLK_DIV);
173+
167174 writel(GMAC_GTXCLK_SEL_PLL, dwmac->apb_base + GMAC_GTXCLK_SEL);
168175 reg = GMAC_TX_CLK_EN | GMAC_TX_CLK_N_EN | GMAC_TX_CLK_OUT_EN |
169176 GMAC_RX_CLK_EN | GMAC_RX_CLK_N_EN;
drivers/net/ethernet/ti/icssg/icssg_prueth.c+41−31
@@ -203,6 +203,44 @@ static void prueth_emac_stop(struct prueth *prueth) · 202 unmodified lines
203203 }
204204 }
205205
206+static void icssg_enable_fw_offload(struct prueth *prueth)
207+{
208+ struct prueth_emac *emac;
209+ int mac;
210+
211+ for (mac = PRUETH_MAC0; mac < PRUETH_NUM_MACS; mac++) {
212+ emac = prueth->emac[mac];
213+ if (prueth->is_hsr_offload_mode) {
214+ if (emac->ndev->features & NETIF_F_HW_HSR_TAG_RM)
215+ icssg_set_port_state(emac, ICSSG_EMAC_HSR_RX_OFFLOAD_ENABLE);
216+ else
217+ icssg_set_port_state(emac, ICSSG_EMAC_HSR_RX_OFFLOAD_DISABLE);
218+ }
219+
220+ if (prueth->is_switch_mode || prueth->is_hsr_offload_mode) {
221+ if (netif_running(emac->ndev)) {
222+ icssg_fdb_add_del(emac, eth_stp_addr, prueth->default_vlan,
223+ ICSSG_FDB_ENTRY_P0_MEMBERSHIP |
224+ ICSSG_FDB_ENTRY_P1_MEMBERSHIP |
225+ ICSSG_FDB_ENTRY_P2_MEMBERSHIP |
226+ ICSSG_FDB_ENTRY_BLOCK,
227+ true);
228+ icssg_vtbl_modify(emac, emac->port_vlan | DEFAULT_VID,
229+ BIT(emac->port_id) | DEFAULT_PORT_MASK,
230+ BIT(emac->port_id) | DEFAULT_UNTAG_MASK,
231+ true);
232+ if (prueth->is_hsr_offload_mode)
233+ icssg_vtbl_modify(emac, DEFAULT_VID,
234+ DEFAULT_PORT_MASK,
235+ DEFAULT_UNTAG_MASK, true);
236+ icssg_set_pvid(prueth, emac->port_vlan, emac->port_id);
237+ if (prueth->is_switch_mode)
238+ icssg_set_port_state(emac, ICSSG_EMAC_PORT_VLAN_AWARE_ENABLE);
239+ }
240+ }
241+ }
242+}
243+
206244 static int prueth_emac_common_start(struct prueth *prueth)
207245 {
208246 struct prueth_emac *emac;
@@ -753,6 +791,7 @@ static int emac_ndo_open(struct net_device *ndev) · 544 unmodified lines
753791 ret = prueth_emac_common_start(prueth);
754792 if (ret)
755793 goto free_rx_irq;
794+ icssg_enable_fw_offload(prueth);
756795 }
757796
758797 flow_cfg = emac->dram.va + ICSSG_CONFIG_OFFSET + PSI_L_REGULAR_FLOW_ID_BASE_OFFSET;
@@ -1360,8 +1399,7 @@ static int prueth_emac_restart(struct prueth *prueth) · 601 unmodified lines
13601399
13611400 static void icssg_change_mode(struct prueth *prueth)
13621401 {
1363− struct prueth_emac *emac;
1364− int mac, ret;
1402+ int ret;
13651403
13661404 ret = prueth_emac_restart(prueth);
13671405 if (ret) {
@@ -1369,35 +1407,7 @@ static void icssg_change_mode(struct prueth *prueth) · 1 unmodified line
13691407 return;
13701408 }
13711409
1372− for (mac = PRUETH_MAC0; mac < PRUETH_NUM_MACS; mac++) {
1373− emac = prueth->emac[mac];
1374− if (prueth->is_hsr_offload_mode) {
1375− if (emac->ndev->features & NETIF_F_HW_HSR_TAG_RM)
1376− icssg_set_port_state(emac, ICSSG_EMAC_HSR_RX_OFFLOAD_ENABLE);
1377− else
1378− icssg_set_port_state(emac, ICSSG_EMAC_HSR_RX_OFFLOAD_DISABLE);
1379− }
1380−
1381− if (netif_running(emac->ndev)) {
1382− icssg_fdb_add_del(emac, eth_stp_addr, prueth->default_vlan,
1383− ICSSG_FDB_ENTRY_P0_MEMBERSHIP |
1384− ICSSG_FDB_ENTRY_P1_MEMBERSHIP |
1385− ICSSG_FDB_ENTRY_P2_MEMBERSHIP |
1386− ICSSG_FDB_ENTRY_BLOCK,
1387− true);
1388− icssg_vtbl_modify(emac, emac->port_vlan | DEFAULT_VID,
1389− BIT(emac->port_id) | DEFAULT_PORT_MASK,
1390− BIT(emac->port_id) | DEFAULT_UNTAG_MASK,
1391− true);
1392− if (prueth->is_hsr_offload_mode)
1393− icssg_vtbl_modify(emac, DEFAULT_VID,
1394− DEFAULT_PORT_MASK,
1395− DEFAULT_UNTAG_MASK, true);
1396− icssg_set_pvid(prueth, emac->port_vlan, emac->port_id);
1397− if (prueth->is_switch_mode)
1398− icssg_set_port_state(emac, ICSSG_EMAC_PORT_VLAN_AWARE_ENABLE);
1399− }
1400− }
1410+ icssg_enable_fw_offload(prueth);
14011411 }
14021412
14031413 static int prueth_netdevice_port_link(struct net_device *ndev,
drivers/net/ethernet/wangxun/libwx/wx_vf_lib.c+1−1
@@ -192,7 +192,7 @@ void wx_setup_vfmrqc_vf(struct wx *wx) · 191 unmodified lines
192192 u8 i, j;
193193
194194 /* Fill out hash function seeds */
195− netdev_rss_key_fill(wx->rss_key, sizeof(wx->rss_key));
195+ netdev_rss_key_fill(wx->rss_key, WX_RSS_KEY_SIZE);
196196 for (i = 0; i < WX_RSS_KEY_SIZE / 4; i++)
197197 wr32(wx, WX_VXRSSRK(i), wx->rss_key[i]);
198198
drivers/net/ethernet/xilinx/xilinx_axienet_main.c+6−2
@@ -1160,6 +1160,7 @@ static void axienet_dma_rx_cb(void *data, const struct dmaengine_result *result) · 1159 unmodified lines
11601160 struct axienet_local *lp = data;
11611161 struct sk_buff *skb;
11621162 u32 *app_metadata;
1163+ int i;
11631164
11641165 skbuf_dma = axienet_get_rx_desc(lp, lp->rx_ring_tail++);
11651166 skb = skbuf_dma->skb;
@@ -1178,7 +1179,10 @@ static void axienet_dma_rx_cb(void *data, const struct dmaengine_result *result) · 12 unmodified lines
11781179 u64_stats_add(&lp->rx_packets, 1);
11791180 u64_stats_add(&lp->rx_bytes, rx_len);
11801181 u64_stats_update_end(&lp->rx_stat_sync);
1181− axienet_rx_submit_desc(lp->ndev);
1182+
1183+ for (i = 0; i < CIRC_SPACE(lp->rx_ring_head, lp->rx_ring_tail,
1184+ RX_BUF_NUM_DEFAULT); i++)
1185+ axienet_rx_submit_desc(lp->ndev);
11821186 dma_async_issue_pending(lp->rx_chan);
11831187 }
11841188
@@ -1457,7 +1461,6 @@ static void axienet_rx_submit_desc(struct net_device *ndev) · 272 unmodified lines
14571461 if (!skbuf_dma)
14581462 return;
14591463
1460− lp->rx_ring_head++;
14611464 skb = netdev_alloc_skb(ndev, lp->max_frm_size);
14621465 if (!skb)
14631466 return;
@@ -1482,6 +1485,7 @@ static void axienet_rx_submit_desc(struct net_device *ndev) · 18 unmodified lines
14821485 skbuf_dma->desc = dma_rx_desc;
14831486 dma_rx_desc->callback_param = lp;
14841487 dma_rx_desc->callback_result = axienet_dma_rx_cb;
1488+ lp->rx_ring_head++;
14851489 dmaengine_submit(dma_rx_desc);
14861490
14871491 return;
drivers/net/phy/mscc/mscc.h+12−0
@@ -362,6 +362,13 @@ struct vsc85xx_hw_stat { · 361 unmodified lines
362362 u16 mask;
363363 };
364364
365+struct vsc8531_skb_cb {
366+ u32 ns;
367+};
368+
369+#define VSC8531_SKB_CB(skb) \
370+ ((struct vsc8531_skb_cb *)((skb)->cb))
371+
365372 struct vsc8531_private {
366373 int rate_magic;
367374 u16 supp_led_modes;
@@ -410,6 +417,11 @@ struct vsc8531_private { · 42 unmodified lines
410417 */
411418 struct mutex ts_lock;
412419 struct mutex phc_lock;
420+
421+ /* list of skbs that were received and need timestamp information but it
422+ * didn't received it yet
423+ */
424+ struct sk_buff_head rx_skbs_list;
413425 };
414426
415427 /* Shared structure between the PHYs of the same package.
drivers/net/phy/mscc/mscc_main.c+12−0
@@ -2335,6 +2335,13 @@ static int vsc85xx_probe(struct phy_device *phydev) · 2334 unmodified lines
23352335 return vsc85xx_dt_led_modes_get(phydev, default_mode);
23362336 }
23372337
2338+static void vsc85xx_remove(struct phy_device *phydev)
2339+{
2340+ struct vsc8531_private *priv = phydev->priv;
2341+
2342+ skb_queue_purge(&priv->rx_skbs_list);
2343+}
2344+
23382345 /* Microsemi VSC85xx PHYs */
23392346 static struct phy_driver vsc85xx_driver[] = {
23402347 {
@@ -2589,6 +2596,7 @@ static struct phy_driver vsc85xx_driver[] = { · 248 unmodified lines
25892596 .config_intr = &vsc85xx_config_intr,
25902597 .suspend = &genphy_suspend,
25912598 .resume = &genphy_resume,
2599+ .remove = &vsc85xx_remove,
25922600 .probe = &vsc8574_probe,
25932601 .set_wol = &vsc85xx_wol_set,
25942602 .get_wol = &vsc85xx_wol_get,
@@ -2614,6 +2622,7 @@ static struct phy_driver vsc85xx_driver[] = { · 19 unmodified lines
26142622 .config_intr = &vsc85xx_config_intr,
26152623 .suspend = &genphy_suspend,
26162624 .resume = &genphy_resume,
2625+ .remove = &vsc85xx_remove,
26172626 .probe = &vsc8574_probe,
26182627 .set_wol = &vsc85xx_wol_set,
26192628 .get_wol = &vsc85xx_wol_get,
@@ -2639,6 +2648,7 @@ static struct phy_driver vsc85xx_driver[] = { · 19 unmodified lines
26392648 .config_intr = &vsc85xx_config_intr,
26402649 .suspend = &genphy_suspend,
26412650 .resume = &genphy_resume,
2651+ .remove = &vsc85xx_remove,
26422652 .probe = &vsc8584_probe,
26432653 .get_tunable = &vsc85xx_get_tunable,
26442654 .set_tunable = &vsc85xx_set_tunable,
@@ -2662,6 +2672,7 @@ static struct phy_driver vsc85xx_driver[] = { · 17 unmodified lines
26622672 .config_intr = &vsc85xx_config_intr,
26632673 .suspend = &genphy_suspend,
26642674 .resume = &genphy_resume,
2675+ .remove = &vsc85xx_remove,
26652676 .probe = &vsc8584_probe,
26662677 .get_tunable = &vsc85xx_get_tunable,
26672678 .set_tunable = &vsc85xx_set_tunable,
@@ -2685,6 +2696,7 @@ static struct phy_driver vsc85xx_driver[] = { · 17 unmodified lines
26852696 .config_intr = &vsc85xx_config_intr,
26862697 .suspend = &genphy_suspend,
26872698 .resume = &genphy_resume,
2699+ .remove = &vsc85xx_remove,
26882700 .probe = &vsc8584_probe,
26892701 .get_tunable = &vsc85xx_get_tunable,
26902702 .set_tunable = &vsc85xx_set_tunable,
drivers/net/phy/mscc/mscc_ptp.c+37−12
@@ -1194,9 +1194,7 @@ static bool vsc85xx_rxtstamp(struct mii_timestamper *mii_ts, · 1193 unmodified lines
11941194 {
11951195 struct vsc8531_private *vsc8531 =
11961196 container_of(mii_ts, struct vsc8531_private, mii_ts);
1197− struct skb_shared_hwtstamps *shhwtstamps = NULL;
11981197 struct vsc85xx_ptphdr *ptphdr;
1199− struct timespec64 ts;
12001198 unsigned long ns;
12011199
12021200 if (!vsc8531->ptp->configured)
@@ -1206,27 +1204,52 @@ static bool vsc85xx_rxtstamp(struct mii_timestamper *mii_ts, · 3 unmodified lines
12061204 type == PTP_CLASS_NONE)
12071205 return false;
12081206
1209− vsc85xx_gettime(&vsc8531->ptp->caps, &ts);
1210−
12111207 ptphdr = get_ptp_header_rx(skb, vsc8531->ptp->rx_filter);
12121208 if (!ptphdr)
12131209 return false;
12141210
1215− shhwtstamps = skb_hwtstamps(skb);
1216− memset(shhwtstamps, 0, sizeof(struct skb_shared_hwtstamps));
1217−
12181211 ns = ntohl(ptphdr->rsrvd2);
12191212
1220− /* nsec is in reserved field */
1221− if (ts.tv_nsec < ns)
1222− ts.tv_sec--;
1213+ VSC8531_SKB_CB(skb)->ns = ns;
1214+ skb_queue_tail(&vsc8531->rx_skbs_list, skb);
12231215
1224− shhwtstamps->hwtstamp = ktime_set(ts.tv_sec, ns);
1225− netif_rx(skb);
1216+ ptp_schedule_worker(vsc8531->ptp->ptp_clock, 0);
12261217
12271218 return true;
12281219 }
12291220
1221+static long vsc85xx_do_aux_work(struct ptp_clock_info *info)
1222+{
1223+ struct vsc85xx_ptp *ptp = container_of(info, struct vsc85xx_ptp, caps);
1224+ struct skb_shared_hwtstamps *shhwtstamps = NULL;
1225+ struct phy_device *phydev = ptp->phydev;
1226+ struct vsc8531_private *priv = phydev->priv;
1227+ struct sk_buff_head received;
1228+ struct sk_buff *rx_skb;
1229+ struct timespec64 ts;
1230+ unsigned long flags;
1231+
1232+ __skb_queue_head_init(&received);
1233+ spin_lock_irqsave(&priv->rx_skbs_list.lock, flags);
1234+ skb_queue_splice_tail_init(&priv->rx_skbs_list, &received);
1235+ spin_unlock_irqrestore(&priv->rx_skbs_list.lock, flags);
1236+
1237+ vsc85xx_gettime(info, &ts);
1238+ while ((rx_skb = __skb_dequeue(&received)) != NULL) {
1239+ shhwtstamps = skb_hwtstamps(rx_skb);
1240+ memset(shhwtstamps, 0, sizeof(struct skb_shared_hwtstamps));
1241+
1242+ if (ts.tv_nsec < VSC8531_SKB_CB(rx_skb)->ns)
1243+ ts.tv_sec--;
1244+
1245+ shhwtstamps->hwtstamp = ktime_set(ts.tv_sec,
1246+ VSC8531_SKB_CB(rx_skb)->ns);
1247+ netif_rx(rx_skb);
1248+ }
1249+
1250+ return -1;
1251+}
1252+
12301253 static const struct ptp_clock_info vsc85xx_clk_caps = {
12311254 .owner = THIS_MODULE,
12321255 .name = "VSC85xx timer",
@@ -1240,6 +1263,7 @@ static const struct ptp_clock_info vsc85xx_clk_caps = { · 7 unmodified lines
12401263 .adjfine = &vsc85xx_adjfine,
12411264 .gettime64 = &vsc85xx_gettime,
12421265 .settime64 = &vsc85xx_settime,
1266+ .do_aux_work = &vsc85xx_do_aux_work,
12431267 };
12441268
12451269 static struct vsc8531_private *vsc8584_base_priv(struct phy_device *phydev)
@@ -1567,6 +1591,7 @@ int vsc8584_ptp_probe(struct phy_device *phydev) · 321 unmodified lines
15671591
15681592 mutex_init(&vsc8531->phc_lock);
15691593 mutex_init(&vsc8531->ts_lock);
1594+ skb_queue_head_init(&vsc8531->rx_skbs_list);
15701595
15711596 /* Retrieve the shared load/save GPIO. Request it as non exclusive as
15721597 * the same GPIO can be requested by all the PHYs of the same package.
drivers/net/ppp/ppp_generic.c+11−6
@@ -33,6 +33,7 @@ · 32 unmodified lines
3333 #include <linux/ppp_channel.h>
3434 #include <linux/ppp-comp.h>
3535 #include <linux/skbuff.h>
36+#include <linux/rculist.h>
3637 #include <linux/rtnetlink.h>
3738 #include <linux/if_arp.h>
3839 #include <linux/ip.h>
@@ -1598,11 +1599,14 @@ static int ppp_fill_forward_path(struct net_device_path_ctx *ctx, · 1559 unmodified lines
15981599 if (ppp->flags & SC_MULTILINK)
15991600 return -EOPNOTSUPP;
16001601
1601− if (list_empty(&ppp->channels))
1602+ pch = list_first_or_null_rcu(&ppp->channels, struct channel, clist);
1603+ if (!pch)
1604+ return -ENODEV;
1605+
1606+ chan = READ_ONCE(pch->chan);
1607+ if (!chan)
16021608 return -ENODEV;
16031609
1604− pch = list_first_entry(&ppp->channels, struct channel, clist);
1605− chan = pch->chan;
16061610 if (!chan->ops->fill_forward_path)
16071611 return -EOPNOTSUPP;
16081612
@@ -2994,7 +2998,7 @@ ppp_unregister_channel(struct ppp_channel *chan) · 1385 unmodified lines
29942998 */
29952999 down_write(&pch->chan_sem);
29963000 spin_lock_bh(&pch->downl);
2997− pch->chan = NULL;
3001+ WRITE_ONCE(pch->chan, NULL);
29983002 spin_unlock_bh(&pch->downl);
29993003 up_write(&pch->chan_sem);
30003004 ppp_disconnect_channel(pch);
@@ -3515,7 +3519,7 @@ ppp_connect_channel(struct channel *pch, int unit) · 514 unmodified lines
35153519 hdrlen = pch->file.hdrlen + 2; /* for protocol bytes */
35163520 if (hdrlen > ppp->dev->hard_header_len)
35173521 ppp->dev->hard_header_len = hdrlen;
3518− list_add_tail(&pch->clist, &ppp->channels);
3522+ list_add_tail_rcu(&pch->clist, &ppp->channels);
35193523 ++ppp->n_channels;
35203524 pch->ppp = ppp;
35213525 refcount_inc(&ppp->file.refcnt);
@@ -3545,10 +3549,11 @@ ppp_disconnect_channel(struct channel *pch) · 23 unmodified lines
35453549 if (ppp) {
35463550 /* remove it from the ppp unit's list */
35473551 ppp_lock(ppp);
3548− list_del(&pch->clist);
3552+ list_del_rcu(&pch->clist);
35493553 if (--ppp->n_channels == 0)
35503554 wake_up_interruptible(&ppp->file.rwait);
35513555 ppp_unlock(ppp);
3556+ synchronize_net();
35523557 if (refcount_dec_and_test(&ppp->file.refcnt))
35533558 ppp_destroy_interface(ppp);
35543559 err = 0;
drivers/net/pse-pd/pd692x0.c+48−15
@@ -1041,6 +1041,10 @@ pd692x0_configure_managers(struct pd692x0_priv *priv, int nmanagers) · 1040 unmodified lines
10411041 int pw_budget;
10421042
10431043 pw_budget = regulator_get_unclaimed_power_budget(supply);
1044+ if (!pw_budget)
1045+ /* Do nothing if no power budget */
1046+ continue;
1047+
10441048 /* Max power budget per manager */
10451049 if (pw_budget > 6000000)
10461050 pw_budget = 6000000;
@@ -1162,12 +1166,44 @@ pd692x0_write_ports_matrix(struct pd692x0_priv *priv, · 115 unmodified lines
11621166 return 0;
11631167 }
11641168
1169+static void pd692x0_of_put_managers(struct pd692x0_priv *priv,
1170+ struct pd692x0_manager *manager,
1171+ int nmanagers)
1172+{
1173+ int i, j;
1174+
1175+ for (i = 0; i < nmanagers; i++) {
1176+ for (j = 0; j < manager[i].nports; j++)
1177+ of_node_put(manager[i].port_node[j]);
1178+ of_node_put(manager[i].node);
1179+ }
1180+}
1181+
1182+static void pd692x0_managers_free_pw_budget(struct pd692x0_priv *priv)
1183+{
1184+ int i;
1185+
1186+ for (i = 0; i < PD692X0_MAX_MANAGERS; i++) {
1187+ struct regulator *supply;
1188+
1189+ if (!priv->manager_reg[i] || !priv->manager_pw_budget[i])
1190+ continue;
1191+
1192+ supply = priv->manager_reg[i]->supply;
1193+ if (!supply)
1194+ continue;
1195+
1196+ regulator_free_power_budget(supply,
1197+ priv->manager_pw_budget[i]);
1198+ }
1199+}
1200+
11651201 static int pd692x0_setup_pi_matrix(struct pse_controller_dev *pcdev)
11661202 {
11671203 struct pd692x0_manager *manager __free(kfree) = NULL;
11681204 struct pd692x0_priv *priv = to_pd692x0_priv(pcdev);
11691205 struct pd692x0_matrix port_matrix[PD692X0_MAX_PIS];
1170− int ret, i, j, nmanagers;
1206+ int ret, nmanagers;
11711207
11721208 /* Should we flash the port matrix */
11731209 if (priv->fw_state != PD692X0_FW_OK &&
@@ -1185,31 +1221,27 @@ static int pd692x0_setup_pi_matrix(struct pse_controller_dev *pcdev) · 11 unmodified lines
11851221 nmanagers = ret;
11861222 ret = pd692x0_register_managers_regulator(priv, manager, nmanagers);
11871223 if (ret)
1188− goto out;
1224+ goto err_of_managers;
11891225
11901226 ret = pd692x0_configure_managers(priv, nmanagers);
11911227 if (ret)
1192− goto out;
1228+ goto err_of_managers;
11931229
11941230 ret = pd692x0_set_ports_matrix(priv, manager, nmanagers, port_matrix);
11951231 if (ret)
1196− goto out;
1232+ goto err_managers_req_pw;
11971233
11981234 ret = pd692x0_write_ports_matrix(priv, port_matrix);
11991235 if (ret)
1200− goto out;
1201−
1202−out:
1203− for (i = 0; i < nmanagers; i++) {
1204− struct regulator *supply = priv->manager_reg[i]->supply;
1236+ goto err_managers_req_pw;
12051237
1206− regulator_free_power_budget(supply,
1207− priv->manager_pw_budget[i]);
1238+ pd692x0_of_put_managers(priv, manager, nmanagers);
1239+ return 0;
12081240
1209− for (j = 0; j < manager[i].nports; j++)
1210− of_node_put(manager[i].port_node[j]);
1211− of_node_put(manager[i].node);
1212− }
1241+err_managers_req_pw:
1242+ pd692x0_managers_free_pw_budget(priv);
1243+err_of_managers:
1244+ pd692x0_of_put_managers(priv, manager, nmanagers);
12131245 return ret;
12141246 }
12151247
@@ -1748,6 +1780,7 @@ static void pd692x0_i2c_remove(struct i2c_client *client) · 532 unmodified lines
17481780 {
17491781 struct pd692x0_priv *priv = i2c_get_clientdata(client);
17501782
1783+ pd692x0_managers_free_pw_budget(priv);
17511784 firmware_upload_unregister(priv->fwl);
17521785 }
17531786
drivers/net/usb/asix_devices.c+1−1
@@ -676,7 +676,7 @@ static int ax88772_init_mdio(struct usbnet *dev) · 675 unmodified lines
676676 priv->mdio->read = &asix_mdio_bus_read;
677677 priv->mdio->write = &asix_mdio_bus_write;
678678 priv->mdio->name = "Asix MDIO Bus";
679− priv->mdio->phy_mask = ~(BIT(priv->phy_addr) | BIT(AX_EMBD_PHY_ADDR));
679+ priv->mdio->phy_mask = ~(BIT(priv->phy_addr & 0x1f) | BIT(AX_EMBD_PHY_ADDR));
680680 /* mii bus name is usb-<usb bus number>-<usb device number> */
681681 snprintf(priv->mdio->id, MII_BUS_ID_SIZE, "usb-%03d:%03d",
682682 dev->udev->bus->busnum, dev->udev->devnum);
drivers/net/usb/cdc_ncm.c+7−0
@@ -2087,6 +2087,13 @@ static const struct usb_device_id cdc_devs[] = { · 2086 unmodified lines
20872087 .driver_info = (unsigned long)&wwan_info,
20882088 },
20892089
2090+ /* Intel modem (label from OEM reads Fibocom L850-GL) */
2091+ { USB_DEVICE_AND_INTERFACE_INFO(0x8087, 0x095a,
2092+ USB_CLASS_COMM,
2093+ USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE),
2094+ .driver_info = (unsigned long)&wwan_info,
2095+ },
2096+
20902097 /* DisplayLink docking stations */
20912098 { .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
20922099 | USB_DEVICE_ID_MATCH_VENDOR,
drivers/pci/controller/pcie-xilinx.c+1−1
@@ -400,7 +400,7 @@ static irqreturn_t xilinx_pcie_intr_handler(int irq, void *data) · 399 unmodified lines
400400 if (val & XILINX_PCIE_RPIFR1_MSI_INTR) {
401401 val = pcie_read(pcie, XILINX_PCIE_REG_RPIFR2) &
402402 XILINX_PCIE_RPIFR2_MSG_DATA;
403− domain = pcie->msi_domain->parent;
403+ domain = pcie->msi_domain;
404404 } else {
405405 val = (val & XILINX_PCIE_RPIFR1_INTR_MASK) >>
406406 XILINX_PCIE_RPIFR1_INTR_SHIFT;
drivers/pci/controller/vmd.c+0−3
@@ -306,9 +306,6 @@ static bool vmd_init_dev_msi_info(struct device *dev, struct irq_domain *domain, · 305 unmodified lines
306306 struct irq_domain *real_parent,
307307 struct msi_domain_info *info)
308308 {
309− if (WARN_ON_ONCE(info->bus_token != DOMAIN_BUS_PCI_DEVICE_MSIX))
310− return false;
311−
312309 if (!msi_lib_init_dev_msi_info(dev, domain, real_parent, info))
313310 return false;
314311
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/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/tty/serial/8250/8250_rsa.c+4−4
@@ -147,7 +147,7 @@ void rsa_enable(struct uart_8250_port *up) · 146 unmodified lines
147147 if (up->port.uartclk == SERIAL_RSA_BAUD_BASE * 16)
148148 serial_out(up, UART_RSA_FRR, 0);
149149 }
150−EXPORT_SYMBOL_GPL_FOR_MODULES(rsa_enable, "8250_base");
150+EXPORT_SYMBOL_FOR_MODULES(rsa_enable, "8250_base");
151151
152152 /*
153153 * Attempts to turn off the RSA FIFO and resets the RSA board back to 115kbps compat mode. It is
@@ -179,7 +179,7 @@ void rsa_disable(struct uart_8250_port *up) · 25 unmodified lines
179179 up->port.uartclk = SERIAL_RSA_BAUD_BASE_LO * 16;
180180 uart_port_unlock_irq(&up->port);
181181 }
182−EXPORT_SYMBOL_GPL_FOR_MODULES(rsa_disable, "8250_base");
182+EXPORT_SYMBOL_FOR_MODULES(rsa_disable, "8250_base");
183183
184184 void rsa_autoconfig(struct uart_8250_port *up)
185185 {
@@ -192,7 +192,7 @@ void rsa_autoconfig(struct uart_8250_port *up) · 6 unmodified lines
192192 if (__rsa_enable(up))
193193 up->port.type = PORT_RSA;
194194 }
195−EXPORT_SYMBOL_GPL_FOR_MODULES(rsa_autoconfig, "8250_base");
195+EXPORT_SYMBOL_FOR_MODULES(rsa_autoconfig, "8250_base");
196196
197197 void rsa_reset(struct uart_8250_port *up)
198198 {
@@ -201,7 +201,7 @@ void rsa_reset(struct uart_8250_port *up) · 2 unmodified lines
201201
202202 serial_out(up, UART_RSA_FRR, 0);
203203 }
204−EXPORT_SYMBOL_GPL_FOR_MODULES(rsa_reset, "8250_base");
204+EXPORT_SYMBOL_FOR_MODULES(rsa_reset, "8250_base");
205205
206206 #ifdef CONFIG_SERIAL_8250_DEPRECATED_OPTIONS
207207 #ifndef MODULE
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/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/anon_inodes.c+1−1
@@ -129,7 +129,7 @@ struct inode *anon_inode_make_secure_inode(struct super_block *sb, const char *n · 128 unmodified lines
129129 }
130130 return inode;
131131 }
132−EXPORT_SYMBOL_GPL_FOR_MODULES(anon_inode_make_secure_inode, "kvm");
132+EXPORT_SYMBOL_FOR_MODULES(anon_inode_make_secure_inode, "kvm");
133133
134134 static struct file *__anon_inode_getfile(const char *name,
135135 const struct file_operations *fops,
fs/btrfs/extent_io.c+19−5
@@ -1512,7 +1512,7 @@ out: · 1511 unmodified lines
15121512
15131513 /*
15141514 * Return 0 if we have submitted or queued the sector for submission.
1515− * Return <0 for critical errors.
1515+ * Return <0 for critical errors, and the sector will have its dirty flag cleared.
15161516 *
15171517 * Caller should make sure filepos < i_size and handle filepos >= i_size case.
15181518 */
@@ -1535,8 +1535,17 @@ static int submit_one_sector(struct btrfs_inode *inode, · 16 unmodified lines
15351535 ASSERT(filepos < i_size);
15361536
15371537 em = btrfs_get_extent(inode, NULL, filepos, sectorsize);
1538− if (IS_ERR(em))
1538+ if (IS_ERR(em)) {
1539+ /*
1540+ * When submission failed, we should still clear the folio dirty.
1541+ * Or the folio will be written back again but without any
1542+ * ordered extent.
1543+ */
1544+ btrfs_folio_clear_dirty(fs_info, folio, filepos, sectorsize);
1545+ btrfs_folio_set_writeback(fs_info, folio, filepos, sectorsize);
1546+ btrfs_folio_clear_writeback(fs_info, folio, filepos, sectorsize);
15391547 return PTR_ERR(em);
1548+ }
15401549
15411550 extent_offset = filepos - em->start;
15421551 em_end = btrfs_extent_map_end(em);
@@ -1609,8 +1618,12 @@ static noinline_for_stack int extent_writepage_io(struct btrfs_inode *inode, · 66 unmodified lines
16091618 folio_unlock(folio);
16101619 return 1;
16111620 }
1612− if (ret < 0)
1621+ if (ret < 0) {
1622+ btrfs_folio_clear_dirty(fs_info, folio, start, len);
1623+ btrfs_folio_set_writeback(fs_info, folio, start, len);
1624+ btrfs_folio_clear_writeback(fs_info, folio, start, len);
16131625 return ret;
1626+ }
16141627
16151628 for (cur = start; cur < start + len; cur += fs_info->sectorsize)
16161629 set_bit((cur - folio_start) >> fs_info->sectorsize_bits, &range_bitmap);
@@ -1666,8 +1679,8 @@ static noinline_for_stack int extent_writepage_io(struct btrfs_inode *inode, · 49 unmodified lines
16661679 * Here we set writeback and clear for the range. If the full folio
16671680 * is no longer dirty then we clear the PAGECACHE_TAG_DIRTY tag.
16681681 *
1669− * If we hit any error, the corresponding sector will still be dirty
1670− * thus no need to clear PAGECACHE_TAG_DIRTY.
1682+ * If we hit any error, the corresponding sector will have its dirty
1683+ * flag cleared and writeback finished, thus no need to handle the error case.
16711684 */
16721685 if (!submitted_io && !error) {
16731686 btrfs_folio_set_writeback(fs_info, folio, start, len);
@@ -1813,6 +1826,7 @@ static noinline_for_stack bool lock_extent_buffer_for_io(struct extent_buffer *e · 139 unmodified lines
18131826 xas_load(&xas);
18141827 xas_set_mark(&xas, PAGECACHE_TAG_WRITEBACK);
18151828 xas_clear_mark(&xas, PAGECACHE_TAG_DIRTY);
1829+ xas_clear_mark(&xas, PAGECACHE_TAG_TOWRITE);
18161830 xas_unlock_irqrestore(&xas, flags);
18171831
18181832 btrfs_set_header_flag(eb, BTRFS_HEADER_FLAG_WRITTEN);
fs/btrfs/inode.c+19−10
@@ -4189,6 +4189,23 @@ int btrfs_update_inode_fallback(struct btrfs_trans_handle *trans, · 4188 unmodified lines
41894189 return ret;
41904190 }
41914191
4192+static void update_time_after_link_or_unlink(struct btrfs_inode *dir)
4193+{
4194+ struct timespec64 now;
4195+
4196+ /*
4197+ * If we are replaying a log tree, we do not want to update the mtime
4198+ * and ctime of the parent directory with the current time, since the
4199+ * log replay procedure is responsible for setting them to their correct
4200+ * values (the ones it had when the fsync was done).
4201+ */
4202+ if (test_bit(BTRFS_FS_LOG_RECOVERING, &dir->root->fs_info->flags))
4203+ return;
4204+
4205+ now = inode_set_ctime_current(&dir->vfs_inode);
4206+ inode_set_mtime_to_ts(&dir->vfs_inode, now);
4207+}
4208+
41924209 /*
41934210 * unlink helper that gets used here in inode.c and in the tree logging
41944211 * recovery code. It remove a link in a directory with a given name, and
@@ -4289,7 +4306,7 @@ skip_backref: · 94 unmodified lines
42894306 inode_inc_iversion(&inode->vfs_inode);
42904307 inode_set_ctime_current(&inode->vfs_inode);
42914308 inode_inc_iversion(&dir->vfs_inode);
4292− inode_set_mtime_to_ts(&dir->vfs_inode, inode_set_ctime_current(&dir->vfs_inode));
4309+ update_time_after_link_or_unlink(dir);
42934310
42944311 return btrfs_update_inode(trans, dir);
42954312 }
@@ -6683,15 +6700,7 @@ int btrfs_add_link(struct btrfs_trans_handle *trans, · 2387 unmodified lines
66836700 btrfs_i_size_write(parent_inode, parent_inode->vfs_inode.i_size +
66846701 name->len * 2);
66856702 inode_inc_iversion(&parent_inode->vfs_inode);
6686− /*
6687− * If we are replaying a log tree, we do not want to update the mtime
6688− * and ctime of the parent directory with the current time, since the
6689− * log replay procedure is responsible for setting them to their correct
6690− * values (the ones it had when the fsync was done).
6691− */
6692− if (!test_bit(BTRFS_FS_LOG_RECOVERING, &root->fs_info->flags))
6693− inode_set_mtime_to_ts(&parent_inode->vfs_inode,
6694− inode_set_ctime_current(&parent_inode->vfs_inode));
6703+ update_time_after_link_or_unlink(parent_inode);
66956704
66966705 ret = btrfs_update_inode(trans, parent_inode);
66976706 if (ret)
fs/btrfs/subpage.c+18−1
@@ -448,8 +448,25 @@ void btrfs_subpage_set_writeback(const struct btrfs_fs_info *fs_info, · 447 unmodified lines
448448
449449 spin_lock_irqsave(&bfs->lock, flags);
450450 bitmap_set(bfs->bitmaps, start_bit, len >> fs_info->sectorsize_bits);
451+
452+ /*
453+ * Don't clear the TOWRITE tag when starting writeback on a still-dirty
454+ * folio. Doing so can cause WB_SYNC_ALL writepages() to overlook it,
455+ * assume writeback is complete, and exit too early — violating sync
456+ * ordering guarantees.
457+ */
451458 if (!folio_test_writeback(folio))
452− folio_start_writeback(folio);
459+ __folio_start_writeback(folio, true);
460+ if (!folio_test_dirty(folio)) {
461+ struct address_space *mapping = folio_mapping(folio);
462+ XA_STATE(xas, &mapping->i_pages, folio->index);
463+ unsigned long flags;
464+
465+ xas_lock_irqsave(&xas, flags);
466+ xas_load(&xas);
467+ xas_clear_mark(&xas, PAGECACHE_TAG_TOWRITE);
468+ xas_unlock_irqrestore(&xas, flags);
469+ }
453470 spin_unlock_irqrestore(&bfs->lock, flags);
454471 }
455472
fs/btrfs/super.c+8−5
@@ -88,6 +88,9 @@ struct btrfs_fs_context { · 87 unmodified lines
8888 refcount_t refs;
8989 };
9090
91+static void btrfs_emit_options(struct btrfs_fs_info *info,
92+ struct btrfs_fs_context *old);
93+
9194 enum {
9295 Opt_acl,
9396 Opt_clear_cache,
@@ -698,12 +701,9 @@ bool btrfs_check_options(const struct btrfs_fs_info *info, · 604 unmodified lines
698701
699702 if (!test_bit(BTRFS_FS_STATE_REMOUNTING, &info->fs_state)) {
700703 if (btrfs_raw_test_opt(*mount_opt, SPACE_CACHE)) {
701− btrfs_info(info, "disk space caching is enabled");
702704 btrfs_warn(info,
703705 "space cache v1 is being deprecated and will be removed in a future release, please use -o space_cache=v2");
704706 }
705− if (btrfs_raw_test_opt(*mount_opt, FREE_SPACE_TREE))
706− btrfs_info(info, "using free-space-tree");
707707 }
708708
709709 return ret;
@@ -980,6 +980,8 @@ static int btrfs_fill_super(struct super_block *sb, · 270 unmodified lines
980980 return ret;
981981 }
982982
983+ btrfs_emit_options(fs_info, NULL);
984+
983985 inode = btrfs_iget(BTRFS_FIRST_FREE_OBJECTID, fs_info->fs_root);
984986 if (IS_ERR(inode)) {
985987 ret = PTR_ERR(inode);
@@ -1437,7 +1439,7 @@ static void btrfs_emit_options(struct btrfs_fs_info *info, · 451 unmodified lines
14371439 {
14381440 btrfs_info_if_set(info, old, NODATASUM, "setting nodatasum");
14391441 btrfs_info_if_set(info, old, DEGRADED, "allowing degraded mounts");
1440− btrfs_info_if_set(info, old, NODATASUM, "setting nodatasum");
1442+ btrfs_info_if_set(info, old, NODATACOW, "setting nodatacow");
14411443 btrfs_info_if_set(info, old, SSD, "enabling ssd optimizations");
14421444 btrfs_info_if_set(info, old, SSD_SPREAD, "using spread ssd allocation scheme");
14431445 btrfs_info_if_set(info, old, NOBARRIER, "turning off barriers");
@@ -1459,10 +1461,11 @@ static void btrfs_emit_options(struct btrfs_fs_info *info, · 15 unmodified lines
14591461 btrfs_info_if_set(info, old, IGNOREMETACSUMS, "ignoring meta csums");
14601462 btrfs_info_if_set(info, old, IGNORESUPERFLAGS, "ignoring unknown super block flags");
14611463
1464+ btrfs_info_if_unset(info, old, NODATASUM, "setting datasum");
14621465 btrfs_info_if_unset(info, old, NODATACOW, "setting datacow");
14631466 btrfs_info_if_unset(info, old, SSD, "not using ssd optimizations");
14641467 btrfs_info_if_unset(info, old, SSD_SPREAD, "not using spread ssd allocation scheme");
1465− btrfs_info_if_unset(info, old, NOBARRIER, "turning off barriers");
1468+ btrfs_info_if_unset(info, old, NOBARRIER, "turning on barriers");
14661469 btrfs_info_if_unset(info, old, NOTREELOG, "enabling tree log");
14671470 btrfs_info_if_unset(info, old, SPACE_CACHE, "disabling disk space caching");
14681471 btrfs_info_if_unset(info, old, FREE_SPACE_TREE, "disabling free space tree");
fs/btrfs/zoned.c+99−34
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 #include "accessors.h"
1818 #include "bio.h"
1919 #include "transaction.h"
20+#include "sysfs.h"
2021
2122 /* Maximum number of zones to report per blkdev_report_zones() call */
2223 #define BTRFS_REPORT_NR_ZONES 4096
@@ -42,6 +43,9 @@ · 19 unmodified lines
4243 /* Number of superblock log zones */
4344 #define BTRFS_NR_SB_LOG_ZONES 2
4445
46+/* Default number of max active zones when the device has no limits. */
47+#define BTRFS_DEFAULT_MAX_ACTIVE_ZONES 128
48+
4549 /*
4650 * Minimum of active zones we need:
4751 *
@@ -416,7 +420,10 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cache) · 368 unmodified lines
416420 if (!IS_ALIGNED(nr_sectors, zone_sectors))
417421 zone_info->nr_zones++;
418422
419− max_active_zones = bdev_max_active_zones(bdev);
423+ max_active_zones = min_not_zero(bdev_max_active_zones(bdev),
424+ bdev_max_open_zones(bdev));
425+ if (!max_active_zones && zone_info->nr_zones > BTRFS_DEFAULT_MAX_ACTIVE_ZONES)
426+ max_active_zones = BTRFS_DEFAULT_MAX_ACTIVE_ZONES;
420427 if (max_active_zones && max_active_zones < BTRFS_MIN_ACTIVE_ZONES) {
421428 btrfs_err(fs_info,
422429 "zoned: %s: max active zones %u is too small, need at least %u active zones",
@@ -2168,10 +2175,15 @@ bool btrfs_zone_activate(struct btrfs_block_group *block_group) · 1745 unmodified lines
21682175 goto out_unlock;
21692176 }
21702177
2171− /* No space left */
2172− if (btrfs_zoned_bg_is_full(block_group)) {
2173− ret = false;
2174− goto out_unlock;
2178+ if (block_group->flags & BTRFS_BLOCK_GROUP_DATA) {
2179+ /* The caller should check if the block group is full. */
2180+ if (WARN_ON_ONCE(btrfs_zoned_bg_is_full(block_group))) {
2181+ ret = false;
2182+ goto out_unlock;
2183+ }
2184+ } else {
2185+ /* Since it is already written, it should have been active. */
2186+ WARN_ON_ONCE(block_group->meta_write_pointer != block_group->start);
21752187 }
21762188
21772189 for (i = 0; i < map->num_stripes; i++) {
@@ -2230,7 +2242,7 @@ static void wait_eb_writebacks(struct btrfs_block_group *block_group) · 52 unmodified lines
22302242 struct btrfs_fs_info *fs_info = block_group->fs_info;
22312243 const u64 end = block_group->start + block_group->length;
22322244 struct extent_buffer *eb;
2233− unsigned long index, start = (block_group->start >> fs_info->sectorsize_bits);
2245+ unsigned long index, start = (block_group->start >> fs_info->nodesize_bits);
22342246
22352247 rcu_read_lock();
22362248 xa_for_each_start(&fs_info->buffer_tree, index, eb, start) {
@@ -2245,6 +2257,40 @@ static void wait_eb_writebacks(struct btrfs_block_group *block_group) · 8 unmodified lines
22452257 rcu_read_unlock();
22462258 }
22472259
2260+static int call_zone_finish(struct btrfs_block_group *block_group,
2261+ struct btrfs_io_stripe *stripe)
2262+{
2263+ struct btrfs_device *device = stripe->dev;
2264+ const u64 physical = stripe->physical;
2265+ struct btrfs_zoned_device_info *zinfo = device->zone_info;
2266+ int ret;
2267+
2268+ if (!device->bdev)
2269+ return 0;
2270+
2271+ if (zinfo->max_active_zones == 0)
2272+ return 0;
2273+
2274+ if (btrfs_dev_is_sequential(device, physical)) {
2275+ unsigned int nofs_flags;
2276+
2277+ nofs_flags = memalloc_nofs_save();
2278+ ret = blkdev_zone_mgmt(device->bdev, REQ_OP_ZONE_FINISH,
2279+ physical >> SECTOR_SHIFT,
2280+ zinfo->zone_size >> SECTOR_SHIFT);
2281+ memalloc_nofs_restore(nofs_flags);
2282+
2283+ if (ret)
2284+ return ret;
2285+ }
2286+
2287+ if (!(block_group->flags & BTRFS_BLOCK_GROUP_DATA))
2288+ zinfo->reserved_active_zones++;
2289+ btrfs_dev_clear_active_zone(device, physical);
2290+
2291+ return 0;
2292+}
2293+
22482294 static int do_zone_finish(struct btrfs_block_group *block_group, bool fully_written)
22492295 {
22502296 struct btrfs_fs_info *fs_info = block_group->fs_info;
@@ -2329,31 +2375,12 @@ static int do_zone_finish(struct btrfs_block_group *block_group, bool fully_writ · 78 unmodified lines
23292375 down_read(&dev_replace->rwsem);
23302376 map = block_group->physical_map;
23312377 for (i = 0; i < map->num_stripes; i++) {
2332− struct btrfs_device *device = map->stripes[i].dev;
2333− const u64 physical = map->stripes[i].physical;
2334− struct btrfs_zoned_device_info *zinfo = device->zone_info;
2335− unsigned int nofs_flags;
2336−
2337− if (!device->bdev)
2338− continue;
2339−
2340− if (zinfo->max_active_zones == 0)
2341− continue;
2342−
2343− nofs_flags = memalloc_nofs_save();
2344− ret = blkdev_zone_mgmt(device->bdev, REQ_OP_ZONE_FINISH,
2345− physical >> SECTOR_SHIFT,
2346− zinfo->zone_size >> SECTOR_SHIFT);
2347− memalloc_nofs_restore(nofs_flags);
23482378
2379+ ret = call_zone_finish(block_group, &map->stripes[i]);
23492380 if (ret) {
23502381 up_read(&dev_replace->rwsem);
23512382 return ret;
23522383 }
2353−
2354− if (!(block_group->flags & BTRFS_BLOCK_GROUP_DATA))
2355− zinfo->reserved_active_zones++;
2356− btrfs_dev_clear_active_zone(device, physical);
23572384 }
23582385 up_read(&dev_replace->rwsem);
23592386
@@ -2504,12 +2531,12 @@ void btrfs_clear_data_reloc_bg(struct btrfs_block_group *bg) · 144 unmodified lines
25042531 void btrfs_zoned_reserve_data_reloc_bg(struct btrfs_fs_info *fs_info)
25052532 {
25062533 struct btrfs_space_info *data_sinfo = fs_info->data_sinfo;
2507− struct btrfs_space_info *space_info = data_sinfo->sub_group[0];
2534+ struct btrfs_space_info *space_info = data_sinfo;
25082535 struct btrfs_trans_handle *trans;
25092536 struct btrfs_block_group *bg;
25102537 struct list_head *bg_list;
25112538 u64 alloc_flags;
2512− bool initial = false;
2539+ bool first = true;
25132540 bool did_chunk_alloc = false;
25142541 int index;
25152542 int ret;
@@ -2523,21 +2550,52 @@ void btrfs_zoned_reserve_data_reloc_bg(struct btrfs_fs_info *fs_info) · 7 unmodified lines
25232550 if (sb_rdonly(fs_info->sb))
25242551 return;
25252552
2526− ASSERT(space_info->subgroup_id == BTRFS_SUB_GROUP_DATA_RELOC);
25272553 alloc_flags = btrfs_get_alloc_profile(fs_info, space_info->flags);
25282554 index = btrfs_bg_flags_to_raid_index(alloc_flags);
25292555
2530− bg_list = &data_sinfo->block_groups[index];
2556+ /* Scan the data space_info to find empty block groups. Take the second one. */
25312557 again:
2558+ bg_list = &space_info->block_groups[index];
25322559 list_for_each_entry(bg, bg_list, list) {
2533− if (bg->used > 0)
2560+ if (bg->alloc_offset != 0)
25342561 continue;
25352562
2536− if (!initial) {
2537− initial = true;
2563+ if (first) {
2564+ first = false;
25382565 continue;
25392566 }
25402567
2568+ if (space_info == data_sinfo) {
2569+ /* Migrate the block group to the data relocation space_info. */
2570+ struct btrfs_space_info *reloc_sinfo = data_sinfo->sub_group[0];
2571+ int factor;
2572+
2573+ ASSERT(reloc_sinfo->subgroup_id == BTRFS_SUB_GROUP_DATA_RELOC);
2574+ factor = btrfs_bg_type_to_factor(bg->flags);
2575+
2576+ down_write(&space_info->groups_sem);
2577+ list_del_init(&bg->list);
2578+ /* We can assume this as we choose the second empty one. */
2579+ ASSERT(!list_empty(&space_info->block_groups[index]));
2580+ up_write(&space_info->groups_sem);
2581+
2582+ spin_lock(&space_info->lock);
2583+ space_info->total_bytes -= bg->length;
2584+ space_info->disk_total -= bg->length * factor;
2585+ /* There is no allocation ever happened. */
2586+ ASSERT(bg->used == 0);
2587+ ASSERT(bg->zone_unusable == 0);
2588+ /* No super block in a block group on the zoned setup. */
2589+ ASSERT(bg->bytes_super == 0);
2590+ spin_unlock(&space_info->lock);
2591+
2592+ bg->space_info = reloc_sinfo;
2593+ if (reloc_sinfo->block_group_kobjs[index] == NULL)
2594+ btrfs_sysfs_add_block_group_type(bg);
2595+
2596+ btrfs_add_bg_to_space_info(fs_info, bg);
2597+ }
2598+
25412599 fs_info->data_reloc_bg = bg->start;
25422600 set_bit(BLOCK_GROUP_FLAG_ZONED_DATA_RELOC, &bg->runtime_flags);
25432601 btrfs_zone_activate(bg);
@@ -2552,11 +2610,18 @@ again: · 8 unmodified lines
25522610 if (IS_ERR(trans))
25532611 return;
25542612
2613+ /* Allocate new BG in the data relocation space_info. */
2614+ space_info = data_sinfo->sub_group[0];
2615+ ASSERT(space_info->subgroup_id == BTRFS_SUB_GROUP_DATA_RELOC);
25552616 ret = btrfs_chunk_alloc(trans, space_info, alloc_flags, CHUNK_ALLOC_FORCE);
25562617 btrfs_end_transaction(trans);
25572618 if (ret == 1) {
2619+ /*
2620+ * We allocated a new block group in the data relocation space_info. We
2621+ * can take that one.
2622+ */
2623+ first = false;
25582624 did_chunk_alloc = true;
2559− bg_list = &space_info->block_groups[index];
25602625 goto again;
25612626 }
25622627 }
fs/buffer.c+1−1
@@ -157,8 +157,8 @@ static void __end_buffer_read_notouch(struct buffer_head *bh, int uptodate) · 156 unmodified lines
157157 */
158158 void end_buffer_read_sync(struct buffer_head *bh, int uptodate)
159159 {
160− __end_buffer_read_notouch(bh, uptodate);
161160 put_bh(bh);
161+ __end_buffer_read_notouch(bh, uptodate);
162162 }
163163 EXPORT_SYMBOL(end_buffer_read_sync);
164164
fs/coredump.c+1−1
@@ -345,7 +345,7 @@ static bool coredump_parse(struct core_name *cn, struct coredump_params *cprm, · 344 unmodified lines
345345 was_space = false;
346346 err = cn_printf(cn, "%c", '\0');
347347 if (err)
348− return err;
348+ return false;
349349 (*argv)[(*argc)++] = cn->used;
350350 }
351351 }
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/ext4/fsmap.c+20−3
@@ -393,6 +393,14 @@ static unsigned int ext4_getfsmap_find_sb(struct super_block *sb, · 392 unmodified lines
393393 /* Reserved GDT blocks */
394394 if (!ext4_has_feature_meta_bg(sb) || metagroup < first_meta_bg) {
395395 len = le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks);
396+
397+ /*
398+ * mkfs.ext4 can set s_reserved_gdt_blocks as 0 in some cases,
399+ * check for that.
400+ */
401+ if (!len)
402+ return 0;
403+
396404 error = ext4_getfsmap_fill(meta_list, fsb, len,
397405 EXT4_FMR_OWN_RESV_GDT);
398406 if (error)
@@ -526,6 +534,7 @@ static int ext4_getfsmap_datadev(struct super_block *sb, · 127 unmodified lines
526534 ext4_group_t end_ag;
527535 ext4_grpblk_t first_cluster;
528536 ext4_grpblk_t last_cluster;
537+ struct ext4_fsmap irec;
529538 int error = 0;
530539
531540 bofs = le32_to_cpu(sbi->s_es->s_first_data_block);
@@ -609,10 +618,18 @@ static int ext4_getfsmap_datadev(struct super_block *sb, · 77 unmodified lines
609618 goto err;
610619 }
611620
612− /* Report any gaps at the end of the bg */
621+ /*
622+ * The dummy record below will cause ext4_getfsmap_helper() to report
623+ * any allocated blocks at the end of the range.
624+ */
625+ irec.fmr_device = 0;
626+ irec.fmr_physical = end_fsb + 1;
627+ irec.fmr_length = 0;
628+ irec.fmr_owner = EXT4_FMR_OWN_FREE;
629+ irec.fmr_flags = 0;
630+
613631 info->gfi_last = true;
614− error = ext4_getfsmap_datadev_helper(sb, end_ag, last_cluster + 1,
615− 0, info);
632+ error = ext4_getfsmap_helper(sb, info, &irec);
616633 if (error)
617634 goto err;
618635
fs/ext4/indirect.c+2−2
@@ -539,7 +539,7 @@ int ext4_ind_map_blocks(handle_t *handle, struct inode *inode, · 538 unmodified lines
539539 int indirect_blks;
540540 int blocks_to_boundary = 0;
541541 int depth;
542− int count = 0;
542+ u64 count = 0;
543543 ext4_fsblk_t first_block = 0;
544544
545545 trace_ext4_ind_map_blocks_enter(inode, map->m_lblk, map->m_len, flags);
@@ -588,7 +588,7 @@ int ext4_ind_map_blocks(handle_t *handle, struct inode *inode, · 42 unmodified lines
588588 count++;
589589 /* Fill in size of a hole we found */
590590 map->m_pblk = 0;
591− map->m_len = min_t(unsigned int, map->m_len, count);
591+ map->m_len = umin(map->m_len, count);
592592 goto cleanup;
593593 }
594594
fs/ext4/inode.c+2−2
@@ -146,7 +146,7 @@ static inline int ext4_begin_ordered_truncate(struct inode *inode, · 145 unmodified lines
146146 */
147147 int ext4_inode_is_fast_symlink(struct inode *inode)
148148 {
149− if (!(EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL)) {
149+ if (!ext4_has_feature_ea_inode(inode->i_sb)) {
150150 int ea_blocks = EXT4_I(inode)->i_file_acl ?
151151 EXT4_CLUSTER_SIZE(inode->i_sb) >> 9 : 0;
152152
@@ -3155,7 +3155,7 @@ retry: · 3002 unmodified lines
31553155 folio_unlock(folio);
31563156 folio_put(folio);
31573157 /*
3158− * block_write_begin may have instantiated a few blocks
3158+ * ext4_block_write_begin may have instantiated a few blocks
31593159 * outside i_size. Trim these off again. Don't need
31603160 * i_size_read because we hold inode lock.
31613161 */
fs/ext4/namei.c+0−4
@@ -2965,7 +2965,6 @@ int ext4_init_new_dir(handle_t *handle, struct inode *dir, · 2964 unmodified lines
29652965 struct inode *inode)
29662966 {
29672967 struct buffer_head *dir_block = NULL;
2968− struct ext4_dir_entry_2 *de;
29692968 ext4_lblk_t block = 0;
29702969 int err;
29712970
@@ -2982,10 +2981,7 @@ int ext4_init_new_dir(handle_t *handle, struct inode *dir, · 10 unmodified lines
29822981 dir_block = ext4_append(handle, inode, &block);
29832982 if (IS_ERR(dir_block))
29842983 return PTR_ERR(dir_block);
2985− de = (struct ext4_dir_entry_2 *)dir_block->b_data;
29862984 err = ext4_init_dirblock(handle, inode, dir_block, dir->i_ino, NULL, 0);
2987− if (err)
2988− goto out;
29892985 out:
29902986 brelse(dir_block);
29912987 return err;
fs/ext4/orphan.c+3−2
@@ -589,8 +589,9 @@ int ext4_init_orphan_info(struct super_block *sb) · 588 unmodified lines
589589 }
590590 oi->of_blocks = inode->i_size >> sb->s_blocksize_bits;
591591 oi->of_csum_seed = EXT4_I(inode)->i_csum_seed;
592− oi->of_binfo = kmalloc(oi->of_blocks*sizeof(struct ext4_orphan_block),
593− GFP_KERNEL);
592+ oi->of_binfo = kmalloc_array(oi->of_blocks,
593+ sizeof(struct ext4_orphan_block),
594+ GFP_KERNEL);
594595 if (!oi->of_binfo) {
595596 ret = -ENOMEM;
596597 goto out_put;
fs/ext4/page-io.c+1−1
@@ -547,7 +547,7 @@ int ext4_bio_write_folio(struct ext4_io_submit *io, struct folio *folio, · 546 unmodified lines
547547 * first page of the bio. Otherwise it can deadlock.
548548 */
549549 if (io->io_bio)
550− gfp_flags = GFP_NOWAIT | __GFP_NOWARN;
550+ gfp_flags = GFP_NOWAIT;
551551 retry_encrypt:
552552 bounce_page = fscrypt_encrypt_pagecache_blocks(folio,
553553 enc_bytes, 0, gfp_flags);
fs/ext4/super.c+8−4
@@ -268,7 +268,7 @@ struct buffer_head *ext4_sb_bread_unmovable(struct super_block *sb, · 267 unmodified lines
268268 void ext4_sb_breadahead_unmovable(struct super_block *sb, sector_t block)
269269 {
270270 struct buffer_head *bh = bdev_getblk(sb->s_bdev, block,
271− sb->s_blocksize, GFP_NOWAIT | __GFP_NOWARN);
271+ sb->s_blocksize, GFP_NOWAIT);
272272
273273 if (likely(bh)) {
274274 if (trylock_buffer(bh))
@@ -1998,6 +1998,9 @@ int ext4_init_fs_context(struct fs_context *fc) · 1723 unmodified lines
19981998 fc->fs_private = ctx;
19991999 fc->ops = &ext4_context_ops;
20002000
2001+ /* i_version is always enabled now */
2002+ fc->sb_flags |= SB_I_VERSION;
2003+
20012004 return 0;
20022005 }
20032006
@@ -2975,6 +2978,8 @@ static int _ext4_show_options(struct seq_file *seq, struct super_block *sb, · 971 unmodified lines
29752978 SEQ_OPTS_PRINT("min_batch_time=%u", sbi->s_min_batch_time);
29762979 if (nodefs || sbi->s_max_batch_time != EXT4_DEF_MAX_BATCH_TIME)
29772980 SEQ_OPTS_PRINT("max_batch_time=%u", sbi->s_max_batch_time);
2981+ if (nodefs && sb->s_flags & SB_I_VERSION)
2982+ SEQ_OPTS_PUTS("i_version");
29782983 if (nodefs || sbi->s_stripe)
29792984 SEQ_OPTS_PRINT("stripe=%lu", sbi->s_stripe);
29802985 if (nodefs || EXT4_MOUNT_DATA_FLAGS &
@@ -5314,9 +5319,6 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb) · 2333 unmodified lines
53145319 sb->s_flags = (sb->s_flags & ~SB_POSIXACL) |
53155320 (test_opt(sb, POSIX_ACL) ? SB_POSIXACL : 0);
53165321
5317− /* i_version is always enabled now */
5318− sb->s_flags |= SB_I_VERSION;
5319−
53205322 /* HSM events are allowed by default. */
53215323 sb->s_iflags |= SB_I_ALLOW_HSM;
53225324
@@ -5414,6 +5416,8 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb) · 91 unmodified lines
54145416 err = ext4_load_and_init_journal(sb, es, ctx);
54155417 if (err)
54165418 goto failed_mount3a;
5419+ if (bdev_read_only(sb->s_bdev))
5420+ needs_recovery = 0;
54175421 } else if (test_opt(sb, NOLOAD) && !sb_rdonly(sb) &&
54185422 ext4_has_feature_journal_needs_recovery(sb)) {
54195423 ext4_msg(sb, KERN_ERR, "required journal recovery "
fs/fhandle.c+1−1
@@ -402,7 +402,7 @@ static long do_handle_open(int mountdirfd, struct file_handle __user *ufh, · 401 unmodified lines
402402 if (retval)
403403 return retval;
404404
405− CLASS(get_unused_fd, fd)(O_CLOEXEC);
405+ CLASS(get_unused_fd, fd)(open_flag);
406406 if (fd < 0)
407407 return fd;
408408
fs/fs-writeback.c+5−4
@@ -2608,10 +2608,6 @@ void __mark_inode_dirty(struct inode *inode, int flags) · 2607 unmodified lines
26082608 wakeup_bdi = inode_io_list_move_locked(inode, wb,
26092609 dirty_list);
26102610
2611− spin_unlock(&wb->list_lock);
2612− spin_unlock(&inode->i_lock);
2613− trace_writeback_dirty_inode_enqueue(inode);
2614−
26152611 /*
26162612 * If this is the first dirty inode for this bdi,
26172613 * we have to wake-up the corresponding bdi thread
@@ -2621,6 +2617,11 @@ void __mark_inode_dirty(struct inode *inode, int flags) · 3 unmodified lines
26212617 if (wakeup_bdi &&
26222618 (wb->bdi->capabilities & BDI_CAP_WRITEBACK))
26232619 wb_wakeup_delayed(wb);
2620+
2621+ spin_unlock(&wb->list_lock);
2622+ spin_unlock(&inode->i_lock);
2623+ trace_writeback_dirty_inode_enqueue(inode);
2624+
26242625 return;
26252626 }
26262627 }
fs/fuse/inode.c+0−5
@@ -289,11 +289,6 @@ void fuse_change_attributes_common(struct inode *inode, struct fuse_attr *attr, · 288 unmodified lines
289289 }
290290 }
291291
292− if (attr->blksize != 0)
293− inode->i_blkbits = ilog2(attr->blksize);
294− else
295− inode->i_blkbits = inode->i_sb->s_blocksize_bits;
296−
297292 /*
298293 * Don't set the sticky bit in i_mode, unless we want the VFS
299294 * to check permissions. This prevents failures due to the
fs/iomap/direct-io.c+7−7
@@ -363,14 +363,14 @@ static int iomap_dio_bio_iter(struct iomap_iter *iter, struct iomap_dio *dio) · 362 unmodified lines
363363 if (iomap->flags & IOMAP_F_SHARED)
364364 dio->flags |= IOMAP_DIO_COW;
365365
366− if (iomap->flags & IOMAP_F_NEW) {
366+ if (iomap->flags & IOMAP_F_NEW)
367367 need_zeroout = true;
368− } else if (iomap->type == IOMAP_MAPPED) {
369− if (iomap_dio_can_use_fua(iomap, dio))
370− bio_opf |= REQ_FUA;
371− else
372− dio->flags &= ~IOMAP_DIO_WRITE_THROUGH;
373− }
368+ else if (iomap->type == IOMAP_MAPPED &&
369+ iomap_dio_can_use_fua(iomap, dio))
370+ bio_opf |= REQ_FUA;
371+
372+ if (!(bio_opf & REQ_FUA))
373+ dio->flags &= ~IOMAP_DIO_WRITE_THROUGH;
374374
375375 /*
376376 * We can only do deferred completion for pure overwrites that
fs/jbd2/checkpoint.c+1−0
@@ -285,6 +285,7 @@ restart: · 284 unmodified lines
285285 retry:
286286 if (batch_count)
287287 __flush_batch(journal, &batch_count);
288+ cond_resched();
288289 spin_lock(&journal->j_list_lock);
289290 goto restart;
290291 }
fs/kernfs/inode.c+2−2
@@ -142,9 +142,9 @@ ssize_t kernfs_iop_listxattr(struct dentry *dentry, char *buf, size_t size) · 141 unmodified lines
142142 struct kernfs_node *kn = kernfs_dentry_node(dentry);
143143 struct kernfs_iattrs *attrs;
144144
145− attrs = kernfs_iattrs_noalloc(kn);
145+ attrs = kernfs_iattrs(kn);
146146 if (!attrs)
147− return -ENODATA;
147+ return -ENOMEM;
148148
149149 return simple_xattr_list(d_inode(dentry), &attrs->xattrs, buf, size);
150150 }
fs/namespace.c+44−32
@@ -1197,10 +1197,7 @@ static void commit_tree(struct mount *mnt) · 1196 unmodified lines
11971197
11981198 if (!mnt_ns_attached(mnt)) {
11991199 for (struct mount *m = mnt; m; m = next_mnt(m, mnt))
1200− if (unlikely(mnt_ns_attached(m)))
1201− m = skip_mnt_tree(m);
1202− else
1203− mnt_add_to_ns(n, m);
1200+ mnt_add_to_ns(n, m);
12041201 n->nr_mounts += n->pending_mounts;
12051202 n->pending_mounts = 0;
12061203 }
@@ -2704,6 +2701,7 @@ static int attach_recursive_mnt(struct mount *source_mnt, · 1497 unmodified lines
27042701 lock_mnt_tree(child);
27052702 q = __lookup_mnt(&child->mnt_parent->mnt,
27062703 child->mnt_mountpoint);
2704+ commit_tree(child);
27072705 if (q) {
27082706 struct mountpoint *mp = root.mp;
27092707 struct mount *r = child;
@@ -2713,7 +2711,6 @@ static int attach_recursive_mnt(struct mount *source_mnt, · 3 unmodified lines
27132711 mp = shorter;
27142712 mnt_change_mountpoint(r, mp, q);
27152713 }
2716− commit_tree(child);
27172714 }
27182715 unpin_mountpoint(&root);
27192716 unlock_mount_hash();
@@ -2862,6 +2859,19 @@ static int graft_tree(struct mount *mnt, struct mount *p, struct mountpoint *mp) · 142 unmodified lines
28622859 return attach_recursive_mnt(mnt, p, mp);
28632860 }
28642861
2862+static int may_change_propagation(const struct mount *m)
2863+{
2864+ struct mnt_namespace *ns = m->mnt_ns;
2865+
2866+ // it must be mounted in some namespace
2867+ if (IS_ERR_OR_NULL(ns)) // is_mounted()
2868+ return -EINVAL;
2869+ // and the caller must be admin in userns of that namespace
2870+ if (!ns_capable(ns->user_ns, CAP_SYS_ADMIN))
2871+ return -EPERM;
2872+ return 0;
2873+}
2874+
28652875 /*
28662876 * Sanity check the flags to change_mnt_propagation.
28672877 */
@@ -2898,10 +2908,10 @@ static int do_change_type(struct path *path, int ms_flags) · 30 unmodified lines
28982908 return -EINVAL;
28992909
29002910 namespace_lock();
2901− if (!check_mnt(mnt)) {
2902− err = -EINVAL;
2911+ err = may_change_propagation(mnt);
2912+ if (err)
29032913 goto out_unlock;
2904− }
2914+
29052915 if (type == MS_SHARED) {
29062916 err = invent_group_ids(mnt, recurse);
29072917 if (err)
@@ -3347,18 +3357,11 @@ static int do_set_group(struct path *from_path, struct path *to_path) · 439 unmodified lines
33473357
33483358 namespace_lock();
33493359
3350− err = -EINVAL;
3351− /* To and From must be mounted */
3352− if (!is_mounted(&from->mnt))
3353− goto out;
3354− if (!is_mounted(&to->mnt))
3355− goto out;
3356−
3357− err = -EPERM;
3358− /* We should be allowed to modify mount namespaces of both mounts */
3359− if (!ns_capable(from->mnt_ns->user_ns, CAP_SYS_ADMIN))
3360+ err = may_change_propagation(from);
3361+ if (err)
33603362 goto out;
3361− if (!ns_capable(to->mnt_ns->user_ns, CAP_SYS_ADMIN))
3363+ err = may_change_propagation(to);
3364+ if (err)
33623365 goto out;
33633366
33643367 err = -EINVAL;
@@ -4551,20 +4554,10 @@ SYSCALL_DEFINE5(move_mount, · 1186 unmodified lines
45514554 if (flags & MOVE_MOUNT_SET_GROUP) mflags |= MNT_TREE_PROPAGATION;
45524555 if (flags & MOVE_MOUNT_BENEATH) mflags |= MNT_TREE_BENEATH;
45534556
4554− lflags = 0;
4555− if (flags & MOVE_MOUNT_F_SYMLINKS) lflags |= LOOKUP_FOLLOW;
4556− if (flags & MOVE_MOUNT_F_AUTOMOUNTS) lflags |= LOOKUP_AUTOMOUNT;
45574557 uflags = 0;
4558− if (flags & MOVE_MOUNT_F_EMPTY_PATH) uflags = AT_EMPTY_PATH;
4559− from_name = getname_maybe_null(from_pathname, uflags);
4560− if (IS_ERR(from_name))
4561− return PTR_ERR(from_name);
4558+ if (flags & MOVE_MOUNT_T_EMPTY_PATH)
4559+ uflags = AT_EMPTY_PATH;
45624560
4563− lflags = 0;
4564− if (flags & MOVE_MOUNT_T_SYMLINKS) lflags |= LOOKUP_FOLLOW;
4565− if (flags & MOVE_MOUNT_T_AUTOMOUNTS) lflags |= LOOKUP_AUTOMOUNT;
4566− uflags = 0;
4567− if (flags & MOVE_MOUNT_T_EMPTY_PATH) uflags = AT_EMPTY_PATH;
45684561 to_name = getname_maybe_null(to_pathname, uflags);
45694562 if (IS_ERR(to_name))
45704563 return PTR_ERR(to_name);
@@ -4577,11 +4570,24 @@ SYSCALL_DEFINE5(move_mount, · 6 unmodified lines
45774570 to_path = fd_file(f_to)->f_path;
45784571 path_get(&to_path);
45794572 } else {
4573+ lflags = 0;
4574+ if (flags & MOVE_MOUNT_T_SYMLINKS)
4575+ lflags |= LOOKUP_FOLLOW;
4576+ if (flags & MOVE_MOUNT_T_AUTOMOUNTS)
4577+ lflags |= LOOKUP_AUTOMOUNT;
45804578 ret = filename_lookup(to_dfd, to_name, lflags, &to_path, NULL);
45814579 if (ret)
45824580 return ret;
45834581 }
45844582
4583+ uflags = 0;
4584+ if (flags & MOVE_MOUNT_F_EMPTY_PATH)
4585+ uflags = AT_EMPTY_PATH;
4586+
4587+ from_name = getname_maybe_null(from_pathname, uflags);
4588+ if (IS_ERR(from_name))
4589+ return PTR_ERR(from_name);
4590+
45854591 if (!from_name && from_dfd >= 0) {
45864592 CLASS(fd_raw, f_from)(from_dfd);
45874593 if (fd_empty(f_from))
@@ -4590,6 +4596,11 @@ SYSCALL_DEFINE5(move_mount, · 2 unmodified lines
45904596 return vfs_move_mount(&fd_file(f_from)->f_path, &to_path, mflags);
45914597 }
45924598
4599+ lflags = 0;
4600+ if (flags & MOVE_MOUNT_F_SYMLINKS)
4601+ lflags |= LOOKUP_FOLLOW;
4602+ if (flags & MOVE_MOUNT_F_AUTOMOUNTS)
4603+ lflags |= LOOKUP_AUTOMOUNT;
45934604 ret = filename_lookup(from_dfd, from_name, lflags, &from_path, NULL);
45944605 if (ret)
45954606 return ret;
@@ -5176,7 +5187,8 @@ SYSCALL_DEFINE5(open_tree_attr, int, dfd, const char __user *, filename, · 580 unmodified lines
51765187 int ret;
51775188 struct mount_kattr kattr = {};
51785189
5179− kattr.kflags = MOUNT_KATTR_IDMAP_REPLACE;
5190+ if (flags & OPEN_TREE_CLONE)
5191+ kattr.kflags = MOUNT_KATTR_IDMAP_REPLACE;
51805192 if (flags & AT_RECURSIVE)
51815193 kattr.kflags |= MOUNT_KATTR_RECURSE;
51825194
fs/netfs/read_collect.c+3−1
@@ -281,8 +281,10 @@ reassess: · 280 unmodified lines
281281 } else if (test_bit(NETFS_RREQ_SHORT_TRANSFER, &rreq->flags)) {
282282 notes |= MADE_PROGRESS;
283283 } else {
284− if (!stream->failed)
284+ if (!stream->failed) {
285285 stream->transferred += transferred;
286+ stream->transferred_valid = true;
287+ }
286288 if (front->transferred < front->len)
287289 set_bit(NETFS_RREQ_SHORT_TRANSFER, &rreq->flags);
288290 notes |= MADE_PROGRESS;
fs/netfs/write_collect.c+8−2
@@ -254,6 +254,7 @@ reassess_streams: · 253 unmodified lines
254254 if (front->start + front->transferred > stream->collected_to) {
255255 stream->collected_to = front->start + front->transferred;
256256 stream->transferred = stream->collected_to - wreq->start;
257+ stream->transferred_valid = true;
257258 notes |= MADE_PROGRESS;
258259 }
259260 if (test_bit(NETFS_SREQ_FAILED, &front->flags)) {
@@ -356,6 +357,7 @@ bool netfs_write_collection(struct netfs_io_request *wreq) · 96 unmodified lines
356357 {
357358 struct netfs_inode *ictx = netfs_inode(wreq->inode);
358359 size_t transferred;
360+ bool transferred_valid = false;
359361 int s;
360362
361363 _enter("R=%x", wreq->debug_id);
@@ -376,12 +378,16 @@ bool netfs_write_collection(struct netfs_io_request *wreq) · 14 unmodified lines
376378 continue;
377379 if (!list_empty(&stream->subrequests))
378380 return false;
379− if (stream->transferred < transferred)
381+ if (stream->transferred_valid &&
382+ stream->transferred < transferred) {
380383 transferred = stream->transferred;
384+ transferred_valid = true;
385+ }
381386 }
382387
383388 /* Okay, declare that all I/O is complete. */
384− wreq->transferred = transferred;
389+ if (transferred_valid)
390+ wreq->transferred = transferred;
385391 trace_netfs_rreq(wreq, netfs_rreq_trace_write_done);
386392
387393 if (wreq->io_streams[1].active &&
fs/netfs/write_issue.c+2−2
@@ -118,12 +118,12 @@ struct netfs_io_request *netfs_create_write_req(struct address_space *mapping, · 117 unmodified lines
118118 wreq->io_streams[0].prepare_write = ictx->ops->prepare_write;
119119 wreq->io_streams[0].issue_write = ictx->ops->issue_write;
120120 wreq->io_streams[0].collected_to = start;
121− wreq->io_streams[0].transferred = LONG_MAX;
121+ wreq->io_streams[0].transferred = 0;
122122
123123 wreq->io_streams[1].stream_nr = 1;
124124 wreq->io_streams[1].source = NETFS_WRITE_TO_CACHE;
125125 wreq->io_streams[1].collected_to = start;
126− wreq->io_streams[1].transferred = LONG_MAX;
126+ wreq->io_streams[1].transferred = 0;
127127 if (fscache_resources_valid(&wreq->cache_resources)) {
128128 wreq->io_streams[1].avail = true;
129129 wreq->io_streams[1].active = true;
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/overlayfs/dir.c+1−1
@@ -225,7 +225,7 @@ struct dentry *ovl_create_temp(struct ovl_fs *ofs, struct dentry *workdir, · 224 unmodified lines
225225 struct ovl_cattr *attr)
226226 {
227227 struct dentry *ret;
228− inode_lock(workdir->d_inode);
228+ inode_lock_nested(workdir->d_inode, I_MUTEX_PARENT);
229229 ret = ovl_create_real(ofs, workdir,
230230 ovl_lookup_temp(ofs, workdir), attr);
231231 inode_unlock(workdir->d_inode);
fs/overlayfs/util.c+2−1
@@ -1552,7 +1552,8 @@ void ovl_copyattr(struct inode *inode) · 1551 unmodified lines
15521552 int ovl_parent_lock(struct dentry *parent, struct dentry *child)
15531553 {
15541554 inode_lock_nested(parent->d_inode, I_MUTEX_PARENT);
1555− if (!child || child->d_parent == parent)
1555+ if (!child ||
1556+ (!d_unhashed(child) && child->d_parent == parent))
15561557 return 0;
15571558
15581559 inode_unlock(parent->d_inode);
fs/pidfs.c+1−1
@@ -296,12 +296,12 @@ static __u32 pidfs_coredump_mask(unsigned long mm_flags) · 295 unmodified lines
296296 static long pidfd_info(struct file *file, unsigned int cmd, unsigned long arg)
297297 {
298298 struct pidfd_info __user *uinfo = (struct pidfd_info __user *)arg;
299+ struct task_struct *task __free(put_task) = NULL;
299300 struct pid *pid = pidfd_pid(file);
300301 size_t usize = _IOC_SIZE(cmd);
301302 struct pidfd_info kinfo = {};
302303 struct pidfs_exit_info *exit_info;
303304 struct user_namespace *user_ns;
304− struct task_struct *task;
305305 struct pidfs_attr *attr;
306306 const struct cred *c;
307307 __u64 mask;
fs/pnode.c+6−4
@@ -111,7 +111,8 @@ void change_mnt_propagation(struct mount *mnt, int type) · 110 unmodified lines
111111 return;
112112 }
113113 if (IS_MNT_SHARED(mnt)) {
114− m = propagation_source(mnt);
114+ if (type == MS_SLAVE || !hlist_empty(&mnt->mnt_slave_list))
115+ m = propagation_source(mnt);
115116 if (list_empty(&mnt->mnt_share)) {
116117 mnt_release_group_id(mnt);
117118 } else {
@@ -637,10 +638,11 @@ void propagate_umount(struct list_head *set) · 519 unmodified lines
637638 }
638639
639640 // now to_umount consists of all acceptable candidates
640− // deal with reparenting of remaining overmounts on those
641+ // deal with reparenting of surviving overmounts on those
641642 list_for_each_entry(m, &to_umount, mnt_list) {
642− if (m->overmount)
643− reparent(m->overmount);
643+ struct mount *over = m->overmount;
644+ if (over && !will_be_unmounted(over))
645+ reparent(over);
644646 }
645647
646648 // and fold them into the set
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/smb/server/connection.c+2−1
@@ -504,7 +504,8 @@ void ksmbd_conn_transport_destroy(void) · 503 unmodified lines
504504 {
505505 mutex_lock(&init_lock);
506506 ksmbd_tcp_destroy();
507− ksmbd_rdma_destroy();
507+ ksmbd_rdma_stop_listening();
508508 stop_sessions();
509+ ksmbd_rdma_destroy();
509510 mutex_unlock(&init_lock);
510511 }
fs/smb/server/connection.h+6−1
@@ -46,7 +46,12 @@ struct ksmbd_conn { · 45 unmodified lines
4646 struct mutex srv_mutex;
4747 int status;
4848 unsigned int cli_cap;
49− __be32 inet_addr;
49+ union {
50+ __be32 inet_addr;
51+#if IS_ENABLED(CONFIG_IPV6)
52+ u8 inet6_addr[16];
53+#endif
54+ };
5055 char *request_buf;
5156 struct ksmbd_transport *transport;
5257 struct nls_table *local_nls;
fs/smb/server/oplock.c+10−3
@@ -1102,8 +1102,10 @@ void smb_send_parent_lease_break_noti(struct ksmbd_file *fp, · 1101 unmodified lines
11021102 if (!atomic_inc_not_zero(&opinfo->refcount))
11031103 continue;
11041104
1105− if (ksmbd_conn_releasing(opinfo->conn))
1105+ if (ksmbd_conn_releasing(opinfo->conn)) {
1106+ opinfo_put(opinfo);
11061107 continue;
1108+ }
11071109
11081110 oplock_break(opinfo, SMB2_OPLOCK_LEVEL_NONE, NULL);
11091111 opinfo_put(opinfo);
@@ -1139,8 +1141,11 @@ void smb_lazy_parent_lease_break_close(struct ksmbd_file *fp) · 29 unmodified lines
11391141 if (!atomic_inc_not_zero(&opinfo->refcount))
11401142 continue;
11411143
1142− if (ksmbd_conn_releasing(opinfo->conn))
1144+ if (ksmbd_conn_releasing(opinfo->conn)) {
1145+ opinfo_put(opinfo);
11431146 continue;
1147+ }
1148+
11441149 oplock_break(opinfo, SMB2_OPLOCK_LEVEL_NONE, NULL);
11451150 opinfo_put(opinfo);
11461151 }
@@ -1343,8 +1348,10 @@ void smb_break_all_levII_oplock(struct ksmbd_work *work, struct ksmbd_file *fp, · 196 unmodified lines
13431348 if (!atomic_inc_not_zero(&brk_op->refcount))
13441349 continue;
13451350
1346− if (ksmbd_conn_releasing(brk_op->conn))
1351+ if (ksmbd_conn_releasing(brk_op->conn)) {
1352+ opinfo_put(brk_op);
13471353 continue;
1354+ }
13481355
13491356 if (brk_op->is_lease && (brk_op->o_lease->state &
13501357 (~(SMB2_LEASE_READ_CACHING_LE |
fs/smb/server/transport_rdma.c+4−1
@@ -2194,7 +2194,7 @@ int ksmbd_rdma_init(void) · 2193 unmodified lines
21942194 return 0;
21952195 }
21962196
2197−void ksmbd_rdma_destroy(void)
2197+void ksmbd_rdma_stop_listening(void)
21982198 {
21992199 if (!smb_direct_listener.cm_id)
22002200 return;
@@ -2203,7 +2203,10 @@ void ksmbd_rdma_destroy(void) · 2 unmodified lines
22032203 rdma_destroy_id(smb_direct_listener.cm_id);
22042204
22052205 smb_direct_listener.cm_id = NULL;
2206+}
22062207
2208+void ksmbd_rdma_destroy(void)
2209+{
22072210 if (smb_direct_wq) {
22082211 destroy_workqueue(smb_direct_wq);
22092212 smb_direct_wq = NULL;
fs/smb/server/transport_rdma.h+3−1
@@ -54,13 +54,15 @@ struct smb_direct_data_transfer { · 53 unmodified lines
5454
5555 #ifdef CONFIG_SMB_SERVER_SMBDIRECT
5656 int ksmbd_rdma_init(void);
57+void ksmbd_rdma_stop_listening(void);
5758 void ksmbd_rdma_destroy(void);
5859 bool ksmbd_rdma_capable_netdev(struct net_device *netdev);
5960 void init_smbd_max_io_size(unsigned int sz);
6061 unsigned int get_smbd_max_read_write_size(void);
6162 #else
6263 static inline int ksmbd_rdma_init(void) { return 0; }
63−static inline int ksmbd_rdma_destroy(void) { return 0; }
64+static inline void ksmbd_rdma_stop_listening(void) { }
65+static inline void ksmbd_rdma_destroy(void) { }
6466 static inline bool ksmbd_rdma_capable_netdev(struct net_device *netdev) { return false; }
6567 static inline void init_smbd_max_io_size(unsigned int sz) { }
6668 static inline unsigned int get_smbd_max_read_write_size(void) { return 0; }
fs/smb/server/transport_tcp.c+23−3
@@ -85,7 +85,14 @@ static struct tcp_transport *alloc_transport(struct socket *client_sk) · 84 unmodified lines
8585 return NULL;
8686 }
8787
88+#if IS_ENABLED(CONFIG_IPV6)
89+ if (client_sk->sk->sk_family == AF_INET6)
90+ memcpy(&conn->inet6_addr, &client_sk->sk->sk_v6_daddr, 16);
91+ else
92+ conn->inet_addr = inet_sk(client_sk->sk)->inet_daddr;
93+#else
8894 conn->inet_addr = inet_sk(client_sk->sk)->inet_daddr;
95+#endif
8996 conn->transport = KSMBD_TRANS(t);
9097 KSMBD_TRANS(t)->conn = conn;
9198 KSMBD_TRANS(t)->ops = &ksmbd_tcp_transport_ops;
@@ -229,7 +236,6 @@ static int ksmbd_kthread_fn(void *p) · 137 unmodified lines
229236 {
230237 struct socket *client_sk = NULL;
231238 struct interface *iface = (struct interface *)p;
232− struct inet_sock *csk_inet;
233239 struct ksmbd_conn *conn;
234240 int ret;
235241
@@ -252,13 +258,27 @@ static int ksmbd_kthread_fn(void *p) · 16 unmodified lines
252258 /*
253259 * Limits repeated connections from clients with the same IP.
254260 */
255− csk_inet = inet_sk(client_sk->sk);
256261 down_read(&conn_list_lock);
257262 list_for_each_entry(conn, &conn_list, conns_list)
258− if (csk_inet->inet_daddr == conn->inet_addr) {
263+#if IS_ENABLED(CONFIG_IPV6)
264+ if (client_sk->sk->sk_family == AF_INET6) {
265+ if (memcmp(&client_sk->sk->sk_v6_daddr,
266+ &conn->inet6_addr, 16) == 0) {
267+ ret = -EAGAIN;
268+ break;
269+ }
270+ } else if (inet_sk(client_sk->sk)->inet_daddr ==
271+ conn->inet_addr) {
272+ ret = -EAGAIN;
273+ break;
274+ }
275+#else
276+ if (inet_sk(client_sk->sk)->inet_daddr ==
277+ conn->inet_addr) {
259278 ret = -EAGAIN;
260279 break;
261280 }
281+#endif
262282 up_read(&conn_list_lock);
263283 if (ret == -EAGAIN)
264284 continue;
fs/splice.c+3−0
@@ -739,6 +739,9 @@ iter_file_splice_write(struct pipe_inode_info *pipe, struct file *out, · 738 unmodified lines
739739 sd.pos = kiocb.ki_pos;
740740 if (ret <= 0)
741741 break;
742+ WARN_ONCE(ret > sd.total_len - left,
743+ "Splice Exceeded! ret=%zd tot=%zu left=%zu\n",
744+ ret, sd.total_len, left);
742745
743746 sd.num_spliced += ret;
744747 sd.total_len -= ret;
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/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/cpuhotplug.h+1−0
@@ -168,6 +168,7 @@ enum cpuhp_state { · 167 unmodified lines
168168 CPUHP_AP_QCOM_TIMER_STARTING,
169169 CPUHP_AP_TEGRA_TIMER_STARTING,
170170 CPUHP_AP_ARMADA_TIMER_STARTING,
171+ CPUHP_AP_LOONGARCH_ARCH_TIMER_STARTING,
171172 CPUHP_AP_MIPS_GIC_TIMER_STARTING,
172173 CPUHP_AP_ARC_TIMER_STARTING,
173174 CPUHP_AP_REALTEK_TIMER_STARTING,
include/linux/export.h+1−1
@@ -91,6 +91,6 @@ · 90 unmodified lines
9191 #define EXPORT_SYMBOL_NS(sym, ns) __EXPORT_SYMBOL(sym, "", ns)
9292 #define EXPORT_SYMBOL_NS_GPL(sym, ns) __EXPORT_SYMBOL(sym, "GPL", ns)
9393
94−#define EXPORT_SYMBOL_GPL_FOR_MODULES(sym, mods) __EXPORT_SYMBOL(sym, "GPL", "module:" mods)
94+#define EXPORT_SYMBOL_FOR_MODULES(sym, mods) __EXPORT_SYMBOL(sym, "GPL", "module:" mods)
9595
9696 #endif /* _LINUX_EXPORT_H */
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/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/netfs.h+1−0
@@ -150,6 +150,7 @@ struct netfs_io_stream { · 149 unmodified lines
150150 bool active; /* T if stream is active */
151151 bool need_retry; /* T if this stream needs retrying */
152152 bool failed; /* T if this stream failed */
153+ bool transferred_valid; /* T is ->transferred is valid */
153154 };
154155
155156 /*
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/net/bluetooth/bluetooth.h+2−2
@@ -647,7 +647,7 @@ static inline void sco_exit(void) · 646 unmodified lines
647647 #if IS_ENABLED(CONFIG_BT_LE)
648648 int iso_init(void);
649649 int iso_exit(void);
650−bool iso_enabled(void);
650+bool iso_inited(void);
651651 #else
652652 static inline int iso_init(void)
653653 {
@@ -659,7 +659,7 @@ static inline int iso_exit(void) · 5 unmodified lines
659659 return 0;
660660 }
661661
662−static inline bool iso_enabled(void)
662+static inline bool iso_inited(void)
663663 {
664664 return false;
665665 }
include/net/bluetooth/hci_core.h+38−6
@@ -129,7 +129,9 @@ struct hci_conn_hash { · 128 unmodified lines
129129 struct list_head list;
130130 unsigned int acl_num;
131131 unsigned int sco_num;
132− unsigned int iso_num;
132+ unsigned int cis_num;
133+ unsigned int bis_num;
134+ unsigned int pa_num;
133135 unsigned int le_num;
134136 unsigned int le_num_peripheral;
135137 };
@@ -1014,9 +1016,13 @@ static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c) · 878 unmodified lines
10141016 h->sco_num++;
10151017 break;
10161018 case CIS_LINK:
1019+ h->cis_num++;
1020+ break;
10171021 case BIS_LINK:
1022+ h->bis_num++;
1023+ break;
10181024 case PA_LINK:
1019− h->iso_num++;
1025+ h->pa_num++;
10201026 break;
10211027 }
10221028 }
@@ -1042,9 +1048,13 @@ static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c) · 19 unmodified lines
10421048 h->sco_num--;
10431049 break;
10441050 case CIS_LINK:
1051+ h->cis_num--;
1052+ break;
10451053 case BIS_LINK:
1054+ h->bis_num--;
1055+ break;
10461056 case PA_LINK:
1047− h->iso_num--;
1057+ h->pa_num--;
10481058 break;
10491059 }
10501060 }
@@ -1061,9 +1071,11 @@ static inline unsigned int hci_conn_num(struct hci_dev *hdev, __u8 type) · 10 unmodified lines
10611071 case ESCO_LINK:
10621072 return h->sco_num;
10631073 case CIS_LINK:
1074+ return h->cis_num;
10641075 case BIS_LINK:
1076+ return h->bis_num;
10651077 case PA_LINK:
1066− return h->iso_num;
1078+ return h->pa_num;
10671079 default:
10681080 return 0;
10691081 }
@@ -1073,7 +1085,15 @@ static inline unsigned int hci_conn_count(struct hci_dev *hdev) · 3 unmodified lines
10731085 {
10741086 struct hci_conn_hash *c = &hdev->conn_hash;
10751087
1076− return c->acl_num + c->sco_num + c->le_num + c->iso_num;
1088+ return c->acl_num + c->sco_num + c->le_num + c->cis_num + c->bis_num +
1089+ c->pa_num;
1090+}
1091+
1092+static inline unsigned int hci_iso_count(struct hci_dev *hdev)
1093+{
1094+ struct hci_conn_hash *c = &hdev->conn_hash;
1095+
1096+ return c->cis_num + c->bis_num;
10771097 }
10781098
10791099 static inline bool hci_conn_valid(struct hci_dev *hdev, struct hci_conn *conn)
@@ -1915,6 +1935,8 @@ void hci_conn_del_sysfs(struct hci_conn *conn); · 835 unmodified lines
19151935 !hci_dev_test_flag(dev, HCI_RPA_EXPIRED))
19161936 #define adv_rpa_valid(adv) (bacmp(&adv->random_addr, BDADDR_ANY) && \
19171937 !adv->rpa_expired)
1938+#define le_enabled(dev) (lmp_le_capable(dev) && \
1939+ hci_dev_test_flag(dev, HCI_LE_ENABLED))
19181940
19191941 #define scan_1m(dev) (((dev)->le_tx_def_phys & HCI_LE_SET_PHY_1M) || \
19201942 ((dev)->le_rx_def_phys & HCI_LE_SET_PHY_1M))
@@ -1932,6 +1954,7 @@ void hci_conn_del_sysfs(struct hci_conn *conn); · 11 unmodified lines
19321954 ((dev)->le_rx_def_phys & HCI_LE_SET_PHY_CODED))
19331955
19341956 #define ll_privacy_capable(dev) ((dev)->le_features[0] & HCI_LE_LL_PRIVACY)
1957+#define ll_privacy_enabled(dev) (le_enabled(dev) && ll_privacy_capable(dev))
19351958
19361959 #define privacy_mode_capable(dev) (ll_privacy_capable(dev) && \
19371960 ((dev)->commands[39] & 0x04))
@@ -1981,14 +2004,23 @@ void hci_conn_del_sysfs(struct hci_conn *conn); · 43 unmodified lines
19812004
19822005 /* CIS Master/Slave and BIS support */
19832006 #define iso_capable(dev) (cis_capable(dev) || bis_capable(dev))
2007+#define iso_enabled(dev) (le_enabled(dev) && iso_capable(dev))
19842008 #define cis_capable(dev) \
19852009 (cis_central_capable(dev) || cis_peripheral_capable(dev))
2010+#define cis_enabled(dev) (le_enabled(dev) && cis_capable(dev))
19862011 #define cis_central_capable(dev) \
19872012 ((dev)->le_features[3] & HCI_LE_CIS_CENTRAL)
2013+#define cis_central_enabled(dev) \
2014+ (le_enabled(dev) && cis_central_capable(dev))
19882015 #define cis_peripheral_capable(dev) \
19892016 ((dev)->le_features[3] & HCI_LE_CIS_PERIPHERAL)
2017+#define cis_peripheral_enabled(dev) \
2018+ (le_enabled(dev) && cis_peripheral_capable(dev))
19902019 #define bis_capable(dev) ((dev)->le_features[3] & HCI_LE_ISO_BROADCASTER)
1991−#define sync_recv_capable(dev) ((dev)->le_features[3] & HCI_LE_ISO_SYNC_RECEIVER)
2020+#define bis_enabled(dev) (le_enabled(dev) && bis_capable(dev))
2021+#define sync_recv_capable(dev) \
2022+ ((dev)->le_features[3] & HCI_LE_ISO_SYNC_RECEIVER)
2023+#define sync_recv_enabled(dev) (le_enabled(dev) && sync_recv_capable(dev))
19922024
19932025 #define mws_transport_config_capable(dev) (((dev)->commands[30] & 0x08) && \
19942026 (!hci_test_quirk((dev), HCI_QUIRK_BROKEN_MWS_TRANSPORT_CONFIG)))
include/net/bond_3ad.h+1−0
@@ -307,6 +307,7 @@ int bond_3ad_lacpdu_recv(const struct sk_buff *skb, struct bonding *bond, · 306 unmodified lines
307307 struct slave *slave);
308308 int bond_3ad_set_carrier(struct bonding *bond);
309309 void bond_3ad_update_lacp_rate(struct bonding *bond);
310+void bond_3ad_update_lacp_active(struct bonding *bond);
310311 void bond_3ad_update_ad_actor_settings(struct bonding *bond);
311312 int bond_3ad_stats_fill(struct sk_buff *skb, struct bond_3ad_stats *stats);
312313 size_t bond_3ad_stats_size(void);
include/net/sch_generic.h+8−3
@@ -1038,12 +1038,17 @@ static inline struct sk_buff *qdisc_dequeue_internal(struct Qdisc *sch, bool dir · 1037 unmodified lines
10381038 skb = __skb_dequeue(&sch->gso_skb);
10391039 if (skb) {
10401040 sch->q.qlen--;
1041+ qdisc_qstats_backlog_dec(sch, skb);
10411042 return skb;
10421043 }
1043− if (direct)
1044− return __qdisc_dequeue_head(&sch->q);
1045− else
1044+ if (direct) {
1045+ skb = __qdisc_dequeue_head(&sch->q);
1046+ if (skb)
1047+ qdisc_qstats_backlog_dec(sch, skb);
1048+ return skb;
1049+ } else {
10461050 return sch->dequeue(sch);
1051+ }
10471052 }
10481053
10491054 static inline struct sk_buff *qdisc_dequeue_head(struct Qdisc *sch)
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 */
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/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/signal.c+5−1
@@ -4067,6 +4067,7 @@ SYSCALL_DEFINE4(pidfd_send_signal, int, pidfd, int, sig, · 4066 unmodified lines
40674067 {
40684068 struct pid *pid;
40694069 enum pid_type type;
4070+ int ret;
40704071
40714072 /* Enforce flags be set to 0 until we add an extension. */
40724073 if (flags & ~PIDFD_SEND_SIGNAL_FLAGS)
@@ -4108,7 +4109,10 @@ SYSCALL_DEFINE4(pidfd_send_signal, int, pidfd, int, sig, · 35 unmodified lines
41084109 }
41094110 }
41104111
4111− return do_pidfd_send_signal(pid, sig, type, info, flags);
4112+ ret = do_pidfd_send_signal(pid, sig, type, info, flags);
4113+ put_pid(pid);
4114+
4115+ return ret;
41124116 }
41134117
41144118 static int
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+8−2
@@ -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,
@@ -2204,7 +2210,7 @@ static inline bool is_good_system_name(const char *name) · 885 unmodified lines
22042210 static inline void sanitize_event_name(char *name)
22052211 {
22062212 while (*name++ != '\0')
2207− if (*name == ':' || *name == '.')
2213+ if (*name == ':' || *name == '.' || *name == '*')
22082214 *name = '_';
22092215 }
22102216
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
lib/crypto/Kconfig+5−5
@@ -140,8 +140,8 @@ config CRYPTO_LIB_CHACHA20POLY1305 · 139 unmodified lines
140140 config CRYPTO_LIB_SHA1
141141 tristate
142142 help
143− The SHA-1 library functions. Select this if your module uses any of
144− the functions from <crypto/sha1.h>.
143+ The SHA-1 and HMAC-SHA1 library functions. Select this if your module
144+ uses any of the functions from <crypto/sha1.h>.
145145
146146 config CRYPTO_LIB_SHA1_ARCH
147147 bool
@@ -157,9 +157,9 @@ config CRYPTO_LIB_SHA1_ARCH · 9 unmodified lines
157157 config CRYPTO_LIB_SHA256
158158 tristate
159159 help
160− Enable the SHA-256 library interface. This interface may be fulfilled
161− by either the generic implementation or an arch-specific one, if one
162− is available and enabled.
160+ The SHA-224, SHA-256, HMAC-SHA224, and HMAC-SHA256 library functions.
161+ Select this if your module uses any of these functions from
162+ <crypto/sha2.h>.
163163
164164 config CRYPTO_LIB_SHA256_ARCH
165165 bool
lib/crypto/Makefile+4−4
@@ -100,7 +100,6 @@ ifeq ($(CONFIG_ARM),y) · 99 unmodified lines
100100 libsha256-y += arm/sha256-ce.o arm/sha256-core.o
101101 $(obj)/arm/sha256-core.S: $(src)/arm/sha256-armv4.pl
102102 $(call cmd,perlasm)
103−clean-files += arm/sha256-core.S
104103 AFLAGS_arm/sha256-core.o += $(aflags-thumb2-y)
105104 endif
106105
@@ -108,7 +107,6 @@ ifeq ($(CONFIG_ARM64),y) · 1 unmodified line
108107 libsha256-y += arm64/sha256-core.o
109108 $(obj)/arm64/sha256-core.S: $(src)/arm64/sha2-armv8.pl
110109 $(call cmd,perlasm_with_args)
111−clean-files += arm64/sha256-core.S
112110 libsha256-$(CONFIG_KERNEL_MODE_NEON) += arm64/sha256-ce.o
113111 endif
114112
@@ -132,7 +130,6 @@ ifeq ($(CONFIG_ARM),y) · 17 unmodified lines
132130 libsha512-y += arm/sha512-core.o
133131 $(obj)/arm/sha512-core.S: $(src)/arm/sha512-armv4.pl
134132 $(call cmd,perlasm)
135−clean-files += arm/sha512-core.S
136133 AFLAGS_arm/sha512-core.o += $(aflags-thumb2-y)
137134 endif
138135
@@ -140,7 +137,6 @@ ifeq ($(CONFIG_ARM64),y) · 1 unmodified line
140137 libsha512-y += arm64/sha512-core.o
141138 $(obj)/arm64/sha512-core.S: $(src)/arm64/sha2-armv8.pl
142139 $(call cmd,perlasm_with_args)
143−clean-files += arm64/sha512-core.S
144140 libsha512-$(CONFIG_KERNEL_MODE_NEON) += arm64/sha512-ce-core.o
145141 endif
146142
@@ -167,3 +163,7 @@ obj-$(CONFIG_PPC) += powerpc/ · 20 unmodified lines
167163 obj-$(CONFIG_RISCV) += riscv/
168164 obj-$(CONFIG_S390) += s390/
169165 obj-$(CONFIG_X86) += x86/
166+
167+# clean-files must be defined unconditionally
168+clean-files += arm/sha256-core.S arm/sha512-core.S
169+clean-files += arm64/sha256-core.S arm64/sha512-core.S
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/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/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/bluetooth/hci_conn.c+14−3
@@ -339,7 +339,8 @@ static int hci_enhanced_setup_sync(struct hci_dev *hdev, void *data) · 338 unmodified lines
339339 case BT_CODEC_TRANSPARENT:
340340 if (!find_next_esco_param(conn, esco_param_msbc,
341341 ARRAY_SIZE(esco_param_msbc)))
342− return false;
342+ return -EINVAL;
343+
343344 param = &esco_param_msbc[conn->attempt - 1];
344345 cp.tx_coding_format.id = 0x03;
345346 cp.rx_coding_format.id = 0x03;
@@ -830,7 +831,17 @@ static void bis_cleanup(struct hci_conn *conn) · 484 unmodified lines
830831 /* Check if ISO connection is a BIS and terminate advertising
831832 * set and BIG if there are no other connections using it.
832833 */
833− bis = hci_conn_hash_lookup_big(hdev, conn->iso_qos.bcast.big);
834+ bis = hci_conn_hash_lookup_big_state(hdev,
835+ conn->iso_qos.bcast.big,
836+ BT_CONNECTED,
837+ HCI_ROLE_MASTER);
838+ if (bis)
839+ return;
840+
841+ bis = hci_conn_hash_lookup_big_state(hdev,
842+ conn->iso_qos.bcast.big,
843+ BT_CONNECT,
844+ HCI_ROLE_MASTER);
834845 if (bis)
835846 return;
836847
@@ -2249,7 +2260,7 @@ struct hci_conn *hci_connect_bis(struct hci_dev *hdev, bdaddr_t *dst, · 1412 unmodified lines
22492260 * the start periodic advertising and create BIG commands have
22502261 * been queued
22512262 */
2252− hci_conn_hash_list_state(hdev, bis_mark_per_adv, PA_LINK,
2263+ hci_conn_hash_list_state(hdev, bis_mark_per_adv, BIS_LINK,
22532264 BT_BOUND, &data);
22542265
22552266 /* Queue start periodic advertising and create BIG */
net/bluetooth/hci_event.c+10−5
@@ -6745,8 +6745,8 @@ static void hci_le_cis_established_evt(struct hci_dev *hdev, void *data, · 6744 unmodified lines
67456745 qos->ucast.out.latency =
67466746 DIV_ROUND_CLOSEST(get_unaligned_le24(ev->p_latency),
67476747 1000);
6748− qos->ucast.in.sdu = le16_to_cpu(ev->c_mtu);
6749− qos->ucast.out.sdu = le16_to_cpu(ev->p_mtu);
6748+ qos->ucast.in.sdu = ev->c_bn ? le16_to_cpu(ev->c_mtu) : 0;
6749+ qos->ucast.out.sdu = ev->p_bn ? le16_to_cpu(ev->p_mtu) : 0;
67506750 qos->ucast.in.phy = ev->c_phy;
67516751 qos->ucast.out.phy = ev->p_phy;
67526752 break;
@@ -6760,8 +6760,8 @@ static void hci_le_cis_established_evt(struct hci_dev *hdev, void *data, · 7 unmodified lines
67606760 qos->ucast.in.latency =
67616761 DIV_ROUND_CLOSEST(get_unaligned_le24(ev->p_latency),
67626762 1000);
6763− qos->ucast.out.sdu = le16_to_cpu(ev->c_mtu);
6764− qos->ucast.in.sdu = le16_to_cpu(ev->p_mtu);
6763+ qos->ucast.out.sdu = ev->c_bn ? le16_to_cpu(ev->c_mtu) : 0;
6764+ qos->ucast.in.sdu = ev->p_bn ? le16_to_cpu(ev->p_mtu) : 0;
67656765 qos->ucast.out.phy = ev->c_phy;
67666766 qos->ucast.in.phy = ev->p_phy;
67676767 break;
@@ -6957,9 +6957,14 @@ static void hci_le_big_sync_established_evt(struct hci_dev *hdev, void *data, · 189 unmodified lines
69576957 continue;
69586958 }
69596959
6960− if (ev->status != 0x42)
6960+ if (ev->status != 0x42) {
69616961 /* Mark PA sync as established */
69626962 set_bit(HCI_CONN_PA_SYNC, &bis->flags);
6963+ /* Reset cleanup callback of PA Sync so it doesn't
6964+ * terminate the sync when deleting the connection.
6965+ */
6966+ conn->cleanup = NULL;
6967+ }
69636968
69646969 bis->sync_handle = conn->sync_handle;
69656970 bis->iso_qos.bcast.big = ev->handle;
net/bluetooth/hci_sync.c+16−9
@@ -3344,7 +3344,7 @@ static int hci_powered_update_adv_sync(struct hci_dev *hdev) · 3343 unmodified lines
33443344 * advertising data. This also applies to the case
33453345 * where BR/EDR was toggled during the AUTO_OFF phase.
33463346 */
3347− if (hci_dev_test_flag(hdev, HCI_ADVERTISING) ||
3347+ if (hci_dev_test_flag(hdev, HCI_ADVERTISING) &&
33483348 list_empty(&hdev->adv_instances)) {
33493349 if (ext_adv_capable(hdev)) {
33503350 err = hci_setup_ext_adv_instance_sync(hdev, 0x00);
@@ -4531,14 +4531,14 @@ static int hci_le_set_host_feature_sync(struct hci_dev *hdev) · 1180 unmodified lines
45314531 {
45324532 struct hci_cp_le_set_host_feature cp;
45334533
4534− if (!cis_capable(hdev))
4534+ if (!iso_capable(hdev))
45354535 return 0;
45364536
45374537 memset(&cp, 0, sizeof(cp));
45384538
45394539 /* Connected Isochronous Channels (Host Support) */
45404540 cp.bit_number = 32;
4541− cp.bit_value = 1;
4541+ cp.bit_value = iso_enabled(hdev) ? 0x01 : 0x00;
45424542
45434543 return __hci_cmd_sync_status(hdev, HCI_OP_LE_SET_HOST_FEATURE,
45444544 sizeof(cp), &cp, HCI_CMD_TIMEOUT);
@@ -6985,8 +6985,6 @@ static void create_pa_complete(struct hci_dev *hdev, void *data, int err) · 2440 unmodified lines
69856985
69866986 hci_dev_lock(hdev);
69876987
6988− hci_dev_clear_flag(hdev, HCI_PA_SYNC);
6989−
69906988 if (!hci_conn_valid(hdev, conn))
69916989 clear_bit(HCI_CONN_CREATE_PA_SYNC, &conn->flags);
69926990
@@ -7047,10 +7045,13 @@ static int hci_le_pa_create_sync(struct hci_dev *hdev, void *data) · 54 unmodified lines
70477045 /* SID has not been set listen for HCI_EV_LE_EXT_ADV_REPORT to update
70487046 * it.
70497047 */
7050− if (conn->sid == HCI_SID_INVALID)
7051− __hci_cmd_sync_status_sk(hdev, HCI_OP_NOP, 0, NULL,
7052− HCI_EV_LE_EXT_ADV_REPORT,
7053− conn->conn_timeout, NULL);
7048+ if (conn->sid == HCI_SID_INVALID) {
7049+ err = __hci_cmd_sync_status_sk(hdev, HCI_OP_NOP, 0, NULL,
7050+ HCI_EV_LE_EXT_ADV_REPORT,
7051+ conn->conn_timeout, NULL);
7052+ if (err == -ETIMEDOUT)
7053+ goto done;
7054+ }
70547055
70557056 memset(&cp, 0, sizeof(cp));
70567057 cp.options = qos->bcast.options;
@@ -7080,6 +7081,12 @@ static int hci_le_pa_create_sync(struct hci_dev *hdev, void *data) · 23 unmodified lines
70807081 __hci_cmd_sync_status(hdev, HCI_OP_LE_PA_CREATE_SYNC_CANCEL,
70817082 0, NULL, HCI_CMD_TIMEOUT);
70827083
7084+done:
7085+ hci_dev_clear_flag(hdev, HCI_PA_SYNC);
7086+
7087+ /* Update passive scan since HCI_PA_SYNC flag has been cleared */
7088+ hci_update_passive_scan_sync(hdev);
7089+
70837090 return err;
70847091 }
70857092
net/bluetooth/iso.c+8−8
@@ -1347,7 +1347,7 @@ static int iso_sock_getname(struct socket *sock, struct sockaddr *addr, · 1346 unmodified lines
13471347 bacpy(&sa->iso_bdaddr, &iso_pi(sk)->dst);
13481348 sa->iso_bdaddr_type = iso_pi(sk)->dst_type;
13491349
1350− if (hcon && hcon->type == BIS_LINK) {
1350+ if (hcon && (hcon->type == BIS_LINK || hcon->type == PA_LINK)) {
13511351 sa->iso_bc->bc_sid = iso_pi(sk)->bc_sid;
13521352 sa->iso_bc->bc_num_bis = iso_pi(sk)->bc_num_bis;
13531353 memcpy(sa->iso_bc->bc_bis, iso_pi(sk)->bc_bis,
@@ -2483,11 +2483,11 @@ static const struct net_proto_family iso_sock_family_ops = { · 1129 unmodified lines
24832483 .create = iso_sock_create,
24842484 };
24852485
2486−static bool iso_inited;
2486+static bool inited;
24872487
2488−bool iso_enabled(void)
2488+bool iso_inited(void)
24892489 {
2490− return iso_inited;
2490+ return inited;
24912491 }
24922492
24932493 int iso_init(void)
@@ -2496,7 +2496,7 @@ int iso_init(void) · 2 unmodified lines
24962496
24972497 BUILD_BUG_ON(sizeof(struct sockaddr_iso) > sizeof(struct sockaddr));
24982498
2499− if (iso_inited)
2499+ if (inited)
25002500 return -EALREADY;
25012501
25022502 err = proto_register(&iso_proto, 0);
@@ -2524,7 +2524,7 @@ int iso_init(void) · 21 unmodified lines
25242524 iso_debugfs = debugfs_create_file("iso", 0444, bt_debugfs,
25252525 NULL, &iso_debugfs_fops);
25262526
2527− iso_inited = true;
2527+ inited = true;
25282528
25292529 return 0;
25302530
@@ -2535,7 +2535,7 @@ error: · 4 unmodified lines
25352535
25362536 int iso_exit(void)
25372537 {
2538− if (!iso_inited)
2538+ if (!inited)
25392539 return -EALREADY;
25402540
25412541 bt_procfs_cleanup(&init_net, "iso");
@@ -2549,7 +2549,7 @@ int iso_exit(void) · 7 unmodified lines
25492549
25502550 proto_unregister(&iso_proto);
25512551
2552− iso_inited = false;
2552+ inited = false;
25532553
25542554 return 0;
25552555 }
net/bluetooth/mgmt.c+6−6
@@ -922,19 +922,19 @@ static u32 get_current_settings(struct hci_dev *hdev) · 921 unmodified lines
922922 if (hci_dev_test_flag(hdev, HCI_WIDEBAND_SPEECH_ENABLED))
923923 settings |= MGMT_SETTING_WIDEBAND_SPEECH;
924924
925− if (cis_central_capable(hdev))
925+ if (cis_central_enabled(hdev))
926926 settings |= MGMT_SETTING_CIS_CENTRAL;
927927
928− if (cis_peripheral_capable(hdev))
928+ if (cis_peripheral_enabled(hdev))
929929 settings |= MGMT_SETTING_CIS_PERIPHERAL;
930930
931− if (bis_capable(hdev))
931+ if (bis_enabled(hdev))
932932 settings |= MGMT_SETTING_ISO_BROADCASTER;
933933
934− if (sync_recv_capable(hdev))
934+ if (sync_recv_enabled(hdev))
935935 settings |= MGMT_SETTING_ISO_SYNC_RECEIVER;
936936
937− if (ll_privacy_capable(hdev))
937+ if (ll_privacy_enabled(hdev))
938938 settings |= MGMT_SETTING_LL_PRIVACY;
939939
940940 return settings;
@@ -4513,7 +4513,7 @@ static int read_exp_features_info(struct sock *sk, struct hci_dev *hdev, · 3572 unmodified lines
45134513 }
45144514
45154515 if (IS_ENABLED(CONFIG_BT_LE)) {
4516− flags = iso_enabled() ? BIT(0) : 0;
4516+ flags = iso_inited() ? BIT(0) : 0;
45174517 memcpy(rp->features[idx].uuid, iso_socket_uuid, 16);
45184518 rp->features[idx].flags = cpu_to_le32(flags);
45194519 idx++;
net/bridge/br_multicast.c+16−0
@@ -4818,6 +4818,14 @@ void br_multicast_set_query_intvl(struct net_bridge_mcast *brmctx, · 4817 unmodified lines
48184818 intvl_jiffies = BR_MULTICAST_QUERY_INTVL_MIN;
48194819 }
48204820
4821+ if (intvl_jiffies > BR_MULTICAST_QUERY_INTVL_MAX) {
4822+ br_info(brmctx->br,
4823+ "trying to set multicast query interval above maximum, setting to %lu (%ums)\n",
4824+ jiffies_to_clock_t(BR_MULTICAST_QUERY_INTVL_MAX),
4825+ jiffies_to_msecs(BR_MULTICAST_QUERY_INTVL_MAX));
4826+ intvl_jiffies = BR_MULTICAST_QUERY_INTVL_MAX;
4827+ }
4828+
48214829 brmctx->multicast_query_interval = intvl_jiffies;
48224830 }
48234831
@@ -4834,6 +4842,14 @@ void br_multicast_set_startup_query_intvl(struct net_bridge_mcast *brmctx, · 10 unmodified lines
48344842 intvl_jiffies = BR_MULTICAST_STARTUP_QUERY_INTVL_MIN;
48354843 }
48364844
4845+ if (intvl_jiffies > BR_MULTICAST_STARTUP_QUERY_INTVL_MAX) {
4846+ br_info(brmctx->br,
4847+ "trying to set multicast startup query interval above maximum, setting to %lu (%ums)\n",
4848+ jiffies_to_clock_t(BR_MULTICAST_STARTUP_QUERY_INTVL_MAX),
4849+ jiffies_to_msecs(BR_MULTICAST_STARTUP_QUERY_INTVL_MAX));
4850+ intvl_jiffies = BR_MULTICAST_STARTUP_QUERY_INTVL_MAX;
4851+ }
4852+
48374853 brmctx->multicast_startup_query_interval = intvl_jiffies;
48384854 }
48394855
net/bridge/br_private.h+2−0
@@ -31,6 +31,8 @@ · 30 unmodified lines
3131 #define BR_MULTICAST_DEFAULT_HASH_MAX 4096
3232 #define BR_MULTICAST_QUERY_INTVL_MIN msecs_to_jiffies(1000)
3333 #define BR_MULTICAST_STARTUP_QUERY_INTVL_MIN BR_MULTICAST_QUERY_INTVL_MIN
34+#define BR_MULTICAST_QUERY_INTVL_MAX msecs_to_jiffies(86400000) /* 24 hours */
35+#define BR_MULTICAST_STARTUP_QUERY_INTVL_MAX BR_MULTICAST_QUERY_INTVL_MAX
3436
3537 #define BR_HWDOM_MAX BITS_PER_LONG
3638
net/core/dev.c+12−0
@@ -3779,6 +3779,18 @@ static netdev_features_t gso_features_check(const struct sk_buff *skb, · 3778 unmodified lines
37793779 features &= ~NETIF_F_TSO_MANGLEID;
37803780 }
37813781
3782+ /* NETIF_F_IPV6_CSUM does not support IPv6 extension headers,
3783+ * so neither does TSO that depends on it.
3784+ */
3785+ if (features & NETIF_F_IPV6_CSUM &&
3786+ (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6 ||
3787+ (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4 &&
3788+ vlan_get_protocol(skb) == htons(ETH_P_IPV6))) &&
3789+ skb_transport_header_was_set(skb) &&
3790+ skb_network_header_len(skb) != sizeof(struct ipv6hdr) &&
3791+ !ipv6_has_hopopt_jumbo(skb))
3792+ features &= ~(NETIF_F_IPV6_CSUM | NETIF_F_TSO6 | NETIF_F_GSO_UDP_L4);
3793+
37823794 return features;
37833795 }
37843796
net/hsr/hsr_slave.c+7−1
@@ -63,8 +63,14 @@ static rx_handler_result_t hsr_handle_frame(struct sk_buff **pskb) · 62 unmodified lines
6363 skb_push(skb, ETH_HLEN);
6464 skb_reset_mac_header(skb);
6565 if ((!hsr->prot_version && protocol == htons(ETH_P_PRP)) ||
66− protocol == htons(ETH_P_HSR))
66+ protocol == htons(ETH_P_HSR)) {
67+ if (!pskb_may_pull(skb, ETH_HLEN + HSR_HLEN)) {
68+ kfree_skb(skb);
69+ goto finish_consume;
70+ }
71+
6772 skb_set_network_header(skb, ETH_HLEN + HSR_HLEN);
73+ }
6874 skb_reset_mac_len(skb);
6975
7076 /* Only the frames received over the interlink port will assign a
net/ipv4/netfilter/nf_reject_ipv4.c+2−4
@@ -247,8 +247,7 @@ void nf_send_reset(struct net *net, struct sock *sk, struct sk_buff *oldskb, · 246 unmodified lines
247247 if (!oth)
248248 return;
249249
250− if ((hook == NF_INET_PRE_ROUTING || hook == NF_INET_INGRESS) &&
251− nf_reject_fill_skb_dst(oldskb) < 0)
250+ if (!skb_dst(oldskb) && nf_reject_fill_skb_dst(oldskb) < 0)
252251 return;
253252
254253 if (skb_rtable(oldskb)->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST))
@@ -321,8 +320,7 @@ void nf_send_unreach(struct sk_buff *skb_in, int code, int hook) · 66 unmodified lines
321320 if (iph->frag_off & htons(IP_OFFSET))
322321 return;
323322
324− if ((hook == NF_INET_PRE_ROUTING || hook == NF_INET_INGRESS) &&
325− nf_reject_fill_skb_dst(skb_in) < 0)
323+ if (!skb_dst(skb_in) && nf_reject_fill_skb_dst(skb_in) < 0)
326324 return;
327325
328326 if (skb_csum_unnecessary(skb_in) ||
net/ipv6/netfilter/nf_reject_ipv6.c+2−3
@@ -293,7 +293,7 @@ void nf_send_reset6(struct net *net, struct sock *sk, struct sk_buff *oldskb, · 292 unmodified lines
293293 fl6.fl6_sport = otcph->dest;
294294 fl6.fl6_dport = otcph->source;
295295
296− if (hook == NF_INET_PRE_ROUTING || hook == NF_INET_INGRESS) {
296+ if (!skb_dst(oldskb)) {
297297 nf_ip6_route(net, &dst, flowi6_to_flowi(&fl6), false);
298298 if (!dst)
299299 return;
@@ -397,8 +397,7 @@ void nf_send_unreach6(struct net *net, struct sk_buff *skb_in, · 97 unmodified lines
397397 if (hooknum == NF_INET_LOCAL_OUT && skb_in->dev == NULL)
398398 skb_in->dev = net->loopback_dev;
399399
400− if ((hooknum == NF_INET_PRE_ROUTING || hooknum == NF_INET_INGRESS) &&
401− nf_reject6_fill_skb_dst(skb_in) < 0)
400+ if (!skb_dst(skb_in) && nf_reject6_fill_skb_dst(skb_in) < 0)
402401 return;
403402
404403 icmpv6_send(skb_in, ICMPV6_DEST_UNREACH, code, 0);
net/ipv6/seg6_hmac.c+5−1
@@ -35,6 +35,7 @@ · 34 unmodified lines
3535 #include <net/xfrm.h>
3636
3737 #include <crypto/hash.h>
38+#include <crypto/utils.h>
3839 #include <net/seg6.h>
3940 #include <net/genetlink.h>
4041 #include <net/seg6_hmac.h>
@@ -280,7 +281,7 @@ bool seg6_hmac_validate_skb(struct sk_buff *skb) · 239 unmodified lines
280281 if (seg6_hmac_compute(hinfo, srh, &ipv6_hdr(skb)->saddr, hmac_output))
281282 return false;
282283
283− if (memcmp(hmac_output, tlv->hmac, SEG6_HMAC_FIELD_LEN) != 0)
284+ if (crypto_memneq(hmac_output, tlv->hmac, SEG6_HMAC_FIELD_LEN))
284285 return false;
285286
286287 return true;
@@ -304,6 +305,9 @@ int seg6_hmac_info_add(struct net *net, u32 key, struct seg6_hmac_info *hinfo) · 17 unmodified lines
304305 struct seg6_pernet_data *sdata = seg6_pernet(net);
305306 int err;
306307
308+ if (!__hmac_get_algo(hinfo->alg_id))
309+ return -EINVAL;
310+
307311 err = rhashtable_lookup_insert_fast(&sdata->hmac_infos, &hinfo->node,
308312 rht_params);
309313
net/mptcp/options.c+4−2
@@ -1118,7 +1118,9 @@ static bool add_addr_hmac_valid(struct mptcp_sock *msk, · 1117 unmodified lines
11181118 return hmac == mp_opt->ahmac;
11191119 }
11201120
1121−/* Return false if a subflow has been reset, else return true */
1121+/* Return false in case of error (or subflow has been reset),
1122+ * else return true.
1123+ */
11221124 bool mptcp_incoming_options(struct sock *sk, struct sk_buff *skb)
11231125 {
11241126 struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
@@ -1222,7 +1224,7 @@ bool mptcp_incoming_options(struct sock *sk, struct sk_buff *skb) · 97 unmodified lines
12221224
12231225 mpext = skb_ext_add(skb, SKB_EXT_MPTCP);
12241226 if (!mpext)
1225− return true;
1227+ return false;
12261228
12271229 memset(mpext, 0, sizeof(*mpext));
12281230
net/mptcp/pm.c+12−6
@@ -274,6 +274,7 @@ static void mptcp_pm_add_timer(struct timer_list *timer) · 273 unmodified lines
274274 add_timer);
275275 struct mptcp_sock *msk = entry->sock;
276276 struct sock *sk = (struct sock *)msk;
277+ unsigned int timeout;
277278
278279 pr_debug("msk=%p\n", msk);
279280
@@ -291,6 +292,10 @@ static void mptcp_pm_add_timer(struct timer_list *timer) · 11 unmodified lines
291292 goto out;
292293 }
293294
295+ timeout = mptcp_get_add_addr_timeout(sock_net(sk));
296+ if (!timeout)
297+ goto out;
298+
294299 spin_lock_bh(&msk->pm.lock);
295300
296301 if (!mptcp_pm_should_add_signal_addr(msk)) {
@@ -302,7 +307,7 @@ static void mptcp_pm_add_timer(struct timer_list *timer) · 5 unmodified lines
302307
303308 if (entry->retrans_times < ADD_ADDR_RETRANS_MAX)
304309 sk_reset_timer(sk, timer,
305− jiffies + mptcp_get_add_addr_timeout(sock_net(sk)));
310+ jiffies + timeout);
306311
307312 spin_unlock_bh(&msk->pm.lock);
308313
@@ -344,6 +349,7 @@ bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk, · 35 unmodified lines
344349 struct mptcp_pm_add_entry *add_entry = NULL;
345350 struct sock *sk = (struct sock *)msk;
346351 struct net *net = sock_net(sk);
352+ unsigned int timeout;
347353
348354 lockdep_assert_held(&msk->pm.lock);
349355
@@ -353,9 +359,7 @@ bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk, · 3 unmodified lines
353359 if (WARN_ON_ONCE(mptcp_pm_is_kernel(msk)))
354360 return false;
355361
356− sk_reset_timer(sk, &add_entry->add_timer,
357− jiffies + mptcp_get_add_addr_timeout(net));
358− return true;
362+ goto reset_timer;
359363 }
360364
361365 add_entry = kmalloc(sizeof(*add_entry), GFP_ATOMIC);
@@ -369,8 +373,10 @@ bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk, · 7 unmodified lines
369373 add_entry->retrans_times = 0;
370374
371375 timer_setup(&add_entry->add_timer, mptcp_pm_add_timer, 0);
372− sk_reset_timer(sk, &add_entry->add_timer,
373− jiffies + mptcp_get_add_addr_timeout(net));
376+reset_timer:
377+ timeout = mptcp_get_add_addr_timeout(net);
378+ if (timeout)
379+ sk_reset_timer(sk, &add_entry->add_timer, jiffies + timeout);
374380
375381 return true;
376382 }
net/mptcp/pm_kernel.c+0−1
@@ -1085,7 +1085,6 @@ static void __flush_addrs(struct list_head *list) · 1084 unmodified lines
10851085 static void __reset_counters(struct pm_nl_pernet *pernet)
10861086 {
10871087 WRITE_ONCE(pernet->add_addr_signal_max, 0);
1088− WRITE_ONCE(pernet->add_addr_accept_max, 0);
10891088 WRITE_ONCE(pernet->local_addr_max, 0);
10901089 pernet->addrs = 0;
10911090 }
net/sched/sch_cake.c+12−2
@@ -1750,7 +1750,7 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 1749 unmodified lines
17501750 ktime_t now = ktime_get();
17511751 struct cake_tin_data *b;
17521752 struct cake_flow *flow;
1753− u32 idx;
1753+ u32 idx, tin;
17541754
17551755 /* choose flow to insert into */
17561756 idx = cake_classify(sch, &b, skb, q->flow_mode, &ret);
@@ -1760,6 +1760,7 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 3 unmodified lines
17601760 __qdisc_drop(skb, to_free);
17611761 return ret;
17621762 }
1763+ tin = (u32)(b - q->tins);
17631764 idx--;
17641765 flow = &b->flows[idx];
17651766
@@ -1927,13 +1928,22 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 161 unmodified lines
19271928 q->buffer_max_used = q->buffer_used;
19281929
19291930 if (q->buffer_used > q->buffer_limit) {
1931+ bool same_flow = false;
19301932 u32 dropped = 0;
1933+ u32 drop_id;
19311934
19321935 while (q->buffer_used > q->buffer_limit) {
19331936 dropped++;
1934− cake_drop(sch, to_free);
1937+ drop_id = cake_drop(sch, to_free);
1938+
1939+ if ((drop_id >> 16) == tin &&
1940+ (drop_id & 0xFFFF) == idx)
1941+ same_flow = true;
19351942 }
19361943 b->drop_overlimit += dropped;
1944+
1945+ if (same_flow)
1946+ return NET_XMIT_CN;
19371947 }
19381948 return NET_XMIT_SUCCESS;
19391949 }
net/sched/sch_codel.c+7−5
@@ -101,9 +101,9 @@ static const struct nla_policy codel_policy[TCA_CODEL_MAX + 1] = { · 100 unmodified lines
101101 static int codel_change(struct Qdisc *sch, struct nlattr *opt,
102102 struct netlink_ext_ack *extack)
103103 {
104+ unsigned int dropped_pkts = 0, dropped_bytes = 0;
104105 struct codel_sched_data *q = qdisc_priv(sch);
105106 struct nlattr *tb[TCA_CODEL_MAX + 1];
106− unsigned int qlen, dropped = 0;
107107 int err;
108108
109109 err = nla_parse_nested_deprecated(tb, TCA_CODEL_MAX, opt,
@@ -142,15 +142,17 @@ static int codel_change(struct Qdisc *sch, struct nlattr *opt, · 32 unmodified lines
142142 WRITE_ONCE(q->params.ecn,
143143 !!nla_get_u32(tb[TCA_CODEL_ECN]));
144144
145− qlen = sch->q.qlen;
146145 while (sch->q.qlen > sch->limit) {
147146 struct sk_buff *skb = qdisc_dequeue_internal(sch, true);
148147
149− dropped += qdisc_pkt_len(skb);
150− qdisc_qstats_backlog_dec(sch, skb);
148+ if (!skb)
149+ break;
150+
151+ dropped_pkts++;
152+ dropped_bytes += qdisc_pkt_len(skb);
151153 rtnl_qdisc_drop(skb, sch);
152154 }
153− qdisc_tree_reduce_backlog(sch, qlen - sch->q.qlen, dropped);
155+ qdisc_tree_reduce_backlog(sch, dropped_pkts, dropped_bytes);
154156
155157 sch_tree_unlock(sch);
156158 return 0;
net/sched/sch_dualpi2.c+3−2
@@ -927,7 +927,8 @@ static int dualpi2_init(struct Qdisc *sch, struct nlattr *opt, · 926 unmodified lines
927927
928928 q->sch = sch;
929929 dualpi2_reset_default(sch);
930− hrtimer_setup(&q->pi2_timer, dualpi2_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNED);
930+ hrtimer_setup(&q->pi2_timer, dualpi2_timer, CLOCK_MONOTONIC,
931+ HRTIMER_MODE_ABS_PINNED_SOFT);
931932
932933 if (opt && nla_len(opt)) {
933934 err = dualpi2_change(sch, opt, extack);
@@ -937,7 +938,7 @@ static int dualpi2_init(struct Qdisc *sch, struct nlattr *opt, · 3 unmodified lines
937938 }
938939
939940 hrtimer_start(&q->pi2_timer, next_pi2_timeout(q),
940− HRTIMER_MODE_ABS_PINNED);
941+ HRTIMER_MODE_ABS_PINNED_SOFT);
941942 return 0;
942943 }
943944
net/sched/sch_fq.c+7−5
@@ -1013,11 +1013,11 @@ static int fq_load_priomap(struct fq_sched_data *q, · 1012 unmodified lines
10131013 static int fq_change(struct Qdisc *sch, struct nlattr *opt,
10141014 struct netlink_ext_ack *extack)
10151015 {
1016+ unsigned int dropped_pkts = 0, dropped_bytes = 0;
10161017 struct fq_sched_data *q = qdisc_priv(sch);
10171018 struct nlattr *tb[TCA_FQ_MAX + 1];
1018− int err, drop_count = 0;
1019− unsigned drop_len = 0;
10201019 u32 fq_log;
1020+ int err;
10211021
10221022 err = nla_parse_nested_deprecated(tb, TCA_FQ_MAX, opt, fq_policy,
10231023 NULL);
@@ -1135,16 +1135,18 @@ static int fq_change(struct Qdisc *sch, struct nlattr *opt, · 111 unmodified lines
11351135 err = fq_resize(sch, fq_log);
11361136 sch_tree_lock(sch);
11371137 }
1138+
11381139 while (sch->q.qlen > sch->limit) {
11391140 struct sk_buff *skb = qdisc_dequeue_internal(sch, false);
11401141
11411142 if (!skb)
11421143 break;
1143− drop_len += qdisc_pkt_len(skb);
1144+
1145+ dropped_pkts++;
1146+ dropped_bytes += qdisc_pkt_len(skb);
11441147 rtnl_kfree_skbs(skb, skb);
1145− drop_count++;
11461148 }
1147− qdisc_tree_reduce_backlog(sch, drop_count, drop_len);
1149+ qdisc_tree_reduce_backlog(sch, dropped_pkts, dropped_bytes);
11481150
11491151 sch_tree_unlock(sch);
11501152 return err;
net/sched/sch_fq_codel.c+7−5
@@ -366,6 +366,7 @@ static const struct nla_policy fq_codel_policy[TCA_FQ_CODEL_MAX + 1] = { · 365 unmodified lines
366366 static int fq_codel_change(struct Qdisc *sch, struct nlattr *opt,
367367 struct netlink_ext_ack *extack)
368368 {
369+ unsigned int dropped_pkts = 0, dropped_bytes = 0;
369370 struct fq_codel_sched_data *q = qdisc_priv(sch);
370371 struct nlattr *tb[TCA_FQ_CODEL_MAX + 1];
371372 u32 quantum = 0;
@@ -443,13 +444,14 @@ static int fq_codel_change(struct Qdisc *sch, struct nlattr *opt, · 71 unmodified lines
443444 q->memory_usage > q->memory_limit) {
444445 struct sk_buff *skb = qdisc_dequeue_internal(sch, false);
445446
446− q->cstats.drop_len += qdisc_pkt_len(skb);
447+ if (!skb)
448+ break;
449+
450+ dropped_pkts++;
451+ dropped_bytes += qdisc_pkt_len(skb);
447452 rtnl_kfree_skbs(skb, skb);
448− q->cstats.drop_count++;
449453 }
450− qdisc_tree_reduce_backlog(sch, q->cstats.drop_count, q->cstats.drop_len);
451− q->cstats.drop_count = 0;
452− q->cstats.drop_len = 0;
454+ qdisc_tree_reduce_backlog(sch, dropped_pkts, dropped_bytes);
453455
454456 sch_tree_unlock(sch);
455457 return 0;
net/sched/sch_fq_pie.c+7−5
@@ -287,10 +287,9 @@ begin: · 286 unmodified lines
287287 static int fq_pie_change(struct Qdisc *sch, struct nlattr *opt,
288288 struct netlink_ext_ack *extack)
289289 {
290+ unsigned int dropped_pkts = 0, dropped_bytes = 0;
290291 struct fq_pie_sched_data *q = qdisc_priv(sch);
291292 struct nlattr *tb[TCA_FQ_PIE_MAX + 1];
292− unsigned int len_dropped = 0;
293− unsigned int num_dropped = 0;
294293 int err;
295294
296295 err = nla_parse_nested(tb, TCA_FQ_PIE_MAX, opt, fq_pie_policy, extack);
@@ -368,11 +367,14 @@ static int fq_pie_change(struct Qdisc *sch, struct nlattr *opt, · 71 unmodified lines
368367 while (sch->q.qlen > sch->limit) {
369368 struct sk_buff *skb = qdisc_dequeue_internal(sch, false);
370369
371− len_dropped += qdisc_pkt_len(skb);
372− num_dropped += 1;
370+ if (!skb)
371+ break;
372+
373+ dropped_pkts++;
374+ dropped_bytes += qdisc_pkt_len(skb);
373375 rtnl_kfree_skbs(skb, skb);
374376 }
375− qdisc_tree_reduce_backlog(sch, num_dropped, len_dropped);
377+ qdisc_tree_reduce_backlog(sch, dropped_pkts, dropped_bytes);
376378
377379 sch_tree_unlock(sch);
378380 return 0;
net/sched/sch_hhf.c+7−5
@@ -508,9 +508,9 @@ static const struct nla_policy hhf_policy[TCA_HHF_MAX + 1] = { · 507 unmodified lines
508508 static int hhf_change(struct Qdisc *sch, struct nlattr *opt,
509509 struct netlink_ext_ack *extack)
510510 {
511+ unsigned int dropped_pkts = 0, dropped_bytes = 0;
511512 struct hhf_sched_data *q = qdisc_priv(sch);
512513 struct nlattr *tb[TCA_HHF_MAX + 1];
513− unsigned int qlen, prev_backlog;
514514 int err;
515515 u64 non_hh_quantum;
516516 u32 new_quantum = q->quantum;
@@ -561,15 +561,17 @@ static int hhf_change(struct Qdisc *sch, struct nlattr *opt, · 44 unmodified lines
561561 usecs_to_jiffies(us));
562562 }
563563
564− qlen = sch->q.qlen;
565− prev_backlog = sch->qstats.backlog;
566564 while (sch->q.qlen > sch->limit) {
567565 struct sk_buff *skb = qdisc_dequeue_internal(sch, false);
568566
567+ if (!skb)
568+ break;
569+
570+ dropped_pkts++;
571+ dropped_bytes += qdisc_pkt_len(skb);
569572 rtnl_kfree_skbs(skb, skb);
570573 }
571− qdisc_tree_reduce_backlog(sch, qlen - sch->q.qlen,
572− prev_backlog - sch->qstats.backlog);
574+ qdisc_tree_reduce_backlog(sch, dropped_pkts, dropped_bytes);
573575
574576 sch_tree_unlock(sch);
575577 return 0;
net/sched/sch_htb.c+1−1
@@ -592,7 +592,7 @@ htb_change_class_mode(struct htb_sched *q, struct htb_class *cl, s64 *diff) · 591 unmodified lines
592592 */
593593 static inline void htb_activate(struct htb_sched *q, struct htb_class *cl)
594594 {
595− WARN_ON(cl->level || !cl->leaf.q || !cl->leaf.q->q.qlen);
595+ WARN_ON(cl->level || !cl->leaf.q);
596596
597597 if (!cl->prio_activity) {
598598 cl->prio_activity = 1 << cl->prio;
net/sched/sch_pie.c+7−5
@@ -141,9 +141,9 @@ static const struct nla_policy pie_policy[TCA_PIE_MAX + 1] = { · 140 unmodified lines
141141 static int pie_change(struct Qdisc *sch, struct nlattr *opt,
142142 struct netlink_ext_ack *extack)
143143 {
144+ unsigned int dropped_pkts = 0, dropped_bytes = 0;
144145 struct pie_sched_data *q = qdisc_priv(sch);
145146 struct nlattr *tb[TCA_PIE_MAX + 1];
146− unsigned int qlen, dropped = 0;
147147 int err;
148148
149149 err = nla_parse_nested_deprecated(tb, TCA_PIE_MAX, opt, pie_policy,
@@ -193,15 +193,17 @@ static int pie_change(struct Qdisc *sch, struct nlattr *opt, · 43 unmodified lines
193193 nla_get_u32(tb[TCA_PIE_DQ_RATE_ESTIMATOR]));
194194
195195 /* Drop excess packets if new limit is lower */
196− qlen = sch->q.qlen;
197196 while (sch->q.qlen > sch->limit) {
198197 struct sk_buff *skb = qdisc_dequeue_internal(sch, true);
199198
200− dropped += qdisc_pkt_len(skb);
201− qdisc_qstats_backlog_dec(sch, skb);
199+ if (!skb)
200+ break;
201+
202+ dropped_pkts++;
203+ dropped_bytes += qdisc_pkt_len(skb);
202204 rtnl_qdisc_drop(skb, sch);
203205 }
204− qdisc_tree_reduce_backlog(sch, qlen - sch->q.qlen, dropped);
206+ qdisc_tree_reduce_backlog(sch, dropped_pkts, dropped_bytes);
205207
206208 sch_tree_unlock(sch);
207209 return 0;
net/smc/af_smc.c+2−1
@@ -2568,8 +2568,9 @@ static void smc_listen_work(struct work_struct *work) · 2567 unmodified lines
25682568 goto out_decl;
25692569 }
25702570
2571− smc_listen_out_connected(new_smc);
25722571 SMC_STAT_SERV_SUCC_INC(sock_net(newclcsock->sk), ini);
2572+ /* smc_listen_out() will release smcsk */
2573+ smc_listen_out_connected(new_smc);
25732574 goto out_free;
25742575
25752576 out_unlock:
net/tls/tls_sw.c+6−1
@@ -1808,6 +1808,9 @@ int decrypt_skb(struct sock *sk, struct scatterlist *sgout) · 1807 unmodified lines
18081808 return tls_decrypt_sg(sk, NULL, sgout, &darg);
18091809 }
18101810
1811+/* All records returned from a recvmsg() call must have the same type.
1812+ * 0 is not a valid content type. Use it as "no type reported, yet".
1813+ */
18111814 static int tls_record_content_type(struct msghdr *msg, struct tls_msg *tlm,
18121815 u8 *control)
18131816 {
@@ -2051,8 +2054,10 @@ int tls_sw_recvmsg(struct sock *sk, · 237 unmodified lines
20512054 if (err < 0)
20522055 goto end;
20532056
2057+ /* process_rx_list() will set @control if it processed any records */
20542058 copied = err;
2055− if (len <= copied || (copied && control != TLS_RECORD_TYPE_DATA) || rx_more)
2059+ if (len <= copied || rx_more ||
2060+ (control && control != TLS_RECORD_TYPE_DATA))
20562061 goto end;
20572062
20582063 target = sock_rcvlowat(sk, flags & MSG_WAITALL, len);
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/bootconfig/main.c+2−2
@@ -193,7 +193,7 @@ static int load_xbc_from_initrd(int fd, char **buf) · 192 unmodified lines
193193 if (stat.st_size < BOOTCONFIG_FOOTER_SIZE)
194194 return 0;
195195
196− if (lseek(fd, -BOOTCONFIG_MAGIC_LEN, SEEK_END) < 0)
196+ if (lseek(fd, -(off_t)BOOTCONFIG_MAGIC_LEN, SEEK_END) < 0)
197197 return pr_errno("Failed to lseek for magic", -errno);
198198
199199 if (read(fd, magic, BOOTCONFIG_MAGIC_LEN) < 0)
@@ -203,7 +203,7 @@ static int load_xbc_from_initrd(int fd, char **buf) · 3 unmodified lines
203203 if (memcmp(magic, BOOTCONFIG_MAGIC, BOOTCONFIG_MAGIC_LEN) != 0)
204204 return 0;
205205
206− if (lseek(fd, -BOOTCONFIG_FOOTER_SIZE, SEEK_END) < 0)
206+ if (lseek(fd, -(off_t)BOOTCONFIG_FOOTER_SIZE, SEEK_END) < 0)
207207 return pr_errno("Failed to lseek for size", -errno);
208208
209209 if (read(fd, &size, sizeof(uint32_t)) < 0)
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/objtool/arch/loongarch/special.c+23−0
@@ -27,6 +27,7 @@ static void get_rodata_table_size_by_table_annotate(struct objtool_file *file, · 26 unmodified lines
2727 struct table_info *next_table;
2828 unsigned long tmp_insn_offset;
2929 unsigned long tmp_rodata_offset;
30+ bool is_valid_list = false;
3031
3132 rsec = find_section_by_name(file->elf, ".rela.discard.tablejump_annotate");
3233 if (!rsec)
@@ -35,6 +36,12 @@ static void get_rodata_table_size_by_table_annotate(struct objtool_file *file, · 2 unmodified lines
3536 INIT_LIST_HEAD(&table_list);
3637
3738 for_each_reloc(rsec, reloc) {
39+ if (reloc->sym->sec->rodata)
40+ continue;
41+
42+ if (strcmp(insn->sec->name, reloc->sym->sec->name))
43+ continue;
44+
3845 orig_table = malloc(sizeof(struct table_info));
3946 if (!orig_table) {
4047 WARN("malloc failed");
@@ -49,6 +56,22 @@ static void get_rodata_table_size_by_table_annotate(struct objtool_file *file, · 8 unmodified lines
4956
5057 if (reloc_idx(reloc) + 1 == sec_num_entries(rsec))
5158 break;
59+
60+ if (strcmp(insn->sec->name, (reloc + 1)->sym->sec->name)) {
61+ list_for_each_entry(orig_table, &table_list, jump_info) {
62+ if (orig_table->insn_offset == insn->offset) {
63+ is_valid_list = true;
64+ break;
65+ }
66+ }
67+
68+ if (!is_valid_list) {
69+ list_del_init(&table_list);
70+ continue;
71+ }
72+
73+ break;
74+ }
5275 }
5376
5477 list_for_each_entry(orig_table, &table_list, jump_info) {
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/testing/selftests/coredump/stackdump_test.c+0−3
@@ -446,9 +446,6 @@ TEST_F(coredump, socket_detect_userspace_client) · 445 unmodified lines
446446 if (info.coredump_mask & PIDFD_COREDUMPED)
447447 goto out;
448448
449− if (read(fd_coredump, &c, 1) < 1)
450− goto out;
451−
452449 exit_code = EXIT_SUCCESS;
453450 out:
454451 if (fd_peer_pidfd >= 0)
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/drivers/net/bonding/Makefile+2−1
@@ -10,7 +10,8 @@ TEST_PROGS := \ · 9 unmodified lines
1010 mode-2-recovery-updelay.sh \
1111 bond_options.sh \
1212 bond-eth-type-change.sh \
13− bond_macvlan_ipvlan.sh
13+ bond_macvlan_ipvlan.sh \
14+ bond_passive_lacp.sh
1415
1516 TEST_FILES := \
1617 lag_lib.sh \
tools/testing/selftests/drivers/net/bonding/bond_passive_lacp.sh+105−0
@@ -0,0 +1,105 @@
1+#!/bin/bash
2+# SPDX-License-Identifier: GPL-2.0
3+#
4+# Test if a bond interface works with lacp_active=off.
5+
6+# shellcheck disable=SC2034
7+REQUIRE_MZ=no
8+NUM_NETIFS=0
9+lib_dir=$(dirname "$0")
10+# shellcheck disable=SC1091
11+source "$lib_dir"/../../../net/forwarding/lib.sh
12+
13+# shellcheck disable=SC2317
14+check_port_state()
15+{
16+ local netns=$1
17+ local port=$2
18+ local state=$3
19+
20+ ip -n "${netns}" -d -j link show "$port" | \
21+ jq -e ".[].linkinfo.info_slave_data.ad_actor_oper_port_state_str | index(\"${state}\") != null" > /dev/null
22+}
23+
24+check_pkt_count()
25+{
26+ RET=0
27+ local ns="$1"
28+ local iface="$2"
29+
30+ # wait 65s, one per 30s
31+ slowwait_for_counter 65 2 tc_rule_handle_stats_get \
32+ "dev ${iface} egress" 101 ".packets" "-n ${ns}" &> /dev/null
33+}
34+
35+setup() {
36+ setup_ns c_ns s_ns
37+
38+ # shellcheck disable=SC2154
39+ ip -n "${c_ns}" link add eth0 type veth peer name eth0 netns "${s_ns}"
40+ ip -n "${c_ns}" link add eth1 type veth peer name eth1 netns "${s_ns}"
41+
42+ # Add tc filter to count the pkts
43+ tc -n "${c_ns}" qdisc add dev eth0 clsact
44+ tc -n "${c_ns}" filter add dev eth0 egress handle 101 protocol 0x8809 matchall action pass
45+ tc -n "${s_ns}" qdisc add dev eth1 clsact
46+ tc -n "${s_ns}" filter add dev eth1 egress handle 101 protocol 0x8809 matchall action pass
47+
48+ ip -n "${s_ns}" link add bond0 type bond mode 802.3ad lacp_active on lacp_rate fast
49+ ip -n "${s_ns}" link set eth0 master bond0
50+ ip -n "${s_ns}" link set eth1 master bond0
51+
52+ ip -n "${c_ns}" link add bond0 type bond mode 802.3ad lacp_active off lacp_rate fast
53+ ip -n "${c_ns}" link set eth0 master bond0
54+ ip -n "${c_ns}" link set eth1 master bond0
55+
56+}
57+
58+trap cleanup_all_ns EXIT
59+setup
60+
61+# The bond will send 2 lacpdu pkts during init time, let's wait at least 2s
62+# after interface up
63+ip -n "${c_ns}" link set bond0 up
64+sleep 2
65+
66+# 1. The passive side shouldn't send LACPDU.
67+check_pkt_count "${c_ns}" "eth0" && RET=1
68+log_test "802.3ad lacp_active off" "init port"
69+
70+ip -n "${s_ns}" link set bond0 up
71+# 2. The passive side should not have the 'active' flag.
72+RET=0
73+slowwait 2 check_port_state "${c_ns}" "eth0" "active" && RET=1
74+log_test "802.3ad lacp_active off" "port state active"
75+
76+# 3. The active side should have the 'active' flag.
77+RET=0
78+slowwait 2 check_port_state "${s_ns}" "eth0" "active" || RET=1
79+log_test "802.3ad lacp_active on" "port state active"
80+
81+# 4. Make sure the connection is not expired.
82+RET=0
83+slowwait 5 check_port_state "${s_ns}" "eth0" "distributing"
84+slowwait 10 check_port_state "${s_ns}" "eth0" "expired" && RET=1
85+log_test "bond 802.3ad lacp_active off" "port connection"
86+
87+# After testing, disconnect one port on each side to check the state.
88+ip -n "${s_ns}" link set eth0 nomaster
89+ip -n "${s_ns}" link set eth0 up
90+ip -n "${c_ns}" link set eth1 nomaster
91+ip -n "${c_ns}" link set eth1 up
92+# Due to Periodic Machine and Rx Machine state change, the bond will still
93+# send lacpdu pkts in a few seconds. sleep at lease 5s to make sure
94+# negotiation finished
95+sleep 5
96+
97+# 5. The active side should keep sending LACPDU.
98+check_pkt_count "${s_ns}" "eth1" || RET=1
99+log_test "bond 802.3ad lacp_active on" "port pkt after disconnect"
100+
101+# 6. The passive side shouldn't send LACPDU anymore.
102+check_pkt_count "${c_ns}" "eth0" && RET=1
103+log_test "bond 802.3ad lacp_active off" "port pkt after disconnect"
104+
105+exit "$EXIT_STATUS"
tools/testing/selftests/drivers/net/bonding/config+1−0
@@ -6,6 +6,7 @@ CONFIG_MACVLAN=y · 5 unmodified lines
66 CONFIG_IPVLAN=y
77 CONFIG_NET_ACT_GACT=y
88 CONFIG_NET_CLS_FLOWER=y
9+CONFIG_NET_CLS_MATCHALL=m
910 CONFIG_NET_SCH_INGRESS=y
1011 CONFIG_NLMON=y
1112 CONFIG_VETH=y
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/mount_setattr/mount_setattr_test.c+64−13
@@ -107,6 +107,26 @@ · 106 unmodified lines
107107 #endif
108108 #endif
109109
110+#ifndef __NR_open_tree_attr
111+ #if defined __alpha__
112+ #define __NR_open_tree_attr 577
113+ #elif defined _MIPS_SIM
114+ #if _MIPS_SIM == _MIPS_SIM_ABI32 /* o32 */
115+ #define __NR_open_tree_attr (467 + 4000)
116+ #endif
117+ #if _MIPS_SIM == _MIPS_SIM_NABI32 /* n32 */
118+ #define __NR_open_tree_attr (467 + 6000)
119+ #endif
120+ #if _MIPS_SIM == _MIPS_SIM_ABI64 /* n64 */
121+ #define __NR_open_tree_attr (467 + 5000)
122+ #endif
123+ #elif defined __ia64__
124+ #define __NR_open_tree_attr (467 + 1024)
125+ #else
126+ #define __NR_open_tree_attr 467
127+ #endif
128+#endif
129+
110130 #ifndef MOUNT_ATTR_IDMAP
111131 #define MOUNT_ATTR_IDMAP 0x00100000
112132 #endif
@@ -121,6 +141,12 @@ static inline int sys_mount_setattr(int dfd, const char *path, unsigned int flag · 8 unmodified lines
121141 return syscall(__NR_mount_setattr, dfd, path, flags, attr, size);
122142 }
123143
144+static inline int sys_open_tree_attr(int dfd, const char *path, unsigned int flags,
145+ struct mount_attr *attr, size_t size)
146+{
147+ return syscall(__NR_open_tree_attr, dfd, path, flags, attr, size);
148+}
149+
124150 static ssize_t write_nointr(int fd, const void *buf, size_t count)
125151 {
126152 ssize_t ret;
@@ -1222,6 +1248,12 @@ TEST_F(mount_setattr_idmapped, attached_mount_inside_current_mount_namespace) · 1095 unmodified lines
12221248 attr.userns_fd = get_userns_fd(0, 10000, 10000);
12231249 ASSERT_GE(attr.userns_fd, 0);
12241250 ASSERT_NE(sys_mount_setattr(open_tree_fd, "", AT_EMPTY_PATH, &attr, sizeof(attr)), 0);
1251+ /*
1252+ * Make sure that open_tree_attr() without OPEN_TREE_CLONE is not a way
1253+ * to bypass this mount_setattr() restriction.
1254+ */
1255+ ASSERT_LT(sys_open_tree_attr(open_tree_fd, "", AT_EMPTY_PATH, &attr, sizeof(attr)), 0);
1256+
12251257 ASSERT_EQ(close(attr.userns_fd), 0);
12261258 ASSERT_EQ(close(open_tree_fd), 0);
12271259 }
@@ -1255,6 +1287,12 @@ TEST_F(mount_setattr_idmapped, attached_mount_outside_current_mount_namespace) · 27 unmodified lines
12551287 ASSERT_GE(attr.userns_fd, 0);
12561288 ASSERT_NE(sys_mount_setattr(open_tree_fd, "", AT_EMPTY_PATH, &attr,
12571289 sizeof(attr)), 0);
1290+ /*
1291+ * Make sure that open_tree_attr() without OPEN_TREE_CLONE is not a way
1292+ * to bypass this mount_setattr() restriction.
1293+ */
1294+ ASSERT_LT(sys_open_tree_attr(open_tree_fd, "", AT_EMPTY_PATH, &attr, sizeof(attr)), 0);
1295+
12581296 ASSERT_EQ(close(attr.userns_fd), 0);
12591297 ASSERT_EQ(close(open_tree_fd), 0);
12601298 }
@@ -1321,6 +1359,19 @@ TEST_F(mount_setattr_idmapped, detached_mount_outside_current_mount_namespace) · 60 unmodified lines
13211359 ASSERT_EQ(close(open_tree_fd), 0);
13221360 }
13231361
1362+static bool expected_uid_gid(int dfd, const char *path, int flags,
1363+ uid_t expected_uid, gid_t expected_gid)
1364+{
1365+ int ret;
1366+ struct stat st;
1367+
1368+ ret = fstatat(dfd, path, &st, flags);
1369+ if (ret < 0)
1370+ return false;
1371+
1372+ return st.st_uid == expected_uid && st.st_gid == expected_gid;
1373+}
1374+
13241375 /**
13251376 * Validate that currently changing the idmapping of an idmapped mount fails.
13261377 */
@@ -1331,6 +1382,8 @@ TEST_F(mount_setattr_idmapped, change_idmapping) · 4 unmodified lines
13311382 .attr_set = MOUNT_ATTR_IDMAP,
13321383 };
13331384
1385+ ASSERT_TRUE(expected_uid_gid(-EBADF, "/mnt/D", 0, 0, 0));
1386+
13341387 if (!mount_setattr_supported())
13351388 SKIP(return, "mount_setattr syscall not supported");
13361389
@@ -1348,27 +1401,25 @@ TEST_F(mount_setattr_idmapped, change_idmapping) · 11 unmodified lines
13481401 AT_EMPTY_PATH, &attr, sizeof(attr)), 0);
13491402 ASSERT_EQ(close(attr.userns_fd), 0);
13501403
1404+ EXPECT_FALSE(expected_uid_gid(open_tree_fd, ".", 0, 0, 0));
1405+ EXPECT_TRUE(expected_uid_gid(open_tree_fd, ".", 0, 10000, 10000));
1406+
13511407 /* Change idmapping on a detached mount that is already idmapped. */
13521408 attr.userns_fd = get_userns_fd(0, 20000, 10000);
13531409 ASSERT_GE(attr.userns_fd, 0);
13541410 ASSERT_NE(sys_mount_setattr(open_tree_fd, "", AT_EMPTY_PATH, &attr, sizeof(attr)), 0);
1411+ /*
1412+ * Make sure that open_tree_attr() without OPEN_TREE_CLONE is not a way
1413+ * to bypass this mount_setattr() restriction.
1414+ */
1415+ EXPECT_LT(sys_open_tree_attr(open_tree_fd, "", AT_EMPTY_PATH, &attr, sizeof(attr)), 0);
1416+ EXPECT_FALSE(expected_uid_gid(open_tree_fd, ".", 0, 20000, 20000));
1417+ EXPECT_TRUE(expected_uid_gid(open_tree_fd, ".", 0, 10000, 10000));
1418+
13551419 ASSERT_EQ(close(attr.userns_fd), 0);
13561420 ASSERT_EQ(close(open_tree_fd), 0);
13571421 }
13581422
1359−static bool expected_uid_gid(int dfd, const char *path, int flags,
1360− uid_t expected_uid, gid_t expected_gid)
1361−{
1362− int ret;
1363− struct stat st;
1364−
1365− ret = fstatat(dfd, path, &st, flags);
1366− if (ret < 0)
1367− return false;
1368−
1369− return st.st_uid == expected_uid && st.st_gid == expected_gid;
1370−}
1371−
13721423 TEST_F(mount_setattr_idmapped, idmap_mount_tree_invalid)
13731424 {
13741425 int open_tree_fd = -EBADF;
tools/testing/selftests/net/forwarding/router.sh+29−0
@@ -18,6 +18,8 @@ · 17 unmodified lines
1818 # | 2001:db8:1::1/64 2001:db8:2::1/64 |
1919 # | |
2020 # +-----------------------------------------------------------------+
21+#
22+#shellcheck disable=SC2034 # SC doesn't see our uses of global variables
2123
2224 ALL_TESTS="
2325 ping_ipv4
@@ -27,6 +29,7 @@ ALL_TESTS=" · 3 unmodified lines
2729 ipv4_sip_equal_dip
2830 ipv6_sip_equal_dip
2931 ipv4_dip_link_local
32+ ipv4_sip_link_local
3033 "
3134
3235 NUM_NETIFS=4
@@ -330,6 +333,32 @@ ipv4_dip_link_local() · 297 unmodified lines
330333 tc filter del dev $rp2 egress protocol ip pref 1 handle 101 flower
331334 }
332335
336+ipv4_sip_link_local()
337+{
338+ local sip=169.254.1.1
339+
340+ RET=0
341+
342+ # Disable rpfilter to prevent packets to be dropped because of it.
343+ sysctl_set net.ipv4.conf.all.rp_filter 0
344+ sysctl_set net.ipv4.conf."$rp1".rp_filter 0
345+
346+ tc filter add dev "$rp2" egress protocol ip pref 1 handle 101 \
347+ flower src_ip "$sip" action pass
348+
349+ $MZ "$h1" -t udp "sp=54321,dp=12345" -c 5 -d 1msec -b "$rp1mac" \
350+ -A "$sip" -B 198.51.100.2 -q
351+
352+ tc_check_packets "dev $rp2 egress" 101 5
353+ check_err $? "Packets were dropped"
354+
355+ log_test "IPv4 source IP is link-local"
356+
357+ tc filter del dev "$rp2" egress protocol ip pref 1 handle 101 flower
358+ sysctl_restore net.ipv4.conf."$rp1".rp_filter
359+ sysctl_restore net.ipv4.conf.all.rp_filter
360+}
361+
333362 trap cleanup EXIT
334363
335364 setup_prepare
tools/testing/selftests/net/mptcp/mptcp_connect.c+3−2
@@ -183,9 +183,10 @@ static void xgetaddrinfo(const char *node, const char *service, · 182 unmodified lines
183183 struct addrinfo *hints,
184184 struct addrinfo **res)
185185 {
186−again:
187− int err = getaddrinfo(node, service, hints, res);
186+ int err;
188187
188+again:
189+ err = getaddrinfo(node, service, hints, res);
189190 if (err) {
190191 const char *errstr;
191192
tools/testing/selftests/net/mptcp/mptcp_inq.c+3−2
@@ -75,9 +75,10 @@ static void xgetaddrinfo(const char *node, const char *service, · 74 unmodified lines
7575 struct addrinfo *hints,
7676 struct addrinfo **res)
7777 {
78−again:
79− int err = getaddrinfo(node, service, hints, res);
78+ int err;
8079
80+again:
81+ err = getaddrinfo(node, service, hints, res);
8182 if (err) {
8283 const char *errstr;
8384
tools/testing/selftests/net/mptcp/mptcp_join.sh+1−0
@@ -3842,6 +3842,7 @@ endpoint_tests() · 3841 unmodified lines
38423842 # remove and re-add
38433843 if reset_with_events "delete re-add signal" &&
38443844 mptcp_lib_kallsyms_has "subflow_rebuild_header$"; then
3845+ ip netns exec $ns1 sysctl -q net.mptcp.add_addr_timeout=0
38453846 pm_nl_set_limits $ns1 0 3
38463847 pm_nl_set_limits $ns2 3 3
38473848 pm_nl_add_endpoint $ns1 10.0.2.1 id 1 flags signal
tools/testing/selftests/net/mptcp/mptcp_sockopt.c+3−2
@@ -162,9 +162,10 @@ static void xgetaddrinfo(const char *node, const char *service, · 161 unmodified lines
162162 struct addrinfo *hints,
163163 struct addrinfo **res)
164164 {
165−again:
166− int err = getaddrinfo(node, service, hints, res);
165+ int err;
167166
167+again:
168+ err = getaddrinfo(node, service, hints, res);
168169 if (err) {
169170 const char *errstr;
170171
tools/testing/selftests/net/mptcp/pm_netlink.sh+1−0
@@ -198,6 +198,7 @@ set_limits 1 9 2>/dev/null · 197 unmodified lines
198198 check "get_limits" "${default_limits}" "subflows above hard limit"
199199
200200 set_limits 8 8
201+flush_endpoint ## to make sure it doesn't affect the limits
201202 check "get_limits" "$(format_limits 8 8)" "set limits"
202203
203204 flush_endpoint
tools/testing/selftests/net/tls.c+300−12
@@ -181,13 +181,12 @@ static int tls_send_cmsg(int fd, unsigned char record_type, · 180 unmodified lines
181181 return sendmsg(fd, &msg, flags);
182182 }
183183
184−static int tls_recv_cmsg(struct __test_metadata *_metadata,
185− int fd, unsigned char record_type,
186− void *data, size_t len, int flags)
184+static int __tls_recv_cmsg(struct __test_metadata *_metadata,
185+ int fd, unsigned char *ctype,
186+ void *data, size_t len, int flags)
187187 {
188188 char cbuf[CMSG_SPACE(sizeof(char))];
189189 struct cmsghdr *cmsg;
190− unsigned char ctype;
191190 struct msghdr msg;
192191 struct iovec vec;
193192 int n;
@@ -206,7 +205,20 @@ static int tls_recv_cmsg(struct __test_metadata *_metadata, · 12 unmodified lines
206205 EXPECT_NE(cmsg, NULL);
207206 EXPECT_EQ(cmsg->cmsg_level, SOL_TLS);
208207 EXPECT_EQ(cmsg->cmsg_type, TLS_GET_RECORD_TYPE);
209− ctype = *((unsigned char *)CMSG_DATA(cmsg));
208+ if (ctype)
209+ *ctype = *((unsigned char *)CMSG_DATA(cmsg));
210+
211+ return n;
212+}
213+
214+static int tls_recv_cmsg(struct __test_metadata *_metadata,
215+ int fd, unsigned char record_type,
216+ void *data, size_t len, int flags)
217+{
218+ unsigned char ctype;
219+ int n;
220+
221+ n = __tls_recv_cmsg(_metadata, fd, &ctype, data, len, flags);
210222 EXPECT_EQ(ctype, record_type);
211223
212224 return n;
@@ -2164,6 +2176,284 @@ TEST_F(tls, rekey_poll_delay) · 1951 unmodified lines
21642176 }
21652177 }
21662178
2179+struct raw_rec {
2180+ unsigned int plain_len;
2181+ unsigned char plain_data[100];
2182+ unsigned int cipher_len;
2183+ unsigned char cipher_data[128];
2184+};
2185+
2186+/* TLS 1.2, AES_CCM, data, seqno:0, plaintext: 'Hello world' */
2187+static const struct raw_rec id0_data_l11 = {
2188+ .plain_len = 11,
2189+ .plain_data = {
2190+ 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x77, 0x6f,
2191+ 0x72, 0x6c, 0x64,
2192+ },
2193+ .cipher_len = 40,
2194+ .cipher_data = {
2195+ 0x17, 0x03, 0x03, 0x00, 0x23, 0x00, 0x00, 0x00,
2196+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0xa2, 0x33,
2197+ 0xde, 0x8d, 0x94, 0xf0, 0x29, 0x6c, 0xb1, 0xaf,
2198+ 0x6a, 0x75, 0xb2, 0x93, 0xad, 0x45, 0xd5, 0xfd,
2199+ 0x03, 0x51, 0x57, 0x8f, 0xf9, 0xcc, 0x3b, 0x42,
2200+ },
2201+};
2202+
2203+/* TLS 1.2, AES_CCM, ctrl, seqno:0, plaintext: '' */
2204+static const struct raw_rec id0_ctrl_l0 = {
2205+ .plain_len = 0,
2206+ .plain_data = {
2207+ },
2208+ .cipher_len = 29,
2209+ .cipher_data = {
2210+ 0x16, 0x03, 0x03, 0x00, 0x18, 0x00, 0x00, 0x00,
2211+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x38, 0x7b,
2212+ 0xa6, 0x1c, 0xdd, 0xa7, 0x19, 0x33, 0xab, 0xae,
2213+ 0x88, 0xe1, 0xd2, 0x08, 0x4f,
2214+ },
2215+};
2216+
2217+/* TLS 1.2, AES_CCM, data, seqno:0, plaintext: '' */
2218+static const struct raw_rec id0_data_l0 = {
2219+ .plain_len = 0,
2220+ .plain_data = {
2221+ },
2222+ .cipher_len = 29,
2223+ .cipher_data = {
2224+ 0x17, 0x03, 0x03, 0x00, 0x18, 0x00, 0x00, 0x00,
2225+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc5, 0x37, 0x90,
2226+ 0x70, 0x45, 0x89, 0xfb, 0x5c, 0xc7, 0x89, 0x03,
2227+ 0x68, 0x80, 0xd3, 0xd8, 0xcc,
2228+ },
2229+};
2230+
2231+/* TLS 1.2, AES_CCM, data, seqno:1, plaintext: 'Hello world' */
2232+static const struct raw_rec id1_data_l11 = {
2233+ .plain_len = 11,
2234+ .plain_data = {
2235+ 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x77, 0x6f,
2236+ 0x72, 0x6c, 0x64,
2237+ },
2238+ .cipher_len = 40,
2239+ .cipher_data = {
2240+ 0x17, 0x03, 0x03, 0x00, 0x23, 0x00, 0x00, 0x00,
2241+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x3a, 0x1a, 0x9c,
2242+ 0xd0, 0xa8, 0x9a, 0xd6, 0x69, 0xd6, 0x1a, 0xe3,
2243+ 0xb5, 0x1f, 0x0d, 0x2c, 0xe2, 0x97, 0x46, 0xff,
2244+ 0x2b, 0xcc, 0x5a, 0xc4, 0xa3, 0xb9, 0xef, 0xba,
2245+ },
2246+};
2247+
2248+/* TLS 1.2, AES_CCM, ctrl, seqno:1, plaintext: '' */
2249+static const struct raw_rec id1_ctrl_l0 = {
2250+ .plain_len = 0,
2251+ .plain_data = {
2252+ },
2253+ .cipher_len = 29,
2254+ .cipher_data = {
2255+ 0x16, 0x03, 0x03, 0x00, 0x18, 0x00, 0x00, 0x00,
2256+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x3e, 0xf0, 0xfe,
2257+ 0xee, 0xd9, 0xe2, 0x5d, 0xc7, 0x11, 0x4c, 0xe6,
2258+ 0xb4, 0x7e, 0xef, 0x40, 0x2b,
2259+ },
2260+};
2261+
2262+/* TLS 1.2, AES_CCM, data, seqno:1, plaintext: '' */
2263+static const struct raw_rec id1_data_l0 = {
2264+ .plain_len = 0,
2265+ .plain_data = {
2266+ },
2267+ .cipher_len = 29,
2268+ .cipher_data = {
2269+ 0x17, 0x03, 0x03, 0x00, 0x18, 0x00, 0x00, 0x00,
2270+ 0x00, 0x00, 0x00, 0x00, 0x01, 0xce, 0xfc, 0x86,
2271+ 0xc8, 0xf0, 0x55, 0xf9, 0x47, 0x3f, 0x74, 0xdc,
2272+ 0xc9, 0xbf, 0xfe, 0x5b, 0xb1,
2273+ },
2274+};
2275+
2276+/* TLS 1.2, AES_CCM, ctrl, seqno:2, plaintext: 'Hello world' */
2277+static const struct raw_rec id2_ctrl_l11 = {
2278+ .plain_len = 11,
2279+ .plain_data = {
2280+ 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x77, 0x6f,
2281+ 0x72, 0x6c, 0x64,
2282+ },
2283+ .cipher_len = 40,
2284+ .cipher_data = {
2285+ 0x16, 0x03, 0x03, 0x00, 0x23, 0x00, 0x00, 0x00,
2286+ 0x00, 0x00, 0x00, 0x00, 0x02, 0xe5, 0x3d, 0x19,
2287+ 0x3d, 0xca, 0xb8, 0x16, 0xb6, 0xff, 0x79, 0x87,
2288+ 0x2a, 0x04, 0x11, 0x3d, 0xf8, 0x64, 0x5f, 0x36,
2289+ 0x8b, 0xa8, 0xee, 0x4c, 0x6d, 0x62, 0xa5, 0x00,
2290+ },
2291+};
2292+
2293+/* TLS 1.2, AES_CCM, data, seqno:2, plaintext: 'Hello world' */
2294+static const struct raw_rec id2_data_l11 = {
2295+ .plain_len = 11,
2296+ .plain_data = {
2297+ 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x77, 0x6f,
2298+ 0x72, 0x6c, 0x64,
2299+ },
2300+ .cipher_len = 40,
2301+ .cipher_data = {
2302+ 0x17, 0x03, 0x03, 0x00, 0x23, 0x00, 0x00, 0x00,
2303+ 0x00, 0x00, 0x00, 0x00, 0x02, 0xe5, 0x3d, 0x19,
2304+ 0x3d, 0xca, 0xb8, 0x16, 0xb6, 0xff, 0x79, 0x87,
2305+ 0x8e, 0xa1, 0xd0, 0xcd, 0x33, 0xb5, 0x86, 0x2b,
2306+ 0x17, 0xf1, 0x52, 0x2a, 0x55, 0x62, 0x65, 0x11,
2307+ },
2308+};
2309+
2310+/* TLS 1.2, AES_CCM, ctrl, seqno:2, plaintext: '' */
2311+static const struct raw_rec id2_ctrl_l0 = {
2312+ .plain_len = 0,
2313+ .plain_data = {
2314+ },
2315+ .cipher_len = 29,
2316+ .cipher_data = {
2317+ 0x16, 0x03, 0x03, 0x00, 0x18, 0x00, 0x00, 0x00,
2318+ 0x00, 0x00, 0x00, 0x00, 0x02, 0xdc, 0x5c, 0x0e,
2319+ 0x41, 0xdd, 0xba, 0xd3, 0xcc, 0xcf, 0x6d, 0xd9,
2320+ 0x06, 0xdb, 0x79, 0xe5, 0x5d,
2321+ },
2322+};
2323+
2324+/* TLS 1.2, AES_CCM, data, seqno:2, plaintext: '' */
2325+static const struct raw_rec id2_data_l0 = {
2326+ .plain_len = 0,
2327+ .plain_data = {
2328+ },
2329+ .cipher_len = 29,
2330+ .cipher_data = {
2331+ 0x17, 0x03, 0x03, 0x00, 0x18, 0x00, 0x00, 0x00,
2332+ 0x00, 0x00, 0x00, 0x00, 0x02, 0xc3, 0xca, 0x26,
2333+ 0x22, 0xe4, 0x25, 0xfb, 0x5f, 0x6d, 0xbf, 0x83,
2334+ 0x30, 0x48, 0x69, 0x1a, 0x47,
2335+ },
2336+};
2337+
2338+FIXTURE(zero_len)
2339+{
2340+ int fd, cfd;
2341+ bool notls;
2342+};
2343+
2344+FIXTURE_VARIANT(zero_len)
2345+{
2346+ const struct raw_rec *recs[4];
2347+ ssize_t recv_ret[4];
2348+};
2349+
2350+FIXTURE_VARIANT_ADD(zero_len, data_data_data)
2351+{
2352+ .recs = { &id0_data_l11, &id1_data_l11, &id2_data_l11, },
2353+ .recv_ret = { 33, -EAGAIN, },
2354+};
2355+
2356+FIXTURE_VARIANT_ADD(zero_len, data_0ctrl_data)
2357+{
2358+ .recs = { &id0_data_l11, &id1_ctrl_l0, &id2_data_l11, },
2359+ .recv_ret = { 11, 0, 11, -EAGAIN, },
2360+};
2361+
2362+FIXTURE_VARIANT_ADD(zero_len, 0data_0data_0data)
2363+{
2364+ .recs = { &id0_data_l0, &id1_data_l0, &id2_data_l0, },
2365+ .recv_ret = { -EAGAIN, },
2366+};
2367+
2368+FIXTURE_VARIANT_ADD(zero_len, 0data_0data_ctrl)
2369+{
2370+ .recs = { &id0_data_l0, &id1_data_l0, &id2_ctrl_l11, },
2371+ .recv_ret = { 0, 11, -EAGAIN, },
2372+};
2373+
2374+FIXTURE_VARIANT_ADD(zero_len, 0data_0data_0ctrl)
2375+{
2376+ .recs = { &id0_data_l0, &id1_data_l0, &id2_ctrl_l0, },
2377+ .recv_ret = { 0, 0, -EAGAIN, },
2378+};
2379+
2380+FIXTURE_VARIANT_ADD(zero_len, 0ctrl_0ctrl_0ctrl)
2381+{
2382+ .recs = { &id0_ctrl_l0, &id1_ctrl_l0, &id2_ctrl_l0, },
2383+ .recv_ret = { 0, 0, 0, -EAGAIN, },
2384+};
2385+
2386+FIXTURE_VARIANT_ADD(zero_len, 0data_0data_data)
2387+{
2388+ .recs = { &id0_data_l0, &id1_data_l0, &id2_data_l11, },
2389+ .recv_ret = { 11, -EAGAIN, },
2390+};
2391+
2392+FIXTURE_VARIANT_ADD(zero_len, data_0data_0data)
2393+{
2394+ .recs = { &id0_data_l11, &id1_data_l0, &id2_data_l0, },
2395+ .recv_ret = { 11, -EAGAIN, },
2396+};
2397+
2398+FIXTURE_SETUP(zero_len)
2399+{
2400+ struct tls_crypto_info_keys tls12;
2401+ int ret;
2402+
2403+ tls_crypto_info_init(TLS_1_2_VERSION, TLS_CIPHER_AES_CCM_128,
2404+ &tls12, 0);
2405+
2406+ ulp_sock_pair(_metadata, &self->fd, &self->cfd, &self->notls);
2407+ if (self->notls)
2408+ return;
2409+
2410+ /* Don't install keys on fd, we'll send raw records */
2411+ ret = setsockopt(self->cfd, SOL_TLS, TLS_RX, &tls12, tls12.len);
2412+ ASSERT_EQ(ret, 0);
2413+}
2414+
2415+FIXTURE_TEARDOWN(zero_len)
2416+{
2417+ close(self->fd);
2418+ close(self->cfd);
2419+}
2420+
2421+TEST_F(zero_len, test)
2422+{
2423+ const struct raw_rec *const *rec;
2424+ unsigned char buf[128];
2425+ int rec_off;
2426+ int i;
2427+
2428+ for (i = 0; i < 4 && variant->recs[i]; i++)
2429+ EXPECT_EQ(send(self->fd, variant->recs[i]->cipher_data,
2430+ variant->recs[i]->cipher_len, 0),
2431+ variant->recs[i]->cipher_len);
2432+
2433+ rec = &variant->recs[0];
2434+ rec_off = 0;
2435+ for (i = 0; i < 4; i++) {
2436+ int j, ret;
2437+
2438+ ret = variant->recv_ret[i] >= 0 ? variant->recv_ret[i] : -1;
2439+ EXPECT_EQ(__tls_recv_cmsg(_metadata, self->cfd, NULL,
2440+ buf, sizeof(buf), MSG_DONTWAIT), ret);
2441+ if (ret == -1)
2442+ EXPECT_EQ(errno, -variant->recv_ret[i]);
2443+ if (variant->recv_ret[i] == -EAGAIN)
2444+ break;
2445+
2446+ for (j = 0; j < ret; j++) {
2447+ while (rec_off == (*rec)->plain_len) {
2448+ rec++;
2449+ rec_off = 0;
2450+ }
2451+ EXPECT_EQ(buf[j], (*rec)->plain_data[rec_off]);
2452+ rec_off++;
2453+ }
2454+ }
2455+};
2456+
21672457 FIXTURE(tls_err)
21682458 {
21692459 int fd, cfd;
@@ -2748,17 +3038,18 @@ TEST(data_steal) { · 578 unmodified lines
27483038 pid = fork();
27493039 ASSERT_GE(pid, 0);
27503040 if (!pid) {
2751− EXPECT_EQ(recv(cfd, buf, sizeof(buf), MSG_WAITALL),
2752− sizeof(buf));
3041+ EXPECT_EQ(recv(cfd, buf, sizeof(buf) / 2, MSG_WAITALL),
3042+ sizeof(buf) / 2);
27533043 exit(!__test_passed(_metadata));
27543044 }
27553045
2756− usleep(2000);
3046+ usleep(10000);
27573047 ASSERT_EQ(setsockopt(fd, SOL_TLS, TLS_TX, &tls, tls.len), 0);
27583048 ASSERT_EQ(setsockopt(cfd, SOL_TLS, TLS_RX, &tls, tls.len), 0);
27593049
27603050 EXPECT_EQ(send(fd, buf, sizeof(buf), 0), sizeof(buf));
2761− usleep(2000);
3051+ EXPECT_EQ(wait(&status), pid);
3052+ EXPECT_EQ(status, 0);
27623053 EXPECT_EQ(recv(cfd, buf2, sizeof(buf2), MSG_DONTWAIT), -1);
27633054 /* Don't check errno, the error will be different depending
27643055 * on what random bytes TLS interpreted as the record length.
@@ -2766,9 +3057,6 @@ TEST(data_steal) { · 1 unmodified line
27663057
27673058 close(fd);
27683059 close(cfd);
2769−
2770− EXPECT_EQ(wait(&status), pid);
2771− EXPECT_EQ(status, 0);
27723060 }
27733061
27743062 static void __attribute__((constructor)) fips_check(void) {
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/tc-testing/tc-tests/infra/qdiscs.json+198−0
@@ -185,6 +185,204 @@ · 184 unmodified lines
185185 "$IP addr del 10.10.10.10/24 dev $DUMMY || true"
186186 ]
187187 },
188+ {
189+ "id": "34c0",
190+ "name": "Test TBF with HHF Backlog Accounting in gso_skb case against underflow",
191+ "category": [
192+ "qdisc",
193+ "tbf",
194+ "hhf"
195+ ],
196+ "plugins": {
197+ "requires": [
198+ "nsPlugin"
199+ ]
200+ },
201+ "setup": [
202+ "$IP link set dev $DUMMY up || true",
203+ "$IP addr add 10.10.11.10/24 dev $DUMMY || true",
204+ "$TC qdisc add dev $DUMMY root handle 1: tbf rate 8bit burst 100b latency 100ms",
205+ "$TC qdisc replace dev $DUMMY handle 2: parent 1:1 hhf limit 1000",
206+ [
207+ "ping -I $DUMMY -c2 10.10.11.11",
208+ 1
209+ ],
210+ "$TC qdisc change dev $DUMMY handle 2: parent 1:1 hhf limit 1"
211+ ],
212+ "cmdUnderTest": "$TC qdisc del dev $DUMMY handle 2: parent 1:1",
213+ "expExitCode": "0",
214+ "verifyCmd": "$TC -s qdisc show dev $DUMMY",
215+ "matchPattern": "backlog 0b 0p",
216+ "matchCount": "1",
217+ "teardown": [
218+ "$TC qdisc del dev $DUMMY handle 1: root"
219+ ]
220+ },
221+ {
222+ "id": "fd68",
223+ "name": "Test TBF with CODEL Backlog Accounting in gso_skb case against underflow",
224+ "category": [
225+ "qdisc",
226+ "tbf",
227+ "codel"
228+ ],
229+ "plugins": {
230+ "requires": [
231+ "nsPlugin"
232+ ]
233+ },
234+ "setup": [
235+ "$IP link set dev $DUMMY up || true",
236+ "$IP addr add 10.10.11.10/24 dev $DUMMY || true",
237+ "$TC qdisc add dev $DUMMY root handle 1: tbf rate 8bit burst 100b latency 100ms",
238+ "$TC qdisc replace dev $DUMMY handle 2: parent 1:1 codel limit 1000",
239+ [
240+ "ping -I $DUMMY -c2 10.10.11.11",
241+ 1
242+ ],
243+ "$TC qdisc change dev $DUMMY handle 2: parent 1:1 codel limit 1"
244+ ],
245+ "cmdUnderTest": "$TC qdisc del dev $DUMMY handle 2: parent 1:1",
246+ "expExitCode": "0",
247+ "verifyCmd": "$TC -s qdisc show dev $DUMMY",
248+ "matchPattern": "backlog 0b 0p",
249+ "matchCount": "1",
250+ "teardown": [
251+ "$TC qdisc del dev $DUMMY handle 1: root"
252+ ]
253+ },
254+ {
255+ "id": "514e",
256+ "name": "Test TBF with PIE Backlog Accounting in gso_skb case against underflow",
257+ "category": [
258+ "qdisc",
259+ "tbf",
260+ "pie"
261+ ],
262+ "plugins": {
263+ "requires": [
264+ "nsPlugin"
265+ ]
266+ },
267+ "setup": [
268+ "$IP link set dev $DUMMY up || true",
269+ "$IP addr add 10.10.11.10/24 dev $DUMMY || true",
270+ "$TC qdisc add dev $DUMMY root handle 1: tbf rate 8bit burst 100b latency 100ms",
271+ "$TC qdisc replace dev $DUMMY handle 2: parent 1:1 pie limit 1000",
272+ [
273+ "ping -I $DUMMY -c2 10.10.11.11",
274+ 1
275+ ],
276+ "$TC qdisc change dev $DUMMY handle 2: parent 1:1 pie limit 1"
277+ ],
278+ "cmdUnderTest": "$TC qdisc del dev $DUMMY handle 2: parent 1:1",
279+ "expExitCode": "0",
280+ "verifyCmd": "$TC -s qdisc show dev $DUMMY",
281+ "matchPattern": "backlog 0b 0p",
282+ "matchCount": "1",
283+ "teardown": [
284+ "$TC qdisc del dev $DUMMY handle 1: root"
285+ ]
286+ },
287+ {
288+ "id": "6c97",
289+ "name": "Test TBF with FQ Backlog Accounting in gso_skb case against underflow",
290+ "category": [
291+ "qdisc",
292+ "tbf",
293+ "fq"
294+ ],
295+ "plugins": {
296+ "requires": [
297+ "nsPlugin"
298+ ]
299+ },
300+ "setup": [
301+ "$IP link set dev $DUMMY up || true",
302+ "$IP addr add 10.10.11.10/24 dev $DUMMY || true",
303+ "$TC qdisc add dev $DUMMY root handle 1: tbf rate 8bit burst 100b latency 100ms",
304+ "$TC qdisc replace dev $DUMMY handle 2: parent 1:1 fq limit 1000",
305+ [
306+ "ping -I $DUMMY -c2 10.10.11.11",
307+ 1
308+ ],
309+ "$TC qdisc change dev $DUMMY handle 2: parent 1:1 fq limit 1"
310+ ],
311+ "cmdUnderTest": "$TC qdisc del dev $DUMMY handle 2: parent 1:1",
312+ "expExitCode": "0",
313+ "verifyCmd": "$TC -s qdisc show dev $DUMMY",
314+ "matchPattern": "backlog 0b 0p",
315+ "matchCount": "1",
316+ "teardown": [
317+ "$TC qdisc del dev $DUMMY handle 1: root"
318+ ]
319+ },
320+ {
321+ "id": "5d0b",
322+ "name": "Test TBF with FQ_CODEL Backlog Accounting in gso_skb case against underflow",
323+ "category": [
324+ "qdisc",
325+ "tbf",
326+ "fq_codel"
327+ ],
328+ "plugins": {
329+ "requires": [
330+ "nsPlugin"
331+ ]
332+ },
333+ "setup": [
334+ "$IP link set dev $DUMMY up || true",
335+ "$IP addr add 10.10.11.10/24 dev $DUMMY || true",
336+ "$TC qdisc add dev $DUMMY root handle 1: tbf rate 8bit burst 100b latency 100ms",
337+ "$TC qdisc replace dev $DUMMY handle 2: parent 1:1 fq_codel limit 1000",
338+ [
339+ "ping -I $DUMMY -c2 10.10.11.11",
340+ 1
341+ ],
342+ "$TC qdisc change dev $DUMMY handle 2: parent 1:1 fq_codel limit 1"
343+ ],
344+ "cmdUnderTest": "$TC qdisc del dev $DUMMY handle 2: parent 1:1",
345+ "expExitCode": "0",
346+ "verifyCmd": "$TC -s qdisc show dev $DUMMY",
347+ "matchPattern": "backlog 0b 0p",
348+ "matchCount": "1",
349+ "teardown": [
350+ "$TC qdisc del dev $DUMMY handle 1: root"
351+ ]
352+ },
353+ {
354+ "id": "21c3",
355+ "name": "Test TBF with FQ_PIE Backlog Accounting in gso_skb case against underflow",
356+ "category": [
357+ "qdisc",
358+ "tbf",
359+ "fq_pie"
360+ ],
361+ "plugins": {
362+ "requires": [
363+ "nsPlugin"
364+ ]
365+ },
366+ "setup": [
367+ "$IP link set dev $DUMMY up || true",
368+ "$IP addr add 10.10.11.10/24 dev $DUMMY || true",
369+ "$TC qdisc add dev $DUMMY root handle 1: tbf rate 8bit burst 100b latency 100ms",
370+ "$TC qdisc replace dev $DUMMY handle 2: parent 1:1 fq_pie limit 1000",
371+ [
372+ "ping -I $DUMMY -c2 10.10.11.11",
373+ 1
374+ ],
375+ "$TC qdisc change dev $DUMMY handle 2: parent 1:1 fq_pie limit 1"
376+ ],
377+ "cmdUnderTest": "$TC qdisc del dev $DUMMY handle 2: parent 1:1",
378+ "expExitCode": "0",
379+ "verifyCmd": "$TC -s qdisc show dev $DUMMY",
380+ "matchPattern": "backlog 0b 0p",
381+ "matchCount": "1",
382+ "teardown": [
383+ "$TC qdisc del dev $DUMMY handle 1: root"
384+ ]
385+ },
188386 {
189387 "id": "a4bb",
190388 "name": "Test FQ_CODEL with HTB parent - force packet drop with empty queue",
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)"))

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

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

Repository code

Go to file
t