History

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

Conflicts are simple overlapping changes.

David S. Miller committed 5 years ago

Commit 5af84df2 parents 090597b 9f42f67371 files · +3766 −3026Browse files

Unified · Split

371 files
  1. Documentation/dev-tools/kunit/running_tips.rst +1 −13
  2. Documentation/devicetree/bindings/clock/brcm,iproc-clocks.yaml +0 −1
  3. Documentation/devicetree/bindings/display/renesas,du.yaml +0 −1
  4. Documentation/devicetree/bindings/hwmon/adt7475.yaml +11 −11
  5. Documentation/devicetree/bindings/iommu/arm,smmu.yaml +2 −4
  6. Documentation/devicetree/bindings/iommu/rockchip,iommu.yaml +0 −2
  7. Documentation/devicetree/bindings/memory-controllers/arm,pl353-smc.yaml +0 −1
  8. Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +0 −8
  9. Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml +2 −2
  10. Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml +28 −28
  11. Documentation/devicetree/bindings/regulator/fixed-regulator.yaml +2 −0
  12. Documentation/devicetree/bindings/regulator/mps,mpq7920.yaml +3 −3
  13. Documentation/devicetree/bindings/regulator/nxp,pf8x00-regulator.yaml +2 −1
  14. Documentation/devicetree/bindings/rtc/faraday,ftrtc010.yaml +0 −1
  15. Documentation/devicetree/bindings/spi/spi-controller.yaml +16 −16
  16. Documentation/devicetree/bindings/usb/nxp,isp1760.yaml +0 −2
  17. Documentation/driver-api/early-userspace/early_userspace_support.rst +4 −4
  18. Documentation/features/core/thread-info-in-task/arch-support.txt +32 −0
  19. Documentation/features/time/arch-tick-broadcast/arch-support.txt +1 −1
  20. Documentation/filesystems/ramfs-rootfs-initramfs.rst +1 −1
  21. Documentation/networking/af_xdp.rst +3 −3
  22. Documentation/networking/ip-sysctl.rst +1 −1
  23. Documentation/translations/zh_CN/process/2.Process.rst +2 −2
  24. LICENSES/dual/CC-BY-4.0 +1 −1
  25. MAINTAINERS +2 −0
  26. Makefile +7 −6
  27. arch/arm/Kconfig +1 −1
  28. arch/arm/boot/dts/aspeed-bmc-asrock-e3c246d4i.dts +3 −1
  29. arch/arm/boot/dts/aspeed-bmc-ibm-everest.dts +5 −4
  30. arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts +1 −4
  31. arch/arm/boot/dts/aspeed-bmc-opp-tacoma.dts +2 −4
  32. arch/arm/boot/dts/versatile-ab.dts +2 −3
  33. arch/arm/boot/dts/versatile-pb.dts +1 −1
  34. arch/arm/configs/integrator_defconfig +1 −4
  35. arch/arm/configs/multi_v7_defconfig +1 −1
  36. arch/arm/configs/realview_defconfig +1 −3
  37. arch/arm/configs/shmobile_defconfig +1 −0
  38. arch/arm/configs/u8500_defconfig +5 −0
  39. arch/arm/configs/versatile_defconfig +1 −3
  40. arch/arm/configs/vexpress_defconfig +7 −10
  41. arch/arm64/Kconfig +2 −1
  42. arch/arm64/boot/dts/nvidia/tegra194.dtsi +13 −0
  43. arch/arm64/boot/dts/renesas/r9a07g044.dtsi +2 −2
  44. arch/arm64/include/asm/cache.h +1 −1
  45. arch/arm64/include/asm/smp_plat.h +1 −0
  46. arch/arm64/kernel/Makefile +1 −1
  47. arch/arm64/kernel/cpufeature.c +1 −0
  48. arch/arm64/kernel/entry-common.c +1 −1
  49. arch/arm64/kernel/mte.c +2 −13
  50. arch/arm64/kernel/smccc-call.S +6 −3
  51. arch/arm64/lib/copy_from_user.S +10 −3
  52. arch/arm64/lib/copy_in_user.S +14 −7
  53. arch/arm64/lib/copy_to_user.S +11 −3
  54. arch/arm64/lib/strlen.S +10 −0
  55. arch/arm64/mm/mmu.c +8 −12
  56. arch/mips/include/asm/fpu.h +1 −1
  57. arch/mips/mm/tlbex.c +2 −0
  58. arch/powerpc/mm/nohash/8xx.c +10 −0
  59. arch/powerpc/platforms/powermac/smp.c +1 −0
  60. arch/s390/boot/text_dma.S +4 −15
  61. arch/s390/configs/debug_defconfig +18 −9
  62. arch/s390/configs/defconfig +19 −8
  63. arch/s390/configs/zfcpdump_defconfig +1 −2
  64. arch/s390/include/asm/ftrace.h +1 −0
  65. arch/s390/kernel/ftrace.c +2 −0
  66. arch/s390/kernel/mcount.S +2 −2
  67. arch/s390/kernel/perf_cpum_cf.c +1 −1
  68. arch/s390/kernel/uprobes.c +1 −0
  69. arch/s390/kernel/vdso32/Makefile +1 −0
  70. arch/s390/net/bpf_jit_comp.c +1 −1
  71. arch/x86/kernel/cpu/mshyperv.c +1 −1
  72. arch/x86/kvm/cpuid.c +25 −5
  73. arch/x86/kvm/mmu/mmu.c +2 −0
  74. arch/x86/kvm/mmu/paging.h +14 −0
  75. arch/x86/kvm/mmu/paging_tmpl.h +2 −2
  76. arch/x86/kvm/mmu/spte.h +0 −6
  77. arch/x86/kvm/svm/nested.c +33 −20
  78. arch/x86/kvm/svm/sev.c +8 −6
  79. arch/x86/kvm/svm/svm.c +70 −7
  80. arch/x86/kvm/svm/svm.h +5 −0
  81. arch/x86/kvm/vmx/vmx.h +0 −2
  82. arch/x86/kvm/x86.c +2 −3
  83. arch/x86/mm/pgtable.c +15 −19
  84. drivers/block/nbd.c +1 −1
  85. drivers/block/paride/pd.c +1 −1
  86. drivers/block/xen-blkfront.c +26 −198
  87. drivers/char/powernv-op-panel.c +1 −0
  88. drivers/clk/renesas/r9a07g044-cpg.c +47 −32
  89. drivers/clk/renesas/renesas-rzg2l-cpg.c +59 −51
  90. drivers/clk/renesas/renesas-rzg2l-cpg.h +28 −9
  91. drivers/cpufreq/longhaul.c +0 −2
  92. drivers/dma-buf/sync_file.c +7 −6
  93. drivers/dma/ipu/ipu_idmac.c +2 −0
  94. drivers/dma/mpc512x_dma.c +1 −0
  95. drivers/dma/ti/k3-udma.c +1 −0
  96. drivers/edac/Kconfig +1 −1
  97. drivers/firmware/arm_ffa/bus.c +3 −3
  98. drivers/firmware/arm_ffa/driver.c +5 −3
  99. drivers/firmware/arm_scmi/bus.c +3 −5
  100. drivers/firmware/arm_scmi/driver.c +9 −5
  101. drivers/firmware/arm_scmi/notify.c +4 −0
  102. drivers/firmware/arm_scmi/sensors.c +4 −2
  103. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +1 −1
  104. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +9 −13
  105. drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +3 −3
  106. drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 −0
  107. drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +1 −1
  108. drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +18 −0
  109. drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +35 −14
  110. drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +3 −3
  111. drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +5 −6
  112. drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +1 −1
  113. drivers/gpu/drm/amd/amdgpu/dce_virtual.c +1 −1
  114. drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c +2 −2
  115. drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c +2 −2
  116. drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +12 −33
  117. drivers/gpu/drm/amd/amdkfd/kfd_process.c +1 −2
  118. drivers/gpu/drm/amd/amdkfd/kfd_svm.c +18 −12
  119. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 −1
  120. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_smu.c +2 −2
  121. drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +4 −4
  122. drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.c +1 −1
  123. drivers/gpu/drm/amd/include/asic_reg/mp/mp_13_0_1_offset.h +0 −355
  124. drivers/gpu/drm/amd/include/asic_reg/mp/mp_13_0_1_sh_mask.h +0 −531
  125. drivers/gpu/drm/amd/pm/inc/smu_v13_0.h +1 −0
  126. drivers/gpu/drm/amd/pm/inc/smu_v13_0_1.h +0 −57
  127. drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 −0
  128. drivers/gpu/drm/amd/pm/swsmu/smu13/Makefile +1 −1
  129. drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +24 −0
  130. drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_1.c +0 −311
  131. drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +34 −15
  132. drivers/gpu/drm/i915/gem/i915_gem_shrinker.c +1 −0
  133. drivers/gpu/drm/i915/gt/gen8_ppgtt.c +1 −4
  134. drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c +1 −1
  135. drivers/gpu/drm/msm/msm_gem.c +1 −1
  136. drivers/gpu/drm/panel/panel-novatek-nt35510.c +1 −3
  137. drivers/gpu/drm/qxl/qxl_ttm.c +1 −1
  138. drivers/gpu/drm/ttm/ttm_range_manager.c +3 −0
  139. drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +1 −0
  140. drivers/gpu/drm/vmwgfx/vmwgfx_mob.c +0 −1
  141. drivers/hv/channel_mgmt.c +64 −32
  142. drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +1 −0
  143. drivers/iommu/arm/arm-smmu/qcom_iommu.c +2 −11
  144. drivers/iommu/intel/iommu.c +23 −11
  145. drivers/iommu/rockchip-iommu.c +4 −2
  146. drivers/mmc/core/block.c +21 −14
  147. drivers/mmc/core/host.c +10 −10
  148. drivers/mmc/host/jz4740_mmc.c +2 −0
  149. drivers/mtd/chips/cfi_util.c +2 −2
  150. drivers/net/bonding/bond_main.c +2 −0
  151. drivers/net/dsa/mt7530.c +2 −0
  152. drivers/net/dsa/mt7530.h +1 −0
  153. drivers/net/dsa/mv88e6xxx/Kconfig +1 −1
  154. drivers/net/dsa/sja1105/sja1105_main.c +6 −0
  155. drivers/net/ethernet/broadcom/bnxt/bnxt.c +62 −23
  156. drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c +9 −1
  157. drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +7 −17
  158. drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h +0 −1
  159. drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c +5 −4
  160. drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c +1 −1
  161. drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c +8 −8
  162. drivers/net/ethernet/freescale/fman/mac.c +1 −0
  163. drivers/net/ethernet/hisilicon/hip04_eth.c +3 −3
  164. drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h +5 −2
  165. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +6 −2
  166. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c +1 −0
  167. drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +10 −0
  168. drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c +19 −0
  169. drivers/net/ethernet/ibm/ibmvnic.c +1 −1
  170. drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +2 −1
  171. drivers/net/ethernet/marvell/octeontx2/af/Makefile +1 −1
  172. drivers/net/ethernet/marvell/octeontx2/af/rvu.c +9 −1
  173. drivers/net/ethernet/marvell/octeontx2/af/rvu.h +21 −0
  174. drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c +3 −0
  175. drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c +1 −4
  176. drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c +41 −7
  177. drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +36 −0
  178. drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +36 −11
  179. drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c +21 −8
  180. drivers/net/ethernet/marvell/octeontx2/af/rvu_switch.c +258 −0
  181. drivers/net/ethernet/microchip/sparx5/Kconfig +1 −0
  182. drivers/net/ethernet/netronome/nfp/flower/conntrack.c +1 −0
  183. drivers/net/ethernet/realtek/r8169_main.c +2 −1
  184. drivers/net/ethernet/renesas/ravb.h +1 −1
  185. drivers/net/ethernet/renesas/ravb_main.c +1 −1
  186. drivers/net/ethernet/xscale/ptp_ixp46x.c +2 −0
  187. drivers/net/usb/r8152.c +20 −10
  188. drivers/net/wireless/mediatek/mt76/mt7921/main.c +1 −0
  189. drivers/nvme/host/pci.c +58 −9
  190. drivers/nvme/host/tcp.c +1 −3
  191. drivers/pci/proc.c +1 −1
  192. drivers/power/supply/ab8500_fg.c +2 −0
  193. drivers/power/supply/abx500_chargalg.c +1 −0
  194. drivers/pwm/pwm-berlin.c +3 −6
  195. drivers/pwm/pwm-ep93xx.c +40 −45
  196. drivers/pwm/pwm-spear.c +3 −6
  197. drivers/pwm/pwm-sprd.c +4 −7
  198. drivers/pwm/pwm-tiecap.c +6 −9
  199. drivers/regulator/bd9576-regulator.c +2 −2
  200. drivers/regulator/hi6421-regulator.c +13 −9
  201. drivers/regulator/hi6421v600-regulator.c +9 −7
  202. drivers/regulator/mtk-dvfsrc-regulator.c +1 −2
  203. drivers/regulator/rtmv20-regulator.c +1 −1
  204. drivers/s390/char/tape_char.c +0 −2
  205. drivers/s390/net/ctcm_fsms.c +1 −0
  206. drivers/s390/net/qeth_l3_main.c +1 −0
  207. drivers/s390/scsi/zfcp_sysfs.c +1 −0
  208. drivers/scsi/arm/fas216.c +1 −1
  209. drivers/scsi/hosts.c +1 −0
  210. drivers/scsi/libsas/sas_discover.c +1 −1
  211. drivers/scsi/mpi3mr/mpi3mr_fw.c +7 −8
  212. drivers/scsi/pm8001/pm8001_ctl.c +26 −22
  213. drivers/scsi/pm8001/pm8001_hwi.c +9 −9
  214. drivers/scsi/pm8001/pm8001_init.c +15 −14
  215. drivers/scsi/pm8001/pm8001_sas.c +22 −19
  216. drivers/scsi/pm8001/pm80xx_hwi.c +25 −25
  217. drivers/scsi/scsi_lib.c +1 −1
  218. drivers/scsi/ufs/ufshcd.h +7 −2
  219. drivers/spi/spi-atmel.c +2 −7
  220. drivers/spi/spi-bcm2835.c +7 −5
  221. drivers/spi/spi-cadence-quadspi.c +17 −13
  222. drivers/spi/spi-cadence.c +9 −5
  223. drivers/spi/spi-imx.c +19 −19
  224. drivers/spi/spi-mt65xx.c +19 −9
  225. drivers/spi/spi-stm32.c +17 −7
  226. drivers/usb/gadget/udc/fsl_qe_udc.c +1 −0
  227. drivers/video/fbdev/core/fbmem.c +5 −7
  228. drivers/video/fbdev/xilinxfb.c +2 −0
  229. fs/afs/cmservice.c +7 −18
  230. fs/afs/dir.c +6 −4
  231. fs/afs/write.c +12 −6
  232. fs/cifs/cifs_dfs_ref.c +5 −1
  233. fs/cifs/cifsglob.h +7 −0
  234. fs/cifs/connect.c +99 −11
  235. fs/cifs/dns_resolve.c +6 −4
  236. fs/cifs/dns_resolve.h +1 −1
  237. fs/cifs/misc.c +1 −1
  238. fs/cifs/smb2ops.c +4 −2
  239. fs/cifs/smb2pdu.h +1 −0
  240. fs/configfs/file.c +22 −7
  241. fs/fcntl.c +1 −1
  242. fs/hfs/bfind.c +13 −1
  243. fs/hfs/bnode.c +20 −5
  244. fs/hfs/btree.h +7 −0
  245. fs/hfs/super.c +5 −5
  246. fs/io_uring.c +5 −3
  247. fs/iomap/buffered-io.c +4 −4
  248. fs/iomap/seek.c +9 −16
  249. fs/seq_file.c +3 −0
  250. fs/xfs/libxfs/xfs_ag.c +8 −0
  251. fs/xfs/libxfs/xfs_attr.c +8 −8
  252. fs/xfs/libxfs/xfs_ialloc.c +55 −0
  253. fs/xfs/libxfs/xfs_ialloc.h +3 −0
  254. fs/xfs/libxfs/xfs_inode_buf.c +16 −12
  255. fs/xfs/libxfs/xfs_trans_inode.c +4 −6
  256. fs/xfs/scrub/inode.c +16 −2
  257. fs/xfs/xfs_inode.c +13 −0
  258. fs/xfs/xfs_ioctl.c +22 −5
  259. fs/xfs/xfs_rtalloc.c +37 −12
  260. fs/zonefs/super.c +0 −3
  261. include/dt-bindings/clock/r9a07g044-cpg.h +183 −53
  262. include/linux/kasan.h +1 −0
  263. include/linux/mfd/rt5033-private.h +2 −2
  264. include/linux/pgtable.h +1 −25
  265. include/linux/rmap.h +3 −1
  266. include/linux/scmi_protocol.h +9 −5
  267. include/linux/scpi_protocol.h +8 −0
  268. include/math-emu/op-common.h +1 −1
  269. include/net/tcp.h +0 −1
  270. include/soc/tegra/mc.h +7 −2
  271. include/trace/events/afs.h +62 −5
  272. include/trace/events/net.h +1 −1
  273. include/trace/events/qdisc.h +27 −1
  274. init/Kconfig +0 −1
  275. kernel/bpf/verifier.c +2 −0
  276. kernel/debug/gdbstub.c +1 −1
  277. kernel/rcu/refscale.c +3 −3
  278. kernel/rcu/tasks.h +2 −4
  279. kernel/rcu/tree_stall.h +2 −2
  280. kernel/scftorture.c +3 −3
  281. kernel/trace/trace_events_hist.c +3 −3
  282. lib/test_hmm.c +0 −2
  283. mm/hugetlb.c +3 −2
  284. mm/kasan/kasan.h +12 −0
  285. mm/page_alloc.c +21 −7
  286. mm/slab.h +11 −4
  287. mm/slub.c +30 −63
  288. net/bpf/test_run.c +5 −0
  289. net/bridge/br_fdb.c +1 −1
  290. net/caif/caif_socket.c +2 −1
  291. net/core/dev.c +26 −8
  292. net/core/skbuff.c +16 −2
  293. net/core/skmsg.c +11 −5
  294. net/decnet/af_decnet.c +12 −15
  295. net/dsa/slave.c +9 −5
  296. net/dsa/tag_ksz.c +9 −0
  297. net/ipv4/tcp_bpf.c +1 −1
  298. net/ipv4/tcp_fastopen.c +24 −4
  299. net/ipv4/tcp_ipv4.c +1 −1
  300. net/ipv4/udp.c +19 −6
  301. net/ipv4/udp_bpf.c +1 −1
  302. net/ipv6/ip6_output.c +1 −1
  303. net/ipv6/route.c +1 −1
  304. net/ipv6/udp.c +19 −6
  305. net/netrom/nr_timer.c +11 −9
  306. net/sched/act_skbmod.c +8 −4
  307. net/sched/cls_api.c +1 −1
  308. net/sched/cls_tcindex.c +4 −1
  309. net/sctp/auth.c +2 −0
  310. net/sctp/output.c +2 −2
  311. net/sctp/socket.c +4 −0
  312. scripts/Makefile.build +1 −1
  313. scripts/setlocalversion +8 −5
  314. scripts/spdxcheck.py +1 −1
  315. sound/soc/mediatek/mt8183/mt8183-dai-adda.c +1 −0
  316. tools/arch/arm64/include/uapi/asm/unistd.h +1 −0
  317. tools/bpf/bpftool/common.c +5 −0
  318. tools/include/linux/kconfig.h +0 −6
  319. tools/include/uapi/asm-generic/unistd.h +6 −1
  320. tools/perf/arch/x86/entry/syscalls/syscall_64.tbl +1 −0
  321. tools/perf/builtin-inject.c +9 −4
  322. tools/perf/builtin-report.c +22 −11
  323. tools/perf/builtin-sched.c +30 −5
  324. tools/perf/builtin-script.c +8 −0
  325. tools/perf/builtin-stat.c +0 −3
  326. tools/perf/builtin-trace.c +43 −2
  327. tools/perf/tests/bpf.c +2 −0
  328. tools/perf/tests/event_update.c +4 −2
  329. tools/perf/tests/evsel-roundtrip-name.c +2 −1
  330. tools/perf/tests/maps.c +2 −0
  331. tools/perf/tests/parse-events.c +10 −6
  332. tools/perf/tests/perf-time-to-tsc.c +2 −1
  333. tools/perf/tests/topology.c +1 −0
  334. tools/perf/util/cs-etm.c +167 −1
  335. tools/perf/util/data.c +1 −1
  336. tools/perf/util/dso.c +3 −1
  337. tools/perf/util/dwarf-aux.c +4 −4
  338. tools/perf/util/dwarf-aux.h +1 −1
  339. tools/perf/util/env.c +2 −0
  340. tools/perf/util/lzma.c +5 −3
  341. tools/perf/util/map.c +2 −0
  342. tools/perf/util/pfm.c +1 −1
  343. tools/perf/util/pmu.c +8 −1
  344. tools/perf/util/probe-event.c +26 −27
  345. tools/perf/util/probe-event.h +2 −2
  346. tools/perf/util/probe-file.c +2 −2
  347. tools/perf/util/probe-finder.c +7 −8
  348. tools/perf/util/probe-finder.h +1 −1
  349. tools/perf/util/session.c +1 −0
  350. tools/perf/util/sort.c +1 −1
  351. tools/perf/util/sort.h +1 −1
  352. tools/perf/util/stat-display.c +13 −1
  353. tools/testing/kunit/kunit.py +2 −0
  354. tools/testing/kunit/kunit_kernel.py +2 −4
  355. tools/testing/kunit/kunit_parser.py +4 −2
  356. tools/testing/kunit/kunit_tool_test.py +13 −3
  357. tools/testing/kunit/test_data/test_is_test_passed-no_tests_run_no_header.log +0 −0
  358. tools/testing/kunit/test_data/test_is_test_passed-no_tests_run_with_header.log +2 −0
  359. tools/testing/selftests/kvm/include/kvm_util.h +2 −1
  360. tools/testing/selftests/kvm/lib/aarch64/processor.c +1 −1
  361. tools/testing/selftests/kvm/lib/guest_modes.c +16 −0
  362. tools/testing/selftests/kvm/lib/kvm_util.c +5 −0
  363. tools/testing/selftests/kvm/set_memory_region_test.c +2 −1
  364. tools/testing/selftests/kvm/x86_64/hyperv_features.c +1 −1
  365. tools/testing/selftests/kvm/x86_64/mmu_role_test.c +1 −1
  366. tools/testing/selftests/kvm/x86_64/smm_test.c +64 −6
  367. tools/testing/selftests/memory-hotplug/mem-on-off-test.sh +3 −1
  368. tools/testing/selftests/net/nettest.c +54 −1
  369. tools/testing/selftests/net/pmtu.sh +206 −6
  370. virt/kvm/coalesced_mmio.c +1 −1
  371. virt/kvm/kvm_main.c +1 −1
Documentation/dev-tools/kunit/running_tips.rst+1−13
@@ -86,19 +86,7 @@ Generating code coverage reports under UML · 85 unmodified lines
8686 .. note::
8787 TODO(brendanhiggins@google.com): There are various issues with UML and
8888 versions of gcc 7 and up. You're likely to run into missing ``.gcda``
89− files or compile errors. We know one `faulty GCC commit
90− <https://github.com/gcc-mirror/gcc/commit/8c9434c2f9358b8b8bad2c1990edf10a21645f9d>`_
91− but not how we'd go about getting this fixed. The compile errors still
92− need some investigation.
93−
94−.. note::
95− TODO(brendanhiggins@google.com): for recent versions of Linux
96− (5.10-5.12, maybe earlier), there's a bug with gcov counters not being
97− flushed in UML. This translates to very low (<1%) reported coverage. This is
98− related to the above issue and can be worked around by replacing the
99− one call to ``uml_abort()`` (it's in ``os_dump_core()``) with a plain
100− ``exit()``.
101−
89+ files or compile errors.
10290
10391 This is different from the "normal" way of getting coverage information that is
10492 documented in Documentation/dev-tools/gcov.rst.
Documentation/devicetree/bindings/clock/brcm,iproc-clocks.yaml+0−1
@@ -50,7 +50,6 @@ properties: · 49 unmodified lines
5050
5151 reg:
5252 minItems: 1
53− maxItems: 3
5453 items:
5554 - description: base register
5655 - description: power register
Documentation/devicetree/bindings/display/renesas,du.yaml+0−1
@@ -92,7 +92,6 @@ required: · 91 unmodified lines
9292 - reg
9393 - clocks
9494 - interrupts
95− - resets
9695 - ports
9796
9897 allOf:
Documentation/devicetree/bindings/hwmon/adt7475.yaml+11−11
@@ -39,17 +39,7 @@ properties: · 38 unmodified lines
3939 reg:
4040 maxItems: 1
4141
42−patternProperties:
43− "^adi,bypass-attenuator-in[0-4]$":
44− description: |
45− Configures bypassing the individual voltage input attenuator. If
46− set to 1 the attenuator is bypassed if set to 0 the attenuator is
47− not bypassed. If the property is absent then the attenuator
48− retains it's configuration from the bios/bootloader.
49− $ref: /schemas/types.yaml#/definitions/uint32
50− enum: [0, 1]
51−
52− "^adi,pwm-active-state$":
42+ adi,pwm-active-state:
5343 description: |
5444 Integer array, represents the active state of the pwm outputs If set to 0
5545 the pwm uses a logic low output for 100% duty cycle. If set to 1 the pwm
@@ -61,6 +51,16 @@ patternProperties: · 5 unmodified lines
6151 enum: [0, 1]
6252 default: 1
6353
54+patternProperties:
55+ "^adi,bypass-attenuator-in[0-4]$":
56+ description: |
57+ Configures bypassing the individual voltage input attenuator. If
58+ set to 1 the attenuator is bypassed if set to 0 the attenuator is
59+ not bypassed. If the property is absent then the attenuator
60+ retains it's configuration from the bios/bootloader.
61+ $ref: /schemas/types.yaml#/definitions/uint32
62+ enum: [0, 1]
63+
6464 required:
6565 - compatible
6666 - reg
Documentation/devicetree/bindings/iommu/arm,smmu.yaml+2−4
@@ -52,16 +52,14 @@ properties: · 51 unmodified lines
5252 items:
5353 - const: marvell,ap806-smmu-500
5454 - const: arm,mmu-500
55− - description: NVIDIA SoCs that program two ARM MMU-500s identically
56− items:
5755 - description: NVIDIA SoCs that require memory controller interaction
5856 and may program multiple ARM MMU-500s identically with the memory
5957 controller interleaving translations between multiple instances
6058 for improved performance.
6159 items:
6260 - enum:
63− - const: nvidia,tegra194-smmu
64− - const: nvidia,tegra186-smmu
61+ - nvidia,tegra194-smmu
62+ - nvidia,tegra186-smmu
6563 - const: nvidia,smmu-500
6664 - items:
6765 - const: arm,mmu-500
Documentation/devicetree/bindings/iommu/rockchip,iommu.yaml+0−2
@@ -28,14 +28,12 @@ properties: · 27 unmodified lines
2828 - description: configuration registers for MMU instance 0
2929 - description: configuration registers for MMU instance 1
3030 minItems: 1
31− maxItems: 2
3231
3332 interrupts:
3433 items:
3534 - description: interruption for MMU instance 0
3635 - description: interruption for MMU instance 1
3736 minItems: 1
38− maxItems: 2
3937
4038 clocks:
4139 items:
Documentation/devicetree/bindings/memory-controllers/arm,pl353-smc.yaml+0−1
@@ -57,7 +57,6 @@ properties: · 56 unmodified lines
5757
5858 ranges:
5959 minItems: 1
60− maxItems: 3
6160 description: |
6261 Memory bus areas for interacting with the devices. Reflects
6362 the memory layout with four integer values following:
Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml+0−8
@@ -84,7 +84,6 @@ properties: · 83 unmodified lines
8484
8585 interrupts:
8686 minItems: 1
87− maxItems: 3
8887 items:
8988 - description: NAND CTLRDY interrupt
9089 - description: FLASH_DMA_DONE if flash DMA is available
@@ -92,7 +91,6 @@ properties: · 1 unmodified line
9291
9392 interrupt-names:
9493 minItems: 1
95− maxItems: 3
9694 items:
9795 - const: nand_ctlrdy
9896 - const: flash_dma_done
@@ -148,8 +146,6 @@ allOf: · 49 unmodified lines
148146 then:
149147 properties:
150148 reg-names:
151− minItems: 2
152− maxItems: 2
153149 items:
154150 - const: nand
155151 - const: nand-int-base
@@ -161,8 +157,6 @@ allOf: · 5 unmodified lines
161157 then:
162158 properties:
163159 reg-names:
164− minItems: 3
165− maxItems: 3
166160 items:
167161 - const: nand
168162 - const: nand-int-base
@@ -175,8 +169,6 @@ allOf: · 6 unmodified lines
175169 then:
176170 properties:
177171 reg-names:
178− minItems: 3
179− maxItems: 3
180172 items:
181173 - const: nand
182174 - const: iproc-idm
Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml+2−2
@@ -67,8 +67,8 @@ properties: · 66 unmodified lines
6767 reg:
6868 oneOf:
6969 - enum:
70− - 0
71− - 1
70+ - 0
71+ - 1
7272
7373 required:
7474 - compatible
Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml+28−28
@@ -77,6 +77,34 @@ properties: · 76 unmodified lines
7777 Type-C spec states minimum CC pin debounce of 100 ms and maximum
7878 of 200 ms. However, some solutions might need more than 200 ms.
7979
80+ refclk-dig:
81+ type: object
82+ description: |
83+ WIZ node should have subnode for refclk_dig to select the reference
84+ clock source for the reference clock used in the PHY and PMA digital
85+ logic.
86+ properties:
87+ clocks:
88+ minItems: 2
89+ maxItems: 4
90+ description: Phandle to two (Torrent) or four (Sierra) clock nodes representing
91+ the inputs to refclk_dig
92+
93+ "#clock-cells":
94+ const: 0
95+
96+ assigned-clocks:
97+ maxItems: 1
98+
99+ assigned-clock-parents:
100+ maxItems: 1
101+
102+ required:
103+ - clocks
104+ - "#clock-cells"
105+ - assigned-clocks
106+ - assigned-clock-parents
107+
80108 patternProperties:
81109 "^pll[0|1]-refclk$":
82110 type: object
@@ -121,34 +149,6 @@ patternProperties: · 38 unmodified lines
121149 - clocks
122150 - "#clock-cells"
123151
124− "^refclk-dig$":
125− type: object
126− description: |
127− WIZ node should have subnode for refclk_dig to select the reference
128− clock source for the reference clock used in the PHY and PMA digital
129− logic.
130− properties:
131− clocks:
132− minItems: 2
133− maxItems: 4
134− description: Phandle to two (Torrent) or four (Sierra) clock nodes representing
135− the inputs to refclk_dig
136−
137− "#clock-cells":
138− const: 0
139−
140− assigned-clocks:
141− maxItems: 1
142−
143− assigned-clock-parents:
144− maxItems: 1
145−
146− required:
147− - clocks
148− - "#clock-cells"
149− - assigned-clocks
150− - assigned-clock-parents
151−
152152 "^serdes@[0-9a-f]+$":
153153 type: object
154154 description: |
Documentation/devicetree/bindings/regulator/fixed-regulator.yaml+2−0
@@ -57,12 +57,14 @@ properties: · 56 unmodified lines
5757 maxItems: 1
5858
5959 power-domains:
60+ deprecated: true
6061 description:
6162 Power domain to use for enable control. This binding is only
6263 available if the compatible is chosen to regulator-fixed-domain.
6364 maxItems: 1
6465
6566 required-opps:
67+ deprecated: true
6668 description:
6769 Performance state to use for enable control. This binding is only
6870 available if the compatible is chosen to regulator-fixed-domain. The
Documentation/devicetree/bindings/regulator/mps,mpq7920.yaml+3−3
@@ -36,12 +36,12 @@ properties: · 35 unmodified lines
3636 switching frequency must be one of following corresponding value
3737 1.1MHz, 1.65MHz, 2.2MHz, 2.75MHz
3838
39− patternProperties:
40− "^ldo[1-4]$":
39+ ldortc:
4140 type: object
4241 $ref: regulator.yaml#
4342
44− "^ldortc$":
43+ patternProperties:
44+ "^ldo[1-4]$":
4545 type: object
4646 $ref: regulator.yaml#
4747
Documentation/devicetree/bindings/regulator/nxp,pf8x00-regulator.yaml+2−1
@@ -83,7 +83,8 @@ properties: · 82 unmodified lines
8383
8484 unevaluatedProperties: false
8585
86− "^vsnvs$":
86+ properties:
87+ vsnvs:
8788 type: object
8889 $ref: regulator.yaml#
8990 description:
Documentation/devicetree/bindings/rtc/faraday,ftrtc010.yaml+0−1
@@ -30,7 +30,6 @@ properties: · 29 unmodified lines
3030 maxItems: 1
3131
3232 clocks:
33− minItems: 2
3433 items:
3534 - description: PCLK clocks
3635 - description: EXTCLK clocks. Faraday calls it CLK1HZ and says the clock
Documentation/devicetree/bindings/spi/spi-controller.yaml+16−16
@@ -79,22 +79,7 @@ properties: · 78 unmodified lines
7979 description:
8080 The SPI controller acts as a slave, instead of a master.
8181
82−allOf:
83− - if:
84− not:
85− required:
86− - spi-slave
87− then:
88− properties:
89− "#address-cells":
90− const: 1
91− else:
92− properties:
93− "#address-cells":
94− const: 0
95−
96−patternProperties:
97− "^slave$":
82+ slave:
9883 type: object
9984
10085 properties:
@@ -105,6 +90,7 @@ patternProperties: · 4 unmodified lines
10590 required:
10691 - compatible
10792
93+patternProperties:
10894 "^.*@[0-9a-f]+$":
10995 type: object
11096
@@ -180,6 +166,20 @@ patternProperties: · 69 unmodified lines
180166 - compatible
181167 - reg
182168
169+allOf:
170+ - if:
171+ not:
172+ required:
173+ - spi-slave
174+ then:
175+ properties:
176+ "#address-cells":
177+ const: 1
178+ else:
179+ properties:
180+ "#address-cells":
181+ const: 0
182+
183183 additionalProperties: true
184184
185185 examples:
Documentation/devicetree/bindings/usb/nxp,isp1760.yaml+0−2
@@ -25,14 +25,12 @@ properties: · 24 unmodified lines
2525
2626 interrupts:
2727 minItems: 1
28− maxItems: 2
2928 items:
3029 - description: Host controller interrupt
3130 - description: Device controller interrupt in isp1761
3231
3332 interrupt-names:
3433 minItems: 1
35− maxItems: 2
3634 items:
3735 - const: host
3836 - const: peripheral
Documentation/driver-api/early-userspace/early_userspace_support.rst+4−4
@@ -69,17 +69,17 @@ early userspace image can be built by an unprivileged user. · 68 unmodified lines
6969
7070 As a technical note, when directories and files are specified, the
7171 entire CONFIG_INITRAMFS_SOURCE is passed to
72−usr/gen_initramfs_list.sh. This means that CONFIG_INITRAMFS_SOURCE
72+usr/gen_initramfs.sh. This means that CONFIG_INITRAMFS_SOURCE
7373 can really be interpreted as any legal argument to
74−gen_initramfs_list.sh. If a directory is specified as an argument then
74+gen_initramfs.sh. If a directory is specified as an argument then
7575 the contents are scanned, uid/gid translation is performed, and
7676 usr/gen_init_cpio file directives are output. If a directory is
77−specified as an argument to usr/gen_initramfs_list.sh then the
77+specified as an argument to usr/gen_initramfs.sh then the
7878 contents of the file are simply copied to the output. All of the output
7979 directives from directory scanning and file contents copying are
8080 processed by usr/gen_init_cpio.
8181
82−See also 'usr/gen_initramfs_list.sh -h'.
82+See also 'usr/gen_initramfs.sh -h'.
8383
8484 Where's this all leading?
8585 =========================
Documentation/features/core/thread-info-in-task/arch-support.txt+32−0
@@ -0,0 +1,32 @@
1+#
2+# Feature name: thread-info-in-task
3+# Kconfig: THREAD_INFO_IN_TASK
4+# description: arch makes use of the core kernel facility to embedd thread_info in task_struct
5+#
6+ -----------------------
7+ | arch |status|
8+ -----------------------
9+ | alpha: | TODO |
10+ | arc: | TODO |
11+ | arm: | TODO |
12+ | arm64: | ok |
13+ | csky: | TODO |
14+ | h8300: | TODO |
15+ | hexagon: | TODO |
16+ | ia64: | TODO |
17+ | m68k: | TODO |
18+ | microblaze: | TODO |
19+ | mips: | TODO |
20+ | nds32: | ok |
21+ | nios2: | TODO |
22+ | openrisc: | TODO |
23+ | parisc: | TODO |
24+ | powerpc: | ok |
25+ | riscv: | ok |
26+ | s390: | ok |
27+ | sh: | TODO |
28+ | sparc: | TODO |
29+ | um: | TODO |
30+ | x86: | ok |
31+ | xtensa: | TODO |
32+ -----------------------
Documentation/features/time/arch-tick-broadcast/arch-support.txt+1−1
@@ -22,7 +22,7 @@ · 21 unmodified lines
2222 | openrisc: | TODO |
2323 | parisc: | TODO |
2424 | powerpc: | ok |
25− | riscv: | TODO |
25+ | riscv: | ok |
2626 | s390: | TODO |
2727 | sh: | ok |
2828 | sparc: | TODO |
Documentation/filesystems/ramfs-rootfs-initramfs.rst+1−1
@@ -170,7 +170,7 @@ Documentation/driver-api/early-userspace/early_userspace_support.rst for more de · 169 unmodified lines
170170 The kernel does not depend on external cpio tools. If you specify a
171171 directory instead of a configuration file, the kernel's build infrastructure
172172 creates a configuration file from that directory (usr/Makefile calls
173−usr/gen_initramfs_list.sh), and proceeds to package up that directory
173+usr/gen_initramfs.sh), and proceeds to package up that directory
174174 using the config file (by feeding it to usr/gen_init_cpio, which is created
175175 from usr/gen_init_cpio.c). The kernel's build-time cpio creation code is
176176 entirely self-contained, and the kernel's boot-time extractor is also
Documentation/networking/af_xdp.rst+3−3
@@ -243,8 +243,8 @@ Configuration Flags and Socket Options · 242 unmodified lines
243243 These are the various configuration flags that can be used to control
244244 and monitor the behavior of AF_XDP sockets.
245245
246−XDP_COPY and XDP_ZERO_COPY bind flags
247−-------------------------------------
246+XDP_COPY and XDP_ZEROCOPY bind flags
247+------------------------------------
248248
249249 When you bind to a socket, the kernel will first try to use zero-copy
250250 copy. If zero-copy is not supported, it will fall back on using copy
@@ -252,7 +252,7 @@ mode, i.e. copying all packets out to user space. But if you would · 1 unmodified line
252252 like to force a certain mode, you can use the following flags. If you
253253 pass the XDP_COPY flag to the bind call, the kernel will force the
254254 socket into copy mode. If it cannot use copy mode, the bind call will
255−fail with an error. Conversely, the XDP_ZERO_COPY flag will force the
255+fail with an error. Conversely, the XDP_ZEROCOPY flag will force the
256256 socket into zero-copy mode or fail.
257257
258258 XDP_SHARED_UMEM bind flag
Documentation/networking/ip-sysctl.rst+1−1
@@ -826,7 +826,7 @@ tcp_fastopen_blackhole_timeout_sec - INTEGER · 825 unmodified lines
826826 initial value when the blackhole issue goes away.
827827 0 to disable the blackhole detection.
828828
829− By default, it is set to 1hr.
829+ By default, it is set to 0 (feature is disabled).
830830
831831 tcp_fastopen_key - list of comma separated 32-digit hexadecimal INTEGERs
832832 The list consists of a primary key and an optional backup key. The
Documentation/translations/zh_CN/process/2.Process.rst+2−2
@@ -47,7 +47,7 @@ · 46 unmodified lines
4747 (顺便说一句,值得注意的是,合并窗口期间集成的更改并不是凭空产生的;它们是经
4848 提前收集、测试和分级的。稍后将详细描述该过程的工作方式。)
4949
50−合并窗口持续大约两周。在这段时间结束时,LinusTorvalds将声明窗口已关闭,并
50+合并窗口持续大约两周。在这段时间结束时,Linus Torvalds将声明窗口已关闭,并
5151 释放第一个“rc”内核。例如,对于目标为5.6的内核,在合并窗口结束时发生的释放
5252 将被称为5.6-rc1。-rc1 版本是一个信号,表示合并新特性的时间已经过去,稳定下一
5353 个内核的时间已经到来。
@@ -168,7 +168,7 @@ Greg Kroah-Hartman领导。稳定团队将使用5.x.y编号方案不定期地发 · 114 unmodified lines
168168 补丁如何进入内核
169169 ----------------
170170
171−只有一个人可以将补丁合并到主线内核存储库中:LinusTorvalds。但是,在进入
171+只有一个人可以将补丁合并到主线内核存储库中:Linus Torvalds。但是,在进入
172172 2.6.38内核的9500多个补丁中,只有112个(大约1.3%)是由Linus自己直接选择的。
173173 内核项目已经发展到一个没有一个开发人员可以在没有支持的情况下检查和选择每个
174174 补丁的规模。内核开发人员处理这种增长的方式是使用围绕信任链构建的助理系统。
LICENSES/dual/CC-BY-4.0+1−1
@@ -392,7 +392,7 @@ Section 8 -- Interpretation. · 391 unmodified lines
392392 Creative Commons is not a party to its public
393393 licenses. Notwithstanding, Creative Commons may elect to apply one of
394394 its public licenses to material it publishes and in those instances
395−will be considered the “Licensor.” The text of the Creative Commons
395+will be considered the "Licensor." The text of the Creative Commons
396396 public licenses is dedicated to the public domain under the CC0 Public
397397 Domain Dedication. Except for the limited purpose of indicating that
398398 material is shared under a Creative Commons public license or as
MAINTAINERS+2−0
@@ -933,6 +933,7 @@ F: drivers/video/fbdev/geode/ · 932 unmodified lines
933933
934934 AMD IOMMU (AMD-VI)
935935 M: Joerg Roedel <joro@8bytes.org>
936+R: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
936937 L: iommu@lists.linux-foundation.org
937938 S: Maintained
938939 T: git git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git
@@ -11764,6 +11765,7 @@ F: drivers/char/hw_random/mtk-rng.c · 10825 unmodified lines
1176411765 MEDIATEK SWITCH DRIVER
1176511766 M: Sean Wang <sean.wang@mediatek.com>
1176611767 M: Landen Chao <Landen.Chao@mediatek.com>
11768+M: DENG Qingfang <dqfext@gmail.com>
1176711769 L: netdev@vger.kernel.org
1176811770 S: Maintained
1176911771 F: drivers/net/dsa/mt7530.*
Makefile+7−6
@@ -2,7 +2,7 @@ · 1 unmodified line
22 VERSION = 5
33 PATCHLEVEL = 14
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc1
5+EXTRAVERSION = -rc2
66 NAME = Opossums on Parade
77
88 # *DOCUMENTATION*
@@ -728,11 +728,12 @@ $(KCONFIG_CONFIG): · 719 unmodified lines
728728 # This exploits the 'multi-target pattern rule' trick.
729729 # The syncconfig should be executed only once to make all the targets.
730730 # (Note: use the grouped target '&:' when we bump to GNU Make 4.3)
731−quiet_cmd_syncconfig = SYNC $@
732− cmd_syncconfig = $(MAKE) -f $(srctree)/Makefile syncconfig
733−
731+#
732+# Do not use $(call cmd,...) here. That would suppress prompts from syncconfig,
733+# so you cannot notice that Kconfig is waiting for the user input.
734734 %/config/auto.conf %/config/auto.conf.cmd %/generated/autoconf.h: $(KCONFIG_CONFIG)
735− +$(call cmd,syncconfig)
735+ $(Q)$(kecho) " SYNC $@"
736+ $(Q)$(MAKE) -f $(srctree)/Makefile syncconfig
736737 else # !may-sync-config
737738 # External modules and some install targets need include/generated/autoconf.h
738739 # and include/config/auto.conf but do not care if they are up-to-date.
@@ -802,7 +803,7 @@ else · 63 unmodified lines
802803 # Warn about unmarked fall-throughs in switch statement.
803804 # Disabled for clang while comment to attribute conversion happens and
804805 # https://github.com/ClangBuiltLinux/linux/issues/636 is discussed.
805−KBUILD_CFLAGS += $(call cc-option,-Wimplicit-fallthrough,)
806+KBUILD_CFLAGS += $(call cc-option,-Wimplicit-fallthrough=5,)
806807 endif
807808
808809 # These warnings generated too much noise in a regular build.
arch/arm/Kconfig+1−1
@@ -395,7 +395,7 @@ config ARCH_IXP4XX · 394 unmodified lines
395395 select IXP4XX_IRQ
396396 select IXP4XX_TIMER
397397 # With the new PCI driver this is not needed
398− select NEED_MACH_IO_H if PCI_IXP4XX_LEGACY
398+ select NEED_MACH_IO_H if IXP4XX_PCI_LEGACY
399399 select USB_EHCI_BIG_ENDIAN_DESC
400400 select USB_EHCI_BIG_ENDIAN_MMIO
401401 help
arch/arm/boot/dts/aspeed-bmc-asrock-e3c246d4i.dts+3−1
@@ -4,6 +4,7 @@ · 3 unmodified lines
44 #include "aspeed-g5.dtsi"
55 #include <dt-bindings/gpio/aspeed-gpio.h>
66 #include <dt-bindings/i2c/i2c.h>
7+#include <dt-bindings/interrupt-controller/irq.h>
78
89 /{
910 model = "ASRock E3C246D4I BMC";
@@ -73,7 +74,8 @@ · 63 unmodified lines
7374
7475 &vuart {
7576 status = "okay";
76− aspeed,sirq-active-high;
77+ aspeed,lpc-io-reg = <0x2f8>;
78+ aspeed,lpc-interrupts = <3 IRQ_TYPE_LEVEL_HIGH>;
7779 };
7880
7981 &mac0 {
arch/arm/boot/dts/aspeed-bmc-ibm-everest.dts+5−4
@@ -406,14 +406,14 @@ · 405 unmodified lines
406406 reg = <0x69>;
407407 };
408408
409− power-supply@6a {
409+ power-supply@6b {
410410 compatible = "ibm,cffps";
411− reg = <0x6a>;
411+ reg = <0x6b>;
412412 };
413413
414− power-supply@6b {
414+ power-supply@6d {
415415 compatible = "ibm,cffps";
416− reg = <0x6b>;
416+ reg = <0x6d>;
417417 };
418418 };
419419
@@ -2832,6 +2832,7 @@ · 2412 unmodified lines
28322832
28332833 &emmc {
28342834 status = "okay";
2835+ clk-phase-mmc-hs200 = <180>, <180>;
28352836 };
28362837
28372838 &fsim0 {
arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts+1−4
@@ -280,10 +280,7 @@ · 279 unmodified lines
280280 /*W0-W7*/ "","","","","","","","",
281281 /*X0-X7*/ "","","","","","","","",
282282 /*Y0-Y7*/ "","","","","","","","",
283− /*Z0-Z7*/ "","","","","","","","",
284− /*AA0-AA7*/ "","","","","","","","",
285− /*AB0-AB7*/ "","","","","","","","",
286− /*AC0-AC7*/ "","","","","","","","";
283+ /*Z0-Z7*/ "","","","","","","","";
287284
288285 pin_mclr_vpp {
289286 gpio-hog;
arch/arm/boot/dts/aspeed-bmc-opp-tacoma.dts+2−4
@@ -136,10 +136,7 @@ · 135 unmodified lines
136136 /*W0-W7*/ "","","","","","","","",
137137 /*X0-X7*/ "","","","","","","","",
138138 /*Y0-Y7*/ "","","","","","","","",
139− /*Z0-Z7*/ "","","","","","","","",
140− /*AA0-AA7*/ "","","","","","","","",
141− /*AB0-AB7*/ "","","","","","","","",
142− /*AC0-AC7*/ "","","","","","","","";
139+ /*Z0-Z7*/ "","","","","","","","";
143140 };
144141
145142 &fmc {
@@ -189,6 +186,7 @@ · 43 unmodified lines
189186
190187 &emmc {
191188 status = "okay";
189+ clk-phase-mmc-hs200 = <36>, <270>;
192190 };
193191
194192 &fsim0 {
arch/arm/boot/dts/versatile-ab.dts+2−3
@@ -195,16 +195,15 @@ · 194 unmodified lines
195195 #size-cells = <1>;
196196 ranges;
197197
198− vic: intc@10140000 {
198+ vic: interrupt-controller@10140000 {
199199 compatible = "arm,versatile-vic";
200200 interrupt-controller;
201201 #interrupt-cells = <1>;
202202 reg = <0x10140000 0x1000>;
203− clear-mask = <0xffffffff>;
204203 valid-mask = <0xffffffff>;
205204 };
206205
207− sic: intc@10003000 {
206+ sic: interrupt-controller@10003000 {
208207 compatible = "arm,versatile-sic";
209208 interrupt-controller;
210209 #interrupt-cells = <1>;
arch/arm/boot/dts/versatile-pb.dts+1−1
@@ -7,7 +7,7 @@ · 6 unmodified lines
77
88 amba {
99 /* The Versatile PB is using more SIC IRQ lines than the AB */
10− sic: intc@10003000 {
10+ sic: interrupt-controller@10003000 {
1111 clear-mask = <0xffffffff>;
1212 /*
1313 * Valid interrupt lines mask according to
arch/arm/configs/integrator_defconfig+1−4
@@ -57,10 +57,7 @@ CONFIG_DRM=y · 56 unmodified lines
5757 CONFIG_DRM_DISPLAY_CONNECTOR=y
5858 CONFIG_DRM_SIMPLE_BRIDGE=y
5959 CONFIG_DRM_PL111=y
60−CONFIG_FB_MODE_HELPERS=y
61−CONFIG_FB_MATROX=y
62−CONFIG_FB_MATROX_MILLENIUM=y
63−CONFIG_FB_MATROX_MYSTIQUE=y
60+CONFIG_FB=y
6461 CONFIG_BACKLIGHT_CLASS_DEVICE=y
6562 # CONFIG_VGA_CONSOLE is not set
6663 CONFIG_LOGO=y
arch/arm/configs/multi_v7_defconfig+1−1
@@ -821,7 +821,7 @@ CONFIG_USB_ISP1760=y · 820 unmodified lines
821821 CONFIG_USB_HSIC_USB3503=y
822822 CONFIG_AB8500_USB=y
823823 CONFIG_KEYSTONE_USB_PHY=m
824−CONFIG_NOP_USB_XCEIV=m
824+CONFIG_NOP_USB_XCEIV=y
825825 CONFIG_AM335X_PHY_USB=m
826826 CONFIG_TWL6030_USB=m
827827 CONFIG_USB_GPIO_VBUS=y
arch/arm/configs/realview_defconfig+1−3
@@ -64,11 +64,9 @@ CONFIG_DRM_PANEL_SIMPLE=y · 63 unmodified lines
6464 CONFIG_DRM_DISPLAY_CONNECTOR=y
6565 CONFIG_DRM_SIMPLE_BRIDGE=y
6666 CONFIG_DRM_PL111=y
67−CONFIG_FB_MODE_HELPERS=y
67+CONFIG_FB=y
6868 CONFIG_BACKLIGHT_CLASS_DEVICE=y
6969 CONFIG_LOGO=y
70−# CONFIG_LOGO_LINUX_MONO is not set
71−# CONFIG_LOGO_LINUX_VGA16 is not set
7270 CONFIG_SOUND=y
7371 CONFIG_SND=y
7472 # CONFIG_SND_DRIVERS is not set
arch/arm/configs/shmobile_defconfig+1−0
@@ -135,6 +135,7 @@ CONFIG_DRM_SII902X=y · 134 unmodified lines
135135 CONFIG_DRM_SIMPLE_BRIDGE=y
136136 CONFIG_DRM_I2C_ADV7511=y
137137 CONFIG_DRM_I2C_ADV7511_AUDIO=y
138+CONFIG_FB=y
138139 CONFIG_FB_SH_MOBILE_LCDC=y
139140 CONFIG_BACKLIGHT_PWM=y
140141 CONFIG_BACKLIGHT_AS3711=y
arch/arm/configs/u8500_defconfig+5−0
@@ -61,6 +61,10 @@ CONFIG_INPUT_TOUCHSCREEN=y · 60 unmodified lines
6161 CONFIG_TOUCHSCREEN_ATMEL_MXT=y
6262 CONFIG_TOUCHSCREEN_BU21013=y
6363 CONFIG_TOUCHSCREEN_CY8CTMA140=y
64+CONFIG_TOUCHSCREEN_CYTTSP_CORE=y
65+CONFIG_TOUCHSCREEN_CYTTSP_SPI=y
66+CONFIG_TOUCHSCREEN_MMS114=y
67+CONFIG_TOUCHSCREEN_ZINITIX=y
6468 CONFIG_INPUT_MISC=y
6569 CONFIG_INPUT_AB8500_PONKEY=y
6670 CONFIG_INPUT_GPIO_VIBRA=y
@@ -100,6 +104,7 @@ CONFIG_DRM_PANEL_SAMSUNG_S6E63M0_DSI=y · 33 unmodified lines
100104 CONFIG_DRM_PANEL_SONY_ACX424AKP=y
101105 CONFIG_DRM_LIMA=y
102106 CONFIG_DRM_MCDE=y
107+CONFIG_FB=y
103108 CONFIG_BACKLIGHT_CLASS_DEVICE=y
104109 CONFIG_BACKLIGHT_KTD253=y
105110 CONFIG_BACKLIGHT_GPIO=y
arch/arm/configs/versatile_defconfig+1−3
@@ -60,7 +60,7 @@ CONFIG_DRM_PANEL_SIMPLE=y · 59 unmodified lines
6060 CONFIG_DRM_DISPLAY_CONNECTOR=y
6161 CONFIG_DRM_SIMPLE_BRIDGE=y
6262 CONFIG_DRM_PL111=y
63−CONFIG_FB_MODE_HELPERS=y
63+CONFIG_FB=y
6464 CONFIG_BACKLIGHT_CLASS_DEVICE=y
6565 CONFIG_LOGO=y
6666 CONFIG_SOUND=y
@@ -88,8 +88,6 @@ CONFIG_NFSD=y · 21 unmodified lines
8888 CONFIG_NFSD_V3=y
8989 CONFIG_NLS_CODEPAGE_850=m
9090 CONFIG_NLS_ISO8859_1=m
91−CONFIG_FONTS=y
92−CONFIG_FONT_ACORN_8x8=y
9391 CONFIG_MAGIC_SYSRQ=y
9492 CONFIG_DEBUG_FS=y
9593 CONFIG_DEBUG_KERNEL=y
arch/arm/configs/vexpress_defconfig+7−10
@@ -11,9 +11,6 @@ CONFIG_CPUSETS=y · 10 unmodified lines
1111 # CONFIG_NET_NS is not set
1212 CONFIG_BLK_DEV_INITRD=y
1313 CONFIG_PROFILING=y
14−CONFIG_MODULES=y
15−CONFIG_MODULE_UNLOAD=y
16−# CONFIG_BLK_DEV_BSG is not set
1714 CONFIG_ARCH_VEXPRESS=y
1815 CONFIG_ARCH_VEXPRESS_DCSCB=y
1916 CONFIG_ARCH_VEXPRESS_TC2_PM=y
@@ -23,14 +20,17 @@ CONFIG_MCPM=y · 3 unmodified lines
2320 CONFIG_VMSPLIT_2G=y
2421 CONFIG_NR_CPUS=8
2522 CONFIG_ARM_PSCI=y
26−CONFIG_CMA=y
2723 CONFIG_ZBOOT_ROM_TEXT=0x0
2824 CONFIG_ZBOOT_ROM_BSS=0x0
2925 CONFIG_CMDLINE="console=ttyAMA0"
3026 CONFIG_CPU_IDLE=y
3127 CONFIG_VFP=y
3228 CONFIG_NEON=y
29+CONFIG_MODULES=y
30+CONFIG_MODULE_UNLOAD=y
31+# CONFIG_BLK_DEV_BSG is not set
3332 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
33+CONFIG_CMA=y
3434 CONFIG_NET=y
3535 CONFIG_PACKET=y
3636 CONFIG_UNIX=y
@@ -43,7 +43,6 @@ CONFIG_IP_PNP_BOOTP=y · 6 unmodified lines
4343 CONFIG_NET_9P=y
4444 CONFIG_NET_9P_VIRTIO=y
4545 CONFIG_DEVTMPFS=y
46−CONFIG_DMA_CMA=y
4746 CONFIG_MTD=y
4847 CONFIG_MTD_CMDLINE_PARTS=y
4948 CONFIG_MTD_BLOCK=y
@@ -59,7 +58,6 @@ CONFIG_VIRTIO_BLK=y · 9 unmodified lines
5958 CONFIG_BLK_DEV_SD=y
6059 CONFIG_SCSI_VIRTIO=y
6160 CONFIG_ATA=y
62−# CONFIG_SATA_PMP is not set
6361 CONFIG_NETDEVICES=y
6462 CONFIG_VIRTIO_NET=y
6563 CONFIG_SMC91X=y
@@ -81,11 +79,9 @@ CONFIG_DRM=y · 15 unmodified lines
8179 CONFIG_DRM_PANEL_SIMPLE=y
8280 CONFIG_DRM_SII902X=y
8381 CONFIG_DRM_PL111=y
84−CONFIG_FB_MODE_HELPERS=y
82+CONFIG_FB=y
8583 CONFIG_BACKLIGHT_CLASS_DEVICE=y
8684 CONFIG_LOGO=y
87−# CONFIG_LOGO_LINUX_MONO is not set
88−# CONFIG_LOGO_LINUX_VGA16 is not set
8985 CONFIG_SOUND=y
9086 CONFIG_SND=y
9187 # CONFIG_SND_DRIVERS is not set
@@ -136,10 +132,11 @@ CONFIG_ROOT_NFS=y · 44 unmodified lines
136132 CONFIG_9P_FS=y
137133 CONFIG_NLS_CODEPAGE_437=y
138134 CONFIG_NLS_ISO8859_1=y
135+# CONFIG_CRYPTO_HW is not set
136+CONFIG_DMA_CMA=y
139137 CONFIG_DEBUG_INFO=y
140138 CONFIG_MAGIC_SYSRQ=y
141139 CONFIG_DEBUG_KERNEL=y
142140 CONFIG_DETECT_HUNG_TASK=y
143141 # CONFIG_SCHED_DEBUG is not set
144142 CONFIG_DEBUG_USER=y
145−# CONFIG_CRYPTO_HW is not set
arch/arm64/Kconfig+2−1
@@ -1605,7 +1605,8 @@ config ARM64_BTI_KERNEL · 1604 unmodified lines
16051605 depends on CC_HAS_BRANCH_PROT_PAC_RET_BTI
16061606 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94697
16071607 depends on !CC_IS_GCC || GCC_VERSION >= 100100
1608− depends on !(CC_IS_CLANG && GCOV_KERNEL)
1608+ # https://github.com/llvm/llvm-project/commit/a88c722e687e6780dcd6a58718350dc76fcc4cc9
1609+ depends on !CC_IS_CLANG || CLANG_VERSION >= 120000
16091610 depends on (!FUNCTION_GRAPH_TRACER || DYNAMIC_FTRACE_WITH_REGS)
16101611 help
16111612 Build the kernel with Branch Target Identification annotations
arch/arm64/boot/dts/nvidia/tegra194.dtsi+13−0
@@ -948,6 +948,10 @@ · 947 unmodified lines
948948 <&bpmp TEGRA194_CLK_XUSB_SS>,
949949 <&bpmp TEGRA194_CLK_XUSB_FS>;
950950 clock-names = "dev", "ss", "ss_src", "fs_src";
951+ interconnects = <&mc TEGRA194_MEMORY_CLIENT_XUSB_DEVR &emc>,
952+ <&mc TEGRA194_MEMORY_CLIENT_XUSB_DEVW &emc>;
953+ interconnect-names = "dma-mem", "write";
954+ iommus = <&smmu TEGRA194_SID_XUSB_DEV>;
951955 power-domains = <&bpmp TEGRA194_POWER_DOMAIN_XUSBB>,
952956 <&bpmp TEGRA194_POWER_DOMAIN_XUSBA>;
953957 power-domain-names = "dev", "ss";
@@ -977,6 +981,10 @@ · 23 unmodified lines
977981 "xusb_ss", "xusb_ss_src", "xusb_hs_src",
978982 "xusb_fs_src", "pll_u_480m", "clk_m",
979983 "pll_e";
984+ interconnects = <&mc TEGRA194_MEMORY_CLIENT_XUSB_HOSTR &emc>,
985+ <&mc TEGRA194_MEMORY_CLIENT_XUSB_HOSTW &emc>;
986+ interconnect-names = "dma-mem", "write";
987+ iommus = <&smmu TEGRA194_SID_XUSB_HOST>;
980988
981989 power-domains = <&bpmp TEGRA194_POWER_DOMAIN_XUSBC>,
982990 <&bpmp TEGRA194_POWER_DOMAIN_XUSBA>;
@@ -2469,6 +2477,11 @@ · 1486 unmodified lines
24692477 * for 8x and 11.025x sample rate streams.
24702478 */
24712479 assigned-clock-rates = <258000000>;
2480+
2481+ interconnects = <&mc TEGRA194_MEMORY_CLIENT_APEDMAR &emc>,
2482+ <&mc TEGRA194_MEMORY_CLIENT_APEDMAW &emc>;
2483+ interconnect-names = "dma-mem", "write";
2484+ iommus = <&smmu TEGRA194_SID_APE>;
24722485 };
24732486
24742487 tcu: tcu {
arch/arm64/boot/dts/renesas/r9a07g044.dtsi+2−2
@@ -82,10 +82,10 @@ · 81 unmodified lines
8282 <GIC_SPI 384 IRQ_TYPE_LEVEL_HIGH>;
8383 interrupt-names = "eri", "rxi", "txi",
8484 "bri", "dri", "tei";
85− clocks = <&cpg CPG_MOD R9A07G044_CLK_SCIF0>;
85+ clocks = <&cpg CPG_MOD R9A07G044_SCIF0_CLK_PCK>;
8686 clock-names = "fck";
8787 power-domains = <&cpg>;
88− resets = <&cpg R9A07G044_CLK_SCIF0>;
88+ resets = <&cpg R9A07G044_SCIF0_RST_SYSTEM_N>;
8989 status = "disabled";
9090 };
9191
arch/arm64/include/asm/cache.h+1−1
@@ -47,7 +47,7 @@ · 46 unmodified lines
4747 * cache before the transfer is done, causing old data to be seen by
4848 * the CPU.
4949 */
50−#define ARCH_DMA_MINALIGN L1_CACHE_BYTES
50+#define ARCH_DMA_MINALIGN (128)
5151
5252 #ifdef CONFIG_KASAN_SW_TAGS
5353 #define ARCH_SLAB_MINALIGN (1ULL << KASAN_SHADOW_SCALE_SHIFT)
arch/arm64/include/asm/smp_plat.h+1−0
@@ -10,6 +10,7 @@ · 9 unmodified lines
1010
1111 #include <linux/cpumask.h>
1212
13+#include <asm/smp.h>
1314 #include <asm/types.h>
1415
1516 struct mpidr_hash {
arch/arm64/kernel/Makefile+1−1
@@ -17,7 +17,7 @@ CFLAGS_syscall.o += -fno-stack-protector · 16 unmodified lines
1717 # It's not safe to invoke KCOV when portions of the kernel environment aren't
1818 # available or are out-of-sync with HW state. Since `noinstr` doesn't always
1919 # inhibit KCOV instrumentation, disable it for the entire compilation unit.
20−KCOV_INSTRUMENT_entry.o := n
20+KCOV_INSTRUMENT_entry-common.o := n
2121 KCOV_INSTRUMENT_idle.o := n
2222
2323 # Object file lists.
arch/arm64/kernel/cpufeature.c+1−0
@@ -81,6 +81,7 @@ · 80 unmodified lines
8181 #include <asm/mmu_context.h>
8282 #include <asm/mte.h>
8383 #include <asm/processor.h>
84+#include <asm/smp.h>
8485 #include <asm/sysreg.h>
8586 #include <asm/traps.h>
8687 #include <asm/virt.h>
arch/arm64/kernel/entry-common.c+1−1
@@ -604,7 +604,7 @@ asmlinkage void noinstr el0t_64_fiq_handler(struct pt_regs *regs) · 603 unmodified lines
604604 __el0_fiq_handler_common(regs);
605605 }
606606
607−static void __el0_error_handler_common(struct pt_regs *regs)
607+static void noinstr __el0_error_handler_common(struct pt_regs *regs)
608608 {
609609 unsigned long esr = read_sysreg(esr_el1);
610610
arch/arm64/kernel/mte.c+2−13
@@ -193,18 +193,6 @@ void mte_check_tfsr_el1(void) · 192 unmodified lines
193193 }
194194 #endif
195195
196−static void update_gcr_el1_excl(u64 excl)
197−{
198−
199− /*
200− * Note that the mask controlled by the user via prctl() is an
201− * include while GCR_EL1 accepts an exclude mask.
202− * No need for ISB since this only affects EL0 currently, implicit
203− * with ERET.
204− */
205− sysreg_clear_set_s(SYS_GCR_EL1, SYS_GCR_EL1_EXCL_MASK, excl);
206−}
207−
208196 static void set_gcr_el1_excl(u64 excl)
209197 {
210198 current->thread.gcr_user_excl = excl;
@@ -265,7 +253,8 @@ void mte_suspend_exit(void) · 54 unmodified lines
265253 if (!system_supports_mte())
266254 return;
267255
268− update_gcr_el1_excl(gcr_kernel_excl);
256+ sysreg_clear_set_s(SYS_GCR_EL1, SYS_GCR_EL1_EXCL_MASK, gcr_kernel_excl);
257+ isb();
269258 }
270259
271260 long set_mte_ctrl(struct task_struct *task, unsigned long arg)
arch/arm64/kernel/smccc-call.S+6−3
@@ -32,20 +32,23 @@ SYM_FUNC_END(__arm_smccc_sve_check) · 31 unmodified lines
3232 EXPORT_SYMBOL(__arm_smccc_sve_check)
3333
3434 .macro SMCCC instr
35+ stp x29, x30, [sp, #-16]!
36+ mov x29, sp
3537 alternative_if ARM64_SVE
3638 bl __arm_smccc_sve_check
3739 alternative_else_nop_endif
3840 \instr #0
39− ldr x4, [sp]
41+ ldr x4, [sp, #16]
4042 stp x0, x1, [x4, #ARM_SMCCC_RES_X0_OFFS]
4143 stp x2, x3, [x4, #ARM_SMCCC_RES_X2_OFFS]
42− ldr x4, [sp, #8]
44+ ldr x4, [sp, #24]
4345 cbz x4, 1f /* no quirk structure */
4446 ldr x9, [x4, #ARM_SMCCC_QUIRK_ID_OFFS]
4547 cmp x9, #ARM_SMCCC_QUIRK_QCOM_A6
4648 b.ne 1f
4749 str x6, [x4, ARM_SMCCC_QUIRK_STATE_OFFS]
48−1: ret
50+1: ldp x29, x30, [sp], #16
51+ ret
4952 .endm
5053
5154 /*
arch/arm64/lib/copy_from_user.S+10−3
@@ -29,7 +29,7 @@ · 28 unmodified lines
2929 .endm
3030
3131 .macro ldrh1 reg, ptr, val
32− user_ldst 9998f, ldtrh, \reg, \ptr, \val
32+ user_ldst 9997f, ldtrh, \reg, \ptr, \val
3333 .endm
3434
3535 .macro strh1 reg, ptr, val
@@ -37,7 +37,7 @@ · 1 unmodified line
3737 .endm
3838
3939 .macro ldr1 reg, ptr, val
40− user_ldst 9998f, ldtr, \reg, \ptr, \val
40+ user_ldst 9997f, ldtr, \reg, \ptr, \val
4141 .endm
4242
4343 .macro str1 reg, ptr, val
@@ -45,7 +45,7 @@ · 1 unmodified line
4545 .endm
4646
4747 .macro ldp1 reg1, reg2, ptr, val
48− user_ldp 9998f, \reg1, \reg2, \ptr, \val
48+ user_ldp 9997f, \reg1, \reg2, \ptr, \val
4949 .endm
5050
5151 .macro stp1 reg1, reg2, ptr, val
@@ -53,8 +53,10 @@ · 1 unmodified line
5353 .endm
5454
5555 end .req x5
56+srcin .req x15
5657 SYM_FUNC_START(__arch_copy_from_user)
5758 add end, x0, x2
59+ mov srcin, x1
5860 #include "copy_template.S"
5961 mov x0, #0 // Nothing to copy
6062 ret
@@ -63,6 +65,11 @@ EXPORT_SYMBOL(__arch_copy_from_user) · 2 unmodified lines
6365
6466 .section .fixup,"ax"
6567 .align 2
68+9997: cmp dst, dstin
69+ b.ne 9998f
70+ // Before being absolutely sure we couldn't copy anything, try harder
71+USER(9998f, ldtrb tmp1w, [srcin])
72+ strb tmp1w, [dst], #1
6673 9998: sub x0, end, dst // bytes not copied
6774 ret
6875 .previous
arch/arm64/lib/copy_in_user.S+14−7
@@ -30,33 +30,34 @@ · 29 unmodified lines
3030 .endm
3131
3232 .macro ldrh1 reg, ptr, val
33− user_ldst 9998f, ldtrh, \reg, \ptr, \val
33+ user_ldst 9997f, ldtrh, \reg, \ptr, \val
3434 .endm
3535
3636 .macro strh1 reg, ptr, val
37− user_ldst 9998f, sttrh, \reg, \ptr, \val
37+ user_ldst 9997f, sttrh, \reg, \ptr, \val
3838 .endm
3939
4040 .macro ldr1 reg, ptr, val
41− user_ldst 9998f, ldtr, \reg, \ptr, \val
41+ user_ldst 9997f, ldtr, \reg, \ptr, \val
4242 .endm
4343
4444 .macro str1 reg, ptr, val
45− user_ldst 9998f, sttr, \reg, \ptr, \val
45+ user_ldst 9997f, sttr, \reg, \ptr, \val
4646 .endm
4747
4848 .macro ldp1 reg1, reg2, ptr, val
49− user_ldp 9998f, \reg1, \reg2, \ptr, \val
49+ user_ldp 9997f, \reg1, \reg2, \ptr, \val
5050 .endm
5151
5252 .macro stp1 reg1, reg2, ptr, val
53− user_stp 9998f, \reg1, \reg2, \ptr, \val
53+ user_stp 9997f, \reg1, \reg2, \ptr, \val
5454 .endm
5555
5656 end .req x5
57−
57+srcin .req x15
5858 SYM_FUNC_START(__arch_copy_in_user)
5959 add end, x0, x2
60+ mov srcin, x1
6061 #include "copy_template.S"
6162 mov x0, #0
6263 ret
@@ -65,6 +66,12 @@ EXPORT_SYMBOL(__arch_copy_in_user) · 2 unmodified lines
6566
6667 .section .fixup,"ax"
6768 .align 2
69+9997: cmp dst, dstin
70+ b.ne 9998f
71+ // Before being absolutely sure we couldn't copy anything, try harder
72+USER(9998f, ldtrb tmp1w, [srcin])
73+USER(9998f, sttrb tmp1w, [dst])
74+ add dst, dst, #1
6875 9998: sub x0, end, dst // bytes not copied
6976 ret
7077 .previous
arch/arm64/lib/copy_to_user.S+11−3
@@ -32,7 +32,7 @@ · 31 unmodified lines
3232 .endm
3333
3434 .macro strh1 reg, ptr, val
35− user_ldst 9998f, sttrh, \reg, \ptr, \val
35+ user_ldst 9997f, sttrh, \reg, \ptr, \val
3636 .endm
3737
3838 .macro ldr1 reg, ptr, val
@@ -40,7 +40,7 @@ · 1 unmodified line
4040 .endm
4141
4242 .macro str1 reg, ptr, val
43− user_ldst 9998f, sttr, \reg, \ptr, \val
43+ user_ldst 9997f, sttr, \reg, \ptr, \val
4444 .endm
4545
4646 .macro ldp1 reg1, reg2, ptr, val
@@ -48,12 +48,14 @@ · 1 unmodified line
4848 .endm
4949
5050 .macro stp1 reg1, reg2, ptr, val
51− user_stp 9998f, \reg1, \reg2, \ptr, \val
51+ user_stp 9997f, \reg1, \reg2, \ptr, \val
5252 .endm
5353
5454 end .req x5
55+srcin .req x15
5556 SYM_FUNC_START(__arch_copy_to_user)
5657 add end, x0, x2
58+ mov srcin, x1
5759 #include "copy_template.S"
5860 mov x0, #0
5961 ret
@@ -62,6 +64,12 @@ EXPORT_SYMBOL(__arch_copy_to_user) · 2 unmodified lines
6264
6365 .section .fixup,"ax"
6466 .align 2
67+9997: cmp dst, dstin
68+ b.ne 9998f
69+ // Before being absolutely sure we couldn't copy anything, try harder
70+ ldrb tmp1w, [srcin]
71+USER(9998f, sttrb tmp1w, [dst])
72+ add dst, dst, #1
6573 9998: sub x0, end, dst // bytes not copied
6674 ret
6775 .previous
arch/arm64/lib/strlen.S+10−0
@@ -8,6 +8,7 @@ · 7 unmodified lines
88
99 #include <linux/linkage.h>
1010 #include <asm/assembler.h>
11+#include <asm/mte-def.h>
1112
1213 /* Assumptions:
1314 *
@@ -42,7 +43,16 @@ · 28 unmodified lines
4243 #define REP8_7f 0x7f7f7f7f7f7f7f7f
4344 #define REP8_80 0x8080808080808080
4445
46+/*
47+ * When KASAN_HW_TAGS is in use, memory is checked at MTE_GRANULE_SIZE
48+ * (16-byte) granularity, and we must ensure that no access straddles this
49+ * alignment boundary.
50+ */
51+#ifdef CONFIG_KASAN_HW_TAGS
52+#define MIN_PAGE_SIZE MTE_GRANULE_SIZE
53+#else
4554 #define MIN_PAGE_SIZE 4096
55+#endif
4656
4757 /* Since strings are short on average, we check the first 16 bytes
4858 of the string for a NUL character. In order to do an unaligned ldp
arch/arm64/mm/mmu.c+8−12
@@ -1339,7 +1339,6 @@ void *__init fixmap_remap_fdt(phys_addr_t dt_phys, int *size, pgprot_t prot) · 1338 unmodified lines
13391339 return dt_virt;
13401340 }
13411341
1342−#if CONFIG_PGTABLE_LEVELS > 3
13431342 int pud_set_huge(pud_t *pudp, phys_addr_t phys, pgprot_t prot)
13441343 {
13451344 pud_t new_pud = pfn_pud(__phys_to_pfn(phys), mk_pud_sect_prot(prot));
@@ -1354,16 +1353,6 @@ int pud_set_huge(pud_t *pudp, phys_addr_t phys, pgprot_t prot) · 8 unmodified lines
13541353 return 1;
13551354 }
13561355
1357−int pud_clear_huge(pud_t *pudp)
1358−{
1359− if (!pud_sect(READ_ONCE(*pudp)))
1360− return 0;
1361− pud_clear(pudp);
1362− return 1;
1363−}
1364−#endif
1365−
1366−#if CONFIG_PGTABLE_LEVELS > 2
13671356 int pmd_set_huge(pmd_t *pmdp, phys_addr_t phys, pgprot_t prot)
13681357 {
13691358 pmd_t new_pmd = pfn_pmd(__phys_to_pfn(phys), mk_pmd_sect_prot(prot));
@@ -1378,6 +1367,14 @@ int pmd_set_huge(pmd_t *pmdp, phys_addr_t phys, pgprot_t prot) · 8 unmodified lines
13781367 return 1;
13791368 }
13801369
1370+int pud_clear_huge(pud_t *pudp)
1371+{
1372+ if (!pud_sect(READ_ONCE(*pudp)))
1373+ return 0;
1374+ pud_clear(pudp);
1375+ return 1;
1376+}
1377+
13811378 int pmd_clear_huge(pmd_t *pmdp)
13821379 {
13831380 if (!pmd_sect(READ_ONCE(*pmdp)))
@@ -1385,7 +1382,6 @@ int pmd_clear_huge(pmd_t *pmdp) · 1 unmodified line
13851382 pmd_clear(pmdp);
13861383 return 1;
13871384 }
1388−#endif
13891385
13901386 int pmd_free_pte_page(pmd_t *pmdp, unsigned long addr)
13911387 {
arch/mips/include/asm/fpu.h+1−1
@@ -76,7 +76,7 @@ static inline int __enable_fpu(enum fpu_mode mode) · 75 unmodified lines
7676 /* we only have a 32-bit FPU */
7777 return SIGFPE;
7878 #endif
79− fallthrough;
79+ /* fallthrough */
8080 case FPU_32BIT:
8181 if (cpu_has_fre) {
8282 /* clear FRE */
arch/mips/mm/tlbex.c+2−0
@@ -1383,6 +1383,7 @@ static void build_r4000_tlb_refill_handler(void) · 1382 unmodified lines
13831383 switch (boot_cpu_type()) {
13841384 default:
13851385 if (sizeof(long) == 4) {
1386+ fallthrough;
13861387 case CPU_LOONGSON2EF:
13871388 /* Loongson2 ebase is different than r4k, we have more space */
13881389 if ((p - tlb_handler) > 64)
@@ -2169,6 +2170,7 @@ static void build_r4000_tlb_load_handler(void) · 780 unmodified lines
21692170 default:
21702171 if (cpu_has_mips_r2_exec_hazard) {
21712172 uasm_i_ehb(&p);
2173+ fallthrough;
21722174
21732175 case CPU_CAVIUM_OCTEON:
21742176 case CPU_CAVIUM_OCTEON_PLUS:
arch/powerpc/mm/nohash/8xx.c+10−0
@@ -240,3 +240,13 @@ void __init setup_kuap(bool disabled) · 239 unmodified lines
240240 mtspr(SPRN_MD_AP, MD_APG_KUAP);
241241 }
242242 #endif
243+
244+int pud_clear_huge(pud_t *pud)
245+{
246+ return 0;
247+}
248+
249+int pmd_clear_huge(pmd_t *pmd)
250+{
251+ return 0;
252+}
arch/powerpc/platforms/powermac/smp.c+1−0
@@ -146,6 +146,7 @@ static inline void psurge_clr_ipi(int cpu) · 145 unmodified lines
146146 switch(psurge_type) {
147147 case PSURGE_DUAL:
148148 out_8(psurge_sec_intr, ~0);
149+ break;
149150 case PSURGE_NONE:
150151 break;
151152 default:
arch/s390/boot/text_dma.S+4−15
@@ -9,16 +9,6 @@ · 8 unmodified lines
99 #include <asm/errno.h>
1010 #include <asm/sigp.h>
1111
12−#ifdef CC_USING_EXPOLINE
13− .pushsection .dma.text.__s390_indirect_jump_r14,"axG"
14−__dma__s390_indirect_jump_r14:
15− larl %r1,0f
16− ex 0,0(%r1)
17− j .
18−0: br %r14
19− .popsection
20−#endif
21−
2212 .section .dma.text,"ax"
2313 /*
2414 * Simplified version of expoline thunk. The normal thunks can not be used here,
@@ -27,11 +17,10 @@ __dma__s390_indirect_jump_r14: · 2 unmodified lines
2717 * affects a few functions that are not performance-relevant.
2818 */
2919 .macro BR_EX_DMA_r14
30−#ifdef CC_USING_EXPOLINE
31− jg __dma__s390_indirect_jump_r14
32−#else
33− br %r14
34−#endif
20+ larl %r1,0f
21+ ex 0,0(%r1)
22+ j .
23+0: br %r14
3524 .endm
3625
3726 /*
arch/s390/configs/debug_defconfig+18−9
@@ -5,7 +5,12 @@ CONFIG_WATCH_QUEUE=y · 4 unmodified lines
55 CONFIG_AUDIT=y
66 CONFIG_NO_HZ_IDLE=y
77 CONFIG_HIGH_RES_TIMERS=y
8+CONFIG_BPF_SYSCALL=y
9+CONFIG_BPF_JIT=y
10+CONFIG_BPF_JIT_ALWAYS_ON=y
11+CONFIG_BPF_LSM=y
812 CONFIG_PREEMPT=y
13+CONFIG_SCHED_CORE=y
914 CONFIG_BSD_PROCESS_ACCT=y
1015 CONFIG_BSD_PROCESS_ACCT_V3=y
1116 CONFIG_TASKSTATS=y
@@ -28,14 +33,13 @@ CONFIG_CGROUP_DEVICE=y · 16 unmodified lines
2833 CONFIG_CGROUP_CPUACCT=y
2934 CONFIG_CGROUP_PERF=y
3035 CONFIG_CGROUP_BPF=y
36+CONFIG_CGROUP_MISC=y
3137 CONFIG_NAMESPACES=y
3238 CONFIG_USER_NS=y
3339 CONFIG_CHECKPOINT_RESTORE=y
3440 CONFIG_SCHED_AUTOGROUP=y
3541 CONFIG_EXPERT=y
3642 # CONFIG_SYSFS_SYSCALL is not set
37−CONFIG_BPF_LSM=y
38−CONFIG_BPF_SYSCALL=y
3943 CONFIG_USERFAULTFD=y
4044 # CONFIG_COMPAT_BRK is not set
4145 CONFIG_PROFILING=y
@@ -76,6 +80,7 @@ CONFIG_BLK_DEV_THROTTLING=y · 34 unmodified lines
7680 CONFIG_BLK_WBT=y
7781 CONFIG_BLK_CGROUP_IOLATENCY=y
7882 CONFIG_BLK_CGROUP_IOCOST=y
83+CONFIG_BLK_CGROUP_IOPRIO=y
7984 CONFIG_BLK_INLINE_ENCRYPTION=y
8085 CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK=y
8186 CONFIG_PARTITION_ADVANCED=y
@@ -95,6 +100,7 @@ CONFIG_CLEANCACHE=y · 13 unmodified lines
95100 CONFIG_FRONTSWAP=y
96101 CONFIG_CMA_DEBUG=y
97102 CONFIG_CMA_DEBUGFS=y
103+CONFIG_CMA_SYSFS=y
98104 CONFIG_CMA_AREAS=7
99105 CONFIG_MEM_SOFT_DIRTY=y
100106 CONFIG_ZSWAP=y
@@ -158,6 +164,7 @@ CONFIG_IPV6_RPL_LWTUNNEL=y · 57 unmodified lines
158164 CONFIG_MPTCP=y
159165 CONFIG_NETFILTER=y
160166 CONFIG_BRIDGE_NETFILTER=m
167+CONFIG_NETFILTER_NETLINK_HOOK=m
161168 CONFIG_NF_CONNTRACK=m
162169 CONFIG_NF_CONNTRACK_SECMARK=y
163170 CONFIG_NF_CONNTRACK_EVENTS=y
@@ -280,6 +287,7 @@ CONFIG_IP_VS_FTP=m · 116 unmodified lines
280287 CONFIG_IP_VS_PE_SIP=m
281288 CONFIG_NFT_FIB_IPV4=m
282289 CONFIG_NF_TABLES_ARP=y
290+CONFIG_NF_LOG_IPV4=m
283291 CONFIG_IP_NF_IPTABLES=m
284292 CONFIG_IP_NF_MATCH_AH=m
285293 CONFIG_IP_NF_MATCH_ECN=m
@@ -384,12 +392,11 @@ CONFIG_VSOCKETS=m · 98 unmodified lines
384392 CONFIG_VIRTIO_VSOCKETS=m
385393 CONFIG_NETLINK_DIAG=m
386394 CONFIG_CGROUP_NET_PRIO=y
387−CONFIG_BPF_JIT=y
388395 CONFIG_NET_PKTGEN=m
389396 CONFIG_PCI=y
390−CONFIG_PCI_IOV=y
391397 # CONFIG_PCIEASPM is not set
392398 CONFIG_PCI_DEBUG=y
399+CONFIG_PCI_IOV=y
393400 CONFIG_HOTPLUG_PCI=y
394401 CONFIG_HOTPLUG_PCI_S390=y
395402 CONFIG_DEVTMPFS=y
@@ -436,7 +443,7 @@ CONFIG_MD_MULTIPATH=m · 40 unmodified lines
436443 CONFIG_MD_FAULTY=m
437444 CONFIG_MD_CLUSTER=m
438445 CONFIG_BCACHE=m
439−CONFIG_BLK_DEV_DM=m
446+CONFIG_BLK_DEV_DM=y
440447 CONFIG_DM_UNSTRIPED=m
441448 CONFIG_DM_CRYPT=m
442449 CONFIG_DM_SNAPSHOT=m
@@ -453,6 +460,7 @@ CONFIG_DM_MULTIPATH_ST=m · 10 unmodified lines
453460 CONFIG_DM_MULTIPATH_HST=m
454461 CONFIG_DM_MULTIPATH_IOA=m
455462 CONFIG_DM_DELAY=m
463+CONFIG_DM_INIT=y
456464 CONFIG_DM_UEVENT=y
457465 CONFIG_DM_FLAKEY=m
458466 CONFIG_DM_VERITY=m
@@ -495,6 +503,7 @@ CONFIG_NLMON=m · 36 unmodified lines
495503 # CONFIG_NET_VENDOR_GOOGLE is not set
496504 # CONFIG_NET_VENDOR_HUAWEI is not set
497505 # CONFIG_NET_VENDOR_INTEL is not set
506+# CONFIG_NET_VENDOR_MICROSOFT is not set
498507 # CONFIG_NET_VENDOR_MARVELL is not set
499508 CONFIG_MLX4_EN=m
500509 CONFIG_MLX5_CORE=m
@@ -551,7 +560,6 @@ CONFIG_INPUT_EVDEV=y · 50 unmodified lines
551560 CONFIG_LEGACY_PTY_COUNT=0
552561 CONFIG_VIRTIO_CONSOLE=m
553562 CONFIG_HW_RANDOM_VIRTIO=m
554−CONFIG_RAW_DRIVER=m
555563 CONFIG_HANGCHECK_TIMER=m
556564 CONFIG_TN3270_FS=y
557565 CONFIG_PPS=m
@@ -574,7 +582,6 @@ CONFIG_SYNC_FILE=y · 16 unmodified lines
574582 CONFIG_VFIO=m
575583 CONFIG_VFIO_PCI=m
576584 CONFIG_VFIO_MDEV=m
577−CONFIG_VFIO_MDEV_DEVICE=m
578585 CONFIG_VIRTIO_PCI=m
579586 CONFIG_VIRTIO_BALLOON=m
580587 CONFIG_VIRTIO_INPUT=y
@@ -619,6 +626,7 @@ CONFIG_FUSE_FS=y · 38 unmodified lines
619626 CONFIG_CUSE=m
620627 CONFIG_VIRTIO_FS=m
621628 CONFIG_OVERLAY_FS=m
629+CONFIG_NETFS_STATS=y
622630 CONFIG_FSCACHE=m
623631 CONFIG_CACHEFILES=m
624632 CONFIG_ISO9660_FS=y
@@ -654,7 +662,6 @@ CONFIG_NFSD_V3_ACL=y · 29 unmodified lines
654662 CONFIG_NFSD_V4=y
655663 CONFIG_NFSD_V4_SECURITY_LABEL=y
656664 CONFIG_CIFS=m
657−CONFIG_CIFS_STATS2=y
658665 CONFIG_CIFS_WEAK_PW_HASH=y
659666 CONFIG_CIFS_UPCALL=y
660667 CONFIG_CIFS_XATTR=y
@@ -682,6 +689,7 @@ CONFIG_SECURITY_SELINUX_BOOTPARAM=y · 21 unmodified lines
682689 CONFIG_SECURITY_SELINUX_DISABLE=y
683690 CONFIG_SECURITY_LOCKDOWN_LSM=y
684691 CONFIG_SECURITY_LOCKDOWN_LSM_EARLY=y
692+CONFIG_SECURITY_LANDLOCK=y
685693 CONFIG_INTEGRITY_SIGNATURE=y
686694 CONFIG_INTEGRITY_ASYMMETRIC_KEYS=y
687695 CONFIG_IMA=y
@@ -696,6 +704,7 @@ CONFIG_CRYPTO_CRYPTD=m · 8 unmodified lines
696704 CONFIG_CRYPTO_TEST=m
697705 CONFIG_CRYPTO_DH=m
698706 CONFIG_CRYPTO_ECDH=m
707+CONFIG_CRYPTO_ECDSA=m
699708 CONFIG_CRYPTO_ECRDSA=m
700709 CONFIG_CRYPTO_SM2=m
701710 CONFIG_CRYPTO_CURVE25519=m
@@ -843,7 +852,6 @@ CONFIG_FAULT_INJECTION_DEBUG_FS=y · 141 unmodified lines
843852 CONFIG_FAIL_FUNCTION=y
844853 CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y
845854 CONFIG_LKDTM=m
846−CONFIG_TEST_LIST_SORT=y
847855 CONFIG_TEST_MIN_HEAP=y
848856 CONFIG_TEST_SORT=y
849857 CONFIG_KPROBES_SANITY_TEST=y
@@ -853,3 +861,4 @@ CONFIG_PERCPU_TEST=m · 3 unmodified lines
853861 CONFIG_ATOMIC64_SELFTEST=y
854862 CONFIG_TEST_BITOPS=m
855863 CONFIG_TEST_BPF=m
864+CONFIG_TEST_LIVEPATCH=m
arch/s390/configs/defconfig+19−8
@@ -4,6 +4,11 @@ CONFIG_WATCH_QUEUE=y · 3 unmodified lines
44 CONFIG_AUDIT=y
55 CONFIG_NO_HZ_IDLE=y
66 CONFIG_HIGH_RES_TIMERS=y
7+CONFIG_BPF_SYSCALL=y
8+CONFIG_BPF_JIT=y
9+CONFIG_BPF_JIT_ALWAYS_ON=y
10+CONFIG_BPF_LSM=y
11+CONFIG_SCHED_CORE=y
712 CONFIG_BSD_PROCESS_ACCT=y
813 CONFIG_BSD_PROCESS_ACCT_V3=y
914 CONFIG_TASKSTATS=y
@@ -26,14 +31,13 @@ CONFIG_CGROUP_DEVICE=y · 16 unmodified lines
2631 CONFIG_CGROUP_CPUACCT=y
2732 CONFIG_CGROUP_PERF=y
2833 CONFIG_CGROUP_BPF=y
34+CONFIG_CGROUP_MISC=y
2935 CONFIG_NAMESPACES=y
3036 CONFIG_USER_NS=y
3137 CONFIG_CHECKPOINT_RESTORE=y
3238 CONFIG_SCHED_AUTOGROUP=y
3339 CONFIG_EXPERT=y
3440 # CONFIG_SYSFS_SYSCALL is not set
35−CONFIG_BPF_LSM=y
36−CONFIG_BPF_SYSCALL=y
3741 CONFIG_USERFAULTFD=y
3842 # CONFIG_COMPAT_BRK is not set
3943 CONFIG_PROFILING=y
@@ -70,6 +74,7 @@ CONFIG_BLK_DEV_THROTTLING=y · 30 unmodified lines
7074 CONFIG_BLK_WBT=y
7175 CONFIG_BLK_CGROUP_IOLATENCY=y
7276 CONFIG_BLK_CGROUP_IOCOST=y
77+CONFIG_BLK_CGROUP_IOPRIO=y
7378 CONFIG_BLK_INLINE_ENCRYPTION=y
7479 CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK=y
7580 CONFIG_PARTITION_ADVANCED=y
@@ -87,6 +92,7 @@ CONFIG_KSM=y · 11 unmodified lines
8792 CONFIG_TRANSPARENT_HUGEPAGE=y
8893 CONFIG_CLEANCACHE=y
8994 CONFIG_FRONTSWAP=y
95+CONFIG_CMA_SYSFS=y
9096 CONFIG_CMA_AREAS=7
9197 CONFIG_MEM_SOFT_DIRTY=y
9298 CONFIG_ZSWAP=y
@@ -149,6 +155,7 @@ CONFIG_IPV6_RPL_LWTUNNEL=y · 56 unmodified lines
149155 CONFIG_MPTCP=y
150156 CONFIG_NETFILTER=y
151157 CONFIG_BRIDGE_NETFILTER=m
158+CONFIG_NETFILTER_NETLINK_HOOK=m
152159 CONFIG_NF_CONNTRACK=m
153160 CONFIG_NF_CONNTRACK_SECMARK=y
154161 CONFIG_NF_CONNTRACK_EVENTS=y
@@ -271,6 +278,7 @@ CONFIG_IP_VS_FTP=m · 116 unmodified lines
271278 CONFIG_IP_VS_PE_SIP=m
272279 CONFIG_NFT_FIB_IPV4=m
273280 CONFIG_NF_TABLES_ARP=y
281+CONFIG_NF_LOG_IPV4=m
274282 CONFIG_IP_NF_IPTABLES=m
275283 CONFIG_IP_NF_MATCH_AH=m
276284 CONFIG_IP_NF_MATCH_ECN=m
@@ -374,11 +382,10 @@ CONFIG_VSOCKETS=m · 97 unmodified lines
374382 CONFIG_VIRTIO_VSOCKETS=m
375383 CONFIG_NETLINK_DIAG=m
376384 CONFIG_CGROUP_NET_PRIO=y
377−CONFIG_BPF_JIT=y
378385 CONFIG_NET_PKTGEN=m
379386 CONFIG_PCI=y
380−CONFIG_PCI_IOV=y
381387 # CONFIG_PCIEASPM is not set
388+CONFIG_PCI_IOV=y
382389 CONFIG_HOTPLUG_PCI=y
383390 CONFIG_HOTPLUG_PCI_S390=y
384391 CONFIG_UEVENT_HELPER=y
@@ -427,7 +434,7 @@ CONFIG_MD_MULTIPATH=m · 42 unmodified lines
427434 CONFIG_MD_FAULTY=m
428435 CONFIG_MD_CLUSTER=m
429436 CONFIG_BCACHE=m
430−CONFIG_BLK_DEV_DM=m
437+CONFIG_BLK_DEV_DM=y
431438 CONFIG_DM_UNSTRIPED=m
432439 CONFIG_DM_CRYPT=m
433440 CONFIG_DM_SNAPSHOT=m
@@ -444,6 +451,7 @@ CONFIG_DM_MULTIPATH_ST=m · 10 unmodified lines
444451 CONFIG_DM_MULTIPATH_HST=m
445452 CONFIG_DM_MULTIPATH_IOA=m
446453 CONFIG_DM_DELAY=m
454+CONFIG_DM_INIT=y
447455 CONFIG_DM_UEVENT=y
448456 CONFIG_DM_FLAKEY=m
449457 CONFIG_DM_VERITY=m
@@ -487,6 +495,7 @@ CONFIG_NLMON=m · 37 unmodified lines
487495 # CONFIG_NET_VENDOR_GOOGLE is not set
488496 # CONFIG_NET_VENDOR_HUAWEI is not set
489497 # CONFIG_NET_VENDOR_INTEL is not set
498+# CONFIG_NET_VENDOR_MICROSOFT is not set
490499 # CONFIG_NET_VENDOR_MARVELL is not set
491500 CONFIG_MLX4_EN=m
492501 CONFIG_MLX5_CORE=m
@@ -543,7 +552,6 @@ CONFIG_INPUT_EVDEV=y · 50 unmodified lines
543552 CONFIG_LEGACY_PTY_COUNT=0
544553 CONFIG_VIRTIO_CONSOLE=m
545554 CONFIG_HW_RANDOM_VIRTIO=m
546−CONFIG_RAW_DRIVER=m
547555 CONFIG_HANGCHECK_TIMER=m
548556 CONFIG_TN3270_FS=y
549557 # CONFIG_PTP_1588_CLOCK is not set
@@ -566,7 +574,6 @@ CONFIG_SYNC_FILE=y · 16 unmodified lines
566574 CONFIG_VFIO=m
567575 CONFIG_VFIO_PCI=m
568576 CONFIG_VFIO_MDEV=m
569−CONFIG_VFIO_MDEV_DEVICE=m
570577 CONFIG_VIRTIO_PCI=m
571578 CONFIG_VIRTIO_BALLOON=m
572579 CONFIG_VIRTIO_INPUT=y
@@ -607,6 +614,7 @@ CONFIG_FUSE_FS=y · 34 unmodified lines
607614 CONFIG_CUSE=m
608615 CONFIG_VIRTIO_FS=m
609616 CONFIG_OVERLAY_FS=m
617+CONFIG_NETFS_STATS=y
610618 CONFIG_FSCACHE=m
611619 CONFIG_CACHEFILES=m
612620 CONFIG_ISO9660_FS=y
@@ -642,7 +650,6 @@ CONFIG_NFSD_V3_ACL=y · 29 unmodified lines
642650 CONFIG_NFSD_V4=y
643651 CONFIG_NFSD_V4_SECURITY_LABEL=y
644652 CONFIG_CIFS=m
645−CONFIG_CIFS_STATS2=y
646653 CONFIG_CIFS_WEAK_PW_HASH=y
647654 CONFIG_CIFS_UPCALL=y
648655 CONFIG_CIFS_XATTR=y
@@ -669,6 +676,7 @@ CONFIG_SECURITY_SELINUX_BOOTPARAM=y · 20 unmodified lines
669676 CONFIG_SECURITY_SELINUX_DISABLE=y
670677 CONFIG_SECURITY_LOCKDOWN_LSM=y
671678 CONFIG_SECURITY_LOCKDOWN_LSM_EARLY=y
679+CONFIG_SECURITY_LANDLOCK=y
672680 CONFIG_INTEGRITY_SIGNATURE=y
673681 CONFIG_INTEGRITY_ASYMMETRIC_KEYS=y
674682 CONFIG_IMA=y
@@ -684,6 +692,7 @@ CONFIG_CRYPTO_CRYPTD=m · 9 unmodified lines
684692 CONFIG_CRYPTO_TEST=m
685693 CONFIG_CRYPTO_DH=m
686694 CONFIG_CRYPTO_ECDH=m
695+CONFIG_CRYPTO_ECDSA=m
687696 CONFIG_CRYPTO_ECRDSA=m
688697 CONFIG_CRYPTO_SM2=m
689698 CONFIG_CRYPTO_CURVE25519=m
@@ -754,6 +763,7 @@ CONFIG_CRC8=m · 64 unmodified lines
754763 CONFIG_DMA_CMA=y
755764 CONFIG_CMA_SIZE_MBYTES=0
756765 CONFIG_PRINTK_TIME=y
766+CONFIG_DYNAMIC_DEBUG=y
757767 CONFIG_DEBUG_INFO=y
758768 CONFIG_DEBUG_INFO_DWARF4=y
759769 CONFIG_GDB_SCRIPTS=y
@@ -781,3 +791,4 @@ CONFIG_LKDTM=m · 21 unmodified lines
781791 CONFIG_PERCPU_TEST=m
782792 CONFIG_ATOMIC64_SELFTEST=y
783793 CONFIG_TEST_BPF=m
794+CONFIG_TEST_LIVEPATCH=m
arch/s390/configs/zfcpdump_defconfig+1−2
@@ -29,9 +29,9 @@ CONFIG_PARTITION_ADVANCED=y · 28 unmodified lines
2929 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
3030 # CONFIG_COMPACTION is not set
3131 # CONFIG_MIGRATION is not set
32−# CONFIG_BOUNCE is not set
3332 CONFIG_NET=y
3433 # CONFIG_IUCV is not set
34+# CONFIG_PCPU_DEV_REFCNT is not set
3535 # CONFIG_ETHTOOL_NETLINK is not set
3636 CONFIG_DEVTMPFS=y
3737 CONFIG_BLK_DEV_RAM=y
@@ -51,7 +51,6 @@ CONFIG_ZFCP=y · 13 unmodified lines
5151 # CONFIG_SERIO is not set
5252 # CONFIG_HVC_IUCV is not set
5353 # CONFIG_HW_RANDOM_S390 is not set
54−CONFIG_RAW_DRIVER=y
5554 # CONFIG_HMC_DRV is not set
5655 # CONFIG_S390_TAPE is not set
5756 # CONFIG_VMCP is not set
arch/s390/include/asm/ftrace.h+1−0
@@ -19,6 +19,7 @@ void ftrace_caller(void); · 18 unmodified lines
1919
2020 extern char ftrace_graph_caller_end;
2121 extern unsigned long ftrace_plt;
22+extern void *ftrace_func;
2223
2324 struct dyn_arch_ftrace { };
2425
arch/s390/kernel/ftrace.c+2−0
@@ -40,6 +40,7 @@ · 39 unmodified lines
4040 * trampoline (ftrace_plt), which clobbers also r1.
4141 */
4242
43+void *ftrace_func __read_mostly = ftrace_stub;
4344 unsigned long ftrace_plt;
4445
4546 int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr,
@@ -85,6 +86,7 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) · 39 unmodified lines
8586
8687 int ftrace_update_ftrace_func(ftrace_func_t func)
8788 {
89+ ftrace_func = func;
8890 return 0;
8991 }
9092
arch/s390/kernel/mcount.S+2−2
@@ -59,13 +59,13 @@ ENTRY(ftrace_caller) · 58 unmodified lines
5959 #ifdef CONFIG_HAVE_MARCH_Z196_FEATURES
6060 aghik %r2,%r0,-MCOUNT_INSN_SIZE
6161 lgrl %r4,function_trace_op
62− lgrl %r1,ftrace_trace_function
62+ lgrl %r1,ftrace_func
6363 #else
6464 lgr %r2,%r0
6565 aghi %r2,-MCOUNT_INSN_SIZE
6666 larl %r4,function_trace_op
6767 lg %r4,0(%r4)
68− larl %r1,ftrace_trace_function
68+ larl %r1,ftrace_func
6969 lg %r1,0(%r1)
7070 #endif
7171 lgr %r3,%r14
arch/s390/kernel/perf_cpum_cf.c+1−1
@@ -745,7 +745,7 @@ static int __init cpumf_pmu_init(void) · 744 unmodified lines
745745 if (!cf_dbg) {
746746 pr_err("Registration of s390dbf(cpum_cf) failed\n");
747747 return -ENOMEM;
748− };
748+ }
749749 debug_register_view(cf_dbg, &debug_sprintf_view);
750750
751751 cpumf_pmu.attr_groups = cpumf_cf_event_group();
arch/s390/kernel/uprobes.c+1−0
@@ -126,6 +126,7 @@ int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, · 125 unmodified lines
126126 case DIE_SSTEP:
127127 if (uprobe_post_sstep_notifier(regs))
128128 return NOTIFY_STOP;
129+ break;
129130 default:
130131 break;
131132 }
arch/s390/kernel/vdso32/Makefile+1−0
@@ -29,6 +29,7 @@ $(targets:%=$(obj)/%.dbg): KBUILD_CFLAGS = $(KBUILD_CFLAGS_32) · 28 unmodified lines
2929 $(targets:%=$(obj)/%.dbg): KBUILD_AFLAGS = $(KBUILD_AFLAGS_32)
3030
3131 obj-y += vdso32_wrapper.o
32+targets += vdso32.lds
3233 CPPFLAGS_vdso32.lds += -P -C -U$(ARCH)
3334
3435 # Disable gcov profiling, ubsan and kasan for VDSO code
arch/s390/net/bpf_jit_comp.c+1−1
@@ -112,7 +112,7 @@ static inline void reg_set_seen(struct bpf_jit *jit, u32 b1) · 111 unmodified lines
112112 {
113113 u32 r1 = reg2hex[b1];
114114
115− if (!jit->seen_reg[r1] && r1 >= 6 && r1 <= 15)
115+ if (r1 >= 6 && r1 <= 15 && !jit->seen_reg[r1])
116116 jit->seen_reg[r1] = 1;
117117 }
118118
arch/x86/kernel/cpu/mshyperv.c+1−1
@@ -237,7 +237,7 @@ static void __init hv_smp_prepare_cpus(unsigned int max_cpus) · 236 unmodified lines
237237 for_each_present_cpu(i) {
238238 if (i == 0)
239239 continue;
240− ret = hv_call_add_logical_proc(numa_cpu_node(i), i, i);
240+ ret = hv_call_add_logical_proc(numa_cpu_node(i), i, cpu_physical_id(i));
241241 BUG_ON(ret);
242242 }
243243
arch/x86/kvm/cpuid.c+25−5
@@ -765,7 +765,8 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function) · 764 unmodified lines
765765
766766 edx.split.num_counters_fixed = min(cap.num_counters_fixed, MAX_FIXED_COUNTERS);
767767 edx.split.bit_width_fixed = cap.bit_width_fixed;
768− edx.split.anythread_deprecated = 1;
768+ if (cap.version)
769+ edx.split.anythread_deprecated = 1;
769770 edx.split.reserved1 = 0;
770771 edx.split.reserved2 = 0;
771772
@@ -940,8 +941,21 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function) · 168 unmodified lines
940941 unsigned virt_as = max((entry->eax >> 8) & 0xff, 48U);
941942 unsigned phys_as = entry->eax & 0xff;
942943
943− if (!g_phys_as)
944+ /*
945+ * If TDP (NPT) is disabled use the adjusted host MAXPHYADDR as
946+ * the guest operates in the same PA space as the host, i.e.
947+ * reductions in MAXPHYADDR for memory encryption affect shadow
948+ * paging, too.
949+ *
950+ * If TDP is enabled but an explicit guest MAXPHYADDR is not
951+ * provided, use the raw bare metal MAXPHYADDR as reductions to
952+ * the HPAs do not affect GPAs.
953+ */
954+ if (!tdp_enabled)
955+ g_phys_as = boot_cpu_data.x86_phys_bits;
956+ else if (!g_phys_as)
944957 g_phys_as = phys_as;
958+
945959 entry->eax = g_phys_as | (virt_as << 8);
946960 entry->edx = 0;
947961 cpuid_entry_override(entry, CPUID_8000_0008_EBX);
@@ -964,12 +978,18 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function) · 16 unmodified lines
964978 case 0x8000001a:
965979 case 0x8000001e:
966980 break;
967− /* Support memory encryption cpuid if host supports it */
968981 case 0x8000001F:
969− if (!kvm_cpu_cap_has(X86_FEATURE_SEV))
982+ if (!kvm_cpu_cap_has(X86_FEATURE_SEV)) {
970983 entry->eax = entry->ebx = entry->ecx = entry->edx = 0;
971− else
984+ } else {
972985 cpuid_entry_override(entry, CPUID_8000_001F_EAX);
986+
987+ /*
988+ * Enumerate '0' for "PA bits reduction", the adjusted
989+ * MAXPHYADDR is enumerated directly (see 0x80000008).
990+ */
991+ entry->ebx &= ~GENMASK(11, 6);
992+ }
973993 break;
974994 /*Add support for Centaur's CPUID instruction*/
975995 case 0xC0000000:
arch/x86/kvm/mmu/mmu.c+2−0
@@ -53,6 +53,8 @@ · 52 unmodified lines
5353 #include <asm/kvm_page_track.h>
5454 #include "trace.h"
5555
56+#include "paging.h"
57+
5658 extern bool itlb_multihit_kvm_mitigation;
5759
5860 int __read_mostly nx_huge_pages = -1;
arch/x86/kvm/mmu/paging.h+14−0
@@ -0,0 +1,14 @@
1+/* SPDX-License-Identifier: GPL-2.0-only */
2+/* Shadow paging constants/helpers that don't need to be #undef'd. */
3+#ifndef __KVM_X86_PAGING_H
4+#define __KVM_X86_PAGING_H
5+
6+#define GUEST_PT64_BASE_ADDR_MASK (((1ULL << 52) - 1) & ~(u64)(PAGE_SIZE-1))
7+#define PT64_LVL_ADDR_MASK(level) \
8+ (GUEST_PT64_BASE_ADDR_MASK & ~((1ULL << (PAGE_SHIFT + (((level) - 1) \
9+ * PT64_LEVEL_BITS))) - 1))
10+#define PT64_LVL_OFFSET_MASK(level) \
11+ (GUEST_PT64_BASE_ADDR_MASK & ((1ULL << (PAGE_SHIFT + (((level) - 1) \
12+ * PT64_LEVEL_BITS))) - 1))
13+#endif /* __KVM_X86_PAGING_H */
14+
arch/x86/kvm/mmu/paging_tmpl.h+2−2
@@ -24,7 +24,7 @@ · 23 unmodified lines
2424 #define pt_element_t u64
2525 #define guest_walker guest_walker64
2626 #define FNAME(name) paging##64_##name
27− #define PT_BASE_ADDR_MASK PT64_BASE_ADDR_MASK
27+ #define PT_BASE_ADDR_MASK GUEST_PT64_BASE_ADDR_MASK
2828 #define PT_LVL_ADDR_MASK(lvl) PT64_LVL_ADDR_MASK(lvl)
2929 #define PT_LVL_OFFSET_MASK(lvl) PT64_LVL_OFFSET_MASK(lvl)
3030 #define PT_INDEX(addr, level) PT64_INDEX(addr, level)
@@ -57,7 +57,7 @@ · 26 unmodified lines
5757 #define pt_element_t u64
5858 #define guest_walker guest_walkerEPT
5959 #define FNAME(name) ept_##name
60− #define PT_BASE_ADDR_MASK PT64_BASE_ADDR_MASK
60+ #define PT_BASE_ADDR_MASK GUEST_PT64_BASE_ADDR_MASK
6161 #define PT_LVL_ADDR_MASK(lvl) PT64_LVL_ADDR_MASK(lvl)
6262 #define PT_LVL_OFFSET_MASK(lvl) PT64_LVL_OFFSET_MASK(lvl)
6363 #define PT_INDEX(addr, level) PT64_INDEX(addr, level)
arch/x86/kvm/mmu/spte.h+0−6
@@ -38,12 +38,6 @@ static_assert(SPTE_TDP_AD_ENABLED_MASK == 0); · 37 unmodified lines
3838 #else
3939 #define PT64_BASE_ADDR_MASK (((1ULL << 52) - 1) & ~(u64)(PAGE_SIZE-1))
4040 #endif
41−#define PT64_LVL_ADDR_MASK(level) \
42− (PT64_BASE_ADDR_MASK & ~((1ULL << (PAGE_SHIFT + (((level) - 1) \
43− * PT64_LEVEL_BITS))) - 1))
44−#define PT64_LVL_OFFSET_MASK(level) \
45− (PT64_BASE_ADDR_MASK & ((1ULL << (PAGE_SHIFT + (((level) - 1) \
46− * PT64_LEVEL_BITS))) - 1))
4741
4842 #define PT64_PERM_MASK (PT_PRESENT_MASK | PT_WRITABLE_MASK | shadow_user_mask \
4943 | shadow_x_mask | shadow_nx_mask | shadow_me_mask)
arch/x86/kvm/svm/nested.c+33−20
@@ -154,6 +154,10 @@ void recalc_intercepts(struct vcpu_svm *svm) · 153 unmodified lines
154154
155155 for (i = 0; i < MAX_INTERCEPT; i++)
156156 c->intercepts[i] |= g->intercepts[i];
157+
158+ /* If SMI is not intercepted, ignore guest SMI intercept as well */
159+ if (!intercept_smi)
160+ vmcb_clr_intercept(c, INTERCEPT_SMI);
157161 }
158162
159163 static void copy_vmcb_control_area(struct vmcb_control_area *dst,
@@ -304,8 +308,8 @@ static bool nested_vmcb_valid_sregs(struct kvm_vcpu *vcpu, · 144 unmodified lines
304308 return true;
305309 }
306310
307−static void nested_load_control_from_vmcb12(struct vcpu_svm *svm,
308− struct vmcb_control_area *control)
311+void nested_load_control_from_vmcb12(struct vcpu_svm *svm,
312+ struct vmcb_control_area *control)
309313 {
310314 copy_vmcb_control_area(&svm->nested.ctl, control);
311315
@@ -618,6 +622,11 @@ int nested_svm_vmrun(struct kvm_vcpu *vcpu) · 306 unmodified lines
618622 struct kvm_host_map map;
619623 u64 vmcb12_gpa;
620624
625+ if (!svm->nested.hsave_msr) {
626+ kvm_inject_gp(vcpu, 0);
627+ return 1;
628+ }
629+
621630 if (is_smm(vcpu)) {
622631 kvm_queue_exception(vcpu, UD_VECTOR);
623632 return 1;
@@ -692,6 +701,27 @@ out: · 68 unmodified lines
692701 return ret;
693702 }
694703
704+/* Copy state save area fields which are handled by VMRUN */
705+void svm_copy_vmrun_state(struct vmcb_save_area *from_save,
706+ struct vmcb_save_area *to_save)
707+{
708+ to_save->es = from_save->es;
709+ to_save->cs = from_save->cs;
710+ to_save->ss = from_save->ss;
711+ to_save->ds = from_save->ds;
712+ to_save->gdtr = from_save->gdtr;
713+ to_save->idtr = from_save->idtr;
714+ to_save->rflags = from_save->rflags | X86_EFLAGS_FIXED;
715+ to_save->efer = from_save->efer;
716+ to_save->cr0 = from_save->cr0;
717+ to_save->cr3 = from_save->cr3;
718+ to_save->cr4 = from_save->cr4;
719+ to_save->rax = from_save->rax;
720+ to_save->rsp = from_save->rsp;
721+ to_save->rip = from_save->rip;
722+ to_save->cpl = 0;
723+}
724+
695725 void nested_svm_vmloadsave(struct vmcb *from_vmcb, struct vmcb *to_vmcb)
696726 {
697727 to_vmcb->save.fs = from_vmcb->save.fs;
@@ -1355,28 +1385,11 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu, · 657 unmodified lines
13551385
13561386 svm->nested.vmcb12_gpa = kvm_state->hdr.svm.vmcb_pa;
13571387
1358− svm->vmcb01.ptr->save.es = save->es;
1359− svm->vmcb01.ptr->save.cs = save->cs;
1360− svm->vmcb01.ptr->save.ss = save->ss;
1361− svm->vmcb01.ptr->save.ds = save->ds;
1362− svm->vmcb01.ptr->save.gdtr = save->gdtr;
1363− svm->vmcb01.ptr->save.idtr = save->idtr;
1364− svm->vmcb01.ptr->save.rflags = save->rflags | X86_EFLAGS_FIXED;
1365− svm->vmcb01.ptr->save.efer = save->efer;
1366− svm->vmcb01.ptr->save.cr0 = save->cr0;
1367− svm->vmcb01.ptr->save.cr3 = save->cr3;
1368− svm->vmcb01.ptr->save.cr4 = save->cr4;
1369− svm->vmcb01.ptr->save.rax = save->rax;
1370− svm->vmcb01.ptr->save.rsp = save->rsp;
1371− svm->vmcb01.ptr->save.rip = save->rip;
1372− svm->vmcb01.ptr->save.cpl = 0;
1373−
1388+ svm_copy_vmrun_state(save, &svm->vmcb01.ptr->save);
13741389 nested_load_control_from_vmcb12(svm, ctl);
13751390
13761391 svm_switch_vmcb(svm, &svm->nested.vmcb02);
1377−
13781392 nested_vmcb02_prepare_control(svm);
1379−
13801393 kvm_make_request(KVM_REQ_GET_NESTED_STATE_PAGES, vcpu);
13811394 ret = 0;
13821395 out_free:
arch/x86/kvm/svm/sev.c+8−6
@@ -1272,8 +1272,8 @@ static int sev_send_update_data(struct kvm *kvm, struct kvm_sev_cmd *argp) · 1271 unmodified lines
12721272 /* Pin guest memory */
12731273 guest_page = sev_pin_memory(kvm, params.guest_uaddr & PAGE_MASK,
12741274 PAGE_SIZE, &n, 0);
1275− if (!guest_page)
1276− return -EFAULT;
1275+ if (IS_ERR(guest_page))
1276+ return PTR_ERR(guest_page);
12771277
12781278 /* allocate memory for header and transport buffer */
12791279 ret = -ENOMEM;
@@ -1310,8 +1310,9 @@ static int sev_send_update_data(struct kvm *kvm, struct kvm_sev_cmd *argp) · 30 unmodified lines
13101310 }
13111311
13121312 /* Copy packet header to userspace. */
1313− ret = copy_to_user((void __user *)(uintptr_t)params.hdr_uaddr, hdr,
1314− params.hdr_len);
1313+ if (copy_to_user((void __user *)(uintptr_t)params.hdr_uaddr, hdr,
1314+ params.hdr_len))
1315+ ret = -EFAULT;
13151316
13161317 e_free_trans_data:
13171318 kfree(trans_data);
@@ -1463,11 +1464,12 @@ static int sev_receive_update_data(struct kvm *kvm, struct kvm_sev_cmd *argp) · 145 unmodified lines
14631464 data.trans_len = params.trans_len;
14641465
14651466 /* Pin guest memory */
1466− ret = -EFAULT;
14671467 guest_page = sev_pin_memory(kvm, params.guest_uaddr & PAGE_MASK,
14681468 PAGE_SIZE, &n, 0);
1469− if (!guest_page)
1469+ if (IS_ERR(guest_page)) {
1470+ ret = PTR_ERR(guest_page);
14701471 goto e_free_trans;
1472+ }
14711473
14721474 /* The RECEIVE_UPDATE_DATA command requires C-bit to be always set. */
14731475 data.guest_address = (page_to_pfn(guest_page[0]) << PAGE_SHIFT) + offset;
arch/x86/kvm/svm/svm.c+70−7
@@ -198,6 +198,11 @@ module_param(avic, bool, 0444); · 197 unmodified lines
198198 bool __read_mostly dump_invalid_vmcb;
199199 module_param(dump_invalid_vmcb, bool, 0644);
200200
201+
202+bool intercept_smi = true;
203+module_param(intercept_smi, bool, 0444);
204+
205+
201206 static bool svm_gp_erratum_intercept = true;
202207
203208 static u8 rsm_ins_bytes[] = "\x0f\xaa";
@@ -1185,7 +1190,10 @@ static void init_vmcb(struct kvm_vcpu *vcpu) · 981 unmodified lines
11851190
11861191 svm_set_intercept(svm, INTERCEPT_INTR);
11871192 svm_set_intercept(svm, INTERCEPT_NMI);
1188− svm_set_intercept(svm, INTERCEPT_SMI);
1193+
1194+ if (intercept_smi)
1195+ svm_set_intercept(svm, INTERCEPT_SMI);
1196+
11891197 svm_set_intercept(svm, INTERCEPT_SELECTIVE_CR0);
11901198 svm_set_intercept(svm, INTERCEPT_RDPMC);
11911199 svm_set_intercept(svm, INTERCEPT_CPUID);
@@ -1923,7 +1931,7 @@ static int npf_interception(struct kvm_vcpu *vcpu) · 731 unmodified lines
19231931 {
19241932 struct vcpu_svm *svm = to_svm(vcpu);
19251933
1926− u64 fault_address = __sme_clr(svm->vmcb->control.exit_info_2);
1934+ u64 fault_address = svm->vmcb->control.exit_info_2;
19271935 u64 error_code = svm->vmcb->control.exit_info_1;
19281936
19291937 trace_kvm_page_fault(fault_address, error_code);
@@ -2106,6 +2114,11 @@ static int nmi_interception(struct kvm_vcpu *vcpu) · 176 unmodified lines
21062114 return 1;
21072115 }
21082116
2117+static int smi_interception(struct kvm_vcpu *vcpu)
2118+{
2119+ return 1;
2120+}
2121+
21092122 static int intr_interception(struct kvm_vcpu *vcpu)
21102123 {
21112124 ++vcpu->stat.irq_exits;
@@ -2941,7 +2954,16 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr) · 829 unmodified lines
29412954 svm_disable_lbrv(vcpu);
29422955 break;
29432956 case MSR_VM_HSAVE_PA:
2944− svm->nested.hsave_msr = data;
2957+ /*
2958+ * Old kernels did not validate the value written to
2959+ * MSR_VM_HSAVE_PA. Allow KVM_SET_MSR to set an invalid
2960+ * value to allow live migrating buggy or malicious guests
2961+ * originating from those kernels.
2962+ */
2963+ if (!msr->host_initiated && !page_address_valid(vcpu, data))
2964+ return 1;
2965+
2966+ svm->nested.hsave_msr = data & PAGE_MASK;
29452967 break;
29462968 case MSR_VM_CR:
29472969 return svm_set_vm_cr(vcpu, data);
@@ -3080,8 +3102,7 @@ static int (*const svm_exit_handlers[])(struct kvm_vcpu *vcpu) = { · 132 unmodified lines
30803102 [SVM_EXIT_EXCP_BASE + GP_VECTOR] = gp_interception,
30813103 [SVM_EXIT_INTR] = intr_interception,
30823104 [SVM_EXIT_NMI] = nmi_interception,
3083− [SVM_EXIT_SMI] = kvm_emulate_as_nop,
3084− [SVM_EXIT_INIT] = kvm_emulate_as_nop,
3105+ [SVM_EXIT_SMI] = smi_interception,
30853106 [SVM_EXIT_VINTR] = interrupt_window_interception,
30863107 [SVM_EXIT_RDPMC] = kvm_emulate_rdpmc,
30873108 [SVM_EXIT_CPUID] = kvm_emulate_cpuid,
@@ -4288,6 +4309,7 @@ static int svm_smi_allowed(struct kvm_vcpu *vcpu, bool for_injection) · 1200 unmodified lines
42884309 static int svm_enter_smm(struct kvm_vcpu *vcpu, char *smstate)
42894310 {
42904311 struct vcpu_svm *svm = to_svm(vcpu);
4312+ struct kvm_host_map map_save;
42914313 int ret;
42924314
42934315 if (is_guest_mode(vcpu)) {
@@ -4303,6 +4325,29 @@ static int svm_enter_smm(struct kvm_vcpu *vcpu, char *smstate) · 9 unmodified lines
43034325 ret = nested_svm_vmexit(svm);
43044326 if (ret)
43054327 return ret;
4328+
4329+ /*
4330+ * KVM uses VMCB01 to store L1 host state while L2 runs but
4331+ * VMCB01 is going to be used during SMM and thus the state will
4332+ * be lost. Temporary save non-VMLOAD/VMSAVE state to the host save
4333+ * area pointed to by MSR_VM_HSAVE_PA. APM guarantees that the
4334+ * format of the area is identical to guest save area offsetted
4335+ * by 0x400 (matches the offset of 'struct vmcb_save_area'
4336+ * within 'struct vmcb'). Note: HSAVE area may also be used by
4337+ * L1 hypervisor to save additional host context (e.g. KVM does
4338+ * that, see svm_prepare_guest_switch()) which must be
4339+ * preserved.
4340+ */
4341+ if (kvm_vcpu_map(vcpu, gpa_to_gfn(svm->nested.hsave_msr),
4342+ &map_save) == -EINVAL)
4343+ return 1;
4344+
4345+ BUILD_BUG_ON(offsetof(struct vmcb, save) != 0x400);
4346+
4347+ svm_copy_vmrun_state(&svm->vmcb01.ptr->save,
4348+ map_save.hva + 0x400);
4349+
4350+ kvm_vcpu_unmap(vcpu, &map_save, true);
43064351 }
43074352 return 0;
43084353 }
@@ -4310,13 +4355,14 @@ static int svm_enter_smm(struct kvm_vcpu *vcpu, char *smstate) · 1 unmodified line
43104355 static int svm_leave_smm(struct kvm_vcpu *vcpu, const char *smstate)
43114356 {
43124357 struct vcpu_svm *svm = to_svm(vcpu);
4313− struct kvm_host_map map;
4358+ struct kvm_host_map map, map_save;
43144359 int ret = 0;
43154360
43164361 if (guest_cpuid_has(vcpu, X86_FEATURE_LM)) {
43174362 u64 saved_efer = GET_SMSTATE(u64, smstate, 0x7ed0);
43184363 u64 guest = GET_SMSTATE(u64, smstate, 0x7ed8);
43194364 u64 vmcb12_gpa = GET_SMSTATE(u64, smstate, 0x7ee0);
4365+ struct vmcb *vmcb12;
43204366
43214367 if (guest) {
43224368 if (!guest_cpuid_has(vcpu, X86_FEATURE_SVM))
@@ -4332,8 +4378,25 @@ static int svm_leave_smm(struct kvm_vcpu *vcpu, const char *smstate) · 9 unmodified lines
43324378 if (svm_allocate_nested(svm))
43334379 return 1;
43344380
4335− ret = enter_svm_guest_mode(vcpu, vmcb12_gpa, map.hva);
4381+ vmcb12 = map.hva;
4382+
4383+ nested_load_control_from_vmcb12(svm, &vmcb12->control);
4384+
4385+ ret = enter_svm_guest_mode(vcpu, vmcb12_gpa, vmcb12);
43364386 kvm_vcpu_unmap(vcpu, &map, true);
4387+
4388+ /*
4389+ * Restore L1 host state from L1 HSAVE area as VMCB01 was
4390+ * used during SMM (see svm_enter_smm())
4391+ */
4392+ if (kvm_vcpu_map(vcpu, gpa_to_gfn(svm->nested.hsave_msr),
4393+ &map_save) == -EINVAL)
4394+ return 1;
4395+
4396+ svm_copy_vmrun_state(map_save.hva + 0x400,
4397+ &svm->vmcb01.ptr->save);
4398+
4399+ kvm_vcpu_unmap(vcpu, &map_save, true);
43374400 }
43384401 }
43394402
arch/x86/kvm/svm/svm.h+5−0
@@ -31,6 +31,7 @@ · 30 unmodified lines
3131 #define MSRPM_OFFSETS 16
3232 extern u32 msrpm_offsets[MSRPM_OFFSETS] __read_mostly;
3333 extern bool npt_enabled;
34+extern bool intercept_smi;
3435
3536 /*
3637 * Clean bits in VMCB.
@@ -463,6 +464,8 @@ void svm_leave_nested(struct vcpu_svm *svm); · 426 unmodified lines
463464 void svm_free_nested(struct vcpu_svm *svm);
464465 int svm_allocate_nested(struct vcpu_svm *svm);
465466 int nested_svm_vmrun(struct kvm_vcpu *vcpu);
467+void svm_copy_vmrun_state(struct vmcb_save_area *from_save,
468+ struct vmcb_save_area *to_save);
466469 void nested_svm_vmloadsave(struct vmcb *from_vmcb, struct vmcb *to_vmcb);
467470 int nested_svm_vmexit(struct vcpu_svm *svm);
468471
@@ -479,6 +482,8 @@ int nested_svm_check_permissions(struct kvm_vcpu *vcpu); · 10 unmodified lines
479482 int nested_svm_check_exception(struct vcpu_svm *svm, unsigned nr,
480483 bool has_error_code, u32 error_code);
481484 int nested_svm_exit_special(struct vcpu_svm *svm);
485+void nested_load_control_from_vmcb12(struct vcpu_svm *svm,
486+ struct vmcb_control_area *control);
482487 void nested_sync_control_from_vmcb02(struct vcpu_svm *svm);
483488 void nested_vmcb02_compute_g_pat(struct vcpu_svm *svm);
484489 void svm_switch_vmcb(struct vcpu_svm *svm, struct kvm_vmcb_info *target_vmcb);
arch/x86/kvm/vmx/vmx.h+0−2
@@ -14,8 +14,6 @@ · 13 unmodified lines
1414 #include "vmx_ops.h"
1515 #include "cpuid.h"
1616
17−extern const u32 vmx_msr_index[];
18−
1917 #define MSR_TYPE_R 1
2018 #define MSR_TYPE_W 2
2119 #define MSR_TYPE_RW 3
arch/x86/kvm/x86.c+2−3
@@ -9601,6 +9601,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) · 9600 unmodified lines
96019601 set_debugreg(vcpu->arch.eff_db[3], 3);
96029602 set_debugreg(vcpu->arch.dr6, 6);
96039603 vcpu->arch.switch_db_regs &= ~KVM_DEBUGREG_RELOAD;
9604+ } else if (unlikely(hw_breakpoint_active())) {
9605+ set_debugreg(0, 7);
96049606 }
96059607
96069608 for (;;) {
@@ -10985,9 +10987,6 @@ int kvm_arch_hardware_setup(void *opaque) · 1378 unmodified lines
1098510987 int r;
1098610988
1098710989 rdmsrl_safe(MSR_EFER, &host_efer);
10988− if (WARN_ON_ONCE(boot_cpu_has(X86_FEATURE_NX) &&
10989− !(host_efer & EFER_NX)))
10990− return -EIO;
1099110990
1099210991 if (boot_cpu_has(X86_FEATURE_XSAVES))
1099310992 rdmsrl(MSR_IA32_XSS, host_xss);
arch/x86/mm/pgtable.c+15−19
@@ -682,7 +682,6 @@ int p4d_clear_huge(p4d_t *p4d) · 681 unmodified lines
682682 }
683683 #endif
684684
685−#if CONFIG_PGTABLE_LEVELS > 3
686685 /**
687686 * pud_set_huge - setup kernel PUD mapping
688687 *
@@ -721,23 +720,6 @@ int pud_set_huge(pud_t *pud, phys_addr_t addr, pgprot_t prot) · 32 unmodified lines
721720 return 1;
722721 }
723722
724−/**
725− * pud_clear_huge - clear kernel PUD mapping when it is set
726− *
727− * Returns 1 on success and 0 on failure (no PUD map is found).
728− */
729−int pud_clear_huge(pud_t *pud)
730−{
731− if (pud_large(*pud)) {
732− pud_clear(pud);
733− return 1;
734− }
735−
736− return 0;
737−}
738−#endif
739−
740−#if CONFIG_PGTABLE_LEVELS > 2
741723 /**
742724 * pmd_set_huge - setup kernel PMD mapping
743725 *
@@ -768,6 +750,21 @@ int pmd_set_huge(pmd_t *pmd, phys_addr_t addr, pgprot_t prot) · 24 unmodified lines
768750 return 1;
769751 }
770752
753+/**
754+ * pud_clear_huge - clear kernel PUD mapping when it is set
755+ *
756+ * Returns 1 on success and 0 on failure (no PUD map is found).
757+ */
758+int pud_clear_huge(pud_t *pud)
759+{
760+ if (pud_large(*pud)) {
761+ pud_clear(pud);
762+ return 1;
763+ }
764+
765+ return 0;
766+}
767+
771768 /**
772769 * pmd_clear_huge - clear kernel PMD mapping when it is set
773770 *
@@ -782,7 +779,6 @@ int pmd_clear_huge(pmd_t *pmd) · 8 unmodified lines
782779
783780 return 0;
784781 }
785−#endif
786782
787783 #ifdef CONFIG_X86_64
788784 /**
drivers/block/nbd.c+1−1
@@ -239,8 +239,8 @@ static void nbd_dev_remove(struct nbd_device *nbd) · 238 unmodified lines
239239
240240 if (disk) {
241241 del_gendisk(disk);
242− blk_mq_free_tag_set(&nbd->tag_set);
243242 blk_cleanup_disk(disk);
243+ blk_mq_free_tag_set(&nbd->tag_set);
244244 }
245245
246246 /*
drivers/block/paride/pd.c+1−1
@@ -1014,8 +1014,8 @@ static void __exit pd_exit(void) · 1013 unmodified lines
10141014 if (p) {
10151015 disk->gd = NULL;
10161016 del_gendisk(p);
1017− blk_mq_free_tag_set(&disk->tag_set);
10181017 blk_cleanup_disk(p);
1018+ blk_mq_free_tag_set(&disk->tag_set);
10191019 pi_release(disk->pi);
10201020 }
10211021 }
drivers/block/xen-blkfront.c+26−198
@@ -502,34 +502,21 @@ static int blkif_getgeo(struct block_device *bd, struct hd_geometry *hg) · 501 unmodified lines
502502 static int blkif_ioctl(struct block_device *bdev, fmode_t mode,
503503 unsigned command, unsigned long argument)
504504 {
505− struct blkfront_info *info = bdev->bd_disk->private_data;
506505 int i;
507506
508− dev_dbg(&info->xbdev->dev, "command: 0x%x, argument: 0x%lx\n",
509− command, (long)argument);
510−
511507 switch (command) {
512508 case CDROMMULTISESSION:
513− dev_dbg(&info->xbdev->dev, "FIXME: support multisession CDs later\n");
514509 for (i = 0; i < sizeof(struct cdrom_multisession); i++)
515510 if (put_user(0, (char __user *)(argument + i)))
516511 return -EFAULT;
517512 return 0;
518−
519− case CDROM_GET_CAPABILITY: {
520− struct gendisk *gd = info->gd;
521− if (gd->flags & GENHD_FL_CD)
513+ case CDROM_GET_CAPABILITY:
514+ if (bdev->bd_disk->flags & GENHD_FL_CD)
522515 return 0;
523516 return -EINVAL;
524− }
525−
526517 default:
527− /*printk(KERN_ALERT "ioctl %08x not supported by Xen blkdev\n",
528− command);*/
529− return -EINVAL; /* same return as native Linux */
518+ return -EINVAL;
530519 }
531−
532− return 0;
533520 }
534521
535522 static unsigned long blkif_ring_get_request(struct blkfront_ring_info *rinfo,
@@ -1177,36 +1164,6 @@ out_release_minors: · 641 unmodified lines
11771164 return err;
11781165 }
11791166
1180−static void xlvbd_release_gendisk(struct blkfront_info *info)
1181−{
1182− unsigned int minor, nr_minors, i;
1183− struct blkfront_ring_info *rinfo;
1184−
1185− if (info->rq == NULL)
1186− return;
1187−
1188− /* No more blkif_request(). */
1189− blk_mq_stop_hw_queues(info->rq);
1190−
1191− for_each_rinfo(info, rinfo, i) {
1192− /* No more gnttab callback work. */
1193− gnttab_cancel_free_callback(&rinfo->callback);
1194−
1195− /* Flush gnttab callback work. Must be done with no locks held. */
1196− flush_work(&rinfo->work);
1197− }
1198−
1199− del_gendisk(info->gd);
1200−
1201− minor = info->gd->first_minor;
1202− nr_minors = info->gd->minors;
1203− xlbd_release_minors(minor, nr_minors);
1204−
1205− blk_cleanup_disk(info->gd);
1206− info->gd = NULL;
1207− blk_mq_free_tag_set(&info->tag_set);
1208−}
1209−
12101167 /* Already hold rinfo->ring_lock. */
12111168 static inline void kick_pending_request_queues_locked(struct blkfront_ring_info *rinfo)
12121169 {
@@ -1756,12 +1713,6 @@ abort_transaction: · 543 unmodified lines
17561713 return err;
17571714 }
17581715
1759−static void free_info(struct blkfront_info *info)
1760−{
1761− list_del(&info->info_list);
1762− kfree(info);
1763−}
1764−
17651716 /* Common code used when first setting up, and when resuming. */
17661717 static int talk_to_blkback(struct xenbus_device *dev,
17671718 struct blkfront_info *info)
@@ -1880,13 +1831,6 @@ again: · 112 unmodified lines
18801831 xenbus_dev_fatal(dev, err, "%s", message);
18811832 destroy_blkring:
18821833 blkif_free(info, 0);
1883−
1884− mutex_lock(&blkfront_mutex);
1885− free_info(info);
1886− mutex_unlock(&blkfront_mutex);
1887−
1888− dev_set_drvdata(&dev->dev, NULL);
1889−
18901834 return err;
18911835 }
18921836
@@ -2126,38 +2070,26 @@ static int blkfront_resume(struct xenbus_device *dev) · 233 unmodified lines
21262070 static void blkfront_closing(struct blkfront_info *info)
21272071 {
21282072 struct xenbus_device *xbdev = info->xbdev;
2129− struct block_device *bdev = NULL;
2130−
2131− mutex_lock(&info->mutex);
2073+ struct blkfront_ring_info *rinfo;
2074+ unsigned int i;
21322075
2133− if (xbdev->state == XenbusStateClosing) {
2134− mutex_unlock(&info->mutex);
2076+ if (xbdev->state == XenbusStateClosing)
21352077 return;
2136− }
21372078
2138− if (info->gd)
2139− bdev = bdgrab(info->gd->part0);
2140−
2141− mutex_unlock(&info->mutex);
2142−
2143− if (!bdev) {
2144− xenbus_frontend_closed(xbdev);
2145− return;
2146− }
2079+ /* No more blkif_request(). */
2080+ blk_mq_stop_hw_queues(info->rq);
2081+ blk_set_queue_dying(info->rq);
2082+ set_capacity(info->gd, 0);
21472083
2148− mutex_lock(&bdev->bd_disk->open_mutex);
2084+ for_each_rinfo(info, rinfo, i) {
2085+ /* No more gnttab callback work. */
2086+ gnttab_cancel_free_callback(&rinfo->callback);
21492087
2150− if (bdev->bd_openers) {
2151− xenbus_dev_error(xbdev, -EBUSY,
2152− "Device in use; refusing to close");
2153− xenbus_switch_state(xbdev, XenbusStateClosing);
2154− } else {
2155− xlvbd_release_gendisk(info);
2156− xenbus_frontend_closed(xbdev);
2088+ /* Flush gnttab callback work. Must be done with no locks held. */
2089+ flush_work(&rinfo->work);
21572090 }
21582091
2159− mutex_unlock(&bdev->bd_disk->open_mutex);
2160− bdput(bdev);
2092+ xenbus_frontend_closed(xbdev);
21612093 }
21622094
21632095 static void blkfront_setup_discard(struct blkfront_info *info)
@@ -2472,8 +2404,7 @@ static void blkback_changed(struct xenbus_device *dev, · 308 unmodified lines
24722404 break;
24732405 fallthrough;
24742406 case XenbusStateClosing:
2475− if (info)
2476− blkfront_closing(info);
2407+ blkfront_closing(info);
24772408 break;
24782409 }
24792410 }
@@ -2481,56 +2412,21 @@ static void blkback_changed(struct xenbus_device *dev, · 1 unmodified line
24812412 static int blkfront_remove(struct xenbus_device *xbdev)
24822413 {
24832414 struct blkfront_info *info = dev_get_drvdata(&xbdev->dev);
2484− struct block_device *bdev = NULL;
2485− struct gendisk *disk;
24862415
24872416 dev_dbg(&xbdev->dev, "%s removed", xbdev->nodename);
24882417
2489− if (!info)
2490− return 0;
2491−
2492− blkif_free(info, 0);
2493−
2494− mutex_lock(&info->mutex);
2495−
2496− disk = info->gd;
2497− if (disk)
2498− bdev = bdgrab(disk->part0);
2499−
2500− info->xbdev = NULL;
2501− mutex_unlock(&info->mutex);
2502−
2503− if (!bdev) {
2504− mutex_lock(&blkfront_mutex);
2505− free_info(info);
2506− mutex_unlock(&blkfront_mutex);
2507− return 0;
2508− }
2509−
2510− /*
2511− * The xbdev was removed before we reached the Closed
2512− * state. See if it's safe to remove the disk. If the bdev
2513− * isn't closed yet, we let release take care of it.
2514− */
2515−
2516− mutex_lock(&disk->open_mutex);
2517− info = disk->private_data;
2518−
2519− dev_warn(disk_to_dev(disk),
2520− "%s was hot-unplugged, %d stale handles\n",
2521− xbdev->nodename, bdev->bd_openers);
2418+ del_gendisk(info->gd);
25222419
2523− if (info && !bdev->bd_openers) {
2524− xlvbd_release_gendisk(info);
2525− disk->private_data = NULL;
2526− mutex_lock(&blkfront_mutex);
2527− free_info(info);
2528− mutex_unlock(&blkfront_mutex);
2529− }
2420+ mutex_lock(&blkfront_mutex);
2421+ list_del(&info->info_list);
2422+ mutex_unlock(&blkfront_mutex);
25302423
2531− mutex_unlock(&disk->open_mutex);
2532− bdput(bdev);
2424+ blkif_free(info, 0);
2425+ xlbd_release_minors(info->gd->first_minor, info->gd->minors);
2426+ blk_cleanup_disk(info->gd);
2427+ blk_mq_free_tag_set(&info->tag_set);
25332428
2429+ kfree(info);
25342430 return 0;
25352431 }
25362432
@@ -2541,77 +2437,9 @@ static int blkfront_is_ready(struct xenbus_device *dev) · 4 unmodified lines
25412437 return info->is_ready && info->xbdev;
25422438 }
25432439
2544−static int blkif_open(struct block_device *bdev, fmode_t mode)
2545−{
2546− struct gendisk *disk = bdev->bd_disk;
2547− struct blkfront_info *info;
2548− int err = 0;
2549−
2550− mutex_lock(&blkfront_mutex);
2551−
2552− info = disk->private_data;
2553− if (!info) {
2554− /* xbdev gone */
2555− err = -ERESTARTSYS;
2556− goto out;
2557− }
2558−
2559− mutex_lock(&info->mutex);
2560−
2561− if (!info->gd)
2562− /* xbdev is closed */
2563− err = -ERESTARTSYS;
2564−
2565− mutex_unlock(&info->mutex);
2566−
2567−out:
2568− mutex_unlock(&blkfront_mutex);
2569− return err;
2570−}
2571−
2572−static void blkif_release(struct gendisk *disk, fmode_t mode)
2573−{
2574− struct blkfront_info *info = disk->private_data;
2575− struct xenbus_device *xbdev;
2576−
2577− mutex_lock(&blkfront_mutex);
2578− if (disk->part0->bd_openers)
2579− goto out_mutex;
2580−
2581− /*
2582− * Check if we have been instructed to close. We will have
2583− * deferred this request, because the bdev was still open.
2584− */
2585−
2586− mutex_lock(&info->mutex);
2587− xbdev = info->xbdev;
2588−
2589− if (xbdev && xbdev->state == XenbusStateClosing) {
2590− /* pending switch to state closed */
2591− dev_info(disk_to_dev(disk), "releasing disk\n");
2592− xlvbd_release_gendisk(info);
2593− xenbus_frontend_closed(info->xbdev);
2594− }
2595−
2596− mutex_unlock(&info->mutex);
2597−
2598− if (!xbdev) {
2599− /* sudden device removal */
2600− dev_info(disk_to_dev(disk), "releasing disk\n");
2601− xlvbd_release_gendisk(info);
2602− disk->private_data = NULL;
2603− free_info(info);
2604− }
2605−
2606−out_mutex:
2607− mutex_unlock(&blkfront_mutex);
2608−}
2609−
26102440 static const struct block_device_operations xlvbd_block_fops =
26112441 {
26122442 .owner = THIS_MODULE,
2613− .open = blkif_open,
2614− .release = blkif_release,
26152443 .getgeo = blkif_getgeo,
26162444 .ioctl = blkif_ioctl,
26172445 .compat_ioctl = blkdev_compat_ptr_ioctl,
drivers/char/powernv-op-panel.c+1−0
@@ -75,6 +75,7 @@ static int __op_panel_update_display(void) · 74 unmodified lines
7575 rc);
7676 break;
7777 }
78+ break;
7879 case OPAL_SUCCESS:
7980 break;
8081 default:
drivers/clk/renesas/r9a07g044-cpg.c+47−32
@@ -30,8 +30,9 @@ enum clk_ids { · 29 unmodified lines
3030 CLK_PLL2_DIV20,
3131 CLK_PLL3,
3232 CLK_PLL3_DIV2,
33+ CLK_PLL3_DIV2_4,
34+ CLK_PLL3_DIV2_4_2,
3335 CLK_PLL3_DIV4,
34− CLK_PLL3_DIV8,
3536 CLK_PLL4,
3637 CLK_PLL5,
3738 CLK_PLL5_DIV2,
@@ -42,12 +43,13 @@ enum clk_ids { · 4 unmodified lines
4243 };
4344
4445 /* Divider tables */
45−static const struct clk_div_table dtable_3b[] = {
46+static const struct clk_div_table dtable_1_32[] = {
4647 {0, 1},
4748 {1, 2},
4849 {2, 4},
4950 {3, 8},
5051 {4, 32},
52+ {0, 0},
5153 };
5254
5355 static const struct cpg_core_clk r9a07g044_core_clks[] __initconst = {
@@ -66,47 +68,56 @@ static const struct cpg_core_clk r9a07g044_core_clks[] __initconst = { · 12 unmodified lines
6668 DEF_FIXED(".pll2_div20", CLK_PLL2_DIV20, CLK_PLL2, 1, 20),
6769
6870 DEF_FIXED(".pll3_div2", CLK_PLL3_DIV2, CLK_PLL3, 1, 2),
71+ DEF_FIXED(".pll3_div2_4", CLK_PLL3_DIV2_4, CLK_PLL3_DIV2, 1, 4),
72+ DEF_FIXED(".pll3_div2_4_2", CLK_PLL3_DIV2_4_2, CLK_PLL3_DIV2_4, 1, 2),
6973 DEF_FIXED(".pll3_div4", CLK_PLL3_DIV4, CLK_PLL3, 1, 4),
70− DEF_FIXED(".pll3_div8", CLK_PLL3_DIV8, CLK_PLL3, 1, 8),
7174
7275 /* Core output clk */
7376 DEF_FIXED("I", R9A07G044_CLK_I, CLK_PLL1, 1, 1),
7477 DEF_DIV("P0", R9A07G044_CLK_P0, CLK_PLL2_DIV16, DIVPL2A,
75− dtable_3b, CLK_DIVIDER_HIWORD_MASK),
78+ dtable_1_32, CLK_DIVIDER_HIWORD_MASK),
7679 DEF_FIXED("TSU", R9A07G044_CLK_TSU, CLK_PLL2_DIV20, 1, 1),
77− DEF_DIV("P1", R9A07G044_CLK_P1, CLK_PLL3_DIV8,
78− DIVPL3B, dtable_3b, CLK_DIVIDER_HIWORD_MASK),
80+ DEF_DIV("P1", R9A07G044_CLK_P1, CLK_PLL3_DIV2_4,
81+ DIVPL3B, dtable_1_32, CLK_DIVIDER_HIWORD_MASK),
82+ DEF_DIV("P2", R9A07G044_CLK_P2, CLK_PLL3_DIV2_4_2,
83+ DIVPL3A, dtable_1_32, CLK_DIVIDER_HIWORD_MASK),
7984 };
8085
8186 static struct rzg2l_mod_clk r9a07g044_mod_clks[] = {
82− DEF_MOD("gic", R9A07G044_CLK_GIC600,
83− R9A07G044_CLK_P1,
84− 0x514, BIT(0), (BIT(0) | BIT(1))),
85− DEF_MOD("ia55", R9A07G044_CLK_IA55,
86− R9A07G044_CLK_P1,
87− 0x518, (BIT(0) | BIT(1)), BIT(0)),
88− DEF_MOD("scif0", R9A07G044_CLK_SCIF0,
89− R9A07G044_CLK_P0,
90− 0x584, BIT(0), BIT(0)),
91− DEF_MOD("scif1", R9A07G044_CLK_SCIF1,
92− R9A07G044_CLK_P0,
93− 0x584, BIT(1), BIT(1)),
94− DEF_MOD("scif2", R9A07G044_CLK_SCIF2,
95− R9A07G044_CLK_P0,
96− 0x584, BIT(2), BIT(2)),
97− DEF_MOD("scif3", R9A07G044_CLK_SCIF3,
98− R9A07G044_CLK_P0,
99− 0x584, BIT(3), BIT(3)),
100− DEF_MOD("scif4", R9A07G044_CLK_SCIF4,
101− R9A07G044_CLK_P0,
102− 0x584, BIT(4), BIT(4)),
103− DEF_MOD("sci0", R9A07G044_CLK_SCI0,
104− R9A07G044_CLK_P0,
105− 0x588, BIT(0), BIT(0)),
87+ DEF_MOD("gic", R9A07G044_GIC600_GICCLK, R9A07G044_CLK_P1,
88+ 0x514, 0),
89+ DEF_MOD("ia55_pclk", R9A07G044_IA55_PCLK, R9A07G044_CLK_P2,
90+ 0x518, 0),
91+ DEF_MOD("ia55_clk", R9A07G044_IA55_CLK, R9A07G044_CLK_P1,
92+ 0x518, 1),
93+ DEF_MOD("scif0", R9A07G044_SCIF0_CLK_PCK, R9A07G044_CLK_P0,
94+ 0x584, 0),
95+ DEF_MOD("scif1", R9A07G044_SCIF1_CLK_PCK, R9A07G044_CLK_P0,
96+ 0x584, 1),
97+ DEF_MOD("scif2", R9A07G044_SCIF2_CLK_PCK, R9A07G044_CLK_P0,
98+ 0x584, 2),
99+ DEF_MOD("scif3", R9A07G044_SCIF3_CLK_PCK, R9A07G044_CLK_P0,
100+ 0x584, 3),
101+ DEF_MOD("scif4", R9A07G044_SCIF4_CLK_PCK, R9A07G044_CLK_P0,
102+ 0x584, 4),
103+ DEF_MOD("sci0", R9A07G044_SCI0_CLKP, R9A07G044_CLK_P0,
104+ 0x588, 0),
105+};
106+
107+static struct rzg2l_reset r9a07g044_resets[] = {
108+ DEF_RST(R9A07G044_GIC600_GICRESET_N, 0x814, 0),
109+ DEF_RST(R9A07G044_GIC600_DBG_GICRESET_N, 0x814, 1),
110+ DEF_RST(R9A07G044_IA55_RESETN, 0x818, 0),
111+ DEF_RST(R9A07G044_SCIF0_RST_SYSTEM_N, 0x884, 0),
112+ DEF_RST(R9A07G044_SCIF1_RST_SYSTEM_N, 0x884, 1),
113+ DEF_RST(R9A07G044_SCIF2_RST_SYSTEM_N, 0x884, 2),
114+ DEF_RST(R9A07G044_SCIF3_RST_SYSTEM_N, 0x884, 3),
115+ DEF_RST(R9A07G044_SCIF4_RST_SYSTEM_N, 0x884, 4),
116+ DEF_RST(R9A07G044_SCI0_RST, 0x888, 0),
106117 };
107118
108119 static const unsigned int r9a07g044_crit_mod_clks[] __initconst = {
109− MOD_CLK_BASE + R9A07G044_CLK_GIC600,
120+ MOD_CLK_BASE + R9A07G044_GIC600_GICCLK,
110121 };
111122
112123 const struct rzg2l_cpg_info r9a07g044_cpg_info = {
@@ -123,5 +134,9 @@ const struct rzg2l_cpg_info r9a07g044_cpg_info = { · 10 unmodified lines
123134 /* Module Clocks */
124135 .mod_clks = r9a07g044_mod_clks,
125136 .num_mod_clks = ARRAY_SIZE(r9a07g044_mod_clks),
126− .num_hw_mod_clks = R9A07G044_CLK_MIPI_DSI_PIN + 1,
137+ .num_hw_mod_clks = R9A07G044_TSU_PCLK + 1,
138+
139+ /* Resets */
140+ .resets = r9a07g044_resets,
141+ .num_resets = ARRAY_SIZE(r9a07g044_resets),
127142 };
drivers/clk/renesas/renesas-rzg2l-cpg.c+59−51
@@ -47,9 +47,9 @@ · 46 unmodified lines
4747 #define SDIV(val) DIV_RSMASK(val, 0, 0x7)
4848
4949 #define CLK_ON_R(reg) (reg)
50−#define CLK_MON_R(reg) (0x680 - 0x500 + (reg))
51−#define CLK_RST_R(reg) (0x800 - 0x500 + (reg))
52−#define CLK_MRST_R(reg) (0x980 - 0x500 + (reg))
50+#define CLK_MON_R(reg) (0x180 + (reg))
51+#define CLK_RST_R(reg) (reg)
52+#define CLK_MRST_R(reg) (0x180 + (reg))
5353
5454 #define GET_REG_OFFSET(val) ((val >> 20) & 0xfff)
5555 #define GET_REG_SAMPLL_CLK1(val) ((val >> 22) & 0xfff)
@@ -78,6 +78,7 @@ struct rzg2l_cpg_priv { · 22 unmodified lines
7878 struct clk **clks;
7979 unsigned int num_core_clks;
8080 unsigned int num_mod_clks;
81+ unsigned int num_resets;
8182 unsigned int last_dt_core_clk;
8283
8384 struct raw_notifier_head notifiers;
@@ -315,15 +316,13 @@ fail: · 231 unmodified lines
315316 *
316317 * @hw: handle between common and hardware-specific interfaces
317318 * @off: register offset
318− * @onoff: ON/MON bits
319− * @reset: reset bits
319+ * @bit: ON/MON bit
320320 * @priv: CPG/MSTP private data
321321 */
322322 struct mstp_clock {
323323 struct clk_hw hw;
324324 u16 off;
325− u8 onoff;
326− u8 reset;
325+ u8 bit;
327326 struct rzg2l_cpg_priv *priv;
328327 };
329328
@@ -337,6 +336,7 @@ static int rzg2l_mod_clock_endisable(struct clk_hw *hw, bool enable) · 7 unmodified lines
337336 struct device *dev = priv->dev;
338337 unsigned long flags;
339338 unsigned int i;
339+ u32 bitmask = BIT(clock->bit);
340340 u32 value;
341341
342342 if (!clock->off) {
@@ -349,9 +349,9 @@ static int rzg2l_mod_clock_endisable(struct clk_hw *hw, bool enable) · 6 unmodified lines
349349 spin_lock_irqsave(&priv->rmw_lock, flags);
350350
351351 if (enable)
352− value = (clock->onoff << 16) | clock->onoff;
352+ value = (bitmask << 16) | bitmask;
353353 else
354− value = clock->onoff << 16;
354+ value = bitmask << 16;
355355 writel(value, priv->base + CLK_ON_R(reg));
356356
357357 spin_unlock_irqrestore(&priv->rmw_lock, flags);
@@ -360,7 +360,7 @@ static int rzg2l_mod_clock_endisable(struct clk_hw *hw, bool enable) · 2 unmodified lines
360360 return 0;
361361
362362 for (i = 1000; i > 0; --i) {
363− if (((readl(priv->base + CLK_MON_R(reg))) & clock->onoff))
363+ if (((readl(priv->base + CLK_MON_R(reg))) & bitmask))
364364 break;
365365 cpu_relax();
366366 }
@@ -388,6 +388,7 @@ static int rzg2l_mod_clock_is_enabled(struct clk_hw *hw) · 21 unmodified lines
388388 {
389389 struct mstp_clock *clock = to_mod_clock(hw);
390390 struct rzg2l_cpg_priv *priv = clock->priv;
391+ u32 bitmask = BIT(clock->bit);
391392 u32 value;
392393
393394 if (!clock->off) {
@@ -397,7 +398,7 @@ static int rzg2l_mod_clock_is_enabled(struct clk_hw *hw) · 3 unmodified lines
397398
398399 value = readl(priv->base + CLK_MON_R(clock->off));
399400
400− return !(value & clock->onoff);
401+ return !(value & bitmask);
401402 }
402403
403404 static const struct clk_ops rzg2l_mod_clock_ops = {
@@ -457,8 +458,7 @@ rzg2l_cpg_register_mod_clk(const struct rzg2l_mod_clk *mod, · 53 unmodified lines
457458 init.num_parents = 1;
458459
459460 clock->off = mod->off;
460− clock->onoff = mod->onoff;
461− clock->reset = mod->reset;
461+ clock->bit = mod->bit;
462462 clock->priv = priv;
463463 clock->hw.init = &init;
464464
@@ -483,12 +483,11 @@ static int rzg2l_cpg_reset(struct reset_controller_dev *rcdev, · 18 unmodified lines
483483 {
484484 struct rzg2l_cpg_priv *priv = rcdev_to_priv(rcdev);
485485 const struct rzg2l_cpg_info *info = priv->info;
486− unsigned int reg = info->mod_clks[id].off;
487− u32 dis = info->mod_clks[id].reset;
486+ unsigned int reg = info->resets[id].off;
487+ u32 dis = BIT(info->resets[id].bit);
488488 u32 we = dis << 16;
489489
490− dev_dbg(rcdev->dev, "reset name:%s id:%ld offset:0x%x\n",
491− info->mod_clks[id].name, id, CLK_RST_R(reg));
490+ dev_dbg(rcdev->dev, "reset id:%ld offset:0x%x\n", id, CLK_RST_R(reg));
492491
493492 /* Reset module */
494493 writel(we, priv->base + CLK_RST_R(reg));
@@ -507,11 +506,10 @@ static int rzg2l_cpg_assert(struct reset_controller_dev *rcdev, · 12 unmodified lines
507506 {
508507 struct rzg2l_cpg_priv *priv = rcdev_to_priv(rcdev);
509508 const struct rzg2l_cpg_info *info = priv->info;
510− unsigned int reg = info->mod_clks[id].off;
511− u32 value = info->mod_clks[id].reset << 16;
509+ unsigned int reg = info->resets[id].off;
510+ u32 value = BIT(info->resets[id].bit) << 16;
512511
513− dev_dbg(rcdev->dev, "assert name:%s id:%ld offset:0x%x\n",
514− info->mod_clks[id].name, id, CLK_RST_R(reg));
512+ dev_dbg(rcdev->dev, "assert id:%ld offset:0x%x\n", id, CLK_RST_R(reg));
515513
516514 writel(value, priv->base + CLK_RST_R(reg));
517515 return 0;
@@ -522,12 +520,12 @@ static int rzg2l_cpg_deassert(struct reset_controller_dev *rcdev, · 4 unmodified lines
522520 {
523521 struct rzg2l_cpg_priv *priv = rcdev_to_priv(rcdev);
524522 const struct rzg2l_cpg_info *info = priv->info;
525− unsigned int reg = info->mod_clks[id].off;
526− u32 dis = info->mod_clks[id].reset;
523+ unsigned int reg = info->resets[id].off;
524+ u32 dis = BIT(info->resets[id].bit);
527525 u32 value = (dis << 16) | dis;
528526
529− dev_dbg(rcdev->dev, "deassert name:%s id:%ld offset:0x%x\n",
530− info->mod_clks[id].name, id, CLK_RST_R(reg));
527+ dev_dbg(rcdev->dev, "deassert id:%ld offset:0x%x\n", id,
528+ CLK_RST_R(reg));
531529
532530 writel(value, priv->base + CLK_RST_R(reg));
533531 return 0;
@@ -538,8 +536,8 @@ static int rzg2l_cpg_status(struct reset_controller_dev *rcdev, · 4 unmodified lines
538536 {
539537 struct rzg2l_cpg_priv *priv = rcdev_to_priv(rcdev);
540538 const struct rzg2l_cpg_info *info = priv->info;
541− unsigned int reg = info->mod_clks[id].off;
542− u32 bitmask = info->mod_clks[id].reset;
539+ unsigned int reg = info->resets[id].off;
540+ u32 bitmask = BIT(info->resets[id].bit);
543541
544542 return !(readl(priv->base + CLK_MRST_R(reg)) & bitmask);
545543 }
@@ -554,9 +552,11 @@ static const struct reset_control_ops rzg2l_cpg_reset_ops = { · 8 unmodified lines
554552 static int rzg2l_cpg_reset_xlate(struct reset_controller_dev *rcdev,
555553 const struct of_phandle_args *reset_spec)
556554 {
555+ struct rzg2l_cpg_priv *priv = rcdev_to_priv(rcdev);
556+ const struct rzg2l_cpg_info *info = priv->info;
557557 unsigned int id = reset_spec->args[0];
558558
559− if (id >= rcdev->nr_resets) {
559+ if (id >= rcdev->nr_resets || !info->resets[id].off) {
560560 dev_err(rcdev->dev, "Invalid reset index %u\n", id);
561561 return -EINVAL;
562562 }
@@ -571,7 +571,7 @@ static int rzg2l_cpg_reset_controller_register(struct rzg2l_cpg_priv *priv) · 8 unmodified lines
571571 priv->rcdev.dev = priv->dev;
572572 priv->rcdev.of_reset_n_cells = 1;
573573 priv->rcdev.of_xlate = rzg2l_cpg_reset_xlate;
574− priv->rcdev.nr_resets = priv->num_mod_clks;
574+ priv->rcdev.nr_resets = priv->num_resets;
575575
576576 return devm_reset_controller_register(priv->dev, &priv->rcdev);
577577 }
@@ -594,42 +594,49 @@ static int rzg2l_cpg_attach_dev(struct generic_pm_domain *unused, struct device · 16 unmodified lines
594594 {
595595 struct device_node *np = dev->of_node;
596596 struct of_phandle_args clkspec;
597+ bool once = true;
597598 struct clk *clk;
598599 int error;
599600 int i = 0;
600601
601602 while (!of_parse_phandle_with_args(np, "clocks", "#clock-cells", i,
602603 &clkspec)) {
603− if (rzg2l_cpg_is_pm_clk(&clkspec))
604− goto found;
605−
606− of_node_put(clkspec.np);
604+ if (rzg2l_cpg_is_pm_clk(&clkspec)) {
605+ if (once) {
606+ once = false;
607+ error = pm_clk_create(dev);
608+ if (error) {
609+ of_node_put(clkspec.np);
610+ goto err;
611+ }
612+ }
613+ clk = of_clk_get_from_provider(&clkspec);
614+ of_node_put(clkspec.np);
615+ if (IS_ERR(clk)) {
616+ error = PTR_ERR(clk);
617+ goto fail_destroy;
618+ }
619+
620+ error = pm_clk_add_clk(dev, clk);
621+ if (error) {
622+ dev_err(dev, "pm_clk_add_clk failed %d\n",
623+ error);
624+ goto fail_put;
625+ }
626+ } else {
627+ of_node_put(clkspec.np);
628+ }
607629 i++;
608630 }
609631
610632 return 0;
611633
612−found:
613− clk = of_clk_get_from_provider(&clkspec);
614− of_node_put(clkspec.np);
615−
616− if (IS_ERR(clk))
617− return PTR_ERR(clk);
618−
619− error = pm_clk_create(dev);
620− if (error)
621− goto fail_put;
622−
623− error = pm_clk_add_clk(dev, clk);
624− if (error)
625− goto fail_destroy;
626−
627− return 0;
634+fail_put:
635+ clk_put(clk);
628636
629637 fail_destroy:
630638 pm_clk_destroy(dev);
631−fail_put:
632− clk_put(clk);
639+err:
633640 return error;
634641 }
635642
@@ -692,6 +699,7 @@ static int __init rzg2l_cpg_probe(struct platform_device *pdev) · 56 unmodified lines
692699 priv->clks = clks;
693700 priv->num_core_clks = info->num_total_core_clks;
694701 priv->num_mod_clks = info->num_hw_mod_clks;
702+ priv->num_resets = info->num_resets;
695703 priv->last_dt_core_clk = info->last_dt_core_clk;
696704
697705 for (i = 0; i < nclks; i++)
drivers/clk/renesas/renesas-rzg2l-cpg.h+28−9
@@ -21,6 +21,7 @@ · 20 unmodified lines
2121 #define DDIV_PACK(offset, bitpos, size) \
2222 (((offset) << 20) | ((bitpos) << 12) | ((size) << 8))
2323 #define DIVPL2A DDIV_PACK(CPG_PL2_DDIV, 0, 3)
24+#define DIVPL3A DDIV_PACK(CPG_PL3A_DDIV, 0, 3)
2425 #define DIVPL3B DDIV_PACK(CPG_PL3A_DDIV, 4, 3)
2526
2627 /**
@@ -76,26 +77,40 @@ enum clk_types { · 49 unmodified lines
7677 * @id: clock index in array containing all Core and Module Clocks
7778 * @parent: id of parent clock
7879 * @off: register offset
79− * @onoff: ON/MON bits
80− * @reset: reset bits
80+ * @bit: ON/MON bit
8181 */
8282 struct rzg2l_mod_clk {
8383 const char *name;
8484 unsigned int id;
8585 unsigned int parent;
8686 u16 off;
87− u8 onoff;
88− u8 reset;
87+ u8 bit;
8988 };
9089
91−#define DEF_MOD(_name, _id, _parent, _off, _onoff, _reset) \
92− [_id] = { \
90+#define DEF_MOD(_name, _id, _parent, _off, _bit) \
91+ { \
9392 .name = _name, \
94− .id = MOD_CLK_BASE + _id, \
93+ .id = MOD_CLK_BASE + (_id), \
9594 .parent = (_parent), \
9695 .off = (_off), \
97− .onoff = (_onoff), \
98− .reset = (_reset) \
96+ .bit = (_bit), \
97+ }
98+
99+/**
100+ * struct rzg2l_reset - Reset definitions
101+ *
102+ * @off: register offset
103+ * @bit: reset bit
104+ */
105+struct rzg2l_reset {
106+ u16 off;
107+ u8 bit;
108+};
109+
110+#define DEF_RST(_id, _off, _bit) \
111+ [_id] = { \
112+ .off = (_off), \
113+ .bit = (_bit) \
99114 }
100115
101116 /**
@@ -126,6 +141,10 @@ struct rzg2l_cpg_info { · 24 unmodified lines
126141 unsigned int num_mod_clks;
127142 unsigned int num_hw_mod_clks;
128143
144+ /* Resets */
145+ const struct rzg2l_reset *resets;
146+ unsigned int num_resets;
147+
129148 /* Critical Module Clocks that should not be disabled */
130149 const unsigned int *crit_mod_clks;
131150 unsigned int num_crit_mod_clks;
drivers/cpufreq/longhaul.c+0−2
@@ -942,8 +942,6 @@ static int __init longhaul_init(void) · 941 unmodified lines
942942 return cpufreq_register_driver(&longhaul_driver);
943943 case 10:
944944 pr_err("Use acpi-cpufreq driver for VIA C7\n");
945− default:
946− ;
947945 }
948946
949947 return -ENODEV;
drivers/dma-buf/sync_file.c+7−6
@@ -211,8 +211,8 @@ static struct sync_file *sync_file_merge(const char *name, struct sync_file *a, · 210 unmodified lines
211211 struct sync_file *b)
212212 {
213213 struct sync_file *sync_file;
214− struct dma_fence **fences, **nfences, **a_fences, **b_fences;
215− int i, i_a, i_b, num_fences, a_num_fences, b_num_fences;
214+ struct dma_fence **fences = NULL, **nfences, **a_fences, **b_fences;
215+ int i = 0, i_a, i_b, num_fences, a_num_fences, b_num_fences;
216216
217217 sync_file = sync_file_alloc();
218218 if (!sync_file)
@@ -236,7 +236,7 @@ static struct sync_file *sync_file_merge(const char *name, struct sync_file *a, · 17 unmodified lines
236236 * If a sync_file can only be created with sync_file_merge
237237 * and sync_file_create, this is a reasonable assumption.
238238 */
239− for (i = i_a = i_b = 0; i_a < a_num_fences && i_b < b_num_fences; ) {
239+ for (i_a = i_b = 0; i_a < a_num_fences && i_b < b_num_fences; ) {
240240 struct dma_fence *pt_a = a_fences[i_a];
241241 struct dma_fence *pt_b = b_fences[i_b];
242242
@@ -277,15 +277,16 @@ static struct sync_file *sync_file_merge(const char *name, struct sync_file *a, · 34 unmodified lines
277277 fences = nfences;
278278 }
279279
280− if (sync_file_set_fence(sync_file, fences, i) < 0) {
281− kfree(fences);
280+ if (sync_file_set_fence(sync_file, fences, i) < 0)
282281 goto err;
283− }
284282
285283 strlcpy(sync_file->user_name, name, sizeof(sync_file->user_name));
286284 return sync_file;
287285
288286 err:
287+ while (i)
288+ dma_fence_put(fences[--i]);
289+ kfree(fences);
289290 fput(sync_file->file);
290291 return NULL;
291292
drivers/dma/ipu/ipu_idmac.c+2−0
@@ -618,6 +618,7 @@ static int ipu_enable_channel(struct idmac *idmac, struct idmac_channel *ichan) · 617 unmodified lines
618618 case IDMAC_SDC_1:
619619 case IDMAC_IC_7:
620620 ipu_channel_set_priority(ipu, channel, true);
621+ break;
621622 default:
622623 break;
623624 }
@@ -978,6 +979,7 @@ static int ipu_init_channel(struct idmac *idmac, struct idmac_channel *ichan) · 354 unmodified lines
978979 case IDMAC_SDC_0:
979980 case IDMAC_SDC_1:
980981 n_desc = 4;
982+ break;
981983 default:
982984 break;
983985 }
drivers/dma/mpc512x_dma.c+1−0
@@ -813,6 +813,7 @@ inline bool is_buswidth_valid(u8 buswidth, bool is_mpc8308) · 812 unmodified lines
813813 case 16:
814814 if (is_mpc8308)
815815 return false;
816+ break;
816817 case 1:
817818 case 2:
818819 case 4:
drivers/dma/ti/k3-udma.c+1−0
@@ -4948,6 +4948,7 @@ static int setup_resources(struct udma_dev *ud) · 4947 unmodified lines
49484948 ud->tchan_cnt),
49494949 ud->rchan_cnt - bitmap_weight(ud->rchan_map,
49504950 ud->rchan_cnt));
4951+ break;
49514952 default:
49524953 break;
49534954 }
drivers/edac/Kconfig+1−1
@@ -271,7 +271,7 @@ config EDAC_PND2 · 270 unmodified lines
271271 config EDAC_IGEN6
272272 tristate "Intel client SoC Integrated MC"
273273 depends on PCI && PCI_MMCONFIG && ARCH_HAVE_NMI_SAFE_CMPXCHG
274− depends on X64_64 && X86_MCE_INTEL
274+ depends on X86_64 && X86_MCE_INTEL
275275 help
276276 Support for error detection and correction on the Intel
277277 client SoC Integrated Memory Controller using In-Band ECC IP.
drivers/firmware/arm_ffa/bus.c+3−3
@@ -46,9 +46,6 @@ static int ffa_device_probe(struct device *dev) · 45 unmodified lines
4646 struct ffa_driver *ffa_drv = to_ffa_driver(dev->driver);
4747 struct ffa_device *ffa_dev = to_ffa_dev(dev);
4848
49− if (!ffa_device_match(dev, dev->driver))
50− return -ENODEV;
51−
5249 return ffa_drv->probe(ffa_dev);
5350 }
5451
@@ -99,6 +96,9 @@ int ffa_driver_register(struct ffa_driver *driver, struct module *owner, · 44 unmodified lines
9996 {
10097 int ret;
10198
99+ if (!driver->probe)
100+ return -EINVAL;
101+
102102 driver->driver.bus = &ffa_bus_type;
103103 driver->driver.name = driver->name;
104104 driver->driver.owner = owner;
drivers/firmware/arm_ffa/driver.c+5−3
@@ -120,7 +120,7 @@ · 119 unmodified lines
120120 #define PACK_TARGET_INFO(s, r) \
121121 (FIELD_PREP(SENDER_ID_MASK, (s)) | FIELD_PREP(RECEIVER_ID_MASK, (r)))
122122
123−/**
123+/*
124124 * FF-A specification mentions explicitly about '4K pages'. This should
125125 * not be confused with the kernel PAGE_SIZE, which is the translation
126126 * granule kernel is configured and may be one among 4K, 16K and 64K.
@@ -149,8 +149,10 @@ static const int ffa_linux_errmap[] = { · 22 unmodified lines
149149
150150 static inline int ffa_to_linux_errno(int errno)
151151 {
152− if (errno < FFA_RET_SUCCESS && errno >= -ARRAY_SIZE(ffa_linux_errmap))
153− return ffa_linux_errmap[-errno];
152+ int err_idx = -errno;
153+
154+ if (err_idx >= 0 && err_idx < ARRAY_SIZE(ffa_linux_errmap))
155+ return ffa_linux_errmap[err_idx];
154156 return -EINVAL;
155157 }
156158
drivers/firmware/arm_scmi/bus.c+3−5
@@ -104,11 +104,6 @@ static int scmi_dev_probe(struct device *dev) · 103 unmodified lines
104104 {
105105 struct scmi_driver *scmi_drv = to_scmi_driver(dev->driver);
106106 struct scmi_device *scmi_dev = to_scmi_dev(dev);
107− const struct scmi_device_id *id;
108−
109− id = scmi_dev_match_id(scmi_dev, scmi_drv);
110− if (!id)
111− return -ENODEV;
112107
113108 if (!scmi_dev->handle)
114109 return -EPROBE_DEFER;
@@ -139,6 +134,9 @@ int scmi_driver_register(struct scmi_driver *driver, struct module *owner, · 24 unmodified lines
139134 {
140135 int retval;
141136
137+ if (!driver->probe)
138+ return -EINVAL;
139+
142140 retval = scmi_protocol_device_request(driver->id_table);
143141 if (retval)
144142 return retval;
drivers/firmware/arm_scmi/driver.c+9−5
@@ -47,7 +47,6 @@ enum scmi_error_codes { · 46 unmodified lines
4747 SCMI_ERR_GENERIC = -8, /* Generic Error */
4848 SCMI_ERR_HARDWARE = -9, /* Hardware Error */
4949 SCMI_ERR_PROTOCOL = -10,/* Protocol Error */
50− SCMI_ERR_MAX
5150 };
5251
5352 /* List of all SCMI devices active in system */
@@ -166,8 +165,10 @@ static const int scmi_linux_errmap[] = { · 112 unmodified lines
166165
167166 static inline int scmi_to_linux_errno(int errno)
168167 {
169− if (errno < SCMI_SUCCESS && errno > SCMI_ERR_MAX)
170− return scmi_linux_errmap[-errno];
168+ int err_idx = -errno;
169+
170+ if (err_idx >= SCMI_SUCCESS && err_idx < ARRAY_SIZE(scmi_linux_errmap))
171+ return scmi_linux_errmap[err_idx];
171172 return -EIO;
172173 }
173174
@@ -1025,8 +1026,9 @@ static int __scmi_xfer_info_init(struct scmi_info *sinfo, · 851 unmodified lines
10251026 const struct scmi_desc *desc = sinfo->desc;
10261027
10271028 /* Pre-allocated messages, no more than what hdr.seq can support */
1028− if (WARN_ON(desc->max_msg >= MSG_TOKEN_MAX)) {
1029− dev_err(dev, "Maximum message of %d exceeds supported %ld\n",
1029+ if (WARN_ON(!desc->max_msg || desc->max_msg > MSG_TOKEN_MAX)) {
1030+ dev_err(dev,
1031+ "Invalid maximum messages %d, not in range [1 - %lu]\n",
10301032 desc->max_msg, MSG_TOKEN_MAX);
10311033 return -EINVAL;
10321034 }
@@ -1137,6 +1139,8 @@ scmi_txrx_setup(struct scmi_info *info, struct device *dev, int prot_id) · 104 unmodified lines
11371139 * @proto_id and @name: if device was still not existent it is created as a
11381140 * child of the specified SCMI instance @info and its transport properly
11391141 * initialized as usual.
1142+ *
1143+ * Return: A properly initialized scmi device, NULL otherwise.
11401144 */
11411145 static inline struct scmi_device *
11421146 scmi_get_protocol_device(struct device_node *np, struct scmi_info *info,
drivers/firmware/arm_scmi/notify.c+4−0
@@ -1457,6 +1457,8 @@ static void scmi_devm_release_notifier(struct device *dev, void *res) · 1456 unmodified lines
14571457 *
14581458 * Generic devres managed helper to register a notifier_block against a
14591459 * protocol event.
1460+ *
1461+ * Return: 0 on Success
14601462 */
14611463 static int scmi_devm_notifier_register(struct scmi_device *sdev,
14621464 u8 proto_id, u8 evt_id,
@@ -1523,6 +1525,8 @@ static int scmi_devm_notifier_match(struct device *dev, void *res, void *data) · 60 unmodified lines
15231525 * Generic devres managed helper to explicitly un-register a notifier_block
15241526 * against a protocol event, which was previously registered using the above
15251527 * @scmi_devm_notifier_register.
1528+ *
1529+ * Return: 0 on Success
15261530 */
15271531 static int scmi_devm_notifier_unregister(struct scmi_device *sdev,
15281532 u8 proto_id, u8 evt_id,
drivers/firmware/arm_scmi/sensors.c+4−2
@@ -166,7 +166,8 @@ struct scmi_msg_sensor_reading_get { · 165 unmodified lines
166166
167167 struct scmi_resp_sensor_reading_complete {
168168 __le32 id;
169− __le64 readings;
169+ __le32 readings_low;
170+ __le32 readings_high;
170171 };
171172
172173 struct scmi_sensor_reading_resp {
@@ -717,7 +718,8 @@ static int scmi_sensor_reading_get(const struct scmi_protocol_handle *ph, · 544 unmodified lines
717718
718719 resp = t->rx.buf;
719720 if (le32_to_cpu(resp->id) == sensor_id)
720− *value = get_unaligned_le64(&resp->readings);
721+ *value =
722+ get_unaligned_le64(&resp->readings_low);
721723 else
722724 ret = -EPROTO;
723725 }
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h+1−1
@@ -269,7 +269,7 @@ int amdgpu_amdkfd_gpuvm_free_memory_of_gpu( · 268 unmodified lines
269269 struct kgd_dev *kgd, struct kgd_mem *mem, void *drm_priv,
270270 uint64_t *size);
271271 int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
272− struct kgd_dev *kgd, struct kgd_mem *mem, void *drm_priv, bool *table_freed);
272+ struct kgd_dev *kgd, struct kgd_mem *mem, void *drm_priv);
273273 int amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu(
274274 struct kgd_dev *kgd, struct kgd_mem *mem, void *drm_priv);
275275 int amdgpu_amdkfd_gpuvm_sync_memory(
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c+9−13
@@ -1057,8 +1057,7 @@ static void unmap_bo_from_gpuvm(struct kgd_mem *mem, · 1056 unmodified lines
10571057
10581058 static int update_gpuvm_pte(struct kgd_mem *mem,
10591059 struct kfd_mem_attachment *entry,
1060− struct amdgpu_sync *sync,
1061− bool *table_freed)
1060+ struct amdgpu_sync *sync)
10621061 {
10631062 struct amdgpu_bo_va *bo_va = entry->bo_va;
10641063 struct amdgpu_device *adev = entry->adev;
@@ -1069,7 +1068,7 @@ static int update_gpuvm_pte(struct kgd_mem *mem, · 4 unmodified lines
10691068 return ret;
10701069
10711070 /* Update the page tables */
1072− ret = amdgpu_vm_bo_update(adev, bo_va, false, table_freed);
1071+ ret = amdgpu_vm_bo_update(adev, bo_va, false);
10731072 if (ret) {
10741073 pr_err("amdgpu_vm_bo_update failed\n");
10751074 return ret;
@@ -1081,8 +1080,7 @@ static int update_gpuvm_pte(struct kgd_mem *mem, · 5 unmodified lines
10811080 static int map_bo_to_gpuvm(struct kgd_mem *mem,
10821081 struct kfd_mem_attachment *entry,
10831082 struct amdgpu_sync *sync,
1084− bool no_update_pte,
1085− bool *table_freed)
1083+ bool no_update_pte)
10861084 {
10871085 int ret;
10881086
@@ -1099,7 +1097,7 @@ static int map_bo_to_gpuvm(struct kgd_mem *mem, · 10 unmodified lines
10991097 if (no_update_pte)
11001098 return 0;
11011099
1102− ret = update_gpuvm_pte(mem, entry, sync, table_freed);
1100+ ret = update_gpuvm_pte(mem, entry, sync);
11031101 if (ret) {
11041102 pr_err("update_gpuvm_pte() failed\n");
11051103 goto update_gpuvm_pte_failed;
@@ -1393,8 +1391,7 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu( · 287 unmodified lines
13931391 domain = alloc_domain = AMDGPU_GEM_DOMAIN_VRAM;
13941392 alloc_flags = AMDGPU_GEM_CREATE_VRAM_WIPE_ON_RELEASE;
13951393 alloc_flags |= (flags & KFD_IOC_ALLOC_MEM_FLAGS_PUBLIC) ?
1396− AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED :
1397− AMDGPU_GEM_CREATE_NO_CPU_ACCESS;
1394+ AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED : 0;
13981395 } else if (flags & KFD_IOC_ALLOC_MEM_FLAGS_GTT) {
13991396 domain = alloc_domain = AMDGPU_GEM_DOMAIN_GTT;
14001397 alloc_flags = 0;
@@ -1597,8 +1594,7 @@ int amdgpu_amdkfd_gpuvm_free_memory_of_gpu( · 196 unmodified lines
15971594 }
15981595
15991596 int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
1600− struct kgd_dev *kgd, struct kgd_mem *mem,
1601− void *drm_priv, bool *table_freed)
1597+ struct kgd_dev *kgd, struct kgd_mem *mem, void *drm_priv)
16021598 {
16031599 struct amdgpu_device *adev = get_amdgpu_device(kgd);
16041600 struct amdgpu_vm *avm = drm_priv_to_vm(drm_priv);
@@ -1686,7 +1682,7 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu( · 81 unmodified lines
16861682 entry->va, entry->va + bo_size, entry);
16871683
16881684 ret = map_bo_to_gpuvm(mem, entry, ctx.sync,
1689− is_invalid_userptr, table_freed);
1685+ is_invalid_userptr);
16901686 if (ret) {
16911687 pr_err("Failed to map bo to gpuvm\n");
16921688 goto out_unreserve;
@@ -2136,7 +2132,7 @@ static int validate_invalid_user_pages(struct amdkfd_process_info *process_info) · 443 unmodified lines
21362132 continue;
21372133
21382134 kfd_mem_dmaunmap_attachment(mem, attachment);
2139− ret = update_gpuvm_pte(mem, attachment, &sync, NULL);
2135+ ret = update_gpuvm_pte(mem, attachment, &sync);
21402136 if (ret) {
21412137 pr_err("%s: update PTE failed\n", __func__);
21422138 /* make sure this gets validated again */
@@ -2342,7 +2338,7 @@ int amdgpu_amdkfd_gpuvm_restore_process_bos(void *info, struct dma_fence **ef) · 199 unmodified lines
23422338 continue;
23432339
23442340 kfd_mem_dmaunmap_attachment(mem, attachment);
2345− ret = update_gpuvm_pte(mem, attachment, &sync_obj, NULL);
2341+ ret = update_gpuvm_pte(mem, attachment, &sync_obj);
23462342 if (ret) {
23472343 pr_debug("Memory eviction: update PTE failed. Try again\n");
23482344 goto validate_map_fail;
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c+3−3
@@ -781,7 +781,7 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p) · 780 unmodified lines
781781 if (r)
782782 return r;
783783
784− r = amdgpu_vm_bo_update(adev, fpriv->prt_va, false, NULL);
784+ r = amdgpu_vm_bo_update(adev, fpriv->prt_va, false);
785785 if (r)
786786 return r;
787787
@@ -792,7 +792,7 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p) · 4 unmodified lines
792792 if (amdgpu_mcbp || amdgpu_sriov_vf(adev)) {
793793 bo_va = fpriv->csa_va;
794794 BUG_ON(!bo_va);
795− r = amdgpu_vm_bo_update(adev, bo_va, false, NULL);
795+ r = amdgpu_vm_bo_update(adev, bo_va, false);
796796 if (r)
797797 return r;
798798
@@ -811,7 +811,7 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p) · 12 unmodified lines
811811 if (bo_va == NULL)
812812 continue;
813813
814− r = amdgpu_vm_bo_update(adev, bo_va, false, NULL);
814+ r = amdgpu_vm_bo_update(adev, bo_va, false);
815815 if (r)
816816 return r;
817817
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c+1−0
@@ -1168,6 +1168,7 @@ static const struct pci_device_id pciidlist[] = { · 1167 unmodified lines
11681168 {0x1002, 0x734F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI14},
11691169
11701170 /* Renoir */
1171+ {0x1002, 0x15E7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RENOIR|AMD_IS_APU},
11711172 {0x1002, 0x1636, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RENOIR|AMD_IS_APU},
11721173 {0x1002, 0x1638, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RENOIR|AMD_IS_APU},
11731174 {0x1002, 0x164C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RENOIR|AMD_IS_APU},
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c+1−1
@@ -612,7 +612,7 @@ static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev, · 611 unmodified lines
612612
613613 if (operation == AMDGPU_VA_OP_MAP ||
614614 operation == AMDGPU_VA_OP_REPLACE) {
615− r = amdgpu_vm_bo_update(adev, bo_va, false, NULL);
615+ r = amdgpu_vm_bo_update(adev, bo_va, false);
616616 if (r)
617617 goto error;
618618 }
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c+18−0
@@ -278,6 +278,21 @@ static bool amdgpu_msi_ok(struct amdgpu_device *adev) · 277 unmodified lines
278278 return true;
279279 }
280280
281+static void amdgpu_restore_msix(struct amdgpu_device *adev)
282+{
283+ u16 ctrl;
284+
285+ pci_read_config_word(adev->pdev, adev->pdev->msix_cap + PCI_MSIX_FLAGS, &ctrl);
286+ if (!(ctrl & PCI_MSIX_FLAGS_ENABLE))
287+ return;
288+
289+ /* VF FLR */
290+ ctrl &= ~PCI_MSIX_FLAGS_ENABLE;
291+ pci_write_config_word(adev->pdev, adev->pdev->msix_cap + PCI_MSIX_FLAGS, ctrl);
292+ ctrl |= PCI_MSIX_FLAGS_ENABLE;
293+ pci_write_config_word(adev->pdev, adev->pdev->msix_cap + PCI_MSIX_FLAGS, ctrl);
294+}
295+
281296 /**
282297 * amdgpu_irq_init - initialize interrupt handling
283298 *
@@ -569,6 +584,9 @@ void amdgpu_irq_gpu_reset_resume_helper(struct amdgpu_device *adev) · 285 unmodified lines
569584 {
570585 int i, j, k;
571586
587+ if (amdgpu_sriov_vf(adev))
588+ amdgpu_restore_msix(adev);
589+
572590 for (i = 0; i < AMDGPU_IRQ_CLIENTID_MAX; ++i) {
573591 if (!adev->irq.client[i].sources)
574592 continue;
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c+35−14
@@ -809,7 +809,7 @@ static int amdgpu_ras_enable_all_features(struct amdgpu_device *adev, · 808 unmodified lines
809809
810810 /* query/inject/cure begin */
811811 int amdgpu_ras_query_error_status(struct amdgpu_device *adev,
812− struct ras_query_if *info)
812+ struct ras_query_if *info)
813813 {
814814 struct ras_manager *obj = amdgpu_ras_find_obj(adev, &info->head);
815815 struct ras_err_data err_data = {0, 0, 0, NULL};
@@ -1043,17 +1043,32 @@ int amdgpu_ras_error_inject(struct amdgpu_device *adev, · 227 unmodified lines
10431043 return ret;
10441044 }
10451045
1046−/* get the total error counts on all IPs */
1047−void amdgpu_ras_query_error_count(struct amdgpu_device *adev,
1048− unsigned long *ce_count,
1049− unsigned long *ue_count)
1046+/**
1047+ * amdgpu_ras_query_error_count -- Get error counts of all IPs
1048+ * adev: pointer to AMD GPU device
1049+ * ce_count: pointer to an integer to be set to the count of correctible errors.
1050+ * ue_count: pointer to an integer to be set to the count of uncorrectible
1051+ * errors.
1052+ *
1053+ * If set, @ce_count or @ue_count, count and return the corresponding
1054+ * error counts in those integer pointers. Return 0 if the device
1055+ * supports RAS. Return -EOPNOTSUPP if the device doesn't support RAS.
1056+ */
1057+int amdgpu_ras_query_error_count(struct amdgpu_device *adev,
1058+ unsigned long *ce_count,
1059+ unsigned long *ue_count)
10501060 {
10511061 struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
10521062 struct ras_manager *obj;
10531063 unsigned long ce, ue;
10541064
10551065 if (!adev->ras_enabled || !con)
1056− return;
1066+ return -EOPNOTSUPP;
1067+
1068+ /* Don't count since no reporting.
1069+ */
1070+ if (!ce_count && !ue_count)
1071+ return 0;
10571072
10581073 ce = 0;
10591074 ue = 0;
@@ -1061,9 +1076,11 @@ void amdgpu_ras_query_error_count(struct amdgpu_device *adev, · 1 unmodified line
10611076 struct ras_query_if info = {
10621077 .head = obj->head,
10631078 };
1079+ int res;
10641080
1065− if (amdgpu_ras_query_error_status(adev, &info))
1066− return;
1081+ res = amdgpu_ras_query_error_status(adev, &info);
1082+ if (res)
1083+ return res;
10671084
10681085 ce += info.ce_count;
10691086 ue += info.ue_count;
@@ -1074,6 +1091,8 @@ void amdgpu_ras_query_error_count(struct amdgpu_device *adev, · 4 unmodified lines
10741091
10751092 if (ue_count)
10761093 *ue_count = ue;
1094+
1095+ return 0;
10771096 }
10781097 /* query/inject/cure end */
10791098
@@ -2137,9 +2156,10 @@ static void amdgpu_ras_counte_dw(struct work_struct *work) · 1057 unmodified lines
21372156
21382157 /* Cache new values.
21392158 */
2140− amdgpu_ras_query_error_count(adev, &ce_count, &ue_count);
2141− atomic_set(&con->ras_ce_count, ce_count);
2142− atomic_set(&con->ras_ue_count, ue_count);
2159+ if (amdgpu_ras_query_error_count(adev, &ce_count, &ue_count) == 0) {
2160+ atomic_set(&con->ras_ce_count, ce_count);
2161+ atomic_set(&con->ras_ue_count, ue_count);
2162+ }
21432163
21442164 pm_runtime_mark_last_busy(dev->dev);
21452165 Out:
@@ -2312,9 +2332,10 @@ int amdgpu_ras_late_init(struct amdgpu_device *adev, · 166 unmodified lines
23122332
23132333 /* Those are the cached values at init.
23142334 */
2315− amdgpu_ras_query_error_count(adev, &ce_count, &ue_count);
2316− atomic_set(&con->ras_ce_count, ce_count);
2317− atomic_set(&con->ras_ue_count, ue_count);
2335+ if (amdgpu_ras_query_error_count(adev, &ce_count, &ue_count) == 0) {
2336+ atomic_set(&con->ras_ce_count, ce_count);
2337+ atomic_set(&con->ras_ue_count, ue_count);
2338+ }
23182339
23192340 return 0;
23202341 cleanup:
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h+3−3
@@ -490,9 +490,9 @@ int amdgpu_ras_request_reset_on_boot(struct amdgpu_device *adev, · 489 unmodified lines
490490 void amdgpu_ras_resume(struct amdgpu_device *adev);
491491 void amdgpu_ras_suspend(struct amdgpu_device *adev);
492492
493−void amdgpu_ras_query_error_count(struct amdgpu_device *adev,
494− unsigned long *ce_count,
495− unsigned long *ue_count);
493+int amdgpu_ras_query_error_count(struct amdgpu_device *adev,
494+ unsigned long *ce_count,
495+ unsigned long *ue_count);
496496
497497 /* error handling functions */
498498 int amdgpu_ras_add_bad_pages(struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c+5−6
@@ -1758,7 +1758,7 @@ int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev, · 1757 unmodified lines
17581758 r = vm->update_funcs->commit(&params, fence);
17591759
17601760 if (table_freed)
1761− *table_freed = *table_freed || params.table_freed;
1761+ *table_freed = params.table_freed;
17621762
17631763 error_unlock:
17641764 amdgpu_vm_eviction_unlock(vm);
@@ -1816,7 +1816,6 @@ void amdgpu_vm_get_memory(struct amdgpu_vm *vm, uint64_t *vram_mem, · 51 unmodified lines
18161816 * @adev: amdgpu_device pointer
18171817 * @bo_va: requested BO and VM object
18181818 * @clear: if true clear the entries
1819− * @table_freed: return true if page table is freed
18201819 *
18211820 * Fill in the page table entries for @bo_va.
18221821 *
@@ -1824,7 +1823,7 @@ void amdgpu_vm_get_memory(struct amdgpu_vm *vm, uint64_t *vram_mem, · 1 unmodified line
18241823 * 0 for success, -EINVAL for failure.
18251824 */
18261825 int amdgpu_vm_bo_update(struct amdgpu_device *adev, struct amdgpu_bo_va *bo_va,
1827− bool clear, bool *table_freed)
1826+ bool clear)
18281827 {
18291828 struct amdgpu_bo *bo = bo_va->base.bo;
18301829 struct amdgpu_vm *vm = bo_va->base.vm;
@@ -1903,7 +1902,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, struct amdgpu_bo_va *bo_va, · 72 unmodified lines
19031902 resv, mapping->start,
19041903 mapping->last, update_flags,
19051904 mapping->offset, mem,
1906− pages_addr, last_update, table_freed);
1905+ pages_addr, last_update, NULL);
19071906 if (r)
19081907 return r;
19091908 }
@@ -2155,7 +2154,7 @@ int amdgpu_vm_handle_moved(struct amdgpu_device *adev, · 245 unmodified lines
21552154
21562155 list_for_each_entry_safe(bo_va, tmp, &vm->moved, base.vm_status) {
21572156 /* Per VM BOs never need to bo cleared in the page tables */
2158− r = amdgpu_vm_bo_update(adev, bo_va, false, NULL);
2157+ r = amdgpu_vm_bo_update(adev, bo_va, false);
21592158 if (r)
21602159 return r;
21612160 }
@@ -2174,7 +2173,7 @@ int amdgpu_vm_handle_moved(struct amdgpu_device *adev, · 12 unmodified lines
21742173 else
21752174 clear = true;
21762175
2177− r = amdgpu_vm_bo_update(adev, bo_va, clear, NULL);
2176+ r = amdgpu_vm_bo_update(adev, bo_va, clear);
21782177 if (r)
21792178 return r;
21802179
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h+1−1
@@ -406,7 +406,7 @@ int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev, · 405 unmodified lines
406406 struct dma_fence **fence, bool *free_table);
407407 int amdgpu_vm_bo_update(struct amdgpu_device *adev,
408408 struct amdgpu_bo_va *bo_va,
409− bool clear, bool *table_freed);
409+ bool clear);
410410 bool amdgpu_vm_evictable(struct amdgpu_bo *bo);
411411 void amdgpu_vm_bo_invalidate(struct amdgpu_device *adev,
412412 struct amdgpu_bo *bo, bool evicted);
drivers/gpu/drm/amd/amdgpu/dce_virtual.c+1−1
@@ -766,7 +766,7 @@ static const struct amdgpu_irq_src_funcs dce_virtual_crtc_irq_funcs = { · 765 unmodified lines
766766
767767 static void dce_virtual_set_irq_funcs(struct amdgpu_device *adev)
768768 {
769− adev->crtc_irq.num_types = AMDGPU_CRTC_IRQ_VBLANK6 + 1;
769+ adev->crtc_irq.num_types = adev->mode_info.num_crtc;
770770 adev->crtc_irq.funcs = &dce_virtual_crtc_irq_funcs;
771771 }
772772
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c+2−2
@@ -252,7 +252,7 @@ static void xgpu_ai_mailbox_flr_work(struct work_struct *work) · 251 unmodified lines
252252 * otherwise the mailbox msg will be ruined/reseted by
253253 * the VF FLR.
254254 */
255− if (!down_read_trylock(&adev->reset_sem))
255+ if (!down_write_trylock(&adev->reset_sem))
256256 return;
257257
258258 amdgpu_virt_fini_data_exchange(adev);
@@ -268,7 +268,7 @@ static void xgpu_ai_mailbox_flr_work(struct work_struct *work) · 9 unmodified lines
268268
269269 flr_done:
270270 atomic_set(&adev->in_gpu_reset, 0);
271− up_read(&adev->reset_sem);
271+ up_write(&adev->reset_sem);
272272
273273 /* Trigger recovery for world switch failure if no TDR */
274274 if (amdgpu_device_should_recover_gpu(adev)
drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c+2−2
@@ -273,7 +273,7 @@ static void xgpu_nv_mailbox_flr_work(struct work_struct *work) · 272 unmodified lines
273273 * otherwise the mailbox msg will be ruined/reseted by
274274 * the VF FLR.
275275 */
276− if (!down_read_trylock(&adev->reset_sem))
276+ if (!down_write_trylock(&adev->reset_sem))
277277 return;
278278
279279 amdgpu_virt_fini_data_exchange(adev);
@@ -289,7 +289,7 @@ static void xgpu_nv_mailbox_flr_work(struct work_struct *work) · 9 unmodified lines
289289
290290 flr_done:
291291 atomic_set(&adev->in_gpu_reset, 0);
292− up_read(&adev->reset_sem);
292+ up_write(&adev->reset_sem);
293293
294294 /* Trigger recovery for world switch failure if no TDR */
295295 if (amdgpu_device_should_recover_gpu(adev)
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c+12−33
@@ -1393,7 +1393,6 @@ static int kfd_ioctl_map_memory_to_gpu(struct file *filep, · 1392 unmodified lines
13931393 long err = 0;
13941394 int i;
13951395 uint32_t *devices_arr = NULL;
1396− bool table_freed = false;
13971396
13981397 dev = kfd_device_by_id(GET_GPU_ID(args->handle));
13991398 if (!dev)
@@ -1451,8 +1450,7 @@ static int kfd_ioctl_map_memory_to_gpu(struct file *filep, · 51 unmodified lines
14511450 goto get_mem_obj_from_handle_failed;
14521451 }
14531452 err = amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
1454− peer->kgd, (struct kgd_mem *)mem,
1455− peer_pdd->drm_priv, &table_freed);
1453+ peer->kgd, (struct kgd_mem *)mem, peer_pdd->drm_priv);
14561454 if (err) {
14571455 pr_err("Failed to map to gpu %d/%d\n",
14581456 i, args->n_devices);
@@ -1470,17 +1468,16 @@ static int kfd_ioctl_map_memory_to_gpu(struct file *filep, · 11 unmodified lines
14701468 }
14711469
14721470 /* Flush TLBs after waiting for the page table updates to complete */
1473− if (table_freed) {
1474− for (i = 0; i < args->n_devices; i++) {
1475− peer = kfd_device_by_id(devices_arr[i]);
1476− if (WARN_ON_ONCE(!peer))
1477− continue;
1478− peer_pdd = kfd_get_process_device_data(peer, p);
1479− if (WARN_ON_ONCE(!peer_pdd))
1480− continue;
1481− kfd_flush_tlb(peer_pdd, TLB_FLUSH_LEGACY);
1482− }
1471+ for (i = 0; i < args->n_devices; i++) {
1472+ peer = kfd_device_by_id(devices_arr[i]);
1473+ if (WARN_ON_ONCE(!peer))
1474+ continue;
1475+ peer_pdd = kfd_get_process_device_data(peer, p);
1476+ if (WARN_ON_ONCE(!peer_pdd))
1477+ continue;
1478+ kfd_flush_tlb(peer_pdd, TLB_FLUSH_LEGACY);
14831479 }
1480+
14841481 kfree(devices_arr);
14851482
14861483 return err;
@@ -1568,27 +1565,10 @@ static int kfd_ioctl_unmap_memory_from_gpu(struct file *filep, · 81 unmodified lines
15681565 }
15691566 args->n_success = i+1;
15701567 }
1571− mutex_unlock(&p->mutex);
1572−
1573− err = amdgpu_amdkfd_gpuvm_sync_memory(dev->kgd, (struct kgd_mem *) mem, true);
1574− if (err) {
1575− pr_debug("Sync memory failed, wait interrupted by user signal\n");
1576− goto sync_memory_failed;
1577− }
1578−
1579− /* Flush TLBs after waiting for the page table updates to complete */
1580− for (i = 0; i < args->n_devices; i++) {
1581− peer = kfd_device_by_id(devices_arr[i]);
1582− if (WARN_ON_ONCE(!peer))
1583− continue;
1584− peer_pdd = kfd_get_process_device_data(peer, p);
1585− if (WARN_ON_ONCE(!peer_pdd))
1586− continue;
1587− kfd_flush_tlb(peer_pdd, TLB_FLUSH_HEAVYWEIGHT);
1588− }
1589−
15901568 kfree(devices_arr);
15911569
1570+ mutex_unlock(&p->mutex);
1571+
15921572 return 0;
15931573
15941574 bind_process_to_device_failed:
@@ -1596,7 +1576,6 @@ get_mem_obj_from_handle_failed: · 1 unmodified line
15961576 unmap_memory_from_gpu_failed:
15971577 mutex_unlock(&p->mutex);
15981578 copy_from_user_failed:
1599−sync_memory_failed:
16001579 kfree(devices_arr);
16011580 return err;
16021581 }
drivers/gpu/drm/amd/amdkfd/kfd_process.c+1−2
@@ -714,8 +714,7 @@ static int kfd_process_alloc_gpuvm(struct kfd_process_device *pdd, · 713 unmodified lines
714714 if (err)
715715 goto err_alloc_mem;
716716
717− err = amdgpu_amdkfd_gpuvm_map_memory_to_gpu(kdev->kgd, mem,
718− pdd->drm_priv, NULL);
717+ err = amdgpu_amdkfd_gpuvm_map_memory_to_gpu(kdev->kgd, mem, pdd->drm_priv);
719718 if (err)
720719 goto err_map_mem;
721720
drivers/gpu/drm/amd/amdkfd/kfd_svm.c+18−12
@@ -2375,21 +2375,27 @@ static bool svm_range_skip_recover(struct svm_range *prange) · 2374 unmodified lines
23752375
23762376 static void
23772377 svm_range_count_fault(struct amdgpu_device *adev, struct kfd_process *p,
2378− struct svm_range *prange, int32_t gpuidx)
2378+ int32_t gpuidx)
23792379 {
23802380 struct kfd_process_device *pdd;
23812381
2382− if (gpuidx == MAX_GPU_INSTANCE)
2383− /* fault is on different page of same range
2384− * or fault is skipped to recover later
2385− */
2386− pdd = svm_range_get_pdd_by_adev(prange, adev);
2387− else
2388− /* fault recovered
2389− * or fault cannot recover because GPU no access on the range
2390− */
2391− pdd = kfd_process_device_from_gpuidx(p, gpuidx);
2382+ /* fault is on different page of same range
2383+ * or fault is skipped to recover later
2384+ * or fault is on invalid virtual address
2385+ */
2386+ if (gpuidx == MAX_GPU_INSTANCE) {
2387+ uint32_t gpuid;
2388+ int r;
23922389
2390+ r = kfd_process_gpuid_from_kgd(p, adev, &gpuid, &gpuidx);
2391+ if (r < 0)
2392+ return;
2393+ }
2394+
2395+ /* fault is recovered
2396+ * or fault cannot recover because GPU no access on the range
2397+ */
2398+ pdd = kfd_process_device_from_gpuidx(p, gpuidx);
23932399 if (pdd)
23942400 WRITE_ONCE(pdd->faults, pdd->faults + 1);
23952401 }
@@ -2525,7 +2531,7 @@ out_unlock_svms: · 129 unmodified lines
25252531 mutex_unlock(&svms->lock);
25262532 mmap_read_unlock(mm);
25272533
2528− svm_range_count_fault(adev, p, prange, gpuidx);
2534+ svm_range_count_fault(adev, p, gpuidx);
25292535
25302536 mmput(mm);
25312537 out:
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c+1−1
@@ -9191,7 +9191,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) · 9190 unmodified lines
91919191 #if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) || \
91929192 defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)
91939193 /* restore the backlight level */
9194− if (dm->backlight_dev)
9194+ if (dm->backlight_dev && (amdgpu_dm_backlight_get_level(dm) != dm->brightness[0]))
91959195 amdgpu_dm_backlight_set_level(dm, dm->brightness[0]);
91969196 #endif
91979197 /*
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_smu.c+2−2
@@ -31,8 +31,8 @@ · 30 unmodified lines
3131 #include "dcn31_smu.h"
3232
3333 #include "yellow_carp_offset.h"
34−#include "mp/mp_13_0_1_offset.h"
35−#include "mp/mp_13_0_1_sh_mask.h"
34+#include "mp/mp_13_0_2_offset.h"
35+#include "mp/mp_13_0_2_sh_mask.h"
3636
3737 #define REG(reg_name) \
3838 (MP0_BASE.instance[0].segment[reg ## reg_name ## _BASE_IDX] + reg ## reg_name)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c+4−4
@@ -1620,11 +1620,12 @@ enum dc_status dpcd_configure_lttpr_mode(struct dc_link *link, struct link_train · 1619 unmodified lines
16201620 {
16211621 enum dc_status status = DC_OK;
16221622
1623− if (lt_settings->lttpr_mode == LTTPR_MODE_NON_TRANSPARENT)
1624− status = configure_lttpr_mode_non_transparent(link, lt_settings);
1625− else
1623+ if (lt_settings->lttpr_mode == LTTPR_MODE_TRANSPARENT)
16261624 status = configure_lttpr_mode_transparent(link);
16271625
1626+ else if (lt_settings->lttpr_mode == LTTPR_MODE_NON_TRANSPARENT)
1627+ status = configure_lttpr_mode_non_transparent(link, lt_settings);
1628+
16281629 return status;
16291630 }
16301631
@@ -1784,7 +1785,6 @@ bool perform_link_training_with_retries( · 153 unmodified lines
17841785 link_enc = stream->link_enc;
17851786 else
17861787 link_enc = link->link_enc;
1787− ASSERT(link_enc);
17881788
17891789 /* We need to do this before the link training to ensure the idle pattern in SST
17901790 * mode will be sent right after the link training
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.c+1−1
@@ -390,7 +390,7 @@ void dcn31_update_info_frame(struct pipe_ctx *pipe_ctx) · 389 unmodified lines
390390 is_hdmi_tmds = dc_is_hdmi_tmds_signal(pipe_ctx->stream->signal);
391391 is_dp = dc_is_dp_signal(pipe_ctx->stream->signal);
392392
393− if (!is_hdmi_tmds)
393+ if (!is_hdmi_tmds && !is_dp)
394394 return;
395395
396396 if (is_hdmi_tmds)
drivers/gpu/drm/amd/include/asic_reg/mp/mp_13_0_1_offset.h+0−355
@@ -1,355 +0,0 @@
1−/*
2− * Copyright 2020 Advanced Micro Devices, Inc.
3− *
4− * Permission is hereby granted, free of charge, to any person obtaining a
5− * copy of this software and associated documentation files (the "Software"),
6− * to deal in the Software without restriction, including without limitation
7− * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8− * and/or sell copies of the Software, and to permit persons to whom the
9− * Software is furnished to do so, subject to the following conditions:
10− *
11− * The above copyright notice and this permission notice shall be included in
12− * all copies or substantial portions of the Software.
13− *
14− * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15− * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16− * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17− * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18− * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19− * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20− * OTHER DEALINGS IN THE SOFTWARE.
21− *
22− *
23− */
24−#ifndef _mp_13_0_1_OFFSET_HEADER
25−#define _mp_13_0_1_OFFSET_HEADER
26−
27−
28−
29−// addressBlock: mp_SmuMp0_SmnDec
30−// base address: 0x0
31−#define regMP0_SMN_C2PMSG_32 0x0060
32−#define regMP0_SMN_C2PMSG_32_BASE_IDX 0
33−#define regMP0_SMN_C2PMSG_33 0x0061
34−#define regMP0_SMN_C2PMSG_33_BASE_IDX 0
35−#define regMP0_SMN_C2PMSG_34 0x0062
36−#define regMP0_SMN_C2PMSG_34_BASE_IDX 0
37−#define regMP0_SMN_C2PMSG_35 0x0063
38−#define regMP0_SMN_C2PMSG_35_BASE_IDX 0
39−#define regMP0_SMN_C2PMSG_36 0x0064
40−#define regMP0_SMN_C2PMSG_36_BASE_IDX 0
41−#define regMP0_SMN_C2PMSG_37 0x0065
42−#define regMP0_SMN_C2PMSG_37_BASE_IDX 0
43−#define regMP0_SMN_C2PMSG_38 0x0066
44−#define regMP0_SMN_C2PMSG_38_BASE_IDX 0
45−#define regMP0_SMN_C2PMSG_39 0x0067
46−#define regMP0_SMN_C2PMSG_39_BASE_IDX 0
47−#define regMP0_SMN_C2PMSG_40 0x0068
48−#define regMP0_SMN_C2PMSG_40_BASE_IDX 0
49−#define regMP0_SMN_C2PMSG_41 0x0069
50−#define regMP0_SMN_C2PMSG_41_BASE_IDX 0
51−#define regMP0_SMN_C2PMSG_42 0x006a
52−#define regMP0_SMN_C2PMSG_42_BASE_IDX 0
53−#define regMP0_SMN_C2PMSG_43 0x006b
54−#define regMP0_SMN_C2PMSG_43_BASE_IDX 0
55−#define regMP0_SMN_C2PMSG_44 0x006c
56−#define regMP0_SMN_C2PMSG_44_BASE_IDX 0
57−#define regMP0_SMN_C2PMSG_45 0x006d
58−#define regMP0_SMN_C2PMSG_45_BASE_IDX 0
59−#define regMP0_SMN_C2PMSG_46 0x006e
60−#define regMP0_SMN_C2PMSG_46_BASE_IDX 0
61−#define regMP0_SMN_C2PMSG_47 0x006f
62−#define regMP0_SMN_C2PMSG_47_BASE_IDX 0
63−#define regMP0_SMN_C2PMSG_48 0x0070
64−#define regMP0_SMN_C2PMSG_48_BASE_IDX 0
65−#define regMP0_SMN_C2PMSG_49 0x0071
66−#define regMP0_SMN_C2PMSG_49_BASE_IDX 0
67−#define regMP0_SMN_C2PMSG_50 0x0072
68−#define regMP0_SMN_C2PMSG_50_BASE_IDX 0
69−#define regMP0_SMN_C2PMSG_51 0x0073
70−#define regMP0_SMN_C2PMSG_51_BASE_IDX 0
71−#define regMP0_SMN_C2PMSG_52 0x0074
72−#define regMP0_SMN_C2PMSG_52_BASE_IDX 0
73−#define regMP0_SMN_C2PMSG_53 0x0075
74−#define regMP0_SMN_C2PMSG_53_BASE_IDX 0
75−#define regMP0_SMN_C2PMSG_54 0x0076
76−#define regMP0_SMN_C2PMSG_54_BASE_IDX 0
77−#define regMP0_SMN_C2PMSG_55 0x0077
78−#define regMP0_SMN_C2PMSG_55_BASE_IDX 0
79−#define regMP0_SMN_C2PMSG_56 0x0078
80−#define regMP0_SMN_C2PMSG_56_BASE_IDX 0
81−#define regMP0_SMN_C2PMSG_57 0x0079
82−#define regMP0_SMN_C2PMSG_57_BASE_IDX 0
83−#define regMP0_SMN_C2PMSG_58 0x007a
84−#define regMP0_SMN_C2PMSG_58_BASE_IDX 0
85−#define regMP0_SMN_C2PMSG_59 0x007b
86−#define regMP0_SMN_C2PMSG_59_BASE_IDX 0
87−#define regMP0_SMN_C2PMSG_60 0x007c
88−#define regMP0_SMN_C2PMSG_60_BASE_IDX 0
89−#define regMP0_SMN_C2PMSG_61 0x007d
90−#define regMP0_SMN_C2PMSG_61_BASE_IDX 0
91−#define regMP0_SMN_C2PMSG_62 0x007e
92−#define regMP0_SMN_C2PMSG_62_BASE_IDX 0
93−#define regMP0_SMN_C2PMSG_63 0x007f
94−#define regMP0_SMN_C2PMSG_63_BASE_IDX 0
95−#define regMP0_SMN_C2PMSG_64 0x0080
96−#define regMP0_SMN_C2PMSG_64_BASE_IDX 0
97−#define regMP0_SMN_C2PMSG_65 0x0081
98−#define regMP0_SMN_C2PMSG_65_BASE_IDX 0
99−#define regMP0_SMN_C2PMSG_66 0x0082
100−#define regMP0_SMN_C2PMSG_66_BASE_IDX 0
101−#define regMP0_SMN_C2PMSG_67 0x0083
102−#define regMP0_SMN_C2PMSG_67_BASE_IDX 0
103−#define regMP0_SMN_C2PMSG_68 0x0084
104−#define regMP0_SMN_C2PMSG_68_BASE_IDX 0
105−#define regMP0_SMN_C2PMSG_69 0x0085
106−#define regMP0_SMN_C2PMSG_69_BASE_IDX 0
107−#define regMP0_SMN_C2PMSG_70 0x0086
108−#define regMP0_SMN_C2PMSG_70_BASE_IDX 0
109−#define regMP0_SMN_C2PMSG_71 0x0087
110−#define regMP0_SMN_C2PMSG_71_BASE_IDX 0
111−#define regMP0_SMN_C2PMSG_72 0x0088
112−#define regMP0_SMN_C2PMSG_72_BASE_IDX 0
113−#define regMP0_SMN_C2PMSG_73 0x0089
114−#define regMP0_SMN_C2PMSG_73_BASE_IDX 0
115−#define regMP0_SMN_C2PMSG_74 0x008a
116−#define regMP0_SMN_C2PMSG_74_BASE_IDX 0
117−#define regMP0_SMN_C2PMSG_75 0x008b
118−#define regMP0_SMN_C2PMSG_75_BASE_IDX 0
119−#define regMP0_SMN_C2PMSG_76 0x008c
120−#define regMP0_SMN_C2PMSG_76_BASE_IDX 0
121−#define regMP0_SMN_C2PMSG_77 0x008d
122−#define regMP0_SMN_C2PMSG_77_BASE_IDX 0
123−#define regMP0_SMN_C2PMSG_78 0x008e
124−#define regMP0_SMN_C2PMSG_78_BASE_IDX 0
125−#define regMP0_SMN_C2PMSG_79 0x008f
126−#define regMP0_SMN_C2PMSG_79_BASE_IDX 0
127−#define regMP0_SMN_C2PMSG_80 0x0090
128−#define regMP0_SMN_C2PMSG_80_BASE_IDX 0
129−#define regMP0_SMN_C2PMSG_81 0x0091
130−#define regMP0_SMN_C2PMSG_81_BASE_IDX 0
131−#define regMP0_SMN_C2PMSG_82 0x0092
132−#define regMP0_SMN_C2PMSG_82_BASE_IDX 0
133−#define regMP0_SMN_C2PMSG_83 0x0093
134−#define regMP0_SMN_C2PMSG_83_BASE_IDX 0
135−#define regMP0_SMN_C2PMSG_84 0x0094
136−#define regMP0_SMN_C2PMSG_84_BASE_IDX 0
137−#define regMP0_SMN_C2PMSG_85 0x0095
138−#define regMP0_SMN_C2PMSG_85_BASE_IDX 0
139−#define regMP0_SMN_C2PMSG_86 0x0096
140−#define regMP0_SMN_C2PMSG_86_BASE_IDX 0
141−#define regMP0_SMN_C2PMSG_87 0x0097
142−#define regMP0_SMN_C2PMSG_87_BASE_IDX 0
143−#define regMP0_SMN_C2PMSG_88 0x0098
144−#define regMP0_SMN_C2PMSG_88_BASE_IDX 0
145−#define regMP0_SMN_C2PMSG_89 0x0099
146−#define regMP0_SMN_C2PMSG_89_BASE_IDX 0
147−#define regMP0_SMN_C2PMSG_90 0x009a
148−#define regMP0_SMN_C2PMSG_90_BASE_IDX 0
149−#define regMP0_SMN_C2PMSG_91 0x009b
150−#define regMP0_SMN_C2PMSG_91_BASE_IDX 0
151−#define regMP0_SMN_C2PMSG_92 0x009c
152−#define regMP0_SMN_C2PMSG_92_BASE_IDX 0
153−#define regMP0_SMN_C2PMSG_93 0x009d
154−#define regMP0_SMN_C2PMSG_93_BASE_IDX 0
155−#define regMP0_SMN_C2PMSG_94 0x009e
156−#define regMP0_SMN_C2PMSG_94_BASE_IDX 0
157−#define regMP0_SMN_C2PMSG_95 0x009f
158−#define regMP0_SMN_C2PMSG_95_BASE_IDX 0
159−#define regMP0_SMN_C2PMSG_96 0x00a0
160−#define regMP0_SMN_C2PMSG_96_BASE_IDX 0
161−#define regMP0_SMN_C2PMSG_97 0x00a1
162−#define regMP0_SMN_C2PMSG_97_BASE_IDX 0
163−#define regMP0_SMN_C2PMSG_98 0x00a2
164−#define regMP0_SMN_C2PMSG_98_BASE_IDX 0
165−#define regMP0_SMN_C2PMSG_99 0x00a3
166−#define regMP0_SMN_C2PMSG_99_BASE_IDX 0
167−#define regMP0_SMN_C2PMSG_100 0x00a4
168−#define regMP0_SMN_C2PMSG_100_BASE_IDX 0
169−#define regMP0_SMN_C2PMSG_101 0x00a5
170−#define regMP0_SMN_C2PMSG_101_BASE_IDX 0
171−#define regMP0_SMN_C2PMSG_102 0x00a6
172−#define regMP0_SMN_C2PMSG_102_BASE_IDX 0
173−#define regMP0_SMN_C2PMSG_103 0x00a7
174−#define regMP0_SMN_C2PMSG_103_BASE_IDX 0
175−#define regMP0_SMN_IH_CREDIT 0x00c1
176−#define regMP0_SMN_IH_CREDIT_BASE_IDX 0
177−#define regMP0_SMN_IH_SW_INT 0x00c2
178−#define regMP0_SMN_IH_SW_INT_BASE_IDX 0
179−#define regMP0_SMN_IH_SW_INT_CTRL 0x00c3
180−#define regMP0_SMN_IH_SW_INT_CTRL_BASE_IDX 0
181−
182−
183−// addressBlock: mp_SmuMp1_SmnDec
184−// base address: 0x0
185−#define regMP1_SMN_C2PMSG_32 0x0260
186−#define regMP1_SMN_C2PMSG_32_BASE_IDX 0
187−#define regMP1_SMN_C2PMSG_33 0x0261
188−#define regMP1_SMN_C2PMSG_33_BASE_IDX 0
189−#define regMP1_SMN_C2PMSG_34 0x0262
190−#define regMP1_SMN_C2PMSG_34_BASE_IDX 0
191−#define regMP1_SMN_C2PMSG_35 0x0263
192−#define regMP1_SMN_C2PMSG_35_BASE_IDX 0
193−#define regMP1_SMN_C2PMSG_36 0x0264
194−#define regMP1_SMN_C2PMSG_36_BASE_IDX 0
195−#define regMP1_SMN_C2PMSG_37 0x0265
196−#define regMP1_SMN_C2PMSG_37_BASE_IDX 0
197−#define regMP1_SMN_C2PMSG_38 0x0266
198−#define regMP1_SMN_C2PMSG_38_BASE_IDX 0
199−#define regMP1_SMN_C2PMSG_39 0x0267
200−#define regMP1_SMN_C2PMSG_39_BASE_IDX 0
201−#define regMP1_SMN_C2PMSG_40 0x0268
202−#define regMP1_SMN_C2PMSG_40_BASE_IDX 0
203−#define regMP1_SMN_C2PMSG_41 0x0269
204−#define regMP1_SMN_C2PMSG_41_BASE_IDX 0
205−#define regMP1_SMN_C2PMSG_42 0x026a
206−#define regMP1_SMN_C2PMSG_42_BASE_IDX 0
207−#define regMP1_SMN_C2PMSG_43 0x026b
208−#define regMP1_SMN_C2PMSG_43_BASE_IDX 0
209−#define regMP1_SMN_C2PMSG_44 0x026c
210−#define regMP1_SMN_C2PMSG_44_BASE_IDX 0
211−#define regMP1_SMN_C2PMSG_45 0x026d
212−#define regMP1_SMN_C2PMSG_45_BASE_IDX 0
213−#define regMP1_SMN_C2PMSG_46 0x026e
214−#define regMP1_SMN_C2PMSG_46_BASE_IDX 0
215−#define regMP1_SMN_C2PMSG_47 0x026f
216−#define regMP1_SMN_C2PMSG_47_BASE_IDX 0
217−#define regMP1_SMN_C2PMSG_48 0x0270
218−#define regMP1_SMN_C2PMSG_48_BASE_IDX 0
219−#define regMP1_SMN_C2PMSG_49 0x0271
220−#define regMP1_SMN_C2PMSG_49_BASE_IDX 0
221−#define regMP1_SMN_C2PMSG_50 0x0272
222−#define regMP1_SMN_C2PMSG_50_BASE_IDX 0
223−#define regMP1_SMN_C2PMSG_51 0x0273
224−#define regMP1_SMN_C2PMSG_51_BASE_IDX 0
225−#define regMP1_SMN_C2PMSG_52 0x0274
226−#define regMP1_SMN_C2PMSG_52_BASE_IDX 0
227−#define regMP1_SMN_C2PMSG_53 0x0275
228−#define regMP1_SMN_C2PMSG_53_BASE_IDX 0
229−#define regMP1_SMN_C2PMSG_54 0x0276
230−#define regMP1_SMN_C2PMSG_54_BASE_IDX 0
231−#define regMP1_SMN_C2PMSG_55 0x0277
232−#define regMP1_SMN_C2PMSG_55_BASE_IDX 0
233−#define regMP1_SMN_C2PMSG_56 0x0278
234−#define regMP1_SMN_C2PMSG_56_BASE_IDX 0
235−#define regMP1_SMN_C2PMSG_57 0x0279
236−#define regMP1_SMN_C2PMSG_57_BASE_IDX 0
237−#define regMP1_SMN_C2PMSG_58 0x027a
238−#define regMP1_SMN_C2PMSG_58_BASE_IDX 0
239−#define regMP1_SMN_C2PMSG_59 0x027b
240−#define regMP1_SMN_C2PMSG_59_BASE_IDX 0
241−#define regMP1_SMN_C2PMSG_60 0x027c
242−#define regMP1_SMN_C2PMSG_60_BASE_IDX 0
243−#define regMP1_SMN_C2PMSG_61 0x027d
244−#define regMP1_SMN_C2PMSG_61_BASE_IDX 0
245−#define regMP1_SMN_C2PMSG_62 0x027e
246−#define regMP1_SMN_C2PMSG_62_BASE_IDX 0
247−#define regMP1_SMN_C2PMSG_63 0x027f
248−#define regMP1_SMN_C2PMSG_63_BASE_IDX 0
249−#define regMP1_SMN_C2PMSG_64 0x0280
250−#define regMP1_SMN_C2PMSG_64_BASE_IDX 0
251−#define regMP1_SMN_C2PMSG_65 0x0281
252−#define regMP1_SMN_C2PMSG_65_BASE_IDX 0
253−#define regMP1_SMN_C2PMSG_66 0x0282
254−#define regMP1_SMN_C2PMSG_66_BASE_IDX 0
255−#define regMP1_SMN_C2PMSG_67 0x0283
256−#define regMP1_SMN_C2PMSG_67_BASE_IDX 0
257−#define regMP1_SMN_C2PMSG_68 0x0284
258−#define regMP1_SMN_C2PMSG_68_BASE_IDX 0
259−#define regMP1_SMN_C2PMSG_69 0x0285
260−#define regMP1_SMN_C2PMSG_69_BASE_IDX 0
261−#define regMP1_SMN_C2PMSG_70 0x0286
262−#define regMP1_SMN_C2PMSG_70_BASE_IDX 0
263−#define regMP1_SMN_C2PMSG_71 0x0287
264−#define regMP1_SMN_C2PMSG_71_BASE_IDX 0
265−#define regMP1_SMN_C2PMSG_72 0x0288
266−#define regMP1_SMN_C2PMSG_72_BASE_IDX 0
267−#define regMP1_SMN_C2PMSG_73 0x0289
268−#define regMP1_SMN_C2PMSG_73_BASE_IDX 0
269−#define regMP1_SMN_C2PMSG_74 0x028a
270−#define regMP1_SMN_C2PMSG_74_BASE_IDX 0
271−#define regMP1_SMN_C2PMSG_75 0x028b
272−#define regMP1_SMN_C2PMSG_75_BASE_IDX 0
273−#define regMP1_SMN_C2PMSG_76 0x028c
274−#define regMP1_SMN_C2PMSG_76_BASE_IDX 0
275−#define regMP1_SMN_C2PMSG_77 0x028d
276−#define regMP1_SMN_C2PMSG_77_BASE_IDX 0
277−#define regMP1_SMN_C2PMSG_78 0x028e
278−#define regMP1_SMN_C2PMSG_78_BASE_IDX 0
279−#define regMP1_SMN_C2PMSG_79 0x028f
280−#define regMP1_SMN_C2PMSG_79_BASE_IDX 0
281−#define regMP1_SMN_C2PMSG_80 0x0290
282−#define regMP1_SMN_C2PMSG_80_BASE_IDX 0
283−#define regMP1_SMN_C2PMSG_81 0x0291
284−#define regMP1_SMN_C2PMSG_81_BASE_IDX 0
285−#define regMP1_SMN_C2PMSG_82 0x0292
286−#define regMP1_SMN_C2PMSG_82_BASE_IDX 0
287−#define regMP1_SMN_C2PMSG_83 0x0293
288−#define regMP1_SMN_C2PMSG_83_BASE_IDX 0
289−#define regMP1_SMN_C2PMSG_84 0x0294
290−#define regMP1_SMN_C2PMSG_84_BASE_IDX 0
291−#define regMP1_SMN_C2PMSG_85 0x0295
292−#define regMP1_SMN_C2PMSG_85_BASE_IDX 0
293−#define regMP1_SMN_C2PMSG_86 0x0296
294−#define regMP1_SMN_C2PMSG_86_BASE_IDX 0
295−#define regMP1_SMN_C2PMSG_87 0x0297
296−#define regMP1_SMN_C2PMSG_87_BASE_IDX 0
297−#define regMP1_SMN_C2PMSG_88 0x0298
298−#define regMP1_SMN_C2PMSG_88_BASE_IDX 0
299−#define regMP1_SMN_C2PMSG_89 0x0299
300−#define regMP1_SMN_C2PMSG_89_BASE_IDX 0
301−#define regMP1_SMN_C2PMSG_90 0x029a
302−#define regMP1_SMN_C2PMSG_90_BASE_IDX 0
303−#define regMP1_SMN_C2PMSG_91 0x029b
304−#define regMP1_SMN_C2PMSG_91_BASE_IDX 0
305−#define regMP1_SMN_C2PMSG_92 0x029c
306−#define regMP1_SMN_C2PMSG_92_BASE_IDX 0
307−#define regMP1_SMN_C2PMSG_93 0x029d
308−#define regMP1_SMN_C2PMSG_93_BASE_IDX 0
309−#define regMP1_SMN_C2PMSG_94 0x029e
310−#define regMP1_SMN_C2PMSG_94_BASE_IDX 0
311−#define regMP1_SMN_C2PMSG_95 0x029f
312−#define regMP1_SMN_C2PMSG_95_BASE_IDX 0
313−#define regMP1_SMN_C2PMSG_96 0x02a0
314−#define regMP1_SMN_C2PMSG_96_BASE_IDX 0
315−#define regMP1_SMN_C2PMSG_97 0x02a1
316−#define regMP1_SMN_C2PMSG_97_BASE_IDX 0
317−#define regMP1_SMN_C2PMSG_98 0x02a2
318−#define regMP1_SMN_C2PMSG_98_BASE_IDX 0
319−#define regMP1_SMN_C2PMSG_99 0x02a3
320−#define regMP1_SMN_C2PMSG_99_BASE_IDX 0
321−#define regMP1_SMN_C2PMSG_100 0x02a4
322−#define regMP1_SMN_C2PMSG_100_BASE_IDX 0
323−#define regMP1_SMN_C2PMSG_101 0x02a5
324−#define regMP1_SMN_C2PMSG_101_BASE_IDX 0
325−#define regMP1_SMN_C2PMSG_102 0x02a6
326−#define regMP1_SMN_C2PMSG_102_BASE_IDX 0
327−#define regMP1_SMN_C2PMSG_103 0x02a7
328−#define regMP1_SMN_C2PMSG_103_BASE_IDX 0
329−#define regMP1_SMN_IH_CREDIT 0x02c1
330−#define regMP1_SMN_IH_CREDIT_BASE_IDX 0
331−#define regMP1_SMN_IH_SW_INT 0x02c2
332−#define regMP1_SMN_IH_SW_INT_BASE_IDX 0
333−#define regMP1_SMN_IH_SW_INT_CTRL 0x02c3
334−#define regMP1_SMN_IH_SW_INT_CTRL_BASE_IDX 0
335−#define regMP1_SMN_FPS_CNT 0x02c4
336−#define regMP1_SMN_FPS_CNT_BASE_IDX 0
337−#define regMP1_SMN_EXT_SCRATCH0 0x0340
338−#define regMP1_SMN_EXT_SCRATCH0_BASE_IDX 0
339−#define regMP1_SMN_EXT_SCRATCH1 0x0341
340−#define regMP1_SMN_EXT_SCRATCH1_BASE_IDX 0
341−#define regMP1_SMN_EXT_SCRATCH2 0x0342
342−#define regMP1_SMN_EXT_SCRATCH2_BASE_IDX 0
343−#define regMP1_SMN_EXT_SCRATCH3 0x0343
344−#define regMP1_SMN_EXT_SCRATCH3_BASE_IDX 0
345−#define regMP1_SMN_EXT_SCRATCH4 0x0344
346−#define regMP1_SMN_EXT_SCRATCH4_BASE_IDX 0
347−#define regMP1_SMN_EXT_SCRATCH5 0x0345
348−#define regMP1_SMN_EXT_SCRATCH5_BASE_IDX 0
349−#define regMP1_SMN_EXT_SCRATCH6 0x0346
350−#define regMP1_SMN_EXT_SCRATCH6_BASE_IDX 0
351−#define regMP1_SMN_EXT_SCRATCH7 0x0347
352−#define regMP1_SMN_EXT_SCRATCH7_BASE_IDX 0
353−
354−
355−#endif
drivers/gpu/drm/amd/include/asic_reg/mp/mp_13_0_1_sh_mask.h+0−531
@@ -1,531 +0,0 @@
1−/*
2− * Copyright 2020 Advanced Micro Devices, Inc.
3− *
4− * Permission is hereby granted, free of charge, to any person obtaining a
5− * copy of this software and associated documentation files (the "Software"),
6− * to deal in the Software without restriction, including without limitation
7− * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8− * and/or sell copies of the Software, and to permit persons to whom the
9− * Software is furnished to do so, subject to the following conditions:
10− *
11− * The above copyright notice and this permission notice shall be included in
12− * all copies or substantial portions of the Software.
13− *
14− * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15− * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16− * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17− * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18− * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19− * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20− * OTHER DEALINGS IN THE SOFTWARE.
21− *
22− *
23− */
24−#ifndef _mp_13_0_1_SH_MASK_HEADER
25−#define _mp_13_0_1_SH_MASK_HEADER
26−
27−
28−// addressBlock: mp_SmuMp0_SmnDec
29−//MP0_SMN_C2PMSG_32
30−#define MP0_SMN_C2PMSG_32__CONTENT__SHIFT 0x0
31−#define MP0_SMN_C2PMSG_32__CONTENT_MASK 0xFFFFFFFFL
32−//MP0_SMN_C2PMSG_33
33−#define MP0_SMN_C2PMSG_33__CONTENT__SHIFT 0x0
34−#define MP0_SMN_C2PMSG_33__CONTENT_MASK 0xFFFFFFFFL
35−//MP0_SMN_C2PMSG_34
36−#define MP0_SMN_C2PMSG_34__CONTENT__SHIFT 0x0
37−#define MP0_SMN_C2PMSG_34__CONTENT_MASK 0xFFFFFFFFL
38−//MP0_SMN_C2PMSG_35
39−#define MP0_SMN_C2PMSG_35__CONTENT__SHIFT 0x0
40−#define MP0_SMN_C2PMSG_35__CONTENT_MASK 0xFFFFFFFFL
41−//MP0_SMN_C2PMSG_36
42−#define MP0_SMN_C2PMSG_36__CONTENT__SHIFT 0x0
43−#define MP0_SMN_C2PMSG_36__CONTENT_MASK 0xFFFFFFFFL
44−//MP0_SMN_C2PMSG_37
45−#define MP0_SMN_C2PMSG_37__CONTENT__SHIFT 0x0
46−#define MP0_SMN_C2PMSG_37__CONTENT_MASK 0xFFFFFFFFL
47−//MP0_SMN_C2PMSG_38
48−#define MP0_SMN_C2PMSG_38__CONTENT__SHIFT 0x0
49−#define MP0_SMN_C2PMSG_38__CONTENT_MASK 0xFFFFFFFFL
50−//MP0_SMN_C2PMSG_39
51−#define MP0_SMN_C2PMSG_39__CONTENT__SHIFT 0x0
52−#define MP0_SMN_C2PMSG_39__CONTENT_MASK 0xFFFFFFFFL
53−//MP0_SMN_C2PMSG_40
54−#define MP0_SMN_C2PMSG_40__CONTENT__SHIFT 0x0
55−#define MP0_SMN_C2PMSG_40__CONTENT_MASK 0xFFFFFFFFL
56−//MP0_SMN_C2PMSG_41
57−#define MP0_SMN_C2PMSG_41__CONTENT__SHIFT 0x0
58−#define MP0_SMN_C2PMSG_41__CONTENT_MASK 0xFFFFFFFFL
59−//MP0_SMN_C2PMSG_42
60−#define MP0_SMN_C2PMSG_42__CONTENT__SHIFT 0x0
61−#define MP0_SMN_C2PMSG_42__CONTENT_MASK 0xFFFFFFFFL
62−//MP0_SMN_C2PMSG_43
63−#define MP0_SMN_C2PMSG_43__CONTENT__SHIFT 0x0
64−#define MP0_SMN_C2PMSG_43__CONTENT_MASK 0xFFFFFFFFL
65−//MP0_SMN_C2PMSG_44
66−#define MP0_SMN_C2PMSG_44__CONTENT__SHIFT 0x0
67−#define MP0_SMN_C2PMSG_44__CONTENT_MASK 0xFFFFFFFFL
68−//MP0_SMN_C2PMSG_45
69−#define MP0_SMN_C2PMSG_45__CONTENT__SHIFT 0x0
70−#define MP0_SMN_C2PMSG_45__CONTENT_MASK 0xFFFFFFFFL
71−//MP0_SMN_C2PMSG_46
72−#define MP0_SMN_C2PMSG_46__CONTENT__SHIFT 0x0
73−#define MP0_SMN_C2PMSG_46__CONTENT_MASK 0xFFFFFFFFL
74−//MP0_SMN_C2PMSG_47
75−#define MP0_SMN_C2PMSG_47__CONTENT__SHIFT 0x0
76−#define MP0_SMN_C2PMSG_47__CONTENT_MASK 0xFFFFFFFFL
77−//MP0_SMN_C2PMSG_48
78−#define MP0_SMN_C2PMSG_48__CONTENT__SHIFT 0x0
79−#define MP0_SMN_C2PMSG_48__CONTENT_MASK 0xFFFFFFFFL
80−//MP0_SMN_C2PMSG_49
81−#define MP0_SMN_C2PMSG_49__CONTENT__SHIFT 0x0
82−#define MP0_SMN_C2PMSG_49__CONTENT_MASK 0xFFFFFFFFL
83−//MP0_SMN_C2PMSG_50
84−#define MP0_SMN_C2PMSG_50__CONTENT__SHIFT 0x0
85−#define MP0_SMN_C2PMSG_50__CONTENT_MASK 0xFFFFFFFFL
86−//MP0_SMN_C2PMSG_51
87−#define MP0_SMN_C2PMSG_51__CONTENT__SHIFT 0x0
88−#define MP0_SMN_C2PMSG_51__CONTENT_MASK 0xFFFFFFFFL
89−//MP0_SMN_C2PMSG_52
90−#define MP0_SMN_C2PMSG_52__CONTENT__SHIFT 0x0
91−#define MP0_SMN_C2PMSG_52__CONTENT_MASK 0xFFFFFFFFL
92−//MP0_SMN_C2PMSG_53
93−#define MP0_SMN_C2PMSG_53__CONTENT__SHIFT 0x0
94−#define MP0_SMN_C2PMSG_53__CONTENT_MASK 0xFFFFFFFFL
95−//MP0_SMN_C2PMSG_54
96−#define MP0_SMN_C2PMSG_54__CONTENT__SHIFT 0x0
97−#define MP0_SMN_C2PMSG_54__CONTENT_MASK 0xFFFFFFFFL
98−//MP0_SMN_C2PMSG_55
99−#define MP0_SMN_C2PMSG_55__CONTENT__SHIFT 0x0
100−#define MP0_SMN_C2PMSG_55__CONTENT_MASK 0xFFFFFFFFL
101−//MP0_SMN_C2PMSG_56
102−#define MP0_SMN_C2PMSG_56__CONTENT__SHIFT 0x0
103−#define MP0_SMN_C2PMSG_56__CONTENT_MASK 0xFFFFFFFFL
104−//MP0_SMN_C2PMSG_57
105−#define MP0_SMN_C2PMSG_57__CONTENT__SHIFT 0x0
106−#define MP0_SMN_C2PMSG_57__CONTENT_MASK 0xFFFFFFFFL
107−//MP0_SMN_C2PMSG_58
108−#define MP0_SMN_C2PMSG_58__CONTENT__SHIFT 0x0
109−#define MP0_SMN_C2PMSG_58__CONTENT_MASK 0xFFFFFFFFL
110−//MP0_SMN_C2PMSG_59
111−#define MP0_SMN_C2PMSG_59__CONTENT__SHIFT 0x0
112−#define MP0_SMN_C2PMSG_59__CONTENT_MASK 0xFFFFFFFFL
113−//MP0_SMN_C2PMSG_60
114−#define MP0_SMN_C2PMSG_60__CONTENT__SHIFT 0x0
115−#define MP0_SMN_C2PMSG_60__CONTENT_MASK 0xFFFFFFFFL
116−//MP0_SMN_C2PMSG_61
117−#define MP0_SMN_C2PMSG_61__CONTENT__SHIFT 0x0
118−#define MP0_SMN_C2PMSG_61__CONTENT_MASK 0xFFFFFFFFL
119−//MP0_SMN_C2PMSG_62
120−#define MP0_SMN_C2PMSG_62__CONTENT__SHIFT 0x0
121−#define MP0_SMN_C2PMSG_62__CONTENT_MASK 0xFFFFFFFFL
122−//MP0_SMN_C2PMSG_63
123−#define MP0_SMN_C2PMSG_63__CONTENT__SHIFT 0x0
124−#define MP0_SMN_C2PMSG_63__CONTENT_MASK 0xFFFFFFFFL
125−//MP0_SMN_C2PMSG_64
126−#define MP0_SMN_C2PMSG_64__CONTENT__SHIFT 0x0
127−#define MP0_SMN_C2PMSG_64__CONTENT_MASK 0xFFFFFFFFL
128−//MP0_SMN_C2PMSG_65
129−#define MP0_SMN_C2PMSG_65__CONTENT__SHIFT 0x0
130−#define MP0_SMN_C2PMSG_65__CONTENT_MASK 0xFFFFFFFFL
131−//MP0_SMN_C2PMSG_66
132−#define MP0_SMN_C2PMSG_66__CONTENT__SHIFT 0x0
133−#define MP0_SMN_C2PMSG_66__CONTENT_MASK 0xFFFFFFFFL
134−//MP0_SMN_C2PMSG_67
135−#define MP0_SMN_C2PMSG_67__CONTENT__SHIFT 0x0
136−#define MP0_SMN_C2PMSG_67__CONTENT_MASK 0xFFFFFFFFL
137−//MP0_SMN_C2PMSG_68
138−#define MP0_SMN_C2PMSG_68__CONTENT__SHIFT 0x0
139−#define MP0_SMN_C2PMSG_68__CONTENT_MASK 0xFFFFFFFFL
140−//MP0_SMN_C2PMSG_69
141−#define MP0_SMN_C2PMSG_69__CONTENT__SHIFT 0x0
142−#define MP0_SMN_C2PMSG_69__CONTENT_MASK 0xFFFFFFFFL
143−//MP0_SMN_C2PMSG_70
144−#define MP0_SMN_C2PMSG_70__CONTENT__SHIFT 0x0
145−#define MP0_SMN_C2PMSG_70__CONTENT_MASK 0xFFFFFFFFL
146−//MP0_SMN_C2PMSG_71
147−#define MP0_SMN_C2PMSG_71__CONTENT__SHIFT 0x0
148−#define MP0_SMN_C2PMSG_71__CONTENT_MASK 0xFFFFFFFFL
149−//MP0_SMN_C2PMSG_72
150−#define MP0_SMN_C2PMSG_72__CONTENT__SHIFT 0x0
151−#define MP0_SMN_C2PMSG_72__CONTENT_MASK 0xFFFFFFFFL
152−//MP0_SMN_C2PMSG_73
153−#define MP0_SMN_C2PMSG_73__CONTENT__SHIFT 0x0
154−#define MP0_SMN_C2PMSG_73__CONTENT_MASK 0xFFFFFFFFL
155−//MP0_SMN_C2PMSG_74
156−#define MP0_SMN_C2PMSG_74__CONTENT__SHIFT 0x0
157−#define MP0_SMN_C2PMSG_74__CONTENT_MASK 0xFFFFFFFFL
158−//MP0_SMN_C2PMSG_75
159−#define MP0_SMN_C2PMSG_75__CONTENT__SHIFT 0x0
160−#define MP0_SMN_C2PMSG_75__CONTENT_MASK 0xFFFFFFFFL
161−//MP0_SMN_C2PMSG_76
162−#define MP0_SMN_C2PMSG_76__CONTENT__SHIFT 0x0
163−#define MP0_SMN_C2PMSG_76__CONTENT_MASK 0xFFFFFFFFL
164−//MP0_SMN_C2PMSG_77
165−#define MP0_SMN_C2PMSG_77__CONTENT__SHIFT 0x0
166−#define MP0_SMN_C2PMSG_77__CONTENT_MASK 0xFFFFFFFFL
167−//MP0_SMN_C2PMSG_78
168−#define MP0_SMN_C2PMSG_78__CONTENT__SHIFT 0x0
169−#define MP0_SMN_C2PMSG_78__CONTENT_MASK 0xFFFFFFFFL
170−//MP0_SMN_C2PMSG_79
171−#define MP0_SMN_C2PMSG_79__CONTENT__SHIFT 0x0
172−#define MP0_SMN_C2PMSG_79__CONTENT_MASK 0xFFFFFFFFL
173−//MP0_SMN_C2PMSG_80
174−#define MP0_SMN_C2PMSG_80__CONTENT__SHIFT 0x0
175−#define MP0_SMN_C2PMSG_80__CONTENT_MASK 0xFFFFFFFFL
176−//MP0_SMN_C2PMSG_81
177−#define MP0_SMN_C2PMSG_81__CONTENT__SHIFT 0x0
178−#define MP0_SMN_C2PMSG_81__CONTENT_MASK 0xFFFFFFFFL
179−//MP0_SMN_C2PMSG_82
180−#define MP0_SMN_C2PMSG_82__CONTENT__SHIFT 0x0
181−#define MP0_SMN_C2PMSG_82__CONTENT_MASK 0xFFFFFFFFL
182−//MP0_SMN_C2PMSG_83
183−#define MP0_SMN_C2PMSG_83__CONTENT__SHIFT 0x0
184−#define MP0_SMN_C2PMSG_83__CONTENT_MASK 0xFFFFFFFFL
185−//MP0_SMN_C2PMSG_84
186−#define MP0_SMN_C2PMSG_84__CONTENT__SHIFT 0x0
187−#define MP0_SMN_C2PMSG_84__CONTENT_MASK 0xFFFFFFFFL
188−//MP0_SMN_C2PMSG_85
189−#define MP0_SMN_C2PMSG_85__CONTENT__SHIFT 0x0
190−#define MP0_SMN_C2PMSG_85__CONTENT_MASK 0xFFFFFFFFL
191−//MP0_SMN_C2PMSG_86
192−#define MP0_SMN_C2PMSG_86__CONTENT__SHIFT 0x0
193−#define MP0_SMN_C2PMSG_86__CONTENT_MASK 0xFFFFFFFFL
194−//MP0_SMN_C2PMSG_87
195−#define MP0_SMN_C2PMSG_87__CONTENT__SHIFT 0x0
196−#define MP0_SMN_C2PMSG_87__CONTENT_MASK 0xFFFFFFFFL
197−//MP0_SMN_C2PMSG_88
198−#define MP0_SMN_C2PMSG_88__CONTENT__SHIFT 0x0
199−#define MP0_SMN_C2PMSG_88__CONTENT_MASK 0xFFFFFFFFL
200−//MP0_SMN_C2PMSG_89
201−#define MP0_SMN_C2PMSG_89__CONTENT__SHIFT 0x0
202−#define MP0_SMN_C2PMSG_89__CONTENT_MASK 0xFFFFFFFFL
203−//MP0_SMN_C2PMSG_90
204−#define MP0_SMN_C2PMSG_90__CONTENT__SHIFT 0x0
205−#define MP0_SMN_C2PMSG_90__CONTENT_MASK 0xFFFFFFFFL
206−//MP0_SMN_C2PMSG_91
207−#define MP0_SMN_C2PMSG_91__CONTENT__SHIFT 0x0
208−#define MP0_SMN_C2PMSG_91__CONTENT_MASK 0xFFFFFFFFL
209−//MP0_SMN_C2PMSG_92
210−#define MP0_SMN_C2PMSG_92__CONTENT__SHIFT 0x0
211−#define MP0_SMN_C2PMSG_92__CONTENT_MASK 0xFFFFFFFFL
212−//MP0_SMN_C2PMSG_93
213−#define MP0_SMN_C2PMSG_93__CONTENT__SHIFT 0x0
214−#define MP0_SMN_C2PMSG_93__CONTENT_MASK 0xFFFFFFFFL
215−//MP0_SMN_C2PMSG_94
216−#define MP0_SMN_C2PMSG_94__CONTENT__SHIFT 0x0
217−#define MP0_SMN_C2PMSG_94__CONTENT_MASK 0xFFFFFFFFL
218−//MP0_SMN_C2PMSG_95
219−#define MP0_SMN_C2PMSG_95__CONTENT__SHIFT 0x0
220−#define MP0_SMN_C2PMSG_95__CONTENT_MASK 0xFFFFFFFFL
221−//MP0_SMN_C2PMSG_96
222−#define MP0_SMN_C2PMSG_96__CONTENT__SHIFT 0x0
223−#define MP0_SMN_C2PMSG_96__CONTENT_MASK 0xFFFFFFFFL
224−//MP0_SMN_C2PMSG_97
225−#define MP0_SMN_C2PMSG_97__CONTENT__SHIFT 0x0
226−#define MP0_SMN_C2PMSG_97__CONTENT_MASK 0xFFFFFFFFL
227−//MP0_SMN_C2PMSG_98
228−#define MP0_SMN_C2PMSG_98__CONTENT__SHIFT 0x0
229−#define MP0_SMN_C2PMSG_98__CONTENT_MASK 0xFFFFFFFFL
230−//MP0_SMN_C2PMSG_99
231−#define MP0_SMN_C2PMSG_99__CONTENT__SHIFT 0x0
232−#define MP0_SMN_C2PMSG_99__CONTENT_MASK 0xFFFFFFFFL
233−//MP0_SMN_C2PMSG_100
234−#define MP0_SMN_C2PMSG_100__CONTENT__SHIFT 0x0
235−#define MP0_SMN_C2PMSG_100__CONTENT_MASK 0xFFFFFFFFL
236−//MP0_SMN_C2PMSG_101
237−#define MP0_SMN_C2PMSG_101__CONTENT__SHIFT 0x0
238−#define MP0_SMN_C2PMSG_101__CONTENT_MASK 0xFFFFFFFFL
239−//MP0_SMN_C2PMSG_102
240−#define MP0_SMN_C2PMSG_102__CONTENT__SHIFT 0x0
241−#define MP0_SMN_C2PMSG_102__CONTENT_MASK 0xFFFFFFFFL
242−//MP0_SMN_C2PMSG_103
243−#define MP0_SMN_C2PMSG_103__CONTENT__SHIFT 0x0
244−#define MP0_SMN_C2PMSG_103__CONTENT_MASK 0xFFFFFFFFL
245−//MP0_SMN_IH_CREDIT
246−#define MP0_SMN_IH_CREDIT__CREDIT_VALUE__SHIFT 0x0
247−#define MP0_SMN_IH_CREDIT__CLIENT_ID__SHIFT 0x10
248−#define MP0_SMN_IH_CREDIT__CREDIT_VALUE_MASK 0x00000003L
249−#define MP0_SMN_IH_CREDIT__CLIENT_ID_MASK 0x00FF0000L
250−//MP0_SMN_IH_SW_INT
251−#define MP0_SMN_IH_SW_INT__ID__SHIFT 0x0
252−#define MP0_SMN_IH_SW_INT__VALID__SHIFT 0x8
253−#define MP0_SMN_IH_SW_INT__ID_MASK 0x000000FFL
254−#define MP0_SMN_IH_SW_INT__VALID_MASK 0x00000100L
255−//MP0_SMN_IH_SW_INT_CTRL
256−#define MP0_SMN_IH_SW_INT_CTRL__INT_MASK__SHIFT 0x0
257−#define MP0_SMN_IH_SW_INT_CTRL__INT_ACK__SHIFT 0x8
258−#define MP0_SMN_IH_SW_INT_CTRL__INT_MASK_MASK 0x00000001L
259−#define MP0_SMN_IH_SW_INT_CTRL__INT_ACK_MASK 0x00000100L
260−
261−
262−// addressBlock: mp_SmuMp1Pub_CruDec
263−//MP1_FIRMWARE_FLAGS
264−#define MP1_FIRMWARE_FLAGS__INTERRUPTS_ENABLED__SHIFT 0x0
265−#define MP1_FIRMWARE_FLAGS__RESERVED__SHIFT 0x1
266−#define MP1_FIRMWARE_FLAGS__INTERRUPTS_ENABLED_MASK 0x00000001L
267−#define MP1_FIRMWARE_FLAGS__RESERVED_MASK 0xFFFFFFFEL
268−
269−
270−// addressBlock: mp_SmuMp1_SmnDec
271−//MP1_SMN_C2PMSG_32
272−#define MP1_SMN_C2PMSG_32__CONTENT__SHIFT 0x0
273−#define MP1_SMN_C2PMSG_32__CONTENT_MASK 0xFFFFFFFFL
274−//MP1_SMN_C2PMSG_33
275−#define MP1_SMN_C2PMSG_33__CONTENT__SHIFT 0x0
276−#define MP1_SMN_C2PMSG_33__CONTENT_MASK 0xFFFFFFFFL
277−//MP1_SMN_C2PMSG_34
278−#define MP1_SMN_C2PMSG_34__CONTENT__SHIFT 0x0
279−#define MP1_SMN_C2PMSG_34__CONTENT_MASK 0xFFFFFFFFL
280−//MP1_SMN_C2PMSG_35
281−#define MP1_SMN_C2PMSG_35__CONTENT__SHIFT 0x0
282−#define MP1_SMN_C2PMSG_35__CONTENT_MASK 0xFFFFFFFFL
283−//MP1_SMN_C2PMSG_36
284−#define MP1_SMN_C2PMSG_36__CONTENT__SHIFT 0x0
285−#define MP1_SMN_C2PMSG_36__CONTENT_MASK 0xFFFFFFFFL
286−//MP1_SMN_C2PMSG_37
287−#define MP1_SMN_C2PMSG_37__CONTENT__SHIFT 0x0
288−#define MP1_SMN_C2PMSG_37__CONTENT_MASK 0xFFFFFFFFL
289−//MP1_SMN_C2PMSG_38
290−#define MP1_SMN_C2PMSG_38__CONTENT__SHIFT 0x0
291−#define MP1_SMN_C2PMSG_38__CONTENT_MASK 0xFFFFFFFFL
292−//MP1_SMN_C2PMSG_39
293−#define MP1_SMN_C2PMSG_39__CONTENT__SHIFT 0x0
294−#define MP1_SMN_C2PMSG_39__CONTENT_MASK 0xFFFFFFFFL
295−//MP1_SMN_C2PMSG_40
296−#define MP1_SMN_C2PMSG_40__CONTENT__SHIFT 0x0
297−#define MP1_SMN_C2PMSG_40__CONTENT_MASK 0xFFFFFFFFL
298−//MP1_SMN_C2PMSG_41
299−#define MP1_SMN_C2PMSG_41__CONTENT__SHIFT 0x0
300−#define MP1_SMN_C2PMSG_41__CONTENT_MASK 0xFFFFFFFFL
301−//MP1_SMN_C2PMSG_42
302−#define MP1_SMN_C2PMSG_42__CONTENT__SHIFT 0x0
303−#define MP1_SMN_C2PMSG_42__CONTENT_MASK 0xFFFFFFFFL
304−//MP1_SMN_C2PMSG_43
305−#define MP1_SMN_C2PMSG_43__CONTENT__SHIFT 0x0
306−#define MP1_SMN_C2PMSG_43__CONTENT_MASK 0xFFFFFFFFL
307−//MP1_SMN_C2PMSG_44
308−#define MP1_SMN_C2PMSG_44__CONTENT__SHIFT 0x0
309−#define MP1_SMN_C2PMSG_44__CONTENT_MASK 0xFFFFFFFFL
310−//MP1_SMN_C2PMSG_45
311−#define MP1_SMN_C2PMSG_45__CONTENT__SHIFT 0x0
312−#define MP1_SMN_C2PMSG_45__CONTENT_MASK 0xFFFFFFFFL
313−//MP1_SMN_C2PMSG_46
314−#define MP1_SMN_C2PMSG_46__CONTENT__SHIFT 0x0
315−#define MP1_SMN_C2PMSG_46__CONTENT_MASK 0xFFFFFFFFL
316−//MP1_SMN_C2PMSG_47
317−#define MP1_SMN_C2PMSG_47__CONTENT__SHIFT 0x0
318−#define MP1_SMN_C2PMSG_47__CONTENT_MASK 0xFFFFFFFFL
319−//MP1_SMN_C2PMSG_48
320−#define MP1_SMN_C2PMSG_48__CONTENT__SHIFT 0x0
321−#define MP1_SMN_C2PMSG_48__CONTENT_MASK 0xFFFFFFFFL
322−//MP1_SMN_C2PMSG_49
323−#define MP1_SMN_C2PMSG_49__CONTENT__SHIFT 0x0
324−#define MP1_SMN_C2PMSG_49__CONTENT_MASK 0xFFFFFFFFL
325−//MP1_SMN_C2PMSG_50
326−#define MP1_SMN_C2PMSG_50__CONTENT__SHIFT 0x0
327−#define MP1_SMN_C2PMSG_50__CONTENT_MASK 0xFFFFFFFFL
328−//MP1_SMN_C2PMSG_51
329−#define MP1_SMN_C2PMSG_51__CONTENT__SHIFT 0x0
330−#define MP1_SMN_C2PMSG_51__CONTENT_MASK 0xFFFFFFFFL
331−//MP1_SMN_C2PMSG_52
332−#define MP1_SMN_C2PMSG_52__CONTENT__SHIFT 0x0
333−#define MP1_SMN_C2PMSG_52__CONTENT_MASK 0xFFFFFFFFL
334−//MP1_SMN_C2PMSG_53
335−#define MP1_SMN_C2PMSG_53__CONTENT__SHIFT 0x0
336−#define MP1_SMN_C2PMSG_53__CONTENT_MASK 0xFFFFFFFFL
337−//MP1_SMN_C2PMSG_54
338−#define MP1_SMN_C2PMSG_54__CONTENT__SHIFT 0x0
339−#define MP1_SMN_C2PMSG_54__CONTENT_MASK 0xFFFFFFFFL
340−//MP1_SMN_C2PMSG_55
341−#define MP1_SMN_C2PMSG_55__CONTENT__SHIFT 0x0
342−#define MP1_SMN_C2PMSG_55__CONTENT_MASK 0xFFFFFFFFL
343−//MP1_SMN_C2PMSG_56
344−#define MP1_SMN_C2PMSG_56__CONTENT__SHIFT 0x0
345−#define MP1_SMN_C2PMSG_56__CONTENT_MASK 0xFFFFFFFFL
346−//MP1_SMN_C2PMSG_57
347−#define MP1_SMN_C2PMSG_57__CONTENT__SHIFT 0x0
348−#define MP1_SMN_C2PMSG_57__CONTENT_MASK 0xFFFFFFFFL
349−//MP1_SMN_C2PMSG_58
350−#define MP1_SMN_C2PMSG_58__CONTENT__SHIFT 0x0
351−#define MP1_SMN_C2PMSG_58__CONTENT_MASK 0xFFFFFFFFL
352−//MP1_SMN_C2PMSG_59
353−#define MP1_SMN_C2PMSG_59__CONTENT__SHIFT 0x0
354−#define MP1_SMN_C2PMSG_59__CONTENT_MASK 0xFFFFFFFFL
355−//MP1_SMN_C2PMSG_60
356−#define MP1_SMN_C2PMSG_60__CONTENT__SHIFT 0x0
357−#define MP1_SMN_C2PMSG_60__CONTENT_MASK 0xFFFFFFFFL
358−//MP1_SMN_C2PMSG_61
359−#define MP1_SMN_C2PMSG_61__CONTENT__SHIFT 0x0
360−#define MP1_SMN_C2PMSG_61__CONTENT_MASK 0xFFFFFFFFL
361−//MP1_SMN_C2PMSG_62
362−#define MP1_SMN_C2PMSG_62__CONTENT__SHIFT 0x0
363−#define MP1_SMN_C2PMSG_62__CONTENT_MASK 0xFFFFFFFFL
364−//MP1_SMN_C2PMSG_63
365−#define MP1_SMN_C2PMSG_63__CONTENT__SHIFT 0x0
366−#define MP1_SMN_C2PMSG_63__CONTENT_MASK 0xFFFFFFFFL
367−//MP1_SMN_C2PMSG_64
368−#define MP1_SMN_C2PMSG_64__CONTENT__SHIFT 0x0
369−#define MP1_SMN_C2PMSG_64__CONTENT_MASK 0xFFFFFFFFL
370−//MP1_SMN_C2PMSG_65
371−#define MP1_SMN_C2PMSG_65__CONTENT__SHIFT 0x0
372−#define MP1_SMN_C2PMSG_65__CONTENT_MASK 0xFFFFFFFFL
373−//MP1_SMN_C2PMSG_66
374−#define MP1_SMN_C2PMSG_66__CONTENT__SHIFT 0x0
375−#define MP1_SMN_C2PMSG_66__CONTENT_MASK 0xFFFFFFFFL
376−//MP1_SMN_C2PMSG_67
377−#define MP1_SMN_C2PMSG_67__CONTENT__SHIFT 0x0
378−#define MP1_SMN_C2PMSG_67__CONTENT_MASK 0xFFFFFFFFL
379−//MP1_SMN_C2PMSG_68
380−#define MP1_SMN_C2PMSG_68__CONTENT__SHIFT 0x0
381−#define MP1_SMN_C2PMSG_68__CONTENT_MASK 0xFFFFFFFFL
382−//MP1_SMN_C2PMSG_69
383−#define MP1_SMN_C2PMSG_69__CONTENT__SHIFT 0x0
384−#define MP1_SMN_C2PMSG_69__CONTENT_MASK 0xFFFFFFFFL
385−//MP1_SMN_C2PMSG_70
386−#define MP1_SMN_C2PMSG_70__CONTENT__SHIFT 0x0
387−#define MP1_SMN_C2PMSG_70__CONTENT_MASK 0xFFFFFFFFL
388−//MP1_SMN_C2PMSG_71
389−#define MP1_SMN_C2PMSG_71__CONTENT__SHIFT 0x0
390−#define MP1_SMN_C2PMSG_71__CONTENT_MASK 0xFFFFFFFFL
391−//MP1_SMN_C2PMSG_72
392−#define MP1_SMN_C2PMSG_72__CONTENT__SHIFT 0x0
393−#define MP1_SMN_C2PMSG_72__CONTENT_MASK 0xFFFFFFFFL
394−//MP1_SMN_C2PMSG_73
395−#define MP1_SMN_C2PMSG_73__CONTENT__SHIFT 0x0
396−#define MP1_SMN_C2PMSG_73__CONTENT_MASK 0xFFFFFFFFL
397−//MP1_SMN_C2PMSG_74
398−#define MP1_SMN_C2PMSG_74__CONTENT__SHIFT 0x0
399−#define MP1_SMN_C2PMSG_74__CONTENT_MASK 0xFFFFFFFFL
400−//MP1_SMN_C2PMSG_75
401−#define MP1_SMN_C2PMSG_75__CONTENT__SHIFT 0x0
402−#define MP1_SMN_C2PMSG_75__CONTENT_MASK 0xFFFFFFFFL
403−//MP1_SMN_C2PMSG_76
404−#define MP1_SMN_C2PMSG_76__CONTENT__SHIFT 0x0
405−#define MP1_SMN_C2PMSG_76__CONTENT_MASK 0xFFFFFFFFL
406−//MP1_SMN_C2PMSG_77
407−#define MP1_SMN_C2PMSG_77__CONTENT__SHIFT 0x0
408−#define MP1_SMN_C2PMSG_77__CONTENT_MASK 0xFFFFFFFFL
409−//MP1_SMN_C2PMSG_78
410−#define MP1_SMN_C2PMSG_78__CONTENT__SHIFT 0x0
411−#define MP1_SMN_C2PMSG_78__CONTENT_MASK 0xFFFFFFFFL
412−//MP1_SMN_C2PMSG_79
413−#define MP1_SMN_C2PMSG_79__CONTENT__SHIFT 0x0
414−#define MP1_SMN_C2PMSG_79__CONTENT_MASK 0xFFFFFFFFL
415−//MP1_SMN_C2PMSG_80
416−#define MP1_SMN_C2PMSG_80__CONTENT__SHIFT 0x0
417−#define MP1_SMN_C2PMSG_80__CONTENT_MASK 0xFFFFFFFFL
418−//MP1_SMN_C2PMSG_81
419−#define MP1_SMN_C2PMSG_81__CONTENT__SHIFT 0x0
420−#define MP1_SMN_C2PMSG_81__CONTENT_MASK 0xFFFFFFFFL
421−//MP1_SMN_C2PMSG_82
422−#define MP1_SMN_C2PMSG_82__CONTENT__SHIFT 0x0
423−#define MP1_SMN_C2PMSG_82__CONTENT_MASK 0xFFFFFFFFL
424−//MP1_SMN_C2PMSG_83
425−#define MP1_SMN_C2PMSG_83__CONTENT__SHIFT 0x0
426−#define MP1_SMN_C2PMSG_83__CONTENT_MASK 0xFFFFFFFFL
427−//MP1_SMN_C2PMSG_84
428−#define MP1_SMN_C2PMSG_84__CONTENT__SHIFT 0x0
429−#define MP1_SMN_C2PMSG_84__CONTENT_MASK 0xFFFFFFFFL
430−//MP1_SMN_C2PMSG_85
431−#define MP1_SMN_C2PMSG_85__CONTENT__SHIFT 0x0
432−#define MP1_SMN_C2PMSG_85__CONTENT_MASK 0xFFFFFFFFL
433−//MP1_SMN_C2PMSG_86
434−#define MP1_SMN_C2PMSG_86__CONTENT__SHIFT 0x0
435−#define MP1_SMN_C2PMSG_86__CONTENT_MASK 0xFFFFFFFFL
436−//MP1_SMN_C2PMSG_87
437−#define MP1_SMN_C2PMSG_87__CONTENT__SHIFT 0x0
438−#define MP1_SMN_C2PMSG_87__CONTENT_MASK 0xFFFFFFFFL
439−//MP1_SMN_C2PMSG_88
440−#define MP1_SMN_C2PMSG_88__CONTENT__SHIFT 0x0
441−#define MP1_SMN_C2PMSG_88__CONTENT_MASK 0xFFFFFFFFL
442−//MP1_SMN_C2PMSG_89
443−#define MP1_SMN_C2PMSG_89__CONTENT__SHIFT 0x0
444−#define MP1_SMN_C2PMSG_89__CONTENT_MASK 0xFFFFFFFFL
445−//MP1_SMN_C2PMSG_90
446−#define MP1_SMN_C2PMSG_90__CONTENT__SHIFT 0x0
447−#define MP1_SMN_C2PMSG_90__CONTENT_MASK 0xFFFFFFFFL
448−//MP1_SMN_C2PMSG_91
449−#define MP1_SMN_C2PMSG_91__CONTENT__SHIFT 0x0
450−#define MP1_SMN_C2PMSG_91__CONTENT_MASK 0xFFFFFFFFL
451−//MP1_SMN_C2PMSG_92
452−#define MP1_SMN_C2PMSG_92__CONTENT__SHIFT 0x0
453−#define MP1_SMN_C2PMSG_92__CONTENT_MASK 0xFFFFFFFFL
454−//MP1_SMN_C2PMSG_93
455−#define MP1_SMN_C2PMSG_93__CONTENT__SHIFT 0x0
456−#define MP1_SMN_C2PMSG_93__CONTENT_MASK 0xFFFFFFFFL
457−//MP1_SMN_C2PMSG_94
458−#define MP1_SMN_C2PMSG_94__CONTENT__SHIFT 0x0
459−#define MP1_SMN_C2PMSG_94__CONTENT_MASK 0xFFFFFFFFL
460−//MP1_SMN_C2PMSG_95
461−#define MP1_SMN_C2PMSG_95__CONTENT__SHIFT 0x0
462−#define MP1_SMN_C2PMSG_95__CONTENT_MASK 0xFFFFFFFFL
463−//MP1_SMN_C2PMSG_96
464−#define MP1_SMN_C2PMSG_96__CONTENT__SHIFT 0x0
465−#define MP1_SMN_C2PMSG_96__CONTENT_MASK 0xFFFFFFFFL
466−//MP1_SMN_C2PMSG_97
467−#define MP1_SMN_C2PMSG_97__CONTENT__SHIFT 0x0
468−#define MP1_SMN_C2PMSG_97__CONTENT_MASK 0xFFFFFFFFL
469−//MP1_SMN_C2PMSG_98
470−#define MP1_SMN_C2PMSG_98__CONTENT__SHIFT 0x0
471−#define MP1_SMN_C2PMSG_98__CONTENT_MASK 0xFFFFFFFFL
472−//MP1_SMN_C2PMSG_99
473−#define MP1_SMN_C2PMSG_99__CONTENT__SHIFT 0x0
474−#define MP1_SMN_C2PMSG_99__CONTENT_MASK 0xFFFFFFFFL
475−//MP1_SMN_C2PMSG_100
476−#define MP1_SMN_C2PMSG_100__CONTENT__SHIFT 0x0
477−#define MP1_SMN_C2PMSG_100__CONTENT_MASK 0xFFFFFFFFL
478−//MP1_SMN_C2PMSG_101
479−#define MP1_SMN_C2PMSG_101__CONTENT__SHIFT 0x0
480−#define MP1_SMN_C2PMSG_101__CONTENT_MASK 0xFFFFFFFFL
481−//MP1_SMN_C2PMSG_102
482−#define MP1_SMN_C2PMSG_102__CONTENT__SHIFT 0x0
483−#define MP1_SMN_C2PMSG_102__CONTENT_MASK 0xFFFFFFFFL
484−//MP1_SMN_C2PMSG_103
485−#define MP1_SMN_C2PMSG_103__CONTENT__SHIFT 0x0
486−#define MP1_SMN_C2PMSG_103__CONTENT_MASK 0xFFFFFFFFL
487−//MP1_SMN_IH_CREDIT
488−#define MP1_SMN_IH_CREDIT__CREDIT_VALUE__SHIFT 0x0
489−#define MP1_SMN_IH_CREDIT__CLIENT_ID__SHIFT 0x10
490−#define MP1_SMN_IH_CREDIT__CREDIT_VALUE_MASK 0x00000003L
491−#define MP1_SMN_IH_CREDIT__CLIENT_ID_MASK 0x00FF0000L
492−//MP1_SMN_IH_SW_INT
493−#define MP1_SMN_IH_SW_INT__ID__SHIFT 0x0
494−#define MP1_SMN_IH_SW_INT__VALID__SHIFT 0x8
495−#define MP1_SMN_IH_SW_INT__ID_MASK 0x000000FFL
496−#define MP1_SMN_IH_SW_INT__VALID_MASK 0x00000100L
497−//MP1_SMN_IH_SW_INT_CTRL
498−#define MP1_SMN_IH_SW_INT_CTRL__INT_MASK__SHIFT 0x0
499−#define MP1_SMN_IH_SW_INT_CTRL__INT_ACK__SHIFT 0x8
500−#define MP1_SMN_IH_SW_INT_CTRL__INT_MASK_MASK 0x00000001L
501−#define MP1_SMN_IH_SW_INT_CTRL__INT_ACK_MASK 0x00000100L
502−//MP1_SMN_FPS_CNT
503−#define MP1_SMN_FPS_CNT__COUNT__SHIFT 0x0
504−#define MP1_SMN_FPS_CNT__COUNT_MASK 0xFFFFFFFFL
505−//MP1_SMN_EXT_SCRATCH0
506−#define MP1_SMN_EXT_SCRATCH0__DATA__SHIFT 0x0
507−#define MP1_SMN_EXT_SCRATCH0__DATA_MASK 0xFFFFFFFFL
508−//MP1_SMN_EXT_SCRATCH1
509−#define MP1_SMN_EXT_SCRATCH1__DATA__SHIFT 0x0
510−#define MP1_SMN_EXT_SCRATCH1__DATA_MASK 0xFFFFFFFFL
511−//MP1_SMN_EXT_SCRATCH2
512−#define MP1_SMN_EXT_SCRATCH2__DATA__SHIFT 0x0
513−#define MP1_SMN_EXT_SCRATCH2__DATA_MASK 0xFFFFFFFFL
514−//MP1_SMN_EXT_SCRATCH3
515−#define MP1_SMN_EXT_SCRATCH3__DATA__SHIFT 0x0
516−#define MP1_SMN_EXT_SCRATCH3__DATA_MASK 0xFFFFFFFFL
517−//MP1_SMN_EXT_SCRATCH4
518−#define MP1_SMN_EXT_SCRATCH4__DATA__SHIFT 0x0
519−#define MP1_SMN_EXT_SCRATCH4__DATA_MASK 0xFFFFFFFFL
520−//MP1_SMN_EXT_SCRATCH5
521−#define MP1_SMN_EXT_SCRATCH5__DATA__SHIFT 0x0
522−#define MP1_SMN_EXT_SCRATCH5__DATA_MASK 0xFFFFFFFFL
523−//MP1_SMN_EXT_SCRATCH6
524−#define MP1_SMN_EXT_SCRATCH6__DATA__SHIFT 0x0
525−#define MP1_SMN_EXT_SCRATCH6__DATA_MASK 0xFFFFFFFFL
526−//MP1_SMN_EXT_SCRATCH7
527−#define MP1_SMN_EXT_SCRATCH7__DATA__SHIFT 0x0
528−#define MP1_SMN_EXT_SCRATCH7__DATA_MASK 0xFFFFFFFFL
529−
530−
531−#endif
drivers/gpu/drm/amd/pm/inc/smu_v13_0.h+1−0
@@ -26,6 +26,7 @@ · 25 unmodified lines
2626 #include "amdgpu_smu.h"
2727
2828 #define SMU13_DRIVER_IF_VERSION_INV 0xFFFFFFFF
29+#define SMU13_DRIVER_IF_VERSION_YELLOW_CARP 0x03
2930 #define SMU13_DRIVER_IF_VERSION_ALDE 0x07
3031
3132 /* MP Apertures */
drivers/gpu/drm/amd/pm/inc/smu_v13_0_1.h+0−57
@@ -1,57 +0,0 @@
1−/*
2− * Copyright 2020 Advanced Micro Devices, Inc.
3− *
4− * Permission is hereby granted, free of charge, to any person obtaining a
5− * copy of this software and associated documentation files (the "Software"),
6− * to deal in the Software without restriction, including without limitation
7− * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8− * and/or sell copies of the Software, and to permit persons to whom the
9− * Software is furnished to do so, subject to the following conditions:
10− *
11− * The above copyright notice and this permission notice shall be included in
12− * all copies or substantial portions of the Software.
13− *
14− * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15− * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16− * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17− * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18− * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19− * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20− * OTHER DEALINGS IN THE SOFTWARE.
21− *
22− */
23−#ifndef __SMU_V13_0_1_H__
24−#define __SMU_V13_0_1_H__
25−
26−#include "amdgpu_smu.h"
27−
28−#define SMU13_0_1_DRIVER_IF_VERSION_INV 0xFFFFFFFF
29−#define SMU13_0_1_DRIVER_IF_VERSION_YELLOW_CARP 0x3
30−
31−/* MP Apertures */
32−#define MP0_Public 0x03800000
33−#define MP0_SRAM 0x03900000
34−#define MP1_Public 0x03b00000
35−#define MP1_SRAM 0x03c00004
36−
37−/* address block */
38−#define smnMP1_FIRMWARE_FLAGS 0x3010024
39−
40−
41−#if defined(SWSMU_CODE_LAYER_L2) || defined(SWSMU_CODE_LAYER_L3)
42−
43−int smu_v13_0_1_check_fw_status(struct smu_context *smu);
44−
45−int smu_v13_0_1_check_fw_version(struct smu_context *smu);
46−
47−int smu_v13_0_1_fini_smc_tables(struct smu_context *smu);
48−
49−int smu_v13_0_1_get_vbios_bootup_values(struct smu_context *smu);
50−
51−int smu_v13_0_1_set_default_dpm_tables(struct smu_context *smu);
52−
53−int smu_v13_0_1_set_driver_table_location(struct smu_context *smu);
54−
55−int smu_v13_0_1_gfx_off_control(struct smu_context *smu, bool enable);
56−#endif
57−#endif
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c+1−0
@@ -1528,6 +1528,7 @@ int smu_v11_0_baco_set_state(struct smu_context *smu, enum smu_baco_state state) · 1527 unmodified lines
15281528 case CHIP_SIENNA_CICHLID:
15291529 case CHIP_NAVY_FLOUNDER:
15301530 case CHIP_DIMGREY_CAVEFISH:
1531+ case CHIP_BEIGE_GOBY:
15311532 if (amdgpu_runtime_pm == 2)
15321533 ret = smu_cmn_send_smc_msg_with_param(smu,
15331534 SMU_MSG_EnterBaco,
drivers/gpu/drm/amd/pm/swsmu/smu13/Makefile+1−1
@@ -23,7 +23,7 @@ · 22 unmodified lines
2323 # Makefile for the 'smu manager' sub-component of powerplay.
2424 # It provides the smu management services for the driver.
2525
26−SMU13_MGR = smu_v13_0.o aldebaran_ppt.o smu_v13_0_1.o yellow_carp_ppt.o
26+SMU13_MGR = smu_v13_0.o aldebaran_ppt.o yellow_carp_ppt.o
2727
2828 AMD_SWSMU_SMU13MGR = $(addprefix $(AMD_SWSMU_PATH)/smu13/,$(SMU13_MGR))
2929
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c+24−0
@@ -210,6 +210,9 @@ int smu_v13_0_check_fw_version(struct smu_context *smu) · 209 unmodified lines
210210 case CHIP_ALDEBARAN:
211211 smu->smc_driver_if_version = SMU13_DRIVER_IF_VERSION_ALDE;
212212 break;
213+ case CHIP_YELLOW_CARP:
214+ smu->smc_driver_if_version = SMU13_DRIVER_IF_VERSION_YELLOW_CARP;
215+ break;
213216 default:
214217 dev_err(smu->adev->dev, "smu unsupported asic type:%d.\n", smu->adev->asic_type);
215218 smu->smc_driver_if_version = SMU13_DRIVER_IF_VERSION_INV;
@@ -694,6 +697,27 @@ failed: · 478 unmodified lines
694697 return ret;
695698 }
696699
700+int smu_v13_0_gfx_off_control(struct smu_context *smu, bool enable)
701+{
702+ int ret = 0;
703+ struct amdgpu_device *adev = smu->adev;
704+
705+ switch (adev->asic_type) {
706+ case CHIP_YELLOW_CARP:
707+ if (!(adev->pm.pp_feature & PP_GFXOFF_MASK))
708+ return 0;
709+ if (enable)
710+ ret = smu_cmn_send_smc_msg(smu, SMU_MSG_AllowGfxOff, NULL);
711+ else
712+ ret = smu_cmn_send_smc_msg(smu, SMU_MSG_DisallowGfxOff, NULL);
713+ break;
714+ default:
715+ break;
716+ }
717+
718+ return ret;
719+}
720+
697721 int smu_v13_0_system_features_control(struct smu_context *smu,
698722 bool en)
699723 {
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_1.c+0−311
@@ -1,311 +0,0 @@
1−/*
2− * Copyright 2020 Advanced Micro Devices, Inc.
3− *
4− * Permission is hereby granted, free of charge, to any person obtaining a
5− * copy of this software and associated documentation files (the "Software"),
6− * to deal in the Software without restriction, including without limitation
7− * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8− * and/or sell copies of the Software, and to permit persons to whom the
9− * Software is furnished to do so, subject to the following conditions:
10− *
11− * The above copyright notice and this permission notice shall be included in
12− * all copies or substantial portions of the Software.
13− *
14− * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15− * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16− * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17− * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18− * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19− * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20− * OTHER DEALINGS IN THE SOFTWARE.
21− */
22−
23−//#include <linux/reboot.h>
24−
25−#define SWSMU_CODE_LAYER_L3
26−
27−#include "amdgpu.h"
28−#include "amdgpu_smu.h"
29−#include "smu_v13_0_1.h"
30−#include "soc15_common.h"
31−#include "smu_cmn.h"
32−#include "atomfirmware.h"
33−#include "amdgpu_atomfirmware.h"
34−#include "amdgpu_atombios.h"
35−#include "atom.h"
36−
37−#include "asic_reg/mp/mp_13_0_1_offset.h"
38−#include "asic_reg/mp/mp_13_0_1_sh_mask.h"
39−
40−/*
41− * DO NOT use these for err/warn/info/debug messages.
42− * Use dev_err, dev_warn, dev_info and dev_dbg instead.
43− * They are more MGPU friendly.
44− */
45−#undef pr_err
46−#undef pr_warn
47−#undef pr_info
48−#undef pr_debug
49−
50−int smu_v13_0_1_check_fw_status(struct smu_context *smu)
51−{
52− struct amdgpu_device *adev = smu->adev;
53− uint32_t mp1_fw_flags;
54−
55− mp1_fw_flags = RREG32_PCIE(MP1_Public |
56− (smnMP1_FIRMWARE_FLAGS & 0xffffffff));
57−
58− if ((mp1_fw_flags & MP1_FIRMWARE_FLAGS__INTERRUPTS_ENABLED_MASK) >>
59− MP1_FIRMWARE_FLAGS__INTERRUPTS_ENABLED__SHIFT)
60− return 0;
61−
62− return -EIO;
63−}
64−
65−int smu_v13_0_1_check_fw_version(struct smu_context *smu)
66−{
67− uint32_t if_version = 0xff, smu_version = 0xff;
68− uint16_t smu_major;
69− uint8_t smu_minor, smu_debug;
70− int ret = 0;
71−
72− ret = smu_cmn_get_smc_version(smu, &if_version, &smu_version);
73− if (ret)
74− return ret;
75−
76− smu_major = (smu_version >> 16) & 0xffff;
77− smu_minor = (smu_version >> 8) & 0xff;
78− smu_debug = (smu_version >> 0) & 0xff;
79−
80− switch (smu->adev->asic_type) {
81− case CHIP_YELLOW_CARP:
82− smu->smc_driver_if_version = SMU13_0_1_DRIVER_IF_VERSION_YELLOW_CARP;
83− break;
84−
85− default:
86− dev_err(smu->adev->dev, "smu unsupported asic type:%d.\n", smu->adev->asic_type);
87− smu->smc_driver_if_version = SMU13_0_1_DRIVER_IF_VERSION_INV;
88− break;
89− }
90−
91− dev_info(smu->adev->dev, "smu fw reported version = 0x%08x (%d.%d.%d)\n",
92− smu_version, smu_major, smu_minor, smu_debug);
93−
94− /*
95− * 1. if_version mismatch is not critical as our fw is designed
96− * to be backward compatible.
97− * 2. New fw usually brings some optimizations. But that's visible
98− * only on the paired driver.
99− * Considering above, we just leave user a warning message instead
100− * of halt driver loading.
101− */
102− if (if_version != smu->smc_driver_if_version) {
103− dev_info(smu->adev->dev, "smu driver if version = 0x%08x, smu fw if version = 0x%08x, "
104− "smu fw version = 0x%08x (%d.%d.%d)\n",
105− smu->smc_driver_if_version, if_version,
106− smu_version, smu_major, smu_minor, smu_debug);
107− dev_warn(smu->adev->dev, "SMU driver if version not matched\n");
108− }
109−
110− return ret;
111−}
112−
113−int smu_v13_0_1_fini_smc_tables(struct smu_context *smu)
114−{
115− struct smu_table_context *smu_table = &smu->smu_table;
116−
117− kfree(smu_table->clocks_table);
118− smu_table->clocks_table = NULL;
119−
120− kfree(smu_table->metrics_table);
121− smu_table->metrics_table = NULL;
122−
123− kfree(smu_table->watermarks_table);
124− smu_table->watermarks_table = NULL;
125−
126− return 0;
127−}
128−
129−static int smu_v13_0_1_atom_get_smu_clockinfo(struct amdgpu_device *adev,
130− uint8_t clk_id,
131− uint8_t syspll_id,
132− uint32_t *clk_freq)
133−{
134− struct atom_get_smu_clock_info_parameters_v3_1 input = {0};
135− struct atom_get_smu_clock_info_output_parameters_v3_1 *output;
136− int ret, index;
137−
138− input.clk_id = clk_id;
139− input.syspll_id = syspll_id;
140− input.command = GET_SMU_CLOCK_INFO_V3_1_GET_CLOCK_FREQ;
141− index = get_index_into_master_table(atom_master_list_of_command_functions_v2_1,
142− getsmuclockinfo);
143−
144− ret = amdgpu_atom_execute_table(adev->mode_info.atom_context, index,
145− (uint32_t *)&input);
146− if (ret)
147− return -EINVAL;
148−
149− output = (struct atom_get_smu_clock_info_output_parameters_v3_1 *)&input;
150− *clk_freq = le32_to_cpu(output->atom_smu_outputclkfreq.smu_clock_freq_hz) / 10000;
151−
152− return 0;
153−}
154−
155−int smu_v13_0_1_get_vbios_bootup_values(struct smu_context *smu)
156−{
157− int ret, index;
158− uint16_t size;
159− uint8_t frev, crev;
160− struct atom_common_table_header *header;
161− struct atom_firmware_info_v3_4 *v_3_4;
162− struct atom_firmware_info_v3_3 *v_3_3;
163− struct atom_firmware_info_v3_1 *v_3_1;
164−
165− index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
166− firmwareinfo);
167−
168− ret = amdgpu_atombios_get_data_table(smu->adev, index, &size, &frev, &crev,
169− (uint8_t **)&header);
170− if (ret)
171− return ret;
172−
173− if (header->format_revision != 3) {
174− dev_err(smu->adev->dev, "unknown atom_firmware_info version! for smu13\n");
175− return -EINVAL;
176− }
177−
178− switch (header->content_revision) {
179− case 0:
180− case 1:
181− case 2:
182− v_3_1 = (struct atom_firmware_info_v3_1 *)header;
183− smu->smu_table.boot_values.revision = v_3_1->firmware_revision;
184− smu->smu_table.boot_values.gfxclk = v_3_1->bootup_sclk_in10khz;
185− smu->smu_table.boot_values.uclk = v_3_1->bootup_mclk_in10khz;
186− smu->smu_table.boot_values.socclk = 0;
187− smu->smu_table.boot_values.dcefclk = 0;
188− smu->smu_table.boot_values.vddc = v_3_1->bootup_vddc_mv;
189− smu->smu_table.boot_values.vddci = v_3_1->bootup_vddci_mv;
190− smu->smu_table.boot_values.mvddc = v_3_1->bootup_mvddc_mv;
191− smu->smu_table.boot_values.vdd_gfx = v_3_1->bootup_vddgfx_mv;
192− smu->smu_table.boot_values.cooling_id = v_3_1->coolingsolution_id;
193− break;
194− case 3:
195− v_3_3 = (struct atom_firmware_info_v3_3 *)header;
196− smu->smu_table.boot_values.revision = v_3_3->firmware_revision;
197− smu->smu_table.boot_values.gfxclk = v_3_3->bootup_sclk_in10khz;
198− smu->smu_table.boot_values.uclk = v_3_3->bootup_mclk_in10khz;
199− smu->smu_table.boot_values.socclk = 0;
200− smu->smu_table.boot_values.dcefclk = 0;
201− smu->smu_table.boot_values.vddc = v_3_3->bootup_vddc_mv;
202− smu->smu_table.boot_values.vddci = v_3_3->bootup_vddci_mv;
203− smu->smu_table.boot_values.mvddc = v_3_3->bootup_mvddc_mv;
204− smu->smu_table.boot_values.vdd_gfx = v_3_3->bootup_vddgfx_mv;
205− smu->smu_table.boot_values.cooling_id = v_3_3->coolingsolution_id;
206− break;
207− case 4:
208− default:
209− v_3_4 = (struct atom_firmware_info_v3_4 *)header;
210− smu->smu_table.boot_values.revision = v_3_4->firmware_revision;
211− smu->smu_table.boot_values.gfxclk = v_3_4->bootup_sclk_in10khz;
212− smu->smu_table.boot_values.uclk = v_3_4->bootup_mclk_in10khz;
213− smu->smu_table.boot_values.socclk = 0;
214− smu->smu_table.boot_values.dcefclk = 0;
215− smu->smu_table.boot_values.vddc = v_3_4->bootup_vddc_mv;
216− smu->smu_table.boot_values.vddci = v_3_4->bootup_vddci_mv;
217− smu->smu_table.boot_values.mvddc = v_3_4->bootup_mvddc_mv;
218− smu->smu_table.boot_values.vdd_gfx = v_3_4->bootup_vddgfx_mv;
219− smu->smu_table.boot_values.cooling_id = v_3_4->coolingsolution_id;
220− break;
221− }
222−
223− smu->smu_table.boot_values.format_revision = header->format_revision;
224− smu->smu_table.boot_values.content_revision = header->content_revision;
225−
226− smu_v13_0_1_atom_get_smu_clockinfo(smu->adev,
227− (uint8_t)SMU11_SYSPLL0_SOCCLK_ID,
228− (uint8_t)0,
229− &smu->smu_table.boot_values.socclk);
230−
231− smu_v13_0_1_atom_get_smu_clockinfo(smu->adev,
232− (uint8_t)SMU11_SYSPLL0_DCEFCLK_ID,
233− (uint8_t)0,
234− &smu->smu_table.boot_values.dcefclk);
235−
236− smu_v13_0_1_atom_get_smu_clockinfo(smu->adev,
237− (uint8_t)SMU11_SYSPLL0_ECLK_ID,
238− (uint8_t)0,
239− &smu->smu_table.boot_values.eclk);
240−
241− smu_v13_0_1_atom_get_smu_clockinfo(smu->adev,
242− (uint8_t)SMU11_SYSPLL0_VCLK_ID,
243− (uint8_t)0,
244− &smu->smu_table.boot_values.vclk);
245−
246− smu_v13_0_1_atom_get_smu_clockinfo(smu->adev,
247− (uint8_t)SMU11_SYSPLL0_DCLK_ID,
248− (uint8_t)0,
249− &smu->smu_table.boot_values.dclk);
250−
251− if ((smu->smu_table.boot_values.format_revision == 3) &&
252− (smu->smu_table.boot_values.content_revision >= 2))
253− smu_v13_0_1_atom_get_smu_clockinfo(smu->adev,
254− (uint8_t)SMU11_SYSPLL1_0_FCLK_ID,
255− (uint8_t)SMU11_SYSPLL1_2_ID,
256− &smu->smu_table.boot_values.fclk);
257−
258− return 0;
259−}
260−
261−int smu_v13_0_1_set_default_dpm_tables(struct smu_context *smu)
262−{
263− struct smu_table_context *smu_table = &smu->smu_table;
264−
265− return smu_cmn_update_table(smu, SMU_TABLE_DPMCLOCKS, 0, smu_table->clocks_table, false);
266−}
267−
268−int smu_v13_0_1_set_driver_table_location(struct smu_context *smu)
269−{
270− struct smu_table *driver_table = &smu->smu_table.driver_table;
271− int ret = 0;
272−
273− if (!driver_table->mc_address)
274− return 0;
275−
276− ret = smu_cmn_send_smc_msg_with_param(smu,
277− SMU_MSG_SetDriverDramAddrHigh,
278− upper_32_bits(driver_table->mc_address),
279− NULL);
280−
281− if (ret)
282− return ret;
283−
284− ret = smu_cmn_send_smc_msg_with_param(smu,
285− SMU_MSG_SetDriverDramAddrLow,
286− lower_32_bits(driver_table->mc_address),
287− NULL);
288−
289− return ret;
290−}
291−
292−int smu_v13_0_1_gfx_off_control(struct smu_context *smu, bool enable)
293−{
294− int ret = 0;
295− struct amdgpu_device *adev = smu->adev;
296−
297− switch (adev->asic_type) {
298− case CHIP_YELLOW_CARP:
299− if (!(adev->pm.pp_feature & PP_GFXOFF_MASK))
300− return 0;
301− if (enable)
302− ret = smu_cmn_send_smc_msg(smu, SMU_MSG_AllowGfxOff, NULL);
303− else
304− ret = smu_cmn_send_smc_msg(smu, SMU_MSG_DisallowGfxOff, NULL);
305− break;
306− default:
307− break;
308− }
309−
310− return ret;
311−}
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c+34−15
@@ -25,7 +25,7 @@ · 24 unmodified lines
2525
2626 #include "amdgpu.h"
2727 #include "amdgpu_smu.h"
28−#include "smu_v13_0_1.h"
28+#include "smu_v13_0.h"
2929 #include "smu13_driver_if_yellow_carp.h"
3030 #include "yellow_carp_ppt.h"
3131 #include "smu_v13_0_1_ppsmc.h"
@@ -186,6 +186,22 @@ err0_out: · 154 unmodified lines
186186 return -ENOMEM;
187187 }
188188
189+static int yellow_carp_fini_smc_tables(struct smu_context *smu)
190+{
191+ struct smu_table_context *smu_table = &smu->smu_table;
192+
193+ kfree(smu_table->clocks_table);
194+ smu_table->clocks_table = NULL;
195+
196+ kfree(smu_table->metrics_table);
197+ smu_table->metrics_table = NULL;
198+
199+ kfree(smu_table->watermarks_table);
200+ smu_table->watermarks_table = NULL;
201+
202+ return 0;
203+}
204+
189205 static int yellow_carp_system_features_control(struct smu_context *smu, bool en)
190206 {
191207 struct smu_feature *feature = &smu->smu_feature;
@@ -282,13 +298,9 @@ static int yellow_carp_mode_reset(struct smu_context *smu, int type) · 90 unmodified lines
282298 if (index < 0)
283299 return index == -EACCES ? 0 : index;
284300
285− mutex_lock(&smu->message_lock);
286−
287− ret = smu_cmn_send_msg_without_waiting(smu, (uint16_t)index, type);
288−
289− mutex_unlock(&smu->message_lock);
290−
291− mdelay(10);
301+ ret = smu_cmn_send_smc_msg_with_param(smu, (uint16_t)index, type, NULL);
302+ if (ret)
303+ dev_err(smu->adev->dev, "Failed to mode reset!\n");
292304
293305 return ret;
294306 }
@@ -659,6 +671,13 @@ static ssize_t yellow_carp_get_gpu_metrics(struct smu_context *smu, · 364 unmodified lines
659671 return sizeof(struct gpu_metrics_v2_1);
660672 }
661673
674+static int yellow_carp_set_default_dpm_tables(struct smu_context *smu)
675+{
676+ struct smu_table_context *smu_table = &smu->smu_table;
677+
678+ return smu_cmn_update_table(smu, SMU_TABLE_DPMCLOCKS, 0, smu_table->clocks_table, false);
679+}
680+
662681 static int yellow_carp_od_edit_dpm_table(struct smu_context *smu, enum PP_OD_DPM_TABLE_COMMAND type,
663682 long input[], uint32_t size)
664683 {
@@ -1203,17 +1222,17 @@ static int yellow_carp_set_fine_grain_gfx_freq_parameters(struct smu_context *sm · 538 unmodified lines
12031222 }
12041223
12051224 static const struct pptable_funcs yellow_carp_ppt_funcs = {
1206− .check_fw_status = smu_v13_0_1_check_fw_status,
1207− .check_fw_version = smu_v13_0_1_check_fw_version,
1225+ .check_fw_status = smu_v13_0_check_fw_status,
1226+ .check_fw_version = smu_v13_0_check_fw_version,
12081227 .init_smc_tables = yellow_carp_init_smc_tables,
1209− .fini_smc_tables = smu_v13_0_1_fini_smc_tables,
1210− .get_vbios_bootup_values = smu_v13_0_1_get_vbios_bootup_values,
1228+ .fini_smc_tables = yellow_carp_fini_smc_tables,
1229+ .get_vbios_bootup_values = smu_v13_0_get_vbios_bootup_values,
12111230 .system_features_control = yellow_carp_system_features_control,
12121231 .send_smc_msg_with_param = smu_cmn_send_smc_msg_with_param,
12131232 .send_smc_msg = smu_cmn_send_smc_msg,
12141233 .dpm_set_vcn_enable = yellow_carp_dpm_set_vcn_enable,
12151234 .dpm_set_jpeg_enable = yellow_carp_dpm_set_jpeg_enable,
1216− .set_default_dpm_table = smu_v13_0_1_set_default_dpm_tables,
1235+ .set_default_dpm_table = yellow_carp_set_default_dpm_tables,
12171236 .read_sensor = yellow_carp_read_sensor,
12181237 .is_dpm_running = yellow_carp_is_dpm_running,
12191238 .set_watermarks_table = yellow_carp_set_watermarks_table,
@@ -1222,8 +1241,8 @@ static const struct pptable_funcs yellow_carp_ppt_funcs = { · 2 unmodified lines
12221241 .get_gpu_metrics = yellow_carp_get_gpu_metrics,
12231242 .get_enabled_mask = smu_cmn_get_enabled_32_bits_mask,
12241243 .get_pp_feature_mask = smu_cmn_get_pp_feature_mask,
1225− .set_driver_table_location = smu_v13_0_1_set_driver_table_location,
1226− .gfx_off_control = smu_v13_0_1_gfx_off_control,
1244+ .set_driver_table_location = smu_v13_0_set_driver_table_location,
1245+ .gfx_off_control = smu_v13_0_gfx_off_control,
12271246 .post_init = yellow_carp_post_smu_init,
12281247 .mode2_reset = yellow_carp_mode2_reset,
12291248 .get_dpm_ultimate_freq = yellow_carp_get_dpm_ultimate_freq,
drivers/gpu/drm/i915/gem/i915_gem_shrinker.c+1−0
@@ -62,6 +62,7 @@ static void try_to_writeback(struct drm_i915_gem_object *obj, · 61 unmodified lines
6262 switch (obj->mm.madv) {
6363 case I915_MADV_DONTNEED:
6464 i915_gem_object_truncate(obj);
65+ return;
6566 case __I915_MADV_PURGED:
6667 return;
6768 }
drivers/gpu/drm/i915/gt/gen8_ppgtt.c+1−4
@@ -303,10 +303,7 @@ static void __gen8_ppgtt_alloc(struct i915_address_space * const vm, · 302 unmodified lines
303303 __i915_gem_object_pin_pages(pt->base);
304304 i915_gem_object_make_unshrinkable(pt->base);
305305
306− if (lvl ||
307− gen8_pt_count(*start, end) < I915_PDES ||
308− intel_vgpu_active(vm->i915))
309− fill_px(pt, vm->scratch[lvl]->encode);
306+ fill_px(pt, vm->scratch[lvl]->encode);
310307
311308 spin_lock(&pd->lock);
312309 if (likely(!pd->entry[idx])) {
drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c+1−1
@@ -348,7 +348,7 @@ static struct i915_fence_reg *fence_find(struct i915_ggtt *ggtt) · 347 unmodified lines
348348 if (intel_has_pending_fb_unpin(ggtt->vm.i915))
349349 return ERR_PTR(-EAGAIN);
350350
351− return ERR_PTR(-EDEADLK);
351+ return ERR_PTR(-ENOBUFS);
352352 }
353353
354354 int __i915_vma_pin_fence(struct i915_vma *vma)
drivers/gpu/drm/msm/msm_gem.c+1−1
@@ -1169,7 +1169,7 @@ static int msm_gem_new_impl(struct drm_device *dev, · 1168 unmodified lines
11691169 case MSM_BO_CACHED_COHERENT:
11701170 if (priv->has_cached_coherent)
11711171 break;
1172− /* fallthrough */
1172+ fallthrough;
11731173 default:
11741174 DRM_DEV_ERROR(dev->dev, "invalid cache flag: %x\n",
11751175 (flags & MSM_BO_CACHE_MASK));
drivers/gpu/drm/panel/panel-novatek-nt35510.c+1−3
@@ -706,9 +706,7 @@ static int nt35510_power_on(struct nt35510 *nt) · 705 unmodified lines
706706 if (ret)
707707 return ret;
708708
709− ret = nt35510_read_id(nt);
710− if (ret)
711− return ret;
709+ nt35510_read_id(nt);
712710
713711 /* Set up stuff in manufacturer control, page 1 */
714712 ret = nt35510_send_long(nt, dsi, MCS_CMD_MAUCCTR,
drivers/gpu/drm/qxl/qxl_ttm.c+1−1
@@ -127,7 +127,7 @@ static void qxl_bo_move_notify(struct ttm_buffer_object *bo, · 126 unmodified lines
127127 struct qxl_bo *qbo;
128128 struct qxl_device *qdev;
129129
130− if (!qxl_ttm_bo_is_qxl_bo(bo))
130+ if (!qxl_ttm_bo_is_qxl_bo(bo) || !bo->resource)
131131 return;
132132 qbo = to_qxl_bo(bo);
133133 qdev = to_qxl(qbo->tbo.base.dev);
drivers/gpu/drm/ttm/ttm_range_manager.c+3−0
@@ -181,6 +181,9 @@ int ttm_range_man_fini(struct ttm_device *bdev, · 180 unmodified lines
181181 struct drm_mm *mm = &rman->mm;
182182 int ret;
183183
184+ if (!man)
185+ return 0;
186+
184187 ttm_resource_manager_set_used(man, false);
185188
186189 ret = ttm_resource_manager_evict_all(bdev, man);
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c+1−0
@@ -36,6 +36,7 @@ · 35 unmodified lines
3636 #include <drm/drm_ioctl.h>
3737 #include <drm/drm_sysfs.h>
3838 #include <drm/ttm/ttm_bo_driver.h>
39+#include <drm/ttm/ttm_range_manager.h>
3940 #include <drm/ttm/ttm_placement.h>
4041 #include <generated/utsrelease.h>
4142
drivers/gpu/drm/vmwgfx/vmwgfx_mob.c+0−1
@@ -354,7 +354,6 @@ static void vmw_otable_batch_takedown(struct vmw_private *dev_priv, · 353 unmodified lines
354354 ttm_bo_unpin(bo);
355355 ttm_bo_unreserve(bo);
356356
357− ttm_bo_unpin(batch->otable_bo);
358357 ttm_bo_put(batch->otable_bo);
359358 batch->otable_bo = NULL;
360359 }
drivers/hv/channel_mgmt.c+64−32
@@ -605,6 +605,17 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel) · 604 unmodified lines
605605 */
606606 mutex_lock(&vmbus_connection.channel_mutex);
607607
608+ list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) {
609+ if (guid_equal(&channel->offermsg.offer.if_type,
610+ &newchannel->offermsg.offer.if_type) &&
611+ guid_equal(&channel->offermsg.offer.if_instance,
612+ &newchannel->offermsg.offer.if_instance)) {
613+ fnew = false;
614+ newchannel->primary_channel = channel;
615+ break;
616+ }
617+ }
618+
608619 init_vp_index(newchannel);
609620
610621 /* Remember the channels that should be cleaned up upon suspend. */
@@ -617,16 +628,6 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel) · 6 unmodified lines
617628 */
618629 atomic_dec(&vmbus_connection.offer_in_progress);
619630
620− list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) {
621− if (guid_equal(&channel->offermsg.offer.if_type,
622− &newchannel->offermsg.offer.if_type) &&
623− guid_equal(&channel->offermsg.offer.if_instance,
624− &newchannel->offermsg.offer.if_instance)) {
625− fnew = false;
626− break;
627− }
628− }
629−
630631 if (fnew) {
631632 list_add_tail(&newchannel->listentry,
632633 &vmbus_connection.chn_list);
@@ -647,7 +648,6 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel) · 14 unmodified lines
647648 /*
648649 * Process the sub-channel.
649650 */
650− newchannel->primary_channel = channel;
651651 list_add_tail(&newchannel->sc_list, &channel->sc_list);
652652 }
653653
@@ -683,6 +683,30 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel) · 29 unmodified lines
683683 queue_work(wq, &newchannel->add_channel_work);
684684 }
685685
686+/*
687+ * Check if CPUs used by other channels of the same device.
688+ * It should only be called by init_vp_index().
689+ */
690+static bool hv_cpuself_used(u32 cpu, struct vmbus_channel *chn)
691+{
692+ struct vmbus_channel *primary = chn->primary_channel;
693+ struct vmbus_channel *sc;
694+
695+ lockdep_assert_held(&vmbus_connection.channel_mutex);
696+
697+ if (!primary)
698+ return false;
699+
700+ if (primary->target_cpu == cpu)
701+ return true;
702+
703+ list_for_each_entry(sc, &primary->sc_list, sc_list)
704+ if (sc != chn && sc->target_cpu == cpu)
705+ return true;
706+
707+ return false;
708+}
709+
686710 /*
687711 * We use this state to statically distribute the channel interrupt load.
688712 */
@@ -702,6 +726,7 @@ static int next_numa_node_id; · 13 unmodified lines
702726 static void init_vp_index(struct vmbus_channel *channel)
703727 {
704728 bool perf_chn = hv_is_perf_channel(channel);
729+ u32 i, ncpu = num_online_cpus();
705730 cpumask_var_t available_mask;
706731 struct cpumask *alloced_mask;
707732 u32 target_cpu;
@@ -724,31 +749,38 @@ static void init_vp_index(struct vmbus_channel *channel) · 16 unmodified lines
724749 return;
725750 }
726751
727− while (true) {
728− numa_node = next_numa_node_id++;
729− if (numa_node == nr_node_ids) {
730− next_numa_node_id = 0;
731− continue;
752+ for (i = 1; i <= ncpu + 1; i++) {
753+ while (true) {
754+ numa_node = next_numa_node_id++;
755+ if (numa_node == nr_node_ids) {
756+ next_numa_node_id = 0;
757+ continue;
758+ }
759+ if (cpumask_empty(cpumask_of_node(numa_node)))
760+ continue;
761+ break;
762+ }
763+ alloced_mask = &hv_context.hv_numa_map[numa_node];
764+
765+ if (cpumask_weight(alloced_mask) ==
766+ cpumask_weight(cpumask_of_node(numa_node))) {
767+ /*
768+ * We have cycled through all the CPUs in the node;
769+ * reset the alloced map.
770+ */
771+ cpumask_clear(alloced_mask);
732772 }
733− if (cpumask_empty(cpumask_of_node(numa_node)))
734− continue;
735− break;
736− }
737− alloced_mask = &hv_context.hv_numa_map[numa_node];
738773
739− if (cpumask_weight(alloced_mask) ==
740− cpumask_weight(cpumask_of_node(numa_node))) {
741− /*
742− * We have cycled through all the CPUs in the node;
743− * reset the alloced map.
744− */
745− cpumask_clear(alloced_mask);
746− }
774+ cpumask_xor(available_mask, alloced_mask,
775+ cpumask_of_node(numa_node));
747776
748− cpumask_xor(available_mask, alloced_mask, cpumask_of_node(numa_node));
777+ target_cpu = cpumask_first(available_mask);
778+ cpumask_set_cpu(target_cpu, alloced_mask);
749779
750− target_cpu = cpumask_first(available_mask);
751− cpumask_set_cpu(target_cpu, alloced_mask);
780+ if (channel->offermsg.offer.sub_channel_index >= ncpu ||
781+ i > ncpu || !hv_cpuself_used(target_cpu, channel))
782+ break;
783+ }
752784
753785 channel->target_cpu = target_cpu;
754786
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c+1−0
@@ -379,6 +379,7 @@ static void arm_smmu_cmdq_skip_err(struct arm_smmu_device *smmu) · 378 unmodified lines
379379 switch (idx) {
380380 case CMDQ_ERR_CERROR_ABT_IDX:
381381 dev_err(smmu->dev, "retrying command fetch\n");
382+ return;
382383 case CMDQ_ERR_CERROR_NONE_IDX:
383384 return;
384385 case CMDQ_ERR_CERROR_ATC_INV_IDX:
drivers/iommu/arm/arm-smmu/qcom_iommu.c+2−11
@@ -849,12 +849,10 @@ static int qcom_iommu_device_probe(struct platform_device *pdev) · 848 unmodified lines
849849 ret = iommu_device_register(&qcom_iommu->iommu, &qcom_iommu_ops, dev);
850850 if (ret) {
851851 dev_err(dev, "Failed to register iommu\n");
852− goto err_sysfs_remove;
852+ return ret;
853853 }
854854
855− ret = bus_set_iommu(&platform_bus_type, &qcom_iommu_ops);
856− if (ret)
857− goto err_unregister_device;
855+ bus_set_iommu(&platform_bus_type, &qcom_iommu_ops);
858856
859857 if (qcom_iommu->local_base) {
860858 pm_runtime_get_sync(dev);
@@ -863,13 +861,6 @@ static int qcom_iommu_device_probe(struct platform_device *pdev) · 2 unmodified lines
863861 }
864862
865863 return 0;
866−
867−err_unregister_device:
868− iommu_device_unregister(&qcom_iommu->iommu);
869−
870−err_sysfs_remove:
871− iommu_device_sysfs_remove(&qcom_iommu->iommu);
872− return ret;
873864 }
874865
875866 static int qcom_iommu_device_remove(struct platform_device *pdev)
drivers/iommu/intel/iommu.c+23−11
@@ -2429,10 +2429,11 @@ __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn, · 2428 unmodified lines
24292429 return 0;
24302430 }
24312431
2432−static void domain_context_clear_one(struct intel_iommu *iommu, u8 bus, u8 devfn)
2432+static void domain_context_clear_one(struct device_domain_info *info, u8 bus, u8 devfn)
24332433 {
2434− unsigned long flags;
2434+ struct intel_iommu *iommu = info->iommu;
24352435 struct context_entry *context;
2436+ unsigned long flags;
24362437 u16 did_old;
24372438
24382439 if (!iommu)
@@ -2444,7 +2445,16 @@ static void domain_context_clear_one(struct intel_iommu *iommu, u8 bus, u8 devfn · 5 unmodified lines
24442445 spin_unlock_irqrestore(&iommu->lock, flags);
24452446 return;
24462447 }
2447− did_old = context_domain_id(context);
2448+
2449+ if (sm_supported(iommu)) {
2450+ if (hw_pass_through && domain_type_is_si(info->domain))
2451+ did_old = FLPT_DEFAULT_DID;
2452+ else
2453+ did_old = info->domain->iommu_did[iommu->seq_id];
2454+ } else {
2455+ did_old = context_domain_id(context);
2456+ }
2457+
24482458 context_clear_entry(context);
24492459 __iommu_flush_cache(iommu, context, sizeof(*context));
24502460 spin_unlock_irqrestore(&iommu->lock, flags);
@@ -2462,6 +2472,8 @@ static void domain_context_clear_one(struct intel_iommu *iommu, u8 bus, u8 devfn · 11 unmodified lines
24622472 0,
24632473 0,
24642474 DMA_TLB_DSI_FLUSH);
2475+
2476+ __iommu_flush_dev_iotlb(info, 0, MAX_AGAW_PFN_WIDTH);
24652477 }
24662478
24672479 static inline void unlink_domain_info(struct device_domain_info *info)
@@ -4425,9 +4437,9 @@ out_free_dmar: · 1957 unmodified lines
44254437
44264438 static int domain_context_clear_one_cb(struct pci_dev *pdev, u16 alias, void *opaque)
44274439 {
4428− struct intel_iommu *iommu = opaque;
4440+ struct device_domain_info *info = opaque;
44294441
4430− domain_context_clear_one(iommu, PCI_BUS_NUM(alias), alias & 0xff);
4442+ domain_context_clear_one(info, PCI_BUS_NUM(alias), alias & 0xff);
44314443 return 0;
44324444 }
44334445
@@ -4437,12 +4449,13 @@ static int domain_context_clear_one_cb(struct pci_dev *pdev, u16 alias, void *op · 3 unmodified lines
44374449 * devices, unbinding the driver from any one of them will possibly leave
44384450 * the others unable to operate.
44394451 */
4440−static void domain_context_clear(struct intel_iommu *iommu, struct device *dev)
4452+static void domain_context_clear(struct device_domain_info *info)
44414453 {
4442− if (!iommu || !dev || !dev_is_pci(dev))
4454+ if (!info->iommu || !info->dev || !dev_is_pci(info->dev))
44434455 return;
44444456
4445− pci_for_each_dma_alias(to_pci_dev(dev), &domain_context_clear_one_cb, iommu);
4457+ pci_for_each_dma_alias(to_pci_dev(info->dev),
4458+ &domain_context_clear_one_cb, info);
44464459 }
44474460
44484461 static void __dmar_remove_one_dev_info(struct device_domain_info *info)
@@ -4459,14 +4472,13 @@ static void __dmar_remove_one_dev_info(struct device_domain_info *info) · 10 unmodified lines
44594472 iommu = info->iommu;
44604473 domain = info->domain;
44614474
4462− if (info->dev) {
4475+ if (info->dev && !dev_is_real_dma_subdevice(info->dev)) {
44634476 if (dev_is_pci(info->dev) && sm_supported(iommu))
44644477 intel_pasid_tear_down_entry(iommu, info->dev,
44654478 PASID_RID2PASID, false);
44664479
44674480 iommu_disable_dev_iotlb(info);
4468− if (!dev_is_real_dma_subdevice(info->dev))
4469− domain_context_clear(iommu, info->dev);
4481+ domain_context_clear(info);
44704482 intel_pasid_free_table(info->dev);
44714483 }
44724484
drivers/iommu/rockchip-iommu.c+4−2
@@ -544,12 +544,14 @@ static inline u32 rk_dma_addr_dte(dma_addr_t dt_dma) · 543 unmodified lines
544544 }
545545
546546 #define DT_HI_MASK GENMASK_ULL(39, 32)
547+#define DTE_BASE_HI_MASK GENMASK(11, 4)
547548 #define DT_SHIFT 28
548549
549550 static inline phys_addr_t rk_dte_addr_phys_v2(u32 addr)
550551 {
551− return (phys_addr_t)(addr & RK_DTE_PT_ADDRESS_MASK) |
552− ((addr & DT_HI_MASK) << DT_SHIFT);
552+ u64 addr64 = addr;
553+ return (phys_addr_t)(addr64 & RK_DTE_PT_ADDRESS_MASK) |
554+ ((addr64 & DTE_BASE_HI_MASK) << DT_SHIFT);
553555 }
554556
555557 static inline u32 rk_dma_addr_dte_v2(dma_addr_t dt_dma)
drivers/mmc/core/block.c+21−14
@@ -28,6 +28,7 @@ · 27 unmodified lines
2828 #include <linux/errno.h>
2929 #include <linux/hdreg.h>
3030 #include <linux/kdev_t.h>
31+#include <linux/kref.h>
3132 #include <linux/blkdev.h>
3233 #include <linux/cdev.h>
3334 #include <linux/mutex.h>
@@ -111,7 +112,7 @@ struct mmc_blk_data { · 77 unmodified lines
111112 #define MMC_BLK_CMD23 (1 << 0) /* Can do SET_BLOCK_COUNT for multiblock */
112113 #define MMC_BLK_REL_WR (1 << 1) /* MMC Reliable write support */
113114
114− unsigned int usage;
115+ struct kref kref;
115116 unsigned int read_only;
116117 unsigned int part_type;
117118 unsigned int reset_done;
@@ -181,10 +182,8 @@ static struct mmc_blk_data *mmc_blk_get(struct gendisk *disk) · 63 unmodified lines
181182
182183 mutex_lock(&open_lock);
183184 md = disk->private_data;
184− if (md && md->usage == 0)
185+ if (md && !kref_get_unless_zero(&md->kref))
185186 md = NULL;
186− if (md)
187− md->usage++;
188187 mutex_unlock(&open_lock);
189188
190189 return md;
@@ -196,18 +195,25 @@ static inline int mmc_get_devidx(struct gendisk *disk) · 5 unmodified lines
196195 return devidx;
197196 }
198197
199−static void mmc_blk_put(struct mmc_blk_data *md)
198+static void mmc_blk_kref_release(struct kref *ref)
200199 {
201− mutex_lock(&open_lock);
202− md->usage--;
203− if (md->usage == 0) {
204− int devidx = mmc_get_devidx(md->disk);
200+ struct mmc_blk_data *md = container_of(ref, struct mmc_blk_data, kref);
201+ int devidx;
205202
206− ida_simple_remove(&mmc_blk_ida, devidx);
207− put_disk(md->disk);
208− kfree(md);
209− }
203+ devidx = mmc_get_devidx(md->disk);
204+ ida_simple_remove(&mmc_blk_ida, devidx);
205+
206+ mutex_lock(&open_lock);
207+ md->disk->private_data = NULL;
210208 mutex_unlock(&open_lock);
209+
210+ put_disk(md->disk);
211+ kfree(md);
212+}
213+
214+static void mmc_blk_put(struct mmc_blk_data *md)
215+{
216+ kref_put(&md->kref, mmc_blk_kref_release);
211217 }
212218
213219 static ssize_t power_ro_lock_show(struct device *dev,
@@ -2327,7 +2333,8 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, · 2113 unmodified lines
23272333
23282334 INIT_LIST_HEAD(&md->part);
23292335 INIT_LIST_HEAD(&md->rpmbs);
2330− md->usage = 1;
2336+ kref_init(&md->kref);
2337+
23312338 md->queue.blkdata = md;
23322339
23332340 md->disk->major = MMC_BLOCK_MAJOR;
drivers/mmc/core/host.c+10−10
@@ -75,7 +75,8 @@ static void mmc_host_classdev_release(struct device *dev) · 74 unmodified lines
7575 {
7676 struct mmc_host *host = cls_dev_to_mmc_host(dev);
7777 wakeup_source_unregister(host->ws);
78− ida_simple_remove(&mmc_host_ida, host->index);
78+ if (of_alias_get_id(host->parent->of_node, "mmc") < 0)
79+ ida_simple_remove(&mmc_host_ida, host->index);
7980 kfree(host);
8081 }
8182
@@ -502,7 +503,7 @@ static int mmc_first_nonreserved_index(void) · 420 unmodified lines
502503 */
503504 struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
504505 {
505− int err;
506+ int index;
506507 struct mmc_host *host;
507508 int alias_id, min_idx, max_idx;
508509
@@ -515,20 +516,19 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev) · 6 unmodified lines
515516
516517 alias_id = of_alias_get_id(dev->of_node, "mmc");
517518 if (alias_id >= 0) {
518− min_idx = alias_id;
519− max_idx = alias_id + 1;
519+ index = alias_id;
520520 } else {
521521 min_idx = mmc_first_nonreserved_index();
522522 max_idx = 0;
523− }
524523
525− err = ida_simple_get(&mmc_host_ida, min_idx, max_idx, GFP_KERNEL);
526− if (err < 0) {
527− kfree(host);
528− return NULL;
524+ index = ida_simple_get(&mmc_host_ida, min_idx, max_idx, GFP_KERNEL);
525+ if (index < 0) {
526+ kfree(host);
527+ return NULL;
528+ }
529529 }
530530
531− host->index = err;
531+ host->index = index;
532532
533533 dev_set_name(&host->class_dev, "mmc%d", host->index);
534534 host->ws = wakeup_source_register(NULL, dev_name(&host->class_dev));
drivers/mmc/host/jz4740_mmc.c+2−0
@@ -789,6 +789,8 @@ static irqreturn_t jz_mmc_irq_worker(int irq, void *devid) · 788 unmodified lines
789789 break;
790790 }
791791 }
792+ fallthrough;
793+
792794 case JZ4740_MMC_STATE_DONE:
793795 break;
794796 }
drivers/mtd/chips/cfi_util.c+2−2
@@ -108,8 +108,8 @@ map_word cfi_build_cmd(u_long cmd, struct map_info *map, struct cfi_private *cfi · 107 unmodified lines
108108 #if BITS_PER_LONG >= 64
109109 case 8:
110110 onecmd |= (onecmd << (chip_mode * 32));
111−#endif
112111 fallthrough;
112+#endif
113113 case 4:
114114 onecmd |= (onecmd << (chip_mode * 16));
115115 fallthrough;
@@ -164,8 +164,8 @@ unsigned long cfi_merge_status(map_word val, struct map_info *map, · 48 unmodified lines
164164 #if BITS_PER_LONG >= 64
165165 case 8:
166166 res |= (onestat >> (chip_mode * 32));
167−#endif
168167 fallthrough;
168+#endif
169169 case 4:
170170 res |= (onestat >> (chip_mode * 16));
171171 fallthrough;
drivers/net/bonding/bond_main.c+2−0
@@ -3450,7 +3450,9 @@ static int bond_master_netdev_event(unsigned long event, · 3449 unmodified lines
34503450 return bond_event_changename(event_bond);
34513451 case NETDEV_UNREGISTER:
34523452 bond_remove_proc_entry(event_bond);
3453+#ifdef CONFIG_XFRM_OFFLOAD
34533454 xfrm_dev_state_flush(dev_net(bond_dev), bond_dev, true);
3455+#endif /* CONFIG_XFRM_OFFLOAD */
34543456 break;
34553457 case NETDEV_REGISTER:
34563458 bond_create_proc_entry(event_bond);
drivers/net/dsa/mt7530.c+2−0
@@ -366,6 +366,8 @@ mt7530_fdb_write(struct mt7530_priv *priv, u16 vid, · 365 unmodified lines
366366 int i;
367367
368368 reg[1] |= vid & CVID_MASK;
369+ if (vid > 1)
370+ reg[1] |= ATA2_IVL;
369371 reg[2] |= (aging & AGE_TIMER_MASK) << AGE_TIMER;
370372 reg[2] |= (port_mask & PORT_MAP_MASK) << PORT_MAP;
371373 /* STATIC_ENT indicate that entry is static wouldn't
drivers/net/dsa/mt7530.h+1−0
@@ -79,6 +79,7 @@ enum mt753x_bpdu_port_fw { · 78 unmodified lines
7979 #define STATIC_EMP 0
8080 #define STATIC_ENT 3
8181 #define MT7530_ATA2 0x78
82+#define ATA2_IVL BIT(15)
8283
8384 /* Register for address table write data */
8485 #define MT7530_ATWD 0x7c
drivers/net/dsa/mv88e6xxx/Kconfig+1−1
@@ -12,7 +12,7 @@ config NET_DSA_MV88E6XXX · 11 unmodified lines
1212 config NET_DSA_MV88E6XXX_PTP
1313 bool "PTP support for Marvell 88E6xxx"
1414 default n
15− depends on PTP_1588_CLOCK
15+ depends on NET_DSA_MV88E6XXX && PTP_1588_CLOCK
1616 help
1717 Say Y to enable PTP hardware timestamping on Marvell 88E6xxx switch
1818 chips that support it.
drivers/net/dsa/sja1105/sja1105_main.c+6−0
@@ -397,6 +397,12 @@ static int sja1105_init_static_vlan(struct sja1105_private *priv) · 396 unmodified lines
397397 if (dsa_is_cpu_port(ds, port))
398398 v->pvid = true;
399399 list_add(&v->list, &priv->dsa_8021q_vlans);
400+
401+ v = kmemdup(v, sizeof(*v), GFP_KERNEL);
402+ if (!v)
403+ return -ENOMEM;
404+
405+ list_add(&v->list, &priv->bridge_vlans);
400406 }
401407
402408 ((struct sja1105_vlan_lookup_entry *)table->entries)[0] = pvid;
drivers/net/ethernet/broadcom/bnxt/bnxt.c+62−23
@@ -1671,11 +1671,16 @@ static inline struct sk_buff *bnxt_tpa_end(struct bnxt *bp, · 1670 unmodified lines
16711671
16721672 if ((tpa_info->flags2 & RX_CMP_FLAGS2_META_FORMAT_VLAN) &&
16731673 (skb->dev->features & BNXT_HW_FEATURE_VLAN_ALL_RX)) {
1674− u16 vlan_proto = tpa_info->metadata >>
1675− RX_CMP_FLAGS2_METADATA_TPID_SFT;
1674+ __be16 vlan_proto = htons(tpa_info->metadata >>
1675+ RX_CMP_FLAGS2_METADATA_TPID_SFT);
16761676 u16 vtag = tpa_info->metadata & RX_CMP_FLAGS2_METADATA_TCI_MASK;
16771677
1678− __vlan_hwaccel_put_tag(skb, htons(vlan_proto), vtag);
1678+ if (eth_type_vlan(vlan_proto)) {
1679+ __vlan_hwaccel_put_tag(skb, vlan_proto, vtag);
1680+ } else {
1681+ dev_kfree_skb(skb);
1682+ return NULL;
1683+ }
16791684 }
16801685
16811686 skb_checksum_none_assert(skb);
@@ -1897,9 +1902,15 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, · 215 unmodified lines
18971902 (skb->dev->features & BNXT_HW_FEATURE_VLAN_ALL_RX)) {
18981903 u32 meta_data = le32_to_cpu(rxcmp1->rx_cmp_meta_data);
18991904 u16 vtag = meta_data & RX_CMP_FLAGS2_METADATA_TCI_MASK;
1900− u16 vlan_proto = meta_data >> RX_CMP_FLAGS2_METADATA_TPID_SFT;
1905+ __be16 vlan_proto = htons(meta_data >>
1906+ RX_CMP_FLAGS2_METADATA_TPID_SFT);
19011907
1902− __vlan_hwaccel_put_tag(skb, htons(vlan_proto), vtag);
1908+ if (eth_type_vlan(vlan_proto)) {
1909+ __vlan_hwaccel_put_tag(skb, vlan_proto, vtag);
1910+ } else {
1911+ dev_kfree_skb(skb);
1912+ goto next_rx;
1913+ }
19031914 }
19041915
19051916 skb_checksum_none_assert(skb);
@@ -7563,8 +7574,12 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp) · 5657 unmodified lines
75637574 bp->flags &= ~BNXT_FLAG_WOL_CAP;
75647575 if (flags & FUNC_QCAPS_RESP_FLAGS_WOL_MAGICPKT_SUPPORTED)
75657576 bp->flags |= BNXT_FLAG_WOL_CAP;
7566− if (flags & FUNC_QCAPS_RESP_FLAGS_PTP_SUPPORTED)
7577+ if (flags & FUNC_QCAPS_RESP_FLAGS_PTP_SUPPORTED) {
75677578 __bnxt_hwrm_ptp_qcfg(bp);
7579+ } else {
7580+ kfree(bp->ptp_cfg);
7581+ bp->ptp_cfg = NULL;
7582+ }
75687583 } else {
75697584 #ifdef CONFIG_BNXT_SRIOV
75707585 struct bnxt_vf_info *vf = &bp->vf;
@@ -10123,7 +10138,6 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init) · 2552 unmodified lines
1012310138 }
1012410139 }
1012510140
10126− bnxt_ptp_start(bp);
1012710141 rc = bnxt_init_nic(bp, irq_re_init);
1012810142 if (rc) {
1012910143 netdev_err(bp->dev, "bnxt_init_nic err: %x\n", rc);
@@ -10197,6 +10211,12 @@ int bnxt_half_open_nic(struct bnxt *bp) · 67 unmodified lines
1019710211 {
1019810212 int rc = 0;
1019910213
10214+ if (test_bit(BNXT_STATE_ABORT_ERR, &bp->state)) {
10215+ netdev_err(bp->dev, "A previous firmware reset has not completed, aborting half open\n");
10216+ rc = -ENODEV;
10217+ goto half_open_err;
10218+ }
10219+
1020010220 rc = bnxt_alloc_mem(bp, false);
1020110221 if (rc) {
1020210222 netdev_err(bp->dev, "bnxt_alloc_mem err: %x\n", rc);
@@ -10256,9 +10276,16 @@ static int bnxt_open(struct net_device *dev) · 53 unmodified lines
1025610276 rc = bnxt_hwrm_if_change(bp, true);
1025710277 if (rc)
1025810278 return rc;
10279+
10280+ if (bnxt_ptp_init(bp)) {
10281+ netdev_warn(dev, "PTP initialization failed.\n");
10282+ kfree(bp->ptp_cfg);
10283+ bp->ptp_cfg = NULL;
10284+ }
1025910285 rc = __bnxt_open_nic(bp, true, true);
1026010286 if (rc) {
1026110287 bnxt_hwrm_if_change(bp, false);
10288+ bnxt_ptp_clear(bp);
1026210289 } else {
1026310290 if (test_and_clear_bit(BNXT_STATE_FW_RESET_DET, &bp->state)) {
1026410291 if (!test_bit(BNXT_STATE_IN_FW_RESET, &bp->state)) {
@@ -10349,6 +10376,7 @@ static int bnxt_close(struct net_device *dev) · 84 unmodified lines
1034910376 {
1035010377 struct bnxt *bp = netdev_priv(dev);
1035110378
10379+ bnxt_ptp_clear(bp);
1035210380 bnxt_hwmon_close(bp);
1035310381 bnxt_close_nic(bp, true, true);
1035410382 bnxt_hwrm_shutdown_link(bp);
@@ -11335,6 +11363,7 @@ static void bnxt_fw_reset_close(struct bnxt *bp) · 980 unmodified lines
1133511363 bnxt_clear_int_mode(bp);
1133611364 pci_disable_device(bp->pdev);
1133711365 }
11366+ bnxt_ptp_clear(bp);
1133811367 __bnxt_close_nic(bp, true, false);
1133911368 bnxt_vf_reps_free(bp);
1134011369 bnxt_clear_int_mode(bp);
@@ -11959,10 +11988,21 @@ static bool bnxt_fw_reset_timeout(struct bnxt *bp) · 618 unmodified lines
1195911988 (bp->fw_reset_max_dsecs * HZ / 10));
1196011989 }
1196111990
11991+static void bnxt_fw_reset_abort(struct bnxt *bp, int rc)
11992+{
11993+ clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
11994+ if (bp->fw_reset_state != BNXT_FW_RESET_STATE_POLL_VF) {
11995+ bnxt_ulp_start(bp, rc);
11996+ bnxt_dl_health_status_update(bp, false);
11997+ }
11998+ bp->fw_reset_state = 0;
11999+ dev_close(bp->dev);
12000+}
12001+
1196212002 static void bnxt_fw_reset_task(struct work_struct *work)
1196312003 {
1196412004 struct bnxt *bp = container_of(work, struct bnxt, fw_reset_task.work);
11965− int rc;
12005+ int rc = 0;
1196612006
1196712007 if (!test_bit(BNXT_STATE_IN_FW_RESET, &bp->state)) {
1196812008 netdev_err(bp->dev, "bnxt_fw_reset_task() called when not in fw reset mode!\n");
@@ -11992,6 +12032,11 @@ static void bnxt_fw_reset_task(struct work_struct *work) · 23 unmodified lines
1199212032 }
1199312033 bp->fw_reset_timestamp = jiffies;
1199412034 rtnl_lock();
12035+ if (test_bit(BNXT_STATE_ABORT_ERR, &bp->state)) {
12036+ bnxt_fw_reset_abort(bp, rc);
12037+ rtnl_unlock();
12038+ return;
12039+ }
1199512040 bnxt_fw_reset_close(bp);
1199612041 if (bp->fw_cap & BNXT_FW_CAP_ERR_RECOVER_RELOAD) {
1199712042 bp->fw_reset_state = BNXT_FW_RESET_STATE_POLL_FW_DOWN;
@@ -12039,6 +12084,7 @@ static void bnxt_fw_reset_task(struct work_struct *work) · 41 unmodified lines
1203912084 if (val == 0xffff) {
1204012085 if (bnxt_fw_reset_timeout(bp)) {
1204112086 netdev_err(bp->dev, "Firmware reset aborted, PCI config space invalid\n");
12087+ rc = -ETIMEDOUT;
1204212088 goto fw_reset_abort;
1204312089 }
1204412090 bnxt_queue_fw_reset_work(bp, HZ / 1000);
@@ -12048,6 +12094,7 @@ static void bnxt_fw_reset_task(struct work_struct *work) · 3 unmodified lines
1204812094 clear_bit(BNXT_STATE_FW_FATAL_COND, &bp->state);
1204912095 if (pci_enable_device(bp->pdev)) {
1205012096 netdev_err(bp->dev, "Cannot re-enable PCI device\n");
12097+ rc = -ENODEV;
1205112098 goto fw_reset_abort;
1205212099 }
1205312100 pci_set_master(bp->pdev);
@@ -12074,9 +12121,10 @@ static void bnxt_fw_reset_task(struct work_struct *work) · 20 unmodified lines
1207412121 }
1207512122 rc = bnxt_open(bp->dev);
1207612123 if (rc) {
12077− netdev_err(bp->dev, "bnxt_open_nic() failed\n");
12078− clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
12079− dev_close(bp->dev);
12124+ netdev_err(bp->dev, "bnxt_open() failed during FW reset\n");
12125+ bnxt_fw_reset_abort(bp, rc);
12126+ rtnl_unlock();
12127+ return;
1208012128 }
1208112129
1208212130 bp->fw_reset_state = 0;
@@ -12103,12 +12151,8 @@ fw_reset_abort_status: · 20 unmodified lines
1210312151 netdev_err(bp->dev, "fw_health_status 0x%x\n", sts);
1210412152 }
1210512153 fw_reset_abort:
12106− clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
12107− if (bp->fw_reset_state != BNXT_FW_RESET_STATE_POLL_VF)
12108− bnxt_dl_health_status_update(bp, false);
12109− bp->fw_reset_state = 0;
1211012154 rtnl_lock();
12111− dev_close(bp->dev);
12155+ bnxt_fw_reset_abort(bp, rc);
1211212156 rtnl_unlock();
1211312157 }
1211412158
@@ -12662,7 +12706,6 @@ static void bnxt_remove_one(struct pci_dev *pdev) · 547 unmodified lines
1266212706 if (BNXT_PF(bp))
1266312707 devlink_port_type_clear(&bp->dl_port);
1266412708
12665− bnxt_ptp_clear(bp);
1266612709 pci_disable_pcie_error_reporting(pdev);
1266712710 unregister_netdev(dev);
1266812711 clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
@@ -13246,11 +13289,6 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 577 unmodified lines
1324613289 rc);
1324713290 }
1324813291
13249− if (bnxt_ptp_init(bp)) {
13250− netdev_warn(dev, "PTP initialization failed.\n");
13251− kfree(bp->ptp_cfg);
13252− bp->ptp_cfg = NULL;
13253− }
1325413292 bnxt_inv_fw_health_reg(bp);
1325513293 bnxt_dl_register(bp);
1325613294
@@ -13436,7 +13474,8 @@ static pci_ers_result_t bnxt_io_error_detected(struct pci_dev *pdev, · 179 unmodified lines
1343613474 if (netif_running(netdev))
1343713475 bnxt_close(netdev);
1343813476
13439− pci_disable_device(pdev);
13477+ if (pci_is_enabled(pdev))
13478+ pci_disable_device(pdev);
1344013479 bnxt_free_ctx_mem(bp);
1344113480 kfree(bp->ctx);
1344213481 bp->ctx = NULL;
drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c+9−1
@@ -433,6 +433,7 @@ static int bnxt_hwrm_queue_dscp2pri_cfg(struct bnxt *bp, struct dcb_app *app, · 432 unmodified lines
433433 static int bnxt_ets_validate(struct bnxt *bp, struct ieee_ets *ets, u8 *tc)
434434 {
435435 int total_ets_bw = 0;
436+ bool zero = false;
436437 u8 max_tc = 0;
437438 int i;
438439
@@ -453,13 +454,20 @@ static int bnxt_ets_validate(struct bnxt *bp, struct ieee_ets *ets, u8 *tc) · 14 unmodified lines
453454 break;
454455 case IEEE_8021QAZ_TSA_ETS:
455456 total_ets_bw += ets->tc_tx_bw[i];
457+ zero = zero || !ets->tc_tx_bw[i];
456458 break;
457459 default:
458460 return -ENOTSUPP;
459461 }
460462 }
461− if (total_ets_bw > 100)
463+ if (total_ets_bw > 100) {
464+ netdev_warn(bp->dev, "rejecting ETS config exceeding available bandwidth\n");
462465 return -EINVAL;
466+ }
467+ if (zero && total_ets_bw == 100) {
468+ netdev_warn(bp->dev, "rejecting ETS config starving a TC\n");
469+ return -EINVAL;
470+ }
463471
464472 if (max_tc >= bp->max_tc)
465473 *tc = bp->max_tc;
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c+7−17
@@ -385,22 +385,6 @@ int bnxt_get_rx_ts_p5(struct bnxt *bp, u64 *ts, u32 pkt_ts) · 384 unmodified lines
385385 return 0;
386386 }
387387
388−void bnxt_ptp_start(struct bnxt *bp)
389−{
390− struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
391−
392− if (!ptp)
393− return;
394−
395− if (bp->flags & BNXT_FLAG_CHIP_P5) {
396− spin_lock_bh(&ptp->ptp_lock);
397− ptp->current_time = bnxt_refclk_read(bp, NULL);
398− WRITE_ONCE(ptp->old_time, ptp->current_time);
399− spin_unlock_bh(&ptp->ptp_lock);
400− ptp_schedule_worker(ptp->ptp_clock, 0);
401− }
402−}
403−
404388 static const struct ptp_clock_info bnxt_ptp_caps = {
405389 .owner = THIS_MODULE,
406390 .name = "bnxt clock",
@@ -450,7 +434,13 @@ int bnxt_ptp_init(struct bnxt *bp) · 43 unmodified lines
450434 bnxt_unmap_ptp_regs(bp);
451435 return err;
452436 }
453−
437+ if (bp->flags & BNXT_FLAG_CHIP_P5) {
438+ spin_lock_bh(&ptp->ptp_lock);
439+ ptp->current_time = bnxt_refclk_read(bp, NULL);
440+ WRITE_ONCE(ptp->old_time, ptp->current_time);
441+ spin_unlock_bh(&ptp->ptp_lock);
442+ ptp_schedule_worker(ptp->ptp_clock, 0);
443+ }
454444 return 0;
455445 }
456446
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h+0−1
@@ -75,7 +75,6 @@ int bnxt_hwtstamp_set(struct net_device *dev, struct ifreq *ifr); · 74 unmodified lines
7575 int bnxt_hwtstamp_get(struct net_device *dev, struct ifreq *ifr);
7676 int bnxt_get_tx_ts_p5(struct bnxt *bp, struct sk_buff *skb);
7777 int bnxt_get_rx_ts_p5(struct bnxt *bp, u64 *ts, u32 pkt_ts);
78−void bnxt_ptp_start(struct bnxt *bp);
7978 int bnxt_ptp_init(struct bnxt *bp);
8079 void bnxt_ptp_clear(struct bnxt *bp);
8180 #endif
drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c+5−4
@@ -479,16 +479,17 @@ struct bnxt_en_dev *bnxt_ulp_probe(struct net_device *dev) · 478 unmodified lines
479479 if (!edev)
480480 return ERR_PTR(-ENOMEM);
481481 edev->en_ops = &bnxt_en_ops_tbl;
482− if (bp->flags & BNXT_FLAG_ROCEV1_CAP)
483− edev->flags |= BNXT_EN_FLAG_ROCEV1_CAP;
484− if (bp->flags & BNXT_FLAG_ROCEV2_CAP)
485− edev->flags |= BNXT_EN_FLAG_ROCEV2_CAP;
486482 edev->net = dev;
487483 edev->pdev = bp->pdev;
488484 edev->l2_db_size = bp->db_size;
489485 edev->l2_db_size_nc = bp->db_size;
490486 bp->edev = edev;
491487 }
488+ edev->flags &= ~BNXT_EN_FLAG_ROCE_CAP;
489+ if (bp->flags & BNXT_FLAG_ROCEV1_CAP)
490+ edev->flags |= BNXT_EN_FLAG_ROCEV1_CAP;
491+ if (bp->flags & BNXT_FLAG_ROCEV2_CAP)
492+ edev->flags |= BNXT_EN_FLAG_ROCEV2_CAP;
492493 return bp->edev;
493494 }
494495 EXPORT_SYMBOL(bnxt_ulp_probe);
drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c+1−1
@@ -420,7 +420,7 @@ static int cn23xx_pf_setup_global_input_regs(struct octeon_device *oct) · 419 unmodified lines
420420 * bits 32:47 indicate the PVF num.
421421 */
422422 for (q_no = 0; q_no < ern; q_no++) {
423− reg_val = oct->pcie_port << CN23XX_PKT_INPUT_CTL_MAC_NUM_POS;
423+ reg_val = (u64)oct->pcie_port << CN23XX_PKT_INPUT_CTL_MAC_NUM_POS;
424424
425425 /* for VF assigned queues. */
426426 if (q_no < oct->sriov_info.pf_srn) {
drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c+8−8
@@ -2809,32 +2809,32 @@ static int dpaa2_switch_ctrl_if_setup(struct ethsw_core *ethsw) · 2808 unmodified lines
28092809 if (err)
28102810 return err;
28112811
2812− err = dpaa2_switch_seed_bp(ethsw);
2813− if (err)
2814− goto err_free_dpbp;
2815−
28162812 err = dpaa2_switch_alloc_rings(ethsw);
28172813 if (err)
2818− goto err_drain_dpbp;
2814+ goto err_free_dpbp;
28192815
28202816 err = dpaa2_switch_setup_dpio(ethsw);
28212817 if (err)
28222818 goto err_destroy_rings;
28232819
2820+ err = dpaa2_switch_seed_bp(ethsw);
2821+ if (err)
2822+ goto err_deregister_dpio;
2823+
28242824 err = dpsw_ctrl_if_enable(ethsw->mc_io, 0, ethsw->dpsw_handle);
28252825 if (err) {
28262826 dev_err(ethsw->dev, "dpsw_ctrl_if_enable err %d\n", err);
2827− goto err_deregister_dpio;
2827+ goto err_drain_dpbp;
28282828 }
28292829
28302830 return 0;
28312831
2832+err_drain_dpbp:
2833+ dpaa2_switch_drain_bp(ethsw);
28322834 err_deregister_dpio:
28332835 dpaa2_switch_free_dpio(ethsw);
28342836 err_destroy_rings:
28352837 dpaa2_switch_destroy_rings(ethsw);
2836−err_drain_dpbp:
2837− dpaa2_switch_drain_bp(ethsw);
28382838 err_free_dpbp:
28392839 dpaa2_switch_free_dpbp(ethsw);
28402840
drivers/net/ethernet/freescale/fman/mac.c+1−0
@@ -524,6 +524,7 @@ static void setup_memac(struct mac_device *mac_dev) · 523 unmodified lines
524524 | SUPPORTED_Autoneg \
525525 | SUPPORTED_Pause \
526526 | SUPPORTED_Asym_Pause \
527+ | SUPPORTED_FIBRE \
527528 | SUPPORTED_MII)
528529
529530 static DEFINE_MUTEX(eth_lock);
drivers/net/ethernet/hisilicon/hip04_eth.c+3−3
@@ -131,7 +131,7 @@ · 130 unmodified lines
131131 /* buf unit size is cache_line_size, which is 64, so the shift is 6 */
132132 #define PPE_BUF_SIZE_SHIFT 6
133133 #define PPE_TX_BUF_HOLD BIT(31)
134−#define CACHE_LINE_MASK 0x3F
134+#define SOC_CACHE_LINE_MASK 0x3F
135135 #else
136136 #define PPE_CFG_QOS_VMID_GRP_SHIFT 8
137137 #define PPE_CFG_RX_CTRL_ALIGN_SHIFT 11
@@ -531,8 +531,8 @@ hip04_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev) · 393 unmodified lines
531531 #if defined(CONFIG_HI13X1_GMAC)
532532 desc->cfg = (__force u32)cpu_to_be32(TX_CLEAR_WB | TX_FINISH_CACHE_INV
533533 | TX_RELEASE_TO_PPE | priv->port << TX_POOL_SHIFT);
534− desc->data_offset = (__force u32)cpu_to_be32(phys & CACHE_LINE_MASK);
535− desc->send_addr = (__force u32)cpu_to_be32(phys & ~CACHE_LINE_MASK);
534+ desc->data_offset = (__force u32)cpu_to_be32(phys & SOC_CACHE_LINE_MASK);
535+ desc->send_addr = (__force u32)cpu_to_be32(phys & ~SOC_CACHE_LINE_MASK);
536536 #else
537537 desc->cfg = (__force u32)cpu_to_be32(TX_CLEAR_WB | TX_FINISH_CACHE_INV);
538538 desc->send_addr = (__force u32)cpu_to_be32(phys);
drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h+5−2
@@ -98,6 +98,7 @@ struct hclgevf_mbx_resp_status { · 97 unmodified lines
9898 u32 origin_mbx_msg;
9999 bool received_resp;
100100 int resp_status;
101+ u16 match_id;
101102 u8 additional_info[HCLGE_MBX_MAX_RESP_DATA_SIZE];
102103 };
103104
@@ -143,7 +144,8 @@ struct hclge_mbx_vf_to_pf_cmd { · 39 unmodified lines
143144 u8 mbx_need_resp;
144145 u8 rsv1[1];
145146 u8 msg_len;
146− u8 rsv2[3];
147+ u8 rsv2;
148+ u16 match_id;
147149 struct hclge_vf_to_pf_msg msg;
148150 };
149151
@@ -153,7 +155,8 @@ struct hclge_mbx_pf_to_vf_cmd { · 3 unmodified lines
153155 u8 dest_vfid;
154156 u8 rsv[3];
155157 u8 msg_len;
156− u8 rsv1[3];
158+ u8 rsv1;
159+ u16 match_id;
157160 struct hclge_pf_to_vf_msg msg;
158161 };
159162
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c+6−2
@@ -9552,13 +9552,17 @@ static int hclge_set_vport_vlan_filter(struct hclge_vport *vport, bool enable) · 9551 unmodified lines
95529552 if (ret)
95539553 return ret;
95549554
9555− if (test_bit(HNAE3_DEV_SUPPORT_PORT_VLAN_BYPASS_B, ae_dev->caps))
9555+ if (test_bit(HNAE3_DEV_SUPPORT_PORT_VLAN_BYPASS_B, ae_dev->caps)) {
95569556 ret = hclge_set_port_vlan_filter_bypass(hdev, vport->vport_id,
95579557 !enable);
9558− else if (!vport->vport_id)
9558+ } else if (!vport->vport_id) {
9559+ if (test_bit(HNAE3_DEV_SUPPORT_VLAN_FLTR_MDF_B, ae_dev->caps))
9560+ enable = false;
9561+
95599562 ret = hclge_set_vlan_filter_ctrl(hdev, HCLGE_FILTER_TYPE_PORT,
95609563 HCLGE_FILTER_FE_INGRESS,
95619564 enable, 0);
9565+ }
95629566
95639567 return ret;
95649568 }
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c+1−0
@@ -47,6 +47,7 @@ static int hclge_gen_resp_to_vf(struct hclge_vport *vport, · 46 unmodified lines
4747
4848 resp_pf_to_vf->dest_vfid = vf_to_pf_req->mbx_src_vfid;
4949 resp_pf_to_vf->msg_len = vf_to_pf_req->msg_len;
50+ resp_pf_to_vf->match_id = vf_to_pf_req->match_id;
5051
5152 resp_pf_to_vf->msg.code = HCLGE_MBX_PF_VF_RESP;
5253 resp_pf_to_vf->msg.vf_mbx_msg_code = vf_to_pf_req->msg.code;
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c+10−0
@@ -2641,6 +2641,16 @@ static int hclgevf_rss_init_hw(struct hclgevf_dev *hdev) · 2640 unmodified lines
26412641
26422642 static int hclgevf_init_vlan_config(struct hclgevf_dev *hdev)
26432643 {
2644+ struct hnae3_handle *nic = &hdev->nic;
2645+ int ret;
2646+
2647+ ret = hclgevf_en_hw_strip_rxvtag(nic, true);
2648+ if (ret) {
2649+ dev_err(&hdev->pdev->dev,
2650+ "failed to enable rx vlan offload, ret = %d\n", ret);
2651+ return ret;
2652+ }
2653+
26442654 return hclgevf_set_vlan_filter(&hdev->nic, htons(ETH_P_8021Q), 0,
26452655 false);
26462656 }
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c+19−0
@@ -13,6 +13,7 @@ static int hclgevf_resp_to_errno(u16 resp_code) · 12 unmodified lines
1313 return resp_code ? -resp_code : 0;
1414 }
1515
16+#define HCLGEVF_MBX_MATCH_ID_START 1
1617 static void hclgevf_reset_mbx_resp_status(struct hclgevf_dev *hdev)
1718 {
1819 /* this function should be called with mbx_resp.mbx_mutex held
@@ -21,6 +22,10 @@ static void hclgevf_reset_mbx_resp_status(struct hclgevf_dev *hdev) · 2 unmodified lines
2122 hdev->mbx_resp.received_resp = false;
2223 hdev->mbx_resp.origin_mbx_msg = 0;
2324 hdev->mbx_resp.resp_status = 0;
25+ hdev->mbx_resp.match_id++;
26+ /* Update match_id and ensure the value of match_id is not zero */
27+ if (hdev->mbx_resp.match_id == 0)
28+ hdev->mbx_resp.match_id = HCLGEVF_MBX_MATCH_ID_START;
2429 memset(hdev->mbx_resp.additional_info, 0, HCLGE_MBX_MAX_RESP_DATA_SIZE);
2530 }
2631
@@ -115,6 +120,7 @@ int hclgevf_send_mbx_msg(struct hclgevf_dev *hdev, · 88 unmodified lines
115120 if (need_resp) {
116121 mutex_lock(&hdev->mbx_resp.mbx_mutex);
117122 hclgevf_reset_mbx_resp_status(hdev);
123+ req->match_id = hdev->mbx_resp.match_id;
118124 status = hclgevf_cmd_send(&hdev->hw, &desc, 1);
119125 if (status) {
120126 dev_err(&hdev->pdev->dev,
@@ -211,6 +217,19 @@ void hclgevf_mbx_handler(struct hclgevf_dev *hdev) · 90 unmodified lines
211217 resp->additional_info[i] = *temp;
212218 temp++;
213219 }
220+
221+ /* If match_id is not zero, it means PF support
222+ * match_id. If the match_id is right, VF get the
223+ * right response, otherwise ignore the response.
224+ * Driver will clear hdev->mbx_resp when send
225+ * next message which need response.
226+ */
227+ if (req->match_id) {
228+ if (req->match_id == resp->match_id)
229+ resp->received_resp = true;
230+ } else {
231+ resp->received_resp = true;
232+ }
214233 break;
215234 case HCLGE_MBX_LINK_STAT_CHANGE:
216235 case HCLGE_MBX_ASSERTING_RESET:
drivers/net/ethernet/ibm/ibmvnic.c+1−1
@@ -1731,7 +1731,6 @@ static netdev_tx_t ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev) · 1730 unmodified lines
17311731 tx_send_failed++;
17321732 tx_dropped++;
17331733 ret = NETDEV_TX_OK;
1734− ibmvnic_tx_scrq_flush(adapter, tx_scrq);
17351734 goto out;
17361735 }
17371736
@@ -1753,6 +1752,7 @@ static netdev_tx_t ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev) · 15 unmodified lines
17531752 dev_kfree_skb_any(skb);
17541753 tx_send_failed++;
17551754 tx_dropped++;
1755+ ibmvnic_tx_scrq_flush(adapter, tx_scrq);
17561756 ret = NETDEV_TX_OK;
17571757 goto out;
17581758 }
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c+2−1
@@ -1825,7 +1825,8 @@ static void ixgbe_dma_sync_frag(struct ixgbe_ring *rx_ring, · 1824 unmodified lines
18251825 struct sk_buff *skb)
18261826 {
18271827 if (ring_uses_build_skb(rx_ring)) {
1828− unsigned long offset = (unsigned long)(skb->data) & ~PAGE_MASK;
1828+ unsigned long mask = (unsigned long)ixgbe_rx_pg_size(rx_ring) - 1;
1829+ unsigned long offset = (unsigned long)(skb->data) & mask;
18291830
18301831 dma_sync_single_range_for_cpu(rx_ring->dev,
18311832 IXGBE_CB(skb)->dma,
drivers/net/ethernet/marvell/octeontx2/af/Makefile+1−1
@@ -10,4 +10,4 @@ obj-$(CONFIG_OCTEONTX2_AF) += rvu_af.o · 9 unmodified lines
1010 rvu_mbox-y := mbox.o rvu_trace.o
1111 rvu_af-y := cgx.o rvu.o rvu_cgx.o rvu_npa.o rvu_nix.o \
1212 rvu_reg.o rvu_npc.o rvu_debugfs.o ptp.o rvu_npc_fs.o \
13− rvu_cpt.o rvu_devlink.o rpm.o rvu_cn10k.o
13+ rvu_cpt.o rvu_devlink.o rpm.o rvu_cn10k.o rvu_switch.o
drivers/net/ethernet/marvell/octeontx2/af/rvu.c+9−1
@@ -1314,7 +1314,7 @@ int rvu_mbox_handler_detach_resources(struct rvu *rvu, · 1313 unmodified lines
13141314 return rvu_detach_rsrcs(rvu, detach, detach->hdr.pcifunc);
13151315 }
13161316
1317−static int rvu_get_nix_blkaddr(struct rvu *rvu, u16 pcifunc)
1317+int rvu_get_nix_blkaddr(struct rvu *rvu, u16 pcifunc)
13181318 {
13191319 struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc);
13201320 int blkaddr = BLKADDR_NIX0, vf;
@@ -2859,6 +2859,12 @@ static int rvu_enable_sriov(struct rvu *rvu) · 1538 unmodified lines
28592859 if (!vfs)
28602860 return 0;
28612861
2862+ /* LBK channel number 63 is used for switching packets between
2863+ * CGX mapped VFs. Hence limit LBK pairs till 62 only.
2864+ */
2865+ if (vfs > 62)
2866+ vfs = 62;
2867+
28622868 /* Save VFs number for reference in VF interrupts handlers.
28632869 * Since interrupts might start arriving during SRIOV enablement
28642870 * ordinary API cannot be used to get number of enabled VFs.
@@ -3001,6 +3007,8 @@ static int rvu_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 136 unmodified lines
30013007 /* Initialize debugfs */
30023008 rvu_dbg_init(rvu);
30033009
3010+ mutex_init(&rvu->rswitch.switch_lock);
3011+
30043012 return 0;
30053013 err_dl:
30063014 rvu_unregister_dl(rvu);
drivers/net/ethernet/marvell/octeontx2/af/rvu.h+21−0
@@ -415,6 +415,16 @@ struct npc_kpu_profile_adapter { · 414 unmodified lines
415415 size_t kpus;
416416 };
417417
418+#define RVU_SWITCH_LBK_CHAN 63
419+
420+struct rvu_switch {
421+ struct mutex switch_lock; /* Serialize flow installation */
422+ u32 used_entries;
423+ u16 *entry2pcifunc;
424+ u16 mode;
425+ u16 start_entry;
426+};
427+
418428 struct rvu {
419429 void __iomem *afreg_base;
420430 void __iomem *pfreg_base;
@@ -445,6 +455,7 @@ struct rvu { · 24 unmodified lines
445455
446456 /* CGX */
447457 #define PF_CGXMAP_BASE 1 /* PF 0 is reserved for RVU PF */
458+ u16 cgx_mapped_vfs; /* maximum CGX mapped VFs */
448459 u8 cgx_mapped_pfs;
449460 u8 cgx_cnt_max; /* CGX port count max */
450461 u8 *pf2cgxlmac_map; /* pf to cgx_lmac map */
@@ -477,6 +488,9 @@ struct rvu { · 26 unmodified lines
477488 struct rvu_debugfs rvu_dbg;
478489 #endif
479490 struct rvu_devlink *rvu_dl;
491+
492+ /* RVU switch implementation over NPC with DMAC rules */
493+ struct rvu_switch rswitch;
480494 };
481495
482496 static inline void rvu_write64(struct rvu *rvu, u64 block, u64 offset, u64 val)
@@ -691,6 +705,7 @@ int nix_aq_context_read(struct rvu *rvu, struct nix_hw *nix_hw, · 208 unmodified lines
691705 struct nix_cn10k_aq_enq_req *aq_req,
692706 struct nix_cn10k_aq_enq_rsp *aq_rsp,
693707 u16 pcifunc, u8 ctype, u32 qidx);
708+int rvu_get_nix_blkaddr(struct rvu *rvu, u16 pcifunc);
694709
695710 /* NPC APIs */
696711 int rvu_npc_init(struct rvu *rvu);
@@ -768,4 +783,10 @@ void rvu_dbg_exit(struct rvu *rvu); · 71 unmodified lines
768783 static inline void rvu_dbg_init(struct rvu *rvu) {}
769784 static inline void rvu_dbg_exit(struct rvu *rvu) {}
770785 #endif
786+
787+/* RVU Switch */
788+void rvu_switch_enable(struct rvu *rvu);
789+void rvu_switch_disable(struct rvu *rvu);
790+void rvu_switch_update_rules(struct rvu *rvu, u16 pcifunc);
791+
771792 #endif /* RVU_H */
drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c+3−0
@@ -126,6 +126,7 @@ static int rvu_map_cgx_lmac_pf(struct rvu *rvu) · 125 unmodified lines
126126 unsigned long lmac_bmap;
127127 int size, free_pkind;
128128 int cgx, lmac, iter;
129+ int numvfs, hwvfs;
129130
130131 if (!cgx_cnt_max)
131132 return 0;
@@ -166,6 +167,8 @@ static int rvu_map_cgx_lmac_pf(struct rvu *rvu) · 34 unmodified lines
166167 pkind->pfchan_map[free_pkind] = ((pf) & 0x3F) << 16;
167168 rvu_map_cgx_nix_block(rvu, pf, cgx, lmac);
168169 rvu->cgx_mapped_pfs++;
170+ rvu_get_pf_numvfs(rvu, pf, &numvfs, &hwvfs);
171+ rvu->cgx_mapped_vfs += numvfs;
169172 pf++;
170173 }
171174 }
drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c+1−4
@@ -2113,9 +2113,6 @@ static void rvu_print_npc_mcam_info(struct seq_file *s, · 2112 unmodified lines
21132113 int entry_acnt, entry_ecnt;
21142114 int cntr_acnt, cntr_ecnt;
21152115
2116− /* Skip PF0 */
2117− if (!pcifunc)
2118− return;
21192116 rvu_npc_get_mcam_entry_alloc_info(rvu, pcifunc, blkaddr,
21202117 &entry_acnt, &entry_ecnt);
21212118 rvu_npc_get_mcam_counter_alloc_info(rvu, pcifunc, blkaddr,
@@ -2298,7 +2295,7 @@ static void rvu_dbg_npc_mcam_show_flows(struct seq_file *s, · 176 unmodified lines
22982295 static void rvu_dbg_npc_mcam_show_action(struct seq_file *s,
22992296 struct rvu_npc_mcam_rule *rule)
23002297 {
2301− if (rule->intf == NIX_INTF_TX) {
2298+ if (is_npc_intf_tx(rule->intf)) {
23022299 switch (rule->tx_action.op) {
23032300 case NIX_TX_ACTIONOP_DROP:
23042301 seq_puts(s, "\taction: Drop\n");
drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c+41−7
@@ -1364,6 +1364,44 @@ static void rvu_health_reporters_destroy(struct rvu *rvu) · 1363 unmodified lines
13641364 rvu_nix_health_reporters_destroy(rvu_dl);
13651365 }
13661366
1367+static int rvu_devlink_eswitch_mode_get(struct devlink *devlink, u16 *mode)
1368+{
1369+ struct rvu_devlink *rvu_dl = devlink_priv(devlink);
1370+ struct rvu *rvu = rvu_dl->rvu;
1371+ struct rvu_switch *rswitch;
1372+
1373+ rswitch = &rvu->rswitch;
1374+ *mode = rswitch->mode;
1375+
1376+ return 0;
1377+}
1378+
1379+static int rvu_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode,
1380+ struct netlink_ext_ack *extack)
1381+{
1382+ struct rvu_devlink *rvu_dl = devlink_priv(devlink);
1383+ struct rvu *rvu = rvu_dl->rvu;
1384+ struct rvu_switch *rswitch;
1385+
1386+ rswitch = &rvu->rswitch;
1387+ switch (mode) {
1388+ case DEVLINK_ESWITCH_MODE_LEGACY:
1389+ case DEVLINK_ESWITCH_MODE_SWITCHDEV:
1390+ if (rswitch->mode == mode)
1391+ return 0;
1392+ rswitch->mode = mode;
1393+ if (mode == DEVLINK_ESWITCH_MODE_SWITCHDEV)
1394+ rvu_switch_enable(rvu);
1395+ else
1396+ rvu_switch_disable(rvu);
1397+ break;
1398+ default:
1399+ return -EINVAL;
1400+ }
1401+
1402+ return 0;
1403+}
1404+
13671405 static int rvu_devlink_info_get(struct devlink *devlink, struct devlink_info_req *req,
13681406 struct netlink_ext_ack *extack)
13691407 {
@@ -1372,6 +1410,8 @@ static int rvu_devlink_info_get(struct devlink *devlink, struct devlink_info_req · 2 unmodified lines
13721410
13731411 static const struct devlink_ops rvu_devlink_ops = {
13741412 .info_get = rvu_devlink_info_get,
1413+ .eswitch_mode_get = rvu_devlink_eswitch_mode_get,
1414+ .eswitch_mode_set = rvu_devlink_eswitch_mode_set,
13751415 };
13761416
13771417 int rvu_register_dl(struct rvu *rvu)
@@ -1380,14 +1420,9 @@ int rvu_register_dl(struct rvu *rvu) · 2 unmodified lines
13801420 struct devlink *dl;
13811421 int err;
13821422
1383− rvu_dl = kzalloc(sizeof(*rvu_dl), GFP_KERNEL);
1384− if (!rvu_dl)
1385− return -ENOMEM;
1386−
13871423 dl = devlink_alloc(&rvu_devlink_ops, sizeof(struct rvu_devlink));
13881424 if (!dl) {
13891425 dev_warn(rvu->dev, "devlink_alloc failed\n");
1390− kfree(rvu_dl);
13911426 return -ENOMEM;
13921427 }
13931428
@@ -1395,10 +1430,10 @@ int rvu_register_dl(struct rvu *rvu) · 1 unmodified line
13951430 if (err) {
13961431 dev_err(rvu->dev, "devlink register failed with error %d\n", err);
13971432 devlink_free(dl);
1398− kfree(rvu_dl);
13991433 return err;
14001434 }
14011435
1436+ rvu_dl = devlink_priv(dl);
14021437 rvu_dl->dl = dl;
14031438 rvu_dl->rvu = rvu;
14041439 rvu->rvu_dl = rvu_dl;
@@ -1417,5 +1452,4 @@ void rvu_unregister_dl(struct rvu *rvu) · 12 unmodified lines
14171452 rvu_health_reporters_destroy(rvu);
14181453 devlink_unregister(dl);
14191454 devlink_free(dl);
1420− kfree(rvu_dl);
14211455 }
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c+36−0
@@ -1952,6 +1952,35 @@ static void nix_tl1_default_cfg(struct rvu *rvu, struct nix_hw *nix_hw, · 1951 unmodified lines
19521952 pfvf_map[schq] = TXSCH_SET_FLAG(pfvf_map[schq], NIX_TXSCHQ_CFG_DONE);
19531953 }
19541954
1955+static void rvu_nix_tx_tl2_cfg(struct rvu *rvu, int blkaddr,
1956+ u16 pcifunc, struct nix_txsch *txsch)
1957+{
1958+ struct rvu_hwinfo *hw = rvu->hw;
1959+ int lbk_link_start, lbk_links;
1960+ u8 pf = rvu_get_pf(pcifunc);
1961+ int schq;
1962+
1963+ if (!is_pf_cgxmapped(rvu, pf))
1964+ return;
1965+
1966+ lbk_link_start = hw->cgx_links;
1967+
1968+ for (schq = 0; schq < txsch->schq.max; schq++) {
1969+ if (TXSCH_MAP_FUNC(txsch->pfvf_map[schq]) != pcifunc)
1970+ continue;
1971+ /* Enable all LBK links with channel 63 by default so that
1972+ * packets can be sent to LBK with a NPC TX MCAM rule
1973+ */
1974+ lbk_links = hw->lbk_links;
1975+ while (lbk_links--)
1976+ rvu_write64(rvu, blkaddr,
1977+ NIX_AF_TL3_TL2X_LINKX_CFG(schq,
1978+ lbk_link_start +
1979+ lbk_links),
1980+ BIT_ULL(12) | RVU_SWITCH_LBK_CHAN);
1981+ }
1982+}
1983+
19551984 int rvu_mbox_handler_nix_txschq_cfg(struct rvu *rvu,
19561985 struct nix_txschq_config *req,
19571986 struct msg_rsp *rsp)
@@ -2040,6 +2069,9 @@ int rvu_mbox_handler_nix_txschq_cfg(struct rvu *rvu, · 82 unmodified lines
20402069 rvu_write64(rvu, blkaddr, reg, regval);
20412070 }
20422071
2072+ rvu_nix_tx_tl2_cfg(rvu, blkaddr, pcifunc,
2073+ &nix_hw->txsch[NIX_TXSCH_LVL_TL2]);
2074+
20432075 return 0;
20442076 }
20452077
@@ -3180,6 +3212,8 @@ int rvu_mbox_handler_nix_set_mac_addr(struct rvu *rvu, · 1134 unmodified lines
31803212 if (test_bit(PF_SET_VF_TRUSTED, &pfvf->flags) && from_vf)
31813213 ether_addr_copy(pfvf->default_mac, req->mac_addr);
31823214
3215+ rvu_switch_update_rules(rvu, pcifunc);
3216+
31833217 return 0;
31843218 }
31853219
@@ -3849,6 +3883,8 @@ int rvu_mbox_handler_nix_lf_start_rx(struct rvu *rvu, struct msg_req *req, · 663 unmodified lines
38493883 pfvf = rvu_get_pfvf(rvu, pcifunc);
38503884 set_bit(NIXLF_INITIALIZED, &pfvf->flags);
38513885
3886+ rvu_switch_update_rules(rvu, pcifunc);
3887+
38523888 return rvu_cgx_start_stop_io(rvu, pcifunc, true);
38533889 }
38543890
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c+36−11
@@ -442,7 +442,8 @@ static void npc_fixup_vf_rule(struct rvu *rvu, struct npc_mcam *mcam, · 441 unmodified lines
442442 owner = mcam->entry2pfvf_map[index];
443443 target_func = (entry->action >> 4) & 0xffff;
444444 /* do nothing when target is LBK/PF or owner is not PF */
445− if (is_afvf(target_func) || (owner & RVU_PFVF_FUNC_MASK) ||
445+ if (is_pffunc_af(owner) || is_afvf(target_func) ||
446+ (owner & RVU_PFVF_FUNC_MASK) ||
446447 !(target_func & RVU_PFVF_FUNC_MASK))
447448 return;
448449
@@ -468,6 +469,8 @@ static void npc_config_mcam_entry(struct rvu *rvu, struct npc_mcam *mcam, · 19 unmodified lines
468469 {
469470 int bank = npc_get_bank(mcam, index);
470471 int kw = 0, actbank, actindex;
472+ u8 tx_intf_mask = ~intf & 0x3;
473+ u8 tx_intf = intf;
471474 u64 cam0, cam1;
472475
473476 actbank = bank; /* Save bank id, to set action later on */
@@ -488,12 +491,21 @@ static void npc_config_mcam_entry(struct rvu *rvu, struct npc_mcam *mcam, · 14 unmodified lines
488491 */
489492 for (; bank < (actbank + mcam->banks_per_entry); bank++, kw = kw + 2) {
490493 /* Interface should be set in all banks */
494+ if (is_npc_intf_tx(intf)) {
495+ /* Last bit must be set and rest don't care
496+ * for TX interfaces
497+ */
498+ tx_intf_mask = 0x1;
499+ tx_intf = intf & tx_intf_mask;
500+ tx_intf_mask = ~tx_intf & tx_intf_mask;
501+ }
502+
491503 rvu_write64(rvu, blkaddr,
492504 NPC_AF_MCAMEX_BANKX_CAMX_INTF(index, bank, 1),
493− intf);
505+ tx_intf);
494506 rvu_write64(rvu, blkaddr,
495507 NPC_AF_MCAMEX_BANKX_CAMX_INTF(index, bank, 0),
496− ~intf & 0x3);
508+ tx_intf_mask);
497509
498510 /* Set the match key */
499511 npc_get_keyword(entry, kw, &cam0, &cam1);
@@ -650,6 +662,7 @@ void rvu_npc_install_ucast_entry(struct rvu *rvu, u16 pcifunc, · 150 unmodified lines
650662 eth_broadcast_addr((u8 *)&req.mask.dmac);
651663 req.features = BIT_ULL(NPC_DMAC);
652664 req.channel = chan;
665+ req.chan_mask = 0xFFFU;
653666 req.intf = pfvf->nix_rx_intf;
654667 req.op = action.op;
655668 req.hdr.pcifunc = 0; /* AF is requester */
@@ -799,6 +812,7 @@ void rvu_npc_install_bcast_match_entry(struct rvu *rvu, u16 pcifunc, · 143 unmodified lines
799812 eth_broadcast_addr((u8 *)&req.mask.dmac);
800813 req.features = BIT_ULL(NPC_DMAC);
801814 req.channel = chan;
815+ req.chan_mask = 0xFFFU;
802816 req.intf = pfvf->nix_rx_intf;
803817 req.entry = index;
804818 req.hdr.pcifunc = 0; /* AF is requester */
@@ -1745,6 +1759,8 @@ static int npc_mcam_rsrcs_init(struct rvu *rvu, int blkaddr) · 940 unmodified lines
17451759 int nixlf_count = rvu_get_nixlf_count(rvu);
17461760 struct npc_mcam *mcam = &rvu->hw->mcam;
17471761 int rsvd, err;
1762+ u16 index;
1763+ int cntr;
17481764 u64 cfg;
17491765
17501766 /* Actual number of MCAM entries vary by entry size */
@@ -1845,6 +1861,14 @@ static int npc_mcam_rsrcs_init(struct rvu *rvu, int blkaddr) · 94 unmodified lines
18451861 if (!mcam->entry2target_pffunc)
18461862 goto free_mem;
18471863
1864+ for (index = 0; index < mcam->bmap_entries; index++) {
1865+ mcam->entry2pfvf_map[index] = NPC_MCAM_INVALID_MAP;
1866+ mcam->entry2cntr_map[index] = NPC_MCAM_INVALID_MAP;
1867+ }
1868+
1869+ for (cntr = 0; cntr < mcam->counters.max; cntr++)
1870+ mcam->cntr2pfvf_map[cntr] = NPC_MCAM_INVALID_MAP;
1871+
18481872 mutex_init(&mcam->lock);
18491873
18501874 return 0;
@@ -2562,7 +2586,7 @@ int rvu_mbox_handler_npc_mcam_alloc_entry(struct rvu *rvu, · 711 unmodified lines
25622586 }
25632587
25642588 /* Alloc request from PFFUNC with no NIXLF attached should be denied */
2565− if (!is_nixlf_attached(rvu, pcifunc))
2589+ if (!is_pffunc_af(pcifunc) && !is_nixlf_attached(rvu, pcifunc))
25662590 return NPC_MCAM_ALLOC_DENIED;
25672591
25682592 return npc_mcam_alloc_entries(mcam, pcifunc, req, rsp);
@@ -2582,7 +2606,7 @@ int rvu_mbox_handler_npc_mcam_free_entry(struct rvu *rvu, · 13 unmodified lines
25822606 return NPC_MCAM_INVALID_REQ;
25832607
25842608 /* Free request from PFFUNC with no NIXLF attached, ignore */
2585− if (!is_nixlf_attached(rvu, pcifunc))
2609+ if (!is_pffunc_af(pcifunc) && !is_nixlf_attached(rvu, pcifunc))
25862610 return NPC_MCAM_INVALID_REQ;
25872611
25882612 mutex_lock(&mcam->lock);
@@ -2594,7 +2618,7 @@ int rvu_mbox_handler_npc_mcam_free_entry(struct rvu *rvu, · 5 unmodified lines
25942618 if (rc)
25952619 goto exit;
25962620
2597− mcam->entry2pfvf_map[req->entry] = 0;
2621+ mcam->entry2pfvf_map[req->entry] = NPC_MCAM_INVALID_MAP;
25982622 mcam->entry2target_pffunc[req->entry] = 0x0;
25992623 npc_mcam_clear_bit(mcam, req->entry);
26002624 npc_enable_mcam_entry(rvu, mcam, blkaddr, req->entry, false);
@@ -2679,13 +2703,14 @@ int rvu_mbox_handler_npc_mcam_write_entry(struct rvu *rvu, · 78 unmodified lines
26792703 else
26802704 nix_intf = pfvf->nix_rx_intf;
26812705
2682− if (npc_mcam_verify_channel(rvu, pcifunc, req->intf, channel)) {
2706+ if (!is_pffunc_af(pcifunc) &&
2707+ npc_mcam_verify_channel(rvu, pcifunc, req->intf, channel)) {
26832708 rc = NPC_MCAM_INVALID_REQ;
26842709 goto exit;
26852710 }
26862711
2687− if (npc_mcam_verify_pf_func(rvu, &req->entry_data, req->intf,
2688− pcifunc)) {
2712+ if (!is_pffunc_af(pcifunc) &&
2713+ npc_mcam_verify_pf_func(rvu, &req->entry_data, req->intf, pcifunc)) {
26892714 rc = NPC_MCAM_INVALID_REQ;
26902715 goto exit;
26912716 }
@@ -2836,7 +2861,7 @@ int rvu_mbox_handler_npc_mcam_alloc_counter(struct rvu *rvu, · 144 unmodified lines
28362861 return NPC_MCAM_INVALID_REQ;
28372862
28382863 /* If the request is from a PFFUNC with no NIXLF attached, ignore */
2839− if (!is_nixlf_attached(rvu, pcifunc))
2864+ if (!is_pffunc_af(pcifunc) && !is_nixlf_attached(rvu, pcifunc))
28402865 return NPC_MCAM_INVALID_REQ;
28412866
28422867 /* Since list of allocated counter IDs needs to be sent to requester,
@@ -3081,7 +3106,7 @@ int rvu_mbox_handler_npc_mcam_alloc_and_write_entry(struct rvu *rvu, · 238 unmodified lines
30813106 if (rc) {
30823107 /* Free allocated MCAM entry */
30833108 mutex_lock(&mcam->lock);
3084− mcam->entry2pfvf_map[entry] = 0;
3109+ mcam->entry2pfvf_map[entry] = NPC_MCAM_INVALID_MAP;
30853110 npc_mcam_clear_bit(mcam, entry);
30863111 mutex_unlock(&mcam->lock);
30873112 return rc;
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c+21−8
@@ -910,14 +910,17 @@ static void rvu_mcam_add_counter_to_rule(struct rvu *rvu, u16 pcifunc, · 909 unmodified lines
910910
911911 static void npc_update_rx_entry(struct rvu *rvu, struct rvu_pfvf *pfvf,
912912 struct mcam_entry *entry,
913− struct npc_install_flow_req *req, u16 target)
913+ struct npc_install_flow_req *req,
914+ u16 target, bool pf_set_vfs_mac)
914915 {
916+ struct rvu_switch *rswitch = &rvu->rswitch;
915917 struct nix_rx_action action;
916− u64 chan_mask;
917918
918− chan_mask = req->chan_mask ? req->chan_mask : ~0ULL;
919− npc_update_entry(rvu, NPC_CHAN, entry, req->channel, 0, chan_mask, 0,
920− NIX_INTF_RX);
919+ if (rswitch->mode == DEVLINK_ESWITCH_MODE_SWITCHDEV && pf_set_vfs_mac)
920+ req->chan_mask = 0x0; /* Do not care channel */
921+
922+ npc_update_entry(rvu, NPC_CHAN, entry, req->channel, 0, req->chan_mask,
923+ 0, NIX_INTF_RX);
921924
922925 *(u64 *)&action = 0x00;
923926 action.pf_func = target;
@@ -949,9 +952,16 @@ static void npc_update_tx_entry(struct rvu *rvu, struct rvu_pfvf *pfvf, · 25 unmodified lines
949952 struct npc_install_flow_req *req, u16 target)
950953 {
951954 struct nix_tx_action action;
955+ u64 mask = ~0ULL;
956+
957+ /* If AF is installing then do not care about
958+ * PF_FUNC in Send Descriptor
959+ */
960+ if (is_pffunc_af(req->hdr.pcifunc))
961+ mask = 0;
952962
953963 npc_update_entry(rvu, NPC_PF_FUNC, entry, (__force u16)htons(target),
954− 0, ~0ULL, 0, NIX_INTF_TX);
964+ 0, mask, 0, NIX_INTF_TX);
955965
956966 *(u64 *)&action = 0x00;
957967 action.op = req->op;
@@ -1002,7 +1012,7 @@ static int npc_install_flow(struct rvu *rvu, int blkaddr, u16 target, · 44 unmodified lines
10021012 req->intf);
10031013
10041014 if (is_npc_intf_rx(req->intf))
1005− npc_update_rx_entry(rvu, pfvf, entry, req, target);
1015+ npc_update_rx_entry(rvu, pfvf, entry, req, target, pf_set_vfs_mac);
10061016 else
10071017 npc_update_tx_entry(rvu, pfvf, entry, req, target);
10081018
@@ -1164,7 +1174,9 @@ int rvu_mbox_handler_npc_install_flow(struct rvu *rvu, · 155 unmodified lines
11641174 if (err)
11651175 return err;
11661176
1167− if (npc_mcam_verify_channel(rvu, target, req->intf, req->channel))
1177+ /* Skip channel validation if AF is installing */
1178+ if (!is_pffunc_af(req->hdr.pcifunc) &&
1179+ npc_mcam_verify_channel(rvu, target, req->intf, req->channel))
11681180 return -EINVAL;
11691181
11701182 pfvf = rvu_get_pfvf(rvu, target);
@@ -1180,6 +1192,7 @@ int rvu_mbox_handler_npc_install_flow(struct rvu *rvu, · 9 unmodified lines
11801192 eth_broadcast_addr((u8 *)&req->mask.dmac);
11811193 }
11821194
1195+ /* Proceed if NIXLF is attached or not for TX rules */
11831196 err = nix_get_nixlf(rvu, target, &nixlf, NULL);
11841197 if (err && is_npc_intf_rx(req->intf) && !pf_set_vfs_mac)
11851198 return -EINVAL;
drivers/net/ethernet/marvell/octeontx2/af/rvu_switch.c+258−0
@@ -0,0 +1,258 @@
1+// SPDX-License-Identifier: GPL-2.0
2+/* Marvell OcteonTx2 RVU Admin Function driver
3+ *
4+ * Copyright (C) 2021 Marvell.
5+ */
6+
7+#include <linux/bitfield.h>
8+#include "rvu.h"
9+
10+static int rvu_switch_install_rx_rule(struct rvu *rvu, u16 pcifunc,
11+ u16 chan_mask)
12+{
13+ struct npc_install_flow_req req = { 0 };
14+ struct npc_install_flow_rsp rsp = { 0 };
15+ struct rvu_pfvf *pfvf;
16+
17+ pfvf = rvu_get_pfvf(rvu, pcifunc);
18+ /* If the pcifunc is not initialized then nothing to do.
19+ * This same function will be called again via rvu_switch_update_rules
20+ * after pcifunc is initialized.
21+ */
22+ if (!test_bit(NIXLF_INITIALIZED, &pfvf->flags))
23+ return 0;
24+
25+ ether_addr_copy(req.packet.dmac, pfvf->mac_addr);
26+ eth_broadcast_addr((u8 *)&req.mask.dmac);
27+ req.hdr.pcifunc = 0; /* AF is requester */
28+ req.vf = pcifunc;
29+ req.features = BIT_ULL(NPC_DMAC);
30+ req.channel = pfvf->rx_chan_base;
31+ req.chan_mask = chan_mask;
32+ req.intf = pfvf->nix_rx_intf;
33+ req.op = NIX_RX_ACTION_DEFAULT;
34+ req.default_rule = 1;
35+
36+ return rvu_mbox_handler_npc_install_flow(rvu, &req, &rsp);
37+}
38+
39+static int rvu_switch_install_tx_rule(struct rvu *rvu, u16 pcifunc, u16 entry)
40+{
41+ struct npc_install_flow_req req = { 0 };
42+ struct npc_install_flow_rsp rsp = { 0 };
43+ struct rvu_pfvf *pfvf;
44+ u8 lbkid;
45+
46+ pfvf = rvu_get_pfvf(rvu, pcifunc);
47+ /* If the pcifunc is not initialized then nothing to do.
48+ * This same function will be called again via rvu_switch_update_rules
49+ * after pcifunc is initialized.
50+ */
51+ if (!test_bit(NIXLF_INITIALIZED, &pfvf->flags))
52+ return 0;
53+
54+ lbkid = pfvf->nix_blkaddr == BLKADDR_NIX0 ? 0 : 1;
55+ ether_addr_copy(req.packet.dmac, pfvf->mac_addr);
56+ eth_broadcast_addr((u8 *)&req.mask.dmac);
57+ req.hdr.pcifunc = 0; /* AF is requester */
58+ req.vf = pcifunc;
59+ req.entry = entry;
60+ req.features = BIT_ULL(NPC_DMAC);
61+ req.intf = pfvf->nix_tx_intf;
62+ req.op = NIX_TX_ACTIONOP_UCAST_CHAN;
63+ req.index = (lbkid << 8) | RVU_SWITCH_LBK_CHAN;
64+ req.set_cntr = 1;
65+
66+ return rvu_mbox_handler_npc_install_flow(rvu, &req, &rsp);
67+}
68+
69+static int rvu_switch_install_rules(struct rvu *rvu)
70+{
71+ struct rvu_switch *rswitch = &rvu->rswitch;
72+ u16 start = rswitch->start_entry;
73+ struct rvu_hwinfo *hw = rvu->hw;
74+ int pf, vf, numvfs, hwvf;
75+ u16 pcifunc, entry = 0;
76+ int err;
77+
78+ for (pf = 1; pf < hw->total_pfs; pf++) {
79+ if (!is_pf_cgxmapped(rvu, pf))
80+ continue;
81+
82+ pcifunc = pf << 10;
83+ /* rvu_get_nix_blkaddr sets up the corresponding NIX block
84+ * address and NIX RX and TX interfaces for a pcifunc.
85+ * Generally it is called during attach call of a pcifunc but it
86+ * is called here since we are pre-installing rules before
87+ * nixlfs are attached
88+ */
89+ rvu_get_nix_blkaddr(rvu, pcifunc);
90+
91+ /* MCAM RX rule for a PF/VF already exists as default unicast
92+ * rules installed by AF. Hence change the channel in those
93+ * rules to ignore channel so that packets with the required
94+ * DMAC received from LBK(by other PF/VFs in system) or from
95+ * external world (from wire) are accepted.
96+ */
97+ err = rvu_switch_install_rx_rule(rvu, pcifunc, 0x0);
98+ if (err) {
99+ dev_err(rvu->dev, "RX rule for PF%d failed(%d)\n",
100+ pf, err);
101+ return err;
102+ }
103+
104+ err = rvu_switch_install_tx_rule(rvu, pcifunc, start + entry);
105+ if (err) {
106+ dev_err(rvu->dev, "TX rule for PF%d failed(%d)\n",
107+ pf, err);
108+ return err;
109+ }
110+
111+ rswitch->entry2pcifunc[entry++] = pcifunc;
112+
113+ rvu_get_pf_numvfs(rvu, pf, &numvfs, &hwvf);
114+ for (vf = 0; vf < numvfs; vf++, hwvf++) {
115+ pcifunc = pf << 10 | ((vf + 1) & 0x3FF);
116+ rvu_get_nix_blkaddr(rvu, pcifunc);
117+
118+ err = rvu_switch_install_rx_rule(rvu, pcifunc, 0x0);
119+ if (err) {
120+ dev_err(rvu->dev,
121+ "RX rule for PF%dVF%d failed(%d)\n",
122+ pf, vf, err);
123+ return err;
124+ }
125+
126+ err = rvu_switch_install_tx_rule(rvu, pcifunc,
127+ start + entry);
128+ if (err) {
129+ dev_err(rvu->dev,
130+ "TX rule for PF%dVF%d failed(%d)\n",
131+ pf, vf, err);
132+ return err;
133+ }
134+
135+ rswitch->entry2pcifunc[entry++] = pcifunc;
136+ }
137+ }
138+
139+ return 0;
140+}
141+
142+void rvu_switch_enable(struct rvu *rvu)
143+{
144+ struct npc_mcam_alloc_entry_req alloc_req = { 0 };
145+ struct npc_mcam_alloc_entry_rsp alloc_rsp = { 0 };
146+ struct npc_delete_flow_req uninstall_req = { 0 };
147+ struct npc_mcam_free_entry_req free_req = { 0 };
148+ struct rvu_switch *rswitch = &rvu->rswitch;
149+ struct msg_rsp rsp;
150+ int ret;
151+
152+ alloc_req.contig = true;
153+ alloc_req.count = rvu->cgx_mapped_pfs + rvu->cgx_mapped_vfs;
154+ ret = rvu_mbox_handler_npc_mcam_alloc_entry(rvu, &alloc_req,
155+ &alloc_rsp);
156+ if (ret) {
157+ dev_err(rvu->dev,
158+ "Unable to allocate MCAM entries\n");
159+ goto exit;
160+ }
161+
162+ if (alloc_rsp.count != alloc_req.count) {
163+ dev_err(rvu->dev,
164+ "Unable to allocate %d MCAM entries, got %d\n",
165+ alloc_req.count, alloc_rsp.count);
166+ goto free_entries;
167+ }
168+
169+ rswitch->entry2pcifunc = kcalloc(alloc_req.count, sizeof(u16),
170+ GFP_KERNEL);
171+ if (!rswitch->entry2pcifunc)
172+ goto free_entries;
173+
174+ rswitch->used_entries = alloc_rsp.count;
175+ rswitch->start_entry = alloc_rsp.entry;
176+
177+ ret = rvu_switch_install_rules(rvu);
178+ if (ret)
179+ goto uninstall_rules;
180+
181+ return;
182+
183+uninstall_rules:
184+ uninstall_req.start = rswitch->start_entry;
185+ uninstall_req.end = rswitch->start_entry + rswitch->used_entries - 1;
186+ rvu_mbox_handler_npc_delete_flow(rvu, &uninstall_req, &rsp);
187+ kfree(rswitch->entry2pcifunc);
188+free_entries:
189+ free_req.all = 1;
190+ rvu_mbox_handler_npc_mcam_free_entry(rvu, &free_req, &rsp);
191+exit:
192+ return;
193+}
194+
195+void rvu_switch_disable(struct rvu *rvu)
196+{
197+ struct npc_delete_flow_req uninstall_req = { 0 };
198+ struct npc_mcam_free_entry_req free_req = { 0 };
199+ struct rvu_switch *rswitch = &rvu->rswitch;
200+ struct rvu_hwinfo *hw = rvu->hw;
201+ int pf, vf, numvfs, hwvf;
202+ struct msg_rsp rsp;
203+ u16 pcifunc;
204+ int err;
205+
206+ if (!rswitch->used_entries)
207+ return;
208+
209+ for (pf = 1; pf < hw->total_pfs; pf++) {
210+ if (!is_pf_cgxmapped(rvu, pf))
211+ continue;
212+
213+ pcifunc = pf << 10;
214+ err = rvu_switch_install_rx_rule(rvu, pcifunc, 0xFFF);
215+ if (err)
216+ dev_err(rvu->dev,
217+ "Reverting RX rule for PF%d failed(%d)\n",
218+ pf, err);
219+
220+ for (vf = 0; vf < numvfs; vf++, hwvf++) {
221+ pcifunc = pf << 10 | ((vf + 1) & 0x3FF);
222+ err = rvu_switch_install_rx_rule(rvu, pcifunc, 0xFFF);
223+ if (err)
224+ dev_err(rvu->dev,
225+ "Reverting RX rule for PF%dVF%d failed(%d)\n",
226+ pf, vf, err);
227+ }
228+ }
229+
230+ uninstall_req.start = rswitch->start_entry;
231+ uninstall_req.end = rswitch->start_entry + rswitch->used_entries - 1;
232+ free_req.all = 1;
233+ rvu_mbox_handler_npc_delete_flow(rvu, &uninstall_req, &rsp);
234+ rvu_mbox_handler_npc_mcam_free_entry(rvu, &free_req, &rsp);
235+ rswitch->used_entries = 0;
236+ kfree(rswitch->entry2pcifunc);
237+}
238+
239+void rvu_switch_update_rules(struct rvu *rvu, u16 pcifunc)
240+{
241+ struct rvu_switch *rswitch = &rvu->rswitch;
242+ u32 max = rswitch->used_entries;
243+ u16 entry;
244+
245+ if (!rswitch->used_entries)
246+ return;
247+
248+ for (entry = 0; entry < max; entry++) {
249+ if (rswitch->entry2pcifunc[entry] == pcifunc)
250+ break;
251+ }
252+
253+ if (entry >= max)
254+ return;
255+
256+ rvu_switch_install_tx_rule(rvu, pcifunc, rswitch->start_entry + entry);
257+ rvu_switch_install_rx_rule(rvu, pcifunc, 0x0);
258+}
drivers/net/ethernet/microchip/sparx5/Kconfig+1−0
@@ -3,6 +3,7 @@ config SPARX5_SWITCH · 2 unmodified lines
33 depends on NET_SWITCHDEV
44 depends on HAS_IOMEM
55 depends on OF
6+ depends on ARCH_SPARX5 || COMPILE_TEST
67 select PHYLINK
78 select PHY_SPARX5_SERDES
89 select RESET_CONTROLLER
drivers/net/ethernet/netronome/nfp/flower/conntrack.c+1−0
@@ -1769,6 +1769,7 @@ int nfp_fl_ct_del_flow(struct nfp_fl_ct_map_entry *ct_map_ent) · 1768 unmodified lines
17691769 nfp_ct_map_params);
17701770 nfp_fl_ct_clean_flow_entry(ct_map_ent->ct_entry);
17711771 kfree(ct_map_ent);
1772+ break;
17721773 default:
17731774 break;
17741775 }
drivers/net/ethernet/realtek/r8169_main.c+2−1
@@ -5084,7 +5084,8 @@ static int r8169_mdio_register(struct rtl8169_private *tp) · 5083 unmodified lines
50845084 new_bus->priv = tp;
50855085 new_bus->parent = &pdev->dev;
50865086 new_bus->irq[0] = PHY_MAC_INTERRUPT;
5087− snprintf(new_bus->id, MII_BUS_ID_SIZE, "r8169-%x", pci_dev_id(pdev));
5087+ snprintf(new_bus->id, MII_BUS_ID_SIZE, "r8169-%x-%x",
5088+ pci_domain_nr(pdev->bus), pci_dev_id(pdev));
50885089
50895090 new_bus->read = r8169_mdio_read_reg;
50905091 new_bus->write = r8169_mdio_write_reg;
drivers/net/ethernet/renesas/ravb.h+1−1
@@ -864,7 +864,7 @@ enum GECMR_BIT { · 863 unmodified lines
864864
865865 /* The Ethernet AVB descriptor definitions. */
866866 struct ravb_desc {
867− __le16 ds; /* Descriptor size */
867+ __le16 ds; /* Descriptor size */
868868 u8 cc; /* Content control MSBs (reserved) */
869869 u8 die_dt; /* Descriptor interrupt enable and type */
870870 __le32 dptr; /* Descriptor pointer */
drivers/net/ethernet/renesas/ravb_main.c+1−1
@@ -920,7 +920,7 @@ static int ravb_poll(struct napi_struct *napi, int budget) · 919 unmodified lines
920920 if (ravb_rx(ndev, &quota, q))
921921 goto out;
922922
923− /* Processing RX Descriptor Ring */
923+ /* Processing TX Descriptor Ring */
924924 spin_lock_irqsave(&priv->lock, flags);
925925 /* Clear TX interrupt */
926926 ravb_write(ndev, ~(mask | TIS_RESERVED), TIS);
drivers/net/ethernet/xscale/ptp_ixp46x.c+2−0
@@ -14,6 +14,8 @@ · 13 unmodified lines
1414 #include <linux/kernel.h>
1515 #include <linux/ptp_clock_kernel.h>
1616 #include <linux/soc/ixp4xx/cpu.h>
17+#include <linux/module.h>
18+#include <mach/ixp4xx-regs.h>
1719
1820 #include "ixp46x_ts.h"
1921
drivers/net/usb/r8152.c+20−10
@@ -1552,7 +1552,8 @@ static int · 1551 unmodified lines
15521552 rtl8152_set_speed(struct r8152 *tp, u8 autoneg, u32 speed, u8 duplex,
15531553 u32 advertising);
15541554
1555−static int rtl8152_set_mac_address(struct net_device *netdev, void *p)
1555+static int __rtl8152_set_mac_address(struct net_device *netdev, void *p,
1556+ bool in_resume)
15561557 {
15571558 struct r8152 *tp = netdev_priv(netdev);
15581559 struct sockaddr *addr = p;
@@ -1561,9 +1562,11 @@ static int rtl8152_set_mac_address(struct net_device *netdev, void *p) · 2 unmodified lines
15611562 if (!is_valid_ether_addr(addr->sa_data))
15621563 goto out1;
15631564
1564− ret = usb_autopm_get_interface(tp->intf);
1565− if (ret < 0)
1566− goto out1;
1565+ if (!in_resume) {
1566+ ret = usb_autopm_get_interface(tp->intf);
1567+ if (ret < 0)
1568+ goto out1;
1569+ }
15671570
15681571 mutex_lock(&tp->control);
15691572
@@ -1575,11 +1578,17 @@ static int rtl8152_set_mac_address(struct net_device *netdev, void *p) · 5 unmodified lines
15751578
15761579 mutex_unlock(&tp->control);
15771580
1578− usb_autopm_put_interface(tp->intf);
1581+ if (!in_resume)
1582+ usb_autopm_put_interface(tp->intf);
15791583 out1:
15801584 return ret;
15811585 }
15821586
1587+static int rtl8152_set_mac_address(struct net_device *netdev, void *p)
1588+{
1589+ return __rtl8152_set_mac_address(netdev, p, false);
1590+}
1591+
15831592 /* Devices containing proper chips can support a persistent
15841593 * host system provided MAC address.
15851594 * Examples of this are Dell TB15 and Dell WD15 docks
@@ -1698,7 +1707,7 @@ static int determine_ethernet_addr(struct r8152 *tp, struct sockaddr *sa) · 112 unmodified lines
16981707 return ret;
16991708 }
17001709
1701−static int set_ethernet_addr(struct r8152 *tp)
1710+static int set_ethernet_addr(struct r8152 *tp, bool in_resume)
17021711 {
17031712 struct net_device *dev = tp->netdev;
17041713 struct sockaddr sa;
@@ -1711,7 +1720,7 @@ static int set_ethernet_addr(struct r8152 *tp) · 6 unmodified lines
17111720 if (tp->version == RTL_VER_01)
17121721 ether_addr_copy(dev->dev_addr, sa.sa_data);
17131722 else
1714− ret = rtl8152_set_mac_address(dev, &sa);
1723+ ret = __rtl8152_set_mac_address(dev, &sa, in_resume);
17151724
17161725 return ret;
17171726 }
@@ -6763,9 +6772,10 @@ static int rtl8152_close(struct net_device *netdev) · 5045 unmodified lines
67636772 tp->rtl_ops.down(tp);
67646773
67656774 mutex_unlock(&tp->control);
6775+ }
67666776
6777+ if (!res)
67676778 usb_autopm_put_interface(tp->intf);
6768− }
67696779
67706780 free_all_mem(tp);
67716781
@@ -8443,7 +8453,7 @@ static int rtl8152_reset_resume(struct usb_interface *intf) · 1671 unmodified lines
84438453 clear_bit(SELECTIVE_SUSPEND, &tp->flags);
84448454 tp->rtl_ops.init(tp);
84458455 queue_delayed_work(system_long_wq, &tp->hw_phy_work, 0);
8446− set_ethernet_addr(tp);
8456+ set_ethernet_addr(tp, true);
84478457 return rtl8152_resume(intf);
84488458 }
84498459
@@ -9644,7 +9654,7 @@ static int rtl8152_probe(struct usb_interface *intf, · 1194 unmodified lines
96449654 tp->rtl_fw.retry = true;
96459655 #endif
96469656 queue_delayed_work(system_long_wq, &tp->hw_phy_work, 0);
9647− set_ethernet_addr(tp);
9657+ set_ethernet_addr(tp, false);
96489658
96499659 usb_set_intfdata(intf, tp);
96509660
drivers/net/wireless/mediatek/mt76/mt7921/main.c+1−0
@@ -389,6 +389,7 @@ static int mt7921_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, · 388 unmodified lines
389389 case WLAN_CIPHER_SUITE_WEP104:
390390 if (!mvif->wep_sta)
391391 return -EOPNOTSUPP;
392+ break;
392393 case WLAN_CIPHER_SUITE_TKIP:
393394 case WLAN_CIPHER_SUITE_CCMP:
394395 case WLAN_CIPHER_SUITE_CCMP_256:
drivers/nvme/host/pci.c+58−9
@@ -1554,6 +1554,28 @@ static void nvme_init_queue(struct nvme_queue *nvmeq, u16 qid) · 1553 unmodified lines
15541554 wmb(); /* ensure the first interrupt sees the initialization */
15551555 }
15561556
1557+/*
1558+ * Try getting shutdown_lock while setting up IO queues.
1559+ */
1560+static int nvme_setup_io_queues_trylock(struct nvme_dev *dev)
1561+{
1562+ /*
1563+ * Give up if the lock is being held by nvme_dev_disable.
1564+ */
1565+ if (!mutex_trylock(&dev->shutdown_lock))
1566+ return -ENODEV;
1567+
1568+ /*
1569+ * Controller is in wrong state, fail early.
1570+ */
1571+ if (dev->ctrl.state != NVME_CTRL_CONNECTING) {
1572+ mutex_unlock(&dev->shutdown_lock);
1573+ return -ENODEV;
1574+ }
1575+
1576+ return 0;
1577+}
1578+
15571579 static int nvme_create_queue(struct nvme_queue *nvmeq, int qid, bool polled)
15581580 {
15591581 struct nvme_dev *dev = nvmeq->dev;
@@ -1582,8 +1604,11 @@ static int nvme_create_queue(struct nvme_queue *nvmeq, int qid, bool polled) · 22 unmodified lines
15821604 goto release_cq;
15831605
15841606 nvmeq->cq_vector = vector;
1585− nvme_init_queue(nvmeq, qid);
15861607
1608+ result = nvme_setup_io_queues_trylock(dev);
1609+ if (result)
1610+ return result;
1611+ nvme_init_queue(nvmeq, qid);
15871612 if (!polled) {
15881613 result = queue_request_irq(nvmeq);
15891614 if (result < 0)
@@ -1591,10 +1616,12 @@ static int nvme_create_queue(struct nvme_queue *nvmeq, int qid, bool polled) · 1 unmodified line
15911616 }
15921617
15931618 set_bit(NVMEQ_ENABLED, &nvmeq->flags);
1619+ mutex_unlock(&dev->shutdown_lock);
15941620 return result;
15951621
15961622 release_sq:
15971623 dev->online_queues--;
1624+ mutex_unlock(&dev->shutdown_lock);
15981625 adapter_delete_sq(dev, qid);
15991626 release_cq:
16001627 adapter_delete_cq(dev, qid);
@@ -2167,7 +2194,18 @@ static int nvme_setup_io_queues(struct nvme_dev *dev) · 566 unmodified lines
21672194 if (nr_io_queues == 0)
21682195 return 0;
21692196
2170− clear_bit(NVMEQ_ENABLED, &adminq->flags);
2197+ /*
2198+ * Free IRQ resources as soon as NVMEQ_ENABLED bit transitions
2199+ * from set to unset. If there is a window to it is truely freed,
2200+ * pci_free_irq_vectors() jumping into this window will crash.
2201+ * And take lock to avoid racing with pci_free_irq_vectors() in
2202+ * nvme_dev_disable() path.
2203+ */
2204+ result = nvme_setup_io_queues_trylock(dev);
2205+ if (result)
2206+ return result;
2207+ if (test_and_clear_bit(NVMEQ_ENABLED, &adminq->flags))
2208+ pci_free_irq(pdev, 0, adminq);
21712209
21722210 if (dev->cmb_use_sqes) {
21732211 result = nvme_cmb_qdepth(dev, nr_io_queues,
@@ -2183,14 +2221,17 @@ static int nvme_setup_io_queues(struct nvme_dev *dev) · 9 unmodified lines
21832221 result = nvme_remap_bar(dev, size);
21842222 if (!result)
21852223 break;
2186− if (!--nr_io_queues)
2187− return -ENOMEM;
2224+ if (!--nr_io_queues) {
2225+ result = -ENOMEM;
2226+ goto out_unlock;
2227+ }
21882228 } while (1);
21892229 adminq->q_db = dev->dbs;
21902230
21912231 retry:
21922232 /* Deregister the admin queue's interrupt */
2193− pci_free_irq(pdev, 0, adminq);
2233+ if (test_and_clear_bit(NVMEQ_ENABLED, &adminq->flags))
2234+ pci_free_irq(pdev, 0, adminq);
21942235
21952236 /*
21962237 * If we enable msix early due to not intx, disable it again before
@@ -2199,8 +2240,10 @@ static int nvme_setup_io_queues(struct nvme_dev *dev) · 2 unmodified lines
21992240 pci_free_irq_vectors(pdev);
22002241
22012242 result = nvme_setup_irqs(dev, nr_io_queues);
2202− if (result <= 0)
2203− return -EIO;
2243+ if (result <= 0) {
2244+ result = -EIO;
2245+ goto out_unlock;
2246+ }
22042247
22052248 dev->num_vecs = result;
22062249 result = max(result - 1, 1);
@@ -2214,8 +2257,9 @@ static int nvme_setup_io_queues(struct nvme_dev *dev) · 7 unmodified lines
22142257 */
22152258 result = queue_request_irq(adminq);
22162259 if (result)
2217− return result;
2260+ goto out_unlock;
22182261 set_bit(NVMEQ_ENABLED, &adminq->flags);
2262+ mutex_unlock(&dev->shutdown_lock);
22192263
22202264 result = nvme_create_io_queues(dev);
22212265 if (result || dev->online_queues < 2)
@@ -2224,6 +2268,9 @@ static int nvme_setup_io_queues(struct nvme_dev *dev) · 2 unmodified lines
22242268 if (dev->online_queues - 1 < dev->max_qid) {
22252269 nr_io_queues = dev->online_queues - 1;
22262270 nvme_disable_io_queues(dev);
2271+ result = nvme_setup_io_queues_trylock(dev);
2272+ if (result)
2273+ return result;
22272274 nvme_suspend_io_queues(dev);
22282275 goto retry;
22292276 }
@@ -2232,6 +2279,9 @@ static int nvme_setup_io_queues(struct nvme_dev *dev) · 2 unmodified lines
22322279 dev->io_queues[HCTX_TYPE_READ],
22332280 dev->io_queues[HCTX_TYPE_POLL]);
22342281 return 0;
2282+out_unlock:
2283+ mutex_unlock(&dev->shutdown_lock);
2284+ return result;
22352285 }
22362286
22372287 static void nvme_del_queue_end(struct request *req, blk_status_t error)
@@ -2962,7 +3012,6 @@ static void nvme_remove(struct pci_dev *pdev) · 724 unmodified lines
29623012 if (!pci_device_is_present(pdev)) {
29633013 nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_DEAD);
29643014 nvme_dev_disable(dev, true);
2965− nvme_dev_remove_admin(dev);
29663015 }
29673016
29683017 flush_work(&dev->ctrl.reset_work);
drivers/nvme/host/tcp.c+1−3
@@ -123,7 +123,6 @@ struct nvme_tcp_ctrl { · 122 unmodified lines
123123 struct blk_mq_tag_set admin_tag_set;
124124 struct sockaddr_storage addr;
125125 struct sockaddr_storage src_addr;
126− struct net_device *ndev;
127126 struct nvme_ctrl ctrl;
128127
129128 struct work_struct err_work;
@@ -2533,8 +2532,7 @@ static struct nvme_ctrl *nvme_tcp_create_ctrl(struct device *dev, · 2403 unmodified lines
25332532 }
25342533
25352534 if (opts->mask & NVMF_OPT_HOST_IFACE) {
2536− ctrl->ndev = dev_get_by_name(&init_net, opts->host_iface);
2537− if (!ctrl->ndev) {
2535+ if (!__dev_get_by_name(&init_net, opts->host_iface)) {
25382536 pr_err("invalid interface passed: %s\n",
25392537 opts->host_iface);
25402538 ret = -ENODEV;
drivers/pci/proc.c+1−1
@@ -230,8 +230,8 @@ static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd, · 229 unmodified lines
230230 break;
231231 }
232232 /* If arch decided it can't, fall through... */
233−#endif /* HAVE_PCI_MMAP */
234233 fallthrough;
234+#endif /* HAVE_PCI_MMAP */
235235 default:
236236 ret = -EINVAL;
237237 break;
drivers/power/supply/ab8500_fg.c+2−0
@@ -1728,6 +1728,7 @@ static void ab8500_fg_algorithm_calibrate(struct ab8500_fg *di) · 1727 unmodified lines
17281728 break;
17291729 case AB8500_FG_CALIB_WAIT:
17301730 dev_dbg(di->dev, "Calibration WFI\n");
1731+ break;
17311732 default:
17321733 break;
17331734 }
@@ -2224,6 +2225,7 @@ static int ab8500_fg_get_ext_psy_data(struct device *dev, void *data) · 490 unmodified lines
22242225 queue_work(di->fg_wq, &di->fg_work);
22252226 break;
22262227 }
2228+ break;
22272229 default:
22282230 break;
22292231 }
drivers/power/supply/abx500_chargalg.c+1−0
@@ -1150,6 +1150,7 @@ static int abx500_chargalg_get_ext_psy_data(struct device *dev, void *data) · 1149 unmodified lines
11501150 default:
11511151 break;
11521152 }
1153+ break;
11531154 default:
11541155 break;
11551156 }
drivers/pwm/pwm-berlin.c+3−6
@@ -190,12 +190,9 @@ static int berlin_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, · 189 unmodified lines
190190 return 0;
191191 }
192192
193− if (state->period != pwm->state.period ||
194− state->duty_cycle != pwm->state.duty_cycle) {
195− err = berlin_pwm_config(chip, pwm, state->duty_cycle, state->period);
196− if (err)
197− return err;
198− }
193+ err = berlin_pwm_config(chip, pwm, state->duty_cycle, state->period);
194+ if (err)
195+ return err;
199196
200197 if (!enabled)
201198 return berlin_pwm_enable(chip, pwm);
drivers/pwm/pwm-ep93xx.c+40−45
@@ -64,6 +64,11 @@ static int ep93xx_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, · 63 unmodified lines
6464 int ret;
6565 struct ep93xx_pwm *ep93xx_pwm = to_ep93xx_pwm(chip);
6666 bool enabled = state->enabled;
67+ void __iomem *base = ep93xx_pwm->base;
68+ unsigned long long c;
69+ unsigned long period_cycles;
70+ unsigned long duty_cycles;
71+ unsigned long term;
6772
6873 if (state->polarity != pwm->state.polarity) {
6974 if (enabled) {
@@ -97,57 +102,47 @@ static int ep93xx_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, · 27 unmodified lines
97102 return 0;
98103 }
99104
100− if (state->period != pwm->state.period ||
101− state->duty_cycle != pwm->state.duty_cycle) {
102− struct ep93xx_pwm *ep93xx_pwm = to_ep93xx_pwm(chip);
103− void __iomem *base = ep93xx_pwm->base;
104− unsigned long long c;
105− unsigned long period_cycles;
106− unsigned long duty_cycles;
107− unsigned long term;
105+ /*
106+ * The clock needs to be enabled to access the PWM registers.
107+ * Configuration can be changed at any time.
108+ */
109+ if (!pwm_is_enabled(pwm)) {
110+ ret = clk_prepare_enable(ep93xx_pwm->clk);
111+ if (ret)
112+ return ret;
113+ }
108114
109− /*
110− * The clock needs to be enabled to access the PWM registers.
111− * Configuration can be changed at any time.
112− */
113− if (!pwm_is_enabled(pwm)) {
114− ret = clk_prepare_enable(ep93xx_pwm->clk);
115− if (ret)
116− return ret;
117− }
115+ c = clk_get_rate(ep93xx_pwm->clk);
116+ c *= state->period;
117+ do_div(c, 1000000000);
118+ period_cycles = c;
119+
120+ c = period_cycles;
121+ c *= state->duty_cycle;
122+ do_div(c, state->period);
123+ duty_cycles = c;
118124
119− c = clk_get_rate(ep93xx_pwm->clk);
120− c *= state->period;
121− do_div(c, 1000000000);
122− period_cycles = c;
123−
124− c = period_cycles;
125− c *= state->duty_cycle;
126− do_div(c, state->period);
127− duty_cycles = c;
128−
129− if (period_cycles < 0x10000 && duty_cycles < 0x10000) {
130− term = readw(base + EP93XX_PWMx_TERM_COUNT);
131−
132− /* Order is important if PWM is running */
133− if (period_cycles > term) {
134− writew(period_cycles, base + EP93XX_PWMx_TERM_COUNT);
135− writew(duty_cycles, base + EP93XX_PWMx_DUTY_CYCLE);
136− } else {
137− writew(duty_cycles, base + EP93XX_PWMx_DUTY_CYCLE);
138− writew(period_cycles, base + EP93XX_PWMx_TERM_COUNT);
139− }
140− ret = 0;
125+ if (period_cycles < 0x10000 && duty_cycles < 0x10000) {
126+ term = readw(base + EP93XX_PWMx_TERM_COUNT);
127+
128+ /* Order is important if PWM is running */
129+ if (period_cycles > term) {
130+ writew(period_cycles, base + EP93XX_PWMx_TERM_COUNT);
131+ writew(duty_cycles, base + EP93XX_PWMx_DUTY_CYCLE);
141132 } else {
142− ret = -EINVAL;
133+ writew(duty_cycles, base + EP93XX_PWMx_DUTY_CYCLE);
134+ writew(period_cycles, base + EP93XX_PWMx_TERM_COUNT);
143135 }
136+ ret = 0;
137+ } else {
138+ ret = -EINVAL;
139+ }
144140
145− if (!pwm_is_enabled(pwm))
146− clk_disable_unprepare(ep93xx_pwm->clk);
141+ if (!pwm_is_enabled(pwm))
142+ clk_disable_unprepare(ep93xx_pwm->clk);
147143
148− if (ret)
149− return ret;
150− }
144+ if (ret)
145+ return ret;
151146
152147 if (!enabled) {
153148 ret = clk_prepare_enable(ep93xx_pwm->clk);
drivers/pwm/pwm-spear.c+3−6
@@ -177,12 +177,9 @@ static int spear_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, · 176 unmodified lines
177177 return 0;
178178 }
179179
180− if (state->period != pwm->state.period ||
181− state->duty_cycle != pwm->state.duty_cycle) {
182− err = spear_pwm_config(chip, pwm, state->duty_cycle, state->period);
183− if (err)
184− return err;
185− }
180+ err = spear_pwm_config(chip, pwm, state->duty_cycle, state->period);
181+ if (err)
182+ return err;
186183
187184 if (!pwm->state.enabled)
188185 return spear_pwm_enable(chip, pwm);
drivers/pwm/pwm-sprd.c+4−7
@@ -183,13 +183,10 @@ static int sprd_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, · 182 unmodified lines
183183 }
184184 }
185185
186− if (state->period != cstate->period ||
187− state->duty_cycle != cstate->duty_cycle) {
188− ret = sprd_pwm_config(spc, pwm, state->duty_cycle,
189− state->period);
190− if (ret)
191− return ret;
192− }
186+ ret = sprd_pwm_config(spc, pwm, state->duty_cycle,
187+ state->period);
188+ if (ret)
189+ return ret;
193190
194191 sprd_pwm_write(spc, pwm->hwpwm, SPRD_PWM_ENABLE, 1);
195192 } else if (cstate->enabled) {
drivers/pwm/pwm-tiecap.c+6−9
@@ -189,16 +189,13 @@ static int ecap_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, · 188 unmodified lines
189189 return 0;
190190 }
191191
192− if (state->period != pwm->state.period ||
193− state->duty_cycle != pwm->state.duty_cycle) {
194− if (state->period > NSEC_PER_SEC)
195− return -ERANGE;
192+ if (state->period > NSEC_PER_SEC)
193+ return -ERANGE;
196194
197− err = ecap_pwm_config(chip, pwm, state->duty_cycle,
198− state->period, enabled);
199− if (err)
200− return err;
201− }
195+ err = ecap_pwm_config(chip, pwm, state->duty_cycle,
196+ state->period, enabled);
197+ if (err)
198+ return err;
202199
203200 if (!enabled)
204201 return ecap_pwm_enable(chip, pwm);
drivers/regulator/bd9576-regulator.c+2−2
@@ -294,9 +294,9 @@ static bool check_temp_flag_mismatch(struct regulator_dev *rdev, int severity, · 293 unmodified lines
294294 struct bd957x_regulator_data *r)
295295 {
296296 if ((severity == REGULATOR_SEVERITY_ERR &&
297− r->ovd_notif != REGULATOR_EVENT_OVER_TEMP) ||
297+ r->temp_notif != REGULATOR_EVENT_OVER_TEMP) ||
298298 (severity == REGULATOR_SEVERITY_WARN &&
299− r->ovd_notif != REGULATOR_EVENT_OVER_TEMP_WARN)) {
299+ r->temp_notif != REGULATOR_EVENT_OVER_TEMP_WARN)) {
300300 dev_warn(rdev_get_dev(rdev),
301301 "Can't support both thermal WARN and ERR\n");
302302 if (severity == REGULATOR_SEVERITY_WARN)
drivers/regulator/hi6421-regulator.c+13−9
@@ -366,9 +366,8 @@ static struct hi6421_regulator_info · 365 unmodified lines
366366
367367 static int hi6421_regulator_enable(struct regulator_dev *rdev)
368368 {
369− struct hi6421_regulator_pdata *pdata;
369+ struct hi6421_regulator_pdata *pdata = rdev_get_drvdata(rdev);
370370
371− pdata = dev_get_drvdata(rdev->dev.parent);
372371 /* hi6421 spec requires regulator enablement must be serialized:
373372 * - Because when BUCK, LDO switching from off to on, it will have
374373 * a huge instantaneous current; so you can not turn on two or
@@ -385,9 +384,10 @@ static int hi6421_regulator_enable(struct regulator_dev *rdev) · 10 unmodified lines
385384
386385 static unsigned int hi6421_regulator_ldo_get_mode(struct regulator_dev *rdev)
387386 {
388− struct hi6421_regulator_info *info = rdev_get_drvdata(rdev);
387+ struct hi6421_regulator_info *info;
389388 unsigned int reg_val;
390389
390+ info = container_of(rdev->desc, struct hi6421_regulator_info, desc);
391391 regmap_read(rdev->regmap, rdev->desc->enable_reg, &reg_val);
392392 if (reg_val & info->mode_mask)
393393 return REGULATOR_MODE_IDLE;
@@ -397,9 +397,10 @@ static unsigned int hi6421_regulator_ldo_get_mode(struct regulator_dev *rdev) · 3 unmodified lines
397397
398398 static unsigned int hi6421_regulator_buck_get_mode(struct regulator_dev *rdev)
399399 {
400− struct hi6421_regulator_info *info = rdev_get_drvdata(rdev);
400+ struct hi6421_regulator_info *info;
401401 unsigned int reg_val;
402402
403+ info = container_of(rdev->desc, struct hi6421_regulator_info, desc);
403404 regmap_read(rdev->regmap, rdev->desc->enable_reg, &reg_val);
404405 if (reg_val & info->mode_mask)
405406 return REGULATOR_MODE_STANDBY;
@@ -410,9 +411,10 @@ static unsigned int hi6421_regulator_buck_get_mode(struct regulator_dev *rdev) · 4 unmodified lines
410411 static int hi6421_regulator_ldo_set_mode(struct regulator_dev *rdev,
411412 unsigned int mode)
412413 {
413− struct hi6421_regulator_info *info = rdev_get_drvdata(rdev);
414+ struct hi6421_regulator_info *info;
414415 unsigned int new_mode;
415416
417+ info = container_of(rdev->desc, struct hi6421_regulator_info, desc);
416418 switch (mode) {
417419 case REGULATOR_MODE_NORMAL:
418420 new_mode = 0;
@@ -434,9 +436,10 @@ static int hi6421_regulator_ldo_set_mode(struct regulator_dev *rdev, · 15 unmodified lines
434436 static int hi6421_regulator_buck_set_mode(struct regulator_dev *rdev,
435437 unsigned int mode)
436438 {
437− struct hi6421_regulator_info *info = rdev_get_drvdata(rdev);
439+ struct hi6421_regulator_info *info;
438440 unsigned int new_mode;
439441
442+ info = container_of(rdev->desc, struct hi6421_regulator_info, desc);
440443 switch (mode) {
441444 case REGULATOR_MODE_NORMAL:
442445 new_mode = 0;
@@ -459,7 +462,9 @@ static unsigned int · 16 unmodified lines
459462 hi6421_regulator_ldo_get_optimum_mode(struct regulator_dev *rdev,
460463 int input_uV, int output_uV, int load_uA)
461464 {
462− struct hi6421_regulator_info *info = rdev_get_drvdata(rdev);
465+ struct hi6421_regulator_info *info;
466+
467+ info = container_of(rdev->desc, struct hi6421_regulator_info, desc);
463468
464469 if (load_uA > info->eco_microamp)
465470 return REGULATOR_MODE_NORMAL;
@@ -543,14 +548,13 @@ static int hi6421_regulator_probe(struct platform_device *pdev) · 77 unmodified lines
543548 if (!pdata)
544549 return -ENOMEM;
545550 mutex_init(&pdata->lock);
546− platform_set_drvdata(pdev, pdata);
547551
548552 for (i = 0; i < ARRAY_SIZE(hi6421_regulator_info); i++) {
549553 /* assign per-regulator data */
550554 info = &hi6421_regulator_info[i];
551555
552556 config.dev = pdev->dev.parent;
553− config.driver_data = info;
557+ config.driver_data = pdata;
554558 config.regmap = pmic->regmap;
555559
556560 rdev = devm_regulator_register(&pdev->dev, &info->desc,
drivers/regulator/hi6421v600-regulator.c+9−7
@@ -98,10 +98,9 @@ static const unsigned int ldo34_voltages[] = { · 97 unmodified lines
9898
9999 static int hi6421_spmi_regulator_enable(struct regulator_dev *rdev)
100100 {
101− struct hi6421_spmi_reg_priv *priv;
101+ struct hi6421_spmi_reg_priv *priv = rdev_get_drvdata(rdev);
102102 int ret;
103103
104− priv = dev_get_drvdata(rdev->dev.parent);
105104 /* cannot enable more than one regulator at one time */
106105 mutex_lock(&priv->enable_mutex);
107106
@@ -119,9 +118,10 @@ static int hi6421_spmi_regulator_enable(struct regulator_dev *rdev) · 11 unmodified lines
119118
120119 static unsigned int hi6421_spmi_regulator_get_mode(struct regulator_dev *rdev)
121120 {
122− struct hi6421_spmi_reg_info *sreg = rdev_get_drvdata(rdev);
121+ struct hi6421_spmi_reg_info *sreg;
123122 unsigned int reg_val;
124123
124+ sreg = container_of(rdev->desc, struct hi6421_spmi_reg_info, desc);
125125 regmap_read(rdev->regmap, rdev->desc->enable_reg, &reg_val);
126126
127127 if (reg_val & sreg->eco_mode_mask)
@@ -133,9 +133,10 @@ static unsigned int hi6421_spmi_regulator_get_mode(struct regulator_dev *rdev) · 5 unmodified lines
133133 static int hi6421_spmi_regulator_set_mode(struct regulator_dev *rdev,
134134 unsigned int mode)
135135 {
136− struct hi6421_spmi_reg_info *sreg = rdev_get_drvdata(rdev);
136+ struct hi6421_spmi_reg_info *sreg;
137137 unsigned int val;
138138
139+ sreg = container_of(rdev->desc, struct hi6421_spmi_reg_info, desc);
139140 switch (mode) {
140141 case REGULATOR_MODE_NORMAL:
141142 val = 0;
@@ -159,7 +160,9 @@ hi6421_spmi_regulator_get_optimum_mode(struct regulator_dev *rdev, · 17 unmodified lines
159160 int input_uV, int output_uV,
160161 int load_uA)
161162 {
162− struct hi6421_spmi_reg_info *sreg = rdev_get_drvdata(rdev);
163+ struct hi6421_spmi_reg_info *sreg;
164+
165+ sreg = container_of(rdev->desc, struct hi6421_spmi_reg_info, desc);
163166
164167 if (!sreg->eco_uA || ((unsigned int)load_uA > sreg->eco_uA))
165168 return REGULATOR_MODE_NORMAL;
@@ -252,13 +255,12 @@ static int hi6421_spmi_regulator_probe(struct platform_device *pdev) · 86 unmodified lines
252255 return -ENOMEM;
253256
254257 mutex_init(&priv->enable_mutex);
255− platform_set_drvdata(pdev, priv);
256258
257259 for (i = 0; i < ARRAY_SIZE(regulator_info); i++) {
258260 info = &regulator_info[i];
259261
260262 config.dev = pdev->dev.parent;
261− config.driver_data = info;
263+ config.driver_data = priv;
262264 config.regmap = pmic->regmap;
263265
264266 rdev = devm_regulator_register(dev, &info->desc, &config);
drivers/regulator/mtk-dvfsrc-regulator.c+1−2
@@ -179,8 +179,7 @@ static int dvfsrc_vcore_regulator_probe(struct platform_device *pdev) · 178 unmodified lines
179179 for (i = 0; i < regulator_init_data->size; i++) {
180180 config.dev = dev->parent;
181181 config.driver_data = (mt_regulators + i);
182− rdev = devm_regulator_register(dev->parent,
183− &(mt_regulators + i)->desc,
182+ rdev = devm_regulator_register(dev, &(mt_regulators + i)->desc,
184183 &config);
185184 if (IS_ERR(rdev)) {
186185 dev_err(dev, "failed to register %s\n",
drivers/regulator/rtmv20-regulator.c+1−1
@@ -37,7 +37,7 @@ · 36 unmodified lines
3737 #define RTMV20_WIDTH2_MASK GENMASK(7, 0)
3838 #define RTMV20_LBPLVL_MASK GENMASK(3, 0)
3939 #define RTMV20_LBPEN_MASK BIT(7)
40−#define RTMV20_STROBEPOL_MASK BIT(1)
40+#define RTMV20_STROBEPOL_MASK BIT(0)
4141 #define RTMV20_VSYNPOL_MASK BIT(1)
4242 #define RTMV20_FSINEN_MASK BIT(7)
4343 #define RTMV20_ESEN_MASK BIT(6)
drivers/s390/char/tape_char.c+0−2
@@ -371,8 +371,6 @@ __tapechar_ioctl(struct tape_device *device, · 370 unmodified lines
371371 case MTSEEK:
372372 if (device->required_tapemarks)
373373 tape_std_terminate_write(device);
374− default:
375− ;
376374 }
377375 rc = tape_mtop(device, op.mt_op, op.mt_count);
378376
drivers/s390/net/ctcm_fsms.c+1−0
@@ -1454,6 +1454,7 @@ again: · 1453 unmodified lines
14541454 get_ccwdev_lock(ch->cdev), saveflags);
14551455 if (rc != 0)
14561456 ctcm_ccw_check_rc(ch, rc, "normal RX");
1457+ break;
14571458 default:
14581459 break;
14591460 }
drivers/s390/net/qeth_l3_main.c+1−0
@@ -434,6 +434,7 @@ static int qeth_l3_correct_routing_type(struct qeth_card *card, · 433 unmodified lines
434434 if (qeth_is_ipafunc_supported(card, prot,
435435 IPA_OSA_MC_ROUTER))
436436 return 0;
437+ goto out_inval;
437438 default:
438439 goto out_inval;
439440 }
drivers/s390/scsi/zfcp_sysfs.c+1−0
@@ -487,6 +487,7 @@ static ssize_t zfcp_sysfs_port_fc_security_show(struct device *dev, · 486 unmodified lines
487487 if (0 == (status & ZFCP_STATUS_COMMON_OPEN) ||
488488 0 == (status & ZFCP_STATUS_COMMON_UNBLOCKED) ||
489489 0 == (status & ZFCP_STATUS_PORT_PHYS_OPEN) ||
490+ 0 != (status & ZFCP_STATUS_PORT_LINK_TEST) ||
490491 0 != (status & ZFCP_STATUS_COMMON_ERP_FAILED) ||
491492 0 != (status & ZFCP_STATUS_COMMON_ACCESS_BOXED))
492493 i = sprintf(buf, "unknown\n");
drivers/scsi/arm/fas216.c+1−1
@@ -2010,7 +2010,7 @@ static void fas216_rq_sns_done(FAS216_Info *info, struct scsi_cmnd *SCpnt, · 2009 unmodified lines
20102010 "request sense complete, result=0x%04x%02x%02x",
20112011 result, SCpnt->SCp.Message, SCpnt->SCp.Status);
20122012
2013− if (result != DID_OK || SCpnt->SCp.Status != GOOD)
2013+ if (result != DID_OK || SCpnt->SCp.Status != SAM_STAT_GOOD)
20142014 /*
20152015 * Something went wrong. Make sure that we don't
20162016 * have valid data in the sense buffer that could
drivers/scsi/hosts.c+1−0
@@ -488,6 +488,7 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) · 487 unmodified lines
488488 shost_printk(KERN_WARNING, shost,
489489 "error handler thread failed to spawn, error = %ld\n",
490490 PTR_ERR(shost->ehandler));
491+ shost->ehandler = NULL;
491492 goto fail;
492493 }
493494
drivers/scsi/libsas/sas_discover.c+1−1
@@ -461,7 +461,7 @@ static void sas_discover_domain(struct work_struct *work) · 460 unmodified lines
461461 break;
462462 #else
463463 pr_notice("ATA device seen but CONFIG_SCSI_SAS_ATA=N so cannot attach\n");
464− /* Fall through */
464+ fallthrough;
465465 #endif
466466 /* Fall through - only for the #else condition above. */
467467 default:
drivers/scsi/mpi3mr/mpi3mr_fw.c+7−8
@@ -2607,14 +2607,13 @@ static int mpi3mr_issue_iocinit(struct mpi3mr_ioc *mrioc) · 2606 unmodified lines
26072607 goto out;
26082608 }
26092609 drv_info->information_length = cpu_to_le32(data_len);
2610− strncpy(drv_info->driver_signature, "Broadcom", sizeof(drv_info->driver_signature));
2611− strncpy(drv_info->os_name, utsname()->sysname, sizeof(drv_info->os_name));
2612− drv_info->os_name[sizeof(drv_info->os_name) - 1] = 0;
2613− strncpy(drv_info->os_version, utsname()->release, sizeof(drv_info->os_version));
2614− drv_info->os_version[sizeof(drv_info->os_version) - 1] = 0;
2615− strncpy(drv_info->driver_name, MPI3MR_DRIVER_NAME, sizeof(drv_info->driver_name));
2616− strncpy(drv_info->driver_version, MPI3MR_DRIVER_VERSION, sizeof(drv_info->driver_version));
2617− strncpy(drv_info->driver_release_date, MPI3MR_DRIVER_RELDATE, sizeof(drv_info->driver_release_date));
2610+ strscpy(drv_info->driver_signature, "Broadcom", sizeof(drv_info->driver_signature));
2611+ strscpy(drv_info->os_name, utsname()->sysname, sizeof(drv_info->os_name));
2612+ strscpy(drv_info->os_version, utsname()->release, sizeof(drv_info->os_version));
2613+ strscpy(drv_info->driver_name, MPI3MR_DRIVER_NAME, sizeof(drv_info->driver_name));
2614+ strscpy(drv_info->driver_version, MPI3MR_DRIVER_VERSION, sizeof(drv_info->driver_version));
2615+ strscpy(drv_info->driver_release_date, MPI3MR_DRIVER_RELDATE,
2616+ sizeof(drv_info->driver_release_date));
26182617 drv_info->driver_capabilities = 0;
26192618 memcpy((u8 *)&mrioc->driver_info, (u8 *)drv_info,
26202619 sizeof(mrioc->driver_info));
drivers/scsi/pm8001/pm8001_ctl.c+26−22
@@ -77,7 +77,7 @@ DEVICE_ATTR(interface_rev, S_IRUGO, pm8001_ctl_mpi_interface_rev_show, NULL); · 76 unmodified lines
7777 * @attr: device attribute (unused)
7878 * @buf: the buffer returned
7979 *
80− * A sysfs 'read only' shost attribute.
80+ * A sysfs 'read-only' shost attribute.
8181 */
8282 static ssize_t controller_fatal_error_show(struct device *cdev,
8383 struct device_attribute *attr, char *buf)
@@ -149,7 +149,7 @@ static ssize_t pm8001_ctl_ila_version_show(struct device *cdev, · 65 unmodified lines
149149 static DEVICE_ATTR(ila_version, 0444, pm8001_ctl_ila_version_show, NULL);
150150
151151 /**
152− * pm8001_ctl_inactive_fw_version_show - Inacative firmware version number
152+ * pm8001_ctl_inactive_fw_version_show - Inactive firmware version number
153153 * @cdev: pointer to embedded class device
154154 * @attr: device attribute (unused)
155155 * @buf: the buffer returned
@@ -396,6 +396,7 @@ static DEVICE_ATTR(aap_log, S_IRUGO, pm8001_ctl_aap_log_show, NULL); · 240 unmodified lines
396396 * @cdev:pointer to embedded class device
397397 * @attr: device attribute (unused)
398398 * @buf: the buffer returned
399+ *
399400 * A sysfs 'read-only' shost attribute.
400401 */
401402 static ssize_t pm8001_ctl_ib_queue_log_show(struct device *cdev,
@@ -430,6 +431,7 @@ static DEVICE_ATTR(ib_log, S_IRUGO, pm8001_ctl_ib_queue_log_show, NULL); · 28 unmodified lines
430431 * @cdev:pointer to embedded class device
431432 * @attr: device attribute (unused)
432433 * @buf: the buffer returned
434+ *
433435 * A sysfs 'read-only' shost attribute.
434436 */
435437
@@ -464,6 +466,7 @@ static DEVICE_ATTR(ob_log, S_IRUGO, pm8001_ctl_ob_queue_log_show, NULL); · 28 unmodified lines
464466 * @cdev:pointer to embedded class device
465467 * @attr: device attribute (unused)
466468 * @buf:the buffer returned
469+ *
467470 * A sysfs 'read-only' shost attribute.
468471 */
469472 static ssize_t pm8001_ctl_bios_version_show(struct device *cdev,
@@ -555,13 +558,13 @@ static ssize_t pm8001_ctl_iop_log_show(struct device *cdev, · 85 unmodified lines
555558 static DEVICE_ATTR(iop_log, S_IRUGO, pm8001_ctl_iop_log_show, NULL);
556559
557560 /**
558− ** pm8001_ctl_fatal_log_show - fatal error logging
559− ** @cdev:pointer to embedded class device
560− ** @attr: device attribute
561− ** @buf: the buffer returned
562− **
563− ** A sysfs 'read-only' shost attribute.
564− **/
561+ * pm8001_ctl_fatal_log_show - fatal error logging
562+ * @cdev:pointer to embedded class device
563+ * @attr: device attribute
564+ * @buf: the buffer returned
565+ *
566+ * A sysfs 'read-only' shost attribute.
567+ */
565568
566569 static ssize_t pm8001_ctl_fatal_log_show(struct device *cdev,
567570 struct device_attribute *attr, char *buf)
@@ -575,13 +578,13 @@ static ssize_t pm8001_ctl_fatal_log_show(struct device *cdev, · 7 unmodified lines
575578 static DEVICE_ATTR(fatal_log, S_IRUGO, pm8001_ctl_fatal_log_show, NULL);
576579
577580 /**
578− ** non_fatal_log_show - non fatal error logging
579− ** @cdev:pointer to embedded class device
580− ** @attr: device attribute
581− ** @buf: the buffer returned
582− **
583− ** A sysfs 'read-only' shost attribute.
584− **/
581+ * non_fatal_log_show - non fatal error logging
582+ * @cdev:pointer to embedded class device
583+ * @attr: device attribute
584+ * @buf: the buffer returned
585+ *
586+ * A sysfs 'read-only' shost attribute.
587+ */
585588 static ssize_t non_fatal_log_show(struct device *cdev,
586589 struct device_attribute *attr, char *buf)
587590 {
@@ -620,12 +623,13 @@ static ssize_t non_fatal_count_store(struct device *cdev, · 32 unmodified lines
620623 static DEVICE_ATTR_RW(non_fatal_count);
621624
622625 /**
623− ** pm8001_ctl_gsm_log_show - gsm dump collection
624− ** @cdev:pointer to embedded class device
625− ** @attr: device attribute (unused)
626− ** @buf: the buffer returned
627− ** A sysfs 'read-only' shost attribute.
628− **/
626+ * pm8001_ctl_gsm_log_show - gsm dump collection
627+ * @cdev:pointer to embedded class device
628+ * @attr: device attribute (unused)
629+ * @buf: the buffer returned
630+ *
631+ * A sysfs 'read-only' shost attribute.
632+ */
629633 static ssize_t pm8001_ctl_gsm_log_show(struct device *cdev,
630634 struct device_attribute *attr, char *buf)
631635 {
drivers/scsi/pm8001/pm8001_hwi.c+9−9
@@ -384,7 +384,7 @@ static void update_outbnd_queue_table(struct pm8001_hba_info *pm8001_ha, · 383 unmodified lines
384384
385385 /**
386386 * pm8001_bar4_shift - function is called to shift BAR base address
387− * @pm8001_ha : our hba card infomation
387+ * @pm8001_ha : our hba card information
388388 * @shiftValue : shifting value in memory bar.
389389 */
390390 int pm8001_bar4_shift(struct pm8001_hba_info *pm8001_ha, u32 shiftValue)
@@ -1151,7 +1151,7 @@ static void pm8001_hw_chip_rst(struct pm8001_hba_info *pm8001_ha) · 760 unmodified lines
11511151 }
11521152
11531153 /**
1154− * pm8001_chip_iounmap - which maped when initialized.
1154+ * pm8001_chip_iounmap - which mapped when initialized.
11551155 * @pm8001_ha: our hba card information
11561156 */
11571157 void pm8001_chip_iounmap(struct pm8001_hba_info *pm8001_ha)
@@ -1187,10 +1187,10 @@ pm8001_chip_intx_interrupt_enable(struct pm8001_hba_info *pm8001_ha) · 29 unmodified lines
11871187 pm8001_cw32(pm8001_ha, 0, MSGU_ODCR, ODCR_CLEAR_ALL);
11881188 }
11891189
1190− /**
1191− * pm8001_chip_intx_interrupt_disable- disable PM8001 chip interrupt
1192− * @pm8001_ha: our hba card information
1193− */
1190+/**
1191+ * pm8001_chip_intx_interrupt_disable - disable PM8001 chip interrupt
1192+ * @pm8001_ha: our hba card information
1193+ */
11941194 static void
11951195 pm8001_chip_intx_interrupt_disable(struct pm8001_hba_info *pm8001_ha)
11961196 {
@@ -1876,8 +1876,8 @@ static void pm8001_send_read_log(struct pm8001_hba_info *pm8001_ha, · 679 unmodified lines
18761876 * @piomb: the message contents of this outbound message.
18771877 *
18781878 * When FW has completed a ssp request for example a IO request, after it has
1879− * filled the SG data with the data, it will trigger this event represent
1880− * that he has finished the job,please check the coresponding buffer.
1879+ * filled the SG data with the data, it will trigger this event representing
1880+ * that he has finished the job; please check the corresponding buffer.
18811881 * So we will tell the caller who maybe waiting the result to tell upper layer
18821882 * that the task has been finished.
18831883 */
@@ -3522,7 +3522,7 @@ hw_event_phy_down(struct pm8001_hba_info *pm8001_ha, void *piomb) · 1638 unmodified lines
35223522 *
35233523 * when sas layer find a device it will notify LLDD, then the driver register
35243524 * the domain device to FW, this event is the return device ID which the FW
3525− * has assigned, from now,inter-communication with FW is no longer using the
3525+ * has assigned, from now, inter-communication with FW is no longer using the
35263526 * SAS address, use device ID which FW assigned.
35273527 */
35283528 int pm8001_mpi_reg_resp(struct pm8001_hba_info *pm8001_ha, void *piomb)
drivers/scsi/pm8001/pm8001_init.c+15−14
@@ -233,7 +233,7 @@ static irqreturn_t pm8001_interrupt_handler_msix(int irq, void *opaque) · 232 unmodified lines
233233 /**
234234 * pm8001_interrupt_handler_intx - main INTx interrupt handler.
235235 * @irq: interrupt number
236− * @dev_id: sas_ha structure. The HBA is retrieved from sas_has structure.
236+ * @dev_id: sas_ha structure. The HBA is retrieved from sas_ha structure.
237237 */
238238
239239 static irqreturn_t pm8001_interrupt_handler_intx(int irq, void *dev_id)
@@ -439,9 +439,9 @@ err_out: · 199 unmodified lines
439439 }
440440
441441 /**
442− * pm8001_ioremap - remap the pci high physical address to kernal virtual
442+ * pm8001_ioremap - remap the pci high physical address to kernel virtual
443443 * address so that we can access them.
444− * @pm8001_ha:our hba structure.
444+ * @pm8001_ha: our hba structure.
445445 */
446446 static int pm8001_ioremap(struct pm8001_hba_info *pm8001_ha)
447447 {
@@ -652,7 +652,7 @@ static void pm8001_post_sas_ha_init(struct Scsi_Host *shost, · 204 unmodified lines
652652 * pm8001_init_sas_add - initialize sas address
653653 * @pm8001_ha: our ha struct.
654654 *
655− * Currently we just set the fixed SAS address to our HBA,for manufacture,
655+ * Currently we just set the fixed SAS address to our HBA, for manufacture,
656656 * it should read from the EEPROM
657657 */
658658 static void pm8001_init_sas_add(struct pm8001_hba_info *pm8001_ha)
@@ -790,7 +790,7 @@ struct pm8001_mpi3_phy_pg_trx_config { · 131 unmodified lines
790790 };
791791
792792 /**
793− * pm8001_get_internal_phy_settings : Retrieves the internal PHY settings
793+ * pm8001_get_internal_phy_settings - Retrieves the internal PHY settings
794794 * @pm8001_ha : our adapter
795795 * @phycfg : PHY config page to populate
796796 */
@@ -810,7 +810,7 @@ void pm8001_get_internal_phy_settings(struct pm8001_hba_info *pm8001_ha, · 13 unmodified lines
810810 }
811811
812812 /**
813− * pm8001_get_external_phy_settings : Retrieves the external PHY settings
813+ * pm8001_get_external_phy_settings - Retrieves the external PHY settings
814814 * @pm8001_ha : our adapter
815815 * @phycfg : PHY config page to populate
816816 */
@@ -830,7 +830,7 @@ void pm8001_get_external_phy_settings(struct pm8001_hba_info *pm8001_ha, · 13 unmodified lines
830830 }
831831
832832 /**
833− * pm8001_get_phy_mask : Retrieves the mask that denotes if a PHY is int/ext
833+ * pm8001_get_phy_mask - Retrieves the mask that denotes if a PHY is int/ext
834834 * @pm8001_ha : our adapter
835835 * @phymask : The PHY mask
836836 */
@@ -868,7 +868,7 @@ void pm8001_get_phy_mask(struct pm8001_hba_info *pm8001_ha, int *phymask) · 31 unmodified lines
868868 }
869869
870870 /**
871− * pm8001_set_phy_settings_ven_117c_12G() : Configure ATTO 12Gb PHY settings
871+ * pm8001_set_phy_settings_ven_117c_12G() - Configure ATTO 12Gb PHY settings
872872 * @pm8001_ha : our adapter
873873 */
874874 static
@@ -903,7 +903,7 @@ int pm8001_set_phy_settings_ven_117c_12G(struct pm8001_hba_info *pm8001_ha) · 28 unmodified lines
903903 }
904904
905905 /**
906− * pm8001_configure_phy_settings : Configures PHY settings based on vendor ID.
906+ * pm8001_configure_phy_settings - Configures PHY settings based on vendor ID.
907907 * @pm8001_ha : our hba.
908908 */
909909 static int pm8001_configure_phy_settings(struct pm8001_hba_info *pm8001_ha)
@@ -1053,8 +1053,8 @@ intx: · 143 unmodified lines
10531053 * @ent: pci device id
10541054 *
10551055 * This function is the main initialization function, when register a new
1056− * pci driver it is invoked, all struct an hardware initilization should be done
1057− * here, also, register interrupt
1056+ * pci driver it is invoked, all struct and hardware initialization should be
1057+ * done here, also, register interrupt.
10581058 */
10591059 static int pm8001_pci_probe(struct pci_dev *pdev,
10601060 const struct pci_device_id *ent)
@@ -1172,10 +1172,11 @@ err_out_enable: · 111 unmodified lines
11721172 return rc;
11731173 }
11741174
1175−/*
1175+/**
11761176 * pm8001_init_ccb_tag - allocate memory to CCB and tag.
11771177 * @pm8001_ha: our hba card information.
11781178 * @shost: scsi host which has been allocated outside.
1179+ * @pdev: pci device.
11791180 */
11801181 static int
11811182 pm8001_init_ccb_tag(struct pm8001_hba_info *pm8001_ha, struct Scsi_Host *shost,
@@ -1270,7 +1271,7 @@ static void pm8001_pci_remove(struct pci_dev *pdev) · 88 unmodified lines
12701271 * pm8001_pci_suspend - power management suspend main entry point
12711272 * @dev: Device struct
12721273 *
1273− * Returns 0 success, anything else error.
1274+ * Return: 0 on success, anything else on error.
12741275 */
12751276 static int __maybe_unused pm8001_pci_suspend(struct device *dev)
12761277 {
@@ -1315,7 +1316,7 @@ static int __maybe_unused pm8001_pci_suspend(struct device *dev) · 38 unmodified lines
13151316 * pm8001_pci_resume - power management resume main entry point
13161317 * @dev: Device struct
13171318 *
1318− * Returns 0 success, anything else error.
1319+ * Return: 0 on success, anything else on error.
13191320 */
13201321 static int __maybe_unused pm8001_pci_resume(struct device *dev)
13211322 {
drivers/scsi/pm8001/pm8001_sas.c+22−19
@@ -98,14 +98,16 @@ void pm8001_tag_init(struct pm8001_hba_info *pm8001_ha) · 97 unmodified lines
9898 pm8001_tag_free(pm8001_ha, i);
9999 }
100100
101− /**
102− * pm8001_mem_alloc - allocate memory for pm8001.
103− * @pdev: pci device.
104− * @virt_addr: the allocated virtual address
105− * @pphys_addr_hi: the physical address high byte address.
106− * @pphys_addr_lo: the physical address low byte address.
107− * @mem_size: memory size.
108− */
101+/**
102+ * pm8001_mem_alloc - allocate memory for pm8001.
103+ * @pdev: pci device.
104+ * @virt_addr: the allocated virtual address
105+ * @pphys_addr: DMA address for this device
106+ * @pphys_addr_hi: the physical address high byte address.
107+ * @pphys_addr_lo: the physical address low byte address.
108+ * @mem_size: memory size.
109+ * @align: requested byte alignment
110+ */
109111 int pm8001_mem_alloc(struct pci_dev *pdev, void **virt_addr,
110112 dma_addr_t *pphys_addr, u32 *pphys_addr_hi,
111113 u32 *pphys_addr_lo, u32 mem_size, u32 align)
@@ -339,7 +341,7 @@ static int pm8001_task_prep_ssp_tm(struct pm8001_hba_info *pm8001_ha, · 227 unmodified lines
339341 }
340342
341343 /**
342− * pm8001_task_prep_ssp - the dispatcher function,prepare ssp data for ssp task
344+ * pm8001_task_prep_ssp - the dispatcher function, prepare ssp data for ssp task
343345 * @pm8001_ha: our hba card information
344346 * @ccb: the ccb which attached to ssp task
345347 */
@@ -554,10 +556,10 @@ void pm8001_ccb_task_free(struct pm8001_hba_info *pm8001_ha, · 208 unmodified lines
554556 pm8001_tag_free(pm8001_ha, ccb_idx);
555557 }
556558
557− /**
558− * pm8001_alloc_dev - find a empty pm8001_device
559− * @pm8001_ha: our hba card information
560− */
559+/**
560+ * pm8001_alloc_dev - find a empty pm8001_device
561+ * @pm8001_ha: our hba card information
562+ */
561563 static struct pm8001_device *pm8001_alloc_dev(struct pm8001_hba_info *pm8001_ha)
562564 {
563565 u32 dev;
@@ -705,7 +707,7 @@ static void pm8001_tmf_timedout(struct timer_list *t) · 141 unmodified lines
705707 * @parameter: ssp task parameter.
706708 *
707709 * when errors or exception happened, we may want to do something, for example
708− * abort the issued task which result in this execption, it is done by calling
710+ * abort the issued task which result in this exception, it is done by calling
709711 * this function, note it is also with the task execute interface.
710712 */
711713 static int pm8001_exec_internal_tmf_task(struct domain_device *dev,
@@ -984,11 +986,12 @@ void pm8001_open_reject_retry( · 272 unmodified lines
984986 }
985987
986988 /**
987− * pm8001_I_T_nexus_reset()
988− * Standard mandates link reset for ATA (type 0) and hard reset for
989− * SSP (type 1) , only for RECOVERY
990− * @dev: the device structure for the device to reset.
991− */
989+ * pm8001_I_T_nexus_reset() - reset the initiator/target connection
990+ * @dev: the device structure for the device to reset.
991+ *
992+ * Standard mandates link reset for ATA (type 0) and hard reset for
993+ * SSP (type 1), only for RECOVERY
994+ */
992995 int pm8001_I_T_nexus_reset(struct domain_device *dev)
993996 {
994997 int rc = TMF_RESP_FUNC_FAILED;
drivers/scsi/pm8001/pm80xx_hwi.c+25−25
@@ -140,7 +140,7 @@ ssize_t pm80xx_get_fatal_dump(struct device *cdev, · 139 unmodified lines
140140 pm8001_ha->fatal_bar_loc = 0;
141141 }
142142
143− /* Read until accum_len is retrived */
143+ /* Read until accum_len is retrieved */
144144 accum_len = pm8001_mr32(fatal_table_address,
145145 MPI_FATAL_EDUMP_TABLE_ACCUM_LEN);
146146 /* Determine length of data between previously stored transfer length
@@ -1011,7 +1011,7 @@ static int mpi_init_check(struct pm8001_hba_info *pm8001_ha) · 864 unmodified lines
10111011 value);
10121012 return -EBUSY;
10131013 }
1014− /* check the MPI-State for initialization upto 100ms*/
1014+ /* check the MPI-State for initialization up to 100ms*/
10151015 max_wait_count = 5;/* 100 msec */
10161016 do {
10171017 msleep(FW_READY_INTERVAL);
@@ -1093,7 +1093,7 @@ static int init_pci_device_addresses(struct pm8001_hba_info *pm8001_ha) · 75 unmodified lines
10931093
10941094 value = pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_0);
10951095
1096− /**
1096+ /*
10971097 * lower 26 bits of SCRATCHPAD0 register describes offset within the
10981098 * PCIe BAR where the MPI configuration table is present
10991099 */
@@ -1101,7 +1101,7 @@ static int init_pci_device_addresses(struct pm8001_hba_info *pm8001_ha) · 1 unmodified line
11011101
11021102 pm8001_dbg(pm8001_ha, DEV, "Scratchpad 0 Offset: 0x%x value 0x%x\n",
11031103 offset, value);
1104− /**
1104+ /*
11051105 * Upper 6 bits describe the offset within PCI config space where BAR
11061106 * is located.
11071107 */
@@ -1109,7 +1109,7 @@ static int init_pci_device_addresses(struct pm8001_hba_info *pm8001_ha) · 1 unmodified line
11091109 pcibar = get_pci_bar_index(pcilogic);
11101110 pm8001_dbg(pm8001_ha, INIT, "Scratchpad 0 PCI BAR: %d\n", pcibar);
11111111
1112− /**
1112+ /*
11131113 * Make sure the offset falls inside the ioremapped PCI BAR
11141114 */
11151115 if (offset > pm8001_ha->io_mem[pcibar].memsize) {
@@ -1121,7 +1121,7 @@ static int init_pci_device_addresses(struct pm8001_hba_info *pm8001_ha) · 5 unmodified lines
11211121 pm8001_ha->main_cfg_tbl_addr = base_addr =
11221122 pm8001_ha->io_mem[pcibar].memvirtaddr + offset;
11231123
1124− /**
1124+ /*
11251125 * Validate main configuration table address: first DWord should read
11261126 * "PMCS"
11271127 */
@@ -1385,7 +1385,7 @@ pm80xx_get_encrypt_info(struct pm8001_hba_info *pm8001_ha) · 257 unmodified lines
13851385 }
13861386
13871387 /**
1388− * pm80xx_encrypt_update - update flash with encryption informtion
1388+ * pm80xx_encrypt_update - update flash with encryption information
13891389 * @pm8001_ha: our hba card information.
13901390 */
13911391 static int pm80xx_encrypt_update(struct pm8001_hba_info *pm8001_ha)
@@ -1422,7 +1422,7 @@ static int pm80xx_encrypt_update(struct pm8001_hba_info *pm8001_ha) · 30 unmodified lines
14221422 }
14231423
14241424 /**
1425− * pm80xx_chip_init - the main init function that initialize whole PM8001 chip.
1425+ * pm80xx_chip_init - the main init function that initializes whole PM8001 chip.
14261426 * @pm8001_ha: our hba card information
14271427 */
14281428 static int pm80xx_chip_init(struct pm8001_hba_info *pm8001_ha)
@@ -1541,7 +1541,7 @@ static int mpi_uninit_check(struct pm8001_hba_info *pm8001_ha) · 112 unmodified lines
15411541 }
15421542
15431543 /**
1544− * pm80xx_fatal_errors - returns non zero *ONLY* when fatal errors
1544+ * pm80xx_fatal_errors - returns non-zero *ONLY* when fatal errors
15451545 * @pm8001_ha: our hba card information
15461546 *
15471547 * Fatal errors are recoverable only after a host reboot.
@@ -1576,8 +1576,8 @@ pm80xx_fatal_errors(struct pm8001_hba_info *pm8001_ha) · 28 unmodified lines
15761576 }
15771577
15781578 /**
1579− * pm80xx_chip_soft_rst - soft reset the PM8001 chip, so that the clear all
1580− * the FW register status to the originated status.
1579+ * pm80xx_chip_soft_rst - soft reset the PM8001 chip, so that all
1580+ * FW register status are reset to the originated status.
15811581 * @pm8001_ha: our hba card information
15821582 */
15831583
@@ -1895,13 +1895,13 @@ static void pm80xx_send_read_log(struct pm8001_hba_info *pm8001_ha, · 311 unmodified lines
18951895 }
18961896
18971897 /**
1898− * mpi_ssp_completion- process the event that FW response to the SSP request.
1898+ * mpi_ssp_completion - process the event that FW response to the SSP request.
18991899 * @pm8001_ha: our hba card information
19001900 * @piomb: the message contents of this outbound message.
19011901 *
19021902 * When FW has completed a ssp request for example a IO request, after it has
1903− * filled the SG data with the data, it will trigger this event represent
1904− * that he has finished the job,please check the coresponding buffer.
1903+ * filled the SG data with the data, it will trigger this event representing
1904+ * that he has finished the job; please check the corresponding buffer.
19051905 * So we will tell the caller who maybe waiting the result to tell upper layer
19061906 * that the task has been finished.
19071907 */
@@ -3217,7 +3217,7 @@ mpi_smp_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) · 1309 unmodified lines
32173217 }
32183218
32193219 /**
3220− * pm80xx_hw_event_ack_req- For PM8001,some events need to acknowage to FW.
3220+ * pm80xx_hw_event_ack_req- For PM8001, some events need to acknowledge to FW.
32213221 * @pm8001_ha: our hba card information
32223222 * @Qnum: the outbound queue message number.
32233223 * @SEA: source of event to ack
@@ -3275,7 +3275,7 @@ static void hw_event_port_recover(struct pm8001_hba_info *pm8001_ha, · 51 unmodified lines
32753275 }
32763276
32773277 /**
3278− * hw_event_sas_phy_up -FW tells me a SAS phy up event.
3278+ * hw_event_sas_phy_up - FW tells me a SAS phy up event.
32793279 * @pm8001_ha: our hba card information
32803280 * @piomb: IO message buffer
32813281 */
@@ -3353,7 +3353,7 @@ hw_event_sas_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb) · 71 unmodified lines
33533353 }
33543354
33553355 /**
3356− * hw_event_sata_phy_up -FW tells me a SATA phy up event.
3356+ * hw_event_sata_phy_up - FW tells me a SATA phy up event.
33573357 * @pm8001_ha: our hba card information
33583358 * @piomb: IO message buffer
33593359 */
@@ -3400,7 +3400,7 @@ hw_event_sata_phy_up(struct pm8001_hba_info *pm8001_ha, void *piomb) · 40 unmodified lines
34003400 }
34013401
34023402 /**
3403− * hw_event_phy_down -we should notify the libsas the phy is down.
3403+ * hw_event_phy_down - we should notify the libsas the phy is down.
34043404 * @pm8001_ha: our hba card information
34053405 * @piomb: IO message buffer
34063406 */
@@ -3500,7 +3500,7 @@ static int mpi_phy_start_resp(struct pm8001_hba_info *pm8001_ha, void *piomb) · 93 unmodified lines
35003500 }
35013501
35023502 /**
3503− * mpi_thermal_hw_event -The hw event has come.
3503+ * mpi_thermal_hw_event - a thermal hw event has come.
35043504 * @pm8001_ha: our hba card information
35053505 * @piomb: IO message buffer
35063506 */
@@ -3530,7 +3530,7 @@ static int mpi_thermal_hw_event(struct pm8001_hba_info *pm8001_ha, void *piomb) · 23 unmodified lines
35303530 }
35313531
35323532 /**
3533− * mpi_hw_event -The hw event has come.
3533+ * mpi_hw_event - The hw event has come.
35343534 * @pm8001_ha: our hba card information
35353535 * @piomb: IO message buffer
35363536 */
@@ -4025,7 +4025,7 @@ static void process_one_iomb(struct pm8001_hba_info *pm8001_ha, void *piomb) · 488 unmodified lines
40254025 case OPC_OUB_SET_DEV_INFO:
40264026 pm8001_dbg(pm8001_ha, MSG, "OPC_OUB_SET_DEV_INFO\n");
40274027 break;
4028− /* spcv specifc commands */
4028+ /* spcv specific commands */
40294029 case OPC_OUB_PHY_START_RESP:
40304030 pm8001_dbg(pm8001_ha, MSG,
40314031 "OPC_OUB_PHY_START_RESP opcode:%x\n", opc);
@@ -4186,7 +4186,7 @@ static void build_smp_cmd(u32 deviceID, __le32 hTag, · 154 unmodified lines
41864186 }
41874187
41884188 /**
4189− * pm80xx_chip_smp_req - send a SMP task to FW
4189+ * pm80xx_chip_smp_req - send an SMP task to FW
41904190 * @pm8001_ha: our hba card information.
41914191 * @ccb: the ccb information this request used.
41924192 */
@@ -4346,7 +4346,7 @@ static int check_enc_sat_cmd(struct sas_task *task) · 153 unmodified lines
43464346 }
43474347
43484348 /**
4349− * pm80xx_chip_ssp_io_req - send a SSP task to FW
4349+ * pm80xx_chip_ssp_io_req - send an SSP task to FW
43504350 * @pm8001_ha: our hba card information.
43514351 * @ccb: the ccb information this request used.
43524352 */
@@ -4750,13 +4750,13 @@ pm80xx_chip_phy_start_req(struct pm8001_hba_info *pm8001_ha, u8 phy_id) · 397 unmodified lines
47504750 payload.ase_sh_lm_slr_phyid = cpu_to_le32(SPINHOLD_DISABLE |
47514751 LINKMODE_AUTO | pm8001_ha->link_rate | phy_id);
47524752 /* SSC Disable and SAS Analog ST configuration */
4753− /**
4753+ /*
47544754 payload.ase_sh_lm_slr_phyid =
47554755 cpu_to_le32(SSC_DISABLE_30 | SAS_ASE | SPINHOLD_DISABLE |
47564756 LINKMODE_AUTO | LINKRATE_15 | LINKRATE_30 | LINKRATE_60 |
47574757 phy_id);
47584758 Have to add "SAS PHY Analog Setup SPASTI 1 Byte" Based on need
4759− **/
4759+ */
47604760
47614761 payload.sas_identify.dev_type = SAS_END_DEVICE;
47624762 payload.sas_identify.initiator_bits = SAS_PROTOCOL_ALL;
drivers/scsi/scsi_lib.c+1−1
@@ -194,7 +194,7 @@ void scsi_queue_insert(struct scsi_cmnd *cmd, int reason) · 193 unmodified lines
194194 * @bufflen: len of buffer
195195 * @sense: optional sense buffer
196196 * @sshdr: optional decoded sense header
197− * @timeout: request timeout in seconds
197+ * @timeout: request timeout in HZ
198198 * @retries: number of times to retry request
199199 * @flags: flags for ->cmd_flags
200200 * @rq_flags: flags for ->rq_flags
drivers/scsi/ufs/ufshcd.h+7−2
@@ -1229,8 +1229,13 @@ static inline int ufshcd_vops_pwr_change_notify(struct ufs_hba *hba, · 1228 unmodified lines
12291229 static inline void ufshcd_vops_setup_xfer_req(struct ufs_hba *hba, int tag,
12301230 bool is_scsi_cmd)
12311231 {
1232− if (hba->vops && hba->vops->setup_xfer_req)
1233− return hba->vops->setup_xfer_req(hba, tag, is_scsi_cmd);
1232+ if (hba->vops && hba->vops->setup_xfer_req) {
1233+ unsigned long flags;
1234+
1235+ spin_lock_irqsave(hba->host->host_lock, flags);
1236+ hba->vops->setup_xfer_req(hba, tag, is_scsi_cmd);
1237+ spin_unlock_irqrestore(hba->host->host_lock, flags);
1238+ }
12341239 }
12351240
12361241 static inline void ufshcd_vops_setup_task_mgmt(struct ufs_hba *hba,
drivers/spi/spi-atmel.c+2−7
@@ -352,8 +352,6 @@ static void cs_activate(struct atmel_spi *as, struct spi_device *spi) · 351 unmodified lines
352352 }
353353
354354 mr = spi_readl(as, MR);
355− if (spi->cs_gpiod)
356− gpiod_set_value(spi->cs_gpiod, 1);
357355 } else {
358356 u32 cpol = (spi->mode & SPI_CPOL) ? SPI_BIT(CPOL) : 0;
359357 int i;
@@ -369,8 +367,6 @@ static void cs_activate(struct atmel_spi *as, struct spi_device *spi) · 9 unmodified lines
369367
370368 mr = spi_readl(as, MR);
371369 mr = SPI_BFINS(PCS, ~(1 << chip_select), mr);
372− if (spi->cs_gpiod)
373− gpiod_set_value(spi->cs_gpiod, 1);
374370 spi_writel(as, MR, mr);
375371 }
376372
@@ -400,8 +396,6 @@ static void cs_deactivate(struct atmel_spi *as, struct spi_device *spi) · 23 unmodified lines
400396
401397 if (!spi->cs_gpiod)
402398 spi_writel(as, CR, SPI_BIT(LASTXFER));
403− else
404− gpiod_set_value(spi->cs_gpiod, 0);
405399 }
406400
407401 static void atmel_spi_lock(struct atmel_spi *as) __acquires(&as->lock)
@@ -1483,7 +1477,8 @@ static int atmel_spi_probe(struct platform_device *pdev) · 1075 unmodified lines
14831477 master->bus_num = pdev->id;
14841478 master->num_chipselect = 4;
14851479 master->setup = atmel_spi_setup;
1486− master->flags = (SPI_MASTER_MUST_RX | SPI_MASTER_MUST_TX);
1480+ master->flags = (SPI_MASTER_MUST_RX | SPI_MASTER_MUST_TX |
1481+ SPI_MASTER_GPIO_SS);
14871482 master->transfer_one = atmel_spi_one_transfer;
14881483 master->set_cs = atmel_spi_set_cs;
14891484 master->cleanup = atmel_spi_cleanup;
drivers/spi/spi-bcm2835.c+7−5
@@ -83,6 +83,7 @@ MODULE_PARM_DESC(polling_limit_us, · 82 unmodified lines
8383 * struct bcm2835_spi - BCM2835 SPI controller
8484 * @regs: base address of register map
8585 * @clk: core clock, divided to calculate serial clock
86+ * @clk_hz: core clock cached speed
8687 * @irq: interrupt, signals TX FIFO empty or RX FIFO ¾ full
8788 * @tfr: SPI transfer currently processed
8889 * @ctlr: SPI controller reverse lookup
@@ -116,6 +117,7 @@ MODULE_PARM_DESC(polling_limit_us, · 27 unmodified lines
116117 struct bcm2835_spi {
117118 void __iomem *regs;
118119 struct clk *clk;
120+ unsigned long clk_hz;
119121 int irq;
120122 struct spi_transfer *tfr;
121123 struct spi_controller *ctlr;
@@ -1045,19 +1047,18 @@ static int bcm2835_spi_transfer_one(struct spi_controller *ctlr, · 923 unmodified lines
10451047 {
10461048 struct bcm2835_spi *bs = spi_controller_get_devdata(ctlr);
10471049 struct bcm2835_spidev *slv = spi_get_ctldata(spi);
1048− unsigned long spi_hz, clk_hz, cdiv;
1050+ unsigned long spi_hz, cdiv;
10491051 unsigned long hz_per_byte, byte_limit;
10501052 u32 cs = slv->prepare_cs;
10511053
10521054 /* set clock */
10531055 spi_hz = tfr->speed_hz;
1054− clk_hz = clk_get_rate(bs->clk);
10551056
1056− if (spi_hz >= clk_hz / 2) {
1057+ if (spi_hz >= bs->clk_hz / 2) {
10571058 cdiv = 2; /* clk_hz/2 is the fastest we can go */
10581059 } else if (spi_hz) {
10591060 /* CDIV must be a multiple of two */
1060− cdiv = DIV_ROUND_UP(clk_hz, spi_hz);
1061+ cdiv = DIV_ROUND_UP(bs->clk_hz, spi_hz);
10611062 cdiv += (cdiv % 2);
10621063
10631064 if (cdiv >= 65536)
@@ -1065,7 +1066,7 @@ static int bcm2835_spi_transfer_one(struct spi_controller *ctlr, · 1 unmodified line
10651066 } else {
10661067 cdiv = 0; /* 0 is the slowest we can go */
10671068 }
1068− tfr->effective_speed_hz = cdiv ? (clk_hz / cdiv) : (clk_hz / 65536);
1069+ tfr->effective_speed_hz = cdiv ? (bs->clk_hz / cdiv) : (bs->clk_hz / 65536);
10691070 bcm2835_wr(bs, BCM2835_SPI_CLK, cdiv);
10701071
10711072 /* handle all the 3-wire mode */
@@ -1354,6 +1355,7 @@ static int bcm2835_spi_probe(struct platform_device *pdev) · 282 unmodified lines
13541355 return bs->irq ? bs->irq : -ENODEV;
13551356
13561357 clk_prepare_enable(bs->clk);
1358+ bs->clk_hz = clk_get_rate(bs->clk);
13571359
13581360 err = bcm2835_dma_init(ctlr, &pdev->dev, bs);
13591361 if (err)
drivers/spi/spi-cadence-quadspi.c+17−13
@@ -309,6 +309,9 @@ static unsigned int cqspi_calc_dummy(const struct spi_mem_op *op, bool dtr) · 308 unmodified lines
309309 {
310310 unsigned int dummy_clk;
311311
312+ if (!op->dummy.nbytes)
313+ return 0;
314+
312315 dummy_clk = op->dummy.nbytes * (8 / op->dummy.buswidth);
313316 if (dtr)
314317 dummy_clk /= 2;
@@ -797,19 +800,20 @@ static int cqspi_write_setup(struct cqspi_flash_pdata *f_pdata, · 482 unmodified lines
797800 reg = cqspi_calc_rdreg(f_pdata);
798801 writel(reg, reg_base + CQSPI_REG_RD_INSTR);
799802
800− if (f_pdata->dtr) {
801− /*
802− * Some flashes like the cypress Semper flash expect a 4-byte
803− * dummy address with the Read SR command in DTR mode, but this
804− * controller does not support sending address with the Read SR
805− * command. So, disable write completion polling on the
806− * controller's side. spi-nor will take care of polling the
807− * status register.
808− */
809− reg = readl(reg_base + CQSPI_REG_WR_COMPLETION_CTRL);
810− reg |= CQSPI_REG_WR_DISABLE_AUTO_POLL;
811− writel(reg, reg_base + CQSPI_REG_WR_COMPLETION_CTRL);
812− }
803+ /*
804+ * SPI NAND flashes require the address of the status register to be
805+ * passed in the Read SR command. Also, some SPI NOR flashes like the
806+ * cypress Semper flash expect a 4-byte dummy address in the Read SR
807+ * command in DTR mode.
808+ *
809+ * But this controller does not support address phase in the Read SR
810+ * command when doing auto-HW polling. So, disable write completion
811+ * polling on the controller's side. spinand and spi-nor will take
812+ * care of polling the status register.
813+ */
814+ reg = readl(reg_base + CQSPI_REG_WR_COMPLETION_CTRL);
815+ reg |= CQSPI_REG_WR_DISABLE_AUTO_POLL;
816+ writel(reg, reg_base + CQSPI_REG_WR_COMPLETION_CTRL);
813817
814818 reg = readl(reg_base + CQSPI_REG_SIZE);
815819 reg &= ~CQSPI_REG_SIZE_ADDRESS_MASK;
drivers/spi/spi-cadence.c+9−5
@@ -517,6 +517,12 @@ static int cdns_spi_probe(struct platform_device *pdev) · 516 unmodified lines
517517 goto clk_dis_apb;
518518 }
519519
520+ pm_runtime_use_autosuspend(&pdev->dev);
521+ pm_runtime_set_autosuspend_delay(&pdev->dev, SPI_AUTOSUSPEND_TIMEOUT);
522+ pm_runtime_get_noresume(&pdev->dev);
523+ pm_runtime_set_active(&pdev->dev);
524+ pm_runtime_enable(&pdev->dev);
525+
520526 ret = of_property_read_u32(pdev->dev.of_node, "num-cs", &num_cs);
521527 if (ret < 0)
522528 master->num_chipselect = CDNS_SPI_DEFAULT_NUM_CS;
@@ -531,11 +537,6 @@ static int cdns_spi_probe(struct platform_device *pdev) · 8 unmodified lines
531537 /* SPI controller initializations */
532538 cdns_spi_init_hw(xspi);
533539
534− pm_runtime_set_active(&pdev->dev);
535− pm_runtime_enable(&pdev->dev);
536− pm_runtime_use_autosuspend(&pdev->dev);
537− pm_runtime_set_autosuspend_delay(&pdev->dev, SPI_AUTOSUSPEND_TIMEOUT);
538−
539540 irq = platform_get_irq(pdev, 0);
540541 if (irq <= 0) {
541542 ret = -ENXIO;
@@ -566,6 +567,9 @@ static int cdns_spi_probe(struct platform_device *pdev) · 24 unmodified lines
566567
567568 master->bits_per_word_mask = SPI_BPW_MASK(8);
568569
570+ pm_runtime_mark_last_busy(&pdev->dev);
571+ pm_runtime_put_autosuspend(&pdev->dev);
572+
569573 ret = spi_register_master(master);
570574 if (ret) {
571575 dev_err(&pdev->dev, "spi_register_master failed\n");
drivers/spi/spi-imx.c+19−19
@@ -506,7 +506,7 @@ static int mx51_ecspi_prepare_message(struct spi_imx_data *spi_imx, · 505 unmodified lines
506506 {
507507 struct spi_device *spi = msg->spi;
508508 u32 ctrl = MX51_ECSPI_CTRL_ENABLE;
509− u32 testreg;
509+ u32 testreg, delay;
510510 u32 cfg = readl(spi_imx->base + MX51_ECSPI_CONFIG);
511511
512512 /* set Master or Slave mode */
@@ -567,6 +567,23 @@ static int mx51_ecspi_prepare_message(struct spi_imx_data *spi_imx, · 54 unmodified lines
567567
568568 writel(cfg, spi_imx->base + MX51_ECSPI_CONFIG);
569569
570+ /*
571+ * Wait until the changes in the configuration register CONFIGREG
572+ * propagate into the hardware. It takes exactly one tick of the
573+ * SCLK clock, but we will wait two SCLK clock just to be sure. The
574+ * effect of the delay it takes for the hardware to apply changes
575+ * is noticable if the SCLK clock run very slow. In such a case, if
576+ * the polarity of SCLK should be inverted, the GPIO ChipSelect might
577+ * be asserted before the SCLK polarity changes, which would disrupt
578+ * the SPI communication as the device on the other end would consider
579+ * the change of SCLK polarity as a clock tick already.
580+ */
581+ delay = (2 * 1000000) / spi_imx->spi_bus_clk;
582+ if (likely(delay < 10)) /* SCLK is faster than 100 kHz */
583+ udelay(delay);
584+ else /* SCLK is _very_ slow */
585+ usleep_range(delay, delay + 10);
586+
570587 return 0;
571588 }
572589
@@ -574,7 +591,7 @@ static int mx51_ecspi_prepare_transfer(struct spi_imx_data *spi_imx, · 1 unmodified line
574591 struct spi_device *spi)
575592 {
576593 u32 ctrl = readl(spi_imx->base + MX51_ECSPI_CTRL);
577− u32 clk, delay;
594+ u32 clk;
578595
579596 /* Clear BL field and set the right value */
580597 ctrl &= ~MX51_ECSPI_CTRL_BL_MASK;
@@ -596,23 +613,6 @@ static int mx51_ecspi_prepare_transfer(struct spi_imx_data *spi_imx, · 15 unmodified lines
596613
597614 writel(ctrl, spi_imx->base + MX51_ECSPI_CTRL);
598615
599− /*
600− * Wait until the changes in the configuration register CONFIGREG
601− * propagate into the hardware. It takes exactly one tick of the
602− * SCLK clock, but we will wait two SCLK clock just to be sure. The
603− * effect of the delay it takes for the hardware to apply changes
604− * is noticable if the SCLK clock run very slow. In such a case, if
605− * the polarity of SCLK should be inverted, the GPIO ChipSelect might
606− * be asserted before the SCLK polarity changes, which would disrupt
607− * the SPI communication as the device on the other end would consider
608− * the change of SCLK polarity as a clock tick already.
609− */
610− delay = (2 * 1000000) / clk;
611− if (likely(delay < 10)) /* SCLK is faster than 100 kHz */
612− udelay(delay);
613− else /* SCLK is _very_ slow */
614− usleep_range(delay, delay + 10);
615−
616616 return 0;
617617 }
618618
drivers/spi/spi-mt65xx.c+19−9
@@ -427,13 +427,23 @@ static int mtk_spi_fifo_transfer(struct spi_master *master, · 426 unmodified lines
427427 mtk_spi_setup_packet(master);
428428
429429 cnt = xfer->len / 4;
430− iowrite32_rep(mdata->base + SPI_TX_DATA_REG, xfer->tx_buf, cnt);
430+ if (xfer->tx_buf)
431+ iowrite32_rep(mdata->base + SPI_TX_DATA_REG, xfer->tx_buf, cnt);
432+
433+ if (xfer->rx_buf)
434+ ioread32_rep(mdata->base + SPI_RX_DATA_REG, xfer->rx_buf, cnt);
431435
432436 remainder = xfer->len % 4;
433437 if (remainder > 0) {
434438 reg_val = 0;
435− memcpy(&reg_val, xfer->tx_buf + (cnt * 4), remainder);
436− writel(reg_val, mdata->base + SPI_TX_DATA_REG);
439+ if (xfer->tx_buf) {
440+ memcpy(&reg_val, xfer->tx_buf + (cnt * 4), remainder);
441+ writel(reg_val, mdata->base + SPI_TX_DATA_REG);
442+ }
443+ if (xfer->rx_buf) {
444+ reg_val = readl(mdata->base + SPI_RX_DATA_REG);
445+ memcpy(xfer->rx_buf + (cnt * 4), &reg_val, remainder);
446+ }
437447 }
438448
439449 mtk_spi_enable_transfer(master);
@@ -793,12 +803,6 @@ static int mtk_spi_probe(struct platform_device *pdev) · 353 unmodified lines
793803
794804 pm_runtime_enable(&pdev->dev);
795805
796− ret = devm_spi_register_master(&pdev->dev, master);
797− if (ret) {
798− dev_err(&pdev->dev, "failed to register master (%d)\n", ret);
799− goto err_disable_runtime_pm;
800− }
801−
802806 if (mdata->dev_comp->need_pad_sel) {
803807 if (mdata->pad_num != master->num_chipselect) {
804808 dev_err(&pdev->dev,
@@ -838,6 +842,12 @@ static int mtk_spi_probe(struct platform_device *pdev) · 33 unmodified lines
838842 dev_notice(&pdev->dev, "SPI dma_set_mask(%d) failed, ret:%d\n",
839843 addr_bits, ret);
840844
845+ ret = devm_spi_register_master(&pdev->dev, master);
846+ if (ret) {
847+ dev_err(&pdev->dev, "failed to register master (%d)\n", ret);
848+ goto err_disable_runtime_pm;
849+ }
850+
841851 return 0;
842852
843853 err_disable_runtime_pm:
drivers/spi/spi-stm32.c+17−7
@@ -884,15 +884,18 @@ static irqreturn_t stm32h7_spi_irq_thread(int irq, void *dev_id) · 883 unmodified lines
884884 ier = readl_relaxed(spi->base + STM32H7_SPI_IER);
885885
886886 mask = ier;
887− /* EOTIE is triggered on EOT, SUSP and TXC events. */
887+ /*
888+ * EOTIE enables irq from EOT, SUSP and TXC events. We need to set
889+ * SUSP to acknowledge it later. TXC is automatically cleared
890+ */
891+
888892 mask |= STM32H7_SPI_SR_SUSP;
889893 /*
890− * When TXTF is set, DXPIE and TXPIE are cleared. So in case of
891− * Full-Duplex, need to poll RXP event to know if there are remaining
892− * data, before disabling SPI.
894+ * DXPIE is set in Full-Duplex, one IT will be raised if TXP and RXP
895+ * are set. So in case of Full-Duplex, need to poll TXP and RXP event.
893896 */
894− if (spi->rx_buf && !spi->cur_usedma)
895− mask |= STM32H7_SPI_SR_RXP;
897+ if ((spi->cur_comm == SPI_FULL_DUPLEX) && !spi->cur_usedma)
898+ mask |= STM32H7_SPI_SR_TXP | STM32H7_SPI_SR_RXP;
896899
897900 if (!(sr & mask)) {
898901 dev_warn(spi->dev, "spurious IT (sr=0x%08x, ier=0x%08x)\n",
@@ -1925,6 +1928,7 @@ static int stm32_spi_probe(struct platform_device *pdev) · 1026 unmodified lines
19251928 master->can_dma = stm32_spi_can_dma;
19261929
19271930 pm_runtime_set_active(&pdev->dev);
1931+ pm_runtime_get_noresume(&pdev->dev);
19281932 pm_runtime_enable(&pdev->dev);
19291933
19301934 ret = spi_register_master(master);
@@ -1940,6 +1944,8 @@ static int stm32_spi_probe(struct platform_device *pdev) · 9 unmodified lines
19401944
19411945 err_pm_disable:
19421946 pm_runtime_disable(&pdev->dev);
1947+ pm_runtime_put_noidle(&pdev->dev);
1948+ pm_runtime_set_suspended(&pdev->dev);
19431949 err_dma_release:
19441950 if (spi->dma_tx)
19451951 dma_release_channel(spi->dma_tx);
@@ -1956,9 +1962,14 @@ static int stm32_spi_remove(struct platform_device *pdev) · 10 unmodified lines
19561962 struct spi_master *master = platform_get_drvdata(pdev);
19571963 struct stm32_spi *spi = spi_master_get_devdata(master);
19581964
1965+ pm_runtime_get_sync(&pdev->dev);
1966+
19591967 spi_unregister_master(master);
19601968 spi->cfg->disable(spi);
19611969
1970+ pm_runtime_disable(&pdev->dev);
1971+ pm_runtime_put_noidle(&pdev->dev);
1972+ pm_runtime_set_suspended(&pdev->dev);
19621973 if (master->dma_tx)
19631974 dma_release_channel(master->dma_tx);
19641975 if (master->dma_rx)
@@ -1966,7 +1977,6 @@ static int stm32_spi_remove(struct platform_device *pdev) · 1 unmodified line
19661977
19671978 clk_disable_unprepare(spi->clk);
19681979
1969− pm_runtime_disable(&pdev->dev);
19701980
19711981 pinctrl_pm_select_sleep_state(&pdev->dev);
19721982
drivers/usb/gadget/udc/fsl_qe_udc.c+1−0
@@ -586,6 +586,7 @@ static int qe_ep_init(struct qe_udc *udc, · 585 unmodified lines
586586 case USB_SPEED_FULL:
587587 if (max <= 1023)
588588 break;
589+ fallthrough;
589590 default:
590591 goto en_done;
591592 }
drivers/video/fbdev/core/fbmem.c+5−7
@@ -970,13 +970,11 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) · 969 unmodified lines
970970 fb_var_to_videomode(&mode2, &info->var);
971971 /* make sure we don't delete the videomode of current var */
972972 ret = fb_mode_is_equal(&mode1, &mode2);
973−
974− if (!ret)
975− fbcon_mode_deleted(info, &mode1);
976−
977− if (!ret)
978− fb_delete_videomode(&mode1, &info->modelist);
979−
973+ if (!ret) {
974+ ret = fbcon_mode_deleted(info, &mode1);
975+ if (!ret)
976+ fb_delete_videomode(&mode1, &info->modelist);
977+ }
980978
981979 return ret ? -EINVAL : 0;
982980 }
drivers/video/fbdev/xilinxfb.c+2−0
@@ -241,6 +241,8 @@ xilinx_fb_blank(int blank_mode, struct fb_info *fbi) · 240 unmodified lines
241241 case FB_BLANK_POWERDOWN:
242242 /* turn off panel */
243243 xilinx_fb_out32(drvdata, REG_CTRL, 0);
244+ break;
245+
244246 default:
245247 break;
246248 }
fs/afs/cmservice.c+7−18
@@ -29,16 +29,11 @@ static void SRXAFSCB_TellMeAboutYourself(struct work_struct *); · 28 unmodified lines
2929
3030 static int afs_deliver_yfs_cb_callback(struct afs_call *);
3131
32−#define CM_NAME(name) \
33− char afs_SRXCB##name##_name[] __tracepoint_string = \
34− "CB." #name
35−
3632 /*
3733 * CB.CallBack operation type
3834 */
39−static CM_NAME(CallBack);
4035 static const struct afs_call_type afs_SRXCBCallBack = {
41− .name = afs_SRXCBCallBack_name,
36+ .name = "CB.CallBack",
4237 .deliver = afs_deliver_cb_callback,
4338 .destructor = afs_cm_destructor,
4439 .work = SRXAFSCB_CallBack,
@@ -47,9 +42,8 @@ static const struct afs_call_type afs_SRXCBCallBack = { · 2 unmodified lines
4742 /*
4843 * CB.InitCallBackState operation type
4944 */
50−static CM_NAME(InitCallBackState);
5145 static const struct afs_call_type afs_SRXCBInitCallBackState = {
52− .name = afs_SRXCBInitCallBackState_name,
46+ .name = "CB.InitCallBackState",
5347 .deliver = afs_deliver_cb_init_call_back_state,
5448 .destructor = afs_cm_destructor,
5549 .work = SRXAFSCB_InitCallBackState,
@@ -58,9 +52,8 @@ static const struct afs_call_type afs_SRXCBInitCallBackState = { · 2 unmodified lines
5852 /*
5953 * CB.InitCallBackState3 operation type
6054 */
61−static CM_NAME(InitCallBackState3);
6255 static const struct afs_call_type afs_SRXCBInitCallBackState3 = {
63− .name = afs_SRXCBInitCallBackState3_name,
56+ .name = "CB.InitCallBackState3",
6457 .deliver = afs_deliver_cb_init_call_back_state3,
6558 .destructor = afs_cm_destructor,
6659 .work = SRXAFSCB_InitCallBackState,
@@ -69,9 +62,8 @@ static const struct afs_call_type afs_SRXCBInitCallBackState3 = { · 2 unmodified lines
6962 /*
7063 * CB.Probe operation type
7164 */
72−static CM_NAME(Probe);
7365 static const struct afs_call_type afs_SRXCBProbe = {
74− .name = afs_SRXCBProbe_name,
66+ .name = "CB.Probe",
7567 .deliver = afs_deliver_cb_probe,
7668 .destructor = afs_cm_destructor,
7769 .work = SRXAFSCB_Probe,
@@ -80,9 +72,8 @@ static const struct afs_call_type afs_SRXCBProbe = { · 2 unmodified lines
8072 /*
8173 * CB.ProbeUuid operation type
8274 */
83−static CM_NAME(ProbeUuid);
8475 static const struct afs_call_type afs_SRXCBProbeUuid = {
85− .name = afs_SRXCBProbeUuid_name,
76+ .name = "CB.ProbeUuid",
8677 .deliver = afs_deliver_cb_probe_uuid,
8778 .destructor = afs_cm_destructor,
8879 .work = SRXAFSCB_ProbeUuid,
@@ -91,9 +82,8 @@ static const struct afs_call_type afs_SRXCBProbeUuid = { · 2 unmodified lines
9182 /*
9283 * CB.TellMeAboutYourself operation type
9384 */
94−static CM_NAME(TellMeAboutYourself);
9585 static const struct afs_call_type afs_SRXCBTellMeAboutYourself = {
96− .name = afs_SRXCBTellMeAboutYourself_name,
86+ .name = "CB.TellMeAboutYourself",
9787 .deliver = afs_deliver_cb_tell_me_about_yourself,
9888 .destructor = afs_cm_destructor,
9989 .work = SRXAFSCB_TellMeAboutYourself,
@@ -102,9 +92,8 @@ static const struct afs_call_type afs_SRXCBTellMeAboutYourself = { · 2 unmodified lines
10292 /*
10393 * YFS CB.CallBack operation type
10494 */
105−static CM_NAME(YFS_CallBack);
10695 static const struct afs_call_type afs_SRXYFSCB_CallBack = {
107− .name = afs_SRXCBYFS_CallBack_name,
96+ .name = "YFSCB.CallBack",
10897 .deliver = afs_deliver_yfs_cb_callback,
10998 .destructor = afs_cm_destructor,
11099 .work = SRXAFSCB_CallBack,
fs/afs/dir.c+6−4
@@ -656,7 +656,6 @@ static int afs_do_lookup_one(struct inode *dir, struct dentry *dentry, · 655 unmodified lines
656656 return ret;
657657 }
658658
659− ret = -ENOENT;
660659 if (!cookie.found) {
661660 _leave(" = -ENOENT [not found]");
662661 return -ENOENT;
@@ -2020,17 +2019,20 @@ static int afs_rename(struct user_namespace *mnt_userns, struct inode *old_dir, · 1357 unmodified lines
20202019
20212020 if (d_count(new_dentry) > 2) {
20222021 /* copy the target dentry's name */
2023− ret = -ENOMEM;
20242022 op->rename.tmp = d_alloc(new_dentry->d_parent,
20252023 &new_dentry->d_name);
2026− if (!op->rename.tmp)
2024+ if (!op->rename.tmp) {
2025+ op->error = -ENOMEM;
20272026 goto error;
2027+ }
20282028
20292029 ret = afs_sillyrename(new_dvnode,
20302030 AFS_FS_I(d_inode(new_dentry)),
20312031 new_dentry, op->key);
2032− if (ret)
2032+ if (ret) {
2033+ op->error = ret;
20332034 goto error;
2035+ }
20342036
20352037 op->dentry_2 = op->rename.tmp;
20362038 op->rename.rehash = NULL;
fs/afs/write.c+12−6
@@ -771,14 +771,20 @@ int afs_writepages(struct address_space *mapping, · 770 unmodified lines
771771 if (wbc->range_cyclic) {
772772 start = mapping->writeback_index * PAGE_SIZE;
773773 ret = afs_writepages_region(mapping, wbc, start, LLONG_MAX, &next);
774− if (start > 0 && wbc->nr_to_write > 0 && ret == 0)
775− ret = afs_writepages_region(mapping, wbc, 0, start,
776− &next);
777− mapping->writeback_index = next / PAGE_SIZE;
774+ if (ret == 0) {
775+ mapping->writeback_index = next / PAGE_SIZE;
776+ if (start > 0 && wbc->nr_to_write > 0) {
777+ ret = afs_writepages_region(mapping, wbc, 0,
778+ start, &next);
779+ if (ret == 0)
780+ mapping->writeback_index =
781+ next / PAGE_SIZE;
782+ }
783+ }
778784 } else if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX) {
779785 ret = afs_writepages_region(mapping, wbc, 0, LLONG_MAX, &next);
780− if (wbc->nr_to_write > 0)
781− mapping->writeback_index = next;
786+ if (wbc->nr_to_write > 0 && ret == 0)
787+ mapping->writeback_index = next / PAGE_SIZE;
782788 } else {
783789 ret = afs_writepages_region(mapping, wbc,
784790 wbc->range_start, wbc->range_end, &next);
fs/cifs/cifs_dfs_ref.c+5−1
@@ -176,7 +176,7 @@ char *cifs_compose_mount_options(const char *sb_mountdata, · 175 unmodified lines
176176 }
177177 }
178178
179− rc = dns_resolve_server_name_to_ip(name, &srvIP);
179+ rc = dns_resolve_server_name_to_ip(name, &srvIP, NULL);
180180 if (rc < 0) {
181181 cifs_dbg(FYI, "%s: Failed to resolve server part of %s to IP: %d\n",
182182 __func__, name, rc);
@@ -211,6 +211,10 @@ char *cifs_compose_mount_options(const char *sb_mountdata, · 28 unmodified lines
211211 else
212212 noff = tkn_e - (sb_mountdata + off) + 1;
213213
214+ if (strncasecmp(sb_mountdata + off, "cruid=", 6) == 0) {
215+ off += noff;
216+ continue;
217+ }
214218 if (strncasecmp(sb_mountdata + off, "unc=", 4) == 0) {
215219 off += noff;
216220 continue;
fs/cifs/cifsglob.h+7−0
@@ -75,6 +75,9 @@ · 74 unmodified lines
7575 #define SMB_ECHO_INTERVAL_MAX 600
7676 #define SMB_ECHO_INTERVAL_DEFAULT 60
7777
78+/* dns resolution interval in seconds */
79+#define SMB_DNS_RESOLVE_INTERVAL_DEFAULT 600
80+
7881 /* maximum number of PDUs in one compound */
7982 #define MAX_COMPOUND 5
8083
@@ -646,6 +649,7 @@ struct TCP_Server_Info { · 565 unmodified lines
646649 /* point to the SMBD connection if RDMA is used instead of socket */
647650 struct smbd_connection *smbd_conn;
648651 struct delayed_work echo; /* echo ping workqueue job */
652+ struct delayed_work resolve; /* dns resolution workqueue job */
649653 char *smallbuf; /* pointer to current "small" buffer */
650654 char *bigbuf; /* pointer to current "big" buffer */
651655 /* Total size of this PDU. Only valid from cifs_demultiplex_thread */
@@ -689,6 +693,9 @@ struct TCP_Server_Info { · 37 unmodified lines
689693 bool use_swn_dstaddr;
690694 struct sockaddr_storage swn_dstaddr;
691695 #endif
696+#ifdef CONFIG_CIFS_DFS_UPCALL
697+ bool is_dfs_conn; /* if a dfs connection */
698+#endif
692699 };
693700
694701 struct cifs_credits {
fs/cifs/connect.c+99−11
@@ -78,6 +78,8 @@ static int reconn_set_ipaddr_from_hostname(struct TCP_Server_Info *server) · 77 unmodified lines
7878 int rc;
7979 int len;
8080 char *unc, *ipaddr = NULL;
81+ time64_t expiry, now;
82+ unsigned long ttl = SMB_DNS_RESOLVE_INTERVAL_DEFAULT;
8183
8284 if (!server->hostname)
8385 return -EINVAL;
@@ -91,13 +93,13 @@ static int reconn_set_ipaddr_from_hostname(struct TCP_Server_Info *server) · 7 unmodified lines
9193 }
9294 scnprintf(unc, len, "\\\\%s", server->hostname);
9395
94− rc = dns_resolve_server_name_to_ip(unc, &ipaddr);
96+ rc = dns_resolve_server_name_to_ip(unc, &ipaddr, &expiry);
9597 kfree(unc);
9698
9799 if (rc < 0) {
98100 cifs_dbg(FYI, "%s: failed to resolve server part of %s to IP: %d\n",
99101 __func__, server->hostname, rc);
100− return rc;
102+ goto requeue_resolve;
101103 }
102104
103105 spin_lock(&cifs_tcp_ses_lock);
@@ -106,7 +108,45 @@ static int reconn_set_ipaddr_from_hostname(struct TCP_Server_Info *server) · 2 unmodified lines
106108 spin_unlock(&cifs_tcp_ses_lock);
107109 kfree(ipaddr);
108110
109− return !rc ? -1 : 0;
111+ /* rc == 1 means success here */
112+ if (rc) {
113+ now = ktime_get_real_seconds();
114+ if (expiry && expiry > now)
115+ /*
116+ * To make sure we don't use the cached entry, retry 1s
117+ * after expiry.
118+ */
119+ ttl = (expiry - now + 1);
120+ }
121+ rc = !rc ? -1 : 0;
122+
123+requeue_resolve:
124+ cifs_dbg(FYI, "%s: next dns resolution scheduled for %lu seconds in the future\n",
125+ __func__, ttl);
126+ mod_delayed_work(cifsiod_wq, &server->resolve, (ttl * HZ));
127+
128+ return rc;
129+}
130+
131+
132+static void cifs_resolve_server(struct work_struct *work)
133+{
134+ int rc;
135+ struct TCP_Server_Info *server = container_of(work,
136+ struct TCP_Server_Info, resolve.work);
137+
138+ mutex_lock(&server->srv_mutex);
139+
140+ /*
141+ * Resolve the hostname again to make sure that IP address is up-to-date.
142+ */
143+ rc = reconn_set_ipaddr_from_hostname(server);
144+ if (rc) {
145+ cifs_dbg(FYI, "%s: failed to resolve hostname: %d\n",
146+ __func__, rc);
147+ }
148+
149+ mutex_unlock(&server->srv_mutex);
110150 }
111151
112152 #ifdef CONFIG_CIFS_DFS_UPCALL
@@ -680,6 +720,7 @@ static void clean_demultiplex_info(struct TCP_Server_Info *server) · 567 unmodified lines
680720 spin_unlock(&cifs_tcp_ses_lock);
681721
682722 cancel_delayed_work_sync(&server->echo);
723+ cancel_delayed_work_sync(&server->resolve);
683724
684725 spin_lock(&GlobalMid_Lock);
685726 server->tcpStatus = CifsExiting;
@@ -1227,6 +1268,16 @@ cifs_find_tcp_session(struct smb3_fs_context *ctx) · 541 unmodified lines
12271268
12281269 spin_lock(&cifs_tcp_ses_lock);
12291270 list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {
1271+#ifdef CONFIG_CIFS_DFS_UPCALL
1272+ /*
1273+ * DFS failover implementation in cifs_reconnect() requires unique tcp sessions for
1274+ * DFS connections to do failover properly, so avoid sharing them with regular
1275+ * shares or even links that may connect to same server but having completely
1276+ * different failover targets.
1277+ */
1278+ if (server->is_dfs_conn)
1279+ continue;
1280+#endif
12301281 /*
12311282 * Skip ses channels since they're only handled in lower layers
12321283 * (e.g. cifs_send_recv).
@@ -1254,12 +1305,16 @@ cifs_put_tcp_session(struct TCP_Server_Info *server, int from_reconnect) · 21 unmodified lines
12541305 return;
12551306 }
12561307
1308+ /* srv_count can never go negative */
1309+ WARN_ON(server->srv_count < 0);
1310+
12571311 put_net(cifs_net_ns(server));
12581312
12591313 list_del_init(&server->tcp_ses_list);
12601314 spin_unlock(&cifs_tcp_ses_lock);
12611315
12621316 cancel_delayed_work_sync(&server->echo);
1317+ cancel_delayed_work_sync(&server->resolve);
12631318
12641319 if (from_reconnect)
12651320 /*
@@ -1342,6 +1397,7 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx) · 76 unmodified lines
13421397 INIT_LIST_HEAD(&tcp_ses->tcp_ses_list);
13431398 INIT_LIST_HEAD(&tcp_ses->smb_ses_list);
13441399 INIT_DELAYED_WORK(&tcp_ses->echo, cifs_echo_request);
1400+ INIT_DELAYED_WORK(&tcp_ses->resolve, cifs_resolve_server);
13451401 INIT_DELAYED_WORK(&tcp_ses->reconnect, smb2_reconnect_server);
13461402 mutex_init(&tcp_ses->reconnect_mutex);
13471403 memcpy(&tcp_ses->srcaddr, &ctx->srcaddr,
@@ -1427,6 +1483,12 @@ smbd_connected: · 79 unmodified lines
14271483 /* queue echo request delayed work */
14281484 queue_delayed_work(cifsiod_wq, &tcp_ses->echo, tcp_ses->echo_interval);
14291485
1486+ /* queue dns resolution delayed work */
1487+ cifs_dbg(FYI, "%s: next dns resolution scheduled for %d seconds in the future\n",
1488+ __func__, SMB_DNS_RESOLVE_INTERVAL_DEFAULT);
1489+
1490+ queue_delayed_work(cifsiod_wq, &tcp_ses->resolve, (SMB_DNS_RESOLVE_INTERVAL_DEFAULT * HZ));
1491+
14301492 return tcp_ses;
14311493
14321494 out_err_crypto_release:
@@ -1605,6 +1667,9 @@ void cifs_put_smb_ses(struct cifs_ses *ses) · 172 unmodified lines
16051667 }
16061668 spin_unlock(&cifs_tcp_ses_lock);
16071669
1670+ /* ses_count can never go negative */
1671+ WARN_ON(ses->ses_count < 0);
1672+
16081673 spin_lock(&GlobalMid_Lock);
16091674 if (ses->status == CifsGood)
16101675 ses->status = CifsExiting;
@@ -1972,6 +2037,9 @@ cifs_put_tcon(struct cifs_tcon *tcon) · 361 unmodified lines
19722037 return;
19732038 }
19742039
2040+ /* tc_count can never go negative */
2041+ WARN_ON(tcon->tc_count < 0);
2042+
19752043 if (tcon->use_witness) {
19762044 int rc;
19772045
@@ -2910,6 +2978,23 @@ static int mount_setup_tlink(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses, · 932 unmodified lines
29102978 }
29112979
29122980 #ifdef CONFIG_CIFS_DFS_UPCALL
2981+static int mount_get_dfs_conns(struct smb3_fs_context *ctx, struct cifs_sb_info *cifs_sb,
2982+ unsigned int *xid, struct TCP_Server_Info **nserver,
2983+ struct cifs_ses **nses, struct cifs_tcon **ntcon)
2984+{
2985+ int rc;
2986+
2987+ ctx->nosharesock = true;
2988+ rc = mount_get_conns(ctx, cifs_sb, xid, nserver, nses, ntcon);
2989+ if (*nserver) {
2990+ cifs_dbg(FYI, "%s: marking tcp session as a dfs connection\n", __func__);
2991+ spin_lock(&cifs_tcp_ses_lock);
2992+ (*nserver)->is_dfs_conn = true;
2993+ spin_unlock(&cifs_tcp_ses_lock);
2994+ }
2995+ return rc;
2996+}
2997+
29132998 /*
29142999 * cifs_build_path_to_root returns full path to root when we do not have an
29153000 * existing connection (tcon)
@@ -3105,7 +3190,7 @@ static int do_dfs_failover(const char *path, const char *full_path, struct cifs_ · 189 unmodified lines
31053190 tmp_ctx.prepath);
31063191
31073192 mount_put_conns(cifs_sb, *xid, *server, *ses, *tcon);
3108− rc = mount_get_conns(&tmp_ctx, cifs_sb, xid, server, ses, tcon);
3193+ rc = mount_get_dfs_conns(&tmp_ctx, cifs_sb, xid, server, ses, tcon);
31093194 if (!rc || (*server && *ses)) {
31103195 /*
31113196 * We were able to connect to new target server. Update current context with
@@ -3404,7 +3489,12 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx) · 292 unmodified lines
34043489 goto error;
34053490 }
34063491
3407− ctx->nosharesock = true;
3492+ mount_put_conns(cifs_sb, xid, server, ses, tcon);
3493+ /*
3494+ * Ignore error check here because we may failover to other targets from cached a
3495+ * referral.
3496+ */
3497+ (void)mount_get_dfs_conns(ctx, cifs_sb, &xid, &server, &ses, &tcon);
34083498
34093499 /* Get path of DFS root */
34103500 ref_path = build_unc_path_to_root(ctx, cifs_sb, false);
@@ -3433,7 +3523,7 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx) · 22 unmodified lines
34333523 /* Connect to new DFS target only if we were redirected */
34343524 if (oldmnt != cifs_sb->ctx->mount_options) {
34353525 mount_put_conns(cifs_sb, xid, server, ses, tcon);
3436− rc = mount_get_conns(ctx, cifs_sb, &xid, &server, &ses, &tcon);
3526+ rc = mount_get_dfs_conns(ctx, cifs_sb, &xid, &server, &ses, &tcon);
34373527 }
34383528 if (rc && !server && !ses) {
34393529 /* Failed to connect. Try to connect to other targets in the referral. */
@@ -3459,7 +3549,7 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx) · 19 unmodified lines
34593549 rc = -ELOOP;
34603550 } while (rc == -EREMOTE);
34613551
3462− if (rc || !tcon)
3552+ if (rc || !tcon || !ses)
34633553 goto error;
34643554
34653555 kfree(ref_path);
@@ -4095,7 +4185,8 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru · 629 unmodified lines
40954185 if (!tree)
40964186 return -ENOMEM;
40974187
4098− if (!tcon->dfs_path) {
4188+ /* If it is not dfs or there was no cached dfs referral, then reconnect to same share */
4189+ if (!tcon->dfs_path || dfs_cache_noreq_find(tcon->dfs_path + 1, &ref, &tl)) {
40994190 if (tcon->ipc) {
41004191 scnprintf(tree, MAX_TREE_SIZE, "\\\\%s\\IPC$", server->hostname);
41014192 rc = ops->tree_connect(xid, tcon->ses, tree, tcon, nlsc);
@@ -4105,9 +4196,6 @@ int cifs_tree_connect(const unsigned int xid, struct cifs_tcon *tcon, const stru · 3 unmodified lines
41054196 goto out;
41064197 }
41074198
4108− rc = dfs_cache_noreq_find(tcon->dfs_path + 1, &ref, &tl);
4109− if (rc)
4110− goto out;
41114199 isroot = ref.server_type == DFS_TYPE_ROOT;
41124200 free_dfs_info_param(&ref);
41134201
fs/cifs/dns_resolve.c+6−4
@@ -24,6 +24,7 @@ · 23 unmodified lines
2424 * dns_resolve_server_name_to_ip - Resolve UNC server name to ip address.
2525 * @unc: UNC path specifying the server (with '/' as delimiter)
2626 * @ip_addr: Where to return the IP address.
27+ * @expiry: Where to return the expiry time for the dns record.
2728 *
2829 * The IP address will be returned in string form, and the caller is
2930 * responsible for freeing it.
@@ -31,7 +32,7 @@ · 1 unmodified line
3132 * Returns length of result on success, -ve on error.
3233 */
3334 int
34−dns_resolve_server_name_to_ip(const char *unc, char **ip_addr)
35+dns_resolve_server_name_to_ip(const char *unc, char **ip_addr, time64_t *expiry)
3536 {
3637 struct sockaddr_storage ss;
3738 const char *hostname, *sep;
@@ -66,13 +67,14 @@ dns_resolve_server_name_to_ip(const char *unc, char **ip_addr) · 28 unmodified lines
6667
6768 /* Perform the upcall */
6869 rc = dns_query(current->nsproxy->net_ns, NULL, hostname, len,
69− NULL, ip_addr, NULL, false);
70+ NULL, ip_addr, expiry, false);
7071 if (rc < 0)
7172 cifs_dbg(FYI, "%s: unable to resolve: %*.*s\n",
7273 __func__, len, len, hostname);
7374 else
74− cifs_dbg(FYI, "%s: resolved: %*.*s to %s\n",
75− __func__, len, len, hostname, *ip_addr);
75+ cifs_dbg(FYI, "%s: resolved: %*.*s to %s expiry %llu\n",
76+ __func__, len, len, hostname, *ip_addr,
77+ expiry ? (*expiry) : 0);
7678 return rc;
7779
7880 name_is_IP_address:
fs/cifs/dns_resolve.h+1−1
@@ -12,7 +12,7 @@ · 11 unmodified lines
1212 #define _DNS_RESOLVE_H
1313
1414 #ifdef __KERNEL__
15−extern int dns_resolve_server_name_to_ip(const char *unc, char **ip_addr);
15+extern int dns_resolve_server_name_to_ip(const char *unc, char **ip_addr, time64_t *expiry);
1616 #endif /* KERNEL */
1717
1818 #endif /* _DNS_RESOLVE_H */
fs/cifs/misc.c+1−1
@@ -1187,7 +1187,7 @@ int match_target_ip(struct TCP_Server_Info *server, · 1186 unmodified lines
11871187
11881188 cifs_dbg(FYI, "%s: target name: %s\n", __func__, target + 2);
11891189
1190− rc = dns_resolve_server_name_to_ip(target, &tip);
1190+ rc = dns_resolve_server_name_to_ip(target, &tip, NULL);
11911191 if (rc < 0)
11921192 goto out;
11931193
fs/cifs/smb2ops.c+4−2
@@ -557,8 +557,8 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf, · 556 unmodified lines
557557 p = buf;
558558 while (bytes_left >= sizeof(*p)) {
559559 info->speed = le64_to_cpu(p->LinkSpeed);
560− info->rdma_capable = le32_to_cpu(p->Capability & RDMA_CAPABLE);
561− info->rss_capable = le32_to_cpu(p->Capability & RSS_CAPABLE);
560+ info->rdma_capable = le32_to_cpu(p->Capability & RDMA_CAPABLE) ? 1 : 0;
561+ info->rss_capable = le32_to_cpu(p->Capability & RSS_CAPABLE) ? 1 : 0;
562562
563563 cifs_dbg(FYI, "%s: adding iface %zu\n", __func__, *iface_count);
564564 cifs_dbg(FYI, "%s: speed %zu bps\n", __func__, info->speed);
@@ -2910,6 +2910,8 @@ smb2_get_dfs_refer(const unsigned int xid, struct cifs_ses *ses, · 2345 unmodified lines
29102910 /* ipc tcons are not refcounted */
29112911 spin_lock(&cifs_tcp_ses_lock);
29122912 tcon->tc_count--;
2913+ /* tc_count can never go negative */
2914+ WARN_ON(tcon->tc_count < 0);
29132915 spin_unlock(&cifs_tcp_ses_lock);
29142916 }
29152917 kfree(utf16_path);
fs/cifs/smb2pdu.h+1−0
@@ -394,6 +394,7 @@ struct smb2_compression_capabilities_context { · 393 unmodified lines
394394 __u16 Padding;
395395 __u32 Flags;
396396 __le16 CompressionAlgorithms[3];
397+ __u16 Pad; /* Some servers require pad to DataLen multiple of 8 */
397398 /* Check if pad needed */
398399 } __packed;
399400
fs/configfs/file.c+22−7
@@ -91,7 +91,10 @@ static ssize_t configfs_read_iter(struct kiocb *iocb, struct iov_iter *to) · 90 unmodified lines
9191 }
9292 pr_debug("%s: count = %zd, pos = %lld, buf = %s\n",
9393 __func__, iov_iter_count(to), iocb->ki_pos, buffer->page);
94− retval = copy_to_iter(buffer->page, buffer->count, to);
94+ if (iocb->ki_pos >= buffer->count)
95+ goto out;
96+ retval = copy_to_iter(buffer->page + iocb->ki_pos,
97+ buffer->count - iocb->ki_pos, to);
9598 iocb->ki_pos += retval;
9699 if (retval == 0)
97100 retval = -EFAULT;
@@ -162,7 +165,10 @@ static ssize_t configfs_bin_read_iter(struct kiocb *iocb, struct iov_iter *to) · 64 unmodified lines
162165 buffer->needs_read_fill = 0;
163166 }
164167
165− retval = copy_to_iter(buffer->bin_buffer, buffer->bin_buffer_size, to);
168+ if (iocb->ki_pos >= buffer->bin_buffer_size)
169+ goto out;
170+ retval = copy_to_iter(buffer->bin_buffer + iocb->ki_pos,
171+ buffer->bin_buffer_size - iocb->ki_pos, to);
166172 iocb->ki_pos += retval;
167173 if (retval == 0)
168174 retval = -EFAULT;
@@ -171,21 +177,28 @@ out: · 2 unmodified lines
171177 return retval;
172178 }
173179
174−static int fill_write_buffer(struct configfs_buffer *buffer,
180+/* Fill [buffer, buffer + pos) with data coming from @from. */
181+static int fill_write_buffer(struct configfs_buffer *buffer, loff_t pos,
175182 struct iov_iter *from)
176183 {
184+ loff_t to_copy;
177185 int copied;
186+ u8 *to;
178187
179188 if (!buffer->page)
180189 buffer->page = (char *)__get_free_pages(GFP_KERNEL, 0);
181190 if (!buffer->page)
182191 return -ENOMEM;
183192
184− copied = copy_from_iter(buffer->page, SIMPLE_ATTR_SIZE - 1, from);
193+ to_copy = SIMPLE_ATTR_SIZE - 1 - pos;
194+ if (to_copy <= 0)
195+ return 0;
196+ to = buffer->page + pos;
197+ copied = copy_from_iter(to, to_copy, from);
185198 buffer->needs_read_fill = 1;
186199 /* if buf is assumed to contain a string, terminate it by \0,
187200 * so e.g. sscanf() can scan the string easily */
188− buffer->page[copied] = 0;
201+ to[copied] = 0;
189202 return copied ? : -EFAULT;
190203 }
191204
@@ -217,7 +230,7 @@ static ssize_t configfs_write_iter(struct kiocb *iocb, struct iov_iter *from) · 25 unmodified lines
217230 ssize_t len;
218231
219232 mutex_lock(&buffer->mutex);
220− len = fill_write_buffer(buffer, from);
233+ len = fill_write_buffer(buffer, iocb->ki_pos, from);
221234 if (len > 0)
222235 len = flush_write_buffer(file, buffer, len);
223236 if (len > 0)
@@ -272,7 +285,9 @@ static ssize_t configfs_bin_write_iter(struct kiocb *iocb, · 48 unmodified lines
272285 buffer->bin_buffer_size = end_offset;
273286 }
274287
275− len = copy_from_iter(buffer->bin_buffer, buffer->bin_buffer_size, from);
288+ len = copy_from_iter(buffer->bin_buffer + iocb->ki_pos,
289+ buffer->bin_buffer_size - iocb->ki_pos, from);
290+ iocb->ki_pos += len;
276291 out:
277292 mutex_unlock(&buffer->mutex);
278293 return len ? : -EFAULT;
fs/fcntl.c+1−1
@@ -369,8 +369,8 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned long arg, · 368 unmodified lines
369369 /* 32-bit arches must use fcntl64() */
370370 case F_OFD_SETLK:
371371 case F_OFD_SETLKW:
372−#endif
373372 fallthrough;
373+#endif
374374 case F_SETLK:
375375 case F_SETLKW:
376376 if (copy_from_user(&flock, argp, sizeof(flock)))
fs/hfs/bfind.c+13−1
@@ -25,7 +25,19 @@ int hfs_find_init(struct hfs_btree *tree, struct hfs_find_data *fd) · 24 unmodified lines
2525 fd->key = ptr + tree->max_key_len + 2;
2626 hfs_dbg(BNODE_REFS, "find_init: %d (%p)\n",
2727 tree->cnid, __builtin_return_address(0));
28− mutex_lock(&tree->tree_lock);
28+ switch (tree->cnid) {
29+ case HFS_CAT_CNID:
30+ mutex_lock_nested(&tree->tree_lock, CATALOG_BTREE_MUTEX);
31+ break;
32+ case HFS_EXT_CNID:
33+ mutex_lock_nested(&tree->tree_lock, EXTENTS_BTREE_MUTEX);
34+ break;
35+ case HFS_ATTR_CNID:
36+ mutex_lock_nested(&tree->tree_lock, ATTR_BTREE_MUTEX);
37+ break;
38+ default:
39+ return -EINVAL;
40+ }
2941 return 0;
3042 }
3143
fs/hfs/bnode.c+20−5
@@ -15,16 +15,31 @@ · 14 unmodified lines
1515
1616 #include "btree.h"
1717
18−void hfs_bnode_read(struct hfs_bnode *node, void *buf,
19− int off, int len)
18+void hfs_bnode_read(struct hfs_bnode *node, void *buf, int off, int len)
2019 {
2120 struct page *page;
21+ int pagenum;
22+ int bytes_read;
23+ int bytes_to_read;
24+ void *vaddr;
2225
2326 off += node->page_offset;
24− page = node->page[0];
27+ pagenum = off >> PAGE_SHIFT;
28+ off &= ~PAGE_MASK; /* compute page offset for the first page */
2529
26− memcpy(buf, kmap(page) + off, len);
27− kunmap(page);
30+ for (bytes_read = 0; bytes_read < len; bytes_read += bytes_to_read) {
31+ if (pagenum >= node->tree->pages_per_bnode)
32+ break;
33+ page = node->page[pagenum];
34+ bytes_to_read = min_t(int, len - bytes_read, PAGE_SIZE - off);
35+
36+ vaddr = kmap_atomic(page);
37+ memcpy(buf + bytes_read, vaddr + off, bytes_to_read);
38+ kunmap_atomic(vaddr);
39+
40+ pagenum++;
41+ off = 0; /* page offset only applies to the first page */
42+ }
2843 }
2944
3045 u16 hfs_bnode_read_u16(struct hfs_bnode *node, int off)
fs/hfs/btree.h+7−0
@@ -13,6 +13,13 @@ typedef int (*btree_keycmp)(const btree_key *, const btree_key *); · 12 unmodified lines
1313
1414 #define NODE_HASH_SIZE 256
1515
16+/* B-tree mutex nested subclasses */
17+enum hfs_btree_mutex_classes {
18+ CATALOG_BTREE_MUTEX,
19+ EXTENTS_BTREE_MUTEX,
20+ ATTR_BTREE_MUTEX,
21+};
22+
1623 /* A HFS BTree held in memory */
1724 struct hfs_btree {
1825 struct super_block *sb;
fs/hfs/super.c+5−5
@@ -420,14 +420,12 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent) · 419 unmodified lines
420420 if (!res) {
421421 if (fd.entrylength > sizeof(rec) || fd.entrylength < 0) {
422422 res = -EIO;
423− goto bail;
423+ goto bail_hfs_find;
424424 }
425425 hfs_bnode_read(fd.bnode, &rec, fd.entryoffset, fd.entrylength);
426426 }
427− if (res) {
428− hfs_find_exit(&fd);
429− goto bail_no_root;
430− }
427+ if (res)
428+ goto bail_hfs_find;
431429 res = -EINVAL;
432430 root_inode = hfs_iget(sb, &fd.search_key->cat, &rec);
433431 hfs_find_exit(&fd);
@@ -443,6 +441,8 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent) · 9 unmodified lines
443441 /* everything's okay */
444442 return 0;
445443
444+bail_hfs_find:
445+ hfs_find_exit(&fd);
446446 bail_no_root:
447447 pr_err("get root inode failed\n");
448448 bail:
fs/io_uring.c+5−3
@@ -2016,7 +2016,7 @@ static void io_req_task_submit(struct io_kiocb *req) · 2015 unmodified lines
20162016
20172017 /* ctx stays valid until unlock, even if we drop all ours ctx->refs */
20182018 mutex_lock(&ctx->uring_lock);
2019− if (!(current->flags & PF_EXITING) && !current->in_execve)
2019+ if (!(req->task->flags & PF_EXITING) && !req->task->in_execve)
20202020 __io_queue_sqe(req);
20212021 else
20222022 io_req_complete_failed(req, -EFAULT);
@@ -6019,11 +6019,13 @@ static bool io_drain_req(struct io_kiocb *req) · 3996 unmodified lines
60196019
60206020 ret = io_req_prep_async(req);
60216021 if (ret)
6022− return ret;
6022+ goto fail;
60236023 io_prep_async_link(req);
60246024 de = kmalloc(sizeof(*de), GFP_KERNEL);
60256025 if (!de) {
6026− io_req_complete_failed(req, -ENOMEM);
6026+ ret = -ENOMEM;
6027+fail:
6028+ io_req_complete_failed(req, ret);
60276029 return true;
60286030 }
60296031
fs/iomap/buffered-io.c+4−4
@@ -215,6 +215,7 @@ iomap_read_inline_data(struct inode *inode, struct page *page, · 214 unmodified lines
215215 if (PageUptodate(page))
216216 return;
217217
218+ BUG_ON(page_has_private(page));
218219 BUG_ON(page->index);
219220 BUG_ON(size > PAGE_SIZE - offset_in_page(iomap->inline_data));
220221
@@ -239,7 +240,7 @@ iomap_readpage_actor(struct inode *inode, loff_t pos, loff_t length, void *data, · 18 unmodified lines
239240 {
240241 struct iomap_readpage_ctx *ctx = data;
241242 struct page *page = ctx->cur_page;
242− struct iomap_page *iop = iomap_page_create(inode, page);
243+ struct iomap_page *iop;
243244 bool same_page = false, is_contig = false;
244245 loff_t orig_pos = pos;
245246 unsigned poff, plen;
@@ -252,6 +253,7 @@ iomap_readpage_actor(struct inode *inode, loff_t pos, loff_t length, void *data, · 6 unmodified lines
252253 }
253254
254255 /* zero post-eof blocks as the page may be mapped */
256+ iop = iomap_page_create(inode, page);
255257 iomap_adjust_read_range(inode, iop, &pos, length, &poff, &plen);
256258 if (plen == 0)
257259 goto done;
@@ -967,7 +969,6 @@ iomap_page_mkwrite_actor(struct inode *inode, loff_t pos, loff_t length, · 709 unmodified lines
967969 block_commit_write(page, 0, length);
968970 } else {
969971 WARN_ON_ONCE(!PageUptodate(page));
970− iomap_page_create(inode, page);
971972 set_page_dirty(page);
972973 }
973974
@@ -1304,14 +1305,13 @@ iomap_writepage_map(struct iomap_writepage_ctx *wpc, · 330 unmodified lines
13041305 struct writeback_control *wbc, struct inode *inode,
13051306 struct page *page, u64 end_offset)
13061307 {
1307− struct iomap_page *iop = to_iomap_page(page);
1308+ struct iomap_page *iop = iomap_page_create(inode, page);
13081309 struct iomap_ioend *ioend, *next;
13091310 unsigned len = i_blocksize(inode);
13101311 u64 file_offset; /* file offset of page */
13111312 int error = 0, count = 0, i;
13121313 LIST_HEAD(submit_list);
13131314
1314− WARN_ON_ONCE(i_blocks_per_page(inode, page) > 1 && !iop);
13151315 WARN_ON_ONCE(iop && atomic_read(&iop->write_bytes_pending) != 0);
13161316
13171317 /*
fs/iomap/seek.c+9−16
@@ -35,23 +35,20 @@ loff_t · 34 unmodified lines
3535 iomap_seek_hole(struct inode *inode, loff_t offset, const struct iomap_ops *ops)
3636 {
3737 loff_t size = i_size_read(inode);
38− loff_t length = size - offset;
3938 loff_t ret;
4039
4140 /* Nothing to be found before or beyond the end of the file. */
4241 if (offset < 0 || offset >= size)
4342 return -ENXIO;
4443
45− while (length > 0) {
46− ret = iomap_apply(inode, offset, length, IOMAP_REPORT, ops,
47− &offset, iomap_seek_hole_actor);
44+ while (offset < size) {
45+ ret = iomap_apply(inode, offset, size - offset, IOMAP_REPORT,
46+ ops, &offset, iomap_seek_hole_actor);
4847 if (ret < 0)
4948 return ret;
5049 if (ret == 0)
5150 break;
52−
5351 offset += ret;
54− length -= ret;
5552 }
5653
5754 return offset;
@@ -83,27 +80,23 @@ loff_t · 25 unmodified lines
8380 iomap_seek_data(struct inode *inode, loff_t offset, const struct iomap_ops *ops)
8481 {
8582 loff_t size = i_size_read(inode);
86− loff_t length = size - offset;
8783 loff_t ret;
8884
8985 /* Nothing to be found before or beyond the end of the file. */
9086 if (offset < 0 || offset >= size)
9187 return -ENXIO;
9288
93− while (length > 0) {
94− ret = iomap_apply(inode, offset, length, IOMAP_REPORT, ops,
95− &offset, iomap_seek_data_actor);
89+ while (offset < size) {
90+ ret = iomap_apply(inode, offset, size - offset, IOMAP_REPORT,
91+ ops, &offset, iomap_seek_data_actor);
9692 if (ret < 0)
9793 return ret;
9894 if (ret == 0)
99− break;
100−
95+ return offset;
10196 offset += ret;
102− length -= ret;
10397 }
10498
105− if (length <= 0)
106− return -ENXIO;
107− return offset;
99+ /* We've reached the end of the file without finding data */
100+ return -ENXIO;
108101 }
109102 EXPORT_SYMBOL_GPL(iomap_seek_data);
fs/seq_file.c+3−0
@@ -32,6 +32,9 @@ static void seq_set_overflow(struct seq_file *m) · 31 unmodified lines
3232
3333 static void *seq_buf_alloc(unsigned long size)
3434 {
35+ if (unlikely(size > MAX_RW_COUNT))
36+ return NULL;
37+
3538 return kvmalloc(size, GFP_KERNEL_ACCOUNT);
3639 }
3740
fs/xfs/libxfs/xfs_ag.c+8−0
@@ -803,6 +803,14 @@ xfs_ag_shrink_space( · 802 unmodified lines
803803
804804 args.fsbno = XFS_AGB_TO_FSB(mp, agno, aglen - delta);
805805
806+ /*
807+ * Make sure that the last inode cluster cannot overlap with the new
808+ * end of the AG, even if it's sparse.
809+ */
810+ error = xfs_ialloc_check_shrink(*tpp, agno, agibp, aglen - delta);
811+ if (error)
812+ return error;
813+
806814 /*
807815 * Disable perag reservations so it doesn't cause the allocation request
808816 * to fail. We'll reestablish reservation before we return.
fs/xfs/libxfs/xfs_attr.c+8−8
@@ -483,7 +483,7 @@ xfs_attr_set_iter( · 482 unmodified lines
483483 if (error)
484484 return error;
485485
486− /* fallthrough */
486+ fallthrough;
487487 case XFS_DAS_RM_LBLK:
488488 /* Set state in case xfs_attr_rmtval_remove returns -EAGAIN */
489489 dac->dela_state = XFS_DAS_RM_LBLK;
@@ -496,7 +496,7 @@ xfs_attr_set_iter( · 6 unmodified lines
496496 return -EAGAIN;
497497 }
498498
499− /* fallthrough */
499+ fallthrough;
500500 case XFS_DAS_RD_LEAF:
501501 /*
502502 * This is the last step for leaf format. Read the block with
@@ -528,7 +528,7 @@ xfs_attr_set_iter( · 25 unmodified lines
528528 return error;
529529 }
530530
531− /* fallthrough */
531+ fallthrough;
532532 case XFS_DAS_ALLOC_NODE:
533533 /*
534534 * If there was an out-of-line value, allocate the blocks we
@@ -590,7 +590,7 @@ xfs_attr_set_iter( · 55 unmodified lines
590590 if (error)
591591 return error;
592592
593− /* fallthrough */
593+ fallthrough;
594594 case XFS_DAS_RM_NBLK:
595595 /* Set state in case xfs_attr_rmtval_remove returns -EAGAIN */
596596 dac->dela_state = XFS_DAS_RM_NBLK;
@@ -603,7 +603,7 @@ xfs_attr_set_iter( · 6 unmodified lines
603603 return -EAGAIN;
604604 }
605605
606− /* fallthrough */
606+ fallthrough;
607607 case XFS_DAS_CLR_FLAG:
608608 /*
609609 * The last state for node format. Look up the old attr and
@@ -1406,7 +1406,7 @@ xfs_attr_remove_iter( · 796 unmodified lines
14061406 state = dac->da_state;
14071407 }
14081408
1409− /* fallthrough */
1409+ fallthrough;
14101410 case XFS_DAS_RMTBLK:
14111411 dac->dela_state = XFS_DAS_RMTBLK;
14121412
@@ -1441,7 +1441,7 @@ xfs_attr_remove_iter( · 28 unmodified lines
14411441 return -EAGAIN;
14421442 }
14431443
1444− /* fallthrough */
1444+ fallthrough;
14451445 case XFS_DAS_RM_NAME:
14461446 /*
14471447 * If we came here fresh from a transaction roll, reattach all
@@ -1469,7 +1469,7 @@ xfs_attr_remove_iter( · 21 unmodified lines
14691469 return -EAGAIN;
14701470 }
14711471
1472− /* fallthrough */
1472+ fallthrough;
14731473 case XFS_DAS_RM_SHRINK:
14741474 /*
14751475 * If the result is small enough, push it all into the inode.
fs/xfs/libxfs/xfs_ialloc.c+55−0
@@ -2928,3 +2928,58 @@ xfs_ialloc_calc_rootino( · 2927 unmodified lines
29282928
29292929 return XFS_AGINO_TO_INO(mp, 0, XFS_AGB_TO_AGINO(mp, first_bno));
29302930 }
2931+
2932+/*
2933+ * Ensure there are not sparse inode clusters that cross the new EOAG.
2934+ *
2935+ * This is a no-op for non-spinode filesystems since clusters are always fully
2936+ * allocated and checking the bnobt suffices. However, a spinode filesystem
2937+ * could have a record where the upper inodes are free blocks. If those blocks
2938+ * were removed from the filesystem, the inode record would extend beyond EOAG,
2939+ * which will be flagged as corruption.
2940+ */
2941+int
2942+xfs_ialloc_check_shrink(
2943+ struct xfs_trans *tp,
2944+ xfs_agnumber_t agno,
2945+ struct xfs_buf *agibp,
2946+ xfs_agblock_t new_length)
2947+{
2948+ struct xfs_inobt_rec_incore rec;
2949+ struct xfs_btree_cur *cur;
2950+ struct xfs_mount *mp = tp->t_mountp;
2951+ struct xfs_perag *pag;
2952+ xfs_agino_t agino = XFS_AGB_TO_AGINO(mp, new_length);
2953+ int has;
2954+ int error;
2955+
2956+ if (!xfs_sb_version_hassparseinodes(&mp->m_sb))
2957+ return 0;
2958+
2959+ pag = xfs_perag_get(mp, agno);
2960+ cur = xfs_inobt_init_cursor(mp, tp, agibp, pag, XFS_BTNUM_INO);
2961+
2962+ /* Look up the inobt record that would correspond to the new EOFS. */
2963+ error = xfs_inobt_lookup(cur, agino, XFS_LOOKUP_LE, &has);
2964+ if (error || !has)
2965+ goto out;
2966+
2967+ error = xfs_inobt_get_rec(cur, &rec, &has);
2968+ if (error)
2969+ goto out;
2970+
2971+ if (!has) {
2972+ error = -EFSCORRUPTED;
2973+ goto out;
2974+ }
2975+
2976+ /* If the record covers inodes that would be beyond EOFS, bail out. */
2977+ if (rec.ir_startino + XFS_INODES_PER_CHUNK > agino) {
2978+ error = -ENOSPC;
2979+ goto out;
2980+ }
2981+out:
2982+ xfs_btree_del_cursor(cur, error);
2983+ xfs_perag_put(pag);
2984+ return error;
2985+}
fs/xfs/libxfs/xfs_ialloc.h+3−0
@@ -122,4 +122,7 @@ int xfs_ialloc_cluster_alignment(struct xfs_mount *mp); · 121 unmodified lines
122122 void xfs_ialloc_setup_geometry(struct xfs_mount *mp);
123123 xfs_ino_t xfs_ialloc_calc_rootino(struct xfs_mount *mp, int sunit);
124124
125+int xfs_ialloc_check_shrink(struct xfs_trans *tp, xfs_agnumber_t agno,
126+ struct xfs_buf *agibp, xfs_agblock_t new_length);
127+
125128 #endif /* __XFS_IALLOC_H__ */
fs/xfs/libxfs/xfs_inode_buf.c+16−12
@@ -592,23 +592,27 @@ xfs_inode_validate_extsize( · 591 unmodified lines
592592 /*
593593 * This comment describes a historic gap in this verifier function.
594594 *
595− * On older kernels, the extent size hint verifier doesn't check that
596− * the extent size hint is an integer multiple of the realtime extent
597− * size on a directory with both RTINHERIT and EXTSZINHERIT flags set.
598− * The verifier has always enforced the alignment rule for regular
599− * files with the REALTIME flag set.
595+ * For a directory with both RTINHERIT and EXTSZINHERIT flags set, this
596+ * function has never checked that the extent size hint is an integer
597+ * multiple of the realtime extent size. Since we allow users to set
598+ * this combination on non-rt filesystems /and/ to change the rt
599+ * extent size when adding a rt device to a filesystem, the net effect
600+ * is that users can configure a filesystem anticipating one rt
601+ * geometry and change their minds later. Directories do not use the
602+ * extent size hint, so this is harmless for them.
600603 *
601604 * If a directory with a misaligned extent size hint is allowed to
602605 * propagate that hint into a new regular realtime file, the result
603606 * is that the inode cluster buffer verifier will trigger a corruption
604− * shutdown the next time it is run.
607+ * shutdown the next time it is run, because the verifier has always
608+ * enforced the alignment rule for regular files.
605609 *
606− * Unfortunately, there could be filesystems with these misconfigured
607− * directories in the wild, so we cannot add a check to this verifier
608− * at this time because that will result a new source of directory
609− * corruption errors when reading an existing filesystem. Instead, we
610− * permit the misconfiguration to pass through the verifiers so that
611− * callers of this function can correct and mitigate externally.
610+ * Because we allow administrators to set a new rt extent size when
611+ * adding a rt section, we cannot add a check to this verifier because
612+ * that will result a new source of directory corruption errors when
613+ * reading an existing filesystem. Instead, we rely on callers to
614+ * decide when alignment checks are appropriate, and fix things up as
615+ * needed.
612616 */
613617
614618 if (rt_flag)
fs/xfs/libxfs/xfs_trans_inode.c+4−6
@@ -143,16 +143,14 @@ xfs_trans_log_inode( · 142 unmodified lines
143143 }
144144
145145 /*
146− * Inode verifiers on older kernels don't check that the extent size
147− * hint is an integer multiple of the rt extent size on a directory
148− * with both rtinherit and extszinherit flags set. If we're logging a
149− * directory that is misconfigured in this way, clear the hint.
146+ * Inode verifiers do not check that the extent size hint is an integer
147+ * multiple of the rt extent size on a directory with both rtinherit
148+ * and extszinherit flags set. If we're logging a directory that is
149+ * misconfigured in this way, clear the hint.
150150 */
151151 if ((ip->i_diflags & XFS_DIFLAG_RTINHERIT) &&
152152 (ip->i_diflags & XFS_DIFLAG_EXTSZINHERIT) &&
153153 (ip->i_extsize % ip->i_mount->m_sb.sb_rextsize) > 0) {
154− xfs_info_once(ip->i_mount,
155− "Correcting misaligned extent size hint in inode 0x%llx.", ip->i_ino);
156154 ip->i_diflags &= ~(XFS_DIFLAG_EXTSIZE |
157155 XFS_DIFLAG_EXTSZINHERIT);
158156 ip->i_extsize = 0;
fs/xfs/scrub/inode.c+16−2
@@ -73,11 +73,25 @@ xchk_inode_extsize( · 72 unmodified lines
7373 uint16_t flags)
7474 {
7575 xfs_failaddr_t fa;
76+ uint32_t value = be32_to_cpu(dip->di_extsize);
7677
77− fa = xfs_inode_validate_extsize(sc->mp, be32_to_cpu(dip->di_extsize),
78− mode, flags);
78+ fa = xfs_inode_validate_extsize(sc->mp, value, mode, flags);
7979 if (fa)
8080 xchk_ino_set_corrupt(sc, ino);
81+
82+ /*
83+ * XFS allows a sysadmin to change the rt extent size when adding a rt
84+ * section to a filesystem after formatting. If there are any
85+ * directories with extszinherit and rtinherit set, the hint could
86+ * become misaligned with the new rextsize. The verifier doesn't check
87+ * this, because we allow rtinherit directories even without an rt
88+ * device. Flag this as an administrative warning since we will clean
89+ * this up eventually.
90+ */
91+ if ((flags & XFS_DIFLAG_RTINHERIT) &&
92+ (flags & XFS_DIFLAG_EXTSZINHERIT) &&
93+ value % sc->mp->m_sb.sb_rextsize > 0)
94+ xchk_ino_set_warning(sc, ino);
8195 }
8296
8397 /*
fs/xfs/xfs_inode.c+13−0
@@ -2763,6 +2763,19 @@ xfs_remove( · 2762 unmodified lines
27632763 error = xfs_droplink(tp, ip);
27642764 if (error)
27652765 goto out_trans_cancel;
2766+
2767+ /*
2768+ * Point the unlinked child directory's ".." entry to the root
2769+ * directory to eliminate back-references to inodes that may
2770+ * get freed before the child directory is closed. If the fs
2771+ * gets shrunk, this can lead to dirent inode validation errors.
2772+ */
2773+ if (dp->i_ino != tp->t_mountp->m_sb.sb_rootino) {
2774+ error = xfs_dir_replace(tp, ip, &xfs_name_dotdot,
2775+ tp->t_mountp->m_sb.sb_rootino, 0);
2776+ if (error)
2777+ return error;
2778+ }
27662779 } else {
27672780 /*
27682781 * When removing a non-directory we need to log the parent
fs/xfs/xfs_ioctl.c+22−5
@@ -1065,7 +1065,24 @@ xfs_fill_fsxattr( · 1064 unmodified lines
10651065
10661066 fileattr_fill_xflags(fa, xfs_ip2xflags(ip));
10671067
1068− fa->fsx_extsize = XFS_FSB_TO_B(mp, ip->i_extsize);
1068+ if (ip->i_diflags & XFS_DIFLAG_EXTSIZE) {
1069+ fa->fsx_extsize = XFS_FSB_TO_B(mp, ip->i_extsize);
1070+ } else if (ip->i_diflags & XFS_DIFLAG_EXTSZINHERIT) {
1071+ /*
1072+ * Don't let a misaligned extent size hint on a directory
1073+ * escape to userspace if it won't pass the setattr checks
1074+ * later.
1075+ */
1076+ if ((ip->i_diflags & XFS_DIFLAG_RTINHERIT) &&
1077+ ip->i_extsize % mp->m_sb.sb_rextsize > 0) {
1078+ fa->fsx_xflags &= ~(FS_XFLAG_EXTSIZE |
1079+ FS_XFLAG_EXTSZINHERIT);
1080+ fa->fsx_extsize = 0;
1081+ } else {
1082+ fa->fsx_extsize = XFS_FSB_TO_B(mp, ip->i_extsize);
1083+ }
1084+ }
1085+
10691086 if (ip->i_diflags2 & XFS_DIFLAG2_COWEXTSIZE)
10701087 fa->fsx_cowextsize = XFS_FSB_TO_B(mp, ip->i_cowextsize);
10711088 fa->fsx_projid = ip->i_projid;
@@ -1292,10 +1309,10 @@ xfs_ioctl_setattr_check_extsize( · 220 unmodified lines
12921309 new_diflags = xfs_flags2diflags(ip, fa->fsx_xflags);
12931310
12941311 /*
1295− * Inode verifiers on older kernels don't check that the extent size
1296− * hint is an integer multiple of the rt extent size on a directory
1297− * with both rtinherit and extszinherit flags set. Don't let sysadmins
1298− * misconfigure directories.
1312+ * Inode verifiers do not check that the extent size hint is an integer
1313+ * multiple of the rt extent size on a directory with both rtinherit
1314+ * and extszinherit flags set. Don't let sysadmins misconfigure
1315+ * directories.
12991316 */
13001317 if ((new_diflags & XFS_DIFLAG_RTINHERIT) &&
13011318 (new_diflags & XFS_DIFLAG_EXTSZINHERIT)) {
fs/xfs/xfs_rtalloc.c+37−12
@@ -923,16 +923,41 @@ xfs_growfs_rt( · 922 unmodified lines
923923 uint8_t *rsum_cache; /* old summary cache */
924924
925925 sbp = &mp->m_sb;
926− /*
927− * Initial error checking.
928− */
926+
929927 if (!capable(CAP_SYS_ADMIN))
930928 return -EPERM;
931− if (mp->m_rtdev_targp == NULL || mp->m_rbmip == NULL ||
932− (nrblocks = in->newblocks) <= sbp->sb_rblocks ||
933− (sbp->sb_rblocks && (in->extsize != sbp->sb_rextsize)))
929+
930+ /* Needs to have been mounted with an rt device. */
931+ if (!XFS_IS_REALTIME_MOUNT(mp))
932+ return -EINVAL;
933+ /*
934+ * Mount should fail if the rt bitmap/summary files don't load, but
935+ * we'll check anyway.
936+ */
937+ if (!mp->m_rbmip || !mp->m_rsumip)
938+ return -EINVAL;
939+
940+ /* Shrink not supported. */
941+ if (in->newblocks <= sbp->sb_rblocks)
942+ return -EINVAL;
943+
944+ /* Can only change rt extent size when adding rt volume. */
945+ if (sbp->sb_rblocks > 0 && in->extsize != sbp->sb_rextsize)
946+ return -EINVAL;
947+
948+ /* Range check the extent size. */
949+ if (XFS_FSB_TO_B(mp, in->extsize) > XFS_MAX_RTEXTSIZE ||
950+ XFS_FSB_TO_B(mp, in->extsize) < XFS_MIN_RTEXTSIZE)
934951 return -EINVAL;
935− if ((error = xfs_sb_validate_fsb_count(sbp, nrblocks)))
952+
953+ /* Unsupported realtime features. */
954+ if (xfs_sb_version_hasrmapbt(&mp->m_sb) ||
955+ xfs_sb_version_hasreflink(&mp->m_sb))
956+ return -EOPNOTSUPP;
957+
958+ nrblocks = in->newblocks;
959+ error = xfs_sb_validate_fsb_count(sbp, nrblocks);
960+ if (error)
936961 return error;
937962 /*
938963 * Read in the last block of the device, make sure it exists.
@@ -996,7 +1021,8 @@ xfs_growfs_rt( · 57 unmodified lines
9961021 ((sbp->sb_rextents & ((1 << mp->m_blkbit_log) - 1)) != 0);
9971022 bmbno < nrbmblocks;
9981023 bmbno++) {
999− xfs_trans_t *tp;
1024+ struct xfs_trans *tp;
1025+ xfs_rfsblock_t nrblocks_step;
10001026
10011027 *nmp = *mp;
10021028 nsbp = &nmp->m_sb;
@@ -1005,10 +1031,9 @@ xfs_growfs_rt( · 2 unmodified lines
10051031 */
10061032 nsbp->sb_rextsize = in->extsize;
10071033 nsbp->sb_rbmblocks = bmbno + 1;
1008− nsbp->sb_rblocks =
1009− XFS_RTMIN(nrblocks,
1010− nsbp->sb_rbmblocks * NBBY *
1011− nsbp->sb_blocksize * nsbp->sb_rextsize);
1034+ nrblocks_step = (bmbno + 1) * NBBY * nsbp->sb_blocksize *
1035+ nsbp->sb_rextsize;
1036+ nsbp->sb_rblocks = min(nrblocks, nrblocks_step);
10121037 nsbp->sb_rextents = nsbp->sb_rblocks;
10131038 do_div(nsbp->sb_rextents, nsbp->sb_rextsize);
10141039 ASSERT(nsbp->sb_rextents != 0);
fs/zonefs/super.c+0−3
@@ -705,9 +705,6 @@ static ssize_t zonefs_file_dio_append(struct kiocb *iocb, struct iov_iter *from) · 704 unmodified lines
705705 return 0;
706706
707707 bio = bio_alloc(GFP_NOFS, nr_pages);
708− if (!bio)
709− return -ENOMEM;
710−
711708 bio_set_dev(bio, bdev);
712709 bio->bi_iter.bi_sector = zi->i_zsector;
713710 bio->bi_write_hint = iocb->ki_hint;
include/dt-bindings/clock/r9a07g044-cpg.h+183−53
@@ -32,58 +32,188 @@ · 31 unmodified lines
3232 #define R9A07G044_OSCCLK 21
3333
3434 /* R9A07G044 Module Clocks */
35−#define R9A07G044_CLK_GIC600 0
36−#define R9A07G044_CLK_IA55 1
37−#define R9A07G044_CLK_SYC 2
38−#define R9A07G044_CLK_DMAC 3
39−#define R9A07G044_CLK_SYSC 4
40−#define R9A07G044_CLK_MTU 5
41−#define R9A07G044_CLK_GPT 6
42−#define R9A07G044_CLK_ETH0 7
43−#define R9A07G044_CLK_ETH1 8
44−#define R9A07G044_CLK_I2C0 9
45−#define R9A07G044_CLK_I2C1 10
46−#define R9A07G044_CLK_I2C2 11
47−#define R9A07G044_CLK_I2C3 12
48−#define R9A07G044_CLK_SCIF0 13
49−#define R9A07G044_CLK_SCIF1 14
50−#define R9A07G044_CLK_SCIF2 15
51−#define R9A07G044_CLK_SCIF3 16
52−#define R9A07G044_CLK_SCIF4 17
53−#define R9A07G044_CLK_SCI0 18
54−#define R9A07G044_CLK_SCI1 19
55−#define R9A07G044_CLK_GPIO 20
56−#define R9A07G044_CLK_SDHI0 21
57−#define R9A07G044_CLK_SDHI1 22
58−#define R9A07G044_CLK_USB0 23
59−#define R9A07G044_CLK_USB1 24
60−#define R9A07G044_CLK_CANFD 25
61−#define R9A07G044_CLK_SSI0 26
62−#define R9A07G044_CLK_SSI1 27
63−#define R9A07G044_CLK_SSI2 28
64−#define R9A07G044_CLK_SSI3 29
65−#define R9A07G044_CLK_MHU 30
66−#define R9A07G044_CLK_OSTM0 31
67−#define R9A07G044_CLK_OSTM1 32
68−#define R9A07G044_CLK_OSTM2 33
69−#define R9A07G044_CLK_WDT0 34
70−#define R9A07G044_CLK_WDT1 35
71−#define R9A07G044_CLK_WDT2 36
72−#define R9A07G044_CLK_WDT_PON 37
73−#define R9A07G044_CLK_GPU 38
74−#define R9A07G044_CLK_ISU 39
75−#define R9A07G044_CLK_H264 40
76−#define R9A07G044_CLK_CRU 41
77−#define R9A07G044_CLK_MIPI_DSI 42
78−#define R9A07G044_CLK_LCDC 43
79−#define R9A07G044_CLK_SRC 44
80−#define R9A07G044_CLK_RSPI0 45
81−#define R9A07G044_CLK_RSPI1 46
82−#define R9A07G044_CLK_RSPI2 47
83−#define R9A07G044_CLK_ADC 48
84−#define R9A07G044_CLK_TSU_PCLK 49
85−#define R9A07G044_CLK_SPI 50
86−#define R9A07G044_CLK_MIPI_DSI_V 51
87−#define R9A07G044_CLK_MIPI_DSI_PIN 52
35+#define R9A07G044_CA55_SCLK 0
36+#define R9A07G044_CA55_PCLK 1
37+#define R9A07G044_CA55_ATCLK 2
38+#define R9A07G044_CA55_GICCLK 3
39+#define R9A07G044_CA55_PERICLK 4
40+#define R9A07G044_CA55_ACLK 5
41+#define R9A07G044_CA55_TSCLK 6
42+#define R9A07G044_GIC600_GICCLK 7
43+#define R9A07G044_IA55_CLK 8
44+#define R9A07G044_IA55_PCLK 9
45+#define R9A07G044_MHU_PCLK 10
46+#define R9A07G044_SYC_CNT_CLK 11
47+#define R9A07G044_DMAC_ACLK 12
48+#define R9A07G044_DMAC_PCLK 13
49+#define R9A07G044_OSTM0_PCLK 14
50+#define R9A07G044_OSTM1_PCLK 15
51+#define R9A07G044_OSTM2_PCLK 16
52+#define R9A07G044_MTU_X_MCK_MTU3 17
53+#define R9A07G044_POE3_CLKM_POE 18
54+#define R9A07G044_GPT_PCLK 19
55+#define R9A07G044_POEG_A_CLKP 20
56+#define R9A07G044_POEG_B_CLKP 21
57+#define R9A07G044_POEG_C_CLKP 22
58+#define R9A07G044_POEG_D_CLKP 23
59+#define R9A07G044_WDT0_PCLK 24
60+#define R9A07G044_WDT0_CLK 25
61+#define R9A07G044_WDT1_PCLK 26
62+#define R9A07G044_WDT1_CLK 27
63+#define R9A07G044_WDT2_PCLK 28
64+#define R9A07G044_WDT2_CLK 29
65+#define R9A07G044_SPI_CLK2 30
66+#define R9A07G044_SPI_CLK 31
67+#define R9A07G044_SDHI0_IMCLK 32
68+#define R9A07G044_SDHI0_IMCLK2 33
69+#define R9A07G044_SDHI0_CLK_HS 34
70+#define R9A07G044_SDHI0_ACLK 35
71+#define R9A07G044_SDHI1_IMCLK 36
72+#define R9A07G044_SDHI1_IMCLK2 37
73+#define R9A07G044_SDHI1_CLK_HS 38
74+#define R9A07G044_SDHI1_ACLK 39
75+#define R9A07G044_GPU_CLK 40
76+#define R9A07G044_GPU_AXI_CLK 41
77+#define R9A07G044_GPU_ACE_CLK 42
78+#define R9A07G044_ISU_ACLK 43
79+#define R9A07G044_ISU_PCLK 44
80+#define R9A07G044_H264_CLK_A 45
81+#define R9A07G044_H264_CLK_P 46
82+#define R9A07G044_CRU_SYSCLK 47
83+#define R9A07G044_CRU_VCLK 48
84+#define R9A07G044_CRU_PCLK 49
85+#define R9A07G044_CRU_ACLK 50
86+#define R9A07G044_MIPI_DSI_PLLCLK 51
87+#define R9A07G044_MIPI_DSI_SYSCLK 52
88+#define R9A07G044_MIPI_DSI_ACLK 53
89+#define R9A07G044_MIPI_DSI_PCLK 54
90+#define R9A07G044_MIPI_DSI_VCLK 55
91+#define R9A07G044_MIPI_DSI_LPCLK 56
92+#define R9A07G044_LCDC_CLK_A 57
93+#define R9A07G044_LCDC_CLK_P 58
94+#define R9A07G044_LCDC_CLK_D 59
95+#define R9A07G044_SSI0_PCLK2 60
96+#define R9A07G044_SSI0_PCLK_SFR 61
97+#define R9A07G044_SSI1_PCLK2 62
98+#define R9A07G044_SSI1_PCLK_SFR 63
99+#define R9A07G044_SSI2_PCLK2 64
100+#define R9A07G044_SSI2_PCLK_SFR 65
101+#define R9A07G044_SSI3_PCLK2 66
102+#define R9A07G044_SSI3_PCLK_SFR 67
103+#define R9A07G044_SRC_CLKP 68
104+#define R9A07G044_USB_U2H0_HCLK 69
105+#define R9A07G044_USB_U2H1_HCLK 70
106+#define R9A07G044_USB_U2P_EXR_CPUCLK 71
107+#define R9A07G044_USB_PCLK 72
108+#define R9A07G044_ETH0_CLK_AXI 73
109+#define R9A07G044_ETH0_CLK_CHI 74
110+#define R9A07G044_ETH1_CLK_AXI 75
111+#define R9A07G044_ETH1_CLK_CHI 76
112+#define R9A07G044_I2C0_PCLK 77
113+#define R9A07G044_I2C1_PCLK 78
114+#define R9A07G044_I2C2_PCLK 79
115+#define R9A07G044_I2C3_PCLK 80
116+#define R9A07G044_SCIF0_CLK_PCK 81
117+#define R9A07G044_SCIF1_CLK_PCK 82
118+#define R9A07G044_SCIF2_CLK_PCK 83
119+#define R9A07G044_SCIF3_CLK_PCK 84
120+#define R9A07G044_SCIF4_CLK_PCK 85
121+#define R9A07G044_SCI0_CLKP 86
122+#define R9A07G044_SCI1_CLKP 87
123+#define R9A07G044_IRDA_CLKP 88
124+#define R9A07G044_RSPI0_CLKB 89
125+#define R9A07G044_RSPI1_CLKB 90
126+#define R9A07G044_RSPI2_CLKB 91
127+#define R9A07G044_CANFD_PCLK 92
128+#define R9A07G044_GPIO_HCLK 93
129+#define R9A07G044_ADC_ADCLK 94
130+#define R9A07G044_ADC_PCLK 95
131+#define R9A07G044_TSU_PCLK 96
132+
133+/* R9A07G044 Resets */
134+#define R9A07G044_CA55_RST_1_0 0
135+#define R9A07G044_CA55_RST_1_1 1
136+#define R9A07G044_CA55_RST_3_0 2
137+#define R9A07G044_CA55_RST_3_1 3
138+#define R9A07G044_CA55_RST_4 4
139+#define R9A07G044_CA55_RST_5 5
140+#define R9A07G044_CA55_RST_6 6
141+#define R9A07G044_CA55_RST_7 7
142+#define R9A07G044_CA55_RST_8 8
143+#define R9A07G044_CA55_RST_9 9
144+#define R9A07G044_CA55_RST_10 10
145+#define R9A07G044_CA55_RST_11 11
146+#define R9A07G044_CA55_RST_12 12
147+#define R9A07G044_GIC600_GICRESET_N 13
148+#define R9A07G044_GIC600_DBG_GICRESET_N 14
149+#define R9A07G044_IA55_RESETN 15
150+#define R9A07G044_MHU_RESETN 16
151+#define R9A07G044_DMAC_ARESETN 17
152+#define R9A07G044_DMAC_RST_ASYNC 18
153+#define R9A07G044_SYC_RESETN 19
154+#define R9A07G044_OSTM0_PRESETZ 20
155+#define R9A07G044_OSTM1_PRESETZ 21
156+#define R9A07G044_OSTM2_PRESETZ 22
157+#define R9A07G044_MTU_X_PRESET_MTU3 23
158+#define R9A07G044_POE3_RST_M_REG 24
159+#define R9A07G044_GPT_RST_C 25
160+#define R9A07G044_POEG_A_RST 26
161+#define R9A07G044_POEG_B_RST 27
162+#define R9A07G044_POEG_C_RST 28
163+#define R9A07G044_POEG_D_RST 29
164+#define R9A07G044_WDT0_PRESETN 30
165+#define R9A07G044_WDT1_PRESETN 31
166+#define R9A07G044_WDT2_PRESETN 32
167+#define R9A07G044_SPI_RST 33
168+#define R9A07G044_SDHI0_IXRST 34
169+#define R9A07G044_SDHI1_IXRST 35
170+#define R9A07G044_GPU_RESETN 36
171+#define R9A07G044_GPU_AXI_RESETN 37
172+#define R9A07G044_GPU_ACE_RESETN 38
173+#define R9A07G044_ISU_ARESETN 39
174+#define R9A07G044_ISU_PRESETN 40
175+#define R9A07G044_H264_X_RESET_VCP 41
176+#define R9A07G044_H264_CP_PRESET_P 42
177+#define R9A07G044_CRU_CMN_RSTB 43
178+#define R9A07G044_CRU_PRESETN 44
179+#define R9A07G044_CRU_ARESETN 45
180+#define R9A07G044_MIPI_DSI_CMN_RSTB 46
181+#define R9A07G044_MIPI_DSI_ARESET_N 47
182+#define R9A07G044_MIPI_DSI_PRESET_N 48
183+#define R9A07G044_LCDC_RESET_N 49
184+#define R9A07G044_SSI0_RST_M2_REG 50
185+#define R9A07G044_SSI1_RST_M2_REG 51
186+#define R9A07G044_SSI2_RST_M2_REG 52
187+#define R9A07G044_SSI3_RST_M2_REG 53
188+#define R9A07G044_SRC_RST 54
189+#define R9A07G044_USB_U2H0_HRESETN 55
190+#define R9A07G044_USB_U2H1_HRESETN 56
191+#define R9A07G044_USB_U2P_EXL_SYSRST 57
192+#define R9A07G044_USB_PRESETN 58
193+#define R9A07G044_ETH0_RST_HW_N 59
194+#define R9A07G044_ETH1_RST_HW_N 60
195+#define R9A07G044_I2C0_MRST 61
196+#define R9A07G044_I2C1_MRST 62
197+#define R9A07G044_I2C2_MRST 63
198+#define R9A07G044_I2C3_MRST 64
199+#define R9A07G044_SCIF0_RST_SYSTEM_N 65
200+#define R9A07G044_SCIF1_RST_SYSTEM_N 66
201+#define R9A07G044_SCIF2_RST_SYSTEM_N 67
202+#define R9A07G044_SCIF3_RST_SYSTEM_N 68
203+#define R9A07G044_SCIF4_RST_SYSTEM_N 69
204+#define R9A07G044_SCI0_RST 70
205+#define R9A07G044_SCI1_RST 71
206+#define R9A07G044_IRDA_RST 72
207+#define R9A07G044_RSPI0_RST 73
208+#define R9A07G044_RSPI1_RST 74
209+#define R9A07G044_RSPI2_RST 75
210+#define R9A07G044_CANFD_RSTP_N 76
211+#define R9A07G044_CANFD_RSTC_N 77
212+#define R9A07G044_GPIO_RSTN 78
213+#define R9A07G044_GPIO_PORT_RESETN 79
214+#define R9A07G044_GPIO_SPARE_RESETN 80
215+#define R9A07G044_ADC_PRESETN 81
216+#define R9A07G044_ADC_ADRST_N 82
217+#define R9A07G044_TSU_PRESETN 83
88218
89219 #endif /* __DT_BINDINGS_CLOCK_R9A07G044_CPG_H__ */
include/linux/kasan.h+1−0
@@ -3,6 +3,7 @@ · 2 unmodified lines
33 #define _LINUX_KASAN_H
44
55 #include <linux/bug.h>
6+#include <linux/kernel.h>
67 #include <linux/static_key.h>
78 #include <linux/types.h>
89
include/linux/mfd/rt5033-private.h+2−2
@@ -200,13 +200,13 @@ enum rt5033_reg { · 199 unmodified lines
200200 #define RT5033_REGULATOR_BUCK_VOLTAGE_MIN 1000000U
201201 #define RT5033_REGULATOR_BUCK_VOLTAGE_MAX 3000000U
202202 #define RT5033_REGULATOR_BUCK_VOLTAGE_STEP 100000U
203−#define RT5033_REGULATOR_BUCK_VOLTAGE_STEP_NUM 32
203+#define RT5033_REGULATOR_BUCK_VOLTAGE_STEP_NUM 21
204204
205205 /* RT5033 regulator LDO output voltage uV */
206206 #define RT5033_REGULATOR_LDO_VOLTAGE_MIN 1200000U
207207 #define RT5033_REGULATOR_LDO_VOLTAGE_MAX 3000000U
208208 #define RT5033_REGULATOR_LDO_VOLTAGE_STEP 100000U
209−#define RT5033_REGULATOR_LDO_VOLTAGE_STEP_NUM 32
209+#define RT5033_REGULATOR_LDO_VOLTAGE_STEP_NUM 19
210210
211211 /* RT5033 regulator SAFE LDO output voltage uV */
212212 #define RT5033_REGULATOR_SAFE_LDO_VOLTAGE 4900000U
include/linux/pgtable.h+1−25
@@ -1397,34 +1397,10 @@ static inline int p4d_clear_huge(p4d_t *p4d) · 1396 unmodified lines
13971397 }
13981398 #endif /* !__PAGETABLE_P4D_FOLDED */
13991399
1400−#ifndef __PAGETABLE_PUD_FOLDED
14011400 int pud_set_huge(pud_t *pud, phys_addr_t addr, pgprot_t prot);
1402−int pud_clear_huge(pud_t *pud);
1403−#else
1404−static inline int pud_set_huge(pud_t *pud, phys_addr_t addr, pgprot_t prot)
1405−{
1406− return 0;
1407−}
1408−static inline int pud_clear_huge(pud_t *pud)
1409−{
1410− return 0;
1411−}
1412−#endif /* !__PAGETABLE_PUD_FOLDED */
1413−
1414−#ifndef __PAGETABLE_PMD_FOLDED
14151401 int pmd_set_huge(pmd_t *pmd, phys_addr_t addr, pgprot_t prot);
1402+int pud_clear_huge(pud_t *pud);
14161403 int pmd_clear_huge(pmd_t *pmd);
1417−#else
1418−static inline int pmd_set_huge(pmd_t *pmd, phys_addr_t addr, pgprot_t prot)
1419−{
1420− return 0;
1421−}
1422−static inline int pmd_clear_huge(pmd_t *pmd)
1423−{
1424− return 0;
1425−}
1426−#endif /* !__PAGETABLE_PMD_FOLDED */
1427−
14281404 int p4d_free_pud_page(p4d_t *p4d, unsigned long addr);
14291405 int pud_free_pmd_page(pud_t *pud, unsigned long addr);
14301406 int pmd_free_pte_page(pmd_t *pmd, unsigned long addr);
include/linux/rmap.h+3−1
@@ -291,7 +291,9 @@ static inline int page_referenced(struct page *page, int is_locked, · 290 unmodified lines
291291 return 0;
292292 }
293293
294−#define try_to_unmap(page, refs) false
294+static inline void try_to_unmap(struct page *page, enum ttu_flags flags)
295+{
296+}
295297
296298 static inline int page_mkclean(struct page *page)
297299 {
include/linux/scmi_protocol.h+9−5
@@ -101,6 +101,10 @@ struct scmi_clk_proto_ops { · 100 unmodified lines
101101 * to sustained performance level mapping
102102 * @est_power_get: gets the estimated power cost for a given performance domain
103103 * at a given frequency
104+ * @fast_switch_possible: indicates if fast DVFS switching is possible or not
105+ * for a given device
106+ * @power_scale_mw_get: indicates if the power values provided are in milliWatts
107+ * or in some other (abstract) scale
104108 */
105109 struct scmi_perf_proto_ops {
106110 int (*limits_set)(const struct scmi_protocol_handle *ph, u32 domain,
@@ -153,7 +157,7 @@ struct scmi_power_proto_ops { · 46 unmodified lines
153157 };
154158
155159 /**
156− * scmi_sensor_reading - represent a timestamped read
160+ * struct scmi_sensor_reading - represent a timestamped read
157161 *
158162 * Used by @reading_get_timestamped method.
159163 *
@@ -167,7 +171,7 @@ struct scmi_sensor_reading { · 7 unmodified lines
167171 };
168172
169173 /**
170− * scmi_range_attrs - specifies a sensor or axis values' range
174+ * struct scmi_range_attrs - specifies a sensor or axis values' range
171175 * @min_range: The minimum value which can be represented by the sensor/axis.
172176 * @max_range: The maximum value which can be represented by the sensor/axis.
173177 */
@@ -177,7 +181,7 @@ struct scmi_range_attrs { · 3 unmodified lines
177181 };
178182
179183 /**
180− * scmi_sensor_axis_info - describes one sensor axes
184+ * struct scmi_sensor_axis_info - describes one sensor axes
181185 * @id: The axes ID.
182186 * @type: Axes type. Chosen amongst one of @enum scmi_sensor_class.
183187 * @scale: Power-of-10 multiplier applied to the axis unit.
@@ -205,8 +209,8 @@ struct scmi_sensor_axis_info { · 21 unmodified lines
205209 };
206210
207211 /**
208− * scmi_sensor_intervals_info - describes number and type of available update
209− * intervals
212+ * struct scmi_sensor_intervals_info - describes number and type of available
213+ * update intervals
210214 * @segmented: Flag for segmented intervals' representation. When True there
211215 * will be exactly 3 intervals in @desc, with each entry
212216 * representing a member of a segment in this order:
include/linux/scpi_protocol.h+8−0
@@ -51,6 +51,14 @@ struct scpi_sensor_info { · 50 unmodified lines
5151 * OPP is an index to the list return by @dvfs_get_info
5252 * @dvfs_get_info: returns the DVFS capabilities of the given power
5353 * domain. It includes the OPP list and the latency information
54+ * @device_domain_id: gets the scpi domain id for a given device
55+ * @get_transition_latency: gets the DVFS transition latency for a given device
56+ * @add_opps_to_device: adds all the OPPs for a given device
57+ * @sensor_get_capability: get the list of capabilities for the sensors
58+ * @sensor_get_info: get the information of the specified sensor
59+ * @sensor_get_value: gets the current value of the sensor
60+ * @device_get_power_state: gets the power state of a power domain
61+ * @device_set_power_state: sets the power state of a power domain
5462 */
5563 struct scpi_ops {
5664 u32 (*get_version)(void);
include/math-emu/op-common.h+1−1
@@ -338,7 +338,7 @@ do { \ · 337 unmodified lines
338338 FP_SET_EXCEPTION(FP_EX_INVALID | FP_EX_INVALID_ISI); \
339339 break; \
340340 } \
341− /* FALLTHRU */ \
341+ fallthrough; \
342342 \
343343 case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NORMAL): \
344344 case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_ZERO): \
include/net/tcp.h+0−1
@@ -1709,7 +1709,6 @@ struct tcp_fastopen_context { · 1708 unmodified lines
17091709 struct rcu_head rcu;
17101710 };
17111711
1712−extern unsigned int sysctl_tcp_fastopen_blackhole_timeout;
17131712 void tcp_fastopen_active_disable(struct sock *sk);
17141713 bool tcp_fastopen_active_should_disable(struct sock *sk);
17151714 void tcp_fastopen_active_disable_ofo_check(struct sock *sk);
include/soc/tegra/mc.h+7−2
@@ -237,14 +237,19 @@ unsigned int tegra_mc_get_emem_device_count(struct tegra_mc *mc); · 236 unmodified lines
237237
238238 #ifdef CONFIG_TEGRA_MC
239239 struct tegra_mc *devm_tegra_memory_controller_get(struct device *dev);
240+int tegra_mc_probe_device(struct tegra_mc *mc, struct device *dev);
240241 #else
241242 static inline struct tegra_mc *
242243 devm_tegra_memory_controller_get(struct device *dev)
243244 {
244245 return ERR_PTR(-ENODEV);
245246 }
246−#endif
247247
248−int tegra_mc_probe_device(struct tegra_mc *mc, struct device *dev);
248+static inline int
249+tegra_mc_probe_device(struct tegra_mc *mc, struct device *dev)
250+{
251+ return -ENODEV;
252+}
253+#endif
249254
250255 #endif /* __SOC_TEGRA_MC_H__ */
include/trace/events/afs.h+62−5
@@ -174,6 +174,34 @@ enum afs_vl_operation { · 173 unmodified lines
174174 afs_VL_GetCapabilities = 65537, /* AFS Get VL server capabilities */
175175 };
176176
177+enum afs_cm_operation {
178+ afs_CB_CallBack = 204, /* AFS break callback promises */
179+ afs_CB_InitCallBackState = 205, /* AFS initialise callback state */
180+ afs_CB_Probe = 206, /* AFS probe client */
181+ afs_CB_GetLock = 207, /* AFS get contents of CM lock table */
182+ afs_CB_GetCE = 208, /* AFS get cache file description */
183+ afs_CB_GetXStatsVersion = 209, /* AFS get version of extended statistics */
184+ afs_CB_GetXStats = 210, /* AFS get contents of extended statistics data */
185+ afs_CB_InitCallBackState3 = 213, /* AFS initialise callback state, version 3 */
186+ afs_CB_ProbeUuid = 214, /* AFS check the client hasn't rebooted */
187+};
188+
189+enum yfs_cm_operation {
190+ yfs_CB_Probe = 206, /* YFS probe client */
191+ yfs_CB_GetLock = 207, /* YFS get contents of CM lock table */
192+ yfs_CB_XStatsVersion = 209, /* YFS get version of extended statistics */
193+ yfs_CB_GetXStats = 210, /* YFS get contents of extended statistics data */
194+ yfs_CB_InitCallBackState3 = 213, /* YFS initialise callback state, version 3 */
195+ yfs_CB_ProbeUuid = 214, /* YFS check the client hasn't rebooted */
196+ yfs_CB_GetServerPrefs = 215,
197+ yfs_CB_GetCellServDV = 216,
198+ yfs_CB_GetLocalCell = 217,
199+ yfs_CB_GetCacheConfig = 218,
200+ yfs_CB_GetCellByNum = 65537,
201+ yfs_CB_TellMeAboutYourself = 65538, /* get client capabilities */
202+ yfs_CB_CallBack = 64204,
203+};
204+
177205 enum afs_edit_dir_op {
178206 afs_edit_dir_create,
179207 afs_edit_dir_create_error,
@@ -436,6 +464,32 @@ enum afs_cb_break_reason { · 256 unmodified lines
436464 EM(afs_YFSVL_GetCellName, "YFSVL.GetCellName") \
437465 E_(afs_VL_GetCapabilities, "VL.GetCapabilities")
438466
467+#define afs_cm_operations \
468+ EM(afs_CB_CallBack, "CB.CallBack") \
469+ EM(afs_CB_InitCallBackState, "CB.InitCallBackState") \
470+ EM(afs_CB_Probe, "CB.Probe") \
471+ EM(afs_CB_GetLock, "CB.GetLock") \
472+ EM(afs_CB_GetCE, "CB.GetCE") \
473+ EM(afs_CB_GetXStatsVersion, "CB.GetXStatsVersion") \
474+ EM(afs_CB_GetXStats, "CB.GetXStats") \
475+ EM(afs_CB_InitCallBackState3, "CB.InitCallBackState3") \
476+ E_(afs_CB_ProbeUuid, "CB.ProbeUuid")
477+
478+#define yfs_cm_operations \
479+ EM(yfs_CB_Probe, "YFSCB.Probe") \
480+ EM(yfs_CB_GetLock, "YFSCB.GetLock") \
481+ EM(yfs_CB_XStatsVersion, "YFSCB.XStatsVersion") \
482+ EM(yfs_CB_GetXStats, "YFSCB.GetXStats") \
483+ EM(yfs_CB_InitCallBackState3, "YFSCB.InitCallBackState3") \
484+ EM(yfs_CB_ProbeUuid, "YFSCB.ProbeUuid") \
485+ EM(yfs_CB_GetServerPrefs, "YFSCB.GetServerPrefs") \
486+ EM(yfs_CB_GetCellServDV, "YFSCB.GetCellServDV") \
487+ EM(yfs_CB_GetLocalCell, "YFSCB.GetLocalCell") \
488+ EM(yfs_CB_GetCacheConfig, "YFSCB.GetCacheConfig") \
489+ EM(yfs_CB_GetCellByNum, "YFSCB.GetCellByNum") \
490+ EM(yfs_CB_TellMeAboutYourself, "YFSCB.TellMeAboutYourself") \
491+ E_(yfs_CB_CallBack, "YFSCB.CallBack")
492+
439493 #define afs_edit_dir_ops \
440494 EM(afs_edit_dir_create, "create") \
441495 EM(afs_edit_dir_create_error, "c_fail") \
@@ -569,6 +623,8 @@ afs_server_traces; · 127 unmodified lines
569623 afs_cell_traces;
570624 afs_fs_operations;
571625 afs_vl_operations;
626+afs_cm_operations;
627+yfs_cm_operations;
572628 afs_edit_dir_ops;
573629 afs_edit_dir_reasons;
574630 afs_eproto_causes;
@@ -649,20 +705,21 @@ TRACE_EVENT(afs_cb_call, · 74 unmodified lines
649705
650706 TP_STRUCT__entry(
651707 __field(unsigned int, call )
652− __field(const char *, name )
653708 __field(u32, op )
709+ __field(u16, service_id )
654710 ),
655711
656712 TP_fast_assign(
657713 __entry->call = call->debug_id;
658− __entry->name = call->type->name;
659714 __entry->op = call->operation_ID;
715+ __entry->service_id = call->service_id;
660716 ),
661717
662− TP_printk("c=%08x %s o=%u",
718+ TP_printk("c=%08x %s",
663719 __entry->call,
664− __entry->name,
665− __entry->op)
720+ __entry->service_id == 2501 ?
721+ __print_symbolic(__entry->op, yfs_cm_operations) :
722+ __print_symbolic(__entry->op, afs_cm_operations))
666723 );
667724
668725 TRACE_EVENT(afs_call,
include/trace/events/net.h+1−1
@@ -136,7 +136,7 @@ DECLARE_EVENT_CLASS(net_dev_template, · 135 unmodified lines
136136 __assign_str(name, skb->dev->name);
137137 ),
138138
139− TP_printk("dev=%s skbaddr=%p len=%u",
139+ TP_printk("dev=%s skbaddr=%px len=%u",
140140 __get_str(name), __entry->skbaddr, __entry->len)
141141 )
142142
include/trace/events/qdisc.h+27−1
@@ -41,11 +41,37 @@ TRACE_EVENT(qdisc_dequeue, · 40 unmodified lines
4141 __entry->txq_state = txq->state;
4242 ),
4343
44− TP_printk("dequeue ifindex=%d qdisc handle=0x%X parent=0x%X txq_state=0x%lX packets=%d skbaddr=%p",
44+ TP_printk("dequeue ifindex=%d qdisc handle=0x%X parent=0x%X txq_state=0x%lX packets=%d skbaddr=%px",
4545 __entry->ifindex, __entry->handle, __entry->parent,
4646 __entry->txq_state, __entry->packets, __entry->skbaddr )
4747 );
4848
49+TRACE_EVENT(qdisc_enqueue,
50+
51+ TP_PROTO(struct Qdisc *qdisc, const struct netdev_queue *txq, struct sk_buff *skb),
52+
53+ TP_ARGS(qdisc, txq, skb),
54+
55+ TP_STRUCT__entry(
56+ __field(struct Qdisc *, qdisc)
57+ __field(void *, skbaddr)
58+ __field(int, ifindex)
59+ __field(u32, handle)
60+ __field(u32, parent)
61+ ),
62+
63+ TP_fast_assign(
64+ __entry->qdisc = qdisc;
65+ __entry->skbaddr = skb;
66+ __entry->ifindex = txq->dev ? txq->dev->ifindex : 0;
67+ __entry->handle = qdisc->handle;
68+ __entry->parent = qdisc->parent;
69+ ),
70+
71+ TP_printk("enqueue ifindex=%d qdisc handle=0x%X parent=0x%X skbaddr=%px",
72+ __entry->ifindex, __entry->handle, __entry->parent, __entry->skbaddr)
73+);
74+
4975 TRACE_EVENT(qdisc_reset,
5076
5177 TP_PROTO(struct Qdisc *q),
init/Kconfig+0−1
@@ -1847,7 +1847,6 @@ config SLUB_DEBUG · 1846 unmodified lines
18471847 default y
18481848 bool "Enable SLUB debugging support" if EXPERT
18491849 depends on SLUB && SYSFS
1850− select STACKDEPOT if STACKTRACE_SUPPORT
18511850 help
18521851 SLUB has extensive debug support features. Disabling these can
18531852 result in significant savings in code size. This also disables
kernel/bpf/verifier.c+2−0
@@ -3754,6 +3754,8 @@ continue_func: · 3753 unmodified lines
37543754 if (tail_call_reachable)
37553755 for (j = 0; j < frame; j++)
37563756 subprog[ret_prog[j]].tail_call_reachable = true;
3757+ if (subprog[0].tail_call_reachable)
3758+ env->prog->aux->tail_call_reachable = true;
37573759
37583760 /* end of for() loop means the last insn of the 'subprog'
37593761 * was reached. Doesn't matter whether it was JA or EXIT
kernel/debug/gdbstub.c+1−1
@@ -1045,8 +1045,8 @@ int gdb_serial_stub(struct kgdb_state *ks) · 1044 unmodified lines
10451045 gdb_cmd_detachkill(ks);
10461046 return DBG_PASS_EVENT;
10471047 }
1048−#endif
10491048 fallthrough;
1049+#endif
10501050 case 'C': /* Exception passing */
10511051 tmp = gdb_cmd_exception_pass(ks);
10521052 if (tmp > 0)
kernel/rcu/refscale.c+3−3
@@ -487,13 +487,13 @@ ref_scale_reader(void *arg) · 486 unmodified lines
487487 s64 duration;
488488
489489 VERBOSE_SCALEOUT_BATCH("ref_scale_reader %ld: task started", me);
490− set_cpus_allowed_ptr(current, cpumask_of(me % nr_cpu_ids));
490+ WARN_ON_ONCE(set_cpus_allowed_ptr(current, cpumask_of(me % nr_cpu_ids)));
491491 set_user_nice(current, MAX_NICE);
492492 atomic_inc(&n_init);
493493 if (holdoff)
494494 schedule_timeout_interruptible(holdoff * HZ);
495495 repeat:
496− VERBOSE_SCALEOUT_BATCH("ref_scale_reader %ld: waiting to start next experiment on cpu %d", me, smp_processor_id());
496+ VERBOSE_SCALEOUT_BATCH("ref_scale_reader %ld: waiting to start next experiment on cpu %d", me, raw_smp_processor_id());
497497
498498 // Wait for signal that this reader can start.
499499 wait_event(rt->wq, (atomic_read(&nreaders_exp) && smp_load_acquire(&rt->start_reader)) ||
@@ -503,7 +503,7 @@ repeat: · 3 unmodified lines
503503 goto end;
504504
505505 // Make sure that the CPU is affinitized appropriately during testing.
506− WARN_ON_ONCE(smp_processor_id() != me);
506+ WARN_ON_ONCE(raw_smp_processor_id() != me);
507507
508508 WRITE_ONCE(rt->start_reader, 0);
509509 if (!atomic_dec_return(&n_started))
kernel/rcu/tasks.h+2−4
@@ -953,10 +953,9 @@ static bool trc_inspect_reader(struct task_struct *t, void *arg) · 952 unmodified lines
953953 in_qs = likely(!t->trc_reader_nesting);
954954 }
955955
956− // Mark as checked. Because this is called from the grace-period
957− // kthread, also remove the task from the holdout list.
956+ // Mark as checked so that the grace-period kthread will
957+ // remove it from the holdout list.
958958 t->trc_reader_checked = true;
959− trc_del_holdout(t);
960959
961960 if (in_qs)
962961 return true; // Already in quiescent state, done!!!
@@ -983,7 +982,6 @@ static void trc_wait_for_one_reader(struct task_struct *t, · 20 unmodified lines
983982 // The current task had better be in a quiescent state.
984983 if (t == current) {
985984 t->trc_reader_checked = true;
986− trc_del_holdout(t);
987985 WARN_ON_ONCE(t->trc_reader_nesting);
988986 return;
989987 }
kernel/rcu/tree_stall.h+2−2
@@ -795,9 +795,9 @@ void show_rcu_gp_kthreads(void) · 794 unmodified lines
795795 jr = j - data_race(rcu_state.gp_req_activity);
796796 js = j - data_race(rcu_state.gp_start);
797797 jw = j - data_race(rcu_state.gp_wake_time);
798− pr_info("%s: wait state: %s(%d) ->state: %#lx ->rt_priority %u delta ->gp_start %lu ->gp_activity %lu ->gp_req_activity %lu ->gp_wake_time %lu ->gp_wake_seq %ld ->gp_seq %ld ->gp_seq_needed %ld ->gp_max %lu ->gp_flags %#x\n",
798+ pr_info("%s: wait state: %s(%d) ->state: %#x ->rt_priority %u delta ->gp_start %lu ->gp_activity %lu ->gp_req_activity %lu ->gp_wake_time %lu ->gp_wake_seq %ld ->gp_seq %ld ->gp_seq_needed %ld ->gp_max %lu ->gp_flags %#x\n",
799799 rcu_state.name, gp_state_getname(rcu_state.gp_state),
800− rcu_state.gp_state, t ? t->__state : 0x1ffffL, t ? t->rt_priority : 0xffU,
800+ rcu_state.gp_state, t ? t->__state : 0x1ffff, t ? t->rt_priority : 0xffU,
801801 js, ja, jr, jw, (long)data_race(rcu_state.gp_wake_seq),
802802 (long)data_race(rcu_state.gp_seq),
803803 (long)data_race(rcu_get_root()->gp_seq_needed),
kernel/scftorture.c+3−3
@@ -405,15 +405,15 @@ static int scftorture_invoker(void *arg) · 404 unmodified lines
405405
406406 VERBOSE_SCFTORTOUT("scftorture_invoker %d: task started", scfp->cpu);
407407 cpu = scfp->cpu % nr_cpu_ids;
408− set_cpus_allowed_ptr(current, cpumask_of(cpu));
408+ WARN_ON_ONCE(set_cpus_allowed_ptr(current, cpumask_of(cpu)));
409409 set_user_nice(current, MAX_NICE);
410410 if (holdoff)
411411 schedule_timeout_interruptible(holdoff * HZ);
412412
413− VERBOSE_SCFTORTOUT("scftorture_invoker %d: Waiting for all SCF torturers from cpu %d", scfp->cpu, smp_processor_id());
413+ VERBOSE_SCFTORTOUT("scftorture_invoker %d: Waiting for all SCF torturers from cpu %d", scfp->cpu, raw_smp_processor_id());
414414
415415 // Make sure that the CPU is affinitized appropriately during testing.
416− curcpu = smp_processor_id();
416+ curcpu = raw_smp_processor_id();
417417 WARN_ONCE(curcpu != scfp->cpu % nr_cpu_ids,
418418 "%s: Wanted CPU %d, running on %d, nr_cpu_ids = %d\n",
419419 __func__, scfp->cpu, curcpu, nr_cpu_ids);
kernel/trace/trace_events_hist.c+3−3
@@ -1689,7 +1689,9 @@ static struct hist_field *create_hist_field(struct hist_trigger_data *hist_data, · 1688 unmodified lines
16891689 if (WARN_ON_ONCE(!field))
16901690 goto out;
16911691
1692− if (is_string_field(field)) {
1692+ /* Pointers to strings are just pointers and dangerous to dereference */
1693+ if (is_string_field(field) &&
1694+ (field->filter_type != FILTER_PTR_STRING)) {
16931695 flags |= HIST_FIELD_FL_STRING;
16941696
16951697 hist_field->size = MAX_FILTER_STR_VAL;
@@ -4495,8 +4497,6 @@ static inline void add_to_key(char *compound_key, void *key, · 2799 unmodified lines
44954497 field = key_field->field;
44964498 if (field->filter_type == FILTER_DYN_STRING)
44974499 size = *(u32 *)(rec + field->offset) >> 16;
4498− else if (field->filter_type == FILTER_PTR_STRING)
4499− size = strlen(key);
45004500 else if (field->filter_type == FILTER_STATIC_STRING)
45014501 size = field->size;
45024502
lib/test_hmm.c+0−2
@@ -628,10 +628,8 @@ static int dmirror_check_atomic(struct dmirror *dmirror, unsigned long start, · 627 unmodified lines
628628
629629 for (pfn = start >> PAGE_SHIFT; pfn < (end >> PAGE_SHIFT); pfn++) {
630630 void *entry;
631− struct page *page;
632631
633632 entry = xa_load(&dmirror->pt, pfn);
634− page = xa_untag_pointer(entry);
635633 if (xa_pointer_tag(entry) == DPT_XA_TAG_ATOMIC)
636634 return -EPERM;
637635 }
mm/hugetlb.c+3−2
@@ -5440,8 +5440,9 @@ long follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma, · 5439 unmodified lines
54405440 continue;
54415441 }
54425442
5443− refs = min3(pages_per_huge_page(h) - pfn_offset,
5444− (vma->vm_end - vaddr) >> PAGE_SHIFT, remainder);
5443+ /* vaddr may not be aligned to PAGE_SIZE */
5444+ refs = min3(pages_per_huge_page(h) - pfn_offset, remainder,
5445+ (vma->vm_end - ALIGN_DOWN(vaddr, PAGE_SIZE)) >> PAGE_SHIFT);
54455446
54465447 if (pages || vmas)
54475448 record_subpages_vmas(mem_map_offset(page, pfn_offset),
mm/kasan/kasan.h+12−0
@@ -9,6 +9,7 @@ · 8 unmodified lines
99 #ifdef CONFIG_KASAN_HW_TAGS
1010
1111 #include <linux/static_key.h>
12+#include "../slab.h"
1213
1314 DECLARE_STATIC_KEY_FALSE(kasan_flag_stacktrace);
1415 extern bool kasan_flag_async __ro_after_init;
@@ -387,6 +388,17 @@ static inline void kasan_unpoison(const void *addr, size_t size, bool init) · 372 unmodified lines
387388
388389 if (WARN_ON((unsigned long)addr & KASAN_GRANULE_MASK))
389390 return;
391+ /*
392+ * Explicitly initialize the memory with the precise object size to
393+ * avoid overwriting the SLAB redzone. This disables initialization in
394+ * the arch code and may thus lead to performance penalty. The penalty
395+ * is accepted since SLAB redzones aren't enabled in production builds.
396+ */
397+ if (__slub_debug_enabled() &&
398+ init && ((unsigned long)size & KASAN_GRANULE_MASK)) {
399+ init = false;
400+ memzero_explicit((void *)addr, size);
401+ }
390402 size = round_up(size, KASAN_GRANULE_SIZE);
391403
392404 hw_set_mem_tag_range((void *)addr, size, tag, init);
mm/page_alloc.c+21−7
@@ -3820,7 +3820,7 @@ static inline bool __should_fail_alloc_page(gfp_t gfp_mask, unsigned int order) · 3819 unmodified lines
38203820
38213821 #endif /* CONFIG_FAIL_PAGE_ALLOC */
38223822
3823−static noinline bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order)
3823+noinline bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order)
38243824 {
38253825 return __should_fail_alloc_page(gfp_mask, order);
38263826 }
@@ -5221,9 +5221,6 @@ unsigned long __alloc_pages_bulk(gfp_t gfp, int preferred_nid, · 1394 unmodified lines
52215221 unsigned int alloc_flags = ALLOC_WMARK_LOW;
52225222 int nr_populated = 0, nr_account = 0;
52235223
5224− if (unlikely(nr_pages <= 0))
5225− return 0;
5226−
52275224 /*
52285225 * Skip populated array elements to determine if any pages need
52295226 * to be allocated before disabling IRQs.
@@ -5231,19 +5228,35 @@ unsigned long __alloc_pages_bulk(gfp_t gfp, int preferred_nid, · 1 unmodified line
52315228 while (page_array && nr_populated < nr_pages && page_array[nr_populated])
52325229 nr_populated++;
52335230
5231+ /* No pages requested? */
5232+ if (unlikely(nr_pages <= 0))
5233+ goto out;
5234+
52345235 /* Already populated array? */
52355236 if (unlikely(page_array && nr_pages - nr_populated == 0))
5236− return nr_populated;
5237+ goto out;
52375238
52385239 /* Use the single page allocator for one page. */
52395240 if (nr_pages - nr_populated == 1)
52405241 goto failed;
52415242
5243+#ifdef CONFIG_PAGE_OWNER
5244+ /*
5245+ * PAGE_OWNER may recurse into the allocator to allocate space to
5246+ * save the stack with pagesets.lock held. Releasing/reacquiring
5247+ * removes much of the performance benefit of bulk allocation so
5248+ * force the caller to allocate one page at a time as it'll have
5249+ * similar performance to added complexity to the bulk allocator.
5250+ */
5251+ if (static_branch_unlikely(&page_owner_inited))
5252+ goto failed;
5253+#endif
5254+
52425255 /* May set ALLOC_NOFRAGMENT, fragmentation will return 1 page. */
52435256 gfp &= gfp_allowed_mask;
52445257 alloc_gfp = gfp;
52455258 if (!prepare_alloc_pages(gfp, 0, preferred_nid, nodemask, &ac, &alloc_gfp, &alloc_flags))
5246− return 0;
5259+ goto out;
52475260 gfp = alloc_gfp;
52485261
52495262 /* Find an allowed local zone that meets the low watermark. */
@@ -5311,6 +5324,7 @@ unsigned long __alloc_pages_bulk(gfp_t gfp, int preferred_nid, · 61 unmodified lines
53115324 __count_zid_vm_events(PGALLOC, zone_idx(zone), nr_account);
53125325 zone_statistics(ac.preferred_zoneref->zone, zone, nr_account);
53135326
5327+out:
53145328 return nr_populated;
53155329
53165330 failed_irq:
@@ -5326,7 +5340,7 @@ failed: · 9 unmodified lines
53265340 nr_populated++;
53275341 }
53285342
5329− return nr_populated;
5343+ goto out;
53305344 }
53315345 EXPORT_SYMBOL_GPL(__alloc_pages_bulk);
53325346
mm/slab.h+11−4
@@ -216,10 +216,18 @@ DECLARE_STATIC_KEY_FALSE(slub_debug_enabled); · 215 unmodified lines
216216 #endif
217217 extern void print_tracking(struct kmem_cache *s, void *object);
218218 long validate_slab_cache(struct kmem_cache *s);
219+static inline bool __slub_debug_enabled(void)
220+{
221+ return static_branch_unlikely(&slub_debug_enabled);
222+}
219223 #else
220224 static inline void print_tracking(struct kmem_cache *s, void *object)
221225 {
222226 }
227+static inline bool __slub_debug_enabled(void)
228+{
229+ return false;
230+}
223231 #endif
224232
225233 /*
@@ -229,11 +237,10 @@ static inline void print_tracking(struct kmem_cache *s, void *object) · 3 unmodified lines
229237 */
230238 static inline bool kmem_cache_debug_flags(struct kmem_cache *s, slab_flags_t flags)
231239 {
232−#ifdef CONFIG_SLUB_DEBUG
233− VM_WARN_ON_ONCE(!(flags & SLAB_DEBUG_FLAGS));
234− if (static_branch_unlikely(&slub_debug_enabled))
240+ if (IS_ENABLED(CONFIG_SLUB_DEBUG))
241+ VM_WARN_ON_ONCE(!(flags & SLAB_DEBUG_FLAGS));
242+ if (__slub_debug_enabled())
235243 return s->flags & flags;
236−#endif
237244 return false;
238245 }
239246
mm/slub.c+30−63
@@ -26,7 +26,6 @@ · 25 unmodified lines
2626 #include <linux/cpuset.h>
2727 #include <linux/mempolicy.h>
2828 #include <linux/ctype.h>
29−#include <linux/stackdepot.h>
3029 #include <linux/debugobjects.h>
3130 #include <linux/kallsyms.h>
3231 #include <linux/kfence.h>
@@ -120,25 +119,11 @@ · 87 unmodified lines
120119 */
121120
122121 #ifdef CONFIG_SLUB_DEBUG
123−
124122 #ifdef CONFIG_SLUB_DEBUG_ON
125123 DEFINE_STATIC_KEY_TRUE(slub_debug_enabled);
126124 #else
127125 DEFINE_STATIC_KEY_FALSE(slub_debug_enabled);
128126 #endif
129−
130−static inline bool __slub_debug_enabled(void)
131−{
132− return static_branch_unlikely(&slub_debug_enabled);
133−}
134−
135−#else /* CONFIG_SLUB_DEBUG */
136−
137−static inline bool __slub_debug_enabled(void)
138−{
139− return false;
140−}
141−
142127 #endif /* CONFIG_SLUB_DEBUG */
143128
144129 static inline bool kmem_cache_debug(struct kmem_cache *s)
@@ -221,8 +206,8 @@ static inline bool kmem_cache_has_cpu_partial(struct kmem_cache *s) · 76 unmodified lines
221206 #define TRACK_ADDRS_COUNT 16
222207 struct track {
223208 unsigned long addr; /* Called from address */
224−#ifdef CONFIG_STACKDEPOT
225− depot_stack_handle_t handle;
209+#ifdef CONFIG_STACKTRACE
210+ unsigned long addrs[TRACK_ADDRS_COUNT]; /* Called from address */
226211 #endif
227212 int cpu; /* Was running on cpu */
228213 int pid; /* Pid context */
@@ -626,27 +611,22 @@ static struct track *get_track(struct kmem_cache *s, void *object, · 397 unmodified lines
626611 return kasan_reset_tag(p + alloc);
627612 }
628613
629−#ifdef CONFIG_STACKDEPOT
630−static depot_stack_handle_t save_stack_depot_trace(gfp_t flags)
631−{
632− unsigned long entries[TRACK_ADDRS_COUNT];
633− depot_stack_handle_t handle;
634− unsigned int nr_entries;
635−
636− nr_entries = stack_trace_save(entries, ARRAY_SIZE(entries), 4);
637− handle = stack_depot_save(entries, nr_entries, flags);
638− return handle;
639−}
640−#endif
641−
642614 static void set_track(struct kmem_cache *s, void *object,
643615 enum track_item alloc, unsigned long addr)
644616 {
645617 struct track *p = get_track(s, object, alloc);
646618
647619 if (addr) {
648−#ifdef CONFIG_STACKDEPOT
649− p->handle = save_stack_depot_trace(GFP_NOWAIT);
620+#ifdef CONFIG_STACKTRACE
621+ unsigned int nr_entries;
622+
623+ metadata_access_enable();
624+ nr_entries = stack_trace_save(kasan_reset_tag(p->addrs),
625+ TRACK_ADDRS_COUNT, 3);
626+ metadata_access_disable();
627+
628+ if (nr_entries < TRACK_ADDRS_COUNT)
629+ p->addrs[nr_entries] = 0;
650630 #endif
651631 p->addr = addr;
652632 p->cpu = smp_processor_id();
@@ -673,19 +653,14 @@ static void print_track(const char *s, struct track *t, unsigned long pr_time) · 20 unmodified lines
673653
674654 pr_err("%s in %pS age=%lu cpu=%u pid=%d\n",
675655 s, (void *)t->addr, pr_time - t->when, t->cpu, t->pid);
676−#ifdef CONFIG_STACKDEPOT
656+#ifdef CONFIG_STACKTRACE
677657 {
678− depot_stack_handle_t handle;
679− unsigned long *entries;
680− unsigned int nr_entries;
681−
682− handle = READ_ONCE(t->handle);
683− if (!handle) {
684− pr_err("object allocation/free stack trace missing\n");
685− } else {
686− nr_entries = stack_depot_fetch(handle, &entries);
687− stack_trace_print(entries, nr_entries, 0);
688− }
658+ int i;
659+ for (i = 0; i < TRACK_ADDRS_COUNT; i++)
660+ if (t->addrs[i])
661+ pr_err("\t%pS\n", (void *)t->addrs[i]);
662+ else
663+ break;
689664 }
690665 #endif
691666 }
@@ -4059,26 +4034,18 @@ void kmem_obj_info(struct kmem_obj_info *kpp, void *object, struct page *page) · 3367 unmodified lines
40594034 objp = fixup_red_left(s, objp);
40604035 trackp = get_track(s, objp, TRACK_ALLOC);
40614036 kpp->kp_ret = (void *)trackp->addr;
4062−#ifdef CONFIG_STACKDEPOT
4063− {
4064− depot_stack_handle_t handle;
4065− unsigned long *entries;
4066− unsigned int nr_entries;
4067−
4068− handle = READ_ONCE(trackp->handle);
4069− if (handle) {
4070− nr_entries = stack_depot_fetch(handle, &entries);
4071− for (i = 0; i < KS_ADDRS_COUNT && i < nr_entries; i++)
4072− kpp->kp_stack[i] = (void *)entries[i];
4073− }
4037+#ifdef CONFIG_STACKTRACE
4038+ for (i = 0; i < KS_ADDRS_COUNT && i < TRACK_ADDRS_COUNT; i++) {
4039+ kpp->kp_stack[i] = (void *)trackp->addrs[i];
4040+ if (!kpp->kp_stack[i])
4041+ break;
4042+ }
40744043
4075− trackp = get_track(s, objp, TRACK_FREE);
4076− handle = READ_ONCE(trackp->handle);
4077− if (handle) {
4078− nr_entries = stack_depot_fetch(handle, &entries);
4079− for (i = 0; i < KS_ADDRS_COUNT && i < nr_entries; i++)
4080− kpp->kp_free_stack[i] = (void *)entries[i];
4081− }
4044+ trackp = get_track(s, objp, TRACK_FREE);
4045+ for (i = 0; i < KS_ADDRS_COUNT && i < TRACK_ADDRS_COUNT; i++) {
4046+ kpp->kp_free_stack[i] = (void *)trackp->addrs[i];
4047+ if (!kpp->kp_free_stack[i])
4048+ break;
40824049 }
40834050 #endif
40844051 #endif
net/bpf/test_run.c+5−0
@@ -761,6 +761,11 @@ int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr, · 760 unmodified lines
761761 void *data;
762762 int ret = -EINVAL;
763763
764+ if (prog->expected_attach_type == BPF_XDP_DEVMAP ||
765+ prog->expected_attach_type == BPF_XDP_CPUMAP)
766+ return -EINVAL;
767+ if (kattr->test.ctx_in || kattr->test.ctx_out)
768+ return -EINVAL;
764769 ctx = bpf_ctx_init(kattr, sizeof(struct xdp_md));
765770 if (IS_ERR(ctx))
766771 return PTR_ERR(ctx);
net/bridge/br_fdb.c+1−1
@@ -783,7 +783,7 @@ int br_fdb_replay(const struct net_device *br_dev, const struct net_device *dev, · 782 unmodified lines
783783 struct net_device *dst_dev;
784784
785785 dst_dev = dst ? dst->dev : br->dev;
786− if (dst_dev != br_dev && dst_dev != dev)
786+ if (dst_dev && dst_dev != dev)
787787 continue;
788788
789789 err = br_fdb_replay_one(nb, fdb, dst_dev, action, ctx);
net/caif/caif_socket.c+2−1
@@ -539,7 +539,8 @@ static int caif_seqpkt_sendmsg(struct socket *sock, struct msghdr *msg, · 538 unmodified lines
539539 goto err;
540540
541541 ret = -EINVAL;
542− if (unlikely(msg->msg_iter.iov->iov_base == NULL))
542+ if (unlikely(msg->msg_iter.nr_segs == 0) ||
543+ unlikely(msg->msg_iter.iov->iov_base == NULL))
543544 goto err;
544545 noblock = msg->msg_flags & MSG_DONTWAIT;
545546
net/core/dev.c+26−8
@@ -131,6 +131,7 @@ · 130 unmodified lines
131131 #include <trace/events/napi.h>
132132 #include <trace/events/net.h>
133133 #include <trace/events/skb.h>
134+#include <trace/events/qdisc.h>
134135 #include <linux/inetdevice.h>
135136 #include <linux/cpu_rmap.h>
136137 #include <linux/static_key.h>
@@ -3844,6 +3845,18 @@ static void qdisc_pkt_len_init(struct sk_buff *skb) · 3707 unmodified lines
38443845 }
38453846 }
38463847
3848+static int dev_qdisc_enqueue(struct sk_buff *skb, struct Qdisc *q,
3849+ struct sk_buff **to_free,
3850+ struct netdev_queue *txq)
3851+{
3852+ int rc;
3853+
3854+ rc = q->enqueue(skb, q, to_free) & NET_XMIT_MASK;
3855+ if (rc == NET_XMIT_SUCCESS)
3856+ trace_qdisc_enqueue(q, txq, skb);
3857+ return rc;
3858+}
3859+
38473860 static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q,
38483861 struct net_device *dev,
38493862 struct netdev_queue *txq)
@@ -3862,8 +3875,7 @@ static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q, · 12 unmodified lines
38623875 * of q->seqlock to protect from racing with requeuing.
38633876 */
38643877 if (unlikely(!nolock_qdisc_is_empty(q))) {
3865− rc = q->enqueue(skb, q, &to_free) &
3866− NET_XMIT_MASK;
3878+ rc = dev_qdisc_enqueue(skb, q, &to_free, txq);
38673879 __qdisc_run(q);
38683880 qdisc_run_end(q);
38693881
@@ -3879,7 +3891,7 @@ static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q, · 9 unmodified lines
38793891 return NET_XMIT_SUCCESS;
38803892 }
38813893
3882− rc = q->enqueue(skb, q, &to_free) & NET_XMIT_MASK;
3894+ rc = dev_qdisc_enqueue(skb, q, &to_free, txq);
38833895 qdisc_run(q);
38843896
38853897 no_lock_out:
@@ -3923,7 +3935,7 @@ no_lock_out: · 37 unmodified lines
39233935 qdisc_run_end(q);
39243936 rc = NET_XMIT_SUCCESS;
39253937 } else {
3926− rc = q->enqueue(skb, q, &to_free) & NET_XMIT_MASK;
3938+ rc = dev_qdisc_enqueue(skb, q, &to_free, txq);
39273939 if (qdisc_run_begin(q)) {
39283940 if (unlikely(contended)) {
39293941 spin_unlock(&q->busylock);
@@ -9703,14 +9715,17 @@ int bpf_xdp_link_attach(const union bpf_attr *attr, struct bpf_prog *prog) · 5773 unmodified lines
97039715 struct net_device *dev;
97049716 int err, fd;
97059717
9718+ rtnl_lock();
97069719 dev = dev_get_by_index(net, attr->link_create.target_ifindex);
9707− if (!dev)
9720+ if (!dev) {
9721+ rtnl_unlock();
97089722 return -EINVAL;
9723+ }
97099724
97109725 link = kzalloc(sizeof(*link), GFP_USER);
97119726 if (!link) {
97129727 err = -ENOMEM;
9713− goto out_put_dev;
9728+ goto unlock;
97149729 }
97159730
97169731 bpf_link_init(&link->link, BPF_LINK_TYPE_XDP, &bpf_xdp_link_lops, prog);
@@ -9720,14 +9735,14 @@ int bpf_xdp_link_attach(const union bpf_attr *attr, struct bpf_prog *prog) · 3 unmodified lines
97209735 err = bpf_link_prime(&link->link, &link_primer);
97219736 if (err) {
97229737 kfree(link);
9723− goto out_put_dev;
9738+ goto unlock;
97249739 }
97259740
9726− rtnl_lock();
97279741 err = dev_xdp_attach_link(dev, NULL, link);
97289742 rtnl_unlock();
97299743
97309744 if (err) {
9745+ link->dev = NULL;
97319746 bpf_link_cleanup(&link_primer);
97329747 goto out_put_dev;
97339748 }
@@ -9737,6 +9752,9 @@ int bpf_xdp_link_attach(const union bpf_attr *attr, struct bpf_prog *prog) · 3 unmodified lines
97379752 dev_put(dev);
97389753 return fd;
97399754
9755+unlock:
9756+ rtnl_unlock();
9757+
97409758 out_put_dev:
97419759 dev_put(dev);
97429760 return err;
net/core/skbuff.c+16−2
@@ -663,7 +663,7 @@ static void skb_release_data(struct sk_buff *skb) · 662 unmodified lines
663663 if (skb->cloned &&
664664 atomic_sub_return(skb->nohdr ? (1 << SKB_DATAREF_SHIFT) + 1 : 1,
665665 &shinfo->dataref))
666− return;
666+ goto exit;
667667
668668 skb_zcopy_clear(skb, true);
669669
@@ -674,6 +674,17 @@ static void skb_release_data(struct sk_buff *skb) · 4 unmodified lines
674674 kfree_skb_list(shinfo->frag_list);
675675
676676 skb_free_head(skb);
677+exit:
678+ /* When we clone an SKB we copy the reycling bit. The pp_recycle
679+ * bit is only set on the head though, so in order to avoid races
680+ * while trying to recycle fragments on __skb_frag_unref() we need
681+ * to make one SKB responsible for triggering the recycle path.
682+ * So disable the recycling bit if an SKB is cloned and we have
683+ * additional references to to the fragmented part of the SKB.
684+ * Eventually the last SKB will have the recycling bit set and it's
685+ * dataref set to 0, which will trigger the recycling
686+ */
687+ skb->pp_recycle = 0;
677688 }
678689
679690 /*
@@ -3011,8 +3022,11 @@ skb_zerocopy_headlen(const struct sk_buff *from) · 2331 unmodified lines
30113022
30123023 if (!from->head_frag ||
30133024 skb_headlen(from) < L1_CACHE_BYTES ||
3014− skb_shinfo(from)->nr_frags >= MAX_SKB_FRAGS)
3025+ skb_shinfo(from)->nr_frags >= MAX_SKB_FRAGS) {
30153026 hlen = skb_headlen(from);
3027+ if (!hlen)
3028+ hlen = from->len;
3029+ }
30163030
30173031 if (skb_has_frag_list(from))
30183032 hlen = from->len;
net/core/skmsg.c+11−5
@@ -508,10 +508,8 @@ static int sk_psock_skb_ingress_enqueue(struct sk_buff *skb, · 507 unmodified lines
508508 if (skb_linearize(skb))
509509 return -EAGAIN;
510510 num_sge = skb_to_sgvec(skb, msg->sg.data, 0, skb->len);
511− if (unlikely(num_sge < 0)) {
512− kfree(msg);
511+ if (unlikely(num_sge < 0))
513512 return num_sge;
514− }
515513
516514 copied = skb->len;
517515 msg->sg.start = 0;
@@ -530,6 +528,7 @@ static int sk_psock_skb_ingress(struct sk_psock *psock, struct sk_buff *skb) · 12 unmodified lines
530528 {
531529 struct sock *sk = psock->sk;
532530 struct sk_msg *msg;
531+ int err;
533532
534533 /* If we are receiving on the same sock skb->sk is already assigned,
535534 * skip memory accounting and owner transition seeing it already set
@@ -548,7 +547,10 @@ static int sk_psock_skb_ingress(struct sk_psock *psock, struct sk_buff *skb) · 12 unmodified lines
548547 * into user buffers.
549548 */
550549 skb_set_owner_r(skb, sk);
551− return sk_psock_skb_ingress_enqueue(skb, psock, sk, msg);
550+ err = sk_psock_skb_ingress_enqueue(skb, psock, sk, msg);
551+ if (err < 0)
552+ kfree(msg);
553+ return err;
552554 }
553555
554556 /* Puts an skb on the ingress queue of the socket already assigned to the
@@ -559,12 +561,16 @@ static int sk_psock_skb_ingress_self(struct sk_psock *psock, struct sk_buff *skb · 4 unmodified lines
559561 {
560562 struct sk_msg *msg = kzalloc(sizeof(*msg), __GFP_NOWARN | GFP_ATOMIC);
561563 struct sock *sk = psock->sk;
564+ int err;
562565
563566 if (unlikely(!msg))
564567 return -EAGAIN;
565568 sk_msg_init(msg);
566569 skb_set_owner_r(skb, sk);
567− return sk_psock_skb_ingress_enqueue(skb, psock, sk, msg);
570+ err = sk_psock_skb_ingress_enqueue(skb, psock, sk, msg);
571+ if (err < 0)
572+ kfree(msg);
573+ return err;
568574 }
569575
570576 static int sk_psock_handle_skb(struct sk_psock *psock, struct sk_buff *skb,
net/decnet/af_decnet.c+12−15
@@ -816,7 +816,7 @@ static int dn_auto_bind(struct socket *sock) · 815 unmodified lines
816816 static int dn_confirm_accept(struct sock *sk, long *timeo, gfp_t allocation)
817817 {
818818 struct dn_scp *scp = DN_SK(sk);
819− DEFINE_WAIT(wait);
819+ DEFINE_WAIT_FUNC(wait, woken_wake_function);
820820 int err;
821821
822822 if (scp->state != DN_CR)
@@ -826,11 +826,11 @@ static int dn_confirm_accept(struct sock *sk, long *timeo, gfp_t allocation) · 3 unmodified lines
826826 scp->segsize_loc = dst_metric_advmss(__sk_dst_get(sk));
827827 dn_send_conn_conf(sk, allocation);
828828
829− prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
829+ add_wait_queue(sk_sleep(sk), &wait);
830830 for(;;) {
831831 release_sock(sk);
832832 if (scp->state == DN_CC)
833− *timeo = schedule_timeout(*timeo);
833+ *timeo = wait_woken(&wait, TASK_INTERRUPTIBLE, *timeo);
834834 lock_sock(sk);
835835 err = 0;
836836 if (scp->state == DN_RUN)
@@ -844,9 +844,8 @@ static int dn_confirm_accept(struct sock *sk, long *timeo, gfp_t allocation) · 7 unmodified lines
844844 err = -EAGAIN;
845845 if (!*timeo)
846846 break;
847− prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
848847 }
849− finish_wait(sk_sleep(sk), &wait);
848+ remove_wait_queue(sk_sleep(sk), &wait);
850849 if (err == 0) {
851850 sk->sk_socket->state = SS_CONNECTED;
852851 } else if (scp->state != DN_CC) {
@@ -858,7 +857,7 @@ static int dn_confirm_accept(struct sock *sk, long *timeo, gfp_t allocation) · 5 unmodified lines
858857 static int dn_wait_run(struct sock *sk, long *timeo)
859858 {
860859 struct dn_scp *scp = DN_SK(sk);
861− DEFINE_WAIT(wait);
860+ DEFINE_WAIT_FUNC(wait, woken_wake_function);
862861 int err = 0;
863862
864863 if (scp->state == DN_RUN)
@@ -867,11 +866,11 @@ static int dn_wait_run(struct sock *sk, long *timeo) · 2 unmodified lines
867866 if (!*timeo)
868867 return -EALREADY;
869868
870− prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
869+ add_wait_queue(sk_sleep(sk), &wait);
871870 for(;;) {
872871 release_sock(sk);
873872 if (scp->state == DN_CI || scp->state == DN_CC)
874− *timeo = schedule_timeout(*timeo);
873+ *timeo = wait_woken(&wait, TASK_INTERRUPTIBLE, *timeo);
875874 lock_sock(sk);
876875 err = 0;
877876 if (scp->state == DN_RUN)
@@ -885,9 +884,8 @@ static int dn_wait_run(struct sock *sk, long *timeo) · 7 unmodified lines
885884 err = -ETIMEDOUT;
886885 if (!*timeo)
887886 break;
888− prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
889887 }
890− finish_wait(sk_sleep(sk), &wait);
888+ remove_wait_queue(sk_sleep(sk), &wait);
891889 out:
892890 if (err == 0) {
893891 sk->sk_socket->state = SS_CONNECTED;
@@ -1032,16 +1030,16 @@ static void dn_user_copy(struct sk_buff *skb, struct optdata_dn *opt) · 138 unmodified lines
10321030
10331031 static struct sk_buff *dn_wait_for_connect(struct sock *sk, long *timeo)
10341032 {
1035− DEFINE_WAIT(wait);
1033+ DEFINE_WAIT_FUNC(wait, woken_wake_function);
10361034 struct sk_buff *skb = NULL;
10371035 int err = 0;
10381036
1039− prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
1037+ add_wait_queue(sk_sleep(sk), &wait);
10401038 for(;;) {
10411039 release_sock(sk);
10421040 skb = skb_dequeue(&sk->sk_receive_queue);
10431041 if (skb == NULL) {
1044− *timeo = schedule_timeout(*timeo);
1042+ *timeo = wait_woken(&wait, TASK_INTERRUPTIBLE, *timeo);
10451043 skb = skb_dequeue(&sk->sk_receive_queue);
10461044 }
10471045 lock_sock(sk);
@@ -1056,9 +1054,8 @@ static struct sk_buff *dn_wait_for_connect(struct sock *sk, long *timeo) · 8 unmodified lines
10561054 err = -EAGAIN;
10571055 if (!*timeo)
10581056 break;
1059− prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
10601057 }
1061− finish_wait(sk_sleep(sk), &wait);
1058+ remove_wait_queue(sk_sleep(sk), &wait);
10621059
10631060 return skb == NULL ? ERR_PTR(err) : skb;
10641061 }
net/dsa/slave.c+9−5
@@ -1808,6 +1808,7 @@ void dsa_slave_setup_tagger(struct net_device *slave) · 1807 unmodified lines
18081808 struct dsa_slave_priv *p = netdev_priv(slave);
18091809 const struct dsa_port *cpu_dp = dp->cpu_dp;
18101810 struct net_device *master = cpu_dp->master;
1811+ const struct dsa_switch *ds = dp->ds;
18111812
18121813 slave->needed_headroom = cpu_dp->tag_ops->needed_headroom;
18131814 slave->needed_tailroom = cpu_dp->tag_ops->needed_tailroom;
@@ -1819,6 +1820,14 @@ void dsa_slave_setup_tagger(struct net_device *slave) · 5 unmodified lines
18191820 slave->needed_tailroom += master->needed_tailroom;
18201821
18211822 p->xmit = cpu_dp->tag_ops->xmit;
1823+
1824+ slave->features = master->vlan_features | NETIF_F_HW_TC;
1825+ if (ds->ops->port_vlan_add && ds->ops->port_vlan_del)
1826+ slave->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
1827+ slave->hw_features |= NETIF_F_HW_TC;
1828+ slave->features |= NETIF_F_LLTX;
1829+ if (slave->needed_tailroom)
1830+ slave->features &= ~(NETIF_F_SG | NETIF_F_FRAGLIST);
18221831 }
18231832
18241833 static struct lock_class_key dsa_slave_netdev_xmit_lock_key;
@@ -1881,11 +1890,6 @@ int dsa_slave_create(struct dsa_port *port) · 56 unmodified lines
18811890 if (slave_dev == NULL)
18821891 return -ENOMEM;
18831892
1884− slave_dev->features = master->vlan_features | NETIF_F_HW_TC;
1885− if (ds->ops->port_vlan_add && ds->ops->port_vlan_del)
1886− slave_dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
1887− slave_dev->hw_features |= NETIF_F_HW_TC;
1888− slave_dev->features |= NETIF_F_LLTX;
18891893 slave_dev->ethtool_ops = &dsa_slave_ethtool_ops;
18901894 if (!is_zero_ether_addr(port->mac))
18911895 ether_addr_copy(slave_dev->dev_addr, port->mac);
net/dsa/tag_ksz.c+9−0
@@ -53,6 +53,9 @@ static struct sk_buff *ksz8795_xmit(struct sk_buff *skb, struct net_device *dev) · 52 unmodified lines
5353 u8 *tag;
5454 u8 *addr;
5555
56+ if (skb->ip_summed == CHECKSUM_PARTIAL && skb_checksum_help(skb))
57+ return NULL;
58+
5659 /* Tag encoding */
5760 tag = skb_put(skb, KSZ_INGRESS_TAG_LEN);
5861 addr = skb_mac_header(skb);
@@ -114,6 +117,9 @@ static struct sk_buff *ksz9477_xmit(struct sk_buff *skb, · 55 unmodified lines
114117 u8 *addr;
115118 u16 val;
116119
120+ if (skb->ip_summed == CHECKSUM_PARTIAL && skb_checksum_help(skb))
121+ return NULL;
122+
117123 /* Tag encoding */
118124 tag = skb_put(skb, KSZ9477_INGRESS_TAG_LEN);
119125 addr = skb_mac_header(skb);
@@ -164,6 +170,9 @@ static struct sk_buff *ksz9893_xmit(struct sk_buff *skb, · 44 unmodified lines
164170 u8 *addr;
165171 u8 *tag;
166172
173+ if (skb->ip_summed == CHECKSUM_PARTIAL && skb_checksum_help(skb))
174+ return NULL;
175+
167176 /* Tag encoding */
168177 tag = skb_put(skb, KSZ_INGRESS_TAG_LEN);
169178 addr = skb_mac_header(skb);
net/ipv4/tcp_bpf.c+1−1
@@ -503,7 +503,7 @@ static int __init tcp_bpf_v4_build_proto(void) · 502 unmodified lines
503503 tcp_bpf_rebuild_protos(tcp_bpf_prots[TCP_BPF_IPV4], &tcp_prot);
504504 return 0;
505505 }
506−core_initcall(tcp_bpf_v4_build_proto);
506+late_initcall(tcp_bpf_v4_build_proto);
507507
508508 static int tcp_bpf_assert_proto_ops(struct proto *ops)
509509 {
net/ipv4/tcp_fastopen.c+24−4
@@ -496,8 +496,18 @@ void tcp_fastopen_active_disable(struct sock *sk) · 495 unmodified lines
496496 {
497497 struct net *net = sock_net(sk);
498498
499+ if (!sock_net(sk)->ipv4.sysctl_tcp_fastopen_blackhole_timeout)
500+ return;
501+
502+ /* Paired with READ_ONCE() in tcp_fastopen_active_should_disable() */
503+ WRITE_ONCE(net->ipv4.tfo_active_disable_stamp, jiffies);
504+
505+ /* Paired with smp_rmb() in tcp_fastopen_active_should_disable().
506+ * We want net->ipv4.tfo_active_disable_stamp to be updated first.
507+ */
508+ smp_mb__before_atomic();
499509 atomic_inc(&net->ipv4.tfo_active_disable_times);
500− net->ipv4.tfo_active_disable_stamp = jiffies;
510+
501511 NET_INC_STATS(net, LINUX_MIB_TCPFASTOPENBLACKHOLE);
502512 }
503513
@@ -508,17 +518,27 @@ void tcp_fastopen_active_disable(struct sock *sk) · 4 unmodified lines
508518 bool tcp_fastopen_active_should_disable(struct sock *sk)
509519 {
510520 unsigned int tfo_bh_timeout = sock_net(sk)->ipv4.sysctl_tcp_fastopen_blackhole_timeout;
511− int tfo_da_times = atomic_read(&sock_net(sk)->ipv4.tfo_active_disable_times);
512521 unsigned long timeout;
522+ int tfo_da_times;
513523 int multiplier;
514524
525+ if (!tfo_bh_timeout)
526+ return false;
527+
528+ tfo_da_times = atomic_read(&sock_net(sk)->ipv4.tfo_active_disable_times);
515529 if (!tfo_da_times)
516530 return false;
517531
532+ /* Paired with smp_mb__before_atomic() in tcp_fastopen_active_disable() */
533+ smp_rmb();
534+
518535 /* Limit timeout to max: 2^6 * initial timeout */
519536 multiplier = 1 << min(tfo_da_times - 1, 6);
520− timeout = multiplier * tfo_bh_timeout * HZ;
521− if (time_before(jiffies, sock_net(sk)->ipv4.tfo_active_disable_stamp + timeout))
537+
538+ /* Paired with the WRITE_ONCE() in tcp_fastopen_active_disable(). */
539+ timeout = READ_ONCE(sock_net(sk)->ipv4.tfo_active_disable_stamp) +
540+ multiplier * tfo_bh_timeout * HZ;
541+ if (time_before(jiffies, timeout))
522542 return true;
523543
524544 /* Mark check bit so we can check for successful active TFO
net/ipv4/tcp_ipv4.c+1−1
@@ -2964,7 +2964,7 @@ static int __net_init tcp_sk_init(struct net *net) · 2963 unmodified lines
29642964 net->ipv4.sysctl_tcp_comp_sack_slack_ns = 100 * NSEC_PER_USEC;
29652965 net->ipv4.sysctl_tcp_comp_sack_nr = 44;
29662966 net->ipv4.sysctl_tcp_fastopen = TFO_CLIENT_ENABLE;
2967− net->ipv4.sysctl_tcp_fastopen_blackhole_timeout = 60 * 60;
2967+ net->ipv4.sysctl_tcp_fastopen_blackhole_timeout = 0;
29682968 atomic_set(&net->ipv4.tfo_active_disable_times, 0);
29692969
29702970 /* Reno is always built in */
net/ipv4/udp.c+19−6
@@ -645,10 +645,12 @@ static struct sock *__udp4_lib_err_encap(struct net *net, · 644 unmodified lines
645645 const struct iphdr *iph,
646646 struct udphdr *uh,
647647 struct udp_table *udptable,
648+ struct sock *sk,
648649 struct sk_buff *skb, u32 info)
649650 {
651+ int (*lookup)(struct sock *sk, struct sk_buff *skb);
650652 int network_offset, transport_offset;
651− struct sock *sk;
653+ struct udp_sock *up;
652654
653655 network_offset = skb_network_offset(skb);
654656 transport_offset = skb_transport_offset(skb);
@@ -659,18 +661,28 @@ static struct sock *__udp4_lib_err_encap(struct net *net, · 4 unmodified lines
659661 /* Transport header needs to point to the UDP header */
660662 skb_set_transport_header(skb, iph->ihl << 2);
661663
664+ if (sk) {
665+ up = udp_sk(sk);
666+
667+ lookup = READ_ONCE(up->encap_err_lookup);
668+ if (lookup && lookup(sk, skb))
669+ sk = NULL;
670+
671+ goto out;
672+ }
673+
662674 sk = __udp4_lib_lookup(net, iph->daddr, uh->source,
663675 iph->saddr, uh->dest, skb->dev->ifindex, 0,
664676 udptable, NULL);
665677 if (sk) {
666− int (*lookup)(struct sock *sk, struct sk_buff *skb);
667− struct udp_sock *up = udp_sk(sk);
678+ up = udp_sk(sk);
668679
669680 lookup = READ_ONCE(up->encap_err_lookup);
670681 if (!lookup || lookup(sk, skb))
671682 sk = NULL;
672683 }
673684
685+out:
674686 if (!sk)
675687 sk = ERR_PTR(__udp4_lib_err_encap_no_sk(skb, info));
676688
@@ -707,15 +719,16 @@ int __udp4_lib_err(struct sk_buff *skb, u32 info, struct udp_table *udptable) · 30 unmodified lines
707719 sk = __udp4_lib_lookup(net, iph->daddr, uh->dest,
708720 iph->saddr, uh->source, skb->dev->ifindex,
709721 inet_sdif(skb), udptable, NULL);
722+
710723 if (!sk || udp_sk(sk)->encap_type) {
711724 /* No socket for error: try tunnels before discarding */
712− sk = ERR_PTR(-ENOENT);
713725 if (static_branch_unlikely(&udp_encap_needed_key)) {
714− sk = __udp4_lib_err_encap(net, iph, uh, udptable, skb,
726+ sk = __udp4_lib_err_encap(net, iph, uh, udptable, sk, skb,
715727 info);
716728 if (!sk)
717729 return 0;
718− }
730+ } else
731+ sk = ERR_PTR(-ENOENT);
719732
720733 if (IS_ERR(sk)) {
721734 __ICMP_INC_STATS(net, ICMP_MIB_INERRORS);
net/ipv4/udp_bpf.c+1−1
@@ -133,7 +133,7 @@ static int __init udp_bpf_v4_build_proto(void) · 132 unmodified lines
133133 udp_bpf_rebuild_protos(&udp_bpf_prots[UDP_BPF_IPV4], &udp_prot);
134134 return 0;
135135 }
136−core_initcall(udp_bpf_v4_build_proto);
136+late_initcall(udp_bpf_v4_build_proto);
137137
138138 int udp_bpf_update_proto(struct sock *sk, struct sk_psock *psock, bool restore)
139139 {
net/ipv6/ip6_output.c+1−1
@@ -74,7 +74,7 @@ static int ip6_finish_output2(struct net *net, struct sock *sk, struct sk_buff * · 73 unmodified lines
7474
7575 if (likely(nskb)) {
7676 if (skb->sk)
77− skb_set_owner_w(skb, skb->sk);
77+ skb_set_owner_w(nskb, skb->sk);
7878 consume_skb(skb);
7979 } else {
8080 kfree_skb(skb);
net/ipv6/route.c+1−1
@@ -3751,7 +3751,7 @@ static struct fib6_info *ip6_route_info_create(struct fib6_config *cfg, · 3750 unmodified lines
37513751 err = PTR_ERR(rt->fib6_metrics);
37523752 /* Do not leave garbage there. */
37533753 rt->fib6_metrics = (struct dst_metrics *)&dst_default_metrics;
3754− goto out;
3754+ goto out_free;
37553755 }
37563756
37573757 if (cfg->fc_flags & RTF_ADDRCONF)
net/ipv6/udp.c+19−6
@@ -502,12 +502,14 @@ static struct sock *__udp6_lib_err_encap(struct net *net, · 501 unmodified lines
502502 const struct ipv6hdr *hdr, int offset,
503503 struct udphdr *uh,
504504 struct udp_table *udptable,
505+ struct sock *sk,
505506 struct sk_buff *skb,
506507 struct inet6_skb_parm *opt,
507508 u8 type, u8 code, __be32 info)
508509 {
510+ int (*lookup)(struct sock *sk, struct sk_buff *skb);
509511 int network_offset, transport_offset;
510− struct sock *sk;
512+ struct udp_sock *up;
511513
512514 network_offset = skb_network_offset(skb);
513515 transport_offset = skb_transport_offset(skb);
@@ -518,18 +520,28 @@ static struct sock *__udp6_lib_err_encap(struct net *net, · 4 unmodified lines
518520 /* Transport header needs to point to the UDP header */
519521 skb_set_transport_header(skb, offset);
520522
523+ if (sk) {
524+ up = udp_sk(sk);
525+
526+ lookup = READ_ONCE(up->encap_err_lookup);
527+ if (lookup && lookup(sk, skb))
528+ sk = NULL;
529+
530+ goto out;
531+ }
532+
521533 sk = __udp6_lib_lookup(net, &hdr->daddr, uh->source,
522534 &hdr->saddr, uh->dest,
523535 inet6_iif(skb), 0, udptable, skb);
524536 if (sk) {
525− int (*lookup)(struct sock *sk, struct sk_buff *skb);
526− struct udp_sock *up = udp_sk(sk);
537+ up = udp_sk(sk);
527538
528539 lookup = READ_ONCE(up->encap_err_lookup);
529540 if (!lookup || lookup(sk, skb))
530541 sk = NULL;
531542 }
532543
544+out:
533545 if (!sk) {
534546 sk = ERR_PTR(__udp6_lib_err_encap_no_sk(skb, opt, type, code,
535547 offset, info));
@@ -558,16 +570,17 @@ int __udp6_lib_err(struct sk_buff *skb, struct inet6_skb_parm *opt, · 22 unmodified lines
558570
559571 sk = __udp6_lib_lookup(net, daddr, uh->dest, saddr, uh->source,
560572 inet6_iif(skb), inet6_sdif(skb), udptable, NULL);
573+
561574 if (!sk || udp_sk(sk)->encap_type) {
562575 /* No socket for error: try tunnels before discarding */
563− sk = ERR_PTR(-ENOENT);
564576 if (static_branch_unlikely(&udpv6_encap_needed_key)) {
565577 sk = __udp6_lib_err_encap(net, hdr, offset, uh,
566− udptable, skb,
578+ udptable, sk, skb,
567579 opt, type, code, info);
568580 if (!sk)
569581 return 0;
570− }
582+ } else
583+ sk = ERR_PTR(-ENOENT);
571584
572585 if (IS_ERR(sk)) {
573586 __ICMP6_INC_STATS(net, __in6_dev_get(skb->dev),
net/netrom/nr_timer.c+11−9
@@ -121,11 +121,9 @@ static void nr_heartbeat_expiry(struct timer_list *t) · 120 unmodified lines
121121 is accepted() it isn't 'dead' so doesn't get removed. */
122122 if (sock_flag(sk, SOCK_DESTROY) ||
123123 (sk->sk_state == TCP_LISTEN && sock_flag(sk, SOCK_DEAD))) {
124− sock_hold(sk);
125124 bh_unlock_sock(sk);
126125 nr_destroy_socket(sk);
127− sock_put(sk);
128− return;
126+ goto out;
129127 }
130128 break;
131129
@@ -146,6 +144,8 @@ static void nr_heartbeat_expiry(struct timer_list *t) · 14 unmodified lines
146144
147145 nr_start_heartbeat(sk);
148146 bh_unlock_sock(sk);
147+out:
148+ sock_put(sk);
149149 }
150150
151151 static void nr_t2timer_expiry(struct timer_list *t)
@@ -159,6 +159,7 @@ static void nr_t2timer_expiry(struct timer_list *t) · 7 unmodified lines
159159 nr_enquiry_response(sk);
160160 }
161161 bh_unlock_sock(sk);
162+ sock_put(sk);
162163 }
163164
164165 static void nr_t4timer_expiry(struct timer_list *t)
@@ -169,6 +170,7 @@ static void nr_t4timer_expiry(struct timer_list *t) · 4 unmodified lines
169170 bh_lock_sock(sk);
170171 nr_sk(sk)->condition &= ~NR_COND_PEER_RX_BUSY;
171172 bh_unlock_sock(sk);
173+ sock_put(sk);
172174 }
173175
174176 static void nr_idletimer_expiry(struct timer_list *t)
@@ -197,6 +199,7 @@ static void nr_idletimer_expiry(struct timer_list *t) · 22 unmodified lines
197199 sock_set_flag(sk, SOCK_DEAD);
198200 }
199201 bh_unlock_sock(sk);
202+ sock_put(sk);
200203 }
201204
202205 static void nr_t1timer_expiry(struct timer_list *t)
@@ -209,8 +212,7 @@ static void nr_t1timer_expiry(struct timer_list *t) · 6 unmodified lines
209212 case NR_STATE_1:
210213 if (nr->n2count == nr->n2) {
211214 nr_disconnect(sk, ETIMEDOUT);
212− bh_unlock_sock(sk);
213− return;
215+ goto out;
214216 } else {
215217 nr->n2count++;
216218 nr_write_internal(sk, NR_CONNREQ);
@@ -220,8 +222,7 @@ static void nr_t1timer_expiry(struct timer_list *t) · 3 unmodified lines
220222 case NR_STATE_2:
221223 if (nr->n2count == nr->n2) {
222224 nr_disconnect(sk, ETIMEDOUT);
223− bh_unlock_sock(sk);
224− return;
225+ goto out;
225226 } else {
226227 nr->n2count++;
227228 nr_write_internal(sk, NR_DISCREQ);
@@ -231,8 +232,7 @@ static void nr_t1timer_expiry(struct timer_list *t) · 3 unmodified lines
231232 case NR_STATE_3:
232233 if (nr->n2count == nr->n2) {
233234 nr_disconnect(sk, ETIMEDOUT);
234− bh_unlock_sock(sk);
235− return;
235+ goto out;
236236 } else {
237237 nr->n2count++;
238238 nr_requeue_frames(sk);
@@ -241,5 +241,7 @@ static void nr_t1timer_expiry(struct timer_list *t) · 2 unmodified lines
241241 }
242242
243243 nr_start_t1timer(sk);
244+out:
244245 bh_unlock_sock(sk);
246+ sock_put(sk);
245247 }
net/sched/act_skbmod.c+8−4
@@ -6,6 +6,7 @@ · 5 unmodified lines
66 */
77
88 #include <linux/module.h>
9+#include <linux/if_arp.h>
910 #include <linux/init.h>
1011 #include <linux/kernel.h>
1112 #include <linux/skbuff.h>
@@ -33,6 +34,13 @@ static int tcf_skbmod_act(struct sk_buff *skb, const struct tc_action *a, · 21 unmodified lines
3334 tcf_lastuse_update(&d->tcf_tm);
3435 bstats_cpu_update(this_cpu_ptr(d->common.cpu_bstats), skb);
3536
37+ action = READ_ONCE(d->tcf_action);
38+ if (unlikely(action == TC_ACT_SHOT))
39+ goto drop;
40+
41+ if (!skb->dev || skb->dev->type != ARPHRD_ETHER)
42+ return action;
43+
3644 /* XXX: if you are going to edit more fields beyond ethernet header
3745 * (example when you add IP header replacement or vlan swap)
3846 * then MAX_EDIT_LEN needs to change appropriately
@@ -41,10 +49,6 @@ static int tcf_skbmod_act(struct sk_buff *skb, const struct tc_action *a, · 2 unmodified lines
4149 if (unlikely(err)) /* best policy is to drop on the floor */
4250 goto drop;
4351
44− action = READ_ONCE(d->tcf_action);
45− if (unlikely(action == TC_ACT_SHOT))
46− goto drop;
47−
4852 p = rcu_dereference_bh(d->skbmod_p);
4953 flags = p->flags;
5054 if (flags & SKBMOD_F_DMAC)
net/sched/cls_api.c+1−1
@@ -2897,7 +2897,7 @@ replay: · 2896 unmodified lines
28972897 break;
28982898 case RTM_GETCHAIN:
28992899 err = tc_chain_notify(chain, skb, n->nlmsg_seq,
2900− n->nlmsg_seq, n->nlmsg_type, true);
2900+ n->nlmsg_flags, n->nlmsg_type, true);
29012901 if (err < 0)
29022902 NL_SET_ERR_MSG(extack, "Failed to send chain notify message");
29032903 break;
net/sched/cls_tcindex.c+4−1
@@ -278,6 +278,8 @@ static int tcindex_filter_result_init(struct tcindex_filter_result *r, · 277 unmodified lines
278278 TCA_TCINDEX_POLICE);
279279 }
280280
281+static void tcindex_free_perfect_hash(struct tcindex_data *cp);
282+
281283 static void tcindex_partial_destroy_work(struct work_struct *work)
282284 {
283285 struct tcindex_data *p = container_of(to_rcu_work(work),
@@ -285,7 +287,8 @@ static void tcindex_partial_destroy_work(struct work_struct *work) · 1 unmodified line
285287 rwork);
286288
287289 rtnl_lock();
288− kfree(p->perfect);
290+ if (p->perfect)
291+ tcindex_free_perfect_hash(p);
289292 kfree(p);
290293 rtnl_unlock();
291294 }
net/sctp/auth.c+2−0
@@ -860,6 +860,8 @@ int sctp_auth_set_key(struct sctp_endpoint *ep, · 859 unmodified lines
860860 if (replace) {
861861 list_del_init(&shkey->key_list);
862862 sctp_auth_shkey_release(shkey);
863+ if (asoc && asoc->active_key_id == auth_key->sca_keynumber)
864+ sctp_auth_asoc_init_active_key(asoc, GFP_KERNEL);
863865 }
864866 list_add(&cur_key->key_list, sh_keys);
865867
net/sctp/output.c+2−2
@@ -104,8 +104,8 @@ void sctp_packet_config(struct sctp_packet *packet, __u32 vtag, · 103 unmodified lines
104104 if (asoc->param_flags & SPP_PMTUD_ENABLE)
105105 sctp_assoc_sync_pmtu(asoc);
106106 } else if (!sctp_transport_pl_enabled(tp) &&
107− !sctp_transport_pmtu_check(tp)) {
108− if (asoc->param_flags & SPP_PMTUD_ENABLE)
107+ asoc->param_flags & SPP_PMTUD_ENABLE) {
108+ if (!sctp_transport_pmtu_check(tp))
109109 sctp_assoc_sync_pmtu(asoc);
110110 }
111111
net/sctp/socket.c+4−0
@@ -4577,6 +4577,10 @@ static int sctp_setsockopt(struct sock *sk, int level, int optname, · 4576 unmodified lines
45774577 }
45784578
45794579 if (optlen > 0) {
4580+ /* Trim it to the biggest size sctp sockopt may need if necessary */
4581+ optlen = min_t(unsigned int, optlen,
4582+ PAGE_ALIGN(USHRT_MAX +
4583+ sizeof(__u16) * sizeof(struct sctp_reset_streams)));
45804584 kopt = memdup_sockptr(optval, optlen);
45814585 if (IS_ERR(kopt))
45824586 return PTR_ERR(kopt);
scripts/Makefile.build+1−1
@@ -386,7 +386,7 @@ ifeq ($(CONFIG_LTO_CLANG) $(CONFIG_MODVERSIONS),y y) · 385 unmodified lines
386386 cmd_update_lto_symversions = \
387387 rm -f $@.symversions \
388388 $(foreach n, $(filter-out FORCE,$^), \
389− $(if $(wildcard $(n).symversions), \
389+ $(if $(shell test -s $(n).symversions && echo y), \
390390 ; cat $(n).symversions >> $@.symversions))
391391 else
392392 cmd_update_lto_symversions = echo >/dev/null
scripts/setlocalversion+8−5
@@ -131,11 +131,14 @@ res="${res}${CONFIG_LOCALVERSION}${LOCALVERSION}" · 130 unmodified lines
131131 if test "$CONFIG_LOCALVERSION_AUTO" = "y"; then
132132 # full scm version string
133133 res="$res$(scm_version)"
134−elif [ -z "${LOCALVERSION}" ]; then
135− # append a plus sign if the repository is not in a clean
136− # annotated or signed tagged state (as git describe only
137− # looks at signed or annotated tags - git tag -a/-s) and
138− # LOCALVERSION= is not specified
134+elif [ "${LOCALVERSION+set}" != "set" ]; then
135+ # If the variable LOCALVERSION is not set, append a plus
136+ # sign if the repository is not in a clean annotated or
137+ # signed tagged state (as git describe only looks at signed
138+ # or annotated tags - git tag -a/-s).
139+ #
140+ # If the variable LOCALVERSION is set (including being set
141+ # to an empty string), we don't want to append a plus sign.
139142 scm=$(scm_version --short)
140143 res="$res${scm:++}"
141144 fi
scripts/spdxcheck.py+1−1
@@ -44,7 +44,7 @@ def read_spdxdata(repo): · 43 unmodified lines
4444 continue
4545
4646 exception = None
47− for l in open(el.path).readlines():
47+ for l in open(el.path, encoding="utf-8").readlines():
4848 if l.startswith('Valid-License-Identifier:'):
4949 lid = l.split(':')[1].strip().upper()
5050 if lid in spdx.licenses:
sound/soc/mediatek/mt8183/mt8183-dai-adda.c+1−0
@@ -341,6 +341,7 @@ static int set_mtkaif_rx(struct mtk_base_afe *afe) · 340 unmodified lines
341341 case MT8183_MTKAIF_PROTOCOL_1:
342342 regmap_write(afe->regmap, AFE_AUD_PAD_TOP, 0x31);
343343 regmap_write(afe->regmap, AFE_ADDA_MTKAIF_CFG0, 0x0);
344+ break;
344345 default:
345346 break;
346347 }
tools/arch/arm64/include/uapi/asm/unistd.h+1−0
@@ -20,5 +20,6 @@ · 19 unmodified lines
2020 #define __ARCH_WANT_SET_GET_RLIMIT
2121 #define __ARCH_WANT_TIME32_SYSCALLS
2222 #define __ARCH_WANT_SYS_CLONE3
23+#define __ARCH_WANT_MEMFD_SECRET
2324
2425 #include <asm-generic/unistd.h>
tools/bpf/bpftool/common.c+5−0
@@ -222,6 +222,11 @@ int mount_bpffs_for_pin(const char *name) · 221 unmodified lines
222222 int err = 0;
223223
224224 file = malloc(strlen(name) + 1);
225+ if (!file) {
226+ p_err("mem alloc failed");
227+ return -1;
228+ }
229+
225230 strcpy(file, name);
226231 dir = dirname(file);
227232
tools/include/linux/kconfig.h+0−6
@@ -4,12 +4,6 @@ · 3 unmodified lines
44
55 /* CONFIG_CC_VERSION_TEXT (Do not delete this comment. See help in Kconfig) */
66
7−#ifdef CONFIG_CPU_BIG_ENDIAN
8−#define __BIG_ENDIAN 4321
9−#else
10−#define __LITTLE_ENDIAN 1234
11−#endif
12−
137 #define __ARG_PLACEHOLDER_1 0,
148 #define __take_second_arg(__ignored, val, ...) val
159
tools/include/uapi/asm-generic/unistd.h+6−1
@@ -873,8 +873,13 @@ __SYSCALL(__NR_landlock_add_rule, sys_landlock_add_rule) · 872 unmodified lines
873873 #define __NR_landlock_restrict_self 446
874874 __SYSCALL(__NR_landlock_restrict_self, sys_landlock_restrict_self)
875875
876+#ifdef __ARCH_WANT_MEMFD_SECRET
877+#define __NR_memfd_secret 447
878+__SYSCALL(__NR_memfd_secret, sys_memfd_secret)
879+#endif
880+
876881 #undef __NR_syscalls
877−#define __NR_syscalls 447
882+#define __NR_syscalls 448
878883
879884 /*
880885 * 32 bit systems traditionally used different
tools/perf/arch/x86/entry/syscalls/syscall_64.tbl+1−0
@@ -368,6 +368,7 @@ · 367 unmodified lines
368368 444 common landlock_create_ruleset sys_landlock_create_ruleset
369369 445 common landlock_add_rule sys_landlock_add_rule
370370 446 common landlock_restrict_self sys_landlock_restrict_self
371+447 common memfd_secret sys_memfd_secret
371372
372373 #
373374 # Due to a historical design error, certain syscalls are numbered differently
tools/perf/builtin-inject.c+9−4
@@ -361,9 +361,10 @@ static struct dso *findnew_dso(int pid, int tid, const char *filename, · 360 unmodified lines
361361 dso = machine__findnew_dso_id(machine, filename, id);
362362 }
363363
364− if (dso)
364+ if (dso) {
365+ nsinfo__put(dso->nsinfo);
365366 dso->nsinfo = nsi;
366− else
367+ } else
367368 nsinfo__put(nsi);
368369
369370 thread__put(thread);
@@ -992,8 +993,10 @@ int cmd_inject(int argc, const char **argv) · 622 unmodified lines
992993
993994 data.path = inject.input_name;
994995 inject.session = perf_session__new(&data, inject.output.is_pipe, &inject.tool);
995− if (IS_ERR(inject.session))
996− return PTR_ERR(inject.session);
996+ if (IS_ERR(inject.session)) {
997+ ret = PTR_ERR(inject.session);
998+ goto out_close_output;
999+ }
9971000
9981001 if (zstd_init(&(inject.session->zstd_data), 0) < 0)
9991002 pr_warning("Decompression initialization failed.\n");
@@ -1035,6 +1038,8 @@ int cmd_inject(int argc, const char **argv) · 35 unmodified lines
10351038 out_delete:
10361039 zstd_fini(&(inject.session->zstd_data));
10371040 perf_session__delete(inject.session);
1041+out_close_output:
1042+ perf_data__close(&inject.output);
10381043 free(inject.itrace_synth_opts.vm_tm_corr_args);
10391044 return ret;
10401045 }
tools/perf/builtin-report.c+22−11
@@ -1175,6 +1175,8 @@ int cmd_report(int argc, const char **argv) · 1174 unmodified lines
11751175 .annotation_opts = annotation__default_options,
11761176 .skip_empty = true,
11771177 };
1178+ char *sort_order_help = sort_help("sort by key(s):");
1179+ char *field_order_help = sort_help("output field(s): overhead period sample ");
11781180 const struct option options[] = {
11791181 OPT_STRING('i', "input", &input_name, "file",
11801182 "input file name"),
@@ -1209,9 +1211,9 @@ int cmd_report(int argc, const char **argv) · 28 unmodified lines
12091211 OPT_BOOLEAN(0, "header-only", &report.header_only,
12101212 "Show only data header."),
12111213 OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
1212− sort_help("sort by key(s):")),
1214+ sort_order_help),
12131215 OPT_STRING('F', "fields", &field_order, "key[,keys...]",
1214− sort_help("output field(s): overhead period sample ")),
1216+ field_order_help),
12151217 OPT_BOOLEAN(0, "show-cpu-utilization", &symbol_conf.show_cpu_utilization,
12161218 "Show sample percentage for different cpu modes"),
12171219 OPT_BOOLEAN_FLAG(0, "showcpuutilization", &symbol_conf.show_cpu_utilization,
@@ -1344,11 +1346,11 @@ int cmd_report(int argc, const char **argv) · 126 unmodified lines
13441346 char sort_tmp[128];
13451347
13461348 if (ret < 0)
1347− return ret;
1349+ goto exit;
13481350
13491351 ret = perf_config(report__config, &report);
13501352 if (ret)
1351− return ret;
1353+ goto exit;
13521354
13531355 argc = parse_options(argc, argv, options, report_usage, 0);
13541356 if (argc) {
@@ -1362,8 +1364,10 @@ int cmd_report(int argc, const char **argv) · 7 unmodified lines
13621364 report.symbol_filter_str = argv[0];
13631365 }
13641366
1365− if (annotate_check_args(&report.annotation_opts) < 0)
1366− return -EINVAL;
1367+ if (annotate_check_args(&report.annotation_opts) < 0) {
1368+ ret = -EINVAL;
1369+ goto exit;
1370+ }
13671371
13681372 if (report.mmaps_mode)
13691373 report.tasks_mode = true;
@@ -1377,12 +1381,14 @@ int cmd_report(int argc, const char **argv) · 7 unmodified lines
13771381 if (symbol_conf.vmlinux_name &&
13781382 access(symbol_conf.vmlinux_name, R_OK)) {
13791383 pr_err("Invalid file: %s\n", symbol_conf.vmlinux_name);
1380− return -EINVAL;
1384+ ret = -EINVAL;
1385+ goto exit;
13811386 }
13821387 if (symbol_conf.kallsyms_name &&
13831388 access(symbol_conf.kallsyms_name, R_OK)) {
13841389 pr_err("Invalid file: %s\n", symbol_conf.kallsyms_name);
1385− return -EINVAL;
1390+ ret = -EINVAL;
1391+ goto exit;
13861392 }
13871393
13881394 if (report.inverted_callchain)
@@ -1406,12 +1412,14 @@ int cmd_report(int argc, const char **argv) · 17 unmodified lines
14061412
14071413 repeat:
14081414 session = perf_session__new(&data, false, &report.tool);
1409− if (IS_ERR(session))
1410− return PTR_ERR(session);
1415+ if (IS_ERR(session)) {
1416+ ret = PTR_ERR(session);
1417+ goto exit;
1418+ }
14111419
14121420 ret = evswitch__init(&report.evswitch, session->evlist, stderr);
14131421 if (ret)
1414− return ret;
1422+ goto exit;
14151423
14161424 if (zstd_init(&(session->zstd_data), 0) < 0)
14171425 pr_warning("Decompression initialization failed. Reported data may be incomplete.\n");
@@ -1646,5 +1654,8 @@ error: · 228 unmodified lines
16461654
16471655 zstd_fini(&(session->zstd_data));
16481656 perf_session__delete(session);
1657+exit:
1658+ free(sort_order_help);
1659+ free(field_order_help);
16491660 return ret;
16501661 }
tools/perf/builtin-sched.c+30−5
@@ -670,7 +670,7 @@ static void create_tasks(struct perf_sched *sched) · 669 unmodified lines
670670 err = pthread_attr_init(&attr);
671671 BUG_ON(err);
672672 err = pthread_attr_setstacksize(&attr,
673− (size_t) max(16 * 1024, PTHREAD_STACK_MIN));
673+ (size_t) max(16 * 1024, (int)PTHREAD_STACK_MIN));
674674 BUG_ON(err);
675675 err = pthread_mutex_lock(&sched->start_work_mutex);
676676 BUG_ON(err);
@@ -3335,6 +3335,16 @@ static void setup_sorting(struct perf_sched *sched, const struct option *options · 2658 unmodified lines
33353335 sort_dimension__add("pid", &sched->cmp_pid);
33363336 }
33373337
3338+static bool schedstat_events_exposed(void)
3339+{
3340+ /*
3341+ * Select "sched:sched_stat_wait" event to check
3342+ * whether schedstat tracepoints are exposed.
3343+ */
3344+ return IS_ERR(trace_event__tp_format("sched", "sched_stat_wait")) ?
3345+ false : true;
3346+}
3347+
33383348 static int __cmd_record(int argc, const char **argv)
33393349 {
33403350 unsigned int rec_argc, i, j;
@@ -3346,21 +3356,33 @@ static int __cmd_record(int argc, const char **argv) · 5 unmodified lines
33463356 "-m", "1024",
33473357 "-c", "1",
33483358 "-e", "sched:sched_switch",
3349− "-e", "sched:sched_stat_wait",
3350− "-e", "sched:sched_stat_sleep",
3351− "-e", "sched:sched_stat_iowait",
33523359 "-e", "sched:sched_stat_runtime",
33533360 "-e", "sched:sched_process_fork",
33543361 "-e", "sched:sched_wakeup_new",
33553362 "-e", "sched:sched_migrate_task",
33563363 };
3364+
3365+ /*
3366+ * The tracepoints trace_sched_stat_{wait, sleep, iowait}
3367+ * are not exposed to user if CONFIG_SCHEDSTATS is not set,
3368+ * to prevent "perf sched record" execution failure, determine
3369+ * whether to record schedstat events according to actual situation.
3370+ */
3371+ const char * const schedstat_args[] = {
3372+ "-e", "sched:sched_stat_wait",
3373+ "-e", "sched:sched_stat_sleep",
3374+ "-e", "sched:sched_stat_iowait",
3375+ };
3376+ unsigned int schedstat_argc = schedstat_events_exposed() ?
3377+ ARRAY_SIZE(schedstat_args) : 0;
3378+
33573379 struct tep_event *waking_event;
33583380
33593381 /*
33603382 * +2 for either "-e", "sched:sched_wakeup" or
33613383 * "-e", "sched:sched_waking"
33623384 */
3363− rec_argc = ARRAY_SIZE(record_args) + 2 + argc - 1;
3385+ rec_argc = ARRAY_SIZE(record_args) + 2 + schedstat_argc + argc - 1;
33643386 rec_argv = calloc(rec_argc + 1, sizeof(char *));
33653387
33663388 if (rec_argv == NULL)
@@ -3376,6 +3398,9 @@ static int __cmd_record(int argc, const char **argv) · 9 unmodified lines
33763398 else
33773399 rec_argv[i++] = strdup("sched:sched_wakeup");
33783400
3401+ for (j = 0; j < schedstat_argc; j++)
3402+ rec_argv[i++] = strdup(schedstat_args[j]);
3403+
33793404 for (j = 1; j < (unsigned int)argc; j++, i++)
33803405 rec_argv[i] = argv[j];
33813406
tools/perf/builtin-script.c+8−0
@@ -2601,6 +2601,12 @@ static void perf_script__exit_per_event_dump_stats(struct perf_script *script) · 2600 unmodified lines
26012601 }
26022602 }
26032603
2604+static void perf_script__exit(struct perf_script *script)
2605+{
2606+ perf_thread_map__put(script->threads);
2607+ perf_cpu_map__put(script->cpus);
2608+}
2609+
26042610 static int __cmd_script(struct perf_script *script)
26052611 {
26062612 int ret;
@@ -4143,8 +4149,10 @@ out_delete: · 1536 unmodified lines
41434149 zfree(&script.ptime_range);
41444150 }
41454151
4152+ zstd_fini(&(session->zstd_data));
41464153 evlist__free_stats(session->evlist);
41474154 perf_session__delete(session);
4155+ perf_script__exit(&script);
41484156
41494157 if (script_started)
41504158 cleanup_scripting();
tools/perf/builtin-stat.c+0−3
@@ -2445,9 +2445,6 @@ int cmd_stat(int argc, const char **argv) · 2444 unmodified lines
24452445
24462446 evlist__check_cpu_maps(evsel_list);
24472447
2448− if (perf_pmu__has_hybrid())
2449− stat_config.no_merge = true;
2450−
24512448 /*
24522449 * Initialize thread_map with comm names,
24532450 * so we could print it out on output.
tools/perf/builtin-trace.c+43−2
@@ -2266,6 +2266,14 @@ static void *syscall__augmented_args(struct syscall *sc, struct perf_sample *sam · 2265 unmodified lines
22662266 return augmented_args;
22672267 }
22682268
2269+static void syscall__exit(struct syscall *sc)
2270+{
2271+ if (!sc)
2272+ return;
2273+
2274+ free(sc->arg_fmt);
2275+}
2276+
22692277 static int trace__sys_enter(struct trace *trace, struct evsel *evsel,
22702278 union perf_event *event __maybe_unused,
22712279 struct perf_sample *sample)
@@ -3095,6 +3103,21 @@ static struct evsel *evsel__new_pgfault(u64 config) · 823 unmodified lines
30953103 return evsel;
30963104 }
30973105
3106+static void evlist__free_syscall_tp_fields(struct evlist *evlist)
3107+{
3108+ struct evsel *evsel;
3109+
3110+ evlist__for_each_entry(evlist, evsel) {
3111+ struct evsel_trace *et = evsel->priv;
3112+
3113+ if (!et || !evsel->tp_format || strcmp(evsel->tp_format->system, "syscalls"))
3114+ continue;
3115+
3116+ free(et->fmt);
3117+ free(et);
3118+ }
3119+}
3120+
30983121 static void trace__handle_event(struct trace *trace, union perf_event *event, struct perf_sample *sample)
30993122 {
31003123 const u32 type = event->header.type;
@@ -4130,7 +4153,7 @@ out_disable: · 1029 unmodified lines
41304153
41314154 out_delete_evlist:
41324155 trace__symbols__exit(trace);
4133−
4156+ evlist__free_syscall_tp_fields(evlist);
41344157 evlist__delete(evlist);
41354158 cgroup__put(trace->cgroup);
41364159 trace->evlist = NULL;
@@ -4636,6 +4659,9 @@ do_concat: · 499 unmodified lines
46364659 err = parse_events_option(&o, lists[0], 0);
46374660 }
46384661 out:
4662+ free(strace_groups_dir);
4663+ free(lists[0]);
4664+ free(lists[1]);
46394665 if (sep)
46404666 *sep = ',';
46414667
@@ -4701,6 +4727,21 @@ out: · 59 unmodified lines
47014727 return err;
47024728 }
47034729
4730+static void trace__exit(struct trace *trace)
4731+{
4732+ int i;
4733+
4734+ strlist__delete(trace->ev_qualifier);
4735+ free(trace->ev_qualifier_ids.entries);
4736+ if (trace->syscalls.table) {
4737+ for (i = 0; i <= trace->sctbl->syscalls.max_id; i++)
4738+ syscall__exit(&trace->syscalls.table[i]);
4739+ free(trace->syscalls.table);
4740+ }
4741+ syscalltbl__delete(trace->sctbl);
4742+ zfree(&trace->perfconfig_events);
4743+}
4744+
47044745 int cmd_trace(int argc, const char **argv)
47054746 {
47064747 const char *trace_usage[] = {
@@ -5135,6 +5176,6 @@ out_close: · 428 unmodified lines
51355176 if (output_name != NULL)
51365177 fclose(trace.output);
51375178 out:
5138− zfree(&trace.perfconfig_events);
5179+ trace__exit(&trace);
51395180 return err;
51405181 }
tools/perf/tests/bpf.c+2−0
@@ -1,6 +1,7 @@
11 // SPDX-License-Identifier: GPL-2.0
22 #include <errno.h>
33 #include <stdio.h>
4+#include <stdlib.h>
45 #include <sys/epoll.h>
56 #include <sys/types.h>
67 #include <sys/stat.h>
@@ -276,6 +277,7 @@ static int __test__bpf(int idx) · 269 unmodified lines
276277 }
277278
278279 out:
280+ free(obj_buf);
279281 bpf__clear();
280282 return ret;
281283 }
tools/perf/tests/event_update.c+4−2
@@ -88,6 +88,7 @@ int test__event_update(struct test *test __maybe_unused, int subtest __maybe_unu · 87 unmodified lines
8888 struct evsel *evsel;
8989 struct event_name tmp;
9090 struct evlist *evlist = evlist__new_default();
91+ char *unit = strdup("KRAVA");
9192
9293 TEST_ASSERT_VAL("failed to get evlist", evlist);
9394
@@ -98,7 +99,7 @@ int test__event_update(struct test *test __maybe_unused, int subtest __maybe_unu · 4 unmodified lines
9899
99100 perf_evlist__id_add(&evlist->core, &evsel->core, 0, 0, 123);
100101
101− evsel->unit = strdup("KRAVA");
102+ evsel->unit = unit;
102103
103104 TEST_ASSERT_VAL("failed to synthesize attr update unit",
104105 !perf_event__synthesize_event_update_unit(NULL, evsel, process_event_unit));
@@ -118,6 +119,7 @@ int test__event_update(struct test *test __maybe_unused, int subtest __maybe_unu · 13 unmodified lines
118119 TEST_ASSERT_VAL("failed to synthesize attr update cpus",
119120 !perf_event__synthesize_event_update_cpus(&tmp.tool, evsel, process_event_cpus));
120121
121− perf_cpu_map__put(evsel->core.own_cpus);
122+ free(unit);
123+ evlist__delete(evlist);
122124 return 0;
123125 }
tools/perf/tests/evsel-roundtrip-name.c+2−1
@@ -5,6 +5,7 @@ · 4 unmodified lines
55 #include "tests.h"
66 #include "debug.h"
77 #include "pmu.h"
8+#include "pmu-hybrid.h"
89 #include <errno.h>
910 #include <linux/kernel.h>
1011
@@ -102,7 +103,7 @@ int test__perf_evsel__roundtrip_name_test(struct test *test __maybe_unused, int · 91 unmodified lines
102103 {
103104 int err = 0, ret = 0;
104105
105− if (perf_pmu__has_hybrid())
106+ if (perf_pmu__has_hybrid() && perf_pmu__hybrid_mounted("cpu_atom"))
106107 return perf_evsel__name_array_test(evsel__hw_names, 2);
107108
108109 err = perf_evsel__name_array_test(evsel__hw_names, 1);
tools/perf/tests/maps.c+2−0
@@ -116,5 +116,7 @@ int test__maps__merge_in(struct test *t __maybe_unused, int subtest __maybe_unus · 115 unmodified lines
116116
117117 ret = check_maps(merged3, ARRAY_SIZE(merged3), &maps);
118118 TEST_ASSERT_VAL("merge check failed", !ret);
119+
120+ maps__exit(&maps);
119121 return TEST_OK;
120122 }
tools/perf/tests/parse-events.c+10−6
@@ -6,6 +6,7 @@ · 5 unmodified lines
66 #include "tests.h"
77 #include "debug.h"
88 #include "pmu.h"
9+#include "pmu-hybrid.h"
910 #include <dirent.h>
1011 #include <errno.h>
1112 #include <sys/types.h>
@@ -1596,6 +1597,13 @@ static int test__hybrid_raw1(struct evlist *evlist) · 1584 unmodified lines
15961597 {
15971598 struct evsel *evsel = evlist__first(evlist);
15981599
1600+ if (!perf_pmu__hybrid_mounted("cpu_atom")) {
1601+ TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
1602+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
1603+ TEST_ASSERT_VAL("wrong config", 0x1a == evsel->core.attr.config);
1604+ return 0;
1605+ }
1606+
15991607 TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
16001608 TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
16011609 TEST_ASSERT_VAL("wrong config", 0x1a == evsel->core.attr.config);
@@ -1620,13 +1628,9 @@ static int test__hybrid_cache_event(struct evlist *evlist) · 18 unmodified lines
16201628 {
16211629 struct evsel *evsel = evlist__first(evlist);
16221630
1623− TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
1631+ TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
16241632 TEST_ASSERT_VAL("wrong type", PERF_TYPE_HW_CACHE == evsel->core.attr.type);
16251633 TEST_ASSERT_VAL("wrong config", 0x2 == (evsel->core.attr.config & 0xffffffff));
1626−
1627− evsel = evsel__next(evsel);
1628− TEST_ASSERT_VAL("wrong type", PERF_TYPE_HW_CACHE == evsel->core.attr.type);
1629− TEST_ASSERT_VAL("wrong config", 0x10002 == (evsel->core.attr.config & 0xffffffff));
16301634 return 0;
16311635 }
16321636
@@ -2028,7 +2032,7 @@ static struct evlist_test test__hybrid_events[] = { · 395 unmodified lines
20282032 .id = 7,
20292033 },
20302034 {
2031− .name = "cpu_core/LLC-loads/,cpu_atom/LLC-load-misses/",
2035+ .name = "cpu_core/LLC-loads/",
20322036 .check = test__hybrid_cache_event,
20332037 .id = 8,
20342038 },
tools/perf/tests/perf-time-to-tsc.c+2−1
@@ -21,6 +21,7 @@ · 20 unmodified lines
2121 #include "mmap.h"
2222 #include "tests.h"
2323 #include "pmu.h"
24+#include "pmu-hybrid.h"
2425
2526 #define CHECK__(x) { \
2627 while ((x) < 0) { \
@@ -93,7 +94,7 @@ int test__perf_time_to_tsc(struct test *test __maybe_unused, int subtest __maybe · 66 unmodified lines
9394 * For hybrid "cycles:u", it creates two events.
9495 * Init the second evsel here.
9596 */
96− if (perf_pmu__has_hybrid()) {
97+ if (perf_pmu__has_hybrid() && perf_pmu__hybrid_mounted("cpu_atom")) {
9798 evsel = evsel__next(evsel);
9899 evsel->core.attr.comm = 1;
99100 evsel->core.attr.disabled = 1;
tools/perf/tests/topology.c+1−0
@@ -61,6 +61,7 @@ static int session_write_header(char *path) · 60 unmodified lines
6161 TEST_ASSERT_VAL("failed to write header",
6262 !perf_session__write_header(session, session->evlist, data.file.fd, true));
6363
64+ evlist__delete(session->evlist);
6465 perf_session__delete(session);
6566
6667 return 0;
tools/perf/util/cs-etm.c+167−1
@@ -2683,6 +2683,172 @@ static u64 *cs_etm__create_meta_blk(u64 *buff_in, int *buff_in_offset, · 2682 unmodified lines
26832683 return metadata;
26842684 }
26852685
2686+/**
2687+ * Puts a fragment of an auxtrace buffer into the auxtrace queues based
2688+ * on the bounds of aux_event, if it matches with the buffer that's at
2689+ * file_offset.
2690+ *
2691+ * Normally, whole auxtrace buffers would be added to the queue. But we
2692+ * want to reset the decoder for every PERF_RECORD_AUX event, and the decoder
2693+ * is reset across each buffer, so splitting the buffers up in advance has
2694+ * the same effect.
2695+ */
2696+static int cs_etm__queue_aux_fragment(struct perf_session *session, off_t file_offset, size_t sz,
2697+ struct perf_record_aux *aux_event, struct perf_sample *sample)
2698+{
2699+ int err;
2700+ char buf[PERF_SAMPLE_MAX_SIZE];
2701+ union perf_event *auxtrace_event_union;
2702+ struct perf_record_auxtrace *auxtrace_event;
2703+ union perf_event auxtrace_fragment;
2704+ __u64 aux_offset, aux_size;
2705+
2706+ struct cs_etm_auxtrace *etm = container_of(session->auxtrace,
2707+ struct cs_etm_auxtrace,
2708+ auxtrace);
2709+
2710+ /*
2711+ * There should be a PERF_RECORD_AUXTRACE event at the file_offset that we got
2712+ * from looping through the auxtrace index.
2713+ */
2714+ err = perf_session__peek_event(session, file_offset, buf,
2715+ PERF_SAMPLE_MAX_SIZE, &auxtrace_event_union, NULL);
2716+ if (err)
2717+ return err;
2718+ auxtrace_event = &auxtrace_event_union->auxtrace;
2719+ if (auxtrace_event->header.type != PERF_RECORD_AUXTRACE)
2720+ return -EINVAL;
2721+
2722+ if (auxtrace_event->header.size < sizeof(struct perf_record_auxtrace) ||
2723+ auxtrace_event->header.size != sz) {
2724+ return -EINVAL;
2725+ }
2726+
2727+ /*
2728+ * In per-thread mode, CPU is set to -1, but TID will be set instead. See
2729+ * auxtrace_mmap_params__set_idx(). Return 'not found' if neither CPU nor TID match.
2730+ */
2731+ if ((auxtrace_event->cpu == (__u32) -1 && auxtrace_event->tid != sample->tid) ||
2732+ auxtrace_event->cpu != sample->cpu)
2733+ return 1;
2734+
2735+ if (aux_event->flags & PERF_AUX_FLAG_OVERWRITE) {
2736+ /*
2737+ * Clamp size in snapshot mode. The buffer size is clamped in
2738+ * __auxtrace_mmap__read() for snapshots, so the aux record size doesn't reflect
2739+ * the buffer size.
2740+ */
2741+ aux_size = min(aux_event->aux_size, auxtrace_event->size);
2742+
2743+ /*
2744+ * In this mode, the head also points to the end of the buffer so aux_offset
2745+ * needs to have the size subtracted so it points to the beginning as in normal mode
2746+ */
2747+ aux_offset = aux_event->aux_offset - aux_size;
2748+ } else {
2749+ aux_size = aux_event->aux_size;
2750+ aux_offset = aux_event->aux_offset;
2751+ }
2752+
2753+ if (aux_offset >= auxtrace_event->offset &&
2754+ aux_offset + aux_size <= auxtrace_event->offset + auxtrace_event->size) {
2755+ /*
2756+ * If this AUX event was inside this buffer somewhere, create a new auxtrace event
2757+ * based on the sizes of the aux event, and queue that fragment.
2758+ */
2759+ auxtrace_fragment.auxtrace = *auxtrace_event;
2760+ auxtrace_fragment.auxtrace.size = aux_size;
2761+ auxtrace_fragment.auxtrace.offset = aux_offset;
2762+ file_offset += aux_offset - auxtrace_event->offset + auxtrace_event->header.size;
2763+
2764+ pr_debug3("CS ETM: Queue buffer size: %#"PRI_lx64" offset: %#"PRI_lx64
2765+ " tid: %d cpu: %d\n", aux_size, aux_offset, sample->tid, sample->cpu);
2766+ return auxtrace_queues__add_event(&etm->queues, session, &auxtrace_fragment,
2767+ file_offset, NULL);
2768+ }
2769+
2770+ /* Wasn't inside this buffer, but there were no parse errors. 1 == 'not found' */
2771+ return 1;
2772+}
2773+
2774+static int cs_etm__queue_aux_records_cb(struct perf_session *session, union perf_event *event,
2775+ u64 offset __maybe_unused, void *data __maybe_unused)
2776+{
2777+ struct perf_sample sample;
2778+ int ret;
2779+ struct auxtrace_index_entry *ent;
2780+ struct auxtrace_index *auxtrace_index;
2781+ struct evsel *evsel;
2782+ size_t i;
2783+
2784+ /* Don't care about any other events, we're only queuing buffers for AUX events */
2785+ if (event->header.type != PERF_RECORD_AUX)
2786+ return 0;
2787+
2788+ if (event->header.size < sizeof(struct perf_record_aux))
2789+ return -EINVAL;
2790+
2791+ /* Truncated Aux records can have 0 size and shouldn't result in anything being queued. */
2792+ if (!event->aux.aux_size)
2793+ return 0;
2794+
2795+ /*
2796+ * Parse the sample, we need the sample_id_all data that comes after the event so that the
2797+ * CPU or PID can be matched to an AUXTRACE buffer's CPU or PID.
2798+ */
2799+ evsel = evlist__event2evsel(session->evlist, event);
2800+ if (!evsel)
2801+ return -EINVAL;
2802+ ret = evsel__parse_sample(evsel, event, &sample);
2803+ if (ret)
2804+ return ret;
2805+
2806+ /*
2807+ * Loop through the auxtrace index to find the buffer that matches up with this aux event.
2808+ */
2809+ list_for_each_entry(auxtrace_index, &session->auxtrace_index, list) {
2810+ for (i = 0; i < auxtrace_index->nr; i++) {
2811+ ent = &auxtrace_index->entries[i];
2812+ ret = cs_etm__queue_aux_fragment(session, ent->file_offset,
2813+ ent->sz, &event->aux, &sample);
2814+ /*
2815+ * Stop search on error or successful values. Continue search on
2816+ * 1 ('not found')
2817+ */
2818+ if (ret != 1)
2819+ return ret;
2820+ }
2821+ }
2822+
2823+ /*
2824+ * Couldn't find the buffer corresponding to this aux record, something went wrong. Warn but
2825+ * don't exit with an error because it will still be possible to decode other aux records.
2826+ */
2827+ pr_err("CS ETM: Couldn't find auxtrace buffer for aux_offset: %#"PRI_lx64
2828+ " tid: %d cpu: %d\n", event->aux.aux_offset, sample.tid, sample.cpu);
2829+ return 0;
2830+}
2831+
2832+static int cs_etm__queue_aux_records(struct perf_session *session)
2833+{
2834+ struct auxtrace_index *index = list_first_entry_or_null(&session->auxtrace_index,
2835+ struct auxtrace_index, list);
2836+ if (index && index->nr > 0)
2837+ return perf_session__peek_events(session, session->header.data_offset,
2838+ session->header.data_size,
2839+ cs_etm__queue_aux_records_cb, NULL);
2840+
2841+ /*
2842+ * We would get here if there are no entries in the index (either no auxtrace
2843+ * buffers or no index at all). Fail silently as there is the possibility of
2844+ * queueing them in cs_etm__process_auxtrace_event() if etm->data_queued is still
2845+ * false.
2846+ *
2847+ * In that scenario, buffers will not be split by AUX records.
2848+ */
2849+ return 0;
2850+}
2851+
26862852 int cs_etm__process_auxtrace_info(union perf_event *event,
26872853 struct perf_session *session)
26882854 {
@@ -2883,7 +3049,7 @@ int cs_etm__process_auxtrace_info(union perf_event *event, · 194 unmodified lines
28833049 if (err)
28843050 goto err_delete_thread;
28853051
2886− err = auxtrace_queues__process_index(&etm->queues, session);
3052+ err = cs_etm__queue_aux_records(session);
28873053 if (err)
28883054 goto err_delete_thread;
28893055
tools/perf/util/data.c+1−1
@@ -20,7 +20,7 @@ · 19 unmodified lines
2020
2121 static void close_dir(struct perf_data_file *files, int nr)
2222 {
23− while (--nr >= 1) {
23+ while (--nr >= 0) {
2424 close(files[nr].fd);
2525 zfree(&files[nr].path);
2626 }
tools/perf/util/dso.c+3−1
@@ -1154,8 +1154,10 @@ struct map *dso__new_map(const char *name) · 1153 unmodified lines
11541154 struct map *map = NULL;
11551155 struct dso *dso = dso__new(name);
11561156
1157− if (dso)
1157+ if (dso) {
11581158 map = map__new2(0, dso);
1159+ dso__put(dso);
1160+ }
11591161
11601162 return map;
11611163 }
tools/perf/util/dwarf-aux.c+4−4
@@ -113,14 +113,14 @@ static Dwarf_Line *cu_getsrc_die(Dwarf_Die *cu_die, Dwarf_Addr addr) · 112 unmodified lines
113113 *
114114 * Find a line number and file name for @addr in @cu_die.
115115 */
116−int cu_find_lineinfo(Dwarf_Die *cu_die, unsigned long addr,
117− const char **fname, int *lineno)
116+int cu_find_lineinfo(Dwarf_Die *cu_die, Dwarf_Addr addr,
117+ const char **fname, int *lineno)
118118 {
119119 Dwarf_Line *line;
120120 Dwarf_Die die_mem;
121121 Dwarf_Addr faddr;
122122
123− if (die_find_realfunc(cu_die, (Dwarf_Addr)addr, &die_mem)
123+ if (die_find_realfunc(cu_die, addr, &die_mem)
124124 && die_entrypc(&die_mem, &faddr) == 0 &&
125125 faddr == addr) {
126126 *fname = dwarf_decl_file(&die_mem);
@@ -128,7 +128,7 @@ int cu_find_lineinfo(Dwarf_Die *cu_die, unsigned long addr, · 1 unmodified line
128128 goto out;
129129 }
130130
131− line = cu_getsrc_die(cu_die, (Dwarf_Addr)addr);
131+ line = cu_getsrc_die(cu_die, addr);
132132 if (line && dwarf_lineno(line, lineno) == 0) {
133133 *fname = dwarf_linesrc(line, NULL, NULL);
134134 if (!*fname)
tools/perf/util/dwarf-aux.h+1−1
@@ -19,7 +19,7 @@ const char *cu_find_realpath(Dwarf_Die *cu_die, const char *fname); · 18 unmodified lines
1919 const char *cu_get_comp_dir(Dwarf_Die *cu_die);
2020
2121 /* Get a line number and file name for given address */
22−int cu_find_lineinfo(Dwarf_Die *cudie, unsigned long addr,
22+int cu_find_lineinfo(Dwarf_Die *cudie, Dwarf_Addr addr,
2323 const char **fname, int *lineno);
2424
2525 /* Walk on functions at given address */
tools/perf/util/env.c+2−0
@@ -186,10 +186,12 @@ void perf_env__exit(struct perf_env *env) · 185 unmodified lines
186186 zfree(&env->cpuid);
187187 zfree(&env->cmdline);
188188 zfree(&env->cmdline_argv);
189+ zfree(&env->sibling_dies);
189190 zfree(&env->sibling_cores);
190191 zfree(&env->sibling_threads);
191192 zfree(&env->pmu_mappings);
192193 zfree(&env->cpu);
194+ zfree(&env->cpu_pmu_caps);
193195 zfree(&env->numa_map);
194196
195197 for (i = 0; i < env->nr_numa_nodes; i++)
tools/perf/util/lzma.c+5−3
@@ -69,7 +69,7 @@ int lzma_decompress_to_file(const char *input, int output_fd) · 68 unmodified lines
6969
7070 if (ferror(infile)) {
7171 pr_err("lzma: read error: %s\n", strerror(errno));
72− goto err_fclose;
72+ goto err_lzma_end;
7373 }
7474
7575 if (feof(infile))
@@ -83,7 +83,7 @@ int lzma_decompress_to_file(const char *input, int output_fd) · 7 unmodified lines
8383
8484 if (writen(output_fd, buf_out, write_size) != write_size) {
8585 pr_err("lzma: write error: %s\n", strerror(errno));
86− goto err_fclose;
86+ goto err_lzma_end;
8787 }
8888
8989 strm.next_out = buf_out;
@@ -95,11 +95,13 @@ int lzma_decompress_to_file(const char *input, int output_fd) · 5 unmodified lines
9595 break;
9696
9797 pr_err("lzma: failed %s\n", lzma_strerror(ret));
98− goto err_fclose;
98+ goto err_lzma_end;
9999 }
100100 }
101101
102102 err = 0;
103+err_lzma_end:
104+ lzma_end(&strm);
103105 err_fclose:
104106 fclose(infile);
105107 return err;
tools/perf/util/map.c+2−0
@@ -192,6 +192,8 @@ struct map *map__new(struct machine *machine, u64 start, u64 len, · 191 unmodified lines
192192 if (!(prot & PROT_EXEC))
193193 dso__set_loaded(dso);
194194 }
195+
196+ nsinfo__put(dso->nsinfo);
195197 dso->nsinfo = nsi;
196198
197199 if (build_id__is_defined(bid))
tools/perf/util/pfm.c+1−1
@@ -99,7 +99,7 @@ int parse_libpfm_events_option(const struct option *opt, const char *str, · 98 unmodified lines
9999 grp_leader = evsel;
100100
101101 if (grp_evt > -1) {
102− evsel->leader = grp_leader;
102+ evsel__set_leader(evsel, grp_leader);
103103 grp_leader->core.nr_members++;
104104 grp_evt++;
105105 }
tools/perf/util/pmu.c+8−1
@@ -950,6 +950,13 @@ static struct perf_pmu *pmu_lookup(const char *name) · 949 unmodified lines
950950 LIST_HEAD(format);
951951 LIST_HEAD(aliases);
952952 __u32 type;
953+ bool is_hybrid = perf_pmu__hybrid_mounted(name);
954+
955+ /*
956+ * Check pmu name for hybrid and the pmu may be invalid in sysfs
957+ */
958+ if (!strncmp(name, "cpu_", 4) && !is_hybrid)
959+ return NULL;
953960
954961 /*
955962 * The pmu data we store & need consists of the pmu
@@ -978,7 +985,7 @@ static struct perf_pmu *pmu_lookup(const char *name) · 22 unmodified lines
978985 pmu->is_uncore = pmu_is_uncore(name);
979986 if (pmu->is_uncore)
980987 pmu->id = pmu_id(name);
981− pmu->is_hybrid = perf_pmu__hybrid_mounted(name);
988+ pmu->is_hybrid = is_hybrid;
982989 pmu->max_precise = pmu_max_precise(name);
983990 pmu_add_cpu_aliases(&aliases, pmu);
984991 pmu_add_sys_aliases(&aliases, pmu);
tools/perf/util/probe-event.c+26−27
@@ -179,8 +179,10 @@ struct map *get_target_map(const char *target, struct nsinfo *nsi, bool user) · 178 unmodified lines
179179 struct map *map;
180180
181181 map = dso__new_map(target);
182− if (map && map->dso)
182+ if (map && map->dso) {
183+ nsinfo__put(map->dso->nsinfo);
183184 map->dso->nsinfo = nsinfo__get(nsi);
185+ }
184186 return map;
185187 } else {
186188 return kernel_get_module_map(target);
@@ -237,8 +239,8 @@ static void clear_probe_trace_events(struct probe_trace_event *tevs, int ntevs) · 50 unmodified lines
237239 clear_probe_trace_event(tevs + i);
238240 }
239241
240−static bool kprobe_blacklist__listed(unsigned long address);
241−static bool kprobe_warn_out_range(const char *symbol, unsigned long address)
242+static bool kprobe_blacklist__listed(u64 address);
243+static bool kprobe_warn_out_range(const char *symbol, u64 address)
242244 {
243245 struct map *map;
244246 bool ret = false;
@@ -398,8 +400,7 @@ static int find_alternative_probe_point(struct debuginfo *dinfo, · 153 unmodified lines
398400 pr_debug("Symbol %s address found : %" PRIx64 "\n",
399401 pp->function, address);
400402
401− ret = debuginfo__find_probe_point(dinfo, (unsigned long)address,
402− result);
403+ ret = debuginfo__find_probe_point(dinfo, address, result);
403404 if (ret <= 0)
404405 ret = (!ret) ? -ENOENT : ret;
405406 else {
@@ -587,7 +588,7 @@ static void debuginfo_cache__exit(void) · 181 unmodified lines
587588 }
588589
589590
590−static int get_text_start_address(const char *exec, unsigned long *address,
591+static int get_text_start_address(const char *exec, u64 *address,
591592 struct nsinfo *nsi)
592593 {
593594 Elf *elf;
@@ -632,7 +633,7 @@ static int find_perf_probe_point_from_dwarf(struct probe_trace_point *tp, · 38 unmodified lines
632633 bool is_kprobe)
633634 {
634635 struct debuginfo *dinfo = NULL;
635− unsigned long stext = 0;
636+ u64 stext = 0;
636637 u64 addr = tp->address;
637638 int ret = -ENOENT;
638639
@@ -660,8 +661,7 @@ static int find_perf_probe_point_from_dwarf(struct probe_trace_point *tp, · 21 unmodified lines
660661
661662 dinfo = debuginfo_cache__open(tp->module, verbose <= 0);
662663 if (dinfo)
663− ret = debuginfo__find_probe_point(dinfo,
664− (unsigned long)addr, pp);
664+ ret = debuginfo__find_probe_point(dinfo, addr, pp);
665665 else
666666 ret = -ENOENT;
667667
@@ -676,7 +676,7 @@ error: · 8 unmodified lines
676676
677677 /* Adjust symbol name and address */
678678 static int post_process_probe_trace_point(struct probe_trace_point *tp,
679− struct map *map, unsigned long offs)
679+ struct map *map, u64 offs)
680680 {
681681 struct symbol *sym;
682682 u64 addr = tp->address - offs;
@@ -719,7 +719,7 @@ post_process_offline_probe_trace_events(struct probe_trace_event *tevs, · 36 unmodified lines
719719 int ntevs, const char *pathname)
720720 {
721721 struct map *map;
722− unsigned long stext = 0;
722+ u64 stext = 0;
723723 int i, ret = 0;
724724
725725 /* Prepare a map for offline binary */
@@ -745,7 +745,7 @@ static int add_exec_to_probe_trace_events(struct probe_trace_event *tevs, · 19 unmodified lines
745745 struct nsinfo *nsi)
746746 {
747747 int i, ret = 0;
748− unsigned long stext = 0;
748+ u64 stext = 0;
749749
750750 if (!exec)
751751 return 0;
@@ -790,7 +790,7 @@ post_process_module_probe_trace_events(struct probe_trace_event *tevs, · 38 unmodified lines
790790 mod_name = find_module_name(module);
791791 for (i = 0; i < ntevs; i++) {
792792 ret = post_process_probe_trace_point(&tevs[i].point,
793− map, (unsigned long)text_offs);
793+ map, text_offs);
794794 if (ret < 0)
795795 break;
796796 tevs[i].point.module =
@@ -1534,7 +1534,7 @@ static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev) · 737 unmodified lines
15341534 * so tmp[1] should always valid (but could be '\0').
15351535 */
15361536 if (tmp && !strncmp(tmp, "0x", 2)) {
1537− pp->abs_address = strtoul(pp->function, &tmp, 0);
1537+ pp->abs_address = strtoull(pp->function, &tmp, 0);
15381538 if (*tmp != '\0') {
15391539 semantic_error("Invalid absolute address.\n");
15401540 return -EINVAL;
@@ -1909,7 +1909,7 @@ int parse_probe_trace_command(const char *cmd, struct probe_trace_event *tev) · 368 unmodified lines
19091909 argv[i] = NULL;
19101910 argc -= 1;
19111911 } else
1912− tp->address = strtoul(fmt1_str, NULL, 0);
1912+ tp->address = strtoull(fmt1_str, NULL, 0);
19131913 } else {
19141914 /* Only the symbol-based probe has offset */
19151915 tp->symbol = strdup(fmt1_str);
@@ -2155,7 +2155,7 @@ synthesize_uprobe_trace_def(struct probe_trace_point *tp, struct strbuf *buf) · 239 unmodified lines
21552155 return -EINVAL;
21562156
21572157 /* Use the tp->address for uprobes */
2158− err = strbuf_addf(buf, "%s:0x%lx", tp->module, tp->address);
2158+ err = strbuf_addf(buf, "%s:0x%" PRIx64, tp->module, tp->address);
21592159
21602160 if (err >= 0 && tp->ref_ctr_offset) {
21612161 if (!uprobe_ref_ctr_is_supported())
@@ -2170,7 +2170,7 @@ synthesize_kprobe_trace_def(struct probe_trace_point *tp, struct strbuf *buf) · 8 unmodified lines
21702170 {
21712171 if (!strncmp(tp->symbol, "0x", 2)) {
21722172 /* Absolute address. See try_to_find_absolute_address() */
2173− return strbuf_addf(buf, "%s%s0x%lx", tp->module ?: "",
2173+ return strbuf_addf(buf, "%s%s0x%" PRIx64, tp->module ?: "",
21742174 tp->module ? ":" : "", tp->address);
21752175 } else {
21762176 return strbuf_addf(buf, "%s%s%s+%lu", tp->module ?: "",
@@ -2269,7 +2269,7 @@ static int convert_to_perf_probe_point(struct probe_trace_point *tp, · 92 unmodified lines
22692269 pp->function = strdup(tp->symbol);
22702270 pp->offset = tp->offset;
22712271 } else {
2272− ret = e_snprintf(buf, 128, "0x%" PRIx64, (u64)tp->address);
2272+ ret = e_snprintf(buf, 128, "0x%" PRIx64, tp->address);
22732273 if (ret < 0)
22742274 return ret;
22752275 pp->function = strdup(buf);
@@ -2450,8 +2450,8 @@ void clear_probe_trace_event(struct probe_trace_event *tev) · 174 unmodified lines
24502450
24512451 struct kprobe_blacklist_node {
24522452 struct list_head list;
2453− unsigned long start;
2454− unsigned long end;
2453+ u64 start;
2454+ u64 end;
24552455 char *symbol;
24562456 };
24572457
@@ -2496,7 +2496,7 @@ static int kprobe_blacklist__load(struct list_head *blacklist) · 38 unmodified lines
24962496 }
24972497 INIT_LIST_HEAD(&node->list);
24982498 list_add_tail(&node->list, blacklist);
2499− if (sscanf(buf, "0x%lx-0x%lx", &node->start, &node->end) != 2) {
2499+ if (sscanf(buf, "0x%" PRIx64 "-0x%" PRIx64, &node->start, &node->end) != 2) {
25002500 ret = -EINVAL;
25012501 break;
25022502 }
@@ -2512,7 +2512,7 @@ static int kprobe_blacklist__load(struct list_head *blacklist) · 9 unmodified lines
25122512 ret = -ENOMEM;
25132513 break;
25142514 }
2515− pr_debug2("Blacklist: 0x%lx-0x%lx, %s\n",
2515+ pr_debug2("Blacklist: 0x%" PRIx64 "-0x%" PRIx64 ", %s\n",
25162516 node->start, node->end, node->symbol);
25172517 ret++;
25182518 }
@@ -2524,8 +2524,7 @@ static int kprobe_blacklist__load(struct list_head *blacklist) · 5 unmodified lines
25242524 }
25252525
25262526 static struct kprobe_blacklist_node *
2527−kprobe_blacklist__find_by_address(struct list_head *blacklist,
2528− unsigned long address)
2527+kprobe_blacklist__find_by_address(struct list_head *blacklist, u64 address)
25292528 {
25302529 struct kprobe_blacklist_node *node;
25312530
@@ -2553,7 +2552,7 @@ static void kprobe_blacklist__release(void) · 21 unmodified lines
25532552 kprobe_blacklist__delete(&kprobe_blacklist);
25542553 }
25552554
2556−static bool kprobe_blacklist__listed(unsigned long address)
2555+static bool kprobe_blacklist__listed(u64 address)
25572556 {
25582557 return !!kprobe_blacklist__find_by_address(&kprobe_blacklist, address);
25592558 }
@@ -3221,7 +3220,7 @@ static int try_to_find_absolute_address(struct perf_probe_event *pev, · 661 unmodified lines
32213220 * In __add_probe_trace_events, a NULL symbol is interpreted as
32223221 * invalid.
32233222 */
3224− if (asprintf(&tp->symbol, "0x%lx", tp->address) < 0)
3223+ if (asprintf(&tp->symbol, "0x%" PRIx64, tp->address) < 0)
32253224 goto errout;
32263225
32273226 /* For kprobe, check range */
@@ -3232,7 +3231,7 @@ static int try_to_find_absolute_address(struct perf_probe_event *pev, · 4 unmodified lines
32323231 goto errout;
32333232 }
32343233
3235− if (asprintf(&tp->realname, "abs_%lx", tp->address) < 0)
3234+ if (asprintf(&tp->realname, "abs_%" PRIx64, tp->address) < 0)
32363235 goto errout;
32373236
32383237 if (pev->target) {
tools/perf/util/probe-event.h+2−2
@@ -33,7 +33,7 @@ struct probe_trace_point { · 32 unmodified lines
3333 char *module; /* Module name */
3434 unsigned long offset; /* Offset from symbol */
3535 unsigned long ref_ctr_offset; /* SDT reference counter offset */
36− unsigned long address; /* Actual address of the trace point */
36+ u64 address; /* Actual address of the trace point */
3737 bool retprobe; /* Return probe flag */
3838 };
3939
@@ -70,7 +70,7 @@ struct perf_probe_point { · 30 unmodified lines
7070 bool retprobe; /* Return probe flag */
7171 char *lazy_line; /* Lazy matching pattern */
7272 unsigned long offset; /* Offset from function entry */
73− unsigned long abs_address; /* Absolute address of the point */
73+ u64 abs_address; /* Absolute address of the point */
7474 };
7575
7676 /* Perf probe probing argument field chain */
tools/perf/util/probe-file.c+2−2
@@ -377,11 +377,11 @@ int probe_file__del_events(int fd, struct strfilter *filter) · 376 unmodified lines
377377
378378 ret = probe_file__get_events(fd, filter, namelist);
379379 if (ret < 0)
380− return ret;
380+ goto out;
381381
382382 ret = probe_file__del_strlist(fd, namelist);
383+out:
383384 strlist__delete(namelist);
384−
385385 return ret;
386386 }
387387
tools/perf/util/probe-finder.c+7−8
@@ -668,7 +668,7 @@ static int convert_to_trace_point(Dwarf_Die *sp_die, Dwfl_Module *mod, · 667 unmodified lines
668668 }
669669
670670 tp->offset = (unsigned long)(paddr - eaddr);
671− tp->address = (unsigned long)paddr;
671+ tp->address = paddr;
672672 tp->symbol = strdup(symbol);
673673 if (!tp->symbol)
674674 return -ENOMEM;
@@ -1707,7 +1707,7 @@ int debuginfo__get_text_offset(struct debuginfo *dbg, Dwarf_Addr *offs, · 1032 unmodified lines
17071707 }
17081708
17091709 /* Reverse search */
1710−int debuginfo__find_probe_point(struct debuginfo *dbg, unsigned long addr,
1710+int debuginfo__find_probe_point(struct debuginfo *dbg, u64 addr,
17111711 struct perf_probe_point *ppt)
17121712 {
17131713 Dwarf_Die cudie, spdie, indie;
@@ -1720,14 +1720,14 @@ int debuginfo__find_probe_point(struct debuginfo *dbg, unsigned long addr, · 6 unmodified lines
17201720 addr += baseaddr;
17211721 /* Find cu die */
17221722 if (!dwarf_addrdie(dbg->dbg, (Dwarf_Addr)addr, &cudie)) {
1723− pr_warning("Failed to find debug information for address %lx\n",
1723+ pr_warning("Failed to find debug information for address %" PRIx64 "\n",
17241724 addr);
17251725 ret = -EINVAL;
17261726 goto end;
17271727 }
17281728
17291729 /* Find a corresponding line (filename and lineno) */
1730− cu_find_lineinfo(&cudie, addr, &fname, &lineno);
1730+ cu_find_lineinfo(&cudie, (Dwarf_Addr)addr, &fname, &lineno);
17311731 /* Don't care whether it failed or not */
17321732
17331733 /* Find a corresponding function (name, baseline and baseaddr) */
@@ -1742,7 +1742,7 @@ int debuginfo__find_probe_point(struct debuginfo *dbg, unsigned long addr, · 8 unmodified lines
17421742 }
17431743
17441744 fname = dwarf_decl_file(&spdie);
1745− if (addr == (unsigned long)baseaddr) {
1745+ if (addr == baseaddr) {
17461746 /* Function entry - Relative line number is 0 */
17471747 lineno = baseline;
17481748 goto post;
@@ -1788,7 +1788,7 @@ post: · 39 unmodified lines
17881788 if (lineno)
17891789 ppt->line = lineno - baseline;
17901790 else if (basefunc) {
1791− ppt->offset = addr - (unsigned long)baseaddr;
1791+ ppt->offset = addr - baseaddr;
17921792 func = basefunc;
17931793 }
17941794
@@ -1828,8 +1828,7 @@ static int line_range_add_line(const char *src, unsigned int lineno, · 33 unmodified lines
18281828 }
18291829
18301830 static int line_range_walk_cb(const char *fname, int lineno,
1831− Dwarf_Addr addr __maybe_unused,
1832− void *data)
1831+ Dwarf_Addr addr, void *data)
18331832 {
18341833 struct line_finder *lf = data;
18351834 const char *__fname;
tools/perf/util/probe-finder.h+1−1
@@ -46,7 +46,7 @@ int debuginfo__find_trace_events(struct debuginfo *dbg, · 45 unmodified lines
4646 struct probe_trace_event **tevs);
4747
4848 /* Find a perf_probe_point from debuginfo */
49−int debuginfo__find_probe_point(struct debuginfo *dbg, unsigned long addr,
49+int debuginfo__find_probe_point(struct debuginfo *dbg, u64 addr,
5050 struct perf_probe_point *ppt);
5151
5252 int debuginfo__get_text_offset(struct debuginfo *dbg, Dwarf_Addr *offs,
tools/perf/util/session.c+1−0
@@ -306,6 +306,7 @@ void perf_session__delete(struct perf_session *session) · 305 unmodified lines
306306 evlist__delete(session->evlist);
307307 perf_data__close(session->data);
308308 }
309+ trace_event__cleanup(&session->tevent);
309310 free(session);
310311 }
311312
tools/perf/util/sort.c+1−1
@@ -3370,7 +3370,7 @@ static void add_hpp_sort_string(struct strbuf *sb, struct hpp_dimension *s, int · 3369 unmodified lines
33703370 add_key(sb, s[i].name, llen);
33713371 }
33723372
3373−const char *sort_help(const char *prefix)
3373+char *sort_help(const char *prefix)
33743374 {
33753375 struct strbuf sb;
33763376 char *s;
tools/perf/util/sort.h+1−1
@@ -302,7 +302,7 @@ void reset_output_field(void); · 301 unmodified lines
302302 void sort__setup_elide(FILE *fp);
303303 void perf_hpp__set_elide(int idx, bool elide);
304304
305−const char *sort_help(const char *prefix);
305+char *sort_help(const char *prefix);
306306
307307 int report_parse_ignore_callees_opt(const struct option *opt, const char *arg, int unset);
308308
tools/perf/util/stat-display.c+13−1
@@ -596,6 +596,18 @@ static void collect_all_aliases(struct perf_stat_config *config, struct evsel *c · 595 unmodified lines
596596 }
597597 }
598598
599+static bool is_uncore(struct evsel *evsel)
600+{
601+ struct perf_pmu *pmu = evsel__find_pmu(evsel);
602+
603+ return pmu && pmu->is_uncore;
604+}
605+
606+static bool hybrid_uniquify(struct evsel *evsel)
607+{
608+ return perf_pmu__has_hybrid() && !is_uncore(evsel);
609+}
610+
599611 static bool collect_data(struct perf_stat_config *config, struct evsel *counter,
600612 void (*cb)(struct perf_stat_config *config, struct evsel *counter, void *data,
601613 bool first),
@@ -604,7 +616,7 @@ static bool collect_data(struct perf_stat_config *config, struct evsel *counter, · 2 unmodified lines
604616 if (counter->merged_stat)
605617 return false;
606618 cb(config, counter, data, true);
607− if (config->no_merge)
619+ if (config->no_merge || hybrid_uniquify(counter))
608620 uniquify_event_name(counter);
609621 else if (counter->auto_merge_stats)
610622 collect_all_aliases(config, counter, cb, data);
tools/testing/kunit/kunit.py+2−0
@@ -12,6 +12,8 @@ import sys · 11 unmodified lines
1212 import os
1313 import time
1414
15+assert sys.version_info >= (3, 7), "Python version is too old"
16+
1517 from collections import namedtuple
1618 from enum import Enum, auto
1719
tools/testing/kunit/kunit_kernel.py+2−4
@@ -6,15 +6,13 @@ · 5 unmodified lines
66 # Author: Felix Guo <felixguoxiuping@gmail.com>
77 # Author: Brendan Higgins <brendanhiggins@google.com>
88
9−from __future__ import annotations
109 import importlib.util
1110 import logging
1211 import subprocess
1312 import os
1413 import shutil
1514 import signal
16−from typing import Iterator
17−from typing import Optional
15+from typing import Iterator, Optional, Tuple
1816
1917 from contextlib import ExitStack
2018
@@ -208,7 +206,7 @@ def get_source_tree_ops(arch: str, cross_compile: Optional[str]) -> LinuxSourceT · 187 unmodified lines
208206 raise ConfigError(arch + ' is not a valid arch')
209207
210208 def get_source_tree_ops_from_qemu_config(config_path: str,
211− cross_compile: Optional[str]) -> tuple[
209+ cross_compile: Optional[str]) -> Tuple[
212210 str, LinuxSourceTreeOperations]:
213211 # The module name/path has very little to do with where the actual file
214212 # exists (I learned this through experimentation and could not find it
tools/testing/kunit/kunit_parser.py+4−2
@@ -338,9 +338,11 @@ def bubble_up_suite_errors(test_suites: Iterable[TestSuite]) -> TestStatus: · 337 unmodified lines
338338 def parse_test_result(lines: LineStream) -> TestResult:
339339 consume_non_diagnostic(lines)
340340 if not lines or not parse_tap_header(lines):
341− return TestResult(TestStatus.NO_TESTS, [], lines)
341+ return TestResult(TestStatus.FAILURE_TO_PARSE_TESTS, [], lines)
342342 expected_test_suite_num = parse_test_plan(lines)
343− if not expected_test_suite_num:
343+ if expected_test_suite_num == 0:
344+ return TestResult(TestStatus.NO_TESTS, [], lines)
345+ elif expected_test_suite_num is None:
344346 return TestResult(TestStatus.FAILURE_TO_PARSE_TESTS, [], lines)
345347 test_suites = []
346348 for i in range(1, expected_test_suite_num + 1):
tools/testing/kunit/kunit_tool_test.py+13−3
@@ -157,8 +157,18 @@ class KUnitParserTest(unittest.TestCase): · 156 unmodified lines
157157 kunit_parser.TestStatus.FAILURE,
158158 result.status)
159159
160+ def test_no_header(self):
161+ empty_log = test_data_path('test_is_test_passed-no_tests_run_no_header.log')
162+ with open(empty_log) as file:
163+ result = kunit_parser.parse_run_tests(
164+ kunit_parser.extract_tap_lines(file.readlines()))
165+ self.assertEqual(0, len(result.suites))
166+ self.assertEqual(
167+ kunit_parser.TestStatus.FAILURE_TO_PARSE_TESTS,
168+ result.status)
169+
160170 def test_no_tests(self):
161− empty_log = test_data_path('test_is_test_passed-no_tests_run.log')
171+ empty_log = test_data_path('test_is_test_passed-no_tests_run_with_header.log')
162172 with open(empty_log) as file:
163173 result = kunit_parser.parse_run_tests(
164174 kunit_parser.extract_tap_lines(file.readlines()))
@@ -173,7 +183,7 @@ class KUnitParserTest(unittest.TestCase): · 8 unmodified lines
173183 with open(crash_log) as file:
174184 result = kunit_parser.parse_run_tests(
175185 kunit_parser.extract_tap_lines(file.readlines()))
176− print_mock.assert_any_call(StrContains('no tests run!'))
186+ print_mock.assert_any_call(StrContains('could not parse test results!'))
177187 print_mock.stop()
178188 file.close()
179189
@@ -309,7 +319,7 @@ class KUnitJsonTest(unittest.TestCase): · 129 unmodified lines
309319 result["sub_groups"][1]["test_cases"][0])
310320
311321 def test_no_tests_json(self):
312− result = self._json_for('test_is_test_passed-no_tests_run.log')
322+ result = self._json_for('test_is_test_passed-no_tests_run_with_header.log')
313323 self.assertEqual(0, len(result['sub_groups']))
314324
315325 class StrContains(str):
tools/testing/kunit/test_data/test_is_test_passed-no_tests_run_no_header.logrenamed from tools/testing/kunit/test_data/test_is_test_passed-no_tests_run.log+0−0

File renamed without changes.

tools/testing/kunit/test_data/test_is_test_passed-no_tests_run_with_header.log+2−0
@@ -0,0 +1,2 @@
1+TAP version 14
2+1..0
tools/testing/selftests/kvm/include/kvm_util.h+2−1
@@ -45,6 +45,7 @@ enum vm_guest_mode { · 44 unmodified lines
4545 VM_MODE_P40V48_64K,
4646 VM_MODE_PXXV48_4K, /* For 48bits VA but ANY bits PA */
4747 VM_MODE_P47V64_4K,
48+ VM_MODE_P44V64_4K,
4849 NUM_VM_MODES,
4950 };
5051
@@ -62,7 +63,7 @@ enum vm_guest_mode { · 11 unmodified lines
6263
6364 #elif defined(__s390x__)
6465
65−#define VM_MODE_DEFAULT VM_MODE_P47V64_4K
66+#define VM_MODE_DEFAULT VM_MODE_P44V64_4K
6667 #define MIN_PAGE_SHIFT 12U
6768 #define ptes_per_page(page_size) ((page_size) / 16)
6869
tools/testing/selftests/kvm/lib/aarch64/processor.c+1−1
@@ -401,7 +401,7 @@ unexpected_exception: · 400 unmodified lines
401401 void vm_init_descriptor_tables(struct kvm_vm *vm)
402402 {
403403 vm->handlers = vm_vaddr_alloc(vm, sizeof(struct handlers),
404− vm->page_size, 0, 0);
404+ vm->page_size);
405405
406406 *(vm_vaddr_t *)addr_gva2hva(vm, (vm_vaddr_t)(&exception_handlers)) = vm->handlers;
407407 }
tools/testing/selftests/kvm/lib/guest_modes.c+16−0
@@ -22,6 +22,22 @@ void guest_modes_append_default(void) · 21 unmodified lines
2222 }
2323 }
2424 #endif
25+#ifdef __s390x__
26+ {
27+ int kvm_fd, vm_fd;
28+ struct kvm_s390_vm_cpu_processor info;
29+
30+ kvm_fd = open_kvm_dev_path_or_exit();
31+ vm_fd = ioctl(kvm_fd, KVM_CREATE_VM, 0);
32+ kvm_device_access(vm_fd, KVM_S390_VM_CPU_MODEL,
33+ KVM_S390_VM_CPU_PROCESSOR, &info, false);
34+ close(vm_fd);
35+ close(kvm_fd);
36+ /* Starting with z13 we have 47bits of physical address */
37+ if (info.ibc >= 0x30)
38+ guest_mode_append(VM_MODE_P47V64_4K, true, true);
39+ }
40+#endif
2541 }
2642
2743 void for_each_guest_mode(void (*func)(enum vm_guest_mode, void *), void *arg)
tools/testing/selftests/kvm/lib/kvm_util.c+5−0
@@ -176,6 +176,7 @@ const char *vm_guest_mode_string(uint32_t i) · 175 unmodified lines
176176 [VM_MODE_P40V48_64K] = "PA-bits:40, VA-bits:48, 64K pages",
177177 [VM_MODE_PXXV48_4K] = "PA-bits:ANY, VA-bits:48, 4K pages",
178178 [VM_MODE_P47V64_4K] = "PA-bits:47, VA-bits:64, 4K pages",
179+ [VM_MODE_P44V64_4K] = "PA-bits:44, VA-bits:64, 4K pages",
179180 };
180181 _Static_assert(sizeof(strings)/sizeof(char *) == NUM_VM_MODES,
181182 "Missing new mode strings?");
@@ -194,6 +195,7 @@ const struct vm_guest_mode_params vm_guest_mode_params[] = { · 12 unmodified lines
194195 { 40, 48, 0x10000, 16 },
195196 { 0, 0, 0x1000, 12 },
196197 { 47, 64, 0x1000, 12 },
198+ { 44, 64, 0x1000, 12 },
197199 };
198200 _Static_assert(sizeof(vm_guest_mode_params)/sizeof(struct vm_guest_mode_params) == NUM_VM_MODES,
199201 "Missing new mode params?");
@@ -282,6 +284,9 @@ struct kvm_vm *vm_create(enum vm_guest_mode mode, uint64_t phy_pages, int perm) · 82 unmodified lines
282284 case VM_MODE_P47V64_4K:
283285 vm->pgtable_levels = 5;
284286 break;
287+ case VM_MODE_P44V64_4K:
288+ vm->pgtable_levels = 5;
289+ break;
285290 default:
286291 TEST_FAIL("Unknown guest mode, mode: 0x%x", mode);
287292 }
tools/testing/selftests/kvm/set_memory_region_test.c+2−1
@@ -377,7 +377,8 @@ static void test_add_max_memory_regions(void) · 376 unmodified lines
377377 (max_mem_slots - 1), MEM_REGION_SIZE >> 10);
378378
379379 mem = mmap(NULL, (size_t)max_mem_slots * MEM_REGION_SIZE + alignment,
380− PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
380+ PROT_READ | PROT_WRITE,
381+ MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0);
381382 TEST_ASSERT(mem != MAP_FAILED, "Failed to mmap() host");
382383 mem_aligned = (void *)(((size_t) mem + alignment - 1) & ~(alignment - 1));
383384
tools/testing/selftests/kvm/x86_64/hyperv_features.c+1−1
@@ -615,7 +615,7 @@ int main(void) · 614 unmodified lines
615615
616616 vm_init_descriptor_tables(vm);
617617 vcpu_init_descriptor_tables(vm, VCPU_ID);
618− vm_handle_exception(vm, GP_VECTOR, guest_gp_handler);
618+ vm_install_exception_handler(vm, GP_VECTOR, guest_gp_handler);
619619
620620 pr_info("Testing access to Hyper-V specific MSRs\n");
621621 guest_test_msrs_access(vm, addr_gva2hva(vm, msr_gva),
tools/testing/selftests/kvm/x86_64/mmu_role_test.c+1−1
@@ -71,7 +71,7 @@ static void mmu_role_test(u32 *cpuid_reg, u32 evil_cpuid_val) · 70 unmodified lines
7171 /* Set up a #PF handler to eat the RSVD #PF and signal all done! */
7272 vm_init_descriptor_tables(vm);
7373 vcpu_init_descriptor_tables(vm, VCPU_ID);
74− vm_handle_exception(vm, PF_VECTOR, guest_pf_handler);
74+ vm_install_exception_handler(vm, PF_VECTOR, guest_pf_handler);
7575
7676 r = _vcpu_run(vm, VCPU_ID);
7777 TEST_ASSERT(r == 0, "vcpu_run failed: %d\n", r);
tools/testing/selftests/kvm/x86_64/smm_test.c+64−6
@@ -53,15 +53,28 @@ static inline void sync_with_host(uint64_t phase) · 52 unmodified lines
5353 : "+a" (phase));
5454 }
5555
56−void self_smi(void)
56+static void self_smi(void)
5757 {
5858 x2apic_write_reg(APIC_ICR,
5959 APIC_DEST_SELF | APIC_INT_ASSERT | APIC_DM_SMI);
6060 }
6161
62−void guest_code(void *arg)
62+static void l2_guest_code(void)
6363 {
64+ sync_with_host(8);
65+
66+ sync_with_host(10);
67+
68+ vmcall();
69+}
70+
71+static void guest_code(void *arg)
72+{
73+ #define L2_GUEST_STACK_SIZE 64
74+ unsigned long l2_guest_stack[L2_GUEST_STACK_SIZE];
6475 uint64_t apicbase = rdmsr(MSR_IA32_APICBASE);
76+ struct svm_test_data *svm = arg;
77+ struct vmx_pages *vmx_pages = arg;
6578
6679 sync_with_host(1);
6780
@@ -74,21 +87,50 @@ void guest_code(void *arg) · 6 unmodified lines
7487 sync_with_host(4);
7588
7689 if (arg) {
77− if (cpu_has_svm())
78− generic_svm_setup(arg, NULL, NULL);
79− else
80− GUEST_ASSERT(prepare_for_vmx_operation(arg));
90+ if (cpu_has_svm()) {
91+ generic_svm_setup(svm, l2_guest_code,
92+ &l2_guest_stack[L2_GUEST_STACK_SIZE]);
93+ } else {
94+ GUEST_ASSERT(prepare_for_vmx_operation(vmx_pages));
95+ GUEST_ASSERT(load_vmcs(vmx_pages));
96+ prepare_vmcs(vmx_pages, l2_guest_code,
97+ &l2_guest_stack[L2_GUEST_STACK_SIZE]);
98+ }
8199
82100 sync_with_host(5);
83101
84102 self_smi();
85103
86104 sync_with_host(7);
105+
106+ if (cpu_has_svm()) {
107+ run_guest(svm->vmcb, svm->vmcb_gpa);
108+ svm->vmcb->save.rip += 3;
109+ run_guest(svm->vmcb, svm->vmcb_gpa);
110+ } else {
111+ vmlaunch();
112+ vmresume();
113+ }
114+
115+ /* Stages 8-11 are eaten by SMM (SMRAM_STAGE reported instead) */
116+ sync_with_host(12);
87117 }
88118
89119 sync_with_host(DONE);
90120 }
91121
122+void inject_smi(struct kvm_vm *vm)
123+{
124+ struct kvm_vcpu_events events;
125+
126+ vcpu_events_get(vm, VCPU_ID, &events);
127+
128+ events.smi.pending = 1;
129+ events.flags |= KVM_VCPUEVENT_VALID_SMM;
130+
131+ vcpu_events_set(vm, VCPU_ID, &events);
132+}
133+
92134 int main(int argc, char *argv[])
93135 {
94136 vm_vaddr_t nested_gva = 0;
@@ -147,6 +189,22 @@ int main(int argc, char *argv[]) · 52 unmodified lines
147189 "Unexpected stage: #%x, got %x",
148190 stage, stage_reported);
149191
192+ /*
193+ * Enter SMM during L2 execution and check that we correctly
194+ * return from it. Do not perform save/restore while in SMM yet.
195+ */
196+ if (stage == 8) {
197+ inject_smi(vm);
198+ continue;
199+ }
200+
201+ /*
202+ * Perform save/restore while the guest is in SMM triggered
203+ * during L2 execution.
204+ */
205+ if (stage == 10)
206+ inject_smi(vm);
207+
150208 state = vcpu_save_state(vm, VCPU_ID);
151209 kvm_vm_release(vm);
152210 kvm_vm_restart(vm, O_RDWR);
tools/testing/selftests/memory-hotplug/mem-on-off-test.sh+3−1
@@ -282,7 +282,9 @@ done · 281 unmodified lines
282282 #
283283 echo $error > $NOTIFIER_ERR_INJECT_DIR/actions/MEM_GOING_OFFLINE/error
284284 for memory in `hotpluggable_online_memory`; do
285− offline_memory_expect_fail $memory
285+ if [ $((RANDOM % 100)) -lt $ratio ]; then
286+ offline_memory_expect_fail $memory
287+ fi
286288 done
287289
288290 echo 0 > $NOTIFIER_ERR_INJECT_DIR/actions/MEM_GOING_OFFLINE/error
tools/testing/selftests/net/nettest.c+54−1
@@ -11,9 +11,11 @@ · 10 unmodified lines
1111 #include <sys/socket.h>
1212 #include <sys/wait.h>
1313 #include <linux/tcp.h>
14+#include <linux/udp.h>
1415 #include <arpa/inet.h>
1516 #include <net/if.h>
1617 #include <netinet/in.h>
18+#include <netinet/ip.h>
1719 #include <netdb.h>
1820 #include <fcntl.h>
1921 #include <libgen.h>
@@ -27,6 +29,10 @@ · 7 unmodified lines
2729 #include <time.h>
2830 #include <errno.h>
2931
32+#include <linux/xfrm.h>
33+#include <linux/ipsec.h>
34+#include <linux/pfkeyv2.h>
35+
3036 #ifndef IPV6_UNICAST_IF
3137 #define IPV6_UNICAST_IF 76
3238 #endif
@@ -114,6 +120,9 @@ struct sock_args { · 81 unmodified lines
114120 struct in_addr in;
115121 struct in6_addr in6;
116122 } expected_raddr;
123+
124+ /* ESP in UDP encap test */
125+ int use_xfrm;
117126 };
118127
119128 static int server_mode;
@@ -1346,6 +1355,41 @@ static int bind_socket(int sd, struct sock_args *args) · 1226 unmodified lines
13461355 return 0;
13471356 }
13481357
1358+static int config_xfrm_policy(int sd, struct sock_args *args)
1359+{
1360+ struct xfrm_userpolicy_info policy = {};
1361+ int type = UDP_ENCAP_ESPINUDP;
1362+ int xfrm_af = IP_XFRM_POLICY;
1363+ int level = SOL_IP;
1364+
1365+ if (args->type != SOCK_DGRAM) {
1366+ log_error("Invalid socket type. Only DGRAM could be used for XFRM\n");
1367+ return 1;
1368+ }
1369+
1370+ policy.action = XFRM_POLICY_ALLOW;
1371+ policy.sel.family = args->version;
1372+ if (args->version == AF_INET6) {
1373+ xfrm_af = IPV6_XFRM_POLICY;
1374+ level = SOL_IPV6;
1375+ }
1376+
1377+ policy.dir = XFRM_POLICY_OUT;
1378+ if (setsockopt(sd, level, xfrm_af, &policy, sizeof(policy)) < 0)
1379+ return 1;
1380+
1381+ policy.dir = XFRM_POLICY_IN;
1382+ if (setsockopt(sd, level, xfrm_af, &policy, sizeof(policy)) < 0)
1383+ return 1;
1384+
1385+ if (setsockopt(sd, IPPROTO_UDP, UDP_ENCAP, &type, sizeof(type)) < 0) {
1386+ log_err_errno("Failed to set xfrm encap");
1387+ return 1;
1388+ }
1389+
1390+ return 0;
1391+}
1392+
13491393 static int lsock_init(struct sock_args *args)
13501394 {
13511395 long flags;
@@ -1389,6 +1433,11 @@ static int lsock_init(struct sock_args *args) · 37 unmodified lines
13891433 if (fcntl(sd, F_SETFD, FD_CLOEXEC) < 0)
13901434 log_err_errno("Failed to set close-on-exec flag");
13911435
1436+ if (args->use_xfrm && config_xfrm_policy(sd, args)) {
1437+ log_err_errno("Failed to set xfrm policy");
1438+ goto err;
1439+ }
1440+
13921441 out:
13931442 return sd;
13941443
@@ -1772,7 +1821,7 @@ static int ipc_parent(int cpid, int fd, struct sock_args *args) · 377 unmodified lines
17721821 return client_status;
17731822 }
17741823
1775−#define GETOPT_STR "sr:l:c:p:t:g:P:DRn:M:X:m:d:I:BN:O:SCi6L:0:1:2:3:Fbq"
1824+#define GETOPT_STR "sr:l:c:p:t:g:P:DRn:M:X:m:d:I:BN:O:SCi6xL:0:1:2:3:Fbq"
17761825
17771826 static void print_usage(char *prog)
17781827 {
@@ -1795,6 +1844,7 @@ static void print_usage(char *prog) · 16 unmodified lines
17951844 " -D|R datagram (D) / raw (R) socket (default stream)\n"
17961845 " -l addr local address to bind to in server mode\n"
17971846 " -c addr local address to bind to in client mode\n"
1847+ " -x configure XFRM policy on socket\n"
17981848 "\n"
17991849 " -d dev bind socket to given device name\n"
18001850 " -I dev bind socket to given device name - server mode\n"
@@ -1966,6 +2016,9 @@ int main(int argc, char *argv[]) · 165 unmodified lines
19662016 case 'q':
19672017 quiet = 1;
19682018 break;
2019+ case 'x':
2020+ args.use_xfrm = 1;
2021+ break;
19692022 default:
19702023 print_usage(argv[0]);
19712024 return 1;
tools/testing/selftests/net/pmtu.sh+206−6
@@ -118,6 +118,16 @@ · 117 unmodified lines
118118 # below for IPv6 doesn't apply here, because, on IPv4, administrative MTU
119119 # changes alone won't affect PMTU
120120 #
121+# - pmtu_vti4_udp_exception
122+# Same as pmtu_vti4_exception, but using ESP-in-UDP
123+#
124+# - pmtu_vti4_udp_routed_exception
125+# Set up vti tunnel on top of veth connected through routing namespace and
126+# add xfrm states and policies with ESP-in-UDP encapsulation. Check that
127+# route exception is not created if link layer MTU is not exceeded, then
128+# lower MTU on second part of routed environment and check that exception
129+# is created with the expected PMTU.
130+#
121131 # - pmtu_vti6_exception
122132 # Set up vti6 tunnel on top of veth, with xfrm states and policies, in two
123133 # namespaces with matching endpoints. Check that route exception is
@@ -125,6 +135,13 @@ · 1 unmodified line
125135 # decrease and increase MTU of tunnel, checking that route exception PMTU
126136 # changes accordingly
127137 #
138+# - pmtu_vti6_udp_exception
139+# Same as pmtu_vti6_exception, but using ESP-in-UDP
140+#
141+# - pmtu_vti6_udp_routed_exception
142+# Same as pmtu_vti6_udp_routed_exception but with routing between vti
143+# endpoints
144+#
128145 # - pmtu_vti4_default_mtu
129146 # Set up vti4 tunnel on top of veth, in two namespaces with matching
130147 # endpoints. Check that MTU assigned to vti interface is the MTU of the
@@ -224,6 +241,10 @@ tests=" · 93 unmodified lines
224241 pmtu_ipv6_ipv6_exception IPv6 over IPv6: PMTU exceptions 1
225242 pmtu_vti6_exception vti6: PMTU exceptions 0
226243 pmtu_vti4_exception vti4: PMTU exceptions 0
244+ pmtu_vti6_udp_exception vti6: PMTU exceptions (ESP-in-UDP) 0
245+ pmtu_vti4_udp_exception vti4: PMTU exceptions (ESP-in-UDP) 0
246+ pmtu_vti6_udp_routed_exception vti6: PMTU exceptions, routed (ESP-in-UDP) 0
247+ pmtu_vti4_udp_routed_exception vti4: PMTU exceptions, routed (ESP-in-UDP) 0
227248 pmtu_vti4_default_mtu vti4: default MTU assignment 0
228249 pmtu_vti6_default_mtu vti6: default MTU assignment 0
229250 pmtu_vti4_link_add_mtu vti4: MTU setting on link creation 0
@@ -246,7 +267,6 @@ ns_b="ip netns exec ${NS_B}" · 16 unmodified lines
246267 ns_c="ip netns exec ${NS_C}"
247268 ns_r1="ip netns exec ${NS_R1}"
248269 ns_r2="ip netns exec ${NS_R2}"
249−
250270 # Addressing and routing for tests with routers: four network segments, with
251271 # index SEGMENT between 1 and 4, a common prefix (PREFIX4 or PREFIX6) and an
252272 # identifier ID, which is 1 for hosts (A and B), 2 for routers (R1 and R2).
@@ -279,7 +299,6 @@ routes=" · 26 unmodified lines
279299 A ${prefix6}:${b_r2}::1 ${prefix6}:${a_r2}::2
280300 B default ${prefix6}:${b_r1}::2
281301 "
282−
283302 USE_NH="no"
284303 # ns family nh id destination gateway
285304 nexthops="
@@ -326,6 +345,7 @@ dummy6_mask="64" · 40 unmodified lines
326345
327346 err_buf=
328347 tcpdump_pids=
348+nettest_pids=
329349
330350 err() {
331351 err_buf="${err_buf}${1}
@@ -548,6 +568,14 @@ setup_vti6() { · 216 unmodified lines
548568 setup_vti 6 ${veth6_a_addr} ${veth6_b_addr} ${tunnel6_a_addr} ${tunnel6_b_addr} ${tunnel6_mask}
549569 }
550570
571+setup_vti4routed() {
572+ setup_vti 4 ${prefix4}.${a_r1}.1 ${prefix4}.${b_r1}.1 ${tunnel4_a_addr} ${tunnel4_b_addr} ${tunnel4_mask}
573+}
574+
575+setup_vti6routed() {
576+ setup_vti 6 ${prefix6}:${a_r1}::1 ${prefix6}:${b_r1}::1 ${tunnel6_a_addr} ${tunnel6_b_addr} ${tunnel6_mask}
577+}
578+
551579 setup_vxlan_or_geneve() {
552580 type="${1}"
553581 a_addr="${2}"
@@ -619,18 +647,36 @@ setup_xfrm() { · 65 unmodified lines
619647 proto=${1}
620648 veth_a_addr="${2}"
621649 veth_b_addr="${3}"
650+ encap=${4}
622651
623− run_cmd ${ns_a} ip -${proto} xfrm state add src ${veth_a_addr} dst ${veth_b_addr} spi 0x1000 proto esp aead 'rfc4106(gcm(aes))' 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f 128 mode tunnel || return 1
624− run_cmd ${ns_a} ip -${proto} xfrm state add src ${veth_b_addr} dst ${veth_a_addr} spi 0x1001 proto esp aead 'rfc4106(gcm(aes))' 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f 128 mode tunnel
652+ run_cmd ${ns_a} ip -${proto} xfrm state add src ${veth_a_addr} dst ${veth_b_addr} spi 0x1000 proto esp aead 'rfc4106(gcm(aes))' 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f 128 mode tunnel ${encap} || return 1
653+ run_cmd ${ns_a} ip -${proto} xfrm state add src ${veth_b_addr} dst ${veth_a_addr} spi 0x1001 proto esp aead 'rfc4106(gcm(aes))' 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f 128 mode tunnel ${encap}
625654 run_cmd ${ns_a} ip -${proto} xfrm policy add dir out mark 10 tmpl src ${veth_a_addr} dst ${veth_b_addr} proto esp mode tunnel
626655 run_cmd ${ns_a} ip -${proto} xfrm policy add dir in mark 10 tmpl src ${veth_b_addr} dst ${veth_a_addr} proto esp mode tunnel
627656
628− run_cmd ${ns_b} ip -${proto} xfrm state add src ${veth_a_addr} dst ${veth_b_addr} spi 0x1000 proto esp aead 'rfc4106(gcm(aes))' 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f 128 mode tunnel
629− run_cmd ${ns_b} ip -${proto} xfrm state add src ${veth_b_addr} dst ${veth_a_addr} spi 0x1001 proto esp aead 'rfc4106(gcm(aes))' 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f 128 mode tunnel
657+ run_cmd ${ns_b} ip -${proto} xfrm state add src ${veth_a_addr} dst ${veth_b_addr} spi 0x1000 proto esp aead 'rfc4106(gcm(aes))' 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f 128 mode tunnel ${encap}
658+ run_cmd ${ns_b} ip -${proto} xfrm state add src ${veth_b_addr} dst ${veth_a_addr} spi 0x1001 proto esp aead 'rfc4106(gcm(aes))' 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f 128 mode tunnel ${encap}
630659 run_cmd ${ns_b} ip -${proto} xfrm policy add dir out mark 10 tmpl src ${veth_b_addr} dst ${veth_a_addr} proto esp mode tunnel
631660 run_cmd ${ns_b} ip -${proto} xfrm policy add dir in mark 10 tmpl src ${veth_a_addr} dst ${veth_b_addr} proto esp mode tunnel
632661 }
633662
663+setup_nettest_xfrm() {
664+ which nettest >/dev/null
665+ if [ $? -ne 0 ]; then
666+ echo "'nettest' command not found; skipping tests"
667+ return 1
668+ fi
669+
670+ [ ${1} -eq 6 ] && proto="-6" || proto=""
671+ port=${2}
672+
673+ run_cmd ${ns_a} nettest ${proto} -q -D -s -x -p ${port} -t 5 &
674+ nettest_pids="${nettest_pids} $!"
675+
676+ run_cmd ${ns_b} nettest ${proto} -q -D -s -x -p ${port} -t 5 &
677+ nettest_pids="${nettest_pids} $!"
678+}
679+
634680 setup_xfrm4() {
635681 setup_xfrm 4 ${veth4_a_addr} ${veth4_b_addr}
636682 }
@@ -639,6 +685,26 @@ setup_xfrm6() { · 2 unmodified lines
639685 setup_xfrm 6 ${veth6_a_addr} ${veth6_b_addr}
640686 }
641687
688+setup_xfrm4udp() {
689+ setup_xfrm 4 ${veth4_a_addr} ${veth4_b_addr} "encap espinudp 4500 4500 0.0.0.0"
690+ setup_nettest_xfrm 4 4500
691+}
692+
693+setup_xfrm6udp() {
694+ setup_xfrm 6 ${veth6_a_addr} ${veth6_b_addr} "encap espinudp 4500 4500 0.0.0.0"
695+ setup_nettest_xfrm 6 4500
696+}
697+
698+setup_xfrm4udprouted() {
699+ setup_xfrm 4 ${prefix4}.${a_r1}.1 ${prefix4}.${b_r1}.1 "encap espinudp 4500 4500 0.0.0.0"
700+ setup_nettest_xfrm 4 4500
701+}
702+
703+setup_xfrm6udprouted() {
704+ setup_xfrm 6 ${prefix6}:${a_r1}::1 ${prefix6}:${b_r1}::1 "encap espinudp 4500 4500 0.0.0.0"
705+ setup_nettest_xfrm 6 4500
706+}
707+
642708 setup_routing_old() {
643709 for i in ${routes}; do
644710 [ "${ns}" = "" ] && ns="${i}" && continue
@@ -823,6 +889,11 @@ cleanup() { · 178 unmodified lines
823889 done
824890 tcpdump_pids=
825891
892+ for pid in ${nettest_pids}; do
893+ kill ${pid}
894+ done
895+ nettest_pids=
896+
826897 for n in ${NS_A} ${NS_B} ${NS_C} ${NS_R1} ${NS_R2}; do
827898 ip netns del ${n} 2> /dev/null
828899 done
@@ -1432,6 +1503,135 @@ test_pmtu_vti6_exception() { · 603 unmodified lines
14321503 return ${fail}
14331504 }
14341505
1506+test_pmtu_vti4_udp_exception() {
1507+ setup namespaces veth vti4 xfrm4udp || return $ksft_skip
1508+ trace "${ns_a}" veth_a "${ns_b}" veth_b \
1509+ "${ns_a}" vti4_a "${ns_b}" vti4_b
1510+
1511+ veth_mtu=1500
1512+ vti_mtu=$((veth_mtu - 20))
1513+
1514+ # UDP SPI SN IV ICV pad length next header
1515+ esp_payload_rfc4106=$((vti_mtu - 8 - 4 - 4 - 8 - 16 - 1 - 1))
1516+ ping_payload=$((esp_payload_rfc4106 - 28))
1517+
1518+ mtu "${ns_a}" veth_a ${veth_mtu}
1519+ mtu "${ns_b}" veth_b ${veth_mtu}
1520+ mtu "${ns_a}" vti4_a ${vti_mtu}
1521+ mtu "${ns_b}" vti4_b ${vti_mtu}
1522+
1523+ # Send DF packet without exceeding link layer MTU, check that no
1524+ # exception is created
1525+ run_cmd ${ns_a} ping -q -M want -i 0.1 -w 1 -s ${ping_payload} ${tunnel4_b_addr}
1526+ pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${tunnel4_b_addr})"
1527+ check_pmtu_value "" "${pmtu}" "sending packet smaller than PMTU (IP payload length ${esp_payload_rfc4106})" || return 1
1528+
1529+ # Now exceed link layer MTU by one byte, check that exception is created
1530+ # with the right PMTU value
1531+ run_cmd ${ns_a} ping -q -M want -i 0.1 -w 1 -s $((ping_payload + 1)) ${tunnel4_b_addr}
1532+ pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${tunnel4_b_addr})"
1533+ check_pmtu_value "${esp_payload_rfc4106}" "${pmtu}" "exceeding PMTU (IP payload length $((esp_payload_rfc4106 + 1)))"
1534+}
1535+
1536+test_pmtu_vti6_udp_exception() {
1537+ setup namespaces veth vti6 xfrm6udp || return $ksft_skip
1538+ trace "${ns_a}" veth_a "${ns_b}" veth_b \
1539+ "${ns_a}" vti6_a "${ns_b}" vti6_b
1540+ fail=0
1541+
1542+ # Create route exception by exceeding link layer MTU
1543+ mtu "${ns_a}" veth_a 4000
1544+ mtu "${ns_b}" veth_b 4000
1545+ mtu "${ns_a}" vti6_a 5000
1546+ mtu "${ns_b}" vti6_b 5000
1547+ run_cmd ${ns_a} ${ping6} -q -i 0.1 -w 1 -s 60000 ${tunnel6_b_addr}
1548+
1549+ # Check that exception was created
1550+ pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${tunnel6_b_addr})"
1551+ check_pmtu_value any "${pmtu}" "creating tunnel exceeding link layer MTU" || return 1
1552+
1553+ # Decrease tunnel MTU, check for PMTU decrease in route exception
1554+ mtu "${ns_a}" vti6_a 3000
1555+ pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${tunnel6_b_addr})"
1556+ check_pmtu_value "3000" "${pmtu}" "decreasing tunnel MTU" || fail=1
1557+
1558+ # Increase tunnel MTU, check for PMTU increase in route exception
1559+ mtu "${ns_a}" vti6_a 9000
1560+ pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${tunnel6_b_addr})"
1561+ check_pmtu_value "9000" "${pmtu}" "increasing tunnel MTU" || fail=1
1562+
1563+ return ${fail}
1564+}
1565+
1566+test_pmtu_vti4_udp_routed_exception() {
1567+ setup namespaces routing vti4routed xfrm4udprouted || return $ksft_skip
1568+ trace "${ns_a}" veth_A-R1 "${ns_b}" veth_B-R1 \
1569+ "${ns_a}" vti4_a "${ns_b}" vti4_b
1570+
1571+ veth_mtu=1500
1572+ vti_mtu=$((veth_mtu - 20))
1573+
1574+ # UDP SPI SN IV ICV pad length next header
1575+ esp_payload_rfc4106=$((vti_mtu - 8 - 4 - 4 - 8 - 16 - 1 - 1))
1576+ ping_payload=$((esp_payload_rfc4106 - 28))
1577+
1578+ mtu "${ns_a}" veth_A-R1 ${veth_mtu}
1579+ mtu "${ns_r1}" veth_R1-A ${veth_mtu}
1580+ mtu "${ns_b}" veth_B-R1 ${veth_mtu}
1581+ mtu "${ns_r1}" veth_R1-B ${veth_mtu}
1582+
1583+ mtu "${ns_a}" vti4_a ${vti_mtu}
1584+ mtu "${ns_b}" vti4_b ${vti_mtu}
1585+
1586+ # Send DF packet without exceeding link layer MTU, check that no
1587+ # exception is created
1588+ run_cmd ${ns_a} ping -q -M want -i 0.1 -w 1 -s ${ping_payload} ${tunnel4_b_addr}
1589+ pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${tunnel4_b_addr})"
1590+ check_pmtu_value "" "${pmtu}" "sending packet smaller than PMTU (IP payload length ${esp_payload_rfc4106})" || return 1
1591+
1592+ # Now decrease link layer MTU by 8 bytes on R1, check that exception is created
1593+ # with the right PMTU value
1594+ mtu "${ns_r1}" veth_R1-B $((veth_mtu - 8))
1595+ run_cmd ${ns_a} ping -q -M want -i 0.1 -w 1 -s $((ping_payload)) ${tunnel4_b_addr}
1596+ pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${tunnel4_b_addr})"
1597+ check_pmtu_value "$((esp_payload_rfc4106 - 8))" "${pmtu}" "exceeding PMTU (IP payload length $((esp_payload_rfc4106)))"
1598+}
1599+
1600+test_pmtu_vti6_udp_routed_exception() {
1601+ setup namespaces routing vti6routed xfrm6udprouted || return $ksft_skip
1602+ trace "${ns_a}" veth_A-R1 "${ns_b}" veth_B-R1 \
1603+ "${ns_a}" vti6_a "${ns_b}" vti6_b
1604+
1605+ veth_mtu=1500
1606+ vti_mtu=$((veth_mtu - 40))
1607+
1608+ # UDP SPI SN IV ICV pad length next header
1609+ esp_payload_rfc4106=$((vti_mtu - 8 - 4 - 4 - 8 - 16 - 1 - 1))
1610+ ping_payload=$((esp_payload_rfc4106 - 48))
1611+
1612+ mtu "${ns_a}" veth_A-R1 ${veth_mtu}
1613+ mtu "${ns_r1}" veth_R1-A ${veth_mtu}
1614+ mtu "${ns_b}" veth_B-R1 ${veth_mtu}
1615+ mtu "${ns_r1}" veth_R1-B ${veth_mtu}
1616+
1617+ # mtu "${ns_a}" vti6_a ${vti_mtu}
1618+ # mtu "${ns_b}" vti6_b ${vti_mtu}
1619+
1620+ run_cmd ${ns_a} ${ping6} -q -M want -i 0.1 -w 1 -s ${ping_payload} ${tunnel6_b_addr}
1621+
1622+ # Check that exception was not created
1623+ pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${tunnel6_b_addr})"
1624+ check_pmtu_value "" "${pmtu}" "sending packet smaller than PMTU (IP payload length ${esp_payload_rfc4106})" || return 1
1625+
1626+ # Now decrease link layer MTU by 8 bytes on R1, check that exception is created
1627+ # with the right PMTU value
1628+ mtu "${ns_r1}" veth_R1-B $((veth_mtu - 8))
1629+ run_cmd ${ns_a} ${ping6} -q -M want -i 0.1 -w 1 -s $((ping_payload)) ${tunnel6_b_addr}
1630+ pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${tunnel6_b_addr})"
1631+ check_pmtu_value "$((esp_payload_rfc4106 - 8))" "${pmtu}" "exceeding PMTU (IP payload length $((esp_payload_rfc4106)))"
1632+
1633+}
1634+
14351635 test_pmtu_vti4_default_mtu() {
14361636 setup namespaces veth vti4 || return $ksft_skip
14371637
virt/kvm/coalesced_mmio.c+1−1
@@ -186,7 +186,6 @@ int kvm_vm_ioctl_unregister_coalesced_mmio(struct kvm *kvm, · 185 unmodified lines
186186 coalesced_mmio_in_range(dev, zone->addr, zone->size)) {
187187 r = kvm_io_bus_unregister_dev(kvm,
188188 zone->pio ? KVM_PIO_BUS : KVM_MMIO_BUS, &dev->dev);
189− kvm_iodevice_destructor(&dev->dev);
190189
191190 /*
192191 * On failure, unregister destroys all devices on the
@@ -196,6 +195,7 @@ int kvm_vm_ioctl_unregister_coalesced_mmio(struct kvm *kvm, · 3 unmodified lines
196195 */
197196 if (r)
198197 break;
198+ kvm_iodevice_destructor(&dev->dev);
199199 }
200200 }
201201
virt/kvm/kvm_main.c+1−1
@@ -935,7 +935,7 @@ static int kvm_create_vm_debugfs(struct kvm *kvm, int fd) · 934 unmodified lines
935935 stat_data->kvm = kvm;
936936 stat_data->desc = pdesc;
937937 stat_data->kind = KVM_STAT_VCPU;
938− kvm->debugfs_stat_data[i] = stat_data;
938+ kvm->debugfs_stat_data[i + kvm_vm_stats_header.num_desc] = stat_data;
939939 debugfs_create_file(pdesc->name, kvm_stats_debugfs_mode(pdesc),
940940 kvm->debugfs_dentry, stat_data,
941941 &stat_fops_per_vm);