History

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

net/mptcp/protocol.c 977d293e23b4 ("mptcp: ensure tx skbs always have the MPTCP ext") efe686ffce01 ("mptcp: ensure tx skbs always have the MPTCP ext") same patch merged in both trees, keep net-next.

Jakub Kicinski committed 5 years ago

Commit 2fcd14d2 parents 9aad3e4 9bc62af332 files · +3498 −1318Browse files

Unified · Split

332 files
  1. Documentation/devicetree/bindings/arm/tegra.yaml +1 −1
  2. Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt +1 −1
  3. Documentation/devicetree/bindings/ufs/samsung,exynos-ufs.yaml +89 −0
  4. Documentation/networking/device_drivers/ethernet/intel/ice.rst +1 −1
  5. Documentation/networking/dsa/sja1105.rst +1 −1
  6. MAINTAINERS +11 −11
  7. Makefile +1 −1
  8. arch/alpha/Kconfig +1 −2
  9. arch/alpha/include/asm/asm-prototypes.h +1 −0
  10. arch/alpha/include/asm/jensen.h +4 −4
  11. arch/alpha/kernel/sys_jensen.c +5 −5
  12. arch/alpha/lib/Makefile +1 −0
  13. arch/alpha/lib/udiv-qrnnd.S +2 −0
  14. arch/alpha/math-emu/Makefile +1 −1
  15. arch/alpha/math-emu/math.c +0 −2
  16. arch/arm64/kernel/fpsimd.c +1 −1
  17. arch/arm64/kernel/process.c +1 −2
  18. arch/parisc/lib/iomap.c +3 −1
  19. arch/powerpc/kernel/interrupt.c +43 −0
  20. arch/powerpc/kernel/interrupt_64.S +0 −41
  21. arch/powerpc/kernel/mce.c +15 −2
  22. arch/powerpc/kvm/book3s_hv_rmhandlers.S +34 −2
  23. arch/powerpc/sysdev/xics/xics-common.c +2 −2
  24. arch/s390/Kconfig +0 −10
  25. arch/s390/Makefile +0 −7
  26. arch/s390/configs/debug_defconfig +5 −3
  27. arch/s390/configs/defconfig +4 −1
  28. arch/s390/include/asm/ccwgroup.h +1 −1
  29. arch/s390/net/bpf_jit_comp.c +38 −32
  30. arch/s390/pci/pci_mmio.c +2 −2
  31. arch/sh/boot/Makefile +8 −8
  32. arch/sparc/kernel/ioport.c +3 −1
  33. arch/sparc/lib/iomap.c +2 −0
  34. arch/x86/Kconfig +5 −0
  35. arch/x86/Makefile_32.cpu +9 −3
  36. arch/x86/kernel/cpu/mce/core.c +32 −11
  37. arch/x86/mm/init_64.c +3 −3
  38. arch/x86/mm/pat/memtype.c +6 −1
  39. arch/x86/xen/enlighten_pv.c +7 −0
  40. arch/x86/xen/mmu_pv.c +5 −2
  41. block/blk-cgroup.c +14 −4
  42. block/blk-integrity.c +8 −1
  43. block/blk-mq-tag.c +1 −1
  44. drivers/base/power/trace.c +10 −0
  45. drivers/cpufreq/cpufreq_governor_attr_set.c +1 −1
  46. drivers/cpufreq/intel_pstate.c +14 −8
  47. drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 −1
  48. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +10 −0
  49. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +7 −0
  50. drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +4 −6
  51. drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +12 −0
  52. drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +1 −1
  53. drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +1 −1
  54. drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.h +1 −1
  55. drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 −2
  56. drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +9 −9
  57. drivers/gpu/drm/amd/amdkfd/kfd_device.c +36 −20
  58. drivers/gpu/drm/amd/amdkfd/kfd_priv.h +1 −0
  59. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +86 −23
  60. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +8 −10
  61. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h +10 −1
  62. drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c +1 −1
  63. drivers/gpu/drm/amd/display/dc/core/dc_link.c +12 −4
  64. drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +30 −4
  65. drivers/gpu/drm/amd/display/dc/dce/dce_panel_cntl.c +0 −10
  66. drivers/gpu/drm/amd/pm/inc/smu11_driver_if_cyan_skillfish.h +35 −51
  67. drivers/gpu/drm/amd/pm/inc/smu_types.h +4 −1
  68. drivers/gpu/drm/amd/pm/inc/smu_v11_8_ppsmc.h +8 −1
  69. drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +1 −1
  70. drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +6 −2
  71. drivers/gpu/drm/amd/pm/swsmu/smu11/cyan_skillfish_ppt.c +481 −0
  72. drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +25 −3
  73. drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +5 −3
  74. drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +10 −6
  75. drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c +2 −0
  76. drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +8 −4
  77. drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +4 −2
  78. drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +21 −0
  79. drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h +15 −0
  80. drivers/gpu/drm/etnaviv/etnaviv_buffer.c +1 −2
  81. drivers/gpu/drm/etnaviv/etnaviv_gem.c +1 −2
  82. drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c +1 −2
  83. drivers/gpu/drm/etnaviv/etnaviv_gpu.c +25 −18
  84. drivers/gpu/drm/etnaviv/etnaviv_gpu.h +1 −0
  85. drivers/gpu/drm/etnaviv/etnaviv_iommu.c +4 −0
  86. drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c +8 −0
  87. drivers/gpu/drm/etnaviv/etnaviv_mmu.c +1 −0
  88. drivers/gpu/drm/etnaviv/etnaviv_mmu.h +3 −1
  89. drivers/gpu/drm/i915/Makefile +0 −1
  90. drivers/gpu/drm/i915/display/intel_dp.c +4 −1
  91. drivers/gpu/drm/i915/display/intel_dp_link_training.c +1 −1
  92. drivers/gpu/drm/i915/gem/i915_gem_context.c +3 −3
  93. drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c +4 −3
  94. drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c +20 −6
  95. drivers/gpu/drm/i915/gt/intel_rps.c +7 −1
  96. drivers/gpu/drm/i915/gt/uc/intel_uc.c +3 −8
  97. drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.c +1 −1
  98. drivers/gpu/drm/radeon/radeon_kms.c +1 −1
  99. drivers/gpu/drm/vc4/vc4_hdmi.c +23 −61
  100. drivers/net/dsa/b53/b53_mdio.c +19 −2
  101. drivers/net/dsa/b53/b53_mmap.c +13 −0
  102. drivers/net/dsa/b53/b53_priv.h +5 −0
  103. drivers/net/dsa/b53/b53_spi.c +13 −0
  104. drivers/net/dsa/b53/b53_srab.c +19 −2
  105. drivers/net/dsa/bcm_sf2.c +13 −1
  106. drivers/net/dsa/dsa_loop.c +21 −1
  107. drivers/net/dsa/hirschmann/hellcreek.c +16 −0
  108. drivers/net/dsa/lan9303-core.c +6 −0
  109. drivers/net/dsa/lan9303.h +1 −0
  110. drivers/net/dsa/lan9303_i2c.c +20 −4
  111. drivers/net/dsa/lan9303_mdio.c +15 −0
  112. drivers/net/dsa/lantiq_gswip.c +18 −0
  113. drivers/net/dsa/microchip/ksz8795_spi.c +10 −1
  114. drivers/net/dsa/microchip/ksz8863_smi.c +13 −0
  115. drivers/net/dsa/microchip/ksz9477_i2c.c +12 −2
  116. drivers/net/dsa/microchip/ksz9477_spi.c +6 −2
  117. drivers/net/dsa/mt7530.c +18 −0
  118. drivers/net/dsa/mv88e6060.c +18 −0
  119. drivers/net/dsa/mv88e6xxx/chip.c +35 −3
  120. drivers/net/dsa/mv88e6xxx/devlink.c +9 −64
  121. drivers/net/dsa/mv88e6xxx/devlink.h +4 −2
  122. drivers/net/dsa/ocelot/felix.c +1 −1
  123. drivers/net/dsa/ocelot/felix.h +1 −1
  124. drivers/net/dsa/ocelot/felix_vsc9959.c +19 −3
  125. drivers/net/dsa/ocelot/seville_vsc9953.c +18 −2
  126. drivers/net/dsa/qca/ar9331.c +18 −0
  127. drivers/net/dsa/qca8k.c +18 −0
  128. drivers/net/dsa/realtek-smi-core.c +20 −2
  129. drivers/net/dsa/sja1105/sja1105_clocking.c +1 −1
  130. drivers/net/dsa/sja1105/sja1105_devlink.c +1 −1
  131. drivers/net/dsa/sja1105/sja1105_flower.c +1 −1
  132. drivers/net/dsa/sja1105/sja1105_main.c +19 −2
  133. drivers/net/dsa/sja1105/sja1105_mdio.c +1 −1
  134. drivers/net/dsa/sja1105/sja1105_spi.c +1 −1
  135. drivers/net/dsa/sja1105/sja1105_static_config.c +1 −1
  136. drivers/net/dsa/sja1105/sja1105_static_config.h +1 −1
  137. drivers/net/dsa/sja1105/sja1105_vl.c +1 −1
  138. drivers/net/dsa/sja1105/sja1105_vl.h +1 −1
  139. drivers/net/dsa/vitesse-vsc73xx-core.c +6 −0
  140. drivers/net/dsa/vitesse-vsc73xx-platform.c +21 −1
  141. drivers/net/dsa/vitesse-vsc73xx-spi.c +21 −1
  142. drivers/net/dsa/vitesse-vsc73xx.h +1 −0
  143. drivers/net/dsa/xrs700x/xrs700x.c +6 −0
  144. drivers/net/dsa/xrs700x/xrs700x.h +1 −0
  145. drivers/net/dsa/xrs700x/xrs700x_i2c.c +18 −0
  146. drivers/net/dsa/xrs700x/xrs700x_mdio.c +18 −0
  147. drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c +2 −2
  148. drivers/net/ethernet/broadcom/bgmac-bcma.c +2 −0
  149. drivers/net/ethernet/broadcom/bnxt/bnxt.c +4 −4
  150. drivers/net/ethernet/broadcom/bnxt/bnxt.h +5 −0
  151. drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +1 −1
  152. drivers/net/ethernet/freescale/enetc/enetc.c +2 −5
  153. drivers/net/ethernet/freescale/enetc/enetc_ierb.c +1 −1
  154. drivers/net/ethernet/freescale/enetc/enetc_ierb.h +1 −1
  155. drivers/net/ethernet/freescale/fec_main.c +0 −1
  156. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c +4 −4
  157. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +55 −25
  158. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c +9 −1
  159. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +1 −1
  160. drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +34 −18
  161. drivers/net/ethernet/intel/Kconfig +1 −0
  162. drivers/net/ethernet/mediatek/mtk_ppe_offload.c +3 −0
  163. drivers/net/ethernet/mellanox/mlx4/en_netdev.c +32 −18
  164. drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +0 −1
  165. drivers/net/ethernet/mscc/ocelot.c +8 −13
  166. drivers/net/ethernet/mscc/ocelot_devlink.c +1 −1
  167. drivers/net/ethernet/mscc/ocelot_mrp.c +1 −1
  168. drivers/net/ethernet/mscc/ocelot_net.c +1 −1
  169. drivers/net/ethernet/qlogic/qed/qed_iwarp.c +8 −0
  170. drivers/net/ethernet/qlogic/qed/qed_roce.c +8 −0
  171. drivers/net/hamradio/dmascc.c +3 −3
  172. drivers/net/pcs/pcs-xpcs-nxp.c +1 −1
  173. drivers/net/phy/mdio_device.c +11 −0
  174. drivers/net/usb/hso.c +5 −7
  175. drivers/net/virtio_net.c +4 −0
  176. drivers/net/vxlan.c +1 −1
  177. drivers/net/xen-netback/netback.c +1 −1
  178. drivers/nfc/st-nci/spi.c +1 −0
  179. drivers/nvme/host/core.c +7 −10
  180. drivers/nvme/host/multipath.c +5 −2
  181. drivers/nvme/host/rdma.c +3 −13
  182. drivers/nvme/host/tcp.c +10 −10
  183. drivers/nvme/target/configfs.c +1 −1
  184. drivers/of/device.c +5 −1
  185. drivers/of/property.c +0 −2
  186. drivers/pci/pci-acpi.c +1 −1
  187. drivers/pci/quirks.c +7 −2
  188. drivers/pci/vpd.c +26 −10
  189. drivers/platform/x86/amd-pmc.c +1 −1
  190. drivers/platform/x86/dell/Kconfig +1 −2
  191. drivers/platform/x86/gigabyte-wmi.c +1 −0
  192. drivers/platform/x86/intel/hid.c +22 −5
  193. drivers/platform/x86/intel/punit_ipc.c +1 −2
  194. drivers/platform/x86/lg-laptop.c +1 −1
  195. drivers/platform/x86/touchscreen_dmi.c +50 −4
  196. drivers/ptp/Kconfig +1 −0
  197. drivers/regulator/max14577-regulator.c +0 −2
  198. drivers/regulator/qcom-rpmh-regulator.c +1 −1
  199. drivers/s390/char/sclp_early.c +2 −1
  200. drivers/s390/cio/ccwgroup.c +8 −2
  201. drivers/s390/crypto/ap_bus.c +2 −1
  202. drivers/s390/crypto/ap_queue.c +2 −2
  203. drivers/s390/net/qeth_core.h +0 −1
  204. drivers/s390/net/qeth_core_main.c +9 −13
  205. drivers/s390/net/qeth_l2_main.c +0 −1
  206. drivers/s390/net/qeth_l3_main.c +0 −1
  207. drivers/spi/spi-rockchip.c +6 −0
  208. drivers/spi/spi-tegra20-slink.c +2 −3
  209. drivers/spi/spi.c +0 −8
  210. drivers/video/fbdev/Kconfig +3 −1
  211. drivers/xen/Kconfig +1 −1
  212. drivers/xen/balloon.c +45 −17
  213. drivers/xen/swiotlb-xen.c +17 −20
  214. fs/afs/callback.c +42 −2
  215. fs/afs/cell.c +2 −0
  216. fs/afs/dir.c +18 −39
  217. fs/afs/dir_edit.c +2 −2
  218. fs/afs/file.c +83 −3
  219. fs/afs/fs_probe.c +7 −1
  220. fs/afs/fsclient.c +20 −11
  221. fs/afs/inode.c +43 −55
  222. fs/afs/internal.h +21 −0
  223. fs/afs/protocol_afs.h +15 −0
  224. fs/afs/protocol_yfs.h +6 −0
  225. fs/afs/rotate.c +1 −0
  226. fs/afs/server.c +2 −0
  227. fs/afs/super.c +1 −0
  228. fs/afs/write.c +24 −5
  229. fs/cifs/cache.c +1 −1
  230. fs/cifs/cifs_debug.c +0 −1
  231. fs/cifs/cifs_fs_sb.h +0 −1
  232. fs/cifs/cifs_ioctl.h +0 −1
  233. fs/cifs/cifs_spnego.c +1 −1
  234. fs/cifs/cifs_spnego.h +1 −1
  235. fs/cifs/cifs_unicode.c +0 −1
  236. fs/cifs/cifsacl.c +0 −1
  237. fs/cifs/cifsacl.h +0 −1
  238. fs/cifs/cifsencrypt.c +0 −1
  239. fs/cifs/cifsfs.c +0 −1
  240. fs/cifs/cifsfs.h +0 −1
  241. fs/cifs/cifsglob.h +1 −1
  242. fs/cifs/cifspdu.h +0 −1
  243. fs/cifs/cifsproto.h +3 −1
  244. fs/cifs/cifssmb.c +0 −1
  245. fs/cifs/connect.c +10 −3
  246. fs/cifs/dir.c +0 −1
  247. fs/cifs/dns_resolve.c +0 −1
  248. fs/cifs/dns_resolve.h +2 −2
  249. fs/cifs/export.c +0 −1
  250. fs/cifs/file.c +2 −1
  251. fs/cifs/fscache.c +1 −1
  252. fs/cifs/fscache.h +1 −1
  253. fs/cifs/inode.c +3 −4
  254. fs/cifs/ioctl.c +1 −2
  255. fs/cifs/link.c +0 −1
  256. fs/cifs/misc.c +39 −3
  257. fs/cifs/netmisc.c +0 −1
  258. fs/cifs/ntlmssp.h +0 −1
  259. fs/cifs/readdir.c +0 −1
  260. fs/cifs/rfc1002pdu.h +0 −1
  261. fs/cifs/sess.c +0 −1
  262. fs/cifs/smb2file.c +0 −1
  263. fs/cifs/smb2glob.h +0 −1
  264. fs/cifs/smb2inode.c +0 −1
  265. fs/cifs/smb2misc.c +0 −1
  266. fs/cifs/smb2pdu.c +0 −1
  267. fs/cifs/smb2pdu.h +0 −1
  268. fs/cifs/smb2proto.h +0 −1
  269. fs/cifs/smb2status.h +0 −1
  270. fs/cifs/smb2transport.c +0 −1
  271. fs/cifs/smberr.h +0 −1
  272. fs/cifs/transport.c +0 −1
  273. fs/cifs/winucase.c +0 −1
  274. fs/cifs/xattr.c +0 −1
  275. fs/io-wq.c +13 −14
  276. fs/io_uring.c +144 −77
  277. fs/ksmbd/misc.c +67 −9
  278. fs/ksmbd/misc.h +1 −2
  279. fs/ksmbd/smb2pdu.c +13 −5
  280. fs/ksmbd/transport_rdma.c +0 −1
  281. fs/lockd/svcxdr.h +2 −11
  282. fs/nfsd/nfs4state.c +13 −3
  283. fs/qnx4/dir.c +27 −9
  284. fs/smbfs_common/smbfsctl.h +1 −1
  285. include/asm-generic/io.h +3 −23
  286. include/asm-generic/iomap.h +0 −10
  287. include/asm-generic/pci_iomap.h +3 −0
  288. include/linux/dsa/ocelot.h +1 −1
  289. include/linux/mdio.h +3 −0
  290. include/linux/packing.h +1 −1
  291. include/linux/sched.h +1 −0
  292. include/linux/uio.h +16 −5
  293. include/net/dsa.h +9 −0
  294. include/net/sock.h +1 −0
  295. include/trace/events/afs.h +6 −2
  296. include/uapi/linux/cifs/cifs_mount.h +0 −1
  297. include/uapi/linux/io_uring.h +7 −1
  298. init/main.c +3 −3
  299. kernel/dma/debug.c +2 −1
  300. kernel/dma/mapping.c +2 −1
  301. kernel/events/core.c +1 −1
  302. kernel/locking/rwbase_rt.c +45 −20
  303. lib/iov_iter.c +36 −0
  304. lib/packing.c +1 −1
  305. lib/pci_iomap.c +43 −0
  306. mm/memcontrol.c +0 −10
  307. mm/memory.c +1 −0
  308. mm/workingset.c +1 −0
  309. net/core/dev.c +10 −6
  310. net/core/sock.c +23 −14
  311. net/dsa/dsa2.c +106 −8
  312. net/dsa/tag_ocelot.c +1 −1
  313. net/dsa/tag_ocelot_8021q.c +1 −1
  314. net/ipv4/nexthop.c +16 −5
  315. net/smc/smc_clc.c +2 −1
  316. net/smc/smc_core.c +2 −0
  317. scripts/Makefile.clang +5 −0
  318. scripts/Makefile.modpost +1 −1
  319. scripts/checkkconfigsymbols.py +3 −8
  320. scripts/clang-tools/gen_compile_commands.py +1 −0
  321. tools/lib/perf/evsel.c +41 −23
  322. tools/perf/builtin-script.c +13 −11
  323. tools/perf/ui/browser.c +24 −9
  324. tools/perf/ui/browser.h +1 −1
  325. tools/perf/ui/browsers/annotate.c +17 −7
  326. tools/perf/util/bpf-event.c +3 −0
  327. tools/perf/util/machine.c +1 −0
  328. tools/testing/selftests/drivers/net/ocelot/tc_flower_chains.sh +1 −1
  329. tools/testing/selftests/net/af_unix/Makefile +1 −4
  330. tools/testing/selftests/net/af_unix/test_unix_oob.c +3 −2
  331. tools/testing/selftests/powerpc/tm/tm-syscall-asm.S +36 −1
  332. tools/testing/selftests/powerpc/tm/tm-syscall.c +29 −7
Documentation/devicetree/bindings/arm/tegra.yaml+1−1
@@ -54,7 +54,7 @@ properties: · 53 unmodified lines
5454 - const: toradex,apalis_t30
5555 - const: nvidia,tegra30
5656 - items:
57− - const: toradex,apalis_t30-eval-v1.1
57+ - const: toradex,apalis_t30-v1.1-eval
5858 - const: toradex,apalis_t30-eval
5959 - const: toradex,apalis_t30-v1.1
6060 - const: toradex,apalis_t30
Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt+1−1
@@ -9,7 +9,7 @@ function block. · 8 unmodified lines
99
1010 All DISP device tree nodes must be siblings to the central MMSYS_CONFIG node.
1111 For a description of the MMSYS_CONFIG binding, see
12−Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt.
12+Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.yaml.
1313
1414 DISP function blocks
1515 ====================
Documentation/devicetree/bindings/ufs/samsung,exynos-ufs.yaml+89−0
@@ -0,0 +1,89 @@
1+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/ufs/samsung,exynos-ufs.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: Samsung SoC series UFS host controller Device Tree Bindings
8+
9+maintainers:
10+ - Alim Akhtar <alim.akhtar@samsung.com>
11+
12+description: |
13+ Each Samsung UFS host controller instance should have its own node.
14+ This binding define Samsung specific binding other then what is used
15+ in the common ufshcd bindings
16+ [1] Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt
17+
18+properties:
19+
20+ compatible:
21+ enum:
22+ - samsung,exynos7-ufs
23+
24+ reg:
25+ items:
26+ - description: HCI register
27+ - description: vendor specific register
28+ - description: unipro register
29+ - description: UFS protector register
30+
31+ reg-names:
32+ items:
33+ - const: hci
34+ - const: vs_hci
35+ - const: unipro
36+ - const: ufsp
37+
38+ clocks:
39+ items:
40+ - description: ufs link core clock
41+ - description: unipro main clock
42+
43+ clock-names:
44+ items:
45+ - const: core_clk
46+ - const: sclk_unipro_main
47+
48+ interrupts:
49+ maxItems: 1
50+
51+ phys:
52+ maxItems: 1
53+
54+ phy-names:
55+ const: ufs-phy
56+
57+required:
58+ - compatible
59+ - reg
60+ - interrupts
61+ - phys
62+ - phy-names
63+ - clocks
64+ - clock-names
65+
66+additionalProperties: false
67+
68+examples:
69+ - |
70+ #include <dt-bindings/interrupt-controller/arm-gic.h>
71+ #include <dt-bindings/clock/exynos7-clk.h>
72+
73+ ufs: ufs@15570000 {
74+ compatible = "samsung,exynos7-ufs";
75+ reg = <0x15570000 0x100>,
76+ <0x15570100 0x100>,
77+ <0x15571000 0x200>,
78+ <0x15572000 0x300>;
79+ reg-names = "hci", "vs_hci", "unipro", "ufsp";
80+ interrupts = <GIC_SPI 200 IRQ_TYPE_LEVEL_HIGH>;
81+ clocks = <&clock_fsys1 ACLK_UFS20_LINK>,
82+ <&clock_fsys1 SCLK_UFSUNIPRO20_USER>;
83+ clock-names = "core_clk", "sclk_unipro_main";
84+ pinctrl-names = "default";
85+ pinctrl-0 = <&ufs_rst_n &ufs_refclk_out>;
86+ phys = <&ufs_phy>;
87+ phy-names = "ufs-phy";
88+ };
89+...
Documentation/networking/device_drivers/ethernet/intel/ice.rst+1−1
@@ -851,7 +851,7 @@ NOTES: · 850 unmodified lines
851851 - 0x88A8 traffic will not be received unless VLAN stripping is disabled with
852852 the following command::
853853
854− # ethool -K <ethX> rxvlan off
854+ # ethtool -K <ethX> rxvlan off
855855
856856 - 0x88A8/0x8100 double VLANs cannot be used with 0x8100 or 0x8100/0x8100 VLANS
857857 configured on the same port. 0x88a8/0x8100 traffic will not be received if
Documentation/networking/dsa/sja1105.rst+1−1
@@ -296,7 +296,7 @@ not available. · 295 unmodified lines
296296 Device Tree bindings and board design
297297 =====================================
298298
299−This section references ``Documentation/devicetree/bindings/net/dsa/sja1105.txt``
299+This section references ``Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml``
300300 and aims to showcase some potential switch caveats.
301301
302302 RMII PHY role and out-of-band signaling
MAINTAINERS+11−11
@@ -2804,9 +2804,8 @@ F: arch/arm/mach-pxa/include/mach/vpac270.h · 2803 unmodified lines
28042804 F: arch/arm/mach-pxa/vpac270.c
28052805
28062806 ARM/VT8500 ARM ARCHITECTURE
2807−M: Tony Prisk <linux@prisktech.co.nz>
28082807 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
2809−S: Maintained
2808+S: Orphan
28102809 F: Documentation/devicetree/bindings/i2c/i2c-wmt.txt
28112810 F: arch/arm/mach-vt8500/
28122811 F: drivers/clocksource/timer-vt8500.c
@@ -13255,9 +13254,9 @@ F: Documentation/scsi/NinjaSCSI.rst · 10442 unmodified lines
1325513254 F: drivers/scsi/nsp32*
1325613255
1325713256 NIOS2 ARCHITECTURE
13258−M: Ley Foon Tan <ley.foon.tan@intel.com>
13257+M: Dinh Nguyen <dinguyen@kernel.org>
1325913258 S: Maintained
13260−T: git git://git.kernel.org/pub/scm/linux/kernel/git/lftan/nios2.git
13259+T: git git://git.kernel.org/pub/scm/linux/kernel/git/dinguyen/linux.git
1326113260 F: arch/nios2/
1326213261
1326313262 NITRO ENCLAVES (NE)
@@ -14342,7 +14341,8 @@ F: Documentation/devicetree/bindings/pci/intel,ixp4xx-pci.yaml · 1078 unmodified lines
1434214341 F: drivers/pci/controller/pci-ixp4xx.c
1434314342
1434414343 PCI DRIVER FOR INTEL VOLUME MANAGEMENT DEVICE (VMD)
14345−M: Jonathan Derrick <jonathan.derrick@intel.com>
14344+M: Nirmal Patel <nirmal.patel@linux.intel.com>
14345+R: Jonathan Derrick <jonathan.derrick@linux.dev>
1434614346 L: linux-pci@vger.kernel.org
1434714347 S: Supported
1434814348 F: drivers/pci/controller/vmd.c
@@ -16955,7 +16955,6 @@ F: drivers/misc/sgi-xp/ · 2606 unmodified lines
1695516955
1695616956 SHARED MEMORY COMMUNICATIONS (SMC) SOCKETS
1695716957 M: Karsten Graul <kgraul@linux.ibm.com>
16958−M: Guvenc Gulce <guvenc@linux.ibm.com>
1695916958 L: linux-s390@vger.kernel.org
1696016959 S: Supported
1696116960 W: http://www.ibm.com/developerworks/linux/linux390/
@@ -17968,10 +17967,11 @@ F: Documentation/admin-guide/svga.rst · 1006 unmodified lines
1796817967 F: arch/x86/boot/video*
1796917968
1797017969 SWIOTLB SUBSYSTEM
17971−M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
17970+M: Christoph Hellwig <hch@infradead.org>
1797217971 L: iommu@lists.linux-foundation.org
1797317972 S: Supported
17974−T: git git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb.git
17973+W: http://git.infradead.org/users/hch/dma-mapping.git
17974+T: git git://git.infradead.org/users/hch/dma-mapping.git
1797517975 F: arch/*/kernel/pci-swiotlb.c
1797617976 F: include/linux/swiotlb.h
1797717977 F: kernel/dma/swiotlb.c
@@ -20474,7 +20474,6 @@ F: samples/bpf/xdpsock* · 2496 unmodified lines
2047420474 F: tools/lib/bpf/xsk*
2047520475
2047620476 XEN BLOCK SUBSYSTEM
20477−M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
2047820477 M: Roger Pau Monné <roger.pau@citrix.com>
2047920478 L: xen-devel@lists.xenproject.org (moderated for non-subscribers)
2048020479 S: Supported
@@ -20522,7 +20521,7 @@ S: Supported · 41 unmodified lines
2052220521 F: drivers/net/xen-netback/*
2052320522
2052420523 XEN PCI SUBSYSTEM
20525−M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
20524+M: Juergen Gross <jgross@suse.com>
2052620525 L: xen-devel@lists.xenproject.org (moderated for non-subscribers)
2052720526 S: Supported
2052820527 F: arch/x86/pci/*xen*
@@ -20545,7 +20544,8 @@ S: Supported · 16 unmodified lines
2054520544 F: sound/xen/*
2054620545
2054720546 XEN SWIOTLB SUBSYSTEM
20548−M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
20547+M: Juergen Gross <jgross@suse.com>
20548+M: Stefano Stabellini <sstabellini@kernel.org>
2054920549 L: xen-devel@lists.xenproject.org (moderated for non-subscribers)
2055020550 L: iommu@lists.linux-foundation.org
2055120551 S: Supported
Makefile+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 VERSION = 5
33 PATCHLEVEL = 15
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc1
5+EXTRAVERSION = -rc2
66 NAME = Opossums on Parade
77
88 # *DOCUMENTATION*
arch/alpha/Kconfig+1−2
@@ -20,7 +20,7 @@ config ALPHA · 19 unmodified lines
2020 select NEED_SG_DMA_LENGTH
2121 select VIRT_TO_BUS
2222 select GENERIC_IRQ_PROBE
23− select GENERIC_PCI_IOMAP if PCI
23+ select GENERIC_PCI_IOMAP
2424 select AUTO_IRQ_AFFINITY if SMP
2525 select GENERIC_IRQ_SHOW
2626 select ARCH_WANT_IPC_PARSE_VERSION
@@ -199,7 +199,6 @@ config ALPHA_EIGER · 172 unmodified lines
199199
200200 config ALPHA_JENSEN
201201 bool "Jensen"
202− depends on BROKEN
203202 select HAVE_EISA
204203 help
205204 DEC PC 150 AXP (aka Jensen): This is a very old Digital system - one
arch/alpha/include/asm/asm-prototypes.h+1−0
@@ -16,3 +16,4 @@ extern void __divlu(void); · 15 unmodified lines
1616 extern void __remlu(void);
1717 extern void __divqu(void);
1818 extern void __remqu(void);
19+extern unsigned long __udiv_qrnnd(unsigned long *, unsigned long, unsigned long , unsigned long);
arch/alpha/include/asm/jensen.h+4−4
@@ -111,18 +111,18 @@ __EXTERN_INLINE void jensen_set_hae(unsigned long addr) · 110 unmodified lines
111111 * convinced that I need one of the newer machines.
112112 */
113113
114−static inline unsigned int jensen_local_inb(unsigned long addr)
114+__EXTERN_INLINE unsigned int jensen_local_inb(unsigned long addr)
115115 {
116116 return 0xff & *(vuip)((addr << 9) + EISA_VL82C106);
117117 }
118118
119−static inline void jensen_local_outb(u8 b, unsigned long addr)
119+__EXTERN_INLINE void jensen_local_outb(u8 b, unsigned long addr)
120120 {
121121 *(vuip)((addr << 9) + EISA_VL82C106) = b;
122122 mb();
123123 }
124124
125−static inline unsigned int jensen_bus_inb(unsigned long addr)
125+__EXTERN_INLINE unsigned int jensen_bus_inb(unsigned long addr)
126126 {
127127 long result;
128128
@@ -131,7 +131,7 @@ static inline unsigned int jensen_bus_inb(unsigned long addr) · 2 unmodified lines
131131 return __kernel_extbl(result, addr & 3);
132132 }
133133
134−static inline void jensen_bus_outb(u8 b, unsigned long addr)
134+__EXTERN_INLINE void jensen_bus_outb(u8 b, unsigned long addr)
135135 {
136136 jensen_set_hae(0);
137137 *(vuip)((addr << 7) + EISA_IO + 0x00) = b * 0x01010101;
arch/alpha/kernel/sys_jensen.c+5−5
@@ -7,6 +7,11 @@ · 6 unmodified lines
77 *
88 * Code supporting the Jensen.
99 */
10+#define __EXTERN_INLINE
11+#include <asm/io.h>
12+#include <asm/jensen.h>
13+#undef __EXTERN_INLINE
14+
1015 #include <linux/interrupt.h>
1116 #include <linux/kernel.h>
1217 #include <linux/types.h>
@@ -17,11 +22,6 @@ · 4 unmodified lines
1722
1823 #include <asm/ptrace.h>
1924
20−#define __EXTERN_INLINE inline
21−#include <asm/io.h>
22−#include <asm/jensen.h>
23−#undef __EXTERN_INLINE
24−
2525 #include <asm/dma.h>
2626 #include <asm/irq.h>
2727 #include <asm/mmu_context.h>
arch/alpha/lib/Makefile+1−0
@@ -14,6 +14,7 @@ ev6-$(CONFIG_ALPHA_EV6) := ev6- · 13 unmodified lines
1414 ev67-$(CONFIG_ALPHA_EV67) := ev67-
1515
1616 lib-y = __divqu.o __remqu.o __divlu.o __remlu.o \
17+ udiv-qrnnd.o \
1718 udelay.o \
1819 $(ev6-y)memset.o \
1920 $(ev6-y)memcpy.o \
arch/alpha/lib/udiv-qrnnd.Srenamed from arch/alpha/math-emu/qrnnd.S+2−0
@@ -25,6 +25,7 @@ · 24 unmodified lines
2525 # along with GCC; see the file COPYING. If not, write to the
2626 # Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
2727 # MA 02111-1307, USA.
28+#include <asm/export.h>
2829
2930 .set noreorder
3031 .set noat
@@ -161,3 +162,4 @@ $Odd: · 130 unmodified lines
161162 ret $31,($26),1
162163
163164 .end __udiv_qrnnd
165+EXPORT_SYMBOL(__udiv_qrnnd)
arch/alpha/math-emu/Makefile+1−1
@@ -7,4 +7,4 @@ ccflags-y := -w · 6 unmodified lines
77
88 obj-$(CONFIG_MATHEMU) += math-emu.o
99
10−math-emu-objs := math.o qrnnd.o
10+math-emu-objs := math.o
arch/alpha/math-emu/math.c+0−2
@@ -403,5 +403,3 @@ alpha_fp_emul_imprecise (struct pt_regs *regs, unsigned long write_mask) · 402 unmodified lines
403403 egress:
404404 return si_code;
405405 }
406−
407−EXPORT_SYMBOL(__udiv_qrnnd);
arch/arm64/kernel/fpsimd.c+1−1
@@ -513,7 +513,7 @@ size_t sve_state_size(struct task_struct const *task) · 512 unmodified lines
513513 void sve_alloc(struct task_struct *task)
514514 {
515515 if (task->thread.sve_state) {
516− memset(task->thread.sve_state, 0, sve_state_size(current));
516+ memset(task->thread.sve_state, 0, sve_state_size(task));
517517 return;
518518 }
519519
arch/arm64/kernel/process.c+1−2
@@ -18,7 +18,6 @@ · 17 unmodified lines
1818 #include <linux/mman.h>
1919 #include <linux/mm.h>
2020 #include <linux/nospec.h>
21−#include <linux/sched.h>
2221 #include <linux/stddef.h>
2322 #include <linux/sysctl.h>
2423 #include <linux/unistd.h>
@@ -58,7 +57,7 @@ · 33 unmodified lines
5857
5958 #if defined(CONFIG_STACKPROTECTOR) && !defined(CONFIG_STACKPROTECTOR_PER_TASK)
6059 #include <linux/stackprotector.h>
61−unsigned long __stack_chk_guard __read_mostly;
60+unsigned long __stack_chk_guard __ro_after_init;
6261 EXPORT_SYMBOL(__stack_chk_guard);
6362 #endif
6463
arch/parisc/lib/iomap.c+3−1
@@ -513,12 +513,15 @@ void ioport_unmap(void __iomem *addr) · 512 unmodified lines
513513 }
514514 }
515515
516+#ifdef CONFIG_PCI
516517 void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
517518 {
518519 if (!INDIRECT_ADDR(addr)) {
519520 iounmap(addr);
520521 }
521522 }
523+EXPORT_SYMBOL(pci_iounmap);
524+#endif
522525
523526 EXPORT_SYMBOL(ioread8);
524527 EXPORT_SYMBOL(ioread16);
@@ -544,4 +547,3 @@ EXPORT_SYMBOL(iowrite16_rep); · 19 unmodified lines
544547 EXPORT_SYMBOL(iowrite32_rep);
545548 EXPORT_SYMBOL(ioport_map);
546549 EXPORT_SYMBOL(ioport_unmap);
547−EXPORT_SYMBOL(pci_iounmap);
arch/powerpc/kernel/interrupt.c+43−0
@@ -18,6 +18,7 @@ · 17 unmodified lines
1818 #include <asm/switch_to.h>
1919 #include <asm/syscall.h>
2020 #include <asm/time.h>
21+#include <asm/tm.h>
2122 #include <asm/unistd.h>
2223
2324 #if defined(CONFIG_PPC_ADV_DEBUG_REGS) && defined(CONFIG_PPC32)
@@ -136,6 +137,48 @@ notrace long system_call_exception(long r3, long r4, long r5, · 112 unmodified lines
136137 */
137138 irq_soft_mask_regs_set_state(regs, IRQS_ENABLED);
138139
140+ /*
141+ * If system call is called with TM active, set _TIF_RESTOREALL to
142+ * prevent RFSCV being used to return to userspace, because POWER9
143+ * TM implementation has problems with this instruction returning to
144+ * transactional state. Final register values are not relevant because
145+ * the transaction will be aborted upon return anyway. Or in the case
146+ * of unsupported_scv SIGILL fault, the return state does not much
147+ * matter because it's an edge case.
148+ */
149+ if (IS_ENABLED(CONFIG_PPC_TRANSACTIONAL_MEM) &&
150+ unlikely(MSR_TM_TRANSACTIONAL(regs->msr)))
151+ current_thread_info()->flags |= _TIF_RESTOREALL;
152+
153+ /*
154+ * If the system call was made with a transaction active, doom it and
155+ * return without performing the system call. Unless it was an
156+ * unsupported scv vector, in which case it's treated like an illegal
157+ * instruction.
158+ */
159+#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
160+ if (unlikely(MSR_TM_TRANSACTIONAL(regs->msr)) &&
161+ !trap_is_unsupported_scv(regs)) {
162+ /* Enable TM in the kernel, and disable EE (for scv) */
163+ hard_irq_disable();
164+ mtmsr(mfmsr() | MSR_TM);
165+
166+ /* tabort, this dooms the transaction, nothing else */
167+ asm volatile(".long 0x7c00071d | ((%0) << 16)"
168+ :: "r"(TM_CAUSE_SYSCALL|TM_CAUSE_PERSISTENT));
169+
170+ /*
171+ * Userspace will never see the return value. Execution will
172+ * resume after the tbegin. of the aborted transaction with the
173+ * checkpointed register state. A context switch could occur
174+ * or signal delivered to the process before resuming the
175+ * doomed transaction context, but that should all be handled
176+ * as expected.
177+ */
178+ return -ENOSYS;
179+ }
180+#endif // CONFIG_PPC_TRANSACTIONAL_MEM
181+
139182 local_irq_enable();
140183
141184 if (unlikely(current_thread_info()->flags & _TIF_SYSCALL_DOTRACE)) {
arch/powerpc/kernel/interrupt_64.S+0−41
@@ -12,7 +12,6 @@ · 11 unmodified lines
1212 #include <asm/mmu.h>
1313 #include <asm/ppc_asm.h>
1414 #include <asm/ptrace.h>
15−#include <asm/tm.h>
1615
1716 .section ".toc","aw"
1817 SYS_CALL_TABLE:
@@ -55,12 +54,6 @@ COMPAT_SYS_CALL_TABLE: · 36 unmodified lines
5554 .globl system_call_vectored_\name
5655 system_call_vectored_\name:
5756 _ASM_NOKPROBE_SYMBOL(system_call_vectored_\name)
58−#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
59−BEGIN_FTR_SECTION
60− extrdi. r10, r12, 1, (63-MSR_TS_T_LG) /* transaction active? */
61− bne tabort_syscall
62−END_FTR_SECTION_IFSET(CPU_FTR_TM)
63−#endif
6457 SCV_INTERRUPT_TO_KERNEL
6558 mr r10,r1
6659 ld r1,PACAKSAVE(r13)
@@ -247,12 +240,6 @@ _ASM_NOKPROBE_SYMBOL(system_call_common_real) · 180 unmodified lines
247240 .globl system_call_common
248241 system_call_common:
249242 _ASM_NOKPROBE_SYMBOL(system_call_common)
250−#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
251−BEGIN_FTR_SECTION
252− extrdi. r10, r12, 1, (63-MSR_TS_T_LG) /* transaction active? */
253− bne tabort_syscall
254−END_FTR_SECTION_IFSET(CPU_FTR_TM)
255−#endif
256243 mr r10,r1
257244 ld r1,PACAKSAVE(r13)
258245 std r10,0(r1)
@@ -425,34 +412,6 @@ SOFT_MASK_TABLE(.Lsyscall_rst_start, 1b) · 166 unmodified lines
425412 RESTART_TABLE(.Lsyscall_rst_start, .Lsyscall_rst_end, syscall_restart)
426413 #endif
427414
428−#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
429−tabort_syscall:
430−_ASM_NOKPROBE_SYMBOL(tabort_syscall)
431− /* Firstly we need to enable TM in the kernel */
432− mfmsr r10
433− li r9, 1
434− rldimi r10, r9, MSR_TM_LG, 63-MSR_TM_LG
435− mtmsrd r10, 0
436−
437− /* tabort, this dooms the transaction, nothing else */
438− li r9, (TM_CAUSE_SYSCALL|TM_CAUSE_PERSISTENT)
439− TABORT(R9)
440−
441− /*
442− * Return directly to userspace. We have corrupted user register state,
443− * but userspace will never see that register state. Execution will
444− * resume after the tbegin of the aborted transaction with the
445− * checkpointed register state.
446− */
447− li r9, MSR_RI
448− andc r10, r10, r9
449− mtmsrd r10, 1
450− mtspr SPRN_SRR0, r11
451− mtspr SPRN_SRR1, r12
452− RFI_TO_USER
453− b . /* prevent speculative execution */
454−#endif
455−
456415 /*
457416 * If MSR EE/RI was never enabled, IRQs not reconciled, NVGPRs not
458417 * touched, no exit work created, then this can be used.
arch/powerpc/kernel/mce.c+15−2
@@ -249,6 +249,7 @@ void machine_check_queue_event(void) · 248 unmodified lines
249249 {
250250 int index;
251251 struct machine_check_event evt;
252+ unsigned long msr;
252253
253254 if (!get_mce_event(&evt, MCE_EVENT_RELEASE))
254255 return;
@@ -262,8 +263,20 @@ void machine_check_queue_event(void) · 7 unmodified lines
262263 memcpy(&local_paca->mce_info->mce_event_queue[index],
263264 &evt, sizeof(evt));
264265
265− /* Queue irq work to process this event later. */
266− irq_work_queue(&mce_event_process_work);
266+ /*
267+ * Queue irq work to process this event later. Before
268+ * queuing the work enable translation for non radix LPAR,
269+ * as irq_work_queue may try to access memory outside RMO
270+ * region.
271+ */
272+ if (!radix_enabled() && firmware_has_feature(FW_FEATURE_LPAR)) {
273+ msr = mfmsr();
274+ mtmsr(msr | MSR_IR | MSR_DR);
275+ irq_work_queue(&mce_event_process_work);
276+ mtmsr(msr);
277+ } else {
278+ irq_work_queue(&mce_event_process_work);
279+ }
267280 }
268281
269282 void mce_common_process_ue(struct pt_regs *regs,
arch/powerpc/kvm/book3s_hv_rmhandlers.S+34−2
@@ -2536,7 +2536,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_P9_TM_HV_ASSIST) · 2535 unmodified lines
25362536 /* The following code handles the fake_suspend = 1 case */
25372537 mflr r0
25382538 std r0, PPC_LR_STKOFF(r1)
2539− stdu r1, -PPC_MIN_STKFRM(r1)
2539+ stdu r1, -TM_FRAME_SIZE(r1)
25402540
25412541 /* Turn on TM. */
25422542 mfmsr r8
@@ -2551,10 +2551,42 @@ BEGIN_FTR_SECTION · 8 unmodified lines
25512551 END_FTR_SECTION_IFSET(CPU_FTR_P9_TM_XER_SO_BUG)
25522552 nop
25532553
2554+ /*
2555+ * It's possible that treclaim. may modify registers, if we have lost
2556+ * track of fake-suspend state in the guest due to it using rfscv.
2557+ * Save and restore registers in case this occurs.
2558+ */
2559+ mfspr r3, SPRN_DSCR
2560+ mfspr r4, SPRN_XER
2561+ mfspr r5, SPRN_AMR
2562+ /* SPRN_TAR would need to be saved here if the kernel ever used it */
2563+ mfcr r12
2564+ SAVE_NVGPRS(r1)
2565+ SAVE_GPR(2, r1)
2566+ SAVE_GPR(3, r1)
2567+ SAVE_GPR(4, r1)
2568+ SAVE_GPR(5, r1)
2569+ stw r12, 8(r1)
2570+ std r1, HSTATE_HOST_R1(r13)
2571+
25542572 /* We have to treclaim here because that's the only way to do S->N */
25552573 li r3, TM_CAUSE_KVM_RESCHED
25562574 TRECLAIM(R3)
25572575
2576+ GET_PACA(r13)
2577+ ld r1, HSTATE_HOST_R1(r13)
2578+ REST_GPR(2, r1)
2579+ REST_GPR(3, r1)
2580+ REST_GPR(4, r1)
2581+ REST_GPR(5, r1)
2582+ lwz r12, 8(r1)
2583+ REST_NVGPRS(r1)
2584+ mtspr SPRN_DSCR, r3
2585+ mtspr SPRN_XER, r4
2586+ mtspr SPRN_AMR, r5
2587+ mtcr r12
2588+ HMT_MEDIUM
2589+
25582590 /*
25592591 * We were in fake suspend, so we are not going to save the
25602592 * register state as the guest checkpointed state (since
@@ -2582,7 +2614,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_P9_TM_XER_SO_BUG) · 21 unmodified lines
25822614 std r5, VCPU_TFHAR(r9)
25832615 std r6, VCPU_TFIAR(r9)
25842616
2585− addi r1, r1, PPC_MIN_STKFRM
2617+ addi r1, r1, TM_FRAME_SIZE
25862618 ld r0, PPC_LR_STKOFF(r1)
25872619 mtlr r0
25882620 blr
arch/powerpc/sysdev/xics/xics-common.c+2−2
@@ -348,9 +348,9 @@ static int xics_host_map(struct irq_domain *domain, unsigned int virq, · 347 unmodified lines
348348 if (xics_ics->check(xics_ics, hwirq))
349349 return -EINVAL;
350350
351− /* No chip data for the XICS domain */
351+ /* Let the ICS be the chip data for the XICS domain. For ICS native */
352352 irq_domain_set_info(domain, virq, hwirq, xics_ics->chip,
353− NULL, handle_fasteoi_irq, NULL, NULL);
353+ xics_ics, handle_fasteoi_irq, NULL, NULL);
354354
355355 return 0;
356356 }
arch/s390/Kconfig+0−10
@@ -685,16 +685,6 @@ config STACK_GUARD · 684 unmodified lines
685685 The minimum size for the stack guard should be 256 for 31 bit and
686686 512 for 64 bit.
687687
688−config WARN_DYNAMIC_STACK
689− def_bool n
690− prompt "Emit compiler warnings for function with dynamic stack usage"
691− help
692− This option enables the compiler option -mwarn-dynamicstack. If the
693− compiler supports this options generates warnings for functions
694− that dynamically allocate stack space using alloca.
695−
696− Say N if you are unsure.
697−
698688 endmenu
699689
700690 menu "I/O subsystem"
arch/s390/Makefile+0−7
@@ -85,13 +85,6 @@ cflags-$(CONFIG_CHECK_STACK) += -mstack-guard=$(CONFIG_STACK_GUARD) · 84 unmodified lines
8585 endif
8686 endif
8787
88−ifdef CONFIG_WARN_DYNAMIC_STACK
89− ifneq ($(call cc-option,-mwarn-dynamicstack),)
90− KBUILD_CFLAGS += -mwarn-dynamicstack
91− KBUILD_CFLAGS_DECOMPRESSOR += -mwarn-dynamicstack
92− endif
93−endif
94−
9588 ifdef CONFIG_EXPOLINE
9689 ifneq ($(call cc-option,$(CC_FLAGS_MARCH) -mindirect-branch=thunk),)
9790 CC_FLAGS_EXPOLINE := -mindirect-branch=thunk
arch/s390/configs/debug_defconfig+5−3
@@ -10,6 +10,7 @@ CONFIG_BPF_JIT=y · 9 unmodified lines
1010 CONFIG_BPF_JIT_ALWAYS_ON=y
1111 CONFIG_BPF_LSM=y
1212 CONFIG_PREEMPT=y
13+CONFIG_SCHED_CORE=y
1314 CONFIG_BSD_PROCESS_ACCT=y
1415 CONFIG_BSD_PROCESS_ACCT_V3=y
1516 CONFIG_TASKSTATS=y
@@ -503,6 +504,7 @@ CONFIG_NLMON=m · 487 unmodified lines
503504 # CONFIG_NET_VENDOR_HUAWEI is not set
504505 # CONFIG_NET_VENDOR_INTEL is not set
505506 # CONFIG_NET_VENDOR_MICROSOFT is not set
507+# CONFIG_NET_VENDOR_LITEX is not set
506508 # CONFIG_NET_VENDOR_MARVELL is not set
507509 CONFIG_MLX4_EN=m
508510 CONFIG_MLX5_CORE=m
@@ -661,7 +663,6 @@ CONFIG_NFSD_V3_ACL=y · 152 unmodified lines
661663 CONFIG_NFSD_V4=y
662664 CONFIG_NFSD_V4_SECURITY_LABEL=y
663665 CONFIG_CIFS=m
664−CONFIG_CIFS_WEAK_PW_HASH=y
665666 CONFIG_CIFS_UPCALL=y
666667 CONFIG_CIFS_XATTR=y
667668 CONFIG_CIFS_POSIX=y
@@ -720,6 +721,8 @@ CONFIG_CRYPTO_XCBC=m · 52 unmodified lines
720721 CONFIG_CRYPTO_VMAC=m
721722 CONFIG_CRYPTO_CRC32=m
722723 CONFIG_CRYPTO_BLAKE2S=m
724+CONFIG_CRYPTO_MD4=m
725+CONFIG_CRYPTO_MD5=y
723726 CONFIG_CRYPTO_MICHAEL_MIC=m
724727 CONFIG_CRYPTO_RMD160=m
725728 CONFIG_CRYPTO_SHA3=m
@@ -774,7 +777,6 @@ CONFIG_RANDOM32_SELFTEST=y · 48 unmodified lines
774777 CONFIG_DMA_CMA=y
775778 CONFIG_CMA_SIZE_MBYTES=0
776779 CONFIG_DMA_API_DEBUG=y
777−CONFIG_STRING_SELFTEST=y
778780 CONFIG_PRINTK_TIME=y
779781 CONFIG_DYNAMIC_DEBUG=y
780782 CONFIG_DEBUG_INFO=y
@@ -853,12 +855,12 @@ CONFIG_FAIL_FUNCTION=y · 72 unmodified lines
853855 CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y
854856 CONFIG_LKDTM=m
855857 CONFIG_TEST_MIN_HEAP=y
856−CONFIG_TEST_SORT=y
857858 CONFIG_KPROBES_SANITY_TEST=y
858859 CONFIG_RBTREE_TEST=y
859860 CONFIG_INTERVAL_TREE_TEST=m
860861 CONFIG_PERCPU_TEST=m
861862 CONFIG_ATOMIC64_SELFTEST=y
863+CONFIG_STRING_SELFTEST=y
862864 CONFIG_TEST_BITOPS=m
863865 CONFIG_TEST_BPF=m
864866 CONFIG_TEST_LIVEPATCH=m
arch/s390/configs/defconfig+4−1
@@ -8,6 +8,7 @@ CONFIG_BPF_SYSCALL=y · 7 unmodified lines
88 CONFIG_BPF_JIT=y
99 CONFIG_BPF_JIT_ALWAYS_ON=y
1010 CONFIG_BPF_LSM=y
11+CONFIG_SCHED_CORE=y
1112 CONFIG_BSD_PROCESS_ACCT=y
1213 CONFIG_BSD_PROCESS_ACCT_V3=y
1314 CONFIG_TASKSTATS=y
@@ -494,6 +495,7 @@ CONFIG_NLMON=m · 480 unmodified lines
494495 # CONFIG_NET_VENDOR_HUAWEI is not set
495496 # CONFIG_NET_VENDOR_INTEL is not set
496497 # CONFIG_NET_VENDOR_MICROSOFT is not set
498+# CONFIG_NET_VENDOR_LITEX is not set
497499 # CONFIG_NET_VENDOR_MARVELL is not set
498500 CONFIG_MLX4_EN=m
499501 CONFIG_MLX5_CORE=m
@@ -648,7 +650,6 @@ CONFIG_NFSD_V3_ACL=y · 148 unmodified lines
648650 CONFIG_NFSD_V4=y
649651 CONFIG_NFSD_V4_SECURITY_LABEL=y
650652 CONFIG_CIFS=m
651−CONFIG_CIFS_WEAK_PW_HASH=y
652653 CONFIG_CIFS_UPCALL=y
653654 CONFIG_CIFS_XATTR=y
654655 CONFIG_CIFS_POSIX=y
@@ -708,6 +709,8 @@ CONFIG_CRYPTO_XCBC=m · 53 unmodified lines
708709 CONFIG_CRYPTO_VMAC=m
709710 CONFIG_CRYPTO_CRC32=m
710711 CONFIG_CRYPTO_BLAKE2S=m
712+CONFIG_CRYPTO_MD4=m
713+CONFIG_CRYPTO_MD5=y
711714 CONFIG_CRYPTO_MICHAEL_MIC=m
712715 CONFIG_CRYPTO_RMD160=m
713716 CONFIG_CRYPTO_SHA3=m
arch/s390/include/asm/ccwgroup.h+1−1
@@ -55,7 +55,7 @@ int ccwgroup_create_dev(struct device *root, struct ccwgroup_driver *gdrv, · 54 unmodified lines
5555 int num_devices, const char *buf);
5656
5757 extern int ccwgroup_set_online(struct ccwgroup_device *gdev);
58−extern int ccwgroup_set_offline(struct ccwgroup_device *gdev);
58+int ccwgroup_set_offline(struct ccwgroup_device *gdev, bool call_gdrv);
5959
6060 extern int ccwgroup_probe_ccwdev(struct ccw_device *cdev);
6161 extern void ccwgroup_remove_ccwdev(struct ccw_device *cdev);
arch/s390/net/bpf_jit_comp.c+38−32
@@ -248,8 +248,7 @@ static inline void reg_set_seen(struct bpf_jit *jit, u32 b1) · 247 unmodified lines
248248
249249 #define EMIT6_PCREL(op1, op2, b1, b2, i, off, mask) \
250250 ({ \
251− /* Branch instruction needs 6 bytes */ \
252− int rel = (addrs[(i) + (off) + 1] - (addrs[(i) + 1] - 6)) / 2;\
251+ int rel = (addrs[(i) + (off) + 1] - jit->prg) / 2; \
253252 _EMIT6((op1) | reg(b1, b2) << 16 | (rel & 0xffff), (op2) | (mask));\
254253 REG_SET_SEEN(b1); \
255254 REG_SET_SEEN(b2); \
@@ -761,10 +760,10 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, · 505 unmodified lines
761760 EMIT4(0xb9080000, dst_reg, src_reg);
762761 break;
763762 case BPF_ALU | BPF_ADD | BPF_K: /* dst = (u32) dst + (u32) imm */
764− if (!imm)
765− break;
766− /* alfi %dst,imm */
767− EMIT6_IMM(0xc20b0000, dst_reg, imm);
763+ if (imm != 0) {
764+ /* alfi %dst,imm */
765+ EMIT6_IMM(0xc20b0000, dst_reg, imm);
766+ }
768767 EMIT_ZERO(dst_reg);
769768 break;
770769 case BPF_ALU64 | BPF_ADD | BPF_K: /* dst = dst + imm */
@@ -786,17 +785,22 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, · 15 unmodified lines
786785 EMIT4(0xb9090000, dst_reg, src_reg);
787786 break;
788787 case BPF_ALU | BPF_SUB | BPF_K: /* dst = (u32) dst - (u32) imm */
789− if (!imm)
790− break;
791− /* alfi %dst,-imm */
792− EMIT6_IMM(0xc20b0000, dst_reg, -imm);
788+ if (imm != 0) {
789+ /* alfi %dst,-imm */
790+ EMIT6_IMM(0xc20b0000, dst_reg, -imm);
791+ }
793792 EMIT_ZERO(dst_reg);
794793 break;
795794 case BPF_ALU64 | BPF_SUB | BPF_K: /* dst = dst - imm */
796795 if (!imm)
797796 break;
798− /* agfi %dst,-imm */
799− EMIT6_IMM(0xc2080000, dst_reg, -imm);
797+ if (imm == -0x80000000) {
798+ /* algfi %dst,0x80000000 */
799+ EMIT6_IMM(0xc20a0000, dst_reg, 0x80000000);
800+ } else {
801+ /* agfi %dst,-imm */
802+ EMIT6_IMM(0xc2080000, dst_reg, -imm);
803+ }
800804 break;
801805 /*
802806 * BPF_MUL
@@ -811,10 +815,10 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, · 8 unmodified lines
811815 EMIT4(0xb90c0000, dst_reg, src_reg);
812816 break;
813817 case BPF_ALU | BPF_MUL | BPF_K: /* dst = (u32) dst * (u32) imm */
814− if (imm == 1)
815− break;
816− /* msfi %r5,imm */
817− EMIT6_IMM(0xc2010000, dst_reg, imm);
818+ if (imm != 1) {
819+ /* msfi %r5,imm */
820+ EMIT6_IMM(0xc2010000, dst_reg, imm);
821+ }
818822 EMIT_ZERO(dst_reg);
819823 break;
820824 case BPF_ALU64 | BPF_MUL | BPF_K: /* dst = dst * imm */
@@ -867,6 +871,8 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, · 46 unmodified lines
867871 if (BPF_OP(insn->code) == BPF_MOD)
868872 /* lhgi %dst,0 */
869873 EMIT4_IMM(0xa7090000, dst_reg, 0);
874+ else
875+ EMIT_ZERO(dst_reg);
870876 break;
871877 }
872878 /* lhi %w0,0 */
@@ -999,10 +1005,10 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, · 126 unmodified lines
9991005 EMIT4(0xb9820000, dst_reg, src_reg);
10001006 break;
10011007 case BPF_ALU | BPF_XOR | BPF_K: /* dst = (u32) dst ^ (u32) imm */
1002− if (!imm)
1003− break;
1004− /* xilf %dst,imm */
1005− EMIT6_IMM(0xc0070000, dst_reg, imm);
1008+ if (imm != 0) {
1009+ /* xilf %dst,imm */
1010+ EMIT6_IMM(0xc0070000, dst_reg, imm);
1011+ }
10061012 EMIT_ZERO(dst_reg);
10071013 break;
10081014 case BPF_ALU64 | BPF_XOR | BPF_K: /* dst = dst ^ imm */
@@ -1033,10 +1039,10 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, · 24 unmodified lines
10331039 EMIT6_DISP_LH(0xeb000000, 0x000d, dst_reg, dst_reg, src_reg, 0);
10341040 break;
10351041 case BPF_ALU | BPF_LSH | BPF_K: /* dst = (u32) dst << (u32) imm */
1036− if (imm == 0)
1037− break;
1038− /* sll %dst,imm(%r0) */
1039− EMIT4_DISP(0x89000000, dst_reg, REG_0, imm);
1042+ if (imm != 0) {
1043+ /* sll %dst,imm(%r0) */
1044+ EMIT4_DISP(0x89000000, dst_reg, REG_0, imm);
1045+ }
10401046 EMIT_ZERO(dst_reg);
10411047 break;
10421048 case BPF_ALU64 | BPF_LSH | BPF_K: /* dst = dst << imm */
@@ -1058,10 +1064,10 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, · 15 unmodified lines
10581064 EMIT6_DISP_LH(0xeb000000, 0x000c, dst_reg, dst_reg, src_reg, 0);
10591065 break;
10601066 case BPF_ALU | BPF_RSH | BPF_K: /* dst = (u32) dst >> (u32) imm */
1061− if (imm == 0)
1062− break;
1063− /* srl %dst,imm(%r0) */
1064− EMIT4_DISP(0x88000000, dst_reg, REG_0, imm);
1067+ if (imm != 0) {
1068+ /* srl %dst,imm(%r0) */
1069+ EMIT4_DISP(0x88000000, dst_reg, REG_0, imm);
1070+ }
10651071 EMIT_ZERO(dst_reg);
10661072 break;
10671073 case BPF_ALU64 | BPF_RSH | BPF_K: /* dst = dst >> imm */
@@ -1083,10 +1089,10 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, · 15 unmodified lines
10831089 EMIT6_DISP_LH(0xeb000000, 0x000a, dst_reg, dst_reg, src_reg, 0);
10841090 break;
10851091 case BPF_ALU | BPF_ARSH | BPF_K: /* ((s32) dst >> imm */
1086− if (imm == 0)
1087− break;
1088− /* sra %dst,imm(%r0) */
1089− EMIT4_DISP(0x8a000000, dst_reg, REG_0, imm);
1092+ if (imm != 0) {
1093+ /* sra %dst,imm(%r0) */
1094+ EMIT4_DISP(0x8a000000, dst_reg, REG_0, imm);
1095+ }
10901096 EMIT_ZERO(dst_reg);
10911097 break;
10921098 case BPF_ALU64 | BPF_ARSH | BPF_K: /* ((s64) dst) >>= imm */
arch/s390/pci/pci_mmio.c+2−2
@@ -159,7 +159,7 @@ SYSCALL_DEFINE3(s390_pci_mmio_write, unsigned long, mmio_addr, · 158 unmodified lines
159159
160160 mmap_read_lock(current->mm);
161161 ret = -EINVAL;
162− vma = find_vma(current->mm, mmio_addr);
162+ vma = vma_lookup(current->mm, mmio_addr);
163163 if (!vma)
164164 goto out_unlock_mmap;
165165 if (!(vma->vm_flags & (VM_IO | VM_PFNMAP)))
@@ -298,7 +298,7 @@ SYSCALL_DEFINE3(s390_pci_mmio_read, unsigned long, mmio_addr, · 132 unmodified lines
298298
299299 mmap_read_lock(current->mm);
300300 ret = -EINVAL;
301− vma = find_vma(current->mm, mmio_addr);
301+ vma = vma_lookup(current->mm, mmio_addr);
302302 if (!vma)
303303 goto out_unlock_mmap;
304304 if (!(vma->vm_flags & (VM_IO | VM_PFNMAP)))
arch/sh/boot/Makefile+8−8
@@ -80,30 +80,30 @@ $(obj)/vmlinux.bin.xz: $(obj)/vmlinux.bin FORCE · 79 unmodified lines
8080 $(obj)/vmlinux.bin.lzo: $(obj)/vmlinux.bin FORCE
8181 $(call if_changed,lzo)
8282
83−$(obj)/uImage.bz2: $(obj)/vmlinux.bin.bz2
83+$(obj)/uImage.bz2: $(obj)/vmlinux.bin.bz2 FORCE
8484 $(call if_changed,uimage,bzip2)
8585
86−$(obj)/uImage.gz: $(obj)/vmlinux.bin.gz
86+$(obj)/uImage.gz: $(obj)/vmlinux.bin.gz FORCE
8787 $(call if_changed,uimage,gzip)
8888
89−$(obj)/uImage.lzma: $(obj)/vmlinux.bin.lzma
89+$(obj)/uImage.lzma: $(obj)/vmlinux.bin.lzma FORCE
9090 $(call if_changed,uimage,lzma)
9191
92−$(obj)/uImage.xz: $(obj)/vmlinux.bin.xz
92+$(obj)/uImage.xz: $(obj)/vmlinux.bin.xz FORCE
9393 $(call if_changed,uimage,xz)
9494
95−$(obj)/uImage.lzo: $(obj)/vmlinux.bin.lzo
95+$(obj)/uImage.lzo: $(obj)/vmlinux.bin.lzo FORCE
9696 $(call if_changed,uimage,lzo)
9797
98−$(obj)/uImage.bin: $(obj)/vmlinux.bin
98+$(obj)/uImage.bin: $(obj)/vmlinux.bin FORCE
9999 $(call if_changed,uimage,none)
100100
101101 OBJCOPYFLAGS_vmlinux.srec := -I binary -O srec
102−$(obj)/vmlinux.srec: $(obj)/compressed/vmlinux
102+$(obj)/vmlinux.srec: $(obj)/compressed/vmlinux FORCE
103103 $(call if_changed,objcopy)
104104
105105 OBJCOPYFLAGS_uImage.srec := -I binary -O srec
106−$(obj)/uImage.srec: $(obj)/uImage
106+$(obj)/uImage.srec: $(obj)/uImage FORCE
107107 $(call if_changed,objcopy)
108108
109109 $(obj)/uImage: $(obj)/uImage.$(suffix-y)
arch/sparc/kernel/ioport.c+3−1
@@ -356,7 +356,9 @@ err_nomem: · 355 unmodified lines
356356 void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
357357 dma_addr_t dma_addr, unsigned long attrs)
358358 {
359− if (!sparc_dma_free_resource(cpu_addr, PAGE_ALIGN(size)))
359+ size = PAGE_ALIGN(size);
360+
361+ if (!sparc_dma_free_resource(cpu_addr, size))
360362 return;
361363
362364 dma_make_coherent(dma_addr, size);
arch/sparc/lib/iomap.c+2−0
@@ -19,8 +19,10 @@ void ioport_unmap(void __iomem *addr) · 18 unmodified lines
1919 EXPORT_SYMBOL(ioport_map);
2020 EXPORT_SYMBOL(ioport_unmap);
2121
22+#ifdef CONFIG_PCI
2223 void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
2324 {
2425 /* nothing to do */
2526 }
2627 EXPORT_SYMBOL(pci_iounmap);
28+#endif
arch/x86/Kconfig+5−0
@@ -339,6 +339,11 @@ config NEED_PER_CPU_PAGE_FIRST_CHUNK · 338 unmodified lines
339339 config ARCH_HIBERNATION_POSSIBLE
340340 def_bool y
341341
342+config ARCH_NR_GPIO
343+ int
344+ default 1024 if X86_64
345+ default 512
346+
342347 config ARCH_SUSPEND_POSSIBLE
343348 def_bool y
344349
arch/x86/Makefile_32.cpu+9−3
@@ -4,6 +4,12 @@ · 3 unmodified lines
44
55 tune = $(call cc-option,-mtune=$(1),$(2))
66
7+ifdef CONFIG_CC_IS_CLANG
8+align := -falign-functions=0 $(call cc-option,-falign-jumps=0) $(call cc-option,-falign-loops=0)
9+else
10+align := -falign-functions=0 -falign-jumps=0 -falign-loops=0
11+endif
12+
713 cflags-$(CONFIG_M486SX) += -march=i486
814 cflags-$(CONFIG_M486) += -march=i486
915 cflags-$(CONFIG_M586) += -march=i586
@@ -19,11 +25,11 @@ cflags-$(CONFIG_MK6) += -march=k6 · 9 unmodified lines
1925 # They make zero difference whatsosever to performance at this time.
2026 cflags-$(CONFIG_MK7) += -march=athlon
2127 cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8,-march=athlon)
22−cflags-$(CONFIG_MCRUSOE) += -march=i686 -falign-functions=0 -falign-jumps=0 -falign-loops=0
23−cflags-$(CONFIG_MEFFICEON) += -march=i686 $(call tune,pentium3) -falign-functions=0 -falign-jumps=0 -falign-loops=0
28+cflags-$(CONFIG_MCRUSOE) += -march=i686 $(align)
29+cflags-$(CONFIG_MEFFICEON) += -march=i686 $(call tune,pentium3) $(align)
2430 cflags-$(CONFIG_MWINCHIPC6) += $(call cc-option,-march=winchip-c6,-march=i586)
2531 cflags-$(CONFIG_MWINCHIP3D) += $(call cc-option,-march=winchip2,-march=i586)
26−cflags-$(CONFIG_MCYRIXIII) += $(call cc-option,-march=c3,-march=i486) -falign-functions=0 -falign-jumps=0 -falign-loops=0
32+cflags-$(CONFIG_MCYRIXIII) += $(call cc-option,-march=c3,-march=i486) $(align)
2733 cflags-$(CONFIG_MVIAC3_2) += $(call cc-option,-march=c3-2,-march=i686)
2834 cflags-$(CONFIG_MVIAC7) += -march=i686
2935 cflags-$(CONFIG_MCORE2) += -march=i686 $(call tune,core2)
arch/x86/kernel/cpu/mce/core.c+32−11
@@ -1253,6 +1253,9 @@ static void __mc_scan_banks(struct mce *m, struct pt_regs *regs, struct mce *fin · 1252 unmodified lines
12531253
12541254 static void kill_me_now(struct callback_head *ch)
12551255 {
1256+ struct task_struct *p = container_of(ch, struct task_struct, mce_kill_me);
1257+
1258+ p->mce_count = 0;
12561259 force_sig(SIGBUS);
12571260 }
12581261
@@ -1262,6 +1265,7 @@ static void kill_me_maybe(struct callback_head *cb) · 3 unmodified lines
12621265 int flags = MF_ACTION_REQUIRED;
12631266 int ret;
12641267
1268+ p->mce_count = 0;
12651269 pr_err("Uncorrected hardware memory error in user-access at %llx", p->mce_addr);
12661270
12671271 if (!p->mce_ripv)
@@ -1290,17 +1294,34 @@ static void kill_me_maybe(struct callback_head *cb) · 22 unmodified lines
12901294 }
12911295 }
12921296
1293−static void queue_task_work(struct mce *m, int kill_current_task)
1297+static void queue_task_work(struct mce *m, char *msg, int kill_current_task)
12941298 {
1295− current->mce_addr = m->addr;
1296− current->mce_kflags = m->kflags;
1297− current->mce_ripv = !!(m->mcgstatus & MCG_STATUS_RIPV);
1298− current->mce_whole_page = whole_page(m);
1299+ int count = ++current->mce_count;
12991300
1300− if (kill_current_task)
1301− current->mce_kill_me.func = kill_me_now;
1302− else
1303− current->mce_kill_me.func = kill_me_maybe;
1301+ /* First call, save all the details */
1302+ if (count == 1) {
1303+ current->mce_addr = m->addr;
1304+ current->mce_kflags = m->kflags;
1305+ current->mce_ripv = !!(m->mcgstatus & MCG_STATUS_RIPV);
1306+ current->mce_whole_page = whole_page(m);
1307+
1308+ if (kill_current_task)
1309+ current->mce_kill_me.func = kill_me_now;
1310+ else
1311+ current->mce_kill_me.func = kill_me_maybe;
1312+ }
1313+
1314+ /* Ten is likely overkill. Don't expect more than two faults before task_work() */
1315+ if (count > 10)
1316+ mce_panic("Too many consecutive machine checks while accessing user data", m, msg);
1317+
1318+ /* Second or later call, make sure page address matches the one from first call */
1319+ if (count > 1 && (current->mce_addr >> PAGE_SHIFT) != (m->addr >> PAGE_SHIFT))
1320+ mce_panic("Consecutive machine checks to different user pages", m, msg);
1321+
1322+ /* Do not call task_work_add() more than once */
1323+ if (count > 1)
1324+ return;
13041325
13051326 task_work_add(current, &current->mce_kill_me, TWA_RESUME);
13061327 }
@@ -1438,7 +1459,7 @@ noinstr void do_machine_check(struct pt_regs *regs) · 131 unmodified lines
14381459 /* If this triggers there is no way to recover. Die hard. */
14391460 BUG_ON(!on_thread_stack() || !user_mode(regs));
14401461
1441− queue_task_work(&m, kill_current_task);
1462+ queue_task_work(&m, msg, kill_current_task);
14421463
14431464 } else {
14441465 /*
@@ -1456,7 +1477,7 @@ noinstr void do_machine_check(struct pt_regs *regs) · 11 unmodified lines
14561477 }
14571478
14581479 if (m.kflags & MCE_IN_KERNEL_COPYIN)
1459− queue_task_work(&m, kill_current_task);
1480+ queue_task_work(&m, msg, kill_current_task);
14601481 }
14611482 out:
14621483 mce_wrmsrl(MSR_IA32_MCG_STATUS, 0);
arch/x86/mm/init_64.c+3−3
@@ -1432,18 +1432,18 @@ int kern_addr_valid(unsigned long addr) · 1431 unmodified lines
14321432 return 0;
14331433
14341434 p4d = p4d_offset(pgd, addr);
1435− if (p4d_none(*p4d))
1435+ if (!p4d_present(*p4d))
14361436 return 0;
14371437
14381438 pud = pud_offset(p4d, addr);
1439− if (pud_none(*pud))
1439+ if (!pud_present(*pud))
14401440 return 0;
14411441
14421442 if (pud_large(*pud))
14431443 return pfn_valid(pud_pfn(*pud));
14441444
14451445 pmd = pmd_offset(pud, addr);
1446− if (pmd_none(*pmd))
1446+ if (!pmd_present(*pmd))
14471447 return 0;
14481448
14491449 if (pmd_large(*pmd))
arch/x86/mm/pat/memtype.c+6−1
@@ -583,7 +583,12 @@ int memtype_reserve(u64 start, u64 end, enum page_cache_mode req_type, · 582 unmodified lines
583583 int err = 0;
584584
585585 start = sanitize_phys(start);
586− end = sanitize_phys(end);
586+
587+ /*
588+ * The end address passed into this function is exclusive, but
589+ * sanitize_phys() expects an inclusive address.
590+ */
591+ end = sanitize_phys(end - 1) + 1;
587592 if (start >= end) {
588593 WARN(1, "%s failed: [mem %#010Lx-%#010Lx], req %s\n", __func__,
589594 start, end - 1, cattr_name(req_type));
arch/x86/xen/enlighten_pv.c+7−0
@@ -1214,6 +1214,11 @@ static void __init xen_dom0_set_legacy_features(void) · 1213 unmodified lines
12141214 x86_platform.legacy.rtc = 1;
12151215 }
12161216
1217+static void __init xen_domu_set_legacy_features(void)
1218+{
1219+ x86_platform.legacy.rtc = 0;
1220+}
1221+
12171222 /* First C function to be called on Xen boot */
12181223 asmlinkage __visible void __init xen_start_kernel(void)
12191224 {
@@ -1359,6 +1364,8 @@ asmlinkage __visible void __init xen_start_kernel(void) · 139 unmodified lines
13591364 add_preferred_console("xenboot", 0, NULL);
13601365 if (pci_xen)
13611366 x86_init.pci.arch_init = pci_xen_init;
1367+ x86_platform.set_legacy_features =
1368+ xen_domu_set_legacy_features;
13621369 } else {
13631370 const struct dom0_vga_console_info *info =
13641371 (void *)((char *)xen_start_info +
arch/x86/xen/mmu_pv.c+5−2
@@ -1518,14 +1518,17 @@ static inline void xen_alloc_ptpage(struct mm_struct *mm, unsigned long pfn, · 1517 unmodified lines
15181518 if (pinned) {
15191519 struct page *page = pfn_to_page(pfn);
15201520
1521− if (static_branch_likely(&xen_struct_pages_ready))
1521+ pinned = false;
1522+ if (static_branch_likely(&xen_struct_pages_ready)) {
1523+ pinned = PagePinned(page);
15221524 SetPagePinned(page);
1525+ }
15231526
15241527 xen_mc_batch();
15251528
15261529 __set_pfn_prot(pfn, PAGE_KERNEL_RO);
15271530
1528− if (level == PT_PTE && USE_SPLIT_PTE_PTLOCKS)
1531+ if (level == PT_PTE && USE_SPLIT_PTE_PTLOCKS && !pinned)
15291532 __pin_pagetable_pfn(MMUEXT_PIN_L1_TABLE, pfn);
15301533
15311534 xen_mc_issue(PARAVIRT_LAZY_MMU);
block/blk-cgroup.c+14−4
@@ -1182,10 +1182,6 @@ int blkcg_init_queue(struct request_queue *q) · 1181 unmodified lines
11821182 if (preloaded)
11831183 radix_tree_preload_end();
11841184
1185− ret = blk_iolatency_init(q);
1186− if (ret)
1187− goto err_destroy_all;
1188−
11891185 ret = blk_ioprio_init(q);
11901186 if (ret)
11911187 goto err_destroy_all;
@@ -1194,6 +1190,12 @@ int blkcg_init_queue(struct request_queue *q) · 2 unmodified lines
11941190 if (ret)
11951191 goto err_destroy_all;
11961192
1193+ ret = blk_iolatency_init(q);
1194+ if (ret) {
1195+ blk_throtl_exit(q);
1196+ goto err_destroy_all;
1197+ }
1198+
11971199 return 0;
11981200
11991201 err_destroy_all:
@@ -1364,10 +1366,14 @@ enomem: · 164 unmodified lines
13641366 /* alloc failed, nothing's initialized yet, free everything */
13651367 spin_lock_irq(&q->queue_lock);
13661368 list_for_each_entry(blkg, &q->blkg_list, q_node) {
1369+ struct blkcg *blkcg = blkg->blkcg;
1370+
1371+ spin_lock(&blkcg->lock);
13671372 if (blkg->pd[pol->plid]) {
13681373 pol->pd_free_fn(blkg->pd[pol->plid]);
13691374 blkg->pd[pol->plid] = NULL;
13701375 }
1376+ spin_unlock(&blkcg->lock);
13711377 }
13721378 spin_unlock_irq(&q->queue_lock);
13731379 ret = -ENOMEM;
@@ -1399,12 +1405,16 @@ void blkcg_deactivate_policy(struct request_queue *q, · 25 unmodified lines
13991405 __clear_bit(pol->plid, q->blkcg_pols);
14001406
14011407 list_for_each_entry(blkg, &q->blkg_list, q_node) {
1408+ struct blkcg *blkcg = blkg->blkcg;
1409+
1410+ spin_lock(&blkcg->lock);
14021411 if (blkg->pd[pol->plid]) {
14031412 if (pol->pd_offline_fn)
14041413 pol->pd_offline_fn(blkg->pd[pol->plid]);
14051414 pol->pd_free_fn(blkg->pd[pol->plid]);
14061415 blkg->pd[pol->plid] = NULL;
14071416 }
1417+ spin_unlock(&blkcg->lock);
14081418 }
14091419
14101420 spin_unlock_irq(&q->queue_lock);
block/blk-integrity.c+8−1
@@ -426,8 +426,15 @@ EXPORT_SYMBOL(blk_integrity_register); · 425 unmodified lines
426426 */
427427 void blk_integrity_unregister(struct gendisk *disk)
428428 {
429+ struct blk_integrity *bi = &disk->queue->integrity;
430+
431+ if (!bi->profile)
432+ return;
433+
434+ /* ensure all bios are off the integrity workqueue */
435+ blk_flush_integrity();
429436 blk_queue_flag_clear(QUEUE_FLAG_STABLE_WRITES, disk->queue);
430− memset(&disk->queue->integrity, 0, sizeof(struct blk_integrity));
437+ memset(bi, 0, sizeof(*bi));
431438 }
432439 EXPORT_SYMBOL(blk_integrity_unregister);
433440
block/blk-mq-tag.c+1−1
@@ -208,7 +208,7 @@ static struct request *blk_mq_find_and_get_req(struct blk_mq_tags *tags, · 207 unmodified lines
208208
209209 spin_lock_irqsave(&tags->lock, flags);
210210 rq = tags->rqs[bitnr];
211− if (!rq || !refcount_inc_not_zero(&rq->ref))
211+ if (!rq || rq->tag != bitnr || !refcount_inc_not_zero(&rq->ref))
212212 rq = NULL;
213213 spin_unlock_irqrestore(&tags->lock, flags);
214214 return rq;
drivers/base/power/trace.c+10−0
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #include <linux/export.h>
1414 #include <linux/rtc.h>
1515 #include <linux/suspend.h>
16+#include <linux/init.h>
1617
1718 #include <linux/mc146818rtc.h>
1819
@@ -165,6 +166,9 @@ void generate_pm_trace(const void *tracedata, unsigned int user) · 146 unmodified lines
165166 const char *file = *(const char **)(tracedata + 2);
166167 unsigned int user_hash_value, file_hash_value;
167168
169+ if (!x86_platform.legacy.rtc)
170+ return;
171+
168172 user_hash_value = user % USERHASH;
169173 file_hash_value = hash_string(lineno, file, FILEHASH);
170174 set_magic_time(user_hash_value, file_hash_value, dev_hash_value);
@@ -267,6 +271,9 @@ static struct notifier_block pm_trace_nb = { · 96 unmodified lines
267271
268272 static int __init early_resume_init(void)
269273 {
274+ if (!x86_platform.legacy.rtc)
275+ return 0;
276+
270277 hash_value_early_read = read_magic_time();
271278 register_pm_notifier(&pm_trace_nb);
272279 return 0;
@@ -277,6 +284,9 @@ static int __init late_resume_init(void) · 4 unmodified lines
277284 unsigned int val = hash_value_early_read;
278285 unsigned int user, file, dev;
279286
287+ if (!x86_platform.legacy.rtc)
288+ return 0;
289+
280290 user = val % USERHASH;
281291 val = val / USERHASH;
282292 file = val % FILEHASH;
drivers/cpufreq/cpufreq_governor_attr_set.c+1−1
@@ -74,8 +74,8 @@ unsigned int gov_attr_set_put(struct gov_attr_set *attr_set, struct list_head *l · 73 unmodified lines
7474 if (count)
7575 return count;
7676
77− kobject_put(&attr_set->kobj);
7877 mutex_destroy(&attr_set->update_lock);
78+ kobject_put(&attr_set->kobj);
7979 return 0;
8080 }
8181 EXPORT_SYMBOL_GPL(gov_attr_set_put);
drivers/cpufreq/intel_pstate.c+14−8
@@ -3205,11 +3205,15 @@ static int __init intel_pstate_init(void) · 3204 unmodified lines
32053205 if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
32063206 return -ENODEV;
32073207
3208− if (no_load)
3209− return -ENODEV;
3210−
32113208 id = x86_match_cpu(hwp_support_ids);
32123209 if (id) {
3210+ bool hwp_forced = intel_pstate_hwp_is_enabled();
3211+
3212+ if (hwp_forced)
3213+ pr_info("HWP enabled by BIOS\n");
3214+ else if (no_load)
3215+ return -ENODEV;
3216+
32133217 copy_cpu_funcs(&core_funcs);
32143218 /*
32153219 * Avoid enabling HWP for processors without EPP support,
@@ -3219,8 +3223,7 @@ static int __init intel_pstate_init(void) · 3 unmodified lines
32193223 * If HWP is enabled already, though, there is no choice but to
32203224 * deal with it.
32213225 */
3222− if ((!no_hwp && boot_cpu_has(X86_FEATURE_HWP_EPP)) ||
3223− intel_pstate_hwp_is_enabled()) {
3226+ if ((!no_hwp && boot_cpu_has(X86_FEATURE_HWP_EPP)) || hwp_forced) {
32243227 hwp_active++;
32253228 hwp_mode_bdw = id->driver_data;
32263229 intel_pstate.attr = hwp_cpufreq_attrs;
@@ -3235,7 +3238,11 @@ static int __init intel_pstate_init(void) · 8 unmodified lines
32353238
32363239 goto hwp_cpu_matched;
32373240 }
3241+ pr_info("HWP not enabled\n");
32383242 } else {
3243+ if (no_load)
3244+ return -ENODEV;
3245+
32393246 id = x86_match_cpu(intel_pstate_cpu_ids);
32403247 if (!id) {
32413248 pr_info("CPU model not supported\n");
@@ -3314,10 +3321,9 @@ static int __init intel_pstate_setup(char *str) · 72 unmodified lines
33143321 else if (!strcmp(str, "passive"))
33153322 default_driver = &intel_cpufreq;
33163323
3317− if (!strcmp(str, "no_hwp")) {
3318− pr_info("HWP disabled\n");
3324+ if (!strcmp(str, "no_hwp"))
33193325 no_hwp = 1;
3320− }
3326+
33213327 if (!strcmp(str, "force"))
33223328 force_load = 1;
33233329 if (!strcmp(str, "hwp_only"))
drivers/gpu/drm/amd/amdgpu/amdgpu.h+1−1
@@ -758,7 +758,7 @@ enum amd_hw_ip_block_type { · 757 unmodified lines
758758 MAX_HWIP
759759 };
760760
761−#define HWIP_MAX_INSTANCE 8
761+#define HWIP_MAX_INSTANCE 10
762762
763763 struct amd_powerplay {
764764 void *pp_handle;
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c+10−0
@@ -192,6 +192,16 @@ void amdgpu_amdkfd_suspend(struct amdgpu_device *adev, bool run_pm) · 191 unmodified lines
192192 kgd2kfd_suspend(adev->kfd.dev, run_pm);
193193 }
194194
195+int amdgpu_amdkfd_resume_iommu(struct amdgpu_device *adev)
196+{
197+ int r = 0;
198+
199+ if (adev->kfd.dev)
200+ r = kgd2kfd_resume_iommu(adev->kfd.dev);
201+
202+ return r;
203+}
204+
195205 int amdgpu_amdkfd_resume(struct amdgpu_device *adev, bool run_pm)
196206 {
197207 int r = 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h+7−0
@@ -137,6 +137,7 @@ int amdgpu_amdkfd_init(void); · 136 unmodified lines
137137 void amdgpu_amdkfd_fini(void);
138138
139139 void amdgpu_amdkfd_suspend(struct amdgpu_device *adev, bool run_pm);
140+int amdgpu_amdkfd_resume_iommu(struct amdgpu_device *adev);
140141 int amdgpu_amdkfd_resume(struct amdgpu_device *adev, bool run_pm);
141142 void amdgpu_amdkfd_interrupt(struct amdgpu_device *adev,
142143 const void *ih_ring_entry);
@@ -327,6 +328,7 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd, · 184 unmodified lines
327328 const struct kgd2kfd_shared_resources *gpu_resources);
328329 void kgd2kfd_device_exit(struct kfd_dev *kfd);
329330 void kgd2kfd_suspend(struct kfd_dev *kfd, bool run_pm);
331+int kgd2kfd_resume_iommu(struct kfd_dev *kfd);
330332 int kgd2kfd_resume(struct kfd_dev *kfd, bool run_pm);
331333 int kgd2kfd_pre_reset(struct kfd_dev *kfd);
332334 int kgd2kfd_post_reset(struct kfd_dev *kfd);
@@ -365,6 +367,11 @@ static inline void kgd2kfd_suspend(struct kfd_dev *kfd, bool run_pm) · 32 unmodified lines
365367 {
366368 }
367369
370+static int __maybe_unused kgd2kfd_resume_iommu(struct kfd_dev *kfd)
371+{
372+ return 0;
373+}
374+
368375 static inline int kgd2kfd_resume(struct kfd_dev *kfd, bool run_pm)
369376 {
370377 return 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c+4−6
@@ -1544,20 +1544,18 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev) · 1543 unmodified lines
15441544 struct dentry *ent;
15451545 int r, i;
15461546
1547−
1548−
15491547 ent = debugfs_create_file("amdgpu_preempt_ib", 0600, root, adev,
15501548 &fops_ib_preempt);
1551− if (!ent) {
1549+ if (IS_ERR(ent)) {
15521550 DRM_ERROR("unable to create amdgpu_preempt_ib debugsfs file\n");
1553− return -EIO;
1551+ return PTR_ERR(ent);
15541552 }
15551553
15561554 ent = debugfs_create_file("amdgpu_force_sclk", 0200, root, adev,
15571555 &fops_sclk_set);
1558− if (!ent) {
1556+ if (IS_ERR(ent)) {
15591557 DRM_ERROR("unable to create amdgpu_set_sclk debugsfs file\n");
1560− return -EIO;
1558+ return PTR_ERR(ent);
15611559 }
15621560
15631561 /* Register debugfs entries for amdgpu_ttm */
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c+12−0
@@ -2394,6 +2394,10 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev) · 2393 unmodified lines
23942394 if (r)
23952395 goto init_failed;
23962396
2397+ r = amdgpu_amdkfd_resume_iommu(adev);
2398+ if (r)
2399+ goto init_failed;
2400+
23972401 r = amdgpu_device_ip_hw_init_phase1(adev);
23982402 if (r)
23992403 goto init_failed;
@@ -3148,6 +3152,10 @@ static int amdgpu_device_ip_resume(struct amdgpu_device *adev) · 748 unmodified lines
31483152 {
31493153 int r;
31503154
3155+ r = amdgpu_amdkfd_resume_iommu(adev);
3156+ if (r)
3157+ return r;
3158+
31513159 r = amdgpu_device_ip_resume_phase1(adev);
31523160 if (r)
31533161 return r;
@@ -4601,6 +4609,10 @@ int amdgpu_do_asic_reset(struct list_head *device_list_handle, · 1447 unmodified lines
46014609 dev_warn(tmp_adev->dev, "asic atom init failed!");
46024610 } else {
46034611 dev_info(tmp_adev->dev, "GPU reset succeeded, trying to resume\n");
4612+ r = amdgpu_amdkfd_resume_iommu(tmp_adev);
4613+ if (r)
4614+ goto out;
4615+
46044616 r = amdgpu_device_ip_resume_phase1(tmp_adev);
46054617 if (r)
46064618 goto out;
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c+1−1
@@ -598,7 +598,7 @@ void amdgpu_gmc_tmz_set(struct amdgpu_device *adev) · 597 unmodified lines
598598 break;
599599 default:
600600 adev->gmc.tmz_enabled = false;
601− dev_warn(adev->dev,
601+ dev_info(adev->dev,
602602 "Trusted Memory Zone (TMZ) feature not supported\n");
603603 break;
604604 }
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c+1−1
@@ -757,7 +757,7 @@ Out: · 756 unmodified lines
757757 return res;
758758 }
759759
760−inline uint32_t amdgpu_ras_eeprom_max_record_count(void)
760+uint32_t amdgpu_ras_eeprom_max_record_count(void)
761761 {
762762 return RAS_MAX_RECORD_COUNT;
763763 }
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.h+1−1
@@ -120,7 +120,7 @@ int amdgpu_ras_eeprom_read(struct amdgpu_ras_eeprom_control *control, · 119 unmodified lines
120120 int amdgpu_ras_eeprom_append(struct amdgpu_ras_eeprom_control *control,
121121 struct eeprom_table_record *records, const u32 num);
122122
123−inline uint32_t amdgpu_ras_eeprom_max_record_count(void);
123+uint32_t amdgpu_ras_eeprom_max_record_count(void);
124124
125125 void amdgpu_ras_debugfs_set_ret_size(struct amdgpu_ras_eeprom_control *control);
126126
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c+2−2
@@ -428,8 +428,8 @@ int amdgpu_debugfs_ring_init(struct amdgpu_device *adev, · 427 unmodified lines
428428 ent = debugfs_create_file(name,
429429 S_IFREG | S_IRUGO, root,
430430 ring, &amdgpu_debugfs_ring_fops);
431− if (!ent)
432− return -ENOMEM;
431+ if (IS_ERR(ent))
432+ return PTR_ERR(ent);
433433
434434 i_size_write(ent->d_inode, ring->ring_size + 12);
435435 ring->ent = ent;
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c+9−9
@@ -515,6 +515,15 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict, · 514 unmodified lines
515515 goto out;
516516 }
517517
518+ if (bo->type == ttm_bo_type_device &&
519+ new_mem->mem_type == TTM_PL_VRAM &&
520+ old_mem->mem_type != TTM_PL_VRAM) {
521+ /* amdgpu_bo_fault_reserve_notify will re-set this if the CPU
522+ * accesses the BO after it's moved.
523+ */
524+ abo->flags &= ~AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
525+ }
526+
518527 if (adev->mman.buffer_funcs_enabled) {
519528 if (((old_mem->mem_type == TTM_PL_SYSTEM &&
520529 new_mem->mem_type == TTM_PL_VRAM) ||
@@ -545,15 +554,6 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict, · 24 unmodified lines
545554 return r;
546555 }
547556
548− if (bo->type == ttm_bo_type_device &&
549− new_mem->mem_type == TTM_PL_VRAM &&
550− old_mem->mem_type != TTM_PL_VRAM) {
551− /* amdgpu_bo_fault_reserve_notify will re-set this if the CPU
552− * accesses the BO after it's moved.
553− */
554− abo->flags &= ~AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
555− }
556−
557557 out:
558558 /* update statistics */
559559 atomic64_add(bo->base.size, &adev->num_bytes_moved);
drivers/gpu/drm/amd/amdkfd/kfd_device.c+36−20
@@ -468,6 +468,7 @@ static const struct kfd_device_info navi10_device_info = { · 467 unmodified lines
468468 .needs_iommu_device = false,
469469 .supports_cwsr = true,
470470 .needs_pci_atomics = true,
471+ .no_atomic_fw_version = 145,
471472 .num_sdma_engines = 2,
472473 .num_xgmi_sdma_engines = 0,
473474 .num_sdma_queues_per_engine = 8,
@@ -487,6 +488,7 @@ static const struct kfd_device_info navi12_device_info = { · 13 unmodified lines
487488 .needs_iommu_device = false,
488489 .supports_cwsr = true,
489490 .needs_pci_atomics = true,
491+ .no_atomic_fw_version = 145,
490492 .num_sdma_engines = 2,
491493 .num_xgmi_sdma_engines = 0,
492494 .num_sdma_queues_per_engine = 8,
@@ -506,6 +508,7 @@ static const struct kfd_device_info navi14_device_info = { · 13 unmodified lines
506508 .needs_iommu_device = false,
507509 .supports_cwsr = true,
508510 .needs_pci_atomics = true,
511+ .no_atomic_fw_version = 145,
509512 .num_sdma_engines = 2,
510513 .num_xgmi_sdma_engines = 0,
511514 .num_sdma_queues_per_engine = 8,
@@ -525,6 +528,7 @@ static const struct kfd_device_info sienna_cichlid_device_info = { · 13 unmodified lines
525528 .needs_iommu_device = false,
526529 .supports_cwsr = true,
527530 .needs_pci_atomics = true,
531+ .no_atomic_fw_version = 92,
528532 .num_sdma_engines = 4,
529533 .num_xgmi_sdma_engines = 0,
530534 .num_sdma_queues_per_engine = 8,
@@ -544,6 +548,7 @@ static const struct kfd_device_info navy_flounder_device_info = { · 13 unmodified lines
544548 .needs_iommu_device = false,
545549 .supports_cwsr = true,
546550 .needs_pci_atomics = true,
551+ .no_atomic_fw_version = 92,
547552 .num_sdma_engines = 2,
548553 .num_xgmi_sdma_engines = 0,
549554 .num_sdma_queues_per_engine = 8,
@@ -562,7 +567,8 @@ static const struct kfd_device_info vangogh_device_info = { · 12 unmodified lines
562567 .mqd_size_aligned = MQD_SIZE_ALIGNED,
563568 .needs_iommu_device = false,
564569 .supports_cwsr = true,
565− .needs_pci_atomics = false,
570+ .needs_pci_atomics = true,
571+ .no_atomic_fw_version = 92,
566572 .num_sdma_engines = 1,
567573 .num_xgmi_sdma_engines = 0,
568574 .num_sdma_queues_per_engine = 2,
@@ -582,6 +588,7 @@ static const struct kfd_device_info dimgrey_cavefish_device_info = { · 13 unmodified lines
582588 .needs_iommu_device = false,
583589 .supports_cwsr = true,
584590 .needs_pci_atomics = true,
591+ .no_atomic_fw_version = 92,
585592 .num_sdma_engines = 2,
586593 .num_xgmi_sdma_engines = 0,
587594 .num_sdma_queues_per_engine = 8,
@@ -601,6 +608,7 @@ static const struct kfd_device_info beige_goby_device_info = { · 13 unmodified lines
601608 .needs_iommu_device = false,
602609 .supports_cwsr = true,
603610 .needs_pci_atomics = true,
611+ .no_atomic_fw_version = 92,
604612 .num_sdma_engines = 1,
605613 .num_xgmi_sdma_engines = 0,
606614 .num_sdma_queues_per_engine = 8,
@@ -619,7 +627,8 @@ static const struct kfd_device_info yellow_carp_device_info = { · 12 unmodified lines
619627 .mqd_size_aligned = MQD_SIZE_ALIGNED,
620628 .needs_iommu_device = false,
621629 .supports_cwsr = true,
622− .needs_pci_atomics = false,
630+ .needs_pci_atomics = true,
631+ .no_atomic_fw_version = 92,
623632 .num_sdma_engines = 1,
624633 .num_xgmi_sdma_engines = 0,
625634 .num_sdma_queues_per_engine = 2,
@@ -708,20 +717,6 @@ struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd, · 82 unmodified lines
708717 if (!kfd)
709718 return NULL;
710719
711− /* Allow BIF to recode atomics to PCIe 3.0 AtomicOps.
712− * 32 and 64-bit requests are possible and must be
713− * supported.
714− */
715− kfd->pci_atomic_requested = amdgpu_amdkfd_have_atomics_support(kgd);
716− if (device_info->needs_pci_atomics &&
717− !kfd->pci_atomic_requested) {
718− dev_info(kfd_device,
719− "skipped device %x:%x, PCI rejects atomics\n",
720− pdev->vendor, pdev->device);
721− kfree(kfd);
722− return NULL;
723− }
724−
725720 kfd->kgd = kgd;
726721 kfd->device_info = device_info;
727722 kfd->pdev = pdev;
@@ -821,6 +816,23 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd, · 93 unmodified lines
821816 kfd->vm_info.vmid_num_kfd = kfd->vm_info.last_vmid_kfd
822817 - kfd->vm_info.first_vmid_kfd + 1;
823818
819+ /* Allow BIF to recode atomics to PCIe 3.0 AtomicOps.
820+ * 32 and 64-bit requests are possible and must be
821+ * supported.
822+ */
823+ kfd->pci_atomic_requested = amdgpu_amdkfd_have_atomics_support(kfd->kgd);
824+ if (!kfd->pci_atomic_requested &&
825+ kfd->device_info->needs_pci_atomics &&
826+ (!kfd->device_info->no_atomic_fw_version ||
827+ kfd->mec_fw_version < kfd->device_info->no_atomic_fw_version)) {
828+ dev_info(kfd_device,
829+ "skipped device %x:%x, PCI rejects atomics %d<%d\n",
830+ kfd->pdev->vendor, kfd->pdev->device,
831+ kfd->mec_fw_version,
832+ kfd->device_info->no_atomic_fw_version);
833+ return false;
834+ }
835+
824836 /* Verify module parameters regarding mapped process number*/
825837 if ((hws_max_conc_proc < 0)
826838 || (hws_max_conc_proc > kfd->vm_info.vmid_num_kfd)) {
@@ -1057,17 +1069,21 @@ int kgd2kfd_resume(struct kfd_dev *kfd, bool run_pm) · 230 unmodified lines
10571069 return ret;
10581070 }
10591071
1060−static int kfd_resume(struct kfd_dev *kfd)
1072+int kgd2kfd_resume_iommu(struct kfd_dev *kfd)
10611073 {
10621074 int err = 0;
10631075
10641076 err = kfd_iommu_resume(kfd);
1065− if (err) {
1077+ if (err)
10661078 dev_err(kfd_device,
10671079 "Failed to resume IOMMU for device %x:%x\n",
10681080 kfd->pdev->vendor, kfd->pdev->device);
1069− return err;
1070− }
1081+ return err;
1082+}
1083+
1084+static int kfd_resume(struct kfd_dev *kfd)
1085+{
1086+ int err = 0;
10711087
10721088 err = kfd->dqm->ops.start(kfd->dqm);
10731089 if (err) {
drivers/gpu/drm/amd/amdkfd/kfd_priv.h+1−0
@@ -207,6 +207,7 @@ struct kfd_device_info { · 206 unmodified lines
207207 bool supports_cwsr;
208208 bool needs_iommu_device;
209209 bool needs_pci_atomics;
210+ uint32_t no_atomic_fw_version;
210211 unsigned int num_sdma_engines;
211212 unsigned int num_xgmi_sdma_engines;
212213 unsigned int num_sdma_queues_per_engine;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c+86−23
@@ -998,6 +998,8 @@ static void mmhub_read_system_context(struct amdgpu_device *adev, struct dc_phy_ · 997 unmodified lines
998998 uint32_t agp_base, agp_bot, agp_top;
999999 PHYSICAL_ADDRESS_LOC page_table_start, page_table_end, page_table_base;
10001000
1001+ memset(pa_config, 0, sizeof(*pa_config));
1002+
10011003 logical_addr_low = min(adev->gmc.fb_start, adev->gmc.agp_start) >> 18;
10021004 pt_base = amdgpu_gmc_pd_addr(adev->gart.bo);
10031005
@@ -6024,21 +6026,23 @@ static inline int dm_set_vblank(struct drm_crtc *crtc, bool enable) · 5020 unmodified lines
60246026 return 0;
60256027
60266028 #if defined(CONFIG_DRM_AMD_DC_DCN)
6027− work = kzalloc(sizeof(*work), GFP_ATOMIC);
6028− if (!work)
6029− return -ENOMEM;
6029+ if (dm->vblank_control_workqueue) {
6030+ work = kzalloc(sizeof(*work), GFP_ATOMIC);
6031+ if (!work)
6032+ return -ENOMEM;
60306033
6031− INIT_WORK(&work->work, vblank_control_worker);
6032− work->dm = dm;
6033− work->acrtc = acrtc;
6034− work->enable = enable;
6034+ INIT_WORK(&work->work, vblank_control_worker);
6035+ work->dm = dm;
6036+ work->acrtc = acrtc;
6037+ work->enable = enable;
60356038
6036− if (acrtc_state->stream) {
6037− dc_stream_retain(acrtc_state->stream);
6038− work->stream = acrtc_state->stream;
6039− }
6039+ if (acrtc_state->stream) {
6040+ dc_stream_retain(acrtc_state->stream);
6041+ work->stream = acrtc_state->stream;
6042+ }
60406043
6041− queue_work(dm->vblank_control_workqueue, &work->work);
6044+ queue_work(dm->vblank_control_workqueue, &work->work);
6045+ }
60426046 #endif
60436047
60446048 return 0;
@@ -6792,14 +6796,15 @@ const struct drm_encoder_helper_funcs amdgpu_dm_encoder_helper_funcs = { · 747 unmodified lines
67926796
67936797 #if defined(CONFIG_DRM_AMD_DC_DCN)
67946798 static int dm_update_mst_vcpi_slots_for_dsc(struct drm_atomic_state *state,
6795− struct dc_state *dc_state)
6799+ struct dc_state *dc_state,
6800+ struct dsc_mst_fairness_vars *vars)
67966801 {
67976802 struct dc_stream_state *stream = NULL;
67986803 struct drm_connector *connector;
67996804 struct drm_connector_state *new_con_state;
68006805 struct amdgpu_dm_connector *aconnector;
68016806 struct dm_connector_state *dm_conn_state;
6802− int i, j, clock, bpp;
6807+ int i, j, clock;
68036808 int vcpi, pbn_div, pbn = 0;
68046809
68056810 for_each_new_connector_in_state(state, connector, new_con_state, i) {
@@ -6838,9 +6843,15 @@ static int dm_update_mst_vcpi_slots_for_dsc(struct drm_atomic_state *state, · 32 unmodified lines
68386843 }
68396844
68406845 pbn_div = dm_mst_get_pbn_divider(stream->link);
6841− bpp = stream->timing.dsc_cfg.bits_per_pixel;
68426846 clock = stream->timing.pix_clk_100hz / 10;
6843− pbn = drm_dp_calc_pbn_mode(clock, bpp, true);
6847+ /* pbn is calculated by compute_mst_dsc_configs_for_state*/
6848+ for (j = 0; j < dc_state->stream_count; j++) {
6849+ if (vars[j].aconnector == aconnector) {
6850+ pbn = vars[j].pbn;
6851+ break;
6852+ }
6853+ }
6854+
68446855 vcpi = drm_dp_mst_atomic_enable_dsc(state,
68456856 aconnector->port,
68466857 pbn, pbn_div,
@@ -7519,6 +7530,32 @@ static void amdgpu_dm_connector_add_common_modes(struct drm_encoder *encoder, · 672 unmodified lines
75197530 }
75207531 }
75217532
7533+static void amdgpu_set_panel_orientation(struct drm_connector *connector)
7534+{
7535+ struct drm_encoder *encoder;
7536+ struct amdgpu_encoder *amdgpu_encoder;
7537+ const struct drm_display_mode *native_mode;
7538+
7539+ if (connector->connector_type != DRM_MODE_CONNECTOR_eDP &&
7540+ connector->connector_type != DRM_MODE_CONNECTOR_LVDS)
7541+ return;
7542+
7543+ encoder = amdgpu_dm_connector_to_encoder(connector);
7544+ if (!encoder)
7545+ return;
7546+
7547+ amdgpu_encoder = to_amdgpu_encoder(encoder);
7548+
7549+ native_mode = &amdgpu_encoder->native_mode;
7550+ if (native_mode->hdisplay == 0 || native_mode->vdisplay == 0)
7551+ return;
7552+
7553+ drm_connector_set_panel_orientation_with_quirk(connector,
7554+ DRM_MODE_PANEL_ORIENTATION_UNKNOWN,
7555+ native_mode->hdisplay,
7556+ native_mode->vdisplay);
7557+}
7558+
75227559 static void amdgpu_dm_connector_ddc_get_modes(struct drm_connector *connector,
75237560 struct edid *edid)
75247561 {
@@ -7547,6 +7584,8 @@ static void amdgpu_dm_connector_ddc_get_modes(struct drm_connector *connector, · 22 unmodified lines
75477584 * restored here.
75487585 */
75497586 amdgpu_dm_update_freesync_caps(connector, edid);
7587+
7588+ amdgpu_set_panel_orientation(connector);
75507589 } else {
75517590 amdgpu_dm_connector->num_modes = 0;
75527591 }
@@ -8058,8 +8097,26 @@ static bool is_content_protection_different(struct drm_connector_state *state, · 505 unmodified lines
80588097 state->content_protection == DRM_MODE_CONTENT_PROTECTION_ENABLED)
80598098 state->content_protection = DRM_MODE_CONTENT_PROTECTION_DESIRED;
80608099
8061− /* Check if something is connected/enabled, otherwise we start hdcp but nothing is connected/enabled
8062− * hot-plug, headless s3, dpms
8100+ /* Stream removed and re-enabled
8101+ *
8102+ * Can sometimes overlap with the HPD case,
8103+ * thus set update_hdcp to false to avoid
8104+ * setting HDCP multiple times.
8105+ *
8106+ * Handles: DESIRED -> DESIRED (Special case)
8107+ */
8108+ if (!(old_state->crtc && old_state->crtc->enabled) &&
8109+ state->crtc && state->crtc->enabled &&
8110+ connector->state->content_protection == DRM_MODE_CONTENT_PROTECTION_DESIRED) {
8111+ dm_con_state->update_hdcp = false;
8112+ return true;
8113+ }
8114+
8115+ /* Hot-plug, headless s3, dpms
8116+ *
8117+ * Only start HDCP if the display is connected/enabled.
8118+ * update_hdcp flag will be set to false until the next
8119+ * HPD comes in.
80638120 *
80648121 * Handles: DESIRED -> DESIRED (Special case)
80658122 */
@@ -8648,7 +8705,8 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, · 582 unmodified lines
86488705 * If PSR or idle optimizations are enabled then flush out
86498706 * any pending work before hardware programming.
86508707 */
8651− flush_workqueue(dm->vblank_control_workqueue);
8708+ if (dm->vblank_control_workqueue)
8709+ flush_workqueue(dm->vblank_control_workqueue);
86528710 #endif
86538711
86548712 bundle->stream_update.stream = acrtc_state->stream;
@@ -8983,7 +9041,8 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) · 328 unmodified lines
89839041 /* if there mode set or reset, disable eDP PSR */
89849042 if (mode_set_reset_required) {
89859043 #if defined(CONFIG_DRM_AMD_DC_DCN)
8986− flush_workqueue(dm->vblank_control_workqueue);
9044+ if (dm->vblank_control_workqueue)
9045+ flush_workqueue(dm->vblank_control_workqueue);
89879046 #endif
89889047 amdgpu_dm_psr_disable_all(dm);
89899048 }
@@ -10243,6 +10302,9 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, · 1253 unmodified lines
1024310302 int ret, i;
1024410303 bool lock_and_validation_needed = false;
1024510304 struct dm_crtc_state *dm_old_crtc_state;
10305+#if defined(CONFIG_DRM_AMD_DC_DCN)
10306+ struct dsc_mst_fairness_vars vars[MAX_PIPES];
10307+#endif
1024610308
1024710309 trace_amdgpu_dm_atomic_check_begin(state);
1024810310
@@ -10473,10 +10535,10 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, · 224 unmodified lines
1047310535 goto fail;
1047410536
1047510537 #if defined(CONFIG_DRM_AMD_DC_DCN)
10476− if (!compute_mst_dsc_configs_for_state(state, dm_state->context))
10538+ if (!compute_mst_dsc_configs_for_state(state, dm_state->context, vars))
1047710539 goto fail;
1047810540
10479− ret = dm_update_mst_vcpi_slots_for_dsc(state, dm_state->context);
10541+ ret = dm_update_mst_vcpi_slots_for_dsc(state, dm_state->context, vars);
1048010542 if (ret)
1048110543 goto fail;
1048210544 #endif
@@ -10492,7 +10554,8 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, · 9 unmodified lines
1049210554 goto fail;
1049310555 status = dc_validate_global_state(dc, dm_state->context, false);
1049410556 if (status != DC_OK) {
10495− DC_LOG_WARNING("DC global validation failure: %s (%d)",
10557+ drm_dbg_atomic(dev,
10558+ "DC global validation failure: %s (%d)",
1049610559 dc_status_to_str(status), status);
1049710560 ret = -EINVAL;
1049810561 goto fail;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c+8−10
@@ -518,12 +518,7 @@ struct dsc_mst_fairness_params { · 517 unmodified lines
518518 uint32_t num_slices_h;
519519 uint32_t num_slices_v;
520520 uint32_t bpp_overwrite;
521−};
522−
523−struct dsc_mst_fairness_vars {
524− int pbn;
525− bool dsc_enabled;
526− int bpp_x16;
521+ struct amdgpu_dm_connector *aconnector;
527522 };
528523
529524 static int kbps_to_peak_pbn(int kbps)
@@ -750,12 +745,12 @@ static void try_disable_dsc(struct drm_atomic_state *state, · 220 unmodified lines
750745
751746 static bool compute_mst_dsc_configs_for_link(struct drm_atomic_state *state,
752747 struct dc_state *dc_state,
753− struct dc_link *dc_link)
748+ struct dc_link *dc_link,
749+ struct dsc_mst_fairness_vars *vars)
754750 {
755751 int i;
756752 struct dc_stream_state *stream;
757753 struct dsc_mst_fairness_params params[MAX_PIPES];
758− struct dsc_mst_fairness_vars vars[MAX_PIPES];
759754 struct amdgpu_dm_connector *aconnector;
760755 int count = 0;
761756 bool debugfs_overwrite = false;
@@ -776,6 +771,7 @@ static bool compute_mst_dsc_configs_for_link(struct drm_atomic_state *state, · 14 unmodified lines
776771 params[count].timing = &stream->timing;
777772 params[count].sink = stream->sink;
778773 aconnector = (struct amdgpu_dm_connector *)stream->dm_stream_context;
774+ params[count].aconnector = aconnector;
779775 params[count].port = aconnector->port;
780776 params[count].clock_force_enable = aconnector->dsc_settings.dsc_force_enable;
781777 if (params[count].clock_force_enable == DSC_CLK_FORCE_ENABLE)
@@ -798,6 +794,7 @@ static bool compute_mst_dsc_configs_for_link(struct drm_atomic_state *state, · 16 unmodified lines
798794 }
799795 /* Try no compression */
800796 for (i = 0; i < count; i++) {
797+ vars[i].aconnector = params[i].aconnector;
801798 vars[i].pbn = kbps_to_peak_pbn(params[i].bw_range.stream_kbps);
802799 vars[i].dsc_enabled = false;
803800 vars[i].bpp_x16 = 0;
@@ -851,7 +848,8 @@ static bool compute_mst_dsc_configs_for_link(struct drm_atomic_state *state, · 47 unmodified lines
851848 }
852849
853850 bool compute_mst_dsc_configs_for_state(struct drm_atomic_state *state,
854− struct dc_state *dc_state)
851+ struct dc_state *dc_state,
852+ struct dsc_mst_fairness_vars *vars)
855853 {
856854 int i, j;
857855 struct dc_stream_state *stream;
@@ -882,7 +880,7 @@ bool compute_mst_dsc_configs_for_state(struct drm_atomic_state *state, · 24 unmodified lines
882880 return false;
883881
884882 mutex_lock(&aconnector->mst_mgr.lock);
885− if (!compute_mst_dsc_configs_for_link(state, dc_state, stream->link)) {
883+ if (!compute_mst_dsc_configs_for_link(state, dc_state, stream->link, vars)) {
886884 mutex_unlock(&aconnector->mst_mgr.lock);
887885 return false;
888886 }
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h+10−1
@@ -39,8 +39,17 @@ void · 38 unmodified lines
3939 dm_dp_create_fake_mst_encoders(struct amdgpu_device *adev);
4040
4141 #if defined(CONFIG_DRM_AMD_DC_DCN)
42+
43+struct dsc_mst_fairness_vars {
44+ int pbn;
45+ bool dsc_enabled;
46+ int bpp_x16;
47+ struct amdgpu_dm_connector *aconnector;
48+};
49+
4250 bool compute_mst_dsc_configs_for_state(struct drm_atomic_state *state,
43− struct dc_state *dc_state);
51+ struct dc_state *dc_state,
52+ struct dsc_mst_fairness_vars *vars);
4453 #endif
4554
4655 #endif
drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c+1−1
@@ -62,7 +62,7 @@ inline void dc_assert_fp_enabled(void) · 61 unmodified lines
6262 depth = *pcpu;
6363 put_cpu_ptr(&fpu_recursion_depth);
6464
65− ASSERT(depth > 1);
65+ ASSERT(depth >= 1);
6666 }
6767
6868 /**
drivers/gpu/drm/amd/display/dc/core/dc_link.c+12−4
@@ -2586,13 +2586,21 @@ static struct abm *get_abm_from_stream_res(const struct dc_link *link) · 2585 unmodified lines
25862586
25872587 int dc_link_get_backlight_level(const struct dc_link *link)
25882588 {
2589−
25902589 struct abm *abm = get_abm_from_stream_res(link);
2590+ struct panel_cntl *panel_cntl = link->panel_cntl;
2591+ struct dc *dc = link->ctx->dc;
2592+ struct dmcu *dmcu = dc->res_pool->dmcu;
2593+ bool fw_set_brightness = true;
25912594
2592− if (abm == NULL || abm->funcs->get_current_backlight == NULL)
2593− return DC_ERROR_UNEXPECTED;
2595+ if (dmcu)
2596+ fw_set_brightness = dmcu->funcs->is_dmcu_initialized(dmcu);
25942597
2595− return (int) abm->funcs->get_current_backlight(abm);
2598+ if (!fw_set_brightness && panel_cntl->funcs->get_current_backlight)
2599+ return panel_cntl->funcs->get_current_backlight(panel_cntl);
2600+ else if (abm != NULL && abm->funcs->get_current_backlight != NULL)
2601+ return (int) abm->funcs->get_current_backlight(abm);
2602+ else
2603+ return DC_ERROR_UNEXPECTED;
25962604 }
25972605
25982606 int dc_link_get_target_backlight_pwm(const struct dc_link *link)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c+30−4
@@ -1,4 +1,26 @@
1−/* Copyright 2015 Advanced Micro Devices, Inc. */
1+/*
2+ * Copyright 2015 Advanced Micro Devices, Inc.
3+ *
4+ * Permission is hereby granted, free of charge, to any person obtaining a
5+ * copy of this software and associated documentation files (the "Software"),
6+ * to deal in the Software without restriction, including without limitation
7+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+ * and/or sell copies of the Software, and to permit persons to whom the
9+ * Software is furnished to do so, subject to the following conditions:
10+ *
11+ * The above copyright notice and this permission notice shall be included in
12+ * all copies or substantial portions of the Software.
13+ *
14+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20+ * OTHER DEALINGS IN THE SOFTWARE.
21+ *
22+ * Authors: AMD
23+ */
224 #include "dm_services.h"
325 #include "dc.h"
426 #include "dc_link_dp.h"
@@ -1840,9 +1862,13 @@ bool perform_link_training_with_retries( · 1835 unmodified lines
18401862 dp_disable_link_phy(link, signal);
18411863
18421864 /* Abort link training if failure due to sink being unplugged. */
1843− if (status == LINK_TRAINING_ABORT)
1844− break;
1845− else if (do_fallback) {
1865+ if (status == LINK_TRAINING_ABORT) {
1866+ enum dc_connection_type type = dc_connection_none;
1867+
1868+ dc_link_detect_sink(link, &type);
1869+ if (type == dc_connection_none)
1870+ break;
1871+ } else if (do_fallback) {
18461872 decide_fallback_link_setting(*link_setting, &current_setting, status);
18471873 /* Fail link training if reduced link bandwidth no longer meets
18481874 * stream requirements.
drivers/gpu/drm/amd/display/dc/dce/dce_panel_cntl.c+0−10
@@ -49,7 +49,6 @@ · 48 unmodified lines
4949 static unsigned int dce_get_16_bit_backlight_from_pwm(struct panel_cntl *panel_cntl)
5050 {
5151 uint64_t current_backlight;
52− uint32_t round_result;
5352 uint32_t bl_period, bl_int_count;
5453 uint32_t bl_pwm, fractional_duty_cycle_en;
5554 uint32_t bl_period_mask, bl_pwm_mask;
@@ -84,15 +83,6 @@ static unsigned int dce_get_16_bit_backlight_from_pwm(struct panel_cntl *panel_c · 28 unmodified lines
8483 current_backlight = div_u64(current_backlight, bl_period);
8584 current_backlight = (current_backlight + 1) >> 1;
8685
87− current_backlight = (uint64_t)(current_backlight) * bl_period;
88−
89− round_result = (uint32_t)(current_backlight & 0xFFFFFFFF);
90−
91− round_result = (round_result >> (bl_int_count-1)) & 1;
92−
93− current_backlight >>= bl_int_count;
94− current_backlight += round_result;
95−
9686 return (uint32_t)(current_backlight);
9787 }
9888
drivers/gpu/drm/amd/pm/inc/smu11_driver_if_cyan_skillfish.h+35−51
@@ -33,63 +33,47 @@ · 32 unmodified lines
3333 #define TABLE_PMSTATUSLOG 3 // Called by Tools for Agm logging
3434 #define TABLE_DPMCLOCKS 4 // Called by Driver; defined here, but not used, for backward compatible
3535 #define TABLE_MOMENTARY_PM 5 // Called by Tools; defined here, but not used, for backward compatible
36−#define TABLE_COUNT 6
36+#define TABLE_SMU_METRICS 6 // Called by Driver
37+#define TABLE_COUNT 7
3738
38−#define NUM_DSPCLK_LEVELS 8
39−#define NUM_SOCCLK_DPM_LEVELS 8
40−#define NUM_DCEFCLK_DPM_LEVELS 4
41−#define NUM_FCLK_DPM_LEVELS 4
42−#define NUM_MEMCLK_DPM_LEVELS 4
39+typedef struct SmuMetricsTable_t {
40+ //CPU status
41+ uint16_t CoreFrequency[6]; //[MHz]
42+ uint32_t CorePower[6]; //[mW]
43+ uint16_t CoreTemperature[6]; //[centi-Celsius]
44+ uint16_t L3Frequency[2]; //[MHz]
45+ uint16_t L3Temperature[2]; //[centi-Celsius]
46+ uint16_t C0Residency[6]; //Percentage
4347
44−#define NUMBER_OF_PSTATES 8
45−#define NUMBER_OF_CORES 8
48+ // GFX status
49+ uint16_t GfxclkFrequency; //[MHz]
50+ uint16_t GfxTemperature; //[centi-Celsius]
4651
47−typedef enum {
48− S3_TYPE_ENTRY,
49− S5_TYPE_ENTRY,
50−} Sleep_Type_e;
52+ // SOC IP info
53+ uint16_t SocclkFrequency; //[MHz]
54+ uint16_t VclkFrequency; //[MHz]
55+ uint16_t DclkFrequency; //[MHz]
56+ uint16_t MemclkFrequency; //[MHz]
5157
52−typedef enum {
53− GFX_OFF = 0,
54− GFX_ON = 1,
55−} GFX_Mode_e;
58+ // power, VF info for CPU/GFX telemetry rails, and then socket power total
59+ uint32_t Voltage[2]; //[mV] indices: VDDCR_VDD, VDDCR_GFX
60+ uint32_t Current[2]; //[mA] indices: VDDCR_VDD, VDDCR_GFX
61+ uint32_t Power[2]; //[mW] indices: VDDCR_VDD, VDDCR_GFX
62+ uint32_t CurrentSocketPower; //[mW]
5663
57−typedef enum {
58− CPU_P0 = 0,
59− CPU_P1,
60− CPU_P2,
61− CPU_P3,
62− CPU_P4,
63− CPU_P5,
64− CPU_P6,
65− CPU_P7
66−} CPU_PState_e;
64+ uint16_t SocTemperature; //[centi-Celsius]
65+ uint16_t EdgeTemperature;
66+ uint16_t ThrottlerStatus;
67+ uint16_t Spare;
6768
68−typedef enum {
69− CPU_CORE0 = 0,
70− CPU_CORE1,
71− CPU_CORE2,
72− CPU_CORE3,
73− CPU_CORE4,
74− CPU_CORE5,
75− CPU_CORE6,
76− CPU_CORE7
77−} CORE_ID_e;
69+} SmuMetricsTable_t;
7870
79−typedef enum {
80− DF_DPM0 = 0,
81− DF_DPM1,
82− DF_DPM2,
83− DF_DPM3,
84− DF_PState_Count
85−} DF_PState_e;
86−
87−typedef enum {
88− GFX_DPM0 = 0,
89− GFX_DPM1,
90− GFX_DPM2,
91− GFX_DPM3,
92− GFX_PState_Count
93−} GFX_PState_e;
71+typedef struct SmuMetrics_t {
72+ SmuMetricsTable_t Current;
73+ SmuMetricsTable_t Average;
74+ uint32_t SampleStartTime;
75+ uint32_t SampleStopTime;
76+ uint32_t Accnt;
77+} SmuMetrics_t;
9478
9579 #endif
drivers/gpu/drm/amd/pm/inc/smu_types.h+4−1
@@ -226,7 +226,10 @@ · 225 unmodified lines
226226 __SMU_DUMMY_MAP(SetUclkDpmMode), \
227227 __SMU_DUMMY_MAP(LightSBR), \
228228 __SMU_DUMMY_MAP(GfxDriverResetRecovery), \
229− __SMU_DUMMY_MAP(BoardPowerCalibration),
229+ __SMU_DUMMY_MAP(BoardPowerCalibration), \
230+ __SMU_DUMMY_MAP(RequestGfxclk), \
231+ __SMU_DUMMY_MAP(ForceGfxVid), \
232+ __SMU_DUMMY_MAP(UnforceGfxVid),
230233
231234 #undef __SMU_DUMMY_MAP
232235 #define __SMU_DUMMY_MAP(type) SMU_MSG_##type
drivers/gpu/drm/amd/pm/inc/smu_v11_8_ppsmc.h+8−1
@@ -65,6 +65,13 @@ · 64 unmodified lines
6565 #define PPSMC_MSG_SetDriverTableVMID 0x34
6666 #define PPSMC_MSG_SetSoftMinCclk 0x35
6767 #define PPSMC_MSG_SetSoftMaxCclk 0x36
68−#define PPSMC_Message_Count 0x37
68+#define PPSMC_MSG_GetGfxFrequency 0x37
69+#define PPSMC_MSG_GetGfxVid 0x38
70+#define PPSMC_MSG_ForceGfxFreq 0x39
71+#define PPSMC_MSG_UnForceGfxFreq 0x3A
72+#define PPSMC_MSG_ForceGfxVid 0x3B
73+#define PPSMC_MSG_UnforceGfxVid 0x3C
74+#define PPSMC_MSG_GetEnabledSmuFeatures 0x3D
75+#define PPSMC_Message_Count 0x3E
6976
7077 #endif
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c+1−1
@@ -1404,7 +1404,7 @@ static int smu_disable_dpms(struct smu_context *smu) · 1403 unmodified lines
14041404 */
14051405 if (smu->uploading_custom_pp_table &&
14061406 (adev->asic_type >= CHIP_NAVI10) &&
1407− (adev->asic_type <= CHIP_DIMGREY_CAVEFISH))
1407+ (adev->asic_type <= CHIP_BEIGE_GOBY))
14081408 return smu_disable_all_features_with_exception(smu,
14091409 true,
14101410 SMU_FEATURE_COUNT);
drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c+6−2
@@ -771,8 +771,12 @@ static int arcturus_print_clk_levels(struct smu_context *smu, · 770 unmodified lines
771771 struct smu_11_0_dpm_context *dpm_context = NULL;
772772 uint32_t gen_speed, lane_width;
773773
774− if (amdgpu_ras_intr_triggered())
775− return sysfs_emit(buf, "unavailable\n");
774+ smu_cmn_get_sysfs_buf(&buf, &size);
775+
776+ if (amdgpu_ras_intr_triggered()) {
777+ size += sysfs_emit_at(buf, size, "unavailable\n");
778+ return size;
779+ }
776780
777781 dpm_context = smu_dpm->dpm_context;
778782
drivers/gpu/drm/amd/pm/swsmu/smu11/cyan_skillfish_ppt.c+481−0
@@ -44,6 +44,27 @@ · 43 unmodified lines
4444 #undef pr_info
4545 #undef pr_debug
4646
47+/* unit: MHz */
48+#define CYAN_SKILLFISH_SCLK_MIN 1000
49+#define CYAN_SKILLFISH_SCLK_MAX 2000
50+#define CYAN_SKILLFISH_SCLK_DEFAULT 1800
51+
52+/* unit: mV */
53+#define CYAN_SKILLFISH_VDDC_MIN 700
54+#define CYAN_SKILLFISH_VDDC_MAX 1129
55+#define CYAN_SKILLFISH_VDDC_MAGIC 5118 // 0x13fe
56+
57+static struct gfx_user_settings {
58+ uint32_t sclk;
59+ uint32_t vddc;
60+} cyan_skillfish_user_settings;
61+
62+#define FEATURE_MASK(feature) (1ULL << feature)
63+#define SMC_DPM_FEATURE ( \
64+ FEATURE_MASK(FEATURE_FCLK_DPM_BIT) | \
65+ FEATURE_MASK(FEATURE_SOC_DPM_BIT) | \
66+ FEATURE_MASK(FEATURE_GFX_DPM_BIT))
67+
4768 static struct cmn2asic_msg_mapping cyan_skillfish_message_map[SMU_MSG_MAX_COUNT] = {
4869 MSG_MAP(TestMessage, PPSMC_MSG_TestMessage, 0),
4970 MSG_MAP(GetSmuVersion, PPSMC_MSG_GetSmuVersion, 0),
@@ -52,14 +73,473 @@ static struct cmn2asic_msg_mapping cyan_skillfish_message_map[SMU_MSG_MAX_COUNT] · 2 unmodified lines
5273 MSG_MAP(SetDriverDramAddrLow, PPSMC_MSG_SetDriverTableDramAddrLow, 0),
5374 MSG_MAP(TransferTableSmu2Dram, PPSMC_MSG_TransferTableSmu2Dram, 0),
5475 MSG_MAP(TransferTableDram2Smu, PPSMC_MSG_TransferTableDram2Smu, 0),
76+ MSG_MAP(GetEnabledSmuFeatures, PPSMC_MSG_GetEnabledSmuFeatures, 0),
77+ MSG_MAP(RequestGfxclk, PPSMC_MSG_RequestGfxclk, 0),
78+ MSG_MAP(ForceGfxVid, PPSMC_MSG_ForceGfxVid, 0),
79+ MSG_MAP(UnforceGfxVid, PPSMC_MSG_UnforceGfxVid, 0),
80+};
81+
82+static struct cmn2asic_mapping cyan_skillfish_table_map[SMU_TABLE_COUNT] = {
83+ TAB_MAP_VALID(SMU_METRICS),
5584 };
5685
86+static int cyan_skillfish_tables_init(struct smu_context *smu)
87+{
88+ struct smu_table_context *smu_table = &smu->smu_table;
89+ struct smu_table *tables = smu_table->tables;
90+
91+ SMU_TABLE_INIT(tables, SMU_TABLE_SMU_METRICS,
92+ sizeof(SmuMetrics_t),
93+ PAGE_SIZE,
94+ AMDGPU_GEM_DOMAIN_VRAM);
95+
96+ smu_table->metrics_table = kzalloc(sizeof(SmuMetrics_t), GFP_KERNEL);
97+ if (!smu_table->metrics_table)
98+ goto err0_out;
99+
100+ smu_table->gpu_metrics_table_size = sizeof(struct gpu_metrics_v2_2);
101+ smu_table->gpu_metrics_table = kzalloc(smu_table->gpu_metrics_table_size, GFP_KERNEL);
102+ if (!smu_table->gpu_metrics_table)
103+ goto err1_out;
104+
105+ smu_table->metrics_time = 0;
106+
107+ return 0;
108+
109+err1_out:
110+ smu_table->gpu_metrics_table_size = 0;
111+ kfree(smu_table->metrics_table);
112+err0_out:
113+ return -ENOMEM;
114+}
115+
116+static int cyan_skillfish_init_smc_tables(struct smu_context *smu)
117+{
118+ int ret = 0;
119+
120+ ret = cyan_skillfish_tables_init(smu);
121+ if (ret)
122+ return ret;
123+
124+ return smu_v11_0_init_smc_tables(smu);
125+}
126+
127+static int cyan_skillfish_finit_smc_tables(struct smu_context *smu)
128+{
129+ struct smu_table_context *smu_table = &smu->smu_table;
130+
131+ kfree(smu_table->metrics_table);
132+ smu_table->metrics_table = NULL;
133+
134+ kfree(smu_table->gpu_metrics_table);
135+ smu_table->gpu_metrics_table = NULL;
136+ smu_table->gpu_metrics_table_size = 0;
137+
138+ smu_table->metrics_time = 0;
139+
140+ return 0;
141+}
142+
143+static int
144+cyan_skillfish_get_smu_metrics_data(struct smu_context *smu,
145+ MetricsMember_t member,
146+ uint32_t *value)
147+{
148+ struct smu_table_context *smu_table = &smu->smu_table;
149+ SmuMetrics_t *metrics = (SmuMetrics_t *)smu_table->metrics_table;
150+ int ret = 0;
151+
152+ mutex_lock(&smu->metrics_lock);
153+
154+ ret = smu_cmn_get_metrics_table_locked(smu, NULL, false);
155+ if (ret) {
156+ mutex_unlock(&smu->metrics_lock);
157+ return ret;
158+ }
159+
160+ switch (member) {
161+ case METRICS_CURR_GFXCLK:
162+ *value = metrics->Current.GfxclkFrequency;
163+ break;
164+ case METRICS_CURR_SOCCLK:
165+ *value = metrics->Current.SocclkFrequency;
166+ break;
167+ case METRICS_CURR_VCLK:
168+ *value = metrics->Current.VclkFrequency;
169+ break;
170+ case METRICS_CURR_DCLK:
171+ *value = metrics->Current.DclkFrequency;
172+ break;
173+ case METRICS_CURR_UCLK:
174+ *value = metrics->Current.MemclkFrequency;
175+ break;
176+ case METRICS_AVERAGE_SOCKETPOWER:
177+ *value = (metrics->Current.CurrentSocketPower << 8) /
178+ 1000;
179+ break;
180+ case METRICS_TEMPERATURE_EDGE:
181+ *value = metrics->Current.GfxTemperature / 100 *
182+ SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
183+ break;
184+ case METRICS_TEMPERATURE_HOTSPOT:
185+ *value = metrics->Current.SocTemperature / 100 *
186+ SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
187+ break;
188+ case METRICS_VOLTAGE_VDDSOC:
189+ *value = metrics->Current.Voltage[0];
190+ break;
191+ case METRICS_VOLTAGE_VDDGFX:
192+ *value = metrics->Current.Voltage[1];
193+ break;
194+ case METRICS_THROTTLER_STATUS:
195+ *value = metrics->Current.ThrottlerStatus;
196+ break;
197+ default:
198+ *value = UINT_MAX;
199+ break;
200+ }
201+
202+ mutex_unlock(&smu->metrics_lock);
203+
204+ return ret;
205+}
206+
207+static int cyan_skillfish_read_sensor(struct smu_context *smu,
208+ enum amd_pp_sensors sensor,
209+ void *data,
210+ uint32_t *size)
211+{
212+ int ret = 0;
213+
214+ if (!data || !size)
215+ return -EINVAL;
216+
217+ mutex_lock(&smu->sensor_lock);
218+
219+ switch (sensor) {
220+ case AMDGPU_PP_SENSOR_GFX_SCLK:
221+ ret = cyan_skillfish_get_smu_metrics_data(smu,
222+ METRICS_CURR_GFXCLK,
223+ (uint32_t *)data);
224+ *(uint32_t *)data *= 100;
225+ *size = 4;
226+ break;
227+ case AMDGPU_PP_SENSOR_GFX_MCLK:
228+ ret = cyan_skillfish_get_smu_metrics_data(smu,
229+ METRICS_CURR_UCLK,
230+ (uint32_t *)data);
231+ *(uint32_t *)data *= 100;
232+ *size = 4;
233+ break;
234+ case AMDGPU_PP_SENSOR_GPU_POWER:
235+ ret = cyan_skillfish_get_smu_metrics_data(smu,
236+ METRICS_AVERAGE_SOCKETPOWER,
237+ (uint32_t *)data);
238+ *size = 4;
239+ break;
240+ case AMDGPU_PP_SENSOR_HOTSPOT_TEMP:
241+ ret = cyan_skillfish_get_smu_metrics_data(smu,
242+ METRICS_TEMPERATURE_HOTSPOT,
243+ (uint32_t *)data);
244+ *size = 4;
245+ break;
246+ case AMDGPU_PP_SENSOR_EDGE_TEMP:
247+ ret = cyan_skillfish_get_smu_metrics_data(smu,
248+ METRICS_TEMPERATURE_EDGE,
249+ (uint32_t *)data);
250+ *size = 4;
251+ break;
252+ case AMDGPU_PP_SENSOR_VDDNB:
253+ ret = cyan_skillfish_get_smu_metrics_data(smu,
254+ METRICS_VOLTAGE_VDDSOC,
255+ (uint32_t *)data);
256+ *size = 4;
257+ break;
258+ case AMDGPU_PP_SENSOR_VDDGFX:
259+ ret = cyan_skillfish_get_smu_metrics_data(smu,
260+ METRICS_VOLTAGE_VDDGFX,
261+ (uint32_t *)data);
262+ *size = 4;
263+ break;
264+ default:
265+ ret = -EOPNOTSUPP;
266+ break;
267+ }
268+
269+ mutex_unlock(&smu->sensor_lock);
270+
271+ return ret;
272+}
273+
274+static int cyan_skillfish_get_current_clk_freq(struct smu_context *smu,
275+ enum smu_clk_type clk_type,
276+ uint32_t *value)
277+{
278+ MetricsMember_t member_type;
279+
280+ switch (clk_type) {
281+ case SMU_GFXCLK:
282+ case SMU_SCLK:
283+ member_type = METRICS_CURR_GFXCLK;
284+ break;
285+ case SMU_FCLK:
286+ case SMU_MCLK:
287+ member_type = METRICS_CURR_UCLK;
288+ break;
289+ case SMU_SOCCLK:
290+ member_type = METRICS_CURR_SOCCLK;
291+ break;
292+ case SMU_VCLK:
293+ member_type = METRICS_CURR_VCLK;
294+ break;
295+ case SMU_DCLK:
296+ member_type = METRICS_CURR_DCLK;
297+ break;
298+ default:
299+ return -EINVAL;
300+ }
301+
302+ return cyan_skillfish_get_smu_metrics_data(smu, member_type, value);
303+}
304+
305+static int cyan_skillfish_print_clk_levels(struct smu_context *smu,
306+ enum smu_clk_type clk_type,
307+ char *buf)
308+{
309+ int ret = 0, size = 0;
310+ uint32_t cur_value = 0;
311+
312+ smu_cmn_get_sysfs_buf(&buf, &size);
313+
314+ switch (clk_type) {
315+ case SMU_OD_SCLK:
316+ ret = cyan_skillfish_get_smu_metrics_data(smu, METRICS_CURR_GFXCLK, &cur_value);
317+ if (ret)
318+ return ret;
319+ size += sysfs_emit_at(buf, size,"%s:\n", "OD_SCLK");
320+ size += sysfs_emit_at(buf, size, "0: %uMhz *\n", cur_value);
321+ break;
322+ case SMU_OD_VDDC_CURVE:
323+ ret = cyan_skillfish_get_smu_metrics_data(smu, METRICS_VOLTAGE_VDDGFX, &cur_value);
324+ if (ret)
325+ return ret;
326+ size += sysfs_emit_at(buf, size,"%s:\n", "OD_VDDC");
327+ size += sysfs_emit_at(buf, size, "0: %umV *\n", cur_value);
328+ break;
329+ case SMU_OD_RANGE:
330+ size += sysfs_emit_at(buf, size, "%s:\n", "OD_RANGE");
331+ size += sysfs_emit_at(buf, size, "SCLK: %7uMhz %10uMhz\n",
332+ CYAN_SKILLFISH_SCLK_MIN, CYAN_SKILLFISH_SCLK_MAX);
333+ size += sysfs_emit_at(buf, size, "VDDC: %7umV %10umV\n",
334+ CYAN_SKILLFISH_VDDC_MIN, CYAN_SKILLFISH_VDDC_MAX);
335+ break;
336+ case SMU_GFXCLK:
337+ case SMU_SCLK:
338+ case SMU_FCLK:
339+ case SMU_MCLK:
340+ case SMU_SOCCLK:
341+ case SMU_VCLK:
342+ case SMU_DCLK:
343+ ret = cyan_skillfish_get_current_clk_freq(smu, clk_type, &cur_value);
344+ if (ret)
345+ return ret;
346+ size += sysfs_emit_at(buf, size, "0: %uMhz *\n", cur_value);
347+ break;
348+ default:
349+ dev_warn(smu->adev->dev, "Unsupported clock type\n");
350+ return ret;
351+ }
352+
353+ return size;
354+}
355+
356+static bool cyan_skillfish_is_dpm_running(struct smu_context *smu)
357+{
358+ struct amdgpu_device *adev = smu->adev;
359+ int ret = 0;
360+ uint32_t feature_mask[2];
361+ uint64_t feature_enabled;
362+
363+ /* we need to re-init after suspend so return false */
364+ if (adev->in_suspend)
365+ return false;
366+
367+ ret = smu_cmn_get_enabled_32_bits_mask(smu, feature_mask, 2);
368+
369+ if (ret)
370+ return false;
371+
372+ feature_enabled = (uint64_t)feature_mask[0] |
373+ ((uint64_t)feature_mask[1] << 32);
374+
375+ return !!(feature_enabled & SMC_DPM_FEATURE);
376+}
377+
378+static ssize_t cyan_skillfish_get_gpu_metrics(struct smu_context *smu,
379+ void **table)
380+{
381+ struct smu_table_context *smu_table = &smu->smu_table;
382+ struct gpu_metrics_v2_2 *gpu_metrics =
383+ (struct gpu_metrics_v2_2 *)smu_table->gpu_metrics_table;
384+ SmuMetrics_t metrics;
385+ int i, ret = 0;
386+
387+ ret = smu_cmn_get_metrics_table(smu, &metrics, true);
388+ if (ret)
389+ return ret;
390+
391+ smu_cmn_init_soft_gpu_metrics(gpu_metrics, 2, 2);
392+
393+ gpu_metrics->temperature_gfx = metrics.Current.GfxTemperature;
394+ gpu_metrics->temperature_soc = metrics.Current.SocTemperature;
395+
396+ gpu_metrics->average_socket_power = metrics.Current.CurrentSocketPower;
397+ gpu_metrics->average_soc_power = metrics.Current.Power[0];
398+ gpu_metrics->average_gfx_power = metrics.Current.Power[1];
399+
400+ gpu_metrics->average_gfxclk_frequency = metrics.Average.GfxclkFrequency;
401+ gpu_metrics->average_socclk_frequency = metrics.Average.SocclkFrequency;
402+ gpu_metrics->average_uclk_frequency = metrics.Average.MemclkFrequency;
403+ gpu_metrics->average_fclk_frequency = metrics.Average.MemclkFrequency;
404+ gpu_metrics->average_vclk_frequency = metrics.Average.VclkFrequency;
405+ gpu_metrics->average_dclk_frequency = metrics.Average.DclkFrequency;
406+
407+ gpu_metrics->current_gfxclk = metrics.Current.GfxclkFrequency;
408+ gpu_metrics->current_socclk = metrics.Current.SocclkFrequency;
409+ gpu_metrics->current_uclk = metrics.Current.MemclkFrequency;
410+ gpu_metrics->current_fclk = metrics.Current.MemclkFrequency;
411+ gpu_metrics->current_vclk = metrics.Current.VclkFrequency;
412+ gpu_metrics->current_dclk = metrics.Current.DclkFrequency;
413+
414+ for (i = 0; i < 6; i++) {
415+ gpu_metrics->temperature_core[i] = metrics.Current.CoreTemperature[i];
416+ gpu_metrics->average_core_power[i] = metrics.Average.CorePower[i];
417+ gpu_metrics->current_coreclk[i] = metrics.Current.CoreFrequency[i];
418+ }
419+
420+ for (i = 0; i < 2; i++) {
421+ gpu_metrics->temperature_l3[i] = metrics.Current.L3Temperature[i];
422+ gpu_metrics->current_l3clk[i] = metrics.Current.L3Frequency[i];
423+ }
424+
425+ gpu_metrics->throttle_status = metrics.Current.ThrottlerStatus;
426+ gpu_metrics->system_clock_counter = ktime_get_boottime_ns();
427+
428+ *table = (void *)gpu_metrics;
429+
430+ return sizeof(struct gpu_metrics_v2_2);
431+}
432+
433+static int cyan_skillfish_od_edit_dpm_table(struct smu_context *smu,
434+ enum PP_OD_DPM_TABLE_COMMAND type,
435+ long input[], uint32_t size)
436+{
437+ int ret = 0;
438+ uint32_t vid;
439+
440+ switch (type) {
441+ case PP_OD_EDIT_VDDC_CURVE:
442+ if (size != 3 || input[0] != 0) {
443+ dev_err(smu->adev->dev, "Invalid parameter!\n");
444+ return -EINVAL;
445+ }
446+
447+ if (input[1] <= CYAN_SKILLFISH_SCLK_MIN ||
448+ input[1] > CYAN_SKILLFISH_SCLK_MAX) {
449+ dev_err(smu->adev->dev, "Invalid sclk! Valid sclk range: %uMHz - %uMhz\n",
450+ CYAN_SKILLFISH_SCLK_MIN, CYAN_SKILLFISH_SCLK_MAX);
451+ return -EINVAL;
452+ }
453+
454+ if (input[2] <= CYAN_SKILLFISH_VDDC_MIN ||
455+ input[2] > CYAN_SKILLFISH_VDDC_MAX) {
456+ dev_err(smu->adev->dev, "Invalid vddc! Valid vddc range: %umV - %umV\n",
457+ CYAN_SKILLFISH_VDDC_MIN, CYAN_SKILLFISH_VDDC_MAX);
458+ return -EINVAL;
459+ }
460+
461+ cyan_skillfish_user_settings.sclk = input[1];
462+ cyan_skillfish_user_settings.vddc = input[2];
463+
464+ break;
465+ case PP_OD_RESTORE_DEFAULT_TABLE:
466+ if (size != 0) {
467+ dev_err(smu->adev->dev, "Invalid parameter!\n");
468+ return -EINVAL;
469+ }
470+
471+ cyan_skillfish_user_settings.sclk = CYAN_SKILLFISH_SCLK_DEFAULT;
472+ cyan_skillfish_user_settings.vddc = CYAN_SKILLFISH_VDDC_MAGIC;
473+
474+ break;
475+ case PP_OD_COMMIT_DPM_TABLE:
476+ if (size != 0) {
477+ dev_err(smu->adev->dev, "Invalid parameter!\n");
478+ return -EINVAL;
479+ }
480+
481+ if (cyan_skillfish_user_settings.sclk < CYAN_SKILLFISH_SCLK_MIN ||
482+ cyan_skillfish_user_settings.sclk > CYAN_SKILLFISH_SCLK_MAX) {
483+ dev_err(smu->adev->dev, "Invalid sclk! Valid sclk range: %uMHz - %uMhz\n",
484+ CYAN_SKILLFISH_SCLK_MIN, CYAN_SKILLFISH_SCLK_MAX);
485+ return -EINVAL;
486+ }
487+
488+ if ((cyan_skillfish_user_settings.vddc != CYAN_SKILLFISH_VDDC_MAGIC) &&
489+ (cyan_skillfish_user_settings.vddc < CYAN_SKILLFISH_VDDC_MIN ||
490+ cyan_skillfish_user_settings.vddc > CYAN_SKILLFISH_VDDC_MAX)) {
491+ dev_err(smu->adev->dev, "Invalid vddc! Valid vddc range: %umV - %umV\n",
492+ CYAN_SKILLFISH_VDDC_MIN, CYAN_SKILLFISH_VDDC_MAX);
493+ return -EINVAL;
494+ }
495+
496+ ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_RequestGfxclk,
497+ cyan_skillfish_user_settings.sclk, NULL);
498+ if (ret) {
499+ dev_err(smu->adev->dev, "Set sclk failed!\n");
500+ return ret;
501+ }
502+
503+ if (cyan_skillfish_user_settings.vddc == CYAN_SKILLFISH_VDDC_MAGIC) {
504+ ret = smu_cmn_send_smc_msg(smu, SMU_MSG_UnforceGfxVid, NULL);
505+ if (ret) {
506+ dev_err(smu->adev->dev, "Unforce vddc failed!\n");
507+ return ret;
508+ }
509+ } else {
510+ /*
511+ * PMFW accepts SVI2 VID code, convert voltage to VID:
512+ * vid = (uint32_t)((1.55 - voltage) * 160.0 + 0.00001)
513+ */
514+ vid = (1550 - cyan_skillfish_user_settings.vddc) * 160 / 1000;
515+ ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_ForceGfxVid, vid, NULL);
516+ if (ret) {
517+ dev_err(smu->adev->dev, "Force vddc failed!\n");
518+ return ret;
519+ }
520+ }
521+
522+ break;
523+ default:
524+ return -EOPNOTSUPP;
525+ }
526+
527+ return ret;
528+}
529+
57530 static const struct pptable_funcs cyan_skillfish_ppt_funcs = {
58531
59532 .check_fw_status = smu_v11_0_check_fw_status,
60533 .check_fw_version = smu_v11_0_check_fw_version,
61534 .init_power = smu_v11_0_init_power,
62535 .fini_power = smu_v11_0_fini_power,
536+ .init_smc_tables = cyan_skillfish_init_smc_tables,
537+ .fini_smc_tables = cyan_skillfish_finit_smc_tables,
538+ .read_sensor = cyan_skillfish_read_sensor,
539+ .print_clk_levels = cyan_skillfish_print_clk_levels,
540+ .is_dpm_running = cyan_skillfish_is_dpm_running,
541+ .get_gpu_metrics = cyan_skillfish_get_gpu_metrics,
542+ .od_edit_dpm_table = cyan_skillfish_od_edit_dpm_table,
63543 .register_irq_handler = smu_v11_0_register_irq_handler,
64544 .notify_memory_pool_location = smu_v11_0_notify_memory_pool_location,
65545 .send_smc_msg_with_param = smu_cmn_send_smc_msg_with_param,
@@ -72,5 +552,6 @@ void cyan_skillfish_set_ppt_funcs(struct smu_context *smu) · 6 unmodified lines
72552 {
73553 smu->ppt_funcs = &cyan_skillfish_ppt_funcs;
74554 smu->message_map = cyan_skillfish_message_map;
555+ smu->table_map = cyan_skillfish_table_map;
75556 smu->is_apu = true;
76557 }
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c+25−3
@@ -1279,6 +1279,8 @@ static int navi10_print_clk_levels(struct smu_context *smu, · 1278 unmodified lines
12791279 struct smu_11_0_overdrive_table *od_settings = smu->od_settings;
12801280 uint32_t min_value, max_value;
12811281
1282+ smu_cmn_get_sysfs_buf(&buf, &size);
1283+
12821284 switch (clk_type) {
12831285 case SMU_GFXCLK:
12841286 case SMU_SCLK:
@@ -1392,7 +1394,7 @@ static int navi10_print_clk_levels(struct smu_context *smu, · 107 unmodified lines
13921394 case SMU_OD_RANGE:
13931395 if (!smu->od_enabled || !od_table || !od_settings)
13941396 break;
1395− size = sysfs_emit(buf, "%s:\n", "OD_RANGE");
1397+ size += sysfs_emit_at(buf, size, "%s:\n", "OD_RANGE");
13961398
13971399 if (navi10_od_feature_is_supported(od_settings, SMU_11_0_ODCAP_GFXCLK_LIMITS)) {
13981400 navi10_od_setting_get_range(od_settings, SMU_11_0_ODSETTING_GFXCLKFMIN,
@@ -2272,7 +2274,27 @@ static int navi10_baco_enter(struct smu_context *smu) · 873 unmodified lines
22722274 {
22732275 struct amdgpu_device *adev = smu->adev;
22742276
2275− if (adev->in_runpm)
2277+ /*
2278+ * This aims the case below:
2279+ * amdgpu driver loaded -> runpm suspend kicked -> sound driver loaded
2280+ *
2281+ * For NAVI10 and later ASICs, we rely on PMFW to handle the runpm. To
2282+ * make that possible, PMFW needs to acknowledge the dstate transition
2283+ * process for both gfx(function 0) and audio(function 1) function of
2284+ * the ASIC.
2285+ *
2286+ * The PCI device's initial runpm status is RUNPM_SUSPENDED. So as the
2287+ * device representing the audio function of the ASIC. And that means
2288+ * even if the sound driver(snd_hda_intel) was not loaded yet, it's still
2289+ * possible runpm suspend kicked on the ASIC. However without the dstate
2290+ * transition notification from audio function, pmfw cannot handle the
2291+ * BACO in/exit correctly. And that will cause driver hang on runpm
2292+ * resuming.
2293+ *
2294+ * To address this, we revert to legacy message way(driver masters the
2295+ * timing for BACO in/exit) on sound driver missing.
2296+ */
2297+ if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev))
22762298 return smu_v11_0_baco_set_armd3_sequence(smu, BACO_SEQ_BACO);
22772299 else
22782300 return smu_v11_0_baco_enter(smu);
@@ -2282,7 +2304,7 @@ static int navi10_baco_exit(struct smu_context *smu) · 3 unmodified lines
22822304 {
22832305 struct amdgpu_device *adev = smu->adev;
22842306
2285− if (adev->in_runpm) {
2307+ if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev)) {
22862308 /* Wait for PMFW handling for the Dstate change */
22872309 msleep(10);
22882310 return smu_v11_0_baco_set_armd3_sequence(smu, BACO_SEQ_ULPS);
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c+5−3
@@ -1058,6 +1058,8 @@ static int sienna_cichlid_print_clk_levels(struct smu_context *smu, · 1057 unmodified lines
10581058 uint32_t min_value, max_value;
10591059 uint32_t smu_version;
10601060
1061+ smu_cmn_get_sysfs_buf(&buf, &size);
1062+
10611063 switch (clk_type) {
10621064 case SMU_GFXCLK:
10631065 case SMU_SCLK:
@@ -1180,7 +1182,7 @@ static int sienna_cichlid_print_clk_levels(struct smu_context *smu, · 116 unmodified lines
11801182 if (!smu->od_enabled || !od_table || !od_settings)
11811183 break;
11821184
1183− size = sysfs_emit(buf, "%s:\n", "OD_RANGE");
1185+ size += sysfs_emit_at(buf, size, "%s:\n", "OD_RANGE");
11841186
11851187 if (sienna_cichlid_is_od_feature_supported(od_settings, SMU_11_0_7_ODCAP_GFXCLK_LIMITS)) {
11861188 sienna_cichlid_get_od_setting_range(od_settings, SMU_11_0_7_ODSETTING_GFXCLKFMIN,
@@ -2187,7 +2189,7 @@ static int sienna_cichlid_baco_enter(struct smu_context *smu) · 1000 unmodified lines
21872189 {
21882190 struct amdgpu_device *adev = smu->adev;
21892191
2190− if (adev->in_runpm)
2192+ if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev))
21912193 return smu_v11_0_baco_set_armd3_sequence(smu, BACO_SEQ_BACO);
21922194 else
21932195 return smu_v11_0_baco_enter(smu);
@@ -2197,7 +2199,7 @@ static int sienna_cichlid_baco_exit(struct smu_context *smu) · 3 unmodified lines
21972199 {
21982200 struct amdgpu_device *adev = smu->adev;
21992201
2200− if (adev->in_runpm) {
2202+ if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev)) {
22012203 /* Wait for PMFW handling for the Dstate change */
22022204 msleep(10);
22032205 return smu_v11_0_baco_set_armd3_sequence(smu, BACO_SEQ_ULPS);
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c+10−6
@@ -589,10 +589,12 @@ static int vangogh_print_legacy_clk_levels(struct smu_context *smu, · 588 unmodified lines
589589 if (ret)
590590 return ret;
591591
592+ smu_cmn_get_sysfs_buf(&buf, &size);
593+
592594 switch (clk_type) {
593595 case SMU_OD_SCLK:
594596 if (smu_dpm_ctx->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL) {
595− size = sysfs_emit(buf, "%s:\n", "OD_SCLK");
597+ size += sysfs_emit_at(buf, size, "%s:\n", "OD_SCLK");
596598 size += sysfs_emit_at(buf, size, "0: %10uMhz\n",
597599 (smu->gfx_actual_hard_min_freq > 0) ? smu->gfx_actual_hard_min_freq : smu->gfx_default_hard_min_freq);
598600 size += sysfs_emit_at(buf, size, "1: %10uMhz\n",
@@ -601,7 +603,7 @@ static int vangogh_print_legacy_clk_levels(struct smu_context *smu, · 2 unmodified lines
601603 break;
602604 case SMU_OD_CCLK:
603605 if (smu_dpm_ctx->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL) {
604− size = sysfs_emit(buf, "CCLK_RANGE in Core%d:\n", smu->cpu_core_id_select);
606+ size += sysfs_emit_at(buf, size, "CCLK_RANGE in Core%d:\n", smu->cpu_core_id_select);
605607 size += sysfs_emit_at(buf, size, "0: %10uMhz\n",
606608 (smu->cpu_actual_soft_min_freq > 0) ? smu->cpu_actual_soft_min_freq : smu->cpu_default_soft_min_freq);
607609 size += sysfs_emit_at(buf, size, "1: %10uMhz\n",
@@ -610,7 +612,7 @@ static int vangogh_print_legacy_clk_levels(struct smu_context *smu, · 2 unmodified lines
610612 break;
611613 case SMU_OD_RANGE:
612614 if (smu_dpm_ctx->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL) {
613− size = sysfs_emit(buf, "%s:\n", "OD_RANGE");
615+ size += sysfs_emit_at(buf, size, "%s:\n", "OD_RANGE");
614616 size += sysfs_emit_at(buf, size, "SCLK: %7uMhz %10uMhz\n",
615617 smu->gfx_default_hard_min_freq, smu->gfx_default_soft_max_freq);
616618 size += sysfs_emit_at(buf, size, "CCLK: %7uMhz %10uMhz\n",
@@ -688,10 +690,12 @@ static int vangogh_print_clk_levels(struct smu_context *smu, · 71 unmodified lines
688690 if (ret)
689691 return ret;
690692
693+ smu_cmn_get_sysfs_buf(&buf, &size);
694+
691695 switch (clk_type) {
692696 case SMU_OD_SCLK:
693697 if (smu_dpm_ctx->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL) {
694− size = sysfs_emit(buf, "%s:\n", "OD_SCLK");
698+ size += sysfs_emit_at(buf, size, "%s:\n", "OD_SCLK");
695699 size += sysfs_emit_at(buf, size, "0: %10uMhz\n",
696700 (smu->gfx_actual_hard_min_freq > 0) ? smu->gfx_actual_hard_min_freq : smu->gfx_default_hard_min_freq);
697701 size += sysfs_emit_at(buf, size, "1: %10uMhz\n",
@@ -700,7 +704,7 @@ static int vangogh_print_clk_levels(struct smu_context *smu, · 2 unmodified lines
700704 break;
701705 case SMU_OD_CCLK:
702706 if (smu_dpm_ctx->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL) {
703− size = sysfs_emit(buf, "CCLK_RANGE in Core%d:\n", smu->cpu_core_id_select);
707+ size += sysfs_emit_at(buf, size, "CCLK_RANGE in Core%d:\n", smu->cpu_core_id_select);
704708 size += sysfs_emit_at(buf, size, "0: %10uMhz\n",
705709 (smu->cpu_actual_soft_min_freq > 0) ? smu->cpu_actual_soft_min_freq : smu->cpu_default_soft_min_freq);
706710 size += sysfs_emit_at(buf, size, "1: %10uMhz\n",
@@ -709,7 +713,7 @@ static int vangogh_print_clk_levels(struct smu_context *smu, · 2 unmodified lines
709713 break;
710714 case SMU_OD_RANGE:
711715 if (smu_dpm_ctx->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL) {
712− size = sysfs_emit(buf, "%s:\n", "OD_RANGE");
716+ size += sysfs_emit_at(buf, size, "%s:\n", "OD_RANGE");
713717 size += sysfs_emit_at(buf, size, "SCLK: %7uMhz %10uMhz\n",
714718 smu->gfx_default_hard_min_freq, smu->gfx_default_soft_max_freq);
715719 size += sysfs_emit_at(buf, size, "CCLK: %7uMhz %10uMhz\n",
drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c+2−0
@@ -497,6 +497,8 @@ static int renoir_print_clk_levels(struct smu_context *smu, · 496 unmodified lines
497497 if (ret)
498498 return ret;
499499
500+ smu_cmn_get_sysfs_buf(&buf, &size);
501+
500502 switch (clk_type) {
501503 case SMU_OD_RANGE:
502504 if (smu_dpm_ctx->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL) {
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c+8−4
@@ -733,15 +733,19 @@ static int aldebaran_print_clk_levels(struct smu_context *smu, · 732 unmodified lines
733733 uint32_t freq_values[3] = {0};
734734 uint32_t min_clk, max_clk;
735735
736− if (amdgpu_ras_intr_triggered())
737− return sysfs_emit(buf, "unavailable\n");
736+ smu_cmn_get_sysfs_buf(&buf, &size);
737+
738+ if (amdgpu_ras_intr_triggered()) {
739+ size += sysfs_emit_at(buf, size, "unavailable\n");
740+ return size;
741+ }
738742
739743 dpm_context = smu_dpm->dpm_context;
740744
741745 switch (type) {
742746
743747 case SMU_OD_SCLK:
744− size = sysfs_emit(buf, "%s:\n", "GFXCLK");
748+ size += sysfs_emit_at(buf, size, "%s:\n", "GFXCLK");
745749 fallthrough;
746750 case SMU_SCLK:
747751 ret = aldebaran_get_current_clk_freq_by_table(smu, SMU_GFXCLK, &now);
@@ -795,7 +799,7 @@ static int aldebaran_print_clk_levels(struct smu_context *smu, · 47 unmodified lines
795799 break;
796800
797801 case SMU_OD_MCLK:
798− size = sysfs_emit(buf, "%s:\n", "MCLK");
802+ size += sysfs_emit_at(buf, size, "%s:\n", "MCLK");
799803 fallthrough;
800804 case SMU_MCLK:
801805 ret = aldebaran_get_current_clk_freq_by_table(smu, SMU_UCLK, &now);
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c+4−2
@@ -1052,16 +1052,18 @@ static int yellow_carp_print_clk_levels(struct smu_context *smu, · 1051 unmodified lines
10521052 int i, size = 0, ret = 0;
10531053 uint32_t cur_value = 0, value = 0, count = 0;
10541054
1055+ smu_cmn_get_sysfs_buf(&buf, &size);
1056+
10551057 switch (clk_type) {
10561058 case SMU_OD_SCLK:
1057− size = sysfs_emit(buf, "%s:\n", "OD_SCLK");
1059+ size += sysfs_emit_at(buf, size, "%s:\n", "OD_SCLK");
10581060 size += sysfs_emit_at(buf, size, "0: %10uMhz\n",
10591061 (smu->gfx_actual_hard_min_freq > 0) ? smu->gfx_actual_hard_min_freq : smu->gfx_default_hard_min_freq);
10601062 size += sysfs_emit_at(buf, size, "1: %10uMhz\n",
10611063 (smu->gfx_actual_soft_max_freq > 0) ? smu->gfx_actual_soft_max_freq : smu->gfx_default_soft_max_freq);
10621064 break;
10631065 case SMU_OD_RANGE:
1064− size = sysfs_emit(buf, "%s:\n", "OD_RANGE");
1066+ size += sysfs_emit_at(buf, size, "%s:\n", "OD_RANGE");
10651067 size += sysfs_emit_at(buf, size, "SCLK: %7uMhz %10uMhz\n",
10661068 smu->gfx_default_hard_min_freq, smu->gfx_default_soft_max_freq);
10671069 break;
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c+21−0
@@ -1053,3 +1053,24 @@ int smu_cmn_set_mp1_state(struct smu_context *smu, · 1052 unmodified lines
10531053
10541054 return ret;
10551055 }
1056+
1057+bool smu_cmn_is_audio_func_enabled(struct amdgpu_device *adev)
1058+{
1059+ struct pci_dev *p = NULL;
1060+ bool snd_driver_loaded;
1061+
1062+ /*
1063+ * If the ASIC comes with no audio function, we always assume
1064+ * it is "enabled".
1065+ */
1066+ p = pci_get_domain_bus_and_slot(pci_domain_nr(adev->pdev->bus),
1067+ adev->pdev->bus->number, 1);
1068+ if (!p)
1069+ return true;
1070+
1071+ snd_driver_loaded = pci_is_enabled(p) ? true : false;
1072+
1073+ pci_dev_put(p);
1074+
1075+ return snd_driver_loaded;
1076+}
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h+15−0
@@ -110,5 +110,20 @@ void smu_cmn_init_soft_gpu_metrics(void *table, uint8_t frev, uint8_t crev); · 109 unmodified lines
110110 int smu_cmn_set_mp1_state(struct smu_context *smu,
111111 enum pp_mp1_state mp1_state);
112112
113+/*
114+ * Helper function to make sysfs_emit_at() happy. Align buf to
115+ * the current page boundary and record the offset.
116+ */
117+static inline void smu_cmn_get_sysfs_buf(char **buf, int *offset)
118+{
119+ if (!*buf || !offset)
120+ return;
121+
122+ *offset = offset_in_page(*buf);
123+ *buf -= *offset;
124+}
125+
126+bool smu_cmn_is_audio_func_enabled(struct amdgpu_device *adev);
127+
113128 #endif
114129 #endif
drivers/gpu/drm/etnaviv/etnaviv_buffer.c+1−2
@@ -397,8 +397,7 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, u32 exec_state, · 396 unmodified lines
397397 if (switch_mmu_context) {
398398 struct etnaviv_iommu_context *old_context = gpu->mmu_context;
399399
400− etnaviv_iommu_context_get(mmu_context);
401− gpu->mmu_context = mmu_context;
400+ gpu->mmu_context = etnaviv_iommu_context_get(mmu_context);
402401 etnaviv_iommu_context_put(old_context);
403402 }
404403
drivers/gpu/drm/etnaviv/etnaviv_gem.c+1−2
@@ -294,8 +294,7 @@ struct etnaviv_vram_mapping *etnaviv_gem_mapping_get( · 293 unmodified lines
294294 list_del(&mapping->obj_node);
295295 }
296296
297− etnaviv_iommu_context_get(mmu_context);
298− mapping->context = mmu_context;
297+ mapping->context = etnaviv_iommu_context_get(mmu_context);
299298 mapping->use = 1;
300299
301300 ret = etnaviv_iommu_map_gem(mmu_context, etnaviv_obj,
drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c+1−2
@@ -532,8 +532,7 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data, · 531 unmodified lines
532532 goto err_submit_objects;
533533
534534 submit->ctx = file->driver_priv;
535− etnaviv_iommu_context_get(submit->ctx->mmu);
536− submit->mmu_context = submit->ctx->mmu;
535+ submit->mmu_context = etnaviv_iommu_context_get(submit->ctx->mmu);
537536 submit->exec_state = args->exec_state;
538537 submit->flags = args->flags;
539538
drivers/gpu/drm/etnaviv/etnaviv_gpu.c+25−18
@@ -569,6 +569,12 @@ static int etnaviv_hw_reset(struct etnaviv_gpu *gpu) · 568 unmodified lines
569569 /* We rely on the GPU running, so program the clock */
570570 etnaviv_gpu_update_clock(gpu);
571571
572+ gpu->fe_running = false;
573+ gpu->exec_state = -1;
574+ if (gpu->mmu_context)
575+ etnaviv_iommu_context_put(gpu->mmu_context);
576+ gpu->mmu_context = NULL;
577+
572578 return 0;
573579 }
574580
@@ -637,19 +643,23 @@ void etnaviv_gpu_start_fe(struct etnaviv_gpu *gpu, u32 address, u16 prefetch) · 62 unmodified lines
637643 VIVS_MMUv2_SEC_COMMAND_CONTROL_ENABLE |
638644 VIVS_MMUv2_SEC_COMMAND_CONTROL_PREFETCH(prefetch));
639645 }
646+
647+ gpu->fe_running = true;
640648 }
641649
642−static void etnaviv_gpu_start_fe_idleloop(struct etnaviv_gpu *gpu)
650+static void etnaviv_gpu_start_fe_idleloop(struct etnaviv_gpu *gpu,
651+ struct etnaviv_iommu_context *context)
643652 {
644− u32 address = etnaviv_cmdbuf_get_va(&gpu->buffer,
645− &gpu->mmu_context->cmdbuf_mapping);
646653 u16 prefetch;
654+ u32 address;
647655
648656 /* setup the MMU */
649− etnaviv_iommu_restore(gpu, gpu->mmu_context);
657+ etnaviv_iommu_restore(gpu, context);
650658
651659 /* Start command processor */
652660 prefetch = etnaviv_buffer_init(gpu);
661+ address = etnaviv_cmdbuf_get_va(&gpu->buffer,
662+ &gpu->mmu_context->cmdbuf_mapping);
653663
654664 etnaviv_gpu_start_fe(gpu, address, prefetch);
655665 }
@@ -832,7 +842,6 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu) · 176 unmodified lines
832842 /* Now program the hardware */
833843 mutex_lock(&gpu->lock);
834844 etnaviv_gpu_hw_init(gpu);
835− gpu->exec_state = -1;
836845 mutex_unlock(&gpu->lock);
837846
838847 pm_runtime_mark_last_busy(gpu->dev);
@@ -1057,8 +1066,6 @@ void etnaviv_gpu_recover_hang(struct etnaviv_gpu *gpu) · 218 unmodified lines
10571066 spin_unlock(&gpu->event_spinlock);
10581067
10591068 etnaviv_gpu_hw_init(gpu);
1060− gpu->exec_state = -1;
1061− gpu->mmu_context = NULL;
10621069
10631070 mutex_unlock(&gpu->lock);
10641071 pm_runtime_mark_last_busy(gpu->dev);
@@ -1370,14 +1377,12 @@ struct dma_fence *etnaviv_gpu_submit(struct etnaviv_gem_submit *submit) · 305 unmodified lines
13701377 goto out_unlock;
13711378 }
13721379
1373− if (!gpu->mmu_context) {
1374− etnaviv_iommu_context_get(submit->mmu_context);
1375− gpu->mmu_context = submit->mmu_context;
1376− etnaviv_gpu_start_fe_idleloop(gpu);
1377− } else {
1378− etnaviv_iommu_context_get(gpu->mmu_context);
1379− submit->prev_mmu_context = gpu->mmu_context;
1380− }
1380+ if (!gpu->fe_running)
1381+ etnaviv_gpu_start_fe_idleloop(gpu, submit->mmu_context);
1382+
1383+ if (submit->prev_mmu_context)
1384+ etnaviv_iommu_context_put(submit->prev_mmu_context);
1385+ submit->prev_mmu_context = etnaviv_iommu_context_get(gpu->mmu_context);
13811386
13821387 if (submit->nr_pmrs) {
13831388 gpu->event[event[1]].sync_point = &sync_point_perfmon_sample_pre;
@@ -1579,7 +1584,7 @@ int etnaviv_gpu_wait_idle(struct etnaviv_gpu *gpu, unsigned int timeout_ms) · 195 unmodified lines
15791584
15801585 static int etnaviv_gpu_hw_suspend(struct etnaviv_gpu *gpu)
15811586 {
1582− if (gpu->initialized && gpu->mmu_context) {
1587+ if (gpu->initialized && gpu->fe_running) {
15831588 /* Replace the last WAIT with END */
15841589 mutex_lock(&gpu->lock);
15851590 etnaviv_buffer_end(gpu);
@@ -1592,8 +1597,7 @@ static int etnaviv_gpu_hw_suspend(struct etnaviv_gpu *gpu) · 6 unmodified lines
15921597 */
15931598 etnaviv_gpu_wait_idle(gpu, 100);
15941599
1595− etnaviv_iommu_context_put(gpu->mmu_context);
1596− gpu->mmu_context = NULL;
1600+ gpu->fe_running = false;
15971601 }
15981602
15991603 gpu->exec_state = -1;
@@ -1741,6 +1745,9 @@ static void etnaviv_gpu_unbind(struct device *dev, struct device *master, · 141 unmodified lines
17411745 etnaviv_gpu_hw_suspend(gpu);
17421746 #endif
17431747
1748+ if (gpu->mmu_context)
1749+ etnaviv_iommu_context_put(gpu->mmu_context);
1750+
17441751 if (gpu->initialized) {
17451752 etnaviv_cmdbuf_free(&gpu->buffer);
17461753 etnaviv_iommu_global_fini(gpu);
drivers/gpu/drm/etnaviv/etnaviv_gpu.h+1−0
@@ -101,6 +101,7 @@ struct etnaviv_gpu { · 100 unmodified lines
101101 struct workqueue_struct *wq;
102102 struct drm_gpu_scheduler sched;
103103 bool initialized;
104+ bool fe_running;
104105
105106 /* 'ring'-buffer: */
106107 struct etnaviv_cmdbuf buffer;
drivers/gpu/drm/etnaviv/etnaviv_iommu.c+4−0
@@ -92,6 +92,10 @@ static void etnaviv_iommuv1_restore(struct etnaviv_gpu *gpu, · 91 unmodified lines
9292 struct etnaviv_iommuv1_context *v1_context = to_v1_context(context);
9393 u32 pgtable;
9494
95+ if (gpu->mmu_context)
96+ etnaviv_iommu_context_put(gpu->mmu_context);
97+ gpu->mmu_context = etnaviv_iommu_context_get(context);
98+
9599 /* set base addresses */
96100 gpu_write(gpu, VIVS_MC_MEMORY_BASE_ADDR_RA, context->global->memory_base);
97101 gpu_write(gpu, VIVS_MC_MEMORY_BASE_ADDR_FE, context->global->memory_base);
drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c+8−0
@@ -172,6 +172,10 @@ static void etnaviv_iommuv2_restore_nonsec(struct etnaviv_gpu *gpu, · 171 unmodified lines
172172 if (gpu_read(gpu, VIVS_MMUv2_CONTROL) & VIVS_MMUv2_CONTROL_ENABLE)
173173 return;
174174
175+ if (gpu->mmu_context)
176+ etnaviv_iommu_context_put(gpu->mmu_context);
177+ gpu->mmu_context = etnaviv_iommu_context_get(context);
178+
175179 prefetch = etnaviv_buffer_config_mmuv2(gpu,
176180 (u32)v2_context->mtlb_dma,
177181 (u32)context->global->bad_page_dma);
@@ -192,6 +196,10 @@ static void etnaviv_iommuv2_restore_sec(struct etnaviv_gpu *gpu, · 14 unmodified lines
192196 if (gpu_read(gpu, VIVS_MMUv2_SEC_CONTROL) & VIVS_MMUv2_SEC_CONTROL_ENABLE)
193197 return;
194198
199+ if (gpu->mmu_context)
200+ etnaviv_iommu_context_put(gpu->mmu_context);
201+ gpu->mmu_context = etnaviv_iommu_context_get(context);
202+
195203 gpu_write(gpu, VIVS_MMUv2_PTA_ADDRESS_LOW,
196204 lower_32_bits(context->global->v2.pta_dma));
197205 gpu_write(gpu, VIVS_MMUv2_PTA_ADDRESS_HIGH,
drivers/gpu/drm/etnaviv/etnaviv_mmu.c+1−0
@@ -199,6 +199,7 @@ static int etnaviv_iommu_find_iova(struct etnaviv_iommu_context *context, · 198 unmodified lines
199199 */
200200 list_for_each_entry_safe(m, n, &list, scan_node) {
201201 etnaviv_iommu_remove_mapping(context, m);
202+ etnaviv_iommu_context_put(m->context);
202203 m->context = NULL;
203204 list_del_init(&m->mmu_node);
204205 list_del_init(&m->scan_node);
drivers/gpu/drm/etnaviv/etnaviv_mmu.h+3−1
@@ -105,9 +105,11 @@ void etnaviv_iommu_dump(struct etnaviv_iommu_context *ctx, void *buf); · 104 unmodified lines
105105 struct etnaviv_iommu_context *
106106 etnaviv_iommu_context_init(struct etnaviv_iommu_global *global,
107107 struct etnaviv_cmdbuf_suballoc *suballoc);
108−static inline void etnaviv_iommu_context_get(struct etnaviv_iommu_context *ctx)
108+static inline struct etnaviv_iommu_context *
109+etnaviv_iommu_context_get(struct etnaviv_iommu_context *ctx)
109110 {
110111 kref_get(&ctx->refcount);
112+ return ctx;
111113 }
112114 void etnaviv_iommu_context_put(struct etnaviv_iommu_context *ctx);
113115 void etnaviv_iommu_restore(struct etnaviv_gpu *gpu,
drivers/gpu/drm/i915/Makefile+0−1
@@ -19,7 +19,6 @@ subdir-ccflags-y += $(call cc-disable-warning, missing-field-initializers) · 18 unmodified lines
1919 subdir-ccflags-y += $(call cc-disable-warning, unused-but-set-variable)
2020 # clang warnings
2121 subdir-ccflags-y += $(call cc-disable-warning, sign-compare)
22−subdir-ccflags-y += $(call cc-disable-warning, sometimes-uninitialized)
2322 subdir-ccflags-y += $(call cc-disable-warning, initializer-overrides)
2423 subdir-ccflags-y += $(call cc-disable-warning, frame-address)
2524 subdir-ccflags-$(CONFIG_DRM_I915_WERROR) += -Werror
drivers/gpu/drm/i915/display/intel_dp.c+4−1
@@ -2445,11 +2445,14 @@ intel_edp_init_dpcd(struct intel_dp *intel_dp) · 2444 unmodified lines
24452445 */
24462446 if (drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV,
24472447 intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd)) ==
2448− sizeof(intel_dp->edp_dpcd))
2448+ sizeof(intel_dp->edp_dpcd)) {
24492449 drm_dbg_kms(&dev_priv->drm, "eDP DPCD: %*ph\n",
24502450 (int)sizeof(intel_dp->edp_dpcd),
24512451 intel_dp->edp_dpcd);
24522452
2453+ intel_dp->use_max_params = intel_dp->edp_dpcd[0] < DP_EDP_14;
2454+ }
2455+
24532456 /*
24542457 * This has to be called after intel_dp->edp_dpcd is filled, PSR checks
24552458 * for SET_POWER_CAPABLE bit in intel_dp->edp_dpcd[1]
drivers/gpu/drm/i915/display/intel_dp_link_training.c+1−1
@@ -848,7 +848,7 @@ intel_dp_link_train_all_phys(struct intel_dp *intel_dp, · 847 unmodified lines
848848 }
849849
850850 if (ret)
851− intel_dp_link_train_phy(intel_dp, crtc_state, DP_PHY_DPRX);
851+ ret = intel_dp_link_train_phy(intel_dp, crtc_state, DP_PHY_DPRX);
852852
853853 if (intel_dp->set_idle_link_train)
854854 intel_dp->set_idle_link_train(intel_dp, crtc_state);
drivers/gpu/drm/i915/gem/i915_gem_context.c+3−3
@@ -986,6 +986,9 @@ void i915_gem_context_release(struct kref *ref) · 985 unmodified lines
986986 trace_i915_context_free(ctx);
987987 GEM_BUG_ON(!i915_gem_context_is_closed(ctx));
988988
989+ if (ctx->syncobj)
990+ drm_syncobj_put(ctx->syncobj);
991+
989992 mutex_destroy(&ctx->engines_mutex);
990993 mutex_destroy(&ctx->lut_mutex);
991994
@@ -1205,9 +1208,6 @@ static void context_close(struct i915_gem_context *ctx) · 213 unmodified lines
12051208 if (vm)
12061209 i915_vm_close(vm);
12071210
1208− if (ctx->syncobj)
1209− drm_syncobj_put(ctx->syncobj);
1210−
12111211 ctx->file_priv = ERR_PTR(-EBADF);
12121212
12131213 /*
drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c+4−3
@@ -59,13 +59,13 @@ static int igt_dmabuf_import_self(void *arg) · 58 unmodified lines
5959 err = PTR_ERR(import);
6060 goto out_dmabuf;
6161 }
62+ import_obj = to_intel_bo(import);
6263
6364 if (import != &obj->base) {
6465 pr_err("i915_gem_prime_import created a new object!\n");
6566 err = -EINVAL;
6667 goto out_import;
6768 }
68− import_obj = to_intel_bo(import);
6969
7070 i915_gem_object_lock(import_obj, NULL);
7171 err = __i915_gem_object_get_pages(import_obj);
@@ -128,6 +128,8 @@ static int igt_dmabuf_import_same_driver_lmem(void *arg) · 56 unmodified lines
128128 pr_err("i915_gem_prime_import failed with the wrong err=%ld\n",
129129 PTR_ERR(import));
130130 err = PTR_ERR(import);
131+ } else {
132+ err = 0;
131133 }
132134
133135 dma_buf_put(dmabuf);
@@ -176,6 +178,7 @@ static int igt_dmabuf_import_same_driver(struct drm_i915_private *i915, · 42 unmodified lines
176178 err = PTR_ERR(import);
177179 goto out_dmabuf;
178180 }
181+ import_obj = to_intel_bo(import);
179182
180183 if (import == &obj->base) {
181184 pr_err("i915_gem_prime_import reused gem object!\n");
@@ -183,8 +186,6 @@ static int igt_dmabuf_import_same_driver(struct drm_i915_private *i915, · 1 unmodified line
183186 goto out_import;
184187 }
185188
186− import_obj = to_intel_bo(import);
187−
188189 i915_gem_object_lock(import_obj, NULL);
189190 err = __i915_gem_object_get_pages(import_obj);
190191 if (err) {
drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c+20−6
@@ -581,6 +581,20 @@ static enum i915_mmap_type default_mapping(struct drm_i915_private *i915) · 580 unmodified lines
581581 return I915_MMAP_TYPE_GTT;
582582 }
583583
584+static struct drm_i915_gem_object *
585+create_sys_or_internal(struct drm_i915_private *i915,
586+ unsigned long size)
587+{
588+ if (HAS_LMEM(i915)) {
589+ struct intel_memory_region *sys_region =
590+ i915->mm.regions[INTEL_REGION_SMEM];
591+
592+ return __i915_gem_object_create_user(i915, size, &sys_region, 1);
593+ }
594+
595+ return i915_gem_object_create_internal(i915, size);
596+}
597+
584598 static bool assert_mmap_offset(struct drm_i915_private *i915,
585599 unsigned long size,
586600 int expected)
@@ -589,7 +603,7 @@ static bool assert_mmap_offset(struct drm_i915_private *i915, · 2 unmodified lines
589603 u64 offset;
590604 int ret;
591605
592− obj = i915_gem_object_create_internal(i915, size);
606+ obj = create_sys_or_internal(i915, size);
593607 if (IS_ERR(obj))
594608 return expected && expected == PTR_ERR(obj);
595609
@@ -633,6 +647,7 @@ static int igt_mmap_offset_exhaustion(void *arg) · 37 unmodified lines
633647 struct drm_mm_node *hole, *next;
634648 int loop, err = 0;
635649 u64 offset;
650+ int enospc = HAS_LMEM(i915) ? -ENXIO : -ENOSPC;
636651
637652 /* Disable background reaper */
638653 disable_retire_worker(i915);
@@ -683,14 +698,14 @@ static int igt_mmap_offset_exhaustion(void *arg) · 44 unmodified lines
683698 }
684699
685700 /* Too large */
686− if (!assert_mmap_offset(i915, 2 * PAGE_SIZE, -ENOSPC)) {
701+ if (!assert_mmap_offset(i915, 2 * PAGE_SIZE, enospc)) {
687702 pr_err("Unexpectedly succeeded in inserting too large object into single page hole\n");
688703 err = -EINVAL;
689704 goto out;
690705 }
691706
692707 /* Fill the hole, further allocation attempts should then fail */
693− obj = i915_gem_object_create_internal(i915, PAGE_SIZE);
708+ obj = create_sys_or_internal(i915, PAGE_SIZE);
694709 if (IS_ERR(obj)) {
695710 err = PTR_ERR(obj);
696711 pr_err("Unable to create object for reclaimed hole\n");
@@ -703,7 +718,7 @@ static int igt_mmap_offset_exhaustion(void *arg) · 6 unmodified lines
703718 goto err_obj;
704719 }
705720
706− if (!assert_mmap_offset(i915, PAGE_SIZE, -ENOSPC)) {
721+ if (!assert_mmap_offset(i915, PAGE_SIZE, enospc)) {
707722 pr_err("Unexpectedly succeeded in inserting object into no holes!\n");
708723 err = -EINVAL;
709724 goto err_obj;
@@ -839,10 +854,9 @@ static int wc_check(struct drm_i915_gem_object *obj) · 129 unmodified lines
839854
840855 static bool can_mmap(struct drm_i915_gem_object *obj, enum i915_mmap_type type)
841856 {
842− struct drm_i915_private *i915 = to_i915(obj->base.dev);
843857 bool no_map;
844858
845− if (HAS_LMEM(i915))
859+ if (obj->ops->mmap_offset)
846860 return type == I915_MMAP_TYPE_FIXED;
847861 else if (type == I915_MMAP_TYPE_FIXED)
848862 return false;
drivers/gpu/drm/i915/gt/intel_rps.c+7−1
@@ -1973,8 +1973,14 @@ u32 intel_rps_read_actual_frequency(struct intel_rps *rps) · 1972 unmodified lines
19731973 u32 intel_rps_read_punit_req(struct intel_rps *rps)
19741974 {
19751975 struct intel_uncore *uncore = rps_to_uncore(rps);
1976+ struct intel_runtime_pm *rpm = rps_to_uncore(rps)->rpm;
1977+ intel_wakeref_t wakeref;
1978+ u32 freq = 0;
19761979
1977− return intel_uncore_read(uncore, GEN6_RPNSWREQ);
1980+ with_intel_runtime_pm_if_in_use(rpm, wakeref)
1981+ freq = intel_uncore_read(uncore, GEN6_RPNSWREQ);
1982+
1983+ return freq;
19781984 }
19791985
19801986 static u32 intel_rps_get_req(u32 pureq)
drivers/gpu/drm/i915/gt/uc/intel_uc.c+3−8
@@ -172,11 +172,6 @@ void intel_uc_driver_remove(struct intel_uc *uc) · 171 unmodified lines
172172 __uc_free_load_err_log(uc);
173173 }
174174
175−static inline bool guc_communication_enabled(struct intel_guc *guc)
176−{
177− return intel_guc_ct_enabled(&guc->ct);
178−}
179−
180175 /*
181176 * Events triggered while CT buffers are disabled are logged in the SCRATCH_15
182177 * register using the same bits used in the CT message payload. Since our
@@ -210,7 +205,7 @@ static void guc_get_mmio_msg(struct intel_guc *guc) · 27 unmodified lines
210205 static void guc_handle_mmio_msg(struct intel_guc *guc)
211206 {
212207 /* we need communication to be enabled to reply to GuC */
213− GEM_BUG_ON(!guc_communication_enabled(guc));
208+ GEM_BUG_ON(!intel_guc_ct_enabled(&guc->ct));
214209
215210 spin_lock_irq(&guc->irq_lock);
216211 if (guc->mmio_msg) {
@@ -226,7 +221,7 @@ static int guc_enable_communication(struct intel_guc *guc) · 9 unmodified lines
226221 struct drm_i915_private *i915 = gt->i915;
227222 int ret;
228223
229− GEM_BUG_ON(guc_communication_enabled(guc));
224+ GEM_BUG_ON(intel_guc_ct_enabled(&guc->ct));
230225
231226 ret = i915_inject_probe_error(i915, -ENXIO);
232227 if (ret)
@@ -662,7 +657,7 @@ static int __uc_resume(struct intel_uc *uc, bool enable_communication) · 429 unmodified lines
662657 return 0;
663658
664659 /* Make sure we enable communication if and only if it's disabled */
665− GEM_BUG_ON(enable_communication == guc_communication_enabled(guc));
660+ GEM_BUG_ON(enable_communication == intel_guc_ct_enabled(&guc->ct));
666661
667662 if (enable_communication)
668663 guc_enable_communication(guc);
drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.c+1−1
@@ -57,7 +57,7 @@ nvkm_control_mthd_pstate_info(struct nvkm_control *ctrl, void *data, u32 size) · 56 unmodified lines
5757 args->v0.count = 0;
5858 args->v0.ustate_ac = NVIF_CONTROL_PSTATE_INFO_V0_USTATE_DISABLE;
5959 args->v0.ustate_dc = NVIF_CONTROL_PSTATE_INFO_V0_USTATE_DISABLE;
60− args->v0.pwrsrc = -ENOSYS;
60+ args->v0.pwrsrc = -ENODEV;
6161 args->v0.pstate = NVIF_CONTROL_PSTATE_INFO_V0_PSTATE_UNKNOWN;
6262 }
6363
drivers/gpu/drm/radeon/radeon_kms.c+1−1
@@ -119,7 +119,7 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags) · 118 unmodified lines
119119 #endif
120120
121121 if (pci_find_capability(pdev, PCI_CAP_ID_AGP))
122− rdev->agp = radeon_agp_head_init(rdev->ddev);
122+ rdev->agp = radeon_agp_head_init(dev);
123123 if (rdev->agp) {
124124 rdev->agp->agp_mtrr = arch_phys_wc_add(
125125 rdev->agp->agp_info.aper_base,
drivers/gpu/drm/vc4/vc4_hdmi.c+23−61
@@ -167,8 +167,6 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force) · 166 unmodified lines
167167 struct vc4_hdmi *vc4_hdmi = connector_to_vc4_hdmi(connector);
168168 bool connected = false;
169169
170− WARN_ON(pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev));
171−
172170 if (vc4_hdmi->hpd_gpio &&
173171 gpiod_get_value_cansleep(vc4_hdmi->hpd_gpio)) {
174172 connected = true;
@@ -189,12 +187,10 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force) · 14 unmodified lines
189187 }
190188 }
191189
192− pm_runtime_put(&vc4_hdmi->pdev->dev);
193190 return connector_status_connected;
194191 }
195192
196193 cec_phys_addr_invalidate(vc4_hdmi->cec_adap);
197− pm_runtime_put(&vc4_hdmi->pdev->dev);
198194 return connector_status_disconnected;
199195 }
200196
@@ -436,7 +432,7 @@ static void vc4_hdmi_set_avi_infoframe(struct drm_encoder *encoder) · 235 unmodified lines
436432 struct vc4_hdmi_encoder *vc4_encoder = to_vc4_hdmi_encoder(encoder);
437433 struct drm_connector *connector = &vc4_hdmi->connector;
438434 struct drm_connector_state *cstate = connector->state;
439− struct drm_crtc *crtc = cstate->crtc;
435+ struct drm_crtc *crtc = encoder->crtc;
440436 const struct drm_display_mode *mode = &crtc->state->adjusted_mode;
441437 union hdmi_infoframe frame;
442438 int ret;
@@ -541,11 +537,8 @@ static bool vc4_hdmi_supports_scrambling(struct drm_encoder *encoder, · 98 unmodified lines
541537
542538 static void vc4_hdmi_enable_scrambling(struct drm_encoder *encoder)
543539 {
540+ struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode;
544541 struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
545− struct drm_connector *connector = &vc4_hdmi->connector;
546− struct drm_connector_state *cstate = connector->state;
547− struct drm_crtc *crtc = cstate->crtc;
548− struct drm_display_mode *mode = &crtc->state->adjusted_mode;
549542
550543 if (!vc4_hdmi_supports_scrambling(encoder, mode))
551544 return;
@@ -566,18 +559,17 @@ static void vc4_hdmi_enable_scrambling(struct drm_encoder *encoder) · 14 unmodified lines
566559 static void vc4_hdmi_disable_scrambling(struct drm_encoder *encoder)
567560 {
568561 struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
569− struct drm_connector *connector = &vc4_hdmi->connector;
570− struct drm_connector_state *cstate = connector->state;
562+ struct drm_crtc *crtc = encoder->crtc;
571563
572564 /*
573− * At boot, connector->state will be NULL. Since we don't know the
565+ * At boot, encoder->crtc will be NULL. Since we don't know the
574566 * state of the scrambler and in order to avoid any
575567 * inconsistency, let's disable it all the time.
576568 */
577− if (cstate && !vc4_hdmi_supports_scrambling(encoder, &cstate->crtc->mode))
569+ if (crtc && !vc4_hdmi_supports_scrambling(encoder, &crtc->mode))
578570 return;
579571
580− if (cstate && !vc4_hdmi_mode_needs_scrambling(&cstate->crtc->mode))
572+ if (crtc && !vc4_hdmi_mode_needs_scrambling(&crtc->mode))
581573 return;
582574
583575 if (delayed_work_pending(&vc4_hdmi->scrambling_work))
@@ -635,6 +627,7 @@ static void vc4_hdmi_encoder_post_crtc_powerdown(struct drm_encoder *encoder, · 51 unmodified lines
635627 vc4_hdmi->variant->phy_disable(vc4_hdmi);
636628
637629 clk_disable_unprepare(vc4_hdmi->pixel_bvb_clock);
630+ clk_disable_unprepare(vc4_hdmi->hsm_clock);
638631 clk_disable_unprepare(vc4_hdmi->pixel_clock);
639632
640633 ret = pm_runtime_put(&vc4_hdmi->pdev->dev);
@@ -898,9 +891,7 @@ static void vc4_hdmi_encoder_pre_crtc_configure(struct drm_encoder *encoder, · 257 unmodified lines
898891 vc4_hdmi_encoder_get_connector_state(encoder, state);
899892 struct vc4_hdmi_connector_state *vc4_conn_state =
900893 conn_state_to_vc4_hdmi_conn_state(conn_state);
901− struct drm_crtc_state *crtc_state =
902− drm_atomic_get_new_crtc_state(state, conn_state->crtc);
903− struct drm_display_mode *mode = &crtc_state->adjusted_mode;
894+ struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode;
904895 struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
905896 unsigned long bvb_rate, pixel_rate, hsm_rate;
906897 int ret;
@@ -947,6 +938,13 @@ static void vc4_hdmi_encoder_pre_crtc_configure(struct drm_encoder *encoder, · 40 unmodified lines
947938 return;
948939 }
949940
941+ ret = clk_prepare_enable(vc4_hdmi->hsm_clock);
942+ if (ret) {
943+ DRM_ERROR("Failed to turn on HSM clock: %d\n", ret);
944+ clk_disable_unprepare(vc4_hdmi->pixel_clock);
945+ return;
946+ }
947+
950948 vc4_hdmi_cec_update_clk_div(vc4_hdmi);
951949
952950 if (pixel_rate > 297000000)
@@ -959,6 +957,7 @@ static void vc4_hdmi_encoder_pre_crtc_configure(struct drm_encoder *encoder, · 6 unmodified lines
959957 ret = clk_set_min_rate(vc4_hdmi->pixel_bvb_clock, bvb_rate);
960958 if (ret) {
961959 DRM_ERROR("Failed to set pixel bvb clock rate: %d\n", ret);
960+ clk_disable_unprepare(vc4_hdmi->hsm_clock);
962961 clk_disable_unprepare(vc4_hdmi->pixel_clock);
963962 return;
964963 }
@@ -966,6 +965,7 @@ static void vc4_hdmi_encoder_pre_crtc_configure(struct drm_encoder *encoder, · 1 unmodified line
966965 ret = clk_prepare_enable(vc4_hdmi->pixel_bvb_clock);
967966 if (ret) {
968967 DRM_ERROR("Failed to turn on pixel bvb clock: %d\n", ret);
968+ clk_disable_unprepare(vc4_hdmi->hsm_clock);
969969 clk_disable_unprepare(vc4_hdmi->pixel_clock);
970970 return;
971971 }
@@ -985,11 +985,7 @@ static void vc4_hdmi_encoder_pre_crtc_configure(struct drm_encoder *encoder, · 13 unmodified lines
985985 static void vc4_hdmi_encoder_pre_crtc_enable(struct drm_encoder *encoder,
986986 struct drm_atomic_state *state)
987987 {
988− struct drm_connector_state *conn_state =
989− vc4_hdmi_encoder_get_connector_state(encoder, state);
990− struct drm_crtc_state *crtc_state =
991− drm_atomic_get_new_crtc_state(state, conn_state->crtc);
992− struct drm_display_mode *mode = &crtc_state->adjusted_mode;
988+ struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode;
993989 struct vc4_hdmi_encoder *vc4_encoder = to_vc4_hdmi_encoder(encoder);
994990 struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
995991
@@ -1012,11 +1008,7 @@ static void vc4_hdmi_encoder_pre_crtc_enable(struct drm_encoder *encoder, · 16 unmodified lines
10121008 static void vc4_hdmi_encoder_post_crtc_enable(struct drm_encoder *encoder,
10131009 struct drm_atomic_state *state)
10141010 {
1015− struct drm_connector_state *conn_state =
1016− vc4_hdmi_encoder_get_connector_state(encoder, state);
1017− struct drm_crtc_state *crtc_state =
1018− drm_atomic_get_new_crtc_state(state, conn_state->crtc);
1019− struct drm_display_mode *mode = &crtc_state->adjusted_mode;
1011+ struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode;
10201012 struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
10211013 struct vc4_hdmi_encoder *vc4_encoder = to_vc4_hdmi_encoder(encoder);
10221014 bool hsync_pos = mode->flags & DRM_MODE_FLAG_PHSYNC;
@@ -1204,8 +1196,8 @@ static void vc4_hdmi_audio_set_mai_clock(struct vc4_hdmi *vc4_hdmi, · 181 unmodified lines
12041196
12051197 static void vc4_hdmi_set_n_cts(struct vc4_hdmi *vc4_hdmi, unsigned int samplerate)
12061198 {
1207− struct drm_connector *connector = &vc4_hdmi->connector;
1208− struct drm_crtc *crtc = connector->state->crtc;
1199+ struct drm_encoder *encoder = &vc4_hdmi->encoder.base.base;
1200+ struct drm_crtc *crtc = encoder->crtc;
12091201 const struct drm_display_mode *mode = &crtc->state->adjusted_mode;
12101202 u32 n, cts;
12111203 u64 tmp;
@@ -1238,13 +1230,13 @@ static inline struct vc4_hdmi *dai_to_hdmi(struct snd_soc_dai *dai) · 26 unmodified lines
12381230 static int vc4_hdmi_audio_startup(struct device *dev, void *data)
12391231 {
12401232 struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev);
1241− struct drm_connector *connector = &vc4_hdmi->connector;
1233+ struct drm_encoder *encoder = &vc4_hdmi->encoder.base.base;
12421234
12431235 /*
12441236 * If the HDMI encoder hasn't probed, or the encoder is
12451237 * currently in DVI mode, treat the codec dai as missing.
12461238 */
1247− if (!connector->state || !(HDMI_READ(HDMI_RAM_PACKET_CONFIG) &
1239+ if (!encoder->crtc || !(HDMI_READ(HDMI_RAM_PACKET_CONFIG) &
12481240 VC4_HDMI_RAM_PACKET_ENABLE))
12491241 return -ENODEV;
12501242
@@ -2114,29 +2106,6 @@ static int vc5_hdmi_init_resources(struct vc4_hdmi *vc4_hdmi) · 863 unmodified lines
21142106 return 0;
21152107 }
21162108
2117−#ifdef CONFIG_PM
2118−static int vc4_hdmi_runtime_suspend(struct device *dev)
2119−{
2120− struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev);
2121−
2122− clk_disable_unprepare(vc4_hdmi->hsm_clock);
2123−
2124− return 0;
2125−}
2126−
2127−static int vc4_hdmi_runtime_resume(struct device *dev)
2128−{
2129− struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev);
2130− int ret;
2131−
2132− ret = clk_prepare_enable(vc4_hdmi->hsm_clock);
2133− if (ret)
2134− return ret;
2135−
2136− return 0;
2137−}
2138−#endif
2139−
21402109 static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
21412110 {
21422111 const struct vc4_hdmi_variant *variant = of_device_get_match_data(dev);
@@ -2391,18 +2360,11 @@ static const struct of_device_id vc4_hdmi_dt_match[] = { · 248 unmodified lines
23912360 {}
23922361 };
23932362
2394−static const struct dev_pm_ops vc4_hdmi_pm_ops = {
2395− SET_RUNTIME_PM_OPS(vc4_hdmi_runtime_suspend,
2396− vc4_hdmi_runtime_resume,
2397− NULL)
2398−};
2399−
24002363 struct platform_driver vc4_hdmi_driver = {
24012364 .probe = vc4_hdmi_dev_probe,
24022365 .remove = vc4_hdmi_dev_remove,
24032366 .driver = {
24042367 .name = "vc4_hdmi",
24052368 .of_match_table = vc4_hdmi_dt_match,
2406− .pm = &vc4_hdmi_pm_ops,
24072369 },
24082370 };
drivers/net/dsa/b53/b53_mdio.c+19−2
@@ -351,9 +351,25 @@ static int b53_mdio_probe(struct mdio_device *mdiodev) · 350 unmodified lines
351351 static void b53_mdio_remove(struct mdio_device *mdiodev)
352352 {
353353 struct b53_device *dev = dev_get_drvdata(&mdiodev->dev);
354− struct dsa_switch *ds = dev->ds;
355354
356− dsa_unregister_switch(ds);
355+ if (!dev)
356+ return;
357+
358+ b53_switch_remove(dev);
359+
360+ dev_set_drvdata(&mdiodev->dev, NULL);
361+}
362+
363+static void b53_mdio_shutdown(struct mdio_device *mdiodev)
364+{
365+ struct b53_device *dev = dev_get_drvdata(&mdiodev->dev);
366+
367+ if (!dev)
368+ return;
369+
370+ b53_switch_shutdown(dev);
371+
372+ dev_set_drvdata(&mdiodev->dev, NULL);
357373 }
358374
359375 static const struct of_device_id b53_of_match[] = {
@@ -373,6 +389,7 @@ MODULE_DEVICE_TABLE(of, b53_of_match); · 13 unmodified lines
373389 static struct mdio_driver b53_mdio_driver = {
374390 .probe = b53_mdio_probe,
375391 .remove = b53_mdio_remove,
392+ .shutdown = b53_mdio_shutdown,
376393 .mdiodrv.driver = {
377394 .name = "bcm53xx",
378395 .of_match_table = b53_of_match,
drivers/net/dsa/b53/b53_mmap.c+13−0
@@ -316,9 +316,21 @@ static int b53_mmap_remove(struct platform_device *pdev) · 315 unmodified lines
316316 if (dev)
317317 b53_switch_remove(dev);
318318
319+ platform_set_drvdata(pdev, NULL);
320+
319321 return 0;
320322 }
321323
324+static void b53_mmap_shutdown(struct platform_device *pdev)
325+{
326+ struct b53_device *dev = platform_get_drvdata(pdev);
327+
328+ if (dev)
329+ b53_switch_shutdown(dev);
330+
331+ platform_set_drvdata(pdev, NULL);
332+}
333+
322334 static const struct of_device_id b53_mmap_of_table[] = {
323335 { .compatible = "brcm,bcm3384-switch" },
324336 { .compatible = "brcm,bcm6328-switch" },
@@ -331,6 +343,7 @@ MODULE_DEVICE_TABLE(of, b53_mmap_of_table); · 6 unmodified lines
331343 static struct platform_driver b53_mmap_driver = {
332344 .probe = b53_mmap_probe,
333345 .remove = b53_mmap_remove,
346+ .shutdown = b53_mmap_shutdown,
334347 .driver = {
335348 .name = "b53-switch",
336349 .of_match_table = b53_mmap_of_table,
drivers/net/dsa/b53/b53_priv.h+5−0
@@ -227,6 +227,11 @@ static inline void b53_switch_remove(struct b53_device *dev) · 226 unmodified lines
227227 dsa_unregister_switch(dev->ds);
228228 }
229229
230+static inline void b53_switch_shutdown(struct b53_device *dev)
231+{
232+ dsa_switch_shutdown(dev->ds);
233+}
234+
230235 #define b53_build_op(type_op_size, val_type) \
231236 static inline int b53_##type_op_size(struct b53_device *dev, u8 page, \
232237 u8 reg, val_type val) \
drivers/net/dsa/b53/b53_spi.c+13−0
@@ -321,9 +321,21 @@ static int b53_spi_remove(struct spi_device *spi) · 320 unmodified lines
321321 if (dev)
322322 b53_switch_remove(dev);
323323
324+ spi_set_drvdata(spi, NULL);
325+
324326 return 0;
325327 }
326328
329+static void b53_spi_shutdown(struct spi_device *spi)
330+{
331+ struct b53_device *dev = spi_get_drvdata(spi);
332+
333+ if (dev)
334+ b53_switch_shutdown(dev);
335+
336+ spi_set_drvdata(spi, NULL);
337+}
338+
327339 static const struct of_device_id b53_spi_of_match[] = {
328340 { .compatible = "brcm,bcm5325" },
329341 { .compatible = "brcm,bcm5365" },
@@ -344,6 +356,7 @@ static struct spi_driver b53_spi_driver = { · 14 unmodified lines
344356 },
345357 .probe = b53_spi_probe,
346358 .remove = b53_spi_remove,
359+ .shutdown = b53_spi_shutdown,
347360 };
348361
349362 module_spi_driver(b53_spi_driver);
drivers/net/dsa/b53/b53_srab.c+19−2
@@ -629,17 +629,34 @@ static int b53_srab_probe(struct platform_device *pdev) · 628 unmodified lines
629629 static int b53_srab_remove(struct platform_device *pdev)
630630 {
631631 struct b53_device *dev = platform_get_drvdata(pdev);
632− struct b53_srab_priv *priv = dev->priv;
633632
634− b53_srab_intr_set(priv, false);
633+ if (!dev)
634+ return 0;
635+
636+ b53_srab_intr_set(dev->priv, false);
635637 b53_switch_remove(dev);
636638
639+ platform_set_drvdata(pdev, NULL);
640+
637641 return 0;
638642 }
639643
644+static void b53_srab_shutdown(struct platform_device *pdev)
645+{
646+ struct b53_device *dev = platform_get_drvdata(pdev);
647+
648+ if (!dev)
649+ return;
650+
651+ b53_switch_shutdown(dev);
652+
653+ platform_set_drvdata(pdev, NULL);
654+}
655+
640656 static struct platform_driver b53_srab_driver = {
641657 .probe = b53_srab_probe,
642658 .remove = b53_srab_remove,
659+ .shutdown = b53_srab_shutdown,
643660 .driver = {
644661 .name = "b53-srab-switch",
645662 .of_match_table = b53_srab_of_match,
drivers/net/dsa/bcm_sf2.c+13−1
@@ -68,7 +68,7 @@ static unsigned int bcm_sf2_num_active_ports(struct dsa_switch *ds) · 67 unmodified lines
6868 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
6969 unsigned int port, count = 0;
7070
71− for (port = 0; port < ARRAY_SIZE(priv->port_sts); port++) {
71+ for (port = 0; port < ds->num_ports; port++) {
7272 if (dsa_is_cpu_port(ds, port))
7373 continue;
7474 if (priv->port_sts[port].enabled)
@@ -1514,6 +1514,9 @@ static int bcm_sf2_sw_remove(struct platform_device *pdev) · 1439 unmodified lines
15141514 {
15151515 struct bcm_sf2_priv *priv = platform_get_drvdata(pdev);
15161516
1517+ if (!priv)
1518+ return 0;
1519+
15171520 priv->wol_ports_mask = 0;
15181521 /* Disable interrupts */
15191522 bcm_sf2_intr_disable(priv);
@@ -1525,6 +1528,8 @@ static int bcm_sf2_sw_remove(struct platform_device *pdev) · 5 unmodified lines
15251528 if (priv->type == BCM7278_DEVICE_ID)
15261529 reset_control_assert(priv->rcdev);
15271530
1531+ platform_set_drvdata(pdev, NULL);
1532+
15281533 return 0;
15291534 }
15301535
@@ -1532,6 +1537,9 @@ static void bcm_sf2_sw_shutdown(struct platform_device *pdev) · 1 unmodified line
15321537 {
15331538 struct bcm_sf2_priv *priv = platform_get_drvdata(pdev);
15341539
1540+ if (!priv)
1541+ return;
1542+
15351543 /* For a kernel about to be kexec'd we want to keep the GPHY on for a
15361544 * successful MDIO bus scan to occur. If we did turn off the GPHY
15371545 * before (e.g: port_disable), this will also power it back on.
@@ -1540,6 +1548,10 @@ static void bcm_sf2_sw_shutdown(struct platform_device *pdev) · 2 unmodified lines
15401548 */
15411549 if (priv->hw_params.num_gphy == 1)
15421550 bcm_sf2_gphy_enable_set(priv->dev->ds, true);
1551+
1552+ dsa_switch_shutdown(priv->dev->ds);
1553+
1554+ platform_set_drvdata(pdev, NULL);
15431555 }
15441556
15451557 #ifdef CONFIG_PM_SLEEP
drivers/net/dsa/dsa_loop.c+21−1
@@ -340,10 +340,29 @@ static int dsa_loop_drv_probe(struct mdio_device *mdiodev) · 339 unmodified lines
340340 static void dsa_loop_drv_remove(struct mdio_device *mdiodev)
341341 {
342342 struct dsa_switch *ds = dev_get_drvdata(&mdiodev->dev);
343− struct dsa_loop_priv *ps = ds->priv;
343+ struct dsa_loop_priv *ps;
344+
345+ if (!ds)
346+ return;
347+
348+ ps = ds->priv;
344349
345350 dsa_unregister_switch(ds);
346351 dev_put(ps->netdev);
352+
353+ dev_set_drvdata(&mdiodev->dev, NULL);
354+}
355+
356+static void dsa_loop_drv_shutdown(struct mdio_device *mdiodev)
357+{
358+ struct dsa_switch *ds = dev_get_drvdata(&mdiodev->dev);
359+
360+ if (!ds)
361+ return;
362+
363+ dsa_switch_shutdown(ds);
364+
365+ dev_set_drvdata(&mdiodev->dev, NULL);
347366 }
348367
349368 static struct mdio_driver dsa_loop_drv = {
@@ -352,6 +371,7 @@ static struct mdio_driver dsa_loop_drv = { · 2 unmodified lines
352371 },
353372 .probe = dsa_loop_drv_probe,
354373 .remove = dsa_loop_drv_remove,
374+ .shutdown = dsa_loop_drv_shutdown,
355375 };
356376
357377 #define NUM_FIXED_PHYS (DSA_LOOP_NUM_PORTS - 2)
drivers/net/dsa/hirschmann/hellcreek.c+16−0
@@ -1916,6 +1916,9 @@ static int hellcreek_remove(struct platform_device *pdev) · 1915 unmodified lines
19161916 {
19171917 struct hellcreek *hellcreek = platform_get_drvdata(pdev);
19181918
1919+ if (!hellcreek)
1920+ return 0;
1921+
19191922 hellcreek_hwtstamp_free(hellcreek);
19201923 hellcreek_ptp_free(hellcreek);
19211924 dsa_unregister_switch(hellcreek->ds);
@@ -1924,6 +1927,18 @@ static int hellcreek_remove(struct platform_device *pdev) · 2 unmodified lines
19241927 return 0;
19251928 }
19261929
1930+static void hellcreek_shutdown(struct platform_device *pdev)
1931+{
1932+ struct hellcreek *hellcreek = platform_get_drvdata(pdev);
1933+
1934+ if (!hellcreek)
1935+ return;
1936+
1937+ dsa_switch_shutdown(hellcreek->ds);
1938+
1939+ platform_set_drvdata(pdev, NULL);
1940+}
1941+
19271942 static const struct hellcreek_platform_data de1soc_r1_pdata = {
19281943 .name = "r4c30",
19291944 .num_ports = 4,
@@ -1946,6 +1961,7 @@ MODULE_DEVICE_TABLE(of, hellcreek_of_match); · 16 unmodified lines
19461961 static struct platform_driver hellcreek_driver = {
19471962 .probe = hellcreek_probe,
19481963 .remove = hellcreek_remove,
1964+ .shutdown = hellcreek_shutdown,
19491965 .driver = {
19501966 .name = "hellcreek",
19511967 .of_match_table = hellcreek_of_match,
drivers/net/dsa/lan9303-core.c+6−0
@@ -1379,6 +1379,12 @@ int lan9303_remove(struct lan9303 *chip) · 1378 unmodified lines
13791379 }
13801380 EXPORT_SYMBOL(lan9303_remove);
13811381
1382+void lan9303_shutdown(struct lan9303 *chip)
1383+{
1384+ dsa_switch_shutdown(chip->ds);
1385+}
1386+EXPORT_SYMBOL(lan9303_shutdown);
1387+
13821388 MODULE_AUTHOR("Juergen Borleis <kernel@pengutronix.de>");
13831389 MODULE_DESCRIPTION("Core driver for SMSC/Microchip LAN9303 three port ethernet switch");
13841390 MODULE_LICENSE("GPL v2");
drivers/net/dsa/lan9303.h+1−0
@@ -10,3 +10,4 @@ extern const struct lan9303_phy_ops lan9303_indirect_phy_ops; · 9 unmodified lines
1010
1111 int lan9303_probe(struct lan9303 *chip, struct device_node *np);
1212 int lan9303_remove(struct lan9303 *chip);
13+void lan9303_shutdown(struct lan9303 *chip);
drivers/net/dsa/lan9303_i2c.c+20−4
@@ -67,13 +67,28 @@ static int lan9303_i2c_probe(struct i2c_client *client, · 66 unmodified lines
6767
6868 static int lan9303_i2c_remove(struct i2c_client *client)
6969 {
70− struct lan9303_i2c *sw_dev;
70+ struct lan9303_i2c *sw_dev = i2c_get_clientdata(client);
7171
72− sw_dev = i2c_get_clientdata(client);
7372 if (!sw_dev)
74− return -ENODEV;
73+ return 0;
74+
75+ lan9303_remove(&sw_dev->chip);
76+
77+ i2c_set_clientdata(client, NULL);
78+
79+ return 0;
80+}
81+
82+static void lan9303_i2c_shutdown(struct i2c_client *client)
83+{
84+ struct lan9303_i2c *sw_dev = i2c_get_clientdata(client);
85+
86+ if (!sw_dev)
87+ return;
88+
89+ lan9303_shutdown(&sw_dev->chip);
7590
76− return lan9303_remove(&sw_dev->chip);
91+ i2c_set_clientdata(client, NULL);
7792 }
7893
7994 /*-------------------------------------------------------------------------*/
@@ -97,6 +112,7 @@ static struct i2c_driver lan9303_i2c_driver = { · 17 unmodified lines
97112 },
98113 .probe = lan9303_i2c_probe,
99114 .remove = lan9303_i2c_remove,
115+ .shutdown = lan9303_i2c_shutdown,
100116 .id_table = lan9303_i2c_id,
101117 };
102118 module_i2c_driver(lan9303_i2c_driver);
drivers/net/dsa/lan9303_mdio.c+15−0
@@ -138,6 +138,20 @@ static void lan9303_mdio_remove(struct mdio_device *mdiodev) · 137 unmodified lines
138138 return;
139139
140140 lan9303_remove(&sw_dev->chip);
141+
142+ dev_set_drvdata(&mdiodev->dev, NULL);
143+}
144+
145+static void lan9303_mdio_shutdown(struct mdio_device *mdiodev)
146+{
147+ struct lan9303_mdio *sw_dev = dev_get_drvdata(&mdiodev->dev);
148+
149+ if (!sw_dev)
150+ return;
151+
152+ lan9303_shutdown(&sw_dev->chip);
153+
154+ dev_set_drvdata(&mdiodev->dev, NULL);
141155 }
142156
143157 /*-------------------------------------------------------------------------*/
@@ -155,6 +169,7 @@ static struct mdio_driver lan9303_mdio_driver = { · 11 unmodified lines
155169 },
156170 .probe = lan9303_mdio_probe,
157171 .remove = lan9303_mdio_remove,
172+ .shutdown = lan9303_mdio_shutdown,
158173 };
159174 mdio_module_driver(lan9303_mdio_driver);
160175
drivers/net/dsa/lantiq_gswip.c+18−0
@@ -2184,6 +2184,9 @@ static int gswip_remove(struct platform_device *pdev) · 2183 unmodified lines
21842184 struct gswip_priv *priv = platform_get_drvdata(pdev);
21852185 int i;
21862186
2187+ if (!priv)
2188+ return 0;
2189+
21872190 /* disable the switch */
21882191 gswip_mdio_mask(priv, GSWIP_MDIO_GLOB_ENABLE, 0, GSWIP_MDIO_GLOB);
21892192
@@ -2197,9 +2200,23 @@ static int gswip_remove(struct platform_device *pdev) · 7 unmodified lines
21972200 for (i = 0; i < priv->num_gphy_fw; i++)
21982201 gswip_gphy_fw_remove(priv, &priv->gphy_fw[i]);
21992202
2203+ platform_set_drvdata(pdev, NULL);
2204+
22002205 return 0;
22012206 }
22022207
2208+static void gswip_shutdown(struct platform_device *pdev)
2209+{
2210+ struct gswip_priv *priv = platform_get_drvdata(pdev);
2211+
2212+ if (!priv)
2213+ return;
2214+
2215+ dsa_switch_shutdown(priv->ds);
2216+
2217+ platform_set_drvdata(pdev, NULL);
2218+}
2219+
22032220 static const struct gswip_hw_info gswip_xrx200 = {
22042221 .max_ports = 7,
22052222 .cpu_port = 6,
@@ -2223,6 +2240,7 @@ MODULE_DEVICE_TABLE(of, gswip_of_match); · 17 unmodified lines
22232240 static struct platform_driver gswip_driver = {
22242241 .probe = gswip_probe,
22252242 .remove = gswip_remove,
2243+ .shutdown = gswip_shutdown,
22262244 .driver = {
22272245 .name = "gswip",
22282246 .of_match_table = gswip_of_match,
drivers/net/dsa/microchip/ksz8795_spi.c+10−1
@@ -94,6 +94,8 @@ static int ksz8795_spi_remove(struct spi_device *spi) · 93 unmodified lines
9494 if (dev)
9595 ksz_switch_remove(dev);
9696
97+ spi_set_drvdata(spi, NULL);
98+
9799 return 0;
98100 }
99101
@@ -101,8 +103,15 @@ static void ksz8795_spi_shutdown(struct spi_device *spi) · 1 unmodified line
101103 {
102104 struct ksz_device *dev = spi_get_drvdata(spi);
103105
104− if (dev && dev->dev_ops->shutdown)
106+ if (!dev)
107+ return;
108+
109+ if (dev->dev_ops->shutdown)
105110 dev->dev_ops->shutdown(dev);
111+
112+ dsa_switch_shutdown(dev->ds);
113+
114+ spi_set_drvdata(spi, NULL);
106115 }
107116
108117 static const struct of_device_id ksz8795_dt_ids[] = {
drivers/net/dsa/microchip/ksz8863_smi.c+13−0
@@ -191,6 +191,18 @@ static void ksz8863_smi_remove(struct mdio_device *mdiodev) · 190 unmodified lines
191191
192192 if (dev)
193193 ksz_switch_remove(dev);
194+
195+ dev_set_drvdata(&mdiodev->dev, NULL);
196+}
197+
198+static void ksz8863_smi_shutdown(struct mdio_device *mdiodev)
199+{
200+ struct ksz_device *dev = dev_get_drvdata(&mdiodev->dev);
201+
202+ if (dev)
203+ dsa_switch_shutdown(dev->ds);
204+
205+ dev_set_drvdata(&mdiodev->dev, NULL);
194206 }
195207
196208 static const struct of_device_id ksz8863_dt_ids[] = {
@@ -203,6 +215,7 @@ MODULE_DEVICE_TABLE(of, ksz8863_dt_ids); · 6 unmodified lines
203215 static struct mdio_driver ksz8863_driver = {
204216 .probe = ksz8863_smi_probe,
205217 .remove = ksz8863_smi_remove,
218+ .shutdown = ksz8863_smi_shutdown,
206219 .mdiodrv.driver = {
207220 .name = "ksz8863-switch",
208221 .of_match_table = ksz8863_dt_ids,
drivers/net/dsa/microchip/ksz9477_i2c.c+12−2
@@ -56,7 +56,10 @@ static int ksz9477_i2c_remove(struct i2c_client *i2c) · 55 unmodified lines
5656 {
5757 struct ksz_device *dev = i2c_get_clientdata(i2c);
5858
59− ksz_switch_remove(dev);
59+ if (dev)
60+ ksz_switch_remove(dev);
61+
62+ i2c_set_clientdata(i2c, NULL);
6063
6164 return 0;
6265 }
@@ -65,8 +68,15 @@ static void ksz9477_i2c_shutdown(struct i2c_client *i2c) · 2 unmodified lines
6568 {
6669 struct ksz_device *dev = i2c_get_clientdata(i2c);
6770
68− if (dev && dev->dev_ops->shutdown)
71+ if (!dev)
72+ return;
73+
74+ if (dev->dev_ops->shutdown)
6975 dev->dev_ops->shutdown(dev);
76+
77+ dsa_switch_shutdown(dev->ds);
78+
79+ i2c_set_clientdata(i2c, NULL);
7080 }
7181
7282 static const struct i2c_device_id ksz9477_i2c_id[] = {
drivers/net/dsa/microchip/ksz9477_spi.c+6−2
@@ -72,6 +72,8 @@ static int ksz9477_spi_remove(struct spi_device *spi) · 71 unmodified lines
7272 if (dev)
7373 ksz_switch_remove(dev);
7474
75+ spi_set_drvdata(spi, NULL);
76+
7577 return 0;
7678 }
7779
@@ -79,8 +81,10 @@ static void ksz9477_spi_shutdown(struct spi_device *spi) · 1 unmodified line
7981 {
8082 struct ksz_device *dev = spi_get_drvdata(spi);
8183
82− if (dev && dev->dev_ops->shutdown)
83− dev->dev_ops->shutdown(dev);
84+ if (dev)
85+ dsa_switch_shutdown(dev->ds);
86+
87+ spi_set_drvdata(spi, NULL);
8488 }
8589
8690 static const struct of_device_id ksz9477_dt_ids[] = {
drivers/net/dsa/mt7530.c+18−0
@@ -3286,6 +3286,9 @@ mt7530_remove(struct mdio_device *mdiodev) · 3285 unmodified lines
32863286 struct mt7530_priv *priv = dev_get_drvdata(&mdiodev->dev);
32873287 int ret = 0;
32883288
3289+ if (!priv)
3290+ return;
3291+
32893292 ret = regulator_disable(priv->core_pwr);
32903293 if (ret < 0)
32913294 dev_err(priv->dev,
@@ -3301,11 +3304,26 @@ mt7530_remove(struct mdio_device *mdiodev) · 9 unmodified lines
33013304
33023305 dsa_unregister_switch(priv->ds);
33033306 mutex_destroy(&priv->reg_mutex);
3307+
3308+ dev_set_drvdata(&mdiodev->dev, NULL);
3309+}
3310+
3311+static void mt7530_shutdown(struct mdio_device *mdiodev)
3312+{
3313+ struct mt7530_priv *priv = dev_get_drvdata(&mdiodev->dev);
3314+
3315+ if (!priv)
3316+ return;
3317+
3318+ dsa_switch_shutdown(priv->ds);
3319+
3320+ dev_set_drvdata(&mdiodev->dev, NULL);
33043321 }
33053322
33063323 static struct mdio_driver mt7530_mdio_driver = {
33073324 .probe = mt7530_probe,
33083325 .remove = mt7530_remove,
3326+ .shutdown = mt7530_shutdown,
33093327 .mdiodrv.driver = {
33103328 .name = "mt7530",
33113329 .of_match_table = mt7530_of_match,
drivers/net/dsa/mv88e6060.c+18−0
@@ -290,7 +290,24 @@ static void mv88e6060_remove(struct mdio_device *mdiodev) · 289 unmodified lines
290290 {
291291 struct dsa_switch *ds = dev_get_drvdata(&mdiodev->dev);
292292
293+ if (!ds)
294+ return;
295+
293296 dsa_unregister_switch(ds);
297+
298+ dev_set_drvdata(&mdiodev->dev, NULL);
299+}
300+
301+static void mv88e6060_shutdown(struct mdio_device *mdiodev)
302+{
303+ struct dsa_switch *ds = dev_get_drvdata(&mdiodev->dev);
304+
305+ if (!ds)
306+ return;
307+
308+ dsa_switch_shutdown(ds);
309+
310+ dev_set_drvdata(&mdiodev->dev, NULL);
294311 }
295312
296313 static const struct of_device_id mv88e6060_of_match[] = {
@@ -303,6 +320,7 @@ static const struct of_device_id mv88e6060_of_match[] = { · 6 unmodified lines
303320 static struct mdio_driver mv88e6060_driver = {
304321 .probe = mv88e6060_probe,
305322 .remove = mv88e6060_remove,
323+ .shutdown = mv88e6060_shutdown,
306324 .mdiodrv.driver = {
307325 .name = "mv88e6060",
308326 .of_match_table = mv88e6060_of_match,
drivers/net/dsa/mv88e6xxx/chip.c+35−3
@@ -3071,7 +3071,7 @@ static void mv88e6xxx_teardown(struct dsa_switch *ds) · 3070 unmodified lines
30713071 {
30723072 mv88e6xxx_teardown_devlink_params(ds);
30733073 dsa_devlink_resources_unregister(ds);
3074− mv88e6xxx_teardown_devlink_regions(ds);
3074+ mv88e6xxx_teardown_devlink_regions_global(ds);
30753075 }
30763076
30773077 static int mv88e6xxx_setup(struct dsa_switch *ds)
@@ -3215,7 +3215,7 @@ unlock: · 137 unmodified lines
32153215 if (err)
32163216 goto out_resources;
32173217
3218− err = mv88e6xxx_setup_devlink_regions(ds);
3218+ err = mv88e6xxx_setup_devlink_regions_global(ds);
32193219 if (err)
32203220 goto out_params;
32213221
@@ -3229,6 +3229,16 @@ out_resources: · 7 unmodified lines
32293229 return err;
32303230 }
32313231
3232+static int mv88e6xxx_port_setup(struct dsa_switch *ds, int port)
3233+{
3234+ return mv88e6xxx_setup_devlink_regions_port(ds, port);
3235+}
3236+
3237+static void mv88e6xxx_port_teardown(struct dsa_switch *ds, int port)
3238+{
3239+ mv88e6xxx_teardown_devlink_regions_port(ds, port);
3240+}
3241+
32323242 /* prod_id for switch families which do not have a PHY model number */
32333243 static const u16 family_prod_id_table[] = {
32343244 [MV88E6XXX_FAMILY_6341] = MV88E6XXX_PORT_SWITCH_ID_PROD_6341,
@@ -6116,6 +6126,8 @@ static const struct dsa_switch_ops mv88e6xxx_switch_ops = { · 2881 unmodified lines
61166126 .change_tag_protocol = mv88e6xxx_change_tag_protocol,
61176127 .setup = mv88e6xxx_setup,
61186128 .teardown = mv88e6xxx_teardown,
6129+ .port_setup = mv88e6xxx_port_setup,
6130+ .port_teardown = mv88e6xxx_port_teardown,
61196131 .phylink_validate = mv88e6xxx_validate,
61206132 .phylink_mac_link_state = mv88e6xxx_serdes_pcs_get_state,
61216133 .phylink_mac_config = mv88e6xxx_mac_config,
@@ -6389,7 +6401,12 @@ out: · 267 unmodified lines
63896401 static void mv88e6xxx_remove(struct mdio_device *mdiodev)
63906402 {
63916403 struct dsa_switch *ds = dev_get_drvdata(&mdiodev->dev);
6392− struct mv88e6xxx_chip *chip = ds->priv;
6404+ struct mv88e6xxx_chip *chip;
6405+
6406+ if (!ds)
6407+ return;
6408+
6409+ chip = ds->priv;
63936410
63946411 if (chip->info->ptp_support) {
63956412 mv88e6xxx_hwtstamp_free(chip);
@@ -6410,6 +6427,20 @@ static void mv88e6xxx_remove(struct mdio_device *mdiodev) · 14 unmodified lines
64106427 mv88e6xxx_g1_irq_free(chip);
64116428 else
64126429 mv88e6xxx_irq_poll_free(chip);
6430+
6431+ dev_set_drvdata(&mdiodev->dev, NULL);
6432+}
6433+
6434+static void mv88e6xxx_shutdown(struct mdio_device *mdiodev)
6435+{
6436+ struct dsa_switch *ds = dev_get_drvdata(&mdiodev->dev);
6437+
6438+ if (!ds)
6439+ return;
6440+
6441+ dsa_switch_shutdown(ds);
6442+
6443+ dev_set_drvdata(&mdiodev->dev, NULL);
64136444 }
64146445
64156446 static const struct of_device_id mv88e6xxx_of_match[] = {
@@ -6433,6 +6464,7 @@ MODULE_DEVICE_TABLE(of, mv88e6xxx_of_match); · 17 unmodified lines
64336464 static struct mdio_driver mv88e6xxx_driver = {
64346465 .probe = mv88e6xxx_probe,
64356466 .remove = mv88e6xxx_remove,
6467+ .shutdown = mv88e6xxx_shutdown,
64366468 .mdiodrv.driver = {
64376469 .name = "mv88e6085",
64386470 .of_match_table = mv88e6xxx_of_match,
drivers/net/dsa/mv88e6xxx/devlink.c+9−64
@@ -647,26 +647,25 @@ static struct mv88e6xxx_region mv88e6xxx_regions[] = { · 646 unmodified lines
647647 },
648648 };
649649
650−static void
651−mv88e6xxx_teardown_devlink_regions_global(struct mv88e6xxx_chip *chip)
650+void mv88e6xxx_teardown_devlink_regions_global(struct dsa_switch *ds)
652651 {
652+ struct mv88e6xxx_chip *chip = ds->priv;
653653 int i;
654654
655655 for (i = 0; i < ARRAY_SIZE(mv88e6xxx_regions); i++)
656656 dsa_devlink_region_destroy(chip->regions[i]);
657657 }
658658
659−static void
660−mv88e6xxx_teardown_devlink_regions_port(struct mv88e6xxx_chip *chip,
661− int port)
659+void mv88e6xxx_teardown_devlink_regions_port(struct dsa_switch *ds, int port)
662660 {
661+ struct mv88e6xxx_chip *chip = ds->priv;
662+
663663 dsa_devlink_region_destroy(chip->ports[port].region);
664664 }
665665
666−static int mv88e6xxx_setup_devlink_regions_port(struct dsa_switch *ds,
667− struct mv88e6xxx_chip *chip,
668− int port)
666+int mv88e6xxx_setup_devlink_regions_port(struct dsa_switch *ds, int port)
669667 {
668+ struct mv88e6xxx_chip *chip = ds->priv;
670669 struct devlink_region *region;
671670
672671 region = dsa_devlink_port_region_create(ds,
@@ -681,40 +680,10 @@ static int mv88e6xxx_setup_devlink_regions_port(struct dsa_switch *ds, · 8 unmodified lines
681680 return 0;
682681 }
683682
684−static void
685−mv88e6xxx_teardown_devlink_regions_ports(struct mv88e6xxx_chip *chip)
686−{
687− int port;
688−
689− for (port = 0; port < mv88e6xxx_num_ports(chip); port++)
690− mv88e6xxx_teardown_devlink_regions_port(chip, port);
691−}
692−
693−static int mv88e6xxx_setup_devlink_regions_ports(struct dsa_switch *ds,
694− struct mv88e6xxx_chip *chip)
695−{
696− int port;
697− int err;
698−
699− for (port = 0; port < mv88e6xxx_num_ports(chip); port++) {
700− err = mv88e6xxx_setup_devlink_regions_port(ds, chip, port);
701− if (err)
702− goto out;
703− }
704−
705− return 0;
706−
707−out:
708− while (port-- > 0)
709− mv88e6xxx_teardown_devlink_regions_port(chip, port);
710−
711− return err;
712−}
713−
714−static int mv88e6xxx_setup_devlink_regions_global(struct dsa_switch *ds,
715− struct mv88e6xxx_chip *chip)
683+int mv88e6xxx_setup_devlink_regions_global(struct dsa_switch *ds)
716684 {
717685 bool (*cond)(struct mv88e6xxx_chip *chip);
686+ struct mv88e6xxx_chip *chip = ds->priv;
718687 struct devlink_region_ops *ops;
719688 struct devlink_region *region;
720689 u64 size;
@@ -753,30 +722,6 @@ out: · 32 unmodified lines
753722 return PTR_ERR(region);
754723 }
755724
756−int mv88e6xxx_setup_devlink_regions(struct dsa_switch *ds)
757−{
758− struct mv88e6xxx_chip *chip = ds->priv;
759− int err;
760−
761− err = mv88e6xxx_setup_devlink_regions_global(ds, chip);
762− if (err)
763− return err;
764−
765− err = mv88e6xxx_setup_devlink_regions_ports(ds, chip);
766− if (err)
767− mv88e6xxx_teardown_devlink_regions_global(chip);
768−
769− return err;
770−}
771−
772−void mv88e6xxx_teardown_devlink_regions(struct dsa_switch *ds)
773−{
774− struct mv88e6xxx_chip *chip = ds->priv;
775−
776− mv88e6xxx_teardown_devlink_regions_ports(chip);
777− mv88e6xxx_teardown_devlink_regions_global(chip);
778−}
779−
780725 int mv88e6xxx_devlink_info_get(struct dsa_switch *ds,
781726 struct devlink_info_req *req,
782727 struct netlink_ext_ack *extack)
drivers/net/dsa/mv88e6xxx/devlink.h+4−2
@@ -12,8 +12,10 @@ int mv88e6xxx_devlink_param_get(struct dsa_switch *ds, u32 id, · 11 unmodified lines
1212 struct devlink_param_gset_ctx *ctx);
1313 int mv88e6xxx_devlink_param_set(struct dsa_switch *ds, u32 id,
1414 struct devlink_param_gset_ctx *ctx);
15−int mv88e6xxx_setup_devlink_regions(struct dsa_switch *ds);
16−void mv88e6xxx_teardown_devlink_regions(struct dsa_switch *ds);
15+int mv88e6xxx_setup_devlink_regions_global(struct dsa_switch *ds);
16+void mv88e6xxx_teardown_devlink_regions_global(struct dsa_switch *ds);
17+int mv88e6xxx_setup_devlink_regions_port(struct dsa_switch *ds, int port);
18+void mv88e6xxx_teardown_devlink_regions_port(struct dsa_switch *ds, int port);
1719
1820 int mv88e6xxx_devlink_info_get(struct dsa_switch *ds,
1921 struct devlink_info_req *req,
drivers/net/dsa/ocelot/felix.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: GPL-2.0
2−/* Copyright 2019-2021 NXP Semiconductors
2+/* Copyright 2019-2021 NXP
33 *
44 * This is an umbrella module for all network switches that are
55 * register-compatible with Ocelot and that perform I/O to their host CPU
drivers/net/dsa/ocelot/felix.h+1−1
@@ -1,5 +1,5 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
2−/* Copyright 2019 NXP Semiconductors
2+/* Copyright 2019 NXP
33 */
44 #ifndef _MSCC_FELIX_H
55 #define _MSCC_FELIX_H
drivers/net/dsa/ocelot/felix_vsc9959.c+19−3
@@ -1,6 +1,6 @@
11 // SPDX-License-Identifier: (GPL-2.0 OR MIT)
22 /* Copyright 2017 Microsemi Corporation
3− * Copyright 2018-2019 NXP Semiconductors
3+ * Copyright 2018-2019 NXP
44 */
55 #include <linux/fsl/enetc_mdio.h>
66 #include <soc/mscc/ocelot_qsys.h>
@@ -1472,9 +1472,10 @@ err_pci_enable: · 1465 unmodified lines
14721472
14731473 static void felix_pci_remove(struct pci_dev *pdev)
14741474 {
1475− struct felix *felix;
1475+ struct felix *felix = pci_get_drvdata(pdev);
14761476
1477− felix = pci_get_drvdata(pdev);
1477+ if (!felix)
1478+ return;
14781479
14791480 dsa_unregister_switch(felix->ds);
14801481
@@ -1482,6 +1483,20 @@ static void felix_pci_remove(struct pci_dev *pdev) · 1 unmodified line
14821483 kfree(felix);
14831484
14841485 pci_disable_device(pdev);
1486+
1487+ pci_set_drvdata(pdev, NULL);
1488+}
1489+
1490+static void felix_pci_shutdown(struct pci_dev *pdev)
1491+{
1492+ struct felix *felix = pci_get_drvdata(pdev);
1493+
1494+ if (!felix)
1495+ return;
1496+
1497+ dsa_switch_shutdown(felix->ds);
1498+
1499+ pci_set_drvdata(pdev, NULL);
14851500 }
14861501
14871502 static struct pci_device_id felix_ids[] = {
@@ -1498,6 +1513,7 @@ static struct pci_driver felix_vsc9959_pci_driver = { · 10 unmodified lines
14981513 .id_table = felix_ids,
14991514 .probe = felix_pci_probe,
15001515 .remove = felix_pci_remove,
1516+ .shutdown = felix_pci_shutdown,
15011517 };
15021518 module_pci_driver(felix_vsc9959_pci_driver);
15031519
drivers/net/dsa/ocelot/seville_vsc9953.c+18−2
@@ -1245,18 +1245,33 @@ err_alloc_felix: · 1244 unmodified lines
12451245
12461246 static int seville_remove(struct platform_device *pdev)
12471247 {
1248− struct felix *felix;
1248+ struct felix *felix = platform_get_drvdata(pdev);
12491249
1250− felix = platform_get_drvdata(pdev);
1250+ if (!felix)
1251+ return 0;
12511252
12521253 dsa_unregister_switch(felix->ds);
12531254
12541255 kfree(felix->ds);
12551256 kfree(felix);
12561257
1258+ platform_set_drvdata(pdev, NULL);
1259+
12571260 return 0;
12581261 }
12591262
1263+static void seville_shutdown(struct platform_device *pdev)
1264+{
1265+ struct felix *felix = platform_get_drvdata(pdev);
1266+
1267+ if (!felix)
1268+ return;
1269+
1270+ dsa_switch_shutdown(felix->ds);
1271+
1272+ platform_set_drvdata(pdev, NULL);
1273+}
1274+
12601275 static const struct of_device_id seville_of_match[] = {
12611276 { .compatible = "mscc,vsc9953-switch" },
12621277 { },
@@ -1266,6 +1281,7 @@ MODULE_DEVICE_TABLE(of, seville_of_match); · 3 unmodified lines
12661281 static struct platform_driver seville_vsc9953_driver = {
12671282 .probe = seville_probe,
12681283 .remove = seville_remove,
1284+ .shutdown = seville_shutdown,
12691285 .driver = {
12701286 .name = "mscc_seville",
12711287 .of_match_table = of_match_ptr(seville_of_match),
drivers/net/dsa/qca/ar9331.c+18−0
@@ -1083,6 +1083,9 @@ static void ar9331_sw_remove(struct mdio_device *mdiodev) · 1082 unmodified lines
10831083 struct ar9331_sw_priv *priv = dev_get_drvdata(&mdiodev->dev);
10841084 unsigned int i;
10851085
1086+ if (!priv)
1087+ return;
1088+
10861089 for (i = 0; i < ARRAY_SIZE(priv->port); i++) {
10871090 struct ar9331_sw_port *port = &priv->port[i];
10881091
@@ -1094,6 +1097,20 @@ static void ar9331_sw_remove(struct mdio_device *mdiodev) · 5 unmodified lines
10941097 dsa_unregister_switch(&priv->ds);
10951098
10961099 reset_control_assert(priv->sw_reset);
1100+
1101+ dev_set_drvdata(&mdiodev->dev, NULL);
1102+}
1103+
1104+static void ar9331_sw_shutdown(struct mdio_device *mdiodev)
1105+{
1106+ struct ar9331_sw_priv *priv = dev_get_drvdata(&mdiodev->dev);
1107+
1108+ if (!priv)
1109+ return;
1110+
1111+ dsa_switch_shutdown(&priv->ds);
1112+
1113+ dev_set_drvdata(&mdiodev->dev, NULL);
10971114 }
10981115
10991116 static const struct of_device_id ar9331_sw_of_match[] = {
@@ -1104,6 +1121,7 @@ static const struct of_device_id ar9331_sw_of_match[] = { · 4 unmodified lines
11041121 static struct mdio_driver ar9331_sw_mdio_driver = {
11051122 .probe = ar9331_sw_probe,
11061123 .remove = ar9331_sw_remove,
1124+ .shutdown = ar9331_sw_shutdown,
11071125 .mdiodrv.driver = {
11081126 .name = AR9331_SW_NAME,
11091127 .of_match_table = ar9331_sw_of_match,
drivers/net/dsa/qca8k.c+18−0
@@ -1880,10 +1880,27 @@ qca8k_sw_remove(struct mdio_device *mdiodev) · 1879 unmodified lines
18801880 struct qca8k_priv *priv = dev_get_drvdata(&mdiodev->dev);
18811881 int i;
18821882
1883+ if (!priv)
1884+ return;
1885+
18831886 for (i = 0; i < QCA8K_NUM_PORTS; i++)
18841887 qca8k_port_set_status(priv, i, 0);
18851888
18861889 dsa_unregister_switch(priv->ds);
1890+
1891+ dev_set_drvdata(&mdiodev->dev, NULL);
1892+}
1893+
1894+static void qca8k_sw_shutdown(struct mdio_device *mdiodev)
1895+{
1896+ struct qca8k_priv *priv = dev_get_drvdata(&mdiodev->dev);
1897+
1898+ if (!priv)
1899+ return;
1900+
1901+ dsa_switch_shutdown(priv->ds);
1902+
1903+ dev_set_drvdata(&mdiodev->dev, NULL);
18871904 }
18881905
18891906 #ifdef CONFIG_PM_SLEEP
@@ -1940,6 +1957,7 @@ static const struct of_device_id qca8k_of_match[] = { · 50 unmodified lines
19401957 static struct mdio_driver qca8kmdio_driver = {
19411958 .probe = qca8k_sw_probe,
19421959 .remove = qca8k_sw_remove,
1960+ .shutdown = qca8k_sw_shutdown,
19431961 .mdiodrv.driver = {
19441962 .name = "qca8k",
19451963 .of_match_table = qca8k_of_match,
drivers/net/dsa/realtek-smi-core.c+20−2
@@ -368,7 +368,7 @@ int realtek_smi_setup_mdio(struct realtek_smi *smi) · 367 unmodified lines
368368 smi->slave_mii_bus->parent = smi->dev;
369369 smi->ds->slave_mii_bus = smi->slave_mii_bus;
370370
371− ret = of_mdiobus_register(smi->slave_mii_bus, mdio_np);
371+ ret = devm_of_mdiobus_register(smi->dev, smi->slave_mii_bus, mdio_np);
372372 if (ret) {
373373 dev_err(smi->dev, "unable to register MDIO bus %s\n",
374374 smi->slave_mii_bus->id);
@@ -464,16 +464,33 @@ static int realtek_smi_probe(struct platform_device *pdev) · 89 unmodified lines
464464
465465 static int realtek_smi_remove(struct platform_device *pdev)
466466 {
467− struct realtek_smi *smi = dev_get_drvdata(&pdev->dev);
467+ struct realtek_smi *smi = platform_get_drvdata(pdev);
468+
469+ if (!smi)
470+ return 0;
468471
469472 dsa_unregister_switch(smi->ds);
470473 if (smi->slave_mii_bus)
471474 of_node_put(smi->slave_mii_bus->dev.of_node);
472475 gpiod_set_value(smi->reset, 1);
473476
477+ platform_set_drvdata(pdev, NULL);
478+
474479 return 0;
475480 }
476481
482+static void realtek_smi_shutdown(struct platform_device *pdev)
483+{
484+ struct realtek_smi *smi = platform_get_drvdata(pdev);
485+
486+ if (!smi)
487+ return;
488+
489+ dsa_switch_shutdown(smi->ds);
490+
491+ platform_set_drvdata(pdev, NULL);
492+}
493+
477494 static const struct of_device_id realtek_smi_of_match[] = {
478495 {
479496 .compatible = "realtek,rtl8366rb",
@@ -495,6 +512,7 @@ static struct platform_driver realtek_smi_driver = { · 15 unmodified lines
495512 },
496513 .probe = realtek_smi_probe,
497514 .remove = realtek_smi_remove,
515+ .shutdown = realtek_smi_shutdown,
498516 };
499517 module_platform_driver(realtek_smi_driver);
500518
drivers/net/dsa/sja1105/sja1105_clocking.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: BSD-3-Clause
2−/* Copyright (c) 2016-2018, NXP Semiconductors
2+/* Copyright 2016-2018 NXP
33 * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com>
44 */
55 #include <linux/packing.h>
drivers/net/dsa/sja1105/sja1105_devlink.c+1−1
@@ -1,6 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0
22 /* Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com>
3− * Copyright 2020 NXP Semiconductors
3+ * Copyright 2020 NXP
44 */
55 #include "sja1105.h"
66
drivers/net/dsa/sja1105/sja1105_flower.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: GPL-2.0
2−/* Copyright 2020, NXP Semiconductors
2+/* Copyright 2020 NXP
33 */
44 #include "sja1105.h"
55 #include "sja1105_vl.h"
drivers/net/dsa/sja1105/sja1105_main.c+19−2
@@ -3340,13 +3340,29 @@ static int sja1105_probe(struct spi_device *spi) · 3339 unmodified lines
33403340 static int sja1105_remove(struct spi_device *spi)
33413341 {
33423342 struct sja1105_private *priv = spi_get_drvdata(spi);
3343− struct dsa_switch *ds = priv->ds;
33443343
3345− dsa_unregister_switch(ds);
3344+ if (!priv)
3345+ return 0;
3346+
3347+ dsa_unregister_switch(priv->ds);
3348+
3349+ spi_set_drvdata(spi, NULL);
33463350
33473351 return 0;
33483352 }
33493353
3354+static void sja1105_shutdown(struct spi_device *spi)
3355+{
3356+ struct sja1105_private *priv = spi_get_drvdata(spi);
3357+
3358+ if (!priv)
3359+ return;
3360+
3361+ dsa_switch_shutdown(priv->ds);
3362+
3363+ spi_set_drvdata(spi, NULL);
3364+}
3365+
33503366 static const struct of_device_id sja1105_dt_ids[] = {
33513367 { .compatible = "nxp,sja1105e", .data = &sja1105e_info },
33523368 { .compatible = "nxp,sja1105t", .data = &sja1105t_info },
@@ -3370,6 +3386,7 @@ static struct spi_driver sja1105_driver = { · 17 unmodified lines
33703386 },
33713387 .probe = sja1105_probe,
33723388 .remove = sja1105_remove,
3389+ .shutdown = sja1105_shutdown,
33733390 };
33743391
33753392 module_spi_driver(sja1105_driver);
drivers/net/dsa/sja1105/sja1105_mdio.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: GPL-2.0
2−/* Copyright 2021, NXP Semiconductors
2+/* Copyright 2021 NXP
33 */
44 #include <linux/pcs/pcs-xpcs.h>
55 #include <linux/of_mdio.h>
drivers/net/dsa/sja1105/sja1105_spi.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: BSD-3-Clause
2−/* Copyright (c) 2016-2018, NXP Semiconductors
2+/* Copyright 2016-2018 NXP
33 * Copyright (c) 2018, Sensor-Technik Wiedemann GmbH
44 * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com>
55 */
drivers/net/dsa/sja1105/sja1105_static_config.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: BSD-3-Clause
2−/* Copyright (c) 2016-2018, NXP Semiconductors
2+/* Copyright 2016-2018 NXP
33 * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com>
44 */
55 #include "sja1105_static_config.h"
drivers/net/dsa/sja1105/sja1105_static_config.h+1−1
@@ -1,5 +1,5 @@
11 /* SPDX-License-Identifier: BSD-3-Clause */
2−/* Copyright (c) 2016-2018, NXP Semiconductors
2+/* Copyright 2016-2018 NXP
33 * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com>
44 */
55 #ifndef _SJA1105_STATIC_CONFIG_H
drivers/net/dsa/sja1105/sja1105_vl.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: GPL-2.0
2−/* Copyright 2020, NXP Semiconductors
2+/* Copyright 2020 NXP
33 */
44 #include <net/tc_act/tc_gate.h>
55 #include <linux/dsa/8021q.h>
drivers/net/dsa/sja1105/sja1105_vl.h+1−1
@@ -1,5 +1,5 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
2−/* Copyright 2020, NXP Semiconductors
2+/* Copyright 2020 NXP
33 */
44 #ifndef _SJA1105_VL_H
55 #define _SJA1105_VL_H
drivers/net/dsa/vitesse-vsc73xx-core.c+6−0
@@ -1225,6 +1225,12 @@ int vsc73xx_remove(struct vsc73xx *vsc) · 1224 unmodified lines
12251225 }
12261226 EXPORT_SYMBOL(vsc73xx_remove);
12271227
1228+void vsc73xx_shutdown(struct vsc73xx *vsc)
1229+{
1230+ dsa_switch_shutdown(vsc->ds);
1231+}
1232+EXPORT_SYMBOL(vsc73xx_shutdown);
1233+
12281234 MODULE_AUTHOR("Linus Walleij <linus.walleij@linaro.org>");
12291235 MODULE_DESCRIPTION("Vitesse VSC7385/7388/7395/7398 driver");
12301236 MODULE_LICENSE("GPL v2");
drivers/net/dsa/vitesse-vsc73xx-platform.c+21−1
@@ -116,7 +116,26 @@ static int vsc73xx_platform_remove(struct platform_device *pdev) · 115 unmodified lines
116116 {
117117 struct vsc73xx_platform *vsc_platform = platform_get_drvdata(pdev);
118118
119− return vsc73xx_remove(&vsc_platform->vsc);
119+ if (!vsc_platform)
120+ return 0;
121+
122+ vsc73xx_remove(&vsc_platform->vsc);
123+
124+ platform_set_drvdata(pdev, NULL);
125+
126+ return 0;
127+}
128+
129+static void vsc73xx_platform_shutdown(struct platform_device *pdev)
130+{
131+ struct vsc73xx_platform *vsc_platform = platform_get_drvdata(pdev);
132+
133+ if (!vsc_platform)
134+ return;
135+
136+ vsc73xx_shutdown(&vsc_platform->vsc);
137+
138+ platform_set_drvdata(pdev, NULL);
120139 }
121140
122141 static const struct vsc73xx_ops vsc73xx_platform_ops = {
@@ -144,6 +163,7 @@ MODULE_DEVICE_TABLE(of, vsc73xx_of_match); · 21 unmodified lines
144163 static struct platform_driver vsc73xx_platform_driver = {
145164 .probe = vsc73xx_platform_probe,
146165 .remove = vsc73xx_platform_remove,
166+ .shutdown = vsc73xx_platform_shutdown,
147167 .driver = {
148168 .name = "vsc73xx-platform",
149169 .of_match_table = vsc73xx_of_match,
drivers/net/dsa/vitesse-vsc73xx-spi.c+21−1
@@ -163,7 +163,26 @@ static int vsc73xx_spi_remove(struct spi_device *spi) · 162 unmodified lines
163163 {
164164 struct vsc73xx_spi *vsc_spi = spi_get_drvdata(spi);
165165
166− return vsc73xx_remove(&vsc_spi->vsc);
166+ if (!vsc_spi)
167+ return 0;
168+
169+ vsc73xx_remove(&vsc_spi->vsc);
170+
171+ spi_set_drvdata(spi, NULL);
172+
173+ return 0;
174+}
175+
176+static void vsc73xx_spi_shutdown(struct spi_device *spi)
177+{
178+ struct vsc73xx_spi *vsc_spi = spi_get_drvdata(spi);
179+
180+ if (!vsc_spi)
181+ return;
182+
183+ vsc73xx_shutdown(&vsc_spi->vsc);
184+
185+ spi_set_drvdata(spi, NULL);
167186 }
168187
169188 static const struct vsc73xx_ops vsc73xx_spi_ops = {
@@ -191,6 +210,7 @@ MODULE_DEVICE_TABLE(of, vsc73xx_of_match); · 21 unmodified lines
191210 static struct spi_driver vsc73xx_spi_driver = {
192211 .probe = vsc73xx_spi_probe,
193212 .remove = vsc73xx_spi_remove,
213+ .shutdown = vsc73xx_spi_shutdown,
194214 .driver = {
195215 .name = "vsc73xx-spi",
196216 .of_match_table = vsc73xx_of_match,
drivers/net/dsa/vitesse-vsc73xx.h+1−0
@@ -27,3 +27,4 @@ struct vsc73xx_ops { · 26 unmodified lines
2727 int vsc73xx_is_addr_valid(u8 block, u8 subblock);
2828 int vsc73xx_probe(struct vsc73xx *vsc);
2929 int vsc73xx_remove(struct vsc73xx *vsc);
30+void vsc73xx_shutdown(struct vsc73xx *vsc);
drivers/net/dsa/xrs700x/xrs700x.c+6−0
@@ -822,6 +822,12 @@ void xrs700x_switch_remove(struct xrs700x *priv) · 821 unmodified lines
822822 }
823823 EXPORT_SYMBOL(xrs700x_switch_remove);
824824
825+void xrs700x_switch_shutdown(struct xrs700x *priv)
826+{
827+ dsa_switch_shutdown(priv->ds);
828+}
829+EXPORT_SYMBOL(xrs700x_switch_shutdown);
830+
825831 MODULE_AUTHOR("George McCollister <george.mccollister@gmail.com>");
826832 MODULE_DESCRIPTION("Arrow SpeedChips XRS700x DSA driver");
827833 MODULE_LICENSE("GPL v2");
drivers/net/dsa/xrs700x/xrs700x.h+1−0
@@ -40,3 +40,4 @@ struct xrs700x { · 39 unmodified lines
4040 struct xrs700x *xrs700x_switch_alloc(struct device *base, void *devpriv);
4141 int xrs700x_switch_register(struct xrs700x *priv);
4242 void xrs700x_switch_remove(struct xrs700x *priv);
43+void xrs700x_switch_shutdown(struct xrs700x *priv);
drivers/net/dsa/xrs700x/xrs700x_i2c.c+18−0
@@ -109,11 +109,28 @@ static int xrs700x_i2c_remove(struct i2c_client *i2c) · 108 unmodified lines
109109 {
110110 struct xrs700x *priv = i2c_get_clientdata(i2c);
111111
112+ if (!priv)
113+ return 0;
114+
112115 xrs700x_switch_remove(priv);
113116
117+ i2c_set_clientdata(i2c, NULL);
118+
114119 return 0;
115120 }
116121
122+static void xrs700x_i2c_shutdown(struct i2c_client *i2c)
123+{
124+ struct xrs700x *priv = i2c_get_clientdata(i2c);
125+
126+ if (!priv)
127+ return;
128+
129+ xrs700x_switch_shutdown(priv);
130+
131+ i2c_set_clientdata(i2c, NULL);
132+}
133+
117134 static const struct i2c_device_id xrs700x_i2c_id[] = {
118135 { "xrs700x-switch", 0 },
119136 {},
@@ -137,6 +154,7 @@ static struct i2c_driver xrs700x_i2c_driver = { · 17 unmodified lines
137154 },
138155 .probe = xrs700x_i2c_probe,
139156 .remove = xrs700x_i2c_remove,
157+ .shutdown = xrs700x_i2c_shutdown,
140158 .id_table = xrs700x_i2c_id,
141159 };
142160
drivers/net/dsa/xrs700x/xrs700x_mdio.c+18−0
@@ -136,7 +136,24 @@ static void xrs700x_mdio_remove(struct mdio_device *mdiodev) · 135 unmodified lines
136136 {
137137 struct xrs700x *priv = dev_get_drvdata(&mdiodev->dev);
138138
139+ if (!priv)
140+ return;
141+
139142 xrs700x_switch_remove(priv);
143+
144+ dev_set_drvdata(&mdiodev->dev, NULL);
145+}
146+
147+static void xrs700x_mdio_shutdown(struct mdio_device *mdiodev)
148+{
149+ struct xrs700x *priv = dev_get_drvdata(&mdiodev->dev);
150+
151+ if (!priv)
152+ return;
153+
154+ xrs700x_switch_shutdown(priv);
155+
156+ dev_set_drvdata(&mdiodev->dev, NULL);
140157 }
141158
142159 static const struct of_device_id __maybe_unused xrs700x_mdio_dt_ids[] = {
@@ -155,6 +172,7 @@ static struct mdio_driver xrs700x_mdio_driver = { · 12 unmodified lines
155172 },
156173 .probe = xrs700x_mdio_probe,
157174 .remove = xrs700x_mdio_remove,
175+ .shutdown = xrs700x_mdio_shutdown,
158176 };
159177
160178 mdio_module_driver(xrs700x_mdio_driver);
drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c+2−2
@@ -413,13 +413,13 @@ static int atl_resume_common(struct device *dev, bool deep) · 412 unmodified lines
413413 if (deep) {
414414 /* Reinitialize Nic/Vecs objects */
415415 aq_nic_deinit(nic, !nic->aq_hw->aq_nic_cfg->wol);
416+ }
416417
418+ if (netif_running(nic->ndev)) {
417419 ret = aq_nic_init(nic);
418420 if (ret)
419421 goto err_exit;
420− }
421422
422− if (netif_running(nic->ndev)) {
423423 ret = aq_nic_start(nic);
424424 if (ret)
425425 goto err_exit;
drivers/net/ethernet/broadcom/bgmac-bcma.c+2−0
@@ -129,6 +129,8 @@ static int bgmac_probe(struct bcma_device *core) · 128 unmodified lines
129129 bcma_set_drvdata(core, bgmac);
130130
131131 err = of_get_mac_address(bgmac->dev->of_node, bgmac->net_dev->dev_addr);
132+ if (err == -EPROBE_DEFER)
133+ return err;
132134
133135 /* If no MAC address assigned via device tree, check SPROM */
134136 if (err) {
drivers/net/ethernet/broadcom/bnxt/bnxt.c+4−4
@@ -391,7 +391,7 @@ static bool bnxt_txr_netif_try_stop_queue(struct bnxt *bp, · 390 unmodified lines
391391 * netif_tx_queue_stopped().
392392 */
393393 smp_mb();
394− if (bnxt_tx_avail(bp, txr) > bp->tx_wake_thresh) {
394+ if (bnxt_tx_avail(bp, txr) >= bp->tx_wake_thresh) {
395395 netif_tx_wake_queue(txq);
396396 return false;
397397 }
@@ -764,7 +764,7 @@ next_tx_int: · 366 unmodified lines
764764 smp_mb();
765765
766766 if (unlikely(netif_tx_queue_stopped(txq)) &&
767− bnxt_tx_avail(bp, txr) > bp->tx_wake_thresh &&
767+ bnxt_tx_avail(bp, txr) >= bp->tx_wake_thresh &&
768768 READ_ONCE(txr->dev_state) != BNXT_DEV_STATE_CLOSING)
769769 netif_tx_wake_queue(txq);
770770 }
@@ -2416,7 +2416,7 @@ static int __bnxt_poll_work(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, · 1645 unmodified lines
24162416 if (TX_CMP_TYPE(txcmp) == CMP_TYPE_TX_L2_CMP) {
24172417 tx_pkts++;
24182418 /* return full budget so NAPI will complete. */
2419− if (unlikely(tx_pkts > bp->tx_wake_thresh)) {
2419+ if (unlikely(tx_pkts >= bp->tx_wake_thresh)) {
24202420 rx_pkts = budget;
24212421 raw_cons = NEXT_RAW_CMP(raw_cons);
24222422 if (budget)
@@ -3640,7 +3640,7 @@ static int bnxt_init_tx_rings(struct bnxt *bp) · 1217 unmodified lines
36403640 u16 i;
36413641
36423642 bp->tx_wake_thresh = max_t(int, bp->tx_ring_size / 2,
3643− MAX_SKB_FRAGS + 1);
3643+ BNXT_MIN_TX_DESC_CNT);
36443644
36453645 for (i = 0; i < bp->tx_nr_rings; i++) {
36463646 struct bnxt_tx_ring_info *txr = &bp->tx_ring[i];
drivers/net/ethernet/broadcom/bnxt/bnxt.h+5−0
@@ -629,6 +629,11 @@ struct nqe_cn { · 628 unmodified lines
629629 #define BNXT_MAX_RX_JUM_DESC_CNT (RX_DESC_CNT * MAX_RX_AGG_PAGES - 1)
630630 #define BNXT_MAX_TX_DESC_CNT (TX_DESC_CNT * MAX_TX_PAGES - 1)
631631
632+/* Minimum TX BDs for a TX packet with MAX_SKB_FRAGS + 1. We need one extra
633+ * BD because the first TX BD is always a long BD.
634+ */
635+#define BNXT_MIN_TX_DESC_CNT (MAX_SKB_FRAGS + 2)
636+
632637 #define RX_RING(x) (((x) & ~(RX_DESC_CNT - 1)) >> (BNXT_PAGE_SHIFT - 4))
633638 #define RX_IDX(x) ((x) & (RX_DESC_CNT - 1))
634639
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c+1−1
@@ -798,7 +798,7 @@ static int bnxt_set_ringparam(struct net_device *dev, · 797 unmodified lines
798798
799799 if ((ering->rx_pending > BNXT_MAX_RX_DESC_CNT) ||
800800 (ering->tx_pending > BNXT_MAX_TX_DESC_CNT) ||
801− (ering->tx_pending <= MAX_SKB_FRAGS))
801+ (ering->tx_pending < BNXT_MIN_TX_DESC_CNT))
802802 return -EINVAL;
803803
804804 if (netif_running(dev))
drivers/net/ethernet/freescale/enetc/enetc.c+2−5
@@ -419,7 +419,7 @@ static void enetc_rx_dim_work(struct work_struct *w) · 418 unmodified lines
419419
420420 static void enetc_rx_net_dim(struct enetc_int_vector *v)
421421 {
422− struct dim_sample dim_sample;
422+ struct dim_sample dim_sample = {};
423423
424424 v->comp_cnt++;
425425
@@ -1879,7 +1879,6 @@ static void enetc_clear_bdrs(struct enetc_ndev_priv *priv) · 1453 unmodified lines
18791879 static int enetc_setup_irqs(struct enetc_ndev_priv *priv)
18801880 {
18811881 struct pci_dev *pdev = priv->si->pdev;
1882− cpumask_t cpu_mask;
18831882 int i, j, err;
18841883
18851884 for (i = 0; i < priv->bdr_int_num; i++) {
@@ -1908,9 +1907,7 @@ static int enetc_setup_irqs(struct enetc_ndev_priv *priv) · 22 unmodified lines
19081907
19091908 enetc_wr(hw, ENETC_SIMSITRV(idx), entry);
19101909 }
1911− cpumask_clear(&cpu_mask);
1912− cpumask_set_cpu(i % num_online_cpus(), &cpu_mask);
1913− irq_set_affinity_hint(irq, &cpu_mask);
1910+ irq_set_affinity_hint(irq, get_cpu_mask(i % num_online_cpus()));
19141911 }
19151912
19161913 return 0;
drivers/net/ethernet/freescale/enetc/enetc_ierb.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
2−/* Copyright 2021 NXP Semiconductors
2+/* Copyright 2021 NXP
33 *
44 * The Integrated Endpoint Register Block (IERB) is configured by pre-boot
55 * software and is supposed to be to ENETC what a NVRAM is to a 'real' PCIe
drivers/net/ethernet/freescale/enetc/enetc_ierb.h+1−1
@@ -1,5 +1,5 @@
11 /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
2−/* Copyright 2021 NXP Semiconductors */
2+/* Copyright 2021 NXP */
33
44 #include <linux/pci.h>
55 #include <linux/platform_device.h>
drivers/net/ethernet/freescale/fec_main.c+0−1
@@ -4176,5 +4176,4 @@ static struct platform_driver fec_driver = { · 4175 unmodified lines
41764176
41774177 module_platform_driver(fec_driver);
41784178
4179−MODULE_ALIAS("platform:"DRIVER_NAME);
41804179 MODULE_LICENSE("GPL");
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c+4−4
@@ -2445,12 +2445,12 @@ static void hclge_handle_over_8bd_err(struct hclge_dev *hdev, · 2444 unmodified lines
24452445 return;
24462446 }
24472447
2448− dev_err(dev, "PPU_PF_ABNORMAL_INT_ST over_8bd_no_fe found, vf_id(%u), queue_id(%u)\n",
2448+ dev_err(dev, "PPU_PF_ABNORMAL_INT_ST over_8bd_no_fe found, vport(%u), queue_id(%u)\n",
24492449 vf_id, q_id);
24502450
24512451 if (vf_id) {
24522452 if (vf_id >= hdev->num_alloc_vport) {
2453− dev_err(dev, "invalid vf id(%u)\n", vf_id);
2453+ dev_err(dev, "invalid vport(%u)\n", vf_id);
24542454 return;
24552455 }
24562456
@@ -2463,8 +2463,8 @@ static void hclge_handle_over_8bd_err(struct hclge_dev *hdev, · 6 unmodified lines
24632463
24642464 ret = hclge_inform_reset_assert_to_vf(&hdev->vport[vf_id]);
24652465 if (ret)
2466− dev_err(dev, "inform reset to vf(%u) failed %d!\n",
2467− hdev->vport->vport_id, ret);
2466+ dev_err(dev, "inform reset to vport(%u) failed %d!\n",
2467+ vf_id, ret);
24682468 } else {
24692469 set_bit(HNAE3_FUNC_RESET, reset_requests);
24702470 }
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c+55−25
@@ -3667,7 +3667,8 @@ static int hclge_set_all_vf_rst(struct hclge_dev *hdev, bool reset) · 3666 unmodified lines
36673667 if (ret) {
36683668 dev_err(&hdev->pdev->dev,
36693669 "set vf(%u) rst failed %d!\n",
3670− vport->vport_id, ret);
3670+ vport->vport_id - HCLGE_VF_VPORT_START_NUM,
3671+ ret);
36713672 return ret;
36723673 }
36733674
@@ -3682,7 +3683,8 @@ static int hclge_set_all_vf_rst(struct hclge_dev *hdev, bool reset) · 8 unmodified lines
36823683 if (ret)
36833684 dev_warn(&hdev->pdev->dev,
36843685 "inform reset to vf(%u) failed %d!\n",
3685− vport->vport_id, ret);
3686+ vport->vport_id - HCLGE_VF_VPORT_START_NUM,
3687+ ret);
36863688 }
36873689
36883690 return 0;
@@ -4747,6 +4749,24 @@ static int hclge_get_rss(struct hnae3_handle *handle, u32 *indir, · 1058 unmodified lines
47474749 return 0;
47484750 }
47494751
4752+static int hclge_parse_rss_hfunc(struct hclge_vport *vport, const u8 hfunc,
4753+ u8 *hash_algo)
4754+{
4755+ switch (hfunc) {
4756+ case ETH_RSS_HASH_TOP:
4757+ *hash_algo = HCLGE_RSS_HASH_ALGO_TOEPLITZ;
4758+ return 0;
4759+ case ETH_RSS_HASH_XOR:
4760+ *hash_algo = HCLGE_RSS_HASH_ALGO_SIMPLE;
4761+ return 0;
4762+ case ETH_RSS_HASH_NO_CHANGE:
4763+ *hash_algo = vport->rss_algo;
4764+ return 0;
4765+ default:
4766+ return -EINVAL;
4767+ }
4768+}
4769+
47504770 static int hclge_set_rss(struct hnae3_handle *handle, const u32 *indir,
47514771 const u8 *key, const u8 hfunc)
47524772 {
@@ -4756,30 +4776,27 @@ static int hclge_set_rss(struct hnae3_handle *handle, const u32 *indir, · 3 unmodified lines
47564776 u8 hash_algo;
47574777 int ret, i;
47584778
4779+ ret = hclge_parse_rss_hfunc(vport, hfunc, &hash_algo);
4780+ if (ret) {
4781+ dev_err(&hdev->pdev->dev, "invalid hfunc type %u\n", hfunc);
4782+ return ret;
4783+ }
4784+
47594785 /* Set the RSS Hash Key if specififed by the user */
47604786 if (key) {
4761− switch (hfunc) {
4762− case ETH_RSS_HASH_TOP:
4763− hash_algo = HCLGE_RSS_HASH_ALGO_TOEPLITZ;
4764− break;
4765− case ETH_RSS_HASH_XOR:
4766− hash_algo = HCLGE_RSS_HASH_ALGO_SIMPLE;
4767− break;
4768− case ETH_RSS_HASH_NO_CHANGE:
4769− hash_algo = vport->rss_algo;
4770− break;
4771− default:
4772− return -EINVAL;
4773− }
4774−
47754787 ret = hclge_set_rss_algo_key(hdev, hash_algo, key);
47764788 if (ret)
47774789 return ret;
47784790
47794791 /* Update the shadow RSS key with user specified qids */
47804792 memcpy(vport->rss_hash_key, key, HCLGE_RSS_KEY_SIZE);
4781− vport->rss_algo = hash_algo;
4793+ } else {
4794+ ret = hclge_set_rss_algo_key(hdev, hash_algo,
4795+ vport->rss_hash_key);
4796+ if (ret)
4797+ return ret;
47824798 }
4799+ vport->rss_algo = hash_algo;
47834800
47844801 /* Update the shadow RSS table with user specified qids */
47854802 for (i = 0; i < ae_dev->dev_specs.rss_ind_tbl_size; i++)
@@ -6633,10 +6650,13 @@ static int hclge_fd_parse_ring_cookie(struct hclge_dev *hdev, u64 ring_cookie, · 1847 unmodified lines
66336650 u8 vf = ethtool_get_flow_spec_ring_vf(ring_cookie);
66346651 u16 tqps;
66356652
6653+ /* To keep consistent with user's configuration, minus 1 when
6654+ * printing 'vf', because vf id from ethtool is added 1 for vf.
6655+ */
66366656 if (vf > hdev->num_req_vfs) {
66376657 dev_err(&hdev->pdev->dev,
6638− "Error: vf id (%u) > max vf num (%u)\n",
6639− vf, hdev->num_req_vfs);
6658+ "Error: vf id (%u) should be less than %u\n",
6659+ vf - 1, hdev->num_req_vfs);
66406660 return -EINVAL;
66416661 }
66426662
@@ -9825,6 +9845,9 @@ static int hclge_set_vlan_filter_hw(struct hclge_dev *hdev, __be16 proto, · 3182 unmodified lines
98259845 if (is_kill && !vlan_id)
98269846 return 0;
98279847
9848+ if (vlan_id >= VLAN_N_VID)
9849+ return -EINVAL;
9850+
98289851 ret = hclge_set_vf_vlan_common(hdev, vport_id, is_kill, vlan_id);
98299852 if (ret) {
98309853 dev_err(&hdev->pdev->dev,
@@ -10731,7 +10754,8 @@ static int hclge_reset_tqp_cmd_send(struct hclge_dev *hdev, u16 queue_id, · 900 unmodified lines
1073110754 return 0;
1073210755 }
1073310756
10734−static int hclge_get_reset_status(struct hclge_dev *hdev, u16 queue_id)
10757+static int hclge_get_reset_status(struct hclge_dev *hdev, u16 queue_id,
10758+ u8 *reset_status)
1073510759 {
1073610760 struct hclge_reset_tqp_queue_cmd *req;
1073710761 struct hclge_desc desc;
@@ -10749,7 +10773,9 @@ static int hclge_get_reset_status(struct hclge_dev *hdev, u16 queue_id) · 11 unmodified lines
1074910773 return ret;
1075010774 }
1075110775
10752− return hnae3_get_bit(req->ready_to_reset, HCLGE_TQP_RESET_B);
10776+ *reset_status = hnae3_get_bit(req->ready_to_reset, HCLGE_TQP_RESET_B);
10777+
10778+ return 0;
1075310779 }
1075410780
1075510781 u16 hclge_covert_handle_qid_global(struct hnae3_handle *handle, u16 queue_id)
@@ -10768,7 +10794,7 @@ static int hclge_reset_tqp_cmd(struct hnae3_handle *handle) · 12 unmodified lines
1076810794 struct hclge_vport *vport = hclge_get_vport(handle);
1076910795 struct hclge_dev *hdev = vport->back;
1077010796 u16 reset_try_times = 0;
10771− int reset_status;
10797+ u8 reset_status;
1077210798 u16 queue_gid;
1077310799 int ret;
1077410800 u16 i;
@@ -10784,7 +10810,11 @@ static int hclge_reset_tqp_cmd(struct hnae3_handle *handle) · 9 unmodified lines
1078410810 }
1078510811
1078610812 while (reset_try_times++ < HCLGE_TQP_RESET_TRY_TIMES) {
10787− reset_status = hclge_get_reset_status(hdev, queue_gid);
10813+ ret = hclge_get_reset_status(hdev, queue_gid,
10814+ &reset_status);
10815+ if (ret)
10816+ return ret;
10817+
1078810818 if (reset_status)
1078910819 break;
1079010820
@@ -11477,11 +11507,11 @@ static void hclge_clear_resetting_state(struct hclge_dev *hdev) · 686 unmodified lines
1147711507 struct hclge_vport *vport = &hdev->vport[i];
1147811508 int ret;
1147911509
11480− /* Send cmd to clear VF's FUNC_RST_ING */
11510+ /* Send cmd to clear vport's FUNC_RST_ING */
1148111511 ret = hclge_set_vf_rst(hdev, vport->vport_id, false);
1148211512 if (ret)
1148311513 dev_warn(&hdev->pdev->dev,
11484− "clear vf(%u) rst failed %d!\n",
11514+ "clear vport(%u) rst failed %d!\n",
1148511515 vport->vport_id, ret);
1148611516 }
1148711517 }
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c+9−1
@@ -566,7 +566,7 @@ static int hclge_reset_vf(struct hclge_vport *vport) · 565 unmodified lines
566566 struct hclge_dev *hdev = vport->back;
567567
568568 dev_warn(&hdev->pdev->dev, "PF received VF reset request from VF %u!",
569− vport->vport_id);
569+ vport->vport_id - HCLGE_VF_VPORT_START_NUM);
570570
571571 return hclge_func_reset_cmd(hdev, vport->vport_id);
572572 }
@@ -590,9 +590,17 @@ static void hclge_get_queue_id_in_pf(struct hclge_vport *vport, · 17 unmodified lines
590590 struct hclge_mbx_vf_to_pf_cmd *mbx_req,
591591 struct hclge_respond_to_vf_msg *resp_msg)
592592 {
593+ struct hnae3_handle *handle = &vport->nic;
594+ struct hclge_dev *hdev = vport->back;
593595 u16 queue_id, qid_in_pf;
594596
595597 memcpy(&queue_id, mbx_req->msg.data, sizeof(queue_id));
598+ if (queue_id >= handle->kinfo.num_tqps) {
599+ dev_err(&hdev->pdev->dev, "Invalid queue id(%u) from VF %u\n",
600+ queue_id, mbx_req->mbx_src_vfid);
601+ return;
602+ }
603+
596604 qid_in_pf = hclge_covert_handle_qid_global(&vport->nic, queue_id);
597605 memcpy(resp_msg->data, &qid_in_pf, sizeof(qid_in_pf));
598606 resp_msg->len = sizeof(qid_in_pf);
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c+1−1
@@ -581,7 +581,7 @@ int hclge_tm_qs_shaper_cfg(struct hclge_vport *vport, int max_tx_rate) · 580 unmodified lines
581581 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
582582 if (ret) {
583583 dev_err(&hdev->pdev->dev,
584− "vf%u, qs%u failed to set tx_rate:%d, ret=%d\n",
584+ "vport%u, qs%u failed to set tx_rate:%d, ret=%d\n",
585585 vport->vport_id, shap_cfg_cmd->qs_id,
586586 max_tx_rate, ret);
587587 return ret;
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c+34−18
@@ -816,40 +816,56 @@ static int hclgevf_get_rss(struct hnae3_handle *handle, u32 *indir, u8 *key, · 815 unmodified lines
816816 return 0;
817817 }
818818
819+static int hclgevf_parse_rss_hfunc(struct hclgevf_dev *hdev, const u8 hfunc,
820+ u8 *hash_algo)
821+{
822+ switch (hfunc) {
823+ case ETH_RSS_HASH_TOP:
824+ *hash_algo = HCLGEVF_RSS_HASH_ALGO_TOEPLITZ;
825+ return 0;
826+ case ETH_RSS_HASH_XOR:
827+ *hash_algo = HCLGEVF_RSS_HASH_ALGO_SIMPLE;
828+ return 0;
829+ case ETH_RSS_HASH_NO_CHANGE:
830+ *hash_algo = hdev->rss_cfg.hash_algo;
831+ return 0;
832+ default:
833+ return -EINVAL;
834+ }
835+}
836+
819837 static int hclgevf_set_rss(struct hnae3_handle *handle, const u32 *indir,
820838 const u8 *key, const u8 hfunc)
821839 {
822840 struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle);
823841 struct hclgevf_rss_cfg *rss_cfg = &hdev->rss_cfg;
842+ u8 hash_algo;
824843 int ret, i;
825844
826845 if (hdev->ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V2) {
846+ ret = hclgevf_parse_rss_hfunc(hdev, hfunc, &hash_algo);
847+ if (ret)
848+ return ret;
849+
827850 /* Set the RSS Hash Key if specififed by the user */
828851 if (key) {
829− switch (hfunc) {
830− case ETH_RSS_HASH_TOP:
831− rss_cfg->hash_algo =
832− HCLGEVF_RSS_HASH_ALGO_TOEPLITZ;
833− break;
834− case ETH_RSS_HASH_XOR:
835− rss_cfg->hash_algo =
836− HCLGEVF_RSS_HASH_ALGO_SIMPLE;
837− break;
838− case ETH_RSS_HASH_NO_CHANGE:
839− break;
840− default:
841− return -EINVAL;
842− }
843−
844− ret = hclgevf_set_rss_algo_key(hdev, rss_cfg->hash_algo,
845− key);
846− if (ret)
852+ ret = hclgevf_set_rss_algo_key(hdev, hash_algo, key);
853+ if (ret) {
854+ dev_err(&hdev->pdev->dev,
855+ "invalid hfunc type %u\n", hfunc);
847856 return ret;
857+ }
848858
849859 /* Update the shadow RSS key with user specified qids */
850860 memcpy(rss_cfg->rss_hash_key, key,
851861 HCLGEVF_RSS_KEY_SIZE);
862+ } else {
863+ ret = hclgevf_set_rss_algo_key(hdev, hash_algo,
864+ rss_cfg->rss_hash_key);
865+ if (ret)
866+ return ret;
852867 }
868+ rss_cfg->hash_algo = hash_algo;
853869 }
854870
855871 /* update the shadow RSS table with user specified qids */
drivers/net/ethernet/intel/Kconfig+1−0
@@ -335,6 +335,7 @@ config IGC · 334 unmodified lines
335335 tristate "Intel(R) Ethernet Controller I225-LM/I225-V support"
336336 default n
337337 depends on PCI
338+ depends on PTP_1588_CLOCK_OPTIONAL
338339 help
339340 This driver supports Intel(R) Ethernet Controller I225-LM/I225-V
340341 family of adapters.
drivers/net/ethernet/mediatek/mtk_ppe_offload.c+3−0
@@ -186,6 +186,9 @@ mtk_flow_offload_replace(struct mtk_eth *eth, struct flow_cls_offload *f) · 185 unmodified lines
186186 int hash;
187187 int i;
188188
189+ if (rhashtable_lookup(&eth->flow_table, &f->cookie, mtk_flow_ht_params))
190+ return -EEXIST;
191+
189192 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_META)) {
190193 struct flow_match_meta match;
191194
drivers/net/ethernet/mellanox/mlx4/en_netdev.c+32−18
@@ -372,6 +372,9 @@ mlx4_en_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb, · 371 unmodified lines
372372 int nhoff = skb_network_offset(skb);
373373 int ret = 0;
374374
375+ if (skb->encapsulation)
376+ return -EPROTONOSUPPORT;
377+
375378 if (skb->protocol != htons(ETH_P_IP))
376379 return -EPROTONOSUPPORT;
377380
@@ -1269,7 +1272,6 @@ static void mlx4_en_do_set_rx_mode(struct work_struct *work) · 891 unmodified lines
12691272 if (!netif_carrier_ok(dev)) {
12701273 if (!mlx4_en_QUERY_PORT(mdev, priv->port)) {
12711274 if (priv->port_state.link_state) {
1272− priv->last_link_state = MLX4_DEV_EVENT_PORT_UP;
12731275 netif_carrier_on(dev);
12741276 en_dbg(LINK, priv, "Link Up\n");
12751277 }
@@ -1557,26 +1559,36 @@ static void mlx4_en_service_task(struct work_struct *work) · 281 unmodified lines
15571559 mutex_unlock(&mdev->state_lock);
15581560 }
15591561
1560−static void mlx4_en_linkstate(struct work_struct *work)
1562+static void mlx4_en_linkstate(struct mlx4_en_priv *priv)
1563+{
1564+ struct mlx4_en_port_state *port_state = &priv->port_state;
1565+ struct mlx4_en_dev *mdev = priv->mdev;
1566+ struct net_device *dev = priv->dev;
1567+ bool up;
1568+
1569+ if (mlx4_en_QUERY_PORT(mdev, priv->port))
1570+ port_state->link_state = MLX4_PORT_STATE_DEV_EVENT_PORT_DOWN;
1571+
1572+ up = port_state->link_state == MLX4_PORT_STATE_DEV_EVENT_PORT_UP;
1573+ if (up == netif_carrier_ok(dev))
1574+ netif_carrier_event(dev);
1575+ if (!up) {
1576+ en_info(priv, "Link Down\n");
1577+ netif_carrier_off(dev);
1578+ } else {
1579+ en_info(priv, "Link Up\n");
1580+ netif_carrier_on(dev);
1581+ }
1582+}
1583+
1584+static void mlx4_en_linkstate_work(struct work_struct *work)
15611585 {
15621586 struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv,
15631587 linkstate_task);
15641588 struct mlx4_en_dev *mdev = priv->mdev;
1565− int linkstate = priv->link_state;
15661589
15671590 mutex_lock(&mdev->state_lock);
1568− /* If observable port state changed set carrier state and
1569− * report to system log */
1570− if (priv->last_link_state != linkstate) {
1571− if (linkstate == MLX4_DEV_EVENT_PORT_DOWN) {
1572− en_info(priv, "Link Down\n");
1573− netif_carrier_off(priv->dev);
1574− } else {
1575− en_info(priv, "Link Up\n");
1576− netif_carrier_on(priv->dev);
1577− }
1578− }
1579− priv->last_link_state = linkstate;
1591+ mlx4_en_linkstate(priv);
15801592 mutex_unlock(&mdev->state_lock);
15811593 }
15821594
@@ -2079,9 +2091,11 @@ static int mlx4_en_open(struct net_device *dev) · 496 unmodified lines
20792091 mlx4_en_clear_stats(dev);
20802092
20812093 err = mlx4_en_start_port(dev);
2082− if (err)
2094+ if (err) {
20832095 en_err(priv, "Failed starting port:%d\n", priv->port);
2084−
2096+ goto out;
2097+ }
2098+ mlx4_en_linkstate(priv);
20852099 out:
20862100 mutex_unlock(&mdev->state_lock);
20872101 return err;
@@ -3168,7 +3182,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, · 1080 unmodified lines
31683182 spin_lock_init(&priv->stats_lock);
31693183 INIT_WORK(&priv->rx_mode_task, mlx4_en_do_set_rx_mode);
31703184 INIT_WORK(&priv->restart_task, mlx4_en_restart);
3171− INIT_WORK(&priv->linkstate_task, mlx4_en_linkstate);
3185+ INIT_WORK(&priv->linkstate_task, mlx4_en_linkstate_work);
31723186 INIT_DELAYED_WORK(&priv->stats_task, mlx4_en_do_get_stats);
31733187 INIT_DELAYED_WORK(&priv->service_task, mlx4_en_service_task);
31743188 #ifdef CONFIG_RFS_ACCEL
drivers/net/ethernet/mellanox/mlx4/mlx4_en.h+0−1
@@ -552,7 +552,6 @@ struct mlx4_en_priv { · 551 unmodified lines
552552
553553 struct mlx4_hwq_resources res;
554554 int link_state;
555− int last_link_state;
556555 bool port_up;
557556 int port;
558557 int registered;
drivers/net/ethernet/mscc/ocelot.c+8−13
@@ -563,16 +563,6 @@ void ocelot_phylink_mac_link_up(struct ocelot *ocelot, int port, · 562 unmodified lines
563563 ocelot_port_writel(ocelot_port, DEV_MAC_ENA_CFG_RX_ENA |
564564 DEV_MAC_ENA_CFG_TX_ENA, DEV_MAC_ENA_CFG);
565565
566− /* Take MAC, Port, Phy (intern) and PCS (SGMII/Serdes) clock out of
567− * reset
568− */
569− ocelot_port_writel(ocelot_port, DEV_CLOCK_CFG_LINK_SPEED(speed),
570− DEV_CLOCK_CFG);
571−
572− /* No PFC */
573− ocelot_write_gix(ocelot, ANA_PFC_PFC_CFG_FC_LINK_SPEED(speed),
574− ANA_PFC_PFC_CFG, port);
575−
576566 /* Core: Enable port for frame transfer */
577567 ocelot_fields_write(ocelot, port,
578568 QSYS_SWITCH_PORT_MODE_PORT_ENA, 1);
@@ -1303,14 +1293,19 @@ static u32 ocelot_get_bond_mask(struct ocelot *ocelot, struct net_device *bond, · 724 unmodified lines
13031293 return mask;
13041294 }
13051295
1306−static u32 ocelot_get_bridge_fwd_mask(struct ocelot *ocelot,
1296+static u32 ocelot_get_bridge_fwd_mask(struct ocelot *ocelot, int src_port,
13071297 struct net_device *bridge)
13081298 {
1299+ struct ocelot_port *ocelot_port = ocelot->ports[src_port];
13091300 u32 mask = 0;
13101301 int port;
13111302
1303+ if (!ocelot_port || ocelot_port->bridge != bridge ||
1304+ ocelot_port->stp_state != BR_STATE_FORWARDING)
1305+ return 0;
1306+
13121307 for (port = 0; port < ocelot->num_phys_ports; port++) {
1313− struct ocelot_port *ocelot_port = ocelot->ports[port];
1308+ ocelot_port = ocelot->ports[port];
13141309
13151310 if (!ocelot_port)
13161311 continue;
@@ -1376,7 +1371,7 @@ void ocelot_apply_bridge_fwd_mask(struct ocelot *ocelot) · 59 unmodified lines
13761371 struct net_device *bridge = ocelot_port->bridge;
13771372 struct net_device *bond = ocelot_port->bond;
13781373
1379− mask = ocelot_get_bridge_fwd_mask(ocelot, bridge);
1374+ mask = ocelot_get_bridge_fwd_mask(ocelot, port, bridge);
13801375 mask |= cpu_fwd_mask;
13811376 mask &= ~BIT(port);
13821377 if (bond) {
drivers/net/ethernet/mscc/ocelot_devlink.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: (GPL-2.0 OR MIT)
2−/* Copyright 2020-2021 NXP Semiconductors
2+/* Copyright 2020-2021 NXP
33 */
44 #include <net/devlink.h>
55 #include "ocelot.h"
drivers/net/ethernet/mscc/ocelot_mrp.c+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 /* Microsemi Ocelot Switch driver
33 *
44 * Copyright (c) 2017, 2019 Microsemi Corporation
5− * Copyright 2020-2021 NXP Semiconductors
5+ * Copyright 2020-2021 NXP
66 */
77
88 #include <linux/if_bridge.h>
drivers/net/ethernet/mscc/ocelot_net.c+1−1
@@ -5,7 +5,7 @@ · 4 unmodified lines
55 * mscc_ocelot_switch_lib.
66 *
77 * Copyright (c) 2017, 2019 Microsemi Corporation
8− * Copyright 2020-2021 NXP Semiconductors
8+ * Copyright 2020-2021 NXP
99 */
1010
1111 #include <linux/if_bridge.h>
drivers/net/ethernet/qlogic/qed/qed_iwarp.c+8−0
@@ -1297,6 +1297,14 @@ qed_iwarp_wait_cid_map_cleared(struct qed_hwfn *p_hwfn, struct qed_bmap *bmap) · 1296 unmodified lines
12971297 prev_weight = weight;
12981298
12991299 while (weight) {
1300+ /* If the HW device is during recovery, all resources are
1301+ * immediately reset without receiving a per-cid indication
1302+ * from HW. In this case we don't expect the cid_map to be
1303+ * cleared.
1304+ */
1305+ if (p_hwfn->cdev->recov_in_prog)
1306+ return 0;
1307+
13001308 msleep(QED_IWARP_MAX_CID_CLEAN_TIME);
13011309
13021310 weight = bitmap_weight(bmap->bitmap, bmap->max_count);
drivers/net/ethernet/qlogic/qed/qed_roce.c+8−0
@@ -77,6 +77,14 @@ void qed_roce_stop(struct qed_hwfn *p_hwfn) · 76 unmodified lines
7777 * Beyond the added delay we clear the bitmap anyway.
7878 */
7979 while (bitmap_weight(rcid_map->bitmap, rcid_map->max_count)) {
80+ /* If the HW device is during recovery, all resources are
81+ * immediately reset without receiving a per-cid indication
82+ * from HW. In this case we don't expect the cid bitmap to be
83+ * cleared.
84+ */
85+ if (p_hwfn->cdev->recov_in_prog)
86+ return;
87+
8088 msleep(100);
8189 if (wait_count++ > 20) {
8290 DP_NOTICE(p_hwfn, "cid bitmap wait timed out\n");
drivers/net/hamradio/dmascc.c+3−3
@@ -973,7 +973,7 @@ static inline void tx_on(struct scc_priv *priv) · 972 unmodified lines
973973 flags = claim_dma_lock();
974974 set_dma_mode(priv->param.dma, DMA_MODE_WRITE);
975975 set_dma_addr(priv->param.dma,
976− (int) priv->tx_buf[priv->tx_tail] + n);
976+ virt_to_bus(priv->tx_buf[priv->tx_tail]) + n);
977977 set_dma_count(priv->param.dma,
978978 priv->tx_len[priv->tx_tail] - n);
979979 release_dma_lock(flags);
@@ -1020,7 +1020,7 @@ static inline void rx_on(struct scc_priv *priv) · 40 unmodified lines
10201020 flags = claim_dma_lock();
10211021 set_dma_mode(priv->param.dma, DMA_MODE_READ);
10221022 set_dma_addr(priv->param.dma,
1023− (int) priv->rx_buf[priv->rx_head]);
1023+ virt_to_bus(priv->rx_buf[priv->rx_head]));
10241024 set_dma_count(priv->param.dma, BUF_SIZE);
10251025 release_dma_lock(flags);
10261026 enable_dma(priv->param.dma);
@@ -1233,7 +1233,7 @@ static void special_condition(struct scc_priv *priv, int rc) · 206 unmodified lines
12331233 if (priv->param.dma >= 0) {
12341234 flags = claim_dma_lock();
12351235 set_dma_addr(priv->param.dma,
1236− (int) priv->rx_buf[priv->rx_head]);
1236+ virt_to_bus(priv->rx_buf[priv->rx_head]));
12371237 set_dma_count(priv->param.dma, BUF_SIZE);
12381238 release_dma_lock(flags);
12391239 } else {
drivers/net/pcs/pcs-xpcs-nxp.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: GPL-2.0
2−/* Copyright 2021 NXP Semiconductors
2+/* Copyright 2021 NXP
33 */
44 #include <linux/pcs/pcs-xpcs.h>
55 #include "pcs-xpcs.h"
drivers/net/phy/mdio_device.c+11−0
@@ -179,6 +179,16 @@ static int mdio_remove(struct device *dev) · 178 unmodified lines
179179 return 0;
180180 }
181181
182+static void mdio_shutdown(struct device *dev)
183+{
184+ struct mdio_device *mdiodev = to_mdio_device(dev);
185+ struct device_driver *drv = mdiodev->dev.driver;
186+ struct mdio_driver *mdiodrv = to_mdio_driver(drv);
187+
188+ if (mdiodrv->shutdown)
189+ mdiodrv->shutdown(mdiodev);
190+}
191+
182192 /**
183193 * mdio_driver_register - register an mdio_driver with the MDIO layer
184194 * @drv: new mdio_driver to register
@@ -193,6 +203,7 @@ int mdio_driver_register(struct mdio_driver *drv) · 8 unmodified lines
193203 mdiodrv->driver.bus = &mdio_bus_type;
194204 mdiodrv->driver.probe = mdio_probe;
195205 mdiodrv->driver.remove = mdio_remove;
206+ mdiodrv->driver.shutdown = mdio_shutdown;
196207
197208 retval = driver_register(&mdiodrv->driver);
198209 if (retval) {
drivers/net/usb/hso.c+5−7
@@ -2719,14 +2719,14 @@ struct hso_device *hso_create_mux_serial_device(struct usb_interface *interface, · 2718 unmodified lines
27192719
27202720 serial = kzalloc(sizeof(*serial), GFP_KERNEL);
27212721 if (!serial)
2722− goto exit;
2722+ goto err_free_dev;
27232723
27242724 hso_dev->port_data.dev_serial = serial;
27252725 serial->parent = hso_dev;
27262726
27272727 if (hso_serial_common_create
27282728 (serial, 1, CTRL_URB_RX_SIZE, CTRL_URB_TX_SIZE))
2729− goto exit;
2729+ goto err_free_serial;
27302730
27312731 serial->tx_data_length--;
27322732 serial->write_data = hso_mux_serial_write_data;
@@ -2742,11 +2742,9 @@ struct hso_device *hso_create_mux_serial_device(struct usb_interface *interface, · 9 unmodified lines
27422742 /* done, return it */
27432743 return hso_dev;
27442744
2745−exit:
2746− if (serial) {
2747− tty_unregister_device(tty_drv, serial->minor);
2748− kfree(serial);
2749− }
2745+err_free_serial:
2746+ kfree(serial);
2747+err_free_dev:
27502748 kfree(hso_dev);
27512749 return NULL;
27522750
drivers/net/virtio_net.c+4−0
@@ -425,6 +425,10 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi, · 424 unmodified lines
425425
426426 skb_reserve(skb, p - buf);
427427 skb_put(skb, len);
428+
429+ page = (struct page *)page->private;
430+ if (page)
431+ give_pages(rq, page);
428432 goto ok;
429433 }
430434
drivers/net/vxlan.c+1−1
@@ -4756,12 +4756,12 @@ static void __net_exit vxlan_exit_batch_net(struct list_head *net_list) · 4755 unmodified lines
47564756 LIST_HEAD(list);
47574757 unsigned int h;
47584758
4759− rtnl_lock();
47604759 list_for_each_entry(net, net_list, exit_list) {
47614760 struct vxlan_net *vn = net_generic(net, vxlan_net_id);
47624761
47634762 unregister_nexthop_notifier(net, &vn->nexthop_notifier_block);
47644763 }
4764+ rtnl_lock();
47654765 list_for_each_entry(net, net_list, exit_list)
47664766 vxlan_destroy_tunnels(net, &list);
47674767
drivers/net/xen-netback/netback.c+1−1
@@ -499,7 +499,7 @@ check_frags: · 498 unmodified lines
499499 * the header's copy failed, and they are
500500 * sharing a slot, send an error
501501 */
502− if (i == 0 && sharedslot)
502+ if (i == 0 && !first_shinfo && sharedslot)
503503 xenvif_idx_release(queue, pending_idx,
504504 XEN_NETIF_RSP_ERROR);
505505 else
drivers/nfc/st-nci/spi.c+1−0
@@ -278,6 +278,7 @@ static int st_nci_spi_remove(struct spi_device *dev) · 277 unmodified lines
278278
279279 static struct spi_device_id st_nci_spi_id_table[] = {
280280 {ST_NCI_SPI_DRIVER_NAME, 0},
281+ {"st21nfcb-spi", 0},
281282 {}
282283 };
283284 MODULE_DEVICE_TABLE(spi, st_nci_spi_id_table);
drivers/nvme/host/core.c+7−10
@@ -3524,7 +3524,9 @@ static struct nvme_ns_head *nvme_find_ns_head(struct nvme_subsystem *subsys, · 3523 unmodified lines
35243524 lockdep_assert_held(&subsys->lock);
35253525
35263526 list_for_each_entry(h, &subsys->nsheads, entry) {
3527− if (h->ns_id == nsid && nvme_tryget_ns_head(h))
3527+ if (h->ns_id != nsid)
3528+ continue;
3529+ if (!list_empty(&h->list) && nvme_tryget_ns_head(h))
35283530 return h;
35293531 }
35303532
@@ -3843,6 +3845,10 @@ static void nvme_ns_remove(struct nvme_ns *ns) · 312 unmodified lines
38433845
38443846 mutex_lock(&ns->ctrl->subsys->lock);
38453847 list_del_rcu(&ns->siblings);
3848+ if (list_empty(&ns->head->list)) {
3849+ list_del_init(&ns->head->entry);
3850+ last_path = true;
3851+ }
38463852 mutex_unlock(&ns->ctrl->subsys->lock);
38473853
38483854 /* guarantee not available in head->list */
@@ -3856,20 +3862,11 @@ static void nvme_ns_remove(struct nvme_ns *ns) · 7 unmodified lines
38563862 nvme_cdev_del(&ns->cdev, &ns->cdev_device);
38573863 del_gendisk(ns->disk);
38583864 blk_cleanup_queue(ns->queue);
3859− if (blk_get_integrity(ns->disk))
3860− blk_integrity_unregister(ns->disk);
38613865
38623866 down_write(&ns->ctrl->namespaces_rwsem);
38633867 list_del_init(&ns->list);
38643868 up_write(&ns->ctrl->namespaces_rwsem);
38653869
3866− /* Synchronize with nvme_init_ns_head() */
3867− mutex_lock(&ns->head->subsys->lock);
3868− if (list_empty(&ns->head->list)) {
3869− list_del_init(&ns->head->entry);
3870− last_path = true;
3871− }
3872− mutex_unlock(&ns->head->subsys->lock);
38733870 if (last_path)
38743871 nvme_mpath_shutdown_disk(ns->head);
38753872 nvme_put_ns(ns);
drivers/nvme/host/multipath.c+5−2
@@ -600,14 +600,17 @@ static int nvme_update_ana_state(struct nvme_ctrl *ctrl, · 599 unmodified lines
600600
601601 down_read(&ctrl->namespaces_rwsem);
602602 list_for_each_entry(ns, &ctrl->namespaces, list) {
603− unsigned nsid = le32_to_cpu(desc->nsids[n]);
604−
603+ unsigned nsid;
604+again:
605+ nsid = le32_to_cpu(desc->nsids[n]);
605606 if (ns->head->ns_id < nsid)
606607 continue;
607608 if (ns->head->ns_id == nsid)
608609 nvme_update_ns_ana_state(desc, ns);
609610 if (++n == nr_nsids)
610611 break;
612+ if (ns->head->ns_id > nsid)
613+ goto again;
611614 }
612615 up_read(&ctrl->namespaces_rwsem);
613616 return 0;
drivers/nvme/host/rdma.c+3−13
@@ -656,8 +656,8 @@ static void nvme_rdma_free_queue(struct nvme_rdma_queue *queue) · 655 unmodified lines
656656 if (!test_and_clear_bit(NVME_RDMA_Q_ALLOCATED, &queue->flags))
657657 return;
658658
659− nvme_rdma_destroy_queue_ib(queue);
660659 rdma_destroy_id(queue->cm_id);
660+ nvme_rdma_destroy_queue_ib(queue);
661661 mutex_destroy(&queue->queue_lock);
662662 }
663663
@@ -1815,14 +1815,10 @@ static int nvme_rdma_conn_established(struct nvme_rdma_queue *queue) · 1151 unmodified lines
18151815 for (i = 0; i < queue->queue_size; i++) {
18161816 ret = nvme_rdma_post_recv(queue, &queue->rsp_ring[i]);
18171817 if (ret)
1818− goto out_destroy_queue_ib;
1818+ return ret;
18191819 }
18201820
18211821 return 0;
1822−
1823−out_destroy_queue_ib:
1824− nvme_rdma_destroy_queue_ib(queue);
1825− return ret;
18261822 }
18271823
18281824 static int nvme_rdma_conn_rejected(struct nvme_rdma_queue *queue,
@@ -1916,14 +1912,10 @@ static int nvme_rdma_route_resolved(struct nvme_rdma_queue *queue) · 87 unmodified lines
19161912 if (ret) {
19171913 dev_err(ctrl->ctrl.device,
19181914 "rdma_connect_locked failed (%d).\n", ret);
1919− goto out_destroy_queue_ib;
1915+ return ret;
19201916 }
19211917
19221918 return 0;
1923−
1924−out_destroy_queue_ib:
1925− nvme_rdma_destroy_queue_ib(queue);
1926− return ret;
19271919 }
19281920
19291921 static int nvme_rdma_cm_handler(struct rdma_cm_id *cm_id,
@@ -1954,8 +1946,6 @@ static int nvme_rdma_cm_handler(struct rdma_cm_id *cm_id, · 24 unmodified lines
19541946 case RDMA_CM_EVENT_ROUTE_ERROR:
19551947 case RDMA_CM_EVENT_CONNECT_ERROR:
19561948 case RDMA_CM_EVENT_UNREACHABLE:
1957− nvme_rdma_destroy_queue_ib(queue);
1958− fallthrough;
19591949 case RDMA_CM_EVENT_ADDR_ERROR:
19601950 dev_dbg(queue->ctrl->ctrl.device,
19611951 "CM error event %d\n", ev->event);
drivers/nvme/host/tcp.c+10−10
@@ -274,6 +274,12 @@ static inline void nvme_tcp_send_all(struct nvme_tcp_queue *queue) · 273 unmodified lines
274274 } while (ret > 0);
275275 }
276276
277+static inline bool nvme_tcp_queue_more(struct nvme_tcp_queue *queue)
278+{
279+ return !list_empty(&queue->send_list) ||
280+ !llist_empty(&queue->req_list) || queue->more_requests;
281+}
282+
277283 static inline void nvme_tcp_queue_request(struct nvme_tcp_request *req,
278284 bool sync, bool last)
279285 {
@@ -294,9 +300,10 @@ static inline void nvme_tcp_queue_request(struct nvme_tcp_request *req, · 14 unmodified lines
294300 nvme_tcp_send_all(queue);
295301 queue->more_requests = false;
296302 mutex_unlock(&queue->send_mutex);
297− } else if (last) {
298− queue_work_on(queue->io_cpu, nvme_tcp_wq, &queue->io_work);
299303 }
304+
305+ if (last && nvme_tcp_queue_more(queue))
306+ queue_work_on(queue->io_cpu, nvme_tcp_wq, &queue->io_work);
300307 }
301308
302309 static void nvme_tcp_process_req_list(struct nvme_tcp_queue *queue)
@@ -906,12 +913,6 @@ done: · 603 unmodified lines
906913 read_unlock_bh(&sk->sk_callback_lock);
907914 }
908915
909−static inline bool nvme_tcp_queue_more(struct nvme_tcp_queue *queue)
910−{
911− return !list_empty(&queue->send_list) ||
912− !llist_empty(&queue->req_list) || queue->more_requests;
913−}
914−
915916 static inline void nvme_tcp_done_send_req(struct nvme_tcp_queue *queue)
916917 {
917918 queue->request = NULL;
@@ -1145,8 +1146,7 @@ static void nvme_tcp_io_work(struct work_struct *w) · 227 unmodified lines
11451146 pending = true;
11461147 else if (unlikely(result < 0))
11471148 break;
1148− } else
1149− pending = !llist_empty(&queue->req_list);
1149+ }
11501150
11511151 result = nvme_tcp_try_recv(queue);
11521152 if (result > 0)
drivers/nvme/target/configfs.c+1−1
@@ -1067,7 +1067,7 @@ static ssize_t nvmet_subsys_attr_serial_show(struct config_item *item, · 1066 unmodified lines
10671067 {
10681068 struct nvmet_subsys *subsys = to_subsys(item);
10691069
1070− return snprintf(page, PAGE_SIZE, "%*s\n",
1070+ return snprintf(page, PAGE_SIZE, "%.*s\n",
10711071 NVMET_SN_MAX_SIZE, subsys->serial);
10721072 }
10731073
drivers/of/device.c+5−1
@@ -85,7 +85,11 @@ of_dma_set_restricted_buffer(struct device *dev, struct device_node *np) · 84 unmodified lines
8585 break;
8686 }
8787
88− if (i != count && of_reserved_mem_device_init_by_idx(dev, of_node, i))
88+ /*
89+ * Attempt to initialize a restricted-dma-pool region if one was found.
90+ * Note that count can hold a negative error code.
91+ */
92+ if (i < count && of_reserved_mem_device_init_by_idx(dev, of_node, i))
8993 dev_warn(dev, "failed to initialise \"restricted-dma-pool\" memory node\n");
9094 }
9195
drivers/of/property.c+0−2
@@ -1291,7 +1291,6 @@ DEFINE_SIMPLE_PROP(pwms, "pwms", "#pwm-cells") · 1290 unmodified lines
12911291 DEFINE_SIMPLE_PROP(resets, "resets", "#reset-cells")
12921292 DEFINE_SIMPLE_PROP(leds, "leds", NULL)
12931293 DEFINE_SIMPLE_PROP(backlight, "backlight", NULL)
1294−DEFINE_SIMPLE_PROP(phy_handle, "phy-handle", NULL)
12951294 DEFINE_SUFFIX_PROP(regulators, "-supply", NULL)
12961295 DEFINE_SUFFIX_PROP(gpio, "-gpio", "#gpio-cells")
12971296
@@ -1380,7 +1379,6 @@ static const struct supplier_bindings of_supplier_bindings[] = { · 82 unmodified lines
13801379 { .parse_prop = parse_resets, },
13811380 { .parse_prop = parse_leds, },
13821381 { .parse_prop = parse_backlight, },
1383− { .parse_prop = parse_phy_handle, },
13841382 { .parse_prop = parse_gpio_compat, },
13851383 { .parse_prop = parse_interrupts, },
13861384 { .parse_prop = parse_regulators, },
drivers/pci/pci-acpi.c+1−1
@@ -937,7 +937,7 @@ static struct acpi_device *acpi_pci_find_companion(struct device *dev); · 936 unmodified lines
937937
938938 void pci_set_acpi_fwnode(struct pci_dev *dev)
939939 {
940− if (!ACPI_COMPANION(&dev->dev) && !pci_dev_is_added(dev))
940+ if (!dev_fwnode(&dev->dev) && !pci_dev_is_added(dev))
941941 ACPI_COMPANION_SET(&dev->dev,
942942 acpi_pci_find_companion(&dev->dev));
943943 }
drivers/pci/quirks.c+7−2
@@ -5435,7 +5435,7 @@ DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, · 5434 unmodified lines
54355435 PCI_CLASS_MULTIMEDIA_HD_AUDIO, 8, quirk_gpu_hda);
54365436
54375437 /*
5438− * Create device link for NVIDIA GPU with integrated USB xHCI Host
5438+ * Create device link for GPUs with integrated USB xHCI Host
54395439 * controller to VGA.
54405440 */
54415441 static void quirk_gpu_usb(struct pci_dev *usb)
@@ -5444,9 +5444,11 @@ static void quirk_gpu_usb(struct pci_dev *usb) · 2 unmodified lines
54445444 }
54455445 DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
54465446 PCI_CLASS_SERIAL_USB, 8, quirk_gpu_usb);
5447+DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_ATI, PCI_ANY_ID,
5448+ PCI_CLASS_SERIAL_USB, 8, quirk_gpu_usb);
54475449
54485450 /*
5449− * Create device link for NVIDIA GPU with integrated Type-C UCSI controller
5451+ * Create device link for GPUs with integrated Type-C UCSI controller
54505452 * to VGA. Currently there is no class code defined for UCSI device over PCI
54515453 * so using UNKNOWN class for now and it will be updated when UCSI
54525454 * over PCI gets a class code.
@@ -5459,6 +5461,9 @@ static void quirk_gpu_usb_typec_ucsi(struct pci_dev *ucsi) · 6 unmodified lines
54595461 DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
54605462 PCI_CLASS_SERIAL_UNKNOWN, 8,
54615463 quirk_gpu_usb_typec_ucsi);
5464+DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_ATI, PCI_ANY_ID,
5465+ PCI_CLASS_SERIAL_UNKNOWN, 8,
5466+ quirk_gpu_usb_typec_ucsi);
54625467
54635468 /*
54645469 * Enable the NVIDIA GPU integrated HDA controller if the BIOS left it
drivers/pci/vpd.c+26−10
@@ -99,6 +99,24 @@ error: · 98 unmodified lines
9999 return off ?: PCI_VPD_SZ_INVALID;
100100 }
101101
102+static bool pci_vpd_available(struct pci_dev *dev)
103+{
104+ struct pci_vpd *vpd = &dev->vpd;
105+
106+ if (!vpd->cap)
107+ return false;
108+
109+ if (vpd->len == 0) {
110+ vpd->len = pci_vpd_size(dev);
111+ if (vpd->len == PCI_VPD_SZ_INVALID) {
112+ vpd->cap = 0;
113+ return false;
114+ }
115+ }
116+
117+ return true;
118+}
119+
102120 /*
103121 * Wait for last operation to complete.
104122 * This code has to spin since there is no other notification from the PCI
@@ -145,7 +163,7 @@ static ssize_t pci_vpd_read(struct pci_dev *dev, loff_t pos, size_t count, · 40 unmodified lines
145163 loff_t end = pos + count;
146164 u8 *buf = arg;
147165
148− if (!vpd->cap)
166+ if (!pci_vpd_available(dev))
149167 return -ENODEV;
150168
151169 if (pos < 0)
@@ -206,7 +224,7 @@ static ssize_t pci_vpd_write(struct pci_dev *dev, loff_t pos, size_t count, · 54 unmodified lines
206224 loff_t end = pos + count;
207225 int ret = 0;
208226
209− if (!vpd->cap)
227+ if (!pci_vpd_available(dev))
210228 return -ENODEV;
211229
212230 if (pos < 0 || (pos & 3) || (count & 3))
@@ -242,14 +260,11 @@ static ssize_t pci_vpd_write(struct pci_dev *dev, loff_t pos, size_t count, · 29 unmodified lines
242260
243261 void pci_vpd_init(struct pci_dev *dev)
244262 {
263+ if (dev->vpd.len == PCI_VPD_SZ_INVALID)
264+ return;
265+
245266 dev->vpd.cap = pci_find_capability(dev, PCI_CAP_ID_VPD);
246267 mutex_init(&dev->vpd.lock);
247−
248− if (!dev->vpd.len)
249− dev->vpd.len = pci_vpd_size(dev);
250−
251− if (dev->vpd.len == PCI_VPD_SZ_INVALID)
252− dev->vpd.cap = 0;
253268 }
254269
255270 static ssize_t vpd_read(struct file *filp, struct kobject *kobj,
@@ -294,13 +309,14 @@ const struct attribute_group pci_dev_vpd_attr_group = { · 38 unmodified lines
294309
295310 void *pci_vpd_alloc(struct pci_dev *dev, unsigned int *size)
296311 {
297− unsigned int len = dev->vpd.len;
312+ unsigned int len;
298313 void *buf;
299314 int cnt;
300315
301− if (!dev->vpd.cap)
316+ if (!pci_vpd_available(dev))
302317 return ERR_PTR(-ENODEV);
303318
319+ len = dev->vpd.len;
304320 buf = kmalloc(len, GFP_KERNEL);
305321 if (!buf)
306322 return ERR_PTR(-ENOMEM);
drivers/platform/x86/amd-pmc.c+1−1
@@ -71,7 +71,7 @@ · 70 unmodified lines
7171 #define AMD_CPU_ID_YC 0x14B5
7272
7373 #define PMC_MSG_DELAY_MIN_US 100
74−#define RESPONSE_REGISTER_LOOP_MAX 200
74+#define RESPONSE_REGISTER_LOOP_MAX 20000
7575
7676 #define SOC_SUBSYSTEM_IP_MAX 12
7777 #define DELAY_MIN_US 2000
drivers/platform/x86/dell/Kconfig+1−2
@@ -166,8 +166,7 @@ config DELL_WMI · 165 unmodified lines
166166
167167 config DELL_WMI_PRIVACY
168168 bool "Dell WMI Hardware Privacy Support"
169− depends on DELL_WMI
170− depends on LEDS_TRIGGER_AUDIO
169+ depends on LEDS_TRIGGER_AUDIO = y || DELL_WMI = LEDS_TRIGGER_AUDIO
171170 help
172171 This option adds integration with the "Dell Hardware Privacy"
173172 feature of Dell laptops to the dell-wmi driver.
drivers/platform/x86/gigabyte-wmi.c+1−0
@@ -144,6 +144,7 @@ static const struct dmi_system_id gigabyte_wmi_known_working_platforms[] = { · 143 unmodified lines
144144 DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550 AORUS ELITE"),
145145 DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550 AORUS ELITE V2"),
146146 DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550 GAMING X V2"),
147+ DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550I AORUS PRO AX"),
147148 DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550M AORUS PRO-P"),
148149 DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550M DS3H"),
149150 DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("Z390 I AORUS PRO WIFI-CF"),
drivers/platform/x86/intel/hid.c+22−5
@@ -118,12 +118,30 @@ static const struct dmi_system_id dmi_vgbs_allow_list[] = { · 117 unmodified lines
118118 { }
119119 };
120120
121+/*
122+ * Some devices, even non convertible ones, can send incorrect SW_TABLET_MODE
123+ * reports. Accept such reports only from devices in this list.
124+ */
125+static const struct dmi_system_id dmi_auto_add_switch[] = {
126+ {
127+ .matches = {
128+ DMI_EXACT_MATCH(DMI_CHASSIS_TYPE, "31" /* Convertible */),
129+ },
130+ },
131+ {
132+ .matches = {
133+ DMI_EXACT_MATCH(DMI_CHASSIS_TYPE, "32" /* Detachable */),
134+ },
135+ },
136+ {} /* Array terminator */
137+};
138+
121139 struct intel_hid_priv {
122140 struct input_dev *input_dev;
123141 struct input_dev *array;
124142 struct input_dev *switches;
125143 bool wakeup_mode;
126− bool dual_accel;
144+ bool auto_add_switch;
127145 };
128146
129147 #define HID_EVENT_FILTER_UUID "eeec56b3-4442-408f-a792-4edd4d758054"
@@ -452,10 +470,8 @@ static void notify_handler(acpi_handle handle, u32 event, void *context) · 322 unmodified lines
452470 * Some convertible have unreliable VGBS return which could cause incorrect
453471 * SW_TABLET_MODE report, in these cases we enable support when receiving
454472 * the first event instead of during driver setup.
455− *
456− * See dual_accel_detect.h for more info on the dual_accel check.
457473 */
458− if (!priv->switches && !priv->dual_accel && (event == 0xcc || event == 0xcd)) {
474+ if (!priv->switches && priv->auto_add_switch && (event == 0xcc || event == 0xcd)) {
459475 dev_info(&device->dev, "switch event received, enable switches supports\n");
460476 err = intel_hid_switches_setup(device);
461477 if (err)
@@ -596,7 +612,8 @@ static int intel_hid_probe(struct platform_device *device) · 134 unmodified lines
596612 return -ENOMEM;
597613 dev_set_drvdata(&device->dev, priv);
598614
599− priv->dual_accel = dual_accel_detect();
615+ /* See dual_accel_detect.h for more info on the dual_accel check. */
616+ priv->auto_add_switch = dmi_check_system(dmi_auto_add_switch) && !dual_accel_detect();
600617
601618 err = intel_hid_input_setup(device);
602619 if (err) {
drivers/platform/x86/intel/punit_ipc.c+1−2
@@ -8,7 +8,6 @@ · 7 unmodified lines
88 * which provide mailbox interface for power management usage.
99 */
1010
11−#include <linux/acpi.h>
1211 #include <linux/bitops.h>
1312 #include <linux/delay.h>
1413 #include <linux/device.h>
@@ -319,7 +318,7 @@ static struct platform_driver intel_punit_ipc_driver = { · 304 unmodified lines
319318 .remove = intel_punit_ipc_remove,
320319 .driver = {
321320 .name = "intel_punit_ipc",
322− .acpi_match_table = ACPI_PTR(punit_ipc_acpi_ids),
321+ .acpi_match_table = punit_ipc_acpi_ids,
323322 },
324323 };
325324
drivers/platform/x86/lg-laptop.c+1−1
@@ -655,7 +655,7 @@ static int acpi_add(struct acpi_device *device) · 654 unmodified lines
655655 goto out_platform_registered;
656656 }
657657 product = dmi_get_system_info(DMI_PRODUCT_NAME);
658− if (strlen(product) > 4)
658+ if (product && strlen(product) > 4)
659659 switch (product[4]) {
660660 case '5':
661661 case '6':
drivers/platform/x86/touchscreen_dmi.c+50−4
@@ -100,10 +100,10 @@ static const struct ts_dmi_data chuwi_hi10_air_data = { · 99 unmodified lines
100100 };
101101
102102 static const struct property_entry chuwi_hi10_plus_props[] = {
103− PROPERTY_ENTRY_U32("touchscreen-min-x", 0),
104− PROPERTY_ENTRY_U32("touchscreen-min-y", 5),
105− PROPERTY_ENTRY_U32("touchscreen-size-x", 1914),
106− PROPERTY_ENTRY_U32("touchscreen-size-y", 1283),
103+ PROPERTY_ENTRY_U32("touchscreen-min-x", 12),
104+ PROPERTY_ENTRY_U32("touchscreen-min-y", 10),
105+ PROPERTY_ENTRY_U32("touchscreen-size-x", 1908),
106+ PROPERTY_ENTRY_U32("touchscreen-size-y", 1270),
107107 PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-chuwi-hi10plus.fw"),
108108 PROPERTY_ENTRY_U32("silead,max-fingers", 10),
109109 PROPERTY_ENTRY_BOOL("silead,home-button"),
@@ -111,6 +111,15 @@ static const struct property_entry chuwi_hi10_plus_props[] = { · 1 unmodified line
111111 };
112112
113113 static const struct ts_dmi_data chuwi_hi10_plus_data = {
114+ .embedded_fw = {
115+ .name = "silead/gsl1680-chuwi-hi10plus.fw",
116+ .prefix = { 0xf0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 },
117+ .length = 34056,
118+ .sha256 = { 0xfd, 0x0a, 0x08, 0x08, 0x3c, 0xa6, 0x34, 0x4e,
119+ 0x2c, 0x49, 0x9c, 0xcd, 0x7d, 0x44, 0x9d, 0x38,
120+ 0x10, 0x68, 0xb5, 0xbd, 0xb7, 0x2a, 0x63, 0xb5,
121+ 0x67, 0x0b, 0x96, 0xbd, 0x89, 0x67, 0x85, 0x09 },
122+ },
114123 .acpi_name = "MSSL0017:00",
115124 .properties = chuwi_hi10_plus_props,
116125 };
@@ -141,6 +150,33 @@ static const struct ts_dmi_data chuwi_hi10_pro_data = { · 24 unmodified lines
141150 .properties = chuwi_hi10_pro_props,
142151 };
143152
153+static const struct property_entry chuwi_hibook_props[] = {
154+ PROPERTY_ENTRY_U32("touchscreen-min-x", 30),
155+ PROPERTY_ENTRY_U32("touchscreen-min-y", 4),
156+ PROPERTY_ENTRY_U32("touchscreen-size-x", 1892),
157+ PROPERTY_ENTRY_U32("touchscreen-size-y", 1276),
158+ PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
159+ PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
160+ PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-chuwi-hibook.fw"),
161+ PROPERTY_ENTRY_U32("silead,max-fingers", 10),
162+ PROPERTY_ENTRY_BOOL("silead,home-button"),
163+ { }
164+};
165+
166+static const struct ts_dmi_data chuwi_hibook_data = {
167+ .embedded_fw = {
168+ .name = "silead/gsl1680-chuwi-hibook.fw",
169+ .prefix = { 0xf0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 },
170+ .length = 40392,
171+ .sha256 = { 0xf7, 0xc0, 0xe8, 0x5a, 0x6c, 0xf2, 0xeb, 0x8d,
172+ 0x12, 0xc4, 0x45, 0xbf, 0x55, 0x13, 0x4c, 0x1a,
173+ 0x13, 0x04, 0x31, 0x08, 0x65, 0x73, 0xf7, 0xa8,
174+ 0x1b, 0x7d, 0x59, 0xc9, 0xe6, 0x97, 0xf7, 0x38 },
175+ },
176+ .acpi_name = "MSSL0017:00",
177+ .properties = chuwi_hibook_props,
178+};
179+
144180 static const struct property_entry chuwi_vi8_props[] = {
145181 PROPERTY_ENTRY_U32("touchscreen-min-x", 4),
146182 PROPERTY_ENTRY_U32("touchscreen-min-y", 6),
@@ -979,6 +1015,16 @@ const struct dmi_system_id touchscreen_dmi_table[] = { · 832 unmodified lines
9791015 DMI_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"),
9801016 },
9811017 },
1018+ {
1019+ /* Chuwi HiBook (CWI514) */
1020+ .driver_data = (void *)&chuwi_hibook_data,
1021+ .matches = {
1022+ DMI_MATCH(DMI_BOARD_VENDOR, "Hampoo"),
1023+ DMI_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"),
1024+ /* Above matches are too generic, add bios-date match */
1025+ DMI_MATCH(DMI_BIOS_DATE, "05/07/2016"),
1026+ },
1027+ },
9821028 {
9831029 /* Chuwi Vi8 (CWI506) */
9841030 .driver_data = (void *)&chuwi_vi8_data,
drivers/ptp/Kconfig+1−0
@@ -174,6 +174,7 @@ config PTP_1588_CLOCK_OCP · 173 unmodified lines
174174 depends on I2C && MTD
175175 depends on SERIAL_8250
176176 depends on !S390
177+ depends on COMMON_CLK
177178 select NET_DEVLINK
178179 help
179180 This driver adds support for an OpenCompute time card.
drivers/regulator/max14577-regulator.c+0−2
@@ -269,5 +269,3 @@ module_exit(max14577_regulator_exit); · 268 unmodified lines
269269 MODULE_AUTHOR("Krzysztof Kozlowski <krzk@kernel.org>");
270270 MODULE_DESCRIPTION("Maxim 14577/77836 regulator driver");
271271 MODULE_LICENSE("GPL");
272−MODULE_ALIAS("platform:max14577-regulator");
273−MODULE_ALIAS("platform:max77836-regulator");
drivers/regulator/qcom-rpmh-regulator.c+1−1
@@ -991,7 +991,7 @@ static const struct rpmh_vreg_init_data pm8009_1_vreg_data[] = { · 990 unmodified lines
991991 RPMH_VREG("ldo4", "ldo%s4", &pmic5_nldo, "vdd-l4"),
992992 RPMH_VREG("ldo5", "ldo%s5", &pmic5_pldo, "vdd-l5-l6"),
993993 RPMH_VREG("ldo6", "ldo%s6", &pmic5_pldo, "vdd-l5-l6"),
994− RPMH_VREG("ldo7", "ldo%s6", &pmic5_pldo_lv, "vdd-l7"),
994+ RPMH_VREG("ldo7", "ldo%s7", &pmic5_pldo_lv, "vdd-l7"),
995995 {}
996996 };
997997
drivers/s390/char/sclp_early.c+2−1
@@ -45,13 +45,14 @@ static void __init sclp_early_facilities_detect(void) · 44 unmodified lines
4545 sclp.has_gisaf = !!(sccb->fac118 & 0x08);
4646 sclp.has_hvs = !!(sccb->fac119 & 0x80);
4747 sclp.has_kss = !!(sccb->fac98 & 0x01);
48− sclp.has_sipl = !!(sccb->cbl & 0x4000);
4948 if (sccb->fac85 & 0x02)
5049 S390_lowcore.machine_flags |= MACHINE_FLAG_ESOP;
5150 if (sccb->fac91 & 0x40)
5251 S390_lowcore.machine_flags |= MACHINE_FLAG_TLB_GUEST;
5352 if (sccb->cpuoff > 134)
5453 sclp.has_diag318 = !!(sccb->byte_134 & 0x80);
54+ if (sccb->cpuoff > 137)
55+ sclp.has_sipl = !!(sccb->cbl & 0x4000);
5556 sclp.rnmax = sccb->rnmax ? sccb->rnmax : sccb->rnmax2;
5657 sclp.rzm = sccb->rnsize ? sccb->rnsize : sccb->rnsize2;
5758 sclp.rzm <<= 20;
drivers/s390/cio/ccwgroup.c+8−2
@@ -77,12 +77,13 @@ EXPORT_SYMBOL(ccwgroup_set_online); · 76 unmodified lines
7777 /**
7878 * ccwgroup_set_offline() - disable a ccwgroup device
7979 * @gdev: target ccwgroup device
80+ * @call_gdrv: Call the registered gdrv set_offline function
8081 *
8182 * This function attempts to put the ccwgroup device into the offline state.
8283 * Returns:
8384 * %0 on success and a negative error value on failure.
8485 */
85−int ccwgroup_set_offline(struct ccwgroup_device *gdev)
86+int ccwgroup_set_offline(struct ccwgroup_device *gdev, bool call_gdrv)
8687 {
8788 struct ccwgroup_driver *gdrv = to_ccwgroupdrv(gdev->dev.driver);
8889 int ret = -EINVAL;
@@ -91,11 +92,16 @@ int ccwgroup_set_offline(struct ccwgroup_device *gdev) · 2 unmodified lines
9192 return -EAGAIN;
9293 if (gdev->state == CCWGROUP_OFFLINE)
9394 goto out;
95+ if (!call_gdrv) {
96+ ret = 0;
97+ goto offline;
98+ }
9499 if (gdrv->set_offline)
95100 ret = gdrv->set_offline(gdev);
96101 if (ret)
97102 goto out;
98103
104+offline:
99105 gdev->state = CCWGROUP_OFFLINE;
100106 out:
101107 atomic_set(&gdev->onoff, 0);
@@ -124,7 +130,7 @@ static ssize_t ccwgroup_online_store(struct device *dev, · 22 unmodified lines
124130 if (value == 1)
125131 ret = ccwgroup_set_online(gdev);
126132 else if (value == 0)
127− ret = ccwgroup_set_offline(gdev);
133+ ret = ccwgroup_set_offline(gdev, true);
128134 else
129135 ret = -EINVAL;
130136 out:
drivers/s390/crypto/ap_bus.c+2−1
@@ -213,7 +213,6 @@ static inline int ap_fetch_qci_info(struct ap_config_info *info) · 212 unmodified lines
213213 * ap_init_qci_info(): Allocate and query qci config info.
214214 * Does also update the static variables ap_max_domain_id
215215 * and ap_max_adapter_id if this info is available.
216−
217216 */
218217 static void __init ap_init_qci_info(void)
219218 {
@@ -439,6 +438,7 @@ static enum hrtimer_restart ap_poll_timeout(struct hrtimer *unused) · 219 unmodified lines
439438 /**
440439 * ap_interrupt_handler() - Schedule ap_tasklet on interrupt
441440 * @airq: pointer to adapter interrupt descriptor
441+ * @floating: ignored
442442 */
443443 static void ap_interrupt_handler(struct airq_struct *airq, bool floating)
444444 {
@@ -1786,6 +1786,7 @@ static inline void ap_scan_adapter(int ap) · 1341 unmodified lines
17861786 /**
17871787 * ap_scan_bus(): Scan the AP bus for new devices
17881788 * Runs periodically, workqueue timer (ap_config_time)
1789+ * @unused: Unused pointer.
17891790 */
17901791 static void ap_scan_bus(struct work_struct *unused)
17911792 {
drivers/s390/crypto/ap_queue.c+2−2
@@ -20,7 +20,7 @@ static void __ap_flush_queue(struct ap_queue *aq); · 19 unmodified lines
2020
2121 /**
2222 * ap_queue_enable_irq(): Enable interrupt support on this AP queue.
23− * @qid: The AP queue number
23+ * @aq: The AP queue
2424 * @ind: the notification indicator byte
2525 *
2626 * Enables interruption on AP queue via ap_aqic(). Based on the return
@@ -311,7 +311,7 @@ static enum ap_sm_wait ap_sm_read_write(struct ap_queue *aq) · 284 unmodified lines
311311
312312 /**
313313 * ap_sm_reset(): Reset an AP queue.
314− * @qid: The AP queue number
314+ * @aq: The AP queue
315315 *
316316 * Submit the Reset command to an AP queue.
317317 */
drivers/s390/net/qeth_core.h+0−1
@@ -858,7 +858,6 @@ struct qeth_card { · 857 unmodified lines
858858 struct napi_struct napi;
859859 struct qeth_rx rx;
860860 struct delayed_work buffer_reclaim_work;
861− struct work_struct close_dev_work;
862861 };
863862
864863 static inline bool qeth_card_hw_is_reachable(struct qeth_card *card)
drivers/s390/net/qeth_core_main.c+9−13
@@ -70,15 +70,6 @@ static void qeth_issue_next_read_cb(struct qeth_card *card, · 69 unmodified lines
7070 static int qeth_qdio_establish(struct qeth_card *);
7171 static void qeth_free_qdio_queues(struct qeth_card *card);
7272
73−static void qeth_close_dev_handler(struct work_struct *work)
74−{
75− struct qeth_card *card;
76−
77− card = container_of(work, struct qeth_card, close_dev_work);
78− QETH_CARD_TEXT(card, 2, "cldevhdl");
79− ccwgroup_set_offline(card->gdev);
80−}
81−
8273 static const char *qeth_get_cardname(struct qeth_card *card)
8374 {
8475 if (IS_VM_NIC(card)) {
@@ -202,6 +193,9 @@ static void qeth_clear_working_pool_list(struct qeth_card *card) · 117 unmodified lines
202193 &card->qdio.in_buf_pool.entry_list, list)
203194 list_del(&pool_entry->list);
204195
196+ if (!queue)
197+ return;
198+
205199 for (i = 0; i < ARRAY_SIZE(queue->bufs); i++)
206200 queue->bufs[i].pool_entry = NULL;
207201 }
@@ -792,10 +786,12 @@ static struct qeth_ipa_cmd *qeth_check_ipa_data(struct qeth_card *card, · 584 unmodified lines
792786 case IPA_CMD_STOPLAN:
793787 if (cmd->hdr.return_code == IPA_RC_VEPA_TO_VEB_TRANSITION) {
794788 dev_err(&card->gdev->dev,
795− "Interface %s is down because the adjacent port is no longer in reflective relay mode\n",
789+ "Adjacent port of interface %s is no longer in reflective relay mode, trigger recovery\n",
796790 netdev_name(card->dev));
797− schedule_work(&card->close_dev_work);
791+ /* Set offline, then probably fail to set online: */
792+ qeth_schedule_recovery(card);
798793 } else {
794+ /* stay online for subsequent STARTLAN */
799795 dev_warn(&card->gdev->dev,
800796 "The link for interface %s on CHPID 0x%X failed\n",
801797 netdev_name(card->dev), card->info.chpid);
@@ -1537,7 +1533,6 @@ static void qeth_setup_card(struct qeth_card *card) · 735 unmodified lines
15371533 INIT_LIST_HEAD(&card->ipato.entries);
15381534 qeth_init_qdio_info(card);
15391535 INIT_DELAYED_WORK(&card->buffer_reclaim_work, qeth_buffer_reclaim_work);
1540− INIT_WORK(&card->close_dev_work, qeth_close_dev_handler);
15411536 hash_init(card->rx_mode_addrs);
15421537 hash_init(card->local_addrs4);
15431538 hash_init(card->local_addrs6);
@@ -5519,7 +5514,8 @@ static int qeth_do_reset(void *data) · 3975 unmodified lines
55195514 dev_info(&card->gdev->dev,
55205515 "Device successfully recovered!\n");
55215516 } else {
5522− ccwgroup_set_offline(card->gdev);
5517+ qeth_set_offline(card, disc, true);
5518+ ccwgroup_set_offline(card->gdev, false);
55235519 dev_warn(&card->gdev->dev,
55245520 "The qeth device driver failed to recover an error on the device\n");
55255521 }
drivers/s390/net/qeth_l2_main.c+0−1
@@ -2307,7 +2307,6 @@ static void qeth_l2_remove_device(struct ccwgroup_device *gdev) · 2306 unmodified lines
23072307 if (gdev->state == CCWGROUP_ONLINE)
23082308 qeth_set_offline(card, card->discipline, false);
23092309
2310− cancel_work_sync(&card->close_dev_work);
23112310 if (card->dev->reg_state == NETREG_REGISTERED) {
23122311 priv = netdev_priv(card->dev);
23132312 if (priv->brport_features & BR_LEARNING_SYNC) {
drivers/s390/net/qeth_l3_main.c+0−1
@@ -1969,7 +1969,6 @@ static void qeth_l3_remove_device(struct ccwgroup_device *cgdev) · 1968 unmodified lines
19691969 if (cgdev->state == CCWGROUP_ONLINE)
19701970 qeth_set_offline(card, card->discipline, false);
19711971
1972− cancel_work_sync(&card->close_dev_work);
19731972 if (card->dev->reg_state == NETREG_REGISTERED)
19741973 unregister_netdev(card->dev);
19751974
drivers/spi/spi-rockchip.c+6−0
@@ -600,6 +600,12 @@ static int rockchip_spi_transfer_one( · 599 unmodified lines
600600 int ret;
601601 bool use_dma;
602602
603+ /* Zero length transfers won't trigger an interrupt on completion */
604+ if (!xfer->len) {
605+ spi_finalize_current_transfer(ctlr);
606+ return 1;
607+ }
608+
603609 WARN_ON(readl_relaxed(rs->regs + ROCKCHIP_SPI_SSIENR) &&
604610 (readl_relaxed(rs->regs + ROCKCHIP_SPI_SR) & SR_BUSY));
605611
drivers/spi/spi-tegra20-slink.c+2−3
@@ -204,9 +204,6 @@ struct tegra_slink_data { · 203 unmodified lines
204204 struct dma_async_tx_descriptor *tx_dma_desc;
205205 };
206206
207−static int tegra_slink_runtime_suspend(struct device *dev);
208−static int tegra_slink_runtime_resume(struct device *dev);
209−
210207 static inline u32 tegra_slink_readl(struct tegra_slink_data *tspi,
211208 unsigned long reg)
212209 {
@@ -1185,6 +1182,7 @@ static int tegra_slink_resume(struct device *dev) · 972 unmodified lines
11851182 }
11861183 #endif
11871184
1185+#ifdef CONFIG_PM
11881186 static int tegra_slink_runtime_suspend(struct device *dev)
11891187 {
11901188 struct spi_master *master = dev_get_drvdata(dev);
@@ -1210,6 +1208,7 @@ static int tegra_slink_runtime_resume(struct device *dev) · 19 unmodified lines
12101208 }
12111209 return 0;
12121210 }
1211+#endif /* CONFIG_PM */
12131212
12141213 static const struct dev_pm_ops slink_pm_ops = {
12151214 SET_RUNTIME_PM_OPS(tegra_slink_runtime_suspend,
drivers/spi/spi.c+0−8
@@ -58,10 +58,6 @@ modalias_show(struct device *dev, struct device_attribute *a, char *buf) · 57 unmodified lines
5858 const struct spi_device *spi = to_spi_device(dev);
5959 int len;
6060
61− len = of_device_modalias(dev, buf, PAGE_SIZE);
62− if (len != -ENODEV)
63− return len;
64−
6561 len = acpi_device_modalias(dev, buf, PAGE_SIZE - 1);
6662 if (len != -ENODEV)
6763 return len;
@@ -367,10 +363,6 @@ static int spi_uevent(struct device *dev, struct kobj_uevent_env *env) · 299 unmodified lines
367363 const struct spi_device *spi = to_spi_device(dev);
368364 int rc;
369365
370− rc = of_device_uevent_modalias(dev, env);
371− if (rc != -ENODEV)
372− return rc;
373−
374366 rc = acpi_device_uevent_modalias(dev, env);
375367 if (rc != -ENODEV)
376368 return rc;
drivers/video/fbdev/Kconfig+3−1
@@ -582,7 +582,9 @@ config FB_HP300 · 581 unmodified lines
582582
583583 config FB_TGA
584584 tristate "TGA/SFB+ framebuffer support"
585− depends on FB && (ALPHA || TC)
585+ depends on FB
586+ depends on PCI || TC
587+ depends on ALPHA || TC
586588 select FB_CFB_FILLRECT
587589 select FB_CFB_COPYAREA
588590 select FB_CFB_IMAGEBLIT
drivers/xen/Kconfig+1−1
@@ -214,7 +214,7 @@ config XEN_PVCALLS_FRONTEND · 213 unmodified lines
214214 implements them.
215215
216216 config XEN_PVCALLS_BACKEND
217− bool "XEN PV Calls backend driver"
217+ tristate "XEN PV Calls backend driver"
218218 depends on INET && XEN && XEN_BACKEND
219219 help
220220 Experimental backend for the Xen PV Calls protocol
drivers/xen/balloon.c+45−17
@@ -43,6 +43,8 @@ · 42 unmodified lines
4343 #include <linux/sched.h>
4444 #include <linux/cred.h>
4545 #include <linux/errno.h>
46+#include <linux/freezer.h>
47+#include <linux/kthread.h>
4648 #include <linux/mm.h>
4749 #include <linux/memblock.h>
4850 #include <linux/pagemap.h>
@@ -115,7 +117,7 @@ static struct ctl_table xen_root[] = { · 66 unmodified lines
115117 #define EXTENT_ORDER (fls(XEN_PFN_PER_PAGE) - 1)
116118
117119 /*
118− * balloon_process() state:
120+ * balloon_thread() state:
119121 *
120122 * BP_DONE: done or nothing to do,
121123 * BP_WAIT: wait to be rescheduled,
@@ -130,6 +132,8 @@ enum bp_state { · 8 unmodified lines
130132 BP_ECANCELED
131133 };
132134
135+/* Main waiting point for xen-balloon thread. */
136+static DECLARE_WAIT_QUEUE_HEAD(balloon_thread_wq);
133137
134138 static DEFINE_MUTEX(balloon_mutex);
135139
@@ -144,10 +148,6 @@ static xen_pfn_t frame_list[PAGE_SIZE / sizeof(xen_pfn_t)]; · 8 unmodified lines
144148 static LIST_HEAD(ballooned_pages);
145149 static DECLARE_WAIT_QUEUE_HEAD(balloon_wq);
146150
147−/* Main work function, always executed in process context. */
148−static void balloon_process(struct work_struct *work);
149−static DECLARE_DELAYED_WORK(balloon_worker, balloon_process);
150−
151151 /* When ballooning out (allocating memory to return to Xen) we don't really
152152 want the kernel to try too hard since that can trigger the oom killer. */
153153 #define GFP_BALLOON \
@@ -366,7 +366,7 @@ static void xen_online_page(struct page *page, unsigned int order) · 212 unmodified lines
366366 static int xen_memory_notifier(struct notifier_block *nb, unsigned long val, void *v)
367367 {
368368 if (val == MEM_ONLINE)
369− schedule_delayed_work(&balloon_worker, 0);
369+ wake_up(&balloon_thread_wq);
370370
371371 return NOTIFY_OK;
372372 }
@@ -491,18 +491,43 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) · 118 unmodified lines
491491 }
492492
493493 /*
494− * As this is a work item it is guaranteed to run as a single instance only.
494+ * Stop waiting if either state is not BP_EAGAIN and ballooning action is
495+ * needed, or if the credit has changed while state is BP_EAGAIN.
496+ */
497+static bool balloon_thread_cond(enum bp_state state, long credit)
498+{
499+ if (state != BP_EAGAIN)
500+ credit = 0;
501+
502+ return current_credit() != credit || kthread_should_stop();
503+}
504+
505+/*
506+ * As this is a kthread it is guaranteed to run as a single instance only.
495507 * We may of course race updates of the target counts (which are protected
496508 * by the balloon lock), or with changes to the Xen hard limit, but we will
497509 * recover from these in time.
498510 */
499−static void balloon_process(struct work_struct *work)
511+static int balloon_thread(void *unused)
500512 {
501513 enum bp_state state = BP_DONE;
502514 long credit;
515+ unsigned long timeout;
516+
517+ set_freezable();
518+ for (;;) {
519+ if (state == BP_EAGAIN)
520+ timeout = balloon_stats.schedule_delay * HZ;
521+ else
522+ timeout = 3600 * HZ;
523+ credit = current_credit();
503524
525+ wait_event_interruptible_timeout(balloon_thread_wq,
526+ balloon_thread_cond(state, credit), timeout);
527+
528+ if (kthread_should_stop())
529+ return 0;
504530
505− do {
506531 mutex_lock(&balloon_mutex);
507532
508533 credit = current_credit();
@@ -529,12 +554,7 @@ static void balloon_process(struct work_struct *work) · 20 unmodified lines
529554 mutex_unlock(&balloon_mutex);
530555
531556 cond_resched();
532−
533− } while (credit && state == BP_DONE);
534−
535− /* Schedule more work if there is some still to be done. */
536− if (state == BP_EAGAIN)
537− schedule_delayed_work(&balloon_worker, balloon_stats.schedule_delay * HZ);
557+ }
538558 }
539559
540560 /* Resets the Xen limit, sets new target, and kicks off processing. */
@@ -542,7 +562,7 @@ void balloon_set_new_target(unsigned long target) · 1 unmodified line
542562 {
543563 /* No need for lock. Not read-modify-write updates. */
544564 balloon_stats.target_pages = target;
545− schedule_delayed_work(&balloon_worker, 0);
565+ wake_up(&balloon_thread_wq);
546566 }
547567 EXPORT_SYMBOL_GPL(balloon_set_new_target);
548568
@@ -647,7 +667,7 @@ void free_xenballooned_pages(int nr_pages, struct page **pages) · 98 unmodified lines
647667
648668 /* The balloon may be too large now. Shrink it if needed. */
649669 if (current_credit())
650− schedule_delayed_work(&balloon_worker, 0);
670+ wake_up(&balloon_thread_wq);
651671
652672 mutex_unlock(&balloon_mutex);
653673 }
@@ -679,6 +699,8 @@ static void __init balloon_add_region(unsigned long start_pfn, · 25 unmodified lines
679699
680700 static int __init balloon_init(void)
681701 {
702+ struct task_struct *task;
703+
682704 if (!xen_domain())
683705 return -ENODEV;
684706
@@ -722,6 +744,12 @@ static int __init balloon_init(void) · 37 unmodified lines
722744 }
723745 #endif
724746
747+ task = kthread_run(balloon_thread, NULL, "xen-balloon");
748+ if (IS_ERR(task)) {
749+ pr_err("xen-balloon thread could not be started, ballooning will not work!\n");
750+ return PTR_ERR(task);
751+ }
752+
725753 /* Init the xen-balloon driver. */
726754 xen_balloon_init();
727755
drivers/xen/swiotlb-xen.c+17−20
@@ -106,27 +106,26 @@ static int is_xen_swiotlb_buffer(struct device *dev, dma_addr_t dma_addr) · 105 unmodified lines
106106
107107 static int xen_swiotlb_fixup(void *buf, unsigned long nslabs)
108108 {
109− int i, rc;
110− int dma_bits;
109+ int rc;
110+ unsigned int order = get_order(IO_TLB_SEGSIZE << IO_TLB_SHIFT);
111+ unsigned int i, dma_bits = order + PAGE_SHIFT;
111112 dma_addr_t dma_handle;
112113 phys_addr_t p = virt_to_phys(buf);
113114
114− dma_bits = get_order(IO_TLB_SEGSIZE << IO_TLB_SHIFT) + PAGE_SHIFT;
115+ BUILD_BUG_ON(IO_TLB_SEGSIZE & (IO_TLB_SEGSIZE - 1));
116+ BUG_ON(nslabs % IO_TLB_SEGSIZE);
115117
116118 i = 0;
117119 do {
118− int slabs = min(nslabs - i, (unsigned long)IO_TLB_SEGSIZE);
119−
120120 do {
121121 rc = xen_create_contiguous_region(
122− p + (i << IO_TLB_SHIFT),
123− get_order(slabs << IO_TLB_SHIFT),
122+ p + (i << IO_TLB_SHIFT), order,
124123 dma_bits, &dma_handle);
125124 } while (rc && dma_bits++ < MAX_DMA_BITS);
126125 if (rc)
127126 return rc;
128127
129− i += slabs;
128+ i += IO_TLB_SEGSIZE;
130129 } while (i < nslabs);
131130 return 0;
132131 }
@@ -153,9 +152,7 @@ static const char *xen_swiotlb_error(enum xen_swiotlb_err err) · 20 unmodified lines
153152 return "";
154153 }
155154
156−#define DEFAULT_NSLABS ALIGN(SZ_64M >> IO_TLB_SHIFT, IO_TLB_SEGSIZE)
157−
158−int __ref xen_swiotlb_init(void)
155+int xen_swiotlb_init(void)
159156 {
160157 enum xen_swiotlb_err m_ret = XEN_SWIOTLB_UNKNOWN;
161158 unsigned long bytes = swiotlb_size_or_default();
@@ -185,7 +182,7 @@ retry: · 23 unmodified lines
185182 order--;
186183 }
187184 if (!start)
188− goto error;
185+ goto exit;
189186 if (order != get_order(bytes)) {
190187 pr_warn("Warning: only able to allocate %ld MB for software IO TLB\n",
191188 (PAGE_SIZE << order) >> 20);
@@ -208,15 +205,15 @@ retry: · 16 unmodified lines
208205 swiotlb_set_max_segment(PAGE_SIZE);
209206 return 0;
210207 error:
211− if (repeat--) {
208+ if (nslabs > 1024 && repeat--) {
212209 /* Min is 2MB */
213− nslabs = max(1024UL, (nslabs >> 1));
214− pr_info("Lowering to %luMB\n",
215− (nslabs << IO_TLB_SHIFT) >> 20);
210+ nslabs = max(1024UL, ALIGN(nslabs >> 1, IO_TLB_SEGSIZE));
211+ bytes = nslabs << IO_TLB_SHIFT;
212+ pr_info("Lowering to %luMB\n", bytes >> 20);
216213 goto retry;
217214 }
215+exit:
218216 pr_err("%s (rc:%d)\n", xen_swiotlb_error(m_ret), rc);
219− free_pages((unsigned long)start, order);
220217 return rc;
221218 }
222219
@@ -244,9 +241,9 @@ retry: · 21 unmodified lines
244241 rc = xen_swiotlb_fixup(start, nslabs);
245242 if (rc) {
246243 memblock_free(__pa(start), PAGE_ALIGN(bytes));
247− if (repeat--) {
244+ if (nslabs > 1024 && repeat--) {
248245 /* Min is 2MB */
249− nslabs = max(1024UL, (nslabs >> 1));
246+ nslabs = max(1024UL, ALIGN(nslabs >> 1, IO_TLB_SEGSIZE));
250247 bytes = nslabs << IO_TLB_SHIFT;
251248 pr_info("Lowering to %luMB\n", bytes >> 20);
252249 goto retry;
@@ -254,7 +251,7 @@ retry: · 1 unmodified line
254251 panic("%s (rc:%d)", xen_swiotlb_error(XEN_SWIOTLB_EFIXUP), rc);
255252 }
256253
257− if (swiotlb_init_with_tbl(start, nslabs, false))
254+ if (swiotlb_init_with_tbl(start, nslabs, true))
258255 panic("Cannot allocate SWIOTLB buffer");
259256 swiotlb_set_max_segment(PAGE_SIZE);
260257 }
fs/afs/callback.c+42−2
@@ -20,6 +20,37 @@ · 19 unmodified lines
2020 #include <linux/sched.h>
2121 #include "internal.h"
2222
23+/*
24+ * Handle invalidation of an mmap'd file. We invalidate all the PTEs referring
25+ * to the pages in this file's pagecache, forcing the kernel to go through
26+ * ->fault() or ->page_mkwrite() - at which point we can handle invalidation
27+ * more fully.
28+ */
29+void afs_invalidate_mmap_work(struct work_struct *work)
30+{
31+ struct afs_vnode *vnode = container_of(work, struct afs_vnode, cb_work);
32+
33+ unmap_mapping_pages(vnode->vfs_inode.i_mapping, 0, 0, false);
34+}
35+
36+void afs_server_init_callback_work(struct work_struct *work)
37+{
38+ struct afs_server *server = container_of(work, struct afs_server, initcb_work);
39+ struct afs_vnode *vnode;
40+ struct afs_cell *cell = server->cell;
41+
42+ down_read(&cell->fs_open_mmaps_lock);
43+
44+ list_for_each_entry(vnode, &cell->fs_open_mmaps, cb_mmap_link) {
45+ if (vnode->cb_server == server) {
46+ clear_bit(AFS_VNODE_CB_PROMISED, &vnode->flags);
47+ queue_work(system_unbound_wq, &vnode->cb_work);
48+ }
49+ }
50+
51+ up_read(&cell->fs_open_mmaps_lock);
52+}
53+
2354 /*
2455 * Allow the fileserver to request callback state (re-)initialisation.
2556 * Unfortunately, UUIDs are not guaranteed unique.
@@ -29,8 +60,11 @@ void afs_init_callback_state(struct afs_server *server) · 3 unmodified lines
2960 rcu_read_lock();
3061 do {
3162 server->cb_s_break++;
32− server = rcu_dereference(server->uuid_next);
33− } while (0);
63+ atomic_inc(&server->cell->fs_s_break);
64+ if (!list_empty(&server->cell->fs_open_mmaps))
65+ queue_work(system_unbound_wq, &server->initcb_work);
66+
67+ } while ((server = rcu_dereference(server->uuid_next)));
3468 rcu_read_unlock();
3569 }
3670
@@ -44,11 +78,17 @@ void __afs_break_callback(struct afs_vnode *vnode, enum afs_cb_break_reason reas · 7 unmodified lines
4478 clear_bit(AFS_VNODE_NEW_CONTENT, &vnode->flags);
4579 if (test_and_clear_bit(AFS_VNODE_CB_PROMISED, &vnode->flags)) {
4680 vnode->cb_break++;
81+ vnode->cb_v_break = vnode->volume->cb_v_break;
4782 afs_clear_permits(vnode);
4883
4984 if (vnode->lock_state == AFS_VNODE_LOCK_WAITING_FOR_CB)
5085 afs_lock_may_be_available(vnode);
5186
87+ if (reason != afs_cb_break_for_deleted &&
88+ vnode->status.type == AFS_FTYPE_FILE &&
89+ atomic_read(&vnode->cb_nr_mmap))
90+ queue_work(system_unbound_wq, &vnode->cb_work);
91+
5292 trace_afs_cb_break(&vnode->fid, vnode->cb_break, reason, true);
5393 } else {
5494 trace_afs_cb_break(&vnode->fid, vnode->cb_break, reason, false);
fs/afs/cell.c+2−0
@@ -166,6 +166,8 @@ static struct afs_cell *afs_alloc_cell(struct afs_net *net, · 165 unmodified lines
166166 seqlock_init(&cell->volume_lock);
167167 cell->fs_servers = RB_ROOT;
168168 seqlock_init(&cell->fs_lock);
169+ INIT_LIST_HEAD(&cell->fs_open_mmaps);
170+ init_rwsem(&cell->fs_open_mmaps_lock);
169171 rwlock_init(&cell->vl_servers_lock);
170172 cell->flags = (1 << AFS_CELL_FL_CHECK_ALIAS);
171173
fs/afs/dir.c+18−39
@@ -1077,9 +1077,9 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry, · 1076 unmodified lines
10771077 */
10781078 static int afs_d_revalidate_rcu(struct dentry *dentry)
10791079 {
1080− struct afs_vnode *dvnode, *vnode;
1080+ struct afs_vnode *dvnode;
10811081 struct dentry *parent;
1082− struct inode *dir, *inode;
1082+ struct inode *dir;
10831083 long dir_version, de_version;
10841084
10851085 _enter("%p", dentry);
@@ -1109,18 +1109,6 @@ static int afs_d_revalidate_rcu(struct dentry *dentry) · 23 unmodified lines
11091109 return -ECHILD;
11101110 }
11111111
1112− /* Check to see if the vnode referred to by the dentry still
1113− * has a callback.
1114− */
1115− if (d_really_is_positive(dentry)) {
1116− inode = d_inode_rcu(dentry);
1117− if (inode) {
1118− vnode = AFS_FS_I(inode);
1119− if (!afs_check_validity(vnode))
1120− return -ECHILD;
1121− }
1122− }
1123−
11241112 return 1; /* Still valid */
11251113 }
11261114
@@ -1156,17 +1144,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) · 29 unmodified lines
11561144 if (IS_ERR(key))
11571145 key = NULL;
11581146
1159− if (d_really_is_positive(dentry)) {
1160− inode = d_inode(dentry);
1161− if (inode) {
1162− vnode = AFS_FS_I(inode);
1163− afs_validate(vnode, key);
1164− if (test_bit(AFS_VNODE_DELETED, &vnode->flags))
1165− goto out_bad;
1166− }
1167− }
1168−
1169− /* lock down the parent dentry so we can peer at it */
1147+ /* Hold the parent dentry so we can peer at it */
11701148 parent = dget_parent(dentry);
11711149 dir = AFS_FS_I(d_inode(parent));
11721150
@@ -1175,7 +1153,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) · 2 unmodified lines
11751153
11761154 if (test_bit(AFS_VNODE_DELETED, &dir->flags)) {
11771155 _debug("%pd: parent dir deleted", dentry);
1178− goto out_bad_parent;
1156+ goto not_found;
11791157 }
11801158
11811159 /* We only need to invalidate a dentry if the server's copy changed
@@ -1201,12 +1179,12 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) · 19 unmodified lines
12011179 case 0:
12021180 /* the filename maps to something */
12031181 if (d_really_is_negative(dentry))
1204− goto out_bad_parent;
1182+ goto not_found;
12051183 inode = d_inode(dentry);
12061184 if (is_bad_inode(inode)) {
12071185 printk("kAFS: afs_d_revalidate: %pd2 has bad inode\n",
12081186 dentry);
1209− goto out_bad_parent;
1187+ goto not_found;
12101188 }
12111189
12121190 vnode = AFS_FS_I(inode);
@@ -1228,9 +1206,6 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) · 15 unmodified lines
12281206 dentry, fid.unique,
12291207 vnode->fid.unique,
12301208 vnode->vfs_inode.i_generation);
1231− write_seqlock(&vnode->cb_lock);
1232− set_bit(AFS_VNODE_DELETED, &vnode->flags);
1233− write_sequnlock(&vnode->cb_lock);
12341209 goto not_found;
12351210 }
12361211 goto out_valid;
@@ -1245,7 +1220,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) · 8 unmodified lines
12451220 default:
12461221 _debug("failed to iterate dir %pd: %d",
12471222 parent, ret);
1248− goto out_bad_parent;
1223+ goto not_found;
12491224 }
12501225
12511226 out_valid:
@@ -1256,16 +1231,9 @@ out_valid_noupdate: · 4 unmodified lines
12561231 _leave(" = 1 [valid]");
12571232 return 1;
12581233
1259− /* the dirent, if it exists, now points to a different vnode */
12601234 not_found:
1261− spin_lock(&dentry->d_lock);
1262− dentry->d_flags |= DCACHE_NFSFS_RENAMED;
1263− spin_unlock(&dentry->d_lock);
1264−
1265−out_bad_parent:
12661235 _debug("dropping dentry %pd2", dentry);
12671236 dput(parent);
1268−out_bad:
12691237 key_put(key);
12701238
12711239 _leave(" = 0 [bad]");
@@ -1792,6 +1760,10 @@ static int afs_link(struct dentry *from, struct inode *dir, · 520 unmodified lines
17921760 goto error;
17931761 }
17941762
1763+ ret = afs_validate(vnode, op->key);
1764+ if (ret < 0)
1765+ goto error_op;
1766+
17951767 afs_op_set_vnode(op, 0, dvnode);
17961768 afs_op_set_vnode(op, 1, vnode);
17971769 op->file[0].dv_delta = 1;
@@ -1805,6 +1777,8 @@ static int afs_link(struct dentry *from, struct inode *dir, · 7 unmodified lines
18051777 op->create.reason = afs_edit_dir_for_link;
18061778 return afs_do_sync_operation(op);
18071779
1780+error_op:
1781+ afs_put_operation(op);
18081782 error:
18091783 d_drop(dentry);
18101784 _leave(" = %d", ret);
@@ -1989,6 +1963,11 @@ static int afs_rename(struct user_namespace *mnt_userns, struct inode *old_dir, · 178 unmodified lines
19891963 if (IS_ERR(op))
19901964 return PTR_ERR(op);
19911965
1966+ ret = afs_validate(vnode, op->key);
1967+ op->error = ret;
1968+ if (ret < 0)
1969+ goto error;
1970+
19921971 afs_op_set_vnode(op, 0, orig_dvnode);
19931972 afs_op_set_vnode(op, 1, new_dvnode); /* May be same as orig_dvnode */
19941973 op->file[0].dv_delta = 1;
fs/afs/dir_edit.c+2−2
@@ -263,7 +263,7 @@ void afs_edit_dir_add(struct afs_vnode *vnode, · 262 unmodified lines
263263 if (b == nr_blocks) {
264264 _debug("init %u", b);
265265 afs_edit_init_block(meta, block, b);
266− i_size_write(&vnode->vfs_inode, (b + 1) * AFS_DIR_BLOCK_SIZE);
266+ afs_set_i_size(vnode, (b + 1) * AFS_DIR_BLOCK_SIZE);
267267 }
268268
269269 /* Only lower dir pages have a counter in the header. */
@@ -296,7 +296,7 @@ void afs_edit_dir_add(struct afs_vnode *vnode, · 26 unmodified lines
296296 new_directory:
297297 afs_edit_init_block(meta, meta, 0);
298298 i_size = AFS_DIR_BLOCK_SIZE;
299− i_size_write(&vnode->vfs_inode, i_size);
299+ afs_set_i_size(vnode, i_size);
300300 slot = AFS_DIR_RESV_BLOCKS0;
301301 page = page0;
302302 block = meta;
fs/afs/file.c+83−3
@@ -24,12 +24,16 @@ static void afs_invalidatepage(struct page *page, unsigned int offset, · 23 unmodified lines
2424 static int afs_releasepage(struct page *page, gfp_t gfp_flags);
2525
2626 static void afs_readahead(struct readahead_control *ractl);
27+static ssize_t afs_file_read_iter(struct kiocb *iocb, struct iov_iter *iter);
28+static void afs_vm_open(struct vm_area_struct *area);
29+static void afs_vm_close(struct vm_area_struct *area);
30+static vm_fault_t afs_vm_map_pages(struct vm_fault *vmf, pgoff_t start_pgoff, pgoff_t end_pgoff);
2731
2832 const struct file_operations afs_file_operations = {
2933 .open = afs_open,
3034 .release = afs_release,
3135 .llseek = generic_file_llseek,
32− .read_iter = generic_file_read_iter,
36+ .read_iter = afs_file_read_iter,
3337 .write_iter = afs_file_write,
3438 .mmap = afs_file_mmap,
3539 .splice_read = generic_file_splice_read,
@@ -59,8 +63,10 @@ const struct address_space_operations afs_fs_aops = { · 23 unmodified lines
5963 };
6064
6165 static const struct vm_operations_struct afs_vm_ops = {
66+ .open = afs_vm_open,
67+ .close = afs_vm_close,
6268 .fault = filemap_fault,
63− .map_pages = filemap_map_pages,
69+ .map_pages = afs_vm_map_pages,
6470 .page_mkwrite = afs_page_mkwrite,
6571 };
6672
@@ -295,7 +301,7 @@ static void afs_req_issue_op(struct netfs_read_subrequest *subreq) · 228 unmodified lines
295301 fsreq->subreq = subreq;
296302 fsreq->pos = subreq->start + subreq->transferred;
297303 fsreq->len = subreq->len - subreq->transferred;
298− fsreq->key = subreq->rreq->netfs_priv;
304+ fsreq->key = key_get(subreq->rreq->netfs_priv);
299305 fsreq->vnode = vnode;
300306 fsreq->iter = &fsreq->def_iter;
301307
@@ -304,6 +310,7 @@ static void afs_req_issue_op(struct netfs_read_subrequest *subreq) · 2 unmodified lines
304310 fsreq->pos, fsreq->len);
305311
306312 afs_fetch_data(fsreq->vnode, fsreq);
313+ afs_put_read(fsreq);
307314 }
308315
309316 static int afs_symlink_readpage(struct page *page)
@@ -490,15 +497,88 @@ static int afs_releasepage(struct page *page, gfp_t gfp_flags) · 180 unmodified lines
490497 return 1;
491498 }
492499
500+static void afs_add_open_mmap(struct afs_vnode *vnode)
501+{
502+ if (atomic_inc_return(&vnode->cb_nr_mmap) == 1) {
503+ down_write(&vnode->volume->cell->fs_open_mmaps_lock);
504+
505+ list_add_tail(&vnode->cb_mmap_link,
506+ &vnode->volume->cell->fs_open_mmaps);
507+
508+ up_write(&vnode->volume->cell->fs_open_mmaps_lock);
509+ }
510+}
511+
512+static void afs_drop_open_mmap(struct afs_vnode *vnode)
513+{
514+ if (!atomic_dec_and_test(&vnode->cb_nr_mmap))
515+ return;
516+
517+ down_write(&vnode->volume->cell->fs_open_mmaps_lock);
518+
519+ if (atomic_read(&vnode->cb_nr_mmap) == 0)
520+ list_del_init(&vnode->cb_mmap_link);
521+
522+ up_write(&vnode->volume->cell->fs_open_mmaps_lock);
523+ flush_work(&vnode->cb_work);
524+}
525+
493526 /*
494527 * Handle setting up a memory mapping on an AFS file.
495528 */
496529 static int afs_file_mmap(struct file *file, struct vm_area_struct *vma)
497530 {
531+ struct afs_vnode *vnode = AFS_FS_I(file_inode(file));
498532 int ret;
499533
534+ afs_add_open_mmap(vnode);
535+
500536 ret = generic_file_mmap(file, vma);
501537 if (ret == 0)
502538 vma->vm_ops = &afs_vm_ops;
539+ else
540+ afs_drop_open_mmap(vnode);
503541 return ret;
504542 }
543+
544+static void afs_vm_open(struct vm_area_struct *vma)
545+{
546+ afs_add_open_mmap(AFS_FS_I(file_inode(vma->vm_file)));
547+}
548+
549+static void afs_vm_close(struct vm_area_struct *vma)
550+{
551+ afs_drop_open_mmap(AFS_FS_I(file_inode(vma->vm_file)));
552+}
553+
554+static vm_fault_t afs_vm_map_pages(struct vm_fault *vmf, pgoff_t start_pgoff, pgoff_t end_pgoff)
555+{
556+ struct afs_vnode *vnode = AFS_FS_I(file_inode(vmf->vma->vm_file));
557+ struct afs_file *af = vmf->vma->vm_file->private_data;
558+
559+ switch (afs_validate(vnode, af->key)) {
560+ case 0:
561+ return filemap_map_pages(vmf, start_pgoff, end_pgoff);
562+ case -ENOMEM:
563+ return VM_FAULT_OOM;
564+ case -EINTR:
565+ case -ERESTARTSYS:
566+ return VM_FAULT_RETRY;
567+ case -ESTALE:
568+ default:
569+ return VM_FAULT_SIGBUS;
570+ }
571+}
572+
573+static ssize_t afs_file_read_iter(struct kiocb *iocb, struct iov_iter *iter)
574+{
575+ struct afs_vnode *vnode = AFS_FS_I(file_inode(iocb->ki_filp));
576+ struct afs_file *af = iocb->ki_filp->private_data;
577+ int ret;
578+
579+ ret = afs_validate(vnode, af->key);
580+ if (ret < 0)
581+ return ret;
582+
583+ return generic_file_read_iter(iocb, iter);
584+}
fs/afs/fs_probe.c+7−1
@@ -9,6 +9,7 @@ · 8 unmodified lines
99 #include <linux/slab.h>
1010 #include "afs_fs.h"
1111 #include "internal.h"
12+#include "protocol_afs.h"
1213 #include "protocol_yfs.h"
1314
1415 static unsigned int afs_fs_probe_fast_poll_interval = 30 * HZ;
@@ -102,7 +103,7 @@ void afs_fileserver_probe_result(struct afs_call *call) · 87 unmodified lines
102103 struct afs_addr_list *alist = call->alist;
103104 struct afs_server *server = call->server;
104105 unsigned int index = call->addr_ix;
105− unsigned int rtt_us = 0;
106+ unsigned int rtt_us = 0, cap0;
106107 int ret = call->error;
107108
108109 _enter("%pU,%u", &server->uuid, index);
@@ -159,6 +160,11 @@ responded: · 50 unmodified lines
159160 clear_bit(AFS_SERVER_FL_IS_YFS, &server->flags);
160161 alist->addrs[index].srx_service = call->service_id;
161162 }
163+ cap0 = ntohl(call->tmp);
164+ if (cap0 & AFS3_VICED_CAPABILITY_64BITFILES)
165+ set_bit(AFS_SERVER_FL_HAS_FS64, &server->flags);
166+ else
167+ clear_bit(AFS_SERVER_FL_HAS_FS64, &server->flags);
162168 }
163169
164170 if (rxrpc_kernel_get_srtt(call->net->socket, call->rxcall, &rtt_us) &&
fs/afs/fsclient.c+20−11
@@ -456,9 +456,7 @@ void afs_fs_fetch_data(struct afs_operation *op) · 455 unmodified lines
456456 struct afs_read *req = op->fetch.req;
457457 __be32 *bp;
458458
459− if (upper_32_bits(req->pos) ||
460− upper_32_bits(req->len) ||
461− upper_32_bits(req->pos + req->len))
459+ if (test_bit(AFS_SERVER_FL_HAS_FS64, &op->server->flags))
462460 return afs_fs_fetch_data64(op);
463461
464462 _enter("");
@@ -1113,9 +1111,7 @@ void afs_fs_store_data(struct afs_operation *op) · 648 unmodified lines
11131111 (unsigned long long)op->store.pos,
11141112 (unsigned long long)op->store.i_size);
11151113
1116− if (upper_32_bits(op->store.pos) ||
1117− upper_32_bits(op->store.size) ||
1118− upper_32_bits(op->store.i_size))
1114+ if (test_bit(AFS_SERVER_FL_HAS_FS64, &op->server->flags))
11191115 return afs_fs_store_data64(op);
11201116
11211117 call = afs_alloc_flat_call(op->net, &afs_RXFSStoreData,
@@ -1229,7 +1225,7 @@ static void afs_fs_setattr_size(struct afs_operation *op) · 107 unmodified lines
12291225 key_serial(op->key), vp->fid.vid, vp->fid.vnode);
12301226
12311227 ASSERT(attr->ia_valid & ATTR_SIZE);
1232− if (upper_32_bits(attr->ia_size))
1228+ if (test_bit(AFS_SERVER_FL_HAS_FS64, &op->server->flags))
12331229 return afs_fs_setattr_size64(op);
12341230
12351231 call = afs_alloc_flat_call(op->net, &afs_RXFSStoreData_as_Status,
@@ -1657,20 +1653,33 @@ static int afs_deliver_fs_get_capabilities(struct afs_call *call) · 421 unmodified lines
16571653 return ret;
16581654
16591655 count = ntohl(call->tmp);
1660−
16611656 call->count = count;
16621657 call->count2 = count;
1663− afs_extract_discard(call, count * sizeof(__be32));
1658+ if (count == 0) {
1659+ call->unmarshall = 4;
1660+ call->tmp = 0;
1661+ break;
1662+ }
1663+
1664+ /* Extract the first word of the capabilities to call->tmp */
1665+ afs_extract_to_tmp(call);
16641666 call->unmarshall++;
16651667 fallthrough;
16661668
1667− /* Extract capabilities words */
16681669 case 2:
16691670 ret = afs_extract_data(call, false);
16701671 if (ret < 0)
16711672 return ret;
16721673
1673− /* TODO: Examine capabilities */
1674+ afs_extract_discard(call, (count - 1) * sizeof(__be32));
1675+ call->unmarshall++;
1676+ fallthrough;
1677+
1678+ /* Extract remaining capabilities words */
1679+ case 3:
1680+ ret = afs_extract_data(call, false);
1681+ if (ret < 0)
1682+ return ret;
16741683
16751684 call->unmarshall++;
16761685 break;
fs/afs/inode.c+43−55
@@ -53,16 +53,6 @@ static noinline void dump_vnode(struct afs_vnode *vnode, struct afs_vnode *paren · 52 unmodified lines
5353 dump_stack();
5454 }
5555
56−/*
57− * Set the file size and block count. Estimate the number of 512 bytes blocks
58− * used, rounded up to nearest 1K for consistency with other AFS clients.
59− */
60−static void afs_set_i_size(struct afs_vnode *vnode, u64 size)
61−{
62− i_size_write(&vnode->vfs_inode, size);
63− vnode->vfs_inode.i_blocks = ((size + 1023) >> 10) << 1;
64−}
65−
6656 /*
6757 * Initialise an inode from the vnode status.
6858 */
@@ -587,22 +577,32 @@ static void afs_zap_data(struct afs_vnode *vnode) · 518 unmodified lines
587577 }
588578
589579 /*
590− * Get the server reinit counter for a vnode's current server.
580+ * Check to see if we have a server currently serving this volume and that it
581+ * hasn't been reinitialised or dropped from the list.
591582 */
592−static bool afs_get_s_break_rcu(struct afs_vnode *vnode, unsigned int *_s_break)
583+static bool afs_check_server_good(struct afs_vnode *vnode)
593584 {
594− struct afs_server_list *slist = rcu_dereference(vnode->volume->servers);
585+ struct afs_server_list *slist;
595586 struct afs_server *server;
587+ bool good;
596588 int i;
597589
590+ if (vnode->cb_fs_s_break == atomic_read(&vnode->volume->cell->fs_s_break))
591+ return true;
592+
593+ rcu_read_lock();
594+
595+ slist = rcu_dereference(vnode->volume->servers);
598596 for (i = 0; i < slist->nr_servers; i++) {
599597 server = slist->servers[i].server;
600598 if (server == vnode->cb_server) {
601− *_s_break = READ_ONCE(server->cb_s_break);
602− return true;
599+ good = (vnode->cb_s_break == server->cb_s_break);
600+ rcu_read_unlock();
601+ return good;
603602 }
604603 }
605604
605+ rcu_read_unlock();
606606 return false;
607607 }
608608
@@ -611,57 +611,46 @@ static bool afs_get_s_break_rcu(struct afs_vnode *vnode, unsigned int *_s_break) · 2 unmodified lines
611611 */
612612 bool afs_check_validity(struct afs_vnode *vnode)
613613 {
614− struct afs_volume *volume = vnode->volume;
615614 enum afs_cb_break_reason need_clear = afs_cb_break_no_break;
616615 time64_t now = ktime_get_real_seconds();
617− bool valid;
618− unsigned int cb_break, cb_s_break, cb_v_break;
616+ unsigned int cb_break;
619617 int seq = 0;
620618
621619 do {
622620 read_seqbegin_or_lock(&vnode->cb_lock, &seq);
623− cb_v_break = READ_ONCE(volume->cb_v_break);
624621 cb_break = vnode->cb_break;
625622
626− if (test_bit(AFS_VNODE_CB_PROMISED, &vnode->flags) &&
627− afs_get_s_break_rcu(vnode, &cb_s_break)) {
628− if (vnode->cb_s_break != cb_s_break ||
629− vnode->cb_v_break != cb_v_break) {
630− vnode->cb_s_break = cb_s_break;
631− vnode->cb_v_break = cb_v_break;
632− need_clear = afs_cb_break_for_vsbreak;
633− valid = false;
634− } else if (test_bit(AFS_VNODE_ZAP_DATA, &vnode->flags)) {
623+ if (test_bit(AFS_VNODE_CB_PROMISED, &vnode->flags)) {
624+ if (vnode->cb_v_break != vnode->volume->cb_v_break)
625+ need_clear = afs_cb_break_for_v_break;
626+ else if (!afs_check_server_good(vnode))
627+ need_clear = afs_cb_break_for_s_reinit;
628+ else if (test_bit(AFS_VNODE_ZAP_DATA, &vnode->flags))
635629 need_clear = afs_cb_break_for_zap;
636− valid = false;
637− } else if (vnode->cb_expires_at - 10 <= now) {
630+ else if (vnode->cb_expires_at - 10 <= now)
638631 need_clear = afs_cb_break_for_lapsed;
639− valid = false;
640− } else {
641− valid = true;
642− }
643632 } else if (test_bit(AFS_VNODE_DELETED, &vnode->flags)) {
644− valid = true;
633+ ;
645634 } else {
646− vnode->cb_v_break = cb_v_break;
647− valid = false;
635+ need_clear = afs_cb_break_no_promise;
648636 }
649637
650638 } while (need_seqretry(&vnode->cb_lock, seq));
651639
652640 done_seqretry(&vnode->cb_lock, seq);
653641
654− if (need_clear != afs_cb_break_no_break) {
655− write_seqlock(&vnode->cb_lock);
656− if (cb_break == vnode->cb_break)
657− __afs_break_callback(vnode, need_clear);
658− else
659− trace_afs_cb_miss(&vnode->fid, need_clear);
660− write_sequnlock(&vnode->cb_lock);
661− valid = false;
662− }
642+ if (need_clear == afs_cb_break_no_break)
643+ return true;
663644
664− return valid;
645+ write_seqlock(&vnode->cb_lock);
646+ if (need_clear == afs_cb_break_no_promise)
647+ vnode->cb_v_break = vnode->volume->cb_v_break;
648+ else if (cb_break == vnode->cb_break)
649+ __afs_break_callback(vnode, need_clear);
650+ else
651+ trace_afs_cb_miss(&vnode->fid, need_clear);
652+ write_sequnlock(&vnode->cb_lock);
653+ return false;
665654 }
666655
667656 /*
@@ -675,21 +664,20 @@ bool afs_check_validity(struct afs_vnode *vnode) · 7 unmodified lines
675664 */
676665 int afs_validate(struct afs_vnode *vnode, struct key *key)
677666 {
678− bool valid;
679667 int ret;
680668
681669 _enter("{v={%llx:%llu} fl=%lx},%x",
682670 vnode->fid.vid, vnode->fid.vnode, vnode->flags,
683671 key_serial(key));
684672
685− rcu_read_lock();
686− valid = afs_check_validity(vnode);
687− rcu_read_unlock();
688−
689− if (test_bit(AFS_VNODE_DELETED, &vnode->flags))
690− clear_nlink(&vnode->vfs_inode);
673+ if (unlikely(test_bit(AFS_VNODE_DELETED, &vnode->flags))) {
674+ if (vnode->vfs_inode.i_nlink)
675+ clear_nlink(&vnode->vfs_inode);
676+ goto valid;
677+ }
691678
692− if (valid)
679+ if (test_bit(AFS_VNODE_CB_PROMISED, &vnode->flags) &&
680+ afs_check_validity(vnode))
693681 goto valid;
694682
695683 down_write(&vnode->validate_lock);
fs/afs/internal.h+21−0
@@ -390,6 +390,9 @@ struct afs_cell { · 389 unmodified lines
390390 /* Active fileserver interaction state. */
391391 struct rb_root fs_servers; /* afs_server (by server UUID) */
392392 seqlock_t fs_lock; /* For fs_servers */
393+ struct rw_semaphore fs_open_mmaps_lock;
394+ struct list_head fs_open_mmaps; /* List of vnodes that are mmapped */
395+ atomic_t fs_s_break; /* Counter of CB.InitCallBackState messages */
393396
394397 /* VL server list. */
395398 rwlock_t vl_servers_lock; /* Lock on vl_servers */
@@ -503,6 +506,7 @@ struct afs_server { · 107 unmodified lines
503506 struct hlist_node addr4_link; /* Link in net->fs_addresses4 */
504507 struct hlist_node addr6_link; /* Link in net->fs_addresses6 */
505508 struct hlist_node proc_link; /* Link in net->fs_proc */
509+ struct work_struct initcb_work; /* Work for CB.InitCallBackState* */
506510 struct afs_server *gc_next; /* Next server in manager's list */
507511 time64_t unuse_time; /* Time at which last unused */
508512 unsigned long flags;
@@ -516,6 +520,7 @@ struct afs_server { · 7 unmodified lines
516520 #define AFS_SERVER_FL_IS_YFS 16 /* Server is YFS not AFS */
517521 #define AFS_SERVER_FL_NO_IBULK 17 /* Fileserver doesn't support FS.InlineBulkStatus */
518522 #define AFS_SERVER_FL_NO_RM2 18 /* Fileserver doesn't support YFS.RemoveFile2 */
523+#define AFS_SERVER_FL_HAS_FS64 19 /* Fileserver supports FS.{Fetch,Store}Data64 */
519524 atomic_t ref; /* Object refcount */
520525 atomic_t active; /* Active user count */
521526 u32 addr_version; /* Address list version */
@@ -657,7 +662,11 @@ struct afs_vnode { · 135 unmodified lines
657662 afs_lock_type_t lock_type : 8;
658663
659664 /* outstanding callback notification on this file */
665+ struct work_struct cb_work; /* Work for mmap'd files */
666+ struct list_head cb_mmap_link; /* Link in cell->fs_open_mmaps */
660667 void *cb_server; /* Server with callback/filelock */
668+ atomic_t cb_nr_mmap; /* Number of mmaps */
669+ unsigned int cb_fs_s_break; /* Mass server break counter (cell->fs_s_break) */
661670 unsigned int cb_s_break; /* Mass break counter on ->server */
662671 unsigned int cb_v_break; /* Mass break counter on ->volume */
663672 unsigned int cb_break; /* Break counter on vnode */
@@ -965,6 +974,8 @@ extern struct fscache_cookie_def afs_vnode_cache_index_def; · 301 unmodified lines
965974 /*
966975 * callback.c
967976 */
977+extern void afs_invalidate_mmap_work(struct work_struct *);
978+extern void afs_server_init_callback_work(struct work_struct *work);
968979 extern void afs_init_callback_state(struct afs_server *);
969980 extern void __afs_break_callback(struct afs_vnode *, enum afs_cb_break_reason);
970981 extern void afs_break_callback(struct afs_vnode *, enum afs_cb_break_reason);
@@ -1585,6 +1596,16 @@ static inline void afs_update_dentry_version(struct afs_operation *op, · 614 unmodified lines
15851596 (void *)(unsigned long)dir_vp->scb.status.data_version;
15861597 }
15871598
1599+/*
1600+ * Set the file size and block count. Estimate the number of 512 bytes blocks
1601+ * used, rounded up to nearest 1K for consistency with other AFS clients.
1602+ */
1603+static inline void afs_set_i_size(struct afs_vnode *vnode, u64 size)
1604+{
1605+ i_size_write(&vnode->vfs_inode, size);
1606+ vnode->vfs_inode.i_blocks = ((size + 1023) >> 10) << 1;
1607+}
1608+
15881609 /*
15891610 * Check for a conflicting operation on a directory that we just unlinked from.
15901611 * If someone managed to sneak a link or an unlink in on the file we just
fs/afs/protocol_afs.h+15−0
@@ -0,0 +1,15 @@
1+/* SPDX-License-Identifier: GPL-2.0-or-later */
2+/* AFS protocol bits
3+ *
4+ * Copyright (C) 2021 Red Hat, Inc. All Rights Reserved.
5+ * Written by David Howells (dhowells@redhat.com)
6+ */
7+
8+
9+#define AFSCAPABILITIESMAX 196 /* Maximum number of words in a capability set */
10+
11+/* AFS3 Fileserver capabilities word 0 */
12+#define AFS3_VICED_CAPABILITY_ERRORTRANS 0x0001 /* Uses UAE errors */
13+#define AFS3_VICED_CAPABILITY_64BITFILES 0x0002 /* FetchData64 & StoreData64 supported */
14+#define AFS3_VICED_CAPABILITY_WRITELOCKACL 0x0004 /* Can lock a file even without lock perm */
15+#define AFS3_VICED_CAPABILITY_SANEACLS 0x0008 /* ACLs reviewed for sanity - don't use */
fs/afs/protocol_yfs.h+6−0
@@ -168,3 +168,9 @@ enum yfs_lock_type { · 167 unmodified lines
168168 yfs_LockMandatoryWrite = 0x101,
169169 yfs_LockMandatoryExtend = 0x102,
170170 };
171+
172+/* RXYFS Viced Capability Flags */
173+#define YFS_VICED_CAPABILITY_ERRORTRANS 0x0001 /* Deprecated v0.195 */
174+#define YFS_VICED_CAPABILITY_64BITFILES 0x0002 /* Deprecated v0.195 */
175+#define YFS_VICED_CAPABILITY_WRITELOCKACL 0x0004 /* Can lock a file even without lock perm */
176+#define YFS_VICED_CAPABILITY_SANEACLS 0x0008 /* Deprecated v0.195 */
fs/afs/rotate.c+1−0
@@ -374,6 +374,7 @@ selected_server: · 373 unmodified lines
374374 if (vnode->cb_server != server) {
375375 vnode->cb_server = server;
376376 vnode->cb_s_break = server->cb_s_break;
377+ vnode->cb_fs_s_break = atomic_read(&server->cell->fs_s_break);
377378 vnode->cb_v_break = vnode->volume->cb_v_break;
378379 clear_bit(AFS_VNODE_CB_PROMISED, &vnode->flags);
379380 }
fs/afs/server.c+2−0
@@ -235,6 +235,7 @@ static struct afs_server *afs_alloc_server(struct afs_cell *cell, · 234 unmodified lines
235235 server->addr_version = alist->version;
236236 server->uuid = *uuid;
237237 rwlock_init(&server->fs_lock);
238+ INIT_WORK(&server->initcb_work, afs_server_init_callback_work);
238239 init_waitqueue_head(&server->probe_wq);
239240 INIT_LIST_HEAD(&server->probe_link);
240241 spin_lock_init(&server->probe_lock);
@@ -467,6 +468,7 @@ static void afs_destroy_server(struct afs_net *net, struct afs_server *server) · 226 unmodified lines
467468 if (test_bit(AFS_SERVER_FL_MAY_HAVE_CB, &server->flags))
468469 afs_give_up_callbacks(net, server);
469470
471+ flush_work(&server->initcb_work);
470472 afs_put_server(net, server, afs_server_trace_destroy);
471473 }
472474
fs/afs/super.c+1−0
@@ -698,6 +698,7 @@ static struct inode *afs_alloc_inode(struct super_block *sb) · 697 unmodified lines
698698 vnode->lock_state = AFS_VNODE_LOCK_NONE;
699699
700700 init_rwsem(&vnode->rmdir_lock);
701+ INIT_WORK(&vnode->cb_work, afs_invalidate_mmap_work);
701702
702703 _leave(" = %p", &vnode->vfs_inode);
703704 return &vnode->vfs_inode;
fs/afs/write.c+24−5
@@ -137,7 +137,7 @@ int afs_write_end(struct file *file, struct address_space *mapping, · 136 unmodified lines
137137 write_seqlock(&vnode->cb_lock);
138138 i_size = i_size_read(&vnode->vfs_inode);
139139 if (maybe_i_size > i_size)
140− i_size_write(&vnode->vfs_inode, maybe_i_size);
140+ afs_set_i_size(vnode, maybe_i_size);
141141 write_sequnlock(&vnode->cb_lock);
142142 }
143143
@@ -471,13 +471,18 @@ static void afs_extend_writeback(struct address_space *mapping, · 327 unmodified lines
471471 }
472472
473473 /* Has the page moved or been split? */
474− if (unlikely(page != xas_reload(&xas)))
474+ if (unlikely(page != xas_reload(&xas))) {
475+ put_page(page);
475476 break;
477+ }
476478
477− if (!trylock_page(page))
479+ if (!trylock_page(page)) {
480+ put_page(page);
478481 break;
482+ }
479483 if (!PageDirty(page) || PageWriteback(page)) {
480484 unlock_page(page);
485+ put_page(page);
481486 break;
482487 }
483488
@@ -487,6 +492,7 @@ static void afs_extend_writeback(struct address_space *mapping, · 3 unmodified lines
487492 t = afs_page_dirty_to(page, priv);
488493 if (f != 0 && !new_content) {
489494 unlock_page(page);
495+ put_page(page);
490496 break;
491497 }
492498
@@ -801,6 +807,7 @@ int afs_writepages(struct address_space *mapping, · 308 unmodified lines
801807 ssize_t afs_file_write(struct kiocb *iocb, struct iov_iter *from)
802808 {
803809 struct afs_vnode *vnode = AFS_FS_I(file_inode(iocb->ki_filp));
810+ struct afs_file *af = iocb->ki_filp->private_data;
804811 ssize_t result;
805812 size_t count = iov_iter_count(from);
806813
@@ -816,6 +823,10 @@ ssize_t afs_file_write(struct kiocb *iocb, struct iov_iter *from) · 9 unmodified lines
816823 if (!count)
817824 return 0;
818825
826+ result = afs_validate(vnode, af->key);
827+ if (result < 0)
828+ return result;
829+
819830 result = generic_file_write_iter(iocb, from);
820831
821832 _leave(" = %zd", result);
@@ -829,13 +840,18 @@ ssize_t afs_file_write(struct kiocb *iocb, struct iov_iter *from) · 7 unmodified lines
829840 */
830841 int afs_fsync(struct file *file, loff_t start, loff_t end, int datasync)
831842 {
832− struct inode *inode = file_inode(file);
833− struct afs_vnode *vnode = AFS_FS_I(inode);
843+ struct afs_vnode *vnode = AFS_FS_I(file_inode(file));
844+ struct afs_file *af = file->private_data;
845+ int ret;
834846
835847 _enter("{%llx:%llu},{n=%pD},%d",
836848 vnode->fid.vid, vnode->fid.vnode, file,
837849 datasync);
838850
851+ ret = afs_validate(vnode, af->key);
852+ if (ret < 0)
853+ return ret;
854+
839855 return file_write_and_wait_range(file, start, end);
840856 }
841857
@@ -849,11 +865,14 @@ vm_fault_t afs_page_mkwrite(struct vm_fault *vmf) · 7 unmodified lines
849865 struct file *file = vmf->vma->vm_file;
850866 struct inode *inode = file_inode(file);
851867 struct afs_vnode *vnode = AFS_FS_I(inode);
868+ struct afs_file *af = file->private_data;
852869 unsigned long priv;
853870 vm_fault_t ret = VM_FAULT_RETRY;
854871
855872 _enter("{{%llx:%llu}},{%lx}", vnode->fid.vid, vnode->fid.vnode, page->index);
856873
874+ afs_validate(vnode, af->key);
875+
857876 sb_start_pagefault(inode->i_sb);
858877
859878 /* Wait for the page to be written to the cache before we allow it to
fs/cifs/cache.c+1−1
@@ -1,6 +1,6 @@
11 // SPDX-License-Identifier: LGPL-2.1
22 /*
3− * fs/cifs/cache.c - CIFS filesystem cache index structure definitions
3+ * CIFS filesystem cache index structure definitions
44 *
55 * Copyright (c) 2010 Novell, Inc.
66 * Authors(s): Suresh Jayaraman (sjayaraman@suse.de>
fs/cifs/cifs_debug.c+0−1
@@ -1,6 +1,5 @@
11 // SPDX-License-Identifier: GPL-2.0-or-later
22 /*
3− * fs/cifs_debug.c
43 *
54 * Copyright (C) International Business Machines Corp., 2000,2005
65 *
fs/cifs/cifs_fs_sb.h+0−1
@@ -1,6 +1,5 @@
11 /* SPDX-License-Identifier: LGPL-2.1 */
22 /*
3− * fs/cifs/cifs_fs_sb.h
43 *
54 * Copyright (c) International Business Machines Corp., 2002,2004
65 * Author(s): Steve French (sfrench@us.ibm.com)
fs/cifs/cifs_ioctl.h+0−1
@@ -1,6 +1,5 @@
11 /* SPDX-License-Identifier: LGPL-2.1 */
22 /*
3− * fs/cifs/cifs_ioctl.h
43 *
54 * Structure definitions for io control for cifs/smb3
65 *
fs/cifs/cifs_spnego.c+1−1
@@ -1,6 +1,6 @@
11 // SPDX-License-Identifier: LGPL-2.1
22 /*
3− * fs/cifs/cifs_spnego.c -- SPNEGO upcall management for CIFS
3+ * SPNEGO upcall management for CIFS
44 *
55 * Copyright (c) 2007 Red Hat, Inc.
66 * Author(s): Jeff Layton (jlayton@redhat.com)
fs/cifs/cifs_spnego.h+1−1
@@ -1,6 +1,6 @@
11 /* SPDX-License-Identifier: LGPL-2.1 */
22 /*
3− * fs/cifs/cifs_spnego.h -- SPNEGO upcall management for CIFS
3+ * SPNEGO upcall management for CIFS
44 *
55 * Copyright (c) 2007 Red Hat, Inc.
66 * Author(s): Jeff Layton (jlayton@redhat.com)
fs/cifs/cifs_unicode.c+0−1
@@ -1,6 +1,5 @@
11 // SPDX-License-Identifier: GPL-2.0-or-later
22 /*
3− * fs/cifs/cifs_unicode.c
43 *
54 * Copyright (c) International Business Machines Corp., 2000,2009
65 * Modified by Steve French (sfrench@us.ibm.com)
fs/cifs/cifsacl.c+0−1
@@ -1,6 +1,5 @@
11 // SPDX-License-Identifier: LGPL-2.1
22 /*
3− * fs/cifs/cifsacl.c
43 *
54 * Copyright (C) International Business Machines Corp., 2007,2008
65 * Author(s): Steve French (sfrench@us.ibm.com)
fs/cifs/cifsacl.h+0−1
@@ -1,6 +1,5 @@
11 /* SPDX-License-Identifier: LGPL-2.1 */
22 /*
3− * fs/cifs/cifsacl.h
43 *
54 * Copyright (c) International Business Machines Corp., 2007
65 * Author(s): Steve French (sfrench@us.ibm.com)
fs/cifs/cifsencrypt.c+0−1
@@ -1,6 +1,5 @@
11 // SPDX-License-Identifier: LGPL-2.1
22 /*
3− * fs/cifs/cifsencrypt.c
43 *
54 * Encryption and hashing operations relating to NTLM, NTLMv2. See MS-NLMP
65 * for more detailed information
fs/cifs/cifsfs.c+0−1
@@ -1,6 +1,5 @@
11 // SPDX-License-Identifier: LGPL-2.1
22 /*
3− * fs/cifs/cifsfs.c
43 *
54 * Copyright (C) International Business Machines Corp., 2002,2008
65 * Author(s): Steve French (sfrench@us.ibm.com)
fs/cifs/cifsfs.h+0−1
@@ -1,6 +1,5 @@
11 /* SPDX-License-Identifier: LGPL-2.1 */
22 /*
3− * fs/cifs/cifsfs.h
43 *
54 * Copyright (c) International Business Machines Corp., 2002, 2007
65 * Author(s): Steve French (sfrench@us.ibm.com)
fs/cifs/cifsglob.h+1−1
@@ -1,6 +1,5 @@
11 /* SPDX-License-Identifier: LGPL-2.1 */
22 /*
3− * fs/cifs/cifsglob.h
43 *
54 * Copyright (C) International Business Machines Corp., 2002,2008
65 * Author(s): Steve French (sfrench@us.ibm.com)
@@ -1400,6 +1399,7 @@ struct cifsInodeInfo { · 1393 unmodified lines
14001399 #define CIFS_INO_INVALID_MAPPING (4) /* pagecache is invalid */
14011400 #define CIFS_INO_LOCK (5) /* lock bit for synchronization */
14021401 #define CIFS_INO_MODIFIED_ATTR (6) /* Indicate change in mtime/ctime */
1402+#define CIFS_INO_CLOSE_ON_LOCK (7) /* Not to defer the close when lock is set */
14031403 unsigned long flags;
14041404 spinlock_t writers_lock;
14051405 unsigned int writers; /* Number of writers on this inode */
fs/cifs/cifspdu.h+0−1
@@ -1,6 +1,5 @@
11 /* SPDX-License-Identifier: LGPL-2.1 */
22 /*
3− * fs/cifs/cifspdu.h
43 *
54 * Copyright (c) International Business Machines Corp., 2002,2009
65 * Author(s): Steve French (sfrench@us.ibm.com)
fs/cifs/cifsproto.h+3−1
@@ -1,6 +1,5 @@
11 /* SPDX-License-Identifier: LGPL-2.1 */
22 /*
3− * fs/cifs/cifsproto.h
43 *
54 * Copyright (c) International Business Machines Corp., 2002,2008
65 * Author(s): Steve French (sfrench@us.ibm.com)
@@ -268,6 +267,9 @@ extern void cifs_close_deferred_file(struct cifsInodeInfo *cifs_inode); · 261 unmodified lines
268267
269268 extern void cifs_close_all_deferred_files(struct cifs_tcon *cifs_tcon);
270269
270+extern void cifs_close_deferred_file_under_dentry(struct cifs_tcon *cifs_tcon,
271+ const char *path);
272+
271273 extern struct TCP_Server_Info *cifs_get_tcp_session(struct smb3_fs_context *ctx);
272274 extern void cifs_put_tcp_session(struct TCP_Server_Info *server,
273275 int from_reconnect);
fs/cifs/cifssmb.c+0−1
@@ -1,6 +1,5 @@
11 // SPDX-License-Identifier: LGPL-2.1
22 /*
3− * fs/cifs/cifssmb.c
43 *
54 * Copyright (C) International Business Machines Corp., 2002,2010
65 * Author(s): Steve French (sfrench@us.ibm.com)
fs/cifs/connect.c+10−3
@@ -1,6 +1,5 @@
11 // SPDX-License-Identifier: LGPL-2.1
22 /*
3− * fs/cifs/connect.c
43 *
54 * Copyright (C) International Business Machines Corp., 2002,2011
65 * Author(s): Steve French (sfrench@us.ibm.com)
@@ -1090,7 +1089,7 @@ next_pdu: · 1083 unmodified lines
10901089 module_put_and_exit(0);
10911090 }
10921091
1093−/**
1092+/*
10941093 * Returns true if srcaddr isn't specified and rhs isn't specified, or
10951094 * if srcaddr is specified and matches the IP address of the rhs argument
10961095 */
@@ -1550,6 +1549,9 @@ static int match_session(struct cifs_ses *ses, struct smb3_fs_context *ctx) · 453 unmodified lines
15501549
15511550 /**
15521551 * cifs_setup_ipc - helper to setup the IPC tcon for the session
1552+ * @ses: smb session to issue the request on
1553+ * @ctx: the superblock configuration context to use for building the
1554+ * new tree connection for the IPC (interprocess communication RPC)
15531555 *
15541556 * A new IPC connection is made and stored in the session
15551557 * tcon_ipc. The IPC tcon has the same lifetime as the session.
@@ -1605,6 +1607,7 @@ out: · 49 unmodified lines
16051607
16061608 /**
16071609 * cifs_free_ipc - helper to release the session IPC tcon
1610+ * @ses: smb session to unmount the IPC from
16081611 *
16091612 * Needs to be called everytime a session is destroyed.
16101613 *
@@ -1855,6 +1858,8 @@ cifs_set_cifscreds(struct smb3_fs_context *ctx __attribute__((unused)), · 244 unmodified lines
18551858
18561859 /**
18571860 * cifs_get_smb_ses - get a session matching @ctx data from @server
1861+ * @server: server to setup the session to
1862+ * @ctx: superblock configuration context to use to setup the session
18581863 *
18591864 * This function assumes it is being called from cifs_mount() where we
18601865 * already got a server reference (server refcount +1). See
@@ -2065,6 +2070,8 @@ cifs_put_tcon(struct cifs_tcon *tcon) · 204 unmodified lines
20652070
20662071 /**
20672072 * cifs_get_tcon - get a tcon matching @ctx data from @ses
2073+ * @ses: smb session to issue the request on
2074+ * @ctx: the superblock configuration context to use for building the
20682075 *
20692076 * - tcon refcount is the number of mount points using the tcon.
20702077 * - ses refcount is the number of tcon using the session.
@@ -3030,7 +3037,7 @@ build_unc_path_to_root(const struct smb3_fs_context *ctx, · 959 unmodified lines
30303037 return full_path;
30313038 }
30323039
3033−/**
3040+/*
30343041 * expand_dfs_referral - Perform a dfs referral query and update the cifs_sb
30353042 *
30363043 * If a referral is found, cifs_sb->ctx->mount_options will be (re-)allocated
fs/cifs/dir.c+0−1
@@ -1,6 +1,5 @@
11 // SPDX-License-Identifier: LGPL-2.1
22 /*
3− * fs/cifs/dir.c
43 *
54 * vfs operations that deal with dentries
65 *
fs/cifs/dns_resolve.c+0−1
@@ -1,6 +1,5 @@
11 // SPDX-License-Identifier: LGPL-2.1
22 /*
3− * fs/cifs/dns_resolve.c
43 *
54 * Copyright (c) 2007 Igor Mammedov
65 * Author(s): Igor Mammedov (niallain@gmail.com)
fs/cifs/dns_resolve.h+2−2
@@ -1,7 +1,7 @@
11 /* SPDX-License-Identifier: LGPL-2.1 */
22 /*
3− * fs/cifs/dns_resolve.h -- DNS Resolver upcall management for CIFS DFS
4− * Handles host name to IP address resolution
3+ * DNS Resolver upcall management for CIFS DFS
4+ * Handles host name to IP address resolution
55 *
66 * Copyright (c) International Business Machines Corp., 2008
77 * Author(s): Steve French (sfrench@us.ibm.com)
fs/cifs/export.c+0−1
@@ -1,6 +1,5 @@
11 // SPDX-License-Identifier: LGPL-2.1
22 /*
3− * fs/cifs/export.c
43 *
54 * Copyright (C) International Business Machines Corp., 2007
65 * Author(s): Steve French (sfrench@us.ibm.com)
fs/cifs/file.c+2−1
@@ -1,6 +1,5 @@
11 // SPDX-License-Identifier: LGPL-2.1
22 /*
3− * fs/cifs/file.c
43 *
54 * vfs operations that deal with files
65 *
@@ -883,6 +882,7 @@ int cifs_close(struct inode *inode, struct file *file) · 876 unmodified lines
883882 dclose = kmalloc(sizeof(struct cifs_deferred_close), GFP_KERNEL);
884883 if ((cinode->oplock == CIFS_CACHE_RHW_FLG) &&
885884 cinode->lease_granted &&
885+ !test_bit(CIFS_INO_CLOSE_ON_LOCK, &cinode->flags) &&
886886 dclose) {
887887 if (test_bit(CIFS_INO_MODIFIED_ATTR, &cinode->flags)) {
888888 inode->i_ctime = inode->i_mtime = current_time(inode);
@@ -1865,6 +1865,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *flock) · 976 unmodified lines
18651865 cifs_read_flock(flock, &type, &lock, &unlock, &wait_flag,
18661866 tcon->ses->server);
18671867 cifs_sb = CIFS_FILE_SB(file);
1868+ set_bit(CIFS_INO_CLOSE_ON_LOCK, &CIFS_I(d_inode(cfile->dentry))->flags);
18681869
18691870 if (cap_unix(tcon->ses) &&
18701871 (CIFS_UNIX_FCNTL_CAP & le64_to_cpu(tcon->fsUnixInfo.Capability)) &&
fs/cifs/fscache.c+1−1
@@ -1,6 +1,6 @@
11 // SPDX-License-Identifier: LGPL-2.1
22 /*
3− * fs/cifs/fscache.c - CIFS filesystem cache interface
3+ * CIFS filesystem cache interface
44 *
55 * Copyright (c) 2010 Novell, Inc.
66 * Author(s): Suresh Jayaraman <sjayaraman@suse.de>
fs/cifs/fscache.h+1−1
@@ -1,6 +1,6 @@
11 /* SPDX-License-Identifier: LGPL-2.1 */
22 /*
3− * fs/cifs/fscache.h - CIFS filesystem cache interface definitions
3+ * CIFS filesystem cache interface definitions
44 *
55 * Copyright (c) 2010 Novell, Inc.
66 * Authors(s): Suresh Jayaraman (sjayaraman@suse.de>
fs/cifs/inode.c+3−4
@@ -1,6 +1,5 @@
11 // SPDX-License-Identifier: LGPL-2.1
22 /*
3− * fs/cifs/inode.c
43 *
54 * Copyright (C) International Business Machines Corp., 2002,2010
65 * Author(s): Steve French (sfrench@us.ibm.com)
@@ -1625,7 +1624,7 @@ int cifs_unlink(struct inode *dir, struct dentry *dentry) · 1618 unmodified lines
16251624 goto unlink_out;
16261625 }
16271626
1628− cifs_close_deferred_file(CIFS_I(inode));
1627+ cifs_close_deferred_file_under_dentry(tcon, full_path);
16291628 if (cap_unix(tcon->ses) && (CIFS_UNIX_POSIX_PATH_OPS_CAP &
16301629 le64_to_cpu(tcon->fsUnixInfo.Capability))) {
16311630 rc = CIFSPOSIXDelFile(xid, tcon, full_path,
@@ -2114,9 +2113,9 @@ cifs_rename2(struct user_namespace *mnt_userns, struct inode *source_dir, · 482 unmodified lines
21142113 goto cifs_rename_exit;
21152114 }
21162115
2117− cifs_close_deferred_file(CIFS_I(d_inode(source_dentry)));
2116+ cifs_close_deferred_file_under_dentry(tcon, from_name);
21182117 if (d_inode(target_dentry) != NULL)
2119− cifs_close_deferred_file(CIFS_I(d_inode(target_dentry)));
2118+ cifs_close_deferred_file_under_dentry(tcon, to_name);
21202119
21212120 rc = cifs_do_rename(xid, source_dentry, from_name, target_dentry,
21222121 to_name);
fs/cifs/ioctl.c+1−2
@@ -1,6 +1,5 @@
11 // SPDX-License-Identifier: LGPL-2.1
22 /*
3− * fs/cifs/ioctl.c
43 *
54 * vfs operations that deal with io control
65 *
@@ -359,7 +358,7 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) · 352 unmodified lines
359358 if (pSMBFile == NULL)
360359 break;
361360 tcon = tlink_tcon(pSMBFile->tlink);
362− caps = le64_to_cpu(tcon->fsUnixInfo.Capability);
361+ /* caps = le64_to_cpu(tcon->fsUnixInfo.Capability); */
363362
364363 if (get_user(ExtAttrBits, (int __user *)arg)) {
365364 rc = -EFAULT;
fs/cifs/link.c+0−1
@@ -1,6 +1,5 @@
11 // SPDX-License-Identifier: LGPL-2.1
22 /*
3− * fs/cifs/link.c
43 *
54 * Copyright (C) International Business Machines Corp., 2002,2008
65 * Author(s): Steve French (sfrench@us.ibm.com)
fs/cifs/misc.c+39−3
@@ -1,6 +1,5 @@
11 // SPDX-License-Identifier: LGPL-2.1
22 /*
3− * fs/cifs/misc.c
43 *
54 * Copyright (C) International Business Machines Corp., 2002,2008
65 * Author(s): Steve French (sfrench@us.ibm.com)
@@ -736,7 +735,7 @@ cifs_close_deferred_file(struct cifsInodeInfo *cifs_inode) · 729 unmodified lines
736735 if (cancel_delayed_work(&cfile->deferred)) {
737736 tmp_list = kmalloc(sizeof(struct file_list), GFP_ATOMIC);
738737 if (tmp_list == NULL)
739− continue;
738+ break;
740739 tmp_list->cfile = cfile;
741740 list_add_tail(&tmp_list->list, &file_head);
742741 }
@@ -767,7 +766,7 @@ cifs_close_all_deferred_files(struct cifs_tcon *tcon) · 24 unmodified lines
767766 if (cancel_delayed_work(&cfile->deferred)) {
768767 tmp_list = kmalloc(sizeof(struct file_list), GFP_ATOMIC);
769768 if (tmp_list == NULL)
770− continue;
769+ break;
771770 tmp_list->cfile = cfile;
772771 list_add_tail(&tmp_list->list, &file_head);
773772 }
@@ -781,6 +780,43 @@ cifs_close_all_deferred_files(struct cifs_tcon *tcon) · 7 unmodified lines
781780 kfree(tmp_list);
782781 }
783782 }
783+void
784+cifs_close_deferred_file_under_dentry(struct cifs_tcon *tcon, const char *path)
785+{
786+ struct cifsFileInfo *cfile;
787+ struct list_head *tmp;
788+ struct file_list *tmp_list, *tmp_next_list;
789+ struct list_head file_head;
790+ void *page;
791+ const char *full_path;
792+
793+ INIT_LIST_HEAD(&file_head);
794+ page = alloc_dentry_path();
795+ spin_lock(&tcon->open_file_lock);
796+ list_for_each(tmp, &tcon->openFileList) {
797+ cfile = list_entry(tmp, struct cifsFileInfo, tlist);
798+ full_path = build_path_from_dentry(cfile->dentry, page);
799+ if (strstr(full_path, path)) {
800+ if (delayed_work_pending(&cfile->deferred)) {
801+ if (cancel_delayed_work(&cfile->deferred)) {
802+ tmp_list = kmalloc(sizeof(struct file_list), GFP_ATOMIC);
803+ if (tmp_list == NULL)
804+ break;
805+ tmp_list->cfile = cfile;
806+ list_add_tail(&tmp_list->list, &file_head);
807+ }
808+ }
809+ }
810+ }
811+ spin_unlock(&tcon->open_file_lock);
812+
813+ list_for_each_entry_safe(tmp_list, tmp_next_list, &file_head, list) {
814+ _cifsFileInfo_put(tmp_list->cfile, true, false);
815+ list_del(&tmp_list->list);
816+ kfree(tmp_list);
817+ }
818+ free_dentry_path(page);
819+}
784820
785821 /* parses DFS refferal V3 structure
786822 * caller is responsible for freeing target_nodes
fs/cifs/netmisc.c+0−1
@@ -1,6 +1,5 @@
11 // SPDX-License-Identifier: GPL-2.0-or-later
22 /*
3− * fs/cifs/netmisc.c
43 *
54 * Copyright (c) International Business Machines Corp., 2002,2008
65 * Author(s): Steve French (sfrench@us.ibm.com)
fs/cifs/ntlmssp.h+0−1
@@ -1,6 +1,5 @@
11 /* SPDX-License-Identifier: LGPL-2.1 */
22 /*
3− * fs/cifs/ntlmssp.h
43 *
54 * Copyright (c) International Business Machines Corp., 2002,2007
65 * Author(s): Steve French (sfrench@us.ibm.com)
fs/cifs/readdir.c+0−1
@@ -1,6 +1,5 @@
11 // SPDX-License-Identifier: LGPL-2.1
22 /*
3− * fs/cifs/readdir.c
43 *
54 * Directory search handling
65 *
fs/cifs/rfc1002pdu.h+0−1
@@ -1,6 +1,5 @@
11 /* SPDX-License-Identifier: LGPL-2.1 */
22 /*
3− * fs/cifs/rfc1002pdu.h
43 *
54 * Protocol Data Unit definitions for RFC 1001/1002 support
65 *
fs/cifs/sess.c+0−1
@@ -1,6 +1,5 @@
11 // SPDX-License-Identifier: LGPL-2.1
22 /*
3− * fs/cifs/sess.c
43 *
54 * SMB/CIFS session setup handling routines
65 *
fs/cifs/smb2file.c+0−1
@@ -1,6 +1,5 @@
11 // SPDX-License-Identifier: LGPL-2.1
22 /*
3− * fs/cifs/smb2file.c
43 *
54 * Copyright (C) International Business Machines Corp., 2002, 2011
65 * Author(s): Steve French (sfrench@us.ibm.com),
fs/cifs/smb2glob.h+0−1
@@ -1,6 +1,5 @@
11 /* SPDX-License-Identifier: LGPL-2.1 */
22 /*
3− * fs/cifs/smb2glob.h
43 *
54 * Definitions for various global variables and structures
65 *
fs/cifs/smb2inode.c+0−1
@@ -1,6 +1,5 @@
11 // SPDX-License-Identifier: LGPL-2.1
22 /*
3− * fs/cifs/smb2inode.c
43 *
54 * Copyright (C) International Business Machines Corp., 2002, 2011
65 * Etersoft, 2012
fs/cifs/smb2misc.c+0−1
@@ -1,6 +1,5 @@
11 // SPDX-License-Identifier: LGPL-2.1
22 /*
3− * fs/cifs/smb2misc.c
43 *
54 * Copyright (C) International Business Machines Corp., 2002,2011
65 * Etersoft, 2012
fs/cifs/smb2pdu.c+0−1
@@ -1,6 +1,5 @@
11 // SPDX-License-Identifier: LGPL-2.1
22 /*
3− * fs/cifs/smb2pdu.c
43 *
54 * Copyright (C) International Business Machines Corp., 2009, 2013
65 * Etersoft, 2012
fs/cifs/smb2pdu.h+0−1
@@ -1,6 +1,5 @@
11 /* SPDX-License-Identifier: LGPL-2.1 */
22 /*
3− * fs/cifs/smb2pdu.h
43 *
54 * Copyright (c) International Business Machines Corp., 2009, 2013
65 * Etersoft, 2012
fs/cifs/smb2proto.h+0−1
@@ -1,6 +1,5 @@
11 /* SPDX-License-Identifier: LGPL-2.1 */
22 /*
3− * fs/cifs/smb2proto.h
43 *
54 * Copyright (c) International Business Machines Corp., 2002, 2011
65 * Etersoft, 2012
fs/cifs/smb2status.h+0−1
@@ -1,6 +1,5 @@
11 /* SPDX-License-Identifier: LGPL-2.1 */
22 /*
3− * fs/cifs/smb2status.h
43 *
54 * SMB2 Status code (network error) definitions
65 * Definitions are from MS-ERREF
fs/cifs/smb2transport.c+0−1
@@ -1,6 +1,5 @@
11 // SPDX-License-Identifier: LGPL-2.1
22 /*
3− * fs/cifs/smb2transport.c
43 *
54 * Copyright (C) International Business Machines Corp., 2002, 2011
65 * Etersoft, 2012
fs/cifs/smberr.h+0−1
@@ -1,6 +1,5 @@
11 /* SPDX-License-Identifier: LGPL-2.1 */
22 /*
3− * fs/cifs/smberr.h
43 *
54 * Copyright (c) International Business Machines Corp., 2002,2004
65 * Author(s): Steve French (sfrench@us.ibm.com)
fs/cifs/transport.c+0−1
@@ -1,6 +1,5 @@
11 // SPDX-License-Identifier: LGPL-2.1
22 /*
3− * fs/cifs/transport.c
43 *
54 * Copyright (C) International Business Machines Corp., 2002,2008
65 * Author(s): Steve French (sfrench@us.ibm.com)
fs/cifs/winucase.c+0−1
@@ -1,6 +1,5 @@
11 // SPDX-License-Identifier: GPL-2.0-or-later
22 /*
3− * fs/cifs/winucase.c
43 *
54 * Copyright (c) Jeffrey Layton <jlayton@redhat.com>, 2013
65 *
fs/cifs/xattr.c+0−1
@@ -1,6 +1,5 @@
11 // SPDX-License-Identifier: LGPL-2.1
22 /*
3− * fs/cifs/xattr.c
43 *
54 * Copyright (c) International Business Machines Corp., 2003, 2007
65 * Author(s): Steve French (sfrench@us.ibm.com)
fs/io-wq.c+13−14
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414 #include <linux/rculist_nulls.h>
1515 #include <linux/cpu.h>
1616 #include <linux/tracehook.h>
17+#include <uapi/linux/io_uring.h>
1718
1819 #include "io-wq.h"
1920
@@ -176,7 +177,6 @@ static void io_worker_ref_put(struct io_wq *wq) · 156 unmodified lines
176177 static void io_worker_exit(struct io_worker *worker)
177178 {
178179 struct io_wqe *wqe = worker->wqe;
179− struct io_wqe_acct *acct = io_wqe_get_acct(worker);
180180
181181 if (refcount_dec_and_test(&worker->ref))
182182 complete(&worker->ref_done);
@@ -186,7 +186,6 @@ static void io_worker_exit(struct io_worker *worker) · 3 unmodified lines
186186 if (worker->flags & IO_WORKER_F_FREE)
187187 hlist_nulls_del_rcu(&worker->nulls_node);
188188 list_del_rcu(&worker->all_list);
189− acct->nr_workers--;
190189 preempt_disable();
191190 io_wqe_dec_running(worker);
192191 worker->flags = 0;
@@ -246,8 +245,6 @@ static bool io_wqe_activate_free_worker(struct io_wqe *wqe, · 53 unmodified lines
246245 */
247246 static bool io_wqe_create_worker(struct io_wqe *wqe, struct io_wqe_acct *acct)
248247 {
249− bool do_create = false;
250−
251248 /*
252249 * Most likely an attempt to queue unbounded work on an io_wq that
253250 * wasn't setup with any unbounded workers.
@@ -256,18 +253,15 @@ static bool io_wqe_create_worker(struct io_wqe *wqe, struct io_wqe_acct *acct) · 2 unmodified lines
256253 pr_warn_once("io-wq is not configured for unbound workers");
257254
258255 raw_spin_lock(&wqe->lock);
259− if (acct->nr_workers < acct->max_workers) {
260− acct->nr_workers++;
261− do_create = true;
256+ if (acct->nr_workers == acct->max_workers) {
257+ raw_spin_unlock(&wqe->lock);
258+ return true;
262259 }
260+ acct->nr_workers++;
263261 raw_spin_unlock(&wqe->lock);
264− if (do_create) {
265− atomic_inc(&acct->nr_running);
266− atomic_inc(&wqe->wq->worker_refs);
267− return create_io_worker(wqe->wq, wqe, acct->index);
268− }
269−
270− return true;
262+ atomic_inc(&acct->nr_running);
263+ atomic_inc(&wqe->wq->worker_refs);
264+ return create_io_worker(wqe->wq, wqe, acct->index);
271265 }
272266
273267 static void io_wqe_inc_running(struct io_worker *worker)
@@ -574,6 +568,7 @@ loop: · 300 unmodified lines
574568 }
575569 /* timed out, exit unless we're the last worker */
576570 if (last_timeout && acct->nr_workers > 1) {
571+ acct->nr_workers--;
577572 raw_spin_unlock(&wqe->lock);
578573 __set_current_state(TASK_RUNNING);
579574 break;
@@ -1287,6 +1282,10 @@ int io_wq_max_workers(struct io_wq *wq, int *new_count) · 707 unmodified lines
12871282 {
12881283 int i, node, prev = 0;
12891284
1285+ BUILD_BUG_ON((int) IO_WQ_ACCT_BOUND != (int) IO_WQ_BOUND);
1286+ BUILD_BUG_ON((int) IO_WQ_ACCT_UNBOUND != (int) IO_WQ_UNBOUND);
1287+ BUILD_BUG_ON((int) IO_WQ_ACCT_NR != 2);
1288+
12901289 for (i = 0; i < 2; i++) {
12911290 if (new_count[i] > task_rlimit(current, RLIMIT_NPROC))
12921291 new_count[i] = task_rlimit(current, RLIMIT_NPROC);
fs/io_uring.c+144−77
@@ -712,6 +712,7 @@ struct io_async_rw { · 711 unmodified lines
712712 struct iovec fast_iov[UIO_FASTIOV];
713713 const struct iovec *free_iovec;
714714 struct iov_iter iter;
715+ struct iov_iter_state iter_state;
715716 size_t bytes_done;
716717 struct wait_page_queue wpq;
717718 };
@@ -735,7 +736,6 @@ enum { · 17 unmodified lines
735736 REQ_F_BUFFER_SELECTED_BIT,
736737 REQ_F_COMPLETE_INLINE_BIT,
737738 REQ_F_REISSUE_BIT,
738− REQ_F_DONT_REISSUE_BIT,
739739 REQ_F_CREDS_BIT,
740740 REQ_F_REFCOUNT_BIT,
741741 REQ_F_ARM_LTIMEOUT_BIT,
@@ -782,8 +782,6 @@ enum { · 40 unmodified lines
782782 REQ_F_COMPLETE_INLINE = BIT(REQ_F_COMPLETE_INLINE_BIT),
783783 /* caller should reissue async */
784784 REQ_F_REISSUE = BIT(REQ_F_REISSUE_BIT),
785− /* don't attempt request reissue, see io_rw_reissue() */
786− REQ_F_DONT_REISSUE = BIT(REQ_F_DONT_REISSUE_BIT),
787785 /* supports async reads */
788786 REQ_F_NOWAIT_READ = BIT(REQ_F_NOWAIT_READ_BIT),
789787 /* supports async writes */
@@ -2444,13 +2442,6 @@ static void io_iopoll_complete(struct io_ring_ctx *ctx, unsigned int *nr_events, · 1654 unmodified lines
24442442 req = list_first_entry(done, struct io_kiocb, inflight_entry);
24452443 list_del(&req->inflight_entry);
24462444
2447− if (READ_ONCE(req->result) == -EAGAIN &&
2448− !(req->flags & REQ_F_DONT_REISSUE)) {
2449− req->iopoll_completed = 0;
2450− io_req_task_queue_reissue(req);
2451− continue;
2452− }
2453−
24542445 __io_cqring_fill_event(ctx, req->user_data, req->result,
24552446 io_put_rw_kbuf(req));
24562447 (*nr_events)++;
@@ -2613,8 +2604,7 @@ static bool io_resubmit_prep(struct io_kiocb *req) · 156 unmodified lines
26132604
26142605 if (!rw)
26152606 return !io_req_prep_async(req);
2616− /* may have left rw->iter inconsistent on -EIOCBQUEUED */
2617− iov_iter_revert(&rw->iter, req->result - iov_iter_count(&rw->iter));
2607+ iov_iter_restore(&rw->iter, &rw->iter_state);
26182608 return true;
26192609 }
26202610
@@ -2714,10 +2704,9 @@ static void io_complete_rw_iopoll(struct kiocb *kiocb, long res, long res2) · 93 unmodified lines
27142704 if (kiocb->ki_flags & IOCB_WRITE)
27152705 kiocb_end_write(req);
27162706 if (unlikely(res != req->result)) {
2717− if (!(res == -EAGAIN && io_rw_should_reissue(req) &&
2718− io_resubmit_prep(req))) {
2719− req_set_fail(req);
2720− req->flags |= REQ_F_DONT_REISSUE;
2707+ if (res == -EAGAIN && io_rw_should_reissue(req)) {
2708+ req->flags |= REQ_F_REISSUE;
2709+ return;
27212710 }
27222711 }
27232712
@@ -2843,7 +2832,8 @@ static bool io_file_supports_nowait(struct io_kiocb *req, int rw) · 119 unmodified lines
28432832 return __io_file_supports_nowait(req->file, rw);
28442833 }
28452834
2846−static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe)
2835+static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe,
2836+ int rw)
28472837 {
28482838 struct io_ring_ctx *ctx = req->ctx;
28492839 struct kiocb *kiocb = &req->rw.kiocb;
@@ -2865,8 +2855,13 @@ static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe) · 15 unmodified lines
28652855 if (unlikely(ret))
28662856 return ret;
28672857
2868− /* don't allow async punt for O_NONBLOCK or RWF_NOWAIT */
2869− if ((kiocb->ki_flags & IOCB_NOWAIT) || (file->f_flags & O_NONBLOCK))
2858+ /*
2859+ * If the file is marked O_NONBLOCK, still allow retry for it if it
2860+ * supports async. Otherwise it's impossible to use O_NONBLOCK files
2861+ * reliably. If not, or it IOCB_NOWAIT is set, don't retry.
2862+ */
2863+ if ((kiocb->ki_flags & IOCB_NOWAIT) ||
2864+ ((file->f_flags & O_NONBLOCK) && !io_file_supports_nowait(req, rw)))
28702865 req->flags |= REQ_F_NOWAIT;
28712866
28722867 ioprio = READ_ONCE(sqe->ioprio);
@@ -2931,7 +2926,6 @@ static void kiocb_done(struct kiocb *kiocb, ssize_t ret, · 58 unmodified lines
29312926 {
29322927 struct io_kiocb *req = container_of(kiocb, struct io_kiocb, rw.kiocb);
29332928 struct io_async_rw *io = req->async_data;
2934− bool check_reissue = kiocb->ki_complete == io_complete_rw;
29352929
29362930 /* add previously done IO, if any */
29372931 if (io && io->bytes_done > 0) {
@@ -2943,19 +2937,27 @@ static void kiocb_done(struct kiocb *kiocb, ssize_t ret, · 5 unmodified lines
29432937
29442938 if (req->flags & REQ_F_CUR_POS)
29452939 req->file->f_pos = kiocb->ki_pos;
2946− if (ret >= 0 && check_reissue)
2940+ if (ret >= 0 && (kiocb->ki_complete == io_complete_rw))
29472941 __io_complete_rw(req, ret, 0, issue_flags);
29482942 else
29492943 io_rw_done(kiocb, ret);
29502944
2951− if (check_reissue && (req->flags & REQ_F_REISSUE)) {
2945+ if (req->flags & REQ_F_REISSUE) {
29522946 req->flags &= ~REQ_F_REISSUE;
29532947 if (io_resubmit_prep(req)) {
29542948 io_req_task_queue_reissue(req);
29552949 } else {
2950+ unsigned int cflags = io_put_rw_kbuf(req);
2951+ struct io_ring_ctx *ctx = req->ctx;
2952+
29562953 req_set_fail(req);
2957− __io_req_complete(req, issue_flags, ret,
2958− io_put_rw_kbuf(req));
2954+ if (issue_flags & IO_URING_F_NONBLOCK) {
2955+ mutex_lock(&ctx->uring_lock);
2956+ __io_req_complete(req, issue_flags, ret, cflags);
2957+ mutex_unlock(&ctx->uring_lock);
2958+ } else {
2959+ __io_req_complete(req, issue_flags, ret, cflags);
2960+ }
29592961 }
29602962 }
29612963 }
@@ -3263,12 +3265,15 @@ static ssize_t loop_rw_iter(int rw, struct io_kiocb *req, struct iov_iter *iter) · 301 unmodified lines
32633265 ret = nr;
32643266 break;
32653267 }
3268+ if (!iov_iter_is_bvec(iter)) {
3269+ iov_iter_advance(iter, nr);
3270+ } else {
3271+ req->rw.len -= nr;
3272+ req->rw.addr += nr;
3273+ }
32663274 ret += nr;
32673275 if (nr != iovec.iov_len)
32683276 break;
3269− req->rw.len -= nr;
3270− req->rw.addr += nr;
3271− iov_iter_advance(iter, nr);
32723277 }
32733278
32743279 return ret;
@@ -3315,12 +3320,17 @@ static int io_setup_async_rw(struct io_kiocb *req, const struct iovec *iovec, · 40 unmodified lines
33153320 if (!force && !io_op_defs[req->opcode].needs_async_setup)
33163321 return 0;
33173322 if (!req->async_data) {
3323+ struct io_async_rw *iorw;
3324+
33183325 if (io_alloc_async_data(req)) {
33193326 kfree(iovec);
33203327 return -ENOMEM;
33213328 }
33223329
33233330 io_req_map_rw(req, iovec, fast_iov, iter);
3331+ iorw = req->async_data;
3332+ /* we've copied and mapped the iter, ensure state is saved */
3333+ iov_iter_save_state(&iorw->iter, &iorw->iter_state);
33243334 }
33253335 return 0;
33263336 }
@@ -3339,6 +3349,7 @@ static inline int io_rw_prep_async(struct io_kiocb *req, int rw) · 12 unmodified lines
33393349 iorw->free_iovec = iov;
33403350 if (iov)
33413351 req->flags |= REQ_F_NEED_CLEANUP;
3352+ iov_iter_save_state(&iorw->iter, &iorw->iter_state);
33423353 return 0;
33433354 }
33443355
@@ -3346,7 +3357,7 @@ static int io_read_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) · 1 unmodified line
33463357 {
33473358 if (unlikely(!(req->file->f_mode & FMODE_READ)))
33483359 return -EBADF;
3349− return io_prep_rw(req, sqe);
3360+ return io_prep_rw(req, sqe, READ);
33503361 }
33513362
33523363 /*
@@ -3442,19 +3453,28 @@ static int io_read(struct io_kiocb *req, unsigned int issue_flags) · 89 unmodified lines
34423453 struct kiocb *kiocb = &req->rw.kiocb;
34433454 struct iov_iter __iter, *iter = &__iter;
34443455 struct io_async_rw *rw = req->async_data;
3445− ssize_t io_size, ret, ret2;
34463456 bool force_nonblock = issue_flags & IO_URING_F_NONBLOCK;
3457+ struct iov_iter_state __state, *state;
3458+ ssize_t ret, ret2;
34473459
34483460 if (rw) {
34493461 iter = &rw->iter;
3462+ state = &rw->iter_state;
3463+ /*
3464+ * We come here from an earlier attempt, restore our state to
3465+ * match in case it doesn't. It's cheap enough that we don't
3466+ * need to make this conditional.
3467+ */
3468+ iov_iter_restore(iter, state);
34503469 iovec = NULL;
34513470 } else {
34523471 ret = io_import_iovec(READ, req, &iovec, iter, !force_nonblock);
34533472 if (ret < 0)
34543473 return ret;
3474+ state = &__state;
3475+ iov_iter_save_state(iter, state);
34553476 }
3456− io_size = iov_iter_count(iter);
3457− req->result = io_size;
3477+ req->result = iov_iter_count(iter);
34583478
34593479 /* Ensure we clear previously set non-block flag */
34603480 if (!force_nonblock)
@@ -3468,7 +3488,7 @@ static int io_read(struct io_kiocb *req, unsigned int issue_flags) · 7 unmodified lines
34683488 return ret ?: -EAGAIN;
34693489 }
34703490
3471− ret = rw_verify_area(READ, req->file, io_kiocb_ppos(kiocb), io_size);
3491+ ret = rw_verify_area(READ, req->file, io_kiocb_ppos(kiocb), req->result);
34723492 if (unlikely(ret)) {
34733493 kfree(iovec);
34743494 return ret;
@@ -3484,30 +3504,49 @@ static int io_read(struct io_kiocb *req, unsigned int issue_flags) · 9 unmodified lines
34843504 /* no retry on NONBLOCK nor RWF_NOWAIT */
34853505 if (req->flags & REQ_F_NOWAIT)
34863506 goto done;
3487− /* some cases will consume bytes even on error returns */
3488− iov_iter_reexpand(iter, iter->count + iter->truncated);
3489− iov_iter_revert(iter, io_size - iov_iter_count(iter));
34903507 ret = 0;
34913508 } else if (ret == -EIOCBQUEUED) {
34923509 goto out_free;
3493− } else if (ret <= 0 || ret == io_size || !force_nonblock ||
3510+ } else if (ret <= 0 || ret == req->result || !force_nonblock ||
34943511 (req->flags & REQ_F_NOWAIT) || !need_read_all(req)) {
34953512 /* read all, failed, already did sync or don't want to retry */
34963513 goto done;
34973514 }
34983515
3516+ /*
3517+ * Don't depend on the iter state matching what was consumed, or being
3518+ * untouched in case of error. Restore it and we'll advance it
3519+ * manually if we need to.
3520+ */
3521+ iov_iter_restore(iter, state);
3522+
34993523 ret2 = io_setup_async_rw(req, iovec, inline_vecs, iter, true);
35003524 if (ret2)
35013525 return ret2;
35023526
35033527 iovec = NULL;
35043528 rw = req->async_data;
3505− /* now use our persistent iterator, if we aren't already */
3506− iter = &rw->iter;
3529+ /*
3530+ * Now use our persistent iterator and state, if we aren't already.
3531+ * We've restored and mapped the iter to match.
3532+ */
3533+ if (iter != &rw->iter) {
3534+ iter = &rw->iter;
3535+ state = &rw->iter_state;
3536+ }
35073537
35083538 do {
3509− io_size -= ret;
3539+ /*
3540+ * We end up here because of a partial read, either from
3541+ * above or inside this loop. Advance the iter by the bytes
3542+ * that were consumed.
3543+ */
3544+ iov_iter_advance(iter, ret);
3545+ if (!iov_iter_count(iter))
3546+ break;
35103547 rw->bytes_done += ret;
3548+ iov_iter_save_state(iter, state);
3549+
35113550 /* if we can retry, do so with the callbacks armed */
35123551 if (!io_rw_should_retry(req)) {
35133552 kiocb->ki_flags &= ~IOCB_WAITQ;
@@ -3525,7 +3564,8 @@ static int io_read(struct io_kiocb *req, unsigned int issue_flags) · 11 unmodified lines
35253564 return 0;
35263565 /* we got some bytes, but not all. retry. */
35273566 kiocb->ki_flags &= ~IOCB_WAITQ;
3528− } while (ret > 0 && ret < io_size);
3567+ iov_iter_restore(iter, state);
3568+ } while (ret > 0);
35293569 done:
35303570 kiocb_done(kiocb, ret, issue_flags);
35313571 out_free:
@@ -3539,7 +3579,7 @@ static int io_write_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) · 7 unmodified lines
35393579 {
35403580 if (unlikely(!(req->file->f_mode & FMODE_WRITE)))
35413581 return -EBADF;
3542− return io_prep_rw(req, sqe);
3582+ return io_prep_rw(req, sqe, WRITE);
35433583 }
35443584
35453585 static int io_write(struct io_kiocb *req, unsigned int issue_flags)
@@ -3548,19 +3588,24 @@ static int io_write(struct io_kiocb *req, unsigned int issue_flags) · 2 unmodified lines
35483588 struct kiocb *kiocb = &req->rw.kiocb;
35493589 struct iov_iter __iter, *iter = &__iter;
35503590 struct io_async_rw *rw = req->async_data;
3551− ssize_t ret, ret2, io_size;
35523591 bool force_nonblock = issue_flags & IO_URING_F_NONBLOCK;
3592+ struct iov_iter_state __state, *state;
3593+ ssize_t ret, ret2;
35533594
35543595 if (rw) {
35553596 iter = &rw->iter;
3597+ state = &rw->iter_state;
3598+ iov_iter_restore(iter, state);
35563599 iovec = NULL;
35573600 } else {
35583601 ret = io_import_iovec(WRITE, req, &iovec, iter, !force_nonblock);
35593602 if (ret < 0)
35603603 return ret;
3604+ state = &__state;
3605+ iov_iter_save_state(iter, state);
35613606 }
3562− io_size = iov_iter_count(iter);
3563− req->result = io_size;
3607+ req->result = iov_iter_count(iter);
3608+ ret2 = 0;
35643609
35653610 /* Ensure we clear previously set non-block flag */
35663611 if (!force_nonblock)
@@ -3577,7 +3622,7 @@ static int io_write(struct io_kiocb *req, unsigned int issue_flags) · 10 unmodified lines
35773622 (req->flags & REQ_F_ISREG))
35783623 goto copy_iov;
35793624
3580− ret = rw_verify_area(WRITE, req->file, io_kiocb_ppos(kiocb), io_size);
3625+ ret = rw_verify_area(WRITE, req->file, io_kiocb_ppos(kiocb), req->result);
35813626 if (unlikely(ret))
35823627 goto out_free;
35833628
@@ -3624,9 +3669,9 @@ done: · 40 unmodified lines
36243669 kiocb_done(kiocb, ret2, issue_flags);
36253670 } else {
36263671 copy_iov:
3627− /* some cases will consume bytes even on error returns */
3628− iov_iter_reexpand(iter, iter->count + iter->truncated);
3629− iov_iter_revert(iter, io_size - iov_iter_count(iter));
3672+ iov_iter_restore(iter, state);
3673+ if (ret2 > 0)
3674+ iov_iter_advance(iter, ret2);
36303675 ret = io_setup_async_rw(req, iovec, inline_vecs, iter, false);
36313676 return ret ?: -EAGAIN;
36323677 }
@@ -7515,6 +7560,14 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events, · 3882 unmodified lines
75157560 break;
75167561 } while (1);
75177562
7563+ if (uts) {
7564+ struct timespec64 ts;
7565+
7566+ if (get_timespec64(&ts, uts))
7567+ return -EFAULT;
7568+ timeout = timespec64_to_jiffies(&ts);
7569+ }
7570+
75187571 if (sig) {
75197572 #ifdef CONFIG_COMPAT
75207573 if (in_compat_syscall())
@@ -7528,14 +7581,6 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events, · 7 unmodified lines
75287581 return ret;
75297582 }
75307583
7531− if (uts) {
7532− struct timespec64 ts;
7533−
7534− if (get_timespec64(&ts, uts))
7535− return -EFAULT;
7536− timeout = timespec64_to_jiffies(&ts);
7537− }
7538−
75397584 init_waitqueue_func_entry(&iowq.wq, io_wake_function);
75407585 iowq.wq.private = current;
75417586 INIT_LIST_HEAD(&iowq.wq.entry);
@@ -8284,11 +8329,27 @@ static int io_sqe_file_register(struct io_ring_ctx *ctx, struct file *file, · 742 unmodified lines
82848329 #endif
82858330 }
82868331
8332+static int io_queue_rsrc_removal(struct io_rsrc_data *data, unsigned idx,
8333+ struct io_rsrc_node *node, void *rsrc)
8334+{
8335+ struct io_rsrc_put *prsrc;
8336+
8337+ prsrc = kzalloc(sizeof(*prsrc), GFP_KERNEL);
8338+ if (!prsrc)
8339+ return -ENOMEM;
8340+
8341+ prsrc->tag = *io_get_tag_slot(data, idx);
8342+ prsrc->rsrc = rsrc;
8343+ list_add(&prsrc->list, &node->rsrc_list);
8344+ return 0;
8345+}
8346+
82878347 static int io_install_fixed_file(struct io_kiocb *req, struct file *file,
82888348 unsigned int issue_flags, u32 slot_index)
82898349 {
82908350 struct io_ring_ctx *ctx = req->ctx;
82918351 bool force_nonblock = issue_flags & IO_URING_F_NONBLOCK;
8352+ bool needs_switch = false;
82928353 struct io_fixed_file *file_slot;
82938354 int ret = -EBADF;
82948355
@@ -8304,9 +8365,22 @@ static int io_install_fixed_file(struct io_kiocb *req, struct file *file, · 9 unmodified lines
83048365
83058366 slot_index = array_index_nospec(slot_index, ctx->nr_user_files);
83068367 file_slot = io_fixed_file_slot(&ctx->file_table, slot_index);
8307− ret = -EBADF;
8308− if (file_slot->file_ptr)
8309− goto err;
8368+
8369+ if (file_slot->file_ptr) {
8370+ struct file *old_file;
8371+
8372+ ret = io_rsrc_node_switch_start(ctx);
8373+ if (ret)
8374+ goto err;
8375+
8376+ old_file = (struct file *)(file_slot->file_ptr & FFS_MASK);
8377+ ret = io_queue_rsrc_removal(ctx->file_data, slot_index,
8378+ ctx->rsrc_node, old_file);
8379+ if (ret)
8380+ goto err;
8381+ file_slot->file_ptr = 0;
8382+ needs_switch = true;
8383+ }
83108384
83118385 *io_get_tag_slot(ctx->file_data, slot_index) = 0;
83128386 io_fixed_file_set(file_slot, file);
@@ -8318,27 +8392,14 @@ static int io_install_fixed_file(struct io_kiocb *req, struct file *file, · 5 unmodified lines
83188392
83198393 ret = 0;
83208394 err:
8395+ if (needs_switch)
8396+ io_rsrc_node_switch(ctx, ctx->file_data);
83218397 io_ring_submit_unlock(ctx, !force_nonblock);
83228398 if (ret)
83238399 fput(file);
83248400 return ret;
83258401 }
83268402
8327−static int io_queue_rsrc_removal(struct io_rsrc_data *data, unsigned idx,
8328− struct io_rsrc_node *node, void *rsrc)
8329−{
8330− struct io_rsrc_put *prsrc;
8331−
8332− prsrc = kzalloc(sizeof(*prsrc), GFP_KERNEL);
8333− if (!prsrc)
8334− return -ENOMEM;
8335−
8336− prsrc->tag = *io_get_tag_slot(data, idx);
8337− prsrc->rsrc = rsrc;
8338− list_add(&prsrc->list, &node->rsrc_list);
8339− return 0;
8340−}
8341−
83428403 static int __io_sqe_files_update(struct io_ring_ctx *ctx,
83438404 struct io_uring_rsrc_update2 *up,
83448405 unsigned nr_args)
@@ -10560,10 +10621,12 @@ static int io_register_iowq_max_workers(struct io_ring_ctx *ctx, · 2215 unmodified lines
1056010621 * ordering. Fine to drop uring_lock here, we hold
1056110622 * a ref to the ctx.
1056210623 */
10624+ refcount_inc(&sqd->refs);
1056310625 mutex_unlock(&ctx->uring_lock);
1056410626 mutex_lock(&sqd->lock);
1056510627 mutex_lock(&ctx->uring_lock);
10566− tctx = sqd->thread->io_uring;
10628+ if (sqd->thread)
10629+ tctx = sqd->thread->io_uring;
1056710630 }
1056810631 } else {
1056910632 tctx = current->io_uring;
@@ -10577,16 +10640,20 @@ static int io_register_iowq_max_workers(struct io_ring_ctx *ctx, · 7 unmodified lines
1057710640 if (ret)
1057810641 goto err;
1057910642
10580− if (sqd)
10643+ if (sqd) {
1058110644 mutex_unlock(&sqd->lock);
10645+ io_put_sq_data(sqd);
10646+ }
1058210647
1058310648 if (copy_to_user(arg, new_count, sizeof(new_count)))
1058410649 return -EFAULT;
1058510650
1058610651 return 0;
1058710652 err:
10588− if (sqd)
10653+ if (sqd) {
1058910654 mutex_unlock(&sqd->lock);
10655+ io_put_sq_data(sqd);
10656+ }
1059010657 return ret;
1059110658 }
1059210659
fs/ksmbd/misc.c+67−9
@@ -191,19 +191,77 @@ int get_nlink(struct kstat *st) · 190 unmodified lines
191191 return nlink;
192192 }
193193
194−void ksmbd_conv_path_to_unix(char *path)
194+char *ksmbd_conv_path_to_unix(char *path)
195195 {
196+ size_t path_len, remain_path_len, out_path_len;
197+ char *out_path, *out_next;
198+ int i, pre_dotdot_cnt = 0, slash_cnt = 0;
199+ bool is_last;
200+
196201 strreplace(path, '\\', '/');
197−}
202+ path_len = strlen(path);
203+ remain_path_len = path_len;
204+ if (path_len == 0)
205+ return ERR_PTR(-EINVAL);
198206
199−void ksmbd_strip_last_slash(char *path)
200−{
201− int len = strlen(path);
207+ out_path = kzalloc(path_len + 2, GFP_KERNEL);
208+ if (!out_path)
209+ return ERR_PTR(-ENOMEM);
210+ out_path_len = 0;
211+ out_next = out_path;
212+
213+ do {
214+ char *name = path + path_len - remain_path_len;
215+ char *next = strchrnul(name, '/');
216+ size_t name_len = next - name;
217+
218+ is_last = !next[0];
219+ if (name_len == 2 && name[0] == '.' && name[1] == '.') {
220+ pre_dotdot_cnt++;
221+ /* handle the case that path ends with "/.." */
222+ if (is_last)
223+ goto follow_dotdot;
224+ } else {
225+ if (pre_dotdot_cnt) {
226+follow_dotdot:
227+ slash_cnt = 0;
228+ for (i = out_path_len - 1; i >= 0; i--) {
229+ if (out_path[i] == '/' &&
230+ ++slash_cnt == pre_dotdot_cnt + 1)
231+ break;
232+ }
233+
234+ if (i < 0 &&
235+ slash_cnt != pre_dotdot_cnt) {
236+ kfree(out_path);
237+ return ERR_PTR(-EINVAL);
238+ }
239+
240+ out_next = &out_path[i+1];
241+ *out_next = '\0';
242+ out_path_len = i + 1;
202243
203− while (len && path[len - 1] == '/') {
204− path[len - 1] = '\0';
205− len--;
206− }
244+ }
245+
246+ if (name_len != 0 &&
247+ !(name_len == 1 && name[0] == '.') &&
248+ !(name_len == 2 && name[0] == '.' && name[1] == '.')) {
249+ next[0] = '\0';
250+ sprintf(out_next, "%s/", name);
251+ out_next += name_len + 1;
252+ out_path_len += name_len + 1;
253+ next[0] = '/';
254+ }
255+ pre_dotdot_cnt = 0;
256+ }
257+
258+ remain_path_len -= name_len + 1;
259+ } while (!is_last);
260+
261+ if (out_path_len > 0)
262+ out_path[out_path_len-1] = '\0';
263+ path[path_len] = '\0';
264+ return out_path;
207265 }
208266
209267 void ksmbd_conv_path_to_windows(char *path)
fs/ksmbd/misc.h+1−2
@@ -16,8 +16,7 @@ int ksmbd_validate_filename(char *filename); · 15 unmodified lines
1616 int parse_stream_name(char *filename, char **stream_name, int *s_type);
1717 char *convert_to_nt_pathname(char *filename, char *sharepath);
1818 int get_nlink(struct kstat *st);
19−void ksmbd_conv_path_to_unix(char *path);
20−void ksmbd_strip_last_slash(char *path);
19+char *ksmbd_conv_path_to_unix(char *path);
2120 void ksmbd_conv_path_to_windows(char *path);
2221 char *ksmbd_extract_sharename(char *treename);
2322 char *convert_to_unix_name(struct ksmbd_share_config *share, char *name);
fs/ksmbd/smb2pdu.c+13−5
@@ -634,7 +634,7 @@ static char * · 633 unmodified lines
634634 smb2_get_name(struct ksmbd_share_config *share, const char *src,
635635 const int maxlen, struct nls_table *local_nls)
636636 {
637− char *name, *unixname;
637+ char *name, *norm_name, *unixname;
638638
639639 name = smb_strndup_from_utf16(src, maxlen, 1, local_nls);
640640 if (IS_ERR(name)) {
@@ -643,11 +643,15 @@ smb2_get_name(struct ksmbd_share_config *share, const char *src, · 2 unmodified lines
643643 }
644644
645645 /* change it to absolute unix name */
646− ksmbd_conv_path_to_unix(name);
647− ksmbd_strip_last_slash(name);
648−
649− unixname = convert_to_unix_name(share, name);
646+ norm_name = ksmbd_conv_path_to_unix(name);
647+ if (IS_ERR(norm_name)) {
648+ kfree(name);
649+ return norm_name;
650+ }
650651 kfree(name);
652+
653+ unixname = convert_to_unix_name(share, norm_name);
654+ kfree(norm_name);
651655 if (!unixname) {
652656 pr_err("can not convert absolute name\n");
653657 return ERR_PTR(-ENOMEM);
@@ -4041,6 +4045,10 @@ static int smb2_get_ea(struct ksmbd_work *work, struct ksmbd_file *fp, · 3387 unmodified lines
40414045 path = &fp->filp->f_path;
40424046 /* single EA entry is requested with given user.* name */
40434047 if (req->InputBufferLength) {
4048+ if (le32_to_cpu(req->InputBufferLength) <
4049+ sizeof(struct smb2_ea_info_req))
4050+ return -EINVAL;
4051+
40444052 ea_req = (struct smb2_ea_info_req *)req->Buffer;
40454053 } else {
40464054 /* need to send all EAs, if no specific EA is requested*/
fs/ksmbd/transport_rdma.c+0−1
@@ -20,7 +20,6 @@ · 19 unmodified lines
2020 #define SUBMOD_NAME "smb_direct"
2121
2222 #include <linux/kthread.h>
23−#include <linux/rwlock.h>
2423 #include <linux/list.h>
2524 #include <linux/mempool.h>
2625 #include <linux/highmem.h>
fs/lockd/svcxdr.h+2−11
@@ -134,18 +134,9 @@ svcxdr_decode_owner(struct xdr_stream *xdr, struct xdr_netobj *obj) · 133 unmodified lines
134134 static inline bool
135135 svcxdr_encode_owner(struct xdr_stream *xdr, const struct xdr_netobj *obj)
136136 {
137− unsigned int quadlen = XDR_QUADLEN(obj->len);
138− __be32 *p;
139−
140− if (xdr_stream_encode_u32(xdr, obj->len) < 0)
141− return false;
142− p = xdr_reserve_space(xdr, obj->len);
143− if (!p)
137+ if (obj->len > XDR_MAX_NETOBJ)
144138 return false;
145− p[quadlen - 1] = 0; /* XDR pad */
146− memcpy(p, obj->data, obj->len);
147−
148− return true;
139+ return xdr_stream_encode_opaque(xdr, obj->data, obj->len) > 0;
149140 }
150141
151142 #endif /* _LOCKD_SVCXDR_H_ */
fs/nfsd/nfs4state.c+13−3
@@ -3570,7 +3570,7 @@ static struct nfsd4_conn *__nfsd4_find_conn(struct svc_xprt *xpt, struct nfsd4_s · 3569 unmodified lines
35703570 }
35713571
35723572 static __be32 nfsd4_match_existing_connection(struct svc_rqst *rqst,
3573− struct nfsd4_session *session, u32 req)
3573+ struct nfsd4_session *session, u32 req, struct nfsd4_conn **conn)
35743574 {
35753575 struct nfs4_client *clp = session->se_client;
35763576 struct svc_xprt *xpt = rqst->rq_xprt;
@@ -3593,6 +3593,8 @@ static __be32 nfsd4_match_existing_connection(struct svc_rqst *rqst, · 16 unmodified lines
35933593 else
35943594 status = nfserr_inval;
35953595 spin_unlock(&clp->cl_lock);
3596+ if (status == nfs_ok && conn)
3597+ *conn = c;
35963598 return status;
35973599 }
35983600
@@ -3617,8 +3619,16 @@ __be32 nfsd4_bind_conn_to_session(struct svc_rqst *rqstp, · 18 unmodified lines
36173619 status = nfserr_wrong_cred;
36183620 if (!nfsd4_mach_creds_match(session->se_client, rqstp))
36193621 goto out;
3620− status = nfsd4_match_existing_connection(rqstp, session, bcts->dir);
3621− if (status == nfs_ok || status == nfserr_inval)
3622+ status = nfsd4_match_existing_connection(rqstp, session,
3623+ bcts->dir, &conn);
3624+ if (status == nfs_ok) {
3625+ if (bcts->dir == NFS4_CDFC4_FORE_OR_BOTH ||
3626+ bcts->dir == NFS4_CDFC4_BACK)
3627+ conn->cn_flags |= NFS4_CDFC4_BACK;
3628+ nfsd4_probe_callback(session->se_client);
3629+ goto out;
3630+ }
3631+ if (status == nfserr_inval)
36223632 goto out;
36233633 status = nfsd4_map_bcts_dir(&bcts->dir);
36243634 if (status)
fs/qnx4/dir.c+27−9
@@ -20,12 +20,33 @@ · 19 unmodified lines
2020 * depending on the status field in the last byte. The
2121 * first byte is where the name start either way, and a
2222 * zero means it's empty.
23+ *
24+ * Also, due to a bug in gcc, we don't want to use the
25+ * real (differently sized) name arrays in the inode and
26+ * link entries, but always the 'de_name[]' one in the
27+ * fake struct entry.
28+ *
29+ * See
30+ *
31+ * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578#c6
32+ *
33+ * for details, but basically gcc will take the size of the
34+ * 'name' array from one of the used union entries randomly.
35+ *
36+ * This use of 'de_name[]' (48 bytes) avoids the false positive
37+ * warnings that would happen if gcc decides to use 'inode.di_name'
38+ * (16 bytes) even when the pointer and size were to come from
39+ * 'link.dl_name' (48 bytes).
40+ *
41+ * In all cases the actual name pointer itself is the same, it's
42+ * only the gcc internal 'what is the size of this field' logic
43+ * that can get confused.
2344 */
2445 union qnx4_directory_entry {
2546 struct {
26− char de_name;
27− char de_pad[62];
28− char de_status;
47+ const char de_name[48];
48+ u8 de_pad[15];
49+ u8 de_status;
2950 };
3051 struct qnx4_inode_entry inode;
3152 struct qnx4_link_info link;
@@ -53,29 +74,26 @@ static int qnx4_readdir(struct file *file, struct dir_context *ctx) · 21 unmodified lines
5374 ix = (ctx->pos >> QNX4_DIR_ENTRY_SIZE_BITS) % QNX4_INODES_PER_BLOCK;
5475 for (; ix < QNX4_INODES_PER_BLOCK; ix++, ctx->pos += QNX4_DIR_ENTRY_SIZE) {
5576 union qnx4_directory_entry *de;
56− const char *name;
5777
5878 offset = ix * QNX4_DIR_ENTRY_SIZE;
5979 de = (union qnx4_directory_entry *) (bh->b_data + offset);
6080
61− if (!de->de_name)
81+ if (!de->de_name[0])
6282 continue;
6383 if (!(de->de_status & (QNX4_FILE_USED|QNX4_FILE_LINK)))
6484 continue;
6585 if (!(de->de_status & QNX4_FILE_LINK)) {
6686 size = sizeof(de->inode.di_fname);
67− name = de->inode.di_fname;
6887 ino = blknum * QNX4_INODES_PER_BLOCK + ix - 1;
6988 } else {
7089 size = sizeof(de->link.dl_fname);
71− name = de->link.dl_fname;
7290 ino = ( le32_to_cpu(de->link.dl_inode_blk) - 1 ) *
7391 QNX4_INODES_PER_BLOCK +
7492 de->link.dl_inode_ndx;
7593 }
76− size = strnlen(name, size);
94+ size = strnlen(de->de_name, size);
7795 QNX4DEBUG((KERN_INFO "qnx4_readdir:%.*s\n", size, name));
78− if (!dir_emit(ctx, name, size, ino, DT_UNKNOWN)) {
96+ if (!dir_emit(ctx, de->de_name, size, ino, DT_UNKNOWN)) {
7997 brelse(bh);
8098 return 0;
8199 }
fs/smbfs_common/smbfsctl.h+1−1
@@ -1,6 +1,6 @@
11 /* SPDX-License-Identifier: LGPL-2.1+ */
22 /*
3− * fs/cifs/smbfsctl.h: SMB, CIFS, SMB2 FSCTL definitions
3+ * SMB, CIFS, SMB2 FSCTL definitions
44 *
55 * Copyright (c) International Business Machines Corp., 2002,2013
66 * Author(s): Steve French (sfrench@us.ibm.com)
include/asm-generic/io.h+3−23
@@ -1023,16 +1023,7 @@ static inline void __iomem *ioport_map(unsigned long port, unsigned int nr) · 1022 unmodified lines
10231023 port &= IO_SPACE_LIMIT;
10241024 return (port > MMIO_UPPER_LIMIT) ? NULL : PCI_IOBASE + port;
10251025 }
1026−#define __pci_ioport_unmap __pci_ioport_unmap
1027−static inline void __pci_ioport_unmap(void __iomem *p)
1028−{
1029− uintptr_t start = (uintptr_t) PCI_IOBASE;
1030− uintptr_t addr = (uintptr_t) p;
1031−
1032− if (addr >= start && addr < start + IO_SPACE_LIMIT)
1033− return;
1034− iounmap(p);
1035−}
1026+#define ARCH_HAS_GENERIC_IOPORT_MAP
10361027 #endif
10371028
10381029 #ifndef ioport_unmap
@@ -1048,21 +1039,10 @@ extern void ioport_unmap(void __iomem *p); · 9 unmodified lines
10481039 #endif /* CONFIG_HAS_IOPORT_MAP */
10491040
10501041 #ifndef CONFIG_GENERIC_IOMAP
1051−struct pci_dev;
1052−extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
1053−
1054−#ifndef __pci_ioport_unmap
1055−static inline void __pci_ioport_unmap(void __iomem *p) {}
1056−#endif
1057−
10581042 #ifndef pci_iounmap
1059−#define pci_iounmap pci_iounmap
1060−static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p)
1061−{
1062− __pci_ioport_unmap(p);
1063−}
1043+#define ARCH_WANTS_GENERIC_PCI_IOUNMAP
1044+#endif
10641045 #endif
1065−#endif /* CONFIG_GENERIC_IOMAP */
10661046
10671047 #ifndef xlate_dev_mem_ptr
10681048 #define xlate_dev_mem_ptr xlate_dev_mem_ptr
include/asm-generic/iomap.h+0−10
@@ -110,16 +110,6 @@ static inline void __iomem *ioremap_np(phys_addr_t offset, size_t size) · 109 unmodified lines
110110 }
111111 #endif
112112
113−#ifdef CONFIG_PCI
114−/* Destroy a virtual mapping cookie for a PCI BAR (memory or IO) */
115−struct pci_dev;
116−extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
117−#elif defined(CONFIG_GENERIC_IOMAP)
118−struct pci_dev;
119−static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
120−{ }
121−#endif
122−
123113 #include <asm-generic/pci_iomap.h>
124114
125115 #endif
include/asm-generic/pci_iomap.h+3−0
@@ -18,6 +18,7 @@ extern void __iomem *pci_iomap_range(struct pci_dev *dev, int bar, · 17 unmodified lines
1818 extern void __iomem *pci_iomap_wc_range(struct pci_dev *dev, int bar,
1919 unsigned long offset,
2020 unsigned long maxlen);
21+extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
2122 /* Create a virtual mapping cookie for a port on a given PCI device.
2223 * Do not call this directly, it exists to make it easier for architectures
2324 * to override */
@@ -50,6 +51,8 @@ static inline void __iomem *pci_iomap_wc_range(struct pci_dev *dev, int bar, · 26 unmodified lines
5051 {
5152 return NULL;
5253 }
54+static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
55+{ }
5356 #endif
5457
5558 #endif /* __ASM_GENERIC_PCI_IOMAP_H */
include/linux/dsa/ocelot.h+1−1
@@ -1,5 +1,5 @@
11 /* SPDX-License-Identifier: GPL-2.0
2− * Copyright 2019-2021 NXP Semiconductors
2+ * Copyright 2019-2021 NXP
33 */
44
55 #ifndef _NET_DSA_TAG_OCELOT_H
include/linux/mdio.h+3−0
@@ -80,6 +80,9 @@ struct mdio_driver { · 79 unmodified lines
8080
8181 /* Clears up any memory if needed */
8282 void (*remove)(struct mdio_device *mdiodev);
83+
84+ /* Quiesces the device on system shutdown, turns off interrupts etc */
85+ void (*shutdown)(struct mdio_device *mdiodev);
8386 };
8487
8588 static inline struct mdio_driver *
include/linux/packing.h+1−1
@@ -1,5 +1,5 @@
11 /* SPDX-License-Identifier: BSD-3-Clause
2− * Copyright (c) 2016-2018, NXP Semiconductors
2+ * Copyright 2016-2018 NXP
33 * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com>
44 */
55 #ifndef _LINUX_PACKING_H
include/linux/sched.h+1−0
@@ -1471,6 +1471,7 @@ struct task_struct { · 1470 unmodified lines
14711471 mce_whole_page : 1,
14721472 __mce_reserved : 62;
14731473 struct callback_head mce_kill_me;
1474+ int mce_count;
14741475 #endif
14751476
14761477 #ifdef CONFIG_KRETPROBES
include/linux/uio.h+16−5
@@ -27,6 +27,12 @@ enum iter_type { · 26 unmodified lines
2727 ITER_DISCARD,
2828 };
2929
30+struct iov_iter_state {
31+ size_t iov_offset;
32+ size_t count;
33+ unsigned long nr_segs;
34+};
35+
3036 struct iov_iter {
3137 u8 iter_type;
3238 bool data_source;
@@ -47,7 +53,6 @@ struct iov_iter { · 14 unmodified lines
4753 };
4854 loff_t xarray_start;
4955 };
50− size_t truncated;
5156 };
5257
5358 static inline enum iter_type iov_iter_type(const struct iov_iter *i)
@@ -55,6 +60,14 @@ static inline enum iter_type iov_iter_type(const struct iov_iter *i) · 1 unmodified line
5560 return i->iter_type;
5661 }
5762
63+static inline void iov_iter_save_state(struct iov_iter *iter,
64+ struct iov_iter_state *state)
65+{
66+ state->iov_offset = iter->iov_offset;
67+ state->count = iter->count;
68+ state->nr_segs = iter->nr_segs;
69+}
70+
5871 static inline bool iter_is_iovec(const struct iov_iter *i)
5972 {
6073 return iov_iter_type(i) == ITER_IOVEC;
@@ -233,6 +246,7 @@ ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages, · 172 unmodified lines
233246 ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, struct page ***pages,
234247 size_t maxsize, size_t *start);
235248 int iov_iter_npages(const struct iov_iter *i, int maxpages);
249+void iov_iter_restore(struct iov_iter *i, struct iov_iter_state *state);
236250
237251 const void *dup_iter(struct iov_iter *new, struct iov_iter *old, gfp_t flags);
238252
@@ -255,10 +269,8 @@ static inline void iov_iter_truncate(struct iov_iter *i, u64 count) · 16 unmodified lines
255269 * conversion in assignement is by definition greater than all
256270 * values of size_t, including old i->count.
257271 */
258− if (i->count > count) {
259− i->truncated += i->count - count;
272+ if (i->count > count)
260273 i->count = count;
261− }
262274 }
263275
264276 /*
@@ -267,7 +279,6 @@ static inline void iov_iter_truncate(struct iov_iter *i, u64 count) · 2 unmodified lines
267279 */
268280 static inline void iov_iter_reexpand(struct iov_iter *i, size_t count)
269281 {
270− i->truncated -= count - i->count;
271282 i->count = count;
272283 }
273284
include/net/dsa.h+9−0
@@ -585,8 +585,16 @@ struct dsa_switch_ops { · 584 unmodified lines
585585 int (*change_tag_protocol)(struct dsa_switch *ds, int port,
586586 enum dsa_tag_protocol proto);
587587
588+ /* Optional switch-wide initialization and destruction methods */
588589 int (*setup)(struct dsa_switch *ds);
589590 void (*teardown)(struct dsa_switch *ds);
591+
592+ /* Per-port initialization and destruction methods. Mandatory if the
593+ * driver registers devlink port regions, optional otherwise.
594+ */
595+ int (*port_setup)(struct dsa_switch *ds, int port);
596+ void (*port_teardown)(struct dsa_switch *ds, int port);
597+
590598 u32 (*get_phy_flags)(struct dsa_switch *ds, int port);
591599
592600 /*
@@ -1046,6 +1054,7 @@ static inline int dsa_ndo_eth_ioctl(struct net_device *dev, struct ifreq *ifr, · 453 unmodified lines
10461054
10471055 void dsa_unregister_switch(struct dsa_switch *ds);
10481056 int dsa_register_switch(struct dsa_switch *ds);
1057+void dsa_switch_shutdown(struct dsa_switch *ds);
10491058 struct dsa_switch *dsa_switch_find(int tree_index, int sw_index);
10501059 #ifdef CONFIG_PM_SLEEP
10511060 int dsa_switch_suspend(struct dsa_switch *ds);
include/net/sock.h+1−0
@@ -1628,6 +1628,7 @@ static inline void unlock_sock_fast(struct sock *sk, bool slow) · 1627 unmodified lines
16281628 release_sock(sk);
16291629 __release(&sk->sk_lock.slock);
16301630 } else {
1631+ mutex_release(&sk->sk_lock.dep_map, _RET_IP_);
16311632 spin_unlock_bh(&sk->sk_lock.slock);
16321633 }
16331634 }
include/trace/events/afs.h+6−2
@@ -306,11 +306,13 @@ enum afs_flock_operation { · 305 unmodified lines
306306
307307 enum afs_cb_break_reason {
308308 afs_cb_break_no_break,
309+ afs_cb_break_no_promise,
309310 afs_cb_break_for_callback,
310311 afs_cb_break_for_deleted,
311312 afs_cb_break_for_lapsed,
313+ afs_cb_break_for_s_reinit,
312314 afs_cb_break_for_unlink,
313− afs_cb_break_for_vsbreak,
315+ afs_cb_break_for_v_break,
314316 afs_cb_break_for_volume_callback,
315317 afs_cb_break_for_zap,
316318 };
@@ -602,11 +604,13 @@ enum afs_cb_break_reason { · 285 unmodified lines
602604
603605 #define afs_cb_break_reasons \
604606 EM(afs_cb_break_no_break, "no-break") \
607+ EM(afs_cb_break_no_promise, "no-promise") \
605608 EM(afs_cb_break_for_callback, "break-cb") \
606609 EM(afs_cb_break_for_deleted, "break-del") \
607610 EM(afs_cb_break_for_lapsed, "break-lapsed") \
611+ EM(afs_cb_break_for_s_reinit, "s-reinit") \
608612 EM(afs_cb_break_for_unlink, "break-unlink") \
609− EM(afs_cb_break_for_vsbreak, "break-vs") \
613+ EM(afs_cb_break_for_v_break, "break-v") \
610614 EM(afs_cb_break_for_volume_callback, "break-v-cb") \
611615 E_(afs_cb_break_for_zap, "break-zap")
612616
include/uapi/linux/cifs/cifs_mount.h+0−1
@@ -1,6 +1,5 @@
11 /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */
22 /*
3− * include/uapi/linux/cifs/cifs_mount.h
43 *
54 * Author(s): Scott Lovenberg (scott.lovenberg@gmail.com)
65 *
include/uapi/linux/io_uring.h+7−1
@@ -317,13 +317,19 @@ enum { · 316 unmodified lines
317317 IORING_REGISTER_IOWQ_AFF = 17,
318318 IORING_UNREGISTER_IOWQ_AFF = 18,
319319
320− /* set/get max number of workers */
320+ /* set/get max number of io-wq workers */
321321 IORING_REGISTER_IOWQ_MAX_WORKERS = 19,
322322
323323 /* this goes last */
324324 IORING_REGISTER_LAST
325325 };
326326
327+/* io-wq worker categories */
328+enum {
329+ IO_WQ_BOUND,
330+ IO_WQ_UNBOUND,
331+};
332+
327333 /* deprecated, see struct io_uring_rsrc_update */
328334 struct io_uring_files_update {
329335 __u32 offset;
init/main.c+3−3
@@ -1242,7 +1242,7 @@ trace_initcall_start_cb(void *data, initcall_t fn) · 1241 unmodified lines
12421242 {
12431243 ktime_t *calltime = (ktime_t *)data;
12441244
1245− printk(KERN_DEBUG "calling %pS @ %i irqs_disabled() %d\n", fn, task_pid_nr(current), irqs_disabled());
1245+ printk(KERN_DEBUG "calling %pS @ %i\n", fn, task_pid_nr(current));
12461246 *calltime = ktime_get();
12471247 }
12481248
@@ -1256,8 +1256,8 @@ trace_initcall_finish_cb(void *data, initcall_t fn, int ret) · 7 unmodified lines
12561256 rettime = ktime_get();
12571257 delta = ktime_sub(rettime, *calltime);
12581258 duration = (unsigned long long) ktime_to_ns(delta) >> 10;
1259− printk(KERN_DEBUG "initcall %pS returned %d after %lld usecs, irqs_disabled() %d\n",
1260− fn, ret, duration, irqs_disabled());
1259+ printk(KERN_DEBUG "initcall %pS returned %d after %lld usecs\n",
1260+ fn, ret, duration);
12611261 }
12621262
12631263 static ktime_t initcall_calltime;
kernel/dma/debug.c+2−1
@@ -567,7 +567,8 @@ static void add_dma_entry(struct dma_debug_entry *entry) · 566 unmodified lines
567567 pr_err("cacheline tracking ENOMEM, dma-debug disabled\n");
568568 global_disable = true;
569569 } else if (rc == -EEXIST) {
570− pr_err("cacheline tracking EEXIST, overlapping mappings aren't supported\n");
570+ err_printk(entry->dev, entry,
571+ "cacheline tracking EEXIST, overlapping mappings aren't supported\n");
571572 }
572573 }
573574
kernel/dma/mapping.c+2−1
@@ -206,7 +206,8 @@ static int __dma_map_sg_attrs(struct device *dev, struct scatterlist *sg, · 205 unmodified lines
206206 /**
207207 * dma_map_sg_attrs - Map the given buffer for DMA
208208 * @dev: The device for which to perform the DMA operation
209− * @sg: The sg_table object describing the buffer
209+ * @sg: The sg_table object describing the buffer
210+ * @nents: Number of entries to map
210211 * @dir: DMA direction
211212 * @attrs: Optional DMA attributes for the map operation
212213 *
kernel/events/core.c+1−1
@@ -10193,7 +10193,7 @@ static void perf_event_addr_filters_apply(struct perf_event *event) · 10192 unmodified lines
1019310193 return;
1019410194
1019510195 if (ifh->nr_file_filters) {
10196− mm = get_task_mm(event->ctx->task);
10196+ mm = get_task_mm(task);
1019710197 if (!mm)
1019810198 goto restart;
1019910199
kernel/locking/rwbase_rt.c+45−20
@@ -41,6 +41,12 @@ · 40 unmodified lines
4141 * The risk of writer starvation is there, but the pathological use cases
4242 * which trigger it are not necessarily the typical RT workloads.
4343 *
44+ * Fast-path orderings:
45+ * The lock/unlock of readers can run in fast paths: lock and unlock are only
46+ * atomic ops, and there is no inner lock to provide ACQUIRE and RELEASE
47+ * semantics of rwbase_rt. Atomic ops should thus provide _acquire()
48+ * and _release() (or stronger).
49+ *
4450 * Common code shared between RT rw_semaphore and rwlock
4551 */
4652
@@ -53,6 +59,7 @@ static __always_inline int rwbase_read_trylock(struct rwbase_rt *rwb) · 6 unmodified lines
5359 * set.
5460 */
5561 for (r = atomic_read(&rwb->readers); r < 0;) {
62+ /* Fully-ordered if cmpxchg() succeeds, provides ACQUIRE */
5663 if (likely(atomic_try_cmpxchg(&rwb->readers, &r, r + 1)))
5764 return 1;
5865 }
@@ -162,6 +169,8 @@ static __always_inline void rwbase_read_unlock(struct rwbase_rt *rwb, · 103 unmodified lines
162169 /*
163170 * rwb->readers can only hit 0 when a writer is waiting for the
164171 * active readers to leave the critical section.
172+ *
173+ * dec_and_test() is fully ordered, provides RELEASE.
165174 */
166175 if (unlikely(atomic_dec_and_test(&rwb->readers)))
167176 __rwbase_read_unlock(rwb, state);
@@ -172,7 +181,11 @@ static inline void __rwbase_write_unlock(struct rwbase_rt *rwb, int bias, · 4 unmodified lines
172181 {
173182 struct rt_mutex_base *rtm = &rwb->rtmutex;
174183
175− atomic_add(READER_BIAS - bias, &rwb->readers);
184+ /*
185+ * _release() is needed in case that reader is in fast path, pairing
186+ * with atomic_try_cmpxchg() in rwbase_read_trylock(), provides RELEASE
187+ */
188+ (void)atomic_add_return_release(READER_BIAS - bias, &rwb->readers);
176189 raw_spin_unlock_irqrestore(&rtm->wait_lock, flags);
177190 rwbase_rtmutex_unlock(rtm);
178191 }
@@ -196,6 +209,23 @@ static inline void rwbase_write_downgrade(struct rwbase_rt *rwb) · 17 unmodified lines
196209 __rwbase_write_unlock(rwb, WRITER_BIAS - 1, flags);
197210 }
198211
212+static inline bool __rwbase_write_trylock(struct rwbase_rt *rwb)
213+{
214+ /* Can do without CAS because we're serialized by wait_lock. */
215+ lockdep_assert_held(&rwb->rtmutex.wait_lock);
216+
217+ /*
218+ * _acquire is needed in case the reader is in the fast path, pairing
219+ * with rwbase_read_unlock(), provides ACQUIRE.
220+ */
221+ if (!atomic_read_acquire(&rwb->readers)) {
222+ atomic_set(&rwb->readers, WRITER_BIAS);
223+ return 1;
224+ }
225+
226+ return 0;
227+}
228+
199229 static int __sched rwbase_write_lock(struct rwbase_rt *rwb,
200230 unsigned int state)
201231 {
@@ -210,34 +240,30 @@ static int __sched rwbase_write_lock(struct rwbase_rt *rwb, · 8 unmodified lines
210240 atomic_sub(READER_BIAS, &rwb->readers);
211241
212242 raw_spin_lock_irqsave(&rtm->wait_lock, flags);
213− /*
214− * set_current_state() for rw_semaphore
215− * current_save_and_set_rtlock_wait_state() for rwlock
216− */
217− rwbase_set_and_save_current_state(state);
243+ if (__rwbase_write_trylock(rwb))
244+ goto out_unlock;
218245
219− /* Block until all readers have left the critical section. */
220− for (; atomic_read(&rwb->readers);) {
246+ rwbase_set_and_save_current_state(state);
247+ for (;;) {
221248 /* Optimized out for rwlocks */
222249 if (rwbase_signal_pending_state(state, current)) {
223− __set_current_state(TASK_RUNNING);
250+ rwbase_restore_current_state();
224251 __rwbase_write_unlock(rwb, 0, flags);
225252 return -EINTR;
226253 }
254+
255+ if (__rwbase_write_trylock(rwb))
256+ break;
257+
227258 raw_spin_unlock_irqrestore(&rtm->wait_lock, flags);
259+ rwbase_schedule();
260+ raw_spin_lock_irqsave(&rtm->wait_lock, flags);
228261
229− /*
230− * Schedule and wait for the readers to leave the critical
231− * section. The last reader leaving it wakes the waiter.
232− */
233− if (atomic_read(&rwb->readers) != 0)
234− rwbase_schedule();
235262 set_current_state(state);
236− raw_spin_lock_irqsave(&rtm->wait_lock, flags);
237263 }
238−
239− atomic_set(&rwb->readers, WRITER_BIAS);
240264 rwbase_restore_current_state();
265+
266+out_unlock:
241267 raw_spin_unlock_irqrestore(&rtm->wait_lock, flags);
242268 return 0;
243269 }
@@ -253,8 +279,7 @@ static inline int rwbase_write_trylock(struct rwbase_rt *rwb) · 9 unmodified lines
253279 atomic_sub(READER_BIAS, &rwb->readers);
254280
255281 raw_spin_lock_irqsave(&rtm->wait_lock, flags);
256− if (!atomic_read(&rwb->readers)) {
257− atomic_set(&rwb->readers, WRITER_BIAS);
282+ if (__rwbase_write_trylock(rwb)) {
258283 raw_spin_unlock_irqrestore(&rtm->wait_lock, flags);
259284 return 1;
260285 }
lib/iov_iter.c+36−0
@@ -1972,3 +1972,39 @@ int import_single_range(int rw, void __user *buf, size_t len, · 1971 unmodified lines
19721972 return 0;
19731973 }
19741974 EXPORT_SYMBOL(import_single_range);
1975+
1976+/**
1977+ * iov_iter_restore() - Restore a &struct iov_iter to the same state as when
1978+ * iov_iter_save_state() was called.
1979+ *
1980+ * @i: &struct iov_iter to restore
1981+ * @state: state to restore from
1982+ *
1983+ * Used after iov_iter_save_state() to bring restore @i, if operations may
1984+ * have advanced it.
1985+ *
1986+ * Note: only works on ITER_IOVEC, ITER_BVEC, and ITER_KVEC
1987+ */
1988+void iov_iter_restore(struct iov_iter *i, struct iov_iter_state *state)
1989+{
1990+ if (WARN_ON_ONCE(!iov_iter_is_bvec(i) && !iter_is_iovec(i)) &&
1991+ !iov_iter_is_kvec(i))
1992+ return;
1993+ i->iov_offset = state->iov_offset;
1994+ i->count = state->count;
1995+ /*
1996+ * For the *vec iters, nr_segs + iov is constant - if we increment
1997+ * the vec, then we also decrement the nr_segs count. Hence we don't
1998+ * need to track both of these, just one is enough and we can deduct
1999+ * the other from that. ITER_KVEC and ITER_IOVEC are the same struct
2000+ * size, so we can just increment the iov pointer as they are unionzed.
2001+ * ITER_BVEC _may_ be the same size on some archs, but on others it is
2002+ * not. Be safe and handle it separately.
2003+ */
2004+ BUILD_BUG_ON(sizeof(struct iovec) != sizeof(struct kvec));
2005+ if (iov_iter_is_bvec(i))
2006+ i->bvec -= state->nr_segs - i->nr_segs;
2007+ else
2008+ i->iov -= state->nr_segs - i->nr_segs;
2009+ i->nr_segs = state->nr_segs;
2010+}
lib/packing.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
2−/* Copyright (c) 2016-2018, NXP Semiconductors
2+/* Copyright 2016-2018 NXP
33 * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com>
44 */
55 #include <linux/packing.h>
lib/pci_iomap.c+43−0
@@ -134,4 +134,47 @@ void __iomem *pci_iomap_wc(struct pci_dev *dev, int bar, unsigned long maxlen) · 133 unmodified lines
134134 return pci_iomap_wc_range(dev, bar, 0, maxlen);
135135 }
136136 EXPORT_SYMBOL_GPL(pci_iomap_wc);
137+
138+/*
139+ * pci_iounmap() somewhat illogically comes from lib/iomap.c for the
140+ * CONFIG_GENERIC_IOMAP case, because that's the code that knows about
141+ * the different IOMAP ranges.
142+ *
143+ * But if the architecture does not use the generic iomap code, and if
144+ * it has _not_ defined it's own private pci_iounmap function, we define
145+ * it here.
146+ *
147+ * NOTE! This default implementation assumes that if the architecture
148+ * support ioport mapping (HAS_IOPORT_MAP), the ioport mapping will
149+ * be fixed to the range [ PCI_IOBASE, PCI_IOBASE+IO_SPACE_LIMIT [,
150+ * and does not need unmapping with 'ioport_unmap()'.
151+ *
152+ * If you have different rules for your architecture, you need to
153+ * implement your own pci_iounmap() that knows the rules for where
154+ * and how IO vs MEM get mapped.
155+ *
156+ * This code is odd, and the ARCH_HAS/ARCH_WANTS #define logic comes
157+ * from legacy <asm-generic/io.h> header file behavior. In particular,
158+ * it would seem to make sense to do the iounmap(p) for the non-IO-space
159+ * case here regardless, but that's not what the old header file code
160+ * did. Probably incorrectly, but this is meant to be bug-for-bug
161+ * compatible.
162+ */
163+#if defined(ARCH_WANTS_GENERIC_PCI_IOUNMAP)
164+
165+void pci_iounmap(struct pci_dev *dev, void __iomem *p)
166+{
167+#ifdef ARCH_HAS_GENERIC_IOPORT_MAP
168+ uintptr_t start = (uintptr_t) PCI_IOBASE;
169+ uintptr_t addr = (uintptr_t) p;
170+
171+ if (addr >= start && addr < start + IO_SPACE_LIMIT)
172+ return;
173+ iounmap(p);
174+#endif
175+}
176+EXPORT_SYMBOL(pci_iounmap);
177+
178+#endif /* ARCH_WANTS_GENERIC_PCI_IOUNMAP */
179+
137180 #endif /* CONFIG_PCI */
mm/memcontrol.c+0−10
@@ -106,9 +106,6 @@ static bool do_memsw_account(void) · 105 unmodified lines
106106 /* memcg and lruvec stats flushing */
107107 static void flush_memcg_stats_dwork(struct work_struct *w);
108108 static DECLARE_DEFERRABLE_WORK(stats_flush_dwork, flush_memcg_stats_dwork);
109−static void flush_memcg_stats_work(struct work_struct *w);
110−static DECLARE_WORK(stats_flush_work, flush_memcg_stats_work);
111−static DEFINE_PER_CPU(unsigned int, stats_flush_threshold);
112109 static DEFINE_SPINLOCK(stats_flush_lock);
113110
114111 #define THRESHOLDS_EVENTS_TARGET 128
@@ -682,8 +679,6 @@ void __mod_memcg_lruvec_state(struct lruvec *lruvec, enum node_stat_item idx, · 567 unmodified lines
682679
683680 /* Update lruvec */
684681 __this_cpu_add(pn->lruvec_stats_percpu->state[idx], val);
685− if (!(__this_cpu_inc_return(stats_flush_threshold) % MEMCG_CHARGE_BATCH))
686− queue_work(system_unbound_wq, &stats_flush_work);
687682 }
688683
689684 /**
@@ -5361,11 +5356,6 @@ static void flush_memcg_stats_dwork(struct work_struct *w) · 4671 unmodified lines
53615356 queue_delayed_work(system_unbound_wq, &stats_flush_dwork, 2UL*HZ);
53625357 }
53635358
5364−static void flush_memcg_stats_work(struct work_struct *w)
5365−{
5366− mem_cgroup_flush_stats();
5367−}
5368−
53695359 static void mem_cgroup_css_rstat_flush(struct cgroup_subsys_state *css, int cpu)
53705360 {
53715361 struct mem_cgroup *memcg = mem_cgroup_from_css(css);
mm/memory.c+1−0
@@ -3403,6 +3403,7 @@ void unmap_mapping_pages(struct address_space *mapping, pgoff_t start, · 3402 unmodified lines
34033403 unmap_mapping_range_tree(&mapping->i_mmap, &details);
34043404 i_mmap_unlock_write(mapping);
34053405 }
3406+EXPORT_SYMBOL_GPL(unmap_mapping_pages);
34063407
34073408 /**
34083409 * unmap_mapping_range - unmap the portion of all mmaps in the specified
mm/workingset.c+1−0
@@ -352,6 +352,7 @@ void workingset_refault(struct page *page, void *shadow) · 351 unmodified lines
352352
353353 inc_lruvec_state(lruvec, WORKINGSET_REFAULT_BASE + file);
354354
355+ mem_cgroup_flush_stats();
355356 /*
356357 * Compare the distance to the existing workingset size. We
357358 * don't activate pages that couldn't stay resident even if
net/core/dev.c+10−6
@@ -6925,12 +6925,16 @@ EXPORT_SYMBOL(napi_disable); · 6924 unmodified lines
69256925 */
69266926 void napi_enable(struct napi_struct *n)
69276927 {
6928− BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state));
6929− smp_mb__before_atomic();
6930− clear_bit(NAPI_STATE_SCHED, &n->state);
6931− clear_bit(NAPI_STATE_NPSVC, &n->state);
6932− if (n->dev->threaded && n->thread)
6933− set_bit(NAPI_STATE_THREADED, &n->state);
6928+ unsigned long val, new;
6929+
6930+ do {
6931+ val = READ_ONCE(n->state);
6932+ BUG_ON(!test_bit(NAPI_STATE_SCHED, &val));
6933+
6934+ new = val & ~(NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC);
6935+ if (n->dev->threaded && n->thread)
6936+ new |= NAPIF_STATE_THREADED;
6937+ } while (cmpxchg(&n->state, val, new) != val);
69346938 }
69356939 EXPORT_SYMBOL(napi_enable);
69366940
net/core/sock.c+23−14
@@ -3179,17 +3179,15 @@ EXPORT_SYMBOL(sock_init_data); · 3178 unmodified lines
31793179
31803180 void lock_sock_nested(struct sock *sk, int subclass)
31813181 {
3182+ /* The sk_lock has mutex_lock() semantics here. */
3183+ mutex_acquire(&sk->sk_lock.dep_map, subclass, 0, _RET_IP_);
3184+
31823185 might_sleep();
31833186 spin_lock_bh(&sk->sk_lock.slock);
31843187 if (sk->sk_lock.owned)
31853188 __lock_sock(sk);
31863189 sk->sk_lock.owned = 1;
3187− spin_unlock(&sk->sk_lock.slock);
3188− /*
3189− * The sk_lock has mutex_lock() semantics here:
3190− */
3191− mutex_acquire(&sk->sk_lock.dep_map, subclass, 0, _RET_IP_);
3192− local_bh_enable();
3190+ spin_unlock_bh(&sk->sk_lock.slock);
31933191 }
31943192 EXPORT_SYMBOL(lock_sock_nested);
31953193
@@ -3227,24 +3225,35 @@ EXPORT_SYMBOL(release_sock); · 31 unmodified lines
32273225 */
32283226 bool lock_sock_fast(struct sock *sk) __acquires(&sk->sk_lock.slock)
32293227 {
3228+ /* The sk_lock has mutex_lock() semantics here. */
3229+ mutex_acquire(&sk->sk_lock.dep_map, 0, 0, _RET_IP_);
3230+
32303231 might_sleep();
32313232 spin_lock_bh(&sk->sk_lock.slock);
32323233
3233− if (!sk->sk_lock.owned)
3234+ if (!sk->sk_lock.owned) {
32343235 /*
3235− * Note : We must disable BH
3236+ * Fast path return with bottom halves disabled and
3237+ * sock::sk_lock.slock held.
3238+ *
3239+ * The 'mutex' is not contended and holding
3240+ * sock::sk_lock.slock prevents all other lockers to
3241+ * proceed so the corresponding unlock_sock_fast() can
3242+ * avoid the slow path of release_sock() completely and
3243+ * just release slock.
3244+ *
3245+ * From a semantical POV this is equivalent to 'acquiring'
3246+ * the 'mutex', hence the corresponding lockdep
3247+ * mutex_release() has to happen in the fast path of
3248+ * unlock_sock_fast().
32363249 */
32373250 return false;
3251+ }
32383252
32393253 __lock_sock(sk);
32403254 sk->sk_lock.owned = 1;
3241− spin_unlock(&sk->sk_lock.slock);
3242− /*
3243− * The sk_lock has mutex_lock() semantics here:
3244− */
3245− mutex_acquire(&sk->sk_lock.dep_map, 0, 0, _RET_IP_);
32463255 __acquire(&sk->sk_lock.slock);
3247− local_bh_enable();
3256+ spin_unlock_bh(&sk->sk_lock.slock);
32483257 return true;
32493258 }
32503259 EXPORT_SYMBOL(lock_sock_fast);
net/dsa/dsa2.c+106−8
@@ -429,6 +429,7 @@ static int dsa_port_setup(struct dsa_port *dp) · 428 unmodified lines
429429 {
430430 struct devlink_port *dlp = &dp->devlink_port;
431431 bool dsa_port_link_registered = false;
432+ struct dsa_switch *ds = dp->ds;
432433 bool dsa_port_enabled = false;
433434 int err = 0;
434435
@@ -438,6 +439,12 @@ static int dsa_port_setup(struct dsa_port *dp) · 3 unmodified lines
438439 INIT_LIST_HEAD(&dp->fdbs);
439440 INIT_LIST_HEAD(&dp->mdbs);
440441
442+ if (ds->ops->port_setup) {
443+ err = ds->ops->port_setup(ds, dp->index);
444+ if (err)
445+ return err;
446+ }
447+
441448 switch (dp->type) {
442449 case DSA_PORT_TYPE_UNUSED:
443450 dsa_port_disable(dp);
@@ -480,8 +487,11 @@ static int dsa_port_setup(struct dsa_port *dp) · 36 unmodified lines
480487 dsa_port_disable(dp);
481488 if (err && dsa_port_link_registered)
482489 dsa_port_link_unregister_of(dp);
483− if (err)
490+ if (err) {
491+ if (ds->ops->port_teardown)
492+ ds->ops->port_teardown(ds, dp->index);
484493 return err;
494+ }
485495
486496 dp->setup = true;
487497
@@ -533,11 +543,15 @@ static int dsa_port_devlink_setup(struct dsa_port *dp) · 45 unmodified lines
533543 static void dsa_port_teardown(struct dsa_port *dp)
534544 {
535545 struct devlink_port *dlp = &dp->devlink_port;
546+ struct dsa_switch *ds = dp->ds;
536547 struct dsa_mac_addr *a, *tmp;
537548
538549 if (!dp->setup)
539550 return;
540551
552+ if (ds->ops->port_teardown)
553+ ds->ops->port_teardown(ds, dp->index);
554+
541555 devlink_port_type_clear(dlp);
542556
543557 switch (dp->type) {
@@ -581,6 +595,36 @@ static void dsa_port_devlink_teardown(struct dsa_port *dp) · 37 unmodified lines
581595 dp->devlink_port_setup = false;
582596 }
583597
598+/* Destroy the current devlink port, and create a new one which has the UNUSED
599+ * flavour. At this point, any call to ds->ops->port_setup has been already
600+ * balanced out by a call to ds->ops->port_teardown, so we know that any
601+ * devlink port regions the driver had are now unregistered. We then call its
602+ * ds->ops->port_setup again, in order for the driver to re-create them on the
603+ * new devlink port.
604+ */
605+static int dsa_port_reinit_as_unused(struct dsa_port *dp)
606+{
607+ struct dsa_switch *ds = dp->ds;
608+ int err;
609+
610+ dsa_port_devlink_teardown(dp);
611+ dp->type = DSA_PORT_TYPE_UNUSED;
612+ err = dsa_port_devlink_setup(dp);
613+ if (err)
614+ return err;
615+
616+ if (ds->ops->port_setup) {
617+ /* On error, leave the devlink port registered,
618+ * dsa_switch_teardown will clean it up later.
619+ */
620+ err = ds->ops->port_setup(ds, dp->index);
621+ if (err)
622+ return err;
623+ }
624+
625+ return 0;
626+}
627+
584628 static int dsa_devlink_info_get(struct devlink *dl,
585629 struct devlink_info_req *req,
586630 struct netlink_ext_ack *extack)
@@ -833,7 +877,7 @@ static int dsa_switch_setup(struct dsa_switch *ds) · 246 unmodified lines
833877 devlink_params_publish(ds->devlink);
834878
835879 if (!ds->slave_mii_bus && ds->ops->phy_read) {
836− ds->slave_mii_bus = devm_mdiobus_alloc(ds->dev);
880+ ds->slave_mii_bus = mdiobus_alloc();
837881 if (!ds->slave_mii_bus) {
838882 err = -ENOMEM;
839883 goto teardown;
@@ -843,13 +887,16 @@ static int dsa_switch_setup(struct dsa_switch *ds) · 3 unmodified lines
843887
844888 err = mdiobus_register(ds->slave_mii_bus);
845889 if (err < 0)
846− goto teardown;
890+ goto free_slave_mii_bus;
847891 }
848892
849893 ds->setup = true;
850894
851895 return 0;
852896
897+free_slave_mii_bus:
898+ if (ds->slave_mii_bus && ds->ops->phy_read)
899+ mdiobus_free(ds->slave_mii_bus);
853900 teardown:
854901 if (ds->ops->teardown)
855902 ds->ops->teardown(ds);
@@ -872,8 +919,11 @@ static void dsa_switch_teardown(struct dsa_switch *ds) · 16 unmodified lines
872919 if (!ds->setup)
873920 return;
874921
875− if (ds->slave_mii_bus && ds->ops->phy_read)
922+ if (ds->slave_mii_bus && ds->ops->phy_read) {
876923 mdiobus_unregister(ds->slave_mii_bus);
924+ mdiobus_free(ds->slave_mii_bus);
925+ ds->slave_mii_bus = NULL;
926+ }
877927
878928 dsa_switch_unregister_notifier(ds);
879929
@@ -933,12 +983,9 @@ static int dsa_tree_setup_switches(struct dsa_switch_tree *dst) · 53 unmodified lines
933983 list_for_each_entry(dp, &dst->ports, list) {
934984 err = dsa_port_setup(dp);
935985 if (err) {
936− dsa_port_devlink_teardown(dp);
937− dp->type = DSA_PORT_TYPE_UNUSED;
938− err = dsa_port_devlink_setup(dp);
986+ err = dsa_port_reinit_as_unused(dp);
939987 if (err)
940988 goto teardown;
941− continue;
942989 }
943990 }
944991
@@ -1043,6 +1090,7 @@ static int dsa_tree_setup(struct dsa_switch_tree *dst) · 98 unmodified lines
10431090 teardown_master:
10441091 dsa_tree_teardown_master(dst);
10451092 teardown_switches:
1093+ dsa_tree_teardown_ports(dst);
10461094 dsa_tree_teardown_switches(dst);
10471095 teardown_cpu_ports:
10481096 dsa_tree_teardown_cpu_ports(dst);
@@ -1557,3 +1605,53 @@ void dsa_unregister_switch(struct dsa_switch *ds) · 508 unmodified lines
15571605 mutex_unlock(&dsa2_mutex);
15581606 }
15591607 EXPORT_SYMBOL_GPL(dsa_unregister_switch);
1608+
1609+/* If the DSA master chooses to unregister its net_device on .shutdown, DSA is
1610+ * blocking that operation from completion, due to the dev_hold taken inside
1611+ * netdev_upper_dev_link. Unlink the DSA slave interfaces from being uppers of
1612+ * the DSA master, so that the system can reboot successfully.
1613+ */
1614+void dsa_switch_shutdown(struct dsa_switch *ds)
1615+{
1616+ struct net_device *master, *slave_dev;
1617+ LIST_HEAD(unregister_list);
1618+ struct dsa_port *dp;
1619+
1620+ mutex_lock(&dsa2_mutex);
1621+ rtnl_lock();
1622+
1623+ list_for_each_entry(dp, &ds->dst->ports, list) {
1624+ if (dp->ds != ds)
1625+ continue;
1626+
1627+ if (!dsa_port_is_user(dp))
1628+ continue;
1629+
1630+ master = dp->cpu_dp->master;
1631+ slave_dev = dp->slave;
1632+
1633+ netdev_upper_dev_unlink(master, slave_dev);
1634+ /* Just unlinking ourselves as uppers of the master is not
1635+ * sufficient. When the master net device unregisters, that will
1636+ * also call dev_close, which we will catch as NETDEV_GOING_DOWN
1637+ * and trigger a dev_close on our own devices (dsa_slave_close).
1638+ * In turn, that will call dev_mc_unsync on the master's net
1639+ * device. If the master is also a DSA switch port, this will
1640+ * trigger dsa_slave_set_rx_mode which will call dev_mc_sync on
1641+ * its own master. Lockdep will complain about the fact that
1642+ * all cascaded masters have the same dsa_master_addr_list_lock_key,
1643+ * which it normally would not do if the cascaded masters would
1644+ * be in a proper upper/lower relationship, which we've just
1645+ * destroyed.
1646+ * To suppress the lockdep warnings, let's actually unregister
1647+ * the DSA slave interfaces too, to avoid the nonsensical
1648+ * multicast address list synchronization on shutdown.
1649+ */
1650+ unregister_netdevice_queue(slave_dev, &unregister_list);
1651+ }
1652+ unregister_netdevice_many(&unregister_list);
1653+
1654+ rtnl_unlock();
1655+ mutex_unlock(&dsa2_mutex);
1656+}
1657+EXPORT_SYMBOL_GPL(dsa_switch_shutdown);
net/dsa/tag_ocelot.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: GPL-2.0
2−/* Copyright 2019 NXP Semiconductors
2+/* Copyright 2019 NXP
33 */
44 #include <linux/dsa/ocelot.h>
55 #include <soc/mscc/ocelot.h>
net/dsa/tag_ocelot_8021q.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: GPL-2.0
2−/* Copyright 2020-2021 NXP Semiconductors
2+/* Copyright 2020-2021 NXP
33 *
44 * An implementation of the software-defined tag_8021q.c tagger format, which
55 * also preserves full functionality under a vlan_filtering bridge. It does
net/ipv4/nexthop.c+16−5
@@ -1982,6 +1982,8 @@ static int replace_nexthop_grp(struct net *net, struct nexthop *old, · 1981 unmodified lines
19821982 rcu_assign_pointer(old->nh_grp, newg);
19831983
19841984 if (newg->resilient) {
1985+ /* Make sure concurrent readers are not using 'oldg' anymore. */
1986+ synchronize_net();
19851987 rcu_assign_pointer(oldg->res_table, tmp_table);
19861988 rcu_assign_pointer(oldg->spare->res_table, tmp_table);
19871989 }
@@ -3565,6 +3567,7 @@ static struct notifier_block nh_netdev_notifier = { · 1577 unmodified lines
35653567 };
35663568
35673569 static int nexthops_dump(struct net *net, struct notifier_block *nb,
3570+ enum nexthop_event_type event_type,
35683571 struct netlink_ext_ack *extack)
35693572 {
35703573 struct rb_root *root = &net->nexthop.rb_root;
@@ -3575,8 +3578,7 @@ static int nexthops_dump(struct net *net, struct notifier_block *nb, · 4 unmodified lines
35753578 struct nexthop *nh;
35763579
35773580 nh = rb_entry(node, struct nexthop, rb_node);
3578− err = call_nexthop_notifier(nb, net, NEXTHOP_EVENT_REPLACE, nh,
3579− extack);
3581+ err = call_nexthop_notifier(nb, net, event_type, nh, extack);
35803582 if (err)
35813583 break;
35823584 }
@@ -3590,7 +3592,7 @@ int register_nexthop_notifier(struct net *net, struct notifier_block *nb, · 7 unmodified lines
35903592 int err;
35913593
35923594 rtnl_lock();
3593− err = nexthops_dump(net, nb, extack);
3595+ err = nexthops_dump(net, nb, NEXTHOP_EVENT_REPLACE, extack);
35943596 if (err)
35953597 goto unlock;
35963598 err = blocking_notifier_chain_register(&net->nexthop.notifier_chain,
@@ -3603,8 +3605,17 @@ EXPORT_SYMBOL(register_nexthop_notifier); · 6 unmodified lines
36033605
36043606 int unregister_nexthop_notifier(struct net *net, struct notifier_block *nb)
36053607 {
3606− return blocking_notifier_chain_unregister(&net->nexthop.notifier_chain,
3607− nb);
3608+ int err;
3609+
3610+ rtnl_lock();
3611+ err = blocking_notifier_chain_unregister(&net->nexthop.notifier_chain,
3612+ nb);
3613+ if (err)
3614+ goto unlock;
3615+ nexthops_dump(net, nb, NEXTHOP_EVENT_DEL, NULL);
3616+unlock:
3617+ rtnl_unlock();
3618+ return err;
36083619 }
36093620 EXPORT_SYMBOL(unregister_nexthop_notifier);
36103621
net/smc/smc_clc.c+2−1
@@ -510,7 +510,8 @@ static int smc_clc_prfx_set(struct socket *clcsock, · 509 unmodified lines
510510 goto out_rel;
511511 }
512512 /* get address to which the internal TCP socket is bound */
513− kernel_getsockname(clcsock, (struct sockaddr *)&addrs);
513+ if (kernel_getsockname(clcsock, (struct sockaddr *)&addrs) < 0)
514+ goto out_rel;
514515 /* analyze IP specific data of net_device belonging to TCP socket */
515516 addr6 = (struct sockaddr_in6 *)&addrs;
516517 rcu_read_lock();
net/smc/smc_core.c+2−0
@@ -1468,7 +1468,9 @@ static void smc_conn_abort_work(struct work_struct *work) · 1467 unmodified lines
14681468 abort_work);
14691469 struct smc_sock *smc = container_of(conn, struct smc_sock, conn);
14701470
1471+ lock_sock(&smc->sk);
14711472 smc_conn_kill(conn, true);
1473+ release_sock(&smc->sk);
14721474 sock_put(&smc->sk); /* sock_hold done by schedulers of abort_work */
14731475 }
14741476
scripts/Makefile.clang+5−0
@@ -29,7 +29,12 @@ CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE)) · 28 unmodified lines
2929 else
3030 CLANG_FLAGS += -fintegrated-as
3131 endif
32+# By default, clang only warns when it encounters an unknown warning flag or
33+# certain optimization flags it knows it has not implemented.
34+# Make it behave more like gcc by erroring when these flags are encountered
35+# so they can be implemented or wrapped in cc-option.
3236 CLANG_FLAGS += -Werror=unknown-warning-option
37+CLANG_FLAGS += -Werror=ignored-optimization-argument
3338 KBUILD_CFLAGS += $(CLANG_FLAGS)
3439 KBUILD_AFLAGS += $(CLANG_FLAGS)
3540 export CLANG_FLAGS
scripts/Makefile.modpost+1−1
@@ -13,7 +13,7 @@ · 12 unmodified lines
1313 # Stage 2 is handled by this file and does the following
1414 # 1) Find all modules listed in modules.order
1515 # 2) modpost is then used to
16−# 3) create one <module>.mod.c file pr. module
16+# 3) create one <module>.mod.c file per module
1717 # 4) create one Module.symvers file with CRC for all exported symbols
1818
1919 # Step 3 is used to place certain information in the module's ELF
scripts/checkkconfigsymbols.py+3−8
@@ -34,7 +34,6 @@ REGEX_SOURCE_SYMBOL = re.compile(SOURCE_SYMBOL) · 33 unmodified lines
3434 REGEX_KCONFIG_DEF = re.compile(DEF)
3535 REGEX_KCONFIG_EXPR = re.compile(EXPR)
3636 REGEX_KCONFIG_STMT = re.compile(STMT)
37−REGEX_KCONFIG_HELP = re.compile(r"^\s+help\s*$")
3837 REGEX_FILTER_SYMBOLS = re.compile(r"[A-Za-z0-9]$")
3938 REGEX_NUMERIC = re.compile(r"0[xX][0-9a-fA-F]+|[0-9]+")
4039 REGEX_QUOTES = re.compile("(\"(.*?)\")")
@@ -102,6 +101,9 @@ def parse_options(): · 61 unmodified lines
102101 "continue.")
103102
104103 if args.commit:
104+ if args.commit.startswith('HEAD'):
105+ sys.exit("The --commit option can't use the HEAD ref")
106+
105107 args.find = False
106108
107109 if args.ignore:
@@ -432,7 +434,6 @@ def parse_kconfig_file(kfile): · 324 unmodified lines
432434 lines = []
433435 defined = []
434436 references = []
435− skip = False
436437
437438 if not os.path.exists(kfile):
438439 return defined, references
@@ -448,12 +449,6 @@ def parse_kconfig_file(kfile): · 9 unmodified lines
448449 if REGEX_KCONFIG_DEF.match(line):
449450 symbol_def = REGEX_KCONFIG_DEF.findall(line)
450451 defined.append(symbol_def[0])
451− skip = False
452− elif REGEX_KCONFIG_HELP.match(line):
453− skip = True
454− elif skip:
455− # ignore content of help messages
456− pass
457452 elif REGEX_KCONFIG_STMT.match(line):
458453 line = REGEX_QUOTES.sub("", line)
459454 symbols = get_symbols_in_line(line)
scripts/clang-tools/gen_compile_commands.py+1−0
@@ -13,6 +13,7 @@ import logging · 12 unmodified lines
1313 import os
1414 import re
1515 import subprocess
16+import sys
1617
1718 _DEFAULT_OUTPUT = 'compile_commands.json'
1819 _DEFAULT_LOG_LEVEL = 'WARNING'
tools/lib/perf/evsel.c+41−23
@@ -43,7 +43,7 @@ void perf_evsel__delete(struct perf_evsel *evsel) · 42 unmodified lines
4343 free(evsel);
4444 }
4545
46−#define FD(e, x, y) (*(int *) xyarray__entry(e->fd, x, y))
46+#define FD(e, x, y) ((int *) xyarray__entry(e->fd, x, y))
4747 #define MMAP(e, x, y) (e->mmap ? ((struct perf_mmap *) xyarray__entry(e->mmap, x, y)) : NULL)
4848
4949 int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads)
@@ -54,7 +54,10 @@ int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads) · 4 unmodified lines
5454 int cpu, thread;
5555 for (cpu = 0; cpu < ncpus; cpu++) {
5656 for (thread = 0; thread < nthreads; thread++) {
57− FD(evsel, cpu, thread) = -1;
57+ int *fd = FD(evsel, cpu, thread);
58+
59+ if (fd)
60+ *fd = -1;
5861 }
5962 }
6063 }
@@ -80,7 +83,7 @@ sys_perf_event_open(struct perf_event_attr *attr, · 19 unmodified lines
8083 static int get_group_fd(struct perf_evsel *evsel, int cpu, int thread, int *group_fd)
8184 {
8285 struct perf_evsel *leader = evsel->leader;
83− int fd;
86+ int *fd;
8487
8588 if (evsel == leader) {
8689 *group_fd = -1;
@@ -95,10 +98,10 @@ static int get_group_fd(struct perf_evsel *evsel, int cpu, int thread, int *grou · 8 unmodified lines
9598 return -ENOTCONN;
9699
97100 fd = FD(leader, cpu, thread);
98− if (fd == -1)
101+ if (fd == NULL || *fd == -1)
99102 return -EBADF;
100103
101− *group_fd = fd;
104+ *group_fd = *fd;
102105
103106 return 0;
104107 }
@@ -138,7 +141,11 @@ int perf_evsel__open(struct perf_evsel *evsel, struct perf_cpu_map *cpus, · 33 unmodified lines
138141
139142 for (cpu = 0; cpu < cpus->nr; cpu++) {
140143 for (thread = 0; thread < threads->nr; thread++) {
141− int fd, group_fd;
144+ int fd, group_fd, *evsel_fd;
145+
146+ evsel_fd = FD(evsel, cpu, thread);
147+ if (evsel_fd == NULL)
148+ return -EINVAL;
142149
143150 err = get_group_fd(evsel, cpu, thread, &group_fd);
144151 if (err < 0)
@@ -151,7 +158,7 @@ int perf_evsel__open(struct perf_evsel *evsel, struct perf_cpu_map *cpus, · 6 unmodified lines
151158 if (fd < 0)
152159 return -errno;
153160
154− FD(evsel, cpu, thread) = fd;
161+ *evsel_fd = fd;
155162 }
156163 }
157164
@@ -163,9 +170,12 @@ static void perf_evsel__close_fd_cpu(struct perf_evsel *evsel, int cpu) · 5 unmodified lines
163170 int thread;
164171
165172 for (thread = 0; thread < xyarray__max_y(evsel->fd); ++thread) {
166− if (FD(evsel, cpu, thread) >= 0)
167− close(FD(evsel, cpu, thread));
168− FD(evsel, cpu, thread) = -1;
173+ int *fd = FD(evsel, cpu, thread);
174+
175+ if (fd && *fd >= 0) {
176+ close(*fd);
177+ *fd = -1;
178+ }
169179 }
170180 }
171181
@@ -209,13 +219,12 @@ void perf_evsel__munmap(struct perf_evsel *evsel) · 37 unmodified lines
209219
210220 for (cpu = 0; cpu < xyarray__max_x(evsel->fd); cpu++) {
211221 for (thread = 0; thread < xyarray__max_y(evsel->fd); thread++) {
212− int fd = FD(evsel, cpu, thread);
213− struct perf_mmap *map = MMAP(evsel, cpu, thread);
222+ int *fd = FD(evsel, cpu, thread);
214223
215− if (fd < 0)
224+ if (fd == NULL || *fd < 0)
216225 continue;
217226
218− perf_mmap__munmap(map);
227+ perf_mmap__munmap(MMAP(evsel, cpu, thread));
219228 }
220229 }
221230
@@ -239,15 +248,16 @@ int perf_evsel__mmap(struct perf_evsel *evsel, int pages) · 17 unmodified lines
239248
240249 for (cpu = 0; cpu < xyarray__max_x(evsel->fd); cpu++) {
241250 for (thread = 0; thread < xyarray__max_y(evsel->fd); thread++) {
242− int fd = FD(evsel, cpu, thread);
243− struct perf_mmap *map = MMAP(evsel, cpu, thread);
251+ int *fd = FD(evsel, cpu, thread);
252+ struct perf_mmap *map;
244253
245− if (fd < 0)
254+ if (fd == NULL || *fd < 0)
246255 continue;
247256
257+ map = MMAP(evsel, cpu, thread);
248258 perf_mmap__init(map, NULL, false, NULL);
249259
250− ret = perf_mmap__mmap(map, &mp, fd, cpu);
260+ ret = perf_mmap__mmap(map, &mp, *fd, cpu);
251261 if (ret) {
252262 perf_evsel__munmap(evsel);
253263 return ret;
@@ -260,7 +270,9 @@ int perf_evsel__mmap(struct perf_evsel *evsel, int pages) · 6 unmodified lines
260270
261271 void *perf_evsel__mmap_base(struct perf_evsel *evsel, int cpu, int thread)
262272 {
263− if (FD(evsel, cpu, thread) < 0 || MMAP(evsel, cpu, thread) == NULL)
273+ int *fd = FD(evsel, cpu, thread);
274+
275+ if (fd == NULL || *fd < 0 || MMAP(evsel, cpu, thread) == NULL)
264276 return NULL;
265277
266278 return MMAP(evsel, cpu, thread)->base;
@@ -295,17 +307,18 @@ int perf_evsel__read(struct perf_evsel *evsel, int cpu, int thread, · 28 unmodified lines
295307 struct perf_counts_values *count)
296308 {
297309 size_t size = perf_evsel__read_size(evsel);
310+ int *fd = FD(evsel, cpu, thread);
298311
299312 memset(count, 0, sizeof(*count));
300313
301− if (FD(evsel, cpu, thread) < 0)
314+ if (fd == NULL || *fd < 0)
302315 return -EINVAL;
303316
304317 if (MMAP(evsel, cpu, thread) &&
305318 !perf_mmap__read_self(MMAP(evsel, cpu, thread), count))
306319 return 0;
307320
308− if (readn(FD(evsel, cpu, thread), count->values, size) <= 0)
321+ if (readn(*fd, count->values, size) <= 0)
309322 return -errno;
310323
311324 return 0;
@@ -318,8 +331,13 @@ static int perf_evsel__run_ioctl(struct perf_evsel *evsel, · 6 unmodified lines
318331 int thread;
319332
320333 for (thread = 0; thread < xyarray__max_y(evsel->fd); thread++) {
321− int fd = FD(evsel, cpu, thread),
322− err = ioctl(fd, ioc, arg);
334+ int err;
335+ int *fd = FD(evsel, cpu, thread);
336+
337+ if (fd == NULL || *fd < 0)
338+ return -1;
339+
340+ err = ioctl(*fd, ioc, arg);
323341
324342 if (err)
325343 return err;
tools/perf/builtin-script.c+13−11
@@ -368,16 +368,6 @@ static inline int output_type(unsigned int type) · 367 unmodified lines
368368 return OUTPUT_TYPE_OTHER;
369369 }
370370
371−static inline unsigned int attr_type(unsigned int type)
372−{
373− switch (type) {
374− case OUTPUT_TYPE_SYNTH:
375− return PERF_TYPE_SYNTH;
376− default:
377− return type;
378− }
379−}
380−
381371 static bool output_set_by_user(void)
382372 {
383373 int j;
@@ -556,6 +546,18 @@ static void set_print_ip_opts(struct perf_event_attr *attr) · 172 unmodified lines
556546 output[type].print_ip_opts |= EVSEL__PRINT_SRCLINE;
557547 }
558548
549+static struct evsel *find_first_output_type(struct evlist *evlist,
550+ unsigned int type)
551+{
552+ struct evsel *evsel;
553+
554+ evlist__for_each_entry(evlist, evsel) {
555+ if (output_type(evsel->core.attr.type) == (int)type)
556+ return evsel;
557+ }
558+ return NULL;
559+}
560+
559561 /*
560562 * verify all user requested events exist and the samples
561563 * have the expected data
@@ -567,7 +569,7 @@ static int perf_session__check_output_opt(struct perf_session *session) · 5 unmodified lines
567569 struct evsel *evsel;
568570
569571 for (j = 0; j < OUTPUT_TYPE_MAX; ++j) {
570− evsel = perf_session__find_first_evtype(session, attr_type(j));
572+ evsel = find_first_output_type(session->evlist, j);
571573
572574 /*
573575 * even if fields is set to 0 (ie., show nothing) event must
tools/perf/ui/browser.c+24−9
@@ -757,25 +757,40 @@ void __ui_browser__line_arrow(struct ui_browser *browser, unsigned int column, · 756 unmodified lines
757757 }
758758
759759 void ui_browser__mark_fused(struct ui_browser *browser, unsigned int column,
760− unsigned int row, bool arrow_down)
760+ unsigned int row, int diff, bool arrow_down)
761761 {
762− unsigned int end_row;
762+ int end_row;
763763
764− if (row >= browser->top_idx)
765− end_row = row - browser->top_idx;
766− else
764+ if (diff <= 0)
767765 return;
768766
769767 SLsmg_set_char_set(1);
770768
771769 if (arrow_down) {
770+ if (row + diff <= browser->top_idx)
771+ return;
772+
773+ end_row = row + diff - browser->top_idx;
772774 ui_browser__gotorc(browser, end_row, column - 1);
773− SLsmg_write_char(SLSMG_ULCORN_CHAR);
774− ui_browser__gotorc(browser, end_row, column);
775− SLsmg_draw_hline(2);
776− ui_browser__gotorc(browser, end_row + 1, column - 1);
777775 SLsmg_write_char(SLSMG_LTEE_CHAR);
776+
777+ while (--end_row >= 0 && end_row > (int)(row - browser->top_idx)) {
778+ ui_browser__gotorc(browser, end_row, column - 1);
779+ SLsmg_draw_vline(1);
780+ }
781+
782+ end_row = (int)(row - browser->top_idx);
783+ if (end_row >= 0) {
784+ ui_browser__gotorc(browser, end_row, column - 1);
785+ SLsmg_write_char(SLSMG_ULCORN_CHAR);
786+ ui_browser__gotorc(browser, end_row, column);
787+ SLsmg_draw_hline(2);
788+ }
778789 } else {
790+ if (row < browser->top_idx)
791+ return;
792+
793+ end_row = row - browser->top_idx;
779794 ui_browser__gotorc(browser, end_row, column - 1);
780795 SLsmg_write_char(SLSMG_LTEE_CHAR);
781796 ui_browser__gotorc(browser, end_row, column);
tools/perf/ui/browser.h+1−1
@@ -51,7 +51,7 @@ void ui_browser__write_graph(struct ui_browser *browser, int graph); · 50 unmodified lines
5151 void __ui_browser__line_arrow(struct ui_browser *browser, unsigned int column,
5252 u64 start, u64 end);
5353 void ui_browser__mark_fused(struct ui_browser *browser, unsigned int column,
54− unsigned int row, bool arrow_down);
54+ unsigned int row, int diff, bool arrow_down);
5555 void __ui_browser__show_title(struct ui_browser *browser, const char *title);
5656 void ui_browser__show_title(struct ui_browser *browser, const char *title);
5757 int ui_browser__show(struct ui_browser *browser, const char *title,
tools/perf/ui/browsers/annotate.c+17−7
@@ -125,13 +125,20 @@ static void annotate_browser__write(struct ui_browser *browser, void *entry, int · 124 unmodified lines
125125 ab->selection = al;
126126 }
127127
128−static bool is_fused(struct annotate_browser *ab, struct disasm_line *cursor)
128+static int is_fused(struct annotate_browser *ab, struct disasm_line *cursor)
129129 {
130130 struct disasm_line *pos = list_prev_entry(cursor, al.node);
131131 const char *name;
132+ int diff = 1;
133+
134+ while (pos && pos->al.offset == -1) {
135+ pos = list_prev_entry(pos, al.node);
136+ if (!ab->opts->hide_src_code)
137+ diff++;
138+ }
132139
133140 if (!pos)
134− return false;
141+ return 0;
135142
136143 if (ins__is_lock(&pos->ins))
137144 name = pos->ops.locked.ins.name;
@@ -139,9 +146,11 @@ static bool is_fused(struct annotate_browser *ab, struct disasm_line *cursor) · 1 unmodified line
139146 name = pos->ins.name;
140147
141148 if (!name || !cursor->ins.name)
142− return false;
149+ return 0;
143150
144− return ins__is_fused(ab->arch, name, cursor->ins.name);
151+ if (ins__is_fused(ab->arch, name, cursor->ins.name))
152+ return diff;
153+ return 0;
145154 }
146155
147156 static void annotate_browser__draw_current_jump(struct ui_browser *browser)
@@ -155,6 +164,7 @@ static void annotate_browser__draw_current_jump(struct ui_browser *browser) · 7 unmodified lines
155164 struct annotation *notes = symbol__annotation(sym);
156165 u8 pcnt_width = annotation__pcnt_width(notes);
157166 int width;
167+ int diff = 0;
158168
159169 /* PLT symbols contain external offsets */
160170 if (strstr(sym->name, "@plt"))
@@ -205,11 +215,11 @@ static void annotate_browser__draw_current_jump(struct ui_browser *browser) · 44 unmodified lines
205215 pcnt_width + 2 + notes->widths.addr + width,
206216 from, to);
207217
208− if (is_fused(ab, cursor)) {
218+ diff = is_fused(ab, cursor);
219+ if (diff > 0) {
209220 ui_browser__mark_fused(browser,
210221 pcnt_width + 3 + notes->widths.addr + width,
211− from - 1,
212− to > from);
222+ from - diff, diff, to > from);
213223 }
214224 }
215225
tools/perf/util/bpf-event.c+3−0
@@ -24,7 +24,10 @@ · 23 unmodified lines
2424 struct btf * __weak btf__load_from_kernel_by_id(__u32 id)
2525 {
2626 struct btf *btf;
27+#pragma GCC diagnostic push
28+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
2729 int err = btf__get_from_id(id, &btf);
30+#pragma GCC diagnostic pop
2831
2932 return err ? ERR_PTR(err) : btf;
3033 }
tools/perf/util/machine.c+1−0
@@ -2149,6 +2149,7 @@ static int add_callchain_ip(struct thread *thread, · 2148 unmodified lines
21492149
21502150 al.filtered = 0;
21512151 al.sym = NULL;
2152+ al.srcline = NULL;
21522153 if (!cpumode) {
21532154 thread__find_cpumode_addr_location(thread, ip, &al);
21542155 } else {
tools/testing/selftests/drivers/net/ocelot/tc_flower_chains.sh+1−1
@@ -1,6 +1,6 @@
11 #!/bin/bash
22 # SPDX-License-Identifier: GPL-2.0
3−# Copyright 2020 NXP Semiconductors
3+# Copyright 2020 NXP
44
55 WAIT_TIME=1
66 NUM_NETIFS=4
tools/testing/selftests/net/af_unix/Makefile+1−4
@@ -1,5 +1,2 @@
1−##TEST_GEN_FILES := test_unix_oob
2−TEST_PROGS := test_unix_oob
1+TEST_GEN_PROGS := test_unix_oob
32 include ../../lib.mk
4−
5−all: $(TEST_PROGS)
tools/testing/selftests/net/af_unix/test_unix_oob.c+3−2
@@ -271,8 +271,9 @@ main(int argc, char **argv) · 270 unmodified lines
271271 read_oob(pfd, &oob);
272272
273273 if (!signal_recvd || len != 127 || oob != '%' || atmark != 1) {
274− fprintf(stderr, "Test 3 failed, sigurg %d len %d OOB %c ",
275− "atmark %d\n", signal_recvd, len, oob, atmark);
274+ fprintf(stderr,
275+ "Test 3 failed, sigurg %d len %d OOB %c atmark %d\n",
276+ signal_recvd, len, oob, atmark);
276277 die(1);
277278 }
278279
tools/testing/selftests/powerpc/tm/tm-syscall-asm.S+36−1
@@ -1,5 +1,5 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
2−#include <ppc-asm.h>
2+#include <basic_asm.h>
33 #include <asm/unistd.h>
44
55 .text
@@ -26,3 +26,38 @@ FUNC_START(getppid_tm_suspended) · 20 unmodified lines
2626 1:
2727 li r3, -1
2828 blr
29+
30+
31+.macro scv level
32+ .long (0x44000001 | (\level) << 5)
33+.endm
34+
35+FUNC_START(getppid_scv_tm_active)
36+ PUSH_BASIC_STACK(0)
37+ tbegin.
38+ beq 1f
39+ li r0, __NR_getppid
40+ scv 0
41+ tend.
42+ POP_BASIC_STACK(0)
43+ blr
44+1:
45+ li r3, -1
46+ POP_BASIC_STACK(0)
47+ blr
48+
49+FUNC_START(getppid_scv_tm_suspended)
50+ PUSH_BASIC_STACK(0)
51+ tbegin.
52+ beq 1f
53+ li r0, __NR_getppid
54+ tsuspend.
55+ scv 0
56+ tresume.
57+ tend.
58+ POP_BASIC_STACK(0)
59+ blr
60+1:
61+ li r3, -1
62+ POP_BASIC_STACK(0)
63+ blr
tools/testing/selftests/powerpc/tm/tm-syscall.c+29−7
@@ -19,23 +19,36 @@ · 18 unmodified lines
1919 #include "utils.h"
2020 #include "tm.h"
2121
22+#ifndef PPC_FEATURE2_SCV
23+#define PPC_FEATURE2_SCV 0x00100000 /* scv syscall */
24+#endif
25+
2226 extern int getppid_tm_active(void);
2327 extern int getppid_tm_suspended(void);
28+extern int getppid_scv_tm_active(void);
29+extern int getppid_scv_tm_suspended(void);
2430
2531 unsigned retries = 0;
2632
2733 #define TEST_DURATION 10 /* seconds */
2834
29−pid_t getppid_tm(bool suspend)
35+pid_t getppid_tm(bool scv, bool suspend)
3036 {
3137 int i;
3238 pid_t pid;
3339
3440 for (i = 0; i < TM_RETRIES; i++) {
35− if (suspend)
36− pid = getppid_tm_suspended();
37− else
38− pid = getppid_tm_active();
41+ if (suspend) {
42+ if (scv)
43+ pid = getppid_scv_tm_suspended();
44+ else
45+ pid = getppid_tm_suspended();
46+ } else {
47+ if (scv)
48+ pid = getppid_scv_tm_active();
49+ else
50+ pid = getppid_tm_active();
51+ }
3952
4053 if (pid >= 0)
4154 return pid;
@@ -82,15 +95,24 @@ int tm_syscall(void) · 40 unmodified lines
8295 * Test a syscall within a suspended transaction and verify
8396 * that it succeeds.
8497 */
85− FAIL_IF(getppid_tm(true) == -1); /* Should succeed. */
98+ FAIL_IF(getppid_tm(false, true) == -1); /* Should succeed. */
8699
87100 /*
88101 * Test a syscall within an active transaction and verify that
89102 * it fails with the correct failure code.
90103 */
91− FAIL_IF(getppid_tm(false) != -1); /* Should fail... */
104+ FAIL_IF(getppid_tm(false, false) != -1); /* Should fail... */
92105 FAIL_IF(!failure_is_persistent()); /* ...persistently... */
93106 FAIL_IF(!failure_is_syscall()); /* ...with code syscall. */
107+
108+ /* Now do it all again with scv if it is available. */
109+ if (have_hwcap2(PPC_FEATURE2_SCV)) {
110+ FAIL_IF(getppid_tm(true, true) == -1); /* Should succeed. */
111+ FAIL_IF(getppid_tm(true, false) != -1); /* Should fail... */
112+ FAIL_IF(!failure_is_persistent()); /* ...persistently... */
113+ FAIL_IF(!failure_is_syscall()); /* ...with code syscall. */
114+ }
115+
94116 gettimeofday(&now, 0);
95117 }
96118

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

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

Repository code

Go to file
t