History

Merge v5.10-rc3 into drm-next

We need commit f8f6ae5d077a ("mm: always have io_remap_pfn_range() set pgprot_decrypted()") to be able to merge Jason's cleanup patch.

Daniel Vetter committed 6 years ago

Commit 512bce52 parents 5b8c596 f8394f2459 files · +3848 −2270Browse files

Unified · Split

459 files
  1. Documentation/ABI/stable/sysfs-driver-dma-ioatdma +5 −5
  2. Documentation/ABI/testing/sysfs-class-net +1 −1
  3. Documentation/Makefile +4 −0
  4. Documentation/admin-guide/LSM/SafeSetID.rst +1 −1
  5. Documentation/admin-guide/pm/cpuidle.rst +2 −2
  6. Documentation/admin-guide/sysctl/net.rst +1 −0
  7. Documentation/arm/sunxi.rst +10 −0
  8. Documentation/conf.py +1 −1
  9. Documentation/dev-tools/kasan.rst +2 −0
  10. Documentation/dev-tools/kunit/start.rst +1 −1
  11. Documentation/dev-tools/kunit/usage.rst +5 −0
  12. Documentation/devicetree/bindings/clock/hi6220-clock.txt +1 −1
  13. Documentation/devicetree/bindings/interrupt-controller/ti,sci-inta.yaml +10 −0
  14. Documentation/devicetree/bindings/net/can/can-controller.yaml +18 −0
  15. Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml +135 −0
  16. Documentation/devicetree/bindings/net/can/fsl-flexcan.txt +0 −57
  17. Documentation/filesystems/api-summary.rst +0 −3
  18. Documentation/gpu/amdgpu.rst +0 −7
  19. Documentation/hwmon/adm1266.rst +1 −1
  20. Documentation/hwmon/index.rst +1 −0
  21. Documentation/hwmon/mp2975.rst +13 −1
  22. Documentation/leds/index.rst +1 −0
  23. Documentation/locking/lockdep-design.rst +31 −20
  24. Documentation/misc-devices/index.rst +0 −1
  25. Documentation/networking/devlink/ice.rst +1 −0
  26. Documentation/networking/j1939.rst +60 −60
  27. Documentation/networking/statistics.rst +1 −2
  28. Documentation/sphinx/automarkup.py +14 −6
  29. Documentation/userspace-api/index.rst +1 −0
  30. MAINTAINERS +13 −6
  31. Makefile +1 −1
  32. arch/arc/kernel/head.S +16 −1
  33. arch/arc/kernel/stacktrace.c +6 −1
  34. arch/arc/plat-hsdk/platform.c +0 −17
  35. arch/arm/mm/init.c +2 −2
  36. arch/arm64/Kconfig +1 −1
  37. arch/arm64/include/asm/brk-imm.h +2 −0
  38. arch/arm64/include/asm/debug-monitors.h +1 −0
  39. arch/arm64/include/asm/kprobes.h +1 −1
  40. arch/arm64/kernel/kexec_image.c +31 −10
  41. arch/arm64/kernel/machine_kexec_file.c +8 −1
  42. arch/arm64/kernel/probes/kprobes.c +23 −46
  43. arch/powerpc/include/asm/nohash/32/kup-8xx.h +1 −1
  44. arch/powerpc/include/asm/nohash/32/mmu-8xx.h +15 −32
  45. arch/powerpc/include/asm/nohash/32/pte-8xx.h +5 −4
  46. arch/powerpc/include/asm/topology.h +9 −3
  47. arch/powerpc/include/asm/uaccess.h +2 −2
  48. arch/powerpc/kernel/eeh_cache.c +3 −2
  49. arch/powerpc/kernel/head_40x.S +0 −8
  50. arch/powerpc/kernel/head_8xx.S +7 −39
  51. arch/powerpc/kernel/head_book3s_32.S +0 −12
  52. arch/powerpc/kernel/smp.c +2 −1
  53. arch/riscv/include/asm/uaccess.h +1 −1
  54. arch/riscv/kernel/ftrace.c +1 −1
  55. arch/riscv/kernel/head.S +5 −0
  56. arch/riscv/kernel/vdso/.gitignore +1 −0
  57. arch/riscv/kernel/vdso/Makefile +9 −9
  58. arch/riscv/kernel/vdso/so2s.sh +6 −0
  59. arch/riscv/mm/fault.c +3 −1
  60. arch/riscv/mm/init.c +21 −11
  61. arch/s390/configs/debug_defconfig +6 −4
  62. arch/s390/configs/defconfig +5 −4
  63. arch/s390/configs/zfcpdump_defconfig +1 −1
  64. arch/s390/include/asm/pgtable.h +30 −22
  65. arch/s390/include/asm/vdso/vdso.h +0 −0
  66. arch/s390/kernel/asm-offsets.c +0 −8
  67. arch/s390/kernel/smp.c +2 −1
  68. arch/s390/pci/pci_event.c +4 −0
  69. arch/x86/boot/compressed/ident_map_64.c +1 −0
  70. arch/x86/boot/compressed/mem_encrypt.S +19 −1
  71. arch/x86/boot/compressed/misc.h +2 −0
  72. arch/x86/hyperv/hv_apic.c +9 −5
  73. arch/x86/kernel/apic/x2apic_uv_x.c +18 −5
  74. arch/x86/kernel/cpu/bugs.c +33 −18
  75. arch/x86/kernel/head_64.S +16 −0
  76. arch/x86/kernel/sev-es-shared.c +26 −0
  77. arch/x86/kernel/sev-es.c +13 −7
  78. arch/x86/kernel/sev_verify_cbit.S +89 −0
  79. arch/x86/lib/memcpy_64.S +1 −3
  80. arch/x86/lib/memmove_64.S +1 −3
  81. arch/x86/lib/memset_64.S +1 −3
  82. arch/x86/mm/mem_encrypt.c +1 −0
  83. arch/xtensa/mm/init.c +2 −2
  84. drivers/base/core.c +2 −4
  85. drivers/base/dd.c +5 −4
  86. drivers/base/power/runtime.c +20 −37
  87. drivers/block/null_blk.h +1 −1
  88. drivers/block/null_blk_zoned.c +31 −16
  89. drivers/char/tpm/eventlog/efi.c +5 −0
  90. drivers/char/tpm/tpm_tis.c +27 −2
  91. drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c +1 −1
  92. drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c +1 −1
  93. drivers/crypto/allwinner/sun8i-ce/sun8i-ce-trng.c +1 −1
  94. drivers/gpu/drm/amd/display/include/dal_asic_id.h +4 −0
  95. drivers/gpu/drm/i915/gem/i915_gem_domain.c +13 −15
  96. drivers/gpu/drm/i915/gt/intel_engine.h +35 −20
  97. drivers/gpu/drm/i915/gt/intel_lrc.c +22 −9
  98. drivers/gpu/drm/i915/gt/intel_timeline.c +10 −8
  99. drivers/gpu/drm/i915/gt/intel_timeline_types.h +2 −0
  100. drivers/gpu/drm/i915/gvt/handlers.c +44 −3
  101. drivers/gpu/drm/i915/gvt/scheduler.c +8 −7
  102. drivers/gpu/drm/i915/i915_vma.c +4 −2
  103. drivers/gpu/drm/imx/dw_hdmi-imx.c +3 −14
  104. drivers/gpu/drm/imx/imx-drm-core.c +5 −5
  105. drivers/gpu/drm/imx/imx-ldb.c +4 −6
  106. drivers/gpu/drm/imx/imx-tve.c +6 −34
  107. drivers/gpu/drm/imx/parallel-display.c +3 −17
  108. drivers/gpu/drm/panfrost/panfrost_drv.c +3 −2
  109. drivers/gpu/drm/panfrost/panfrost_gem.c +1 −3
  110. drivers/gpu/drm/panfrost/panfrost_gem.h +1 −1
  111. drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c +11 −3
  112. drivers/gpu/drm/vc4/vc4_bo.c +5 −4
  113. drivers/gpu/drm/vc4/vc4_drv.c +14 −27
  114. drivers/gpu/drm/vc4/vc4_drv.h +4 −5
  115. drivers/gpu/drm/vc4/vc4_gem.c +10 −9
  116. drivers/gpu/drm/vc4/vc4_hvs.c +2 −2
  117. drivers/gpu/drm/vc4/vc4_kms.c +58 −22
  118. drivers/gpu/drm/vc4/vc4_v3d.c +6 −6
  119. drivers/gpu/ipu-v3/ipu-common.c +0 −67
  120. drivers/hv/hv_balloon.c +1 −1
  121. drivers/i2c/busses/Kconfig +1 −1
  122. drivers/i2c/busses/i2c-designware-slave.c +19 −33
  123. drivers/i2c/busses/i2c-mlxbf.c +86 −118
  124. drivers/i2c/busses/i2c-mt65xx.c +4 −4
  125. drivers/i2c/busses/i2c-sh_mobile.c +66 −20
  126. drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.h +1 −1
  127. drivers/infiniband/sw/rdmavt/vt.c +5 −2
  128. drivers/infiniband/sw/rxe/rxe_verbs.c +5 −1
  129. drivers/infiniband/sw/siw/siw_main.c +5 −2
  130. drivers/infiniband/ulp/srpt/ib_srpt.c +8 −5
  131. drivers/infiniband/ulp/srpt/ib_srpt.h +1 −0
  132. drivers/iommu/amd/amd_iommu_types.h +5 −1
  133. drivers/iommu/intel/iommu.c +3 −0
  134. drivers/iommu/intel/svm.c +7 −1
  135. drivers/iommu/iommu.c +1 −1
  136. drivers/irqchip/Kconfig +1 −2
  137. drivers/irqchip/irq-bcm2836.c +1 −1
  138. drivers/irqchip/irq-mst-intc.c +2 −2
  139. drivers/irqchip/irq-renesas-intc-irqpin.c +3 −5
  140. drivers/irqchip/irq-sifive-plic.c +5 −5
  141. drivers/irqchip/irq-stm32-exti.c +4 −0
  142. drivers/irqchip/irq-ti-sci-inta.c +80 −3
  143. drivers/mtd/nand/raw/fsl_ifc_nand.c +24 −19
  144. drivers/mtd/nand/raw/mxc_nand.c +5 −12
  145. drivers/mtd/nand/raw/stm32_fmc2_nand.c +8 −7
  146. drivers/mtd/spi-nor/core.c +7 −6
  147. drivers/net/can/dev.c +11 −3
  148. drivers/net/can/flexcan.c +7 −5
  149. drivers/net/can/peak_canfd/peak_canfd.c +8 −3
  150. drivers/net/can/rx-offload.c +2 −2
  151. drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c +11 −11
  152. drivers/net/can/spi/mcp251xfd/mcp251xfd-regmap.c +9 −9
  153. drivers/net/can/ti_hecc.c +5 −3
  154. drivers/net/can/usb/peak_usb/pcan_usb_core.c +46 −5
  155. drivers/net/can/usb/peak_usb/pcan_usb_fd.c +37 −11
  156. drivers/net/can/xilinx_can.c +3 −3
  157. drivers/net/dsa/qca8k.c +2 −2
  158. drivers/net/ethernet/cadence/macb_main.c +2 −1
  159. drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c +1 −1
  160. drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_hw.c +3 −0
  161. drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +18 −10
  162. drivers/net/ethernet/freescale/fec.h +6 −0
  163. drivers/net/ethernet/freescale/fec_main.c +16 −13
  164. drivers/net/ethernet/freescale/gianfar.c +3 −11
  165. drivers/net/ethernet/ibm/ibmvnic.c +32 −4
  166. drivers/net/ethernet/pensando/ionic/ionic_ethtool.c +5 −0
  167. drivers/net/ethernet/realtek/r8169_main.c +11 −3
  168. drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c +7 −7
  169. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +1 −0
  170. drivers/net/ethernet/ti/cpsw_ethtool.c +0 −1
  171. drivers/net/ethernet/ti/cpsw_priv.c +1 −4
  172. drivers/net/phy/sfp.c +2 −1
  173. drivers/net/usb/qmi_wwan.c +1 −0
  174. drivers/nvme/host/core.c +6 −2
  175. drivers/nvme/host/nvme.h +1 −0
  176. drivers/nvme/host/pci.c +19 −4
  177. drivers/nvme/host/rdma.c +3 −11
  178. drivers/nvme/host/tcp.c +4 −12
  179. drivers/of/device.c +1 −1
  180. drivers/opp/core.c +5 −4
  181. drivers/opp/of.c +2 −0
  182. drivers/pci/controller/dwc/pcie-designware-host.c +6 −2
  183. drivers/pci/controller/pci-mvebu.c +10 −13
  184. drivers/pci/pci.c +7 −2
  185. drivers/powercap/intel_rapl_common.c +1 −1
  186. drivers/regulator/core.c +2 −0
  187. drivers/s390/crypto/ap_bus.c +12 −2
  188. drivers/s390/crypto/pkey_api.c +16 −14
  189. drivers/s390/crypto/zcrypt_card.c +8 −5
  190. drivers/s390/crypto/zcrypt_queue.c +1 −5
  191. drivers/scsi/device_handler/scsi_dh_alua.c +5 −4
  192. drivers/scsi/hpsa.c +3 −1
  193. drivers/scsi/mpt3sas/mpt3sas_base.c +7 −0
  194. drivers/spi/spi-bcm2835.c +1 −14
  195. drivers/spi/spi-fsl-dspi.c +4 −6
  196. drivers/spi/spi-imx.c +15 −8
  197. drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml +1 −1
  198. drivers/tty/serial/8250/8250_mtk.c +1 −1
  199. drivers/tty/serial/Kconfig +1 −0
  200. drivers/tty/serial/serial_txx9.c +3 −0
  201. drivers/tty/tty_io.c +4 −2
  202. drivers/tty/vt/vt.c +2 −22
  203. drivers/tty/vt/vt_ioctl.c +19 −17
  204. drivers/usb/core/quirks.c +3 −0
  205. drivers/usb/dwc2/platform.c +3 −0
  206. drivers/usb/dwc3/dwc3-pci.c +4 −0
  207. drivers/usb/dwc3/ep0.c +2 −1
  208. drivers/usb/gadget/legacy/raw_gadget.c +4 −1
  209. drivers/usb/gadget/udc/fsl_udc_core.c +1 −1
  210. drivers/usb/gadget/udc/goku_udc.c +1 −1
  211. drivers/usb/misc/apple-mfi-fastcharge.c +3 −1
  212. drivers/usb/mtu3/mtu3_gadget.c +1 −0
  213. drivers/usb/serial/cyberjack.c +6 −1
  214. drivers/usb/serial/option.c +10 −0
  215. drivers/vfio/fsl-mc/vfio_fsl_mc.c +7 −3
  216. drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c +1 −1
  217. drivers/vfio/pci/vfio_pci.c +1 −1
  218. drivers/vfio/pci/vfio_pci_rdwr.c +35 −8
  219. drivers/vfio/platform/vfio_platform_common.c +1 −2
  220. drivers/vfio/vfio_iommu_type1.c +5 −12
  221. fs/afs/xattr.c +1 −6
  222. fs/afs/yfsclient.c +1 −0
  223. fs/ceph/caps.c +1 −1
  224. fs/ceph/mds_client.c +35 −15
  225. fs/ceph/mds_client.h +1 −0
  226. fs/ceph/quota.c +1 −1
  227. fs/ceph/snap.c +1 −1
  228. fs/gfs2/glock.c +2 −1
  229. fs/gfs2/glops.c +45 −11
  230. fs/gfs2/glops.h +1 −0
  231. fs/gfs2/inode.c +2 −1
  232. fs/gfs2/lops.c +5 −26
  233. fs/gfs2/lops.h +0 −2
  234. fs/gfs2/ops_fstype.c +9 −5
  235. fs/gfs2/recovery.c +1 −1
  236. fs/gfs2/rgrp.c +4 −1
  237. fs/gfs2/super.c +1 −0
  238. fs/io-wq.c +4 −0
  239. fs/io_uring.c +136 −47
  240. fs/iomap/buffered-io.c +10 −20
  241. fs/proc/base.c +2 −0
  242. fs/proc/cpuinfo.c +1 −1
  243. fs/proc/generic.c +2 −2
  244. fs/proc/inode.c +2 −0
  245. fs/proc/stat.c +1 −1
  246. fs/seq_file.c +32 −13
  247. fs/xfs/libxfs/xfs_alloc.c +1 −0
  248. fs/xfs/libxfs/xfs_bmap.h +1 −1
  249. fs/xfs/scrub/inode.c +1 −2
  250. fs/xfs/xfs_aops.c +12 −8
  251. fs/xfs/xfs_iops.c +10 −0
  252. fs/xfs/xfs_reflink.c +2 −1
  253. include/kunit/test.h +8 −8
  254. include/linux/blk-mq.h +2 −0
  255. include/linux/can/skb.h +8 −12
  256. include/linux/io_uring.h +2 −1
  257. include/linux/iomap.h +1 −1
  258. include/linux/mm.h +9 −0
  259. include/linux/netfilter/nfnetlink.h +8 −1
  260. include/linux/netfilter_ipv4.h +1 −1
  261. include/linux/netfilter_ipv6.h +5 −5
  262. include/linux/pagemap.h +4 −4
  263. include/linux/pgtable.h +0 −4
  264. include/linux/phy.h +5 −35
  265. include/linux/pm_runtime.h +2 −4
  266. include/linux/refcount.h +65 −65
  267. include/linux/seq_file.h +1 −0
  268. include/net/cfg80211.h +5 −4
  269. include/net/mac80211.h +4 −3
  270. include/sound/control.h +1 −1
  271. include/sound/core.h +2 −1
  272. include/sound/pcm.h +2 −2
  273. include/uapi/linux/icmpv6.h +1 −0
  274. include/uapi/sound/compress_offload.h +1 −1
  275. include/video/imx-ipu-v3.h +0 −3
  276. kernel/entry/common.c +2 −2
  277. kernel/events/core.c +5 −7
  278. kernel/fork.c +5 −5
  279. kernel/futex.c +14 −2
  280. kernel/hung_task.c +1 −2
  281. kernel/irq/Kconfig +1 −0
  282. kernel/kprobes.c +21 −4
  283. kernel/kthread.c +2 −1
  284. kernel/sched/cpufreq_schedutil.c +10 −12
  285. kernel/signal.c +10 −9
  286. kernel/trace/ring_buffer.c +46 −12
  287. kernel/trace/trace.c +3 −3
  288. kernel/trace/trace.h +23 −3
  289. kernel/trace/trace_events_synth.c +7 −10
  290. kernel/trace/trace_selftest.c +7 −2
  291. lib/crc32test.c +0 −4
  292. lib/fonts/font_10x18.c +1 −1
  293. lib/fonts/font_6x10.c +1 −1
  294. lib/fonts/font_6x11.c +1 −1
  295. lib/fonts/font_6x8.c +1 −1
  296. lib/fonts/font_7x14.c +1 −1
  297. lib/fonts/font_8x16.c +1 −1
  298. lib/fonts/font_8x8.c +1 −1
  299. lib/fonts/font_acorn_8x8.c +1 −1
  300. lib/fonts/font_mini_4x6.c +1 −1
  301. lib/fonts/font_pearl_8x8.c +1 −1
  302. lib/fonts/font_sun12x22.c +1 −1
  303. lib/fonts/font_sun8x16.c +1 −1
  304. lib/fonts/font_ter16x32.c +1 −1
  305. lib/test_kasan.c +107 −42
  306. mm/hugetlb.c +11 −9
  307. mm/memcontrol.c +18 −7
  308. mm/mempolicy.c +3 −3
  309. mm/memremap.c +16 −23
  310. mm/truncate.c +1 −1
  311. net/atm/lec.c +2 −3
  312. net/can/Kconfig +3 −2
  313. net/can/isotp.c +14 −12
  314. net/can/j1939/socket.c +6 −0
  315. net/can/proc.c +4 −2
  316. net/ipv4/ip_tunnel.c +0 −3
  317. net/ipv4/netfilter.c +5 −3
  318. net/ipv4/netfilter/iptable_mangle.c +1 −1
  319. net/ipv4/netfilter/nf_reject_ipv4.c +1 −1
  320. net/ipv4/xfrm4_tunnel.c +2 −2
  321. net/ipv6/icmp.c +7 −1
  322. net/ipv6/ip6_tunnel.c +2 −2
  323. net/ipv6/netfilter.c +3 −3
  324. net/ipv6/netfilter/ip6table_mangle.c +1 −1
  325. net/ipv6/reassembly.c +32 −1
  326. net/ipv6/xfrm6_tunnel.c +2 −2
  327. net/mac80211/mlme.c +2 −1
  328. net/mac80211/sta_info.c +18 −0
  329. net/mac80211/sta_info.h +8 −1
  330. net/mac80211/tx.c +28 −16
  331. net/mptcp/token.c +1 −1
  332. net/netfilter/ipset/ip_set_core.c +2 −1
  333. net/netfilter/ipvs/ip_vs_core.c +2 −2
  334. net/netfilter/nf_nat_proto.c +2 −2
  335. net/netfilter/nf_synproxy_core.c +1 −1
  336. net/netfilter/nf_tables_api.c +12 −7
  337. net/netfilter/nfnetlink.c +18 −4
  338. net/netfilter/nft_chain_route.c +2 −2
  339. net/netfilter/utils.c +2 −2
  340. net/openvswitch/datapath.c +7 −7
  341. net/openvswitch/flow_table.c +1 −1
  342. net/sctp/sm_sideeffect.c +2 −2
  343. net/wireless/core.c +31 −26
  344. net/wireless/core.h +3 −2
  345. net/wireless/nl80211.c +2 −1
  346. net/wireless/reg.c +1 −1
  347. net/xfrm/xfrm_interface.c +4 −4
  348. net/xfrm/xfrm_state.c +5 −3
  349. scripts/get_abi.pl +23 −0
  350. scripts/kernel-doc +15 −6
  351. sound/core/control.c +2 −2
  352. sound/core/pcm_dmaengine.c +2 −1
  353. sound/core/pcm_lib.c +1 −1
  354. sound/core/pcm_native.c +2 −2
  355. sound/hda/ext/hdac_ext_controller.c +2 −0
  356. sound/pci/hda/hda_codec.c +29 −16
  357. sound/pci/hda/hda_controller.h +2 −1
  358. sound/pci/hda/hda_intel.c +35 −28
  359. sound/pci/hda/patch_realtek.c +56 −11
  360. sound/soc/atmel/mchp-spdiftx.c +0 −1
  361. sound/soc/codecs/cs42l51.c +21 −1
  362. sound/soc/codecs/wcd9335.c +1 −1
  363. sound/soc/codecs/wcd934x.c +1 −1
  364. sound/soc/codecs/wsa881x.c +2 −0
  365. sound/soc/intel/Kconfig +0 −18
  366. sound/soc/intel/atom/Makefile +1 −1
  367. sound/soc/intel/atom/sst/Makefile +3 −3
  368. sound/soc/intel/boards/kbl_rt5663_max98927.c +31 −8
  369. sound/soc/intel/catpt/dsp.c +6 −3
  370. sound/soc/intel/catpt/pcm.c +10 −0
  371. sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c +25 −6
  372. sound/soc/qcom/lpass-cpu.c +10 −4
  373. sound/soc/qcom/lpass-sc7180.c +1 −1
  374. sound/soc/qcom/sdm845.c +2 −0
  375. sound/soc/soc-core.c +1 −1
  376. sound/soc/soc-dapm.c +1 −1
  377. sound/soc/sof/loader.c +5 −0
  378. sound/usb/pcm.c +6 −0
  379. sound/usb/quirks.c +1 −0
  380. tools/arch/arm64/include/uapi/asm/kvm.h +25 −0
  381. tools/arch/s390/include/uapi/asm/sie.h +1 −1
  382. tools/arch/x86/include/asm/cpufeatures.h +5 −1
  383. tools/arch/x86/include/asm/disabled-features.h +8 −1
  384. tools/arch/x86/include/asm/msr-index.h +10 −0
  385. tools/arch/x86/include/asm/required-features.h +1 −1
  386. tools/arch/x86/include/uapi/asm/kvm.h +20 −0
  387. tools/arch/x86/include/uapi/asm/svm.h +13 −0
  388. tools/build/feature/test-all.c +0 −1
  389. tools/include/linux/compiler-gcc.h +0 −12
  390. tools/include/linux/compiler.h +0 −3
  391. tools/include/uapi/asm-generic/unistd.h +3 −1
  392. tools/include/uapi/drm/i915_drm.h +56 −3
  393. tools/include/uapi/linux/fscrypt.h +3 −3
  394. tools/include/uapi/linux/kvm.h +19 −0
  395. tools/include/uapi/linux/mman.h +1 −0
  396. tools/include/uapi/linux/mount.h +1 −0
  397. tools/include/uapi/linux/perf_event.h +1 −1
  398. tools/include/uapi/linux/prctl.h +9 −0
  399. tools/include/uapi/linux/vhost.h +4 −0
  400. tools/perf/Makefile.config +1 −0
  401. tools/perf/arch/x86/entry/syscalls/syscall_64.tbl +7 −4
  402. tools/perf/builtin-trace.c +9 −6
  403. tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json +1 −1
  404. tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json +1 −1
  405. tools/perf/tests/dwarf-unwind.c +5 −5
  406. tools/perf/ui/browsers/hists.c +1 −1
  407. tools/perf/util/build-id.c +2 −0
  408. tools/perf/util/hashmap.c +3 −0
  409. tools/perf/util/hashmap.h +12 −0
  410. tools/perf/util/machine.c +10 −1
  411. tools/perf/util/scripting-engines/trace-event-python.c +2 −5
  412. tools/perf/util/session.c +14 −0
  413. tools/perf/util/symbol.c +7 −0
  414. tools/perf/util/symbol.h +2 −0
  415. tools/testing/kunit/kunit_parser.py +1 −2
  416. tools/testing/kunit/kunit_tool_test.py +25 −7
  417. tools/testing/kunit/test_data/test_config_printk_time.log +2 −1
  418. tools/testing/kunit/test_data/test_interrupted_tap_output.log +2 −1
  419. tools/testing/kunit/test_data/test_kernel_panic_interrupt.log +2 −1
  420. tools/testing/kunit/test_data/test_multiple_prefixes.log +2 −1
  421. tools/testing/kunit/test_data/test_pound_no_prefix.log +2 −1
  422. tools/testing/kunit/test_data/test_pound_sign.log +1 −0
  423. tools/testing/selftests/clone3/clone3_cap_checkpoint_restore.c +1 −1
  424. tools/testing/selftests/core/close_range_test.c +4 −4
  425. tools/testing/selftests/filesystems/binderfs/binderfs_test.c +4 −4
  426. tools/testing/selftests/filesystems/epoll/epoll_wakeup_test.c +95 −0
  427. tools/testing/selftests/ftrace/test.d/dynevent/add_remove_kprobe.tc +1 −1
  428. tools/testing/selftests/ftrace/test.d/dynevent/clear_select_events.tc +1 −1
  429. tools/testing/selftests/ftrace/test.d/dynevent/generic_clear_event.tc +1 −1
  430. tools/testing/selftests/ftrace/test.d/ftrace/func-filter-notrace-pid.tc +1 −1
  431. tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc +1 −1
  432. tools/testing/selftests/ftrace/test.d/ftrace/func-filter-stacktrace.tc +2 −2
  433. tools/testing/selftests/ftrace/test.d/functions +7 −0
  434. tools/testing/selftests/ftrace/test.d/kprobe/add_and_remove.tc +1 −1
  435. tools/testing/selftests/ftrace/test.d/kprobe/busy_check.tc +1 −1
  436. tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args.tc +2 −2
  437. tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_comm.tc +1 −1
  438. tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc +2 −2
  439. tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_symbol.tc +5 −5
  440. tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc +1 −1
  441. tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_user.tc +4 −0
  442. tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc +7 −7
  443. tools/testing/selftests/ftrace/test.d/kprobe/kprobe_multiprobe.tc +1 −1
  444. tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc +6 −6
  445. tools/testing/selftests/ftrace/test.d/kprobe/kretprobe_args.tc +2 −2
  446. tools/testing/selftests/ftrace/test.d/kprobe/profile.tc +1 −1
  447. tools/testing/selftests/kselftest_harness.h +23 −23
  448. tools/testing/selftests/lib.mk +1 −1
  449. tools/testing/selftests/pidfd/config +1 −0
  450. tools/testing/selftests/pidfd/pidfd_getfd_test.c +4 −1
  451. tools/testing/selftests/pidfd/pidfd_open_test.c +0 −1
  452. tools/testing/selftests/pidfd/pidfd_poll_test.c +0 −1
  453. tools/testing/selftests/pidfd/pidfd_setns_test.c +0 −1
  454. tools/testing/selftests/pidfd/pidfd_test.c +1 −1
  455. tools/testing/selftests/proc/proc-loadavg-001.c +0 −1
  456. tools/testing/selftests/proc/proc-self-syscall.c +0 −1
  457. tools/testing/selftests/proc/proc-uptime-002.c +0 −1
  458. tools/testing/selftests/wireguard/netns.sh +8 −0
  459. tools/testing/selftests/wireguard/qemu/kernel.config +2 −0
Documentation/ABI/stable/sysfs-driver-dma-ioatdma+5−5
@@ -1,29 +1,29 @@
1−What: sys/devices/pciXXXX:XX/0000:XX:XX.X/dma/dma<n>chan<n>/quickdata/cap
1+What: /sys/devices/pciXXXX:XX/0000:XX:XX.X/dma/dma<n>chan<n>/quickdata/cap
22 Date: December 3, 2009
33 KernelVersion: 2.6.32
44 Contact: dmaengine@vger.kernel.org
55 Description: Capabilities the DMA supports.Currently there are DMA_PQ, DMA_PQ_VAL,
66 DMA_XOR,DMA_XOR_VAL,DMA_INTERRUPT.
77
8−What: sys/devices/pciXXXX:XX/0000:XX:XX.X/dma/dma<n>chan<n>/quickdata/ring_active
8+What: /sys/devices/pciXXXX:XX/0000:XX:XX.X/dma/dma<n>chan<n>/quickdata/ring_active
99 Date: December 3, 2009
1010 KernelVersion: 2.6.32
1111 Contact: dmaengine@vger.kernel.org
1212 Description: The number of descriptors active in the ring.
1313
14−What: sys/devices/pciXXXX:XX/0000:XX:XX.X/dma/dma<n>chan<n>/quickdata/ring_size
14+What: /sys/devices/pciXXXX:XX/0000:XX:XX.X/dma/dma<n>chan<n>/quickdata/ring_size
1515 Date: December 3, 2009
1616 KernelVersion: 2.6.32
1717 Contact: dmaengine@vger.kernel.org
1818 Description: Descriptor ring size, total number of descriptors available.
1919
20−What: sys/devices/pciXXXX:XX/0000:XX:XX.X/dma/dma<n>chan<n>/quickdata/version
20+What: /sys/devices/pciXXXX:XX/0000:XX:XX.X/dma/dma<n>chan<n>/quickdata/version
2121 Date: December 3, 2009
2222 KernelVersion: 2.6.32
2323 Contact: dmaengine@vger.kernel.org
2424 Description: Version of ioatdma device.
2525
26−What: sys/devices/pciXXXX:XX/0000:XX:XX.X/dma/dma<n>chan<n>/quickdata/intr_coalesce
26+What: /sys/devices/pciXXXX:XX/0000:XX:XX.X/dma/dma<n>chan<n>/quickdata/intr_coalesce
2727 Date: August 8, 2017
2828 KernelVersion: 4.14
2929 Contact: dmaengine@vger.kernel.org
Documentation/ABI/testing/sysfs-class-net+1−1
@@ -152,7 +152,7 @@ Description: · 151 unmodified lines
152152 When an interface is under test, it cannot be expected
153153 to pass packets as normal.
154154
155−What: /sys/clas/net/<iface>/duplex
155+What: /sys/class/net/<iface>/duplex
156156 Date: October 2009
157157 KernelVersion: 2.6.33
158158 Contact: netdev@vger.kernel.org
Documentation/Makefile+4−0
@@ -26,6 +26,10 @@ BUILDDIR = $(obj)/output · 25 unmodified lines
2626 PDFLATEX = xelatex
2727 LATEXOPTS = -interaction=batchmode
2828
29+ifeq ($(KBUILD_VERBOSE),0)
30+SPHINXOPTS += "-q"
31+endif
32+
2933 # User-friendly check for sphinx-build
3034 HAVE_SPHINX := $(shell if which $(SPHINXBUILD) >/dev/null 2>&1; then echo 1; else echo 0; fi)
3135
Documentation/admin-guide/LSM/SafeSetID.rst+1−1
@@ -107,7 +107,7 @@ for a UID/GID will prevent that UID/GID from obtaining auxiliary setid · 106 unmodified lines
107107 privileges, such as allowing a user to set up user namespace UID/GID mappings.
108108
109109 Note on GID policies and setgroups()
110−==================
110+====================================
111111 In v5.9 we are adding support for limiting CAP_SETGID privileges as was done
112112 previously for CAP_SETUID. However, for compatibility with common sandboxing
113113 related code conventions in userspace, we currently allow arbitrary
Documentation/admin-guide/pm/cpuidle.rst+2−2
@@ -478,7 +478,7 @@ order to ask the hardware to enter that state. Also, for each · 477 unmodified lines
478478 statistics of the given idle state. That information is exposed by the kernel
479479 via ``sysfs``.
480480
481−For each CPU in the system, there is a :file:`/sys/devices/system/cpu<N>/cpuidle/`
481+For each CPU in the system, there is a :file:`/sys/devices/system/cpu/cpu<N>/cpuidle/`
482482 directory in ``sysfs``, where the number ``<N>`` is assigned to the given
483483 CPU at the initialization time. That directory contains a set of subdirectories
484484 called :file:`state0`, :file:`state1` and so on, up to the number of idle state
@@ -494,7 +494,7 @@ object corresponding to it, as follows: · 9 unmodified lines
494494 residency.
495495
496496 ``below``
497− Total number of times this idle state had been asked for, but cerainly
497+ Total number of times this idle state had been asked for, but certainly
498498 a deeper idle state would have been a better match for the observed idle
499499 duration.
500500
Documentation/admin-guide/sysctl/net.rst+1−0
@@ -300,6 +300,7 @@ Note: · 299 unmodified lines
300300 0: 0 1 2 3 4 5 6 7
301301 RSS hash key:
302302 84:50:f4:00:a8:15:d1:a7:e9:7f:1d:60:35:c7:47:25:42:97:74:ca:56:bb:b6:a1:d8:43:e3:c9:0c:fd:17:55:c2:3a:4d:69:ed:f1:42:89
303+
303304 netdev_tstamp_prequeue
304305 ----------------------
305306
Documentation/arm/sunxi.rst+10−0
@@ -148,3 +148,13 @@ SunXi family · 147 unmodified lines
148148 * User Manual
149149
150150 http://dl.linux-sunxi.org/A64/Allwinner%20A64%20User%20Manual%20v1.0.pdf
151+
152+ - Allwinner H6
153+
154+ * Datasheet
155+
156+ https://linux-sunxi.org/images/5/5c/Allwinner_H6_V200_Datasheet_V1.1.pdf
157+
158+ * User Manual
159+
160+ https://linux-sunxi.org/images/4/46/Allwinner_H6_V200_User_Manual_V1.1.pdf
Documentation/conf.py+1−1
@@ -51,7 +51,7 @@ if major >= 3: · 50 unmodified lines
5151 support for Sphinx v3.0 and above is brand new. Be prepared for
5252 possible issues in the generated output.
5353 ''')
54− if minor > 0 or patch >= 2:
54+ if (major > 3) or (minor > 0 or patch >= 2):
5555 # Sphinx c function parser is more pedantic with regards to type
5656 # checking. Due to that, having macros at c:function cause problems.
5757 # Those needed to be scaped by using c_id_attributes[] array
Documentation/dev-tools/kasan.rst+2−0
@@ -295,11 +295,13 @@ print the number of the test and the status of the test: · 294 unmodified lines
295295 pass::
296296
297297 ok 28 - kmalloc_double_kzfree
298+
298299 or, if kmalloc failed::
299300
300301 # kmalloc_large_oob_right: ASSERTION FAILED at lib/test_kasan.c:163
301302 Expected ptr is not null, but is
302303 not ok 4 - kmalloc_large_oob_right
304+
303305 or, if a KASAN report was expected, but not found::
304306
305307 # kmalloc_double_kzfree: EXPECTATION FAILED at lib/test_kasan.c:629
Documentation/dev-tools/kunit/start.rst+1−1
@@ -197,7 +197,7 @@ Now add the following to ``drivers/misc/Kconfig``: · 196 unmodified lines
197197
198198 config MISC_EXAMPLE_TEST
199199 bool "Test for my example"
200− depends on MISC_EXAMPLE && KUNIT
200+ depends on MISC_EXAMPLE && KUNIT=y
201201
202202 and the following to ``drivers/misc/Makefile``:
203203
Documentation/dev-tools/kunit/usage.rst+5−0
@@ -561,6 +561,11 @@ Once the kernel is built and installed, a simple · 560 unmodified lines
561561
562562 ...will run the tests.
563563
564+.. note::
565+ Note that you should make sure your test depends on ``KUNIT=y`` in Kconfig
566+ if the test does not support module build. Otherwise, it will trigger
567+ compile errors if ``CONFIG_KUNIT`` is ``m``.
568+
564569 Writing new tests for other architectures
565570 -----------------------------------------
566571
Documentation/devicetree/bindings/clock/hi6220-clock.txt+1−1
@@ -4,7 +4,7 @@ Clock control registers reside in different Hi6220 system controllers, · 3 unmodified lines
44 please refer the following document to know more about the binding rules
55 for these system controllers:
66
7−Documentation/devicetree/bindings/arm/hisilicon/hisilicon.txt
7+Documentation/devicetree/bindings/arm/hisilicon/hisilicon.yaml
88
99 Required Properties:
1010
Documentation/devicetree/bindings/interrupt-controller/ti,sci-inta.yaml+10−0
@@ -32,6 +32,11 @@ description: | · 31 unmodified lines
3232 | | vint | bit | | 0 |.....|63| vintx |
3333 | +--------------+ +------------+ |
3434 | |
35+ | Unmap |
36+ | +--------------+ |
37+ Unmapped events ---->| | umapidx |-------------------------> Globalevents
38+ | +--------------+ |
39+ | |
3540 +-----------------------------------------+
3641
3742 Configuration of these Intmap registers that maps global events to vint is
@@ -70,6 +75,11 @@ properties: · 32 unmodified lines
7075 - description: |
7176 "limit" specifies the limit for translation
7277
78+ ti,unmapped-event-sources:
79+ $ref: /schemas/types.yaml#definitions/phandle-array
80+ description:
81+ Array of phandles to DMA controllers where the unmapped events originate.
82+
7383 required:
7484 - compatible
7585 - reg
Documentation/devicetree/bindings/net/can/can-controller.yaml+18−0
@@ -0,0 +1,18 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/net/can/can-controller.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: CAN Controller Generic Binding
8+
9+maintainers:
10+ - Marc Kleine-Budde <mkl@pengutronix.de>
11+
12+properties:
13+ $nodename:
14+ pattern: "^can(@.*)?$"
15+
16+additionalProperties: true
17+
18+...
Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml+135−0
@@ -0,0 +1,135 @@
1+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/net/can/fsl,flexcan.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title:
8+ Flexcan CAN controller on Freescale's ARM and PowerPC system-on-a-chip (SOC).
9+
10+maintainers:
11+ - Marc Kleine-Budde <mkl@pengutronix.de>
12+
13+allOf:
14+ - $ref: can-controller.yaml#
15+
16+properties:
17+ compatible:
18+ oneOf:
19+ - enum:
20+ - fsl,imx8qm-flexcan
21+ - fsl,imx8mp-flexcan
22+ - fsl,imx6q-flexcan
23+ - fsl,imx53-flexcan
24+ - fsl,imx35-flexcan
25+ - fsl,imx28-flexcan
26+ - fsl,imx25-flexcan
27+ - fsl,p1010-flexcan
28+ - fsl,vf610-flexcan
29+ - fsl,ls1021ar2-flexcan
30+ - fsl,lx2160ar1-flexcan
31+ - items:
32+ - enum:
33+ - fsl,imx7d-flexcan
34+ - fsl,imx6ul-flexcan
35+ - fsl,imx6sx-flexcan
36+ - const: fsl,imx6q-flexcan
37+ - items:
38+ - enum:
39+ - fsl,ls1028ar1-flexcan
40+ - const: fsl,lx2160ar1-flexcan
41+
42+ reg:
43+ maxItems: 1
44+
45+ interrupts:
46+ maxItems: 1
47+
48+ clocks:
49+ maxItems: 2
50+
51+ clock-names:
52+ items:
53+ - const: ipg
54+ - const: per
55+
56+ clock-frequency:
57+ description: |
58+ The oscillator frequency driving the flexcan device, filled in by the
59+ boot loader. This property should only be used the used operating system
60+ doesn't support the clocks and clock-names property.
61+
62+ xceiver-supply:
63+ description: Regulator that powers the CAN transceiver.
64+
65+ big-endian:
66+ $ref: /schemas/types.yaml#/definitions/flag
67+ description: |
68+ This means the registers of FlexCAN controller are big endian. This is
69+ optional property.i.e. if this property is not present in device tree
70+ node then controller is assumed to be little endian. If this property is
71+ present then controller is assumed to be big endian.
72+
73+ fsl,stop-mode:
74+ description: |
75+ Register bits of stop mode control.
76+
77+ The format should be as follows:
78+ <gpr req_gpr req_bit>
79+ gpr is the phandle to general purpose register node.
80+ req_gpr is the gpr register offset of CAN stop request.
81+ req_bit is the bit offset of CAN stop request.
82+ $ref: /schemas/types.yaml#/definitions/phandle-array
83+ items:
84+ - description: The 'gpr' is the phandle to general purpose register node.
85+ - description: The 'req_gpr' is the gpr register offset of CAN stop request.
86+ maximum: 0xff
87+ - description: The 'req_bit' is the bit offset of CAN stop request.
88+ maximum: 0x1f
89+
90+ fsl,clk-source:
91+ description: |
92+ Select the clock source to the CAN Protocol Engine (PE). It's SoC
93+ implementation dependent. Refer to RM for detailed definition. If this
94+ property is not set in device tree node then driver selects clock source 1
95+ by default.
96+ 0: clock source 0 (oscillator clock)
97+ 1: clock source 1 (peripheral clock)
98+ $ref: /schemas/types.yaml#/definitions/uint32
99+ default: 1
100+ minimum: 0
101+ maximum: 1
102+
103+ wakeup-source:
104+ $ref: /schemas/types.yaml#/definitions/flag
105+ description:
106+ Enable CAN remote wakeup.
107+
108+required:
109+ - compatible
110+ - reg
111+ - interrupts
112+
113+additionalProperties: false
114+
115+examples:
116+ - |
117+ can@1c000 {
118+ compatible = "fsl,p1010-flexcan";
119+ reg = <0x1c000 0x1000>;
120+ interrupts = <48 0x2>;
121+ interrupt-parent = <&mpic>;
122+ clock-frequency = <200000000>;
123+ fsl,clk-source = <0>;
124+ };
125+ - |
126+ #include <dt-bindings/interrupt-controller/irq.h>
127+
128+ can@2090000 {
129+ compatible = "fsl,imx6q-flexcan";
130+ reg = <0x02090000 0x4000>;
131+ interrupts = <0 110 IRQ_TYPE_LEVEL_HIGH>;
132+ clocks = <&clks 1>, <&clks 2>;
133+ clock-names = "ipg", "per";
134+ fsl,stop-mode = <&gpr 0x34 28>;
135+ };
Documentation/devicetree/bindings/net/can/fsl-flexcan.txt+0−57
@@ -1,57 +0,0 @@
1−Flexcan CAN controller on Freescale's ARM and PowerPC system-on-a-chip (SOC).
2−
3−Required properties:
4−
5−- compatible : Should be "fsl,<processor>-flexcan"
6−
7− where <processor> is imx8qm, imx6q, imx28, imx53, imx35, imx25, p1010,
8− vf610, ls1021ar2, lx2160ar1, ls1028ar1.
9−
10− The ls1028ar1 must be followed by lx2160ar1, e.g.
11− - "fsl,ls1028ar1-flexcan", "fsl,lx2160ar1-flexcan"
12−
13− An implementation should also claim any of the following compatibles
14− that it is fully backwards compatible with:
15−
16− - fsl,p1010-flexcan
17−
18−- reg : Offset and length of the register set for this device
19−- interrupts : Interrupt tuple for this device
20−
21−Optional properties:
22−
23−- clock-frequency : The oscillator frequency driving the flexcan device
24−
25−- xceiver-supply: Regulator that powers the CAN transceiver
26−
27−- big-endian: This means the registers of FlexCAN controller are big endian.
28− This is optional property.i.e. if this property is not present in
29− device tree node then controller is assumed to be little endian.
30− if this property is present then controller is assumed to be big
31− endian.
32−
33−- fsl,stop-mode: register bits of stop mode control, the format is
34− <&gpr req_gpr req_bit>.
35− gpr is the phandle to general purpose register node.
36− req_gpr is the gpr register offset of CAN stop request.
37− req_bit is the bit offset of CAN stop request.
38−
39−- fsl,clk-source: Select the clock source to the CAN Protocol Engine (PE).
40− It's SoC Implementation dependent. Refer to RM for detailed
41− definition. If this property is not set in device tree node
42− then driver selects clock source 1 by default.
43− 0: clock source 0 (oscillator clock)
44− 1: clock source 1 (peripheral clock)
45−
46−- wakeup-source: enable CAN remote wakeup
47−
48−Example:
49−
50− can@1c000 {
51− compatible = "fsl,p1010-flexcan";
52− reg = <0x1c000 0x1000>;
53− interrupts = <48 0x2>;
54− interrupt-parent = <&mpic>;
55− clock-frequency = <200000000>; // filled in by bootloader
56− fsl,clk-source = <0>; // select clock source 0 for PE
57− };
Documentation/filesystems/api-summary.rst+0−3
@@ -86,9 +86,6 @@ Other Functions · 85 unmodified lines
8686 .. kernel-doc:: fs/dax.c
8787 :export:
8888
89−.. kernel-doc:: fs/direct-io.c
90− :export:
91−
9289 .. kernel-doc:: fs/libfs.c
9390 :export:
9491
Documentation/gpu/amdgpu.rst+0−7
@@ -83,10 +83,6 @@ AMDGPU XGMI Support · 82 unmodified lines
8383 ===================
8484
8585 .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
86− :doc: AMDGPU XGMI Support
87−
88−.. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
89− :internal:
9086
9187 AMDGPU RAS Support
9288 ==================
@@ -124,9 +120,6 @@ RAS VRAM Bad Pages sysfs Interface · 31 unmodified lines
124120 .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
125121 :doc: AMDGPU RAS sysfs gpu_vram_bad_pages Interface
126122
127−.. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
128− :internal:
129−
130123 Sample Code
131124 -----------
132125 Sample code for testing error injection can be found here:
Documentation/hwmon/adm1266.rst+1−1
@@ -20,7 +20,7 @@ ADM1266 is a sequencer that features voltage readback from 17 channels via an · 19 unmodified lines
2020 integrated 12 bit SAR ADC, accessed using a PMBus interface.
2121
2222 The driver is a client driver to the core PMBus driver. Please see
23−Documentation/hwmon/pmbus for details on PMBus client drivers.
23+Documentation/hwmon/pmbus.rst for details on PMBus client drivers.
2424
2525
2626 Sysfs entries
Documentation/hwmon/index.rst+1−0
@@ -132,6 +132,7 @@ Hardware Monitoring Kernel Drivers · 131 unmodified lines
132132 mcp3021
133133 menf21bmc
134134 mlxreg-fan
135+ mp2975
135136 nct6683
136137 nct6775
137138 nct7802
Documentation/hwmon/mp2975.rst+13−1
@@ -20,6 +20,7 @@ This driver implements support for Monolithic Power Systems, Inc. (MPS) · 19 unmodified lines
2020 vendor dual-loop, digital, multi-phase controller MP2975.
2121
2222 This device:
23+
2324 - Supports up to two power rail.
2425 - Provides 8 pulse-width modulations (PWMs), and can be configured up
2526 to 8-phase operation for rail 1 and up to 4-phase operation for rail
@@ -32,10 +33,12 @@ This device: · 6 unmodified lines
3233 10-mV DAC, IMVP9 mode with 5-mV DAC.
3334
3435 Device supports:
36+
3537 - SVID interface.
3638 - AVSBus interface.
3739
3840 Device complaint with:
41+
3942 - PMBus rev 1.3 interface.
4043
4144 Device supports direct format for reading output current, output voltage,
@@ -45,11 +48,14 @@ Device supports VID and direct formats for reading output voltage. · 3 unmodified lines
4548 The below VID modes are supported: VR12, VR13, IMVP9.
4649
4750 The driver provides the next attributes for the current:
51+
4852 - for current in: input, maximum alarm;
4953 - for current out input, maximum alarm and highest values;
5054 - for phase current: input and label.
51−attributes.
55+ attributes.
56+
5257 The driver exports the following attributes via the 'sysfs' files, where
58+
5359 - 'n' is number of telemetry pages (from 1 to 2);
5460 - 'k' is number of configured phases (from 1 to 8);
5561 - indexes 1, 1*n for "iin";
@@ -65,11 +71,14 @@ The driver exports the following attributes via the 'sysfs' files, where · 9 unmodified lines
6571 **curr[1-{2n+k}]_label**
6672
6773 The driver provides the next attributes for the voltage:
74+
6875 - for voltage in: input, high critical threshold, high critical alarm, all only
6976 from page 0;
7077 - for voltage out: input, low and high critical thresholds, low and high
7178 critical alarms, from pages 0 and 1;
79+
7280 The driver exports the following attributes via the 'sysfs' files, where
81+
7382 - 'n' is number of telemetry pages (from 1 to 2);
7483 - indexes 1 for "iin";
7584 - indexes n+1, n+2 for "vout";
@@ -87,9 +96,12 @@ The driver exports the following attributes via the 'sysfs' files, where · 11 unmodified lines
8796 **in[2-{n+1}1_lcrit_alarm**
8897
8998 The driver provides the next attributes for the power:
99+
90100 - for power in alarm and input.
91101 - for power out: highest and input.
102+
92103 The driver exports the following attributes via the 'sysfs' files, where
104+
93105 - 'n' is number of telemetry pages (from 1 to 2);
94106 - indexes 1 for "pin";
95107 - indexes n+1, n+2 for "pout";
Documentation/leds/index.rst+1−0
@@ -25,3 +25,4 @@ LEDs · 24 unmodified lines
2525 leds-lp5562
2626 leds-lp55xx
2727 leds-mlxcpld
28+ leds-sc27xx
Documentation/locking/lockdep-design.rst+31−20
@@ -42,6 +42,7 @@ The validator tracks lock-class usage history and divides the usage into · 41 unmodified lines
4242 (4 usages * n STATEs + 1) categories:
4343
4444 where the 4 usages can be:
45+
4546 - 'ever held in STATE context'
4647 - 'ever held as readlock in STATE context'
4748 - 'ever held with STATE enabled'
@@ -49,10 +50,12 @@ where the 4 usages can be: · 1 unmodified line
4950
5051 where the n STATEs are coded in kernel/locking/lockdep_states.h and as of
5152 now they include:
53+
5254 - hardirq
5355 - softirq
5456
5557 where the last 1 category is:
58+
5659 - 'ever used' [ == !unused ]
5760
5861 When locking rules are violated, these usage bits are presented in the
@@ -96,9 +99,9 @@ exact case is for the lock as of the reporting time. · 37 unmodified lines
9699 +--------------+-------------+--------------+
97100 | | irq enabled | irq disabled |
98101 +--------------+-------------+--------------+
99− | ever in irq | ? | - |
102+ | ever in irq | '?' | '-' |
100103 +--------------+-------------+--------------+
101− | never in irq | + | . |
104+ | never in irq | '+' | '.' |
102105 +--------------+-------------+--------------+
103106
104107 The character '-' suggests irq is disabled because if otherwise the
@@ -216,7 +219,7 @@ looks like this:: · 111 unmodified lines
216219 BD_MUTEX_PARTITION
217220 };
218221
219−mutex_lock_nested(&bdev->bd_contains->bd_mutex, BD_MUTEX_PARTITION);
222+ mutex_lock_nested(&bdev->bd_contains->bd_mutex, BD_MUTEX_PARTITION);
220223
221224 In this case the locking is done on a bdev object that is known to be a
222225 partition.
@@ -334,7 +337,7 @@ Troubleshooting: · 111 unmodified lines
334337 ----------------
335338
336339 The validator tracks a maximum of MAX_LOCKDEP_KEYS number of lock classes.
337−Exceeding this number will trigger the following lockdep warning:
340+Exceeding this number will trigger the following lockdep warning::
338341
339342 (DEBUG_LOCKS_WARN_ON(id >= MAX_LOCKDEP_KEYS))
340343
@@ -420,7 +423,8 @@ the critical section of another reader of the same lock instance. · 79 unmodified lines
420423
421424 The difference between recursive readers and non-recursive readers is because:
422425 recursive readers get blocked only by a write lock *holder*, while non-recursive
423−readers could get blocked by a write lock *waiter*. Considering the follow example:
426+readers could get blocked by a write lock *waiter*. Considering the follow
427+example::
424428
425429 TASK A: TASK B:
426430
@@ -448,20 +452,22 @@ There are simply four block conditions: · 21 unmodified lines
448452
449453 Block condition matrix, Y means the row blocks the column, and N means otherwise.
450454
451− | E | r | R |
452455 +---+---+---+---+
453− E | Y | Y | Y |
456+ | | E | r | R |
457+ +---+---+---+---+
458+ | E | Y | Y | Y |
459+ +---+---+---+---+
460+ | r | Y | Y | N |
454461 +---+---+---+---+
455− r | Y | Y | N |
462+ | R | Y | Y | N |
456463 +---+---+---+---+
457− R | Y | Y | N |
458464
459465 (W: writers, r: non-recursive readers, R: recursive readers)
460466
461467
462468 acquired recursively. Unlike non-recursive read locks, recursive read locks
463469 only get blocked by current write lock *holders* other than write lock
464−*waiters*, for example:
470+*waiters*, for example::
465471
466472 TASK A: TASK B:
467473
@@ -491,7 +497,7 @@ Recursive locks don't block each other, while non-recursive locks do (this is · 23 unmodified lines
491497 even true for two non-recursive read locks). A non-recursive lock can block the
492498 corresponding recursive lock, and vice versa.
493499
494−A deadlock case with recursive locks involved is as follow:
500+A deadlock case with recursive locks involved is as follow::
495501
496502 TASK A: TASK B:
497503
@@ -510,7 +516,7 @@ because there are 3 types for lockers, there are, in theory, 9 types of lock · 12 unmodified lines
510516 dependencies, but we can show that 4 types of lock dependencies are enough for
511517 deadlock detection.
512518
513−For each lock dependency:
519+For each lock dependency::
514520
515521 L1 -> L2
516522
@@ -525,20 +531,25 @@ same types). · 8 unmodified lines
525531 With the above combination for simplification, there are 4 types of dependency edges
526532 in the lockdep graph:
527533
528−1) -(ER)->: exclusive writer to recursive reader dependency, "X -(ER)-> Y" means
534+1) -(ER)->:
535+ exclusive writer to recursive reader dependency, "X -(ER)-> Y" means
529536 X -> Y and X is a writer and Y is a recursive reader.
530537
531−2) -(EN)->: exclusive writer to non-recursive locker dependency, "X -(EN)-> Y" means
538+2) -(EN)->:
539+ exclusive writer to non-recursive locker dependency, "X -(EN)-> Y" means
532540 X -> Y and X is a writer and Y is either a writer or non-recursive reader.
533541
534−3) -(SR)->: shared reader to recursive reader dependency, "X -(SR)-> Y" means
542+3) -(SR)->:
543+ shared reader to recursive reader dependency, "X -(SR)-> Y" means
535544 X -> Y and X is a reader (recursive or not) and Y is a recursive reader.
536545
537−4) -(SN)->: shared reader to non-recursive locker dependency, "X -(SN)-> Y" means
546+4) -(SN)->:
547+ shared reader to non-recursive locker dependency, "X -(SN)-> Y" means
538548 X -> Y and X is a reader (recursive or not) and Y is either a writer or
539549 non-recursive reader.
540550
541−Note that given two locks, they may have multiple dependencies between them, for example:
551+Note that given two locks, they may have multiple dependencies between them,
552+for example::
542553
543554 TASK A:
544555
@@ -592,11 +603,11 @@ circles that won't cause deadlocks. · 47 unmodified lines
592603
593604 Proof for sufficiency (Lemma 1):
594605
595−Let's say we have a strong circle:
606+Let's say we have a strong circle::
596607
597608 L1 -> L2 ... -> Ln -> L1
598609
599−, which means we have dependencies:
610+, which means we have dependencies::
600611
601612 L1 -> L2
602613 L2 -> L3
@@ -633,7 +644,7 @@ a lock held by P2, and P2 is waiting for a lock held by P3, ... and Pn is waitin · 30 unmodified lines
633644 for a lock held by P1. Let's name the lock Px is waiting as Lx, so since P1 is waiting
634645 for L1 and holding Ln, so we will have Ln -> L1 in the dependency graph. Similarly,
635646 we have L1 -> L2, L2 -> L3, ..., Ln-1 -> Ln in the dependency graph, which means we
636−have a circle:
647+have a circle::
637648
638649 Ln -> L1 -> L2 -> ... -> Ln
639650
Documentation/misc-devices/index.rst+0−1
@@ -24,7 +24,6 @@ fit into other categories. · 23 unmodified lines
2424 isl29003
2525 lis3lv02d
2626 max6875
27− mic/index
2827 pci-endpoint-test
2928 spear-pcie-gadget
3029 uacce
Documentation/networking/devlink/ice.rst+1−0
@@ -70,6 +70,7 @@ The ``ice`` driver reports the following versions · 69 unmodified lines
7070 that both the name (as reported by ``fw.app.name``) and version are
7171 required to uniquely identify the package.
7272 * - ``fw.app.bundle_id``
73+ - running
7374 - 0xc0000001
7475 - Unique identifier for the DDP package loaded in the device. Also
7576 referred to as the DDP Track ID. Can be used to uniquely identify
Documentation/networking/j1939.rst+60−60
@@ -10,9 +10,9 @@ Overview / What Is J1939 · 9 unmodified lines
1010 SAE J1939 defines a higher layer protocol on CAN. It implements a more
1111 sophisticated addressing scheme and extends the maximum packet size above 8
1212 bytes. Several derived specifications exist, which differ from the original
13−J1939 on the application level, like MilCAN A, NMEA2000 and especially
13+J1939 on the application level, like MilCAN A, NMEA2000, and especially
1414 ISO-11783 (ISOBUS). This last one specifies the so-called ETP (Extended
15−Transport Protocol) which is has been included in this implementation. This
15+Transport Protocol), which has been included in this implementation. This
1616 results in a maximum packet size of ((2 ^ 24) - 1) * 7 bytes == 111 MiB.
1717
1818 Specifications used
@@ -32,15 +32,15 @@ sockets, we found some reasons to justify a kernel implementation for the · 13 unmodified lines
3232 addressing and transport methods used by J1939.
3333
3434 * **Addressing:** when a process on an ECU communicates via J1939, it should
35− not necessarily know its source address. Although at least one process per
35+ not necessarily know its source address. Although, at least one process per
3636 ECU should know the source address. Other processes should be able to reuse
3737 that address. This way, address parameters for different processes
3838 cooperating for the same ECU, are not duplicated. This way of working is
39− closely related to the UNIX concept where programs do just one thing, and do
39+ closely related to the UNIX concept, where programs do just one thing and do
4040 it well.
4141
4242 * **Dynamic addressing:** Address Claiming in J1939 is time critical.
43− Furthermore data transport should be handled properly during the address
43+ Furthermore, data transport should be handled properly during the address
4444 negotiation. Putting this functionality in the kernel eliminates it as a
4545 requirement for _every_ user space process that communicates via J1939. This
4646 results in a consistent J1939 bus with proper addressing.
@@ -58,7 +58,7 @@ Therefore, these parts are left to user space. · 11 unmodified lines
5858
5959 The J1939 sockets operate on CAN network devices (see SocketCAN). Any J1939
6060 user space library operating on CAN raw sockets will still operate properly.
61−Since such library does not communicate with the in-kernel implementation, care
61+Since such a library does not communicate with the in-kernel implementation, care
6262 must be taken that these two do not interfere. In practice, this means they
6363 cannot share ECU addresses. A single ECU (or virtual ECU) address is used by
6464 the library exclusively, or by the in-kernel system exclusively.
@@ -77,13 +77,13 @@ is composed as follows: · 12 unmodified lines
7777 8 bits : PS (PDU Specific)
7878
7979 In J1939-21 distinction is made between PDU1 format (where PF < 240) and PDU2
80−format (where PF >= 240). Furthermore, when using PDU2 format, the PS-field
80+format (where PF >= 240). Furthermore, when using the PDU2 format, the PS-field
8181 contains a so-called Group Extension, which is part of the PGN. When using PDU2
8282 format, the Group Extension is set in the PS-field.
8383
8484 On the other hand, when using PDU1 format, the PS-field contains a so-called
8585 Destination Address, which is _not_ part of the PGN. When communicating a PGN
86−from user space to kernel (or visa versa) and PDU2 format is used, the PS-field
86+from user space to kernel (or vice versa) and PDU2 format is used, the PS-field
8787 of the PGN shall be set to zero. The Destination Address shall be set
8888 elsewhere.
8989
@@ -96,15 +96,15 @@ Addressing · 6 unmodified lines
9696
9797 Both static and dynamic addressing methods can be used.
9898
99−For static addresses, no extra checks are made by the kernel, and provided
99+For static addresses, no extra checks are made by the kernel and provided
100100 addresses are considered right. This responsibility is for the OEM or system
101101 integrator.
102102
103103 For dynamic addressing, so-called Address Claiming, extra support is foreseen
104−in the kernel. In J1939 any ECU is known by it's 64-bit NAME. At the moment of
104+in the kernel. In J1939 any ECU is known by its 64-bit NAME. At the moment of
105105 a successful address claim, the kernel keeps track of both NAME and source
106106 address being claimed. This serves as a base for filter schemes. By default,
107−packets with a destination that is not locally, will be rejected.
107+packets with a destination that is not locally will be rejected.
108108
109109 Mixed mode packets (from a static to a dynamic address or vice versa) are
110110 allowed. The BSD sockets define separate API calls for getting/setting the
@@ -131,31 +131,31 @@ API Calls · 20 unmodified lines
131131 ---------
132132
133133 On CAN, you first need to open a socket for communicating over a CAN network.
134−To use J1939, #include <linux/can/j1939.h>. From there, <linux/can.h> will be
134+To use J1939, ``#include <linux/can/j1939.h>``. From there, ``<linux/can.h>`` will be
135135 included too. To open a socket, use:
136136
137137 .. code-block:: C
138138
139139 s = socket(PF_CAN, SOCK_DGRAM, CAN_J1939);
140140
141−J1939 does use SOCK_DGRAM sockets. In the J1939 specification, connections are
141+J1939 does use ``SOCK_DGRAM`` sockets. In the J1939 specification, connections are
142142 mentioned in the context of transport protocol sessions. These still deliver
143−packets to the other end (using several CAN packets). SOCK_STREAM is not
143+packets to the other end (using several CAN packets). ``SOCK_STREAM`` is not
144144 supported.
145145
146−After the successful creation of the socket, you would normally use the bind(2)
147−and/or connect(2) system call to bind the socket to a CAN interface. After
148−binding and/or connecting the socket, you can read(2) and write(2) from/to the
149−socket or use send(2), sendto(2), sendmsg(2) and the recv*() counterpart
146+After the successful creation of the socket, you would normally use the ``bind(2)``
147+and/or ``connect(2)`` system call to bind the socket to a CAN interface. After
148+binding and/or connecting the socket, you can ``read(2)`` and ``write(2)`` from/to the
149+socket or use ``send(2)``, ``sendto(2)``, ``sendmsg(2)`` and the ``recv*()`` counterpart
150150 operations on the socket as usual. There are also J1939 specific socket options
151151 described below.
152152
153−In order to send data, a bind(2) must have been successful. bind(2) assigns a
153+In order to send data, a ``bind(2)`` must have been successful. ``bind(2)`` assigns a
154154 local address to a socket.
155155
156−Different from CAN is that the payload data is just the data that get send,
157−without it's header info. The header info is derived from the sockaddr supplied
158−to bind(2), connect(2), sendto(2) and recvfrom(2). A write(2) with size 4 will
156+Different from CAN is that the payload data is just the data that get sends,
157+without its header info. The header info is derived from the sockaddr supplied
158+to ``bind(2)``, ``connect(2)``, ``sendto(2)`` and ``recvfrom(2)``. A ``write(2)`` with size 4 will
159159 result in a packet with 4 bytes.
160160
161161 The sockaddr structure has extensions for use with J1939 as specified below:
@@ -180,47 +180,47 @@ The sockaddr structure has extensions for use with J1939 as specified below: · 18 unmodified lines
180180 } can_addr;
181181 }
182182
183−can_family & can_ifindex serve the same purpose as for other SocketCAN sockets.
183+``can_family`` & ``can_ifindex`` serve the same purpose as for other SocketCAN sockets.
184184
185−can_addr.j1939.pgn specifies the PGN (max 0x3ffff). Individual bits are
185+``can_addr.j1939.pgn`` specifies the PGN (max 0x3ffff). Individual bits are
186186 specified above.
187187
188−can_addr.j1939.name contains the 64-bit J1939 NAME.
188+``can_addr.j1939.name`` contains the 64-bit J1939 NAME.
189189
190−can_addr.j1939.addr contains the address.
190+``can_addr.j1939.addr`` contains the address.
191191
192−The bind(2) system call assigns the local address, i.e. the source address when
193−sending packages. If a PGN during bind(2) is set, it's used as a RX filter.
194−I.e. only packets with a matching PGN are received. If an ADDR or NAME is set
192+The ``bind(2)`` system call assigns the local address, i.e. the source address when
193+sending packages. If a PGN during ``bind(2)`` is set, it's used as a RX filter.
194+I.e. only packets with a matching PGN are received. If an ADDR or NAME is set
195195 it is used as a receive filter, too. It will match the destination NAME or ADDR
196196 of the incoming packet. The NAME filter will work only if appropriate Address
197197 Claiming for this name was done on the CAN bus and registered/cached by the
198198 kernel.
199199
200−On the other hand connect(2) assigns the remote address, i.e. the destination
201−address. The PGN from connect(2) is used as the default PGN when sending
200+On the other hand ``connect(2)`` assigns the remote address, i.e. the destination
201+address. The PGN from ``connect(2)`` is used as the default PGN when sending
202202 packets. If ADDR or NAME is set it will be used as the default destination ADDR
203−or NAME. Further a set ADDR or NAME during connect(2) is used as a receive
203+or NAME. Further a set ADDR or NAME during ``connect(2)`` is used as a receive
204204 filter. It will match the source NAME or ADDR of the incoming packet.
205205
206−Both write(2) and send(2) will send a packet with local address from bind(2) and
207−the remote address from connect(2). Use sendto(2) to overwrite the destination
206+Both ``write(2)`` and ``send(2)`` will send a packet with local address from ``bind(2)`` and the
207+remote address from ``connect(2)``. Use ``sendto(2)`` to overwrite the destination
208208 address.
209209
210−If can_addr.j1939.name is set (!= 0) the NAME is looked up by the kernel and
211−the corresponding ADDR is used. If can_addr.j1939.name is not set (== 0),
212−can_addr.j1939.addr is used.
210+If ``can_addr.j1939.name`` is set (!= 0) the NAME is looked up by the kernel and
211+the corresponding ADDR is used. If ``can_addr.j1939.name`` is not set (== 0),
212+``can_addr.j1939.addr`` is used.
213213
214214 When creating a socket, reasonable defaults are set. Some options can be
215−modified with setsockopt(2) & getsockopt(2).
215+modified with ``setsockopt(2)`` & ``getsockopt(2)``.
216216
217217 RX path related options:
218218
219−- SO_J1939_FILTER - configure array of filters
220−- SO_J1939_PROMISC - disable filters set by bind(2) and connect(2)
219+- ``SO_J1939_FILTER`` - configure array of filters
220+- ``SO_J1939_PROMISC`` - disable filters set by ``bind(2)`` and ``connect(2)``
221221
222222 By default no broadcast packets can be send or received. To enable sending or
223−receiving broadcast packets use the socket option SO_BROADCAST:
223+receiving broadcast packets use the socket option ``SO_BROADCAST``:
224224
225225 .. code-block:: C
226226
@@ -261,26 +261,26 @@ The following diagram illustrates the RX path: · 34 unmodified lines
261261 +---------------------------+
262262
263263 TX path related options:
264−SO_J1939_SEND_PRIO - change default send priority for the socket
264+``SO_J1939_SEND_PRIO`` - change default send priority for the socket
265265
266266 Message Flags during send() and Related System Calls
267267 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
268268
269−send(2), sendto(2) and sendmsg(2) take a 'flags' argument. Currently
269+``send(2)``, ``sendto(2)`` and ``sendmsg(2)`` take a 'flags' argument. Currently
270270 supported flags are:
271271
272−* MSG_DONTWAIT, i.e. non-blocking operation.
272+* ``MSG_DONTWAIT``, i.e. non-blocking operation.
273273
274274 recvmsg(2)
275275 ^^^^^^^^^^
276276
277−In most cases recvmsg(2) is needed if you want to extract more information than
278−recvfrom(2) can provide. For example package priority and timestamp. The
277+In most cases ``recvmsg(2)`` is needed if you want to extract more information than
278+``recvfrom(2)`` can provide. For example package priority and timestamp. The
279279 Destination Address, name and packet priority (if applicable) are attached to
280−the msghdr in the recvmsg(2) call. They can be extracted using cmsg(3) macros,
281−with cmsg_level == SOL_J1939 && cmsg_type == SCM_J1939_DEST_ADDR,
282−SCM_J1939_DEST_NAME or SCM_J1939_PRIO. The returned data is a uint8_t for
283−priority and dst_addr, and uint64_t for dst_name.
280+the msghdr in the ``recvmsg(2)`` call. They can be extracted using ``cmsg(3)`` macros,
281+with ``cmsg_level == SOL_J1939 && cmsg_type == SCM_J1939_DEST_ADDR``,
282+``SCM_J1939_DEST_NAME`` or ``SCM_J1939_PRIO``. The returned data is a ``uint8_t`` for
283+``priority`` and ``dst_addr``, and ``uint64_t`` for ``dst_name``.
284284
285285 .. code-block:: C
286286
@@ -305,12 +305,12 @@ Dynamic Addressing · 18 unmodified lines
305305
306306 Distinction has to be made between using the claimed address and doing an
307307 address claim. To use an already claimed address, one has to fill in the
308−j1939.name member and provide it to bind(2). If the name had claimed an address
308+``j1939.name`` member and provide it to ``bind(2)``. If the name had claimed an address
309309 earlier, all further messages being sent will use that address. And the
310−j1939.addr member will be ignored.
310+``j1939.addr`` member will be ignored.
311311
312312 An exception on this is PGN 0x0ee00. This is the "Address Claim/Cannot Claim
313−Address" message and the kernel will use the j1939.addr member for that PGN if
313+Address" message and the kernel will use the ``j1939.addr`` member for that PGN if
314314 necessary.
315315
316316 To claim an address following code example can be used:
@@ -371,12 +371,12 @@ NAME can send packets. · 54 unmodified lines
371371
372372 If another ECU claims the address, the kernel will mark the NAME-SA expired.
373373 No socket bound to the NAME can send packets (other than address claims). To
374−claim another address, some socket bound to NAME, must bind(2) again, but with
375−only j1939.addr changed to the new SA, and must then send a valid address claim
374+claim another address, some socket bound to NAME, must ``bind(2)`` again, but with
375+only ``j1939.addr`` changed to the new SA, and must then send a valid address claim
376376 packet. This restarts the state machine in the kernel (and any other
377377 participant on the bus) for this NAME.
378378
379−can-utils also include the jacd tool, so it can be used as code example or as
379+``can-utils`` also include the ``j1939acd`` tool, so it can be used as code example or as
380380 default Address Claiming daemon.
381381
382382 Send Examples
@@ -403,8 +403,8 @@ Bind: · 20 unmodified lines
403403
404404 bind(sock, (struct sockaddr *)&baddr, sizeof(baddr));
405405
406−Now, the socket 'sock' is bound to the SA 0x20. Since no connect(2) was called,
407−at this point we can use only sendto(2) or sendmsg(2).
406+Now, the socket 'sock' is bound to the SA 0x20. Since no ``connect(2)`` was called,
407+at this point we can use only ``sendto(2)`` or ``sendmsg(2)``.
408408
409409 Send:
410410
@@ -414,8 +414,8 @@ Send: · 3 unmodified lines
414414 .can_family = AF_CAN,
415415 .can_addr.j1939 = {
416416 .name = J1939_NO_NAME;
417− .pgn = 0x30,
418− .addr = 0x12300,
417+ .addr = 0x30,
418+ .pgn = 0x12300,
419419 },
420420 };
421421
Documentation/networking/statistics.rst+1−2
@@ -175,5 +175,4 @@ The following structures are internal to the kernel, their members are · 174 unmodified lines
175175 translated to netlink attributes when dumped. Drivers must not overwrite
176176 the statistics they don't report with 0.
177177
178−.. kernel-doc:: include/linux/ethtool.h
179− :identifiers: ethtool_pause_stats
178+- ethtool_pause_stats()
Documentation/sphinx/automarkup.py+14−6
@@ -15,6 +15,14 @@ else: · 14 unmodified lines
1515 import re
1616 from itertools import chain
1717
18+#
19+# Python 2 lacks re.ASCII...
20+#
21+try:
22+ ascii_p3 = re.ASCII
23+except AttributeError:
24+ ascii_p3 = 0
25+
1826 #
1927 # Regex nastiness. Of course.
2028 # Try to identify "function()" that's not already marked up some
@@ -22,22 +30,22 @@ from itertools import chain · 1 unmodified line
2230 # :c:func: block (i.e. ":c:func:`mmap()`s" flakes out), so the last
2331 # bit tries to restrict matches to things that won't create trouble.
2432 #
25−RE_function = re.compile(r'\b(([a-zA-Z_]\w+)\(\))', flags=re.ASCII)
33+RE_function = re.compile(r'\b(([a-zA-Z_]\w+)\(\))', flags=ascii_p3)
2634
2735 #
2836 # Sphinx 2 uses the same :c:type role for struct, union, enum and typedef
2937 #
3038 RE_generic_type = re.compile(r'\b(struct|union|enum|typedef)\s+([a-zA-Z_]\w+)',
31− flags=re.ASCII)
39+ flags=ascii_p3)
3240
3341 #
3442 # Sphinx 3 uses a different C role for each one of struct, union, enum and
3543 # typedef
3644 #
37−RE_struct = re.compile(r'\b(struct)\s+([a-zA-Z_]\w+)', flags=re.ASCII)
38−RE_union = re.compile(r'\b(union)\s+([a-zA-Z_]\w+)', flags=re.ASCII)
39−RE_enum = re.compile(r'\b(enum)\s+([a-zA-Z_]\w+)', flags=re.ASCII)
40−RE_typedef = re.compile(r'\b(typedef)\s+([a-zA-Z_]\w+)', flags=re.ASCII)
45+RE_struct = re.compile(r'\b(struct)\s+([a-zA-Z_]\w+)', flags=ascii_p3)
46+RE_union = re.compile(r'\b(union)\s+([a-zA-Z_]\w+)', flags=ascii_p3)
47+RE_enum = re.compile(r'\b(enum)\s+([a-zA-Z_]\w+)', flags=ascii_p3)
48+RE_typedef = re.compile(r'\b(typedef)\s+([a-zA-Z_]\w+)', flags=ascii_p3)
4149
4250 #
4351 # Detects a reference to a documentation page of the form Documentation/... with
Documentation/userspace-api/index.rst+1−0
@@ -22,6 +22,7 @@ place where this information is gathered. · 21 unmodified lines
2222 spec_ctrl
2323 accelerators/ocxl
2424 ioctl/index
25+ iommu
2526 media/index
2627
2728 .. only:: subproject and html
MAINTAINERS+13−6
@@ -978,7 +978,7 @@ M: Michael Hennerich <Michael.Hennerich@analog.com> · 977 unmodified lines
978978 L: linux-iio@vger.kernel.org
979979 S: Supported
980980 W: http://ez.analog.com/community/linux-device-drivers
981−F: Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.txt
981+F: Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.yaml
982982 F: drivers/iio/adc/ad7768-1.c
983983
984984 ANALOG DEVICES INC AD7780 DRIVER
@@ -3857,7 +3857,7 @@ M: Roger Quadros <rogerq@ti.com> · 2872 unmodified lines
38573857 L: linux-usb@vger.kernel.org
38583858 S: Maintained
38593859 T: git git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb.git
3860−F: Documentation/devicetree/bindings/usb/cdns-usb3.txt
3860+F: Documentation/devicetree/bindings/usb/cdns,usb3.yaml
38613861 F: drivers/usb/cdns3/
38623862
38633863 CADET FM/AM RADIO RECEIVER DRIVER
@@ -7923,7 +7923,7 @@ HISILICON LPC BUS DRIVER · 4059 unmodified lines
79237923 M: john.garry@huawei.com
79247924 S: Maintained
79257925 W: http://www.hisilicon.com
7926−F: Documentation/devicetree/bindings/arm/hisilicon/hisilicon-low-pin-count.txt
7926+F: Documentation/devicetree/bindings/arm/hisilicon/low-pin-count.yaml
79277927 F: drivers/bus/hisi_lpc.c
79287928
79297929 HISILICON NETWORK SUBSYSTEM 3 DRIVER (HNS3)
@@ -11170,7 +11170,7 @@ F: Documentation/devicetree/bindings/input/touchscreen/melfas_mip4.txt · 3240 unmodified lines
1117011170 F: drivers/input/touchscreen/melfas_mip4.c
1117111171
1117211172 MELLANOX BLUEFIELD I2C DRIVER
11173−M: Khalil Blaiech <kblaiech@mellanox.com>
11173+M: Khalil Blaiech <kblaiech@nvidia.com>
1117411174 L: linux-i2c@vger.kernel.org
1117511175 S: Supported
1117611176 F: drivers/i2c/busses/i2c-mlxbf.c
@@ -14534,6 +14534,14 @@ F: Documentation/devicetree/bindings/mailbox/qcom-ipcc.yaml · 3357 unmodified lines
1453414534 F: drivers/mailbox/qcom-ipcc.c
1453514535 F: include/dt-bindings/mailbox/qcom-ipcc.h
1453614536
14537+QUALCOMM IPQ4019 VQMMC REGULATOR DRIVER
14538+M: Robert Marko <robert.marko@sartura.hr>
14539+M: Luka Perkov <luka.perkov@sartura.hr>
14540+L: linux-arm-msm@vger.kernel.org
14541+S: Maintained
14542+F: Documentation/devicetree/bindings/regulator/vqmmc-ipq4019-regulator.yaml
14543+F: drivers/regulator/vqmmc-ipq4019-regulator.c
14544+
1453714545 QUALCOMM RMNET DRIVER
1453814546 M: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
1453914547 M: Sean Tranchetti <stranche@codeaurora.org>
@@ -14889,7 +14897,6 @@ RENESAS ETHERNET DRIVERS · 349 unmodified lines
1488914897 R: Sergei Shtylyov <sergei.shtylyov@gmail.com>
1489014898 L: netdev@vger.kernel.org
1489114899 L: linux-renesas-soc@vger.kernel.org
14892−F: Documentation/devicetree/bindings/net/renesas,*.txt
1489314900 F: Documentation/devicetree/bindings/net/renesas,*.yaml
1489414901 F: drivers/net/ethernet/renesas/
1489514902 F: include/linux/sh_eth.h
@@ -18090,7 +18097,7 @@ M: Yu Chen <chenyu56@huawei.com> · 3194 unmodified lines
1809018097 M: Binghui Wang <wangbinghui@hisilicon.com>
1809118098 L: linux-usb@vger.kernel.org
1809218099 S: Maintained
18093−F: Documentation/devicetree/bindings/phy/phy-hi3660-usb3.txt
18100+F: Documentation/devicetree/bindings/phy/hisilicon,hi3660-usb3.yaml
1809418101 F: drivers/phy/hisilicon/phy-hi3660-usb3.c
1809518102
1809618103 USB ISP116X DRIVER
Makefile+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 VERSION = 5
33 PATCHLEVEL = 10
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc2
5+EXTRAVERSION = -rc3
66 NAME = Kleptomaniac Octopus
77
88 # *DOCUMENTATION*
arch/arc/kernel/head.S+16−1
@@ -67,7 +67,22 @@ · 66 unmodified lines
6767 sr r5, [ARC_REG_LPB_CTRL]
6868 1:
6969 #endif /* CONFIG_ARC_LPB_DISABLE */
70−#endif
70+
71+ /* On HSDK, CCMs need to remapped super early */
72+#ifdef CONFIG_ARC_SOC_HSDK
73+ mov r6, 0x60000000
74+ lr r5, [ARC_REG_ICCM_BUILD]
75+ breq r5, 0, 1f
76+ sr r6, [ARC_REG_AUX_ICCM]
77+1:
78+ lr r5, [ARC_REG_DCCM_BUILD]
79+ breq r5, 0, 2f
80+ sr r6, [ARC_REG_AUX_DCCM]
81+2:
82+#endif /* CONFIG_ARC_SOC_HSDK */
83+
84+#endif /* CONFIG_ISA_ARCV2 */
85+
7186 ; Config DSP_CTRL properly, so kernel may use integer multiply,
7287 ; multiply-accumulate, and divide operations
7388 DSP_EARLY_INIT
arch/arc/kernel/stacktrace.c+6−1
@@ -112,7 +112,7 @@ arc_unwind_core(struct task_struct *tsk, struct pt_regs *regs, · 111 unmodified lines
112112 int (*consumer_fn) (unsigned int, void *), void *arg)
113113 {
114114 #ifdef CONFIG_ARC_DW2_UNWIND
115− int ret = 0;
115+ int ret = 0, cnt = 0;
116116 unsigned int address;
117117 struct unwind_frame_info frame_info;
118118
@@ -132,6 +132,11 @@ arc_unwind_core(struct task_struct *tsk, struct pt_regs *regs, · 13 unmodified lines
132132 break;
133133
134134 frame_info.regs.r63 = frame_info.regs.r31;
135+
136+ if (cnt++ > 128) {
137+ printk("unwinder looping too long, aborting !\n");
138+ return 0;
139+ }
135140 }
136141
137142 return address; /* return the last address it saw */
arch/arc/plat-hsdk/platform.c+0−17
@@ -17,22 +17,6 @@ int arc_hsdk_axi_dmac_coherent __section(".data") = 0; · 16 unmodified lines
1717
1818 #define ARC_CCM_UNUSED_ADDR 0x60000000
1919
20−static void __init hsdk_init_per_cpu(unsigned int cpu)
21−{
22− /*
23− * By default ICCM is mapped to 0x7z while this area is used for
24− * kernel virtual mappings, so move it to currently unused area.
25− */
26− if (cpuinfo_arc700[cpu].iccm.sz)
27− write_aux_reg(ARC_REG_AUX_ICCM, ARC_CCM_UNUSED_ADDR);
28−
29− /*
30− * By default DCCM is mapped to 0x8z while this area is used by kernel,
31− * so move it to currently unused area.
32− */
33− if (cpuinfo_arc700[cpu].dccm.sz)
34− write_aux_reg(ARC_REG_AUX_DCCM, ARC_CCM_UNUSED_ADDR);
35−}
3620
3721 #define ARC_PERIPHERAL_BASE 0xf0000000
3822 #define CREG_BASE (ARC_PERIPHERAL_BASE + 0x1000)
@@ -339,5 +323,4 @@ static const char *hsdk_compat[] __initconst = { · 300 unmodified lines
339323 MACHINE_START(SIMULATION, "hsdk")
340324 .dt_compat = hsdk_compat,
341325 .init_early = hsdk_init_early,
342− .init_per_cpu = hsdk_init_per_cpu,
343326 MACHINE_END
arch/arm/mm/init.c+2−2
@@ -354,8 +354,8 @@ static void __init free_highpages(void) · 353 unmodified lines
354354 /* set highmem page free */
355355 for_each_free_mem_range(i, NUMA_NO_NODE, MEMBLOCK_NONE,
356356 &range_start, &range_end, NULL) {
357− unsigned long start = PHYS_PFN(range_start);
358− unsigned long end = PHYS_PFN(range_end);
357+ unsigned long start = PFN_UP(range_start);
358+ unsigned long end = PFN_DOWN(range_end);
359359
360360 /* Ignore complete lowmem entries */
361361 if (end <= max_low)
arch/arm64/Kconfig+1−1
@@ -1002,7 +1002,7 @@ config NUMA · 1001 unmodified lines
10021002 config NODES_SHIFT
10031003 int "Maximum NUMA Nodes (as a power of 2)"
10041004 range 1 10
1005− default "2"
1005+ default "4"
10061006 depends on NEED_MULTIPLE_NODES
10071007 help
10081008 Specify the maximum number of NUMA Nodes available on the target
arch/arm64/include/asm/brk-imm.h+2−0
@@ -10,6 +10,7 @@ · 9 unmodified lines
1010 * #imm16 values used for BRK instruction generation
1111 * 0x004: for installing kprobes
1212 * 0x005: for installing uprobes
13+ * 0x006: for kprobe software single-step
1314 * Allowed values for kgdb are 0x400 - 0x7ff
1415 * 0x100: for triggering a fault on purpose (reserved)
1516 * 0x400: for dynamic BRK instruction
@@ -19,6 +20,7 @@ · 3 unmodified lines
1920 */
2021 #define KPROBES_BRK_IMM 0x004
2122 #define UPROBES_BRK_IMM 0x005
23+#define KPROBES_BRK_SS_IMM 0x006
2224 #define FAULT_BRK_IMM 0x100
2325 #define KGDB_DYN_DBG_BRK_IMM 0x400
2426 #define KGDB_COMPILED_DBG_BRK_IMM 0x401
arch/arm64/include/asm/debug-monitors.h+1−0
@@ -53,6 +53,7 @@ · 52 unmodified lines
5353
5454 /* kprobes BRK opcodes with ESR encoding */
5555 #define BRK64_OPCODE_KPROBES (AARCH64_BREAK_MON | (KPROBES_BRK_IMM << 5))
56+#define BRK64_OPCODE_KPROBES_SS (AARCH64_BREAK_MON | (KPROBES_BRK_SS_IMM << 5))
5657 /* uprobes BRK opcodes with ESR encoding */
5758 #define BRK64_OPCODE_UPROBES (AARCH64_BREAK_MON | (UPROBES_BRK_IMM << 5))
5859
arch/arm64/include/asm/kprobes.h+1−1
@@ -16,7 +16,7 @@ · 15 unmodified lines
1616 #include <linux/percpu.h>
1717
1818 #define __ARCH_WANT_KPROBES_INSN_SLOT
19−#define MAX_INSN_SIZE 1
19+#define MAX_INSN_SIZE 2
2020
2121 #define flush_insn_slot(p) do { } while (0)
2222 #define kretprobe_blacklist_size 0
arch/arm64/kernel/kexec_image.c+31−10
@@ -43,7 +43,7 @@ static void *image_load(struct kimage *image, · 42 unmodified lines
4343 u64 flags, value;
4444 bool be_image, be_kernel;
4545 struct kexec_buf kbuf;
46− unsigned long text_offset;
46+ unsigned long text_offset, kernel_segment_number;
4747 struct kexec_segment *kernel_segment;
4848 int ret;
4949
@@ -88,11 +88,37 @@ static void *image_load(struct kimage *image, · 38 unmodified lines
8888 /* Adjust kernel segment with TEXT_OFFSET */
8989 kbuf.memsz += text_offset;
9090
91− ret = kexec_add_buffer(&kbuf);
92− if (ret)
91+ kernel_segment_number = image->nr_segments;
92+
93+ /*
94+ * The location of the kernel segment may make it impossible to satisfy
95+ * the other segment requirements, so we try repeatedly to find a
96+ * location that will work.
97+ */
98+ while ((ret = kexec_add_buffer(&kbuf)) == 0) {
99+ /* Try to load additional data */
100+ kernel_segment = &image->segment[kernel_segment_number];
101+ ret = load_other_segments(image, kernel_segment->mem,
102+ kernel_segment->memsz, initrd,
103+ initrd_len, cmdline);
104+ if (!ret)
105+ break;
106+
107+ /*
108+ * We couldn't find space for the other segments; erase the
109+ * kernel segment and try the next available hole.
110+ */
111+ image->nr_segments -= 1;
112+ kbuf.buf_min = kernel_segment->mem + kernel_segment->memsz;
113+ kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
114+ }
115+
116+ if (ret) {
117+ pr_err("Could not find any suitable kernel location!");
93118 return ERR_PTR(ret);
119+ }
94120
95− kernel_segment = &image->segment[image->nr_segments - 1];
121+ kernel_segment = &image->segment[kernel_segment_number];
96122 kernel_segment->mem += text_offset;
97123 kernel_segment->memsz -= text_offset;
98124 image->start = kernel_segment->mem;
@@ -101,12 +127,7 @@ static void *image_load(struct kimage *image, · 2 unmodified lines
101127 kernel_segment->mem, kbuf.bufsz,
102128 kernel_segment->memsz);
103129
104− /* Load additional data */
105− ret = load_other_segments(image,
106− kernel_segment->mem, kernel_segment->memsz,
107− initrd, initrd_len, cmdline);
108−
109− return ERR_PTR(ret);
130+ return 0;
110131 }
111132
112133 #ifdef CONFIG_KEXEC_IMAGE_VERIFY_SIG
arch/arm64/kernel/machine_kexec_file.c+8−1
@@ -240,6 +240,11 @@ static int prepare_elf_headers(void **addr, unsigned long *sz) · 239 unmodified lines
240240 return ret;
241241 }
242242
243+/*
244+ * Tries to add the initrd and DTB to the image. If it is not possible to find
245+ * valid locations, this function will undo changes to the image and return non
246+ * zero.
247+ */
243248 int load_other_segments(struct kimage *image,
244249 unsigned long kernel_load_addr,
245250 unsigned long kernel_size,
@@ -248,7 +253,8 @@ int load_other_segments(struct kimage *image, · 2 unmodified lines
248253 {
249254 struct kexec_buf kbuf;
250255 void *headers, *dtb = NULL;
251− unsigned long headers_sz, initrd_load_addr = 0, dtb_len;
256+ unsigned long headers_sz, initrd_load_addr = 0, dtb_len,
257+ orig_segments = image->nr_segments;
252258 int ret = 0;
253259
254260 kbuf.image = image;
@@ -334,6 +340,7 @@ int load_other_segments(struct kimage *image, · 79 unmodified lines
334340 return 0;
335341
336342 out_err:
343+ image->nr_segments = orig_segments;
337344 vfree(dtb);
338345 return ret;
339346 }
arch/arm64/kernel/probes/kprobes.c+23−46
@@ -36,25 +36,16 @@ DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); · 35 unmodified lines
3636 static void __kprobes
3737 post_kprobe_handler(struct kprobe_ctlblk *, struct pt_regs *);
3838
39−static int __kprobes patch_text(kprobe_opcode_t *addr, u32 opcode)
40−{
41− void *addrs[1];
42− u32 insns[1];
43−
44− addrs[0] = addr;
45− insns[0] = opcode;
46−
47− return aarch64_insn_patch_text(addrs, insns, 1);
48−}
49−
5039 static void __kprobes arch_prepare_ss_slot(struct kprobe *p)
5140 {
41+ kprobe_opcode_t *addr = p->ainsn.api.insn;
42+ void *addrs[] = {addr, addr + 1};
43+ u32 insns[] = {p->opcode, BRK64_OPCODE_KPROBES_SS};
44+
5245 /* prepare insn slot */
53− patch_text(p->ainsn.api.insn, p->opcode);
46+ aarch64_insn_patch_text(addrs, insns, 2);
5447
55− flush_icache_range((uintptr_t) (p->ainsn.api.insn),
56− (uintptr_t) (p->ainsn.api.insn) +
57− MAX_INSN_SIZE * sizeof(kprobe_opcode_t));
48+ flush_icache_range((uintptr_t)addr, (uintptr_t)(addr + MAX_INSN_SIZE));
5849
5950 /*
6051 * Needs restoring of return address after stepping xol.
@@ -128,13 +119,18 @@ void *alloc_insn_page(void) · 67 unmodified lines
128119 /* arm kprobe: install breakpoint in text */
129120 void __kprobes arch_arm_kprobe(struct kprobe *p)
130121 {
131− patch_text(p->addr, BRK64_OPCODE_KPROBES);
122+ void *addr = p->addr;
123+ u32 insn = BRK64_OPCODE_KPROBES;
124+
125+ aarch64_insn_patch_text(&addr, &insn, 1);
132126 }
133127
134128 /* disarm kprobe: remove breakpoint from text */
135129 void __kprobes arch_disarm_kprobe(struct kprobe *p)
136130 {
137− patch_text(p->addr, p->opcode);
131+ void *addr = p->addr;
132+
133+ aarch64_insn_patch_text(&addr, &p->opcode, 1);
138134 }
139135
140136 void __kprobes arch_remove_kprobe(struct kprobe *p)
@@ -163,20 +159,15 @@ static void __kprobes set_current_kprobe(struct kprobe *p) · 22 unmodified lines
163159 }
164160
165161 /*
166− * Interrupts need to be disabled before single-step mode is set, and not
167− * reenabled until after single-step mode ends.
168− * Without disabling interrupt on local CPU, there is a chance of
169− * interrupt occurrence in the period of exception return and start of
170− * out-of-line single-step, that result in wrongly single stepping
171− * into the interrupt handler.
162+ * Mask all of DAIF while executing the instruction out-of-line, to keep things
163+ * simple and avoid nesting exceptions. Interrupts do have to be disabled since
164+ * the kprobe state is per-CPU and doesn't get migrated.
172165 */
173166 static void __kprobes kprobes_save_local_irqflag(struct kprobe_ctlblk *kcb,
174167 struct pt_regs *regs)
175168 {
176169 kcb->saved_irqflag = regs->pstate & DAIF_MASK;
177− regs->pstate |= PSR_I_BIT;
178− /* Unmask PSTATE.D for enabling software step exceptions. */
179− regs->pstate &= ~PSR_D_BIT;
170+ regs->pstate |= DAIF_MASK;
180171 }
181172
182173 static void __kprobes kprobes_restore_local_irqflag(struct kprobe_ctlblk *kcb,
@@ -219,10 +210,7 @@ static void __kprobes setup_singlestep(struct kprobe *p, · 36 unmodified lines
219210 slot = (unsigned long)p->ainsn.api.insn;
220211
221212 set_ss_context(kcb, slot); /* mark pending ss */
222−
223− /* IRQs and single stepping do not mix well. */
224213 kprobes_save_local_irqflag(kcb, regs);
225− kernel_enable_single_step(regs);
226214 instruction_pointer_set(regs, slot);
227215 } else {
228216 /* insn simulation */
@@ -273,12 +261,8 @@ post_kprobe_handler(struct kprobe_ctlblk *kcb, struct pt_regs *regs) · 44 unmodified lines
273261 }
274262 /* call post handler */
275263 kcb->kprobe_status = KPROBE_HIT_SSDONE;
276− if (cur->post_handler) {
277− /* post_handler can hit breakpoint and single step
278− * again, so we enable D-flag for recursive exception.
279− */
264+ if (cur->post_handler)
280265 cur->post_handler(cur, regs, 0);
281− }
282266
283267 reset_current_kprobe();
284268 }
@@ -302,8 +286,6 @@ int __kprobes kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr) · 17 unmodified lines
302286 if (!instruction_pointer(regs))
303287 BUG();
304288
305− kernel_disable_single_step();
306−
307289 if (kcb->kprobe_status == KPROBE_REENTER)
308290 restore_previous_kprobe(kcb);
309291 else
@@ -365,10 +347,6 @@ static void __kprobes kprobe_handler(struct pt_regs *regs) · 55 unmodified lines
365347 * pre-handler and it returned non-zero, it will
366348 * modify the execution path and no need to single
367349 * stepping. Let's just reset current kprobe and exit.
368− *
369− * pre_handler can hit a breakpoint and can step thru
370− * before return, keep PSTATE D-flag enabled until
371− * pre_handler return back.
372350 */
373351 if (!p->pre_handler || !p->pre_handler(p, regs)) {
374352 setup_singlestep(p, regs, kcb, 0);
@@ -399,7 +377,7 @@ kprobe_ss_hit(struct kprobe_ctlblk *kcb, unsigned long addr) · 24 unmodified lines
399377 }
400378
401379 static int __kprobes
402−kprobe_single_step_handler(struct pt_regs *regs, unsigned int esr)
380+kprobe_breakpoint_ss_handler(struct pt_regs *regs, unsigned int esr)
403381 {
404382 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
405383 int retval;
@@ -409,16 +387,15 @@ kprobe_single_step_handler(struct pt_regs *regs, unsigned int esr) · 3 unmodified lines
409387
410388 if (retval == DBG_HOOK_HANDLED) {
411389 kprobes_restore_local_irqflag(kcb, regs);
412− kernel_disable_single_step();
413−
414390 post_kprobe_handler(kcb, regs);
415391 }
416392
417393 return retval;
418394 }
419395
420−static struct step_hook kprobes_step_hook = {
421− .fn = kprobe_single_step_handler,
396+static struct break_hook kprobes_break_ss_hook = {
397+ .imm = KPROBES_BRK_SS_IMM,
398+ .fn = kprobe_breakpoint_ss_handler,
422399 };
423400
424401 static int __kprobes
@@ -486,7 +463,7 @@ int __kprobes arch_trampoline_kprobe(struct kprobe *p) · 61 unmodified lines
486463 int __init arch_init_kprobes(void)
487464 {
488465 register_kernel_break_hook(&kprobes_break_hook);
489− register_kernel_step_hook(&kprobes_step_hook);
466+ register_kernel_break_hook(&kprobes_break_ss_hook);
490467
491468 return 0;
492469 }
arch/powerpc/include/asm/nohash/32/kup-8xx.h+1−1
@@ -63,7 +63,7 @@ static inline void restore_user_access(unsigned long flags) · 62 unmodified lines
6363 static inline bool
6464 bad_kuap_fault(struct pt_regs *regs, unsigned long address, bool is_write)
6565 {
66− return WARN(!((regs->kuap ^ MD_APG_KUAP) & 0xf0000000),
66+ return WARN(!((regs->kuap ^ MD_APG_KUAP) & 0xff000000),
6767 "Bug: fault blocked by AP register !");
6868 }
6969
arch/powerpc/include/asm/nohash/32/mmu-8xx.h+15−32
@@ -33,19 +33,18 @@ · 32 unmodified lines
3333 * respectively NA for All or X for Supervisor and no access for User.
3434 * Then we use the APG to say whether accesses are according to Page rules or
3535 * "all Supervisor" rules (Access to all)
36− * Therefore, we define 2 APG groups. lsb is _PMD_USER
37− * 0 => Kernel => 01 (all accesses performed according to page definition)
38− * 1 => User => 00 (all accesses performed as supervisor iaw page definition)
39− * 2-15 => Not Used
40− */
41−#define MI_APG_INIT 0x40000000
42−
43−/*
44− * 0 => Kernel => 01 (all accesses performed according to page definition)
45− * 1 => User => 10 (all accesses performed according to swaped page definition)
46− * 2-15 => Not Used
47− */
48−#define MI_APG_KUEP 0x60000000
36+ * _PAGE_ACCESSED is also managed via APG. When _PAGE_ACCESSED is not set, say
37+ * "all User" rules, that will lead to NA for all.
38+ * Therefore, we define 4 APG groups. lsb is _PAGE_ACCESSED
39+ * 0 => Kernel => 11 (all accesses performed according as user iaw page definition)
40+ * 1 => Kernel+Accessed => 01 (all accesses performed according to page definition)
41+ * 2 => User => 11 (all accesses performed according as user iaw page definition)
42+ * 3 => User+Accessed => 00 (all accesses performed as supervisor iaw page definition) for INIT
43+ * => 10 (all accesses performed according to swaped page definition) for KUEP
44+ * 4-15 => Not Used
45+ */
46+#define MI_APG_INIT 0xdc000000
47+#define MI_APG_KUEP 0xde000000
4948
5049 /* The effective page number register. When read, contains the information
5150 * about the last instruction TLB miss. When MI_RPN is written, bits in
@@ -106,25 +105,9 @@ · 54 unmodified lines
106105 #define MD_Ks 0x80000000 /* Should not be set */
107106 #define MD_Kp 0x40000000 /* Should always be set */
108107
109−/*
110− * All pages' PP data bits are set to either 000 or 011 or 001, which means
111− * respectively RW for Supervisor and no access for User, or RO for
112− * Supervisor and no access for user and NA for ALL.
113− * Then we use the APG to say whether accesses are according to Page rules or
114− * "all Supervisor" rules (Access to all)
115− * Therefore, we define 2 APG groups. lsb is _PMD_USER
116− * 0 => Kernel => 01 (all accesses performed according to page definition)
117− * 1 => User => 00 (all accesses performed as supervisor iaw page definition)
118− * 2-15 => Not Used
119− */
120−#define MD_APG_INIT 0x40000000
121−
122−/*
123− * 0 => No user => 01 (all accesses performed according to page definition)
124− * 1 => User => 10 (all accesses performed according to swaped page definition)
125− * 2-15 => Not Used
126− */
127−#define MD_APG_KUAP 0x60000000
108+/* See explanation above at the definition of MI_APG_INIT */
109+#define MD_APG_INIT 0xdc000000
110+#define MD_APG_KUAP 0xde000000
128111
129112 /* The effective page number register. When read, contains the information
130113 * about the last instruction TLB miss. When MD_RPN is written, bits in
arch/powerpc/include/asm/nohash/32/pte-8xx.h+5−4
@@ -39,9 +39,9 @@ · 38 unmodified lines
3939 * into the TLB.
4040 */
4141 #define _PAGE_GUARDED 0x0010 /* Copied to L1 G entry in DTLB */
42−#define _PAGE_SPECIAL 0x0020 /* SW entry */
42+#define _PAGE_ACCESSED 0x0020 /* Copied to L1 APG 1 entry in I/DTLB */
4343 #define _PAGE_EXEC 0x0040 /* Copied to PP (bit 21) in ITLB */
44−#define _PAGE_ACCESSED 0x0080 /* software: page referenced */
44+#define _PAGE_SPECIAL 0x0080 /* SW entry */
4545
4646 #define _PAGE_NA 0x0200 /* Supervisor NA, User no access */
4747 #define _PAGE_RO 0x0600 /* Supervisor RO, User no access */
@@ -59,11 +59,12 @@ · 11 unmodified lines
5959
6060 #define _PMD_PRESENT 0x0001
6161 #define _PMD_PRESENT_MASK _PMD_PRESENT
62−#define _PMD_BAD 0x0fd0
62+#define _PMD_BAD 0x0f90
6363 #define _PMD_PAGE_MASK 0x000c
6464 #define _PMD_PAGE_8M 0x000c
6565 #define _PMD_PAGE_512K 0x0004
66−#define _PMD_USER 0x0020 /* APG 1 */
66+#define _PMD_ACCESSED 0x0020 /* APG 1 */
67+#define _PMD_USER 0x0040 /* APG 2 */
6768
6869 #define _PTE_NONE_MASK 0
6970
arch/powerpc/include/asm/topology.h+9−3
@@ -6,6 +6,7 @@ · 5 unmodified lines
66
77 struct device;
88 struct device_node;
9+struct drmem_lmb;
910
1011 #ifdef CONFIG_NUMA
1112
@@ -61,6 +62,9 @@ static inline int early_cpu_to_node(int cpu) · 49 unmodified lines
6162 */
6263 return (nid < 0) ? 0 : nid;
6364 }
65+
66+int of_drconf_to_nid_single(struct drmem_lmb *lmb);
67+
6468 #else
6569
6670 static inline int early_cpu_to_node(int cpu) { return 0; }
@@ -84,10 +88,12 @@ static inline int cpu_distance(__be32 *cpu1_assoc, __be32 *cpu2_assoc) · 17 unmodified lines
8488 return 0;
8589 }
8690
87−#endif /* CONFIG_NUMA */
91+static inline int of_drconf_to_nid_single(struct drmem_lmb *lmb)
92+{
93+ return first_online_node;
94+}
8895
89−struct drmem_lmb;
90−int of_drconf_to_nid_single(struct drmem_lmb *lmb);
96+#endif /* CONFIG_NUMA */
9197
9298 #if defined(CONFIG_NUMA) && defined(CONFIG_PPC_SPLPAR)
9399 extern int find_and_online_cpu_nid(int cpu);
arch/powerpc/include/asm/uaccess.h+2−2
@@ -178,7 +178,7 @@ do { \ · 177 unmodified lines
178178 * are no aliasing issues.
179179 */
180180 #define __put_user_asm_goto(x, addr, label, op) \
181− asm volatile goto( \
181+ asm_volatile_goto( \
182182 "1: " op "%U1%X1 %0,%1 # put_user\n" \
183183 EX_TABLE(1b, %l2) \
184184 : \
@@ -191,7 +191,7 @@ do { \ · 6 unmodified lines
191191 __put_user_asm_goto(x, ptr, label, "std")
192192 #else /* __powerpc64__ */
193193 #define __put_user_asm2_goto(x, addr, label) \
194− asm volatile goto( \
194+ asm_volatile_goto( \
195195 "1: stw%X1 %0, %1\n" \
196196 "2: stw%X1 %L0, %L1\n" \
197197 EX_TABLE(1b, %l2) \
arch/powerpc/kernel/eeh_cache.c+3−2
@@ -264,8 +264,9 @@ static int eeh_addr_cache_show(struct seq_file *s, void *v) · 263 unmodified lines
264264 {
265265 struct pci_io_addr_range *piar;
266266 struct rb_node *n;
267+ unsigned long flags;
267268
268− spin_lock(&pci_io_addr_cache_root.piar_lock);
269+ spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags);
269270 for (n = rb_first(&pci_io_addr_cache_root.rb_root); n; n = rb_next(n)) {
270271 piar = rb_entry(n, struct pci_io_addr_range, rb_node);
271272
@@ -273,7 +274,7 @@ static int eeh_addr_cache_show(struct seq_file *s, void *v) · 1 unmodified line
273274 (piar->flags & IORESOURCE_IO) ? "i/o" : "mem",
274275 &piar->addr_lo, &piar->addr_hi, pci_name(piar->pcidev));
275276 }
276− spin_unlock(&pci_io_addr_cache_root.piar_lock);
277+ spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags);
277278
278279 return 0;
279280 }
arch/powerpc/kernel/head_40x.S+0−8
@@ -284,11 +284,7 @@ _ENTRY(saved_ksp_limit) · 283 unmodified lines
284284
285285 rlwimi r11, r10, 22, 20, 29 /* Compute PTE address */
286286 lwz r11, 0(r11) /* Get Linux PTE */
287−#ifdef CONFIG_SWAP
288287 li r9, _PAGE_PRESENT | _PAGE_ACCESSED
289−#else
290− li r9, _PAGE_PRESENT
291−#endif
292288 andc. r9, r9, r11 /* Check permission */
293289 bne 5f
294290
@@ -369,11 +365,7 @@ _ENTRY(saved_ksp_limit) · 74 unmodified lines
369365
370366 rlwimi r11, r10, 22, 20, 29 /* Compute PTE address */
371367 lwz r11, 0(r11) /* Get Linux PTE */
372−#ifdef CONFIG_SWAP
373368 li r9, _PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC
374−#else
375− li r9, _PAGE_PRESENT | _PAGE_EXEC
376−#endif
377369 andc. r9, r9, r11 /* Check permission */
378370 bne 5f
379371
arch/powerpc/kernel/head_8xx.S+7−39
@@ -202,9 +202,7 @@ SystemCall: · 201 unmodified lines
202202
203203 InstructionTLBMiss:
204204 mtspr SPRN_SPRG_SCRATCH0, r10
205−#if defined(ITLB_MISS_KERNEL) || defined(CONFIG_SWAP) || defined(CONFIG_HUGETLBFS)
206205 mtspr SPRN_SPRG_SCRATCH1, r11
207−#endif
208206
209207 /* If we are faulting a kernel address, we have to use the
210208 * kernel page tables.
@@ -224,25 +222,13 @@ InstructionTLBMiss: · 13 unmodified lines
224222 3:
225223 mtcr r11
226224 #endif
227−#if defined(CONFIG_HUGETLBFS) || !defined(CONFIG_PIN_TLB_TEXT)
228225 lwz r11, (swapper_pg_dir-PAGE_OFFSET)@l(r10) /* Get level 1 entry */
229226 mtspr SPRN_MD_TWC, r11
230−#else
231− lwz r10, (swapper_pg_dir-PAGE_OFFSET)@l(r10) /* Get level 1 entry */
232− mtspr SPRN_MI_TWC, r10 /* Set segment attributes */
233− mtspr SPRN_MD_TWC, r10
234−#endif
235227 mfspr r10, SPRN_MD_TWC
236228 lwz r10, 0(r10) /* Get the pte */
237−#if defined(CONFIG_HUGETLBFS) || !defined(CONFIG_PIN_TLB_TEXT)
229+ rlwimi r11, r10, 0, _PAGE_GUARDED | _PAGE_ACCESSED
238230 rlwimi r11, r10, 32 - 9, _PMD_PAGE_512K
239231 mtspr SPRN_MI_TWC, r11
240−#endif
241−#ifdef CONFIG_SWAP
242− rlwinm r11, r10, 32-5, _PAGE_PRESENT
243− and r11, r11, r10
244− rlwimi r10, r11, 0, _PAGE_PRESENT
245−#endif
246232 /* The Linux PTE won't go exactly into the MMU TLB.
247233 * Software indicator bits 20 and 23 must be clear.
248234 * Software indicator bits 22, 24, 25, 26, and 27 must be
@@ -256,9 +242,7 @@ InstructionTLBMiss: · 7 unmodified lines
256242
257243 /* Restore registers */
258244 0: mfspr r10, SPRN_SPRG_SCRATCH0
259−#if defined(ITLB_MISS_KERNEL) || defined(CONFIG_SWAP) || defined(CONFIG_HUGETLBFS)
260245 mfspr r11, SPRN_SPRG_SCRATCH1
261−#endif
262246 rfi
263247 patch_site 0b, patch__itlbmiss_exit_1
264248
@@ -268,9 +252,7 @@ InstructionTLBMiss: · 3 unmodified lines
268252 addi r10, r10, 1
269253 stw r10, (itlb_miss_counter - PAGE_OFFSET)@l(0)
270254 mfspr r10, SPRN_SPRG_SCRATCH0
271−#if defined(ITLB_MISS_KERNEL) || defined(CONFIG_SWAP)
272255 mfspr r11, SPRN_SPRG_SCRATCH1
273−#endif
274256 rfi
275257 #endif
276258
@@ -297,30 +279,16 @@ DataStoreTLBMiss: · 20 unmodified lines
297279 mfspr r10, SPRN_MD_TWC
298280 lwz r10, 0(r10) /* Get the pte */
299281
300− /* Insert the Guarded flag into the TWC from the Linux PTE.
282+ /* Insert Guarded and Accessed flags into the TWC from the Linux PTE.
301283 * It is bit 27 of both the Linux PTE and the TWC (at least
302284 * I got that right :-). It will be better when we can put
303285 * this into the Linux pgd/pmd and load it in the operation
304286 * above.
305287 */
306− rlwimi r11, r10, 0, _PAGE_GUARDED
288+ rlwimi r11, r10, 0, _PAGE_GUARDED | _PAGE_ACCESSED
307289 rlwimi r11, r10, 32 - 9, _PMD_PAGE_512K
308290 mtspr SPRN_MD_TWC, r11
309291
310− /* Both _PAGE_ACCESSED and _PAGE_PRESENT has to be set.
311− * We also need to know if the insn is a load/store, so:
312− * Clear _PAGE_PRESENT and load that which will
313− * trap into DTLB Error with store bit set accordinly.
314− */
315− /* PRESENT=0x1, ACCESSED=0x20
316− * r11 = ((r10 & PRESENT) & ((r10 & ACCESSED) >> 5));
317− * r10 = (r10 & ~PRESENT) | r11;
318− */
319−#ifdef CONFIG_SWAP
320− rlwinm r11, r10, 32-5, _PAGE_PRESENT
321− and r11, r11, r10
322− rlwimi r10, r11, 0, _PAGE_PRESENT
323−#endif
324292 /* The Linux PTE won't go exactly into the MMU TLB.
325293 * Software indicator bits 24, 25, 26, and 27 must be
326294 * set. All other Linux PTE bits control the behavior
@@ -711,7 +679,7 @@ initial_mmu: · 384 unmodified lines
711679 li r9, 4 /* up to 4 pages of 8M */
712680 mtctr r9
713681 lis r9, KERNELBASE@h /* Create vaddr for TLB */
714− li r10, MI_PS8MEG | MI_SVALID /* Set 8M byte page */
682+ li r10, MI_PS8MEG | _PMD_ACCESSED | MI_SVALID
715683 li r11, MI_BOOTINIT /* Create RPN for address 0 */
716684 1:
717685 mtspr SPRN_MI_CTR, r8 /* Set instruction MMU control */
@@ -775,7 +743,7 @@ _GLOBAL(mmu_pin_tlb) · 57 unmodified lines
775743 #ifdef CONFIG_PIN_TLB_TEXT
776744 LOAD_REG_IMMEDIATE(r5, 28 << 8)
777745 LOAD_REG_IMMEDIATE(r6, PAGE_OFFSET)
778− LOAD_REG_IMMEDIATE(r7, MI_SVALID | MI_PS8MEG)
746+ LOAD_REG_IMMEDIATE(r7, MI_SVALID | MI_PS8MEG | _PMD_ACCESSED)
779747 LOAD_REG_IMMEDIATE(r8, 0xf0 | _PAGE_RO | _PAGE_SPS | _PAGE_SH | _PAGE_PRESENT)
780748 LOAD_REG_ADDR(r9, _sinittext)
781749 li r0, 4
@@ -797,7 +765,7 @@ _GLOBAL(mmu_pin_tlb) · 15 unmodified lines
797765 LOAD_REG_IMMEDIATE(r5, 28 << 8 | MD_TWAM)
798766 #ifdef CONFIG_PIN_TLB_DATA
799767 LOAD_REG_IMMEDIATE(r6, PAGE_OFFSET)
800− LOAD_REG_IMMEDIATE(r7, MI_SVALID | MI_PS8MEG)
768+ LOAD_REG_IMMEDIATE(r7, MI_SVALID | MI_PS8MEG | _PMD_ACCESSED)
801769 #ifdef CONFIG_PIN_TLB_IMMR
802770 li r0, 3
803771 #else
@@ -834,7 +802,7 @@ _GLOBAL(mmu_pin_tlb) · 30 unmodified lines
834802 #endif
835803 #ifdef CONFIG_PIN_TLB_IMMR
836804 LOAD_REG_IMMEDIATE(r0, VIRT_IMMR_BASE | MD_EVALID)
837− LOAD_REG_IMMEDIATE(r7, MD_SVALID | MD_PS512K | MD_GUARDED)
805+ LOAD_REG_IMMEDIATE(r7, MD_SVALID | MD_PS512K | MD_GUARDED | _PMD_ACCESSED)
838806 mfspr r8, SPRN_IMMR
839807 rlwinm r8, r8, 0, 0xfff80000
840808 ori r8, r8, 0xf0 | _PAGE_DIRTY | _PAGE_SPS | _PAGE_SH | \
arch/powerpc/kernel/head_book3s_32.S+0−12
@@ -457,11 +457,7 @@ InstructionTLBMiss: · 456 unmodified lines
457457 cmplw 0,r1,r3
458458 #endif
459459 mfspr r2, SPRN_SPRG_PGDIR
460−#ifdef CONFIG_SWAP
461460 li r1,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC
462−#else
463− li r1,_PAGE_PRESENT | _PAGE_EXEC
464−#endif
465461 #if defined(CONFIG_MODULES) || defined(CONFIG_DEBUG_PAGEALLOC)
466462 bgt- 112f
467463 lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */
@@ -523,11 +519,7 @@ DataLoadTLBMiss: · 55 unmodified lines
523519 lis r1, TASK_SIZE@h /* check if kernel address */
524520 cmplw 0,r1,r3
525521 mfspr r2, SPRN_SPRG_PGDIR
526−#ifdef CONFIG_SWAP
527522 li r1, _PAGE_PRESENT | _PAGE_ACCESSED
528−#else
529− li r1, _PAGE_PRESENT
530−#endif
531523 bgt- 112f
532524 lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */
533525 addi r2, r2, (swapper_pg_dir - PAGE_OFFSET)@l /* kernel page table */
@@ -603,11 +595,7 @@ DataStoreTLBMiss: · 69 unmodified lines
603595 lis r1, TASK_SIZE@h /* check if kernel address */
604596 cmplw 0,r1,r3
605597 mfspr r2, SPRN_SPRG_PGDIR
606−#ifdef CONFIG_SWAP
607598 li r1, _PAGE_RW | _PAGE_DIRTY | _PAGE_PRESENT | _PAGE_ACCESSED
608−#else
609− li r1, _PAGE_RW | _PAGE_DIRTY | _PAGE_PRESENT
610−#endif
611599 bgt- 112f
612600 lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */
613601 addi r2, r2, (swapper_pg_dir - PAGE_OFFSET)@l /* kernel page table */
arch/powerpc/kernel/smp.c+2−1
@@ -1393,13 +1393,14 @@ static void add_cpu_to_masks(int cpu) · 1392 unmodified lines
13931393 /* Activate a secondary processor. */
13941394 void start_secondary(void *unused)
13951395 {
1396− unsigned int cpu = smp_processor_id();
1396+ unsigned int cpu = raw_smp_processor_id();
13971397
13981398 mmgrab(&init_mm);
13991399 current->active_mm = &init_mm;
14001400
14011401 smp_store_cpu_info(cpu);
14021402 set_dec(tb_ticks_per_jiffy);
1403+ rcu_cpu_starting(cpu);
14031404 preempt_disable();
14041405 cpu_callin_map[cpu] = 1;
14051406
arch/riscv/include/asm/uaccess.h+1−1
@@ -476,7 +476,7 @@ do { \ · 475 unmodified lines
476476 do { \
477477 long __kr_err; \
478478 \
479− __put_user_nocheck(*((type *)(dst)), (type *)(src), __kr_err); \
479+ __put_user_nocheck(*((type *)(src)), (type *)(dst), __kr_err); \
480480 if (unlikely(__kr_err)) \
481481 goto err_label; \
482482 } while (0)
arch/riscv/kernel/ftrace.c+1−1
@@ -1,4 +1,4 @@
1−/* SPDX-License-Identifier: GPL-2.0 */
1+// SPDX-License-Identifier: GPL-2.0
22 /*
33 * Copyright (C) 2013 Linaro Limited
44 * Author: AKASHI Takahiro <takahiro.akashi@linaro.org>
arch/riscv/kernel/head.S+5−0
@@ -35,12 +35,17 @@ ENTRY(_start) · 34 unmodified lines
3535 .word 0
3636 #endif
3737 .balign 8
38+#ifdef CONFIG_RISCV_M_MODE
39+ /* Image load offset (0MB) from start of RAM for M-mode */
40+ .dword 0
41+#else
3842 #if __riscv_xlen == 64
3943 /* Image load offset(2MB) from start of RAM */
4044 .dword 0x200000
4145 #else
4246 /* Image load offset(4MB) from start of RAM */
4347 .dword 0x400000
48+#endif
4449 #endif
4550 /* Effective size of kernel image */
4651 .dword _end - _start
arch/riscv/kernel/vdso/.gitignore+1−0
@@ -1,3 +1,4 @@
11 # SPDX-License-Identifier: GPL-2.0-only
22 vdso.lds
33 *.tmp
4+vdso-syms.S
arch/riscv/kernel/vdso/Makefile+9−9
@@ -43,19 +43,14 @@ $(obj)/vdso.o: $(obj)/vdso.so · 42 unmodified lines
4343 SYSCFLAGS_vdso.so.dbg = $(c_flags)
4444 $(obj)/vdso.so.dbg: $(src)/vdso.lds $(obj-vdso) FORCE
4545 $(call if_changed,vdsold)
46+SYSCFLAGS_vdso.so.dbg = -shared -s -Wl,-soname=linux-vdso.so.1 \
47+ -Wl,--build-id -Wl,--hash-style=both
4648
4749 # We also create a special relocatable object that should mirror the symbol
4850 # table and layout of the linked DSO. With ld --just-symbols we can then
4951 # refer to these symbols in the kernel code rather than hand-coded addresses.
50−
51−SYSCFLAGS_vdso.so.dbg = -shared -s -Wl,-soname=linux-vdso.so.1 \
52− -Wl,--build-id=sha1 -Wl,--hash-style=both
53−$(obj)/vdso-dummy.o: $(src)/vdso.lds $(obj)/rt_sigreturn.o FORCE
54− $(call if_changed,vdsold)
55−
56−LDFLAGS_vdso-syms.o := -r --just-symbols
57−$(obj)/vdso-syms.o: $(obj)/vdso-dummy.o FORCE
58− $(call if_changed,ld)
52+$(obj)/vdso-syms.S: $(obj)/vdso.so FORCE
53+ $(call if_changed,so2s)
5954
6055 # strip rule for the .so file
6156 $(obj)/%.so: OBJCOPYFLAGS := -S
@@ -73,6 +68,11 @@ quiet_cmd_vdsold = VDSOLD $@ · 11 unmodified lines
7368 $(patsubst %, -G __vdso_%, $(vdso-syms)) $@.tmp $@ && \
7469 rm $@.tmp
7570
71+# Extracts symbol offsets from the VDSO, converting them into an assembly file
72+# that contains the same symbols at the same offsets.
73+quiet_cmd_so2s = SO2S $@
74+ cmd_so2s = $(NM) -D $< | $(srctree)/$(src)/so2s.sh > $@
75+
7676 # install commands for the unstripped file
7777 quiet_cmd_vdso_install = INSTALL $@
7878 cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@
arch/riscv/kernel/vdso/so2s.sh+6−0
@@ -0,0 +1,6 @@
1+#!/bin/sh
2+# SPDX-License-Identifier: GPL-2.0+
3+# Copyright 2020 Palmer Dabbelt <palmerdabbelt@google.com>
4+
5+sed 's!\([0-9a-f]*\) T \([a-z0-9_]*\)\(@@LINUX_4.15\)*!.global \2\n.set \2,0x\1!' \
6+| grep '^\.'
arch/riscv/mm/fault.c+3−1
@@ -86,6 +86,7 @@ static inline void vmalloc_fault(struct pt_regs *regs, int code, unsigned long a · 85 unmodified lines
8686 pmd_t *pmd, *pmd_k;
8787 pte_t *pte_k;
8888 int index;
89+ unsigned long pfn;
8990
9091 /* User mode accesses just cause a SIGSEGV */
9192 if (user_mode(regs))
@@ -100,7 +101,8 @@ static inline void vmalloc_fault(struct pt_regs *regs, int code, unsigned long a · 8 unmodified lines
100101 * of a task switch.
101102 */
102103 index = pgd_index(addr);
103− pgd = (pgd_t *)pfn_to_virt(csr_read(CSR_SATP)) + index;
104+ pfn = csr_read(CSR_SATP) & SATP_PPN;
105+ pgd = (pgd_t *)pfn_to_virt(pfn) + index;
104106 pgd_k = init_mm.pgd + index;
105107
106108 if (!pgd_present(*pgd_k)) {
arch/riscv/mm/init.c+21−11
@@ -154,9 +154,8 @@ disable: · 153 unmodified lines
154154
155155 void __init setup_bootmem(void)
156156 {
157− phys_addr_t mem_size = 0;
158− phys_addr_t total_mem = 0;
159− phys_addr_t mem_start, start, end = 0;
157+ phys_addr_t mem_start = 0;
158+ phys_addr_t start, end = 0;
160159 phys_addr_t vmlinux_end = __pa_symbol(&_end);
161160 phys_addr_t vmlinux_start = __pa_symbol(&_start);
162161 u64 i;
@@ -164,21 +163,18 @@ void __init setup_bootmem(void) · 1 unmodified line
164163 /* Find the memory region containing the kernel */
165164 for_each_mem_range(i, &start, &end) {
166165 phys_addr_t size = end - start;
167− if (!total_mem)
166+ if (!mem_start)
168167 mem_start = start;
169168 if (start <= vmlinux_start && vmlinux_end <= end)
170169 BUG_ON(size == 0);
171− total_mem = total_mem + size;
172170 }
173171
174172 /*
175− * Remove memblock from the end of usable area to the
176− * end of region
173+ * The maximal physical memory size is -PAGE_OFFSET.
174+ * Make sure that any memory beyond mem_start + (-PAGE_OFFSET) is removed
175+ * as it is unusable by kernel.
177176 */
178− mem_size = min(total_mem, (phys_addr_t)-PAGE_OFFSET);
179− if (mem_start + mem_size < end)
180− memblock_remove(mem_start + mem_size,
181− end - mem_start - mem_size);
177+ memblock_enforce_memory_limit(mem_start - PAGE_OFFSET);
182178
183179 /* Reserve from the start of the kernel to the end of the kernel */
184180 memblock_reserve(vmlinux_start, vmlinux_end - vmlinux_start);
@@ -297,6 +293,7 @@ pmd_t fixmap_pmd[PTRS_PER_PMD] __page_aligned_bss; · 112 unmodified lines
297293 #define NUM_EARLY_PMDS (1UL + MAX_EARLY_MAPPING_SIZE / PGDIR_SIZE)
298294 #endif
299295 pmd_t early_pmd[PTRS_PER_PMD * NUM_EARLY_PMDS] __initdata __aligned(PAGE_SIZE);
296+pmd_t early_dtb_pmd[PTRS_PER_PMD] __initdata __aligned(PAGE_SIZE);
300297
301298 static pmd_t *__init get_pmd_virt_early(phys_addr_t pa)
302299 {
@@ -494,6 +491,18 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa) · 191 unmodified lines
494491 load_pa + (va - PAGE_OFFSET),
495492 map_size, PAGE_KERNEL_EXEC);
496493
494+#ifndef __PAGETABLE_PMD_FOLDED
495+ /* Setup early PMD for DTB */
496+ create_pgd_mapping(early_pg_dir, DTB_EARLY_BASE_VA,
497+ (uintptr_t)early_dtb_pmd, PGDIR_SIZE, PAGE_TABLE);
498+ /* Create two consecutive PMD mappings for FDT early scan */
499+ pa = dtb_pa & ~(PMD_SIZE - 1);
500+ create_pmd_mapping(early_dtb_pmd, DTB_EARLY_BASE_VA,
501+ pa, PMD_SIZE, PAGE_KERNEL);
502+ create_pmd_mapping(early_dtb_pmd, DTB_EARLY_BASE_VA + PMD_SIZE,
503+ pa + PMD_SIZE, PMD_SIZE, PAGE_KERNEL);
504+ dtb_early_va = (void *)DTB_EARLY_BASE_VA + (dtb_pa & (PMD_SIZE - 1));
505+#else
497506 /* Create two consecutive PGD mappings for FDT early scan */
498507 pa = dtb_pa & ~(PGDIR_SIZE - 1);
499508 create_pgd_mapping(early_pg_dir, DTB_EARLY_BASE_VA,
@@ -501,6 +510,7 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa) · 1 unmodified line
501510 create_pgd_mapping(early_pg_dir, DTB_EARLY_BASE_VA + PGDIR_SIZE,
502511 pa + PGDIR_SIZE, PGDIR_SIZE, PAGE_KERNEL);
503512 dtb_early_va = (void *)DTB_EARLY_BASE_VA + (dtb_pa & (PGDIR_SIZE - 1));
513+#endif
504514 dtb_early_pa = dtb_pa;
505515
506516 /*
arch/s390/configs/debug_defconfig+6−4
@@ -93,9 +93,10 @@ CONFIG_CLEANCACHE=y · 92 unmodified lines
9393 CONFIG_FRONTSWAP=y
9494 CONFIG_CMA_DEBUG=y
9595 CONFIG_CMA_DEBUGFS=y
96+CONFIG_CMA_AREAS=7
9697 CONFIG_MEM_SOFT_DIRTY=y
9798 CONFIG_ZSWAP=y
98−CONFIG_ZSMALLOC=m
99+CONFIG_ZSMALLOC=y
99100 CONFIG_ZSMALLOC_STAT=y
100101 CONFIG_DEFERRED_STRUCT_PAGE_INIT=y
101102 CONFIG_IDLE_PAGE_TRACKING=y
@@ -378,7 +379,6 @@ CONFIG_NETLINK_DIAG=m · 276 unmodified lines
378379 CONFIG_CGROUP_NET_PRIO=y
379380 CONFIG_BPF_JIT=y
380381 CONFIG_NET_PKTGEN=m
381−# CONFIG_NET_DROP_MONITOR is not set
382382 CONFIG_PCI=y
383383 # CONFIG_PCIEASPM is not set
384384 CONFIG_PCI_DEBUG=y
@@ -386,7 +386,7 @@ CONFIG_HOTPLUG_PCI=y · 1 unmodified line
386386 CONFIG_HOTPLUG_PCI_S390=y
387387 CONFIG_DEVTMPFS=y
388388 CONFIG_CONNECTOR=y
389−CONFIG_ZRAM=m
389+CONFIG_ZRAM=y
390390 CONFIG_BLK_DEV_LOOP=m
391391 CONFIG_BLK_DEV_CRYPTOLOOP=m
392392 CONFIG_BLK_DEV_DRBD=m
@@ -689,6 +689,7 @@ CONFIG_CRYPTO_TEST=m · 296 unmodified lines
689689 CONFIG_CRYPTO_DH=m
690690 CONFIG_CRYPTO_ECDH=m
691691 CONFIG_CRYPTO_ECRDSA=m
692+CONFIG_CRYPTO_SM2=m
692693 CONFIG_CRYPTO_CURVE25519=m
693694 CONFIG_CRYPTO_GCM=y
694695 CONFIG_CRYPTO_CHACHA20POLY1305=m
@@ -709,7 +710,6 @@ CONFIG_CRYPTO_RMD160=m · 14 unmodified lines
709710 CONFIG_CRYPTO_RMD256=m
710711 CONFIG_CRYPTO_RMD320=m
711712 CONFIG_CRYPTO_SHA3=m
712−CONFIG_CRYPTO_SM3=m
713713 CONFIG_CRYPTO_TGR192=m
714714 CONFIG_CRYPTO_WP512=m
715715 CONFIG_CRYPTO_AES_TI=m
@@ -753,6 +753,7 @@ CONFIG_CRYPTO_DES_S390=m · 37 unmodified lines
753753 CONFIG_CRYPTO_AES_S390=m
754754 CONFIG_CRYPTO_GHASH_S390=m
755755 CONFIG_CRYPTO_CRC32_S390=y
756+CONFIG_CRYPTO_DEV_VIRTIO=m
756757 CONFIG_CORDIC=m
757758 CONFIG_CRC32_SELFTEST=y
758759 CONFIG_CRC4=m
@@ -829,6 +830,7 @@ CONFIG_NETDEV_NOTIFIER_ERROR_INJECT=m · 70 unmodified lines
829830 CONFIG_FAULT_INJECTION=y
830831 CONFIG_FAILSLAB=y
831832 CONFIG_FAIL_PAGE_ALLOC=y
833+CONFIG_FAULT_INJECTION_USERCOPY=y
832834 CONFIG_FAIL_MAKE_REQUEST=y
833835 CONFIG_FAIL_IO_TIMEOUT=y
834836 CONFIG_FAIL_FUTEX=y
arch/s390/configs/defconfig+5−4
@@ -87,9 +87,10 @@ CONFIG_KSM=y · 86 unmodified lines
8787 CONFIG_TRANSPARENT_HUGEPAGE=y
8888 CONFIG_CLEANCACHE=y
8989 CONFIG_FRONTSWAP=y
90+CONFIG_CMA_AREAS=7
9091 CONFIG_MEM_SOFT_DIRTY=y
9192 CONFIG_ZSWAP=y
92−CONFIG_ZSMALLOC=m
93+CONFIG_ZSMALLOC=y
9394 CONFIG_ZSMALLOC_STAT=y
9495 CONFIG_DEFERRED_STRUCT_PAGE_INIT=y
9596 CONFIG_IDLE_PAGE_TRACKING=y
@@ -371,7 +372,6 @@ CONFIG_NETLINK_DIAG=m · 275 unmodified lines
371372 CONFIG_CGROUP_NET_PRIO=y
372373 CONFIG_BPF_JIT=y
373374 CONFIG_NET_PKTGEN=m
374−# CONFIG_NET_DROP_MONITOR is not set
375375 CONFIG_PCI=y
376376 # CONFIG_PCIEASPM is not set
377377 CONFIG_HOTPLUG_PCI=y
@@ -379,7 +379,7 @@ CONFIG_HOTPLUG_PCI_S390=y · 1 unmodified line
379379 CONFIG_UEVENT_HELPER=y
380380 CONFIG_DEVTMPFS=y
381381 CONFIG_CONNECTOR=y
382−CONFIG_ZRAM=m
382+CONFIG_ZRAM=y
383383 CONFIG_BLK_DEV_LOOP=m
384384 CONFIG_BLK_DEV_CRYPTOLOOP=m
385385 CONFIG_BLK_DEV_DRBD=m
@@ -680,6 +680,7 @@ CONFIG_CRYPTO_TEST=m · 294 unmodified lines
680680 CONFIG_CRYPTO_DH=m
681681 CONFIG_CRYPTO_ECDH=m
682682 CONFIG_CRYPTO_ECRDSA=m
683+CONFIG_CRYPTO_SM2=m
683684 CONFIG_CRYPTO_CURVE25519=m
684685 CONFIG_CRYPTO_GCM=y
685686 CONFIG_CRYPTO_CHACHA20POLY1305=m
@@ -701,7 +702,6 @@ CONFIG_CRYPTO_RMD160=m · 15 unmodified lines
701702 CONFIG_CRYPTO_RMD256=m
702703 CONFIG_CRYPTO_RMD320=m
703704 CONFIG_CRYPTO_SHA3=m
704−CONFIG_CRYPTO_SM3=m
705705 CONFIG_CRYPTO_TGR192=m
706706 CONFIG_CRYPTO_WP512=m
707707 CONFIG_CRYPTO_AES_TI=m
@@ -745,6 +745,7 @@ CONFIG_CRYPTO_DES_S390=m · 37 unmodified lines
745745 CONFIG_CRYPTO_AES_S390=m
746746 CONFIG_CRYPTO_GHASH_S390=m
747747 CONFIG_CRYPTO_CRC32_S390=y
748+CONFIG_CRYPTO_DEV_VIRTIO=m
748749 CONFIG_CORDIC=m
749750 CONFIG_PRIME_NUMBERS=m
750751 CONFIG_CRC4=m
arch/s390/configs/zfcpdump_defconfig+1−1
@@ -17,11 +17,11 @@ CONFIG_HZ_100=y · 16 unmodified lines
1717 # CONFIG_CHSC_SCH is not set
1818 # CONFIG_SCM_BUS is not set
1919 CONFIG_CRASH_DUMP=y
20−# CONFIG_SECCOMP is not set
2120 # CONFIG_PFAULT is not set
2221 # CONFIG_S390_HYPFS_FS is not set
2322 # CONFIG_VIRTUALIZATION is not set
2423 # CONFIG_S390_GUEST is not set
24+# CONFIG_SECCOMP is not set
2525 CONFIG_PARTITION_ADVANCED=y
2626 CONFIG_IBM_PARTITION=y
2727 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
arch/s390/include/asm/pgtable.h+30−22
@@ -692,16 +692,6 @@ static inline int pud_large(pud_t pud) · 691 unmodified lines
692692 return !!(pud_val(pud) & _REGION3_ENTRY_LARGE);
693693 }
694694
695−static inline unsigned long pud_pfn(pud_t pud)
696−{
697− unsigned long origin_mask;
698−
699− origin_mask = _REGION_ENTRY_ORIGIN;
700− if (pud_large(pud))
701− origin_mask = _REGION3_ENTRY_ORIGIN_LARGE;
702− return (pud_val(pud) & origin_mask) >> PAGE_SHIFT;
703−}
704−
705695 #define pmd_leaf pmd_large
706696 static inline int pmd_large(pmd_t pmd)
707697 {
@@ -747,16 +737,6 @@ static inline int pmd_none(pmd_t pmd) · 39 unmodified lines
747737 return pmd_val(pmd) == _SEGMENT_ENTRY_EMPTY;
748738 }
749739
750−static inline unsigned long pmd_pfn(pmd_t pmd)
751−{
752− unsigned long origin_mask;
753−
754− origin_mask = _SEGMENT_ENTRY_ORIGIN;
755− if (pmd_large(pmd))
756− origin_mask = _SEGMENT_ENTRY_ORIGIN_LARGE;
757− return (pmd_val(pmd) & origin_mask) >> PAGE_SHIFT;
758−}
759−
760740 #define pmd_write pmd_write
761741 static inline int pmd_write(pmd_t pmd)
762742 {
@@ -1238,11 +1218,39 @@ static inline pte_t mk_pte(struct page *page, pgprot_t pgprot) · 475 unmodified lines
12381218 #define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1))
12391219 #define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
12401220
1241−#define pmd_deref(pmd) (pmd_val(pmd) & _SEGMENT_ENTRY_ORIGIN)
1242−#define pud_deref(pud) (pud_val(pud) & _REGION_ENTRY_ORIGIN)
12431221 #define p4d_deref(pud) (p4d_val(pud) & _REGION_ENTRY_ORIGIN)
12441222 #define pgd_deref(pgd) (pgd_val(pgd) & _REGION_ENTRY_ORIGIN)
12451223
1224+static inline unsigned long pmd_deref(pmd_t pmd)
1225+{
1226+ unsigned long origin_mask;
1227+
1228+ origin_mask = _SEGMENT_ENTRY_ORIGIN;
1229+ if (pmd_large(pmd))
1230+ origin_mask = _SEGMENT_ENTRY_ORIGIN_LARGE;
1231+ return pmd_val(pmd) & origin_mask;
1232+}
1233+
1234+static inline unsigned long pmd_pfn(pmd_t pmd)
1235+{
1236+ return pmd_deref(pmd) >> PAGE_SHIFT;
1237+}
1238+
1239+static inline unsigned long pud_deref(pud_t pud)
1240+{
1241+ unsigned long origin_mask;
1242+
1243+ origin_mask = _REGION_ENTRY_ORIGIN;
1244+ if (pud_large(pud))
1245+ origin_mask = _REGION3_ENTRY_ORIGIN_LARGE;
1246+ return pud_val(pud) & origin_mask;
1247+}
1248+
1249+static inline unsigned long pud_pfn(pud_t pud)
1250+{
1251+ return pud_deref(pud) >> PAGE_SHIFT;
1252+}
1253+
12461254 /*
12471255 * The pgd_offset function *always* adds the index for the top-level
12481256 * region/segment table. This is done to get a sequence like the
arch/s390/include/asm/vdso/vdso.h+0−0

Empty file deleted.

arch/s390/kernel/asm-offsets.c+0−8
@@ -61,14 +61,6 @@ int main(void) · 60 unmodified lines
6161 BLANK();
6262 OFFSET(__VDSO_GETCPU_VAL, vdso_per_cpu_data, getcpu_val);
6363 BLANK();
64− /* constants used by the vdso */
65− DEFINE(__CLOCK_REALTIME, CLOCK_REALTIME);
66− DEFINE(__CLOCK_MONOTONIC, CLOCK_MONOTONIC);
67− DEFINE(__CLOCK_REALTIME_COARSE, CLOCK_REALTIME_COARSE);
68− DEFINE(__CLOCK_MONOTONIC_COARSE, CLOCK_MONOTONIC_COARSE);
69− DEFINE(__CLOCK_THREAD_CPUTIME_ID, CLOCK_THREAD_CPUTIME_ID);
70− DEFINE(__CLOCK_COARSE_RES, LOW_RES_NSEC);
71− BLANK();
7264 /* idle data offsets */
7365 OFFSET(__CLOCK_IDLE_ENTER, s390_idle_data, clock_idle_enter);
7466 OFFSET(__CLOCK_IDLE_EXIT, s390_idle_data, clock_idle_exit);
arch/s390/kernel/smp.c+2−1
@@ -855,13 +855,14 @@ void __init smp_detect_cpus(void) · 854 unmodified lines
855855
856856 static void smp_init_secondary(void)
857857 {
858− int cpu = smp_processor_id();
858+ int cpu = raw_smp_processor_id();
859859
860860 S390_lowcore.last_update_clock = get_tod_clock();
861861 restore_access_regs(S390_lowcore.access_regs_save_area);
862862 set_cpu_flag(CIF_ASCE_PRIMARY);
863863 set_cpu_flag(CIF_ASCE_SECONDARY);
864864 cpu_init();
865+ rcu_cpu_starting(cpu);
865866 preempt_disable();
866867 init_cpu_timer();
867868 vtime_init();
arch/s390/pci/pci_event.c+4−0
@@ -101,6 +101,10 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf) · 100 unmodified lines
101101 if (ret)
102102 break;
103103
104+ /* the PCI function will be scanned once function 0 appears */
105+ if (!zdev->zbus->bus)
106+ break;
107+
104108 pdev = pci_scan_single_device(zdev->zbus->bus, zdev->devfn);
105109 if (!pdev)
106110 break;
arch/x86/boot/compressed/ident_map_64.c+1−0
@@ -164,6 +164,7 @@ void initialize_identity_maps(void *rmode) · 163 unmodified lines
164164 add_identity_map(cmdline, cmdline + COMMAND_LINE_SIZE);
165165
166166 /* Load the new page-table. */
167+ sev_verify_cbit(top_level_pgt);
167168 write_cr3(top_level_pgt);
168169 }
169170
arch/x86/boot/compressed/mem_encrypt.S+19−1
@@ -68,6 +68,9 @@ SYM_FUNC_START(get_sev_encryption_bit) · 67 unmodified lines
6868 SYM_FUNC_END(get_sev_encryption_bit)
6969
7070 .code64
71+
72+#include "../../kernel/sev_verify_cbit.S"
73+
7174 SYM_FUNC_START(set_sev_encryption_mask)
7275 #ifdef CONFIG_AMD_MEM_ENCRYPT
7376 push %rbp
@@ -81,6 +84,19 @@ SYM_FUNC_START(set_sev_encryption_mask) · 7 unmodified lines
8184
8285 bts %rax, sme_me_mask(%rip) /* Create the encryption mask */
8386
87+ /*
88+ * Read MSR_AMD64_SEV again and store it to sev_status. Can't do this in
89+ * get_sev_encryption_bit() because this function is 32-bit code and
90+ * shared between 64-bit and 32-bit boot path.
91+ */
92+ movl $MSR_AMD64_SEV, %ecx /* Read the SEV MSR */
93+ rdmsr
94+
95+ /* Store MSR value in sev_status */
96+ shlq $32, %rdx
97+ orq %rdx, %rax
98+ movq %rax, sev_status(%rip)
99+
84100 .Lno_sev_mask:
85101 movq %rbp, %rsp /* Restore original stack pointer */
86102
@@ -96,5 +112,7 @@ SYM_FUNC_END(set_sev_encryption_mask) · 9 unmodified lines
96112
97113 #ifdef CONFIG_AMD_MEM_ENCRYPT
98114 .balign 8
99−SYM_DATA(sme_me_mask, .quad 0)
115+SYM_DATA(sme_me_mask, .quad 0)
116+SYM_DATA(sev_status, .quad 0)
117+SYM_DATA(sev_check_data, .quad 0)
100118 #endif
arch/x86/boot/compressed/misc.h+2−0
@@ -159,4 +159,6 @@ void boot_page_fault(void); · 158 unmodified lines
159159 void boot_stage1_vc(void);
160160 void boot_stage2_vc(void);
161161
162+unsigned long sev_verify_cbit(unsigned long cr3);
163+
162164 #endif /* BOOT_COMPRESSED_MISC_H */
arch/x86/hyperv/hv_apic.c+9−5
@@ -273,11 +273,15 @@ void __init hv_apic_init(void) · 272 unmodified lines
273273 pr_info("Hyper-V: Using enlightened APIC (%s mode)",
274274 x2apic_enabled() ? "x2apic" : "xapic");
275275 /*
276− * With x2apic, architectural x2apic MSRs are equivalent to the
277− * respective synthetic MSRs, so there's no need to override
278− * the apic accessors. The only exception is
279− * hv_apic_eoi_write, because it benefits from lazy EOI when
280− * available, but it works for both xapic and x2apic modes.
276+ * When in x2apic mode, don't use the Hyper-V specific APIC
277+ * accessors since the field layout in the ICR register is
278+ * different in x2apic mode. Furthermore, the architectural
279+ * x2apic MSRs function just as well as the Hyper-V
280+ * synthetic APIC MSRs, so there's no benefit in having
281+ * separate Hyper-V accessors for x2apic mode. The only
282+ * exception is hv_apic_eoi_write, because it benefits from
283+ * lazy EOI when available, but the same accessor works for
284+ * both xapic and x2apic because the field layout is the same.
281285 */
282286 apic_set_eoi_write(hv_apic_eoi_write);
283287 if (!x2apic_enabled()) {
arch/x86/kernel/apic/x2apic_uv_x.c+18−5
@@ -290,6 +290,9 @@ static void __init uv_stringify(int len, char *to, char *from) · 289 unmodified lines
290290 {
291291 /* Relies on 'to' being NULL chars so result will be NULL terminated */
292292 strncpy(to, from, len-1);
293+
294+ /* Trim trailing spaces */
295+ (void)strim(to);
293296 }
294297
295298 /* Find UV arch type entry in UVsystab */
@@ -366,7 +369,7 @@ static int __init early_get_arch_type(void) · 70 unmodified lines
366369 return ret;
367370 }
368371
369−static int __init uv_set_system_type(char *_oem_id)
372+static int __init uv_set_system_type(char *_oem_id, char *_oem_table_id)
370373 {
371374 /* Save OEM_ID passed from ACPI MADT */
372375 uv_stringify(sizeof(oem_id), oem_id, _oem_id);
@@ -386,13 +389,23 @@ static int __init uv_set_system_type(char *_oem_id) · 13 unmodified lines
386389 /* (Not hubless), not a UV */
387390 return 0;
388391
392+ /* Is UV hubless system */
393+ uv_hubless_system = 0x01;
394+
395+ /* UV5 Hubless */
396+ if (strncmp(uv_archtype, "NSGI5", 5) == 0)
397+ uv_hubless_system |= 0x20;
398+
389399 /* UV4 Hubless: CH */
390− if (strncmp(uv_archtype, "NSGI4", 5) == 0)
391− uv_hubless_system = 0x11;
400+ else if (strncmp(uv_archtype, "NSGI4", 5) == 0)
401+ uv_hubless_system |= 0x10;
392402
393403 /* UV3 Hubless: UV300/MC990X w/o hub */
394404 else
395− uv_hubless_system = 0x9;
405+ uv_hubless_system |= 0x8;
406+
407+ /* Copy APIC type */
408+ uv_stringify(sizeof(oem_table_id), oem_table_id, _oem_table_id);
396409
397410 pr_info("UV: OEM IDs %s/%s, SystemType %d, HUBLESS ID %x\n",
398411 oem_id, oem_table_id, uv_system_type, uv_hubless_system);
@@ -456,7 +469,7 @@ static int __init uv_acpi_madt_oem_check(char *_oem_id, char *_oem_table_id) · 57 unmodified lines
456469 uv_cpu_info->p_uv_hub_info = &uv_hub_info_node0;
457470
458471 /* If not UV, return. */
459− if (likely(uv_set_system_type(_oem_id) == 0))
472+ if (uv_set_system_type(_oem_id, _oem_table_id) == 0)
460473 return 0;
461474
462475 /* Save and Decode OEM Table ID */
arch/x86/kernel/cpu/bugs.c+33−18
@@ -1254,6 +1254,14 @@ static int ssb_prctl_set(struct task_struct *task, unsigned long ctrl) · 1253 unmodified lines
12541254 return 0;
12551255 }
12561256
1257+static bool is_spec_ib_user_controlled(void)
1258+{
1259+ return spectre_v2_user_ibpb == SPECTRE_V2_USER_PRCTL ||
1260+ spectre_v2_user_ibpb == SPECTRE_V2_USER_SECCOMP ||
1261+ spectre_v2_user_stibp == SPECTRE_V2_USER_PRCTL ||
1262+ spectre_v2_user_stibp == SPECTRE_V2_USER_SECCOMP;
1263+}
1264+
12571265 static int ib_prctl_set(struct task_struct *task, unsigned long ctrl)
12581266 {
12591267 switch (ctrl) {
@@ -1261,16 +1269,26 @@ static int ib_prctl_set(struct task_struct *task, unsigned long ctrl) · 1 unmodified line
12611269 if (spectre_v2_user_ibpb == SPECTRE_V2_USER_NONE &&
12621270 spectre_v2_user_stibp == SPECTRE_V2_USER_NONE)
12631271 return 0;
1272+
12641273 /*
1265− * Indirect branch speculation is always disabled in strict
1266− * mode. It can neither be enabled if it was force-disabled
1267− * by a previous prctl call.
1274+ * With strict mode for both IBPB and STIBP, the instruction
1275+ * code paths avoid checking this task flag and instead,
1276+ * unconditionally run the instruction. However, STIBP and IBPB
1277+ * are independent and either can be set to conditionally
1278+ * enabled regardless of the mode of the other.
1279+ *
1280+ * If either is set to conditional, allow the task flag to be
1281+ * updated, unless it was force-disabled by a previous prctl
1282+ * call. Currently, this is possible on an AMD CPU which has the
1283+ * feature X86_FEATURE_AMD_STIBP_ALWAYS_ON. In this case, if the
1284+ * kernel is booted with 'spectre_v2_user=seccomp', then
1285+ * spectre_v2_user_ibpb == SPECTRE_V2_USER_SECCOMP and
1286+ * spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT_PREFERRED.
12681287 */
1269− if (spectre_v2_user_ibpb == SPECTRE_V2_USER_STRICT ||
1270− spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT ||
1271− spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT_PREFERRED ||
1288+ if (!is_spec_ib_user_controlled() ||
12721289 task_spec_ib_force_disable(task))
12731290 return -EPERM;
1291+
12741292 task_clear_spec_ib_disable(task);
12751293 task_update_spec_tif(task);
12761294 break;
@@ -1283,10 +1301,10 @@ static int ib_prctl_set(struct task_struct *task, unsigned long ctrl) · 6 unmodified lines
12831301 if (spectre_v2_user_ibpb == SPECTRE_V2_USER_NONE &&
12841302 spectre_v2_user_stibp == SPECTRE_V2_USER_NONE)
12851303 return -EPERM;
1286− if (spectre_v2_user_ibpb == SPECTRE_V2_USER_STRICT ||
1287− spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT ||
1288− spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT_PREFERRED)
1304+
1305+ if (!is_spec_ib_user_controlled())
12891306 return 0;
1307+
12901308 task_set_spec_ib_disable(task);
12911309 if (ctrl == PR_SPEC_FORCE_DISABLE)
12921310 task_set_spec_ib_force_disable(task);
@@ -1351,20 +1369,17 @@ static int ib_prctl_get(struct task_struct *task) · 58 unmodified lines
13511369 if (spectre_v2_user_ibpb == SPECTRE_V2_USER_NONE &&
13521370 spectre_v2_user_stibp == SPECTRE_V2_USER_NONE)
13531371 return PR_SPEC_ENABLE;
1354− else if (spectre_v2_user_ibpb == SPECTRE_V2_USER_STRICT ||
1355− spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT ||
1356− spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT_PREFERRED)
1357− return PR_SPEC_DISABLE;
1358− else if (spectre_v2_user_ibpb == SPECTRE_V2_USER_PRCTL ||
1359− spectre_v2_user_ibpb == SPECTRE_V2_USER_SECCOMP ||
1360− spectre_v2_user_stibp == SPECTRE_V2_USER_PRCTL ||
1361− spectre_v2_user_stibp == SPECTRE_V2_USER_SECCOMP) {
1372+ else if (is_spec_ib_user_controlled()) {
13621373 if (task_spec_ib_force_disable(task))
13631374 return PR_SPEC_PRCTL | PR_SPEC_FORCE_DISABLE;
13641375 if (task_spec_ib_disable(task))
13651376 return PR_SPEC_PRCTL | PR_SPEC_DISABLE;
13661377 return PR_SPEC_PRCTL | PR_SPEC_ENABLE;
1367− } else
1378+ } else if (spectre_v2_user_ibpb == SPECTRE_V2_USER_STRICT ||
1379+ spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT ||
1380+ spectre_v2_user_stibp == SPECTRE_V2_USER_STRICT_PREFERRED)
1381+ return PR_SPEC_DISABLE;
1382+ else
13681383 return PR_SPEC_NOT_AFFECTED;
13691384 }
13701385
arch/x86/kernel/head_64.S+16−0
@@ -161,6 +161,21 @@ SYM_INNER_LABEL(secondary_startup_64_no_verify, SYM_L_GLOBAL) · 160 unmodified lines
161161
162162 /* Setup early boot stage 4-/5-level pagetables. */
163163 addq phys_base(%rip), %rax
164+
165+ /*
166+ * For SEV guests: Verify that the C-bit is correct. A malicious
167+ * hypervisor could lie about the C-bit position to perform a ROP
168+ * attack on the guest by writing to the unencrypted stack and wait for
169+ * the next RET instruction.
170+ * %rsi carries pointer to realmode data and is callee-clobbered. Save
171+ * and restore it.
172+ */
173+ pushq %rsi
174+ movq %rax, %rdi
175+ call sev_verify_cbit
176+ popq %rsi
177+
178+ /* Switch to new page-table */
164179 movq %rax, %cr3
165180
166181 /* Ensure I am executing from virtual addresses */
@@ -279,6 +294,7 @@ SYM_INNER_LABEL(secondary_startup_64_no_verify, SYM_L_GLOBAL) · 112 unmodified lines
279294 SYM_CODE_END(secondary_startup_64)
280295
281296 #include "verify_cpu.S"
297+#include "sev_verify_cbit.S"
282298
283299 #ifdef CONFIG_HOTPLUG_CPU
284300 /*
arch/x86/kernel/sev-es-shared.c+26−0
@@ -178,6 +178,32 @@ void __init do_vc_no_ghcb(struct pt_regs *regs, unsigned long exit_code) · 177 unmodified lines
178178 goto fail;
179179 regs->dx = val >> 32;
180180
181+ /*
182+ * This is a VC handler and the #VC is only raised when SEV-ES is
183+ * active, which means SEV must be active too. Do sanity checks on the
184+ * CPUID results to make sure the hypervisor does not trick the kernel
185+ * into the no-sev path. This could map sensitive data unencrypted and
186+ * make it accessible to the hypervisor.
187+ *
188+ * In particular, check for:
189+ * - Hypervisor CPUID bit
190+ * - Availability of CPUID leaf 0x8000001f
191+ * - SEV CPUID bit.
192+ *
193+ * The hypervisor might still report the wrong C-bit position, but this
194+ * can't be checked here.
195+ */
196+
197+ if ((fn == 1 && !(regs->cx & BIT(31))))
198+ /* Hypervisor bit */
199+ goto fail;
200+ else if (fn == 0x80000000 && (regs->ax < 0x8000001f))
201+ /* SEV leaf check */
202+ goto fail;
203+ else if ((fn == 0x8000001f && !(regs->ax & BIT(1))))
204+ /* SEV bit */
205+ goto fail;
206+
181207 /* Skip over the CPUID two-byte opcode */
182208 regs->ip += 2;
183209
arch/x86/kernel/sev-es.c+13−7
@@ -374,8 +374,8 @@ fault: · 373 unmodified lines
374374 return ES_EXCEPTION;
375375 }
376376
377−static bool vc_slow_virt_to_phys(struct ghcb *ghcb, struct es_em_ctxt *ctxt,
378− unsigned long vaddr, phys_addr_t *paddr)
377+static enum es_result vc_slow_virt_to_phys(struct ghcb *ghcb, struct es_em_ctxt *ctxt,
378+ unsigned long vaddr, phys_addr_t *paddr)
379379 {
380380 unsigned long va = (unsigned long)vaddr;
381381 unsigned int level;
@@ -394,15 +394,19 @@ static bool vc_slow_virt_to_phys(struct ghcb *ghcb, struct es_em_ctxt *ctxt, · 12 unmodified lines
394394 if (user_mode(ctxt->regs))
395395 ctxt->fi.error_code |= X86_PF_USER;
396396
397− return false;
397+ return ES_EXCEPTION;
398398 }
399399
400+ if (WARN_ON_ONCE(pte_val(*pte) & _PAGE_ENC))
401+ /* Emulated MMIO to/from encrypted memory not supported */
402+ return ES_UNSUPPORTED;
403+
400404 pa = (phys_addr_t)pte_pfn(*pte) << PAGE_SHIFT;
401405 pa |= va & ~page_level_mask(level);
402406
403407 *paddr = pa;
404408
405− return true;
409+ return ES_OK;
406410 }
407411
408412 /* Include code shared with pre-decompression boot stage */
@@ -731,6 +735,7 @@ static enum es_result vc_do_mmio(struct ghcb *ghcb, struct es_em_ctxt *ctxt, · 322 unmodified lines
731735 {
732736 u64 exit_code, exit_info_1, exit_info_2;
733737 unsigned long ghcb_pa = __pa(ghcb);
738+ enum es_result res;
734739 phys_addr_t paddr;
735740 void __user *ref;
736741
@@ -740,11 +745,12 @@ static enum es_result vc_do_mmio(struct ghcb *ghcb, struct es_em_ctxt *ctxt, · 3 unmodified lines
740745
741746 exit_code = read ? SVM_VMGEXIT_MMIO_READ : SVM_VMGEXIT_MMIO_WRITE;
742747
743− if (!vc_slow_virt_to_phys(ghcb, ctxt, (unsigned long)ref, &paddr)) {
744− if (!read)
748+ res = vc_slow_virt_to_phys(ghcb, ctxt, (unsigned long)ref, &paddr);
749+ if (res != ES_OK) {
750+ if (res == ES_EXCEPTION && !read)
745751 ctxt->fi.error_code |= X86_PF_WRITE;
746752
747− return ES_EXCEPTION;
753+ return res;
748754 }
749755
750756 exit_info_1 = paddr;
arch/x86/kernel/sev_verify_cbit.S+89−0
@@ -0,0 +1,89 @@
1+/* SPDX-License-Identifier: GPL-2.0-only */
2+/*
3+ * sev_verify_cbit.S - Code for verification of the C-bit position reported
4+ * by the Hypervisor when running with SEV enabled.
5+ *
6+ * Copyright (c) 2020 Joerg Roedel (jroedel@suse.de)
7+ *
8+ * sev_verify_cbit() is called before switching to a new long-mode page-table
9+ * at boot.
10+ *
11+ * Verify that the C-bit position is correct by writing a random value to
12+ * an encrypted memory location while on the current page-table. Then it
13+ * switches to the new page-table to verify the memory content is still the
14+ * same. After that it switches back to the current page-table and when the
15+ * check succeeded it returns. If the check failed the code invalidates the
16+ * stack pointer and goes into a hlt loop. The stack-pointer is invalidated to
17+ * make sure no interrupt or exception can get the CPU out of the hlt loop.
18+ *
19+ * New page-table pointer is expected in %rdi (first parameter)
20+ *
21+ */
22+SYM_FUNC_START(sev_verify_cbit)
23+#ifdef CONFIG_AMD_MEM_ENCRYPT
24+ /* First check if a C-bit was detected */
25+ movq sme_me_mask(%rip), %rsi
26+ testq %rsi, %rsi
27+ jz 3f
28+
29+ /* sme_me_mask != 0 could mean SME or SEV - Check also for SEV */
30+ movq sev_status(%rip), %rsi
31+ testq %rsi, %rsi
32+ jz 3f
33+
34+ /* Save CR4 in %rsi */
35+ movq %cr4, %rsi
36+
37+ /* Disable Global Pages */
38+ movq %rsi, %rdx
39+ andq $(~X86_CR4_PGE), %rdx
40+ movq %rdx, %cr4
41+
42+ /*
43+ * Verified that running under SEV - now get a random value using
44+ * RDRAND. This instruction is mandatory when running as an SEV guest.
45+ *
46+ * Don't bail out of the loop if RDRAND returns errors. It is better to
47+ * prevent forward progress than to work with a non-random value here.
48+ */
49+1: rdrand %rdx
50+ jnc 1b
51+
52+ /* Store value to memory and keep it in %rdx */
53+ movq %rdx, sev_check_data(%rip)
54+
55+ /* Backup current %cr3 value to restore it later */
56+ movq %cr3, %rcx
57+
58+ /* Switch to new %cr3 - This might unmap the stack */
59+ movq %rdi, %cr3
60+
61+ /*
62+ * Compare value in %rdx with memory location. If C-bit is incorrect
63+ * this would read the encrypted data and make the check fail.
64+ */
65+ cmpq %rdx, sev_check_data(%rip)
66+
67+ /* Restore old %cr3 */
68+ movq %rcx, %cr3
69+
70+ /* Restore previous CR4 */
71+ movq %rsi, %cr4
72+
73+ /* Check CMPQ result */
74+ je 3f
75+
76+ /*
77+ * The check failed, prevent any forward progress to prevent ROP
78+ * attacks, invalidate the stack and go into a hlt loop.
79+ */
80+ xorq %rsp, %rsp
81+ subq $0x1000, %rsp
82+2: hlt
83+ jmp 2b
84+3:
85+#endif
86+ /* Return page-table pointer */
87+ movq %rdi, %rax
88+ ret
89+SYM_FUNC_END(sev_verify_cbit)
arch/x86/lib/memcpy_64.S+1−3
@@ -16,8 +16,6 @@ · 15 unmodified lines
1616 * to a jmp to memcpy_erms which does the REP; MOVSB mem copy.
1717 */
1818
19−.weak memcpy
20−
2119 /*
2220 * memcpy - Copy a memory block.
2321 *
@@ -30,7 +28,7 @@ · 6 unmodified lines
3028 * rax original destination
3129 */
3230 SYM_FUNC_START_ALIAS(__memcpy)
33−SYM_FUNC_START_LOCAL(memcpy)
31+SYM_FUNC_START_WEAK(memcpy)
3432 ALTERNATIVE_2 "jmp memcpy_orig", "", X86_FEATURE_REP_GOOD, \
3533 "jmp memcpy_erms", X86_FEATURE_ERMS
3634
arch/x86/lib/memmove_64.S+1−3
@@ -24,9 +24,7 @@ · 23 unmodified lines
2424 * Output:
2525 * rax: dest
2626 */
27−.weak memmove
28−
29−SYM_FUNC_START_ALIAS(memmove)
27+SYM_FUNC_START_WEAK(memmove)
3028 SYM_FUNC_START(__memmove)
3129
3230 mov %rdi, %rax
arch/x86/lib/memset_64.S+1−3
@@ -6,8 +6,6 @@ · 5 unmodified lines
66 #include <asm/alternative-asm.h>
77 #include <asm/export.h>
88
9−.weak memset
10−
119 /*
1210 * ISO C memset - set a memory block to a byte value. This function uses fast
1311 * string to get better performance than the original function. The code is
@@ -19,7 +17,7 @@ · 5 unmodified lines
1917 *
2018 * rax original destination
2119 */
22−SYM_FUNC_START_ALIAS(memset)
20+SYM_FUNC_START_WEAK(memset)
2321 SYM_FUNC_START(__memset)
2422 /*
2523 * Some CPUs support enhanced REP MOVSB/STOSB feature. It is recommended
arch/x86/mm/mem_encrypt.c+1−0
@@ -39,6 +39,7 @@ · 38 unmodified lines
3939 */
4040 u64 sme_me_mask __section(".data") = 0;
4141 u64 sev_status __section(".data") = 0;
42+u64 sev_check_data __section(".data") = 0;
4243 EXPORT_SYMBOL(sme_me_mask);
4344 DEFINE_STATIC_KEY_FALSE(sev_enable_key);
4445 EXPORT_SYMBOL_GPL(sev_enable_key);
arch/xtensa/mm/init.c+2−2
@@ -89,8 +89,8 @@ static void __init free_highpages(void) · 88 unmodified lines
8989 /* set highmem page free */
9090 for_each_free_mem_range(i, NUMA_NO_NODE, MEMBLOCK_NONE,
9191 &range_start, &range_end, NULL) {
92− unsigned long start = PHYS_PFN(range_start);
93− unsigned long end = PHYS_PFN(range_end);
92+ unsigned long start = PFN_UP(range_start);
93+ unsigned long end = PFN_DOWN(range_end);
9494
9595 /* Ignore complete lowmem entries */
9696 if (end <= max_low)
drivers/base/core.c+2−4
@@ -773,8 +773,7 @@ static void __device_link_del(struct kref *kref) · 772 unmodified lines
773773 dev_dbg(link->consumer, "Dropping the link to %s\n",
774774 dev_name(link->supplier));
775775
776− if (link->flags & DL_FLAG_PM_RUNTIME)
777− pm_runtime_drop_link(link->consumer);
776+ pm_runtime_drop_link(link);
778777
779778 list_del_rcu(&link->s_node);
780779 list_del_rcu(&link->c_node);
@@ -788,8 +787,7 @@ static void __device_link_del(struct kref *kref) · 7 unmodified lines
788787 dev_info(link->consumer, "Dropping the link to %s\n",
789788 dev_name(link->supplier));
790789
791− if (link->flags & DL_FLAG_PM_RUNTIME)
792− pm_runtime_drop_link(link->consumer);
790+ pm_runtime_drop_link(link);
793791
794792 list_del(&link->s_node);
795793 list_del(&link->c_node);
drivers/base/dd.c+5−4
@@ -1117,6 +1117,8 @@ static void __device_release_driver(struct device *dev, struct device *parent) · 1116 unmodified lines
11171117
11181118 drv = dev->driver;
11191119 if (drv) {
1120+ pm_runtime_get_sync(dev);
1121+
11201122 while (device_links_busy(dev)) {
11211123 __device_driver_unlock(dev, parent);
11221124
@@ -1128,13 +1130,12 @@ static void __device_release_driver(struct device *dev, struct device *parent) · 5 unmodified lines
11281130 * have released the driver successfully while this one
11291131 * was waiting, so check for that.
11301132 */
1131− if (dev->driver != drv)
1133+ if (dev->driver != drv) {
1134+ pm_runtime_put(dev);
11321135 return;
1136+ }
11331137 }
11341138
1135− pm_runtime_get_sync(dev);
1136− pm_runtime_clean_up_links(dev);
1137−
11381139 driver_sysfs_remove(dev);
11391140
11401141 if (dev->bus)
drivers/base/power/runtime.c+20−37
@@ -1642,42 +1642,6 @@ void pm_runtime_remove(struct device *dev) · 1641 unmodified lines
16421642 pm_runtime_reinit(dev);
16431643 }
16441644
1645−/**
1646− * pm_runtime_clean_up_links - Prepare links to consumers for driver removal.
1647− * @dev: Device whose driver is going to be removed.
1648− *
1649− * Check links from this device to any consumers and if any of them have active
1650− * runtime PM references to the device, drop the usage counter of the device
1651− * (as many times as needed).
1652− *
1653− * Links with the DL_FLAG_MANAGED flag unset are ignored.
1654− *
1655− * Since the device is guaranteed to be runtime-active at the point this is
1656− * called, nothing else needs to be done here.
1657− *
1658− * Moreover, this is called after device_links_busy() has returned 'false', so
1659− * the status of each link is guaranteed to be DL_STATE_SUPPLIER_UNBIND and
1660− * therefore rpm_active can't be manipulated concurrently.
1661− */
1662−void pm_runtime_clean_up_links(struct device *dev)
1663−{
1664− struct device_link *link;
1665− int idx;
1666−
1667− idx = device_links_read_lock();
1668−
1669− list_for_each_entry_rcu(link, &dev->links.consumers, s_node,
1670− device_links_read_lock_held()) {
1671− if (!(link->flags & DL_FLAG_MANAGED))
1672− continue;
1673−
1674− while (refcount_dec_not_one(&link->rpm_active))
1675− pm_runtime_put_noidle(dev);
1676− }
1677−
1678− device_links_read_unlock(idx);
1679−}
1680−
16811645 /**
16821646 * pm_runtime_get_suppliers - Resume and reference-count supplier devices.
16831647 * @dev: Consumer device.
@@ -1729,7 +1693,7 @@ void pm_runtime_new_link(struct device *dev) · 45 unmodified lines
17291693 spin_unlock_irq(&dev->power.lock);
17301694 }
17311695
1732−void pm_runtime_drop_link(struct device *dev)
1696+static void pm_runtime_drop_link_count(struct device *dev)
17331697 {
17341698 spin_lock_irq(&dev->power.lock);
17351699 WARN_ON(dev->power.links_count == 0);
@@ -1737,6 +1701,25 @@ void pm_runtime_drop_link(struct device *dev) · 1 unmodified line
17371701 spin_unlock_irq(&dev->power.lock);
17381702 }
17391703
1704+/**
1705+ * pm_runtime_drop_link - Prepare for device link removal.
1706+ * @link: Device link going away.
1707+ *
1708+ * Drop the link count of the consumer end of @link and decrement the supplier
1709+ * device's runtime PM usage counter as many times as needed to drop all of the
1710+ * PM runtime reference to it from the consumer.
1711+ */
1712+void pm_runtime_drop_link(struct device_link *link)
1713+{
1714+ if (!(link->flags & DL_FLAG_PM_RUNTIME))
1715+ return;
1716+
1717+ pm_runtime_drop_link_count(link->consumer);
1718+
1719+ while (refcount_dec_not_one(&link->rpm_active))
1720+ pm_runtime_put(link->supplier);
1721+}
1722+
17401723 static bool pm_runtime_need_not_resume(struct device *dev)
17411724 {
17421725 return atomic_read(&dev->power.usage_count) <= 1 &&
drivers/block/null_blk.h+1−1
@@ -47,7 +47,7 @@ struct nullb_device { · 46 unmodified lines
4747 unsigned int nr_zones_closed;
4848 struct blk_zone *zones;
4949 sector_t zone_size_sects;
50− spinlock_t zone_dev_lock;
50+ spinlock_t zone_lock;
5151 unsigned long *zone_locks;
5252
5353 unsigned long size; /* device size in MB */
drivers/block/null_blk_zoned.c+31−16
@@ -46,11 +46,20 @@ int null_init_zoned_dev(struct nullb_device *dev, struct request_queue *q) · 45 unmodified lines
4646 if (!dev->zones)
4747 return -ENOMEM;
4848
49− spin_lock_init(&dev->zone_dev_lock);
50− dev->zone_locks = bitmap_zalloc(dev->nr_zones, GFP_KERNEL);
51− if (!dev->zone_locks) {
52− kvfree(dev->zones);
53− return -ENOMEM;
49+ /*
50+ * With memory backing, the zone_lock spinlock needs to be temporarily
51+ * released to avoid scheduling in atomic context. To guarantee zone
52+ * information protection, use a bitmap to lock zones with
53+ * wait_on_bit_lock_io(). Sleeping on the lock is OK as memory backing
54+ * implies that the queue is marked with BLK_MQ_F_BLOCKING.
55+ */
56+ spin_lock_init(&dev->zone_lock);
57+ if (dev->memory_backed) {
58+ dev->zone_locks = bitmap_zalloc(dev->nr_zones, GFP_KERNEL);
59+ if (!dev->zone_locks) {
60+ kvfree(dev->zones);
61+ return -ENOMEM;
62+ }
5463 }
5564
5665 if (dev->zone_nr_conv >= dev->nr_zones) {
@@ -137,12 +146,17 @@ void null_free_zoned_dev(struct nullb_device *dev) · 80 unmodified lines
137146
138147 static inline void null_lock_zone(struct nullb_device *dev, unsigned int zno)
139148 {
140− wait_on_bit_lock_io(dev->zone_locks, zno, TASK_UNINTERRUPTIBLE);
149+ if (dev->memory_backed)
150+ wait_on_bit_lock_io(dev->zone_locks, zno, TASK_UNINTERRUPTIBLE);
151+ spin_lock_irq(&dev->zone_lock);
141152 }
142153
143154 static inline void null_unlock_zone(struct nullb_device *dev, unsigned int zno)
144155 {
145− clear_and_wake_up_bit(zno, dev->zone_locks);
156+ spin_unlock_irq(&dev->zone_lock);
157+
158+ if (dev->memory_backed)
159+ clear_and_wake_up_bit(zno, dev->zone_locks);
146160 }
147161
148162 int null_report_zones(struct gendisk *disk, sector_t sector,
@@ -322,7 +336,6 @@ static blk_status_t null_zone_write(struct nullb_cmd *cmd, sector_t sector, · 173 unmodified lines
322336 return null_process_cmd(cmd, REQ_OP_WRITE, sector, nr_sectors);
323337
324338 null_lock_zone(dev, zno);
325− spin_lock(&dev->zone_dev_lock);
326339
327340 switch (zone->cond) {
328341 case BLK_ZONE_COND_FULL:
@@ -375,9 +388,17 @@ static blk_status_t null_zone_write(struct nullb_cmd *cmd, sector_t sector, · 46 unmodified lines
375388 if (zone->cond != BLK_ZONE_COND_EXP_OPEN)
376389 zone->cond = BLK_ZONE_COND_IMP_OPEN;
377390
378− spin_unlock(&dev->zone_dev_lock);
391+ /*
392+ * Memory backing allocation may sleep: release the zone_lock spinlock
393+ * to avoid scheduling in atomic context. Zone operation atomicity is
394+ * still guaranteed through the zone_locks bitmap.
395+ */
396+ if (dev->memory_backed)
397+ spin_unlock_irq(&dev->zone_lock);
379398 ret = null_process_cmd(cmd, REQ_OP_WRITE, sector, nr_sectors);
380− spin_lock(&dev->zone_dev_lock);
399+ if (dev->memory_backed)
400+ spin_lock_irq(&dev->zone_lock);
401+
381402 if (ret != BLK_STS_OK)
382403 goto unlock;
383404
@@ -392,7 +413,6 @@ static blk_status_t null_zone_write(struct nullb_cmd *cmd, sector_t sector, · 8 unmodified lines
392413 ret = BLK_STS_OK;
393414
394415 unlock:
395− spin_unlock(&dev->zone_dev_lock);
396416 null_unlock_zone(dev, zno);
397417
398418 return ret;
@@ -516,9 +536,7 @@ static blk_status_t null_zone_mgmt(struct nullb_cmd *cmd, enum req_opf op, · 117 unmodified lines
516536 null_lock_zone(dev, i);
517537 zone = &dev->zones[i];
518538 if (zone->cond != BLK_ZONE_COND_EMPTY) {
519− spin_lock(&dev->zone_dev_lock);
520539 null_reset_zone(dev, zone);
521− spin_unlock(&dev->zone_dev_lock);
522540 trace_nullb_zone_op(cmd, i, zone->cond);
523541 }
524542 null_unlock_zone(dev, i);
@@ -530,7 +548,6 @@ static blk_status_t null_zone_mgmt(struct nullb_cmd *cmd, enum req_opf op, · 5 unmodified lines
530548 zone = &dev->zones[zone_no];
531549
532550 null_lock_zone(dev, zone_no);
533− spin_lock(&dev->zone_dev_lock);
534551
535552 switch (op) {
536553 case REQ_OP_ZONE_RESET:
@@ -550,8 +567,6 @@ static blk_status_t null_zone_mgmt(struct nullb_cmd *cmd, enum req_opf op, · 13 unmodified lines
550567 break;
551568 }
552569
553− spin_unlock(&dev->zone_dev_lock);
554−
555570 if (ret == BLK_STS_OK)
556571 trace_nullb_zone_op(cmd, zone_no, zone->cond);
557572
drivers/char/tpm/eventlog/efi.c+5−0
@@ -41,6 +41,11 @@ int tpm_read_log_efi(struct tpm_chip *chip) · 40 unmodified lines
4141 log_size = log_tbl->size;
4242 memunmap(log_tbl);
4343
44+ if (!log_size) {
45+ pr_warn("UEFI TPM log area empty\n");
46+ return -EIO;
47+ }
48+
4449 log_tbl = memremap(efi.tpm_log, sizeof(*log_tbl) + log_size,
4550 MEMREMAP_WB);
4651 if (!log_tbl) {
drivers/char/tpm/tpm_tis.c+27−2
@@ -27,6 +27,7 @@ · 26 unmodified lines
2727 #include <linux/of.h>
2828 #include <linux/of_device.h>
2929 #include <linux/kernel.h>
30+#include <linux/dmi.h>
3031 #include "tpm.h"
3132 #include "tpm_tis_core.h"
3233
@@ -49,8 +50,8 @@ static inline struct tpm_tis_tcg_phy *to_tpm_tis_tcg_phy(struct tpm_tis_data *da · 16 unmodified lines
4950 return container_of(data, struct tpm_tis_tcg_phy, priv);
5051 }
5152
52−static bool interrupts = true;
53−module_param(interrupts, bool, 0444);
53+static int interrupts = -1;
54+module_param(interrupts, int, 0444);
5455 MODULE_PARM_DESC(interrupts, "Enable interrupts");
5556
5657 static bool itpm;
@@ -63,6 +64,28 @@ module_param(force, bool, 0444); · 6 unmodified lines
6364 MODULE_PARM_DESC(force, "Force device probe rather than using ACPI entry");
6465 #endif
6566
67+static int tpm_tis_disable_irq(const struct dmi_system_id *d)
68+{
69+ if (interrupts == -1) {
70+ pr_notice("tpm_tis: %s detected: disabling interrupts.\n", d->ident);
71+ interrupts = 0;
72+ }
73+
74+ return 0;
75+}
76+
77+static const struct dmi_system_id tpm_tis_dmi_table[] = {
78+ {
79+ .callback = tpm_tis_disable_irq,
80+ .ident = "ThinkPad T490s",
81+ .matches = {
82+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
83+ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T490s"),
84+ },
85+ },
86+ {}
87+};
88+
6689 #if defined(CONFIG_PNP) && defined(CONFIG_ACPI)
6790 static int has_hid(struct acpi_device *dev, const char *hid)
6891 {
@@ -192,6 +215,8 @@ static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info) · 123 unmodified lines
192215 int irq = -1;
193216 int rc;
194217
218+ dmi_check_system(tpm_tis_dmi_table);
219+
195220 rc = check_acpi_tpm2(dev);
196221 if (rc)
197222 return rc;
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c+1−1
@@ -7,7 +7,7 @@ · 6 unmodified lines
77 *
88 * This file add support for MD5 and SHA1/SHA224/SHA256/SHA384/SHA512.
99 *
10− * You could find the datasheet in Documentation/arm/sunxi/README
10+ * You could find the datasheet in Documentation/arm/sunxi.rst
1111 */
1212 #include <linux/dma-mapping.h>
1313 #include <linux/pm_runtime.h>
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c+1−1
@@ -7,7 +7,7 @@ · 6 unmodified lines
77 *
88 * This file handle the PRNG
99 *
10− * You could find a link for the datasheet in Documentation/arm/sunxi/README
10+ * You could find a link for the datasheet in Documentation/arm/sunxi.rst
1111 */
1212 #include "sun8i-ce.h"
1313 #include <linux/dma-mapping.h>
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-trng.c+1−1
@@ -7,7 +7,7 @@ · 6 unmodified lines
77 *
88 * This file handle the TRNG
99 *
10− * You could find a link for the datasheet in Documentation/arm/sunxi/README
10+ * You could find a link for the datasheet in Documentation/arm/sunxi.rst
1111 */
1212 #include "sun8i-ce.h"
1313 #include <linux/dma-mapping.h>
drivers/gpu/drm/amd/display/include/dal_asic_id.h+4−0
@@ -217,6 +217,10 @@ enum { · 216 unmodified lines
217217 #ifndef ASICREV_IS_VANGOGH
218218 #define ASICREV_IS_VANGOGH(eChipRev) ((eChipRev >= VANGOGH_A0) && (eChipRev < VANGOGH_UNKNOWN))
219219 #endif
220+#define GREEN_SARDINE_A0 0xA1
221+#ifndef ASICREV_IS_GREEN_SARDINE
222+#define ASICREV_IS_GREEN_SARDINE(eChipRev) ((eChipRev >= GREEN_SARDINE_A0) && (eChipRev < 0xFF))
223+#endif
220224
221225 /*
222226 * ASIC chip ID
drivers/gpu/drm/i915/gem/i915_gem_domain.c+13−15
@@ -508,21 +508,6 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data, · 507 unmodified lines
508508 if (!obj)
509509 return -ENOENT;
510510
511− /*
512− * Already in the desired write domain? Nothing for us to do!
513− *
514− * We apply a little bit of cunning here to catch a broader set of
515− * no-ops. If obj->write_domain is set, we must be in the same
516− * obj->read_domains, and only that domain. Therefore, if that
517− * obj->write_domain matches the request read_domains, we are
518− * already in the same read/write domain and can skip the operation,
519− * without having to further check the requested write_domain.
520− */
521− if (READ_ONCE(obj->write_domain) == read_domains) {
522− err = 0;
523− goto out;
524− }
525−
526511 /*
527512 * Try to flush the object off the GPU without holding the lock.
528513 * We will repeat the flush holding the lock in the normal manner
@@ -560,6 +545,19 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data, · 31 unmodified lines
560545 if (err)
561546 goto out;
562547
548+ /*
549+ * Already in the desired write domain? Nothing for us to do!
550+ *
551+ * We apply a little bit of cunning here to catch a broader set of
552+ * no-ops. If obj->write_domain is set, we must be in the same
553+ * obj->read_domains, and only that domain. Therefore, if that
554+ * obj->write_domain matches the request read_domains, we are
555+ * already in the same read/write domain and can skip the operation,
556+ * without having to further check the requested write_domain.
557+ */
558+ if (READ_ONCE(obj->write_domain) == read_domains)
559+ goto out_unpin;
560+
563561 err = i915_gem_object_lock_interruptible(obj, NULL);
564562 if (err)
565563 goto out_unpin;
drivers/gpu/drm/i915/gt/intel_engine.h+35−20
@@ -245,22 +245,14 @@ static inline u32 *gen12_emit_pipe_control(u32 *batch, u32 flags0, u32 flags1, u · 244 unmodified lines
245245 }
246246
247247 static inline u32 *
248−__gen8_emit_ggtt_write_rcs(u32 *cs, u32 value, u32 gtt_offset, u32 flags0, u32 flags1)
248+__gen8_emit_write_rcs(u32 *cs, u32 value, u32 offset, u32 flags0, u32 flags1)
249249 {
250− /* We're using qword write, offset should be aligned to 8 bytes. */
251− GEM_BUG_ON(!IS_ALIGNED(gtt_offset, 8));
252−
253− /* w/a for post sync ops following a GPGPU operation we
254− * need a prior CS_STALL, which is emitted by the flush
255− * following the batch.
256− */
257250 *cs++ = GFX_OP_PIPE_CONTROL(6) | flags0;
258− *cs++ = flags1 | PIPE_CONTROL_QW_WRITE | PIPE_CONTROL_GLOBAL_GTT_IVB;
259− *cs++ = gtt_offset;
251+ *cs++ = flags1 | PIPE_CONTROL_QW_WRITE;
252+ *cs++ = offset;
260253 *cs++ = 0;
261254 *cs++ = value;
262− /* We're thrashing one dword of HWS. */
263− *cs++ = 0;
255+ *cs++ = 0; /* We're thrashing one extra dword. */
264256
265257 return cs;
266258 }
@@ -268,13 +260,38 @@ __gen8_emit_ggtt_write_rcs(u32 *cs, u32 value, u32 gtt_offset, u32 flags0, u32 f · 1 unmodified line
268260 static inline u32*
269261 gen8_emit_ggtt_write_rcs(u32 *cs, u32 value, u32 gtt_offset, u32 flags)
270262 {
271− return __gen8_emit_ggtt_write_rcs(cs, value, gtt_offset, 0, flags);
263+ /* We're using qword write, offset should be aligned to 8 bytes. */
264+ GEM_BUG_ON(!IS_ALIGNED(gtt_offset, 8));
265+
266+ return __gen8_emit_write_rcs(cs,
267+ value,
268+ gtt_offset,
269+ 0,
270+ flags | PIPE_CONTROL_GLOBAL_GTT_IVB);
272271 }
273272
274273 static inline u32*
275274 gen12_emit_ggtt_write_rcs(u32 *cs, u32 value, u32 gtt_offset, u32 flags0, u32 flags1)
276275 {
277− return __gen8_emit_ggtt_write_rcs(cs, value, gtt_offset, flags0, flags1);
276+ /* We're using qword write, offset should be aligned to 8 bytes. */
277+ GEM_BUG_ON(!IS_ALIGNED(gtt_offset, 8));
278+
279+ return __gen8_emit_write_rcs(cs,
280+ value,
281+ gtt_offset,
282+ flags0,
283+ flags1 | PIPE_CONTROL_GLOBAL_GTT_IVB);
284+}
285+
286+static inline u32 *
287+__gen8_emit_flush_dw(u32 *cs, u32 value, u32 gtt_offset, u32 flags)
288+{
289+ *cs++ = (MI_FLUSH_DW + 1) | flags;
290+ *cs++ = gtt_offset;
291+ *cs++ = 0;
292+ *cs++ = value;
293+
294+ return cs;
278295 }
279296
280297 static inline u32 *
@@ -285,12 +302,10 @@ gen8_emit_ggtt_write(u32 *cs, u32 value, u32 gtt_offset, u32 flags) · 4 unmodified lines
285302 /* Offset should be aligned to 8 bytes for both (QW/DW) write types */
286303 GEM_BUG_ON(!IS_ALIGNED(gtt_offset, 8));
287304
288− *cs++ = (MI_FLUSH_DW + 1) | MI_FLUSH_DW_OP_STOREDW | flags;
289− *cs++ = gtt_offset | MI_FLUSH_DW_USE_GTT;
290− *cs++ = 0;
291− *cs++ = value;
292−
293− return cs;
305+ return __gen8_emit_flush_dw(cs,
306+ value,
307+ gtt_offset | MI_FLUSH_DW_USE_GTT,
308+ flags | MI_FLUSH_DW_OP_STOREDW);
294309 }
295310
296311 static inline void __intel_engine_reset(struct intel_engine_cs *engine,
drivers/gpu/drm/i915/gt/intel_lrc.c+22−9
@@ -3547,6 +3547,19 @@ static const struct intel_context_ops execlists_context_ops = { · 3546 unmodified lines
35473547 .destroy = execlists_context_destroy,
35483548 };
35493549
3550+static u32 hwsp_offset(const struct i915_request *rq)
3551+{
3552+ const struct intel_timeline_cacheline *cl;
3553+
3554+ /* Before the request is executed, the timeline/cachline is fixed */
3555+
3556+ cl = rcu_dereference_protected(rq->hwsp_cacheline, 1);
3557+ if (cl)
3558+ return cl->ggtt_offset;
3559+
3560+ return rcu_dereference_protected(rq->timeline, 1)->hwsp_offset;
3561+}
3562+
35503563 static int gen8_emit_init_breadcrumb(struct i915_request *rq)
35513564 {
35523565 u32 *cs;
@@ -3569,7 +3582,7 @@ static int gen8_emit_init_breadcrumb(struct i915_request *rq) · 16 unmodified lines
35693582 *cs++ = MI_NOOP;
35703583
35713584 *cs++ = MI_STORE_DWORD_IMM_GEN4 | MI_USE_GGTT;
3572− *cs++ = i915_request_timeline(rq)->hwsp_offset;
3585+ *cs++ = hwsp_offset(rq);
35733586 *cs++ = 0;
35743587 *cs++ = rq->fence.seqno - 1;
35753588
@@ -4886,11 +4899,9 @@ gen8_emit_fini_breadcrumb_tail(struct i915_request *request, u32 *cs) · 1310 unmodified lines
48864899 return gen8_emit_wa_tail(request, cs);
48874900 }
48884901
4889−static u32 *emit_xcs_breadcrumb(struct i915_request *request, u32 *cs)
4902+static u32 *emit_xcs_breadcrumb(struct i915_request *rq, u32 *cs)
48904903 {
4891− u32 addr = i915_request_active_timeline(request)->hwsp_offset;
4892−
4893− return gen8_emit_ggtt_write(cs, request->fence.seqno, addr, 0);
4904+ return gen8_emit_ggtt_write(cs, rq->fence.seqno, hwsp_offset(rq), 0);
48944905 }
48954906
48964907 static u32 *gen8_emit_fini_breadcrumb(struct i915_request *rq, u32 *cs)
@@ -4909,7 +4920,7 @@ static u32 *gen8_emit_fini_breadcrumb_rcs(struct i915_request *request, u32 *cs) · 12 unmodified lines
49094920 /* XXX flush+write+CS_STALL all in one upsets gem_concurrent_blt:kbl */
49104921 cs = gen8_emit_ggtt_write_rcs(cs,
49114922 request->fence.seqno,
4912− i915_request_active_timeline(request)->hwsp_offset,
4923+ hwsp_offset(request),
49134924 PIPE_CONTROL_FLUSH_ENABLE |
49144925 PIPE_CONTROL_CS_STALL);
49154926
@@ -4921,7 +4932,7 @@ gen11_emit_fini_breadcrumb_rcs(struct i915_request *request, u32 *cs) · 5 unmodified lines
49214932 {
49224933 cs = gen8_emit_ggtt_write_rcs(cs,
49234934 request->fence.seqno,
4924− i915_request_active_timeline(request)->hwsp_offset,
4935+ hwsp_offset(request),
49254936 PIPE_CONTROL_CS_STALL |
49264937 PIPE_CONTROL_TILE_CACHE_FLUSH |
49274938 PIPE_CONTROL_RENDER_TARGET_CACHE_FLUSH |
@@ -4983,7 +4994,9 @@ gen12_emit_fini_breadcrumb_tail(struct i915_request *request, u32 *cs) · 55 unmodified lines
49834994
49844995 static u32 *gen12_emit_fini_breadcrumb(struct i915_request *rq, u32 *cs)
49854996 {
4986− return gen12_emit_fini_breadcrumb_tail(rq, emit_xcs_breadcrumb(rq, cs));
4997+ /* XXX Stalling flush before seqno write; post-sync not */
4998+ cs = emit_xcs_breadcrumb(rq, __gen8_emit_flush_dw(cs, 0, 0, 0));
4999+ return gen12_emit_fini_breadcrumb_tail(rq, cs);
49875000 }
49885001
49895002 static u32 *
@@ -4991,7 +5004,7 @@ gen12_emit_fini_breadcrumb_rcs(struct i915_request *request, u32 *cs) · 1 unmodified line
49915004 {
49925005 cs = gen12_emit_ggtt_write_rcs(cs,
49935006 request->fence.seqno,
4994− i915_request_active_timeline(request)->hwsp_offset,
5007+ hwsp_offset(request),
49955008 PIPE_CONTROL0_HDC_PIPELINE_FLUSH,
49965009 PIPE_CONTROL_CS_STALL |
49975010 PIPE_CONTROL_TILE_CACHE_FLUSH |
drivers/gpu/drm/i915/gt/intel_timeline.c+10−8
@@ -188,10 +188,14 @@ cacheline_alloc(struct intel_timeline_hwsp *hwsp, unsigned int cacheline) · 187 unmodified lines
188188 return cl;
189189 }
190190
191−static void cacheline_acquire(struct intel_timeline_cacheline *cl)
191+static void cacheline_acquire(struct intel_timeline_cacheline *cl,
192+ u32 ggtt_offset)
192193 {
193− if (cl)
194− i915_active_acquire(&cl->active);
194+ if (!cl)
195+ return;
196+
197+ cl->ggtt_offset = ggtt_offset;
198+ i915_active_acquire(&cl->active);
195199 }
196200
197201 static void cacheline_release(struct intel_timeline_cacheline *cl)
@@ -340,7 +344,7 @@ int intel_timeline_pin(struct intel_timeline *tl, struct i915_gem_ww_ctx *ww) · 142 unmodified lines
340344 GT_TRACE(tl->gt, "timeline:%llx using HWSP offset:%x\n",
341345 tl->fence_context, tl->hwsp_offset);
342346
343− cacheline_acquire(tl->hwsp_cacheline);
347+ cacheline_acquire(tl->hwsp_cacheline, tl->hwsp_offset);
344348 if (atomic_fetch_inc(&tl->pin_count)) {
345349 cacheline_release(tl->hwsp_cacheline);
346350 __i915_vma_unpin(tl->hwsp_ggtt);
@@ -515,7 +519,7 @@ __intel_timeline_get_seqno(struct intel_timeline *tl, · 168 unmodified lines
515519 GT_TRACE(tl->gt, "timeline:%llx using HWSP offset:%x\n",
516520 tl->fence_context, tl->hwsp_offset);
517521
518− cacheline_acquire(cl);
522+ cacheline_acquire(cl, tl->hwsp_offset);
519523 tl->hwsp_cacheline = cl;
520524
521525 *seqno = timeline_advance(tl);
@@ -573,9 +577,7 @@ int intel_timeline_read_hwsp(struct i915_request *from, · 51 unmodified lines
573577 if (err)
574578 goto out;
575579
576− *hwsp = i915_ggtt_offset(cl->hwsp->vma) +
577− ptr_unmask_bits(cl->vaddr, CACHELINE_BITS) * CACHELINE_BYTES;
578−
580+ *hwsp = cl->ggtt_offset;
579581 out:
580582 i915_active_release(&cl->active);
581583 return err;
drivers/gpu/drm/i915/gt/intel_timeline_types.h+2−0
@@ -94,6 +94,8 @@ struct intel_timeline_cacheline { · 93 unmodified lines
9494 struct intel_timeline_hwsp *hwsp;
9595 void *vaddr;
9696
97+ u32 ggtt_offset;
98+
9799 struct rcu_head rcu;
98100 };
99101
drivers/gpu/drm/i915/gvt/handlers.c+44−3
@@ -1489,7 +1489,8 @@ static int hws_pga_write(struct intel_vgpu *vgpu, unsigned int offset, · 1488 unmodified lines
14891489 const struct intel_engine_cs *engine =
14901490 intel_gvt_render_mmio_to_engine(vgpu->gvt, offset);
14911491
1492− if (!intel_gvt_ggtt_validate_range(vgpu, value, I915_GTT_PAGE_SIZE)) {
1492+ if (value != 0 &&
1493+ !intel_gvt_ggtt_validate_range(vgpu, value, I915_GTT_PAGE_SIZE)) {
14931494 gvt_vgpu_err("write invalid HWSP address, reg:0x%x, value:0x%x\n",
14941495 offset, value);
14951496 return -EINVAL;
@@ -1650,6 +1651,34 @@ static int edp_psr_imr_iir_write(struct intel_vgpu *vgpu, · 154 unmodified lines
16501651 return 0;
16511652 }
16521653
1654+/**
1655+ * FixMe:
1656+ * If guest fills non-priv batch buffer on ApolloLake/Broxton as Mesa i965 did:
1657+ * 717e7539124d (i965: Use a WC map and memcpy for the batch instead of pwrite.)
1658+ * Due to the missing flush of bb filled by VM vCPU, host GPU hangs on executing
1659+ * these MI_BATCH_BUFFER.
1660+ * Temporarily workaround this by setting SNOOP bit for PAT3 used by PPGTT
1661+ * PML4 PTE: PAT(0) PCD(1) PWT(1).
1662+ * The performance is still expected to be low, will need further improvement.
1663+ */
1664+static int bxt_ppat_low_write(struct intel_vgpu *vgpu, unsigned int offset,
1665+ void *p_data, unsigned int bytes)
1666+{
1667+ u64 pat =
1668+ GEN8_PPAT(0, CHV_PPAT_SNOOP) |
1669+ GEN8_PPAT(1, 0) |
1670+ GEN8_PPAT(2, 0) |
1671+ GEN8_PPAT(3, CHV_PPAT_SNOOP) |
1672+ GEN8_PPAT(4, CHV_PPAT_SNOOP) |
1673+ GEN8_PPAT(5, CHV_PPAT_SNOOP) |
1674+ GEN8_PPAT(6, CHV_PPAT_SNOOP) |
1675+ GEN8_PPAT(7, CHV_PPAT_SNOOP);
1676+
1677+ vgpu_vreg(vgpu, offset) = lower_32_bits(pat);
1678+
1679+ return 0;
1680+}
1681+
16531682 static int guc_status_read(struct intel_vgpu *vgpu,
16541683 unsigned int offset, void *p_data,
16551684 unsigned int bytes)
@@ -2812,7 +2841,7 @@ static int init_bdw_mmio_info(struct intel_gvt *gvt) · 1156 unmodified lines
28122841
28132842 MMIO_DH(GEN6_PCODE_MAILBOX, D_BDW_PLUS, NULL, mailbox_write);
28142843
2815− MMIO_D(GEN8_PRIVATE_PAT_LO, D_BDW_PLUS);
2844+ MMIO_D(GEN8_PRIVATE_PAT_LO, D_BDW_PLUS & ~D_BXT);
28162845 MMIO_D(GEN8_PRIVATE_PAT_HI, D_BDW_PLUS);
28172846
28182847 MMIO_D(GAMTARBMODE, D_BDW_PLUS);
@@ -3139,7 +3168,7 @@ static int init_skl_mmio_info(struct intel_gvt *gvt) · 320 unmodified lines
31393168 NULL, NULL);
31403169
31413170 MMIO_DFH(GAMT_CHKN_BIT_REG, D_KBL | D_CFL, F_CMD_ACCESS, NULL, NULL);
3142− MMIO_D(GEN9_CTX_PREEMPT_REG, D_SKL_PLUS);
3171+ MMIO_D(GEN9_CTX_PREEMPT_REG, D_SKL_PLUS & ~D_BXT);
31433172
31443173 return 0;
31453174 }
@@ -3313,9 +3342,21 @@ static int init_bxt_mmio_info(struct intel_gvt *gvt) · 167 unmodified lines
33133342 MMIO_D(GEN8_PUSHBUS_SHIFT, D_BXT);
33143343 MMIO_D(GEN6_GFXPAUSE, D_BXT);
33153344 MMIO_DFH(GEN8_L3SQCREG1, D_BXT, F_CMD_ACCESS, NULL, NULL);
3345+ MMIO_DFH(GEN8_L3CNTLREG, D_BXT, F_CMD_ACCESS, NULL, NULL);
3346+ MMIO_DFH(_MMIO(0x20D8), D_BXT, F_CMD_ACCESS, NULL, NULL);
3347+ MMIO_F(GEN8_RING_CS_GPR(RENDER_RING_BASE, 0), 0x40, F_CMD_ACCESS,
3348+ 0, 0, D_BXT, NULL, NULL);
3349+ MMIO_F(GEN8_RING_CS_GPR(GEN6_BSD_RING_BASE, 0), 0x40, F_CMD_ACCESS,
3350+ 0, 0, D_BXT, NULL, NULL);
3351+ MMIO_F(GEN8_RING_CS_GPR(BLT_RING_BASE, 0), 0x40, F_CMD_ACCESS,
3352+ 0, 0, D_BXT, NULL, NULL);
3353+ MMIO_F(GEN8_RING_CS_GPR(VEBOX_RING_BASE, 0), 0x40, F_CMD_ACCESS,
3354+ 0, 0, D_BXT, NULL, NULL);
33163355
33173356 MMIO_DFH(GEN9_CTX_PREEMPT_REG, D_BXT, F_CMD_ACCESS, NULL, NULL);
33183357
3358+ MMIO_DH(GEN8_PRIVATE_PAT_LO, D_BXT, NULL, bxt_ppat_low_write);
3359+
33193360 return 0;
33203361 }
33213362
drivers/gpu/drm/i915/gvt/scheduler.c+8−7
@@ -1277,7 +1277,7 @@ void intel_vgpu_clean_submission(struct intel_vgpu *vgpu) · 1276 unmodified lines
12771277
12781278 i915_context_ppgtt_root_restore(s, i915_vm_to_ppgtt(s->shadow[0]->vm));
12791279 for_each_engine(engine, vgpu->gvt->gt, id)
1280− intel_context_unpin(s->shadow[id]);
1280+ intel_context_put(s->shadow[id]);
12811281
12821282 kmem_cache_destroy(s->workloads);
12831283 }
@@ -1369,11 +1369,6 @@ int intel_vgpu_setup_submission(struct intel_vgpu *vgpu) · 85 unmodified lines
13691369 ce->ring = __intel_context_ring_size(ring_size);
13701370 }
13711371
1372− ret = intel_context_pin(ce);
1373− intel_context_put(ce);
1374− if (ret)
1375− goto out_shadow_ctx;
1376−
13771372 s->shadow[i] = ce;
13781373 }
13791374
@@ -1405,7 +1400,6 @@ out_shadow_ctx: · 25 unmodified lines
14051400 if (IS_ERR(s->shadow[i]))
14061401 break;
14071402
1408− intel_context_unpin(s->shadow[i]);
14091403 intel_context_put(s->shadow[i]);
14101404 }
14111405 i915_vm_put(&ppgtt->vm);
@@ -1479,6 +1473,7 @@ void intel_vgpu_destroy_workload(struct intel_vgpu_workload *workload) · 67 unmodified lines
14791473 {
14801474 struct intel_vgpu_submission *s = &workload->vgpu->submission;
14811475
1476+ intel_context_unpin(s->shadow[workload->engine->id]);
14821477 release_shadow_batch_buffer(workload);
14831478 release_shadow_wa_ctx(&workload->wa_ctx);
14841479
@@ -1724,6 +1719,12 @@ intel_vgpu_create_workload(struct intel_vgpu *vgpu, · 239 unmodified lines
17241719 return ERR_PTR(ret);
17251720 }
17261721
1722+ ret = intel_context_pin(s->shadow[engine->id]);
1723+ if (ret) {
1724+ intel_vgpu_destroy_workload(workload);
1725+ return ERR_PTR(ret);
1726+ }
1727+
17271728 return workload;
17281729 }
17291730
drivers/gpu/drm/i915/i915_vma.c+4−2
@@ -314,8 +314,10 @@ static void __vma_release(struct dma_fence_work *work) · 313 unmodified lines
314314 {
315315 struct i915_vma_work *vw = container_of(work, typeof(*vw), base);
316316
317− if (vw->pinned)
317+ if (vw->pinned) {
318318 __i915_gem_object_unpin_pages(vw->pinned);
319+ i915_gem_object_put(vw->pinned);
320+ }
319321
320322 i915_vm_free_pt_stash(vw->vm, &vw->stash);
321323 i915_vm_put(vw->vm);
@@ -431,7 +433,7 @@ int i915_vma_bind(struct i915_vma *vma, · 109 unmodified lines
431433
432434 if (vma->obj) {
433435 __i915_gem_object_pin_pages(vma->obj);
434− work->pinned = vma->obj;
436+ work->pinned = i915_gem_object_get(vma->obj);
435437 }
436438 } else {
437439 vma->ops->bind_vma(vma->vm, NULL, vma, cache_level, bind_flags);
drivers/gpu/drm/imx/dw_hdmi-imx.c+3−14
@@ -111,10 +111,6 @@ static int dw_hdmi_imx_parse_dt(struct imx_hdmi *hdmi) · 110 unmodified lines
111111 return 0;
112112 }
113113
114−static void dw_hdmi_imx_encoder_disable(struct drm_encoder *encoder)
115−{
116−}
117−
118114 static void dw_hdmi_imx_encoder_enable(struct drm_encoder *encoder)
119115 {
120116 struct imx_hdmi *hdmi = enc_to_imx_hdmi(encoder);
@@ -140,7 +136,6 @@ static int dw_hdmi_imx_atomic_check(struct drm_encoder *encoder, · 19 unmodified lines
140136
141137 static const struct drm_encoder_helper_funcs dw_hdmi_imx_encoder_helper_funcs = {
142138 .enable = dw_hdmi_imx_encoder_enable,
143− .disable = dw_hdmi_imx_encoder_disable,
144139 .atomic_check = dw_hdmi_imx_atomic_check,
145140 };
146141
@@ -219,15 +214,9 @@ static int dw_hdmi_imx_bind(struct device *dev, struct device *master, · 72 unmodified lines
219214 hdmi->dev = &pdev->dev;
220215 encoder = &hdmi->encoder;
221216
222− encoder->possible_crtcs = drm_of_find_possible_crtcs(drm, dev->of_node);
223− /*
224− * If we failed to find the CRTC(s) which this encoder is
225− * supposed to be connected to, it's because the CRTC has
226− * not been registered yet. Defer probing, and hope that
227− * the required CRTC is added later.
228− */
229− if (encoder->possible_crtcs == 0)
230− return -EPROBE_DEFER;
217+ ret = imx_drm_encoder_parse_of(drm, encoder, dev->of_node);
218+ if (ret)
219+ return ret;
231220
232221 ret = dw_hdmi_imx_parse_dt(hdmi);
233222 if (ret < 0)
drivers/gpu/drm/imx/imx-drm-core.c+5−5
@@ -20,6 +20,7 @@ · 19 unmodified lines
2020 #include <drm/drm_fb_helper.h>
2121 #include <drm/drm_gem_cma_helper.h>
2222 #include <drm/drm_gem_framebuffer_helper.h>
23+#include <drm/drm_managed.h>
2324 #include <drm/drm_of.h>
2425 #include <drm/drm_plane_helper.h>
2526 #include <drm/drm_probe_helper.h>
@@ -212,7 +213,9 @@ static int imx_drm_bind(struct device *dev) · 186 unmodified lines
212213 drm->mode_config.allow_fb_modifiers = true;
213214 drm->mode_config.normalize_zpos = true;
214215
215− drm_mode_config_init(drm);
216+ ret = drmm_mode_config_init(drm);
217+ if (ret)
218+ return ret;
216219
217220 ret = drm_vblank_init(drm, MAX_CRTC);
218221 if (ret)
@@ -251,7 +254,6 @@ err_poll_fini: · 32 unmodified lines
251254 drm_kms_helper_poll_fini(drm);
252255 component_unbind_all(drm->dev, drm);
253256 err_kms:
254− drm_mode_config_cleanup(drm);
255257 drm_dev_put(drm);
256258
257259 return ret;
@@ -267,11 +269,9 @@ static void imx_drm_unbind(struct device *dev) · 9 unmodified lines
267269
268270 component_unbind_all(drm->dev, drm);
269271
270− drm_mode_config_cleanup(drm);
272+ drm_dev_put(drm);
271273
272274 dev_set_drvdata(dev, NULL);
273−
274− drm_dev_put(drm);
275275 }
276276
277277 static const struct component_master_ops imx_drm_ops = {
drivers/gpu/drm/imx/imx-ldb.c+4−6
@@ -62,7 +62,6 @@ struct imx_ldb_channel { · 61 unmodified lines
6262 struct i2c_adapter *ddc;
6363 int chno;
6464 void *edid;
65− int edid_len;
6665 struct drm_display_mode mode;
6766 int mode_valid;
6867 u32 bus_format;
@@ -536,15 +535,14 @@ static int imx_ldb_panel_ddc(struct device *dev, · 467 unmodified lines
536535 }
537536
538537 if (!channel->ddc) {
538+ int edid_len;
539+
539540 /* if no DDC available, fallback to hardcoded EDID */
540541 dev_dbg(dev, "no ddc available\n");
541542
542− edidp = of_get_property(child, "edid",
543− &channel->edid_len);
543+ edidp = of_get_property(child, "edid", &edid_len);
544544 if (edidp) {
545− channel->edid = kmemdup(edidp,
546− channel->edid_len,
547− GFP_KERNEL);
545+ channel->edid = kmemdup(edidp, edid_len, GFP_KERNEL);
548546 } else if (!channel->panel) {
549547 /* fallback to display-timings node */
550548 ret = of_get_drm_display_mode(child,
drivers/gpu/drm/imx/imx-tve.c+6−34
@@ -13,7 +13,6 @@ · 12 unmodified lines
1313 #include <linux/platform_device.h>
1414 #include <linux/regmap.h>
1515 #include <linux/regulator/consumer.h>
16−#include <linux/spinlock.h>
1716 #include <linux/videodev2.h>
1817
1918 #include <video/imx-ipu-v3.h>
@@ -104,8 +103,6 @@ struct imx_tve { · 84 unmodified lines
104103 struct drm_connector connector;
105104 struct drm_encoder encoder;
106105 struct device *dev;
107− spinlock_t lock; /* register lock */
108− bool enabled;
109106 int mode;
110107 int di_hsync_pin;
111108 int di_vsync_pin;
@@ -129,30 +126,10 @@ static inline struct imx_tve *enc_to_tve(struct drm_encoder *e) · 17 unmodified lines
129126 return container_of(e, struct imx_tve, encoder);
130127 }
131128
132−static void tve_lock(void *__tve)
133−__acquires(&tve->lock)
134−{
135− struct imx_tve *tve = __tve;
136−
137− spin_lock(&tve->lock);
138−}
139−
140−static void tve_unlock(void *__tve)
141−__releases(&tve->lock)
142−{
143− struct imx_tve *tve = __tve;
144−
145− spin_unlock(&tve->lock);
146−}
147−
148129 static void tve_enable(struct imx_tve *tve)
149130 {
150− if (!tve->enabled) {
151− tve->enabled = true;
152− clk_prepare_enable(tve->clk);
153− regmap_update_bits(tve->regmap, TVE_COM_CONF_REG,
154− TVE_EN, TVE_EN);
155− }
131+ clk_prepare_enable(tve->clk);
132+ regmap_update_bits(tve->regmap, TVE_COM_CONF_REG, TVE_EN, TVE_EN);
156133
157134 /* clear interrupt status register */
158135 regmap_write(tve->regmap, TVE_STAT_REG, 0xffffffff);
@@ -169,11 +146,8 @@ static void tve_enable(struct imx_tve *tve) · 10 unmodified lines
169146
170147 static void tve_disable(struct imx_tve *tve)
171148 {
172− if (tve->enabled) {
173− tve->enabled = false;
174− regmap_update_bits(tve->regmap, TVE_COM_CONF_REG, TVE_EN, 0);
175− clk_disable_unprepare(tve->clk);
176− }
149+ regmap_update_bits(tve->regmap, TVE_COM_CONF_REG, TVE_EN, 0);
150+ clk_disable_unprepare(tve->clk);
177151 }
178152
179153 static int tve_setup_tvout(struct imx_tve *tve)
@@ -500,8 +474,7 @@ static struct regmap_config tve_regmap_config = { · 320 unmodified lines
500474
501475 .readable_reg = imx_tve_readable_reg,
502476
503− .lock = tve_lock,
504− .unlock = tve_unlock,
477+ .fast_io = true,
505478
506479 .max_register = 0xdc,
507480 };
@@ -511,7 +484,7 @@ static const char * const imx_tve_modes[] = { · 3 unmodified lines
511484 [TVE_MODE_VGA] = "vga",
512485 };
513486
514−static const int of_get_tve_mode(struct device_node *np)
487+static int of_get_tve_mode(struct device_node *np)
515488 {
516489 const char *bm;
517490 int ret, i;
@@ -544,7 +517,6 @@ static int imx_tve_bind(struct device *dev, struct device *master, void *data) · 26 unmodified lines
544517 memset(tve, 0, sizeof(*tve));
545518
546519 tve->dev = dev;
547− spin_lock_init(&tve->lock);
548520
549521 ddc_node = of_parse_phandle(np, "ddc-i2c-bus", 0);
550522 if (ddc_node) {
drivers/gpu/drm/imx/parallel-display.c+3−17
@@ -28,7 +28,6 @@ struct imx_parallel_display { · 27 unmodified lines
2828 struct drm_bridge bridge;
2929 struct device *dev;
3030 void *edid;
31− int edid_len;
3231 u32 bus_format;
3332 u32 bus_flags;
3433 struct drm_display_mode mode;
@@ -41,11 +40,6 @@ static inline struct imx_parallel_display *con_to_imxpd(struct drm_connector *c) · 6 unmodified lines
4140 return container_of(c, struct imx_parallel_display, connector);
4241 }
4342
44−static inline struct imx_parallel_display *enc_to_imxpd(struct drm_encoder *e)
45−{
46− return container_of(e, struct imx_parallel_display, encoder);
47−}
48−
4943 static inline struct imx_parallel_display *bridge_to_imxpd(struct drm_bridge *b)
5044 {
5145 return container_of(b, struct imx_parallel_display, bridge);
@@ -310,6 +304,7 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data) · 258 unmodified lines
310304 struct device_node *np = dev->of_node;
311305 const u8 *edidp;
312306 struct imx_parallel_display *imxpd;
307+ int edid_len;
313308 int ret;
314309 u32 bus_format = 0;
315310 const char *fmt;
@@ -323,9 +318,9 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data) · 7 unmodified lines
323318 if (ret && ret != -ENODEV)
324319 return ret;
325320
326− edidp = of_get_property(np, "edid", &imxpd->edid_len);
321+ edidp = of_get_property(np, "edid", &edid_len);
327322 if (edidp)
328− imxpd->edid = kmemdup(edidp, imxpd->edid_len, GFP_KERNEL);
323+ imxpd->edid = devm_kmemdup(dev, edidp, edid_len, GFP_KERNEL);
329324
330325 ret = of_property_read_string(np, "interface-pix-fmt", &fmt);
331326 if (!ret) {
@@ -349,17 +344,8 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data) · 17 unmodified lines
349344 return 0;
350345 }
351346
352−static void imx_pd_unbind(struct device *dev, struct device *master,
353− void *data)
354−{
355− struct imx_parallel_display *imxpd = dev_get_drvdata(dev);
356−
357− kfree(imxpd->edid);
358−}
359−
360347 static const struct component_ops imx_pd_ops = {
361348 .bind = imx_pd_bind,
362− .unbind = imx_pd_unbind,
363349 };
364350
365351 static int imx_pd_probe(struct platform_device *pdev)
drivers/gpu/drm/panfrost/panfrost_drv.c+3−2
@@ -628,6 +628,7 @@ static int panfrost_probe(struct platform_device *pdev) · 627 unmodified lines
628628 err_out1:
629629 pm_runtime_disable(pfdev->dev);
630630 panfrost_device_fini(pfdev);
631+ pm_runtime_set_suspended(pfdev->dev);
631632 err_out0:
632633 drm_dev_put(ddev);
633634 return err;
@@ -642,9 +643,9 @@ static int panfrost_remove(struct platform_device *pdev) · 8 unmodified lines
642643 panfrost_gem_shrinker_cleanup(ddev);
643644
644645 pm_runtime_get_sync(pfdev->dev);
645− panfrost_device_fini(pfdev);
646− pm_runtime_put_sync_suspend(pfdev->dev);
647646 pm_runtime_disable(pfdev->dev);
647+ panfrost_device_fini(pfdev);
648+ pm_runtime_set_suspended(pfdev->dev);
648649
649650 drm_dev_put(ddev);
650651 return 0;
drivers/gpu/drm/panfrost/panfrost_gem.c+1−3
@@ -105,14 +105,12 @@ void panfrost_gem_mapping_put(struct panfrost_gem_mapping *mapping) · 104 unmodified lines
105105 kref_put(&mapping->refcount, panfrost_gem_mapping_release);
106106 }
107107
108−void panfrost_gem_teardown_mappings(struct panfrost_gem_object *bo)
108+void panfrost_gem_teardown_mappings_locked(struct panfrost_gem_object *bo)
109109 {
110110 struct panfrost_gem_mapping *mapping;
111111
112− mutex_lock(&bo->mappings.lock);
113112 list_for_each_entry(mapping, &bo->mappings.list, node)
114113 panfrost_gem_teardown_mapping(mapping);
115− mutex_unlock(&bo->mappings.lock);
116114 }
117115
118116 int panfrost_gem_open(struct drm_gem_object *obj, struct drm_file *file_priv)
drivers/gpu/drm/panfrost/panfrost_gem.h+1−1
@@ -82,7 +82,7 @@ struct panfrost_gem_mapping * · 81 unmodified lines
8282 panfrost_gem_mapping_get(struct panfrost_gem_object *bo,
8383 struct panfrost_file_priv *priv);
8484 void panfrost_gem_mapping_put(struct panfrost_gem_mapping *mapping);
85−void panfrost_gem_teardown_mappings(struct panfrost_gem_object *bo);
85+void panfrost_gem_teardown_mappings_locked(struct panfrost_gem_object *bo);
8686
8787 void panfrost_gem_shrinker_init(struct drm_device *dev);
8888 void panfrost_gem_shrinker_cleanup(struct drm_device *dev);
drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c+11−3
@@ -40,18 +40,26 @@ static bool panfrost_gem_purge(struct drm_gem_object *obj) · 39 unmodified lines
4040 {
4141 struct drm_gem_shmem_object *shmem = to_drm_gem_shmem_obj(obj);
4242 struct panfrost_gem_object *bo = to_panfrost_bo(obj);
43+ bool ret = false;
4344
4445 if (atomic_read(&bo->gpu_usecount))
4546 return false;
4647
47− if (!mutex_trylock(&shmem->pages_lock))
48+ if (!mutex_trylock(&bo->mappings.lock))
4849 return false;
4950
50− panfrost_gem_teardown_mappings(bo);
51+ if (!mutex_trylock(&shmem->pages_lock))
52+ goto unlock_mappings;
53+
54+ panfrost_gem_teardown_mappings_locked(bo);
5155 drm_gem_shmem_purge_locked(obj);
56+ ret = true;
5257
5358 mutex_unlock(&shmem->pages_lock);
54− return true;
59+
60+unlock_mappings:
61+ mutex_unlock(&bo->mappings.lock);
62+ return ret;
5563 }
5664
5765 static unsigned long
drivers/gpu/drm/vc4/vc4_bo.c+5−4
@@ -468,7 +468,7 @@ struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t unaligned_size, · 467 unmodified lines
468468 }
469469
470470 if (IS_ERR(cma_obj)) {
471− struct drm_printer p = drm_info_printer(vc4->dev->dev);
471+ struct drm_printer p = drm_info_printer(vc4->base.dev);
472472 DRM_ERROR("Failed to allocate from CMA:\n");
473473 vc4_bo_stats_print(&p, vc4);
474474 return ERR_PTR(-ENOMEM);
@@ -609,7 +609,7 @@ static void vc4_bo_cache_time_work(struct work_struct *work) · 134 unmodified lines
609609 {
610610 struct vc4_dev *vc4 =
611611 container_of(work, struct vc4_dev, bo_cache.time_work);
612− struct drm_device *dev = vc4->dev;
612+ struct drm_device *dev = &vc4->base;
613613
614614 mutex_lock(&vc4->bo_lock);
615615 vc4_bo_cache_free_old(dev);
@@ -1024,6 +1024,7 @@ int vc4_get_tiling_ioctl(struct drm_device *dev, void *data, · 408 unmodified lines
10241024 return 0;
10251025 }
10261026
1027+static void vc4_bo_cache_destroy(struct drm_device *dev, void *unused);
10271028 int vc4_bo_cache_init(struct drm_device *dev)
10281029 {
10291030 struct vc4_dev *vc4 = to_vc4_dev(dev);
@@ -1052,10 +1053,10 @@ int vc4_bo_cache_init(struct drm_device *dev) · 22 unmodified lines
10521053 INIT_WORK(&vc4->bo_cache.time_work, vc4_bo_cache_time_work);
10531054 timer_setup(&vc4->bo_cache.time_timer, vc4_bo_cache_time_timer, 0);
10541055
1055− return 0;
1056+ return drmm_add_action_or_reset(dev, vc4_bo_cache_destroy, NULL);
10561057 }
10571058
1058−void vc4_bo_cache_destroy(struct drm_device *dev)
1059+static void vc4_bo_cache_destroy(struct drm_device *dev, void *unused)
10591060 {
10601061 struct vc4_dev *vc4 = to_vc4_dev(dev);
10611062 int i;
drivers/gpu/drm/vc4/vc4_drv.c+14−27
@@ -245,37 +245,37 @@ static int vc4_drm_bind(struct device *dev) · 244 unmodified lines
245245
246246 dev->coherent_dma_mask = DMA_BIT_MASK(32);
247247
248− vc4 = devm_kzalloc(dev, sizeof(*vc4), GFP_KERNEL);
249− if (!vc4)
250− return -ENOMEM;
251−
252248 /* If VC4 V3D is missing, don't advertise render nodes. */
253249 node = of_find_matching_node_and_match(NULL, vc4_v3d_dt_match, NULL);
254250 if (!node || !of_device_is_available(node))
255251 vc4_drm_driver.driver_features &= ~DRIVER_RENDER;
256252 of_node_put(node);
257253
258− drm = drm_dev_alloc(&vc4_drm_driver, dev);
259− if (IS_ERR(drm))
260− return PTR_ERR(drm);
254+ vc4 = devm_drm_dev_alloc(dev, &vc4_drm_driver, struct vc4_dev, base);
255+ if (IS_ERR(vc4))
256+ return PTR_ERR(vc4);
257+
258+ drm = &vc4->base;
261259 platform_set_drvdata(pdev, drm);
262− vc4->dev = drm;
263− drm->dev_private = vc4;
264260 INIT_LIST_HEAD(&vc4->debugfs_list);
265261
266262 mutex_init(&vc4->bin_bo_lock);
267263
268264 ret = vc4_bo_cache_init(drm);
269265 if (ret)
270− goto dev_put;
266+ return ret;
271267
272− drm_mode_config_init(drm);
268+ ret = drmm_mode_config_init(drm);
269+ if (ret)
270+ return ret;
273271
274− vc4_gem_init(drm);
272+ ret = vc4_gem_init(drm);
273+ if (ret)
274+ return ret;
275275
276276 ret = component_bind_all(dev, drm);
277277 if (ret)
278− goto gem_destroy;
278+ return ret;
279279
280280 ret = vc4_plane_create_additional_planes(drm);
281281 if (ret)
@@ -300,30 +300,17 @@ static int vc4_drm_bind(struct device *dev) · 18 unmodified lines
300300
301301 unbind_all:
302302 component_unbind_all(dev, drm);
303−gem_destroy:
304− vc4_gem_destroy(drm);
305− drm_mode_config_cleanup(drm);
306− vc4_bo_cache_destroy(drm);
307−dev_put:
308− drm_dev_put(drm);
303+
309304 return ret;
310305 }
311306
312307 static void vc4_drm_unbind(struct device *dev)
313308 {
314309 struct drm_device *drm = dev_get_drvdata(dev);
315− struct vc4_dev *vc4 = to_vc4_dev(drm);
316310
317311 drm_dev_unregister(drm);
318312
319313 drm_atomic_helper_shutdown(drm);
320−
321− drm_mode_config_cleanup(drm);
322−
323− drm_atomic_private_obj_fini(&vc4->load_tracker);
324− drm_atomic_private_obj_fini(&vc4->ctm_manager);
325−
326− drm_dev_put(drm);
327314 }
328315
329316 static const struct component_master_ops vc4_drm_ops = {
drivers/gpu/drm/vc4/vc4_drv.h+4−5
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414 #include <drm/drm_device.h>
1515 #include <drm/drm_encoder.h>
1616 #include <drm/drm_gem_cma_helper.h>
17+#include <drm/drm_managed.h>
1718 #include <drm/drm_mm.h>
1819 #include <drm/drm_modeset_lock.h>
1920
@@ -71,7 +72,7 @@ struct vc4_perfmon { · 51 unmodified lines
7172 };
7273
7374 struct vc4_dev {
74− struct drm_device *dev;
75+ struct drm_device base;
7576
7677 struct vc4_hvs *hvs;
7778 struct vc4_v3d *v3d;
@@ -234,7 +235,7 @@ struct vc4_dev { · 156 unmodified lines
234235 static inline struct vc4_dev *
235236 to_vc4_dev(struct drm_device *dev)
236237 {
237− return (struct vc4_dev *)dev->dev_private;
238+ return container_of(dev, struct vc4_dev, base);
238239 }
239240
240241 struct vc4_bo {
@@ -808,7 +809,6 @@ struct drm_gem_object *vc4_prime_import_sg_table(struct drm_device *dev, · 567 unmodified lines
808809 struct sg_table *sgt);
809810 void *vc4_prime_vmap(struct drm_gem_object *obj);
810811 int vc4_bo_cache_init(struct drm_device *dev);
811−void vc4_bo_cache_destroy(struct drm_device *dev);
812812 int vc4_bo_inc_usecnt(struct vc4_bo *bo);
813813 void vc4_bo_dec_usecnt(struct vc4_bo *bo);
814814 void vc4_bo_add_to_purgeable_pool(struct vc4_bo *bo);
@@ -873,8 +873,7 @@ extern struct platform_driver vc4_dsi_driver; · 58 unmodified lines
873873 extern const struct dma_fence_ops vc4_fence_ops;
874874
875875 /* vc4_gem.c */
876−void vc4_gem_init(struct drm_device *dev);
877−void vc4_gem_destroy(struct drm_device *dev);
876+int vc4_gem_init(struct drm_device *dev);
878877 int vc4_submit_cl_ioctl(struct drm_device *dev, void *data,
879878 struct drm_file *file_priv);
880879 int vc4_wait_seqno_ioctl(struct drm_device *dev, void *data,
drivers/gpu/drm/vc4/vc4_gem.c+10−9
@@ -314,16 +314,16 @@ vc4_reset_work(struct work_struct *work) · 313 unmodified lines
314314 struct vc4_dev *vc4 =
315315 container_of(work, struct vc4_dev, hangcheck.reset_work);
316316
317− vc4_save_hang_state(vc4->dev);
317+ vc4_save_hang_state(&vc4->base);
318318
319− vc4_reset(vc4->dev);
319+ vc4_reset(&vc4->base);
320320 }
321321
322322 static void
323323 vc4_hangcheck_elapsed(struct timer_list *t)
324324 {
325325 struct vc4_dev *vc4 = from_timer(vc4, t, hangcheck.timer);
326− struct drm_device *dev = vc4->dev;
326+ struct drm_device *dev = &vc4->base;
327327 uint32_t ct0ca, ct1ca;
328328 unsigned long irqflags;
329329 struct vc4_exec_info *bin_exec, *render_exec;
@@ -1000,7 +1000,7 @@ vc4_job_handle_completed(struct vc4_dev *vc4) · 670 unmodified lines
10001000 list_del(&exec->head);
10011001
10021002 spin_unlock_irqrestore(&vc4->job_lock, irqflags);
1003− vc4_complete_exec(vc4->dev, exec);
1003+ vc4_complete_exec(&vc4->base, exec);
10041004 spin_lock_irqsave(&vc4->job_lock, irqflags);
10051005 }
10061006
@@ -1258,13 +1258,13 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data, · 251 unmodified lines
12581258 return 0;
12591259
12601260 fail:
1261− vc4_complete_exec(vc4->dev, exec);
1261+ vc4_complete_exec(&vc4->base, exec);
12621262
12631263 return ret;
12641264 }
12651265
1266−void
1267−vc4_gem_init(struct drm_device *dev)
1266+static void vc4_gem_destroy(struct drm_device *dev, void *unused);
1267+int vc4_gem_init(struct drm_device *dev)
12681268 {
12691269 struct vc4_dev *vc4 = to_vc4_dev(dev);
12701270
@@ -1285,10 +1285,11 @@ vc4_gem_init(struct drm_device *dev) · 14 unmodified lines
12851285
12861286 INIT_LIST_HEAD(&vc4->purgeable.list);
12871287 mutex_init(&vc4->purgeable.lock);
1288+
1289+ return drmm_add_action_or_reset(dev, vc4_gem_destroy, NULL);
12881290 }
12891291
1290−void
1291−vc4_gem_destroy(struct drm_device *dev)
1292+static void vc4_gem_destroy(struct drm_device *dev, void *unused)
12921293 {
12931294 struct vc4_dev *vc4 = to_vc4_dev(dev);
12941295
drivers/gpu/drm/vc4/vc4_hvs.c+2−2
@@ -562,7 +562,7 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data) · 561 unmodified lines
562562 {
563563 struct platform_device *pdev = to_platform_device(dev);
564564 struct drm_device *drm = dev_get_drvdata(master);
565− struct vc4_dev *vc4 = drm->dev_private;
565+ struct vc4_dev *vc4 = to_vc4_dev(drm);
566566 struct vc4_hvs *hvs = NULL;
567567 int ret;
568568 u32 dispctrl;
@@ -681,7 +681,7 @@ static void vc4_hvs_unbind(struct device *dev, struct device *master, · 112 unmodified lines
681681 void *data)
682682 {
683683 struct drm_device *drm = dev_get_drvdata(master);
684− struct vc4_dev *vc4 = drm->dev_private;
684+ struct vc4_dev *vc4 = to_vc4_dev(drm);
685685 struct vc4_hvs *hvs = vc4->hvs;
686686
687687 if (drm_mm_node_allocated(&vc4->hvs->mitchell_netravali_filter))
drivers/gpu/drm/vc4/vc4_kms.c+58−22
@@ -51,7 +51,7 @@ static struct vc4_ctm_state *vc4_get_ctm_state(struct drm_atomic_state *state, · 50 unmodified lines
5151 struct drm_private_obj *manager)
5252 {
5353 struct drm_device *dev = state->dev;
54− struct vc4_dev *vc4 = dev->dev_private;
54+ struct vc4_dev *vc4 = to_vc4_dev(dev);
5555 struct drm_private_state *priv_state;
5656 int ret;
5757
@@ -93,6 +93,29 @@ static const struct drm_private_state_funcs vc4_ctm_state_funcs = { · 35 unmodified lines
9393 .atomic_destroy_state = vc4_ctm_destroy_state,
9494 };
9595
96+static void vc4_ctm_obj_fini(struct drm_device *dev, void *unused)
97+{
98+ struct vc4_dev *vc4 = to_vc4_dev(dev);
99+
100+ drm_atomic_private_obj_fini(&vc4->ctm_manager);
101+}
102+
103+static int vc4_ctm_obj_init(struct vc4_dev *vc4)
104+{
105+ struct vc4_ctm_state *ctm_state;
106+
107+ drm_modeset_lock_init(&vc4->ctm_state_lock);
108+
109+ ctm_state = kzalloc(sizeof(*ctm_state), GFP_KERNEL);
110+ if (!ctm_state)
111+ return -ENOMEM;
112+
113+ drm_atomic_private_obj_init(&vc4->base, &vc4->ctm_manager, &ctm_state->base,
114+ &vc4_ctm_state_funcs);
115+
116+ return drmm_add_action(&vc4->base, vc4_ctm_obj_fini, NULL);
117+}
118+
96119 /* Converts a DRM S31.32 value to the HW S0.9 format. */
97120 static u16 vc4_ctm_s31_32_to_s0_9(u64 in)
98121 {
@@ -609,6 +632,34 @@ static const struct drm_private_state_funcs vc4_load_tracker_state_funcs = { · 510 unmodified lines
609632 .atomic_destroy_state = vc4_load_tracker_destroy_state,
610633 };
611634
635+static void vc4_load_tracker_obj_fini(struct drm_device *dev, void *unused)
636+{
637+ struct vc4_dev *vc4 = to_vc4_dev(dev);
638+
639+ if (!vc4->load_tracker_available)
640+ return;
641+
642+ drm_atomic_private_obj_fini(&vc4->load_tracker);
643+}
644+
645+static int vc4_load_tracker_obj_init(struct vc4_dev *vc4)
646+{
647+ struct vc4_load_tracker_state *load_state;
648+
649+ if (!vc4->load_tracker_available)
650+ return 0;
651+
652+ load_state = kzalloc(sizeof(*load_state), GFP_KERNEL);
653+ if (!load_state)
654+ return -ENOMEM;
655+
656+ drm_atomic_private_obj_init(&vc4->base, &vc4->load_tracker,
657+ &load_state->base,
658+ &vc4_load_tracker_state_funcs);
659+
660+ return drmm_add_action(&vc4->base, vc4_load_tracker_obj_fini, NULL);
661+}
662+
612663 #define NUM_OUTPUTS 6
613664 #define NUM_CHANNELS 3
614665
@@ -711,8 +762,6 @@ static const struct drm_mode_config_funcs vc4_mode_funcs = { · 96 unmodified lines
711762 int vc4_kms_load(struct drm_device *dev)
712763 {
713764 struct vc4_dev *vc4 = to_vc4_dev(dev);
714− struct vc4_ctm_state *ctm_state;
715− struct vc4_load_tracker_state *load_state;
716765 bool is_vc5 = of_device_is_compatible(dev->dev->of_node,
717766 "brcm,bcm2711-vc5");
718767 int ret;
@@ -751,26 +800,13 @@ int vc4_kms_load(struct drm_device *dev) · 32 unmodified lines
751800 dev->mode_config.async_page_flip = true;
752801 dev->mode_config.allow_fb_modifiers = true;
753802
754− drm_modeset_lock_init(&vc4->ctm_state_lock);
755−
756− ctm_state = kzalloc(sizeof(*ctm_state), GFP_KERNEL);
757− if (!ctm_state)
758− return -ENOMEM;
759−
760− drm_atomic_private_obj_init(dev, &vc4->ctm_manager, &ctm_state->base,
761− &vc4_ctm_state_funcs);
762−
763− if (vc4->load_tracker_available) {
764− load_state = kzalloc(sizeof(*load_state), GFP_KERNEL);
765− if (!load_state) {
766− drm_atomic_private_obj_fini(&vc4->ctm_manager);
767− return -ENOMEM;
768− }
803+ ret = vc4_ctm_obj_init(vc4);
804+ if (ret)
805+ return ret;
769806
770− drm_atomic_private_obj_init(dev, &vc4->load_tracker,
771− &load_state->base,
772− &vc4_load_tracker_state_funcs);
773− }
807+ ret = vc4_load_tracker_obj_init(vc4);
808+ if (ret)
809+ return ret;
774810
775811 drm_mode_config_reset(dev);
776812
drivers/gpu/drm/vc4/vc4_v3d.c+6−6
@@ -168,7 +168,7 @@ static void vc4_v3d_init_hw(struct drm_device *dev) · 167 unmodified lines
168168
169169 int vc4_v3d_get_bin_slot(struct vc4_dev *vc4)
170170 {
171− struct drm_device *dev = vc4->dev;
171+ struct drm_device *dev = &vc4->base;
172172 unsigned long irqflags;
173173 int slot;
174174 uint64_t seqno = 0;
@@ -246,7 +246,7 @@ static int bin_bo_alloc(struct vc4_dev *vc4) · 71 unmodified lines
246246 INIT_LIST_HEAD(&list);
247247
248248 while (true) {
249− struct vc4_bo *bo = vc4_bo_create(vc4->dev, size, true,
249+ struct vc4_bo *bo = vc4_bo_create(&vc4->base, size, true,
250250 VC4_BO_TYPE_BIN);
251251
252252 if (IS_ERR(bo)) {
@@ -361,7 +361,7 @@ static int vc4_v3d_runtime_suspend(struct device *dev) · 108 unmodified lines
361361 struct vc4_v3d *v3d = dev_get_drvdata(dev);
362362 struct vc4_dev *vc4 = v3d->vc4;
363363
364− vc4_irq_uninstall(vc4->dev);
364+ vc4_irq_uninstall(&vc4->base);
365365
366366 clk_disable_unprepare(v3d->clk);
367367
@@ -378,11 +378,11 @@ static int vc4_v3d_runtime_resume(struct device *dev) · 10 unmodified lines
378378 if (ret != 0)
379379 return ret;
380380
381− vc4_v3d_init_hw(vc4->dev);
381+ vc4_v3d_init_hw(&vc4->base);
382382
383383 /* We disabled the IRQ as part of vc4_irq_uninstall in suspend. */
384− enable_irq(vc4->dev->irq);
385− vc4_irq_postinstall(vc4->dev);
384+ enable_irq(vc4->base.irq);
385+ vc4_irq_postinstall(&vc4->base);
386386
387387 return 0;
388388 }
drivers/gpu/ipu-v3/ipu-common.c+0−67
@@ -133,73 +133,6 @@ enum ipu_color_space ipu_pixelformat_to_colorspace(u32 pixelformat) · 132 unmodified lines
133133 }
134134 EXPORT_SYMBOL_GPL(ipu_pixelformat_to_colorspace);
135135
136−bool ipu_pixelformat_is_planar(u32 pixelformat)
137−{
138− switch (pixelformat) {
139− case V4L2_PIX_FMT_YUV420:
140− case V4L2_PIX_FMT_YVU420:
141− case V4L2_PIX_FMT_YUV422P:
142− case V4L2_PIX_FMT_NV12:
143− case V4L2_PIX_FMT_NV21:
144− case V4L2_PIX_FMT_NV16:
145− case V4L2_PIX_FMT_NV61:
146− return true;
147− }
148−
149− return false;
150−}
151−EXPORT_SYMBOL_GPL(ipu_pixelformat_is_planar);
152−
153−enum ipu_color_space ipu_mbus_code_to_colorspace(u32 mbus_code)
154−{
155− switch (mbus_code & 0xf000) {
156− case 0x1000:
157− return IPUV3_COLORSPACE_RGB;
158− case 0x2000:
159− return IPUV3_COLORSPACE_YUV;
160− default:
161− return IPUV3_COLORSPACE_UNKNOWN;
162− }
163−}
164−EXPORT_SYMBOL_GPL(ipu_mbus_code_to_colorspace);
165−
166−int ipu_stride_to_bytes(u32 pixel_stride, u32 pixelformat)
167−{
168− switch (pixelformat) {
169− case V4L2_PIX_FMT_YUV420:
170− case V4L2_PIX_FMT_YVU420:
171− case V4L2_PIX_FMT_YUV422P:
172− case V4L2_PIX_FMT_NV12:
173− case V4L2_PIX_FMT_NV21:
174− case V4L2_PIX_FMT_NV16:
175− case V4L2_PIX_FMT_NV61:
176− /*
177− * for the planar YUV formats, the stride passed to
178− * cpmem must be the stride in bytes of the Y plane.
179− * And all the planar YUV formats have an 8-bit
180− * Y component.
181− */
182− return (8 * pixel_stride) >> 3;
183− case V4L2_PIX_FMT_RGB565:
184− case V4L2_PIX_FMT_YUYV:
185− case V4L2_PIX_FMT_UYVY:
186− return (16 * pixel_stride) >> 3;
187− case V4L2_PIX_FMT_BGR24:
188− case V4L2_PIX_FMT_RGB24:
189− return (24 * pixel_stride) >> 3;
190− case V4L2_PIX_FMT_BGR32:
191− case V4L2_PIX_FMT_RGB32:
192− case V4L2_PIX_FMT_XBGR32:
193− case V4L2_PIX_FMT_XRGB32:
194− return (32 * pixel_stride) >> 3;
195− default:
196− break;
197− }
198−
199− return -EINVAL;
200−}
201−EXPORT_SYMBOL_GPL(ipu_stride_to_bytes);
202−
203136 int ipu_degrees_to_rot_mode(enum ipu_rotate_mode *mode, int degrees,
204137 bool hflip, bool vflip)
205138 {
drivers/hv/hv_balloon.c+1−1
@@ -1275,7 +1275,7 @@ static void balloon_up(struct work_struct *dummy) · 1274 unmodified lines
12751275
12761276 /* Refuse to balloon below the floor. */
12771277 if (avail_pages < num_pages || avail_pages - num_pages < floor) {
1278− pr_warn("Balloon request will be partially fulfilled. %s\n",
1278+ pr_info("Balloon request will be partially fulfilled. %s\n",
12791279 avail_pages < num_pages ? "Not enough memory." :
12801280 "Balloon floor reached.");
12811281
drivers/i2c/busses/Kconfig+1−1
@@ -733,7 +733,7 @@ config I2C_LPC2K · 732 unmodified lines
733733
734734 config I2C_MLXBF
735735 tristate "Mellanox BlueField I2C controller"
736− depends on ARM64
736+ depends on MELLANOX_PLATFORM && ARM64
737737 help
738738 Enabling this option will add I2C SMBus support for Mellanox BlueField
739739 system.
drivers/i2c/busses/i2c-designware-slave.c+19−33
@@ -159,7 +159,6 @@ static int i2c_dw_irq_handler_slave(struct dw_i2c_dev *dev) · 158 unmodified lines
159159 u32 raw_stat, stat, enabled, tmp;
160160 u8 val = 0, slave_activity;
161161
162− regmap_read(dev->map, DW_IC_INTR_STAT, &stat);
163162 regmap_read(dev->map, DW_IC_ENABLE, &enabled);
164163 regmap_read(dev->map, DW_IC_RAW_INTR_STAT, &raw_stat);
165164 regmap_read(dev->map, DW_IC_STATUS, &tmp);
@@ -168,32 +167,30 @@ static int i2c_dw_irq_handler_slave(struct dw_i2c_dev *dev) · 2 unmodified lines
168167 if (!enabled || !(raw_stat & ~DW_IC_INTR_ACTIVITY) || !dev->slave)
169168 return 0;
170169
170+ stat = i2c_dw_read_clear_intrbits_slave(dev);
171171 dev_dbg(dev->dev,
172172 "%#x STATUS SLAVE_ACTIVITY=%#x : RAW_INTR_STAT=%#x : INTR_STAT=%#x\n",
173173 enabled, slave_activity, raw_stat, stat);
174174
175− if ((stat & DW_IC_INTR_RX_FULL) && (stat & DW_IC_INTR_STOP_DET))
176− i2c_slave_event(dev->slave, I2C_SLAVE_WRITE_REQUESTED, &val);
175+ if (stat & DW_IC_INTR_RX_FULL) {
176+ if (dev->status != STATUS_WRITE_IN_PROGRESS) {
177+ dev->status = STATUS_WRITE_IN_PROGRESS;
178+ i2c_slave_event(dev->slave, I2C_SLAVE_WRITE_REQUESTED,
179+ &val);
180+ }
181+
182+ regmap_read(dev->map, DW_IC_DATA_CMD, &tmp);
183+ val = tmp;
184+ if (!i2c_slave_event(dev->slave, I2C_SLAVE_WRITE_RECEIVED,
185+ &val))
186+ dev_vdbg(dev->dev, "Byte %X acked!", val);
187+ }
177188
178189 if (stat & DW_IC_INTR_RD_REQ) {
179190 if (slave_activity) {
180− if (stat & DW_IC_INTR_RX_FULL) {
181− regmap_read(dev->map, DW_IC_DATA_CMD, &tmp);
182− val = tmp;
183−
184− if (!i2c_slave_event(dev->slave,
185− I2C_SLAVE_WRITE_RECEIVED,
186− &val)) {
187− dev_vdbg(dev->dev, "Byte %X acked!",
188− val);
189− }
190− regmap_read(dev->map, DW_IC_CLR_RD_REQ, &tmp);
191− stat = i2c_dw_read_clear_intrbits_slave(dev);
192− } else {
193− regmap_read(dev->map, DW_IC_CLR_RD_REQ, &tmp);
194− regmap_read(dev->map, DW_IC_CLR_RX_UNDER, &tmp);
195− stat = i2c_dw_read_clear_intrbits_slave(dev);
196− }
191+ regmap_read(dev->map, DW_IC_CLR_RD_REQ, &tmp);
192+
193+ dev->status = STATUS_READ_IN_PROGRESS;
197194 if (!i2c_slave_event(dev->slave,
198195 I2C_SLAVE_READ_REQUESTED,
199196 &val))
@@ -205,21 +202,11 @@ static int i2c_dw_irq_handler_slave(struct dw_i2c_dev *dev) · 5 unmodified lines
205202 if (!i2c_slave_event(dev->slave, I2C_SLAVE_READ_PROCESSED,
206203 &val))
207204 regmap_read(dev->map, DW_IC_CLR_RX_DONE, &tmp);
208−
209− i2c_slave_event(dev->slave, I2C_SLAVE_STOP, &val);
210− stat = i2c_dw_read_clear_intrbits_slave(dev);
211− return 1;
212205 }
213206
214− if (stat & DW_IC_INTR_RX_FULL) {
215− regmap_read(dev->map, DW_IC_DATA_CMD, &tmp);
216− val = tmp;
217− if (!i2c_slave_event(dev->slave, I2C_SLAVE_WRITE_RECEIVED,
218− &val))
219− dev_vdbg(dev->dev, "Byte %X acked!", val);
220− } else {
207+ if (stat & DW_IC_INTR_STOP_DET) {
208+ dev->status = STATUS_IDLE;
221209 i2c_slave_event(dev->slave, I2C_SLAVE_STOP, &val);
222− stat = i2c_dw_read_clear_intrbits_slave(dev);
223210 }
224211
225212 return 1;
@@ -230,7 +217,6 @@ static irqreturn_t i2c_dw_isr_slave(int this_irq, void *dev_id) · 4 unmodified lines
230217 struct dw_i2c_dev *dev = dev_id;
231218 int ret;
232219
233− i2c_dw_read_clear_intrbits_slave(dev);
234220 ret = i2c_dw_irq_handler_slave(dev);
235221 if (ret > 0)
236222 complete(&dev->cmd_complete);
drivers/i2c/busses/i2c-mlxbf.c+86−118
@@ -62,10 +62,8 @@ · 61 unmodified lines
6262 * Master. Default value is set to 400MHz.
6363 */
6464 #define MLXBF_I2C_TYU_PLL_OUT_FREQ (400 * 1000 * 1000)
65−/* Reference clock for Bluefield 1 - 156 MHz. */
66−#define MLXBF_I2C_TYU_PLL_IN_FREQ (156 * 1000 * 1000)
67−/* Reference clock for BlueField 2 - 200 MHz. */
68−#define MLXBF_I2C_YU_PLL_IN_FREQ (200 * 1000 * 1000)
65+/* Reference clock for Bluefield - 156 MHz. */
66+#define MLXBF_I2C_PLL_IN_FREQ (156 * 1000 * 1000)
6967
7068 /* Constant used to determine the PLL frequency. */
7169 #define MLNXBF_I2C_COREPLL_CONST 16384
@@ -489,44 +487,6 @@ static struct mutex mlxbf_i2c_bus_lock; · 417 unmodified lines
489487
490488 #define MLXBF_I2C_FREQUENCY_1GHZ 1000000000
491489
492−static void mlxbf_i2c_write(void __iomem *io, int reg, u32 val)
493−{
494− writel(val, io + reg);
495−}
496−
497−static u32 mlxbf_i2c_read(void __iomem *io, int reg)
498−{
499− return readl(io + reg);
500−}
501−
502−/*
503− * This function is used to read data from Master GW Data Descriptor.
504− * Data bytes in the Master GW Data Descriptor are shifted left so the
505− * data starts at the MSB of the descriptor registers as set by the
506− * underlying hardware. TYU_READ_DATA enables byte swapping while
507− * reading data bytes, and MUST be called by the SMBus read routines
508− * to copy data from the 32 * 32-bit HW Data registers a.k.a Master GW
509− * Data Descriptor.
510− */
511−static u32 mlxbf_i2c_read_data(void __iomem *io, int reg)
512−{
513− return (u32)be32_to_cpu(mlxbf_i2c_read(io, reg));
514−}
515−
516−/*
517− * This function is used to write data to the Master GW Data Descriptor.
518− * Data copied to the Master GW Data Descriptor MUST be shifted left so
519− * the data starts at the MSB of the descriptor registers as required by
520− * the underlying hardware. TYU_WRITE_DATA enables byte swapping when
521− * writing data bytes, and MUST be called by the SMBus write routines to
522− * copy data to the 32 * 32-bit HW Data registers a.k.a Master GW Data
523− * Descriptor.
524− */
525−static void mlxbf_i2c_write_data(void __iomem *io, int reg, u32 val)
526−{
527− mlxbf_i2c_write(io, reg, (u32)cpu_to_be32(val));
528−}
529−
530490 /*
531491 * Function to poll a set of bits at a specific address; it checks whether
532492 * the bits are equal to zero when eq_zero is set to 'true', and not equal
@@ -541,7 +501,7 @@ static u32 mlxbf_smbus_poll(void __iomem *io, u32 addr, u32 mask, · 8 unmodified lines
541501 timeout = (timeout / MLXBF_I2C_POLL_FREQ_IN_USEC) + 1;
542502
543503 do {
544− bits = mlxbf_i2c_read(io, addr) & mask;
504+ bits = readl(io + addr) & mask;
545505 if (eq_zero ? bits == 0 : bits != 0)
546506 return eq_zero ? 1 : bits;
547507 udelay(MLXBF_I2C_POLL_FREQ_IN_USEC);
@@ -609,16 +569,16 @@ static int mlxbf_i2c_smbus_check_status(struct mlxbf_i2c_priv *priv) · 61 unmodified lines
609569 MLXBF_I2C_SMBUS_TIMEOUT);
610570
611571 /* Read cause status bits. */
612− cause_status_bits = mlxbf_i2c_read(priv->mst_cause->io,
613− MLXBF_I2C_CAUSE_ARBITER);
572+ cause_status_bits = readl(priv->mst_cause->io +
573+ MLXBF_I2C_CAUSE_ARBITER);
614574 cause_status_bits &= MLXBF_I2C_CAUSE_MASTER_ARBITER_BITS_MASK;
615575
616576 /*
617577 * Parse both Cause and Master GW bits, then return transaction status.
618578 */
619579
620− master_status_bits = mlxbf_i2c_read(priv->smbus->io,
621− MLXBF_I2C_SMBUS_MASTER_STATUS);
580+ master_status_bits = readl(priv->smbus->io +
581+ MLXBF_I2C_SMBUS_MASTER_STATUS);
622582 master_status_bits &= MLXBF_I2C_SMBUS_MASTER_STATUS_MASK;
623583
624584 if (mlxbf_i2c_smbus_transaction_success(master_status_bits,
@@ -649,10 +609,17 @@ static void mlxbf_i2c_smbus_write_data(struct mlxbf_i2c_priv *priv, · 24 unmodified lines
649609
650610 aligned_length = round_up(length, 4);
651611
652− /* Copy data bytes from 4-byte aligned source buffer. */
612+ /*
613+ * Copy data bytes from 4-byte aligned source buffer.
614+ * Data copied to the Master GW Data Descriptor MUST be shifted
615+ * left so the data starts at the MSB of the descriptor registers
616+ * as required by the underlying hardware. Enable byte swapping
617+ * when writing data bytes to the 32 * 32-bit HW Data registers
618+ * a.k.a Master GW Data Descriptor.
619+ */
653620 for (offset = 0; offset < aligned_length; offset += sizeof(u32)) {
654621 data32 = *((u32 *)(data + offset));
655− mlxbf_i2c_write_data(priv->smbus->io, addr + offset, data32);
622+ iowrite32be(data32, priv->smbus->io + addr + offset);
656623 }
657624 }
658625
@@ -664,15 +631,23 @@ static void mlxbf_i2c_smbus_read_data(struct mlxbf_i2c_priv *priv, · 5 unmodified lines
664631
665632 mask = sizeof(u32) - 1;
666633
634+ /*
635+ * Data bytes in the Master GW Data Descriptor are shifted left
636+ * so the data starts at the MSB of the descriptor registers as
637+ * set by the underlying hardware. Enable byte swapping while
638+ * reading data bytes from the 32 * 32-bit HW Data registers
639+ * a.k.a Master GW Data Descriptor.
640+ */
641+
667642 for (offset = 0; offset < (length & ~mask); offset += sizeof(u32)) {
668− data32 = mlxbf_i2c_read_data(priv->smbus->io, addr + offset);
643+ data32 = ioread32be(priv->smbus->io + addr + offset);
669644 *((u32 *)(data + offset)) = data32;
670645 }
671646
672647 if (!(length & mask))
673648 return;
674649
675− data32 = mlxbf_i2c_read_data(priv->smbus->io, addr + offset);
650+ data32 = ioread32be(priv->smbus->io + addr + offset);
676651
677652 for (byte = 0; byte < (length & mask); byte++) {
678653 data[offset + byte] = data32 & GENMASK(7, 0);
@@ -698,16 +673,16 @@ static int mlxbf_i2c_smbus_enable(struct mlxbf_i2c_priv *priv, u8 slave, · 19 unmodified lines
698673 command |= rol32(pec_en, MLXBF_I2C_MASTER_SEND_PEC_SHIFT);
699674
700675 /* Clear status bits. */
701− mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_MASTER_STATUS, 0x0);
676+ writel(0x0, priv->smbus->io + MLXBF_I2C_SMBUS_MASTER_STATUS);
702677 /* Set the cause data. */
703− mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_CAUSE_OR_CLEAR, ~0x0);
678+ writel(~0x0, priv->smbus->io + MLXBF_I2C_CAUSE_OR_CLEAR);
704679 /* Zero PEC byte. */
705− mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_MASTER_PEC, 0x0);
680+ writel(0x0, priv->smbus->io + MLXBF_I2C_SMBUS_MASTER_PEC);
706681 /* Zero byte count. */
707− mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_RS_BYTES, 0x0);
682+ writel(0x0, priv->smbus->io + MLXBF_I2C_SMBUS_RS_BYTES);
708683
709684 /* GW activation. */
710− mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_MASTER_GW, command);
685+ writel(command, priv->smbus->io + MLXBF_I2C_SMBUS_MASTER_GW);
711686
712687 /*
713688 * Poll master status and check status bits. An ACK is sent when
@@ -823,8 +798,8 @@ mlxbf_i2c_smbus_start_transaction(struct mlxbf_i2c_priv *priv, · 109 unmodified lines
823798 * needs to be 'manually' reset. This should be removed in
824799 * next tag integration.
825800 */
826− mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_MASTER_FSM,
827− MLXBF_I2C_SMBUS_MASTER_FSM_PS_STATE_MASK);
801+ writel(MLXBF_I2C_SMBUS_MASTER_FSM_PS_STATE_MASK,
802+ priv->smbus->io + MLXBF_I2C_SMBUS_MASTER_FSM);
828803 }
829804
830805 return ret;
@@ -1113,8 +1088,8 @@ static void mlxbf_i2c_set_timings(struct mlxbf_i2c_priv *priv, · 282 unmodified lines
11131088 timer |= mlxbf_i2c_set_timer(priv, timings->scl_low,
11141089 false, MLXBF_I2C_MASK_16,
11151090 MLXBF_I2C_SHIFT_16);
1116− mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_TIMER_SCL_LOW_SCL_HIGH,
1117− timer);
1091+ writel(timer, priv->smbus->io +
1092+ MLXBF_I2C_SMBUS_TIMER_SCL_LOW_SCL_HIGH);
11181093
11191094 timer = mlxbf_i2c_set_timer(priv, timings->sda_rise, false,
11201095 MLXBF_I2C_MASK_8, MLXBF_I2C_SHIFT_0);
@@ -1124,37 +1099,34 @@ static void mlxbf_i2c_set_timings(struct mlxbf_i2c_priv *priv, · 3 unmodified lines
11241099 MLXBF_I2C_MASK_8, MLXBF_I2C_SHIFT_16);
11251100 timer |= mlxbf_i2c_set_timer(priv, timings->scl_fall, false,
11261101 MLXBF_I2C_MASK_8, MLXBF_I2C_SHIFT_24);
1127− mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_TIMER_FALL_RISE_SPIKE,
1128− timer);
1102+ writel(timer, priv->smbus->io +
1103+ MLXBF_I2C_SMBUS_TIMER_FALL_RISE_SPIKE);
11291104
11301105 timer = mlxbf_i2c_set_timer(priv, timings->hold_start, true,
11311106 MLXBF_I2C_MASK_16, MLXBF_I2C_SHIFT_0);
11321107 timer |= mlxbf_i2c_set_timer(priv, timings->hold_data, true,
11331108 MLXBF_I2C_MASK_16, MLXBF_I2C_SHIFT_16);
1134− mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_TIMER_THOLD, timer);
1109+ writel(timer, priv->smbus->io + MLXBF_I2C_SMBUS_TIMER_THOLD);
11351110
11361111 timer = mlxbf_i2c_set_timer(priv, timings->setup_start, true,
11371112 MLXBF_I2C_MASK_16, MLXBF_I2C_SHIFT_0);
11381113 timer |= mlxbf_i2c_set_timer(priv, timings->setup_stop, true,
11391114 MLXBF_I2C_MASK_16, MLXBF_I2C_SHIFT_16);
1140− mlxbf_i2c_write(priv->smbus->io,
1141− MLXBF_I2C_SMBUS_TIMER_TSETUP_START_STOP, timer);
1115+ writel(timer, priv->smbus->io +
1116+ MLXBF_I2C_SMBUS_TIMER_TSETUP_START_STOP);
11421117
11431118 timer = mlxbf_i2c_set_timer(priv, timings->setup_data, true,
11441119 MLXBF_I2C_MASK_16, MLXBF_I2C_SHIFT_0);
1145− mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_TIMER_TSETUP_DATA,
1146− timer);
1120+ writel(timer, priv->smbus->io + MLXBF_I2C_SMBUS_TIMER_TSETUP_DATA);
11471121
11481122 timer = mlxbf_i2c_set_timer(priv, timings->buf, false,
11491123 MLXBF_I2C_MASK_16, MLXBF_I2C_SHIFT_0);
11501124 timer |= mlxbf_i2c_set_timer(priv, timings->thigh_max, false,
11511125 MLXBF_I2C_MASK_16, MLXBF_I2C_SHIFT_16);
1152− mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_THIGH_MAX_TBUF,
1153− timer);
1126+ writel(timer, priv->smbus->io + MLXBF_I2C_SMBUS_THIGH_MAX_TBUF);
11541127
11551128 timer = timings->timeout;
1156− mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_SCL_LOW_TIMEOUT,
1157− timer);
1129+ writel(timer, priv->smbus->io + MLXBF_I2C_SMBUS_SCL_LOW_TIMEOUT);
11581130 }
11591131
11601132 enum mlxbf_i2c_timings_config {
@@ -1426,19 +1398,15 @@ static int mlxbf_i2c_init_master(struct platform_device *pdev, · 265 unmodified lines
14261398 * platform firmware; disabling the bus might compromise the system
14271399 * functionality.
14281400 */
1429− config_reg = mlxbf_i2c_read(gpio_res->io,
1430− MLXBF_I2C_GPIO_0_FUNC_EN_0);
1401+ config_reg = readl(gpio_res->io + MLXBF_I2C_GPIO_0_FUNC_EN_0);
14311402 config_reg = MLXBF_I2C_GPIO_SMBUS_GW_ASSERT_PINS(priv->bus,
14321403 config_reg);
1433− mlxbf_i2c_write(gpio_res->io, MLXBF_I2C_GPIO_0_FUNC_EN_0,
1434− config_reg);
1404+ writel(config_reg, gpio_res->io + MLXBF_I2C_GPIO_0_FUNC_EN_0);
14351405
1436− config_reg = mlxbf_i2c_read(gpio_res->io,
1437− MLXBF_I2C_GPIO_0_FORCE_OE_EN);
1406+ config_reg = readl(gpio_res->io + MLXBF_I2C_GPIO_0_FORCE_OE_EN);
14381407 config_reg = MLXBF_I2C_GPIO_SMBUS_GW_RESET_PINS(priv->bus,
14391408 config_reg);
1440− mlxbf_i2c_write(gpio_res->io, MLXBF_I2C_GPIO_0_FORCE_OE_EN,
1441− config_reg);
1409+ writel(config_reg, gpio_res->io + MLXBF_I2C_GPIO_0_FORCE_OE_EN);
14421410
14431411 mutex_unlock(gpio_res->lock);
14441412
@@ -1452,10 +1420,9 @@ static u64 mlxbf_calculate_freq_from_tyu(struct mlxbf_i2c_resource *corepll_res) · 7 unmodified lines
14521420 u32 corepll_val;
14531421 u16 core_f;
14541422
1455− pad_frequency = MLXBF_I2C_TYU_PLL_IN_FREQ;
1423+ pad_frequency = MLXBF_I2C_PLL_IN_FREQ;
14561424
1457− corepll_val = mlxbf_i2c_read(corepll_res->io,
1458− MLXBF_I2C_CORE_PLL_REG1);
1425+ corepll_val = readl(corepll_res->io + MLXBF_I2C_CORE_PLL_REG1);
14591426
14601427 /* Get Core PLL configuration bits. */
14611428 core_f = rol32(corepll_val, MLXBF_I2C_COREPLL_CORE_F_TYU_SHIFT) &
@@ -1488,12 +1455,10 @@ static u64 mlxbf_calculate_freq_from_yu(struct mlxbf_i2c_resource *corepll_res) · 26 unmodified lines
14881455 u8 core_od, core_r;
14891456 u32 core_f;
14901457
1491− pad_frequency = MLXBF_I2C_YU_PLL_IN_FREQ;
1458+ pad_frequency = MLXBF_I2C_PLL_IN_FREQ;
14921459
1493− corepll_reg1_val = mlxbf_i2c_read(corepll_res->io,
1494− MLXBF_I2C_CORE_PLL_REG1);
1495− corepll_reg2_val = mlxbf_i2c_read(corepll_res->io,
1496− MLXBF_I2C_CORE_PLL_REG2);
1460+ corepll_reg1_val = readl(corepll_res->io + MLXBF_I2C_CORE_PLL_REG1);
1461+ corepll_reg2_val = readl(corepll_res->io + MLXBF_I2C_CORE_PLL_REG2);
14971462
14981463 /* Get Core PLL configuration bits */
14991464 core_f = rol32(corepll_reg1_val, MLXBF_I2C_COREPLL_CORE_F_YU_SHIFT) &
@@ -1585,7 +1550,7 @@ static int mlxbf_slave_enable(struct mlxbf_i2c_priv *priv, u8 addr) · 85 unmodified lines
15851550 * (7-bit address, 1 status bit (1 if enabled, 0 if not)).
15861551 */
15871552 for (reg = 0; reg < reg_cnt; reg++) {
1588− slave_reg = mlxbf_i2c_read(priv->smbus->io,
1553+ slave_reg = readl(priv->smbus->io +
15891554 MLXBF_I2C_SMBUS_SLAVE_ADDR_CFG + reg * 0x4);
15901555 /*
15911556 * Each register holds 4 slave addresses. So, we have to keep
@@ -1643,8 +1608,8 @@ static int mlxbf_slave_enable(struct mlxbf_i2c_priv *priv, u8 addr) · 51 unmodified lines
16431608
16441609 /* Enable the slave address and update the register. */
16451610 slave_reg |= (1 << MLXBF_I2C_SMBUS_SLAVE_ADDR_EN_BIT) << (byte * 8);
1646− mlxbf_i2c_write(priv->smbus->io,
1647− MLXBF_I2C_SMBUS_SLAVE_ADDR_CFG + reg * 0x4, slave_reg);
1611+ writel(slave_reg, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_ADDR_CFG +
1612+ reg * 0x4);
16481613
16491614 return 0;
16501615 }
@@ -1668,7 +1633,7 @@ static int mlxbf_slave_disable(struct mlxbf_i2c_priv *priv) · 17 unmodified lines
16681633 * (7-bit address, 1 status bit (1 if enabled, 0 if not)).
16691634 */
16701635 for (reg = 0; reg < reg_cnt; reg++) {
1671− slave_reg = mlxbf_i2c_read(priv->smbus->io,
1636+ slave_reg = readl(priv->smbus->io +
16721637 MLXBF_I2C_SMBUS_SLAVE_ADDR_CFG + reg * 0x4);
16731638
16741639 /* Check whether the address slots are empty. */
@@ -1708,8 +1673,8 @@ static int mlxbf_slave_disable(struct mlxbf_i2c_priv *priv) · 33 unmodified lines
17081673
17091674 /* Cleanup the slave address slot. */
17101675 slave_reg &= ~(GENMASK(7, 0) << (slave_byte * 8));
1711− mlxbf_i2c_write(priv->smbus->io,
1712− MLXBF_I2C_SMBUS_SLAVE_ADDR_CFG + reg * 0x4, slave_reg);
1676+ writel(slave_reg, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_ADDR_CFG +
1677+ reg * 0x4);
17131678
17141679 return 0;
17151680 }
@@ -1801,7 +1766,7 @@ static int mlxbf_i2c_init_slave(struct platform_device *pdev, · 85 unmodified lines
18011766 int ret;
18021767
18031768 /* Reset FSM. */
1804− mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_SLAVE_FSM, 0);
1769+ writel(0, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_FSM);
18051770
18061771 /*
18071772 * Enable slave cause interrupt bits. Drive
@@ -1810,15 +1775,13 @@ static int mlxbf_i2c_init_slave(struct platform_device *pdev, · 2 unmodified lines
18101775 * masters issue a Read and Write, respectively. But, clear all
18111776 * interrupts first.
18121777 */
1813− mlxbf_i2c_write(priv->slv_cause->io,
1814− MLXBF_I2C_CAUSE_OR_CLEAR, ~0);
1778+ writel(~0, priv->slv_cause->io + MLXBF_I2C_CAUSE_OR_CLEAR);
18151779 int_reg = MLXBF_I2C_CAUSE_READ_WAIT_FW_RESPONSE;
18161780 int_reg |= MLXBF_I2C_CAUSE_WRITE_SUCCESS;
1817− mlxbf_i2c_write(priv->slv_cause->io,
1818− MLXBF_I2C_CAUSE_OR_EVTEN0, int_reg);
1781+ writel(int_reg, priv->slv_cause->io + MLXBF_I2C_CAUSE_OR_EVTEN0);
18191782
18201783 /* Finally, set the 'ready' bit to start handling transactions. */
1821− mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_SLAVE_READY, 0x1);
1784+ writel(0x1, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_READY);
18221785
18231786 /* Initialize the cause coalesce resource. */
18241787 ret = mlxbf_i2c_init_coalesce(pdev, priv);
@@ -1844,23 +1807,21 @@ static bool mlxbf_i2c_has_coalesce(struct mlxbf_i2c_priv *priv, bool *read, · 19 unmodified lines
18441807 MLXBF_I2C_CAUSE_YU_SLAVE_BIT :
18451808 priv->bus + MLXBF_I2C_CAUSE_TYU_SLAVE_BIT;
18461809
1847− coalesce0_reg = mlxbf_i2c_read(priv->coalesce->io,
1848− MLXBF_I2C_CAUSE_COALESCE_0);
1810+ coalesce0_reg = readl(priv->coalesce->io + MLXBF_I2C_CAUSE_COALESCE_0);
18491811 is_set = coalesce0_reg & (1 << slave_shift);
18501812
18511813 if (!is_set)
18521814 return false;
18531815
18541816 /* Check the source of the interrupt, i.e. whether a Read or Write. */
1855− cause_reg = mlxbf_i2c_read(priv->slv_cause->io,
1856− MLXBF_I2C_CAUSE_ARBITER);
1817+ cause_reg = readl(priv->slv_cause->io + MLXBF_I2C_CAUSE_ARBITER);
18571818 if (cause_reg & MLXBF_I2C_CAUSE_READ_WAIT_FW_RESPONSE)
18581819 *read = true;
18591820 else if (cause_reg & MLXBF_I2C_CAUSE_WRITE_SUCCESS)
18601821 *write = true;
18611822
18621823 /* Clear cause bits. */
1863− mlxbf_i2c_write(priv->slv_cause->io, MLXBF_I2C_CAUSE_OR_CLEAR, ~0x0);
1824+ writel(~0x0, priv->slv_cause->io + MLXBF_I2C_CAUSE_OR_CLEAR);
18641825
18651826 return true;
18661827 }
@@ -1900,8 +1861,8 @@ static int mlxbf_smbus_irq_send(struct mlxbf_i2c_priv *priv, u8 recv_bytes) · 33 unmodified lines
19001861 * address, if supplied.
19011862 */
19021863 if (recv_bytes > 0) {
1903− data32 = mlxbf_i2c_read_data(priv->smbus->io,
1904− MLXBF_I2C_SLAVE_DATA_DESC_ADDR);
1864+ data32 = ioread32be(priv->smbus->io +
1865+ MLXBF_I2C_SLAVE_DATA_DESC_ADDR);
19051866
19061867 /* Parse the received bytes. */
19071868 switch (recv_bytes) {
@@ -1966,7 +1927,7 @@ static int mlxbf_smbus_irq_send(struct mlxbf_i2c_priv *priv, u8 recv_bytes) · 58 unmodified lines
19661927 control32 |= rol32(write_size, MLXBF_I2C_SLAVE_WRITE_BYTES_SHIFT);
19671928 control32 |= rol32(pec_en, MLXBF_I2C_SLAVE_SEND_PEC_SHIFT);
19681929
1969− mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_SLAVE_GW, control32);
1930+ writel(control32, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_GW);
19701931
19711932 /*
19721933 * Wait until the transfer is completed; the driver will wait
@@ -1975,10 +1936,9 @@ static int mlxbf_smbus_irq_send(struct mlxbf_i2c_priv *priv, u8 recv_bytes) · 2 unmodified lines
19751936 mlxbf_smbus_slave_wait_for_idle(priv, MLXBF_I2C_SMBUS_TIMEOUT);
19761937
19771938 /* Release the Slave GW. */
1978− mlxbf_i2c_write(priv->smbus->io,
1979− MLXBF_I2C_SMBUS_SLAVE_RS_MASTER_BYTES, 0x0);
1980− mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_SLAVE_PEC, 0x0);
1981− mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_SLAVE_READY, 0x1);
1939+ writel(0x0, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_RS_MASTER_BYTES);
1940+ writel(0x0, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_PEC);
1941+ writel(0x1, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_READY);
19821942
19831943 return 0;
19841944 }
@@ -2023,10 +1983,9 @@ static int mlxbf_smbus_irq_recv(struct mlxbf_i2c_priv *priv, u8 recv_bytes) · 38 unmodified lines
20231983 i2c_slave_event(slave, I2C_SLAVE_STOP, &value);
20241984
20251985 /* Release the Slave GW. */
2026− mlxbf_i2c_write(priv->smbus->io,
2027− MLXBF_I2C_SMBUS_SLAVE_RS_MASTER_BYTES, 0x0);
2028− mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_SLAVE_PEC, 0x0);
2029− mlxbf_i2c_write(priv->smbus->io, MLXBF_I2C_SMBUS_SLAVE_READY, 0x1);
1986+ writel(0x0, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_RS_MASTER_BYTES);
1987+ writel(0x0, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_PEC);
1988+ writel(0x1, priv->smbus->io + MLXBF_I2C_SMBUS_SLAVE_READY);
20301989
20311990 return ret;
20321991 }
@@ -2061,8 +2020,8 @@ static irqreturn_t mlxbf_smbus_irq(int irq, void *ptr) · 28 unmodified lines
20612020 * slave, if the higher 8 bits are sent then the slave expect N bytes
20622021 * from the master.
20632022 */
2064− rw_bytes_reg = mlxbf_i2c_read(priv->smbus->io,
2065− MLXBF_I2C_SMBUS_SLAVE_RS_MASTER_BYTES);
2023+ rw_bytes_reg = readl(priv->smbus->io +
2024+ MLXBF_I2C_SMBUS_SLAVE_RS_MASTER_BYTES);
20662025 recv_bytes = (rw_bytes_reg >> 8) & GENMASK(7, 0);
20672026
20682027 /*
@@ -2264,6 +2223,7 @@ static const struct of_device_id mlxbf_i2c_dt_ids[] = { · 195 unmodified lines
22642223
22652224 MODULE_DEVICE_TABLE(of, mlxbf_i2c_dt_ids);
22662225
2226+#ifdef CONFIG_ACPI
22672227 static const struct acpi_device_id mlxbf_i2c_acpi_ids[] = {
22682228 { "MLNXBF03", (kernel_ulong_t)&mlxbf_i2c_chip[MLXBF_I2C_CHIP_TYPE_1] },
22692229 { "MLNXBF23", (kernel_ulong_t)&mlxbf_i2c_chip[MLXBF_I2C_CHIP_TYPE_2] },
@@ -2305,6 +2265,12 @@ static int mlxbf_i2c_acpi_probe(struct device *dev, struct mlxbf_i2c_priv *priv) · 35 unmodified lines
23052265
23062266 return ret;
23072267 }
2268+#else
2269+static int mlxbf_i2c_acpi_probe(struct device *dev, struct mlxbf_i2c_priv *priv)
2270+{
2271+ return -ENOENT;
2272+}
2273+#endif /* CONFIG_ACPI */
23082274
23092275 static int mlxbf_i2c_of_probe(struct device *dev, struct mlxbf_i2c_priv *priv)
23102276 {
@@ -2473,7 +2439,9 @@ static struct platform_driver mlxbf_i2c_driver = { · 162 unmodified lines
24732439 .driver = {
24742440 .name = "i2c-mlxbf",
24752441 .of_match_table = mlxbf_i2c_dt_ids,
2442+#ifdef CONFIG_ACPI
24762443 .acpi_match_table = ACPI_PTR(mlxbf_i2c_acpi_ids),
2444+#endif /* CONFIG_ACPI */
24772445 },
24782446 };
24792447
@@ -2502,5 +2470,5 @@ static void __exit mlxbf_i2c_exit(void) · 22 unmodified lines
25022470 module_exit(mlxbf_i2c_exit);
25032471
25042472 MODULE_DESCRIPTION("Mellanox BlueField I2C bus driver");
2505−MODULE_AUTHOR("Khalil Blaiech <kblaiech@mellanox.com>");
2473+MODULE_AUTHOR("Khalil Blaiech <kblaiech@nvidia.com>");
25062474 MODULE_LICENSE("GPL v2");
drivers/i2c/busses/i2c-mt65xx.c+4−4
@@ -475,6 +475,10 @@ static void mtk_i2c_init_hw(struct mtk_i2c *i2c) · 474 unmodified lines
475475 {
476476 u16 control_reg;
477477
478+ writel(I2C_DMA_HARD_RST, i2c->pdmabase + OFFSET_RST);
479+ udelay(50);
480+ writel(I2C_DMA_CLR_FLAG, i2c->pdmabase + OFFSET_RST);
481+
478482 mtk_i2c_writew(i2c, I2C_SOFT_RST, OFFSET_SOFTRESET);
479483
480484 /* Set ioconfig */
@@ -529,10 +533,6 @@ static void mtk_i2c_init_hw(struct mtk_i2c *i2c) · 48 unmodified lines
529533
530534 mtk_i2c_writew(i2c, control_reg, OFFSET_CONTROL);
531535 mtk_i2c_writew(i2c, I2C_DELAY_LEN, OFFSET_DELAY_LEN);
532−
533− writel(I2C_DMA_HARD_RST, i2c->pdmabase + OFFSET_RST);
534− udelay(50);
535− writel(I2C_DMA_CLR_FLAG, i2c->pdmabase + OFFSET_RST);
536536 }
537537
538538 static const struct i2c_spec_values *mtk_i2c_get_spec(unsigned int speed)
drivers/i2c/busses/i2c-sh_mobile.c+66−20
@@ -129,6 +129,7 @@ struct sh_mobile_i2c_data { · 128 unmodified lines
129129 int sr;
130130 bool send_stop;
131131 bool stop_after_dma;
132+ bool atomic_xfer;
132133
133134 struct resource *res;
134135 struct dma_chan *dma_tx;
@@ -330,13 +331,15 @@ static unsigned char i2c_op(struct sh_mobile_i2c_data *pd, enum sh_mobile_i2c_op · 195 unmodified lines
330331 ret = iic_rd(pd, ICDR);
331332 break;
332333 case OP_RX_STOP: /* enable DTE interrupt, issue stop */
333− iic_wr(pd, ICIC,
334− ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE);
334+ if (!pd->atomic_xfer)
335+ iic_wr(pd, ICIC,
336+ ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE);
335337 iic_wr(pd, ICCR, ICCR_ICE | ICCR_RACK);
336338 break;
337339 case OP_RX_STOP_DATA: /* enable DTE interrupt, read data, issue stop */
338− iic_wr(pd, ICIC,
339− ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE);
340+ if (!pd->atomic_xfer)
341+ iic_wr(pd, ICIC,
342+ ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE);
340343 ret = iic_rd(pd, ICDR);
341344 iic_wr(pd, ICCR, ICCR_ICE | ICCR_RACK);
342345 break;
@@ -429,7 +432,8 @@ static irqreturn_t sh_mobile_i2c_isr(int irq, void *dev_id) · 86 unmodified lines
429432
430433 if (wakeup) {
431434 pd->sr |= SW_DONE;
432− wake_up(&pd->wait);
435+ if (!pd->atomic_xfer)
436+ wake_up(&pd->wait);
433437 }
434438
435439 /* defeat write posting to avoid spurious WAIT interrupts */
@@ -581,6 +585,9 @@ static void start_ch(struct sh_mobile_i2c_data *pd, struct i2c_msg *usr_msg, · 145 unmodified lines
581585 pd->pos = -1;
582586 pd->sr = 0;
583587
588+ if (pd->atomic_xfer)
589+ return;
590+
584591 pd->dma_buf = i2c_get_dma_safe_msg_buf(pd->msg, 8);
585592 if (pd->dma_buf)
586593 sh_mobile_i2c_xfer_dma(pd);
@@ -637,15 +644,13 @@ static int poll_busy(struct sh_mobile_i2c_data *pd) · 50 unmodified lines
637644 return i ? 0 : -ETIMEDOUT;
638645 }
639646
640−static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter,
641− struct i2c_msg *msgs,
642− int num)
647+static int sh_mobile_xfer(struct sh_mobile_i2c_data *pd,
648+ struct i2c_msg *msgs, int num)
643649 {
644− struct sh_mobile_i2c_data *pd = i2c_get_adapdata(adapter);
645650 struct i2c_msg *msg;
646651 int err = 0;
647652 int i;
648− long timeout;
653+ long time_left;
649654
650655 /* Wake up device and enable clock */
651656 pm_runtime_get_sync(pd->dev);
@@ -662,15 +667,35 @@ static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter, · 10 unmodified lines
662667 if (do_start)
663668 i2c_op(pd, OP_START);
664669
665− /* The interrupt handler takes care of the rest... */
666− timeout = wait_event_timeout(pd->wait,
667− pd->sr & (ICSR_TACK | SW_DONE),
668− adapter->timeout);
669−
670− /* 'stop_after_dma' tells if DMA transfer was complete */
671− i2c_put_dma_safe_msg_buf(pd->dma_buf, pd->msg, pd->stop_after_dma);
670+ if (pd->atomic_xfer) {
671+ unsigned long j = jiffies + pd->adap.timeout;
672+
673+ time_left = time_before_eq(jiffies, j);
674+ while (time_left &&
675+ !(pd->sr & (ICSR_TACK | SW_DONE))) {
676+ unsigned char sr = iic_rd(pd, ICSR);
677+
678+ if (sr & (ICSR_AL | ICSR_TACK |
679+ ICSR_WAIT | ICSR_DTE)) {
680+ sh_mobile_i2c_isr(0, pd);
681+ udelay(150);
682+ } else {
683+ cpu_relax();
684+ }
685+ time_left = time_before_eq(jiffies, j);
686+ }
687+ } else {
688+ /* The interrupt handler takes care of the rest... */
689+ time_left = wait_event_timeout(pd->wait,
690+ pd->sr & (ICSR_TACK | SW_DONE),
691+ pd->adap.timeout);
692+
693+ /* 'stop_after_dma' tells if DMA xfer was complete */
694+ i2c_put_dma_safe_msg_buf(pd->dma_buf, pd->msg,
695+ pd->stop_after_dma);
696+ }
672697
673− if (!timeout) {
698+ if (!time_left) {
674699 dev_err(pd->dev, "Transfer request timed out\n");
675700 if (pd->dma_direction != DMA_NONE)
676701 sh_mobile_i2c_cleanup_dma(pd);
@@ -696,14 +721,35 @@ static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter, · 19 unmodified lines
696721 return err ?: num;
697722 }
698723
724+static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter,
725+ struct i2c_msg *msgs,
726+ int num)
727+{
728+ struct sh_mobile_i2c_data *pd = i2c_get_adapdata(adapter);
729+
730+ pd->atomic_xfer = false;
731+ return sh_mobile_xfer(pd, msgs, num);
732+}
733+
734+static int sh_mobile_i2c_xfer_atomic(struct i2c_adapter *adapter,
735+ struct i2c_msg *msgs,
736+ int num)
737+{
738+ struct sh_mobile_i2c_data *pd = i2c_get_adapdata(adapter);
739+
740+ pd->atomic_xfer = true;
741+ return sh_mobile_xfer(pd, msgs, num);
742+}
743+
699744 static u32 sh_mobile_i2c_func(struct i2c_adapter *adapter)
700745 {
701746 return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | I2C_FUNC_PROTOCOL_MANGLING;
702747 }
703748
704749 static const struct i2c_algorithm sh_mobile_i2c_algorithm = {
705− .functionality = sh_mobile_i2c_func,
706− .master_xfer = sh_mobile_i2c_xfer,
750+ .functionality = sh_mobile_i2c_func,
751+ .master_xfer = sh_mobile_i2c_xfer,
752+ .master_xfer_atomic = sh_mobile_i2c_xfer_atomic,
707753 };
708754
709755 static const struct i2c_adapter_quirks sh_mobile_i2c_quirks = {
drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.h+1−1
@@ -176,7 +176,7 @@ struct pvrdma_port_attr { · 175 unmodified lines
176176 u8 subnet_timeout;
177177 u8 init_type_reply;
178178 u8 active_width;
179− u16 active_speed;
179+ u8 active_speed;
180180 u8 phys_state;
181181 u8 reserved[2];
182182 };
drivers/infiniband/sw/rdmavt/vt.c+5−2
@@ -524,6 +524,7 @@ static noinline int check_support(struct rvt_dev_info *rdi, int verb) · 523 unmodified lines
524524 int rvt_register_device(struct rvt_dev_info *rdi)
525525 {
526526 int ret = 0, i;
527+ u64 dma_mask;
527528
528529 if (!rdi)
529530 return -EINVAL;
@@ -580,8 +581,10 @@ int rvt_register_device(struct rvt_dev_info *rdi) · 50 unmodified lines
580581
581582 /* DMA Operations */
582583 rdi->ibdev.dev.dma_parms = rdi->ibdev.dev.parent->dma_parms;
583− dma_set_coherent_mask(&rdi->ibdev.dev,
584− rdi->ibdev.dev.parent->coherent_dma_mask);
584+ dma_mask = IS_ENABLED(CONFIG_64BIT) ? DMA_BIT_MASK(64) : DMA_BIT_MASK(32);
585+ ret = dma_coerce_mask_and_coherent(&rdi->ibdev.dev, dma_mask);
586+ if (ret)
587+ goto bail_wss;
585588
586589 /* Protection Domain */
587590 spin_lock_init(&rdi->n_pds_lock);
drivers/infiniband/sw/rxe/rxe_verbs.c+5−1
@@ -1118,6 +1118,7 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name) · 1117 unmodified lines
11181118 int err;
11191119 struct ib_device *dev = &rxe->ib_dev;
11201120 struct crypto_shash *tfm;
1121+ u64 dma_mask;
11211122
11221123 strlcpy(dev->node_desc, "rxe", sizeof(dev->node_desc));
11231124
@@ -1130,7 +1131,10 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name) · 6 unmodified lines
11301131 rxe->ndev->dev_addr);
11311132 dev->dev.dma_parms = &rxe->dma_parms;
11321133 dma_set_max_seg_size(&dev->dev, UINT_MAX);
1133− dma_set_coherent_mask(&dev->dev, dma_get_required_mask(&dev->dev));
1134+ dma_mask = IS_ENABLED(CONFIG_64BIT) ? DMA_BIT_MASK(64) : DMA_BIT_MASK(32);
1135+ err = dma_coerce_mask_and_coherent(&dev->dev, dma_mask);
1136+ if (err)
1137+ return err;
11341138
11351139 dev->uverbs_cmd_mask = BIT_ULL(IB_USER_VERBS_CMD_GET_CONTEXT)
11361140 | BIT_ULL(IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL)
drivers/infiniband/sw/siw/siw_main.c+5−2
@@ -306,6 +306,7 @@ static struct siw_device *siw_device_create(struct net_device *netdev) · 305 unmodified lines
306306 struct siw_device *sdev = NULL;
307307 struct ib_device *base_dev;
308308 struct device *parent = netdev->dev.parent;
309+ u64 dma_mask;
309310 int rv;
310311
311312 if (!parent) {
@@ -384,8 +385,10 @@ static struct siw_device *siw_device_create(struct net_device *netdev) · 72 unmodified lines
384385 base_dev->dev.parent = parent;
385386 base_dev->dev.dma_parms = &sdev->dma_parms;
386387 dma_set_max_seg_size(&base_dev->dev, UINT_MAX);
387− dma_set_coherent_mask(&base_dev->dev,
388− dma_get_required_mask(&base_dev->dev));
388+ dma_mask = IS_ENABLED(CONFIG_64BIT) ? DMA_BIT_MASK(64) : DMA_BIT_MASK(32);
389+ if (dma_coerce_mask_and_coherent(&base_dev->dev, dma_mask))
390+ goto error;
391+
389392 base_dev->num_comp_vectors = num_possible_cpus();
390393
391394 xa_init_flags(&sdev->qp_xa, XA_FLAGS_ALLOC1);
drivers/infiniband/ulp/srpt/ib_srpt.c+8−5
@@ -622,10 +622,11 @@ static int srpt_refresh_port(struct srpt_port *sport) · 621 unmodified lines
622622 /**
623623 * srpt_unregister_mad_agent - unregister MAD callback functions
624624 * @sdev: SRPT HCA pointer.
625+ * @port_cnt: number of ports with registered MAD
625626 *
626627 * Note: It is safe to call this function more than once for the same device.
627628 */
628−static void srpt_unregister_mad_agent(struct srpt_device *sdev)
629+static void srpt_unregister_mad_agent(struct srpt_device *sdev, int port_cnt)
629630 {
630631 struct ib_port_modify port_modify = {
631632 .clr_port_cap_mask = IB_PORT_DEVICE_MGMT_SUP,
@@ -633,7 +634,7 @@ static void srpt_unregister_mad_agent(struct srpt_device *sdev) · 1 unmodified line
633634 struct srpt_port *sport;
634635 int i;
635636
636− for (i = 1; i <= sdev->device->phys_port_cnt; i++) {
637+ for (i = 1; i <= port_cnt; i++) {
637638 sport = &sdev->port[i - 1];
638639 WARN_ON(sport->port != i);
639640 if (sport->mad_agent) {
@@ -3185,7 +3186,8 @@ static int srpt_add_one(struct ib_device *device) · 2545 unmodified lines
31853186 if (ret) {
31863187 pr_err("MAD registration failed for %s-%d.\n",
31873188 dev_name(&sdev->device->dev), i);
3188− goto err_event;
3189+ i--;
3190+ goto err_port;
31893191 }
31903192 }
31913193
@@ -3197,7 +3199,8 @@ static int srpt_add_one(struct ib_device *device) · 5 unmodified lines
31973199 pr_debug("added %s.\n", dev_name(&device->dev));
31983200 return 0;
31993201
3200−err_event:
3202+err_port:
3203+ srpt_unregister_mad_agent(sdev, i);
32013204 ib_unregister_event_handler(&sdev->event_handler);
32023205 err_cm:
32033206 if (sdev->cm_id)
@@ -3221,7 +3224,7 @@ static void srpt_remove_one(struct ib_device *device, void *client_data) · 17 unmodified lines
32213224 struct srpt_device *sdev = client_data;
32223225 int i;
32233226
3224− srpt_unregister_mad_agent(sdev);
3227+ srpt_unregister_mad_agent(sdev, sdev->device->phys_port_cnt);
32253228
32263229 ib_unregister_event_handler(&sdev->event_handler);
32273230
drivers/infiniband/ulp/srpt/ib_srpt.h+1−0
@@ -256,6 +256,7 @@ enum rdma_ch_state { · 255 unmodified lines
256256 * @rdma_cm: See below.
257257 * @rdma_cm.cm_id: RDMA CM ID associated with the channel.
258258 * @cq: IB completion queue for this channel.
259+ * @cq_size: Number of CQEs in @cq.
259260 * @zw_cqe: Zero-length write CQE.
260261 * @rcu: RCU head.
261262 * @kref: kref for this channel.
drivers/iommu/amd/amd_iommu_types.h+5−1
@@ -409,7 +409,11 @@ extern bool amd_iommu_np_cache; · 408 unmodified lines
409409 /* Only true if all IOMMUs support device IOTLBs */
410410 extern bool amd_iommu_iotlb_sup;
411411
412−#define MAX_IRQS_PER_TABLE 256
412+/*
413+ * AMD IOMMU hardware only support 512 IRTEs despite
414+ * the architectural limitation of 2048 entries.
415+ */
416+#define MAX_IRQS_PER_TABLE 512
413417 #define IRQ_TABLE_ALIGNMENT 128
414418
415419 struct irq_remap_table {
drivers/iommu/intel/iommu.c+3−0
@@ -2525,6 +2525,9 @@ struct dmar_domain *find_domain(struct device *dev) · 2524 unmodified lines
25252525 {
25262526 struct device_domain_info *info;
25272527
2528+ if (unlikely(!dev || !dev->iommu))
2529+ return NULL;
2530+
25282531 if (unlikely(attach_deferred(dev)))
25292532 return NULL;
25302533
drivers/iommu/intel/svm.c+7−1
@@ -279,6 +279,7 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev, · 278 unmodified lines
279279 struct intel_iommu *iommu = device_to_iommu(dev, NULL, NULL);
280280 struct intel_svm_dev *sdev = NULL;
281281 struct dmar_domain *dmar_domain;
282+ struct device_domain_info *info;
282283 struct intel_svm *svm = NULL;
283284 int ret = 0;
284285
@@ -310,6 +311,10 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev, · 25 unmodified lines
310311 if (data->hpasid <= 0 || data->hpasid >= PASID_MAX)
311312 return -EINVAL;
312313
314+ info = get_domain_info(dev);
315+ if (!info)
316+ return -EINVAL;
317+
313318 dmar_domain = to_dmar_domain(domain);
314319
315320 mutex_lock(&pasid_mutex);
@@ -357,6 +362,7 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev, · 41 unmodified lines
357362 goto out;
358363 }
359364 sdev->dev = dev;
365+ sdev->sid = PCI_DEVID(info->bus, info->devfn);
360366
361367 /* Only count users if device has aux domains */
362368 if (iommu_dev_feature_enabled(dev, IOMMU_DEV_FEAT_AUX))
@@ -1029,7 +1035,7 @@ no_pasid: · 666 unmodified lines
10291035 resp.qw0 = QI_PGRP_PASID(req->pasid) |
10301036 QI_PGRP_DID(req->rid) |
10311037 QI_PGRP_PASID_P(req->pasid_present) |
1032− QI_PGRP_PDP(req->pasid_present) |
1038+ QI_PGRP_PDP(req->priv_data_present) |
10331039 QI_PGRP_RESP_CODE(result) |
10341040 QI_PGRP_RESP_TYPE;
10351041 resp.qw1 = QI_PGRP_IDX(req->prg_index) |
drivers/iommu/iommu.c+1−1
@@ -2071,7 +2071,7 @@ EXPORT_SYMBOL_GPL(iommu_uapi_cache_invalidate); · 2070 unmodified lines
20712071
20722072 static int iommu_check_bind_data(struct iommu_gpasid_bind_data *data)
20732073 {
2074− u32 mask;
2074+ u64 mask;
20752075 int i;
20762076
20772077 if (data->version != IOMMU_GPASID_BIND_VERSION_1)
drivers/irqchip/Kconfig+1−2
@@ -180,7 +180,6 @@ config IRQ_MIPS_CPU · 179 unmodified lines
180180 select GENERIC_IRQ_CHIP
181181 select GENERIC_IRQ_IPI if SYS_SUPPORTS_MULTITHREADING
182182 select IRQ_DOMAIN
183− select IRQ_DOMAIN_HIERARCHY if GENERIC_IRQ_IPI
184183 select GENERIC_IRQ_EFFECTIVE_AFF_MASK
185184
186185 config CLPS711X_IRQCHIP
@@ -315,7 +314,6 @@ config KEYSTONE_IRQ · 128 unmodified lines
315314 config MIPS_GIC
316315 bool
317316 select GENERIC_IRQ_IPI
318− select IRQ_DOMAIN_HIERARCHY
319317 select MIPS_CM
320318
321319 config INGENIC_IRQ
@@ -591,6 +589,7 @@ config LOONGSON_PCH_MSI · 269 unmodified lines
591589
592590 config MST_IRQ
593591 bool "MStar Interrupt Controller"
592+ depends on ARCH_MEDIATEK || ARCH_MSTARV7 || COMPILE_TEST
594593 default ARCH_MEDIATEK
595594 select IRQ_DOMAIN
596595 select IRQ_DOMAIN_HIERARCHY
drivers/irqchip/irq-bcm2836.c+1−1
@@ -244,7 +244,7 @@ static int bcm2836_cpu_dying(unsigned int cpu) · 243 unmodified lines
244244
245245 #define BITS_PER_MBOX 32
246246
247−static void bcm2836_arm_irqchip_smp_init(void)
247+static void __init bcm2836_arm_irqchip_smp_init(void)
248248 {
249249 struct irq_fwspec ipi_fwspec = {
250250 .fwnode = intc.domain->fwnode,
drivers/irqchip/irq-mst-intc.c+2−2
@@ -154,8 +154,8 @@ static const struct irq_domain_ops mst_intc_domain_ops = { · 153 unmodified lines
154154 .free = irq_domain_free_irqs_common,
155155 };
156156
157−int __init
158−mst_intc_of_init(struct device_node *dn, struct device_node *parent)
157+static int __init mst_intc_of_init(struct device_node *dn,
158+ struct device_node *parent)
159159 {
160160 struct irq_domain *domain, *domain_parent;
161161 struct mst_intc_chip_data *cd;
drivers/irqchip/irq-renesas-intc-irqpin.c+3−5
@@ -71,8 +71,7 @@ struct intc_irqpin_priv { · 70 unmodified lines
7171 };
7272
7373 struct intc_irqpin_config {
74− unsigned int irlm_bit;
75− unsigned needs_irlm:1;
74+ int irlm_bit; /* -1 if non-existent */
7675 };
7776
7877 static unsigned long intc_irqpin_read32(void __iomem *iomem)
@@ -349,11 +348,10 @@ static const struct irq_domain_ops intc_irqpin_irq_domain_ops = { · 270 unmodified lines
349348
350349 static const struct intc_irqpin_config intc_irqpin_irlm_r8a777x = {
351350 .irlm_bit = 23, /* ICR0.IRLM0 */
352− .needs_irlm = 1,
353351 };
354352
355353 static const struct intc_irqpin_config intc_irqpin_rmobile = {
356− .needs_irlm = 0,
354+ .irlm_bit = -1,
357355 };
358356
359357 static const struct of_device_id intc_irqpin_dt_ids[] = {
@@ -470,7 +468,7 @@ static int intc_irqpin_probe(struct platform_device *pdev) · 110 unmodified lines
470468 }
471469
472470 /* configure "individual IRQ mode" where needed */
473− if (config && config->needs_irlm) {
471+ if (config && config->irlm_bit >= 0) {
474472 if (io[INTC_IRQPIN_REG_IRLM])
475473 intc_irqpin_read_modify_write(p, INTC_IRQPIN_REG_IRLM,
476474 config->irlm_bit, 1, 1);
drivers/irqchip/irq-sifive-plic.c+5−5
@@ -99,7 +99,7 @@ static inline void plic_irq_toggle(const struct cpumask *mask, · 98 unmodified lines
9999 struct irq_data *d, int enable)
100100 {
101101 int cpu;
102− struct plic_priv *priv = irq_get_chip_data(d->irq);
102+ struct plic_priv *priv = irq_data_get_irq_chip_data(d);
103103
104104 writel(enable, priv->regs + PRIORITY_BASE + d->hwirq * PRIORITY_PER_ID);
105105 for_each_cpu(cpu, mask) {
@@ -115,7 +115,7 @@ static void plic_irq_unmask(struct irq_data *d) · 9 unmodified lines
115115 {
116116 struct cpumask amask;
117117 unsigned int cpu;
118− struct plic_priv *priv = irq_get_chip_data(d->irq);
118+ struct plic_priv *priv = irq_data_get_irq_chip_data(d);
119119
120120 cpumask_and(&amask, &priv->lmask, cpu_online_mask);
121121 cpu = cpumask_any_and(irq_data_get_affinity_mask(d),
@@ -127,7 +127,7 @@ static void plic_irq_unmask(struct irq_data *d) · 5 unmodified lines
127127
128128 static void plic_irq_mask(struct irq_data *d)
129129 {
130− struct plic_priv *priv = irq_get_chip_data(d->irq);
130+ struct plic_priv *priv = irq_data_get_irq_chip_data(d);
131131
132132 plic_irq_toggle(&priv->lmask, d, 0);
133133 }
@@ -138,7 +138,7 @@ static int plic_set_affinity(struct irq_data *d, · 4 unmodified lines
138138 {
139139 unsigned int cpu;
140140 struct cpumask amask;
141− struct plic_priv *priv = irq_get_chip_data(d->irq);
141+ struct plic_priv *priv = irq_data_get_irq_chip_data(d);
142142
143143 cpumask_and(&amask, &priv->lmask, mask_val);
144144
@@ -151,7 +151,7 @@ static int plic_set_affinity(struct irq_data *d, · 6 unmodified lines
151151 return -EINVAL;
152152
153153 plic_irq_toggle(&priv->lmask, d, 0);
154− plic_irq_toggle(cpumask_of(cpu), d, 1);
154+ plic_irq_toggle(cpumask_of(cpu), d, !irqd_irq_masked(d));
155155
156156 irq_data_update_effective_affinity(d, cpumask_of(cpu));
157157
drivers/irqchip/irq-stm32-exti.c+4−0
@@ -195,6 +195,10 @@ static const struct stm32_desc_irq stm32mp1_desc_irq[] = { · 194 unmodified lines
195195 { .exti = 25, .irq_parent = 107, .chip = &stm32_exti_h_chip_direct },
196196 { .exti = 30, .irq_parent = 52, .chip = &stm32_exti_h_chip_direct },
197197 { .exti = 47, .irq_parent = 93, .chip = &stm32_exti_h_chip_direct },
198+ { .exti = 48, .irq_parent = 138, .chip = &stm32_exti_h_chip_direct },
199+ { .exti = 50, .irq_parent = 139, .chip = &stm32_exti_h_chip_direct },
200+ { .exti = 52, .irq_parent = 140, .chip = &stm32_exti_h_chip_direct },
201+ { .exti = 53, .irq_parent = 141, .chip = &stm32_exti_h_chip_direct },
198202 { .exti = 54, .irq_parent = 135, .chip = &stm32_exti_h_chip_direct },
199203 { .exti = 61, .irq_parent = 100, .chip = &stm32_exti_h_chip_direct },
200204 { .exti = 65, .irq_parent = 144, .chip = &stm32_exti_h_chip },
drivers/irqchip/irq-ti-sci-inta.c+80−3
@@ -85,6 +85,17 @@ struct ti_sci_inta_vint_desc { · 84 unmodified lines
8585 * @base: Base address of the memory mapped IO registers
8686 * @pdev: Pointer to platform device.
8787 * @ti_sci_id: TI-SCI device identifier
88+ * @unmapped_cnt: Number of @unmapped_dev_ids entries
89+ * @unmapped_dev_ids: Pointer to an array of TI-SCI device identifiers of
90+ * unmapped event sources.
91+ * Unmapped Events are not part of the Global Event Map and
92+ * they are converted to Global event within INTA to be
93+ * received by the same INTA to generate an interrupt.
94+ * In case an interrupt request comes for a device which is
95+ * generating Unmapped Event, we must use the INTA's TI-SCI
96+ * device identifier in place of the source device
97+ * identifier to let sysfw know where it has to program the
98+ * Global Event number.
8899 */
89100 struct ti_sci_inta_irq_domain {
90101 const struct ti_sci_handle *sci;
@@ -96,11 +107,37 @@ struct ti_sci_inta_irq_domain { · 5 unmodified lines
96107 void __iomem *base;
97108 struct platform_device *pdev;
98109 u32 ti_sci_id;
110+
111+ int unmapped_cnt;
112+ u16 *unmapped_dev_ids;
99113 };
100114
101115 #define to_vint_desc(e, i) container_of(e, struct ti_sci_inta_vint_desc, \
102116 events[i])
103117
118+static u16 ti_sci_inta_get_dev_id(struct ti_sci_inta_irq_domain *inta, u32 hwirq)
119+{
120+ u16 dev_id = HWIRQ_TO_DEVID(hwirq);
121+ int i;
122+
123+ if (inta->unmapped_cnt == 0)
124+ return dev_id;
125+
126+ /*
127+ * For devices sending Unmapped Events we must use the INTA's TI-SCI
128+ * device identifier number to be able to convert it to a Global Event
129+ * and map it to an interrupt.
130+ */
131+ for (i = 0; i < inta->unmapped_cnt; i++) {
132+ if (dev_id == inta->unmapped_dev_ids[i]) {
133+ dev_id = inta->ti_sci_id;
134+ break;
135+ }
136+ }
137+
138+ return dev_id;
139+}
140+
104141 /**
105142 * ti_sci_inta_irq_handler() - Chained IRQ handler for the vint irqs
106143 * @desc: Pointer to irq_desc corresponding to the irq
@@ -251,7 +288,7 @@ static struct ti_sci_inta_event_desc *ti_sci_inta_alloc_event(struct ti_sci_inta · 144 unmodified lines
251288 u16 dev_id, dev_index;
252289 int err;
253290
254− dev_id = HWIRQ_TO_DEVID(hwirq);
291+ dev_id = ti_sci_inta_get_dev_id(inta, hwirq);
255292 dev_index = HWIRQ_TO_IRQID(hwirq);
256293
257294 event_desc = &vint_desc->events[free_bit];
@@ -352,14 +389,15 @@ static void ti_sci_inta_free_irq(struct ti_sci_inta_event_desc *event_desc, · 94 unmodified lines
352389 {
353390 struct ti_sci_inta_vint_desc *vint_desc;
354391 struct ti_sci_inta_irq_domain *inta;
392+ u16 dev_id;
355393
356394 vint_desc = to_vint_desc(event_desc, event_desc->vint_bit);
357395 inta = vint_desc->domain->host_data;
396+ dev_id = ti_sci_inta_get_dev_id(inta, hwirq);
358397 /* free event irq */
359398 mutex_lock(&inta->vint_mutex);
360399 inta->sci->ops.rm_irq_ops.free_event_map(inta->sci,
361− HWIRQ_TO_DEVID(hwirq),
362− HWIRQ_TO_IRQID(hwirq),
400+ dev_id, HWIRQ_TO_IRQID(hwirq),
363401 inta->ti_sci_id,
364402 vint_desc->vint_id,
365403 event_desc->global_event,
@@ -574,6 +612,41 @@ static struct msi_domain_info ti_sci_inta_msi_domain_info = { · 208 unmodified lines
574612 .chip = &ti_sci_inta_msi_irq_chip,
575613 };
576614
615+static int ti_sci_inta_get_unmapped_sources(struct ti_sci_inta_irq_domain *inta)
616+{
617+ struct device *dev = &inta->pdev->dev;
618+ struct device_node *node = dev_of_node(dev);
619+ struct of_phandle_iterator it;
620+ int count, err, ret, i;
621+
622+ count = of_count_phandle_with_args(node, "ti,unmapped-event-sources", NULL);
623+ if (count <= 0)
624+ return 0;
625+
626+ inta->unmapped_dev_ids = devm_kcalloc(dev, count,
627+ sizeof(*inta->unmapped_dev_ids),
628+ GFP_KERNEL);
629+ if (!inta->unmapped_dev_ids)
630+ return -ENOMEM;
631+
632+ i = 0;
633+ of_for_each_phandle(&it, err, node, "ti,unmapped-event-sources", NULL, 0) {
634+ u32 dev_id;
635+
636+ ret = of_property_read_u32(it.node, "ti,sci-dev-id", &dev_id);
637+ if (ret) {
638+ dev_err(dev, "ti,sci-dev-id read failure for %pOFf\n", it.node);
639+ of_node_put(it.node);
640+ return ret;
641+ }
642+ inta->unmapped_dev_ids[i++] = dev_id;
643+ }
644+
645+ inta->unmapped_cnt = count;
646+
647+ return 0;
648+}
649+
577650 static int ti_sci_inta_irq_domain_probe(struct platform_device *pdev)
578651 {
579652 struct irq_domain *parent_domain, *domain, *msi_domain;
@@ -629,6 +702,10 @@ static int ti_sci_inta_irq_domain_probe(struct platform_device *pdev) · 49 unmodified lines
629702 if (IS_ERR(inta->base))
630703 return PTR_ERR(inta->base);
631704
705+ ret = ti_sci_inta_get_unmapped_sources(inta);
706+ if (ret)
707+ return ret;
708+
632709 domain = irq_domain_add_linear(dev_of_node(dev),
633710 ti_sci_get_num_resources(inta->vint),
634711 &ti_sci_inta_irq_domain_ops, inta);
drivers/mtd/nand/raw/fsl_ifc_nand.c+24−19
@@ -707,6 +707,30 @@ static int fsl_ifc_attach_chip(struct nand_chip *chip) · 706 unmodified lines
707707 {
708708 struct mtd_info *mtd = nand_to_mtd(chip);
709709 struct fsl_ifc_mtd *priv = nand_get_controller_data(chip);
710+ struct fsl_ifc_ctrl *ctrl = priv->ctrl;
711+ struct fsl_ifc_global __iomem *ifc_global = ctrl->gregs;
712+ u32 csor;
713+
714+ csor = ifc_in32(&ifc_global->csor_cs[priv->bank].csor);
715+
716+ /* Must also set CSOR_NAND_ECC_ENC_EN if DEC_EN set */
717+ if (csor & CSOR_NAND_ECC_DEC_EN) {
718+ chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST;
719+ mtd_set_ooblayout(mtd, &fsl_ifc_ooblayout_ops);
720+
721+ /* Hardware generates ECC per 512 Bytes */
722+ chip->ecc.size = 512;
723+ if ((csor & CSOR_NAND_ECC_MODE_MASK) == CSOR_NAND_ECC_MODE_4) {
724+ chip->ecc.bytes = 8;
725+ chip->ecc.strength = 4;
726+ } else {
727+ chip->ecc.bytes = 16;
728+ chip->ecc.strength = 8;
729+ }
730+ } else {
731+ chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT;
732+ chip->ecc.algo = NAND_ECC_ALGO_HAMMING;
733+ }
710734
711735 dev_dbg(priv->dev, "%s: nand->numchips = %d\n", __func__,
712736 nanddev_ntargets(&chip->base));
@@ -910,25 +934,6 @@ static int fsl_ifc_chip_init(struct fsl_ifc_mtd *priv) · 197 unmodified lines
910934 return -ENODEV;
911935 }
912936
913− /* Must also set CSOR_NAND_ECC_ENC_EN if DEC_EN set */
914− if (csor & CSOR_NAND_ECC_DEC_EN) {
915− chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST;
916− mtd_set_ooblayout(mtd, &fsl_ifc_ooblayout_ops);
917−
918− /* Hardware generates ECC per 512 Bytes */
919− chip->ecc.size = 512;
920− if ((csor & CSOR_NAND_ECC_MODE_MASK) == CSOR_NAND_ECC_MODE_4) {
921− chip->ecc.bytes = 8;
922− chip->ecc.strength = 4;
923− } else {
924− chip->ecc.bytes = 16;
925− chip->ecc.strength = 8;
926− }
927− } else {
928− chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT;
929− chip->ecc.algo = NAND_ECC_ALGO_HAMMING;
930− }
931−
932937 ret = fsl_ifc_sram_init(priv);
933938 if (ret)
934939 return ret;
drivers/mtd/nand/raw/mxc_nand.c+5−12
@@ -1681,6 +1681,11 @@ static int mxcnd_attach_chip(struct nand_chip *chip) · 1680 unmodified lines
16811681 struct mxc_nand_host *host = nand_get_controller_data(chip);
16821682 struct device *dev = mtd->dev.parent;
16831683
1684+ chip->ecc.bytes = host->devtype_data->eccbytes;
1685+ host->eccsize = host->devtype_data->eccsize;
1686+ chip->ecc.size = 512;
1687+ mtd_set_ooblayout(mtd, host->devtype_data->ooblayout);
1688+
16841689 switch (chip->ecc.engine_type) {
16851690 case NAND_ECC_ENGINE_TYPE_ON_HOST:
16861691 chip->ecc.read_page = mxc_nand_read_page;
@@ -1836,19 +1841,7 @@ static int mxcnd_probe(struct platform_device *pdev) · 149 unmodified lines
18361841 if (host->devtype_data->axi_offset)
18371842 host->regs_axi = host->base + host->devtype_data->axi_offset;
18381843
1839− this->ecc.bytes = host->devtype_data->eccbytes;
1840− host->eccsize = host->devtype_data->eccsize;
1841−
18421844 this->legacy.select_chip = host->devtype_data->select_chip;
1843− this->ecc.size = 512;
1844− mtd_set_ooblayout(mtd, host->devtype_data->ooblayout);
1845−
1846− if (host->pdata.hw_ecc) {
1847− this->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST;
1848− } else {
1849− this->ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT;
1850− this->ecc.algo = NAND_ECC_ALGO_HAMMING;
1851− }
18521845
18531846 /* NAND bus width determines access functions used by upper layer */
18541847 if (host->pdata.width == 2)
drivers/mtd/nand/raw/stm32_fmc2_nand.c+8−7
@@ -1708,6 +1708,13 @@ static int stm32_fmc2_nfc_attach_chip(struct nand_chip *chip) · 1707 unmodified lines
17081708 return -EINVAL;
17091709 }
17101710
1711+ /* Default ECC settings in case they are not set in the device tree */
1712+ if (!chip->ecc.size)
1713+ chip->ecc.size = FMC2_ECC_STEP_SIZE;
1714+
1715+ if (!chip->ecc.strength)
1716+ chip->ecc.strength = FMC2_ECC_BCH8;
1717+
17111718 ret = nand_ecc_choose_conf(chip, &stm32_fmc2_nfc_ecc_caps,
17121719 mtd->oobsize - FMC2_BBM_LEN);
17131720 if (ret) {
@@ -1727,8 +1734,7 @@ static int stm32_fmc2_nfc_attach_chip(struct nand_chip *chip) · 13 unmodified lines
17271734
17281735 mtd_set_ooblayout(mtd, &stm32_fmc2_nfc_ooblayout_ops);
17291736
1730− if (chip->options & NAND_BUSWIDTH_16)
1731− stm32_fmc2_nfc_set_buswidth_16(nfc, true);
1737+ stm32_fmc2_nfc_setup(chip);
17321738
17331739 return 0;
17341740 }
@@ -1952,11 +1958,6 @@ static int stm32_fmc2_nfc_probe(struct platform_device *pdev) · 217 unmodified lines
19521958 chip->options |= NAND_BUSWIDTH_AUTO | NAND_NO_SUBPAGE_WRITE |
19531959 NAND_USES_DMA;
19541960
1955− /* Default ECC settings */
1956− chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST;
1957− chip->ecc.size = FMC2_ECC_STEP_SIZE;
1958− chip->ecc.strength = FMC2_ECC_BCH8;
1959−
19601961 /* Scan to find existence of the device */
19611962 ret = nand_scan(chip, nand->ncs);
19621963 if (ret)
drivers/mtd/spi-nor/core.c+7−6
@@ -2701,11 +2701,10 @@ static void spi_nor_sfdp_init_params(struct spi_nor *nor) · 2700 unmodified lines
27012701
27022702 memcpy(&sfdp_params, nor->params, sizeof(sfdp_params));
27032703
2704− if (spi_nor_parse_sfdp(nor, &sfdp_params)) {
2704+ if (spi_nor_parse_sfdp(nor, nor->params)) {
2705+ memcpy(nor->params, &sfdp_params, sizeof(*nor->params));
27052706 nor->addr_width = 0;
27062707 nor->flags &= ~SNOR_F_4B_OPCODES;
2707− } else {
2708− memcpy(nor->params, &sfdp_params, sizeof(*nor->params));
27092708 }
27102709 }
27112710
@@ -3009,13 +3008,15 @@ static int spi_nor_set_addr_width(struct spi_nor *nor) · 297 unmodified lines
30093008 /* already configured from SFDP */
30103009 } else if (nor->info->addr_width) {
30113010 nor->addr_width = nor->info->addr_width;
3012− } else if (nor->mtd.size > 0x1000000) {
3013− /* enable 4-byte addressing if the device exceeds 16MiB */
3014− nor->addr_width = 4;
30153011 } else {
30163012 nor->addr_width = 3;
30173013 }
30183014
3015+ if (nor->addr_width == 3 && nor->mtd.size > 0x1000000) {
3016+ /* enable 4-byte addressing if the device exceeds 16MiB */
3017+ nor->addr_width = 4;
3018+ }
3019+
30193020 if (nor->addr_width > SPI_NOR_MAX_ADDR_WIDTH) {
30203021 dev_dbg(nor->dev, "address width is too large: %u\n",
30213022 nor->addr_width);
drivers/net/can/dev.c+11−3
@@ -512,9 +512,13 @@ __can_get_echo_skb(struct net_device *dev, unsigned int idx, u8 *len_ptr) · 511 unmodified lines
512512 */
513513 struct sk_buff *skb = priv->echo_skb[idx];
514514 struct canfd_frame *cf = (struct canfd_frame *)skb->data;
515− u8 len = cf->len;
516515
517− *len_ptr = len;
516+ /* get the real payload length for netdev statistics */
517+ if (cf->can_id & CAN_RTR_FLAG)
518+ *len_ptr = 0;
519+ else
520+ *len_ptr = cf->len;
521+
518522 priv->echo_skb[idx] = NULL;
519523
520524 return skb;
@@ -538,7 +542,11 @@ unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx) · 17 unmodified lines
538542 if (!skb)
539543 return 0;
540544
541− netif_rx(skb);
545+ skb_get(skb);
546+ if (netif_rx(skb) == NET_RX_SUCCESS)
547+ dev_consume_skb_any(skb);
548+ else
549+ dev_kfree_skb_any(skb);
542550
543551 return len;
544552 }
drivers/net/can/flexcan.c+7−5
@@ -217,7 +217,7 @@ · 216 unmodified lines
217217 * MX8MP FlexCAN3 03.00.17.01 yes yes no yes yes yes
218218 * VF610 FlexCAN3 ? no yes no yes yes? no
219219 * LS1021A FlexCAN2 03.00.04.00 no yes no no yes no
220− * LX2160A FlexCAN3 03.00.23.00 no yes no no yes yes
220+ * LX2160A FlexCAN3 03.00.23.00 no yes no yes yes yes
221221 *
222222 * Some SOCs do not have the RX_WARN & TX_WARN interrupt line connected.
223223 */
@@ -400,19 +400,19 @@ static struct flexcan_devtype_data fsl_imx8mp_devtype_data = { · 176 unmodified lines
400400 static const struct flexcan_devtype_data fsl_vf610_devtype_data = {
401401 .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS |
402402 FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_USE_OFF_TIMESTAMP |
403− FLEXCAN_QUIRK_BROKEN_PERR_STATE,
403+ FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_SUPPORT_ECC,
404404 };
405405
406406 static const struct flexcan_devtype_data fsl_ls1021a_r2_devtype_data = {
407407 .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS |
408− FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_BROKEN_PERR_STATE |
409− FLEXCAN_QUIRK_USE_OFF_TIMESTAMP,
408+ FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_USE_OFF_TIMESTAMP,
410409 };
411410
412411 static const struct flexcan_devtype_data fsl_lx2160a_r1_devtype_data = {
413412 .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS |
414413 FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_BROKEN_PERR_STATE |
415− FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | FLEXCAN_QUIRK_SUPPORT_FD,
414+ FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | FLEXCAN_QUIRK_SUPPORT_FD |
415+ FLEXCAN_QUIRK_SUPPORT_ECC,
416416 };
417417
418418 static const struct can_bittiming_const flexcan_bittiming_const = {
@@ -2062,6 +2062,8 @@ static int flexcan_remove(struct platform_device *pdev) · 1643 unmodified lines
20622062 {
20632063 struct net_device *dev = platform_get_drvdata(pdev);
20642064
2065+ device_set_wakeup_enable(&pdev->dev, false);
2066+ device_set_wakeup_capable(&pdev->dev, false);
20652067 unregister_flexcandev(dev);
20662068 pm_runtime_disable(&pdev->dev);
20672069 free_candev(dev);
drivers/net/can/peak_canfd/peak_canfd.c+8−3
@@ -262,8 +262,7 @@ static int pucan_handle_can_rx(struct peak_canfd_priv *priv, · 261 unmodified lines
262262 cf_len = get_can_dlc(pucan_msg_get_dlc(msg));
263263
264264 /* if this frame is an echo, */
265− if ((rx_msg_flags & PUCAN_MSG_LOOPED_BACK) &&
266− !(rx_msg_flags & PUCAN_MSG_SELF_RECEIVE)) {
265+ if (rx_msg_flags & PUCAN_MSG_LOOPED_BACK) {
267266 unsigned long flags;
268267
269268 spin_lock_irqsave(&priv->echo_lock, flags);
@@ -277,7 +276,13 @@ static int pucan_handle_can_rx(struct peak_canfd_priv *priv, · 7 unmodified lines
277276 netif_wake_queue(priv->ndev);
278277
279278 spin_unlock_irqrestore(&priv->echo_lock, flags);
280− return 0;
279+
280+ /* if this frame is only an echo, stop here. Otherwise,
281+ * continue to push this application self-received frame into
282+ * its own rx queue.
283+ */
284+ if (!(rx_msg_flags & PUCAN_MSG_SELF_RECEIVE))
285+ return 0;
281286 }
282287
283288 /* otherwise, it should be pushed into rx fifo */
drivers/net/can/rx-offload.c+2−2
@@ -245,7 +245,7 @@ int can_rx_offload_queue_sorted(struct can_rx_offload *offload, · 244 unmodified lines
245245
246246 if (skb_queue_len(&offload->skb_queue) >
247247 offload->skb_queue_len_max) {
248− kfree_skb(skb);
248+ dev_kfree_skb_any(skb);
249249 return -ENOBUFS;
250250 }
251251
@@ -290,7 +290,7 @@ int can_rx_offload_queue_tail(struct can_rx_offload *offload, · 38 unmodified lines
290290 {
291291 if (skb_queue_len(&offload->skb_queue) >
292292 offload->skb_queue_len_max) {
293− kfree_skb(skb);
293+ dev_kfree_skb_any(skb);
294294 return -ENOBUFS;
295295 }
296296
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c+11−11
@@ -75,11 +75,11 @@ static const char *__mcp251xfd_get_model_str(enum mcp251xfd_model model) · 74 unmodified lines
7575 {
7676 switch (model) {
7777 case MCP251XFD_MODEL_MCP2517FD:
78− return "MCP2517FD"; break;
78+ return "MCP2517FD";
7979 case MCP251XFD_MODEL_MCP2518FD:
80− return "MCP2518FD"; break;
80+ return "MCP2518FD";
8181 case MCP251XFD_MODEL_MCP251XFD:
82− return "MCP251xFD"; break;
82+ return "MCP251xFD";
8383 }
8484
8585 return "<unknown>";
@@ -95,21 +95,21 @@ static const char *mcp251xfd_get_mode_str(const u8 mode) · 9 unmodified lines
9595 {
9696 switch (mode) {
9797 case MCP251XFD_REG_CON_MODE_MIXED:
98− return "Mixed (CAN FD/CAN 2.0)"; break;
98+ return "Mixed (CAN FD/CAN 2.0)";
9999 case MCP251XFD_REG_CON_MODE_SLEEP:
100− return "Sleep"; break;
100+ return "Sleep";
101101 case MCP251XFD_REG_CON_MODE_INT_LOOPBACK:
102− return "Internal Loopback"; break;
102+ return "Internal Loopback";
103103 case MCP251XFD_REG_CON_MODE_LISTENONLY:
104− return "Listen Only"; break;
104+ return "Listen Only";
105105 case MCP251XFD_REG_CON_MODE_CONFIG:
106− return "Configuration"; break;
106+ return "Configuration";
107107 case MCP251XFD_REG_CON_MODE_EXT_LOOPBACK:
108− return "External Loopback"; break;
108+ return "External Loopback";
109109 case MCP251XFD_REG_CON_MODE_CAN2_0:
110− return "CAN 2.0"; break;
110+ return "CAN 2.0";
111111 case MCP251XFD_REG_CON_MODE_RESTRICTED:
112− return "Restricted Operation"; break;
112+ return "Restricted Operation";
113113 }
114114
115115 return "<unknown>";
drivers/net/can/spi/mcp251xfd/mcp251xfd-regmap.c+9−9
@@ -173,7 +173,7 @@ mcp251xfd_regmap_nocrc_read(void *context, · 172 unmodified lines
173173 memcpy(&buf_tx->cmd, reg, sizeof(buf_tx->cmd));
174174 if (MCP251XFD_SANITIZE_SPI)
175175 memset(buf_tx->data, 0x0, val_len);
176− };
176+ }
177177
178178 err = spi_sync(spi, &msg);
179179 if (err)
@@ -330,17 +330,17 @@ mcp251xfd_regmap_crc_read(void *context, · 150 unmodified lines
330330 goto out;
331331 }
332332
333− netdev_dbg(priv->ndev,
334− "CRC read error at address 0x%04x (length=%zd, data=%*ph, CRC=0x%04x) retrying.\n",
335− reg, val_len, (int)val_len, buf_rx->data,
336− get_unaligned_be16(buf_rx->data + val_len));
337− }
338−
339− if (err) {
340333 netdev_info(priv->ndev,
341− "CRC read error at address 0x%04x (length=%zd, data=%*ph, CRC=0x%04x).\n",
334+ "CRC read error at address 0x%04x (length=%zd, data=%*ph, CRC=0x%04x) retrying.\n",
342335 reg, val_len, (int)val_len, buf_rx->data,
343336 get_unaligned_be16(buf_rx->data + val_len));
337+ }
338+
339+ if (err) {
340+ netdev_err(priv->ndev,
341+ "CRC read error at address 0x%04x (length=%zd, data=%*ph, CRC=0x%04x).\n",
342+ reg, val_len, (int)val_len, buf_rx->data,
343+ get_unaligned_be16(buf_rx->data + val_len));
344344
345345 return err;
346346 }
drivers/net/can/ti_hecc.c+5−3
@@ -933,7 +933,7 @@ static int ti_hecc_probe(struct platform_device *pdev) · 932 unmodified lines
933933 err = clk_prepare_enable(priv->clk);
934934 if (err) {
935935 dev_err(&pdev->dev, "clk_prepare_enable() failed\n");
936− goto probe_exit_clk;
936+ goto probe_exit_release_clk;
937937 }
938938
939939 priv->offload.mailbox_read = ti_hecc_mailbox_read;
@@ -942,7 +942,7 @@ static int ti_hecc_probe(struct platform_device *pdev) · 2 unmodified lines
942942 err = can_rx_offload_add_timestamp(ndev, &priv->offload);
943943 if (err) {
944944 dev_err(&pdev->dev, "can_rx_offload_add_timestamp() failed\n");
945− goto probe_exit_clk;
945+ goto probe_exit_disable_clk;
946946 }
947947
948948 err = register_candev(ndev);
@@ -960,7 +960,9 @@ static int ti_hecc_probe(struct platform_device *pdev) · 11 unmodified lines
960960
961961 probe_exit_offload:
962962 can_rx_offload_del(&priv->offload);
963−probe_exit_clk:
963+probe_exit_disable_clk:
964+ clk_disable_unprepare(priv->clk);
965+probe_exit_release_clk:
964966 clk_put(priv->clk);
965967 probe_exit_candev:
966968 free_candev(ndev);
drivers/net/can/usb/peak_usb/pcan_usb_core.c+46−5
@@ -130,14 +130,55 @@ void peak_usb_get_ts_time(struct peak_time_ref *time_ref, u32 ts, ktime_t *time) · 129 unmodified lines
130130 /* protect from getting time before setting now */
131131 if (ktime_to_ns(time_ref->tv_host)) {
132132 u64 delta_us;
133+ s64 delta_ts = 0;
134+
135+ /* General case: dev_ts_1 < dev_ts_2 < ts, with:
136+ *
137+ * - dev_ts_1 = previous sync timestamp
138+ * - dev_ts_2 = last sync timestamp
139+ * - ts = event timestamp
140+ * - ts_period = known sync period (theoretical)
141+ * ~ dev_ts2 - dev_ts1
142+ * *but*:
143+ *
144+ * - time counters wrap (see adapter->ts_used_bits)
145+ * - sometimes, dev_ts_1 < ts < dev_ts2
146+ *
147+ * "normal" case (sync time counters increase):
148+ * must take into account case when ts wraps (tsw)
149+ *
150+ * < ts_period > < >
151+ * | | |
152+ * ---+--------+----+-------0-+--+-->
153+ * ts_dev_1 | ts_dev_2 |
154+ * ts tsw
155+ */
156+ if (time_ref->ts_dev_1 < time_ref->ts_dev_2) {
157+ /* case when event time (tsw) wraps */
158+ if (ts < time_ref->ts_dev_1)
159+ delta_ts = 1 << time_ref->adapter->ts_used_bits;
160+
161+ /* Otherwise, sync time counter (ts_dev_2) has wrapped:
162+ * handle case when event time (tsn) hasn't.
163+ *
164+ * < ts_period > < >
165+ * | | |
166+ * ---+--------+--0-+---------+--+-->
167+ * ts_dev_1 | ts_dev_2 |
168+ * tsn ts
169+ */
170+ } else if (time_ref->ts_dev_1 < ts) {
171+ delta_ts = -(1 << time_ref->adapter->ts_used_bits);
172+ }
133173
134− delta_us = ts - time_ref->ts_dev_2;
135− if (ts < time_ref->ts_dev_2)
136− delta_us &= (1 << time_ref->adapter->ts_used_bits) - 1;
174+ /* add delay between last sync and event timestamps */
175+ delta_ts += (signed int)(ts - time_ref->ts_dev_2);
137176
138− delta_us += time_ref->ts_total;
177+ /* add time from beginning to last sync */
178+ delta_ts += time_ref->ts_total;
139179
140− delta_us *= time_ref->adapter->us_per_ts_scale;
180+ /* convert ticks number into microseconds */
181+ delta_us = delta_ts * time_ref->adapter->us_per_ts_scale;
141182 delta_us >>= time_ref->adapter->us_per_ts_shift;
142183
143184 *time = ktime_add_us(time_ref->tv_host_0, delta_us);
drivers/net/can/usb/peak_usb/pcan_usb_fd.c+37−11
@@ -468,12 +468,18 @@ static int pcan_usb_fd_decode_canmsg(struct pcan_usb_fd_if *usb_if, · 467 unmodified lines
468468 struct pucan_msg *rx_msg)
469469 {
470470 struct pucan_rx_msg *rm = (struct pucan_rx_msg *)rx_msg;
471− struct peak_usb_device *dev = usb_if->dev[pucan_msg_get_channel(rm)];
472− struct net_device *netdev = dev->netdev;
471+ struct peak_usb_device *dev;
472+ struct net_device *netdev;
473473 struct canfd_frame *cfd;
474474 struct sk_buff *skb;
475475 const u16 rx_msg_flags = le16_to_cpu(rm->flags);
476476
477+ if (pucan_msg_get_channel(rm) >= ARRAY_SIZE(usb_if->dev))
478+ return -ENOMEM;
479+
480+ dev = usb_if->dev[pucan_msg_get_channel(rm)];
481+ netdev = dev->netdev;
482+
477483 if (rx_msg_flags & PUCAN_MSG_EXT_DATA_LEN) {
478484 /* CANFD frame case */
479485 skb = alloc_canfd_skb(netdev, &cfd);
@@ -519,15 +525,21 @@ static int pcan_usb_fd_decode_status(struct pcan_usb_fd_if *usb_if, · 39 unmodified lines
519525 struct pucan_msg *rx_msg)
520526 {
521527 struct pucan_status_msg *sm = (struct pucan_status_msg *)rx_msg;
522− struct peak_usb_device *dev = usb_if->dev[pucan_stmsg_get_channel(sm)];
523− struct pcan_usb_fd_device *pdev =
524− container_of(dev, struct pcan_usb_fd_device, dev);
528+ struct pcan_usb_fd_device *pdev;
525529 enum can_state new_state = CAN_STATE_ERROR_ACTIVE;
526530 enum can_state rx_state, tx_state;
527− struct net_device *netdev = dev->netdev;
531+ struct peak_usb_device *dev;
532+ struct net_device *netdev;
528533 struct can_frame *cf;
529534 struct sk_buff *skb;
530535
536+ if (pucan_stmsg_get_channel(sm) >= ARRAY_SIZE(usb_if->dev))
537+ return -ENOMEM;
538+
539+ dev = usb_if->dev[pucan_stmsg_get_channel(sm)];
540+ pdev = container_of(dev, struct pcan_usb_fd_device, dev);
541+ netdev = dev->netdev;
542+
531543 /* nothing should be sent while in BUS_OFF state */
532544 if (dev->can.state == CAN_STATE_BUS_OFF)
533545 return 0;
@@ -579,9 +591,14 @@ static int pcan_usb_fd_decode_error(struct pcan_usb_fd_if *usb_if, · 45 unmodified lines
579591 struct pucan_msg *rx_msg)
580592 {
581593 struct pucan_error_msg *er = (struct pucan_error_msg *)rx_msg;
582− struct peak_usb_device *dev = usb_if->dev[pucan_ermsg_get_channel(er)];
583− struct pcan_usb_fd_device *pdev =
584− container_of(dev, struct pcan_usb_fd_device, dev);
594+ struct pcan_usb_fd_device *pdev;
595+ struct peak_usb_device *dev;
596+
597+ if (pucan_ermsg_get_channel(er) >= ARRAY_SIZE(usb_if->dev))
598+ return -EINVAL;
599+
600+ dev = usb_if->dev[pucan_ermsg_get_channel(er)];
601+ pdev = container_of(dev, struct pcan_usb_fd_device, dev);
585602
586603 /* keep a trace of tx and rx error counters for later use */
587604 pdev->bec.txerr = er->tx_err_cnt;
@@ -595,11 +612,17 @@ static int pcan_usb_fd_decode_overrun(struct pcan_usb_fd_if *usb_if, · 7 unmodified lines
595612 struct pucan_msg *rx_msg)
596613 {
597614 struct pcan_ufd_ovr_msg *ov = (struct pcan_ufd_ovr_msg *)rx_msg;
598− struct peak_usb_device *dev = usb_if->dev[pufd_omsg_get_channel(ov)];
599− struct net_device *netdev = dev->netdev;
615+ struct peak_usb_device *dev;
616+ struct net_device *netdev;
600617 struct can_frame *cf;
601618 struct sk_buff *skb;
602619
620+ if (pufd_omsg_get_channel(ov) >= ARRAY_SIZE(usb_if->dev))
621+ return -EINVAL;
622+
623+ dev = usb_if->dev[pufd_omsg_get_channel(ov)];
624+ netdev = dev->netdev;
625+
603626 /* allocate an skb to store the error frame */
604627 skb = alloc_can_err_skb(netdev, &cf);
605628 if (!skb)
@@ -716,6 +739,9 @@ static int pcan_usb_fd_encode_msg(struct peak_usb_device *dev, · 110 unmodified lines
716739 u16 tx_msg_size, tx_msg_flags;
717740 u8 can_dlc;
718741
742+ if (cfd->len > CANFD_MAX_DLEN)
743+ return -EINVAL;
744+
719745 tx_msg_size = ALIGN(sizeof(struct pucan_tx_msg) + cfd->len, 4);
720746 tx_msg->size = cpu_to_le16(tx_msg_size);
721747 tx_msg->type = cpu_to_le16(PUCAN_MSG_CAN_TX);
drivers/net/can/xilinx_can.c+3−3
@@ -1395,7 +1395,7 @@ static int xcan_open(struct net_device *ndev) · 1394 unmodified lines
13951395 if (ret < 0) {
13961396 netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n",
13971397 __func__, ret);
1398− return ret;
1398+ goto err;
13991399 }
14001400
14011401 ret = request_irq(ndev->irq, xcan_interrupt, priv->irq_flags,
@@ -1479,6 +1479,7 @@ static int xcan_get_berr_counter(const struct net_device *ndev, · 77 unmodified lines
14791479 if (ret < 0) {
14801480 netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n",
14811481 __func__, ret);
1482+ pm_runtime_put(priv->dev);
14821483 return ret;
14831484 }
14841485
@@ -1793,7 +1794,7 @@ static int xcan_probe(struct platform_device *pdev) · 308 unmodified lines
17931794 if (ret < 0) {
17941795 netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n",
17951796 __func__, ret);
1796− goto err_pmdisable;
1797+ goto err_disableclks;
17971798 }
17981799
17991800 if (priv->read_reg(priv, XCAN_SR_OFFSET) != XCAN_SR_CONFIG_MASK) {
@@ -1828,7 +1829,6 @@ static int xcan_probe(struct platform_device *pdev) · 28 unmodified lines
18281829
18291830 err_disableclks:
18301831 pm_runtime_put(priv->dev);
1831−err_pmdisable:
18321832 pm_runtime_disable(&pdev->dev);
18331833 err_free:
18341834 free_candev(ndev);
drivers/net/dsa/qca8k.c+2−2
@@ -1219,8 +1219,8 @@ qca8k_port_change_mtu(struct dsa_switch *ds, int port, int new_mtu) · 1218 unmodified lines
12191219 priv->port_mtu[port] = new_mtu;
12201220
12211221 for (i = 0; i < QCA8K_NUM_PORTS; i++)
1222− if (priv->port_mtu[port] > mtu)
1223− mtu = priv->port_mtu[port];
1222+ if (priv->port_mtu[i] > mtu)
1223+ mtu = priv->port_mtu[i];
12241224
12251225 /* Include L2 header / FCS length */
12261226 qca8k_write(priv, QCA8K_MAX_FRAME_SIZE, mtu + ETH_HLEN + ETH_FCS_LEN);
drivers/net/ethernet/cadence/macb_main.c+2−1
@@ -1929,7 +1929,8 @@ static inline int macb_clear_csum(struct sk_buff *skb) · 1928 unmodified lines
19291929
19301930 static int macb_pad_and_fcs(struct sk_buff **skb, struct net_device *ndev)
19311931 {
1932− bool cloned = skb_cloned(*skb) || skb_header_cloned(*skb);
1932+ bool cloned = skb_cloned(*skb) || skb_header_cloned(*skb) ||
1933+ skb_is_nonlinear(*skb);
19331934 int padlen = ETH_ZLEN - (*skb)->len;
19341935 int headroom = skb_headroom(*skb);
19351936 int tailroom = skb_tailroom(*skb);
drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c+1−1
@@ -212,7 +212,7 @@ static struct sk_buff *alloc_ctrl_skb(struct sk_buff *skb, int len) · 211 unmodified lines
212212 {
213213 if (likely(skb && !skb_shared(skb) && !skb_cloned(skb))) {
214214 __skb_trim(skb, 0);
215− refcount_add(2, &skb->users);
215+ refcount_inc(&skb->users);
216216 } else {
217217 skb = alloc_skb(len, GFP_KERNEL | __GFP_NOFAIL);
218218 }
drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_hw.c+3−0
@@ -383,6 +383,9 @@ int chtls_setkey(struct chtls_sock *csk, u32 keylen, · 382 unmodified lines
383383 if (ret)
384384 goto out_notcb;
385385
386+ if (unlikely(csk_flag(sk, CSK_ABORT_SHUTDOWN)))
387+ goto out_notcb;
388+
386389 set_wr_txq(skb, CPL_PRIORITY_DATA, csk->tlshws.txqid);
387390 csk->wr_credits -= DIV_ROUND_UP(len, 16);
388391 csk->wr_unacked += DIV_ROUND_UP(len, 16);
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c+18−10
@@ -174,12 +174,17 @@ MODULE_PARM_DESC(tx_timeout, "The Tx timeout in ms"); · 173 unmodified lines
174174 #define DPAA_PARSE_RESULTS_SIZE sizeof(struct fman_prs_result)
175175 #define DPAA_TIME_STAMP_SIZE 8
176176 #define DPAA_HASH_RESULTS_SIZE 8
177+#define DPAA_HWA_SIZE (DPAA_PARSE_RESULTS_SIZE + DPAA_TIME_STAMP_SIZE \
178+ + DPAA_HASH_RESULTS_SIZE)
179+#define DPAA_RX_PRIV_DATA_DEFAULT_SIZE (DPAA_TX_PRIV_DATA_SIZE + \
180+ dpaa_rx_extra_headroom)
177181 #ifdef CONFIG_DPAA_ERRATUM_A050385
178−#define DPAA_RX_PRIV_DATA_SIZE (DPAA_A050385_ALIGN - (DPAA_PARSE_RESULTS_SIZE\
179− + DPAA_TIME_STAMP_SIZE + DPAA_HASH_RESULTS_SIZE))
182+#define DPAA_RX_PRIV_DATA_A050385_SIZE (DPAA_A050385_ALIGN - DPAA_HWA_SIZE)
183+#define DPAA_RX_PRIV_DATA_SIZE (fman_has_errata_a050385() ? \
184+ DPAA_RX_PRIV_DATA_A050385_SIZE : \
185+ DPAA_RX_PRIV_DATA_DEFAULT_SIZE)
180186 #else
181−#define DPAA_RX_PRIV_DATA_SIZE (u16)(DPAA_TX_PRIV_DATA_SIZE + \
182− dpaa_rx_extra_headroom)
187+#define DPAA_RX_PRIV_DATA_SIZE DPAA_RX_PRIV_DATA_DEFAULT_SIZE
183188 #endif
184189
185190 #define DPAA_ETH_PCD_RXQ_NUM 128
@@ -2840,7 +2845,8 @@ out_error: · 2654 unmodified lines
28402845 return err;
28412846 }
28422847
2843−static inline u16 dpaa_get_headroom(struct dpaa_buffer_layout *bl)
2848+static u16 dpaa_get_headroom(struct dpaa_buffer_layout *bl,
2849+ enum port_type port)
28442850 {
28452851 u16 headroom;
28462852
@@ -2854,10 +2860,12 @@ static inline u16 dpaa_get_headroom(struct dpaa_buffer_layout *bl) · 7 unmodified lines
28542860 *
28552861 * Also make sure the headroom is a multiple of data_align bytes
28562862 */
2857− headroom = (u16)(bl->priv_data_size + DPAA_PARSE_RESULTS_SIZE +
2858− DPAA_TIME_STAMP_SIZE + DPAA_HASH_RESULTS_SIZE);
2863+ headroom = (u16)(bl[port].priv_data_size + DPAA_HWA_SIZE);
28592864
2860− return ALIGN(headroom, DPAA_FD_DATA_ALIGNMENT);
2865+ if (port == RX)
2866+ return ALIGN(headroom, DPAA_FD_RX_DATA_ALIGNMENT);
2867+ else
2868+ return ALIGN(headroom, DPAA_FD_DATA_ALIGNMENT);
28612869 }
28622870
28632871 static int dpaa_eth_probe(struct platform_device *pdev)
@@ -3025,8 +3033,8 @@ static int dpaa_eth_probe(struct platform_device *pdev) · 161 unmodified lines
30253033 goto free_dpaa_fqs;
30263034 }
30273035
3028− priv->tx_headroom = dpaa_get_headroom(&priv->buf_layout[TX]);
3029− priv->rx_headroom = dpaa_get_headroom(&priv->buf_layout[RX]);
3036+ priv->tx_headroom = dpaa_get_headroom(priv->buf_layout, TX);
3037+ priv->rx_headroom = dpaa_get_headroom(priv->buf_layout, RX);
30303038
30313039 /* All real interfaces need their ports initialized */
30323040 err = dpaa_eth_init_ports(mac_dev, dpaa_bp, &port_fqs,
drivers/net/ethernet/freescale/fec.h+6−0
@@ -456,6 +456,12 @@ struct bufdesc_ex { · 455 unmodified lines
456456 */
457457 #define FEC_QUIRK_HAS_FRREG (1 << 16)
458458
459+/* Some FEC hardware blocks need the MMFR cleared at setup time to avoid
460+ * the generation of an MII event. This must be avoided in the older
461+ * FEC blocks where it will stop MII events being generated.
462+ */
463+#define FEC_QUIRK_CLEAR_SETUP_MII (1 << 17)
464+
459465 struct bufdesc_prop {
460466 int qid;
461467 /* Address of Rx and Tx buffers */
drivers/net/ethernet/freescale/fec_main.c+16−13
@@ -100,14 +100,14 @@ static const struct fec_devinfo fec_imx27_info = { · 99 unmodified lines
100100 static const struct fec_devinfo fec_imx28_info = {
101101 .quirks = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME |
102102 FEC_QUIRK_SINGLE_MDIO | FEC_QUIRK_HAS_RACC |
103− FEC_QUIRK_HAS_FRREG,
103+ FEC_QUIRK_HAS_FRREG | FEC_QUIRK_CLEAR_SETUP_MII,
104104 };
105105
106106 static const struct fec_devinfo fec_imx6q_info = {
107107 .quirks = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT |
108108 FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM |
109109 FEC_QUIRK_HAS_VLAN | FEC_QUIRK_ERR006358 |
110− FEC_QUIRK_HAS_RACC,
110+ FEC_QUIRK_HAS_RACC | FEC_QUIRK_CLEAR_SETUP_MII,
111111 };
112112
113113 static const struct fec_devinfo fec_mvf600_info = {
@@ -119,7 +119,8 @@ static const struct fec_devinfo fec_imx6x_info = { · 5 unmodified lines
119119 FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM |
120120 FEC_QUIRK_HAS_VLAN | FEC_QUIRK_HAS_AVB |
121121 FEC_QUIRK_ERR007885 | FEC_QUIRK_BUG_CAPTURE |
122− FEC_QUIRK_HAS_RACC | FEC_QUIRK_HAS_COALESCE,
122+ FEC_QUIRK_HAS_RACC | FEC_QUIRK_HAS_COALESCE |
123+ FEC_QUIRK_CLEAR_SETUP_MII,
123124 };
124125
125126 static const struct fec_devinfo fec_imx6ul_info = {
@@ -127,7 +128,7 @@ static const struct fec_devinfo fec_imx6ul_info = { · 1 unmodified line
127128 FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM |
128129 FEC_QUIRK_HAS_VLAN | FEC_QUIRK_ERR007885 |
129130 FEC_QUIRK_BUG_CAPTURE | FEC_QUIRK_HAS_RACC |
130− FEC_QUIRK_HAS_COALESCE,
131+ FEC_QUIRK_HAS_COALESCE | FEC_QUIRK_CLEAR_SETUP_MII,
131132 };
132133
133134 static struct platform_device_id fec_devtype[] = {
@@ -2134,15 +2135,17 @@ static int fec_enet_mii_init(struct platform_device *pdev) · 2000 unmodified lines
21342135 if (suppress_preamble)
21352136 fep->phy_speed |= BIT(7);
21362137
2137− /* Clear MMFR to avoid to generate MII event by writing MSCR.
2138− * MII event generation condition:
2139− * - writing MSCR:
2140− * - mmfr[31:0]_not_zero & mscr[7:0]_is_zero &
2141− * mscr_reg_data_in[7:0] != 0
2142− * - writing MMFR:
2143− * - mscr[7:0]_not_zero
2144− */
2145− writel(0, fep->hwp + FEC_MII_DATA);
2138+ if (fep->quirks & FEC_QUIRK_CLEAR_SETUP_MII) {
2139+ /* Clear MMFR to avoid to generate MII event by writing MSCR.
2140+ * MII event generation condition:
2141+ * - writing MSCR:
2142+ * - mmfr[31:0]_not_zero & mscr[7:0]_is_zero &
2143+ * mscr_reg_data_in[7:0] != 0
2144+ * - writing MMFR:
2145+ * - mscr[7:0]_not_zero
2146+ */
2147+ writel(0, fep->hwp + FEC_MII_DATA);
2148+ }
21462149
21472150 writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED);
21482151
drivers/net/ethernet/freescale/gianfar.c+3−11
@@ -1829,20 +1829,12 @@ static netdev_tx_t gfar_start_xmit(struct sk_buff *skb, struct net_device *dev) · 1828 unmodified lines
18291829 fcb_len = GMAC_FCB_LEN + GMAC_TXPAL_LEN;
18301830
18311831 /* make space for additional header when fcb is needed */
1832− if (fcb_len && unlikely(skb_headroom(skb) < fcb_len)) {
1833− struct sk_buff *skb_new;
1834−
1835− skb_new = skb_realloc_headroom(skb, fcb_len);
1836− if (!skb_new) {
1832+ if (fcb_len) {
1833+ if (unlikely(skb_cow_head(skb, fcb_len))) {
18371834 dev->stats.tx_errors++;
18381835 dev_kfree_skb_any(skb);
18391836 return NETDEV_TX_OK;
18401837 }
1841−
1842− if (skb->sk)
1843− skb_set_owner_w(skb_new, skb->sk);
1844− dev_consume_skb_any(skb);
1845− skb = skb_new;
18461838 }
18471839
18481840 /* total number of fragments in the SKB */
@@ -3380,7 +3372,7 @@ static int gfar_probe(struct platform_device *ofdev) · 1531 unmodified lines
33803372
33813373 if (dev->features & NETIF_F_IP_CSUM ||
33823374 priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER)
3383− dev->needed_headroom = GMAC_FCB_LEN;
3375+ dev->needed_headroom = GMAC_FCB_LEN + GMAC_TXPAL_LEN;
33843376
33853377 /* Initializing some of the rx/tx queue level parameters */
33863378 for (i = 0; i < priv->num_tx_queues; i++) {
drivers/net/ethernet/ibm/ibmvnic.c+32−4
@@ -1185,18 +1185,27 @@ static int ibmvnic_open(struct net_device *netdev) · 1184 unmodified lines
11851185 if (adapter->state != VNIC_CLOSED) {
11861186 rc = ibmvnic_login(netdev);
11871187 if (rc)
1188− return rc;
1188+ goto out;
11891189
11901190 rc = init_resources(adapter);
11911191 if (rc) {
11921192 netdev_err(netdev, "failed to initialize resources\n");
11931193 release_resources(adapter);
1194− return rc;
1194+ goto out;
11951195 }
11961196 }
11971197
11981198 rc = __ibmvnic_open(netdev);
11991199
1200+out:
1201+ /*
1202+ * If open fails due to a pending failover, set device state and
1203+ * return. Device operation will be handled by reset routine.
1204+ */
1205+ if (rc && adapter->failover_pending) {
1206+ adapter->state = VNIC_OPEN;
1207+ rc = 0;
1208+ }
12001209 return rc;
12011210 }
12021211
@@ -1922,6 +1931,13 @@ static int do_reset(struct ibmvnic_adapter *adapter, · 719 unmodified lines
19221931 rwi->reset_reason);
19231932
19241933 rtnl_lock();
1934+ /*
1935+ * Now that we have the rtnl lock, clear any pending failover.
1936+ * This will ensure ibmvnic_open() has either completed or will
1937+ * block until failover is complete.
1938+ */
1939+ if (rwi->reset_reason == VNIC_RESET_FAILOVER)
1940+ adapter->failover_pending = false;
19251941
19261942 netif_carrier_off(netdev);
19271943 adapter->reset_reason = rwi->reset_reason;
@@ -2202,6 +2218,13 @@ static void __ibmvnic_reset(struct work_struct *work) · 274 unmodified lines
22022218 /* CHANGE_PARAM requestor holds rtnl_lock */
22032219 rc = do_change_param_reset(adapter, rwi, reset_state);
22042220 } else if (adapter->force_reset_recovery) {
2221+ /*
2222+ * Since we are doing a hard reset now, clear the
2223+ * failover_pending flag so we don't ignore any
2224+ * future MOBILITY or other resets.
2225+ */
2226+ adapter->failover_pending = false;
2227+
22052228 /* Transport event occurred during previous reset */
22062229 if (adapter->wait_for_reset) {
22072230 /* Previous was CHANGE_PARAM; caller locked */
@@ -2266,9 +2289,15 @@ static int ibmvnic_reset(struct ibmvnic_adapter *adapter, · 58 unmodified lines
22662289 unsigned long flags;
22672290 int ret;
22682291
2292+ /*
2293+ * If failover is pending don't schedule any other reset.
2294+ * Instead let the failover complete. If there is already a
2295+ * a failover reset scheduled, we will detect and drop the
2296+ * duplicate reset when walking the ->rwi_list below.
2297+ */
22692298 if (adapter->state == VNIC_REMOVING ||
22702299 adapter->state == VNIC_REMOVED ||
2271− adapter->failover_pending) {
2300+ (adapter->failover_pending && reason != VNIC_RESET_FAILOVER)) {
22722301 ret = EBUSY;
22732302 netdev_dbg(netdev, "Adapter removing or pending failover, skipping reset\n");
22742303 goto err;
@@ -4713,7 +4742,6 @@ static void ibmvnic_handle_crq(union ibmvnic_crq *crq, · 2438 unmodified lines
47134742 case IBMVNIC_CRQ_INIT:
47144743 dev_info(dev, "Partner initialized\n");
47154744 adapter->from_passive_init = true;
4716− adapter->failover_pending = false;
47174745 if (!completion_done(&adapter->init_done)) {
47184746 complete(&adapter->init_done);
47194747 adapter->init_done_rc = -EIO;
drivers/net/ethernet/pensando/ionic/ionic_ethtool.c+5−0
@@ -126,6 +126,11 @@ static int ionic_get_link_ksettings(struct net_device *netdev, · 125 unmodified lines
126126
127127 ethtool_link_ksettings_zero_link_mode(ks, supported);
128128
129+ if (!idev->port_info) {
130+ netdev_err(netdev, "port_info not initialized\n");
131+ return -EOPNOTSUPP;
132+ }
133+
129134 /* The port_info data is found in a DMA space that the NIC keeps
130135 * up-to-date, so there's no need to request the data from the
131136 * NIC, we already have it in our memory space.
drivers/net/ethernet/realtek/r8169_main.c+11−3
@@ -4080,9 +4080,17 @@ err_out: · 4079 unmodified lines
40804080 return -EIO;
40814081 }
40824082
4083−static bool rtl_test_hw_pad_bug(struct rtl8169_private *tp, struct sk_buff *skb)
4083+static bool rtl_test_hw_pad_bug(struct rtl8169_private *tp)
40844084 {
4085− return skb->len < ETH_ZLEN && tp->mac_version == RTL_GIGA_MAC_VER_34;
4085+ switch (tp->mac_version) {
4086+ case RTL_GIGA_MAC_VER_34:
4087+ case RTL_GIGA_MAC_VER_60:
4088+ case RTL_GIGA_MAC_VER_61:
4089+ case RTL_GIGA_MAC_VER_63:
4090+ return true;
4091+ default:
4092+ return false;
4093+ }
40864094 }
40874095
40884096 static void rtl8169_tso_csum_v1(struct sk_buff *skb, u32 *opts)
@@ -4154,7 +4162,7 @@ static bool rtl8169_tso_csum_v2(struct rtl8169_private *tp, · 65 unmodified lines
41544162
41554163 opts[1] |= transport_offset << TCPHO_SHIFT;
41564164 } else {
4157− if (unlikely(rtl_test_hw_pad_bug(tp, skb)))
4165+ if (unlikely(skb->len < ETH_ZLEN && rtl_test_hw_pad_bug(tp)))
41584166 return !eth_skb_pad(skb);
41594167 }
41604168
drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c+7−7
@@ -625,13 +625,6 @@ static int intel_eth_pci_probe(struct pci_dev *pdev, · 624 unmodified lines
625625 if (ret)
626626 return ret;
627627
628− if (plat->eee_usecs_rate > 0) {
629− u32 tx_lpi_usec;
630−
631− tx_lpi_usec = (plat->eee_usecs_rate / 1000000) - 1;
632− writel(tx_lpi_usec, res.addr + GMAC_1US_TIC_COUNTER);
633− }
634−
635628 ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES);
636629 if (ret < 0)
637630 return ret;
@@ -641,6 +634,13 @@ static int intel_eth_pci_probe(struct pci_dev *pdev, · 3 unmodified lines
641634 res.wol_irq = pci_irq_vector(pdev, 0);
642635 res.irq = pci_irq_vector(pdev, 0);
643636
637+ if (plat->eee_usecs_rate > 0) {
638+ u32 tx_lpi_usec;
639+
640+ tx_lpi_usec = (plat->eee_usecs_rate / 1000000) - 1;
641+ writel(tx_lpi_usec, res.addr + GMAC_1US_TIC_COUNTER);
642+ }
643+
644644 ret = stmmac_dvr_probe(&pdev->dev, plat, &res);
645645 if (ret) {
646646 pci_free_irq_vectors(pdev);
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+1−0
@@ -4757,6 +4757,7 @@ static void stmmac_napi_add(struct net_device *dev) · 4756 unmodified lines
47574757
47584758 ch->priv_data = priv;
47594759 ch->index = queue;
4760+ spin_lock_init(&ch->lock);
47604761
47614762 if (queue < priv->plat->rx_queues_to_use) {
47624763 netif_napi_add(dev, &ch->rx_napi, stmmac_napi_poll_rx,
drivers/net/ethernet/ti/cpsw_ethtool.c+0−1
@@ -728,7 +728,6 @@ int cpsw_get_ts_info(struct net_device *ndev, struct ethtool_ts_info *info) · 727 unmodified lines
728728 (1 << HWTSTAMP_TX_ON);
729729 info->rx_filters =
730730 (1 << HWTSTAMP_FILTER_NONE) |
731− (1 << HWTSTAMP_FILTER_PTP_V1_L4_EVENT) |
732731 (1 << HWTSTAMP_FILTER_PTP_V2_EVENT);
733732 return 0;
734733 }
drivers/net/ethernet/ti/cpsw_priv.c+1−4
@@ -639,13 +639,10 @@ static int cpsw_hwtstamp_set(struct net_device *dev, struct ifreq *ifr) · 638 unmodified lines
639639 break;
640640 case HWTSTAMP_FILTER_ALL:
641641 case HWTSTAMP_FILTER_NTP_ALL:
642− return -ERANGE;
643642 case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
644643 case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
645644 case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
646− priv->rx_ts_enabled = HWTSTAMP_FILTER_PTP_V1_L4_EVENT;
647− cfg.rx_filter = HWTSTAMP_FILTER_PTP_V1_L4_EVENT;
648− break;
645+ return -ERANGE;
649646 case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
650647 case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
651648 case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
drivers/net/phy/sfp.c+2−1
@@ -2389,7 +2389,8 @@ static int sfp_probe(struct platform_device *pdev) · 2388 unmodified lines
23892389 continue;
23902390
23912391 sfp->gpio_irq[i] = gpiod_to_irq(sfp->gpio[i]);
2392− if (!sfp->gpio_irq[i]) {
2392+ if (sfp->gpio_irq[i] < 0) {
2393+ sfp->gpio_irq[i] = 0;
23932394 sfp->need_poll = true;
23942395 continue;
23952396 }
drivers/net/usb/qmi_wwan.c+1−0
@@ -1309,6 +1309,7 @@ static const struct usb_device_id products[] = { · 1308 unmodified lines
13091309 {QMI_FIXED_INTF(0x1bc7, 0x1101, 3)}, /* Telit ME910 dual modem */
13101310 {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */
13111311 {QMI_QUIRK_SET_DTR(0x1bc7, 0x1201, 2)}, /* Telit LE920, LE920A4 */
1312+ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1230, 2)}, /* Telit LE910Cx */
13121313 {QMI_QUIRK_SET_DTR(0x1bc7, 0x1260, 2)}, /* Telit LE910Cx */
13131314 {QMI_QUIRK_SET_DTR(0x1bc7, 0x1261, 2)}, /* Telit LE910Cx */
13141315 {QMI_QUIRK_SET_DTR(0x1bc7, 0x1900, 1)}, /* Telit LN940 series */
drivers/nvme/host/core.c+6−2
@@ -4582,8 +4582,7 @@ void nvme_start_queues(struct nvme_ctrl *ctrl) · 4581 unmodified lines
45824582 }
45834583 EXPORT_SYMBOL_GPL(nvme_start_queues);
45844584
4585−
4586−void nvme_sync_queues(struct nvme_ctrl *ctrl)
4585+void nvme_sync_io_queues(struct nvme_ctrl *ctrl)
45874586 {
45884587 struct nvme_ns *ns;
45894588
@@ -4591,7 +4590,12 @@ void nvme_sync_queues(struct nvme_ctrl *ctrl) · 1 unmodified line
45914590 list_for_each_entry(ns, &ctrl->namespaces, list)
45924591 blk_sync_queue(ns->queue);
45934592 up_read(&ctrl->namespaces_rwsem);
4593+}
4594+EXPORT_SYMBOL_GPL(nvme_sync_io_queues);
45944595
4596+void nvme_sync_queues(struct nvme_ctrl *ctrl)
4597+{
4598+ nvme_sync_io_queues(ctrl);
45954599 if (ctrl->admin_q)
45964600 blk_sync_queue(ctrl->admin_q);
45974601 }
drivers/nvme/host/nvme.h+1−0
@@ -602,6 +602,7 @@ void nvme_stop_queues(struct nvme_ctrl *ctrl); · 601 unmodified lines
602602 void nvme_start_queues(struct nvme_ctrl *ctrl);
603603 void nvme_kill_queues(struct nvme_ctrl *ctrl);
604604 void nvme_sync_queues(struct nvme_ctrl *ctrl);
605+void nvme_sync_io_queues(struct nvme_ctrl *ctrl);
605606 void nvme_unfreeze(struct nvme_ctrl *ctrl);
606607 void nvme_wait_freeze(struct nvme_ctrl *ctrl);
607608 int nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout);
drivers/nvme/host/pci.c+19−4
@@ -198,6 +198,7 @@ struct nvme_queue { · 197 unmodified lines
198198 u32 q_depth;
199199 u16 cq_vector;
200200 u16 sq_tail;
201+ u16 last_sq_tail;
201202 u16 cq_head;
202203 u16 qid;
203204 u8 cq_phase;
@@ -455,11 +456,24 @@ static int nvme_pci_map_queues(struct blk_mq_tag_set *set) · 251 unmodified lines
455456 return 0;
456457 }
457458
458−static inline void nvme_write_sq_db(struct nvme_queue *nvmeq)
459+/*
460+ * Write sq tail if we are asked to, or if the next command would wrap.
461+ */
462+static inline void nvme_write_sq_db(struct nvme_queue *nvmeq, bool write_sq)
459463 {
464+ if (!write_sq) {
465+ u16 next_tail = nvmeq->sq_tail + 1;
466+
467+ if (next_tail == nvmeq->q_depth)
468+ next_tail = 0;
469+ if (next_tail != nvmeq->last_sq_tail)
470+ return;
471+ }
472+
460473 if (nvme_dbbuf_update_and_check_event(nvmeq->sq_tail,
461474 nvmeq->dbbuf_sq_db, nvmeq->dbbuf_sq_ei))
462475 writel(nvmeq->sq_tail, nvmeq->q_db);
476+ nvmeq->last_sq_tail = nvmeq->sq_tail;
463477 }
464478
465479 /**
@@ -476,8 +490,7 @@ static void nvme_submit_cmd(struct nvme_queue *nvmeq, struct nvme_command *cmd, · 10 unmodified lines
476490 cmd, sizeof(*cmd));
477491 if (++nvmeq->sq_tail == nvmeq->q_depth)
478492 nvmeq->sq_tail = 0;
479− if (write_sq)
480− nvme_write_sq_db(nvmeq);
493+ nvme_write_sq_db(nvmeq, write_sq);
481494 spin_unlock(&nvmeq->sq_lock);
482495 }
483496
@@ -486,7 +499,8 @@ static void nvme_commit_rqs(struct blk_mq_hw_ctx *hctx) · 2 unmodified lines
486499 struct nvme_queue *nvmeq = hctx->driver_data;
487500
488501 spin_lock(&nvmeq->sq_lock);
489− nvme_write_sq_db(nvmeq);
502+ if (nvmeq->sq_tail != nvmeq->last_sq_tail)
503+ nvme_write_sq_db(nvmeq, true);
490504 spin_unlock(&nvmeq->sq_lock);
491505 }
492506
@@ -1496,6 +1510,7 @@ static void nvme_init_queue(struct nvme_queue *nvmeq, u16 qid) · 1003 unmodified lines
14961510 struct nvme_dev *dev = nvmeq->dev;
14971511
14981512 nvmeq->sq_tail = 0;
1513+ nvmeq->last_sq_tail = 0;
14991514 nvmeq->cq_head = 0;
15001515 nvmeq->cq_phase = 1;
15011516 nvmeq->q_db = &dev->dbs[qid * 2 * dev->db_stride];
drivers/nvme/host/rdma.c+3−11
@@ -122,7 +122,6 @@ struct nvme_rdma_ctrl { · 121 unmodified lines
122122 struct sockaddr_storage src_addr;
123123
124124 struct nvme_ctrl ctrl;
125− struct mutex teardown_lock;
126125 bool use_inline_data;
127126 u32 io_queues[HCTX_MAX_TYPES];
128127 };
@@ -1010,8 +1009,8 @@ out_free_io_queues: · 881 unmodified lines
10101009 static void nvme_rdma_teardown_admin_queue(struct nvme_rdma_ctrl *ctrl,
10111010 bool remove)
10121011 {
1013− mutex_lock(&ctrl->teardown_lock);
10141012 blk_mq_quiesce_queue(ctrl->ctrl.admin_q);
1013+ blk_sync_queue(ctrl->ctrl.admin_q);
10151014 nvme_rdma_stop_queue(&ctrl->queues[0]);
10161015 if (ctrl->ctrl.admin_tagset) {
10171016 blk_mq_tagset_busy_iter(ctrl->ctrl.admin_tagset,
@@ -1021,16 +1020,15 @@ static void nvme_rdma_teardown_admin_queue(struct nvme_rdma_ctrl *ctrl, · 3 unmodified lines
10211020 if (remove)
10221021 blk_mq_unquiesce_queue(ctrl->ctrl.admin_q);
10231022 nvme_rdma_destroy_admin_queue(ctrl, remove);
1024− mutex_unlock(&ctrl->teardown_lock);
10251023 }
10261024
10271025 static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl,
10281026 bool remove)
10291027 {
1030− mutex_lock(&ctrl->teardown_lock);
10311028 if (ctrl->ctrl.queue_count > 1) {
10321029 nvme_start_freeze(&ctrl->ctrl);
10331030 nvme_stop_queues(&ctrl->ctrl);
1031+ nvme_sync_io_queues(&ctrl->ctrl);
10341032 nvme_rdma_stop_io_queues(ctrl);
10351033 if (ctrl->ctrl.tagset) {
10361034 blk_mq_tagset_busy_iter(ctrl->ctrl.tagset,
@@ -1041,7 +1039,6 @@ static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl, · 4 unmodified lines
10411039 nvme_start_queues(&ctrl->ctrl);
10421040 nvme_rdma_destroy_io_queues(ctrl, remove);
10431041 }
1044− mutex_unlock(&ctrl->teardown_lock);
10451042 }
10461043
10471044 static void nvme_rdma_free_ctrl(struct nvme_ctrl *nctrl)
@@ -1976,16 +1973,12 @@ static void nvme_rdma_complete_timed_out(struct request *rq) · 928 unmodified lines
19761973 {
19771974 struct nvme_rdma_request *req = blk_mq_rq_to_pdu(rq);
19781975 struct nvme_rdma_queue *queue = req->queue;
1979− struct nvme_rdma_ctrl *ctrl = queue->ctrl;
19801976
1981− /* fence other contexts that may complete the command */
1982− mutex_lock(&ctrl->teardown_lock);
19831977 nvme_rdma_stop_queue(queue);
1984− if (!blk_mq_request_completed(rq)) {
1978+ if (blk_mq_request_started(rq) && !blk_mq_request_completed(rq)) {
19851979 nvme_req(rq)->status = NVME_SC_HOST_ABORTED_CMD;
19861980 blk_mq_complete_request(rq);
19871981 }
1988− mutex_unlock(&ctrl->teardown_lock);
19891982 }
19901983
19911984 static enum blk_eh_timer_return
@@ -2320,7 +2313,6 @@ static struct nvme_ctrl *nvme_rdma_create_ctrl(struct device *dev, · 328 unmodified lines
23202313 return ERR_PTR(-ENOMEM);
23212314 ctrl->ctrl.opts = opts;
23222315 INIT_LIST_HEAD(&ctrl->list);
2323− mutex_init(&ctrl->teardown_lock);
23242316
23252317 if (!(opts->mask & NVMF_OPT_TRSVCID)) {
23262318 opts->trsvcid =
drivers/nvme/host/tcp.c+4−12
@@ -124,7 +124,6 @@ struct nvme_tcp_ctrl { · 123 unmodified lines
124124 struct sockaddr_storage src_addr;
125125 struct nvme_ctrl ctrl;
126126
127− struct mutex teardown_lock;
128127 struct work_struct err_work;
129128 struct delayed_work connect_work;
130129 struct nvme_tcp_request async_req;
@@ -1886,8 +1885,8 @@ out_free_queue: · 1755 unmodified lines
18861885 static void nvme_tcp_teardown_admin_queue(struct nvme_ctrl *ctrl,
18871886 bool remove)
18881887 {
1889− mutex_lock(&to_tcp_ctrl(ctrl)->teardown_lock);
18901888 blk_mq_quiesce_queue(ctrl->admin_q);
1889+ blk_sync_queue(ctrl->admin_q);
18911890 nvme_tcp_stop_queue(ctrl, 0);
18921891 if (ctrl->admin_tagset) {
18931892 blk_mq_tagset_busy_iter(ctrl->admin_tagset,
@@ -1897,18 +1896,17 @@ static void nvme_tcp_teardown_admin_queue(struct nvme_ctrl *ctrl, · 3 unmodified lines
18971896 if (remove)
18981897 blk_mq_unquiesce_queue(ctrl->admin_q);
18991898 nvme_tcp_destroy_admin_queue(ctrl, remove);
1900− mutex_unlock(&to_tcp_ctrl(ctrl)->teardown_lock);
19011899 }
19021900
19031901 static void nvme_tcp_teardown_io_queues(struct nvme_ctrl *ctrl,
19041902 bool remove)
19051903 {
1906− mutex_lock(&to_tcp_ctrl(ctrl)->teardown_lock);
19071904 if (ctrl->queue_count <= 1)
1908− goto out;
1905+ return;
19091906 blk_mq_quiesce_queue(ctrl->admin_q);
19101907 nvme_start_freeze(ctrl);
19111908 nvme_stop_queues(ctrl);
1909+ nvme_sync_io_queues(ctrl);
19121910 nvme_tcp_stop_io_queues(ctrl);
19131911 if (ctrl->tagset) {
19141912 blk_mq_tagset_busy_iter(ctrl->tagset,
@@ -1918,8 +1916,6 @@ static void nvme_tcp_teardown_io_queues(struct nvme_ctrl *ctrl, · 3 unmodified lines
19181916 if (remove)
19191917 nvme_start_queues(ctrl);
19201918 nvme_tcp_destroy_io_queues(ctrl, remove);
1921−out:
1922− mutex_unlock(&to_tcp_ctrl(ctrl)->teardown_lock);
19231919 }
19241920
19251921 static void nvme_tcp_reconnect_or_remove(struct nvme_ctrl *ctrl)
@@ -2171,14 +2167,11 @@ static void nvme_tcp_complete_timed_out(struct request *rq) · 245 unmodified lines
21712167 struct nvme_tcp_request *req = blk_mq_rq_to_pdu(rq);
21722168 struct nvme_ctrl *ctrl = &req->queue->ctrl->ctrl;
21732169
2174− /* fence other contexts that may complete the command */
2175− mutex_lock(&to_tcp_ctrl(ctrl)->teardown_lock);
21762170 nvme_tcp_stop_queue(ctrl, nvme_tcp_queue_id(req->queue));
2177− if (!blk_mq_request_completed(rq)) {
2171+ if (blk_mq_request_started(rq) && !blk_mq_request_completed(rq)) {
21782172 nvme_req(rq)->status = NVME_SC_HOST_ABORTED_CMD;
21792173 blk_mq_complete_request(rq);
21802174 }
2181− mutex_unlock(&to_tcp_ctrl(ctrl)->teardown_lock);
21822175 }
21832176
21842177 static enum blk_eh_timer_return
@@ -2455,7 +2448,6 @@ static struct nvme_ctrl *nvme_tcp_create_ctrl(struct device *dev, · 270 unmodified lines
24552448 nvme_tcp_reconnect_ctrl_work);
24562449 INIT_WORK(&ctrl->err_work, nvme_tcp_error_recovery_work);
24572450 INIT_WORK(&ctrl->ctrl.reset_work, nvme_reset_ctrl_work);
2458− mutex_init(&ctrl->teardown_lock);
24592451
24602452 if (!(opts->mask & NVMF_OPT_TRSVCID)) {
24612453 opts->trsvcid =
drivers/of/device.c+1−1
@@ -112,7 +112,7 @@ int of_dma_configure_id(struct device *dev, struct device_node *np, · 111 unmodified lines
112112 u64 dma_end = 0;
113113
114114 /* Determine the overall bounds of all DMA regions */
115− for (dma_start = ~0ULL; r->size; r++) {
115+ for (dma_start = ~0; r->size; r++) {
116116 /* Take lower and upper limits */
117117 if (r->dma_start < dma_start)
118118 dma_start = r->dma_start;
drivers/opp/core.c+5−4
@@ -1181,6 +1181,10 @@ static void _opp_table_kref_release(struct kref *kref) · 1180 unmodified lines
11811181 struct opp_device *opp_dev, *temp;
11821182 int i;
11831183
1184+ /* Drop the lock as soon as we can */
1185+ list_del(&opp_table->node);
1186+ mutex_unlock(&opp_table_lock);
1187+
11841188 _of_clear_opp_table(opp_table);
11851189
11861190 /* Release clk */
@@ -1208,10 +1212,7 @@ static void _opp_table_kref_release(struct kref *kref) · 21 unmodified lines
12081212
12091213 mutex_destroy(&opp_table->genpd_virt_dev_lock);
12101214 mutex_destroy(&opp_table->lock);
1211− list_del(&opp_table->node);
12121215 kfree(opp_table);
1213−
1214− mutex_unlock(&opp_table_lock);
12151216 }
12161217
12171218 void dev_pm_opp_put_opp_table(struct opp_table *opp_table)
@@ -1930,7 +1931,7 @@ struct opp_table *dev_pm_opp_register_set_opp_helper(struct device *dev, · 712 unmodified lines
19301931 return ERR_PTR(-EINVAL);
19311932
19321933 opp_table = dev_pm_opp_get_opp_table(dev);
1933− if (!IS_ERR(opp_table))
1934+ if (IS_ERR(opp_table))
19341935 return opp_table;
19351936
19361937 /* This should be called before OPPs are initialized */
drivers/opp/of.c+2−0
@@ -944,6 +944,8 @@ static int _of_add_opp_table_v1(struct device *dev, struct opp_table *opp_table) · 943 unmodified lines
944944 nr -= 2;
945945 }
946946
947+ return 0;
948+
947949 remove_static_opp:
948950 _opp_remove_all_static(opp_table);
949951
drivers/pci/controller/dwc/pcie-designware-host.c+6−2
@@ -586,8 +586,12 @@ void dw_pcie_setup_rc(struct pcie_port *pp) · 585 unmodified lines
586586 * ATU, so we should not program the ATU here.
587587 */
588588 if (pp->bridge->child_ops == &dw_child_pcie_ops) {
589− struct resource_entry *entry =
590− resource_list_first_type(&pp->bridge->windows, IORESOURCE_MEM);
589+ struct resource_entry *tmp, *entry = NULL;
590+
591+ /* Get last memory resource entry */
592+ resource_list_for_each_entry(tmp, &pp->bridge->windows)
593+ if (resource_type(tmp->res) == IORESOURCE_MEM)
594+ entry = tmp;
591595
592596 dw_pcie_prog_outbound_atu(pci, PCIE_ATU_REGION_INDEX0,
593597 PCIE_ATU_TYPE_MEM, entry->res->start,
drivers/pci/controller/pci-mvebu.c+10−13
@@ -958,25 +958,16 @@ static void mvebu_pcie_powerdown(struct mvebu_pcie_port *port) · 957 unmodified lines
958958 }
959959
960960 /*
961− * We can't use devm_of_pci_get_host_bridge_resources() because we
962− * need to parse our special DT properties encoding the MEM and IO
963− * apertures.
961+ * devm_of_pci_get_host_bridge_resources() only sets up translateable resources,
962+ * so we need extra resource setup parsing our special DT properties encoding
963+ * the MEM and IO apertures.
964964 */
965965 static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie)
966966 {
967967 struct device *dev = &pcie->pdev->dev;
968− struct device_node *np = dev->of_node;
969968 struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie);
970969 int ret;
971970
972− /* Get the bus range */
973− ret = of_pci_parse_bus_range(np, &pcie->busn);
974− if (ret) {
975− dev_err(dev, "failed to parse bus-range property: %d\n", ret);
976− return ret;
977− }
978− pci_add_resource(&bridge->windows, &pcie->busn);
979−
980971 /* Get the PCIe memory aperture */
981972 mvebu_mbus_get_pcie_mem_aperture(&pcie->mem);
982973 if (resource_size(&pcie->mem) == 0) {
@@ -986,6 +977,9 @@ static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie) · 3 unmodified lines
986977
987978 pcie->mem.name = "PCI MEM";
988979 pci_add_resource(&bridge->windows, &pcie->mem);
980+ ret = devm_request_resource(dev, &iomem_resource, &pcie->mem);
981+ if (ret)
982+ return ret;
989983
990984 /* Get the PCIe IO aperture */
991985 mvebu_mbus_get_pcie_io_aperture(&pcie->io);
@@ -999,9 +993,12 @@ static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie) · 7 unmodified lines
999993 pcie->realio.name = "PCI I/O";
1000994
1001995 pci_add_resource(&bridge->windows, &pcie->realio);
996+ ret = devm_request_resource(dev, &ioport_resource, &pcie->realio);
997+ if (ret)
998+ return ret;
1002999 }
10031000
1004− return devm_request_pci_bus_resources(dev, &bridge->windows);
1001+ return 0;
10051002 }
10061003
10071004 /*
drivers/pci/pci.c+7−2
@@ -3516,8 +3516,13 @@ void pci_acs_init(struct pci_dev *dev) · 3515 unmodified lines
35163516 {
35173517 dev->acs_cap = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ACS);
35183518
3519− if (dev->acs_cap)
3520− pci_enable_acs(dev);
3519+ /*
3520+ * Attempt to enable ACS regardless of capability because some Root
3521+ * Ports (e.g. those quirked with *_intel_pch_acs_*) do not have
3522+ * the standard ACS capability but still support ACS via those
3523+ * quirks.
3524+ */
3525+ pci_enable_acs(dev);
35213526 }
35223527
35233528 /**
drivers/powercap/intel_rapl_common.c+1−1
@@ -620,7 +620,7 @@ static u64 rapl_unit_xlate(struct rapl_domain *rd, enum unit_type type, · 619 unmodified lines
620620 case ARBITRARY_UNIT:
621621 default:
622622 return value;
623− };
623+ }
624624
625625 if (to_raw)
626626 return div64_u64(value, units) * scale;
drivers/regulator/core.c+2−0
@@ -4165,6 +4165,8 @@ int regulator_get_voltage_rdev(struct regulator_dev *rdev) · 4164 unmodified lines
41654165 ret = rdev->desc->fixed_uV;
41664166 } else if (rdev->supply) {
41674167 ret = regulator_get_voltage_rdev(rdev->supply->rdev);
4168+ } else if (rdev->supply_name) {
4169+ return -EPROBE_DEFER;
41684170 } else {
41694171 return -EINVAL;
41704172 }
drivers/s390/crypto/ap_bus.c+12−2
@@ -680,7 +680,10 @@ static int ap_device_probe(struct device *dev) · 679 unmodified lines
680680 {
681681 struct ap_device *ap_dev = to_ap_dev(dev);
682682 struct ap_driver *ap_drv = to_ap_drv(dev->driver);
683− int card, queue, devres, drvres, rc;
683+ int card, queue, devres, drvres, rc = -ENODEV;
684+
685+ if (!get_device(dev))
686+ return rc;
684687
685688 if (is_queue_dev(dev)) {
686689 /*
@@ -697,7 +700,7 @@ static int ap_device_probe(struct device *dev) · 10 unmodified lines
697700 mutex_unlock(&ap_perms_mutex);
698701 drvres = ap_drv->flags & AP_DRIVER_FLAG_DEFAULT;
699702 if (!!devres != !!drvres)
700− return -ENODEV;
703+ goto out;
701704 }
702705
703706 /* Add queue/card to list of active queues/cards */
@@ -718,6 +721,9 @@ static int ap_device_probe(struct device *dev) · 14 unmodified lines
718721 ap_dev->drv = NULL;
719722 }
720723
724+out:
725+ if (rc)
726+ put_device(dev);
721727 return rc;
722728 }
723729
@@ -744,6 +750,8 @@ static int ap_device_remove(struct device *dev) · 20 unmodified lines
744750 hash_del(&to_ap_queue(dev)->hnode);
745751 spin_unlock_bh(&ap_queues_lock);
746752
753+ put_device(dev);
754+
747755 return 0;
748756 }
749757
@@ -1371,6 +1379,8 @@ static inline void ap_scan_domains(struct ap_card *ac) · 621 unmodified lines
13711379 __func__, ac->id, dom);
13721380 goto put_dev_and_continue;
13731381 }
1382+ /* get it and thus adjust reference counter */
1383+ get_device(dev);
13741384 if (decfg)
13751385 AP_DBF_INFO("%s(%d,%d) new (decfg) queue device created\n",
13761386 __func__, ac->id, dom);
drivers/s390/crypto/pkey_api.c+16−14
@@ -35,9 +35,6 @@ MODULE_DESCRIPTION("s390 protected key interface"); · 34 unmodified lines
3535 #define PROTKEYBLOBBUFSIZE 256 /* protected key buffer size used internal */
3636 #define MAXAPQNSINLIST 64 /* max 64 apqns within a apqn list */
3737
38−/* mask of available pckmo subfunctions, fetched once at module init */
39−static cpacf_mask_t pckmo_functions;
40−
4138 /*
4239 * debug feature data and functions
4340 */
@@ -91,6 +88,9 @@ static int pkey_clr2protkey(u32 keytype, · 47 unmodified lines
9188 const struct pkey_clrkey *clrkey,
9289 struct pkey_protkey *protkey)
9390 {
91+ /* mask of available pckmo subfunctions */
92+ static cpacf_mask_t pckmo_functions;
93+
9494 long fc;
9595 int keysize;
9696 u8 paramblock[64];
@@ -114,11 +114,13 @@ static int pkey_clr2protkey(u32 keytype, · 17 unmodified lines
114114 return -EINVAL;
115115 }
116116
117− /*
118− * Check if the needed pckmo subfunction is available.
119− * These subfunctions can be enabled/disabled by customers
120− * in the LPAR profile or may even change on the fly.
121− */
117+ /* Did we already check for PCKMO ? */
118+ if (!pckmo_functions.bytes[0]) {
119+ /* no, so check now */
120+ if (!cpacf_query(CPACF_PCKMO, &pckmo_functions))
121+ return -ENODEV;
122+ }
123+ /* check for the pckmo subfunction we need now */
122124 if (!cpacf_test_func(&pckmo_functions, fc)) {
123125 DEBUG_ERR("%s pckmo functions not available\n", __func__);
124126 return -ENODEV;
@@ -2058,7 +2060,7 @@ static struct miscdevice pkey_dev = { · 1933 unmodified lines
20582060 */
20592061 static int __init pkey_init(void)
20602062 {
2061− cpacf_mask_t kmc_functions;
2063+ cpacf_mask_t func_mask;
20622064
20632065 /*
20642066 * The pckmo instruction should be available - even if we don't
@@ -2066,15 +2068,15 @@ static int __init pkey_init(void) · 1 unmodified line
20662068 * is also the minimum level for the kmc instructions which
20672069 * are able to work with protected keys.
20682070 */
2069− if (!cpacf_query(CPACF_PCKMO, &pckmo_functions))
2071+ if (!cpacf_query(CPACF_PCKMO, &func_mask))
20702072 return -ENODEV;
20712073
20722074 /* check for kmc instructions available */
2073− if (!cpacf_query(CPACF_KMC, &kmc_functions))
2075+ if (!cpacf_query(CPACF_KMC, &func_mask))
20742076 return -ENODEV;
2075− if (!cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_128) ||
2076− !cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_192) ||
2077− !cpacf_test_func(&kmc_functions, CPACF_KMC_PAES_256))
2077+ if (!cpacf_test_func(&func_mask, CPACF_KMC_PAES_128) ||
2078+ !cpacf_test_func(&func_mask, CPACF_KMC_PAES_192) ||
2079+ !cpacf_test_func(&func_mask, CPACF_KMC_PAES_256))
20782080 return -ENODEV;
20792081
20802082 pkey_debug_init();
drivers/s390/crypto/zcrypt_card.c+8−5
@@ -157,11 +157,6 @@ int zcrypt_card_register(struct zcrypt_card *zc) · 156 unmodified lines
157157 {
158158 int rc;
159159
160− rc = sysfs_create_group(&zc->card->ap_dev.device.kobj,
161− &zcrypt_card_attr_group);
162− if (rc)
163− return rc;
164−
165160 spin_lock(&zcrypt_list_lock);
166161 list_add_tail(&zc->list, &zcrypt_card_list);
167162 spin_unlock(&zcrypt_list_lock);
@@ -170,6 +165,14 @@ int zcrypt_card_register(struct zcrypt_card *zc) · 2 unmodified lines
170165
171166 ZCRYPT_DBF(DBF_INFO, "card=%02x register online=1\n", zc->card->id);
172167
168+ rc = sysfs_create_group(&zc->card->ap_dev.device.kobj,
169+ &zcrypt_card_attr_group);
170+ if (rc) {
171+ spin_lock(&zcrypt_list_lock);
172+ list_del_init(&zc->list);
173+ spin_unlock(&zcrypt_list_lock);
174+ }
175+
173176 return rc;
174177 }
175178 EXPORT_SYMBOL(zcrypt_card_register);
drivers/s390/crypto/zcrypt_queue.c+1−5
@@ -180,7 +180,6 @@ int zcrypt_queue_register(struct zcrypt_queue *zq) · 179 unmodified lines
180180 &zcrypt_queue_attr_group);
181181 if (rc)
182182 goto out;
183− get_device(&zq->queue->ap_dev.device);
184183
185184 if (zq->ops->rng) {
186185 rc = zcrypt_rng_device_add();
@@ -192,7 +191,6 @@ int zcrypt_queue_register(struct zcrypt_queue *zq) · 5 unmodified lines
192191 out_unregister:
193192 sysfs_remove_group(&zq->queue->ap_dev.device.kobj,
194193 &zcrypt_queue_attr_group);
195− put_device(&zq->queue->ap_dev.device);
196194 out:
197195 spin_lock(&zcrypt_list_lock);
198196 list_del_init(&zq->list);
@@ -220,12 +218,10 @@ void zcrypt_queue_unregister(struct zcrypt_queue *zq) · 21 unmodified lines
220218 list_del_init(&zq->list);
221219 zcrypt_device_count--;
222220 spin_unlock(&zcrypt_list_lock);
223− zcrypt_card_put(zc);
224221 if (zq->ops->rng)
225222 zcrypt_rng_device_remove();
226223 sysfs_remove_group(&zq->queue->ap_dev.device.kobj,
227224 &zcrypt_queue_attr_group);
228− put_device(&zq->queue->ap_dev.device);
229− zcrypt_queue_put(zq);
225+ zcrypt_card_put(zc);
230226 }
231227 EXPORT_SYMBOL(zcrypt_queue_unregister);
drivers/scsi/device_handler/scsi_dh_alua.c+5−4
@@ -658,8 +658,8 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg) · 657 unmodified lines
658658 rcu_read_lock();
659659 list_for_each_entry_rcu(h,
660660 &tmp_pg->dh_list, node) {
661− /* h->sdev should always be valid */
662− BUG_ON(!h->sdev);
661+ if (!h->sdev)
662+ continue;
663663 h->sdev->access_state = desc[0];
664664 }
665665 rcu_read_unlock();
@@ -705,7 +705,8 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg) · 39 unmodified lines
705705 pg->expiry = 0;
706706 rcu_read_lock();
707707 list_for_each_entry_rcu(h, &pg->dh_list, node) {
708− BUG_ON(!h->sdev);
708+ if (!h->sdev)
709+ continue;
709710 h->sdev->access_state =
710711 (pg->state & SCSI_ACCESS_STATE_MASK);
711712 if (pg->pref)
@@ -1147,7 +1148,6 @@ static void alua_bus_detach(struct scsi_device *sdev) · 435 unmodified lines
11471148 spin_lock(&h->pg_lock);
11481149 pg = rcu_dereference_protected(h->pg, lockdep_is_held(&h->pg_lock));
11491150 rcu_assign_pointer(h->pg, NULL);
1150− h->sdev = NULL;
11511151 spin_unlock(&h->pg_lock);
11521152 if (pg) {
11531153 spin_lock_irq(&pg->lock);
@@ -1156,6 +1156,7 @@ static void alua_bus_detach(struct scsi_device *sdev) · 2 unmodified lines
11561156 kref_put(&pg->kref, release_port_group);
11571157 }
11581158 sdev->handler_data = NULL;
1159+ synchronize_rcu();
11591160 kfree(h);
11601161 }
11611162
drivers/scsi/hpsa.c+3−1
@@ -8855,7 +8855,7 @@ reinit_after_soft_reset: · 8854 unmodified lines
88558855 /* hook into SCSI subsystem */
88568856 rc = hpsa_scsi_add_host(h);
88578857 if (rc)
8858− goto clean7; /* perf, sg, cmd, irq, shost, pci, lu, aer/h */
8858+ goto clean8; /* lastlogicals, perf, sg, cmd, irq, shost, pci, lu, aer/h */
88598859
88608860 /* Monitor the controller for firmware lockups */
88618861 h->heartbeat_sample_interval = HEARTBEAT_SAMPLE_INTERVAL;
@@ -8870,6 +8870,8 @@ reinit_after_soft_reset: · 8 unmodified lines
88708870 HPSA_EVENT_MONITOR_INTERVAL);
88718871 return 0;
88728872
8873+clean8: /* lastlogicals, perf, sg, cmd, irq, shost, pci, lu, aer/h */
8874+ kfree(h->lastlogicals);
88738875 clean7: /* perf, sg, cmd, irq, shost, pci, lu, aer/h */
88748876 hpsa_free_performant_mode(h);
88758877 h->access.set_intr_mask(h, HPSA_INTR_OFF);
drivers/scsi/mpt3sas/mpt3sas_base.c+7−0
@@ -1740,6 +1740,13 @@ _base_irqpoll(struct irq_poll *irqpoll, int budget) · 1739 unmodified lines
17401740 reply_q->irq_poll_scheduled = false;
17411741 reply_q->irq_line_enable = true;
17421742 enable_irq(reply_q->os_irq);
1743+ /*
1744+ * Go for one more round of processing the
1745+ * reply descriptor post queue incase if HBA
1746+ * Firmware has posted some reply descriptors
1747+ * while reenabling the IRQ.
1748+ */
1749+ _base_process_reply_queue(reply_q);
17431750 }
17441751
17451752 return num_entries;
drivers/spi/spi-bcm2835.c+1−14
@@ -1193,7 +1193,6 @@ static int bcm2835_spi_setup(struct spi_device *spi) · 1192 unmodified lines
11931193 struct spi_controller *ctlr = spi->controller;
11941194 struct bcm2835_spi *bs = spi_controller_get_devdata(ctlr);
11951195 struct gpio_chip *chip;
1196− enum gpio_lookup_flags lflags;
11971196 u32 cs;
11981197
11991198 /*
@@ -1259,21 +1258,9 @@ static int bcm2835_spi_setup(struct spi_device *spi) · 59 unmodified lines
12591258 if (!chip)
12601259 return 0;
12611260
1262− /*
1263− * Retrieve the corresponding GPIO line used for CS.
1264− * The inversion semantics will be handled by the GPIO core
1265− * code, so we pass GPIOD_OUT_LOW for "unasserted" and
1266− * the correct flag for inversion semantics. The SPI_CS_HIGH
1267− * on spi->mode cannot be checked for polarity in this case
1268− * as the flag use_gpio_descriptors enforces SPI_CS_HIGH.
1269− */
1270− if (of_property_read_bool(spi->dev.of_node, "spi-cs-high"))
1271− lflags = GPIO_ACTIVE_HIGH;
1272− else
1273− lflags = GPIO_ACTIVE_LOW;
12741261 spi->cs_gpiod = gpiochip_request_own_desc(chip, 8 - spi->chip_select,
12751262 DRV_NAME,
1276− lflags,
1263+ GPIO_LOOKUP_FLAGS_DEFAULT,
12771264 GPIOD_OUT_LOW);
12781265 if (IS_ERR(spi->cs_gpiod))
12791266 return PTR_ERR(spi->cs_gpiod);
drivers/spi/spi-fsl-dspi.c+4−6
@@ -1080,12 +1080,11 @@ MODULE_DEVICE_TABLE(of, fsl_dspi_dt_ids); · 1079 unmodified lines
10801080 #ifdef CONFIG_PM_SLEEP
10811081 static int dspi_suspend(struct device *dev)
10821082 {
1083− struct spi_controller *ctlr = dev_get_drvdata(dev);
1084− struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr);
1083+ struct fsl_dspi *dspi = dev_get_drvdata(dev);
10851084
10861085 if (dspi->irq)
10871086 disable_irq(dspi->irq);
1088− spi_controller_suspend(ctlr);
1087+ spi_controller_suspend(dspi->ctlr);
10891088 clk_disable_unprepare(dspi->clk);
10901089
10911090 pinctrl_pm_select_sleep_state(dev);
@@ -1095,8 +1094,7 @@ static int dspi_suspend(struct device *dev) · 3 unmodified lines
10951094
10961095 static int dspi_resume(struct device *dev)
10971096 {
1098− struct spi_controller *ctlr = dev_get_drvdata(dev);
1099− struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr);
1097+ struct fsl_dspi *dspi = dev_get_drvdata(dev);
11001098 int ret;
11011099
11021100 pinctrl_pm_select_default_state(dev);
@@ -1104,7 +1102,7 @@ static int dspi_resume(struct device *dev) · 1 unmodified line
11041102 ret = clk_prepare_enable(dspi->clk);
11051103 if (ret)
11061104 return ret;
1107− spi_controller_resume(ctlr);
1105+ spi_controller_resume(dspi->ctlr);
11081106 if (dspi->irq)
11091107 enable_irq(dspi->irq);
11101108
drivers/spi/spi-imx.c+15−8
@@ -1676,15 +1676,18 @@ static int spi_imx_probe(struct platform_device *pdev) · 1675 unmodified lines
16761676 goto out_master_put;
16771677 }
16781678
1679− pm_runtime_enable(spi_imx->dev);
1679+ ret = clk_prepare_enable(spi_imx->clk_per);
1680+ if (ret)
1681+ goto out_master_put;
1682+
1683+ ret = clk_prepare_enable(spi_imx->clk_ipg);
1684+ if (ret)
1685+ goto out_put_per;
1686+
16801687 pm_runtime_set_autosuspend_delay(spi_imx->dev, MXC_RPM_TIMEOUT);
16811688 pm_runtime_use_autosuspend(spi_imx->dev);
1682−
1683− ret = pm_runtime_get_sync(spi_imx->dev);
1684− if (ret < 0) {
1685− dev_err(spi_imx->dev, "failed to enable clock\n");
1686− goto out_runtime_pm_put;
1687− }
1689+ pm_runtime_set_active(spi_imx->dev);
1690+ pm_runtime_enable(spi_imx->dev);
16881691
16891692 spi_imx->spi_clk = clk_get_rate(spi_imx->clk_per);
16901693 /*
@@ -1722,8 +1725,12 @@ out_bitbang_start: · 31 unmodified lines
17221725 spi_imx_sdma_exit(spi_imx);
17231726 out_runtime_pm_put:
17241727 pm_runtime_dont_use_autosuspend(spi_imx->dev);
1725− pm_runtime_put_sync(spi_imx->dev);
1728+ pm_runtime_set_suspended(&pdev->dev);
17261729 pm_runtime_disable(spi_imx->dev);
1730+
1731+ clk_disable_unprepare(spi_imx->clk_ipg);
1732+out_put_per:
1733+ clk_disable_unprepare(spi_imx->clk_per);
17271734 out_master_put:
17281735 spi_master_put(master);
17291736
drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml+1−1
@@ -24,7 +24,7 @@ description: · 23 unmodified lines
2424 In addition, it is recommended to declare a mmc-pwrseq on SDIO host above
2525 WFx. Without it, you may encounter issues with warm boot. The mmc-pwrseq
2626 should be compatible with mmc-pwrseq-simple. Please consult
27− Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt for more
27+ Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.yaml for more
2828 information.
2929
3030 For SPI':'
drivers/tty/serial/8250/8250_mtk.c+1−1
@@ -317,7 +317,7 @@ mtk8250_set_termios(struct uart_port *port, struct ktermios *termios, · 316 unmodified lines
317317 */
318318 baud = tty_termios_baud_rate(termios);
319319
320− serial8250_do_set_termios(port, termios, old);
320+ serial8250_do_set_termios(port, termios, NULL);
321321
322322 tty_termios_encode_baud_rate(termios, baud, baud);
323323
drivers/tty/serial/Kconfig+1−0
@@ -522,6 +522,7 @@ config SERIAL_IMX_EARLYCON · 521 unmodified lines
522522 depends on OF
523523 select SERIAL_EARLYCON
524524 select SERIAL_CORE_CONSOLE
525+ default y if SERIAL_IMX_CONSOLE
525526 help
526527 If you have enabled the earlycon on the Freescale IMX
527528 CPU you can make it the earlycon by answering Y to this option.
drivers/tty/serial/serial_txx9.c+3−0
@@ -1280,6 +1280,9 @@ static int __init serial_txx9_init(void) · 1279 unmodified lines
12801280
12811281 #ifdef ENABLE_SERIAL_TXX9_PCI
12821282 ret = pci_register_driver(&serial_txx9_pci_driver);
1283+ if (ret) {
1284+ platform_driver_unregister(&serial_txx9_plat_driver);
1285+ }
12831286 #endif
12841287 if (ret == 0)
12851288 goto out;
drivers/tty/tty_io.c+4−2
@@ -1515,10 +1515,12 @@ static void release_tty(struct tty_struct *tty, int idx) · 1514 unmodified lines
15151515 tty->ops->shutdown(tty);
15161516 tty_save_termios(tty);
15171517 tty_driver_remove_tty(tty->driver, tty);
1518− tty->port->itty = NULL;
1518+ if (tty->port)
1519+ tty->port->itty = NULL;
15191520 if (tty->link)
15201521 tty->link->port->itty = NULL;
1521− tty_buffer_cancel_work(tty->port);
1522+ if (tty->port)
1523+ tty_buffer_cancel_work(tty->port);
15221524 if (tty->link)
15231525 tty_buffer_cancel_work(tty->link->port);
15241526
drivers/tty/vt/vt.c+2−22
@@ -4704,27 +4704,6 @@ static int con_font_default(struct vc_data *vc, struct console_font_op *op) · 4703 unmodified lines
47044704 return rc;
47054705 }
47064706
4707−static int con_font_copy(struct vc_data *vc, struct console_font_op *op)
4708−{
4709− int con = op->height;
4710− int rc;
4711−
4712−
4713− console_lock();
4714− if (vc->vc_mode != KD_TEXT)
4715− rc = -EINVAL;
4716− else if (!vc->vc_sw->con_font_copy)
4717− rc = -ENOSYS;
4718− else if (con < 0 || !vc_cons_allocated(con))
4719− rc = -ENOTTY;
4720− else if (con == vc->vc_num) /* nothing to do */
4721− rc = 0;
4722− else
4723− rc = vc->vc_sw->con_font_copy(vc, con);
4724− console_unlock();
4725− return rc;
4726−}
4727−
47284707 int con_font_op(struct vc_data *vc, struct console_font_op *op)
47294708 {
47304709 switch (op->op) {
@@ -4735,7 +4714,8 @@ int con_font_op(struct vc_data *vc, struct console_font_op *op) · 4 unmodified lines
47354714 case KD_FONT_OP_SET_DEFAULT:
47364715 return con_font_default(vc, op);
47374716 case KD_FONT_OP_COPY:
4738− return con_font_copy(vc, op);
4717+ /* was buggy and never really used */
4718+ return -EINVAL;
47394719 }
47404720 return -ENOSYS;
47414721 }
drivers/tty/vt/vt_ioctl.c+19−17
@@ -484,7 +484,7 @@ static int vt_k_ioctl(struct tty_struct *tty, unsigned int cmd, · 483 unmodified lines
484484 return 0;
485485 }
486486
487−static inline int do_fontx_ioctl(int cmd,
487+static inline int do_fontx_ioctl(struct vc_data *vc, int cmd,
488488 struct consolefontdesc __user *user_cfd,
489489 struct console_font_op *op)
490490 {
@@ -502,15 +502,16 @@ static inline int do_fontx_ioctl(int cmd, · 11 unmodified lines
502502 op->height = cfdarg.charheight;
503503 op->charcount = cfdarg.charcount;
504504 op->data = cfdarg.chardata;
505− return con_font_op(vc_cons[fg_console].d, op);
506− case GIO_FONTX: {
505+ return con_font_op(vc, op);
506+
507+ case GIO_FONTX:
507508 op->op = KD_FONT_OP_GET;
508509 op->flags = KD_FONT_FLAG_OLD;
509510 op->width = 8;
510511 op->height = cfdarg.charheight;
511512 op->charcount = cfdarg.charcount;
512513 op->data = cfdarg.chardata;
513− i = con_font_op(vc_cons[fg_console].d, op);
514+ i = con_font_op(vc, op);
514515 if (i)
515516 return i;
516517 cfdarg.charheight = op->height;
@@ -518,12 +519,11 @@ static inline int do_fontx_ioctl(int cmd, · 1 unmodified line
518519 if (copy_to_user(user_cfd, &cfdarg, sizeof(struct consolefontdesc)))
519520 return -EFAULT;
520521 return 0;
521− }
522522 }
523523 return -EINVAL;
524524 }
525525
526−static int vt_io_fontreset(struct console_font_op *op)
526+static int vt_io_fontreset(struct vc_data *vc, struct console_font_op *op)
527527 {
528528 int ret;
529529
@@ -537,12 +537,12 @@ static int vt_io_fontreset(struct console_font_op *op) · 7 unmodified lines
537537
538538 op->op = KD_FONT_OP_SET_DEFAULT;
539539 op->data = NULL;
540− ret = con_font_op(vc_cons[fg_console].d, op);
540+ ret = con_font_op(vc, op);
541541 if (ret)
542542 return ret;
543543
544544 console_lock();
545− con_set_default_unimap(vc_cons[fg_console].d);
545+ con_set_default_unimap(vc);
546546 console_unlock();
547547
548548 return 0;
@@ -584,7 +584,7 @@ static int vt_io_ioctl(struct vc_data *vc, unsigned int cmd, void __user *up, · 35 unmodified lines
584584 op.height = 0;
585585 op.charcount = 256;
586586 op.data = up;
587− return con_font_op(vc_cons[fg_console].d, &op);
587+ return con_font_op(vc, &op);
588588
589589 case GIO_FONT:
590590 op.op = KD_FONT_OP_GET;
@@ -593,7 +593,7 @@ static int vt_io_ioctl(struct vc_data *vc, unsigned int cmd, void __user *up, · 2 unmodified lines
593593 op.height = 32;
594594 op.charcount = 256;
595595 op.data = up;
596− return con_font_op(vc_cons[fg_console].d, &op);
596+ return con_font_op(vc, &op);
597597
598598 case PIO_CMAP:
599599 if (!perm)
@@ -609,13 +609,13 @@ static int vt_io_ioctl(struct vc_data *vc, unsigned int cmd, void __user *up, · 9 unmodified lines
609609
610610 fallthrough;
611611 case GIO_FONTX:
612− return do_fontx_ioctl(cmd, up, &op);
612+ return do_fontx_ioctl(vc, cmd, up, &op);
613613
614614 case PIO_FONTRESET:
615615 if (!perm)
616616 return -EPERM;
617617
618− return vt_io_fontreset(&op);
618+ return vt_io_fontreset(vc, &op);
619619
620620 case PIO_SCRNMAP:
621621 if (!perm)
@@ -1066,8 +1066,9 @@ struct compat_consolefontdesc { · 444 unmodified lines
10661066 };
10671067
10681068 static inline int
1069−compat_fontx_ioctl(int cmd, struct compat_consolefontdesc __user *user_cfd,
1070− int perm, struct console_font_op *op)
1069+compat_fontx_ioctl(struct vc_data *vc, int cmd,
1070+ struct compat_consolefontdesc __user *user_cfd,
1071+ int perm, struct console_font_op *op)
10711072 {
10721073 struct compat_consolefontdesc cfdarg;
10731074 int i;
@@ -1085,7 +1086,8 @@ compat_fontx_ioctl(int cmd, struct compat_consolefontdesc __user *user_cfd, · 11 unmodified lines
10851086 op->height = cfdarg.charheight;
10861087 op->charcount = cfdarg.charcount;
10871088 op->data = compat_ptr(cfdarg.chardata);
1088− return con_font_op(vc_cons[fg_console].d, op);
1089+ return con_font_op(vc, op);
1090+
10891091 case GIO_FONTX:
10901092 op->op = KD_FONT_OP_GET;
10911093 op->flags = KD_FONT_FLAG_OLD;
@@ -1093,7 +1095,7 @@ compat_fontx_ioctl(int cmd, struct compat_consolefontdesc __user *user_cfd, · 1 unmodified line
10931095 op->height = cfdarg.charheight;
10941096 op->charcount = cfdarg.charcount;
10951097 op->data = compat_ptr(cfdarg.chardata);
1096− i = con_font_op(vc_cons[fg_console].d, op);
1098+ i = con_font_op(vc, op);
10971099 if (i)
10981100 return i;
10991101 cfdarg.charheight = op->height;
@@ -1183,7 +1185,7 @@ long vt_compat_ioctl(struct tty_struct *tty, · 83 unmodified lines
11831185 */
11841186 case PIO_FONTX:
11851187 case GIO_FONTX:
1186− return compat_fontx_ioctl(cmd, up, perm, &op);
1188+ return compat_fontx_ioctl(vc, cmd, up, perm, &op);
11871189
11881190 case KDFONTOP:
11891191 return compat_kdfontop_ioctl(up, perm, &op, vc);
drivers/usb/core/quirks.c+3−0
@@ -378,6 +378,9 @@ static const struct usb_device_id usb_quirk_list[] = { · 377 unmodified lines
378378 { USB_DEVICE(0x0926, 0x3333), .driver_info =
379379 USB_QUIRK_CONFIG_INTF_STRINGS },
380380
381+ /* Kingston DataTraveler 3.0 */
382+ { USB_DEVICE(0x0951, 0x1666), .driver_info = USB_QUIRK_NO_LPM },
383+
381384 /* X-Rite/Gretag-Macbeth Eye-One Pro display colorimeter */
382385 { USB_DEVICE(0x0971, 0x2000), .driver_info = USB_QUIRK_NO_SET_INTF },
383386
drivers/usb/dwc2/platform.c+3−0
@@ -608,10 +608,13 @@ static int dwc2_driver_probe(struct platform_device *dev) · 607 unmodified lines
608608 #endif /* CONFIG_USB_DWC2_PERIPHERAL || CONFIG_USB_DWC2_DUAL_ROLE */
609609 return 0;
610610
611+#if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || \
612+ IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)
611613 error_debugfs:
612614 dwc2_debugfs_exit(hsotg);
613615 if (hsotg->hcd_enabled)
614616 dwc2_hcd_remove(hsotg);
617+#endif
615618 error_drd:
616619 dwc2_drd_exit(hsotg);
617620
drivers/usb/dwc3/dwc3-pci.c+4−0
@@ -40,6 +40,7 @@ · 39 unmodified lines
4040 #define PCI_DEVICE_ID_INTEL_TGPLP 0xa0ee
4141 #define PCI_DEVICE_ID_INTEL_TGPH 0x43ee
4242 #define PCI_DEVICE_ID_INTEL_JSP 0x4dee
43+#define PCI_DEVICE_ID_INTEL_ADLS 0x7ae1
4344
4445 #define PCI_INTEL_BXT_DSM_GUID "732b85d5-b7a7-4a1b-9ba0-4bbd00ffd511"
4546 #define PCI_INTEL_BXT_FUNC_PMU_PWR 4
@@ -367,6 +368,9 @@ static const struct pci_device_id dwc3_pci_id_table[] = { · 321 unmodified lines
367368 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_JSP),
368369 (kernel_ulong_t) &dwc3_pci_intel_properties, },
369370
371+ { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ADLS),
372+ (kernel_ulong_t) &dwc3_pci_intel_properties, },
373+
370374 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_NL_USB),
371375 (kernel_ulong_t) &dwc3_pci_amd_properties, },
372376 { } /* Terminating Entry */
drivers/usb/dwc3/ep0.c+2−1
@@ -1058,10 +1058,11 @@ void dwc3_ep0_send_delayed_status(struct dwc3 *dwc) · 1057 unmodified lines
10581058 {
10591059 unsigned int direction = !dwc->ep0_expect_in;
10601060
1061+ dwc->delayed_status = false;
1062+
10611063 if (dwc->ep0state != EP0_STATUS_PHASE)
10621064 return;
10631065
1064− dwc->delayed_status = false;
10651066 __dwc3_ep0_do_control_status(dwc, dwc->eps[direction]);
10661067 }
10671068
drivers/usb/gadget/legacy/raw_gadget.c+4−1
@@ -564,9 +564,12 @@ static int raw_ioctl_event_fetch(struct raw_dev *dev, unsigned long value) · 563 unmodified lines
564564 return -ENODEV;
565565 }
566566 length = min(arg.length, event->length);
567− if (copy_to_user((void __user *)value, event, sizeof(*event) + length))
567+ if (copy_to_user((void __user *)value, event, sizeof(*event) + length)) {
568+ kfree(event);
568569 return -EFAULT;
570+ }
569571
572+ kfree(event);
570573 return 0;
571574 }
572575
drivers/usb/gadget/udc/fsl_udc_core.c+1−1
@@ -1051,7 +1051,7 @@ static int fsl_ep_fifo_status(struct usb_ep *_ep) · 1050 unmodified lines
10511051 u32 bitmask;
10521052 struct ep_queue_head *qh;
10531053
1054− if (!_ep || _ep->desc || !(_ep->desc->bEndpointAddress&0xF))
1054+ if (!_ep || !_ep->desc || !(_ep->desc->bEndpointAddress&0xF))
10551055 return -ENODEV;
10561056
10571057 ep = container_of(_ep, struct fsl_ep, ep);
drivers/usb/gadget/udc/goku_udc.c+1−1
@@ -1760,6 +1760,7 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 1759 unmodified lines
17601760 goto err;
17611761 }
17621762
1763+ pci_set_drvdata(pdev, dev);
17631764 spin_lock_init(&dev->lock);
17641765 dev->pdev = pdev;
17651766 dev->gadget.ops = &goku_ops;
@@ -1793,7 +1794,6 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 27 unmodified lines
17931794 }
17941795 dev->regs = (struct goku_udc_regs __iomem *) base;
17951796
1796− pci_set_drvdata(pdev, dev);
17971797 INFO(dev, "%s\n", driver_desc);
17981798 INFO(dev, "version: " DRIVER_VERSION " %s\n", dmastr());
17991799 INFO(dev, "irq %d, pci mem %p\n", pdev->irq, base);
drivers/usb/misc/apple-mfi-fastcharge.c+3−1
@@ -120,8 +120,10 @@ static int apple_mfi_fc_set_property(struct power_supply *psy, · 119 unmodified lines
120120 dev_dbg(&mfi->udev->dev, "prop: %d\n", psp);
121121
122122 ret = pm_runtime_get_sync(&mfi->udev->dev);
123− if (ret < 0)
123+ if (ret < 0) {
124+ pm_runtime_put_noidle(&mfi->udev->dev);
124125 return ret;
126+ }
125127
126128 switch (psp) {
127129 case POWER_SUPPLY_PROP_CHARGE_TYPE:
drivers/usb/mtu3/mtu3_gadget.c+1−0
@@ -564,6 +564,7 @@ static int mtu3_gadget_stop(struct usb_gadget *g) · 563 unmodified lines
564564
565565 spin_unlock_irqrestore(&mtu->lock, flags);
566566
567+ synchronize_irq(mtu->irq);
567568 return 0;
568569 }
569570
drivers/usb/serial/cyberjack.c+6−1
@@ -357,11 +357,12 @@ static void cyberjack_write_bulk_callback(struct urb *urb) · 356 unmodified lines
357357 struct device *dev = &port->dev;
358358 int status = urb->status;
359359 unsigned long flags;
360+ bool resubmitted = false;
360361
361− set_bit(0, &port->write_urbs_free);
362362 if (status) {
363363 dev_dbg(dev, "%s - nonzero write bulk status received: %d\n",
364364 __func__, status);
365+ set_bit(0, &port->write_urbs_free);
365366 return;
366367 }
367368
@@ -394,6 +395,8 @@ static void cyberjack_write_bulk_callback(struct urb *urb) · 26 unmodified lines
394395 goto exit;
395396 }
396397
398+ resubmitted = true;
399+
397400 dev_dbg(dev, "%s - priv->wrsent=%d\n", __func__, priv->wrsent);
398401 dev_dbg(dev, "%s - priv->wrfilled=%d\n", __func__, priv->wrfilled);
399402
@@ -410,6 +413,8 @@ static void cyberjack_write_bulk_callback(struct urb *urb) · 10 unmodified lines
410413
411414 exit:
412415 spin_unlock_irqrestore(&priv->lock, flags);
416+ if (!resubmitted)
417+ set_bit(0, &port->write_urbs_free);
413418 usb_serial_port_softint(port);
414419 }
415420
drivers/usb/serial/option.c+10−0
@@ -250,6 +250,7 @@ static void option_instat_callback(struct urb *urb); · 249 unmodified lines
250250 #define QUECTEL_PRODUCT_EP06 0x0306
251251 #define QUECTEL_PRODUCT_EM12 0x0512
252252 #define QUECTEL_PRODUCT_RM500Q 0x0800
253+#define QUECTEL_PRODUCT_EC200T 0x6026
253254
254255 #define CMOTECH_VENDOR_ID 0x16d8
255256 #define CMOTECH_PRODUCT_6001 0x6001
@@ -1117,6 +1118,7 @@ static const struct usb_device_id option_ids[] = { · 861 unmodified lines
11171118 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0, 0) },
11181119 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0xff, 0x10),
11191120 .driver_info = ZLP },
1121+ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200T, 0xff, 0, 0) },
11201122
11211123 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) },
11221124 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) },
@@ -1189,6 +1191,8 @@ static const struct usb_device_id option_ids[] = { · 66 unmodified lines
11891191 .driver_info = NCTRL(0) | RSVD(1) },
11901192 { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1054, 0xff), /* Telit FT980-KS */
11911193 .driver_info = NCTRL(2) | RSVD(3) },
1194+ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1055, 0xff), /* Telit FN980 (PCIe) */
1195+ .driver_info = NCTRL(0) | RSVD(1) },
11921196 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910),
11931197 .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) },
11941198 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM),
@@ -1201,6 +1205,8 @@ static const struct usb_device_id option_ids[] = { · 6 unmodified lines
12011205 .driver_info = NCTRL(0) },
12021206 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910),
12031207 .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
1208+ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1203, 0xff), /* Telit LE910Cx (RNDIS) */
1209+ .driver_info = NCTRL(2) | RSVD(3) },
12041210 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4),
12051211 .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) | RSVD(3) },
12061212 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920),
@@ -1215,6 +1221,10 @@ static const struct usb_device_id option_ids[] = { · 8 unmodified lines
12151221 { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1213, 0xff) },
12161222 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920A4_1214),
12171223 .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) | RSVD(3) },
1224+ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1230, 0xff), /* Telit LE910Cx (rmnet) */
1225+ .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
1226+ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1231, 0xff), /* Telit LE910Cx (RNDIS) */
1227+ .driver_info = NCTRL(2) | RSVD(3) },
12181228 { USB_DEVICE(TELIT_VENDOR_ID, 0x1260),
12191229 .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
12201230 { USB_DEVICE(TELIT_VENDOR_ID, 0x1261),
drivers/vfio/fsl-mc/vfio_fsl_mc.c+7−3
@@ -248,7 +248,9 @@ static long vfio_fsl_mc_ioctl(void *device_data, unsigned int cmd, · 247 unmodified lines
248248 info.size = vdev->regions[info.index].size;
249249 info.flags = vdev->regions[info.index].flags;
250250
251− return copy_to_user((void __user *)arg, &info, minsz);
251+ if (copy_to_user((void __user *)arg, &info, minsz))
252+ return -EFAULT;
253+ return 0;
252254 }
253255 case VFIO_DEVICE_GET_IRQ_INFO:
254256 {
@@ -267,7 +269,9 @@ static long vfio_fsl_mc_ioctl(void *device_data, unsigned int cmd, · 12 unmodified lines
267269 info.flags = VFIO_IRQ_INFO_EVENTFD;
268270 info.count = 1;
269271
270− return copy_to_user((void __user *)arg, &info, minsz);
272+ if (copy_to_user((void __user *)arg, &info, minsz))
273+ return -EFAULT;
274+ return 0;
271275 }
272276 case VFIO_DEVICE_SET_IRQS:
273277 {
@@ -468,7 +472,7 @@ static int vfio_fsl_mc_mmap(void *device_data, struct vm_area_struct *vma) · 194 unmodified lines
468472 {
469473 struct vfio_fsl_mc_device *vdev = device_data;
470474 struct fsl_mc_device *mc_dev = vdev->mc_dev;
471− int index;
475+ unsigned int index;
472476
473477 index = vma->vm_pgoff >> (VFIO_FSL_MC_OFFSET_SHIFT - PAGE_SHIFT);
474478
drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c+1−1
@@ -13,7 +13,7 @@ · 12 unmodified lines
1313 #include "linux/fsl/mc.h"
1414 #include "vfio_fsl_mc_private.h"
1515
16−int vfio_fsl_mc_irqs_allocate(struct vfio_fsl_mc_device *vdev)
16+static int vfio_fsl_mc_irqs_allocate(struct vfio_fsl_mc_device *vdev)
1717 {
1818 struct fsl_mc_device *mc_dev = vdev->mc_dev;
1919 struct vfio_fsl_mc_irq *mc_irq;
drivers/vfio/pci/vfio_pci.c+1−1
@@ -385,7 +385,7 @@ static int vfio_pci_enable(struct vfio_pci_device *vdev) · 384 unmodified lines
385385 pdev->vendor == PCI_VENDOR_ID_INTEL &&
386386 IS_ENABLED(CONFIG_VFIO_PCI_IGD)) {
387387 ret = vfio_pci_igd_init(vdev);
388− if (ret) {
388+ if (ret && ret != -ENODEV) {
389389 pci_warn(pdev, "Failed to setup Intel IGD regions\n");
390390 goto disable_exit;
391391 }
drivers/vfio/pci/vfio_pci_rdwr.c+35−8
@@ -356,34 +356,60 @@ ssize_t vfio_pci_vga_rw(struct vfio_pci_device *vdev, char __user *buf, · 355 unmodified lines
356356 return done;
357357 }
358358
359−static int vfio_pci_ioeventfd_handler(void *opaque, void *unused)
359+static void vfio_pci_ioeventfd_do_write(struct vfio_pci_ioeventfd *ioeventfd,
360+ bool test_mem)
360361 {
361− struct vfio_pci_ioeventfd *ioeventfd = opaque;
362−
363362 switch (ioeventfd->count) {
364363 case 1:
365− vfio_pci_iowrite8(ioeventfd->vdev, ioeventfd->test_mem,
364+ vfio_pci_iowrite8(ioeventfd->vdev, test_mem,
366365 ioeventfd->data, ioeventfd->addr);
367366 break;
368367 case 2:
369− vfio_pci_iowrite16(ioeventfd->vdev, ioeventfd->test_mem,
368+ vfio_pci_iowrite16(ioeventfd->vdev, test_mem,
370369 ioeventfd->data, ioeventfd->addr);
371370 break;
372371 case 4:
373− vfio_pci_iowrite32(ioeventfd->vdev, ioeventfd->test_mem,
372+ vfio_pci_iowrite32(ioeventfd->vdev, test_mem,
374373 ioeventfd->data, ioeventfd->addr);
375374 break;
376375 #ifdef iowrite64
377376 case 8:
378− vfio_pci_iowrite64(ioeventfd->vdev, ioeventfd->test_mem,
377+ vfio_pci_iowrite64(ioeventfd->vdev, test_mem,
379378 ioeventfd->data, ioeventfd->addr);
380379 break;
381380 #endif
382381 }
382+}
383+
384+static int vfio_pci_ioeventfd_handler(void *opaque, void *unused)
385+{
386+ struct vfio_pci_ioeventfd *ioeventfd = opaque;
387+ struct vfio_pci_device *vdev = ioeventfd->vdev;
388+
389+ if (ioeventfd->test_mem) {
390+ if (!down_read_trylock(&vdev->memory_lock))
391+ return 1; /* Lock contended, use thread */
392+ if (!__vfio_pci_memory_enabled(vdev)) {
393+ up_read(&vdev->memory_lock);
394+ return 0;
395+ }
396+ }
397+
398+ vfio_pci_ioeventfd_do_write(ioeventfd, false);
399+
400+ if (ioeventfd->test_mem)
401+ up_read(&vdev->memory_lock);
383402
384403 return 0;
385404 }
386405
406+static void vfio_pci_ioeventfd_thread(void *opaque, void *unused)
407+{
408+ struct vfio_pci_ioeventfd *ioeventfd = opaque;
409+
410+ vfio_pci_ioeventfd_do_write(ioeventfd, ioeventfd->test_mem);
411+}
412+
387413 long vfio_pci_ioeventfd(struct vfio_pci_device *vdev, loff_t offset,
388414 uint64_t data, int count, int fd)
389415 {
@@ -457,7 +483,8 @@ long vfio_pci_ioeventfd(struct vfio_pci_device *vdev, loff_t offset, · 67 unmodified lines
457483 ioeventfd->test_mem = vdev->pdev->resource[bar].flags & IORESOURCE_MEM;
458484
459485 ret = vfio_virqfd_enable(ioeventfd, vfio_pci_ioeventfd_handler,
460− NULL, NULL, &ioeventfd->virqfd, fd);
486+ vfio_pci_ioeventfd_thread, NULL,
487+ &ioeventfd->virqfd, fd);
461488 if (ret) {
462489 kfree(ioeventfd);
463490 goto out_unlock;
drivers/vfio/platform/vfio_platform_common.c+1−2
@@ -267,7 +267,7 @@ static int vfio_platform_open(void *device_data) · 266 unmodified lines
267267
268268 ret = pm_runtime_get_sync(vdev->device);
269269 if (ret < 0)
270− goto err_pm;
270+ goto err_rst;
271271
272272 ret = vfio_platform_call_reset(vdev, &extra_dbg);
273273 if (ret && vdev->reset_required) {
@@ -284,7 +284,6 @@ static int vfio_platform_open(void *device_data) · 10 unmodified lines
284284
285285 err_rst:
286286 pm_runtime_put(vdev->device);
287−err_pm:
288287 vfio_platform_irq_cleanup(vdev);
289288 err_irq:
290289 vfio_platform_regions_cleanup(vdev);
drivers/vfio/vfio_iommu_type1.c+5−12
@@ -1993,6 +1993,7 @@ static void vfio_iommu_iova_insert_copy(struct vfio_iommu *iommu, · 1992 unmodified lines
19931993
19941994 list_splice_tail(iova_copy, iova);
19951995 }
1996+
19961997 static int vfio_iommu_type1_attach_group(void *iommu_data,
19971998 struct iommu_group *iommu_group)
19981999 {
@@ -2009,18 +2010,10 @@ static int vfio_iommu_type1_attach_group(void *iommu_data, · 10 unmodified lines
20092010
20102011 mutex_lock(&iommu->lock);
20112012
2012− list_for_each_entry(d, &iommu->domain_list, next) {
2013− if (find_iommu_group(d, iommu_group)) {
2014− mutex_unlock(&iommu->lock);
2015− return -EINVAL;
2016− }
2017− }
2018−
2019− if (iommu->external_domain) {
2020− if (find_iommu_group(iommu->external_domain, iommu_group)) {
2021− mutex_unlock(&iommu->lock);
2022− return -EINVAL;
2023− }
2013+ /* Check for duplicates */
2014+ if (vfio_iommu_find_iommu_group(iommu, iommu_group)) {
2015+ mutex_unlock(&iommu->lock);
2016+ return -EINVAL;
20242017 }
20252018
20262019 group = kzalloc(sizeof(*group), GFP_KERNEL);
fs/afs/xattr.c+1−6
@@ -148,11 +148,6 @@ static const struct xattr_handler afs_xattr_afs_acl_handler = { · 147 unmodified lines
148148 .set = afs_xattr_set_acl,
149149 };
150150
151−static void yfs_acl_put(struct afs_operation *op)
152−{
153− yfs_free_opaque_acl(op->yacl);
154−}
155−
156151 static const struct afs_operation_ops yfs_fetch_opaque_acl_operation = {
157152 .issue_yfs_rpc = yfs_fs_fetch_opaque_acl,
158153 .success = afs_acl_success,
@@ -246,7 +241,7 @@ error: · 87 unmodified lines
246241 static const struct afs_operation_ops yfs_store_opaque_acl2_operation = {
247242 .issue_yfs_rpc = yfs_fs_store_opaque_acl2,
248243 .success = afs_acl_success,
249− .put = yfs_acl_put,
244+ .put = afs_acl_put,
250245 };
251246
252247 /*
fs/afs/yfsclient.c+1−0
@@ -1990,6 +1990,7 @@ void yfs_fs_store_opaque_acl2(struct afs_operation *op) · 1989 unmodified lines
19901990 memcpy(bp, acl->data, acl->size);
19911991 if (acl->size != size)
19921992 memset((void *)bp + acl->size, 0, size - acl->size);
1993+ bp += size / sizeof(__be32);
19931994 yfs_check_req(call, bp);
19941995
19951996 trace_afs_make_fs_call(call, &vp->fid);
fs/ceph/caps.c+1−1
@@ -4074,7 +4074,7 @@ void ceph_handle_caps(struct ceph_mds_session *session, · 4073 unmodified lines
40744074 vino.snap, inode);
40754075
40764076 mutex_lock(&session->s_mutex);
4077− session->s_seq++;
4077+ inc_session_sequence(session);
40784078 dout(" mds%d seq %lld cap seq %u\n", session->s_mds, session->s_seq,
40794079 (unsigned)seq);
40804080
fs/ceph/mds_client.c+35−15
@@ -4231,7 +4231,7 @@ static void handle_lease(struct ceph_mds_client *mdsc, · 4230 unmodified lines
42314231 dname.len, dname.name);
42324232
42334233 mutex_lock(&session->s_mutex);
4234− session->s_seq++;
4234+ inc_session_sequence(session);
42354235
42364236 if (!inode) {
42374237 dout("handle_lease no inode %llx\n", vino.ino);
@@ -4385,28 +4385,48 @@ static void maybe_recover_session(struct ceph_mds_client *mdsc) · 147 unmodified lines
43854385
43864386 bool check_session_state(struct ceph_mds_session *s)
43874387 {
4388− if (s->s_state == CEPH_MDS_SESSION_CLOSING) {
4389− dout("resending session close request for mds%d\n",
4390− s->s_mds);
4391− request_close_session(s);
4392− return false;
4393− }
4394− if (s->s_ttl && time_after(jiffies, s->s_ttl)) {
4395− if (s->s_state == CEPH_MDS_SESSION_OPEN) {
4388+ switch (s->s_state) {
4389+ case CEPH_MDS_SESSION_OPEN:
4390+ if (s->s_ttl && time_after(jiffies, s->s_ttl)) {
43964391 s->s_state = CEPH_MDS_SESSION_HUNG;
43974392 pr_info("mds%d hung\n", s->s_mds);
43984393 }
4399− }
4400− if (s->s_state == CEPH_MDS_SESSION_NEW ||
4401− s->s_state == CEPH_MDS_SESSION_RESTARTING ||
4402− s->s_state == CEPH_MDS_SESSION_CLOSED ||
4403− s->s_state == CEPH_MDS_SESSION_REJECTED)
4404− /* this mds is failed or recovering, just wait */
4394+ break;
4395+ case CEPH_MDS_SESSION_CLOSING:
4396+ /* Should never reach this when we're unmounting */
4397+ WARN_ON_ONCE(true);
4398+ fallthrough;
4399+ case CEPH_MDS_SESSION_NEW:
4400+ case CEPH_MDS_SESSION_RESTARTING:
4401+ case CEPH_MDS_SESSION_CLOSED:
4402+ case CEPH_MDS_SESSION_REJECTED:
44054403 return false;
4404+ }
44064405
44074406 return true;
44084407 }
44094408
4409+/*
4410+ * If the sequence is incremented while we're waiting on a REQUEST_CLOSE reply,
4411+ * then we need to retransmit that request.
4412+ */
4413+void inc_session_sequence(struct ceph_mds_session *s)
4414+{
4415+ lockdep_assert_held(&s->s_mutex);
4416+
4417+ s->s_seq++;
4418+
4419+ if (s->s_state == CEPH_MDS_SESSION_CLOSING) {
4420+ int ret;
4421+
4422+ dout("resending session close request for mds%d\n", s->s_mds);
4423+ ret = request_close_session(s);
4424+ if (ret < 0)
4425+ pr_err("unable to close session to mds%d: %d\n",
4426+ s->s_mds, ret);
4427+ }
4428+}
4429+
44104430 /*
44114431 * delayed work -- periodically trim expired leases, renew caps with mds
44124432 */
fs/ceph/mds_client.h+1−0
@@ -480,6 +480,7 @@ struct ceph_mds_client { · 479 unmodified lines
480480 extern const char *ceph_mds_op_name(int op);
481481
482482 extern bool check_session_state(struct ceph_mds_session *s);
483+void inc_session_sequence(struct ceph_mds_session *s);
483484
484485 extern struct ceph_mds_session *
485486 __ceph_lookup_mds_session(struct ceph_mds_client *, int mds);
fs/ceph/quota.c+1−1
@@ -53,7 +53,7 @@ void ceph_handle_quota(struct ceph_mds_client *mdsc, · 52 unmodified lines
5353
5454 /* increment msg sequence number */
5555 mutex_lock(&session->s_mutex);
56− session->s_seq++;
56+ inc_session_sequence(session);
5757 mutex_unlock(&session->s_mutex);
5858
5959 /* lookup inode */
fs/ceph/snap.c+1−1
@@ -873,7 +873,7 @@ void ceph_handle_snap(struct ceph_mds_client *mdsc, · 872 unmodified lines
873873 ceph_snap_op_name(op), split, trace_len);
874874
875875 mutex_lock(&session->s_mutex);
876− session->s_seq++;
876+ inc_session_sequence(session);
877877 mutex_unlock(&session->s_mutex);
878878
879879 down_write(&mdsc->snap_rwsem);
fs/gfs2/glock.c+2−1
@@ -1078,7 +1078,8 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number, · 1077 unmodified lines
10781078 out_free:
10791079 kfree(gl->gl_lksb.sb_lvbptr);
10801080 kmem_cache_free(cachep, gl);
1081− atomic_dec(&sdp->sd_glock_disposal);
1081+ if (atomic_dec_and_test(&sdp->sd_glock_disposal))
1082+ wake_up(&sdp->sd_glock_wait);
10821083
10831084 out:
10841085 return ret;
fs/gfs2/glops.c+45−11
@@ -164,6 +164,31 @@ void gfs2_ail_flush(struct gfs2_glock *gl, bool fsync) · 163 unmodified lines
164164 GFS2_LFC_AIL_FLUSH);
165165 }
166166
167+/**
168+ * gfs2_rgrp_metasync - sync out the metadata of a resource group
169+ * @gl: the glock protecting the resource group
170+ *
171+ */
172+
173+static int gfs2_rgrp_metasync(struct gfs2_glock *gl)
174+{
175+ struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
176+ struct address_space *metamapping = &sdp->sd_aspace;
177+ struct gfs2_rgrpd *rgd = gfs2_glock2rgrp(gl);
178+ const unsigned bsize = sdp->sd_sb.sb_bsize;
179+ loff_t start = (rgd->rd_addr * bsize) & PAGE_MASK;
180+ loff_t end = PAGE_ALIGN((rgd->rd_addr + rgd->rd_length) * bsize) - 1;
181+ int error;
182+
183+ filemap_fdatawrite_range(metamapping, start, end);
184+ error = filemap_fdatawait_range(metamapping, start, end);
185+ WARN_ON_ONCE(error && !gfs2_withdrawn(sdp));
186+ mapping_set_error(metamapping, error);
187+ if (error)
188+ gfs2_io_error(sdp);
189+ return error;
190+}
191+
167192 /**
168193 * rgrp_go_sync - sync out the metadata for this glock
169194 * @gl: the glock
@@ -176,11 +201,7 @@ void gfs2_ail_flush(struct gfs2_glock *gl, bool fsync) · 6 unmodified lines
176201 static int rgrp_go_sync(struct gfs2_glock *gl)
177202 {
178203 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
179− struct address_space *mapping = &sdp->sd_aspace;
180204 struct gfs2_rgrpd *rgd = gfs2_glock2rgrp(gl);
181− const unsigned bsize = sdp->sd_sb.sb_bsize;
182− loff_t start = (rgd->rd_addr * bsize) & PAGE_MASK;
183− loff_t end = PAGE_ALIGN((rgd->rd_addr + rgd->rd_length) * bsize) - 1;
184205 int error;
185206
186207 if (!test_and_clear_bit(GLF_DIRTY, &gl->gl_flags))
@@ -189,10 +210,7 @@ static int rgrp_go_sync(struct gfs2_glock *gl) · 2 unmodified lines
189210
190211 gfs2_log_flush(sdp, gl, GFS2_LOG_HEAD_FLUSH_NORMAL |
191212 GFS2_LFC_RGRP_GO_SYNC);
192− filemap_fdatawrite_range(mapping, start, end);
193− error = filemap_fdatawait_range(mapping, start, end);
194− WARN_ON_ONCE(error && !gfs2_withdrawn(sdp));
195− mapping_set_error(mapping, error);
213+ error = gfs2_rgrp_metasync(gl);
196214 if (!error)
197215 error = gfs2_ail_empty_gl(gl);
198216 gfs2_free_clones(rgd);
@@ -266,7 +284,24 @@ static void gfs2_clear_glop_pending(struct gfs2_inode *ip) · 67 unmodified lines
266284 }
267285
268286 /**
269− * inode_go_sync - Sync the dirty data and/or metadata for an inode glock
287+ * gfs2_inode_metasync - sync out the metadata of an inode
288+ * @gl: the glock protecting the inode
289+ *
290+ */
291+int gfs2_inode_metasync(struct gfs2_glock *gl)
292+{
293+ struct address_space *metamapping = gfs2_glock2aspace(gl);
294+ int error;
295+
296+ filemap_fdatawrite(metamapping);
297+ error = filemap_fdatawait(metamapping);
298+ if (error)
299+ gfs2_io_error(gl->gl_name.ln_sbd);
300+ return error;
301+}
302+
303+/**
304+ * inode_go_sync - Sync the dirty metadata of an inode
270305 * @gl: the glock protecting the inode
271306 *
272307 */
@@ -297,8 +332,7 @@ static int inode_go_sync(struct gfs2_glock *gl) · 24 unmodified lines
297332 error = filemap_fdatawait(mapping);
298333 mapping_set_error(mapping, error);
299334 }
300− ret = filemap_fdatawait(metamapping);
301− mapping_set_error(metamapping, ret);
335+ ret = gfs2_inode_metasync(gl);
302336 if (!error)
303337 error = ret;
304338 gfs2_ail_empty_gl(gl);
fs/gfs2/glops.h+1−0
@@ -22,6 +22,7 @@ extern const struct gfs2_glock_operations gfs2_quota_glops; · 21 unmodified lines
2222 extern const struct gfs2_glock_operations gfs2_journal_glops;
2323 extern const struct gfs2_glock_operations *gfs2_glops_list[];
2424
25+extern int gfs2_inode_metasync(struct gfs2_glock *gl);
2526 extern void gfs2_ail_flush(struct gfs2_glock *gl, bool fsync);
2627
2728 #endif /* __GLOPS_DOT_H__ */
fs/gfs2/inode.c+2−1
@@ -180,7 +180,8 @@ struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned int type, · 179 unmodified lines
180180 error = gfs2_glock_nq_init(io_gl, LM_ST_SHARED, GL_EXACT, &ip->i_iopen_gh);
181181 if (unlikely(error))
182182 goto fail;
183− gfs2_cancel_delete_work(ip->i_iopen_gh.gh_gl);
183+ if (blktype != GFS2_BLKST_UNLINKED)
184+ gfs2_cancel_delete_work(ip->i_iopen_gh.gh_gl);
184185 glock_set_object(ip->i_iopen_gh.gh_gl, ip);
185186 gfs2_glock_put(io_gl);
186187 io_gl = NULL;
fs/gfs2/lops.c+5−26
@@ -22,6 +22,7 @@ · 21 unmodified lines
2222 #include "incore.h"
2323 #include "inode.h"
2424 #include "glock.h"
25+#include "glops.h"
2526 #include "log.h"
2627 #include "lops.h"
2728 #include "meta_io.h"
@@ -817,41 +818,19 @@ static int buf_lo_scan_elements(struct gfs2_jdesc *jd, u32 start, · 789 unmodified lines
817818 return error;
818819 }
819820
820−/**
821− * gfs2_meta_sync - Sync all buffers associated with a glock
822− * @gl: The glock
823− *
824− */
825−
826−void gfs2_meta_sync(struct gfs2_glock *gl)
827−{
828− struct address_space *mapping = gfs2_glock2aspace(gl);
829− struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
830− int error;
831−
832− if (mapping == NULL)
833− mapping = &sdp->sd_aspace;
834−
835− filemap_fdatawrite(mapping);
836− error = filemap_fdatawait(mapping);
837−
838− if (error)
839− gfs2_io_error(gl->gl_name.ln_sbd);
840−}
841−
842821 static void buf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass)
843822 {
844823 struct gfs2_inode *ip = GFS2_I(jd->jd_inode);
845824 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
846825
847826 if (error) {
848− gfs2_meta_sync(ip->i_gl);
827+ gfs2_inode_metasync(ip->i_gl);
849828 return;
850829 }
851830 if (pass != 1)
852831 return;
853832
854− gfs2_meta_sync(ip->i_gl);
833+ gfs2_inode_metasync(ip->i_gl);
855834
856835 fs_info(sdp, "jid=%u: Replayed %u of %u blocks\n",
857836 jd->jd_jid, jd->jd_replayed_blocks, jd->jd_found_blocks);
@@ -1060,14 +1039,14 @@ static void databuf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass) · 202 unmodified lines
10601039 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
10611040
10621041 if (error) {
1063− gfs2_meta_sync(ip->i_gl);
1042+ gfs2_inode_metasync(ip->i_gl);
10641043 return;
10651044 }
10661045 if (pass != 1)
10671046 return;
10681047
10691048 /* data sync? */
1070− gfs2_meta_sync(ip->i_gl);
1049+ gfs2_inode_metasync(ip->i_gl);
10711050
10721051 fs_info(sdp, "jid=%u: Replayed %u of %u data blocks\n",
10731052 jd->jd_jid, jd->jd_replayed_blocks, jd->jd_found_blocks);
fs/gfs2/lops.h+0−2
@@ -27,8 +27,6 @@ extern void gfs2_log_submit_bio(struct bio **biop, int opf); · 26 unmodified lines
2727 extern void gfs2_pin(struct gfs2_sbd *sdp, struct buffer_head *bh);
2828 extern int gfs2_find_jhead(struct gfs2_jdesc *jd,
2929 struct gfs2_log_header_host *head, bool keep_cache);
30−extern void gfs2_meta_sync(struct gfs2_glock *gl);
31−
3230 static inline unsigned int buf_limit(struct gfs2_sbd *sdp)
3331 {
3432 unsigned int limit;
fs/gfs2/ops_fstype.c+9−5
@@ -633,8 +633,10 @@ static int init_statfs(struct gfs2_sbd *sdp) · 632 unmodified lines
633633 if (IS_ERR(sdp->sd_statfs_inode)) {
634634 error = PTR_ERR(sdp->sd_statfs_inode);
635635 fs_err(sdp, "can't read in statfs inode: %d\n", error);
636− goto fail;
636+ goto out;
637637 }
638+ if (sdp->sd_args.ar_spectator)
639+ goto out;
638640
639641 pn = gfs2_lookup_simple(master, "per_node");
640642 if (IS_ERR(pn)) {
@@ -682,15 +684,17 @@ free_local: · 41 unmodified lines
682684 iput(pn);
683685 put_statfs:
684686 iput(sdp->sd_statfs_inode);
685−fail:
687+out:
686688 return error;
687689 }
688690
689691 /* Uninitialize and free up memory used by the list of statfs inodes */
690692 static void uninit_statfs(struct gfs2_sbd *sdp)
691693 {
692− gfs2_glock_dq_uninit(&sdp->sd_sc_gh);
693− free_local_statfs_inodes(sdp);
694+ if (!sdp->sd_args.ar_spectator) {
695+ gfs2_glock_dq_uninit(&sdp->sd_sc_gh);
696+ free_local_statfs_inodes(sdp);
697+ }
694698 iput(sdp->sd_statfs_inode);
695699 }
696700
@@ -704,7 +708,7 @@ static int init_journal(struct gfs2_sbd *sdp, int undo) · 7 unmodified lines
704708
705709 if (undo) {
706710 jindex = 0;
707− goto fail_jinode_gh;
711+ goto fail_statfs;
708712 }
709713
710714 sdp->sd_jindex = gfs2_lookup_simple(master, "jindex");
fs/gfs2/recovery.c+1−1
@@ -349,7 +349,7 @@ static int update_statfs_inode(struct gfs2_jdesc *jd, · 348 unmodified lines
349349
350350 mark_buffer_dirty(bh);
351351 brelse(bh);
352− gfs2_meta_sync(ip->i_gl);
352+ gfs2_inode_metasync(ip->i_gl);
353353
354354 out:
355355 return error;
fs/gfs2/rgrp.c+4−1
@@ -719,9 +719,9 @@ void gfs2_clear_rgrpd(struct gfs2_sbd *sdp) · 718 unmodified lines
719719 }
720720
721721 gfs2_free_clones(rgd);
722+ return_all_reservations(rgd);
722723 kfree(rgd->rd_bits);
723724 rgd->rd_bits = NULL;
724− return_all_reservations(rgd);
725725 kmem_cache_free(gfs2_rgrpd_cachep, rgd);
726726 }
727727 }
@@ -1370,6 +1370,9 @@ int gfs2_fitrim(struct file *filp, void __user *argp) · 642 unmodified lines
13701370 if (!capable(CAP_SYS_ADMIN))
13711371 return -EPERM;
13721372
1373+ if (!test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags))
1374+ return -EROFS;
1375+
13731376 if (!blk_queue_discard(q))
13741377 return -EOPNOTSUPP;
13751378
fs/gfs2/super.c+1−0
@@ -738,6 +738,7 @@ restart: · 737 unmodified lines
738738 gfs2_jindex_free(sdp);
739739 /* Take apart glock structures and buffer lists */
740740 gfs2_gl_hash_clear(sdp);
741+ truncate_inode_pages_final(&sdp->sd_aspace);
741742 gfs2_delete_debugfs_file(sdp);
742743 /* Unmount the locking protocol */
743744 gfs2_lm_unmount(sdp);
fs/io-wq.c+4−0
@@ -482,6 +482,10 @@ static void io_impersonate_work(struct io_worker *worker, · 481 unmodified lines
482482 current->files = work->identity->files;
483483 current->nsproxy = work->identity->nsproxy;
484484 task_unlock(current);
485+ if (!work->identity->files) {
486+ /* failed grabbing files, ensure work gets cancelled */
487+ work->flags |= IO_WQ_WORK_CANCEL;
488+ }
485489 }
486490 if ((work->flags & IO_WQ_WORK_FS) && current->fs != work->identity->fs)
487491 current->fs = work->identity->fs;
fs/io_uring.c+136−47
@@ -995,20 +995,33 @@ static void io_sq_thread_drop_mm(void) · 994 unmodified lines
995995 if (mm) {
996996 kthread_unuse_mm(mm);
997997 mmput(mm);
998+ current->mm = NULL;
998999 }
9991000 }
10001001
10011002 static int __io_sq_thread_acquire_mm(struct io_ring_ctx *ctx)
10021003 {
1003− if (!current->mm) {
1004− if (unlikely(!(ctx->flags & IORING_SETUP_SQPOLL) ||
1005− !ctx->sqo_task->mm ||
1006− !mmget_not_zero(ctx->sqo_task->mm)))
1007− return -EFAULT;
1008− kthread_use_mm(ctx->sqo_task->mm);
1004+ struct mm_struct *mm;
1005+
1006+ if (current->mm)
1007+ return 0;
1008+
1009+ /* Should never happen */
1010+ if (unlikely(!(ctx->flags & IORING_SETUP_SQPOLL)))
1011+ return -EFAULT;
1012+
1013+ task_lock(ctx->sqo_task);
1014+ mm = ctx->sqo_task->mm;
1015+ if (unlikely(!mm || !mmget_not_zero(mm)))
1016+ mm = NULL;
1017+ task_unlock(ctx->sqo_task);
1018+
1019+ if (mm) {
1020+ kthread_use_mm(mm);
1021+ return 0;
10091022 }
10101023
1011− return 0;
1024+ return -EFAULT;
10121025 }
10131026
10141027 static int io_sq_thread_acquire_mm(struct io_ring_ctx *ctx,
@@ -1274,9 +1287,12 @@ static bool io_identity_cow(struct io_kiocb *req) · 259 unmodified lines
12741287 /* add one for this request */
12751288 refcount_inc(&id->count);
12761289
1277− /* drop old identity, assign new one. one ref for req, one for tctx */
1278− if (req->work.identity != tctx->identity &&
1279− refcount_sub_and_test(2, &req->work.identity->count))
1290+ /* drop tctx and req identity references, if needed */
1291+ if (tctx->identity != &tctx->__identity &&
1292+ refcount_dec_and_test(&tctx->identity->count))
1293+ kfree(tctx->identity);
1294+ if (req->work.identity != &tctx->__identity &&
1295+ refcount_dec_and_test(&req->work.identity->count))
12801296 kfree(req->work.identity);
12811297
12821298 req->work.identity = id;
@@ -1577,14 +1593,29 @@ static void io_cqring_mark_overflow(struct io_ring_ctx *ctx) · 294 unmodified lines
15771593 }
15781594 }
15791595
1580−static inline bool io_match_files(struct io_kiocb *req,
1581− struct files_struct *files)
1596+static inline bool __io_match_files(struct io_kiocb *req,
1597+ struct files_struct *files)
15821598 {
1599+ return ((req->flags & REQ_F_WORK_INITIALIZED) &&
1600+ (req->work.flags & IO_WQ_WORK_FILES)) &&
1601+ req->work.identity->files == files;
1602+}
1603+
1604+static bool io_match_files(struct io_kiocb *req,
1605+ struct files_struct *files)
1606+{
1607+ struct io_kiocb *link;
1608+
15831609 if (!files)
15841610 return true;
1585− if ((req->flags & REQ_F_WORK_INITIALIZED) &&
1586− (req->work.flags & IO_WQ_WORK_FILES))
1587− return req->work.identity->files == files;
1611+ if (__io_match_files(req, files))
1612+ return true;
1613+ if (req->flags & REQ_F_LINK_HEAD) {
1614+ list_for_each_entry(link, &req->link_list, link_list) {
1615+ if (__io_match_files(link, files))
1616+ return true;
1617+ }
1618+ }
15881619 return false;
15891620 }
15901621
@@ -1668,7 +1699,8 @@ static void __io_cqring_fill_event(struct io_kiocb *req, long res, long cflags) · 77 unmodified lines
16681699 WRITE_ONCE(cqe->user_data, req->user_data);
16691700 WRITE_ONCE(cqe->res, res);
16701701 WRITE_ONCE(cqe->flags, cflags);
1671− } else if (ctx->cq_overflow_flushed || req->task->io_uring->in_idle) {
1702+ } else if (ctx->cq_overflow_flushed ||
1703+ atomic_read(&req->task->io_uring->in_idle)) {
16721704 /*
16731705 * If we're in ring overflow flush mode, or in task cancel mode,
16741706 * then we cannot store the request for later flushing, we need
@@ -1838,7 +1870,7 @@ static void __io_free_req(struct io_kiocb *req) · 163 unmodified lines
18381870 io_dismantle_req(req);
18391871
18401872 percpu_counter_dec(&tctx->inflight);
1841− if (tctx->in_idle)
1873+ if (atomic_read(&tctx->in_idle))
18421874 wake_up(&tctx->wait);
18431875 put_task_struct(req->task);
18441876
@@ -7695,7 +7727,8 @@ static int io_uring_alloc_task_context(struct task_struct *task) · 5850 unmodified lines
76957727 xa_init(&tctx->xa);
76967728 init_waitqueue_head(&tctx->wait);
76977729 tctx->last = NULL;
7698− tctx->in_idle = 0;
7730+ atomic_set(&tctx->in_idle, 0);
7731+ tctx->sqpoll = false;
76997732 io_init_identity(&tctx->__identity);
77007733 tctx->identity = &tctx->__identity;
77017734 task->io_uring = tctx;
@@ -8388,22 +8421,6 @@ static bool io_match_link(struct io_kiocb *preq, struct io_kiocb *req) · 686 unmodified lines
83888421 return false;
83898422 }
83908423
8391−static bool io_match_link_files(struct io_kiocb *req,
8392− struct files_struct *files)
8393−{
8394− struct io_kiocb *link;
8395−
8396− if (io_match_files(req, files))
8397− return true;
8398− if (req->flags & REQ_F_LINK_HEAD) {
8399− list_for_each_entry(link, &req->link_list, link_list) {
8400− if (io_match_files(link, files))
8401− return true;
8402− }
8403− }
8404− return false;
8405−}
8406−
84078424 /*
84088425 * We're looking to cancel 'req' because it's holding on to our files, but
84098426 * 'req' could be a link to another request. See if it is, and cancel that
@@ -8453,7 +8470,21 @@ static bool io_timeout_remove_link(struct io_ring_ctx *ctx, · 43 unmodified lines
84538470
84548471 static bool io_cancel_link_cb(struct io_wq_work *work, void *data)
84558472 {
8456− return io_match_link(container_of(work, struct io_kiocb, work), data);
8473+ struct io_kiocb *req = container_of(work, struct io_kiocb, work);
8474+ bool ret;
8475+
8476+ if (req->flags & REQ_F_LINK_TIMEOUT) {
8477+ unsigned long flags;
8478+ struct io_ring_ctx *ctx = req->ctx;
8479+
8480+ /* protect against races with linked timeouts */
8481+ spin_lock_irqsave(&ctx->completion_lock, flags);
8482+ ret = io_match_link(req, data);
8483+ spin_unlock_irqrestore(&ctx->completion_lock, flags);
8484+ } else {
8485+ ret = io_match_link(req, data);
8486+ }
8487+ return ret;
84578488 }
84588489
84598490 static void io_attempt_cancel(struct io_ring_ctx *ctx, struct io_kiocb *req)
@@ -8479,6 +8510,7 @@ static void io_attempt_cancel(struct io_ring_ctx *ctx, struct io_kiocb *req) · 19 unmodified lines
84798510 }
84808511
84818512 static void io_cancel_defer_files(struct io_ring_ctx *ctx,
8513+ struct task_struct *task,
84828514 struct files_struct *files)
84838515 {
84848516 struct io_defer_entry *de = NULL;
@@ -8486,7 +8518,8 @@ static void io_cancel_defer_files(struct io_ring_ctx *ctx, · 1 unmodified line
84868518
84878519 spin_lock_irq(&ctx->completion_lock);
84888520 list_for_each_entry_reverse(de, &ctx->defer_list, list) {
8489− if (io_match_link_files(de->req, files)) {
8521+ if (io_task_match(de->req, task) &&
8522+ io_match_files(de->req, files)) {
84908523 list_cut_position(&list, &ctx->defer_list, &de->list);
84918524 break;
84928525 }
@@ -8512,7 +8545,6 @@ static bool io_uring_cancel_files(struct io_ring_ctx *ctx, · 19 unmodified lines
85128545 if (list_empty_careful(&ctx->inflight_list))
85138546 return false;
85148547
8515− io_cancel_defer_files(ctx, files);
85168548 /* cancel all at once, should be faster than doing it one by one*/
85178549 io_wq_cancel_cb(ctx->io_wq, io_wq_files_match, files, true);
85188550
@@ -8598,8 +8630,16 @@ static void io_uring_cancel_task_requests(struct io_ring_ctx *ctx, · 79 unmodified lines
85988630 {
85998631 struct task_struct *task = current;
86008632
8601− if ((ctx->flags & IORING_SETUP_SQPOLL) && ctx->sq_data)
8633+ if ((ctx->flags & IORING_SETUP_SQPOLL) && ctx->sq_data) {
86028634 task = ctx->sq_data->thread;
8635+ atomic_inc(&task->io_uring->in_idle);
8636+ io_sq_thread_park(ctx->sq_data);
8637+ }
8638+
8639+ if (files)
8640+ io_cancel_defer_files(ctx, NULL, files);
8641+ else
8642+ io_cancel_defer_files(ctx, task, NULL);
86038643
86048644 io_cqring_overflow_flush(ctx, true, task, files);
86058645
@@ -8607,12 +8647,23 @@ static void io_uring_cancel_task_requests(struct io_ring_ctx *ctx, · 1 unmodified line
86078647 io_run_task_work();
86088648 cond_resched();
86098649 }
8650+
8651+ if ((ctx->flags & IORING_SETUP_SQPOLL) && ctx->sq_data) {
8652+ atomic_dec(&task->io_uring->in_idle);
8653+ /*
8654+ * If the files that are going away are the ones in the thread
8655+ * identity, clear them out.
8656+ */
8657+ if (task->io_uring->identity->files == files)
8658+ task->io_uring->identity->files = NULL;
8659+ io_sq_thread_unpark(ctx->sq_data);
8660+ }
86108661 }
86118662
86128663 /*
86138664 * Note that this task has used io_uring. We use it for cancelation purposes.
86148665 */
8615−static int io_uring_add_task_file(struct file *file)
8666+static int io_uring_add_task_file(struct io_ring_ctx *ctx, struct file *file)
86168667 {
86178668 struct io_uring_task *tctx = current->io_uring;
86188669
@@ -8634,6 +8685,14 @@ static int io_uring_add_task_file(struct file *file) · 15 unmodified lines
86348685 tctx->last = file;
86358686 }
86368687
8688+ /*
8689+ * This is race safe in that the task itself is doing this, hence it
8690+ * cannot be going through the exit/cancel paths at the same time.
8691+ * This cannot be modified while exit/cancel is running.
8692+ */
8693+ if (!tctx->sqpoll && (ctx->flags & IORING_SETUP_SQPOLL))
8694+ tctx->sqpoll = true;
8695+
86378696 return 0;
86388697 }
86398698
@@ -8675,7 +8734,7 @@ void __io_uring_files_cancel(struct files_struct *files) · 35 unmodified lines
86758734 unsigned long index;
86768735
86778736 /* make sure overflow events are dropped */
8678− tctx->in_idle = true;
8737+ atomic_inc(&tctx->in_idle);
86798738
86808739 xa_for_each(&tctx->xa, index, file) {
86818740 struct io_ring_ctx *ctx = file->private_data;
@@ -8684,6 +8743,35 @@ void __io_uring_files_cancel(struct files_struct *files) · 2 unmodified lines
86848743 if (files)
86858744 io_uring_del_task_file(file);
86868745 }
8746+
8747+ atomic_dec(&tctx->in_idle);
8748+}
8749+
8750+static s64 tctx_inflight(struct io_uring_task *tctx)
8751+{
8752+ unsigned long index;
8753+ struct file *file;
8754+ s64 inflight;
8755+
8756+ inflight = percpu_counter_sum(&tctx->inflight);
8757+ if (!tctx->sqpoll)
8758+ return inflight;
8759+
8760+ /*
8761+ * If we have SQPOLL rings, then we need to iterate and find them, and
8762+ * add the pending count for those.
8763+ */
8764+ xa_for_each(&tctx->xa, index, file) {
8765+ struct io_ring_ctx *ctx = file->private_data;
8766+
8767+ if (ctx->flags & IORING_SETUP_SQPOLL) {
8768+ struct io_uring_task *__tctx = ctx->sqo_task->io_uring;
8769+
8770+ inflight += percpu_counter_sum(&__tctx->inflight);
8771+ }
8772+ }
8773+
8774+ return inflight;
86878775 }
86888776
86898777 /*
@@ -8697,11 +8785,11 @@ void __io_uring_task_cancel(void) · 7 unmodified lines
86978785 s64 inflight;
86988786
86998787 /* make sure overflow events are dropped */
8700− tctx->in_idle = true;
8788+ atomic_inc(&tctx->in_idle);
87018789
87028790 do {
87038791 /* read completions before cancelations */
8704− inflight = percpu_counter_sum(&tctx->inflight);
8792+ inflight = tctx_inflight(tctx);
87058793 if (!inflight)
87068794 break;
87078795 __io_uring_files_cancel(NULL);
@@ -8712,13 +8800,13 @@ void __io_uring_task_cancel(void) · 4 unmodified lines
87128800 * If we've seen completions, retry. This avoids a race where
87138801 * a completion comes in before we did prepare_to_wait().
87148802 */
8715− if (inflight != percpu_counter_sum(&tctx->inflight))
8803+ if (inflight != tctx_inflight(tctx))
87168804 continue;
87178805 schedule();
87188806 } while (1);
87198807
87208808 finish_wait(&tctx->wait, &wait);
8721− tctx->in_idle = false;
8809+ atomic_dec(&tctx->in_idle);
87228810 }
87238811
87248812 static int io_uring_flush(struct file *file, void *data)
@@ -8863,7 +8951,7 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit, · 138 unmodified lines
88638951 io_sqpoll_wait_sq(ctx);
88648952 submitted = to_submit;
88658953 } else if (to_submit) {
8866− ret = io_uring_add_task_file(f.file);
8954+ ret = io_uring_add_task_file(ctx, f.file);
88678955 if (unlikely(ret))
88688956 goto out;
88698957 mutex_lock(&ctx->uring_lock);
@@ -8900,7 +8988,8 @@ out_fput: · 30 unmodified lines
89008988 #ifdef CONFIG_PROC_FS
89018989 static int io_uring_show_cred(int id, void *p, void *data)
89028990 {
8903− const struct cred *cred = p;
8991+ struct io_identity *iod = p;
8992+ const struct cred *cred = iod->creds;
89048993 struct seq_file *m = data;
89058994 struct user_namespace *uns = seq_user_ns(m);
89068995 struct group_info *gi;
@@ -9092,7 +9181,7 @@ err_fd: · 185 unmodified lines
90929181 #if defined(CONFIG_UNIX)
90939182 ctx->ring_sock->file = file;
90949183 #endif
9095− if (unlikely(io_uring_add_task_file(file))) {
9184+ if (unlikely(io_uring_add_task_file(ctx, file))) {
90969185 file = ERR_PTR(-ENOMEM);
90979186 goto err_fd;
90989187 }
fs/iomap/buffered-io.c+10−20
@@ -1374,6 +1374,7 @@ iomap_writepage_map(struct iomap_writepage_ctx *wpc, · 1373 unmodified lines
13741374 WARN_ON_ONCE(!wpc->ioend && !list_empty(&submit_list));
13751375 WARN_ON_ONCE(!PageLocked(page));
13761376 WARN_ON_ONCE(PageWriteback(page));
1377+ WARN_ON_ONCE(PageDirty(page));
13771378
13781379 /*
13791380 * We cannot cancel the ioend directly here on error. We may have
@@ -1382,33 +1383,22 @@ iomap_writepage_map(struct iomap_writepage_ctx *wpc, · 2 unmodified lines
13821383 * appropriately.
13831384 */
13841385 if (unlikely(error)) {
1386+ /*
1387+ * Let the filesystem know what portion of the current page
1388+ * failed to map. If the page wasn't been added to ioend, it
1389+ * won't be affected by I/O completion and we must unlock it
1390+ * now.
1391+ */
1392+ if (wpc->ops->discard_page)
1393+ wpc->ops->discard_page(page, file_offset);
13851394 if (!count) {
1386− /*
1387− * If the current page hasn't been added to ioend, it
1388− * won't be affected by I/O completions and we must
1389− * discard and unlock it right here.
1390− */
1391− if (wpc->ops->discard_page)
1392− wpc->ops->discard_page(page);
13931395 ClearPageUptodate(page);
13941396 unlock_page(page);
13951397 goto done;
13961398 }
1397−
1398− /*
1399− * If the page was not fully cleaned, we need to ensure that the
1400− * higher layers come back to it correctly. That means we need
1401− * to keep the page dirty, and for WB_SYNC_ALL writeback we need
1402− * to ensure the PAGECACHE_TAG_TOWRITE index mark is not removed
1403− * so another attempt to write this page in this writeback sweep
1404− * will be made.
1405− */
1406− set_page_writeback_keepwrite(page);
1407− } else {
1408− clear_page_dirty_for_io(page);
1409− set_page_writeback(page);
14101399 }
14111400
1401+ set_page_writeback(page);
14121402 unlock_page(page);
14131403
14141404 /*
fs/proc/base.c+2−0
@@ -1049,6 +1049,8 @@ static ssize_t oom_adj_read(struct file *file, char __user *buf, size_t count, · 1048 unmodified lines
10491049 oom_adj = (task->signal->oom_score_adj * -OOM_DISABLE) /
10501050 OOM_SCORE_ADJ_MAX;
10511051 put_task_struct(task);
1052+ if (oom_adj > OOM_ADJUST_MAX)
1053+ oom_adj = OOM_ADJUST_MAX;
10521054 len = snprintf(buffer, sizeof(buffer), "%d\n", oom_adj);
10531055 return simple_read_from_buffer(buf, count, ppos, buffer, len);
10541056 }
fs/proc/cpuinfo.c+1−1
@@ -19,7 +19,7 @@ static int cpuinfo_open(struct inode *inode, struct file *file) · 18 unmodified lines
1919 static const struct proc_ops cpuinfo_proc_ops = {
2020 .proc_flags = PROC_ENTRY_PERMANENT,
2121 .proc_open = cpuinfo_open,
22− .proc_read = seq_read,
22+ .proc_read_iter = seq_read_iter,
2323 .proc_lseek = seq_lseek,
2424 .proc_release = seq_release,
2525 };
fs/proc/generic.c+2−2
@@ -590,7 +590,7 @@ static int proc_seq_release(struct inode *inode, struct file *file) · 589 unmodified lines
590590 static const struct proc_ops proc_seq_ops = {
591591 /* not permanent -- can call into arbitrary seq_operations */
592592 .proc_open = proc_seq_open,
593− .proc_read = seq_read,
593+ .proc_read_iter = seq_read_iter,
594594 .proc_lseek = seq_lseek,
595595 .proc_release = proc_seq_release,
596596 };
@@ -621,7 +621,7 @@ static int proc_single_open(struct inode *inode, struct file *file) · 24 unmodified lines
621621 static const struct proc_ops proc_single_ops = {
622622 /* not permanent -- can call into arbitrary ->single_show */
623623 .proc_open = proc_single_open,
624− .proc_read = seq_read,
624+ .proc_read_iter = seq_read_iter,
625625 .proc_lseek = seq_lseek,
626626 .proc_release = single_release,
627627 };
fs/proc/inode.c+2−0
@@ -597,6 +597,7 @@ static const struct file_operations proc_iter_file_ops = { · 596 unmodified lines
597597 .llseek = proc_reg_llseek,
598598 .read_iter = proc_reg_read_iter,
599599 .write = proc_reg_write,
600+ .splice_read = generic_file_splice_read,
600601 .poll = proc_reg_poll,
601602 .unlocked_ioctl = proc_reg_unlocked_ioctl,
602603 .mmap = proc_reg_mmap,
@@ -622,6 +623,7 @@ static const struct file_operations proc_reg_file_ops_compat = { · 19 unmodified lines
622623 static const struct file_operations proc_iter_file_ops_compat = {
623624 .llseek = proc_reg_llseek,
624625 .read_iter = proc_reg_read_iter,
626+ .splice_read = generic_file_splice_read,
625627 .write = proc_reg_write,
626628 .poll = proc_reg_poll,
627629 .unlocked_ioctl = proc_reg_unlocked_ioctl,
fs/proc/stat.c+1−1
@@ -226,7 +226,7 @@ static int stat_open(struct inode *inode, struct file *file) · 225 unmodified lines
226226 static const struct proc_ops stat_proc_ops = {
227227 .proc_flags = PROC_ENTRY_PERMANENT,
228228 .proc_open = stat_open,
229− .proc_read = seq_read,
229+ .proc_read_iter = seq_read_iter,
230230 .proc_lseek = seq_lseek,
231231 .proc_release = single_release,
232232 };
fs/seq_file.c+32−13
@@ -18,6 +18,7 @@ · 17 unmodified lines
1818 #include <linux/mm.h>
1919 #include <linux/printk.h>
2020 #include <linux/string_helpers.h>
21+#include <linux/uio.h>
2122
2223 #include <linux/uaccess.h>
2324 #include <asm/page.h>
@@ -146,7 +147,28 @@ Eoverflow: · 122 unmodified lines
146147 */
147148 ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos)
148149 {
149− struct seq_file *m = file->private_data;
150+ struct iovec iov = { .iov_base = buf, .iov_len = size};
151+ struct kiocb kiocb;
152+ struct iov_iter iter;
153+ ssize_t ret;
154+
155+ init_sync_kiocb(&kiocb, file);
156+ iov_iter_init(&iter, READ, &iov, 1, size);
157+
158+ kiocb.ki_pos = *ppos;
159+ ret = seq_read_iter(&kiocb, &iter);
160+ *ppos = kiocb.ki_pos;
161+ return ret;
162+}
163+EXPORT_SYMBOL(seq_read);
164+
165+/*
166+ * Ready-made ->f_op->read_iter()
167+ */
168+ssize_t seq_read_iter(struct kiocb *iocb, struct iov_iter *iter)
169+{
170+ struct seq_file *m = iocb->ki_filp->private_data;
171+ size_t size = iov_iter_count(iter);
150172 size_t copied = 0;
151173 size_t n;
152174 void *p;
@@ -158,14 +180,14 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos) · 5 unmodified lines
158180 * if request is to read from zero offset, reset iterator to first
159181 * record as it might have been already advanced by previous requests
160182 */
161− if (*ppos == 0) {
183+ if (iocb->ki_pos == 0) {
162184 m->index = 0;
163185 m->count = 0;
164186 }
165187
166− /* Don't assume *ppos is where we left it */
167− if (unlikely(*ppos != m->read_pos)) {
168− while ((err = traverse(m, *ppos)) == -EAGAIN)
188+ /* Don't assume ki_pos is where we left it */
189+ if (unlikely(iocb->ki_pos != m->read_pos)) {
190+ while ((err = traverse(m, iocb->ki_pos)) == -EAGAIN)
169191 ;
170192 if (err) {
171193 /* With prejudice... */
@@ -174,7 +196,7 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos) · 2 unmodified lines
174196 m->count = 0;
175197 goto Done;
176198 } else {
177− m->read_pos = *ppos;
199+ m->read_pos = iocb->ki_pos;
178200 }
179201 }
180202
@@ -187,13 +209,11 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos) · 6 unmodified lines
187209 /* if not empty - flush it first */
188210 if (m->count) {
189211 n = min(m->count, size);
190− err = copy_to_user(buf, m->buf + m->from, n);
191− if (err)
212+ if (copy_to_iter(m->buf + m->from, n, iter) != n)
192213 goto Efault;
193214 m->count -= n;
194215 m->from += n;
195216 size -= n;
196− buf += n;
197217 copied += n;
198218 if (!size)
199219 goto Done;
@@ -254,8 +274,7 @@ Fill: · 54 unmodified lines
254274 }
255275 m->op->stop(m, p);
256276 n = min(m->count, size);
257− err = copy_to_user(buf, m->buf, n);
258− if (err)
277+ if (copy_to_iter(m->buf, n, iter) != n)
259278 goto Efault;
260279 copied += n;
261280 m->count -= n;
@@ -264,7 +283,7 @@ Done: · 2 unmodified lines
264283 if (!copied)
265284 copied = err;
266285 else {
267− *ppos += copied;
286+ iocb->ki_pos += copied;
268287 m->read_pos += copied;
269288 }
270289 mutex_unlock(&m->lock);
@@ -276,7 +295,7 @@ Efault: · 5 unmodified lines
276295 err = -EFAULT;
277296 goto Done;
278297 }
279−EXPORT_SYMBOL(seq_read);
298+EXPORT_SYMBOL(seq_read_iter);
280299
281300 /**
282301 * seq_lseek - ->llseek() method for sequential files.
fs/xfs/libxfs/xfs_alloc.c+1−0
@@ -2467,6 +2467,7 @@ xfs_defer_agfl_block( · 2466 unmodified lines
24672467 new->xefi_startblock = XFS_AGB_TO_FSB(mp, agno, agbno);
24682468 new->xefi_blockcount = 1;
24692469 new->xefi_oinfo = *oinfo;
2470+ new->xefi_skip_discard = false;
24702471
24712472 trace_xfs_agfl_free_defer(mp, agno, 0, agbno, 1);
24722473
fs/xfs/libxfs/xfs_bmap.h+1−1
@@ -52,9 +52,9 @@ struct xfs_extent_free_item · 51 unmodified lines
5252 {
5353 xfs_fsblock_t xefi_startblock;/* starting fs block number */
5454 xfs_extlen_t xefi_blockcount;/* number of blocks in extent */
55+ bool xefi_skip_discard;
5556 struct list_head xefi_list;
5657 struct xfs_owner_info xefi_oinfo; /* extent owner */
57− bool xefi_skip_discard;
5858 };
5959
6060 #define XFS_BMAP_MAX_NMAP 4
fs/xfs/scrub/inode.c+1−2
@@ -121,8 +121,7 @@ xchk_inode_flags( · 120 unmodified lines
121121 goto bad;
122122
123123 /* rt flags require rt device */
124− if ((flags & (XFS_DIFLAG_REALTIME | XFS_DIFLAG_RTINHERIT)) &&
125− !mp->m_rtdev_targp)
124+ if ((flags & XFS_DIFLAG_REALTIME) && !mp->m_rtdev_targp)
126125 goto bad;
127126
128127 /* new rt bitmap flag only valid for rbmino */
fs/xfs/xfs_aops.c+12−8
@@ -346,8 +346,8 @@ xfs_map_blocks( · 345 unmodified lines
346346 ssize_t count = i_blocksize(inode);
347347 xfs_fileoff_t offset_fsb = XFS_B_TO_FSBT(mp, offset);
348348 xfs_fileoff_t end_fsb = XFS_B_TO_FSB(mp, offset + count);
349− xfs_fileoff_t cow_fsb = NULLFILEOFF;
350− int whichfork = XFS_DATA_FORK;
349+ xfs_fileoff_t cow_fsb;
350+ int whichfork;
351351 struct xfs_bmbt_irec imap;
352352 struct xfs_iext_cursor icur;
353353 int retries = 0;
@@ -381,6 +381,8 @@ xfs_map_blocks( · 27 unmodified lines
381381 * landed in a hole and we skip the block.
382382 */
383383 retry:
384+ cow_fsb = NULLFILEOFF;
385+ whichfork = XFS_DATA_FORK;
384386 xfs_ilock(ip, XFS_ILOCK_SHARED);
385387 ASSERT(ip->i_df.if_format != XFS_DINODE_FMT_BTREE ||
386388 (ip->i_df.if_flags & XFS_IFEXTENTS));
@@ -527,13 +529,15 @@ xfs_prepare_ioend( · 140 unmodified lines
527529 */
528530 static void
529531 xfs_discard_page(
530− struct page *page)
532+ struct page *page,
533+ loff_t fileoff)
531534 {
532535 struct inode *inode = page->mapping->host;
533536 struct xfs_inode *ip = XFS_I(inode);
534537 struct xfs_mount *mp = ip->i_mount;
535− loff_t offset = page_offset(page);
536− xfs_fileoff_t start_fsb = XFS_B_TO_FSBT(mp, offset);
538+ unsigned int pageoff = offset_in_page(fileoff);
539+ xfs_fileoff_t start_fsb = XFS_B_TO_FSBT(mp, fileoff);
540+ xfs_fileoff_t pageoff_fsb = XFS_B_TO_FSBT(mp, pageoff);
537541 int error;
538542
539543 if (XFS_FORCED_SHUTDOWN(mp))
@@ -541,14 +545,14 @@ xfs_discard_page( · 1 unmodified line
541545
542546 xfs_alert_ratelimited(mp,
543547 "page discard on page "PTR_FMT", inode 0x%llx, offset %llu.",
544− page, ip->i_ino, offset);
548+ page, ip->i_ino, fileoff);
545549
546550 error = xfs_bmap_punch_delalloc_range(ip, start_fsb,
547− i_blocks_per_page(inode, page));
551+ i_blocks_per_page(inode, page) - pageoff_fsb);
548552 if (error && !XFS_FORCED_SHUTDOWN(mp))
549553 xfs_alert(mp, "page discard unable to remove delalloc mapping.");
550554 out_invalidate:
551− iomap_invalidatepage(page, 0, PAGE_SIZE);
555+ iomap_invalidatepage(page, pageoff, PAGE_SIZE - pageoff);
552556 }
553557
554558 static const struct iomap_writeback_ops xfs_writeback_ops = {
fs/xfs/xfs_iops.c+10−0
@@ -911,6 +911,16 @@ xfs_setattr_size( · 910 unmodified lines
911911 error = iomap_zero_range(inode, oldsize, newsize - oldsize,
912912 &did_zeroing, &xfs_buffered_write_iomap_ops);
913913 } else {
914+ /*
915+ * iomap won't detect a dirty page over an unwritten block (or a
916+ * cow block over a hole) and subsequently skips zeroing the
917+ * newly post-EOF portion of the page. Flush the new EOF to
918+ * convert the block before the pagecache truncate.
919+ */
920+ error = filemap_write_and_wait_range(inode->i_mapping, newsize,
921+ newsize);
922+ if (error)
923+ return error;
914924 error = iomap_truncate_page(inode, newsize, &did_zeroing,
915925 &xfs_buffered_write_iomap_ops);
916926 }
fs/xfs/xfs_reflink.c+2−1
@@ -1502,7 +1502,8 @@ xfs_reflink_unshare( · 1501 unmodified lines
15021502 &xfs_buffered_write_iomap_ops);
15031503 if (error)
15041504 goto out;
1505− error = filemap_write_and_wait(inode->i_mapping);
1505+
1506+ error = filemap_write_and_wait_range(inode->i_mapping, offset, len);
15061507 if (error)
15071508 goto out;
15081509
include/kunit/test.h+8−8
@@ -252,13 +252,14 @@ static inline int kunit_run_all_tests(void) · 251 unmodified lines
252252 }
253253 #endif /* IS_BUILTIN(CONFIG_KUNIT) */
254254
255+#ifdef MODULE
255256 /**
256− * kunit_test_suites() - used to register one or more &struct kunit_suite
257− * with KUnit.
257+ * kunit_test_suites_for_module() - used to register one or more
258+ * &struct kunit_suite with KUnit.
258259 *
259− * @suites_list...: a statically allocated list of &struct kunit_suite.
260+ * @__suites: a statically allocated list of &struct kunit_suite.
260261 *
261− * Registers @suites_list with the test framework. See &struct kunit_suite for
262+ * Registers @__suites with the test framework. See &struct kunit_suite for
262263 * more information.
263264 *
264265 * If a test suite is built-in, module_init() gets translated into
@@ -267,7 +268,6 @@ static inline int kunit_run_all_tests(void) · 2 unmodified lines
267268 * module_{init|exit} functions for the builtin case when registering
268269 * suites via kunit_test_suites() below.
269270 */
270−#ifdef MODULE
271271 #define kunit_test_suites_for_module(__suites) \
272272 static int __init kunit_test_suites_init(void) \
273273 { \
@@ -294,7 +294,7 @@ static inline int kunit_run_all_tests(void) · 20 unmodified lines
294294 * kunit_test_suites() - used to register one or more &struct kunit_suite
295295 * with KUnit.
296296 *
297− * @suites: a statically allocated list of &struct kunit_suite.
297+ * @__suites: a statically allocated list of &struct kunit_suite.
298298 *
299299 * Registers @suites with the test framework. See &struct kunit_suite for
300300 * more information.
@@ -308,10 +308,10 @@ static inline int kunit_run_all_tests(void) · 7 unmodified lines
308308 * module.
309309 *
310310 */
311−#define kunit_test_suites(...) \
311+#define kunit_test_suites(__suites...) \
312312 __kunit_test_suites(__UNIQUE_ID(array), \
313313 __UNIQUE_ID(suites), \
314− __VA_ARGS__)
314+ ##__suites)
315315
316316 #define kunit_test_suite(suite) kunit_test_suites(&suite)
317317
include/linux/blk-mq.h+2−0
@@ -235,6 +235,8 @@ enum hctx_type { · 234 unmodified lines
235235 * @flags: Zero or more BLK_MQ_F_* flags.
236236 * @driver_data: Pointer to data owned by the block driver that created this
237237 * tag set.
238+ * @active_queues_shared_sbitmap:
239+ * number of active request queues per tag set.
238240 * @__bitmap_tags: A shared tags sbitmap, used over all hctx's
239241 * @__breserved_tags:
240242 * A shared reserved tags sbitmap, used over all hctx's
include/linux/can/skb.h+8−12
@@ -61,21 +61,17 @@ static inline void can_skb_set_owner(struct sk_buff *skb, struct sock *sk) · 60 unmodified lines
6161 */
6262 static inline struct sk_buff *can_create_echo_skb(struct sk_buff *skb)
6363 {
64− if (skb_shared(skb)) {
65− struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC);
64+ struct sk_buff *nskb;
6665
67− if (likely(nskb)) {
68− can_skb_set_owner(nskb, skb->sk);
69− consume_skb(skb);
70− return nskb;
71− } else {
72− kfree_skb(skb);
73− return NULL;
74− }
66+ nskb = skb_clone(skb, GFP_ATOMIC);
67+ if (unlikely(!nskb)) {
68+ kfree_skb(skb);
69+ return NULL;
7570 }
7671
77− /* we can assume to have an unshared skb with proper owner */
78− return skb;
72+ can_skb_set_owner(nskb, skb->sk);
73+ consume_skb(skb);
74+ return nskb;
7975 }
8076
8177 #endif /* !_CAN_SKB_H */
include/linux/io_uring.h+2−1
@@ -30,7 +30,8 @@ struct io_uring_task { · 29 unmodified lines
3030 struct percpu_counter inflight;
3131 struct io_identity __identity;
3232 struct io_identity *identity;
33− bool in_idle;
33+ atomic_t in_idle;
34+ bool sqpoll;
3435 };
3536
3637 #if defined(CONFIG_IO_URING)
include/linux/iomap.h+1−1
@@ -221,7 +221,7 @@ struct iomap_writeback_ops { · 220 unmodified lines
221221 * Optional, allows the file system to discard state on a page where
222222 * we failed to submit any I/O.
223223 */
224− void (*discard_page)(struct page *page);
224+ void (*discard_page)(struct page *page, loff_t fileoff);
225225 };
226226
227227 struct iomap_writepage_ctx {
include/linux/mm.h+9−0
@@ -2759,6 +2759,15 @@ static inline vm_fault_t vmf_insert_page(struct vm_area_struct *vma, · 2758 unmodified lines
27592759 return VM_FAULT_NOPAGE;
27602760 }
27612761
2762+#ifndef io_remap_pfn_range
2763+static inline int io_remap_pfn_range(struct vm_area_struct *vma,
2764+ unsigned long addr, unsigned long pfn,
2765+ unsigned long size, pgprot_t prot)
2766+{
2767+ return remap_pfn_range(vma, addr, pfn, size, pgprot_decrypted(prot));
2768+}
2769+#endif
2770+
27622771 static inline vm_fault_t vmf_error(int err)
27632772 {
27642773 if (err == -ENOMEM)
include/linux/netfilter/nfnetlink.h+8−1
@@ -24,6 +24,12 @@ struct nfnl_callback { · 23 unmodified lines
2424 const u_int16_t attr_count; /* number of nlattr's */
2525 };
2626
27+enum nfnl_abort_action {
28+ NFNL_ABORT_NONE = 0,
29+ NFNL_ABORT_AUTOLOAD,
30+ NFNL_ABORT_VALIDATE,
31+};
32+
2733 struct nfnetlink_subsystem {
2834 const char *name;
2935 __u8 subsys_id; /* nfnetlink subsystem ID */
@@ -31,7 +37,8 @@ struct nfnetlink_subsystem { · 1 unmodified line
3137 const struct nfnl_callback *cb; /* callback for individual types */
3238 struct module *owner;
3339 int (*commit)(struct net *net, struct sk_buff *skb);
34− int (*abort)(struct net *net, struct sk_buff *skb, bool autoload);
40+ int (*abort)(struct net *net, struct sk_buff *skb,
41+ enum nfnl_abort_action action);
3542 void (*cleanup)(struct net *net);
3643 bool (*valid_genid)(struct net *net, u32 genid);
3744 };
include/linux/netfilter_ipv4.h+1−1
@@ -16,7 +16,7 @@ struct ip_rt_info { · 15 unmodified lines
1616 u_int32_t mark;
1717 };
1818
19−int ip_route_me_harder(struct net *net, struct sk_buff *skb, unsigned addr_type);
19+int ip_route_me_harder(struct net *net, struct sock *sk, struct sk_buff *skb, unsigned addr_type);
2020
2121 struct nf_queue_entry;
2222
include/linux/netfilter_ipv6.h+5−5
@@ -42,7 +42,7 @@ struct nf_ipv6_ops { · 41 unmodified lines
4242 #if IS_MODULE(CONFIG_IPV6)
4343 int (*chk_addr)(struct net *net, const struct in6_addr *addr,
4444 const struct net_device *dev, int strict);
45− int (*route_me_harder)(struct net *net, struct sk_buff *skb);
45+ int (*route_me_harder)(struct net *net, struct sock *sk, struct sk_buff *skb);
4646 int (*dev_get_saddr)(struct net *net, const struct net_device *dev,
4747 const struct in6_addr *daddr, unsigned int srcprefs,
4848 struct in6_addr *saddr);
@@ -143,9 +143,9 @@ static inline int nf_br_ip6_fragment(struct net *net, struct sock *sk, · 94 unmodified lines
143143 #endif
144144 }
145145
146−int ip6_route_me_harder(struct net *net, struct sk_buff *skb);
146+int ip6_route_me_harder(struct net *net, struct sock *sk, struct sk_buff *skb);
147147
148−static inline int nf_ip6_route_me_harder(struct net *net, struct sk_buff *skb)
148+static inline int nf_ip6_route_me_harder(struct net *net, struct sock *sk, struct sk_buff *skb)
149149 {
150150 #if IS_MODULE(CONFIG_IPV6)
151151 const struct nf_ipv6_ops *v6_ops = nf_get_ipv6_ops();
@@ -153,9 +153,9 @@ static inline int nf_ip6_route_me_harder(struct net *net, struct sk_buff *skb) · 1 unmodified line
153153 if (!v6_ops)
154154 return -EHOSTUNREACH;
155155
156− return v6_ops->route_me_harder(net, skb);
156+ return v6_ops->route_me_harder(net, sk, skb);
157157 #elif IS_BUILTIN(CONFIG_IPV6)
158− return ip6_route_me_harder(net, skb);
158+ return ip6_route_me_harder(net, sk, skb);
159159 #else
160160 return -EHOSTUNREACH;
161161 #endif
include/linux/pagemap.h+4−4
@@ -344,9 +344,9 @@ static inline struct page *find_get_page_flags(struct address_space *mapping, · 343 unmodified lines
344344 /**
345345 * find_lock_page - locate, pin and lock a pagecache page
346346 * @mapping: the address_space to search
347− * @offset: the page index
347+ * @index: the page index
348348 *
349− * Looks up the page cache entry at @mapping & @offset. If there is a
349+ * Looks up the page cache entry at @mapping & @index. If there is a
350350 * page cache page, it is returned locked and with an increased
351351 * refcount.
352352 *
@@ -363,9 +363,9 @@ static inline struct page *find_lock_page(struct address_space *mapping, · 10 unmodified lines
363363 /**
364364 * find_lock_head - Locate, pin and lock a pagecache page.
365365 * @mapping: The address_space to search.
366− * @offset: The page index.
366+ * @index: The page index.
367367 *
368− * Looks up the page cache entry at @mapping & @offset. If there is a
368+ * Looks up the page cache entry at @mapping & @index. If there is a
369369 * page cache page, its head page is returned locked and with an increased
370370 * refcount.
371371 *
include/linux/pgtable.h+0−4
@@ -1427,10 +1427,6 @@ typedef unsigned int pgtbl_mod_mask; · 1426 unmodified lines
14271427
14281428 #endif /* !__ASSEMBLY__ */
14291429
1430−#ifndef io_remap_pfn_range
1431−#define io_remap_pfn_range remap_pfn_range
1432−#endif
1433−
14341430 #ifndef has_transparent_hugepage
14351431 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
14361432 #define has_transparent_hugepage() 1
include/linux/phy.h+5−35
@@ -147,16 +147,8 @@ typedef enum { · 146 unmodified lines
147147 PHY_INTERFACE_MODE_MAX,
148148 } phy_interface_t;
149149
150−/**
150+/*
151151 * phy_supported_speeds - return all speeds currently supported by a PHY device
152− * @phy: The PHY device to return supported speeds of.
153− * @speeds: buffer to store supported speeds in.
154− * @size: size of speeds buffer.
155− *
156− * Description: Returns the number of supported speeds, and fills
157− * the speeds buffer with the supported speeds. If speeds buffer is
158− * too small to contain all currently supported speeds, will return as
159− * many speeds as can fit.
160152 */
161153 unsigned int phy_supported_speeds(struct phy_device *phy,
162154 unsigned int *speeds,
@@ -1022,14 +1014,9 @@ static inline int __phy_modify_changed(struct phy_device *phydev, u32 regnum, · 859 unmodified lines
10221014 regnum, mask, set);
10231015 }
10241016
1025−/**
1017+/*
10261018 * phy_read_mmd - Convenience function for reading a register
10271019 * from an MMD on a given PHY.
1028− * @phydev: The phy_device struct
1029− * @devad: The MMD to read from
1030− * @regnum: The register on the MMD to read
1031− *
1032− * Same rules as for phy_read();
10331020 */
10341021 int phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum);
10351022
@@ -1064,38 +1051,21 @@ int phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum); · 28 unmodified lines
10641051 __ret; \
10651052 })
10661053
1067−/**
1054+/*
10681055 * __phy_read_mmd - Convenience function for reading a register
10691056 * from an MMD on a given PHY.
1070− * @phydev: The phy_device struct
1071− * @devad: The MMD to read from
1072− * @regnum: The register on the MMD to read
1073− *
1074− * Same rules as for __phy_read();
10751057 */
10761058 int __phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum);
10771059
1078−/**
1060+/*
10791061 * phy_write_mmd - Convenience function for writing a register
10801062 * on an MMD on a given PHY.
1081− * @phydev: The phy_device struct
1082− * @devad: The MMD to write to
1083− * @regnum: The register on the MMD to read
1084− * @val: value to write to @regnum
1085− *
1086− * Same rules as for phy_write();
10871063 */
10881064 int phy_write_mmd(struct phy_device *phydev, int devad, u32 regnum, u16 val);
10891065
1090−/**
1066+/*
10911067 * __phy_write_mmd - Convenience function for writing a register
10921068 * on an MMD on a given PHY.
1093− * @phydev: The phy_device struct
1094− * @devad: The MMD to write to
1095− * @regnum: The register on the MMD to read
1096− * @val: value to write to @regnum
1097− *
1098− * Same rules as for __phy_write();
10991069 */
11001070 int __phy_write_mmd(struct phy_device *phydev, int devad, u32 regnum, u16 val);
11011071
include/linux/pm_runtime.h+2−4
@@ -54,11 +54,10 @@ extern u64 pm_runtime_autosuspend_expiration(struct device *dev); · 53 unmodified lines
5454 extern void pm_runtime_update_max_time_suspended(struct device *dev,
5555 s64 delta_ns);
5656 extern void pm_runtime_set_memalloc_noio(struct device *dev, bool enable);
57−extern void pm_runtime_clean_up_links(struct device *dev);
5857 extern void pm_runtime_get_suppliers(struct device *dev);
5958 extern void pm_runtime_put_suppliers(struct device *dev);
6059 extern void pm_runtime_new_link(struct device *dev);
61−extern void pm_runtime_drop_link(struct device *dev);
60+extern void pm_runtime_drop_link(struct device_link *link);
6261
6362 /**
6463 * pm_runtime_get_if_in_use - Conditionally bump up runtime PM usage counter.
@@ -276,11 +275,10 @@ static inline u64 pm_runtime_autosuspend_expiration( · 211 unmodified lines
276275 struct device *dev) { return 0; }
277276 static inline void pm_runtime_set_memalloc_noio(struct device *dev,
278277 bool enable){}
279−static inline void pm_runtime_clean_up_links(struct device *dev) {}
280278 static inline void pm_runtime_get_suppliers(struct device *dev) {}
281279 static inline void pm_runtime_put_suppliers(struct device *dev) {}
282280 static inline void pm_runtime_new_link(struct device *dev) {}
283−static inline void pm_runtime_drop_link(struct device *dev) {}
281+static inline void pm_runtime_drop_link(struct device_link *link) {}
284282
285283 #endif /* !CONFIG_PM */
286284
include/linux/refcount.h+65−65
@@ -147,24 +147,6 @@ static inline unsigned int refcount_read(const refcount_t *r) · 146 unmodified lines
147147 return atomic_read(&r->refs);
148148 }
149149
150−/**
151− * refcount_add_not_zero - add a value to a refcount unless it is 0
152− * @i: the value to add to the refcount
153− * @r: the refcount
154− *
155− * Will saturate at REFCOUNT_SATURATED and WARN.
156− *
157− * Provides no memory ordering, it is assumed the caller has guaranteed the
158− * object memory to be stable (RCU, etc.). It does provide a control dependency
159− * and thereby orders future stores. See the comment on top.
160− *
161− * Use of this function is not recommended for the normal reference counting
162− * use case in which references are taken and released one at a time. In these
163− * cases, refcount_inc(), or one of its variants, should instead be used to
164− * increment a reference count.
165− *
166− * Return: false if the passed refcount is 0, true otherwise
167− */
168150 static inline __must_check bool __refcount_add_not_zero(int i, refcount_t *r, int *oldp)
169151 {
170152 int old = refcount_read(r);
@@ -183,17 +165,12 @@ static inline __must_check bool __refcount_add_not_zero(int i, refcount_t *r, in · 12 unmodified lines
183165 return old;
184166 }
185167
186−static inline __must_check bool refcount_add_not_zero(int i, refcount_t *r)
187−{
188− return __refcount_add_not_zero(i, r, NULL);
189−}
190−
191168 /**
192− * refcount_add - add a value to a refcount
169+ * refcount_add_not_zero - add a value to a refcount unless it is 0
193170 * @i: the value to add to the refcount
194171 * @r: the refcount
195172 *
196− * Similar to atomic_add(), but will saturate at REFCOUNT_SATURATED and WARN.
173+ * Will saturate at REFCOUNT_SATURATED and WARN.
197174 *
198175 * Provides no memory ordering, it is assumed the caller has guaranteed the
199176 * object memory to be stable (RCU, etc.). It does provide a control dependency
@@ -203,7 +180,14 @@ static inline __must_check bool refcount_add_not_zero(int i, refcount_t *r) · 3 unmodified lines
203180 * use case in which references are taken and released one at a time. In these
204181 * cases, refcount_inc(), or one of its variants, should instead be used to
205182 * increment a reference count.
183+ *
184+ * Return: false if the passed refcount is 0, true otherwise
206185 */
186+static inline __must_check bool refcount_add_not_zero(int i, refcount_t *r)
187+{
188+ return __refcount_add_not_zero(i, r, NULL);
189+}
190+
207191 static inline void __refcount_add(int i, refcount_t *r, int *oldp)
208192 {
209193 int old = atomic_fetch_add_relaxed(i, &r->refs);
@@ -217,11 +201,32 @@ static inline void __refcount_add(int i, refcount_t *r, int *oldp) · 7 unmodified lines
217201 refcount_warn_saturate(r, REFCOUNT_ADD_OVF);
218202 }
219203
204+/**
205+ * refcount_add - add a value to a refcount
206+ * @i: the value to add to the refcount
207+ * @r: the refcount
208+ *
209+ * Similar to atomic_add(), but will saturate at REFCOUNT_SATURATED and WARN.
210+ *
211+ * Provides no memory ordering, it is assumed the caller has guaranteed the
212+ * object memory to be stable (RCU, etc.). It does provide a control dependency
213+ * and thereby orders future stores. See the comment on top.
214+ *
215+ * Use of this function is not recommended for the normal reference counting
216+ * use case in which references are taken and released one at a time. In these
217+ * cases, refcount_inc(), or one of its variants, should instead be used to
218+ * increment a reference count.
219+ */
220220 static inline void refcount_add(int i, refcount_t *r)
221221 {
222222 __refcount_add(i, r, NULL);
223223 }
224224
225+static inline __must_check bool __refcount_inc_not_zero(refcount_t *r, int *oldp)
226+{
227+ return __refcount_add_not_zero(1, r, oldp);
228+}
229+
225230 /**
226231 * refcount_inc_not_zero - increment a refcount unless it is 0
227232 * @r: the refcount to increment
@@ -235,14 +240,14 @@ static inline void refcount_add(int i, refcount_t *r) · 7 unmodified lines
235240 *
236241 * Return: true if the increment was successful, false otherwise
237242 */
238−static inline __must_check bool __refcount_inc_not_zero(refcount_t *r, int *oldp)
243+static inline __must_check bool refcount_inc_not_zero(refcount_t *r)
239244 {
240− return __refcount_add_not_zero(1, r, oldp);
245+ return __refcount_inc_not_zero(r, NULL);
241246 }
242247
243−static inline __must_check bool refcount_inc_not_zero(refcount_t *r)
248+static inline void __refcount_inc(refcount_t *r, int *oldp)
244249 {
245− return __refcount_inc_not_zero(r, NULL);
250+ __refcount_add(1, r, oldp);
246251 }
247252
248253 /**
@@ -257,14 +262,27 @@ static inline __must_check bool refcount_inc_not_zero(refcount_t *r) · 8 unmodified lines
257262 * Will WARN if the refcount is 0, as this represents a possible use-after-free
258263 * condition.
259264 */
260−static inline void __refcount_inc(refcount_t *r, int *oldp)
265+static inline void refcount_inc(refcount_t *r)
261266 {
262− __refcount_add(1, r, oldp);
267+ __refcount_inc(r, NULL);
263268 }
264269
265−static inline void refcount_inc(refcount_t *r)
270+static inline __must_check bool __refcount_sub_and_test(int i, refcount_t *r, int *oldp)
266271 {
267− __refcount_inc(r, NULL);
272+ int old = atomic_fetch_sub_release(i, &r->refs);
273+
274+ if (oldp)
275+ *oldp = old;
276+
277+ if (old == i) {
278+ smp_acquire__after_ctrl_dep();
279+ return true;
280+ }
281+
282+ if (unlikely(old < 0 || old - i < 0))
283+ refcount_warn_saturate(r, REFCOUNT_SUB_UAF);
284+
285+ return false;
268286 }
269287
270288 /**
@@ -287,27 +305,14 @@ static inline void refcount_inc(refcount_t *r) · 16 unmodified lines
287305 *
288306 * Return: true if the resulting refcount is 0, false otherwise
289307 */
290−static inline __must_check bool __refcount_sub_and_test(int i, refcount_t *r, int *oldp)
308+static inline __must_check bool refcount_sub_and_test(int i, refcount_t *r)
291309 {
292− int old = atomic_fetch_sub_release(i, &r->refs);
293−
294− if (oldp)
295− *oldp = old;
296−
297− if (old == i) {
298− smp_acquire__after_ctrl_dep();
299− return true;
300− }
301−
302− if (unlikely(old < 0 || old - i < 0))
303− refcount_warn_saturate(r, REFCOUNT_SUB_UAF);
304−
305− return false;
310+ return __refcount_sub_and_test(i, r, NULL);
306311 }
307312
308−static inline __must_check bool refcount_sub_and_test(int i, refcount_t *r)
313+static inline __must_check bool __refcount_dec_and_test(refcount_t *r, int *oldp)
309314 {
310− return __refcount_sub_and_test(i, r, NULL);
315+ return __refcount_sub_and_test(1, r, oldp);
311316 }
312317
313318 /**
@@ -323,26 +328,11 @@ static inline __must_check bool refcount_sub_and_test(int i, refcount_t *r) · 9 unmodified lines
323328 *
324329 * Return: true if the resulting refcount is 0, false otherwise
325330 */
326−static inline __must_check bool __refcount_dec_and_test(refcount_t *r, int *oldp)
327−{
328− return __refcount_sub_and_test(1, r, oldp);
329−}
330−
331331 static inline __must_check bool refcount_dec_and_test(refcount_t *r)
332332 {
333333 return __refcount_dec_and_test(r, NULL);
334334 }
335335
336−/**
337− * refcount_dec - decrement a refcount
338− * @r: the refcount
339− *
340− * Similar to atomic_dec(), it will WARN on underflow and fail to decrement
341− * when saturated at REFCOUNT_SATURATED.
342− *
343− * Provides release memory ordering, such that prior loads and stores are done
344− * before.
345− */
346336 static inline void __refcount_dec(refcount_t *r, int *oldp)
347337 {
348338 int old = atomic_fetch_sub_release(1, &r->refs);
@@ -354,6 +344,16 @@ static inline void __refcount_dec(refcount_t *r, int *oldp) · 5 unmodified lines
354344 refcount_warn_saturate(r, REFCOUNT_DEC_LEAK);
355345 }
356346
347+/**
348+ * refcount_dec - decrement a refcount
349+ * @r: the refcount
350+ *
351+ * Similar to atomic_dec(), it will WARN on underflow and fail to decrement
352+ * when saturated at REFCOUNT_SATURATED.
353+ *
354+ * Provides release memory ordering, such that prior loads and stores are done
355+ * before.
356+ */
357357 static inline void refcount_dec(refcount_t *r)
358358 {
359359 __refcount_dec(r, NULL);
include/linux/seq_file.h+1−0
@@ -107,6 +107,7 @@ void seq_pad(struct seq_file *m, char c); · 106 unmodified lines
107107 char *mangle_path(char *s, const char *p, const char *esc);
108108 int seq_open(struct file *, const struct seq_operations *);
109109 ssize_t seq_read(struct file *, char __user *, size_t, loff_t *);
110+ssize_t seq_read_iter(struct kiocb *iocb, struct iov_iter *iter);
110111 loff_t seq_lseek(struct file *, loff_t, int);
111112 int seq_release(struct inode *, struct file *);
112113 int seq_write(struct seq_file *seq, const void *data, size_t len);
include/net/cfg80211.h+5−4
@@ -1444,7 +1444,7 @@ int cfg80211_check_station_change(struct wiphy *wiphy, · 1443 unmodified lines
14441444 enum cfg80211_station_type statype);
14451445
14461446 /**
1447− * enum station_info_rate_flags - bitrate info flags
1447+ * enum rate_info_flags - bitrate info flags
14481448 *
14491449 * Used by the driver to indicate the specific rate transmission
14501450 * type for 802.11n transmissions.
@@ -1517,7 +1517,7 @@ struct rate_info { · 66 unmodified lines
15171517 };
15181518
15191519 /**
1520− * enum station_info_rate_flags - bitrate info flags
1520+ * enum bss_param_flags - bitrate info flags
15211521 *
15221522 * Used by the driver to indicate the specific rate transmission
15231523 * type for 802.11n transmissions.
@@ -6467,7 +6467,8 @@ void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, · 4943 unmodified lines
64676467 struct ieee80211_channel *channel, gfp_t gfp);
64686468
64696469 /**
6470− * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate
6470+ * cfg80211_notify_new_peer_candidate - notify cfg80211 of a new mesh peer
6471+ * candidate
64716472 *
64726473 * @dev: network device
64736474 * @macaddr: the MAC address of the new candidate
@@ -7606,7 +7607,7 @@ u32 cfg80211_calculate_bitrate(struct rate_info *rate); · 1132 unmodified lines
76067607 void cfg80211_unregister_wdev(struct wireless_dev *wdev);
76077608
76087609 /**
7609− * struct cfg80211_ft_event - FT Information Elements
7610+ * struct cfg80211_ft_event_params - FT Information Elements
76107611 * @ies: FT IEs
76117612 * @ies_len: length of the FT IE in bytes
76127613 * @target_ap: target AP's MAC address
include/net/mac80211.h+4−3
@@ -3311,7 +3311,7 @@ enum ieee80211_roc_type { · 3310 unmodified lines
33113311 };
33123312
33133313 /**
3314− * enum ieee80211_reconfig_complete_type - reconfig type
3314+ * enum ieee80211_reconfig_type - reconfig type
33153315 *
33163316 * This enum is used by the reconfig_complete() callback to indicate what
33173317 * reconfiguration type was completed.
@@ -6334,7 +6334,8 @@ bool ieee80211_tx_prepare_skb(struct ieee80211_hw *hw, · 3016 unmodified lines
63346334 int band, struct ieee80211_sta **sta);
63356335
63366336 /**
6337− * Sanity-check and parse the radiotap header of injected frames
6337+ * ieee80211_parse_tx_radiotap - Sanity-check and parse the radiotap header
6338+ * of injected frames
63386339 * @skb: packet injected by userspace
63396340 * @dev: the &struct device of this 802.11 device
63406341 */
@@ -6389,7 +6390,7 @@ int ieee80211_parse_p2p_noa(const struct ieee80211_p2p_noa_attr *attr, · 48 unmodified lines
63896390 void ieee80211_update_p2p_noa(struct ieee80211_noa_data *data, u32 tsf);
63906391
63916392 /**
6392− * ieee80211_tdls_oper - request userspace to perform a TDLS operation
6393+ * ieee80211_tdls_oper_request - request userspace to perform a TDLS operation
63936394 * @vif: virtual interface
63946395 * @peer: the peer's destination address
63956396 * @oper: the requested TDLS operation
include/sound/control.h+1−1
@@ -42,7 +42,7 @@ struct snd_kcontrol_new { · 41 unmodified lines
4242 snd_ctl_elem_iface_t iface; /* interface identifier */
4343 unsigned int device; /* device/client number */
4444 unsigned int subdevice; /* subdevice (substream) number */
45− const unsigned char *name; /* ASCII name of item */
45+ const char *name; /* ASCII name of item */
4646 unsigned int index; /* index of item */
4747 unsigned int access; /* access rights */
4848 unsigned int count; /* count of same elements */
include/sound/core.h+2−1
@@ -332,7 +332,8 @@ void __snd_printk(unsigned int level, const char *file, int line, · 331 unmodified lines
332332 #define snd_BUG() WARN(1, "BUG?\n")
333333
334334 /**
335− * Suppress high rates of output when CONFIG_SND_DEBUG is enabled.
335+ * snd_printd_ratelimit - Suppress high rates of output when
336+ * CONFIG_SND_DEBUG is enabled.
336337 */
337338 #define snd_printd_ratelimit() printk_ratelimit()
338339
include/sound/pcm.h+2−2
@@ -1284,8 +1284,8 @@ snd_pcm_sgbuf_get_ptr(struct snd_pcm_substream *substream, unsigned int ofs) · 1283 unmodified lines
12841284 }
12851285
12861286 /**
1287− * snd_pcm_sgbuf_chunk_size - Compute the max size that fits within the contig.
1288− * page from the given size
1287+ * snd_pcm_sgbuf_get_chunk_size - Compute the max size that fits within the
1288+ * contig. page from the given size
12891289 * @substream: PCM substream
12901290 * @ofs: byte offset
12911291 * @size: byte size to examine
include/uapi/linux/icmpv6.h+1−0
@@ -138,6 +138,7 @@ struct icmp6hdr { · 137 unmodified lines
138138 #define ICMPV6_HDR_FIELD 0
139139 #define ICMPV6_UNK_NEXTHDR 1
140140 #define ICMPV6_UNK_OPTION 2
141+#define ICMPV6_HDR_INCOMP 3
141142
142143 /*
143144 * constants for (set|get)sockopt
include/uapi/sound/compress_offload.h+1−1
@@ -144,7 +144,7 @@ struct snd_compr_metadata { · 143 unmodified lines
144144 __u32 value[8];
145145 } __attribute__((packed, aligned(4)));
146146
147−/**
147+/*
148148 * compress path ioctl definitions
149149 * SNDRV_COMPRESS_GET_CAPS: Query capability of DSP
150150 * SNDRV_COMPRESS_GET_CODEC_CAPS: Query capability of a codec
include/video/imx-ipu-v3.h+0−3
@@ -484,9 +484,6 @@ int ipu_smfc_set_watermark(struct ipu_smfc *smfc, u32 set_level, u32 clr_level); · 483 unmodified lines
484484
485485 enum ipu_color_space ipu_drm_fourcc_to_colorspace(u32 drm_fourcc);
486486 enum ipu_color_space ipu_pixelformat_to_colorspace(u32 pixelformat);
487−enum ipu_color_space ipu_mbus_code_to_colorspace(u32 mbus_code);
488−int ipu_stride_to_bytes(u32 pixel_stride, u32 pixelformat);
489−bool ipu_pixelformat_is_planar(u32 pixelformat);
490487 int ipu_degrees_to_rot_mode(enum ipu_rotate_mode *mode, int degrees,
491488 bool hflip, bool vflip);
492489 int ipu_rot_mode_to_degrees(int *degrees, enum ipu_rotate_mode mode,
kernel/entry/common.c+2−2
@@ -337,10 +337,10 @@ noinstr irqentry_state_t irqentry_enter(struct pt_regs *regs) · 336 unmodified lines
337337 * already contains a warning when RCU is not watching, so no point
338338 * in having another one here.
339339 */
340+ lockdep_hardirqs_off(CALLER_ADDR0);
340341 instrumentation_begin();
341342 rcu_irq_enter_check_tick();
342− /* Use the combo lockdep/tracing function */
343− trace_hardirqs_off();
343+ trace_hardirqs_off_finish();
344344 instrumentation_end();
345345
346346 return ret;
kernel/events/core.c+5−7
@@ -10085,6 +10085,7 @@ perf_event_parse_addr_filter(struct perf_event *event, char *fstr, · 10084 unmodified lines
1008510085 if (token == IF_SRC_FILE || token == IF_SRC_FILEADDR) {
1008610086 int fpos = token == IF_SRC_FILE ? 2 : 1;
1008710087
10088+ kfree(filename);
1008810089 filename = match_strdup(&args[fpos]);
1008910090 if (!filename) {
1009010091 ret = -ENOMEM;
@@ -10131,16 +10132,13 @@ perf_event_parse_addr_filter(struct perf_event *event, char *fstr, · 40 unmodified lines
1013110132 */
1013210133 ret = -EOPNOTSUPP;
1013310134 if (!event->ctx->task)
10134− goto fail_free_name;
10135+ goto fail;
1013510136
1013610137 /* look up the path and grab its inode */
1013710138 ret = kern_path(filename, LOOKUP_FOLLOW,
1013810139 &filter->path);
1013910140 if (ret)
10140− goto fail_free_name;
10141−
10142− kfree(filename);
10143− filename = NULL;
10141+ goto fail;
1014410142
1014510143 ret = -EINVAL;
1014610144 if (!filter->path.dentry ||
@@ -10160,13 +10158,13 @@ perf_event_parse_addr_filter(struct perf_event *event, char *fstr, · 13 unmodified lines
1016010158 if (state != IF_STATE_ACTION)
1016110159 goto fail;
1016210160
10161+ kfree(filename);
1016310162 kfree(orig);
1016410163
1016510164 return 0;
1016610165
10167−fail_free_name:
10168− kfree(filename);
1016910166 fail:
10167+ kfree(filename);
1017010168 free_filters_list(filters);
1017110169 kfree(orig);
1017210170
kernel/fork.c+5−5
@@ -2167,14 +2167,9 @@ static __latent_entropy struct task_struct *copy_process( · 2166 unmodified lines
21672167 /* ok, now we should be set up.. */
21682168 p->pid = pid_nr(pid);
21692169 if (clone_flags & CLONE_THREAD) {
2170− p->exit_signal = -1;
21712170 p->group_leader = current->group_leader;
21722171 p->tgid = current->tgid;
21732172 } else {
2174− if (clone_flags & CLONE_PARENT)
2175− p->exit_signal = current->group_leader->exit_signal;
2176− else
2177− p->exit_signal = args->exit_signal;
21782173 p->group_leader = p;
21792174 p->tgid = p->pid;
21802175 }
@@ -2218,9 +2213,14 @@ static __latent_entropy struct task_struct *copy_process( · 37 unmodified lines
22182213 if (clone_flags & (CLONE_PARENT|CLONE_THREAD)) {
22192214 p->real_parent = current->real_parent;
22202215 p->parent_exec_id = current->parent_exec_id;
2216+ if (clone_flags & CLONE_THREAD)
2217+ p->exit_signal = -1;
2218+ else
2219+ p->exit_signal = current->group_leader->exit_signal;
22212220 } else {
22222221 p->real_parent = current;
22232222 p->parent_exec_id = current->self_exec_id;
2223+ p->exit_signal = args->exit_signal;
22242224 }
22252225
22262226 klp_copy_process(p);
kernel/futex.c+14−2
@@ -2380,10 +2380,22 @@ retry: · 2379 unmodified lines
23802380 }
23812381
23822382 /*
2383− * Since we just failed the trylock; there must be an owner.
2383+ * The trylock just failed, so either there is an owner or
2384+ * there is a higher priority waiter than this one.
23842385 */
23852386 newowner = rt_mutex_owner(&pi_state->pi_mutex);
2386− BUG_ON(!newowner);
2387+ /*
2388+ * If the higher priority waiter has not yet taken over the
2389+ * rtmutex then newowner is NULL. We can't return here with
2390+ * that state because it's inconsistent vs. the user space
2391+ * state. So drop the locks and try again. It's a valid
2392+ * situation and not any different from the other retry
2393+ * conditions.
2394+ */
2395+ if (unlikely(!newowner)) {
2396+ err = -EAGAIN;
2397+ goto handle_err;
2398+ }
23872399 } else {
23882400 WARN_ON_ONCE(argowner != current);
23892401 if (oldowner == current) {
kernel/hung_task.c+1−2
@@ -225,8 +225,7 @@ static long hung_timeout_jiffies(unsigned long last_checked, · 224 unmodified lines
225225 * Process updating of timeout sysctl
226226 */
227227 int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,
228− void __user *buffer,
229− size_t *lenp, loff_t *ppos)
228+ void *buffer, size_t *lenp, loff_t *ppos)
230229 {
231230 int ret;
232231
kernel/irq/Kconfig+1−0
@@ -82,6 +82,7 @@ config IRQ_FASTEOI_HIERARCHY_HANDLERS · 81 unmodified lines
8282 # Generic IRQ IPI support
8383 config GENERIC_IRQ_IPI
8484 bool
85+ select IRQ_DOMAIN_HIERARCHY
8586
8687 # Generic MSI interrupt support
8788 config GENERIC_MSI_IRQ
kernel/kprobes.c+21−4
@@ -1249,7 +1249,13 @@ __acquires(hlist_lock) · 1248 unmodified lines
12491249
12501250 *head = &kretprobe_inst_table[hash];
12511251 hlist_lock = kretprobe_table_lock_ptr(hash);
1252− raw_spin_lock_irqsave(hlist_lock, *flags);
1252+ /*
1253+ * Nested is a workaround that will soon not be needed.
1254+ * There's other protections that make sure the same lock
1255+ * is not taken on the same CPU that lockdep is unaware of.
1256+ * Differentiate when it is taken in NMI context.
1257+ */
1258+ raw_spin_lock_irqsave_nested(hlist_lock, *flags, !!in_nmi());
12531259 }
12541260 NOKPROBE_SYMBOL(kretprobe_hash_lock);
12551261
@@ -1258,7 +1264,13 @@ static void kretprobe_table_lock(unsigned long hash, · 2 unmodified lines
12581264 __acquires(hlist_lock)
12591265 {
12601266 raw_spinlock_t *hlist_lock = kretprobe_table_lock_ptr(hash);
1261− raw_spin_lock_irqsave(hlist_lock, *flags);
1267+ /*
1268+ * Nested is a workaround that will soon not be needed.
1269+ * There's other protections that make sure the same lock
1270+ * is not taken on the same CPU that lockdep is unaware of.
1271+ * Differentiate when it is taken in NMI context.
1272+ */
1273+ raw_spin_lock_irqsave_nested(hlist_lock, *flags, !!in_nmi());
12621274 }
12631275 NOKPROBE_SYMBOL(kretprobe_table_lock);
12641276
@@ -2028,7 +2040,12 @@ static int pre_handler_kretprobe(struct kprobe *p, struct pt_regs *regs) · 763 unmodified lines
20282040
20292041 /* TODO: consider to only swap the RA after the last pre_handler fired */
20302042 hash = hash_ptr(current, KPROBE_HASH_BITS);
2031− raw_spin_lock_irqsave(&rp->lock, flags);
2043+ /*
2044+ * Nested is a workaround that will soon not be needed.
2045+ * There's other protections that make sure the same lock
2046+ * is not taken on the same CPU that lockdep is unaware of.
2047+ */
2048+ raw_spin_lock_irqsave_nested(&rp->lock, flags, 1);
20322049 if (!hlist_empty(&rp->free_instances)) {
20332050 ri = hlist_entry(rp->free_instances.first,
20342051 struct kretprobe_instance, hlist);
@@ -2039,7 +2056,7 @@ static int pre_handler_kretprobe(struct kprobe *p, struct pt_regs *regs) · 4 unmodified lines
20392056 ri->task = current;
20402057
20412058 if (rp->entry_handler && rp->entry_handler(ri, regs)) {
2042− raw_spin_lock_irqsave(&rp->lock, flags);
2059+ raw_spin_lock_irqsave_nested(&rp->lock, flags, 1);
20432060 hlist_add_head(&ri->hlist, &rp->free_instances);
20442061 raw_spin_unlock_irqrestore(&rp->lock, flags);
20452062 return 0;
kernel/kthread.c+2−1
@@ -897,7 +897,8 @@ void kthread_delayed_work_timer_fn(struct timer_list *t) · 896 unmodified lines
897897 /* Move the work from worker->delayed_work_list. */
898898 WARN_ON_ONCE(list_empty(&work->node));
899899 list_del_init(&work->node);
900− kthread_insert_work(worker, work, &worker->work_list);
900+ if (!work->canceling)
901+ kthread_insert_work(worker, work, &worker->work_list);
901902
902903 raw_spin_unlock_irqrestore(&worker->lock, flags);
903904 }
kernel/sched/cpufreq_schedutil.c+10−12
@@ -102,9 +102,12 @@ static bool sugov_should_update_freq(struct sugov_policy *sg_policy, u64 time) · 101 unmodified lines
102102 static bool sugov_update_next_freq(struct sugov_policy *sg_policy, u64 time,
103103 unsigned int next_freq)
104104 {
105− if (sg_policy->next_freq == next_freq &&
106− !cpufreq_driver_test_flags(CPUFREQ_NEED_UPDATE_LIMITS))
107− return false;
105+ if (!sg_policy->need_freq_update) {
106+ if (sg_policy->next_freq == next_freq)
107+ return false;
108+ } else {
109+ sg_policy->need_freq_update = cpufreq_driver_test_flags(CPUFREQ_NEED_UPDATE_LIMITS);
110+ }
108111
109112 sg_policy->next_freq = next_freq;
110113 sg_policy->last_freq_update_time = time;
@@ -162,11 +165,9 @@ static unsigned int get_next_freq(struct sugov_policy *sg_policy, · 51 unmodified lines
162165
163166 freq = map_util_freq(util, freq, max);
164167
165− if (freq == sg_policy->cached_raw_freq && !sg_policy->need_freq_update &&
166− !cpufreq_driver_test_flags(CPUFREQ_NEED_UPDATE_LIMITS))
168+ if (freq == sg_policy->cached_raw_freq && !sg_policy->need_freq_update)
167169 return sg_policy->next_freq;
168170
169− sg_policy->need_freq_update = false;
170171 sg_policy->cached_raw_freq = freq;
171172 return cpufreq_driver_resolve_freq(policy, freq);
172173 }
@@ -442,7 +443,6 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, · 269 unmodified lines
442443 struct sugov_policy *sg_policy = sg_cpu->sg_policy;
443444 unsigned long util, max;
444445 unsigned int next_f;
445− bool busy;
446446 unsigned int cached_freq = sg_policy->cached_raw_freq;
447447
448448 sugov_iowait_boost(sg_cpu, time, flags);
@@ -453,9 +453,6 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, · 4 unmodified lines
453453 if (!sugov_should_update_freq(sg_policy, time))
454454 return;
455455
456− /* Limits may have changed, don't skip frequency update */
457− busy = !sg_policy->need_freq_update && sugov_cpu_is_busy(sg_cpu);
458−
459456 util = sugov_get_util(sg_cpu);
460457 max = sg_cpu->max;
461458 util = sugov_iowait_apply(sg_cpu, time, util, max);
@@ -464,7 +461,7 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, · 2 unmodified lines
464461 * Do not reduce the frequency if the CPU has not been idle
465462 * recently, as the reduction is likely to be premature then.
466463 */
467− if (busy && next_f < sg_policy->next_freq) {
464+ if (sugov_cpu_is_busy(sg_cpu) && next_f < sg_policy->next_freq) {
468465 next_f = sg_policy->next_freq;
469466
470467 /* Restore cached freq as next_freq has changed */
@@ -829,9 +826,10 @@ static int sugov_start(struct cpufreq_policy *policy) · 358 unmodified lines
829826 sg_policy->next_freq = 0;
830827 sg_policy->work_in_progress = false;
831828 sg_policy->limits_changed = false;
832− sg_policy->need_freq_update = false;
833829 sg_policy->cached_raw_freq = 0;
834830
831+ sg_policy->need_freq_update = cpufreq_driver_test_flags(CPUFREQ_NEED_UPDATE_LIMITS);
832+
835833 for_each_cpu(cpu, policy->cpus) {
836834 struct sugov_cpu *sg_cpu = &per_cpu(sugov_cpu, cpu);
837835
kernel/signal.c+10−9
@@ -391,16 +391,17 @@ static bool task_participate_group_stop(struct task_struct *task) · 390 unmodified lines
391391
392392 void task_join_group_stop(struct task_struct *task)
393393 {
394+ unsigned long mask = current->jobctl & JOBCTL_STOP_SIGMASK;
395+ struct signal_struct *sig = current->signal;
396+
397+ if (sig->group_stop_count) {
398+ sig->group_stop_count++;
399+ mask |= JOBCTL_STOP_CONSUME;
400+ } else if (!(sig->flags & SIGNAL_STOP_STOPPED))
401+ return;
402+
394403 /* Have the new thread join an on-going signal group stop */
395− unsigned long jobctl = current->jobctl;
396− if (jobctl & JOBCTL_STOP_PENDING) {
397− struct signal_struct *sig = current->signal;
398− unsigned long signr = jobctl & JOBCTL_STOP_SIGMASK;
399− unsigned long gstop = JOBCTL_STOP_PENDING | JOBCTL_STOP_CONSUME;
400− if (task_set_jobctl_pending(task, signr | gstop)) {
401− sig->group_stop_count++;
402− }
403− }
404+ task_set_jobctl_pending(task, mask | JOBCTL_STOP_PENDING);
404405 }
405406
406407 /*
kernel/trace/ring_buffer.c+46−12
@@ -438,14 +438,16 @@ enum { · 437 unmodified lines
438438 };
439439 /*
440440 * Used for which event context the event is in.
441− * NMI = 0
442− * IRQ = 1
443− * SOFTIRQ = 2
444− * NORMAL = 3
441+ * TRANSITION = 0
442+ * NMI = 1
443+ * IRQ = 2
444+ * SOFTIRQ = 3
445+ * NORMAL = 4
445446 *
446447 * See trace_recursive_lock() comment below for more details.
447448 */
448449 enum {
450+ RB_CTX_TRANSITION,
449451 RB_CTX_NMI,
450452 RB_CTX_IRQ,
451453 RB_CTX_SOFTIRQ,
@@ -3014,10 +3016,10 @@ rb_wakeups(struct trace_buffer *buffer, struct ring_buffer_per_cpu *cpu_buffer) · 2562 unmodified lines
30143016 * a bit of overhead in something as critical as function tracing,
30153017 * we use a bitmask trick.
30163018 *
3017− * bit 0 = NMI context
3018− * bit 1 = IRQ context
3019− * bit 2 = SoftIRQ context
3020− * bit 3 = normal context.
3019+ * bit 1 = NMI context
3020+ * bit 2 = IRQ context
3021+ * bit 3 = SoftIRQ context
3022+ * bit 4 = normal context.
30213023 *
30223024 * This works because this is the order of contexts that can
30233025 * preempt other contexts. A SoftIRQ never preempts an IRQ
@@ -3040,6 +3042,30 @@ rb_wakeups(struct trace_buffer *buffer, struct ring_buffer_per_cpu *cpu_buffer) · 16 unmodified lines
30403042 * The least significant bit can be cleared this way, and it
30413043 * just so happens that it is the same bit corresponding to
30423044 * the current context.
3045+ *
3046+ * Now the TRANSITION bit breaks the above slightly. The TRANSITION bit
3047+ * is set when a recursion is detected at the current context, and if
3048+ * the TRANSITION bit is already set, it will fail the recursion.
3049+ * This is needed because there's a lag between the changing of
3050+ * interrupt context and updating the preempt count. In this case,
3051+ * a false positive will be found. To handle this, one extra recursion
3052+ * is allowed, and this is done by the TRANSITION bit. If the TRANSITION
3053+ * bit is already set, then it is considered a recursion and the function
3054+ * ends. Otherwise, the TRANSITION bit is set, and that bit is returned.
3055+ *
3056+ * On the trace_recursive_unlock(), the TRANSITION bit will be the first
3057+ * to be cleared. Even if it wasn't the context that set it. That is,
3058+ * if an interrupt comes in while NORMAL bit is set and the ring buffer
3059+ * is called before preempt_count() is updated, since the check will
3060+ * be on the NORMAL bit, the TRANSITION bit will then be set. If an
3061+ * NMI then comes in, it will set the NMI bit, but when the NMI code
3062+ * does the trace_recursive_unlock() it will clear the TRANSTION bit
3063+ * and leave the NMI bit set. But this is fine, because the interrupt
3064+ * code that set the TRANSITION bit will then clear the NMI bit when it
3065+ * calls trace_recursive_unlock(). If another NMI comes in, it will
3066+ * set the TRANSITION bit and continue.
3067+ *
3068+ * Note: The TRANSITION bit only handles a single transition between context.
30433069 */
30443070
30453071 static __always_inline int
@@ -3055,8 +3081,16 @@ trace_recursive_lock(struct ring_buffer_per_cpu *cpu_buffer) · 9 unmodified lines
30553081 bit = pc & NMI_MASK ? RB_CTX_NMI :
30563082 pc & HARDIRQ_MASK ? RB_CTX_IRQ : RB_CTX_SOFTIRQ;
30573083
3058− if (unlikely(val & (1 << (bit + cpu_buffer->nest))))
3059− return 1;
3084+ if (unlikely(val & (1 << (bit + cpu_buffer->nest)))) {
3085+ /*
3086+ * It is possible that this was called by transitioning
3087+ * between interrupt context, and preempt_count() has not
3088+ * been updated yet. In this case, use the TRANSITION bit.
3089+ */
3090+ bit = RB_CTX_TRANSITION;
3091+ if (val & (1 << (bit + cpu_buffer->nest)))
3092+ return 1;
3093+ }
30603094
30613095 val |= (1 << (bit + cpu_buffer->nest));
30623096 cpu_buffer->current_context = val;
@@ -3071,8 +3105,8 @@ trace_recursive_unlock(struct ring_buffer_per_cpu *cpu_buffer) · 8 unmodified lines
30713105 cpu_buffer->current_context - (1 << cpu_buffer->nest);
30723106 }
30733107
3074−/* The recursive locking above uses 4 bits */
3075−#define NESTED_BITS 4
3108+/* The recursive locking above uses 5 bits */
3109+#define NESTED_BITS 5
30763110
30773111 /**
30783112 * ring_buffer_nest_start - Allow to trace while nested
kernel/trace/trace.c+3−3
@@ -2750,7 +2750,7 @@ trace_event_buffer_lock_reserve(struct trace_buffer **current_rb, · 2749 unmodified lines
27502750 /*
27512751 * If tracing is off, but we have triggers enabled
27522752 * we still need to look at the event data. Use the temp_buffer
2753− * to store the trace event for the tigger to use. It's recusive
2753+ * to store the trace event for the trigger to use. It's recursive
27542754 * safe and will not be recorded anywhere.
27552755 */
27562756 if (!entry && trace_file->flags & EVENT_FILE_FL_TRIGGER_COND) {
@@ -2952,7 +2952,7 @@ static void __ftrace_trace_stack(struct trace_buffer *buffer, · 195 unmodified lines
29522952 stackidx = __this_cpu_inc_return(ftrace_stack_reserve) - 1;
29532953
29542954 /* This should never happen. If it does, yell once and skip */
2955− if (WARN_ON_ONCE(stackidx > FTRACE_KSTACK_NESTING))
2955+ if (WARN_ON_ONCE(stackidx >= FTRACE_KSTACK_NESTING))
29562956 goto out;
29572957
29582958 /*
@@ -3132,7 +3132,7 @@ static char *get_trace_buf(void) · 173 unmodified lines
31323132
31333133 /* Interrupts must see nesting incremented before we use the buffer */
31343134 barrier();
3135− return &buffer->buffer[buffer->nesting][0];
3135+ return &buffer->buffer[buffer->nesting - 1][0];
31363136 }
31373137
31383138 static void put_trace_buf(void)
kernel/trace/trace.h+23−3
@@ -637,6 +637,12 @@ enum { · 636 unmodified lines
637637 * function is called to clear it.
638638 */
639639 TRACE_GRAPH_NOTRACE_BIT,
640+
641+ /*
642+ * When transitioning between context, the preempt_count() may
643+ * not be correct. Allow for a single recursion to cover this case.
644+ */
645+ TRACE_TRANSITION_BIT,
640646 };
641647
642648 #define trace_recursion_set(bit) do { (current)->trace_recursion |= (1<<(bit)); } while (0)
@@ -691,14 +697,27 @@ static __always_inline int trace_test_and_set_recursion(int start, int max) · 48 unmodified lines
691697 return 0;
692698
693699 bit = trace_get_context_bit() + start;
694− if (unlikely(val & (1 << bit)))
695− return -1;
700+ if (unlikely(val & (1 << bit))) {
701+ /*
702+ * It could be that preempt_count has not been updated during
703+ * a switch between contexts. Allow for a single recursion.
704+ */
705+ bit = TRACE_TRANSITION_BIT;
706+ if (trace_recursion_test(bit))
707+ return -1;
708+ trace_recursion_set(bit);
709+ barrier();
710+ return bit + 1;
711+ }
712+
713+ /* Normal check passed, clear the transition to allow it again */
714+ trace_recursion_clear(TRACE_TRANSITION_BIT);
696715
697716 val |= 1 << bit;
698717 current->trace_recursion = val;
699718 barrier();
700719
701− return bit;
720+ return bit + 1;
702721 }
703722
704723 static __always_inline void trace_clear_recursion(int bit)
@@ -708,6 +727,7 @@ static __always_inline void trace_clear_recursion(int bit) · 3 unmodified lines
708727 if (!bit)
709728 return;
710729
730+ bit--;
711731 bit = 1 << bit;
712732 val &= ~bit;
713733
kernel/trace/trace_events_synth.c+7−10
@@ -584,7 +584,7 @@ static struct synth_field *parse_synth_field(int argc, const char **argv, · 583 unmodified lines
584584 {
585585 struct synth_field *field;
586586 const char *prefix = NULL, *field_type = argv[0], *field_name, *array;
587− int len, ret = 0;
587+ int len, ret = -ENOMEM;
588588 struct seq_buf s;
589589 ssize_t size;
590590
@@ -617,10 +617,9 @@ static struct synth_field *parse_synth_field(int argc, const char **argv, · 26 unmodified lines
617617 len--;
618618
619619 field->name = kmemdup_nul(field_name, len, GFP_KERNEL);
620− if (!field->name) {
621− ret = -ENOMEM;
620+ if (!field->name)
622621 goto free;
623− }
622+
624623 if (!is_good_name(field->name)) {
625624 synth_err(SYNTH_ERR_BAD_NAME, errpos(field_name));
626625 ret = -EINVAL;
@@ -638,10 +637,9 @@ static struct synth_field *parse_synth_field(int argc, const char **argv, · 11 unmodified lines
638637 len += strlen(prefix);
639638
640639 field->type = kzalloc(len, GFP_KERNEL);
641− if (!field->type) {
642− ret = -ENOMEM;
640+ if (!field->type)
643641 goto free;
644− }
642+
645643 seq_buf_init(&s, field->type, len);
646644 if (prefix)
647645 seq_buf_puts(&s, prefix);
@@ -653,6 +651,7 @@ static struct synth_field *parse_synth_field(int argc, const char **argv, · 5 unmodified lines
653651 }
654652 if (WARN_ON_ONCE(!seq_buf_buffer_left(&s)))
655653 goto free;
654+
656655 s.buffer[s.len] = '\0';
657656
658657 size = synth_field_size(field->type);
@@ -666,10 +665,8 @@ static struct synth_field *parse_synth_field(int argc, const char **argv, · 7 unmodified lines
666665
667666 len = sizeof("__data_loc ") + strlen(field->type) + 1;
668667 type = kzalloc(len, GFP_KERNEL);
669− if (!type) {
670− ret = -ENOMEM;
668+ if (!type)
671669 goto free;
672− }
673670
674671 seq_buf_init(&s, type, len);
675672 seq_buf_puts(&s, "__data_loc ");
kernel/trace/trace_selftest.c+7−2
@@ -492,8 +492,13 @@ trace_selftest_function_recursion(void) · 491 unmodified lines
492492 unregister_ftrace_function(&test_rec_probe);
493493
494494 ret = -1;
495− if (trace_selftest_recursion_cnt != 1) {
496− pr_cont("*callback not called once (%d)* ",
495+ /*
496+ * Recursion allows for transitions between context,
497+ * and may call the callback twice.
498+ */
499+ if (trace_selftest_recursion_cnt != 1 &&
500+ trace_selftest_recursion_cnt != 2) {
501+ pr_cont("*callback not called once (or twice) (%d)* ",
497502 trace_selftest_recursion_cnt);
498503 goto out;
499504 }
lib/crc32test.c+0−4
@@ -683,7 +683,6 @@ static int __init crc32c_test(void) · 682 unmodified lines
683683
684684 /* reduce OS noise */
685685 local_irq_save(flags);
686− local_irq_disable();
687686
688687 nsec = ktime_get_ns();
689688 for (i = 0; i < 100; i++) {
@@ -694,7 +693,6 @@ static int __init crc32c_test(void) · 4 unmodified lines
694693 nsec = ktime_get_ns() - nsec;
695694
696695 local_irq_restore(flags);
697− local_irq_enable();
698696
699697 pr_info("crc32c: CRC_LE_BITS = %d\n", CRC_LE_BITS);
700698
@@ -768,7 +766,6 @@ static int __init crc32_test(void) · 67 unmodified lines
768766
769767 /* reduce OS noise */
770768 local_irq_save(flags);
771− local_irq_disable();
772769
773770 nsec = ktime_get_ns();
774771 for (i = 0; i < 100; i++) {
@@ -783,7 +780,6 @@ static int __init crc32_test(void) · 8 unmodified lines
783780 nsec = ktime_get_ns() - nsec;
784781
785782 local_irq_restore(flags);
786− local_irq_enable();
787783
788784 pr_info("crc32: CRC_LE_BITS = %d, CRC_BE BITS = %d\n",
789785 CRC_LE_BITS, CRC_BE_BITS);
lib/fonts/font_10x18.c+1−1
@@ -8,7 +8,7 @@ · 7 unmodified lines
88
99 #define FONTDATAMAX 9216
1010
11−static struct font_data fontdata_10x18 = {
11+static const struct font_data fontdata_10x18 = {
1212 { 0, 0, FONTDATAMAX, 0 }, {
1313 /* 0 0x00 '^@' */
1414 0x00, 0x00, /* 0000000000 */
lib/fonts/font_6x10.c+1−1
@@ -3,7 +3,7 @@ · 2 unmodified lines
33
44 #define FONTDATAMAX 2560
55
6−static struct font_data fontdata_6x10 = {
6+static const struct font_data fontdata_6x10 = {
77 { 0, 0, FONTDATAMAX, 0 }, {
88 /* 0 0x00 '^@' */
99 0x00, /* 00000000 */
lib/fonts/font_6x11.c+1−1
@@ -9,7 +9,7 @@ · 8 unmodified lines
99
1010 #define FONTDATAMAX (11*256)
1111
12−static struct font_data fontdata_6x11 = {
12+static const struct font_data fontdata_6x11 = {
1313 { 0, 0, FONTDATAMAX, 0 }, {
1414 /* 0 0x00 '^@' */
1515 0x00, /* 00000000 */
lib/fonts/font_6x8.c+1−1
@@ -3,7 +3,7 @@ · 2 unmodified lines
33
44 #define FONTDATAMAX 2048
55
6−static struct font_data fontdata_6x8 = {
6+static const struct font_data fontdata_6x8 = {
77 { 0, 0, FONTDATAMAX, 0 }, {
88 /* 0 0x00 '^@' */
99 0x00, /* 000000 */
lib/fonts/font_7x14.c+1−1
@@ -8,7 +8,7 @@ · 7 unmodified lines
88
99 #define FONTDATAMAX 3584
1010
11−static struct font_data fontdata_7x14 = {
11+static const struct font_data fontdata_7x14 = {
1212 { 0, 0, FONTDATAMAX, 0 }, {
1313 /* 0 0x00 '^@' */
1414 0x00, /* 0000000 */
lib/fonts/font_8x16.c+1−1
@@ -10,7 +10,7 @@ · 9 unmodified lines
1010
1111 #define FONTDATAMAX 4096
1212
13−static struct font_data fontdata_8x16 = {
13+static const struct font_data fontdata_8x16 = {
1414 { 0, 0, FONTDATAMAX, 0 }, {
1515 /* 0 0x00 '^@' */
1616 0x00, /* 00000000 */
lib/fonts/font_8x8.c+1−1
@@ -9,7 +9,7 @@ · 8 unmodified lines
99
1010 #define FONTDATAMAX 2048
1111
12−static struct font_data fontdata_8x8 = {
12+static const struct font_data fontdata_8x8 = {
1313 { 0, 0, FONTDATAMAX, 0 }, {
1414 /* 0 0x00 '^@' */
1515 0x00, /* 00000000 */
lib/fonts/font_acorn_8x8.c+1−1
@@ -5,7 +5,7 @@ · 4 unmodified lines
55
66 #define FONTDATAMAX 2048
77
8−static struct font_data acorndata_8x8 = {
8+static const struct font_data acorndata_8x8 = {
99 { 0, 0, FONTDATAMAX, 0 }, {
1010 /* 00 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ^@ */
1111 /* 01 */ 0x7e, 0x81, 0xa5, 0x81, 0xbd, 0x99, 0x81, 0x7e, /* ^A */
lib/fonts/font_mini_4x6.c+1−1
@@ -43,7 +43,7 @@ __END__; · 42 unmodified lines
4343
4444 #define FONTDATAMAX 1536
4545
46−static struct font_data fontdata_mini_4x6 = {
46+static const struct font_data fontdata_mini_4x6 = {
4747 { 0, 0, FONTDATAMAX, 0 }, {
4848 /*{*/
4949 /* Char 0: ' ' */
lib/fonts/font_pearl_8x8.c+1−1
@@ -14,7 +14,7 @@ · 13 unmodified lines
1414
1515 #define FONTDATAMAX 2048
1616
17−static struct font_data fontdata_pearl8x8 = {
17+static const struct font_data fontdata_pearl8x8 = {
1818 { 0, 0, FONTDATAMAX, 0 }, {
1919 /* 0 0x00 '^@' */
2020 0x00, /* 00000000 */
lib/fonts/font_sun12x22.c+1−1
@@ -3,7 +3,7 @@ · 2 unmodified lines
33
44 #define FONTDATAMAX 11264
55
6−static struct font_data fontdata_sun12x22 = {
6+static const struct font_data fontdata_sun12x22 = {
77 { 0, 0, FONTDATAMAX, 0 }, {
88 /* 0 0x00 '^@' */
99 0x00, 0x00, /* 000000000000 */
lib/fonts/font_sun8x16.c+1−1
@@ -3,7 +3,7 @@ · 2 unmodified lines
33
44 #define FONTDATAMAX 4096
55
6−static struct font_data fontdata_sun8x16 = {
6+static const struct font_data fontdata_sun8x16 = {
77 { 0, 0, FONTDATAMAX, 0 }, {
88 /* */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
99 /* */ 0x00,0x00,0x7e,0x81,0xa5,0x81,0x81,0xbd,0x99,0x81,0x81,0x7e,0x00,0x00,0x00,0x00,
lib/fonts/font_ter16x32.c+1−1
@@ -4,7 +4,7 @@ · 3 unmodified lines
44
55 #define FONTDATAMAX 16384
66
7−static struct font_data fontdata_ter16x32 = {
7+static const struct font_data fontdata_ter16x32 = {
88 { 0, 0, FONTDATAMAX, 0 }, {
99 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1010 0x00, 0x00, 0x00, 0x00, 0x7f, 0xfc, 0x7f, 0xfc,
lib/test_kasan.c+107−42
@@ -216,6 +216,12 @@ static void kmalloc_oob_16(struct kunit *test) · 215 unmodified lines
216216 u64 words[2];
217217 } *ptr1, *ptr2;
218218
219+ /* This test is specifically crafted for the generic mode. */
220+ if (!IS_ENABLED(CONFIG_KASAN_GENERIC)) {
221+ kunit_info(test, "CONFIG_KASAN_GENERIC required\n");
222+ return;
223+ }
224+
219225 ptr1 = kmalloc(sizeof(*ptr1) - 3, GFP_KERNEL);
220226 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr1);
221227
@@ -227,6 +233,23 @@ static void kmalloc_oob_16(struct kunit *test) · 5 unmodified lines
227233 kfree(ptr2);
228234 }
229235
236+static void kmalloc_uaf_16(struct kunit *test)
237+{
238+ struct {
239+ u64 words[2];
240+ } *ptr1, *ptr2;
241+
242+ ptr1 = kmalloc(sizeof(*ptr1), GFP_KERNEL);
243+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr1);
244+
245+ ptr2 = kmalloc(sizeof(*ptr2), GFP_KERNEL);
246+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr2);
247+ kfree(ptr2);
248+
249+ KUNIT_EXPECT_KASAN_FAIL(test, *ptr1 = *ptr2);
250+ kfree(ptr1);
251+}
252+
230253 static void kmalloc_oob_memset_2(struct kunit *test)
231254 {
232255 char *ptr;
@@ -429,6 +452,12 @@ static void kasan_global_oob(struct kunit *test) · 196 unmodified lines
429452 volatile int i = 3;
430453 char *p = &global_array[ARRAY_SIZE(global_array) + i];
431454
455+ /* Only generic mode instruments globals. */
456+ if (!IS_ENABLED(CONFIG_KASAN_GENERIC)) {
457+ kunit_info(test, "CONFIG_KASAN_GENERIC required");
458+ return;
459+ }
460+
432461 KUNIT_EXPECT_KASAN_FAIL(test, *(volatile char *)p);
433462 }
434463
@@ -467,6 +496,12 @@ static void kasan_alloca_oob_left(struct kunit *test) · 32 unmodified lines
467496 char alloca_array[i];
468497 char *p = alloca_array - 1;
469498
499+ /* Only generic mode instruments dynamic allocas. */
500+ if (!IS_ENABLED(CONFIG_KASAN_GENERIC)) {
501+ kunit_info(test, "CONFIG_KASAN_GENERIC required");
502+ return;
503+ }
504+
470505 if (!IS_ENABLED(CONFIG_KASAN_STACK)) {
471506 kunit_info(test, "CONFIG_KASAN_STACK is not enabled");
472507 return;
@@ -481,6 +516,12 @@ static void kasan_alloca_oob_right(struct kunit *test) · 8 unmodified lines
481516 char alloca_array[i];
482517 char *p = alloca_array + i;
483518
519+ /* Only generic mode instruments dynamic allocas. */
520+ if (!IS_ENABLED(CONFIG_KASAN_GENERIC)) {
521+ kunit_info(test, "CONFIG_KASAN_GENERIC required");
522+ return;
523+ }
524+
484525 if (!IS_ENABLED(CONFIG_KASAN_STACK)) {
485526 kunit_info(test, "CONFIG_KASAN_STACK is not enabled");
486527 return;
@@ -551,6 +592,9 @@ static void kasan_memchr(struct kunit *test) · 64 unmodified lines
551592 return;
552593 }
553594
595+ if (OOB_TAG_OFF)
596+ size = round_up(size, OOB_TAG_OFF);
597+
554598 ptr = kmalloc(size, GFP_KERNEL | __GFP_ZERO);
555599 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr);
556600
@@ -573,6 +617,9 @@ static void kasan_memcmp(struct kunit *test) · 16 unmodified lines
573617 return;
574618 }
575619
620+ if (OOB_TAG_OFF)
621+ size = round_up(size, OOB_TAG_OFF);
622+
576623 ptr = kmalloc(size, GFP_KERNEL | __GFP_ZERO);
577624 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr);
578625 memset(arr, 0, sizeof(arr));
@@ -619,13 +666,50 @@ static void kasan_strings(struct kunit *test) · 40 unmodified lines
619666 KUNIT_EXPECT_KASAN_FAIL(test, kasan_int_result = strnlen(ptr, 1));
620667 }
621668
622−static void kasan_bitops(struct kunit *test)
669+static void kasan_bitops_modify(struct kunit *test, int nr, void *addr)
670+{
671+ KUNIT_EXPECT_KASAN_FAIL(test, set_bit(nr, addr));
672+ KUNIT_EXPECT_KASAN_FAIL(test, __set_bit(nr, addr));
673+ KUNIT_EXPECT_KASAN_FAIL(test, clear_bit(nr, addr));
674+ KUNIT_EXPECT_KASAN_FAIL(test, __clear_bit(nr, addr));
675+ KUNIT_EXPECT_KASAN_FAIL(test, clear_bit_unlock(nr, addr));
676+ KUNIT_EXPECT_KASAN_FAIL(test, __clear_bit_unlock(nr, addr));
677+ KUNIT_EXPECT_KASAN_FAIL(test, change_bit(nr, addr));
678+ KUNIT_EXPECT_KASAN_FAIL(test, __change_bit(nr, addr));
679+}
680+
681+static void kasan_bitops_test_and_modify(struct kunit *test, int nr, void *addr)
682+{
683+ KUNIT_EXPECT_KASAN_FAIL(test, test_and_set_bit(nr, addr));
684+ KUNIT_EXPECT_KASAN_FAIL(test, __test_and_set_bit(nr, addr));
685+ KUNIT_EXPECT_KASAN_FAIL(test, test_and_set_bit_lock(nr, addr));
686+ KUNIT_EXPECT_KASAN_FAIL(test, test_and_clear_bit(nr, addr));
687+ KUNIT_EXPECT_KASAN_FAIL(test, __test_and_clear_bit(nr, addr));
688+ KUNIT_EXPECT_KASAN_FAIL(test, test_and_change_bit(nr, addr));
689+ KUNIT_EXPECT_KASAN_FAIL(test, __test_and_change_bit(nr, addr));
690+ KUNIT_EXPECT_KASAN_FAIL(test, kasan_int_result = test_bit(nr, addr));
691+
692+#if defined(clear_bit_unlock_is_negative_byte)
693+ KUNIT_EXPECT_KASAN_FAIL(test, kasan_int_result =
694+ clear_bit_unlock_is_negative_byte(nr, addr));
695+#endif
696+}
697+
698+static void kasan_bitops_generic(struct kunit *test)
623699 {
700+ long *bits;
701+
702+ /* This test is specifically crafted for the generic mode. */
703+ if (!IS_ENABLED(CONFIG_KASAN_GENERIC)) {
704+ kunit_info(test, "CONFIG_KASAN_GENERIC required\n");
705+ return;
706+ }
707+
624708 /*
625709 * Allocate 1 more byte, which causes kzalloc to round up to 16-bytes;
626710 * this way we do not actually corrupt other memory.
627711 */
628− long *bits = kzalloc(sizeof(*bits) + 1, GFP_KERNEL);
712+ bits = kzalloc(sizeof(*bits) + 1, GFP_KERNEL);
629713 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, bits);
630714
631715 /*
@@ -633,55 +717,34 @@ static void kasan_bitops(struct kunit *test) · 1 unmodified line
633717 * below accesses are still out-of-bounds, since bitops are defined to
634718 * operate on the whole long the bit is in.
635719 */
636− KUNIT_EXPECT_KASAN_FAIL(test, set_bit(BITS_PER_LONG, bits));
637−
638− KUNIT_EXPECT_KASAN_FAIL(test, __set_bit(BITS_PER_LONG, bits));
639−
640− KUNIT_EXPECT_KASAN_FAIL(test, clear_bit(BITS_PER_LONG, bits));
641−
642− KUNIT_EXPECT_KASAN_FAIL(test, __clear_bit(BITS_PER_LONG, bits));
643−
644− KUNIT_EXPECT_KASAN_FAIL(test, clear_bit_unlock(BITS_PER_LONG, bits));
645−
646− KUNIT_EXPECT_KASAN_FAIL(test, __clear_bit_unlock(BITS_PER_LONG, bits));
647−
648− KUNIT_EXPECT_KASAN_FAIL(test, change_bit(BITS_PER_LONG, bits));
649−
650− KUNIT_EXPECT_KASAN_FAIL(test, __change_bit(BITS_PER_LONG, bits));
720+ kasan_bitops_modify(test, BITS_PER_LONG, bits);
651721
652722 /*
653723 * Below calls try to access bit beyond allocated memory.
654724 */
655− KUNIT_EXPECT_KASAN_FAIL(test,
656− test_and_set_bit(BITS_PER_LONG + BITS_PER_BYTE, bits));
657−
658− KUNIT_EXPECT_KASAN_FAIL(test,
659− __test_and_set_bit(BITS_PER_LONG + BITS_PER_BYTE, bits));
660−
661− KUNIT_EXPECT_KASAN_FAIL(test,
662− test_and_set_bit_lock(BITS_PER_LONG + BITS_PER_BYTE, bits));
725+ kasan_bitops_test_and_modify(test, BITS_PER_LONG + BITS_PER_BYTE, bits);
663726
664− KUNIT_EXPECT_KASAN_FAIL(test,
665− test_and_clear_bit(BITS_PER_LONG + BITS_PER_BYTE, bits));
727+ kfree(bits);
728+}
666729
667− KUNIT_EXPECT_KASAN_FAIL(test,
668− __test_and_clear_bit(BITS_PER_LONG + BITS_PER_BYTE, bits));
730+static void kasan_bitops_tags(struct kunit *test)
731+{
732+ long *bits;
669733
670− KUNIT_EXPECT_KASAN_FAIL(test,
671− test_and_change_bit(BITS_PER_LONG + BITS_PER_BYTE, bits));
734+ /* This test is specifically crafted for the tag-based mode. */
735+ if (IS_ENABLED(CONFIG_KASAN_GENERIC)) {
736+ kunit_info(test, "CONFIG_KASAN_SW_TAGS required\n");
737+ return;
738+ }
672739
673− KUNIT_EXPECT_KASAN_FAIL(test,
674− __test_and_change_bit(BITS_PER_LONG + BITS_PER_BYTE, bits));
740+ /* Allocation size will be rounded to up granule size, which is 16. */
741+ bits = kzalloc(sizeof(*bits), GFP_KERNEL);
742+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, bits);
675743
676− KUNIT_EXPECT_KASAN_FAIL(test,
677− kasan_int_result =
678− test_bit(BITS_PER_LONG + BITS_PER_BYTE, bits));
744+ /* Do the accesses past the 16 allocated bytes. */
745+ kasan_bitops_modify(test, BITS_PER_LONG, &bits[1]);
746+ kasan_bitops_test_and_modify(test, BITS_PER_LONG + BITS_PER_BYTE, &bits[1]);
679747
680−#if defined(clear_bit_unlock_is_negative_byte)
681− KUNIT_EXPECT_KASAN_FAIL(test,
682− kasan_int_result = clear_bit_unlock_is_negative_byte(
683− BITS_PER_LONG + BITS_PER_BYTE, bits));
684−#endif
685748 kfree(bits);
686749 }
687750
@@ -728,6 +791,7 @@ static struct kunit_case kasan_kunit_test_cases[] = { · 40 unmodified lines
728791 KUNIT_CASE(kmalloc_oob_krealloc_more),
729792 KUNIT_CASE(kmalloc_oob_krealloc_less),
730793 KUNIT_CASE(kmalloc_oob_16),
794+ KUNIT_CASE(kmalloc_uaf_16),
731795 KUNIT_CASE(kmalloc_oob_in_memset),
732796 KUNIT_CASE(kmalloc_oob_memset_2),
733797 KUNIT_CASE(kmalloc_oob_memset_4),
@@ -751,7 +815,8 @@ static struct kunit_case kasan_kunit_test_cases[] = { · 17 unmodified lines
751815 KUNIT_CASE(kasan_memchr),
752816 KUNIT_CASE(kasan_memcmp),
753817 KUNIT_CASE(kasan_strings),
754− KUNIT_CASE(kasan_bitops),
818+ KUNIT_CASE(kasan_bitops_generic),
819+ KUNIT_CASE(kasan_bitops_tags),
755820 KUNIT_CASE(kmalloc_double_kzfree),
756821 KUNIT_CASE(vmalloc_oob),
757822 {}
mm/hugetlb.c+11−9
@@ -648,6 +648,8 @@ retry: · 647 unmodified lines
648648 }
649649
650650 del += t - f;
651+ hugetlb_cgroup_uncharge_file_region(
652+ resv, rg, t - f);
651653
652654 /* New entry for end of split region */
653655 nrg->from = t;
@@ -660,9 +662,6 @@ retry: · 6 unmodified lines
660662 /* Original entry is trimmed */
661663 rg->to = f;
662664
663− hugetlb_cgroup_uncharge_file_region(
664− resv, rg, nrg->to - nrg->from);
665−
666665 list_add(&nrg->link, &rg->link);
667666 nrg = NULL;
668667 break;
@@ -678,17 +677,17 @@ retry: · 9 unmodified lines
678677 }
679678
680679 if (f <= rg->from) { /* Trim beginning of region */
681− del += t - rg->from;
682− rg->from = t;
683−
684680 hugetlb_cgroup_uncharge_file_region(resv, rg,
685681 t - rg->from);
686− } else { /* Trim end of region */
687− del += rg->to - f;
688− rg->to = f;
689682
683+ del += t - rg->from;
684+ rg->from = t;
685+ } else { /* Trim end of region */
690686 hugetlb_cgroup_uncharge_file_region(resv, rg,
691687 rg->to - f);
688+
689+ del += rg->to - f;
690+ rg->to = f;
692691 }
693692 }
694693
@@ -2443,6 +2442,9 @@ struct page *alloc_huge_page(struct vm_area_struct *vma, · 1748 unmodified lines
24432442
24442443 rsv_adjust = hugepage_subpool_put_pages(spool, 1);
24452444 hugetlb_acct_memory(h, -rsv_adjust);
2445+ if (deferred_reserve)
2446+ hugetlb_cgroup_uncharge_page_rsvd(hstate_index(h),
2447+ pages_per_huge_page(h), page);
24462448 }
24472449 return page;
24482450
mm/memcontrol.c+18−7
@@ -4110,11 +4110,17 @@ static int memcg_stat_show(struct seq_file *m, void *v) · 4109 unmodified lines
41104110 (u64)memsw * PAGE_SIZE);
41114111
41124112 for (i = 0; i < ARRAY_SIZE(memcg1_stats); i++) {
4113+ unsigned long nr;
4114+
41134115 if (memcg1_stats[i] == MEMCG_SWAP && !do_memsw_account())
41144116 continue;
4117+ nr = memcg_page_state(memcg, memcg1_stats[i]);
4118+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
4119+ if (memcg1_stats[i] == NR_ANON_THPS)
4120+ nr *= HPAGE_PMD_NR;
4121+#endif
41154122 seq_printf(m, "total_%s %llu\n", memcg1_stat_names[i],
4116− (u64)memcg_page_state(memcg, memcg1_stats[i]) *
4117− PAGE_SIZE);
4123+ (u64)nr * PAGE_SIZE);
41184124 }
41194125
41204126 for (i = 0; i < ARRAY_SIZE(memcg1_events); i++)
@@ -5339,17 +5345,22 @@ mem_cgroup_css_alloc(struct cgroup_subsys_state *parent_css) · 1218 unmodified lines
53395345 memcg->swappiness = mem_cgroup_swappiness(parent);
53405346 memcg->oom_kill_disable = parent->oom_kill_disable;
53415347 }
5342− if (parent && parent->use_hierarchy) {
5348+ if (!parent) {
5349+ page_counter_init(&memcg->memory, NULL);
5350+ page_counter_init(&memcg->swap, NULL);
5351+ page_counter_init(&memcg->kmem, NULL);
5352+ page_counter_init(&memcg->tcpmem, NULL);
5353+ } else if (parent->use_hierarchy) {
53435354 memcg->use_hierarchy = true;
53445355 page_counter_init(&memcg->memory, &parent->memory);
53455356 page_counter_init(&memcg->swap, &parent->swap);
53465357 page_counter_init(&memcg->kmem, &parent->kmem);
53475358 page_counter_init(&memcg->tcpmem, &parent->tcpmem);
53485359 } else {
5349− page_counter_init(&memcg->memory, NULL);
5350− page_counter_init(&memcg->swap, NULL);
5351− page_counter_init(&memcg->kmem, NULL);
5352− page_counter_init(&memcg->tcpmem, NULL);
5360+ page_counter_init(&memcg->memory, &root_mem_cgroup->memory);
5361+ page_counter_init(&memcg->swap, &root_mem_cgroup->swap);
5362+ page_counter_init(&memcg->kmem, &root_mem_cgroup->kmem);
5363+ page_counter_init(&memcg->tcpmem, &root_mem_cgroup->tcpmem);
53535364 /*
53545365 * Deeper hierachy with use_hierarchy == false doesn't make
53555366 * much sense so let cgroup subsystem know about this
mm/mempolicy.c+3−3
@@ -525,7 +525,7 @@ static int queue_pages_pte_range(pmd_t *pmd, unsigned long addr, · 524 unmodified lines
525525 unsigned long flags = qp->flags;
526526 int ret;
527527 bool has_unmovable = false;
528− pte_t *pte;
528+ pte_t *pte, *mapped_pte;
529529 spinlock_t *ptl;
530530
531531 ptl = pmd_trans_huge_lock(pmd, vma);
@@ -539,7 +539,7 @@ static int queue_pages_pte_range(pmd_t *pmd, unsigned long addr, · 7 unmodified lines
539539 if (pmd_trans_unstable(pmd))
540540 return 0;
541541
542− pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl);
542+ mapped_pte = pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl);
543543 for (; addr != end; pte++, addr += PAGE_SIZE) {
544544 if (!pte_present(*pte))
545545 continue;
@@ -571,7 +571,7 @@ static int queue_pages_pte_range(pmd_t *pmd, unsigned long addr, · 25 unmodified lines
571571 } else
572572 break;
573573 }
574− pte_unmap_unlock(pte - 1, ptl);
574+ pte_unmap_unlock(mapped_pte, ptl);
575575 cond_resched();
576576
577577 if (has_unmovable)
mm/memremap.c+16−23
@@ -41,28 +41,24 @@ EXPORT_SYMBOL_GPL(memremap_compat_align); · 40 unmodified lines
4141 DEFINE_STATIC_KEY_FALSE(devmap_managed_key);
4242 EXPORT_SYMBOL(devmap_managed_key);
4343
44−static void devmap_managed_enable_put(void)
44+static void devmap_managed_enable_put(struct dev_pagemap *pgmap)
4545 {
46− static_branch_dec(&devmap_managed_key);
46+ if (pgmap->type == MEMORY_DEVICE_PRIVATE ||
47+ pgmap->type == MEMORY_DEVICE_FS_DAX)
48+ static_branch_dec(&devmap_managed_key);
4749 }
4850
49−static int devmap_managed_enable_get(struct dev_pagemap *pgmap)
51+static void devmap_managed_enable_get(struct dev_pagemap *pgmap)
5052 {
51− if (pgmap->type == MEMORY_DEVICE_PRIVATE &&
52− (!pgmap->ops || !pgmap->ops->page_free)) {
53− WARN(1, "Missing page_free method\n");
54− return -EINVAL;
55− }
56−
57− static_branch_inc(&devmap_managed_key);
58− return 0;
53+ if (pgmap->type == MEMORY_DEVICE_PRIVATE ||
54+ pgmap->type == MEMORY_DEVICE_FS_DAX)
55+ static_branch_inc(&devmap_managed_key);
5956 }
6057 #else
61−static int devmap_managed_enable_get(struct dev_pagemap *pgmap)
58+static void devmap_managed_enable_get(struct dev_pagemap *pgmap)
6259 {
63− return -EINVAL;
6460 }
65−static void devmap_managed_enable_put(void)
61+static void devmap_managed_enable_put(struct dev_pagemap *pgmap)
6662 {
6763 }
6864 #endif /* CONFIG_DEV_PAGEMAP_OPS */
@@ -169,7 +165,7 @@ void memunmap_pages(struct dev_pagemap *pgmap) · 100 unmodified lines
169165 pageunmap_range(pgmap, i);
170166
171167 WARN_ONCE(pgmap->altmap.alloc, "failed to free all reserved pages\n");
172− devmap_managed_enable_put();
168+ devmap_managed_enable_put(pgmap);
173169 }
174170 EXPORT_SYMBOL_GPL(memunmap_pages);
175171
@@ -307,7 +303,6 @@ void *memremap_pages(struct dev_pagemap *pgmap, int nid) · 131 unmodified lines
307303 .pgprot = PAGE_KERNEL,
308304 };
309305 const int nr_range = pgmap->nr_range;
310− bool need_devmap_managed = true;
311306 int error, i;
312307
313308 if (WARN_ONCE(!nr_range, "nr_range must be specified\n"))
@@ -323,6 +318,10 @@ void *memremap_pages(struct dev_pagemap *pgmap, int nid) · 9 unmodified lines
323318 WARN(1, "Missing migrate_to_ram method\n");
324319 return ERR_PTR(-EINVAL);
325320 }
321+ if (!pgmap->ops->page_free) {
322+ WARN(1, "Missing page_free method\n");
323+ return ERR_PTR(-EINVAL);
324+ }
326325 if (!pgmap->owner) {
327326 WARN(1, "Missing owner\n");
328327 return ERR_PTR(-EINVAL);
@@ -336,11 +335,9 @@ void *memremap_pages(struct dev_pagemap *pgmap, int nid) · 7 unmodified lines
336335 }
337336 break;
338337 case MEMORY_DEVICE_GENERIC:
339− need_devmap_managed = false;
340338 break;
341339 case MEMORY_DEVICE_PCI_P2PDMA:
342340 params.pgprot = pgprot_noncached(params.pgprot);
343− need_devmap_managed = false;
344341 break;
345342 default:
346343 WARN(1, "Invalid pgmap type %d\n", pgmap->type);
@@ -364,11 +361,7 @@ void *memremap_pages(struct dev_pagemap *pgmap, int nid) · 17 unmodified lines
364361 }
365362 }
366363
367− if (need_devmap_managed) {
368− error = devmap_managed_enable_get(pgmap);
369− if (error)
370− return ERR_PTR(error);
371− }
364+ devmap_managed_enable_get(pgmap);
372365
373366 /*
374367 * Clear the pgmap nr_range as it will be incremented for each
mm/truncate.c+1−1
@@ -528,7 +528,7 @@ void truncate_inode_pages_final(struct address_space *mapping) · 527 unmodified lines
528528 }
529529 EXPORT_SYMBOL(truncate_inode_pages_final);
530530
531−unsigned long __invalidate_mapping_pages(struct address_space *mapping,
531+static unsigned long __invalidate_mapping_pages(struct address_space *mapping,
532532 pgoff_t start, pgoff_t end, unsigned long *nr_pagevec)
533533 {
534534 pgoff_t indices[PAGEVEC_SIZE];
net/atm/lec.c+2−3
@@ -954,9 +954,8 @@ static void *lec_seq_next(struct seq_file *seq, void *v, loff_t *pos) · 953 unmodified lines
954954 {
955955 struct lec_state *state = seq->private;
956956
957− v = lec_get_idx(state, 1);
958− *pos += !!PTR_ERR(v);
959− return v;
957+ ++*pos;
958+ return lec_get_idx(state, 1);
960959 }
961960
962961 static int lec_seq_show(struct seq_file *seq, void *v)
net/can/Kconfig+3−2
@@ -62,8 +62,9 @@ config CAN_ISOTP · 61 unmodified lines
6262 communication between CAN nodes via two defined CAN Identifiers.
6363 As CAN frames can only transport a small amount of data bytes
6464 (max. 8 bytes for 'classic' CAN and max. 64 bytes for CAN FD) this
65− segmentation is needed to transport longer PDUs as needed e.g. for
66− vehicle diagnosis (UDS, ISO 14229) or IP-over-CAN traffic.
65+ segmentation is needed to transport longer Protocol Data Units (PDU)
66+ as needed e.g. for vehicle diagnosis (UDS, ISO 14229) or IP-over-CAN
67+ traffic.
6768 This protocol driver implements data transfers according to
6869 ISO 15765-2:2016 for 'classic' CAN and CAN FD frame types.
6970 If you want to perform automotive vehicle diagnostic services (UDS),
net/can/isotp.c+14−12
@@ -252,14 +252,16 @@ static void isotp_rcv_skb(struct sk_buff *skb, struct sock *sk) · 251 unmodified lines
252252
253253 static u8 padlen(u8 datalen)
254254 {
255− const u8 plen[] = {8, 8, 8, 8, 8, 8, 8, 8, 8, /* 0 - 8 */
256− 12, 12, 12, 12, /* 9 - 12 */
257− 16, 16, 16, 16, /* 13 - 16 */
258− 20, 20, 20, 20, /* 17 - 20 */
259− 24, 24, 24, 24, /* 21 - 24 */
260− 32, 32, 32, 32, 32, 32, 32, 32, /* 25 - 32 */
261− 48, 48, 48, 48, 48, 48, 48, 48, /* 33 - 40 */
262− 48, 48, 48, 48, 48, 48, 48, 48}; /* 41 - 48 */
255+ static const u8 plen[] = {
256+ 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 0 - 8 */
257+ 12, 12, 12, 12, /* 9 - 12 */
258+ 16, 16, 16, 16, /* 13 - 16 */
259+ 20, 20, 20, 20, /* 17 - 20 */
260+ 24, 24, 24, 24, /* 21 - 24 */
261+ 32, 32, 32, 32, 32, 32, 32, 32, /* 25 - 32 */
262+ 48, 48, 48, 48, 48, 48, 48, 48, /* 33 - 40 */
263+ 48, 48, 48, 48, 48, 48, 48, 48 /* 41 - 48 */
264+ };
263265
264266 if (datalen > 48)
265267 return 64;
@@ -569,10 +571,6 @@ static int isotp_rcv_cf(struct sock *sk, struct canfd_frame *cf, int ae, · 303 unmodified lines
569571 return 0;
570572 }
571573
572− /* no creation of flow control frames */
573− if (so->opt.flags & CAN_ISOTP_LISTEN_MODE)
574− return 0;
575−
576574 /* perform blocksize handling, if enabled */
577575 if (!so->rxfc.bs || ++so->rx.bs < so->rxfc.bs) {
578576 /* start rx timeout watchdog */
@@ -581,6 +579,10 @@ static int isotp_rcv_cf(struct sock *sk, struct canfd_frame *cf, int ae, · 2 unmodified lines
581579 return 0;
582580 }
583581
582+ /* no creation of flow control frames */
583+ if (so->opt.flags & CAN_ISOTP_LISTEN_MODE)
584+ return 0;
585+
584586 /* we reached the specified blocksize so->rxfc.bs */
585587 isotp_send_fc(sk, ae, ISOTP_FC_CTS);
586588 return 0;
net/can/j1939/socket.c+6−0
@@ -475,6 +475,12 @@ static int j1939_sk_bind(struct socket *sock, struct sockaddr *uaddr, int len) · 474 unmodified lines
475475 goto out_release_sock;
476476 }
477477
478+ if (!(ndev->flags & IFF_UP)) {
479+ dev_put(ndev);
480+ ret = -ENETDOWN;
481+ goto out_release_sock;
482+ }
483+
478484 priv = j1939_netdev_start(ndev);
479485 dev_put(ndev);
480486 if (IS_ERR(priv)) {
net/can/proc.c+4−2
@@ -462,6 +462,9 @@ void can_init_proc(struct net *net) · 461 unmodified lines
462462 */
463463 void can_remove_proc(struct net *net)
464464 {
465+ if (!net->can.proc_dir)
466+ return;
467+
465468 if (net->can.pde_stats)
466469 remove_proc_entry(CAN_PROC_STATS, net->can.proc_dir);
467470
@@ -486,6 +489,5 @@ void can_remove_proc(struct net *net) · 18 unmodified lines
486489 if (net->can.pde_rcvlist_sff)
487490 remove_proc_entry(CAN_PROC_RCVLIST_SFF, net->can.proc_dir);
488491
489− if (net->can.proc_dir)
490− remove_proc_entry("can", net->proc_net);
492+ remove_proc_entry("can", net->proc_net);
491493 }
net/ipv4/ip_tunnel.c+0−3
@@ -608,9 +608,6 @@ void ip_md_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, · 607 unmodified lines
608608 ttl = ip4_dst_hoplimit(&rt->dst);
609609 }
610610
611− if (!df && skb->protocol == htons(ETH_P_IP))
612− df = inner_iph->frag_off & htons(IP_DF);
613−
614611 headroom += LL_RESERVED_SPACE(rt->dst.dev) + rt->dst.header_len;
615612 if (headroom > dev->needed_headroom)
616613 dev->needed_headroom = headroom;
net/ipv4/netfilter.c+5−3
@@ -17,17 +17,19 @@ · 16 unmodified lines
1717 #include <net/netfilter/nf_queue.h>
1818
1919 /* route_me_harder function, used by iptable_nat, iptable_mangle + ip_queue */
20−int ip_route_me_harder(struct net *net, struct sk_buff *skb, unsigned int addr_type)
20+int ip_route_me_harder(struct net *net, struct sock *sk, struct sk_buff *skb, unsigned int addr_type)
2121 {
2222 const struct iphdr *iph = ip_hdr(skb);
2323 struct rtable *rt;
2424 struct flowi4 fl4 = {};
2525 __be32 saddr = iph->saddr;
26− const struct sock *sk = skb_to_full_sk(skb);
27− __u8 flags = sk ? inet_sk_flowi_flags(sk) : 0;
26+ __u8 flags;
2827 struct net_device *dev = skb_dst(skb)->dev;
2928 unsigned int hh_len;
3029
30+ sk = sk_to_full_sk(sk);
31+ flags = sk ? inet_sk_flowi_flags(sk) : 0;
32+
3133 if (addr_type == RTN_UNSPEC)
3234 addr_type = inet_addr_type_dev_table(net, dev, saddr);
3335 if (addr_type == RTN_LOCAL || addr_type == RTN_UNICAST)
net/ipv4/netfilter/iptable_mangle.c+1−1
@@ -62,7 +62,7 @@ ipt_mangle_out(struct sk_buff *skb, const struct nf_hook_state *state) · 61 unmodified lines
6262 iph->daddr != daddr ||
6363 skb->mark != mark ||
6464 iph->tos != tos) {
65− err = ip_route_me_harder(state->net, skb, RTN_UNSPEC);
65+ err = ip_route_me_harder(state->net, state->sk, skb, RTN_UNSPEC);
6666 if (err < 0)
6767 ret = NF_DROP_ERR(err);
6868 }
net/ipv4/netfilter/nf_reject_ipv4.c+1−1
@@ -145,7 +145,7 @@ void nf_send_reset(struct net *net, struct sk_buff *oldskb, int hook) · 144 unmodified lines
145145 ip4_dst_hoplimit(skb_dst(nskb)));
146146 nf_reject_ip_tcphdr_put(nskb, oldskb, oth);
147147
148− if (ip_route_me_harder(net, nskb, RTN_UNSPEC))
148+ if (ip_route_me_harder(net, nskb->sk, nskb, RTN_UNSPEC))
149149 goto free_nskb;
150150
151151 niph = ip_hdr(nskb);
net/ipv4/xfrm4_tunnel.c+2−2
@@ -64,14 +64,14 @@ static int xfrm_tunnel_err(struct sk_buff *skb, u32 info) · 63 unmodified lines
6464 static struct xfrm_tunnel xfrm_tunnel_handler __read_mostly = {
6565 .handler = xfrm_tunnel_rcv,
6666 .err_handler = xfrm_tunnel_err,
67− .priority = 3,
67+ .priority = 4,
6868 };
6969
7070 #if IS_ENABLED(CONFIG_IPV6)
7171 static struct xfrm_tunnel xfrm64_tunnel_handler __read_mostly = {
7272 .handler = xfrm_tunnel_rcv,
7373 .err_handler = xfrm_tunnel_err,
74− .priority = 2,
74+ .priority = 3,
7575 };
7676 #endif
7777
net/ipv6/icmp.c+7−1
@@ -158,7 +158,13 @@ static bool is_ineligible(const struct sk_buff *skb) · 157 unmodified lines
158158 tp = skb_header_pointer(skb,
159159 ptr+offsetof(struct icmp6hdr, icmp6_type),
160160 sizeof(_type), &_type);
161− if (!tp || !(*tp & ICMPV6_INFOMSG_MASK))
161+
162+ /* Based on RFC 8200, Section 4.5 Fragment Header, return
163+ * false if this is a fragment packet with no icmp header info.
164+ */
165+ if (!tp && frag_off != 0)
166+ return false;
167+ else if (!tp || !(*tp & ICMPV6_INFOMSG_MASK))
162168 return true;
163169 }
164170 return false;
net/ipv6/ip6_tunnel.c+2−2
@@ -1271,6 +1271,8 @@ route_lookup: · 1270 unmodified lines
12711271 if (max_headroom > dev->needed_headroom)
12721272 dev->needed_headroom = max_headroom;
12731273
1274+ skb_set_inner_ipproto(skb, proto);
1275+
12741276 err = ip6_tnl_encap(skb, t, &proto, fl6);
12751277 if (err)
12761278 return err;
@@ -1280,8 +1282,6 @@ route_lookup: · 3 unmodified lines
12801282 ipv6_push_frag_opts(skb, &opt.ops, &proto);
12811283 }
12821284
1283− skb_set_inner_ipproto(skb, proto);
1284−
12851285 skb_push(skb, sizeof(struct ipv6hdr));
12861286 skb_reset_network_header(skb);
12871287 ipv6h = ipv6_hdr(skb);
net/ipv6/netfilter.c+3−3
@@ -20,10 +20,10 @@ · 19 unmodified lines
2020 #include <net/netfilter/ipv6/nf_defrag_ipv6.h>
2121 #include "../bridge/br_private.h"
2222
23−int ip6_route_me_harder(struct net *net, struct sk_buff *skb)
23+int ip6_route_me_harder(struct net *net, struct sock *sk_partial, struct sk_buff *skb)
2424 {
2525 const struct ipv6hdr *iph = ipv6_hdr(skb);
26− struct sock *sk = sk_to_full_sk(skb->sk);
26+ struct sock *sk = sk_to_full_sk(sk_partial);
2727 unsigned int hh_len;
2828 struct dst_entry *dst;
2929 int strict = (ipv6_addr_type(&iph->daddr) &
@@ -84,7 +84,7 @@ static int nf_ip6_reroute(struct sk_buff *skb, · 54 unmodified lines
8484 if (!ipv6_addr_equal(&iph->daddr, &rt_info->daddr) ||
8585 !ipv6_addr_equal(&iph->saddr, &rt_info->saddr) ||
8686 skb->mark != rt_info->mark)
87− return ip6_route_me_harder(entry->state.net, skb);
87+ return ip6_route_me_harder(entry->state.net, entry->state.sk, skb);
8888 }
8989 return 0;
9090 }
net/ipv6/netfilter/ip6table_mangle.c+1−1
@@ -57,7 +57,7 @@ ip6t_mangle_out(struct sk_buff *skb, const struct nf_hook_state *state) · 56 unmodified lines
5757 skb->mark != mark ||
5858 ipv6_hdr(skb)->hop_limit != hop_limit ||
5959 flowlabel != *((u_int32_t *)ipv6_hdr(skb)))) {
60− err = ip6_route_me_harder(state->net, skb);
60+ err = ip6_route_me_harder(state->net, state->sk, skb);
6161 if (err < 0)
6262 ret = NF_DROP_ERR(err);
6363 }
net/ipv6/reassembly.c+32−1
@@ -42,6 +42,8 @@ · 41 unmodified lines
4242 #include <linux/skbuff.h>
4343 #include <linux/slab.h>
4444 #include <linux/export.h>
45+#include <linux/tcp.h>
46+#include <linux/udp.h>
4547
4648 #include <net/sock.h>
4749 #include <net/snmp.h>
@@ -322,7 +324,9 @@ static int ipv6_frag_rcv(struct sk_buff *skb) · 274 unmodified lines
322324 struct frag_queue *fq;
323325 const struct ipv6hdr *hdr = ipv6_hdr(skb);
324326 struct net *net = dev_net(skb_dst(skb)->dev);
325− int iif;
327+ __be16 frag_off;
328+ int iif, offset;
329+ u8 nexthdr;
326330
327331 if (IP6CB(skb)->flags & IP6SKB_FRAGMENTED)
328332 goto fail_hdr;
@@ -351,6 +355,33 @@ static int ipv6_frag_rcv(struct sk_buff *skb) · 22 unmodified lines
351355 return 1;
352356 }
353357
358+ /* RFC 8200, Section 4.5 Fragment Header:
359+ * If the first fragment does not include all headers through an
360+ * Upper-Layer header, then that fragment should be discarded and
361+ * an ICMP Parameter Problem, Code 3, message should be sent to
362+ * the source of the fragment, with the Pointer field set to zero.
363+ */
364+ nexthdr = hdr->nexthdr;
365+ offset = ipv6_skip_exthdr(skb, skb_transport_offset(skb), &nexthdr, &frag_off);
366+ if (offset >= 0) {
367+ /* Check some common protocols' header */
368+ if (nexthdr == IPPROTO_TCP)
369+ offset += sizeof(struct tcphdr);
370+ else if (nexthdr == IPPROTO_UDP)
371+ offset += sizeof(struct udphdr);
372+ else if (nexthdr == IPPROTO_ICMPV6)
373+ offset += sizeof(struct icmp6hdr);
374+ else
375+ offset += 1;
376+
377+ if (!(frag_off & htons(IP6_OFFSET)) && offset > skb->len) {
378+ __IP6_INC_STATS(net, __in6_dev_get_safely(skb->dev),
379+ IPSTATS_MIB_INHDRERRORS);
380+ icmpv6_param_prob(skb, ICMPV6_HDR_INCOMP, 0);
381+ return -1;
382+ }
383+ }
384+
354385 iif = skb->dev ? skb->dev->ifindex : 0;
355386 fq = fq_find(net, fhdr->identification, hdr, iif);
356387 if (fq) {
net/ipv6/xfrm6_tunnel.c+2−2
@@ -303,13 +303,13 @@ static const struct xfrm_type xfrm6_tunnel_type = { · 302 unmodified lines
303303 static struct xfrm6_tunnel xfrm6_tunnel_handler __read_mostly = {
304304 .handler = xfrm6_tunnel_rcv,
305305 .err_handler = xfrm6_tunnel_err,
306− .priority = 2,
306+ .priority = 3,
307307 };
308308
309309 static struct xfrm6_tunnel xfrm46_tunnel_handler __read_mostly = {
310310 .handler = xfrm6_tunnel_rcv,
311311 .err_handler = xfrm6_tunnel_err,
312− .priority = 2,
312+ .priority = 3,
313313 };
314314
315315 static int __net_init xfrm6_tunnel_net_init(struct net *net)
net/mac80211/mlme.c+2−1
@@ -5464,6 +5464,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, · 5463 unmodified lines
54645464 struct cfg80211_assoc_request *req)
54655465 {
54665466 bool is_6ghz = req->bss->channel->band == NL80211_BAND_6GHZ;
5467+ bool is_5ghz = req->bss->channel->band == NL80211_BAND_5GHZ;
54675468 struct ieee80211_local *local = sdata->local;
54685469 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
54695470 struct ieee80211_bss *bss = (void *)req->bss->priv;
@@ -5616,7 +5617,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, · 146 unmodified lines
56165617 if (vht_ie && vht_ie[1] >= sizeof(struct ieee80211_vht_cap))
56175618 memcpy(&assoc_data->ap_vht_cap, vht_ie + 2,
56185619 sizeof(struct ieee80211_vht_cap));
5619− else if (!is_6ghz)
5620+ else if (is_5ghz)
56205621 ifmgd->flags |= IEEE80211_STA_DISABLE_VHT |
56215622 IEEE80211_STA_DISABLE_HE;
56225623 rcu_read_unlock();
net/mac80211/sta_info.c+18−0
@@ -258,6 +258,24 @@ struct sta_info *sta_info_get_by_idx(struct ieee80211_sub_if_data *sdata, · 257 unmodified lines
258258 */
259259 void sta_info_free(struct ieee80211_local *local, struct sta_info *sta)
260260 {
261+ /*
262+ * If we had used sta_info_pre_move_state() then we might not
263+ * have gone through the state transitions down again, so do
264+ * it here now (and warn if it's inserted).
265+ *
266+ * This will clear state such as fast TX/RX that may have been
267+ * allocated during state transitions.
268+ */
269+ while (sta->sta_state > IEEE80211_STA_NONE) {
270+ int ret;
271+
272+ WARN_ON_ONCE(test_sta_flag(sta, WLAN_STA_INSERTED));
273+
274+ ret = sta_info_move_state(sta, sta->sta_state - 1);
275+ if (WARN_ONCE(ret, "sta_info_move_state() returned %d\n", ret))
276+ break;
277+ }
278+
261279 if (sta->rate_ctrl)
262280 rate_control_free_sta(sta);
263281
net/mac80211/sta_info.h+8−1
@@ -785,7 +785,7 @@ int sta_info_init(struct ieee80211_local *local); · 784 unmodified lines
785785 void sta_info_stop(struct ieee80211_local *local);
786786
787787 /**
788− * sta_info_flush - flush matching STA entries from the STA table
788+ * __sta_info_flush - flush matching STA entries from the STA table
789789 *
790790 * Returns the number of removed STA entries.
791791 *
@@ -794,6 +794,13 @@ void sta_info_stop(struct ieee80211_local *local); · 2 unmodified lines
794794 */
795795 int __sta_info_flush(struct ieee80211_sub_if_data *sdata, bool vlans);
796796
797+/**
798+ * sta_info_flush - flush matching STA entries from the STA table
799+ *
800+ * Returns the number of removed STA entries.
801+ *
802+ * @sdata: sdata to remove all stations from
803+ */
797804 static inline int sta_info_flush(struct ieee80211_sub_if_data *sdata)
798805 {
799806 return __sta_info_flush(sdata, false);
net/mac80211/tx.c+28−16
@@ -1942,19 +1942,24 @@ static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata, · 1941 unmodified lines
19421942
19431943 /* device xmit handlers */
19441944
1945+enum ieee80211_encrypt {
1946+ ENCRYPT_NO,
1947+ ENCRYPT_MGMT,
1948+ ENCRYPT_DATA,
1949+};
1950+
19451951 static int ieee80211_skb_resize(struct ieee80211_sub_if_data *sdata,
19461952 struct sk_buff *skb,
1947− int head_need, bool may_encrypt)
1953+ int head_need,
1954+ enum ieee80211_encrypt encrypt)
19481955 {
19491956 struct ieee80211_local *local = sdata->local;
1950− struct ieee80211_hdr *hdr;
19511957 bool enc_tailroom;
19521958 int tail_need = 0;
19531959
1954− hdr = (struct ieee80211_hdr *) skb->data;
1955− enc_tailroom = may_encrypt &&
1956− (sdata->crypto_tx_tailroom_needed_cnt ||
1957− ieee80211_is_mgmt(hdr->frame_control));
1960+ enc_tailroom = encrypt == ENCRYPT_MGMT ||
1961+ (encrypt == ENCRYPT_DATA &&
1962+ sdata->crypto_tx_tailroom_needed_cnt);
19581963
19591964 if (enc_tailroom) {
19601965 tail_need = IEEE80211_ENCRYPT_TAILROOM;
@@ -1985,23 +1990,29 @@ void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, · 24 unmodified lines
19851990 {
19861991 struct ieee80211_local *local = sdata->local;
19871992 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1988− struct ieee80211_hdr *hdr;
1993+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
19891994 int headroom;
1990− bool may_encrypt;
1995+ enum ieee80211_encrypt encrypt;
19911996
1992− may_encrypt = !(info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT);
1997+ if (info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT)
1998+ encrypt = ENCRYPT_NO;
1999+ else if (ieee80211_is_mgmt(hdr->frame_control))
2000+ encrypt = ENCRYPT_MGMT;
2001+ else
2002+ encrypt = ENCRYPT_DATA;
19932003
19942004 headroom = local->tx_headroom;
1995− if (may_encrypt)
2005+ if (encrypt != ENCRYPT_NO)
19962006 headroom += sdata->encrypt_headroom;
19972007 headroom -= skb_headroom(skb);
19982008 headroom = max_t(int, 0, headroom);
19992009
2000− if (ieee80211_skb_resize(sdata, skb, headroom, may_encrypt)) {
2010+ if (ieee80211_skb_resize(sdata, skb, headroom, encrypt)) {
20012011 ieee80211_free_txskb(&local->hw, skb);
20022012 return;
20032013 }
20042014
2015+ /* reload after potential resize */
20052016 hdr = (struct ieee80211_hdr *) skb->data;
20062017 info->control.vif = &sdata->vif;
20072018
@@ -2828,7 +2839,7 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata, · 820 unmodified lines
28282839 head_need += sdata->encrypt_headroom;
28292840 head_need += local->tx_headroom;
28302841 head_need = max_t(int, 0, head_need);
2831− if (ieee80211_skb_resize(sdata, skb, head_need, true)) {
2842+ if (ieee80211_skb_resize(sdata, skb, head_need, ENCRYPT_DATA)) {
28322843 ieee80211_free_txskb(&local->hw, skb);
28332844 skb = NULL;
28342845 return ERR_PTR(-ENOMEM);
@@ -3502,7 +3513,7 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, · 667 unmodified lines
35023513 if (unlikely(ieee80211_skb_resize(sdata, skb,
35033514 max_t(int, extra_head + hw_headroom -
35043515 skb_headroom(skb), 0),
3505− false))) {
3516+ ENCRYPT_NO))) {
35063517 kfree_skb(skb);
35073518 return true;
35083519 }
@@ -3619,13 +3630,14 @@ begin: · 110 unmodified lines
36193630 tx.skb = skb;
36203631 tx.sdata = vif_to_sdata(info->control.vif);
36213632
3622− if (txq->sta && !(info->flags & IEEE80211_TX_CTL_INJECTED)) {
3633+ if (txq->sta) {
36233634 tx.sta = container_of(txq->sta, struct sta_info, sta);
36243635 /*
36253636 * Drop unicast frames to unauthorised stations unless they are
3626− * EAPOL frames from the local station.
3637+ * injected frames or EAPOL frames from the local station.
36273638 */
3628− if (unlikely(ieee80211_is_data(hdr->frame_control) &&
3639+ if (unlikely(!(info->flags & IEEE80211_TX_CTL_INJECTED) &&
3640+ ieee80211_is_data(hdr->frame_control) &&
36293641 !ieee80211_vif_is_mesh(&tx.sdata->vif) &&
36303642 tx.sdata->vif.type != NL80211_IFTYPE_OCB &&
36313643 !is_multicast_ether_addr(hdr->addr1) &&
net/mptcp/token.c+1−1
@@ -291,7 +291,7 @@ struct mptcp_sock *mptcp_token_iter_next(const struct net *net, long *s_slot, · 290 unmodified lines
291291 {
292292 struct mptcp_sock *ret = NULL;
293293 struct hlist_nulls_node *pos;
294− int slot, num;
294+ int slot, num = 0;
295295
296296 for (slot = *s_slot; slot <= token_mask; *s_num = 0, slot++) {
297297 struct token_bucket *bucket = &token_hash[slot];
net/netfilter/ipset/ip_set_core.c+2−1
@@ -637,13 +637,14 @@ ip_set_match_extensions(struct ip_set *set, const struct ip_set_ext *ext, · 636 unmodified lines
637637 if (SET_WITH_COUNTER(set)) {
638638 struct ip_set_counter *counter = ext_counter(data, set);
639639
640+ ip_set_update_counter(counter, ext, flags);
641+
640642 if (flags & IPSET_FLAG_MATCH_COUNTERS &&
641643 !(ip_set_match_counter(ip_set_get_packets(counter),
642644 mext->packets, mext->packets_op) &&
643645 ip_set_match_counter(ip_set_get_bytes(counter),
644646 mext->bytes, mext->bytes_op)))
645647 return false;
646− ip_set_update_counter(counter, ext, flags);
647648 }
648649 if (SET_WITH_SKBINFO(set))
649650 ip_set_get_skbinfo(ext_skbinfo(data, set),
net/netfilter/ipvs/ip_vs_core.c+2−2
@@ -742,12 +742,12 @@ static int ip_vs_route_me_harder(struct netns_ipvs *ipvs, int af, · 741 unmodified lines
742742 struct dst_entry *dst = skb_dst(skb);
743743
744744 if (dst->dev && !(dst->dev->flags & IFF_LOOPBACK) &&
745− ip6_route_me_harder(ipvs->net, skb) != 0)
745+ ip6_route_me_harder(ipvs->net, skb->sk, skb) != 0)
746746 return 1;
747747 } else
748748 #endif
749749 if (!(skb_rtable(skb)->rt_flags & RTCF_LOCAL) &&
750− ip_route_me_harder(ipvs->net, skb, RTN_LOCAL) != 0)
750+ ip_route_me_harder(ipvs->net, skb->sk, skb, RTN_LOCAL) != 0)
751751 return 1;
752752
753753 return 0;
net/netfilter/nf_nat_proto.c+2−2
@@ -715,7 +715,7 @@ nf_nat_ipv4_local_fn(void *priv, struct sk_buff *skb, · 714 unmodified lines
715715
716716 if (ct->tuplehash[dir].tuple.dst.u3.ip !=
717717 ct->tuplehash[!dir].tuple.src.u3.ip) {
718− err = ip_route_me_harder(state->net, skb, RTN_UNSPEC);
718+ err = ip_route_me_harder(state->net, state->sk, skb, RTN_UNSPEC);
719719 if (err < 0)
720720 ret = NF_DROP_ERR(err);
721721 }
@@ -953,7 +953,7 @@ nf_nat_ipv6_local_fn(void *priv, struct sk_buff *skb, · 231 unmodified lines
953953
954954 if (!nf_inet_addr_cmp(&ct->tuplehash[dir].tuple.dst.u3,
955955 &ct->tuplehash[!dir].tuple.src.u3)) {
956− err = nf_ip6_route_me_harder(state->net, skb);
956+ err = nf_ip6_route_me_harder(state->net, state->sk, skb);
957957 if (err < 0)
958958 ret = NF_DROP_ERR(err);
959959 }
net/netfilter/nf_synproxy_core.c+1−1
@@ -446,7 +446,7 @@ synproxy_send_tcp(struct net *net, · 445 unmodified lines
446446
447447 skb_dst_set_noref(nskb, skb_dst(skb));
448448 nskb->protocol = htons(ETH_P_IP);
449− if (ip_route_me_harder(net, nskb, RTN_UNSPEC))
449+ if (ip_route_me_harder(net, nskb->sk, nskb, RTN_UNSPEC))
450450 goto free_nskb;
451451
452452 if (nfct) {
net/netfilter/nf_tables_api.c+12−7
@@ -7137,7 +7137,7 @@ static void nf_tables_flowtable_notify(struct nft_ctx *ctx, · 7136 unmodified lines
71377137 GFP_KERNEL);
71387138 kfree(buf);
71397139
7140− if (ctx->report &&
7140+ if (!ctx->report &&
71417141 !nfnetlink_has_listeners(ctx->net, NFNLGRP_NFTABLES))
71427142 return;
71437143
@@ -7259,7 +7259,7 @@ static void nf_tables_gen_notify(struct net *net, struct sk_buff *skb, · 115 unmodified lines
72597259 audit_log_nfcfg("?:0;?:0", 0, net->nft.base_seq,
72607260 AUDIT_NFT_OP_GEN_REGISTER, GFP_KERNEL);
72617261
7262− if (nlmsg_report(nlh) &&
7262+ if (!nlmsg_report(nlh) &&
72637263 !nfnetlink_has_listeners(net, NFNLGRP_NFTABLES))
72647264 return;
72657265
@@ -8053,12 +8053,16 @@ static void nf_tables_abort_release(struct nft_trans *trans) · 787 unmodified lines
80538053 kfree(trans);
80548054 }
80558055
8056−static int __nf_tables_abort(struct net *net, bool autoload)
8056+static int __nf_tables_abort(struct net *net, enum nfnl_abort_action action)
80578057 {
80588058 struct nft_trans *trans, *next;
80598059 struct nft_trans_elem *te;
80608060 struct nft_hook *hook;
80618061
8062+ if (action == NFNL_ABORT_VALIDATE &&
8063+ nf_tables_validate(net) < 0)
8064+ return -EAGAIN;
8065+
80628066 list_for_each_entry_safe_reverse(trans, next, &net->nft.commit_list,
80638067 list) {
80648068 switch (trans->msg_type) {
@@ -8190,7 +8194,7 @@ static int __nf_tables_abort(struct net *net, bool autoload) · 125 unmodified lines
81908194 nf_tables_abort_release(trans);
81918195 }
81928196
8193− if (autoload)
8197+ if (action == NFNL_ABORT_AUTOLOAD)
81948198 nf_tables_module_autoload(net);
81958199 else
81968200 nf_tables_module_autoload_cleanup(net);
@@ -8203,9 +8207,10 @@ static void nf_tables_cleanup(struct net *net) · 6 unmodified lines
82038207 nft_validate_state_update(net, NFT_VALIDATE_SKIP);
82048208 }
82058209
8206−static int nf_tables_abort(struct net *net, struct sk_buff *skb, bool autoload)
8210+static int nf_tables_abort(struct net *net, struct sk_buff *skb,
8211+ enum nfnl_abort_action action)
82078212 {
8208− int ret = __nf_tables_abort(net, autoload);
8213+ int ret = __nf_tables_abort(net, action);
82098214
82108215 mutex_unlock(&net->nft.commit_mutex);
82118216
@@ -8836,7 +8841,7 @@ static void __net_exit nf_tables_exit_net(struct net *net) · 624 unmodified lines
88368841 {
88378842 mutex_lock(&net->nft.commit_mutex);
88388843 if (!list_empty(&net->nft.commit_list))
8839− __nf_tables_abort(net, false);
8844+ __nf_tables_abort(net, NFNL_ABORT_NONE);
88408845 __nft_release_tables(net);
88418846 mutex_unlock(&net->nft.commit_mutex);
88428847 WARN_ON_ONCE(!list_empty(&net->nft.tables));
net/netfilter/nfnetlink.c+18−4
@@ -333,7 +333,7 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh, · 332 unmodified lines
333333 return netlink_ack(skb, nlh, -EINVAL, NULL);
334334 replay:
335335 status = 0;
336−
336+replay_abort:
337337 skb = netlink_skb_clone(oskb, GFP_KERNEL);
338338 if (!skb)
339339 return netlink_ack(oskb, nlh, -ENOMEM, NULL);
@@ -499,7 +499,7 @@ ack: · 159 unmodified lines
499499 }
500500 done:
501501 if (status & NFNL_BATCH_REPLAY) {
502− ss->abort(net, oskb, true);
502+ ss->abort(net, oskb, NFNL_ABORT_AUTOLOAD);
503503 nfnl_err_reset(&err_list);
504504 kfree_skb(skb);
505505 module_put(ss->owner);
@@ -510,11 +510,25 @@ done: · 4 unmodified lines
510510 status |= NFNL_BATCH_REPLAY;
511511 goto done;
512512 } else if (err) {
513− ss->abort(net, oskb, false);
513+ ss->abort(net, oskb, NFNL_ABORT_NONE);
514514 netlink_ack(oskb, nlmsg_hdr(oskb), err, NULL);
515515 }
516516 } else {
517− ss->abort(net, oskb, false);
517+ enum nfnl_abort_action abort_action;
518+
519+ if (status & NFNL_BATCH_FAILURE)
520+ abort_action = NFNL_ABORT_NONE;
521+ else
522+ abort_action = NFNL_ABORT_VALIDATE;
523+
524+ err = ss->abort(net, oskb, abort_action);
525+ if (err == -EAGAIN) {
526+ nfnl_err_reset(&err_list);
527+ kfree_skb(skb);
528+ module_put(ss->owner);
529+ status |= NFNL_BATCH_FAILURE;
530+ goto replay_abort;
531+ }
518532 }
519533 if (ss->cleanup)
520534 ss->cleanup(net);
net/netfilter/nft_chain_route.c+2−2
@@ -42,7 +42,7 @@ static unsigned int nf_route_table_hook4(void *priv, · 41 unmodified lines
4242 iph->daddr != daddr ||
4343 skb->mark != mark ||
4444 iph->tos != tos) {
45− err = ip_route_me_harder(state->net, skb, RTN_UNSPEC);
45+ err = ip_route_me_harder(state->net, state->sk, skb, RTN_UNSPEC);
4646 if (err < 0)
4747 ret = NF_DROP_ERR(err);
4848 }
@@ -92,7 +92,7 @@ static unsigned int nf_route_table_hook6(void *priv, · 43 unmodified lines
9292 skb->mark != mark ||
9393 ipv6_hdr(skb)->hop_limit != hop_limit ||
9494 flowlabel != *((u32 *)ipv6_hdr(skb)))) {
95− err = nf_ip6_route_me_harder(state->net, skb);
95+ err = nf_ip6_route_me_harder(state->net, state->sk, skb);
9696 if (err < 0)
9797 ret = NF_DROP_ERR(err);
9898 }
net/netfilter/utils.c+2−2
@@ -191,8 +191,8 @@ static int nf_ip_reroute(struct sk_buff *skb, const struct nf_queue_entry *entry · 190 unmodified lines
191191 skb->mark == rt_info->mark &&
192192 iph->daddr == rt_info->daddr &&
193193 iph->saddr == rt_info->saddr))
194− return ip_route_me_harder(entry->state.net, skb,
195− RTN_UNSPEC);
194+ return ip_route_me_harder(entry->state.net, entry->state.sk,
195+ skb, RTN_UNSPEC);
196196 }
197197 #endif
198198 return 0;
net/openvswitch/datapath.c+7−7
@@ -1703,13 +1703,13 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info) · 1702 unmodified lines
17031703 parms.port_no = OVSP_LOCAL;
17041704 parms.upcall_portids = a[OVS_DP_ATTR_UPCALL_PID];
17051705
1706− err = ovs_dp_change(dp, a);
1707− if (err)
1708− goto err_destroy_meters;
1709−
17101706 /* So far only local changes have been made, now need the lock. */
17111707 ovs_lock();
17121708
1709+ err = ovs_dp_change(dp, a);
1710+ if (err)
1711+ goto err_unlock_and_destroy_meters;
1712+
17131713 vport = new_vport(&parms);
17141714 if (IS_ERR(vport)) {
17151715 err = PTR_ERR(vport);
@@ -1725,8 +1725,7 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info) · 9 unmodified lines
17251725 ovs_dp_reset_user_features(skb, info);
17261726 }
17271727
1728− ovs_unlock();
1729− goto err_destroy_meters;
1728+ goto err_unlock_and_destroy_meters;
17301729 }
17311730
17321731 err = ovs_dp_cmd_fill_info(dp, reply, info->snd_portid,
@@ -1741,7 +1740,8 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info) · 8 unmodified lines
17411740 ovs_notify(&dp_datapath_genl_family, reply, info);
17421741 return 0;
17431742
1744−err_destroy_meters:
1743+err_unlock_and_destroy_meters:
1744+ ovs_unlock();
17451745 ovs_meters_exit(dp);
17461746 err_destroy_ports:
17471747 kfree(dp->ports);
net/openvswitch/flow_table.c+1−1
@@ -390,7 +390,7 @@ static struct mask_cache *tbl_mask_cache_alloc(u32 size) · 389 unmodified lines
390390 }
391391 int ovs_flow_tbl_masks_cache_resize(struct flow_table *table, u32 size)
392392 {
393− struct mask_cache *mc = rcu_dereference(table->mask_cache);
393+ struct mask_cache *mc = rcu_dereference_ovsl(table->mask_cache);
394394 struct mask_cache *new;
395395
396396 if (size == mc->cache_size)
net/sctp/sm_sideeffect.c+2−2
@@ -1601,12 +1601,12 @@ static int sctp_cmd_interpreter(enum sctp_event_type event_type, · 1600 unmodified lines
16011601 break;
16021602
16031603 case SCTP_CMD_INIT_FAILED:
1604− sctp_cmd_init_failed(commands, asoc, cmd->obj.u32);
1604+ sctp_cmd_init_failed(commands, asoc, cmd->obj.u16);
16051605 break;
16061606
16071607 case SCTP_CMD_ASSOC_FAILED:
16081608 sctp_cmd_assoc_failed(commands, asoc, event_type,
1609− subtype, chunk, cmd->obj.u32);
1609+ subtype, chunk, cmd->obj.u16);
16101610 break;
16111611
16121612 case SCTP_CMD_INIT_COUNTER_INC:
net/wireless/core.c+31−26
@@ -1250,8 +1250,7 @@ void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev, · 1249 unmodified lines
12501250 }
12511251 EXPORT_SYMBOL(cfg80211_stop_iface);
12521252
1253−void cfg80211_init_wdev(struct cfg80211_registered_device *rdev,
1254− struct wireless_dev *wdev)
1253+void cfg80211_init_wdev(struct wireless_dev *wdev)
12551254 {
12561255 mutex_init(&wdev->mtx);
12571256 INIT_LIST_HEAD(&wdev->event_list);
@@ -1262,6 +1261,30 @@ void cfg80211_init_wdev(struct cfg80211_registered_device *rdev, · 4 unmodified lines
12621261 spin_lock_init(&wdev->pmsr_lock);
12631262 INIT_WORK(&wdev->pmsr_free_wk, cfg80211_pmsr_free_wk);
12641263
1264+#ifdef CONFIG_CFG80211_WEXT
1265+ wdev->wext.default_key = -1;
1266+ wdev->wext.default_mgmt_key = -1;
1267+ wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC;
1268+#endif
1269+
1270+ if (wdev->wiphy->flags & WIPHY_FLAG_PS_ON_BY_DEFAULT)
1271+ wdev->ps = true;
1272+ else
1273+ wdev->ps = false;
1274+ /* allow mac80211 to determine the timeout */
1275+ wdev->ps_timeout = -1;
1276+
1277+ if ((wdev->iftype == NL80211_IFTYPE_STATION ||
1278+ wdev->iftype == NL80211_IFTYPE_P2P_CLIENT ||
1279+ wdev->iftype == NL80211_IFTYPE_ADHOC) && !wdev->use_4addr)
1280+ wdev->netdev->priv_flags |= IFF_DONT_BRIDGE;
1281+
1282+ INIT_WORK(&wdev->disconnect_wk, cfg80211_autodisconnect_wk);
1283+}
1284+
1285+void cfg80211_register_wdev(struct cfg80211_registered_device *rdev,
1286+ struct wireless_dev *wdev)
1287+{
12651288 /*
12661289 * We get here also when the interface changes network namespaces,
12671290 * as it's registered into the new one, but we don't want it to
@@ -1295,6 +1318,11 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb, · 27 unmodified lines
12951318 switch (state) {
12961319 case NETDEV_POST_INIT:
12971320 SET_NETDEV_DEVTYPE(dev, &wiphy_type);
1321+ wdev->netdev = dev;
1322+ /* can only change netns with wiphy */
1323+ dev->features |= NETIF_F_NETNS_LOCAL;
1324+
1325+ cfg80211_init_wdev(wdev);
12981326 break;
12991327 case NETDEV_REGISTER:
13001328 /*
@@ -1302,35 +1330,12 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb, · 1 unmodified line
13021330 * called within code protected by it when interfaces
13031331 * are added with nl80211.
13041332 */
1305− /* can only change netns with wiphy */
1306− dev->features |= NETIF_F_NETNS_LOCAL;
1307−
13081333 if (sysfs_create_link(&dev->dev.kobj, &rdev->wiphy.dev.kobj,
13091334 "phy80211")) {
13101335 pr_err("failed to add phy80211 symlink to netdev!\n");
13111336 }
1312− wdev->netdev = dev;
1313−#ifdef CONFIG_CFG80211_WEXT
1314− wdev->wext.default_key = -1;
1315− wdev->wext.default_mgmt_key = -1;
1316− wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC;
1317−#endif
1318−
1319− if (wdev->wiphy->flags & WIPHY_FLAG_PS_ON_BY_DEFAULT)
1320− wdev->ps = true;
1321− else
1322− wdev->ps = false;
1323− /* allow mac80211 to determine the timeout */
1324− wdev->ps_timeout = -1;
1325−
1326− if ((wdev->iftype == NL80211_IFTYPE_STATION ||
1327− wdev->iftype == NL80211_IFTYPE_P2P_CLIENT ||
1328− wdev->iftype == NL80211_IFTYPE_ADHOC) && !wdev->use_4addr)
1329− dev->priv_flags |= IFF_DONT_BRIDGE;
1330−
1331− INIT_WORK(&wdev->disconnect_wk, cfg80211_autodisconnect_wk);
13321337
1333− cfg80211_init_wdev(rdev, wdev);
1338+ cfg80211_register_wdev(rdev, wdev);
13341339 break;
13351340 case NETDEV_GOING_DOWN:
13361341 cfg80211_leave(rdev, wdev);
net/wireless/core.h+3−2
@@ -209,8 +209,9 @@ struct wiphy *wiphy_idx_to_wiphy(int wiphy_idx); · 208 unmodified lines
209209 int cfg80211_switch_netns(struct cfg80211_registered_device *rdev,
210210 struct net *net);
211211
212−void cfg80211_init_wdev(struct cfg80211_registered_device *rdev,
213− struct wireless_dev *wdev);
212+void cfg80211_init_wdev(struct wireless_dev *wdev);
213+void cfg80211_register_wdev(struct cfg80211_registered_device *rdev,
214+ struct wireless_dev *wdev);
214215
215216 static inline void wdev_lock(struct wireless_dev *wdev)
216217 __acquires(wdev)
net/wireless/nl80211.c+2−1
@@ -3885,7 +3885,8 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info) · 3884 unmodified lines
38853885 * P2P Device and NAN do not have a netdev, so don't go
38863886 * through the netdev notifier and must be added here
38873887 */
3888− cfg80211_init_wdev(rdev, wdev);
3888+ cfg80211_init_wdev(wdev);
3889+ cfg80211_register_wdev(rdev, wdev);
38893890 break;
38903891 default:
38913892 break;
net/wireless/reg.c+1−1
@@ -3616,7 +3616,7 @@ static void print_rd_rules(const struct ieee80211_regdomain *rd) · 3615 unmodified lines
36163616 power_rule = &reg_rule->power_rule;
36173617
36183618 if (reg_rule->flags & NL80211_RRF_AUTO_BW)
3619− snprintf(bw, sizeof(bw), "%d KHz, %d KHz AUTO",
3619+ snprintf(bw, sizeof(bw), "%d KHz, %u KHz AUTO",
36203620 freq_range->max_bandwidth_khz,
36213621 reg_get_max_bandwidth(rd, reg_rule));
36223622 else
net/xfrm/xfrm_interface.c+4−4
@@ -803,14 +803,14 @@ static struct xfrm6_tunnel xfrmi_ipv6_handler __read_mostly = { · 802 unmodified lines
803803 .handler = xfrmi6_rcv_tunnel,
804804 .cb_handler = xfrmi_rcv_cb,
805805 .err_handler = xfrmi6_err,
806− .priority = -1,
806+ .priority = 2,
807807 };
808808
809809 static struct xfrm6_tunnel xfrmi_ip6ip_handler __read_mostly = {
810810 .handler = xfrmi6_rcv_tunnel,
811811 .cb_handler = xfrmi_rcv_cb,
812812 .err_handler = xfrmi6_err,
813− .priority = -1,
813+ .priority = 2,
814814 };
815815 #endif
816816
@@ -848,14 +848,14 @@ static struct xfrm_tunnel xfrmi_ipip_handler __read_mostly = { · 31 unmodified lines
848848 .handler = xfrmi4_rcv_tunnel,
849849 .cb_handler = xfrmi_rcv_cb,
850850 .err_handler = xfrmi4_err,
851− .priority = -1,
851+ .priority = 3,
852852 };
853853
854854 static struct xfrm_tunnel xfrmi_ipip6_handler __read_mostly = {
855855 .handler = xfrmi4_rcv_tunnel,
856856 .cb_handler = xfrmi_rcv_cb,
857857 .err_handler = xfrmi4_err,
858− .priority = -1,
858+ .priority = 2,
859859 };
860860 #endif
861861
net/xfrm/xfrm_state.c+5−3
@@ -2004,6 +2004,7 @@ int xfrm_alloc_spi(struct xfrm_state *x, u32 low, u32 high) · 2003 unmodified lines
20042004 int err = -ENOENT;
20052005 __be32 minspi = htonl(low);
20062006 __be32 maxspi = htonl(high);
2007+ __be32 newspi = 0;
20072008 u32 mark = x->mark.v & x->mark.m;
20082009
20092010 spin_lock_bh(&x->lock);
@@ -2022,21 +2023,22 @@ int xfrm_alloc_spi(struct xfrm_state *x, u32 low, u32 high) · 12 unmodified lines
20222023 xfrm_state_put(x0);
20232024 goto unlock;
20242025 }
2025− x->id.spi = minspi;
2026+ newspi = minspi;
20262027 } else {
20272028 u32 spi = 0;
20282029 for (h = 0; h < high-low+1; h++) {
20292030 spi = low + prandom_u32()%(high-low+1);
20302031 x0 = xfrm_state_lookup(net, mark, &x->id.daddr, htonl(spi), x->id.proto, x->props.family);
20312032 if (x0 == NULL) {
2032− x->id.spi = htonl(spi);
2033+ newspi = htonl(spi);
20332034 break;
20342035 }
20352036 xfrm_state_put(x0);
20362037 }
20372038 }
2038− if (x->id.spi) {
2039+ if (newspi) {
20392040 spin_lock_bh(&net->xfrm.xfrm_state_lock);
2041+ x->id.spi = newspi;
20402042 h = xfrm_spi_hash(net, &x->id.daddr, x->id.spi, x->id.proto, x->props.family);
20412043 hlist_add_head_rcu(&x->byspi, net->xfrm.state_byspi + h);
20422044 spin_unlock_bh(&net->xfrm.xfrm_state_lock);
scripts/get_abi.pl+23−0
@@ -287,6 +287,8 @@ my $bondary = qr { (?<![\w\/\`\{])(?=[\w\/\`\{])|(?<=[\w\/\`\{])(?![\w\/\`\{]) } · 286 unmodified lines
287287 sub output_rest {
288288 create_labels();
289289
290+ my $part = "";
291+
290292 foreach my $what (sort {
291293 ($data{$a}->{type} eq "File") cmp ($data{$b}->{type} eq "File") ||
292294 $a cmp $b
@@ -306,6 +308,21 @@ sub output_rest { · 13 unmodified lines
306308 $w =~ s/([\(\)\_\-\*\=\^\~\\])/\\$1/g;
307309
308310 if ($type ne "File") {
311+ my $cur_part = $what;
312+ if ($what =~ '/') {
313+ if ($what =~ m#^(\/?(?:[\w\-]+\/?){1,2})#) {
314+ $cur_part = "Symbols under $1";
315+ $cur_part =~ s,/$,,;
316+ }
317+ }
318+
319+ if ($cur_part ne "" && $part ne $cur_part) {
320+ $part = $cur_part;
321+ my $bar = $part;
322+ $bar =~ s/./-/g;
323+ print "$part\n$bar\n\n";
324+ }
325+
309326 printf ".. _%s:\n\n", $data{$what}->{label};
310327
311328 my @names = split /, /,$w;
@@ -352,6 +369,12 @@ sub output_rest { · 40 unmodified lines
352369
353370 if (!($desc =~ /^\s*$/)) {
354371 if ($description_is_rst) {
372+ # Remove title markups from the description
373+ # Having titles inside ABI files will only work if extra
374+ # care would be taken in order to strictly follow the same
375+ # level order for each markup.
376+ $desc =~ s/\n[\-\*\=\^\~]+\n/\n\n/g;
377+
355378 # Enrich text by creating cross-references
356379
357380 $desc =~ s,Documentation/(?!devicetree)(\S+)\.rst,:doc:`/$1`,g;
scripts/kernel-doc+15−6
@@ -1092,7 +1092,11 @@ sub output_struct_rst(%) { · 1091 unmodified lines
10921092 print "\n\n.. c:type:: " . $name . "\n\n";
10931093 } else {
10941094 my $name = $args{'struct'};
1095− print "\n\n.. c:struct:: " . $name . "\n\n";
1095+ if ($args{'type'} eq 'union') {
1096+ print "\n\n.. c:union:: " . $name . "\n\n";
1097+ } else {
1098+ print "\n\n.. c:struct:: " . $name . "\n\n";
1099+ }
10961100 }
10971101 print_lineno($declaration_start_line);
10981102 $lineprefix = " ";
@@ -1427,20 +1431,25 @@ sub dump_enum($$) { · 328 unmodified lines
14271431 }
14281432 }
14291433
1434+my $typedef_type = qr { ((?:\s+[\w\*]+){1,8})\s* }x;
1435+my $typedef_ident = qr { \*?\s*(\w\S+)\s* }x;
1436+my $typedef_args = qr { \s*\((.*)\); }x;
1437+
1438+my $typedef1 = qr { typedef$typedef_type\($typedef_ident\)$typedef_args }x;
1439+my $typedef2 = qr { typedef$typedef_type$typedef_ident$typedef_args }x;
1440+
14301441 sub dump_typedef($$) {
14311442 my $x = shift;
14321443 my $file = shift;
14331444
14341445 $x =~ s@/\*.*?\*/@@gos; # strip comments.
14351446
1436− # Parse function prototypes
1437− if ($x =~ /typedef\s+(\w+)\s*\(\*\s*(\w\S+)\s*\)\s*\((.*)\);/ ||
1438− $x =~ /typedef\s+(\w+)\s*(\w\S+)\s*\s*\((.*)\);/) {
1439−
1440− # Function typedefs
1447+ # Parse function typedef prototypes
1448+ if ($x =~ $typedef1 || $x =~ $typedef2) {
14411449 $return_type = $1;
14421450 $declaration_name = $2;
14431451 my $args = $3;
1452+ $return_type =~ s/^\s+//;
14441453
14451454 create_parameterlist($args, ',', $file, $declaration_name);
14461455
sound/core/control.c+2−2
@@ -1925,8 +1925,8 @@ EXPORT_SYMBOL(snd_ctl_unregister_ioctl); · 1924 unmodified lines
19251925
19261926 #ifdef CONFIG_COMPAT
19271927 /**
1928− * snd_ctl_unregister_ioctl - de-register the device-specific compat 32bit
1929− * control-ioctls
1928+ * snd_ctl_unregister_ioctl_compat - de-register the device-specific compat
1929+ * 32bit control-ioctls
19301930 * @fcn: ioctl callback function to unregister
19311931 */
19321932 int snd_ctl_unregister_ioctl_compat(snd_kctl_ioctl_func_t fcn)
sound/core/pcm_dmaengine.c+2−1
@@ -356,7 +356,8 @@ int snd_dmaengine_pcm_close(struct snd_pcm_substream *substream) · 355 unmodified lines
356356 EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_close);
357357
358358 /**
359− * snd_dmaengine_pcm_release_chan_close - Close a dmaengine based PCM substream and release channel
359+ * snd_dmaengine_pcm_close_release_chan - Close a dmaengine based PCM
360+ * substream and release channel
360361 * @substream: PCM substream
361362 *
362363 * Releases the DMA channel associated with the PCM substream.
sound/core/pcm_lib.c+1−1
@@ -490,7 +490,7 @@ void snd_pcm_set_ops(struct snd_pcm *pcm, int direction, · 489 unmodified lines
490490 EXPORT_SYMBOL(snd_pcm_set_ops);
491491
492492 /**
493− * snd_pcm_sync - set the PCM sync id
493+ * snd_pcm_set_sync - set the PCM sync id
494494 * @substream: the pcm substream
495495 *
496496 * Sets the PCM sync identifier for the card.
sound/core/pcm_native.c+2−2
@@ -112,7 +112,7 @@ void snd_pcm_stream_lock(struct snd_pcm_substream *substream) · 111 unmodified lines
112112 EXPORT_SYMBOL_GPL(snd_pcm_stream_lock);
113113
114114 /**
115− * snd_pcm_stream_lock - Unlock the PCM stream
115+ * snd_pcm_stream_unlock - Unlock the PCM stream
116116 * @substream: PCM substream
117117 *
118118 * This unlocks the PCM stream that has been locked via snd_pcm_stream_lock().
@@ -595,7 +595,7 @@ static void snd_pcm_sync_stop(struct snd_pcm_substream *substream) · 476 unmodified lines
595595 }
596596
597597 /**
598− * snd_pcm_hw_param_choose - choose a configuration defined by @params
598+ * snd_pcm_hw_params_choose - choose a configuration defined by @params
599599 * @pcm: PCM instance
600600 * @params: the hw_params instance
601601 *
sound/hda/ext/hdac_ext_controller.c+2−0
@@ -148,6 +148,8 @@ struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_bus *bus, · 147 unmodified lines
148148 return NULL;
149149 if (bus->idx != bus_idx)
150150 return NULL;
151+ if (addr < 0 || addr > 31)
152+ return NULL;
151153
152154 list_for_each_entry(hlink, &bus->hlink_list, list) {
153155 for (i = 0; i < HDA_MAX_CODECS; i++) {
sound/pci/hda/hda_codec.c+29−16
@@ -2934,7 +2934,7 @@ static void hda_call_codec_resume(struct hda_codec *codec) · 2933 unmodified lines
29342934 snd_hdac_leave_pm(&codec->core);
29352935 }
29362936
2937−static int hda_codec_runtime_suspend(struct device *dev)
2937+static int hda_codec_suspend(struct device *dev)
29382938 {
29392939 struct hda_codec *codec = dev_to_hda_codec(dev);
29402940 unsigned int state;
@@ -2953,7 +2953,7 @@ static int hda_codec_runtime_suspend(struct device *dev) · 12 unmodified lines
29532953 return 0;
29542954 }
29552955
2956−static int hda_codec_runtime_resume(struct device *dev)
2956+static int hda_codec_resume(struct device *dev)
29572957 {
29582958 struct hda_codec *codec = dev_to_hda_codec(dev);
29592959
@@ -2967,57 +2967,70 @@ static int hda_codec_runtime_resume(struct device *dev) · 7 unmodified lines
29672967 pm_runtime_mark_last_busy(dev);
29682968 return 0;
29692969 }
2970+
2971+static int hda_codec_runtime_suspend(struct device *dev)
2972+{
2973+ return hda_codec_suspend(dev);
2974+}
2975+
2976+static int hda_codec_runtime_resume(struct device *dev)
2977+{
2978+ return hda_codec_resume(dev);
2979+}
2980+
29702981 #endif /* CONFIG_PM */
29712982
29722983 #ifdef CONFIG_PM_SLEEP
2973−static int hda_codec_force_resume(struct device *dev)
2984+static int hda_codec_pm_prepare(struct device *dev)
2985+{
2986+ return pm_runtime_suspended(dev);
2987+}
2988+
2989+static void hda_codec_pm_complete(struct device *dev)
29742990 {
29752991 struct hda_codec *codec = dev_to_hda_codec(dev);
2976− int ret;
29772992
2978− ret = pm_runtime_force_resume(dev);
2979− /* schedule jackpoll work for jack detection update */
2980− if (codec->jackpoll_interval ||
2981− (pm_runtime_suspended(dev) && hda_codec_need_resume(codec)))
2982− schedule_delayed_work(&codec->jackpoll_work,
2983− codec->jackpoll_interval);
2984− return ret;
2993+ if (pm_runtime_suspended(dev) && (codec->jackpoll_interval ||
2994+ hda_codec_need_resume(codec) || codec->forced_resume))
2995+ pm_request_resume(dev);
29852996 }
29862997
29872998 static int hda_codec_pm_suspend(struct device *dev)
29882999 {
29893000 dev->power.power_state = PMSG_SUSPEND;
2990− return pm_runtime_force_suspend(dev);
3001+ return hda_codec_suspend(dev);
29913002 }
29923003
29933004 static int hda_codec_pm_resume(struct device *dev)
29943005 {
29953006 dev->power.power_state = PMSG_RESUME;
2996− return hda_codec_force_resume(dev);
3007+ return hda_codec_resume(dev);
29973008 }
29983009
29993010 static int hda_codec_pm_freeze(struct device *dev)
30003011 {
30013012 dev->power.power_state = PMSG_FREEZE;
3002− return pm_runtime_force_suspend(dev);
3013+ return hda_codec_suspend(dev);
30033014 }
30043015
30053016 static int hda_codec_pm_thaw(struct device *dev)
30063017 {
30073018 dev->power.power_state = PMSG_THAW;
3008− return hda_codec_force_resume(dev);
3019+ return hda_codec_resume(dev);
30093020 }
30103021
30113022 static int hda_codec_pm_restore(struct device *dev)
30123023 {
30133024 dev->power.power_state = PMSG_RESTORE;
3014− return hda_codec_force_resume(dev);
3025+ return hda_codec_resume(dev);
30153026 }
30163027 #endif /* CONFIG_PM_SLEEP */
30173028
30183029 /* referred in hda_bind.c */
30193030 const struct dev_pm_ops hda_codec_driver_pm = {
30203031 #ifdef CONFIG_PM_SLEEP
3032+ .prepare = hda_codec_pm_prepare,
3033+ .complete = hda_codec_pm_complete,
30213034 .suspend = hda_codec_pm_suspend,
30223035 .resume = hda_codec_pm_resume,
30233036 .freeze = hda_codec_pm_freeze,
sound/pci/hda/hda_controller.h+2−1
@@ -41,7 +41,7 @@ · 40 unmodified lines
4141 /* 24 unused */
4242 #define AZX_DCAPS_COUNT_LPIB_DELAY (1 << 25) /* Take LPIB as delay */
4343 #define AZX_DCAPS_PM_RUNTIME (1 << 26) /* runtime PM support */
44−#define AZX_DCAPS_SUSPEND_SPURIOUS_WAKEUP (1 << 27) /* Workaround for spurious wakeups after suspend */
44+/* 27 unused */
4545 #define AZX_DCAPS_CORBRP_SELF_CLEAR (1 << 28) /* CORBRP clears itself after reset */
4646 #define AZX_DCAPS_NO_MSI64 (1 << 29) /* Stick to 32-bit MSIs */
4747 #define AZX_DCAPS_SEPARATE_STREAM_TAG (1 << 30) /* capture and playback use separate stream tag */
@@ -143,6 +143,7 @@ struct azx { · 95 unmodified lines
143143 unsigned int align_buffer_size:1;
144144 unsigned int region_requested:1;
145145 unsigned int disabled:1; /* disabled by vga_switcheroo */
146+ unsigned int pm_prepared:1;
146147
147148 /* GTS present */
148149 unsigned int gts_present:1;
sound/pci/hda/hda_intel.c+35−28
@@ -297,8 +297,7 @@ enum { · 296 unmodified lines
297297 /* PCH for HSW/BDW; with runtime PM */
298298 /* no i915 binding for this as HSW/BDW has another controller for HDMI */
299299 #define AZX_DCAPS_INTEL_PCH \
300− (AZX_DCAPS_INTEL_PCH_BASE | AZX_DCAPS_PM_RUNTIME |\
301− AZX_DCAPS_SUSPEND_SPURIOUS_WAKEUP)
300+ (AZX_DCAPS_INTEL_PCH_BASE | AZX_DCAPS_PM_RUNTIME)
302301
303302 /* HSW HDMI */
304303 #define AZX_DCAPS_INTEL_HASWELL \
@@ -985,7 +984,7 @@ static void __azx_runtime_suspend(struct azx *chip) · 680 unmodified lines
985984 display_power(chip, false);
986985 }
987986
988−static void __azx_runtime_resume(struct azx *chip, bool from_rt)
987+static void __azx_runtime_resume(struct azx *chip)
989988 {
990989 struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
991990 struct hdac_bus *bus = azx_bus(chip);
@@ -1002,7 +1001,8 @@ static void __azx_runtime_resume(struct azx *chip, bool from_rt) · 10 unmodified lines
10021001 azx_init_pci(chip);
10031002 hda_intel_init_chip(chip, true);
10041003
1005− if (from_rt) {
1004+ /* Avoid codec resume if runtime resume is for system suspend */
1005+ if (!chip->pm_prepared) {
10061006 list_for_each_codec(codec, &chip->bus) {
10071007 if (codec->relaxed_resume)
10081008 continue;
@@ -1018,6 +1018,29 @@ static void __azx_runtime_resume(struct azx *chip, bool from_rt) · 9 unmodified lines
10181018 }
10191019
10201020 #ifdef CONFIG_PM_SLEEP
1021+static int azx_prepare(struct device *dev)
1022+{
1023+ struct snd_card *card = dev_get_drvdata(dev);
1024+ struct azx *chip;
1025+
1026+ chip = card->private_data;
1027+ chip->pm_prepared = 1;
1028+
1029+ /* HDA controller always requires different WAKEEN for runtime suspend
1030+ * and system suspend, so don't use direct-complete here.
1031+ */
1032+ return 0;
1033+}
1034+
1035+static void azx_complete(struct device *dev)
1036+{
1037+ struct snd_card *card = dev_get_drvdata(dev);
1038+ struct azx *chip;
1039+
1040+ chip = card->private_data;
1041+ chip->pm_prepared = 0;
1042+}
1043+
10211044 static int azx_suspend(struct device *dev)
10221045 {
10231046 struct snd_card *card = dev_get_drvdata(dev);
@@ -1029,15 +1052,7 @@ static int azx_suspend(struct device *dev) · 5 unmodified lines
10291052
10301053 chip = card->private_data;
10311054 bus = azx_bus(chip);
1032− snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
1033− /* An ugly workaround: direct call of __azx_runtime_suspend() and
1034− * __azx_runtime_resume() for old Intel platforms that suffer from
1035− * spurious wakeups after S3 suspend
1036− */
1037− if (chip->driver_caps & AZX_DCAPS_SUSPEND_SPURIOUS_WAKEUP)
1038− __azx_runtime_suspend(chip);
1039− else
1040− pm_runtime_force_suspend(dev);
1055+ __azx_runtime_suspend(chip);
10411056 if (bus->irq >= 0) {
10421057 free_irq(bus->irq, chip);
10431058 bus->irq = -1;
@@ -1066,11 +1081,7 @@ static int azx_resume(struct device *dev) · 22 unmodified lines
10661081 if (azx_acquire_irq(chip, 1) < 0)
10671082 return -EIO;
10681083
1069− if (chip->driver_caps & AZX_DCAPS_SUSPEND_SPURIOUS_WAKEUP)
1070− __azx_runtime_resume(chip, false);
1071− else
1072− pm_runtime_force_resume(dev);
1073− snd_power_change_state(card, SNDRV_CTL_POWER_D0);
1084+ __azx_runtime_resume(chip);
10741085
10751086 trace_azx_resume(chip);
10761087 return 0;
@@ -1118,10 +1129,7 @@ static int azx_runtime_suspend(struct device *dev) · 41 unmodified lines
11181129 chip = card->private_data;
11191130
11201131 /* enable controller wake up event */
1121− if (snd_power_get_state(card) == SNDRV_CTL_POWER_D0) {
1122− azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) |
1123− STATESTS_INT_MASK);
1124− }
1132+ azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) | STATESTS_INT_MASK);
11251133
11261134 __azx_runtime_suspend(chip);
11271135 trace_azx_runtime_suspend(chip);
@@ -1132,18 +1140,14 @@ static int azx_runtime_resume(struct device *dev) · 4 unmodified lines
11321140 {
11331141 struct snd_card *card = dev_get_drvdata(dev);
11341142 struct azx *chip;
1135− bool from_rt = snd_power_get_state(card) == SNDRV_CTL_POWER_D0;
11361143
11371144 if (!azx_is_pm_ready(card))
11381145 return 0;
11391146 chip = card->private_data;
1140− __azx_runtime_resume(chip, from_rt);
1147+ __azx_runtime_resume(chip);
11411148
11421149 /* disable controller Wake Up event*/
1143− if (from_rt) {
1144− azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) &
1145− ~STATESTS_INT_MASK);
1146− }
1150+ azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) & ~STATESTS_INT_MASK);
11471151
11481152 trace_azx_runtime_resume(chip);
11491153 return 0;
@@ -1177,6 +1181,8 @@ static int azx_runtime_idle(struct device *dev) · 27 unmodified lines
11771181 static const struct dev_pm_ops azx_pm = {
11781182 SET_SYSTEM_SLEEP_PM_OPS(azx_suspend, azx_resume)
11791183 #ifdef CONFIG_PM_SLEEP
1184+ .prepare = azx_prepare,
1185+ .complete = azx_complete,
11801186 .freeze_noirq = azx_freeze_noirq,
11811187 .thaw_noirq = azx_thaw_noirq,
11821188 #endif
@@ -2356,6 +2362,7 @@ static int azx_probe_continue(struct azx *chip) · 1173 unmodified lines
23562362
23572363 if (azx_has_pm_runtime(chip)) {
23582364 pm_runtime_use_autosuspend(&pci->dev);
2365+ pm_runtime_allow(&pci->dev);
23592366 pm_runtime_put_autosuspend(&pci->dev);
23602367 }
23612368
sound/pci/hda/patch_realtek.c+56−11
@@ -6008,6 +6008,27 @@ static void alc285_fixup_invalidate_dacs(struct hda_codec *codec, · 6007 unmodified lines
60086008 snd_hda_override_wcaps(codec, 0x03, 0);
60096009 }
60106010
6011+static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6012+{
6013+ switch (codec->core.vendor_id) {
6014+ case 0x10ec0274:
6015+ case 0x10ec0294:
6016+ case 0x10ec0225:
6017+ case 0x10ec0295:
6018+ case 0x10ec0299:
6019+ alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6020+ alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6021+ break;
6022+ case 0x10ec0235:
6023+ case 0x10ec0236:
6024+ case 0x10ec0255:
6025+ case 0x10ec0256:
6026+ alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6027+ alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6028+ break;
6029+ }
6030+}
6031+
60116032 static void alc295_fixup_chromebook(struct hda_codec *codec,
60126033 const struct hda_fixup *fix, int action)
60136034 {
@@ -6018,16 +6039,7 @@ static void alc295_fixup_chromebook(struct hda_codec *codec, · 4 unmodified lines
60186039 spec->ultra_low_power = true;
60196040 break;
60206041 case HDA_FIXUP_ACT_INIT:
6021− switch (codec->core.vendor_id) {
6022− case 0x10ec0295:
6023− alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6024− alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6025− break;
6026− case 0x10ec0236:
6027− alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6028− alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6029− break;
6030− }
6042+ alc_combo_jack_hp_jd_restart(codec);
60316043 break;
60326044 }
60336045 }
@@ -6083,6 +6095,16 @@ static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec, · 49 unmodified lines
60836095 alc_write_coef_idx(codec, 0x65, 0x0);
60846096 }
60856097
6098+static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6099+ const struct hda_fixup *fix, int action)
6100+{
6101+ switch (action) {
6102+ case HDA_FIXUP_ACT_INIT:
6103+ alc_combo_jack_hp_jd_restart(codec);
6104+ break;
6105+ }
6106+}
6107+
60866108 /* for hda_fixup_thinkpad_acpi() */
60876109 #include "thinkpad_helper.c"
60886110
@@ -6277,6 +6299,8 @@ enum { · 188 unmodified lines
62776299 ALC256_FIXUP_INTEL_NUC8_RUGGED,
62786300 ALC255_FIXUP_XIAOMI_HEADSET_MIC,
62796301 ALC274_FIXUP_HP_MIC,
6302+ ALC274_FIXUP_HP_HEADSET_MIC,
6303+ ALC256_FIXUP_ASUS_HPE,
62806304 };
62816305
62826306 static const struct hda_fixup alc269_fixups[] = {
@@ -7664,6 +7688,23 @@ static const struct hda_fixup alc269_fixups[] = { · 1381 unmodified lines
76647688 { }
76657689 },
76667690 },
7691+ [ALC274_FIXUP_HP_HEADSET_MIC] = {
7692+ .type = HDA_FIXUP_FUNC,
7693+ .v.func = alc274_fixup_hp_headset_mic,
7694+ .chained = true,
7695+ .chain_id = ALC274_FIXUP_HP_MIC
7696+ },
7697+ [ALC256_FIXUP_ASUS_HPE] = {
7698+ .type = HDA_FIXUP_VERBS,
7699+ .v.verbs = (const struct hda_verb[]) {
7700+ /* Set EAPD high */
7701+ { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7702+ { 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
7703+ { }
7704+ },
7705+ .chained = true,
7706+ .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7707+ },
76677708 };
76687709
76697710 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -7815,7 +7856,6 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 145 unmodified lines
78157856 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
78167857 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
78177858 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
7818− SND_PCI_QUIRK(0x103c, 0x874e, "HP", ALC274_FIXUP_HP_MIC),
78197859 SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
78207860 SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
78217861 SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
@@ -7848,6 +7888,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 26 unmodified lines
78487888 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
78497889 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
78507890 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
7891+ SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
78517892 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
78527893 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
78537894 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
@@ -8339,6 +8380,10 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { · 485 unmodified lines
83398380 {0x1a, 0x90a70130},
83408381 {0x1b, 0x90170110},
83418382 {0x21, 0x03211020}),
8383+ SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
8384+ {0x17, 0x90170110},
8385+ {0x19, 0x03a11030},
8386+ {0x21, 0x03211020}),
83428387 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
83438388 {0x12, 0x90a60130},
83448389 {0x14, 0x90170110},
sound/soc/atmel/mchp-spdiftx.c+0−1
@@ -487,7 +487,6 @@ static int mchp_spdiftx_hw_params(struct snd_pcm_substream *substream, · 486 unmodified lines
487487 }
488488 mchp_spdiftx_channel_status_write(dev);
489489 spin_unlock_irqrestore(&ctrl->lock, flags);
490− mr |= SPDIFTX_MR_VALID1 | SPDIFTX_MR_VALID2;
491490
492491 if (dev->gclk_enabled) {
493492 clk_disable_unprepare(dev->gclk);
sound/soc/codecs/cs42l51.c+21−1
@@ -254,8 +254,28 @@ static const struct snd_soc_dapm_widget cs42l51_dapm_widgets[] = { · 253 unmodified lines
254254 &cs42l51_adcr_mux_controls),
255255 };
256256
257+static int mclk_event(struct snd_soc_dapm_widget *w,
258+ struct snd_kcontrol *kcontrol, int event)
259+{
260+ struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm);
261+ struct cs42l51_private *cs42l51 = snd_soc_component_get_drvdata(comp);
262+
263+ switch (event) {
264+ case SND_SOC_DAPM_PRE_PMU:
265+ return clk_prepare_enable(cs42l51->mclk_handle);
266+ case SND_SOC_DAPM_POST_PMD:
267+ /* Delay mclk shutdown to fulfill power-down sequence requirements */
268+ msleep(20);
269+ clk_disable_unprepare(cs42l51->mclk_handle);
270+ break;
271+ }
272+
273+ return 0;
274+}
275+
257276 static const struct snd_soc_dapm_widget cs42l51_dapm_mclk_widgets[] = {
258− SND_SOC_DAPM_CLOCK_SUPPLY("MCLK")
277+ SND_SOC_DAPM_SUPPLY("MCLK", SND_SOC_NOPM, 0, 0, mclk_event,
278+ SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
259279 };
260280
261281 static const struct snd_soc_dapm_route cs42l51_routes[] = {
sound/soc/codecs/wcd9335.c+1−1
@@ -618,7 +618,7 @@ static const char * const sb_tx8_mux_text[] = { · 617 unmodified lines
618618 "ZERO", "RX_MIX_TX8", "DEC8", "DEC8_192"
619619 };
620620
621−static const DECLARE_TLV_DB_SCALE(digital_gain, 0, 1, 0);
621+static const DECLARE_TLV_DB_SCALE(digital_gain, -8400, 100, -8400);
622622 static const DECLARE_TLV_DB_SCALE(line_gain, 0, 7, 1);
623623 static const DECLARE_TLV_DB_SCALE(analog_gain, 0, 25, 1);
624624 static const DECLARE_TLV_DB_SCALE(ear_pa_gain, 0, 150, 0);
sound/soc/codecs/wcd934x.c+1−1
@@ -551,7 +551,7 @@ struct wcd_iir_filter_ctl { · 550 unmodified lines
551551 struct soc_bytes_ext bytes_ext;
552552 };
553553
554−static const DECLARE_TLV_DB_SCALE(digital_gain, 0, 1, 0);
554+static const DECLARE_TLV_DB_SCALE(digital_gain, -8400, 100, -8400);
555555 static const DECLARE_TLV_DB_SCALE(line_gain, 0, 7, 1);
556556 static const DECLARE_TLV_DB_SCALE(analog_gain, 0, 25, 1);
557557 static const DECLARE_TLV_DB_SCALE(ear_pa_gain, 0, 150, 0);
sound/soc/codecs/wsa881x.c+2−0
@@ -1026,6 +1026,8 @@ static struct snd_soc_dai_driver wsa881x_dais[] = { · 1025 unmodified lines
10261026 .id = 0,
10271027 .playback = {
10281028 .stream_name = "SPKR Playback",
1029+ .rates = SNDRV_PCM_RATE_48000,
1030+ .formats = SNDRV_PCM_FMTBIT_S16_LE,
10291031 .rate_max = 48000,
10301032 .rate_min = 48000,
10311033 .channels_min = 1,
sound/soc/intel/Kconfig+0−18
@@ -15,22 +15,6 @@ config SND_SOC_INTEL_SST_TOPLEVEL · 14 unmodified lines
1515
1616 if SND_SOC_INTEL_SST_TOPLEVEL
1717
18−config SND_SST_IPC
19− tristate
20− # This option controls the IPC core for HiFi2 platforms
21−
22−config SND_SST_IPC_PCI
23− tristate
24− select SND_SST_IPC
25− # This option controls the PCI-based IPC for HiFi2 platforms
26− # (Medfield, Merrifield).
27−
28−config SND_SST_IPC_ACPI
29− tristate
30− select SND_SST_IPC
31− # This option controls the ACPI-based IPC for HiFi2 platforms
32− # (Baytrail, Cherrytrail)
33−
3418 config SND_SOC_INTEL_SST
3519 tristate
3620
@@ -57,7 +41,6 @@ config SND_SST_ATOM_HIFI2_PLATFORM · 20 unmodified lines
5741 config SND_SST_ATOM_HIFI2_PLATFORM_PCI
5842 tristate "PCI HiFi2 (Merrifield) Platforms"
5943 depends on X86 && PCI
60− select SND_SST_IPC_PCI
6144 select SND_SST_ATOM_HIFI2_PLATFORM
6245 help
6346 If you have a Intel Merrifield/Edison platform, then
@@ -70,7 +53,6 @@ config SND_SST_ATOM_HIFI2_PLATFORM_ACPI · 6 unmodified lines
7053 tristate "ACPI HiFi2 (Baytrail, Cherrytrail) Platforms"
7154 default ACPI
7255 depends on X86 && ACPI && PCI
73− select SND_SST_IPC_ACPI
7456 select SND_SST_ATOM_HIFI2_PLATFORM
7557 select SND_SOC_ACPI_INTEL_MATCH
7658 select IOSF_MBI
sound/soc/intel/atom/Makefile+1−1
@@ -6,4 +6,4 @@ snd-soc-sst-atom-hifi2-platform-objs := sst-mfld-platform-pcm.o \ · 5 unmodified lines
66 obj-$(CONFIG_SND_SST_ATOM_HIFI2_PLATFORM) += snd-soc-sst-atom-hifi2-platform.o
77
88 # DSP driver
9−obj-$(CONFIG_SND_SST_IPC) += sst/
9+obj-$(CONFIG_SND_SST_ATOM_HIFI2_PLATFORM) += sst/
sound/soc/intel/atom/sst/Makefile+3−3
@@ -3,6 +3,6 @@ snd-intel-sst-core-objs := sst.o sst_ipc.o sst_stream.o sst_drv_interface.o sst_ · 2 unmodified lines
33 snd-intel-sst-pci-objs += sst_pci.o
44 snd-intel-sst-acpi-objs += sst_acpi.o
55
6−obj-$(CONFIG_SND_SST_IPC) += snd-intel-sst-core.o
7−obj-$(CONFIG_SND_SST_IPC_PCI) += snd-intel-sst-pci.o
8−obj-$(CONFIG_SND_SST_IPC_ACPI) += snd-intel-sst-acpi.o
6+obj-$(CONFIG_SND_SST_ATOM_HIFI2_PLATFORM) += snd-intel-sst-core.o
7+obj-$(CONFIG_SND_SST_ATOM_HIFI2_PLATFORM_PCI) += snd-intel-sst-pci.o
8+obj-$(CONFIG_SND_SST_ATOM_HIFI2_PLATFORM_ACPI) += snd-intel-sst-acpi.o
sound/soc/intel/boards/kbl_rt5663_max98927.c+31−8
@@ -401,17 +401,40 @@ static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd, · 400 unmodified lines
401401 struct snd_interval *chan = hw_param_interval(params,
402402 SNDRV_PCM_HW_PARAM_CHANNELS);
403403 struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
404− struct snd_soc_dpcm *dpcm = container_of(
405− params, struct snd_soc_dpcm, hw_params);
406− struct snd_soc_dai_link *fe_dai_link = dpcm->fe->dai_link;
407− struct snd_soc_dai_link *be_dai_link = dpcm->be->dai_link;
404+ struct snd_soc_dpcm *dpcm, *rtd_dpcm = NULL;
405+
406+ /*
407+ * The following loop will be called only for playback stream
408+ * In this platform, there is only one playback device on every SSP
409+ */
410+ for_each_dpcm_fe(rtd, SNDRV_PCM_STREAM_PLAYBACK, dpcm) {
411+ rtd_dpcm = dpcm;
412+ break;
413+ }
414+
415+ /*
416+ * This following loop will be called only for capture stream
417+ * In this platform, there is only one capture device on every SSP
418+ */
419+ for_each_dpcm_fe(rtd, SNDRV_PCM_STREAM_CAPTURE, dpcm) {
420+ rtd_dpcm = dpcm;
421+ break;
422+ }
423+
424+ if (!rtd_dpcm)
425+ return -EINVAL;
426+
427+ /*
428+ * The above 2 loops are mutually exclusive based on the stream direction,
429+ * thus rtd_dpcm variable will never be overwritten
430+ */
408431
409432 /*
410433 * The ADSP will convert the FE rate to 48k, stereo, 24 bit
411434 */
412− if (!strcmp(fe_dai_link->name, "Kbl Audio Port") ||
413− !strcmp(fe_dai_link->name, "Kbl Audio Headset Playback") ||
414− !strcmp(fe_dai_link->name, "Kbl Audio Capture Port")) {
435+ if (!strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Port") ||
436+ !strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Headset Playback") ||
437+ !strcmp(rtd_dpcm->fe->dai_link->name, "Kbl Audio Capture Port")) {
415438 rate->min = rate->max = 48000;
416439 chan->min = chan->max = 2;
417440 snd_mask_none(fmt);
@@ -421,7 +444,7 @@ static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd, · 3 unmodified lines
421444 * The speaker on the SSP0 supports S16_LE and not S24_LE.
422445 * thus changing the mask here
423446 */
424− if (!strcmp(be_dai_link->name, "SSP0-Codec"))
447+ if (!strcmp(rtd_dpcm->be->dai_link->name, "SSP0-Codec"))
425448 snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE);
426449
427450 return 0;
sound/soc/intel/catpt/dsp.c+6−3
@@ -267,9 +267,12 @@ static int catpt_dsp_select_lpclock(struct catpt_dev *cdev, bool lp, bool waiti) · 266 unmodified lines
267267 reg, (reg & CATPT_ISD_DCPWM),
268268 500, 10000);
269269 if (ret) {
270− dev_err(cdev->dev, "await WAITI timeout\n");
271− mutex_unlock(&cdev->clk_mutex);
272− return ret;
270+ dev_warn(cdev->dev, "await WAITI timeout\n");
271+ /* no signal - only high clock selection allowed */
272+ if (lp) {
273+ mutex_unlock(&cdev->clk_mutex);
274+ return 0;
275+ }
273276 }
274277 }
275278
sound/soc/intel/catpt/pcm.c+10−0
@@ -667,7 +667,17 @@ static int catpt_dai_pcm_new(struct snd_soc_pcm_runtime *rtm, · 666 unmodified lines
667667 break;
668668 }
669669
670+ /* see if this is a new configuration */
671+ if (!memcmp(&cdev->devfmt[devfmt.iface], &devfmt, sizeof(devfmt)))
672+ return 0;
673+
674+ pm_runtime_get_sync(cdev->dev);
675+
670676 ret = catpt_ipc_set_device_format(cdev, &devfmt);
677+
678+ pm_runtime_mark_last_busy(cdev->dev);
679+ pm_runtime_put_autosuspend(cdev->dev);
680+
671681 if (ret)
672682 return CATPT_IPC_ERROR(ret);
673683
sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c+25−6
@@ -630,15 +630,34 @@ static struct snd_soc_codec_conf mt8183_da7219_rt1015_codec_conf[] = { · 629 unmodified lines
630630 },
631631 };
632632
633+static const struct snd_kcontrol_new mt8183_da7219_rt1015_snd_controls[] = {
634+ SOC_DAPM_PIN_SWITCH("Left Spk"),
635+ SOC_DAPM_PIN_SWITCH("Right Spk"),
636+};
637+
638+static const
639+struct snd_soc_dapm_widget mt8183_da7219_rt1015_dapm_widgets[] = {
640+ SND_SOC_DAPM_SPK("Left Spk", NULL),
641+ SND_SOC_DAPM_SPK("Right Spk", NULL),
642+ SND_SOC_DAPM_PINCTRL("TDM_OUT_PINCTRL",
643+ "aud_tdm_out_on", "aud_tdm_out_off"),
644+};
645+
646+static const struct snd_soc_dapm_route mt8183_da7219_rt1015_dapm_routes[] = {
647+ {"Left Spk", NULL, "Left SPO"},
648+ {"Right Spk", NULL, "Right SPO"},
649+ {"I2S Playback", NULL, "TDM_OUT_PINCTRL"},
650+};
651+
633652 static struct snd_soc_card mt8183_da7219_rt1015_card = {
634653 .name = "mt8183_da7219_rt1015",
635654 .owner = THIS_MODULE,
636− .controls = mt8183_da7219_max98357_snd_controls,
637− .num_controls = ARRAY_SIZE(mt8183_da7219_max98357_snd_controls),
638− .dapm_widgets = mt8183_da7219_max98357_dapm_widgets,
639− .num_dapm_widgets = ARRAY_SIZE(mt8183_da7219_max98357_dapm_widgets),
640− .dapm_routes = mt8183_da7219_max98357_dapm_routes,
641− .num_dapm_routes = ARRAY_SIZE(mt8183_da7219_max98357_dapm_routes),
655+ .controls = mt8183_da7219_rt1015_snd_controls,
656+ .num_controls = ARRAY_SIZE(mt8183_da7219_rt1015_snd_controls),
657+ .dapm_widgets = mt8183_da7219_rt1015_dapm_widgets,
658+ .num_dapm_widgets = ARRAY_SIZE(mt8183_da7219_rt1015_dapm_widgets),
659+ .dapm_routes = mt8183_da7219_rt1015_dapm_routes,
660+ .num_dapm_routes = ARRAY_SIZE(mt8183_da7219_rt1015_dapm_routes),
642661 .dai_link = mt8183_da7219_dai_links,
643662 .num_links = ARRAY_SIZE(mt8183_da7219_dai_links),
644663 .aux_dev = &mt8183_da7219_max98357_headset_dev,
sound/soc/qcom/lpass-cpu.c+10−4
@@ -80,6 +80,12 @@ static int lpass_cpu_daiops_startup(struct snd_pcm_substream *substream, · 79 unmodified lines
8080 dev_err(dai->dev, "error in enabling mi2s osr clk: %d\n", ret);
8181 return ret;
8282 }
83+ ret = clk_prepare(drvdata->mi2s_bit_clk[dai->driver->id]);
84+ if (ret) {
85+ dev_err(dai->dev, "error in enabling mi2s bit clk: %d\n", ret);
86+ clk_disable_unprepare(drvdata->mi2s_osr_clk[dai->driver->id]);
87+ return ret;
88+ }
8389 return 0;
8490 }
8591
@@ -88,9 +94,8 @@ static void lpass_cpu_daiops_shutdown(struct snd_pcm_substream *substream, · 2 unmodified lines
8894 {
8995 struct lpass_data *drvdata = snd_soc_dai_get_drvdata(dai);
9096
91− clk_disable_unprepare(drvdata->mi2s_bit_clk[dai->driver->id]);
92−
9397 clk_disable_unprepare(drvdata->mi2s_osr_clk[dai->driver->id]);
98+ clk_unprepare(drvdata->mi2s_bit_clk[dai->driver->id]);
9499 }
95100
96101 static int lpass_cpu_daiops_hw_params(struct snd_pcm_substream *substream,
@@ -303,10 +308,10 @@ static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream, · 206 unmodified lines
303308 dev_err(dai->dev, "error writing to i2sctl reg: %d\n",
304309 ret);
305310
306− ret = clk_prepare_enable(drvdata->mi2s_bit_clk[id]);
311+ ret = clk_enable(drvdata->mi2s_bit_clk[id]);
307312 if (ret) {
308313 dev_err(dai->dev, "error in enabling mi2s bit clk: %d\n", ret);
309− clk_disable_unprepare(drvdata->mi2s_osr_clk[id]);
314+ clk_disable(drvdata->mi2s_osr_clk[id]);
310315 return ret;
311316 }
312317
@@ -324,6 +329,7 @@ static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream, · 11 unmodified lines
324329 if (ret)
325330 dev_err(dai->dev, "error writing to i2sctl reg: %d\n",
326331 ret);
332+ clk_disable(drvdata->mi2s_bit_clk[dai->driver->id]);
327333 break;
328334 }
329335
sound/soc/qcom/lpass-sc7180.c+1−1
@@ -188,7 +188,7 @@ static struct lpass_variant sc7180_data = { · 187 unmodified lines
188188 .micmode = REG_FIELD_ID(0x1000, 4, 8, 3, 0x1000),
189189 .micmono = REG_FIELD_ID(0x1000, 3, 3, 3, 0x1000),
190190 .wssrc = REG_FIELD_ID(0x1000, 2, 2, 3, 0x1000),
191− .bitwidth = REG_FIELD_ID(0x1000, 0, 0, 3, 0x1000),
191+ .bitwidth = REG_FIELD_ID(0x1000, 0, 1, 3, 0x1000),
192192
193193 .rdma_dyncclk = REG_FIELD_ID(0xC000, 21, 21, 5, 0x1000),
194194 .rdma_bursten = REG_FIELD_ID(0xC000, 20, 20, 5, 0x1000),
sound/soc/qcom/sdm845.c+2−0
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 #include "qdsp6/q6afe.h"
1818 #include "../codecs/rt5663.h"
1919
20+#define DRIVER_NAME "sdm845"
2021 #define DEFAULT_SAMPLE_RATE_48K 48000
2122 #define DEFAULT_MCLK_RATE 24576000
2223 #define TDM_BCLK_RATE 6144000
@@ -552,6 +553,7 @@ static int sdm845_snd_platform_probe(struct platform_device *pdev) · 529 unmodified lines
552553 if (!data)
553554 return -ENOMEM;
554555
556+ card->driver_name = DRIVER_NAME;
555557 card->dapm_widgets = sdm845_snd_widgets;
556558 card->num_dapm_widgets = ARRAY_SIZE(sdm845_snd_widgets);
557559 card->dev = dev;
sound/soc/soc-core.c+1−1
@@ -2341,7 +2341,7 @@ struct snd_soc_dai *snd_soc_register_dai(struct snd_soc_component *component, · 2340 unmodified lines
23412341 }
23422342
23432343 /**
2344− * snd_soc_unregister_dai - Unregister DAIs from the ASoC core
2344+ * snd_soc_unregister_dais - Unregister DAIs from the ASoC core
23452345 *
23462346 * @component: The component for which the DAIs should be unregistered
23472347 */
sound/soc/soc-dapm.c+1−1
@@ -1276,7 +1276,7 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget, · 1275 unmodified lines
12761276 }
12771277
12781278 /**
1279− * snd_soc_dapm_get_connected_widgets - query audio path and it's widgets.
1279+ * snd_soc_dapm_dai_get_connected_widgets - query audio path and it's widgets.
12801280 * @dai: the soc DAI.
12811281 * @stream: stream direction.
12821282 * @list: list of active widgets for this stream.
sound/soc/sof/loader.c+5−0
@@ -118,6 +118,11 @@ int snd_sof_fw_parse_ext_data(struct snd_sof_dev *sdev, u32 bar, u32 offset) · 117 unmodified lines
118118 case SOF_IPC_EXT_CC_INFO:
119119 ret = get_cc_info(sdev, ext_hdr);
120120 break;
121+ case SOF_IPC_EXT_UNUSED:
122+ case SOF_IPC_EXT_PROBE_INFO:
123+ case SOF_IPC_EXT_USER_ABI_INFO:
124+ /* They are supported but we don't do anything here */
125+ break;
121126 default:
122127 dev_warn(sdev->dev, "warning: unknown ext header type %d size 0x%x\n",
123128 ext_hdr->type, ext_hdr->hdr.size);
sound/usb/pcm.c+6−0
@@ -336,6 +336,7 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs, · 335 unmodified lines
336336 switch (subs->stream->chip->usb_id) {
337337 case USB_ID(0x0763, 0x2030): /* M-Audio Fast Track C400 */
338338 case USB_ID(0x0763, 0x2031): /* M-Audio Fast Track C600 */
339+ case USB_ID(0x22f0, 0x0006): /* Allen&Heath Qu-16 */
339340 ep = 0x81;
340341 ifnum = 3;
341342 goto add_sync_ep_from_ifnum;
@@ -345,6 +346,7 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs, · 3 unmodified lines
345346 ifnum = 2;
346347 goto add_sync_ep_from_ifnum;
347348 case USB_ID(0x2466, 0x8003): /* Fractal Audio Axe-Fx II */
349+ case USB_ID(0x0499, 0x172a): /* Yamaha MODX */
348350 ep = 0x86;
349351 ifnum = 2;
350352 goto add_sync_ep_from_ifnum;
@@ -352,6 +354,10 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs, · 1 unmodified line
352354 ep = 0x81;
353355 ifnum = 2;
354356 goto add_sync_ep_from_ifnum;
357+ case USB_ID(0x1686, 0xf029): /* Zoom UAC-2 */
358+ ep = 0x82;
359+ ifnum = 2;
360+ goto add_sync_ep_from_ifnum;
355361 case USB_ID(0x1397, 0x0001): /* Behringer UFX1604 */
356362 case USB_ID(0x1397, 0x0002): /* Behringer UFX1204 */
357363 ep = 0x81;
sound/usb/quirks.c+1−0
@@ -1800,6 +1800,7 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, · 1799 unmodified lines
18001800 case 0x278b: /* Rotel? */
18011801 case 0x292b: /* Gustard/Ess based devices */
18021802 case 0x2ab6: /* T+A devices */
1803+ case 0x3353: /* Khadas devices */
18031804 case 0x3842: /* EVGA */
18041805 case 0xc502: /* HiBy devices */
18051806 if (fp->dsd_raw)
tools/arch/arm64/include/uapi/asm/kvm.h+25−0
@@ -159,6 +159,21 @@ struct kvm_sync_regs { · 158 unmodified lines
159159 struct kvm_arch_memory_slot {
160160 };
161161
162+/*
163+ * PMU filter structure. Describe a range of events with a particular
164+ * action. To be used with KVM_ARM_VCPU_PMU_V3_FILTER.
165+ */
166+struct kvm_pmu_event_filter {
167+ __u16 base_event;
168+ __u16 nevents;
169+
170+#define KVM_PMU_EVENT_ALLOW 0
171+#define KVM_PMU_EVENT_DENY 1
172+
173+ __u8 action;
174+ __u8 pad[3];
175+};
176+
162177 /* for KVM_GET/SET_VCPU_EVENTS */
163178 struct kvm_vcpu_events {
164179 struct {
@@ -242,6 +257,15 @@ struct kvm_vcpu_events { · 77 unmodified lines
242257 #define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_NOT_AVAIL 0
243258 #define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_AVAIL 1
244259 #define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_1_NOT_REQUIRED 2
260+
261+/*
262+ * Only two states can be presented by the host kernel:
263+ * - NOT_REQUIRED: the guest doesn't need to do anything
264+ * - NOT_AVAIL: the guest isn't mitigated (it can still use SSBS if available)
265+ *
266+ * All the other values are deprecated. The host still accepts all
267+ * values (they are ABI), but will narrow them to the above two.
268+ */
245269 #define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2 KVM_REG_ARM_FW_REG(2)
246270 #define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_NOT_AVAIL 0
247271 #define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_UNKNOWN 1
@@ -329,6 +353,7 @@ struct kvm_vcpu_events { · 81 unmodified lines
329353 #define KVM_ARM_VCPU_PMU_V3_CTRL 0
330354 #define KVM_ARM_VCPU_PMU_V3_IRQ 0
331355 #define KVM_ARM_VCPU_PMU_V3_INIT 1
356+#define KVM_ARM_VCPU_PMU_V3_FILTER 2
332357 #define KVM_ARM_VCPU_TIMER_CTRL 1
333358 #define KVM_ARM_VCPU_TIMER_IRQ_VTIMER 0
334359 #define KVM_ARM_VCPU_TIMER_IRQ_PTIMER 1
tools/arch/s390/include/uapi/asm/sie.h+1−1
@@ -29,7 +29,7 @@ · 28 unmodified lines
2929 { 0x13, "SIGP conditional emergency signal" }, \
3030 { 0x15, "SIGP sense running" }, \
3131 { 0x16, "SIGP set multithreading"}, \
32− { 0x17, "SIGP store additional status ait address"}
32+ { 0x17, "SIGP store additional status at address"}
3333
3434 #define icpt_prog_codes \
3535 { 0x0001, "Prog Operation" }, \
tools/arch/x86/include/asm/cpufeatures.h+5−1
@@ -96,7 +96,7 @@ · 95 unmodified lines
9696 #define X86_FEATURE_SYSCALL32 ( 3*32+14) /* "" syscall in IA32 userspace */
9797 #define X86_FEATURE_SYSENTER32 ( 3*32+15) /* "" sysenter in IA32 userspace */
9898 #define X86_FEATURE_REP_GOOD ( 3*32+16) /* REP microcode works well */
99−/* free ( 3*32+17) */
99+#define X86_FEATURE_SME_COHERENT ( 3*32+17) /* "" AMD hardware-enforced cache coherency */
100100 #define X86_FEATURE_LFENCE_RDTSC ( 3*32+18) /* "" LFENCE synchronizes RDTSC */
101101 #define X86_FEATURE_ACC_POWER ( 3*32+19) /* AMD Accumulated Power Mechanism */
102102 #define X86_FEATURE_NOPL ( 3*32+20) /* The NOPL (0F 1F) instructions */
@@ -236,6 +236,7 @@ · 133 unmodified lines
236236 #define X86_FEATURE_EPT_AD ( 8*32+17) /* Intel Extended Page Table access-dirty bit */
237237 #define X86_FEATURE_VMCALL ( 8*32+18) /* "" Hypervisor supports the VMCALL instruction */
238238 #define X86_FEATURE_VMW_VMMCALL ( 8*32+19) /* "" VMware prefers VMMCALL hypercall instruction */
239+#define X86_FEATURE_SEV_ES ( 8*32+20) /* AMD Secure Encrypted Virtualization - Encrypted State */
239240
240241 /* Intel-defined CPU features, CPUID level 0x00000007:0 (EBX), word 9 */
241242 #define X86_FEATURE_FSGSBASE ( 9*32+ 0) /* RDFSBASE, WRFSBASE, RDGSBASE, WRGSBASE instructions*/
@@ -288,6 +289,7 @@ · 46 unmodified lines
288289 #define X86_FEATURE_FENCE_SWAPGS_USER (11*32+ 4) /* "" LFENCE in user entry SWAPGS path */
289290 #define X86_FEATURE_FENCE_SWAPGS_KERNEL (11*32+ 5) /* "" LFENCE in kernel entry SWAPGS path */
290291 #define X86_FEATURE_SPLIT_LOCK_DETECT (11*32+ 6) /* #AC for split lock */
292+#define X86_FEATURE_PER_THREAD_MBA (11*32+ 7) /* "" Per-thread Memory Bandwidth Allocation */
291293
292294 /* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */
293295 #define X86_FEATURE_AVX512_BF16 (12*32+ 5) /* AVX512 BFLOAT16 instructions */
@@ -353,6 +355,7 @@ · 59 unmodified lines
353355 #define X86_FEATURE_CLDEMOTE (16*32+25) /* CLDEMOTE instruction */
354356 #define X86_FEATURE_MOVDIRI (16*32+27) /* MOVDIRI instruction */
355357 #define X86_FEATURE_MOVDIR64B (16*32+28) /* MOVDIR64B instruction */
358+#define X86_FEATURE_ENQCMD (16*32+29) /* ENQCMD and ENQCMDS instructions */
356359
357360 /* AMD-defined CPU features, CPUID level 0x80000007 (EBX), word 17 */
358361 #define X86_FEATURE_OVERFLOW_RECOV (17*32+ 0) /* MCA overflow recovery support */
@@ -368,6 +371,7 @@ · 9 unmodified lines
368371 #define X86_FEATURE_MD_CLEAR (18*32+10) /* VERW clears CPU buffers */
369372 #define X86_FEATURE_TSX_FORCE_ABORT (18*32+13) /* "" TSX_FORCE_ABORT */
370373 #define X86_FEATURE_SERIALIZE (18*32+14) /* SERIALIZE instruction */
374+#define X86_FEATURE_TSXLDTRK (18*32+16) /* TSX Suspend Load Address Tracking */
371375 #define X86_FEATURE_PCONFIG (18*32+18) /* Intel PCONFIG */
372376 #define X86_FEATURE_ARCH_LBR (18*32+19) /* Intel ARCH LBR */
373377 #define X86_FEATURE_SPEC_CTRL (18*32+26) /* "" Speculation Control (IBRS + IBPB) */
tools/arch/x86/include/asm/disabled-features.h+8−1
@@ -56,6 +56,12 @@ · 55 unmodified lines
5656 # define DISABLE_PTI (1 << (X86_FEATURE_PTI & 31))
5757 #endif
5858
59+#ifdef CONFIG_IOMMU_SUPPORT
60+# define DISABLE_ENQCMD 0
61+#else
62+# define DISABLE_ENQCMD (1 << (X86_FEATURE_ENQCMD & 31))
63+#endif
64+
5965 /*
6066 * Make sure to add features to the correct mask
6167 */
@@ -75,7 +81,8 @@ · 13 unmodified lines
7581 #define DISABLED_MASK13 0
7682 #define DISABLED_MASK14 0
7783 #define DISABLED_MASK15 0
78−#define DISABLED_MASK16 (DISABLE_PKU|DISABLE_OSPKE|DISABLE_LA57|DISABLE_UMIP)
84+#define DISABLED_MASK16 (DISABLE_PKU|DISABLE_OSPKE|DISABLE_LA57|DISABLE_UMIP| \
85+ DISABLE_ENQCMD)
7986 #define DISABLED_MASK17 0
8087 #define DISABLED_MASK18 0
8188 #define DISABLED_MASK_CHECK BUILD_BUG_ON_ZERO(NCAPINTS != 19)
tools/arch/x86/include/asm/msr-index.h+10−0
@@ -257,6 +257,9 @@ · 256 unmodified lines
257257 #define MSR_IA32_LASTINTFROMIP 0x000001dd
258258 #define MSR_IA32_LASTINTTOIP 0x000001de
259259
260+#define MSR_IA32_PASID 0x00000d93
261+#define MSR_IA32_PASID_VALID BIT_ULL(31)
262+
260263 /* DEBUGCTLMSR bits (others vary by model): */
261264 #define DEBUGCTLMSR_LBR (1UL << 0) /* last branch recording */
262265 #define DEBUGCTLMSR_BTF_SHIFT 1
@@ -464,11 +467,15 @@ · 201 unmodified lines
464467 #define MSR_AMD64_IBSOP_REG_MASK ((1UL<<MSR_AMD64_IBSOP_REG_COUNT)-1)
465468 #define MSR_AMD64_IBSCTL 0xc001103a
466469 #define MSR_AMD64_IBSBRTARGET 0xc001103b
470+#define MSR_AMD64_ICIBSEXTDCTL 0xc001103c
467471 #define MSR_AMD64_IBSOPDATA4 0xc001103d
468472 #define MSR_AMD64_IBS_REG_COUNT_MAX 8 /* includes MSR_AMD64_IBSBRTARGET */
473+#define MSR_AMD64_SEV_ES_GHCB 0xc0010130
469474 #define MSR_AMD64_SEV 0xc0010131
470475 #define MSR_AMD64_SEV_ENABLED_BIT 0
476+#define MSR_AMD64_SEV_ES_ENABLED_BIT 1
471477 #define MSR_AMD64_SEV_ENABLED BIT_ULL(MSR_AMD64_SEV_ENABLED_BIT)
478+#define MSR_AMD64_SEV_ES_ENABLED BIT_ULL(MSR_AMD64_SEV_ES_ENABLED_BIT)
472479
473480 #define MSR_AMD64_VIRT_SPEC_CTRL 0xc001011f
474481
@@ -857,11 +864,14 @@ · 382 unmodified lines
857864 #define MSR_CORE_PERF_FIXED_CTR0 0x00000309
858865 #define MSR_CORE_PERF_FIXED_CTR1 0x0000030a
859866 #define MSR_CORE_PERF_FIXED_CTR2 0x0000030b
867+#define MSR_CORE_PERF_FIXED_CTR3 0x0000030c
860868 #define MSR_CORE_PERF_FIXED_CTR_CTRL 0x0000038d
861869 #define MSR_CORE_PERF_GLOBAL_STATUS 0x0000038e
862870 #define MSR_CORE_PERF_GLOBAL_CTRL 0x0000038f
863871 #define MSR_CORE_PERF_GLOBAL_OVF_CTRL 0x00000390
864872
873+#define MSR_PERF_METRICS 0x00000329
874+
865875 /* PERF_GLOBAL_OVF_CTL bits */
866876 #define MSR_CORE_PERF_GLOBAL_OVF_CTRL_TRACE_TOPA_PMI_BIT 55
867877 #define MSR_CORE_PERF_GLOBAL_OVF_CTRL_TRACE_TOPA_PMI (1ULL << MSR_CORE_PERF_GLOBAL_OVF_CTRL_TRACE_TOPA_PMI_BIT)
tools/arch/x86/include/asm/required-features.h+1−1
@@ -54,7 +54,7 @@ · 53 unmodified lines
5454 #endif
5555
5656 #ifdef CONFIG_X86_64
57−#ifdef CONFIG_PARAVIRT
57+#ifdef CONFIG_PARAVIRT_XXL
5858 /* Paravirtualized systems may not have PSE or PGE available */
5959 #define NEED_PSE 0
6060 #define NEED_PGE 0
tools/arch/x86/include/uapi/asm/kvm.h+20−0
@@ -192,6 +192,26 @@ struct kvm_msr_list { · 191 unmodified lines
192192 __u32 indices[0];
193193 };
194194
195+/* Maximum size of any access bitmap in bytes */
196+#define KVM_MSR_FILTER_MAX_BITMAP_SIZE 0x600
197+
198+/* for KVM_X86_SET_MSR_FILTER */
199+struct kvm_msr_filter_range {
200+#define KVM_MSR_FILTER_READ (1 << 0)
201+#define KVM_MSR_FILTER_WRITE (1 << 1)
202+ __u32 flags;
203+ __u32 nmsrs; /* number of msrs in bitmap */
204+ __u32 base; /* MSR index the bitmap starts at */
205+ __u8 *bitmap; /* a 1 bit allows the operations in flags, 0 denies */
206+};
207+
208+#define KVM_MSR_FILTER_MAX_RANGES 16
209+struct kvm_msr_filter {
210+#define KVM_MSR_FILTER_DEFAULT_ALLOW (0 << 0)
211+#define KVM_MSR_FILTER_DEFAULT_DENY (1 << 0)
212+ __u32 flags;
213+ struct kvm_msr_filter_range ranges[KVM_MSR_FILTER_MAX_RANGES];
214+};
195215
196216 struct kvm_cpuid_entry {
197217 __u32 function;
tools/arch/x86/include/uapi/asm/svm.h+13−0
@@ -29,6 +29,7 @@ · 28 unmodified lines
2929 #define SVM_EXIT_WRITE_DR6 0x036
3030 #define SVM_EXIT_WRITE_DR7 0x037
3131 #define SVM_EXIT_EXCP_BASE 0x040
32+#define SVM_EXIT_LAST_EXCP 0x05f
3233 #define SVM_EXIT_INTR 0x060
3334 #define SVM_EXIT_NMI 0x061
3435 #define SVM_EXIT_SMI 0x062
@@ -76,10 +77,21 @@ · 41 unmodified lines
7677 #define SVM_EXIT_MWAIT_COND 0x08c
7778 #define SVM_EXIT_XSETBV 0x08d
7879 #define SVM_EXIT_RDPRU 0x08e
80+#define SVM_EXIT_INVPCID 0x0a2
7981 #define SVM_EXIT_NPF 0x400
8082 #define SVM_EXIT_AVIC_INCOMPLETE_IPI 0x401
8183 #define SVM_EXIT_AVIC_UNACCELERATED_ACCESS 0x402
8284
85+/* SEV-ES software-defined VMGEXIT events */
86+#define SVM_VMGEXIT_MMIO_READ 0x80000001
87+#define SVM_VMGEXIT_MMIO_WRITE 0x80000002
88+#define SVM_VMGEXIT_NMI_COMPLETE 0x80000003
89+#define SVM_VMGEXIT_AP_HLT_LOOP 0x80000004
90+#define SVM_VMGEXIT_AP_JUMP_TABLE 0x80000005
91+#define SVM_VMGEXIT_SET_AP_JUMP_TABLE 0
92+#define SVM_VMGEXIT_GET_AP_JUMP_TABLE 1
93+#define SVM_VMGEXIT_UNSUPPORTED_EVENT 0x8000ffff
94+
8395 #define SVM_EXIT_ERR -1
8496
8597 #define SVM_EXIT_REASONS \
@@ -171,6 +183,7 @@ · 85 unmodified lines
171183 { SVM_EXIT_MONITOR, "monitor" }, \
172184 { SVM_EXIT_MWAIT, "mwait" }, \
173185 { SVM_EXIT_XSETBV, "xsetbv" }, \
186+ { SVM_EXIT_INVPCID, "invpcid" }, \
174187 { SVM_EXIT_NPF, "npf" }, \
175188 { SVM_EXIT_AVIC_INCOMPLETE_IPI, "avic_incomplete_ipi" }, \
176189 { SVM_EXIT_AVIC_UNACCELERATED_ACCESS, "avic_unaccelerated_access" }, \
tools/build/feature/test-all.c+0−1
@@ -185,7 +185,6 @@ int main(int argc, char *argv[]) · 184 unmodified lines
185185 main_test_libperl();
186186 main_test_hello();
187187 main_test_libelf();
188− main_test_libelf_mmap();
189188 main_test_get_current_dir_name();
190189 main_test_gettid();
191190 main_test_glibc();
tools/include/linux/compiler-gcc.h+0−12
@@ -27,18 +27,6 @@ · 26 unmodified lines
2727 #define __pure __attribute__((pure))
2828 #endif
2929 #define noinline __attribute__((noinline))
30−#ifdef __has_attribute
31−#if __has_attribute(disable_tail_calls)
32−#define __no_tail_call __attribute__((disable_tail_calls))
33−#endif
34−#endif
35−#ifndef __no_tail_call
36−#if GCC_VERSION > 40201
37−#define __no_tail_call __attribute__((optimize("no-optimize-sibling-calls")))
38−#else
39−#define __no_tail_call
40−#endif
41−#endif
4230 #ifndef __packed
4331 #define __packed __attribute__((packed))
4432 #endif
tools/include/linux/compiler.h+0−3
@@ -47,9 +47,6 @@ · 46 unmodified lines
4747 #ifndef noinline
4848 #define noinline
4949 #endif
50−#ifndef __no_tail_call
51−#define __no_tail_call
52−#endif
5350
5451 /* Are two types/vars the same type (ignoring qualifiers)? */
5552 #ifndef __same_type
tools/include/uapi/asm-generic/unistd.h+3−1
@@ -857,9 +857,11 @@ __SYSCALL(__NR_openat2, sys_openat2) · 856 unmodified lines
857857 __SYSCALL(__NR_pidfd_getfd, sys_pidfd_getfd)
858858 #define __NR_faccessat2 439
859859 __SYSCALL(__NR_faccessat2, sys_faccessat2)
860+#define __NR_process_madvise 440
861+__SYSCALL(__NR_process_madvise, sys_process_madvise)
860862
861863 #undef __NR_syscalls
862−#define __NR_syscalls 440
864+#define __NR_syscalls 441
863865
864866 /*
865867 * 32 bit systems traditionally used different
tools/include/uapi/drm/i915_drm.h+56−3
@@ -619,6 +619,12 @@ typedef struct drm_i915_irq_wait { · 618 unmodified lines
619619 */
620620 #define I915_PARAM_PERF_REVISION 54
621621
622+/* Query whether DRM_I915_GEM_EXECBUFFER2 supports supplying an array of
623+ * timeline syncobj through drm_i915_gem_execbuffer_ext_timeline_fences. See
624+ * I915_EXEC_USE_EXTENSIONS.
625+ */
626+#define I915_PARAM_HAS_EXEC_TIMELINE_FENCES 55
627+
622628 /* Must be kept compact -- no holes and well documented */
623629
624630 typedef struct drm_i915_getparam {
@@ -1046,6 +1052,38 @@ struct drm_i915_gem_exec_fence { · 421 unmodified lines
10461052 __u32 flags;
10471053 };
10481054
1055+/**
1056+ * See drm_i915_gem_execbuffer_ext_timeline_fences.
1057+ */
1058+#define DRM_I915_GEM_EXECBUFFER_EXT_TIMELINE_FENCES 0
1059+
1060+/**
1061+ * This structure describes an array of drm_syncobj and associated points for
1062+ * timeline variants of drm_syncobj. It is invalid to append this structure to
1063+ * the execbuf if I915_EXEC_FENCE_ARRAY is set.
1064+ */
1065+struct drm_i915_gem_execbuffer_ext_timeline_fences {
1066+ struct i915_user_extension base;
1067+
1068+ /**
1069+ * Number of element in the handles_ptr & value_ptr arrays.
1070+ */
1071+ __u64 fence_count;
1072+
1073+ /**
1074+ * Pointer to an array of struct drm_i915_gem_exec_fence of length
1075+ * fence_count.
1076+ */
1077+ __u64 handles_ptr;
1078+
1079+ /**
1080+ * Pointer to an array of u64 values of length fence_count. Values
1081+ * must be 0 for a binary drm_syncobj. A Value of 0 for a timeline
1082+ * drm_syncobj is invalid as it turns a drm_syncobj into a binary one.
1083+ */
1084+ __u64 values_ptr;
1085+};
1086+
10491087 struct drm_i915_gem_execbuffer2 {
10501088 /**
10511089 * List of gem_exec_object2 structs
@@ -1062,8 +1100,14 @@ struct drm_i915_gem_execbuffer2 { · 10 unmodified lines
10621100 __u32 num_cliprects;
10631101 /**
10641102 * This is a struct drm_clip_rect *cliprects if I915_EXEC_FENCE_ARRAY
1065− * is not set. If I915_EXEC_FENCE_ARRAY is set, then this is a
1066− * struct drm_i915_gem_exec_fence *fences.
1103+ * & I915_EXEC_USE_EXTENSIONS are not set.
1104+ *
1105+ * If I915_EXEC_FENCE_ARRAY is set, then this is a pointer to an array
1106+ * of struct drm_i915_gem_exec_fence and num_cliprects is the length
1107+ * of the array.
1108+ *
1109+ * If I915_EXEC_USE_EXTENSIONS is set, then this is a pointer to a
1110+ * single struct i915_user_extension and num_cliprects is 0.
10671111 */
10681112 __u64 cliprects_ptr;
10691113 #define I915_EXEC_RING_MASK (0x3f)
@@ -1181,7 +1225,16 @@ struct drm_i915_gem_execbuffer2 { · 111 unmodified lines
11811225 */
11821226 #define I915_EXEC_FENCE_SUBMIT (1 << 20)
11831227
1184−#define __I915_EXEC_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_SUBMIT << 1))
1228+/*
1229+ * Setting I915_EXEC_USE_EXTENSIONS implies that
1230+ * drm_i915_gem_execbuffer2.cliprects_ptr is treated as a pointer to an linked
1231+ * list of i915_user_extension. Each i915_user_extension node is the base of a
1232+ * larger structure. The list of supported structures are listed in the
1233+ * drm_i915_gem_execbuffer_ext enum.
1234+ */
1235+#define I915_EXEC_USE_EXTENSIONS (1 << 21)
1236+
1237+#define __I915_EXEC_UNKNOWN_FLAGS (-(I915_EXEC_USE_EXTENSIONS << 1))
11851238
11861239 #define I915_EXEC_CONTEXT_ID_MASK (0xffffffff)
11871240 #define i915_execbuffer2_set_context_id(eb2, context) \
tools/include/uapi/linux/fscrypt.h+3−3
@@ -45,7 +45,6 @@ struct fscrypt_policy_v1 { · 44 unmodified lines
4545 __u8 flags;
4646 __u8 master_key_descriptor[FSCRYPT_KEY_DESCRIPTOR_SIZE];
4747 };
48−#define fscrypt_policy fscrypt_policy_v1
4948
5049 /*
5150 * Process-subscribed "logon" key description prefix and payload format.
@@ -156,9 +155,9 @@ struct fscrypt_get_key_status_arg { · 104 unmodified lines
156155 __u32 __out_reserved[13];
157156 };
158157
159−#define FS_IOC_SET_ENCRYPTION_POLICY _IOR('f', 19, struct fscrypt_policy)
158+#define FS_IOC_SET_ENCRYPTION_POLICY _IOR('f', 19, struct fscrypt_policy_v1)
160159 #define FS_IOC_GET_ENCRYPTION_PWSALT _IOW('f', 20, __u8[16])
161−#define FS_IOC_GET_ENCRYPTION_POLICY _IOW('f', 21, struct fscrypt_policy)
160+#define FS_IOC_GET_ENCRYPTION_POLICY _IOW('f', 21, struct fscrypt_policy_v1)
162161 #define FS_IOC_GET_ENCRYPTION_POLICY_EX _IOWR('f', 22, __u8[9]) /* size + version */
163162 #define FS_IOC_ADD_ENCRYPTION_KEY _IOWR('f', 23, struct fscrypt_add_key_arg)
164163 #define FS_IOC_REMOVE_ENCRYPTION_KEY _IOWR('f', 24, struct fscrypt_remove_key_arg)
@@ -170,6 +169,7 @@ struct fscrypt_get_key_status_arg { · 5 unmodified lines
170169
171170 /* old names; don't add anything new here! */
172171 #ifndef __KERNEL__
172+#define fscrypt_policy fscrypt_policy_v1
173173 #define FS_KEY_DESCRIPTOR_SIZE FSCRYPT_KEY_DESCRIPTOR_SIZE
174174 #define FS_POLICY_FLAGS_PAD_4 FSCRYPT_POLICY_FLAGS_PAD_4
175175 #define FS_POLICY_FLAGS_PAD_8 FSCRYPT_POLICY_FLAGS_PAD_8
tools/include/uapi/linux/kvm.h+19−0
@@ -248,6 +248,8 @@ struct kvm_hyperv_exit { · 247 unmodified lines
248248 #define KVM_EXIT_IOAPIC_EOI 26
249249 #define KVM_EXIT_HYPERV 27
250250 #define KVM_EXIT_ARM_NISV 28
251+#define KVM_EXIT_X86_RDMSR 29
252+#define KVM_EXIT_X86_WRMSR 30
251253
252254 /* For KVM_EXIT_INTERNAL_ERROR */
253255 /* Emulate instruction failed. */
@@ -413,6 +415,17 @@ struct kvm_run { · 159 unmodified lines
413415 __u64 esr_iss;
414416 __u64 fault_ipa;
415417 } arm_nisv;
418+ /* KVM_EXIT_X86_RDMSR / KVM_EXIT_X86_WRMSR */
419+ struct {
420+ __u8 error; /* user -> kernel */
421+ __u8 pad[7];
422+#define KVM_MSR_EXIT_REASON_INVAL (1 << 0)
423+#define KVM_MSR_EXIT_REASON_UNKNOWN (1 << 1)
424+#define KVM_MSR_EXIT_REASON_FILTER (1 << 2)
425+ __u32 reason; /* kernel -> user */
426+ __u32 index; /* kernel -> user */
427+ __u64 data; /* kernel <-> user */
428+ } msr;
416429 /* Fix the size of the union. */
417430 char padding[256];
418431 };
@@ -1037,6 +1050,9 @@ struct kvm_ppc_resize_hpt { · 618 unmodified lines
10371050 #define KVM_CAP_SMALLER_MAXPHYADDR 185
10381051 #define KVM_CAP_S390_DIAG318 186
10391052 #define KVM_CAP_STEAL_TIME 187
1053+#define KVM_CAP_X86_USER_SPACE_MSR 188
1054+#define KVM_CAP_X86_MSR_FILTER 189
1055+#define KVM_CAP_ENFORCE_PV_FEATURE_CPUID 190
10401056
10411057 #ifdef KVM_CAP_IRQ_ROUTING
10421058
@@ -1538,6 +1554,9 @@ struct kvm_pv_cmd { · 495 unmodified lines
15381554 /* Available with KVM_CAP_S390_PROTECTED */
15391555 #define KVM_S390_PV_COMMAND _IOWR(KVMIO, 0xc5, struct kvm_pv_cmd)
15401556
1557+/* Available with KVM_CAP_X86_MSR_FILTER */
1558+#define KVM_X86_SET_MSR_FILTER _IOW(KVMIO, 0xc6, struct kvm_msr_filter)
1559+
15411560 /* Secure Encrypted Virtualization command */
15421561 enum sev_cmd_id {
15431562 /* Guest initialization commands */
tools/include/uapi/linux/mman.h+1−0
@@ -27,6 +27,7 @@ · 26 unmodified lines
2727 #define MAP_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT
2828 #define MAP_HUGE_MASK HUGETLB_FLAG_ENCODE_MASK
2929
30+#define MAP_HUGE_16KB HUGETLB_FLAG_ENCODE_16KB
3031 #define MAP_HUGE_64KB HUGETLB_FLAG_ENCODE_64KB
3132 #define MAP_HUGE_512KB HUGETLB_FLAG_ENCODE_512KB
3233 #define MAP_HUGE_1MB HUGETLB_FLAG_ENCODE_1MB
tools/include/uapi/linux/mount.h+1−0
@@ -16,6 +16,7 @@ · 15 unmodified lines
1616 #define MS_REMOUNT 32 /* Alter flags of a mounted FS */
1717 #define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */
1818 #define MS_DIRSYNC 128 /* Directory modifications are synchronous */
19+#define MS_NOSYMFOLLOW 256 /* Do not follow symlinks */
1920 #define MS_NOATIME 1024 /* Do not update access times. */
2021 #define MS_NODIRATIME 2048 /* Do not update directory access times */
2122 #define MS_BIND 4096
tools/include/uapi/linux/perf_event.h+1−1
@@ -1196,7 +1196,7 @@ union perf_mem_data_src { · 1195 unmodified lines
11961196
11971197 #define PERF_MEM_SNOOPX_FWD 0x01 /* forward */
11981198 /* 1 free */
1199−#define PERF_MEM_SNOOPX_SHIFT 38
1199+#define PERF_MEM_SNOOPX_SHIFT 38
12001200
12011201 /* locked instruction */
12021202 #define PERF_MEM_LOCK_NA 0x01 /* not available */
tools/include/uapi/linux/prctl.h+9−0
@@ -233,6 +233,15 @@ struct prctl_mm_map { · 232 unmodified lines
233233 #define PR_SET_TAGGED_ADDR_CTRL 55
234234 #define PR_GET_TAGGED_ADDR_CTRL 56
235235 # define PR_TAGGED_ADDR_ENABLE (1UL << 0)
236+/* MTE tag check fault modes */
237+# define PR_MTE_TCF_SHIFT 1
238+# define PR_MTE_TCF_NONE (0UL << PR_MTE_TCF_SHIFT)
239+# define PR_MTE_TCF_SYNC (1UL << PR_MTE_TCF_SHIFT)
240+# define PR_MTE_TCF_ASYNC (2UL << PR_MTE_TCF_SHIFT)
241+# define PR_MTE_TCF_MASK (3UL << PR_MTE_TCF_SHIFT)
242+/* MTE tag inclusion mask */
243+# define PR_MTE_TAG_SHIFT 3
244+# define PR_MTE_TAG_MASK (0xffffUL << PR_MTE_TAG_SHIFT)
236245
237246 /* Control reclaim behavior when allocating memory */
238247 #define PR_SET_IO_FLUSHER 57
tools/include/uapi/linux/vhost.h+4−0
@@ -146,4 +146,8 @@ · 145 unmodified lines
146146
147147 /* Set event fd for config interrupt*/
148148 #define VHOST_VDPA_SET_CONFIG_CALL _IOW(VHOST_VIRTIO, 0x77, int)
149+
150+/* Get the valid iova range */
151+#define VHOST_VDPA_GET_IOVA_RANGE _IOR(VHOST_VIRTIO, 0x78, \
152+ struct vhost_vdpa_iova_range)
149153 #endif
tools/perf/Makefile.config+1−0
@@ -749,6 +749,7 @@ else · 748 unmodified lines
749749 PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
750750 PERL_EMBED_CCOPTS = $(shell perl -MExtUtils::Embed -e ccopts 2>/dev/null)
751751 PERL_EMBED_CCOPTS := $(filter-out -specs=%,$(PERL_EMBED_CCOPTS))
752+ PERL_EMBED_CCOPTS := $(filter-out -flto=auto -ffat-lto-objects, $(PERL_EMBED_CCOPTS))
752753 PERL_EMBED_LDOPTS := $(filter-out -specs=%,$(PERL_EMBED_LDOPTS))
753754 FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
754755
tools/perf/arch/x86/entry/syscalls/syscall_64.tbl+7−4
@@ -361,12 +361,13 @@ · 360 unmodified lines
361361 437 common openat2 sys_openat2
362362 438 common pidfd_getfd sys_pidfd_getfd
363363 439 common faccessat2 sys_faccessat2
364+440 common process_madvise sys_process_madvise
364365
365366 #
366−# x32-specific system call numbers start at 512 to avoid cache impact
367−# for native 64-bit operation. The __x32_compat_sys stubs are created
368−# on-the-fly for compat_sys_*() compatibility system calls if X86_X32
369−# is defined.
367+# Due to a historical design error, certain syscalls are numbered differently
368+# in x32 as compared to native x86_64. These syscalls have numbers 512-547.
369+# Do not add new syscalls to this range. Numbers 548 and above are available
370+# for non-x32 use.
370371 #
371372 512 x32 rt_sigaction compat_sys_rt_sigaction
372373 513 x32 rt_sigreturn compat_sys_x32_rt_sigreturn
@@ -404,3 +405,5 @@ · 31 unmodified lines
404405 545 x32 execveat compat_sys_execveat
405406 546 x32 preadv2 compat_sys_preadv64v2
406407 547 x32 pwritev2 compat_sys_pwritev64v2
408+# This is the end of the legacy x32 range. Numbers 548 and above are
409+# not special and are not to be used for x32-specific syscalls.
tools/perf/builtin-trace.c+9−6
@@ -4639,9 +4639,9 @@ do_concat: · 4638 unmodified lines
46394639 err = 0;
46404640
46414641 if (lists[0]) {
4642− struct option o = OPT_CALLBACK('e', "event", &trace->evlist, "event",
4643− "event selector. use 'perf list' to list available events",
4644− parse_events_option);
4642+ struct option o = {
4643+ .value = &trace->evlist,
4644+ };
46454645 err = parse_events_option(&o, lists[0], 0);
46464646 }
46474647 out:
@@ -4655,9 +4655,12 @@ static int trace__parse_cgroups(const struct option *opt, const char *str, int u · 7 unmodified lines
46554655 {
46564656 struct trace *trace = opt->value;
46574657
4658− if (!list_empty(&trace->evlist->core.entries))
4659− return parse_cgroups(opt, str, unset);
4660−
4658+ if (!list_empty(&trace->evlist->core.entries)) {
4659+ struct option o = {
4660+ .value = &trace->evlist,
4661+ };
4662+ return parse_cgroups(&o, str, unset);
4663+ }
46614664 trace->cgroup = evlist__findnew_cgroup(trace->evlist, str);
46624665
46634666 return 0;
tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json+1−1
@@ -329,7 +329,7 @@ · 328 unmodified lines
329329 },
330330 {
331331 "BriefDescription": "Average external Memory Bandwidth Use for reads and writes [GB / sec]",
332− "MetricExpr": "( 64 * ( uncore_imc@cas_count_read@ + uncore_imc@cas_count_write@ ) / 1000000000 ) / duration_time",
332+ "MetricExpr": "( ( ( uncore_imc@cas_count_read@ + uncore_imc@cas_count_write@ ) * 1048576 ) / 1000000000 ) / duration_time",
333333 "MetricGroup": "Memory_BW;SoC",
334334 "MetricName": "DRAM_BW_Use"
335335 },
tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json+1−1
@@ -323,7 +323,7 @@ · 322 unmodified lines
323323 },
324324 {
325325 "BriefDescription": "Average external Memory Bandwidth Use for reads and writes [GB / sec]",
326− "MetricExpr": "( 64 * ( uncore_imc@cas_count_read@ + uncore_imc@cas_count_write@ ) / 1000000000 ) / duration_time",
326+ "MetricExpr": "( ( ( uncore_imc@cas_count_read@ + uncore_imc@cas_count_write@ ) * 1048576 ) / 1000000000 ) / duration_time",
327327 "MetricGroup": "Memory_BW;SoC",
328328 "MetricName": "DRAM_BW_Use"
329329 },
tools/perf/tests/dwarf-unwind.c+5−5
@@ -95,7 +95,7 @@ static int unwind_entry(struct unwind_entry *entry, void *arg) · 94 unmodified lines
9595 return strcmp((const char *) symbol, funcs[idx]);
9696 }
9797
98−__no_tail_call noinline int test_dwarf_unwind__thread(struct thread *thread)
98+noinline int test_dwarf_unwind__thread(struct thread *thread)
9999 {
100100 struct perf_sample sample;
101101 unsigned long cnt = 0;
@@ -126,7 +126,7 @@ __no_tail_call noinline int test_dwarf_unwind__thread(struct thread *thread) · 24 unmodified lines
126126
127127 static int global_unwind_retval = -INT_MAX;
128128
129−__no_tail_call noinline int test_dwarf_unwind__compare(void *p1, void *p2)
129+noinline int test_dwarf_unwind__compare(void *p1, void *p2)
130130 {
131131 /* Any possible value should be 'thread' */
132132 struct thread *thread = *(struct thread **)p1;
@@ -145,7 +145,7 @@ __no_tail_call noinline int test_dwarf_unwind__compare(void *p1, void *p2) · 12 unmodified lines
145145 return p1 - p2;
146146 }
147147
148−__no_tail_call noinline int test_dwarf_unwind__krava_3(struct thread *thread)
148+noinline int test_dwarf_unwind__krava_3(struct thread *thread)
149149 {
150150 struct thread *array[2] = {thread, thread};
151151 void *fp = &bsearch;
@@ -164,12 +164,12 @@ __no_tail_call noinline int test_dwarf_unwind__krava_3(struct thread *thread) · 12 unmodified lines
164164 return global_unwind_retval;
165165 }
166166
167−__no_tail_call noinline int test_dwarf_unwind__krava_2(struct thread *thread)
167+noinline int test_dwarf_unwind__krava_2(struct thread *thread)
168168 {
169169 return test_dwarf_unwind__krava_3(thread);
170170 }
171171
172−__no_tail_call noinline int test_dwarf_unwind__krava_1(struct thread *thread)
172+noinline int test_dwarf_unwind__krava_1(struct thread *thread)
173173 {
174174 return test_dwarf_unwind__krava_2(thread);
175175 }
tools/perf/ui/browsers/hists.c+1−1
@@ -2963,7 +2963,7 @@ static int perf_evsel__hists_browse(struct evsel *evsel, int nr_events, · 2962 unmodified lines
29632963 struct popup_action actions[MAX_OPTIONS];
29642964 int nr_options = 0;
29652965 int key = -1;
2966− char buf[64];
2966+ char buf[128];
29672967 int delay_secs = hbt ? hbt->refresh : 0;
29682968
29692969 #define HIST_BROWSER_HELP_COMMON \
tools/perf/util/build-id.c+2−0
@@ -102,6 +102,8 @@ int build_id__sprintf(const struct build_id *build_id, char *bf) · 101 unmodified lines
102102 const u8 *raw = build_id->data;
103103 size_t i;
104104
105+ bf[0] = 0x0;
106+
105107 for (i = 0; i < build_id->size; ++i) {
106108 sprintf(bid, "%02x", *raw);
107109 ++raw;
tools/perf/util/hashmap.c+3−0
@@ -15,6 +15,9 @@ · 14 unmodified lines
1515 /* make sure libbpf doesn't use kernel-only integer typedefs */
1616 #pragma GCC poison u8 u16 u32 u64 s8 s16 s32 s64
1717
18+/* prevent accidental re-addition of reallocarray() */
19+#pragma GCC poison reallocarray
20+
1821 /* start with 4 buckets */
1922 #define HASHMAP_MIN_CAP_BITS 2
2023
tools/perf/util/hashmap.h+12−0
@@ -25,6 +25,18 @@ static inline size_t hash_bits(size_t h, int bits) · 24 unmodified lines
2525 #endif
2626 }
2727
28+/* generic C-string hashing function */
29+static inline size_t str_hash(const char *s)
30+{
31+ size_t h = 0;
32+
33+ while (*s) {
34+ h = h * 31 + *s;
35+ s++;
36+ }
37+ return h;
38+}
39+
2840 typedef size_t (*hashmap_hash_fn)(const void *key, void *ctx);
2941 typedef bool (*hashmap_equal_fn)(const void *key1, const void *key2, void *ctx);
3042
tools/perf/util/machine.c+10−1
@@ -786,11 +786,20 @@ static int machine__process_ksymbol_unregister(struct machine *machine, · 785 unmodified lines
786786 union perf_event *event,
787787 struct perf_sample *sample __maybe_unused)
788788 {
789+ struct symbol *sym;
789790 struct map *map;
790791
791792 map = maps__find(&machine->kmaps, event->ksymbol.addr);
792− if (map)
793+ if (!map)
794+ return 0;
795+
796+ if (map != machine->vmlinux_map)
793797 maps__remove(&machine->kmaps, map);
798+ else {
799+ sym = dso__find_symbol(map->dso, map->map_ip(map, map->start));
800+ if (sym)
801+ dso__delete_symbol(map->dso, sym);
802+ }
794803
795804 return 0;
796805 }
tools/perf/util/scripting-engines/trace-event-python.c+2−5
@@ -1592,7 +1592,6 @@ static void _free_command_line(wchar_t **command_line, int num) · 1591 unmodified lines
15921592 static int python_start_script(const char *script, int argc, const char **argv)
15931593 {
15941594 struct tables *tables = &tables_global;
1595− PyMODINIT_FUNC (*initfunc)(void);
15961595 #if PY_MAJOR_VERSION < 3
15971596 const char **command_line;
15981597 #else
@@ -1607,20 +1606,18 @@ static int python_start_script(const char *script, int argc, const char **argv) · 8 unmodified lines
16071606 FILE *fp;
16081607
16091608 #if PY_MAJOR_VERSION < 3
1610− initfunc = initperf_trace_context;
16111609 command_line = malloc((argc + 1) * sizeof(const char *));
16121610 command_line[0] = script;
16131611 for (i = 1; i < argc + 1; i++)
16141612 command_line[i] = argv[i - 1];
1613+ PyImport_AppendInittab(name, initperf_trace_context);
16151614 #else
1616− initfunc = PyInit_perf_trace_context;
16171615 command_line = malloc((argc + 1) * sizeof(wchar_t *));
16181616 command_line[0] = Py_DecodeLocale(script, NULL);
16191617 for (i = 1; i < argc + 1; i++)
16201618 command_line[i] = Py_DecodeLocale(argv[i - 1], NULL);
1619+ PyImport_AppendInittab(name, PyInit_perf_trace_context);
16211620 #endif
1622−
1623− PyImport_AppendInittab(name, initfunc);
16241621 Py_Initialize();
16251622
16261623 #if PY_MAJOR_VERSION < 3
tools/perf/util/session.c+14−0
@@ -595,6 +595,7 @@ static void perf_event__mmap2_swap(union perf_event *event, · 594 unmodified lines
595595 event->mmap2.maj = bswap_32(event->mmap2.maj);
596596 event->mmap2.min = bswap_32(event->mmap2.min);
597597 event->mmap2.ino = bswap_64(event->mmap2.ino);
598+ event->mmap2.ino_generation = bswap_64(event->mmap2.ino_generation);
598599
599600 if (sample_id_all) {
600601 void *data = &event->mmap2.filename;
@@ -710,6 +711,18 @@ static void perf_event__namespaces_swap(union perf_event *event, · 109 unmodified lines
710711 swap_sample_id_all(event, &event->namespaces.link_info[i]);
711712 }
712713
714+static void perf_event__cgroup_swap(union perf_event *event, bool sample_id_all)
715+{
716+ event->cgroup.id = bswap_64(event->cgroup.id);
717+
718+ if (sample_id_all) {
719+ void *data = &event->cgroup.path;
720+
721+ data += PERF_ALIGN(strlen(data) + 1, sizeof(u64));
722+ swap_sample_id_all(event, data);
723+ }
724+}
725+
713726 static u8 revbyte(u8 b)
714727 {
715728 int rev = (b >> 4) | ((b & 0xf) << 4);
@@ -952,6 +965,7 @@ static perf_event__swap_op perf_event__swap_ops[] = { · 236 unmodified lines
952965 [PERF_RECORD_SWITCH] = perf_event__switch_swap,
953966 [PERF_RECORD_SWITCH_CPU_WIDE] = perf_event__switch_swap,
954967 [PERF_RECORD_NAMESPACES] = perf_event__namespaces_swap,
968+ [PERF_RECORD_CGROUP] = perf_event__cgroup_swap,
955969 [PERF_RECORD_TEXT_POKE] = perf_event__text_poke_swap,
956970 [PERF_RECORD_HEADER_ATTR] = perf_event__hdr_attr_swap,
957971 [PERF_RECORD_HEADER_EVENT_TYPE] = perf_event__event_type_swap,
tools/perf/util/symbol.c+7−0
@@ -515,6 +515,13 @@ void dso__insert_symbol(struct dso *dso, struct symbol *sym) · 514 unmodified lines
515515 }
516516 }
517517
518+void dso__delete_symbol(struct dso *dso, struct symbol *sym)
519+{
520+ rb_erase_cached(&sym->rb_node, &dso->symbols);
521+ symbol__delete(sym);
522+ dso__reset_find_symbol_cache(dso);
523+}
524+
518525 struct symbol *dso__find_symbol(struct dso *dso, u64 addr)
519526 {
520527 if (dso->last_find_result.addr != addr || dso->last_find_result.symbol == NULL) {
tools/perf/util/symbol.h+2−0
@@ -131,6 +131,8 @@ int dso__load_kallsyms(struct dso *dso, const char *filename, struct map *map); · 130 unmodified lines
131131
132132 void dso__insert_symbol(struct dso *dso,
133133 struct symbol *sym);
134+void dso__delete_symbol(struct dso *dso,
135+ struct symbol *sym);
134136
135137 struct symbol *dso__find_symbol(struct dso *dso, u64 addr);
136138 struct symbol *dso__find_symbol_by_name(struct dso *dso, const char *name);
tools/testing/kunit/kunit_parser.py+1−2
@@ -66,7 +66,6 @@ def isolate_kunit_output(kernel_output): · 65 unmodified lines
6666 def raw_output(kernel_output):
6767 for line in kernel_output:
6868 print(line)
69− yield line
7069
7170 DIVIDER = '=' * 60
7271
@@ -242,7 +241,7 @@ def parse_test_suite(lines: List[str], expected_suite_index: int) -> TestSuite: · 169 unmodified lines
242241 return None
243242 test_suite.name = name
244243 expected_test_case_num = parse_subtest_plan(lines)
245− if not expected_test_case_num:
244+ if expected_test_case_num is None:
246245 return None
247246 while expected_test_case_num > 0:
248247 test_case = parse_test_case(lines)
tools/testing/kunit/kunit_tool_test.py+25−7
@@ -179,7 +179,7 @@ class KUnitParserTest(unittest.TestCase): · 178 unmodified lines
179179 print_mock = mock.patch('builtins.print').start()
180180 result = kunit_parser.parse_run_tests(
181181 kunit_parser.isolate_kunit_output(file.readlines()))
182− print_mock.assert_any_call(StrContains("no kunit output detected"))
182+ print_mock.assert_any_call(StrContains('no tests run!'))
183183 print_mock.stop()
184184 file.close()
185185
@@ -198,39 +198,57 @@ class KUnitParserTest(unittest.TestCase): · 12 unmodified lines
198198 'test_data/test_config_printk_time.log')
199199 with open(prefix_log) as file:
200200 result = kunit_parser.parse_run_tests(file.readlines())
201− self.assertEqual('kunit-resource-test', result.suites[0].name)
201+ self.assertEqual(
202+ kunit_parser.TestStatus.SUCCESS,
203+ result.status)
204+ self.assertEqual('kunit-resource-test', result.suites[0].name)
202205
203206 def test_ignores_multiple_prefixes(self):
204207 prefix_log = get_absolute_path(
205208 'test_data/test_multiple_prefixes.log')
206209 with open(prefix_log) as file:
207210 result = kunit_parser.parse_run_tests(file.readlines())
208− self.assertEqual('kunit-resource-test', result.suites[0].name)
211+ self.assertEqual(
212+ kunit_parser.TestStatus.SUCCESS,
213+ result.status)
214+ self.assertEqual('kunit-resource-test', result.suites[0].name)
209215
210216 def test_prefix_mixed_kernel_output(self):
211217 mixed_prefix_log = get_absolute_path(
212218 'test_data/test_interrupted_tap_output.log')
213219 with open(mixed_prefix_log) as file:
214220 result = kunit_parser.parse_run_tests(file.readlines())
215− self.assertEqual('kunit-resource-test', result.suites[0].name)
221+ self.assertEqual(
222+ kunit_parser.TestStatus.SUCCESS,
223+ result.status)
224+ self.assertEqual('kunit-resource-test', result.suites[0].name)
216225
217226 def test_prefix_poundsign(self):
218227 pound_log = get_absolute_path('test_data/test_pound_sign.log')
219228 with open(pound_log) as file:
220229 result = kunit_parser.parse_run_tests(file.readlines())
221− self.assertEqual('kunit-resource-test', result.suites[0].name)
230+ self.assertEqual(
231+ kunit_parser.TestStatus.SUCCESS,
232+ result.status)
233+ self.assertEqual('kunit-resource-test', result.suites[0].name)
222234
223235 def test_kernel_panic_end(self):
224236 panic_log = get_absolute_path('test_data/test_kernel_panic_interrupt.log')
225237 with open(panic_log) as file:
226238 result = kunit_parser.parse_run_tests(file.readlines())
227− self.assertEqual('kunit-resource-test', result.suites[0].name)
239+ self.assertEqual(
240+ kunit_parser.TestStatus.TEST_CRASHED,
241+ result.status)
242+ self.assertEqual('kunit-resource-test', result.suites[0].name)
228243
229244 def test_pound_no_prefix(self):
230245 pound_log = get_absolute_path('test_data/test_pound_no_prefix.log')
231246 with open(pound_log) as file:
232247 result = kunit_parser.parse_run_tests(file.readlines())
233− self.assertEqual('kunit-resource-test', result.suites[0].name)
248+ self.assertEqual(
249+ kunit_parser.TestStatus.SUCCESS,
250+ result.status)
251+ self.assertEqual('kunit-resource-test', result.suites[0].name)
234252
235253 class KUnitJsonTest(unittest.TestCase):
236254
tools/testing/kunit/test_data/test_config_printk_time.log+2−1
@@ -1,6 +1,7 @@
11 [ 0.060000] printk: console [mc-1] enabled
22 [ 0.060000] random: get_random_bytes called from init_oops_id+0x35/0x40 with crng_init=0
33 [ 0.060000] TAP version 14
4+[ 0.060000] 1..3
45 [ 0.060000] # Subtest: kunit-resource-test
56 [ 0.060000] 1..5
67 [ 0.060000] ok 1 - kunit_resource_test_init_resources
@@ -28,4 +29,4 @@ · 21 unmodified lines
2829 [ 0.060000] Stack:
2930 [ 0.060000] 602086f8 601bc260 705c0000 705c0000
3031 [ 0.060000] 602086f8 6005fcec 705c0000 6002c6ab
31−[ 0.060000] 6005fcec 601bc260 705c0000 3000000010
32+[ 0.060000] 6005fcec 601bc260 705c0000 3000000010
tools/testing/kunit/test_data/test_interrupted_tap_output.log+2−1
@@ -1,6 +1,7 @@
11 [ 0.060000] printk: console [mc-1] enabled
22 [ 0.060000] random: get_random_bytes called from init_oops_id+0x35/0x40 with crng_init=0
33 [ 0.060000] TAP version 14
4+[ 0.060000] 1..3
45 [ 0.060000] # Subtest: kunit-resource-test
56 [ 0.060000] 1..5
67 [ 0.060000] ok 1 - kunit_resource_test_init_resources
@@ -34,4 +35,4 @@ · 27 unmodified lines
3435 [ 0.060000] Stack:
3536 [ 0.060000] 602086f8 601bc260 705c0000 705c0000
3637 [ 0.060000] 602086f8 6005fcec 705c0000 6002c6ab
37−[ 0.060000] 6005fcec 601bc260 705c0000 3000000010
38+[ 0.060000] 6005fcec 601bc260 705c0000 3000000010
tools/testing/kunit/test_data/test_kernel_panic_interrupt.log+2−1
@@ -1,6 +1,7 @@
11 [ 0.060000] printk: console [mc-1] enabled
22 [ 0.060000] random: get_random_bytes called from init_oops_id+0x35/0x40 with crng_init=0
33 [ 0.060000] TAP version 14
4+[ 0.060000] 1..3
45 [ 0.060000] # Subtest: kunit-resource-test
56 [ 0.060000] 1..5
67 [ 0.060000] ok 1 - kunit_resource_test_init_resources
@@ -22,4 +23,4 @@ · 15 unmodified lines
2223 [ 0.060000] Stack:
2324 [ 0.060000] 602086f8 601bc260 705c0000 705c0000
2425 [ 0.060000] 602086f8 6005fcec 705c0000 6002c6ab
25−[ 0.060000] 6005fcec 601bc260 705c0000 3000000010
26+[ 0.060000] 6005fcec 601bc260 705c0000 3000000010
tools/testing/kunit/test_data/test_multiple_prefixes.log+2−1
@@ -1,6 +1,7 @@
11 [ 0.060000][ T1] printk: console [mc-1] enabled
22 [ 0.060000][ T1] random: get_random_bytes called from init_oops_id+0x35/0x40 with crng_init=0
33 [ 0.060000][ T1] TAP version 14
4+[ 0.060000][ T1] 1..3
45 [ 0.060000][ T1] # Subtest: kunit-resource-test
56 [ 0.060000][ T1] 1..5
67 [ 0.060000][ T1] ok 1 - kunit_resource_test_init_resources
@@ -28,4 +29,4 @@ · 21 unmodified lines
2829 [ 0.060000][ T1] Stack:
2930 [ 0.060000][ T1] 602086f8 601bc260 705c0000 705c0000
3031 [ 0.060000][ T1] 602086f8 6005fcec 705c0000 6002c6ab
31−[ 0.060000][ T1] 6005fcec 601bc260 705c0000 3000000010
32+[ 0.060000][ T1] 6005fcec 601bc260 705c0000 3000000010
tools/testing/kunit/test_data/test_pound_no_prefix.log+2−1
@@ -1,6 +1,7 @@
11 printk: console [mc-1] enabled
22 random: get_random_bytes called from init_oops_id+0x35/0x40 with crng_init=0
33 TAP version 14
4+ 1..3
45 # Subtest: kunit-resource-test
56 1..5
67 ok 1 - kunit_resource_test_init_resources
@@ -30,4 +31,4 @@ · 23 unmodified lines
3031 Stack:
3132 602086f8 601bc260 705c0000 705c0000
3233 602086f8 6005fcec 705c0000 6002c6ab
33− 6005fcec 601bc260 705c0000 3000000010
34+ 6005fcec 601bc260 705c0000 3000000010
tools/testing/kunit/test_data/test_pound_sign.log+1−0
@@ -1,6 +1,7 @@
11 [ 0.060000] printk: console [mc-1] enabled
22 [ 0.060000] random: get_random_bytes called from init_oops_id+0x35/0x40 with crng_init=0
33 [ 0.060000] TAP version 14
4+[ 0.060000] 1..3
45 [ 0.060000] # Subtest: kunit-resource-test
56 [ 0.060000] 1..5
67 [ 0.060000] ok 1 - kunit_resource_test_init_resources
tools/testing/selftests/clone3/clone3_cap_checkpoint_restore.c+1−1
@@ -145,7 +145,7 @@ TEST(clone3_cap_checkpoint_restore) · 144 unmodified lines
145145 test_clone3_supported();
146146
147147 EXPECT_EQ(getuid(), 0)
148− XFAIL(return, "Skipping all tests as non-root\n");
148+ SKIP(return, "Skipping all tests as non-root");
149149
150150 memset(&set_tid, 0, sizeof(set_tid));
151151
tools/testing/selftests/core/close_range_test.c+4−4
@@ -44,7 +44,7 @@ TEST(close_range) · 43 unmodified lines
4444 fd = open("/dev/null", O_RDONLY | O_CLOEXEC);
4545 ASSERT_GE(fd, 0) {
4646 if (errno == ENOENT)
47− XFAIL(return, "Skipping test since /dev/null does not exist");
47+ SKIP(return, "Skipping test since /dev/null does not exist");
4848 }
4949
5050 open_fds[i] = fd;
@@ -52,7 +52,7 @@ TEST(close_range) · 1 unmodified line
5252
5353 EXPECT_EQ(-1, sys_close_range(open_fds[0], open_fds[100], -1)) {
5454 if (errno == ENOSYS)
55− XFAIL(return, "close_range() syscall not supported");
55+ SKIP(return, "close_range() syscall not supported");
5656 }
5757
5858 EXPECT_EQ(0, sys_close_range(open_fds[0], open_fds[50], 0));
@@ -108,7 +108,7 @@ TEST(close_range_unshare) · 49 unmodified lines
108108 fd = open("/dev/null", O_RDONLY | O_CLOEXEC);
109109 ASSERT_GE(fd, 0) {
110110 if (errno == ENOENT)
111− XFAIL(return, "Skipping test since /dev/null does not exist");
111+ SKIP(return, "Skipping test since /dev/null does not exist");
112112 }
113113
114114 open_fds[i] = fd;
@@ -197,7 +197,7 @@ TEST(close_range_unshare_capped) · 82 unmodified lines
197197 fd = open("/dev/null", O_RDONLY | O_CLOEXEC);
198198 ASSERT_GE(fd, 0) {
199199 if (errno == ENOENT)
200− XFAIL(return, "Skipping test since /dev/null does not exist");
200+ SKIP(return, "Skipping test since /dev/null does not exist");
201201 }
202202
203203 open_fds[i] = fd;
tools/testing/selftests/filesystems/binderfs/binderfs_test.c+4−4
@@ -74,7 +74,7 @@ static int __do_binderfs_test(struct __test_metadata *_metadata) · 73 unmodified lines
7474 ret = mount(NULL, binderfs_mntpt, "binder", 0, 0);
7575 EXPECT_EQ(ret, 0) {
7676 if (errno == ENODEV)
77− XFAIL(goto out, "binderfs missing");
77+ SKIP(goto out, "binderfs missing");
7878 TH_LOG("%s - Failed to mount binderfs", strerror(errno));
7979 goto rmdir;
8080 }
@@ -475,10 +475,10 @@ TEST(binderfs_stress) · 394 unmodified lines
475475 TEST(binderfs_test_privileged)
476476 {
477477 if (geteuid() != 0)
478− XFAIL(return, "Tests are not run as root. Skipping privileged tests");
478+ SKIP(return, "Tests are not run as root. Skipping privileged tests");
479479
480480 if (__do_binderfs_test(_metadata))
481− XFAIL(return, "The Android binderfs filesystem is not available");
481+ SKIP(return, "The Android binderfs filesystem is not available");
482482 }
483483
484484 TEST(binderfs_test_unprivileged)
@@ -511,7 +511,7 @@ TEST(binderfs_test_unprivileged) · 26 unmodified lines
511511 ret = wait_for_pid(pid);
512512 if (ret) {
513513 if (ret == 2)
514− XFAIL(return, "The Android binderfs filesystem is not available");
514+ SKIP(return, "The Android binderfs filesystem is not available");
515515 ASSERT_EQ(ret, 0) {
516516 TH_LOG("wait_for_pid() failed");
517517 }
tools/testing/selftests/filesystems/epoll/epoll_wakeup_test.c+95−0
@@ -3282,4 +3282,99 @@ TEST(epoll60) · 3281 unmodified lines
32823282 close(ctx.epfd);
32833283 }
32843284
3285+struct epoll61_ctx {
3286+ int epfd;
3287+ int evfd;
3288+};
3289+
3290+static void *epoll61_write_eventfd(void *ctx_)
3291+{
3292+ struct epoll61_ctx *ctx = ctx_;
3293+ int64_t l = 1;
3294+
3295+ usleep(10950);
3296+ write(ctx->evfd, &l, sizeof(l));
3297+ return NULL;
3298+}
3299+
3300+static void *epoll61_epoll_with_timeout(void *ctx_)
3301+{
3302+ struct epoll61_ctx *ctx = ctx_;
3303+ struct epoll_event events[1];
3304+ int n;
3305+
3306+ n = epoll_wait(ctx->epfd, events, 1, 11);
3307+ /*
3308+ * If epoll returned the eventfd, write on the eventfd to wake up the
3309+ * blocking poller.
3310+ */
3311+ if (n == 1) {
3312+ int64_t l = 1;
3313+
3314+ write(ctx->evfd, &l, sizeof(l));
3315+ }
3316+ return NULL;
3317+}
3318+
3319+static void *epoll61_blocking_epoll(void *ctx_)
3320+{
3321+ struct epoll61_ctx *ctx = ctx_;
3322+ struct epoll_event events[1];
3323+
3324+ epoll_wait(ctx->epfd, events, 1, -1);
3325+ return NULL;
3326+}
3327+
3328+TEST(epoll61)
3329+{
3330+ struct epoll61_ctx ctx;
3331+ struct epoll_event ev;
3332+ int i, r;
3333+
3334+ ctx.epfd = epoll_create1(0);
3335+ ASSERT_GE(ctx.epfd, 0);
3336+ ctx.evfd = eventfd(0, EFD_NONBLOCK);
3337+ ASSERT_GE(ctx.evfd, 0);
3338+
3339+ ev.events = EPOLLIN | EPOLLET | EPOLLERR | EPOLLHUP;
3340+ ev.data.ptr = NULL;
3341+ r = epoll_ctl(ctx.epfd, EPOLL_CTL_ADD, ctx.evfd, &ev);
3342+ ASSERT_EQ(r, 0);
3343+
3344+ /*
3345+ * We are testing a race. Repeat the test case 1000 times to make it
3346+ * more likely to fail in case of a bug.
3347+ */
3348+ for (i = 0; i < 1000; i++) {
3349+ pthread_t threads[3];
3350+ int n;
3351+
3352+ /*
3353+ * Start 3 threads:
3354+ * Thread 1 sleeps for 10.9ms and writes to the evenfd.
3355+ * Thread 2 calls epoll with a timeout of 11ms.
3356+ * Thread 3 calls epoll with a timeout of -1.
3357+ *
3358+ * The eventfd write by Thread 1 should either wakeup Thread 2
3359+ * or Thread 3. If it wakes up Thread 2, Thread 2 writes on the
3360+ * eventfd to wake up Thread 3.
3361+ *
3362+ * If no events are missed, all three threads should eventually
3363+ * be joinable.
3364+ */
3365+ ASSERT_EQ(pthread_create(&threads[0], NULL,
3366+ epoll61_write_eventfd, &ctx), 0);
3367+ ASSERT_EQ(pthread_create(&threads[1], NULL,
3368+ epoll61_epoll_with_timeout, &ctx), 0);
3369+ ASSERT_EQ(pthread_create(&threads[2], NULL,
3370+ epoll61_blocking_epoll, &ctx), 0);
3371+
3372+ for (n = 0; n < ARRAY_SIZE(threads); ++n)
3373+ ASSERT_EQ(pthread_join(threads[n], NULL), 0);
3374+ }
3375+
3376+ close(ctx.epfd);
3377+ close(ctx.evfd);
3378+}
3379+
32853380 TEST_HARNESS_MAIN
tools/testing/selftests/ftrace/test.d/dynevent/add_remove_kprobe.tc+1−1
@@ -6,7 +6,7 @@ · 5 unmodified lines
66 echo 0 > events/enable
77 echo > dynamic_events
88
9−PLACE=kernel_clone
9+PLACE=$FUNCTION_FORK
1010
1111 echo "p:myevent1 $PLACE" >> dynamic_events
1212 echo "r:myevent2 $PLACE" >> dynamic_events
tools/testing/selftests/ftrace/test.d/dynevent/clear_select_events.tc+1−1
@@ -6,7 +6,7 @@ · 5 unmodified lines
66 echo 0 > events/enable
77 echo > dynamic_events
88
9−PLACE=kernel_clone
9+PLACE=$FUNCTION_FORK
1010
1111 setup_events() {
1212 echo "p:myevent1 $PLACE" >> dynamic_events
tools/testing/selftests/ftrace/test.d/dynevent/generic_clear_event.tc+1−1
@@ -6,7 +6,7 @@ · 5 unmodified lines
66 echo 0 > events/enable
77 echo > dynamic_events
88
9−PLACE=kernel_clone
9+PLACE=$FUNCTION_FORK
1010
1111 setup_events() {
1212 echo "p:myevent1 $PLACE" >> dynamic_events
tools/testing/selftests/ftrace/test.d/ftrace/func-filter-notrace-pid.tc+1−1
@@ -39,7 +39,7 @@ do_test() { · 38 unmodified lines
3939 disable_tracing
4040
4141 echo do_execve* > set_ftrace_filter
42− echo *do_fork >> set_ftrace_filter
42+ echo $FUNCTION_FORK >> set_ftrace_filter
4343
4444 echo $PID > set_ftrace_notrace_pid
4545 echo function > current_tracer
tools/testing/selftests/ftrace/test.d/ftrace/func-filter-pid.tc+1−1
@@ -39,7 +39,7 @@ do_test() { · 38 unmodified lines
3939 disable_tracing
4040
4141 echo do_execve* > set_ftrace_filter
42− echo *do_fork >> set_ftrace_filter
42+ echo $FUNCTION_FORK >> set_ftrace_filter
4343
4444 echo $PID > set_ftrace_pid
4545 echo function > current_tracer
tools/testing/selftests/ftrace/test.d/ftrace/func-filter-stacktrace.tc+2−2
@@ -4,9 +4,9 @@ · 3 unmodified lines
44 # requires: set_ftrace_filter
55 # flags: instance
66
7−echo kernel_clone:stacktrace >> set_ftrace_filter
7+echo $FUNCTION_FORK:stacktrace >> set_ftrace_filter
88
9−grep -q "kernel_clone:stacktrace:unlimited" set_ftrace_filter
9+grep -q "$FUNCTION_FORK:stacktrace:unlimited" set_ftrace_filter
1010
1111 (echo "forked"; sleep 1)
1212
tools/testing/selftests/ftrace/test.d/functions+7−0
@@ -133,6 +133,13 @@ yield() { · 132 unmodified lines
133133 ping $LOCALHOST -c 1 || sleep .001 || usleep 1 || sleep 1
134134 }
135135
136+# The fork function in the kernel was renamed from "_do_fork" to
137+# "kernel_fork". As older tests should still work with older kernels
138+# as well as newer kernels, check which version of fork is used on this
139+# kernel so that the tests can use the fork function for the running kernel.
140+FUNCTION_FORK=`(if grep '\bkernel_clone\b' /proc/kallsyms > /dev/null; then
141+ echo kernel_clone; else echo '_do_fork'; fi)`
142+
136143 # Since probe event command may include backslash, explicitly use printf "%s"
137144 # to NOT interpret it.
138145 ftrace_errlog_check() { # err-prefix command-with-error-pos-by-^ command-file
tools/testing/selftests/ftrace/test.d/kprobe/add_and_remove.tc+1−1
@@ -3,7 +3,7 @@ · 2 unmodified lines
33 # description: Kprobe dynamic event - adding and removing
44 # requires: kprobe_events
55
6−echo p:myevent kernel_clone > kprobe_events
6+echo p:myevent $FUNCTION_FORK > kprobe_events
77 grep myevent kprobe_events
88 test -d events/kprobes/myevent
99 echo > kprobe_events
tools/testing/selftests/ftrace/test.d/kprobe/busy_check.tc+1−1
@@ -3,7 +3,7 @@ · 2 unmodified lines
33 # description: Kprobe dynamic event - busy event check
44 # requires: kprobe_events
55
6−echo p:myevent kernel_clone > kprobe_events
6+echo p:myevent $FUNCTION_FORK > kprobe_events
77 test -d events/kprobes/myevent
88 echo 1 > events/kprobes/myevent/enable
99 echo > kprobe_events && exit_fail # this must fail
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args.tc+2−2
@@ -3,13 +3,13 @@ · 2 unmodified lines
33 # description: Kprobe dynamic event with arguments
44 # requires: kprobe_events
55
6−echo 'p:testprobe kernel_clone $stack $stack0 +0($stack)' > kprobe_events
6+echo "p:testprobe $FUNCTION_FORK \$stack \$stack0 +0(\$stack)" > kprobe_events
77 grep testprobe kprobe_events | grep -q 'arg1=\$stack arg2=\$stack0 arg3=+0(\$stack)'
88 test -d events/kprobes/testprobe
99
1010 echo 1 > events/kprobes/testprobe/enable
1111 ( echo "forked")
12−grep testprobe trace | grep 'kernel_clone' | \
12+grep testprobe trace | grep "$FUNCTION_FORK" | \
1313 grep -q 'arg1=0x[[:xdigit:]]* arg2=0x[[:xdigit:]]* arg3=0x[[:xdigit:]]*$'
1414
1515 echo 0 > events/kprobes/testprobe/enable
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_comm.tc+1−1
@@ -5,7 +5,7 @@ · 4 unmodified lines
55
66 grep -A1 "fetcharg:" README | grep -q "\$comm" || exit_unsupported # this is too old
77
8−echo 'p:testprobe kernel_clone comm=$comm ' > kprobe_events
8+echo "p:testprobe $FUNCTION_FORK comm=\$comm " > kprobe_events
99 grep testprobe kprobe_events | grep -q 'comm=$comm'
1010 test -d events/kprobes/testprobe
1111
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc+2−2
@@ -30,13 +30,13 @@ esac · 29 unmodified lines
3030 : "Test get argument (1)"
3131 echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):string" > kprobe_events
3232 echo 1 > events/kprobes/testprobe/enable
33−echo "p:test kernel_clone" >> kprobe_events
33+echo "p:test $FUNCTION_FORK" >> kprobe_events
3434 grep -qe "testprobe.* arg1=\"test\"" trace
3535
3636 echo 0 > events/kprobes/testprobe/enable
3737 : "Test get argument (2)"
3838 echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):string arg2=+0(${ARG1}):string" > kprobe_events
3939 echo 1 > events/kprobes/testprobe/enable
40−echo "p:test kernel_clone" >> kprobe_events
40+echo "p:test $FUNCTION_FORK" >> kprobe_events
4141 grep -qe "testprobe.* arg1=\"test\" arg2=\"test\"" trace
4242
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_symbol.tc+5−5
@@ -14,12 +14,12 @@ elif ! grep "$SYMBOL\$" /proc/kallsyms; then · 13 unmodified lines
1414 fi
1515
1616 : "Test get basic types symbol argument"
17−echo "p:testprobe_u kernel_clone arg1=@linux_proc_banner:u64 arg2=@linux_proc_banner:u32 arg3=@linux_proc_banner:u16 arg4=@linux_proc_banner:u8" > kprobe_events
18−echo "p:testprobe_s kernel_clone arg1=@linux_proc_banner:s64 arg2=@linux_proc_banner:s32 arg3=@linux_proc_banner:s16 arg4=@linux_proc_banner:s8" >> kprobe_events
17+echo "p:testprobe_u $FUNCTION_FORK arg1=@linux_proc_banner:u64 arg2=@linux_proc_banner:u32 arg3=@linux_proc_banner:u16 arg4=@linux_proc_banner:u8" > kprobe_events
18+echo "p:testprobe_s $FUNCTION_FORK arg1=@linux_proc_banner:s64 arg2=@linux_proc_banner:s32 arg3=@linux_proc_banner:s16 arg4=@linux_proc_banner:s8" >> kprobe_events
1919 if grep -q "x8/16/32/64" README; then
20− echo "p:testprobe_x kernel_clone arg1=@linux_proc_banner:x64 arg2=@linux_proc_banner:x32 arg3=@linux_proc_banner:x16 arg4=@linux_proc_banner:x8" >> kprobe_events
20+ echo "p:testprobe_x $FUNCTION_FORK arg1=@linux_proc_banner:x64 arg2=@linux_proc_banner:x32 arg3=@linux_proc_banner:x16 arg4=@linux_proc_banner:x8" >> kprobe_events
2121 fi
22−echo "p:testprobe_bf kernel_clone arg1=@linux_proc_banner:b8@4/32" >> kprobe_events
22+echo "p:testprobe_bf $FUNCTION_FORK arg1=@linux_proc_banner:b8@4/32" >> kprobe_events
2323 echo 1 > events/kprobes/enable
2424 (echo "forked")
2525 echo 0 > events/kprobes/enable
@@ -27,7 +27,7 @@ grep "testprobe_[usx]:.* arg1=.* arg2=.* arg3=.* arg4=.*" trace · 1 unmodified line
2727 grep "testprobe_bf:.* arg1=.*" trace
2828
2929 : "Test get string symbol argument"
30−echo "p:testprobe_str kernel_clone arg1=@linux_proc_banner:string" > kprobe_events
30+echo "p:testprobe_str $FUNCTION_FORK arg1=@linux_proc_banner:string" > kprobe_events
3131 echo 1 > events/kprobes/enable
3232 (echo "forked")
3333 echo 0 > events/kprobes/enable
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc+1−1
@@ -4,7 +4,7 @@ · 3 unmodified lines
44 # requires: kprobe_events "x8/16/32/64":README
55
66 gen_event() { # Bitsize
7− echo "p:testprobe kernel_clone \$stack0:s$1 \$stack0:u$1 \$stack0:x$1 \$stack0:b4@4/$1"
7+ echo "p:testprobe $FUNCTION_FORK \$stack0:s$1 \$stack0:u$1 \$stack0:x$1 \$stack0:b4@4/$1"
88 }
99
1010 check_types() { # s-type u-type x-type bf-type width
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_user.tc+4−0
@@ -9,12 +9,16 @@ grep -A10 "fetcharg:" README | grep -q '\[u\]<offset>' || exit_unsupported · 8 unmodified lines
99 :;: "user-memory access syntax and ustring working on user memory";:
1010 echo 'p:myevent do_sys_open path=+0($arg2):ustring path2=+u0($arg2):string' \
1111 > kprobe_events
12+echo 'p:myevent2 do_sys_openat2 path=+0($arg2):ustring path2=+u0($arg2):string' \
13+ >> kprobe_events
1214
1315 grep myevent kprobe_events | \
1416 grep -q 'path=+0($arg2):ustring path2=+u0($arg2):string'
1517 echo 1 > events/kprobes/myevent/enable
18+echo 1 > events/kprobes/myevent2/enable
1619 echo > /dev/null
1720 echo 0 > events/kprobes/myevent/enable
21+echo 0 > events/kprobes/myevent2/enable
1822
1923 grep myevent trace | grep -q 'path="/dev/null" path2="/dev/null"'
2024
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc+7−7
@@ -5,29 +5,29 @@ · 4 unmodified lines
55
66 # prepare
77 echo nop > current_tracer
8−echo kernel_clone > set_ftrace_filter
9−echo 'p:testprobe kernel_clone' > kprobe_events
8+echo $FUNCTION_FORK > set_ftrace_filter
9+echo "p:testprobe $FUNCTION_FORK" > kprobe_events
1010
1111 # kprobe on / ftrace off
1212 echo 1 > events/kprobes/testprobe/enable
1313 echo > trace
1414 ( echo "forked")
1515 grep testprobe trace
16−! grep 'kernel_clone <-' trace
16+! grep "$FUNCTION_FORK <-" trace
1717
1818 # kprobe on / ftrace on
1919 echo function > current_tracer
2020 echo > trace
2121 ( echo "forked")
2222 grep testprobe trace
23−grep 'kernel_clone <-' trace
23+grep "$FUNCTION_FORK <-" trace
2424
2525 # kprobe off / ftrace on
2626 echo 0 > events/kprobes/testprobe/enable
2727 echo > trace
2828 ( echo "forked")
2929 ! grep testprobe trace
30−grep 'kernel_clone <-' trace
30+grep "$FUNCTION_FORK <-" trace
3131
3232 # kprobe on / ftrace on
3333 echo 1 > events/kprobes/testprobe/enable
@@ -35,11 +35,11 @@ echo function > current_tracer · 1 unmodified line
3535 echo > trace
3636 ( echo "forked")
3737 grep testprobe trace
38−grep 'kernel_clone <-' trace
38+grep "$FUNCTION_FORK <-" trace
3939
4040 # kprobe on / ftrace off
4141 echo nop > current_tracer
4242 echo > trace
4343 ( echo "forked")
4444 grep testprobe trace
45−! grep 'kernel_clone <-' trace
45+! grep "$FUNCTION_FORK <-" trace
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_multiprobe.tc+1−1
@@ -4,7 +4,7 @@ · 3 unmodified lines
44 # requires: kprobe_events "Create/append/":README
55
66 # Choose 2 symbols for target
7−SYM1=kernel_clone
7+SYM1=$FUNCTION_FORK
88 SYM2=do_exit
99 EVENT_NAME=kprobes/testevent
1010
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_syntax_errors.tc+6−6
@@ -86,15 +86,15 @@ esac · 85 unmodified lines
8686
8787 # multiprobe errors
8888 if grep -q "Create/append/" README && grep -q "imm-value" README; then
89−echo 'p:kprobes/testevent kernel_clone' > kprobe_events
89+echo "p:kprobes/testevent $FUNCTION_FORK" > kprobe_events
9090 check_error '^r:kprobes/testevent do_exit' # DIFF_PROBE_TYPE
9191
9292 # Explicitly use printf "%s" to not interpret \1
93−printf "%s" 'p:kprobes/testevent kernel_clone abcd=\1' > kprobe_events
94−check_error 'p:kprobes/testevent kernel_clone ^bcd=\1' # DIFF_ARG_TYPE
95−check_error 'p:kprobes/testevent kernel_clone ^abcd=\1:u8' # DIFF_ARG_TYPE
96−check_error 'p:kprobes/testevent kernel_clone ^abcd=\"foo"' # DIFF_ARG_TYPE
97−check_error '^p:kprobes/testevent kernel_clone abcd=\1' # SAME_PROBE
93+printf "%s" "p:kprobes/testevent $FUNCTION_FORK abcd=\\1" > kprobe_events
94+check_error "p:kprobes/testevent $FUNCTION_FORK ^bcd=\\1" # DIFF_ARG_TYPE
95+check_error "p:kprobes/testevent $FUNCTION_FORK ^abcd=\\1:u8" # DIFF_ARG_TYPE
96+check_error "p:kprobes/testevent $FUNCTION_FORK ^abcd=\\\"foo\"" # DIFF_ARG_TYPE
97+check_error "^p:kprobes/testevent $FUNCTION_FORK abcd=\\1" # SAME_PROBE
9898 fi
9999
100100 # %return suffix errors
tools/testing/selftests/ftrace/test.d/kprobe/kretprobe_args.tc+2−2
@@ -4,14 +4,14 @@ · 3 unmodified lines
44 # requires: kprobe_events
55
66 # Add new kretprobe event
7−echo 'r:testprobe2 kernel_clone $retval' > kprobe_events
7+echo "r:testprobe2 $FUNCTION_FORK \$retval" > kprobe_events
88 grep testprobe2 kprobe_events | grep -q 'arg1=\$retval'
99 test -d events/kprobes/testprobe2
1010
1111 echo 1 > events/kprobes/testprobe2/enable
1212 ( echo "forked")
1313
14−cat trace | grep testprobe2 | grep -q '<- kernel_clone'
14+cat trace | grep testprobe2 | grep -q "<- $FUNCTION_FORK"
1515
1616 echo 0 > events/kprobes/testprobe2/enable
1717 echo '-:testprobe2' >> kprobe_events
tools/testing/selftests/ftrace/test.d/kprobe/profile.tc+1−1
@@ -4,7 +4,7 @@ · 3 unmodified lines
44 # requires: kprobe_events
55
66 ! grep -q 'myevent' kprobe_profile
7−echo p:myevent kernel_clone > kprobe_events
7+echo "p:myevent $FUNCTION_FORK" > kprobe_events
88 grep -q 'myevent[[:space:]]*0[[:space:]]*0$' kprobe_profile
99 echo 1 > events/kprobes/myevent/enable
1010 ( echo "forked" )
tools/testing/selftests/kselftest_harness.h+23−23
@@ -126,7 +126,7 @@ · 125 unmodified lines
126126 snprintf(_metadata->results->reason, \
127127 sizeof(_metadata->results->reason), fmt, ##__VA_ARGS__); \
128128 if (TH_LOG_ENABLED) { \
129− fprintf(TH_LOG_STREAM, "# SKIP %s\n", \
129+ fprintf(TH_LOG_STREAM, "# SKIP %s\n", \
130130 _metadata->results->reason); \
131131 } \
132132 _metadata->passed = 1; \
@@ -432,7 +432,7 @@ · 299 unmodified lines
432432 */
433433
434434 /**
435− * ASSERT_EQ(expected, seen)
435+ * ASSERT_EQ()
436436 *
437437 * @expected: expected value
438438 * @seen: measured value
@@ -443,7 +443,7 @@ · 4 unmodified lines
443443 __EXPECT(expected, #expected, seen, #seen, ==, 1)
444444
445445 /**
446− * ASSERT_NE(expected, seen)
446+ * ASSERT_NE()
447447 *
448448 * @expected: expected value
449449 * @seen: measured value
@@ -454,7 +454,7 @@ · 4 unmodified lines
454454 __EXPECT(expected, #expected, seen, #seen, !=, 1)
455455
456456 /**
457− * ASSERT_LT(expected, seen)
457+ * ASSERT_LT()
458458 *
459459 * @expected: expected value
460460 * @seen: measured value
@@ -465,7 +465,7 @@ · 4 unmodified lines
465465 __EXPECT(expected, #expected, seen, #seen, <, 1)
466466
467467 /**
468− * ASSERT_LE(expected, seen)
468+ * ASSERT_LE()
469469 *
470470 * @expected: expected value
471471 * @seen: measured value
@@ -476,7 +476,7 @@ · 4 unmodified lines
476476 __EXPECT(expected, #expected, seen, #seen, <=, 1)
477477
478478 /**
479− * ASSERT_GT(expected, seen)
479+ * ASSERT_GT()
480480 *
481481 * @expected: expected value
482482 * @seen: measured value
@@ -487,7 +487,7 @@ · 4 unmodified lines
487487 __EXPECT(expected, #expected, seen, #seen, >, 1)
488488
489489 /**
490− * ASSERT_GE(expected, seen)
490+ * ASSERT_GE()
491491 *
492492 * @expected: expected value
493493 * @seen: measured value
@@ -498,7 +498,7 @@ · 4 unmodified lines
498498 __EXPECT(expected, #expected, seen, #seen, >=, 1)
499499
500500 /**
501− * ASSERT_NULL(seen)
501+ * ASSERT_NULL()
502502 *
503503 * @seen: measured value
504504 *
@@ -508,7 +508,7 @@ · 3 unmodified lines
508508 __EXPECT(NULL, "NULL", seen, #seen, ==, 1)
509509
510510 /**
511− * ASSERT_TRUE(seen)
511+ * ASSERT_TRUE()
512512 *
513513 * @seen: measured value
514514 *
@@ -518,7 +518,7 @@ · 3 unmodified lines
518518 __EXPECT(0, "0", seen, #seen, !=, 1)
519519
520520 /**
521− * ASSERT_FALSE(seen)
521+ * ASSERT_FALSE()
522522 *
523523 * @seen: measured value
524524 *
@@ -528,7 +528,7 @@ · 3 unmodified lines
528528 __EXPECT(0, "0", seen, #seen, ==, 1)
529529
530530 /**
531− * ASSERT_STREQ(expected, seen)
531+ * ASSERT_STREQ()
532532 *
533533 * @expected: expected value
534534 * @seen: measured value
@@ -539,7 +539,7 @@ · 4 unmodified lines
539539 __EXPECT_STR(expected, seen, ==, 1)
540540
541541 /**
542− * ASSERT_STRNE(expected, seen)
542+ * ASSERT_STRNE()
543543 *
544544 * @expected: expected value
545545 * @seen: measured value
@@ -550,7 +550,7 @@ · 4 unmodified lines
550550 __EXPECT_STR(expected, seen, !=, 1)
551551
552552 /**
553− * EXPECT_EQ(expected, seen)
553+ * EXPECT_EQ()
554554 *
555555 * @expected: expected value
556556 * @seen: measured value
@@ -561,7 +561,7 @@ · 4 unmodified lines
561561 __EXPECT(expected, #expected, seen, #seen, ==, 0)
562562
563563 /**
564− * EXPECT_NE(expected, seen)
564+ * EXPECT_NE()
565565 *
566566 * @expected: expected value
567567 * @seen: measured value
@@ -572,7 +572,7 @@ · 4 unmodified lines
572572 __EXPECT(expected, #expected, seen, #seen, !=, 0)
573573
574574 /**
575− * EXPECT_LT(expected, seen)
575+ * EXPECT_LT()
576576 *
577577 * @expected: expected value
578578 * @seen: measured value
@@ -583,7 +583,7 @@ · 4 unmodified lines
583583 __EXPECT(expected, #expected, seen, #seen, <, 0)
584584
585585 /**
586− * EXPECT_LE(expected, seen)
586+ * EXPECT_LE()
587587 *
588588 * @expected: expected value
589589 * @seen: measured value
@@ -594,7 +594,7 @@ · 4 unmodified lines
594594 __EXPECT(expected, #expected, seen, #seen, <=, 0)
595595
596596 /**
597− * EXPECT_GT(expected, seen)
597+ * EXPECT_GT()
598598 *
599599 * @expected: expected value
600600 * @seen: measured value
@@ -605,7 +605,7 @@ · 4 unmodified lines
605605 __EXPECT(expected, #expected, seen, #seen, >, 0)
606606
607607 /**
608− * EXPECT_GE(expected, seen)
608+ * EXPECT_GE()
609609 *
610610 * @expected: expected value
611611 * @seen: measured value
@@ -616,7 +616,7 @@ · 4 unmodified lines
616616 __EXPECT(expected, #expected, seen, #seen, >=, 0)
617617
618618 /**
619− * EXPECT_NULL(seen)
619+ * EXPECT_NULL()
620620 *
621621 * @seen: measured value
622622 *
@@ -626,7 +626,7 @@ · 3 unmodified lines
626626 __EXPECT(NULL, "NULL", seen, #seen, ==, 0)
627627
628628 /**
629− * EXPECT_TRUE(seen)
629+ * EXPECT_TRUE()
630630 *
631631 * @seen: measured value
632632 *
@@ -636,7 +636,7 @@ · 3 unmodified lines
636636 __EXPECT(0, "0", seen, #seen, !=, 0)
637637
638638 /**
639− * EXPECT_FALSE(seen)
639+ * EXPECT_FALSE()
640640 *
641641 * @seen: measured value
642642 *
@@ -646,7 +646,7 @@ · 3 unmodified lines
646646 __EXPECT(0, "0", seen, #seen, ==, 0)
647647
648648 /**
649− * EXPECT_STREQ(expected, seen)
649+ * EXPECT_STREQ()
650650 *
651651 * @expected: expected value
652652 * @seen: measured value
@@ -657,7 +657,7 @@ · 4 unmodified lines
657657 __EXPECT_STR(expected, seen, ==, 0)
658658
659659 /**
660− * EXPECT_STRNE(expected, seen)
660+ * EXPECT_STRNE()
661661 *
662662 * @expected: expected value
663663 * @seen: measured value
tools/testing/selftests/lib.mk+1−1
@@ -136,7 +136,7 @@ endif · 135 unmodified lines
136136 ifeq ($(OVERRIDE_TARGETS),)
137137 LOCAL_HDRS := $(selfdir)/kselftest_harness.h $(selfdir)/kselftest.h
138138 $(OUTPUT)/%:%.c $(LOCAL_HDRS)
139− $(LINK.c) $^ $(LDLIBS) -o $@
139+ $(LINK.c) $(filter-out $(LOCAL_HDRS),$^) $(LDLIBS) -o $@
140140
141141 $(OUTPUT)/%.o:%.S
142142 $(COMPILE.S) $^ -o $@
tools/testing/selftests/pidfd/config+1−0
@@ -4,3 +4,4 @@ CONFIG_USER_NS=y · 3 unmodified lines
44 CONFIG_PID_NS=y
55 CONFIG_NET_NS=y
66 CONFIG_CGROUPS=y
7+CONFIG_CHECKPOINT_RESTORE=y
tools/testing/selftests/pidfd/pidfd_getfd_test.c+4−1
@@ -204,7 +204,10 @@ TEST_F(child, fetch_fd) · 203 unmodified lines
204204 fd = sys_pidfd_getfd(self->pidfd, self->remote_fd, 0);
205205 ASSERT_GE(fd, 0);
206206
207− EXPECT_EQ(0, sys_kcmp(getpid(), self->pid, KCMP_FILE, fd, self->remote_fd));
207+ ret = sys_kcmp(getpid(), self->pid, KCMP_FILE, fd, self->remote_fd);
208+ if (ret < 0 && errno == ENOSYS)
209+ SKIP(return, "kcmp() syscall not supported");
210+ EXPECT_EQ(ret, 0);
208211
209212 ret = fcntl(fd, F_GETFD);
210213 ASSERT_GE(ret, 0);
tools/testing/selftests/pidfd/pidfd_open_test.c+0−1
@@ -6,7 +6,6 @@ · 5 unmodified lines
66 #include <inttypes.h>
77 #include <limits.h>
88 #include <linux/types.h>
9−#include <linux/wait.h>
109 #include <sched.h>
1110 #include <signal.h>
1211 #include <stdbool.h>
tools/testing/selftests/pidfd/pidfd_poll_test.c+0−1
@@ -3,7 +3,6 @@ · 2 unmodified lines
33 #define _GNU_SOURCE
44 #include <errno.h>
55 #include <linux/types.h>
6−#include <linux/wait.h>
76 #include <poll.h>
87 #include <signal.h>
98 #include <stdbool.h>
tools/testing/selftests/pidfd/pidfd_setns_test.c+0−1
@@ -16,7 +16,6 @@ · 15 unmodified lines
1616 #include <unistd.h>
1717 #include <sys/socket.h>
1818 #include <sys/stat.h>
19−#include <linux/kcmp.h>
2019
2120 #include "pidfd.h"
2221 #include "../clone3/clone3_selftests.h"
tools/testing/selftests/pidfd/pidfd_test.c+1−1
@@ -330,7 +330,7 @@ static int test_pidfd_send_signal_recycled_pid_fail(void) · 329 unmodified lines
330330 ksft_exit_fail_msg("%s test: Failed to recycle pid %d\n",
331331 test_name, PID_RECYCLE);
332332 case PIDFD_SKIP:
333− ksft_print_msg("%s test: Skipping test\n", test_name);
333+ ksft_test_result_skip("%s test: Skipping test\n", test_name);
334334 ret = 0;
335335 break;
336336 case PIDFD_XFAIL:
tools/testing/selftests/proc/proc-loadavg-001.c+0−1
@@ -14,7 +14,6 @@ · 13 unmodified lines
1414 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1515 */
1616 /* Test that /proc/loadavg correctly reports last pid in pid namespace. */
17−#define _GNU_SOURCE
1817 #include <errno.h>
1918 #include <sched.h>
2019 #include <sys/types.h>
tools/testing/selftests/proc/proc-self-syscall.c+0−1
@@ -13,7 +13,6 @@ · 12 unmodified lines
1313 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1414 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1515 */
16−#define _GNU_SOURCE
1716 #include <unistd.h>
1817 #include <sys/syscall.h>
1918 #include <sys/types.h>
tools/testing/selftests/proc/proc-uptime-002.c+0−1
@@ -15,7 +15,6 @@ · 14 unmodified lines
1515 */
1616 // Test that values in /proc/uptime increment monotonically
1717 // while shifting across CPUs.
18−#define _GNU_SOURCE
1918 #undef NDEBUG
2019 #include <assert.h>
2120 #include <unistd.h>
tools/testing/selftests/wireguard/netns.sh+8−0
@@ -316,6 +316,14 @@ pp sleep 3 · 315 unmodified lines
316316 n2 ping -W 1 -c 1 192.168.241.1
317317 n1 wg set wg0 peer "$pub2" persistent-keepalive 0
318318
319+# Test that sk_bound_dev_if works
320+n1 ping -I wg0 -c 1 -W 1 192.168.241.2
321+# What about when the mark changes and the packet must be rerouted?
322+n1 iptables -t mangle -I OUTPUT -j MARK --set-xmark 1
323+n1 ping -c 1 -W 1 192.168.241.2 # First the boring case
324+n1 ping -I wg0 -c 1 -W 1 192.168.241.2 # Then the sk_bound_dev_if case
325+n1 iptables -t mangle -D OUTPUT -j MARK --set-xmark 1
326+
319327 # Test that onion routing works, even when it loops
320328 n1 wg set wg0 peer "$pub3" allowed-ips 192.168.242.2/32 endpoint 192.168.241.2:5
321329 ip1 addr add 192.168.242.1/24 dev wg0
tools/testing/selftests/wireguard/qemu/kernel.config+2−0
@@ -18,10 +18,12 @@ CONFIG_NF_NAT=y · 17 unmodified lines
1818 CONFIG_NETFILTER_XTABLES=y
1919 CONFIG_NETFILTER_XT_NAT=y
2020 CONFIG_NETFILTER_XT_MATCH_LENGTH=y
21+CONFIG_NETFILTER_XT_MARK=y
2122 CONFIG_NF_CONNTRACK_IPV4=y
2223 CONFIG_NF_NAT_IPV4=y
2324 CONFIG_IP_NF_IPTABLES=y
2425 CONFIG_IP_NF_FILTER=y
26+CONFIG_IP_NF_MANGLE=y
2527 CONFIG_IP_NF_NAT=y
2628 CONFIG_IP_ADVANCED_ROUTER=y
2729 CONFIG_IP_MULTIPLE_TABLES=y

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