History

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

Cross-merge networking fixes after downstream PR. No conflicts. Adjacent changes: drivers/net/ethernet/stmicro/stmmac/common.h 38cc3c6dcc09 ("net: stmmac: protect updates of 64-bit statistics counters") fd5a6a71313e ("net: stmmac: est: Per Tx-queue error count for HLBF") c5c3e1bfc9e0 ("net: stmmac: Offload queueMaxSDU from tc-taprio") drivers/net/wireless/microchip/wilc1000/netdev.c c9013880284d ("wifi: fill in MODULE_DESCRIPTION()s for wilc1000") 328efda22af8 ("wifi: wilc1000: do not realloc workqueue everytime an interface is added") net/unix/garbage.c 11498715f266 ("af_unix: Remove io_uring code for GC.") 1279f9d9dec2 ("af_unix: Call kfree_skb() for dead unix_(sk)->oob_skb in GC.")

Jakub Kicinski committed 2 years ago

Commit 3be042c2 parents b6b6145 1f719a2427 files · +4973 −3032Browse files

Unified · Split

427 files
  1. Documentation/ABI/testing/sysfs-driver-intel-i915-hwmon +7 −7
  2. Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon +7 −7
  3. Documentation/devicetree/bindings/sound/allwinner,sun4i-a10-spdif.yaml +4 −1
  4. Documentation/usb/gadget-testing.rst +11 −11
  5. MAINTAINERS +7 −9
  6. Makefile +1 −1
  7. arch/arm64/Makefile +1 −1
  8. arch/arm64/include/asm/vdso.h +0 −3
  9. arch/arm64/kernel/Makefile +3 −3
  10. arch/arm64/kernel/vdso32/Makefile +0 −9
  11. arch/loongarch/Kconfig +2 −21
  12. arch/loongarch/include/asm/acpi.h +3 −1
  13. arch/loongarch/kernel/acpi.c +1 −3
  14. arch/loongarch/mm/kasan_init.c +3 −0
  15. arch/loongarch/vdso/Makefile +1 −0
  16. arch/powerpc/kernel/iommu.c +28 −9
  17. arch/riscv/include/uapi/asm/kvm.h +27 −0
  18. arch/riscv/kvm/vcpu_onereg.c +54 −0
  19. arch/riscv/mm/tlbflush.c +1 −1
  20. arch/s390/kvm/priv.c +6 −2
  21. arch/s390/kvm/vsie.c +0 −1
  22. arch/s390/mm/gmap.c +1 −0
  23. arch/x86/include/asm/coco.h +3 −2
  24. arch/x86/include/asm/kvm_host.h +2 −0
  25. arch/x86/kernel/kvm.c +2 −1
  26. arch/x86/kvm/hyperv.c +50 −0
  27. arch/x86/kvm/hyperv.h +3 −0
  28. arch/x86/kvm/x86.c +7 −0
  29. block/blk-core.c +10 −0
  30. block/blk-mq.c +0 −10
  31. crypto/algif_hash.c +3 −2
  32. crypto/cbc.c +3 −0
  33. drivers/android/binder.c +10 −0
  34. drivers/ata/ahci.c +5 −5
  35. drivers/atm/idt77252.c +2 −0
  36. drivers/crypto/ccp/sev-dev.c +8 −2
  37. drivers/dma-buf/heaps/cma_heap.c +3 −4
  38. drivers/dma/at_hdmac.c +21 −11
  39. drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c +6 −4
  40. drivers/dma/fsl-qdma.c +12 −21
  41. drivers/dma/ti/edma.c +10 −0
  42. drivers/dma/ti/k3-udma.c +8 −2
  43. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +21 −11
  44. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +3 −1
  45. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c +1 −1
  46. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +17 −3
  47. drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +4 −4
  48. drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +13 −23
  49. drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +4 −0
  50. drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +12 −0
  51. drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +1 −1
  52. drivers/gpu/drm/amd/amdgpu/cik_ih.c +6 −0
  53. drivers/gpu/drm/amd/amdgpu/cz_ih.c +5 −0
  54. drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0 −2
  55. drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +0 −22
  56. drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +2 −2
  57. drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +2 −2
  58. drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +2 −2
  59. drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +2 −2
  60. drivers/gpu/drm/amd/amdgpu/iceland_ih.c +5 −0
  61. drivers/gpu/drm/amd/amdgpu/ih_v6_0.c +6 −0
  62. drivers/gpu/drm/amd/amdgpu/ih_v6_1.c +7 −0
  63. drivers/gpu/drm/amd/amdgpu/navi10_ih.c +6 −0
  64. drivers/gpu/drm/amd/amdgpu/si_ih.c +6 −0
  65. drivers/gpu/drm/amd/amdgpu/tonga_ih.c +6 −0
  66. drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c +0 −17
  67. drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c +0 −19
  68. drivers/gpu/drm/amd/amdgpu/vega10_ih.c +6 −0
  69. drivers/gpu/drm/amd/amdgpu/vega20_ih.c +6 −0
  70. drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h +7 −7
  71. drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm +1 −1
  72. drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx9.asm +1 −1
  73. drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +3 −1
  74. drivers/gpu/drm/amd/amdkfd/kfd_migrate.c +1 −1
  75. drivers/gpu/drm/amd/amdkfd/kfd_priv.h +7 −2
  76. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 −0
  77. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn35/dcn35_clk_mgr.c +16 −16
  78. drivers/gpu/drm/amd/display/dc/dcn32/dcn32_dio_link_encoder.c +2 −2
  79. drivers/gpu/drm/amd/display/dc/dcn35/dcn35_dio_link_encoder.c +2 −2
  80. drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c +2 −2
  81. drivers/gpu/drm/amd/display/dc/dml/dcn35/dcn35_fpu.c +2 −2
  82. drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c +12 −21
  83. drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c +1 −1
  84. drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c +5 −6
  85. drivers/gpu/drm/amd/display/dc/inc/core_types.h +2 −0
  86. drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c +1 −1
  87. drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 −31
  88. drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +0 −1
  89. drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +2 −8
  90. drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +1 −7
  91. drivers/gpu/drm/nouveau/nouveau_fence.c +18 −6
  92. drivers/gpu/drm/nouveau/nouveau_fence.h +1 −0
  93. drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +1 −1
  94. drivers/gpu/drm/tegra/drm.c +2 −1
  95. drivers/gpu/drm/virtio/virtgpu_drv.c +1 −0
  96. drivers/gpu/drm/xe/abi/guc_actions_abi.h +2 −2
  97. drivers/gpu/drm/xe/abi/guc_actions_slpc_abi.h +2 −2
  98. drivers/gpu/drm/xe/abi/guc_communication_ctb_abi.h +4 −4
  99. drivers/gpu/drm/xe/abi/guc_klvs_abi.h +3 −3
  100. drivers/gpu/drm/xe/abi/guc_messages_abi.h +10 −10
  101. drivers/gpu/drm/xe/xe_exec.c +9 −1
  102. drivers/gpu/drm/xe/xe_gt_mcr.c +2 −2
  103. drivers/gpu/drm/xe/xe_gt_pagefault.c +7 −4
  104. drivers/gpu/drm/xe/xe_guc_pc.c +2 −0
  105. drivers/gpu/drm/xe/xe_hw_fence.c +3 −3
  106. drivers/gpu/drm/xe/xe_lrc.c +7 −7
  107. drivers/gpu/drm/xe/xe_pt.c +16 −16
  108. drivers/gpu/drm/xe/xe_query.c +25 −25
  109. drivers/gpu/drm/xe/xe_sync.h +5 −0
  110. drivers/gpu/drm/xe/xe_vm.c +99 −66
  111. drivers/gpu/drm/xe/xe_vm.h +14 −2
  112. drivers/gpu/drm/xe/xe_vm_types.h +10 −6
  113. drivers/hwmon/gigabyte_waterforce.c +1 −1
  114. drivers/hwmon/pmbus/mp2975.c +16 −0
  115. drivers/input/joystick/xpad.c +2 −0
  116. drivers/input/keyboard/atkbd.c +9 −5
  117. drivers/input/mouse/bcm5974.c +20 −0
  118. drivers/input/serio/i8042-acpipnpio.h +14 −0
  119. drivers/input/touchscreen/goodix.c +2 −1
  120. drivers/iommu/iommu.c +13 −5
  121. drivers/md/dm-core.h +2 −0
  122. drivers/md/dm-crypt.c +2 −36
  123. drivers/md/dm-ioctl.c +2 −1
  124. drivers/md/dm-stats.c +9 −0
  125. drivers/md/dm-table.c +7 −2
  126. drivers/md/dm-verity-target.c +2 −24
  127. drivers/md/dm-verity.h +0 −1
  128. drivers/md/dm-writecache.c +4 −4
  129. drivers/misc/fastrpc.c +1 −1
  130. drivers/misc/open-dice.c +1 −1
  131. drivers/net/ethernet/aquantia/atlantic/aq_ptp.c +2 −2
  132. drivers/net/ethernet/aquantia/atlantic/aq_ring.c +13 −0
  133. drivers/net/ethernet/aquantia/atlantic/aq_ring.h +1 −0
  134. drivers/net/ethernet/engleder/tsnep_main.c +12 −4
  135. drivers/net/ethernet/intel/i40e/i40e_dcb.h +1 −1
  136. drivers/net/ethernet/intel/ice/ice_osdep.h +1 −1
  137. drivers/net/ethernet/intel/ice/ice_type.h +1 −1
  138. drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +15 −16
  139. drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +12 −2
  140. drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c +1 −1
  141. drivers/net/ethernet/netronome/nfp/nfp_net_common.c +1 −0
  142. drivers/net/ethernet/netronome/nfp/nfpcore/nfp6000_pcie.c +4 −2
  143. drivers/net/ethernet/stmicro/stmmac/common.h +41 −16
  144. drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +7 −8
  145. drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c +7 −8
  146. drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c +7 −8
  147. drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +3 −0
  148. drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +56 −1
  149. drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +7 −8
  150. drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +87 −42
  151. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +66 −67
  152. drivers/net/ethernet/ti/cpsw.c +2 −0
  153. drivers/net/ethernet/ti/cpsw_new.c +3 −0
  154. drivers/net/hyperv/netvsc_drv.c +62 −20
  155. drivers/net/netdevsim/dev.c +4 −4
  156. drivers/net/ppp/ppp_async.c +4 −0
  157. drivers/net/wireless/ath/ar5523/ar5523.c +1 −0
  158. drivers/net/wireless/ath/wcn36xx/main.c +1 −0
  159. drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/module.c +1 −0
  160. drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +4 −2
  161. drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/module.c +1 −0
  162. drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/module.c +1 −0
  163. drivers/net/wireless/intel/iwlwifi/fw/api/debug.h +1 −1
  164. drivers/net/wireless/intel/iwlwifi/fw/dbg.c +1 −2
  165. drivers/net/wireless/intel/iwlwifi/iwl-drv.c +1 −0
  166. drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c +1 −4
  167. drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +4 −2
  168. drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c +5 −4
  169. drivers/net/wireless/intersil/p54/p54spi.c +1 −0
  170. drivers/net/wireless/mediatek/mt76/mt7603/main.c +1 −0
  171. drivers/net/wireless/mediatek/mt76/mt7615/main.c +1 −0
  172. drivers/net/wireless/mediatek/mt76/mt7615/mmio.c +1 −0
  173. drivers/net/wireless/mediatek/mt76/mt7615/sdio.c +1 −0
  174. drivers/net/wireless/mediatek/mt76/mt7615/usb.c +1 −0
  175. drivers/net/wireless/mediatek/mt76/mt7615/usb_sdio.c +1 −0
  176. drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +1 −0
  177. drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c +1 −0
  178. drivers/net/wireless/mediatek/mt76/mt76x0/pci.c +1 −0
  179. drivers/net/wireless/mediatek/mt76/mt76x0/usb.c +1 −0
  180. drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c +1 −0
  181. drivers/net/wireless/mediatek/mt76/mt76x02_util.c +1 −0
  182. drivers/net/wireless/mediatek/mt76/mt76x2/eeprom.c +1 −0
  183. drivers/net/wireless/mediatek/mt76/mt76x2/pci.c +1 −0
  184. drivers/net/wireless/mediatek/mt76/mt76x2/usb.c +1 −0
  185. drivers/net/wireless/mediatek/mt76/mt7915/mmio.c +1 −0
  186. drivers/net/wireless/mediatek/mt76/mt7921/main.c +1 −0
  187. drivers/net/wireless/mediatek/mt76/mt7921/pci.c +1 −0
  188. drivers/net/wireless/mediatek/mt76/mt7921/sdio.c +1 −0
  189. drivers/net/wireless/mediatek/mt76/mt7921/usb.c +1 −0
  190. drivers/net/wireless/mediatek/mt76/mt7925/main.c +1 −0
  191. drivers/net/wireless/mediatek/mt76/mt7925/pci.c +1 −0
  192. drivers/net/wireless/mediatek/mt76/mt7925/usb.c +1 −0
  193. drivers/net/wireless/mediatek/mt76/mt792x_core.c +1 −0
  194. drivers/net/wireless/mediatek/mt76/mt792x_usb.c +1 −0
  195. drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +2 −1
  196. drivers/net/wireless/mediatek/mt76/mt7996/mmio.c +1 −0
  197. drivers/net/wireless/mediatek/mt76/sdio.c +1 −0
  198. drivers/net/wireless/mediatek/mt76/usb.c +1 −0
  199. drivers/net/wireless/mediatek/mt76/util.c +1 −0
  200. drivers/net/wireless/microchip/wilc1000/netdev.c +1 −0
  201. drivers/net/wireless/microchip/wilc1000/sdio.c +1 −0
  202. drivers/net/wireless/microchip/wilc1000/spi.c +1 −0
  203. drivers/net/wireless/ti/wl1251/sdio.c +1 −0
  204. drivers/net/wireless/ti/wl1251/spi.c +1 −0
  205. drivers/net/wireless/ti/wl12xx/main.c +1 −0
  206. drivers/net/wireless/ti/wl18xx/main.c +1 −0
  207. drivers/net/wireless/ti/wlcore/main.c +1 −0
  208. drivers/net/wireless/ti/wlcore/sdio.c +1 −0
  209. drivers/net/wireless/ti/wlcore/spi.c +1 −0
  210. drivers/nvme/common/auth.c +1 −0
  211. drivers/nvme/common/keyring.c +1 −0
  212. drivers/nvme/host/apple.c +7 −6
  213. drivers/nvme/host/auth.c +9 −10
  214. drivers/nvme/host/constants.c +5 −5
  215. drivers/nvme/host/core.c +70 −15
  216. drivers/nvme/host/fabrics.c +12 −7
  217. drivers/nvme/host/fabrics.h +5 −3
  218. drivers/nvme/host/fc.c +14 −46
  219. drivers/nvme/host/multipath.c +8 −7
  220. drivers/nvme/host/nvme.h +43 −19
  221. drivers/nvme/host/pci.c +2 −1
  222. drivers/nvme/host/rdma.c +14 −9
  223. drivers/nvme/host/sysfs.c +61 −3
  224. drivers/nvme/host/tcp.c +6 −5
  225. drivers/nvme/target/core.c +3 −2
  226. drivers/nvme/target/discovery.c +1 −1
  227. drivers/nvme/target/fc.c +103 −83
  228. drivers/nvme/target/fcloop.c +4 −3
  229. drivers/nvme/target/loop.c +6 −3
  230. drivers/nvme/target/rdma.c +1 −0
  231. drivers/nvme/target/tcp.c +2 −0
  232. drivers/pci/bus.c +32 −17
  233. drivers/pci/controller/dwc/pcie-qcom.c +1 −1
  234. drivers/pci/pci.c +52 −26
  235. drivers/pci/pci.h +2 −2
  236. drivers/pci/pcie/aspm.c +9 −4
  237. drivers/phy/microchip/lan966x_serdes.c +2 −0
  238. drivers/phy/qualcomm/phy-qcom-qmp-usb.c +28 −2
  239. drivers/phy/renesas/phy-rcar-gen3-usb2.c +0 −4
  240. drivers/phy/ti/phy-omap-usb2.c +2 −2
  241. drivers/pinctrl/pinctrl-amd.c +1 −1
  242. drivers/power/supply/qcom_battmgr.c +49 −60
  243. drivers/s390/net/qeth_l3_main.c +6 −3
  244. drivers/tty/serial/8250/8250_pci1xxxx.c +2 −2
  245. drivers/tty/serial/max310x.c +43 −10
  246. drivers/tty/serial/serial_core.c +1 −1
  247. drivers/usb/chipidea/ci.h +2 −0
  248. drivers/usb/chipidea/core.c +24 −20
  249. drivers/usb/common/ulpi.c +1 −1
  250. drivers/usb/core/hub.c +32 −14
  251. drivers/usb/dwc3/dwc3-pci.c +4 −0
  252. drivers/usb/dwc3/gadget.c +2 −4
  253. drivers/usb/dwc3/host.c +3 −1
  254. drivers/usb/gadget/function/f_mass_storage.c +18 −2
  255. drivers/usb/gadget/function/f_ncm.c +4 −4
  256. drivers/usb/gadget/udc/pch_udc.c +0 −1
  257. drivers/usb/host/xhci-mem.c +7 −7
  258. drivers/usb/host/xhci-plat.c +3 −0
  259. drivers/usb/host/xhci-ring.c +65 −15
  260. drivers/usb/host/xhci.h +1 −0
  261. drivers/usb/serial/cp210x.c +1 −0
  262. drivers/usb/serial/option.c +1 −0
  263. drivers/usb/serial/qcserial.c +2 −0
  264. drivers/usb/typec/tcpm/tcpm.c +3 −3
  265. drivers/usb/typec/ucsi/ucsi.c +2 −0
  266. drivers/usb/typec/ucsi/ucsi_acpi.c +81 −7
  267. fs/bcachefs/fs-ioctl.c +2 −2
  268. fs/bcachefs/mean_and_variance.h +1 −1
  269. fs/bcachefs/thread_with_file.c +1 −1
  270. fs/bcachefs/util.c +3 −2
  271. fs/btrfs/disk-io.c +11 −2
  272. fs/btrfs/ioctl.c +5 −0
  273. fs/btrfs/qgroup.c +14 −0
  274. fs/btrfs/send.c +1 −1
  275. fs/ext4/ext4.h +5 −3
  276. fs/ext4/extents.c +78 −46
  277. fs/ext4/file.c +1 −1
  278. fs/ext4/indirect.c +1 −1
  279. fs/ext4/inode.c +30 −60
  280. fs/ext4/ioctl.c +1 −1
  281. fs/ext4/mballoc.c +78 −62
  282. fs/ext4/mballoc.h +0 −1
  283. fs/ext4/move_extent.c +4 −6
  284. fs/ext4/super.c +1 −1
  285. fs/gfs2/dentry.c +9 −14
  286. fs/gfs2/inode.c +4 −4
  287. fs/nfsd/nfs4state.c +5 −6
  288. fs/smb/client/cifsglob.h +4 −1
  289. fs/smb/client/sess.c +6 −0
  290. fs/smb/client/smb2pdu.c +19 −5
  291. fs/smb/client/transport.c +2 −2
  292. fs/tracefs/event_inode.c +151 −417
  293. fs/tracefs/inode.c +22 −80
  294. fs/tracefs/internal.h +18 −25
  295. fs/xfs/libxfs/xfs_attr.c +3 −3
  296. fs/xfs/libxfs/xfs_rtbitmap.c +0 −14
  297. fs/xfs/libxfs/xfs_rtbitmap.h +0 −16
  298. fs/xfs/libxfs/xfs_sb.c +14 −0
  299. fs/xfs/libxfs/xfs_sb.h +2 −0
  300. fs/xfs/libxfs/xfs_types.h +12 −0
  301. fs/xfs/scrub/rtbitmap.c +1 −0
  302. fs/xfs/scrub/rtsummary.c +1 −0
  303. include/linux/dmaengine.h +2 −1
  304. include/linux/nvme.h +2 −8
  305. include/linux/pci.h +5 −0
  306. include/net/cfg80211.h +4 −0
  307. include/net/netfilter/nf_tables.h +14 −2
  308. include/sound/cs35l56.h +6 −1
  309. include/trace/events/ext4.h +4 −7
  310. include/trace/events/rxrpc.h +5 −3
  311. include/uapi/linux/netfilter/nf_tables.h +2 −0
  312. include/uapi/linux/serial.h +7 −6
  313. init/Kconfig +3 −3
  314. io_uring/io_uring.h +7 −1
  315. io_uring/net.c +36 −14
  316. io_uring/poll.c +28 −21
  317. io_uring/poll.h +9 −0
  318. io_uring/rw.c +9 −1
  319. kernel/trace/ring_buffer.c +1 −1
  320. kernel/trace/trace_osnoise.c +3 −3
  321. net/core/datagram.c +1 −1
  322. net/devlink/core.c +6 −6
  323. net/ipv4/af_inet.c +4 −2
  324. net/ipv4/ip_tunnel_core.c +1 −1
  325. net/mac80211/cfg.c +9 −7
  326. net/mac80211/debugfs_netdev.c +2 −2
  327. net/mac80211/debugfs_netdev.h +0 −5
  328. net/mac80211/iface.c +1 −1
  329. net/mac80211/mlme.c +81 −33
  330. net/mac80211/scan.c +18 −12
  331. net/mac80211/tx.c +4 −3
  332. net/mac80211/wbrf.c +0 −2
  333. net/netfilter/ipset/ip_set_core.c +2 −0
  334. net/netfilter/ipset/ip_set_hash_gen.h +2 −2
  335. net/netfilter/nf_conntrack_netlink.c +8 −4
  336. net/netfilter/nf_tables_api.c +3 −1
  337. net/netfilter/nfnetlink_queue.c +10 −3
  338. net/netfilter/nft_compat.c +12 −5
  339. net/netfilter/nft_ct.c +3 −0
  340. net/netfilter/nft_set_hash.c +7 −1
  341. net/netfilter/nft_set_pipapo.c +66 −62
  342. net/netfilter/nft_set_pipapo.h +13 −5
  343. net/netfilter/nft_set_pipapo_avx2.c +8 −9
  344. net/netfilter/nft_set_rbtree.c +10 −7
  345. net/rxrpc/ar-internal.h +30 −7
  346. net/rxrpc/call_event.c +5 −7
  347. net/rxrpc/call_object.c +1 −0
  348. net/rxrpc/conn_event.c +9 −1
  349. net/rxrpc/input.c +97 −18
  350. net/rxrpc/output.c +4 −4
  351. net/rxrpc/proc.c +1 −1
  352. net/rxrpc/rxkad.c +2 −2
  353. net/tipc/bearer.c +6 −0
  354. net/unix/garbage.c +11 −0
  355. net/wireless/core.c +2 −1
  356. net/wireless/scan.c +58 −1
  357. sound/core/pcm.c +4 −0
  358. sound/pci/hda/cs35l41_hda_property.c +4 −0
  359. sound/pci/hda/cs35l56_hda.c +77 −59
  360. sound/pci/hda/hda_intel.c +4 −2
  361. sound/pci/hda/patch_cs8409.c +1 −0
  362. sound/pci/hda/patch_realtek.c +13 −3
  363. sound/soc/amd/acp/acp-mach-common.c +14 −2
  364. sound/soc/amd/acp/acp-sof-mach.c +4 −0
  365. sound/soc/amd/acp/acp3x-es83xx/acp3x-es83xx.c +8 −0
  366. sound/soc/amd/yc/acp6x-mach.c +7 −0
  367. sound/soc/codecs/cs35l56-shared.c +122 −18
  368. sound/soc/codecs/cs35l56.c +256 −45
  369. sound/soc/codecs/cs35l56.h +2 −0
  370. sound/soc/codecs/es8326.c +139 −47
  371. sound/soc/codecs/es8326.h +2 −1
  372. sound/soc/codecs/lpass-wsa-macro.c +0 −7
  373. sound/soc/codecs/wcd9335.c +0 −4
  374. sound/soc/codecs/wcd934x.c +0 −1
  375. sound/soc/codecs/wcd938x.c +3 −5
  376. sound/soc/codecs/wm_adsp.c +31 −42
  377. sound/soc/codecs/wsa883x.c +5 −1
  378. sound/soc/qcom/sc8280xp.c +7 −5
  379. sound/soc/soc-core.c +4 −1
  380. sound/soc/sunxi/sun4i-spdif.c +5 −0
  381. sound/usb/clock.c +32 −2
  382. sound/usb/format.c +20 −0
  383. sound/usb/midi2.c +1 −1
  384. sound/usb/quirks.c +22 −16
  385. sound/virtio/virtio_card.c +0 −2
  386. sound/virtio/virtio_ctl_msg.c +0 −2
  387. sound/virtio/virtio_pcm_msg.c +0 −2
  388. tools/arch/x86/include/asm/cpufeatures.h +7 −1
  389. tools/arch/x86/include/asm/msr-index.h +8 −0
  390. tools/arch/x86/include/uapi/asm/kvm.h +3 −0
  391. tools/arch/x86/lib/memcpy_64.S +2 −2
  392. tools/arch/x86/lib/memset_64.S +2 −2
  393. tools/include/asm-generic/unaligned.h +12 −12
  394. tools/include/uapi/asm-generic/unistd.h +14 −1
  395. tools/include/uapi/drm/drm.h +71 −1
  396. tools/include/uapi/drm/i915_drm.h +6 −6
  397. tools/include/uapi/linux/fcntl.h +3 −0
  398. tools/include/uapi/linux/kvm.h +50 −90
  399. tools/include/uapi/linux/mount.h +70 −0
  400. tools/include/uapi/linux/stat.h +1 −0
  401. tools/perf/Documentation/perf-list.txt +4 −0
  402. tools/perf/Makefile.perf +10 −0
  403. tools/perf/builtin-list.c +129 −82
  404. tools/perf/builtin-record.c +2 −2
  405. tools/perf/builtin-top.c +1 −1
  406. tools/perf/pmu-events/arch/x86/alderlake/adl-metrics.json +118 −136
  407. tools/perf/pmu-events/arch/x86/alderlaken/adln-metrics.json +0 −4
  408. tools/perf/pmu-events/arch/x86/sapphirerapids/spr-metrics.json +5 −20
  409. tools/perf/tests/shell/daemon.sh +24 −10
  410. tools/perf/tests/shell/list.sh +18 −3
  411. tools/perf/tests/shell/script.sh +9 −3
  412. tools/perf/trace/beauty/statx.c +1 −0
  413. tools/perf/util/evlist.c +8 −1
  414. tools/perf/util/hist.c +2 −2
  415. tools/perf/util/include/linux/linkage.h +4 −0
  416. tools/perf/util/metricgroup.c +1 −1
  417. tools/perf/util/print-events.c +1 −1
  418. tools/perf/util/synthetic-events.c +2 −2
  419. tools/testing/selftests/kvm/riscv/get-reg-list.c +108 −0
  420. tools/testing/selftests/net/big_tcp.sh +3 −1
  421. tools/testing/selftests/net/cmsg_ipv6.sh +2 −2
  422. tools/testing/selftests/net/pmtu.sh +17 −6
  423. tools/testing/selftests/net/rtnetlink.sh +2 −4
  424. tools/testing/selftests/net/tcp_ao/unsigned-md5.c +6 −6
  425. tools/testing/selftests/net/udpgro_fwd.sh +12 −2
  426. tools/testing/selftests/net/udpgso_bench_rx.c +1 −1
  427. tools/testing/selftests/netfilter/conntrack_dump_flush.c +42 −1
Documentation/ABI/testing/sysfs-driver-intel-i915-hwmon+7−7
@@ -1,4 +1,4 @@
1−What: /sys/devices/.../hwmon/hwmon<i>/in0_input
1+What: /sys/bus/pci/drivers/i915/.../hwmon/hwmon<i>/in0_input
22 Date: February 2023
33 KernelVersion: 6.2
44 Contact: intel-gfx@lists.freedesktop.org
@@ -6,7 +6,7 @@ Description: RO. Current Voltage in millivolt. · 1 unmodified line
66
77 Only supported for particular Intel i915 graphics platforms.
88
9−What: /sys/devices/.../hwmon/hwmon<i>/power1_max
9+What: /sys/bus/pci/drivers/i915/.../hwmon/hwmon<i>/power1_max
1010 Date: February 2023
1111 KernelVersion: 6.2
1212 Contact: intel-gfx@lists.freedesktop.org
@@ -20,7 +20,7 @@ Description: RW. Card reactive sustained (PL1/Tau) power limit in microwatts. · 7 unmodified lines
2020
2121 Only supported for particular Intel i915 graphics platforms.
2222
23−What: /sys/devices/.../hwmon/hwmon<i>/power1_rated_max
23+What: /sys/bus/pci/drivers/i915/.../hwmon/hwmon<i>/power1_rated_max
2424 Date: February 2023
2525 KernelVersion: 6.2
2626 Contact: intel-gfx@lists.freedesktop.org
@@ -28,7 +28,7 @@ Description: RO. Card default power limit (default TDP setting). · 1 unmodified line
2828
2929 Only supported for particular Intel i915 graphics platforms.
3030
31−What: /sys/devices/.../hwmon/hwmon<i>/power1_max_interval
31+What: /sys/bus/pci/drivers/i915/.../hwmon/hwmon<i>/power1_max_interval
3232 Date: February 2023
3333 KernelVersion: 6.2
3434 Contact: intel-gfx@lists.freedesktop.org
@@ -37,7 +37,7 @@ Description: RW. Sustained power limit interval (Tau in PL1/Tau) in · 2 unmodified lines
3737
3838 Only supported for particular Intel i915 graphics platforms.
3939
40−What: /sys/devices/.../hwmon/hwmon<i>/power1_crit
40+What: /sys/bus/pci/drivers/i915/.../hwmon/hwmon<i>/power1_crit
4141 Date: February 2023
4242 KernelVersion: 6.2
4343 Contact: intel-gfx@lists.freedesktop.org
@@ -50,7 +50,7 @@ Description: RW. Card reactive critical (I1) power limit in microwatts. · 6 unmodified lines
5050
5151 Only supported for particular Intel i915 graphics platforms.
5252
53−What: /sys/devices/.../hwmon/hwmon<i>/curr1_crit
53+What: /sys/bus/pci/drivers/i915/.../hwmon/hwmon<i>/curr1_crit
5454 Date: February 2023
5555 KernelVersion: 6.2
5656 Contact: intel-gfx@lists.freedesktop.org
@@ -63,7 +63,7 @@ Description: RW. Card reactive critical (I1) power limit in milliamperes. · 6 unmodified lines
6363
6464 Only supported for particular Intel i915 graphics platforms.
6565
66−What: /sys/devices/.../hwmon/hwmon<i>/energy1_input
66+What: /sys/bus/pci/drivers/i915/.../hwmon/hwmon<i>/energy1_input
6767 Date: February 2023
6868 KernelVersion: 6.2
6969 Contact: intel-gfx@lists.freedesktop.org
Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon+7−7
@@ -1,4 +1,4 @@
1−What: /sys/devices/.../hwmon/hwmon<i>/power1_max
1+What: /sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/power1_max
22 Date: September 2023
33 KernelVersion: 6.5
44 Contact: intel-xe@lists.freedesktop.org
@@ -12,7 +12,7 @@ Description: RW. Card reactive sustained (PL1) power limit in microwatts. · 7 unmodified lines
1212
1313 Only supported for particular Intel xe graphics platforms.
1414
15−What: /sys/devices/.../hwmon/hwmon<i>/power1_rated_max
15+What: /sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/power1_rated_max
1616 Date: September 2023
1717 KernelVersion: 6.5
1818 Contact: intel-xe@lists.freedesktop.org
@@ -20,7 +20,7 @@ Description: RO. Card default power limit (default TDP setting). · 1 unmodified line
2020
2121 Only supported for particular Intel xe graphics platforms.
2222
23−What: /sys/devices/.../hwmon/hwmon<i>/power1_crit
23+What: /sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/power1_crit
2424 Date: September 2023
2525 KernelVersion: 6.5
2626 Contact: intel-xe@lists.freedesktop.org
@@ -33,7 +33,7 @@ Description: RW. Card reactive critical (I1) power limit in microwatts. · 6 unmodified lines
3333
3434 Only supported for particular Intel xe graphics platforms.
3535
36−What: /sys/devices/.../hwmon/hwmon<i>/curr1_crit
36+What: /sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/curr1_crit
3737 Date: September 2023
3838 KernelVersion: 6.5
3939 Contact: intel-xe@lists.freedesktop.org
@@ -44,7 +44,7 @@ Description: RW. Card reactive critical (I1) power limit in milliamperes. · 4 unmodified lines
4444 the operating frequency if the power averaged over a window
4545 exceeds this limit.
4646
47−What: /sys/devices/.../hwmon/hwmon<i>/in0_input
47+What: /sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/in0_input
4848 Date: September 2023
4949 KernelVersion: 6.5
5050 Contact: intel-xe@lists.freedesktop.org
@@ -52,7 +52,7 @@ Description: RO. Current Voltage in millivolt. · 1 unmodified line
5252
5353 Only supported for particular Intel xe graphics platforms.
5454
55−What: /sys/devices/.../hwmon/hwmon<i>/energy1_input
55+What: /sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/energy1_input
5656 Date: September 2023
5757 KernelVersion: 6.5
5858 Contact: intel-xe@lists.freedesktop.org
@@ -60,7 +60,7 @@ Description: RO. Energy input of device in microjoules. · 1 unmodified line
6060
6161 Only supported for particular Intel xe graphics platforms.
6262
63−What: /sys/devices/.../hwmon/hwmon<i>/power1_max_interval
63+What: /sys/bus/pci/drivers/xe/.../hwmon/hwmon<i>/power1_max_interval
6464 Date: October 2023
6565 KernelVersion: 6.6
6666 Contact: intel-xe@lists.freedesktop.org
Documentation/devicetree/bindings/sound/allwinner,sun4i-a10-spdif.yaml+4−1
@@ -22,6 +22,7 @@ properties: · 21 unmodified lines
2222 - const: allwinner,sun6i-a31-spdif
2323 - const: allwinner,sun8i-h3-spdif
2424 - const: allwinner,sun50i-h6-spdif
25+ - const: allwinner,sun50i-h616-spdif
2526 - items:
2627 - const: allwinner,sun8i-a83t-spdif
2728 - const: allwinner,sun8i-h3-spdif
@@ -62,6 +63,8 @@ allOf: · 34 unmodified lines
6263 enum:
6364 - allwinner,sun6i-a31-spdif
6465 - allwinner,sun8i-h3-spdif
66+ - allwinner,sun50i-h6-spdif
67+ - allwinner,sun50i-h616-spdif
6568
6669 then:
6770 required:
@@ -73,7 +76,7 @@ allOf: · 5 unmodified lines
7376 contains:
7477 enum:
7578 - allwinner,sun8i-h3-spdif
76− - allwinner,sun50i-h6-spdif
79+ - allwinner,sun50i-h616-spdif
7780
7881 then:
7982 properties:
Documentation/usb/gadget-testing.rst+11−11
@@ -448,17 +448,17 @@ Function-specific configfs interface · 447 unmodified lines
448448 The function name to use when creating the function directory is "ncm".
449449 The NCM function provides these attributes in its function directory:
450450
451− =============== ==================================================
452− ifname network device interface name associated with this
453− function instance
454− qmult queue length multiplier for high and super speed
455− host_addr MAC address of host's end of this
456− Ethernet over USB link
457− dev_addr MAC address of device's end of this
458− Ethernet over USB link
459− max_segment_size Segment size required for P2P connections. This
460− will set MTU to (max_segment_size - 14 bytes)
461− =============== ==================================================
451+ ======================= ==================================================
452+ ifname network device interface name associated with this
453+ function instance
454+ qmult queue length multiplier for high and super speed
455+ host_addr MAC address of host's end of this
456+ Ethernet over USB link
457+ dev_addr MAC address of device's end of this
458+ Ethernet over USB link
459+ max_segment_size Segment size required for P2P connections. This
460+ will set MTU to 14 bytes
461+ ======================= ==================================================
462462
463463 and after creating the functions/ncm.<instance name> they contain default
464464 values: qmult is 5, dev_addr and host_addr are randomly selected.
MAINTAINERS+7−9
@@ -4172,14 +4172,14 @@ F: drivers/firmware/broadcom/tee_bnxt_fw.c · 4171 unmodified lines
41724172 F: drivers/net/ethernet/broadcom/bnxt/
41734173 F: include/linux/firmware/broadcom/tee_bnxt_fw.h
41744174
4175−BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER
4176−M: Arend van Spriel <aspriel@gmail.com>
4177−M: Franky Lin <franky.lin@broadcom.com>
4178−M: Hante Meuleman <hante.meuleman@broadcom.com>
4175+BROADCOM BRCM80211 IEEE802.11 WIRELESS DRIVERS
4176+M: Arend van Spriel <arend.vanspriel@broadcom.com>
41794177 L: linux-wireless@vger.kernel.org
4178+L: brcm80211@lists.linux.dev
41804179 L: brcm80211-dev-list.pdl@broadcom.com
41814180 S: Supported
41824181 F: drivers/net/wireless/broadcom/brcm80211/
4182+F: include/linux/platform_data/brcmfmac.h
41834183
41844184 BROADCOM BRCMSTB GPIO DRIVER
41854185 M: Doug Berger <opendmb@gmail.com>
@@ -10094,7 +10094,7 @@ L: linux-i2c@vger.kernel.org · 5908 unmodified lines
1009410094 S: Maintained
1009510095 W: https://i2c.wiki.kernel.org/
1009610096 Q: https://patchwork.ozlabs.org/project/linux-i2c/list/
10097−T: git git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git
10097+T: git git://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux.git
1009810098 F: Documentation/devicetree/bindings/i2c/
1009910099 F: drivers/i2c/algos/
1010010100 F: drivers/i2c/busses/
@@ -11130,7 +11130,6 @@ S: Supported · 1029 unmodified lines
1113011130 F: drivers/net/wireless/intel/iwlegacy/
1113111131
1113211132 INTEL WIRELESS WIFI LINK (iwlwifi)
11133−M: Gregory Greenman <gregory.greenman@intel.com>
1113411133 M: Miri Korenblit <miriam.rachel.korenblit@intel.com>
1113511134 L: linux-wireless@vger.kernel.org
1113611135 S: Supported
@@ -16866,9 +16865,8 @@ F: Documentation/devicetree/bindings/pci/xilinx-versal-cpm.yaml · 5729 unmodified lines
1686616865 F: drivers/pci/controller/pcie-xilinx-cpm.c
1686716866
1686816867 PCI ENDPOINT SUBSYSTEM
16869−M: Lorenzo Pieralisi <lpieralisi@kernel.org>
16868+M: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
1687016869 M: Krzysztof Wilczyński <kw@linux.com>
16871−R: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
1687216870 R: Kishon Vijay Abraham I <kishon@kernel.org>
1687316871 L: linux-pci@vger.kernel.org
1687416872 S: Supported
@@ -18444,7 +18442,7 @@ S: Supported · 1569 unmodified lines
1844418442 F: drivers/infiniband/sw/rdmavt
1844518443
1844618444 RDS - RELIABLE DATAGRAM SOCKETS
18447−M: Santosh Shilimkar <santosh.shilimkar@oracle.com>
18445+M: Allison Henderson <allison.henderson@oracle.com>
1844818446 L: netdev@vger.kernel.org
1844918447 L: linux-rdma@vger.kernel.org
1845018448 L: rds-devel@oss.oracle.com (moderated for non-subscribers)
Makefile+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 VERSION = 6
33 PATCHLEVEL = 8
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc2
5+EXTRAVERSION = -rc3
66 NAME = Hurr durr I'ma ninja sloth
77
88 # *DOCUMENTATION*
arch/arm64/Makefile+1−1
@@ -195,7 +195,7 @@ vdso_prepare: prepare0 · 194 unmodified lines
195195 include/generated/vdso-offsets.h arch/arm64/kernel/vdso/vdso.so
196196 ifdef CONFIG_COMPAT_VDSO
197197 $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso32 \
198− include/generated/vdso32-offsets.h arch/arm64/kernel/vdso32/vdso.so
198+ arch/arm64/kernel/vdso32/vdso.so
199199 endif
200200 endif
201201
arch/arm64/include/asm/vdso.h+0−3
@@ -17,9 +17,6 @@ · 16 unmodified lines
1717 #ifndef __ASSEMBLY__
1818
1919 #include <generated/vdso-offsets.h>
20−#ifdef CONFIG_COMPAT_VDSO
21−#include <generated/vdso32-offsets.h>
22−#endif
2320
2421 #define VDSO_SYMBOL(base, name) \
2522 ({ \
arch/arm64/kernel/Makefile+3−3
@@ -77,9 +77,9 @@ obj-$(CONFIG_UNWIND_PATCH_PAC_INTO_SCS) += patch-scs.o · 76 unmodified lines
7777 # We need to prevent the SCS patching code from patching itself. Using
7878 # -mbranch-protection=none here to avoid the patchable PAC opcodes from being
7979 # generated triggers an issue with full LTO on Clang, which stops emitting PAC
80−# instructions altogether. So instead, omit the unwind tables used by the
81−# patching code, so it will not be able to locate its own PAC instructions.
82−CFLAGS_patch-scs.o += -fno-asynchronous-unwind-tables -fno-unwind-tables
80+# instructions altogether. So disable LTO as well for the compilation unit.
81+CFLAGS_patch-scs.o += -mbranch-protection=none
82+CFLAGS_REMOVE_patch-scs.o += $(CC_FLAGS_LTO)
8383
8484 # Force dependency (vdso*-wrap.S includes vdso.so through incbin)
8585 $(obj)/vdso-wrap.o: $(obj)/vdso/vdso.so
arch/arm64/kernel/vdso32/Makefile+0−9
@@ -127,9 +127,6 @@ obj-vdso := $(c-obj-vdso) $(c-obj-vdso-gettimeofday) $(asm-obj-vdso) · 126 unmodified lines
127127 targets += vdso.lds
128128 CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
129129
130−include/generated/vdso32-offsets.h: $(obj)/vdso32.so.dbg FORCE
131− $(call if_changed,vdsosym)
132−
133130 # Strip rule for vdso.so
134131 $(obj)/vdso.so: OBJCOPYFLAGS := -S
135132 $(obj)/vdso.so: $(obj)/vdso32.so.dbg FORCE
@@ -166,9 +163,3 @@ quiet_cmd_vdsoas = AS32 $@ · 30 unmodified lines
166163
167164 quiet_cmd_vdsomunge = MUNGE $@
168165 cmd_vdsomunge = $(obj)/$(munge) $< $@
169−
170−# Generate vDSO offsets using helper script (borrowed from the 64-bit vDSO)
171−gen-vdsosym := $(srctree)/$(src)/../vdso/gen_vdso_offsets.sh
172−quiet_cmd_vdsosym = VDSOSYM $@
173−# The AArch64 nm should be able to read an AArch32 binary
174− cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@
arch/loongarch/Kconfig+2−21
@@ -12,6 +12,7 @@ config LOONGARCH · 11 unmodified lines
1212 select ARCH_DISABLE_KASAN_INLINE
1313 select ARCH_ENABLE_MEMORY_HOTPLUG
1414 select ARCH_ENABLE_MEMORY_HOTREMOVE
15+ select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE
1516 select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI
1617 select ARCH_HAS_CPU_FINALIZE_INIT
1718 select ARCH_HAS_FORTIFY_SOURCE
@@ -99,6 +100,7 @@ config LOONGARCH · 81 unmodified lines
99100 select HAVE_ARCH_KFENCE
100101 select HAVE_ARCH_KGDB if PERF_EVENTS
101102 select HAVE_ARCH_MMAP_RND_BITS if MMU
103+ select HAVE_ARCH_SECCOMP
102104 select HAVE_ARCH_SECCOMP_FILTER
103105 select HAVE_ARCH_TRACEHOOK
104106 select HAVE_ARCH_TRANSPARENT_HUGEPAGE
@@ -632,23 +634,6 @@ config RANDOMIZE_BASE_MAX_OFFSET · 527 unmodified lines
632634
633635 This is limited by the size of the lower address memory, 256MB.
634636
635−config SECCOMP
636− bool "Enable seccomp to safely compute untrusted bytecode"
637− depends on PROC_FS
638− default y
639− help
640− This kernel feature is useful for number crunching applications
641− that may need to compute untrusted bytecode during their
642− execution. By using pipes or other transports made available to
643− the process as file descriptors supporting the read/write
644− syscalls, it's possible to isolate those applications in
645− their own address space using seccomp. Once seccomp is
646− enabled via /proc/<pid>/seccomp, it cannot be disabled
647− and the task is only allowed to execute a few safe syscalls
648− defined by each seccomp mode.
649−
650− If unsure, say Y. Only embedded should say N here.
651−
652637 endmenu
653638
654639 config ARCH_SELECT_MEMORY_MODEL
@@ -667,10 +652,6 @@ config ARCH_SPARSEMEM_ENABLE · 12 unmodified lines
667652 or have huge holes in the physical address space for other reasons.
668653 See <file:Documentation/mm/numa.rst> for more.
669654
670−config ARCH_ENABLE_THP_MIGRATION
671− def_bool y
672− depends on TRANSPARENT_HUGEPAGE
673−
674655 config ARCH_MEMORY_PROBE
675656 def_bool y
676657 depends on MEMORY_HOTPLUG
arch/loongarch/include/asm/acpi.h+3−1
@@ -32,8 +32,10 @@ static inline bool acpi_has_cpu_in_madt(void) · 31 unmodified lines
3232 return true;
3333 }
3434
35+#define MAX_CORE_PIC 256
36+
3537 extern struct list_head acpi_wakeup_device_list;
36−extern struct acpi_madt_core_pic acpi_core_pic[NR_CPUS];
38+extern struct acpi_madt_core_pic acpi_core_pic[MAX_CORE_PIC];
3739
3840 extern int __init parse_acpi_topology(void);
3941
arch/loongarch/kernel/acpi.c+1−3
@@ -29,11 +29,9 @@ int disabled_cpus; · 28 unmodified lines
2929
3030 u64 acpi_saved_sp;
3131
32−#define MAX_CORE_PIC 256
33−
3432 #define PREFIX "ACPI: "
3533
36−struct acpi_madt_core_pic acpi_core_pic[NR_CPUS];
34+struct acpi_madt_core_pic acpi_core_pic[MAX_CORE_PIC];
3735
3836 void __init __iomem * __acpi_map_table(unsigned long phys, unsigned long size)
3937 {
arch/loongarch/mm/kasan_init.c+3−0
@@ -44,6 +44,9 @@ void *kasan_mem_to_shadow(const void *addr) · 43 unmodified lines
4444 unsigned long xrange = (maddr >> XRANGE_SHIFT) & 0xffff;
4545 unsigned long offset = 0;
4646
47+ if (maddr >= FIXADDR_START)
48+ return (void *)(kasan_early_shadow_page);
49+
4750 maddr &= XRANGE_SHADOW_MASK;
4851 switch (xrange) {
4952 case XKPRANGE_CC_SEG:
arch/loongarch/vdso/Makefile+1−0
@@ -2,6 +2,7 @@ · 1 unmodified line
22 # Objects to go into the VDSO.
33
44 KASAN_SANITIZE := n
5+UBSAN_SANITIZE := n
56 KCOV_INSTRUMENT := n
67
78 # Include the generic Makefile to check the built vdso.
arch/powerpc/kernel/iommu.c+28−9
@@ -1287,20 +1287,20 @@ spapr_tce_platform_iommu_attach_dev(struct iommu_domain *platform_domain, · 1286 unmodified lines
12871287 struct iommu_domain *domain = iommu_get_domain_for_dev(dev);
12881288 struct iommu_group *grp = iommu_group_get(dev);
12891289 struct iommu_table_group *table_group;
1290− int ret = -EINVAL;
12911290
12921291 /* At first attach the ownership is already set */
12931292 if (!domain)
12941293 return 0;
12951294
1296− if (!grp)
1297− return -ENODEV;
1298−
12991295 table_group = iommu_group_get_iommudata(grp);
1300− ret = table_group->ops->take_ownership(table_group);
1296+ /*
1297+ * The domain being set to PLATFORM from earlier
1298+ * BLOCKED. The table_group ownership has to be released.
1299+ */
1300+ table_group->ops->release_ownership(table_group);
13011301 iommu_group_put(grp);
13021302
1303− return ret;
1303+ return 0;
13041304 }
13051305
13061306 static const struct iommu_domain_ops spapr_tce_platform_domain_ops = {
@@ -1312,13 +1312,32 @@ static struct iommu_domain spapr_tce_platform_domain = { · 5 unmodified lines
13121312 .ops = &spapr_tce_platform_domain_ops,
13131313 };
13141314
1315−static struct iommu_domain spapr_tce_blocked_domain = {
1316− .type = IOMMU_DOMAIN_BLOCKED,
1315+static int
1316+spapr_tce_blocked_iommu_attach_dev(struct iommu_domain *platform_domain,
1317+ struct device *dev)
1318+{
1319+ struct iommu_group *grp = iommu_group_get(dev);
1320+ struct iommu_table_group *table_group;
1321+ int ret = -EINVAL;
1322+
13171323 /*
13181324 * FIXME: SPAPR mixes blocked and platform behaviors, the blocked domain
13191325 * also sets the dma_api ops
13201326 */
1321− .ops = &spapr_tce_platform_domain_ops,
1327+ table_group = iommu_group_get_iommudata(grp);
1328+ ret = table_group->ops->take_ownership(table_group);
1329+ iommu_group_put(grp);
1330+
1331+ return ret;
1332+}
1333+
1334+static const struct iommu_domain_ops spapr_tce_blocked_domain_ops = {
1335+ .attach_dev = spapr_tce_blocked_iommu_attach_dev,
1336+};
1337+
1338+static struct iommu_domain spapr_tce_blocked_domain = {
1339+ .type = IOMMU_DOMAIN_BLOCKED,
1340+ .ops = &spapr_tce_blocked_domain_ops,
13221341 };
13231342
13241343 static bool spapr_tce_iommu_capable(struct device *dev, enum iommu_cap cap)
arch/riscv/include/uapi/asm/kvm.h+27−0
@@ -139,6 +139,33 @@ enum KVM_RISCV_ISA_EXT_ID { · 138 unmodified lines
139139 KVM_RISCV_ISA_EXT_ZIHPM,
140140 KVM_RISCV_ISA_EXT_SMSTATEEN,
141141 KVM_RISCV_ISA_EXT_ZICOND,
142+ KVM_RISCV_ISA_EXT_ZBC,
143+ KVM_RISCV_ISA_EXT_ZBKB,
144+ KVM_RISCV_ISA_EXT_ZBKC,
145+ KVM_RISCV_ISA_EXT_ZBKX,
146+ KVM_RISCV_ISA_EXT_ZKND,
147+ KVM_RISCV_ISA_EXT_ZKNE,
148+ KVM_RISCV_ISA_EXT_ZKNH,
149+ KVM_RISCV_ISA_EXT_ZKR,
150+ KVM_RISCV_ISA_EXT_ZKSED,
151+ KVM_RISCV_ISA_EXT_ZKSH,
152+ KVM_RISCV_ISA_EXT_ZKT,
153+ KVM_RISCV_ISA_EXT_ZVBB,
154+ KVM_RISCV_ISA_EXT_ZVBC,
155+ KVM_RISCV_ISA_EXT_ZVKB,
156+ KVM_RISCV_ISA_EXT_ZVKG,
157+ KVM_RISCV_ISA_EXT_ZVKNED,
158+ KVM_RISCV_ISA_EXT_ZVKNHA,
159+ KVM_RISCV_ISA_EXT_ZVKNHB,
160+ KVM_RISCV_ISA_EXT_ZVKSED,
161+ KVM_RISCV_ISA_EXT_ZVKSH,
162+ KVM_RISCV_ISA_EXT_ZVKT,
163+ KVM_RISCV_ISA_EXT_ZFH,
164+ KVM_RISCV_ISA_EXT_ZFHMIN,
165+ KVM_RISCV_ISA_EXT_ZIHINTNTL,
166+ KVM_RISCV_ISA_EXT_ZVFH,
167+ KVM_RISCV_ISA_EXT_ZVFHMIN,
168+ KVM_RISCV_ISA_EXT_ZFA,
142169 KVM_RISCV_ISA_EXT_MAX,
143170 };
144171
arch/riscv/kvm/vcpu_onereg.c+54−0
@@ -42,15 +42,42 @@ static const unsigned long kvm_isa_ext_arr[] = { · 41 unmodified lines
4242 KVM_ISA_EXT_ARR(SVPBMT),
4343 KVM_ISA_EXT_ARR(ZBA),
4444 KVM_ISA_EXT_ARR(ZBB),
45+ KVM_ISA_EXT_ARR(ZBC),
46+ KVM_ISA_EXT_ARR(ZBKB),
47+ KVM_ISA_EXT_ARR(ZBKC),
48+ KVM_ISA_EXT_ARR(ZBKX),
4549 KVM_ISA_EXT_ARR(ZBS),
50+ KVM_ISA_EXT_ARR(ZFA),
51+ KVM_ISA_EXT_ARR(ZFH),
52+ KVM_ISA_EXT_ARR(ZFHMIN),
4653 KVM_ISA_EXT_ARR(ZICBOM),
4754 KVM_ISA_EXT_ARR(ZICBOZ),
4855 KVM_ISA_EXT_ARR(ZICNTR),
4956 KVM_ISA_EXT_ARR(ZICOND),
5057 KVM_ISA_EXT_ARR(ZICSR),
5158 KVM_ISA_EXT_ARR(ZIFENCEI),
59+ KVM_ISA_EXT_ARR(ZIHINTNTL),
5260 KVM_ISA_EXT_ARR(ZIHINTPAUSE),
5361 KVM_ISA_EXT_ARR(ZIHPM),
62+ KVM_ISA_EXT_ARR(ZKND),
63+ KVM_ISA_EXT_ARR(ZKNE),
64+ KVM_ISA_EXT_ARR(ZKNH),
65+ KVM_ISA_EXT_ARR(ZKR),
66+ KVM_ISA_EXT_ARR(ZKSED),
67+ KVM_ISA_EXT_ARR(ZKSH),
68+ KVM_ISA_EXT_ARR(ZKT),
69+ KVM_ISA_EXT_ARR(ZVBB),
70+ KVM_ISA_EXT_ARR(ZVBC),
71+ KVM_ISA_EXT_ARR(ZVFH),
72+ KVM_ISA_EXT_ARR(ZVFHMIN),
73+ KVM_ISA_EXT_ARR(ZVKB),
74+ KVM_ISA_EXT_ARR(ZVKG),
75+ KVM_ISA_EXT_ARR(ZVKNED),
76+ KVM_ISA_EXT_ARR(ZVKNHA),
77+ KVM_ISA_EXT_ARR(ZVKNHB),
78+ KVM_ISA_EXT_ARR(ZVKSED),
79+ KVM_ISA_EXT_ARR(ZVKSH),
80+ KVM_ISA_EXT_ARR(ZVKT),
5481 };
5582
5683 static unsigned long kvm_riscv_vcpu_base2isa_ext(unsigned long base_ext)
@@ -92,13 +119,40 @@ static bool kvm_riscv_vcpu_isa_disable_allowed(unsigned long ext) · 35 unmodified lines
92119 case KVM_RISCV_ISA_EXT_SVNAPOT:
93120 case KVM_RISCV_ISA_EXT_ZBA:
94121 case KVM_RISCV_ISA_EXT_ZBB:
122+ case KVM_RISCV_ISA_EXT_ZBC:
123+ case KVM_RISCV_ISA_EXT_ZBKB:
124+ case KVM_RISCV_ISA_EXT_ZBKC:
125+ case KVM_RISCV_ISA_EXT_ZBKX:
95126 case KVM_RISCV_ISA_EXT_ZBS:
127+ case KVM_RISCV_ISA_EXT_ZFA:
128+ case KVM_RISCV_ISA_EXT_ZFH:
129+ case KVM_RISCV_ISA_EXT_ZFHMIN:
96130 case KVM_RISCV_ISA_EXT_ZICNTR:
97131 case KVM_RISCV_ISA_EXT_ZICOND:
98132 case KVM_RISCV_ISA_EXT_ZICSR:
99133 case KVM_RISCV_ISA_EXT_ZIFENCEI:
134+ case KVM_RISCV_ISA_EXT_ZIHINTNTL:
100135 case KVM_RISCV_ISA_EXT_ZIHINTPAUSE:
101136 case KVM_RISCV_ISA_EXT_ZIHPM:
137+ case KVM_RISCV_ISA_EXT_ZKND:
138+ case KVM_RISCV_ISA_EXT_ZKNE:
139+ case KVM_RISCV_ISA_EXT_ZKNH:
140+ case KVM_RISCV_ISA_EXT_ZKR:
141+ case KVM_RISCV_ISA_EXT_ZKSED:
142+ case KVM_RISCV_ISA_EXT_ZKSH:
143+ case KVM_RISCV_ISA_EXT_ZKT:
144+ case KVM_RISCV_ISA_EXT_ZVBB:
145+ case KVM_RISCV_ISA_EXT_ZVBC:
146+ case KVM_RISCV_ISA_EXT_ZVFH:
147+ case KVM_RISCV_ISA_EXT_ZVFHMIN:
148+ case KVM_RISCV_ISA_EXT_ZVKB:
149+ case KVM_RISCV_ISA_EXT_ZVKG:
150+ case KVM_RISCV_ISA_EXT_ZVKNED:
151+ case KVM_RISCV_ISA_EXT_ZVKNHA:
152+ case KVM_RISCV_ISA_EXT_ZVKNHB:
153+ case KVM_RISCV_ISA_EXT_ZVKSED:
154+ case KVM_RISCV_ISA_EXT_ZVKSH:
155+ case KVM_RISCV_ISA_EXT_ZVKT:
102156 return false;
103157 /* Extensions which can be disabled using Smstateen */
104158 case KVM_RISCV_ISA_EXT_SSAIA:
arch/riscv/mm/tlbflush.c+1−1
@@ -68,7 +68,7 @@ static inline void local_flush_tlb_range_asid(unsigned long start, · 67 unmodified lines
6868
6969 void local_flush_tlb_kernel_range(unsigned long start, unsigned long end)
7070 {
71− local_flush_tlb_range_asid(start, end, PAGE_SIZE, FLUSH_TLB_NO_ASID);
71+ local_flush_tlb_range_asid(start, end - start, PAGE_SIZE, FLUSH_TLB_NO_ASID);
7272 }
7373
7474 static void __ipi_flush_tlb_all(void *info)
arch/s390/kvm/priv.c+6−2
@@ -676,8 +676,12 @@ static int handle_pqap(struct kvm_vcpu *vcpu) · 675 unmodified lines
676676 if (vcpu->kvm->arch.crypto.pqap_hook) {
677677 pqap_hook = *vcpu->kvm->arch.crypto.pqap_hook;
678678 ret = pqap_hook(vcpu);
679− if (!ret && vcpu->run->s.regs.gprs[1] & 0x00ff0000)
680− kvm_s390_set_psw_cc(vcpu, 3);
679+ if (!ret) {
680+ if (vcpu->run->s.regs.gprs[1] & 0x00ff0000)
681+ kvm_s390_set_psw_cc(vcpu, 3);
682+ else
683+ kvm_s390_set_psw_cc(vcpu, 0);
684+ }
681685 up_read(&vcpu->kvm->arch.crypto.pqap_hook_rwsem);
682686 return ret;
683687 }
arch/s390/kvm/vsie.c+0−1
@@ -1235,7 +1235,6 @@ static int acquire_gmap_shadow(struct kvm_vcpu *vcpu, · 1234 unmodified lines
12351235 gmap = gmap_shadow(vcpu->arch.gmap, asce, edat);
12361236 if (IS_ERR(gmap))
12371237 return PTR_ERR(gmap);
1238− gmap->private = vcpu->kvm;
12391238 vcpu->kvm->stat.gmap_shadow_create++;
12401239 WRITE_ONCE(vsie_page->gmap, gmap);
12411240 return 0;
arch/s390/mm/gmap.c+1−0
@@ -1691,6 +1691,7 @@ struct gmap *gmap_shadow(struct gmap *parent, unsigned long asce, · 1690 unmodified lines
16911691 return ERR_PTR(-ENOMEM);
16921692 new->mm = parent->mm;
16931693 new->parent = gmap_get(parent);
1694+ new->private = parent->private;
16941695 new->orig_asce = asce;
16951696 new->edat_level = edat_level;
16961697 new->initialized = false;
arch/x86/include/asm/coco.h+3−2
@@ -10,13 +10,14 @@ enum cc_vendor { · 9 unmodified lines
1010 CC_VENDOR_INTEL,
1111 };
1212
13−extern enum cc_vendor cc_vendor;
14−
1513 #ifdef CONFIG_ARCH_HAS_CC_PLATFORM
14+extern enum cc_vendor cc_vendor;
1615 void cc_set_mask(u64 mask);
1716 u64 cc_mkenc(u64 val);
1817 u64 cc_mkdec(u64 val);
1918 #else
19+#define cc_vendor (CC_VENDOR_NONE)
20+
2021 static inline u64 cc_mkenc(u64 val)
2122 {
2223 return val;
arch/x86/include/asm/kvm_host.h+2−0
@@ -1145,6 +1145,8 @@ struct kvm_hv { · 1144 unmodified lines
11451145 unsigned int synic_auto_eoi_used;
11461146
11471147 struct kvm_hv_syndbg hv_syndbg;
1148+
1149+ bool xsaves_xsavec_checked;
11481150 };
11491151 #endif
11501152
arch/x86/kernel/kvm.c+2−1
@@ -434,7 +434,8 @@ static void __init sev_map_percpu_data(void) · 433 unmodified lines
434434 {
435435 int cpu;
436436
437− if (!cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT))
437+ if (cc_vendor != CC_VENDOR_AMD ||
438+ !cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT))
438439 return;
439440
440441 for_each_possible_cpu(cpu) {
arch/x86/kvm/hyperv.c+50−0
@@ -1322,6 +1322,56 @@ static bool hv_check_msr_access(struct kvm_vcpu_hv *hv_vcpu, u32 msr) · 1321 unmodified lines
13221322 return false;
13231323 }
13241324
1325+#define KVM_HV_WIN2016_GUEST_ID 0x1040a00003839
1326+#define KVM_HV_WIN2016_GUEST_ID_MASK (~GENMASK_ULL(23, 16)) /* mask out the service version */
1327+
1328+/*
1329+ * Hyper-V enabled Windows Server 2016 SMP VMs fail to boot in !XSAVES && XSAVEC
1330+ * configuration.
1331+ * Such configuration can result from, for example, AMD Erratum 1386 workaround.
1332+ *
1333+ * Print a notice so users aren't left wondering what's suddenly gone wrong.
1334+ */
1335+static void __kvm_hv_xsaves_xsavec_maybe_warn(struct kvm_vcpu *vcpu)
1336+{
1337+ struct kvm *kvm = vcpu->kvm;
1338+ struct kvm_hv *hv = to_kvm_hv(kvm);
1339+
1340+ /* Check again under the hv_lock. */
1341+ if (hv->xsaves_xsavec_checked)
1342+ return;
1343+
1344+ if ((hv->hv_guest_os_id & KVM_HV_WIN2016_GUEST_ID_MASK) !=
1345+ KVM_HV_WIN2016_GUEST_ID)
1346+ return;
1347+
1348+ hv->xsaves_xsavec_checked = true;
1349+
1350+ /* UP configurations aren't affected */
1351+ if (atomic_read(&kvm->online_vcpus) < 2)
1352+ return;
1353+
1354+ if (guest_cpuid_has(vcpu, X86_FEATURE_XSAVES) ||
1355+ !guest_cpuid_has(vcpu, X86_FEATURE_XSAVEC))
1356+ return;
1357+
1358+ pr_notice_ratelimited("Booting SMP Windows KVM VM with !XSAVES && XSAVEC. "
1359+ "If it fails to boot try disabling XSAVEC in the VM config.\n");
1360+}
1361+
1362+void kvm_hv_xsaves_xsavec_maybe_warn(struct kvm_vcpu *vcpu)
1363+{
1364+ struct kvm_hv *hv = to_kvm_hv(vcpu->kvm);
1365+
1366+ if (!vcpu->arch.hyperv_enabled ||
1367+ hv->xsaves_xsavec_checked)
1368+ return;
1369+
1370+ mutex_lock(&hv->hv_lock);
1371+ __kvm_hv_xsaves_xsavec_maybe_warn(vcpu);
1372+ mutex_unlock(&hv->hv_lock);
1373+}
1374+
13251375 static int kvm_hv_set_msr_pw(struct kvm_vcpu *vcpu, u32 msr, u64 data,
13261376 bool host)
13271377 {
arch/x86/kvm/hyperv.h+3−0
@@ -182,6 +182,8 @@ void kvm_hv_setup_tsc_page(struct kvm *kvm, · 181 unmodified lines
182182 struct pvclock_vcpu_time_info *hv_clock);
183183 void kvm_hv_request_tsc_page_update(struct kvm *kvm);
184184
185+void kvm_hv_xsaves_xsavec_maybe_warn(struct kvm_vcpu *vcpu);
186+
185187 void kvm_hv_init_vm(struct kvm *kvm);
186188 void kvm_hv_destroy_vm(struct kvm *kvm);
187189 int kvm_hv_vcpu_init(struct kvm_vcpu *vcpu);
@@ -267,6 +269,7 @@ int kvm_hv_vcpu_flush_tlb(struct kvm_vcpu *vcpu); · 79 unmodified lines
267269 static inline void kvm_hv_setup_tsc_page(struct kvm *kvm,
268270 struct pvclock_vcpu_time_info *hv_clock) {}
269271 static inline void kvm_hv_request_tsc_page_update(struct kvm *kvm) {}
272+static inline void kvm_hv_xsaves_xsavec_maybe_warn(struct kvm_vcpu *vcpu) {}
270273 static inline void kvm_hv_init_vm(struct kvm *kvm) {}
271274 static inline void kvm_hv_destroy_vm(struct kvm *kvm) {}
272275 static inline int kvm_hv_vcpu_init(struct kvm_vcpu *vcpu)
arch/x86/kvm/x86.c+7−0
@@ -1782,6 +1782,10 @@ static int set_efer(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · 1781 unmodified lines
17821782 if ((efer ^ old_efer) & KVM_MMU_EFER_ROLE_BITS)
17831783 kvm_mmu_reset_context(vcpu);
17841784
1785+ if (!static_cpu_has(X86_FEATURE_XSAVES) &&
1786+ (efer & EFER_SVME))
1787+ kvm_hv_xsaves_xsavec_maybe_warn(vcpu);
1788+
17851789 return 0;
17861790 }
17871791
@@ -7016,6 +7020,9 @@ set_identity_unlock: · 5228 unmodified lines
70167020 r = -EEXIST;
70177021 if (kvm->arch.vpit)
70187022 goto create_pit_unlock;
7023+ r = -ENOENT;
7024+ if (!pic_in_kernel(kvm))
7025+ goto create_pit_unlock;
70197026 r = -ENOMEM;
70207027 kvm->arch.vpit = kvm_create_pit(kvm, u.pit_config.flags);
70217028 if (kvm->arch.vpit)
block/blk-core.c+10−0
@@ -49,6 +49,7 @@ · 48 unmodified lines
4949 #include "blk-pm.h"
5050 #include "blk-cgroup.h"
5151 #include "blk-throttle.h"
52+#include "blk-ioprio.h"
5253
5354 struct dentry *blk_debugfs_root;
5455
@@ -833,6 +834,14 @@ end_io: · 778 unmodified lines
833834 }
834835 EXPORT_SYMBOL(submit_bio_noacct);
835836
837+static void bio_set_ioprio(struct bio *bio)
838+{
839+ /* Nobody set ioprio so far? Initialize it based on task's nice value */
840+ if (IOPRIO_PRIO_CLASS(bio->bi_ioprio) == IOPRIO_CLASS_NONE)
841+ bio->bi_ioprio = get_current_ioprio();
842+ blkcg_set_ioprio(bio);
843+}
844+
836845 /**
837846 * submit_bio - submit a bio to the block device layer for I/O
838847 * @bio: The &struct bio which describes the I/O
@@ -855,6 +864,7 @@ void submit_bio(struct bio *bio) · 16 unmodified lines
855864 count_vm_events(PGPGOUT, bio_sectors(bio));
856865 }
857866
867+ bio_set_ioprio(bio);
858868 submit_bio_noacct(bio);
859869 }
860870 EXPORT_SYMBOL(submit_bio);
block/blk-mq.c+0−10
@@ -40,7 +40,6 @@ · 39 unmodified lines
4040 #include "blk-stat.h"
4141 #include "blk-mq-sched.h"
4242 #include "blk-rq-qos.h"
43−#include "blk-ioprio.h"
4443
4544 static DEFINE_PER_CPU(struct llist_head, blk_cpu_done);
4645 static DEFINE_PER_CPU(call_single_data_t, blk_cpu_csd);
@@ -2944,14 +2943,6 @@ static bool blk_mq_use_cached_rq(struct request *rq, struct blk_plug *plug, · 2897 unmodified lines
29442943 return true;
29452944 }
29462945
2947−static void bio_set_ioprio(struct bio *bio)
2948−{
2949− /* Nobody set ioprio so far? Initialize it based on task's nice value */
2950− if (IOPRIO_PRIO_CLASS(bio->bi_ioprio) == IOPRIO_CLASS_NONE)
2951− bio->bi_ioprio = get_current_ioprio();
2952− blkcg_set_ioprio(bio);
2953−}
2954−
29552946 /**
29562947 * blk_mq_submit_bio - Create and send a request to block device.
29572948 * @bio: Bio pointer.
@@ -2976,7 +2967,6 @@ void blk_mq_submit_bio(struct bio *bio) · 18 unmodified lines
29762967 blk_status_t ret;
29772968
29782969 bio = blk_queue_bounce(bio, q);
2979− bio_set_ioprio(bio);
29802970
29812971 if (plug) {
29822972 rq = rq_list_peek(&plug->cached_rq);
crypto/algif_hash.c+3−2
@@ -91,13 +91,13 @@ static int hash_sendmsg(struct socket *sock, struct msghdr *msg, · 90 unmodified lines
9191 if (!(msg->msg_flags & MSG_MORE)) {
9292 err = hash_alloc_result(sk, ctx);
9393 if (err)
94− goto unlock_free;
94+ goto unlock_free_result;
9595 ahash_request_set_crypt(&ctx->req, NULL,
9696 ctx->result, 0);
9797 err = crypto_wait_req(crypto_ahash_final(&ctx->req),
9898 &ctx->wait);
9999 if (err)
100− goto unlock_free;
100+ goto unlock_free_result;
101101 }
102102 goto done_more;
103103 }
@@ -170,6 +170,7 @@ unlock: · 66 unmodified lines
170170
171171 unlock_free:
172172 af_alg_free_sg(&ctx->sgl);
173+unlock_free_result:
173174 hash_free_result(sk, ctx);
174175 ctx->more = false;
175176 goto unlock;
crypto/cbc.c+3−0
@@ -148,6 +148,9 @@ static int crypto_cbc_create(struct crypto_template *tmpl, struct rtattr **tb) · 147 unmodified lines
148148 if (!is_power_of_2(inst->alg.co.base.cra_blocksize))
149149 goto out_free_inst;
150150
151+ if (inst->alg.co.statesize)
152+ goto out_free_inst;
153+
151154 inst->alg.encrypt = crypto_cbc_encrypt;
152155 inst->alg.decrypt = crypto_cbc_decrypt;
153156
drivers/android/binder.c+10−0
@@ -478,6 +478,16 @@ binder_enqueue_thread_work_ilocked(struct binder_thread *thread, · 477 unmodified lines
478478 {
479479 WARN_ON(!list_empty(&thread->waiting_thread_node));
480480 binder_enqueue_work_ilocked(work, &thread->todo);
481+
482+ /* (e)poll-based threads require an explicit wakeup signal when
483+ * queuing their own work; they rely on these events to consume
484+ * messages without I/O block. Without it, threads risk waiting
485+ * indefinitely without handling the work.
486+ */
487+ if (thread->looper & BINDER_LOOPER_STATE_POLL &&
488+ thread->pid == current->pid && !thread->process_todo)
489+ wake_up_interruptible_sync(&thread->wait);
490+
481491 thread->process_todo = true;
482492 }
483493
drivers/ata/ahci.c+5−5
@@ -606,13 +606,13 @@ static const struct pci_device_id ahci_pci_tbl[] = { · 605 unmodified lines
606606 { PCI_VDEVICE(PROMISE, 0x3781), board_ahci }, /* FastTrak TX8660 ahci-mode */
607607
608608 /* ASMedia */
609− { PCI_VDEVICE(ASMEDIA, 0x0601), board_ahci }, /* ASM1060 */
610− { PCI_VDEVICE(ASMEDIA, 0x0602), board_ahci }, /* ASM1060 */
609+ { PCI_VDEVICE(ASMEDIA, 0x0601), board_ahci_43bit_dma }, /* ASM1060 */
610+ { PCI_VDEVICE(ASMEDIA, 0x0602), board_ahci_43bit_dma }, /* ASM1060 */
611611 { PCI_VDEVICE(ASMEDIA, 0x0611), board_ahci_43bit_dma }, /* ASM1061 */
612612 { PCI_VDEVICE(ASMEDIA, 0x0612), board_ahci_43bit_dma }, /* ASM1061/1062 */
613− { PCI_VDEVICE(ASMEDIA, 0x0621), board_ahci }, /* ASM1061R */
614− { PCI_VDEVICE(ASMEDIA, 0x0622), board_ahci }, /* ASM1062R */
615− { PCI_VDEVICE(ASMEDIA, 0x0624), board_ahci }, /* ASM1062+JMB575 */
613+ { PCI_VDEVICE(ASMEDIA, 0x0621), board_ahci_43bit_dma }, /* ASM1061R */
614+ { PCI_VDEVICE(ASMEDIA, 0x0622), board_ahci_43bit_dma }, /* ASM1062R */
615+ { PCI_VDEVICE(ASMEDIA, 0x0624), board_ahci_43bit_dma }, /* ASM1062+JMB575 */
616616 { PCI_VDEVICE(ASMEDIA, 0x1062), board_ahci }, /* ASM1062A */
617617 { PCI_VDEVICE(ASMEDIA, 0x1064), board_ahci }, /* ASM1064 */
618618 { PCI_VDEVICE(ASMEDIA, 0x1164), board_ahci }, /* ASM1164 */
drivers/atm/idt77252.c+2−0
@@ -2930,6 +2930,8 @@ open_card_ubr0(struct idt77252_dev *card) · 2929 unmodified lines
29302930 vc->scq = alloc_scq(card, vc->class);
29312931 if (!vc->scq) {
29322932 printk("%s: can't get SCQ.\n", card->name);
2933+ kfree(card->vcs[0]);
2934+ card->vcs[0] = NULL;
29332935 return -ENOMEM;
29342936 }
29352937
drivers/crypto/ccp/sev-dev.c+8−2
@@ -534,10 +534,16 @@ EXPORT_SYMBOL_GPL(sev_platform_init); · 533 unmodified lines
534534
535535 static int __sev_platform_shutdown_locked(int *error)
536536 {
537− struct sev_device *sev = psp_master->sev_data;
537+ struct psp_device *psp = psp_master;
538+ struct sev_device *sev;
538539 int ret;
539540
540− if (!sev || sev->state == SEV_STATE_UNINIT)
541+ if (!psp || !psp->sev_data)
542+ return 0;
543+
544+ sev = psp->sev_data;
545+
546+ if (sev->state == SEV_STATE_UNINIT)
541547 return 0;
542548
543549 ret = __sev_do_cmd_locked(SEV_CMD_SHUTDOWN, NULL, error);
drivers/dma-buf/heaps/cma_heap.c+3−4
@@ -168,10 +168,7 @@ static vm_fault_t cma_heap_vm_fault(struct vm_fault *vmf) · 167 unmodified lines
168168 if (vmf->pgoff > buffer->pagecount)
169169 return VM_FAULT_SIGBUS;
170170
171− vmf->page = buffer->pages[vmf->pgoff];
172− get_page(vmf->page);
173−
174− return 0;
171+ return vmf_insert_pfn(vma, vmf->address, page_to_pfn(buffer->pages[vmf->pgoff]));
175172 }
176173
177174 static const struct vm_operations_struct dma_heap_vm_ops = {
@@ -185,6 +182,8 @@ static int cma_heap_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma) · 7 unmodified lines
185182 if ((vma->vm_flags & (VM_SHARED | VM_MAYSHARE)) == 0)
186183 return -EINVAL;
187184
185+ vm_flags_set(vma, VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP);
186+
188187 vma->vm_ops = &dma_heap_vm_ops;
189188 vma->vm_private_data = buffer;
190189
drivers/dma/at_hdmac.c+21−11
@@ -222,8 +222,14 @@ struct atdma_sg { · 221 unmodified lines
222222 * @vd: pointer to the virtual dma descriptor.
223223 * @atchan: pointer to the atmel dma channel.
224224 * @total_len: total transaction byte count
225− * @sg_len: number of sg entries.
225+ * @sglen: number of sg entries.
226226 * @sg: array of sgs.
227+ * @boundary: number of transfers to perform before the automatic address increment operation
228+ * @dst_hole: value to add to the destination address when the boundary has been reached
229+ * @src_hole: value to add to the source address when the boundary has been reached
230+ * @memset_buffer: buffer used for the memset operation
231+ * @memset_paddr: physical address of the buffer used for the memset operation
232+ * @memset_vaddr: virtual address of the buffer used for the memset operation
227233 */
228234 struct at_desc {
229235 struct virt_dma_desc vd;
@@ -245,7 +251,10 @@ struct at_desc { · 15 unmodified lines
245251 /*-- Channels --------------------------------------------------------*/
246252
247253 /**
248− * atc_status - information bits stored in channel status flag
254+ * enum atc_status - information bits stored in channel status flag
255+ *
256+ * @ATC_IS_PAUSED: If channel is pauses
257+ * @ATC_IS_CYCLIC: If channel is cyclic
249258 *
250259 * Manipulated with atomic operations.
251260 */
@@ -282,7 +291,6 @@ struct at_dma_chan { · 30 unmodified lines
282291 u32 save_cfg;
283292 u32 save_dscr;
284293 struct dma_slave_config dma_sconfig;
285− bool cyclic;
286294 struct at_desc *desc;
287295 };
288296
@@ -328,12 +336,12 @@ static inline u8 convert_buswidth(enum dma_slave_buswidth addr_width) · 39 unmodified lines
328336 /**
329337 * struct at_dma - internal representation of an Atmel HDMA Controller
330338 * @dma_device: dmaengine dma_device object members
331− * @atdma_devtype: identifier of DMA controller compatibility
332− * @ch_regs: memory mapped register base
339+ * @regs: memory mapped register base
333340 * @clk: dma controller clock
334341 * @save_imr: interrupt mask register that is saved on suspend/resume cycle
335342 * @all_chan_mask: all channels availlable in a mask
336343 * @lli_pool: hw lli table
344+ * @memset_pool: hw memset pool
337345 * @chan: channels table to store at_dma_chan structures
338346 */
339347 struct at_dma {
@@ -626,6 +634,9 @@ static inline u32 atc_calc_bytes_left(u32 current_len, u32 ctrla) · 286 unmodified lines
626634
627635 /**
628636 * atc_get_llis_residue - Get residue for a hardware linked list transfer
637+ * @atchan: pointer to an atmel hdmac channel.
638+ * @desc: pointer to the descriptor for which the residue is calculated.
639+ * @residue: residue to be set to dma_tx_state.
629640 *
630641 * Calculate the residue by removing the length of the Linked List Item (LLI)
631642 * already transferred from the total length. To get the current LLI we can use
@@ -661,10 +672,8 @@ static inline u32 atc_calc_bytes_left(u32 current_len, u32 ctrla) · 29 unmodified lines
661672 * two DSCR values are different, we read again the CTRLA then the DSCR till two
662673 * consecutive read values from DSCR are equal or till the maximum trials is
663674 * reach. This algorithm is very unlikely not to find a stable value for DSCR.
664− * @atchan: pointer to an atmel hdmac channel.
665− * @desc: pointer to the descriptor for which the residue is calculated.
666− * @residue: residue to be set to dma_tx_state.
667− * Returns 0 on success, -errno otherwise.
675+ *
676+ * Returns: %0 on success, -errno otherwise.
668677 */
669678 static int atc_get_llis_residue(struct at_dma_chan *atchan,
670679 struct at_desc *desc, u32 *residue)
@@ -731,7 +740,8 @@ static int atc_get_llis_residue(struct at_dma_chan *atchan, · 60 unmodified lines
731740 * @chan: DMA channel
732741 * @cookie: transaction identifier to check status of
733742 * @residue: residue to be updated.
734− * Return 0 on success, -errono otherwise.
743+ *
744+ * Return: %0 on success, -errno otherwise.
735745 */
736746 static int atc_get_residue(struct dma_chan *chan, dma_cookie_t cookie,
737747 u32 *residue)
@@ -1710,7 +1720,7 @@ static void atc_issue_pending(struct dma_chan *chan) · 972 unmodified lines
17101720 * atc_alloc_chan_resources - allocate resources for DMA channel
17111721 * @chan: allocate descriptor resources for this channel
17121722 *
1713− * return - the number of allocated descriptors
1723+ * Return: the number of allocated descriptors
17141724 */
17151725 static int atc_alloc_chan_resources(struct dma_chan *chan)
17161726 {
drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c+6−4
@@ -38,15 +38,17 @@ static int dpaa2_qdma_alloc_chan_resources(struct dma_chan *chan) · 37 unmodified lines
3838 if (!dpaa2_chan->fd_pool)
3939 goto err;
4040
41− dpaa2_chan->fl_pool = dma_pool_create("fl_pool", dev,
42− sizeof(struct dpaa2_fl_entry),
43− sizeof(struct dpaa2_fl_entry), 0);
41+ dpaa2_chan->fl_pool =
42+ dma_pool_create("fl_pool", dev,
43+ sizeof(struct dpaa2_fl_entry) * 3,
44+ sizeof(struct dpaa2_fl_entry), 0);
45+
4446 if (!dpaa2_chan->fl_pool)
4547 goto err_fd;
4648
4749 dpaa2_chan->sdd_pool =
4850 dma_pool_create("sdd_pool", dev,
49− sizeof(struct dpaa2_qdma_sd_d),
51+ sizeof(struct dpaa2_qdma_sd_d) * 2,
5052 sizeof(struct dpaa2_qdma_sd_d), 0);
5153 if (!dpaa2_chan->sdd_pool)
5254 goto err_fl;
drivers/dma/fsl-qdma.c+12−21
@@ -514,11 +514,11 @@ static struct fsl_qdma_queue · 513 unmodified lines
514514 queue_temp = queue_head + i + (j * queue_num);
515515
516516 queue_temp->cq =
517− dma_alloc_coherent(&pdev->dev,
518− sizeof(struct fsl_qdma_format) *
519− queue_size[i],
520− &queue_temp->bus_addr,
521− GFP_KERNEL);
517+ dmam_alloc_coherent(&pdev->dev,
518+ sizeof(struct fsl_qdma_format) *
519+ queue_size[i],
520+ &queue_temp->bus_addr,
521+ GFP_KERNEL);
522522 if (!queue_temp->cq)
523523 return NULL;
524524 queue_temp->block_base = fsl_qdma->block_base +
@@ -563,15 +563,14 @@ static struct fsl_qdma_queue · 38 unmodified lines
563563 /*
564564 * Buffer for queue command
565565 */
566− status_head->cq = dma_alloc_coherent(&pdev->dev,
567− sizeof(struct fsl_qdma_format) *
568− status_size,
569− &status_head->bus_addr,
570− GFP_KERNEL);
571− if (!status_head->cq) {
572− devm_kfree(&pdev->dev, status_head);
566+ status_head->cq = dmam_alloc_coherent(&pdev->dev,
567+ sizeof(struct fsl_qdma_format) *
568+ status_size,
569+ &status_head->bus_addr,
570+ GFP_KERNEL);
571+ if (!status_head->cq)
573572 return NULL;
574− }
573+
575574 status_head->n_cq = status_size;
576575 status_head->virt_head = status_head->cq;
577576 status_head->virt_tail = status_head->cq;
@@ -1268,8 +1267,6 @@ static void fsl_qdma_cleanup_vchan(struct dma_device *dmadev) · 690 unmodified lines
12681267
12691268 static void fsl_qdma_remove(struct platform_device *pdev)
12701269 {
1271− int i;
1272− struct fsl_qdma_queue *status;
12731270 struct device_node *np = pdev->dev.of_node;
12741271 struct fsl_qdma_engine *fsl_qdma = platform_get_drvdata(pdev);
12751272
@@ -1277,12 +1274,6 @@ static void fsl_qdma_remove(struct platform_device *pdev) · 1 unmodified line
12771274 fsl_qdma_cleanup_vchan(&fsl_qdma->dma_dev);
12781275 of_dma_controller_free(np);
12791276 dma_async_device_unregister(&fsl_qdma->dma_dev);
1280−
1281− for (i = 0; i < fsl_qdma->block_number; i++) {
1282− status = fsl_qdma->status[i];
1283− dma_free_coherent(&pdev->dev, sizeof(struct fsl_qdma_format) *
1284− status->n_cq, status->cq, status->bus_addr);
1285− }
12861277 }
12871278
12881279 static const struct of_device_id fsl_qdma_dt_ids[] = {
drivers/dma/ti/edma.c+10−0
@@ -2404,6 +2404,11 @@ static int edma_probe(struct platform_device *pdev) · 2403 unmodified lines
24042404 if (irq > 0) {
24052405 irq_name = devm_kasprintf(dev, GFP_KERNEL, "%s_ccint",
24062406 dev_name(dev));
2407+ if (!irq_name) {
2408+ ret = -ENOMEM;
2409+ goto err_disable_pm;
2410+ }
2411+
24072412 ret = devm_request_irq(dev, irq, dma_irq_handler, 0, irq_name,
24082413 ecc);
24092414 if (ret) {
@@ -2420,6 +2425,11 @@ static int edma_probe(struct platform_device *pdev) · 10 unmodified lines
24202425 if (irq > 0) {
24212426 irq_name = devm_kasprintf(dev, GFP_KERNEL, "%s_ccerrint",
24222427 dev_name(dev));
2428+ if (!irq_name) {
2429+ ret = -ENOMEM;
2430+ goto err_disable_pm;
2431+ }
2432+
24232433 ret = devm_request_irq(dev, irq, dma_ccerr_handler, 0, irq_name,
24242434 ecc);
24252435 if (ret) {
drivers/dma/ti/k3-udma.c+8−2
@@ -3968,6 +3968,7 @@ static void udma_desc_pre_callback(struct virt_dma_chan *vc, · 3967 unmodified lines
39683968 {
39693969 struct udma_chan *uc = to_udma_chan(&vc->chan);
39703970 struct udma_desc *d;
3971+ u8 status;
39713972
39723973 if (!vd)
39733974 return;
@@ -3977,12 +3978,12 @@ static void udma_desc_pre_callback(struct virt_dma_chan *vc, · 3 unmodified lines
39773978 if (d->metadata_size)
39783979 udma_fetch_epib(uc, d);
39793980
3980− /* Provide residue information for the client */
39813981 if (result) {
39823982 void *desc_vaddr = udma_curr_cppi5_desc_vaddr(d, d->desc_idx);
39833983
39843984 if (cppi5_desc_get_type(desc_vaddr) ==
39853985 CPPI5_INFO0_DESC_TYPE_VAL_HOST) {
3986+ /* Provide residue information for the client */
39863987 result->residue = d->residue -
39873988 cppi5_hdesc_get_pktlen(desc_vaddr);
39883989 if (result->residue)
@@ -3991,7 +3992,12 @@ static void udma_desc_pre_callback(struct virt_dma_chan *vc, · 2 unmodified lines
39913992 result->result = DMA_TRANS_NOERROR;
39923993 } else {
39933994 result->residue = 0;
3994− result->result = DMA_TRANS_NOERROR;
3995+ /* Propagate TR Response errors to the client */
3996+ status = d->hwdesc[0].tr_resp_base->status;
3997+ if (status)
3998+ result->result = DMA_TRANS_ABORTED;
3999+ else
4000+ result->result = DMA_TRANS_NOERROR;
39954001 }
39964002 }
39974003 }
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c+21−11
@@ -141,11 +141,31 @@ static void amdgpu_amdkfd_reset_work(struct work_struct *work) · 140 unmodified lines
141141 static const struct drm_client_funcs kfd_client_funcs = {
142142 .unregister = drm_client_release,
143143 };
144+
145+int amdgpu_amdkfd_drm_client_create(struct amdgpu_device *adev)
146+{
147+ int ret;
148+
149+ if (!adev->kfd.init_complete)
150+ return 0;
151+
152+ ret = drm_client_init(&adev->ddev, &adev->kfd.client, "kfd",
153+ &kfd_client_funcs);
154+ if (ret) {
155+ dev_err(adev->dev, "Failed to init DRM client: %d\n",
156+ ret);
157+ return ret;
158+ }
159+
160+ drm_client_register(&adev->kfd.client);
161+
162+ return 0;
163+}
164+
144165 void amdgpu_amdkfd_device_init(struct amdgpu_device *adev)
145166 {
146167 int i;
147168 int last_valid_bit;
148− int ret;
149169
150170 amdgpu_amdkfd_gpuvm_init_mem_limits();
151171
@@ -164,12 +184,6 @@ void amdgpu_amdkfd_device_init(struct amdgpu_device *adev) · 12 unmodified lines
164184 .enable_mes = adev->enable_mes,
165185 };
166186
167− ret = drm_client_init(&adev->ddev, &adev->kfd.client, "kfd", &kfd_client_funcs);
168− if (ret) {
169− dev_err(adev->dev, "Failed to init DRM client: %d\n", ret);
170− return;
171− }
172−
173187 /* this is going to have a few of the MSBs set that we need to
174188 * clear
175189 */
@@ -208,10 +222,6 @@ void amdgpu_amdkfd_device_init(struct amdgpu_device *adev) · 32 unmodified lines
208222
209223 adev->kfd.init_complete = kgd2kfd_device_init(adev->kfd.dev,
210224 &gpu_resources);
211− if (adev->kfd.init_complete)
212− drm_client_register(&adev->kfd.client);
213− else
214− drm_client_release(&adev->kfd.client);
215225
216226 amdgpu_amdkfd_total_mem_size += adev->gmc.real_vram_size;
217227
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h+3−1
@@ -182,6 +182,8 @@ int amdgpu_queue_mask_bit_to_set_resource_bit(struct amdgpu_device *adev, · 181 unmodified lines
182182 struct amdgpu_amdkfd_fence *amdgpu_amdkfd_fence_create(u64 context,
183183 struct mm_struct *mm,
184184 struct svm_range_bo *svm_bo);
185+
186+int amdgpu_amdkfd_drm_client_create(struct amdgpu_device *adev);
185187 #if defined(CONFIG_DEBUG_FS)
186188 int kfd_debugfs_kfd_mem_limits(struct seq_file *m, void *data);
187189 #endif
@@ -301,7 +303,7 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(struct amdgpu_device *adev, · 113 unmodified lines
301303 struct kgd_mem *mem, void *drm_priv);
302304 int amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu(
303305 struct amdgpu_device *adev, struct kgd_mem *mem, void *drm_priv);
304−void amdgpu_amdkfd_gpuvm_dmaunmap_mem(struct kgd_mem *mem, void *drm_priv);
306+int amdgpu_amdkfd_gpuvm_dmaunmap_mem(struct kgd_mem *mem, void *drm_priv);
305307 int amdgpu_amdkfd_gpuvm_sync_memory(
306308 struct amdgpu_device *adev, struct kgd_mem *mem, bool intr);
307309 int amdgpu_amdkfd_gpuvm_map_gtt_bo_to_kernel(struct kgd_mem *mem,
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c+1−1
@@ -290,7 +290,7 @@ static int suspend_resume_compute_scheduler(struct amdgpu_device *adev, bool sus · 289 unmodified lines
290290 for (i = 0; i < adev->gfx.num_compute_rings; i++) {
291291 struct amdgpu_ring *ring = &adev->gfx.compute_ring[i];
292292
293− if (!(ring && drm_sched_wqueue_ready(&ring->sched)))
293+ if (!amdgpu_ring_sched_ready(ring))
294294 continue;
295295
296296 /* stop secheduler and drain ring. */
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c+17−3
@@ -2085,21 +2085,35 @@ out: · 2084 unmodified lines
20852085 return ret;
20862086 }
20872087
2088−void amdgpu_amdkfd_gpuvm_dmaunmap_mem(struct kgd_mem *mem, void *drm_priv)
2088+int amdgpu_amdkfd_gpuvm_dmaunmap_mem(struct kgd_mem *mem, void *drm_priv)
20892089 {
20902090 struct kfd_mem_attachment *entry;
20912091 struct amdgpu_vm *vm;
2092+ int ret;
20922093
20932094 vm = drm_priv_to_vm(drm_priv);
20942095
20952096 mutex_lock(&mem->lock);
20962097
2098+ ret = amdgpu_bo_reserve(mem->bo, true);
2099+ if (ret)
2100+ goto out;
2101+
20972102 list_for_each_entry(entry, &mem->attachments, list) {
2098− if (entry->bo_va->base.vm == vm)
2099− kfd_mem_dmaunmap_attachment(mem, entry);
2103+ if (entry->bo_va->base.vm != vm)
2104+ continue;
2105+ if (entry->bo_va->base.bo->tbo.ttm &&
2106+ !entry->bo_va->base.bo->tbo.ttm->sg)
2107+ continue;
2108+
2109+ kfd_mem_dmaunmap_attachment(mem, entry);
21002110 }
21012111
2112+ amdgpu_bo_unreserve(mem->bo);
2113+out:
21022114 mutex_unlock(&mem->lock);
2115+
2116+ return ret;
21032117 }
21042118
21052119 int amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu(
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c+4−4
@@ -1678,7 +1678,7 @@ static int amdgpu_debugfs_test_ib_show(struct seq_file *m, void *unused) · 1677 unmodified lines
16781678 for (i = 0; i < AMDGPU_MAX_RINGS; i++) {
16791679 struct amdgpu_ring *ring = adev->rings[i];
16801680
1681− if (!ring || !drm_sched_wqueue_ready(&ring->sched))
1681+ if (!amdgpu_ring_sched_ready(ring))
16821682 continue;
16831683 drm_sched_wqueue_stop(&ring->sched);
16841684 }
@@ -1694,7 +1694,7 @@ static int amdgpu_debugfs_test_ib_show(struct seq_file *m, void *unused) · 9 unmodified lines
16941694 for (i = 0; i < AMDGPU_MAX_RINGS; i++) {
16951695 struct amdgpu_ring *ring = adev->rings[i];
16961696
1697− if (!ring || !drm_sched_wqueue_ready(&ring->sched))
1697+ if (!amdgpu_ring_sched_ready(ring))
16981698 continue;
16991699 drm_sched_wqueue_start(&ring->sched);
17001700 }
@@ -1916,8 +1916,8 @@ static int amdgpu_debugfs_ib_preempt(void *data, u64 val) · 215 unmodified lines
19161916
19171917 ring = adev->rings[val];
19181918
1919− if (!ring || !ring->funcs->preempt_ib ||
1920− !drm_sched_wqueue_ready(&ring->sched))
1919+ if (!amdgpu_ring_sched_ready(ring) ||
1920+ !ring->funcs->preempt_ib)
19211921 return -EINVAL;
19221922
19231923 /* the last preemption failed */
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c+13−23
@@ -4121,23 +4121,13 @@ int amdgpu_device_init(struct amdgpu_device *adev, · 4120 unmodified lines
41214121 }
41224122 }
41234123 } else {
4124− switch (amdgpu_ip_version(adev, MP1_HWIP, 0)) {
4125− case IP_VERSION(13, 0, 0):
4126− case IP_VERSION(13, 0, 7):
4127− case IP_VERSION(13, 0, 10):
4128− r = psp_gpu_reset(adev);
4129− break;
4130− default:
4131− tmp = amdgpu_reset_method;
4132− /* It should do a default reset when loading or reloading the driver,
4133− * regardless of the module parameter reset_method.
4134− */
4135− amdgpu_reset_method = AMD_RESET_METHOD_NONE;
4136− r = amdgpu_asic_reset(adev);
4137− amdgpu_reset_method = tmp;
4138− break;
4139− }
4140−
4124+ tmp = amdgpu_reset_method;
4125+ /* It should do a default reset when loading or reloading the driver,
4126+ * regardless of the module parameter reset_method.
4127+ */
4128+ amdgpu_reset_method = AMD_RESET_METHOD_NONE;
4129+ r = amdgpu_asic_reset(adev);
4130+ amdgpu_reset_method = tmp;
41414131 if (r) {
41424132 dev_err(adev->dev, "asic reset on init failed\n");
41434133 goto failed;
@@ -5031,7 +5021,7 @@ bool amdgpu_device_has_job_running(struct amdgpu_device *adev) · 887 unmodified lines
50315021 for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
50325022 struct amdgpu_ring *ring = adev->rings[i];
50335023
5034− if (!ring || !drm_sched_wqueue_ready(&ring->sched))
5024+ if (!amdgpu_ring_sched_ready(ring))
50355025 continue;
50365026
50375027 spin_lock(&ring->sched.job_list_lock);
@@ -5170,7 +5160,7 @@ int amdgpu_device_pre_asic_reset(struct amdgpu_device *adev, · 132 unmodified lines
51705160 for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
51715161 struct amdgpu_ring *ring = adev->rings[i];
51725162
5173− if (!ring || !drm_sched_wqueue_ready(&ring->sched))
5163+ if (!amdgpu_ring_sched_ready(ring))
51745164 continue;
51755165
51765166 /* Clear job fence from fence drv to avoid force_completion
@@ -5637,7 +5627,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev, · 460 unmodified lines
56375627 for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
56385628 struct amdgpu_ring *ring = tmp_adev->rings[i];
56395629
5640− if (!ring || !drm_sched_wqueue_ready(&ring->sched))
5630+ if (!amdgpu_ring_sched_ready(ring))
56415631 continue;
56425632
56435633 drm_sched_stop(&ring->sched, job ? &job->base : NULL);
@@ -5706,7 +5696,7 @@ skip_hw_reset: · 62 unmodified lines
57065696 for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
57075697 struct amdgpu_ring *ring = tmp_adev->rings[i];
57085698
5709− if (!ring || !drm_sched_wqueue_ready(&ring->sched))
5699+ if (!amdgpu_ring_sched_ready(ring))
57105700 continue;
57115701
57125702 drm_sched_start(&ring->sched, true);
@@ -6061,7 +6051,7 @@ pci_ers_result_t amdgpu_pci_error_detected(struct pci_dev *pdev, pci_channel_sta · 348 unmodified lines
60616051 for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
60626052 struct amdgpu_ring *ring = adev->rings[i];
60636053
6064− if (!ring || !drm_sched_wqueue_ready(&ring->sched))
6054+ if (!amdgpu_ring_sched_ready(ring))
60656055 continue;
60666056
60676057 drm_sched_stop(&ring->sched, NULL);
@@ -6189,7 +6179,7 @@ void amdgpu_pci_resume(struct pci_dev *pdev) · 121 unmodified lines
61896179 for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
61906180 struct amdgpu_ring *ring = adev->rings[i];
61916181
6192− if (!ring || !drm_sched_wqueue_ready(&ring->sched))
6182+ if (!amdgpu_ring_sched_ready(ring))
61936183 continue;
61946184
61956185 drm_sched_start(&ring->sched, true);
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c+4−0
@@ -2255,6 +2255,10 @@ retry_init: · 2254 unmodified lines
22552255 if (ret)
22562256 goto err_pci;
22572257
2258+ ret = amdgpu_amdkfd_drm_client_create(adev);
2259+ if (ret)
2260+ goto err_pci;
2261+
22582262 /*
22592263 * 1. don't init fbdev on hw without DCE
22602264 * 2. don't init fbdev if there are no connectors
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c+12−0
@@ -635,6 +635,7 @@ int amdgpu_ring_test_helper(struct amdgpu_ring *ring) · 634 unmodified lines
635635 ring->name);
636636
637637 ring->sched.ready = !r;
638+
638639 return r;
639640 }
640641
@@ -717,3 +718,14 @@ void amdgpu_ring_ib_on_emit_de(struct amdgpu_ring *ring) · 76 unmodified lines
717718 if (ring->is_sw_ring)
718719 amdgpu_sw_ring_ib_mark_offset(ring, AMDGPU_MUX_OFFSET_TYPE_DE);
719720 }
721+
722+bool amdgpu_ring_sched_ready(struct amdgpu_ring *ring)
723+{
724+ if (!ring)
725+ return false;
726+
727+ if (ring->no_scheduler || !drm_sched_wqueue_ready(&ring->sched))
728+ return false;
729+
730+ return true;
731+}
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h+1−1
@@ -450,5 +450,5 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, · 449 unmodified lines
450450 int amdgpu_ib_pool_init(struct amdgpu_device *adev);
451451 void amdgpu_ib_pool_fini(struct amdgpu_device *adev);
452452 int amdgpu_ib_ring_tests(struct amdgpu_device *adev);
453−
453+bool amdgpu_ring_sched_ready(struct amdgpu_ring *ring);
454454 #endif
drivers/gpu/drm/amd/amdgpu/cik_ih.c+6−0
@@ -204,6 +204,12 @@ static u32 cik_ih_get_wptr(struct amdgpu_device *adev, · 203 unmodified lines
204204 tmp = RREG32(mmIH_RB_CNTL);
205205 tmp |= IH_RB_CNTL__WPTR_OVERFLOW_CLEAR_MASK;
206206 WREG32(mmIH_RB_CNTL, tmp);
207+
208+ /* Unset the CLEAR_OVERFLOW bit immediately so new overflows
209+ * can be detected.
210+ */
211+ tmp &= ~IH_RB_CNTL__WPTR_OVERFLOW_CLEAR_MASK;
212+ WREG32(mmIH_RB_CNTL, tmp);
207213 }
208214 return (wptr & ih->ptr_mask);
209215 }
drivers/gpu/drm/amd/amdgpu/cz_ih.c+5−0
@@ -216,6 +216,11 @@ static u32 cz_ih_get_wptr(struct amdgpu_device *adev, · 215 unmodified lines
216216 tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, WPTR_OVERFLOW_CLEAR, 1);
217217 WREG32(mmIH_RB_CNTL, tmp);
218218
219+ /* Unset the CLEAR_OVERFLOW bit immediately so new overflows
220+ * can be detected.
221+ */
222+ tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, WPTR_OVERFLOW_CLEAR, 0);
223+ WREG32(mmIH_RB_CNTL, tmp);
219224
220225 out:
221226 return (wptr & ih->ptr_mask);
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c+0−2
@@ -4027,8 +4027,6 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev) · 4026 unmodified lines
40274027 err = 0;
40284028 adev->gfx.mec2_fw = NULL;
40294029 }
4030− amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC2);
4031− amdgpu_gfx_cp_init_microcode(adev, AMDGPU_UCODE_ID_CP_MEC2_JT);
40324030
40334031 gfx_v10_0_check_fw_write_wait(adev);
40344032 out:
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c+0−22
@@ -107,23 +107,6 @@ static const struct soc15_reg_golden golden_settings_gc_11_0_1[] = · 106 unmodified lines
107107 SOC15_REG_GOLDEN_VALUE(GC, 0, regTCP_CNTL2, 0xfcffffff, 0x0000000a)
108108 };
109109
110−static const struct soc15_reg_golden golden_settings_gc_11_5_0[] = {
111− SOC15_REG_GOLDEN_VALUE(GC, 0, regDB_DEBUG5, 0xffffffff, 0x00000800),
112− SOC15_REG_GOLDEN_VALUE(GC, 0, regGB_ADDR_CONFIG, 0x0c1807ff, 0x00000242),
113− SOC15_REG_GOLDEN_VALUE(GC, 0, regGCR_GENERAL_CNTL, 0x1ff1ffff, 0x00000500),
114− SOC15_REG_GOLDEN_VALUE(GC, 0, regGL2A_ADDR_MATCH_MASK, 0xffffffff, 0xfffffff3),
115− SOC15_REG_GOLDEN_VALUE(GC, 0, regGL2C_ADDR_MATCH_MASK, 0xffffffff, 0xfffffff3),
116− SOC15_REG_GOLDEN_VALUE(GC, 0, regGL2C_CTRL, 0xffffffff, 0xf37fff3f),
117− SOC15_REG_GOLDEN_VALUE(GC, 0, regGL2C_CTRL3, 0xfffffffb, 0x00f40188),
118− SOC15_REG_GOLDEN_VALUE(GC, 0, regGL2C_CTRL4, 0xf0ffffff, 0x80009007),
119− SOC15_REG_GOLDEN_VALUE(GC, 0, regPA_CL_ENHANCE, 0xf1ffffff, 0x00880007),
120− SOC15_REG_GOLDEN_VALUE(GC, 0, regPC_CONFIG_CNTL_1, 0xffffffff, 0x00010000),
121− SOC15_REG_GOLDEN_VALUE(GC, 0, regTA_CNTL_AUX, 0xf7f7ffff, 0x01030000),
122− SOC15_REG_GOLDEN_VALUE(GC, 0, regTA_CNTL2, 0x007f0000, 0x00000000),
123− SOC15_REG_GOLDEN_VALUE(GC, 0, regTCP_CNTL2, 0xffcfffff, 0x0000200a),
124− SOC15_REG_GOLDEN_VALUE(GC, 0, regUTCL1_CTRL_2, 0xffffffff, 0x0000048f)
125−};
126−
127110 #define DEFAULT_SH_MEM_CONFIG \
128111 ((SH_MEM_ADDRESS_MODE_64 << SH_MEM_CONFIG__ADDRESS_MODE__SHIFT) | \
129112 (SH_MEM_ALIGNMENT_MODE_UNALIGNED << SH_MEM_CONFIG__ALIGNMENT_MODE__SHIFT) | \
@@ -304,11 +287,6 @@ static void gfx_v11_0_init_golden_registers(struct amdgpu_device *adev) · 174 unmodified lines
304287 golden_settings_gc_11_0_1,
305288 (const u32)ARRAY_SIZE(golden_settings_gc_11_0_1));
306289 break;
307− case IP_VERSION(11, 5, 0):
308− soc15_program_register_sequence(adev,
309− golden_settings_gc_11_5_0,
310− (const u32)ARRAY_SIZE(golden_settings_gc_11_5_0));
311− break;
312290 default:
313291 break;
314292 }
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c+2−2
@@ -915,8 +915,8 @@ static int gmc_v6_0_hw_init(void *handle) · 914 unmodified lines
915915
916916 if (amdgpu_emu_mode == 1)
917917 return amdgpu_gmc_vram_checking(adev);
918− else
919− return r;
918+
919+ return 0;
920920 }
921921
922922 static int gmc_v6_0_hw_fini(void *handle)
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c+2−2
@@ -1099,8 +1099,8 @@ static int gmc_v7_0_hw_init(void *handle) · 1098 unmodified lines
10991099
11001100 if (amdgpu_emu_mode == 1)
11011101 return amdgpu_gmc_vram_checking(adev);
1102− else
1103− return r;
1102+
1103+ return 0;
11041104 }
11051105
11061106 static int gmc_v7_0_hw_fini(void *handle)
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c+2−2
@@ -1219,8 +1219,8 @@ static int gmc_v8_0_hw_init(void *handle) · 1218 unmodified lines
12191219
12201220 if (amdgpu_emu_mode == 1)
12211221 return amdgpu_gmc_vram_checking(adev);
1222− else
1223− return r;
1222+
1223+ return 0;
12241224 }
12251225
12261226 static int gmc_v8_0_hw_fini(void *handle)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c+2−2
@@ -2341,8 +2341,8 @@ static int gmc_v9_0_hw_init(void *handle) · 2340 unmodified lines
23412341
23422342 if (amdgpu_emu_mode == 1)
23432343 return amdgpu_gmc_vram_checking(adev);
2344− else
2345− return r;
2344+
2345+ return 0;
23462346 }
23472347
23482348 /**
drivers/gpu/drm/amd/amdgpu/iceland_ih.c+5−0
@@ -215,6 +215,11 @@ static u32 iceland_ih_get_wptr(struct amdgpu_device *adev, · 214 unmodified lines
215215 tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, WPTR_OVERFLOW_CLEAR, 1);
216216 WREG32(mmIH_RB_CNTL, tmp);
217217
218+ /* Unset the CLEAR_OVERFLOW bit immediately so new overflows
219+ * can be detected.
220+ */
221+ tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, WPTR_OVERFLOW_CLEAR, 0);
222+ WREG32(mmIH_RB_CNTL, tmp);
218223
219224 out:
220225 return (wptr & ih->ptr_mask);
drivers/gpu/drm/amd/amdgpu/ih_v6_0.c+6−0
@@ -418,6 +418,12 @@ static u32 ih_v6_0_get_wptr(struct amdgpu_device *adev, · 417 unmodified lines
418418 tmp = RREG32_NO_KIQ(ih_regs->ih_rb_cntl);
419419 tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, WPTR_OVERFLOW_CLEAR, 1);
420420 WREG32_NO_KIQ(ih_regs->ih_rb_cntl, tmp);
421+
422+ /* Unset the CLEAR_OVERFLOW bit immediately so new overflows
423+ * can be detected.
424+ */
425+ tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, WPTR_OVERFLOW_CLEAR, 0);
426+ WREG32_NO_KIQ(ih_regs->ih_rb_cntl, tmp);
421427 out:
422428 return (wptr & ih->ptr_mask);
423429 }
drivers/gpu/drm/amd/amdgpu/ih_v6_1.c+7−0
@@ -418,6 +418,13 @@ static u32 ih_v6_1_get_wptr(struct amdgpu_device *adev, · 417 unmodified lines
418418 tmp = RREG32_NO_KIQ(ih_regs->ih_rb_cntl);
419419 tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, WPTR_OVERFLOW_CLEAR, 1);
420420 WREG32_NO_KIQ(ih_regs->ih_rb_cntl, tmp);
421+
422+ /* Unset the CLEAR_OVERFLOW bit immediately so new overflows
423+ * can be detected.
424+ */
425+ tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, WPTR_OVERFLOW_CLEAR, 0);
426+ WREG32_NO_KIQ(ih_regs->ih_rb_cntl, tmp);
427+
421428 out:
422429 return (wptr & ih->ptr_mask);
423430 }
drivers/gpu/drm/amd/amdgpu/navi10_ih.c+6−0
@@ -442,6 +442,12 @@ static u32 navi10_ih_get_wptr(struct amdgpu_device *adev, · 441 unmodified lines
442442 tmp = RREG32_NO_KIQ(ih_regs->ih_rb_cntl);
443443 tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, WPTR_OVERFLOW_CLEAR, 1);
444444 WREG32_NO_KIQ(ih_regs->ih_rb_cntl, tmp);
445+
446+ /* Unset the CLEAR_OVERFLOW bit immediately so new overflows
447+ * can be detected.
448+ */
449+ tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, WPTR_OVERFLOW_CLEAR, 0);
450+ WREG32_NO_KIQ(ih_regs->ih_rb_cntl, tmp);
445451 out:
446452 return (wptr & ih->ptr_mask);
447453 }
drivers/gpu/drm/amd/amdgpu/si_ih.c+6−0
@@ -119,6 +119,12 @@ static u32 si_ih_get_wptr(struct amdgpu_device *adev, · 118 unmodified lines
119119 tmp = RREG32(IH_RB_CNTL);
120120 tmp |= IH_RB_CNTL__WPTR_OVERFLOW_CLEAR_MASK;
121121 WREG32(IH_RB_CNTL, tmp);
122+
123+ /* Unset the CLEAR_OVERFLOW bit immediately so new overflows
124+ * can be detected.
125+ */
126+ tmp &= ~IH_RB_CNTL__WPTR_OVERFLOW_CLEAR_MASK;
127+ WREG32(IH_RB_CNTL, tmp);
122128 }
123129 return (wptr & ih->ptr_mask);
124130 }
drivers/gpu/drm/amd/amdgpu/tonga_ih.c+6−0
@@ -219,6 +219,12 @@ static u32 tonga_ih_get_wptr(struct amdgpu_device *adev, · 218 unmodified lines
219219 tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, WPTR_OVERFLOW_CLEAR, 1);
220220 WREG32(mmIH_RB_CNTL, tmp);
221221
222+ /* Unset the CLEAR_OVERFLOW bit immediately so new overflows
223+ * can be detected.
224+ */
225+ tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, WPTR_OVERFLOW_CLEAR, 0);
226+ WREG32(mmIH_RB_CNTL, tmp);
227+
222228 out:
223229 return (wptr & ih->ptr_mask);
224230 }
drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c+0−17
@@ -2017,22 +2017,6 @@ static int vcn_v4_0_set_powergating_state(void *handle, enum amd_powergating_sta · 2016 unmodified lines
20172017 return ret;
20182018 }
20192019
2020−/**
2021− * vcn_v4_0_set_interrupt_state - set VCN block interrupt state
2022− *
2023− * @adev: amdgpu_device pointer
2024− * @source: interrupt sources
2025− * @type: interrupt types
2026− * @state: interrupt states
2027− *
2028− * Set VCN block interrupt state
2029− */
2030−static int vcn_v4_0_set_interrupt_state(struct amdgpu_device *adev, struct amdgpu_irq_src *source,
2031− unsigned type, enum amdgpu_interrupt_state state)
2032−{
2033− return 0;
2034−}
2035−
20362020 /**
20372021 * vcn_v4_0_set_ras_interrupt_state - set VCN block RAS interrupt state
20382022 *
@@ -2097,7 +2081,6 @@ static int vcn_v4_0_process_interrupt(struct amdgpu_device *adev, struct amdgpu_ · 58 unmodified lines
20972081 }
20982082
20992083 static const struct amdgpu_irq_src_funcs vcn_v4_0_irq_funcs = {
2100− .set = vcn_v4_0_set_interrupt_state,
21012084 .process = vcn_v4_0_process_interrupt,
21022085 };
21032086
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c+0−19
@@ -269,8 +269,6 @@ static int vcn_v4_0_5_hw_fini(void *handle) · 268 unmodified lines
269269 vcn_v4_0_5_set_powergating_state(adev, AMD_PG_STATE_GATE);
270270 }
271271 }
272−
273− amdgpu_irq_put(adev, &adev->vcn.inst[i].irq, 0);
274272 }
275273
276274 return 0;
@@ -1668,22 +1666,6 @@ static int vcn_v4_0_5_set_powergating_state(void *handle, enum amd_powergating_s · 1391 unmodified lines
16681666 return ret;
16691667 }
16701668
1671−/**
1672− * vcn_v4_0_5_set_interrupt_state - set VCN block interrupt state
1673− *
1674− * @adev: amdgpu_device pointer
1675− * @source: interrupt sources
1676− * @type: interrupt types
1677− * @state: interrupt states
1678− *
1679− * Set VCN block interrupt state
1680− */
1681−static int vcn_v4_0_5_set_interrupt_state(struct amdgpu_device *adev, struct amdgpu_irq_src *source,
1682− unsigned type, enum amdgpu_interrupt_state state)
1683−{
1684− return 0;
1685−}
1686−
16871669 /**
16881670 * vcn_v4_0_5_process_interrupt - process VCN block interrupt
16891671 *
@@ -1726,7 +1708,6 @@ static int vcn_v4_0_5_process_interrupt(struct amdgpu_device *adev, struct amdgp · 36 unmodified lines
17261708 }
17271709
17281710 static const struct amdgpu_irq_src_funcs vcn_v4_0_5_irq_funcs = {
1729− .set = vcn_v4_0_5_set_interrupt_state,
17301711 .process = vcn_v4_0_5_process_interrupt,
17311712 };
17321713
drivers/gpu/drm/amd/amdgpu/vega10_ih.c+6−0
@@ -373,6 +373,12 @@ static u32 vega10_ih_get_wptr(struct amdgpu_device *adev, · 372 unmodified lines
373373 tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, WPTR_OVERFLOW_CLEAR, 1);
374374 WREG32_NO_KIQ(ih_regs->ih_rb_cntl, tmp);
375375
376+ /* Unset the CLEAR_OVERFLOW bit immediately so new overflows
377+ * can be detected.
378+ */
379+ tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, WPTR_OVERFLOW_CLEAR, 0);
380+ WREG32_NO_KIQ(ih_regs->ih_rb_cntl, tmp);
381+
376382 out:
377383 return (wptr & ih->ptr_mask);
378384 }
drivers/gpu/drm/amd/amdgpu/vega20_ih.c+6−0
@@ -421,6 +421,12 @@ static u32 vega20_ih_get_wptr(struct amdgpu_device *adev, · 420 unmodified lines
421421 tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, WPTR_OVERFLOW_CLEAR, 1);
422422 WREG32_NO_KIQ(ih_regs->ih_rb_cntl, tmp);
423423
424+ /* Unset the CLEAR_OVERFLOW bit immediately so new overflows
425+ * can be detected.
426+ */
427+ tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, WPTR_OVERFLOW_CLEAR, 0);
428+ WREG32_NO_KIQ(ih_regs->ih_rb_cntl, tmp);
429+
424430 out:
425431 return (wptr & ih->ptr_mask);
426432 }
drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h+7−7
@@ -674,7 +674,7 @@ static const uint32_t cwsr_trap_gfx9_hex[] = { · 673 unmodified lines
674674 0x86ea6a6a, 0x8f6e837a,
675675 0xb96ee0c2, 0xbf800002,
676676 0xb97a0002, 0xbf8a0000,
677− 0xbe801f6c, 0xbf810000,
677+ 0xbe801f6c, 0xbf9b0000,
678678 };
679679
680680 static const uint32_t cwsr_trap_nv1x_hex[] = {
@@ -1091,7 +1091,7 @@ static const uint32_t cwsr_trap_nv1x_hex[] = { · 410 unmodified lines
10911091 0xb9eef807, 0x876dff6d,
10921092 0x0000ffff, 0x87fe7e7e,
10931093 0x87ea6a6a, 0xb9faf802,
1094− 0xbe80226c, 0xbf810000,
1094+ 0xbe80226c, 0xbf9b0000,
10951095 0xbf9f0000, 0xbf9f0000,
10961096 0xbf9f0000, 0xbf9f0000,
10971097 0xbf9f0000, 0x00000000,
@@ -1574,7 +1574,7 @@ static const uint32_t cwsr_trap_arcturus_hex[] = { · 476 unmodified lines
15741574 0x86ea6a6a, 0x8f6e837a,
15751575 0xb96ee0c2, 0xbf800002,
15761576 0xb97a0002, 0xbf8a0000,
1577− 0xbe801f6c, 0xbf810000,
1577+ 0xbe801f6c, 0xbf9b0000,
15781578 };
15791579
15801580 static const uint32_t cwsr_trap_aldebaran_hex[] = {
@@ -2065,7 +2065,7 @@ static const uint32_t cwsr_trap_aldebaran_hex[] = { · 484 unmodified lines
20652065 0x86ea6a6a, 0x8f6e837a,
20662066 0xb96ee0c2, 0xbf800002,
20672067 0xb97a0002, 0xbf8a0000,
2068− 0xbe801f6c, 0xbf810000,
2068+ 0xbe801f6c, 0xbf9b0000,
20692069 };
20702070
20712071 static const uint32_t cwsr_trap_gfx10_hex[] = {
@@ -2500,7 +2500,7 @@ static const uint32_t cwsr_trap_gfx10_hex[] = { · 428 unmodified lines
25002500 0x876dff6d, 0x0000ffff,
25012501 0x87fe7e7e, 0x87ea6a6a,
25022502 0xb9faf802, 0xbe80226c,
2503− 0xbf810000, 0xbf9f0000,
2503+ 0xbf9b0000, 0xbf9f0000,
25042504 0xbf9f0000, 0xbf9f0000,
25052505 0xbf9f0000, 0xbf9f0000,
25062506 };
@@ -2944,7 +2944,7 @@ static const uint32_t cwsr_trap_gfx11_hex[] = { · 437 unmodified lines
29442944 0xb8eef802, 0xbf0d866e,
29452945 0xbfa20002, 0xb97af802,
29462946 0xbe80486c, 0xb97af802,
2947− 0xbe804a6c, 0xbfb00000,
2947+ 0xbe804a6c, 0xbfb10000,
29482948 0xbf9f0000, 0xbf9f0000,
29492949 0xbf9f0000, 0xbf9f0000,
29502950 0xbf9f0000, 0x00000000,
@@ -3436,5 +3436,5 @@ static const uint32_t cwsr_trap_gfx9_4_3_hex[] = { · 485 unmodified lines
34363436 0x86ea6a6a, 0x8f6e837a,
34373437 0xb96ee0c2, 0xbf800002,
34383438 0xb97a0002, 0xbf8a0000,
3439− 0xbe801f6c, 0xbf810000,
3439+ 0xbe801f6c, 0xbf9b0000,
34403440 };
drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm+1−1
@@ -1104,7 +1104,7 @@ L_RETURN_WITHOUT_PRIV: · 1103 unmodified lines
11041104 s_rfe_b64 s_restore_pc_lo //Return to the main shader program and resume execution
11051105
11061106 L_END_PGM:
1107− s_endpgm
1107+ s_endpgm_saved
11081108 end
11091109
11101110 function write_hwreg_to_mem(s, s_rsrc, s_mem_offset)
drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx9.asm+1−1
@@ -921,7 +921,7 @@ L_RESTORE: · 920 unmodified lines
921921 /* the END */
922922 /**************************************************************************/
923923 L_END_PGM:
924− s_endpgm
924+ s_endpgm_saved
925925
926926 end
927927
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c+3−1
@@ -1442,7 +1442,9 @@ static int kfd_ioctl_unmap_memory_from_gpu(struct file *filep, · 1441 unmodified lines
14421442 kfd_flush_tlb(peer_pdd, TLB_FLUSH_HEAVYWEIGHT);
14431443
14441444 /* Remove dma mapping after tlb flush to avoid IO_PAGE_FAULT */
1445− amdgpu_amdkfd_gpuvm_dmaunmap_mem(mem, peer_pdd->drm_priv);
1445+ err = amdgpu_amdkfd_gpuvm_dmaunmap_mem(mem, peer_pdd->drm_priv);
1446+ if (err)
1447+ goto sync_memory_failed;
14461448 }
14471449
14481450 mutex_unlock(&p->mutex);
drivers/gpu/drm/amd/amdkfd/kfd_migrate.c+1−1
@@ -574,7 +574,7 @@ svm_migrate_copy_to_ram(struct amdgpu_device *adev, struct svm_range *prange, · 573 unmodified lines
574574 pr_debug("svms 0x%p [0x%lx 0x%lx]\n", prange->svms, prange->start,
575575 prange->last);
576576
577− addr = prange->start << PAGE_SHIFT;
577+ addr = migrate->start;
578578
579579 src = (uint64_t *)(scratch + npages);
580580 dst = scratch;
drivers/gpu/drm/amd/amdkfd/kfd_priv.h+7−2
@@ -1488,10 +1488,15 @@ void kfd_dec_compute_active(struct kfd_node *dev); · 1487 unmodified lines
14881488
14891489 /* Cgroup Support */
14901490 /* Check with device cgroup if @kfd device is accessible */
1491−static inline int kfd_devcgroup_check_permission(struct kfd_node *kfd)
1491+static inline int kfd_devcgroup_check_permission(struct kfd_node *node)
14921492 {
14931493 #if defined(CONFIG_CGROUP_DEVICE) || defined(CONFIG_CGROUP_BPF)
1494− struct drm_device *ddev = adev_to_drm(kfd->adev);
1494+ struct drm_device *ddev;
1495+
1496+ if (node->xcp)
1497+ ddev = node->xcp->ddev;
1498+ else
1499+ ddev = adev_to_drm(node->adev);
14951500
14961501 return devcgroup_check_permission(DEVCG_DEV_CHAR, DRM_MAJOR,
14971502 ddev->render->index,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c+4−0
@@ -9187,6 +9187,10 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) · 9186 unmodified lines
91879187 * To fix this, DC should permit updating only stream properties.
91889188 */
91899189 dummy_updates = kzalloc(sizeof(struct dc_surface_update) * MAX_SURFACES, GFP_ATOMIC);
9190+ if (!dummy_updates) {
9191+ DRM_ERROR("Failed to allocate memory for dummy_updates.\n");
9192+ continue;
9193+ }
91909194 for (j = 0; j < status->plane_count; j++)
91919195 dummy_updates[j].surface = status->plane_states[0];
91929196
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn35/dcn35_clk_mgr.c+16−16
@@ -437,32 +437,32 @@ static struct wm_table ddr5_wm_table = { · 436 unmodified lines
437437 .wm_inst = WM_A,
438438 .wm_type = WM_TYPE_PSTATE_CHG,
439439 .pstate_latency_us = 11.72,
440− .sr_exit_time_us = 14.0,
441− .sr_enter_plus_exit_time_us = 16.0,
440+ .sr_exit_time_us = 28.0,
441+ .sr_enter_plus_exit_time_us = 30.0,
442442 .valid = true,
443443 },
444444 {
445445 .wm_inst = WM_B,
446446 .wm_type = WM_TYPE_PSTATE_CHG,
447447 .pstate_latency_us = 11.72,
448− .sr_exit_time_us = 14.0,
449− .sr_enter_plus_exit_time_us = 16.0,
448+ .sr_exit_time_us = 28.0,
449+ .sr_enter_plus_exit_time_us = 30.0,
450450 .valid = true,
451451 },
452452 {
453453 .wm_inst = WM_C,
454454 .wm_type = WM_TYPE_PSTATE_CHG,
455455 .pstate_latency_us = 11.72,
456− .sr_exit_time_us = 14.0,
457− .sr_enter_plus_exit_time_us = 16.0,
456+ .sr_exit_time_us = 28.0,
457+ .sr_enter_plus_exit_time_us = 30.0,
458458 .valid = true,
459459 },
460460 {
461461 .wm_inst = WM_D,
462462 .wm_type = WM_TYPE_PSTATE_CHG,
463463 .pstate_latency_us = 11.72,
464− .sr_exit_time_us = 14.0,
465− .sr_enter_plus_exit_time_us = 16.0,
464+ .sr_exit_time_us = 28.0,
465+ .sr_enter_plus_exit_time_us = 30.0,
466466 .valid = true,
467467 },
468468 }
@@ -474,32 +474,32 @@ static struct wm_table lpddr5_wm_table = { · 5 unmodified lines
474474 .wm_inst = WM_A,
475475 .wm_type = WM_TYPE_PSTATE_CHG,
476476 .pstate_latency_us = 11.65333,
477− .sr_exit_time_us = 14.0,
478− .sr_enter_plus_exit_time_us = 16.0,
477+ .sr_exit_time_us = 28.0,
478+ .sr_enter_plus_exit_time_us = 30.0,
479479 .valid = true,
480480 },
481481 {
482482 .wm_inst = WM_B,
483483 .wm_type = WM_TYPE_PSTATE_CHG,
484484 .pstate_latency_us = 11.65333,
485− .sr_exit_time_us = 14.0,
486− .sr_enter_plus_exit_time_us = 16.0,
485+ .sr_exit_time_us = 28.0,
486+ .sr_enter_plus_exit_time_us = 30.0,
487487 .valid = true,
488488 },
489489 {
490490 .wm_inst = WM_C,
491491 .wm_type = WM_TYPE_PSTATE_CHG,
492492 .pstate_latency_us = 11.65333,
493− .sr_exit_time_us = 14.0,
494− .sr_enter_plus_exit_time_us = 16.0,
493+ .sr_exit_time_us = 28.0,
494+ .sr_enter_plus_exit_time_us = 30.0,
495495 .valid = true,
496496 },
497497 {
498498 .wm_inst = WM_D,
499499 .wm_type = WM_TYPE_PSTATE_CHG,
500500 .pstate_latency_us = 11.65333,
501− .sr_exit_time_us = 14.0,
502− .sr_enter_plus_exit_time_us = 16.0,
501+ .sr_exit_time_us = 28.0,
502+ .sr_enter_plus_exit_time_us = 30.0,
503503 .valid = true,
504504 },
505505 }
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_dio_link_encoder.c+2−2
@@ -203,12 +203,12 @@ void dcn32_link_encoder_construct( · 202 unmodified lines
203203 enc10->base.hpd_source = init_data->hpd_source;
204204 enc10->base.connector = init_data->connector;
205205
206− if (enc10->base.connector.id == CONNECTOR_ID_USBC)
207− enc10->base.features.flags.bits.DP_IS_USB_C = 1;
208206
209207 enc10->base.preferred_engine = ENGINE_ID_UNKNOWN;
210208
211209 enc10->base.features = *enc_features;
210+ if (enc10->base.connector.id == CONNECTOR_ID_USBC)
211+ enc10->base.features.flags.bits.DP_IS_USB_C = 1;
212212
213213 enc10->base.transmitter = init_data->transmitter;
214214
drivers/gpu/drm/amd/display/dc/dcn35/dcn35_dio_link_encoder.c+2−2
@@ -184,8 +184,6 @@ void dcn35_link_encoder_construct( · 183 unmodified lines
184184 enc10->base.hpd_source = init_data->hpd_source;
185185 enc10->base.connector = init_data->connector;
186186
187− if (enc10->base.connector.id == CONNECTOR_ID_USBC)
188− enc10->base.features.flags.bits.DP_IS_USB_C = 1;
189187
190188 enc10->base.preferred_engine = ENGINE_ID_UNKNOWN;
191189
@@ -240,6 +238,8 @@ void dcn35_link_encoder_construct( · 48 unmodified lines
240238 }
241239
242240 enc10->base.features.flags.bits.HDMI_6GB_EN = 1;
241+ if (enc10->base.connector.id == CONNECTOR_ID_USBC)
242+ enc10->base.features.flags.bits.DP_IS_USB_C = 1;
243243
244244 if (bp_funcs->get_connector_speed_cap_info)
245245 result = bp_funcs->get_connector_speed_cap_info(enc10->base.ctx->dc_bios,
drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c+2−2
@@ -1112,7 +1112,7 @@ struct pipe_slice_table { · 1111 unmodified lines
11121112 struct pipe_ctx *pri_pipe;
11131113 struct dc_plane_state *plane;
11141114 int slice_count;
1115− } mpc_combines[MAX_SURFACES];
1115+ } mpc_combines[MAX_PLANES];
11161116 int mpc_combine_count;
11171117 };
11181118
@@ -2753,7 +2753,7 @@ static int build_synthetic_soc_states(bool disable_dc_mode_overwrite, struct clk · 1634 unmodified lines
27532753 struct _vcs_dpi_voltage_scaling_st entry = {0};
27542754 struct clk_limit_table_entry max_clk_data = {0};
27552755
2756− unsigned int min_dcfclk_mhz = 199, min_fclk_mhz = 299;
2756+ unsigned int min_dcfclk_mhz = 399, min_fclk_mhz = 599;
27572757
27582758 static const unsigned int num_dcfclk_stas = 5;
27592759 unsigned int dcfclk_sta_targets[DC__VOLTAGE_STATES] = {199, 615, 906, 1324, 1564};
drivers/gpu/drm/amd/display/dc/dml/dcn35/dcn35_fpu.c+2−2
@@ -164,8 +164,8 @@ struct _vcs_dpi_soc_bounding_box_st dcn3_5_soc = { · 163 unmodified lines
164164 },
165165 },
166166 .num_states = 5,
167− .sr_exit_time_us = 14.0,
168− .sr_enter_plus_exit_time_us = 16.0,
167+ .sr_exit_time_us = 28.0,
168+ .sr_enter_plus_exit_time_us = 30.0,
169169 .sr_exit_z8_time_us = 210.0,
170170 .sr_enter_plus_exit_z8_time_us = 320.0,
171171 .fclk_change_latency_us = 24.0,
drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c+12−21
@@ -341,9 +341,6 @@ void dml2_init_soc_states(struct dml2_context *dml2, const struct dc *in_dc, · 340 unmodified lines
341341 break;
342342 }
343343
344− if (dml2->config.bbox_overrides.clks_table.num_states)
345− p->in_states->num_states = dml2->config.bbox_overrides.clks_table.num_states;
346−
347344 /* Override from passed values, if available */
348345 for (i = 0; i < p->in_states->num_states; i++) {
349346 if (dml2->config.bbox_overrides.sr_exit_latency_us) {
@@ -400,6 +397,7 @@ void dml2_init_soc_states(struct dml2_context *dml2, const struct dc *in_dc, · 50 unmodified lines
400397 }
401398 /* Copy clocks tables entries, if available */
402399 if (dml2->config.bbox_overrides.clks_table.num_states) {
400+ p->in_states->num_states = dml2->config.bbox_overrides.clks_table.num_states;
403401
404402 for (i = 0; i < dml2->config.bbox_overrides.clks_table.num_entries_per_clk.num_dcfclk_levels; i++) {
405403 p->in_states->state_array[i].dcfclk_mhz = dml2->config.bbox_overrides.clks_table.clk_entries[i].dcfclk_mhz;
@@ -793,35 +791,28 @@ static void populate_dml_surface_cfg_from_plane_state(enum dml_project_id dml2_p · 387 unmodified lines
793791 }
794792 }
795793
796−/*TODO no support for mpc combine, need rework - should calculate scaling params based on plane+stream*/
797−static struct scaler_data get_scaler_data_for_plane(const struct dc_plane_state *in, const struct dc_state *context)
794+static struct scaler_data get_scaler_data_for_plane(const struct dc_plane_state *in, struct dc_state *context)
798795 {
799796 int i;
800− struct scaler_data data = { 0 };
797+ struct pipe_ctx *temp_pipe = &context->res_ctx.temp_pipe;
798+
799+ memset(temp_pipe, 0, sizeof(struct pipe_ctx));
801800
802801 for (i = 0; i < MAX_PIPES; i++) {
803802 const struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
804803
805804 if (pipe->plane_state == in && !pipe->prev_odm_pipe) {
806− const struct pipe_ctx *next_pipe = pipe->next_odm_pipe;
807−
808− data = context->res_ctx.pipe_ctx[i].plane_res.scl_data;
809− while (next_pipe) {
810− data.h_active += next_pipe->plane_res.scl_data.h_active;
811− data.recout.width += next_pipe->plane_res.scl_data.recout.width;
812− if (in->rotation == ROTATION_ANGLE_0 || in->rotation == ROTATION_ANGLE_180) {
813− data.viewport.width += next_pipe->plane_res.scl_data.viewport.width;
814− } else {
815− data.viewport.height += next_pipe->plane_res.scl_data.viewport.height;
816− }
817− next_pipe = next_pipe->next_odm_pipe;
818− }
805+ temp_pipe->stream = pipe->stream;
806+ temp_pipe->plane_state = pipe->plane_state;
807+ temp_pipe->plane_res.scl_data.taps = pipe->plane_res.scl_data.taps;
808+
809+ resource_build_scaling_params(temp_pipe);
819810 break;
820811 }
821812 }
822813
823814 ASSERT(i < MAX_PIPES);
824− return data;
815+ return temp_pipe->plane_res.scl_data;
825816 }
826817
827818 static void populate_dummy_dml_plane_cfg(struct dml_plane_cfg_st *out, unsigned int location, const struct dc_stream_state *in)
@@ -866,7 +857,7 @@ static void populate_dummy_dml_plane_cfg(struct dml_plane_cfg_st *out, unsigned · 38 unmodified lines
866857 out->ScalerEnabled[location] = false;
867858 }
868859
869−static void populate_dml_plane_cfg_from_plane_state(struct dml_plane_cfg_st *out, unsigned int location, const struct dc_plane_state *in, const struct dc_state *context)
860+static void populate_dml_plane_cfg_from_plane_state(struct dml_plane_cfg_st *out, unsigned int location, const struct dc_plane_state *in, struct dc_state *context)
870861 {
871862 const struct scaler_data scaler_data = get_scaler_data_for_plane(in, context);
872863
drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c+1−1
@@ -1183,9 +1183,9 @@ void dce110_disable_stream(struct pipe_ctx *pipe_ctx) · 1182 unmodified lines
11831183 dto_params.timing = &pipe_ctx->stream->timing;
11841184 dp_hpo_inst = pipe_ctx->stream_res.hpo_dp_stream_enc->inst;
11851185 if (dccg) {
1186− dccg->funcs->set_dtbclk_dto(dccg, &dto_params);
11871186 dccg->funcs->disable_symclk32_se(dccg, dp_hpo_inst);
11881187 dccg->funcs->set_dpstreamclk(dccg, REFCLK, tg->inst, dp_hpo_inst);
1188+ dccg->funcs->set_dtbclk_dto(dccg, &dto_params);
11891189 }
11901190 } else if (dccg && dccg->funcs->disable_symclk_se) {
11911191 dccg->funcs->disable_symclk_se(dccg, stream_enc->stream_enc_inst,
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c+5−6
@@ -2790,18 +2790,17 @@ void dcn20_enable_stream(struct pipe_ctx *pipe_ctx) · 2789 unmodified lines
27902790 }
27912791
27922792 if (dc->link_srv->dp_is_128b_132b_signal(pipe_ctx)) {
2793− dp_hpo_inst = pipe_ctx->stream_res.hpo_dp_stream_enc->inst;
2794− dccg->funcs->set_dpstreamclk(dccg, DTBCLK0, tg->inst, dp_hpo_inst);
2795−
2796− phyd32clk = get_phyd32clk_src(link);
2797− dccg->funcs->enable_symclk32_se(dccg, dp_hpo_inst, phyd32clk);
2798−
27992793 dto_params.otg_inst = tg->inst;
28002794 dto_params.pixclk_khz = pipe_ctx->stream->timing.pix_clk_100hz / 10;
28012795 dto_params.num_odm_segments = get_odm_segment_count(pipe_ctx);
28022796 dto_params.timing = &pipe_ctx->stream->timing;
28032797 dto_params.ref_dtbclk_khz = dc->clk_mgr->funcs->get_dtb_ref_clk_frequency(dc->clk_mgr);
28042798 dccg->funcs->set_dtbclk_dto(dccg, &dto_params);
2799+ dp_hpo_inst = pipe_ctx->stream_res.hpo_dp_stream_enc->inst;
2800+ dccg->funcs->set_dpstreamclk(dccg, DTBCLK0, tg->inst, dp_hpo_inst);
2801+
2802+ phyd32clk = get_phyd32clk_src(link);
2803+ dccg->funcs->enable_symclk32_se(dccg, dp_hpo_inst, phyd32clk);
28052804 } else {
28062805 if (dccg->funcs->enable_symclk_se)
28072806 dccg->funcs->enable_symclk_se(dccg, stream_enc->stream_enc_inst,
drivers/gpu/drm/amd/display/dc/inc/core_types.h+2−0
@@ -469,6 +469,8 @@ struct resource_context { · 468 unmodified lines
469469 unsigned int hpo_dp_link_enc_to_link_idx[MAX_HPO_DP2_LINK_ENCODERS];
470470 int hpo_dp_link_enc_ref_cnts[MAX_HPO_DP2_LINK_ENCODERS];
471471 bool is_mpc_3dlut_acquired[MAX_PIPES];
472+ /* solely used for build scalar data in dml2 */
473+ struct pipe_ctx temp_pipe;
472474 };
473475
474476 struct dce_bw_output {
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c+1−1
@@ -196,7 +196,7 @@ static int get_host_router_total_dp_tunnel_bw(const struct dc *dc, uint8_t hr_in · 195 unmodified lines
196196 struct dc_link *link_dpia_primary, *link_dpia_secondary;
197197 int total_bw = 0;
198198
199− for (uint8_t i = 0; i < MAX_PIPES * 2; ++i) {
199+ for (uint8_t i = 0; i < (MAX_PIPES * 2) - 1; ++i) {
200200
201201 if (!dc->links[i] || dc->links[i]->ep_type != DISPLAY_ENDPOINT_USB4_DPIA)
202202 continue;
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c+2−31
@@ -734,7 +734,7 @@ static int smu_early_init(void *handle) · 733 unmodified lines
734734 smu->adev = adev;
735735 smu->pm_enabled = !!amdgpu_dpm;
736736 smu->is_apu = false;
737− smu->smu_baco.state = SMU_BACO_STATE_NONE;
737+ smu->smu_baco.state = SMU_BACO_STATE_EXIT;
738738 smu->smu_baco.platform_support = false;
739739 smu->user_dpm_profile.fan_mode = -1;
740740
@@ -1954,31 +1954,10 @@ static int smu_smc_hw_cleanup(struct smu_context *smu) · 1213 unmodified lines
19541954 return 0;
19551955 }
19561956
1957−static int smu_reset_mp1_state(struct smu_context *smu)
1958−{
1959− struct amdgpu_device *adev = smu->adev;
1960− int ret = 0;
1961−
1962− if ((!adev->in_runpm) && (!adev->in_suspend) &&
1963− (!amdgpu_in_reset(adev)))
1964− switch (amdgpu_ip_version(adev, MP1_HWIP, 0)) {
1965− case IP_VERSION(13, 0, 0):
1966− case IP_VERSION(13, 0, 7):
1967− case IP_VERSION(13, 0, 10):
1968− ret = smu_set_mp1_state(smu, PP_MP1_STATE_UNLOAD);
1969− break;
1970− default:
1971− break;
1972− }
1973−
1974− return ret;
1975−}
1976−
19771957 static int smu_hw_fini(void *handle)
19781958 {
19791959 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
19801960 struct smu_context *smu = adev->powerplay.pp_handle;
1981− int ret;
19821961
19831962 if (amdgpu_sriov_vf(adev) && !amdgpu_sriov_is_pp_one_vf(adev))
19841963 return 0;
@@ -1996,15 +1975,7 @@ static int smu_hw_fini(void *handle) · 11 unmodified lines
19961975
19971976 adev->pm.dpm_enabled = false;
19981977
1999− ret = smu_smc_hw_cleanup(smu);
2000− if (ret)
2001− return ret;
2002−
2003− ret = smu_reset_mp1_state(smu);
2004− if (ret)
2005− return ret;
2006−
2007− return 0;
1978+ return smu_smc_hw_cleanup(smu);
20081979 }
20091980
20101981 static void smu_late_fini(void *handle)
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h+0−1
@@ -424,7 +424,6 @@ enum smu_reset_mode { · 423 unmodified lines
424424 enum smu_baco_state {
425425 SMU_BACO_STATE_ENTER = 0,
426426 SMU_BACO_STATE_EXIT,
427− SMU_BACO_STATE_NONE,
428427 };
429428
430429 struct smu_baco_context {
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c+2−8
@@ -2748,13 +2748,7 @@ static int smu_v13_0_0_set_mp1_state(struct smu_context *smu, · 2747 unmodified lines
27482748
27492749 switch (mp1_state) {
27502750 case PP_MP1_STATE_UNLOAD:
2751− ret = smu_cmn_send_smc_msg_with_param(smu,
2752− SMU_MSG_PrepareMp1ForUnload,
2753− 0x55, NULL);
2754−
2755− if (!ret && smu->smu_baco.state == SMU_BACO_STATE_EXIT)
2756− ret = smu_v13_0_disable_pmfw_state(smu);
2757−
2751+ ret = smu_cmn_set_mp1_state(smu, mp1_state);
27582752 break;
27592753 default:
27602754 /* Ignore others */
@@ -2950,7 +2944,7 @@ static bool smu_v13_0_0_wbrf_support_check(struct smu_context *smu) · 189 unmodified lines
29502944 {
29512945 struct amdgpu_device *adev = smu->adev;
29522946
2953− switch (adev->ip_versions[MP1_HWIP][0]) {
2947+ switch (amdgpu_ip_version(adev, MP1_HWIP, 0)) {
29542948 case IP_VERSION(13, 0, 0):
29552949 return smu->smc_fw_version >= 0x004e6300;
29562950 case IP_VERSION(13, 0, 10):
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c+1−7
@@ -2505,13 +2505,7 @@ static int smu_v13_0_7_set_mp1_state(struct smu_context *smu, · 2504 unmodified lines
25052505
25062506 switch (mp1_state) {
25072507 case PP_MP1_STATE_UNLOAD:
2508− ret = smu_cmn_send_smc_msg_with_param(smu,
2509− SMU_MSG_PrepareMp1ForUnload,
2510− 0x55, NULL);
2511−
2512− if (!ret && smu->smu_baco.state == SMU_BACO_STATE_EXIT)
2513− ret = smu_v13_0_disable_pmfw_state(smu);
2514−
2508+ ret = smu_cmn_set_mp1_state(smu, mp1_state);
25152509 break;
25162510 default:
25172511 /* Ignore others */
drivers/gpu/drm/nouveau/nouveau_fence.c+18−6
@@ -103,6 +103,7 @@ nouveau_fence_context_kill(struct nouveau_fence_chan *fctx, int error) · 102 unmodified lines
103103 void
104104 nouveau_fence_context_del(struct nouveau_fence_chan *fctx)
105105 {
106+ cancel_work_sync(&fctx->uevent_work);
106107 nouveau_fence_context_kill(fctx, 0);
107108 nvif_event_dtor(&fctx->event);
108109 fctx->dead = 1;
@@ -145,12 +146,13 @@ nouveau_fence_update(struct nouveau_channel *chan, struct nouveau_fence_chan *fc · 36 unmodified lines
145146 return drop;
146147 }
147148
148−static int
149−nouveau_fence_wait_uevent_handler(struct nvif_event *event, void *repv, u32 repc)
149+static void
150+nouveau_fence_uevent_work(struct work_struct *work)
150151 {
151− struct nouveau_fence_chan *fctx = container_of(event, typeof(*fctx), event);
152+ struct nouveau_fence_chan *fctx = container_of(work, struct nouveau_fence_chan,
153+ uevent_work);
152154 unsigned long flags;
153− int ret = NVIF_EVENT_KEEP;
155+ int drop = 0;
154156
155157 spin_lock_irqsave(&fctx->lock, flags);
156158 if (!list_empty(&fctx->pending)) {
@@ -160,11 +162,20 @@ nouveau_fence_wait_uevent_handler(struct nvif_event *event, void *repv, u32 repc · 3 unmodified lines
160162 fence = list_entry(fctx->pending.next, typeof(*fence), head);
161163 chan = rcu_dereference_protected(fence->channel, lockdep_is_held(&fctx->lock));
162164 if (nouveau_fence_update(chan, fctx))
163− ret = NVIF_EVENT_DROP;
165+ drop = 1;
164166 }
167+ if (drop)
168+ nvif_event_block(&fctx->event);
169+
165170 spin_unlock_irqrestore(&fctx->lock, flags);
171+}
166172
167− return ret;
173+static int
174+nouveau_fence_wait_uevent_handler(struct nvif_event *event, void *repv, u32 repc)
175+{
176+ struct nouveau_fence_chan *fctx = container_of(event, typeof(*fctx), event);
177+ schedule_work(&fctx->uevent_work);
178+ return NVIF_EVENT_KEEP;
168179 }
169180
170181 void
@@ -178,6 +189,7 @@ nouveau_fence_context_new(struct nouveau_channel *chan, struct nouveau_fence_cha · 7 unmodified lines
178189 } args;
179190 int ret;
180191
192+ INIT_WORK(&fctx->uevent_work, nouveau_fence_uevent_work);
181193 INIT_LIST_HEAD(&fctx->flip);
182194 INIT_LIST_HEAD(&fctx->pending);
183195 spin_lock_init(&fctx->lock);
drivers/gpu/drm/nouveau/nouveau_fence.h+1−0
@@ -44,6 +44,7 @@ struct nouveau_fence_chan { · 43 unmodified lines
4444 u32 context;
4545 char name[32];
4646
47+ struct work_struct uevent_work;
4748 struct nvif_event event;
4849 int notify_ref, dead, killed;
4950 };
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c+1−1
@@ -1078,7 +1078,6 @@ r535_gsp_rpc_set_registry(struct nvkm_gsp *gsp) · 1077 unmodified lines
10781078 if (IS_ERR(rpc))
10791079 return PTR_ERR(rpc);
10801080
1081− rpc->size = sizeof(*rpc);
10821081 rpc->numEntries = NV_GSP_REG_NUM_ENTRIES;
10831082
10841083 str_offset = offsetof(typeof(*rpc), entries[NV_GSP_REG_NUM_ENTRIES]);
@@ -1094,6 +1093,7 @@ r535_gsp_rpc_set_registry(struct nvkm_gsp *gsp) · 9 unmodified lines
10941093 strings += name_len;
10951094 str_offset += name_len;
10961095 }
1096+ rpc->size = str_offset;
10971097
10981098 return nvkm_gsp_rpc_wr(gsp, rpc, false);
10991099 }
drivers/gpu/drm/tegra/drm.c+2−1
@@ -960,7 +960,8 @@ int host1x_client_iommu_attach(struct host1x_client *client) · 959 unmodified lines
960960 * not the shared IOMMU domain, don't try to attach it to a different
961961 * domain. This allows using the IOMMU-backed DMA API.
962962 */
963− if (domain && domain != tegra->domain)
963+ if (domain && domain->type != IOMMU_DOMAIN_IDENTITY &&
964+ domain != tegra->domain)
964965 return 0;
965966
966967 if (tegra->domain) {
drivers/gpu/drm/virtio/virtgpu_drv.c+1−0
@@ -94,6 +94,7 @@ static int virtio_gpu_probe(struct virtio_device *vdev) · 93 unmodified lines
9494 goto err_free;
9595 }
9696
97+ dma_set_max_seg_size(dev->dev, dma_max_mapping_size(dev->dev) ?: UINT_MAX);
9798 ret = virtio_gpu_init(vdev, dev);
9899 if (ret)
99100 goto err_free;
drivers/gpu/drm/xe/abi/guc_actions_abi.h+2−2
@@ -50,8 +50,8 @@ · 49 unmodified lines
5050
5151 #define HOST2GUC_SELF_CFG_REQUEST_MSG_LEN (GUC_HXG_REQUEST_MSG_MIN_LEN + 3u)
5252 #define HOST2GUC_SELF_CFG_REQUEST_MSG_0_MBZ GUC_HXG_REQUEST_MSG_0_DATA0
53−#define HOST2GUC_SELF_CFG_REQUEST_MSG_1_KLV_KEY (0xffff << 16)
54−#define HOST2GUC_SELF_CFG_REQUEST_MSG_1_KLV_LEN (0xffff << 0)
53+#define HOST2GUC_SELF_CFG_REQUEST_MSG_1_KLV_KEY (0xffffu << 16)
54+#define HOST2GUC_SELF_CFG_REQUEST_MSG_1_KLV_LEN (0xffffu << 0)
5555 #define HOST2GUC_SELF_CFG_REQUEST_MSG_2_VALUE32 GUC_HXG_REQUEST_MSG_n_DATAn
5656 #define HOST2GUC_SELF_CFG_REQUEST_MSG_3_VALUE64 GUC_HXG_REQUEST_MSG_n_DATAn
5757
drivers/gpu/drm/xe/abi/guc_actions_slpc_abi.h+2−2
@@ -242,8 +242,8 @@ struct slpc_shared_data { · 241 unmodified lines
242242 (HOST2GUC_PC_SLPC_REQUEST_REQUEST_MSG_MIN_LEN + \
243243 HOST2GUC_PC_SLPC_EVENT_MAX_INPUT_ARGS)
244244 #define HOST2GUC_PC_SLPC_REQUEST_MSG_0_MBZ GUC_HXG_REQUEST_MSG_0_DATA0
245−#define HOST2GUC_PC_SLPC_REQUEST_MSG_1_EVENT_ID (0xff << 8)
246−#define HOST2GUC_PC_SLPC_REQUEST_MSG_1_EVENT_ARGC (0xff << 0)
245+#define HOST2GUC_PC_SLPC_REQUEST_MSG_1_EVENT_ID (0xffu << 8)
246+#define HOST2GUC_PC_SLPC_REQUEST_MSG_1_EVENT_ARGC (0xffu << 0)
247247 #define HOST2GUC_PC_SLPC_REQUEST_MSG_N_EVENT_DATA_N GUC_HXG_REQUEST_MSG_n_DATAn
248248
249249 #endif
drivers/gpu/drm/xe/abi/guc_communication_ctb_abi.h+4−4
@@ -82,11 +82,11 @@ static_assert(sizeof(struct guc_ct_buffer_desc) == 64); · 81 unmodified lines
8282 #define GUC_CTB_HDR_LEN 1u
8383 #define GUC_CTB_MSG_MIN_LEN GUC_CTB_HDR_LEN
8484 #define GUC_CTB_MSG_MAX_LEN 256u
85−#define GUC_CTB_MSG_0_FENCE (0xffff << 16)
86−#define GUC_CTB_MSG_0_FORMAT (0xf << 12)
85+#define GUC_CTB_MSG_0_FENCE (0xffffu << 16)
86+#define GUC_CTB_MSG_0_FORMAT (0xfu << 12)
8787 #define GUC_CTB_FORMAT_HXG 0u
88−#define GUC_CTB_MSG_0_RESERVED (0xf << 8)
89−#define GUC_CTB_MSG_0_NUM_DWORDS (0xff << 0)
88+#define GUC_CTB_MSG_0_RESERVED (0xfu << 8)
89+#define GUC_CTB_MSG_0_NUM_DWORDS (0xffu << 0)
9090
9191 /**
9292 * DOC: CTB HXG Message
drivers/gpu/drm/xe/abi/guc_klvs_abi.h+3−3
@@ -31,9 +31,9 @@ · 30 unmodified lines
3131 */
3232
3333 #define GUC_KLV_LEN_MIN 1u
34−#define GUC_KLV_0_KEY (0xffff << 16)
35−#define GUC_KLV_0_LEN (0xffff << 0)
36−#define GUC_KLV_n_VALUE (0xffffffff << 0)
34+#define GUC_KLV_0_KEY (0xffffu << 16)
35+#define GUC_KLV_0_LEN (0xffffu << 0)
36+#define GUC_KLV_n_VALUE (0xffffffffu << 0)
3737
3838 /**
3939 * DOC: GuC Self Config KLVs
drivers/gpu/drm/xe/abi/guc_messages_abi.h+10−10
@@ -40,18 +40,18 @@ · 39 unmodified lines
4040 */
4141
4242 #define GUC_HXG_MSG_MIN_LEN 1u
43−#define GUC_HXG_MSG_0_ORIGIN (0x1 << 31)
43+#define GUC_HXG_MSG_0_ORIGIN (0x1u << 31)
4444 #define GUC_HXG_ORIGIN_HOST 0u
4545 #define GUC_HXG_ORIGIN_GUC 1u
46−#define GUC_HXG_MSG_0_TYPE (0x7 << 28)
46+#define GUC_HXG_MSG_0_TYPE (0x7u << 28)
4747 #define GUC_HXG_TYPE_REQUEST 0u
4848 #define GUC_HXG_TYPE_EVENT 1u
4949 #define GUC_HXG_TYPE_NO_RESPONSE_BUSY 3u
5050 #define GUC_HXG_TYPE_NO_RESPONSE_RETRY 5u
5151 #define GUC_HXG_TYPE_RESPONSE_FAILURE 6u
5252 #define GUC_HXG_TYPE_RESPONSE_SUCCESS 7u
53−#define GUC_HXG_MSG_0_AUX (0xfffffff << 0)
54−#define GUC_HXG_MSG_n_PAYLOAD (0xffffffff << 0)
53+#define GUC_HXG_MSG_0_AUX (0xfffffffu << 0)
54+#define GUC_HXG_MSG_n_PAYLOAD (0xffffffffu << 0)
5555
5656 /**
5757 * DOC: HXG Request
@@ -85,8 +85,8 @@ · 27 unmodified lines
8585 */
8686
8787 #define GUC_HXG_REQUEST_MSG_MIN_LEN GUC_HXG_MSG_MIN_LEN
88−#define GUC_HXG_REQUEST_MSG_0_DATA0 (0xfff << 16)
89−#define GUC_HXG_REQUEST_MSG_0_ACTION (0xffff << 0)
88+#define GUC_HXG_REQUEST_MSG_0_DATA0 (0xfffu << 16)
89+#define GUC_HXG_REQUEST_MSG_0_ACTION (0xffffu << 0)
9090 #define GUC_HXG_REQUEST_MSG_n_DATAn GUC_HXG_MSG_n_PAYLOAD
9191
9292 /**
@@ -117,8 +117,8 @@ · 24 unmodified lines
117117 */
118118
119119 #define GUC_HXG_EVENT_MSG_MIN_LEN GUC_HXG_MSG_MIN_LEN
120−#define GUC_HXG_EVENT_MSG_0_DATA0 (0xfff << 16)
121−#define GUC_HXG_EVENT_MSG_0_ACTION (0xffff << 0)
120+#define GUC_HXG_EVENT_MSG_0_DATA0 (0xfffu << 16)
121+#define GUC_HXG_EVENT_MSG_0_ACTION (0xffffu << 0)
122122 #define GUC_HXG_EVENT_MSG_n_DATAn GUC_HXG_MSG_n_PAYLOAD
123123
124124 /**
@@ -188,8 +188,8 @@ · 63 unmodified lines
188188 */
189189
190190 #define GUC_HXG_FAILURE_MSG_LEN GUC_HXG_MSG_MIN_LEN
191−#define GUC_HXG_FAILURE_MSG_0_HINT (0xfff << 16)
192−#define GUC_HXG_FAILURE_MSG_0_ERROR (0xffff << 0)
191+#define GUC_HXG_FAILURE_MSG_0_HINT (0xfffu << 16)
192+#define GUC_HXG_FAILURE_MSG_0_ERROR (0xffffu << 0)
193193
194194 /**
195195 * DOC: HXG Response
drivers/gpu/drm/xe/xe_exec.c+9−1
@@ -111,7 +111,7 @@ int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file) · 110 unmodified lines
111111 u64 addresses[XE_HW_ENGINE_MAX_INSTANCE];
112112 struct drm_gpuvm_exec vm_exec = {.extra.fn = xe_exec_fn};
113113 struct drm_exec *exec = &vm_exec.exec;
114− u32 i, num_syncs = 0;
114+ u32 i, num_syncs = 0, num_ufence = 0;
115115 struct xe_sched_job *job;
116116 struct dma_fence *rebind_fence;
117117 struct xe_vm *vm;
@@ -157,6 +157,14 @@ int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file) · 39 unmodified lines
157157 SYNC_PARSE_FLAG_LR_MODE : 0));
158158 if (err)
159159 goto err_syncs;
160+
161+ if (xe_sync_is_ufence(&syncs[i]))
162+ num_ufence++;
163+ }
164+
165+ if (XE_IOCTL_DBG(xe, num_ufence > 1)) {
166+ err = -EINVAL;
167+ goto err_syncs;
160168 }
161169
162170 if (xe_exec_queue_is_parallel(q)) {
drivers/gpu/drm/xe/xe_gt_mcr.c+2−2
@@ -480,7 +480,7 @@ static bool xe_gt_mcr_get_nonterminated_steering(struct xe_gt *gt, · 479 unmodified lines
480480 * to synchronize with external clients (e.g., firmware), so a semaphore
481481 * register will also need to be taken.
482482 */
483−static void mcr_lock(struct xe_gt *gt)
483+static void mcr_lock(struct xe_gt *gt) __acquires(&gt->mcr_lock)
484484 {
485485 struct xe_device *xe = gt_to_xe(gt);
486486 int ret = 0;
@@ -500,7 +500,7 @@ static void mcr_lock(struct xe_gt *gt) · 13 unmodified lines
500500 drm_WARN_ON_ONCE(&xe->drm, ret == -ETIMEDOUT);
501501 }
502502
503−static void mcr_unlock(struct xe_gt *gt)
503+static void mcr_unlock(struct xe_gt *gt) __releases(&gt->mcr_lock)
504504 {
505505 /* Release hardware semaphore - this is done by writing 1 to the register */
506506 if (GRAPHICS_VERx100(gt_to_xe(gt)) >= 1270)
drivers/gpu/drm/xe/xe_gt_pagefault.c+7−4
@@ -165,7 +165,8 @@ retry_userptr: · 164 unmodified lines
165165 goto unlock_vm;
166166 }
167167
168− if (!xe_vma_is_userptr(vma) || !xe_vma_userptr_check_repin(vma)) {
168+ if (!xe_vma_is_userptr(vma) ||
169+ !xe_vma_userptr_check_repin(to_userptr_vma(vma))) {
169170 downgrade_write(&vm->lock);
170171 write_locked = false;
171172 }
@@ -181,11 +182,13 @@ retry_userptr: · 9 unmodified lines
181182 /* TODO: Validate fault */
182183
183184 if (xe_vma_is_userptr(vma) && write_locked) {
185+ struct xe_userptr_vma *uvma = to_userptr_vma(vma);
186+
184187 spin_lock(&vm->userptr.invalidated_lock);
185− list_del_init(&vma->userptr.invalidate_link);
188+ list_del_init(&uvma->userptr.invalidate_link);
186189 spin_unlock(&vm->userptr.invalidated_lock);
187190
188− ret = xe_vma_userptr_pin_pages(vma);
191+ ret = xe_vma_userptr_pin_pages(uvma);
189192 if (ret)
190193 goto unlock_vm;
191194
@@ -220,7 +223,7 @@ retry_userptr: · 28 unmodified lines
220223 dma_fence_put(fence);
221224
222225 if (xe_vma_is_userptr(vma))
223− ret = xe_vma_userptr_check_repin(vma);
226+ ret = xe_vma_userptr_check_repin(to_userptr_vma(vma));
224227 vma->usm.tile_invalidated &= ~BIT(tile->id);
225228
226229 unlock_dma_resv:
drivers/gpu/drm/xe/xe_guc_pc.c+2−0
@@ -963,7 +963,9 @@ void xe_guc_pc_fini(struct xe_guc_pc *pc) · 962 unmodified lines
963963 struct xe_device *xe = pc_to_xe(pc);
964964
965965 if (xe->info.skip_guc_pc) {
966+ xe_device_mem_access_get(xe);
966967 xe_gt_idle_disable_c6(pc_to_gt(pc));
968+ xe_device_mem_access_put(xe);
967969 return;
968970 }
969971
drivers/gpu/drm/xe/xe_hw_fence.c+3−3
@@ -217,13 +217,13 @@ struct xe_hw_fence *xe_hw_fence_create(struct xe_hw_fence_ctx *ctx, · 216 unmodified lines
217217 if (!fence)
218218 return ERR_PTR(-ENOMEM);
219219
220− dma_fence_init(&fence->dma, &xe_hw_fence_ops, &ctx->irq->lock,
221− ctx->dma_fence_ctx, ctx->next_seqno++);
222−
223220 fence->ctx = ctx;
224221 fence->seqno_map = seqno_map;
225222 INIT_LIST_HEAD(&fence->irq_link);
226223
224+ dma_fence_init(&fence->dma, &xe_hw_fence_ops, &ctx->irq->lock,
225+ ctx->dma_fence_ctx, ctx->next_seqno++);
226+
227227 trace_xe_hw_fence_create(fence);
228228
229229 return fence;
drivers/gpu/drm/xe/xe_lrc.c+7−7
@@ -21,10 +21,10 @@ · 20 unmodified lines
2121 #include "xe_map.h"
2222 #include "xe_vm.h"
2323
24−#define CTX_VALID (1 << 0)
25−#define CTX_PRIVILEGE (1 << 8)
26−#define CTX_ADDRESSING_MODE_SHIFT 3
27−#define LEGACY_64B_CONTEXT 3
24+#define LRC_VALID (1 << 0)
25+#define LRC_PRIVILEGE (1 << 8)
26+#define LRC_ADDRESSING_MODE_SHIFT 3
27+#define LRC_LEGACY_64B_CONTEXT 3
2828
2929 #define ENGINE_CLASS_SHIFT 61
3030 #define ENGINE_INSTANCE_SHIFT 48
@@ -762,15 +762,15 @@ int xe_lrc_init(struct xe_lrc *lrc, struct xe_hw_engine *hwe, · 731 unmodified lines
762762 (q->usm.acc_notify << ACC_NOTIFY_S) |
763763 q->usm.acc_trigger);
764764
765− lrc->desc = CTX_VALID;
766− lrc->desc |= LEGACY_64B_CONTEXT << CTX_ADDRESSING_MODE_SHIFT;
765+ lrc->desc = LRC_VALID;
766+ lrc->desc |= LRC_LEGACY_64B_CONTEXT << LRC_ADDRESSING_MODE_SHIFT;
767767 /* TODO: Priority */
768768
769769 /* While this appears to have something about privileged batches or
770770 * some such, it really just means PPGTT mode.
771771 */
772772 if (vm)
773− lrc->desc |= CTX_PRIVILEGE;
773+ lrc->desc |= LRC_PRIVILEGE;
774774
775775 if (GRAPHICS_VERx100(xe) < 1250) {
776776 lrc->desc |= (u64)hwe->instance << ENGINE_INSTANCE_SHIFT;
drivers/gpu/drm/xe/xe_pt.c+16−16
@@ -618,8 +618,8 @@ xe_pt_stage_bind(struct xe_tile *tile, struct xe_vma *vma, · 617 unmodified lines
618618
619619 if (!xe_vma_is_null(vma)) {
620620 if (xe_vma_is_userptr(vma))
621− xe_res_first_sg(vma->userptr.sg, 0, xe_vma_size(vma),
622− &curs);
621+ xe_res_first_sg(to_userptr_vma(vma)->userptr.sg, 0,
622+ xe_vma_size(vma), &curs);
623623 else if (xe_bo_is_vram(bo) || xe_bo_is_stolen(bo))
624624 xe_res_first(bo->ttm.resource, xe_vma_bo_offset(vma),
625625 xe_vma_size(vma), &curs);
@@ -906,17 +906,17 @@ static void xe_vm_dbg_print_entries(struct xe_device *xe, · 280 unmodified lines
906906
907907 #ifdef CONFIG_DRM_XE_USERPTR_INVAL_INJECT
908908
909−static int xe_pt_userptr_inject_eagain(struct xe_vma *vma)
909+static int xe_pt_userptr_inject_eagain(struct xe_userptr_vma *uvma)
910910 {
911− u32 divisor = vma->userptr.divisor ? vma->userptr.divisor : 2;
911+ u32 divisor = uvma->userptr.divisor ? uvma->userptr.divisor : 2;
912912 static u32 count;
913913
914914 if (count++ % divisor == divisor - 1) {
915− struct xe_vm *vm = xe_vma_vm(vma);
915+ struct xe_vm *vm = xe_vma_vm(&uvma->vma);
916916
917− vma->userptr.divisor = divisor << 1;
917+ uvma->userptr.divisor = divisor << 1;
918918 spin_lock(&vm->userptr.invalidated_lock);
919− list_move_tail(&vma->userptr.invalidate_link,
919+ list_move_tail(&uvma->userptr.invalidate_link,
920920 &vm->userptr.invalidated);
921921 spin_unlock(&vm->userptr.invalidated_lock);
922922 return true;
@@ -927,7 +927,7 @@ static int xe_pt_userptr_inject_eagain(struct xe_vma *vma) · 4 unmodified lines
927927
928928 #else
929929
930−static bool xe_pt_userptr_inject_eagain(struct xe_vma *vma)
930+static bool xe_pt_userptr_inject_eagain(struct xe_userptr_vma *uvma)
931931 {
932932 return false;
933933 }
@@ -1000,9 +1000,9 @@ static int xe_pt_userptr_pre_commit(struct xe_migrate_pt_update *pt_update) · 66 unmodified lines
10001000 {
10011001 struct xe_pt_migrate_pt_update *userptr_update =
10021002 container_of(pt_update, typeof(*userptr_update), base);
1003− struct xe_vma *vma = pt_update->vma;
1004− unsigned long notifier_seq = vma->userptr.notifier_seq;
1005− struct xe_vm *vm = xe_vma_vm(vma);
1003+ struct xe_userptr_vma *uvma = to_userptr_vma(pt_update->vma);
1004+ unsigned long notifier_seq = uvma->userptr.notifier_seq;
1005+ struct xe_vm *vm = xe_vma_vm(&uvma->vma);
10061006 int err = xe_pt_vm_dependencies(pt_update->job,
10071007 &vm->rftree[pt_update->tile_id],
10081008 pt_update->start,
@@ -1023,7 +1023,7 @@ static int xe_pt_userptr_pre_commit(struct xe_migrate_pt_update *pt_update) · 14 unmodified lines
10231023 */
10241024 do {
10251025 down_read(&vm->userptr.notifier_lock);
1026− if (!mmu_interval_read_retry(&vma->userptr.notifier,
1026+ if (!mmu_interval_read_retry(&uvma->userptr.notifier,
10271027 notifier_seq))
10281028 break;
10291029
@@ -1032,11 +1032,11 @@ static int xe_pt_userptr_pre_commit(struct xe_migrate_pt_update *pt_update) · 2 unmodified lines
10321032 if (userptr_update->bind)
10331033 return -EAGAIN;
10341034
1035− notifier_seq = mmu_interval_read_begin(&vma->userptr.notifier);
1035+ notifier_seq = mmu_interval_read_begin(&uvma->userptr.notifier);
10361036 } while (true);
10371037
10381038 /* Inject errors to test_whether they are handled correctly */
1039− if (userptr_update->bind && xe_pt_userptr_inject_eagain(vma)) {
1039+ if (userptr_update->bind && xe_pt_userptr_inject_eagain(uvma)) {
10401040 up_read(&vm->userptr.notifier_lock);
10411041 return -EAGAIN;
10421042 }
@@ -1297,7 +1297,7 @@ __xe_pt_bind_vma(struct xe_tile *tile, struct xe_vma *vma, struct xe_exec_queue · 254 unmodified lines
12971297 vma->tile_present |= BIT(tile->id);
12981298
12991299 if (bind_pt_update.locked) {
1300− vma->userptr.initial_bind = true;
1300+ to_userptr_vma(vma)->userptr.initial_bind = true;
13011301 up_read(&vm->userptr.notifier_lock);
13021302 xe_bo_put_commit(&deferred);
13031303 }
@@ -1642,7 +1642,7 @@ __xe_pt_unbind_vma(struct xe_tile *tile, struct xe_vma *vma, struct xe_exec_queu · 338 unmodified lines
16421642
16431643 if (!vma->tile_present) {
16441644 spin_lock(&vm->userptr.invalidated_lock);
1645− list_del_init(&vma->userptr.invalidate_link);
1645+ list_del_init(&to_userptr_vma(vma)->userptr.invalidate_link);
16461646 spin_unlock(&vm->userptr.invalidated_lock);
16471647 }
16481648 up_read(&vm->userptr.notifier_lock);
drivers/gpu/drm/xe/xe_query.c+25−25
@@ -459,21 +459,21 @@ static size_t calc_topo_query_size(struct xe_device *xe) · 458 unmodified lines
459459 sizeof_field(struct xe_gt, fuse_topo.eu_mask_per_dss));
460460 }
461461
462−static void __user *copy_mask(void __user *ptr,
463− struct drm_xe_query_topology_mask *topo,
464− void *mask, size_t mask_size)
462+static int copy_mask(void __user **ptr,
463+ struct drm_xe_query_topology_mask *topo,
464+ void *mask, size_t mask_size)
465465 {
466466 topo->num_bytes = mask_size;
467467
468− if (copy_to_user(ptr, topo, sizeof(*topo)))
469− return ERR_PTR(-EFAULT);
470− ptr += sizeof(topo);
468+ if (copy_to_user(*ptr, topo, sizeof(*topo)))
469+ return -EFAULT;
470+ *ptr += sizeof(topo);
471471
472− if (copy_to_user(ptr, mask, mask_size))
473− return ERR_PTR(-EFAULT);
474− ptr += mask_size;
472+ if (copy_to_user(*ptr, mask, mask_size))
473+ return -EFAULT;
474+ *ptr += mask_size;
475475
476− return ptr;
476+ return 0;
477477 }
478478
479479 static int query_gt_topology(struct xe_device *xe,
@@ -493,28 +493,28 @@ static int query_gt_topology(struct xe_device *xe, · 13 unmodified lines
493493 }
494494
495495 for_each_gt(gt, xe, id) {
496+ int err;
497+
496498 topo.gt_id = id;
497499
498500 topo.type = DRM_XE_TOPO_DSS_GEOMETRY;
499− query_ptr = copy_mask(query_ptr, &topo,
500− gt->fuse_topo.g_dss_mask,
501− sizeof(gt->fuse_topo.g_dss_mask));
502− if (IS_ERR(query_ptr))
503− return PTR_ERR(query_ptr);
501+ err = copy_mask(&query_ptr, &topo, gt->fuse_topo.g_dss_mask,
502+ sizeof(gt->fuse_topo.g_dss_mask));
503+ if (err)
504+ return err;
504505
505506 topo.type = DRM_XE_TOPO_DSS_COMPUTE;
506− query_ptr = copy_mask(query_ptr, &topo,
507− gt->fuse_topo.c_dss_mask,
508− sizeof(gt->fuse_topo.c_dss_mask));
509− if (IS_ERR(query_ptr))
510− return PTR_ERR(query_ptr);
507+ err = copy_mask(&query_ptr, &topo, gt->fuse_topo.c_dss_mask,
508+ sizeof(gt->fuse_topo.c_dss_mask));
509+ if (err)
510+ return err;
511511
512512 topo.type = DRM_XE_TOPO_EU_PER_DSS;
513− query_ptr = copy_mask(query_ptr, &topo,
514− gt->fuse_topo.eu_mask_per_dss,
515− sizeof(gt->fuse_topo.eu_mask_per_dss));
516− if (IS_ERR(query_ptr))
517− return PTR_ERR(query_ptr);
513+ err = copy_mask(&query_ptr, &topo,
514+ gt->fuse_topo.eu_mask_per_dss,
515+ sizeof(gt->fuse_topo.eu_mask_per_dss));
516+ if (err)
517+ return err;
518518 }
519519
520520 return 0;
drivers/gpu/drm/xe/xe_sync.h+5−0
@@ -33,4 +33,9 @@ struct dma_fence * · 32 unmodified lines
3333 xe_sync_in_fence_get(struct xe_sync_entry *sync, int num_sync,
3434 struct xe_exec_queue *q, struct xe_vm *vm);
3535
36+static inline bool xe_sync_is_ufence(struct xe_sync_entry *sync)
37+{
38+ return !!sync->ufence;
39+}
40+
3641 #endif
drivers/gpu/drm/xe/xe_vm.c+99−66
@@ -46,7 +46,7 @@ static struct drm_gem_object *xe_vm_obj(struct xe_vm *vm) · 45 unmodified lines
4646
4747 /**
4848 * xe_vma_userptr_check_repin() - Advisory check for repin needed
49− * @vma: The userptr vma
49+ * @uvma: The userptr vma
5050 *
5151 * Check if the userptr vma has been invalidated since last successful
5252 * repin. The check is advisory only and can the function can be called
@@ -56,15 +56,17 @@ static struct drm_gem_object *xe_vm_obj(struct xe_vm *vm) · 3 unmodified lines
5656 *
5757 * Return: 0 if userptr vma is valid, -EAGAIN otherwise; repin recommended.
5858 */
59−int xe_vma_userptr_check_repin(struct xe_vma *vma)
59+int xe_vma_userptr_check_repin(struct xe_userptr_vma *uvma)
6060 {
61− return mmu_interval_check_retry(&vma->userptr.notifier,
62− vma->userptr.notifier_seq) ?
61+ return mmu_interval_check_retry(&uvma->userptr.notifier,
62+ uvma->userptr.notifier_seq) ?
6363 -EAGAIN : 0;
6464 }
6565
66−int xe_vma_userptr_pin_pages(struct xe_vma *vma)
66+int xe_vma_userptr_pin_pages(struct xe_userptr_vma *uvma)
6767 {
68+ struct xe_userptr *userptr = &uvma->userptr;
69+ struct xe_vma *vma = &uvma->vma;
6870 struct xe_vm *vm = xe_vma_vm(vma);
6971 struct xe_device *xe = vm->xe;
7072 const unsigned long num_pages = xe_vma_size(vma) >> PAGE_SHIFT;
@@ -80,30 +82,30 @@ retry: · 9 unmodified lines
8082 if (vma->gpuva.flags & XE_VMA_DESTROYED)
8183 return 0;
8284
83− notifier_seq = mmu_interval_read_begin(&vma->userptr.notifier);
84− if (notifier_seq == vma->userptr.notifier_seq)
85+ notifier_seq = mmu_interval_read_begin(&userptr->notifier);
86+ if (notifier_seq == userptr->notifier_seq)
8587 return 0;
8688
8789 pages = kvmalloc_array(num_pages, sizeof(*pages), GFP_KERNEL);
8890 if (!pages)
8991 return -ENOMEM;
9092
91− if (vma->userptr.sg) {
93+ if (userptr->sg) {
9294 dma_unmap_sgtable(xe->drm.dev,
93− vma->userptr.sg,
95+ userptr->sg,
9496 read_only ? DMA_TO_DEVICE :
9597 DMA_BIDIRECTIONAL, 0);
96− sg_free_table(vma->userptr.sg);
97− vma->userptr.sg = NULL;
98+ sg_free_table(userptr->sg);
99+ userptr->sg = NULL;
98100 }
99101
100102 pinned = ret = 0;
101103 if (in_kthread) {
102− if (!mmget_not_zero(vma->userptr.notifier.mm)) {
104+ if (!mmget_not_zero(userptr->notifier.mm)) {
103105 ret = -EFAULT;
104106 goto mm_closed;
105107 }
106− kthread_use_mm(vma->userptr.notifier.mm);
108+ kthread_use_mm(userptr->notifier.mm);
107109 }
108110
109111 while (pinned < num_pages) {
@@ -123,32 +125,32 @@ retry: · 13 unmodified lines
123125 }
124126
125127 if (in_kthread) {
126− kthread_unuse_mm(vma->userptr.notifier.mm);
127− mmput(vma->userptr.notifier.mm);
128+ kthread_unuse_mm(userptr->notifier.mm);
129+ mmput(userptr->notifier.mm);
128130 }
129131 mm_closed:
130132 if (ret)
131133 goto out;
132134
133− ret = sg_alloc_table_from_pages_segment(&vma->userptr.sgt, pages,
135+ ret = sg_alloc_table_from_pages_segment(&userptr->sgt, pages,
134136 pinned, 0,
135137 (u64)pinned << PAGE_SHIFT,
136138 xe_sg_segment_size(xe->drm.dev),
137139 GFP_KERNEL);
138140 if (ret) {
139− vma->userptr.sg = NULL;
141+ userptr->sg = NULL;
140142 goto out;
141143 }
142− vma->userptr.sg = &vma->userptr.sgt;
144+ userptr->sg = &userptr->sgt;
143145
144− ret = dma_map_sgtable(xe->drm.dev, vma->userptr.sg,
146+ ret = dma_map_sgtable(xe->drm.dev, userptr->sg,
145147 read_only ? DMA_TO_DEVICE :
146148 DMA_BIDIRECTIONAL,
147149 DMA_ATTR_SKIP_CPU_SYNC |
148150 DMA_ATTR_NO_KERNEL_MAPPING);
149151 if (ret) {
150− sg_free_table(vma->userptr.sg);
151− vma->userptr.sg = NULL;
152+ sg_free_table(userptr->sg);
153+ userptr->sg = NULL;
152154 goto out;
153155 }
154156
@@ -167,8 +169,8 @@ out: · 12 unmodified lines
167169 kvfree(pages);
168170
169171 if (!(ret < 0)) {
170− vma->userptr.notifier_seq = notifier_seq;
171− if (xe_vma_userptr_check_repin(vma) == -EAGAIN)
172+ userptr->notifier_seq = notifier_seq;
173+ if (xe_vma_userptr_check_repin(uvma) == -EAGAIN)
172174 goto retry;
173175 }
174176
@@ -635,7 +637,9 @@ static bool vma_userptr_invalidate(struct mmu_interval_notifier *mni, · 460 unmodified lines
635637 const struct mmu_notifier_range *range,
636638 unsigned long cur_seq)
637639 {
638− struct xe_vma *vma = container_of(mni, struct xe_vma, userptr.notifier);
640+ struct xe_userptr *userptr = container_of(mni, typeof(*userptr), notifier);
641+ struct xe_userptr_vma *uvma = container_of(userptr, typeof(*uvma), userptr);
642+ struct xe_vma *vma = &uvma->vma;
639643 struct xe_vm *vm = xe_vma_vm(vma);
640644 struct dma_resv_iter cursor;
641645 struct dma_fence *fence;
@@ -651,7 +655,7 @@ static bool vma_userptr_invalidate(struct mmu_interval_notifier *mni, · 9 unmodified lines
651655 mmu_interval_set_seq(mni, cur_seq);
652656
653657 /* No need to stop gpu access if the userptr is not yet bound. */
654− if (!vma->userptr.initial_bind) {
658+ if (!userptr->initial_bind) {
655659 up_write(&vm->userptr.notifier_lock);
656660 return true;
657661 }
@@ -663,7 +667,7 @@ static bool vma_userptr_invalidate(struct mmu_interval_notifier *mni, · 5 unmodified lines
663667 if (!xe_vm_in_fault_mode(vm) &&
664668 !(vma->gpuva.flags & XE_VMA_DESTROYED) && vma->tile_present) {
665669 spin_lock(&vm->userptr.invalidated_lock);
666− list_move_tail(&vma->userptr.invalidate_link,
670+ list_move_tail(&userptr->invalidate_link,
667671 &vm->userptr.invalidated);
668672 spin_unlock(&vm->userptr.invalidated_lock);
669673 }
@@ -703,7 +707,7 @@ static const struct mmu_interval_notifier_ops vma_userptr_notifier_ops = { · 33 unmodified lines
703707
704708 int xe_vm_userptr_pin(struct xe_vm *vm)
705709 {
706− struct xe_vma *vma, *next;
710+ struct xe_userptr_vma *uvma, *next;
707711 int err = 0;
708712 LIST_HEAD(tmp_evict);
709713
@@ -711,22 +715,23 @@ int xe_vm_userptr_pin(struct xe_vm *vm) · 1 unmodified line
711715
712716 /* Collect invalidated userptrs */
713717 spin_lock(&vm->userptr.invalidated_lock);
714− list_for_each_entry_safe(vma, next, &vm->userptr.invalidated,
718+ list_for_each_entry_safe(uvma, next, &vm->userptr.invalidated,
715719 userptr.invalidate_link) {
716− list_del_init(&vma->userptr.invalidate_link);
717− list_move_tail(&vma->combined_links.userptr,
720+ list_del_init(&uvma->userptr.invalidate_link);
721+ list_move_tail(&uvma->userptr.repin_link,
718722 &vm->userptr.repin_list);
719723 }
720724 spin_unlock(&vm->userptr.invalidated_lock);
721725
722726 /* Pin and move to temporary list */
723− list_for_each_entry_safe(vma, next, &vm->userptr.repin_list,
724− combined_links.userptr) {
725− err = xe_vma_userptr_pin_pages(vma);
727+ list_for_each_entry_safe(uvma, next, &vm->userptr.repin_list,
728+ userptr.repin_link) {
729+ err = xe_vma_userptr_pin_pages(uvma);
726730 if (err < 0)
727731 return err;
728732
729− list_move_tail(&vma->combined_links.userptr, &vm->rebind_list);
733+ list_del_init(&uvma->userptr.repin_link);
734+ list_move_tail(&uvma->vma.combined_links.rebind, &vm->rebind_list);
730735 }
731736
732737 return 0;
@@ -782,6 +787,14 @@ struct dma_fence *xe_vm_rebind(struct xe_vm *vm, bool rebind_worker) · 49 unmodified lines
782787 return fence;
783788 }
784789
790+static void xe_vma_free(struct xe_vma *vma)
791+{
792+ if (xe_vma_is_userptr(vma))
793+ kfree(to_userptr_vma(vma));
794+ else
795+ kfree(vma);
796+}
797+
785798 #define VMA_CREATE_FLAG_READ_ONLY BIT(0)
786799 #define VMA_CREATE_FLAG_IS_NULL BIT(1)
787800
@@ -800,14 +813,26 @@ static struct xe_vma *xe_vma_create(struct xe_vm *vm, · 12 unmodified lines
800813 xe_assert(vm->xe, start < end);
801814 xe_assert(vm->xe, end < vm->size);
802815
803− if (!bo && !is_null) /* userptr */
816+ /*
817+ * Allocate and ensure that the xe_vma_is_userptr() return
818+ * matches what was allocated.
819+ */
820+ if (!bo && !is_null) {
821+ struct xe_userptr_vma *uvma = kzalloc(sizeof(*uvma), GFP_KERNEL);
822+
823+ if (!uvma)
824+ return ERR_PTR(-ENOMEM);
825+
826+ vma = &uvma->vma;
827+ } else {
804828 vma = kzalloc(sizeof(*vma), GFP_KERNEL);
805− else
806− vma = kzalloc(sizeof(*vma) - sizeof(struct xe_userptr),
807− GFP_KERNEL);
808− if (!vma) {
809− vma = ERR_PTR(-ENOMEM);
810− return vma;
829+ if (!vma)
830+ return ERR_PTR(-ENOMEM);
831+
832+ if (is_null)
833+ vma->gpuva.flags |= DRM_GPUVA_SPARSE;
834+ if (bo)
835+ vma->gpuva.gem.obj = &bo->ttm.base;
811836 }
812837
813838 INIT_LIST_HEAD(&vma->combined_links.rebind);
@@ -818,8 +843,6 @@ static struct xe_vma *xe_vma_create(struct xe_vm *vm, · 4 unmodified lines
818843 vma->gpuva.va.range = end - start + 1;
819844 if (read_only)
820845 vma->gpuva.flags |= XE_VMA_READ_ONLY;
821− if (is_null)
822− vma->gpuva.flags |= DRM_GPUVA_SPARSE;
823846
824847 for_each_tile(tile, vm->xe, id)
825848 vma->tile_mask |= 0x1 << id;
@@ -836,35 +859,35 @@ static struct xe_vma *xe_vma_create(struct xe_vm *vm, · 10 unmodified lines
836859
837860 vm_bo = drm_gpuvm_bo_obtain(vma->gpuva.vm, &bo->ttm.base);
838861 if (IS_ERR(vm_bo)) {
839− kfree(vma);
862+ xe_vma_free(vma);
840863 return ERR_CAST(vm_bo);
841864 }
842865
843866 drm_gpuvm_bo_extobj_add(vm_bo);
844867 drm_gem_object_get(&bo->ttm.base);
845− vma->gpuva.gem.obj = &bo->ttm.base;
846868 vma->gpuva.gem.offset = bo_offset_or_userptr;
847869 drm_gpuva_link(&vma->gpuva, vm_bo);
848870 drm_gpuvm_bo_put(vm_bo);
849871 } else /* userptr or null */ {
850872 if (!is_null) {
873+ struct xe_userptr *userptr = &to_userptr_vma(vma)->userptr;
851874 u64 size = end - start + 1;
852875 int err;
853876
854− INIT_LIST_HEAD(&vma->userptr.invalidate_link);
877+ INIT_LIST_HEAD(&userptr->invalidate_link);
878+ INIT_LIST_HEAD(&userptr->repin_link);
855879 vma->gpuva.gem.offset = bo_offset_or_userptr;
856880
857− err = mmu_interval_notifier_insert(&vma->userptr.notifier,
881+ err = mmu_interval_notifier_insert(&userptr->notifier,
858882 current->mm,
859883 xe_vma_userptr(vma), size,
860884 &vma_userptr_notifier_ops);
861885 if (err) {
862− kfree(vma);
863− vma = ERR_PTR(err);
864− return vma;
886+ xe_vma_free(vma);
887+ return ERR_PTR(err);
865888 }
866889
867− vma->userptr.notifier_seq = LONG_MAX;
890+ userptr->notifier_seq = LONG_MAX;
868891 }
869892
870893 xe_vm_get(vm);
@@ -880,13 +903,15 @@ static void xe_vma_destroy_late(struct xe_vma *vma) · 9 unmodified lines
880903 bool read_only = xe_vma_read_only(vma);
881904
882905 if (xe_vma_is_userptr(vma)) {
883− if (vma->userptr.sg) {
906+ struct xe_userptr *userptr = &to_userptr_vma(vma)->userptr;
907+
908+ if (userptr->sg) {
884909 dma_unmap_sgtable(xe->drm.dev,
885− vma->userptr.sg,
910+ userptr->sg,
886911 read_only ? DMA_TO_DEVICE :
887912 DMA_BIDIRECTIONAL, 0);
888− sg_free_table(vma->userptr.sg);
889− vma->userptr.sg = NULL;
913+ sg_free_table(userptr->sg);
914+ userptr->sg = NULL;
890915 }
891916
892917 /*
@@ -894,7 +919,7 @@ static void xe_vma_destroy_late(struct xe_vma *vma) · 1 unmodified line
894919 * the notifer until we're sure the GPU is not accessing
895920 * them anymore
896921 */
897− mmu_interval_notifier_remove(&vma->userptr.notifier);
922+ mmu_interval_notifier_remove(&userptr->notifier);
898923 xe_vm_put(vm);
899924 } else if (xe_vma_is_null(vma)) {
900925 xe_vm_put(vm);
@@ -902,7 +927,7 @@ static void xe_vma_destroy_late(struct xe_vma *vma) · 1 unmodified line
902927 xe_bo_put(xe_vma_bo(vma));
903928 }
904929
905− kfree(vma);
930+ xe_vma_free(vma);
906931 }
907932
908933 static void vma_destroy_work_func(struct work_struct *w)
@@ -933,7 +958,7 @@ static void xe_vma_destroy(struct xe_vma *vma, struct dma_fence *fence) · 24 unmodified lines
933958 xe_assert(vm->xe, vma->gpuva.flags & XE_VMA_DESTROYED);
934959
935960 spin_lock(&vm->userptr.invalidated_lock);
936− list_del(&vma->userptr.invalidate_link);
961+ list_del(&to_userptr_vma(vma)->userptr.invalidate_link);
937962 spin_unlock(&vm->userptr.invalidated_lock);
938963 } else if (!xe_vma_is_null(vma)) {
939964 xe_bo_assert_held(xe_vma_bo(vma));
@@ -2150,7 +2175,7 @@ static struct xe_vma *new_vma(struct xe_vm *vm, struct drm_gpuva_op_map *op, · 1210 unmodified lines
21502175 drm_exec_fini(&exec);
21512176
21522177 if (xe_vma_is_userptr(vma)) {
2153− err = xe_vma_userptr_pin_pages(vma);
2178+ err = xe_vma_userptr_pin_pages(to_userptr_vma(vma));
21542179 if (err) {
21552180 prep_vma_destroy(vm, vma, false);
21562181 xe_vma_destroy_unlocked(vma);
@@ -2507,7 +2532,7 @@ retry_userptr: · 350 unmodified lines
25072532
25082533 if (err == -EAGAIN && xe_vma_is_userptr(vma)) {
25092534 lockdep_assert_held_write(&vm->lock);
2510− err = xe_vma_userptr_pin_pages(vma);
2535+ err = xe_vma_userptr_pin_pages(to_userptr_vma(vma));
25112536 if (!err)
25122537 goto retry_userptr;
25132538
@@ -2851,7 +2876,7 @@ int xe_vm_bind_ioctl(struct drm_device *dev, void *data, struct drm_file *file) · 337 unmodified lines
28512876 struct drm_gpuva_ops **ops = NULL;
28522877 struct xe_vm *vm;
28532878 struct xe_exec_queue *q = NULL;
2854− u32 num_syncs;
2879+ u32 num_syncs, num_ufence = 0;
28552880 struct xe_sync_entry *syncs = NULL;
28562881 struct drm_xe_vm_bind_op *bind_ops;
28572882 LIST_HEAD(ops_list);
@@ -2988,6 +3013,14 @@ int xe_vm_bind_ioctl(struct drm_device *dev, void *data, struct drm_file *file) · 130 unmodified lines
29883013 SYNC_PARSE_FLAG_DISALLOW_USER_FENCE : 0));
29893014 if (err)
29903015 goto free_syncs;
3016+
3017+ if (xe_sync_is_ufence(&syncs[num_syncs]))
3018+ num_ufence++;
3019+ }
3020+
3021+ if (XE_IOCTL_DBG(xe, num_ufence > 1)) {
3022+ err = -EINVAL;
3023+ goto free_syncs;
29913024 }
29923025
29933026 if (!args->num_binds) {
@@ -3130,8 +3163,8 @@ int xe_vm_invalidate_vma(struct xe_vma *vma) · 136 unmodified lines
31303163 if (IS_ENABLED(CONFIG_PROVE_LOCKING)) {
31313164 if (xe_vma_is_userptr(vma)) {
31323165 WARN_ON_ONCE(!mmu_interval_check_retry
3133− (&vma->userptr.notifier,
3134− vma->userptr.notifier_seq));
3166+ (&to_userptr_vma(vma)->userptr.notifier,
3167+ to_userptr_vma(vma)->userptr.notifier_seq));
31353168 WARN_ON_ONCE(!dma_resv_test_signaled(xe_vm_resv(xe_vma_vm(vma)),
31363169 DMA_RESV_USAGE_BOOKKEEP));
31373170
@@ -3192,11 +3225,11 @@ int xe_analyze_vm(struct drm_printer *p, struct xe_vm *vm, int gt_id) · 54 unmodified lines
31923225 if (is_null) {
31933226 addr = 0;
31943227 } else if (is_userptr) {
3228+ struct sg_table *sg = to_userptr_vma(vma)->userptr.sg;
31953229 struct xe_res_cursor cur;
31963230
3197− if (vma->userptr.sg) {
3198− xe_res_first_sg(vma->userptr.sg, 0, XE_PAGE_SIZE,
3199− &cur);
3231+ if (sg) {
3232+ xe_res_first_sg(sg, 0, XE_PAGE_SIZE, &cur);
32003233 addr = xe_res_dma(&cur);
32013234 } else {
32023235 addr = 0;
drivers/gpu/drm/xe/xe_vm.h+14−2
@@ -160,6 +160,18 @@ static inline bool xe_vma_is_userptr(struct xe_vma *vma) · 159 unmodified lines
160160 return xe_vma_has_no_bo(vma) && !xe_vma_is_null(vma);
161161 }
162162
163+/**
164+ * to_userptr_vma() - Return a pointer to an embedding userptr vma
165+ * @vma: Pointer to the embedded struct xe_vma
166+ *
167+ * Return: Pointer to the embedding userptr vma
168+ */
169+static inline struct xe_userptr_vma *to_userptr_vma(struct xe_vma *vma)
170+{
171+ xe_assert(xe_vma_vm(vma)->xe, xe_vma_is_userptr(vma));
172+ return container_of(vma, struct xe_userptr_vma, vma);
173+}
174+
163175 u64 xe_vm_pdp4_descriptor(struct xe_vm *vm, struct xe_tile *tile);
164176
165177 int xe_vm_create_ioctl(struct drm_device *dev, void *data,
@@ -224,9 +236,9 @@ static inline void xe_vm_reactivate_rebind(struct xe_vm *vm) · 58 unmodified lines
224236 }
225237 }
226238
227−int xe_vma_userptr_pin_pages(struct xe_vma *vma);
239+int xe_vma_userptr_pin_pages(struct xe_userptr_vma *uvma);
228240
229−int xe_vma_userptr_check_repin(struct xe_vma *vma);
241+int xe_vma_userptr_check_repin(struct xe_userptr_vma *uvma);
230242
231243 bool xe_vm_validate_should_retry(struct drm_exec *exec, int err, ktime_t *end);
232244
drivers/gpu/drm/xe/xe_vm_types.h+10−6
@@ -37,6 +37,8 @@ struct xe_vm; · 36 unmodified lines
3737 struct xe_userptr {
3838 /** @invalidate_link: Link for the vm::userptr.invalidated list */
3939 struct list_head invalidate_link;
40+ /** @userptr: link into VM repin list if userptr. */
41+ struct list_head repin_link;
4042 /**
4143 * @notifier: MMU notifier for user pointer (invalidation call back)
4244 */
@@ -68,8 +70,6 @@ struct xe_vma { · 25 unmodified lines
6870 * resv.
6971 */
7072 union {
71− /** @userptr: link into VM repin list if userptr. */
72− struct list_head userptr;
7373 /** @rebind: link into VM if this VMA needs rebinding. */
7474 struct list_head rebind;
7575 /** @destroy: link to contested list when VM is being closed. */
@@ -105,11 +105,15 @@ struct xe_vma { · 29 unmodified lines
105105 * @pat_index: The pat index to use when encoding the PTEs for this vma.
106106 */
107107 u16 pat_index;
108+};
108109
109− /**
110− * @userptr: user pointer state, only allocated for VMAs that are
111− * user pointers
112− */
110+/**
111+ * struct xe_userptr_vma - A userptr vma subclass
112+ * @vma: The vma.
113+ * @userptr: Additional userptr information.
114+ */
115+struct xe_userptr_vma {
116+ struct xe_vma vma;
113117 struct xe_userptr userptr;
114118 };
115119
drivers/hwmon/gigabyte_waterforce.c+1−1
@@ -146,7 +146,7 @@ static int waterforce_get_status(struct waterforce_data *priv) · 145 unmodified lines
146146 /* Send command for getting status */
147147 ret = waterforce_write_expanded(priv, get_status_cmd, GET_STATUS_CMD_LENGTH);
148148 if (ret < 0)
149− return ret;
149+ goto unlock_and_return;
150150
151151 ret = wait_for_completion_interruptible_timeout(&priv->status_report_received,
152152 msecs_to_jiffies(STATUS_VALIDITY));
drivers/hwmon/pmbus/mp2975.c+16−0
@@ -126,6 +126,21 @@ static const struct regulator_desc __maybe_unused mp2975_reg_desc[] = { · 125 unmodified lines
126126
127127 #define to_mp2975_data(x) container_of(x, struct mp2975_data, info)
128128
129+static int mp2975_read_byte_data(struct i2c_client *client, int page, int reg)
130+{
131+ switch (reg) {
132+ case PMBUS_VOUT_MODE:
133+ /*
134+ * Report direct format as configured by MFR_DC_LOOP_CTRL.
135+ * Unlike on MP2971/MP2973 the reported VOUT_MODE isn't automatically
136+ * internally updated, but always reads as PB_VOUT_MODE_VID.
137+ */
138+ return PB_VOUT_MODE_DIRECT;
139+ default:
140+ return -ENODATA;
141+ }
142+}
143+
129144 static int
130145 mp2975_read_word_helper(struct i2c_client *client, int page, int phase, u8 reg,
131146 u16 mask)
@@ -869,6 +884,7 @@ static struct pmbus_driver_info mp2975_info = { · 737 unmodified lines
869884 PMBUS_HAVE_IIN | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT |
870885 PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP | PMBUS_HAVE_POUT |
871886 PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT | PMBUS_PHASE_VIRTUAL,
887+ .read_byte_data = mp2975_read_byte_data,
872888 .read_word_data = mp2975_read_word_data,
873889 #if IS_ENABLED(CONFIG_SENSORS_MP2975_REGULATOR)
874890 .num_regulators = 1,
drivers/input/joystick/xpad.c+2−0
@@ -294,6 +294,7 @@ static const struct xpad_device { · 293 unmodified lines
294294 { 0x1689, 0xfd00, "Razer Onza Tournament Edition", 0, XTYPE_XBOX360 },
295295 { 0x1689, 0xfd01, "Razer Onza Classic Edition", 0, XTYPE_XBOX360 },
296296 { 0x1689, 0xfe00, "Razer Sabertooth", 0, XTYPE_XBOX360 },
297+ { 0x17ef, 0x6182, "Lenovo Legion Controller for Windows", 0, XTYPE_XBOX360 },
297298 { 0x1949, 0x041a, "Amazon Game Controller", 0, XTYPE_XBOX360 },
298299 { 0x1bad, 0x0002, "Harmonix Rock Band Guitar", 0, XTYPE_XBOX360 },
299300 { 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 },
@@ -491,6 +492,7 @@ static const struct usb_device_id xpad_table[] = { · 191 unmodified lines
491492 XPAD_XBOX360_VENDOR(0x15e4), /* Numark Xbox 360 controllers */
492493 XPAD_XBOX360_VENDOR(0x162e), /* Joytech Xbox 360 controllers */
493494 XPAD_XBOX360_VENDOR(0x1689), /* Razer Onza */
495+ XPAD_XBOX360_VENDOR(0x17ef), /* Lenovo */
494496 XPAD_XBOX360_VENDOR(0x1949), /* Amazon controllers */
495497 XPAD_XBOX360_VENDOR(0x1bad), /* Harmonix Rock Band guitar and drums */
496498 XPAD_XBOX360_VENDOR(0x20d6), /* PowerA controllers */
drivers/input/keyboard/atkbd.c+9−5
@@ -811,7 +811,6 @@ static int atkbd_probe(struct atkbd *atkbd) · 810 unmodified lines
811811 {
812812 struct ps2dev *ps2dev = &atkbd->ps2dev;
813813 unsigned char param[2];
814− bool skip_getid;
815814
816815 /*
817816 * Some systems, where the bit-twiddling when testing the io-lines of the
@@ -825,6 +824,11 @@ static int atkbd_probe(struct atkbd *atkbd) · 7 unmodified lines
825824 "keyboard reset failed on %s\n",
826825 ps2dev->serio->phys);
827826
827+ if (atkbd_skip_getid(atkbd)) {
828+ atkbd->id = 0xab83;
829+ goto deactivate_kbd;
830+ }
831+
828832 /*
829833 * Then we check the keyboard ID. We should get 0xab83 under normal conditions.
830834 * Some keyboards report different values, but the first byte is always 0xab or
@@ -833,18 +837,17 @@ static int atkbd_probe(struct atkbd *atkbd) · 2 unmodified lines
833837 */
834838
835839 param[0] = param[1] = 0xa5; /* initialize with invalid values */
836− skip_getid = atkbd_skip_getid(atkbd);
837− if (skip_getid || ps2_command(ps2dev, param, ATKBD_CMD_GETID)) {
840+ if (ps2_command(ps2dev, param, ATKBD_CMD_GETID)) {
838841
839842 /*
840− * If the get ID command was skipped or failed, we check if we can at least set
843+ * If the get ID command failed, we check if we can at least set
841844 * the LEDs on the keyboard. This should work on every keyboard out there.
842845 * It also turns the LEDs off, which we want anyway.
843846 */
844847 param[0] = 0;
845848 if (ps2_command(ps2dev, param, ATKBD_CMD_SETLEDS))
846849 return -1;
847− atkbd->id = skip_getid ? 0xab83 : 0xabba;
850+ atkbd->id = 0xabba;
848851 return 0;
849852 }
850853
@@ -860,6 +863,7 @@ static int atkbd_probe(struct atkbd *atkbd) · 9 unmodified lines
860863 return -1;
861864 }
862865
866+deactivate_kbd:
863867 /*
864868 * Make sure nothing is coming from the keyboard and disturbs our
865869 * internal state.
drivers/input/mouse/bcm5974.c+20−0
@@ -19,6 +19,7 @@ · 18 unmodified lines
1919 * Copyright (C) 2006 Nicolas Boichat (nicolas@boichat.ch)
2020 */
2121
22+#include "linux/usb.h"
2223 #include <linux/kernel.h>
2324 #include <linux/errno.h>
2425 #include <linux/slab.h>
@@ -193,6 +194,8 @@ enum tp_type { · 168 unmodified lines
193194
194195 /* list of device capability bits */
195196 #define HAS_INTEGRATED_BUTTON 1
197+/* maximum number of supported endpoints (currently trackpad and button) */
198+#define MAX_ENDPOINTS 2
196199
197200 /* trackpad finger data block size */
198201 #define FSIZE_TYPE1 (14 * sizeof(__le16))
@@ -891,6 +894,18 @@ static int bcm5974_resume(struct usb_interface *iface) · 692 unmodified lines
891894 return error;
892895 }
893896
897+static bool bcm5974_check_endpoints(struct usb_interface *iface,
898+ const struct bcm5974_config *cfg)
899+{
900+ u8 ep_addr[MAX_ENDPOINTS + 1] = {0};
901+
902+ ep_addr[0] = cfg->tp_ep;
903+ if (cfg->tp_type == TYPE1)
904+ ep_addr[1] = cfg->bt_ep;
905+
906+ return usb_check_int_endpoints(iface, ep_addr);
907+}
908+
894909 static int bcm5974_probe(struct usb_interface *iface,
895910 const struct usb_device_id *id)
896911 {
@@ -903,6 +918,11 @@ static int bcm5974_probe(struct usb_interface *iface, · 6 unmodified lines
903918 /* find the product index */
904919 cfg = bcm5974_get_config(udev);
905920
921+ if (!bcm5974_check_endpoints(iface, cfg)) {
922+ dev_err(&iface->dev, "Unexpected non-int endpoint\n");
923+ return -ENODEV;
924+ }
925+
906926 /* allocate memory for our device state and initialize it */
907927 dev = kzalloc(sizeof(struct bcm5974), GFP_KERNEL);
908928 input_dev = input_allocate_device();
drivers/input/serio/i8042-acpipnpio.h+14−0
@@ -634,6 +634,14 @@ static const struct dmi_system_id i8042_dmi_quirk_table[] __initconst = { · 633 unmodified lines
634634 },
635635 .driver_data = (void *)(SERIO_QUIRK_NOAUX)
636636 },
637+ {
638+ /* Fujitsu Lifebook U728 */
639+ .matches = {
640+ DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
641+ DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK U728"),
642+ },
643+ .driver_data = (void *)(SERIO_QUIRK_NOAUX)
644+ },
637645 {
638646 /* Gigabyte M912 */
639647 .matches = {
@@ -1208,6 +1216,12 @@ static const struct dmi_system_id i8042_dmi_quirk_table[] __initconst = { · 568 unmodified lines
12081216 SERIO_QUIRK_RESET_ALWAYS | SERIO_QUIRK_NOLOOP |
12091217 SERIO_QUIRK_NOPNP)
12101218 },
1219+ {
1220+ .matches = {
1221+ DMI_MATCH(DMI_BOARD_NAME, "NS5x_7xPU"),
1222+ },
1223+ .driver_data = (void *)(SERIO_QUIRK_NOAUX)
1224+ },
12111225 {
12121226 .matches = {
12131227 DMI_MATCH(DMI_BOARD_NAME, "NJ50_70CU"),
drivers/input/touchscreen/goodix.c+2−1
@@ -884,7 +884,8 @@ static int goodix_add_acpi_gpio_mappings(struct goodix_ts_data *ts) · 883 unmodified lines
884884 }
885885 }
886886
887− if (ts->gpio_count == 2 && ts->gpio_int_idx == 0) {
887+ /* Some devices with gpio_int_idx 0 list a third unused GPIO */
888+ if ((ts->gpio_count == 2 || ts->gpio_count == 3) && ts->gpio_int_idx == 0) {
888889 ts->irq_pin_access_method = IRQ_PIN_ACCESS_ACPI_GPIO;
889890 gpio_mapping = acpi_goodix_int_first_gpios;
890891 } else if (ts->gpio_count == 2 && ts->gpio_int_idx == 1) {
drivers/iommu/iommu.c+13−5
@@ -1799,7 +1799,7 @@ iommu_group_alloc_default_domain(struct iommu_group *group, int req_type) · 1798 unmodified lines
17991799 * domain. Do not use in new drivers.
18001800 */
18011801 if (ops->default_domain) {
1802− if (req_type)
1802+ if (req_type != ops->default_domain->type)
18031803 return ERR_PTR(-EINVAL);
18041804 return ops->default_domain;
18051805 }
@@ -1871,10 +1871,18 @@ static int iommu_get_def_domain_type(struct iommu_group *group, · 65 unmodified lines
18711871 const struct iommu_ops *ops = dev_iommu_ops(dev);
18721872 int type;
18731873
1874− if (!ops->def_domain_type)
1875− return cur_type;
1876−
1877− type = ops->def_domain_type(dev);
1874+ if (ops->default_domain) {
1875+ /*
1876+ * Drivers that declare a global static default_domain will
1877+ * always choose that.
1878+ */
1879+ type = ops->default_domain->type;
1880+ } else {
1881+ if (ops->def_domain_type)
1882+ type = ops->def_domain_type(dev);
1883+ else
1884+ return cur_type;
1885+ }
18781886 if (!type || cur_type == type)
18791887 return cur_type;
18801888 if (!cur_type)
drivers/md/dm-core.h+2−0
@@ -22,6 +22,8 @@ · 21 unmodified lines
2222 #include "dm-ima.h"
2323
2424 #define DM_RESERVED_MAX_IOS 1024
25+#define DM_MAX_TARGETS 1048576
26+#define DM_MAX_TARGET_PARAMS 1024
2527
2628 struct dm_io;
2729
drivers/md/dm-crypt.c+2−36
@@ -73,10 +73,8 @@ struct dm_crypt_io { · 72 unmodified lines
7373 struct bio *base_bio;
7474 u8 *integrity_metadata;
7575 bool integrity_metadata_from_pool:1;
76− bool in_tasklet:1;
7776
7877 struct work_struct work;
79− struct tasklet_struct tasklet;
8078
8179 struct convert_context ctx;
8280
@@ -1762,7 +1760,6 @@ static void crypt_io_init(struct dm_crypt_io *io, struct crypt_config *cc, · 1679 unmodified lines
17621760 io->ctx.r.req = NULL;
17631761 io->integrity_metadata = NULL;
17641762 io->integrity_metadata_from_pool = false;
1765− io->in_tasklet = false;
17661763 atomic_set(&io->io_pending, 0);
17671764 }
17681765
@@ -1771,13 +1768,6 @@ static void crypt_inc_pending(struct dm_crypt_io *io) · 2 unmodified lines
17711768 atomic_inc(&io->io_pending);
17721769 }
17731770
1774−static void kcryptd_io_bio_endio(struct work_struct *work)
1775−{
1776− struct dm_crypt_io *io = container_of(work, struct dm_crypt_io, work);
1777−
1778− bio_endio(io->base_bio);
1779−}
1780−
17811771 /*
17821772 * One of the bios was finished. Check for completion of
17831773 * the whole request and correctly clean up the buffer.
@@ -1801,20 +1791,6 @@ static void crypt_dec_pending(struct dm_crypt_io *io) · 17 unmodified lines
18011791
18021792 base_bio->bi_status = error;
18031793
1804− /*
1805− * If we are running this function from our tasklet,
1806− * we can't call bio_endio() here, because it will call
1807− * clone_endio() from dm.c, which in turn will
1808− * free the current struct dm_crypt_io structure with
1809− * our tasklet. In this case we need to delay bio_endio()
1810− * execution to after the tasklet is done and dequeued.
1811− */
1812− if (io->in_tasklet) {
1813− INIT_WORK(&io->work, kcryptd_io_bio_endio);
1814− queue_work(cc->io_queue, &io->work);
1815− return;
1816− }
1817−
18181794 bio_endio(base_bio);
18191795 }
18201796
@@ -2246,11 +2222,6 @@ static void kcryptd_crypt(struct work_struct *work) · 425 unmodified lines
22462222 kcryptd_crypt_write_convert(io);
22472223 }
22482224
2249−static void kcryptd_crypt_tasklet(unsigned long work)
2250−{
2251− kcryptd_crypt((struct work_struct *)work);
2252−}
2253−
22542225 static void kcryptd_queue_crypt(struct dm_crypt_io *io)
22552226 {
22562227 struct crypt_config *cc = io->cc;
@@ -2262,15 +2233,10 @@ static void kcryptd_queue_crypt(struct dm_crypt_io *io) · 5 unmodified lines
22622233 * irqs_disabled(): the kernel may run some IO completion from the idle thread, but
22632234 * it is being executed with irqs disabled.
22642235 */
2265− if (in_hardirq() || irqs_disabled()) {
2266− io->in_tasklet = true;
2267− tasklet_init(&io->tasklet, kcryptd_crypt_tasklet, (unsigned long)&io->work);
2268− tasklet_schedule(&io->tasklet);
2236+ if (!(in_hardirq() || irqs_disabled())) {
2237+ kcryptd_crypt(&io->work);
22692238 return;
22702239 }
2271−
2272− kcryptd_crypt(&io->work);
2273− return;
22742240 }
22752241
22762242 INIT_WORK(&io->work, kcryptd_crypt);
drivers/md/dm-ioctl.c+2−1
@@ -1941,7 +1941,8 @@ static int copy_params(struct dm_ioctl __user *user, struct dm_ioctl *param_kern · 1940 unmodified lines
19411941 minimum_data_size - sizeof(param_kernel->version)))
19421942 return -EFAULT;
19431943
1944− if (param_kernel->data_size < minimum_data_size) {
1944+ if (unlikely(param_kernel->data_size < minimum_data_size) ||
1945+ unlikely(param_kernel->data_size > DM_MAX_TARGETS * DM_MAX_TARGET_PARAMS)) {
19451946 DMERR("Invalid data size in the ioctl structure: %u",
19461947 param_kernel->data_size);
19471948 return -EINVAL;
drivers/md/dm-stats.c+9−0
@@ -66,6 +66,9 @@ struct dm_stats_last_position { · 65 unmodified lines
6666 unsigned int last_rw;
6767 };
6868
69+#define DM_STAT_MAX_ENTRIES 8388608
70+#define DM_STAT_MAX_HISTOGRAM_ENTRIES 134217728
71+
6972 /*
7073 * A typo on the command line could possibly make the kernel run out of memory
7174 * and crash. To prevent the crash we account all used memory. We fail if we
@@ -285,6 +288,9 @@ static int dm_stats_create(struct dm_stats *stats, sector_t start, sector_t end, · 213 unmodified lines
285288 if (n_entries != (size_t)n_entries || !(size_t)(n_entries + 1))
286289 return -EOVERFLOW;
287290
291+ if (n_entries > DM_STAT_MAX_ENTRIES)
292+ return -EOVERFLOW;
293+
288294 shared_alloc_size = struct_size(s, stat_shared, n_entries);
289295 if ((shared_alloc_size - sizeof(struct dm_stat)) / sizeof(struct dm_stat_shared) != n_entries)
290296 return -EOVERFLOW;
@@ -297,6 +303,9 @@ static int dm_stats_create(struct dm_stats *stats, sector_t start, sector_t end, · 6 unmodified lines
297303 if (histogram_alloc_size / (n_histogram_entries + 1) != (size_t)n_entries * sizeof(unsigned long long))
298304 return -EOVERFLOW;
299305
306+ if ((n_histogram_entries + 1) * (size_t)n_entries > DM_STAT_MAX_HISTOGRAM_ENTRIES)
307+ return -EOVERFLOW;
308+
300309 if (!check_shared_memory(shared_alloc_size + histogram_alloc_size +
301310 num_possible_cpus() * (percpu_alloc_size + histogram_alloc_size)))
302311 return -ENOMEM;
drivers/md/dm-table.c+7−2
@@ -129,7 +129,12 @@ static int alloc_targets(struct dm_table *t, unsigned int num) · 128 unmodified lines
129129 int dm_table_create(struct dm_table **result, blk_mode_t mode,
130130 unsigned int num_targets, struct mapped_device *md)
131131 {
132− struct dm_table *t = kzalloc(sizeof(*t), GFP_KERNEL);
132+ struct dm_table *t;
133+
134+ if (num_targets > DM_MAX_TARGETS)
135+ return -EOVERFLOW;
136+
137+ t = kzalloc(sizeof(*t), GFP_KERNEL);
133138
134139 if (!t)
135140 return -ENOMEM;
@@ -144,7 +149,7 @@ int dm_table_create(struct dm_table **result, blk_mode_t mode, · 8 unmodified lines
144149
145150 if (!num_targets) {
146151 kfree(t);
147− return -ENOMEM;
152+ return -EOVERFLOW;
148153 }
149154
150155 if (alloc_targets(t, num_targets)) {
drivers/md/dm-verity-target.c+2−24
@@ -645,23 +645,6 @@ static void verity_work(struct work_struct *w) · 644 unmodified lines
645645 verity_finish_io(io, errno_to_blk_status(verity_verify_io(io)));
646646 }
647647
648−static void verity_tasklet(unsigned long data)
649−{
650− struct dm_verity_io *io = (struct dm_verity_io *)data;
651− int err;
652−
653− io->in_tasklet = true;
654− err = verity_verify_io(io);
655− if (err == -EAGAIN || err == -ENOMEM) {
656− /* fallback to retrying with work-queue */
657− INIT_WORK(&io->work, verity_work);
658− queue_work(io->v->verify_wq, &io->work);
659− return;
660− }
661−
662− verity_finish_io(io, errno_to_blk_status(err));
663−}
664−
665648 static void verity_end_io(struct bio *bio)
666649 {
667650 struct dm_verity_io *io = bio->bi_private;
@@ -674,13 +657,8 @@ static void verity_end_io(struct bio *bio) · 6 unmodified lines
674657 return;
675658 }
676659
677− if (static_branch_unlikely(&use_tasklet_enabled) && io->v->use_tasklet) {
678− tasklet_init(&io->tasklet, verity_tasklet, (unsigned long)io);
679− tasklet_schedule(&io->tasklet);
680− } else {
681− INIT_WORK(&io->work, verity_work);
682− queue_work(io->v->verify_wq, &io->work);
683− }
660+ INIT_WORK(&io->work, verity_work);
661+ queue_work(io->v->verify_wq, &io->work);
684662 }
685663
686664 /*
drivers/md/dm-verity.h+0−1
@@ -83,7 +83,6 @@ struct dm_verity_io { · 82 unmodified lines
8383 struct bvec_iter iter;
8484
8585 struct work_struct work;
86− struct tasklet_struct tasklet;
8786
8887 /*
8988 * Three variably-size fields follow this struct:
drivers/md/dm-writecache.c+4−4
@@ -299,7 +299,7 @@ static int persistent_memory_claim(struct dm_writecache *wc) · 298 unmodified lines
299299 long i;
300300
301301 wc->memory_map = NULL;
302− pages = kvmalloc_array(p, sizeof(struct page *), GFP_KERNEL);
302+ pages = vmalloc_array(p, sizeof(struct page *));
303303 if (!pages) {
304304 r = -ENOMEM;
305305 goto err2;
@@ -330,7 +330,7 @@ static int persistent_memory_claim(struct dm_writecache *wc) · 24 unmodified lines
330330 r = -ENOMEM;
331331 goto err3;
332332 }
333− kvfree(pages);
333+ vfree(pages);
334334 wc->memory_vmapped = true;
335335 }
336336
@@ -341,7 +341,7 @@ static int persistent_memory_claim(struct dm_writecache *wc) · 4 unmodified lines
341341
342342 return 0;
343343 err3:
344− kvfree(pages);
344+ vfree(pages);
345345 err2:
346346 dax_read_unlock(id);
347347 err1:
@@ -962,7 +962,7 @@ static int writecache_alloc_entries(struct dm_writecache *wc) · 614 unmodified lines
962962
963963 if (wc->entries)
964964 return 0;
965− wc->entries = vmalloc(array_size(sizeof(struct wc_entry), wc->n_blocks));
965+ wc->entries = vmalloc_array(wc->n_blocks, sizeof(struct wc_entry));
966966 if (!wc->entries)
967967 return -ENOMEM;
968968 for (b = 0; b < wc->n_blocks; b++) {
drivers/misc/fastrpc.c+1−1
@@ -2191,7 +2191,7 @@ static int fastrpc_cb_remove(struct platform_device *pdev) · 2190 unmodified lines
21912191 int i;
21922192
21932193 spin_lock_irqsave(&cctx->lock, flags);
2194− for (i = 1; i < FASTRPC_MAX_SESSIONS; i++) {
2194+ for (i = 0; i < FASTRPC_MAX_SESSIONS; i++) {
21952195 if (cctx->session[i].sid == sess->sid) {
21962196 cctx->session[i].valid = false;
21972197 cctx->sesscount--;
drivers/misc/open-dice.c+1−1
@@ -140,7 +140,6 @@ static int __init open_dice_probe(struct platform_device *pdev) · 139 unmodified lines
140140 return -ENOMEM;
141141
142142 *drvdata = (struct open_dice_drvdata){
143− .lock = __MUTEX_INITIALIZER(drvdata->lock),
144143 .rmem = rmem,
145144 .misc = (struct miscdevice){
146145 .parent = dev,
@@ -150,6 +149,7 @@ static int __init open_dice_probe(struct platform_device *pdev) · 3 unmodified lines
150149 .mode = 0600,
151150 },
152151 };
152+ mutex_init(&drvdata->lock);
153153
154154 /* Index overflow check not needed, misc_register() will fail. */
155155 snprintf(drvdata->name, sizeof(drvdata->name), DRIVER_NAME"%u", dev_idx++);
drivers/net/ethernet/aquantia/atlantic/aq_ptp.c+2−2
@@ -993,7 +993,7 @@ int aq_ptp_ring_alloc(struct aq_nic_s *aq_nic) · 992 unmodified lines
993993 return 0;
994994
995995 err_exit_hwts_rx:
996− aq_ring_free(&aq_ptp->hwts_rx);
996+ aq_ring_hwts_rx_free(&aq_ptp->hwts_rx);
997997 err_exit_ptp_rx:
998998 aq_ring_free(&aq_ptp->ptp_rx);
999999 err_exit_ptp_tx:
@@ -1011,7 +1011,7 @@ void aq_ptp_ring_free(struct aq_nic_s *aq_nic) · 11 unmodified lines
10111011
10121012 aq_ring_free(&aq_ptp->ptp_tx);
10131013 aq_ring_free(&aq_ptp->ptp_rx);
1014− aq_ring_free(&aq_ptp->hwts_rx);
1014+ aq_ring_hwts_rx_free(&aq_ptp->hwts_rx);
10151015
10161016 aq_ptp_skb_ring_release(&aq_ptp->skb_ring);
10171017 }
drivers/net/ethernet/aquantia/atlantic/aq_ring.c+13−0
@@ -919,6 +919,19 @@ void aq_ring_free(struct aq_ring_s *self) · 918 unmodified lines
919919 }
920920 }
921921
922+void aq_ring_hwts_rx_free(struct aq_ring_s *self)
923+{
924+ if (!self)
925+ return;
926+
927+ if (self->dx_ring) {
928+ dma_free_coherent(aq_nic_get_dev(self->aq_nic),
929+ self->size * self->dx_size + AQ_CFG_RXDS_DEF,
930+ self->dx_ring, self->dx_ring_pa);
931+ self->dx_ring = NULL;
932+ }
933+}
934+
922935 unsigned int aq_ring_fill_stats_data(struct aq_ring_s *self, u64 *data)
923936 {
924937 unsigned int count;
drivers/net/ethernet/aquantia/atlantic/aq_ring.h+1−0
@@ -210,6 +210,7 @@ int aq_ring_rx_fill(struct aq_ring_s *self); · 209 unmodified lines
210210 int aq_ring_hwts_rx_alloc(struct aq_ring_s *self,
211211 struct aq_nic_s *aq_nic, unsigned int idx,
212212 unsigned int size, unsigned int dx_size);
213+void aq_ring_hwts_rx_free(struct aq_ring_s *self);
213214 void aq_ring_hwts_rx_clean(struct aq_ring_s *self, struct aq_nic_s *aq_nic);
214215
215216 unsigned int aq_ring_fill_stats_data(struct aq_ring_s *self, u64 *data);
drivers/net/ethernet/engleder/tsnep_main.c+12−4
@@ -721,17 +721,25 @@ static void tsnep_xdp_xmit_flush(struct tsnep_tx *tx) · 720 unmodified lines
721721
722722 static bool tsnep_xdp_xmit_back(struct tsnep_adapter *adapter,
723723 struct xdp_buff *xdp,
724− struct netdev_queue *tx_nq, struct tsnep_tx *tx)
724+ struct netdev_queue *tx_nq, struct tsnep_tx *tx,
725+ bool zc)
725726 {
726727 struct xdp_frame *xdpf = xdp_convert_buff_to_frame(xdp);
727728 bool xmit;
729+ u32 type;
728730
729731 if (unlikely(!xdpf))
730732 return false;
731733
734+ /* no page pool for zero copy */
735+ if (zc)
736+ type = TSNEP_TX_TYPE_XDP_NDO;
737+ else
738+ type = TSNEP_TX_TYPE_XDP_TX;
739+
732740 __netif_tx_lock(tx_nq, smp_processor_id());
733741
734− xmit = tsnep_xdp_xmit_frame_ring(xdpf, tx, TSNEP_TX_TYPE_XDP_TX);
742+ xmit = tsnep_xdp_xmit_frame_ring(xdpf, tx, type);
735743
736744 /* Avoid transmit queue timeout since we share it with the slow path */
737745 if (xmit)
@@ -1283,7 +1291,7 @@ static bool tsnep_xdp_run_prog(struct tsnep_rx *rx, struct bpf_prog *prog, · 545 unmodified lines
12831291 case XDP_PASS:
12841292 return false;
12851293 case XDP_TX:
1286− if (!tsnep_xdp_xmit_back(rx->adapter, xdp, tx_nq, tx))
1294+ if (!tsnep_xdp_xmit_back(rx->adapter, xdp, tx_nq, tx, false))
12871295 goto out_failure;
12881296 *status |= TSNEP_XDP_TX;
12891297 return true;
@@ -1333,7 +1341,7 @@ static bool tsnep_xdp_run_prog_zc(struct tsnep_rx *rx, struct bpf_prog *prog, · 43 unmodified lines
13331341 case XDP_PASS:
13341342 return false;
13351343 case XDP_TX:
1336− if (!tsnep_xdp_xmit_back(rx->adapter, xdp, tx_nq, tx))
1344+ if (!tsnep_xdp_xmit_back(rx->adapter, xdp, tx_nq, tx, true))
13371345 goto out_failure;
13381346 *status |= TSNEP_XDP_TX;
13391347 return true;
drivers/net/ethernet/intel/i40e/i40e_dcb.h+1−1
@@ -43,7 +43,7 @@ · 42 unmodified lines
4343 #define I40E_LLDP_TLV_SUBTYPE_SHIFT 0
4444 #define I40E_LLDP_TLV_SUBTYPE_MASK (0xFF << I40E_LLDP_TLV_SUBTYPE_SHIFT)
4545 #define I40E_LLDP_TLV_OUI_SHIFT 8
46−#define I40E_LLDP_TLV_OUI_MASK (0xFFFFFF << I40E_LLDP_TLV_OUI_SHIFT)
46+#define I40E_LLDP_TLV_OUI_MASK (0xFFFFFFU << I40E_LLDP_TLV_OUI_SHIFT)
4747
4848 /* Defines for IEEE ETS TLV */
4949 #define I40E_IEEE_ETS_MAXTC_SHIFT 0
drivers/net/ethernet/intel/ice/ice_osdep.h+1−1
@@ -24,7 +24,7 @@ · 23 unmodified lines
2424 #define rd64(a, reg) readq((a)->hw_addr + (reg))
2525
2626 #define ice_flush(a) rd32((a), GLGEN_STAT)
27−#define ICE_M(m, s) ((m) << (s))
27+#define ICE_M(m, s) ((m ## U) << (s))
2828
2929 struct ice_dma_mem {
3030 void *va;
drivers/net/ethernet/intel/ice/ice_type.h+1−1
@@ -1072,7 +1072,7 @@ struct ice_aq_get_set_rss_lut_params { · 1071 unmodified lines
10721072 #define ICE_OROM_VER_BUILD_SHIFT 8
10731073 #define ICE_OROM_VER_BUILD_MASK (0xffff << ICE_OROM_VER_BUILD_SHIFT)
10741074 #define ICE_OROM_VER_SHIFT 24
1075−#define ICE_OROM_VER_MASK (0xff << ICE_OROM_VER_SHIFT)
1075+#define ICE_OROM_VER_MASK (0xffU << ICE_OROM_VER_SHIFT)
10761076 #define ICE_SR_PFA_PTR 0x40
10771077 #define ICE_SR_1ST_NVM_BANK_PTR 0x42
10781078 #define ICE_SR_NVM_BANK_SIZE 0x43
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c+15−16
@@ -1850,8 +1850,8 @@ void npc_mcam_rsrcs_deinit(struct rvu *rvu) · 1849 unmodified lines
18501850 {
18511851 struct npc_mcam *mcam = &rvu->hw->mcam;
18521852
1853− kfree(mcam->bmap);
1854− kfree(mcam->bmap_reverse);
1853+ bitmap_free(mcam->bmap);
1854+ bitmap_free(mcam->bmap_reverse);
18551855 kfree(mcam->entry2pfvf_map);
18561856 kfree(mcam->cntr2pfvf_map);
18571857 kfree(mcam->entry2cntr_map);
@@ -1904,21 +1904,20 @@ int npc_mcam_rsrcs_init(struct rvu *rvu, int blkaddr) · 46 unmodified lines
19041904 mcam->pf_offset = mcam->nixlf_offset + nixlf_count;
19051905
19061906 /* Allocate bitmaps for managing MCAM entries */
1907− mcam->bmap = kmalloc_array(BITS_TO_LONGS(mcam->bmap_entries),
1908− sizeof(long), GFP_KERNEL);
1907+ mcam->bmap = bitmap_zalloc(mcam->bmap_entries, GFP_KERNEL);
19091908 if (!mcam->bmap)
19101909 return -ENOMEM;
19111910
1912− mcam->bmap_reverse = kmalloc_array(BITS_TO_LONGS(mcam->bmap_entries),
1913− sizeof(long), GFP_KERNEL);
1911+ mcam->bmap_reverse = bitmap_zalloc(mcam->bmap_entries, GFP_KERNEL);
19141912 if (!mcam->bmap_reverse)
19151913 goto free_bmap;
19161914
19171915 mcam->bmap_fcnt = mcam->bmap_entries;
19181916
19191917 /* Alloc memory for saving entry to RVU PFFUNC allocation mapping */
1920− mcam->entry2pfvf_map = kmalloc_array(mcam->bmap_entries,
1921− sizeof(u16), GFP_KERNEL);
1918+ mcam->entry2pfvf_map = kcalloc(mcam->bmap_entries, sizeof(u16),
1919+ GFP_KERNEL);
1920+
19221921 if (!mcam->entry2pfvf_map)
19231922 goto free_bmap_reverse;
19241923
@@ -1941,21 +1940,21 @@ int npc_mcam_rsrcs_init(struct rvu *rvu, int blkaddr) · 16 unmodified lines
19411940 if (err)
19421941 goto free_entry_map;
19431942
1944− mcam->cntr2pfvf_map = kmalloc_array(mcam->counters.max,
1945− sizeof(u16), GFP_KERNEL);
1943+ mcam->cntr2pfvf_map = kcalloc(mcam->counters.max, sizeof(u16),
1944+ GFP_KERNEL);
19461945 if (!mcam->cntr2pfvf_map)
19471946 goto free_cntr_bmap;
19481947
19491948 /* Alloc memory for MCAM entry to counter mapping and for tracking
19501949 * counter's reference count.
19511950 */
1952− mcam->entry2cntr_map = kmalloc_array(mcam->bmap_entries,
1953− sizeof(u16), GFP_KERNEL);
1951+ mcam->entry2cntr_map = kcalloc(mcam->bmap_entries, sizeof(u16),
1952+ GFP_KERNEL);
19541953 if (!mcam->entry2cntr_map)
19551954 goto free_cntr_map;
19561955
1957− mcam->cntr_refcnt = kmalloc_array(mcam->counters.max,
1958− sizeof(u16), GFP_KERNEL);
1956+ mcam->cntr_refcnt = kcalloc(mcam->counters.max, sizeof(u16),
1957+ GFP_KERNEL);
19591958 if (!mcam->cntr_refcnt)
19601959 goto free_entry_cntr_map;
19611960
@@ -1988,9 +1987,9 @@ free_cntr_bmap: · 26 unmodified lines
19881987 free_entry_map:
19891988 kfree(mcam->entry2pfvf_map);
19901989 free_bmap_reverse:
1991− kfree(mcam->bmap_reverse);
1990+ bitmap_free(mcam->bmap_reverse);
19921991 free_bmap:
1993− kfree(mcam->bmap);
1992+ bitmap_free(mcam->bmap);
19941993
19951994 return -ENOMEM;
19961995 }
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c+12−2
@@ -951,8 +951,11 @@ int otx2_sq_init(struct otx2_nic *pfvf, u16 qidx, u16 sqb_aura) · 950 unmodified lines
951951 if (pfvf->ptp && qidx < pfvf->hw.tx_queues) {
952952 err = qmem_alloc(pfvf->dev, &sq->timestamps, qset->sqe_cnt,
953953 sizeof(*sq->timestamps));
954− if (err)
954+ if (err) {
955+ kfree(sq->sg);
956+ sq->sg = NULL;
955957 return err;
958+ }
956959 }
957960
958961 sq->head = 0;
@@ -968,7 +971,14 @@ int otx2_sq_init(struct otx2_nic *pfvf, u16 qidx, u16 sqb_aura) · 9 unmodified lines
968971 sq->stats.bytes = 0;
969972 sq->stats.pkts = 0;
970973
971− return pfvf->hw_ops->sq_aq_init(pfvf, qidx, sqb_aura);
974+ err = pfvf->hw_ops->sq_aq_init(pfvf, qidx, sqb_aura);
975+ if (err) {
976+ kfree(sq->sg);
977+ sq->sg = NULL;
978+ return err;
979+ }
980+
981+ return 0;
972982
973983 }
974984
drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c+1−1
@@ -1084,7 +1084,7 @@ nfp_tunnel_add_shared_mac(struct nfp_app *app, struct net_device *netdev, · 1083 unmodified lines
10841084 u16 nfp_mac_idx = 0;
10851085
10861086 entry = nfp_tunnel_lookup_offloaded_macs(app, netdev->dev_addr);
1087− if (entry && nfp_tunnel_is_mac_idx_global(entry->index)) {
1087+ if (entry && (nfp_tunnel_is_mac_idx_global(entry->index) || netif_is_lag_port(netdev))) {
10881088 if (entry->bridge_count ||
10891089 !nfp_flower_is_supported_bridge(netdev)) {
10901090 nfp_tunnel_offloaded_macs_inc_ref_and_link(entry,
drivers/net/ethernet/netronome/nfp/nfp_net_common.c+1−0
@@ -2776,6 +2776,7 @@ static void nfp_net_netdev_init(struct nfp_net *nn) · 2775 unmodified lines
27762776 case NFP_NFD_VER_NFD3:
27772777 netdev->netdev_ops = &nfp_nfd3_netdev_ops;
27782778 netdev->xdp_features |= NETDEV_XDP_ACT_XSK_ZEROCOPY;
2779+ netdev->xdp_features |= NETDEV_XDP_ACT_REDIRECT;
27792780 break;
27802781 case NFP_NFD_VER_NFDK:
27812782 netdev->netdev_ops = &nfp_nfdk_netdev_ops;
drivers/net/ethernet/netronome/nfp/nfpcore/nfp6000_pcie.c+4−2
@@ -537,11 +537,13 @@ static int enable_bars(struct nfp6000_pcie *nfp, u16 interface) · 536 unmodified lines
537537 const u32 barcfg_msix_general =
538538 NFP_PCIE_BAR_PCIE2CPP_MapType(
539539 NFP_PCIE_BAR_PCIE2CPP_MapType_GENERAL) |
540− NFP_PCIE_BAR_PCIE2CPP_LengthSelect_32BIT;
540+ NFP_PCIE_BAR_PCIE2CPP_LengthSelect(
541+ NFP_PCIE_BAR_PCIE2CPP_LengthSelect_32BIT);
541542 const u32 barcfg_msix_xpb =
542543 NFP_PCIE_BAR_PCIE2CPP_MapType(
543544 NFP_PCIE_BAR_PCIE2CPP_MapType_BULK) |
544− NFP_PCIE_BAR_PCIE2CPP_LengthSelect_32BIT |
545+ NFP_PCIE_BAR_PCIE2CPP_LengthSelect(
546+ NFP_PCIE_BAR_PCIE2CPP_LengthSelect_32BIT) |
545547 NFP_PCIE_BAR_PCIE2CPP_Target_BaseAddress(
546548 NFP_CPP_TARGET_ISLAND_XPB);
547549 const u32 barcfg_explicit[4] = {
drivers/net/ethernet/stmicro/stmmac/common.h+41−16
@@ -59,28 +59,51 @@ · 58 unmodified lines
5959 #undef FRAME_FILTER_DEBUG
6060 /* #define FRAME_FILTER_DEBUG */
6161
62+struct stmmac_q_tx_stats {
63+ u64_stats_t tx_bytes;
64+ u64_stats_t tx_set_ic_bit;
65+ u64_stats_t tx_tso_frames;
66+ u64_stats_t tx_tso_nfrags;
67+};
68+
69+struct stmmac_napi_tx_stats {
70+ u64_stats_t tx_packets;
71+ u64_stats_t tx_pkt_n;
72+ u64_stats_t poll;
73+ u64_stats_t tx_clean;
74+ u64_stats_t tx_set_ic_bit;
75+};
76+
6277 struct stmmac_txq_stats {
63− u64 tx_bytes;
64− u64 tx_packets;
65− u64 tx_pkt_n;
66− u64 tx_normal_irq_n;
67− u64 napi_poll;
68− u64 tx_clean;
69− u64 tx_set_ic_bit;
70− u64 tx_tso_frames;
71− u64 tx_tso_nfrags;
72− struct u64_stats_sync syncp;
78+ /* Updates protected by tx queue lock. */
79+ struct u64_stats_sync q_syncp;
80+ struct stmmac_q_tx_stats q;
81+
82+ /* Updates protected by NAPI poll logic. */
83+ struct u64_stats_sync napi_syncp;
84+ struct stmmac_napi_tx_stats napi;
7385 } ____cacheline_aligned_in_smp;
7486
87+struct stmmac_napi_rx_stats {
88+ u64_stats_t rx_bytes;
89+ u64_stats_t rx_packets;
90+ u64_stats_t rx_pkt_n;
91+ u64_stats_t poll;
92+};
93+
7594 struct stmmac_rxq_stats {
76− u64 rx_bytes;
77− u64 rx_packets;
78− u64 rx_pkt_n;
79− u64 rx_normal_irq_n;
80− u64 napi_poll;
81− struct u64_stats_sync syncp;
95+ /* Updates protected by NAPI poll logic. */
96+ struct u64_stats_sync napi_syncp;
97+ struct stmmac_napi_rx_stats napi;
8298 } ____cacheline_aligned_in_smp;
8399
100+/* Updates on each CPU protected by not allowing nested irqs. */
101+struct stmmac_pcpu_stats {
102+ struct u64_stats_sync syncp;
103+ u64_stats_t rx_normal_irq_n[MTL_MAX_TX_QUEUES];
104+ u64_stats_t tx_normal_irq_n[MTL_MAX_RX_QUEUES];
105+};
106+
84107 /* Extra statistic and debug information exposed by ethtool */
85108 struct stmmac_extra_stats {
86109 /* Transmit errors */
@@ -207,6 +230,7 @@ struct stmmac_extra_stats { · 120 unmodified lines
207230 /* per queue statistics */
208231 struct stmmac_txq_stats txq_stats[MTL_MAX_TX_QUEUES];
209232 struct stmmac_rxq_stats rxq_stats[MTL_MAX_RX_QUEUES];
233+ struct stmmac_pcpu_stats __percpu *pcpu_stats;
210234 unsigned long rx_dropped;
211235 unsigned long rx_errors;
212236 unsigned long tx_dropped;
@@ -218,6 +242,7 @@ struct stmmac_safety_stats { · 5 unmodified lines
218242 unsigned long mac_errors[32];
219243 unsigned long mtl_errors[32];
220244 unsigned long dma_errors[32];
245+ unsigned long dma_dpp_errors[32];
221246 };
222247
223248 /* Number of fields in Safety Stats */
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c+7−8
@@ -441,8 +441,7 @@ static int sun8i_dwmac_dma_interrupt(struct stmmac_priv *priv, · 440 unmodified lines
441441 struct stmmac_extra_stats *x, u32 chan,
442442 u32 dir)
443443 {
444− struct stmmac_rxq_stats *rxq_stats = &priv->xstats.rxq_stats[chan];
445− struct stmmac_txq_stats *txq_stats = &priv->xstats.txq_stats[chan];
444+ struct stmmac_pcpu_stats *stats = this_cpu_ptr(priv->xstats.pcpu_stats);
446445 int ret = 0;
447446 u32 v;
448447
@@ -455,9 +454,9 @@ static int sun8i_dwmac_dma_interrupt(struct stmmac_priv *priv, · 6 unmodified lines
455454
456455 if (v & EMAC_TX_INT) {
457456 ret |= handle_tx;
458− u64_stats_update_begin(&txq_stats->syncp);
459− txq_stats->tx_normal_irq_n++;
460− u64_stats_update_end(&txq_stats->syncp);
457+ u64_stats_update_begin(&stats->syncp);
458+ u64_stats_inc(&stats->tx_normal_irq_n[chan]);
459+ u64_stats_update_end(&stats->syncp);
461460 }
462461
463462 if (v & EMAC_TX_DMA_STOP_INT)
@@ -479,9 +478,9 @@ static int sun8i_dwmac_dma_interrupt(struct stmmac_priv *priv, · 15 unmodified lines
479478
480479 if (v & EMAC_RX_INT) {
481480 ret |= handle_rx;
482− u64_stats_update_begin(&rxq_stats->syncp);
483− rxq_stats->rx_normal_irq_n++;
484− u64_stats_update_end(&rxq_stats->syncp);
481+ u64_stats_update_begin(&stats->syncp);
482+ u64_stats_inc(&stats->rx_normal_irq_n[chan]);
483+ u64_stats_update_end(&stats->syncp);
485484 }
486485
487486 if (v & EMAC_RX_BUF_UA_INT)
drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c+7−8
@@ -171,8 +171,7 @@ int dwmac4_dma_interrupt(struct stmmac_priv *priv, void __iomem *ioaddr, · 170 unmodified lines
171171 const struct dwmac4_addrs *dwmac4_addrs = priv->plat->dwmac4_addrs;
172172 u32 intr_status = readl(ioaddr + DMA_CHAN_STATUS(dwmac4_addrs, chan));
173173 u32 intr_en = readl(ioaddr + DMA_CHAN_INTR_ENA(dwmac4_addrs, chan));
174− struct stmmac_rxq_stats *rxq_stats = &priv->xstats.rxq_stats[chan];
175− struct stmmac_txq_stats *txq_stats = &priv->xstats.txq_stats[chan];
174+ struct stmmac_pcpu_stats *stats = this_cpu_ptr(priv->xstats.pcpu_stats);
176175 int ret = 0;
177176
178177 if (dir == DMA_DIR_RX)
@@ -201,15 +200,15 @@ int dwmac4_dma_interrupt(struct stmmac_priv *priv, void __iomem *ioaddr, · 22 unmodified lines
201200 }
202201 /* TX/RX NORMAL interrupts */
203202 if (likely(intr_status & DMA_CHAN_STATUS_RI)) {
204− u64_stats_update_begin(&rxq_stats->syncp);
205− rxq_stats->rx_normal_irq_n++;
206− u64_stats_update_end(&rxq_stats->syncp);
203+ u64_stats_update_begin(&stats->syncp);
204+ u64_stats_inc(&stats->rx_normal_irq_n[chan]);
205+ u64_stats_update_end(&stats->syncp);
207206 ret |= handle_rx;
208207 }
209208 if (likely(intr_status & DMA_CHAN_STATUS_TI)) {
210− u64_stats_update_begin(&txq_stats->syncp);
211− txq_stats->tx_normal_irq_n++;
212− u64_stats_update_end(&txq_stats->syncp);
209+ u64_stats_update_begin(&stats->syncp);
210+ u64_stats_inc(&stats->tx_normal_irq_n[chan]);
211+ u64_stats_update_end(&stats->syncp);
213212 ret |= handle_tx;
214213 }
215214
drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c+7−8
@@ -162,8 +162,7 @@ static void show_rx_process_state(unsigned int status) · 161 unmodified lines
162162 int dwmac_dma_interrupt(struct stmmac_priv *priv, void __iomem *ioaddr,
163163 struct stmmac_extra_stats *x, u32 chan, u32 dir)
164164 {
165− struct stmmac_rxq_stats *rxq_stats = &priv->xstats.rxq_stats[chan];
166− struct stmmac_txq_stats *txq_stats = &priv->xstats.txq_stats[chan];
165+ struct stmmac_pcpu_stats *stats = this_cpu_ptr(priv->xstats.pcpu_stats);
167166 int ret = 0;
168167 /* read the status register (CSR5) */
169168 u32 intr_status = readl(ioaddr + DMA_STATUS);
@@ -215,16 +214,16 @@ int dwmac_dma_interrupt(struct stmmac_priv *priv, void __iomem *ioaddr, · 45 unmodified lines
215214 u32 value = readl(ioaddr + DMA_INTR_ENA);
216215 /* to schedule NAPI on real RIE event. */
217216 if (likely(value & DMA_INTR_ENA_RIE)) {
218− u64_stats_update_begin(&rxq_stats->syncp);
219− rxq_stats->rx_normal_irq_n++;
220− u64_stats_update_end(&rxq_stats->syncp);
217+ u64_stats_update_begin(&stats->syncp);
218+ u64_stats_inc(&stats->rx_normal_irq_n[chan]);
219+ u64_stats_update_end(&stats->syncp);
221220 ret |= handle_rx;
222221 }
223222 }
224223 if (likely(intr_status & DMA_STATUS_TI)) {
225− u64_stats_update_begin(&txq_stats->syncp);
226− txq_stats->tx_normal_irq_n++;
227− u64_stats_update_end(&txq_stats->syncp);
224+ u64_stats_update_begin(&stats->syncp);
225+ u64_stats_inc(&stats->tx_normal_irq_n[chan]);
226+ u64_stats_update_end(&stats->syncp);
228227 ret |= handle_tx;
229228 }
230229 if (unlikely(intr_status & DMA_STATUS_ERI))
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h+3−0
@@ -303,6 +303,8 @@ · 302 unmodified lines
303303 #define XGMAC_RXCEIE BIT(4)
304304 #define XGMAC_TXCEIE BIT(0)
305305 #define XGMAC_MTL_ECC_INT_STATUS 0x000010cc
306+#define XGMAC_MTL_DPP_CONTROL 0x000010e0
307+#define XGMAC_DPP_DISABLE BIT(0)
306308 #define XGMAC_MTL_TXQ_OPMODE(x) (0x00001100 + (0x80 * (x)))
307309 #define XGMAC_TQS GENMASK(25, 16)
308310 #define XGMAC_TQS_SHIFT 16
@@ -385,6 +387,7 @@ · 76 unmodified lines
385387 #define XGMAC_DCEIE BIT(1)
386388 #define XGMAC_TCEIE BIT(0)
387389 #define XGMAC_DMA_ECC_INT_STATUS 0x0000306c
390+#define XGMAC_DMA_DPP_INT_STATUS 0x00003074
388391 #define XGMAC_DMA_CH_CONTROL(x) (0x00003100 + (0x80 * (x)))
389392 #define XGMAC_SPH BIT(24)
390393 #define XGMAC_PBLx8 BIT(16)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c+56−1
@@ -830,6 +830,43 @@ static const struct dwxgmac3_error_desc dwxgmac3_dma_errors[32]= { · 829 unmodified lines
830830 { false, "UNKNOWN", "Unknown Error" }, /* 31 */
831831 };
832832
833+static const char * const dpp_rx_err = "Read Rx Descriptor Parity checker Error";
834+static const char * const dpp_tx_err = "Read Tx Descriptor Parity checker Error";
835+static const struct dwxgmac3_error_desc dwxgmac3_dma_dpp_errors[32] = {
836+ { true, "TDPES0", dpp_tx_err },
837+ { true, "TDPES1", dpp_tx_err },
838+ { true, "TDPES2", dpp_tx_err },
839+ { true, "TDPES3", dpp_tx_err },
840+ { true, "TDPES4", dpp_tx_err },
841+ { true, "TDPES5", dpp_tx_err },
842+ { true, "TDPES6", dpp_tx_err },
843+ { true, "TDPES7", dpp_tx_err },
844+ { true, "TDPES8", dpp_tx_err },
845+ { true, "TDPES9", dpp_tx_err },
846+ { true, "TDPES10", dpp_tx_err },
847+ { true, "TDPES11", dpp_tx_err },
848+ { true, "TDPES12", dpp_tx_err },
849+ { true, "TDPES13", dpp_tx_err },
850+ { true, "TDPES14", dpp_tx_err },
851+ { true, "TDPES15", dpp_tx_err },
852+ { true, "RDPES0", dpp_rx_err },
853+ { true, "RDPES1", dpp_rx_err },
854+ { true, "RDPES2", dpp_rx_err },
855+ { true, "RDPES3", dpp_rx_err },
856+ { true, "RDPES4", dpp_rx_err },
857+ { true, "RDPES5", dpp_rx_err },
858+ { true, "RDPES6", dpp_rx_err },
859+ { true, "RDPES7", dpp_rx_err },
860+ { true, "RDPES8", dpp_rx_err },
861+ { true, "RDPES9", dpp_rx_err },
862+ { true, "RDPES10", dpp_rx_err },
863+ { true, "RDPES11", dpp_rx_err },
864+ { true, "RDPES12", dpp_rx_err },
865+ { true, "RDPES13", dpp_rx_err },
866+ { true, "RDPES14", dpp_rx_err },
867+ { true, "RDPES15", dpp_rx_err },
868+};
869+
833870 static void dwxgmac3_handle_dma_err(struct net_device *ndev,
834871 void __iomem *ioaddr, bool correctable,
835872 struct stmmac_safety_stats *stats)
@@ -841,6 +878,13 @@ static void dwxgmac3_handle_dma_err(struct net_device *ndev, · 5 unmodified lines
841878
842879 dwxgmac3_log_error(ndev, value, correctable, "DMA",
843880 dwxgmac3_dma_errors, STAT_OFF(dma_errors), stats);
881+
882+ value = readl(ioaddr + XGMAC_DMA_DPP_INT_STATUS);
883+ writel(value, ioaddr + XGMAC_DMA_DPP_INT_STATUS);
884+
885+ dwxgmac3_log_error(ndev, value, false, "DMA_DPP",
886+ dwxgmac3_dma_dpp_errors,
887+ STAT_OFF(dma_dpp_errors), stats);
844888 }
845889
846890 static int
@@ -881,6 +925,12 @@ dwxgmac3_safety_feat_config(void __iomem *ioaddr, unsigned int asp, · 34 unmodified lines
881925 value |= XGMAC_TMOUTEN; /* FSM Timeout Feature */
882926 writel(value, ioaddr + XGMAC_MAC_FSM_CONTROL);
883927
928+ /* 5. Enable Data Path Parity Protection */
929+ value = readl(ioaddr + XGMAC_MTL_DPP_CONTROL);
930+ /* already enabled by default, explicit enable it again */
931+ value &= ~XGMAC_DPP_DISABLE;
932+ writel(value, ioaddr + XGMAC_MTL_DPP_CONTROL);
933+
884934 return 0;
885935 }
886936
@@ -914,7 +964,11 @@ static int dwxgmac3_safety_feat_irq_status(struct net_device *ndev, · 27 unmodified lines
914964 ret |= !corr;
915965 }
916966
917− err = dma & (XGMAC_DEUIS | XGMAC_DECIS);
967+ /* DMA_DPP_Interrupt_Status is indicated by MCSIS bit in
968+ * DMA_Safety_Interrupt_Status, so we handle DMA Data Path
969+ * Parity Errors here
970+ */
971+ err = dma & (XGMAC_DEUIS | XGMAC_DECIS | XGMAC_MCSIS);
918972 corr = dma & XGMAC_DECIS;
919973 if (err) {
920974 dwxgmac3_handle_dma_err(ndev, ioaddr, corr, stats);
@@ -930,6 +984,7 @@ static const struct dwxgmac3_error { · 9 unmodified lines
930984 { dwxgmac3_mac_errors },
931985 { dwxgmac3_mtl_errors },
932986 { dwxgmac3_dma_errors },
987+ { dwxgmac3_dma_dpp_errors },
933988 };
934989
935990 static int dwxgmac3_safety_feat_dump(struct stmmac_safety_stats *stats,
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c+7−8
@@ -337,8 +337,7 @@ static int dwxgmac2_dma_interrupt(struct stmmac_priv *priv, · 336 unmodified lines
337337 struct stmmac_extra_stats *x, u32 chan,
338338 u32 dir)
339339 {
340− struct stmmac_rxq_stats *rxq_stats = &priv->xstats.rxq_stats[chan];
341− struct stmmac_txq_stats *txq_stats = &priv->xstats.txq_stats[chan];
340+ struct stmmac_pcpu_stats *stats = this_cpu_ptr(priv->xstats.pcpu_stats);
342341 u32 intr_status = readl(ioaddr + XGMAC_DMA_CH_STATUS(chan));
343342 u32 intr_en = readl(ioaddr + XGMAC_DMA_CH_INT_EN(chan));
344343 int ret = 0;
@@ -367,15 +366,15 @@ static int dwxgmac2_dma_interrupt(struct stmmac_priv *priv, · 22 unmodified lines
367366 /* TX/RX NORMAL interrupts */
368367 if (likely(intr_status & XGMAC_NIS)) {
369368 if (likely(intr_status & XGMAC_RI)) {
370− u64_stats_update_begin(&rxq_stats->syncp);
371− rxq_stats->rx_normal_irq_n++;
372− u64_stats_update_end(&rxq_stats->syncp);
369+ u64_stats_update_begin(&stats->syncp);
370+ u64_stats_inc(&stats->rx_normal_irq_n[chan]);
371+ u64_stats_update_end(&stats->syncp);
373372 ret |= handle_rx;
374373 }
375374 if (likely(intr_status & (XGMAC_TI | XGMAC_TBU))) {
376− u64_stats_update_begin(&txq_stats->syncp);
377− txq_stats->tx_normal_irq_n++;
378− u64_stats_update_end(&txq_stats->syncp);
375+ u64_stats_update_begin(&stats->syncp);
376+ u64_stats_inc(&stats->tx_normal_irq_n[chan]);
377+ u64_stats_update_end(&stats->syncp);
379378 ret |= handle_tx;
380379 }
381380 }
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c+87−42
@@ -549,44 +549,79 @@ stmmac_set_pauseparam(struct net_device *netdev, · 548 unmodified lines
549549 }
550550 }
551551
552+static u64 stmmac_get_rx_normal_irq_n(struct stmmac_priv *priv, int q)
553+{
554+ u64 total;
555+ int cpu;
556+
557+ total = 0;
558+ for_each_possible_cpu(cpu) {
559+ struct stmmac_pcpu_stats *pcpu;
560+ unsigned int start;
561+ u64 irq_n;
562+
563+ pcpu = per_cpu_ptr(priv->xstats.pcpu_stats, cpu);
564+ do {
565+ start = u64_stats_fetch_begin(&pcpu->syncp);
566+ irq_n = u64_stats_read(&pcpu->rx_normal_irq_n[q]);
567+ } while (u64_stats_fetch_retry(&pcpu->syncp, start));
568+ total += irq_n;
569+ }
570+ return total;
571+}
572+
573+static u64 stmmac_get_tx_normal_irq_n(struct stmmac_priv *priv, int q)
574+{
575+ u64 total;
576+ int cpu;
577+
578+ total = 0;
579+ for_each_possible_cpu(cpu) {
580+ struct stmmac_pcpu_stats *pcpu;
581+ unsigned int start;
582+ u64 irq_n;
583+
584+ pcpu = per_cpu_ptr(priv->xstats.pcpu_stats, cpu);
585+ do {
586+ start = u64_stats_fetch_begin(&pcpu->syncp);
587+ irq_n = u64_stats_read(&pcpu->tx_normal_irq_n[q]);
588+ } while (u64_stats_fetch_retry(&pcpu->syncp, start));
589+ total += irq_n;
590+ }
591+ return total;
592+}
593+
552594 static void stmmac_get_per_qstats(struct stmmac_priv *priv, u64 *data)
553595 {
554596 u32 tx_cnt = priv->plat->tx_queues_to_use;
555597 u32 rx_cnt = priv->plat->rx_queues_to_use;
556598 unsigned int start;
557− int q, stat;
558− char *p;
599+ int q;
559600
560601 for (q = 0; q < tx_cnt; q++) {
561602 struct stmmac_txq_stats *txq_stats = &priv->xstats.txq_stats[q];
562− struct stmmac_txq_stats snapshot;
603+ u64 pkt_n;
563604
564605 do {
565− start = u64_stats_fetch_begin(&txq_stats->syncp);
566− snapshot = *txq_stats;
567− } while (u64_stats_fetch_retry(&txq_stats->syncp, start));
606+ start = u64_stats_fetch_begin(&txq_stats->napi_syncp);
607+ pkt_n = u64_stats_read(&txq_stats->napi.tx_pkt_n);
608+ } while (u64_stats_fetch_retry(&txq_stats->napi_syncp, start));
568609
569− p = (char *)&snapshot + offsetof(struct stmmac_txq_stats, tx_pkt_n);
570− for (stat = 0; stat < STMMAC_TXQ_STATS; stat++) {
571− *data++ = (*(u64 *)p);
572− p += sizeof(u64);
573− }
610+ *data++ = pkt_n;
611+ *data++ = stmmac_get_tx_normal_irq_n(priv, q);
574612 }
575613
576614 for (q = 0; q < rx_cnt; q++) {
577615 struct stmmac_rxq_stats *rxq_stats = &priv->xstats.rxq_stats[q];
578− struct stmmac_rxq_stats snapshot;
616+ u64 pkt_n;
579617
580618 do {
581− start = u64_stats_fetch_begin(&rxq_stats->syncp);
582− snapshot = *rxq_stats;
583− } while (u64_stats_fetch_retry(&rxq_stats->syncp, start));
619+ start = u64_stats_fetch_begin(&rxq_stats->napi_syncp);
620+ pkt_n = u64_stats_read(&rxq_stats->napi.rx_pkt_n);
621+ } while (u64_stats_fetch_retry(&rxq_stats->napi_syncp, start));
584622
585− p = (char *)&snapshot + offsetof(struct stmmac_rxq_stats, rx_pkt_n);
586− for (stat = 0; stat < STMMAC_RXQ_STATS; stat++) {
587− *data++ = (*(u64 *)p);
588− p += sizeof(u64);
589− }
623+ *data++ = pkt_n;
624+ *data++ = stmmac_get_rx_normal_irq_n(priv, q);
590625 }
591626 }
592627
@@ -645,39 +680,49 @@ static void stmmac_get_ethtool_stats(struct net_device *dev, · 52 unmodified lines
645680 pos = j;
646681 for (i = 0; i < rx_queues_count; i++) {
647682 struct stmmac_rxq_stats *rxq_stats = &priv->xstats.rxq_stats[i];
648− struct stmmac_rxq_stats snapshot;
683+ struct stmmac_napi_rx_stats snapshot;
684+ u64 n_irq;
649685
650686 j = pos;
651687 do {
652− start = u64_stats_fetch_begin(&rxq_stats->syncp);
653− snapshot = *rxq_stats;
654− } while (u64_stats_fetch_retry(&rxq_stats->syncp, start));
655−
656− data[j++] += snapshot.rx_pkt_n;
657− data[j++] += snapshot.rx_normal_irq_n;
658− normal_irq_n += snapshot.rx_normal_irq_n;
659− napi_poll += snapshot.napi_poll;
688+ start = u64_stats_fetch_begin(&rxq_stats->napi_syncp);
689+ snapshot = rxq_stats->napi;
690+ } while (u64_stats_fetch_retry(&rxq_stats->napi_syncp, start));
691+
692+ data[j++] += u64_stats_read(&snapshot.rx_pkt_n);
693+ n_irq = stmmac_get_rx_normal_irq_n(priv, i);
694+ data[j++] += n_irq;
695+ normal_irq_n += n_irq;
696+ napi_poll += u64_stats_read(&snapshot.poll);
660697 }
661698
662699 pos = j;
663700 for (i = 0; i < tx_queues_count; i++) {
664701 struct stmmac_txq_stats *txq_stats = &priv->xstats.txq_stats[i];
665− struct stmmac_txq_stats snapshot;
702+ struct stmmac_napi_tx_stats napi_snapshot;
703+ struct stmmac_q_tx_stats q_snapshot;
704+ u64 n_irq;
666705
667706 j = pos;
668707 do {
669− start = u64_stats_fetch_begin(&txq_stats->syncp);
670− snapshot = *txq_stats;
671− } while (u64_stats_fetch_retry(&txq_stats->syncp, start));
672−
673− data[j++] += snapshot.tx_pkt_n;
674− data[j++] += snapshot.tx_normal_irq_n;
675− normal_irq_n += snapshot.tx_normal_irq_n;
676− data[j++] += snapshot.tx_clean;
677− data[j++] += snapshot.tx_set_ic_bit;
678− data[j++] += snapshot.tx_tso_frames;
679− data[j++] += snapshot.tx_tso_nfrags;
680− napi_poll += snapshot.napi_poll;
708+ start = u64_stats_fetch_begin(&txq_stats->q_syncp);
709+ q_snapshot = txq_stats->q;
710+ } while (u64_stats_fetch_retry(&txq_stats->q_syncp, start));
711+ do {
712+ start = u64_stats_fetch_begin(&txq_stats->napi_syncp);
713+ napi_snapshot = txq_stats->napi;
714+ } while (u64_stats_fetch_retry(&txq_stats->napi_syncp, start));
715+
716+ data[j++] += u64_stats_read(&napi_snapshot.tx_pkt_n);
717+ n_irq = stmmac_get_tx_normal_irq_n(priv, i);
718+ data[j++] += n_irq;
719+ normal_irq_n += n_irq;
720+ data[j++] += u64_stats_read(&napi_snapshot.tx_clean);
721+ data[j++] += u64_stats_read(&q_snapshot.tx_set_ic_bit) +
722+ u64_stats_read(&napi_snapshot.tx_set_ic_bit);
723+ data[j++] += u64_stats_read(&q_snapshot.tx_tso_frames);
724+ data[j++] += u64_stats_read(&q_snapshot.tx_tso_nfrags);
725+ napi_poll += u64_stats_read(&napi_snapshot.poll);
681726 }
682727 normal_irq_n += priv->xstats.rx_early_irq;
683728 data[j++] = normal_irq_n;
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+66−67
@@ -2482,7 +2482,6 @@ static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget) · 2481 unmodified lines
24822482 struct xdp_desc xdp_desc;
24832483 bool work_done = true;
24842484 u32 tx_set_ic_bit = 0;
2485− unsigned long flags;
24862485
24872486 /* Avoids TX time-out as we are sharing with slow path */
24882487 txq_trans_cond_update(nq);
@@ -2573,9 +2572,9 @@ static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget) · 84 unmodified lines
25732572 tx_q->cur_tx = STMMAC_GET_ENTRY(tx_q->cur_tx, priv->dma_conf.dma_tx_size);
25742573 entry = tx_q->cur_tx;
25752574 }
2576− flags = u64_stats_update_begin_irqsave(&txq_stats->syncp);
2577− txq_stats->tx_set_ic_bit += tx_set_ic_bit;
2578− u64_stats_update_end_irqrestore(&txq_stats->syncp, flags);
2575+ u64_stats_update_begin(&txq_stats->napi_syncp);
2576+ u64_stats_add(&txq_stats->napi.tx_set_ic_bit, tx_set_ic_bit);
2577+ u64_stats_update_end(&txq_stats->napi_syncp);
25792578
25802579 if (tx_desc) {
25812580 stmmac_flush_tx_descriptors(priv, queue);
@@ -2623,7 +2622,6 @@ static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue, · 41 unmodified lines
26232622 unsigned int bytes_compl = 0, pkts_compl = 0;
26242623 unsigned int entry, xmits = 0, count = 0;
26252624 u32 tx_packets = 0, tx_errors = 0;
2626− unsigned long flags;
26272625
26282626 __netif_tx_lock_bh(netdev_get_tx_queue(priv->dev, queue));
26292627
@@ -2789,11 +2787,11 @@ static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue, · 159 unmodified lines
27892787 if (tx_q->dirty_tx != tx_q->cur_tx)
27902788 *pending_packets = true;
27912789
2792− flags = u64_stats_update_begin_irqsave(&txq_stats->syncp);
2793− txq_stats->tx_packets += tx_packets;
2794− txq_stats->tx_pkt_n += tx_packets;
2795− txq_stats->tx_clean++;
2796− u64_stats_update_end_irqrestore(&txq_stats->syncp, flags);
2790+ u64_stats_update_begin(&txq_stats->napi_syncp);
2791+ u64_stats_add(&txq_stats->napi.tx_packets, tx_packets);
2792+ u64_stats_add(&txq_stats->napi.tx_pkt_n, tx_packets);
2793+ u64_stats_inc(&txq_stats->napi.tx_clean);
2794+ u64_stats_update_end(&txq_stats->napi_syncp);
27972795
27982796 priv->xstats.tx_errors += tx_errors;
27992797
@@ -4220,7 +4218,6 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev) · 1420 unmodified lines
42204218 struct stmmac_tx_queue *tx_q;
42214219 bool has_vlan, set_ic;
42224220 u8 proto_hdr_len, hdr;
4223− unsigned long flags;
42244221 u32 pay_len, mss;
42254222 dma_addr_t des;
42264223 int i;
@@ -4385,13 +4382,13 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev) · 158 unmodified lines
43854382 netif_tx_stop_queue(netdev_get_tx_queue(priv->dev, queue));
43864383 }
43874384
4388− flags = u64_stats_update_begin_irqsave(&txq_stats->syncp);
4389− txq_stats->tx_bytes += skb->len;
4390− txq_stats->tx_tso_frames++;
4391− txq_stats->tx_tso_nfrags += nfrags;
4385+ u64_stats_update_begin(&txq_stats->q_syncp);
4386+ u64_stats_add(&txq_stats->q.tx_bytes, skb->len);
4387+ u64_stats_inc(&txq_stats->q.tx_tso_frames);
4388+ u64_stats_add(&txq_stats->q.tx_tso_nfrags, nfrags);
43924389 if (set_ic)
4393− txq_stats->tx_set_ic_bit++;
4394− u64_stats_update_end_irqrestore(&txq_stats->syncp, flags);
4390+ u64_stats_inc(&txq_stats->q.tx_set_ic_bit);
4391+ u64_stats_update_end(&txq_stats->q_syncp);
43954392
43964393 if (priv->sarc_type)
43974394 stmmac_set_desc_sarc(priv, first, priv->sarc_type);
@@ -4490,7 +4487,6 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) · 92 unmodified lines
44904487 struct stmmac_tx_queue *tx_q;
44914488 bool has_vlan, set_ic;
44924489 int entry, first_tx;
4493− unsigned long flags;
44944490 dma_addr_t des;
44954491
44964492 tx_q = &priv->dma_conf.tx_queue[queue];
@@ -4667,11 +4663,11 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) · 170 unmodified lines
46674663 netif_tx_stop_queue(netdev_get_tx_queue(priv->dev, queue));
46684664 }
46694665
4670− flags = u64_stats_update_begin_irqsave(&txq_stats->syncp);
4671− txq_stats->tx_bytes += skb->len;
4666+ u64_stats_update_begin(&txq_stats->q_syncp);
4667+ u64_stats_add(&txq_stats->q.tx_bytes, skb->len);
46724668 if (set_ic)
4673− txq_stats->tx_set_ic_bit++;
4674− u64_stats_update_end_irqrestore(&txq_stats->syncp, flags);
4669+ u64_stats_inc(&txq_stats->q.tx_set_ic_bit);
4670+ u64_stats_update_end(&txq_stats->q_syncp);
46754671
46764672 if (priv->sarc_type)
46774673 stmmac_set_desc_sarc(priv, first, priv->sarc_type);
@@ -4943,12 +4939,11 @@ static int stmmac_xdp_xmit_xdpf(struct stmmac_priv *priv, int queue, · 265 unmodified lines
49434939 set_ic = false;
49444940
49454941 if (set_ic) {
4946− unsigned long flags;
49474942 tx_q->tx_count_frames = 0;
49484943 stmmac_set_tx_ic(priv, tx_desc);
4949− flags = u64_stats_update_begin_irqsave(&txq_stats->syncp);
4950− txq_stats->tx_set_ic_bit++;
4951− u64_stats_update_end_irqrestore(&txq_stats->syncp, flags);
4944+ u64_stats_update_begin(&txq_stats->q_syncp);
4945+ u64_stats_inc(&txq_stats->q.tx_set_ic_bit);
4946+ u64_stats_update_end(&txq_stats->q_syncp);
49524947 }
49534948
49544949 stmmac_enable_dma_transmission(priv, priv->ioaddr);
@@ -5098,7 +5093,6 @@ static void stmmac_dispatch_skb_zc(struct stmmac_priv *priv, u32 queue, · 143 unmodified lines
50985093 unsigned int len = xdp->data_end - xdp->data;
50995094 enum pkt_hash_types hash_type;
51005095 int coe = priv->hw->rx_csum;
5101− unsigned long flags;
51025096 struct sk_buff *skb;
51035097 u32 hash;
51045098
@@ -5128,10 +5122,10 @@ static void stmmac_dispatch_skb_zc(struct stmmac_priv *priv, u32 queue, · 23 unmodified lines
51285122 skb_record_rx_queue(skb, queue);
51295123 napi_gro_receive(&ch->rxtx_napi, skb);
51305124
5131− flags = u64_stats_update_begin_irqsave(&rxq_stats->syncp);
5132− rxq_stats->rx_pkt_n++;
5133− rxq_stats->rx_bytes += len;
5134− u64_stats_update_end_irqrestore(&rxq_stats->syncp, flags);
5125+ u64_stats_update_begin(&rxq_stats->napi_syncp);
5126+ u64_stats_inc(&rxq_stats->napi.rx_pkt_n);
5127+ u64_stats_add(&rxq_stats->napi.rx_bytes, len);
5128+ u64_stats_update_end(&rxq_stats->napi_syncp);
51355129 }
51365130
51375131 static bool stmmac_rx_refill_zc(struct stmmac_priv *priv, u32 queue, u32 budget)
@@ -5213,7 +5207,6 @@ static int stmmac_rx_zc(struct stmmac_priv *priv, int limit, u32 queue) · 75 unmodified lines
52135207 unsigned int desc_size;
52145208 struct bpf_prog *prog;
52155209 bool failure = false;
5216− unsigned long flags;
52175210 int xdp_status = 0;
52185211 int status = 0;
52195212
@@ -5368,9 +5361,9 @@ read_again: · 148 unmodified lines
53685361
53695362 stmmac_finalize_xdp_rx(priv, xdp_status);
53705363
5371− flags = u64_stats_update_begin_irqsave(&rxq_stats->syncp);
5372− rxq_stats->rx_pkt_n += count;
5373− u64_stats_update_end_irqrestore(&rxq_stats->syncp, flags);
5364+ u64_stats_update_begin(&rxq_stats->napi_syncp);
5365+ u64_stats_add(&rxq_stats->napi.rx_pkt_n, count);
5366+ u64_stats_update_end(&rxq_stats->napi_syncp);
53745367
53755368 priv->xstats.rx_dropped += rx_dropped;
53765369 priv->xstats.rx_errors += rx_errors;
@@ -5408,7 +5401,6 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) · 31 unmodified lines
54085401 unsigned int desc_size;
54095402 struct sk_buff *skb = NULL;
54105403 struct stmmac_xdp_buff ctx;
5411− unsigned long flags;
54125404 int xdp_status = 0;
54135405 int buf_sz;
54145406
@@ -5668,11 +5660,11 @@ drain_data: · 253 unmodified lines
56685660
56695661 stmmac_rx_refill(priv, queue);
56705662
5671− flags = u64_stats_update_begin_irqsave(&rxq_stats->syncp);
5672− rxq_stats->rx_packets += rx_packets;
5673− rxq_stats->rx_bytes += rx_bytes;
5674− rxq_stats->rx_pkt_n += count;
5675− u64_stats_update_end_irqrestore(&rxq_stats->syncp, flags);
5663+ u64_stats_update_begin(&rxq_stats->napi_syncp);
5664+ u64_stats_add(&rxq_stats->napi.rx_packets, rx_packets);
5665+ u64_stats_add(&rxq_stats->napi.rx_bytes, rx_bytes);
5666+ u64_stats_add(&rxq_stats->napi.rx_pkt_n, count);
5667+ u64_stats_update_end(&rxq_stats->napi_syncp);
56765668
56775669 priv->xstats.rx_dropped += rx_dropped;
56785670 priv->xstats.rx_errors += rx_errors;
@@ -5687,13 +5679,12 @@ static int stmmac_napi_poll_rx(struct napi_struct *napi, int budget) · 8 unmodified lines
56875679 struct stmmac_priv *priv = ch->priv_data;
56885680 struct stmmac_rxq_stats *rxq_stats;
56895681 u32 chan = ch->index;
5690− unsigned long flags;
56915682 int work_done;
56925683
56935684 rxq_stats = &priv->xstats.rxq_stats[chan];
5694− flags = u64_stats_update_begin_irqsave(&rxq_stats->syncp);
5695− rxq_stats->napi_poll++;
5696− u64_stats_update_end_irqrestore(&rxq_stats->syncp, flags);
5685+ u64_stats_update_begin(&rxq_stats->napi_syncp);
5686+ u64_stats_inc(&rxq_stats->napi.poll);
5687+ u64_stats_update_end(&rxq_stats->napi_syncp);
56975688
56985689 work_done = stmmac_rx(priv, budget, chan);
56995690 if (work_done < budget && napi_complete_done(napi, work_done)) {
@@ -5715,13 +5706,12 @@ static int stmmac_napi_poll_tx(struct napi_struct *napi, int budget) · 15 unmodified lines
57155706 struct stmmac_txq_stats *txq_stats;
57165707 bool pending_packets = false;
57175708 u32 chan = ch->index;
5718− unsigned long flags;
57195709 int work_done;
57205710
57215711 txq_stats = &priv->xstats.txq_stats[chan];
5722− flags = u64_stats_update_begin_irqsave(&txq_stats->syncp);
5723− txq_stats->napi_poll++;
5724− u64_stats_update_end_irqrestore(&txq_stats->syncp, flags);
5712+ u64_stats_update_begin(&txq_stats->napi_syncp);
5713+ u64_stats_inc(&txq_stats->napi.poll);
5714+ u64_stats_update_end(&txq_stats->napi_syncp);
57255715
57265716 work_done = stmmac_tx_clean(priv, budget, chan, &pending_packets);
57275717 work_done = min(work_done, budget);
@@ -5751,17 +5741,16 @@ static int stmmac_napi_poll_rxtx(struct napi_struct *napi, int budget) · 23 unmodified lines
57515741 struct stmmac_rxq_stats *rxq_stats;
57525742 struct stmmac_txq_stats *txq_stats;
57535743 u32 chan = ch->index;
5754− unsigned long flags;
57555744
57565745 rxq_stats = &priv->xstats.rxq_stats[chan];
5757− flags = u64_stats_update_begin_irqsave(&rxq_stats->syncp);
5758− rxq_stats->napi_poll++;
5759− u64_stats_update_end_irqrestore(&rxq_stats->syncp, flags);
5746+ u64_stats_update_begin(&rxq_stats->napi_syncp);
5747+ u64_stats_inc(&rxq_stats->napi.poll);
5748+ u64_stats_update_end(&rxq_stats->napi_syncp);
57605749
57615750 txq_stats = &priv->xstats.txq_stats[chan];
5762− flags = u64_stats_update_begin_irqsave(&txq_stats->syncp);
5763− txq_stats->napi_poll++;
5764− u64_stats_update_end_irqrestore(&txq_stats->syncp, flags);
5751+ u64_stats_update_begin(&txq_stats->napi_syncp);
5752+ u64_stats_inc(&txq_stats->napi.poll);
5753+ u64_stats_update_end(&txq_stats->napi_syncp);
57655754
57665755 tx_done = stmmac_tx_clean(priv, budget, chan, &tx_pending_packets);
57675756 tx_done = min(tx_done, budget);
@@ -7087,10 +7076,13 @@ static void stmmac_get_stats64(struct net_device *dev, struct rtnl_link_stats64 · 1319 unmodified lines
70877076 u64 tx_bytes;
70887077
70897078 do {
7090− start = u64_stats_fetch_begin(&txq_stats->syncp);
7091− tx_packets = txq_stats->tx_packets;
7092− tx_bytes = txq_stats->tx_bytes;
7093− } while (u64_stats_fetch_retry(&txq_stats->syncp, start));
7079+ start = u64_stats_fetch_begin(&txq_stats->q_syncp);
7080+ tx_bytes = u64_stats_read(&txq_stats->q.tx_bytes);
7081+ } while (u64_stats_fetch_retry(&txq_stats->q_syncp, start));
7082+ do {
7083+ start = u64_stats_fetch_begin(&txq_stats->napi_syncp);
7084+ tx_packets = u64_stats_read(&txq_stats->napi.tx_packets);
7085+ } while (u64_stats_fetch_retry(&txq_stats->napi_syncp, start));
70947086
70957087 stats->tx_packets += tx_packets;
70967088 stats->tx_bytes += tx_bytes;
@@ -7102,10 +7094,10 @@ static void stmmac_get_stats64(struct net_device *dev, struct rtnl_link_stats64 · 5 unmodified lines
71027094 u64 rx_bytes;
71037095
71047096 do {
7105− start = u64_stats_fetch_begin(&rxq_stats->syncp);
7106− rx_packets = rxq_stats->rx_packets;
7107− rx_bytes = rxq_stats->rx_bytes;
7108− } while (u64_stats_fetch_retry(&rxq_stats->syncp, start));
7097+ start = u64_stats_fetch_begin(&rxq_stats->napi_syncp);
7098+ rx_packets = u64_stats_read(&rxq_stats->napi.rx_packets);
7099+ rx_bytes = u64_stats_read(&rxq_stats->napi.rx_bytes);
7100+ } while (u64_stats_fetch_retry(&rxq_stats->napi_syncp, start));
71097101
71107102 stats->rx_packets += rx_packets;
71117103 stats->rx_bytes += rx_bytes;
@@ -7499,9 +7491,16 @@ int stmmac_dvr_probe(struct device *device, · 387 unmodified lines
74997491 priv->dev = ndev;
75007492
75017493 for (i = 0; i < MTL_MAX_RX_QUEUES; i++)
7502− u64_stats_init(&priv->xstats.rxq_stats[i].syncp);
7503− for (i = 0; i < MTL_MAX_TX_QUEUES; i++)
7504− u64_stats_init(&priv->xstats.txq_stats[i].syncp);
7494+ u64_stats_init(&priv->xstats.rxq_stats[i].napi_syncp);
7495+ for (i = 0; i < MTL_MAX_TX_QUEUES; i++) {
7496+ u64_stats_init(&priv->xstats.txq_stats[i].q_syncp);
7497+ u64_stats_init(&priv->xstats.txq_stats[i].napi_syncp);
7498+ }
7499+
7500+ priv->xstats.pcpu_stats =
7501+ devm_netdev_alloc_pcpu_stats(device, struct stmmac_pcpu_stats);
7502+ if (!priv->xstats.pcpu_stats)
7503+ return -ENOMEM;
75057504
75067505 stmmac_set_ethtool_ops(ndev);
75077506 priv->pause = pause;
drivers/net/ethernet/ti/cpsw.c+2−0
@@ -631,6 +631,8 @@ static void cpsw_slave_open(struct cpsw_slave *slave, struct cpsw_priv *priv) · 630 unmodified lines
631631 }
632632 }
633633
634+ phy->mac_managed_pm = true;
635+
634636 slave->phy = phy;
635637
636638 phy_attached_info(slave->phy);
drivers/net/ethernet/ti/cpsw_new.c+3−0
@@ -773,6 +773,9 @@ static void cpsw_slave_open(struct cpsw_slave *slave, struct cpsw_priv *priv) · 772 unmodified lines
773773 slave->slave_num);
774774 return;
775775 }
776+
777+ phy->mac_managed_pm = true;
778+
776779 slave->phy = phy;
777780
778781 phy_attached_info(slave->phy);
drivers/net/hyperv/netvsc_drv.c+62−20
@@ -42,6 +42,10 @@ · 41 unmodified lines
4242 #define LINKCHANGE_INT (2 * HZ)
4343 #define VF_TAKEOVER_INT (HZ / 10)
4444
45+/* Macros to define the context of vf registration */
46+#define VF_REG_IN_PROBE 1
47+#define VF_REG_IN_NOTIFIER 2
48+
4549 static unsigned int ring_size __ro_after_init = 128;
4650 module_param(ring_size, uint, 0444);
4751 MODULE_PARM_DESC(ring_size, "Ring buffer size (# of 4K pages)");
@@ -2185,7 +2189,7 @@ static rx_handler_result_t netvsc_vf_handle_frame(struct sk_buff **pskb) · 2137 unmodified lines
21852189 }
21862190
21872191 static int netvsc_vf_join(struct net_device *vf_netdev,
2188− struct net_device *ndev)
2192+ struct net_device *ndev, int context)
21892193 {
21902194 struct net_device_context *ndev_ctx = netdev_priv(ndev);
21912195 int ret;
@@ -2208,7 +2212,11 @@ static int netvsc_vf_join(struct net_device *vf_netdev, · 16 unmodified lines
22082212 goto upper_link_failed;
22092213 }
22102214
2211− schedule_delayed_work(&ndev_ctx->vf_takeover, VF_TAKEOVER_INT);
2215+ /* If this registration is called from probe context vf_takeover
2216+ * is taken care of later in probe itself.
2217+ */
2218+ if (context == VF_REG_IN_NOTIFIER)
2219+ schedule_delayed_work(&ndev_ctx->vf_takeover, VF_TAKEOVER_INT);
22122220
22132221 call_netdevice_notifiers(NETDEV_JOIN, vf_netdev);
22142222
@@ -2346,7 +2354,7 @@ static int netvsc_prepare_bonding(struct net_device *vf_netdev) · 131 unmodified lines
23462354 return NOTIFY_DONE;
23472355 }
23482356
2349−static int netvsc_register_vf(struct net_device *vf_netdev)
2357+static int netvsc_register_vf(struct net_device *vf_netdev, int context)
23502358 {
23512359 struct net_device_context *net_device_ctx;
23522360 struct netvsc_device *netvsc_dev;
@@ -2386,7 +2394,7 @@ static int netvsc_register_vf(struct net_device *vf_netdev) · 33 unmodified lines
23862394
23872395 netdev_info(ndev, "VF registering: %s\n", vf_netdev->name);
23882396
2389− if (netvsc_vf_join(vf_netdev, ndev) != 0)
2397+ if (netvsc_vf_join(vf_netdev, ndev, context) != 0)
23902398 return NOTIFY_DONE;
23912399
23922400 dev_hold(vf_netdev);
@@ -2484,10 +2492,31 @@ static int netvsc_unregister_vf(struct net_device *vf_netdev) · 91 unmodified lines
24842492 return NOTIFY_OK;
24852493 }
24862494
2495+static int check_dev_is_matching_vf(struct net_device *event_ndev)
2496+{
2497+ /* Skip NetVSC interfaces */
2498+ if (event_ndev->netdev_ops == &device_ops)
2499+ return -ENODEV;
2500+
2501+ /* Avoid non-Ethernet type devices */
2502+ if (event_ndev->type != ARPHRD_ETHER)
2503+ return -ENODEV;
2504+
2505+ /* Avoid Vlan dev with same MAC registering as VF */
2506+ if (is_vlan_dev(event_ndev))
2507+ return -ENODEV;
2508+
2509+ /* Avoid Bonding master dev with same MAC registering as VF */
2510+ if (netif_is_bond_master(event_ndev))
2511+ return -ENODEV;
2512+
2513+ return 0;
2514+}
2515+
24872516 static int netvsc_probe(struct hv_device *dev,
24882517 const struct hv_vmbus_device_id *dev_id)
24892518 {
2490− struct net_device *net = NULL;
2519+ struct net_device *net = NULL, *vf_netdev;
24912520 struct net_device_context *net_device_ctx;
24922521 struct netvsc_device_info *device_info = NULL;
24932522 struct netvsc_device *nvdev;
@@ -2599,6 +2628,30 @@ static int netvsc_probe(struct hv_device *dev, · 105 unmodified lines
25992628 }
26002629
26012630 list_add(&net_device_ctx->list, &netvsc_dev_list);
2631+
2632+ /* When the hv_netvsc driver is unloaded and reloaded, the
2633+ * NET_DEVICE_REGISTER for the vf device is replayed before probe
2634+ * is complete. This is because register_netdevice_notifier() gets
2635+ * registered before vmbus_driver_register() so that callback func
2636+ * is set before probe and we don't miss events like NETDEV_POST_INIT
2637+ * So, in this section we try to register the matching vf device that
2638+ * is present as a netdevice, knowing that its register call is not
2639+ * processed in the netvsc_netdev_notifier(as probing is progress and
2640+ * get_netvsc_byslot fails).
2641+ */
2642+ for_each_netdev(dev_net(net), vf_netdev) {
2643+ ret = check_dev_is_matching_vf(vf_netdev);
2644+ if (ret != 0)
2645+ continue;
2646+
2647+ if (net != get_netvsc_byslot(vf_netdev))
2648+ continue;
2649+
2650+ netvsc_prepare_bonding(vf_netdev);
2651+ netvsc_register_vf(vf_netdev, VF_REG_IN_PROBE);
2652+ __netvsc_vf_setup(net, vf_netdev);
2653+ break;
2654+ }
26022655 rtnl_unlock();
26032656
26042657 netvsc_devinfo_put(device_info);
@@ -2754,28 +2807,17 @@ static int netvsc_netdev_event(struct notifier_block *this, · 149 unmodified lines
27542807 unsigned long event, void *ptr)
27552808 {
27562809 struct net_device *event_dev = netdev_notifier_info_to_dev(ptr);
2810+ int ret = 0;
27572811
2758− /* Skip our own events */
2759− if (event_dev->netdev_ops == &device_ops)
2760− return NOTIFY_DONE;
2761−
2762− /* Avoid non-Ethernet type devices */
2763− if (event_dev->type != ARPHRD_ETHER)
2764− return NOTIFY_DONE;
2765−
2766− /* Avoid Vlan dev with same MAC registering as VF */
2767− if (is_vlan_dev(event_dev))
2768− return NOTIFY_DONE;
2769−
2770− /* Avoid Bonding master dev with same MAC registering as VF */
2771− if (netif_is_bond_master(event_dev))
2812+ ret = check_dev_is_matching_vf(event_dev);
2813+ if (ret != 0)
27722814 return NOTIFY_DONE;
27732815
27742816 switch (event) {
27752817 case NETDEV_POST_INIT:
27762818 return netvsc_prepare_bonding(event_dev);
27772819 case NETDEV_REGISTER:
2778− return netvsc_register_vf(event_dev);
2820+ return netvsc_register_vf(event_dev, VF_REG_IN_NOTIFIER);
27792821 case NETDEV_UNREGISTER:
27802822 return netvsc_unregister_vf(event_dev);
27812823 case NETDEV_UP:
drivers/net/netdevsim/dev.c+4−4
@@ -835,14 +835,14 @@ static void nsim_dev_trap_report_work(struct work_struct *work) · 834 unmodified lines
835835 trap_report_dw.work);
836836 nsim_dev = nsim_trap_data->nsim_dev;
837837
838− /* For each running port and enabled packet trap, generate a UDP
839− * packet with a random 5-tuple and report it.
840− */
841838 if (!devl_trylock(priv_to_devlink(nsim_dev))) {
842− schedule_delayed_work(&nsim_dev->trap_data->trap_report_dw, 0);
839+ schedule_delayed_work(&nsim_dev->trap_data->trap_report_dw, 1);
843840 return;
844841 }
845842
843+ /* For each running port and enabled packet trap, generate a UDP
844+ * packet with a random 5-tuple and report it.
845+ */
846846 list_for_each_entry(nsim_dev_port, &nsim_dev->port_list, list) {
847847 if (!netif_running(nsim_dev_port->ns->netdev))
848848 continue;
drivers/net/ppp/ppp_async.c+4−0
@@ -460,6 +460,10 @@ ppp_async_ioctl(struct ppp_channel *chan, unsigned int cmd, unsigned long arg) · 459 unmodified lines
460460 case PPPIOCSMRU:
461461 if (get_user(val, p))
462462 break;
463+ if (val > U16_MAX) {
464+ err = -EINVAL;
465+ break;
466+ }
463467 if (val < PPP_MRU)
464468 val = PPP_MRU;
465469 ap->mru = val;
drivers/net/wireless/ath/ar5523/ar5523.c+1−0
@@ -1803,5 +1803,6 @@ static struct usb_driver ar5523_driver = { · 1802 unmodified lines
18031803
18041804 module_usb_driver(ar5523_driver);
18051805
1806+MODULE_DESCRIPTION("Atheros AR5523 wireless driver");
18061807 MODULE_LICENSE("Dual BSD/GPL");
18071808 MODULE_FIRMWARE(AR5523_FIRMWARE_FILE);
drivers/net/wireless/ath/wcn36xx/main.c+1−0
@@ -1685,6 +1685,7 @@ static struct platform_driver wcn36xx_driver = { · 1684 unmodified lines
16851685
16861686 module_platform_driver(wcn36xx_driver);
16871687
1688+MODULE_DESCRIPTION("Qualcomm Atheros WCN3660/3680 wireless driver");
16881689 MODULE_LICENSE("Dual BSD/GPL");
16891690 MODULE_AUTHOR("Eugene Krasnikov k.eugene.e@gmail.com");
16901691 MODULE_FIRMWARE(WLAN_NV_FILE);
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/module.c+1−0
@@ -20,6 +20,7 @@ static void __exit brcmf_bca_exit(void) · 19 unmodified lines
2020 brcmf_fwvid_unregister_vendor(BRCMF_FWVENDOR_BCA, THIS_MODULE);
2121 }
2222
23+MODULE_DESCRIPTION("Broadcom FullMAC WLAN driver plugin for Broadcom AP chipsets");
2324 MODULE_LICENSE("Dual BSD/GPL");
2425 MODULE_IMPORT_NS(BRCMFMAC);
2526
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c+4−2
@@ -3765,8 +3765,10 @@ static int brcmf_internal_escan_add_info(struct cfg80211_scan_request *req, · 3764 unmodified lines
37653765 if (req->channels[i] == chan)
37663766 break;
37673767 }
3768− if (i == req->n_channels)
3769− req->channels[req->n_channels++] = chan;
3768+ if (i == req->n_channels) {
3769+ req->n_channels++;
3770+ req->channels[i] = chan;
3771+ }
37703772
37713773 for (i = 0; i < req->n_ssids; i++) {
37723774 if (req->ssids[i].ssid_len == ssid_len &&
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/module.c+1−0
@@ -20,6 +20,7 @@ static void __exit brcmf_cyw_exit(void) · 19 unmodified lines
2020 brcmf_fwvid_unregister_vendor(BRCMF_FWVENDOR_CYW, THIS_MODULE);
2121 }
2222
23+MODULE_DESCRIPTION("Broadcom FullMAC WLAN driver plugin for Cypress/Infineon chipsets");
2324 MODULE_LICENSE("Dual BSD/GPL");
2425 MODULE_IMPORT_NS(BRCMFMAC);
2526
drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/module.c+1−0
@@ -20,6 +20,7 @@ static void __exit brcmf_wcc_exit(void) · 19 unmodified lines
2020 brcmf_fwvid_unregister_vendor(BRCMF_FWVENDOR_WCC, THIS_MODULE);
2121 }
2222
23+MODULE_DESCRIPTION("Broadcom FullMAC WLAN driver plugin for Broadcom mobility chipsets");
2324 MODULE_LICENSE("Dual BSD/GPL");
2425 MODULE_IMPORT_NS(BRCMFMAC);
2526
drivers/net/wireless/intel/iwlwifi/fw/api/debug.h+1−1
@@ -537,7 +537,7 @@ enum iwl_fw_dbg_config_cmd_type { · 536 unmodified lines
537537 }; /* LDBG_CFG_CMD_TYPE_API_E_VER_1 */
538538
539539 /* this token disables debug asserts in the firmware */
540−#define IWL_FW_DBG_CONFIG_TOKEN 0x00011301
540+#define IWL_FW_DBG_CONFIG_TOKEN 0x00010001
541541
542542 /**
543543 * struct iwl_fw_dbg_config_cmd - configure FW debug
drivers/net/wireless/intel/iwlwifi/fw/dbg.c+1−2
@@ -1,6 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
22 /*
3− * Copyright (C) 2005-2014, 2018-2023 Intel Corporation
3+ * Copyright (C) 2005-2014, 2018-2024 Intel Corporation
44 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
55 * Copyright (C) 2015-2017 Intel Deutschland GmbH
66 */
@@ -19,7 +19,6 @@ · 12 unmodified lines
1919 * @fwrt_ptr: pointer to the buffer coming from fwrt
2020 * @trans_ptr: pointer to struct %iwl_trans_dump_data which contains the
2121 * transport's data.
22− * @trans_len: length of the valid data in trans_ptr
2322 * @fwrt_len: length of the valid data in fwrt_ptr
2423 */
2524 struct iwl_fw_dump_ptrs {
drivers/net/wireless/intel/iwlwifi/iwl-drv.c+1−0
@@ -128,6 +128,7 @@ static void iwl_dealloc_ucode(struct iwl_drv *drv) · 127 unmodified lines
128128 kfree(drv->fw.ucode_capa.cmd_versions);
129129 kfree(drv->fw.phy_integration_ver);
130130 kfree(drv->trans->dbg.pc_data);
131+ drv->trans->dbg.pc_data = NULL;
131132
132133 for (i = 0; i < IWL_UCODE_TYPE_MAX; i++)
133134 iwl_free_fw_img(drv, drv->fw.img + i);
drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c+1−4
@@ -668,7 +668,6 @@ static const struct ieee80211_sband_iftype_data iwl_he_eht_capa[] = { · 667 unmodified lines
668668 .has_eht = true,
669669 .eht_cap_elem = {
670670 .mac_cap_info[0] =
671− IEEE80211_EHT_MAC_CAP0_EPCS_PRIO_ACCESS |
672671 IEEE80211_EHT_MAC_CAP0_OM_CONTROL |
673672 IEEE80211_EHT_MAC_CAP0_TRIG_TXOP_SHARING_MODE1 |
674673 IEEE80211_EHT_MAC_CAP0_TRIG_TXOP_SHARING_MODE2 |
@@ -793,7 +792,6 @@ static const struct ieee80211_sband_iftype_data iwl_he_eht_capa[] = { · 118 unmodified lines
793792 .has_eht = true,
794793 .eht_cap_elem = {
795794 .mac_cap_info[0] =
796− IEEE80211_EHT_MAC_CAP0_EPCS_PRIO_ACCESS |
797795 IEEE80211_EHT_MAC_CAP0_OM_CONTROL |
798796 IEEE80211_EHT_MAC_CAP0_TRIG_TXOP_SHARING_MODE1 |
799797 IEEE80211_EHT_MAC_CAP0_TRIG_TXOP_SHARING_MODE2,
@@ -1020,8 +1018,7 @@ iwl_nvm_fixup_sband_iftd(struct iwl_trans *trans, · 220 unmodified lines
10201018 if (CSR_HW_REV_TYPE(trans->hw_rev) == IWL_CFG_MAC_TYPE_GL &&
10211019 iftype_data->eht_cap.has_eht) {
10221020 iftype_data->eht_cap.eht_cap_elem.mac_cap_info[0] &=
1023− ~(IEEE80211_EHT_MAC_CAP0_EPCS_PRIO_ACCESS |
1024− IEEE80211_EHT_MAC_CAP0_TRIG_TXOP_SHARING_MODE1 |
1021+ ~(IEEE80211_EHT_MAC_CAP0_TRIG_TXOP_SHARING_MODE1 |
10251022 IEEE80211_EHT_MAC_CAP0_TRIG_TXOP_SHARING_MODE2);
10261023 iftype_data->eht_cap.eht_cap_elem.phy_cap_info[3] &=
10271024 ~(IEEE80211_EHT_PHY_CAP0_PARTIAL_BW_UL_MU_MIMO |
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c+4−2
@@ -1600,7 +1600,8 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw, · 1599 unmodified lines
16001600 */
16011601 if (vif->type == NL80211_IFTYPE_AP ||
16021602 vif->type == NL80211_IFTYPE_ADHOC) {
1603− iwl_mvm_vif_dbgfs_add_link(mvm, vif);
1603+ if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status))
1604+ iwl_mvm_vif_dbgfs_add_link(mvm, vif);
16041605 ret = 0;
16051606 goto out;
16061607 }
@@ -1640,7 +1641,8 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw, · 33 unmodified lines
16401641 iwl_mvm_chandef_get_primary_80(&vif->bss_conf.chandef);
16411642 }
16421643
1643− iwl_mvm_vif_dbgfs_add_link(mvm, vif);
1644+ if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status))
1645+ iwl_mvm_vif_dbgfs_add_link(mvm, vif);
16441646
16451647 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) &&
16461648 vif->type == NL80211_IFTYPE_STATION && !vif->p2p &&
drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c+5−4
@@ -81,7 +81,8 @@ static int iwl_mvm_mld_mac_add_interface(struct ieee80211_hw *hw, · 80 unmodified lines
8181 ieee80211_hw_set(mvm->hw, RX_INCLUDES_FCS);
8282 }
8383
84− iwl_mvm_vif_dbgfs_add_link(mvm, vif);
84+ if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status))
85+ iwl_mvm_vif_dbgfs_add_link(mvm, vif);
8586
8687 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) &&
8788 vif->type == NL80211_IFTYPE_STATION && !vif->p2p &&
@@ -437,6 +438,9 @@ __iwl_mvm_mld_unassign_vif_chanctx(struct iwl_mvm *mvm, · 349 unmodified lines
437438 mvmvif->ap_ibss_active = false;
438439 }
439440
441+ iwl_mvm_link_changed(mvm, vif, link_conf,
442+ LINK_CONTEXT_MODIFY_ACTIVE, false);
443+
440444 if (iwl_mvm_is_esr_supported(mvm->fwrt.trans) && n_active > 1) {
441445 int ret = iwl_mvm_esr_mode_inactive(mvm, vif);
442446
@@ -448,9 +452,6 @@ __iwl_mvm_mld_unassign_vif_chanctx(struct iwl_mvm *mvm, · 5 unmodified lines
448452 if (vif->type == NL80211_IFTYPE_MONITOR)
449453 iwl_mvm_mld_rm_snif_sta(mvm, vif);
450454
451− iwl_mvm_link_changed(mvm, vif, link_conf,
452− LINK_CONTEXT_MODIFY_ACTIVE, false);
453−
454455 if (switching_chanctx)
455456 return;
456457 mvmvif->link[link_id]->phy_ctxt = NULL;
drivers/net/wireless/intersil/p54/p54spi.c+1−0
@@ -700,6 +700,7 @@ static struct spi_driver p54spi_driver = { · 699 unmodified lines
700700
701701 module_spi_driver(p54spi_driver);
702702
703+MODULE_DESCRIPTION("Prism54 SPI wireless driver");
703704 MODULE_LICENSE("GPL");
704705 MODULE_AUTHOR("Christian Lamparter <chunkeey@web.de>");
705706 MODULE_ALIAS("spi:cx3110x");
drivers/net/wireless/mediatek/mt76/mt7603/main.c+1−0
@@ -728,6 +728,7 @@ const struct ieee80211_ops mt7603_ops = { · 727 unmodified lines
728728 .set_sar_specs = mt7603_set_sar_specs,
729729 };
730730
731+MODULE_DESCRIPTION("MediaTek MT7603E and MT76x8 wireless driver");
731732 MODULE_LICENSE("Dual BSD/GPL");
732733
733734 static int __init mt7603_init(void)
drivers/net/wireless/mediatek/mt76/mt7615/main.c+1−0
@@ -1375,4 +1375,5 @@ const struct ieee80211_ops mt7615_ops = { · 1374 unmodified lines
13751375 };
13761376 EXPORT_SYMBOL_GPL(mt7615_ops);
13771377
1378+MODULE_DESCRIPTION("MediaTek MT7615E and MT7663E wireless driver");
13781379 MODULE_LICENSE("Dual BSD/GPL");
drivers/net/wireless/mediatek/mt76/mt7615/mmio.c+1−0
@@ -270,4 +270,5 @@ static void __exit mt7615_exit(void) · 269 unmodified lines
270270
271271 module_init(mt7615_init);
272272 module_exit(mt7615_exit);
273+MODULE_DESCRIPTION("MediaTek MT7615E MMIO helpers");
273274 MODULE_LICENSE("Dual BSD/GPL");
drivers/net/wireless/mediatek/mt76/mt7615/sdio.c+1−0
@@ -253,4 +253,5 @@ module_sdio_driver(mt7663s_driver); · 252 unmodified lines
253253
254254 MODULE_AUTHOR("Sean Wang <sean.wang@mediatek.com>");
255255 MODULE_AUTHOR("Lorenzo Bianconi <lorenzo@kernel.org>");
256+MODULE_DESCRIPTION("MediaTek MT7663S (SDIO) wireless driver");
256257 MODULE_LICENSE("Dual BSD/GPL");
drivers/net/wireless/mediatek/mt76/mt7615/usb.c+1−0
@@ -281,4 +281,5 @@ module_usb_driver(mt7663u_driver); · 280 unmodified lines
281281
282282 MODULE_AUTHOR("Sean Wang <sean.wang@mediatek.com>");
283283 MODULE_AUTHOR("Lorenzo Bianconi <lorenzo@kernel.org>");
284+MODULE_DESCRIPTION("MediaTek MT7663U (USB) wireless driver");
284285 MODULE_LICENSE("Dual BSD/GPL");
drivers/net/wireless/mediatek/mt76/mt7615/usb_sdio.c+1−0
@@ -349,4 +349,5 @@ EXPORT_SYMBOL_GPL(mt7663_usb_sdio_register_device); · 348 unmodified lines
349349
350350 MODULE_AUTHOR("Lorenzo Bianconi <lorenzo@kernel.org>");
351351 MODULE_AUTHOR("Sean Wang <sean.wang@mediatek.com>");
352+MODULE_DESCRIPTION("MediaTek MT7663 SDIO/USB helpers");
352353 MODULE_LICENSE("Dual BSD/GPL");
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c+1−0
@@ -3160,4 +3160,5 @@ exit: · 3159 unmodified lines
31603160 EXPORT_SYMBOL_GPL(mt76_connac2_mcu_fill_message);
31613161
31623162 MODULE_AUTHOR("Lorenzo Bianconi <lorenzo@kernel.org>");
3163+MODULE_DESCRIPTION("MediaTek MT76x connac layer helpers");
31633164 MODULE_LICENSE("Dual BSD/GPL");
drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c+1−0
@@ -342,4 +342,5 @@ int mt76x0_eeprom_init(struct mt76x02_dev *dev) · 341 unmodified lines
342342 return 0;
343343 }
344344
345+MODULE_DESCRIPTION("MediaTek MT76x EEPROM helpers");
345346 MODULE_LICENSE("Dual BSD/GPL");
drivers/net/wireless/mediatek/mt76/mt76x0/pci.c+1−0
@@ -302,6 +302,7 @@ static const struct pci_device_id mt76x0e_device_table[] = { · 301 unmodified lines
302302 MODULE_DEVICE_TABLE(pci, mt76x0e_device_table);
303303 MODULE_FIRMWARE(MT7610E_FIRMWARE);
304304 MODULE_FIRMWARE(MT7650E_FIRMWARE);
305+MODULE_DESCRIPTION("MediaTek MT76x0E (PCIe) wireless driver");
305306 MODULE_LICENSE("Dual BSD/GPL");
306307
307308 static struct pci_driver mt76x0e_driver = {
drivers/net/wireless/mediatek/mt76/mt76x0/usb.c+1−0
@@ -336,6 +336,7 @@ err: · 335 unmodified lines
336336 MODULE_DEVICE_TABLE(usb, mt76x0_device_table);
337337 MODULE_FIRMWARE(MT7610E_FIRMWARE);
338338 MODULE_FIRMWARE(MT7610U_FIRMWARE);
339+MODULE_DESCRIPTION("MediaTek MT76x0U (USB) wireless driver");
339340 MODULE_LICENSE("GPL");
340341
341342 static struct usb_driver mt76x0_driver = {
drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c+1−0
@@ -293,4 +293,5 @@ void mt76x02u_init_mcu(struct mt76_dev *dev) · 292 unmodified lines
293293 EXPORT_SYMBOL_GPL(mt76x02u_init_mcu);
294294
295295 MODULE_AUTHOR("Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>");
296+MODULE_DESCRIPTION("MediaTek MT76x02 MCU helpers");
296297 MODULE_LICENSE("Dual BSD/GPL");
drivers/net/wireless/mediatek/mt76/mt76x02_util.c+1−0
@@ -696,4 +696,5 @@ void mt76x02_config_mac_addr_list(struct mt76x02_dev *dev) · 695 unmodified lines
696696 }
697697 EXPORT_SYMBOL_GPL(mt76x02_config_mac_addr_list);
698698
699+MODULE_DESCRIPTION("MediaTek MT76x02 helpers");
699700 MODULE_LICENSE("Dual BSD/GPL");
drivers/net/wireless/mediatek/mt76/mt76x2/eeprom.c+1−0
@@ -506,4 +506,5 @@ int mt76x2_eeprom_init(struct mt76x02_dev *dev) · 505 unmodified lines
506506 }
507507 EXPORT_SYMBOL_GPL(mt76x2_eeprom_init);
508508
509+MODULE_DESCRIPTION("MediaTek MT76x2 EEPROM helpers");
509510 MODULE_LICENSE("Dual BSD/GPL");
drivers/net/wireless/mediatek/mt76/mt76x2/pci.c+1−0
@@ -165,6 +165,7 @@ mt76x2e_resume(struct pci_dev *pdev) · 164 unmodified lines
165165 MODULE_DEVICE_TABLE(pci, mt76x2e_device_table);
166166 MODULE_FIRMWARE(MT7662_FIRMWARE);
167167 MODULE_FIRMWARE(MT7662_ROM_PATCH);
168+MODULE_DESCRIPTION("MediaTek MT76x2E (PCIe) wireless driver");
168169 MODULE_LICENSE("Dual BSD/GPL");
169170
170171 static struct pci_driver mt76pci_driver = {
drivers/net/wireless/mediatek/mt76/mt76x2/usb.c+1−0
@@ -147,4 +147,5 @@ static struct usb_driver mt76x2u_driver = { · 146 unmodified lines
147147 module_usb_driver(mt76x2u_driver);
148148
149149 MODULE_AUTHOR("Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>");
150+MODULE_DESCRIPTION("MediaTek MT76x2U (USB) wireless driver");
150151 MODULE_LICENSE("Dual BSD/GPL");
drivers/net/wireless/mediatek/mt76/mt7915/mmio.c+1−0
@@ -958,4 +958,5 @@ static void __exit mt7915_exit(void) · 957 unmodified lines
958958
959959 module_init(mt7915_init);
960960 module_exit(mt7915_exit);
961+MODULE_DESCRIPTION("MediaTek MT7915E MMIO helpers");
961962 MODULE_LICENSE("Dual BSD/GPL");
drivers/net/wireless/mediatek/mt76/mt7921/main.c+1−0
@@ -1418,5 +1418,6 @@ const struct ieee80211_ops mt7921_ops = { · 1417 unmodified lines
14181418 };
14191419 EXPORT_SYMBOL_GPL(mt7921_ops);
14201420
1421+MODULE_DESCRIPTION("MediaTek MT7921 core driver");
14211422 MODULE_LICENSE("Dual BSD/GPL");
14221423 MODULE_AUTHOR("Sean Wang <sean.wang@mediatek.com>");
drivers/net/wireless/mediatek/mt76/mt7921/pci.c+1−0
@@ -544,4 +544,5 @@ MODULE_FIRMWARE(MT7922_FIRMWARE_WM); · 543 unmodified lines
544544 MODULE_FIRMWARE(MT7922_ROM_PATCH);
545545 MODULE_AUTHOR("Sean Wang <sean.wang@mediatek.com>");
546546 MODULE_AUTHOR("Lorenzo Bianconi <lorenzo@kernel.org>");
547+MODULE_DESCRIPTION("MediaTek MT7921E (PCIe) wireless driver");
547548 MODULE_LICENSE("Dual BSD/GPL");
drivers/net/wireless/mediatek/mt76/mt7921/sdio.c+1−0
@@ -323,5 +323,6 @@ static struct sdio_driver mt7921s_driver = { · 322 unmodified lines
323323 .drv.pm = pm_sleep_ptr(&mt7921s_pm_ops),
324324 };
325325 module_sdio_driver(mt7921s_driver);
326+MODULE_DESCRIPTION("MediaTek MT7921S (SDIO) wireless driver");
326327 MODULE_AUTHOR("Sean Wang <sean.wang@mediatek.com>");
327328 MODULE_LICENSE("Dual BSD/GPL");
drivers/net/wireless/mediatek/mt76/mt7921/usb.c+1−0
@@ -336,5 +336,6 @@ static struct usb_driver mt7921u_driver = { · 335 unmodified lines
336336 };
337337 module_usb_driver(mt7921u_driver);
338338
339+MODULE_DESCRIPTION("MediaTek MT7921U (USB) wireless driver");
339340 MODULE_AUTHOR("Lorenzo Bianconi <lorenzo@kernel.org>");
340341 MODULE_LICENSE("Dual BSD/GPL");
drivers/net/wireless/mediatek/mt76/mt7925/main.c+1−0
@@ -1450,4 +1450,5 @@ const struct ieee80211_ops mt7925_ops = { · 1449 unmodified lines
14501450 EXPORT_SYMBOL_GPL(mt7925_ops);
14511451
14521452 MODULE_AUTHOR("Deren Wu <deren.wu@mediatek.com>");
1453+MODULE_DESCRIPTION("MediaTek MT7925 core driver");
14531454 MODULE_LICENSE("Dual BSD/GPL");
drivers/net/wireless/mediatek/mt76/mt7925/pci.c+1−0
@@ -583,4 +583,5 @@ MODULE_FIRMWARE(MT7925_FIRMWARE_WM); · 582 unmodified lines
583583 MODULE_FIRMWARE(MT7925_ROM_PATCH);
584584 MODULE_AUTHOR("Deren Wu <deren.wu@mediatek.com>");
585585 MODULE_AUTHOR("Lorenzo Bianconi <lorenzo@kernel.org>");
586+MODULE_DESCRIPTION("MediaTek MT7925E (PCIe) wireless driver");
586587 MODULE_LICENSE("Dual BSD/GPL");
drivers/net/wireless/mediatek/mt76/mt7925/usb.c+1−0
@@ -329,4 +329,5 @@ static struct usb_driver mt7925u_driver = { · 328 unmodified lines
329329 module_usb_driver(mt7925u_driver);
330330
331331 MODULE_AUTHOR("Lorenzo Bianconi <lorenzo@kernel.org>");
332+MODULE_DESCRIPTION("MediaTek MT7925U (USB) wireless driver");
332333 MODULE_LICENSE("Dual BSD/GPL");
drivers/net/wireless/mediatek/mt76/mt792x_core.c+1−0
@@ -862,5 +862,6 @@ int mt792x_load_firmware(struct mt792x_dev *dev) · 861 unmodified lines
862862 }
863863 EXPORT_SYMBOL_GPL(mt792x_load_firmware);
864864
865+MODULE_DESCRIPTION("MediaTek MT792x core driver");
865866 MODULE_LICENSE("Dual BSD/GPL");
866867 MODULE_AUTHOR("Lorenzo Bianconi <lorenzo@kernel.org>");
drivers/net/wireless/mediatek/mt76/mt792x_usb.c+1−0
@@ -314,5 +314,6 @@ void mt792xu_disconnect(struct usb_interface *usb_intf) · 313 unmodified lines
314314 }
315315 EXPORT_SYMBOL_GPL(mt792xu_disconnect);
316316
317+MODULE_DESCRIPTION("MediaTek MT792x USB helpers");
317318 MODULE_LICENSE("Dual BSD/GPL");
318319 MODULE_AUTHOR("Lorenzo Bianconi <lorenzo@kernel.org>");
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c+2−1
@@ -4477,7 +4477,8 @@ int mt7996_mcu_set_txpower_sku(struct mt7996_phy *phy) · 4476 unmodified lines
44774477
44784478 skb_put_data(skb, &req, sizeof(req));
44794479 /* cck and ofdm */
4480− skb_put_data(skb, &la.cck, sizeof(la.cck) + sizeof(la.ofdm));
4480+ skb_put_data(skb, &la.cck, sizeof(la.cck));
4481+ skb_put_data(skb, &la.ofdm, sizeof(la.ofdm));
44814482 /* ht20 */
44824483 skb_put_data(skb, &la.mcs[0], 8);
44834484 /* ht40 */
drivers/net/wireless/mediatek/mt76/mt7996/mmio.c+1−0
@@ -650,4 +650,5 @@ static void __exit mt7996_exit(void) · 649 unmodified lines
650650
651651 module_init(mt7996_init);
652652 module_exit(mt7996_exit);
653+MODULE_DESCRIPTION("MediaTek MT7996 MMIO helpers");
653654 MODULE_LICENSE("Dual BSD/GPL");
drivers/net/wireless/mediatek/mt76/sdio.c+1−0
@@ -672,4 +672,5 @@ EXPORT_SYMBOL_GPL(mt76s_init); · 671 unmodified lines
672672
673673 MODULE_AUTHOR("Sean Wang <sean.wang@mediatek.com>");
674674 MODULE_AUTHOR("Lorenzo Bianconi <lorenzo@kernel.org>");
675+MODULE_DESCRIPTION("MediaTek MT76x SDIO helpers");
675676 MODULE_LICENSE("Dual BSD/GPL");
drivers/net/wireless/mediatek/mt76/usb.c+1−0
@@ -1128,4 +1128,5 @@ int mt76u_init(struct mt76_dev *dev, struct usb_interface *intf) · 1127 unmodified lines
11281128 EXPORT_SYMBOL_GPL(mt76u_init);
11291129
11301130 MODULE_AUTHOR("Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>");
1131+MODULE_DESCRIPTION("MediaTek MT76x USB helpers");
11311132 MODULE_LICENSE("Dual BSD/GPL");
drivers/net/wireless/mediatek/mt76/util.c+1−0
@@ -138,4 +138,5 @@ int __mt76_worker_fn(void *ptr) · 137 unmodified lines
138138 }
139139 EXPORT_SYMBOL_GPL(__mt76_worker_fn);
140140
141+MODULE_DESCRIPTION("MediaTek MT76x helpers");
141142 MODULE_LICENSE("Dual BSD/GPL");
drivers/net/wireless/microchip/wilc1000/netdev.c+1−0
@@ -1010,5 +1010,6 @@ error: · 1009 unmodified lines
10101010 return ERR_PTR(ret);
10111011 }
10121012
1013+MODULE_DESCRIPTION("Atmel WILC1000 core wireless driver");
10131014 MODULE_LICENSE("GPL");
10141015 MODULE_FIRMWARE(WILC1000_FW(WILC1000_API_VER));
drivers/net/wireless/microchip/wilc1000/sdio.c+1−0
@@ -984,4 +984,5 @@ static struct sdio_driver wilc_sdio_driver = { · 983 unmodified lines
984984 module_driver(wilc_sdio_driver,
985985 sdio_register_driver,
986986 sdio_unregister_driver);
987+MODULE_DESCRIPTION("Atmel WILC1000 SDIO wireless driver");
987988 MODULE_LICENSE("GPL");
drivers/net/wireless/microchip/wilc1000/spi.c+1−0
@@ -273,6 +273,7 @@ static struct spi_driver wilc_spi_driver = { · 272 unmodified lines
273273 .remove = wilc_bus_remove,
274274 };
275275 module_spi_driver(wilc_spi_driver);
276+MODULE_DESCRIPTION("Atmel WILC1000 SPI wireless driver");
276277 MODULE_LICENSE("GPL");
277278
278279 static int wilc_spi_tx(struct wilc *wilc, u8 *b, u32 len)
drivers/net/wireless/ti/wl1251/sdio.c+1−0
@@ -343,5 +343,6 @@ static void __exit wl1251_sdio_exit(void) · 342 unmodified lines
343343 module_init(wl1251_sdio_init);
344344 module_exit(wl1251_sdio_exit);
345345
346+MODULE_DESCRIPTION("TI WL1251 SDIO helpers");
346347 MODULE_LICENSE("GPL");
347348 MODULE_AUTHOR("Kalle Valo <kvalo@adurom.com>");
drivers/net/wireless/ti/wl1251/spi.c+1−0
@@ -342,6 +342,7 @@ static struct spi_driver wl1251_spi_driver = { · 341 unmodified lines
342342
343343 module_spi_driver(wl1251_spi_driver);
344344
345+MODULE_DESCRIPTION("TI WL1251 SPI helpers");
345346 MODULE_LICENSE("GPL");
346347 MODULE_AUTHOR("Kalle Valo <kvalo@adurom.com>");
347348 MODULE_ALIAS("spi:wl1251");
drivers/net/wireless/ti/wl12xx/main.c+1−0
@@ -1955,6 +1955,7 @@ module_param_named(tcxo, tcxo_param, charp, 0); · 1954 unmodified lines
19551955 MODULE_PARM_DESC(tcxo,
19561956 "TCXO clock: 19.2, 26, 38.4, 52, 16.368, 32.736, 16.8, 33.6");
19571957
1958+MODULE_DESCRIPTION("TI WL12xx wireless driver");
19581959 MODULE_LICENSE("GPL v2");
19591960 MODULE_AUTHOR("Luciano Coelho <coelho@ti.com>");
19601961 MODULE_FIRMWARE(WL127X_FW_NAME_SINGLE);
drivers/net/wireless/ti/wl18xx/main.c+1−0
@@ -2086,6 +2086,7 @@ module_param_named(num_rx_desc, num_rx_desc_param, int, 0400); · 2085 unmodified lines
20862086 MODULE_PARM_DESC(num_rx_desc_param,
20872087 "Number of Rx descriptors: u8 (default is 32)");
20882088
2089+MODULE_DESCRIPTION("TI WiLink 8 wireless driver");
20892090 MODULE_LICENSE("GPL v2");
20902091 MODULE_AUTHOR("Luciano Coelho <coelho@ti.com>");
20912092 MODULE_FIRMWARE(WL18XX_FW_NAME);
drivers/net/wireless/ti/wlcore/main.c+1−0
@@ -6793,6 +6793,7 @@ MODULE_PARM_DESC(bug_on_recovery, "BUG() on fw recovery"); · 6792 unmodified lines
67936793 module_param(no_recovery, int, 0600);
67946794 MODULE_PARM_DESC(no_recovery, "Prevent HW recovery. FW will remain stuck.");
67956795
6796+MODULE_DESCRIPTION("TI WLAN core driver");
67966797 MODULE_LICENSE("GPL");
67976798 MODULE_AUTHOR("Luciano Coelho <coelho@ti.com>");
67986799 MODULE_AUTHOR("Juuso Oikarinen <juuso.oikarinen@nokia.com>");
drivers/net/wireless/ti/wlcore/sdio.c+1−0
@@ -447,6 +447,7 @@ module_sdio_driver(wl1271_sdio_driver); · 446 unmodified lines
447447 module_param(dump, bool, 0600);
448448 MODULE_PARM_DESC(dump, "Enable sdio read/write dumps.");
449449
450+MODULE_DESCRIPTION("TI WLAN SDIO helpers");
450451 MODULE_LICENSE("GPL");
451452 MODULE_AUTHOR("Luciano Coelho <coelho@ti.com>");
452453 MODULE_AUTHOR("Juuso Oikarinen <juuso.oikarinen@nokia.com>");
drivers/net/wireless/ti/wlcore/spi.c+1−0
@@ -562,6 +562,7 @@ static struct spi_driver wl1271_spi_driver = { · 561 unmodified lines
562562 };
563563
564564 module_spi_driver(wl1271_spi_driver);
565+MODULE_DESCRIPTION("TI WLAN SPI helpers");
565566 MODULE_LICENSE("GPL");
566567 MODULE_AUTHOR("Luciano Coelho <coelho@ti.com>");
567568 MODULE_AUTHOR("Juuso Oikarinen <juuso.oikarinen@nokia.com>");
drivers/nvme/common/auth.c+1−0
@@ -471,4 +471,5 @@ int nvme_auth_generate_key(u8 *secret, struct nvme_dhchap_key **ret_key) · 470 unmodified lines
471471 }
472472 EXPORT_SYMBOL_GPL(nvme_auth_generate_key);
473473
474+MODULE_DESCRIPTION("NVMe Authentication framework");
474475 MODULE_LICENSE("GPL v2");
drivers/nvme/common/keyring.c+1−0
@@ -181,5 +181,6 @@ static void __exit nvme_keyring_exit(void) · 180 unmodified lines
181181
182182 MODULE_LICENSE("GPL v2");
183183 MODULE_AUTHOR("Hannes Reinecke <hare@suse.de>");
184+MODULE_DESCRIPTION("NVMe Keyring implementation");
184185 module_init(nvme_keyring_init);
185186 module_exit(nvme_keyring_exit);
drivers/nvme/host/apple.c+7−6
@@ -797,6 +797,7 @@ static int apple_nvme_init_request(struct blk_mq_tag_set *set, · 796 unmodified lines
797797
798798 static void apple_nvme_disable(struct apple_nvme *anv, bool shutdown)
799799 {
800+ enum nvme_ctrl_state state = nvme_ctrl_state(&anv->ctrl);
800801 u32 csts = readl(anv->mmio_nvme + NVME_REG_CSTS);
801802 bool dead = false, freeze = false;
802803 unsigned long flags;
@@ -808,8 +809,8 @@ static void apple_nvme_disable(struct apple_nvme *anv, bool shutdown) · 5 unmodified lines
808809 if (csts & NVME_CSTS_CFS)
809810 dead = true;
810811
811− if (anv->ctrl.state == NVME_CTRL_LIVE ||
812− anv->ctrl.state == NVME_CTRL_RESETTING) {
812+ if (state == NVME_CTRL_LIVE ||
813+ state == NVME_CTRL_RESETTING) {
813814 freeze = true;
814815 nvme_start_freeze(&anv->ctrl);
815816 }
@@ -881,7 +882,7 @@ static enum blk_eh_timer_return apple_nvme_timeout(struct request *req) · 65 unmodified lines
881882 unsigned long flags;
882883 u32 csts = readl(anv->mmio_nvme + NVME_REG_CSTS);
883884
884− if (anv->ctrl.state != NVME_CTRL_LIVE) {
885+ if (nvme_ctrl_state(&anv->ctrl) != NVME_CTRL_LIVE) {
885886 /*
886887 * From rdma.c:
887888 * If we are resetting, connecting or deleting we should
@@ -985,10 +986,10 @@ static void apple_nvme_reset_work(struct work_struct *work) · 97 unmodified lines
985986 u32 boot_status, aqa;
986987 struct apple_nvme *anv =
987988 container_of(work, struct apple_nvme, ctrl.reset_work);
989+ enum nvme_ctrl_state state = nvme_ctrl_state(&anv->ctrl);
988990
989− if (anv->ctrl.state != NVME_CTRL_RESETTING) {
990− dev_warn(anv->dev, "ctrl state %d is not RESETTING\n",
991− anv->ctrl.state);
991+ if (state != NVME_CTRL_RESETTING) {
992+ dev_warn(anv->dev, "ctrl state %d is not RESETTING\n", state);
992993 ret = -ENODEV;
993994 goto out;
994995 }
drivers/nvme/host/auth.c+9−10
@@ -48,11 +48,6 @@ struct nvme_dhchap_queue_context { · 47 unmodified lines
4848
4949 static struct workqueue_struct *nvme_auth_wq;
5050
51−#define nvme_auth_flags_from_qid(qid) \
52− (qid == 0) ? 0 : BLK_MQ_REQ_NOWAIT | BLK_MQ_REQ_RESERVED
53−#define nvme_auth_queue_from_qid(ctrl, qid) \
54− (qid == 0) ? (ctrl)->fabrics_q : (ctrl)->connect_q
55−
5651 static inline int ctrl_max_dhchaps(struct nvme_ctrl *ctrl)
5752 {
5853 return ctrl->opts->nr_io_queues + ctrl->opts->nr_write_queues +
@@ -63,10 +58,15 @@ static int nvme_auth_submit(struct nvme_ctrl *ctrl, int qid, · 4 unmodified lines
6358 void *data, size_t data_len, bool auth_send)
6459 {
6560 struct nvme_command cmd = {};
66− blk_mq_req_flags_t flags = nvme_auth_flags_from_qid(qid);
67− struct request_queue *q = nvme_auth_queue_from_qid(ctrl, qid);
61+ nvme_submit_flags_t flags = NVME_SUBMIT_RETRY;
62+ struct request_queue *q = ctrl->fabrics_q;
6863 int ret;
6964
65+ if (qid != 0) {
66+ flags |= NVME_SUBMIT_NOWAIT | NVME_SUBMIT_RESERVED;
67+ q = ctrl->connect_q;
68+ }
69+
7070 cmd.auth_common.opcode = nvme_fabrics_command;
7171 cmd.auth_common.secp = NVME_AUTH_DHCHAP_PROTOCOL_IDENTIFIER;
7272 cmd.auth_common.spsp0 = 0x01;
@@ -80,8 +80,7 @@ static int nvme_auth_submit(struct nvme_ctrl *ctrl, int qid, · 7 unmodified lines
8080 }
8181
8282 ret = __nvme_submit_sync_cmd(q, &cmd, NULL, data, data_len,
83− qid == 0 ? NVME_QID_ANY : qid,
84− 0, flags);
83+ qid == 0 ? NVME_QID_ANY : qid, flags);
8584 if (ret > 0)
8685 dev_warn(ctrl->device,
8786 "qid %d auth_send failed with status %d\n", qid, ret);
@@ -897,7 +896,7 @@ static void nvme_ctrl_auth_work(struct work_struct *work) · 809 unmodified lines
897896 * If the ctrl is no connected, bail as reconnect will handle
898897 * authentication.
899898 */
900− if (ctrl->state != NVME_CTRL_LIVE)
899+ if (nvme_ctrl_state(ctrl) != NVME_CTRL_LIVE)
901900 return;
902901
903902 /* Authenticate admin queue first */
drivers/nvme/host/constants.c+5−5
@@ -171,15 +171,15 @@ static const char * const nvme_statuses[] = { · 170 unmodified lines
171171 [NVME_SC_HOST_ABORTED_CMD] = "Host Aborted Command",
172172 };
173173
174−const unsigned char *nvme_get_error_status_str(u16 status)
174+const char *nvme_get_error_status_str(u16 status)
175175 {
176176 status &= 0x7ff;
177177 if (status < ARRAY_SIZE(nvme_statuses) && nvme_statuses[status])
178− return nvme_statuses[status & 0x7ff];
178+ return nvme_statuses[status];
179179 return "Unknown";
180180 }
181181
182−const unsigned char *nvme_get_opcode_str(u8 opcode)
182+const char *nvme_get_opcode_str(u8 opcode)
183183 {
184184 if (opcode < ARRAY_SIZE(nvme_ops) && nvme_ops[opcode])
185185 return nvme_ops[opcode];
@@ -187,7 +187,7 @@ const unsigned char *nvme_get_opcode_str(u8 opcode) · 1 unmodified line
187187 }
188188 EXPORT_SYMBOL_GPL(nvme_get_opcode_str);
189189
190−const unsigned char *nvme_get_admin_opcode_str(u8 opcode)
190+const char *nvme_get_admin_opcode_str(u8 opcode)
191191 {
192192 if (opcode < ARRAY_SIZE(nvme_admin_ops) && nvme_admin_ops[opcode])
193193 return nvme_admin_ops[opcode];
@@ -195,7 +195,7 @@ const unsigned char *nvme_get_admin_opcode_str(u8 opcode) · 1 unmodified line
195195 }
196196 EXPORT_SYMBOL_GPL(nvme_get_admin_opcode_str);
197197
198−const unsigned char *nvme_get_fabrics_opcode_str(u8 opcode) {
198+const char *nvme_get_fabrics_opcode_str(u8 opcode) {
199199 if (opcode < ARRAY_SIZE(nvme_fabrics_ops) && nvme_fabrics_ops[opcode])
200200 return nvme_fabrics_ops[opcode];
201201 return "Unknown";
drivers/nvme/host/core.c+70−15
@@ -338,6 +338,30 @@ static void nvme_log_error(struct request *req) · 337 unmodified lines
338338 nr->status & NVME_SC_DNR ? "DNR " : "");
339339 }
340340
341+static void nvme_log_err_passthru(struct request *req)
342+{
343+ struct nvme_ns *ns = req->q->queuedata;
344+ struct nvme_request *nr = nvme_req(req);
345+
346+ pr_err_ratelimited("%s: %s(0x%x), %s (sct 0x%x / sc 0x%x) %s%s"
347+ "cdw10=0x%x cdw11=0x%x cdw12=0x%x cdw13=0x%x cdw14=0x%x cdw15=0x%x\n",
348+ ns ? ns->disk->disk_name : dev_name(nr->ctrl->device),
349+ ns ? nvme_get_opcode_str(nr->cmd->common.opcode) :
350+ nvme_get_admin_opcode_str(nr->cmd->common.opcode),
351+ nr->cmd->common.opcode,
352+ nvme_get_error_status_str(nr->status),
353+ nr->status >> 8 & 7, /* Status Code Type */
354+ nr->status & 0xff, /* Status Code */
355+ nr->status & NVME_SC_MORE ? "MORE " : "",
356+ nr->status & NVME_SC_DNR ? "DNR " : "",
357+ nr->cmd->common.cdw10,
358+ nr->cmd->common.cdw11,
359+ nr->cmd->common.cdw12,
360+ nr->cmd->common.cdw13,
361+ nr->cmd->common.cdw14,
362+ nr->cmd->common.cdw14);
363+}
364+
341365 enum nvme_disposition {
342366 COMPLETE,
343367 RETRY,
@@ -385,8 +409,12 @@ static inline void nvme_end_req(struct request *req) · 41 unmodified lines
385409 {
386410 blk_status_t status = nvme_error_status(nvme_req(req)->status);
387411
388− if (unlikely(nvme_req(req)->status && !(req->rq_flags & RQF_QUIET)))
389− nvme_log_error(req);
412+ if (unlikely(nvme_req(req)->status && !(req->rq_flags & RQF_QUIET))) {
413+ if (blk_rq_is_passthrough(req))
414+ nvme_log_err_passthru(req);
415+ else
416+ nvme_log_error(req);
417+ }
390418 nvme_end_req_zoned(req);
391419 nvme_trace_bio_complete(req);
392420 if (req->cmd_flags & REQ_NVME_MPATH)
@@ -679,10 +707,21 @@ static inline void nvme_clear_nvme_request(struct request *req) · 286 unmodified lines
679707 /* initialize a passthrough request */
680708 void nvme_init_request(struct request *req, struct nvme_command *cmd)
681709 {
682− if (req->q->queuedata)
710+ struct nvme_request *nr = nvme_req(req);
711+ bool logging_enabled;
712+
713+ if (req->q->queuedata) {
714+ struct nvme_ns *ns = req->q->disk->private_data;
715+
716+ logging_enabled = ns->passthru_err_log_enabled;
683717 req->timeout = NVME_IO_TIMEOUT;
684− else /* no queuedata implies admin queue */
718+ } else { /* no queuedata implies admin queue */
719+ logging_enabled = nr->ctrl->passthru_err_log_enabled;
685720 req->timeout = NVME_ADMIN_TIMEOUT;
721+ }
722+
723+ if (!logging_enabled)
724+ req->rq_flags |= RQF_QUIET;
686725
687726 /* passthru commands should let the driver set the SGL flags */
688727 cmd->common.flags &= ~NVME_CMD_SGL_ALL;
@@ -691,8 +730,7 @@ void nvme_init_request(struct request *req, struct nvme_command *cmd) · 2 unmodified lines
691730 if (req->mq_hctx->type == HCTX_TYPE_POLL)
692731 req->cmd_flags |= REQ_POLLED;
693732 nvme_clear_nvme_request(req);
694− req->rq_flags |= RQF_QUIET;
695− memcpy(nvme_req(req)->cmd, cmd, sizeof(*cmd));
733+ memcpy(nr->cmd, cmd, sizeof(*cmd));
696734 }
697735 EXPORT_SYMBOL_GPL(nvme_init_request);
698736
@@ -721,7 +759,7 @@ blk_status_t nvme_fail_nonready_command(struct nvme_ctrl *ctrl, · 22 unmodified lines
721759 EXPORT_SYMBOL_GPL(nvme_fail_nonready_command);
722760
723761 bool __nvme_check_ready(struct nvme_ctrl *ctrl, struct request *rq,
724− bool queue_live)
762+ bool queue_live, enum nvme_ctrl_state state)
725763 {
726764 struct nvme_request *req = nvme_req(rq);
727765
@@ -742,7 +780,7 @@ bool __nvme_check_ready(struct nvme_ctrl *ctrl, struct request *rq, · 14 unmodified lines
742780 * command, which is require to set the queue live in the
743781 * appropinquate states.
744782 */
745− switch (nvme_ctrl_state(ctrl)) {
783+ switch (state) {
746784 case NVME_CTRL_CONNECTING:
747785 if (blk_rq_is_passthrough(rq) && nvme_is_fabrics(req->cmd) &&
748786 (req->cmd->fabrics.fctype == nvme_fabrics_type_connect ||
@@ -1051,20 +1089,27 @@ EXPORT_SYMBOL_NS_GPL(nvme_execute_rq, NVME_TARGET_PASSTHRU); · 302 unmodified lines
10511089 */
10521090 int __nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd,
10531091 union nvme_result *result, void *buffer, unsigned bufflen,
1054− int qid, int at_head, blk_mq_req_flags_t flags)
1092+ int qid, nvme_submit_flags_t flags)
10551093 {
10561094 struct request *req;
10571095 int ret;
1096+ blk_mq_req_flags_t blk_flags = 0;
10581097
1098+ if (flags & NVME_SUBMIT_NOWAIT)
1099+ blk_flags |= BLK_MQ_REQ_NOWAIT;
1100+ if (flags & NVME_SUBMIT_RESERVED)
1101+ blk_flags |= BLK_MQ_REQ_RESERVED;
10591102 if (qid == NVME_QID_ANY)
1060− req = blk_mq_alloc_request(q, nvme_req_op(cmd), flags);
1103+ req = blk_mq_alloc_request(q, nvme_req_op(cmd), blk_flags);
10611104 else
1062− req = blk_mq_alloc_request_hctx(q, nvme_req_op(cmd), flags,
1105+ req = blk_mq_alloc_request_hctx(q, nvme_req_op(cmd), blk_flags,
10631106 qid - 1);
10641107
10651108 if (IS_ERR(req))
10661109 return PTR_ERR(req);
10671110 nvme_init_request(req, cmd);
1111+ if (flags & NVME_SUBMIT_RETRY)
1112+ req->cmd_flags &= ~REQ_FAILFAST_DRIVER;
10681113
10691114 if (buffer && bufflen) {
10701115 ret = blk_rq_map_kern(q, req, buffer, bufflen, GFP_KERNEL);
@@ -1072,7 +1117,7 @@ int __nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd, · 1 unmodified line
10721117 goto out;
10731118 }
10741119
1075− ret = nvme_execute_rq(req, at_head);
1120+ ret = nvme_execute_rq(req, flags & NVME_SUBMIT_AT_HEAD);
10761121 if (result && ret >= 0)
10771122 *result = nvme_req(req)->result;
10781123 out:
@@ -1085,7 +1130,7 @@ int nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd, · 6 unmodified lines
10851130 void *buffer, unsigned bufflen)
10861131 {
10871132 return __nvme_submit_sync_cmd(q, cmd, NULL, buffer, bufflen,
1088− NVME_QID_ANY, 0, 0);
1133+ NVME_QID_ANY, 0);
10891134 }
10901135 EXPORT_SYMBOL_GPL(nvme_submit_sync_cmd);
10911136
@@ -1560,7 +1605,7 @@ static int nvme_features(struct nvme_ctrl *dev, u8 op, unsigned int fid, · 468 unmodified lines
15601605 c.features.dword11 = cpu_to_le32(dword11);
15611606
15621607 ret = __nvme_submit_sync_cmd(dev->admin_q, &c, &res,
1563− buffer, buflen, NVME_QID_ANY, 0, 0);
1608+ buffer, buflen, NVME_QID_ANY, 0);
15641609 if (ret >= 0 && result)
15651610 *result = le32_to_cpu(res.u32);
15661611 return ret;
@@ -2172,7 +2217,7 @@ static int nvme_sec_submit(void *data, u16 spsp, u8 secp, void *buffer, size_t l · 605 unmodified lines
21722217 cmd.common.cdw11 = cpu_to_le32(len);
21732218
21742219 return __nvme_submit_sync_cmd(ctrl->admin_q, &cmd, NULL, buffer, len,
2175− NVME_QID_ANY, 1, 0);
2220+ NVME_QID_ANY, NVME_SUBMIT_AT_HEAD);
21762221 }
21772222
21782223 static void nvme_configure_opal(struct nvme_ctrl *ctrl, bool was_suspended)
@@ -3651,6 +3696,7 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, struct nvme_ns_info *info) · 1472 unmodified lines
36513696
36523697 ns->disk = disk;
36533698 ns->queue = disk->queue;
3699+ ns->passthru_err_log_enabled = false;
36543700
36553701 if (ctrl->opts && ctrl->opts->data_digest)
36563702 blk_queue_flag_set(QUEUE_FLAG_STABLE_WRITES, ns->queue);
@@ -3714,6 +3760,13 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, struct nvme_ns_info *info) · 57 unmodified lines
37143760 nvme_mpath_add_disk(ns, info->anagrpid);
37153761 nvme_fault_inject_init(&ns->fault_inject, ns->disk->disk_name);
37163762
3763+ /*
3764+ * Set ns->disk->device->driver_data to ns so we can access
3765+ * ns->logging_enabled in nvme_passthru_err_log_enabled_store() and
3766+ * nvme_passthru_err_log_enabled_show().
3767+ */
3768+ dev_set_drvdata(disk_to_dev(ns->disk), ns);
3769+
37173770 return;
37183771
37193772 out_cleanup_ns_from_list:
@@ -4514,6 +4567,7 @@ int nvme_init_ctrl(struct nvme_ctrl *ctrl, struct device *dev, · 794 unmodified lines
45144567 int ret;
45154568
45164569 WRITE_ONCE(ctrl->state, NVME_CTRL_NEW);
4570+ ctrl->passthru_err_log_enabled = false;
45174571 clear_bit(NVME_CTRL_FAILFAST_EXPIRED, &ctrl->flags);
45184572 spin_lock_init(&ctrl->lock);
45194573 mutex_init(&ctrl->scan_lock);
@@ -4851,5 +4905,6 @@ static void __exit nvme_core_exit(void) · 331 unmodified lines
48514905
48524906 MODULE_LICENSE("GPL");
48534907 MODULE_VERSION("1.0");
4908+MODULE_DESCRIPTION("NVMe host core framework");
48544909 module_init(nvme_core_init);
48554910 module_exit(nvme_core_exit);
drivers/nvme/host/fabrics.c+12−7
@@ -180,7 +180,7 @@ int nvmf_reg_read32(struct nvme_ctrl *ctrl, u32 off, u32 *val) · 179 unmodified lines
180180 cmd.prop_get.offset = cpu_to_le32(off);
181181
182182 ret = __nvme_submit_sync_cmd(ctrl->fabrics_q, &cmd, &res, NULL, 0,
183− NVME_QID_ANY, 0, 0);
183+ NVME_QID_ANY, 0);
184184
185185 if (ret >= 0)
186186 *val = le64_to_cpu(res.u64);
@@ -226,7 +226,7 @@ int nvmf_reg_read64(struct nvme_ctrl *ctrl, u32 off, u64 *val) · 39 unmodified lines
226226 cmd.prop_get.offset = cpu_to_le32(off);
227227
228228 ret = __nvme_submit_sync_cmd(ctrl->fabrics_q, &cmd, &res, NULL, 0,
229− NVME_QID_ANY, 0, 0);
229+ NVME_QID_ANY, 0);
230230
231231 if (ret >= 0)
232232 *val = le64_to_cpu(res.u64);
@@ -271,7 +271,7 @@ int nvmf_reg_write32(struct nvme_ctrl *ctrl, u32 off, u32 val) · 38 unmodified lines
271271 cmd.prop_set.value = cpu_to_le64(val);
272272
273273 ret = __nvme_submit_sync_cmd(ctrl->fabrics_q, &cmd, NULL, NULL, 0,
274− NVME_QID_ANY, 0, 0);
274+ NVME_QID_ANY, 0);
275275 if (unlikely(ret))
276276 dev_err(ctrl->device,
277277 "Property Set error: %d, offset %#x\n",
@@ -450,8 +450,10 @@ int nvmf_connect_admin_queue(struct nvme_ctrl *ctrl) · 172 unmodified lines
450450 return -ENOMEM;
451451
452452 ret = __nvme_submit_sync_cmd(ctrl->fabrics_q, &cmd, &res,
453− data, sizeof(*data), NVME_QID_ANY, 1,
454− BLK_MQ_REQ_RESERVED | BLK_MQ_REQ_NOWAIT);
453+ data, sizeof(*data), NVME_QID_ANY,
454+ NVME_SUBMIT_AT_HEAD |
455+ NVME_SUBMIT_NOWAIT |
456+ NVME_SUBMIT_RESERVED);
455457 if (ret) {
456458 nvmf_log_connect_error(ctrl, ret, le32_to_cpu(res.u32),
457459 &cmd, data);
@@ -525,8 +527,10 @@ int nvmf_connect_io_queue(struct nvme_ctrl *ctrl, u16 qid) · 67 unmodified lines
525527 return -ENOMEM;
526528
527529 ret = __nvme_submit_sync_cmd(ctrl->connect_q, &cmd, &res,
528− data, sizeof(*data), qid, 1,
529− BLK_MQ_REQ_RESERVED | BLK_MQ_REQ_NOWAIT);
530+ data, sizeof(*data), qid,
531+ NVME_SUBMIT_AT_HEAD |
532+ NVME_SUBMIT_RESERVED |
533+ NVME_SUBMIT_NOWAIT);
530534 if (ret) {
531535 nvmf_log_connect_error(ctrl, ret, le32_to_cpu(res.u32),
532536 &cmd, data);
@@ -1488,6 +1492,7 @@ static void __exit nvmf_exit(void) · 955 unmodified lines
14881492 }
14891493
14901494 MODULE_LICENSE("GPL v2");
1495+MODULE_DESCRIPTION("NVMe host fabrics library");
14911496
14921497 module_init(nvmf_init);
14931498 module_exit(nvmf_exit);
drivers/nvme/host/fabrics.h+5−3
@@ -185,9 +185,11 @@ static inline bool · 184 unmodified lines
185185 nvmf_ctlr_matches_baseopts(struct nvme_ctrl *ctrl,
186186 struct nvmf_ctrl_options *opts)
187187 {
188− if (ctrl->state == NVME_CTRL_DELETING ||
189− ctrl->state == NVME_CTRL_DELETING_NOIO ||
190− ctrl->state == NVME_CTRL_DEAD ||
188+ enum nvme_ctrl_state state = nvme_ctrl_state(ctrl);
189+
190+ if (state == NVME_CTRL_DELETING ||
191+ state == NVME_CTRL_DELETING_NOIO ||
192+ state == NVME_CTRL_DEAD ||
191193 strcmp(opts->subsysnqn, ctrl->opts->subsysnqn) ||
192194 strcmp(opts->host->nqn, ctrl->opts->host->nqn) ||
193195 !uuid_equal(&opts->host->id, &ctrl->opts->host->id))
drivers/nvme/host/fc.c+14−46
@@ -221,11 +221,6 @@ static LIST_HEAD(nvme_fc_lport_list); · 220 unmodified lines
221221 static DEFINE_IDA(nvme_fc_local_port_cnt);
222222 static DEFINE_IDA(nvme_fc_ctrl_cnt);
223223
224−static struct workqueue_struct *nvme_fc_wq;
225−
226−static bool nvme_fc_waiting_to_unload;
227−static DECLARE_COMPLETION(nvme_fc_unload_proceed);
228−
229224 /*
230225 * These items are short-term. They will eventually be moved into
231226 * a generic FC class. See comments in module init.
@@ -255,8 +250,6 @@ nvme_fc_free_lport(struct kref *ref) · 23 unmodified lines
255250 /* remove from transport list */
256251 spin_lock_irqsave(&nvme_fc_lock, flags);
257252 list_del(&lport->port_list);
258− if (nvme_fc_waiting_to_unload && list_empty(&nvme_fc_lport_list))
259− complete(&nvme_fc_unload_proceed);
260253 spin_unlock_irqrestore(&nvme_fc_lock, flags);
261254
262255 ida_free(&nvme_fc_local_port_cnt, lport->localport.port_num);
@@ -2574,6 +2567,7 @@ static enum blk_eh_timer_return nvme_fc_timeout(struct request *rq) · 2311 unmodified lines
25742567 {
25752568 struct nvme_fc_fcp_op *op = blk_mq_rq_to_pdu(rq);
25762569 struct nvme_fc_ctrl *ctrl = op->ctrl;
2570+ u16 qnum = op->queue->qnum;
25772571 struct nvme_fc_cmd_iu *cmdiu = &op->cmd_iu;
25782572 struct nvme_command *sqe = &cmdiu->sqe;
25792573
@@ -2582,10 +2576,11 @@ static enum blk_eh_timer_return nvme_fc_timeout(struct request *rq) · 2 unmodified lines
25822576 * will detect the aborted io and will fail the connection.
25832577 */
25842578 dev_info(ctrl->ctrl.device,
2585− "NVME-FC{%d.%d}: io timeout: opcode %d fctype %d w10/11: "
2579+ "NVME-FC{%d.%d}: io timeout: opcode %d fctype %d (%s) w10/11: "
25862580 "x%08x/x%08x\n",
2587− ctrl->cnum, op->queue->qnum, sqe->common.opcode,
2588− sqe->connect.fctype, sqe->common.cdw10, sqe->common.cdw11);
2581+ ctrl->cnum, qnum, sqe->common.opcode, sqe->fabrics.fctype,
2582+ nvme_fabrics_opcode_str(qnum, sqe),
2583+ sqe->common.cdw10, sqe->common.cdw11);
25892584 if (__nvme_fc_abort_op(ctrl, op))
25902585 nvme_fc_error_recovery(ctrl, "io timeout abort failed");
25912586
@@ -3575,8 +3570,8 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, · 983 unmodified lines
35753570 flush_delayed_work(&ctrl->connect_work);
35763571
35773572 dev_info(ctrl->ctrl.device,
3578− "NVME-FC{%d}: new ctrl: NQN \"%s\"\n",
3579− ctrl->cnum, nvmf_ctrl_subsysnqn(&ctrl->ctrl));
3573+ "NVME-FC{%d}: new ctrl: NQN \"%s\", hostnqn: %s\n",
3574+ ctrl->cnum, nvmf_ctrl_subsysnqn(&ctrl->ctrl), opts->host->nqn);
35803575
35813576 return &ctrl->ctrl;
35823577
@@ -3894,10 +3889,6 @@ static int __init nvme_fc_init_module(void) · 311 unmodified lines
38943889 {
38953890 int ret;
38963891
3897− nvme_fc_wq = alloc_workqueue("nvme_fc_wq", WQ_MEM_RECLAIM, 0);
3898− if (!nvme_fc_wq)
3899− return -ENOMEM;
3900−
39013892 /*
39023893 * NOTE:
39033894 * It is expected that in the future the kernel will combine
@@ -3915,7 +3906,7 @@ static int __init nvme_fc_init_module(void) · 11 unmodified lines
39153906 ret = class_register(&fc_class);
39163907 if (ret) {
39173908 pr_err("couldn't register class fc\n");
3918− goto out_destroy_wq;
3909+ return ret;
39193910 }
39203911
39213912 /*
@@ -3939,8 +3930,6 @@ out_destroy_device: · 17 unmodified lines
39393930 device_destroy(&fc_class, MKDEV(0, 0));
39403931 out_destroy_class:
39413932 class_unregister(&fc_class);
3942−out_destroy_wq:
3943− destroy_workqueue(nvme_fc_wq);
39443933
39453934 return ret;
39463935 }
@@ -3960,48 +3949,27 @@ nvme_fc_delete_controllers(struct nvme_fc_rport *rport) · 13 unmodified lines
39603949 spin_unlock(&rport->lock);
39613950 }
39623951
3963−static void
3964−nvme_fc_cleanup_for_unload(void)
3952+static void __exit nvme_fc_exit_module(void)
39653953 {
39663954 struct nvme_fc_lport *lport;
39673955 struct nvme_fc_rport *rport;
3968−
3969− list_for_each_entry(lport, &nvme_fc_lport_list, port_list) {
3970− list_for_each_entry(rport, &lport->endp_list, endp_list) {
3971− nvme_fc_delete_controllers(rport);
3972− }
3973− }
3974−}
3975−
3976−static void __exit nvme_fc_exit_module(void)
3977−{
39783956 unsigned long flags;
3979− bool need_cleanup = false;
39803957
39813958 spin_lock_irqsave(&nvme_fc_lock, flags);
3982− nvme_fc_waiting_to_unload = true;
3983− if (!list_empty(&nvme_fc_lport_list)) {
3984− need_cleanup = true;
3985− nvme_fc_cleanup_for_unload();
3986− }
3959+ list_for_each_entry(lport, &nvme_fc_lport_list, port_list)
3960+ list_for_each_entry(rport, &lport->endp_list, endp_list)
3961+ nvme_fc_delete_controllers(rport);
39873962 spin_unlock_irqrestore(&nvme_fc_lock, flags);
3988− if (need_cleanup) {
3989− pr_info("%s: waiting for ctlr deletes\n", __func__);
3990− wait_for_completion(&nvme_fc_unload_proceed);
3991− pr_info("%s: ctrl deletes complete\n", __func__);
3992− }
3963+ flush_workqueue(nvme_delete_wq);
39933964
39943965 nvmf_unregister_transport(&nvme_fc_transport);
39953966
3996− ida_destroy(&nvme_fc_local_port_cnt);
3997− ida_destroy(&nvme_fc_ctrl_cnt);
3998−
39993967 device_destroy(&fc_class, MKDEV(0, 0));
40003968 class_unregister(&fc_class);
4001− destroy_workqueue(nvme_fc_wq);
40023969 }
40033970
40043971 module_init(nvme_fc_init_module);
40053972 module_exit(nvme_fc_exit_module);
40063973
3974+MODULE_DESCRIPTION("NVMe host FC transport driver");
40073975 MODULE_LICENSE("GPL v2");
drivers/nvme/host/multipath.c+8−7
@@ -156,7 +156,7 @@ void nvme_kick_requeue_lists(struct nvme_ctrl *ctrl) · 155 unmodified lines
156156 if (!ns->head->disk)
157157 continue;
158158 kblockd_schedule_work(&ns->head->requeue_work);
159− if (ctrl->state == NVME_CTRL_LIVE)
159+ if (nvme_ctrl_state(ns->ctrl) == NVME_CTRL_LIVE)
160160 disk_uevent(ns->head->disk, KOBJ_CHANGE);
161161 }
162162 up_read(&ctrl->namespaces_rwsem);
@@ -223,13 +223,14 @@ void nvme_mpath_revalidate_paths(struct nvme_ns *ns) · 60 unmodified lines
223223
224224 static bool nvme_path_is_disabled(struct nvme_ns *ns)
225225 {
226+ enum nvme_ctrl_state state = nvme_ctrl_state(ns->ctrl);
227+
226228 /*
227229 * We don't treat NVME_CTRL_DELETING as a disabled path as I/O should
228230 * still be able to complete assuming that the controller is connected.
229231 * Otherwise it will fail immediately and return to the requeue list.
230232 */
231− if (ns->ctrl->state != NVME_CTRL_LIVE &&
232− ns->ctrl->state != NVME_CTRL_DELETING)
233+ if (state != NVME_CTRL_LIVE && state != NVME_CTRL_DELETING)
233234 return true;
234235 if (test_bit(NVME_NS_ANA_PENDING, &ns->flags) ||
235236 !test_bit(NVME_NS_READY, &ns->flags))
@@ -331,7 +332,7 @@ out: · 95 unmodified lines
331332
332333 static inline bool nvme_path_is_optimized(struct nvme_ns *ns)
333334 {
334− return ns->ctrl->state == NVME_CTRL_LIVE &&
335+ return nvme_ctrl_state(ns->ctrl) == NVME_CTRL_LIVE &&
335336 ns->ana_state == NVME_ANA_OPTIMIZED;
336337 }
337338
@@ -358,7 +359,7 @@ static bool nvme_available_path(struct nvme_ns_head *head) · 20 unmodified lines
358359 list_for_each_entry_rcu(ns, &head->list, siblings) {
359360 if (test_bit(NVME_CTRL_FAILFAST_EXPIRED, &ns->ctrl->flags))
360361 continue;
361− switch (ns->ctrl->state) {
362+ switch (nvme_ctrl_state(ns->ctrl)) {
362363 case NVME_CTRL_LIVE:
363364 case NVME_CTRL_RESETTING:
364365 case NVME_CTRL_CONNECTING:
@@ -667,7 +668,7 @@ static void nvme_update_ns_ana_state(struct nvme_ana_group_desc *desc, · 302 unmodified lines
667668 * controller is ready.
668669 */
669670 if (nvme_state_is_live(ns->ana_state) &&
670− ns->ctrl->state == NVME_CTRL_LIVE)
671+ nvme_ctrl_state(ns->ctrl) == NVME_CTRL_LIVE)
671672 nvme_mpath_set_live(ns);
672673 }
673674
@@ -748,7 +749,7 @@ static void nvme_ana_work(struct work_struct *work) · 74 unmodified lines
748749 {
749750 struct nvme_ctrl *ctrl = container_of(work, struct nvme_ctrl, ana_work);
750751
751− if (ctrl->state != NVME_CTRL_LIVE)
752+ if (nvme_ctrl_state(ctrl) != NVME_CTRL_LIVE)
752753 return;
753754
754755 nvme_read_ana_log(ctrl);
drivers/nvme/host/nvme.h+43−19
@@ -263,6 +263,7 @@ enum nvme_ctrl_flags { · 262 unmodified lines
263263 struct nvme_ctrl {
264264 bool comp_seen;
265265 bool identified;
266+ bool passthru_err_log_enabled;
266267 enum nvme_ctrl_state state;
267268 spinlock_t lock;
268269 struct mutex scan_lock;
@@ -522,7 +523,7 @@ struct nvme_ns { · 253 unmodified lines
522523 struct device cdev_device;
523524
524525 struct nvme_fault_inject fault_inject;
525−
526+ bool passthru_err_log_enabled;
526527 };
527528
528529 /* NVMe ns supports metadata actions by the controller (generate/strip) */
@@ -805,17 +806,18 @@ blk_status_t nvme_setup_cmd(struct nvme_ns *ns, struct request *req); · 276 unmodified lines
805806 blk_status_t nvme_fail_nonready_command(struct nvme_ctrl *ctrl,
806807 struct request *req);
807808 bool __nvme_check_ready(struct nvme_ctrl *ctrl, struct request *rq,
808− bool queue_live);
809+ bool queue_live, enum nvme_ctrl_state state);
809810
810811 static inline bool nvme_check_ready(struct nvme_ctrl *ctrl, struct request *rq,
811812 bool queue_live)
812813 {
813− if (likely(ctrl->state == NVME_CTRL_LIVE))
814+ enum nvme_ctrl_state state = nvme_ctrl_state(ctrl);
815+
816+ if (likely(state == NVME_CTRL_LIVE))
814817 return true;
815− if (ctrl->ops->flags & NVME_F_FABRICS &&
816− ctrl->state == NVME_CTRL_DELETING)
818+ if (ctrl->ops->flags & NVME_F_FABRICS && state == NVME_CTRL_DELETING)
817819 return queue_live;
818− return __nvme_check_ready(ctrl, rq, queue_live);
820+ return __nvme_check_ready(ctrl, rq, queue_live, state);
819821 }
820822
821823 /*
@@ -836,12 +838,27 @@ static inline bool nvme_is_unique_nsid(struct nvme_ctrl *ctrl, · 14 unmodified lines
836838 (ctrl->ctratt & NVME_CTRL_CTRATT_NVM_SETS);
837839 }
838840
841+/*
842+ * Flags for __nvme_submit_sync_cmd()
843+ */
844+typedef __u32 __bitwise nvme_submit_flags_t;
845+
846+enum {
847+ /* Insert request at the head of the queue */
848+ NVME_SUBMIT_AT_HEAD = (__force nvme_submit_flags_t)(1 << 0),
849+ /* Set BLK_MQ_REQ_NOWAIT when allocating request */
850+ NVME_SUBMIT_NOWAIT = (__force nvme_submit_flags_t)(1 << 1),
851+ /* Set BLK_MQ_REQ_RESERVED when allocating request */
852+ NVME_SUBMIT_RESERVED = (__force nvme_submit_flags_t)(1 << 2),
853+ /* Retry command when NVME_SC_DNR is not set in the result */
854+ NVME_SUBMIT_RETRY = (__force nvme_submit_flags_t)(1 << 3),
855+};
856+
839857 int nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd,
840858 void *buf, unsigned bufflen);
841859 int __nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd,
842860 union nvme_result *result, void *buffer, unsigned bufflen,
843− int qid, int at_head,
844− blk_mq_req_flags_t flags);
861+ int qid, nvme_submit_flags_t flags);
845862 int nvme_set_features(struct nvme_ctrl *dev, unsigned int fid,
846863 unsigned int dword11, void *buffer, size_t buflen,
847864 u32 *result);
@@ -1124,35 +1141,42 @@ static inline bool nvme_multi_css(struct nvme_ctrl *ctrl) · 276 unmodified lines
11241141 }
11251142
11261143 #ifdef CONFIG_NVME_VERBOSE_ERRORS
1127−const unsigned char *nvme_get_error_status_str(u16 status);
1128−const unsigned char *nvme_get_opcode_str(u8 opcode);
1129−const unsigned char *nvme_get_admin_opcode_str(u8 opcode);
1130−const unsigned char *nvme_get_fabrics_opcode_str(u8 opcode);
1144+const char *nvme_get_error_status_str(u16 status);
1145+const char *nvme_get_opcode_str(u8 opcode);
1146+const char *nvme_get_admin_opcode_str(u8 opcode);
1147+const char *nvme_get_fabrics_opcode_str(u8 opcode);
11311148 #else /* CONFIG_NVME_VERBOSE_ERRORS */
1132−static inline const unsigned char *nvme_get_error_status_str(u16 status)
1149+static inline const char *nvme_get_error_status_str(u16 status)
11331150 {
11341151 return "I/O Error";
11351152 }
1136−static inline const unsigned char *nvme_get_opcode_str(u8 opcode)
1153+static inline const char *nvme_get_opcode_str(u8 opcode)
11371154 {
11381155 return "I/O Cmd";
11391156 }
1140−static inline const unsigned char *nvme_get_admin_opcode_str(u8 opcode)
1157+static inline const char *nvme_get_admin_opcode_str(u8 opcode)
11411158 {
11421159 return "Admin Cmd";
11431160 }
11441161
1145−static inline const unsigned char *nvme_get_fabrics_opcode_str(u8 opcode)
1162+static inline const char *nvme_get_fabrics_opcode_str(u8 opcode)
11461163 {
11471164 return "Fabrics Cmd";
11481165 }
11491166 #endif /* CONFIG_NVME_VERBOSE_ERRORS */
11501167
1151−static inline const unsigned char *nvme_opcode_str(int qid, u8 opcode, u8 fctype)
1168+static inline const char *nvme_opcode_str(int qid, u8 opcode)
11521169 {
1153− if (opcode == nvme_fabrics_command)
1154− return nvme_get_fabrics_opcode_str(fctype);
11551170 return qid ? nvme_get_opcode_str(opcode) :
11561171 nvme_get_admin_opcode_str(opcode);
11571172 }
1173+
1174+static inline const char *nvme_fabrics_opcode_str(
1175+ int qid, const struct nvme_command *cmd)
1176+{
1177+ if (nvme_is_fabrics(cmd))
1178+ return nvme_get_fabrics_opcode_str(cmd->fabrics.fctype);
1179+
1180+ return nvme_opcode_str(qid, cmd->common.opcode);
1181+}
11581182 #endif /* _NVME_H */
drivers/nvme/host/pci.c+2−1
@@ -1349,7 +1349,7 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req) · 1348 unmodified lines
13491349 dev_warn(dev->ctrl.device,
13501350 "I/O tag %d (%04x) opcode %#x (%s) QID %d timeout, reset controller\n",
13511351 req->tag, nvme_cid(req), opcode,
1352− nvme_opcode_str(nvmeq->qid, opcode, 0), nvmeq->qid);
1352+ nvme_opcode_str(nvmeq->qid, opcode), nvmeq->qid);
13531353 nvme_req(req)->flags |= NVME_REQ_CANCELLED;
13541354 goto disable;
13551355 }
@@ -3543,5 +3543,6 @@ static void __exit nvme_exit(void) · 2187 unmodified lines
35433543 MODULE_AUTHOR("Matthew Wilcox <willy@linux.intel.com>");
35443544 MODULE_LICENSE("GPL");
35453545 MODULE_VERSION("1.0");
3546+MODULE_DESCRIPTION("NVMe host PCIe transport driver");
35463547 module_init(nvme_init);
35473548 module_exit(nvme_exit);
drivers/nvme/host/rdma.c+14−9
@@ -1410,6 +1410,8 @@ static int nvme_rdma_map_sg_pi(struct nvme_rdma_queue *queue, · 1409 unmodified lines
14101410 struct nvme_ns *ns = rq->q->queuedata;
14111411 struct bio *bio = rq->bio;
14121412 struct nvme_keyed_sgl_desc *sg = &c->common.dptr.ksgl;
1413+ struct blk_integrity *bi = blk_get_integrity(bio->bi_bdev->bd_disk);
1414+ u32 xfer_len;
14131415 int nr;
14141416
14151417 req->mr = ib_mr_pool_get(queue->qp, &queue->qp->sig_mrs);
@@ -1422,8 +1424,7 @@ static int nvme_rdma_map_sg_pi(struct nvme_rdma_queue *queue, · 6 unmodified lines
14221424 if (unlikely(nr))
14231425 goto mr_put;
14241426
1425− nvme_rdma_set_sig_attrs(blk_get_integrity(bio->bi_bdev->bd_disk), c,
1426− req->mr->sig_attrs, ns->head->pi_type);
1427+ nvme_rdma_set_sig_attrs(bi, c, req->mr->sig_attrs, ns->head->pi_type);
14271428 nvme_rdma_set_prot_checks(c, &req->mr->sig_attrs->check_mask);
14281429
14291430 ib_update_fast_reg_key(req->mr, ib_inc_rkey(req->mr->rkey));
@@ -1441,7 +1442,11 @@ static int nvme_rdma_map_sg_pi(struct nvme_rdma_queue *queue, · 11 unmodified lines
14411442 IB_ACCESS_REMOTE_WRITE;
14421443
14431444 sg->addr = cpu_to_le64(req->mr->iova);
1444− put_unaligned_le24(req->mr->length, sg->length);
1445+ xfer_len = req->mr->length;
1446+ /* Check if PI is added by the HW */
1447+ if (!pi_count)
1448+ xfer_len += (xfer_len >> bi->interval_exp) * ns->head->pi_size;
1449+ put_unaligned_le24(xfer_len, sg->length);
14451450 put_unaligned_le32(req->mr->rkey, sg->key);
14461451 sg->type = NVME_KEY_SGL_FMT_DATA_DESC << 4;
14471452
@@ -1946,14 +1951,13 @@ static enum blk_eh_timer_return nvme_rdma_timeout(struct request *rq) · 498 unmodified lines
19461951 struct nvme_rdma_request *req = blk_mq_rq_to_pdu(rq);
19471952 struct nvme_rdma_queue *queue = req->queue;
19481953 struct nvme_rdma_ctrl *ctrl = queue->ctrl;
1949− u8 opcode = req->req.cmd->common.opcode;
1950− u8 fctype = req->req.cmd->fabrics.fctype;
1954+ struct nvme_command *cmd = req->req.cmd;
19511955 int qid = nvme_rdma_queue_idx(queue);
19521956
19531957 dev_warn(ctrl->ctrl.device,
19541958 "I/O tag %d (%04x) opcode %#x (%s) QID %d timeout\n",
1955− rq->tag, nvme_cid(rq), opcode,
1956− nvme_opcode_str(qid, opcode, fctype), qid);
1959+ rq->tag, nvme_cid(rq), cmd->common.opcode,
1960+ nvme_fabrics_opcode_str(qid, cmd), qid);
19571961
19581962 if (nvme_ctrl_state(&ctrl->ctrl) != NVME_CTRL_LIVE) {
19591963 /*
@@ -2296,8 +2300,8 @@ static struct nvme_ctrl *nvme_rdma_create_ctrl(struct device *dev, · 336 unmodified lines
22962300 if (ret)
22972301 goto out_uninit_ctrl;
22982302
2299− dev_info(ctrl->ctrl.device, "new ctrl: NQN \"%s\", addr %pISpcs\n",
2300− nvmf_ctrl_subsysnqn(&ctrl->ctrl), &ctrl->addr);
2303+ dev_info(ctrl->ctrl.device, "new ctrl: NQN \"%s\", addr %pISpcs, hostnqn: %s\n",
2304+ nvmf_ctrl_subsysnqn(&ctrl->ctrl), &ctrl->addr, opts->host->nqn);
23012305
23022306 mutex_lock(&nvme_rdma_ctrl_mutex);
23032307 list_add_tail(&ctrl->list, &nvme_rdma_ctrl_list);
@@ -2400,4 +2404,5 @@ static void __exit nvme_rdma_cleanup_module(void) · 96 unmodified lines
24002404 module_init(nvme_rdma_init_module);
24012405 module_exit(nvme_rdma_cleanup_module);
24022406
2407+MODULE_DESCRIPTION("NVMe host RDMA transport driver");
24032408 MODULE_LICENSE("GPL v2");
drivers/nvme/host/sysfs.c+61−3
@@ -35,6 +35,62 @@ static ssize_t nvme_sysfs_rescan(struct device *dev, · 34 unmodified lines
3535 }
3636 static DEVICE_ATTR(rescan_controller, S_IWUSR, NULL, nvme_sysfs_rescan);
3737
38+static ssize_t nvme_adm_passthru_err_log_enabled_show(struct device *dev,
39+ struct device_attribute *attr, char *buf)
40+{
41+ struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
42+
43+ return sysfs_emit(buf,
44+ ctrl->passthru_err_log_enabled ? "on\n" : "off\n");
45+}
46+
47+static ssize_t nvme_adm_passthru_err_log_enabled_store(struct device *dev,
48+ struct device_attribute *attr, const char *buf, size_t count)
49+{
50+ struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
51+ int err;
52+ bool passthru_err_log_enabled;
53+
54+ err = kstrtobool(buf, &passthru_err_log_enabled);
55+ if (err)
56+ return -EINVAL;
57+
58+ ctrl->passthru_err_log_enabled = passthru_err_log_enabled;
59+
60+ return count;
61+}
62+
63+static ssize_t nvme_io_passthru_err_log_enabled_show(struct device *dev,
64+ struct device_attribute *attr, char *buf)
65+{
66+ struct nvme_ns *n = dev_get_drvdata(dev);
67+
68+ return sysfs_emit(buf, n->passthru_err_log_enabled ? "on\n" : "off\n");
69+}
70+
71+static ssize_t nvme_io_passthru_err_log_enabled_store(struct device *dev,
72+ struct device_attribute *attr, const char *buf, size_t count)
73+{
74+ struct nvme_ns *ns = dev_get_drvdata(dev);
75+ int err;
76+ bool passthru_err_log_enabled;
77+
78+ err = kstrtobool(buf, &passthru_err_log_enabled);
79+ if (err)
80+ return -EINVAL;
81+ ns->passthru_err_log_enabled = passthru_err_log_enabled;
82+
83+ return count;
84+}
85+
86+static struct device_attribute dev_attr_adm_passthru_err_log_enabled = \
87+ __ATTR(passthru_err_log_enabled, S_IRUGO | S_IWUSR, \
88+ nvme_adm_passthru_err_log_enabled_show, nvme_adm_passthru_err_log_enabled_store);
89+
90+static struct device_attribute dev_attr_io_passthru_err_log_enabled = \
91+ __ATTR(passthru_err_log_enabled, S_IRUGO | S_IWUSR, \
92+ nvme_io_passthru_err_log_enabled_show, nvme_io_passthru_err_log_enabled_store);
93+
3894 static inline struct nvme_ns_head *dev_to_ns_head(struct device *dev)
3995 {
4096 struct gendisk *disk = dev_to_disk(dev);
@@ -208,6 +264,7 @@ static struct attribute *nvme_ns_attrs[] = { · 167 unmodified lines
208264 &dev_attr_ana_grpid.attr,
209265 &dev_attr_ana_state.attr,
210266 #endif
267+ &dev_attr_io_passthru_err_log_enabled.attr,
211268 NULL,
212269 };
213270
@@ -311,6 +368,7 @@ static ssize_t nvme_sysfs_show_state(struct device *dev, · 97 unmodified lines
311368 char *buf)
312369 {
313370 struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
371+ unsigned state = (unsigned)nvme_ctrl_state(ctrl);
314372 static const char *const state_name[] = {
315373 [NVME_CTRL_NEW] = "new",
316374 [NVME_CTRL_LIVE] = "live",
@@ -321,9 +379,8 @@ static ssize_t nvme_sysfs_show_state(struct device *dev, · 4 unmodified lines
321379 [NVME_CTRL_DEAD] = "dead",
322380 };
323381
324− if ((unsigned)ctrl->state < ARRAY_SIZE(state_name) &&
325− state_name[ctrl->state])
326− return sysfs_emit(buf, "%s\n", state_name[ctrl->state]);
382+ if (state < ARRAY_SIZE(state_name) && state_name[state])
383+ return sysfs_emit(buf, "%s\n", state_name[state]);
327384
328385 return sysfs_emit(buf, "unknown state\n");
329386 }
@@ -655,6 +712,7 @@ static struct attribute *nvme_dev_attrs[] = { · 325 unmodified lines
655712 #ifdef CONFIG_NVME_TCP_TLS
656713 &dev_attr_tls_key.attr,
657714 #endif
715+ &dev_attr_adm_passthru_err_log_enabled.attr,
658716 NULL
659717 };
660718
drivers/nvme/host/tcp.c+6−5
@@ -2428,13 +2428,13 @@ static enum blk_eh_timer_return nvme_tcp_timeout(struct request *rq) · 2427 unmodified lines
24282428 struct nvme_tcp_request *req = blk_mq_rq_to_pdu(rq);
24292429 struct nvme_ctrl *ctrl = &req->queue->ctrl->ctrl;
24302430 struct nvme_tcp_cmd_pdu *pdu = nvme_tcp_req_cmd_pdu(req);
2431− u8 opc = pdu->cmd.common.opcode, fctype = pdu->cmd.fabrics.fctype;
2431+ struct nvme_command *cmd = &pdu->cmd;
24322432 int qid = nvme_tcp_queue_id(req->queue);
24332433
24342434 dev_warn(ctrl->device,
24352435 "I/O tag %d (%04x) type %d opcode %#x (%s) QID %d timeout\n",
2436− rq->tag, nvme_cid(rq), pdu->hdr.type, opc,
2437− nvme_opcode_str(qid, opc, fctype), qid);
2436+ rq->tag, nvme_cid(rq), pdu->hdr.type, cmd->common.opcode,
2437+ nvme_fabrics_opcode_str(qid, cmd), qid);
24382438
24392439 if (nvme_ctrl_state(ctrl) != NVME_CTRL_LIVE) {
24402440 /*
@@ -2753,8 +2753,8 @@ static struct nvme_ctrl *nvme_tcp_create_ctrl(struct device *dev, · 312 unmodified lines
27532753 if (ret)
27542754 goto out_uninit_ctrl;
27552755
2756− dev_info(ctrl->ctrl.device, "new ctrl: NQN \"%s\", addr %pISp\n",
2757− nvmf_ctrl_subsysnqn(&ctrl->ctrl), &ctrl->addr);
2756+ dev_info(ctrl->ctrl.device, "new ctrl: NQN \"%s\", addr %pISp, hostnqn: %s\n",
2757+ nvmf_ctrl_subsysnqn(&ctrl->ctrl), &ctrl->addr, opts->host->nqn);
27582758
27592759 mutex_lock(&nvme_tcp_ctrl_mutex);
27602760 list_add_tail(&ctrl->list, &nvme_tcp_ctrl_list);
@@ -2826,4 +2826,5 @@ static void __exit nvme_tcp_cleanup_module(void) · 65 unmodified lines
28262826 module_init(nvme_tcp_init_module);
28272827 module_exit(nvme_tcp_cleanup_module);
28282828
2829+MODULE_DESCRIPTION("NVMe host TCP transport driver");
28292830 MODULE_LICENSE("GPL v2");
drivers/nvme/target/core.c+3−2
@@ -248,7 +248,7 @@ void nvmet_ns_changed(struct nvmet_subsys *subsys, u32 nsid) · 247 unmodified lines
248248 nvmet_add_to_changed_ns_log(ctrl, cpu_to_le32(nsid));
249249 if (nvmet_aen_bit_disabled(ctrl, NVME_AEN_BIT_NS_ATTR))
250250 continue;
251− nvmet_add_async_event(ctrl, NVME_AER_TYPE_NOTICE,
251+ nvmet_add_async_event(ctrl, NVME_AER_NOTICE,
252252 NVME_AER_NOTICE_NS_CHANGED,
253253 NVME_LOG_CHANGED_NS);
254254 }
@@ -265,7 +265,7 @@ void nvmet_send_ana_event(struct nvmet_subsys *subsys, · 10 unmodified lines
265265 continue;
266266 if (nvmet_aen_bit_disabled(ctrl, NVME_AEN_BIT_ANA_CHANGE))
267267 continue;
268− nvmet_add_async_event(ctrl, NVME_AER_TYPE_NOTICE,
268+ nvmet_add_async_event(ctrl, NVME_AER_NOTICE,
269269 NVME_AER_NOTICE_ANA, NVME_LOG_ANA);
270270 }
271271 mutex_unlock(&subsys->lock);
@@ -1705,4 +1705,5 @@ static void __exit nvmet_exit(void) · 1433 unmodified lines
17051705 module_init(nvmet_init);
17061706 module_exit(nvmet_exit);
17071707
1708+MODULE_DESCRIPTION("NVMe target core framework");
17081709 MODULE_LICENSE("GPL v2");
drivers/nvme/target/discovery.c+1−1
@@ -21,7 +21,7 @@ static void __nvmet_disc_changed(struct nvmet_port *port, · 20 unmodified lines
2121 if (nvmet_aen_bit_disabled(ctrl, NVME_AEN_BIT_DISC_CHANGE))
2222 return;
2323
24− nvmet_add_async_event(ctrl, NVME_AER_TYPE_NOTICE,
24+ nvmet_add_async_event(ctrl, NVME_AER_NOTICE,
2525 NVME_AER_NOTICE_DISC_CHANGED, NVME_LOG_DISC);
2626 }
2727
drivers/nvme/target/fc.c+103−83
@@ -111,6 +111,8 @@ struct nvmet_fc_tgtport { · 110 unmodified lines
111111 struct nvmet_fc_port_entry *pe;
112112 struct kref ref;
113113 u32 max_sg_cnt;
114+
115+ struct work_struct put_work;
114116 };
115117
116118 struct nvmet_fc_port_entry {
@@ -145,7 +147,6 @@ struct nvmet_fc_tgt_queue { · 28 unmodified lines
145147 struct list_head avail_defer_list;
146148 struct workqueue_struct *work_q;
147149 struct kref ref;
148− struct rcu_head rcu;
149150 /* array of fcp_iods */
150151 struct nvmet_fc_fcp_iod fod[] __counted_by(sqsize);
151152 } __aligned(sizeof(unsigned long long));
@@ -166,10 +167,9 @@ struct nvmet_fc_tgt_assoc { · 14 unmodified lines
166167 struct nvmet_fc_hostport *hostport;
167168 struct nvmet_fc_ls_iod *rcv_disconn;
168169 struct list_head a_list;
169− struct nvmet_fc_tgt_queue __rcu *queues[NVMET_NR_QUEUES + 1];
170+ struct nvmet_fc_tgt_queue *queues[NVMET_NR_QUEUES + 1];
170171 struct kref ref;
171172 struct work_struct del_work;
172− struct rcu_head rcu;
173173 };
174174
175175
@@ -249,6 +249,13 @@ static int nvmet_fc_tgt_a_get(struct nvmet_fc_tgt_assoc *assoc); · 73 unmodified lines
249249 static void nvmet_fc_tgt_q_put(struct nvmet_fc_tgt_queue *queue);
250250 static int nvmet_fc_tgt_q_get(struct nvmet_fc_tgt_queue *queue);
251251 static void nvmet_fc_tgtport_put(struct nvmet_fc_tgtport *tgtport);
252+static void nvmet_fc_put_tgtport_work(struct work_struct *work)
253+{
254+ struct nvmet_fc_tgtport *tgtport =
255+ container_of(work, struct nvmet_fc_tgtport, put_work);
256+
257+ nvmet_fc_tgtport_put(tgtport);
258+}
252259 static int nvmet_fc_tgtport_get(struct nvmet_fc_tgtport *tgtport);
253260 static void nvmet_fc_handle_fcp_rqst(struct nvmet_fc_tgtport *tgtport,
254261 struct nvmet_fc_fcp_iod *fod);
@@ -360,7 +367,7 @@ __nvmet_fc_finish_ls_req(struct nvmet_fc_ls_req_op *lsop) · 105 unmodified lines
360367
361368 if (!lsop->req_queued) {
362369 spin_unlock_irqrestore(&tgtport->lock, flags);
363− return;
370+ goto out_putwork;
364371 }
365372
366373 list_del(&lsop->lsreq_list);
@@ -373,7 +380,8 @@ __nvmet_fc_finish_ls_req(struct nvmet_fc_ls_req_op *lsop) · 6 unmodified lines
373380 (lsreq->rqstlen + lsreq->rsplen),
374381 DMA_BIDIRECTIONAL);
375382
376− nvmet_fc_tgtport_put(tgtport);
383+out_putwork:
384+ queue_work(nvmet_wq, &tgtport->put_work);
377385 }
378386
379387 static int
@@ -489,8 +497,7 @@ nvmet_fc_xmt_disconnect_assoc(struct nvmet_fc_tgt_assoc *assoc) · 109 unmodified lines
489497 * message is normal. Otherwise, send unless the hostport has
490498 * already been invalidated by the lldd.
491499 */
492− if (!tgtport->ops->ls_req || !assoc->hostport ||
493− assoc->hostport->invalid)
500+ if (!tgtport->ops->ls_req || assoc->hostport->invalid)
494501 return;
495502
496503 lsop = kzalloc((sizeof(*lsop) +
@@ -802,14 +809,11 @@ nvmet_fc_alloc_target_queue(struct nvmet_fc_tgt_assoc *assoc, · 305 unmodified lines
802809 if (!queue)
803810 return NULL;
804811
805− if (!nvmet_fc_tgt_a_get(assoc))
806− goto out_free_queue;
807−
808812 queue->work_q = alloc_workqueue("ntfc%d.%d.%d", 0, 0,
809813 assoc->tgtport->fc_target_port.port_num,
810814 assoc->a_id, qid);
811815 if (!queue->work_q)
812− goto out_a_put;
816+ goto out_free_queue;
813817
814818 queue->qid = qid;
815819 queue->sqsize = sqsize;
@@ -831,15 +835,13 @@ nvmet_fc_alloc_target_queue(struct nvmet_fc_tgt_assoc *assoc, · 15 unmodified lines
831835 goto out_fail_iodlist;
832836
833837 WARN_ON(assoc->queues[qid]);
834− rcu_assign_pointer(assoc->queues[qid], queue);
838+ assoc->queues[qid] = queue;
835839
836840 return queue;
837841
838842 out_fail_iodlist:
839843 nvmet_fc_destroy_fcp_iodlist(assoc->tgtport, queue);
840844 destroy_workqueue(queue->work_q);
841−out_a_put:
842− nvmet_fc_tgt_a_put(assoc);
843845 out_free_queue:
844846 kfree(queue);
845847 return NULL;
@@ -852,15 +854,11 @@ nvmet_fc_tgt_queue_free(struct kref *ref) · 6 unmodified lines
852854 struct nvmet_fc_tgt_queue *queue =
853855 container_of(ref, struct nvmet_fc_tgt_queue, ref);
854856
855− rcu_assign_pointer(queue->assoc->queues[queue->qid], NULL);
856−
857857 nvmet_fc_destroy_fcp_iodlist(queue->assoc->tgtport, queue);
858858
859− nvmet_fc_tgt_a_put(queue->assoc);
860−
861859 destroy_workqueue(queue->work_q);
862860
863− kfree_rcu(queue, rcu);
861+ kfree(queue);
864862 }
865863
866864 static void
@@ -969,7 +967,7 @@ nvmet_fc_find_target_queue(struct nvmet_fc_tgtport *tgtport, · 102 unmodified lines
969967 rcu_read_lock();
970968 list_for_each_entry_rcu(assoc, &tgtport->assoc_list, a_list) {
971969 if (association_id == assoc->association_id) {
972− queue = rcu_dereference(assoc->queues[qid]);
970+ queue = assoc->queues[qid];
973971 if (queue &&
974972 (!atomic_read(&queue->connected) ||
975973 !nvmet_fc_tgt_q_get(queue)))
@@ -1078,8 +1076,6 @@ nvmet_fc_alloc_hostport(struct nvmet_fc_tgtport *tgtport, void *hosthandle) · 102 unmodified lines
10781076 /* new allocation not needed */
10791077 kfree(newhost);
10801078 newhost = match;
1081− /* no new allocation - release reference */
1082− nvmet_fc_tgtport_put(tgtport);
10831079 } else {
10841080 newhost->tgtport = tgtport;
10851081 newhost->hosthandle = hosthandle;
@@ -1094,23 +1090,54 @@ nvmet_fc_alloc_hostport(struct nvmet_fc_tgtport *tgtport, void *hosthandle) · 8 unmodified lines
10941090 }
10951091
10961092 static void
1097−nvmet_fc_delete_assoc(struct work_struct *work)
1093+nvmet_fc_delete_assoc(struct nvmet_fc_tgt_assoc *assoc)
1094+{
1095+ nvmet_fc_delete_target_assoc(assoc);
1096+ nvmet_fc_tgt_a_put(assoc);
1097+}
1098+
1099+static void
1100+nvmet_fc_delete_assoc_work(struct work_struct *work)
10981101 {
10991102 struct nvmet_fc_tgt_assoc *assoc =
11001103 container_of(work, struct nvmet_fc_tgt_assoc, del_work);
1104+ struct nvmet_fc_tgtport *tgtport = assoc->tgtport;
11011105
1102− nvmet_fc_delete_target_assoc(assoc);
1103− nvmet_fc_tgt_a_put(assoc);
1106+ nvmet_fc_delete_assoc(assoc);
1107+ nvmet_fc_tgtport_put(tgtport);
1108+}
1109+
1110+static void
1111+nvmet_fc_schedule_delete_assoc(struct nvmet_fc_tgt_assoc *assoc)
1112+{
1113+ nvmet_fc_tgtport_get(assoc->tgtport);
1114+ queue_work(nvmet_wq, &assoc->del_work);
1115+}
1116+
1117+static bool
1118+nvmet_fc_assoc_exits(struct nvmet_fc_tgtport *tgtport, u64 association_id)
1119+{
1120+ struct nvmet_fc_tgt_assoc *a;
1121+
1122+ list_for_each_entry_rcu(a, &tgtport->assoc_list, a_list) {
1123+ if (association_id == a->association_id)
1124+ return true;
1125+ }
1126+
1127+ return false;
11041128 }
11051129
11061130 static struct nvmet_fc_tgt_assoc *
11071131 nvmet_fc_alloc_target_assoc(struct nvmet_fc_tgtport *tgtport, void *hosthandle)
11081132 {
1109− struct nvmet_fc_tgt_assoc *assoc, *tmpassoc;
1133+ struct nvmet_fc_tgt_assoc *assoc;
11101134 unsigned long flags;
1135+ bool done;
11111136 u64 ran;
11121137 int idx;
1113− bool needrandom = true;
1138+
1139+ if (!tgtport->pe)
1140+ return NULL;
11141141
11151142 assoc = kzalloc(sizeof(*assoc), GFP_KERNEL);
11161143 if (!assoc)
@@ -1120,43 +1147,35 @@ nvmet_fc_alloc_target_assoc(struct nvmet_fc_tgtport *tgtport, void *hosthandle) · 3 unmodified lines
11201147 if (idx < 0)
11211148 goto out_free_assoc;
11221149
1123− if (!nvmet_fc_tgtport_get(tgtport))
1124− goto out_ida;
1125−
11261150 assoc->hostport = nvmet_fc_alloc_hostport(tgtport, hosthandle);
11271151 if (IS_ERR(assoc->hostport))
1128− goto out_put;
1152+ goto out_ida;
11291153
11301154 assoc->tgtport = tgtport;
11311155 assoc->a_id = idx;
11321156 INIT_LIST_HEAD(&assoc->a_list);
11331157 kref_init(&assoc->ref);
1134− INIT_WORK(&assoc->del_work, nvmet_fc_delete_assoc);
1158+ INIT_WORK(&assoc->del_work, nvmet_fc_delete_assoc_work);
11351159 atomic_set(&assoc->terminating, 0);
11361160
1137− while (needrandom) {
1161+ done = false;
1162+ do {
11381163 get_random_bytes(&ran, sizeof(ran) - BYTES_FOR_QID);
11391164 ran = ran << BYTES_FOR_QID_SHIFT;
11401165
11411166 spin_lock_irqsave(&tgtport->lock, flags);
1142− needrandom = false;
1143− list_for_each_entry(tmpassoc, &tgtport->assoc_list, a_list) {
1144− if (ran == tmpassoc->association_id) {
1145− needrandom = true;
1146− break;
1147− }
1148− }
1149− if (!needrandom) {
1167+ rcu_read_lock();
1168+ if (!nvmet_fc_assoc_exits(tgtport, ran)) {
11501169 assoc->association_id = ran;
11511170 list_add_tail_rcu(&assoc->a_list, &tgtport->assoc_list);
1171+ done = true;
11521172 }
1173+ rcu_read_unlock();
11531174 spin_unlock_irqrestore(&tgtport->lock, flags);
1154− }
1175+ } while (!done);
11551176
11561177 return assoc;
11571178
1158−out_put:
1159− nvmet_fc_tgtport_put(tgtport);
11601179 out_ida:
11611180 ida_free(&tgtport->assoc_cnt, idx);
11621181 out_free_assoc:
@@ -1172,13 +1191,18 @@ nvmet_fc_target_assoc_free(struct kref *ref) · 9 unmodified lines
11721191 struct nvmet_fc_tgtport *tgtport = assoc->tgtport;
11731192 struct nvmet_fc_ls_iod *oldls;
11741193 unsigned long flags;
1194+ int i;
1195+
1196+ for (i = NVMET_NR_QUEUES; i >= 0; i--) {
1197+ if (assoc->queues[i])
1198+ nvmet_fc_delete_target_queue(assoc->queues[i]);
1199+ }
11751200
11761201 /* Send Disconnect now that all i/o has completed */
11771202 nvmet_fc_xmt_disconnect_assoc(assoc);
11781203
11791204 nvmet_fc_free_hostport(assoc->hostport);
11801205 spin_lock_irqsave(&tgtport->lock, flags);
1181− list_del_rcu(&assoc->a_list);
11821206 oldls = assoc->rcv_disconn;
11831207 spin_unlock_irqrestore(&tgtport->lock, flags);
11841208 /* if pending Rcv Disconnect Association LS, send rsp now */
@@ -1188,8 +1212,7 @@ nvmet_fc_target_assoc_free(struct kref *ref) · 3 unmodified lines
11881212 dev_info(tgtport->dev,
11891213 "{%d:%d} Association freed\n",
11901214 tgtport->fc_target_port.port_num, assoc->a_id);
1191− kfree_rcu(assoc, rcu);
1192− nvmet_fc_tgtport_put(tgtport);
1215+ kfree(assoc);
11931216 }
11941217
11951218 static void
@@ -1208,7 +1231,7 @@ static void · 12 unmodified lines
12081231 nvmet_fc_delete_target_assoc(struct nvmet_fc_tgt_assoc *assoc)
12091232 {
12101233 struct nvmet_fc_tgtport *tgtport = assoc->tgtport;
1211− struct nvmet_fc_tgt_queue *queue;
1234+ unsigned long flags;
12121235 int i, terminating;
12131236
12141237 terminating = atomic_xchg(&assoc->terminating, 1);
@@ -1217,29 +1240,21 @@ nvmet_fc_delete_target_assoc(struct nvmet_fc_tgt_assoc *assoc) · 2 unmodified lines
12171240 if (terminating)
12181241 return;
12191242
1243+ spin_lock_irqsave(&tgtport->lock, flags);
1244+ list_del_rcu(&assoc->a_list);
1245+ spin_unlock_irqrestore(&tgtport->lock, flags);
12201246
1221− for (i = NVMET_NR_QUEUES; i >= 0; i--) {
1222− rcu_read_lock();
1223− queue = rcu_dereference(assoc->queues[i]);
1224− if (!queue) {
1225− rcu_read_unlock();
1226− continue;
1227− }
1247+ synchronize_rcu();
12281248
1229− if (!nvmet_fc_tgt_q_get(queue)) {
1230− rcu_read_unlock();
1231− continue;
1232− }
1233− rcu_read_unlock();
1234− nvmet_fc_delete_target_queue(queue);
1235− nvmet_fc_tgt_q_put(queue);
1249+ /* ensure all in-flight I/Os have been processed */
1250+ for (i = NVMET_NR_QUEUES; i >= 0; i--) {
1251+ if (assoc->queues[i])
1252+ flush_workqueue(assoc->queues[i]->work_q);
12361253 }
12371254
12381255 dev_info(tgtport->dev,
12391256 "{%d:%d} Association deleted\n",
12401257 tgtport->fc_target_port.port_num, assoc->a_id);
1241−
1242− nvmet_fc_tgt_a_put(assoc);
12431258 }
12441259
12451260 static struct nvmet_fc_tgt_assoc *
@@ -1415,6 +1430,7 @@ nvmet_fc_register_targetport(struct nvmet_fc_port_info *pinfo, · 169 unmodified lines
14151430 kref_init(&newrec->ref);
14161431 ida_init(&newrec->assoc_cnt);
14171432 newrec->max_sg_cnt = template->max_sgl_segments;
1433+ INIT_WORK(&newrec->put_work, nvmet_fc_put_tgtport_work);
14181434
14191435 ret = nvmet_fc_alloc_ls_iodlist(newrec);
14201436 if (ret) {
@@ -1492,9 +1508,8 @@ __nvmet_fc_free_assocs(struct nvmet_fc_tgtport *tgtport) · 71 unmodified lines
14921508 list_for_each_entry_rcu(assoc, &tgtport->assoc_list, a_list) {
14931509 if (!nvmet_fc_tgt_a_get(assoc))
14941510 continue;
1495− if (!queue_work(nvmet_wq, &assoc->del_work))
1496− /* already deleting - release local reference */
1497− nvmet_fc_tgt_a_put(assoc);
1511+ nvmet_fc_schedule_delete_assoc(assoc);
1512+ nvmet_fc_tgt_a_put(assoc);
14981513 }
14991514 rcu_read_unlock();
15001515 }
@@ -1540,16 +1555,14 @@ nvmet_fc_invalidate_host(struct nvmet_fc_target_port *target_port, · 39 unmodified lines
15401555 spin_lock_irqsave(&tgtport->lock, flags);
15411556 list_for_each_entry_safe(assoc, next,
15421557 &tgtport->assoc_list, a_list) {
1543− if (!assoc->hostport ||
1544− assoc->hostport->hosthandle != hosthandle)
1558+ if (assoc->hostport->hosthandle != hosthandle)
15451559 continue;
15461560 if (!nvmet_fc_tgt_a_get(assoc))
15471561 continue;
15481562 assoc->hostport->invalid = 1;
15491563 noassoc = false;
1550− if (!queue_work(nvmet_wq, &assoc->del_work))
1551− /* already deleting - release local reference */
1552− nvmet_fc_tgt_a_put(assoc);
1564+ nvmet_fc_schedule_delete_assoc(assoc);
1565+ nvmet_fc_tgt_a_put(assoc);
15531566 }
15541567 spin_unlock_irqrestore(&tgtport->lock, flags);
15551568
@@ -1581,7 +1594,7 @@ nvmet_fc_delete_ctrl(struct nvmet_ctrl *ctrl) · 25 unmodified lines
15811594
15821595 rcu_read_lock();
15831596 list_for_each_entry_rcu(assoc, &tgtport->assoc_list, a_list) {
1584− queue = rcu_dereference(assoc->queues[0]);
1597+ queue = assoc->queues[0];
15851598 if (queue && queue->nvme_sq.ctrl == ctrl) {
15861599 if (nvmet_fc_tgt_a_get(assoc))
15871600 found_ctrl = true;
@@ -1593,9 +1606,8 @@ nvmet_fc_delete_ctrl(struct nvmet_ctrl *ctrl) · 5 unmodified lines
15931606 nvmet_fc_tgtport_put(tgtport);
15941607
15951608 if (found_ctrl) {
1596− if (!queue_work(nvmet_wq, &assoc->del_work))
1597− /* already deleting - release local reference */
1598− nvmet_fc_tgt_a_put(assoc);
1609+ nvmet_fc_schedule_delete_assoc(assoc);
1610+ nvmet_fc_tgt_a_put(assoc);
15991611 return;
16001612 }
16011613
@@ -1625,6 +1637,8 @@ nvmet_fc_unregister_targetport(struct nvmet_fc_target_port *target_port) · 23 unmodified lines
16251637 /* terminate any outstanding associations */
16261638 __nvmet_fc_free_assocs(tgtport);
16271639
1640+ flush_workqueue(nvmet_wq);
1641+
16281642 /*
16291643 * should terminate LS's as well. However, LS's will be generated
16301644 * at the tail end of association termination, so they likely don't
@@ -1870,9 +1884,6 @@ nvmet_fc_ls_disconnect(struct nvmet_fc_tgtport *tgtport, · 239 unmodified lines
18701884 sizeof(struct fcnvme_ls_disconnect_assoc_acc)),
18711885 FCNVME_LS_DISCONNECT_ASSOC);
18721886
1873− /* release get taken in nvmet_fc_find_target_assoc */
1874− nvmet_fc_tgt_a_put(assoc);
1875−
18761887 /*
18771888 * The rules for LS response says the response cannot
18781889 * go back until ABTS's have been sent for all outstanding
@@ -1887,8 +1898,6 @@ nvmet_fc_ls_disconnect(struct nvmet_fc_tgtport *tgtport, · 8 unmodified lines
18871898 assoc->rcv_disconn = iod;
18881899 spin_unlock_irqrestore(&tgtport->lock, flags);
18891900
1890− nvmet_fc_delete_target_assoc(assoc);
1891−
18921901 if (oldls) {
18931902 dev_info(tgtport->dev,
18941903 "{%d:%d} Multiple Disconnect Association LS's "
@@ -1904,6 +1913,9 @@ nvmet_fc_ls_disconnect(struct nvmet_fc_tgtport *tgtport, · 9 unmodified lines
19041913 nvmet_fc_xmt_ls_rsp(tgtport, oldls);
19051914 }
19061915
1916+ nvmet_fc_schedule_delete_assoc(assoc);
1917+ nvmet_fc_tgt_a_put(assoc);
1918+
19071919 return false;
19081920 }
19091921
@@ -2540,8 +2552,9 @@ nvmet_fc_handle_fcp_rqst(struct nvmet_fc_tgtport *tgtport, · 630 unmodified lines
25402552
25412553 fod->req.cmd = &fod->cmdiubuf.sqe;
25422554 fod->req.cqe = &fod->rspiubuf.cqe;
2543− if (tgtport->pe)
2544− fod->req.port = tgtport->pe->port;
2555+ if (!tgtport->pe)
2556+ goto transport_error;
2557+ fod->req.port = tgtport->pe->port;
25452558
25462559 /* clear any response payload */
25472560 memset(&fod->rspiubuf, 0, sizeof(fod->rspiubuf));
@@ -2902,6 +2915,9 @@ nvmet_fc_remove_port(struct nvmet_port *port) · 354 unmodified lines
29022915
29032916 nvmet_fc_portentry_unbind(pe);
29042917
2918+ /* terminate any outstanding associations */
2919+ __nvmet_fc_free_assocs(pe->tgtport);
2920+
29052921 kfree(pe);
29062922 }
29072923
@@ -2933,6 +2949,9 @@ static int __init nvmet_fc_init_module(void) · 25 unmodified lines
29332949
29342950 static void __exit nvmet_fc_exit_module(void)
29352951 {
2952+ /* ensure any shutdown operation, e.g. delete ctrls have finished */
2953+ flush_workqueue(nvmet_wq);
2954+
29362955 /* sanity check - all lports should be removed */
29372956 if (!list_empty(&nvmet_fc_target_list))
29382957 pr_warn("%s: targetport list not empty\n", __func__);
@@ -2945,4 +2964,5 @@ static void __exit nvmet_fc_exit_module(void) · 6 unmodified lines
29452964 module_init(nvmet_fc_init_module);
29462965 module_exit(nvmet_fc_exit_module);
29472966
2967+MODULE_DESCRIPTION("NVMe target FC transport driver");
29482968 MODULE_LICENSE("GPL v2");
drivers/nvme/target/fcloop.c+4−3
@@ -358,7 +358,7 @@ fcloop_h2t_ls_req(struct nvme_fc_local_port *localport, · 357 unmodified lines
358358 if (!rport->targetport) {
359359 tls_req->status = -ECONNREFUSED;
360360 spin_lock(&rport->lock);
361− list_add_tail(&rport->ls_list, &tls_req->ls_list);
361+ list_add_tail(&tls_req->ls_list, &rport->ls_list);
362362 spin_unlock(&rport->lock);
363363 queue_work(nvmet_wq, &rport->ls_work);
364364 return ret;
@@ -391,7 +391,7 @@ fcloop_h2t_xmt_ls_rsp(struct nvmet_fc_target_port *targetport, · 26 unmodified lines
391391 if (remoteport) {
392392 rport = remoteport->private;
393393 spin_lock(&rport->lock);
394− list_add_tail(&rport->ls_list, &tls_req->ls_list);
394+ list_add_tail(&tls_req->ls_list, &rport->ls_list);
395395 spin_unlock(&rport->lock);
396396 queue_work(nvmet_wq, &rport->ls_work);
397397 }
@@ -446,7 +446,7 @@ fcloop_t2h_ls_req(struct nvmet_fc_target_port *targetport, void *hosthandle, · 48 unmodified lines
446446 if (!tport->remoteport) {
447447 tls_req->status = -ECONNREFUSED;
448448 spin_lock(&tport->lock);
449− list_add_tail(&tport->ls_list, &tls_req->ls_list);
449+ list_add_tail(&tls_req->ls_list, &tport->ls_list);
450450 spin_unlock(&tport->lock);
451451 queue_work(nvmet_wq, &tport->ls_work);
452452 return ret;
@@ -1650,4 +1650,5 @@ static void __exit fcloop_exit(void) · 1197 unmodified lines
16501650 module_init(fcloop_init);
16511651 module_exit(fcloop_exit);
16521652
1653+MODULE_DESCRIPTION("NVMe target FC loop transport driver");
16531654 MODULE_LICENSE("GPL v2");
drivers/nvme/target/loop.c+6−3
@@ -400,7 +400,7 @@ static void nvme_loop_shutdown_ctrl(struct nvme_loop_ctrl *ctrl) · 399 unmodified lines
400400 }
401401
402402 nvme_quiesce_admin_queue(&ctrl->ctrl);
403− if (ctrl->ctrl.state == NVME_CTRL_LIVE)
403+ if (nvme_ctrl_state(&ctrl->ctrl) == NVME_CTRL_LIVE)
404404 nvme_disable_ctrl(&ctrl->ctrl, true);
405405
406406 nvme_cancel_admin_tagset(&ctrl->ctrl);
@@ -434,8 +434,10 @@ static void nvme_loop_reset_ctrl_work(struct work_struct *work) · 27 unmodified lines
434434 nvme_loop_shutdown_ctrl(ctrl);
435435
436436 if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING)) {
437− if (ctrl->ctrl.state != NVME_CTRL_DELETING &&
438− ctrl->ctrl.state != NVME_CTRL_DELETING_NOIO)
437+ enum nvme_ctrl_state state = nvme_ctrl_state(&ctrl->ctrl);
438+
439+ if (state != NVME_CTRL_DELETING &&
440+ state != NVME_CTRL_DELETING_NOIO)
439441 /* state change failure for non-deleted ctrl? */
440442 WARN_ON_ONCE(1);
441443 return;
@@ -688,5 +690,6 @@ static void __exit nvme_loop_cleanup_module(void) · 246 unmodified lines
688690 module_init(nvme_loop_init_module);
689691 module_exit(nvme_loop_cleanup_module);
690692
693+MODULE_DESCRIPTION("NVMe target loop transport driver");
691694 MODULE_LICENSE("GPL v2");
692695 MODULE_ALIAS("nvmet-transport-254"); /* 254 == NVMF_TRTYPE_LOOP */
drivers/nvme/target/rdma.c+1−0
@@ -2104,5 +2104,6 @@ static void __exit nvmet_rdma_exit(void) · 2103 unmodified lines
21042104 module_init(nvmet_rdma_init);
21052105 module_exit(nvmet_rdma_exit);
21062106
2107+MODULE_DESCRIPTION("NVMe target RDMA transport driver");
21072108 MODULE_LICENSE("GPL v2");
21082109 MODULE_ALIAS("nvmet-transport-1"); /* 1 == NVMF_TRTYPE_RDMA */
drivers/nvme/target/tcp.c+2−0
@@ -2216,10 +2216,12 @@ static void __exit nvmet_tcp_exit(void) · 2215 unmodified lines
22162216 flush_workqueue(nvmet_wq);
22172217
22182218 destroy_workqueue(nvmet_tcp_wq);
2219+ ida_destroy(&nvmet_tcp_queue_ida);
22192220 }
22202221
22212222 module_init(nvmet_tcp_init);
22222223 module_exit(nvmet_tcp_exit);
22232224
2225+MODULE_DESCRIPTION("NVMe target TCP transport driver");
22242226 MODULE_LICENSE("GPL v2");
22252227 MODULE_ALIAS("nvmet-transport-3"); /* 3 == NVMF_TRTYPE_TCP */
drivers/pci/bus.c+32−17
@@ -386,21 +386,8 @@ void pci_bus_add_devices(const struct pci_bus *bus) · 385 unmodified lines
386386 }
387387 EXPORT_SYMBOL(pci_bus_add_devices);
388388
389−/** pci_walk_bus - walk devices on/under bus, calling callback.
390− * @top bus whose devices should be walked
391− * @cb callback to be called for each device found
392− * @userdata arbitrary pointer to be passed to callback.
393− *
394− * Walk the given bus, including any bridged devices
395− * on buses under this bus. Call the provided callback
396− * on each device found.
397− *
398− * We check the return of @cb each time. If it returns anything
399− * other than 0, we break out.
400− *
401− */
402−void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *),
403− void *userdata)
389+static void __pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *),
390+ void *userdata, bool locked)
404391 {
405392 struct pci_dev *dev;
406393 struct pci_bus *bus;
@@ -408,7 +395,8 @@ void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *), · 1 unmodified line
408395 int retval;
409396
410397 bus = top;
411− down_read(&pci_bus_sem);
398+ if (!locked)
399+ down_read(&pci_bus_sem);
412400 next = top->devices.next;
413401 for (;;) {
414402 if (next == &bus->devices) {
@@ -431,10 +419,37 @@ void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *), · 16 unmodified lines
431419 if (retval)
432420 break;
433421 }
434− up_read(&pci_bus_sem);
422+ if (!locked)
423+ up_read(&pci_bus_sem);
424+}
425+
426+/**
427+ * pci_walk_bus - walk devices on/under bus, calling callback.
428+ * @top: bus whose devices should be walked
429+ * @cb: callback to be called for each device found
430+ * @userdata: arbitrary pointer to be passed to callback
431+ *
432+ * Walk the given bus, including any bridged devices
433+ * on buses under this bus. Call the provided callback
434+ * on each device found.
435+ *
436+ * We check the return of @cb each time. If it returns anything
437+ * other than 0, we break out.
438+ */
439+void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *), void *userdata)
440+{
441+ __pci_walk_bus(top, cb, userdata, false);
435442 }
436443 EXPORT_SYMBOL_GPL(pci_walk_bus);
437444
445+void pci_walk_bus_locked(struct pci_bus *top, int (*cb)(struct pci_dev *, void *), void *userdata)
446+{
447+ lockdep_assert_held(&pci_bus_sem);
448+
449+ __pci_walk_bus(top, cb, userdata, true);
450+}
451+EXPORT_SYMBOL_GPL(pci_walk_bus_locked);
452+
438453 struct pci_bus *pci_bus_get(struct pci_bus *bus)
439454 {
440455 if (bus)
drivers/pci/controller/dwc/pcie-qcom.c+1−1
@@ -972,7 +972,7 @@ static int qcom_pcie_enable_aspm(struct pci_dev *pdev, void *userdata) · 971 unmodified lines
972972 * Downstream devices need to be in D0 state before enabling PCI PM
973973 * substates.
974974 */
975− pci_set_power_state(pdev, PCI_D0);
975+ pci_set_power_state_locked(pdev, PCI_D0);
976976 pci_enable_link_state_locked(pdev, PCIE_LINK_STATE_ALL);
977977
978978 return 0;
drivers/pci/pci.c+52−26
@@ -1354,6 +1354,7 @@ end: · 1353 unmodified lines
13541354 /**
13551355 * pci_set_full_power_state - Put a PCI device into D0 and update its state
13561356 * @dev: PCI device to power up
1357+ * @locked: whether pci_bus_sem is held
13571358 *
13581359 * Call pci_power_up() to put @dev into D0, read from its PCI_PM_CTRL register
13591360 * to confirm the state change, restore its BARs if they might be lost and
@@ -1363,7 +1364,7 @@ end: · 3 unmodified lines
13631364 * to D0, it is more efficient to use pci_power_up() directly instead of this
13641365 * function.
13651366 */
1366−static int pci_set_full_power_state(struct pci_dev *dev)
1367+static int pci_set_full_power_state(struct pci_dev *dev, bool locked)
13671368 {
13681369 u16 pmcsr;
13691370 int ret;
@@ -1399,7 +1400,7 @@ static int pci_set_full_power_state(struct pci_dev *dev) · 29 unmodified lines
13991400 }
14001401
14011402 if (dev->bus->self)
1402− pcie_aspm_pm_state_change(dev->bus->self);
1403+ pcie_aspm_pm_state_change(dev->bus->self, locked);
14031404
14041405 return 0;
14051406 }
@@ -1428,10 +1429,22 @@ void pci_bus_set_current_state(struct pci_bus *bus, pci_power_t state) · 22 unmodified lines
14281429 pci_walk_bus(bus, __pci_dev_set_current_state, &state);
14291430 }
14301431
1432+static void __pci_bus_set_current_state(struct pci_bus *bus, pci_power_t state, bool locked)
1433+{
1434+ if (!bus)
1435+ return;
1436+
1437+ if (locked)
1438+ pci_walk_bus_locked(bus, __pci_dev_set_current_state, &state);
1439+ else
1440+ pci_walk_bus(bus, __pci_dev_set_current_state, &state);
1441+}
1442+
14311443 /**
14321444 * pci_set_low_power_state - Put a PCI device into a low-power state.
14331445 * @dev: PCI device to handle.
14341446 * @state: PCI power state (D1, D2, D3hot) to put the device into.
1447+ * @locked: whether pci_bus_sem is held
14351448 *
14361449 * Use the device's PCI_PM_CTRL register to put it into a low-power state.
14371450 *
@@ -1442,7 +1455,7 @@ void pci_bus_set_current_state(struct pci_bus *bus, pci_power_t state) · 4 unmodified lines
14421455 * 0 if device already is in the requested state.
14431456 * 0 if device's power state has been successfully changed.
14441457 */
1445−static int pci_set_low_power_state(struct pci_dev *dev, pci_power_t state)
1458+static int pci_set_low_power_state(struct pci_dev *dev, pci_power_t state, bool locked)
14461459 {
14471460 u16 pmcsr;
14481461
@@ -1496,29 +1509,12 @@ static int pci_set_low_power_state(struct pci_dev *dev, pci_power_t state) · 47 unmodified lines
14961509 pci_power_name(state));
14971510
14981511 if (dev->bus->self)
1499− pcie_aspm_pm_state_change(dev->bus->self);
1512+ pcie_aspm_pm_state_change(dev->bus->self, locked);
15001513
15011514 return 0;
15021515 }
15031516
1504−/**
1505− * pci_set_power_state - Set the power state of a PCI device
1506− * @dev: PCI device to handle.
1507− * @state: PCI power state (D0, D1, D2, D3hot) to put the device into.
1508− *
1509− * Transition a device to a new power state, using the platform firmware and/or
1510− * the device's PCI PM registers.
1511− *
1512− * RETURN VALUE:
1513− * -EINVAL if the requested state is invalid.
1514− * -EIO if device does not support PCI PM or its PM capabilities register has a
1515− * wrong version, or device doesn't support the requested state.
1516− * 0 if the transition is to D1 or D2 but D1 and D2 are not supported.
1517− * 0 if device already is in the requested state.
1518− * 0 if the transition is to D3 but D3 is not supported.
1519− * 0 if device's power state has been successfully changed.
1520− */
1521−int pci_set_power_state(struct pci_dev *dev, pci_power_t state)
1517+static int __pci_set_power_state(struct pci_dev *dev, pci_power_t state, bool locked)
15221518 {
15231519 int error;
15241520
@@ -1542,7 +1538,7 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state) · 17 unmodified lines
15421538 return 0;
15431539
15441540 if (state == PCI_D0)
1545− return pci_set_full_power_state(dev);
1541+ return pci_set_full_power_state(dev, locked);
15461542
15471543 /*
15481544 * This device is quirked not to be put into D3, so don't put it in
@@ -1556,16 +1552,16 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state) · 7 unmodified lines
15561552 * To put the device in D3cold, put it into D3hot in the native
15571553 * way, then put it into D3cold using platform ops.
15581554 */
1559− error = pci_set_low_power_state(dev, PCI_D3hot);
1555+ error = pci_set_low_power_state(dev, PCI_D3hot, locked);
15601556
15611557 if (pci_platform_power_transition(dev, PCI_D3cold))
15621558 return error;
15631559
15641560 /* Powering off a bridge may power off the whole hierarchy */
15651561 if (dev->current_state == PCI_D3cold)
1566− pci_bus_set_current_state(dev->subordinate, PCI_D3cold);
1562+ __pci_bus_set_current_state(dev->subordinate, PCI_D3cold, locked);
15671563 } else {
1568− error = pci_set_low_power_state(dev, state);
1564+ error = pci_set_low_power_state(dev, state, locked);
15691565
15701566 if (pci_platform_power_transition(dev, state))
15711567 return error;
@@ -1573,8 +1569,38 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state) · 1 unmodified line
15731569
15741570 return 0;
15751571 }
1572+
1573+/**
1574+ * pci_set_power_state - Set the power state of a PCI device
1575+ * @dev: PCI device to handle.
1576+ * @state: PCI power state (D0, D1, D2, D3hot) to put the device into.
1577+ *
1578+ * Transition a device to a new power state, using the platform firmware and/or
1579+ * the device's PCI PM registers.
1580+ *
1581+ * RETURN VALUE:
1582+ * -EINVAL if the requested state is invalid.
1583+ * -EIO if device does not support PCI PM or its PM capabilities register has a
1584+ * wrong version, or device doesn't support the requested state.
1585+ * 0 if the transition is to D1 or D2 but D1 and D2 are not supported.
1586+ * 0 if device already is in the requested state.
1587+ * 0 if the transition is to D3 but D3 is not supported.
1588+ * 0 if device's power state has been successfully changed.
1589+ */
1590+int pci_set_power_state(struct pci_dev *dev, pci_power_t state)
1591+{
1592+ return __pci_set_power_state(dev, state, false);
1593+}
15761594 EXPORT_SYMBOL(pci_set_power_state);
15771595
1596+int pci_set_power_state_locked(struct pci_dev *dev, pci_power_t state)
1597+{
1598+ lockdep_assert_held(&pci_bus_sem);
1599+
1600+ return __pci_set_power_state(dev, state, true);
1601+}
1602+EXPORT_SYMBOL(pci_set_power_state_locked);
1603+
15781604 #define PCI_EXP_SAVE_REGS 7
15791605
15801606 static struct pci_cap_saved_state *_pci_find_saved_cap(struct pci_dev *pci_dev,
drivers/pci/pci.h+2−2
@@ -571,12 +571,12 @@ int pcie_retrain_link(struct pci_dev *pdev, bool use_lt); · 570 unmodified lines
571571 #ifdef CONFIG_PCIEASPM
572572 void pcie_aspm_init_link_state(struct pci_dev *pdev);
573573 void pcie_aspm_exit_link_state(struct pci_dev *pdev);
574−void pcie_aspm_pm_state_change(struct pci_dev *pdev);
574+void pcie_aspm_pm_state_change(struct pci_dev *pdev, bool locked);
575575 void pcie_aspm_powersave_config_link(struct pci_dev *pdev);
576576 #else
577577 static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) { }
578578 static inline void pcie_aspm_exit_link_state(struct pci_dev *pdev) { }
579−static inline void pcie_aspm_pm_state_change(struct pci_dev *pdev) { }
579+static inline void pcie_aspm_pm_state_change(struct pci_dev *pdev, bool locked) { }
580580 static inline void pcie_aspm_powersave_config_link(struct pci_dev *pdev) { }
581581 #endif
582582
drivers/pci/pcie/aspm.c+9−4
@@ -1003,8 +1003,11 @@ void pcie_aspm_exit_link_state(struct pci_dev *pdev) · 1002 unmodified lines
10031003 up_read(&pci_bus_sem);
10041004 }
10051005
1006−/* @pdev: the root port or switch downstream port */
1007−void pcie_aspm_pm_state_change(struct pci_dev *pdev)
1006+/*
1007+ * @pdev: the root port or switch downstream port
1008+ * @locked: whether pci_bus_sem is held
1009+ */
1010+void pcie_aspm_pm_state_change(struct pci_dev *pdev, bool locked)
10081011 {
10091012 struct pcie_link_state *link = pdev->link_state;
10101013
@@ -1014,12 +1017,14 @@ void pcie_aspm_pm_state_change(struct pci_dev *pdev) · 3 unmodified lines
10141017 * Devices changed PM state, we should recheck if latency
10151018 * meets all functions' requirement
10161019 */
1017− down_read(&pci_bus_sem);
1020+ if (!locked)
1021+ down_read(&pci_bus_sem);
10181022 mutex_lock(&aspm_lock);
10191023 pcie_update_aspm_capable(link->root);
10201024 pcie_config_aspm_path(link);
10211025 mutex_unlock(&aspm_lock);
1022− up_read(&pci_bus_sem);
1026+ if (!locked)
1027+ up_read(&pci_bus_sem);
10231028 }
10241029
10251030 void pcie_aspm_powersave_config_link(struct pci_dev *pdev)
drivers/phy/microchip/lan966x_serdes.c+2−0
@@ -96,6 +96,8 @@ static const struct serdes_mux lan966x_serdes_muxes[] = { · 95 unmodified lines
9696 SERDES_MUX_SGMII(SERDES6G(1), 3, HSIO_HW_CFG_SD6G_1_CFG,
9797 HSIO_HW_CFG_SD6G_1_CFG_SET(1)),
9898
99+ SERDES_MUX_SGMII(SERDES6G(2), 4, 0, 0),
100+
99101 SERDES_MUX_RGMII(RGMII(0), 2, HSIO_HW_CFG_RGMII_0_CFG |
100102 HSIO_HW_CFG_RGMII_ENA |
101103 HSIO_HW_CFG_GMII_ENA,
drivers/phy/qualcomm/phy-qcom-qmp-usb.c+28−2
@@ -1556,6 +1556,14 @@ static const char * const qmp_phy_vreg_l[] = { · 1555 unmodified lines
15561556 "vdda-phy", "vdda-pll",
15571557 };
15581558
1559+static const struct qmp_usb_offsets qmp_usb_offsets_ipq8074 = {
1560+ .serdes = 0,
1561+ .pcs = 0x800,
1562+ .pcs_misc = 0x600,
1563+ .tx = 0x200,
1564+ .rx = 0x400,
1565+};
1566+
15591567 static const struct qmp_usb_offsets qmp_usb_offsets_ipq9574 = {
15601568 .serdes = 0,
15611569 .pcs = 0x800,
@@ -1613,10 +1621,28 @@ static const struct qmp_usb_offsets qmp_usb_offsets_v7 = { · 51 unmodified lines
16131621 .rx = 0x1000,
16141622 };
16151623
1624+static const struct qmp_phy_cfg ipq6018_usb3phy_cfg = {
1625+ .lanes = 1,
1626+
1627+ .offsets = &qmp_usb_offsets_ipq8074,
1628+
1629+ .serdes_tbl = ipq9574_usb3_serdes_tbl,
1630+ .serdes_tbl_num = ARRAY_SIZE(ipq9574_usb3_serdes_tbl),
1631+ .tx_tbl = msm8996_usb3_tx_tbl,
1632+ .tx_tbl_num = ARRAY_SIZE(msm8996_usb3_tx_tbl),
1633+ .rx_tbl = ipq8074_usb3_rx_tbl,
1634+ .rx_tbl_num = ARRAY_SIZE(ipq8074_usb3_rx_tbl),
1635+ .pcs_tbl = ipq8074_usb3_pcs_tbl,
1636+ .pcs_tbl_num = ARRAY_SIZE(ipq8074_usb3_pcs_tbl),
1637+ .vreg_list = qmp_phy_vreg_l,
1638+ .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l),
1639+ .regs = qmp_v3_usb3phy_regs_layout,
1640+};
1641+
16161642 static const struct qmp_phy_cfg ipq8074_usb3phy_cfg = {
16171643 .lanes = 1,
16181644
1619− .offsets = &qmp_usb_offsets_v3,
1645+ .offsets = &qmp_usb_offsets_ipq8074,
16201646
16211647 .serdes_tbl = ipq8074_usb3_serdes_tbl,
16221648 .serdes_tbl_num = ARRAY_SIZE(ipq8074_usb3_serdes_tbl),
@@ -2563,7 +2589,7 @@ err_node_put: · 940 unmodified lines
25632589 static const struct of_device_id qmp_usb_of_match_table[] = {
25642590 {
25652591 .compatible = "qcom,ipq6018-qmp-usb3-phy",
2566− .data = &ipq8074_usb3phy_cfg,
2592+ .data = &ipq6018_usb3phy_cfg,
25672593 }, {
25682594 .compatible = "qcom,ipq8074-qmp-usb3-phy",
25692595 .data = &ipq8074_usb3phy_cfg,
drivers/phy/renesas/phy-rcar-gen3-usb2.c+0−4
@@ -673,8 +673,6 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev) · 672 unmodified lines
673673 channel->irq = platform_get_irq_optional(pdev, 0);
674674 channel->dr_mode = rcar_gen3_get_dr_mode(dev->of_node);
675675 if (channel->dr_mode != USB_DR_MODE_UNKNOWN) {
676− int ret;
677−
678676 channel->is_otg_channel = true;
679677 channel->uses_otg_pins = !of_property_read_bool(dev->of_node,
680678 "renesas,no-otg-pins");
@@ -738,8 +736,6 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev) · 57 unmodified lines
738736 ret = PTR_ERR(provider);
739737 goto error;
740738 } else if (channel->is_otg_channel) {
741− int ret;
742−
743739 ret = device_create_file(dev, &dev_attr_role);
744740 if (ret < 0)
745741 goto error;
drivers/phy/ti/phy-omap-usb2.c+2−2
@@ -117,7 +117,7 @@ static int omap_usb_set_vbus(struct usb_otg *otg, bool enabled) · 116 unmodified lines
117117 {
118118 struct omap_usb *phy = phy_to_omapusb(otg->usb_phy);
119119
120− if (!phy->comparator)
120+ if (!phy->comparator || !phy->comparator->set_vbus)
121121 return -ENODEV;
122122
123123 return phy->comparator->set_vbus(phy->comparator, enabled);
@@ -127,7 +127,7 @@ static int omap_usb_start_srp(struct usb_otg *otg) · 3 unmodified lines
127127 {
128128 struct omap_usb *phy = phy_to_omapusb(otg->usb_phy);
129129
130− if (!phy->comparator)
130+ if (!phy->comparator || !phy->comparator->start_srp)
131131 return -ENODEV;
132132
133133 return phy->comparator->start_srp(phy->comparator);
drivers/pinctrl/pinctrl-amd.c+1−1
@@ -1159,7 +1159,7 @@ static int amd_gpio_probe(struct platform_device *pdev) · 1158 unmodified lines
11591159 }
11601160
11611161 ret = devm_request_irq(&pdev->dev, gpio_dev->irq, amd_gpio_irq_handler,
1162− IRQF_SHARED, KBUILD_MODNAME, gpio_dev);
1162+ IRQF_SHARED | IRQF_ONESHOT, KBUILD_MODNAME, gpio_dev);
11631163 if (ret)
11641164 goto out2;
11651165
drivers/power/supply/qcom_battmgr.c+49−60
@@ -282,7 +282,6 @@ struct qcom_battmgr_wireless { · 281 unmodified lines
282282
283283 struct qcom_battmgr {
284284 struct device *dev;
285− struct auxiliary_device *adev;
286285 struct pmic_glink_client *client;
287286
288287 enum qcom_battmgr_variant variant;
@@ -1294,69 +1293,11 @@ static void qcom_battmgr_enable_worker(struct work_struct *work) · 1005 unmodified lines
12941293 dev_err(battmgr->dev, "failed to request power notifications\n");
12951294 }
12961295
1297−static char *qcom_battmgr_battery[] = { "battery" };
1298−
1299−static void qcom_battmgr_register_psy(struct qcom_battmgr *battmgr)
1300−{
1301− struct power_supply_config psy_cfg_supply = {};
1302− struct auxiliary_device *adev = battmgr->adev;
1303− struct power_supply_config psy_cfg = {};
1304− struct device *dev = &adev->dev;
1305−
1306− psy_cfg.drv_data = battmgr;
1307− psy_cfg.of_node = adev->dev.of_node;
1308−
1309− psy_cfg_supply.drv_data = battmgr;
1310− psy_cfg_supply.of_node = adev->dev.of_node;
1311− psy_cfg_supply.supplied_to = qcom_battmgr_battery;
1312− psy_cfg_supply.num_supplicants = 1;
1313−
1314− if (battmgr->variant == QCOM_BATTMGR_SC8280XP) {
1315− battmgr->bat_psy = devm_power_supply_register(dev, &sc8280xp_bat_psy_desc, &psy_cfg);
1316− if (IS_ERR(battmgr->bat_psy))
1317− dev_err(dev, "failed to register battery power supply (%ld)\n",
1318− PTR_ERR(battmgr->bat_psy));
1319−
1320− battmgr->ac_psy = devm_power_supply_register(dev, &sc8280xp_ac_psy_desc, &psy_cfg_supply);
1321− if (IS_ERR(battmgr->ac_psy))
1322− dev_err(dev, "failed to register AC power supply (%ld)\n",
1323− PTR_ERR(battmgr->ac_psy));
1324−
1325− battmgr->usb_psy = devm_power_supply_register(dev, &sc8280xp_usb_psy_desc, &psy_cfg_supply);
1326− if (IS_ERR(battmgr->usb_psy))
1327− dev_err(dev, "failed to register USB power supply (%ld)\n",
1328− PTR_ERR(battmgr->usb_psy));
1329−
1330− battmgr->wls_psy = devm_power_supply_register(dev, &sc8280xp_wls_psy_desc, &psy_cfg_supply);
1331− if (IS_ERR(battmgr->wls_psy))
1332− dev_err(dev, "failed to register wireless charing power supply (%ld)\n",
1333− PTR_ERR(battmgr->wls_psy));
1334− } else {
1335− battmgr->bat_psy = devm_power_supply_register(dev, &sm8350_bat_psy_desc, &psy_cfg);
1336− if (IS_ERR(battmgr->bat_psy))
1337− dev_err(dev, "failed to register battery power supply (%ld)\n",
1338− PTR_ERR(battmgr->bat_psy));
1339−
1340− battmgr->usb_psy = devm_power_supply_register(dev, &sm8350_usb_psy_desc, &psy_cfg_supply);
1341− if (IS_ERR(battmgr->usb_psy))
1342− dev_err(dev, "failed to register USB power supply (%ld)\n",
1343− PTR_ERR(battmgr->usb_psy));
1344−
1345− battmgr->wls_psy = devm_power_supply_register(dev, &sm8350_wls_psy_desc, &psy_cfg_supply);
1346− if (IS_ERR(battmgr->wls_psy))
1347− dev_err(dev, "failed to register wireless charing power supply (%ld)\n",
1348− PTR_ERR(battmgr->wls_psy));
1349− }
1350−}
1351−
13521296 static void qcom_battmgr_pdr_notify(void *priv, int state)
13531297 {
13541298 struct qcom_battmgr *battmgr = priv;
13551299
13561300 if (state == SERVREG_SERVICE_STATE_UP) {
1357− if (!battmgr->bat_psy)
1358− qcom_battmgr_register_psy(battmgr);
1359−
13601301 battmgr->service_up = true;
13611302 schedule_work(&battmgr->enable_work);
13621303 } else {
@@ -1371,9 +1312,13 @@ static const struct of_device_id qcom_battmgr_of_variants[] = { · 8 unmodified lines
13711312 {}
13721313 };
13731314
1315+static char *qcom_battmgr_battery[] = { "battery" };
1316+
13741317 static int qcom_battmgr_probe(struct auxiliary_device *adev,
13751318 const struct auxiliary_device_id *id)
13761319 {
1320+ struct power_supply_config psy_cfg_supply = {};
1321+ struct power_supply_config psy_cfg = {};
13771322 const struct of_device_id *match;
13781323 struct qcom_battmgr *battmgr;
13791324 struct device *dev = &adev->dev;
@@ -1383,7 +1328,14 @@ static int qcom_battmgr_probe(struct auxiliary_device *adev, · 3 unmodified lines
13831328 return -ENOMEM;
13841329
13851330 battmgr->dev = dev;
1386− battmgr->adev = adev;
1331+
1332+ psy_cfg.drv_data = battmgr;
1333+ psy_cfg.of_node = adev->dev.of_node;
1334+
1335+ psy_cfg_supply.drv_data = battmgr;
1336+ psy_cfg_supply.of_node = adev->dev.of_node;
1337+ psy_cfg_supply.supplied_to = qcom_battmgr_battery;
1338+ psy_cfg_supply.num_supplicants = 1;
13871339
13881340 INIT_WORK(&battmgr->enable_work, qcom_battmgr_enable_worker);
13891341 mutex_init(&battmgr->lock);
@@ -1395,6 +1347,43 @@ static int qcom_battmgr_probe(struct auxiliary_device *adev, · 5 unmodified lines
13951347 else
13961348 battmgr->variant = QCOM_BATTMGR_SM8350;
13971349
1350+ if (battmgr->variant == QCOM_BATTMGR_SC8280XP) {
1351+ battmgr->bat_psy = devm_power_supply_register(dev, &sc8280xp_bat_psy_desc, &psy_cfg);
1352+ if (IS_ERR(battmgr->bat_psy))
1353+ return dev_err_probe(dev, PTR_ERR(battmgr->bat_psy),
1354+ "failed to register battery power supply\n");
1355+
1356+ battmgr->ac_psy = devm_power_supply_register(dev, &sc8280xp_ac_psy_desc, &psy_cfg_supply);
1357+ if (IS_ERR(battmgr->ac_psy))
1358+ return dev_err_probe(dev, PTR_ERR(battmgr->ac_psy),
1359+ "failed to register AC power supply\n");
1360+
1361+ battmgr->usb_psy = devm_power_supply_register(dev, &sc8280xp_usb_psy_desc, &psy_cfg_supply);
1362+ if (IS_ERR(battmgr->usb_psy))
1363+ return dev_err_probe(dev, PTR_ERR(battmgr->usb_psy),
1364+ "failed to register USB power supply\n");
1365+
1366+ battmgr->wls_psy = devm_power_supply_register(dev, &sc8280xp_wls_psy_desc, &psy_cfg_supply);
1367+ if (IS_ERR(battmgr->wls_psy))
1368+ return dev_err_probe(dev, PTR_ERR(battmgr->wls_psy),
1369+ "failed to register wireless charing power supply\n");
1370+ } else {
1371+ battmgr->bat_psy = devm_power_supply_register(dev, &sm8350_bat_psy_desc, &psy_cfg);
1372+ if (IS_ERR(battmgr->bat_psy))
1373+ return dev_err_probe(dev, PTR_ERR(battmgr->bat_psy),
1374+ "failed to register battery power supply\n");
1375+
1376+ battmgr->usb_psy = devm_power_supply_register(dev, &sm8350_usb_psy_desc, &psy_cfg_supply);
1377+ if (IS_ERR(battmgr->usb_psy))
1378+ return dev_err_probe(dev, PTR_ERR(battmgr->usb_psy),
1379+ "failed to register USB power supply\n");
1380+
1381+ battmgr->wls_psy = devm_power_supply_register(dev, &sm8350_wls_psy_desc, &psy_cfg_supply);
1382+ if (IS_ERR(battmgr->wls_psy))
1383+ return dev_err_probe(dev, PTR_ERR(battmgr->wls_psy),
1384+ "failed to register wireless charing power supply\n");
1385+ }
1386+
13981387 battmgr->client = devm_pmic_glink_register_client(dev,
13991388 PMIC_GLINK_OWNER_BATTMGR,
14001389 qcom_battmgr_callback,
drivers/s390/net/qeth_l3_main.c+6−3
@@ -255,9 +255,10 @@ static void qeth_l3_clear_ip_htable(struct qeth_card *card, int recover) · 254 unmodified lines
255255 if (!recover) {
256256 hash_del(&addr->hnode);
257257 kfree(addr);
258− continue;
258+ } else {
259+ /* prepare for recovery */
260+ addr->disp_flag = QETH_DISP_ADDR_ADD;
259261 }
260− addr->disp_flag = QETH_DISP_ADDR_ADD;
261262 }
262263
263264 mutex_unlock(&card->ip_lock);
@@ -278,9 +279,11 @@ static void qeth_l3_recover_ip(struct qeth_card *card) · 14 unmodified lines
278279 if (addr->disp_flag == QETH_DISP_ADDR_ADD) {
279280 rc = qeth_l3_register_addr_entry(card, addr);
280281
281− if (!rc) {
282+ if (!rc || rc == -EADDRINUSE || rc == -ENETDOWN) {
283+ /* keep it in the records */
282284 addr->disp_flag = QETH_DISP_ADDR_DO_NOTHING;
283285 } else {
286+ /* bad address */
284287 hash_del(&addr->hnode);
285288 kfree(addr);
286289 }
drivers/tty/serial/8250/8250_pci1xxxx.c+2−2
@@ -302,7 +302,7 @@ static void pci1xxxx_process_read_data(struct uart_port *port, · 301 unmodified lines
302302 * to read, the data is received one byte at a time.
303303 */
304304 while (valid_burst_count--) {
305− if (*buff_index > (RX_BUF_SIZE - UART_BURST_SIZE))
305+ if (*buff_index >= (RX_BUF_SIZE - UART_BURST_SIZE))
306306 break;
307307 burst_buf = (u32 *)&rx_buff[*buff_index];
308308 *burst_buf = readl(port->membase + UART_RX_BURST_FIFO);
@@ -311,7 +311,7 @@ static void pci1xxxx_process_read_data(struct uart_port *port, · 2 unmodified lines
311311 }
312312
313313 while (*valid_byte_count) {
314− if (*buff_index > RX_BUF_SIZE)
314+ if (*buff_index >= RX_BUF_SIZE)
315315 break;
316316 rx_buff[*buff_index] = readb(port->membase +
317317 UART_RX_BYTE_FIFO);
drivers/tty/serial/max310x.c+43−10
@@ -237,6 +237,14 @@ · 236 unmodified lines
237237 #define MAX310x_REV_MASK (0xf8)
238238 #define MAX310X_WRITE_BIT 0x80
239239
240+/* Port startup definitions */
241+#define MAX310X_PORT_STARTUP_WAIT_RETRIES 20 /* Number of retries */
242+#define MAX310X_PORT_STARTUP_WAIT_DELAY_MS 10 /* Delay between retries */
243+
244+/* Crystal-related definitions */
245+#define MAX310X_XTAL_WAIT_RETRIES 20 /* Number of retries */
246+#define MAX310X_XTAL_WAIT_DELAY_MS 10 /* Delay between retries */
247+
240248 /* MAX3107 specific */
241249 #define MAX3107_REV_ID (0xa0)
242250
@@ -583,7 +591,7 @@ static int max310x_update_best_err(unsigned long f, long *besterr) · 340 unmodified lines
583591 return 1;
584592 }
585593
586−static u32 max310x_set_ref_clk(struct device *dev, struct max310x_port *s,
594+static s32 max310x_set_ref_clk(struct device *dev, struct max310x_port *s,
587595 unsigned long freq, bool xtal)
588596 {
589597 unsigned int div, clksrc, pllcfg = 0;
@@ -641,12 +649,20 @@ static u32 max310x_set_ref_clk(struct device *dev, struct max310x_port *s, · 51 unmodified lines
641649
642650 /* Wait for crystal */
643651 if (xtal) {
644− unsigned int val;
645− msleep(10);
646− regmap_read(s->regmap, MAX310X_STS_IRQSTS_REG, &val);
647− if (!(val & MAX310X_STS_CLKREADY_BIT)) {
648− dev_warn(dev, "clock is not stable yet\n");
649− }
652+ bool stable = false;
653+ unsigned int try = 0, val = 0;
654+
655+ do {
656+ msleep(MAX310X_XTAL_WAIT_DELAY_MS);
657+ regmap_read(s->regmap, MAX310X_STS_IRQSTS_REG, &val);
658+
659+ if (val & MAX310X_STS_CLKREADY_BIT)
660+ stable = true;
661+ } while (!stable && (++try < MAX310X_XTAL_WAIT_RETRIES));
662+
663+ if (!stable)
664+ return dev_err_probe(dev, -EAGAIN,
665+ "clock is not stable\n");
650666 }
651667
652668 return bestfreq;
@@ -1271,7 +1287,7 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devty · 618 unmodified lines
12711287 {
12721288 int i, ret, fmin, fmax, freq;
12731289 struct max310x_port *s;
1274− u32 uartclk = 0;
1290+ s32 uartclk = 0;
12751291 bool xtal;
12761292
12771293 for (i = 0; i < devtype->nr; i++)
@@ -1334,6 +1350,9 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devty · 56 unmodified lines
13341350 goto out_clk;
13351351
13361352 for (i = 0; i < devtype->nr; i++) {
1353+ bool started = false;
1354+ unsigned int try = 0, val = 0;
1355+
13371356 /* Reset port */
13381357 regmap_write(regmaps[i], MAX310X_MODE2_REG,
13391358 MAX310X_MODE2_RST_BIT);
@@ -1342,13 +1361,27 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devty · 2 unmodified lines
13421361
13431362 /* Wait for port startup */
13441363 do {
1345− regmap_read(regmaps[i], MAX310X_BRGDIVLSB_REG, &ret);
1346− } while (ret != 0x01);
1364+ msleep(MAX310X_PORT_STARTUP_WAIT_DELAY_MS);
1365+ regmap_read(regmaps[i], MAX310X_BRGDIVLSB_REG, &val);
1366+
1367+ if (val == 0x01)
1368+ started = true;
1369+ } while (!started && (++try < MAX310X_PORT_STARTUP_WAIT_RETRIES));
1370+
1371+ if (!started) {
1372+ ret = dev_err_probe(dev, -EAGAIN, "port reset failed\n");
1373+ goto out_uart;
1374+ }
13471375
13481376 regmap_write(regmaps[i], MAX310X_MODE1_REG, devtype->mode1);
13491377 }
13501378
13511379 uartclk = max310x_set_ref_clk(dev, s, freq, xtal);
1380+ if (uartclk < 0) {
1381+ ret = uartclk;
1382+ goto out_uart;
1383+ }
1384+
13521385 dev_dbg(dev, "Reference clock set to %i Hz\n", uartclk);
13531386
13541387 for (i = 0; i < devtype->nr; i++) {
drivers/tty/serial/serial_core.c+1−1
@@ -1084,8 +1084,8 @@ static int uart_tiocmget(struct tty_struct *tty) · 1083 unmodified lines
10841084 goto out;
10851085
10861086 if (!tty_io_error(tty)) {
1087− result = uport->mctrl;
10881087 uart_port_lock_irq(uport);
1088+ result = uport->mctrl;
10891089 result |= uport->ops->get_mctrl(uport);
10901090 uart_port_unlock_irq(uport);
10911091 }
drivers/usb/chipidea/ci.h+2−0
@@ -176,6 +176,7 @@ struct hw_bank { · 175 unmodified lines
176176 * @enabled_otg_timer_bits: bits of enabled otg timers
177177 * @next_otg_timer: next nearest enabled timer to be expired
178178 * @work: work for role changing
179+ * @power_lost_work: work for power lost handling
179180 * @wq: workqueue thread
180181 * @qh_pool: allocation pool for queue heads
181182 * @td_pool: allocation pool for transfer descriptors
@@ -226,6 +227,7 @@ struct ci_hdrc { · 44 unmodified lines
226227 enum otg_fsm_timer next_otg_timer;
227228 struct usb_role_switch *role_switch;
228229 struct work_struct work;
230+ struct work_struct power_lost_work;
229231 struct workqueue_struct *wq;
230232
231233 struct dma_pool *qh_pool;
drivers/usb/chipidea/core.c+24−20
@@ -856,6 +856,27 @@ static int ci_extcon_register(struct ci_hdrc *ci) · 855 unmodified lines
856856 return 0;
857857 }
858858
859+static void ci_power_lost_work(struct work_struct *work)
860+{
861+ struct ci_hdrc *ci = container_of(work, struct ci_hdrc, power_lost_work);
862+ enum ci_role role;
863+
864+ disable_irq_nosync(ci->irq);
865+ pm_runtime_get_sync(ci->dev);
866+ if (!ci_otg_is_fsm_mode(ci)) {
867+ role = ci_get_role(ci);
868+
869+ if (ci->role != role) {
870+ ci_handle_id_switch(ci);
871+ } else if (role == CI_ROLE_GADGET) {
872+ if (ci->is_otg && hw_read_otgsc(ci, OTGSC_BSV))
873+ usb_gadget_vbus_connect(&ci->gadget);
874+ }
875+ }
876+ pm_runtime_put_sync(ci->dev);
877+ enable_irq(ci->irq);
878+}
879+
859880 static DEFINE_IDA(ci_ida);
860881
861882 struct platform_device *ci_hdrc_add_device(struct device *dev,
@@ -1045,6 +1066,8 @@ static int ci_hdrc_probe(struct platform_device *pdev) · 183 unmodified lines
10451066
10461067 spin_lock_init(&ci->lock);
10471068 mutex_init(&ci->mutex);
1069+ INIT_WORK(&ci->power_lost_work, ci_power_lost_work);
1070+
10481071 ci->dev = dev;
10491072 ci->platdata = dev_get_platdata(dev);
10501073 ci->imx28_write_fix = !!(ci->platdata->flags &
@@ -1396,25 +1419,6 @@ static int ci_suspend(struct device *dev) · 345 unmodified lines
13961419 return 0;
13971420 }
13981421
1399−static void ci_handle_power_lost(struct ci_hdrc *ci)
1400−{
1401− enum ci_role role;
1402−
1403− disable_irq_nosync(ci->irq);
1404− if (!ci_otg_is_fsm_mode(ci)) {
1405− role = ci_get_role(ci);
1406−
1407− if (ci->role != role) {
1408− ci_handle_id_switch(ci);
1409− } else if (role == CI_ROLE_GADGET) {
1410− if (ci->is_otg && hw_read_otgsc(ci, OTGSC_BSV))
1411− usb_gadget_vbus_connect(&ci->gadget);
1412− }
1413− }
1414−
1415− enable_irq(ci->irq);
1416−}
1417−
14181422 static int ci_resume(struct device *dev)
14191423 {
14201424 struct ci_hdrc *ci = dev_get_drvdata(dev);
@@ -1446,7 +1450,7 @@ static int ci_resume(struct device *dev) · 25 unmodified lines
14461450 ci_role(ci)->resume(ci, power_lost);
14471451
14481452 if (power_lost)
1449− ci_handle_power_lost(ci);
1453+ queue_work(system_freezable_wq, &ci->power_lost_work);
14501454
14511455 if (ci->supports_runtime_pm) {
14521456 pm_runtime_disable(dev);
drivers/usb/common/ulpi.c+1−1
@@ -301,7 +301,7 @@ static int ulpi_register(struct device *dev, struct ulpi *ulpi) · 300 unmodified lines
301301 return ret;
302302 }
303303
304− root = debugfs_create_dir(dev_name(dev), ulpi_root);
304+ root = debugfs_create_dir(dev_name(&ulpi->dev), ulpi_root);
305305 debugfs_create_file("regs", 0444, root, ulpi, &ulpi_regs_fops);
306306
307307 dev_dbg(&ulpi->dev, "registered ULPI PHY: vendor %04x, product %04x\n",
drivers/usb/core/hub.c+32−14
@@ -2053,9 +2053,19 @@ static void update_port_device_state(struct usb_device *udev) · 2052 unmodified lines
20532053
20542054 if (udev->parent) {
20552055 hub = usb_hub_to_struct_hub(udev->parent);
2056− port_dev = hub->ports[udev->portnum - 1];
2057− WRITE_ONCE(port_dev->state, udev->state);
2058− sysfs_notify_dirent(port_dev->state_kn);
2056+
2057+ /*
2058+ * The Link Layer Validation System Driver (lvstest)
2059+ * has a test step to unbind the hub before running the
2060+ * rest of the procedure. This triggers hub_disconnect
2061+ * which will set the hub's maxchild to 0, further
2062+ * resulting in usb_hub_to_struct_hub returning NULL.
2063+ */
2064+ if (hub) {
2065+ port_dev = hub->ports[udev->portnum - 1];
2066+ WRITE_ONCE(port_dev->state, udev->state);
2067+ sysfs_notify_dirent(port_dev->state_kn);
2068+ }
20592069 }
20602070 }
20612071
@@ -2388,17 +2398,25 @@ static int usb_enumerate_device_otg(struct usb_device *udev) · 326 unmodified lines
23882398 }
23892399 } else if (desc->bLength == sizeof
23902400 (struct usb_otg_descriptor)) {
2391− /* Set a_alt_hnp_support for legacy otg device */
2392− err = usb_control_msg(udev,
2393− usb_sndctrlpipe(udev, 0),
2394− USB_REQ_SET_FEATURE, 0,
2395− USB_DEVICE_A_ALT_HNP_SUPPORT,
2396− 0, NULL, 0,
2397− USB_CTRL_SET_TIMEOUT);
2398− if (err < 0)
2399− dev_err(&udev->dev,
2400− "set a_alt_hnp_support failed: %d\n",
2401− err);
2401+ /*
2402+ * We are operating on a legacy OTP device
2403+ * These should be told that they are operating
2404+ * on the wrong port if we have another port that does
2405+ * support HNP
2406+ */
2407+ if (bus->otg_port != 0) {
2408+ /* Set a_alt_hnp_support for legacy otg device */
2409+ err = usb_control_msg(udev,
2410+ usb_sndctrlpipe(udev, 0),
2411+ USB_REQ_SET_FEATURE, 0,
2412+ USB_DEVICE_A_ALT_HNP_SUPPORT,
2413+ 0, NULL, 0,
2414+ USB_CTRL_SET_TIMEOUT);
2415+ if (err < 0)
2416+ dev_err(&udev->dev,
2417+ "set a_alt_hnp_support failed: %d\n",
2418+ err);
2419+ }
24022420 }
24032421 }
24042422 #endif
drivers/usb/dwc3/dwc3-pci.c+4−0
@@ -51,6 +51,8 @@ · 50 unmodified lines
5151 #define PCI_DEVICE_ID_INTEL_MTLP 0x7ec1
5252 #define PCI_DEVICE_ID_INTEL_MTLS 0x7f6f
5353 #define PCI_DEVICE_ID_INTEL_MTL 0x7e7e
54+#define PCI_DEVICE_ID_INTEL_ARLH 0x7ec1
55+#define PCI_DEVICE_ID_INTEL_ARLH_PCH 0x777e
5456 #define PCI_DEVICE_ID_INTEL_TGL 0x9a15
5557 #define PCI_DEVICE_ID_AMD_MR 0x163a
5658
@@ -421,6 +423,8 @@ static const struct pci_device_id dwc3_pci_id_table[] = { · 364 unmodified lines
421423 { PCI_DEVICE_DATA(INTEL, MTLP, &dwc3_pci_intel_swnode) },
422424 { PCI_DEVICE_DATA(INTEL, MTL, &dwc3_pci_intel_swnode) },
423425 { PCI_DEVICE_DATA(INTEL, MTLS, &dwc3_pci_intel_swnode) },
426+ { PCI_DEVICE_DATA(INTEL, ARLH, &dwc3_pci_intel_swnode) },
427+ { PCI_DEVICE_DATA(INTEL, ARLH_PCH, &dwc3_pci_intel_swnode) },
424428 { PCI_DEVICE_DATA(INTEL, TGL, &dwc3_pci_intel_swnode) },
425429
426430 { PCI_DEVICE_DATA(AMD, NL_USB, &dwc3_pci_amd_swnode) },
drivers/usb/dwc3/gadget.c+2−4
@@ -4709,15 +4709,13 @@ int dwc3_gadget_suspend(struct dwc3 *dwc) · 4708 unmodified lines
47094709 unsigned long flags;
47104710 int ret;
47114711
4712− if (!dwc->gadget_driver)
4713− return 0;
4714−
47154712 ret = dwc3_gadget_soft_disconnect(dwc);
47164713 if (ret)
47174714 goto err;
47184715
47194716 spin_lock_irqsave(&dwc->lock, flags);
4720− dwc3_disconnect_gadget(dwc);
4717+ if (dwc->gadget_driver)
4718+ dwc3_disconnect_gadget(dwc);
47214719 spin_unlock_irqrestore(&dwc->lock, flags);
47224720
47234721 return 0;
drivers/usb/dwc3/host.c+3−1
@@ -61,7 +61,7 @@ out: · 60 unmodified lines
6161
6262 int dwc3_host_init(struct dwc3 *dwc)
6363 {
64− struct property_entry props[4];
64+ struct property_entry props[5];
6565 struct platform_device *xhci;
6666 int ret, irq;
6767 int prop_idx = 0;
@@ -89,6 +89,8 @@ int dwc3_host_init(struct dwc3 *dwc) · 21 unmodified lines
8989
9090 memset(props, 0, sizeof(struct property_entry) * ARRAY_SIZE(props));
9191
92+ props[prop_idx++] = PROPERTY_ENTRY_BOOL("xhci-sg-trb-cache-size-quirk");
93+
9294 if (dwc->usb3_lpm_capable)
9395 props[prop_idx++] = PROPERTY_ENTRY_BOOL("usb3-lpm-capable");
9496
drivers/usb/gadget/function/f_mass_storage.c+18−2
@@ -545,21 +545,37 @@ static int start_transfer(struct fsg_dev *fsg, struct usb_ep *ep, · 544 unmodified lines
545545
546546 static bool start_in_transfer(struct fsg_common *common, struct fsg_buffhd *bh)
547547 {
548+ int rc;
549+
548550 if (!fsg_is_set(common))
549551 return false;
550552 bh->state = BUF_STATE_SENDING;
551− if (start_transfer(common->fsg, common->fsg->bulk_in, bh->inreq))
553+ rc = start_transfer(common->fsg, common->fsg->bulk_in, bh->inreq);
554+ if (rc) {
552555 bh->state = BUF_STATE_EMPTY;
556+ if (rc == -ESHUTDOWN) {
557+ common->running = 0;
558+ return false;
559+ }
560+ }
553561 return true;
554562 }
555563
556564 static bool start_out_transfer(struct fsg_common *common, struct fsg_buffhd *bh)
557565 {
566+ int rc;
567+
558568 if (!fsg_is_set(common))
559569 return false;
560570 bh->state = BUF_STATE_RECEIVING;
561− if (start_transfer(common->fsg, common->fsg->bulk_out, bh->outreq))
571+ rc = start_transfer(common->fsg, common->fsg->bulk_out, bh->outreq);
572+ if (rc) {
562573 bh->state = BUF_STATE_FULL;
574+ if (rc == -ESHUTDOWN) {
575+ common->running = 0;
576+ return false;
577+ }
578+ }
563579 return true;
564580 }
565581
drivers/usb/gadget/function/f_ncm.c+4−4
@@ -105,8 +105,8 @@ static inline struct f_ncm *func_to_ncm(struct usb_function *f) · 104 unmodified lines
105105
106106 /*
107107 * Although max mtu as dictated by u_ether is 15412 bytes, setting
108− * max_segment_sizeto 15426 would not be efficient. If user chooses segment
109− * size to be (>= 8192), then we can't aggregate more than one buffer in each
108+ * max_segment_size to 15426 would not be efficient. If user chooses segment
109+ * size to be (>= 8192), then we can't aggregate more than one buffer in each
110110 * NTB (assuming each packet coming from network layer is >= 8192 bytes) as ep
111111 * maxpacket limit is 16384. So let max_segment_size be limited to 8000 to allow
112112 * at least 2 packets to be aggregated reducing wastage of NTB buffer space
@@ -1489,7 +1489,7 @@ static int ncm_bind(struct usb_configuration *c, struct usb_function *f) · 1376 unmodified lines
14891489 ncm_data_intf.bInterfaceNumber = status;
14901490 ncm_union_desc.bSlaveInterface0 = status;
14911491
1492− ecm_desc.wMaxSegmentSize = ncm_opts->max_segment_size;
1492+ ecm_desc.wMaxSegmentSize = cpu_to_le16(ncm_opts->max_segment_size);
14931493
14941494 status = -ENODEV;
14951495
@@ -1685,7 +1685,7 @@ static struct usb_function_instance *ncm_alloc_inst(void) · 189 unmodified lines
16851685 kfree(opts);
16861686 return ERR_CAST(net);
16871687 }
1688− opts->max_segment_size = cpu_to_le16(ETH_FRAME_LEN);
1688+ opts->max_segment_size = ETH_FRAME_LEN;
16891689 INIT_LIST_HEAD(&opts->ncm_os_desc.ext_prop);
16901690
16911691 descs[0] = &opts->ncm_os_desc;
drivers/usb/gadget/udc/pch_udc.c+0−1
@@ -274,7 +274,6 @@ struct pch_udc_cfg_data { · 273 unmodified lines
274274 * @td_data: for data request
275275 * @dev: reference to device struct
276276 * @offset_addr: offset address of ep register
277− * @desc: for this ep
278277 * @queue: queue for requests
279278 * @num: endpoint number
280279 * @in: endpoint is IN
drivers/usb/host/xhci-mem.c+7−7
@@ -1861,14 +1861,14 @@ void xhci_remove_secondary_interrupter(struct usb_hcd *hcd, struct xhci_interrup · 1860 unmodified lines
18611861 struct xhci_hcd *xhci = hcd_to_xhci(hcd);
18621862 unsigned int intr_num;
18631863
1864+ spin_lock_irq(&xhci->lock);
1865+
18641866 /* interrupter 0 is primary interrupter, don't touch it */
1865− if (!ir || !ir->intr_num || ir->intr_num >= xhci->max_interrupters)
1867+ if (!ir || !ir->intr_num || ir->intr_num >= xhci->max_interrupters) {
18661868 xhci_dbg(xhci, "Invalid secondary interrupter, can't remove\n");
1867−
1868− /* fixme, should we check xhci->interrupter[intr_num] == ir */
1869− /* fixme locking */
1870−
1871− spin_lock_irq(&xhci->lock);
1869+ spin_unlock_irq(&xhci->lock);
1870+ return;
1871+ }
18721872
18731873 intr_num = ir->intr_num;
18741874
@@ -2322,7 +2322,7 @@ xhci_add_interrupter(struct xhci_hcd *xhci, struct xhci_interrupter *ir, · 447 unmodified lines
23222322 u64 erst_base;
23232323 u32 erst_size;
23242324
2325− if (intr_num > xhci->max_interrupters) {
2325+ if (intr_num >= xhci->max_interrupters) {
23262326 xhci_warn(xhci, "Can't add interrupter %d, max interrupters %d\n",
23272327 intr_num, xhci->max_interrupters);
23282328 return -EINVAL;
drivers/usb/host/xhci-plat.c+3−0
@@ -253,6 +253,9 @@ int xhci_plat_probe(struct platform_device *pdev, struct device *sysdev, const s · 252 unmodified lines
253253 if (device_property_read_bool(tmpdev, "quirk-broken-port-ped"))
254254 xhci->quirks |= XHCI_BROKEN_PORT_PED;
255255
256+ if (device_property_read_bool(tmpdev, "xhci-sg-trb-cache-size-quirk"))
257+ xhci->quirks |= XHCI_SG_TRB_CACHE_SIZE_QUIRK;
258+
256259 device_property_read_u32(tmpdev, "imod-interval-ns",
257260 &xhci->imod_interval);
258261 }
drivers/usb/host/xhci-ring.c+65−15
@@ -2376,6 +2376,9 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, · 2375 unmodified lines
23762376 /* handle completion code */
23772377 switch (trb_comp_code) {
23782378 case COMP_SUCCESS:
2379+ /* Don't overwrite status if TD had an error, see xHCI 4.9.1 */
2380+ if (td->error_mid_td)
2381+ break;
23792382 if (remaining) {
23802383 frame->status = short_framestatus;
23812384 if (xhci->quirks & XHCI_TRUST_TX_LENGTH)
@@ -2391,9 +2394,13 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, · 9 unmodified lines
23912394 case COMP_BANDWIDTH_OVERRUN_ERROR:
23922395 frame->status = -ECOMM;
23932396 break;
2394− case COMP_ISOCH_BUFFER_OVERRUN:
23952397 case COMP_BABBLE_DETECTED_ERROR:
2398+ sum_trbs_for_length = true;
2399+ fallthrough;
2400+ case COMP_ISOCH_BUFFER_OVERRUN:
23962401 frame->status = -EOVERFLOW;
2402+ if (ep_trb != td->last_trb)
2403+ td->error_mid_td = true;
23972404 break;
23982405 case COMP_INCOMPATIBLE_DEVICE_ERROR:
23992406 case COMP_STALL_ERROR:
@@ -2401,8 +2408,9 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, · 1 unmodified line
24012408 break;
24022409 case COMP_USB_TRANSACTION_ERROR:
24032410 frame->status = -EPROTO;
2411+ sum_trbs_for_length = true;
24042412 if (ep_trb != td->last_trb)
2405− return 0;
2413+ td->error_mid_td = true;
24062414 break;
24072415 case COMP_STOPPED:
24082416 sum_trbs_for_length = true;
@@ -2422,6 +2430,9 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, · 13 unmodified lines
24222430 break;
24232431 }
24242432
2433+ if (td->urb_length_set)
2434+ goto finish_td;
2435+
24252436 if (sum_trbs_for_length)
24262437 frame->actual_length = sum_trb_lengths(xhci, ep->ring, ep_trb) +
24272438 ep_trb_len - remaining;
@@ -2430,6 +2441,14 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, · 2 unmodified lines
24302441
24312442 td->urb->actual_length += frame->actual_length;
24322443
2444+finish_td:
2445+ /* Don't give back TD yet if we encountered an error mid TD */
2446+ if (td->error_mid_td && ep_trb != td->last_trb) {
2447+ xhci_dbg(xhci, "Error mid isoc TD, wait for final completion event\n");
2448+ td->urb_length_set = true;
2449+ return 0;
2450+ }
2451+
24332452 return finish_td(xhci, ep, ep_ring, td, trb_comp_code);
24342453 }
24352454
@@ -2808,17 +2827,51 @@ static int handle_tx_event(struct xhci_hcd *xhci, · 372 unmodified lines
28082827 }
28092828
28102829 if (!ep_seg) {
2811− if (!ep->skip ||
2812− !usb_endpoint_xfer_isoc(&td->urb->ep->desc)) {
2813− /* Some host controllers give a spurious
2814− * successful event after a short transfer.
2815− * Ignore it.
2816− */
2817− if ((xhci->quirks & XHCI_SPURIOUS_SUCCESS) &&
2818− ep_ring->last_td_was_short) {
2819− ep_ring->last_td_was_short = false;
2820− goto cleanup;
2830+
2831+ if (ep->skip && usb_endpoint_xfer_isoc(&td->urb->ep->desc)) {
2832+ skip_isoc_td(xhci, td, ep, status);
2833+ goto cleanup;
2834+ }
2835+
2836+ /*
2837+ * Some hosts give a spurious success event after a short
2838+ * transfer. Ignore it.
2839+ */
2840+ if ((xhci->quirks & XHCI_SPURIOUS_SUCCESS) &&
2841+ ep_ring->last_td_was_short) {
2842+ ep_ring->last_td_was_short = false;
2843+ goto cleanup;
2844+ }
2845+
2846+ /*
2847+ * xhci 4.10.2 states isoc endpoints should continue
2848+ * processing the next TD if there was an error mid TD.
2849+ * So host like NEC don't generate an event for the last
2850+ * isoc TRB even if the IOC flag is set.
2851+ * xhci 4.9.1 states that if there are errors in mult-TRB
2852+ * TDs xHC should generate an error for that TRB, and if xHC
2853+ * proceeds to the next TD it should genete an event for
2854+ * any TRB with IOC flag on the way. Other host follow this.
2855+ * So this event might be for the next TD.
2856+ */
2857+ if (td->error_mid_td &&
2858+ !list_is_last(&td->td_list, &ep_ring->td_list)) {
2859+ struct xhci_td *td_next = list_next_entry(td, td_list);
2860+
2861+ ep_seg = trb_in_td(xhci, td_next->start_seg, td_next->first_trb,
2862+ td_next->last_trb, ep_trb_dma, false);
2863+ if (ep_seg) {
2864+ /* give back previous TD, start handling new */
2865+ xhci_dbg(xhci, "Missing TD completion event after mid TD error\n");
2866+ ep_ring->dequeue = td->last_trb;
2867+ ep_ring->deq_seg = td->last_trb_seg;
2868+ inc_deq(xhci, ep_ring);
2869+ xhci_td_cleanup(xhci, td, ep_ring, td->status);
2870+ td = td_next;
28212871 }
2872+ }
2873+
2874+ if (!ep_seg) {
28222875 /* HC is busted, give up! */
28232876 xhci_err(xhci,
28242877 "ERROR Transfer event TRB DMA ptr not "
@@ -2830,9 +2883,6 @@ static int handle_tx_event(struct xhci_hcd *xhci, · 5 unmodified lines
28302883 ep_trb_dma, true);
28312884 return -ESHUTDOWN;
28322885 }
2833−
2834− skip_isoc_td(xhci, td, ep, status);
2835− goto cleanup;
28362886 }
28372887 if (trb_comp_code == COMP_SHORT_PACKET)
28382888 ep_ring->last_td_was_short = true;
drivers/usb/host/xhci.h+1−0
@@ -1549,6 +1549,7 @@ struct xhci_td { · 1548 unmodified lines
15491549 struct xhci_segment *bounce_seg;
15501550 /* actual_length of the URB has already been set */
15511551 bool urb_length_set;
1552+ bool error_mid_td;
15521553 unsigned int num_trbs;
15531554 };
15541555
drivers/usb/serial/cp210x.c+1−0
@@ -146,6 +146,7 @@ static const struct usb_device_id id_table[] = { · 145 unmodified lines
146146 { USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */
147147 { USB_DEVICE(0x10C4, 0x8664) }, /* AC-Services CAN-IF */
148148 { USB_DEVICE(0x10C4, 0x8665) }, /* AC-Services OBD-IF */
149+ { USB_DEVICE(0x10C4, 0x87ED) }, /* IMST USB-Stick for Smart Meter */
149150 { USB_DEVICE(0x10C4, 0x8856) }, /* CEL EM357 ZigBee USB Stick - LR */
150151 { USB_DEVICE(0x10C4, 0x8857) }, /* CEL EM357 ZigBee USB Stick */
151152 { USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */
drivers/usb/serial/option.c+1−0
@@ -2269,6 +2269,7 @@ static const struct usb_device_id option_ids[] = { · 2268 unmodified lines
22692269 { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x0111, 0xff) }, /* Fibocom FM160 (MBIM mode) */
22702270 { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x01a0, 0xff) }, /* Fibocom NL668-AM/NL652-EU (laptop MBIM) */
22712271 { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x01a2, 0xff) }, /* Fibocom FM101-GL (laptop MBIM) */
2272+ { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x01a3, 0xff) }, /* Fibocom FM101-GL (laptop MBIM) */
22722273 { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x01a4, 0xff), /* Fibocom FM101-GL (laptop MBIM) */
22732274 .driver_info = RSVD(4) },
22742275 { USB_DEVICE_INTERFACE_CLASS(0x2df3, 0x9d03, 0xff) }, /* LongSung M5710 */
drivers/usb/serial/qcserial.c+2−0
@@ -184,6 +184,8 @@ static const struct usb_device_id id_table[] = { · 183 unmodified lines
184184 {DEVICE_SWI(0x413c, 0x81d0)}, /* Dell Wireless 5819 */
185185 {DEVICE_SWI(0x413c, 0x81d1)}, /* Dell Wireless 5818 */
186186 {DEVICE_SWI(0x413c, 0x81d2)}, /* Dell Wireless 5818 */
187+ {DEVICE_SWI(0x413c, 0x8217)}, /* Dell Wireless DW5826e */
188+ {DEVICE_SWI(0x413c, 0x8218)}, /* Dell Wireless DW5826e QDL */
187189
188190 /* Huawei devices */
189191 {DEVICE_HWI(0x03f0, 0x581d)}, /* HP lt4112 LTE/HSPA+ Gobi 4G Modem (Huawei me906e) */
drivers/usb/typec/tcpm/tcpm.c+3−3
@@ -4876,8 +4876,7 @@ static void run_state_machine(struct tcpm_port *port) · 4875 unmodified lines
48764876 break;
48774877 case PORT_RESET:
48784878 tcpm_reset_port(port);
4879− tcpm_set_cc(port, tcpm_default_state(port) == SNK_UNATTACHED ?
4880− TYPEC_CC_RD : tcpm_rp_cc(port));
4879+ tcpm_set_cc(port, TYPEC_CC_OPEN);
48814880 tcpm_set_state(port, PORT_RESET_WAIT_OFF,
48824881 PD_T_ERROR_RECOVERY);
48834882 break;
@@ -6848,7 +6847,8 @@ struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc) · 1964 unmodified lines
68486847 if (err)
68496848 goto out_role_sw_put;
68506849
6851− port->typec_caps.pd = port->pds[0];
6850+ if (port->pds)
6851+ port->typec_caps.pd = port->pds[0];
68526852
68536853 port->typec_port = typec_register_port(port->dev, &port->typec_caps);
68546854 if (IS_ERR(port->typec_port)) {
drivers/usb/typec/ucsi/ucsi.c+2−0
@@ -938,7 +938,9 @@ static void ucsi_handle_connector_change(struct work_struct *work) · 937 unmodified lines
938938
939939 clear_bit(EVENT_PENDING, &con->ucsi->flags);
940940
941+ mutex_lock(&ucsi->ppm_lock);
941942 ret = ucsi_acknowledge_connector_change(ucsi);
943+ mutex_unlock(&ucsi->ppm_lock);
942944 if (ret)
943945 dev_err(ucsi->dev, "%s: ACK failed (%d)", __func__, ret);
944946
drivers/usb/typec/ucsi/ucsi_acpi.c+81−7
@@ -25,6 +25,8 @@ struct ucsi_acpi { · 24 unmodified lines
2525 unsigned long flags;
2626 guid_t guid;
2727 u64 cmd;
28+ bool dell_quirk_probed;
29+ bool dell_quirk_active;
2830 };
2931
3032 static int ucsi_acpi_dsm(struct ucsi_acpi *ua, int func)
@@ -73,9 +75,13 @@ static int ucsi_acpi_sync_write(struct ucsi *ucsi, unsigned int offset, · 42 unmodified lines
7375 const void *val, size_t val_len)
7476 {
7577 struct ucsi_acpi *ua = ucsi_get_drvdata(ucsi);
78+ bool ack = UCSI_COMMAND(*(u64 *)val) == UCSI_ACK_CC_CI;
7679 int ret;
7780
78− set_bit(COMMAND_PENDING, &ua->flags);
81+ if (ack)
82+ set_bit(ACK_PENDING, &ua->flags);
83+ else
84+ set_bit(COMMAND_PENDING, &ua->flags);
7985
8086 ret = ucsi_acpi_async_write(ucsi, offset, val, val_len);
8187 if (ret)
@@ -85,7 +91,10 @@ static int ucsi_acpi_sync_write(struct ucsi *ucsi, unsigned int offset, · 3 unmodified lines
8591 ret = -ETIMEDOUT;
8692
8793 out_clear_bit:
88− clear_bit(COMMAND_PENDING, &ua->flags);
94+ if (ack)
95+ clear_bit(ACK_PENDING, &ua->flags);
96+ else
97+ clear_bit(COMMAND_PENDING, &ua->flags);
8998
9099 return ret;
91100 }
@@ -119,12 +128,73 @@ static const struct ucsi_operations ucsi_zenbook_ops = { · 27 unmodified lines
119128 .async_write = ucsi_acpi_async_write
120129 };
121130
122−static const struct dmi_system_id zenbook_dmi_id[] = {
131+/*
132+ * Some Dell laptops expect that an ACK command with the
133+ * UCSI_ACK_CONNECTOR_CHANGE bit set is followed by a (separate)
134+ * ACK command that only has the UCSI_ACK_COMMAND_COMPLETE bit set.
135+ * If this is not done events are not delivered to OSPM and
136+ * subsequent commands will timeout.
137+ */
138+static int
139+ucsi_dell_sync_write(struct ucsi *ucsi, unsigned int offset,
140+ const void *val, size_t val_len)
141+{
142+ struct ucsi_acpi *ua = ucsi_get_drvdata(ucsi);
143+ u64 cmd = *(u64 *)val, ack = 0;
144+ int ret;
145+
146+ if (UCSI_COMMAND(cmd) == UCSI_ACK_CC_CI &&
147+ cmd & UCSI_ACK_CONNECTOR_CHANGE)
148+ ack = UCSI_ACK_CC_CI | UCSI_ACK_COMMAND_COMPLETE;
149+
150+ ret = ucsi_acpi_sync_write(ucsi, offset, val, val_len);
151+ if (ret != 0)
152+ return ret;
153+ if (ack == 0)
154+ return ret;
155+
156+ if (!ua->dell_quirk_probed) {
157+ ua->dell_quirk_probed = true;
158+
159+ cmd = UCSI_GET_CAPABILITY;
160+ ret = ucsi_acpi_sync_write(ucsi, UCSI_CONTROL, &cmd,
161+ sizeof(cmd));
162+ if (ret == 0)
163+ return ucsi_acpi_sync_write(ucsi, UCSI_CONTROL,
164+ &ack, sizeof(ack));
165+ if (ret != -ETIMEDOUT)
166+ return ret;
167+
168+ ua->dell_quirk_active = true;
169+ dev_err(ua->dev, "Firmware bug: Additional ACK required after ACKing a connector change.\n");
170+ dev_err(ua->dev, "Firmware bug: Enabling workaround\n");
171+ }
172+
173+ if (!ua->dell_quirk_active)
174+ return ret;
175+
176+ return ucsi_acpi_sync_write(ucsi, UCSI_CONTROL, &ack, sizeof(ack));
177+}
178+
179+static const struct ucsi_operations ucsi_dell_ops = {
180+ .read = ucsi_acpi_read,
181+ .sync_write = ucsi_dell_sync_write,
182+ .async_write = ucsi_acpi_async_write
183+};
184+
185+static const struct dmi_system_id ucsi_acpi_quirks[] = {
123186 {
124187 .matches = {
125188 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
126189 DMI_MATCH(DMI_PRODUCT_NAME, "ZenBook UX325UA_UM325UA"),
127190 },
191+ .driver_data = (void *)&ucsi_zenbook_ops,
192+ },
193+ {
194+ .matches = {
195+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
196+ },
197+ .driver_data = (void *)&ucsi_dell_ops,
128198 },
129199 { }
130200 };
@@ -142,8 +212,10 @@ static void ucsi_acpi_notify(acpi_handle handle, u32 event, void *data) · 11 unmodified lines
142212 if (UCSI_CCI_CONNECTOR(cci))
143213 ucsi_connector_change(ua->ucsi, UCSI_CCI_CONNECTOR(cci));
144214
145− if (test_bit(COMMAND_PENDING, &ua->flags) &&
146− cci & (UCSI_CCI_ACK_COMPLETE | UCSI_CCI_COMMAND_COMPLETE))
215+ if (cci & UCSI_CCI_ACK_COMPLETE && test_bit(ACK_PENDING, &ua->flags))
216+ complete(&ua->complete);
217+ if (cci & UCSI_CCI_COMMAND_COMPLETE &&
218+ test_bit(COMMAND_PENDING, &ua->flags))
147219 complete(&ua->complete);
148220 }
149221
@@ -151,6 +223,7 @@ static int ucsi_acpi_probe(struct platform_device *pdev) · 1 unmodified line
151223 {
152224 struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
153225 const struct ucsi_operations *ops = &ucsi_acpi_ops;
226+ const struct dmi_system_id *id;
154227 struct ucsi_acpi *ua;
155228 struct resource *res;
156229 acpi_status status;
@@ -180,8 +253,9 @@ static int ucsi_acpi_probe(struct platform_device *pdev) · 23 unmodified lines
180253 init_completion(&ua->complete);
181254 ua->dev = &pdev->dev;
182255
183− if (dmi_check_system(zenbook_dmi_id))
184− ops = &ucsi_zenbook_ops;
256+ id = dmi_first_match(ucsi_acpi_quirks);
257+ if (id)
258+ ops = id->driver_data;
185259
186260 ua->ucsi = ucsi_create(&pdev->dev, ops);
187261 if (IS_ERR(ua->ucsi))
fs/bcachefs/fs-ioctl.c+2−2
@@ -455,6 +455,7 @@ static long bch2_ioctl_subvolume_destroy(struct bch_fs *c, struct file *filp, · 454 unmodified lines
455455 if (IS_ERR(victim))
456456 return PTR_ERR(victim);
457457
458+ dir = d_inode(path.dentry);
458459 if (victim->d_sb->s_fs_info != c) {
459460 ret = -EXDEV;
460461 goto err;
@@ -463,14 +464,13 @@ static long bch2_ioctl_subvolume_destroy(struct bch_fs *c, struct file *filp, · 2 unmodified lines
463464 ret = -ENOENT;
464465 goto err;
465466 }
466− dir = d_inode(path.dentry);
467467 ret = __bch2_unlink(dir, victim, true);
468468 if (!ret) {
469469 fsnotify_rmdir(dir, victim);
470470 d_delete(victim);
471471 }
472− inode_unlock(dir);
473472 err:
473+ inode_unlock(dir);
474474 dput(victim);
475475 path_put(&path);
476476 return ret;
fs/bcachefs/mean_and_variance.h+1−1
@@ -17,7 +17,7 @@ · 16 unmodified lines
1717 * Rust and rustc has issues with u128.
1818 */
1919
20−#if defined(__SIZEOF_INT128__) && defined(__KERNEL__)
20+#if defined(__SIZEOF_INT128__) && defined(__KERNEL__) && !defined(CONFIG_PARISC)
2121
2222 typedef struct {
2323 unsigned __int128 v;
fs/bcachefs/thread_with_file.c+1−1
@@ -53,9 +53,9 @@ int bch2_run_thread_with_file(struct thread_with_file *thr, · 52 unmodified lines
5353 if (ret)
5454 goto err;
5555
56− fd_install(fd, file);
5756 get_task_struct(thr->task);
5857 wake_up_process(thr->task);
58+ fd_install(fd, file);
5959 return fd;
6060 err:
6161 if (fd >= 0)
fs/bcachefs/util.c+3−2
@@ -418,14 +418,15 @@ static inline void bch2_time_stats_update_one(struct bch2_time_stats *stats, · 417 unmodified lines
418418 bch2_quantiles_update(&stats->quantiles, duration);
419419 }
420420
421− if (time_after64(end, stats->last_event)) {
421+ if (stats->last_event && time_after64(end, stats->last_event)) {
422422 freq = end - stats->last_event;
423423 mean_and_variance_update(&stats->freq_stats, freq);
424424 mean_and_variance_weighted_update(&stats->freq_stats_weighted, freq);
425425 stats->max_freq = max(stats->max_freq, freq);
426426 stats->min_freq = min(stats->min_freq, freq);
427− stats->last_event = end;
428427 }
428+
429+ stats->last_event = end;
429430 }
430431
431432 static void __bch2_time_stats_clear_buffer(struct bch2_time_stats *stats,
fs/btrfs/disk-io.c+11−2
@@ -1336,8 +1336,17 @@ static struct btrfs_root *btrfs_get_root_ref(struct btrfs_fs_info *fs_info, · 1335 unmodified lines
13361336 again:
13371337 root = btrfs_lookup_fs_root(fs_info, objectid);
13381338 if (root) {
1339− /* Shouldn't get preallocated anon_dev for cached roots */
1340− ASSERT(!anon_dev);
1339+ /*
1340+ * Some other caller may have read out the newly inserted
1341+ * subvolume already (for things like backref walk etc). Not
1342+ * that common but still possible. In that case, we just need
1343+ * to free the anon_dev.
1344+ */
1345+ if (unlikely(anon_dev)) {
1346+ free_anon_bdev(anon_dev);
1347+ anon_dev = 0;
1348+ }
1349+
13411350 if (check_ref && btrfs_root_refs(&root->root_item) == 0) {
13421351 btrfs_put_root(root);
13431352 return ERR_PTR(-ENOENT);
fs/btrfs/ioctl.c+5−0
@@ -3815,6 +3815,11 @@ static long btrfs_ioctl_qgroup_create(struct file *file, void __user *arg) · 3814 unmodified lines
38153815 goto out;
38163816 }
38173817
3818+ if (sa->create && is_fstree(sa->qgroupid)) {
3819+ ret = -EINVAL;
3820+ goto out;
3821+ }
3822+
38183823 trans = btrfs_join_transaction(root);
38193824 if (IS_ERR(trans)) {
38203825 ret = PTR_ERR(trans);
fs/btrfs/qgroup.c+14−0
@@ -1736,6 +1736,15 @@ out: · 1735 unmodified lines
17361736 return ret;
17371737 }
17381738
1739+static bool qgroup_has_usage(struct btrfs_qgroup *qgroup)
1740+{
1741+ return (qgroup->rfer > 0 || qgroup->rfer_cmpr > 0 ||
1742+ qgroup->excl > 0 || qgroup->excl_cmpr > 0 ||
1743+ qgroup->rsv.values[BTRFS_QGROUP_RSV_DATA] > 0 ||
1744+ qgroup->rsv.values[BTRFS_QGROUP_RSV_META_PREALLOC] > 0 ||
1745+ qgroup->rsv.values[BTRFS_QGROUP_RSV_META_PERTRANS] > 0);
1746+}
1747+
17391748 int btrfs_remove_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid)
17401749 {
17411750 struct btrfs_fs_info *fs_info = trans->fs_info;
@@ -1755,6 +1764,11 @@ int btrfs_remove_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid) · 13 unmodified lines
17551764 goto out;
17561765 }
17571766
1767+ if (is_fstree(qgroupid) && qgroup_has_usage(qgroup)) {
1768+ ret = -EBUSY;
1769+ goto out;
1770+ }
1771+
17581772 /* Check if there are no children of this qgroup */
17591773 if (!list_empty(&qgroup->members)) {
17601774 ret = -EBUSY;
fs/btrfs/send.c+1−1
@@ -8111,7 +8111,7 @@ long btrfs_ioctl_send(struct inode *inode, struct btrfs_ioctl_send_args *arg) · 8110 unmodified lines
81118111 }
81128112
81138113 if (arg->flags & ~BTRFS_SEND_FLAG_MASK) {
8114− ret = -EINVAL;
8114+ ret = -EOPNOTSUPP;
81158115 goto out;
81168116 }
81178117
fs/ext4/ext4.h+5−3
@@ -252,8 +252,10 @@ struct ext4_allocation_request { · 251 unmodified lines
252252 #define EXT4_MAP_MAPPED BIT(BH_Mapped)
253253 #define EXT4_MAP_UNWRITTEN BIT(BH_Unwritten)
254254 #define EXT4_MAP_BOUNDARY BIT(BH_Boundary)
255+#define EXT4_MAP_DELAYED BIT(BH_Delay)
255256 #define EXT4_MAP_FLAGS (EXT4_MAP_NEW | EXT4_MAP_MAPPED |\
256− EXT4_MAP_UNWRITTEN | EXT4_MAP_BOUNDARY)
257+ EXT4_MAP_UNWRITTEN | EXT4_MAP_BOUNDARY |\
258+ EXT4_MAP_DELAYED)
257259
258260 struct ext4_map_blocks {
259261 ext4_fsblk_t m_pblk;
@@ -2912,10 +2914,10 @@ extern const struct seq_operations ext4_mb_seq_groups_ops; · 2652 unmodified lines
29122914 extern const struct seq_operations ext4_mb_seq_structs_summary_ops;
29132915 extern int ext4_seq_mb_stats_show(struct seq_file *seq, void *offset);
29142916 extern int ext4_mb_init(struct super_block *);
2915−extern int ext4_mb_release(struct super_block *);
2917+extern void ext4_mb_release(struct super_block *);
29162918 extern ext4_fsblk_t ext4_mb_new_blocks(handle_t *,
29172919 struct ext4_allocation_request *, int *);
2918−extern void ext4_discard_preallocations(struct inode *, unsigned int);
2920+extern void ext4_discard_preallocations(struct inode *);
29192921 extern int __init ext4_init_mballoc(void);
29202922 extern void ext4_exit_mballoc(void);
29212923 extern ext4_group_t ext4_mb_prefetch(struct super_block *sb,
fs/ext4/extents.c+78−46
@@ -100,7 +100,7 @@ static int ext4_ext_trunc_restart_fn(struct inode *inode, int *dropped) · 99 unmodified lines
100100 * i_rwsem. So we can safely drop the i_data_sem here.
101101 */
102102 BUG_ON(EXT4_JOURNAL(inode) == NULL);
103− ext4_discard_preallocations(inode, 0);
103+ ext4_discard_preallocations(inode);
104104 up_write(&EXT4_I(inode)->i_data_sem);
105105 *dropped = 1;
106106 return 0;
@@ -2229,7 +2229,7 @@ static int ext4_fill_es_cache_info(struct inode *inode, · 2122 unmodified lines
22292229
22302230
22312231 /*
2232− * ext4_ext_determine_hole - determine hole around given block
2232+ * ext4_ext_find_hole - find hole around given block according to the given path
22332233 * @inode: inode we lookup in
22342234 * @path: path in extent tree to @lblk
22352235 * @lblk: pointer to logical block around which we want to determine hole
@@ -2241,9 +2241,9 @@ static int ext4_fill_es_cache_info(struct inode *inode, · 5 unmodified lines
22412241 * The function returns the length of a hole starting at @lblk. We update @lblk
22422242 * to the beginning of the hole if we managed to find it.
22432243 */
2244−static ext4_lblk_t ext4_ext_determine_hole(struct inode *inode,
2245− struct ext4_ext_path *path,
2246− ext4_lblk_t *lblk)
2244+static ext4_lblk_t ext4_ext_find_hole(struct inode *inode,
2245+ struct ext4_ext_path *path,
2246+ ext4_lblk_t *lblk)
22472247 {
22482248 int depth = ext_depth(inode);
22492249 struct ext4_extent *ex;
@@ -2270,30 +2270,6 @@ static ext4_lblk_t ext4_ext_determine_hole(struct inode *inode, · 20 unmodified lines
22702270 return len;
22712271 }
22722272
2273−/*
2274− * ext4_ext_put_gap_in_cache:
2275− * calculate boundaries of the gap that the requested block fits into
2276− * and cache this gap
2277− */
2278−static void
2279−ext4_ext_put_gap_in_cache(struct inode *inode, ext4_lblk_t hole_start,
2280− ext4_lblk_t hole_len)
2281−{
2282− struct extent_status es;
2283−
2284− ext4_es_find_extent_range(inode, &ext4_es_is_delayed, hole_start,
2285− hole_start + hole_len - 1, &es);
2286− if (es.es_len) {
2287− /* There's delayed extent containing lblock? */
2288− if (es.es_lblk <= hole_start)
2289− return;
2290− hole_len = min(es.es_lblk - hole_start, hole_len);
2291− }
2292− ext_debug(inode, " -> %u:%u\n", hole_start, hole_len);
2293− ext4_es_insert_extent(inode, hole_start, hole_len, ~0,
2294− EXTENT_STATUS_HOLE);
2295−}
2296−
22972273 /*
22982274 * ext4_ext_rm_idx:
22992275 * removes index from the index block.
@@ -4062,6 +4038,72 @@ static int get_implied_cluster_alloc(struct super_block *sb, · 1762 unmodified lines
40624038 return 0;
40634039 }
40644040
4041+/*
4042+ * Determine hole length around the given logical block, first try to
4043+ * locate and expand the hole from the given @path, and then adjust it
4044+ * if it's partially or completely converted to delayed extents, insert
4045+ * it into the extent cache tree if it's indeed a hole, finally return
4046+ * the length of the determined extent.
4047+ */
4048+static ext4_lblk_t ext4_ext_determine_insert_hole(struct inode *inode,
4049+ struct ext4_ext_path *path,
4050+ ext4_lblk_t lblk)
4051+{
4052+ ext4_lblk_t hole_start, len;
4053+ struct extent_status es;
4054+
4055+ hole_start = lblk;
4056+ len = ext4_ext_find_hole(inode, path, &hole_start);
4057+again:
4058+ ext4_es_find_extent_range(inode, &ext4_es_is_delayed, hole_start,
4059+ hole_start + len - 1, &es);
4060+ if (!es.es_len)
4061+ goto insert_hole;
4062+
4063+ /*
4064+ * There's a delalloc extent in the hole, handle it if the delalloc
4065+ * extent is in front of, behind and straddle the queried range.
4066+ */
4067+ if (lblk >= es.es_lblk + es.es_len) {
4068+ /*
4069+ * The delalloc extent is in front of the queried range,
4070+ * find again from the queried start block.
4071+ */
4072+ len -= lblk - hole_start;
4073+ hole_start = lblk;
4074+ goto again;
4075+ } else if (in_range(lblk, es.es_lblk, es.es_len)) {
4076+ /*
4077+ * The delalloc extent containing lblk, it must have been
4078+ * added after ext4_map_blocks() checked the extent status
4079+ * tree so we are not holding i_rwsem and delalloc info is
4080+ * only stabilized by i_data_sem we are going to release
4081+ * soon. Don't modify the extent status tree and report
4082+ * extent as a hole, just adjust the length to the delalloc
4083+ * extent's after lblk.
4084+ */
4085+ len = es.es_lblk + es.es_len - lblk;
4086+ return len;
4087+ } else {
4088+ /*
4089+ * The delalloc extent is partially or completely behind
4090+ * the queried range, update hole length until the
4091+ * beginning of the delalloc extent.
4092+ */
4093+ len = min(es.es_lblk - hole_start, len);
4094+ }
4095+
4096+insert_hole:
4097+ /* Put just found gap into cache to speed up subsequent requests */
4098+ ext_debug(inode, " -> %u:%u\n", hole_start, len);
4099+ ext4_es_insert_extent(inode, hole_start, len, ~0, EXTENT_STATUS_HOLE);
4100+
4101+ /* Update hole_len to reflect hole size after lblk */
4102+ if (hole_start != lblk)
4103+ len -= lblk - hole_start;
4104+
4105+ return len;
4106+}
40654107
40664108 /*
40674109 * Block allocation/map/preallocation routine for extents based files
@@ -4179,22 +4221,12 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode, · 111 unmodified lines
41794221 * we couldn't try to create block if create flag is zero
41804222 */
41814223 if ((flags & EXT4_GET_BLOCKS_CREATE) == 0) {
4182− ext4_lblk_t hole_start, hole_len;
4224+ ext4_lblk_t len;
41834225
4184− hole_start = map->m_lblk;
4185− hole_len = ext4_ext_determine_hole(inode, path, &hole_start);
4186− /*
4187− * put just found gap into cache to speed up
4188− * subsequent requests
4189− */
4190− ext4_ext_put_gap_in_cache(inode, hole_start, hole_len);
4226+ len = ext4_ext_determine_insert_hole(inode, path, map->m_lblk);
41914227
4192− /* Update hole_len to reflect hole size after map->m_lblk */
4193− if (hole_start != map->m_lblk)
4194− hole_len -= map->m_lblk - hole_start;
41954228 map->m_pblk = 0;
4196− map->m_len = min_t(unsigned int, map->m_len, hole_len);
4197−
4229+ map->m_len = min_t(unsigned int, map->m_len, len);
41984230 goto out;
41994231 }
42004232
@@ -4313,7 +4345,7 @@ got_allocated_blocks: · 112 unmodified lines
43134345 * not a good idea to call discard here directly,
43144346 * but otherwise we'd need to call it every free().
43154347 */
4316− ext4_discard_preallocations(inode, 0);
4348+ ext4_discard_preallocations(inode);
43174349 if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE)
43184350 fb_flags = EXT4_FREE_BLOCKS_NO_QUOT_UPDATE;
43194351 ext4_free_blocks(handle, inode, NULL, newblock,
@@ -5357,7 +5389,7 @@ static int ext4_collapse_range(struct file *file, loff_t offset, loff_t len) · 1037 unmodified lines
53575389 ext4_fc_mark_ineligible(sb, EXT4_FC_REASON_FALLOC_RANGE, handle);
53585390
53595391 down_write(&EXT4_I(inode)->i_data_sem);
5360− ext4_discard_preallocations(inode, 0);
5392+ ext4_discard_preallocations(inode);
53615393 ext4_es_remove_extent(inode, punch_start, EXT_MAX_BLOCKS - punch_start);
53625394
53635395 ret = ext4_ext_remove_space(inode, punch_start, punch_stop - 1);
@@ -5365,7 +5397,7 @@ static int ext4_collapse_range(struct file *file, loff_t offset, loff_t len) · 1 unmodified line
53655397 up_write(&EXT4_I(inode)->i_data_sem);
53665398 goto out_stop;
53675399 }
5368− ext4_discard_preallocations(inode, 0);
5400+ ext4_discard_preallocations(inode);
53695401
53705402 ret = ext4_ext_shift_extents(inode, handle, punch_stop,
53715403 punch_stop - punch_start, SHIFT_LEFT);
@@ -5497,7 +5529,7 @@ static int ext4_insert_range(struct file *file, loff_t offset, loff_t len) · 125 unmodified lines
54975529 goto out_stop;
54985530
54995531 down_write(&EXT4_I(inode)->i_data_sem);
5500− ext4_discard_preallocations(inode, 0);
5532+ ext4_discard_preallocations(inode);
55015533
55025534 path = ext4_find_extent(inode, offset_lblk, NULL, 0);
55035535 if (IS_ERR(path)) {
fs/ext4/file.c+1−1
@@ -174,7 +174,7 @@ static int ext4_release_file(struct inode *inode, struct file *filp) · 173 unmodified lines
174174 (atomic_read(&inode->i_writecount) == 1) &&
175175 !EXT4_I(inode)->i_reserved_data_blocks) {
176176 down_write(&EXT4_I(inode)->i_data_sem);
177− ext4_discard_preallocations(inode, 0);
177+ ext4_discard_preallocations(inode);
178178 up_write(&EXT4_I(inode)->i_data_sem);
179179 }
180180 if (is_dx(inode) && filp->private_data)
fs/ext4/indirect.c+1−1
@@ -714,7 +714,7 @@ static int ext4_ind_trunc_restart_fn(handle_t *handle, struct inode *inode, · 713 unmodified lines
714714 * i_rwsem. So we can safely drop the i_data_sem here.
715715 */
716716 BUG_ON(EXT4_JOURNAL(inode) == NULL);
717− ext4_discard_preallocations(inode, 0);
717+ ext4_discard_preallocations(inode);
718718 up_write(&EXT4_I(inode)->i_data_sem);
719719 *dropped = 1;
720720 return 0;
fs/ext4/inode.c+30−60
@@ -371,7 +371,7 @@ void ext4_da_update_reserve_space(struct inode *inode, · 370 unmodified lines
371371 */
372372 if ((ei->i_reserved_data_blocks == 0) &&
373373 !inode_is_open_for_write(inode))
374− ext4_discard_preallocations(inode, 0);
374+ ext4_discard_preallocations(inode);
375375 }
376376
377377 static int __check_block_validity(struct inode *inode, const char *func,
@@ -515,6 +515,8 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode, · 137 unmodified lines
515515 map->m_len = retval;
516516 } else if (ext4_es_is_delayed(&es) || ext4_es_is_hole(&es)) {
517517 map->m_pblk = 0;
518+ map->m_flags |= ext4_es_is_delayed(&es) ?
519+ EXT4_MAP_DELAYED : 0;
518520 retval = es.es_len - (map->m_lblk - es.es_lblk);
519521 if (retval > map->m_len)
520522 retval = map->m_len;
@@ -1703,11 +1705,8 @@ static int ext4_da_map_blocks(struct inode *inode, sector_t iblock, · 1182 unmodified lines
17031705
17041706 /* Lookup extent status tree firstly */
17051707 if (ext4_es_lookup_extent(inode, iblock, NULL, &es)) {
1706− if (ext4_es_is_hole(&es)) {
1707− retval = 0;
1708− down_read(&EXT4_I(inode)->i_data_sem);
1708+ if (ext4_es_is_hole(&es))
17091709 goto add_delayed;
1710− }
17111710
17121711 /*
17131712 * Delayed extent could be allocated by fallocate.
@@ -1749,26 +1748,11 @@ static int ext4_da_map_blocks(struct inode *inode, sector_t iblock, · 35 unmodified lines
17491748 retval = ext4_ext_map_blocks(NULL, inode, map, 0);
17501749 else
17511750 retval = ext4_ind_map_blocks(NULL, inode, map, 0);
1752−
1753−add_delayed:
1754− if (retval == 0) {
1755− int ret;
1756−
1757− /*
1758− * XXX: __block_prepare_write() unmaps passed block,
1759− * is it OK?
1760− */
1761−
1762− ret = ext4_insert_delayed_block(inode, map->m_lblk);
1763− if (ret != 0) {
1764− retval = ret;
1765− goto out_unlock;
1766− }
1767−
1768− map_bh(bh, inode->i_sb, invalid_block);
1769− set_buffer_new(bh);
1770− set_buffer_delay(bh);
1771− } else if (retval > 0) {
1751+ if (retval < 0) {
1752+ up_read(&EXT4_I(inode)->i_data_sem);
1753+ return retval;
1754+ }
1755+ if (retval > 0) {
17721756 unsigned int status;
17731757
17741758 if (unlikely(retval != map->m_len)) {
@@ -1783,11 +1767,21 @@ add_delayed: · 8 unmodified lines
17831767 EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN;
17841768 ext4_es_insert_extent(inode, map->m_lblk, map->m_len,
17851769 map->m_pblk, status);
1770+ up_read(&EXT4_I(inode)->i_data_sem);
1771+ return retval;
17861772 }
1773+ up_read(&EXT4_I(inode)->i_data_sem);
17871774
1788−out_unlock:
1789− up_read((&EXT4_I(inode)->i_data_sem));
1775+add_delayed:
1776+ down_write(&EXT4_I(inode)->i_data_sem);
1777+ retval = ext4_insert_delayed_block(inode, map->m_lblk);
1778+ up_write(&EXT4_I(inode)->i_data_sem);
1779+ if (retval)
1780+ return retval;
17901781
1782+ map_bh(bh, inode->i_sb, invalid_block);
1783+ set_buffer_new(bh);
1784+ set_buffer_delay(bh);
17911785 return retval;
17921786 }
17931787
@@ -3268,6 +3262,9 @@ static void ext4_set_iomap(struct inode *inode, struct iomap *iomap, · 1474 unmodified lines
32683262 iomap->addr = (u64) map->m_pblk << blkbits;
32693263 if (flags & IOMAP_DAX)
32703264 iomap->addr += EXT4_SB(inode->i_sb)->s_dax_part_off;
3265+ } else if (map->m_flags & EXT4_MAP_DELAYED) {
3266+ iomap->type = IOMAP_DELALLOC;
3267+ iomap->addr = IOMAP_NULL_ADDR;
32713268 } else {
32723269 iomap->type = IOMAP_HOLE;
32733270 iomap->addr = IOMAP_NULL_ADDR;
@@ -3430,35 +3427,11 @@ const struct iomap_ops ext4_iomap_overwrite_ops = { · 156 unmodified lines
34303427 .iomap_end = ext4_iomap_end,
34313428 };
34323429
3433−static bool ext4_iomap_is_delalloc(struct inode *inode,
3434− struct ext4_map_blocks *map)
3435−{
3436− struct extent_status es;
3437− ext4_lblk_t offset = 0, end = map->m_lblk + map->m_len - 1;
3438−
3439− ext4_es_find_extent_range(inode, &ext4_es_is_delayed,
3440− map->m_lblk, end, &es);
3441−
3442− if (!es.es_len || es.es_lblk > end)
3443− return false;
3444−
3445− if (es.es_lblk > map->m_lblk) {
3446− map->m_len = es.es_lblk - map->m_lblk;
3447− return false;
3448− }
3449−
3450− offset = map->m_lblk - es.es_lblk;
3451− map->m_len = es.es_len - offset;
3452−
3453− return true;
3454−}
3455−
34563430 static int ext4_iomap_begin_report(struct inode *inode, loff_t offset,
34573431 loff_t length, unsigned int flags,
34583432 struct iomap *iomap, struct iomap *srcmap)
34593433 {
34603434 int ret;
3461− bool delalloc = false;
34623435 struct ext4_map_blocks map;
34633436 u8 blkbits = inode->i_blkbits;
34643437
@@ -3499,13 +3472,8 @@ static int ext4_iomap_begin_report(struct inode *inode, loff_t offset, · 34 unmodified lines
34993472 ret = ext4_map_blocks(NULL, inode, &map, 0);
35003473 if (ret < 0)
35013474 return ret;
3502− if (ret == 0)
3503− delalloc = ext4_iomap_is_delalloc(inode, &map);
3504−
35053475 set_iomap:
35063476 ext4_set_iomap(inode, iomap, &map, offset, length, flags);
3507− if (delalloc && iomap->type == IOMAP_HOLE)
3508− iomap->type = IOMAP_DELALLOC;
35093477
35103478 return 0;
35113479 }
@@ -4015,12 +3983,12 @@ int ext4_punch_hole(struct file *file, loff_t offset, loff_t length) · 503 unmodified lines
40153983
40163984 /* If there are blocks to remove, do it */
40173985 if (stop_block > first_block) {
3986+ ext4_lblk_t hole_len = stop_block - first_block;
40183987
40193988 down_write(&EXT4_I(inode)->i_data_sem);
4020− ext4_discard_preallocations(inode, 0);
3989+ ext4_discard_preallocations(inode);
40213990
4022− ext4_es_remove_extent(inode, first_block,
4023− stop_block - first_block);
3991+ ext4_es_remove_extent(inode, first_block, hole_len);
40243992
40253993 if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
40263994 ret = ext4_ext_remove_space(inode, first_block,
@@ -4029,6 +3997,8 @@ int ext4_punch_hole(struct file *file, loff_t offset, loff_t length) · 2 unmodified lines
40293997 ret = ext4_ind_remove_space(handle, inode, first_block,
40303998 stop_block);
40313999
4000+ ext4_es_insert_extent(inode, first_block, hole_len, ~0,
4001+ EXTENT_STATUS_HOLE);
40324002 up_write(&EXT4_I(inode)->i_data_sem);
40334003 }
40344004 ext4_fc_track_range(handle, inode, first_block, stop_block);
@@ -4170,7 +4140,7 @@ int ext4_truncate(struct inode *inode) · 135 unmodified lines
41704140
41714141 down_write(&EXT4_I(inode)->i_data_sem);
41724142
4173− ext4_discard_preallocations(inode, 0);
4143+ ext4_discard_preallocations(inode);
41744144
41754145 if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
41764146 err = ext4_ext_truncate(handle, inode);
fs/ext4/ioctl.c+1−1
@@ -467,7 +467,7 @@ static long swap_inode_boot_loader(struct super_block *sb, · 466 unmodified lines
467467 ext4_reset_inode_seed(inode);
468468 ext4_reset_inode_seed(inode_bl);
469469
470− ext4_discard_preallocations(inode, 0);
470+ ext4_discard_preallocations(inode);
471471
472472 err = ext4_mark_inode_dirty(handle, inode);
473473 if (err < 0) {
fs/ext4/mballoc.c+78−62
@@ -564,14 +564,14 @@ static void mb_free_blocks_double(struct inode *inode, struct ext4_buddy *e4b, · 563 unmodified lines
564564
565565 blocknr = ext4_group_first_block_no(sb, e4b->bd_group);
566566 blocknr += EXT4_C2B(EXT4_SB(sb), first + i);
567+ ext4_mark_group_bitmap_corrupted(sb, e4b->bd_group,
568+ EXT4_GROUP_INFO_BBITMAP_CORRUPT);
567569 ext4_grp_locked_error(sb, e4b->bd_group,
568570 inode ? inode->i_ino : 0,
569571 blocknr,
570572 "freeing block already freed "
571573 "(bit %u)",
572574 first + i);
573− ext4_mark_group_bitmap_corrupted(sb, e4b->bd_group,
574− EXT4_GROUP_INFO_BBITMAP_CORRUPT);
575575 }
576576 mb_clear_bit(first + i, e4b->bd_info->bb_bitmap);
577577 }
@@ -677,7 +677,7 @@ do { \ · 99 unmodified lines
677677 } \
678678 } while (0)
679679
680−static int __mb_check_buddy(struct ext4_buddy *e4b, char *file,
680+static void __mb_check_buddy(struct ext4_buddy *e4b, char *file,
681681 const char *function, int line)
682682 {
683683 struct super_block *sb = e4b->bd_sb;
@@ -696,7 +696,7 @@ static int __mb_check_buddy(struct ext4_buddy *e4b, char *file, · 12 unmodified lines
696696 void *buddy2;
697697
698698 if (e4b->bd_info->bb_check_counter++ % 10)
699− return 0;
699+ return;
700700
701701 while (order > 1) {
702702 buddy = mb_find_buddy(e4b, order, &max);
@@ -758,7 +758,7 @@ static int __mb_check_buddy(struct ext4_buddy *e4b, char *file, · 55 unmodified lines
758758
759759 grp = ext4_get_group_info(sb, e4b->bd_group);
760760 if (!grp)
761− return NULL;
761+ return;
762762 list_for_each(cur, &grp->bb_prealloc_list) {
763763 ext4_group_t groupnr;
764764 struct ext4_prealloc_space *pa;
@@ -768,7 +768,6 @@ static int __mb_check_buddy(struct ext4_buddy *e4b, char *file, · 3 unmodified lines
768768 for (i = 0; i < pa->pa_len; i++)
769769 MB_CHECK_ASSERT(mb_test_bit(k + i, buddy));
770770 }
771− return 0;
772771 }
773772 #undef MB_CHECK_ASSERT
774773 #define mb_check_buddy(e4b) __mb_check_buddy(e4b, \
@@ -842,7 +841,7 @@ mb_update_avg_fragment_size(struct super_block *sb, struct ext4_group_info *grp) · 67 unmodified lines
842841 struct ext4_sb_info *sbi = EXT4_SB(sb);
843842 int new_order;
844843
845− if (!test_opt2(sb, MB_OPTIMIZE_SCAN) || grp->bb_free == 0)
844+ if (!test_opt2(sb, MB_OPTIMIZE_SCAN) || grp->bb_fragments == 0)
846845 return;
847846
848847 new_order = mb_avg_fragment_size_order(sb,
@@ -871,7 +870,7 @@ mb_update_avg_fragment_size(struct super_block *sb, struct ext4_group_info *grp) · 22 unmodified lines
871870 * cr level needs an update.
872871 */
873872 static void ext4_mb_choose_next_group_p2_aligned(struct ext4_allocation_context *ac,
874− enum criteria *new_cr, ext4_group_t *group, ext4_group_t ngroups)
873+ enum criteria *new_cr, ext4_group_t *group)
875874 {
876875 struct ext4_sb_info *sbi = EXT4_SB(ac->ac_sb);
877876 struct ext4_group_info *iter;
@@ -945,7 +944,7 @@ ext4_mb_find_good_group_avg_frag_lists(struct ext4_allocation_context *ac, int o · 67 unmodified lines
945944 * order. Updates *new_cr if cr level needs an update.
946945 */
947946 static void ext4_mb_choose_next_group_goal_fast(struct ext4_allocation_context *ac,
948− enum criteria *new_cr, ext4_group_t *group, ext4_group_t ngroups)
947+ enum criteria *new_cr, ext4_group_t *group)
949948 {
950949 struct ext4_sb_info *sbi = EXT4_SB(ac->ac_sb);
951950 struct ext4_group_info *grp = NULL;
@@ -990,7 +989,7 @@ static void ext4_mb_choose_next_group_goal_fast(struct ext4_allocation_context * · 38 unmodified lines
990989 * much and fall to CR_GOAL_LEN_SLOW in that case.
991990 */
992991 static void ext4_mb_choose_next_group_best_avail(struct ext4_allocation_context *ac,
993− enum criteria *new_cr, ext4_group_t *group, ext4_group_t ngroups)
992+ enum criteria *new_cr, ext4_group_t *group)
994993 {
995994 struct ext4_sb_info *sbi = EXT4_SB(ac->ac_sb);
996995 struct ext4_group_info *grp = NULL;
@@ -1125,11 +1124,11 @@ static void ext4_mb_choose_next_group(struct ext4_allocation_context *ac, · 128 unmodified lines
11251124 }
11261125
11271126 if (*new_cr == CR_POWER2_ALIGNED) {
1128− ext4_mb_choose_next_group_p2_aligned(ac, new_cr, group, ngroups);
1127+ ext4_mb_choose_next_group_p2_aligned(ac, new_cr, group);
11291128 } else if (*new_cr == CR_GOAL_LEN_FAST) {
1130− ext4_mb_choose_next_group_goal_fast(ac, new_cr, group, ngroups);
1129+ ext4_mb_choose_next_group_goal_fast(ac, new_cr, group);
11311130 } else if (*new_cr == CR_BEST_AVAIL_LEN) {
1132− ext4_mb_choose_next_group_best_avail(ac, new_cr, group, ngroups);
1131+ ext4_mb_choose_next_group_best_avail(ac, new_cr, group);
11331132 } else {
11341133 /*
11351134 * TODO: For CR=2, we can arrange groups in an rb tree sorted by
@@ -1233,6 +1232,24 @@ void ext4_mb_generate_buddy(struct super_block *sb, · 97 unmodified lines
12331232 atomic64_add(period, &sbi->s_mb_generation_time);
12341233 }
12351234
1235+static void mb_regenerate_buddy(struct ext4_buddy *e4b)
1236+{
1237+ int count;
1238+ int order = 1;
1239+ void *buddy;
1240+
1241+ while ((buddy = mb_find_buddy(e4b, order++, &count)))
1242+ mb_set_bits(buddy, 0, count);
1243+
1244+ e4b->bd_info->bb_fragments = 0;
1245+ memset(e4b->bd_info->bb_counters, 0,
1246+ sizeof(*e4b->bd_info->bb_counters) *
1247+ (e4b->bd_sb->s_blocksize_bits + 2));
1248+
1249+ ext4_mb_generate_buddy(e4b->bd_sb, e4b->bd_buddy,
1250+ e4b->bd_bitmap, e4b->bd_group, e4b->bd_info);
1251+}
1252+
12361253 /* The buddy information is attached the buddy cache inode
12371254 * for convenience. The information regarding each group
12381255 * is loaded via ext4_mb_load_buddy. The information involve
@@ -1891,11 +1908,6 @@ static void mb_free_blocks(struct inode *inode, struct ext4_buddy *e4b, · 652 unmodified lines
18911908 mb_check_buddy(e4b);
18921909 mb_free_blocks_double(inode, e4b, first, count);
18931910
1894− this_cpu_inc(discard_pa_seq);
1895− e4b->bd_info->bb_free += count;
1896− if (first < e4b->bd_info->bb_first_free)
1897− e4b->bd_info->bb_first_free = first;
1898−
18991911 /* access memory sequentially: check left neighbour,
19001912 * clear range and then check right neighbour
19011913 */
@@ -1909,21 +1921,31 @@ static void mb_free_blocks(struct inode *inode, struct ext4_buddy *e4b, · 7 unmodified lines
19091921 struct ext4_sb_info *sbi = EXT4_SB(sb);
19101922 ext4_fsblk_t blocknr;
19111923
1924+ /*
1925+ * Fastcommit replay can free already freed blocks which
1926+ * corrupts allocation info. Regenerate it.
1927+ */
1928+ if (sbi->s_mount_state & EXT4_FC_REPLAY) {
1929+ mb_regenerate_buddy(e4b);
1930+ goto check;
1931+ }
1932+
19121933 blocknr = ext4_group_first_block_no(sb, e4b->bd_group);
19131934 blocknr += EXT4_C2B(sbi, block);
1914− if (!(sbi->s_mount_state & EXT4_FC_REPLAY)) {
1915− ext4_grp_locked_error(sb, e4b->bd_group,
1916− inode ? inode->i_ino : 0,
1917− blocknr,
1918− "freeing already freed block (bit %u); block bitmap corrupt.",
1919− block);
1920− ext4_mark_group_bitmap_corrupted(
1921− sb, e4b->bd_group,
1935+ ext4_mark_group_bitmap_corrupted(sb, e4b->bd_group,
19221936 EXT4_GROUP_INFO_BBITMAP_CORRUPT);
1923− }
1924− goto done;
1937+ ext4_grp_locked_error(sb, e4b->bd_group,
1938+ inode ? inode->i_ino : 0, blocknr,
1939+ "freeing already freed block (bit %u); block bitmap corrupt.",
1940+ block);
1941+ return;
19251942 }
19261943
1944+ this_cpu_inc(discard_pa_seq);
1945+ e4b->bd_info->bb_free += count;
1946+ if (first < e4b->bd_info->bb_first_free)
1947+ e4b->bd_info->bb_first_free = first;
1948+
19271949 /* let's maintain fragments counter */
19281950 if (left_is_free && right_is_free)
19291951 e4b->bd_info->bb_fragments--;
@@ -1948,9 +1970,9 @@ static void mb_free_blocks(struct inode *inode, struct ext4_buddy *e4b, · 18 unmodified lines
19481970 if (first <= last)
19491971 mb_buddy_mark_free(e4b, first >> 1, last >> 1);
19501972
1951−done:
19521973 mb_set_largest_free_order(sb, e4b->bd_info);
19531974 mb_update_avg_fragment_size(sb, e4b->bd_info);
1975+check:
19541976 mb_check_buddy(e4b);
19551977 }
19561978
@@ -2276,6 +2298,9 @@ void ext4_mb_try_best_found(struct ext4_allocation_context *ac, · 319 unmodified lines
22762298 return;
22772299
22782300 ext4_lock_group(ac->ac_sb, group);
2301+ if (unlikely(EXT4_MB_GRP_BBITMAP_CORRUPT(e4b->bd_info)))
2302+ goto out;
2303+
22792304 max = mb_find_extent(e4b, ex.fe_start, ex.fe_len, &ex);
22802305
22812306 if (max > 0) {
@@ -2283,6 +2308,7 @@ void ext4_mb_try_best_found(struct ext4_allocation_context *ac, · 1 unmodified line
22832308 ext4_mb_use_best_found(ac, e4b);
22842309 }
22852310
2311+out:
22862312 ext4_unlock_group(ac->ac_sb, group);
22872313 ext4_mb_unload_buddy(e4b);
22882314 }
@@ -2309,12 +2335,10 @@ int ext4_mb_find_by_goal(struct ext4_allocation_context *ac, · 20 unmodified lines
23092335 if (err)
23102336 return err;
23112337
2312− if (unlikely(EXT4_MB_GRP_BBITMAP_CORRUPT(e4b->bd_info))) {
2313− ext4_mb_unload_buddy(e4b);
2314− return 0;
2315− }
2316−
23172338 ext4_lock_group(ac->ac_sb, group);
2339+ if (unlikely(EXT4_MB_GRP_BBITMAP_CORRUPT(e4b->bd_info)))
2340+ goto out;
2341+
23182342 max = mb_find_extent(e4b, ac->ac_g_ex.fe_start,
23192343 ac->ac_g_ex.fe_len, &ex);
23202344 ex.fe_logical = 0xDEADFA11; /* debug value */
@@ -2347,6 +2371,7 @@ int ext4_mb_find_by_goal(struct ext4_allocation_context *ac, · 26 unmodified lines
23472371 ac->ac_b_ex = ex;
23482372 ext4_mb_use_best_found(ac, e4b);
23492373 }
2374+out:
23502375 ext4_unlock_group(ac->ac_sb, group);
23512376 ext4_mb_unload_buddy(e4b);
23522377
@@ -2380,12 +2405,12 @@ void ext4_mb_simple_scan_group(struct ext4_allocation_context *ac, · 27 unmodified lines
23802405
23812406 k = mb_find_next_zero_bit(buddy, max, 0);
23822407 if (k >= max) {
2408+ ext4_mark_group_bitmap_corrupted(ac->ac_sb,
2409+ e4b->bd_group,
2410+ EXT4_GROUP_INFO_BBITMAP_CORRUPT);
23832411 ext4_grp_locked_error(ac->ac_sb, e4b->bd_group, 0, 0,
23842412 "%d free clusters of order %d. But found 0",
23852413 grp->bb_counters[i], i);
2386− ext4_mark_group_bitmap_corrupted(ac->ac_sb,
2387− e4b->bd_group,
2388− EXT4_GROUP_INFO_BBITMAP_CORRUPT);
23892414 break;
23902415 }
23912416 ac->ac_found++;
@@ -2436,12 +2461,12 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac, · 44 unmodified lines
24362461 * free blocks even though group info says we
24372462 * have free blocks
24382463 */
2464+ ext4_mark_group_bitmap_corrupted(sb, e4b->bd_group,
2465+ EXT4_GROUP_INFO_BBITMAP_CORRUPT);
24392466 ext4_grp_locked_error(sb, e4b->bd_group, 0, 0,
24402467 "%d free clusters as per "
24412468 "group info. But bitmap says 0",
24422469 free);
2443− ext4_mark_group_bitmap_corrupted(sb, e4b->bd_group,
2444− EXT4_GROUP_INFO_BBITMAP_CORRUPT);
24452470 break;
24462471 }
24472472
@@ -2467,12 +2492,12 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac, · 19 unmodified lines
24672492 if (WARN_ON(ex.fe_len <= 0))
24682493 break;
24692494 if (free < ex.fe_len) {
2495+ ext4_mark_group_bitmap_corrupted(sb, e4b->bd_group,
2496+ EXT4_GROUP_INFO_BBITMAP_CORRUPT);
24702497 ext4_grp_locked_error(sb, e4b->bd_group, 0, 0,
24712498 "%d free clusters as per "
24722499 "group info. But got %d blocks",
24732500 free, ex.fe_len);
2474− ext4_mark_group_bitmap_corrupted(sb, e4b->bd_group,
2475− EXT4_GROUP_INFO_BBITMAP_CORRUPT);
24762501 /*
24772502 * The number of free blocks differs. This mostly
24782503 * indicate that the bitmap is corrupt. So exit
@@ -3725,7 +3750,7 @@ static int ext4_mb_cleanup_pa(struct ext4_group_info *grp) · 1246 unmodified lines
37253750 return count;
37263751 }
37273752
3728−int ext4_mb_release(struct super_block *sb)
3753+void ext4_mb_release(struct super_block *sb)
37293754 {
37303755 ext4_group_t ngroups = ext4_get_groups_count(sb);
37313756 ext4_group_t i;
@@ -3801,8 +3826,6 @@ int ext4_mb_release(struct super_block *sb) · 69 unmodified lines
38013826 }
38023827
38033828 free_percpu(sbi->s_locality_groups);
3804−
3805− return 0;
38063829 }
38073830
38083831 static inline int ext4_issue_discard(struct super_block *sb,
@@ -5284,7 +5307,7 @@ static void ext4_mb_new_preallocation(struct ext4_allocation_context *ac) · 1475 unmodified lines
52845307 * the caller MUST hold group/inode locks.
52855308 * TODO: optimize the case when there are no in-core structures yet
52865309 */
5287−static noinline_for_stack int
5310+static noinline_for_stack void
52885311 ext4_mb_release_inode_pa(struct ext4_buddy *e4b, struct buffer_head *bitmap_bh,
52895312 struct ext4_prealloc_space *pa)
52905313 {
@@ -5334,11 +5357,9 @@ ext4_mb_release_inode_pa(struct ext4_buddy *e4b, struct buffer_head *bitmap_bh, · 43 unmodified lines
53345357 */
53355358 }
53365359 atomic_add(free, &sbi->s_mb_discarded);
5337−
5338− return 0;
53395360 }
53405361
5341−static noinline_for_stack int
5362+static noinline_for_stack void
53425363 ext4_mb_release_group_pa(struct ext4_buddy *e4b,
53435364 struct ext4_prealloc_space *pa)
53445365 {
@@ -5352,13 +5373,11 @@ ext4_mb_release_group_pa(struct ext4_buddy *e4b, · 7 unmodified lines
53525373 if (unlikely(group != e4b->bd_group && pa->pa_len != 0)) {
53535374 ext4_warning(sb, "bad group: expected %u, group %u, pa_start %llu",
53545375 e4b->bd_group, group, pa->pa_pstart);
5355− return 0;
5376+ return;
53565377 }
53575378 mb_free_blocks(pa->pa_inode, e4b, bit, pa->pa_len);
53585379 atomic_add(pa->pa_len, &EXT4_SB(sb)->s_mb_discarded);
53595380 trace_ext4_mballoc_discard(sb, NULL, group, bit, pa->pa_len);
5360−
5361− return 0;
53625381 }
53635382
53645383 /*
@@ -5479,7 +5498,7 @@ out_dbg: · 114 unmodified lines
54795498 *
54805499 * FIXME!! Make sure it is valid at all the call sites
54815500 */
5482−void ext4_discard_preallocations(struct inode *inode, unsigned int needed)
5501+void ext4_discard_preallocations(struct inode *inode)
54835502 {
54845503 struct ext4_inode_info *ei = EXT4_I(inode);
54855504 struct super_block *sb = inode->i_sb;
@@ -5491,9 +5510,8 @@ void ext4_discard_preallocations(struct inode *inode, unsigned int needed) · 5 unmodified lines
54915510 struct rb_node *iter;
54925511 int err;
54935512
5494− if (!S_ISREG(inode->i_mode)) {
5513+ if (!S_ISREG(inode->i_mode))
54955514 return;
5496− }
54975515
54985516 if (EXT4_SB(sb)->s_mount_state & EXT4_FC_REPLAY)
54995517 return;
@@ -5501,15 +5519,12 @@ void ext4_discard_preallocations(struct inode *inode, unsigned int needed) · 1 unmodified line
55015519 mb_debug(sb, "discard preallocation for inode %lu\n",
55025520 inode->i_ino);
55035521 trace_ext4_discard_preallocations(inode,
5504− atomic_read(&ei->i_prealloc_active), needed);
5505−
5506− if (needed == 0)
5507− needed = UINT_MAX;
5522+ atomic_read(&ei->i_prealloc_active));
55085523
55095524 repeat:
55105525 /* first, collect all pa's in the inode */
55115526 write_lock(&ei->i_prealloc_lock);
5512− for (iter = rb_first(&ei->i_prealloc_node); iter && needed;
5527+ for (iter = rb_first(&ei->i_prealloc_node); iter;
55135528 iter = rb_next(iter)) {
55145529 pa = rb_entry(iter, struct ext4_prealloc_space,
55155530 pa_node.inode_node);
@@ -5533,7 +5548,6 @@ repeat: · 17 unmodified lines
55335548 spin_unlock(&pa->pa_lock);
55345549 rb_erase(&pa->pa_node.inode_node, &ei->i_prealloc_node);
55355550 list_add(&pa->u.pa_tmp_list, &list);
5536− needed--;
55375551 continue;
55385552 }
55395553
@@ -5943,7 +5957,7 @@ static void ext4_mb_add_n_trim(struct ext4_allocation_context *ac) · 403 unmodified lines
59435957 /*
59445958 * release all resource we used in allocation
59455959 */
5946−static int ext4_mb_release_context(struct ext4_allocation_context *ac)
5960+static void ext4_mb_release_context(struct ext4_allocation_context *ac)
59475961 {
59485962 struct ext4_sb_info *sbi = EXT4_SB(ac->ac_sb);
59495963 struct ext4_prealloc_space *pa = ac->ac_pa;
@@ -5980,7 +5994,6 @@ static int ext4_mb_release_context(struct ext4_allocation_context *ac) · 30 unmodified lines
59805994 if (ac->ac_flags & EXT4_MB_HINT_GROUP_ALLOC)
59815995 mutex_unlock(&ac->ac_lg->lg_mutex);
59825996 ext4_mb_collect_stats(ac);
5983− return 0;
59845997 }
59855998
59865999 static int ext4_mb_discard_preallocations(struct super_block *sb, int needed)
@@ -6761,6 +6774,9 @@ __releases(ext4_group_lock_ptr(sb, e4b->bd_group)) · 774 unmodified lines
67616774 bool set_trimmed = false;
67626775 void *bitmap;
67636776
6777+ if (unlikely(EXT4_MB_GRP_BBITMAP_CORRUPT(e4b->bd_info)))
6778+ return 0;
6779+
67646780 last = ext4_last_grp_cluster(sb, e4b->bd_group);
67656781 bitmap = e4b->bd_bitmap;
67666782 if (start == 0 && max >= last)
fs/ext4/mballoc.h+0−1
@@ -192,7 +192,6 @@ struct ext4_allocation_context { · 191 unmodified lines
192192 */
193193 ext4_grpblk_t ac_orig_goal_len;
194194
195− __u32 ac_groups_considered;
196195 __u32 ac_flags; /* allocation hints */
197196 __u16 ac_groups_scanned;
198197 __u16 ac_groups_linear_remaining;
fs/ext4/move_extent.c+4−6
@@ -618,6 +618,7 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp, __u64 orig_blk, · 617 unmodified lines
618618 goto out;
619619 o_end = o_start + len;
620620
621+ *moved_len = 0;
621622 while (o_start < o_end) {
622623 struct ext4_extent *ex;
623624 ext4_lblk_t cur_blk, next_blk;
@@ -672,7 +673,7 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp, __u64 orig_blk, · 48 unmodified lines
672673 */
673674 ext4_double_up_write_data_sem(orig_inode, donor_inode);
674675 /* Swap original branches with new branches */
675− move_extent_per_page(o_filp, donor_inode,
676+ *moved_len += move_extent_per_page(o_filp, donor_inode,
676677 orig_page_index, donor_page_index,
677678 offset_in_page, cur_len,
678679 unwritten, &ret);
@@ -682,14 +683,11 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp, __u64 orig_blk, · 3 unmodified lines
682683 o_start += cur_len;
683684 d_start += cur_len;
684685 }
685− *moved_len = o_start - orig_blk;
686− if (*moved_len > len)
687− *moved_len = len;
688686
689687 out:
690688 if (*moved_len) {
691− ext4_discard_preallocations(orig_inode, 0);
692− ext4_discard_preallocations(donor_inode, 0);
689+ ext4_discard_preallocations(orig_inode);
690+ ext4_discard_preallocations(donor_inode);
693691 }
694692
695693 ext4_free_ext_path(path);
fs/ext4/super.c+1−1
@@ -1525,7 +1525,7 @@ void ext4_clear_inode(struct inode *inode) · 1524 unmodified lines
15251525 ext4_fc_del(inode);
15261526 invalidate_inode_buffers(inode);
15271527 clear_inode(inode);
1528− ext4_discard_preallocations(inode, 0);
1528+ ext4_discard_preallocations(inode);
15291529 ext4_es_remove_extent(inode, 0, EXT_MAX_BLOCKS);
15301530 dquot_drop(inode);
15311531 if (EXT4_I(inode)->jinode) {
fs/gfs2/dentry.c+9−14
@@ -32,25 +32,21 @@ · 31 unmodified lines
3232
3333 static int gfs2_drevalidate(struct dentry *dentry, unsigned int flags)
3434 {
35− struct dentry *parent = NULL;
35+ struct dentry *parent;
3636 struct gfs2_sbd *sdp;
3737 struct gfs2_inode *dip;
38− struct inode *dinode, *inode;
38+ struct inode *inode;
3939 struct gfs2_holder d_gh;
4040 struct gfs2_inode *ip = NULL;
4141 int error, valid = 0;
4242 int had_lock = 0;
4343
44− if (flags & LOOKUP_RCU) {
45− dinode = d_inode_rcu(READ_ONCE(dentry->d_parent));
46− if (!dinode)
47− return -ECHILD;
48− } else {
49− parent = dget_parent(dentry);
50− dinode = d_inode(parent);
51− }
52− sdp = GFS2_SB(dinode);
53− dip = GFS2_I(dinode);
44+ if (flags & LOOKUP_RCU)
45+ return -ECHILD;
46+
47+ parent = dget_parent(dentry);
48+ sdp = GFS2_SB(d_inode(parent));
49+ dip = GFS2_I(d_inode(parent));
5450 inode = d_inode(dentry);
5551
5652 if (inode) {
@@ -66,8 +62,7 @@ static int gfs2_drevalidate(struct dentry *dentry, unsigned int flags) · 9 unmodified lines
6662
6763 had_lock = (gfs2_glock_is_locked_by_me(dip->i_gl) != NULL);
6864 if (!had_lock) {
69− error = gfs2_glock_nq_init(dip->i_gl, LM_ST_SHARED,
70− flags & LOOKUP_RCU ? GL_NOBLOCK : 0, &d_gh);
65+ error = gfs2_glock_nq_init(dip->i_gl, LM_ST_SHARED, 0, &d_gh);
7166 if (error)
7267 goto out;
7368 }
fs/gfs2/inode.c+4−4
@@ -1882,10 +1882,10 @@ int gfs2_permission(struct mnt_idmap *idmap, struct inode *inode, · 1881 unmodified lines
18821882 WARN_ON_ONCE(!may_not_block);
18831883 return -ECHILD;
18841884 }
1885− if (gfs2_glock_is_locked_by_me(ip->i_gl) == NULL) {
1886− int noblock = may_not_block ? GL_NOBLOCK : 0;
1887− error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED,
1888− LM_FLAG_ANY | noblock, &i_gh);
1885+ if (gfs2_glock_is_locked_by_me(gl) == NULL) {
1886+ if (may_not_block)
1887+ return -ECHILD;
1888+ error = gfs2_glock_nq_init(gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh);
18891889 if (error)
18901890 return error;
18911891 }
fs/nfsd/nfs4state.c+5−6
@@ -4945,10 +4945,8 @@ nfsd_break_deleg_cb(struct file_lock *fl) · 4944 unmodified lines
49454945 */
49464946 fl->fl_break_time = 0;
49474947
4948− spin_lock(&fp->fi_lock);
49494948 fp->fi_had_conflict = true;
49504949 nfsd_break_one_deleg(dp);
4951− spin_unlock(&fp->fi_lock);
49524950 return false;
49534951 }
49544952
@@ -5557,12 +5555,13 @@ nfs4_set_delegation(struct nfsd4_open *open, struct nfs4_ol_stateid *stp, · 602 unmodified lines
55575555 if (status)
55585556 goto out_unlock;
55595557
5558+ status = -EAGAIN;
5559+ if (fp->fi_had_conflict)
5560+ goto out_unlock;
5561+
55605562 spin_lock(&state_lock);
55615563 spin_lock(&fp->fi_lock);
5562− if (fp->fi_had_conflict)
5563− status = -EAGAIN;
5564− else
5565− status = hash_delegation_locked(dp, fp);
5564+ status = hash_delegation_locked(dp, fp);
55665565 spin_unlock(&fp->fi_lock);
55675566 spin_unlock(&state_lock);
55685567
fs/smb/client/cifsglob.h+4−1
@@ -87,7 +87,7 @@ · 86 unmodified lines
8787 #define SMB_INTERFACE_POLL_INTERVAL 600
8888
8989 /* maximum number of PDUs in one compound */
90−#define MAX_COMPOUND 5
90+#define MAX_COMPOUND 7
9191
9292 /*
9393 * Default number of credits to keep available for SMB3.
@@ -1032,6 +1032,8 @@ struct cifs_chan { · 938 unmodified lines
10321032 __u8 signkey[SMB3_SIGN_KEY_SIZE];
10331033 };
10341034
1035+#define CIFS_SES_FLAG_SCALE_CHANNELS (0x1)
1036+
10351037 /*
10361038 * Session structure. One of these for each uid session with a particular host
10371039 */
@@ -1064,6 +1066,7 @@ struct cifs_ses { · 26 unmodified lines
10641066 enum securityEnum sectype; /* what security flavor was specified? */
10651067 bool sign; /* is signing required? */
10661068 bool domainAuto:1;
1069+ unsigned int flags;
10671070 __u16 session_flags;
10681071 __u8 smb3signingkey[SMB3_SIGN_KEY_SIZE];
10691072 __u8 smb3encryptionkey[SMB3_ENC_DEC_KEY_SIZE];
fs/smb/client/sess.c+6−0
@@ -75,6 +75,10 @@ cifs_ses_get_chan_index(struct cifs_ses *ses, · 74 unmodified lines
7575 {
7676 unsigned int i;
7777
78+ /* if the channel is waiting for termination */
79+ if (server->terminate)
80+ return CIFS_INVAL_CHAN_INDEX;
81+
7882 for (i = 0; i < ses->chan_count; i++) {
7983 if (ses->chans[i].server == server)
8084 return i;
@@ -269,6 +273,8 @@ int cifs_try_adding_channels(struct cifs_ses *ses) · 188 unmodified lines
269273 &iface->sockaddr,
270274 rc);
271275 kref_put(&iface->refcount, release_iface);
276+ /* failure to add chan should increase weight */
277+ iface->weight_fulfilled++;
272278 continue;
273279 }
274280
fs/smb/client/smb2pdu.c+19−5
@@ -178,6 +178,7 @@ cifs_chan_skip_or_disable(struct cifs_ses *ses, · 177 unmodified lines
178178 }
179179
180180 ses->chans[chan_index].server = NULL;
181+ server->terminate = true;
181182 spin_unlock(&ses->chan_lock);
182183
183184 /*
@@ -188,7 +189,6 @@ cifs_chan_skip_or_disable(struct cifs_ses *ses, · 4 unmodified lines
188189 */
189190 cifs_put_tcp_session(server, from_reconnect);
190191
191− server->terminate = true;
192192 cifs_signal_cifsd_for_reconnect(server, false);
193193
194194 /* mark primary server as needing reconnect */
@@ -399,6 +399,15 @@ skip_sess_setup: · 204 unmodified lines
399399 goto out;
400400 }
401401
402+ spin_lock(&ses->ses_lock);
403+ if (ses->flags & CIFS_SES_FLAG_SCALE_CHANNELS) {
404+ spin_unlock(&ses->ses_lock);
405+ mutex_unlock(&ses->session_mutex);
406+ goto skip_add_channels;
407+ }
408+ ses->flags |= CIFS_SES_FLAG_SCALE_CHANNELS;
409+ spin_unlock(&ses->ses_lock);
410+
402411 if (!rc &&
403412 (server->capabilities & SMB2_GLOBAL_CAP_MULTI_CHANNEL)) {
404413 mutex_unlock(&ses->session_mutex);
@@ -410,7 +419,7 @@ skip_sess_setup: · 5 unmodified lines
410419 rc = SMB3_request_interfaces(xid, tcon, false);
411420 free_xid(xid);
412421
413− if (rc == -EOPNOTSUPP) {
422+ if (rc == -EOPNOTSUPP && ses->chan_count > 1) {
414423 /*
415424 * some servers like Azure SMB server do not advertise
416425 * that multichannel has been disabled with server
@@ -428,17 +437,22 @@ skip_sess_setup: · 11 unmodified lines
428437 if (ses->chan_max > ses->chan_count &&
429438 ses->iface_count &&
430439 !SERVER_IS_CHAN(server)) {
431− if (ses->chan_count == 1)
440+ if (ses->chan_count == 1) {
432441 cifs_server_dbg(VFS, "supports multichannel now\n");
442+ queue_delayed_work(cifsiod_wq, &tcon->query_interfaces,
443+ (SMB_INTERFACE_POLL_INTERVAL * HZ));
444+ }
433445
434446 cifs_try_adding_channels(ses);
435− queue_delayed_work(cifsiod_wq, &tcon->query_interfaces,
436− (SMB_INTERFACE_POLL_INTERVAL * HZ));
437447 }
438448 } else {
439449 mutex_unlock(&ses->session_mutex);
440450 }
451+
441452 skip_add_channels:
453+ spin_lock(&ses->ses_lock);
454+ ses->flags &= ~CIFS_SES_FLAG_SCALE_CHANNELS;
455+ spin_unlock(&ses->ses_lock);
442456
443457 if (smb2_command != SMB2_INTERNAL_CMD)
444458 mod_delayed_work(cifsiod_wq, &server->reconnect, 0);
fs/smb/client/transport.c+2−2
@@ -435,8 +435,8 @@ smb_send_rqst(struct TCP_Server_Info *server, int num_rqst, · 434 unmodified lines
435435 if (!(flags & CIFS_TRANSFORM_REQ))
436436 return __smb_send_rqst(server, num_rqst, rqst);
437437
438− if (num_rqst > MAX_COMPOUND - 1)
439− return -ENOMEM;
438+ if (WARN_ON_ONCE(num_rqst > MAX_COMPOUND - 1))
439+ return -EIO;
440440
441441 if (!server->ops->init_transform_rq) {
442442 cifs_server_dbg(VFS, "Encryption requested but transform callback is missing\n");
fs/tracefs/event_inode.c+151−417
@@ -62,6 +62,46 @@ enum { · 61 unmodified lines
6262
6363 #define EVENTFS_MODE_MASK (EVENTFS_SAVE_MODE - 1)
6464
65+/*
66+ * eventfs_inode reference count management.
67+ *
68+ * NOTE! We count only references from dentries, in the
69+ * form 'dentry->d_fsdata'. There are also references from
70+ * directory inodes ('ti->private'), but the dentry reference
71+ * count is always a superset of the inode reference count.
72+ */
73+static void release_ei(struct kref *ref)
74+{
75+ struct eventfs_inode *ei = container_of(ref, struct eventfs_inode, kref);
76+
77+ WARN_ON_ONCE(!ei->is_freed);
78+
79+ kfree(ei->entry_attrs);
80+ kfree_const(ei->name);
81+ kfree_rcu(ei, rcu);
82+}
83+
84+static inline void put_ei(struct eventfs_inode *ei)
85+{
86+ if (ei)
87+ kref_put(&ei->kref, release_ei);
88+}
89+
90+static inline void free_ei(struct eventfs_inode *ei)
91+{
92+ if (ei) {
93+ ei->is_freed = 1;
94+ put_ei(ei);
95+ }
96+}
97+
98+static inline struct eventfs_inode *get_ei(struct eventfs_inode *ei)
99+{
100+ if (ei)
101+ kref_get(&ei->kref);
102+ return ei;
103+}
104+
65105 static struct dentry *eventfs_root_lookup(struct inode *dir,
66106 struct dentry *dentry,
67107 unsigned int flags);
@@ -156,33 +196,30 @@ static int eventfs_set_attr(struct mnt_idmap *idmap, struct dentry *dentry, · 88 unmodified lines
156196 return ret;
157197 }
158198
159−static void update_top_events_attr(struct eventfs_inode *ei, struct dentry *dentry)
199+static void update_top_events_attr(struct eventfs_inode *ei, struct super_block *sb)
160200 {
161− struct inode *inode;
201+ struct inode *root;
162202
163203 /* Only update if the "events" was on the top level */
164204 if (!ei || !(ei->attr.mode & EVENTFS_TOPLEVEL))
165205 return;
166206
167207 /* Get the tracefs root inode. */
168− inode = d_inode(dentry->d_sb->s_root);
169− ei->attr.uid = inode->i_uid;
170− ei->attr.gid = inode->i_gid;
208+ root = d_inode(sb->s_root);
209+ ei->attr.uid = root->i_uid;
210+ ei->attr.gid = root->i_gid;
171211 }
172212
173213 static void set_top_events_ownership(struct inode *inode)
174214 {
175215 struct tracefs_inode *ti = get_tracefs(inode);
176216 struct eventfs_inode *ei = ti->private;
177− struct dentry *dentry;
178217
179218 /* The top events directory doesn't get automatically updated */
180219 if (!ei || !ei->is_events || !(ei->attr.mode & EVENTFS_TOPLEVEL))
181220 return;
182221
183− dentry = ei->dentry;
184−
185− update_top_events_attr(ei, dentry);
222+ update_top_events_attr(ei, inode->i_sb);
186223
187224 if (!(ei->attr.mode & EVENTFS_SAVE_UID))
188225 inode->i_uid = ei->attr.uid;
@@ -233,10 +270,11 @@ static struct eventfs_inode *eventfs_find_events(struct dentry *dentry) · 44 unmodified lines
233270 {
234271 struct eventfs_inode *ei;
235272
236− mutex_lock(&eventfs_mutex);
237273 do {
238− /* The parent always has an ei, except for events itself */
239− ei = dentry->d_parent->d_fsdata;
274+ // The parent is stable because we do not do renames
275+ dentry = dentry->d_parent;
276+ // ... and directories always have d_fsdata
277+ ei = dentry->d_fsdata;
240278
241279 /*
242280 * If the ei is being freed, the ownership of the children
@@ -246,12 +284,10 @@ static struct eventfs_inode *eventfs_find_events(struct dentry *dentry) · 3 unmodified lines
246284 ei = NULL;
247285 break;
248286 }
249−
250− dentry = ei->dentry;
287+ // Walk upwards until you find the events inode
251288 } while (!ei->is_events);
252− mutex_unlock(&eventfs_mutex);
253289
254− update_top_events_attr(ei, dentry);
290+ update_top_events_attr(ei, dentry->d_sb);
255291
256292 return ei;
257293 }
@@ -282,11 +318,10 @@ static void update_inode_attr(struct dentry *dentry, struct inode *inode, · 24 unmodified lines
282318 }
283319
284320 /**
285− * create_file - create a file in the tracefs filesystem
286− * @name: the name of the file to create.
321+ * lookup_file - look up a file in the tracefs filesystem
322+ * @dentry: the dentry to look up
287323 * @mode: the permission that the file should have.
288324 * @attr: saved attributes changed by user
289− * @parent: parent dentry for this file.
290325 * @data: something that the caller will want to get to later on.
291326 * @fop: struct file_operations that should be used for this file.
292327 *
@@ -294,30 +329,25 @@ static void update_inode_attr(struct dentry *dentry, struct inode *inode, · 1 unmodified line
294329 * directory. The inode.i_private pointer will point to @data in the open()
295330 * call.
296331 */
297−static struct dentry *create_file(const char *name, umode_t mode,
332+static struct dentry *lookup_file(struct eventfs_inode *parent_ei,
333+ struct dentry *dentry,
334+ umode_t mode,
298335 struct eventfs_attr *attr,
299− struct dentry *parent, void *data,
336+ void *data,
300337 const struct file_operations *fop)
301338 {
302339 struct tracefs_inode *ti;
303− struct dentry *dentry;
304340 struct inode *inode;
305341
306342 if (!(mode & S_IFMT))
307343 mode |= S_IFREG;
308344
309345 if (WARN_ON_ONCE(!S_ISREG(mode)))
310− return NULL;
311−
312− WARN_ON_ONCE(!parent);
313− dentry = eventfs_start_creating(name, parent);
314−
315− if (IS_ERR(dentry))
316− return dentry;
346+ return ERR_PTR(-EIO);
317347
318348 inode = tracefs_get_inode(dentry->d_sb);
319349 if (unlikely(!inode))
320− return eventfs_failed_creating(dentry);
350+ return ERR_PTR(-ENOMEM);
321351
322352 /* If the user updated the directory's attributes, use them */
323353 update_inode_attr(dentry, inode, attr, mode);
@@ -331,32 +361,31 @@ static struct dentry *create_file(const char *name, umode_t mode, · 7 unmodified lines
331361
332362 ti = get_tracefs(inode);
333363 ti->flags |= TRACEFS_EVENT_INODE;
334− d_instantiate(dentry, inode);
335− fsnotify_create(dentry->d_parent->d_inode, dentry);
336− return eventfs_end_creating(dentry);
364+
365+ // Files have their parent's ei as their fsdata
366+ dentry->d_fsdata = get_ei(parent_ei);
367+
368+ d_add(dentry, inode);
369+ return NULL;
337370 };
338371
339372 /**
340− * create_dir - create a dir in the tracefs filesystem
373+ * lookup_dir_entry - look up a dir in the tracefs filesystem
374+ * @dentry: the directory to look up
341375 * @ei: the eventfs_inode that represents the directory to create
342− * @parent: parent dentry for this file.
343376 *
344− * This function will create a dentry for a directory represented by
377+ * This function will look up a dentry for a directory represented by
345378 * a eventfs_inode.
346379 */
347−static struct dentry *create_dir(struct eventfs_inode *ei, struct dentry *parent)
380+static struct dentry *lookup_dir_entry(struct dentry *dentry,
381+ struct eventfs_inode *pei, struct eventfs_inode *ei)
348382 {
349383 struct tracefs_inode *ti;
350− struct dentry *dentry;
351384 struct inode *inode;
352385
353− dentry = eventfs_start_creating(ei->name, parent);
354− if (IS_ERR(dentry))
355− return dentry;
356−
357386 inode = tracefs_get_inode(dentry->d_sb);
358387 if (unlikely(!inode))
359− return eventfs_failed_creating(dentry);
388+ return ERR_PTR(-ENOMEM);
360389
361390 /* If the user updated the directory's attributes, use them */
362391 update_inode_attr(dentry, inode, &ei->attr,
@@ -370,64 +399,46 @@ static struct dentry *create_dir(struct eventfs_inode *ei, struct dentry *parent · 7 unmodified lines
370399
371400 ti = get_tracefs(inode);
372401 ti->flags |= TRACEFS_EVENT_INODE;
402+ /* Only directories have ti->private set to an ei, not files */
403+ ti->private = ei;
373404
374− inc_nlink(inode);
375− d_instantiate(dentry, inode);
376− inc_nlink(dentry->d_parent->d_inode);
377− fsnotify_mkdir(dentry->d_parent->d_inode, dentry);
378− return eventfs_end_creating(dentry);
405+ dentry->d_fsdata = get_ei(ei);
406+
407+ d_add(dentry, inode);
408+ return NULL;
379409 }
380410
381−static void free_ei(struct eventfs_inode *ei)
411+static inline struct eventfs_inode *alloc_ei(const char *name)
382412 {
383− kfree_const(ei->name);
384− kfree(ei->d_children);
385− kfree(ei->entry_attrs);
386− kfree(ei);
413+ struct eventfs_inode *ei = kzalloc(sizeof(*ei), GFP_KERNEL);
414+
415+ if (!ei)
416+ return NULL;
417+
418+ ei->name = kstrdup_const(name, GFP_KERNEL);
419+ if (!ei->name) {
420+ kfree(ei);
421+ return NULL;
422+ }
423+ kref_init(&ei->kref);
424+ return ei;
387425 }
388426
389427 /**
390− * eventfs_set_ei_status_free - remove the dentry reference from an eventfs_inode
391− * @ti: the tracefs_inode of the dentry
428+ * eventfs_d_release - dentry is going away
392429 * @dentry: dentry which has the reference to remove.
393430 *
394431 * Remove the association between a dentry from an eventfs_inode.
395432 */
396−void eventfs_set_ei_status_free(struct tracefs_inode *ti, struct dentry *dentry)
433+void eventfs_d_release(struct dentry *dentry)
397434 {
398− struct eventfs_inode *ei;
399− int i;
400−
401− mutex_lock(&eventfs_mutex);
402−
403− ei = dentry->d_fsdata;
404− if (!ei)
405− goto out;
406−
407− /* This could belong to one of the files of the ei */
408− if (ei->dentry != dentry) {
409− for (i = 0; i < ei->nr_entries; i++) {
410− if (ei->d_children[i] == dentry)
411− break;
412− }
413− if (WARN_ON_ONCE(i == ei->nr_entries))
414− goto out;
415− ei->d_children[i] = NULL;
416− } else if (ei->is_freed) {
417− free_ei(ei);
418− } else {
419− ei->dentry = NULL;
420− }
421−
422− dentry->d_fsdata = NULL;
423− out:
424− mutex_unlock(&eventfs_mutex);
435+ put_ei(dentry->d_fsdata);
425436 }
426437
427438 /**
428− * create_file_dentry - create a dentry for a file of an eventfs_inode
439+ * lookup_file_dentry - create a dentry for a file of an eventfs_inode
429440 * @ei: the eventfs_inode that the file will be created under
430− * @idx: the index into the d_children[] of the @ei
441+ * @idx: the index into the entry_attrs[] of the @ei
431442 * @parent: The parent dentry of the created file.
432443 * @name: The name of the file to create
433444 * @mode: The mode of the file.
@@ -438,163 +449,17 @@ void eventfs_set_ei_status_free(struct tracefs_inode *ti, struct dentry *dentry) · 4 unmodified lines
438449 * address located at @e_dentry.
439450 */
440451 static struct dentry *
441−create_file_dentry(struct eventfs_inode *ei, int idx,
442− struct dentry *parent, const char *name, umode_t mode, void *data,
452+lookup_file_dentry(struct dentry *dentry,
453+ struct eventfs_inode *ei, int idx,
454+ umode_t mode, void *data,
443455 const struct file_operations *fops)
444456 {
445457 struct eventfs_attr *attr = NULL;
446− struct dentry **e_dentry = &ei->d_children[idx];
447− struct dentry *dentry;
448−
449− WARN_ON_ONCE(!inode_is_locked(parent->d_inode));
450458
451− mutex_lock(&eventfs_mutex);
452− if (ei->is_freed) {
453− mutex_unlock(&eventfs_mutex);
454− return NULL;
455− }
456− /* If the e_dentry already has a dentry, use it */
457− if (*e_dentry) {
458− dget(*e_dentry);
459− mutex_unlock(&eventfs_mutex);
460− return *e_dentry;
461− }
462−
463− /* ei->entry_attrs are protected by SRCU */
464459 if (ei->entry_attrs)
465460 attr = &ei->entry_attrs[idx];
466461
467− mutex_unlock(&eventfs_mutex);
468−
469− dentry = create_file(name, mode, attr, parent, data, fops);
470−
471− mutex_lock(&eventfs_mutex);
472−
473− if (IS_ERR_OR_NULL(dentry)) {
474− /*
475− * When the mutex was released, something else could have
476− * created the dentry for this e_dentry. In which case
477− * use that one.
478− *
479− * If ei->is_freed is set, the e_dentry is currently on its
480− * way to being freed, don't return it. If e_dentry is NULL
481− * it means it was already freed.
482− */
483− if (ei->is_freed) {
484− dentry = NULL;
485− } else {
486− dentry = *e_dentry;
487− dget(dentry);
488− }
489− mutex_unlock(&eventfs_mutex);
490− return dentry;
491− }
492−
493− if (!*e_dentry && !ei->is_freed) {
494− *e_dentry = dentry;
495− dentry->d_fsdata = ei;
496− } else {
497− /*
498− * Should never happen unless we get here due to being freed.
499− * Otherwise it means two dentries exist with the same name.
500− */
501− WARN_ON_ONCE(!ei->is_freed);
502− dentry = NULL;
503− }
504− mutex_unlock(&eventfs_mutex);
505−
506− return dentry;
507−}
508−
509−/**
510− * eventfs_post_create_dir - post create dir routine
511− * @ei: eventfs_inode of recently created dir
512− *
513− * Map the meta-data of files within an eventfs dir to their parent dentry
514− */
515−static void eventfs_post_create_dir(struct eventfs_inode *ei)
516−{
517− struct eventfs_inode *ei_child;
518− struct tracefs_inode *ti;
519−
520− lockdep_assert_held(&eventfs_mutex);
521−
522− /* srcu lock already held */
523− /* fill parent-child relation */
524− list_for_each_entry_srcu(ei_child, &ei->children, list,
525− srcu_read_lock_held(&eventfs_srcu)) {
526− ei_child->d_parent = ei->dentry;
527− }
528−
529− ti = get_tracefs(ei->dentry->d_inode);
530− ti->private = ei;
531−}
532−
533−/**
534− * create_dir_dentry - Create a directory dentry for the eventfs_inode
535− * @pei: The eventfs_inode parent of ei.
536− * @ei: The eventfs_inode to create the directory for
537− * @parent: The dentry of the parent of this directory
538− *
539− * This creates and attaches a directory dentry to the eventfs_inode @ei.
540− */
541−static struct dentry *
542−create_dir_dentry(struct eventfs_inode *pei, struct eventfs_inode *ei,
543− struct dentry *parent)
544−{
545− struct dentry *dentry = NULL;
546−
547− WARN_ON_ONCE(!inode_is_locked(parent->d_inode));
548−
549− mutex_lock(&eventfs_mutex);
550− if (pei->is_freed || ei->is_freed) {
551− mutex_unlock(&eventfs_mutex);
552− return NULL;
553− }
554− if (ei->dentry) {
555− /* If the eventfs_inode already has a dentry, use it */
556− dentry = ei->dentry;
557− dget(dentry);
558− mutex_unlock(&eventfs_mutex);
559− return dentry;
560− }
561− mutex_unlock(&eventfs_mutex);
562−
563− dentry = create_dir(ei, parent);
564−
565− mutex_lock(&eventfs_mutex);
566−
567− if (IS_ERR_OR_NULL(dentry) && !ei->is_freed) {
568− /*
569− * When the mutex was released, something else could have
570− * created the dentry for this e_dentry. In which case
571− * use that one.
572− *
573− * If ei->is_freed is set, the e_dentry is currently on its
574− * way to being freed.
575− */
576− dentry = ei->dentry;
577− if (dentry)
578− dget(dentry);
579− mutex_unlock(&eventfs_mutex);
580− return dentry;
581− }
582−
583− if (!ei->dentry && !ei->is_freed) {
584− ei->dentry = dentry;
585− eventfs_post_create_dir(ei);
586− dentry->d_fsdata = ei;
587− } else {
588− /*
589− * Should never happen unless we get here due to being freed.
590− * Otherwise it means two dentries exist with the same name.
591− */
592− WARN_ON_ONCE(!ei->is_freed);
593− dentry = NULL;
594− }
595− mutex_unlock(&eventfs_mutex);
596−
597− return dentry;
462+ return lookup_file(ei, dentry, mode, attr, data, fops);
598463 }
599464
600465 /**
@@ -611,79 +476,50 @@ static struct dentry *eventfs_root_lookup(struct inode *dir, · 10 unmodified lines
611476 struct dentry *dentry,
612477 unsigned int flags)
613478 {
614− const struct file_operations *fops;
615− const struct eventfs_entry *entry;
616479 struct eventfs_inode *ei_child;
617480 struct tracefs_inode *ti;
618481 struct eventfs_inode *ei;
619− struct dentry *ei_dentry = NULL;
620− struct dentry *ret = NULL;
621− struct dentry *d;
622482 const char *name = dentry->d_name.name;
623− umode_t mode;
624− void *data;
625− int idx;
626− int i;
627− int r;
483+ struct dentry *result = NULL;
628484
629485 ti = get_tracefs(dir);
630486 if (!(ti->flags & TRACEFS_EVENT_INODE))
631− return NULL;
487+ return ERR_PTR(-EIO);
632488
633− /* Grab srcu to prevent the ei from going away */
634− idx = srcu_read_lock(&eventfs_srcu);
635−
636− /*
637− * Grab the eventfs_mutex to consistent value from ti->private.
638− * This s
639− */
640489 mutex_lock(&eventfs_mutex);
641− ei = READ_ONCE(ti->private);
642− if (ei && !ei->is_freed)
643− ei_dentry = READ_ONCE(ei->dentry);
644− mutex_unlock(&eventfs_mutex);
645490
646− if (!ei || !ei_dentry)
491+ ei = ti->private;
492+ if (!ei || ei->is_freed)
647493 goto out;
648494
649− data = ei->data;
650−
651− list_for_each_entry_srcu(ei_child, &ei->children, list,
652− srcu_read_lock_held(&eventfs_srcu)) {
495+ list_for_each_entry(ei_child, &ei->children, list) {
653496 if (strcmp(ei_child->name, name) != 0)
654497 continue;
655− ret = simple_lookup(dir, dentry, flags);
656− if (IS_ERR(ret))
498+ if (ei_child->is_freed)
657499 goto out;
658− d = create_dir_dentry(ei, ei_child, ei_dentry);
659− dput(d);
500+ result = lookup_dir_entry(dentry, ei, ei_child);
660501 goto out;
661502 }
662503
663− for (i = 0; i < ei->nr_entries; i++) {
664− entry = &ei->entries[i];
665− if (strcmp(name, entry->name) == 0) {
666− void *cdata = data;
667− mutex_lock(&eventfs_mutex);
668− /* If ei->is_freed, then the event itself may be too */
669− if (!ei->is_freed)
670− r = entry->callback(name, &mode, &cdata, &fops);
671− else
672− r = -1;
673− mutex_unlock(&eventfs_mutex);
674− if (r <= 0)
675− continue;
676− ret = simple_lookup(dir, dentry, flags);
677− if (IS_ERR(ret))
678− goto out;
679− d = create_file_dentry(ei, i, ei_dentry, name, mode, cdata, fops);
680− dput(d);
681− break;
682− }
504+ for (int i = 0; i < ei->nr_entries; i++) {
505+ void *data;
506+ umode_t mode;
507+ const struct file_operations *fops;
508+ const struct eventfs_entry *entry = &ei->entries[i];
509+
510+ if (strcmp(name, entry->name) != 0)
511+ continue;
512+
513+ data = ei->data;
514+ if (entry->callback(name, &mode, &data, &fops) <= 0)
515+ goto out;
516+
517+ result = lookup_file_dentry(dentry, ei, i, mode, data, fops);
518+ goto out;
683519 }
684520 out:
685− srcu_read_unlock(&eventfs_srcu, idx);
686− return ret;
521+ mutex_unlock(&eventfs_mutex);
522+ return result;
687523 }
688524
689525 /*
@@ -833,25 +669,10 @@ struct eventfs_inode *eventfs_create_dir(const char *name, struct eventfs_inode · 143 unmodified lines
833669 if (!parent)
834670 return ERR_PTR(-EINVAL);
835671
836− ei = kzalloc(sizeof(*ei), GFP_KERNEL);
672+ ei = alloc_ei(name);
837673 if (!ei)
838674 return ERR_PTR(-ENOMEM);
839675
840− ei->name = kstrdup_const(name, GFP_KERNEL);
841− if (!ei->name) {
842− kfree(ei);
843− return ERR_PTR(-ENOMEM);
844− }
845−
846− if (size) {
847− ei->d_children = kcalloc(size, sizeof(*ei->d_children), GFP_KERNEL);
848− if (!ei->d_children) {
849− kfree_const(ei->name);
850− kfree(ei);
851− return ERR_PTR(-ENOMEM);
852− }
853− }
854−
855676 ei->entries = entries;
856677 ei->nr_entries = size;
857678 ei->data = data;
@@ -859,10 +680,8 @@ struct eventfs_inode *eventfs_create_dir(const char *name, struct eventfs_inode · 1 unmodified line
859680 INIT_LIST_HEAD(&ei->list);
860681
861682 mutex_lock(&eventfs_mutex);
862− if (!parent->is_freed) {
683+ if (!parent->is_freed)
863684 list_add_tail(&ei->list, &parent->children);
864− ei->d_parent = parent->dentry;
865− }
866685 mutex_unlock(&eventfs_mutex);
867686
868687 /* Was the parent freed? */
@@ -902,28 +721,20 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry · 33 unmodified lines
902721 if (IS_ERR(dentry))
903722 return ERR_CAST(dentry);
904723
905− ei = kzalloc(sizeof(*ei), GFP_KERNEL);
724+ ei = alloc_ei(name);
906725 if (!ei)
907− goto fail_ei;
726+ goto fail;
908727
909728 inode = tracefs_get_inode(dentry->d_sb);
910729 if (unlikely(!inode))
911730 goto fail;
912731
913− if (size) {
914− ei->d_children = kcalloc(size, sizeof(*ei->d_children), GFP_KERNEL);
915− if (!ei->d_children)
916− goto fail;
917− }
918−
919− ei->dentry = dentry;
732+ // Note: we have a ref to the dentry from tracefs_start_creating()
733+ ei->events_dir = dentry;
920734 ei->entries = entries;
921735 ei->nr_entries = size;
922736 ei->is_events = 1;
923737 ei->data = data;
924− ei->name = kstrdup_const(name, GFP_KERNEL);
925− if (!ei->name)
926− goto fail;
927738
928739 /* Save the ownership of this directory */
929740 uid = d_inode(dentry->d_parent)->i_uid;
@@ -954,11 +765,19 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry · 24 unmodified lines
954765 inode->i_op = &eventfs_root_dir_inode_operations;
955766 inode->i_fop = &eventfs_file_operations;
956767
957− dentry->d_fsdata = ei;
768+ dentry->d_fsdata = get_ei(ei);
958769
959− /* directory inodes start off with i_nlink == 2 (for "." entry) */
960− inc_nlink(inode);
770+ /*
771+ * Keep all eventfs directories with i_nlink == 1.
772+ * Due to the dynamic nature of the dentry creations and not
773+ * wanting to add a pointer to the parent eventfs_inode in the
774+ * eventfs_inode structure, keeping the i_nlink in sync with the
775+ * number of directories would cause too much complexity for
776+ * something not worth much. Keeping directory links at 1
777+ * tells userspace not to trust the link number.
778+ */
961779 d_instantiate(dentry, inode);
780+ /* The dentry of the "events" parent does keep track though */
962781 inc_nlink(dentry->d_parent->d_inode);
963782 fsnotify_mkdir(dentry->d_parent->d_inode, dentry);
964783 tracefs_end_creating(dentry);
@@ -966,72 +785,11 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry · 1 unmodified line
966785 return ei;
967786
968787 fail:
969− kfree(ei->d_children);
970− kfree(ei);
971− fail_ei:
788+ free_ei(ei);
972789 tracefs_failed_creating(dentry);
973790 return ERR_PTR(-ENOMEM);
974791 }
975792
976−static LLIST_HEAD(free_list);
977−
978−static void eventfs_workfn(struct work_struct *work)
979−{
980− struct eventfs_inode *ei, *tmp;
981− struct llist_node *llnode;
982−
983− llnode = llist_del_all(&free_list);
984− llist_for_each_entry_safe(ei, tmp, llnode, llist) {
985− /* This dput() matches the dget() from unhook_dentry() */
986− for (int i = 0; i < ei->nr_entries; i++) {
987− if (ei->d_children[i])
988− dput(ei->d_children[i]);
989− }
990− /* This should only get here if it had a dentry */
991− if (!WARN_ON_ONCE(!ei->dentry))
992− dput(ei->dentry);
993− }
994−}
995−
996−static DECLARE_WORK(eventfs_work, eventfs_workfn);
997−
998−static void free_rcu_ei(struct rcu_head *head)
999−{
1000− struct eventfs_inode *ei = container_of(head, struct eventfs_inode, rcu);
1001−
1002− if (ei->dentry) {
1003− /* Do not free the ei until all references of dentry are gone */
1004− if (llist_add(&ei->llist, &free_list))
1005− queue_work(system_unbound_wq, &eventfs_work);
1006− return;
1007− }
1008−
1009− /* If the ei doesn't have a dentry, neither should its children */
1010− for (int i = 0; i < ei->nr_entries; i++) {
1011− WARN_ON_ONCE(ei->d_children[i]);
1012− }
1013−
1014− free_ei(ei);
1015−}
1016−
1017−static void unhook_dentry(struct dentry *dentry)
1018−{
1019− if (!dentry)
1020− return;
1021− /*
1022− * Need to add a reference to the dentry that is expected by
1023− * simple_recursive_removal(), which will include a dput().
1024− */
1025− dget(dentry);
1026−
1027− /*
1028− * Also add a reference for the dput() in eventfs_workfn().
1029− * That is required as that dput() will free the ei after
1030− * the SRCU grace period is over.
1031− */
1032− dget(dentry);
1033−}
1034−
1035793 /**
1036794 * eventfs_remove_rec - remove eventfs dir or file from list
1037795 * @ei: eventfs_inode to be removed.
@@ -1044,8 +802,6 @@ static void eventfs_remove_rec(struct eventfs_inode *ei, int level) · 6 unmodified lines
1044802 {
1045803 struct eventfs_inode *ei_child;
1046804
1047− if (!ei)
1048− return;
1049805 /*
1050806 * Check recursion depth. It should never be greater than 3:
1051807 * 0 - events/
@@ -1057,28 +813,11 @@ static void eventfs_remove_rec(struct eventfs_inode *ei, int level) · 5 unmodified lines
1057813 return;
1058814
1059815 /* search for nested folders or files */
1060− list_for_each_entry_srcu(ei_child, &ei->children, list,
1061− lockdep_is_held(&eventfs_mutex)) {
1062− /* Children only have dentry if parent does */
1063− WARN_ON_ONCE(ei_child->dentry && !ei->dentry);
816+ list_for_each_entry(ei_child, &ei->children, list)
1064817 eventfs_remove_rec(ei_child, level + 1);
1065− }
1066−
1067818
1068− ei->is_freed = 1;
1069−
1070− for (int i = 0; i < ei->nr_entries; i++) {
1071− if (ei->d_children[i]) {
1072− /* Children only have dentry if parent does */
1073− WARN_ON_ONCE(!ei->dentry);
1074− unhook_dentry(ei->d_children[i]);
1075− }
1076− }
1077−
1078− unhook_dentry(ei->dentry);
1079−
1080− list_del_rcu(&ei->list);
1081− call_srcu(&eventfs_srcu, &ei->rcu, free_rcu_ei);
819+ list_del(&ei->list);
820+ free_ei(ei);
1082821 }
1083822
1084823 /**
@@ -1089,22 +828,12 @@ static void eventfs_remove_rec(struct eventfs_inode *ei, int level) · 4 unmodified lines
1089828 */
1090829 void eventfs_remove_dir(struct eventfs_inode *ei)
1091830 {
1092− struct dentry *dentry;
1093−
1094831 if (!ei)
1095832 return;
1096833
1097834 mutex_lock(&eventfs_mutex);
1098− dentry = ei->dentry;
1099835 eventfs_remove_rec(ei, 0);
1100836 mutex_unlock(&eventfs_mutex);
1101−
1102− /*
1103− * If any of the ei children has a dentry, then the ei itself
1104− * must have a dentry.
1105− */
1106− if (dentry)
1107− simple_recursive_removal(dentry, NULL);
1108837 }
1109838
1110839 /**
@@ -1117,7 +846,11 @@ void eventfs_remove_events_dir(struct eventfs_inode *ei) · 6 unmodified lines
1117846 {
1118847 struct dentry *dentry;
1119848
1120− dentry = ei->dentry;
849+ dentry = ei->events_dir;
850+ if (!dentry)
851+ return;
852+
853+ ei->events_dir = NULL;
1121854 eventfs_remove_dir(ei);
1122855
1123856 /*
@@ -1127,5 +860,6 @@ void eventfs_remove_events_dir(struct eventfs_inode *ei) · 3 unmodified lines
1127860 * sticks around while the other ei->dentry are created
1128861 * and destroyed dynamically.
1129862 */
863+ d_invalidate(dentry);
1130864 dput(dentry);
1131865 }
fs/tracefs/inode.c+22−80
@@ -38,8 +38,6 @@ static struct inode *tracefs_alloc_inode(struct super_block *sb) · 37 unmodified lines
3838 if (!ti)
3939 return NULL;
4040
41− ti->flags = 0;
42−
4341 return &ti->vfs_inode;
4442 }
4543
@@ -379,21 +377,30 @@ static const struct super_operations tracefs_super_operations = { · 333 unmodified lines
379377 .show_options = tracefs_show_options,
380378 };
381379
382−static void tracefs_dentry_iput(struct dentry *dentry, struct inode *inode)
380+/*
381+ * It would be cleaner if eventfs had its own dentry ops.
382+ *
383+ * Note that d_revalidate is called potentially under RCU,
384+ * so it can't take the eventfs mutex etc. It's fine - if
385+ * we open a file just as it's marked dead, things will
386+ * still work just fine, and just see the old stale case.
387+ */
388+static void tracefs_d_release(struct dentry *dentry)
383389 {
384− struct tracefs_inode *ti;
390+ if (dentry->d_fsdata)
391+ eventfs_d_release(dentry);
392+}
385393
386− if (!dentry || !inode)
387− return;
394+static int tracefs_d_revalidate(struct dentry *dentry, unsigned int flags)
395+{
396+ struct eventfs_inode *ei = dentry->d_fsdata;
388397
389− ti = get_tracefs(inode);
390− if (ti && ti->flags & TRACEFS_EVENT_INODE)
391− eventfs_set_ei_status_free(ti, dentry);
392− iput(inode);
398+ return !(ei && ei->is_freed);
393399 }
394400
395401 static const struct dentry_operations tracefs_dentry_operations = {
396− .d_iput = tracefs_dentry_iput,
402+ .d_revalidate = tracefs_d_revalidate,
403+ .d_release = tracefs_d_release,
397404 };
398405
399406 static int trace_fill_super(struct super_block *sb, void *data, int silent)
@@ -497,75 +504,6 @@ struct dentry *tracefs_end_creating(struct dentry *dentry) · 97 unmodified lines
497504 return dentry;
498505 }
499506
500−/**
501− * eventfs_start_creating - start the process of creating a dentry
502− * @name: Name of the file created for the dentry
503− * @parent: The parent dentry where this dentry will be created
504− *
505− * This is a simple helper function for the dynamically created eventfs
506− * files. When the directory of the eventfs files are accessed, their
507− * dentries are created on the fly. This function is used to start that
508− * process.
509− */
510−struct dentry *eventfs_start_creating(const char *name, struct dentry *parent)
511−{
512− struct dentry *dentry;
513− int error;
514−
515− /* Must always have a parent. */
516− if (WARN_ON_ONCE(!parent))
517− return ERR_PTR(-EINVAL);
518−
519− error = simple_pin_fs(&trace_fs_type, &tracefs_mount,
520− &tracefs_mount_count);
521− if (error)
522− return ERR_PTR(error);
523−
524− if (unlikely(IS_DEADDIR(parent->d_inode)))
525− dentry = ERR_PTR(-ENOENT);
526− else
527− dentry = lookup_one_len(name, parent, strlen(name));
528−
529− if (!IS_ERR(dentry) && dentry->d_inode) {
530− dput(dentry);
531− dentry = ERR_PTR(-EEXIST);
532− }
533−
534− if (IS_ERR(dentry))
535− simple_release_fs(&tracefs_mount, &tracefs_mount_count);
536−
537− return dentry;
538−}
539−
540−/**
541− * eventfs_failed_creating - clean up a failed eventfs dentry creation
542− * @dentry: The dentry to clean up
543− *
544− * If after calling eventfs_start_creating(), a failure is detected, the
545− * resources created by eventfs_start_creating() needs to be cleaned up. In
546− * that case, this function should be called to perform that clean up.
547− */
548−struct dentry *eventfs_failed_creating(struct dentry *dentry)
549−{
550− dput(dentry);
551− simple_release_fs(&tracefs_mount, &tracefs_mount_count);
552− return NULL;
553−}
554−
555−/**
556− * eventfs_end_creating - Finish the process of creating a eventfs dentry
557− * @dentry: The dentry that has successfully been created.
558− *
559− * This function is currently just a place holder to match
560− * eventfs_start_creating(). In case any synchronization needs to be added,
561− * this function will be used to implement that without having to modify
562− * the callers of eventfs_start_creating().
563− */
564−struct dentry *eventfs_end_creating(struct dentry *dentry)
565−{
566− return dentry;
567−}
568−
569507 /* Find the inode that this will use for default */
570508 static struct inode *instance_inode(struct dentry *parent, struct inode *inode)
571509 {
@@ -779,7 +717,11 @@ static void init_once(void *foo) · 207 unmodified lines
779717 {
780718 struct tracefs_inode *ti = (struct tracefs_inode *) foo;
781719
720+ /* inode_init_once() calls memset() on the vfs_inode portion */
782721 inode_init_once(&ti->vfs_inode);
722+
723+ /* Zero out the rest */
724+ memset_after(ti, 0, vfs_inode);
783725 }
784726
785727 static int __init tracefs_init(void)
fs/tracefs/internal.h+18−25
@@ -11,9 +11,10 @@ enum { · 10 unmodified lines
1111 };
1212
1313 struct tracefs_inode {
14+ struct inode vfs_inode;
15+ /* The below gets initialized with memset_after(ti, 0, vfs_inode) */
1416 unsigned long flags;
1517 void *private;
16− struct inode vfs_inode;
1718 };
1819
1920 /*
@@ -31,43 +32,37 @@ struct eventfs_attr { · 11 unmodified lines
3132 /*
3233 * struct eventfs_inode - hold the properties of the eventfs directories.
3334 * @list: link list into the parent directory
35+ * @rcu: Union with @list for freeing
36+ * @children: link list into the child eventfs_inode
3437 * @entries: the array of entries representing the files in the directory
3538 * @name: the name of the directory to create
36− * @children: link list into the child eventfs_inode
37− * @dentry: the dentry of the directory
38− * @d_parent: pointer to the parent's dentry
39− * @d_children: The array of dentries to represent the files when created
39+ * @events_dir: the dentry of the events directory
4040 * @entry_attrs: Saved mode and ownership of the @d_children
41− * @attr: Saved mode and ownership of eventfs_inode itself
4241 * @data: The private data to pass to the callbacks
42+ * @attr: Saved mode and ownership of eventfs_inode itself
4343 * @is_freed: Flag set if the eventfs is on its way to be freed
4444 * Note if is_freed is set, then dentry is corrupted.
45+ * @is_events: Flag set for only the top level "events" directory
4546 * @nr_entries: The number of items in @entries
47+ * @ino: The saved inode number
4648 */
4749 struct eventfs_inode {
48− struct list_head list;
50+ union {
51+ struct list_head list;
52+ struct rcu_head rcu;
53+ };
54+ struct list_head children;
4955 const struct eventfs_entry *entries;
5056 const char *name;
51− struct list_head children;
52− struct dentry *dentry; /* Check is_freed to access */
53− struct dentry *d_parent;
54− struct dentry **d_children;
57+ struct dentry *events_dir;
5558 struct eventfs_attr *entry_attrs;
56− struct eventfs_attr attr;
5759 void *data;
60+ struct eventfs_attr attr;
61+ struct kref kref;
5862 unsigned int is_freed:1;
5963 unsigned int is_events:1;
6064 unsigned int nr_entries:30;
6165 unsigned int ino;
62− /*
63− * Union - used for deletion
64− * @llist: for calling dput() if needed after RCU
65− * @rcu: eventfs_inode to delete in RCU
66− */
67− union {
68− struct llist_node llist;
69− struct rcu_head rcu;
70− };
7166 };
7267
7368 static inline struct tracefs_inode *get_tracefs(const struct inode *inode)
@@ -79,9 +74,7 @@ struct dentry *tracefs_start_creating(const char *name, struct dentry *parent); · 5 unmodified lines
7974 struct dentry *tracefs_end_creating(struct dentry *dentry);
8075 struct dentry *tracefs_failed_creating(struct dentry *dentry);
8176 struct inode *tracefs_get_inode(struct super_block *sb);
82−struct dentry *eventfs_start_creating(const char *name, struct dentry *parent);
83−struct dentry *eventfs_failed_creating(struct dentry *dentry);
84−struct dentry *eventfs_end_creating(struct dentry *dentry);
85−void eventfs_set_ei_status_free(struct tracefs_inode *ti, struct dentry *dentry);
77+
78+void eventfs_d_release(struct dentry *dentry);
8679
8780 #endif /* _TRACEFS_INTERNAL_H */
fs/xfs/libxfs/xfs_attr.c+3−3
@@ -421,10 +421,10 @@ xfs_attr_complete_op( · 420 unmodified lines
421421 bool do_replace = args->op_flags & XFS_DA_OP_REPLACE;
422422
423423 args->op_flags &= ~XFS_DA_OP_REPLACE;
424− if (do_replace) {
425− args->attr_filter &= ~XFS_ATTR_INCOMPLETE;
424+ args->attr_filter &= ~XFS_ATTR_INCOMPLETE;
425+ if (do_replace)
426426 return replace_state;
427− }
427+
428428 return XFS_DAS_DONE;
429429 }
430430
fs/xfs/libxfs/xfs_rtbitmap.c+0−14
@@ -1118,20 +1118,6 @@ xfs_rtbitmap_blockcount( · 1117 unmodified lines
11181118 return howmany_64(rtextents, NBBY * mp->m_sb.sb_blocksize);
11191119 }
11201120
1121−/*
1122− * Compute the maximum level number of the realtime summary file, as defined by
1123− * mkfs. The historic use of highbit32 on a 64-bit quantity prohibited correct
1124− * use of rt volumes with more than 2^32 extents.
1125− */
1126−uint8_t
1127−xfs_compute_rextslog(
1128− xfs_rtbxlen_t rtextents)
1129−{
1130− if (!rtextents)
1131− return 0;
1132− return xfs_highbit64(rtextents);
1133−}
1134−
11351121 /*
11361122 * Compute the number of rtbitmap words needed to populate every block of a
11371123 * bitmap that is large enough to track the given number of rt extents.
fs/xfs/libxfs/xfs_rtbitmap.h+0−16
@@ -351,20 +351,6 @@ xfs_rtfree_extent( · 350 unmodified lines
351351 int xfs_rtfree_blocks(struct xfs_trans *tp, xfs_fsblock_t rtbno,
352352 xfs_filblks_t rtlen);
353353
354−uint8_t xfs_compute_rextslog(xfs_rtbxlen_t rtextents);
355−
356−/* Do we support an rt volume having this number of rtextents? */
357−static inline bool
358−xfs_validate_rtextents(
359− xfs_rtbxlen_t rtextents)
360−{
361− /* No runt rt volumes */
362− if (rtextents == 0)
363− return false;
364−
365− return true;
366−}
367−
368354 xfs_filblks_t xfs_rtbitmap_blockcount(struct xfs_mount *mp, xfs_rtbxlen_t
369355 rtextents);
370356 unsigned long long xfs_rtbitmap_wordcount(struct xfs_mount *mp,
@@ -383,8 +369,6 @@ unsigned long long xfs_rtsummary_wordcount(struct xfs_mount *mp, · 12 unmodified lines
383369 # define xfs_rtsummary_read_buf(a,b) (-ENOSYS)
384370 # define xfs_rtbuf_cache_relse(a) (0)
385371 # define xfs_rtalloc_extent_is_free(m,t,s,l,i) (-ENOSYS)
386−# define xfs_compute_rextslog(rtx) (0)
387−# define xfs_validate_rtextents(rtx) (false)
388372 static inline xfs_filblks_t
389373 xfs_rtbitmap_blockcount(struct xfs_mount *mp, xfs_rtbxlen_t rtextents)
390374 {
fs/xfs/libxfs/xfs_sb.c+14−0
@@ -1377,3 +1377,17 @@ xfs_validate_stripe_geometry( · 1376 unmodified lines
13771377 }
13781378 return true;
13791379 }
1380+
1381+/*
1382+ * Compute the maximum level number of the realtime summary file, as defined by
1383+ * mkfs. The historic use of highbit32 on a 64-bit quantity prohibited correct
1384+ * use of rt volumes with more than 2^32 extents.
1385+ */
1386+uint8_t
1387+xfs_compute_rextslog(
1388+ xfs_rtbxlen_t rtextents)
1389+{
1390+ if (!rtextents)
1391+ return 0;
1392+ return xfs_highbit64(rtextents);
1393+}
fs/xfs/libxfs/xfs_sb.h+2−0
@@ -38,4 +38,6 @@ extern int xfs_sb_get_secondary(struct xfs_mount *mp, · 37 unmodified lines
3838 extern bool xfs_validate_stripe_geometry(struct xfs_mount *mp,
3939 __s64 sunit, __s64 swidth, int sectorsize, bool silent);
4040
41+uint8_t xfs_compute_rextslog(xfs_rtbxlen_t rtextents);
42+
4143 #endif /* __XFS_SB_H__ */
fs/xfs/libxfs/xfs_types.h+12−0
@@ -251,4 +251,16 @@ bool xfs_verify_fileoff(struct xfs_mount *mp, xfs_fileoff_t off); · 250 unmodified lines
251251 bool xfs_verify_fileext(struct xfs_mount *mp, xfs_fileoff_t off,
252252 xfs_fileoff_t len);
253253
254+/* Do we support an rt volume having this number of rtextents? */
255+static inline bool
256+xfs_validate_rtextents(
257+ xfs_rtbxlen_t rtextents)
258+{
259+ /* No runt rt volumes */
260+ if (rtextents == 0)
261+ return false;
262+
263+ return true;
264+}
265+
254266 #endif /* __XFS_TYPES_H__ */
fs/xfs/scrub/rtbitmap.c+1−0
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515 #include "xfs_inode.h"
1616 #include "xfs_bmap.h"
1717 #include "xfs_bit.h"
18+#include "xfs_sb.h"
1819 #include "scrub/scrub.h"
1920 #include "scrub/common.h"
2021 #include "scrub/repair.h"
fs/xfs/scrub/rtsummary.c+1−0
@@ -16,6 +16,7 @@ · 15 unmodified lines
1616 #include "xfs_rtbitmap.h"
1717 #include "xfs_bit.h"
1818 #include "xfs_bmap.h"
19+#include "xfs_sb.h"
1920 #include "scrub/scrub.h"
2021 #include "scrub/common.h"
2122 #include "scrub/trace.h"
include/linux/dmaengine.h+2−1
@@ -953,7 +953,8 @@ static inline int dmaengine_slave_config(struct dma_chan *chan, · 952 unmodified lines
953953
954954 static inline bool is_slave_direction(enum dma_transfer_direction direction)
955955 {
956− return (direction == DMA_MEM_TO_DEV) || (direction == DMA_DEV_TO_MEM);
956+ return (direction == DMA_MEM_TO_DEV) || (direction == DMA_DEV_TO_MEM) ||
957+ (direction == DMA_DEV_TO_DEV);
957958 }
958959
959960 static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single(
include/linux/nvme.h+2−8
@@ -816,12 +816,6 @@ struct nvme_reservation_status_ext { · 815 unmodified lines
816816 struct nvme_registered_ctrl_ext regctl_eds[];
817817 };
818818
819−enum nvme_async_event_type {
820− NVME_AER_TYPE_ERROR = 0,
821− NVME_AER_TYPE_SMART = 1,
822− NVME_AER_TYPE_NOTICE = 2,
823−};
824−
825819 /* I/O commands */
826820
827821 enum nvme_opcode {
@@ -1818,7 +1812,7 @@ struct nvme_command { · 990 unmodified lines
18181812 };
18191813 };
18201814
1821−static inline bool nvme_is_fabrics(struct nvme_command *cmd)
1815+static inline bool nvme_is_fabrics(const struct nvme_command *cmd)
18221816 {
18231817 return cmd->common.opcode == nvme_fabrics_command;
18241818 }
@@ -1837,7 +1831,7 @@ struct nvme_error_slot { · 12 unmodified lines
18371831 __u8 resv2[24];
18381832 };
18391833
1840−static inline bool nvme_is_write(struct nvme_command *cmd)
1834+static inline bool nvme_is_write(const struct nvme_command *cmd)
18411835 {
18421836 /*
18431837 * What a mess...
include/linux/pci.h+5−0
@@ -1422,6 +1422,7 @@ int pci_load_and_free_saved_state(struct pci_dev *dev, · 1421 unmodified lines
14221422 struct pci_saved_state **state);
14231423 int pci_platform_power_transition(struct pci_dev *dev, pci_power_t state);
14241424 int pci_set_power_state(struct pci_dev *dev, pci_power_t state);
1425+int pci_set_power_state_locked(struct pci_dev *dev, pci_power_t state);
14251426 pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state);
14261427 bool pci_pme_capable(struct pci_dev *dev, pci_power_t state);
14271428 void pci_pme_active(struct pci_dev *dev, bool enable);
@@ -1625,6 +1626,8 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, · 197 unmodified lines
16251626
16261627 void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *),
16271628 void *userdata);
1629+void pci_walk_bus_locked(struct pci_bus *top, int (*cb)(struct pci_dev *, void *),
1630+ void *userdata);
16281631 int pci_cfg_space_size(struct pci_dev *dev);
16291632 unsigned char pci_bus_max_busnr(struct pci_bus *bus);
16301633 void pci_setup_bridge(struct pci_bus *bus);
@@ -2025,6 +2028,8 @@ static inline int pci_save_state(struct pci_dev *dev) { return 0; } · 394 unmodified lines
20252028 static inline void pci_restore_state(struct pci_dev *dev) { }
20262029 static inline int pci_set_power_state(struct pci_dev *dev, pci_power_t state)
20272030 { return 0; }
2031+static inline int pci_set_power_state_locked(struct pci_dev *dev, pci_power_t state)
2032+{ return 0; }
20282033 static inline int pci_wake_from_d3(struct pci_dev *dev, bool enable)
20292034 { return 0; }
20302035 static inline pci_power_t pci_choose_state(struct pci_dev *dev,
include/net/cfg80211.h+4−0
@@ -2910,6 +2910,8 @@ struct cfg80211_bss_ies { · 2909 unmodified lines
29102910 * own the beacon_ies, but they're just pointers to the ones from the
29112911 * @hidden_beacon_bss struct)
29122912 * @proberesp_ies: the information elements from the last Probe Response frame
2913+ * @proberesp_ecsa_stuck: ECSA element is stuck in the Probe Response frame,
2914+ * cannot rely on it having valid data
29132915 * @hidden_beacon_bss: in case this BSS struct represents a probe response from
29142916 * a BSS that hides the SSID in its beacon, this points to the BSS struct
29152917 * that holds the beacon data. @beacon_ies is still valid, of course, and
@@ -2950,6 +2952,8 @@ struct cfg80211_bss { · 34 unmodified lines
29502952 u8 chains;
29512953 s8 chain_signal[IEEE80211_MAX_CHAINS];
29522954
2955+ u8 proberesp_ecsa_stuck:1;
2956+
29532957 u8 bssid_index;
29542958 u8 max_bssid_indicator;
29552959
include/net/netfilter/nf_tables.h+14−2
@@ -808,10 +808,16 @@ static inline struct nft_set_elem_expr *nft_set_ext_expr(const struct nft_set_ex · 807 unmodified lines
808808 return nft_set_ext(ext, NFT_SET_EXT_EXPRESSIONS);
809809 }
810810
811−static inline bool nft_set_elem_expired(const struct nft_set_ext *ext)
811+static inline bool __nft_set_elem_expired(const struct nft_set_ext *ext,
812+ u64 tstamp)
812813 {
813814 return nft_set_ext_exists(ext, NFT_SET_EXT_EXPIRATION) &&
814− time_is_before_eq_jiffies64(*nft_set_ext_expiration(ext));
815+ time_after_eq64(tstamp, *nft_set_ext_expiration(ext));
816+}
817+
818+static inline bool nft_set_elem_expired(const struct nft_set_ext *ext)
819+{
820+ return __nft_set_elem_expired(ext, get_jiffies_64());
815821 }
816822
817823 static inline struct nft_set_ext *nft_set_elem_ext(const struct nft_set *set,
@@ -1785,6 +1791,7 @@ struct nftables_pernet { · 967 unmodified lines
17851791 struct list_head notify_list;
17861792 struct mutex commit_mutex;
17871793 u64 table_handle;
1794+ u64 tstamp;
17881795 unsigned int base_seq;
17891796 unsigned int gc_seq;
17901797 u8 validate_state;
@@ -1797,6 +1804,11 @@ static inline struct nftables_pernet *nft_pernet(const struct net *net) · 6 unmodified lines
17971804 return net_generic(net, nf_tables_net_id);
17981805 }
17991806
1807+static inline u64 nft_net_tstamp(const struct net *net)
1808+{
1809+ return nft_pernet(net)->tstamp;
1810+}
1811+
18001812 #define __NFT_REDUCE_READONLY 1UL
18011813 #define NFT_REDUCE_READONLY (void *)__NFT_REDUCE_READONLY
18021814
include/sound/cs35l56.h+6−1
@@ -75,6 +75,7 @@ · 74 unmodified lines
7575 #define CS35L56_DSP1_AHBM_WINDOW_DEBUG_0 0x25E2040
7676 #define CS35L56_DSP1_AHBM_WINDOW_DEBUG_1 0x25E2044
7777 #define CS35L56_DSP1_XMEM_UNPACKED24_0 0x2800000
78+#define CS35L56_DSP1_FW_VER 0x2800010
7879 #define CS35L56_DSP1_HALO_STATE_A1 0x2801E58
7980 #define CS35L56_DSP1_HALO_STATE 0x28021E0
8081 #define CS35L56_DSP1_PM_CUR_STATE_A1 0x2804000
@@ -241,7 +242,7 @@ · 160 unmodified lines
241242
242243 #define CS35L56_CONTROL_PORT_READY_US 2200
243244 #define CS35L56_HALO_STATE_POLL_US 1000
244−#define CS35L56_HALO_STATE_TIMEOUT_US 50000
245+#define CS35L56_HALO_STATE_TIMEOUT_US 250000
245246 #define CS35L56_RESET_PULSE_MIN_US 1100
246247 #define CS35L56_WAKE_HOLD_TIME_US 1000
247248
@@ -272,6 +273,7 @@ extern const char * const cs35l56_tx_input_texts[CS35L56_NUM_INPUT_SRC]; · 24 unmodified lines
272273 extern const unsigned int cs35l56_tx_input_values[CS35L56_NUM_INPUT_SRC];
273274
274275 int cs35l56_set_patch(struct cs35l56_base *cs35l56_base);
276+int cs35l56_force_sync_asp1_registers_from_cache(struct cs35l56_base *cs35l56_base);
275277 int cs35l56_mbox_send(struct cs35l56_base *cs35l56_base, unsigned int command);
276278 int cs35l56_firmware_shutdown(struct cs35l56_base *cs35l56_base);
277279 int cs35l56_wait_for_firmware_boot(struct cs35l56_base *cs35l56_base);
@@ -284,7 +286,10 @@ int cs35l56_is_fw_reload_needed(struct cs35l56_base *cs35l56_base); · 6 unmodified lines
284286 int cs35l56_runtime_suspend_common(struct cs35l56_base *cs35l56_base);
285287 int cs35l56_runtime_resume_common(struct cs35l56_base *cs35l56_base, bool is_soundwire);
286288 void cs35l56_init_cs_dsp(struct cs35l56_base *cs35l56_base, struct cs_dsp *cs_dsp);
289+int cs35l56_read_prot_status(struct cs35l56_base *cs35l56_base,
290+ bool *fw_missing, unsigned int *fw_version);
287291 int cs35l56_hw_init(struct cs35l56_base *cs35l56_base);
292+int cs35l56_get_speaker_id(struct cs35l56_base *cs35l56_base);
288293 int cs35l56_get_bclk_freq_id(unsigned int freq);
289294 void cs35l56_fill_supply_names(struct regulator_bulk_data *data);
290295
include/trace/events/ext4.h+4−7
@@ -772,15 +772,14 @@ TRACE_EVENT(ext4_mb_release_group_pa, · 771 unmodified lines
772772 );
773773
774774 TRACE_EVENT(ext4_discard_preallocations,
775− TP_PROTO(struct inode *inode, unsigned int len, unsigned int needed),
775+ TP_PROTO(struct inode *inode, unsigned int len),
776776
777− TP_ARGS(inode, len, needed),
777+ TP_ARGS(inode, len),
778778
779779 TP_STRUCT__entry(
780780 __field( dev_t, dev )
781781 __field( ino_t, ino )
782782 __field( unsigned int, len )
783− __field( unsigned int, needed )
784783
785784 ),
786785
@@ -788,13 +787,11 @@ TRACE_EVENT(ext4_discard_preallocations, · 1 unmodified line
788787 __entry->dev = inode->i_sb->s_dev;
789788 __entry->ino = inode->i_ino;
790789 __entry->len = len;
791− __entry->needed = needed;
792790 ),
793791
794− TP_printk("dev %d,%d ino %lu len: %u needed %u",
792+ TP_printk("dev %d,%d ino %lu len: %u",
795793 MAJOR(__entry->dev), MINOR(__entry->dev),
796− (unsigned long) __entry->ino, __entry->len,
797− __entry->needed)
794+ (unsigned long) __entry->ino, __entry->len)
798795 );
799796
800797 TRACE_EVENT(ext4_mb_discard_preallocations,
include/trace/events/rxrpc.h+5−3
@@ -128,6 +128,7 @@ · 127 unmodified lines
128128 EM(rxrpc_skb_eaten_by_unshare_nomem, "ETN unshar-nm") \
129129 EM(rxrpc_skb_get_conn_secured, "GET conn-secd") \
130130 EM(rxrpc_skb_get_conn_work, "GET conn-work") \
131+ EM(rxrpc_skb_get_last_nack, "GET last-nack") \
131132 EM(rxrpc_skb_get_local_work, "GET locl-work") \
132133 EM(rxrpc_skb_get_reject_work, "GET rej-work ") \
133134 EM(rxrpc_skb_get_to_recvmsg, "GET to-recv ") \
@@ -141,6 +142,7 @@ · 7 unmodified lines
141142 EM(rxrpc_skb_put_error_report, "PUT error-rep") \
142143 EM(rxrpc_skb_put_input, "PUT input ") \
143144 EM(rxrpc_skb_put_jumbo_subpacket, "PUT jumbo-sub") \
145+ EM(rxrpc_skb_put_last_nack, "PUT last-nack") \
144146 EM(rxrpc_skb_put_purge, "PUT purge ") \
145147 EM(rxrpc_skb_put_rotate, "PUT rotate ") \
146148 EM(rxrpc_skb_put_unknown, "PUT unknown ") \
@@ -1552,7 +1554,7 @@ TRACE_EVENT(rxrpc_congest, · 1405 unmodified lines
15521554 memcpy(&__entry->sum, summary, sizeof(__entry->sum));
15531555 ),
15541556
1555− TP_printk("c=%08x r=%08x %s q=%08x %s cw=%u ss=%u nA=%u,%u+%u r=%u b=%u u=%u d=%u l=%x%s%s%s",
1557+ TP_printk("c=%08x r=%08x %s q=%08x %s cw=%u ss=%u nA=%u,%u+%u,%u b=%u u=%u d=%u l=%x%s%s%s",
15561558 __entry->call,
15571559 __entry->ack_serial,
15581560 __print_symbolic(__entry->sum.ack_reason, rxrpc_ack_names),
@@ -1560,9 +1562,9 @@ TRACE_EVENT(rxrpc_congest, · 1 unmodified line
15601562 __print_symbolic(__entry->sum.mode, rxrpc_congest_modes),
15611563 __entry->sum.cwnd,
15621564 __entry->sum.ssthresh,
1563− __entry->sum.nr_acks, __entry->sum.saw_nacks,
1565+ __entry->sum.nr_acks, __entry->sum.nr_retained_nacks,
15641566 __entry->sum.nr_new_acks,
1565− __entry->sum.nr_rot_new_acks,
1567+ __entry->sum.nr_new_nacks,
15661568 __entry->top - __entry->hard_ack,
15671569 __entry->sum.cumulative_acks,
15681570 __entry->sum.dup_acks,
include/uapi/linux/netfilter/nf_tables.h+2−0
@@ -289,9 +289,11 @@ enum nft_rule_attributes { · 288 unmodified lines
289289 /**
290290 * enum nft_rule_compat_flags - nf_tables rule compat flags
291291 *
292+ * @NFT_RULE_COMPAT_F_UNUSED: unused
292293 * @NFT_RULE_COMPAT_F_INV: invert the check result
293294 */
294295 enum nft_rule_compat_flags {
296+ NFT_RULE_COMPAT_F_UNUSED = (1 << 0),
295297 NFT_RULE_COMPAT_F_INV = (1 << 1),
296298 NFT_RULE_COMPAT_F_MASK = NFT_RULE_COMPAT_F_INV,
297299 };
include/uapi/linux/serial.h+7−6
@@ -145,12 +145,13 @@ struct serial_rs485 { · 144 unmodified lines
145145 #define SER_RS485_ENABLED _BITUL(0)
146146 #define SER_RS485_RTS_ON_SEND _BITUL(1)
147147 #define SER_RS485_RTS_AFTER_SEND _BITUL(2)
148−#define SER_RS485_RX_DURING_TX _BITUL(3)
149−#define SER_RS485_TERMINATE_BUS _BITUL(4)
150−#define SER_RS485_ADDRB _BITUL(5)
151−#define SER_RS485_ADDR_RECV _BITUL(6)
152−#define SER_RS485_ADDR_DEST _BITUL(7)
153−#define SER_RS485_MODE_RS422 _BITUL(8)
148+/* Placeholder for bit 3: SER_RS485_RTS_BEFORE_SEND, which isn't used anymore */
149+#define SER_RS485_RX_DURING_TX _BITUL(4)
150+#define SER_RS485_TERMINATE_BUS _BITUL(5)
151+#define SER_RS485_ADDRB _BITUL(6)
152+#define SER_RS485_ADDR_RECV _BITUL(7)
153+#define SER_RS485_ADDR_DEST _BITUL(8)
154+#define SER_RS485_MODE_RS422 _BITUL(9)
154155
155156 __u32 delay_rts_before_send;
156157 __u32 delay_rts_after_send;
init/Kconfig+3−3
@@ -876,13 +876,13 @@ config CC_NO_ARRAY_BOUNDS · 875 unmodified lines
876876 bool
877877 default y if CC_IS_GCC && GCC_VERSION >= 110000 && GCC11_NO_ARRAY_BOUNDS
878878
879−# Currently, disable -Wstringop-overflow for GCC 11, globally.
880−config GCC11_NO_STRINGOP_OVERFLOW
879+# Currently, disable -Wstringop-overflow for GCC globally.
880+config GCC_NO_STRINGOP_OVERFLOW
881881 def_bool y
882882
883883 config CC_NO_STRINGOP_OVERFLOW
884884 bool
885− default y if CC_IS_GCC && GCC_VERSION >= 110000 && GCC_VERSION < 120000 && GCC11_NO_STRINGOP_OVERFLOW
885+ default y if CC_IS_GCC && GCC_NO_STRINGOP_OVERFLOW
886886
887887 config CC_STRINGOP_OVERFLOW
888888 bool
io_uring/io_uring.h+7−1
@@ -15,11 +15,17 @@ · 14 unmodified lines
1515 #include <trace/events/io_uring.h>
1616 #endif
1717
18−
1918 enum {
2019 IOU_OK = 0,
2120 IOU_ISSUE_SKIP_COMPLETE = -EIOCBQUEUED,
2221
22+ /*
23+ * Requeue the task_work to restart operations on this request. The
24+ * actual value isn't important, should just be not an otherwise
25+ * valid error code, yet less than -MAX_ERRNO and valid internally.
26+ */
27+ IOU_REQUEUE = -3072,
28+
2329 /*
2430 * Intended only when both IO_URING_F_MULTISHOT is passed
2531 * to indicate to the poll runner that multishot should be
io_uring/net.c+36−14
@@ -60,6 +60,7 @@ struct io_sr_msg { · 59 unmodified lines
6060 unsigned len;
6161 unsigned done_io;
6262 unsigned msg_flags;
63+ unsigned nr_multishot_loops;
6364 u16 flags;
6465 /* initialised and used only by !msg send variants */
6566 u16 addr_len;
@@ -70,6 +71,13 @@ struct io_sr_msg { · 4 unmodified lines
7071 struct io_kiocb *notif;
7172 };
7273
74+/*
75+ * Number of times we'll try and do receives if there's more data. If we
76+ * exceed this limit, then add us to the back of the queue and retry from
77+ * there. This helps fairness between flooding clients.
78+ */
79+#define MULTISHOT_MAX_RETRY 32
80+
7381 static inline bool io_check_multishot(struct io_kiocb *req,
7482 unsigned int issue_flags)
7583 {
@@ -611,6 +619,7 @@ int io_recvmsg_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) · 535 unmodified lines
611619 sr->msg_flags |= MSG_CMSG_COMPAT;
612620 #endif
613621 sr->done_io = 0;
622+ sr->nr_multishot_loops = 0;
614623 return 0;
615624 }
616625
@@ -645,23 +654,35 @@ static inline bool io_recv_finish(struct io_kiocb *req, int *ret, · 28 unmodified lines
645654 return true;
646655 }
647656
648− if (!mshot_finished) {
649− if (io_fill_cqe_req_aux(req, issue_flags & IO_URING_F_COMPLETE_DEFER,
650− *ret, cflags | IORING_CQE_F_MORE)) {
651− io_recv_prep_retry(req);
652− /* Known not-empty or unknown state, retry */
653− if (cflags & IORING_CQE_F_SOCK_NONEMPTY ||
654− msg->msg_inq == -1)
657+ if (mshot_finished)
658+ goto finish;
659+
660+ /*
661+ * Fill CQE for this receive and see if we should keep trying to
662+ * receive from this socket.
663+ */
664+ if (io_fill_cqe_req_aux(req, issue_flags & IO_URING_F_COMPLETE_DEFER,
665+ *ret, cflags | IORING_CQE_F_MORE)) {
666+ struct io_sr_msg *sr = io_kiocb_to_cmd(req, struct io_sr_msg);
667+ int mshot_retry_ret = IOU_ISSUE_SKIP_COMPLETE;
668+
669+ io_recv_prep_retry(req);
670+ /* Known not-empty or unknown state, retry */
671+ if (cflags & IORING_CQE_F_SOCK_NONEMPTY || msg->msg_inq == -1) {
672+ if (sr->nr_multishot_loops++ < MULTISHOT_MAX_RETRY)
655673 return false;
656− if (issue_flags & IO_URING_F_MULTISHOT)
657− *ret = IOU_ISSUE_SKIP_COMPLETE;
658− else
659− *ret = -EAGAIN;
660− return true;
674+ /* mshot retries exceeded, force a requeue */
675+ sr->nr_multishot_loops = 0;
676+ mshot_retry_ret = IOU_REQUEUE;
661677 }
662− /* Otherwise stop multishot but use the current result. */
678+ if (issue_flags & IO_URING_F_MULTISHOT)
679+ *ret = mshot_retry_ret;
680+ else
681+ *ret = -EAGAIN;
682+ return true;
663683 }
664−
684+ /* Otherwise stop multishot but use the current result. */
685+finish:
665686 io_req_set_res(req, *ret, cflags);
666687
667688 if (issue_flags & IO_URING_F_MULTISHOT)
@@ -902,6 +923,7 @@ retry_multishot: · 234 unmodified lines
902923 if (!buf)
903924 return -ENOBUFS;
904925 sr->buf = buf;
926+ sr->len = len;
905927 }
906928
907929 ret = import_ubuf(ITER_DEST, sr->buf, len, &msg.msg_iter);
io_uring/poll.c+28−21
@@ -226,8 +226,29 @@ enum { · 225 unmodified lines
226226 IOU_POLL_NO_ACTION = 1,
227227 IOU_POLL_REMOVE_POLL_USE_RES = 2,
228228 IOU_POLL_REISSUE = 3,
229+ IOU_POLL_REQUEUE = 4,
229230 };
230231
232+static void __io_poll_execute(struct io_kiocb *req, int mask)
233+{
234+ unsigned flags = 0;
235+
236+ io_req_set_res(req, mask, 0);
237+ req->io_task_work.func = io_poll_task_func;
238+
239+ trace_io_uring_task_add(req, mask);
240+
241+ if (!(req->flags & REQ_F_POLL_NO_LAZY))
242+ flags = IOU_F_TWQ_LAZY_WAKE;
243+ __io_req_task_work_add(req, flags);
244+}
245+
246+static inline void io_poll_execute(struct io_kiocb *req, int res)
247+{
248+ if (io_poll_get_ownership(req))
249+ __io_poll_execute(req, res);
250+}
251+
231252 /*
232253 * All poll tw should go through this. Checks for poll events, manages
233254 * references, does rewait, etc.
@@ -309,6 +330,8 @@ static int io_poll_check_events(struct io_kiocb *req, struct io_tw_state *ts) · 75 unmodified lines
309330 int ret = io_poll_issue(req, ts);
310331 if (ret == IOU_STOP_MULTISHOT)
311332 return IOU_POLL_REMOVE_POLL_USE_RES;
333+ else if (ret == IOU_REQUEUE)
334+ return IOU_POLL_REQUEUE;
312335 if (ret < 0)
313336 return ret;
314337 }
@@ -331,8 +354,12 @@ void io_poll_task_func(struct io_kiocb *req, struct io_tw_state *ts) · 16 unmodified lines
331354 int ret;
332355
333356 ret = io_poll_check_events(req, ts);
334− if (ret == IOU_POLL_NO_ACTION)
357+ if (ret == IOU_POLL_NO_ACTION) {
358+ return;
359+ } else if (ret == IOU_POLL_REQUEUE) {
360+ __io_poll_execute(req, 0);
335361 return;
362+ }
336363 io_poll_remove_entries(req);
337364 io_poll_tw_hash_eject(req, ts);
338365
@@ -364,26 +391,6 @@ void io_poll_task_func(struct io_kiocb *req, struct io_tw_state *ts) · 25 unmodified lines
364391 }
365392 }
366393
367−static void __io_poll_execute(struct io_kiocb *req, int mask)
368−{
369− unsigned flags = 0;
370−
371− io_req_set_res(req, mask, 0);
372− req->io_task_work.func = io_poll_task_func;
373−
374− trace_io_uring_task_add(req, mask);
375−
376− if (!(req->flags & REQ_F_POLL_NO_LAZY))
377− flags = IOU_F_TWQ_LAZY_WAKE;
378− __io_req_task_work_add(req, flags);
379−}
380−
381−static inline void io_poll_execute(struct io_kiocb *req, int res)
382−{
383− if (io_poll_get_ownership(req))
384− __io_poll_execute(req, res);
385−}
386−
387394 static void io_poll_cancel_req(struct io_kiocb *req)
388395 {
389396 io_poll_mark_cancelled(req);
io_uring/poll.h+9−0
@@ -24,6 +24,15 @@ struct async_poll { · 23 unmodified lines
2424 struct io_poll *double_poll;
2525 };
2626
27+/*
28+ * Must only be called inside issue_flags & IO_URING_F_MULTISHOT, or
29+ * potentially other cases where we already "own" this poll request.
30+ */
31+static inline void io_poll_multishot_retry(struct io_kiocb *req)
32+{
33+ atomic_inc(&req->poll_refs);
34+}
35+
2736 int io_poll_add_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
2837 int io_poll_add(struct io_kiocb *req, unsigned int issue_flags);
2938
io_uring/rw.c+9−1
@@ -18,6 +18,7 @@ · 17 unmodified lines
1818 #include "opdef.h"
1919 #include "kbuf.h"
2020 #include "rsrc.h"
21+#include "poll.h"
2122 #include "rw.h"
2223
2324 struct io_rw {
@@ -962,8 +963,15 @@ int io_read_mshot(struct io_kiocb *req, unsigned int issue_flags) · 938 unmodified lines
962963 if (io_fill_cqe_req_aux(req,
963964 issue_flags & IO_URING_F_COMPLETE_DEFER,
964965 ret, cflags | IORING_CQE_F_MORE)) {
965− if (issue_flags & IO_URING_F_MULTISHOT)
966+ if (issue_flags & IO_URING_F_MULTISHOT) {
967+ /*
968+ * Force retry, as we might have more data to
969+ * be read and otherwise it won't get retried
970+ * until (if ever) another poll is triggered.
971+ */
972+ io_poll_multishot_retry(req);
966973 return IOU_ISSUE_SKIP_COMPLETE;
974+ }
967975 return -EAGAIN;
968976 }
969977 }
kernel/trace/ring_buffer.c+1−1
@@ -944,7 +944,7 @@ __poll_t ring_buffer_poll_wait(struct trace_buffer *buffer, int cpu, · 943 unmodified lines
944944 full = 0;
945945 } else {
946946 if (!cpumask_test_cpu(cpu, buffer->cpumask))
947− return -EINVAL;
947+ return EPOLLERR;
948948
949949 cpu_buffer = buffer->buffers[cpu];
950950 work = &cpu_buffer->irq_work;
kernel/trace/trace_osnoise.c+3−3
@@ -2444,6 +2444,9 @@ static int timerlat_fd_open(struct inode *inode, struct file *file) · 2443 unmodified lines
24442444 tlat = this_cpu_tmr_var();
24452445 tlat->count = 0;
24462446
2447+ hrtimer_init(&tlat->timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNED_HARD);
2448+ tlat->timer.function = timerlat_irq;
2449+
24472450 migrate_enable();
24482451 return 0;
24492452 };
@@ -2526,9 +2529,6 @@ timerlat_fd_read(struct file *file, char __user *ubuf, size_t count, · 76 unmodified lines
25262529 tlat->tracing_thread = false;
25272530 tlat->kthread = current;
25282531
2529− hrtimer_init(&tlat->timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNED_HARD);
2530− tlat->timer.function = timerlat_irq;
2531−
25322532 /* Annotate now to drift new period */
25332533 tlat->abs_period = hrtimer_cb_get_time(&tlat->timer);
25342534
net/core/datagram.c+1−1
@@ -751,7 +751,7 @@ size_t memcpy_to_iter_csum(void *iter_to, size_t progress, · 750 unmodified lines
751751 size_t len, void *from, void *priv2)
752752 {
753753 __wsum *csum = priv2;
754− __wsum next = csum_partial_copy_nocheck(from, iter_to, len);
754+ __wsum next = csum_partial_copy_nocheck(from + progress, iter_to, len);
755755
756756 *csum = csum_block_add(*csum, next, progress);
757757 return 0;
net/devlink/core.c+6−6
@@ -46,7 +46,7 @@ struct devlink_rel { · 45 unmodified lines
4646 u32 obj_index;
4747 devlink_rel_notify_cb_t *notify_cb;
4848 devlink_rel_cleanup_cb_t *cleanup_cb;
49− struct work_struct notify_work;
49+ struct delayed_work notify_work;
5050 } nested_in;
5151 };
5252
@@ -70,7 +70,7 @@ static void __devlink_rel_put(struct devlink_rel *rel) · 17 unmodified lines
7070 static void devlink_rel_nested_in_notify_work(struct work_struct *work)
7171 {
7272 struct devlink_rel *rel = container_of(work, struct devlink_rel,
73− nested_in.notify_work);
73+ nested_in.notify_work.work);
7474 struct devlink *devlink;
7575
7676 devlink = devlinks_xa_get(rel->nested_in.devlink_index);
@@ -96,13 +96,13 @@ rel_put: · 19 unmodified lines
9696 return;
9797
9898 reschedule_work:
99− schedule_work(&rel->nested_in.notify_work);
99+ schedule_delayed_work(&rel->nested_in.notify_work, 1);
100100 }
101101
102102 static void devlink_rel_nested_in_notify_work_schedule(struct devlink_rel *rel)
103103 {
104104 __devlink_rel_get(rel);
105− schedule_work(&rel->nested_in.notify_work);
105+ schedule_delayed_work(&rel->nested_in.notify_work, 0);
106106 }
107107
108108 static struct devlink_rel *devlink_rel_alloc(void)
@@ -123,8 +123,8 @@ static struct devlink_rel *devlink_rel_alloc(void) · 14 unmodified lines
123123 }
124124
125125 refcount_set(&rel->refcount, 1);
126− INIT_WORK(&rel->nested_in.notify_work,
127− &devlink_rel_nested_in_notify_work);
126+ INIT_DELAYED_WORK(&rel->nested_in.notify_work,
127+ &devlink_rel_nested_in_notify_work);
128128 return rel;
129129 }
130130
net/ipv4/af_inet.c+4−2
@@ -1628,10 +1628,12 @@ EXPORT_SYMBOL(inet_current_timestamp); · 1627 unmodified lines
16281628
16291629 int inet_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len)
16301630 {
1631− if (sk->sk_family == AF_INET)
1631+ unsigned int family = READ_ONCE(sk->sk_family);
1632+
1633+ if (family == AF_INET)
16321634 return ip_recv_error(sk, msg, len, addr_len);
16331635 #if IS_ENABLED(CONFIG_IPV6)
1634− if (sk->sk_family == AF_INET6)
1636+ if (family == AF_INET6)
16351637 return pingv6_ops.ipv6_recv_error(sk, msg, len, addr_len);
16361638 #endif
16371639 return -EINVAL;
net/ipv4/ip_tunnel_core.c+1−1
@@ -332,7 +332,7 @@ static int iptunnel_pmtud_build_icmpv6(struct sk_buff *skb, int mtu) · 331 unmodified lines
332332 };
333333 skb_reset_network_header(skb);
334334
335− csum = csum_partial(icmp6h, len, 0);
335+ csum = skb_checksum(skb, skb_transport_offset(skb), len, 0);
336336 icmp6h->icmp6_cksum = csum_ipv6_magic(&nip6h->saddr, &nip6h->daddr, len,
337337 IPPROTO_ICMPV6, csum);
338338
net/mac80211/cfg.c+9−7
@@ -5,7 +5,7 @@ · 4 unmodified lines
55 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
66 * Copyright 2013-2015 Intel Mobile Communications GmbH
77 * Copyright (C) 2015-2017 Intel Deutschland GmbH
8− * Copyright (C) 2018-2022 Intel Corporation
8+ * Copyright (C) 2018-2024 Intel Corporation
99 */
1010
1111 #include <linux/ieee80211.h>
@@ -987,7 +987,8 @@ static int · 975 unmodified lines
987987 ieee80211_set_unsol_bcast_probe_resp(struct ieee80211_sub_if_data *sdata,
988988 struct cfg80211_unsol_bcast_probe_resp *params,
989989 struct ieee80211_link_data *link,
990− struct ieee80211_bss_conf *link_conf)
990+ struct ieee80211_bss_conf *link_conf,
991+ u64 *changed)
991992 {
992993 struct unsol_bcast_probe_resp_data *new, *old = NULL;
993994
@@ -1011,7 +1012,8 @@ ieee80211_set_unsol_bcast_probe_resp(struct ieee80211_sub_if_data *sdata, · 17 unmodified lines
10111012 RCU_INIT_POINTER(link->u.ap.unsol_bcast_probe_resp, NULL);
10121013 }
10131014
1014− return BSS_CHANGED_UNSOL_BCAST_PROBE_RESP;
1015+ *changed |= BSS_CHANGED_UNSOL_BCAST_PROBE_RESP;
1016+ return 0;
10151017 }
10161018
10171019 static int ieee80211_set_ftm_responder_params(
@@ -1450,10 +1452,9 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, · 432 unmodified lines
14501452
14511453 err = ieee80211_set_unsol_bcast_probe_resp(sdata,
14521454 &params->unsol_bcast_probe_resp,
1453− link, link_conf);
1455+ link, link_conf, &changed);
14541456 if (err < 0)
14551457 goto error;
1456− changed |= err;
14571458
14581459 err = drv_start_ap(sdata->local, sdata, link_conf);
14591460 if (err) {
@@ -1525,10 +1526,9 @@ static int ieee80211_change_beacon(struct wiphy *wiphy, struct net_device *dev, · 65 unmodified lines
15251526
15261527 err = ieee80211_set_unsol_bcast_probe_resp(sdata,
15271528 &params->unsol_bcast_probe_resp,
1528− link, link_conf);
1529+ link, link_conf, &changed);
15291530 if (err < 0)
15301531 return err;
1531− changed |= err;
15321532
15331533 if (beacon->he_bss_color_valid &&
15341534 beacon->he_bss_color.enabled != link_conf->he_bss_color.enabled) {
@@ -1869,6 +1869,8 @@ static int sta_link_apply_parameters(struct ieee80211_local *local, · 334 unmodified lines
18691869 sband->band);
18701870 }
18711871
1872+ ieee80211_sta_set_rx_nss(link_sta);
1873+
18721874 return ret;
18731875 }
18741876
net/mac80211/debugfs_netdev.c+2−2
@@ -997,8 +997,8 @@ static void add_link_files(struct ieee80211_link_data *link, · 996 unmodified lines
997997 }
998998 }
999999
1000−void ieee80211_debugfs_add_netdev(struct ieee80211_sub_if_data *sdata,
1001− bool mld_vif)
1000+static void ieee80211_debugfs_add_netdev(struct ieee80211_sub_if_data *sdata,
1001+ bool mld_vif)
10021002 {
10031003 char buf[10+IFNAMSIZ];
10041004
net/mac80211/debugfs_netdev.h+0−5
@@ -11,8 +11,6 @@ · 10 unmodified lines
1111 #include "ieee80211_i.h"
1212
1313 #ifdef CONFIG_MAC80211_DEBUGFS
14−void ieee80211_debugfs_add_netdev(struct ieee80211_sub_if_data *sdata,
15− bool mld_vif);
1614 void ieee80211_debugfs_remove_netdev(struct ieee80211_sub_if_data *sdata);
1715 void ieee80211_debugfs_rename_netdev(struct ieee80211_sub_if_data *sdata);
1816 void ieee80211_debugfs_recreate_netdev(struct ieee80211_sub_if_data *sdata,
@@ -24,9 +22,6 @@ void ieee80211_link_debugfs_remove(struct ieee80211_link_data *link); · 5 unmodified lines
2422 void ieee80211_link_debugfs_drv_add(struct ieee80211_link_data *link);
2523 void ieee80211_link_debugfs_drv_remove(struct ieee80211_link_data *link);
2624 #else
27−static inline void ieee80211_debugfs_add_netdev(
28− struct ieee80211_sub_if_data *sdata, bool mld_vif)
29−{}
3025 static inline void ieee80211_debugfs_remove_netdev(
3126 struct ieee80211_sub_if_data *sdata)
3227 {}
net/mac80211/iface.c+1−1
@@ -1783,7 +1783,7 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata, · 1782 unmodified lines
17831783 /* need to do this after the switch so vif.type is correct */
17841784 ieee80211_link_setup(&sdata->deflink);
17851785
1786− ieee80211_debugfs_add_netdev(sdata, false);
1786+ ieee80211_debugfs_recreate_netdev(sdata, false);
17871787 }
17881788
17891789 static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata,
net/mac80211/mlme.c+81−33
@@ -8,7 +8,7 @@ · 7 unmodified lines
88 * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
99 * Copyright 2013-2014 Intel Mobile Communications GmbH
1010 * Copyright (C) 2015 - 2017 Intel Deutschland GmbH
11− * Copyright (C) 2018 - 2023 Intel Corporation
11+ * Copyright (C) 2018 - 2024 Intel Corporation
1212 */
1313
1414 #include <linux/delay.h>
@@ -2918,6 +2918,7 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, · 2903 unmodified lines
29182918
29192919 /* other links will be destroyed */
29202920 sdata->deflink.u.mgd.bss = NULL;
2921+ sdata->deflink.smps_mode = IEEE80211_SMPS_OFF;
29212922
29222923 netif_carrier_off(sdata->dev);
29232924
@@ -5045,9 +5046,6 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata, · 2121 unmodified lines
50455046 if (!link)
50465047 return 0;
50475048
5048− /* will change later if needed */
5049− link->smps_mode = IEEE80211_SMPS_OFF;
5050−
50515049 /*
50525050 * If this fails (possibly due to channel context sharing
50535051 * on incompatible channels, e.g. 80+80 and 160 sharing the
@@ -7096,6 +7094,7 @@ void ieee80211_mgd_setup_link(struct ieee80211_link_data *link) · 2042 unmodified lines
70967094 link->u.mgd.p2p_noa_index = -1;
70977095 link->u.mgd.conn_flags = 0;
70987096 link->conf->bssid = link->u.mgd.bssid;
7097+ link->smps_mode = IEEE80211_SMPS_OFF;
70997098
71007099 wiphy_work_init(&link->u.mgd.request_smps_work,
71017100 ieee80211_request_smps_mgd_work);
@@ -7309,6 +7308,75 @@ out_err: · 207 unmodified lines
73097308 return err;
73107309 }
73117310
7311+static bool ieee80211_mgd_csa_present(struct ieee80211_sub_if_data *sdata,
7312+ const struct cfg80211_bss_ies *ies,
7313+ u8 cur_channel, bool ignore_ecsa)
7314+{
7315+ const struct element *csa_elem, *ecsa_elem;
7316+ struct ieee80211_channel_sw_ie *csa = NULL;
7317+ struct ieee80211_ext_chansw_ie *ecsa = NULL;
7318+
7319+ if (!ies)
7320+ return false;
7321+
7322+ csa_elem = cfg80211_find_elem(WLAN_EID_CHANNEL_SWITCH,
7323+ ies->data, ies->len);
7324+ if (csa_elem && csa_elem->datalen == sizeof(*csa))
7325+ csa = (void *)csa_elem->data;
7326+
7327+ ecsa_elem = cfg80211_find_elem(WLAN_EID_EXT_CHANSWITCH_ANN,
7328+ ies->data, ies->len);
7329+ if (ecsa_elem && ecsa_elem->datalen == sizeof(*ecsa))
7330+ ecsa = (void *)ecsa_elem->data;
7331+
7332+ if (csa && csa->count == 0)
7333+ csa = NULL;
7334+ if (csa && !csa->mode && csa->new_ch_num == cur_channel)
7335+ csa = NULL;
7336+
7337+ if (ecsa && ecsa->count == 0)
7338+ ecsa = NULL;
7339+ if (ecsa && !ecsa->mode && ecsa->new_ch_num == cur_channel)
7340+ ecsa = NULL;
7341+
7342+ if (ignore_ecsa && ecsa) {
7343+ sdata_info(sdata,
7344+ "Ignoring ECSA in probe response - was considered stuck!\n");
7345+ return csa;
7346+ }
7347+
7348+ return csa || ecsa;
7349+}
7350+
7351+static bool ieee80211_mgd_csa_in_process(struct ieee80211_sub_if_data *sdata,
7352+ struct cfg80211_bss *bss)
7353+{
7354+ u8 cur_channel;
7355+ bool ret;
7356+
7357+ cur_channel = ieee80211_frequency_to_channel(bss->channel->center_freq);
7358+
7359+ rcu_read_lock();
7360+ if (ieee80211_mgd_csa_present(sdata,
7361+ rcu_dereference(bss->beacon_ies),
7362+ cur_channel, false)) {
7363+ ret = true;
7364+ goto out;
7365+ }
7366+
7367+ if (ieee80211_mgd_csa_present(sdata,
7368+ rcu_dereference(bss->proberesp_ies),
7369+ cur_channel, bss->proberesp_ecsa_stuck)) {
7370+ ret = true;
7371+ goto out;
7372+ }
7373+
7374+ ret = false;
7375+out:
7376+ rcu_read_unlock();
7377+ return ret;
7378+}
7379+
73127380 /* config hooks */
73137381 int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
73147382 struct cfg80211_auth_request *req)
@@ -7317,7 +7385,6 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata, · 2 unmodified lines
73177385 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
73187386 struct ieee80211_mgd_auth_data *auth_data;
73197387 struct ieee80211_link_data *link;
7320− const struct element *csa_elem, *ecsa_elem;
73217388 u16 auth_alg;
73227389 int err;
73237390 bool cont_auth;
@@ -7360,21 +7427,10 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata, · 36 unmodified lines
73607427 if (ifmgd->assoc_data)
73617428 return -EBUSY;
73627429
7363− rcu_read_lock();
7364− csa_elem = ieee80211_bss_get_elem(req->bss, WLAN_EID_CHANNEL_SWITCH);
7365− ecsa_elem = ieee80211_bss_get_elem(req->bss,
7366− WLAN_EID_EXT_CHANSWITCH_ANN);
7367− if ((csa_elem &&
7368− csa_elem->datalen == sizeof(struct ieee80211_channel_sw_ie) &&
7369− ((struct ieee80211_channel_sw_ie *)csa_elem->data)->count != 0) ||
7370− (ecsa_elem &&
7371− ecsa_elem->datalen == sizeof(struct ieee80211_ext_chansw_ie) &&
7372− ((struct ieee80211_ext_chansw_ie *)ecsa_elem->data)->count != 0)) {
7373− rcu_read_unlock();
7430+ if (ieee80211_mgd_csa_in_process(sdata, req->bss)) {
73747431 sdata_info(sdata, "AP is in CSA process, reject auth\n");
73757432 return -EINVAL;
73767433 }
7377− rcu_read_unlock();
73787434
73797435 auth_data = kzalloc(sizeof(*auth_data) + req->auth_data_len +
73807436 req->ie_len, GFP_KERNEL);
@@ -7684,7 +7740,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, · 303 unmodified lines
76847740 struct ieee80211_local *local = sdata->local;
76857741 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
76867742 struct ieee80211_mgd_assoc_data *assoc_data;
7687− const struct element *ssid_elem, *csa_elem, *ecsa_elem;
7743+ const struct element *ssid_elem;
76887744 struct ieee80211_vif_cfg *vif_cfg = &sdata->vif.cfg;
76897745 ieee80211_conn_flags_t conn_flags = 0;
76907746 struct ieee80211_link_data *link;
@@ -7707,23 +7763,15 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, · 16 unmodified lines
77077763
77087764 cbss = req->link_id < 0 ? req->bss : req->links[req->link_id].bss;
77097765
7710− rcu_read_lock();
7711− ssid_elem = ieee80211_bss_get_elem(cbss, WLAN_EID_SSID);
7712− if (!ssid_elem || ssid_elem->datalen > sizeof(assoc_data->ssid)) {
7713− rcu_read_unlock();
7766+ if (ieee80211_mgd_csa_in_process(sdata, cbss)) {
7767+ sdata_info(sdata, "AP is in CSA process, reject assoc\n");
77147768 kfree(assoc_data);
77157769 return -EINVAL;
77167770 }
77177771
7718− csa_elem = ieee80211_bss_get_elem(cbss, WLAN_EID_CHANNEL_SWITCH);
7719− ecsa_elem = ieee80211_bss_get_elem(cbss, WLAN_EID_EXT_CHANSWITCH_ANN);
7720− if ((csa_elem &&
7721− csa_elem->datalen == sizeof(struct ieee80211_channel_sw_ie) &&
7722− ((struct ieee80211_channel_sw_ie *)csa_elem->data)->count != 0) ||
7723− (ecsa_elem &&
7724− ecsa_elem->datalen == sizeof(struct ieee80211_ext_chansw_ie) &&
7725− ((struct ieee80211_ext_chansw_ie *)ecsa_elem->data)->count != 0)) {
7726− sdata_info(sdata, "AP is in CSA process, reject assoc\n");
7772+ rcu_read_lock();
7773+ ssid_elem = ieee80211_bss_get_elem(cbss, WLAN_EID_SSID);
7774+ if (!ssid_elem || ssid_elem->datalen > sizeof(assoc_data->ssid)) {
77277775 rcu_read_unlock();
77287776 kfree(assoc_data);
77297777 return -EINVAL;
@@ -7998,8 +8046,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, · 268 unmodified lines
79988046
79998047 rcu_read_lock();
80008048 beacon_ies = rcu_dereference(req->bss->beacon_ies);
8001−
8002− if (beacon_ies) {
8049+ if (!beacon_ies) {
80038050 /*
80048051 * Wait up to one beacon interval ...
80058052 * should this be more if we miss one?
@@ -8080,6 +8127,7 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata, · 74 unmodified lines
80808127 ieee80211_report_disconnect(sdata, frame_buf,
80818128 sizeof(frame_buf), true,
80828129 req->reason_code, false);
8130+ drv_mgd_complete_tx(sdata->local, sdata, &info);
80838131 return 0;
80848132 }
80858133
net/mac80211/scan.c+18−12
@@ -9,7 +9,7 @@ · 8 unmodified lines
99 * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
1010 * Copyright 2013-2015 Intel Mobile Communications GmbH
1111 * Copyright 2016-2017 Intel Deutschland GmbH
12− * Copyright (C) 2018-2023 Intel Corporation
12+ * Copyright (C) 2018-2024 Intel Corporation
1313 */
1414
1515 #include <linux/if_arp.h>
@@ -237,14 +237,18 @@ ieee80211_bss_info_update(struct ieee80211_local *local, · 221 unmodified lines
237237 }
238238
239239 static bool ieee80211_scan_accept_presp(struct ieee80211_sub_if_data *sdata,
240+ struct ieee80211_channel *channel,
240241 u32 scan_flags, const u8 *da)
241242 {
242243 if (!sdata)
243244 return false;
244− /* accept broadcast for OCE */
245− if (scan_flags & NL80211_SCAN_FLAG_ACCEPT_BCAST_PROBE_RESP &&
246− is_broadcast_ether_addr(da))
245+
246+ /* accept broadcast on 6 GHz and for OCE */
247+ if (is_broadcast_ether_addr(da) &&
248+ (channel->band == NL80211_BAND_6GHZ ||
249+ scan_flags & NL80211_SCAN_FLAG_ACCEPT_BCAST_PROBE_RESP))
247250 return true;
251+
248252 if (scan_flags & NL80211_SCAN_FLAG_RANDOM_ADDR)
249253 return true;
250254 return ether_addr_equal(da, sdata->vif.addr);
@@ -293,6 +297,12 @@ void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb) · 42 unmodified lines
293297 wiphy_delayed_work_queue(local->hw.wiphy, &local->scan_work, 0);
294298 }
295299
300+ channel = ieee80211_get_channel_khz(local->hw.wiphy,
301+ ieee80211_rx_status_to_khz(rx_status));
302+
303+ if (!channel || channel->flags & IEEE80211_CHAN_DISABLED)
304+ return;
305+
296306 if (ieee80211_is_probe_resp(mgmt->frame_control)) {
297307 struct cfg80211_scan_request *scan_req;
298308 struct cfg80211_sched_scan_request *sched_scan_req;
@@ -310,19 +320,15 @@ void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb) · 11 unmodified lines
310320 /* ignore ProbeResp to foreign address or non-bcast (OCE)
311321 * unless scanning with randomised address
312322 */
313− if (!ieee80211_scan_accept_presp(sdata1, scan_req_flags,
323+ if (!ieee80211_scan_accept_presp(sdata1, channel,
324+ scan_req_flags,
314325 mgmt->da) &&
315− !ieee80211_scan_accept_presp(sdata2, sched_scan_req_flags,
326+ !ieee80211_scan_accept_presp(sdata2, channel,
327+ sched_scan_req_flags,
316328 mgmt->da))
317329 return;
318330 }
319331
320− channel = ieee80211_get_channel_khz(local->hw.wiphy,
321− ieee80211_rx_status_to_khz(rx_status));
322−
323− if (!channel || channel->flags & IEEE80211_CHAN_DISABLED)
324− return;
325−
326332 bss = ieee80211_bss_info_update(local, rx_status,
327333 mgmt, skb->len,
328334 channel);
net/mac80211/tx.c+4−3
@@ -3100,10 +3100,11 @@ void ieee80211_check_fast_xmit(struct sta_info *sta) · 3099 unmodified lines
31003100 /* DA SA BSSID */
31013101 build.da_offs = offsetof(struct ieee80211_hdr, addr1);
31023102 build.sa_offs = offsetof(struct ieee80211_hdr, addr2);
3103+ rcu_read_lock();
31033104 link = rcu_dereference(sdata->link[tdls_link_id]);
3104− if (WARN_ON_ONCE(!link))
3105− break;
3106− memcpy(hdr->addr3, link->u.mgd.bssid, ETH_ALEN);
3105+ if (!WARN_ON_ONCE(!link))
3106+ memcpy(hdr->addr3, link->u.mgd.bssid, ETH_ALEN);
3107+ rcu_read_unlock();
31073108 build.hdr_len = 24;
31083109 break;
31093110 }
net/mac80211/wbrf.c+0−2
@@ -23,8 +23,6 @@ void ieee80211_check_wbrf_support(struct ieee80211_local *local) · 22 unmodified lines
2323 return;
2424
2525 local->wbrf_supported = acpi_amd_wbrf_supported_producer(dev);
26− dev_dbg(dev, "WBRF is %s supported\n",
27− local->wbrf_supported ? "" : "not");
2826 }
2927
3028 static void get_chan_freq_boundary(u32 center_freq, u32 bandwidth, u64 *start, u64 *end)
net/netfilter/ipset/ip_set_core.c+2−0
@@ -1154,6 +1154,7 @@ static int ip_set_create(struct sk_buff *skb, const struct nfnl_info *info, · 1153 unmodified lines
11541154 return ret;
11551155
11561156 cleanup:
1157+ set->variant->cancel_gc(set);
11571158 set->variant->destroy(set);
11581159 put_out:
11591160 module_put(set->type->me);
@@ -2378,6 +2379,7 @@ ip_set_net_exit(struct net *net) · 1218 unmodified lines
23782379 set = ip_set(inst, i);
23792380 if (set) {
23802381 ip_set(inst, i) = NULL;
2382+ set->variant->cancel_gc(set);
23812383 ip_set_destroy_set(set);
23822384 }
23832385 }
net/netfilter/ipset/ip_set_hash_gen.h+2−2
@@ -432,7 +432,7 @@ mtype_ahash_destroy(struct ip_set *set, struct htable *t, bool ext_destroy) · 431 unmodified lines
432432 u32 i;
433433
434434 for (i = 0; i < jhash_size(t->htable_bits); i++) {
435− n = __ipset_dereference(hbucket(t, i));
435+ n = (__force struct hbucket *)hbucket(t, i);
436436 if (!n)
437437 continue;
438438 if (set->extensions & IPSET_EXT_DESTROY && ext_destroy)
@@ -452,7 +452,7 @@ mtype_destroy(struct ip_set *set) · 13 unmodified lines
452452 struct htype *h = set->data;
453453 struct list_head *l, *lt;
454454
455− mtype_ahash_destroy(set, ipset_dereference_nfnl(h->table), true);
455+ mtype_ahash_destroy(set, (__force struct htable *)h->table, true);
456456 list_for_each_safe(l, lt, &h->ad) {
457457 list_del(l);
458458 kfree(l);
net/netfilter/nf_conntrack_netlink.c+8−4
@@ -876,6 +876,7 @@ struct ctnetlink_filter_u32 { · 875 unmodified lines
876876
877877 struct ctnetlink_filter {
878878 u8 family;
879+ bool zone_filter;
879880
880881 u_int32_t orig_flags;
881882 u_int32_t reply_flags;
@@ -992,9 +993,12 @@ ctnetlink_alloc_filter(const struct nlattr * const cda[], u8 family) · 110 unmodified lines
992993 if (err)
993994 goto err_filter;
994995
995− err = ctnetlink_parse_zone(cda[CTA_ZONE], &filter->zone);
996− if (err < 0)
997− goto err_filter;
996+ if (cda[CTA_ZONE]) {
997+ err = ctnetlink_parse_zone(cda[CTA_ZONE], &filter->zone);
998+ if (err < 0)
999+ goto err_filter;
1000+ filter->zone_filter = true;
1001+ }
9981002
9991003 if (!cda[CTA_FILTER])
10001004 return filter;
@@ -1148,7 +1152,7 @@ static int ctnetlink_filter_match(struct nf_conn *ct, void *data) · 147 unmodified lines
11481152 if (filter->family && nf_ct_l3num(ct) != filter->family)
11491153 goto ignore_entry;
11501154
1151− if (filter->zone.id != NF_CT_DEFAULT_ZONE_ID &&
1155+ if (filter->zone_filter &&
11521156 !nf_ct_zone_equal_any(ct, &filter->zone))
11531157 goto ignore_entry;
11541158
net/netfilter/nf_tables_api.c+3−1
@@ -9834,6 +9834,7 @@ dead_elem: · 9833 unmodified lines
98349834 struct nft_trans_gc *nft_trans_gc_catchall_sync(struct nft_trans_gc *gc)
98359835 {
98369836 struct nft_set_elem_catchall *catchall, *next;
9837+ u64 tstamp = nft_net_tstamp(gc->net);
98379838 const struct nft_set *set = gc->set;
98389839 struct nft_elem_priv *elem_priv;
98399840 struct nft_set_ext *ext;
@@ -9843,7 +9844,7 @@ struct nft_trans_gc *nft_trans_gc_catchall_sync(struct nft_trans_gc *gc) · 3 unmodified lines
98439844 list_for_each_entry_safe(catchall, next, &set->catchall_list, list) {
98449845 ext = nft_set_elem_ext(set, catchall->elem);
98459846
9846− if (!nft_set_elem_expired(ext))
9847+ if (!__nft_set_elem_expired(ext, tstamp))
98479848 continue;
98489849
98499850 gc = nft_trans_gc_queue_sync(gc, GFP_KERNEL);
@@ -10633,6 +10634,7 @@ static bool nf_tables_valid_genid(struct net *net, u32 genid) · 783 unmodified lines
1063310634 bool genid_ok;
1063410635
1063510636 mutex_lock(&nft_net->commit_mutex);
10637+ nft_net->tstamp = get_jiffies_64();
1063610638
1063710639 genid_ok = genid == 0 || nft_net->base_seq == genid;
1063810640 if (!genid_ok)
net/netfilter/nfnetlink_queue.c+10−3
@@ -232,18 +232,25 @@ static void nfqnl_reinject(struct nf_queue_entry *entry, unsigned int verdict) · 231 unmodified lines
232232 if (verdict == NF_ACCEPT ||
233233 verdict == NF_REPEAT ||
234234 verdict == NF_STOP) {
235+ unsigned int ct_verdict = verdict;
236+
235237 rcu_read_lock();
236238 ct_hook = rcu_dereference(nf_ct_hook);
237239 if (ct_hook)
238− verdict = ct_hook->update(entry->state.net, entry->skb);
240+ ct_verdict = ct_hook->update(entry->state.net, entry->skb);
239241 rcu_read_unlock();
240242
241− switch (verdict & NF_VERDICT_MASK) {
243+ switch (ct_verdict & NF_VERDICT_MASK) {
244+ case NF_ACCEPT:
245+ /* follow userspace verdict, could be REPEAT */
246+ break;
242247 case NF_STOLEN:
243248 nf_queue_entry_free(entry);
244249 return;
250+ default:
251+ verdict = ct_verdict & NF_VERDICT_MASK;
252+ break;
245253 }
246−
247254 }
248255 nf_reinject(entry, verdict);
249256 }
net/netfilter/nft_compat.c+12−5
@@ -135,7 +135,7 @@ static void nft_target_eval_bridge(const struct nft_expr *expr, · 134 unmodified lines
135135
136136 static const struct nla_policy nft_target_policy[NFTA_TARGET_MAX + 1] = {
137137 [NFTA_TARGET_NAME] = { .type = NLA_NUL_STRING },
138− [NFTA_TARGET_REV] = { .type = NLA_U32 },
138+ [NFTA_TARGET_REV] = NLA_POLICY_MAX(NLA_BE32, 255),
139139 [NFTA_TARGET_INFO] = { .type = NLA_BINARY },
140140 };
141141
@@ -200,6 +200,7 @@ static const struct nla_policy nft_rule_compat_policy[NFTA_RULE_COMPAT_MAX + 1] · 58 unmodified lines
200200 static int nft_parse_compat(const struct nlattr *attr, u16 *proto, bool *inv)
201201 {
202202 struct nlattr *tb[NFTA_RULE_COMPAT_MAX+1];
203+ u32 l4proto;
203204 u32 flags;
204205 int err;
205206
@@ -212,12 +213,18 @@ static int nft_parse_compat(const struct nlattr *attr, u16 *proto, bool *inv) · 6 unmodified lines
212213 return -EINVAL;
213214
214215 flags = ntohl(nla_get_be32(tb[NFTA_RULE_COMPAT_FLAGS]));
215− if (flags & ~NFT_RULE_COMPAT_F_MASK)
216+ if (flags & NFT_RULE_COMPAT_F_UNUSED ||
217+ flags & ~NFT_RULE_COMPAT_F_MASK)
216218 return -EINVAL;
217219 if (flags & NFT_RULE_COMPAT_F_INV)
218220 *inv = true;
219221
220− *proto = ntohl(nla_get_be32(tb[NFTA_RULE_COMPAT_PROTO]));
222+ l4proto = ntohl(nla_get_be32(tb[NFTA_RULE_COMPAT_PROTO]));
223+ if (l4proto > U16_MAX)
224+ return -EINVAL;
225+
226+ *proto = l4proto;
227+
221228 return 0;
222229 }
223230
@@ -419,7 +426,7 @@ static void nft_match_eval(const struct nft_expr *expr, · 195 unmodified lines
419426
420427 static const struct nla_policy nft_match_policy[NFTA_MATCH_MAX + 1] = {
421428 [NFTA_MATCH_NAME] = { .type = NLA_NUL_STRING },
422− [NFTA_MATCH_REV] = { .type = NLA_U32 },
429+ [NFTA_MATCH_REV] = NLA_POLICY_MAX(NLA_BE32, 255),
423430 [NFTA_MATCH_INFO] = { .type = NLA_BINARY },
424431 };
425432
@@ -724,7 +731,7 @@ out_put: · 298 unmodified lines
724731 static const struct nla_policy nfnl_compat_policy_get[NFTA_COMPAT_MAX+1] = {
725732 [NFTA_COMPAT_NAME] = { .type = NLA_NUL_STRING,
726733 .len = NFT_COMPAT_NAME_MAX-1 },
727− [NFTA_COMPAT_REV] = { .type = NLA_U32 },
734+ [NFTA_COMPAT_REV] = NLA_POLICY_MAX(NLA_BE32, 255),
728735 [NFTA_COMPAT_TYPE] = { .type = NLA_U32 },
729736 };
730737
net/netfilter/nft_ct.c+3−0
@@ -476,6 +476,9 @@ static int nft_ct_get_init(const struct nft_ctx *ctx, · 475 unmodified lines
476476 break;
477477 #endif
478478 case NFT_CT_ID:
479+ if (tb[NFTA_CT_DIRECTION])
480+ return -EINVAL;
481+
479482 len = sizeof(u32);
480483 break;
481484 default:
net/netfilter/nft_set_hash.c+7−1
@@ -36,6 +36,7 @@ struct nft_rhash_cmp_arg { · 35 unmodified lines
3636 const struct nft_set *set;
3737 const u32 *key;
3838 u8 genmask;
39+ u64 tstamp;
3940 };
4041
4142 static inline u32 nft_rhash_key(const void *data, u32 len, u32 seed)
@@ -62,7 +63,7 @@ static inline int nft_rhash_cmp(struct rhashtable_compare_arg *arg, · 20 unmodified lines
6263 return 1;
6364 if (nft_set_elem_is_dead(&he->ext))
6465 return 1;
65− if (nft_set_elem_expired(&he->ext))
66+ if (__nft_set_elem_expired(&he->ext, x->tstamp))
6667 return 1;
6768 if (!nft_set_elem_active(&he->ext, x->genmask))
6869 return 1;
@@ -87,6 +88,7 @@ bool nft_rhash_lookup(const struct net *net, const struct nft_set *set, · 18 unmodified lines
8788 .genmask = nft_genmask_cur(net),
8889 .set = set,
8990 .key = key,
91+ .tstamp = get_jiffies_64(),
9092 };
9193
9294 he = rhashtable_lookup(&priv->ht, &arg, nft_rhash_params);
@@ -106,6 +108,7 @@ nft_rhash_get(const struct net *net, const struct nft_set *set, · 13 unmodified lines
106108 .genmask = nft_genmask_cur(net),
107109 .set = set,
108110 .key = elem->key.val.data,
111+ .tstamp = get_jiffies_64(),
109112 };
110113
111114 he = rhashtable_lookup(&priv->ht, &arg, nft_rhash_params);
@@ -131,6 +134,7 @@ static bool nft_rhash_update(struct nft_set *set, const u32 *key, · 19 unmodified lines
131134 .genmask = NFT_GENMASK_ANY,
132135 .set = set,
133136 .key = key,
137+ .tstamp = get_jiffies_64(),
134138 };
135139
136140 he = rhashtable_lookup(&priv->ht, &arg, nft_rhash_params);
@@ -175,6 +179,7 @@ static int nft_rhash_insert(const struct net *net, const struct nft_set *set, · 38 unmodified lines
175179 .genmask = nft_genmask_next(net),
176180 .set = set,
177181 .key = elem->key.val.data,
182+ .tstamp = nft_net_tstamp(net),
178183 };
179184 struct nft_rhash_elem *prev;
180185
@@ -216,6 +221,7 @@ nft_rhash_deactivate(const struct net *net, const struct nft_set *set, · 35 unmodified lines
216221 .genmask = nft_genmask_next(net),
217222 .set = set,
218223 .key = elem->key.val.data,
224+ .tstamp = nft_net_tstamp(net),
219225 };
220226
221227 rcu_read_lock();
net/netfilter/nft_set_pipapo.c+66−62
@@ -342,9 +342,6 @@ · 341 unmodified lines
342342 #include "nft_set_pipapo_avx2.h"
343343 #include "nft_set_pipapo.h"
344344
345−/* Current working bitmap index, toggled between field matches */
346−static DEFINE_PER_CPU(bool, nft_pipapo_scratch_index);
347−
348345 /**
349346 * pipapo_refill() - For each set bit, set bits from selected mapping table item
350347 * @map: Bitmap to be scanned for set bits
@@ -412,6 +409,7 @@ bool nft_pipapo_lookup(const struct net *net, const struct nft_set *set, · 61 unmodified lines
412409 const u32 *key, const struct nft_set_ext **ext)
413410 {
414411 struct nft_pipapo *priv = nft_set_priv(set);
412+ struct nft_pipapo_scratch *scratch;
415413 unsigned long *res_map, *fill_map;
416414 u8 genmask = nft_genmask_cur(net);
417415 const u8 *rp = (const u8 *)key;
@@ -422,15 +420,17 @@ bool nft_pipapo_lookup(const struct net *net, const struct nft_set *set, · 4 unmodified lines
422420
423421 local_bh_disable();
424422
425− map_index = raw_cpu_read(nft_pipapo_scratch_index);
426−
427423 m = rcu_dereference(priv->match);
428424
429425 if (unlikely(!m || !*raw_cpu_ptr(m->scratch)))
430426 goto out;
431427
432− res_map = *raw_cpu_ptr(m->scratch) + (map_index ? m->bsize_max : 0);
433− fill_map = *raw_cpu_ptr(m->scratch) + (map_index ? 0 : m->bsize_max);
428+ scratch = *raw_cpu_ptr(m->scratch);
429+
430+ map_index = scratch->map_index;
431+
432+ res_map = scratch->map + (map_index ? m->bsize_max : 0);
433+ fill_map = scratch->map + (map_index ? 0 : m->bsize_max);
434434
435435 memset(res_map, 0xff, m->bsize_max * sizeof(*res_map));
436436
@@ -460,7 +460,7 @@ next_match: · 23 unmodified lines
460460 b = pipapo_refill(res_map, f->bsize, f->rules, fill_map, f->mt,
461461 last);
462462 if (b < 0) {
463− raw_cpu_write(nft_pipapo_scratch_index, map_index);
463+ scratch->map_index = map_index;
464464 local_bh_enable();
465465
466466 return false;
@@ -477,7 +477,7 @@ next_match: · 10 unmodified lines
477477 * current inactive bitmap is clean and can be reused as
478478 * *next* bitmap (not initial) for the next packet.
479479 */
480− raw_cpu_write(nft_pipapo_scratch_index, map_index);
480+ scratch->map_index = map_index;
481481 local_bh_enable();
482482
483483 return true;
@@ -504,6 +504,7 @@ out: · 20 unmodified lines
504504 * @set: nftables API set representation
505505 * @data: Key data to be matched against existing elements
506506 * @genmask: If set, check that element is active in given genmask
507+ * @tstamp: timestamp to check for expired elements
507508 *
508509 * This is essentially the same as the lookup function, except that it matches
509510 * key data against the uncommitted copy and doesn't use preallocated maps for
@@ -513,7 +514,8 @@ out: · 3 unmodified lines
513514 */
514515 static struct nft_pipapo_elem *pipapo_get(const struct net *net,
515516 const struct nft_set *set,
516− const u8 *data, u8 genmask)
517+ const u8 *data, u8 genmask,
518+ u64 tstamp)
517519 {
518520 struct nft_pipapo_elem *ret = ERR_PTR(-ENOENT);
519521 struct nft_pipapo *priv = nft_set_priv(set);
@@ -566,7 +568,7 @@ next_match: · 46 unmodified lines
566568 goto out;
567569
568570 if (last) {
569− if (nft_set_elem_expired(&f->mt[b].e->ext))
571+ if (__nft_set_elem_expired(&f->mt[b].e->ext, tstamp))
570572 goto next_match;
571573 if ((genmask &&
572574 !nft_set_elem_active(&f->mt[b].e->ext, genmask)))
@@ -603,10 +605,10 @@ static struct nft_elem_priv * · 30 unmodified lines
603605 nft_pipapo_get(const struct net *net, const struct nft_set *set,
604606 const struct nft_set_elem *elem, unsigned int flags)
605607 {
606− static struct nft_pipapo_elem *e;
608+ struct nft_pipapo_elem *e;
607609
608610 e = pipapo_get(net, set, (const u8 *)elem->key.val.data,
609− nft_genmask_cur(net));
611+ nft_genmask_cur(net), get_jiffies_64());
610612 if (IS_ERR(e))
611613 return ERR_CAST(e);
612614
@@ -1108,6 +1110,25 @@ static void pipapo_map(struct nft_pipapo_match *m, · 495 unmodified lines
11081110 f->mt[map[i].to + j].e = e;
11091111 }
11101112
1113+/**
1114+ * pipapo_free_scratch() - Free per-CPU map at original (not aligned) address
1115+ * @m: Matching data
1116+ * @cpu: CPU number
1117+ */
1118+static void pipapo_free_scratch(const struct nft_pipapo_match *m, unsigned int cpu)
1119+{
1120+ struct nft_pipapo_scratch *s;
1121+ void *mem;
1122+
1123+ s = *per_cpu_ptr(m->scratch, cpu);
1124+ if (!s)
1125+ return;
1126+
1127+ mem = s;
1128+ mem -= s->align_off;
1129+ kfree(mem);
1130+}
1131+
11111132 /**
11121133 * pipapo_realloc_scratch() - Reallocate scratch maps for partial match results
11131134 * @clone: Copy of matching data with pending insertions and deletions
@@ -1121,12 +1142,13 @@ static int pipapo_realloc_scratch(struct nft_pipapo_match *clone, · 7 unmodified lines
11211142 int i;
11221143
11231144 for_each_possible_cpu(i) {
1124− unsigned long *scratch;
1145+ struct nft_pipapo_scratch *scratch;
11251146 #ifdef NFT_PIPAPO_ALIGN
1126− unsigned long *scratch_aligned;
1147+ void *scratch_aligned;
1148+ u32 align_off;
11271149 #endif
1128−
1129− scratch = kzalloc_node(bsize_max * sizeof(*scratch) * 2 +
1150+ scratch = kzalloc_node(struct_size(scratch, map,
1151+ bsize_max * 2) +
11301152 NFT_PIPAPO_ALIGN_HEADROOM,
11311153 GFP_KERNEL, cpu_to_node(i));
11321154 if (!scratch) {
@@ -1140,14 +1162,25 @@ static int pipapo_realloc_scratch(struct nft_pipapo_match *clone, · 7 unmodified lines
11401162 return -ENOMEM;
11411163 }
11421164
1143− kfree(*per_cpu_ptr(clone->scratch, i));
1144−
1145− *per_cpu_ptr(clone->scratch, i) = scratch;
1165+ pipapo_free_scratch(clone, i);
11461166
11471167 #ifdef NFT_PIPAPO_ALIGN
1148− scratch_aligned = NFT_PIPAPO_LT_ALIGN(scratch);
1149− *per_cpu_ptr(clone->scratch_aligned, i) = scratch_aligned;
1168+ /* Align &scratch->map (not the struct itself): the extra
1169+ * %NFT_PIPAPO_ALIGN_HEADROOM bytes passed to kzalloc_node()
1170+ * above guarantee we can waste up to those bytes in order
1171+ * to align the map field regardless of its offset within
1172+ * the struct.
1173+ */
1174+ BUILD_BUG_ON(offsetof(struct nft_pipapo_scratch, map) > NFT_PIPAPO_ALIGN_HEADROOM);
1175+
1176+ scratch_aligned = NFT_PIPAPO_LT_ALIGN(&scratch->map);
1177+ scratch_aligned -= offsetof(struct nft_pipapo_scratch, map);
1178+ align_off = scratch_aligned - (void *)scratch;
1179+
1180+ scratch = scratch_aligned;
1181+ scratch->align_off = align_off;
11501182 #endif
1183+ *per_cpu_ptr(clone->scratch, i) = scratch;
11511184 }
11521185
11531186 return 0;
@@ -1173,6 +1206,7 @@ static int nft_pipapo_insert(const struct net *net, const struct nft_set *set, · 19 unmodified lines
11731206 struct nft_pipapo_match *m = priv->clone;
11741207 u8 genmask = nft_genmask_next(net);
11751208 struct nft_pipapo_elem *e, *dup;
1209+ u64 tstamp = nft_net_tstamp(net);
11761210 struct nft_pipapo_field *f;
11771211 const u8 *start_p, *end_p;
11781212 int i, bsize_max, err = 0;
@@ -1182,7 +1216,7 @@ static int nft_pipapo_insert(const struct net *net, const struct nft_set *set, · 3 unmodified lines
11821216 else
11831217 end = start;
11841218
1185− dup = pipapo_get(net, set, start, genmask);
1219+ dup = pipapo_get(net, set, start, genmask, tstamp);
11861220 if (!IS_ERR(dup)) {
11871221 /* Check if we already have the same exact entry */
11881222 const struct nft_data *dup_key, *dup_end;
@@ -1204,7 +1238,7 @@ static int nft_pipapo_insert(const struct net *net, const struct nft_set *set, · 15 unmodified lines
12041238
12051239 if (PTR_ERR(dup) == -ENOENT) {
12061240 /* Look for partially overlapping entries */
1207− dup = pipapo_get(net, set, end, nft_genmask_next(net));
1241+ dup = pipapo_get(net, set, end, nft_genmask_next(net), tstamp);
12081242 }
12091243
12101244 if (PTR_ERR(dup) != -ENOENT) {
@@ -1301,11 +1335,6 @@ static struct nft_pipapo_match *pipapo_clone(struct nft_pipapo_match *old) · 90 unmodified lines
13011335 if (!new->scratch)
13021336 goto out_scratch;
13031337
1304−#ifdef NFT_PIPAPO_ALIGN
1305− new->scratch_aligned = alloc_percpu(*new->scratch_aligned);
1306− if (!new->scratch_aligned)
1307− goto out_scratch;
1308−#endif
13091338 for_each_possible_cpu(i)
13101339 *per_cpu_ptr(new->scratch, i) = NULL;
13111340
@@ -1357,10 +1386,7 @@ out_lt: · 45 unmodified lines
13571386 }
13581387 out_scratch_realloc:
13591388 for_each_possible_cpu(i)
1360− kfree(*per_cpu_ptr(new->scratch, i));
1361−#ifdef NFT_PIPAPO_ALIGN
1362− free_percpu(new->scratch_aligned);
1363−#endif
1389+ pipapo_free_scratch(new, i);
13641390 out_scratch:
13651391 free_percpu(new->scratch);
13661392 kfree(new);
@@ -1560,6 +1586,7 @@ static void pipapo_gc(struct nft_set *set, struct nft_pipapo_match *m) · 193 unmodified lines
15601586 {
15611587 struct nft_pipapo *priv = nft_set_priv(set);
15621588 struct net *net = read_pnet(&set->net);
1589+ u64 tstamp = nft_net_tstamp(net);
15631590 int rules_f0, first_rule = 0;
15641591 struct nft_pipapo_elem *e;
15651592 struct nft_trans_gc *gc;
@@ -1594,7 +1621,7 @@ static void pipapo_gc(struct nft_set *set, struct nft_pipapo_match *m) · 28 unmodified lines
15941621 /* synchronous gc never fails, there is no need to set on
15951622 * NFT_SET_ELEM_DEAD_BIT.
15961623 */
1597− if (nft_set_elem_expired(&e->ext)) {
1624+ if (__nft_set_elem_expired(&e->ext, tstamp)) {
15981625 priv->dirty = true;
15991626
16001627 gc = nft_trans_gc_queue_sync(gc, GFP_KERNEL);
@@ -1640,13 +1667,9 @@ static void pipapo_free_match(struct nft_pipapo_match *m) · 39 unmodified lines
16401667 int i;
16411668
16421669 for_each_possible_cpu(i)
1643− kfree(*per_cpu_ptr(m->scratch, i));
1670+ pipapo_free_scratch(m, i);
16441671
1645−#ifdef NFT_PIPAPO_ALIGN
1646− free_percpu(m->scratch_aligned);
1647−#endif
16481672 free_percpu(m->scratch);
1649−
16501673 pipapo_free_fields(m);
16511674
16521675 kfree(m);
@@ -1769,7 +1792,7 @@ static void *pipapo_deactivate(const struct net *net, const struct nft_set *set, · 116 unmodified lines
17691792 {
17701793 struct nft_pipapo_elem *e;
17711794
1772− e = pipapo_get(net, set, data, nft_genmask_next(net));
1795+ e = pipapo_get(net, set, data, nft_genmask_next(net), nft_net_tstamp(net));
17731796 if (IS_ERR(e))
17741797 return NULL;
17751798
@@ -2132,7 +2155,7 @@ static int nft_pipapo_init(const struct nft_set *set, · 356 unmodified lines
21322155 m->field_count = field_count;
21332156 m->bsize_max = 0;
21342157
2135− m->scratch = alloc_percpu(unsigned long *);
2158+ m->scratch = alloc_percpu(struct nft_pipapo_scratch *);
21362159 if (!m->scratch) {
21372160 err = -ENOMEM;
21382161 goto out_scratch;
@@ -2140,16 +2163,6 @@ static int nft_pipapo_init(const struct nft_set *set, · 1 unmodified line
21402163 for_each_possible_cpu(i)
21412164 *per_cpu_ptr(m->scratch, i) = NULL;
21422165
2143−#ifdef NFT_PIPAPO_ALIGN
2144− m->scratch_aligned = alloc_percpu(unsigned long *);
2145− if (!m->scratch_aligned) {
2146− err = -ENOMEM;
2147− goto out_free;
2148− }
2149− for_each_possible_cpu(i)
2150− *per_cpu_ptr(m->scratch_aligned, i) = NULL;
2151−#endif
2152−
21532166 rcu_head_init(&m->rcu);
21542167
21552168 nft_pipapo_for_each_field(f, i, m) {
@@ -2180,9 +2193,6 @@ static int nft_pipapo_init(const struct nft_set *set, · 24 unmodified lines
21802193 return 0;
21812194
21822195 out_free:
2183−#ifdef NFT_PIPAPO_ALIGN
2184− free_percpu(m->scratch_aligned);
2185−#endif
21862196 free_percpu(m->scratch);
21872197 out_scratch:
21882198 kfree(m);
@@ -2236,11 +2246,8 @@ static void nft_pipapo_destroy(const struct nft_ctx *ctx, · 47 unmodified lines
22362246
22372247 nft_set_pipapo_match_destroy(ctx, set, m);
22382248
2239−#ifdef NFT_PIPAPO_ALIGN
2240− free_percpu(m->scratch_aligned);
2241−#endif
22422249 for_each_possible_cpu(cpu)
2243− kfree(*per_cpu_ptr(m->scratch, cpu));
2250+ pipapo_free_scratch(m, cpu);
22442251 free_percpu(m->scratch);
22452252 pipapo_free_fields(m);
22462253 kfree(m);
@@ -2253,11 +2260,8 @@ static void nft_pipapo_destroy(const struct nft_ctx *ctx, · 6 unmodified lines
22532260 if (priv->dirty)
22542261 nft_set_pipapo_match_destroy(ctx, set, m);
22552262
2256−#ifdef NFT_PIPAPO_ALIGN
2257− free_percpu(priv->clone->scratch_aligned);
2258−#endif
22592263 for_each_possible_cpu(cpu)
2260− kfree(*per_cpu_ptr(priv->clone->scratch, cpu));
2264+ pipapo_free_scratch(priv->clone, cpu);
22612265 free_percpu(priv->clone->scratch);
22622266
22632267 pipapo_free_fields(priv->clone);
net/netfilter/nft_set_pipapo.h+13−5
@@ -130,21 +130,29 @@ struct nft_pipapo_field { · 129 unmodified lines
130130 union nft_pipapo_map_bucket *mt;
131131 };
132132
133+/**
134+ * struct nft_pipapo_scratch - percpu data used for lookup and matching
135+ * @map_index: Current working bitmap index, toggled between field matches
136+ * @align_off: Offset to get the originally allocated address
137+ * @map: store partial matching results during lookup
138+ */
139+struct nft_pipapo_scratch {
140+ u8 map_index;
141+ u32 align_off;
142+ unsigned long map[];
143+};
144+
133145 /**
134146 * struct nft_pipapo_match - Data used for lookup and matching
135147 * @field_count Amount of fields in set
136148 * @scratch: Preallocated per-CPU maps for partial matching results
137− * @scratch_aligned: Version of @scratch aligned to NFT_PIPAPO_ALIGN bytes
138149 * @bsize_max: Maximum lookup table bucket size of all fields, in longs
139150 * @rcu Matching data is swapped on commits
140151 * @f: Fields, with lookup and mapping tables
141152 */
142153 struct nft_pipapo_match {
143154 int field_count;
144−#ifdef NFT_PIPAPO_ALIGN
145− unsigned long * __percpu *scratch_aligned;
146−#endif
147− unsigned long * __percpu *scratch;
155+ struct nft_pipapo_scratch * __percpu *scratch;
148156 size_t bsize_max;
149157 struct rcu_head rcu;
150158 struct nft_pipapo_field f[] __counted_by(field_count);
net/netfilter/nft_set_pipapo_avx2.c+8−9
@@ -71,9 +71,6 @@ · 70 unmodified lines
7171 #define NFT_PIPAPO_AVX2_ZERO(reg) \
7272 asm volatile("vpxor %ymm" #reg ", %ymm" #reg ", %ymm" #reg)
7373
74−/* Current working bitmap index, toggled between field matches */
75−static DEFINE_PER_CPU(bool, nft_pipapo_avx2_scratch_index);
76−
7774 /**
7875 * nft_pipapo_avx2_prepare() - Prepare before main algorithm body
7976 *
@@ -1120,11 +1117,12 @@ bool nft_pipapo_avx2_lookup(const struct net *net, const struct nft_set *set, · 1040 unmodified lines
11201117 const u32 *key, const struct nft_set_ext **ext)
11211118 {
11221119 struct nft_pipapo *priv = nft_set_priv(set);
1123− unsigned long *res, *fill, *scratch;
1120+ struct nft_pipapo_scratch *scratch;
11241121 u8 genmask = nft_genmask_cur(net);
11251122 const u8 *rp = (const u8 *)key;
11261123 struct nft_pipapo_match *m;
11271124 struct nft_pipapo_field *f;
1125+ unsigned long *res, *fill;
11281126 bool map_index;
11291127 int i, ret = 0;
11301128
@@ -1141,15 +1139,16 @@ bool nft_pipapo_avx2_lookup(const struct net *net, const struct nft_set *set, · 10 unmodified lines
11411139 */
11421140 kernel_fpu_begin_mask(0);
11431141
1144− scratch = *raw_cpu_ptr(m->scratch_aligned);
1142+ scratch = *raw_cpu_ptr(m->scratch);
11451143 if (unlikely(!scratch)) {
11461144 kernel_fpu_end();
11471145 return false;
11481146 }
1149− map_index = raw_cpu_read(nft_pipapo_avx2_scratch_index);
11501147
1151− res = scratch + (map_index ? m->bsize_max : 0);
1152− fill = scratch + (map_index ? 0 : m->bsize_max);
1148+ map_index = scratch->map_index;
1149+
1150+ res = scratch->map + (map_index ? m->bsize_max : 0);
1151+ fill = scratch->map + (map_index ? 0 : m->bsize_max);
11531152
11541153 /* Starting map doesn't need to be set for this implementation */
11551154
@@ -1221,7 +1220,7 @@ next_match: · 65 unmodified lines
12211220
12221221 out:
12231222 if (i % 2)
1224− raw_cpu_write(nft_pipapo_avx2_scratch_index, !map_index);
1223+ scratch->map_index = !map_index;
12251224 kernel_fpu_end();
12261225
12271226 return ret >= 0;
net/netfilter/nft_set_rbtree.c+10−7
@@ -234,7 +234,7 @@ static void nft_rbtree_gc_elem_remove(struct net *net, struct nft_set *set, · 233 unmodified lines
234234
235235 static const struct nft_rbtree_elem *
236236 nft_rbtree_gc_elem(const struct nft_set *__set, struct nft_rbtree *priv,
237− struct nft_rbtree_elem *rbe, u8 genmask)
237+ struct nft_rbtree_elem *rbe)
238238 {
239239 struct nft_set *set = (struct nft_set *)__set;
240240 struct rb_node *prev = rb_prev(&rbe->node);
@@ -253,7 +253,7 @@ nft_rbtree_gc_elem(const struct nft_set *__set, struct nft_rbtree *priv, · 12 unmodified lines
253253 while (prev) {
254254 rbe_prev = rb_entry(prev, struct nft_rbtree_elem, node);
255255 if (nft_rbtree_interval_end(rbe_prev) &&
256− nft_set_elem_active(&rbe_prev->ext, genmask))
256+ nft_set_elem_active(&rbe_prev->ext, NFT_GENMASK_ANY))
257257 break;
258258
259259 prev = rb_prev(prev);
@@ -313,6 +313,7 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set, · 53 unmodified lines
313313 struct nft_rbtree *priv = nft_set_priv(set);
314314 u8 cur_genmask = nft_genmask_cur(net);
315315 u8 genmask = nft_genmask_next(net);
316+ u64 tstamp = nft_net_tstamp(net);
316317 int d;
317318
318319 /* Descend the tree to search for an existing element greater than the
@@ -360,11 +361,11 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set, · 41 unmodified lines
360361 /* perform garbage collection to avoid bogus overlap reports
361362 * but skip new elements in this transaction.
362363 */
363− if (nft_set_elem_expired(&rbe->ext) &&
364+ if (__nft_set_elem_expired(&rbe->ext, tstamp) &&
364365 nft_set_elem_active(&rbe->ext, cur_genmask)) {
365366 const struct nft_rbtree_elem *removed_end;
366367
367− removed_end = nft_rbtree_gc_elem(set, priv, rbe, genmask);
368+ removed_end = nft_rbtree_gc_elem(set, priv, rbe);
368369 if (IS_ERR(removed_end))
369370 return PTR_ERR(removed_end);
370371
@@ -551,6 +552,7 @@ nft_rbtree_deactivate(const struct net *net, const struct nft_set *set, · 180 unmodified lines
551552 const struct nft_rbtree *priv = nft_set_priv(set);
552553 const struct rb_node *parent = priv->root.rb_node;
553554 u8 genmask = nft_genmask_next(net);
555+ u64 tstamp = nft_net_tstamp(net);
554556 int d;
555557
556558 while (parent != NULL) {
@@ -571,7 +573,7 @@ nft_rbtree_deactivate(const struct net *net, const struct nft_set *set, · 14 unmodified lines
571573 nft_rbtree_interval_end(this)) {
572574 parent = parent->rb_right;
573575 continue;
574− } else if (nft_set_elem_expired(&rbe->ext)) {
576+ } else if (__nft_set_elem_expired(&rbe->ext, tstamp)) {
575577 break;
576578 } else if (!nft_set_elem_active(&rbe->ext, genmask)) {
577579 parent = parent->rb_left;
@@ -624,9 +626,10 @@ static void nft_rbtree_gc(struct nft_set *set) · 46 unmodified lines
624626 {
625627 struct nft_rbtree *priv = nft_set_priv(set);
626628 struct nft_rbtree_elem *rbe, *rbe_end = NULL;
629+ struct net *net = read_pnet(&set->net);
630+ u64 tstamp = nft_net_tstamp(net);
627631 struct rb_node *node, *next;
628632 struct nft_trans_gc *gc;
629− struct net *net;
630633
631634 set = nft_set_container_of(priv);
632635 net = read_pnet(&set->net);
@@ -648,7 +651,7 @@ static void nft_rbtree_gc(struct nft_set *set) · 15 unmodified lines
648651 rbe_end = rbe;
649652 continue;
650653 }
651− if (!nft_set_elem_expired(&rbe->ext))
654+ if (!__nft_set_elem_expired(&rbe->ext, tstamp))
652655 continue;
653656
654657 gc = nft_trans_gc_queue_sync(gc, GFP_KERNEL);
net/rxrpc/ar-internal.h+30−7
@@ -199,11 +199,19 @@ struct rxrpc_host_header { · 198 unmodified lines
199199 */
200200 struct rxrpc_skb_priv {
201201 struct rxrpc_connection *conn; /* Connection referred to (poke packet) */
202− u16 offset; /* Offset of data */
203− u16 len; /* Length of data */
204− u8 flags;
202+ union {
203+ struct {
204+ u16 offset; /* Offset of data */
205+ u16 len; /* Length of data */
206+ u8 flags;
205207 #define RXRPC_RX_VERIFIED 0x01
206−
208+ };
209+ struct {
210+ rxrpc_seq_t first_ack; /* First packet in acks table */
211+ u8 nr_acks; /* Number of acks+nacks */
212+ u8 nr_nacks; /* Number of nacks */
213+ };
214+ };
207215 struct rxrpc_host_header hdr; /* RxRPC packet header from this packet */
208216 };
209217
@@ -510,7 +518,7 @@ struct rxrpc_connection { · 300 unmodified lines
510518 enum rxrpc_call_completion completion; /* Completion condition */
511519 s32 abort_code; /* Abort code of connection abort */
512520 int debug_id; /* debug ID for printks */
513− atomic_t serial; /* packet serial number counter */
521+ rxrpc_serial_t tx_serial; /* Outgoing packet serial number counter */
514522 unsigned int hi_serial; /* highest serial number received */
515523 u32 service_id; /* Service ID, possibly upgraded */
516524 u32 security_level; /* Security level selected */
@@ -692,11 +700,11 @@ struct rxrpc_call { · 175 unmodified lines
692700 u8 cong_dup_acks; /* Count of ACKs showing missing packets */
693701 u8 cong_cumul_acks; /* Cumulative ACK count */
694702 ktime_t cong_tstamp; /* Last time cwnd was changed */
703+ struct sk_buff *cong_last_nack; /* Last ACK with nacks received */
695704
696705 /* Receive-phase ACK management (ACKs we send). */
697706 u8 ackr_reason; /* reason to ACK */
698707 u16 ackr_sack_base; /* Starting slot in SACK table ring */
699− rxrpc_serial_t ackr_serial; /* serial of packet being ACK'd */
700708 rxrpc_seq_t ackr_window; /* Base of SACK window */
701709 rxrpc_seq_t ackr_wtop; /* Base of SACK window */
702710 unsigned int ackr_nr_unacked; /* Number of unacked packets */
@@ -730,7 +738,8 @@ struct rxrpc_call { · 27 unmodified lines
730738 struct rxrpc_ack_summary {
731739 u16 nr_acks; /* Number of ACKs in packet */
732740 u16 nr_new_acks; /* Number of new ACKs in packet */
733− u16 nr_rot_new_acks; /* Number of rotated new ACKs */
741+ u16 nr_new_nacks; /* Number of new nacks in packet */
742+ u16 nr_retained_nacks; /* Number of nacks retained between ACKs */
734743 u8 ack_reason;
735744 bool saw_nacks; /* Saw NACKs in packet */
736745 bool new_low_nack; /* T if new low NACK found */
@@ -822,6 +831,20 @@ static inline bool rxrpc_sending_to_client(const struct rxrpc_txbuf *txb) · 85 unmodified lines
822831
823832 #include <trace/events/rxrpc.h>
824833
834+/*
835+ * Allocate the next serial number on a connection. 0 must be skipped.
836+ */
837+static inline rxrpc_serial_t rxrpc_get_next_serial(struct rxrpc_connection *conn)
838+{
839+ rxrpc_serial_t serial;
840+
841+ serial = conn->tx_serial;
842+ if (serial == 0)
843+ serial = 1;
844+ conn->tx_serial = serial + 1;
845+ return serial;
846+}
847+
825848 /*
826849 * af_rxrpc.c
827850 */
net/rxrpc/call_event.c+5−7
@@ -43,8 +43,6 @@ void rxrpc_propose_delay_ACK(struct rxrpc_call *call, rxrpc_serial_t serial, · 42 unmodified lines
4343 unsigned long expiry = rxrpc_soft_ack_delay;
4444 unsigned long now = jiffies, ack_at;
4545
46− call->ackr_serial = serial;
47−
4846 if (rxrpc_soft_ack_delay < expiry)
4947 expiry = rxrpc_soft_ack_delay;
5048 if (call->peer->srtt_us != 0)
@@ -114,6 +112,7 @@ static void rxrpc_congestion_timeout(struct rxrpc_call *call) · 63 unmodified lines
114112 void rxrpc_resend(struct rxrpc_call *call, struct sk_buff *ack_skb)
115113 {
116114 struct rxrpc_ackpacket *ack = NULL;
115+ struct rxrpc_skb_priv *sp;
117116 struct rxrpc_txbuf *txb;
118117 unsigned long resend_at;
119118 rxrpc_seq_t transmitted = READ_ONCE(call->tx_transmitted);
@@ -141,14 +140,15 @@ void rxrpc_resend(struct rxrpc_call *call, struct sk_buff *ack_skb) · 21 unmodified lines
141140 * explicitly NAK'd packets.
142141 */
143142 if (ack_skb) {
143+ sp = rxrpc_skb(ack_skb);
144144 ack = (void *)ack_skb->data + sizeof(struct rxrpc_wire_header);
145145
146− for (i = 0; i < ack->nAcks; i++) {
146+ for (i = 0; i < sp->nr_acks; i++) {
147147 rxrpc_seq_t seq;
148148
149149 if (ack->acks[i] & 1)
150150 continue;
151− seq = ntohl(ack->firstPacket) + i;
151+ seq = sp->first_ack + i;
152152 if (after(txb->seq, transmitted))
153153 break;
154154 if (after(txb->seq, seq))
@@ -373,7 +373,6 @@ static void rxrpc_send_initial_ping(struct rxrpc_call *call) · 218 unmodified lines
373373 bool rxrpc_input_call_event(struct rxrpc_call *call, struct sk_buff *skb)
374374 {
375375 unsigned long now, next, t;
376− rxrpc_serial_t ackr_serial;
377376 bool resend = false, expired = false;
378377 s32 abort_code;
379378
@@ -423,8 +422,7 @@ bool rxrpc_input_call_event(struct rxrpc_call *call, struct sk_buff *skb) · 43 unmodified lines
423422 if (time_after_eq(now, t)) {
424423 trace_rxrpc_timer(call, rxrpc_timer_exp_ack, now);
425424 cmpxchg(&call->delay_ack_at, t, now + MAX_JIFFY_OFFSET);
426− ackr_serial = xchg(&call->ackr_serial, 0);
427− rxrpc_send_ACK(call, RXRPC_ACK_DELAY, ackr_serial,
425+ rxrpc_send_ACK(call, RXRPC_ACK_DELAY, 0,
428426 rxrpc_propose_ack_ping_for_lost_ack);
429427 }
430428
net/rxrpc/call_object.c+1−0
@@ -686,6 +686,7 @@ static void rxrpc_destroy_call(struct work_struct *work) · 685 unmodified lines
686686
687687 del_timer_sync(&call->timer);
688688
689+ rxrpc_free_skb(call->cong_last_nack, rxrpc_skb_put_last_nack);
689690 rxrpc_cleanup_ring(call);
690691 while ((txb = list_first_entry_or_null(&call->tx_sendmsg,
691692 struct rxrpc_txbuf, call_link))) {
net/rxrpc/conn_event.c+9−1
@@ -95,6 +95,14 @@ void rxrpc_conn_retransmit_call(struct rxrpc_connection *conn, · 94 unmodified lines
9595
9696 _enter("%d", conn->debug_id);
9797
98+ if (sp && sp->hdr.type == RXRPC_PACKET_TYPE_ACK) {
99+ if (skb_copy_bits(skb, sizeof(struct rxrpc_wire_header),
100+ &pkt.ack, sizeof(pkt.ack)) < 0)
101+ return;
102+ if (pkt.ack.reason == RXRPC_ACK_PING_RESPONSE)
103+ return;
104+ }
105+
98106 chan = &conn->channels[channel];
99107
100108 /* If the last call got moved on whilst we were waiting to run, just
@@ -117,7 +125,7 @@ void rxrpc_conn_retransmit_call(struct rxrpc_connection *conn, · 16 unmodified lines
117125 iov[2].iov_base = &ack_info;
118126 iov[2].iov_len = sizeof(ack_info);
119127
120− serial = atomic_inc_return(&conn->serial);
128+ serial = rxrpc_get_next_serial(conn);
121129
122130 pkt.whdr.epoch = htonl(conn->proto.epoch);
123131 pkt.whdr.cid = htonl(conn->proto.cid | channel);
net/rxrpc/input.c+97−18
@@ -45,11 +45,9 @@ static void rxrpc_congestion_management(struct rxrpc_call *call, · 44 unmodified lines
4545 }
4646
4747 cumulative_acks += summary->nr_new_acks;
48− cumulative_acks += summary->nr_rot_new_acks;
4948 if (cumulative_acks > 255)
5049 cumulative_acks = 255;
5150
52− summary->mode = call->cong_mode;
5351 summary->cwnd = call->cong_cwnd;
5452 summary->ssthresh = call->cong_ssthresh;
5553 summary->cumulative_acks = cumulative_acks;
@@ -151,6 +149,7 @@ out_no_clear_ca: · 95 unmodified lines
151149 cwnd = RXRPC_TX_MAX_WINDOW;
152150 call->cong_cwnd = cwnd;
153151 call->cong_cumul_acks = cumulative_acks;
152+ summary->mode = call->cong_mode;
154153 trace_rxrpc_congest(call, summary, acked_serial, change);
155154 if (resend)
156155 rxrpc_resend(call, skb);
@@ -213,7 +212,6 @@ static bool rxrpc_rotate_tx_window(struct rxrpc_call *call, rxrpc_seq_t to, · 56 unmodified lines
213212 list_for_each_entry_rcu(txb, &call->tx_buffer, call_link, false) {
214213 if (before_eq(txb->seq, call->acks_hard_ack))
215214 continue;
216− summary->nr_rot_new_acks++;
217215 if (test_bit(RXRPC_TXBUF_LAST, &txb->flags)) {
218216 set_bit(RXRPC_CALL_TX_LAST, &call->flags);
219217 rot_last = true;
@@ -254,6 +252,11 @@ static void rxrpc_end_tx_phase(struct rxrpc_call *call, bool reply_begun, · 34 unmodified lines
254252 {
255253 ASSERT(test_bit(RXRPC_CALL_TX_LAST, &call->flags));
256254
255+ if (unlikely(call->cong_last_nack)) {
256+ rxrpc_free_skb(call->cong_last_nack, rxrpc_skb_put_last_nack);
257+ call->cong_last_nack = NULL;
258+ }
259+
257260 switch (__rxrpc_call_state(call)) {
258261 case RXRPC_CALL_CLIENT_SEND_REQUEST:
259262 case RXRPC_CALL_CLIENT_AWAIT_REPLY:
@@ -702,6 +705,43 @@ static void rxrpc_input_ackinfo(struct rxrpc_call *call, struct sk_buff *skb, · 442 unmodified lines
702705 wake_up(&call->waitq);
703706 }
704707
708+/*
709+ * Determine how many nacks from the previous ACK have now been satisfied.
710+ */
711+static rxrpc_seq_t rxrpc_input_check_prev_ack(struct rxrpc_call *call,
712+ struct rxrpc_ack_summary *summary,
713+ rxrpc_seq_t seq)
714+{
715+ struct sk_buff *skb = call->cong_last_nack;
716+ struct rxrpc_ackpacket ack;
717+ struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
718+ unsigned int i, new_acks = 0, retained_nacks = 0;
719+ rxrpc_seq_t old_seq = sp->first_ack;
720+ u8 *acks = skb->data + sizeof(struct rxrpc_wire_header) + sizeof(ack);
721+
722+ if (after_eq(seq, old_seq + sp->nr_acks)) {
723+ summary->nr_new_acks += sp->nr_nacks;
724+ summary->nr_new_acks += seq - (old_seq + sp->nr_acks);
725+ summary->nr_retained_nacks = 0;
726+ } else if (seq == old_seq) {
727+ summary->nr_retained_nacks = sp->nr_nacks;
728+ } else {
729+ for (i = 0; i < sp->nr_acks; i++) {
730+ if (acks[i] == RXRPC_ACK_TYPE_NACK) {
731+ if (before(old_seq + i, seq))
732+ new_acks++;
733+ else
734+ retained_nacks++;
735+ }
736+ }
737+
738+ summary->nr_new_acks += new_acks;
739+ summary->nr_retained_nacks = retained_nacks;
740+ }
741+
742+ return old_seq + sp->nr_acks;
743+}
744+
705745 /*
706746 * Process individual soft ACKs.
707747 *
@@ -711,25 +751,51 @@ static void rxrpc_input_ackinfo(struct rxrpc_call *call, struct sk_buff *skb, · 3 unmodified lines
711751 * the timer on the basis that the peer might just not have processed them at
712752 * the time the ACK was sent.
713753 */
714−static void rxrpc_input_soft_acks(struct rxrpc_call *call, u8 *acks,
715− rxrpc_seq_t seq, int nr_acks,
716− struct rxrpc_ack_summary *summary)
754+static void rxrpc_input_soft_acks(struct rxrpc_call *call,
755+ struct rxrpc_ack_summary *summary,
756+ struct sk_buff *skb,
757+ rxrpc_seq_t seq,
758+ rxrpc_seq_t since)
717759 {
718− unsigned int i;
760+ struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
761+ unsigned int i, old_nacks = 0;
762+ rxrpc_seq_t lowest_nak = seq + sp->nr_acks;
763+ u8 *acks = skb->data + sizeof(struct rxrpc_wire_header) + sizeof(struct rxrpc_ackpacket);
719764
720− for (i = 0; i < nr_acks; i++) {
765+ for (i = 0; i < sp->nr_acks; i++) {
721766 if (acks[i] == RXRPC_ACK_TYPE_ACK) {
722767 summary->nr_acks++;
723− summary->nr_new_acks++;
768+ if (after_eq(seq, since))
769+ summary->nr_new_acks++;
724770 } else {
725− if (!summary->saw_nacks &&
726− call->acks_lowest_nak != seq + i) {
727− call->acks_lowest_nak = seq + i;
728− summary->new_low_nack = true;
729− }
730771 summary->saw_nacks = true;
772+ if (before(seq, since)) {
773+ /* Overlap with previous ACK */
774+ old_nacks++;
775+ } else {
776+ summary->nr_new_nacks++;
777+ sp->nr_nacks++;
778+ }
779+
780+ if (before(seq, lowest_nak))
781+ lowest_nak = seq;
731782 }
783+ seq++;
784+ }
785+
786+ if (lowest_nak != call->acks_lowest_nak) {
787+ call->acks_lowest_nak = lowest_nak;
788+ summary->new_low_nack = true;
732789 }
790+
791+ /* We *can* have more nacks than we did - the peer is permitted to drop
792+ * packets it has soft-acked and re-request them. Further, it is
793+ * possible for the nack distribution to change whilst the number of
794+ * nacks stays the same or goes down.
795+ */
796+ if (old_nacks < summary->nr_retained_nacks)
797+ summary->nr_new_acks += summary->nr_retained_nacks - old_nacks;
798+ summary->nr_retained_nacks = old_nacks;
733799 }
734800
735801 /*
@@ -773,7 +839,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) · 37 unmodified lines
773839 struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
774840 struct rxrpc_ackinfo info;
775841 rxrpc_serial_t ack_serial, acked_serial;
776− rxrpc_seq_t first_soft_ack, hard_ack, prev_pkt;
842+ rxrpc_seq_t first_soft_ack, hard_ack, prev_pkt, since;
777843 int nr_acks, offset, ioffset;
778844
779845 _enter("");
@@ -789,6 +855,8 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) · 9 unmodified lines
789855 prev_pkt = ntohl(ack.previousPacket);
790856 hard_ack = first_soft_ack - 1;
791857 nr_acks = ack.nAcks;
858+ sp->first_ack = first_soft_ack;
859+ sp->nr_acks = nr_acks;
792860 summary.ack_reason = (ack.reason < RXRPC_ACK__INVALID ?
793861 ack.reason : RXRPC_ACK__INVALID);
794862
@@ -858,6 +926,16 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) · 63 unmodified lines
858926 if (nr_acks > 0)
859927 skb_condense(skb);
860928
929+ if (call->cong_last_nack) {
930+ since = rxrpc_input_check_prev_ack(call, &summary, first_soft_ack);
931+ rxrpc_free_skb(call->cong_last_nack, rxrpc_skb_put_last_nack);
932+ call->cong_last_nack = NULL;
933+ } else {
934+ summary.nr_new_acks = first_soft_ack - call->acks_first_seq;
935+ call->acks_lowest_nak = first_soft_ack + nr_acks;
936+ since = first_soft_ack;
937+ }
938+
861939 call->acks_latest_ts = skb->tstamp;
862940 call->acks_first_seq = first_soft_ack;
863941 call->acks_prev_seq = prev_pkt;
@@ -866,7 +944,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) · 2 unmodified lines
866944 case RXRPC_ACK_PING:
867945 break;
868946 default:
869− if (after(acked_serial, call->acks_highest_serial))
947+ if (acked_serial && after(acked_serial, call->acks_highest_serial))
870948 call->acks_highest_serial = acked_serial;
871949 break;
872950 }
@@ -905,8 +983,9 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) · 32 unmodified lines
905983 if (nr_acks > 0) {
906984 if (offset > (int)skb->len - nr_acks)
907985 return rxrpc_proto_abort(call, 0, rxrpc_eproto_ackr_short_sack);
908− rxrpc_input_soft_acks(call, skb->data + offset, first_soft_ack,
909− nr_acks, &summary);
986+ rxrpc_input_soft_acks(call, &summary, skb, first_soft_ack, since);
987+ rxrpc_get_skb(skb, rxrpc_skb_get_last_nack);
988+ call->cong_last_nack = skb;
910989 }
911990
912991 if (test_bit(RXRPC_CALL_TX_LAST, &call->flags) &&
net/rxrpc/output.c+4−4
@@ -216,7 +216,7 @@ int rxrpc_send_ack_packet(struct rxrpc_call *call, struct rxrpc_txbuf *txb) · 215 unmodified lines
216216 iov[0].iov_len = sizeof(txb->wire) + sizeof(txb->ack) + n;
217217 len = iov[0].iov_len;
218218
219− serial = atomic_inc_return(&conn->serial);
219+ serial = rxrpc_get_next_serial(conn);
220220 txb->wire.serial = htonl(serial);
221221 trace_rxrpc_tx_ack(call->debug_id, serial,
222222 ntohl(txb->ack.firstPacket),
@@ -302,7 +302,7 @@ int rxrpc_send_abort_packet(struct rxrpc_call *call) · 79 unmodified lines
302302 iov[0].iov_base = &pkt;
303303 iov[0].iov_len = sizeof(pkt);
304304
305− serial = atomic_inc_return(&conn->serial);
305+ serial = rxrpc_get_next_serial(conn);
306306 pkt.whdr.serial = htonl(serial);
307307
308308 iov_iter_kvec(&msg.msg_iter, WRITE, iov, 1, sizeof(pkt));
@@ -334,7 +334,7 @@ int rxrpc_send_data_packet(struct rxrpc_call *call, struct rxrpc_txbuf *txb) · 25 unmodified lines
334334 _enter("%x,{%d}", txb->seq, txb->len);
335335
336336 /* Each transmission of a Tx packet needs a new serial number */
337− serial = atomic_inc_return(&conn->serial);
337+ serial = rxrpc_get_next_serial(conn);
338338 txb->wire.serial = htonl(serial);
339339
340340 if (test_bit(RXRPC_CONN_PROBING_FOR_UPGRADE, &conn->flags) &&
@@ -558,7 +558,7 @@ void rxrpc_send_conn_abort(struct rxrpc_connection *conn) · 217 unmodified lines
558558
559559 len = iov[0].iov_len + iov[1].iov_len;
560560
561− serial = atomic_inc_return(&conn->serial);
561+ serial = rxrpc_get_next_serial(conn);
562562 whdr.serial = htonl(serial);
563563
564564 iov_iter_kvec(&msg.msg_iter, WRITE, iov, 2, len);
net/rxrpc/proc.c+1−1
@@ -181,7 +181,7 @@ print: · 180 unmodified lines
181181 atomic_read(&conn->active),
182182 state,
183183 key_serial(conn->key),
184− atomic_read(&conn->serial),
184+ conn->tx_serial,
185185 conn->hi_serial,
186186 conn->channels[0].call_id,
187187 conn->channels[1].call_id,
net/rxrpc/rxkad.c+2−2
@@ -664,7 +664,7 @@ static int rxkad_issue_challenge(struct rxrpc_connection *conn) · 663 unmodified lines
664664
665665 len = iov[0].iov_len + iov[1].iov_len;
666666
667− serial = atomic_inc_return(&conn->serial);
667+ serial = rxrpc_get_next_serial(conn);
668668 whdr.serial = htonl(serial);
669669
670670 ret = kernel_sendmsg(conn->local->socket, &msg, iov, 2, len);
@@ -721,7 +721,7 @@ static int rxkad_send_response(struct rxrpc_connection *conn, · 50 unmodified lines
721721
722722 len = iov[0].iov_len + iov[1].iov_len + iov[2].iov_len;
723723
724− serial = atomic_inc_return(&conn->serial);
724+ serial = rxrpc_get_next_serial(conn);
725725 whdr.serial = htonl(serial);
726726
727727 rxrpc_local_dont_fragment(conn->local, false);
net/tipc/bearer.c+6−0
@@ -1086,6 +1086,12 @@ int tipc_nl_bearer_add(struct sk_buff *skb, struct genl_info *info) · 1085 unmodified lines
10861086
10871087 #ifdef CONFIG_TIPC_MEDIA_UDP
10881088 if (attrs[TIPC_NLA_BEARER_UDP_OPTS]) {
1089+ if (b->media->type_id != TIPC_MEDIA_TYPE_UDP) {
1090+ rtnl_unlock();
1091+ NL_SET_ERR_MSG(info->extack, "UDP option is unsupported");
1092+ return -EINVAL;
1093+ }
1094+
10891095 err = tipc_udp_nl_bearer_add(b,
10901096 attrs[TIPC_NLA_BEARER_UDP_OPTS]);
10911097 if (err) {
net/unix/garbage.c+11−0
@@ -339,6 +339,17 @@ static void __unix_gc(struct work_struct *work) · 338 unmodified lines
339339 /* Here we are. Hitlist is filled. Die. */
340340 __skb_queue_purge(&hitlist);
341341
342+#if IS_ENABLED(CONFIG_AF_UNIX_OOB)
343+ list_for_each_entry_safe(u, next, &gc_candidates, link) {
344+ struct sk_buff *skb = u->oob_skb;
345+
346+ if (skb) {
347+ u->oob_skb = NULL;
348+ kfree_skb(skb);
349+ }
350+ }
351+#endif
352+
342353 spin_lock(&unix_gc_lock);
343354
344355 /* All candidates should have been detached by now. */
net/wireless/core.c+2−1
@@ -5,7 +5,7 @@ · 4 unmodified lines
55 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
66 * Copyright 2013-2014 Intel Mobile Communications GmbH
77 * Copyright 2015-2017 Intel Deutschland GmbH
8− * Copyright (C) 2018-2023 Intel Corporation
8+ * Copyright (C) 2018-2024 Intel Corporation
99 */
1010
1111 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
@@ -1661,6 +1661,7 @@ void wiphy_delayed_work_queue(struct wiphy *wiphy, · 1649 unmodified lines
16611661 unsigned long delay)
16621662 {
16631663 if (!delay) {
1664+ del_timer(&dwork->timer);
16641665 wiphy_work_queue(wiphy, &dwork->work);
16651666 return;
16661667 }
net/wireless/scan.c+58−1
@@ -1731,6 +1731,61 @@ static void cfg80211_update_hidden_bsses(struct cfg80211_internal_bss *known, · 1730 unmodified lines
17311731 }
17321732 }
17331733
1734+static void cfg80211_check_stuck_ecsa(struct cfg80211_registered_device *rdev,
1735+ struct cfg80211_internal_bss *known,
1736+ const struct cfg80211_bss_ies *old)
1737+{
1738+ const struct ieee80211_ext_chansw_ie *ecsa;
1739+ const struct element *elem_new, *elem_old;
1740+ const struct cfg80211_bss_ies *new, *bcn;
1741+
1742+ if (known->pub.proberesp_ecsa_stuck)
1743+ return;
1744+
1745+ new = rcu_dereference_protected(known->pub.proberesp_ies,
1746+ lockdep_is_held(&rdev->bss_lock));
1747+ if (WARN_ON(!new))
1748+ return;
1749+
1750+ if (new->tsf - old->tsf < USEC_PER_SEC)
1751+ return;
1752+
1753+ elem_old = cfg80211_find_elem(WLAN_EID_EXT_CHANSWITCH_ANN,
1754+ old->data, old->len);
1755+ if (!elem_old)
1756+ return;
1757+
1758+ elem_new = cfg80211_find_elem(WLAN_EID_EXT_CHANSWITCH_ANN,
1759+ new->data, new->len);
1760+ if (!elem_new)
1761+ return;
1762+
1763+ bcn = rcu_dereference_protected(known->pub.beacon_ies,
1764+ lockdep_is_held(&rdev->bss_lock));
1765+ if (bcn &&
1766+ cfg80211_find_elem(WLAN_EID_EXT_CHANSWITCH_ANN,
1767+ bcn->data, bcn->len))
1768+ return;
1769+
1770+ if (elem_new->datalen != elem_old->datalen)
1771+ return;
1772+ if (elem_new->datalen < sizeof(struct ieee80211_ext_chansw_ie))
1773+ return;
1774+ if (memcmp(elem_new->data, elem_old->data, elem_new->datalen))
1775+ return;
1776+
1777+ ecsa = (void *)elem_new->data;
1778+
1779+ if (!ecsa->mode)
1780+ return;
1781+
1782+ if (ecsa->new_ch_num !=
1783+ ieee80211_frequency_to_channel(known->pub.channel->center_freq))
1784+ return;
1785+
1786+ known->pub.proberesp_ecsa_stuck = 1;
1787+}
1788+
17341789 static bool
17351790 cfg80211_update_known_bss(struct cfg80211_registered_device *rdev,
17361791 struct cfg80211_internal_bss *known,
@@ -1750,8 +1805,10 @@ cfg80211_update_known_bss(struct cfg80211_registered_device *rdev, · 13 unmodified lines
17501805 /* Override possible earlier Beacon frame IEs */
17511806 rcu_assign_pointer(known->pub.ies,
17521807 new->pub.proberesp_ies);
1753− if (old)
1808+ if (old) {
1809+ cfg80211_check_stuck_ecsa(rdev, known, old);
17541810 kfree_rcu((struct cfg80211_bss_ies *)old, rcu_head);
1811+ }
17551812 }
17561813
17571814 if (rcu_access_pointer(new->pub.beacon_ies)) {
sound/core/pcm.c+4−0
@@ -211,6 +211,10 @@ static const char * const snd_pcm_format_names[] = { · 210 unmodified lines
211211 FORMAT(DSD_U32_LE),
212212 FORMAT(DSD_U16_BE),
213213 FORMAT(DSD_U32_BE),
214+ FORMAT(S20_LE),
215+ FORMAT(S20_BE),
216+ FORMAT(U20_LE),
217+ FORMAT(U20_BE),
214218 };
215219
216220 /**
sound/pci/hda/cs35l41_hda_property.c+4−0
@@ -76,6 +76,8 @@ static const struct cs35l41_config cs35l41_config_table[] = { · 75 unmodified lines
7676 { "10431533", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
7777 { "10431573", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
7878 { "10431663", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, -1, 0, 1000, 4500, 24 },
79+ { "10431683", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
80+ { "104316A3", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 0, 0, 0 },
7981 { "104316D3", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 0, 0, 0 },
8082 { "104316F3", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 0, 0, 0 },
8183 { "104317F3", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
@@ -410,6 +412,8 @@ static const struct cs35l41_prop_model cs35l41_prop_model_table[] = { · 328 unmodified lines
410412 { "CSC3551", "10431533", generic_dsd_config },
411413 { "CSC3551", "10431573", generic_dsd_config },
412414 { "CSC3551", "10431663", generic_dsd_config },
415+ { "CSC3551", "10431683", generic_dsd_config },
416+ { "CSC3551", "104316A3", generic_dsd_config },
413417 { "CSC3551", "104316D3", generic_dsd_config },
414418 { "CSC3551", "104316F3", generic_dsd_config },
415419 { "CSC3551", "104317F3", generic_dsd_config },
sound/pci/hda/cs35l56_hda.c+77−59
@@ -30,14 +30,23 @@ · 29 unmodified lines
3030 * ASP1_RX_WL = 24 bits per sample
3131 * ASP1_TX_WL = 24 bits per sample
3232 * ASP1_RXn_EN 1..3 and ASP1_TXn_EN 1..4 disabled
33+ *
34+ * Override any Windows-specific mixer settings applied by the firmware.
3335 */
3436 static const struct reg_sequence cs35l56_hda_dai_config[] = {
3537 { CS35L56_ASP1_CONTROL1, 0x00000021 },
3638 { CS35L56_ASP1_CONTROL2, 0x20200200 },
3739 { CS35L56_ASP1_CONTROL3, 0x00000003 },
40+ { CS35L56_ASP1_FRAME_CONTROL1, 0x03020100 },
41+ { CS35L56_ASP1_FRAME_CONTROL5, 0x00020100 },
3842 { CS35L56_ASP1_DATA_CONTROL5, 0x00000018 },
3943 { CS35L56_ASP1_DATA_CONTROL1, 0x00000018 },
4044 { CS35L56_ASP1_ENABLES1, 0x00000000 },
45+ { CS35L56_ASP1TX1_INPUT, 0x00000018 },
46+ { CS35L56_ASP1TX2_INPUT, 0x00000019 },
47+ { CS35L56_ASP1TX3_INPUT, 0x00000020 },
48+ { CS35L56_ASP1TX4_INPUT, 0x00000028 },
49+
4150 };
4251
4352 static void cs35l56_hda_play(struct cs35l56_hda *cs35l56)
@@ -133,6 +142,10 @@ static int cs35l56_hda_runtime_resume(struct device *dev) · 89 unmodified lines
133142 }
134143 }
135144
145+ ret = cs35l56_force_sync_asp1_registers_from_cache(&cs35l56->base);
146+ if (ret)
147+ goto err;
148+
136149 return 0;
137150
138151 err:
@@ -384,7 +397,7 @@ static const struct cs_dsp_client_ops cs35l56_hda_client_ops = { · 245 unmodified lines
384397
385398 static int cs35l56_hda_request_firmware_file(struct cs35l56_hda *cs35l56,
386399 const struct firmware **firmware, char **filename,
387− const char *dir, const char *system_name,
400+ const char *base_name, const char *system_name,
388401 const char *amp_name,
389402 const char *filetype)
390403 {
@@ -392,17 +405,13 @@ static int cs35l56_hda_request_firmware_file(struct cs35l56_hda *cs35l56, · 1 unmodified line
392405 int ret = 0;
393406
394407 if (system_name && amp_name)
395− *filename = kasprintf(GFP_KERNEL, "%scs35l56%s-%02x-dsp1-misc-%s-%s.%s", dir,
396− cs35l56->base.secured ? "s" : "", cs35l56->base.rev,
408+ *filename = kasprintf(GFP_KERNEL, "%s-%s-%s.%s", base_name,
397409 system_name, amp_name, filetype);
398410 else if (system_name)
399− *filename = kasprintf(GFP_KERNEL, "%scs35l56%s-%02x-dsp1-misc-%s.%s", dir,
400− cs35l56->base.secured ? "s" : "", cs35l56->base.rev,
411+ *filename = kasprintf(GFP_KERNEL, "%s-%s.%s", base_name,
401412 system_name, filetype);
402413 else
403− *filename = kasprintf(GFP_KERNEL, "%scs35l56%s-%02x-dsp1-misc.%s", dir,
404− cs35l56->base.secured ? "s" : "", cs35l56->base.rev,
405− filetype);
414+ *filename = kasprintf(GFP_KERNEL, "%s.%s", base_name, filetype);
406415
407416 if (!*filename)
408417 return -ENOMEM;
@@ -435,8 +444,8 @@ static int cs35l56_hda_request_firmware_file(struct cs35l56_hda *cs35l56, · 26 unmodified lines
435444 return 0;
436445 }
437446
438−static const char cirrus_dir[] = "cirrus/";
439447 static void cs35l56_hda_request_firmware_files(struct cs35l56_hda *cs35l56,
448+ unsigned int preloaded_fw_ver,
440449 const struct firmware **wmfw_firmware,
441450 char **wmfw_filename,
442451 const struct firmware **coeff_firmware,
@@ -444,55 +453,73 @@ static void cs35l56_hda_request_firmware_files(struct cs35l56_hda *cs35l56, · 1 unmodified line
444453 {
445454 const char *system_name = cs35l56->system_name;
446455 const char *amp_name = cs35l56->amp_name;
456+ char base_name[37];
447457 int ret;
448458
459+ if (preloaded_fw_ver) {
460+ snprintf(base_name, sizeof(base_name),
461+ "cirrus/cs35l56-%02x%s-%06x-dsp1-misc",
462+ cs35l56->base.rev,
463+ cs35l56->base.secured ? "-s" : "",
464+ preloaded_fw_ver & 0xffffff);
465+ } else {
466+ snprintf(base_name, sizeof(base_name),
467+ "cirrus/cs35l56-%02x%s-dsp1-misc",
468+ cs35l56->base.rev,
469+ cs35l56->base.secured ? "-s" : "");
470+ }
471+
449472 if (system_name && amp_name) {
450473 if (!cs35l56_hda_request_firmware_file(cs35l56, wmfw_firmware, wmfw_filename,
451− cirrus_dir, system_name, amp_name, "wmfw")) {
474+ base_name, system_name, amp_name, "wmfw")) {
452475 cs35l56_hda_request_firmware_file(cs35l56, coeff_firmware, coeff_filename,
453− cirrus_dir, system_name, amp_name, "bin");
476+ base_name, system_name, amp_name, "bin");
454477 return;
455478 }
456479 }
457480
458481 if (system_name) {
459482 if (!cs35l56_hda_request_firmware_file(cs35l56, wmfw_firmware, wmfw_filename,
460− cirrus_dir, system_name, NULL, "wmfw")) {
483+ base_name, system_name, NULL, "wmfw")) {
461484 if (amp_name)
462485 cs35l56_hda_request_firmware_file(cs35l56,
463486 coeff_firmware, coeff_filename,
464− cirrus_dir, system_name,
487+ base_name, system_name,
465488 amp_name, "bin");
466489 if (!*coeff_firmware)
467490 cs35l56_hda_request_firmware_file(cs35l56,
468491 coeff_firmware, coeff_filename,
469− cirrus_dir, system_name,
492+ base_name, system_name,
470493 NULL, "bin");
471494 return;
472495 }
496+
497+ /*
498+ * Check for system-specific bin files without wmfw before
499+ * falling back to generic firmware
500+ */
501+ if (amp_name)
502+ cs35l56_hda_request_firmware_file(cs35l56, coeff_firmware, coeff_filename,
503+ base_name, system_name, amp_name, "bin");
504+ if (!*coeff_firmware)
505+ cs35l56_hda_request_firmware_file(cs35l56, coeff_firmware, coeff_filename,
506+ base_name, system_name, NULL, "bin");
507+
508+ if (*coeff_firmware)
509+ return;
473510 }
474511
475512 ret = cs35l56_hda_request_firmware_file(cs35l56, wmfw_firmware, wmfw_filename,
476− cirrus_dir, NULL, NULL, "wmfw");
513+ base_name, NULL, NULL, "wmfw");
477514 if (!ret) {
478515 cs35l56_hda_request_firmware_file(cs35l56, coeff_firmware, coeff_filename,
479− cirrus_dir, NULL, NULL, "bin");
516+ base_name, NULL, NULL, "bin");
480517 return;
481518 }
482519
483− /* When a firmware file is not found must still search for the coeff files */
484− if (system_name) {
485− if (amp_name)
486− cs35l56_hda_request_firmware_file(cs35l56, coeff_firmware, coeff_filename,
487− cirrus_dir, system_name, amp_name, "bin");
488− if (!*coeff_firmware)
489− cs35l56_hda_request_firmware_file(cs35l56, coeff_firmware, coeff_filename,
490− cirrus_dir, system_name, NULL, "bin");
491− }
492−
493520 if (!*coeff_firmware)
494521 cs35l56_hda_request_firmware_file(cs35l56, coeff_firmware, coeff_filename,
495− cirrus_dir, NULL, NULL, "bin");
522+ base_name, NULL, NULL, "bin");
496523 }
497524
498525 static void cs35l56_hda_release_firmware_files(const struct firmware *wmfw_firmware,
@@ -526,7 +553,8 @@ static int cs35l56_hda_fw_load(struct cs35l56_hda *cs35l56) · 27 unmodified lines
526553 const struct firmware *wmfw_firmware = NULL;
527554 char *coeff_filename = NULL;
528555 char *wmfw_filename = NULL;
529− unsigned int firmware_missing;
556+ unsigned int preloaded_fw_ver;
557+ bool firmware_missing;
530558 int ret = 0;
531559
532560 /* Prepare for a new DSP power-up */
@@ -537,24 +565,21 @@ static int cs35l56_hda_fw_load(struct cs35l56_hda *cs35l56) · 4 unmodified lines
537565
538566 pm_runtime_get_sync(cs35l56->base.dev);
539567
540− ret = regmap_read(cs35l56->base.regmap, CS35L56_PROTECTION_STATUS, &firmware_missing);
541− if (ret) {
542− dev_err(cs35l56->base.dev, "Failed to read PROTECTION_STATUS: %d\n", ret);
568+ /*
569+ * The firmware can only be upgraded if it is currently running
570+ * from the built-in ROM. If not, the wmfw/bin must be for the
571+ * version of firmware that is running on the chip.
572+ */
573+ ret = cs35l56_read_prot_status(&cs35l56->base, &firmware_missing, &preloaded_fw_ver);
574+ if (ret)
543575 goto err_pm_put;
544− }
545576
546− firmware_missing &= CS35L56_FIRMWARE_MISSING;
577+ if (firmware_missing)
578+ preloaded_fw_ver = 0;
547579
548− /*
549− * Firmware can only be downloaded if the CS35L56 is secured or is
550− * running from the built-in ROM. If it is secured the BIOS will have
551− * downloaded firmware, and the wmfw/bin files will only contain
552− * tunings that are safe to download with the firmware running.
553− */
554− if (cs35l56->base.secured || firmware_missing) {
555− cs35l56_hda_request_firmware_files(cs35l56, &wmfw_firmware, &wmfw_filename,
556− &coeff_firmware, &coeff_filename);
557− }
580+ cs35l56_hda_request_firmware_files(cs35l56, preloaded_fw_ver,
581+ &wmfw_firmware, &wmfw_filename,
582+ &coeff_firmware, &coeff_filename);
558583
559584 /*
560585 * If the BIOS didn't patch the firmware a bin file is mandatory to
@@ -569,12 +594,12 @@ static int cs35l56_hda_fw_load(struct cs35l56_hda *cs35l56) · 8 unmodified lines
569594 mutex_lock(&cs35l56->base.irq_lock);
570595
571596 /*
572− * When the device is running in secure mode the firmware files can
573− * only contain insecure tunings and therefore we do not need to
574− * shutdown the firmware to apply them and can use the lower cost
575− * reinit sequence instead.
597+ * If the firmware hasn't been patched it must be shutdown before
598+ * doing a full patch and reset afterwards. If it is already
599+ * running a patched version the firmware files only contain
600+ * tunings and we can use the lower cost reinit sequence instead.
576601 */
577− if (!cs35l56->base.secured && (wmfw_firmware || coeff_firmware)) {
602+ if (firmware_missing && (wmfw_firmware || coeff_firmware)) {
578603 ret = cs35l56_firmware_shutdown(&cs35l56->base);
579604 if (ret)
580605 goto err;
@@ -593,7 +618,7 @@ static int cs35l56_hda_fw_load(struct cs35l56_hda *cs35l56) · 12 unmodified lines
593618 if (coeff_filename)
594619 dev_dbg(cs35l56->base.dev, "Loaded Coefficients: %s\n", coeff_filename);
595620
596− if (cs35l56->base.secured) {
621+ if (!firmware_missing) {
597622 ret = cs35l56_mbox_send(&cs35l56->base, CS35L56_MBOX_CMD_AUDIO_REINIT);
598623 if (ret)
599624 goto err_powered_up;
@@ -976,6 +1001,9 @@ int cs35l56_hda_common_probe(struct cs35l56_hda *cs35l56, int id) · 376 unmodified lines
9761001
9771002 regmap_multi_reg_write(cs35l56->base.regmap, cs35l56_hda_dai_config,
9781003 ARRAY_SIZE(cs35l56_hda_dai_config));
1004+ ret = cs35l56_force_sync_asp1_registers_from_cache(&cs35l56->base);
1005+ if (ret)
1006+ goto err;
9791007
9801008 /*
9811009 * By default only enable one ASP1TXn, where n=amplifier index,
@@ -1035,16 +1063,6 @@ const struct dev_pm_ops cs35l56_hda_pm_ops = { · 53 unmodified lines
10351063 };
10361064 EXPORT_SYMBOL_NS_GPL(cs35l56_hda_pm_ops, SND_HDA_SCODEC_CS35L56);
10371065
1038−#if IS_ENABLED(CONFIG_SND_HDA_SCODEC_CS35L56_KUNIT_TEST)
1039−/* Hooks to export static function to KUnit test */
1040−
1041−int cs35l56_hda_test_hook_get_speaker_id(struct device *dev, int amp_index, int num_amps)
1042−{
1043− return cs35l56_hda_get_speaker_id(dev, amp_index, num_amps);
1044−}
1045−EXPORT_SYMBOL_NS_GPL(cs35l56_hda_test_hook_get_speaker_id, SND_HDA_SCODEC_CS35L56);
1046−#endif
1047−
10481066 MODULE_DESCRIPTION("CS35L56 HDA Driver");
10491067 MODULE_IMPORT_NS(SND_HDA_CIRRUS_SCODEC);
10501068 MODULE_IMPORT_NS(SND_HDA_CS_DSP_CONTROLS);
sound/pci/hda/hda_intel.c+4−2
@@ -1729,9 +1729,11 @@ static int default_bdl_pos_adj(struct azx *chip) · 1728 unmodified lines
17291729 /* some exceptions: Atoms seem problematic with value 1 */
17301730 if (chip->pci->vendor == PCI_VENDOR_ID_INTEL) {
17311731 switch (chip->pci->device) {
1732− case 0x0f04: /* Baytrail */
1733− case 0x2284: /* Braswell */
1732+ case PCI_DEVICE_ID_INTEL_HDA_BYT:
1733+ case PCI_DEVICE_ID_INTEL_HDA_BSW:
17341734 return 32;
1735+ case PCI_DEVICE_ID_INTEL_HDA_APL:
1736+ return 64;
17351737 }
17361738 }
17371739
sound/pci/hda/patch_cs8409.c+1−0
@@ -1371,6 +1371,7 @@ void dolphin_fixups(struct hda_codec *codec, const struct hda_fixup *fix, int ac · 1370 unmodified lines
13711371 spec->scodecs[CS8409_CODEC1] = &dolphin_cs42l42_1;
13721372 spec->scodecs[CS8409_CODEC1]->codec = codec;
13731373 spec->num_scodecs = 2;
1374+ spec->gen.suppress_vmaster = 1;
13741375
13751376 codec->patch_ops = cs8409_dolphin_patch_ops;
13761377
sound/pci/hda/patch_realtek.c+13−3
@@ -439,6 +439,10 @@ static void alc_fill_eapd_coef(struct hda_codec *codec) · 438 unmodified lines
439439 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
440440 fallthrough;
441441 case 0x10ec0215:
442+ case 0x10ec0285:
443+ case 0x10ec0289:
444+ alc_update_coef_idx(codec, 0x36, 1<<13, 0);
445+ fallthrough;
442446 case 0x10ec0230:
443447 case 0x10ec0233:
444448 case 0x10ec0235:
@@ -452,9 +456,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec) · 7 unmodified lines
452456 case 0x10ec0283:
453457 case 0x10ec0286:
454458 case 0x10ec0288:
455− case 0x10ec0285:
456459 case 0x10ec0298:
457− case 0x10ec0289:
458460 case 0x10ec0300:
459461 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
460462 break;
@@ -9577,7 +9579,7 @@ static const struct hda_fixup alc269_fixups[] = { · 9116 unmodified lines
95779579 .type = HDA_FIXUP_FUNC,
95789580 .v.func = cs35l41_fixup_i2c_two,
95799581 .chained = true,
9580− .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
9582+ .chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
95819583 },
95829584 [ALC287_FIXUP_TAS2781_I2C] = {
95839585 .type = HDA_FIXUP_FUNC,
@@ -9604,6 +9606,8 @@ static const struct hda_fixup alc269_fixups[] = { · 20 unmodified lines
96049606 [ALC287_FIXUP_THINKPAD_I2S_SPK] = {
96059607 .type = HDA_FIXUP_FUNC,
96069608 .v.func = alc287_fixup_bind_dacs,
9609+ .chained = true,
9610+ .chain_id = ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
96079611 },
96089612 [ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD] = {
96099613 .type = HDA_FIXUP_FUNC,
@@ -9653,6 +9657,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 43 unmodified lines
96539657 SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
96549658 SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
96559659 SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
9660+ SND_PCI_QUIRK(0x1025, 0x126a, "Acer Swift SF114-32", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
96569661 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
96579662 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
96589663 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
@@ -9732,6 +9737,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 73 unmodified lines
97329737 SND_PCI_QUIRK(0x1028, 0x0b71, "Dell Inspiron 16 Plus 7620", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
97339738 SND_PCI_QUIRK(0x1028, 0x0beb, "Dell XPS 15 9530 (2023)", ALC289_FIXUP_DELL_CS35L41_SPI_2),
97349739 SND_PCI_QUIRK(0x1028, 0x0c03, "Dell Precision 5340", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
9740+ SND_PCI_QUIRK(0x1028, 0x0c0d, "Dell Oasis", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
97359741 SND_PCI_QUIRK(0x1028, 0x0c19, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
97369742 SND_PCI_QUIRK(0x1028, 0x0c1a, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
97379743 SND_PCI_QUIRK(0x1028, 0x0c1b, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
@@ -9852,6 +9858,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 114 unmodified lines
98529858 SND_PCI_QUIRK(0x103c, 0x8786, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
98539859 SND_PCI_QUIRK(0x103c, 0x8787, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
98549860 SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
9861+ SND_PCI_QUIRK(0x103c, 0x87b7, "HP Laptop 14-fq0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
98559862 SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
98569863 SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
98579864 SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
@@ -9957,6 +9964,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 99 unmodified lines
99579964 SND_PCI_QUIRK(0x103c, 0x8c72, "HP EliteBook 865 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
99589965 SND_PCI_QUIRK(0x103c, 0x8c96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
99599966 SND_PCI_QUIRK(0x103c, 0x8c97, "HP ZBook", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9967+ SND_PCI_QUIRK(0x103c, 0x8ca1, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
9968+ SND_PCI_QUIRK(0x103c, 0x8ca2, "HP ZBook Power", ALC236_FIXUP_HP_GPIO_LED),
99609969 SND_PCI_QUIRK(0x103c, 0x8ca4, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
99619970 SND_PCI_QUIRK(0x103c, 0x8ca7, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
99629971 SND_PCI_QUIRK(0x103c, 0x8cf5, "HP ZBook Studio 16", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
@@ -10322,6 +10331,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 359 unmodified lines
1032210331 SND_PCI_QUIRK(0x1d72, 0x1945, "Redmi G", ALC256_FIXUP_ASUS_HEADSET_MIC),
1032310332 SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
1032410333 SND_PCI_QUIRK(0x2782, 0x0232, "CHUWI CoreBook XPro", ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO),
10334+ SND_PCI_QUIRK(0x2782, 0x1707, "Vaio VJFE-ADL", ALC298_FIXUP_SPK_VOLUME),
1032510335 SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
1032610336 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
1032710337 SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
sound/soc/amd/acp/acp-mach-common.c+14−2
@@ -505,6 +505,13 @@ static int acp_card_rt5682s_hw_params(struct snd_pcm_substream *substream, · 504 unmodified lines
505505
506506 clk_set_rate(drvdata->wclk, srate);
507507 clk_set_rate(drvdata->bclk, srate * ch * format);
508+ if (!drvdata->soc_mclk) {
509+ ret = acp_clk_enable(drvdata, srate, ch * format);
510+ if (ret < 0) {
511+ dev_err(rtd->card->dev, "Failed to enable HS clk: %d\n", ret);
512+ return ret;
513+ }
514+ }
508515
509516 return 0;
510517 }
@@ -1464,8 +1471,13 @@ int acp_sofdsp_dai_links_create(struct snd_soc_card *card) · 953 unmodified lines
14641471 if (drv_data->amp_cpu_id == I2S_SP) {
14651472 links[i].name = "acp-amp-codec";
14661473 links[i].id = AMP_BE_ID;
1467− links[i].cpus = sof_sp_virtual;
1468− links[i].num_cpus = ARRAY_SIZE(sof_sp_virtual);
1474+ if (drv_data->platform == RENOIR) {
1475+ links[i].cpus = sof_sp;
1476+ links[i].num_cpus = ARRAY_SIZE(sof_sp);
1477+ } else {
1478+ links[i].cpus = sof_sp_virtual;
1479+ links[i].num_cpus = ARRAY_SIZE(sof_sp_virtual);
1480+ }
14691481 links[i].platforms = sof_component;
14701482 links[i].num_platforms = ARRAY_SIZE(sof_component);
14711483 links[i].dpcm_playback = 1;
sound/soc/amd/acp/acp-sof-mach.c+4−0
@@ -48,6 +48,7 @@ static struct acp_card_drvdata sof_rt5682s_rt1019_data = { · 47 unmodified lines
4848 .hs_codec_id = RT5682S,
4949 .amp_codec_id = RT1019,
5050 .dmic_codec_id = DMIC,
51+ .platform = RENOIR,
5152 .tdm_mode = false,
5253 };
5354
@@ -58,6 +59,7 @@ static struct acp_card_drvdata sof_rt5682s_max_data = { · 4 unmodified lines
5859 .hs_codec_id = RT5682S,
5960 .amp_codec_id = MAX98360A,
6061 .dmic_codec_id = DMIC,
62+ .platform = RENOIR,
6163 .tdm_mode = false,
6264 };
6365
@@ -68,6 +70,7 @@ static struct acp_card_drvdata sof_nau8825_data = { · 4 unmodified lines
6870 .hs_codec_id = NAU8825,
6971 .amp_codec_id = MAX98360A,
7072 .dmic_codec_id = DMIC,
73+ .platform = REMBRANDT,
7174 .soc_mclk = true,
7275 .tdm_mode = false,
7376 };
@@ -79,6 +82,7 @@ static struct acp_card_drvdata sof_rt5682s_hs_rt1019_data = { · 5 unmodified lines
7982 .hs_codec_id = RT5682S,
8083 .amp_codec_id = RT1019,
8184 .dmic_codec_id = DMIC,
85+ .platform = REMBRANDT,
8286 .soc_mclk = true,
8387 .tdm_mode = false,
8488 };
sound/soc/amd/acp/acp3x-es83xx/acp3x-es83xx.c+8−0
@@ -354,6 +354,14 @@ static const struct dmi_system_id acp3x_es83xx_dmi_table[] = { · 353 unmodified lines
354354 },
355355 .driver_data = (void *)(ES83XX_ENABLE_DMIC|ES83XX_48_MHZ_MCLK),
356356 },
357+ {
358+ .matches = {
359+ DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "HUAWEI"),
360+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "HVY-WXX9"),
361+ DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "M1010"),
362+ },
363+ .driver_data = (void *)(ES83XX_ENABLE_DMIC),
364+ },
357365 {
358366 .matches = {
359367 DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "HUAWEI"),
sound/soc/amd/yc/acp6x-mach.c+7−0
@@ -297,6 +297,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { · 296 unmodified lines
297297 DMI_MATCH(DMI_PRODUCT_NAME, "Bravo 15 B7ED"),
298298 }
299299 },
300+ {
301+ .driver_data = &acp6x_card,
302+ .matches = {
303+ DMI_MATCH(DMI_BOARD_VENDOR, "Micro-Star International Co., Ltd."),
304+ DMI_MATCH(DMI_PRODUCT_NAME, "Bravo 15 C7VF"),
305+ }
306+ },
300307 {
301308 .driver_data = &acp6x_card,
302309 .matches = {
sound/soc/codecs/cs35l56-shared.c+122−18
@@ -5,6 +5,7 @@ · 4 unmodified lines
55 // Copyright (C) 2023 Cirrus Logic, Inc. and
66 // Cirrus Logic International Semiconductor Ltd.
77
8+#include <linux/gpio/consumer.h>
89 #include <linux/regmap.h>
910 #include <linux/regulator/consumer.h>
1011 #include <linux/types.h>
@@ -12,6 +13,15 @@ · 1 unmodified line
1213 #include "cs35l56.h"
1314
1415 static const struct reg_sequence cs35l56_patch[] = {
16+ /*
17+ * Firmware can change these to non-defaults to satisfy SDCA.
18+ * Ensure that they are at known defaults.
19+ */
20+ { CS35L56_SWIRE_DP3_CH1_INPUT, 0x00000018 },
21+ { CS35L56_SWIRE_DP3_CH2_INPUT, 0x00000019 },
22+ { CS35L56_SWIRE_DP3_CH3_INPUT, 0x00000029 },
23+ { CS35L56_SWIRE_DP3_CH4_INPUT, 0x00000028 },
24+
1525 /* These are not reset by a soft-reset, so patch to defaults. */
1626 { CS35L56_MAIN_RENDER_USER_MUTE, 0x00000000 },
1727 { CS35L56_MAIN_RENDER_USER_VOLUME, 0x00000000 },
@@ -34,10 +44,9 @@ static const struct reg_default cs35l56_reg_defaults[] = { · 16 unmodified lines
3444 { CS35L56_ASP1_FRAME_CONTROL5, 0x00020100 },
3545 { CS35L56_ASP1_DATA_CONTROL1, 0x00000018 },
3646 { CS35L56_ASP1_DATA_CONTROL5, 0x00000018 },
37− { CS35L56_ASP1TX1_INPUT, 0x00000018 },
38− { CS35L56_ASP1TX2_INPUT, 0x00000019 },
39− { CS35L56_ASP1TX3_INPUT, 0x00000020 },
40− { CS35L56_ASP1TX4_INPUT, 0x00000028 },
47+
48+ /* no defaults for ASP1TX mixer */
49+
4150 { CS35L56_SWIRE_DP3_CH1_INPUT, 0x00000018 },
4251 { CS35L56_SWIRE_DP3_CH2_INPUT, 0x00000019 },
4352 { CS35L56_SWIRE_DP3_CH3_INPUT, 0x00000029 },
@@ -195,6 +204,47 @@ static bool cs35l56_volatile_reg(struct device *dev, unsigned int reg) · 151 unmodified lines
195204 }
196205 }
197206
207+/*
208+ * The firmware boot sequence can overwrite the ASP1 config registers so that
209+ * they don't match regmap's view of their values. Rewrite the values from the
210+ * regmap cache into the hardware registers.
211+ */
212+int cs35l56_force_sync_asp1_registers_from_cache(struct cs35l56_base *cs35l56_base)
213+{
214+ struct reg_sequence asp1_regs[] = {
215+ { .reg = CS35L56_ASP1_ENABLES1 },
216+ { .reg = CS35L56_ASP1_CONTROL1 },
217+ { .reg = CS35L56_ASP1_CONTROL2 },
218+ { .reg = CS35L56_ASP1_CONTROL3 },
219+ { .reg = CS35L56_ASP1_FRAME_CONTROL1 },
220+ { .reg = CS35L56_ASP1_FRAME_CONTROL5 },
221+ { .reg = CS35L56_ASP1_DATA_CONTROL1 },
222+ { .reg = CS35L56_ASP1_DATA_CONTROL5 },
223+ };
224+ int i, ret;
225+
226+ /* Read values from regmap cache into a write sequence */
227+ for (i = 0; i < ARRAY_SIZE(asp1_regs); ++i) {
228+ ret = regmap_read(cs35l56_base->regmap, asp1_regs[i].reg, &asp1_regs[i].def);
229+ if (ret)
230+ goto err;
231+ }
232+
233+ /* Write the values cache-bypassed so that they will be written to silicon */
234+ ret = regmap_multi_reg_write_bypassed(cs35l56_base->regmap, asp1_regs,
235+ ARRAY_SIZE(asp1_regs));
236+ if (ret)
237+ goto err;
238+
239+ return 0;
240+
241+err:
242+ dev_err(cs35l56_base->dev, "Failed to sync ASP1 registers: %d\n", ret);
243+
244+ return ret;
245+}
246+EXPORT_SYMBOL_NS_GPL(cs35l56_force_sync_asp1_registers_from_cache, SND_SOC_CS35L56_SHARED);
247+
198248 int cs35l56_mbox_send(struct cs35l56_base *cs35l56_base, unsigned int command)
199249 {
200250 unsigned int val;
@@ -400,17 +450,6 @@ int cs35l56_is_fw_reload_needed(struct cs35l56_base *cs35l56_base) · 199 unmodified lines
400450 unsigned int val;
401451 int ret;
402452
403− /* Nothing to re-patch if we haven't done any patching yet. */
404− if (!cs35l56_base->fw_patched)
405− return false;
406−
407− /*
408− * If we have control of RESET we will have asserted it so the firmware
409− * will need re-patching.
410− */
411− if (cs35l56_base->reset_gpio)
412− return true;
413−
414453 /*
415454 * In secure mode FIRMWARE_MISSING is cleared by the BIOS loader so
416455 * can't be used here to test for memory retention.
@@ -590,10 +629,35 @@ void cs35l56_init_cs_dsp(struct cs35l56_base *cs35l56_base, struct cs_dsp *cs_ds · 173 unmodified lines
590629 }
591630 EXPORT_SYMBOL_NS_GPL(cs35l56_init_cs_dsp, SND_SOC_CS35L56_SHARED);
592631
632+int cs35l56_read_prot_status(struct cs35l56_base *cs35l56_base,
633+ bool *fw_missing, unsigned int *fw_version)
634+{
635+ unsigned int prot_status;
636+ int ret;
637+
638+ ret = regmap_read(cs35l56_base->regmap, CS35L56_PROTECTION_STATUS, &prot_status);
639+ if (ret) {
640+ dev_err(cs35l56_base->dev, "Get PROTECTION_STATUS failed: %d\n", ret);
641+ return ret;
642+ }
643+
644+ *fw_missing = !!(prot_status & CS35L56_FIRMWARE_MISSING);
645+
646+ ret = regmap_read(cs35l56_base->regmap, CS35L56_DSP1_FW_VER, fw_version);
647+ if (ret) {
648+ dev_err(cs35l56_base->dev, "Get FW VER failed: %d\n", ret);
649+ return ret;
650+ }
651+
652+ return 0;
653+}
654+EXPORT_SYMBOL_NS_GPL(cs35l56_read_prot_status, SND_SOC_CS35L56_SHARED);
655+
593656 int cs35l56_hw_init(struct cs35l56_base *cs35l56_base)
594657 {
595658 int ret;
596− unsigned int devid, revid, otpid, secured;
659+ unsigned int devid, revid, otpid, secured, fw_ver;
660+ bool fw_missing;
597661
598662 /*
599663 * When the system is not using a reset_gpio ensure the device is
@@ -652,8 +716,13 @@ int cs35l56_hw_init(struct cs35l56_base *cs35l56_base) · 52 unmodified lines
652716 return ret;
653717 }
654718
655− dev_info(cs35l56_base->dev, "Cirrus Logic CS35L56%s Rev %02X OTP%d\n",
656− cs35l56_base->secured ? "s" : "", cs35l56_base->rev, otpid);
719+ ret = cs35l56_read_prot_status(cs35l56_base, &fw_missing, &fw_ver);
720+ if (ret)
721+ return ret;
722+
723+ dev_info(cs35l56_base->dev, "Cirrus Logic CS35L56%s Rev %02X OTP%d fw:%d.%d.%d (patched=%u)\n",
724+ cs35l56_base->secured ? "s" : "", cs35l56_base->rev, otpid,
725+ fw_ver >> 16, (fw_ver >> 8) & 0xff, fw_ver & 0xff, !fw_missing);
657726
658727 /* Wake source and *_BLOCKED interrupts default to unmasked, so mask them */
659728 regmap_write(cs35l56_base->regmap, CS35L56_IRQ1_MASK_20, 0xffffffff);
@@ -668,6 +737,41 @@ int cs35l56_hw_init(struct cs35l56_base *cs35l56_base) · 8 unmodified lines
668737 }
669738 EXPORT_SYMBOL_NS_GPL(cs35l56_hw_init, SND_SOC_CS35L56_SHARED);
670739
740+int cs35l56_get_speaker_id(struct cs35l56_base *cs35l56_base)
741+{
742+ struct gpio_descs *descs;
743+ int speaker_id;
744+ int i, ret;
745+
746+ /* Read the speaker type qualifier from the motherboard GPIOs */
747+ descs = gpiod_get_array_optional(cs35l56_base->dev, "spk-id", GPIOD_IN);
748+ if (!descs) {
749+ return -ENOENT;
750+ } else if (IS_ERR(descs)) {
751+ ret = PTR_ERR(descs);
752+ return dev_err_probe(cs35l56_base->dev, ret, "Failed to get spk-id-gpios\n");
753+ }
754+
755+ speaker_id = 0;
756+ for (i = 0; i < descs->ndescs; i++) {
757+ ret = gpiod_get_value_cansleep(descs->desc[i]);
758+ if (ret < 0) {
759+ dev_err_probe(cs35l56_base->dev, ret, "Failed to read spk-id[%d]\n", i);
760+ goto err;
761+ }
762+
763+ speaker_id |= (ret << i);
764+ }
765+
766+ dev_dbg(cs35l56_base->dev, "Speaker ID = %d\n", speaker_id);
767+ ret = speaker_id;
768+err:
769+ gpiod_put_array(descs);
770+
771+ return ret;
772+}
773+EXPORT_SYMBOL_NS_GPL(cs35l56_get_speaker_id, SND_SOC_CS35L56_SHARED);
774+
671775 static const u32 cs35l56_bclk_valid_for_pll_freq_table[] = {
672776 [0x0C] = 128000,
673777 [0x0F] = 256000,
sound/soc/codecs/cs35l56.c+256−45
@@ -59,6 +59,135 @@ static int cs35l56_dspwait_put_volsw(struct snd_kcontrol *kcontrol, · 58 unmodified lines
5959 return snd_soc_put_volsw(kcontrol, ucontrol);
6060 }
6161
62+static const unsigned short cs35l56_asp1_mixer_regs[] = {
63+ CS35L56_ASP1TX1_INPUT, CS35L56_ASP1TX2_INPUT,
64+ CS35L56_ASP1TX3_INPUT, CS35L56_ASP1TX4_INPUT,
65+};
66+
67+static const char * const cs35l56_asp1_mux_control_names[] = {
68+ "ASP1 TX1 Source", "ASP1 TX2 Source", "ASP1 TX3 Source", "ASP1 TX4 Source"
69+};
70+
71+static int cs35l56_dspwait_asp1tx_get(struct snd_kcontrol *kcontrol,
72+ struct snd_ctl_elem_value *ucontrol)
73+{
74+ struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol);
75+ struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(component);
76+ struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
77+ int index = e->shift_l;
78+ unsigned int addr, val;
79+ int ret;
80+
81+ /* Wait for mux to be initialized */
82+ cs35l56_wait_dsp_ready(cs35l56);
83+ flush_work(&cs35l56->mux_init_work);
84+
85+ addr = cs35l56_asp1_mixer_regs[index];
86+ ret = regmap_read(cs35l56->base.regmap, addr, &val);
87+ if (ret)
88+ return ret;
89+
90+ val &= CS35L56_ASP_TXn_SRC_MASK;
91+ ucontrol->value.enumerated.item[0] = snd_soc_enum_val_to_item(e, val);
92+
93+ return 0;
94+}
95+
96+static int cs35l56_dspwait_asp1tx_put(struct snd_kcontrol *kcontrol,
97+ struct snd_ctl_elem_value *ucontrol)
98+{
99+ struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol);
100+ struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
101+ struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(component);
102+ struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
103+ int item = ucontrol->value.enumerated.item[0];
104+ int index = e->shift_l;
105+ unsigned int addr, val;
106+ bool changed;
107+ int ret;
108+
109+ /* Wait for mux to be initialized */
110+ cs35l56_wait_dsp_ready(cs35l56);
111+ flush_work(&cs35l56->mux_init_work);
112+
113+ addr = cs35l56_asp1_mixer_regs[index];
114+ val = snd_soc_enum_item_to_val(e, item);
115+
116+ ret = regmap_update_bits_check(cs35l56->base.regmap, addr,
117+ CS35L56_ASP_TXn_SRC_MASK, val, &changed);
118+ if (!ret)
119+ return ret;
120+
121+ if (changed)
122+ snd_soc_dapm_mux_update_power(dapm, kcontrol, item, e, NULL);
123+
124+ return changed;
125+}
126+
127+static void cs35l56_mark_asp1_mixer_widgets_dirty(struct cs35l56_private *cs35l56)
128+{
129+ struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(cs35l56->component);
130+ const char *prefix = cs35l56->component->name_prefix;
131+ char full_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
132+ const char *name;
133+ struct snd_kcontrol *kcontrol;
134+ struct soc_enum *e;
135+ unsigned int val[4];
136+ int i, item, ret;
137+
138+ /*
139+ * Resume so we can read the registers from silicon if the regmap
140+ * cache has not yet been populated.
141+ */
142+ ret = pm_runtime_resume_and_get(cs35l56->base.dev);
143+ if (ret < 0)
144+ return;
145+
146+ ret = regmap_bulk_read(cs35l56->base.regmap, CS35L56_ASP1TX1_INPUT,
147+ val, ARRAY_SIZE(val));
148+
149+ pm_runtime_mark_last_busy(cs35l56->base.dev);
150+ pm_runtime_put_autosuspend(cs35l56->base.dev);
151+
152+ if (ret) {
153+ dev_err(cs35l56->base.dev, "Failed to read ASP1 mixer regs: %d\n", ret);
154+ return;
155+ }
156+
157+ snd_soc_card_mutex_lock(dapm->card);
158+ WARN_ON(!dapm->card->instantiated);
159+
160+ for (i = 0; i < ARRAY_SIZE(cs35l56_asp1_mux_control_names); ++i) {
161+ name = cs35l56_asp1_mux_control_names[i];
162+
163+ if (prefix) {
164+ snprintf(full_name, sizeof(full_name), "%s %s", prefix, name);
165+ name = full_name;
166+ }
167+
168+ kcontrol = snd_soc_card_get_kcontrol(dapm->card, name);
169+ if (!kcontrol) {
170+ dev_warn(cs35l56->base.dev, "Could not find control %s\n", name);
171+ continue;
172+ }
173+
174+ e = (struct soc_enum *)kcontrol->private_value;
175+ item = snd_soc_enum_val_to_item(e, val[i] & CS35L56_ASP_TXn_SRC_MASK);
176+ snd_soc_dapm_mux_update_power(dapm, kcontrol, item, e, NULL);
177+ }
178+
179+ snd_soc_card_mutex_unlock(dapm->card);
180+}
181+
182+static void cs35l56_mux_init_work(struct work_struct *work)
183+{
184+ struct cs35l56_private *cs35l56 = container_of(work,
185+ struct cs35l56_private,
186+ mux_init_work);
187+
188+ cs35l56_mark_asp1_mixer_widgets_dirty(cs35l56);
189+}
190+
62191 static DECLARE_TLV_DB_SCALE(vol_tlv, -10000, 25, 0);
63192
64193 static const struct snd_kcontrol_new cs35l56_controls[] = {
@@ -77,40 +206,44 @@ static const struct snd_kcontrol_new cs35l56_controls[] = { · 12 unmodified lines
77206 };
78207
79208 static SOC_VALUE_ENUM_SINGLE_DECL(cs35l56_asp1tx1_enum,
80− CS35L56_ASP1TX1_INPUT,
81− 0, CS35L56_ASP_TXn_SRC_MASK,
209+ SND_SOC_NOPM,
210+ 0, 0,
82211 cs35l56_tx_input_texts,
83212 cs35l56_tx_input_values);
84213
85214 static const struct snd_kcontrol_new asp1_tx1_mux =
86− SOC_DAPM_ENUM("ASP1TX1 SRC", cs35l56_asp1tx1_enum);
215+ SOC_DAPM_ENUM_EXT("ASP1TX1 SRC", cs35l56_asp1tx1_enum,
216+ cs35l56_dspwait_asp1tx_get, cs35l56_dspwait_asp1tx_put);
87217
88218 static SOC_VALUE_ENUM_SINGLE_DECL(cs35l56_asp1tx2_enum,
89− CS35L56_ASP1TX2_INPUT,
90− 0, CS35L56_ASP_TXn_SRC_MASK,
219+ SND_SOC_NOPM,
220+ 1, 0,
91221 cs35l56_tx_input_texts,
92222 cs35l56_tx_input_values);
93223
94224 static const struct snd_kcontrol_new asp1_tx2_mux =
95− SOC_DAPM_ENUM("ASP1TX2 SRC", cs35l56_asp1tx2_enum);
225+ SOC_DAPM_ENUM_EXT("ASP1TX2 SRC", cs35l56_asp1tx2_enum,
226+ cs35l56_dspwait_asp1tx_get, cs35l56_dspwait_asp1tx_put);
96227
97228 static SOC_VALUE_ENUM_SINGLE_DECL(cs35l56_asp1tx3_enum,
98− CS35L56_ASP1TX3_INPUT,
99− 0, CS35L56_ASP_TXn_SRC_MASK,
229+ SND_SOC_NOPM,
230+ 2, 0,
100231 cs35l56_tx_input_texts,
101232 cs35l56_tx_input_values);
102233
103234 static const struct snd_kcontrol_new asp1_tx3_mux =
104− SOC_DAPM_ENUM("ASP1TX3 SRC", cs35l56_asp1tx3_enum);
235+ SOC_DAPM_ENUM_EXT("ASP1TX3 SRC", cs35l56_asp1tx3_enum,
236+ cs35l56_dspwait_asp1tx_get, cs35l56_dspwait_asp1tx_put);
105237
106238 static SOC_VALUE_ENUM_SINGLE_DECL(cs35l56_asp1tx4_enum,
107− CS35L56_ASP1TX4_INPUT,
108− 0, CS35L56_ASP_TXn_SRC_MASK,
239+ SND_SOC_NOPM,
240+ 3, 0,
109241 cs35l56_tx_input_texts,
110242 cs35l56_tx_input_values);
111243
112244 static const struct snd_kcontrol_new asp1_tx4_mux =
113− SOC_DAPM_ENUM("ASP1TX4 SRC", cs35l56_asp1tx4_enum);
245+ SOC_DAPM_ENUM_EXT("ASP1TX4 SRC", cs35l56_asp1tx4_enum,
246+ cs35l56_dspwait_asp1tx_get, cs35l56_dspwait_asp1tx_put);
114247
115248 static SOC_VALUE_ENUM_SINGLE_DECL(cs35l56_sdw1tx1_enum,
116249 CS35L56_SWIRE_DP3_CH1_INPUT,
@@ -148,6 +281,21 @@ static SOC_VALUE_ENUM_SINGLE_DECL(cs35l56_sdw1tx4_enum, · 31 unmodified lines
148281 static const struct snd_kcontrol_new sdw1_tx4_mux =
149282 SOC_DAPM_ENUM("SDW1TX4 SRC", cs35l56_sdw1tx4_enum);
150283
284+static int cs35l56_asp1_cfg_event(struct snd_soc_dapm_widget *w,
285+ struct snd_kcontrol *kcontrol, int event)
286+{
287+ struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
288+ struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(component);
289+
290+ switch (event) {
291+ case SND_SOC_DAPM_PRE_PMU:
292+ /* Override register values set by firmware boot */
293+ return cs35l56_force_sync_asp1_registers_from_cache(&cs35l56->base);
294+ default:
295+ return 0;
296+ }
297+}
298+
151299 static int cs35l56_play_event(struct snd_soc_dapm_widget *w,
152300 struct snd_kcontrol *kcontrol, int event)
153301 {
@@ -184,6 +332,9 @@ static const struct snd_soc_dapm_widget cs35l56_dapm_widgets[] = { · 30 unmodified lines
184332 SND_SOC_DAPM_REGULATOR_SUPPLY("VDD_B", 0, 0),
185333 SND_SOC_DAPM_REGULATOR_SUPPLY("VDD_AMP", 0, 0),
186334
335+ SND_SOC_DAPM_SUPPLY("ASP1 CFG", SND_SOC_NOPM, 0, 0, cs35l56_asp1_cfg_event,
336+ SND_SOC_DAPM_PRE_PMU),
337+
187338 SND_SOC_DAPM_SUPPLY("PLAY", SND_SOC_NOPM, 0, 0, cs35l56_play_event,
188339 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
189340
@@ -251,6 +402,9 @@ static const struct snd_soc_dapm_route cs35l56_audio_map[] = { · 61 unmodified lines
251402 { "AMP", NULL, "VDD_B" },
252403 { "AMP", NULL, "VDD_AMP" },
253404
405+ { "ASP1 Playback", NULL, "ASP1 CFG" },
406+ { "ASP1 Capture", NULL, "ASP1 CFG" },
407+
254408 { "ASP1 Playback", NULL, "PLAY" },
255409 { "SDW1 Playback", NULL, "PLAY" },
256410
@@ -650,7 +804,7 @@ static struct snd_soc_dai_driver cs35l56_dai[] = { · 393 unmodified lines
650804 }
651805 };
652806
653−static void cs35l56_secure_patch(struct cs35l56_private *cs35l56)
807+static void cs35l56_reinit_patch(struct cs35l56_private *cs35l56)
654808 {
655809 int ret;
656810
@@ -662,19 +816,10 @@ static void cs35l56_secure_patch(struct cs35l56_private *cs35l56) · 5 unmodified lines
662816 cs35l56_mbox_send(&cs35l56->base, CS35L56_MBOX_CMD_AUDIO_REINIT);
663817 }
664818
665−static void cs35l56_patch(struct cs35l56_private *cs35l56)
819+static void cs35l56_patch(struct cs35l56_private *cs35l56, bool firmware_missing)
666820 {
667− unsigned int firmware_missing;
668821 int ret;
669822
670− ret = regmap_read(cs35l56->base.regmap, CS35L56_PROTECTION_STATUS, &firmware_missing);
671− if (ret) {
672− dev_err(cs35l56->base.dev, "Failed to read PROTECTION_STATUS: %d\n", ret);
673− return;
674− }
675−
676− firmware_missing &= CS35L56_FIRMWARE_MISSING;
677−
678823 /*
679824 * Disable SoundWire interrupts to prevent race with IRQ work.
680825 * Setting sdw_irq_no_unmask prevents the handler re-enabling
@@ -747,23 +892,59 @@ static void cs35l56_dsp_work(struct work_struct *work) · 66 unmodified lines
747892 struct cs35l56_private *cs35l56 = container_of(work,
748893 struct cs35l56_private,
749894 dsp_work);
895+ unsigned int firmware_version;
896+ bool firmware_missing;
897+ int ret;
750898
751899 if (!cs35l56->base.init_done)
752900 return;
753901
754902 pm_runtime_get_sync(cs35l56->base.dev);
755903
904+ ret = cs35l56_read_prot_status(&cs35l56->base, &firmware_missing, &firmware_version);
905+ if (ret)
906+ goto err;
907+
908+ /* Populate fw file qualifier with the revision and security state */
909+ kfree(cs35l56->dsp.fwf_name);
910+ if (firmware_missing) {
911+ cs35l56->dsp.fwf_name = kasprintf(GFP_KERNEL, "%02x-dsp1", cs35l56->base.rev);
912+ } else {
913+ /* Firmware files must match the running firmware version */
914+ cs35l56->dsp.fwf_name = kasprintf(GFP_KERNEL,
915+ "%02x%s-%06x-dsp1",
916+ cs35l56->base.rev,
917+ cs35l56->base.secured ? "-s" : "",
918+ firmware_version);
919+ }
920+
921+ if (!cs35l56->dsp.fwf_name)
922+ goto err;
923+
924+ dev_dbg(cs35l56->base.dev, "DSP fwf name: '%s' system name: '%s'\n",
925+ cs35l56->dsp.fwf_name, cs35l56->dsp.system_name);
926+
756927 /*
757− * When the device is running in secure mode the firmware files can
758− * only contain insecure tunings and therefore we do not need to
759− * shutdown the firmware to apply them and can use the lower cost
760− * reinit sequence instead.
928+ * The firmware cannot be patched if it is already running from
929+ * patch RAM. In this case the firmware files are versioned to
930+ * match the running firmware version and will only contain
931+ * tunings. We do not need to shutdown the firmware to apply
932+ * tunings so can use the lower cost reinit sequence instead.
761933 */
762− if (cs35l56->base.secured)
763− cs35l56_secure_patch(cs35l56);
934+ if (!firmware_missing)
935+ cs35l56_reinit_patch(cs35l56);
764936 else
765− cs35l56_patch(cs35l56);
937+ cs35l56_patch(cs35l56, firmware_missing);
766938
939+
940+ /*
941+ * Set starting value of ASP1 mux widgets. Updating a mux takes
942+ * the DAPM mutex. Post this to a separate job so that DAPM
943+ * power-up can wait for dsp_work to complete without deadlocking
944+ * on the DAPM mutex.
945+ */
946+ queue_work(cs35l56->dsp_wq, &cs35l56->mux_init_work);
947+err:
767948 pm_runtime_mark_last_busy(cs35l56->base.dev);
768949 pm_runtime_put_autosuspend(cs35l56->base.dev);
769950 }
@@ -778,10 +959,19 @@ static int cs35l56_component_probe(struct snd_soc_component *component) · 8 unmodified lines
778959
779960 if (!cs35l56->dsp.system_name &&
780961 (snd_soc_card_get_pci_ssid(component->card, &vendor, &device) == 0)) {
781− cs35l56->dsp.system_name = devm_kasprintf(cs35l56->base.dev,
782− GFP_KERNEL,
783− "%04x%04x",
784− vendor, device);
962+ /* Append a speaker qualifier if there is a speaker ID */
963+ if (cs35l56->speaker_id >= 0) {
964+ cs35l56->dsp.system_name = devm_kasprintf(cs35l56->base.dev,
965+ GFP_KERNEL,
966+ "%04x%04x-spkid%d",
967+ vendor, device,
968+ cs35l56->speaker_id);
969+ } else {
970+ cs35l56->dsp.system_name = devm_kasprintf(cs35l56->base.dev,
971+ GFP_KERNEL,
972+ "%04x%04x",
973+ vendor, device);
974+ }
785975 if (!cs35l56->dsp.system_name)
786976 return -ENOMEM;
787977 }
@@ -809,6 +999,17 @@ static void cs35l56_component_remove(struct snd_soc_component *component) · 21 unmodified lines
809999 struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(component);
8101000
8111001 cancel_work_sync(&cs35l56->dsp_work);
1002+ cancel_work_sync(&cs35l56->mux_init_work);
1003+
1004+ if (cs35l56->dsp.cs_dsp.booted)
1005+ wm_adsp_power_down(&cs35l56->dsp);
1006+
1007+ wm_adsp2_component_remove(&cs35l56->dsp, component);
1008+
1009+ kfree(cs35l56->dsp.fwf_name);
1010+ cs35l56->dsp.fwf_name = NULL;
1011+
1012+ cs35l56->component = NULL;
8121013 }
8131014
8141015 static int cs35l56_set_bias_level(struct snd_soc_component *component,
@@ -869,8 +1070,10 @@ int cs35l56_system_suspend(struct device *dev) · 54 unmodified lines
8691070
8701071 dev_dbg(dev, "system_suspend\n");
8711072
872− if (cs35l56->component)
1073+ if (cs35l56->component) {
8731074 flush_work(&cs35l56->dsp_work);
1075+ cancel_work_sync(&cs35l56->mux_init_work);
1076+ }
8741077
8751078 /*
8761079 * The interrupt line is normally shared, but after we start suspending
@@ -1021,6 +1224,7 @@ static int cs35l56_dsp_init(struct cs35l56_private *cs35l56) · 144 unmodified lines
10211224 return -ENOMEM;
10221225
10231226 INIT_WORK(&cs35l56->dsp_work, cs35l56_dsp_work);
1227+ INIT_WORK(&cs35l56->mux_init_work, cs35l56_mux_init_work);
10241228
10251229 dsp = &cs35l56->dsp;
10261230 cs35l56_init_cs_dsp(&cs35l56->base, &dsp->cs_dsp);
@@ -1050,7 +1254,13 @@ static int cs35l56_get_firmware_uid(struct cs35l56_private *cs35l56) · 23 unmodified lines
10501254 if (ret < 0)
10511255 return 0;
10521256
1053− cs35l56->dsp.system_name = devm_kstrdup(dev, prop, GFP_KERNEL);
1257+ /* Append a speaker qualifier if there is a speaker ID */
1258+ if (cs35l56->speaker_id >= 0)
1259+ cs35l56->dsp.system_name = devm_kasprintf(dev, GFP_KERNEL, "%s-spkid%d",
1260+ prop, cs35l56->speaker_id);
1261+ else
1262+ cs35l56->dsp.system_name = devm_kstrdup(dev, prop, GFP_KERNEL);
1263+
10541264 if (cs35l56->dsp.system_name == NULL)
10551265 return -ENOMEM;
10561266
@@ -1065,6 +1275,7 @@ int cs35l56_common_probe(struct cs35l56_private *cs35l56) · 8 unmodified lines
10651275
10661276 init_completion(&cs35l56->init_completion);
10671277 mutex_init(&cs35l56->base.irq_lock);
1278+ cs35l56->speaker_id = -ENOENT;
10681279
10691280 dev_set_drvdata(cs35l56->base.dev, cs35l56);
10701281
@@ -1101,6 +1312,12 @@ int cs35l56_common_probe(struct cs35l56_private *cs35l56) · 30 unmodified lines
11011312 gpiod_set_value_cansleep(cs35l56->base.reset_gpio, 1);
11021313 }
11031314
1315+ ret = cs35l56_get_speaker_id(&cs35l56->base);
1316+ if ((ret < 0) && (ret != -ENOENT))
1317+ goto err;
1318+
1319+ cs35l56->speaker_id = ret;
1320+
11041321 ret = cs35l56_get_firmware_uid(cs35l56);
11051322 if (ret != 0)
11061323 goto err;
@@ -1152,11 +1369,9 @@ int cs35l56_init(struct cs35l56_private *cs35l56) · 45 unmodified lines
11521369 if (ret < 0)
11531370 return ret;
11541371
1155− /* Populate the DSP information with the revision and security state */
1156− cs35l56->dsp.part = devm_kasprintf(cs35l56->base.dev, GFP_KERNEL, "cs35l56%s-%02x",
1157− cs35l56->base.secured ? "s" : "", cs35l56->base.rev);
1158− if (!cs35l56->dsp.part)
1159− return -ENOMEM;
1372+ ret = cs35l56_set_patch(&cs35l56->base);
1373+ if (ret)
1374+ return ret;
11601375
11611376 if (!cs35l56->base.reset_gpio) {
11621377 dev_dbg(cs35l56->base.dev, "No reset gpio: using soft reset\n");
@@ -1190,10 +1405,6 @@ post_soft_reset: · 27 unmodified lines
11901405 if (ret)
11911406 return ret;
11921407
1193− ret = cs35l56_set_patch(&cs35l56->base);
1194− if (ret)
1195− return ret;
1196−
11971408 /* Registers could be dirty after soft reset or SoundWire enumeration */
11981409 regcache_sync(cs35l56->base.regmap);
11991410
sound/soc/codecs/cs35l56.h+2−0
@@ -34,6 +34,7 @@ struct cs35l56_private { · 33 unmodified lines
3434 struct wm_adsp dsp; /* must be first member */
3535 struct cs35l56_base base;
3636 struct work_struct dsp_work;
37+ struct work_struct mux_init_work;
3738 struct workqueue_struct *dsp_wq;
3839 struct snd_soc_component *component;
3940 struct regulator_bulk_data supplies[CS35L56_NUM_BULK_SUPPLIES];
@@ -44,6 +45,7 @@ struct cs35l56_private { · 4 unmodified lines
4445 bool sdw_attached;
4546 struct completion init_completion;
4647
48+ int speaker_id;
4749 u32 rx_mask;
4850 u32 tx_mask;
4951 u8 asp_slot_width;
sound/soc/codecs/es8326.c+139−47
@@ -45,6 +45,82 @@ struct es8326_priv { · 44 unmodified lines
4545 int jack_remove_retry;
4646 };
4747
48+static int es8326_crosstalk1_get(struct snd_kcontrol *kcontrol,
49+ struct snd_ctl_elem_value *ucontrol)
50+{
51+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
52+ struct es8326_priv *es8326 = snd_soc_component_get_drvdata(component);
53+ unsigned int crosstalk_h, crosstalk_l;
54+ unsigned int crosstalk;
55+
56+ regmap_read(es8326->regmap, ES8326_DAC_RAMPRATE, &crosstalk_h);
57+ regmap_read(es8326->regmap, ES8326_DAC_CROSSTALK, &crosstalk_l);
58+ crosstalk_h &= 0x20;
59+ crosstalk_l &= 0xf0;
60+ crosstalk = crosstalk_h >> 1 | crosstalk_l >> 4;
61+ ucontrol->value.integer.value[0] = crosstalk;
62+
63+ return 0;
64+}
65+
66+static int es8326_crosstalk1_set(struct snd_kcontrol *kcontrol,
67+ struct snd_ctl_elem_value *ucontrol)
68+{
69+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
70+ struct es8326_priv *es8326 = snd_soc_component_get_drvdata(component);
71+ unsigned int crosstalk_h, crosstalk_l;
72+ unsigned int crosstalk;
73+
74+ crosstalk = ucontrol->value.integer.value[0];
75+ regmap_read(es8326->regmap, ES8326_DAC_CROSSTALK, &crosstalk_l);
76+ crosstalk_h = (crosstalk & 0x10) << 1;
77+ crosstalk_l &= 0x0f;
78+ crosstalk_l |= (crosstalk & 0x0f) << 4;
79+ regmap_update_bits(es8326->regmap, ES8326_DAC_RAMPRATE,
80+ 0x20, crosstalk_h);
81+ regmap_write(es8326->regmap, ES8326_DAC_CROSSTALK, crosstalk_l);
82+
83+ return 0;
84+}
85+
86+static int es8326_crosstalk2_get(struct snd_kcontrol *kcontrol,
87+ struct snd_ctl_elem_value *ucontrol)
88+{
89+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
90+ struct es8326_priv *es8326 = snd_soc_component_get_drvdata(component);
91+ unsigned int crosstalk_h, crosstalk_l;
92+ unsigned int crosstalk;
93+
94+ regmap_read(es8326->regmap, ES8326_DAC_RAMPRATE, &crosstalk_h);
95+ regmap_read(es8326->regmap, ES8326_DAC_CROSSTALK, &crosstalk_l);
96+ crosstalk_h &= 0x10;
97+ crosstalk_l &= 0x0f;
98+ crosstalk = crosstalk_h | crosstalk_l;
99+ ucontrol->value.integer.value[0] = crosstalk;
100+
101+ return 0;
102+}
103+
104+static int es8326_crosstalk2_set(struct snd_kcontrol *kcontrol,
105+ struct snd_ctl_elem_value *ucontrol)
106+{
107+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
108+ struct es8326_priv *es8326 = snd_soc_component_get_drvdata(component);
109+ unsigned int crosstalk_h, crosstalk_l;
110+ unsigned int crosstalk;
111+
112+ crosstalk = ucontrol->value.integer.value[0];
113+ regmap_read(es8326->regmap, ES8326_DAC_CROSSTALK, &crosstalk_l);
114+ crosstalk_h = crosstalk & 0x10;
115+ crosstalk_l &= 0xf0;
116+ crosstalk_l |= crosstalk & 0x0f;
117+ regmap_update_bits(es8326->regmap, ES8326_DAC_RAMPRATE,
118+ 0x10, crosstalk_h);
119+ regmap_write(es8326->regmap, ES8326_DAC_CROSSTALK, crosstalk_l);
120+
121+ return 0;
122+}
123+
48124 static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(dac_vol_tlv, -9550, 50, 0);
49125 static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(adc_vol_tlv, -9550, 50, 0);
50126 static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(adc_analog_pga_tlv, 0, 300, 0);
@@ -102,6 +178,10 @@ static const struct snd_kcontrol_new es8326_snd_controls[] = { · 51 unmodified lines
102178 SOC_SINGLE_TLV("ALC Capture Target Level", ES8326_ALC_LEVEL,
103179 0, 0x0f, 0, drc_target_tlv),
104180
181+ SOC_SINGLE_EXT("CROSSTALK1", SND_SOC_NOPM, 0, 31, 0,
182+ es8326_crosstalk1_get, es8326_crosstalk1_set),
183+ SOC_SINGLE_EXT("CROSSTALK2", SND_SOC_NOPM, 0, 31, 0,
184+ es8326_crosstalk2_get, es8326_crosstalk2_set),
105185 };
106186
107187 static const struct snd_soc_dapm_widget es8326_dapm_widgets[] = {
@@ -117,12 +197,6 @@ static const struct snd_soc_dapm_widget es8326_dapm_widgets[] = { · 9 unmodified lines
117197 SND_SOC_DAPM_AIF_OUT("I2S OUT", "I2S1 Capture", 0, SND_SOC_NOPM, 0, 0),
118198 SND_SOC_DAPM_AIF_IN("I2S IN", "I2S1 Playback", 0, SND_SOC_NOPM, 0, 0),
119199
120− /* ADC Digital Mute */
121− SND_SOC_DAPM_PGA("ADC L1", ES8326_ADC_MUTE, 0, 1, NULL, 0),
122− SND_SOC_DAPM_PGA("ADC R1", ES8326_ADC_MUTE, 1, 1, NULL, 0),
123− SND_SOC_DAPM_PGA("ADC L2", ES8326_ADC_MUTE, 2, 1, NULL, 0),
124− SND_SOC_DAPM_PGA("ADC R2", ES8326_ADC_MUTE, 3, 1, NULL, 0),
125−
126200 /* Analog Power Supply*/
127201 SND_SOC_DAPM_DAC("Right DAC", NULL, ES8326_ANA_PDN, 0, 1),
128202 SND_SOC_DAPM_DAC("Left DAC", NULL, ES8326_ANA_PDN, 1, 1),
@@ -142,15 +216,10 @@ static const struct snd_soc_dapm_widget es8326_dapm_widgets[] = { · 13 unmodified lines
142216 };
143217
144218 static const struct snd_soc_dapm_route es8326_dapm_routes[] = {
145− {"ADC L1", NULL, "MIC1"},
146− {"ADC R1", NULL, "MIC2"},
147− {"ADC L2", NULL, "MIC3"},
148− {"ADC R2", NULL, "MIC4"},
149−
150− {"ADC L", NULL, "ADC L1"},
151− {"ADC R", NULL, "ADC R1"},
152− {"ADC L", NULL, "ADC L2"},
153− {"ADC R", NULL, "ADC R2"},
219+ {"ADC L", NULL, "MIC1"},
220+ {"ADC R", NULL, "MIC2"},
221+ {"ADC L", NULL, "MIC3"},
222+ {"ADC R", NULL, "MIC4"},
154223
155224 {"I2S OUT", NULL, "ADC L"},
156225 {"I2S OUT", NULL, "ADC R"},
@@ -440,10 +509,16 @@ static int es8326_mute(struct snd_soc_dai *dai, int mute, int direction) · 283 unmodified lines
440509 unsigned int offset_l, offset_r;
441510
442511 if (mute) {
443− regmap_write(es8326->regmap, ES8326_HP_CAL, ES8326_HP_OFF);
444− regmap_update_bits(es8326->regmap, ES8326_DAC_MUTE,
445− ES8326_MUTE_MASK, ES8326_MUTE);
446− regmap_write(es8326->regmap, ES8326_HP_DRIVER, 0xf0);
512+ if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
513+ regmap_write(es8326->regmap, ES8326_HP_CAL, ES8326_HP_OFF);
514+ regmap_update_bits(es8326->regmap, ES8326_DAC_MUTE,
515+ ES8326_MUTE_MASK, ES8326_MUTE);
516+ regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF,
517+ 0x30, 0x00);
518+ } else {
519+ regmap_update_bits(es8326->regmap, ES8326_ADC_MUTE,
520+ 0x0F, 0x0F);
521+ }
447522 } else {
448523 if (!es8326->calibrated) {
449524 regmap_write(es8326->regmap, ES8326_HP_CAL, ES8326_HP_FORCE_CAL);
@@ -456,11 +531,22 @@ static int es8326_mute(struct snd_soc_dai *dai, int mute, int direction) · 6 unmodified lines
456531 regmap_write(es8326->regmap, ES8326_HPR_OFFSET_INI, offset_r);
457532 es8326->calibrated = true;
458533 }
459− regmap_write(es8326->regmap, ES8326_HP_DRIVER, 0xa1);
460− regmap_write(es8326->regmap, ES8326_HP_VOL, 0x91);
461− regmap_write(es8326->regmap, ES8326_HP_CAL, ES8326_HP_ON);
462− regmap_update_bits(es8326->regmap, ES8326_DAC_MUTE,
463− ES8326_MUTE_MASK, ~(ES8326_MUTE));
534+ if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
535+ regmap_update_bits(es8326->regmap, ES8326_DAC_DSM, 0x01, 0x01);
536+ usleep_range(1000, 5000);
537+ regmap_update_bits(es8326->regmap, ES8326_DAC_DSM, 0x01, 0x00);
538+ usleep_range(1000, 5000);
539+ regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, 0x30, 0x20);
540+ regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, 0x30, 0x30);
541+ regmap_write(es8326->regmap, ES8326_HP_DRIVER, 0xa1);
542+ regmap_write(es8326->regmap, ES8326_HP_CAL, ES8326_HP_ON);
543+ regmap_update_bits(es8326->regmap, ES8326_DAC_MUTE,
544+ ES8326_MUTE_MASK, ~(ES8326_MUTE));
545+ } else {
546+ msleep(300);
547+ regmap_update_bits(es8326->regmap, ES8326_ADC_MUTE,
548+ 0x0F, 0x00);
549+ }
464550 }
465551 return 0;
466552 }
@@ -477,23 +563,20 @@ static int es8326_set_bias_level(struct snd_soc_component *codec, · 10 unmodified lines
477563 if (ret)
478564 return ret;
479565
480− regmap_update_bits(es8326->regmap, ES8326_DAC_DSM, 0x01, 0x00);
566+ regmap_update_bits(es8326->regmap, ES8326_RESET, 0x02, 0x02);
567+ usleep_range(5000, 10000);
481568 regmap_write(es8326->regmap, ES8326_INTOUT_IO, es8326->interrupt_clk);
482569 regmap_write(es8326->regmap, ES8326_SDINOUT1_IO,
483570 (ES8326_IO_DMIC_CLK << ES8326_SDINOUT1_SHIFT));
484− regmap_write(es8326->regmap, ES8326_VMIDSEL, 0x0E);
485571 regmap_write(es8326->regmap, ES8326_PGA_PDN, 0x40);
486572 regmap_write(es8326->regmap, ES8326_ANA_PDN, 0x00);
487573 regmap_update_bits(es8326->regmap, ES8326_CLK_CTL, 0x20, 0x20);
488−
489− regmap_update_bits(es8326->regmap, ES8326_RESET,
490− ES8326_CSM_ON, ES8326_CSM_ON);
574+ regmap_update_bits(es8326->regmap, ES8326_RESET, 0x02, 0x00);
491575 break;
492576 case SND_SOC_BIAS_PREPARE:
493577 break;
494578 case SND_SOC_BIAS_STANDBY:
495579 regmap_write(es8326->regmap, ES8326_ANA_PDN, 0x3b);
496− regmap_write(es8326->regmap, ES8326_VMIDSEL, 0x00);
497580 regmap_update_bits(es8326->regmap, ES8326_CLK_CTL, 0x20, 0x00);
498581 regmap_write(es8326->regmap, ES8326_SDINOUT1_IO, ES8326_IO_INPUT);
499582 break;
@@ -513,7 +596,7 @@ static const struct snd_soc_dai_ops es8326_ops = { · 13 unmodified lines
513596 .set_fmt = es8326_set_dai_fmt,
514597 .set_sysclk = es8326_set_dai_sysclk,
515598 .mute_stream = es8326_mute,
516− .no_capture_mute = 1,
599+ .no_capture_mute = 0,
517600 };
518601
519602 static struct snd_soc_dai_driver es8326_dai = {
@@ -672,6 +755,8 @@ static void es8326_jack_detect_handler(struct work_struct *work) · 152 unmodified lines
672755 es8326->hp = 0;
673756 }
674757 regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x01);
758+ regmap_write(es8326->regmap, ES8326_SYS_BIAS, 0x0a);
759+ regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, 0x0f, 0x03);
675760 /*
676761 * Inverted HPJACK_POL bit to trigger one IRQ to double check HP Removal event
677762 */
@@ -695,8 +780,11 @@ static void es8326_jack_detect_handler(struct work_struct *work) · 17 unmodified lines
695780 * Don't report jack status.
696781 */
697782 regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x01);
783+ es8326_enable_micbias(es8326->component);
698784 usleep_range(50000, 70000);
699785 regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x00);
786+ regmap_write(es8326->regmap, ES8326_SYS_BIAS, 0x1f);
787+ regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, 0x0f, 0x08);
700788 queue_delayed_work(system_wq, &es8326->jack_detect_work,
701789 msecs_to_jiffies(400));
702790 es8326->hp = 1;
@@ -736,13 +824,10 @@ exit: · 33 unmodified lines
736824 static irqreturn_t es8326_irq(int irq, void *dev_id)
737825 {
738826 struct es8326_priv *es8326 = dev_id;
739− struct snd_soc_component *comp = es8326->component;
740827
741828 if (!es8326->jack)
742829 goto out;
743830
744− es8326_enable_micbias(comp);
745−
746831 if (es8326->jack->status & SND_JACK_HEADSET)
747832 queue_delayed_work(system_wq, &es8326->jack_detect_work,
748833 msecs_to_jiffies(10));
@@ -766,14 +851,14 @@ static int es8326_calibrate(struct snd_soc_component *component) · 17 unmodified lines
766851 if ((es8326->version == ES8326_VERSION_B) && (es8326->calibrated == false)) {
767852 dev_dbg(component->dev, "ES8326_VERSION_B, calibrating\n");
768853 regmap_write(es8326->regmap, ES8326_CLK_INV, 0xc0);
769− regmap_write(es8326->regmap, ES8326_CLK_DIV1, 0x01);
854+ regmap_write(es8326->regmap, ES8326_CLK_DIV1, 0x03);
770855 regmap_write(es8326->regmap, ES8326_CLK_DLL, 0x30);
771856 regmap_write(es8326->regmap, ES8326_CLK_MUX, 0xed);
772857 regmap_write(es8326->regmap, ES8326_CLK_DAC_SEL, 0x08);
773858 regmap_write(es8326->regmap, ES8326_CLK_TRI, 0xc1);
774859 regmap_write(es8326->regmap, ES8326_DAC_MUTE, 0x03);
775860 regmap_write(es8326->regmap, ES8326_ANA_VSEL, 0x7f);
776− regmap_write(es8326->regmap, ES8326_VMIDLOW, 0x03);
861+ regmap_write(es8326->regmap, ES8326_VMIDLOW, 0x23);
777862 regmap_write(es8326->regmap, ES8326_DAC2HPMIX, 0x88);
778863 usleep_range(15000, 20000);
779864 regmap_write(es8326->regmap, ES8326_HP_OFFSET_CAL, 0x8c);
@@ -814,13 +899,13 @@ static int es8326_resume(struct snd_soc_component *component) · 34 unmodified lines
814899 /* reset internal clock state */
815900 regmap_write(es8326->regmap, ES8326_RESET, 0x1f);
816901 regmap_write(es8326->regmap, ES8326_VMIDSEL, 0x0E);
902+ regmap_write(es8326->regmap, ES8326_ANA_LP, 0xf0);
817903 usleep_range(10000, 15000);
818904 regmap_write(es8326->regmap, ES8326_HPJACK_TIMER, 0xe9);
819− regmap_write(es8326->regmap, ES8326_ANA_MICBIAS, 0x4b);
905+ regmap_write(es8326->regmap, ES8326_ANA_MICBIAS, 0xcb);
820906 /* set headphone default type and detect pin */
821907 regmap_write(es8326->regmap, ES8326_HPDET_TYPE, 0x83);
822908 regmap_write(es8326->regmap, ES8326_CLK_RESAMPLE, 0x05);
823− regmap_write(es8326->regmap, ES8326_HP_MISC, 0x30);
824909
825910 /* set internal oscillator as clock source of headpone cp */
826911 regmap_write(es8326->regmap, ES8326_CLK_DIV_CPC, 0x89);
@@ -828,14 +913,15 @@ static int es8326_resume(struct snd_soc_component *component) · 1 unmodified line
828913 /* clock manager reset release */
829914 regmap_write(es8326->regmap, ES8326_RESET, 0x17);
830915 /* set headphone detection as half scan mode */
831− regmap_write(es8326->regmap, ES8326_HP_MISC, 0x30);
916+ regmap_write(es8326->regmap, ES8326_HP_MISC, 0x3d);
832917 regmap_write(es8326->regmap, ES8326_PULLUP_CTL, 0x00);
833918
834919 /* enable headphone driver */
920+ regmap_write(es8326->regmap, ES8326_HP_VOL, 0xc4);
835921 regmap_write(es8326->regmap, ES8326_HP_DRIVER, 0xa7);
836922 usleep_range(2000, 5000);
837− regmap_write(es8326->regmap, ES8326_HP_DRIVER_REF, 0xa3);
838− regmap_write(es8326->regmap, ES8326_HP_DRIVER_REF, 0xb3);
923+ regmap_write(es8326->regmap, ES8326_HP_DRIVER_REF, 0x23);
924+ regmap_write(es8326->regmap, ES8326_HP_DRIVER_REF, 0x33);
839925 regmap_write(es8326->regmap, ES8326_HP_DRIVER, 0xa1);
840926
841927 regmap_write(es8326->regmap, ES8326_CLK_INV, 0x00);
@@ -844,6 +930,8 @@ static int es8326_resume(struct snd_soc_component *component) · 2 unmodified lines
844930 regmap_write(es8326->regmap, ES8326_CLK_CAL_TIME, 0x00);
845931 /* calibrate for B version */
846932 es8326_calibrate(component);
933+ regmap_write(es8326->regmap, ES8326_DAC_CROSSTALK, 0xaa);
934+ regmap_write(es8326->regmap, ES8326_DAC_RAMPRATE, 0x00);
847935 /* turn off headphone out */
848936 regmap_write(es8326->regmap, ES8326_HP_CAL, 0x00);
849937 /* set ADC and DAC in low power mode */
@@ -856,6 +944,14 @@ static int es8326_resume(struct snd_soc_component *component) · 6 unmodified lines
856944 regmap_write(es8326->regmap, ES8326_DAC_DSM, 0x08);
857945 regmap_write(es8326->regmap, ES8326_DAC_VPPSCALE, 0x15);
858946
947+ regmap_write(es8326->regmap, ES8326_HPDET_TYPE, 0x80 |
948+ ((es8326->version == ES8326_VERSION_B) ?
949+ (ES8326_HP_DET_SRC_PIN9 | es8326->jack_pol) :
950+ (ES8326_HP_DET_SRC_PIN9 | es8326->jack_pol | 0x04)));
951+ usleep_range(5000, 10000);
952+ es8326_enable_micbias(es8326->component);
953+ usleep_range(50000, 70000);
954+ regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x00);
859955 regmap_write(es8326->regmap, ES8326_INT_SOURCE,
860956 (ES8326_INT_SRC_PIN9 | ES8326_INT_SRC_BUTTON));
861957 regmap_write(es8326->regmap, ES8326_INTOUT_IO,
@@ -864,7 +960,7 @@ static int es8326_resume(struct snd_soc_component *component) · 2 unmodified lines
864960 (ES8326_IO_DMIC_CLK << ES8326_SDINOUT1_SHIFT));
865961 regmap_write(es8326->regmap, ES8326_SDINOUT23_IO, ES8326_IO_INPUT);
866962
867− regmap_write(es8326->regmap, ES8326_ANA_PDN, 0x3b);
963+ regmap_write(es8326->regmap, ES8326_ANA_PDN, 0x00);
868964 regmap_write(es8326->regmap, ES8326_RESET, ES8326_CSM_ON);
869965 regmap_update_bits(es8326->regmap, ES8326_PGAGAIN, ES8326_MIC_SEL_MASK,
870966 ES8326_MIC1_SEL);
@@ -872,11 +968,7 @@ static int es8326_resume(struct snd_soc_component *component) · 1 unmodified line
872968 regmap_update_bits(es8326->regmap, ES8326_DAC_MUTE, ES8326_MUTE_MASK,
873969 ES8326_MUTE);
874970
875− regmap_write(es8326->regmap, ES8326_HPDET_TYPE, 0x80 |
876− ((es8326->version == ES8326_VERSION_B) ?
877− (ES8326_HP_DET_SRC_PIN9 | es8326->jack_pol) :
878− (ES8326_HP_DET_SRC_PIN9 | es8326->jack_pol | 0x04)));
879− regmap_write(es8326->regmap, ES8326_HP_VOL, 0x11);
971+ regmap_write(es8326->regmap, ES8326_ADC_MUTE, 0x0f);
880972
881973 es8326->jack_remove_retry = 0;
882974 es8326->hp = 0;
sound/soc/codecs/es8326.h+2−1
@@ -72,6 +72,7 @@ · 71 unmodified lines
7272 #define ES8326_DAC_VOL 0x50
7373 #define ES8326_DRC_RECOVERY 0x53
7474 #define ES8326_DRC_WINSIZE 0x54
75+#define ES8326_DAC_CROSSTALK 0x55
7576 #define ES8326_HPJACK_TIMER 0x56
7677 #define ES8326_HPDET_TYPE 0x57
7778 #define ES8326_INT_SOURCE 0x58
@@ -100,7 +101,7 @@ · 22 unmodified lines
100101 #define ES8326_MUTE (3 << 0)
101102
102103 /* ES8326_CLK_CTL */
103−#define ES8326_CLK_ON (0x7f << 0)
104+#define ES8326_CLK_ON (0x7e << 0)
104105 #define ES8326_CLK_OFF (0 << 0)
105106
106107 /* ES8326_CLK_INV */
sound/soc/codecs/lpass-wsa-macro.c+0−7
@@ -1584,7 +1584,6 @@ static int wsa_macro_enable_interpolator(struct snd_soc_dapm_widget *w, · 1583 unmodified lines
15841584 u16 gain_reg;
15851585 u16 reg;
15861586 int val;
1587− int offset_val = 0;
15881587 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component);
15891588
15901589 if (w->shift == WSA_MACRO_COMP1) {
@@ -1623,10 +1622,8 @@ static int wsa_macro_enable_interpolator(struct snd_soc_dapm_widget *w, · 32 unmodified lines
16231622 CDC_WSA_RX1_RX_PATH_MIX_SEC0,
16241623 CDC_WSA_RX_PGA_HALF_DB_MASK,
16251624 CDC_WSA_RX_PGA_HALF_DB_ENABLE);
1626− offset_val = -2;
16271625 }
16281626 val = snd_soc_component_read(component, gain_reg);
1629− val += offset_val;
16301627 snd_soc_component_write(component, gain_reg, val);
16311628 wsa_macro_config_ear_spkr_gain(component, wsa,
16321629 event, gain_reg);
@@ -1654,10 +1651,6 @@ static int wsa_macro_enable_interpolator(struct snd_soc_dapm_widget *w, · 21 unmodified lines
16541651 CDC_WSA_RX1_RX_PATH_MIX_SEC0,
16551652 CDC_WSA_RX_PGA_HALF_DB_MASK,
16561653 CDC_WSA_RX_PGA_HALF_DB_DISABLE);
1657− offset_val = 2;
1658− val = snd_soc_component_read(component, gain_reg);
1659− val += offset_val;
1660− snd_soc_component_write(component, gain_reg, val);
16611654 }
16621655 wsa_macro_config_ear_spkr_gain(component, wsa,
16631656 event, gain_reg);
sound/soc/codecs/wcd9335.c+0−4
@@ -3033,7 +3033,6 @@ static int wcd9335_codec_enable_mix_path(struct snd_soc_dapm_widget *w, · 3032 unmodified lines
30333033 {
30343034 struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm);
30353035 u16 gain_reg;
3036− int offset_val = 0;
30373036 int val = 0;
30383037
30393038 switch (w->reg) {
@@ -3073,7 +3072,6 @@ static int wcd9335_codec_enable_mix_path(struct snd_soc_dapm_widget *w, · 33 unmodified lines
30733072 switch (event) {
30743073 case SND_SOC_DAPM_POST_PMU:
30753074 val = snd_soc_component_read(comp, gain_reg);
3076− val += offset_val;
30773075 snd_soc_component_write(comp, gain_reg, val);
30783076 break;
30793077 case SND_SOC_DAPM_POST_PMD:
@@ -3294,7 +3292,6 @@ static int wcd9335_codec_enable_interpolator(struct snd_soc_dapm_widget *w, · 214 unmodified lines
32943292 u16 gain_reg;
32953293 u16 reg;
32963294 int val;
3297− int offset_val = 0;
32983295
32993296 if (!(snd_soc_dapm_widget_name_cmp(w, "RX INT0 INTERP"))) {
33003297 reg = WCD9335_CDC_RX0_RX_PATH_CTL;
@@ -3337,7 +3334,6 @@ static int wcd9335_codec_enable_interpolator(struct snd_soc_dapm_widget *w, · 36 unmodified lines
33373334 case SND_SOC_DAPM_POST_PMU:
33383335 wcd9335_config_compander(comp, w->shift, event);
33393336 val = snd_soc_component_read(comp, gain_reg);
3340− val += offset_val;
33413337 snd_soc_component_write(comp, gain_reg, val);
33423338 break;
33433339 case SND_SOC_DAPM_POST_PMD:
sound/soc/codecs/wcd934x.c+0−1
@@ -13,7 +13,6 @@ · 12 unmodified lines
1313 #include <linux/of.h>
1414 #include <linux/platform_device.h>
1515 #include <linux/regmap.h>
16−#include <linux/regulator/consumer.h>
1716 #include <linux/slab.h>
1817 #include <linux/slimbus.h>
1918 #include <sound/pcm_params.h>
sound/soc/codecs/wcd938x.c+3−5
@@ -210,7 +210,7 @@ struct wcd938x_priv { · 209 unmodified lines
210210 };
211211
212212 static const SNDRV_CTL_TLVD_DECLARE_DB_MINMAX(ear_pa_gain, 600, -1800);
213−static const DECLARE_TLV_DB_SCALE(line_gain, -3000, 150, -3000);
213+static const DECLARE_TLV_DB_SCALE(line_gain, -3000, 150, 0);
214214 static const SNDRV_CTL_TLVD_DECLARE_DB_MINMAX(analog_gain, 0, 3000);
215215
216216 struct wcd938x_mbhc_zdet_param {
@@ -3587,10 +3587,8 @@ static int wcd938x_probe(struct platform_device *pdev) · 3370 unmodified lines
35873587 mutex_init(&wcd938x->micb_lock);
35883588
35893589 ret = wcd938x_populate_dt_data(wcd938x, dev);
3590− if (ret) {
3591− dev_err(dev, "%s: Fail to obtain platform data\n", __func__);
3592− return -EINVAL;
3593− }
3590+ if (ret)
3591+ return ret;
35943592
35953593 ret = wcd938x_add_slave_components(wcd938x, dev, &match);
35963594 if (ret)
sound/soc/codecs/wm_adsp.c+31−42
@@ -739,19 +739,25 @@ static int wm_adsp_request_firmware_file(struct wm_adsp *dsp, · 738 unmodified lines
739739 const char *filetype)
740740 {
741741 struct cs_dsp *cs_dsp = &dsp->cs_dsp;
742+ const char *fwf;
742743 char *s, c;
743744 int ret = 0;
744745
746+ if (dsp->fwf_name)
747+ fwf = dsp->fwf_name;
748+ else
749+ fwf = dsp->cs_dsp.name;
750+
745751 if (system_name && asoc_component_prefix)
746752 *filename = kasprintf(GFP_KERNEL, "%s%s-%s-%s-%s-%s.%s", dir, dsp->part,
747− dsp->fwf_name, wm_adsp_fw[dsp->fw].file, system_name,
753+ fwf, wm_adsp_fw[dsp->fw].file, system_name,
748754 asoc_component_prefix, filetype);
749755 else if (system_name)
750756 *filename = kasprintf(GFP_KERNEL, "%s%s-%s-%s-%s.%s", dir, dsp->part,
751− dsp->fwf_name, wm_adsp_fw[dsp->fw].file, system_name,
757+ fwf, wm_adsp_fw[dsp->fw].file, system_name,
752758 filetype);
753759 else
754− *filename = kasprintf(GFP_KERNEL, "%s%s-%s-%s.%s", dir, dsp->part, dsp->fwf_name,
760+ *filename = kasprintf(GFP_KERNEL, "%s%s-%s-%s.%s", dir, dsp->part, fwf,
755761 wm_adsp_fw[dsp->fw].file, filetype);
756762
757763 if (*filename == NULL)
@@ -823,6 +829,23 @@ static int wm_adsp_request_firmware_files(struct wm_adsp *dsp, · 65 unmodified lines
823829 }
824830 }
825831
832+ /* Check system-specific bin without wmfw before falling back to generic */
833+ if (dsp->wmfw_optional && system_name) {
834+ if (asoc_component_prefix)
835+ wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename,
836+ cirrus_dir, system_name,
837+ asoc_component_prefix, "bin");
838+
839+ if (!*coeff_firmware)
840+ wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename,
841+ cirrus_dir, system_name,
842+ NULL, "bin");
843+
844+ if (*coeff_firmware)
845+ return 0;
846+ }
847+
848+ /* Check legacy location */
826849 if (!wm_adsp_request_firmware_file(dsp, wmfw_firmware, wmfw_filename,
827850 "", NULL, NULL, "wmfw")) {
828851 wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename,
@@ -830,62 +853,28 @@ static int wm_adsp_request_firmware_files(struct wm_adsp *dsp, · 1 unmodified line
830853 return 0;
831854 }
832855
856+ /* Fall back to generic wmfw and optional matching bin */
833857 ret = wm_adsp_request_firmware_file(dsp, wmfw_firmware, wmfw_filename,
834858 cirrus_dir, NULL, NULL, "wmfw");
835− if (!ret) {
859+ if (!ret || dsp->wmfw_optional) {
836860 wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename,
837861 cirrus_dir, NULL, NULL, "bin");
838862 return 0;
839863 }
840864
841− if (dsp->wmfw_optional) {
842− if (system_name) {
843− if (asoc_component_prefix)
844− wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename,
845− cirrus_dir, system_name,
846− asoc_component_prefix, "bin");
847−
848− if (!*coeff_firmware)
849− wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename,
850− cirrus_dir, system_name,
851− NULL, "bin");
852− }
853−
854− if (!*coeff_firmware)
855− wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename,
856− "", NULL, NULL, "bin");
857−
858− if (!*coeff_firmware)
859− wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename,
860− cirrus_dir, NULL, NULL, "bin");
861−
862− return 0;
863− }
864−
865865 adsp_err(dsp, "Failed to request firmware <%s>%s-%s-%s<-%s<%s>>.wmfw\n",
866− cirrus_dir, dsp->part, dsp->fwf_name, wm_adsp_fw[dsp->fw].file,
867− system_name, asoc_component_prefix);
866+ cirrus_dir, dsp->part,
867+ dsp->fwf_name ? dsp->fwf_name : dsp->cs_dsp.name,
868+ wm_adsp_fw[dsp->fw].file, system_name, asoc_component_prefix);
868869
869870 return -ENOENT;
870871 }
871872
872873 static int wm_adsp_common_init(struct wm_adsp *dsp)
873874 {
874− char *p;
875−
876875 INIT_LIST_HEAD(&dsp->compr_list);
877876 INIT_LIST_HEAD(&dsp->buffer_list);
878877
879− if (!dsp->fwf_name) {
880− p = devm_kstrdup(dsp->cs_dsp.dev, dsp->cs_dsp.name, GFP_KERNEL);
881− if (!p)
882− return -ENOMEM;
883−
884− dsp->fwf_name = p;
885− for (; *p != 0; ++p)
886− *p = tolower(*p);
887− }
888−
889878 return 0;
890879 }
891880
sound/soc/codecs/wsa883x.c+5−1
@@ -1098,7 +1098,11 @@ static int wsa_dev_mode_put(struct snd_kcontrol *kcontrol, · 1097 unmodified lines
10981098 return 1;
10991099 }
11001100
1101−static const DECLARE_TLV_DB_SCALE(pa_gain, -300, 150, -300);
1101+static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(pa_gain,
1102+ 0, 14, TLV_DB_SCALE_ITEM(-300, 0, 0),
1103+ 15, 29, TLV_DB_SCALE_ITEM(-300, 150, 0),
1104+ 30, 31, TLV_DB_SCALE_ITEM(1800, 0, 0),
1105+);
11021106
11031107 static int wsa883x_get_swr_port(struct snd_kcontrol *kcontrol,
11041108 struct snd_ctl_elem_value *ucontrol)
sound/soc/qcom/sc8280xp.c+7−5
@@ -32,12 +32,14 @@ static int sc8280xp_snd_init(struct snd_soc_pcm_runtime *rtd) · 31 unmodified lines
3232 case WSA_CODEC_DMA_RX_0:
3333 case WSA_CODEC_DMA_RX_1:
3434 /*
35− * set limit of 0dB on Digital Volume for Speakers,
36− * this can prevent damage of speakers to some extent without
37− * active speaker protection
35+ * Set limit of -3 dB on Digital Volume and 0 dB on PA Volume
36+ * to reduce the risk of speaker damage until we have active
37+ * speaker protection in place.
3838 */
39− snd_soc_limit_volume(card, "WSA_RX0 Digital Volume", 84);
40− snd_soc_limit_volume(card, "WSA_RX1 Digital Volume", 84);
39+ snd_soc_limit_volume(card, "WSA_RX0 Digital Volume", 81);
40+ snd_soc_limit_volume(card, "WSA_RX1 Digital Volume", 81);
41+ snd_soc_limit_volume(card, "SpkrLeft PA Volume", 17);
42+ snd_soc_limit_volume(card, "SpkrRight PA Volume", 17);
4143 break;
4244 default:
4345 break;
sound/soc/soc-core.c+4−1
@@ -1037,7 +1037,7 @@ component_dai_empty: · 1036 unmodified lines
10371037 return -EINVAL;
10381038 }
10391039
1040−#define MAX_DEFAULT_CH_MAP_SIZE 7
1040+#define MAX_DEFAULT_CH_MAP_SIZE 8
10411041 static struct snd_soc_dai_link_ch_map default_ch_map_sync[MAX_DEFAULT_CH_MAP_SIZE] = {
10421042 { .cpu = 0, .codec = 0 },
10431043 { .cpu = 1, .codec = 1 },
@@ -1046,6 +1046,7 @@ static struct snd_soc_dai_link_ch_map default_ch_map_sync[MAX_DEFAULT_CH_MAP_SIZ · 2 unmodified lines
10461046 { .cpu = 4, .codec = 4 },
10471047 { .cpu = 5, .codec = 5 },
10481048 { .cpu = 6, .codec = 6 },
1049+ { .cpu = 7, .codec = 7 },
10491050 };
10501051 static struct snd_soc_dai_link_ch_map default_ch_map_1cpu[MAX_DEFAULT_CH_MAP_SIZE] = {
10511052 { .cpu = 0, .codec = 0 },
@@ -1055,6 +1056,7 @@ static struct snd_soc_dai_link_ch_map default_ch_map_1cpu[MAX_DEFAULT_CH_MAP_SIZ · 3 unmodified lines
10551056 { .cpu = 0, .codec = 4 },
10561057 { .cpu = 0, .codec = 5 },
10571058 { .cpu = 0, .codec = 6 },
1059+ { .cpu = 0, .codec = 7 },
10581060 };
10591061 static struct snd_soc_dai_link_ch_map default_ch_map_1codec[MAX_DEFAULT_CH_MAP_SIZE] = {
10601062 { .cpu = 0, .codec = 0 },
@@ -1064,6 +1066,7 @@ static struct snd_soc_dai_link_ch_map default_ch_map_1codec[MAX_DEFAULT_CH_MAP_S · 3 unmodified lines
10641066 { .cpu = 4, .codec = 0 },
10651067 { .cpu = 5, .codec = 0 },
10661068 { .cpu = 6, .codec = 0 },
1069+ { .cpu = 7, .codec = 0 },
10671070 };
10681071 static int snd_soc_compensate_channel_connection_map(struct snd_soc_card *card,
10691072 struct snd_soc_dai_link *dai_link)
sound/soc/sunxi/sun4i-spdif.c+5−0
@@ -577,6 +577,11 @@ static const struct of_device_id sun4i_spdif_of_match[] = { · 576 unmodified lines
577577 .compatible = "allwinner,sun50i-h6-spdif",
578578 .data = &sun50i_h6_spdif_quirks,
579579 },
580+ {
581+ .compatible = "allwinner,sun50i-h616-spdif",
582+ /* Essentially the same as the H6, but without RX */
583+ .data = &sun50i_h6_spdif_quirks,
584+ },
580585 { /* sentinel */ }
581586 };
582587 MODULE_DEVICE_TABLE(of, sun4i_spdif_of_match);
sound/usb/clock.c+32−2
@@ -261,6 +261,8 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip, · 260 unmodified lines
261261 int ret, i, cur, err, pins, clock_id;
262262 const u8 *sources;
263263 int proto = fmt->protocol;
264+ bool readable, writeable;
265+ u32 bmControls;
264266
265267 entity_id &= 0xff;
266268
@@ -292,11 +294,27 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip, · 25 unmodified lines
292294 sources = GET_VAL(selector, proto, baCSourceID);
293295 cur = 0;
294296
297+ if (proto == UAC_VERSION_3)
298+ bmControls = le32_to_cpu(*(__le32 *)(&selector->v3.baCSourceID[0] + pins));
299+ else
300+ bmControls = *(__u8 *)(&selector->v2.baCSourceID[0] + pins);
301+
302+ readable = uac_v2v3_control_is_readable(bmControls,
303+ UAC2_CX_CLOCK_SELECTOR);
304+ writeable = uac_v2v3_control_is_writeable(bmControls,
305+ UAC2_CX_CLOCK_SELECTOR);
306+
295307 if (pins == 1) {
296308 ret = 1;
297309 goto find_source;
298310 }
299311
312+ /* for now just warn about buggy device */
313+ if (!readable)
314+ usb_audio_warn(chip,
315+ "%s(): clock selector control is not readable, id %d\n",
316+ __func__, clock_id);
317+
300318 /* the entity ID we are looking at is a selector.
301319 * find out what it currently selects */
302320 ret = uac_clock_selector_get_val(chip, clock_id);
@@ -325,17 +343,29 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip, · 22 unmodified lines
325343 visited, validate);
326344 if (ret > 0) {
327345 /* Skip setting clock selector again for some devices */
328− if (chip->quirk_flags & QUIRK_FLAG_SKIP_CLOCK_SELECTOR)
346+ if (chip->quirk_flags & QUIRK_FLAG_SKIP_CLOCK_SELECTOR ||
347+ !writeable)
329348 return ret;
330349 err = uac_clock_selector_set_val(chip, entity_id, cur);
331− if (err < 0)
350+ if (err < 0) {
351+ if (pins == 1) {
352+ usb_audio_dbg(chip,
353+ "%s(): selector returned an error, "
354+ "assuming a firmware bug, id %d, ret %d\n",
355+ __func__, clock_id, err);
356+ return ret;
357+ }
332358 return err;
359+ }
333360 }
334361
335362 if (!validate || ret > 0 || !chip->autoclock)
336363 return ret;
337364
338365 find_others:
366+ if (!writeable)
367+ return -ENXIO;
368+
339369 /* The current clock source is invalid, try others. */
340370 for (i = 1; i <= pins; i++) {
341371 if (i == cur)
sound/usb/format.c+20−0
@@ -470,9 +470,11 @@ static int validate_sample_rate_table_v2v3(struct snd_usb_audio *chip, · 469 unmodified lines
470470 int clock)
471471 {
472472 struct usb_device *dev = chip->dev;
473+ struct usb_host_interface *alts;
473474 unsigned int *table;
474475 unsigned int nr_rates;
475476 int i, err;
477+ u32 bmControls;
476478
477479 /* performing the rate verification may lead to unexpected USB bus
478480 * behavior afterwards by some unknown reason. Do this only for the
@@ -481,6 +483,24 @@ static int validate_sample_rate_table_v2v3(struct snd_usb_audio *chip, · 2 unmodified lines
481483 if (!(chip->quirk_flags & QUIRK_FLAG_VALIDATE_RATES))
482484 return 0; /* don't perform the validation as default */
483485
486+ alts = snd_usb_get_host_interface(chip, fp->iface, fp->altsetting);
487+ if (!alts)
488+ return 0;
489+
490+ if (fp->protocol == UAC_VERSION_3) {
491+ struct uac3_as_header_descriptor *as = snd_usb_find_csint_desc(
492+ alts->extra, alts->extralen, NULL, UAC_AS_GENERAL);
493+ bmControls = le32_to_cpu(as->bmControls);
494+ } else {
495+ struct uac2_as_header_descriptor *as = snd_usb_find_csint_desc(
496+ alts->extra, alts->extralen, NULL, UAC_AS_GENERAL);
497+ bmControls = as->bmControls;
498+ }
499+
500+ if (!uac_v2v3_control_is_readable(bmControls,
501+ UAC2_AS_VAL_ALT_SETTINGS))
502+ return 0;
503+
484504 table = kcalloc(fp->nr_rates, sizeof(*table), GFP_KERNEL);
485505 if (!table)
486506 return -ENOMEM;
sound/usb/midi2.c+1−1
@@ -1085,7 +1085,7 @@ int snd_usb_midi_v2_create(struct snd_usb_audio *chip, · 1084 unmodified lines
10851085 }
10861086 if ((quirk && quirk->type != QUIRK_MIDI_STANDARD_INTERFACE) ||
10871087 iface->num_altsetting < 2) {
1088− usb_audio_info(chip, "Quirk or no altest; falling back to MIDI 1.0\n");
1088+ usb_audio_info(chip, "Quirk or no altset; falling back to MIDI 1.0\n");
10891089 goto fallback_to_midi1;
10901090 }
10911091 hostif = &iface->altsetting[1];
sound/usb/quirks.c+22−16
@@ -2031,10 +2031,14 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { · 2030 unmodified lines
20312031 QUIRK_FLAG_CTL_MSG_DELAY_1M | QUIRK_FLAG_IGNORE_CTL_ERROR),
20322032 DEVICE_FLG(0x0499, 0x1509, /* Steinberg UR22 */
20332033 QUIRK_FLAG_GENERIC_IMPLICIT_FB),
2034+ DEVICE_FLG(0x0499, 0x3108, /* Yamaha YIT-W12TX */
2035+ QUIRK_FLAG_GET_SAMPLE_RATE),
20342036 DEVICE_FLG(0x04d8, 0xfeea, /* Benchmark DAC1 Pre */
20352037 QUIRK_FLAG_GET_SAMPLE_RATE),
20362038 DEVICE_FLG(0x04e8, 0xa051, /* Samsung USBC Headset (AKG) */
20372039 QUIRK_FLAG_SKIP_CLOCK_SELECTOR | QUIRK_FLAG_CTL_MSG_DELAY_5M),
2040+ DEVICE_FLG(0x0525, 0xa4ad, /* Hamedal C20 usb camero */
2041+ QUIRK_FLAG_IFACE_SKIP_CLOSE),
20382042 DEVICE_FLG(0x054c, 0x0b8c, /* Sony WALKMAN NW-A45 DAC */
20392043 QUIRK_FLAG_SET_IFACE_FIRST),
20402044 DEVICE_FLG(0x0556, 0x0014, /* Phoenix Audio TMX320VC */
@@ -2073,14 +2077,22 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { · 32 unmodified lines
20732077 QUIRK_FLAG_GENERIC_IMPLICIT_FB),
20742078 DEVICE_FLG(0x0763, 0x2031, /* M-Audio Fast Track C600 */
20752079 QUIRK_FLAG_GENERIC_IMPLICIT_FB),
2080+ DEVICE_FLG(0x07fd, 0x000b, /* MOTU M Series 2nd hardware revision */
2081+ QUIRK_FLAG_CTL_MSG_DELAY_1M),
20762082 DEVICE_FLG(0x08bb, 0x2702, /* LineX FM Transmitter */
20772083 QUIRK_FLAG_IGNORE_CTL_ERROR),
20782084 DEVICE_FLG(0x0951, 0x16ad, /* Kingston HyperX */
20792085 QUIRK_FLAG_CTL_MSG_DELAY_1M),
20802086 DEVICE_FLG(0x0b0e, 0x0349, /* Jabra 550a */
20812087 QUIRK_FLAG_CTL_MSG_DELAY_1M),
2088+ DEVICE_FLG(0x0ecb, 0x205c, /* JBL Quantum610 Wireless */
2089+ QUIRK_FLAG_FIXED_RATE),
2090+ DEVICE_FLG(0x0ecb, 0x2069, /* JBL Quantum810 Wireless */
2091+ QUIRK_FLAG_FIXED_RATE),
20822092 DEVICE_FLG(0x0fd9, 0x0008, /* Hauppauge HVR-950Q */
20832093 QUIRK_FLAG_SHARE_MEDIA_DEVICE | QUIRK_FLAG_ALIGN_TRANSFER),
2094+ DEVICE_FLG(0x1224, 0x2a25, /* Jieli Technology USB PHY 2.0 */
2095+ QUIRK_FLAG_GET_SAMPLE_RATE),
20842096 DEVICE_FLG(0x1395, 0x740a, /* Sennheiser DECT */
20852097 QUIRK_FLAG_GET_SAMPLE_RATE),
20862098 DEVICE_FLG(0x1397, 0x0507, /* Behringer UMC202HD */
@@ -2113,6 +2125,10 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { · 26 unmodified lines
21132125 QUIRK_FLAG_ITF_USB_DSD_DAC | QUIRK_FLAG_CTL_MSG_DELAY),
21142126 DEVICE_FLG(0x1901, 0x0191, /* GE B850V3 CP2114 audio interface */
21152127 QUIRK_FLAG_GET_SAMPLE_RATE),
2128+ DEVICE_FLG(0x19f7, 0x0035, /* RODE NT-USB+ */
2129+ QUIRK_FLAG_GET_SAMPLE_RATE),
2130+ DEVICE_FLG(0x1bcf, 0x2283, /* NexiGo N930AF FHD Webcam */
2131+ QUIRK_FLAG_GET_SAMPLE_RATE),
21162132 DEVICE_FLG(0x2040, 0x7200, /* Hauppauge HVR-950Q */
21172133 QUIRK_FLAG_SHARE_MEDIA_DEVICE | QUIRK_FLAG_ALIGN_TRANSFER),
21182134 DEVICE_FLG(0x2040, 0x7201, /* Hauppauge HVR-950Q-MXL */
@@ -2155,6 +2171,12 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { · 36 unmodified lines
21552171 QUIRK_FLAG_IGNORE_CTL_ERROR),
21562172 DEVICE_FLG(0x2912, 0x30c8, /* Audioengine D1 */
21572173 QUIRK_FLAG_GET_SAMPLE_RATE),
2174+ DEVICE_FLG(0x2b53, 0x0023, /* Fiero SC-01 (firmware v1.0.0 @ 48 kHz) */
2175+ QUIRK_FLAG_GENERIC_IMPLICIT_FB),
2176+ DEVICE_FLG(0x2b53, 0x0024, /* Fiero SC-01 (firmware v1.0.0 @ 96 kHz) */
2177+ QUIRK_FLAG_GENERIC_IMPLICIT_FB),
2178+ DEVICE_FLG(0x2b53, 0x0031, /* Fiero SC-01 (firmware v1.1.0) */
2179+ QUIRK_FLAG_GENERIC_IMPLICIT_FB),
21582180 DEVICE_FLG(0x30be, 0x0101, /* Schiit Hel */
21592181 QUIRK_FLAG_IGNORE_CTL_ERROR),
21602182 DEVICE_FLG(0x413c, 0xa506, /* Dell AE515 sound bar */
@@ -2163,22 +2185,6 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { · 2 unmodified lines
21632185 QUIRK_FLAG_ALIGN_TRANSFER),
21642186 DEVICE_FLG(0x534d, 0x2109, /* MacroSilicon MS2109 */
21652187 QUIRK_FLAG_ALIGN_TRANSFER),
2166− DEVICE_FLG(0x1224, 0x2a25, /* Jieli Technology USB PHY 2.0 */
2167− QUIRK_FLAG_GET_SAMPLE_RATE),
2168− DEVICE_FLG(0x2b53, 0x0023, /* Fiero SC-01 (firmware v1.0.0 @ 48 kHz) */
2169− QUIRK_FLAG_GENERIC_IMPLICIT_FB),
2170− DEVICE_FLG(0x2b53, 0x0024, /* Fiero SC-01 (firmware v1.0.0 @ 96 kHz) */
2171− QUIRK_FLAG_GENERIC_IMPLICIT_FB),
2172− DEVICE_FLG(0x2b53, 0x0031, /* Fiero SC-01 (firmware v1.1.0) */
2173− QUIRK_FLAG_GENERIC_IMPLICIT_FB),
2174− DEVICE_FLG(0x0525, 0xa4ad, /* Hamedal C20 usb camero */
2175− QUIRK_FLAG_IFACE_SKIP_CLOSE),
2176− DEVICE_FLG(0x0ecb, 0x205c, /* JBL Quantum610 Wireless */
2177− QUIRK_FLAG_FIXED_RATE),
2178− DEVICE_FLG(0x0ecb, 0x2069, /* JBL Quantum810 Wireless */
2179− QUIRK_FLAG_FIXED_RATE),
2180− DEVICE_FLG(0x1bcf, 0x2283, /* NexiGo N930AF FHD Webcam */
2181− QUIRK_FLAG_GET_SAMPLE_RATE),
21822188
21832189 /* Vendor matches */
21842190 VENDOR_FLG(0x045e, /* MS Lifecam */
sound/virtio/virtio_card.c+0−2
@@ -91,8 +91,6 @@ static void virtsnd_event_notify_cb(struct virtqueue *vqueue) · 90 unmodified lines
9191 virtsnd_event_dispatch(snd, event);
9292 virtsnd_event_send(vqueue, event, true, GFP_ATOMIC);
9393 }
94− if (unlikely(virtqueue_is_broken(vqueue)))
95− break;
9694 } while (!virtqueue_enable_cb(vqueue));
9795 spin_unlock_irqrestore(&queue->lock, flags);
9896 }
sound/virtio/virtio_ctl_msg.c+0−2
@@ -303,8 +303,6 @@ void virtsnd_ctl_notify_cb(struct virtqueue *vqueue) · 302 unmodified lines
303303 virtqueue_disable_cb(vqueue);
304304 while ((msg = virtqueue_get_buf(vqueue, &length)))
305305 virtsnd_ctl_msg_complete(msg);
306− if (unlikely(virtqueue_is_broken(vqueue)))
307− break;
308306 } while (!virtqueue_enable_cb(vqueue));
309307 spin_unlock_irqrestore(&queue->lock, flags);
310308 }
sound/virtio/virtio_pcm_msg.c+0−2
@@ -358,8 +358,6 @@ static inline void virtsnd_pcm_notify_cb(struct virtio_snd_queue *queue) · 357 unmodified lines
358358 virtqueue_disable_cb(queue->vqueue);
359359 while ((msg = virtqueue_get_buf(queue->vqueue, &written_bytes)))
360360 virtsnd_pcm_msg_complete(msg, written_bytes);
361− if (unlikely(virtqueue_is_broken(queue->vqueue)))
362− break;
363361 } while (!virtqueue_enable_cb(queue->vqueue));
364362 spin_unlock_irqrestore(&queue->lock, flags);
365363 }
tools/arch/x86/include/asm/cpufeatures.h+7−1
@@ -198,6 +198,7 @@ · 197 unmodified lines
198198 #define X86_FEATURE_CAT_L3 ( 7*32+ 4) /* Cache Allocation Technology L3 */
199199 #define X86_FEATURE_CAT_L2 ( 7*32+ 5) /* Cache Allocation Technology L2 */
200200 #define X86_FEATURE_CDP_L3 ( 7*32+ 6) /* Code and Data Prioritization L3 */
201+#define X86_FEATURE_TDX_HOST_PLATFORM ( 7*32+ 7) /* Platform supports being a TDX host */
201202 #define X86_FEATURE_HW_PSTATE ( 7*32+ 8) /* AMD HW-PState */
202203 #define X86_FEATURE_PROC_FEEDBACK ( 7*32+ 9) /* AMD ProcFeedbackInterface */
203204 #define X86_FEATURE_XCOMPACTED ( 7*32+10) /* "" Use compacted XSTATE (XSAVES or XSAVEC) */
@@ -308,10 +309,14 @@ · 104 unmodified lines
308309 #define X86_FEATURE_SMBA (11*32+21) /* "" Slow Memory Bandwidth Allocation */
309310 #define X86_FEATURE_BMEC (11*32+22) /* "" Bandwidth Monitoring Event Configuration */
310311 #define X86_FEATURE_USER_SHSTK (11*32+23) /* Shadow stack support for user mode applications */
311−
312312 #define X86_FEATURE_SRSO (11*32+24) /* "" AMD BTB untrain RETs */
313313 #define X86_FEATURE_SRSO_ALIAS (11*32+25) /* "" AMD BTB untrain RETs through aliasing */
314314 #define X86_FEATURE_IBPB_ON_VMEXIT (11*32+26) /* "" Issue an IBPB only on VMEXIT */
315+#define X86_FEATURE_APIC_MSRS_FENCE (11*32+27) /* "" IA32_TSC_DEADLINE and X2APIC MSRs need fencing */
316+#define X86_FEATURE_ZEN2 (11*32+28) /* "" CPU based on Zen2 microarchitecture */
317+#define X86_FEATURE_ZEN3 (11*32+29) /* "" CPU based on Zen3 microarchitecture */
318+#define X86_FEATURE_ZEN4 (11*32+30) /* "" CPU based on Zen4 microarchitecture */
319+#define X86_FEATURE_ZEN1 (11*32+31) /* "" CPU based on Zen1 microarchitecture */
315320
316321 /* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */
317322 #define X86_FEATURE_AVX_VNNI (12*32+ 4) /* AVX VNNI instructions */
@@ -495,6 +500,7 @@ · 177 unmodified lines
495500 #define X86_BUG_EIBRS_PBRSB X86_BUG(28) /* EIBRS is vulnerable to Post Barrier RSB Predictions */
496501 #define X86_BUG_SMT_RSB X86_BUG(29) /* CPU is vulnerable to Cross-Thread Return Address Predictions */
497502 #define X86_BUG_GDS X86_BUG(30) /* CPU is affected by Gather Data Sampling */
503+#define X86_BUG_TDX_PW_MCE X86_BUG(31) /* CPU may incur #MC if non-TD software does partial write to TDX private memory */
498504
499505 /* BUG word 2 */
500506 #define X86_BUG_SRSO X86_BUG(1*32 + 0) /* AMD SRSO bug */
tools/arch/x86/include/asm/msr-index.h+8−0
@@ -237,6 +237,11 @@ · 236 unmodified lines
237237 #define LBR_INFO_CYCLES 0xffff
238238 #define LBR_INFO_BR_TYPE_OFFSET 56
239239 #define LBR_INFO_BR_TYPE (0xfull << LBR_INFO_BR_TYPE_OFFSET)
240+#define LBR_INFO_BR_CNTR_OFFSET 32
241+#define LBR_INFO_BR_CNTR_NUM 4
242+#define LBR_INFO_BR_CNTR_BITS 2
243+#define LBR_INFO_BR_CNTR_MASK GENMASK_ULL(LBR_INFO_BR_CNTR_BITS - 1, 0)
244+#define LBR_INFO_BR_CNTR_FULL_MASK GENMASK_ULL(LBR_INFO_BR_CNTR_NUM * LBR_INFO_BR_CNTR_BITS - 1, 0)
240245
241246 #define MSR_ARCH_LBR_CTL 0x000014ce
242247 #define ARCH_LBR_CTL_LBREN BIT(0)
@@ -536,6 +541,9 @@ · 293 unmodified lines
536541 #define MSR_RELOAD_PMC0 0x000014c1
537542 #define MSR_RELOAD_FIXED_CTR0 0x00001309
538543
544+/* KeyID partitioning between MKTME and TDX */
545+#define MSR_IA32_MKTME_KEYID_PARTITIONING 0x00000087
546+
539547 /*
540548 * AMD64 MSRs. Not complete. See the architecture manual for a more
541549 * complete list.
tools/arch/x86/include/uapi/asm/kvm.h+3−0
@@ -562,4 +562,7 @@ struct kvm_pmu_event_filter { · 561 unmodified lines
562562 /* x86-specific KVM_EXIT_HYPERCALL flags. */
563563 #define KVM_EXIT_HYPERCALL_LONG_MODE BIT(0)
564564
565+#define KVM_X86_DEFAULT_VM 0
566+#define KVM_X86_SW_PROTECTED_VM 1
567+
565568 #endif /* _ASM_X86_KVM_H */
tools/arch/x86/lib/memcpy_64.S+2−2
@@ -1,11 +1,11 @@
11 /* SPDX-License-Identifier: GPL-2.0-only */
22 /* Copyright 2002 Andi Kleen */
33
4+#include <linux/export.h>
45 #include <linux/linkage.h>
56 #include <asm/errno.h>
67 #include <asm/cpufeatures.h>
78 #include <asm/alternative.h>
8−#include <asm/export.h>
99
1010 .section .noinstr.text, "ax"
1111
@@ -39,7 +39,7 @@ SYM_TYPED_FUNC_START(__memcpy) · 27 unmodified lines
3939 SYM_FUNC_END(__memcpy)
4040 EXPORT_SYMBOL(__memcpy)
4141
42−SYM_FUNC_ALIAS(memcpy, __memcpy)
42+SYM_FUNC_ALIAS_MEMFUNC(memcpy, __memcpy)
4343 EXPORT_SYMBOL(memcpy)
4444
4545 SYM_FUNC_START_LOCAL(memcpy_orig)
tools/arch/x86/lib/memset_64.S+2−2
@@ -1,10 +1,10 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
22 /* Copyright 2002 Andi Kleen, SuSE Labs */
33
4+#include <linux/export.h>
45 #include <linux/linkage.h>
56 #include <asm/cpufeatures.h>
67 #include <asm/alternative.h>
7−#include <asm/export.h>
88
99 .section .noinstr.text, "ax"
1010
@@ -40,7 +40,7 @@ SYM_FUNC_START(__memset) · 29 unmodified lines
4040 SYM_FUNC_END(__memset)
4141 EXPORT_SYMBOL(__memset)
4242
43−SYM_FUNC_ALIAS(memset, __memset)
43+SYM_FUNC_ALIAS_MEMFUNC(memset, __memset)
4444 EXPORT_SYMBOL(memset)
4545
4646 SYM_FUNC_START_LOCAL(memset_orig)
tools/include/asm-generic/unaligned.h+12−12
@@ -105,9 +105,9 @@ static inline u32 get_unaligned_le24(const void *p) · 104 unmodified lines
105105
106106 static inline void __put_unaligned_be24(const u32 val, u8 *p)
107107 {
108− *p++ = val >> 16;
109− *p++ = val >> 8;
110− *p++ = val;
108+ *p++ = (val >> 16) & 0xff;
109+ *p++ = (val >> 8) & 0xff;
110+ *p++ = val & 0xff;
111111 }
112112
113113 static inline void put_unaligned_be24(const u32 val, void *p)
@@ -117,9 +117,9 @@ static inline void put_unaligned_be24(const u32 val, void *p) · 3 unmodified lines
117117
118118 static inline void __put_unaligned_le24(const u32 val, u8 *p)
119119 {
120− *p++ = val;
121− *p++ = val >> 8;
122− *p++ = val >> 16;
120+ *p++ = val & 0xff;
121+ *p++ = (val >> 8) & 0xff;
122+ *p++ = (val >> 16) & 0xff;
123123 }
124124
125125 static inline void put_unaligned_le24(const u32 val, void *p)
@@ -129,12 +129,12 @@ static inline void put_unaligned_le24(const u32 val, void *p) · 3 unmodified lines
129129
130130 static inline void __put_unaligned_be48(const u64 val, u8 *p)
131131 {
132− *p++ = val >> 40;
133− *p++ = val >> 32;
134− *p++ = val >> 24;
135− *p++ = val >> 16;
136− *p++ = val >> 8;
137− *p++ = val;
132+ *p++ = (val >> 40) & 0xff;
133+ *p++ = (val >> 32) & 0xff;
134+ *p++ = (val >> 24) & 0xff;
135+ *p++ = (val >> 16) & 0xff;
136+ *p++ = (val >> 8) & 0xff;
137+ *p++ = val & 0xff;
138138 }
139139
140140 static inline void put_unaligned_be48(const u64 val, void *p)
tools/include/uapi/asm-generic/unistd.h+14−1
@@ -829,8 +829,21 @@ __SYSCALL(__NR_futex_wait, sys_futex_wait) · 828 unmodified lines
829829 #define __NR_futex_requeue 456
830830 __SYSCALL(__NR_futex_requeue, sys_futex_requeue)
831831
832+#define __NR_statmount 457
833+__SYSCALL(__NR_statmount, sys_statmount)
834+
835+#define __NR_listmount 458
836+__SYSCALL(__NR_listmount, sys_listmount)
837+
838+#define __NR_lsm_get_self_attr 459
839+__SYSCALL(__NR_lsm_get_self_attr, sys_lsm_get_self_attr)
840+#define __NR_lsm_set_self_attr 460
841+__SYSCALL(__NR_lsm_set_self_attr, sys_lsm_set_self_attr)
842+#define __NR_lsm_list_modules 461
843+__SYSCALL(__NR_lsm_list_modules, sys_lsm_list_modules)
844+
832845 #undef __NR_syscalls
833−#define __NR_syscalls 457
846+#define __NR_syscalls 462
834847
835848 /*
836849 * 32 bit systems traditionally used different
tools/include/uapi/drm/drm.h+71−1
@@ -713,7 +713,8 @@ struct drm_gem_open { · 712 unmodified lines
713713 /**
714714 * DRM_CAP_ASYNC_PAGE_FLIP
715715 *
716− * If set to 1, the driver supports &DRM_MODE_PAGE_FLIP_ASYNC.
716+ * If set to 1, the driver supports &DRM_MODE_PAGE_FLIP_ASYNC for legacy
717+ * page-flips.
717718 */
718719 #define DRM_CAP_ASYNC_PAGE_FLIP 0x7
719720 /**
@@ -773,6 +774,13 @@ struct drm_gem_open { · 53 unmodified lines
773774 * :ref:`drm_sync_objects`.
774775 */
775776 #define DRM_CAP_SYNCOBJ_TIMELINE 0x14
777+/**
778+ * DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP
779+ *
780+ * If set to 1, the driver supports &DRM_MODE_PAGE_FLIP_ASYNC for atomic
781+ * commits.
782+ */
783+#define DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP 0x15
776784
777785 /* DRM_IOCTL_GET_CAP ioctl argument type */
778786 struct drm_get_cap {
@@ -842,6 +850,31 @@ struct drm_get_cap { · 63 unmodified lines
842850 */
843851 #define DRM_CLIENT_CAP_WRITEBACK_CONNECTORS 5
844852
853+/**
854+ * DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT
855+ *
856+ * Drivers for para-virtualized hardware (e.g. vmwgfx, qxl, virtio and
857+ * virtualbox) have additional restrictions for cursor planes (thus
858+ * making cursor planes on those drivers not truly universal,) e.g.
859+ * they need cursor planes to act like one would expect from a mouse
860+ * cursor and have correctly set hotspot properties.
861+ * If this client cap is not set the DRM core will hide cursor plane on
862+ * those virtualized drivers because not setting it implies that the
863+ * client is not capable of dealing with those extra restictions.
864+ * Clients which do set cursor hotspot and treat the cursor plane
865+ * like a mouse cursor should set this property.
866+ * The client must enable &DRM_CLIENT_CAP_ATOMIC first.
867+ *
868+ * Setting this property on drivers which do not special case
869+ * cursor planes (i.e. non-virtualized drivers) will return
870+ * EOPNOTSUPP, which can be used by userspace to gauge
871+ * requirements of the hardware/drivers they're running on.
872+ *
873+ * This capability is always supported for atomic-capable virtualized
874+ * drivers starting from kernel version 6.6.
875+ */
876+#define DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT 6
877+
845878 /* DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */
846879 struct drm_set_client_cap {
847880 __u64 capability;
@@ -893,6 +926,7 @@ struct drm_syncobj_transfer { · 45 unmodified lines
893926 #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0)
894927 #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1)
895928 #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE (1 << 2) /* wait for time point to become available */
929+#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_DEADLINE (1 << 3) /* set fence deadline to deadline_nsec */
896930 struct drm_syncobj_wait {
897931 __u64 handles;
898932 /* absolute timeout */
@@ -901,6 +935,14 @@ struct drm_syncobj_wait { · 2 unmodified lines
901935 __u32 flags;
902936 __u32 first_signaled; /* only valid when not waiting all */
903937 __u32 pad;
938+ /**
939+ * @deadline_nsec - fence deadline hint
940+ *
941+ * Deadline hint, in absolute CLOCK_MONOTONIC, to set on backing
942+ * fence(s) if the DRM_SYNCOBJ_WAIT_FLAGS_WAIT_DEADLINE flag is
943+ * set.
944+ */
945+ __u64 deadline_nsec;
904946 };
905947
906948 struct drm_syncobj_timeline_wait {
@@ -913,6 +955,14 @@ struct drm_syncobj_timeline_wait { · 6 unmodified lines
913955 __u32 flags;
914956 __u32 first_signaled; /* only valid when not waiting all */
915957 __u32 pad;
958+ /**
959+ * @deadline_nsec - fence deadline hint
960+ *
961+ * Deadline hint, in absolute CLOCK_MONOTONIC, to set on backing
962+ * fence(s) if the DRM_SYNCOBJ_WAIT_FLAGS_WAIT_DEADLINE flag is
963+ * set.
964+ */
965+ __u64 deadline_nsec;
916966 };
917967
918968 /**
@@ -1218,6 +1268,26 @@ extern "C" { · 299 unmodified lines
12181268
12191269 #define DRM_IOCTL_SYNCOBJ_EVENTFD DRM_IOWR(0xCF, struct drm_syncobj_eventfd)
12201270
1271+/**
1272+ * DRM_IOCTL_MODE_CLOSEFB - Close a framebuffer.
1273+ *
1274+ * This closes a framebuffer previously added via ADDFB/ADDFB2. The IOCTL
1275+ * argument is a framebuffer object ID.
1276+ *
1277+ * This IOCTL is similar to &DRM_IOCTL_MODE_RMFB, except it doesn't disable
1278+ * planes and CRTCs. As long as the framebuffer is used by a plane, it's kept
1279+ * alive. When the plane no longer uses the framebuffer (because the
1280+ * framebuffer is replaced with another one, or the plane is disabled), the
1281+ * framebuffer is cleaned up.
1282+ *
1283+ * This is useful to implement flicker-free transitions between two processes.
1284+ *
1285+ * Depending on the threat model, user-space may want to ensure that the
1286+ * framebuffer doesn't expose any sensitive user information: closed
1287+ * framebuffers attached to a plane can be read back by the next DRM master.
1288+ */
1289+#define DRM_IOCTL_MODE_CLOSEFB DRM_IOWR(0xD0, struct drm_mode_closefb)
1290+
12211291 /*
12221292 * Device specific ioctls should only be in their respective headers
12231293 * The device specific ioctl range is from 0x40 to 0x9f.
tools/include/uapi/drm/i915_drm.h+6−6
@@ -693,7 +693,7 @@ typedef struct drm_i915_irq_wait { · 692 unmodified lines
693693 #define I915_PARAM_HAS_EXEC_FENCE 44
694694
695695 /* Query whether DRM_I915_GEM_EXECBUFFER2 supports the ability to capture
696− * user specified bufffers for post-mortem debugging of GPU hangs. See
696+ * user-specified buffers for post-mortem debugging of GPU hangs. See
697697 * EXEC_OBJECT_CAPTURE.
698698 */
699699 #define I915_PARAM_HAS_EXEC_CAPTURE 45
@@ -1606,7 +1606,7 @@ struct drm_i915_gem_busy { · 906 unmodified lines
16061606 * is accurate.
16071607 *
16081608 * The returned dword is split into two fields to indicate both
1609− * the engine classess on which the object is being read, and the
1609+ * the engine classes on which the object is being read, and the
16101610 * engine class on which it is currently being written (if any).
16111611 *
16121612 * The low word (bits 0:15) indicate if the object is being written
@@ -1815,7 +1815,7 @@ struct drm_i915_gem_madvise { · 202 unmodified lines
18151815 __u32 handle;
18161816
18171817 /* Advice: either the buffer will be needed again in the near future,
1818− * or wont be and could be discarded under memory pressure.
1818+ * or won't be and could be discarded under memory pressure.
18191819 */
18201820 __u32 madv;
18211821
@@ -3246,7 +3246,7 @@ struct drm_i915_query_topology_info { · 1424 unmodified lines
32463246 * // enough to hold our array of engines. The kernel will fill out the
32473247 * // item.length for us, which is the number of bytes we need.
32483248 * //
3249− * // Alternatively a large buffer can be allocated straight away enabling
3249+ * // Alternatively a large buffer can be allocated straightaway enabling
32503250 * // querying in one pass, in which case item.length should contain the
32513251 * // length of the provided buffer.
32523252 * err = ioctl(fd, DRM_IOCTL_I915_QUERY, &query);
@@ -3256,7 +3256,7 @@ struct drm_i915_query_topology_info { · 3 unmodified lines
32563256 * // Now that we allocated the required number of bytes, we call the ioctl
32573257 * // again, this time with the data_ptr pointing to our newly allocated
32583258 * // blob, which the kernel can then populate with info on all engines.
3259− * item.data_ptr = (uintptr_t)&info,
3259+ * item.data_ptr = (uintptr_t)&info;
32603260 *
32613261 * err = ioctl(fd, DRM_IOCTL_I915_QUERY, &query);
32623262 * if (err) ...
@@ -3286,7 +3286,7 @@ struct drm_i915_query_topology_info { · 23 unmodified lines
32863286 /**
32873287 * struct drm_i915_engine_info
32883288 *
3289− * Describes one engine and it's capabilities as known to the driver.
3289+ * Describes one engine and its capabilities as known to the driver.
32903290 */
32913291 struct drm_i915_engine_info {
32923292 /** @engine: Engine class and instance. */
tools/include/uapi/linux/fcntl.h+3−0
@@ -116,5 +116,8 @@ · 115 unmodified lines
116116 #define AT_HANDLE_FID AT_REMOVEDIR /* file handle is needed to
117117 compare object identity and may not
118118 be usable to open_by_handle_at(2) */
119+#if defined(__KERNEL__)
120+#define AT_GETATTR_NOSEC 0x80000000
121+#endif
119122
120123 #endif /* _UAPI_LINUX_FCNTL_H */
tools/include/uapi/linux/kvm.h+50−90
@@ -16,76 +16,6 @@ · 15 unmodified lines
1616
1717 #define KVM_API_VERSION 12
1818
19−/* *** Deprecated interfaces *** */
20−
21−#define KVM_TRC_SHIFT 16
22−
23−#define KVM_TRC_ENTRYEXIT (1 << KVM_TRC_SHIFT)
24−#define KVM_TRC_HANDLER (1 << (KVM_TRC_SHIFT + 1))
25−
26−#define KVM_TRC_VMENTRY (KVM_TRC_ENTRYEXIT + 0x01)
27−#define KVM_TRC_VMEXIT (KVM_TRC_ENTRYEXIT + 0x02)
28−#define KVM_TRC_PAGE_FAULT (KVM_TRC_HANDLER + 0x01)
29−
30−#define KVM_TRC_HEAD_SIZE 12
31−#define KVM_TRC_CYCLE_SIZE 8
32−#define KVM_TRC_EXTRA_MAX 7
33−
34−#define KVM_TRC_INJ_VIRQ (KVM_TRC_HANDLER + 0x02)
35−#define KVM_TRC_REDELIVER_EVT (KVM_TRC_HANDLER + 0x03)
36−#define KVM_TRC_PEND_INTR (KVM_TRC_HANDLER + 0x04)
37−#define KVM_TRC_IO_READ (KVM_TRC_HANDLER + 0x05)
38−#define KVM_TRC_IO_WRITE (KVM_TRC_HANDLER + 0x06)
39−#define KVM_TRC_CR_READ (KVM_TRC_HANDLER + 0x07)
40−#define KVM_TRC_CR_WRITE (KVM_TRC_HANDLER + 0x08)
41−#define KVM_TRC_DR_READ (KVM_TRC_HANDLER + 0x09)
42−#define KVM_TRC_DR_WRITE (KVM_TRC_HANDLER + 0x0A)
43−#define KVM_TRC_MSR_READ (KVM_TRC_HANDLER + 0x0B)
44−#define KVM_TRC_MSR_WRITE (KVM_TRC_HANDLER + 0x0C)
45−#define KVM_TRC_CPUID (KVM_TRC_HANDLER + 0x0D)
46−#define KVM_TRC_INTR (KVM_TRC_HANDLER + 0x0E)
47−#define KVM_TRC_NMI (KVM_TRC_HANDLER + 0x0F)
48−#define KVM_TRC_VMMCALL (KVM_TRC_HANDLER + 0x10)
49−#define KVM_TRC_HLT (KVM_TRC_HANDLER + 0x11)
50−#define KVM_TRC_CLTS (KVM_TRC_HANDLER + 0x12)
51−#define KVM_TRC_LMSW (KVM_TRC_HANDLER + 0x13)
52−#define KVM_TRC_APIC_ACCESS (KVM_TRC_HANDLER + 0x14)
53−#define KVM_TRC_TDP_FAULT (KVM_TRC_HANDLER + 0x15)
54−#define KVM_TRC_GTLB_WRITE (KVM_TRC_HANDLER + 0x16)
55−#define KVM_TRC_STLB_WRITE (KVM_TRC_HANDLER + 0x17)
56−#define KVM_TRC_STLB_INVAL (KVM_TRC_HANDLER + 0x18)
57−#define KVM_TRC_PPC_INSTR (KVM_TRC_HANDLER + 0x19)
58−
59−struct kvm_user_trace_setup {
60− __u32 buf_size;
61− __u32 buf_nr;
62−};
63−
64−#define __KVM_DEPRECATED_MAIN_W_0x06 \
65− _IOW(KVMIO, 0x06, struct kvm_user_trace_setup)
66−#define __KVM_DEPRECATED_MAIN_0x07 _IO(KVMIO, 0x07)
67−#define __KVM_DEPRECATED_MAIN_0x08 _IO(KVMIO, 0x08)
68−
69−#define __KVM_DEPRECATED_VM_R_0x70 _IOR(KVMIO, 0x70, struct kvm_assigned_irq)
70−
71−struct kvm_breakpoint {
72− __u32 enabled;
73− __u32 padding;
74− __u64 address;
75−};
76−
77−struct kvm_debug_guest {
78− __u32 enabled;
79− __u32 pad;
80− struct kvm_breakpoint breakpoints[4];
81− __u32 singlestep;
82−};
83−
84−#define __KVM_DEPRECATED_VCPU_W_0x87 _IOW(KVMIO, 0x87, struct kvm_debug_guest)
85−
86−/* *** End of deprecated interfaces *** */
87−
88−
8919 /* for KVM_SET_USER_MEMORY_REGION */
9020 struct kvm_userspace_memory_region {
9121 __u32 slot;
@@ -95,6 +25,19 @@ struct kvm_userspace_memory_region { · 3 unmodified lines
9525 __u64 userspace_addr; /* start of the userspace allocated memory */
9626 };
9727
28+/* for KVM_SET_USER_MEMORY_REGION2 */
29+struct kvm_userspace_memory_region2 {
30+ __u32 slot;
31+ __u32 flags;
32+ __u64 guest_phys_addr;
33+ __u64 memory_size;
34+ __u64 userspace_addr;
35+ __u64 guest_memfd_offset;
36+ __u32 guest_memfd;
37+ __u32 pad1;
38+ __u64 pad2[14];
39+};
40+
9841 /*
9942 * The bit 0 ~ bit 15 of kvm_userspace_memory_region::flags are visible for
10043 * userspace, other bits are reserved for kvm internal use which are defined
@@ -102,6 +45,7 @@ struct kvm_userspace_memory_region { · 1 unmodified line
10245 */
10346 #define KVM_MEM_LOG_DIRTY_PAGES (1UL << 0)
10447 #define KVM_MEM_READONLY (1UL << 1)
48+#define KVM_MEM_GUEST_MEMFD (1UL << 2)
10549
10650 /* for KVM_IRQ_LINE */
10751 struct kvm_irq_level {
@@ -265,6 +209,7 @@ struct kvm_xen_exit { · 157 unmodified lines
265209 #define KVM_EXIT_RISCV_CSR 36
266210 #define KVM_EXIT_NOTIFY 37
267211 #define KVM_EXIT_LOONGARCH_IOCSR 38
212+#define KVM_EXIT_MEMORY_FAULT 39
268213
269214 /* For KVM_EXIT_INTERNAL_ERROR */
270215 /* Emulate instruction failed. */
@@ -518,6 +463,13 @@ struct kvm_run { · 247 unmodified lines
518463 #define KVM_NOTIFY_CONTEXT_INVALID (1 << 0)
519464 __u32 flags;
520465 } notify;
466+ /* KVM_EXIT_MEMORY_FAULT */
467+ struct {
468+#define KVM_MEMORY_EXIT_FLAG_PRIVATE (1ULL << 3)
469+ __u64 flags;
470+ __u64 gpa;
471+ __u64 size;
472+ } memory_fault;
521473 /* Fix the size of the union. */
522474 char padding[256];
523475 };
@@ -945,9 +897,6 @@ struct kvm_ppc_resize_hpt { · 421 unmodified lines
945897 */
946898 #define KVM_GET_VCPU_MMAP_SIZE _IO(KVMIO, 0x04) /* in bytes */
947899 #define KVM_GET_SUPPORTED_CPUID _IOWR(KVMIO, 0x05, struct kvm_cpuid2)
948−#define KVM_TRACE_ENABLE __KVM_DEPRECATED_MAIN_W_0x06
949−#define KVM_TRACE_PAUSE __KVM_DEPRECATED_MAIN_0x07
950−#define KVM_TRACE_DISABLE __KVM_DEPRECATED_MAIN_0x08
951900 #define KVM_GET_EMULATED_CPUID _IOWR(KVMIO, 0x09, struct kvm_cpuid2)
952901 #define KVM_GET_MSR_FEATURE_INDEX_LIST _IOWR(KVMIO, 0x0a, struct kvm_msr_list)
953902
@@ -1201,6 +1150,11 @@ struct kvm_ppc_resize_hpt { · 247 unmodified lines
12011150 #define KVM_CAP_ARM_EAGER_SPLIT_CHUNK_SIZE 228
12021151 #define KVM_CAP_ARM_SUPPORTED_BLOCK_SIZES 229
12031152 #define KVM_CAP_ARM_SUPPORTED_REG_MASK_RANGES 230
1153+#define KVM_CAP_USER_MEMORY2 231
1154+#define KVM_CAP_MEMORY_FAULT_INFO 232
1155+#define KVM_CAP_MEMORY_ATTRIBUTES 233
1156+#define KVM_CAP_GUEST_MEMFD 234
1157+#define KVM_CAP_VM_TYPES 235
12041158
12051159 #ifdef KVM_CAP_IRQ_ROUTING
12061160
@@ -1291,6 +1245,7 @@ struct kvm_x86_mce { · 84 unmodified lines
12911245 #define KVM_XEN_HVM_CONFIG_EVTCHN_2LEVEL (1 << 4)
12921246 #define KVM_XEN_HVM_CONFIG_EVTCHN_SEND (1 << 5)
12931247 #define KVM_XEN_HVM_CONFIG_RUNSTATE_UPDATE_FLAG (1 << 6)
1248+#define KVM_XEN_HVM_CONFIG_PVCLOCK_TSC_UNSTABLE (1 << 7)
12941249
12951250 struct kvm_xen_hvm_config {
12961251 __u32 flags;
@@ -1483,6 +1438,8 @@ struct kvm_vfio_spapr_tce { · 186 unmodified lines
14831438 struct kvm_userspace_memory_region)
14841439 #define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47)
14851440 #define KVM_SET_IDENTITY_MAP_ADDR _IOW(KVMIO, 0x48, __u64)
1441+#define KVM_SET_USER_MEMORY_REGION2 _IOW(KVMIO, 0x49, \
1442+ struct kvm_userspace_memory_region2)
14861443
14871444 /* enable ucontrol for s390 */
14881445 struct kvm_s390_ucas_mapping {
@@ -1507,20 +1464,8 @@ struct kvm_s390_ucas_mapping { · 18 unmodified lines
15071464 _IOW(KVMIO, 0x67, struct kvm_coalesced_mmio_zone)
15081465 #define KVM_UNREGISTER_COALESCED_MMIO \
15091466 _IOW(KVMIO, 0x68, struct kvm_coalesced_mmio_zone)
1510−#define KVM_ASSIGN_PCI_DEVICE _IOR(KVMIO, 0x69, \
1511− struct kvm_assigned_pci_dev)
15121467 #define KVM_SET_GSI_ROUTING _IOW(KVMIO, 0x6a, struct kvm_irq_routing)
1513−/* deprecated, replaced by KVM_ASSIGN_DEV_IRQ */
1514−#define KVM_ASSIGN_IRQ __KVM_DEPRECATED_VM_R_0x70
1515−#define KVM_ASSIGN_DEV_IRQ _IOW(KVMIO, 0x70, struct kvm_assigned_irq)
15161468 #define KVM_REINJECT_CONTROL _IO(KVMIO, 0x71)
1517−#define KVM_DEASSIGN_PCI_DEVICE _IOW(KVMIO, 0x72, \
1518− struct kvm_assigned_pci_dev)
1519−#define KVM_ASSIGN_SET_MSIX_NR _IOW(KVMIO, 0x73, \
1520− struct kvm_assigned_msix_nr)
1521−#define KVM_ASSIGN_SET_MSIX_ENTRY _IOW(KVMIO, 0x74, \
1522− struct kvm_assigned_msix_entry)
1523−#define KVM_DEASSIGN_DEV_IRQ _IOW(KVMIO, 0x75, struct kvm_assigned_irq)
15241469 #define KVM_IRQFD _IOW(KVMIO, 0x76, struct kvm_irqfd)
15251470 #define KVM_CREATE_PIT2 _IOW(KVMIO, 0x77, struct kvm_pit_config)
15261471 #define KVM_SET_BOOT_CPU_ID _IO(KVMIO, 0x78)
@@ -1537,9 +1482,6 @@ struct kvm_s390_ucas_mapping { · 10 unmodified lines
15371482 * KVM_CAP_VM_TSC_CONTROL to set defaults for a VM */
15381483 #define KVM_SET_TSC_KHZ _IO(KVMIO, 0xa2)
15391484 #define KVM_GET_TSC_KHZ _IO(KVMIO, 0xa3)
1540−/* Available with KVM_CAP_PCI_2_3 */
1541−#define KVM_ASSIGN_SET_INTX_MASK _IOW(KVMIO, 0xa4, \
1542− struct kvm_assigned_pci_dev)
15431485 /* Available with KVM_CAP_SIGNAL_MSI */
15441486 #define KVM_SIGNAL_MSI _IOW(KVMIO, 0xa5, struct kvm_msi)
15451487 /* Available with KVM_CAP_PPC_GET_SMMU_INFO */
@@ -1592,8 +1534,6 @@ struct kvm_s390_ucas_mapping { · 46 unmodified lines
15921534 #define KVM_SET_SREGS _IOW(KVMIO, 0x84, struct kvm_sregs)
15931535 #define KVM_TRANSLATE _IOWR(KVMIO, 0x85, struct kvm_translation)
15941536 #define KVM_INTERRUPT _IOW(KVMIO, 0x86, struct kvm_interrupt)
1595−/* KVM_DEBUG_GUEST is no longer supported, use KVM_SET_GUEST_DEBUG instead */
1596−#define KVM_DEBUG_GUEST __KVM_DEPRECATED_VCPU_W_0x87
15971537 #define KVM_GET_MSRS _IOWR(KVMIO, 0x88, struct kvm_msrs)
15981538 #define KVM_SET_MSRS _IOW(KVMIO, 0x89, struct kvm_msrs)
15991539 #define KVM_SET_CPUID _IOW(KVMIO, 0x8a, struct kvm_cpuid)
@@ -2267,4 +2207,24 @@ struct kvm_s390_zpci_op { · 667 unmodified lines
22672207 /* flags for kvm_s390_zpci_op->u.reg_aen.flags */
22682208 #define KVM_S390_ZPCIOP_REGAEN_HOST (1 << 0)
22692209
2210+/* Available with KVM_CAP_MEMORY_ATTRIBUTES */
2211+#define KVM_SET_MEMORY_ATTRIBUTES _IOW(KVMIO, 0xd2, struct kvm_memory_attributes)
2212+
2213+struct kvm_memory_attributes {
2214+ __u64 address;
2215+ __u64 size;
2216+ __u64 attributes;
2217+ __u64 flags;
2218+};
2219+
2220+#define KVM_MEMORY_ATTRIBUTE_PRIVATE (1ULL << 3)
2221+
2222+#define KVM_CREATE_GUEST_MEMFD _IOWR(KVMIO, 0xd4, struct kvm_create_guest_memfd)
2223+
2224+struct kvm_create_guest_memfd {
2225+ __u64 size;
2226+ __u64 flags;
2227+ __u64 reserved[6];
2228+};
2229+
22702230 #endif /* __LINUX_KVM_H */
tools/include/uapi/linux/mount.h+70−0
@@ -138,4 +138,74 @@ struct mount_attr { · 137 unmodified lines
138138 /* List of all mount_attr versions. */
139139 #define MOUNT_ATTR_SIZE_VER0 32 /* sizeof first published struct */
140140
141+
142+/*
143+ * Structure for getting mount/superblock/filesystem info with statmount(2).
144+ *
145+ * The interface is similar to statx(2): individual fields or groups can be
146+ * selected with the @mask argument of statmount(). Kernel will set the @mask
147+ * field according to the supported fields.
148+ *
149+ * If string fields are selected, then the caller needs to pass a buffer that
150+ * has space after the fixed part of the structure. Nul terminated strings are
151+ * copied there and offsets relative to @str are stored in the relevant fields.
152+ * If the buffer is too small, then EOVERFLOW is returned. The actually used
153+ * size is returned in @size.
154+ */
155+struct statmount {
156+ __u32 size; /* Total size, including strings */
157+ __u32 __spare1;
158+ __u64 mask; /* What results were written */
159+ __u32 sb_dev_major; /* Device ID */
160+ __u32 sb_dev_minor;
161+ __u64 sb_magic; /* ..._SUPER_MAGIC */
162+ __u32 sb_flags; /* SB_{RDONLY,SYNCHRONOUS,DIRSYNC,LAZYTIME} */
163+ __u32 fs_type; /* [str] Filesystem type */
164+ __u64 mnt_id; /* Unique ID of mount */
165+ __u64 mnt_parent_id; /* Unique ID of parent (for root == mnt_id) */
166+ __u32 mnt_id_old; /* Reused IDs used in proc/.../mountinfo */
167+ __u32 mnt_parent_id_old;
168+ __u64 mnt_attr; /* MOUNT_ATTR_... */
169+ __u64 mnt_propagation; /* MS_{SHARED,SLAVE,PRIVATE,UNBINDABLE} */
170+ __u64 mnt_peer_group; /* ID of shared peer group */
171+ __u64 mnt_master; /* Mount receives propagation from this ID */
172+ __u64 propagate_from; /* Propagation from in current namespace */
173+ __u32 mnt_root; /* [str] Root of mount relative to root of fs */
174+ __u32 mnt_point; /* [str] Mountpoint relative to current root */
175+ __u64 __spare2[50];
176+ char str[]; /* Variable size part containing strings */
177+};
178+
179+/*
180+ * Structure for passing mount ID and miscellaneous parameters to statmount(2)
181+ * and listmount(2).
182+ *
183+ * For statmount(2) @param represents the request mask.
184+ * For listmount(2) @param represents the last listed mount id (or zero).
185+ */
186+struct mnt_id_req {
187+ __u32 size;
188+ __u32 spare;
189+ __u64 mnt_id;
190+ __u64 param;
191+};
192+
193+/* List of all mnt_id_req versions. */
194+#define MNT_ID_REQ_SIZE_VER0 24 /* sizeof first published struct */
195+
196+/*
197+ * @mask bits for statmount(2)
198+ */
199+#define STATMOUNT_SB_BASIC 0x00000001U /* Want/got sb_... */
200+#define STATMOUNT_MNT_BASIC 0x00000002U /* Want/got mnt_... */
201+#define STATMOUNT_PROPAGATE_FROM 0x00000004U /* Want/got propagate_from */
202+#define STATMOUNT_MNT_ROOT 0x00000008U /* Want/got mnt_root */
203+#define STATMOUNT_MNT_POINT 0x00000010U /* Want/got mnt_point */
204+#define STATMOUNT_FS_TYPE 0x00000020U /* Want/got fs_type */
205+
206+/*
207+ * Special @mnt_id values that can be passed to listmount
208+ */
209+#define LSMT_ROOT 0xffffffffffffffff /* root mount */
210+
141211 #endif /* _UAPI_LINUX_MOUNT_H */
tools/include/uapi/linux/stat.h+1−0
@@ -154,6 +154,7 @@ struct statx { · 153 unmodified lines
154154 #define STATX_BTIME 0x00000800U /* Want/got stx_btime */
155155 #define STATX_MNT_ID 0x00001000U /* Got stx_mnt_id */
156156 #define STATX_DIOALIGN 0x00002000U /* Want/got direct I/O alignment info */
157+#define STATX_MNT_ID_UNIQUE 0x00004000U /* Want/got extended stx_mount_id */
157158
158159 #define STATX__RESERVED 0x80000000U /* Reserved for future struct statx expansion */
159160
tools/perf/Documentation/perf-list.txt+4−0
@@ -47,6 +47,10 @@ Print PMU events and metrics limited to the specific PMU name. · 46 unmodified lines
4747 --json::
4848 Output in JSON format.
4949
50+-o::
51+--output=::
52+ Output file name. By default output is written to stdout.
53+
5054 [[EVENT_MODIFIERS]]
5155 EVENT MODIFIERS
5256 ---------------
tools/perf/Makefile.perf+10−0
@@ -236,6 +236,16 @@ else · 235 unmodified lines
236236 SHELLCHECK := $(shell which shellcheck 2> /dev/null)
237237 endif
238238
239+# shellcheck is using in tools/perf/tests/Build with option -a/--check-sourced (
240+# introduced in v0.4.7) and -S/--severity (introduced in v0.6.0). So make the
241+# minimal shellcheck version as v0.6.0.
242+ifneq ($(SHELLCHECK),)
243+ ifeq ($(shell expr $(shell $(SHELLCHECK) --version | grep version: | \
244+ sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \< 060), 1)
245+ SHELLCHECK :=
246+ endif
247+endif
248+
239249 export srctree OUTPUT RM CC CXX LD AR CFLAGS CXXFLAGS V BISON FLEX AWK
240250 export HOSTCC HOSTLD HOSTAR HOSTCFLAGS SHELLCHECK
241251
tools/perf/builtin-list.c+129−82
@@ -30,6 +30,8 @@ · 29 unmodified lines
3030 * functions.
3131 */
3232 struct print_state {
33+ /** @fp: File to write output to. */
34+ FILE *fp;
3335 /**
3436 * @pmu_glob: Optionally restrict PMU and metric matching to PMU or
3537 * debugfs subsystem name.
@@ -66,13 +68,15 @@ static void default_print_start(void *ps) · 30 unmodified lines
6668 {
6769 struct print_state *print_state = ps;
6870
69− if (!print_state->name_only && pager_in_use())
70− printf("\nList of pre-defined events (to be used in -e or -M):\n\n");
71+ if (!print_state->name_only && pager_in_use()) {
72+ fprintf(print_state->fp,
73+ "\nList of pre-defined events (to be used in -e or -M):\n\n");
74+ }
7175 }
7276
7377 static void default_print_end(void *print_state __maybe_unused) {}
7478
75−static void wordwrap(const char *s, int start, int max, int corr)
79+static void wordwrap(FILE *fp, const char *s, int start, int max, int corr)
7680 {
7781 int column = start;
7882 int n;
@@ -82,10 +86,10 @@ static void wordwrap(const char *s, int start, int max, int corr) · 3 unmodified lines
8286 int wlen = strcspn(s, " \t\n");
8387
8488 if ((column + wlen >= max && column > start) || saw_newline) {
85− printf("\n%*s", start, "");
89+ fprintf(fp, "\n%*s", start, "");
8690 column = start + corr;
8791 }
88− n = printf("%s%.*s", column > start ? " " : "", wlen, s);
92+ n = fprintf(fp, "%s%.*s", column > start ? " " : "", wlen, s);
8993 if (n <= 0)
9094 break;
9195 saw_newline = s[wlen] == '\n';
@@ -104,6 +108,7 @@ static void default_print_event(void *ps, const char *pmu_name, const char *topi · 12 unmodified lines
104108 {
105109 struct print_state *print_state = ps;
106110 int pos;
111+ FILE *fp = print_state->fp;
107112
108113 if (deprecated && !print_state->deprecated)
109114 return;
@@ -119,30 +124,30 @@ static void default_print_event(void *ps, const char *pmu_name, const char *topi · 9 unmodified lines
119124
120125 if (print_state->name_only) {
121126 if (event_alias && strlen(event_alias))
122− printf("%s ", event_alias);
127+ fprintf(fp, "%s ", event_alias);
123128 else
124− printf("%s ", event_name);
129+ fprintf(fp, "%s ", event_name);
125130 return;
126131 }
127132
128133 if (strcmp(print_state->last_topic, topic ?: "")) {
129134 if (topic)
130− printf("\n%s:\n", topic);
135+ fprintf(fp, "\n%s:\n", topic);
131136 zfree(&print_state->last_topic);
132137 print_state->last_topic = strdup(topic ?: "");
133138 }
134139
135140 if (event_alias && strlen(event_alias))
136− pos = printf(" %s OR %s", event_name, event_alias);
141+ pos = fprintf(fp, " %s OR %s", event_name, event_alias);
137142 else
138− pos = printf(" %s", event_name);
143+ pos = fprintf(fp, " %s", event_name);
139144
140145 if (!topic && event_type_desc) {
141146 for (; pos < 53; pos++)
142− putchar(' ');
143− printf("[%s]\n", event_type_desc);
147+ fputc(' ', fp);
148+ fprintf(fp, "[%s]\n", event_type_desc);
144149 } else
145− putchar('\n');
150+ fputc('\n', fp);
146151
147152 if (desc && print_state->desc) {
148153 char *desc_with_unit = NULL;
@@ -155,22 +160,22 @@ static void default_print_event(void *ps, const char *pmu_name, const char *topi · 6 unmodified lines
155160 ? "%s. Unit: %s" : "%s Unit: %s",
156161 desc, pmu_name);
157162 }
158− printf("%*s", 8, "[");
159− wordwrap(desc_len > 0 ? desc_with_unit : desc, 8, pager_get_columns(), 0);
160− printf("]\n");
163+ fprintf(fp, "%*s", 8, "[");
164+ wordwrap(fp, desc_len > 0 ? desc_with_unit : desc, 8, pager_get_columns(), 0);
165+ fprintf(fp, "]\n");
161166 free(desc_with_unit);
162167 }
163168 long_desc = long_desc ?: desc;
164169 if (long_desc && print_state->long_desc) {
165− printf("%*s", 8, "[");
166− wordwrap(long_desc, 8, pager_get_columns(), 0);
167− printf("]\n");
170+ fprintf(fp, "%*s", 8, "[");
171+ wordwrap(fp, long_desc, 8, pager_get_columns(), 0);
172+ fprintf(fp, "]\n");
168173 }
169174
170175 if (print_state->detailed && encoding_desc) {
171− printf("%*s", 8, "");
172− wordwrap(encoding_desc, 8, pager_get_columns(), 0);
173− putchar('\n');
176+ fprintf(fp, "%*s", 8, "");
177+ wordwrap(fp, encoding_desc, 8, pager_get_columns(), 0);
178+ fputc('\n', fp);
174179 }
175180 }
176181
@@ -184,6 +189,7 @@ static void default_print_metric(void *ps, · 7 unmodified lines
184189 const char *unit __maybe_unused)
185190 {
186191 struct print_state *print_state = ps;
192+ FILE *fp = print_state->fp;
187193
188194 if (print_state->event_glob &&
189195 (!print_state->metrics || !name || !strglobmatch(name, print_state->event_glob)) &&
@@ -192,27 +198,27 @@ static void default_print_metric(void *ps, · 2 unmodified lines
192198
193199 if (!print_state->name_only && !print_state->last_metricgroups) {
194200 if (print_state->metricgroups) {
195− printf("\nMetric Groups:\n");
201+ fprintf(fp, "\nMetric Groups:\n");
196202 if (!print_state->metrics)
197− putchar('\n');
203+ fputc('\n', fp);
198204 } else {
199− printf("\nMetrics:\n\n");
205+ fprintf(fp, "\nMetrics:\n\n");
200206 }
201207 }
202208 if (!print_state->last_metricgroups ||
203209 strcmp(print_state->last_metricgroups, group ?: "")) {
204210 if (group && print_state->metricgroups) {
205211 if (print_state->name_only)
206− printf("%s ", group);
212+ fprintf(fp, "%s ", group);
207213 else if (print_state->metrics) {
208214 const char *gdesc = describe_metricgroup(group);
209215
210216 if (gdesc)
211− printf("\n%s: [%s]\n", group, gdesc);
217+ fprintf(fp, "\n%s: [%s]\n", group, gdesc);
212218 else
213− printf("\n%s:\n", group);
219+ fprintf(fp, "\n%s:\n", group);
214220 } else
215− printf("%s\n", group);
221+ fprintf(fp, "%s\n", group);
216222 }
217223 zfree(&print_state->last_metricgroups);
218224 print_state->last_metricgroups = strdup(group ?: "");
@@ -223,53 +229,59 @@ static void default_print_metric(void *ps, · 4 unmodified lines
223229 if (print_state->name_only) {
224230 if (print_state->metrics &&
225231 !strlist__has_entry(print_state->visited_metrics, name)) {
226− printf("%s ", name);
232+ fprintf(fp, "%s ", name);
227233 strlist__add(print_state->visited_metrics, name);
228234 }
229235 return;
230236 }
231− printf(" %s\n", name);
237+ fprintf(fp, " %s\n", name);
232238
233239 if (desc && print_state->desc) {
234− printf("%*s", 8, "[");
235− wordwrap(desc, 8, pager_get_columns(), 0);
236− printf("]\n");
240+ fprintf(fp, "%*s", 8, "[");
241+ wordwrap(fp, desc, 8, pager_get_columns(), 0);
242+ fprintf(fp, "]\n");
237243 }
238244 if (long_desc && print_state->long_desc) {
239− printf("%*s", 8, "[");
240− wordwrap(long_desc, 8, pager_get_columns(), 0);
241− printf("]\n");
245+ fprintf(fp, "%*s", 8, "[");
246+ wordwrap(fp, long_desc, 8, pager_get_columns(), 0);
247+ fprintf(fp, "]\n");
242248 }
243249 if (expr && print_state->detailed) {
244− printf("%*s", 8, "[");
245− wordwrap(expr, 8, pager_get_columns(), 0);
246− printf("]\n");
250+ fprintf(fp, "%*s", 8, "[");
251+ wordwrap(fp, expr, 8, pager_get_columns(), 0);
252+ fprintf(fp, "]\n");
247253 }
248254 if (threshold && print_state->detailed) {
249− printf("%*s", 8, "[");
250− wordwrap(threshold, 8, pager_get_columns(), 0);
251− printf("]\n");
255+ fprintf(fp, "%*s", 8, "[");
256+ wordwrap(fp, threshold, 8, pager_get_columns(), 0);
257+ fprintf(fp, "]\n");
252258 }
253259 }
254260
255261 struct json_print_state {
262+ /** @fp: File to write output to. */
263+ FILE *fp;
256264 /** Should a separator be printed prior to the next item? */
257265 bool need_sep;
258266 };
259267
260−static void json_print_start(void *print_state __maybe_unused)
268+static void json_print_start(void *ps)
261269 {
262− printf("[\n");
270+ struct json_print_state *print_state = ps;
271+ FILE *fp = print_state->fp;
272+
273+ fprintf(fp, "[\n");
263274 }
264275
265276 static void json_print_end(void *ps)
266277 {
267278 struct json_print_state *print_state = ps;
279+ FILE *fp = print_state->fp;
268280
269− printf("%s]\n", print_state->need_sep ? "\n" : "");
281+ fprintf(fp, "%s]\n", print_state->need_sep ? "\n" : "");
270282 }
271283
272−static void fix_escape_printf(struct strbuf *buf, const char *fmt, ...)
284+static void fix_escape_fprintf(FILE *fp, struct strbuf *buf, const char *fmt, ...)
273285 {
274286 va_list args;
275287
@@ -318,7 +330,7 @@ static void fix_escape_printf(struct strbuf *buf, const char *fmt, ...) · 42 unmodified lines
318330 }
319331 }
320332 va_end(args);
321− fputs(buf->buf, stdout);
333+ fputs(buf->buf, fp);
322334 }
323335
324336 static void json_print_event(void *ps, const char *pmu_name, const char *topic,
@@ -330,60 +342,71 @@ static void json_print_event(void *ps, const char *pmu_name, const char *topic, · 5 unmodified lines
330342 {
331343 struct json_print_state *print_state = ps;
332344 bool need_sep = false;
345+ FILE *fp = print_state->fp;
333346 struct strbuf buf;
334347
335348 strbuf_init(&buf, 0);
336− printf("%s{\n", print_state->need_sep ? ",\n" : "");
349+ fprintf(fp, "%s{\n", print_state->need_sep ? ",\n" : "");
337350 print_state->need_sep = true;
338351 if (pmu_name) {
339− fix_escape_printf(&buf, "\t\"Unit\": \"%S\"", pmu_name);
352+ fix_escape_fprintf(fp, &buf, "\t\"Unit\": \"%S\"", pmu_name);
340353 need_sep = true;
341354 }
342355 if (topic) {
343− fix_escape_printf(&buf, "%s\t\"Topic\": \"%S\"", need_sep ? ",\n" : "", topic);
356+ fix_escape_fprintf(fp, &buf, "%s\t\"Topic\": \"%S\"",
357+ need_sep ? ",\n" : "",
358+ topic);
344359 need_sep = true;
345360 }
346361 if (event_name) {
347− fix_escape_printf(&buf, "%s\t\"EventName\": \"%S\"", need_sep ? ",\n" : "",
348− event_name);
362+ fix_escape_fprintf(fp, &buf, "%s\t\"EventName\": \"%S\"",
363+ need_sep ? ",\n" : "",
364+ event_name);
349365 need_sep = true;
350366 }
351367 if (event_alias && strlen(event_alias)) {
352− fix_escape_printf(&buf, "%s\t\"EventAlias\": \"%S\"", need_sep ? ",\n" : "",
353− event_alias);
368+ fix_escape_fprintf(fp, &buf, "%s\t\"EventAlias\": \"%S\"",
369+ need_sep ? ",\n" : "",
370+ event_alias);
354371 need_sep = true;
355372 }
356373 if (scale_unit && strlen(scale_unit)) {
357− fix_escape_printf(&buf, "%s\t\"ScaleUnit\": \"%S\"", need_sep ? ",\n" : "",
358− scale_unit);
374+ fix_escape_fprintf(fp, &buf, "%s\t\"ScaleUnit\": \"%S\"",
375+ need_sep ? ",\n" : "",
376+ scale_unit);
359377 need_sep = true;
360378 }
361379 if (event_type_desc) {
362− fix_escape_printf(&buf, "%s\t\"EventType\": \"%S\"", need_sep ? ",\n" : "",
363− event_type_desc);
380+ fix_escape_fprintf(fp, &buf, "%s\t\"EventType\": \"%S\"",
381+ need_sep ? ",\n" : "",
382+ event_type_desc);
364383 need_sep = true;
365384 }
366385 if (deprecated) {
367− fix_escape_printf(&buf, "%s\t\"Deprecated\": \"%S\"", need_sep ? ",\n" : "",
368− deprecated ? "1" : "0");
386+ fix_escape_fprintf(fp, &buf, "%s\t\"Deprecated\": \"%S\"",
387+ need_sep ? ",\n" : "",
388+ deprecated ? "1" : "0");
369389 need_sep = true;
370390 }
371391 if (desc) {
372− fix_escape_printf(&buf, "%s\t\"BriefDescription\": \"%S\"", need_sep ? ",\n" : "",
373− desc);
392+ fix_escape_fprintf(fp, &buf, "%s\t\"BriefDescription\": \"%S\"",
393+ need_sep ? ",\n" : "",
394+ desc);
374395 need_sep = true;
375396 }
376397 if (long_desc) {
377− fix_escape_printf(&buf, "%s\t\"PublicDescription\": \"%S\"", need_sep ? ",\n" : "",
378− long_desc);
398+ fix_escape_fprintf(fp, &buf, "%s\t\"PublicDescription\": \"%S\"",
399+ need_sep ? ",\n" : "",
400+ long_desc);
379401 need_sep = true;
380402 }
381403 if (encoding_desc) {
382− fix_escape_printf(&buf, "%s\t\"Encoding\": \"%S\"", need_sep ? ",\n" : "",
383− encoding_desc);
404+ fix_escape_fprintf(fp, &buf, "%s\t\"Encoding\": \"%S\"",
405+ need_sep ? ",\n" : "",
406+ encoding_desc);
384407 need_sep = true;
385408 }
386− printf("%s}", need_sep ? "\n" : "");
409+ fprintf(fp, "%s}", need_sep ? "\n" : "");
387410 strbuf_release(&buf);
388411 }
389412
@@ -394,43 +417,53 @@ static void json_print_metric(void *ps __maybe_unused, const char *group, · 4 unmodified lines
394417 {
395418 struct json_print_state *print_state = ps;
396419 bool need_sep = false;
420+ FILE *fp = print_state->fp;
397421 struct strbuf buf;
398422
399423 strbuf_init(&buf, 0);
400− printf("%s{\n", print_state->need_sep ? ",\n" : "");
424+ fprintf(fp, "%s{\n", print_state->need_sep ? ",\n" : "");
401425 print_state->need_sep = true;
402426 if (group) {
403− fix_escape_printf(&buf, "\t\"MetricGroup\": \"%S\"", group);
427+ fix_escape_fprintf(fp, &buf, "\t\"MetricGroup\": \"%S\"", group);
404428 need_sep = true;
405429 }
406430 if (name) {
407− fix_escape_printf(&buf, "%s\t\"MetricName\": \"%S\"", need_sep ? ",\n" : "", name);
431+ fix_escape_fprintf(fp, &buf, "%s\t\"MetricName\": \"%S\"",
432+ need_sep ? ",\n" : "",
433+ name);
408434 need_sep = true;
409435 }
410436 if (expr) {
411− fix_escape_printf(&buf, "%s\t\"MetricExpr\": \"%S\"", need_sep ? ",\n" : "", expr);
437+ fix_escape_fprintf(fp, &buf, "%s\t\"MetricExpr\": \"%S\"",
438+ need_sep ? ",\n" : "",
439+ expr);
412440 need_sep = true;
413441 }
414442 if (threshold) {
415− fix_escape_printf(&buf, "%s\t\"MetricThreshold\": \"%S\"", need_sep ? ",\n" : "",
416− threshold);
443+ fix_escape_fprintf(fp, &buf, "%s\t\"MetricThreshold\": \"%S\"",
444+ need_sep ? ",\n" : "",
445+ threshold);
417446 need_sep = true;
418447 }
419448 if (unit) {
420− fix_escape_printf(&buf, "%s\t\"ScaleUnit\": \"%S\"", need_sep ? ",\n" : "", unit);
449+ fix_escape_fprintf(fp, &buf, "%s\t\"ScaleUnit\": \"%S\"",
450+ need_sep ? ",\n" : "",
451+ unit);
421452 need_sep = true;
422453 }
423454 if (desc) {
424− fix_escape_printf(&buf, "%s\t\"BriefDescription\": \"%S\"", need_sep ? ",\n" : "",
425− desc);
455+ fix_escape_fprintf(fp, &buf, "%s\t\"BriefDescription\": \"%S\"",
456+ need_sep ? ",\n" : "",
457+ desc);
426458 need_sep = true;
427459 }
428460 if (long_desc) {
429− fix_escape_printf(&buf, "%s\t\"PublicDescription\": \"%S\"", need_sep ? ",\n" : "",
430− long_desc);
461+ fix_escape_fprintf(fp, &buf, "%s\t\"PublicDescription\": \"%S\"",
462+ need_sep ? ",\n" : "",
463+ long_desc);
431464 need_sep = true;
432465 }
433− printf("%s}", need_sep ? "\n" : "");
466+ fprintf(fp, "%s}", need_sep ? "\n" : "");
434467 strbuf_release(&buf);
435468 }
436469
@@ -449,8 +482,12 @@ static bool default_skip_duplicate_pmus(void *ps) · 12 unmodified lines
449482 int cmd_list(int argc, const char **argv)
450483 {
451484 int i, ret = 0;
452− struct print_state default_ps = {};
453− struct print_state json_ps = {};
485+ struct print_state default_ps = {
486+ .fp = stdout,
487+ };
488+ struct print_state json_ps = {
489+ .fp = stdout,
490+ };
454491 void *ps = &default_ps;
455492 struct print_callbacks print_cb = {
456493 .print_start = default_print_start,
@@ -461,6 +498,7 @@ int cmd_list(int argc, const char **argv) · 4 unmodified lines
461498 };
462499 const char *cputype = NULL;
463500 const char *unit_name = NULL;
501+ const char *output_path = NULL;
464502 bool json = false;
465503 struct option list_options[] = {
466504 OPT_BOOLEAN(0, "raw-dump", &default_ps.name_only, "Dump raw events"),
@@ -471,6 +509,7 @@ int cmd_list(int argc, const char **argv) · 4 unmodified lines
471509 "Print longer event descriptions."),
472510 OPT_BOOLEAN(0, "details", &default_ps.detailed,
473511 "Print information on the perf event names and expressions used internally by events."),
512+ OPT_STRING('o', "output", &output_path, "file", "output file name"),
474513 OPT_BOOLEAN(0, "deprecated", &default_ps.deprecated,
475514 "Print deprecated events."),
476515 OPT_STRING(0, "cputype", &cputype, "cpu type",
@@ -497,6 +536,11 @@ int cmd_list(int argc, const char **argv) · 20 unmodified lines
497536 argc = parse_options(argc, argv, list_options, list_usage,
498537 PARSE_OPT_STOP_AT_NON_OPTION);
499538
539+ if (output_path) {
540+ default_ps.fp = fopen(output_path, "w");
541+ json_ps.fp = default_ps.fp;
542+ }
543+
500544 setup_pager();
501545
502546 if (!default_ps.name_only)
@@ -618,5 +662,8 @@ out: · 115 unmodified lines
618662 free(default_ps.last_topic);
619663 free(default_ps.last_metricgroups);
620664 strlist__delete(default_ps.visited_metrics);
665+ if (output_path)
666+ fclose(default_ps.fp);
667+
621668 return ret;
622669 }
tools/perf/builtin-record.c+2−2
@@ -4080,8 +4080,8 @@ int cmd_record(int argc, const char **argv) · 4079 unmodified lines
40804080 }
40814081
40824082 if (rec->switch_output.num_files) {
4083− rec->switch_output.filenames = calloc(sizeof(char *),
4084− rec->switch_output.num_files);
4083+ rec->switch_output.filenames = calloc(rec->switch_output.num_files,
4084+ sizeof(char *));
40854085 if (!rec->switch_output.filenames) {
40864086 err = -EINVAL;
40874087 goto out_opts;
tools/perf/builtin-top.c+1−1
@@ -357,7 +357,7 @@ static void perf_top__print_sym_table(struct perf_top *top) · 356 unmodified lines
357357
358358 static void prompt_integer(int *target, const char *msg)
359359 {
360− char *buf = malloc(0), *p;
360+ char *buf = NULL, *p;
361361 size_t dummy = 0;
362362 int tmp;
363363
tools/perf/pmu-events/arch/x86/alderlake/adl-metrics.json+118−136
@@ -114,7 +114,7 @@ · 113 unmodified lines
114114 },
115115 {
116116 "BriefDescription": "Counts the number of issue slots that were not consumed by the backend due to certain allocation restrictions.",
117− "MetricExpr": "TOPDOWN_BE_BOUND.ALLOC_RESTRICTIONS / tma_info_core_slots",
117+ "MetricExpr": "cpu_atom@TOPDOWN_BE_BOUND.ALLOC_RESTRICTIONS@ / tma_info_core_slots",
118118 "MetricGroup": "TopdownL3;tma_L3_group;tma_resource_bound_group",
119119 "MetricName": "tma_alloc_restriction",
120120 "MetricThreshold": "tma_alloc_restriction > 0.1",
@@ -124,7 +124,7 @@ · 3 unmodified lines
124124 {
125125 "BriefDescription": "Counts the total number of issue slots that were not consumed by the backend due to backend stalls",
126126 "DefaultMetricgroupName": "TopdownL1",
127− "MetricExpr": "TOPDOWN_BE_BOUND.ALL / tma_info_core_slots",
127+ "MetricExpr": "cpu_atom@TOPDOWN_BE_BOUND.ALL@ / tma_info_core_slots",
128128 "MetricGroup": "Default;TopdownL1;tma_L1_group",
129129 "MetricName": "tma_backend_bound",
130130 "MetricThreshold": "tma_backend_bound > 0.1",
@@ -169,7 +169,7 @@ · 38 unmodified lines
169169 },
170170 {
171171 "BriefDescription": "Counts the number of issue slots that were not delivered by the frontend due to BACLEARS, which occurs when the Branch Target Buffer (BTB) prediction or lack thereof, was corrected by a later branch predictor in the frontend",
172− "MetricExpr": "TOPDOWN_FE_BOUND.BRANCH_DETECT / tma_info_core_slots",
172+ "MetricExpr": "cpu_atom@TOPDOWN_FE_BOUND.BRANCH_DETECT@ / tma_info_core_slots",
173173 "MetricGroup": "TopdownL3;tma_L3_group;tma_fetch_latency_group",
174174 "MetricName": "tma_branch_detect",
175175 "MetricThreshold": "tma_branch_detect > 0.05",
@@ -179,7 +179,7 @@ · 3 unmodified lines
179179 },
180180 {
181181 "BriefDescription": "Counts the number of issue slots that were not consumed by the backend due to branch mispredicts.",
182− "MetricExpr": "TOPDOWN_BAD_SPECULATION.MISPREDICT / tma_info_core_slots",
182+ "MetricExpr": "cpu_atom@TOPDOWN_BAD_SPECULATION.MISPREDICT@ / tma_info_core_slots",
183183 "MetricGroup": "TopdownL2;tma_L2_group;tma_bad_speculation_group",
184184 "MetricName": "tma_branch_mispredicts",
185185 "MetricThreshold": "tma_branch_mispredicts > 0.05",
@@ -189,7 +189,7 @@ · 3 unmodified lines
189189 },
190190 {
191191 "BriefDescription": "Counts the number of issue slots that were not delivered by the frontend due to BTCLEARS, which occurs when the Branch Target Buffer (BTB) predicts a taken branch.",
192− "MetricExpr": "TOPDOWN_FE_BOUND.BRANCH_RESTEER / tma_info_core_slots",
192+ "MetricExpr": "cpu_atom@TOPDOWN_FE_BOUND.BRANCH_RESTEER@ / tma_info_core_slots",
193193 "MetricGroup": "TopdownL3;tma_L3_group;tma_fetch_latency_group",
194194 "MetricName": "tma_branch_resteer",
195195 "MetricThreshold": "tma_branch_resteer > 0.05",
@@ -198,7 +198,7 @@ · 2 unmodified lines
198198 },
199199 {
200200 "BriefDescription": "Counts the number of issue slots that were not delivered by the frontend due to the microcode sequencer (MS).",
201− "MetricExpr": "TOPDOWN_FE_BOUND.CISC / tma_info_core_slots",
201+ "MetricExpr": "cpu_atom@TOPDOWN_FE_BOUND.CISC@ / tma_info_core_slots",
202202 "MetricGroup": "TopdownL3;tma_L3_group;tma_fetch_bandwidth_group",
203203 "MetricName": "tma_cisc",
204204 "MetricThreshold": "tma_cisc > 0.05",
@@ -217,7 +217,7 @@ · 12 unmodified lines
217217 },
218218 {
219219 "BriefDescription": "Counts the number of issue slots that were not delivered by the frontend due to decode stalls.",
220− "MetricExpr": "TOPDOWN_FE_BOUND.DECODE / tma_info_core_slots",
220+ "MetricExpr": "cpu_atom@TOPDOWN_FE_BOUND.DECODE@ / tma_info_core_slots",
221221 "MetricGroup": "TopdownL3;tma_L3_group;tma_fetch_bandwidth_group",
222222 "MetricName": "tma_decode",
223223 "MetricThreshold": "tma_decode > 0.05",
@@ -235,7 +235,6 @@ · 11 unmodified lines
235235 },
236236 {
237237 "BriefDescription": "Counts the number of cycles the core is stalled due to a demand load miss which hit in DRAM or MMIO (Non-DRAM).",
238− "MetricConstraint": "NO_GROUP_EVENTS",
239238 "MetricExpr": "cpu_atom@MEM_BOUND_STALLS.LOAD_DRAM_HIT@ / tma_info_core_clks - max((cpu_atom@MEM_BOUND_STALLS.LOAD@ - cpu_atom@LD_HEAD.L1_MISS_AT_RET@) / tma_info_core_clks, 0) * cpu_atom@MEM_BOUND_STALLS.LOAD_DRAM_HIT@ / cpu_atom@MEM_BOUND_STALLS.LOAD@",
240239 "MetricGroup": "TopdownL3;tma_L3_group;tma_memory_bound_group",
241240 "MetricName": "tma_dram_bound",
@@ -245,7 +244,7 @@ · 3 unmodified lines
245244 },
246245 {
247246 "BriefDescription": "Counts the number of issue slots that were not consumed by the backend due to a machine clear classified as a fast nuke due to memory ordering, memory disambiguation and memory renaming.",
248− "MetricExpr": "TOPDOWN_BAD_SPECULATION.FASTNUKE / tma_info_core_slots",
247+ "MetricExpr": "cpu_atom@TOPDOWN_BAD_SPECULATION.FASTNUKE@ / tma_info_core_slots",
249248 "MetricGroup": "TopdownL3;tma_L3_group;tma_machine_clears_group",
250249 "MetricName": "tma_fast_nuke",
251250 "MetricThreshold": "tma_fast_nuke > 0.05",
@@ -254,7 +253,7 @@ · 2 unmodified lines
254253 },
255254 {
256255 "BriefDescription": "Counts the number of issue slots that were not delivered by the frontend due to frontend bandwidth restrictions due to decode, predecode, cisc, and other limitations.",
257− "MetricExpr": "TOPDOWN_FE_BOUND.FRONTEND_BANDWIDTH / tma_info_core_slots",
256+ "MetricExpr": "cpu_atom@TOPDOWN_FE_BOUND.FRONTEND_BANDWIDTH@ / tma_info_core_slots",
258257 "MetricGroup": "TopdownL2;tma_L2_group;tma_frontend_bound_group",
259258 "MetricName": "tma_fetch_bandwidth",
260259 "MetricThreshold": "tma_fetch_bandwidth > 0.1",
@@ -264,7 +263,7 @@ · 3 unmodified lines
264263 },
265264 {
266265 "BriefDescription": "Counts the number of issue slots that were not delivered by the frontend due to frontend bandwidth restrictions due to decode, predecode, cisc, and other limitations.",
267− "MetricExpr": "TOPDOWN_FE_BOUND.FRONTEND_LATENCY / tma_info_core_slots",
266+ "MetricExpr": "cpu_atom@TOPDOWN_FE_BOUND.FRONTEND_LATENCY@ / tma_info_core_slots",
268267 "MetricGroup": "TopdownL2;tma_L2_group;tma_frontend_bound_group",
269268 "MetricName": "tma_fetch_latency",
270269 "MetricThreshold": "tma_fetch_latency > 0.15",
@@ -283,7 +282,7 @@ · 12 unmodified lines
283282 },
284283 {
285284 "BriefDescription": "Counts the number of floating point divide operations per uop.",
286− "MetricExpr": "UOPS_RETIRED.FPDIV / tma_info_core_slots",
285+ "MetricExpr": "cpu_atom@UOPS_RETIRED.FPDIV@ / tma_info_core_slots",
287286 "MetricGroup": "TopdownL3;tma_L3_group;tma_base_group",
288287 "MetricName": "tma_fpdiv_uops",
289288 "MetricThreshold": "tma_fpdiv_uops > 0.2",
@@ -293,7 +292,7 @@ · 3 unmodified lines
293292 {
294293 "BriefDescription": "Counts the number of issue slots that were not consumed by the backend due to frontend stalls.",
295294 "DefaultMetricgroupName": "TopdownL1",
296− "MetricExpr": "TOPDOWN_FE_BOUND.ALL / tma_info_core_slots",
295+ "MetricExpr": "cpu_atom@TOPDOWN_FE_BOUND.ALL@ / tma_info_core_slots",
297296 "MetricGroup": "Default;TopdownL1;tma_L1_group",
298297 "MetricName": "tma_frontend_bound",
299298 "MetricThreshold": "tma_frontend_bound > 0.2",
@@ -303,7 +302,7 @@ · 3 unmodified lines
303302 },
304303 {
305304 "BriefDescription": "Counts the number of issue slots that were not delivered by the frontend due to instruction cache misses.",
306− "MetricExpr": "TOPDOWN_FE_BOUND.ICACHE / tma_info_core_slots",
305+ "MetricExpr": "cpu_atom@TOPDOWN_FE_BOUND.ICACHE@ / tma_info_core_slots",
307306 "MetricGroup": "TopdownL3;tma_L3_group;tma_fetch_latency_group",
308307 "MetricName": "tma_icache_misses",
309308 "MetricThreshold": "tma_icache_misses > 0.05",
@@ -330,7 +329,7 @@ · 20 unmodified lines
330329 },
331330 {
332331 "BriefDescription": "Instructions Per Cycle",
333− "MetricExpr": "INST_RETIRED.ANY / tma_info_core_clks",
332+ "MetricExpr": "cpu_atom@INST_RETIRED.ANY@ / tma_info_core_clks",
334333 "MetricName": "tma_info_core_ipc",
335334 "Unit": "cpu_atom"
336335 },
@@ -342,7 +341,7 @@ · 5 unmodified lines
342341 },
343342 {
344343 "BriefDescription": "Uops Per Instruction",
345− "MetricExpr": "UOPS_RETIRED.ALL / INST_RETIRED.ANY",
344+ "MetricExpr": "cpu_atom@UOPS_RETIRED.ALL@ / INST_RETIRED.ANY",
346345 "MetricName": "tma_info_core_upi",
347346 "Unit": "cpu_atom"
348347 },
@@ -366,13 +365,13 @@ · 17 unmodified lines
366365 },
367366 {
368367 "BriefDescription": "Ratio of all branches which mispredict",
369− "MetricExpr": "BR_MISP_RETIRED.ALL_BRANCHES / BR_INST_RETIRED.ALL_BRANCHES",
368+ "MetricExpr": "cpu_atom@BR_MISP_RETIRED.ALL_BRANCHES@ / BR_INST_RETIRED.ALL_BRANCHES",
370369 "MetricName": "tma_info_inst_mix_branch_mispredict_ratio",
371370 "Unit": "cpu_atom"
372371 },
373372 {
374373 "BriefDescription": "Ratio between Mispredicted branches and unknown branches",
375− "MetricExpr": "BR_MISP_RETIRED.ALL_BRANCHES / BACLEARS.ANY",
374+ "MetricExpr": "cpu_atom@BR_MISP_RETIRED.ALL_BRANCHES@ / BACLEARS.ANY",
376375 "MetricName": "tma_info_inst_mix_branch_mispredict_to_unknown_branch_ratio",
377376 "Unit": "cpu_atom"
378377 },
@@ -390,61 +389,61 @@ · 11 unmodified lines
390389 },
391390 {
392391 "BriefDescription": "Instructions per Branch (lower number means higher occurrence rate)",
393− "MetricExpr": "INST_RETIRED.ANY / BR_INST_RETIRED.ALL_BRANCHES",
392+ "MetricExpr": "cpu_atom@INST_RETIRED.ANY@ / BR_INST_RETIRED.ALL_BRANCHES",
394393 "MetricName": "tma_info_inst_mix_ipbranch",
395394 "Unit": "cpu_atom"
396395 },
397396 {
398397 "BriefDescription": "Instruction per (near) call (lower number means higher occurrence rate)",
399− "MetricExpr": "INST_RETIRED.ANY / BR_INST_RETIRED.CALL",
398+ "MetricExpr": "cpu_atom@INST_RETIRED.ANY@ / BR_INST_RETIRED.CALL",
400399 "MetricName": "tma_info_inst_mix_ipcall",
401400 "Unit": "cpu_atom"
402401 },
403402 {
404403 "BriefDescription": "Instructions per Far Branch",
405− "MetricExpr": "INST_RETIRED.ANY / (cpu_atom@BR_INST_RETIRED.FAR_BRANCH@ / 2)",
404+ "MetricExpr": "cpu_atom@INST_RETIRED.ANY@ / (cpu_atom@BR_INST_RETIRED.FAR_BRANCH@ / 2)",
406405 "MetricName": "tma_info_inst_mix_ipfarbranch",
407406 "Unit": "cpu_atom"
408407 },
409408 {
410409 "BriefDescription": "Instructions per Load",
411− "MetricExpr": "INST_RETIRED.ANY / MEM_UOPS_RETIRED.ALL_LOADS",
410+ "MetricExpr": "cpu_atom@INST_RETIRED.ANY@ / MEM_UOPS_RETIRED.ALL_LOADS",
412411 "MetricName": "tma_info_inst_mix_ipload",
413412 "Unit": "cpu_atom"
414413 },
415414 {
416415 "BriefDescription": "Instructions per retired conditional Branch Misprediction where the branch was not taken",
417− "MetricExpr": "INST_RETIRED.ANY / (cpu_atom@BR_MISP_RETIRED.COND@ - cpu_atom@BR_MISP_RETIRED.COND_TAKEN@)",
416+ "MetricExpr": "cpu_atom@INST_RETIRED.ANY@ / (cpu_atom@BR_MISP_RETIRED.COND@ - cpu_atom@BR_MISP_RETIRED.COND_TAKEN@)",
418417 "MetricName": "tma_info_inst_mix_ipmisp_cond_ntaken",
419418 "Unit": "cpu_atom"
420419 },
421420 {
422421 "BriefDescription": "Instructions per retired conditional Branch Misprediction where the branch was taken",
423− "MetricExpr": "INST_RETIRED.ANY / BR_MISP_RETIRED.COND_TAKEN",
422+ "MetricExpr": "cpu_atom@INST_RETIRED.ANY@ / BR_MISP_RETIRED.COND_TAKEN",
424423 "MetricName": "tma_info_inst_mix_ipmisp_cond_taken",
425424 "Unit": "cpu_atom"
426425 },
427426 {
428427 "BriefDescription": "Instructions per retired indirect call or jump Branch Misprediction",
429− "MetricExpr": "INST_RETIRED.ANY / BR_MISP_RETIRED.INDIRECT",
428+ "MetricExpr": "cpu_atom@INST_RETIRED.ANY@ / BR_MISP_RETIRED.INDIRECT",
430429 "MetricName": "tma_info_inst_mix_ipmisp_indirect",
431430 "Unit": "cpu_atom"
432431 },
433432 {
434433 "BriefDescription": "Instructions per retired return Branch Misprediction",
435− "MetricExpr": "INST_RETIRED.ANY / BR_MISP_RETIRED.RETURN",
434+ "MetricExpr": "cpu_atom@INST_RETIRED.ANY@ / BR_MISP_RETIRED.RETURN",
436435 "MetricName": "tma_info_inst_mix_ipmisp_ret",
437436 "Unit": "cpu_atom"
438437 },
439438 {
440439 "BriefDescription": "Instructions per retired Branch Misprediction",
441− "MetricExpr": "INST_RETIRED.ANY / BR_MISP_RETIRED.ALL_BRANCHES",
440+ "MetricExpr": "cpu_atom@INST_RETIRED.ANY@ / BR_MISP_RETIRED.ALL_BRANCHES",
442441 "MetricName": "tma_info_inst_mix_ipmispredict",
443442 "Unit": "cpu_atom"
444443 },
445444 {
446445 "BriefDescription": "Instructions per Store",
447− "MetricExpr": "INST_RETIRED.ANY / MEM_UOPS_RETIRED.ALL_STORES",
446+ "MetricExpr": "cpu_atom@INST_RETIRED.ANY@ / MEM_UOPS_RETIRED.ALL_STORES",
448447 "MetricName": "tma_info_inst_mix_ipstore",
449448 "Unit": "cpu_atom"
450449 },
@@ -480,19 +479,19 @@ · 29 unmodified lines
480479 },
481480 {
482481 "BriefDescription": "Cycle cost per DRAM hit",
483− "MetricExpr": "MEM_BOUND_STALLS.LOAD_DRAM_HIT / MEM_LOAD_UOPS_RETIRED.DRAM_HIT",
482+ "MetricExpr": "cpu_atom@MEM_BOUND_STALLS.LOAD_DRAM_HIT@ / MEM_LOAD_UOPS_RETIRED.DRAM_HIT",
484483 "MetricName": "tma_info_memory_cycles_per_demand_load_dram_hit",
485484 "Unit": "cpu_atom"
486485 },
487486 {
488487 "BriefDescription": "Cycle cost per L2 hit",
489− "MetricExpr": "MEM_BOUND_STALLS.LOAD_L2_HIT / MEM_LOAD_UOPS_RETIRED.L2_HIT",
488+ "MetricExpr": "cpu_atom@MEM_BOUND_STALLS.LOAD_L2_HIT@ / MEM_LOAD_UOPS_RETIRED.L2_HIT",
490489 "MetricName": "tma_info_memory_cycles_per_demand_load_l2_hit",
491490 "Unit": "cpu_atom"
492491 },
493492 {
494493 "BriefDescription": "Cycle cost per LLC hit",
495− "MetricExpr": "MEM_BOUND_STALLS.LOAD_LLC_HIT / MEM_LOAD_UOPS_RETIRED.L3_HIT",
494+ "MetricExpr": "cpu_atom@MEM_BOUND_STALLS.LOAD_LLC_HIT@ / MEM_LOAD_UOPS_RETIRED.L3_HIT",
496495 "MetricName": "tma_info_memory_cycles_per_demand_load_l3_hit",
497496 "Unit": "cpu_atom"
498497 },
@@ -504,7 +503,7 @@ · 5 unmodified lines
504503 },
505504 {
506505 "BriefDescription": "Average CPU Utilization",
507− "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC / TSC",
506+ "MetricExpr": "cpu_atom@CPU_CLK_UNHALTED.REF_TSC@ / TSC",
508507 "MetricName": "tma_info_system_cpu_utilization",
509508 "Unit": "cpu_atom"
510509 },
@@ -524,7 +523,7 @@ · 13 unmodified lines
524523 },
525524 {
526525 "BriefDescription": "Counts the number of issue slots that were not delivered by the frontend due to Instruction Table Lookaside Buffer (ITLB) misses.",
527− "MetricExpr": "TOPDOWN_FE_BOUND.ITLB / tma_info_core_slots",
526+ "MetricExpr": "cpu_atom@TOPDOWN_FE_BOUND.ITLB@ / tma_info_core_slots",
528527 "MetricGroup": "TopdownL3;tma_L3_group;tma_fetch_latency_group",
529528 "MetricName": "tma_itlb_misses",
530529 "MetricThreshold": "tma_itlb_misses > 0.05",
@@ -533,7 +532,7 @@ · 2 unmodified lines
533532 },
534533 {
535534 "BriefDescription": "Counts the number of cycles that the oldest load of the load buffer is stalled at retirement due to a load block.",
536− "MetricExpr": "LD_HEAD.L1_BOUND_AT_RET / tma_info_core_clks",
535+ "MetricExpr": "cpu_atom@LD_HEAD.L1_BOUND_AT_RET@ / tma_info_core_clks",
537536 "MetricGroup": "TopdownL3;tma_L3_group;tma_memory_bound_group",
538537 "MetricName": "tma_l1_bound",
539538 "MetricThreshold": "tma_l1_bound > 0.1",
@@ -542,7 +541,6 @@ · 2 unmodified lines
542541 },
543542 {
544543 "BriefDescription": "Counts the number of cycles a core is stalled due to a demand load which hit in the L2 Cache.",
545− "MetricConstraint": "NO_GROUP_EVENTS",
546544 "MetricExpr": "cpu_atom@MEM_BOUND_STALLS.LOAD_L2_HIT@ / tma_info_core_clks - max((cpu_atom@MEM_BOUND_STALLS.LOAD@ - cpu_atom@LD_HEAD.L1_MISS_AT_RET@) / tma_info_core_clks, 0) * cpu_atom@MEM_BOUND_STALLS.LOAD_L2_HIT@ / cpu_atom@MEM_BOUND_STALLS.LOAD@",
547545 "MetricGroup": "TopdownL3;tma_L3_group;tma_memory_bound_group",
548546 "MetricName": "tma_l2_bound",
@@ -552,7 +550,6 @@ · 3 unmodified lines
552550 },
553551 {
554552 "BriefDescription": "Counts the number of cycles a core is stalled due to a demand load which hit in the Last Level Cache (LLC) or other core with HITE/F/M.",
555− "MetricConstraint": "NO_GROUP_EVENTS_NMI",
556553 "MetricExpr": "cpu_atom@MEM_BOUND_STALLS.LOAD_LLC_HIT@ / tma_info_core_clks - max((cpu_atom@MEM_BOUND_STALLS.LOAD@ - cpu_atom@LD_HEAD.L1_MISS_AT_RET@) / tma_info_core_clks, 0) * cpu_atom@MEM_BOUND_STALLS.LOAD_LLC_HIT@ / cpu_atom@MEM_BOUND_STALLS.LOAD@",
557554 "MetricGroup": "TopdownL3;tma_L3_group;tma_memory_bound_group",
558555 "MetricName": "tma_l3_bound",
@@ -571,7 +568,7 @@ · 12 unmodified lines
571568 },
572569 {
573570 "BriefDescription": "Counts the total number of issue slots that were not consumed by the backend because allocation is stalled due to a machine clear (nuke) of any kind including memory ordering and memory disambiguation.",
574− "MetricExpr": "TOPDOWN_BAD_SPECULATION.MACHINE_CLEARS / tma_info_core_slots",
571+ "MetricExpr": "cpu_atom@TOPDOWN_BAD_SPECULATION.MACHINE_CLEARS@ / tma_info_core_slots",
575572 "MetricGroup": "TopdownL2;tma_L2_group;tma_bad_speculation_group",
576573 "MetricName": "tma_machine_clears",
577574 "MetricThreshold": "tma_machine_clears > 0.05",
@@ -581,7 +578,7 @@ · 3 unmodified lines
581578 },
582579 {
583580 "BriefDescription": "Counts the number of issue slots that were not consumed by the backend due to memory reservation stalls in which a scheduler is not able to accept uops.",
584− "MetricExpr": "TOPDOWN_BE_BOUND.MEM_SCHEDULER / tma_info_core_slots",
581+ "MetricExpr": "cpu_atom@TOPDOWN_BE_BOUND.MEM_SCHEDULER@ / tma_info_core_slots",
585582 "MetricGroup": "TopdownL3;tma_L3_group;tma_resource_bound_group",
586583 "MetricName": "tma_mem_scheduler",
587584 "MetricThreshold": "tma_mem_scheduler > 0.1",
@@ -590,7 +587,7 @@ · 2 unmodified lines
590587 },
591588 {
592589 "BriefDescription": "Counts the number of cycles the core is stalled due to stores or loads.",
593− "MetricExpr": "min(cpu_atom@TOPDOWN_BE_BOUND.ALL@ / tma_info_core_slots, cpu_atom@LD_HEAD.ANY_AT_RET@ / tma_info_core_clks + tma_store_bound)",
590+ "MetricExpr": "min(tma_backend_bound, cpu_atom@LD_HEAD.ANY_AT_RET@ / tma_info_core_clks + tma_store_bound)",
594591 "MetricGroup": "TopdownL2;tma_L2_group;tma_backend_bound_group",
595592 "MetricName": "tma_memory_bound",
596593 "MetricThreshold": "tma_memory_bound > 0.2",
@@ -609,7 +606,7 @@ · 12 unmodified lines
609606 },
610607 {
611608 "BriefDescription": "Counts the number of uops that are from the complex flows issued by the micro-sequencer (MS)",
612− "MetricExpr": "UOPS_RETIRED.MS / tma_info_core_slots",
609+ "MetricExpr": "cpu_atom@UOPS_RETIRED.MS@ / tma_info_core_slots",
613610 "MetricGroup": "TopdownL2;tma_L2_group;tma_retiring_group",
614611 "MetricName": "tma_ms_uops",
615612 "MetricThreshold": "tma_ms_uops > 0.05",
@@ -620,7 +617,7 @@ · 4 unmodified lines
620617 },
621618 {
622619 "BriefDescription": "Counts the number of issue slots that were not consumed by the backend due to IEC or FPC RAT stalls, which can be due to FIQ or IEC reservation stalls in which the integer, floating point or SIMD scheduler is not able to accept uops.",
623− "MetricExpr": "TOPDOWN_BE_BOUND.NON_MEM_SCHEDULER / tma_info_core_slots",
620+ "MetricExpr": "cpu_atom@TOPDOWN_BE_BOUND.NON_MEM_SCHEDULER@ / tma_info_core_slots",
624621 "MetricGroup": "TopdownL3;tma_L3_group;tma_resource_bound_group",
625622 "MetricName": "tma_non_mem_scheduler",
626623 "MetricThreshold": "tma_non_mem_scheduler > 0.1",
@@ -629,7 +626,7 @@ · 2 unmodified lines
629626 },
630627 {
631628 "BriefDescription": "Counts the number of issue slots that were not consumed by the backend due to a machine clear (slow nuke).",
632− "MetricExpr": "TOPDOWN_BAD_SPECULATION.NUKE / tma_info_core_slots",
629+ "MetricExpr": "cpu_atom@TOPDOWN_BAD_SPECULATION.NUKE@ / tma_info_core_slots",
633630 "MetricGroup": "TopdownL3;tma_L3_group;tma_machine_clears_group",
634631 "MetricName": "tma_nuke",
635632 "MetricThreshold": "tma_nuke > 0.05",
@@ -638,7 +635,7 @@ · 2 unmodified lines
638635 },
639636 {
640637 "BriefDescription": "Counts the number of issue slots that were not delivered by the frontend due to other common frontend stalls not categorized.",
641− "MetricExpr": "TOPDOWN_FE_BOUND.OTHER / tma_info_core_slots",
638+ "MetricExpr": "cpu_atom@TOPDOWN_FE_BOUND.OTHER@ / tma_info_core_slots",
642639 "MetricGroup": "TopdownL3;tma_L3_group;tma_fetch_bandwidth_group",
643640 "MetricName": "tma_other_fb",
644641 "MetricThreshold": "tma_other_fb > 0.05",
@@ -647,7 +644,7 @@ · 2 unmodified lines
647644 },
648645 {
649646 "BriefDescription": "Counts the number of cycles that the oldest load of the load buffer is stalled at retirement due to a number of other load blocks.",
650− "MetricExpr": "LD_HEAD.OTHER_AT_RET / tma_info_core_clks",
647+ "MetricExpr": "cpu_atom@LD_HEAD.OTHER_AT_RET@ / tma_info_core_clks",
651648 "MetricGroup": "TopdownL4;tma_L4_group;tma_l1_bound_group",
652649 "MetricName": "tma_other_l1",
653650 "MetricThreshold": "tma_other_l1 > 0.05",
@@ -683,7 +680,7 @@ · 29 unmodified lines
683680 },
684681 {
685682 "BriefDescription": "Counts the number of issue slots that were not delivered by the frontend due to wrong predecodes.",
686− "MetricExpr": "TOPDOWN_FE_BOUND.PREDECODE / tma_info_core_slots",
683+ "MetricExpr": "cpu_atom@TOPDOWN_FE_BOUND.PREDECODE@ / tma_info_core_slots",
687684 "MetricGroup": "TopdownL3;tma_L3_group;tma_fetch_bandwidth_group",
688685 "MetricName": "tma_predecode",
689686 "MetricThreshold": "tma_predecode > 0.05",
@@ -692,7 +689,7 @@ · 2 unmodified lines
692689 },
693690 {
694691 "BriefDescription": "Counts the number of issue slots that were not consumed by the backend due to the physical register file unable to accept an entry (marble stalls).",
695− "MetricExpr": "TOPDOWN_BE_BOUND.REGISTER / tma_info_core_slots",
692+ "MetricExpr": "cpu_atom@TOPDOWN_BE_BOUND.REGISTER@ / tma_info_core_slots",
696693 "MetricGroup": "TopdownL3;tma_L3_group;tma_resource_bound_group",
697694 "MetricName": "tma_register",
698695 "MetricThreshold": "tma_register > 0.1",
@@ -701,7 +698,7 @@ · 2 unmodified lines
701698 },
702699 {
703700 "BriefDescription": "Counts the number of issue slots that were not consumed by the backend due to the reorder buffer being full (ROB stalls).",
704− "MetricExpr": "TOPDOWN_BE_BOUND.REORDER_BUFFER / tma_info_core_slots",
701+ "MetricExpr": "cpu_atom@TOPDOWN_BE_BOUND.REORDER_BUFFER@ / tma_info_core_slots",
705702 "MetricGroup": "TopdownL3;tma_L3_group;tma_resource_bound_group",
706703 "MetricName": "tma_reorder_buffer",
707704 "MetricThreshold": "tma_reorder_buffer > 0.1",
@@ -722,7 +719,7 @@ · 14 unmodified lines
722719 {
723720 "BriefDescription": "Counts the number of issue slots that result in retirement slots.",
724721 "DefaultMetricgroupName": "TopdownL1",
725− "MetricExpr": "TOPDOWN_RETIRING.ALL / tma_info_core_slots",
722+ "MetricExpr": "cpu_atom@TOPDOWN_RETIRING.ALL@ / tma_info_core_slots",
726723 "MetricGroup": "Default;TopdownL1;tma_L1_group",
727724 "MetricName": "tma_retiring",
728725 "MetricThreshold": "tma_retiring > 0.75",
@@ -741,7 +738,7 @@ · 12 unmodified lines
741738 },
742739 {
743740 "BriefDescription": "Counts the number of issue slots that were not consumed by the backend due to scoreboards from the instruction queue (IQ), jump execution unit (JEU), or microcode sequencer (MS).",
744− "MetricExpr": "TOPDOWN_BE_BOUND.SERIALIZATION / tma_info_core_slots",
741+ "MetricExpr": "cpu_atom@TOPDOWN_BE_BOUND.SERIALIZATION@ / tma_info_core_slots",
745742 "MetricGroup": "TopdownL3;tma_L3_group;tma_resource_bound_group",
746743 "MetricName": "tma_serialization",
747744 "MetricThreshold": "tma_serialization > 0.1",
@@ -768,7 +765,7 @@ · 20 unmodified lines
768765 },
769766 {
770767 "BriefDescription": "Counts the number of cycles that the oldest load of the load buffer is stalled at retirement due to a first level TLB miss.",
771− "MetricExpr": "LD_HEAD.DTLB_MISS_AT_RET / tma_info_core_clks",
768+ "MetricExpr": "cpu_atom@LD_HEAD.DTLB_MISS_AT_RET@ / tma_info_core_clks",
772769 "MetricGroup": "TopdownL4;tma_L4_group;tma_l1_bound_group",
773770 "MetricName": "tma_stlb_hit",
774771 "MetricThreshold": "tma_stlb_hit > 0.05",
@@ -777,7 +774,7 @@ · 2 unmodified lines
777774 },
778775 {
779776 "BriefDescription": "Counts the number of cycles that the oldest load of the load buffer is stalled at retirement due to a second level TLB miss requiring a page walk.",
780− "MetricExpr": "LD_HEAD.PGWALK_AT_RET / tma_info_core_clks",
777+ "MetricExpr": "cpu_atom@LD_HEAD.PGWALK_AT_RET@ / tma_info_core_clks",
781778 "MetricGroup": "TopdownL4;tma_L4_group;tma_l1_bound_group",
782779 "MetricName": "tma_stlb_miss",
783780 "MetricThreshold": "tma_stlb_miss > 0.05",
@@ -795,8 +792,7 @@ · 11 unmodified lines
795792 },
796793 {
797794 "BriefDescription": "Counts the number of cycles that the oldest load of the load buffer is stalled at retirement due to a store forward block.",
798− "MetricConstraint": "NO_GROUP_EVENTS_NMI",
799− "MetricExpr": "LD_HEAD.ST_ADDR_AT_RET / tma_info_core_clks",
795+ "MetricExpr": "cpu_atom@LD_HEAD.ST_ADDR_AT_RET@ / tma_info_core_clks",
800796 "MetricGroup": "TopdownL4;tma_L4_group;tma_l1_bound_group",
801797 "MetricName": "tma_store_fwd_blk",
802798 "MetricThreshold": "tma_store_fwd_blk > 0.05",
@@ -875,7 +871,7 @@ · 72 unmodified lines
875871 },
876872 {
877873 "BriefDescription": "This metric represents fraction of cycles the CPU was stalled due to Branch Resteers",
878− "MetricExpr": "INT_MISC.CLEAR_RESTEER_CYCLES / tma_info_thread_clks + tma_unknown_branches",
874+ "MetricExpr": "cpu_core@INT_MISC.CLEAR_RESTEER_CYCLES@ / tma_info_thread_clks + tma_unknown_branches",
879875 "MetricGroup": "FetchLat;TopdownL3;tma_L3_group;tma_fetch_latency_group",
880876 "MetricName": "tma_branch_resteers",
881877 "MetricThreshold": "tma_branch_resteers > 0.05 & (tma_fetch_latency > 0.1 & tma_frontend_bound > 0.15)",
@@ -905,7 +901,6 @@ · 23 unmodified lines
905901 },
906902 {
907903 "BriefDescription": "This metric estimates fraction of cycles while the memory subsystem was handling synchronizations due to contested accesses",
908− "MetricConstraint": "NO_GROUP_EVENTS",
909904 "MetricExpr": "(25 * tma_info_system_average_frequency * (cpu_core@MEM_LOAD_L3_HIT_RETIRED.XSNP_FWD@ * (cpu_core@OCR.DEMAND_DATA_RD.L3_HIT.SNOOP_HITM@ / (cpu_core@OCR.DEMAND_DATA_RD.L3_HIT.SNOOP_HITM@ + cpu_core@OCR.DEMAND_DATA_RD.L3_HIT.SNOOP_HIT_WITH_FWD@))) + 24 * tma_info_system_average_frequency * cpu_core@MEM_LOAD_L3_HIT_RETIRED.XSNP_MISS@) * (1 + cpu_core@MEM_LOAD_RETIRED.FB_HIT@ / cpu_core@MEM_LOAD_RETIRED.L1_MISS@ / 2) / tma_info_thread_clks",
910905 "MetricGroup": "DataSharing;Offcore;Snoop;TopdownL4;tma_L4_group;tma_issueSyncxn;tma_l3_bound_group",
911906 "MetricName": "tma_contested_accesses",
@@ -927,7 +922,6 @@ · 15 unmodified lines
927922 },
928923 {
929924 "BriefDescription": "This metric estimates fraction of cycles while the memory subsystem was handling synchronizations due to data-sharing accesses",
930− "MetricConstraint": "NO_GROUP_EVENTS",
931925 "MetricExpr": "24 * tma_info_system_average_frequency * (cpu_core@MEM_LOAD_L3_HIT_RETIRED.XSNP_NO_FWD@ + cpu_core@MEM_LOAD_L3_HIT_RETIRED.XSNP_FWD@ * (1 - cpu_core@OCR.DEMAND_DATA_RD.L3_HIT.SNOOP_HITM@ / (cpu_core@OCR.DEMAND_DATA_RD.L3_HIT.SNOOP_HITM@ + cpu_core@OCR.DEMAND_DATA_RD.L3_HIT.SNOOP_HIT_WITH_FWD@))) * (1 + cpu_core@MEM_LOAD_RETIRED.FB_HIT@ / cpu_core@MEM_LOAD_RETIRED.L1_MISS@ / 2) / tma_info_thread_clks",
932926 "MetricGroup": "Offcore;Snoop;TopdownL4;tma_L4_group;tma_issueSyncxn;tma_l3_bound_group",
933927 "MetricName": "tma_data_sharing",
@@ -948,7 +942,7 @@ · 14 unmodified lines
948942 },
949943 {
950944 "BriefDescription": "This metric represents fraction of cycles where the Divider unit was active",
951− "MetricExpr": "ARITH.DIV_ACTIVE / tma_info_thread_clks",
945+ "MetricExpr": "cpu_core@ARITH.DIV_ACTIVE@ / tma_info_thread_clks",
952946 "MetricGroup": "TopdownL3;tma_L3_group;tma_core_bound_group",
953947 "MetricName": "tma_divider",
954948 "MetricThreshold": "tma_divider > 0.2 & (tma_core_bound > 0.1 & tma_backend_bound > 0.2)",
@@ -958,7 +952,6 @@ · 3 unmodified lines
958952 },
959953 {
960954 "BriefDescription": "This metric estimates how often the CPU was stalled on accesses to external memory (DRAM) by loads",
961− "MetricConstraint": "NO_GROUP_EVENTS",
962955 "MetricExpr": "cpu_core@MEMORY_ACTIVITY.STALLS_L3_MISS@ / tma_info_thread_clks",
963956 "MetricGroup": "MemoryBound;TmaL3mem;TopdownL3;tma_L3_group;tma_memory_bound_group",
964957 "MetricName": "tma_dram_bound",
@@ -979,7 +972,7 @@ · 14 unmodified lines
979972 },
980973 {
981974 "BriefDescription": "This metric represents fraction of cycles the CPU was stalled due to switches from DSB to MITE pipelines",
982− "MetricExpr": "DSB2MITE_SWITCHES.PENALTY_CYCLES / tma_info_thread_clks",
975+ "MetricExpr": "cpu_core@DSB2MITE_SWITCHES.PENALTY_CYCLES@ / tma_info_thread_clks",
983976 "MetricGroup": "DSBmiss;FetchLat;TopdownL3;tma_L3_group;tma_fetch_latency_group;tma_issueFB",
984977 "MetricName": "tma_dsb_switches",
985978 "MetricThreshold": "tma_dsb_switches > 0.05 & (tma_fetch_latency > 0.1 & tma_frontend_bound > 0.15)",
@@ -1019,7 +1012,7 @@ · 33 unmodified lines
10191012 },
10201013 {
10211014 "BriefDescription": "This metric does a *rough estimation* of how often L1D Fill Buffer unavailability limited additional L1D miss memory access requests to proceed",
1022− "MetricExpr": "L1D_PEND_MISS.FB_FULL / tma_info_thread_clks",
1015+ "MetricExpr": "cpu_core@L1D_PEND_MISS.FB_FULL@ / tma_info_thread_clks",
10231016 "MetricGroup": "MemoryBW;TopdownL4;tma_L4_group;tma_issueBW;tma_issueSL;tma_issueSmSt;tma_l1_bound_group",
10241017 "MetricName": "tma_fb_full",
10251018 "MetricThreshold": "tma_fb_full > 0.3",
@@ -1154,7 +1147,7 @@ · 128 unmodified lines
11541147 },
11551148 {
11561149 "BriefDescription": "This metric represents fraction of cycles the CPU was stalled due to instruction cache misses",
1157− "MetricExpr": "ICACHE_DATA.STALLS / tma_info_thread_clks",
1150+ "MetricExpr": "cpu_core@ICACHE_DATA.STALLS@ / tma_info_thread_clks",
11581151 "MetricGroup": "BigFoot;FetchLat;IcMiss;TopdownL3;tma_L3_group;tma_fetch_latency_group",
11591152 "MetricName": "tma_icache_misses",
11601153 "MetricThreshold": "tma_icache_misses > 0.05 & (tma_fetch_latency > 0.1 & tma_frontend_bound > 0.15)",
@@ -1164,7 +1157,6 @@ · 3 unmodified lines
11641157 },
11651158 {
11661159 "BriefDescription": "Branch Misprediction Cost: Fraction of TMA slots wasted per non-speculative branch misprediction (retired JEClear)",
1167− "MetricConstraint": "NO_GROUP_EVENTS",
11681160 "MetricExpr": "(tma_branch_mispredicts + tma_fetch_latency * tma_mispredicts_resteers / (tma_branch_resteers + tma_dsb_switches + tma_icache_misses + tma_itlb_misses + tma_lcp + tma_ms_switches)) * tma_info_thread_slots / BR_MISP_RETIRED.ALL_BRANCHES",
11691161 "MetricGroup": "Bad;BrMispredicts;tma_issueBM",
11701162 "MetricName": "tma_info_bad_spec_branch_misprediction_cost",
@@ -1173,7 +1165,7 @@ · 2 unmodified lines
11731165 },
11741166 {
11751167 "BriefDescription": "Instructions per retired mispredicts for conditional non-taken branches (lower number means higher occurrence rate).",
1176− "MetricExpr": "INST_RETIRED.ANY / BR_MISP_RETIRED.COND_NTAKEN",
1168+ "MetricExpr": "cpu_core@INST_RETIRED.ANY@ / BR_MISP_RETIRED.COND_NTAKEN",
11771169 "MetricGroup": "Bad;BrMispredicts",
11781170 "MetricName": "tma_info_bad_spec_ipmisp_cond_ntaken",
11791171 "MetricThreshold": "tma_info_bad_spec_ipmisp_cond_ntaken < 200",
@@ -1181,7 +1173,7 @@ · 1 unmodified line
11811173 },
11821174 {
11831175 "BriefDescription": "Instructions per retired mispredicts for conditional taken branches (lower number means higher occurrence rate).",
1184− "MetricExpr": "INST_RETIRED.ANY / BR_MISP_RETIRED.COND_TAKEN",
1176+ "MetricExpr": "cpu_core@INST_RETIRED.ANY@ / BR_MISP_RETIRED.COND_TAKEN",
11851177 "MetricGroup": "Bad;BrMispredicts",
11861178 "MetricName": "tma_info_bad_spec_ipmisp_cond_taken",
11871179 "MetricThreshold": "tma_info_bad_spec_ipmisp_cond_taken < 200",
@@ -1197,7 +1189,7 @@ · 9 unmodified lines
11971189 },
11981190 {
11991191 "BriefDescription": "Instructions per retired mispredicts for return branches (lower number means higher occurrence rate).",
1200− "MetricExpr": "INST_RETIRED.ANY / BR_MISP_RETIRED.RET",
1192+ "MetricExpr": "cpu_core@INST_RETIRED.ANY@ / BR_MISP_RETIRED.RET",
12011193 "MetricGroup": "Bad;BrMispredicts",
12021194 "MetricName": "tma_info_bad_spec_ipmisp_ret",
12031195 "MetricThreshold": "tma_info_bad_spec_ipmisp_ret < 500",
@@ -1205,7 +1197,7 @@ · 1 unmodified line
12051197 },
12061198 {
12071199 "BriefDescription": "Number of Instructions per non-speculative Branch Misprediction (JEClear) (lower number means higher occurrence rate)",
1208− "MetricExpr": "INST_RETIRED.ANY / BR_MISP_RETIRED.ALL_BRANCHES",
1200+ "MetricExpr": "cpu_core@INST_RETIRED.ANY@ / BR_MISP_RETIRED.ALL_BRANCHES",
12091201 "MetricGroup": "Bad;BadSpec;BrMispredicts",
12101202 "MetricName": "tma_info_bad_spec_ipmispredict",
12111203 "MetricThreshold": "tma_info_bad_spec_ipmispredict < 200",
@@ -1213,7 +1205,6 @@ · 1 unmodified line
12131205 },
12141206 {
12151207 "BriefDescription": "Probability of Core Bound bottleneck hidden by SMT-profiling artifacts",
1216− "MetricConstraint": "NO_GROUP_EVENTS",
12171208 "MetricExpr": "(100 * (1 - tma_core_bound / tma_ports_utilization if tma_core_bound < tma_ports_utilization else 1) if tma_info_system_smt_2t_utilization > 0.5 else 0)",
12181209 "MetricGroup": "Cor;SMT",
12191210 "MetricName": "tma_info_botlnk_l0_core_bound_likely",
@@ -1222,7 +1213,6 @@ · 2 unmodified lines
12221213 },
12231214 {
12241215 "BriefDescription": "Total pipeline cost of DSB (uop cache) misses - subset of the Instruction_Fetch_BW Bottleneck",
1225− "MetricConstraint": "NO_GROUP_EVENTS",
12261216 "MetricExpr": "100 * (tma_fetch_latency * tma_dsb_switches / (tma_branch_resteers + tma_dsb_switches + tma_icache_misses + tma_itlb_misses + tma_lcp + tma_ms_switches) + tma_fetch_bandwidth * tma_mite / (tma_dsb + tma_lsd + tma_mite))",
12271217 "MetricGroup": "DSBmiss;Fed;tma_issueFB",
12281218 "MetricName": "tma_info_botlnk_l2_dsb_misses",
@@ -1232,7 +1222,6 @@ · 3 unmodified lines
12321222 },
12331223 {
12341224 "BriefDescription": "Total pipeline cost of Instruction Cache misses - subset of the Big_Code Bottleneck",
1235− "MetricConstraint": "NO_GROUP_EVENTS",
12361225 "MetricExpr": "100 * (tma_fetch_latency * tma_icache_misses / (tma_branch_resteers + tma_dsb_switches + tma_icache_misses + tma_itlb_misses + tma_lcp + tma_ms_switches))",
12371226 "MetricGroup": "Fed;FetchLat;IcMiss;tma_issueFL",
12381227 "MetricName": "tma_info_botlnk_l2_ic_misses",
@@ -1242,7 +1231,6 @@ · 3 unmodified lines
12421231 },
12431232 {
12441233 "BriefDescription": "Total pipeline cost of instruction fetch related bottlenecks by large code footprint programs (i-side cache; TLB and BTB misses)",
1245− "MetricConstraint": "NO_GROUP_EVENTS",
12461234 "MetricExpr": "100 * tma_fetch_latency * (tma_itlb_misses + tma_icache_misses + tma_unknown_branches) / (tma_branch_resteers + tma_dsb_switches + tma_icache_misses + tma_itlb_misses + tma_lcp + tma_ms_switches)",
12471235 "MetricGroup": "BigFoot;Fed;Frontend;IcMiss;MemoryTLB;tma_issueBC",
12481236 "MetricName": "tma_info_bottleneck_big_code",
@@ -1261,7 +1249,6 @@ · 12 unmodified lines
12611249 },
12621250 {
12631251 "BriefDescription": "Total pipeline cost of instruction fetch bandwidth related bottlenecks",
1264− "MetricConstraint": "NO_GROUP_EVENTS",
12651252 "MetricExpr": "100 * (tma_frontend_bound - tma_fetch_latency * tma_mispredicts_resteers / (tma_branch_resteers + tma_dsb_switches + tma_icache_misses + tma_itlb_misses + tma_lcp + tma_ms_switches)) - tma_info_bottleneck_big_code",
12661253 "MetricGroup": "Fed;FetchBW;Frontend",
12671254 "MetricName": "tma_info_bottleneck_instruction_fetch_bw",
@@ -1270,7 +1257,6 @@ · 2 unmodified lines
12701257 },
12711258 {
12721259 "BriefDescription": "Total pipeline cost of (external) Memory Bandwidth related bottlenecks",
1273− "MetricConstraint": "NO_GROUP_EVENTS",
12741260 "MetricExpr": "100 * tma_memory_bound * (tma_dram_bound / (tma_dram_bound + tma_l1_bound + tma_l2_bound + tma_l3_bound + tma_store_bound) * (tma_mem_bandwidth / (tma_mem_bandwidth + tma_mem_latency)) + tma_l3_bound / (tma_dram_bound + tma_l1_bound + tma_l2_bound + tma_l3_bound + tma_store_bound) * (tma_sq_full / (tma_contested_accesses + tma_data_sharing + tma_l3_hit_latency + tma_sq_full))) + tma_l1_bound / (tma_dram_bound + tma_l1_bound + tma_l2_bound + tma_l3_bound + tma_store_bound) * (tma_fb_full / (tma_dtlb_load + tma_fb_full + tma_lock_latency + tma_split_loads + tma_store_fwd_blk))",
12751261 "MetricGroup": "Mem;MemoryBW;Offcore;tma_issueBW",
12761262 "MetricName": "tma_info_bottleneck_memory_bandwidth",
@@ -1280,7 +1266,6 @@ · 3 unmodified lines
12801266 },
12811267 {
12821268 "BriefDescription": "Total pipeline cost of Memory Address Translation related bottlenecks (data-side TLBs)",
1283− "MetricConstraint": "NO_GROUP_EVENTS",
12841269 "MetricExpr": "100 * tma_memory_bound * (tma_l1_bound / max(tma_memory_bound, tma_dram_bound + tma_l1_bound + tma_l2_bound + tma_l3_bound + tma_store_bound) * (tma_dtlb_load / max(tma_l1_bound, tma_dtlb_load + tma_fb_full + tma_lock_latency + tma_split_loads + tma_store_fwd_blk)) + tma_store_bound / (tma_dram_bound + tma_l1_bound + tma_l2_bound + tma_l3_bound + tma_store_bound) * (tma_dtlb_store / (tma_dtlb_store + tma_false_sharing + tma_split_stores + tma_store_latency + tma_streaming_stores)))",
12851270 "MetricGroup": "Mem;MemoryTLB;Offcore;tma_issueTLB",
12861271 "MetricName": "tma_info_bottleneck_memory_data_tlbs",
@@ -1290,7 +1275,6 @@ · 3 unmodified lines
12901275 },
12911276 {
12921277 "BriefDescription": "Total pipeline cost of Memory Latency related bottlenecks (external memory and off-core caches)",
1293− "MetricConstraint": "NO_GROUP_EVENTS",
12941278 "MetricExpr": "100 * tma_memory_bound * (tma_dram_bound / (tma_dram_bound + tma_l1_bound + tma_l2_bound + tma_l3_bound + tma_store_bound) * (tma_mem_latency / (tma_mem_bandwidth + tma_mem_latency)) + tma_l3_bound / (tma_dram_bound + tma_l1_bound + tma_l2_bound + tma_l3_bound + tma_store_bound) * (tma_l3_hit_latency / (tma_contested_accesses + tma_data_sharing + tma_l3_hit_latency + tma_sq_full)) + tma_l2_bound / (tma_dram_bound + tma_l1_bound + tma_l2_bound + tma_l3_bound + tma_store_bound))",
12951279 "MetricGroup": "Mem;MemoryLat;Offcore;tma_issueLat",
12961280 "MetricName": "tma_info_bottleneck_memory_latency",
@@ -1300,7 +1284,6 @@ · 3 unmodified lines
13001284 },
13011285 {
13021286 "BriefDescription": "Total pipeline cost of Branch Misprediction related bottlenecks",
1303− "MetricConstraint": "NO_GROUP_EVENTS",
13041287 "MetricExpr": "100 * (tma_branch_mispredicts + tma_fetch_latency * tma_mispredicts_resteers / (tma_branch_resteers + tma_dsb_switches + tma_icache_misses + tma_itlb_misses + tma_lcp + tma_ms_switches))",
13051288 "MetricGroup": "Bad;BadSpec;BrMispredicts;tma_issueBM",
13061289 "MetricName": "tma_info_bottleneck_mispredictions",
@@ -1317,14 +1300,14 @@ · 10 unmodified lines
13171300 },
13181301 {
13191302 "BriefDescription": "Fraction of branches that are non-taken conditionals",
1320− "MetricExpr": "BR_INST_RETIRED.COND_NTAKEN / BR_INST_RETIRED.ALL_BRANCHES",
1303+ "MetricExpr": "cpu_core@BR_INST_RETIRED.COND_NTAKEN@ / BR_INST_RETIRED.ALL_BRANCHES",
13211304 "MetricGroup": "Bad;Branches;CodeGen;PGO",
13221305 "MetricName": "tma_info_branches_cond_nt",
13231306 "Unit": "cpu_core"
13241307 },
13251308 {
13261309 "BriefDescription": "Fraction of branches that are taken conditionals",
1327− "MetricExpr": "BR_INST_RETIRED.COND_TAKEN / BR_INST_RETIRED.ALL_BRANCHES",
1310+ "MetricExpr": "cpu_core@BR_INST_RETIRED.COND_TAKEN@ / BR_INST_RETIRED.ALL_BRANCHES",
13281311 "MetricGroup": "Bad;Branches;CodeGen;PGO",
13291312 "MetricName": "tma_info_branches_cond_tk",
13301313 "Unit": "cpu_core"
@@ -1352,7 +1335,7 @@ · 21 unmodified lines
13521335 },
13531336 {
13541337 "BriefDescription": "Instructions Per Cycle across hyper-threads (per physical core)",
1355− "MetricExpr": "INST_RETIRED.ANY / tma_info_core_core_clks",
1338+ "MetricExpr": "cpu_core@INST_RETIRED.ANY@ / tma_info_core_core_clks",
13561339 "MetricGroup": "Ret;SMT;TmaL1;tma_L1_group",
13571340 "MetricName": "tma_info_core_coreipc",
13581341 "Unit": "cpu_core"
@@ -1374,14 +1357,14 @@ · 15 unmodified lines
13741357 },
13751358 {
13761359 "BriefDescription": "Instruction-Level-Parallelism (average number of uops executed when there is execution) per-core",
1377− "MetricExpr": "UOPS_EXECUTED.THREAD / (cpu_core@UOPS_EXECUTED.CORE_CYCLES_GE_1@ / 2 if #SMT_on else cpu_core@UOPS_EXECUTED.CORE_CYCLES_GE_1@)",
1360+ "MetricExpr": "cpu_core@UOPS_EXECUTED.THREAD@ / (cpu_core@UOPS_EXECUTED.CORE_CYCLES_GE_1@ / 2 if #SMT_on else cpu_core@UOPS_EXECUTED.CORE_CYCLES_GE_1@)",
13781361 "MetricGroup": "Backend;Cor;Pipeline;PortsUtil",
13791362 "MetricName": "tma_info_core_ilp",
13801363 "Unit": "cpu_core"
13811364 },
13821365 {
13831366 "BriefDescription": "Fraction of Uops delivered by the DSB (aka Decoded ICache; or Uop Cache)",
1384− "MetricExpr": "IDQ.DSB_UOPS / cpu_core@UOPS_ISSUED.ANY@",
1367+ "MetricExpr": "cpu_core@IDQ.DSB_UOPS@ / cpu_core@UOPS_ISSUED.ANY@",
13851368 "MetricGroup": "DSB;Fed;FetchBW;tma_issueFB",
13861369 "MetricName": "tma_info_frontend_dsb_coverage",
13871370 "MetricThreshold": "tma_info_frontend_dsb_coverage < 0.7 & tma_info_thread_ipc / 6 > 0.35",
@@ -1390,28 +1373,28 @@ · 2 unmodified lines
13901373 },
13911374 {
13921375 "BriefDescription": "Average number of cycles of a switch from the DSB fetch-unit to MITE fetch unit - see DSB_Switches tree node for details.",
1393− "MetricExpr": "DSB2MITE_SWITCHES.PENALTY_CYCLES / cpu_core@DSB2MITE_SWITCHES.PENALTY_CYCLES\\,cmask\\=1\\,edge@",
1376+ "MetricExpr": "cpu_core@DSB2MITE_SWITCHES.PENALTY_CYCLES@ / cpu_core@DSB2MITE_SWITCHES.PENALTY_CYCLES\\,cmask\\=1\\,edge@",
13941377 "MetricGroup": "DSBmiss",
13951378 "MetricName": "tma_info_frontend_dsb_switch_cost",
13961379 "Unit": "cpu_core"
13971380 },
13981381 {
13991382 "BriefDescription": "Average number of Uops issued by front-end when it issued something",
1400− "MetricExpr": "UOPS_ISSUED.ANY / cpu_core@UOPS_ISSUED.ANY\\,cmask\\=1@",
1383+ "MetricExpr": "cpu_core@UOPS_ISSUED.ANY@ / cpu_core@UOPS_ISSUED.ANY\\,cmask\\=1@",
14011384 "MetricGroup": "Fed;FetchBW",
14021385 "MetricName": "tma_info_frontend_fetch_upc",
14031386 "Unit": "cpu_core"
14041387 },
14051388 {
14061389 "BriefDescription": "Average Latency for L1 instruction cache misses",
1407− "MetricExpr": "ICACHE_DATA.STALLS / cpu_core@ICACHE_DATA.STALLS\\,cmask\\=1\\,edge@",
1390+ "MetricExpr": "cpu_core@ICACHE_DATA.STALLS@ / cpu_core@ICACHE_DATA.STALLS\\,cmask\\=1\\,edge@",
14081391 "MetricGroup": "Fed;FetchLat;IcMiss",
14091392 "MetricName": "tma_info_frontend_icache_miss_latency",
14101393 "Unit": "cpu_core"
14111394 },
14121395 {
14131396 "BriefDescription": "Instructions per non-speculative DSB miss (lower number means higher occurrence rate)",
1414− "MetricExpr": "INST_RETIRED.ANY / FRONTEND_RETIRED.ANY_DSB_MISS",
1397+ "MetricExpr": "cpu_core@INST_RETIRED.ANY@ / FRONTEND_RETIRED.ANY_DSB_MISS",
14151398 "MetricGroup": "DSBmiss;Fed",
14161399 "MetricName": "tma_info_frontend_ipdsb_miss_ret",
14171400 "MetricThreshold": "tma_info_frontend_ipdsb_miss_ret < 50",
@@ -1440,14 +1423,14 @@ · 22 unmodified lines
14401423 },
14411424 {
14421425 "BriefDescription": "Fraction of Uops delivered by the LSD (Loop Stream Detector; aka Loop Cache)",
1443− "MetricExpr": "LSD.UOPS / cpu_core@UOPS_ISSUED.ANY@",
1426+ "MetricExpr": "cpu_core@LSD.UOPS@ / cpu_core@UOPS_ISSUED.ANY@",
14441427 "MetricGroup": "Fed;LSD",
14451428 "MetricName": "tma_info_frontend_lsd_coverage",
14461429 "Unit": "cpu_core"
14471430 },
14481431 {
14491432 "BriefDescription": "Branch instructions per taken branch.",
1450− "MetricExpr": "BR_INST_RETIRED.ALL_BRANCHES / BR_INST_RETIRED.NEAR_TAKEN",
1433+ "MetricExpr": "cpu_core@BR_INST_RETIRED.ALL_BRANCHES@ / BR_INST_RETIRED.NEAR_TAKEN",
14511434 "MetricGroup": "Branches;Fed;PGO",
14521435 "MetricName": "tma_info_inst_mix_bptkbranch",
14531436 "Unit": "cpu_core"
@@ -1462,7 +1445,7 @@ · 8 unmodified lines
14621445 },
14631446 {
14641447 "BriefDescription": "Instructions per FP Arithmetic instruction (lower number means higher occurrence rate)",
1465− "MetricExpr": "INST_RETIRED.ANY / (cpu_core@FP_ARITH_INST_RETIRED.SCALAR_SINGLE\\,umask\\=0x03@ + cpu_core@FP_ARITH_INST_RETIRED.128B_PACKED_DOUBLE\\,umask\\=0x3c@)",
1448+ "MetricExpr": "cpu_core@INST_RETIRED.ANY@ / (cpu_core@FP_ARITH_INST_RETIRED.SCALAR_SINGLE\\,umask\\=0x03@ + cpu_core@FP_ARITH_INST_RETIRED.128B_PACKED_DOUBLE\\,umask\\=0x3c@)",
14661449 "MetricGroup": "Flops;InsType",
14671450 "MetricName": "tma_info_inst_mix_iparith",
14681451 "MetricThreshold": "tma_info_inst_mix_iparith < 10",
@@ -1471,7 +1454,7 @@ · 2 unmodified lines
14711454 },
14721455 {
14731456 "BriefDescription": "Instructions per FP Arithmetic AVX/SSE 128-bit instruction (lower number means higher occurrence rate)",
1474− "MetricExpr": "INST_RETIRED.ANY / (cpu_core@FP_ARITH_INST_RETIRED.128B_PACKED_DOUBLE@ + cpu_core@FP_ARITH_INST_RETIRED.128B_PACKED_SINGLE@)",
1457+ "MetricExpr": "cpu_core@INST_RETIRED.ANY@ / (cpu_core@FP_ARITH_INST_RETIRED.128B_PACKED_DOUBLE@ + cpu_core@FP_ARITH_INST_RETIRED.128B_PACKED_SINGLE@)",
14751458 "MetricGroup": "Flops;FpVector;InsType",
14761459 "MetricName": "tma_info_inst_mix_iparith_avx128",
14771460 "MetricThreshold": "tma_info_inst_mix_iparith_avx128 < 10",
@@ -1480,7 +1463,7 @@ · 2 unmodified lines
14801463 },
14811464 {
14821465 "BriefDescription": "Instructions per FP Arithmetic AVX* 256-bit instruction (lower number means higher occurrence rate)",
1483− "MetricExpr": "INST_RETIRED.ANY / (cpu_core@FP_ARITH_INST_RETIRED.256B_PACKED_DOUBLE@ + cpu_core@FP_ARITH_INST_RETIRED.256B_PACKED_SINGLE@)",
1466+ "MetricExpr": "cpu_core@INST_RETIRED.ANY@ / (cpu_core@FP_ARITH_INST_RETIRED.256B_PACKED_DOUBLE@ + cpu_core@FP_ARITH_INST_RETIRED.256B_PACKED_SINGLE@)",
14841467 "MetricGroup": "Flops;FpVector;InsType",
14851468 "MetricName": "tma_info_inst_mix_iparith_avx256",
14861469 "MetricThreshold": "tma_info_inst_mix_iparith_avx256 < 10",
@@ -1489,7 +1472,7 @@ · 2 unmodified lines
14891472 },
14901473 {
14911474 "BriefDescription": "Instructions per FP Arithmetic Scalar Double-Precision instruction (lower number means higher occurrence rate)",
1492− "MetricExpr": "INST_RETIRED.ANY / FP_ARITH_INST_RETIRED.SCALAR_DOUBLE",
1475+ "MetricExpr": "cpu_core@INST_RETIRED.ANY@ / FP_ARITH_INST_RETIRED.SCALAR_DOUBLE",
14931476 "MetricGroup": "Flops;FpScalar;InsType",
14941477 "MetricName": "tma_info_inst_mix_iparith_scalar_dp",
14951478 "MetricThreshold": "tma_info_inst_mix_iparith_scalar_dp < 10",
@@ -1498,7 +1481,7 @@ · 2 unmodified lines
14981481 },
14991482 {
15001483 "BriefDescription": "Instructions per FP Arithmetic Scalar Single-Precision instruction (lower number means higher occurrence rate)",
1501− "MetricExpr": "INST_RETIRED.ANY / FP_ARITH_INST_RETIRED.SCALAR_SINGLE",
1484+ "MetricExpr": "cpu_core@INST_RETIRED.ANY@ / FP_ARITH_INST_RETIRED.SCALAR_SINGLE",
15021485 "MetricGroup": "Flops;FpScalar;InsType",
15031486 "MetricName": "tma_info_inst_mix_iparith_scalar_sp",
15041487 "MetricThreshold": "tma_info_inst_mix_iparith_scalar_sp < 10",
@@ -1507,7 +1490,7 @@ · 2 unmodified lines
15071490 },
15081491 {
15091492 "BriefDescription": "Instructions per Branch (lower number means higher occurrence rate)",
1510− "MetricExpr": "INST_RETIRED.ANY / BR_INST_RETIRED.ALL_BRANCHES",
1493+ "MetricExpr": "cpu_core@INST_RETIRED.ANY@ / BR_INST_RETIRED.ALL_BRANCHES",
15111494 "MetricGroup": "Branches;Fed;InsType",
15121495 "MetricName": "tma_info_inst_mix_ipbranch",
15131496 "MetricThreshold": "tma_info_inst_mix_ipbranch < 8",
@@ -1515,7 +1498,7 @@ · 1 unmodified line
15151498 },
15161499 {
15171500 "BriefDescription": "Instructions per (near) call (lower number means higher occurrence rate)",
1518− "MetricExpr": "INST_RETIRED.ANY / BR_INST_RETIRED.NEAR_CALL",
1501+ "MetricExpr": "cpu_core@INST_RETIRED.ANY@ / BR_INST_RETIRED.NEAR_CALL",
15191502 "MetricGroup": "Branches;Fed;PGO",
15201503 "MetricName": "tma_info_inst_mix_ipcall",
15211504 "MetricThreshold": "tma_info_inst_mix_ipcall < 200",
@@ -1523,7 +1506,7 @@ · 1 unmodified line
15231506 },
15241507 {
15251508 "BriefDescription": "Instructions per Floating Point (FP) Operation (lower number means higher occurrence rate)",
1526− "MetricExpr": "INST_RETIRED.ANY / (cpu_core@FP_ARITH_INST_RETIRED.SCALAR_SINGLE@ + cpu_core@FP_ARITH_INST_RETIRED.SCALAR_DOUBLE@ + 2 * cpu_core@FP_ARITH_INST_RETIRED.128B_PACKED_DOUBLE@ + 4 * (cpu_core@FP_ARITH_INST_RETIRED.128B_PACKED_SINGLE@ + cpu_core@FP_ARITH_INST_RETIRED.256B_PACKED_DOUBLE@) + 8 * cpu_core@FP_ARITH_INST_RETIRED.256B_PACKED_SINGLE@)",
1509+ "MetricExpr": "cpu_core@INST_RETIRED.ANY@ / (cpu_core@FP_ARITH_INST_RETIRED.SCALAR_SINGLE@ + cpu_core@FP_ARITH_INST_RETIRED.SCALAR_DOUBLE@ + 2 * cpu_core@FP_ARITH_INST_RETIRED.128B_PACKED_DOUBLE@ + 4 * (cpu_core@FP_ARITH_INST_RETIRED.128B_PACKED_SINGLE@ + cpu_core@FP_ARITH_INST_RETIRED.256B_PACKED_DOUBLE@) + 8 * cpu_core@FP_ARITH_INST_RETIRED.256B_PACKED_SINGLE@)",
15271510 "MetricGroup": "Flops;InsType",
15281511 "MetricName": "tma_info_inst_mix_ipflop",
15291512 "MetricThreshold": "tma_info_inst_mix_ipflop < 10",
@@ -1531,7 +1514,7 @@ · 1 unmodified line
15311514 },
15321515 {
15331516 "BriefDescription": "Instructions per Load (lower number means higher occurrence rate)",
1534− "MetricExpr": "INST_RETIRED.ANY / MEM_INST_RETIRED.ALL_LOADS",
1517+ "MetricExpr": "cpu_core@INST_RETIRED.ANY@ / MEM_INST_RETIRED.ALL_LOADS",
15351518 "MetricGroup": "InsType",
15361519 "MetricName": "tma_info_inst_mix_ipload",
15371520 "MetricThreshold": "tma_info_inst_mix_ipload < 3",
@@ -1539,7 +1522,7 @@ · 1 unmodified line
15391522 },
15401523 {
15411524 "BriefDescription": "Instructions per Store (lower number means higher occurrence rate)",
1542− "MetricExpr": "INST_RETIRED.ANY / MEM_INST_RETIRED.ALL_STORES",
1525+ "MetricExpr": "cpu_core@INST_RETIRED.ANY@ / MEM_INST_RETIRED.ALL_STORES",
15431526 "MetricGroup": "InsType",
15441527 "MetricName": "tma_info_inst_mix_ipstore",
15451528 "MetricThreshold": "tma_info_inst_mix_ipstore < 8",
@@ -1547,7 +1530,7 @@ · 1 unmodified line
15471530 },
15481531 {
15491532 "BriefDescription": "Instructions per Software prefetch instruction (of any type: NTA/T0/T1/T2/Prefetch) (lower number means higher occurrence rate)",
1550− "MetricExpr": "INST_RETIRED.ANY / cpu_core@SW_PREFETCH_ACCESS.T0\\,umask\\=0xF@",
1533+ "MetricExpr": "cpu_core@INST_RETIRED.ANY@ / cpu_core@SW_PREFETCH_ACCESS.T0\\,umask\\=0xF@",
15511534 "MetricGroup": "Prefetches",
15521535 "MetricName": "tma_info_inst_mix_ipswpf",
15531536 "MetricThreshold": "tma_info_inst_mix_ipswpf < 100",
@@ -1555,7 +1538,7 @@ · 1 unmodified line
15551538 },
15561539 {
15571540 "BriefDescription": "Instruction per taken branch",
1558− "MetricExpr": "INST_RETIRED.ANY / BR_INST_RETIRED.NEAR_TAKEN",
1541+ "MetricExpr": "cpu_core@INST_RETIRED.ANY@ / BR_INST_RETIRED.NEAR_TAKEN",
15591542 "MetricGroup": "Branches;Fed;FetchBW;Frontend;PGO;tma_issueFB",
15601543 "MetricName": "tma_info_inst_mix_iptb",
15611544 "MetricThreshold": "tma_info_inst_mix_iptb < 13",
@@ -1655,14 +1638,14 @@ · 93 unmodified lines
16551638 },
16561639 {
16571640 "BriefDescription": "Actual Average Latency for L1 data-cache miss demand load operations (in core cycles)",
1658− "MetricExpr": "L1D_PEND_MISS.PENDING / MEM_LOAD_COMPLETED.L1_MISS_ANY",
1641+ "MetricExpr": "cpu_core@L1D_PEND_MISS.PENDING@ / MEM_LOAD_COMPLETED.L1_MISS_ANY",
16591642 "MetricGroup": "Mem;MemoryBound;MemoryLat",
16601643 "MetricName": "tma_info_memory_load_miss_real_latency",
16611644 "Unit": "cpu_core"
16621645 },
16631646 {
16641647 "BriefDescription": "Memory-Level-Parallelism (average number of L1 miss demand load when there is at least one such miss",
1665− "MetricExpr": "L1D_PEND_MISS.PENDING / L1D_PEND_MISS.PENDING_CYCLES",
1648+ "MetricExpr": "cpu_core@L1D_PEND_MISS.PENDING@ / L1D_PEND_MISS.PENDING_CYCLES",
16661649 "MetricGroup": "Mem;MemoryBW;MemoryBound",
16671650 "MetricName": "tma_info_memory_mlp",
16681651 "PublicDescription": "Memory-Level-Parallelism (average number of L1 miss demand load when there is at least one such miss. Per-Logical Processor)",
@@ -1670,28 +1653,28 @@ · 1 unmodified line
16701653 },
16711654 {
16721655 "BriefDescription": "Average Parallel L2 cache miss data reads",
1673− "MetricExpr": "OFFCORE_REQUESTS_OUTSTANDING.ALL_DATA_RD / OFFCORE_REQUESTS_OUTSTANDING.CYCLES_WITH_DATA_RD",
1656+ "MetricExpr": "cpu_core@OFFCORE_REQUESTS_OUTSTANDING.ALL_DATA_RD@ / OFFCORE_REQUESTS_OUTSTANDING.CYCLES_WITH_DATA_RD",
16741657 "MetricGroup": "Memory_BW;Offcore",
16751658 "MetricName": "tma_info_memory_oro_data_l2_mlp",
16761659 "Unit": "cpu_core"
16771660 },
16781661 {
16791662 "BriefDescription": "Average Latency for L2 cache miss demand Loads",
1680− "MetricExpr": "OFFCORE_REQUESTS_OUTSTANDING.DEMAND_DATA_RD / OFFCORE_REQUESTS.DEMAND_DATA_RD",
1663+ "MetricExpr": "cpu_core@OFFCORE_REQUESTS_OUTSTANDING.DEMAND_DATA_RD@ / OFFCORE_REQUESTS.DEMAND_DATA_RD",
16811664 "MetricGroup": "Memory_Lat;Offcore",
16821665 "MetricName": "tma_info_memory_oro_load_l2_miss_latency",
16831666 "Unit": "cpu_core"
16841667 },
16851668 {
16861669 "BriefDescription": "Average Parallel L2 cache miss demand Loads",
1687− "MetricExpr": "OFFCORE_REQUESTS_OUTSTANDING.DEMAND_DATA_RD / cpu_core@OFFCORE_REQUESTS_OUTSTANDING.DEMAND_DATA_RD\\,cmask\\=1@",
1670+ "MetricExpr": "cpu_core@OFFCORE_REQUESTS_OUTSTANDING.DEMAND_DATA_RD@ / cpu_core@OFFCORE_REQUESTS_OUTSTANDING.DEMAND_DATA_RD\\,cmask\\=1@",
16881671 "MetricGroup": "Memory_BW;Offcore",
16891672 "MetricName": "tma_info_memory_oro_load_l2_mlp",
16901673 "Unit": "cpu_core"
16911674 },
16921675 {
16931676 "BriefDescription": "Average Latency for L3 cache miss demand Loads",
1694− "MetricExpr": "OFFCORE_REQUESTS_OUTSTANDING.L3_MISS_DEMAND_DATA_RD / OFFCORE_REQUESTS.L3_MISS_DEMAND_DATA_RD",
1677+ "MetricExpr": "cpu_core@OFFCORE_REQUESTS_OUTSTANDING.L3_MISS_DEMAND_DATA_RD@ / OFFCORE_REQUESTS.L3_MISS_DEMAND_DATA_RD",
16951678 "MetricGroup": "Memory_Lat;Offcore",
16961679 "MetricName": "tma_info_memory_oro_load_l3_miss_latency",
16971680 "Unit": "cpu_core"
@@ -1755,14 +1738,14 @@ · 57 unmodified lines
17551738 },
17561739 {
17571740 "BriefDescription": "Instruction-Level-Parallelism (average number of uops executed when there is execution) per-thread",
1758− "MetricExpr": "UOPS_EXECUTED.THREAD / cpu_core@UOPS_EXECUTED.THREAD\\,cmask\\=1@",
1741+ "MetricExpr": "cpu_core@UOPS_EXECUTED.THREAD@ / cpu_core@UOPS_EXECUTED.THREAD\\,cmask\\=1@",
17591742 "MetricGroup": "Cor;Pipeline;PortsUtil;SMT",
17601743 "MetricName": "tma_info_pipeline_execute",
17611744 "Unit": "cpu_core"
17621745 },
17631746 {
17641747 "BriefDescription": "Instructions per a microcode Assist invocation",
1765− "MetricExpr": "INST_RETIRED.ANY / cpu_core@ASSISTS.ANY\\,umask\\=0x1B@",
1748+ "MetricExpr": "cpu_core@INST_RETIRED.ANY@ / cpu_core@ASSISTS.ANY\\,umask\\=0x1B@",
17661749 "MetricGroup": "Pipeline;Ret;Retire",
17671750 "MetricName": "tma_info_pipeline_ipassist",
17681751 "MetricThreshold": "tma_info_pipeline_ipassist < 100e3",
@@ -1778,7 +1761,7 @@ · 9 unmodified lines
17781761 },
17791762 {
17801763 "BriefDescription": "Estimated fraction of retirement-cycles dealing with repeat instructions",
1781− "MetricExpr": "INST_RETIRED.REP_ITERATION / cpu_core@UOPS_RETIRED.SLOTS\\,cmask\\=1@",
1764+ "MetricExpr": "cpu_core@INST_RETIRED.REP_ITERATION@ / cpu_core@UOPS_RETIRED.SLOTS\\,cmask\\=1@",
17821765 "MetricGroup": "Pipeline;Ret",
17831766 "MetricName": "tma_info_pipeline_strings_cycles",
17841767 "MetricThreshold": "tma_info_pipeline_strings_cycles > 0.1",
@@ -1793,7 +1776,7 @@ · 8 unmodified lines
17931776 },
17941777 {
17951778 "BriefDescription": "Average CPU Utilization",
1796− "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC / TSC",
1779+ "MetricExpr": "cpu_core@CPU_CLK_UNHALTED.REF_TSC@ / TSC",
17971780 "MetricGroup": "HPC;Summary",
17981781 "MetricName": "tma_info_system_cpu_utilization",
17991782 "Unit": "cpu_core"
@@ -1816,7 +1799,7 @@ · 16 unmodified lines
18161799 },
18171800 {
18181801 "BriefDescription": "Instructions per Far Branch ( Far Branches apply upon transition from application to operating system, handling interrupts, exceptions) [lower number means higher occurrence rate]",
1819− "MetricExpr": "INST_RETIRED.ANY / cpu_core@BR_INST_RETIRED.FAR_BRANCH@u",
1802+ "MetricExpr": "cpu_core@INST_RETIRED.ANY@ / cpu_core@BR_INST_RETIRED.FAR_BRANCH@u",
18201803 "MetricGroup": "Branches;OS",
18211804 "MetricName": "tma_info_system_ipfarbranch",
18221805 "MetricThreshold": "tma_info_system_ipfarbranch < 1e6",
@@ -1847,6 +1830,7 @@ · 24 unmodified lines
18471830 },
18481831 {
18491832 "BriefDescription": "Average latency of data read request to external memory (in nanoseconds)",
1833+ "MetricConstraint": "NO_GROUP_EVENTS",
18501834 "MetricExpr": "(UNC_ARB_TRK_OCCUPANCY.RD + UNC_ARB_DAT_OCCUPANCY.RD) / UNC_ARB_TRK_REQUESTS.RD",
18511835 "MetricGroup": "Mem;MemoryLat;SoC",
18521836 "MetricName": "tma_info_system_mem_read_latency",
@@ -1855,6 +1839,7 @@ · 2 unmodified lines
18551839 },
18561840 {
18571841 "BriefDescription": "Average latency of all requests to external memory (in Uncore cycles)",
1842+ "MetricConstraint": "NO_GROUP_EVENTS",
18581843 "MetricExpr": "(UNC_ARB_TRK_OCCUPANCY.ALL + UNC_ARB_DAT_OCCUPANCY.RD) / UNC_ARB_TRK_REQUESTS.ALL",
18591844 "MetricGroup": "Mem;SoC",
18601845 "MetricName": "tma_info_system_mem_request_latency",
@@ -1897,7 +1882,7 @@ · 36 unmodified lines
18971882 },
18981883 {
18991884 "BriefDescription": "The ratio of Executed- by Issued-Uops",
1900− "MetricExpr": "UOPS_EXECUTED.THREAD / UOPS_ISSUED.ANY",
1885+ "MetricExpr": "cpu_core@UOPS_EXECUTED.THREAD@ / UOPS_ISSUED.ANY",
19011886 "MetricGroup": "Cor;Pipeline",
19021887 "MetricName": "tma_info_thread_execute_per_issue",
19031888 "PublicDescription": "The ratio of Executed- by Issued-Uops. Ratio > 1 suggests high rate of uop micro-fusions. Ratio < 1 suggest high rate of \"execute\" at rename stage.",
@@ -1905,7 +1890,7 @@ · 1 unmodified line
19051890 },
19061891 {
19071892 "BriefDescription": "Instructions Per Cycle (per Logical Processor)",
1908− "MetricExpr": "INST_RETIRED.ANY / tma_info_thread_clks",
1893+ "MetricExpr": "cpu_core@INST_RETIRED.ANY@ / tma_info_thread_clks",
19091894 "MetricGroup": "Ret;Summary",
19101895 "MetricName": "tma_info_thread_ipc",
19111896 "Unit": "cpu_core"
@@ -1972,7 +1957,7 @@ · 60 unmodified lines
19721957 },
19731958 {
19741959 "BriefDescription": "This metric represents fraction of cycles the CPU was stalled due to Instruction TLB (ITLB) misses",
1975− "MetricExpr": "ICACHE_TAG.STALLS / tma_info_thread_clks",
1960+ "MetricExpr": "cpu_core@ICACHE_TAG.STALLS@ / tma_info_thread_clks",
19761961 "MetricGroup": "BigFoot;FetchLat;MemoryTLB;TopdownL3;tma_L3_group;tma_fetch_latency_group",
19771962 "MetricName": "tma_itlb_misses",
19781963 "MetricThreshold": "tma_itlb_misses > 0.05 & (tma_fetch_latency > 0.1 & tma_frontend_bound > 0.15)",
@@ -1992,7 +1977,6 @@ · 13 unmodified lines
19921977 },
19931978 {
19941979 "BriefDescription": "This metric estimates how often the CPU was stalled due to L2 cache accesses by loads",
1995− "MetricConstraint": "NO_GROUP_EVENTS",
19961980 "MetricExpr": "(cpu_core@MEMORY_ACTIVITY.STALLS_L1D_MISS@ - cpu_core@MEMORY_ACTIVITY.STALLS_L2_MISS@) / tma_info_thread_clks",
19971981 "MetricGroup": "CacheMisses;MemoryBound;TmaL3mem;TopdownL3;tma_L3_group;tma_memory_bound_group",
19981982 "MetricName": "tma_l2_bound",
@@ -2003,7 +1987,6 @@ · 4 unmodified lines
20031987 },
20041988 {
20051989 "BriefDescription": "This metric estimates how often the CPU was stalled due to loads accesses to L3 cache or contended with a sibling Core",
2006− "MetricConstraint": "NO_GROUP_EVENTS_NMI",
20071990 "MetricExpr": "(cpu_core@MEMORY_ACTIVITY.STALLS_L2_MISS@ - cpu_core@MEMORY_ACTIVITY.STALLS_L3_MISS@) / tma_info_thread_clks",
20081991 "MetricGroup": "CacheMisses;MemoryBound;TmaL3mem;TopdownL3;tma_L3_group;tma_memory_bound_group",
20091992 "MetricName": "tma_l3_bound",
@@ -2024,7 +2007,7 @@ · 14 unmodified lines
20242007 },
20252008 {
20262009 "BriefDescription": "This metric represents fraction of cycles CPU was stalled due to Length Changing Prefixes (LCPs)",
2027− "MetricExpr": "DECODE.LCP / tma_info_thread_clks",
2010+ "MetricExpr": "cpu_core@DECODE.LCP@ / tma_info_thread_clks",
20282011 "MetricGroup": "FetchLat;TopdownL3;tma_L3_group;tma_fetch_latency_group;tma_issueFB",
20292012 "MetricName": "tma_lcp",
20302013 "MetricThreshold": "tma_lcp > 0.05 & (tma_fetch_latency > 0.1 & tma_frontend_bound > 0.15)",
@@ -2045,7 +2028,7 @@ · 14 unmodified lines
20452028 },
20462029 {
20472030 "BriefDescription": "This metric represents Core fraction of cycles CPU dispatched uops on execution port for Load operations",
2048− "MetricExpr": "UOPS_DISPATCHED.PORT_2_3_10 / (3 * tma_info_core_core_clks)",
2031+ "MetricExpr": "cpu_core@UOPS_DISPATCHED.PORT_2_3_10@ / (3 * tma_info_core_core_clks)",
20492032 "MetricGroup": "TopdownL5;tma_L5_group;tma_ports_utilized_3m_group",
20502033 "MetricName": "tma_load_op_utilization",
20512034 "MetricThreshold": "tma_load_op_utilization > 0.6",
@@ -2064,7 +2047,7 @@ · 12 unmodified lines
20642047 },
20652048 {
20662049 "BriefDescription": "This metric estimates the fraction of cycles where the Second-level TLB (STLB) was missed by load accesses, performing a hardware page walk",
2067− "MetricExpr": "DTLB_LOAD_MISSES.WALK_ACTIVE / tma_info_thread_clks",
2050+ "MetricExpr": "cpu_core@DTLB_LOAD_MISSES.WALK_ACTIVE@ / tma_info_thread_clks",
20682051 "MetricGroup": "MemoryTLB;TopdownL5;tma_L5_group;tma_dtlb_load_group",
20692052 "MetricName": "tma_load_stlb_miss",
20702053 "MetricThreshold": "tma_load_stlb_miss > 0.05 & (tma_dtlb_load > 0.1 & (tma_l1_bound > 0.1 & (tma_memory_bound > 0.2 & tma_backend_bound > 0.2)))",
@@ -2073,7 +2056,6 @@ · 2 unmodified lines
20732056 },
20742057 {
20752058 "BriefDescription": "This metric represents fraction of cycles the CPU spent handling cache misses due to lock operations",
2076− "MetricConstraint": "NO_GROUP_EVENTS",
20772059 "MetricExpr": "(16 * max(0, cpu_core@MEM_INST_RETIRED.LOCK_LOADS@ - cpu_core@L2_RQSTS.ALL_RFO@) + cpu_core@MEM_INST_RETIRED.LOCK_LOADS@ / cpu_core@MEM_INST_RETIRED.ALL_STORES@ * (10 * cpu_core@L2_RQSTS.RFO_HIT@ + min(cpu_core@CPU_CLK_UNHALTED.THREAD@, cpu_core@OFFCORE_REQUESTS_OUTSTANDING.CYCLES_WITH_DEMAND_RFO@))) / tma_info_thread_clks",
20782060 "MetricGroup": "Offcore;TopdownL4;tma_L4_group;tma_issueRFO;tma_l1_bound_group",
20792061 "MetricName": "tma_lock_latency",
@@ -2136,6 +2118,7 @@ · 56 unmodified lines
21362118 },
21372119 {
21382120 "BriefDescription": "This metric represents fraction of cycles the CPU was stalled due to LFENCE Instructions.",
2121+ "MetricConstraint": "NO_GROUP_EVENTS_NMI",
21392122 "MetricExpr": "13 * cpu_core@MISC2_RETIRED.LFENCE@ / tma_info_thread_clks",
21402123 "MetricGroup": "TopdownL6;tma_L6_group;tma_serializing_operation_group",
21412124 "MetricName": "tma_memory_fence",
@@ -2145,7 +2128,6 @@ · 3 unmodified lines
21452128 },
21462129 {
21472130 "BriefDescription": "This metric represents fraction of slots where the CPU was retiring memory operations -- uops for memory load or store accesses.",
2148− "MetricConstraint": "NO_GROUP_EVENTS",
21492131 "MetricExpr": "tma_light_operations * cpu_core@MEM_UOP_RETIRED.ANY@ / (tma_retiring * tma_info_thread_slots)",
21502132 "MetricGroup": "Pipeline;TopdownL3;tma_L3_group;tma_light_operations_group",
21512133 "MetricName": "tma_memory_operations",
@@ -2155,7 +2137,7 @@ · 3 unmodified lines
21552137 },
21562138 {
21572139 "BriefDescription": "This metric represents fraction of slots the CPU was retiring uops fetched by the Microcode Sequencer (MS) unit",
2158− "MetricExpr": "UOPS_RETIRED.MS / tma_info_thread_slots",
2140+ "MetricExpr": "cpu_core@UOPS_RETIRED.MS@ / tma_info_thread_slots",
21592141 "MetricGroup": "MicroSeq;TopdownL3;tma_L3_group;tma_heavy_operations_group;tma_issueMC;tma_issueMS",
21602142 "MetricName": "tma_microcode_sequencer",
21612143 "MetricThreshold": "tma_microcode_sequencer > 0.05 & tma_heavy_operations > 0.1",
@@ -2225,7 +2207,6 @@ · 63 unmodified lines
22252207 },
22262208 {
22272209 "BriefDescription": "This metric represents the remaining light uops fraction the CPU has executed - remaining means not covered by other sibling nodes",
2228− "MetricConstraint": "NO_GROUP_EVENTS",
22292210 "MetricExpr": "max(0, tma_light_operations - (tma_fp_arith + tma_int_operations + tma_memory_operations + tma_fused_instructions + tma_non_fused_branches + tma_nop_instructions))",
22302211 "MetricGroup": "Pipeline;TopdownL3;tma_L3_group;tma_light_operations_group",
22312212 "MetricName": "tma_other_light_ops",
@@ -2246,7 +2227,7 @@ · 14 unmodified lines
22462227 },
22472228 {
22482229 "BriefDescription": "This metric represents Core fraction of cycles CPU dispatched uops on execution port 0 ([SNB+] ALU; [HSW+] ALU and 2nd branch)",
2249− "MetricExpr": "UOPS_DISPATCHED.PORT_0 / tma_info_core_core_clks",
2230+ "MetricExpr": "cpu_core@UOPS_DISPATCHED.PORT_0@ / tma_info_core_core_clks",
22502231 "MetricGroup": "Compute;TopdownL6;tma_L6_group;tma_alu_op_utilization_group;tma_issue2P",
22512232 "MetricName": "tma_port_0",
22522233 "MetricThreshold": "tma_port_0 > 0.6",
@@ -2256,7 +2237,7 @@ · 3 unmodified lines
22562237 },
22572238 {
22582239 "BriefDescription": "This metric represents Core fraction of cycles CPU dispatched uops on execution port 1 (ALU)",
2259− "MetricExpr": "UOPS_DISPATCHED.PORT_1 / tma_info_core_core_clks",
2240+ "MetricExpr": "cpu_core@UOPS_DISPATCHED.PORT_1@ / tma_info_core_core_clks",
22602241 "MetricGroup": "TopdownL6;tma_L6_group;tma_alu_op_utilization_group;tma_issue2P",
22612242 "MetricName": "tma_port_1",
22622243 "MetricThreshold": "tma_port_1 > 0.6",
@@ -2266,7 +2247,7 @@ · 3 unmodified lines
22662247 },
22672248 {
22682249 "BriefDescription": "This metric represents Core fraction of cycles CPU dispatched uops on execution port 6 ([HSW+]Primary Branch and simple ALU)",
2269− "MetricExpr": "UOPS_DISPATCHED.PORT_6 / tma_info_core_core_clks",
2250+ "MetricExpr": "cpu_core@UOPS_DISPATCHED.PORT_6@ / tma_info_core_core_clks",
22702251 "MetricGroup": "TopdownL6;tma_L6_group;tma_alu_op_utilization_group;tma_issue2P",
22712252 "MetricName": "tma_port_6",
22722253 "MetricThreshold": "tma_port_6 > 0.6",
@@ -2296,7 +2277,7 @@ · 23 unmodified lines
22962277 },
22972278 {
22982279 "BriefDescription": "This metric represents fraction of cycles where the CPU executed total of 1 uop per cycle on all execution ports (Logical Processor cycles since ICL, Physical Core cycles otherwise)",
2299− "MetricExpr": "EXE_ACTIVITY.1_PORTS_UTIL / tma_info_thread_clks",
2280+ "MetricExpr": "cpu_core@EXE_ACTIVITY.1_PORTS_UTIL@ / tma_info_thread_clks",
23002281 "MetricGroup": "PortsUtil;TopdownL4;tma_L4_group;tma_issueL1;tma_ports_utilization_group",
23012282 "MetricName": "tma_ports_utilized_1",
23022283 "MetricThreshold": "tma_ports_utilized_1 > 0.2 & (tma_ports_utilization > 0.15 & (tma_core_bound > 0.1 & tma_backend_bound > 0.2))",
@@ -2306,7 +2287,8 @@ · 3 unmodified lines
23062287 },
23072288 {
23082289 "BriefDescription": "This metric represents fraction of cycles CPU executed total of 2 uops per cycle on all execution ports (Logical Processor cycles since ICL, Physical Core cycles otherwise)",
2309− "MetricExpr": "EXE_ACTIVITY.2_PORTS_UTIL / tma_info_thread_clks",
2290+ "MetricConstraint": "NO_GROUP_EVENTS_NMI",
2291+ "MetricExpr": "cpu_core@EXE_ACTIVITY.2_PORTS_UTIL@ / tma_info_thread_clks",
23102292 "MetricGroup": "PortsUtil;TopdownL4;tma_L4_group;tma_issue2P;tma_ports_utilization_group",
23112293 "MetricName": "tma_ports_utilized_2",
23122294 "MetricThreshold": "tma_ports_utilized_2 > 0.15 & (tma_ports_utilization > 0.15 & (tma_core_bound > 0.1 & tma_backend_bound > 0.2))",
@@ -2316,7 +2298,8 @@ · 3 unmodified lines
23162298 },
23172299 {
23182300 "BriefDescription": "This metric represents fraction of cycles CPU executed total of 3 or more uops per cycle on all execution ports (Logical Processor cycles since ICL, Physical Core cycles otherwise)",
2319− "MetricExpr": "UOPS_EXECUTED.CYCLES_GE_3 / tma_info_thread_clks",
2301+ "MetricConstraint": "NO_GROUP_EVENTS_NMI",
2302+ "MetricExpr": "cpu_core@UOPS_EXECUTED.CYCLES_GE_3@ / tma_info_thread_clks",
23202303 "MetricGroup": "PortsUtil;TopdownL4;tma_L4_group;tma_ports_utilization_group",
23212304 "MetricName": "tma_ports_utilized_3m",
23222305 "MetricThreshold": "tma_ports_utilized_3m > 0.7 & (tma_ports_utilization > 0.15 & (tma_core_bound > 0.1 & tma_backend_bound > 0.2))",
@@ -2338,7 +2321,7 @@ · 15 unmodified lines
23382321 },
23392322 {
23402323 "BriefDescription": "This metric represents fraction of cycles the CPU issue-pipeline was stalled due to serializing operations",
2341− "MetricExpr": "RESOURCE_STALLS.SCOREBOARD / tma_info_thread_clks",
2324+ "MetricExpr": "cpu_core@RESOURCE_STALLS.SCOREBOARD@ / tma_info_thread_clks",
23422325 "MetricGroup": "PortsUtil;TopdownL5;tma_L5_group;tma_issueSO;tma_ports_utilized_0_group",
23432326 "MetricName": "tma_serializing_operation",
23442327 "MetricThreshold": "tma_serializing_operation > 0.1 & (tma_ports_utilized_0 > 0.2 & (tma_ports_utilization > 0.15 & (tma_core_bound > 0.1 & tma_backend_bound > 0.2)))",
@@ -2348,7 +2331,7 @@ · 3 unmodified lines
23482331 },
23492332 {
23502333 "BriefDescription": "This metric represents Shuffle (cross \"vector lane\" data transfers) uops fraction the CPU has retired.",
2351− "MetricExpr": "INT_VEC_RETIRED.SHUFFLES / (tma_retiring * tma_info_thread_slots)",
2334+ "MetricExpr": "cpu_core@INT_VEC_RETIRED.SHUFFLES@ / (tma_retiring * tma_info_thread_slots)",
23522335 "MetricGroup": "HPC;Pipeline;TopdownL4;tma_L4_group;tma_int_operations_group",
23532336 "MetricName": "tma_shuffles",
23542337 "MetricThreshold": "tma_shuffles > 0.1 & (tma_int_operations > 0.1 & tma_light_operations > 0.6)",
@@ -2357,7 +2340,8 @@ · 2 unmodified lines
23572340 },
23582341 {
23592342 "BriefDescription": "This metric represents fraction of cycles the CPU was stalled due to PAUSE Instructions",
2360− "MetricExpr": "CPU_CLK_UNHALTED.PAUSE / tma_info_thread_clks",
2343+ "MetricConstraint": "NO_GROUP_EVENTS_NMI",
2344+ "MetricExpr": "cpu_core@CPU_CLK_UNHALTED.PAUSE@ / tma_info_thread_clks",
23612345 "MetricGroup": "TopdownL6;tma_L6_group;tma_serializing_operation_group",
23622346 "MetricName": "tma_slow_pause",
23632347 "MetricThreshold": "tma_slow_pause > 0.05 & (tma_serializing_operation > 0.1 & (tma_ports_utilized_0 > 0.2 & (tma_ports_utilization > 0.15 & (tma_core_bound > 0.1 & tma_backend_bound > 0.2))))",
@@ -2377,8 +2361,7 @@ · 13 unmodified lines
23772361 },
23782362 {
23792363 "BriefDescription": "This metric represents rate of split store accesses",
2380− "MetricConstraint": "NO_GROUP_EVENTS_NMI",
2381− "MetricExpr": "MEM_INST_RETIRED.SPLIT_STORES / tma_info_core_core_clks",
2364+ "MetricExpr": "cpu_core@MEM_INST_RETIRED.SPLIT_STORES@ / tma_info_core_core_clks",
23822365 "MetricGroup": "TopdownL4;tma_L4_group;tma_issueSpSt;tma_store_bound_group",
23832366 "MetricName": "tma_split_stores",
23842367 "MetricThreshold": "tma_split_stores > 0.2 & (tma_store_bound > 0.2 & (tma_memory_bound > 0.2 & tma_backend_bound > 0.2))",
@@ -2398,7 +2381,7 @@ · 13 unmodified lines
23982381 },
23992382 {
24002383 "BriefDescription": "This metric estimates how often CPU was stalled due to RFO store memory accesses; RFO store issue a read-for-ownership request before the write",
2401− "MetricExpr": "EXE_ACTIVITY.BOUND_ON_STORES / tma_info_thread_clks",
2384+ "MetricExpr": "cpu_core@EXE_ACTIVITY.BOUND_ON_STORES@ / tma_info_thread_clks",
24022385 "MetricGroup": "MemoryBound;TmaL3mem;TopdownL3;tma_L3_group;tma_memory_bound_group",
24032386 "MetricName": "tma_store_bound",
24042387 "MetricThreshold": "tma_store_bound > 0.2 & (tma_memory_bound > 0.2 & tma_backend_bound > 0.2)",
@@ -2408,7 +2391,6 @@ · 3 unmodified lines
24082391 },
24092392 {
24102393 "BriefDescription": "This metric roughly estimates fraction of cycles when the memory subsystem had loads blocked since they could not forward data from earlier (in program order) overlapping stores",
2411− "MetricConstraint": "NO_GROUP_EVENTS_NMI",
24122394 "MetricExpr": "13 * cpu_core@LD_BLOCKS.STORE_FORWARD@ / tma_info_thread_clks",
24132395 "MetricGroup": "TopdownL4;tma_L4_group;tma_l1_bound_group",
24142396 "MetricName": "tma_store_fwd_blk",
@@ -2448,7 +2430,7 @@ · 33 unmodified lines
24482430 },
24492431 {
24502432 "BriefDescription": "This metric estimates the fraction of cycles where the STLB was missed by store accesses, performing a hardware page walk",
2451− "MetricExpr": "DTLB_STORE_MISSES.WALK_ACTIVE / tma_info_core_core_clks",
2433+ "MetricExpr": "cpu_core@DTLB_STORE_MISSES.WALK_ACTIVE@ / tma_info_core_core_clks",
24522434 "MetricGroup": "MemoryTLB;TopdownL5;tma_L5_group;tma_dtlb_store_group",
24532435 "MetricName": "tma_store_stlb_miss",
24542436 "MetricThreshold": "tma_store_stlb_miss > 0.05 & (tma_dtlb_store > 0.05 & (tma_store_bound > 0.2 & (tma_memory_bound > 0.2 & tma_backend_bound > 0.2)))",
@@ -2467,7 +2449,7 @@ · 12 unmodified lines
24672449 },
24682450 {
24692451 "BriefDescription": "This metric represents fraction of cycles the CPU was stalled due to new branch address clears",
2470− "MetricExpr": "INT_MISC.UNKNOWN_BRANCH_CYCLES / tma_info_thread_clks",
2452+ "MetricExpr": "cpu_core@INT_MISC.UNKNOWN_BRANCH_CYCLES@ / tma_info_thread_clks",
24712453 "MetricGroup": "BigFoot;FetchLat;TopdownL4;tma_L4_group;tma_branch_resteers_group",
24722454 "MetricName": "tma_unknown_branches",
24732455 "MetricThreshold": "tma_unknown_branches > 0.05 & (tma_branch_resteers > 0.05 & (tma_fetch_latency > 0.1 & tma_frontend_bound > 0.15))",
tools/perf/pmu-events/arch/x86/alderlaken/adln-metrics.json+0−4
@@ -195,7 +195,6 @@ · 194 unmodified lines
195195 },
196196 {
197197 "BriefDescription": "Counts the number of cycles the core is stalled due to a demand load miss which hit in DRAM or MMIO (Non-DRAM).",
198− "MetricConstraint": "NO_GROUP_EVENTS",
199198 "MetricExpr": "MEM_BOUND_STALLS.LOAD_DRAM_HIT / tma_info_core_clks - max((MEM_BOUND_STALLS.LOAD - LD_HEAD.L1_MISS_AT_RET) / tma_info_core_clks, 0) * MEM_BOUND_STALLS.LOAD_DRAM_HIT / MEM_BOUND_STALLS.LOAD",
200199 "MetricGroup": "TopdownL3;tma_L3_group;tma_memory_bound_group",
201200 "MetricName": "tma_dram_bound",
@@ -457,7 +456,6 @@ · 255 unmodified lines
457456 },
458457 {
459458 "BriefDescription": "Counts the number of cycles a core is stalled due to a demand load which hit in the L2 Cache.",
460− "MetricConstraint": "NO_GROUP_EVENTS",
461459 "MetricExpr": "MEM_BOUND_STALLS.LOAD_L2_HIT / tma_info_core_clks - max((MEM_BOUND_STALLS.LOAD - LD_HEAD.L1_MISS_AT_RET) / tma_info_core_clks, 0) * MEM_BOUND_STALLS.LOAD_L2_HIT / MEM_BOUND_STALLS.LOAD",
462460 "MetricGroup": "TopdownL3;tma_L3_group;tma_memory_bound_group",
463461 "MetricName": "tma_l2_bound",
@@ -466,7 +464,6 @@ · 2 unmodified lines
466464 },
467465 {
468466 "BriefDescription": "Counts the number of cycles a core is stalled due to a demand load which hit in the Last Level Cache (LLC) or other core with HITE/F/M.",
469− "MetricConstraint": "NO_GROUP_EVENTS_NMI",
470467 "MetricExpr": "MEM_BOUND_STALLS.LOAD_LLC_HIT / tma_info_core_clks - max((MEM_BOUND_STALLS.LOAD - LD_HEAD.L1_MISS_AT_RET) / tma_info_core_clks, 0) * MEM_BOUND_STALLS.LOAD_LLC_HIT / MEM_BOUND_STALLS.LOAD",
471468 "MetricGroup": "TopdownL3;tma_L3_group;tma_memory_bound_group",
472469 "MetricName": "tma_l3_bound",
@@ -683,7 +680,6 @@ · 210 unmodified lines
683680 },
684681 {
685682 "BriefDescription": "Counts the number of cycles that the oldest load of the load buffer is stalled at retirement due to a store forward block.",
686− "MetricConstraint": "NO_GROUP_EVENTS_NMI",
687683 "MetricExpr": "LD_HEAD.ST_ADDR_AT_RET / tma_info_core_clks",
688684 "MetricGroup": "TopdownL4;tma_L4_group;tma_l1_bound_group",
689685 "MetricName": "tma_store_fwd_blk",
tools/perf/pmu-events/arch/x86/sapphirerapids/spr-metrics.json+5−20
@@ -400,7 +400,6 @@ · 399 unmodified lines
400400 },
401401 {
402402 "BriefDescription": "This metric estimates fraction of cycles while the memory subsystem was handling synchronizations due to contested accesses",
403− "MetricConstraint": "NO_GROUP_EVENTS",
404403 "MetricExpr": "(76 * tma_info_system_average_frequency * (MEM_LOAD_L3_HIT_RETIRED.XSNP_FWD * (OCR.DEMAND_DATA_RD.L3_HIT.SNOOP_HITM / (OCR.DEMAND_DATA_RD.L3_HIT.SNOOP_HITM + OCR.DEMAND_DATA_RD.L3_HIT.SNOOP_HIT_WITH_FWD))) + 75.5 * tma_info_system_average_frequency * MEM_LOAD_L3_HIT_RETIRED.XSNP_MISS) * (1 + MEM_LOAD_RETIRED.FB_HIT / MEM_LOAD_RETIRED.L1_MISS / 2) / tma_info_thread_clks",
405404 "MetricGroup": "DataSharing;Offcore;Snoop;TopdownL4;tma_L4_group;tma_issueSyncxn;tma_l3_bound_group",
406405 "MetricName": "tma_contested_accesses",
@@ -421,7 +420,6 @@ · 14 unmodified lines
421420 },
422421 {
423422 "BriefDescription": "This metric estimates fraction of cycles while the memory subsystem was handling synchronizations due to data-sharing accesses",
424− "MetricConstraint": "NO_GROUP_EVENTS",
425423 "MetricExpr": "75.5 * tma_info_system_average_frequency * (MEM_LOAD_L3_HIT_RETIRED.XSNP_NO_FWD + MEM_LOAD_L3_HIT_RETIRED.XSNP_FWD * (1 - OCR.DEMAND_DATA_RD.L3_HIT.SNOOP_HITM / (OCR.DEMAND_DATA_RD.L3_HIT.SNOOP_HITM + OCR.DEMAND_DATA_RD.L3_HIT.SNOOP_HIT_WITH_FWD))) * (1 + MEM_LOAD_RETIRED.FB_HIT / MEM_LOAD_RETIRED.L1_MISS / 2) / tma_info_thread_clks",
426424 "MetricGroup": "Offcore;Snoop;TopdownL4;tma_L4_group;tma_issueSyncxn;tma_l3_bound_group",
427425 "MetricName": "tma_data_sharing",
@@ -449,7 +447,6 @@ · 21 unmodified lines
449447 },
450448 {
451449 "BriefDescription": "This metric estimates how often the CPU was stalled on accesses to external memory (DRAM) by loads",
452− "MetricConstraint": "NO_GROUP_EVENTS",
453450 "MetricExpr": "(MEMORY_ACTIVITY.STALLS_L3_MISS / tma_info_thread_clks - tma_pmm_bound if #has_pmem > 0 else MEMORY_ACTIVITY.STALLS_L3_MISS / tma_info_thread_clks)",
454451 "MetricGroup": "MemoryBound;TmaL3mem;TopdownL3;tma_L3_group;tma_memory_bound_group",
455452 "MetricName": "tma_dram_bound",
@@ -656,7 +653,6 @@ · 200 unmodified lines
656653 },
657654 {
658655 "BriefDescription": "Branch Misprediction Cost: Fraction of TMA slots wasted per non-speculative branch misprediction (retired JEClear)",
659− "MetricConstraint": "NO_GROUP_EVENTS",
660656 "MetricExpr": "(tma_branch_mispredicts + tma_fetch_latency * tma_mispredicts_resteers / (tma_branch_resteers + tma_dsb_switches + tma_icache_misses + tma_itlb_misses + tma_lcp + tma_ms_switches)) * tma_info_thread_slots / BR_MISP_RETIRED.ALL_BRANCHES",
661657 "MetricGroup": "Bad;BrMispredicts;tma_issueBM",
662658 "MetricName": "tma_info_bad_spec_branch_misprediction_cost",
@@ -699,7 +695,6 @@ · 36 unmodified lines
699695 },
700696 {
701697 "BriefDescription": "Probability of Core Bound bottleneck hidden by SMT-profiling artifacts",
702− "MetricConstraint": "NO_GROUP_EVENTS",
703698 "MetricExpr": "(100 * (1 - tma_core_bound / tma_ports_utilization if tma_core_bound < tma_ports_utilization else 1) if tma_info_system_smt_2t_utilization > 0.5 else 0)",
704699 "MetricGroup": "Cor;SMT",
705700 "MetricName": "tma_info_botlnk_l0_core_bound_likely",
@@ -707,7 +702,6 @@ · 1 unmodified line
707702 },
708703 {
709704 "BriefDescription": "Total pipeline cost of DSB (uop cache) misses - subset of the Instruction_Fetch_BW Bottleneck",
710− "MetricConstraint": "NO_GROUP_EVENTS",
711705 "MetricExpr": "100 * (tma_fetch_latency * tma_dsb_switches / (tma_branch_resteers + tma_dsb_switches + tma_icache_misses + tma_itlb_misses + tma_lcp + tma_ms_switches) + tma_fetch_bandwidth * tma_mite / (tma_dsb + tma_mite))",
712706 "MetricGroup": "DSBmiss;Fed;tma_issueFB",
713707 "MetricName": "tma_info_botlnk_l2_dsb_misses",
@@ -716,7 +710,6 @@ · 2 unmodified lines
716710 },
717711 {
718712 "BriefDescription": "Total pipeline cost of Instruction Cache misses - subset of the Big_Code Bottleneck",
719− "MetricConstraint": "NO_GROUP_EVENTS",
720713 "MetricExpr": "100 * (tma_fetch_latency * tma_icache_misses / (tma_branch_resteers + tma_dsb_switches + tma_icache_misses + tma_itlb_misses + tma_lcp + tma_ms_switches))",
721714 "MetricGroup": "Fed;FetchLat;IcMiss;tma_issueFL",
722715 "MetricName": "tma_info_botlnk_l2_ic_misses",
@@ -725,7 +718,6 @@ · 2 unmodified lines
725718 },
726719 {
727720 "BriefDescription": "Total pipeline cost of instruction fetch related bottlenecks by large code footprint programs (i-side cache; TLB and BTB misses)",
728− "MetricConstraint": "NO_GROUP_EVENTS",
729721 "MetricExpr": "100 * tma_fetch_latency * (tma_itlb_misses + tma_icache_misses + tma_unknown_branches) / (tma_branch_resteers + tma_dsb_switches + tma_icache_misses + tma_itlb_misses + tma_lcp + tma_ms_switches)",
730722 "MetricGroup": "BigFoot;Fed;Frontend;IcMiss;MemoryTLB;tma_issueBC",
731723 "MetricName": "tma_info_bottleneck_big_code",
@@ -742,7 +734,6 @@ · 10 unmodified lines
742734 },
743735 {
744736 "BriefDescription": "Total pipeline cost of instruction fetch bandwidth related bottlenecks",
745− "MetricConstraint": "NO_GROUP_EVENTS",
746737 "MetricExpr": "100 * (tma_frontend_bound - tma_fetch_latency * tma_mispredicts_resteers / (tma_branch_resteers + tma_dsb_switches + tma_icache_misses + tma_itlb_misses + tma_lcp + tma_ms_switches)) - tma_info_bottleneck_big_code",
747738 "MetricGroup": "Fed;FetchBW;Frontend",
748739 "MetricName": "tma_info_bottleneck_instruction_fetch_bw",
@@ -750,7 +741,6 @@ · 1 unmodified line
750741 },
751742 {
752743 "BriefDescription": "Total pipeline cost of (external) Memory Bandwidth related bottlenecks",
753− "MetricConstraint": "NO_GROUP_EVENTS",
754744 "MetricExpr": "100 * tma_memory_bound * (tma_dram_bound / (tma_dram_bound + tma_l1_bound + tma_l2_bound + tma_l3_bound + tma_pmm_bound + tma_store_bound) * (tma_mem_bandwidth / (tma_mem_bandwidth + tma_mem_latency)) + tma_l3_bound / (tma_dram_bound + tma_l1_bound + tma_l2_bound + tma_l3_bound + tma_pmm_bound + tma_store_bound) * (tma_sq_full / (tma_contested_accesses + tma_data_sharing + tma_l3_hit_latency + tma_sq_full))) + tma_l1_bound / (tma_dram_bound + tma_l1_bound + tma_l2_bound + tma_l3_bound + tma_pmm_bound + tma_store_bound) * (tma_fb_full / (tma_dtlb_load + tma_fb_full + tma_lock_latency + tma_split_loads + tma_store_fwd_blk))",
755745 "MetricGroup": "Mem;MemoryBW;Offcore;tma_issueBW",
756746 "MetricName": "tma_info_bottleneck_memory_bandwidth",
@@ -759,7 +749,6 @@ · 2 unmodified lines
759749 },
760750 {
761751 "BriefDescription": "Total pipeline cost of Memory Address Translation related bottlenecks (data-side TLBs)",
762− "MetricConstraint": "NO_GROUP_EVENTS",
763752 "MetricExpr": "100 * tma_memory_bound * (tma_l1_bound / max(tma_memory_bound, tma_dram_bound + tma_l1_bound + tma_l2_bound + tma_l3_bound + tma_pmm_bound + tma_store_bound) * (tma_dtlb_load / max(tma_l1_bound, tma_dtlb_load + tma_fb_full + tma_lock_latency + tma_split_loads + tma_store_fwd_blk)) + tma_store_bound / (tma_dram_bound + tma_l1_bound + tma_l2_bound + tma_l3_bound + tma_pmm_bound + tma_store_bound) * (tma_dtlb_store / (tma_dtlb_store + tma_false_sharing + tma_split_stores + tma_store_latency + tma_streaming_stores)))",
764753 "MetricGroup": "Mem;MemoryTLB;Offcore;tma_issueTLB",
765754 "MetricName": "tma_info_bottleneck_memory_data_tlbs",
@@ -768,7 +757,6 @@ · 2 unmodified lines
768757 },
769758 {
770759 "BriefDescription": "Total pipeline cost of Memory Latency related bottlenecks (external memory and off-core caches)",
771− "MetricConstraint": "NO_GROUP_EVENTS",
772760 "MetricExpr": "100 * tma_memory_bound * (tma_dram_bound / (tma_dram_bound + tma_l1_bound + tma_l2_bound + tma_l3_bound + tma_pmm_bound + tma_store_bound) * (tma_mem_latency / (tma_mem_bandwidth + tma_mem_latency)) + tma_l3_bound / (tma_dram_bound + tma_l1_bound + tma_l2_bound + tma_l3_bound + tma_pmm_bound + tma_store_bound) * (tma_l3_hit_latency / (tma_contested_accesses + tma_data_sharing + tma_l3_hit_latency + tma_sq_full)) + tma_l2_bound / (tma_dram_bound + tma_l1_bound + tma_l2_bound + tma_l3_bound + tma_pmm_bound + tma_store_bound))",
773761 "MetricGroup": "Mem;MemoryLat;Offcore;tma_issueLat",
774762 "MetricName": "tma_info_bottleneck_memory_latency",
@@ -777,7 +765,6 @@ · 2 unmodified lines
777765 },
778766 {
779767 "BriefDescription": "Total pipeline cost of Branch Misprediction related bottlenecks",
780− "MetricConstraint": "NO_GROUP_EVENTS",
781768 "MetricExpr": "100 * (tma_branch_mispredicts + tma_fetch_latency * tma_mispredicts_resteers / (tma_branch_resteers + tma_dsb_switches + tma_icache_misses + tma_itlb_misses + tma_lcp + tma_ms_switches))",
782769 "MetricGroup": "Bad;BadSpec;BrMispredicts;tma_issueBM",
783770 "MetricName": "tma_info_bottleneck_mispredictions",
@@ -1301,6 +1288,7 @@ · 517 unmodified lines
13011288 },
13021289 {
13031290 "BriefDescription": "Average latency of data read request to external memory (in nanoseconds)",
1291+ "MetricConstraint": "NO_GROUP_EVENTS",
13041292 "MetricExpr": "1e9 * (UNC_CHA_TOR_OCCUPANCY.IA_MISS_DRD / UNC_CHA_TOR_INSERTS.IA_MISS_DRD) / (tma_info_system_socket_clks / duration_time)",
13051293 "MetricGroup": "Mem;MemoryLat;SoC",
13061294 "MetricName": "tma_info_system_mem_read_latency",
@@ -1455,7 +1443,6 @@ · 148 unmodified lines
14551443 },
14561444 {
14571445 "BriefDescription": "This metric estimates how often the CPU was stalled due to L2 cache accesses by loads",
1458− "MetricConstraint": "NO_GROUP_EVENTS",
14591446 "MetricExpr": "(MEMORY_ACTIVITY.STALLS_L1D_MISS - MEMORY_ACTIVITY.STALLS_L2_MISS) / tma_info_thread_clks",
14601447 "MetricGroup": "CacheMisses;MemoryBound;TmaL3mem;TopdownL3;tma_L3_group;tma_memory_bound_group",
14611448 "MetricName": "tma_l2_bound",
@@ -1465,7 +1452,6 @@ · 3 unmodified lines
14651452 },
14661453 {
14671454 "BriefDescription": "This metric estimates how often the CPU was stalled due to loads accesses to L3 cache or contended with a sibling Core",
1468− "MetricConstraint": "NO_GROUP_EVENTS_NMI",
14691455 "MetricExpr": "(MEMORY_ACTIVITY.STALLS_L2_MISS - MEMORY_ACTIVITY.STALLS_L3_MISS) / tma_info_thread_clks",
14701456 "MetricGroup": "CacheMisses;MemoryBound;TmaL3mem;TopdownL3;tma_L3_group;tma_memory_bound_group",
14711457 "MetricName": "tma_l3_bound",
@@ -1538,7 +1524,6 @@ · 66 unmodified lines
15381524 },
15391525 {
15401526 "BriefDescription": "This metric represents fraction of cycles the CPU spent handling cache misses due to lock operations",
1541− "MetricConstraint": "NO_GROUP_EVENTS",
15421527 "MetricExpr": "(16 * max(0, MEM_INST_RETIRED.LOCK_LOADS - L2_RQSTS.ALL_RFO) + MEM_INST_RETIRED.LOCK_LOADS / MEM_INST_RETIRED.ALL_STORES * (10 * L2_RQSTS.RFO_HIT + min(CPU_CLK_UNHALTED.THREAD, OFFCORE_REQUESTS_OUTSTANDING.CYCLES_WITH_DEMAND_RFO))) / tma_info_thread_clks",
15431528 "MetricGroup": "Offcore;TopdownL4;tma_L4_group;tma_issueRFO;tma_l1_bound_group",
15441529 "MetricName": "tma_lock_latency",
@@ -1596,6 +1581,7 @@ · 51 unmodified lines
15961581 },
15971582 {
15981583 "BriefDescription": "This metric represents fraction of cycles the CPU was stalled due to LFENCE Instructions.",
1584+ "MetricConstraint": "NO_GROUP_EVENTS_NMI",
15991585 "MetricExpr": "13 * MISC2_RETIRED.LFENCE / tma_info_thread_clks",
16001586 "MetricGroup": "TopdownL6;tma_L6_group;tma_serializing_operation_group",
16011587 "MetricName": "tma_memory_fence",
@@ -1604,7 +1590,6 @@ · 2 unmodified lines
16041590 },
16051591 {
16061592 "BriefDescription": "This metric represents fraction of slots where the CPU was retiring memory operations -- uops for memory load or store accesses.",
1607− "MetricConstraint": "NO_GROUP_EVENTS",
16081593 "MetricExpr": "tma_light_operations * MEM_UOP_RETIRED.ANY / (tma_retiring * tma_info_thread_slots)",
16091594 "MetricGroup": "Pipeline;TopdownL3;tma_L3_group;tma_light_operations_group",
16101595 "MetricName": "tma_memory_operations",
@@ -1676,7 +1661,6 @@ · 65 unmodified lines
16761661 },
16771662 {
16781663 "BriefDescription": "This metric represents the remaining light uops fraction the CPU has executed - remaining means not covered by other sibling nodes",
1679− "MetricConstraint": "NO_GROUP_EVENTS",
16801664 "MetricExpr": "max(0, tma_light_operations - (tma_fp_arith + tma_int_operations + tma_memory_operations + tma_fused_instructions + tma_non_fused_branches + tma_nop_instructions))",
16811665 "MetricGroup": "Pipeline;TopdownL3;tma_L3_group;tma_light_operations_group",
16821666 "MetricName": "tma_other_light_ops",
@@ -1758,6 +1742,7 @@ · 75 unmodified lines
17581742 },
17591743 {
17601744 "BriefDescription": "This metric represents fraction of cycles CPU executed total of 2 uops per cycle on all execution ports (Logical Processor cycles since ICL, Physical Core cycles otherwise)",
1745+ "MetricConstraint": "NO_GROUP_EVENTS_NMI",
17611746 "MetricExpr": "EXE_ACTIVITY.2_PORTS_UTIL / tma_info_thread_clks",
17621747 "MetricGroup": "PortsUtil;TopdownL4;tma_L4_group;tma_issue2P;tma_ports_utilization_group",
17631748 "MetricName": "tma_ports_utilized_2",
@@ -1767,6 +1752,7 @@ · 3 unmodified lines
17671752 },
17681753 {
17691754 "BriefDescription": "This metric represents fraction of cycles CPU executed total of 3 or more uops per cycle on all execution ports (Logical Processor cycles since ICL, Physical Core cycles otherwise)",
1755+ "MetricConstraint": "NO_GROUP_EVENTS_NMI",
17701756 "MetricExpr": "UOPS_EXECUTED.CYCLES_GE_3 / tma_info_thread_clks",
17711757 "MetricGroup": "PortsUtil;TopdownL4;tma_L4_group;tma_ports_utilization_group",
17721758 "MetricName": "tma_ports_utilized_3m",
@@ -1822,6 +1808,7 @@ · 49 unmodified lines
18221808 },
18231809 {
18241810 "BriefDescription": "This metric represents fraction of cycles the CPU was stalled due to PAUSE Instructions",
1811+ "MetricConstraint": "NO_GROUP_EVENTS_NMI",
18251812 "MetricExpr": "CPU_CLK_UNHALTED.PAUSE / tma_info_thread_clks",
18261813 "MetricGroup": "TopdownL6;tma_L6_group;tma_serializing_operation_group",
18271814 "MetricName": "tma_slow_pause",
@@ -1840,7 +1827,6 @@ · 12 unmodified lines
18401827 },
18411828 {
18421829 "BriefDescription": "This metric represents rate of split store accesses",
1843− "MetricConstraint": "NO_GROUP_EVENTS_NMI",
18441830 "MetricExpr": "MEM_INST_RETIRED.SPLIT_STORES / tma_info_core_core_clks",
18451831 "MetricGroup": "TopdownL4;tma_L4_group;tma_issueSpSt;tma_store_bound_group",
18461832 "MetricName": "tma_split_stores",
@@ -1868,7 +1854,6 @@ · 21 unmodified lines
18681854 },
18691855 {
18701856 "BriefDescription": "This metric roughly estimates fraction of cycles when the memory subsystem had loads blocked since they could not forward data from earlier (in program order) overlapping stores",
1871− "MetricConstraint": "NO_GROUP_EVENTS_NMI",
18721857 "MetricExpr": "13 * LD_BLOCKS.STORE_FORWARD / tma_info_thread_clks",
18731858 "MetricGroup": "TopdownL4;tma_L4_group;tma_l1_bound_group",
18741859 "MetricName": "tma_store_fwd_blk",
tools/perf/tests/shell/daemon.sh+24−10
@@ -414,16 +414,30 @@ EOF · 413 unmodified lines
414414 # start daemon
415415 daemon_start ${config} test
416416
417− # send 2 signals
418− perf daemon signal --config ${config} --session test
419− perf daemon signal --config ${config}
420−
421− # stop daemon
422− daemon_exit ${config}
423−
424− # count is 2 perf.data for signals and 1 for perf record finished
425− count=`ls ${base}/session-test/*perf.data* | wc -l`
426− if [ ${count} -ne 3 ]; then
417+ # send 2 signals then exit. Do this in a loop watching the number of
418+ # files to avoid races. If the loop retries more than 600 times then
419+ # give up.
420+ local retries=0
421+ local signals=0
422+ local success=0
423+ while [ ${retries} -lt 600 ] && [ ${success} -eq 0 ]; do
424+ local files
425+ files=`ls ${base}/session-test/*perf.data* 2> /dev/null | wc -l`
426+ if [ ${signals} -eq 0 ]; then
427+ perf daemon signal --config ${config} --session test
428+ signals=1
429+ elif [ ${signals} -eq 1 ] && [ $files -ge 1 ]; then
430+ perf daemon signal --config ${config}
431+ signals=2
432+ elif [ ${signals} -eq 2 ] && [ $files -ge 2 ]; then
433+ daemon_exit ${config}
434+ signals=3
435+ elif [ ${signals} -eq 3 ] && [ $files -ge 3 ]; then
436+ success=1
437+ fi
438+ retries=$((${retries} +1))
439+ done
440+ if [ ${success} -eq 0 ]; then
427441 error=1
428442 echo "FAILED: perf data no generated"
429443 fi
tools/perf/tests/shell/list.sh+18−3
@@ -3,17 +3,32 @@ · 2 unmodified lines
33 # SPDX-License-Identifier: GPL-2.0
44
55 set -e
6−err=0
76
87 shelldir=$(dirname "$0")
98 # shellcheck source=lib/setup_python.sh
109 . "${shelldir}"/lib/setup_python.sh
1110
11+list_output=$(mktemp /tmp/__perf_test.list_output.json.XXXXX)
12+
13+cleanup() {
14+ rm -f "${list_output}"
15+
16+ trap - EXIT TERM INT
17+}
18+
19+trap_cleanup() {
20+ cleanup
21+ exit 1
22+}
23+trap trap_cleanup EXIT TERM INT
24+
1225 test_list_json() {
1326 echo "Json output test"
14− perf list -j | $PYTHON -m json.tool
27+ perf list -j -o "${list_output}"
28+ $PYTHON -m json.tool "${list_output}"
1529 echo "Json output test [Success]"
1630 }
1731
1832 test_list_json
19−exit $err
33+cleanup
34+exit 0
tools/perf/tests/shell/script.sh+9−3
@@ -36,8 +36,7 @@ test_db() · 35 unmodified lines
3636 echo "DB test"
3737
3838 # Check if python script is supported
39− libpython=$(perf version --build-options | grep python | grep -cv OFF)
40− if [ "${libpython}" != "1" ] ; then
39+ if perf version --build-options | grep python | grep -q OFF ; then
4140 echo "SKIP: python scripting is not supported"
4241 err=2
4342 return
@@ -54,7 +53,14 @@ def sample_table(*args): · 10 unmodified lines
5453 def call_path_table(*args):
5554 print(f'call_path_table({args}')
5655 _end_of_file_
57− perf record -g -o "${perfdatafile}" true
56+ case $(uname -m)
57+ in s390x)
58+ cmd_flags="--call-graph dwarf -e cpu-clock";;
59+ *)
60+ cmd_flags="-g";;
61+ esac
62+
63+ perf record $cmd_flags -o "${perfdatafile}" true
5864 perf script -i "${perfdatafile}" -s "${db_test}"
5965 echo "DB test [Success]"
6066 }
tools/perf/trace/beauty/statx.c+1−0
@@ -67,6 +67,7 @@ size_t syscall_arg__scnprintf_statx_mask(char *bf, size_t size, struct syscall_a · 66 unmodified lines
6767 P_FLAG(BTIME);
6868 P_FLAG(MNT_ID);
6969 P_FLAG(DIOALIGN);
70+ P_FLAG(MNT_ID_UNIQUE);
7071
7172 #undef P_FLAG
7273
tools/perf/util/evlist.c+8−1
@@ -103,7 +103,14 @@ struct evlist *evlist__new_default(void) · 102 unmodified lines
103103 err = parse_event(evlist, can_profile_kernel ? "cycles:P" : "cycles:Pu");
104104 if (err) {
105105 evlist__delete(evlist);
106− evlist = NULL;
106+ return NULL;
107+ }
108+
109+ if (evlist->core.nr_entries > 1) {
110+ struct evsel *evsel;
111+
112+ evlist__for_each_entry(evlist, evsel)
113+ evsel__set_sample_id(evsel, /*can_sample_identifier=*/false);
107114 }
108115
109116 return evlist;
tools/perf/util/hist.c+2−2
@@ -491,8 +491,8 @@ static int hist_entry__init(struct hist_entry *he, · 490 unmodified lines
491491 }
492492
493493 if (symbol_conf.res_sample) {
494− he->res_samples = calloc(sizeof(struct res_sample),
495− symbol_conf.res_sample);
494+ he->res_samples = calloc(symbol_conf.res_sample,
495+ sizeof(struct res_sample));
496496 if (!he->res_samples)
497497 goto err_srcline;
498498 }
tools/perf/util/include/linux/linkage.h+4−0
@@ -115,6 +115,10 @@ · 114 unmodified lines
115115 SYM_ALIAS(alias, name, SYM_T_FUNC, SYM_L_WEAK)
116116 #endif
117117
118+#ifndef SYM_FUNC_ALIAS_MEMFUNC
119+#define SYM_FUNC_ALIAS_MEMFUNC SYM_FUNC_ALIAS
120+#endif
121+
118122 // In the kernel sources (include/linux/cfi_types.h), this has a different
119123 // definition when CONFIG_CFI_CLANG is used, for tools/ just use the !clang
120124 // definition:
tools/perf/util/metricgroup.c+1−1
@@ -286,7 +286,7 @@ static int setup_metric_events(const char *pmu, struct hashmap *ids, · 285 unmodified lines
286286 *out_metric_events = NULL;
287287 ids_size = hashmap__size(ids);
288288
289− metric_events = calloc(sizeof(void *), ids_size + 1);
289+ metric_events = calloc(ids_size + 1, sizeof(void *));
290290 if (!metric_events)
291291 return -ENOMEM;
292292
tools/perf/util/print-events.c+1−1
@@ -66,7 +66,7 @@ void print_tracepoint_events(const struct print_callbacks *print_cb __maybe_unus · 65 unmodified lines
6666
6767 put_tracing_file(events_path);
6868 if (events_fd < 0) {
69− printf("Error: failed to open tracing events directory\n");
69+ pr_err("Error: failed to open tracing events directory\n");
7070 return;
7171 }
7272
tools/perf/util/synthetic-events.c+2−2
@@ -1055,11 +1055,11 @@ int perf_event__synthesize_threads(struct perf_tool *tool, · 1054 unmodified lines
10551055 if (thread_nr > n)
10561056 thread_nr = n;
10571057
1058− synthesize_threads = calloc(sizeof(pthread_t), thread_nr);
1058+ synthesize_threads = calloc(thread_nr, sizeof(pthread_t));
10591059 if (synthesize_threads == NULL)
10601060 goto free_dirent;
10611061
1062− args = calloc(sizeof(*args), thread_nr);
1062+ args = calloc(thread_nr, sizeof(*args));
10631063 if (args == NULL)
10641064 goto free_threads;
10651065
tools/testing/selftests/kvm/riscv/get-reg-list.c+108−0
@@ -49,15 +49,42 @@ bool filter_reg(__u64 reg) · 48 unmodified lines
4949 case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_SVPBMT:
5050 case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZBA:
5151 case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZBB:
52+ case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZBC:
53+ case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZBKB:
54+ case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZBKC:
55+ case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZBKX:
5256 case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZBS:
57+ case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZFA:
58+ case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZFH:
59+ case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZFHMIN:
5360 case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZICBOM:
5461 case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZICBOZ:
5562 case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZICNTR:
5663 case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZICOND:
5764 case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZICSR:
5865 case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZIFENCEI:
66+ case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZIHINTNTL:
5967 case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZIHINTPAUSE:
6068 case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZIHPM:
69+ case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZKND:
70+ case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZKNE:
71+ case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZKNH:
72+ case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZKR:
73+ case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZKSED:
74+ case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZKSH:
75+ case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZKT:
76+ case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZVBB:
77+ case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZVBC:
78+ case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZVFH:
79+ case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZVFHMIN:
80+ case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZVKB:
81+ case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZVKG:
82+ case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZVKNED:
83+ case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZVKNHA:
84+ case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZVKNHB:
85+ case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZVKSED:
86+ case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZVKSH:
87+ case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZVKT:
6188 /*
6289 * Like ISA_EXT registers, SBI_EXT registers are only visible when the
6390 * host supports them and disabling them does not affect the visibility
@@ -394,15 +421,42 @@ static const char *isa_ext_single_id_to_str(__u64 reg_off) · 330 unmodified lines
394421 KVM_ISA_EXT_ARR(SVPBMT),
395422 KVM_ISA_EXT_ARR(ZBA),
396423 KVM_ISA_EXT_ARR(ZBB),
424+ KVM_ISA_EXT_ARR(ZBC),
425+ KVM_ISA_EXT_ARR(ZBKB),
426+ KVM_ISA_EXT_ARR(ZBKC),
427+ KVM_ISA_EXT_ARR(ZBKX),
397428 KVM_ISA_EXT_ARR(ZBS),
429+ KVM_ISA_EXT_ARR(ZFA),
430+ KVM_ISA_EXT_ARR(ZFH),
431+ KVM_ISA_EXT_ARR(ZFHMIN),
398432 KVM_ISA_EXT_ARR(ZICBOM),
399433 KVM_ISA_EXT_ARR(ZICBOZ),
400434 KVM_ISA_EXT_ARR(ZICNTR),
401435 KVM_ISA_EXT_ARR(ZICOND),
402436 KVM_ISA_EXT_ARR(ZICSR),
403437 KVM_ISA_EXT_ARR(ZIFENCEI),
438+ KVM_ISA_EXT_ARR(ZIHINTNTL),
404439 KVM_ISA_EXT_ARR(ZIHINTPAUSE),
405440 KVM_ISA_EXT_ARR(ZIHPM),
441+ KVM_ISA_EXT_ARR(ZKND),
442+ KVM_ISA_EXT_ARR(ZKNE),
443+ KVM_ISA_EXT_ARR(ZKNH),
444+ KVM_ISA_EXT_ARR(ZKR),
445+ KVM_ISA_EXT_ARR(ZKSED),
446+ KVM_ISA_EXT_ARR(ZKSH),
447+ KVM_ISA_EXT_ARR(ZKT),
448+ KVM_ISA_EXT_ARR(ZVBB),
449+ KVM_ISA_EXT_ARR(ZVBC),
450+ KVM_ISA_EXT_ARR(ZVFH),
451+ KVM_ISA_EXT_ARR(ZVFHMIN),
452+ KVM_ISA_EXT_ARR(ZVKB),
453+ KVM_ISA_EXT_ARR(ZVKG),
454+ KVM_ISA_EXT_ARR(ZVKNED),
455+ KVM_ISA_EXT_ARR(ZVKNHA),
456+ KVM_ISA_EXT_ARR(ZVKNHB),
457+ KVM_ISA_EXT_ARR(ZVKSED),
458+ KVM_ISA_EXT_ARR(ZVKSH),
459+ KVM_ISA_EXT_ARR(ZVKT),
406460 };
407461
408462 if (reg_off >= ARRAY_SIZE(kvm_isa_ext_reg_name))
@@ -888,15 +942,42 @@ KVM_ISA_EXT_SIMPLE_CONFIG(svnapot, SVNAPOT); · 479 unmodified lines
888942 KVM_ISA_EXT_SIMPLE_CONFIG(svpbmt, SVPBMT);
889943 KVM_ISA_EXT_SIMPLE_CONFIG(zba, ZBA);
890944 KVM_ISA_EXT_SIMPLE_CONFIG(zbb, ZBB);
945+KVM_ISA_EXT_SIMPLE_CONFIG(zbc, ZBC);
946+KVM_ISA_EXT_SIMPLE_CONFIG(zbkb, ZBKB);
947+KVM_ISA_EXT_SIMPLE_CONFIG(zbkc, ZBKC);
948+KVM_ISA_EXT_SIMPLE_CONFIG(zbkx, ZBKX);
891949 KVM_ISA_EXT_SIMPLE_CONFIG(zbs, ZBS);
950+KVM_ISA_EXT_SIMPLE_CONFIG(zfa, ZFA);
951+KVM_ISA_EXT_SIMPLE_CONFIG(zfh, ZFH);
952+KVM_ISA_EXT_SIMPLE_CONFIG(zfhmin, ZFHMIN);
892953 KVM_ISA_EXT_SUBLIST_CONFIG(zicbom, ZICBOM);
893954 KVM_ISA_EXT_SUBLIST_CONFIG(zicboz, ZICBOZ);
894955 KVM_ISA_EXT_SIMPLE_CONFIG(zicntr, ZICNTR);
895956 KVM_ISA_EXT_SIMPLE_CONFIG(zicond, ZICOND);
896957 KVM_ISA_EXT_SIMPLE_CONFIG(zicsr, ZICSR);
897958 KVM_ISA_EXT_SIMPLE_CONFIG(zifencei, ZIFENCEI);
959+KVM_ISA_EXT_SIMPLE_CONFIG(zihintntl, ZIHINTNTL);
898960 KVM_ISA_EXT_SIMPLE_CONFIG(zihintpause, ZIHINTPAUSE);
899961 KVM_ISA_EXT_SIMPLE_CONFIG(zihpm, ZIHPM);
962+KVM_ISA_EXT_SIMPLE_CONFIG(zknd, ZKND);
963+KVM_ISA_EXT_SIMPLE_CONFIG(zkne, ZKNE);
964+KVM_ISA_EXT_SIMPLE_CONFIG(zknh, ZKNH);
965+KVM_ISA_EXT_SIMPLE_CONFIG(zkr, ZKR);
966+KVM_ISA_EXT_SIMPLE_CONFIG(zksed, ZKSED);
967+KVM_ISA_EXT_SIMPLE_CONFIG(zksh, ZKSH);
968+KVM_ISA_EXT_SIMPLE_CONFIG(zkt, ZKT);
969+KVM_ISA_EXT_SIMPLE_CONFIG(zvbb, ZVBB);
970+KVM_ISA_EXT_SIMPLE_CONFIG(zvbc, ZVBC);
971+KVM_ISA_EXT_SIMPLE_CONFIG(zvfh, ZVFH);
972+KVM_ISA_EXT_SIMPLE_CONFIG(zvfhmin, ZVFHMIN);
973+KVM_ISA_EXT_SIMPLE_CONFIG(zvkb, ZVKB);
974+KVM_ISA_EXT_SIMPLE_CONFIG(zvkg, ZVKG);
975+KVM_ISA_EXT_SIMPLE_CONFIG(zvkned, ZVKNED);
976+KVM_ISA_EXT_SIMPLE_CONFIG(zvknha, ZVKNHA);
977+KVM_ISA_EXT_SIMPLE_CONFIG(zvknhb, ZVKNHB);
978+KVM_ISA_EXT_SIMPLE_CONFIG(zvksed, ZVKSED);
979+KVM_ISA_EXT_SIMPLE_CONFIG(zvksh, ZVKSH);
980+KVM_ISA_EXT_SIMPLE_CONFIG(zvkt, ZVKT);
900981
901982 struct vcpu_reg_list *vcpu_configs[] = {
902983 &config_sbi_base,
@@ -914,14 +995,41 @@ struct vcpu_reg_list *vcpu_configs[] = { · 11 unmodified lines
914995 &config_svpbmt,
915996 &config_zba,
916997 &config_zbb,
998+ &config_zbc,
999+ &config_zbkb,
1000+ &config_zbkc,
1001+ &config_zbkx,
9171002 &config_zbs,
1003+ &config_zfa,
1004+ &config_zfh,
1005+ &config_zfhmin,
9181006 &config_zicbom,
9191007 &config_zicboz,
9201008 &config_zicntr,
9211009 &config_zicond,
9221010 &config_zicsr,
9231011 &config_zifencei,
1012+ &config_zihintntl,
9241013 &config_zihintpause,
9251014 &config_zihpm,
1015+ &config_zknd,
1016+ &config_zkne,
1017+ &config_zknh,
1018+ &config_zkr,
1019+ &config_zksed,
1020+ &config_zksh,
1021+ &config_zkt,
1022+ &config_zvbb,
1023+ &config_zvbc,
1024+ &config_zvfh,
1025+ &config_zvfhmin,
1026+ &config_zvkb,
1027+ &config_zvkg,
1028+ &config_zvkned,
1029+ &config_zvknha,
1030+ &config_zvknhb,
1031+ &config_zvksed,
1032+ &config_zvksh,
1033+ &config_zvkt,
9261034 };
9271035 int vcpu_configs_n = ARRAY_SIZE(vcpu_configs);
tools/testing/selftests/net/big_tcp.sh+3−1
@@ -122,7 +122,9 @@ do_netperf() { · 121 unmodified lines
122122 local netns=$1
123123
124124 [ "$NF" = "6" ] && serip=$SERVER_IP6
125− ip net exec $netns netperf -$NF -t TCP_STREAM -H $serip 2>&1 >/dev/null
125+
126+ # use large write to be sure to generate big tcp packets
127+ ip net exec $netns netperf -$NF -t TCP_STREAM -l 1 -H $serip -- -m 262144 2>&1 >/dev/null
126128 }
127129
128130 do_test() {
tools/testing/selftests/net/cmsg_ipv6.sh+2−2
@@ -89,7 +89,7 @@ for ovr in setsock cmsg both diff; do · 88 unmodified lines
8989 check_result $? 0 "TCLASS $prot $ovr - pass"
9090
9191 while [ -d /proc/$BG ]; do
92− $NSEXE ./cmsg_sender -6 -p u $TGT6 1234
92+ $NSEXE ./cmsg_sender -6 -p $p $m $((TOS2)) $TGT6 1234
9393 done
9494
9595 tcpdump -r $TMPF -v 2>&1 | grep "class $TOS2" >> /dev/null
@@ -126,7 +126,7 @@ for ovr in setsock cmsg both diff; do · 30 unmodified lines
126126 check_result $? 0 "HOPLIMIT $prot $ovr - pass"
127127
128128 while [ -d /proc/$BG ]; do
129− $NSEXE ./cmsg_sender -6 -p u $TGT6 1234
129+ $NSEXE ./cmsg_sender -6 -p $p $m $LIM $TGT6 1234
130130 done
131131
132132 tcpdump -r $TMPF -v 2>&1 | grep "hlim $LIM[^0-9]" >> /dev/null
tools/testing/selftests/net/pmtu.sh+17−6
@@ -199,6 +199,7 @@ · 198 unmodified lines
199199 # Same as above but with IPv6
200200
201201 source lib.sh
202+source net_helper.sh
202203
203204 PAUSE_ON_FAIL=no
204205 VERBOSE=0
@@ -1336,13 +1337,15 @@ test_pmtu_ipvX_over_bridged_vxlanY_or_geneveY_exception() { · 1131 unmodified lines
13361337 TCPDST="TCP:[${dst}]:50000"
13371338 fi
13381339 ${ns_b} socat -T 3 -u -6 TCP-LISTEN:50000 STDOUT > $tmpoutfile &
1340+ local socat_pid=$!
13391341
1340− sleep 1
1342+ wait_local_port_listen ${NS_B} 50000 tcp
13411343
13421344 dd if=/dev/zero status=none bs=1M count=1 | ${target} socat -T 3 -u STDIN $TCPDST,connect-timeout=3
13431345
13441346 size=$(du -sb $tmpoutfile)
13451347 size=${size%%/tmp/*}
1348+ wait ${socat_pid}
13461349
13471350 [ $size -ne 1048576 ] && err "File size $size mismatches exepcted value in locally bridged vxlan test" && return 1
13481351 done
@@ -1954,6 +1957,13 @@ check_command() { · 605 unmodified lines
19541957 return 0
19551958 }
19561959
1960+check_running() {
1961+ pid=${1}
1962+ cmd=${2}
1963+
1964+ [ "$(cat /proc/${pid}/cmdline 2>/dev/null | tr -d '\0')" = "{cmd}" ]
1965+}
1966+
19571967 test_cleanup_vxlanX_exception() {
19581968 outer="${1}"
19591969 encap="vxlan"
@@ -1984,11 +1994,12 @@ test_cleanup_vxlanX_exception() { · 24 unmodified lines
19841994
19851995 ${ns_a} ip link del dev veth_A-R1 &
19861996 iplink_pid=$!
1987− sleep 1
1988− if [ "$(cat /proc/${iplink_pid}/cmdline 2>/dev/null | tr -d '\0')" = "iplinkdeldevveth_A-R1" ]; then
1989− err " can't delete veth device in a timely manner, PMTU dst likely leaked"
1990− return 1
1991− fi
1997+ for i in $(seq 1 20); do
1998+ check_running ${iplink_pid} "iplinkdeldevveth_A-R1" || return 0
1999+ sleep 0.1
2000+ done
2001+ err " can't delete veth device in a timely manner, PMTU dst likely leaked"
2002+ return 1
19922003 }
19932004
19942005 test_cleanup_ipv6_exception() {
tools/testing/selftests/net/rtnetlink.sh+2−4
@@ -440,7 +440,6 @@ kci_test_encap_vxlan() · 439 unmodified lines
440440 local ret=0
441441 vxlan="test-vxlan0"
442442 vlan="test-vlan0"
443− testns="$1"
444443 run_cmd ip -netns "$testns" link add "$vxlan" type vxlan id 42 group 239.1.1.1 \
445444 dev "$devdummy" dstport 4789
446445 if [ $? -ne 0 ]; then
@@ -485,7 +484,6 @@ kci_test_encap_fou() · 38 unmodified lines
485484 {
486485 local ret=0
487486 name="test-fou"
488− testns="$1"
489487 run_cmd_grep 'Usage: ip fou' ip fou help
490488 if [ $? -ne 0 ];then
491489 end_test "SKIP: fou: iproute2 too old"
@@ -526,8 +524,8 @@ kci_test_encap() · 34 unmodified lines
526524 run_cmd ip -netns "$testns" link set lo up
527525 run_cmd ip -netns "$testns" link add name "$devdummy" type dummy
528526 run_cmd ip -netns "$testns" link set "$devdummy" up
529− run_cmd kci_test_encap_vxlan "$testns"
530− run_cmd kci_test_encap_fou "$testns"
527+ run_cmd kci_test_encap_vxlan
528+ run_cmd kci_test_encap_fou
531529
532530 ip netns del "$testns"
533531 return $ret
tools/testing/selftests/net/tcp_ao/unsigned-md5.c+6−6
@@ -110,9 +110,9 @@ static void try_accept(const char *tst_name, unsigned int port, · 109 unmodified lines
110110 test_tcp_ao_counters_cmp(tst_name, &ao_cnt1, &ao_cnt2, cnt_expected);
111111
112112 out:
113− synchronize_threads(); /* close() */
113+ synchronize_threads(); /* test_kill_sk() */
114114 if (sk > 0)
115− close(sk);
115+ test_kill_sk(sk);
116116 }
117117
118118 static void server_add_routes(void)
@@ -302,10 +302,10 @@ static void try_connect(const char *tst_name, unsigned int port, · 183 unmodified lines
302302 test_ok("%s: connected", tst_name);
303303
304304 out:
305− synchronize_threads(); /* close() */
305+ synchronize_threads(); /* test_kill_sk() */
306306 /* _test_connect_socket() cleans up on failure */
307307 if (ret > 0)
308− close(sk);
308+ test_kill_sk(sk);
309309 }
310310
311311 #define PREINSTALL_MD5_FIRST BIT(0)
@@ -486,10 +486,10 @@ static void try_to_add(const char *tst_name, unsigned int port, · 174 unmodified lines
486486 }
487487
488488 out:
489− synchronize_threads(); /* close() */
489+ synchronize_threads(); /* test_kill_sk() */
490490 /* _test_connect_socket() cleans up on failure */
491491 if (ret > 0)
492− close(sk);
492+ test_kill_sk(sk);
493493 }
494494
495495 static void client_add_ip(union tcp_addr *client, const char *ip)
tools/testing/selftests/net/udpgro_fwd.sh+12−2
@@ -39,6 +39,10 @@ create_ns() { · 38 unmodified lines
3939 for ns in $NS_SRC $NS_DST; do
4040 ip netns add $ns
4141 ip -n $ns link set dev lo up
42+
43+ # disable route solicitations to decrease 'noise' traffic
44+ ip netns exec $ns sysctl -qw net.ipv6.conf.default.router_solicitations=0
45+ ip netns exec $ns sysctl -qw net.ipv6.conf.all.router_solicitations=0
4246 done
4347
4448 ip link add name veth$SRC type veth peer name veth$DST
@@ -80,6 +84,12 @@ create_vxlan_pair() { · 35 unmodified lines
8084 create_vxlan_endpoint $BASE$ns veth$ns $BM_NET_V6$((3 - $ns)) vxlan6$ns 6
8185 ip -n $BASE$ns addr add dev vxlan6$ns $OL_NET_V6$ns/24 nodad
8286 done
87+
88+ # preload neighbur cache, do avoid some noisy traffic
89+ local addr_dst=$(ip -j -n $BASE$DST link show dev vxlan6$DST |jq -r '.[]["address"]')
90+ local addr_src=$(ip -j -n $BASE$SRC link show dev vxlan6$SRC |jq -r '.[]["address"]')
91+ ip -n $BASE$DST neigh add dev vxlan6$DST lladdr $addr_src $OL_NET_V6$SRC
92+ ip -n $BASE$SRC neigh add dev vxlan6$SRC lladdr $addr_dst $OL_NET_V6$DST
8393 }
8494
8595 is_ipv6() {
@@ -119,7 +129,7 @@ run_test() { · 33 unmodified lines
119129 # not enable GRO
120130 ip netns exec $NS_DST $ipt -A INPUT -p udp --dport 4789
121131 ip netns exec $NS_DST $ipt -A INPUT -p udp --dport 8000
122− ip netns exec $NS_DST ./udpgso_bench_rx -C 1000 -R 10 -n 10 -l 1300 $rx_args &
132+ ip netns exec $NS_DST ./udpgso_bench_rx -C 2000 -R 100 -n 10 -l 1300 $rx_args &
123133 local spid=$!
124134 wait_local_port_listen "$NS_DST" 8000 udp
125135 ip netns exec $NS_SRC ./udpgso_bench_tx $family -M 1 -s 13000 -S 1300 -D $dst
@@ -168,7 +178,7 @@ run_bench() { · 42 unmodified lines
168178 # bind the sender and the receiver to different CPUs to try
169179 # get reproducible results
170180 ip netns exec $NS_DST bash -c "echo 2 > /sys/class/net/veth$DST/queues/rx-0/rps_cpus"
171− ip netns exec $NS_DST taskset 0x2 ./udpgso_bench_rx -C 1000 -R 10 &
181+ ip netns exec $NS_DST taskset 0x2 ./udpgso_bench_rx -C 2000 -R 100 &
172182 local spid=$!
173183 wait_local_port_listen "$NS_DST" 8000 udp
174184 ip netns exec $NS_SRC taskset 0x1 ./udpgso_bench_tx $family -l 3 -S 1300 -D $dst
tools/testing/selftests/net/udpgso_bench_rx.c+1−1
@@ -375,7 +375,7 @@ static void do_recv(void) · 374 unmodified lines
375375 do_flush_udp(fd);
376376
377377 tnow = gettimeofday_ms();
378− if (tnow > treport) {
378+ if (!cfg_expected_pkt_nr && tnow > treport) {
379379 if (packets)
380380 fprintf(stderr,
381381 "%s rx: %6lu MB/s %8lu calls/s\n",
tools/testing/selftests/netfilter/conntrack_dump_flush.c+42−1
@@ -13,7 +13,7 @@ · 12 unmodified lines
1313 #include "../kselftest_harness.h"
1414
1515 #define TEST_ZONE_ID 123
16−#define CTA_FILTER_F_CTA_TUPLE_ZONE (1 << 2)
16+#define NF_CT_DEFAULT_ZONE_ID 0
1717
1818 static int reply_counter;
1919
@@ -336,6 +336,9 @@ FIXTURE_SETUP(conntrack_dump_flush) · 316 unmodified lines
336336 ret = conntrack_data_generate_v4(self->sock, 0xf4f4f4f4, 0xf5f5f5f5,
337337 TEST_ZONE_ID + 2);
338338 EXPECT_EQ(ret, 0);
339+ ret = conntrack_data_generate_v4(self->sock, 0xf6f6f6f6, 0xf7f7f7f7,
340+ NF_CT_DEFAULT_ZONE_ID);
341+ EXPECT_EQ(ret, 0);
339342
340343 src = (struct in6_addr) {{
341344 .__u6_addr32 = {
@@ -395,6 +398,26 @@ FIXTURE_SETUP(conntrack_dump_flush) · 53 unmodified lines
395398 TEST_ZONE_ID + 2);
396399 EXPECT_EQ(ret, 0);
397400
401+ src = (struct in6_addr) {{
402+ .__u6_addr32 = {
403+ 0xb80d0120,
404+ 0x00000000,
405+ 0x00000000,
406+ 0x07000000
407+ }
408+ }};
409+ dst = (struct in6_addr) {{
410+ .__u6_addr32 = {
411+ 0xb80d0120,
412+ 0x00000000,
413+ 0x00000000,
414+ 0x08000000
415+ }
416+ }};
417+ ret = conntrack_data_generate_v6(self->sock, src, dst,
418+ NF_CT_DEFAULT_ZONE_ID);
419+ EXPECT_EQ(ret, 0);
420+
398421 ret = conntracK_count_zone(self->sock, TEST_ZONE_ID);
399422 EXPECT_GE(ret, 2);
400423 if (ret > 2)
@@ -425,6 +448,24 @@ TEST_F(conntrack_dump_flush, test_flush_by_zone) · 24 unmodified lines
425448 EXPECT_EQ(ret, 2);
426449 ret = conntracK_count_zone(self->sock, TEST_ZONE_ID + 2);
427450 EXPECT_EQ(ret, 2);
451+ ret = conntracK_count_zone(self->sock, NF_CT_DEFAULT_ZONE_ID);
452+ EXPECT_EQ(ret, 2);
453+}
454+
455+TEST_F(conntrack_dump_flush, test_flush_by_zone_default)
456+{
457+ int ret;
458+
459+ ret = conntrack_flush_zone(self->sock, NF_CT_DEFAULT_ZONE_ID);
460+ EXPECT_EQ(ret, 0);
461+ ret = conntracK_count_zone(self->sock, TEST_ZONE_ID);
462+ EXPECT_EQ(ret, 2);
463+ ret = conntracK_count_zone(self->sock, TEST_ZONE_ID + 1);
464+ EXPECT_EQ(ret, 2);
465+ ret = conntracK_count_zone(self->sock, TEST_ZONE_ID + 2);
466+ EXPECT_EQ(ret, 2);
467+ ret = conntracK_count_zone(self->sock, NF_CT_DEFAULT_ZONE_ID);
468+ EXPECT_EQ(ret, 0);
428469 }
429470
430471 TEST_HARNESS_MAIN