History

Merge branch 'locking/urgent' into locking/core, to pick up dependent commits

We are applying further, lower-prio fixes on top of two ww_mutex fixes in locking/urgent.

Ingo Molnar committed 5 years ago

Commit 01438742 parents 4faf62b bee6457691 files · +5814 −3820Browse files

Unified · Split

691 files
  1. Documentation/devicetree/bindings/interrupt-controller/ingenic,intc.yaml +1 −0
  2. Documentation/gpu/todo.rst +21 −0
  3. Documentation/networking/bonding.rst +1 −1
  4. Documentation/networking/netdev-FAQ.rst +6 −66
  5. Documentation/process/stable-kernel-rules.rst +0 −6
  6. Documentation/process/submitting-patches.rst +0 −5
  7. Documentation/virt/kvm/api.rst +3 −0
  8. MAINTAINERS +6 −5
  9. Makefile +4 −2
  10. arch/Kconfig +1 −2
  11. arch/arm/Kconfig +1 −0
  12. arch/arm/xen/p2m.c +2 −3
  13. arch/arm64/Kconfig +2 −10
  14. arch/arm64/include/asm/kvm_asm.h +4 −4
  15. arch/arm64/include/asm/kvm_hyp.h +7 −1
  16. arch/arm64/include/asm/memory.h +5 −0
  17. arch/arm64/include/asm/mmu_context.h +0 −17
  18. arch/arm64/include/asm/pgtable-prot.h +0 −1
  19. arch/arm64/include/asm/pgtable.h +3 −0
  20. arch/arm64/include/asm/sysreg.h +14 −6
  21. arch/arm64/kernel/head.S +5 −3
  22. arch/arm64/kernel/idreg-override.c +23 −20
  23. arch/arm64/kernel/image-vars.h +3 −0
  24. arch/arm64/kernel/perf_event.c +1 −1
  25. arch/arm64/kvm/arm.c +6 −1
  26. arch/arm64/kvm/hyp/entry.S +5 −3
  27. arch/arm64/kvm/hyp/include/hyp/switch.h +6 −3
  28. arch/arm64/kvm/hyp/nvhe/debug-sr.c +10 −2
  29. arch/arm64/kvm/hyp/nvhe/host.S +8 −7
  30. arch/arm64/kvm/hyp/nvhe/hyp-main.c +6 −6
  31. arch/arm64/kvm/hyp/nvhe/switch.c +11 −3
  32. arch/arm64/kvm/hyp/nvhe/tlb.c +2 −1
  33. arch/arm64/kvm/hyp/pgtable.c +1 −0
  34. arch/arm64/kvm/hyp/vgic-v3-sr.c +38 −2
  35. arch/arm64/kvm/hyp/vhe/tlb.c +2 −1
  36. arch/arm64/kvm/mmu.c +1 −2
  37. arch/arm64/kvm/perf.c +10 −0
  38. arch/arm64/kvm/pmu-emul.c +0 −10
  39. arch/arm64/kvm/reset.c +14 −8
  40. arch/arm64/kvm/vgic/vgic-v3.c +9 −3
  41. arch/arm64/mm/init.c +26 −3
  42. arch/arm64/mm/mmu.c +3 −2
  43. arch/ia64/include/asm/syscall.h +1 −1
  44. arch/ia64/kernel/ptrace.c +18 −6
  45. arch/m68k/include/asm/page_mm.h +1 −1
  46. arch/m68k/include/asm/page_no.h +2 −2
  47. arch/mips/boot/compressed/decompress.c +8 −0
  48. arch/mips/crypto/Makefile +2 −2
  49. arch/mips/include/asm/traps.h +3 −0
  50. arch/mips/kernel/cpu-probe.c +6 −0
  51. arch/mips/kernel/cpu-r3k-probe.c +3 −0
  52. arch/mips/kernel/traps.c +5 −5
  53. arch/mips/kernel/vmlinux.lds.S +6 −0
  54. arch/parisc/Kconfig +5 −2
  55. arch/parisc/kernel/ptrace.c +0 −2
  56. arch/powerpc/include/asm/code-patching.h +4 −3
  57. arch/powerpc/include/asm/dcr-native.h +4 −4
  58. arch/powerpc/include/asm/interrupt.h +2 −1
  59. arch/powerpc/include/asm/mmu.h +2 −2
  60. arch/powerpc/include/asm/ptrace.h +2 −2
  61. arch/powerpc/include/asm/switch_to.h +10 −0
  62. arch/powerpc/include/asm/vio.h +1 −1
  63. arch/powerpc/kernel/exceptions-64s.S +1 −1
  64. arch/powerpc/kernel/head_book3s_32.S +6 −3
  65. arch/powerpc/kernel/interrupt.c +1 −2
  66. arch/powerpc/kernel/traps.c +1 −1
  67. arch/powerpc/lib/sstep.c +2 −2
  68. arch/powerpc/perf/core-book3s.c +2 −2
  69. arch/powerpc/platforms/pseries/msi.c +23 −2
  70. arch/powerpc/platforms/pseries/vio.c +3 −4
  71. arch/s390/configs/debug_defconfig +3 −13
  72. arch/s390/configs/defconfig +2 −9
  73. arch/s390/configs/zfcpdump_defconfig +0 −3
  74. arch/s390/include/asm/idle.h +6 −6
  75. arch/s390/include/asm/timex.h +18 −18
  76. arch/s390/include/uapi/asm/hwctrset.h +0 −0
  77. arch/s390/kernel/idle.c +6 −6
  78. arch/s390/kernel/perf_cpum_cf.c +1 −1
  79. arch/s390/kernel/perf_cpum_cf_diag.c +3 −17
  80. arch/s390/kernel/time.c +14 −14
  81. arch/s390/kernel/topology.c +0 −2
  82. arch/s390/kvm/interrupt.c +1 −1
  83. arch/sparc/configs/sparc64_defconfig +1 −3
  84. arch/sparc/include/asm/elf_64.h +0 −1
  85. arch/sparc/include/asm/extable.h +2 −2
  86. arch/sparc/include/asm/processor_32.h +1 −5
  87. arch/sparc/include/asm/thread_info_64.h +1 −0
  88. arch/sparc/include/asm/uaccess.h +3 −0
  89. arch/sparc/include/asm/uaccess_32.h +0 −38
  90. arch/sparc/include/asm/uaccess_64.h +0 −1
  91. arch/sparc/kernel/head_32.S +1 −1
  92. arch/sparc/kernel/head_64.S +1 −1
  93. arch/sparc/kernel/process_32.c +0 −12
  94. arch/sparc/kernel/setup_32.c +0 −3
  95. arch/sparc/kernel/setup_64.c +0 −4
  96. arch/sparc/kernel/traps_64.c +6 −7
  97. arch/sparc/kernel/unaligned_32.c +6 −100
  98. arch/sparc/lib/checksum_32.S +27 −37
  99. arch/sparc/lib/copy_user.S +112 −203
  100. arch/sparc/lib/memset.S +33 −54
  101. arch/sparc/mm/Makefile +1 −1
  102. arch/sparc/mm/extable.c +0 −107
  103. arch/sparc/mm/fault_32.c +10 −70
  104. arch/sparc/mm/mm_32.h +0 −2
  105. arch/x86/entry/common.c +2 −1
  106. arch/x86/entry/entry_64_compat.S +2 −0
  107. arch/x86/events/core.c +6 −9
  108. arch/x86/events/intel/core.c +4 −1
  109. arch/x86/include/asm/insn-eval.h +2 −0
  110. arch/x86/include/asm/kvm_host.h +2 −2
  111. arch/x86/include/asm/proto.h +1 −0
  112. arch/x86/include/asm/ptrace.h +15 −0
  113. arch/x86/include/asm/smap.h +4 −6
  114. arch/x86/kernel/kvmclock.c +9 −10
  115. arch/x86/kernel/sev-es.c +17 −5
  116. arch/x86/kernel/traps.c +1 −2
  117. arch/x86/kernel/unwind_orc.c +7 −7
  118. arch/x86/kvm/lapic.c +11 −1
  119. arch/x86/kvm/mmu/tdp_mmu.c +11 −0
  120. arch/x86/kvm/svm/svm.c +13 −12
  121. arch/x86/kvm/vmx/vmx.c +1 −1
  122. arch/x86/kvm/x86.c +1 −1
  123. arch/x86/lib/insn-eval.c +52 −14
  124. arch/x86/net/bpf_jit_comp.c +7 −3
  125. arch/x86/xen/p2m.c +2 −4
  126. block/bio.c +7 −7
  127. block/blk-cgroup-rwstat.c +2 −1
  128. block/blk-crypto-fallback.c +1 −1
  129. block/blk-lib.c +1 −1
  130. block/blk-map.c +1 −1
  131. block/blk-zoned.c +37 −3
  132. block/bounce.c +3 −3
  133. block/genhd.c +1 −3
  134. crypto/Kconfig +1 −1
  135. drivers/atm/eni.c +2 −1
  136. drivers/atm/idt77105.c +2 −2
  137. drivers/atm/lanai.c +4 −1
  138. drivers/atm/uPD98402.c +1 −1
  139. drivers/base/swnode.c +20 −9
  140. drivers/block/drbd/drbd_int.h +1 −1
  141. drivers/block/rsxx/core.c +1 −0
  142. drivers/block/umem.c +4 −1
  143. drivers/block/zram/zram_drv.c +11 −6
  144. drivers/char/hw_random/pseries-rng.c +1 −2
  145. drivers/char/tpm/tpm_ibmvtpm.c +1 −3
  146. drivers/cpufreq/cpufreq-dt-platdev.c +2 −0
  147. drivers/cpufreq/qcom-cpufreq-hw.c +3 −3
  148. drivers/crypto/nx/nx-842-pseries.c +1 −3
  149. drivers/crypto/nx/nx.c +1 −3
  150. drivers/firmware/efi/libstub/arm64-stub.c +1 −1
  151. drivers/firmware/efi/libstub/efi-stub.c +16 −0
  152. drivers/gpio/gpio-pca953x.c +23 −55
  153. drivers/gpio/gpiolib-acpi.c +15 −6
  154. drivers/gpio/gpiolib.c +9 −10
  155. drivers/gpu/drm/Kconfig +1 −0
  156. drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 −0
  157. drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +1 −1
  158. drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +4 −0
  159. drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +1 −1
  160. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +30 −20
  161. drivers/gpu/drm/amd/display/dc/core/dc_link.c +0 −1
  162. drivers/gpu/drm/amd/display/dc/dc.h +1 −0
  163. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c +11 −0
  164. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.h +6 −0
  165. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +7 −0
  166. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hubp.c +1 −0
  167. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +6 −0
  168. drivers/gpu/drm/amd/display/dc/dcn21/dcn21_hubp.c +1 −0
  169. drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c +2 −6
  170. drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hubp.c +1 −0
  171. drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c +31 −0
  172. drivers/gpu/drm/amd/display/dc/dcn301/dcn301_resource.c +95 −1
  173. drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h +2 −0
  174. drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +4 −4
  175. drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c +48 −0
  176. drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_hwmgr.c +66 −0
  177. drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c +27 −21
  178. drivers/gpu/drm/drm_fb_helper.c +1 −1
  179. drivers/gpu/drm/drm_gem_shmem_helper.c +22 −10
  180. drivers/gpu/drm/drm_ioc32.c +11 −0
  181. drivers/gpu/drm/i915/gt/intel_engine_cs.c +6 −1
  182. drivers/gpu/drm/i915/i915_cmd_parser.c +13 −6
  183. drivers/gpu/drm/i915/i915_drv.h +1 −1
  184. drivers/gpu/drm/meson/meson_drv.c +11 −0
  185. drivers/gpu/drm/nouveau/nouveau_bo.c +4 −2
  186. drivers/gpu/drm/qxl/qxl_display.c +1 −0
  187. drivers/gpu/drm/qxl/qxl_release.c +10 −2
  188. drivers/gpu/drm/radeon/radeon.h +2 −0
  189. drivers/gpu/drm/radeon/radeon_gem.c +2 −2
  190. drivers/gpu/drm/radeon/radeon_prime.c +2 −0
  191. drivers/gpu/drm/tiny/gm12u320.c +36 −8
  192. drivers/gpu/drm/ttm/ttm_bo.c +6 −2
  193. drivers/gpu/drm/ttm/ttm_pool.c +2 −2
  194. drivers/gpu/drm/udl/udl_drv.c +17 −0
  195. drivers/gpu/drm/udl/udl_drv.h +1 −0
  196. drivers/gpu/drm/udl/udl_main.c +10 −0
  197. drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c +1 −3
  198. drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c +1 −1
  199. drivers/irqchip/Kconfig +0 −9
  200. drivers/irqchip/irq-ingenic-tcu.c +1 −0
  201. drivers/irqchip/irq-ingenic.c +1 −0
  202. drivers/leds/trigger/ledtrig-tty.c +4 −7
  203. drivers/md/bcache/super.c +1 −1
  204. drivers/md/dm-crypt.c +4 −4
  205. drivers/md/dm-writecache.c +2 −2
  206. drivers/md/raid5-cache.c +2 −2
  207. drivers/md/raid5-ppl.c +1 −1
  208. drivers/media/platform/rockchip/rkisp1/rkisp1-params.c +0 −1
  209. drivers/media/platform/vsp1/vsp1_drm.c +3 −3
  210. drivers/media/rc/Makefile +1 −0
  211. drivers/media/rc/keymaps/Makefile +0 −1
  212. drivers/media/rc/keymaps/rc-cec.c +11 −17
  213. drivers/media/rc/rc-main.c +6 −0
  214. drivers/media/usb/usbtv/usbtv-audio.c +1 −1
  215. drivers/misc/fastrpc.c +5 −0
  216. drivers/misc/habanalabs/common/debugfs.c +1 −4
  217. drivers/misc/habanalabs/common/device.c +35 −5
  218. drivers/misc/habanalabs/common/habanalabs.h +0 −2
  219. drivers/misc/habanalabs/common/habanalabs_ioctl.c +12 −0
  220. drivers/misc/habanalabs/common/irq.c +1 −1
  221. drivers/misc/habanalabs/common/mmu/mmu.c +26 −12
  222. drivers/misc/ibmvmc.c +1 −3
  223. drivers/misc/pvpanic.c +1 −0
  224. drivers/mmc/core/bus.c +5 −6
  225. drivers/mmc/core/mmc.c +11 −4
  226. drivers/mmc/host/mmci.c +9 −1
  227. drivers/net/Kconfig +1 −1
  228. drivers/net/bonding/bond_main.c +6 −2
  229. drivers/net/can/flexcan.c +15 −9
  230. drivers/net/can/m_can/tcan4x5x-core.c +3 −3
  231. drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c +4 −17
  232. drivers/net/dsa/bcm_sf2.c +3 −3
  233. drivers/net/dsa/mt7530.c +4 −0
  234. drivers/net/dsa/sja1105/sja1105_main.c +3 −3
  235. drivers/net/dsa/xrs700x/xrs700x.c +8 −2
  236. drivers/net/ethernet/atheros/alx/main.c +5 −2
  237. drivers/net/ethernet/broadcom/bcm4908_enet.c +3 −0
  238. drivers/net/ethernet/broadcom/bnxt/bnxt.c +15 −2
  239. drivers/net/ethernet/cadence/macb_main.c +8 −7
  240. drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c +4 −4
  241. drivers/net/ethernet/davicom/dm9000.c +18 −5
  242. drivers/net/ethernet/freescale/enetc/enetc.c +50 −43
  243. drivers/net/ethernet/freescale/enetc/enetc.h +5 −0
  244. drivers/net/ethernet/freescale/enetc/enetc_hw.h +17 −3
  245. drivers/net/ethernet/freescale/enetc/enetc_pf.c +87 −17
  246. drivers/net/ethernet/freescale/enetc/enetc_vf.c +7 −0
  247. drivers/net/ethernet/freescale/fec_ptp.c +7 −0
  248. drivers/net/ethernet/freescale/gianfar.c +15 −0
  249. drivers/net/ethernet/hisilicon/hns/hns_enet.c +3 −1
  250. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h +3 −3
  251. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +3 −4
  252. drivers/net/ethernet/ibm/ibmveth.c +1 −3
  253. drivers/net/ethernet/ibm/ibmvnic.c +8 −14
  254. drivers/net/ethernet/intel/iavf/iavf_main.c +2 −1
  255. drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c +5 −0
  256. drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +4 −2
  257. drivers/net/ethernet/intel/ixgbevf/ipsec.c +5 −0
  258. drivers/net/ethernet/marvell/octeontx2/af/cgx.c +3 −1
  259. drivers/net/ethernet/mediatek/mtk_star_emac.c +3 −2
  260. drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +1 −1
  261. drivers/net/ethernet/mellanox/mlx4/en_netdev.c +2 −0
  262. drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +1 −0
  263. drivers/net/ethernet/mellanox/mlxsw/reg.h +1 −0
  264. drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c +5 −0
  265. drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +7 −0
  266. drivers/net/ethernet/mellanox/mlxsw/switchx2.c +2 −1
  267. drivers/net/ethernet/microchip/lan743x_main.c +1 −1
  268. drivers/net/ethernet/mscc/Kconfig +1 −0
  269. drivers/net/ethernet/mscc/ocelot_flower.c +2 −1
  270. drivers/net/ethernet/realtek/r8169_main.c +1 −1
  271. drivers/net/ethernet/renesas/sh_eth.c +7 −0
  272. drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c +45 −14
  273. drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c +49 −10
  274. drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c +18 −1
  275. drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c +0 −4
  276. drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c +1 −1
  277. drivers/net/ethernet/stmicro/stmmac/enh_desc.c +6 −3
  278. drivers/net/ethernet/stmicro/stmmac/hwif.h +3 −2
  279. drivers/net/ethernet/stmicro/stmmac/norm_desc.c +6 −3
  280. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +135 −25
  281. drivers/net/ethernet/sun/niu.c +0 −2
  282. drivers/net/ethernet/tehuti/tehuti.c +1 −0
  283. drivers/net/hamradio/6pack.c +0 −5
  284. drivers/net/hyperv/hyperv_net.h +1 −1
  285. drivers/net/hyperv/netvsc_drv.c +9 −4
  286. drivers/net/hyperv/rndis_filter.c +1 −1
  287. drivers/net/netdevsim/netdev.c +1 −0
  288. drivers/net/phy/dp83822.c +5 −4
  289. drivers/net/phy/dp83tc811.c +6 −5
  290. drivers/net/phy/phy.c +4 −2
  291. drivers/net/phy/phy_device.c +2 −4
  292. drivers/net/usb/cdc_ncm.c +5 −5
  293. drivers/net/usb/qmi_wwan.c +0 −14
  294. drivers/net/usb/r8152.c +6 −29
  295. drivers/net/usb/usbnet.c +1 −1
  296. drivers/net/wan/fsl_ucc_hdlc.c +6 −2
  297. drivers/net/wan/lapbether.c +0 −3
  298. drivers/net/wireless/ath/ath11k/mac.c +2 −2
  299. drivers/net/wireless/ath/ath11k/qmi.c +2 −2
  300. drivers/net/wireless/ath/ath9k/ath9k.h +2 −1
  301. drivers/net/wireless/ath/ath9k/xmit.c +6 −0
  302. drivers/net/wireless/intel/iwlwifi/fw/pnvm.c +2 −2
  303. drivers/net/wireless/intel/iwlwifi/iwl-op-mode.h +2 −0
  304. drivers/net/wireless/intel/iwlwifi/mvm/fw.c +1 −0
  305. drivers/net/wireless/intel/iwlwifi/pcie/drv.c +2 −1
  306. drivers/net/wireless/intel/iwlwifi/pcie/rx.c +2 −1
  307. drivers/net/wireless/mediatek/mt76/dma.c +13 −13
  308. drivers/net/wireless/mediatek/mt76/mt7915/mac.c +5 −5
  309. drivers/net/wireless/mediatek/mt76/mt7915/testmode.c +2 −2
  310. drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +1 −3
  311. drivers/net/xen-netback/netback.c +2 −2
  312. drivers/nvme/host/core.c +11 −4
  313. drivers/nvme/host/fc.c +3 −2
  314. drivers/nvme/host/pci.c +1 −0
  315. drivers/nvme/host/zns.c +7 −2
  316. drivers/nvme/target/passthru.c +3 −3
  317. drivers/nvme/target/rdma.c +2 −3
  318. drivers/opp/core.c +25 −23
  319. drivers/opp/opp.h +2 −0
  320. drivers/pci/xen-pcifront.c +2 −2
  321. drivers/perf/arm_dmc620_pmu.c +1 −0
  322. drivers/regulator/mt6315-regulator.c +2 −2
  323. drivers/regulator/pca9450-regulator.c +9 −1
  324. drivers/regulator/qcom-rpmh-regulator.c +3 −3
  325. drivers/regulator/rt4831-regulator.c +2 −2
  326. drivers/s390/block/dasd.c +3 −3
  327. drivers/s390/char/tty3270.c +4 −2
  328. drivers/s390/char/zcore.c +27 −17
  329. drivers/s390/cio/device_fsm.c +1 −1
  330. drivers/s390/cio/vfio_ccw_ops.c +3 −3
  331. drivers/s390/crypto/vfio_ap_ops.c +1 −1
  332. drivers/s390/net/qeth_core.h +2 −1
  333. drivers/s390/net/qeth_core_main.c +60 −68
  334. drivers/scsi/ibmvscsi/ibmvfc.c +37 −28
  335. drivers/scsi/ibmvscsi/ibmvscsi.c +1 −3
  336. drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c +1 −3
  337. drivers/scsi/ufs/ufs-qcom.c +10 −0
  338. drivers/scsi/ufs/ufshcd.c +13 −28
  339. drivers/scsi/vmw_pvscsi.c +0 −2
  340. drivers/scsi/vmw_pvscsi.h +0 −2
  341. drivers/staging/comedi/drivers/addi_apci_1032.c +3 −1
  342. drivers/staging/comedi/drivers/addi_apci_1500.c +9 −9
  343. drivers/staging/comedi/drivers/adv_pci1710.c +5 −5
  344. drivers/staging/comedi/drivers/amplc_pc236_common.c +3 −1
  345. drivers/staging/comedi/drivers/comedi_parport.c +2 −1
  346. drivers/staging/comedi/drivers/das6402.c +1 −1
  347. drivers/staging/comedi/drivers/das800.c +1 −1
  348. drivers/staging/comedi/drivers/dmm32at.c +1 −1
  349. drivers/staging/comedi/drivers/me4000.c +1 −1
  350. drivers/staging/comedi/drivers/ni_6527.c +3 −1
  351. drivers/staging/comedi/drivers/ni_65xx.c +2 −1
  352. drivers/staging/comedi/drivers/pcl711.c +1 −1
  353. drivers/staging/comedi/drivers/pcl726.c +3 −1
  354. drivers/staging/comedi/drivers/pcl818.c +1 −1
  355. drivers/staging/ks7010/ks_wlan_net.c +4 −2
  356. drivers/staging/rtl8188eu/core/rtw_ap.c +5 −0
  357. drivers/staging/rtl8188eu/os_dep/ioctl_linux.c +4 −2
  358. drivers/staging/rtl8192e/Kconfig +1 −0
  359. drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +4 −3
  360. drivers/staging/rtl8192u/r8192U_wx.c +4 −2
  361. drivers/staging/rtl8712/rtl871x_cmd.c +4 −2
  362. drivers/staging/rtl8712/rtl871x_ioctl_linux.c +1 −1
  363. drivers/staging/wfx/bh.c +1 −0
  364. drivers/staging/wfx/bh.h +4 −0
  365. drivers/staging/wfx/bus.h +3 −0
  366. drivers/staging/wfx/bus_sdio.c +6 −0
  367. drivers/staging/wfx/bus_spi.c +7 −0
  368. drivers/staging/wfx/data_rx.c +5 −0
  369. drivers/staging/wfx/data_tx.c +5 −0
  370. drivers/staging/wfx/data_tx.h +3 −0
  371. drivers/staging/wfx/debug.c +6 −0
  372. drivers/staging/wfx/fwio.c +2 −0
  373. drivers/staging/wfx/hif_api_cmd.h +4 −0
  374. drivers/staging/wfx/hif_api_general.h +9 −0
  375. drivers/staging/wfx/hif_tx.c +4 −0
  376. drivers/staging/wfx/hif_tx_mib.c +5 −0
  377. drivers/staging/wfx/hwio.c +3 −0
  378. drivers/staging/wfx/hwio.h +2 −0
  379. drivers/staging/wfx/key.c +2 −0
  380. drivers/staging/wfx/key.h +2 −0
  381. drivers/staging/wfx/main.c +7 −0
  382. drivers/staging/wfx/main.h +3 −0
  383. drivers/staging/wfx/queue.c +4 −0
  384. drivers/staging/wfx/queue.h +3 −0
  385. drivers/staging/wfx/scan.h +2 −0
  386. drivers/staging/wfx/sta.c +6 −0
  387. drivers/staging/wfx/sta.h +2 −0
  388. drivers/staging/wfx/traces.h +3 −0
  389. drivers/staging/wfx/wfx.h +3 −0
  390. drivers/tty/hvc/hvcs.c +1 −3
  391. drivers/tty/pty.c +2 −13
  392. drivers/tty/serial/max310x.c +5 −24
  393. drivers/tty/tty_io.c +2 −3
  394. drivers/usb/class/cdc-acm.c +5 −0
  395. drivers/usb/class/usblp.c +12 −4
  396. drivers/usb/core/usb.c +32 −0
  397. drivers/usb/dwc3/dwc3-qcom.c +13 −5
  398. drivers/usb/gadget/function/f_uac1.c +1 −0
  399. drivers/usb/gadget/function/f_uac2.c +1 −1
  400. drivers/usb/gadget/function/u_ether_configfs.h +2 −3
  401. drivers/usb/gadget/udc/s3c2410_udc.c +2 −2
  402. drivers/usb/host/xhci-pci.c +11 −2
  403. drivers/usb/host/xhci-ring.c +2 −1
  404. drivers/usb/host/xhci.c +43 −35
  405. drivers/usb/host/xhci.h +1 −0
  406. drivers/usb/renesas_usbhs/pipe.c +2 −0
  407. drivers/usb/serial/ch341.c +1 −0
  408. drivers/usb/serial/cp210x.c +3 −0
  409. drivers/usb/serial/io_edgeport.c +16 −10
  410. drivers/usb/serial/xr_serial.c +0 −25
  411. drivers/usb/usbip/stub_dev.c +35 −7
  412. drivers/usb/usbip/vhci_sysfs.c +34 −5
  413. drivers/usb/usbip/vudc_sysfs.c +42 −7
  414. drivers/video/fbdev/aty/atyfb.h +0 −3
  415. drivers/video/fbdev/aty/atyfb_base.c +5 −4
  416. drivers/virt/acrn/hsm.c +10 −1
  417. drivers/virt/acrn/irqfd.c +3 −3
  418. drivers/xen/events/events_2l.c +15 −7
  419. drivers/xen/events/events_base.c +100 −30
  420. drivers/xen/events/events_fifo.c +0 −7
  421. drivers/xen/events/events_internal.h +8 −6
  422. drivers/xen/gntdev.c +33 −21
  423. fs/Kconfig +1 −1
  424. fs/afs/dir.c +0 −1
  425. fs/afs/file.c +0 −1
  426. fs/afs/fs_operation.c +5 −2
  427. fs/afs/inode.c +0 −1
  428. fs/afs/internal.h +0 −1
  429. fs/afs/mntpt.c +0 −1
  430. fs/afs/xattr.c +7 −24
  431. fs/binfmt_misc.c +14 −15
  432. fs/block_dev.c +13 −4
  433. fs/btrfs/extent_io.c +1 −1
  434. fs/btrfs/scrub.c +1 −1
  435. fs/cifs/cifs_debug.c +1 −1
  436. fs/cifs/cifsfs.c +1 −1
  437. fs/cifs/cifsglob.h +10 −9
  438. fs/cifs/connect.c +7 −7
  439. fs/cifs/sess.c +1 −0
  440. fs/cifs/smb2inode.c +1 −0
  441. fs/cifs/smb2misc.c +5 −5
  442. fs/cifs/smb2ops.c +5 −5
  443. fs/cifs/smb2pdu.c +2 −4
  444. fs/cifs/smb2proto.h +1 −2
  445. fs/cifs/transport.c +2 −2
  446. fs/configfs/file.c +2 −4
  447. fs/crypto/bio.c +3 −3
  448. fs/erofs/data.c +11 −17
  449. fs/erofs/zdata.c +1 −1
  450. fs/ext4/page-io.c +1 −1
  451. fs/f2fs/checkpoint.c +1 −1
  452. fs/f2fs/data.c +2 −2
  453. fs/f2fs/segment.c +1 −1
  454. fs/f2fs/segment.h +2 −2
  455. fs/f2fs/super.c +2 −2
  456. fs/fuse/dev.c +16 −10
  457. fs/fuse/fuse_i.h +1 −0
  458. fs/fuse/virtio_fs.c +8 −1
  459. fs/gfs2/log.c +5 −1
  460. fs/gfs2/lops.c +1 −1
  461. fs/gfs2/ops_fstype.c +1 −3
  462. fs/gfs2/super.c +2 −8
  463. fs/gfs2/super.h +1 −1
  464. fs/gfs2/trans.c +2 −0
  465. fs/gfs2/util.c +11 −6
  466. fs/io-wq.c +12 −13
  467. fs/io-wq.h +1 −1
  468. fs/io_uring.c +455 −382
  469. fs/iomap/buffered-io.c +2 −2
  470. fs/iomap/direct-io.c +2 −2
  471. fs/locks.c +0 −3
  472. fs/mpage.c +1 −1
  473. fs/nfs/Kconfig +1 −1
  474. fs/nfs/dir.c +33 −25
  475. fs/nfs/inode.c +4 −3
  476. fs/nfs/internal.h +2 −1
  477. fs/nfs/nfs3xdr.c +2 −1
  478. fs/nfs/nfs42proc.c +7 −5
  479. fs/nfs/nfs4proc.c +16 −17
  480. fs/nfs/unlink.c +3 −3
  481. fs/nfs/write.c +4 −4
  482. fs/nfsd/Kconfig +1 −0
  483. fs/nfsd/filecache.c +2 −0
  484. fs/nfsd/nfs4callback.c +1 −0
  485. fs/nfsd/nfs4proc.c +1 −1
  486. fs/nfsd/nfs4state.c +15 −40
  487. fs/nilfs2/segbuf.c +1 −1
  488. fs/pnode.h +1 −1
  489. fs/proc/task_mmu.c +0 −2
  490. fs/squashfs/block.c +1 −1
  491. fs/zonefs/super.c +1 −1
  492. include/kvm/arm_pmu.h +7 −2
  493. include/linux/acpi.h +8 −2
  494. include/linux/atmdev.h +1 −1
  495. include/linux/bio.h +2 −2
  496. include/linux/can/skb.h +6 −2
  497. include/linux/compiler-clang.h +6 −0
  498. include/linux/compiler-version.h +14 −0
  499. include/linux/cpu.h +3 −0
  500. include/linux/gpio/consumer.h +2 −0
  501. include/linux/io_uring.h +1 −1
  502. include/linux/irqdomain.h +0 −4
  503. include/linux/kconfig.h +0 −2
  504. include/linux/memblock.h +2 −2
  505. include/linux/memcontrol.h +2 −4
  506. include/linux/mm.h +21 −0
  507. include/linux/mm_types.h +1 −0
  508. include/linux/netdevice.h +0 −2
  509. include/linux/perf_event.h +2 −0
  510. include/linux/pgtable.h +4 −0
  511. include/linux/property.h +1 −1
  512. include/linux/regulator/pca9450.h +3 −0
  513. include/linux/sched/mm.h +2 −1
  514. include/linux/seqlock.h +1 −4
  515. include/linux/stop_machine.h +6 −5
  516. include/linux/sunrpc/svc_rdma.h +0 −1
  517. include/linux/textsearch.h +1 −1
  518. include/linux/u64_stats_sync.h +4 −3
  519. include/linux/usb.h +2 −0
  520. include/linux/virtio_net.h +6 −1
  521. include/linux/ww_mutex.h +3 −2
  522. include/media/rc-map.h +7 −0
  523. include/uapi/linux/bpf.h +0 −1
  524. include/uapi/linux/fuse.h +2 −1
  525. include/uapi/linux/l2tp.h +1 −0
  526. include/uapi/linux/netfilter/nfnetlink_cthelper.h +1 −1
  527. include/xen/grant_table.h +7 −0
  528. include/xen/xenbus.h +0 −1
  529. init/Kconfig +5 −6
  530. kernel/bpf/btf.c +0 −2
  531. kernel/bpf/core.c +6 −0
  532. kernel/bpf/verifier.c +58 −33
  533. kernel/events/core.c +38 −4
  534. kernel/fork.c +9 −0
  535. kernel/irq/irqdomain.c +4 −5
  536. kernel/locking/mutex.c +14 −11
  537. kernel/sched/core.c +62 −64
  538. kernel/sched/membarrier.c +1 −3
  539. kernel/sys.c +1 −1
  540. kernel/time/hrtimer.c +39 −21
  541. lib/Kconfig.kasan +1 −0
  542. lib/extable.c +0 −5
  543. mm/highmem.c +12 −5
  544. mm/huge_memory.c +3 −7
  545. mm/hugetlb.c +91 −32
  546. mm/internal.h +0 −5
  547. mm/kfence/report.c +18 −12
  548. mm/madvise.c +12 −1
  549. mm/memcontrol.c +6 −9
  550. mm/memory.c +9 −7
  551. mm/memory_hotplug.c +1 −1
  552. mm/page_alloc.c +82 −85
  553. mm/slab.c +1 −1
  554. mm/slub.c +1 −1
  555. net/9p/client.c +0 −4
  556. net/core/rtnetlink.c +1 −1
  557. net/core/skbuff.c +2 −0
  558. net/dsa/Kconfig +2 −0
  559. net/dsa/dsa_priv.h +14 −11
  560. net/dsa/slave.c +43 −16
  561. net/dsa/tag_mtk.c +13 −6
  562. net/dsa/tag_rtl4_a.c +5 −7
  563. net/ethtool/channels.c +13 −13
  564. net/ipv4/cipso_ipv4.c +2 −11
  565. net/ipv4/inetpeer.c +7 −14
  566. net/ipv4/ip_tunnel.c +2 −3
  567. net/ipv4/ip_vti.c +3 −3
  568. net/ipv4/nexthop.c +7 −3
  569. net/ipv4/tcp.c +17 −9
  570. net/ipv4/udp_offload.c +1 −1
  571. net/ipv6/calipso.c +5 −9
  572. net/ipv6/ip6_gre.c +8 −8
  573. net/ipv6/ip6_tunnel.c +5 −5
  574. net/ipv6/ip6_vti.c +3 −3
  575. net/ipv6/sit.c +1 −1
  576. net/l2tp/l2tp_core.c +22 −19
  577. net/l2tp/l2tp_core.h +1 −0
  578. net/l2tp/l2tp_netlink.c +6 −0
  579. net/mpls/mpls_gso.c +3 −0
  580. net/mptcp/protocol.c +104 −61
  581. net/mptcp/protocol.h +8 −6
  582. net/mptcp/subflow.c +8 −6
  583. net/netfilter/nf_conntrack_helper.c +1 −2
  584. net/netfilter/nf_conntrack_proto_tcp.c +4 −2
  585. net/netfilter/nf_nat_proto.c +21 −4
  586. net/netfilter/nf_tables_api.c +14 −5
  587. net/netfilter/x_tables.c +4 −2
  588. net/netlabel/netlabel_cipso_v4.c +3 −0
  589. net/qrtr/qrtr.c +4 −2
  590. net/sched/sch_api.c +4 −4
  591. net/sctp/tsnmap.c +1 −1
  592. net/sunrpc/auth_gss/svcauth_gss.c +7 −4
  593. net/sunrpc/sched.c +4 −1
  594. net/sunrpc/svc.c +4 −2
  595. net/sunrpc/svc_xprt.c +2 −2
  596. net/sunrpc/xprtrdma/svc_rdma_backchannel.c +3 −3
  597. net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +39 −43
  598. samples/bpf/xdpsock_user.c +2 −0
  599. scripts/Makefile.lib +2 −2
  600. scripts/dummy-tools/gcc +16 −2
  601. scripts/gcc-plugins/Makefile +1 −0
  602. scripts/ld-version.sh +14 −8
  603. security/commoncap.c +1 −11
  604. sound/hda/intel-nhlt.c +5 −0
  605. sound/pci/hda/hda_bind.c +4 −0
  606. sound/pci/hda/hda_controller.c +0 −7
  607. sound/pci/hda/hda_intel.c +2 −0
  608. sound/pci/hda/patch_ca0132.c +1 −0
  609. sound/pci/hda/patch_conexant.c +45 −17
  610. sound/pci/hda/patch_hdmi.c +13 −0
  611. sound/usb/card.c +6 −0
  612. sound/usb/quirks.c +10 −1
  613. sound/usb/usbaudio.h +1 −0
  614. tools/arch/s390/include/uapi/asm/ptrace.h +3 −2
  615. tools/arch/x86/include/asm/cpufeatures.h +13 −6
  616. tools/arch/x86/include/uapi/asm/kvm.h +1 −0
  617. tools/arch/x86/include/uapi/asm/vmx.h +3 −1
  618. tools/bpf/resolve_btfids/main.c +5 −0
  619. tools/build/Makefile +7 −1
  620. tools/include/linux/coresight-pmu.h +15 −5
  621. tools/include/uapi/drm/drm.h +49 −48
  622. tools/include/uapi/drm/i915_drm.h +2 −1
  623. tools/include/uapi/linux/bpf.h +0 −1
  624. tools/include/uapi/linux/kvm.h +73 −0
  625. tools/include/uapi/linux/mount.h +16 −0
  626. tools/include/uapi/linux/openat2.h +4 −0
  627. tools/lib/bpf/xsk.c +3 −2
  628. tools/lib/perf/evlist.c +9 −4
  629. tools/lib/perf/include/internal/evlist.h +2 −0
  630. tools/objtool/check.c +3 −0
  631. tools/perf/Documentation/perf-evlist.txt +1 −1
  632. tools/perf/Documentation/perf-ftrace.txt +2 −2
  633. tools/perf/Documentation/perf-kallsyms.txt +1 −1
  634. tools/perf/Documentation/perf-trace.txt +2 −2
  635. tools/perf/Makefile.perf +2 −10
  636. tools/perf/arch/arm/util/cs-etm.c +8 −4
  637. tools/perf/arch/powerpc/entry/syscalls/syscall.tbl +6 −15
  638. tools/perf/arch/s390/entry/syscalls/syscall.tbl +1 −0
  639. tools/perf/arch/x86/Makefile +6 −5
  640. tools/perf/arch/x86/entry/syscalls/syscall_64.tbl +1 −0
  641. tools/perf/arch/x86/include/arch-tests.h +1 −0
  642. tools/perf/arch/x86/tests/Build +1 −0
  643. tools/perf/arch/x86/tests/arch-tests.c +4 −0
  644. tools/perf/arch/x86/tests/insn-x86.c +1 −1
  645. tools/perf/arch/x86/tests/sample-parsing.c +121 −0
  646. tools/perf/arch/x86/util/archinsn.c +1 −1
  647. tools/perf/bench/numa.c +29 −13
  648. tools/perf/bench/sched-messaging.c +2 −2
  649. tools/perf/bench/sched-pipe.c +2 −2
  650. tools/perf/bench/syscall.c +2 −2
  651. tools/perf/builtin-daemon.c +3 −3
  652. tools/perf/builtin-diff.c +2 −1
  653. tools/perf/builtin-trace.c +2 −3
  654. tools/perf/perf-archive.sh +1 −2
  655. tools/perf/tests/attr.c +7 −1
  656. tools/perf/tests/code-reading.c +3 −7
  657. tools/perf/tests/cpumap.c +2 −0
  658. tools/perf/tests/keep-tracking.c +2 −3
  659. tools/perf/tests/mmap-basic.c +0 −2
  660. tools/perf/tests/perf-time-to-tsc.c +2 −0
  661. tools/perf/tests/sample-parsing.c +0 −4
  662. tools/perf/tests/shell/daemon.sh +16 −16
  663. tools/perf/tests/sw-clock.c +4 −8
  664. tools/perf/tests/switch-tracking.c +2 −3
  665. tools/perf/tests/task-exit.c +3 −7
  666. tools/perf/tests/thread-map.c +3 −5
  667. tools/perf/util/evlist.c +1 −0
  668. tools/perf/util/evsel.c +17 −1
  669. tools/perf/util/evsel.h +3 −1
  670. tools/perf/util/header.c +2 −2
  671. tools/perf/util/map.c +3 −4
  672. tools/perf/util/parse-events.y +5 −1
  673. tools/perf/util/python-ext-sources +1 −0
  674. tools/perf/util/sort.c +2 −2
  675. tools/perf/util/stat-display.c +1 −1
  676. tools/perf/util/stat.c +38 −9
  677. tools/perf/util/trace-event-read.c +1 −0
  678. tools/testing/selftests/arm64/fp/sve-ptrace.c +1 −1
  679. tools/testing/selftests/bpf/progs/netif_receive_skb.c +10 −3
  680. tools/testing/selftests/bpf/progs/test_global_func11.c +1 −1
  681. tools/testing/selftests/bpf/progs/test_tunnel_kern.c +2 −4
  682. tools/testing/selftests/bpf/verifier/array_access.c +2 −1
  683. tools/testing/selftests/bpf/verifier/atomic_and.c +23 −0
  684. tools/testing/selftests/bpf/verifier/atomic_cmpxchg.c +25 −0
  685. tools/testing/selftests/bpf/verifier/atomic_or.c +25 −0
  686. tools/testing/selftests/gpio/.gitignore +1 −1
  687. tools/testing/selftests/net/fib_nexthops.sh +8 −0
  688. tools/testing/selftests/net/forwarding/mirror_gre_bridge_1d_vlan.sh +9 −0
  689. tools/testing/selftests/net/ipsec.c +1 −1
  690. tools/testing/selftests/netfilter/Makefile +1 −1
  691. tools/testing/selftests/netfilter/nf_nat_edemux.sh +99 −0
Documentation/devicetree/bindings/interrupt-controller/ingenic,intc.yaml+1−0
@@ -23,6 +23,7 @@ properties: · 22 unmodified lines
2323 - enum:
2424 - ingenic,jz4775-intc
2525 - ingenic,jz4770-intc
26+ - ingenic,jz4760b-intc
2627 - const: ingenic,jz4760-intc
2728 - items:
2829 - const: ingenic,x1000-intc
Documentation/gpu/todo.rst+21−0
@@ -613,6 +613,27 @@ Some of these date from the very introduction of KMS in 2008 ... · 612 unmodified lines
613613
614614 Level: Intermediate
615615
616+Remove automatic page mapping from dma-buf importing
617+----------------------------------------------------
618+
619+When importing dma-bufs, the dma-buf and PRIME frameworks automatically map
620+imported pages into the importer's DMA area. drm_gem_prime_fd_to_handle() and
621+drm_gem_prime_handle_to_fd() require that importers call dma_buf_attach()
622+even if they never do actual device DMA, but only CPU access through
623+dma_buf_vmap(). This is a problem for USB devices, which do not support DMA
624+operations.
625+
626+To fix the issue, automatic page mappings should be removed from the
627+buffer-sharing code. Fixing this is a bit more involved, since the import/export
628+cache is also tied to &drm_gem_object.import_attach. Meanwhile we paper over
629+this problem for USB devices by fishing out the USB host controller device, as
630+long as that supports DMA. Otherwise importing can still needlessly fail.
631+
632+Contact: Thomas Zimmermann <tzimmermann@suse.de>, Daniel Vetter
633+
634+Level: Advanced
635+
636+
616637 Better Testing
617638 ==============
618639
Documentation/networking/bonding.rst+1−1
@@ -1988,7 +1988,7 @@ netif_carrier. · 1987 unmodified lines
19881988 If use_carrier is 0, then the MII monitor will first query the
19891989 device's (via ioctl) MII registers and check the link state. If that
19901990 request fails (not just that it returns carrier down), then the MII
1991−monitor will make an ethtool ETHOOL_GLINK request to attempt to obtain
1991+monitor will make an ethtool ETHTOOL_GLINK request to attempt to obtain
19921992 the same information. If both methods fail (i.e., the driver either
19931993 does not support or had some error in processing both the MII register
19941994 and ethtool requests), then the MII monitor will assume the link is
Documentation/networking/netdev-FAQ.rst+6−66
@@ -142,73 +142,13 @@ Please send incremental versions on top of what has been merged in order to fix · 141 unmodified lines
142142 the patches the way they would look like if your latest patch series was to be
143143 merged.
144144
145−How can I tell what patches are queued up for backporting to the various stable releases?
146−-----------------------------------------------------------------------------------------
147−Normally Greg Kroah-Hartman collects stable commits himself, but for
148−networking, Dave collects up patches he deems critical for the
149−networking subsystem, and then hands them off to Greg.
150−
151−There is a patchworks queue that you can see here:
152−
153− https://patchwork.kernel.org/bundle/netdev/stable/?state=*
154−
155−It contains the patches which Dave has selected, but not yet handed off
156−to Greg. If Greg already has the patch, then it will be here:
157−
158− https://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git
159−
160−A quick way to find whether the patch is in this stable-queue is to
161−simply clone the repo, and then git grep the mainline commit ID, e.g.
162−::
163−
164− stable-queue$ git grep -l 284041ef21fdf2e
165− releases/3.0.84/ipv6-fix-possible-crashes-in-ip6_cork_release.patch
166− releases/3.4.51/ipv6-fix-possible-crashes-in-ip6_cork_release.patch
167− releases/3.9.8/ipv6-fix-possible-crashes-in-ip6_cork_release.patch
168− stable/stable-queue$
169−
170−I see a network patch and I think it should be backported to stable. Should I request it via stable@vger.kernel.org like the references in the kernel's Documentation/process/stable-kernel-rules.rst file say?
171−---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
172−No, not for networking. Check the stable queues as per above first
173−to see if it is already queued. If not, then send a mail to netdev,
174−listing the upstream commit ID and why you think it should be a stable
175−candidate.
176−
177−Before you jump to go do the above, do note that the normal stable rules
178−in :ref:`Documentation/process/stable-kernel-rules.rst <stable_kernel_rules>`
179−still apply. So you need to explicitly indicate why it is a critical
180−fix and exactly what users are impacted. In addition, you need to
181−convince yourself that you *really* think it has been overlooked,
182−vs. having been considered and rejected.
183−
184−Generally speaking, the longer it has had a chance to "soak" in
185−mainline, the better the odds that it is an OK candidate for stable. So
186−scrambling to request a commit be added the day after it appears should
187−be avoided.
188−
189−I have created a network patch and I think it should be backported to stable. Should I add a Cc: stable@vger.kernel.org like the references in the kernel's Documentation/ directory say?
190−-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
191−No. See above answer. In short, if you think it really belongs in
192−stable, then ensure you write a decent commit log that describes who
193−gets impacted by the bug fix and how it manifests itself, and when the
194−bug was introduced. If you do that properly, then the commit will get
195−handled appropriately and most likely get put in the patchworks stable
196−queue if it really warrants it.
197−
198−If you think there is some valid information relating to it being in
199−stable that does *not* belong in the commit log, then use the three dash
200−marker line as described in
201−:ref:`Documentation/process/submitting-patches.rst <the_canonical_patch_format>`
202−to temporarily embed that information into the patch that you send.
203−
204−Are all networking bug fixes backported to all stable releases?
145+Are there special rules regarding stable submissions on netdev?
205146 ---------------------------------------------------------------
206−Due to capacity, Dave could only take care of the backports for the
207−last two stable releases. For earlier stable releases, each stable
208−branch maintainer is supposed to take care of them. If you find any
209−patch is missing from an earlier stable branch, please notify
210−stable@vger.kernel.org with either a commit ID or a formal patch
211−backported, and CC Dave and other relevant networking developers.
147+While it used to be the case that netdev submissions were not supposed
148+to carry explicit ``CC: stable@vger.kernel.org`` tags that is no longer
149+the case today. Please follow the standard stable rules in
150+:ref:`Documentation/process/stable-kernel-rules.rst <stable_kernel_rules>`,
151+and make sure you include appropriate Fixes tags!
212152
213153 Is the comment style convention different for the networking content?
214154 ---------------------------------------------------------------------
Documentation/process/stable-kernel-rules.rst+0−6
@@ -35,12 +35,6 @@ Rules on what kind of patches are accepted, and which ones are not, into the · 34 unmodified lines
3535 Procedure for submitting patches to the -stable tree
3636 ----------------------------------------------------
3737
38− - If the patch covers files in net/ or drivers/net please follow netdev stable
39− submission guidelines as described in
40− :ref:`Documentation/networking/netdev-FAQ.rst <netdev-FAQ>`
41− after first checking the stable networking queue at
42− https://patchwork.kernel.org/bundle/netdev/stable/?state=*
43− to ensure the requested patch is not already queued up.
4438 - Security patches should not be handled (solely) by the -stable review
4539 process but should follow the procedures in
4640 :ref:`Documentation/admin-guide/security-bugs.rst <securitybugs>`.
Documentation/process/submitting-patches.rst+0−5
@@ -250,11 +250,6 @@ should also read · 249 unmodified lines
250250 :ref:`Documentation/process/stable-kernel-rules.rst <stable_kernel_rules>`
251251 in addition to this file.
252252
253−Note, however, that some subsystem maintainers want to come to their own
254−conclusions on which patches should go to the stable trees. The networking
255−maintainer, in particular, would rather not see individual developers
256−adding lines like the above to their patches.
257−
258253 If changes affect userland-kernel interfaces, please send the MAN-PAGES
259254 maintainer (as listed in the MAINTAINERS file) a man-pages patch, or at
260255 least a notification of the change, so that some information makes its way
Documentation/virt/kvm/api.rst+3−0
@@ -182,6 +182,9 @@ is dependent on the CPU capability and the kernel configuration. The limit can · 181 unmodified lines
182182 be retrieved using KVM_CAP_ARM_VM_IPA_SIZE of the KVM_CHECK_EXTENSION
183183 ioctl() at run-time.
184184
185+Creation of the VM will fail if the requested IPA size (whether it is
186+implicit or explicit) is unsupported on the host.
187+
185188 Please note that configuring the IPA size does not affect the capability
186189 exposed by the guest CPUs in ID_AA64MMFR0_EL1[PARange]. It only affects
187190 size of the address translated by the stage2 level (guest physical to
MAINTAINERS+6−5
@@ -261,8 +261,8 @@ ABI/API · 260 unmodified lines
261261 L: linux-api@vger.kernel.org
262262 F: include/linux/syscalls.h
263263 F: kernel/sys_ni.c
264−F: include/uapi/
265−F: arch/*/include/uapi/
264+X: include/uapi/
265+X: arch/*/include/uapi/
266266
267267 ABIT UGURU 1,2 HARDWARE MONITOR DRIVER
268268 M: Hans de Goede <hdegoede@redhat.com>
@@ -5835,7 +5835,7 @@ M: David Airlie <airlied@linux.ie> · 5566 unmodified lines
58355835 M: Daniel Vetter <daniel@ffwll.ch>
58365836 L: dri-devel@lists.freedesktop.org
58375837 S: Maintained
5838−B: https://bugs.freedesktop.org/
5838+B: https://gitlab.freedesktop.org/drm
58395839 C: irc://chat.freenode.net/dri-devel
58405840 T: git git://anongit.freedesktop.org/drm/drm
58415841 F: Documentation/devicetree/bindings/display/
@@ -10716,7 +10716,8 @@ F: drivers/net/ethernet/marvell/mvpp2/ · 4874 unmodified lines
1071610716
1071710717 MARVELL MWIFIEX WIRELESS DRIVER
1071810718 M: Amitkumar Karwar <amitkarwar@gmail.com>
10719−M: Ganapathi Bhat <ganapathi.bhat@nxp.com>
10719+M: Ganapathi Bhat <ganapathi017@gmail.com>
10720+M: Sharvari Harisangam <sharvari.harisangam@nxp.com>
1072010721 M: Xinming Hu <huxinming820@gmail.com>
1072110722 L: linux-wireless@vger.kernel.org
1072210723 S: Maintained
@@ -19165,7 +19166,7 @@ S: Maintained · 8442 unmodified lines
1916519166 F: drivers/infiniband/hw/vmw_pvrdma/
1916619167
1916719168 VMware PVSCSI driver
19168−M: Jim Gill <jgill@vmware.com>
19169+M: Vishal Bhakta <vbhakta@vmware.com>
1916919170 M: VMware PV-Drivers <pv-drivers@vmware.com>
1917019171 L: linux-scsi@vger.kernel.org
1917119172 S: Maintained
Makefile+4−2
@@ -2,7 +2,7 @@ · 1 unmodified line
22 VERSION = 5
33 PATCHLEVEL = 12
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc2
5+EXTRAVERSION = -rc3
66 NAME = Frozen Wasteland
77
88 # *DOCUMENTATION*
@@ -264,7 +264,8 @@ no-dot-config-targets := $(clean-targets) \ · 255 unmodified lines
264264 $(version_h) headers headers_% archheaders archscripts \
265265 %asm-generic kernelversion %src-pkg dt_binding_check \
266266 outputmakefile
267−no-sync-config-targets := $(no-dot-config-targets) %install kernelrelease
267+no-sync-config-targets := $(no-dot-config-targets) %install kernelrelease \
268+ image_name
268269 single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.s %.symtypes %/
269270
270271 config-build :=
@@ -478,6 +479,7 @@ USERINCLUDE := \ · 207 unmodified lines
478479 -I$(objtree)/arch/$(SRCARCH)/include/generated/uapi \
479480 -I$(srctree)/include/uapi \
480481 -I$(objtree)/include/generated/uapi \
482+ -include $(srctree)/include/linux/compiler-version.h \
481483 -include $(srctree)/include/linux/kconfig.h
482484
483485 # Use LINUXINCLUDE when you must reference the include/ directory.
arch/Kconfig+1−2
@@ -632,13 +632,12 @@ config HAS_LTO_CLANG · 631 unmodified lines
632632 def_bool y
633633 # Clang >= 11: https://github.com/ClangBuiltLinux/linux/issues/510
634634 depends on CC_IS_CLANG && CLANG_VERSION >= 110000 && LD_IS_LLD
635− depends on $(success,test $(LLVM) -eq 1)
636635 depends on $(success,test $(LLVM_IAS) -eq 1)
637636 depends on $(success,$(NM) --help | head -n 1 | grep -qi llvm)
638637 depends on $(success,$(AR) --help | head -n 1 | grep -qi llvm)
639638 depends on ARCH_SUPPORTS_LTO_CLANG
640639 depends on !FTRACE_MCOUNT_USE_RECORDMCOUNT
641− depends on !KASAN
640+ depends on !KASAN || KASAN_HW_TAGS
642641 depends on !GCOV_KERNEL
643642 help
644643 The compiler and Kconfig options support building with Clang's
arch/arm/Kconfig+1−0
@@ -348,6 +348,7 @@ config ARCH_EP93XX · 347 unmodified lines
348348 select ARM_AMBA
349349 imply ARM_PATCH_PHYS_VIRT
350350 select ARM_VIC
351+ select GENERIC_IRQ_MULTI_HANDLER
351352 select AUTO_ZRELADDR
352353 select CLKDEV_LOOKUP
353354 select CLKSRC_MMIO
arch/arm/xen/p2m.c+2−3
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111
1212 #include <xen/xen.h>
1313 #include <xen/interface/memory.h>
14+#include <xen/grant_table.h>
1415 #include <xen/page.h>
1516 #include <xen/swiotlb-xen.h>
1617
@@ -109,7 +110,7 @@ int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops, · 92 unmodified lines
109110 map_ops[i].status = GNTST_general_error;
110111 unmap.host_addr = map_ops[i].host_addr,
111112 unmap.handle = map_ops[i].handle;
112− map_ops[i].handle = ~0;
113+ map_ops[i].handle = INVALID_GRANT_HANDLE;
113114 if (map_ops[i].flags & GNTMAP_device_map)
114115 unmap.dev_bus_addr = map_ops[i].dev_bus_addr;
115116 else
@@ -130,7 +131,6 @@ int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops, · 14 unmodified lines
130131
131132 return 0;
132133 }
133−EXPORT_SYMBOL_GPL(set_foreign_p2m_mapping);
134134
135135 int clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref *unmap_ops,
136136 struct gnttab_unmap_grant_ref *kunmap_ops,
@@ -145,7 +145,6 @@ int clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref *unmap_ops, · 8 unmodified lines
145145
146146 return 0;
147147 }
148−EXPORT_SYMBOL_GPL(clear_foreign_p2m_mapping);
149148
150149 bool __set_phys_to_machine_multi(unsigned long pfn,
151150 unsigned long mfn, unsigned long nr_pages)
arch/arm64/Kconfig+2−10
@@ -1055,8 +1055,6 @@ config HW_PERF_EVENTS · 1054 unmodified lines
10551055 config SYS_SUPPORTS_HUGETLBFS
10561056 def_bool y
10571057
1058−config ARCH_WANT_HUGE_PMD_SHARE
1059−
10601058 config ARCH_HAS_CACHE_LINE_SIZE
10611059 def_bool y
10621060
@@ -1157,8 +1155,8 @@ config XEN · 94 unmodified lines
11571155
11581156 config FORCE_MAX_ZONEORDER
11591157 int
1160− default "14" if (ARM64_64K_PAGES && TRANSPARENT_HUGEPAGE)
1161− default "12" if (ARM64_16K_PAGES && TRANSPARENT_HUGEPAGE)
1158+ default "14" if ARM64_64K_PAGES
1159+ default "12" if ARM64_16K_PAGES
11621160 default "11"
11631161 help
11641162 The kernel memory allocator divides physically contiguous memory
@@ -1855,12 +1853,6 @@ config CMDLINE_FROM_BOOTLOADER · 690 unmodified lines
18551853 the boot loader doesn't provide any, the default kernel command
18561854 string provided in CMDLINE will be used.
18571855
1858−config CMDLINE_EXTEND
1859− bool "Extend bootloader kernel arguments"
1860− help
1861− The command-line arguments provided by the boot loader will be
1862− appended to the default kernel command string.
1863−
18641856 config CMDLINE_FORCE
18651857 bool "Always use the default kernel command string"
18661858 help
arch/arm64/include/asm/kvm_asm.h+4−4
@@ -47,10 +47,10 @@ · 46 unmodified lines
4747 #define __KVM_HOST_SMCCC_FUNC___kvm_flush_vm_context 2
4848 #define __KVM_HOST_SMCCC_FUNC___kvm_tlb_flush_vmid_ipa 3
4949 #define __KVM_HOST_SMCCC_FUNC___kvm_tlb_flush_vmid 4
50−#define __KVM_HOST_SMCCC_FUNC___kvm_tlb_flush_local_vmid 5
50+#define __KVM_HOST_SMCCC_FUNC___kvm_flush_cpu_context 5
5151 #define __KVM_HOST_SMCCC_FUNC___kvm_timer_set_cntvoff 6
5252 #define __KVM_HOST_SMCCC_FUNC___kvm_enable_ssbs 7
53−#define __KVM_HOST_SMCCC_FUNC___vgic_v3_get_ich_vtr_el2 8
53+#define __KVM_HOST_SMCCC_FUNC___vgic_v3_get_gic_config 8
5454 #define __KVM_HOST_SMCCC_FUNC___vgic_v3_read_vmcr 9
5555 #define __KVM_HOST_SMCCC_FUNC___vgic_v3_write_vmcr 10
5656 #define __KVM_HOST_SMCCC_FUNC___vgic_v3_init_lrs 11
@@ -183,16 +183,16 @@ DECLARE_KVM_HYP_SYM(__bp_harden_hyp_vecs); · 126 unmodified lines
183183 #define __bp_harden_hyp_vecs CHOOSE_HYP_SYM(__bp_harden_hyp_vecs)
184184
185185 extern void __kvm_flush_vm_context(void);
186+extern void __kvm_flush_cpu_context(struct kvm_s2_mmu *mmu);
186187 extern void __kvm_tlb_flush_vmid_ipa(struct kvm_s2_mmu *mmu, phys_addr_t ipa,
187188 int level);
188189 extern void __kvm_tlb_flush_vmid(struct kvm_s2_mmu *mmu);
189−extern void __kvm_tlb_flush_local_vmid(struct kvm_s2_mmu *mmu);
190190
191191 extern void __kvm_timer_set_cntvoff(u64 cntvoff);
192192
193193 extern int __kvm_vcpu_run(struct kvm_vcpu *vcpu);
194194
195−extern u64 __vgic_v3_get_ich_vtr_el2(void);
195+extern u64 __vgic_v3_get_gic_config(void);
196196 extern u64 __vgic_v3_read_vmcr(void);
197197 extern void __vgic_v3_write_vmcr(u32 vmcr);
198198 extern void __vgic_v3_init_lrs(void);
arch/arm64/include/asm/kvm_hyp.h+7−1
@@ -83,6 +83,11 @@ void sysreg_restore_guest_state_vhe(struct kvm_cpu_context *ctxt); · 82 unmodified lines
8383 void __debug_switch_to_guest(struct kvm_vcpu *vcpu);
8484 void __debug_switch_to_host(struct kvm_vcpu *vcpu);
8585
86+#ifdef __KVM_NVHE_HYPERVISOR__
87+void __debug_save_host_buffers_nvhe(struct kvm_vcpu *vcpu);
88+void __debug_restore_host_buffers_nvhe(struct kvm_vcpu *vcpu);
89+#endif
90+
8691 void __fpsimd_save_state(struct user_fpsimd_state *fp_regs);
8792 void __fpsimd_restore_state(struct user_fpsimd_state *fp_regs);
8893
@@ -97,7 +102,8 @@ bool kvm_host_psci_handler(struct kvm_cpu_context *host_ctxt); · 8 unmodified lines
97102
98103 void __noreturn hyp_panic(void);
99104 #ifdef __KVM_NVHE_HYPERVISOR__
100−void __noreturn __hyp_do_panic(bool restore_host, u64 spsr, u64 elr, u64 par);
105+void __noreturn __hyp_do_panic(struct kvm_cpu_context *host_ctxt, u64 spsr,
106+ u64 elr, u64 par);
101107 #endif
102108
103109 #endif /* __ARM64_KVM_HYP_H__ */
arch/arm64/include/asm/memory.h+5−0
@@ -328,6 +328,11 @@ static inline void *phys_to_virt(phys_addr_t x) · 327 unmodified lines
328328 #define ARCH_PFN_OFFSET ((unsigned long)PHYS_PFN_OFFSET)
329329
330330 #if !defined(CONFIG_SPARSEMEM_VMEMMAP) || defined(CONFIG_DEBUG_VIRTUAL)
331+#define page_to_virt(x) ({ \
332+ __typeof__(x) __page = x; \
333+ void *__addr = __va(page_to_phys(__page)); \
334+ (void *)__tag_set((const void *)__addr, page_kasan_tag(__page));\
335+})
331336 #define virt_to_page(x) pfn_to_page(virt_to_pfn(x))
332337 #else
333338 #define page_to_virt(x) ({ \
arch/arm64/include/asm/mmu_context.h+0−17
@@ -63,23 +63,6 @@ static inline void cpu_switch_mm(pgd_t *pgd, struct mm_struct *mm) · 62 unmodified lines
6363 extern u64 idmap_t0sz;
6464 extern u64 idmap_ptrs_per_pgd;
6565
66−static inline bool __cpu_uses_extended_idmap(void)
67−{
68− if (IS_ENABLED(CONFIG_ARM64_VA_BITS_52))
69− return false;
70−
71− return unlikely(idmap_t0sz != TCR_T0SZ(VA_BITS));
72−}
73−
74−/*
75− * True if the extended ID map requires an extra level of translation table
76− * to be configured.
77− */
78−static inline bool __cpu_uses_extended_idmap_level(void)
79−{
80− return ARM64_HW_PGTABLE_LEVELS(64 - idmap_t0sz) > CONFIG_PGTABLE_LEVELS;
81−}
82−
8366 /*
8467 * Ensure TCR.T0SZ is set to the provided value.
8568 */
arch/arm64/include/asm/pgtable-prot.h+0−1
@@ -66,7 +66,6 @@ extern bool arm64_use_ng_mappings; · 65 unmodified lines
6666 #define _PAGE_DEFAULT (_PROT_DEFAULT | PTE_ATTRINDX(MT_NORMAL))
6767
6868 #define PAGE_KERNEL __pgprot(PROT_NORMAL)
69−#define PAGE_KERNEL_TAGGED __pgprot(PROT_NORMAL_TAGGED)
7069 #define PAGE_KERNEL_RO __pgprot((PROT_NORMAL & ~PTE_WRITE) | PTE_RDONLY)
7170 #define PAGE_KERNEL_ROX __pgprot((PROT_NORMAL & ~(PTE_WRITE | PTE_PXN)) | PTE_RDONLY)
7271 #define PAGE_KERNEL_EXEC __pgprot(PROT_NORMAL & ~PTE_PXN)
arch/arm64/include/asm/pgtable.h+3−0
@@ -486,6 +486,9 @@ static inline pmd_t pmd_mkdevmap(pmd_t pmd) · 485 unmodified lines
486486 __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_NC) | PTE_PXN | PTE_UXN)
487487 #define pgprot_device(prot) \
488488 __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_DEVICE_nGnRE) | PTE_PXN | PTE_UXN)
489+#define pgprot_tagged(prot) \
490+ __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_TAGGED))
491+#define pgprot_mhp pgprot_tagged
489492 /*
490493 * DMA allocations for non-coherent devices use what the Arm architecture calls
491494 * "Normal non-cacheable" memory, which permits speculation, unaligned accesses
arch/arm64/include/asm/sysreg.h+14−6
@@ -796,6 +796,11 @@ · 795 unmodified lines
796796 #define ID_AA64MMFR0_PARANGE_48 0x5
797797 #define ID_AA64MMFR0_PARANGE_52 0x6
798798
799+#define ID_AA64MMFR0_TGRAN_2_SUPPORTED_DEFAULT 0x0
800+#define ID_AA64MMFR0_TGRAN_2_SUPPORTED_NONE 0x1
801+#define ID_AA64MMFR0_TGRAN_2_SUPPORTED_MIN 0x2
802+#define ID_AA64MMFR0_TGRAN_2_SUPPORTED_MAX 0x7
803+
799804 #ifdef CONFIG_ARM64_PA_BITS_52
800805 #define ID_AA64MMFR0_PARANGE_MAX ID_AA64MMFR0_PARANGE_52
801806 #else
@@ -961,14 +966,17 @@ · 159 unmodified lines
961966 #define ID_PFR1_PROGMOD_SHIFT 0
962967
963968 #if defined(CONFIG_ARM64_4K_PAGES)
964−#define ID_AA64MMFR0_TGRAN_SHIFT ID_AA64MMFR0_TGRAN4_SHIFT
965−#define ID_AA64MMFR0_TGRAN_SUPPORTED ID_AA64MMFR0_TGRAN4_SUPPORTED
969+#define ID_AA64MMFR0_TGRAN_SHIFT ID_AA64MMFR0_TGRAN4_SHIFT
970+#define ID_AA64MMFR0_TGRAN_SUPPORTED_MIN ID_AA64MMFR0_TGRAN4_SUPPORTED
971+#define ID_AA64MMFR0_TGRAN_SUPPORTED_MAX 0x7
966972 #elif defined(CONFIG_ARM64_16K_PAGES)
967−#define ID_AA64MMFR0_TGRAN_SHIFT ID_AA64MMFR0_TGRAN16_SHIFT
968−#define ID_AA64MMFR0_TGRAN_SUPPORTED ID_AA64MMFR0_TGRAN16_SUPPORTED
973+#define ID_AA64MMFR0_TGRAN_SHIFT ID_AA64MMFR0_TGRAN16_SHIFT
974+#define ID_AA64MMFR0_TGRAN_SUPPORTED_MIN ID_AA64MMFR0_TGRAN16_SUPPORTED
975+#define ID_AA64MMFR0_TGRAN_SUPPORTED_MAX 0xF
969976 #elif defined(CONFIG_ARM64_64K_PAGES)
970−#define ID_AA64MMFR0_TGRAN_SHIFT ID_AA64MMFR0_TGRAN64_SHIFT
971−#define ID_AA64MMFR0_TGRAN_SUPPORTED ID_AA64MMFR0_TGRAN64_SUPPORTED
977+#define ID_AA64MMFR0_TGRAN_SHIFT ID_AA64MMFR0_TGRAN64_SHIFT
978+#define ID_AA64MMFR0_TGRAN_SUPPORTED_MIN ID_AA64MMFR0_TGRAN64_SUPPORTED
979+#define ID_AA64MMFR0_TGRAN_SUPPORTED_MAX 0x7
972980 #endif
973981
974982 #define MVFR2_FPMISC_SHIFT 4
arch/arm64/kernel/head.S+5−3
@@ -319,7 +319,7 @@ SYM_FUNC_START_LOCAL(__create_page_tables) · 318 unmodified lines
319319 */
320320 adrp x5, __idmap_text_end
321321 clz x5, x5
322− cmp x5, TCR_T0SZ(VA_BITS) // default T0SZ small enough?
322+ cmp x5, TCR_T0SZ(VA_BITS_MIN) // default T0SZ small enough?
323323 b.ge 1f // .. then skip VA range extension
324324
325325 adr_l x6, idmap_t0sz
@@ -655,8 +655,10 @@ SYM_FUNC_END(__secondary_too_slow) · 329 unmodified lines
655655 SYM_FUNC_START(__enable_mmu)
656656 mrs x2, ID_AA64MMFR0_EL1
657657 ubfx x2, x2, #ID_AA64MMFR0_TGRAN_SHIFT, 4
658− cmp x2, #ID_AA64MMFR0_TGRAN_SUPPORTED
659− b.ne __no_granule_support
658+ cmp x2, #ID_AA64MMFR0_TGRAN_SUPPORTED_MIN
659+ b.lt __no_granule_support
660+ cmp x2, #ID_AA64MMFR0_TGRAN_SUPPORTED_MAX
661+ b.gt __no_granule_support
660662 update_early_cpu_boot_status 0, x2, x3
661663 adrp x2, idmap_pg_dir
662664 phys_to_ttbr x1, x1
arch/arm64/kernel/idreg-override.c+23−20
@@ -163,33 +163,36 @@ static __init void __parse_cmdline(const char *cmdline, bool parse_aliases) · 162 unmodified lines
163163 } while (1);
164164 }
165165
166−static __init void parse_cmdline(void)
166+static __init const u8 *get_bootargs_cmdline(void)
167167 {
168− if (!IS_ENABLED(CONFIG_CMDLINE_FORCE)) {
169− const u8 *prop;
170− void *fdt;
171− int node;
168+ const u8 *prop;
169+ void *fdt;
170+ int node;
172171
173− fdt = get_early_fdt_ptr();
174− if (!fdt)
175− goto out;
172+ fdt = get_early_fdt_ptr();
173+ if (!fdt)
174+ return NULL;
176175
177− node = fdt_path_offset(fdt, "/chosen");
178− if (node < 0)
179− goto out;
176+ node = fdt_path_offset(fdt, "/chosen");
177+ if (node < 0)
178+ return NULL;
180179
181− prop = fdt_getprop(fdt, node, "bootargs", NULL);
182− if (!prop)
183− goto out;
180+ prop = fdt_getprop(fdt, node, "bootargs", NULL);
181+ if (!prop)
182+ return NULL;
184183
185− __parse_cmdline(prop, true);
184+ return strlen(prop) ? prop : NULL;
185+}
186186
187− if (!IS_ENABLED(CONFIG_CMDLINE_EXTEND))
188− return;
189− }
187+static __init void parse_cmdline(void)
188+{
189+ const u8 *prop = get_bootargs_cmdline();
190190
191−out:
192− __parse_cmdline(CONFIG_CMDLINE, true);
191+ if (IS_ENABLED(CONFIG_CMDLINE_FORCE) || !prop)
192+ __parse_cmdline(CONFIG_CMDLINE, true);
193+
194+ if (!IS_ENABLED(CONFIG_CMDLINE_FORCE) && prop)
195+ __parse_cmdline(prop, true);
193196 }
194197
195198 /* Keep checkers quiet */
arch/arm64/kernel/image-vars.h+3−0
@@ -101,6 +101,9 @@ KVM_NVHE_ALIAS(__stop___kvm_ex_table); · 100 unmodified lines
101101 /* Array containing bases of nVHE per-CPU memory regions. */
102102 KVM_NVHE_ALIAS(kvm_arm_hyp_percpu_base);
103103
104+/* PMU available static key */
105+KVM_NVHE_ALIAS(kvm_arm_pmu_available);
106+
104107 #endif /* CONFIG_KVM */
105108
106109 #endif /* __ARM64_KERNEL_IMAGE_VARS_H */
arch/arm64/kernel/perf_event.c+1−1
@@ -460,7 +460,7 @@ static inline int armv8pmu_counter_has_overflowed(u32 pmnc, int idx) · 459 unmodified lines
460460 return pmnc & BIT(ARMV8_IDX_TO_COUNTER(idx));
461461 }
462462
463−static inline u32 armv8pmu_read_evcntr(int idx)
463+static inline u64 armv8pmu_read_evcntr(int idx)
464464 {
465465 u32 counter = ARMV8_IDX_TO_COUNTER(idx);
466466
arch/arm64/kvm/arm.c+6−1
@@ -385,11 +385,16 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) · 384 unmodified lines
385385 last_ran = this_cpu_ptr(mmu->last_vcpu_ran);
386386
387387 /*
388+ * We guarantee that both TLBs and I-cache are private to each
389+ * vcpu. If detecting that a vcpu from the same VM has
390+ * previously run on the same physical CPU, call into the
391+ * hypervisor code to nuke the relevant contexts.
392+ *
388393 * We might get preempted before the vCPU actually runs, but
389394 * over-invalidation doesn't affect correctness.
390395 */
391396 if (*last_ran != vcpu->vcpu_id) {
392− kvm_call_hyp(__kvm_tlb_flush_local_vmid, mmu);
397+ kvm_call_hyp(__kvm_flush_cpu_context, mmu);
393398 *last_ran = vcpu->vcpu_id;
394399 }
395400
arch/arm64/kvm/hyp/entry.S+5−3
@@ -85,8 +85,10 @@ SYM_INNER_LABEL(__guest_exit_panic, SYM_L_GLOBAL) · 84 unmodified lines
8585
8686 // If the hyp context is loaded, go straight to hyp_panic
8787 get_loaded_vcpu x0, x1
88− cbz x0, hyp_panic
88+ cbnz x0, 1f
89+ b hyp_panic
8990
91+1:
9092 // The hyp context is saved so make sure it is restored to allow
9193 // hyp_panic to run at hyp and, subsequently, panic to run in the host.
9294 // This makes use of __guest_exit to avoid duplication but sets the
@@ -94,7 +96,7 @@ SYM_INNER_LABEL(__guest_exit_panic, SYM_L_GLOBAL) · 1 unmodified line
9496 // current state is saved to the guest context but it will only be
9597 // accurate if the guest had been completely restored.
9698 adr_this_cpu x0, kvm_hyp_ctxt, x1
97− adr x1, hyp_panic
99+ adr_l x1, hyp_panic
98100 str x1, [x0, #CPU_XREG_OFFSET(30)]
99101
100102 get_vcpu_ptr x1, x0
@@ -146,7 +148,7 @@ SYM_INNER_LABEL(__guest_exit, SYM_L_GLOBAL) · 45 unmodified lines
146148 // Now restore the hyp regs
147149 restore_callee_saved_regs x2
148150
149− set_loaded_vcpu xzr, x1, x2
151+ set_loaded_vcpu xzr, x2, x3
150152
151153 alternative_if ARM64_HAS_RAS_EXTN
152154 // If we have the RAS extensions we can consume a pending error
arch/arm64/kvm/hyp/include/hyp/switch.h+6−3
@@ -90,15 +90,18 @@ static inline void __activate_traps_common(struct kvm_vcpu *vcpu) · 89 unmodified lines
9090 * counter, which could make a PMXEVCNTR_EL0 access UNDEF at
9191 * EL1 instead of being trapped to EL2.
9292 */
93− write_sysreg(0, pmselr_el0);
94− write_sysreg(ARMV8_PMU_USERENR_MASK, pmuserenr_el0);
93+ if (kvm_arm_support_pmu_v3()) {
94+ write_sysreg(0, pmselr_el0);
95+ write_sysreg(ARMV8_PMU_USERENR_MASK, pmuserenr_el0);
96+ }
9597 write_sysreg(vcpu->arch.mdcr_el2, mdcr_el2);
9698 }
9799
98100 static inline void __deactivate_traps_common(void)
99101 {
100102 write_sysreg(0, hstr_el2);
101− write_sysreg(0, pmuserenr_el0);
103+ if (kvm_arm_support_pmu_v3())
104+ write_sysreg(0, pmuserenr_el0);
102105 }
103106
104107 static inline void ___activate_traps(struct kvm_vcpu *vcpu)
arch/arm64/kvm/hyp/nvhe/debug-sr.c+10−2
@@ -58,16 +58,24 @@ static void __debug_restore_spe(u64 pmscr_el1) · 57 unmodified lines
5858 write_sysreg_s(pmscr_el1, SYS_PMSCR_EL1);
5959 }
6060
61−void __debug_switch_to_guest(struct kvm_vcpu *vcpu)
61+void __debug_save_host_buffers_nvhe(struct kvm_vcpu *vcpu)
6262 {
6363 /* Disable and flush SPE data generation */
6464 __debug_save_spe(&vcpu->arch.host_debug_state.pmscr_el1);
65+}
66+
67+void __debug_switch_to_guest(struct kvm_vcpu *vcpu)
68+{
6569 __debug_switch_to_guest_common(vcpu);
6670 }
6771
68−void __debug_switch_to_host(struct kvm_vcpu *vcpu)
72+void __debug_restore_host_buffers_nvhe(struct kvm_vcpu *vcpu)
6973 {
7074 __debug_restore_spe(vcpu->arch.host_debug_state.pmscr_el1);
75+}
76+
77+void __debug_switch_to_host(struct kvm_vcpu *vcpu)
78+{
7179 __debug_switch_to_host_common(vcpu);
7280 }
7381
arch/arm64/kvm/hyp/nvhe/host.S+8−7
@@ -71,7 +71,8 @@ SYM_FUNC_START(__host_enter) · 70 unmodified lines
7171 SYM_FUNC_END(__host_enter)
7272
7373 /*
74− * void __noreturn __hyp_do_panic(bool restore_host, u64 spsr, u64 elr, u64 par);
74+ * void __noreturn __hyp_do_panic(struct kvm_cpu_context *host_ctxt, u64 spsr,
75+ * u64 elr, u64 par);
7576 */
7677 SYM_FUNC_START(__hyp_do_panic)
7778 /* Prepare and exit to the host's panic funciton. */
@@ -82,9 +83,11 @@ SYM_FUNC_START(__hyp_do_panic) · 4 unmodified lines
8283 hyp_kimg_va lr, x6
8384 msr elr_el2, lr
8485
85− /* Set the panic format string. Use the, now free, LR as scratch. */
86− ldr lr, =__hyp_panic_string
87− hyp_kimg_va lr, x6
86+ mov x29, x0
87+
88+ /* Load the format string into x0 and arguments into x1-7 */
89+ ldr x0, =__hyp_panic_string
90+ hyp_kimg_va x0, x6
8891
8992 /* Load the format arguments into x1-7. */
9093 mov x6, x3
@@ -94,9 +97,7 @@ SYM_FUNC_START(__hyp_do_panic) · 3 unmodified lines
9497 mrs x5, hpfar_el2
9598
9699 /* Enter the host, conditionally restoring the host context. */
97− cmp x0, xzr
98− mov x0, lr
99− b.eq __host_enter_without_restoring
100+ cbz x29, __host_enter_without_restoring
100101 b __host_enter_for_panic
101102 SYM_FUNC_END(__hyp_do_panic)
102103
arch/arm64/kvm/hyp/nvhe/hyp-main.c+6−6
@@ -46,11 +46,11 @@ static void handle___kvm_tlb_flush_vmid(struct kvm_cpu_context *host_ctxt) · 45 unmodified lines
4646 __kvm_tlb_flush_vmid(kern_hyp_va(mmu));
4747 }
4848
49−static void handle___kvm_tlb_flush_local_vmid(struct kvm_cpu_context *host_ctxt)
49+static void handle___kvm_flush_cpu_context(struct kvm_cpu_context *host_ctxt)
5050 {
5151 DECLARE_REG(struct kvm_s2_mmu *, mmu, host_ctxt, 1);
5252
53− __kvm_tlb_flush_local_vmid(kern_hyp_va(mmu));
53+ __kvm_flush_cpu_context(kern_hyp_va(mmu));
5454 }
5555
5656 static void handle___kvm_timer_set_cntvoff(struct kvm_cpu_context *host_ctxt)
@@ -67,9 +67,9 @@ static void handle___kvm_enable_ssbs(struct kvm_cpu_context *host_ctxt) · 10 unmodified lines
6767 write_sysreg_el2(tmp, SYS_SCTLR);
6868 }
6969
70−static void handle___vgic_v3_get_ich_vtr_el2(struct kvm_cpu_context *host_ctxt)
70+static void handle___vgic_v3_get_gic_config(struct kvm_cpu_context *host_ctxt)
7171 {
72− cpu_reg(host_ctxt, 1) = __vgic_v3_get_ich_vtr_el2();
72+ cpu_reg(host_ctxt, 1) = __vgic_v3_get_gic_config();
7373 }
7474
7575 static void handle___vgic_v3_read_vmcr(struct kvm_cpu_context *host_ctxt)
@@ -115,10 +115,10 @@ static const hcall_t host_hcall[] = { · 39 unmodified lines
115115 HANDLE_FUNC(__kvm_flush_vm_context),
116116 HANDLE_FUNC(__kvm_tlb_flush_vmid_ipa),
117117 HANDLE_FUNC(__kvm_tlb_flush_vmid),
118− HANDLE_FUNC(__kvm_tlb_flush_local_vmid),
118+ HANDLE_FUNC(__kvm_flush_cpu_context),
119119 HANDLE_FUNC(__kvm_timer_set_cntvoff),
120120 HANDLE_FUNC(__kvm_enable_ssbs),
121− HANDLE_FUNC(__vgic_v3_get_ich_vtr_el2),
121+ HANDLE_FUNC(__vgic_v3_get_gic_config),
122122 HANDLE_FUNC(__vgic_v3_read_vmcr),
123123 HANDLE_FUNC(__vgic_v3_write_vmcr),
124124 HANDLE_FUNC(__vgic_v3_init_lrs),
arch/arm64/kvm/hyp/nvhe/switch.c+11−3
@@ -192,6 +192,14 @@ int __kvm_vcpu_run(struct kvm_vcpu *vcpu) · 191 unmodified lines
192192 pmu_switch_needed = __pmu_switch_to_guest(host_ctxt);
193193
194194 __sysreg_save_state_nvhe(host_ctxt);
195+ /*
196+ * We must flush and disable the SPE buffer for nVHE, as
197+ * the translation regime(EL1&0) is going to be loaded with
198+ * that of the guest. And we must do this before we change the
199+ * translation regime to EL2 (via MDCR_EL2_E2PB == 0) and
200+ * before we load guest Stage1.
201+ */
202+ __debug_save_host_buffers_nvhe(vcpu);
195203
196204 __adjust_pc(vcpu);
197205
@@ -234,11 +242,12 @@ int __kvm_vcpu_run(struct kvm_vcpu *vcpu) · 36 unmodified lines
234242 if (vcpu->arch.flags & KVM_ARM64_FP_ENABLED)
235243 __fpsimd_save_fpexc32(vcpu);
236244
245+ __debug_switch_to_host(vcpu);
237246 /*
238247 * This must come after restoring the host sysregs, since a non-VHE
239248 * system may enable SPE here and make use of the TTBRs.
240249 */
241− __debug_switch_to_host(vcpu);
250+ __debug_restore_host_buffers_nvhe(vcpu);
242251
243252 if (pmu_switch_needed)
244253 __pmu_switch_to_host(host_ctxt);
@@ -257,7 +266,6 @@ void __noreturn hyp_panic(void) · 12 unmodified lines
257266 u64 spsr = read_sysreg_el2(SYS_SPSR);
258267 u64 elr = read_sysreg_el2(SYS_ELR);
259268 u64 par = read_sysreg_par();
260− bool restore_host = true;
261269 struct kvm_cpu_context *host_ctxt;
262270 struct kvm_vcpu *vcpu;
263271
@@ -271,7 +279,7 @@ void __noreturn hyp_panic(void) · 7 unmodified lines
271279 __sysreg_restore_state_nvhe(host_ctxt);
272280 }
273281
274− __hyp_do_panic(restore_host, spsr, elr, par);
282+ __hyp_do_panic(host_ctxt, spsr, elr, par);
275283 unreachable();
276284 }
277285
arch/arm64/kvm/hyp/nvhe/tlb.c+2−1
@@ -123,7 +123,7 @@ void __kvm_tlb_flush_vmid(struct kvm_s2_mmu *mmu) · 122 unmodified lines
123123 __tlb_switch_to_host(&cxt);
124124 }
125125
126−void __kvm_tlb_flush_local_vmid(struct kvm_s2_mmu *mmu)
126+void __kvm_flush_cpu_context(struct kvm_s2_mmu *mmu)
127127 {
128128 struct tlb_inv_context cxt;
129129
@@ -131,6 +131,7 @@ void __kvm_tlb_flush_local_vmid(struct kvm_s2_mmu *mmu) · 1 unmodified line
131131 __tlb_switch_to_guest(mmu, &cxt);
132132
133133 __tlbi(vmalle1);
134+ asm volatile("ic iallu");
134135 dsb(nsh);
135136 isb();
136137
arch/arm64/kvm/hyp/pgtable.c+1−0
@@ -223,6 +223,7 @@ static inline int __kvm_pgtable_visit(struct kvm_pgtable_walk_data *data, · 222 unmodified lines
223223 goto out;
224224
225225 if (!table) {
226+ data->addr = ALIGN_DOWN(data->addr, kvm_granule_size(level));
226227 data->addr += kvm_granule_size(level);
227228 goto out;
228229 }
arch/arm64/kvm/hyp/vgic-v3-sr.c+38−2
@@ -405,9 +405,45 @@ void __vgic_v3_init_lrs(void) · 404 unmodified lines
405405 __gic_v3_set_lr(0, i);
406406 }
407407
408−u64 __vgic_v3_get_ich_vtr_el2(void)
408+/*
409+ * Return the GIC CPU configuration:
410+ * - [31:0] ICH_VTR_EL2
411+ * - [62:32] RES0
412+ * - [63] MMIO (GICv2) capable
413+ */
414+u64 __vgic_v3_get_gic_config(void)
409415 {
410− return read_gicreg(ICH_VTR_EL2);
416+ u64 val, sre = read_gicreg(ICC_SRE_EL1);
417+ unsigned long flags = 0;
418+
419+ /*
420+ * To check whether we have a MMIO-based (GICv2 compatible)
421+ * CPU interface, we need to disable the system register
422+ * view. To do that safely, we have to prevent any interrupt
423+ * from firing (which would be deadly).
424+ *
425+ * Note that this only makes sense on VHE, as interrupts are
426+ * already masked for nVHE as part of the exception entry to
427+ * EL2.
428+ */
429+ if (has_vhe())
430+ flags = local_daif_save();
431+
432+ write_gicreg(0, ICC_SRE_EL1);
433+ isb();
434+
435+ val = read_gicreg(ICC_SRE_EL1);
436+
437+ write_gicreg(sre, ICC_SRE_EL1);
438+ isb();
439+
440+ if (has_vhe())
441+ local_daif_restore(flags);
442+
443+ val = (val & ICC_SRE_EL1_SRE) ? 0 : (1ULL << 63);
444+ val |= read_gicreg(ICH_VTR_EL2);
445+
446+ return val;
411447 }
412448
413449 u64 __vgic_v3_read_vmcr(void)
arch/arm64/kvm/hyp/vhe/tlb.c+2−1
@@ -127,7 +127,7 @@ void __kvm_tlb_flush_vmid(struct kvm_s2_mmu *mmu) · 126 unmodified lines
127127 __tlb_switch_to_host(&cxt);
128128 }
129129
130−void __kvm_tlb_flush_local_vmid(struct kvm_s2_mmu *mmu)
130+void __kvm_flush_cpu_context(struct kvm_s2_mmu *mmu)
131131 {
132132 struct tlb_inv_context cxt;
133133
@@ -135,6 +135,7 @@ void __kvm_tlb_flush_local_vmid(struct kvm_s2_mmu *mmu) · 1 unmodified line
135135 __tlb_switch_to_guest(mmu, &cxt);
136136
137137 __tlbi(vmalle1);
138+ asm volatile("ic iallu");
138139 dsb(nsh);
139140 isb();
140141
arch/arm64/kvm/mmu.c+1−2
@@ -1312,8 +1312,7 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm, · 1311 unmodified lines
13121312 * Prevent userspace from creating a memory region outside of the IPA
13131313 * space addressable by the KVM guest IPA space.
13141314 */
1315− if (memslot->base_gfn + memslot->npages >=
1316− (kvm_phys_size(kvm) >> PAGE_SHIFT))
1315+ if ((memslot->base_gfn + memslot->npages) > (kvm_phys_size(kvm) >> PAGE_SHIFT))
13171316 return -EFAULT;
13181317
13191318 mmap_read_lock(current->mm);
arch/arm64/kvm/perf.c+10−0
@@ -11,6 +11,8 @@ · 10 unmodified lines
1111
1212 #include <asm/kvm_emulate.h>
1313
14+DEFINE_STATIC_KEY_FALSE(kvm_arm_pmu_available);
15+
1416 static int kvm_is_in_guest(void)
1517 {
1618 return kvm_get_running_vcpu() != NULL;
@@ -48,6 +50,14 @@ static struct perf_guest_info_callbacks kvm_guest_cbs = { · 31 unmodified lines
4850
4951 int kvm_perf_init(void)
5052 {
53+ /*
54+ * Check if HW_PERF_EVENTS are supported by checking the number of
55+ * hardware performance counters. This could ensure the presence of
56+ * a physical PMU and CONFIG_PERF_EVENT is selected.
57+ */
58+ if (IS_ENABLED(CONFIG_ARM_PMU) && perf_num_counters() > 0)
59+ static_branch_enable(&kvm_arm_pmu_available);
60+
5161 return perf_register_guest_info_callbacks(&kvm_guest_cbs);
5262 }
5363
arch/arm64/kvm/pmu-emul.c+0−10
@@ -823,16 +823,6 @@ u64 kvm_pmu_get_pmceid(struct kvm_vcpu *vcpu, bool pmceid1) · 822 unmodified lines
823823 return val & mask;
824824 }
825825
826−bool kvm_arm_support_pmu_v3(void)
827−{
828− /*
829− * Check if HW_PERF_EVENTS are supported by checking the number of
830− * hardware performance counters. This could ensure the presence of
831− * a physical PMU and CONFIG_PERF_EVENT is selected.
832− */
833− return (perf_num_counters() > 0);
834−}
835−
836826 int kvm_arm_pmu_v3_enable(struct kvm_vcpu *vcpu)
837827 {
838828 if (!kvm_vcpu_has_pmu(vcpu))
arch/arm64/kvm/reset.c+14−8
@@ -311,23 +311,24 @@ int kvm_set_ipa_limit(void) · 310 unmodified lines
311311 }
312312
313313 switch (cpuid_feature_extract_unsigned_field(mmfr0, tgran_2)) {
314− default:
315− case 1:
314+ case ID_AA64MMFR0_TGRAN_2_SUPPORTED_NONE:
316315 kvm_err("PAGE_SIZE not supported at Stage-2, giving up\n");
317316 return -EINVAL;
318− case 0:
317+ case ID_AA64MMFR0_TGRAN_2_SUPPORTED_DEFAULT:
319318 kvm_debug("PAGE_SIZE supported at Stage-2 (default)\n");
320319 break;
321− case 2:
320+ case ID_AA64MMFR0_TGRAN_2_SUPPORTED_MIN ... ID_AA64MMFR0_TGRAN_2_SUPPORTED_MAX:
322321 kvm_debug("PAGE_SIZE supported at Stage-2 (advertised)\n");
323322 break;
323+ default:
324+ kvm_err("Unsupported value for TGRAN_2, giving up\n");
325+ return -EINVAL;
324326 }
325327
326328 kvm_ipa_limit = id_aa64mmfr0_parange_to_phys_shift(parange);
327− WARN(kvm_ipa_limit < KVM_PHYS_SHIFT,
328− "KVM IPA Size Limit (%d bits) is smaller than default size\n",
329− kvm_ipa_limit);
330− kvm_info("IPA Size Limit: %d bits\n", kvm_ipa_limit);
329+ kvm_info("IPA Size Limit: %d bits%s\n", kvm_ipa_limit,
330+ ((kvm_ipa_limit < KVM_PHYS_SHIFT) ?
331+ " (Reduced IPA size, limited VM/VMM compatibility)" : ""));
331332
332333 return 0;
333334 }
@@ -356,6 +357,11 @@ int kvm_arm_setup_stage2(struct kvm *kvm, unsigned long type) · 22 unmodified lines
356357 return -EINVAL;
357358 } else {
358359 phys_shift = KVM_PHYS_SHIFT;
360+ if (phys_shift > kvm_ipa_limit) {
361+ pr_warn_once("%s using unsupported default IPA limit, upgrade your VMM\n",
362+ current->comm);
363+ return -EINVAL;
364+ }
359365 }
360366
361367 mmfr0 = read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1);
arch/arm64/kvm/vgic/vgic-v3.c+9−3
@@ -574,9 +574,13 @@ early_param("kvm-arm.vgic_v4_enable", early_gicv4_enable); · 573 unmodified lines
574574 */
575575 int vgic_v3_probe(const struct gic_kvm_info *info)
576576 {
577− u32 ich_vtr_el2 = kvm_call_hyp_ret(__vgic_v3_get_ich_vtr_el2);
577+ u64 ich_vtr_el2 = kvm_call_hyp_ret(__vgic_v3_get_gic_config);
578+ bool has_v2;
578579 int ret;
579580
581+ has_v2 = ich_vtr_el2 >> 63;
582+ ich_vtr_el2 = (u32)ich_vtr_el2;
583+
580584 /*
581585 * The ListRegs field is 5 bits, but there is an architectural
582586 * maximum of 16 list registers. Just ignore bit 4...
@@ -594,13 +598,15 @@ int vgic_v3_probe(const struct gic_kvm_info *info) · 11 unmodified lines
594598 gicv4_enable ? "en" : "dis");
595599 }
596600
601+ kvm_vgic_global_state.vcpu_base = 0;
602+
597603 if (!info->vcpu.start) {
598604 kvm_info("GICv3: no GICV resource entry\n");
599− kvm_vgic_global_state.vcpu_base = 0;
605+ } else if (!has_v2) {
606+ pr_warn(FW_BUG "CPU interface incapable of MMIO access\n");
600607 } else if (!PAGE_ALIGNED(info->vcpu.start)) {
601608 pr_warn("GICV physical address 0x%llx not page aligned\n",
602609 (unsigned long long)info->vcpu.start);
603− kvm_vgic_global_state.vcpu_base = 0;
604610 } else {
605611 kvm_vgic_global_state.vcpu_base = info->vcpu.start;
606612 kvm_vgic_global_state.can_emulate_gicv2 = true;
arch/arm64/mm/init.c+26−3
@@ -219,17 +219,40 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max) · 218 unmodified lines
219219
220220 int pfn_valid(unsigned long pfn)
221221 {
222− phys_addr_t addr = pfn << PAGE_SHIFT;
222+ phys_addr_t addr = PFN_PHYS(pfn);
223223
224− if ((addr >> PAGE_SHIFT) != pfn)
224+ /*
225+ * Ensure the upper PAGE_SHIFT bits are clear in the
226+ * pfn. Else it might lead to false positives when
227+ * some of the upper bits are set, but the lower bits
228+ * match a valid pfn.
229+ */
230+ if (PHYS_PFN(addr) != pfn)
225231 return 0;
226232
227233 #ifdef CONFIG_SPARSEMEM
234+{
235+ struct mem_section *ms;
236+
228237 if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS)
229238 return 0;
230239
231− if (!valid_section(__pfn_to_section(pfn)))
240+ ms = __pfn_to_section(pfn);
241+ if (!valid_section(ms))
232242 return 0;
243+
244+ /*
245+ * ZONE_DEVICE memory does not have the memblock entries.
246+ * memblock_is_map_memory() check for ZONE_DEVICE based
247+ * addresses will always fail. Even the normal hotplugged
248+ * memory will never have MEMBLOCK_NOMAP flag set in their
249+ * memblock entries. Skip memblock search for all non early
250+ * memory sections covering all of hotplug memory including
251+ * both normal and ZONE_DEVICE based.
252+ */
253+ if (!early_section(ms))
254+ return pfn_section_valid(ms, pfn);
255+}
233256 #endif
234257 return memblock_is_map_memory(addr);
235258 }
arch/arm64/mm/mmu.c+3−2
@@ -40,7 +40,7 @@ · 39 unmodified lines
4040 #define NO_BLOCK_MAPPINGS BIT(0)
4141 #define NO_CONT_MAPPINGS BIT(1)
4242
43−u64 idmap_t0sz = TCR_T0SZ(VA_BITS);
43+u64 idmap_t0sz = TCR_T0SZ(VA_BITS_MIN);
4444 u64 idmap_ptrs_per_pgd = PTRS_PER_PGD;
4545
4646 u64 __section(".mmuoff.data.write") vabits_actual;
@@ -512,7 +512,8 @@ static void __init map_mem(pgd_t *pgdp) · 465 unmodified lines
512512 * if MTE is present. Otherwise, it has the same attributes as
513513 * PAGE_KERNEL.
514514 */
515− __map_memblock(pgdp, start, end, PAGE_KERNEL_TAGGED, flags);
515+ __map_memblock(pgdp, start, end, pgprot_tagged(PAGE_KERNEL),
516+ flags);
516517 }
517518
518519 /*
arch/ia64/include/asm/syscall.h+1−1
@@ -32,7 +32,7 @@ static inline void syscall_rollback(struct task_struct *task, · 31 unmodified lines
3232 static inline long syscall_get_error(struct task_struct *task,
3333 struct pt_regs *regs)
3434 {
35− return regs->r10 == -1 ? regs->r8:0;
35+ return regs->r10 == -1 ? -regs->r8:0;
3636 }
3737
3838 static inline long syscall_get_return_value(struct task_struct *task,
arch/ia64/kernel/ptrace.c+18−6
@@ -2013,27 +2013,39 @@ static void syscall_get_set_args_cb(struct unw_frame_info *info, void *data) · 2012 unmodified lines
20132013 {
20142014 struct syscall_get_set_args *args = data;
20152015 struct pt_regs *pt = args->regs;
2016− unsigned long *krbs, cfm, ndirty;
2016+ unsigned long *krbs, cfm, ndirty, nlocals, nouts;
20172017 int i, count;
20182018
20192019 if (unw_unwind_to_user(info) < 0)
20202020 return;
20212021
2022+ /*
2023+ * We get here via a few paths:
2024+ * - break instruction: cfm is shared with caller.
2025+ * syscall args are in out= regs, locals are non-empty.
2026+ * - epsinstruction: cfm is set by br.call
2027+ * locals don't exist.
2028+ *
2029+ * For both cases argguments are reachable in cfm.sof - cfm.sol.
2030+ * CFM: [ ... | sor: 17..14 | sol : 13..7 | sof : 6..0 ]
2031+ */
20222032 cfm = pt->cr_ifs;
2033+ nlocals = (cfm >> 7) & 0x7f; /* aka sol */
2034+ nouts = (cfm & 0x7f) - nlocals; /* aka sof - sol */
20232035 krbs = (unsigned long *)info->task + IA64_RBS_OFFSET/8;
20242036 ndirty = ia64_rse_num_regs(krbs, krbs + (pt->loadrs >> 19));
20252037
20262038 count = 0;
20272039 if (in_syscall(pt))
2028− count = min_t(int, args->n, cfm & 0x7f);
2040+ count = min_t(int, args->n, nouts);
20292041
2042+ /* Iterate over outs. */
20302043 for (i = 0; i < count; i++) {
2044+ int j = ndirty + nlocals + i + args->i;
20312045 if (args->rw)
2032− *ia64_rse_skip_regs(krbs, ndirty + i + args->i) =
2033− args->args[i];
2046+ *ia64_rse_skip_regs(krbs, j) = args->args[i];
20342047 else
2035− args->args[i] = *ia64_rse_skip_regs(krbs,
2036− ndirty + i + args->i);
2048+ args->args[i] = *ia64_rse_skip_regs(krbs, j);
20372049 }
20382050
20392051 if (!args->rw) {
arch/m68k/include/asm/page_mm.h+1−1
@@ -171,7 +171,7 @@ static inline __attribute_const__ int __virt_to_node_shift(void) · 170 unmodified lines
171171 #include <asm-generic/memory_model.h>
172172 #endif
173173
174−#define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory)
174+#define virt_addr_valid(kaddr) ((unsigned long)(kaddr) >= PAGE_OFFSET && (unsigned long)(kaddr) < (unsigned long)high_memory)
175175 #define pfn_valid(pfn) virt_addr_valid(pfn_to_virt(pfn))
176176
177177 #endif /* __ASSEMBLY__ */
arch/m68k/include/asm/page_no.h+2−2
@@ -30,8 +30,8 @@ extern unsigned long memory_end; · 29 unmodified lines
3030 #define page_to_pfn(page) virt_to_pfn(page_to_virt(page))
3131 #define pfn_valid(pfn) ((pfn) < max_mapnr)
3232
33−#define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
34− ((void *)(kaddr) < (void *)memory_end))
33+#define virt_addr_valid(kaddr) (((unsigned long)(kaddr) >= PAGE_OFFSET) && \
34+ ((unsigned long)(kaddr) < memory_end))
3535
3636 #endif /* __ASSEMBLY__ */
3737
arch/mips/boot/compressed/decompress.c+8−0
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414
1515 #include <asm/addrspace.h>
1616 #include <asm/unaligned.h>
17+#include <asm-generic/vmlinux.lds.h>
1718
1819 /*
1920 * These two variables specify the free mem region
@@ -120,6 +121,13 @@ void decompress_kernel(unsigned long boot_heap_start) · 100 unmodified lines
120121 /* last four bytes is always image size in little endian */
121122 image_size = get_unaligned_le32((void *)&__image_end - 4);
122123
124+ /* The device tree's address must be properly aligned */
125+ image_size = ALIGN(image_size, STRUCT_ALIGNMENT);
126+
127+ puts("Copy device tree to address ");
128+ puthex(VMLINUX_LOAD_ADDRESS_ULL + image_size);
129+ puts("\n");
130+
123131 /* copy dtb to where the booted kernel will expect it */
124132 memcpy((void *)VMLINUX_LOAD_ADDRESS_ULL + image_size,
125133 __appended_dtb, dtb_size);
arch/mips/crypto/Makefile+2−2
@@ -12,8 +12,8 @@ AFLAGS_chacha-core.o += -O2 # needed to fill branch delay slots · 11 unmodified lines
1212 obj-$(CONFIG_CRYPTO_POLY1305_MIPS) += poly1305-mips.o
1313 poly1305-mips-y := poly1305-core.o poly1305-glue.o
1414
15−perlasm-flavour-$(CONFIG_CPU_MIPS32) := o32
16−perlasm-flavour-$(CONFIG_CPU_MIPS64) := 64
15+perlasm-flavour-$(CONFIG_32BIT) := o32
16+perlasm-flavour-$(CONFIG_64BIT) := 64
1717
1818 quiet_cmd_perlasm = PERLASM $@
1919 cmd_perlasm = $(PERL) $(<) $(perlasm-flavour-y) $(@)
arch/mips/include/asm/traps.h+3−0
@@ -24,8 +24,11 @@ extern void (*board_ebase_setup)(void); · 23 unmodified lines
2424 extern void (*board_cache_error_setup)(void);
2525
2626 extern int register_nmi_notifier(struct notifier_block *nb);
27+extern void reserve_exception_space(phys_addr_t addr, unsigned long size);
2728 extern char except_vec_nmi[];
2829
30+#define VECTORSPACING 0x100 /* for EI/VI mode */
31+
2932 #define nmi_notifier(fn, pri) \
3033 ({ \
3134 static struct notifier_block fn##_nb = { \
arch/mips/kernel/cpu-probe.c+6−0
@@ -26,6 +26,7 @@ · 25 unmodified lines
2626 #include <asm/elf.h>
2727 #include <asm/pgtable-bits.h>
2828 #include <asm/spram.h>
29+#include <asm/traps.h>
2930 #include <linux/uaccess.h>
3031
3132 #include "fpu-probe.h"
@@ -1628,6 +1629,7 @@ static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu) · 1596 unmodified lines
16281629 c->cputype = CPU_BMIPS3300;
16291630 __cpu_name[cpu] = "Broadcom BMIPS3300";
16301631 set_elf_platform(cpu, "bmips3300");
1632+ reserve_exception_space(0x400, VECTORSPACING * 64);
16311633 break;
16321634 case PRID_IMP_BMIPS43XX: {
16331635 int rev = c->processor_id & PRID_REV_MASK;
@@ -1638,6 +1640,7 @@ static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu) · 4 unmodified lines
16381640 __cpu_name[cpu] = "Broadcom BMIPS4380";
16391641 set_elf_platform(cpu, "bmips4380");
16401642 c->options |= MIPS_CPU_RIXI;
1643+ reserve_exception_space(0x400, VECTORSPACING * 64);
16411644 } else {
16421645 c->cputype = CPU_BMIPS4350;
16431646 __cpu_name[cpu] = "Broadcom BMIPS4350";
@@ -1654,6 +1657,7 @@ static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu) · 10 unmodified lines
16541657 __cpu_name[cpu] = "Broadcom BMIPS5000";
16551658 set_elf_platform(cpu, "bmips5000");
16561659 c->options |= MIPS_CPU_ULRI | MIPS_CPU_RIXI;
1660+ reserve_exception_space(0x1000, VECTORSPACING * 64);
16571661 break;
16581662 }
16591663 }
@@ -2133,6 +2137,8 @@ void cpu_probe(void) · 473 unmodified lines
21332137 if (cpu == 0)
21342138 __ua_limit = ~((1ull << cpu_vmbits) - 1);
21352139 #endif
2140+
2141+ reserve_exception_space(0, 0x1000);
21362142 }
21372143
21382144 void cpu_report(void)
arch/mips/kernel/cpu-r3k-probe.c+3−0
@@ -21,6 +21,7 @@ · 20 unmodified lines
2121 #include <asm/fpu.h>
2222 #include <asm/mipsregs.h>
2323 #include <asm/elf.h>
24+#include <asm/traps.h>
2425
2526 #include "fpu-probe.h"
2627
@@ -158,6 +159,8 @@ void cpu_probe(void) · 131 unmodified lines
158159 cpu_set_fpu_opts(c);
159160 else
160161 cpu_set_nofpu_opts(c);
162+
163+ reserve_exception_space(0, 0x400);
161164 }
162165
163166 void cpu_report(void)
arch/mips/kernel/traps.c+5−5
@@ -2009,13 +2009,16 @@ void __noreturn nmi_exception_handler(struct pt_regs *regs) · 2008 unmodified lines
20092009 nmi_exit();
20102010 }
20112011
2012−#define VECTORSPACING 0x100 /* for EI/VI mode */
2013−
20142012 unsigned long ebase;
20152013 EXPORT_SYMBOL_GPL(ebase);
20162014 unsigned long exception_handlers[32];
20172015 unsigned long vi_handlers[64];
20182016
2017+void reserve_exception_space(phys_addr_t addr, unsigned long size)
2018+{
2019+ memblock_reserve(addr, size);
2020+}
2021+
20192022 void __init *set_except_vector(int n, void *addr)
20202023 {
20212024 unsigned long handler = (unsigned long) addr;
@@ -2367,10 +2370,7 @@ void __init trap_init(void) · 345 unmodified lines
23672370
23682371 if (!cpu_has_mips_r2_r6) {
23692372 ebase = CAC_BASE;
2370− ebase_pa = virt_to_phys((void *)ebase);
23712373 vec_size = 0x400;
2372−
2373− memblock_reserve(ebase_pa, vec_size);
23742374 } else {
23752375 if (cpu_has_veic || cpu_has_vint)
23762376 vec_size = 0x200 + VECTORSPACING*64;
arch/mips/kernel/vmlinux.lds.S+6−0
@@ -145,6 +145,7 @@ SECTIONS · 144 unmodified lines
145145 }
146146
147147 #ifdef CONFIG_MIPS_ELF_APPENDED_DTB
148+ STRUCT_ALIGN();
148149 .appended_dtb : AT(ADDR(.appended_dtb) - LOAD_OFFSET) {
149150 *(.appended_dtb)
150151 KEEP(*(.appended_dtb))
@@ -172,6 +173,11 @@ SECTIONS · 21 unmodified lines
172173 #endif
173174
174175 #ifdef CONFIG_MIPS_RAW_APPENDED_DTB
176+ .fill : {
177+ FILL(0);
178+ BYTE(0);
179+ . = ALIGN(8);
180+ }
175181 __appended_dtb = .;
176182 /* leave space for appended DTB */
177183 . += 0x100000;
arch/parisc/Kconfig+5−2
@@ -203,9 +203,12 @@ config PREFETCH · 202 unmodified lines
203203 def_bool y
204204 depends on PA8X00 || PA7200
205205
206+config PARISC_HUGE_KERNEL
207+ def_bool y if !MODULES || UBSAN || FTRACE || COMPILE_TEST
208+
206209 config MLONGCALLS
207− def_bool y if !MODULES || UBSAN || FTRACE
208− bool "Enable the -mlong-calls compiler option for big kernels" if MODULES && !UBSAN && !FTRACE
210+ def_bool y if PARISC_HUGE_KERNEL
211+ bool "Enable the -mlong-calls compiler option for big kernels" if !PARISC_HUGE_KERNEL
209212 depends on PA8X00
210213 help
211214 If you configure the kernel to include many drivers built-in instead
arch/parisc/kernel/ptrace.c+0−2
@@ -567,8 +567,6 @@ static const struct user_regset_view user_parisc_native_view = { · 566 unmodified lines
567567 };
568568
569569 #ifdef CONFIG_64BIT
570−#include <linux/compat.h>
571−
572570 static int gpr32_get(struct task_struct *target,
573571 const struct user_regset *regset,
574572 struct membuf to)
arch/powerpc/include/asm/code-patching.h+4−3
@@ -73,9 +73,10 @@ void __patch_exception(int exc, unsigned long addr); · 72 unmodified lines
7373 #endif
7474
7575 #define OP_RT_RA_MASK 0xffff0000UL
76−#define LIS_R2 0x3c020000UL
77−#define ADDIS_R2_R12 0x3c4c0000UL
78−#define ADDI_R2_R2 0x38420000UL
76+#define LIS_R2 (PPC_INST_ADDIS | __PPC_RT(R2))
77+#define ADDIS_R2_R12 (PPC_INST_ADDIS | __PPC_RT(R2) | __PPC_RA(R12))
78+#define ADDI_R2_R2 (PPC_INST_ADDI | __PPC_RT(R2) | __PPC_RA(R2))
79+
7980
8081 static inline unsigned long ppc_function_entry(void *func)
8182 {
arch/powerpc/include/asm/dcr-native.h+4−4
@@ -53,8 +53,8 @@ static inline void mtdcrx(unsigned int reg, unsigned int val) · 52 unmodified lines
5353 #define mfdcr(rn) \
5454 ({unsigned int rval; \
5555 if (__builtin_constant_p(rn) && rn < 1024) \
56− asm volatile("mfdcr %0," __stringify(rn) \
57− : "=r" (rval)); \
56+ asm volatile("mfdcr %0, %1" : "=r" (rval) \
57+ : "n" (rn)); \
5858 else if (likely(cpu_has_feature(CPU_FTR_INDEXED_DCR))) \
5959 rval = mfdcrx(rn); \
6060 else \
@@ -64,8 +64,8 @@ static inline void mtdcrx(unsigned int reg, unsigned int val) · 3 unmodified lines
6464 #define mtdcr(rn, v) \
6565 do { \
6666 if (__builtin_constant_p(rn) && rn < 1024) \
67− asm volatile("mtdcr " __stringify(rn) ",%0" \
68− : : "r" (v)); \
67+ asm volatile("mtdcr %0, %1" \
68+ : : "n" (rn), "r" (v)); \
6969 else if (likely(cpu_has_feature(CPU_FTR_INDEXED_DCR))) \
7070 mtdcrx(rn, v); \
7171 else \
arch/powerpc/include/asm/interrupt.h+2−1
@@ -410,7 +410,6 @@ DECLARE_INTERRUPT_HANDLER(altivec_assist_exception); · 409 unmodified lines
410410 DECLARE_INTERRUPT_HANDLER(CacheLockingException);
411411 DECLARE_INTERRUPT_HANDLER(SPEFloatingPointException);
412412 DECLARE_INTERRUPT_HANDLER(SPEFloatingPointRoundException);
413−DECLARE_INTERRUPT_HANDLER(unrecoverable_exception);
414413 DECLARE_INTERRUPT_HANDLER(WatchdogException);
415414 DECLARE_INTERRUPT_HANDLER(kernel_bad_stack);
416415
@@ -437,6 +436,8 @@ DECLARE_INTERRUPT_HANDLER_NMI(hmi_exception_realmode); · 20 unmodified lines
437436
438437 DECLARE_INTERRUPT_HANDLER_ASYNC(TAUException);
439438
439+void unrecoverable_exception(struct pt_regs *regs);
440+
440441 void replay_system_reset(void);
441442 void replay_soft_interrupts(void);
442443
arch/powerpc/include/asm/mmu.h+2−2
@@ -228,7 +228,7 @@ enum { · 227 unmodified lines
228228 #define MMU_FTRS_ALWAYS 0
229229 #endif
230230
231−static inline bool early_mmu_has_feature(unsigned long feature)
231+static __always_inline bool early_mmu_has_feature(unsigned long feature)
232232 {
233233 if (MMU_FTRS_ALWAYS & feature)
234234 return true;
@@ -286,7 +286,7 @@ static inline void mmu_feature_keys_init(void) · 51 unmodified lines
286286
287287 }
288288
289−static inline bool mmu_has_feature(unsigned long feature)
289+static __always_inline bool mmu_has_feature(unsigned long feature)
290290 {
291291 return early_mmu_has_feature(feature);
292292 }
arch/powerpc/include/asm/ptrace.h+2−2
@@ -195,7 +195,7 @@ static inline void regs_set_return_value(struct pt_regs *regs, unsigned long rc) · 194 unmodified lines
195195 #define TRAP_FLAGS_MASK 0x11
196196 #define TRAP(regs) ((regs)->trap & ~TRAP_FLAGS_MASK)
197197 #define FULL_REGS(regs) (((regs)->trap & 1) == 0)
198−#define SET_FULL_REGS(regs) ((regs)->trap |= 1)
198+#define SET_FULL_REGS(regs) ((regs)->trap &= ~1)
199199 #endif
200200 #define CHECK_FULL_REGS(regs) BUG_ON(!FULL_REGS(regs))
201201 #define NV_REG_POISON 0xdeadbeefdeadbeefUL
@@ -210,7 +210,7 @@ static inline void regs_set_return_value(struct pt_regs *regs, unsigned long rc) · 8 unmodified lines
210210 #define TRAP_FLAGS_MASK 0x1F
211211 #define TRAP(regs) ((regs)->trap & ~TRAP_FLAGS_MASK)
212212 #define FULL_REGS(regs) (((regs)->trap & 1) == 0)
213−#define SET_FULL_REGS(regs) ((regs)->trap |= 1)
213+#define SET_FULL_REGS(regs) ((regs)->trap &= ~1)
214214 #define IS_CRITICAL_EXC(regs) (((regs)->trap & 2) != 0)
215215 #define IS_MCHECK_EXC(regs) (((regs)->trap & 4) != 0)
216216 #define IS_DEBUG_EXC(regs) (((regs)->trap & 8) != 0)
arch/powerpc/include/asm/switch_to.h+10−0
@@ -71,6 +71,16 @@ static inline void disable_kernel_vsx(void) · 70 unmodified lines
7171 {
7272 msr_check_and_clear(MSR_FP|MSR_VEC|MSR_VSX);
7373 }
74+#else
75+static inline void enable_kernel_vsx(void)
76+{
77+ BUILD_BUG();
78+}
79+
80+static inline void disable_kernel_vsx(void)
81+{
82+ BUILD_BUG();
83+}
7484 #endif
7585
7686 #ifdef CONFIG_SPE
arch/powerpc/include/asm/vio.h+1−1
@@ -113,7 +113,7 @@ struct vio_driver { · 112 unmodified lines
113113 const char *name;
114114 const struct vio_device_id *id_table;
115115 int (*probe)(struct vio_dev *dev, const struct vio_device_id *id);
116− int (*remove)(struct vio_dev *dev);
116+ void (*remove)(struct vio_dev *dev);
117117 /* A driver must have a get_desired_dma() function to
118118 * be loaded in a CMO environment if it uses DMA.
119119 */
arch/powerpc/kernel/exceptions-64s.S+1−1
@@ -466,7 +466,7 @@ DEFINE_FIXED_SYMBOL(\name\()_common_real) · 465 unmodified lines
466466
467467 ld r10,PACAKMSR(r13) /* get MSR value for kernel */
468468 /* MSR[RI] is clear iff using SRR regs */
469− .if IHSRR == EXC_HV_OR_STD
469+ .if IHSRR_IF_HVMODE
470470 BEGIN_FTR_SECTION
471471 xori r10,r10,MSR_RI
472472 END_FTR_SECTION_IFCLR(CPU_FTR_HVMODE)
arch/powerpc/kernel/head_book3s_32.S+6−3
@@ -457,11 +457,12 @@ InstructionTLBMiss: · 456 unmodified lines
457457 cmplw 0,r1,r3
458458 #endif
459459 mfspr r2, SPRN_SDR1
460− li r1,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC
460+ li r1,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC | _PAGE_USER
461461 rlwinm r2, r2, 28, 0xfffff000
462462 #ifdef CONFIG_MODULES
463463 bgt- 112f
464464 lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */
465+ li r1,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC
465466 addi r2, r2, (swapper_pg_dir - PAGE_OFFSET)@l /* kernel page table */
466467 #endif
467468 112: rlwimi r2,r3,12,20,29 /* insert top 10 bits of address */
@@ -520,10 +521,11 @@ DataLoadTLBMiss: · 52 unmodified lines
520521 lis r1, TASK_SIZE@h /* check if kernel address */
521522 cmplw 0,r1,r3
522523 mfspr r2, SPRN_SDR1
523− li r1, _PAGE_PRESENT | _PAGE_ACCESSED
524+ li r1, _PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_USER
524525 rlwinm r2, r2, 28, 0xfffff000
525526 bgt- 112f
526527 lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */
528+ li r1, _PAGE_PRESENT | _PAGE_ACCESSED
527529 addi r2, r2, (swapper_pg_dir - PAGE_OFFSET)@l /* kernel page table */
528530 112: rlwimi r2,r3,12,20,29 /* insert top 10 bits of address */
529531 lwz r2,0(r2) /* get pmd entry */
@@ -597,10 +599,11 @@ DataStoreTLBMiss: · 67 unmodified lines
597599 lis r1, TASK_SIZE@h /* check if kernel address */
598600 cmplw 0,r1,r3
599601 mfspr r2, SPRN_SDR1
600− li r1, _PAGE_RW | _PAGE_DIRTY | _PAGE_PRESENT | _PAGE_ACCESSED
602+ li r1, _PAGE_RW | _PAGE_DIRTY | _PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_USER
601603 rlwinm r2, r2, 28, 0xfffff000
602604 bgt- 112f
603605 lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */
606+ li r1, _PAGE_RW | _PAGE_DIRTY | _PAGE_PRESENT | _PAGE_ACCESSED
604607 addi r2, r2, (swapper_pg_dir - PAGE_OFFSET)@l /* kernel page table */
605608 112: rlwimi r2,r3,12,20,29 /* insert top 10 bits of address */
606609 lwz r2,0(r2) /* get pmd entry */
arch/powerpc/kernel/interrupt.c+1−2
@@ -149,7 +149,7 @@ notrace long system_call_exception(long r3, long r4, long r5, · 148 unmodified lines
149149 * enabled when the interrupt handler returns (indicating a process-context /
150150 * synchronous interrupt) then irqs_enabled should be true.
151151 */
152−static notrace inline bool __prep_irq_for_enabled_exit(bool clear_ri)
152+static notrace __always_inline bool __prep_irq_for_enabled_exit(bool clear_ri)
153153 {
154154 /* This must be done with RI=1 because tracing may touch vmaps */
155155 trace_hardirqs_on();
@@ -436,7 +436,6 @@ again: · 280 unmodified lines
436436 return ret;
437437 }
438438
439−void unrecoverable_exception(struct pt_regs *regs);
440439 void preempt_schedule_irq(void);
441440
442441 notrace unsigned long interrupt_exit_kernel_prepare(struct pt_regs *regs, unsigned long msr)
arch/powerpc/kernel/traps.c+1−1
@@ -2170,7 +2170,7 @@ DEFINE_INTERRUPT_HANDLER(SPEFloatingPointRoundException) · 2169 unmodified lines
21702170 * in the MSR is 0. This indicates that SRR0/1 are live, and that
21712171 * we therefore lost state by taking this exception.
21722172 */
2173−DEFINE_INTERRUPT_HANDLER(unrecoverable_exception)
2173+void unrecoverable_exception(struct pt_regs *regs)
21742174 {
21752175 pr_emerg("Unrecoverable exception %lx at %lx (msr=%lx)\n",
21762176 regs->trap, regs->nip, regs->msr);
arch/powerpc/lib/sstep.c+2−2
@@ -904,7 +904,7 @@ static nokprobe_inline int do_vsx_load(struct instruction_op *op, · 903 unmodified lines
904904 if (!address_ok(regs, ea, size) || copy_mem_in(mem, ea, size, regs))
905905 return -EFAULT;
906906
907− nr_vsx_regs = size / sizeof(__vector128);
907+ nr_vsx_regs = max(1ul, size / sizeof(__vector128));
908908 emulate_vsx_load(op, buf, mem, cross_endian);
909909 preempt_disable();
910910 if (reg < 32) {
@@ -951,7 +951,7 @@ static nokprobe_inline int do_vsx_store(struct instruction_op *op, · 40 unmodified lines
951951 if (!address_ok(regs, ea, size))
952952 return -EFAULT;
953953
954− nr_vsx_regs = size / sizeof(__vector128);
954+ nr_vsx_regs = max(1ul, size / sizeof(__vector128));
955955 preempt_disable();
956956 if (reg < 32) {
957957 /* FP regs + extensions */
arch/powerpc/perf/core-book3s.c+2−2
@@ -222,7 +222,7 @@ static inline void perf_get_data_addr(struct perf_event *event, struct pt_regs * · 221 unmodified lines
222222 if (!(mmcra & MMCRA_SAMPLE_ENABLE) || sdar_valid)
223223 *addrp = mfspr(SPRN_SDAR);
224224
225− if (is_kernel_addr(mfspr(SPRN_SDAR)) && perf_allow_kernel(&event->attr) != 0)
225+ if (is_kernel_addr(mfspr(SPRN_SDAR)) && event->attr.exclude_kernel)
226226 *addrp = 0;
227227 }
228228
@@ -507,7 +507,7 @@ static void power_pmu_bhrb_read(struct perf_event *event, struct cpu_hw_events * · 278 unmodified lines
507507 * addresses, hence include a check before filtering code
508508 */
509509 if (!(ppmu->flags & PPMU_ARCH_31) &&
510− is_kernel_addr(addr) && perf_allow_kernel(&event->attr) != 0)
510+ is_kernel_addr(addr) && event->attr.exclude_kernel)
511511 continue;
512512
513513 /* Branches are read most recent first (ie. mfbhrb 0 is
arch/powerpc/platforms/pseries/msi.c+23−2
@@ -4,6 +4,7 @@ · 3 unmodified lines
44 * Copyright 2006-2007 Michael Ellerman, IBM Corp.
55 */
66
7+#include <linux/crash_dump.h>
78 #include <linux/device.h>
89 #include <linux/irq.h>
910 #include <linux/msi.h>
@@ -458,8 +459,28 @@ again: · 448 unmodified lines
458459 return hwirq;
459460 }
460461
461− virq = irq_create_mapping_affinity(NULL, hwirq,
462− entry->affinity);
462+ /*
463+ * Depending on the number of online CPUs in the original
464+ * kernel, it is likely for CPU #0 to be offline in a kdump
465+ * kernel. The associated IRQs in the affinity mappings
466+ * provided by irq_create_affinity_masks() are thus not
467+ * started by irq_startup(), as per-design for managed IRQs.
468+ * This can be a problem with multi-queue block devices driven
469+ * by blk-mq : such a non-started IRQ is very likely paired
470+ * with the single queue enforced by blk-mq during kdump (see
471+ * blk_mq_alloc_tag_set()). This causes the device to remain
472+ * silent and likely hangs the guest at some point.
473+ *
474+ * We don't really care for fine-grained affinity when doing
475+ * kdump actually : simply ignore the pre-computed affinity
476+ * masks in this case and let the default mask with all CPUs
477+ * be used when creating the IRQ mappings.
478+ */
479+ if (is_kdump_kernel())
480+ virq = irq_create_mapping(NULL, hwirq);
481+ else
482+ virq = irq_create_mapping_affinity(NULL, hwirq,
483+ entry->affinity);
463484
464485 if (!virq) {
465486 pr_debug("rtas_msi: Failed mapping hwirq %d\n", hwirq);
arch/powerpc/platforms/pseries/vio.c+3−4
@@ -1261,7 +1261,6 @@ static int vio_bus_remove(struct device *dev) · 1260 unmodified lines
12611261 struct vio_dev *viodev = to_vio_dev(dev);
12621262 struct vio_driver *viodrv = to_vio_driver(dev->driver);
12631263 struct device *devptr;
1264− int ret = 1;
12651264
12661265 /*
12671266 * Hold a reference to the device after the remove function is called
@@ -1270,13 +1269,13 @@ static int vio_bus_remove(struct device *dev) · 2 unmodified lines
12701269 devptr = get_device(dev);
12711270
12721271 if (viodrv->remove)
1273− ret = viodrv->remove(viodev);
1272+ viodrv->remove(viodev);
12741273
1275− if (!ret && firmware_has_feature(FW_FEATURE_CMO))
1274+ if (firmware_has_feature(FW_FEATURE_CMO))
12761275 vio_cmo_bus_remove(viodev);
12771276
12781277 put_device(devptr);
1279− return ret;
1278+ return 0;
12801279 }
12811280
12821281 /**
arch/s390/configs/debug_defconfig+3−13
@@ -275,9 +275,9 @@ CONFIG_IP_VS_DH=m · 274 unmodified lines
275275 CONFIG_IP_VS_SH=m
276276 CONFIG_IP_VS_SED=m
277277 CONFIG_IP_VS_NQ=m
278+CONFIG_IP_VS_TWOS=m
278279 CONFIG_IP_VS_FTP=m
279280 CONFIG_IP_VS_PE_SIP=m
280−CONFIG_NF_TABLES_IPV4=y
281281 CONFIG_NFT_FIB_IPV4=m
282282 CONFIG_NF_TABLES_ARP=y
283283 CONFIG_IP_NF_IPTABLES=m
@@ -298,7 +298,6 @@ CONFIG_IP_NF_SECURITY=m · 14 unmodified lines
298298 CONFIG_IP_NF_ARPTABLES=m
299299 CONFIG_IP_NF_ARPFILTER=m
300300 CONFIG_IP_NF_ARP_MANGLE=m
301−CONFIG_NF_TABLES_IPV6=y
302301 CONFIG_NFT_FIB_IPV6=m
303302 CONFIG_IP6_NF_IPTABLES=m
304303 CONFIG_IP6_NF_MATCH_AH=m
@@ -481,7 +480,6 @@ CONFIG_NLMON=m · 176 unmodified lines
481480 # CONFIG_NET_VENDOR_AQUANTIA is not set
482481 # CONFIG_NET_VENDOR_ARC is not set
483482 # CONFIG_NET_VENDOR_ATHEROS is not set
484−# CONFIG_NET_VENDOR_AURORA is not set
485483 # CONFIG_NET_VENDOR_BROADCOM is not set
486484 # CONFIG_NET_VENDOR_BROCADE is not set
487485 # CONFIG_NET_VENDOR_CADENCE is not set
@@ -581,7 +579,6 @@ CONFIG_VIRTIO_BALLOON=m · 93 unmodified lines
581579 CONFIG_VIRTIO_INPUT=y
582580 CONFIG_VHOST_NET=m
583581 CONFIG_VHOST_VSOCK=m
584−# CONFIG_SURFACE_PLATFORMS is not set
585582 CONFIG_S390_CCW_IOMMU=y
586583 CONFIG_S390_AP_IOMMU=y
587584 CONFIG_EXT4_FS=y
@@ -635,6 +632,7 @@ CONFIG_NTFS_RW=y · 47 unmodified lines
635632 CONFIG_PROC_KCORE=y
636633 CONFIG_TMPFS=y
637634 CONFIG_TMPFS_POSIX_ACL=y
635+CONFIG_TMPFS_INODE64=y
638636 CONFIG_HUGETLBFS=y
639637 CONFIG_CONFIGFS_FS=m
640638 CONFIG_ECRYPT_FS=m
@@ -714,12 +712,8 @@ CONFIG_CRYPTO_VMAC=m · 73 unmodified lines
714712 CONFIG_CRYPTO_CRC32=m
715713 CONFIG_CRYPTO_BLAKE2S=m
716714 CONFIG_CRYPTO_MICHAEL_MIC=m
717−CONFIG_CRYPTO_RMD128=m
718715 CONFIG_CRYPTO_RMD160=m
719−CONFIG_CRYPTO_RMD256=m
720−CONFIG_CRYPTO_RMD320=m
721716 CONFIG_CRYPTO_SHA3=m
722−CONFIG_CRYPTO_TGR192=m
723717 CONFIG_CRYPTO_WP512=m
724718 CONFIG_CRYPTO_AES_TI=m
725719 CONFIG_CRYPTO_ANUBIS=m
@@ -731,7 +725,6 @@ CONFIG_CRYPTO_CAST6=m · 5 unmodified lines
731725 CONFIG_CRYPTO_DES=m
732726 CONFIG_CRYPTO_FCRYPT=m
733727 CONFIG_CRYPTO_KHAZAD=m
734−CONFIG_CRYPTO_SALSA20=m
735728 CONFIG_CRYPTO_SEED=m
736729 CONFIG_CRYPTO_SERPENT=m
737730 CONFIG_CRYPTO_SM4=m
@@ -796,12 +789,9 @@ CONFIG_DEBUG_OBJECTS_RCU_HEAD=y · 58 unmodified lines
796789 CONFIG_DEBUG_OBJECTS_PERCPU_COUNTER=y
797790 CONFIG_SLUB_DEBUG_ON=y
798791 CONFIG_SLUB_STATS=y
799−CONFIG_DEBUG_KMEMLEAK=y
800−CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF=y
801792 CONFIG_DEBUG_STACK_USAGE=y
802793 CONFIG_DEBUG_VM=y
803794 CONFIG_DEBUG_VM_VMACACHE=y
804−CONFIG_DEBUG_VM_RB=y
805795 CONFIG_DEBUG_VM_PGFLAGS=y
806796 CONFIG_DEBUG_MEMORY_INIT=y
807797 CONFIG_MEMORY_NOTIFIER_ERROR_INJECT=m
@@ -838,6 +828,7 @@ CONFIG_BPF_KPROBE_OVERRIDE=y · 30 unmodified lines
838828 CONFIG_HIST_TRIGGERS=y
839829 CONFIG_FTRACE_STARTUP_TEST=y
840830 # CONFIG_EVENT_TRACE_STARTUP_TEST is not set
831+CONFIG_DEBUG_ENTRY=y
841832 CONFIG_NOTIFIER_ERROR_INJECTION=m
842833 CONFIG_NETDEV_NOTIFIER_ERROR_INJECT=m
843834 CONFIG_FAULT_INJECTION=y
@@ -861,4 +852,3 @@ CONFIG_PERCPU_TEST=m · 17 unmodified lines
861852 CONFIG_ATOMIC64_SELFTEST=y
862853 CONFIG_TEST_BITOPS=m
863854 CONFIG_TEST_BPF=m
864−CONFIG_DEBUG_ENTRY=y
arch/s390/configs/defconfig+2−9
@@ -266,9 +266,9 @@ CONFIG_IP_VS_DH=m · 265 unmodified lines
266266 CONFIG_IP_VS_SH=m
267267 CONFIG_IP_VS_SED=m
268268 CONFIG_IP_VS_NQ=m
269+CONFIG_IP_VS_TWOS=m
269270 CONFIG_IP_VS_FTP=m
270271 CONFIG_IP_VS_PE_SIP=m
271−CONFIG_NF_TABLES_IPV4=y
272272 CONFIG_NFT_FIB_IPV4=m
273273 CONFIG_NF_TABLES_ARP=y
274274 CONFIG_IP_NF_IPTABLES=m
@@ -289,7 +289,6 @@ CONFIG_IP_NF_SECURITY=m · 14 unmodified lines
289289 CONFIG_IP_NF_ARPTABLES=m
290290 CONFIG_IP_NF_ARPFILTER=m
291291 CONFIG_IP_NF_ARP_MANGLE=m
292−CONFIG_NF_TABLES_IPV6=y
293292 CONFIG_NFT_FIB_IPV6=m
294293 CONFIG_IP6_NF_IPTABLES=m
295294 CONFIG_IP6_NF_MATCH_AH=m
@@ -473,7 +472,6 @@ CONFIG_NLMON=m · 177 unmodified lines
473472 # CONFIG_NET_VENDOR_AQUANTIA is not set
474473 # CONFIG_NET_VENDOR_ARC is not set
475474 # CONFIG_NET_VENDOR_ATHEROS is not set
476−# CONFIG_NET_VENDOR_AURORA is not set
477475 # CONFIG_NET_VENDOR_BROADCOM is not set
478476 # CONFIG_NET_VENDOR_BROCADE is not set
479477 # CONFIG_NET_VENDOR_CADENCE is not set
@@ -573,7 +571,6 @@ CONFIG_VIRTIO_BALLOON=m · 93 unmodified lines
573571 CONFIG_VIRTIO_INPUT=y
574572 CONFIG_VHOST_NET=m
575573 CONFIG_VHOST_VSOCK=m
576−# CONFIG_SURFACE_PLATFORMS is not set
577574 CONFIG_S390_CCW_IOMMU=y
578575 CONFIG_S390_AP_IOMMU=y
579576 CONFIG_EXT4_FS=y
@@ -623,6 +620,7 @@ CONFIG_NTFS_RW=y · 43 unmodified lines
623620 CONFIG_PROC_KCORE=y
624621 CONFIG_TMPFS=y
625622 CONFIG_TMPFS_POSIX_ACL=y
623+CONFIG_TMPFS_INODE64=y
626624 CONFIG_HUGETLBFS=y
627625 CONFIG_CONFIGFS_FS=m
628626 CONFIG_ECRYPT_FS=m
@@ -703,12 +701,8 @@ CONFIG_CRYPTO_VMAC=m · 74 unmodified lines
703701 CONFIG_CRYPTO_CRC32=m
704702 CONFIG_CRYPTO_BLAKE2S=m
705703 CONFIG_CRYPTO_MICHAEL_MIC=m
706−CONFIG_CRYPTO_RMD128=m
707704 CONFIG_CRYPTO_RMD160=m
708−CONFIG_CRYPTO_RMD256=m
709−CONFIG_CRYPTO_RMD320=m
710705 CONFIG_CRYPTO_SHA3=m
711−CONFIG_CRYPTO_TGR192=m
712706 CONFIG_CRYPTO_WP512=m
713707 CONFIG_CRYPTO_AES_TI=m
714708 CONFIG_CRYPTO_ANUBIS=m
@@ -720,7 +714,6 @@ CONFIG_CRYPTO_CAST6=m · 5 unmodified lines
720714 CONFIG_CRYPTO_DES=m
721715 CONFIG_CRYPTO_FCRYPT=m
722716 CONFIG_CRYPTO_KHAZAD=m
723−CONFIG_CRYPTO_SALSA20=m
724717 CONFIG_CRYPTO_SEED=m
725718 CONFIG_CRYPTO_SERPENT=m
726719 CONFIG_CRYPTO_SM4=m
arch/s390/configs/zfcpdump_defconfig+0−3
@@ -26,7 +26,6 @@ CONFIG_CRASH_DUMP=y · 25 unmodified lines
2626 # CONFIG_SECCOMP is not set
2727 # CONFIG_GCC_PLUGINS is not set
2828 CONFIG_PARTITION_ADVANCED=y
29−CONFIG_IBM_PARTITION=y
3029 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
3130 # CONFIG_COMPACTION is not set
3231 # CONFIG_MIGRATION is not set
@@ -61,11 +60,9 @@ CONFIG_RAW_DRIVER=y · 28 unmodified lines
6160 # CONFIG_HID is not set
6261 # CONFIG_VIRTIO_MENU is not set
6362 # CONFIG_VHOST_MENU is not set
64−# CONFIG_SURFACE_PLATFORMS is not set
6563 # CONFIG_IOMMU_SUPPORT is not set
6664 # CONFIG_DNOTIFY is not set
6765 # CONFIG_INOTIFY_USER is not set
68−CONFIG_CONFIGFS_FS=y
6966 # CONFIG_MISC_FILESYSTEMS is not set
7067 # CONFIG_NETWORK_FILESYSTEMS is not set
7168 CONFIG_LSM="yama,loadpin,safesetid,integrity"
arch/s390/include/asm/idle.h+6−6
@@ -14,12 +14,12 @@ · 13 unmodified lines
1414
1515 struct s390_idle_data {
1616 seqcount_t seqcount;
17− unsigned long long idle_count;
18− unsigned long long idle_time;
19− unsigned long long clock_idle_enter;
20− unsigned long long clock_idle_exit;
21− unsigned long long timer_idle_enter;
22− unsigned long long timer_idle_exit;
17+ unsigned long idle_count;
18+ unsigned long idle_time;
19+ unsigned long clock_idle_enter;
20+ unsigned long clock_idle_exit;
21+ unsigned long timer_idle_enter;
22+ unsigned long timer_idle_exit;
2323 unsigned long mt_cycles_enter[8];
2424 };
2525
arch/s390/include/asm/timex.h+18−18
@@ -98,10 +98,10 @@ extern unsigned char ptff_function_mask[16]; · 97 unmodified lines
9898
9999 /* Query TOD offset result */
100100 struct ptff_qto {
101− unsigned long long physical_clock;
102− unsigned long long tod_offset;
103− unsigned long long logical_tod_offset;
104− unsigned long long tod_epoch_difference;
101+ unsigned long physical_clock;
102+ unsigned long tod_offset;
103+ unsigned long logical_tod_offset;
104+ unsigned long tod_epoch_difference;
105105 } __packed;
106106
107107 static inline int ptff_query(unsigned int nr)
@@ -151,9 +151,9 @@ struct ptff_qui { · 43 unmodified lines
151151 rc; \
152152 })
153153
154−static inline unsigned long long local_tick_disable(void)
154+static inline unsigned long local_tick_disable(void)
155155 {
156− unsigned long long old;
156+ unsigned long old;
157157
158158 old = S390_lowcore.clock_comparator;
159159 S390_lowcore.clock_comparator = clock_comparator_max;
@@ -161,7 +161,7 @@ static inline unsigned long long local_tick_disable(void) · 1 unmodified line
161161 return old;
162162 }
163163
164−static inline void local_tick_enable(unsigned long long comp)
164+static inline void local_tick_enable(unsigned long comp)
165165 {
166166 S390_lowcore.clock_comparator = comp;
167167 set_clock_comparator(S390_lowcore.clock_comparator);
@@ -169,9 +169,9 @@ static inline void local_tick_enable(unsigned long long comp) · 1 unmodified line
169169
170170 #define CLOCK_TICK_RATE 1193180 /* Underlying HZ */
171171
172−typedef unsigned long long cycles_t;
172+typedef unsigned long cycles_t;
173173
174−static inline unsigned long long get_tod_clock(void)
174+static inline unsigned long get_tod_clock(void)
175175 {
176176 union tod_clock clk;
177177
@@ -179,10 +179,10 @@ static inline unsigned long long get_tod_clock(void) · 1 unmodified line
179179 return clk.tod;
180180 }
181181
182−static inline unsigned long long get_tod_clock_fast(void)
182+static inline unsigned long get_tod_clock_fast(void)
183183 {
184184 #ifdef CONFIG_HAVE_MARCH_Z9_109_FEATURES
185− unsigned long long clk;
185+ unsigned long clk;
186186
187187 asm volatile("stckf %0" : "=Q" (clk) : : "cc");
188188 return clk;
@@ -208,9 +208,9 @@ extern union tod_clock tod_clock_base; · 19 unmodified lines
208208 * Therefore preemption must be disabled, otherwise the returned
209209 * value is not guaranteed to be monotonic.
210210 */
211−static inline unsigned long long get_tod_clock_monotonic(void)
211+static inline unsigned long get_tod_clock_monotonic(void)
212212 {
213− unsigned long long tod;
213+ unsigned long tod;
214214
215215 preempt_disable_notrace();
216216 tod = get_tod_clock() - tod_clock_base.tod;
@@ -237,7 +237,7 @@ static inline unsigned long long get_tod_clock_monotonic(void) · 20 unmodified lines
237237 * -> ns = (th * 125) + ((tl * 125) >> 9);
238238 *
239239 */
240−static inline unsigned long long tod_to_ns(unsigned long long todval)
240+static inline unsigned long tod_to_ns(unsigned long todval)
241241 {
242242 return ((todval >> 9) * 125) + (((todval & 0x1ff) * 125) >> 9);
243243 }
@@ -249,10 +249,10 @@ static inline unsigned long long tod_to_ns(unsigned long long todval) · 5 unmodified lines
249249 *
250250 * Returns: true if a is later than b
251251 */
252−static inline int tod_after(unsigned long long a, unsigned long long b)
252+static inline int tod_after(unsigned long a, unsigned long b)
253253 {
254254 if (MACHINE_HAS_SCC)
255− return (long long) a > (long long) b;
255+ return (long) a > (long) b;
256256 return a > b;
257257 }
258258
@@ -263,10 +263,10 @@ static inline int tod_after(unsigned long long a, unsigned long long b) · 4 unmodified lines
263263 *
264264 * Returns: true if a is later than b
265265 */
266−static inline int tod_after_eq(unsigned long long a, unsigned long long b)
266+static inline int tod_after_eq(unsigned long a, unsigned long b)
267267 {
268268 if (MACHINE_HAS_SCC)
269− return (long long) a >= (long long) b;
269+ return (long) a >= (long) b;
270270 return a >= b;
271271 }
272272
arch/s390/include/uapi/asm/hwctrset.hrenamed from arch/s390/include/uapi/asm/perf_cpum_cf_diag.h+0−0

File renamed without changes.

arch/s390/kernel/idle.c+6−6
@@ -47,7 +47,7 @@ void account_idle_time_irq(void) · 46 unmodified lines
4747 void arch_cpu_idle(void)
4848 {
4949 struct s390_idle_data *idle = this_cpu_ptr(&s390_idle);
50− unsigned long long idle_time;
50+ unsigned long idle_time;
5151 unsigned long psw_mask;
5252
5353 /* Wait for external, I/O or machine check interrupt. */
@@ -73,7 +73,7 @@ static ssize_t show_idle_count(struct device *dev, · 19 unmodified lines
7373 struct device_attribute *attr, char *buf)
7474 {
7575 struct s390_idle_data *idle = &per_cpu(s390_idle, dev->id);
76− unsigned long long idle_count;
76+ unsigned long idle_count;
7777 unsigned int seq;
7878
7979 do {
@@ -82,14 +82,14 @@ static ssize_t show_idle_count(struct device *dev, · 2 unmodified lines
8282 if (READ_ONCE(idle->clock_idle_enter))
8383 idle_count++;
8484 } while (read_seqcount_retry(&idle->seqcount, seq));
85− return sprintf(buf, "%llu\n", idle_count);
85+ return sprintf(buf, "%lu\n", idle_count);
8686 }
8787 DEVICE_ATTR(idle_count, 0444, show_idle_count, NULL);
8888
8989 static ssize_t show_idle_time(struct device *dev,
9090 struct device_attribute *attr, char *buf)
9191 {
92− unsigned long long now, idle_time, idle_enter, idle_exit, in_idle;
92+ unsigned long now, idle_time, idle_enter, idle_exit, in_idle;
9393 struct s390_idle_data *idle = &per_cpu(s390_idle, dev->id);
9494 unsigned int seq;
9595
@@ -109,14 +109,14 @@ static ssize_t show_idle_time(struct device *dev, · 13 unmodified lines
109109 }
110110 }
111111 idle_time += in_idle;
112− return sprintf(buf, "%llu\n", idle_time >> 12);
112+ return sprintf(buf, "%lu\n", idle_time >> 12);
113113 }
114114 DEVICE_ATTR(idle_time_us, 0444, show_idle_time, NULL);
115115
116116 u64 arch_cpu_idle_time(int cpu)
117117 {
118118 struct s390_idle_data *idle = &per_cpu(s390_idle, cpu);
119− unsigned long long now, idle_enter, idle_exit, in_idle;
119+ unsigned long now, idle_enter, idle_exit, in_idle;
120120 unsigned int seq;
121121
122122 do {
arch/s390/kernel/perf_cpum_cf.c+1−1
@@ -269,7 +269,7 @@ static int __hw_perf_event_init(struct perf_event *event, unsigned int type) · 268 unmodified lines
269269 case CPUMF_CTR_SET_MAX:
270270 /* The counter could not be associated to a counter set */
271271 return -EINVAL;
272− };
272+ }
273273
274274 /* Initialize for using the CPU-measurement counter facility */
275275 if (!atomic_inc_not_zero(&num_events)) {
arch/s390/kernel/perf_cpum_cf_diag.c+3−17
@@ -26,12 +26,10 @@ · 25 unmodified lines
2626 #include <asm/timex.h>
2727 #include <asm/debug.h>
2828
29−#include <asm/perf_cpum_cf_diag.h>
29+#include <asm/hwctrset.h>
3030
3131 #define CF_DIAG_CTRSET_DEF 0xfeef /* Counter set header mark */
32−#define CF_DIAG_MIN_INTERVAL 60 /* Minimum counter set read */
3332 /* interval in seconds */
34−static unsigned long cf_diag_interval = CF_DIAG_MIN_INTERVAL;
3533 static unsigned int cf_diag_cpu_speed;
3634 static debug_info_t *cf_diag_dbg;
3735
@@ -729,7 +727,6 @@ static DEFINE_MUTEX(cf_diag_ctrset_mutex); · 691 unmodified lines
729727 static struct cf_diag_ctrset {
730728 unsigned long ctrset; /* Bit mask of counter set to read */
731729 cpumask_t mask; /* CPU mask to read from */
732− time64_t lastread; /* Epoch counter set last read */
733730 } cf_diag_ctrset;
734731
735732 static void cf_diag_ctrset_clear(void)
@@ -866,27 +863,16 @@ static int cf_diag_all_read(unsigned long arg) · 130 unmodified lines
866863 {
867864 struct cf_diag_call_on_cpu_parm p;
868865 cpumask_var_t mask;
869− time64_t now;
870− int rc = 0;
866+ int rc;
871867
872868 debug_sprintf_event(cf_diag_dbg, 5, "%s\n", __func__);
873869 if (!alloc_cpumask_var(&mask, GFP_KERNEL))
874870 return -ENOMEM;
875− now = ktime_get_seconds();
876− if (cf_diag_ctrset.lastread + cf_diag_interval > now) {
877− debug_sprintf_event(cf_diag_dbg, 5, "%s now %lld "
878− " lastread %lld\n", __func__, now,
879− cf_diag_ctrset.lastread);
880− rc = -EAGAIN;
881− goto out;
882− } else {
883− cf_diag_ctrset.lastread = now;
884− }
871+
885872 p.sets = cf_diag_ctrset.ctrset;
886873 cpumask_and(mask, &cf_diag_ctrset.mask, cpu_online_mask);
887874 on_each_cpu_mask(mask, cf_diag_cpu_read, &p, 1);
888875 rc = cf_diag_all_copy(arg, mask);
889−out:
890876 free_cpumask_var(mask);
891877 debug_sprintf_event(cf_diag_dbg, 5, "%s rc %d\n", __func__, rc);
892878 return rc;
arch/s390/kernel/time.c+14−14
@@ -68,10 +68,10 @@ EXPORT_SYMBOL(s390_epoch_delta_notifier); · 67 unmodified lines
6868
6969 unsigned char ptff_function_mask[16];
7070
71−static unsigned long long lpar_offset;
72−static unsigned long long initial_leap_seconds;
73−static unsigned long long tod_steering_end;
74−static long long tod_steering_delta;
71+static unsigned long lpar_offset;
72+static unsigned long initial_leap_seconds;
73+static unsigned long tod_steering_end;
74+static long tod_steering_delta;
7575
7676 /*
7777 * Get time offsets with PTFF
@@ -96,7 +96,7 @@ void __init time_early_init(void) · 18 unmodified lines
9696
9797 /* get initial leap seconds */
9898 if (ptff_query(PTFF_QUI) && ptff(&qui, sizeof(qui), PTFF_QUI) == 0)
99− initial_leap_seconds = (unsigned long long)
99+ initial_leap_seconds = (unsigned long)
100100 ((long) qui.old_leap * 4096000000L);
101101 }
102102
@@ -222,7 +222,7 @@ void __init read_persistent_wall_and_boot_offset(struct timespec64 *wall_time, · 119 unmodified lines
222222
223223 static u64 read_tod_clock(struct clocksource *cs)
224224 {
225− unsigned long long now, adj;
225+ unsigned long now, adj;
226226
227227 preempt_disable(); /* protect from changes to steering parameters */
228228 now = get_tod_clock();
@@ -362,7 +362,7 @@ static inline int check_sync_clock(void) · 133 unmodified lines
362362 * Apply clock delta to the global data structures.
363363 * This is called once on the CPU that performed the clock sync.
364364 */
365−static void clock_sync_global(unsigned long long delta)
365+static void clock_sync_global(unsigned long delta)
366366 {
367367 unsigned long now, adj;
368368 struct ptff_qto qto;
@@ -378,7 +378,7 @@ static void clock_sync_global(unsigned long long delta) · 9 unmodified lines
378378 -(adj >> 15) : (adj >> 15);
379379 tod_steering_delta += delta;
380380 if ((abs(tod_steering_delta) >> 48) != 0)
381− panic("TOD clock sync offset %lli is too large to drift\n",
381+ panic("TOD clock sync offset %li is too large to drift\n",
382382 tod_steering_delta);
383383 tod_steering_end = now + (abs(tod_steering_delta) << 15);
384384 vdso_data->arch_data.tod_steering_end = tod_steering_end;
@@ -394,7 +394,7 @@ static void clock_sync_global(unsigned long long delta) · 9 unmodified lines
394394 * Apply clock delta to the per-CPU data structures of this CPU.
395395 * This is called for each online CPU after the call to clock_sync_global.
396396 */
397−static void clock_sync_local(unsigned long long delta)
397+static void clock_sync_local(unsigned long delta)
398398 {
399399 /* Add the delta to the clock comparator. */
400400 if (S390_lowcore.clock_comparator != clock_comparator_max) {
@@ -418,7 +418,7 @@ static void __init time_init_wq(void) · 17 unmodified lines
418418 struct clock_sync_data {
419419 atomic_t cpus;
420420 int in_sync;
421− unsigned long long clock_delta;
421+ unsigned long clock_delta;
422422 };
423423
424424 /*
@@ -538,7 +538,7 @@ static int stpinfo_valid(void) · 113 unmodified lines
538538 static int stp_sync_clock(void *data)
539539 {
540540 struct clock_sync_data *sync = data;
541− unsigned long long clock_delta, flags;
541+ u64 clock_delta, flags;
542542 static int first;
543543 int rc;
544544
@@ -720,8 +720,8 @@ static ssize_t ctn_id_show(struct device *dev, · 175 unmodified lines
720720
721721 mutex_lock(&stp_mutex);
722722 if (stpinfo_valid())
723− ret = sprintf(buf, "%016llx\n",
724− *(unsigned long long *) stp_info.ctnid);
723+ ret = sprintf(buf, "%016lx\n",
724+ *(unsigned long *) stp_info.ctnid);
725725 mutex_unlock(&stp_mutex);
726726 return ret;
727727 }
@@ -794,7 +794,7 @@ static ssize_t leap_seconds_scheduled_show(struct device *dev, · 66 unmodified lines
794794 if (!stzi.lsoib.p)
795795 return sprintf(buf, "0,0\n");
796796
797− return sprintf(buf, "%llu,%d\n",
797+ return sprintf(buf, "%lu,%d\n",
798798 tod_to_ns(stzi.lsoib.nlsout - TOD_UNIX_EPOCH) / NSEC_PER_SEC,
799799 stzi.lsoib.nlso - stzi.lsoib.also);
800800 }
arch/s390/kernel/topology.c+0−2
@@ -76,8 +76,6 @@ static void cpu_group_map(cpumask_t *dst, struct mask_info *info, unsigned int c · 75 unmodified lines
7676 }
7777 info = info->next;
7878 }
79− if (cpumask_empty(&mask))
80− cpumask_copy(&mask, cpumask_of(cpu));
8179 break;
8280 case TOPOLOGY_MODE_PACKAGE:
8381 cpumask_copy(&mask, cpu_present_mask);
arch/s390/kvm/interrupt.c+1−1
@@ -1287,7 +1287,7 @@ static u64 __calculate_sltime(struct kvm_vcpu *vcpu) · 1286 unmodified lines
12871287 /* already expired? */
12881288 if (cputm >> 63)
12891289 return 0;
1290− return min(sltime, tod_to_ns(cputm));
1290+ return min_t(u64, sltime, tod_to_ns(cputm));
12911291 }
12921292 } else if (cpu_timer_interrupts_enabled(vcpu)) {
12931293 sltime = kvm_s390_get_cpu_timer(vcpu);
arch/sparc/configs/sparc64_defconfig+1−3
@@ -93,7 +93,7 @@ CONFIG_NETDEVICES=y · 92 unmodified lines
9393 CONFIG_NET_ETHERNET=y
9494 CONFIG_MII=m
9595 CONFIG_SUNLANCE=m
96−CONFIG_HAPPYMEAL=m
96+CONFIG_HAPPYMEAL=y
9797 CONFIG_SUNGEM=m
9898 CONFIG_SUNVNET=m
9999 CONFIG_LDMVSW=m
@@ -234,9 +234,7 @@ CONFIG_CRYPTO_TWOFISH=m · 134 unmodified lines
234234 CONFIG_CRC16=m
235235 CONFIG_LIBCRC32C=m
236236 CONFIG_VCC=m
237−CONFIG_ATA=y
238237 CONFIG_PATA_CMD64X=y
239−CONFIG_HAPPYMEAL=y
240238 CONFIG_IP_PNP=y
241239 CONFIG_IP_PNP_DHCP=y
242240 CONFIG_DEVTMPFS=y
arch/sparc/include/asm/elf_64.h+0−1
@@ -8,7 +8,6 @@ · 7 unmodified lines
88
99 #include <asm/ptrace.h>
1010 #include <asm/processor.h>
11−#include <asm/extable_64.h>
1211 #include <asm/spitfire.h>
1312 #include <asm/adi.h>
1413
arch/sparc/include/asm/extable.hrenamed from arch/sparc/include/asm/extable_64.h+2−2
@@ -1,6 +1,6 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
2−#ifndef __ASM_EXTABLE64_H
3−#define __ASM_EXTABLE64_H
2+#ifndef __ASM_EXTABLE_H
3+#define __ASM_EXTABLE_H
44 /*
55 * The exception table consists of pairs of addresses: the first is the
66 * address of an instruction that is allowed to fault, and the second is
arch/sparc/include/asm/processor_32.h+1−5
@@ -50,16 +50,12 @@ struct thread_struct { · 49 unmodified lines
5050 unsigned long fsr;
5151 unsigned long fpqdepth;
5252 struct fpq fpqueue[16];
53− unsigned long flags;
5453 mm_segment_t current_ds;
5554 };
5655
57−#define SPARC_FLAG_KTHREAD 0x1 /* task is a kernel thread */
58−#define SPARC_FLAG_UNALIGNED 0x2 /* is allowed to do unaligned accesses */
59−
6056 #define INIT_THREAD { \
61− .flags = SPARC_FLAG_KTHREAD, \
6257 .current_ds = KERNEL_DS, \
58+ .kregs = (struct pt_regs *)(init_stack+THREAD_SIZE)-1 \
6359 }
6460
6561 /* Do necessary setup to start up a newly executed thread. */
arch/sparc/include/asm/thread_info_64.h+1−0
@@ -118,6 +118,7 @@ struct thread_info { · 117 unmodified lines
118118 .task = &tsk, \
119119 .current_ds = ASI_P, \
120120 .preempt_count = INIT_PREEMPT_COUNT, \
121+ .kregs = (struct pt_regs *)(init_stack+THREAD_SIZE)-1 \
121122 }
122123
123124 /* how to get the thread information struct from C */
arch/sparc/include/asm/uaccess.h+3−0
@@ -1,6 +1,9 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
22 #ifndef ___ASM_SPARC_UACCESS_H
33 #define ___ASM_SPARC_UACCESS_H
4+
5+#include <asm/extable.h>
6+
47 #if defined(__sparc__) && defined(__arch64__)
58 #include <asm/uaccess_64.h>
69 #else
arch/sparc/include/asm/uaccess_32.h+0−38
@@ -13,9 +13,6 @@ · 12 unmodified lines
1313
1414 #include <asm/processor.h>
1515
16−#define ARCH_HAS_SORT_EXTABLE
17−#define ARCH_HAS_SEARCH_EXTABLE
18−
1916 /* Sparc is not segmented, however we need to be able to fool access_ok()
2017 * when doing system calls from kernel mode legitimately.
2118 *
@@ -40,36 +37,6 @@ · 18 unmodified lines
4037 #define __access_ok(addr, size) (__user_ok((addr) & get_fs().seg, (size)))
4138 #define access_ok(addr, size) __access_ok((unsigned long)(addr), size)
4239
43−/*
44− * The exception table consists of pairs of addresses: the first is the
45− * address of an instruction that is allowed to fault, and the second is
46− * the address at which the program should continue. No registers are
47− * modified, so it is entirely up to the continuation code to figure out
48− * what to do.
49− *
50− * All the routines below use bits of fixup code that are out of line
51− * with the main instruction path. This means when everything is well,
52− * we don't even have to jump over them. Further, they do not intrude
53− * on our cache or tlb entries.
54− *
55− * There is a special way how to put a range of potentially faulting
56− * insns (like twenty ldd/std's with now intervening other instructions)
57− * You specify address of first in insn and 0 in fixup and in the next
58− * exception_table_entry you specify last potentially faulting insn + 1
59− * and in fixup the routine which should handle the fault.
60− * That fixup code will get
61− * (faulting_insn_address - first_insn_in_the_range_address)/4
62− * in %g2 (ie. index of the faulting instruction in the range).
63− */
64−
65−struct exception_table_entry
66−{
67− unsigned long insn, fixup;
68−};
69−
70−/* Returns 0 if exception not found and fixup otherwise. */
71−unsigned long search_extables_range(unsigned long addr, unsigned long *g2);
72−
7340 /* Uh, these should become the main single-value transfer routines..
7441 * They automatically use the right size if we just have the right
7542 * pointer type..
@@ -252,12 +219,7 @@ static inline unsigned long __clear_user(void __user *addr, unsigned long size) · 176 unmodified lines
252219 unsigned long ret;
253220
254221 __asm__ __volatile__ (
255− ".section __ex_table,#alloc\n\t"
256− ".align 4\n\t"
257− ".word 1f,3\n\t"
258− ".previous\n\t"
259222 "mov %2, %%o1\n"
260− "1:\n\t"
261223 "call __bzero\n\t"
262224 " mov %1, %%o0\n\t"
263225 "mov %%o0, %0\n"
arch/sparc/include/asm/uaccess_64.h+0−1
@@ -10,7 +10,6 @@ · 9 unmodified lines
1010 #include <linux/string.h>
1111 #include <asm/asi.h>
1212 #include <asm/spitfire.h>
13−#include <asm/extable_64.h>
1413
1514 #include <asm/processor.h>
1615
arch/sparc/kernel/head_32.S+1−1
@@ -515,7 +515,7 @@ continue_boot: · 514 unmodified lines
515515
516516 /* I want a kernel stack NOW! */
517517 set init_thread_union, %g1
518− set (THREAD_SIZE - STACKFRAME_SZ), %g2
518+ set (THREAD_SIZE - STACKFRAME_SZ - TRACEREG_SZ), %g2
519519 add %g1, %g2, %sp
520520 mov 0, %fp /* And for good luck */
521521
arch/sparc/kernel/head_64.S+1−1
@@ -706,7 +706,7 @@ tlb_fixup_done: · 705 unmodified lines
706706 wr %g0, ASI_P, %asi
707707 mov 1, %g1
708708 sllx %g1, THREAD_SHIFT, %g1
709− sub %g1, (STACKFRAME_SZ + STACK_BIAS), %g1
709+ sub %g1, (STACKFRAME_SZ + STACK_BIAS + TRACEREG_SZ), %g1
710710 add %g6, %g1, %sp
711711
712712 /* Set per-cpu pointer initially to zero, this makes
arch/sparc/kernel/process_32.c+0−12
@@ -216,16 +216,6 @@ void flush_thread(void) · 215 unmodified lines
216216 clear_thread_flag(TIF_USEDFPU);
217217 #endif
218218 }
219−
220− /* This task is no longer a kernel thread. */
221− if (current->thread.flags & SPARC_FLAG_KTHREAD) {
222− current->thread.flags &= ~SPARC_FLAG_KTHREAD;
223−
224− /* We must fixup kregs as well. */
225− /* XXX This was not fixed for ti for a while, worked. Unused? */
226− current->thread.kregs = (struct pt_regs *)
227− (task_stack_page(current) + (THREAD_SIZE - TRACEREG_SZ));
228− }
229219 }
230220
231221 static inline struct sparc_stackf __user *
@@ -313,7 +303,6 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, unsigned long arg, · 81 unmodified lines
313303 extern int nwindows;
314304 unsigned long psr;
315305 memset(new_stack, 0, STACKFRAME_SZ + TRACEREG_SZ);
316− p->thread.flags |= SPARC_FLAG_KTHREAD;
317306 p->thread.current_ds = KERNEL_DS;
318307 ti->kpc = (((unsigned long) ret_from_kernel_thread) - 0x8);
319308 childregs->u_regs[UREG_G1] = sp; /* function */
@@ -325,7 +314,6 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, unsigned long arg, · 5 unmodified lines
325314 }
326315 memcpy(new_stack, (char *)regs - STACKFRAME_SZ, STACKFRAME_SZ + TRACEREG_SZ);
327316 childregs->u_regs[UREG_FP] = sp;
328− p->thread.flags &= ~SPARC_FLAG_KTHREAD;
329317 p->thread.current_ds = USER_DS;
330318 ti->kpc = (((unsigned long) ret_from_fork) - 0x8);
331319 ti->kpsr = current->thread.fork_kpsr | PSR_PIL;
arch/sparc/kernel/setup_32.c+0−3
@@ -266,7 +266,6 @@ static __init void leon_patch(void) · 265 unmodified lines
266266 }
267267
268268 struct tt_entry *sparc_ttable;
269−static struct pt_regs fake_swapper_regs;
270269
271270 /* Called from head_32.S - before we have setup anything
272271 * in the kernel. Be very careful with what you do here.
@@ -363,8 +362,6 @@ void __init setup_arch(char **cmdline_p) · 90 unmodified lines
363362 (*(linux_dbvec->teach_debugger))();
364363 }
365364
366− init_task.thread.kregs = &fake_swapper_regs;
367−
368365 /* Run-time patch instructions to match the cpu model */
369366 per_cpu_patch();
370367
arch/sparc/kernel/setup_64.c+0−4
@@ -165,8 +165,6 @@ extern int root_mountflags; · 164 unmodified lines
165165
166166 char reboot_command[COMMAND_LINE_SIZE];
167167
168−static struct pt_regs fake_swapper_regs = { { 0, }, 0, 0, 0, 0 };
169−
170168 static void __init per_cpu_patch(void)
171169 {
172170 struct cpuid_patch_entry *p;
@@ -661,8 +659,6 @@ void __init setup_arch(char **cmdline_p) · 488 unmodified lines
661659 rd_image_start = ram_flags & RAMDISK_IMAGE_START_MASK;
662660 #endif
663661
664− task_thread_info(&init_task)->kregs = &fake_swapper_regs;
665−
666662 #ifdef CONFIG_IP_PNP
667663 if (!ic_set_manually) {
668664 phandle chosen = prom_finddevice("/chosen");
arch/sparc/kernel/traps_64.c+6−7
@@ -275,14 +275,13 @@ bool is_no_fault_exception(struct pt_regs *regs) · 274 unmodified lines
275275 asi = (regs->tstate >> 24); /* saved %asi */
276276 else
277277 asi = (insn >> 5); /* immediate asi */
278− if ((asi & 0xf2) == ASI_PNF) {
279− if (insn & 0x1000000) { /* op3[5:4]=3 */
280− handle_ldf_stq(insn, regs);
281− return true;
282− } else if (insn & 0x200000) { /* op3[2], stores */
278+ if ((asi & 0xf6) == ASI_PNF) {
279+ if (insn & 0x200000) /* op3[2], stores */
283280 return false;
284− }
285− handle_ld_nf(insn, regs);
281+ if (insn & 0x1000000) /* op3[5:4]=3 (fp) */
282+ handle_ldf_stq(insn, regs);
283+ else
284+ handle_ld_nf(insn, regs);
286285 return true;
287286 }
288287 }
arch/sparc/kernel/unaligned_32.c+6−100
@@ -16,6 +16,7 @@ · 15 unmodified lines
1616 #include <linux/uaccess.h>
1717 #include <linux/smp.h>
1818 #include <linux/perf_event.h>
19+#include <linux/extable.h>
1920
2021 #include <asm/setup.h>
2122
@@ -213,10 +214,10 @@ static inline int ok_for_kernel(unsigned int insn) · 191 unmodified lines
213214
214215 static void kernel_mna_trap_fault(struct pt_regs *regs, unsigned int insn)
215216 {
216− unsigned long g2 = regs->u_regs [UREG_G2];
217− unsigned long fixup = search_extables_range(regs->pc, &g2);
217+ const struct exception_table_entry *entry;
218218
219− if (!fixup) {
219+ entry = search_exception_tables(regs->pc);
220+ if (!entry) {
220221 unsigned long address = compute_effective_address(regs, insn);
221222 if(address < PAGE_SIZE) {
222223 printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference in mna handler");
@@ -232,9 +233,8 @@ static void kernel_mna_trap_fault(struct pt_regs *regs, unsigned int insn) · 9 unmodified lines
232233 die_if_kernel("Oops", regs);
233234 /* Not reached */
234235 }
235− regs->pc = fixup;
236+ regs->pc = entry->fixup;
236237 regs->npc = regs->pc + 4;
237− regs->u_regs [UREG_G2] = g2;
238238 }
239239
240240 asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn)
@@ -274,103 +274,9 @@ asmlinkage void kernel_unaligned_trap(struct pt_regs *regs, unsigned int insn) · 33 unmodified lines
274274 }
275275 }
276276
277−static inline int ok_for_user(struct pt_regs *regs, unsigned int insn,
278− enum direction dir)
279−{
280− unsigned int reg;
281− int size = ((insn >> 19) & 3) == 3 ? 8 : 4;
282−
283− if ((regs->pc | regs->npc) & 3)
284− return 0;
285−
286− /* Must access_ok() in all the necessary places. */
287−#define WINREG_ADDR(regnum) \
288− ((void __user *)(((unsigned long *)regs->u_regs[UREG_FP])+(regnum)))
289−
290− reg = (insn >> 25) & 0x1f;
291− if (reg >= 16) {
292− if (!access_ok(WINREG_ADDR(reg - 16), size))
293− return -EFAULT;
294− }
295− reg = (insn >> 14) & 0x1f;
296− if (reg >= 16) {
297− if (!access_ok(WINREG_ADDR(reg - 16), size))
298− return -EFAULT;
299− }
300− if (!(insn & 0x2000)) {
301− reg = (insn & 0x1f);
302− if (reg >= 16) {
303− if (!access_ok(WINREG_ADDR(reg - 16), size))
304− return -EFAULT;
305− }
306− }
307−#undef WINREG_ADDR
308− return 0;
309−}
310−
311−static void user_mna_trap_fault(struct pt_regs *regs, unsigned int insn)
277+asmlinkage void user_unaligned_trap(struct pt_regs *regs, unsigned int insn)
312278 {
313279 send_sig_fault(SIGBUS, BUS_ADRALN,
314280 (void __user *)safe_compute_effective_address(regs, insn),
315281 0, current);
316282 }
317−
318−asmlinkage void user_unaligned_trap(struct pt_regs *regs, unsigned int insn)
319−{
320− enum direction dir;
321−
322− if(!(current->thread.flags & SPARC_FLAG_UNALIGNED) ||
323− (((insn >> 30) & 3) != 3))
324− goto kill_user;
325− dir = decode_direction(insn);
326− if(!ok_for_user(regs, insn, dir)) {
327− goto kill_user;
328− } else {
329− int err, size = decode_access_size(insn);
330− unsigned long addr;
331−
332− if(floating_point_load_or_store_p(insn)) {
333− printk("User FPU load/store unaligned unsupported.\n");
334− goto kill_user;
335− }
336−
337− addr = compute_effective_address(regs, insn);
338− perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS, 1, regs, addr);
339− switch(dir) {
340− case load:
341− err = do_int_load(fetch_reg_addr(((insn>>25)&0x1f),
342− regs),
343− size, (unsigned long *) addr,
344− decode_signedness(insn));
345− break;
346−
347− case store:
348− err = do_int_store(((insn>>25)&0x1f), size,
349− (unsigned long *) addr, regs);
350− break;
351−
352− case both:
353− /*
354− * This was supported in 2.4. However, we question
355− * the value of SWAP instruction across word boundaries.
356− */
357− printk("Unaligned SWAP unsupported.\n");
358− err = -EFAULT;
359− break;
360−
361− default:
362− unaligned_panic("Impossible user unaligned trap.");
363− goto out;
364− }
365− if (err)
366− goto kill_user;
367− else
368− advance(regs);
369− goto out;
370− }
371−
372−kill_user:
373− user_mna_trap_fault(regs, insn);
374−out:
375− ;
376−}
arch/sparc/lib/checksum_32.S+27−37
@@ -155,13 +155,6 @@ cpout: retl ! get outta here · 154 unmodified lines
155155 .text; \
156156 .align 4
157157
158−#define EXT(start,end) \
159− .section __ex_table,ALLOC; \
160− .align 4; \
161− .word start, 0, end, cc_fault; \
162− .text; \
163− .align 4
164−
165158 /* This aligned version executes typically in 8.5 superscalar cycles, this
166159 * is the best I can do. I say 8.5 because the final add will pair with
167160 * the next ldd in the main unrolled loop. Thus the pipe is always full.
@@ -169,20 +162,20 @@ cpout: retl ! get outta here · 1 unmodified line
169162 * please check the fixup code below as well.
170163 */
171164 #define CSUMCOPY_BIGCHUNK_ALIGNED(src, dst, sum, off, t0, t1, t2, t3, t4, t5, t6, t7) \
172− ldd [src + off + 0x00], t0; \
173− ldd [src + off + 0x08], t2; \
165+ EX(ldd [src + off + 0x00], t0); \
166+ EX(ldd [src + off + 0x08], t2); \
174167 addxcc t0, sum, sum; \
175− ldd [src + off + 0x10], t4; \
168+ EX(ldd [src + off + 0x10], t4); \
176169 addxcc t1, sum, sum; \
177− ldd [src + off + 0x18], t6; \
170+ EX(ldd [src + off + 0x18], t6); \
178171 addxcc t2, sum, sum; \
179− std t0, [dst + off + 0x00]; \
172+ EX(std t0, [dst + off + 0x00]); \
180173 addxcc t3, sum, sum; \
181− std t2, [dst + off + 0x08]; \
174+ EX(std t2, [dst + off + 0x08]); \
182175 addxcc t4, sum, sum; \
183− std t4, [dst + off + 0x10]; \
176+ EX(std t4, [dst + off + 0x10]); \
184177 addxcc t5, sum, sum; \
185− std t6, [dst + off + 0x18]; \
178+ EX(std t6, [dst + off + 0x18]); \
186179 addxcc t6, sum, sum; \
187180 addxcc t7, sum, sum;
188181
@@ -191,39 +184,39 @@ cpout: retl ! get outta here · 2 unmodified lines
191184 * Viking MXCC into streaming mode. Ho hum...
192185 */
193186 #define CSUMCOPY_BIGCHUNK(src, dst, sum, off, t0, t1, t2, t3, t4, t5, t6, t7) \
194− ldd [src + off + 0x00], t0; \
195− ldd [src + off + 0x08], t2; \
196− ldd [src + off + 0x10], t4; \
197− ldd [src + off + 0x18], t6; \
198− st t0, [dst + off + 0x00]; \
187+ EX(ldd [src + off + 0x00], t0); \
188+ EX(ldd [src + off + 0x08], t2); \
189+ EX(ldd [src + off + 0x10], t4); \
190+ EX(ldd [src + off + 0x18], t6); \
191+ EX(st t0, [dst + off + 0x00]); \
199192 addxcc t0, sum, sum; \
200− st t1, [dst + off + 0x04]; \
193+ EX(st t1, [dst + off + 0x04]); \
201194 addxcc t1, sum, sum; \
202− st t2, [dst + off + 0x08]; \
195+ EX(st t2, [dst + off + 0x08]); \
203196 addxcc t2, sum, sum; \
204− st t3, [dst + off + 0x0c]; \
197+ EX(st t3, [dst + off + 0x0c]); \
205198 addxcc t3, sum, sum; \
206− st t4, [dst + off + 0x10]; \
199+ EX(st t4, [dst + off + 0x10]); \
207200 addxcc t4, sum, sum; \
208− st t5, [dst + off + 0x14]; \
201+ EX(st t5, [dst + off + 0x14]); \
209202 addxcc t5, sum, sum; \
210− st t6, [dst + off + 0x18]; \
203+ EX(st t6, [dst + off + 0x18]); \
211204 addxcc t6, sum, sum; \
212− st t7, [dst + off + 0x1c]; \
205+ EX(st t7, [dst + off + 0x1c]); \
213206 addxcc t7, sum, sum;
214207
215208 /* Yuck, 6 superscalar cycles... */
216209 #define CSUMCOPY_LASTCHUNK(src, dst, sum, off, t0, t1, t2, t3) \
217− ldd [src - off - 0x08], t0; \
218− ldd [src - off - 0x00], t2; \
210+ EX(ldd [src - off - 0x08], t0); \
211+ EX(ldd [src - off - 0x00], t2); \
219212 addxcc t0, sum, sum; \
220− st t0, [dst - off - 0x08]; \
213+ EX(st t0, [dst - off - 0x08]); \
221214 addxcc t1, sum, sum; \
222− st t1, [dst - off - 0x04]; \
215+ EX(st t1, [dst - off - 0x04]); \
223216 addxcc t2, sum, sum; \
224− st t2, [dst - off - 0x00]; \
217+ EX(st t2, [dst - off - 0x00]); \
225218 addxcc t3, sum, sum; \
226− st t3, [dst - off + 0x04];
219+ EX(st t3, [dst - off + 0x04]);
227220
228221 /* Handle the end cruft code out of band for better cache patterns. */
229222 cc_end_cruft:
@@ -331,7 +324,6 @@ __csum_partial_copy_sparc_generic: · 101 unmodified lines
331324 CSUMCOPY_BIGCHUNK(%o0,%o1,%g7,0x20,%o4,%o5,%g2,%g3,%g4,%g5,%o2,%o3)
332325 CSUMCOPY_BIGCHUNK(%o0,%o1,%g7,0x40,%o4,%o5,%g2,%g3,%g4,%g5,%o2,%o3)
333326 CSUMCOPY_BIGCHUNK(%o0,%o1,%g7,0x60,%o4,%o5,%g2,%g3,%g4,%g5,%o2,%o3)
334−10: EXT(5b, 10b) ! note for exception handling
335327 sub %g1, 128, %g1 ! detract from length
336328 addx %g0, %g7, %g7 ! add in last carry bit
337329 andcc %g1, 0xffffff80, %g0 ! more to csum?
@@ -356,8 +348,7 @@ cctbl: CSUMCOPY_LASTCHUNK(%o0,%o1,%g7,0x68,%g2,%g3,%g4,%g5) · 18 unmodified lines
356348 CSUMCOPY_LASTCHUNK(%o0,%o1,%g7,0x28,%g2,%g3,%g4,%g5)
357349 CSUMCOPY_LASTCHUNK(%o0,%o1,%g7,0x18,%g2,%g3,%g4,%g5)
358350 CSUMCOPY_LASTCHUNK(%o0,%o1,%g7,0x08,%g2,%g3,%g4,%g5)
359−12: EXT(cctbl, 12b) ! note for exception table handling
360− addx %g0, %g7, %g7
351+12: addx %g0, %g7, %g7
361352 andcc %o3, 0xf, %g0 ! check for low bits set
362353 ccte: bne cc_end_cruft ! something left, handle it out of band
363354 andcc %o3, 8, %g0 ! begin checks for that code
@@ -367,7 +358,6 @@ ccdbl: CSUMCOPY_BIGCHUNK_ALIGNED(%o0,%o1,%g7,0x00,%o4,%o5,%g2,%g3,%g4,%g5,%o2,%o · 3 unmodified lines
367358 CSUMCOPY_BIGCHUNK_ALIGNED(%o0,%o1,%g7,0x20,%o4,%o5,%g2,%g3,%g4,%g5,%o2,%o3)
368359 CSUMCOPY_BIGCHUNK_ALIGNED(%o0,%o1,%g7,0x40,%o4,%o5,%g2,%g3,%g4,%g5,%o2,%o3)
369360 CSUMCOPY_BIGCHUNK_ALIGNED(%o0,%o1,%g7,0x60,%o4,%o5,%g2,%g3,%g4,%g5,%o2,%o3)
370−11: EXT(ccdbl, 11b) ! note for exception table handling
371361 sub %g1, 128, %g1 ! detract from length
372362 addx %g0, %g7, %g7 ! add in last carry bit
373363 andcc %g1, 0xffffff80, %g0 ! more to csum?
arch/sparc/lib/copy_user.S+112−203
@@ -21,98 +21,134 @@ · 20 unmodified lines
2121 /* Work around cpp -rob */
2222 #define ALLOC #alloc
2323 #define EXECINSTR #execinstr
24+
25+#define EX_ENTRY(l1, l2) \
26+ .section __ex_table,ALLOC; \
27+ .align 4; \
28+ .word l1, l2; \
29+ .text;
30+
2431 #define EX(x,y,a,b) \
2532 98: x,y; \
2633 .section .fixup,ALLOC,EXECINSTR; \
2734 .align 4; \
28−99: ba fixupretl; \
29− a, b, %g3; \
30− .section __ex_table,ALLOC; \
31− .align 4; \
32− .word 98b, 99b; \
33− .text; \
34− .align 4
35+99: retl; \
36+ a, b, %o0; \
37+ EX_ENTRY(98b, 99b)
3538
3639 #define EX2(x,y,c,d,e,a,b) \
3740 98: x,y; \
3841 .section .fixup,ALLOC,EXECINSTR; \
3942 .align 4; \
4043 99: c, d, e; \
41− ba fixupretl; \
42− a, b, %g3; \
43− .section __ex_table,ALLOC; \
44− .align 4; \
45− .word 98b, 99b; \
46− .text; \
47− .align 4
44+ retl; \
45+ a, b, %o0; \
46+ EX_ENTRY(98b, 99b)
4847
4948 #define EXO2(x,y) \
5049 98: x, y; \
51− .section __ex_table,ALLOC; \
52− .align 4; \
53− .word 98b, 97f; \
54− .text; \
55− .align 4
50+ EX_ENTRY(98b, 97f)
5651
57−#define EXT(start,end,handler) \
58− .section __ex_table,ALLOC; \
59− .align 4; \
60− .word start, 0, end, handler; \
61− .text; \
62− .align 4
52+#define LD(insn, src, offset, reg, label) \
53+98: insn [%src + (offset)], %reg; \
54+ .section .fixup,ALLOC,EXECINSTR; \
55+99: ba label; \
56+ mov offset, %g5; \
57+ EX_ENTRY(98b, 99b)
6358
64−/* Please do not change following macros unless you change logic used
65− * in .fixup at the end of this file as well
66− */
59+#define ST(insn, dst, offset, reg, label) \
60+98: insn %reg, [%dst + (offset)]; \
61+ .section .fixup,ALLOC,EXECINSTR; \
62+99: ba label; \
63+ mov offset, %g5; \
64+ EX_ENTRY(98b, 99b)
6765
6866 /* Both these macros have to start with exactly the same insn */
67+/* left: g7 + (g1 % 128) - offset */
6968 #define MOVE_BIGCHUNK(src, dst, offset, t0, t1, t2, t3, t4, t5, t6, t7) \
70− ldd [%src + (offset) + 0x00], %t0; \
71− ldd [%src + (offset) + 0x08], %t2; \
72− ldd [%src + (offset) + 0x10], %t4; \
73− ldd [%src + (offset) + 0x18], %t6; \
74− st %t0, [%dst + (offset) + 0x00]; \
75− st %t1, [%dst + (offset) + 0x04]; \
76− st %t2, [%dst + (offset) + 0x08]; \
77− st %t3, [%dst + (offset) + 0x0c]; \
78− st %t4, [%dst + (offset) + 0x10]; \
79− st %t5, [%dst + (offset) + 0x14]; \
80− st %t6, [%dst + (offset) + 0x18]; \
81− st %t7, [%dst + (offset) + 0x1c];
82−
69+ LD(ldd, src, offset + 0x00, t0, bigchunk_fault) \
70+ LD(ldd, src, offset + 0x08, t2, bigchunk_fault) \
71+ LD(ldd, src, offset + 0x10, t4, bigchunk_fault) \
72+ LD(ldd, src, offset + 0x18, t6, bigchunk_fault) \
73+ ST(st, dst, offset + 0x00, t0, bigchunk_fault) \
74+ ST(st, dst, offset + 0x04, t1, bigchunk_fault) \
75+ ST(st, dst, offset + 0x08, t2, bigchunk_fault) \
76+ ST(st, dst, offset + 0x0c, t3, bigchunk_fault) \
77+ ST(st, dst, offset + 0x10, t4, bigchunk_fault) \
78+ ST(st, dst, offset + 0x14, t5, bigchunk_fault) \
79+ ST(st, dst, offset + 0x18, t6, bigchunk_fault) \
80+ ST(st, dst, offset + 0x1c, t7, bigchunk_fault)
81+
82+/* left: g7 + (g1 % 128) - offset */
8383 #define MOVE_BIGALIGNCHUNK(src, dst, offset, t0, t1, t2, t3, t4, t5, t6, t7) \
84− ldd [%src + (offset) + 0x00], %t0; \
85− ldd [%src + (offset) + 0x08], %t2; \
86− ldd [%src + (offset) + 0x10], %t4; \
87− ldd [%src + (offset) + 0x18], %t6; \
88− std %t0, [%dst + (offset) + 0x00]; \
89− std %t2, [%dst + (offset) + 0x08]; \
90− std %t4, [%dst + (offset) + 0x10]; \
91− std %t6, [%dst + (offset) + 0x18];
84+ LD(ldd, src, offset + 0x00, t0, bigchunk_fault) \
85+ LD(ldd, src, offset + 0x08, t2, bigchunk_fault) \
86+ LD(ldd, src, offset + 0x10, t4, bigchunk_fault) \
87+ LD(ldd, src, offset + 0x18, t6, bigchunk_fault) \
88+ ST(std, dst, offset + 0x00, t0, bigchunk_fault) \
89+ ST(std, dst, offset + 0x08, t2, bigchunk_fault) \
90+ ST(std, dst, offset + 0x10, t4, bigchunk_fault) \
91+ ST(std, dst, offset + 0x18, t6, bigchunk_fault)
9292
93+ .section .fixup,#alloc,#execinstr
94+bigchunk_fault:
95+ sub %g7, %g5, %o0
96+ and %g1, 127, %g1
97+ retl
98+ add %o0, %g1, %o0
99+
100+/* left: offset + 16 + (g1 % 16) */
93101 #define MOVE_LASTCHUNK(src, dst, offset, t0, t1, t2, t3) \
94− ldd [%src - (offset) - 0x10], %t0; \
95− ldd [%src - (offset) - 0x08], %t2; \
96− st %t0, [%dst - (offset) - 0x10]; \
97− st %t1, [%dst - (offset) - 0x0c]; \
98− st %t2, [%dst - (offset) - 0x08]; \
99− st %t3, [%dst - (offset) - 0x04];
102+ LD(ldd, src, -(offset + 0x10), t0, lastchunk_fault) \
103+ LD(ldd, src, -(offset + 0x08), t2, lastchunk_fault) \
104+ ST(st, dst, -(offset + 0x10), t0, lastchunk_fault) \
105+ ST(st, dst, -(offset + 0x0c), t1, lastchunk_fault) \
106+ ST(st, dst, -(offset + 0x08), t2, lastchunk_fault) \
107+ ST(st, dst, -(offset + 0x04), t3, lastchunk_fault)
100108
101−#define MOVE_HALFCHUNK(src, dst, offset, t0, t1, t2, t3) \
102− lduh [%src + (offset) + 0x00], %t0; \
103− lduh [%src + (offset) + 0x02], %t1; \
104− lduh [%src + (offset) + 0x04], %t2; \
105− lduh [%src + (offset) + 0x06], %t3; \
106− sth %t0, [%dst + (offset) + 0x00]; \
107− sth %t1, [%dst + (offset) + 0x02]; \
108− sth %t2, [%dst + (offset) + 0x04]; \
109− sth %t3, [%dst + (offset) + 0x06];
109+ .section .fixup,#alloc,#execinstr
110+lastchunk_fault:
111+ and %g1, 15, %g1
112+ retl
113+ sub %g1, %g5, %o0
110114
115+/* left: o3 + (o2 % 16) - offset */
116+#define MOVE_HALFCHUNK(src, dst, offset, t0, t1, t2, t3) \
117+ LD(lduh, src, offset + 0x00, t0, halfchunk_fault) \
118+ LD(lduh, src, offset + 0x02, t1, halfchunk_fault) \
119+ LD(lduh, src, offset + 0x04, t2, halfchunk_fault) \
120+ LD(lduh, src, offset + 0x06, t3, halfchunk_fault) \
121+ ST(sth, dst, offset + 0x00, t0, halfchunk_fault) \
122+ ST(sth, dst, offset + 0x02, t1, halfchunk_fault) \
123+ ST(sth, dst, offset + 0x04, t2, halfchunk_fault) \
124+ ST(sth, dst, offset + 0x06, t3, halfchunk_fault)
125+
126+/* left: o3 + (o2 % 16) + offset + 2 */
111127 #define MOVE_SHORTCHUNK(src, dst, offset, t0, t1) \
112− ldub [%src - (offset) - 0x02], %t0; \
113− ldub [%src - (offset) - 0x01], %t1; \
114− stb %t0, [%dst - (offset) - 0x02]; \
115− stb %t1, [%dst - (offset) - 0x01];
128+ LD(ldub, src, -(offset + 0x02), t0, halfchunk_fault) \
129+ LD(ldub, src, -(offset + 0x01), t1, halfchunk_fault) \
130+ ST(stb, dst, -(offset + 0x02), t0, halfchunk_fault) \
131+ ST(stb, dst, -(offset + 0x01), t1, halfchunk_fault)
132+
133+ .section .fixup,#alloc,#execinstr
134+halfchunk_fault:
135+ and %o2, 15, %o2
136+ sub %o3, %g5, %o3
137+ retl
138+ add %o2, %o3, %o0
139+
140+/* left: offset + 2 + (o2 % 2) */
141+#define MOVE_LAST_SHORTCHUNK(src, dst, offset, t0, t1) \
142+ LD(ldub, src, -(offset + 0x02), t0, last_shortchunk_fault) \
143+ LD(ldub, src, -(offset + 0x01), t1, last_shortchunk_fault) \
144+ ST(stb, dst, -(offset + 0x02), t0, last_shortchunk_fault) \
145+ ST(stb, dst, -(offset + 0x01), t1, last_shortchunk_fault)
146+
147+ .section .fixup,#alloc,#execinstr
148+last_shortchunk_fault:
149+ and %o2, 1, %o2
150+ retl
151+ sub %o2, %g5, %o0
116152
117153 .text
118154 .align 4
@@ -182,8 +218,6 @@ __copy_user: /* %o0=dst %o1=src %o2=len */ · 63 unmodified lines
182218 MOVE_BIGCHUNK(o1, o0, 0x20, o2, o3, o4, o5, g2, g3, g4, g5)
183219 MOVE_BIGCHUNK(o1, o0, 0x40, o2, o3, o4, o5, g2, g3, g4, g5)
184220 MOVE_BIGCHUNK(o1, o0, 0x60, o2, o3, o4, o5, g2, g3, g4, g5)
185−80:
186− EXT(5b, 80b, 50f)
187221 subcc %g7, 128, %g7
188222 add %o1, 128, %o1
189223 bne 5b
@@ -201,7 +235,6 @@ __copy_user: /* %o0=dst %o1=src %o2=len */ · 11 unmodified lines
201235 jmpl %o5 + %lo(copy_user_table_end), %g0
202236 add %o0, %g7, %o0
203237
204−copy_user_table:
205238 MOVE_LASTCHUNK(o1, o0, 0x60, g2, g3, g4, g5)
206239 MOVE_LASTCHUNK(o1, o0, 0x50, g2, g3, g4, g5)
207240 MOVE_LASTCHUNK(o1, o0, 0x40, g2, g3, g4, g5)
@@ -210,7 +243,6 @@ copy_user_table: · 2 unmodified lines
210243 MOVE_LASTCHUNK(o1, o0, 0x10, g2, g3, g4, g5)
211244 MOVE_LASTCHUNK(o1, o0, 0x00, g2, g3, g4, g5)
212245 copy_user_table_end:
213− EXT(copy_user_table, copy_user_table_end, 51f)
214246 be copy_user_last7
215247 andcc %g1, 4, %g0
216248
@@ -250,8 +282,6 @@ ldd_std: · 33 unmodified lines
250282 MOVE_BIGALIGNCHUNK(o1, o0, 0x20, o2, o3, o4, o5, g2, g3, g4, g5)
251283 MOVE_BIGALIGNCHUNK(o1, o0, 0x40, o2, o3, o4, o5, g2, g3, g4, g5)
252284 MOVE_BIGALIGNCHUNK(o1, o0, 0x60, o2, o3, o4, o5, g2, g3, g4, g5)
253−81:
254− EXT(ldd_std, 81b, 52f)
255285 subcc %g7, 128, %g7
256286 add %o1, 128, %o1
257287 bne ldd_std
@@ -290,8 +320,6 @@ cannot_optimize: · 32 unmodified lines
290320 10:
291321 MOVE_HALFCHUNK(o1, o0, 0x00, g2, g3, g4, g5)
292322 MOVE_HALFCHUNK(o1, o0, 0x08, g2, g3, g4, g5)
293−82:
294− EXT(10b, 82b, 53f)
295323 subcc %o3, 0x10, %o3
296324 add %o1, 0x10, %o1
297325 bne 10b
@@ -308,8 +336,6 @@ byte_chunk: · 10 unmodified lines
308336 MOVE_SHORTCHUNK(o1, o0, -0x0c, g2, g3)
309337 MOVE_SHORTCHUNK(o1, o0, -0x0e, g2, g3)
310338 MOVE_SHORTCHUNK(o1, o0, -0x10, g2, g3)
311−83:
312− EXT(byte_chunk, 83b, 54f)
313339 subcc %o3, 0x10, %o3
314340 add %o1, 0x10, %o1
315341 bne byte_chunk
@@ -325,16 +351,14 @@ short_end: · 9 unmodified lines
325351 add %o1, %o3, %o1
326352 jmpl %o5 + %lo(short_table_end), %g0
327353 andcc %o2, 1, %g0
328−84:
329− MOVE_SHORTCHUNK(o1, o0, 0x0c, g2, g3)
330− MOVE_SHORTCHUNK(o1, o0, 0x0a, g2, g3)
331− MOVE_SHORTCHUNK(o1, o0, 0x08, g2, g3)
332− MOVE_SHORTCHUNK(o1, o0, 0x06, g2, g3)
333− MOVE_SHORTCHUNK(o1, o0, 0x04, g2, g3)
334− MOVE_SHORTCHUNK(o1, o0, 0x02, g2, g3)
335− MOVE_SHORTCHUNK(o1, o0, 0x00, g2, g3)
354+ MOVE_LAST_SHORTCHUNK(o1, o0, 0x0c, g2, g3)
355+ MOVE_LAST_SHORTCHUNK(o1, o0, 0x0a, g2, g3)
356+ MOVE_LAST_SHORTCHUNK(o1, o0, 0x08, g2, g3)
357+ MOVE_LAST_SHORTCHUNK(o1, o0, 0x06, g2, g3)
358+ MOVE_LAST_SHORTCHUNK(o1, o0, 0x04, g2, g3)
359+ MOVE_LAST_SHORTCHUNK(o1, o0, 0x02, g2, g3)
360+ MOVE_LAST_SHORTCHUNK(o1, o0, 0x00, g2, g3)
336361 short_table_end:
337− EXT(84b, short_table_end, 55f)
338362 be 1f
339363 nop
340364 EX(ldub [%o1], %g2, add %g0, 1)
@@ -363,123 +387,8 @@ short_aligned_end: · 22 unmodified lines
363387 .section .fixup,#alloc,#execinstr
364388 .align 4
365389 97:
366− mov %o2, %g3
367−fixupretl:
368390 retl
369− mov %g3, %o0
370−
371−/* exception routine sets %g2 to (broken_insn - first_insn)>>2 */
372−50:
373−/* This magic counts how many bytes are left when crash in MOVE_BIGCHUNK
374− * happens. This is derived from the amount ldd reads, st stores, etc.
375− * x = g2 % 12;
376− * g3 = g1 + g7 - ((g2 / 12) * 32 + (x < 4) ? 0 : (x - 4) * 4);
377− * o0 += (g2 / 12) * 32;
378− */
379− cmp %g2, 12
380− add %o0, %g7, %o0
381− bcs 1f
382− cmp %g2, 24
383− bcs 2f
384− cmp %g2, 36
385− bcs 3f
386− nop
387− sub %g2, 12, %g2
388− sub %g7, 32, %g7
389−3: sub %g2, 12, %g2
390− sub %g7, 32, %g7
391−2: sub %g2, 12, %g2
392− sub %g7, 32, %g7
393−1: cmp %g2, 4
394− bcs,a 60f
395− clr %g2
396− sub %g2, 4, %g2
397− sll %g2, 2, %g2
398−60: and %g1, 0x7f, %g3
399− sub %o0, %g7, %o0
400− add %g3, %g7, %g3
401− ba fixupretl
402− sub %g3, %g2, %g3
403−51:
404−/* i = 41 - g2; j = i % 6;
405− * g3 = (g1 & 15) + (i / 6) * 16 + (j < 4) ? (j + 1) * 4 : 16;
406− * o0 -= (i / 6) * 16 + 16;
407− */
408− neg %g2
409− and %g1, 0xf, %g1
410− add %g2, 41, %g2
411− add %o0, %g1, %o0
412−1: cmp %g2, 6
413− bcs,a 2f
414− cmp %g2, 4
415− add %g1, 16, %g1
416− b 1b
417− sub %g2, 6, %g2
418−2: bcc,a 2f
419− mov 16, %g2
420− inc %g2
421− sll %g2, 2, %g2
422−2: add %g1, %g2, %g3
423− ba fixupretl
424− sub %o0, %g3, %o0
425−52:
426−/* g3 = g1 + g7 - (g2 / 8) * 32 + (g2 & 4) ? (g2 & 3) * 8 : 0;
427− o0 += (g2 / 8) * 32 */
428− andn %g2, 7, %g4
429− add %o0, %g7, %o0
430− andcc %g2, 4, %g0
431− and %g2, 3, %g2
432− sll %g4, 2, %g4
433− sll %g2, 3, %g2
434− bne 60b
435− sub %g7, %g4, %g7
436− ba 60b
437− clr %g2
438−53:
439−/* g3 = o3 + (o2 & 15) - (g2 & 8) - (g2 & 4) ? (g2 & 3) * 2 : 0;
440− o0 += (g2 & 8) */
441− and %g2, 3, %g4
442− andcc %g2, 4, %g0
443− and %g2, 8, %g2
444− sll %g4, 1, %g4
445− be 1f
446− add %o0, %g2, %o0
447− add %g2, %g4, %g2
448−1: and %o2, 0xf, %g3
449− add %g3, %o3, %g3
450− ba fixupretl
451− sub %g3, %g2, %g3
452−54:
453−/* g3 = o3 + (o2 & 15) - (g2 / 4) * 2 - (g2 & 2) ? (g2 & 1) : 0;
454− o0 += (g2 / 4) * 2 */
455− srl %g2, 2, %o4
456− and %g2, 1, %o5
457− srl %g2, 1, %g2
458− add %o4, %o4, %o4
459− and %o5, %g2, %o5
460− and %o2, 0xf, %o2
461− add %o0, %o4, %o0
462− sub %o3, %o5, %o3
463− sub %o2, %o4, %o2
464− ba fixupretl
465− add %o2, %o3, %g3
466−55:
467−/* i = 27 - g2;
468− g3 = (o2 & 1) + i / 4 * 2 + !(i & 3);
469− o0 -= i / 4 * 2 + 1 */
470− neg %g2
471− and %o2, 1, %o2
472− add %g2, 27, %g2
473− srl %g2, 2, %o5
474− andcc %g2, 3, %g0
475− mov 1, %g2
476− add %o5, %o5, %o5
477− be,a 1f
478− clr %g2
479−1: add %g2, %o5, %g3
480− sub %o0, %g3, %o0
481− ba fixupretl
482− add %g3, %o2, %g3
391+ mov %o2, %o0
483392
484393 .globl __copy_user_end
485394 __copy_user_end:
arch/sparc/lib/memset.S+33−54
@@ -19,7 +19,7 @@ · 18 unmodified lines
1919 98: x,y; \
2020 .section .fixup,ALLOC,EXECINSTR; \
2121 .align 4; \
22−99: ba 30f; \
22+99: retl; \
2323 a, b, %o0; \
2424 .section __ex_table,ALLOC; \
2525 .align 4; \
@@ -27,35 +27,44 @@ · 1 unmodified line
2727 .text; \
2828 .align 4
2929
30−#define EXT(start,end,handler) \
30+#define STORE(source, base, offset, n) \
31+98: std source, [base + offset + n]; \
32+ .section .fixup,ALLOC,EXECINSTR; \
33+ .align 4; \
34+99: ba 30f; \
35+ sub %o3, n - offset, %o3; \
3136 .section __ex_table,ALLOC; \
3237 .align 4; \
33− .word start, 0, end, handler; \
38+ .word 98b, 99b; \
3439 .text; \
35− .align 4
40+ .align 4;
41+
42+#define STORE_LAST(source, base, offset, n) \
43+ EX(std source, [base - offset - n], \
44+ add %o1, offset + n);
3645
3746 /* Please don't change these macros, unless you change the logic
3847 * in the .fixup section below as well.
3948 * Store 64 bytes at (BASE + OFFSET) using value SOURCE. */
40−#define ZERO_BIG_BLOCK(base, offset, source) \
41− std source, [base + offset + 0x00]; \
42− std source, [base + offset + 0x08]; \
43− std source, [base + offset + 0x10]; \
44− std source, [base + offset + 0x18]; \
45− std source, [base + offset + 0x20]; \
46− std source, [base + offset + 0x28]; \
47− std source, [base + offset + 0x30]; \
48− std source, [base + offset + 0x38];
49+#define ZERO_BIG_BLOCK(base, offset, source) \
50+ STORE(source, base, offset, 0x00); \
51+ STORE(source, base, offset, 0x08); \
52+ STORE(source, base, offset, 0x10); \
53+ STORE(source, base, offset, 0x18); \
54+ STORE(source, base, offset, 0x20); \
55+ STORE(source, base, offset, 0x28); \
56+ STORE(source, base, offset, 0x30); \
57+ STORE(source, base, offset, 0x38);
4958
5059 #define ZERO_LAST_BLOCKS(base, offset, source) \
51− std source, [base - offset - 0x38]; \
52− std source, [base - offset - 0x30]; \
53− std source, [base - offset - 0x28]; \
54− std source, [base - offset - 0x20]; \
55− std source, [base - offset - 0x18]; \
56− std source, [base - offset - 0x10]; \
57− std source, [base - offset - 0x08]; \
58− std source, [base - offset - 0x00];
60+ STORE_LAST(source, base, offset, 0x38); \
61+ STORE_LAST(source, base, offset, 0x30); \
62+ STORE_LAST(source, base, offset, 0x28); \
63+ STORE_LAST(source, base, offset, 0x20); \
64+ STORE_LAST(source, base, offset, 0x18); \
65+ STORE_LAST(source, base, offset, 0x10); \
66+ STORE_LAST(source, base, offset, 0x08); \
67+ STORE_LAST(source, base, offset, 0x00);
5968
6069 .text
6170 .align 4
@@ -68,8 +77,6 @@ __bzero_begin: · 6 unmodified lines
6877 .globl memset
6978 EXPORT_SYMBOL(__bzero)
7079 EXPORT_SYMBOL(memset)
71− .globl __memset_start, __memset_end
72−__memset_start:
7380 memset:
7481 mov %o0, %g1
7582 mov 1, %g4
@@ -122,8 +129,6 @@ __bzero: · 46 unmodified lines
122129 ZERO_BIG_BLOCK(%o0, 0x00, %g2)
123130 subcc %o3, 128, %o3
124131 ZERO_BIG_BLOCK(%o0, 0x40, %g2)
125−11:
126− EXT(10b, 11b, 20f)
127132 bne 10b
128133 add %o0, 128, %o0
129134
@@ -138,11 +143,9 @@ __bzero: · 8 unmodified lines
138143 jmp %o4
139144 add %o0, %o2, %o0
140145
141−12:
142146 ZERO_LAST_BLOCKS(%o0, 0x48, %g2)
143147 ZERO_LAST_BLOCKS(%o0, 0x08, %g2)
144148 13:
145− EXT(12b, 13b, 21f)
146149 be 8f
147150 andcc %o1, 4, %g0
148151
@@ -182,37 +185,13 @@ __bzero: · 33 unmodified lines
182185 5:
183186 retl
184187 clr %o0
185−__memset_end:
186188
187189 .section .fixup,#alloc,#execinstr
188190 .align 4
189−20:
190− cmp %g2, 8
191− bleu 1f
192− and %o1, 0x7f, %o1
193− sub %g2, 9, %g2
194− add %o3, 64, %o3
195−1:
196− sll %g2, 3, %g2
197− add %o3, %o1, %o0
198− b 30f
199− sub %o0, %g2, %o0
200−21:
201− mov 8, %o0
202− and %o1, 7, %o1
203− sub %o0, %g2, %o0
204− sll %o0, 3, %o0
205− b 30f
206− add %o0, %o1, %o0
207191 30:
208−/* %o4 is faulting address, %o5 is %pc where fault occurred */
209− save %sp, -104, %sp
210− mov %i5, %o0
211− mov %i7, %o1
212− call lookup_fault
213− mov %i4, %o2
214− ret
215− restore
192+ and %o1, 0x7f, %o1
193+ retl
194+ add %o3, %o1, %o0
216195
217196 .globl __bzero_end
218197 __bzero_end:
arch/sparc/mm/Makefile+1−1
@@ -8,7 +8,7 @@ ccflags-y := -Werror · 7 unmodified lines
88 obj-$(CONFIG_SPARC64) += ultra.o tlb.o tsb.o
99 obj-y += fault_$(BITS).o
1010 obj-y += init_$(BITS).o
11−obj-$(CONFIG_SPARC32) += extable.o srmmu.o iommu.o io-unit.o
11+obj-$(CONFIG_SPARC32) += srmmu.o iommu.o io-unit.o
1212 obj-$(CONFIG_SPARC32) += srmmu_access.o
1313 obj-$(CONFIG_SPARC32) += hypersparc.o viking.o tsunami.o swift.o
1414 obj-$(CONFIG_SPARC32) += leon_mm.o
arch/sparc/mm/extable.c+0−107
@@ -1,107 +0,0 @@
1−// SPDX-License-Identifier: GPL-2.0
2−/*
3− * linux/arch/sparc/mm/extable.c
4− */
5−
6−#include <linux/module.h>
7−#include <linux/extable.h>
8−#include <linux/uaccess.h>
9−
10−void sort_extable(struct exception_table_entry *start,
11− struct exception_table_entry *finish)
12−{
13−}
14−
15−/* Caller knows they are in a range if ret->fixup == 0 */
16−const struct exception_table_entry *
17−search_extable(const struct exception_table_entry *base,
18− const size_t num,
19− unsigned long value)
20−{
21− int i;
22−
23− /* Single insn entries are encoded as:
24− * word 1: insn address
25− * word 2: fixup code address
26− *
27− * Range entries are encoded as:
28− * word 1: first insn address
29− * word 2: 0
30− * word 3: last insn address + 4 bytes
31− * word 4: fixup code address
32− *
33− * Deleted entries are encoded as:
34− * word 1: unused
35− * word 2: -1
36− *
37− * See asm/uaccess.h for more details.
38− */
39−
40− /* 1. Try to find an exact match. */
41− for (i = 0; i < num; i++) {
42− if (base[i].fixup == 0) {
43− /* A range entry, skip both parts. */
44− i++;
45− continue;
46− }
47−
48− /* A deleted entry; see trim_init_extable */
49− if (base[i].fixup == -1)
50− continue;
51−
52− if (base[i].insn == value)
53− return &base[i];
54− }
55−
56− /* 2. Try to find a range match. */
57− for (i = 0; i < (num - 1); i++) {
58− if (base[i].fixup)
59− continue;
60−
61− if (base[i].insn <= value && base[i + 1].insn > value)
62− return &base[i];
63−
64− i++;
65− }
66−
67− return NULL;
68−}
69−
70−#ifdef CONFIG_MODULES
71−/* We could memmove them around; easier to mark the trimmed ones. */
72−void trim_init_extable(struct module *m)
73−{
74− unsigned int i;
75− bool range;
76−
77− for (i = 0; i < m->num_exentries; i += range ? 2 : 1) {
78− range = m->extable[i].fixup == 0;
79−
80− if (within_module_init(m->extable[i].insn, m)) {
81− m->extable[i].fixup = -1;
82− if (range)
83− m->extable[i+1].fixup = -1;
84− }
85− if (range)
86− i++;
87− }
88−}
89−#endif /* CONFIG_MODULES */
90−
91−/* Special extable search, which handles ranges. Returns fixup */
92−unsigned long search_extables_range(unsigned long addr, unsigned long *g2)
93−{
94− const struct exception_table_entry *entry;
95−
96− entry = search_exception_tables(addr);
97− if (!entry)
98− return 0;
99−
100− /* Inside range? Fix g2 and return correct fixup */
101− if (!entry->fixup) {
102− *g2 = (addr - entry->insn) / 4;
103− return (entry + 1)->fixup;
104− }
105−
106− return entry->fixup;
107−}
arch/sparc/mm/fault_32.c+10−70
@@ -23,6 +23,7 @@ · 22 unmodified lines
2323 #include <linux/interrupt.h>
2424 #include <linux/kdebug.h>
2525 #include <linux/uaccess.h>
26+#include <linux/extable.h>
2627
2728 #include <asm/page.h>
2829 #include <asm/openprom.h>
@@ -54,54 +55,6 @@ static void __noreturn unhandled_fault(unsigned long address, · 25 unmodified lines
5455 die_if_kernel("Oops", regs);
5556 }
5657
57−asmlinkage int lookup_fault(unsigned long pc, unsigned long ret_pc,
58− unsigned long address)
59−{
60− struct pt_regs regs;
61− unsigned long g2;
62− unsigned int insn;
63− int i;
64−
65− i = search_extables_range(ret_pc, &g2);
66− switch (i) {
67− case 3:
68− /* load & store will be handled by fixup */
69− return 3;
70−
71− case 1:
72− /* store will be handled by fixup, load will bump out */
73− /* for _to_ macros */
74− insn = *((unsigned int *) pc);
75− if ((insn >> 21) & 1)
76− return 1;
77− break;
78−
79− case 2:
80− /* load will be handled by fixup, store will bump out */
81− /* for _from_ macros */
82− insn = *((unsigned int *) pc);
83− if (!((insn >> 21) & 1) || ((insn>>19)&0x3f) == 15)
84− return 2;
85− break;
86−
87− default:
88− break;
89− }
90−
91− memset(&regs, 0, sizeof(regs));
92− regs.pc = pc;
93− regs.npc = pc + 4;
94− __asm__ __volatile__(
95− "rd %%psr, %0\n\t"
96− "nop\n\t"
97− "nop\n\t"
98− "nop\n" : "=r" (regs.psr));
99− unhandled_fault(address, current, &regs);
100−
101− /* Not reached */
102− return 0;
103−}
104−
10558 static inline void
10659 show_signal_msg(struct pt_regs *regs, int sig, int code,
10760 unsigned long address, struct task_struct *tsk)
@@ -162,8 +115,6 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write, · 54 unmodified lines
162115 struct vm_area_struct *vma;
163116 struct task_struct *tsk = current;
164117 struct mm_struct *mm = tsk->mm;
165− unsigned int fixup;
166− unsigned long g2;
167118 int from_user = !(regs->psr & PSR_PS);
168119 int code;
169120 vm_fault_t fault;
@@ -281,30 +232,19 @@ bad_area_nosemaphore: · 111 unmodified lines
281232
282233 /* Is this in ex_table? */
283234 no_context:
284− g2 = regs->u_regs[UREG_G2];
285235 if (!from_user) {
286− fixup = search_extables_range(regs->pc, &g2);
287− /* Values below 10 are reserved for other things */
288− if (fixup > 10) {
289− extern const unsigned int __memset_start[];
290− extern const unsigned int __memset_end[];
236+ const struct exception_table_entry *entry;
291237
238+ entry = search_exception_tables(regs->pc);
292239 #ifdef DEBUG_EXCEPTIONS
293− printk("Exception: PC<%08lx> faddr<%08lx>\n",
294− regs->pc, address);
295− printk("EX_TABLE: insn<%08lx> fixup<%08x> g2<%08lx>\n",
296− regs->pc, fixup, g2);
240+ printk("Exception: PC<%08lx> faddr<%08lx>\n",
241+ regs->pc, address);
242+ printk("EX_TABLE: insn<%08lx> fixup<%08x>\n",
243+ regs->pc, entry->fixup);
297244 #endif
298− if ((regs->pc >= (unsigned long)__memset_start &&
299− regs->pc < (unsigned long)__memset_end)) {
300− regs->u_regs[UREG_I4] = address;
301− regs->u_regs[UREG_I5] = regs->pc;
302− }
303− regs->u_regs[UREG_G2] = g2;
304− regs->pc = fixup;
305− regs->npc = regs->pc + 4;
306− return;
307− }
245+ regs->pc = entry->fixup;
246+ regs->npc = regs->pc + 4;
247+ return;
308248 }
309249
310250 unhandled_fault(address, tsk, regs);
arch/sparc/mm/mm_32.h+0−2
@@ -1,7 +1,5 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
22 /* fault_32.c - visible as they are called from assembler */
3−asmlinkage int lookup_fault(unsigned long pc, unsigned long ret_pc,
4− unsigned long address);
53 asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write,
64 unsigned long address);
75
arch/x86/entry/common.c+2−1
@@ -128,7 +128,8 @@ static noinstr bool __do_fast_syscall_32(struct pt_regs *regs) · 127 unmodified lines
128128 regs->ax = -EFAULT;
129129
130130 instrumentation_end();
131− syscall_exit_to_user_mode(regs);
131+ local_irq_disable();
132+ irqentry_exit_to_user_mode(regs);
132133 return false;
133134 }
134135
arch/x86/entry/entry_64_compat.S+2−0
@@ -210,6 +210,8 @@ SYM_CODE_START(entry_SYSCALL_compat) · 209 unmodified lines
210210 /* Switch to the kernel stack */
211211 movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp
212212
213+SYM_INNER_LABEL(entry_SYSCALL_compat_safe_stack, SYM_L_GLOBAL)
214+
213215 /* Construct struct pt_regs on stack */
214216 pushq $__USER32_DS /* pt_regs->ss */
215217 pushq %r8 /* pt_regs->sp */
arch/x86/events/core.c+6−9
@@ -81,7 +81,11 @@ DEFINE_STATIC_CALL_NULL(x86_pmu_swap_task_ctx, *x86_pmu.swap_task_ctx); · 80 unmodified lines
8181 DEFINE_STATIC_CALL_NULL(x86_pmu_drain_pebs, *x86_pmu.drain_pebs);
8282 DEFINE_STATIC_CALL_NULL(x86_pmu_pebs_aliases, *x86_pmu.pebs_aliases);
8383
84−DEFINE_STATIC_CALL_NULL(x86_pmu_guest_get_msrs, *x86_pmu.guest_get_msrs);
84+/*
85+ * This one is magic, it will get called even when PMU init fails (because
86+ * there is no PMU), in which case it should simply return NULL.
87+ */
88+DEFINE_STATIC_CALL_RET0(x86_pmu_guest_get_msrs, *x86_pmu.guest_get_msrs);
8589
8690 u64 __read_mostly hw_cache_event_ids
8791 [PERF_COUNT_HW_CACHE_MAX]
@@ -1944,13 +1948,6 @@ static void _x86_pmu_read(struct perf_event *event) · 1856 unmodified lines
19441948 x86_perf_event_update(event);
19451949 }
19461950
1947−static inline struct perf_guest_switch_msr *
1948−perf_guest_get_msrs_nop(int *nr)
1949−{
1950− *nr = 0;
1951− return NULL;
1952−}
1953−
19541951 static int __init init_hw_perf_events(void)
19551952 {
19561953 struct x86_pmu_quirk *quirk;
@@ -2025,7 +2022,7 @@ static int __init init_hw_perf_events(void) · 68 unmodified lines
20252022 x86_pmu.read = _x86_pmu_read;
20262023
20272024 if (!x86_pmu.guest_get_msrs)
2028− x86_pmu.guest_get_msrs = perf_guest_get_msrs_nop;
2025+ x86_pmu.guest_get_msrs = (void *)&__static_call_return0;
20292026
20302027 x86_pmu_static_call_update();
20312028
arch/x86/events/intel/core.c+4−1
@@ -3662,8 +3662,10 @@ static int intel_pmu_hw_config(struct perf_event *event) · 3661 unmodified lines
36623662 if (!(event->attr.freq || (event->attr.wakeup_events && !event->attr.watermark))) {
36633663 event->hw.flags |= PERF_X86_EVENT_AUTO_RELOAD;
36643664 if (!(event->attr.sample_type &
3665− ~intel_pmu_large_pebs_flags(event)))
3665+ ~intel_pmu_large_pebs_flags(event))) {
36663666 event->hw.flags |= PERF_X86_EVENT_LARGE_PEBS;
3667+ event->attach_state |= PERF_ATTACH_SCHED_CB;
3668+ }
36673669 }
36683670 if (x86_pmu.pebs_aliases)
36693671 x86_pmu.pebs_aliases(event);
@@ -3676,6 +3678,7 @@ static int intel_pmu_hw_config(struct perf_event *event) · 6 unmodified lines
36763678 ret = intel_pmu_setup_lbr_filter(event);
36773679 if (ret)
36783680 return ret;
3681+ event->attach_state |= PERF_ATTACH_SCHED_CB;
36793682
36803683 /*
36813684 * BTS is set up earlier in this path, so don't account twice
arch/x86/include/asm/insn-eval.h+2−0
@@ -23,6 +23,8 @@ unsigned long insn_get_seg_base(struct pt_regs *regs, int seg_reg_idx); · 22 unmodified lines
2323 int insn_get_code_seg_params(struct pt_regs *regs);
2424 int insn_fetch_from_user(struct pt_regs *regs,
2525 unsigned char buf[MAX_INSN_SIZE]);
26+int insn_fetch_from_user_inatomic(struct pt_regs *regs,
27+ unsigned char buf[MAX_INSN_SIZE]);
2628 bool insn_decode(struct insn *insn, struct pt_regs *regs,
2729 unsigned char buf[MAX_INSN_SIZE], int buf_size);
2830
arch/x86/include/asm/kvm_host.h+2−2
@@ -963,7 +963,7 @@ struct kvm_arch { · 962 unmodified lines
963963 struct kvm_pit *vpit;
964964 atomic_t vapics_in_nmi_mode;
965965 struct mutex apic_map_lock;
966− struct kvm_apic_map *apic_map;
966+ struct kvm_apic_map __rcu *apic_map;
967967 atomic_t apic_map_dirty;
968968
969969 bool apic_access_page_done;
@@ -1036,7 +1036,7 @@ struct kvm_arch { · 66 unmodified lines
10361036
10371037 bool bus_lock_detection_enabled;
10381038
1039− struct kvm_pmu_event_filter *pmu_event_filter;
1039+ struct kvm_pmu_event_filter __rcu *pmu_event_filter;
10401040 struct task_struct *nx_lpage_recovery_thread;
10411041
10421042 #ifdef CONFIG_X86_64
arch/x86/include/asm/proto.h+1−0
@@ -25,6 +25,7 @@ void __end_SYSENTER_singlestep_region(void); · 24 unmodified lines
2525 void entry_SYSENTER_compat(void);
2626 void __end_entry_SYSENTER_compat(void);
2727 void entry_SYSCALL_compat(void);
28+void entry_SYSCALL_compat_safe_stack(void);
2829 void entry_INT80_compat(void);
2930 #ifdef CONFIG_XEN_PV
3031 void xen_entry_INT80_compat(void);
arch/x86/include/asm/ptrace.h+15−0
@@ -94,6 +94,8 @@ struct pt_regs { · 93 unmodified lines
9494 #include <asm/paravirt_types.h>
9595 #endif
9696
97+#include <asm/proto.h>
98+
9799 struct cpuinfo_x86;
98100 struct task_struct;
99101
@@ -175,6 +177,19 @@ static inline bool any_64bit_mode(struct pt_regs *regs) · 75 unmodified lines
175177 #ifdef CONFIG_X86_64
176178 #define current_user_stack_pointer() current_pt_regs()->sp
177179 #define compat_user_stack_pointer() current_pt_regs()->sp
180+
181+static inline bool ip_within_syscall_gap(struct pt_regs *regs)
182+{
183+ bool ret = (regs->ip >= (unsigned long)entry_SYSCALL_64 &&
184+ regs->ip < (unsigned long)entry_SYSCALL_64_safe_stack);
185+
186+#ifdef CONFIG_IA32_EMULATION
187+ ret = ret || (regs->ip >= (unsigned long)entry_SYSCALL_compat &&
188+ regs->ip < (unsigned long)entry_SYSCALL_compat_safe_stack);
189+#endif
190+
191+ return ret;
192+}
178193 #endif
179194
180195 static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
arch/x86/include/asm/smap.h+4−6
@@ -58,9 +58,8 @@ static __always_inline unsigned long smap_save(void) · 57 unmodified lines
5858 unsigned long flags;
5959
6060 asm volatile ("# smap_save\n\t"
61− ALTERNATIVE("jmp 1f", "", X86_FEATURE_SMAP)
62− "pushf; pop %0; " __ASM_CLAC "\n\t"
63− "1:"
61+ ALTERNATIVE("", "pushf; pop %0; " __ASM_CLAC "\n\t",
62+ X86_FEATURE_SMAP)
6463 : "=rm" (flags) : : "memory", "cc");
6564
6665 return flags;
@@ -69,9 +68,8 @@ static __always_inline unsigned long smap_save(void) · 2 unmodified lines
6968 static __always_inline void smap_restore(unsigned long flags)
7069 {
7170 asm volatile ("# smap_restore\n\t"
72− ALTERNATIVE("jmp 1f", "", X86_FEATURE_SMAP)
73− "push %0; popf\n\t"
74− "1:"
71+ ALTERNATIVE("", "push %0; popf\n\t",
72+ X86_FEATURE_SMAP)
7573 : : "g" (flags) : "memory", "cc");
7674 }
7775
arch/x86/kernel/kvmclock.c+9−10
@@ -268,21 +268,20 @@ static void __init kvmclock_init_mem(void) · 267 unmodified lines
268268
269269 static int __init kvm_setup_vsyscall_timeinfo(void)
270270 {
271−#ifdef CONFIG_X86_64
272− u8 flags;
271+ kvmclock_init_mem();
273272
274− if (!per_cpu(hv_clock_per_cpu, 0) || !kvmclock_vsyscall)
275− return 0;
273+#ifdef CONFIG_X86_64
274+ if (per_cpu(hv_clock_per_cpu, 0) && kvmclock_vsyscall) {
275+ u8 flags;
276276
277− flags = pvclock_read_flags(&hv_clock_boot[0].pvti);
278− if (!(flags & PVCLOCK_TSC_STABLE_BIT))
279− return 0;
277+ flags = pvclock_read_flags(&hv_clock_boot[0].pvti);
278+ if (!(flags & PVCLOCK_TSC_STABLE_BIT))
279+ return 0;
280280
281− kvm_clock.vdso_clock_mode = VDSO_CLOCKMODE_PVCLOCK;
281+ kvm_clock.vdso_clock_mode = VDSO_CLOCKMODE_PVCLOCK;
282+ }
282283 #endif
283284
284− kvmclock_init_mem();
285−
286285 return 0;
287286 }
288287 early_initcall(kvm_setup_vsyscall_timeinfo);
arch/x86/kernel/sev-es.c+17−5
@@ -121,8 +121,18 @@ static void __init setup_vc_stacks(int cpu) · 120 unmodified lines
121121 cea_set_pte((void *)vaddr, pa, PAGE_KERNEL);
122122 }
123123
124−static __always_inline bool on_vc_stack(unsigned long sp)
124+static __always_inline bool on_vc_stack(struct pt_regs *regs)
125125 {
126+ unsigned long sp = regs->sp;
127+
128+ /* User-mode RSP is not trusted */
129+ if (user_mode(regs))
130+ return false;
131+
132+ /* SYSCALL gap still has user-mode RSP */
133+ if (ip_within_syscall_gap(regs))
134+ return false;
135+
126136 return ((sp >= __this_cpu_ist_bottom_va(VC)) && (sp < __this_cpu_ist_top_va(VC)));
127137 }
128138
@@ -144,7 +154,7 @@ void noinstr __sev_es_ist_enter(struct pt_regs *regs) · 15 unmodified lines
144154 old_ist = __this_cpu_read(cpu_tss_rw.x86_tss.ist[IST_INDEX_VC]);
145155
146156 /* Make room on the IST stack */
147− if (on_vc_stack(regs->sp))
157+ if (on_vc_stack(regs))
148158 new_ist = ALIGN_DOWN(regs->sp, 8) - sizeof(old_ist);
149159 else
150160 new_ist = old_ist - sizeof(old_ist);
@@ -248,7 +258,7 @@ static enum es_result vc_decode_insn(struct es_em_ctxt *ctxt) · 97 unmodified lines
248258 int res;
249259
250260 if (user_mode(ctxt->regs)) {
251− res = insn_fetch_from_user(ctxt->regs, buffer);
261+ res = insn_fetch_from_user_inatomic(ctxt->regs, buffer);
252262 if (!res) {
253263 ctxt->fi.vector = X86_TRAP_PF;
254264 ctxt->fi.error_code = X86_PF_INSTR | X86_PF_USER;
@@ -1248,13 +1258,12 @@ static __always_inline bool on_vc_fallback_stack(struct pt_regs *regs) · 993 unmodified lines
12481258 DEFINE_IDTENTRY_VC_SAFE_STACK(exc_vmm_communication)
12491259 {
12501260 struct sev_es_runtime_data *data = this_cpu_read(runtime_data);
1261+ irqentry_state_t irq_state;
12511262 struct ghcb_state state;
12521263 struct es_em_ctxt ctxt;
12531264 enum es_result result;
12541265 struct ghcb *ghcb;
12551266
1256− lockdep_assert_irqs_disabled();
1257−
12581267 /*
12591268 * Handle #DB before calling into !noinstr code to avoid recursive #DB.
12601269 */
@@ -1263,6 +1272,8 @@ DEFINE_IDTENTRY_VC_SAFE_STACK(exc_vmm_communication) · 2 unmodified lines
12631272 return;
12641273 }
12651274
1275+ irq_state = irqentry_nmi_enter(regs);
1276+ lockdep_assert_irqs_disabled();
12661277 instrumentation_begin();
12671278
12681279 /*
@@ -1325,6 +1336,7 @@ DEFINE_IDTENTRY_VC_SAFE_STACK(exc_vmm_communication) · 56 unmodified lines
13251336
13261337 out:
13271338 instrumentation_end();
1339+ irqentry_nmi_exit(regs, irq_state);
13281340
13291341 return;
13301342
arch/x86/kernel/traps.c+1−2
@@ -694,8 +694,7 @@ asmlinkage __visible noinstr struct pt_regs *vc_switch_off_ist(struct pt_regs *r · 693 unmodified lines
694694 * In the SYSCALL entry path the RSP value comes from user-space - don't
695695 * trust it and switch to the current kernel stack
696696 */
697− if (regs->ip >= (unsigned long)entry_SYSCALL_64 &&
698− regs->ip < (unsigned long)entry_SYSCALL_64_safe_stack) {
697+ if (ip_within_syscall_gap(regs)) {
699698 sp = this_cpu_read(cpu_current_top_of_stack);
700699 goto sync;
701700 }
arch/x86/kernel/unwind_orc.c+7−7
@@ -13,7 +13,7 @@ · 12 unmodified lines
1313
1414 #define orc_warn_current(args...) \
1515 ({ \
16− if (state->task == current) \
16+ if (state->task == current && !state->error) \
1717 orc_warn(args); \
1818 })
1919
@@ -367,8 +367,8 @@ static bool deref_stack_regs(struct unwind_state *state, unsigned long addr, · 347 unmodified lines
367367 if (!stack_access_ok(state, addr, sizeof(struct pt_regs)))
368368 return false;
369369
370− *ip = regs->ip;
371− *sp = regs->sp;
370+ *ip = READ_ONCE_NOCHECK(regs->ip);
371+ *sp = READ_ONCE_NOCHECK(regs->sp);
372372 return true;
373373 }
374374
@@ -380,8 +380,8 @@ static bool deref_stack_iret_regs(struct unwind_state *state, unsigned long addr · 5 unmodified lines
380380 if (!stack_access_ok(state, addr, IRET_FRAME_SIZE))
381381 return false;
382382
383− *ip = regs->ip;
384− *sp = regs->sp;
383+ *ip = READ_ONCE_NOCHECK(regs->ip);
384+ *sp = READ_ONCE_NOCHECK(regs->sp);
385385 return true;
386386 }
387387
@@ -402,12 +402,12 @@ static bool get_reg(struct unwind_state *state, unsigned int reg_off, · 14 unmodified lines
402402 return false;
403403
404404 if (state->full_regs) {
405− *val = ((unsigned long *)state->regs)[reg];
405+ *val = READ_ONCE_NOCHECK(((unsigned long *)state->regs)[reg]);
406406 return true;
407407 }
408408
409409 if (state->prev_regs) {
410− *val = ((unsigned long *)state->prev_regs)[reg];
410+ *val = READ_ONCE_NOCHECK(((unsigned long *)state->prev_regs)[reg]);
411411 return true;
412412 }
413413
arch/x86/kvm/lapic.c+11−1
@@ -1642,7 +1642,16 @@ static void apic_timer_expired(struct kvm_lapic *apic, bool from_timer_fn) · 1641 unmodified lines
16421642 }
16431643
16441644 if (kvm_use_posted_timer_interrupt(apic->vcpu)) {
1645− kvm_wait_lapic_expire(vcpu);
1645+ /*
1646+ * Ensure the guest's timer has truly expired before posting an
1647+ * interrupt. Open code the relevant checks to avoid querying
1648+ * lapic_timer_int_injected(), which will be false since the
1649+ * interrupt isn't yet injected. Waiting until after injecting
1650+ * is not an option since that won't help a posted interrupt.
1651+ */
1652+ if (vcpu->arch.apic->lapic_timer.expired_tscdeadline &&
1653+ vcpu->arch.apic->lapic_timer.timer_advance_ns)
1654+ __kvm_wait_lapic_expire(vcpu);
16461655 kvm_apic_inject_pending_timer_irqs(apic);
16471656 return;
16481657 }
@@ -2595,6 +2604,7 @@ int kvm_apic_set_state(struct kvm_vcpu *vcpu, struct kvm_lapic_state *s) · 946 unmodified lines
25952604
25962605 apic_update_ppr(apic);
25972606 hrtimer_cancel(&apic->lapic_timer.timer);
2607+ apic->lapic_timer.expired_tscdeadline = 0;
25982608 apic_update_lvtt(apic);
25992609 apic_manage_nmi_watchdog(apic, kvm_lapic_get_reg(apic, APIC_LVT0));
26002610 update_divide_count(apic);
arch/x86/kvm/mmu/tdp_mmu.c+11−0
@@ -337,7 +337,18 @@ static void handle_removed_tdp_mmu_page(struct kvm *kvm, u64 *pt, · 336 unmodified lines
337337 cpu_relax();
338338 }
339339 } else {
340+ /*
341+ * If the SPTE is not MMU-present, there is no backing
342+ * page associated with the SPTE and so no side effects
343+ * that need to be recorded, and exclusive ownership of
344+ * mmu_lock ensures the SPTE can't be made present.
345+ * Note, zapping MMIO SPTEs is also unnecessary as they
346+ * are guarded by the memslots generation, not by being
347+ * unreachable.
348+ */
340349 old_child_spte = READ_ONCE(*sptep);
350+ if (!is_shadow_present_pte(old_child_spte))
351+ continue;
341352
342353 /*
343354 * Marking the SPTE as a removed SPTE is not
arch/x86/kvm/svm/svm.c+13−12
@@ -115,13 +115,6 @@ static const struct svm_direct_access_msrs { · 114 unmodified lines
115115 { .index = MSR_INVALID, .always = false },
116116 };
117117
118−/* enable NPT for AMD64 and X86 with PAE */
119−#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
120−bool npt_enabled = true;
121−#else
122−bool npt_enabled;
123−#endif
124−
125118 /*
126119 * These 2 parameters are used to config the controls for Pause-Loop Exiting:
127120 * pause_filter_count: On processors that support Pause filtering(indicated
@@ -170,9 +163,12 @@ module_param(pause_filter_count_shrink, ushort, 0444); · 42 unmodified lines
170163 static unsigned short pause_filter_count_max = KVM_SVM_DEFAULT_PLE_WINDOW_MAX;
171164 module_param(pause_filter_count_max, ushort, 0444);
172165
173−/* allow nested paging (virtualized MMU) for all guests */
174−static int npt = true;
175−module_param(npt, int, S_IRUGO);
166+/*
167+ * Use nested page tables by default. Note, NPT may get forced off by
168+ * svm_hardware_setup() if it's unsupported by hardware or the host kernel.
169+ */
170+bool npt_enabled = true;
171+module_param_named(npt, npt_enabled, bool, 0444);
176172
177173 /* allow nested virtualization in KVM/SVM */
178174 static int nested = true;
@@ -988,10 +984,15 @@ static __init int svm_hardware_setup(void) · 809 unmodified lines
988984 goto err;
989985 }
990986
991− if (!boot_cpu_has(X86_FEATURE_NPT))
987+ /*
988+ * KVM's MMU doesn't support using 2-level paging for itself, and thus
989+ * NPT isn't supported if the host is using 2-level paging since host
990+ * CR4 is unchanged on VMRUN.
991+ */
992+ if (!IS_ENABLED(CONFIG_X86_64) && !IS_ENABLED(CONFIG_X86_PAE))
992993 npt_enabled = false;
993994
994− if (npt_enabled && !npt)
995+ if (!boot_cpu_has(X86_FEATURE_NPT))
995996 npt_enabled = false;
996997
997998 kvm_configure_mmu(npt_enabled, get_max_npt_level(), PG_LEVEL_1G);
arch/x86/kvm/vmx/vmx.c+1−1
@@ -6580,8 +6580,8 @@ static void atomic_switch_perf_msrs(struct vcpu_vmx *vmx) · 6579 unmodified lines
65806580 int i, nr_msrs;
65816581 struct perf_guest_switch_msr *msrs;
65826582
6583+ /* Note, nr_msrs may be garbage if perf_guest_get_msrs() returns NULL. */
65836584 msrs = perf_guest_get_msrs(&nr_msrs);
6584−
65856585 if (!msrs)
65866586 return;
65876587
arch/x86/kvm/x86.c+1−1
@@ -10601,7 +10601,7 @@ void __user * __x86_set_memory_region(struct kvm *kvm, int id, gpa_t gpa, · 10600 unmodified lines
1060110601 return (void __user *)hva;
1060210602 } else {
1060310603 if (!slot || !slot->npages)
10604− return 0;
10604+ return NULL;
1060510605
1060610606 old_npages = slot->npages;
1060710607 hva = slot->userspace_addr;
arch/x86/lib/insn-eval.c+52−14
@@ -1415,6 +1415,25 @@ void __user *insn_get_addr_ref(struct insn *insn, struct pt_regs *regs) · 1414 unmodified lines
14151415 }
14161416 }
14171417
1418+static unsigned long insn_get_effective_ip(struct pt_regs *regs)
1419+{
1420+ unsigned long seg_base = 0;
1421+
1422+ /*
1423+ * If not in user-space long mode, a custom code segment could be in
1424+ * use. This is true in protected mode (if the process defined a local
1425+ * descriptor table), or virtual-8086 mode. In most of the cases
1426+ * seg_base will be zero as in USER_CS.
1427+ */
1428+ if (!user_64bit_mode(regs)) {
1429+ seg_base = insn_get_seg_base(regs, INAT_SEG_REG_CS);
1430+ if (seg_base == -1L)
1431+ return 0;
1432+ }
1433+
1434+ return seg_base + regs->ip;
1435+}
1436+
14181437 /**
14191438 * insn_fetch_from_user() - Copy instruction bytes from user-space memory
14201439 * @regs: Structure with register values as seen when entering kernel mode
@@ -1431,24 +1450,43 @@ void __user *insn_get_addr_ref(struct insn *insn, struct pt_regs *regs) · 10 unmodified lines
14311450 */
14321451 int insn_fetch_from_user(struct pt_regs *regs, unsigned char buf[MAX_INSN_SIZE])
14331452 {
1434− unsigned long seg_base = 0;
1453+ unsigned long ip;
14351454 int not_copied;
14361455
1437− /*
1438− * If not in user-space long mode, a custom code segment could be in
1439− * use. This is true in protected mode (if the process defined a local
1440− * descriptor table), or virtual-8086 mode. In most of the cases
1441− * seg_base will be zero as in USER_CS.
1442− */
1443− if (!user_64bit_mode(regs)) {
1444− seg_base = insn_get_seg_base(regs, INAT_SEG_REG_CS);
1445− if (seg_base == -1L)
1446− return 0;
1447− }
1456+ ip = insn_get_effective_ip(regs);
1457+ if (!ip)
1458+ return 0;
1459+
1460+ not_copied = copy_from_user(buf, (void __user *)ip, MAX_INSN_SIZE);
14481461
1462+ return MAX_INSN_SIZE - not_copied;
1463+}
1464+
1465+/**
1466+ * insn_fetch_from_user_inatomic() - Copy instruction bytes from user-space memory
1467+ * while in atomic code
1468+ * @regs: Structure with register values as seen when entering kernel mode
1469+ * @buf: Array to store the fetched instruction
1470+ *
1471+ * Gets the linear address of the instruction and copies the instruction bytes
1472+ * to the buf. This function must be used in atomic context.
1473+ *
1474+ * Returns:
1475+ *
1476+ * Number of instruction bytes copied.
1477+ *
1478+ * 0 if nothing was copied.
1479+ */
1480+int insn_fetch_from_user_inatomic(struct pt_regs *regs, unsigned char buf[MAX_INSN_SIZE])
1481+{
1482+ unsigned long ip;
1483+ int not_copied;
1484+
1485+ ip = insn_get_effective_ip(regs);
1486+ if (!ip)
1487+ return 0;
14491488
1450− not_copied = copy_from_user(buf, (void __user *)(seg_base + regs->ip),
1451− MAX_INSN_SIZE);
1489+ not_copied = __copy_from_user_inatomic(buf, (void __user *)ip, MAX_INSN_SIZE);
14521490
14531491 return MAX_INSN_SIZE - not_copied;
14541492 }
arch/x86/net/bpf_jit_comp.c+7−3
@@ -1349,6 +1349,7 @@ st: if (is_imm8(insn->off)) · 1348 unmodified lines
13491349 insn->imm == (BPF_XOR | BPF_FETCH)) {
13501350 u8 *branch_target;
13511351 bool is64 = BPF_SIZE(insn->code) == BPF_DW;
1352+ u32 real_src_reg = src_reg;
13521353
13531354 /*
13541355 * Can't be implemented with a single x86 insn.
@@ -1357,6 +1358,9 @@ st: if (is_imm8(insn->off)) · 2 unmodified lines
13571358
13581359 /* Will need RAX as a CMPXCHG operand so save R0 */
13591360 emit_mov_reg(&prog, true, BPF_REG_AX, BPF_REG_0);
1361+ if (src_reg == BPF_REG_0)
1362+ real_src_reg = BPF_REG_AX;
1363+
13601364 branch_target = prog;
13611365 /* Load old value */
13621366 emit_ldx(&prog, BPF_SIZE(insn->code),
@@ -1366,9 +1370,9 @@ st: if (is_imm8(insn->off)) · 3 unmodified lines
13661370 * put the result in the AUX_REG.
13671371 */
13681372 emit_mov_reg(&prog, is64, AUX_REG, BPF_REG_0);
1369− maybe_emit_mod(&prog, AUX_REG, src_reg, is64);
1373+ maybe_emit_mod(&prog, AUX_REG, real_src_reg, is64);
13701374 EMIT2(simple_alu_opcodes[BPF_OP(insn->imm)],
1371− add_2reg(0xC0, AUX_REG, src_reg));
1375+ add_2reg(0xC0, AUX_REG, real_src_reg));
13721376 /* Attempt to swap in new value */
13731377 err = emit_atomic(&prog, BPF_CMPXCHG,
13741378 dst_reg, AUX_REG, insn->off,
@@ -1381,7 +1385,7 @@ st: if (is_imm8(insn->off)) · 6 unmodified lines
13811385 */
13821386 EMIT2(X86_JNE, -(prog - branch_target) - 2);
13831387 /* Return the pre-modification value */
1384− emit_mov_reg(&prog, is64, src_reg, BPF_REG_0);
1388+ emit_mov_reg(&prog, is64, real_src_reg, BPF_REG_0);
13851389 /* Restore R0 after clobbering RAX */
13861390 emit_mov_reg(&prog, true, BPF_REG_0, BPF_REG_AX);
13871391 break;
arch/x86/xen/p2m.c+2−4
@@ -741,7 +741,7 @@ int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops, · 740 unmodified lines
741741 map_ops[i].status = GNTST_general_error;
742742 unmap[0].host_addr = map_ops[i].host_addr,
743743 unmap[0].handle = map_ops[i].handle;
744− map_ops[i].handle = ~0;
744+ map_ops[i].handle = INVALID_GRANT_HANDLE;
745745 if (map_ops[i].flags & GNTMAP_device_map)
746746 unmap[0].dev_bus_addr = map_ops[i].dev_bus_addr;
747747 else
@@ -751,7 +751,7 @@ int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops, · 3 unmodified lines
751751 kmap_ops[i].status = GNTST_general_error;
752752 unmap[1].host_addr = kmap_ops[i].host_addr,
753753 unmap[1].handle = kmap_ops[i].handle;
754− kmap_ops[i].handle = ~0;
754+ kmap_ops[i].handle = INVALID_GRANT_HANDLE;
755755 if (kmap_ops[i].flags & GNTMAP_device_map)
756756 unmap[1].dev_bus_addr = kmap_ops[i].dev_bus_addr;
757757 else
@@ -776,7 +776,6 @@ int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops, · 18 unmodified lines
776776 out:
777777 return ret;
778778 }
779−EXPORT_SYMBOL_GPL(set_foreign_p2m_mapping);
780779
781780 int clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref *unmap_ops,
782781 struct gnttab_unmap_grant_ref *kunmap_ops,
@@ -802,7 +801,6 @@ int clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref *unmap_ops, · 19 unmodified lines
802801
803802 return ret;
804803 }
805−EXPORT_SYMBOL_GPL(clear_foreign_p2m_mapping);
806804
807805 #ifdef CONFIG_XEN_DEBUG_FS
808806 #include <linux/debugfs.h>
block/bio.c+7−7
@@ -33,7 +33,7 @@ static struct biovec_slab { · 32 unmodified lines
3333 { .nr_vecs = 16, .name = "biovec-16" },
3434 { .nr_vecs = 64, .name = "biovec-64" },
3535 { .nr_vecs = 128, .name = "biovec-128" },
36− { .nr_vecs = BIO_MAX_PAGES, .name = "biovec-max" },
36+ { .nr_vecs = BIO_MAX_VECS, .name = "biovec-max" },
3737 };
3838
3939 static struct biovec_slab *biovec_slab(unsigned short nr_vecs)
@@ -46,7 +46,7 @@ static struct biovec_slab *biovec_slab(unsigned short nr_vecs) · 6 unmodified lines
4646 return &bvec_slabs[1];
4747 case 65 ... 128:
4848 return &bvec_slabs[2];
49− case 129 ... BIO_MAX_PAGES:
49+ case 129 ... BIO_MAX_VECS:
5050 return &bvec_slabs[3];
5151 default:
5252 BUG();
@@ -151,9 +151,9 @@ out: · 98 unmodified lines
151151
152152 void bvec_free(mempool_t *pool, struct bio_vec *bv, unsigned short nr_vecs)
153153 {
154− BIO_BUG_ON(nr_vecs > BIO_MAX_PAGES);
154+ BIO_BUG_ON(nr_vecs > BIO_MAX_VECS);
155155
156− if (nr_vecs == BIO_MAX_PAGES)
156+ if (nr_vecs == BIO_MAX_VECS)
157157 mempool_free(bv, pool);
158158 else if (nr_vecs > BIO_INLINE_VECS)
159159 kmem_cache_free(biovec_slab(nr_vecs)->slab, bv);
@@ -186,15 +186,15 @@ struct bio_vec *bvec_alloc(mempool_t *pool, unsigned short *nr_vecs, · 26 unmodified lines
186186 /*
187187 * Try a slab allocation first for all smaller allocations. If that
188188 * fails and __GFP_DIRECT_RECLAIM is set retry with the mempool.
189− * The mempool is sized to handle up to BIO_MAX_PAGES entries.
189+ * The mempool is sized to handle up to BIO_MAX_VECS entries.
190190 */
191− if (*nr_vecs < BIO_MAX_PAGES) {
191+ if (*nr_vecs < BIO_MAX_VECS) {
192192 struct bio_vec *bvl;
193193
194194 bvl = kmem_cache_alloc(bvs->slab, bvec_alloc_gfp(gfp_mask));
195195 if (likely(bvl) || !(gfp_mask & __GFP_DIRECT_RECLAIM))
196196 return bvl;
197− *nr_vecs = BIO_MAX_PAGES;
197+ *nr_vecs = BIO_MAX_VECS;
198198 }
199199
200200 return mempool_alloc(pool, gfp_mask);
block/blk-cgroup-rwstat.c+2−1
@@ -109,6 +109,7 @@ void blkg_rwstat_recursive_sum(struct blkcg_gq *blkg, struct blkcg_policy *pol, · 108 unmodified lines
109109
110110 lockdep_assert_held(&blkg->q->queue_lock);
111111
112+ memset(sum, 0, sizeof(*sum));
112113 rcu_read_lock();
113114 blkg_for_each_descendant_pre(pos_blkg, pos_css, blkg) {
114115 struct blkg_rwstat *rwstat;
@@ -122,7 +123,7 @@ void blkg_rwstat_recursive_sum(struct blkcg_gq *blkg, struct blkcg_policy *pol, · 7 unmodified lines
122123 rwstat = (void *)pos_blkg + off;
123124
124125 for (i = 0; i < BLKG_RWSTAT_NR; i++)
125− sum->cnt[i] = blkg_rwstat_read_counter(rwstat, i);
126+ sum->cnt[i] += blkg_rwstat_read_counter(rwstat, i);
126127 }
127128 rcu_read_unlock();
128129 }
block/blk-crypto-fallback.c+1−1
@@ -219,7 +219,7 @@ static bool blk_crypto_split_bio_if_needed(struct bio **bio_ptr) · 218 unmodified lines
219219
220220 bio_for_each_segment(bv, bio, iter) {
221221 num_sectors += bv.bv_len >> SECTOR_SHIFT;
222− if (++i == BIO_MAX_PAGES)
222+ if (++i == BIO_MAX_VECS)
223223 break;
224224 }
225225 if (num_sectors < bio_sectors(bio)) {
block/blk-lib.c+1−1
@@ -296,7 +296,7 @@ static unsigned int __blkdev_sectors_to_bio_pages(sector_t nr_sects) · 295 unmodified lines
296296 {
297297 sector_t pages = DIV_ROUND_UP_SECTOR_T(nr_sects, PAGE_SIZE / 512);
298298
299− return min(pages, (sector_t)BIO_MAX_PAGES);
299+ return min(pages, (sector_t)BIO_MAX_VECS);
300300 }
301301
302302 static int __blkdev_issue_zero_pages(struct block_device *bdev,
block/blk-map.c+1−1
@@ -249,7 +249,7 @@ static int bio_map_user_iov(struct request *rq, struct iov_iter *iter, · 248 unmodified lines
249249 if (!iov_iter_count(iter))
250250 return -EINVAL;
251251
252− bio = bio_kmalloc(gfp_mask, iov_iter_npages(iter, BIO_MAX_PAGES));
252+ bio = bio_kmalloc(gfp_mask, iov_iter_npages(iter, BIO_MAX_VECS));
253253 if (!bio)
254254 return -ENOMEM;
255255 bio->bi_opf |= req_op(rq);
block/blk-zoned.c+37−3
@@ -240,7 +240,7 @@ int blkdev_zone_mgmt(struct block_device *bdev, enum req_opf op, · 239 unmodified lines
240240 */
241241 if (op == REQ_OP_ZONE_RESET &&
242242 blkdev_allow_reset_all_zones(bdev, sector, nr_sectors)) {
243− bio->bi_opf = REQ_OP_ZONE_RESET_ALL;
243+ bio->bi_opf = REQ_OP_ZONE_RESET_ALL | REQ_SYNC;
244244 break;
245245 }
246246
@@ -318,6 +318,22 @@ int blkdev_report_zones_ioctl(struct block_device *bdev, fmode_t mode, · 71 unmodified lines
318318 return 0;
319319 }
320320
321+static int blkdev_truncate_zone_range(struct block_device *bdev, fmode_t mode,
322+ const struct blk_zone_range *zrange)
323+{
324+ loff_t start, end;
325+
326+ if (zrange->sector + zrange->nr_sectors <= zrange->sector ||
327+ zrange->sector + zrange->nr_sectors > get_capacity(bdev->bd_disk))
328+ /* Out of range */
329+ return -EINVAL;
330+
331+ start = zrange->sector << SECTOR_SHIFT;
332+ end = ((zrange->sector + zrange->nr_sectors) << SECTOR_SHIFT) - 1;
333+
334+ return truncate_bdev_range(bdev, mode, start, end);
335+}
336+
321337 /*
322338 * BLKRESETZONE, BLKOPENZONE, BLKCLOSEZONE and BLKFINISHZONE ioctl processing.
323339 * Called from blkdev_ioctl.
@@ -329,6 +345,7 @@ int blkdev_zone_mgmt_ioctl(struct block_device *bdev, fmode_t mode, · 5 unmodified lines
329345 struct request_queue *q;
330346 struct blk_zone_range zrange;
331347 enum req_opf op;
348+ int ret;
332349
333350 if (!argp)
334351 return -EINVAL;
@@ -352,6 +369,11 @@ int blkdev_zone_mgmt_ioctl(struct block_device *bdev, fmode_t mode, · 17 unmodified lines
352369 switch (cmd) {
353370 case BLKRESETZONE:
354371 op = REQ_OP_ZONE_RESET;
372+
373+ /* Invalidate the page cache, including dirty pages. */
374+ ret = blkdev_truncate_zone_range(bdev, mode, &zrange);
375+ if (ret)
376+ return ret;
355377 break;
356378 case BLKOPENZONE:
357379 op = REQ_OP_ZONE_OPEN;
@@ -366,8 +388,20 @@ int blkdev_zone_mgmt_ioctl(struct block_device *bdev, fmode_t mode, · 8 unmodified lines
366388 return -ENOTTY;
367389 }
368390
369− return blkdev_zone_mgmt(bdev, op, zrange.sector, zrange.nr_sectors,
370− GFP_KERNEL);
391+ ret = blkdev_zone_mgmt(bdev, op, zrange.sector, zrange.nr_sectors,
392+ GFP_KERNEL);
393+
394+ /*
395+ * Invalidate the page cache again for zone reset: writes can only be
396+ * direct for zoned devices so concurrent writes would not add any page
397+ * to the page cache after/during reset. The page cache may be filled
398+ * again due to concurrent reads though and dropping the pages for
399+ * these is fine.
400+ */
401+ if (!ret && cmd == BLKRESETZONE)
402+ ret = blkdev_truncate_zone_range(bdev, mode, &zrange);
403+
404+ return ret;
371405 }
372406
373407 static inline unsigned long *blk_alloc_zone_bitmap(int node,
block/bounce.c+3−3
@@ -229,10 +229,10 @@ static struct bio *bounce_clone_bio(struct bio *bio_src) · 228 unmodified lines
229229 * - The point of cloning the biovec is to produce a bio with a biovec
230230 * the caller can modify: bi_idx and bi_bvec_done should be 0.
231231 *
232− * - The original bio could've had more than BIO_MAX_PAGES biovecs; if
232+ * - The original bio could've had more than BIO_MAX_VECS biovecs; if
233233 * we tried to clone the whole thing bio_alloc_bioset() would fail.
234234 * But the clone should succeed as long as the number of biovecs we
235− * actually need to allocate is fewer than BIO_MAX_PAGES.
235+ * actually need to allocate is fewer than BIO_MAX_VECS.
236236 *
237237 * - Lastly, bi_vcnt should not be looked at or relied upon by code
238238 * that does not own the bio - reason being drivers don't use it for
@@ -299,7 +299,7 @@ static void __blk_queue_bounce(struct request_queue *q, struct bio **bio_orig, · 60 unmodified lines
299299 int sectors = 0;
300300
301301 bio_for_each_segment(from, *bio_orig, iter) {
302− if (i++ < BIO_MAX_PAGES)
302+ if (i++ < BIO_MAX_VECS)
303303 sectors += from.bv_len >> 9;
304304 if (page_to_pfn(from.bv_page) > q->limits.bounce_pfn)
305305 bounce = true;
block/genhd.c+1−3
@@ -534,10 +534,8 @@ static void register_disk(struct device *parent, struct gendisk *disk, · 533 unmodified lines
534534 kobject_create_and_add("holders", &ddev->kobj);
535535 disk->slave_dir = kobject_create_and_add("slaves", &ddev->kobj);
536536
537− if (disk->flags & GENHD_FL_HIDDEN) {
538− dev_set_uevent_suppress(ddev, 0);
537+ if (disk->flags & GENHD_FL_HIDDEN)
539538 return;
540− }
541539
542540 disk_scan_partitions(disk);
543541
crypto/Kconfig+1−1
@@ -767,7 +767,7 @@ config CRYPTO_POLY1305_X86_64 · 766 unmodified lines
767767
768768 config CRYPTO_POLY1305_MIPS
769769 tristate "Poly1305 authenticator algorithm (MIPS optimized)"
770− depends on CPU_MIPS32 || (CPU_MIPS64 && 64BIT)
770+ depends on MIPS
771771 select CRYPTO_ARCH_HAVE_LIB_POLY1305
772772
773773 config CRYPTO_MD4
drivers/atm/eni.c+2−1
@@ -2260,7 +2260,8 @@ out: · 2259 unmodified lines
22602260 return rc;
22612261
22622262 err_eni_release:
2263− eni_do_release(dev);
2263+ dev->phy = NULL;
2264+ iounmap(ENI_DEV(dev)->ioaddr);
22642265 err_unregister:
22652266 atm_dev_deregister(dev);
22662267 err_free_consistent:
drivers/atm/idt77105.c+2−2
@@ -262,7 +262,7 @@ static int idt77105_start(struct atm_dev *dev) · 261 unmodified lines
262262 {
263263 unsigned long flags;
264264
265− if (!(dev->dev_data = kmalloc(sizeof(struct idt77105_priv),GFP_KERNEL)))
265+ if (!(dev->phy_data = kmalloc(sizeof(struct idt77105_priv),GFP_KERNEL)))
266266 return -ENOMEM;
267267 PRIV(dev)->dev = dev;
268268 spin_lock_irqsave(&idt77105_priv_lock, flags);
@@ -337,7 +337,7 @@ static int idt77105_stop(struct atm_dev *dev) · 68 unmodified lines
337337 else
338338 idt77105_all = walk->next;
339339 dev->phy = NULL;
340− dev->dev_data = NULL;
340+ dev->phy_data = NULL;
341341 kfree(walk);
342342 break;
343343 }
drivers/atm/lanai.c+4−1
@@ -2233,6 +2233,7 @@ static int lanai_dev_open(struct atm_dev *atmdev) · 2232 unmodified lines
22332233 conf1_write(lanai);
22342234 #endif
22352235 iounmap(lanai->base);
2236+ lanai->base = NULL;
22362237 error_pci:
22372238 pci_disable_device(lanai->pci);
22382239 error:
@@ -2245,6 +2246,8 @@ static int lanai_dev_open(struct atm_dev *atmdev) · 6 unmodified lines
22452246 static void lanai_dev_close(struct atm_dev *atmdev)
22462247 {
22472248 struct lanai_dev *lanai = (struct lanai_dev *) atmdev->dev_data;
2249+ if (lanai->base==NULL)
2250+ return;
22482251 printk(KERN_INFO DEV_LABEL "(itf %d): shutting down interface\n",
22492252 lanai->number);
22502253 lanai_timed_poll_stop(lanai);
@@ -2552,7 +2555,7 @@ static int lanai_init_one(struct pci_dev *pci, · 301 unmodified lines
25522555 struct atm_dev *atmdev;
25532556 int result;
25542557
2555− lanai = kmalloc(sizeof(*lanai), GFP_KERNEL);
2558+ lanai = kzalloc(sizeof(*lanai), GFP_KERNEL);
25562559 if (lanai == NULL) {
25572560 printk(KERN_ERR DEV_LABEL
25582561 ": couldn't allocate dev_data structure!\n");
drivers/atm/uPD98402.c+1−1
@@ -211,7 +211,7 @@ static void uPD98402_int(struct atm_dev *dev) · 210 unmodified lines
211211 static int uPD98402_start(struct atm_dev *dev)
212212 {
213213 DPRINTK("phy_start\n");
214− if (!(dev->dev_data = kmalloc(sizeof(struct uPD98402_priv),GFP_KERNEL)))
214+ if (!(dev->phy_data = kmalloc(sizeof(struct uPD98402_priv),GFP_KERNEL)))
215215 return -ENOMEM;
216216 spin_lock_init(&PRIV(dev)->lock);
217217 memset(&PRIV(dev)->sonet_stats,0,sizeof(struct k_sonet_stats));
drivers/base/swnode.c+20−9
@@ -938,6 +938,9 @@ int software_node_register(const struct software_node *node) · 937 unmodified lines
938938 if (software_node_to_swnode(node))
939939 return -EEXIST;
940940
941+ if (node->parent && !parent)
942+ return -EINVAL;
943+
941944 return PTR_ERR_OR_ZERO(swnode_register(node, parent, 0));
942945 }
943946 EXPORT_SYMBOL_GPL(software_node_register);
@@ -1002,25 +1005,33 @@ EXPORT_SYMBOL_GPL(fwnode_remove_software_node); · 58 unmodified lines
10021005 /**
10031006 * device_add_software_node - Assign software node to a device
10041007 * @dev: The device the software node is meant for.
1005− * @swnode: The software node.
1008+ * @node: The software node.
10061009 *
1007− * This function will register @swnode and make it the secondary firmware node
1008− * pointer of @dev. If @dev has no primary node, then @swnode will become the primary
1009− * node.
1010+ * This function will make @node the secondary firmware node pointer of @dev. If
1011+ * @dev has no primary node, then @node will become the primary node. The
1012+ * function will register @node automatically if it wasn't already registered.
10101013 */
1011−int device_add_software_node(struct device *dev, const struct software_node *swnode)
1014+int device_add_software_node(struct device *dev, const struct software_node *node)
10121015 {
1016+ struct swnode *swnode;
10131017 int ret;
10141018
10151019 /* Only one software node per device. */
10161020 if (dev_to_swnode(dev))
10171021 return -EBUSY;
10181022
1019− ret = software_node_register(swnode);
1020− if (ret)
1021− return ret;
1023+ swnode = software_node_to_swnode(node);
1024+ if (swnode) {
1025+ kobject_get(&swnode->kobj);
1026+ } else {
1027+ ret = software_node_register(node);
1028+ if (ret)
1029+ return ret;
1030+
1031+ swnode = software_node_to_swnode(node);
1032+ }
10221033
1023− set_secondary_fwnode(dev, software_node_fwnode(swnode));
1034+ set_secondary_fwnode(dev, &swnode->fwnode);
10241035
10251036 return 0;
10261037 }
drivers/block/drbd/drbd_int.h+1−1
@@ -1324,7 +1324,7 @@ struct bm_extent { · 1323 unmodified lines
13241324 * A followup commit may allow even bigger BIO sizes,
13251325 * once we thought that through. */
13261326 #define DRBD_MAX_BIO_SIZE (1U << 20)
1327−#if DRBD_MAX_BIO_SIZE > (BIO_MAX_PAGES << PAGE_SHIFT)
1327+#if DRBD_MAX_BIO_SIZE > (BIO_MAX_VECS << PAGE_SHIFT)
13281328 #error Architecture not supported: DRBD_MAX_BIO_SIZE > BIO_MAX_SIZE
13291329 #endif
13301330 #define DRBD_MAX_BIO_SIZE_SAFE (1U << 12) /* Works always = 4k */
drivers/block/rsxx/core.c+1−0
@@ -871,6 +871,7 @@ static int rsxx_pci_probe(struct pci_dev *dev, · 870 unmodified lines
871871 card->event_wq = create_singlethread_workqueue(DRIVER_NAME"_event");
872872 if (!card->event_wq) {
873873 dev_err(CARD_TO_DEV(card), "Failed card event setup.\n");
874+ st = -ENOMEM;
874875 goto failed_event_handler;
875876 }
876877
drivers/block/umem.c+4−1
@@ -877,6 +877,7 @@ static int mm_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) · 876 unmodified lines
877877 if (card->mm_pages[0].desc == NULL ||
878878 card->mm_pages[1].desc == NULL) {
879879 dev_printk(KERN_ERR, &card->dev->dev, "alloc failed\n");
880+ ret = -ENOMEM;
880881 goto failed_alloc;
881882 }
882883 reset_page(&card->mm_pages[0]);
@@ -888,8 +889,10 @@ static int mm_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) · 5 unmodified lines
888889 spin_lock_init(&card->lock);
889890
890891 card->queue = blk_alloc_queue(NUMA_NO_NODE);
891− if (!card->queue)
892+ if (!card->queue) {
893+ ret = -ENOMEM;
892894 goto failed_alloc;
895+ }
893896
894897 tasklet_init(&card->tasklet, process_page, (unsigned long)card);
895898
drivers/block/zram/zram_drv.c+11−6
@@ -627,7 +627,7 @@ static ssize_t writeback_store(struct device *dev, · 626 unmodified lines
627627 struct bio_vec bio_vec;
628628 struct page *page;
629629 ssize_t ret = len;
630− int mode;
630+ int mode, err;
631631 unsigned long blk_idx = 0;
632632
633633 if (sysfs_streq(buf, "idle"))
@@ -638,8 +638,8 @@ static ssize_t writeback_store(struct device *dev, · 4 unmodified lines
638638 if (strncmp(buf, PAGE_WB_SIG, sizeof(PAGE_WB_SIG) - 1))
639639 return -EINVAL;
640640
641− ret = kstrtol(buf + sizeof(PAGE_WB_SIG) - 1, 10, &index);
642− if (ret || index >= nr_pages)
641+ if (kstrtol(buf + sizeof(PAGE_WB_SIG) - 1, 10, &index) ||
642+ index >= nr_pages)
643643 return -EINVAL;
644644
645645 nr_pages = 1;
@@ -663,7 +663,7 @@ static ssize_t writeback_store(struct device *dev, · 17 unmodified lines
663663 goto release_init_lock;
664664 }
665665
666− while (nr_pages--) {
666+ for (; nr_pages != 0; index++, nr_pages--) {
667667 struct bio_vec bvec;
668668
669669 bvec.bv_page = page;
@@ -728,12 +728,17 @@ static ssize_t writeback_store(struct device *dev, · 58 unmodified lines
728728 * XXX: A single page IO would be inefficient for write
729729 * but it would be not bad as starter.
730730 */
731− ret = submit_bio_wait(&bio);
732− if (ret) {
731+ err = submit_bio_wait(&bio);
732+ if (err) {
733733 zram_slot_lock(zram, index);
734734 zram_clear_flag(zram, index, ZRAM_UNDER_WB);
735735 zram_clear_flag(zram, index, ZRAM_IDLE);
736736 zram_slot_unlock(zram, index);
737+ /*
738+ * Return last IO error unless every IO were
739+ * not suceeded.
740+ */
741+ ret = err;
737742 continue;
738743 }
739744
drivers/char/hw_random/pseries-rng.c+1−2
@@ -54,10 +54,9 @@ static int pseries_rng_probe(struct vio_dev *dev, · 53 unmodified lines
5454 return hwrng_register(&pseries_rng);
5555 }
5656
57−static int pseries_rng_remove(struct vio_dev *dev)
57+static void pseries_rng_remove(struct vio_dev *dev)
5858 {
5959 hwrng_unregister(&pseries_rng);
60− return 0;
6160 }
6261
6362 static const struct vio_device_id pseries_rng_driver_ids[] = {
drivers/char/tpm/tpm_ibmvtpm.c+1−3
@@ -343,7 +343,7 @@ static int ibmvtpm_crq_send_init_complete(struct ibmvtpm_dev *ibmvtpm) · 342 unmodified lines
343343 *
344344 * Return: Always 0.
345345 */
346−static int tpm_ibmvtpm_remove(struct vio_dev *vdev)
346+static void tpm_ibmvtpm_remove(struct vio_dev *vdev)
347347 {
348348 struct tpm_chip *chip = dev_get_drvdata(&vdev->dev);
349349 struct ibmvtpm_dev *ibmvtpm = dev_get_drvdata(&chip->dev);
@@ -372,8 +372,6 @@ static int tpm_ibmvtpm_remove(struct vio_dev *vdev) · 22 unmodified lines
372372 kfree(ibmvtpm);
373373 /* For tpm_ibmvtpm_get_desired_dma */
374374 dev_set_drvdata(&vdev->dev, NULL);
375−
376− return 0;
377375 }
378376
379377 /**
drivers/cpufreq/cpufreq-dt-platdev.c+2−0
@@ -103,6 +103,8 @@ static const struct of_device_id whitelist[] __initconst = { · 102 unmodified lines
103103 static const struct of_device_id blacklist[] __initconst = {
104104 { .compatible = "allwinner,sun50i-h6", },
105105
106+ { .compatible = "arm,vexpress", },
107+
106108 { .compatible = "calxeda,highbank", },
107109 { .compatible = "calxeda,ecx-2000", },
108110
drivers/cpufreq/qcom-cpufreq-hw.c+3−3
@@ -317,9 +317,9 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy) · 316 unmodified lines
317317 }
318318
319319 base = ioremap(res->start, resource_size(res));
320− if (IS_ERR(base)) {
320+ if (!base) {
321321 dev_err(dev, "failed to map resource %pR\n", res);
322− ret = PTR_ERR(base);
322+ ret = -ENOMEM;
323323 goto release_region;
324324 }
325325
@@ -374,7 +374,7 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy) · 48 unmodified lines
374374 error:
375375 kfree(data);
376376 unmap_base:
377− iounmap(data->base);
377+ iounmap(base);
378378 release_region:
379379 release_mem_region(res->start, resource_size(res));
380380 return ret;
drivers/crypto/nx/nx-842-pseries.c+1−3
@@ -1042,7 +1042,7 @@ error: · 1041 unmodified lines
10421042 return ret;
10431043 }
10441044
1045−static int nx842_remove(struct vio_dev *viodev)
1045+static void nx842_remove(struct vio_dev *viodev)
10461046 {
10471047 struct nx842_devdata *old_devdata;
10481048 unsigned long flags;
@@ -1063,8 +1063,6 @@ static int nx842_remove(struct vio_dev *viodev) · 14 unmodified lines
10631063 if (old_devdata)
10641064 kfree(old_devdata->counters);
10651065 kfree(old_devdata);
1066−
1067− return 0;
10681066 }
10691067
10701068 static const struct vio_device_id nx842_vio_driver_ids[] = {
drivers/crypto/nx/nx.c+1−3
@@ -783,7 +783,7 @@ static int nx_probe(struct vio_dev *viodev, const struct vio_device_id *id) · 782 unmodified lines
783783 return nx_register_algs();
784784 }
785785
786−static int nx_remove(struct vio_dev *viodev)
786+static void nx_remove(struct vio_dev *viodev)
787787 {
788788 dev_dbg(&viodev->dev, "entering nx_remove for UA 0x%x\n",
789789 viodev->unit_address);
@@ -811,8 +811,6 @@ static int nx_remove(struct vio_dev *viodev) · 21 unmodified lines
811811 nx_unregister_skcipher(&nx_ecb_aes_alg, NX_FC_AES,
812812 NX_MODE_AES_ECB);
813813 }
814−
815− return 0;
816814 }
817815
818816
drivers/firmware/efi/libstub/arm64-stub.c+1−1
@@ -24,7 +24,7 @@ efi_status_t check_platform_features(void) · 23 unmodified lines
2424 return EFI_SUCCESS;
2525
2626 tg = (read_cpuid(ID_AA64MMFR0_EL1) >> ID_AA64MMFR0_TGRAN_SHIFT) & 0xf;
27− if (tg != ID_AA64MMFR0_TGRAN_SUPPORTED) {
27+ if (tg < ID_AA64MMFR0_TGRAN_SUPPORTED_MIN || tg > ID_AA64MMFR0_TGRAN_SUPPORTED_MAX) {
2828 if (IS_ENABLED(CONFIG_ARM64_64K_PAGES))
2929 efi_err("This 64 KB granular kernel is not supported by your CPU\n");
3030 else
drivers/firmware/efi/libstub/efi-stub.c+16−0
@@ -96,6 +96,18 @@ static void install_memreserve_table(void) · 95 unmodified lines
9696 efi_err("Failed to install memreserve config table!\n");
9797 }
9898
99+static u32 get_supported_rt_services(void)
100+{
101+ const efi_rt_properties_table_t *rt_prop_table;
102+ u32 supported = EFI_RT_SUPPORTED_ALL;
103+
104+ rt_prop_table = get_efi_config_table(EFI_RT_PROPERTIES_TABLE_GUID);
105+ if (rt_prop_table)
106+ supported &= rt_prop_table->runtime_services_supported;
107+
108+ return supported;
109+}
110+
99111 /*
100112 * EFI entry point for the arm/arm64 EFI stubs. This is the entrypoint
101113 * that is described in the PE/COFF header. Most of the code is the same
@@ -250,6 +262,10 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle, · 148 unmodified lines
250262 (prop_tbl->memory_protection_attribute &
251263 EFI_PROPERTIES_RUNTIME_MEMORY_PROTECTION_NON_EXECUTABLE_PE_DATA);
252264
265+ /* force efi_novamap if SetVirtualAddressMap() is unsupported */
266+ efi_novamap |= !(get_supported_rt_services() &
267+ EFI_RT_SUPPORTED_SET_VIRTUAL_ADDRESS_MAP);
268+
253269 /* hibernation expects the runtime regions to stay in the same place */
254270 if (!IS_ENABLED(CONFIG_HIBERNATION) && !efi_nokaslr && !flat_va_mapping) {
255271 /*
drivers/gpio/gpio-pca953x.c+23−55
@@ -113,8 +113,29 @@ MODULE_DEVICE_TABLE(i2c, pca953x_id); · 112 unmodified lines
113113 #ifdef CONFIG_GPIO_PCA953X_IRQ
114114
115115 #include <linux/dmi.h>
116−#include <linux/gpio.h>
117−#include <linux/list.h>
116+
117+static const struct acpi_gpio_params pca953x_irq_gpios = { 0, 0, true };
118+
119+static const struct acpi_gpio_mapping pca953x_acpi_irq_gpios[] = {
120+ { "irq-gpios", &pca953x_irq_gpios, 1, ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER },
121+ { }
122+};
123+
124+static int pca953x_acpi_get_irq(struct device *dev)
125+{
126+ int ret;
127+
128+ ret = devm_acpi_dev_add_driver_gpios(dev, pca953x_acpi_irq_gpios);
129+ if (ret)
130+ dev_warn(dev, "can't add GPIO ACPI mapping\n");
131+
132+ ret = acpi_dev_gpio_irq_get_by(ACPI_COMPANION(dev), "irq-gpios", 0);
133+ if (ret < 0)
134+ return ret;
135+
136+ dev_info(dev, "ACPI interrupt quirk (IRQ %d)\n", ret);
137+ return ret;
138+}
118139
119140 static const struct dmi_system_id pca953x_dmi_acpi_irq_info[] = {
120141 {
@@ -133,59 +154,6 @@ static const struct dmi_system_id pca953x_dmi_acpi_irq_info[] = { · 12 unmodified lines
133154 },
134155 {}
135156 };
136−
137−#ifdef CONFIG_ACPI
138−static int pca953x_acpi_get_pin(struct acpi_resource *ares, void *data)
139−{
140− struct acpi_resource_gpio *agpio;
141− int *pin = data;
142−
143− if (acpi_gpio_get_irq_resource(ares, &agpio))
144− *pin = agpio->pin_table[0];
145− return 1;
146−}
147−
148−static int pca953x_acpi_find_pin(struct device *dev)
149−{
150− struct acpi_device *adev = ACPI_COMPANION(dev);
151− int pin = -ENOENT, ret;
152− LIST_HEAD(r);
153−
154− ret = acpi_dev_get_resources(adev, &r, pca953x_acpi_get_pin, &pin);
155− acpi_dev_free_resource_list(&r);
156− if (ret < 0)
157− return ret;
158−
159− return pin;
160−}
161−#else
162−static inline int pca953x_acpi_find_pin(struct device *dev) { return -ENXIO; }
163−#endif
164−
165−static int pca953x_acpi_get_irq(struct device *dev)
166−{
167− int pin, ret;
168−
169− pin = pca953x_acpi_find_pin(dev);
170− if (pin < 0)
171− return pin;
172−
173− dev_info(dev, "Applying ACPI interrupt quirk (GPIO %d)\n", pin);
174−
175− if (!gpio_is_valid(pin))
176− return -EINVAL;
177−
178− ret = gpio_request(pin, "pca953x interrupt");
179− if (ret)
180− return ret;
181−
182− ret = gpio_to_irq(pin);
183−
184− /* When pin is used as an IRQ, no need to keep it requested */
185− gpio_free(pin);
186−
187− return ret;
188−}
189157 #endif
190158
191159 static const struct acpi_device_id pca953x_acpi_ids[] = {
drivers/gpio/gpiolib-acpi.c+15−6
@@ -174,7 +174,7 @@ static void acpi_gpiochip_request_irq(struct acpi_gpio_chip *acpi_gpio, · 173 unmodified lines
174174 int ret, value;
175175
176176 ret = request_threaded_irq(event->irq, NULL, event->handler,
177− event->irqflags, "ACPI:Event", event);
177+ event->irqflags | IRQF_ONESHOT, "ACPI:Event", event);
178178 if (ret) {
179179 dev_err(acpi_gpio->chip->parent,
180180 "Failed to setup interrupt handler for %d\n",
@@ -677,6 +677,7 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data) · 496 unmodified lines
677677 if (!lookup->desc) {
678678 const struct acpi_resource_gpio *agpio = &ares->data.gpio;
679679 bool gpioint = agpio->connection_type == ACPI_RESOURCE_GPIO_TYPE_INT;
680+ struct gpio_desc *desc;
680681 u16 pin_index;
681682
682683 if (lookup->info.quirks & ACPI_GPIO_QUIRK_ONLY_GPIOIO && gpioint)
@@ -689,8 +690,12 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data) · 6 unmodified lines
689690 if (pin_index >= agpio->pin_table_length)
690691 return 1;
691692
692− lookup->desc = acpi_get_gpiod(agpio->resource_source.string_ptr,
693+ if (lookup->info.quirks & ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER)
694+ desc = gpio_to_desc(agpio->pin_table[pin_index]);
695+ else
696+ desc = acpi_get_gpiod(agpio->resource_source.string_ptr,
693697 agpio->pin_table[pin_index]);
698+ lookup->desc = desc;
694699 lookup->info.pin_config = agpio->pin_config;
695700 lookup->info.debounce = agpio->debounce_timeout;
696701 lookup->info.gpioint = gpioint;
@@ -940,8 +945,9 @@ struct gpio_desc *acpi_node_get_gpiod(struct fwnode_handle *fwnode, · 243 unmodified lines
940945 }
941946
942947 /**
943− * acpi_dev_gpio_irq_get() - Find GpioInt and translate it to Linux IRQ number
948+ * acpi_dev_gpio_irq_get_by() - Find GpioInt and translate it to Linux IRQ number
944949 * @adev: pointer to a ACPI device to get IRQ from
950+ * @name: optional name of GpioInt resource
945951 * @index: index of GpioInt resource (starting from %0)
946952 *
947953 * If the device has one or more GpioInt resources, this function can be
@@ -951,9 +957,12 @@ struct gpio_desc *acpi_node_get_gpiod(struct fwnode_handle *fwnode, · 3 unmodified lines
951957 * The function is idempotent, though each time it runs it will configure GPIO
952958 * pin direction according to the flags in GpioInt resource.
953959 *
960+ * The function takes optional @name parameter. If the resource has a property
961+ * name, then only those will be taken into account.
962+ *
954963 * Return: Linux IRQ number (> %0) on success, negative errno on failure.
955964 */
956−int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index)
965+int acpi_dev_gpio_irq_get_by(struct acpi_device *adev, const char *name, int index)
957966 {
958967 int idx, i;
959968 unsigned int irq_flags;
@@ -963,7 +972,7 @@ int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index) · 3 unmodified lines
963972 struct acpi_gpio_info info;
964973 struct gpio_desc *desc;
965974
966− desc = acpi_get_gpiod_by_index(adev, NULL, i, &info);
975+ desc = acpi_get_gpiod_by_index(adev, name, i, &info);
967976
968977 /* Ignore -EPROBE_DEFER, it only matters if idx matches */
969978 if (IS_ERR(desc) && PTR_ERR(desc) != -EPROBE_DEFER)
@@ -1008,7 +1017,7 @@ int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index) · 38 unmodified lines
10081017 }
10091018 return -ENOENT;
10101019 }
1011−EXPORT_SYMBOL_GPL(acpi_dev_gpio_irq_get);
1020+EXPORT_SYMBOL_GPL(acpi_dev_gpio_irq_get_by);
10121021
10131022 static acpi_status
10141023 acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address,
drivers/gpio/gpiolib.c+9−10
@@ -367,22 +367,18 @@ static int gpiochip_set_desc_names(struct gpio_chip *gc) · 366 unmodified lines
367367 *
368368 * Looks for device property "gpio-line-names" and if it exists assigns
369369 * GPIO line names for the chip. The memory allocated for the assigned
370− * names belong to the underlying software node and should not be released
370+ * names belong to the underlying firmware node and should not be released
371371 * by the caller.
372372 */
373373 static int devprop_gpiochip_set_names(struct gpio_chip *chip)
374374 {
375375 struct gpio_device *gdev = chip->gpiodev;
376− struct device *dev = chip->parent;
376+ struct fwnode_handle *fwnode = dev_fwnode(&gdev->dev);
377377 const char **names;
378378 int ret, i;
379379 int count;
380380
381− /* GPIO chip may not have a parent device whose properties we inspect. */
382− if (!dev)
383− return 0;
384−
385− count = device_property_string_array_count(dev, "gpio-line-names");
381+ count = fwnode_property_string_array_count(fwnode, "gpio-line-names");
386382 if (count < 0)
387383 return 0;
388384
@@ -396,7 +392,7 @@ static int devprop_gpiochip_set_names(struct gpio_chip *chip) · 7 unmodified lines
396392 if (!names)
397393 return -ENOMEM;
398394
399− ret = device_property_read_string_array(dev, "gpio-line-names",
395+ ret = fwnode_property_read_string_array(fwnode, "gpio-line-names",
400396 names, count);
401397 if (ret < 0) {
402398 dev_warn(&gdev->dev, "failed to read GPIO line names\n");
@@ -474,9 +470,13 @@ EXPORT_SYMBOL_GPL(gpiochip_line_is_valid); · 71 unmodified lines
474470
475471 static void gpiodevice_release(struct device *dev)
476472 {
477− struct gpio_device *gdev = dev_get_drvdata(dev);
473+ struct gpio_device *gdev = container_of(dev, struct gpio_device, dev);
474+ unsigned long flags;
478475
476+ spin_lock_irqsave(&gpio_lock, flags);
479477 list_del(&gdev->list);
478+ spin_unlock_irqrestore(&gpio_lock, flags);
479+
480480 ida_free(&gpio_ida, gdev->id);
481481 kfree_const(gdev->label);
482482 kfree(gdev->descs);
@@ -605,7 +605,6 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data, · 122 unmodified lines
605605 goto err_free_ida;
606606
607607 device_initialize(&gdev->dev);
608− dev_set_drvdata(&gdev->dev, gdev);
609608 if (gc->parent && gc->parent->driver)
610609 gdev->owner = gc->parent->driver->owner;
611610 else if (gc->owner)
drivers/gpu/drm/Kconfig+1−0
@@ -228,6 +228,7 @@ source "drivers/gpu/drm/arm/Kconfig" · 227 unmodified lines
228228 config DRM_RADEON
229229 tristate "ATI Radeon"
230230 depends on DRM && PCI && MMU
231+ depends on AGP || !AGP
231232 select FW_LOADER
232233 select DRM_KMS_HELPER
233234 select DRM_TTM
drivers/gpu/drm/amd/amdgpu/amdgpu.h+1−0
@@ -180,6 +180,7 @@ extern uint amdgpu_smu_memory_pool_size; · 179 unmodified lines
180180 extern uint amdgpu_dc_feature_mask;
181181 extern uint amdgpu_dc_debug_mask;
182182 extern uint amdgpu_dm_abm_level;
183+extern int amdgpu_backlight;
183184 extern struct amdgpu_mgpu_info mgpu_info;
184185 extern int amdgpu_ras_enable;
185186 extern uint amdgpu_ras_mask;
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c+1−1
@@ -903,7 +903,7 @@ void amdgpu_acpi_fini(struct amdgpu_device *adev) · 902 unmodified lines
903903 */
904904 bool amdgpu_acpi_is_s0ix_supported(struct amdgpu_device *adev)
905905 {
906−#if defined(CONFIG_AMD_PMC)
906+#if defined(CONFIG_AMD_PMC) || defined(CONFIG_AMD_PMC_MODULE)
907907 if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) {
908908 if (adev->flags & AMD_IS_APU)
909909 return true;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c+4−0
@@ -781,6 +781,10 @@ uint amdgpu_dm_abm_level; · 780 unmodified lines
781781 MODULE_PARM_DESC(abmlevel, "ABM level (0 = off (default), 1-4 = backlight reduction level) ");
782782 module_param_named(abmlevel, amdgpu_dm_abm_level, uint, 0444);
783783
784+int amdgpu_backlight = -1;
785+MODULE_PARM_DESC(backlight, "Backlight control (0 = pwm, 1 = aux, -1 auto (default))");
786+module_param_named(backlight, amdgpu_backlight, bint, 0444);
787+
784788 /**
785789 * DOC: tmz (int)
786790 * Trusted Memory Zone (TMZ) is a method to protect data being written
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c+1−1
@@ -146,7 +146,7 @@ static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev, · 145 unmodified lines
146146 size = mode_cmd->pitches[0] * height;
147147 aligned_size = ALIGN(size, PAGE_SIZE);
148148 ret = amdgpu_gem_object_create(adev, aligned_size, 0, domain, flags,
149− ttm_bo_type_kernel, NULL, &gobj);
149+ ttm_bo_type_device, NULL, &gobj);
150150 if (ret) {
151151 pr_err("failed to allocate framebuffer (%d)\n", aligned_size);
152152 return -ENOMEM;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c+30−20
@@ -2267,6 +2267,11 @@ static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnector) · 2266 unmodified lines
22672267 caps->ext_caps->bits.hdr_aux_backlight_control == 1)
22682268 caps->aux_support = true;
22692269
2270+ if (amdgpu_backlight == 0)
2271+ caps->aux_support = false;
2272+ else if (amdgpu_backlight == 1)
2273+ caps->aux_support = true;
2274+
22702275 /* From the specification (CTA-861-G), for calculating the maximum
22712276 * luminance we need to use:
22722277 * Luminance = 50*2**(CV/32)
@@ -3185,19 +3190,6 @@ static void amdgpu_dm_update_backlight_caps(struct amdgpu_display_manager *dm) · 912 unmodified lines
31853190 #endif
31863191 }
31873192
3188−static int set_backlight_via_aux(struct dc_link *link, uint32_t brightness)
3189−{
3190− bool rc;
3191−
3192− if (!link)
3193− return 1;
3194−
3195− rc = dc_link_set_backlight_level_nits(link, true, brightness,
3196− AUX_BL_DEFAULT_TRANSITION_TIME_MS);
3197−
3198− return rc ? 0 : 1;
3199−}
3200−
32013193 static int get_brightness_range(const struct amdgpu_dm_backlight_caps *caps,
32023194 unsigned *min, unsigned *max)
32033195 {
@@ -3260,9 +3252,10 @@ static int amdgpu_dm_backlight_update_status(struct backlight_device *bd) · 56 unmodified lines
32603252 brightness = convert_brightness_from_user(&caps, bd->props.brightness);
32613253 // Change brightness based on AUX property
32623254 if (caps.aux_support)
3263− return set_backlight_via_aux(link, brightness);
3264−
3265− rc = dc_link_set_backlight_level(dm->backlight_link, brightness, 0);
3255+ rc = dc_link_set_backlight_level_nits(link, true, brightness,
3256+ AUX_BL_DEFAULT_TRANSITION_TIME_MS);
3257+ else
3258+ rc = dc_link_set_backlight_level(dm->backlight_link, brightness, 0);
32663259
32673260 return rc ? 0 : 1;
32683261 }
@@ -3270,11 +3263,27 @@ static int amdgpu_dm_backlight_update_status(struct backlight_device *bd) · 1 unmodified line
32703263 static int amdgpu_dm_backlight_get_brightness(struct backlight_device *bd)
32713264 {
32723265 struct amdgpu_display_manager *dm = bl_get_data(bd);
3273− int ret = dc_link_get_backlight_level(dm->backlight_link);
3266+ struct amdgpu_dm_backlight_caps caps;
3267+
3268+ amdgpu_dm_update_backlight_caps(dm);
3269+ caps = dm->backlight_caps;
3270+
3271+ if (caps.aux_support) {
3272+ struct dc_link *link = (struct dc_link *)dm->backlight_link;
3273+ u32 avg, peak;
3274+ bool rc;
32743275
3275− if (ret == DC_ERROR_UNEXPECTED)
3276− return bd->props.brightness;
3277− return convert_brightness_to_user(&dm->backlight_caps, ret);
3276+ rc = dc_link_get_backlight_level_nits(link, &avg, &peak);
3277+ if (!rc)
3278+ return bd->props.brightness;
3279+ return convert_brightness_to_user(&caps, avg);
3280+ } else {
3281+ int ret = dc_link_get_backlight_level(dm->backlight_link);
3282+
3283+ if (ret == DC_ERROR_UNEXPECTED)
3284+ return bd->props.brightness;
3285+ return convert_brightness_to_user(&caps, ret);
3286+ }
32783287 }
32793288
32803289 static const struct backlight_ops amdgpu_dm_backlight_ops = {
@@ -4716,6 +4725,7 @@ static int fill_dc_plane_attributes(struct amdgpu_device *adev, · 1435 unmodified lines
47164725 dc_plane_state->global_alpha_value = plane_info.global_alpha_value;
47174726 dc_plane_state->dcc = plane_info.dcc;
47184727 dc_plane_state->layer_index = plane_info.layer_index; // Always returns 0
4728+ dc_plane_state->flip_int_enabled = true;
47194729
47204730 /*
47214731 * Always set input transfer function, since plane state is refreshed
drivers/gpu/drm/amd/display/dc/core/dc_link.c+0−1
@@ -2602,7 +2602,6 @@ bool dc_link_set_backlight_level(const struct dc_link *link, · 2601 unmodified lines
26022602 if (pipe_ctx->plane_state == NULL)
26032603 frame_ramp = 0;
26042604 } else {
2605− ASSERT(false);
26062605 return false;
26072606 }
26082607
drivers/gpu/drm/amd/display/dc/dc.h+1−0
@@ -887,6 +887,7 @@ struct dc_plane_state { · 886 unmodified lines
887887 int layer_index;
888888
889889 union surface_update_flags update_flags;
890+ bool flip_int_enabled;
890891 /* private to DC core */
891892 struct dc_plane_status status;
892893 struct dc_context *ctx;
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c+11−0
@@ -1257,6 +1257,16 @@ void hubp1_soft_reset(struct hubp *hubp, bool reset) · 1256 unmodified lines
12571257 REG_UPDATE(DCHUBP_CNTL, HUBP_DISABLE, reset ? 1 : 0);
12581258 }
12591259
1260+void hubp1_set_flip_int(struct hubp *hubp)
1261+{
1262+ struct dcn10_hubp *hubp1 = TO_DCN10_HUBP(hubp);
1263+
1264+ REG_UPDATE(DCSURF_SURFACE_FLIP_INTERRUPT,
1265+ SURFACE_FLIP_INT_MASK, 1);
1266+
1267+ return;
1268+}
1269+
12601270 void hubp1_init(struct hubp *hubp)
12611271 {
12621272 //do nothing
@@ -1290,6 +1300,7 @@ static const struct hubp_funcs dcn10_hubp_funcs = { · 27 unmodified lines
12901300 .dmdata_load = NULL,
12911301 .hubp_soft_reset = hubp1_soft_reset,
12921302 .hubp_in_blank = hubp1_in_blank,
1303+ .hubp_set_flip_int = hubp1_set_flip_int,
12931304 };
12941305
12951306 /*****************************************/
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.h+6−0
@@ -74,6 +74,7 @@ · 73 unmodified lines
7474 SRI(DCSURF_SURFACE_EARLIEST_INUSE_C, HUBPREQ, id),\
7575 SRI(DCSURF_SURFACE_EARLIEST_INUSE_HIGH_C, HUBPREQ, id),\
7676 SRI(DCSURF_SURFACE_CONTROL, HUBPREQ, id),\
77+ SRI(DCSURF_SURFACE_FLIP_INTERRUPT, HUBPREQ, id),\
7778 SRI(HUBPRET_CONTROL, HUBPRET, id),\
7879 SRI(DCN_EXPANSION_MODE, HUBPREQ, id),\
7980 SRI(DCHUBP_REQ_SIZE_CONFIG, HUBP, id),\
@@ -183,6 +184,7 @@ · 103 unmodified lines
183184 uint32_t DCSURF_SURFACE_EARLIEST_INUSE_C; \
184185 uint32_t DCSURF_SURFACE_EARLIEST_INUSE_HIGH_C; \
185186 uint32_t DCSURF_SURFACE_CONTROL; \
187+ uint32_t DCSURF_SURFACE_FLIP_INTERRUPT; \
186188 uint32_t HUBPRET_CONTROL; \
187189 uint32_t DCN_EXPANSION_MODE; \
188190 uint32_t DCHUBP_REQ_SIZE_CONFIG; \
@@ -332,6 +334,7 @@ · 143 unmodified lines
332334 HUBP_SF(HUBPREQ0_DCSURF_SURFACE_CONTROL, SECONDARY_META_SURFACE_TMZ_C, mask_sh),\
333335 HUBP_SF(HUBPREQ0_DCSURF_SURFACE_CONTROL, SECONDARY_SURFACE_DCC_EN, mask_sh),\
334336 HUBP_SF(HUBPREQ0_DCSURF_SURFACE_CONTROL, SECONDARY_SURFACE_DCC_IND_64B_BLK, mask_sh),\
337+ HUBP_SF(HUBPREQ0_DCSURF_SURFACE_FLIP_INTERRUPT, SURFACE_FLIP_INT_MASK, mask_sh),\
335338 HUBP_SF(HUBPRET0_HUBPRET_CONTROL, DET_BUF_PLANE1_BASE_ADDRESS, mask_sh),\
336339 HUBP_SF(HUBPRET0_HUBPRET_CONTROL, CROSSBAR_SRC_CB_B, mask_sh),\
337340 HUBP_SF(HUBPRET0_HUBPRET_CONTROL, CROSSBAR_SRC_CR_R, mask_sh),\
@@ -531,6 +534,7 @@ · 193 unmodified lines
531534 type PRIMARY_SURFACE_DCC_IND_64B_BLK;\
532535 type SECONDARY_SURFACE_DCC_EN;\
533536 type SECONDARY_SURFACE_DCC_IND_64B_BLK;\
537+ type SURFACE_FLIP_INT_MASK;\
534538 type DET_BUF_PLANE1_BASE_ADDRESS;\
535539 type CROSSBAR_SRC_CB_B;\
536540 type CROSSBAR_SRC_CR_R;\
@@ -777,4 +781,6 @@ void hubp1_read_state_common(struct hubp *hubp); · 240 unmodified lines
777781 bool hubp1_in_blank(struct hubp *hubp);
778782 void hubp1_soft_reset(struct hubp *hubp, bool reset);
779783
784+void hubp1_set_flip_int(struct hubp *hubp);
785+
780786 #endif
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c+7−0
@@ -2196,6 +2196,13 @@ static void dcn10_enable_plane( · 2195 unmodified lines
21962196 if (dc->debug.sanity_checks) {
21972197 hws->funcs.verify_allow_pstate_change_high(dc);
21982198 }
2199+
2200+ if (!pipe_ctx->top_pipe
2201+ && pipe_ctx->plane_state
2202+ && pipe_ctx->plane_state->flip_int_enabled
2203+ && pipe_ctx->plane_res.hubp->funcs->hubp_set_flip_int)
2204+ pipe_ctx->plane_res.hubp->funcs->hubp_set_flip_int(pipe_ctx->plane_res.hubp);
2205+
21992206 }
22002207
22012208 void dcn10_program_gamut_remap(struct pipe_ctx *pipe_ctx)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hubp.c+1−0
@@ -1597,6 +1597,7 @@ static struct hubp_funcs dcn20_hubp_funcs = { · 1596 unmodified lines
15971597 .validate_dml_output = hubp2_validate_dml_output,
15981598 .hubp_in_blank = hubp1_in_blank,
15991599 .hubp_soft_reset = hubp1_soft_reset,
1600+ .hubp_set_flip_int = hubp1_set_flip_int,
16001601 };
16011602
16021603
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c+6−0
@@ -1146,6 +1146,12 @@ void dcn20_enable_plane( · 1145 unmodified lines
11461146 pipe_ctx->plane_res.hubp->funcs->hubp_set_vm_system_aperture_settings(pipe_ctx->plane_res.hubp, &apt);
11471147 }
11481148
1149+ if (!pipe_ctx->top_pipe
1150+ && pipe_ctx->plane_state
1151+ && pipe_ctx->plane_state->flip_int_enabled
1152+ && pipe_ctx->plane_res.hubp->funcs->hubp_set_flip_int)
1153+ pipe_ctx->plane_res.hubp->funcs->hubp_set_flip_int(pipe_ctx->plane_res.hubp);
1154+
11491155 // if (dc->debug.sanity_checks) {
11501156 // dcn10_verify_allow_pstate_change_high(dc);
11511157 // }
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_hubp.c+1−0
@@ -838,6 +838,7 @@ static struct hubp_funcs dcn21_hubp_funcs = { · 837 unmodified lines
838838 .hubp_set_flip_control_surface_gsl = hubp2_set_flip_control_surface_gsl,
839839 .hubp_init = hubp21_init,
840840 .validate_dml_output = hubp21_validate_dml_output,
841+ .hubp_set_flip_int = hubp1_set_flip_int,
841842 };
842843
843844 bool hubp21_construct(
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c+2−6
@@ -296,7 +296,7 @@ struct _vcs_dpi_soc_bounding_box_st dcn2_1_soc = { · 295 unmodified lines
296296 .num_banks = 8,
297297 .num_chans = 4,
298298 .vmm_page_size_bytes = 4096,
299− .dram_clock_change_latency_us = 11.72,
299+ .dram_clock_change_latency_us = 23.84,
300300 .return_bus_width_bytes = 64,
301301 .dispclk_dppclk_vco_speed_mhz = 3600,
302302 .xfc_bus_transport_time_us = 4,
@@ -1062,8 +1062,6 @@ static void patch_bounding_box(struct dc *dc, struct _vcs_dpi_soc_bounding_box_s · 759 unmodified lines
10621062 {
10631063 int i;
10641064
1065− DC_FP_START();
1066−
10671065 if (dc->bb_overrides.sr_exit_time_ns) {
10681066 for (i = 0; i < WM_SET_COUNT; i++) {
10691067 dc->clk_mgr->bw_params->wm_table.entries[i].sr_exit_time_us =
@@ -1088,8 +1086,6 @@ static void patch_bounding_box(struct dc *dc, struct _vcs_dpi_soc_bounding_box_s · 18 unmodified lines
10881086 dc->bb_overrides.dram_clock_change_latency_ns / 1000.0;
10891087 }
10901088 }
1091−
1092− DC_FP_END();
10931089 }
10941090
10951091 void dcn21_calculate_wm(
@@ -1339,7 +1335,7 @@ static noinline bool dcn21_validate_bandwidth_fp(struct dc *dc, · 243 unmodified lines
13391335 int vlevel = 0;
13401336 int pipe_split_from[MAX_PIPES];
13411337 int pipe_cnt = 0;
1342− display_e2e_pipe_params_st *pipes = kzalloc(dc->res_pool->pipe_count * sizeof(display_e2e_pipe_params_st), GFP_KERNEL);
1338+ display_e2e_pipe_params_st *pipes = kzalloc(dc->res_pool->pipe_count * sizeof(display_e2e_pipe_params_st), GFP_ATOMIC);
13431339 DC_LOGGER_INIT(dc->ctx->logger);
13441340
13451341 BW_VAL_TRACE_COUNT();
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hubp.c+1−0
@@ -511,6 +511,7 @@ static struct hubp_funcs dcn30_hubp_funcs = { · 510 unmodified lines
511511 .hubp_init = hubp3_init,
512512 .hubp_in_blank = hubp1_in_blank,
513513 .hubp_soft_reset = hubp1_soft_reset,
514+ .hubp_set_flip_int = hubp1_set_flip_int,
514515 };
515516
516517 bool hubp3_construct(
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c+31−0
@@ -2508,6 +2508,19 @@ static const struct resource_funcs dcn30_res_pool_funcs = { · 2507 unmodified lines
25082508 .patch_unknown_plane_state = dcn20_patch_unknown_plane_state,
25092509 };
25102510
2511+#define CTX ctx
2512+
2513+#define REG(reg_name) \
2514+ (DCN_BASE.instance[0].segment[mm ## reg_name ## _BASE_IDX] + mm ## reg_name)
2515+
2516+static uint32_t read_pipe_fuses(struct dc_context *ctx)
2517+{
2518+ uint32_t value = REG_READ(CC_DC_PIPE_DIS);
2519+ /* Support for max 6 pipes */
2520+ value = value & 0x3f;
2521+ return value;
2522+}
2523+
25112524 static bool dcn30_resource_construct(
25122525 uint8_t num_virtual_links,
25132526 struct dc *dc,
@@ -2517,6 +2530,15 @@ static bool dcn30_resource_construct( · 3 unmodified lines
25172530 struct dc_context *ctx = dc->ctx;
25182531 struct irq_service_init_data init_data;
25192532 struct ddc_service_init_data ddc_init_data;
2533+ uint32_t pipe_fuses = read_pipe_fuses(ctx);
2534+ uint32_t num_pipes = 0;
2535+
2536+ if (!(pipe_fuses == 0 || pipe_fuses == 0x3e)) {
2537+ BREAK_TO_DEBUGGER();
2538+ dm_error("DC: Unexpected fuse recipe for navi2x !\n");
2539+ /* fault to single pipe */
2540+ pipe_fuses = 0x3e;
2541+ }
25202542
25212543 DC_FP_START();
25222544
@@ -2650,6 +2672,15 @@ static bool dcn30_resource_construct( · 127 unmodified lines
26502672 /* PP Lib and SMU interfaces */
26512673 init_soc_bounding_box(dc, pool);
26522674
2675+ num_pipes = dcn3_0_ip.max_num_dpp;
2676+
2677+ for (i = 0; i < dcn3_0_ip.max_num_dpp; i++)
2678+ if (pipe_fuses & 1 << i)
2679+ num_pipes--;
2680+
2681+ dcn3_0_ip.max_num_dpp = num_pipes;
2682+ dcn3_0_ip.max_num_otg = num_pipes;
2683+
26532684 dml_init_instance(&dc->dml, &dcn3_0_soc, &dcn3_0_ip, DML_PROJECT_DCN30);
26542685
26552686 /* IRQ */
drivers/gpu/drm/amd/display/dc/dcn301/dcn301_resource.c+95−1
@@ -1619,12 +1619,106 @@ static void dcn301_update_bw_bounding_box(struct dc *dc, struct clk_bw_params *b · 1618 unmodified lines
16191619 dml_init_instance(&dc->dml, &dcn3_01_soc, &dcn3_01_ip, DML_PROJECT_DCN30);
16201620 }
16211621
1622+static void calculate_wm_set_for_vlevel(
1623+ int vlevel,
1624+ struct wm_range_table_entry *table_entry,
1625+ struct dcn_watermarks *wm_set,
1626+ struct display_mode_lib *dml,
1627+ display_e2e_pipe_params_st *pipes,
1628+ int pipe_cnt)
1629+{
1630+ double dram_clock_change_latency_cached = dml->soc.dram_clock_change_latency_us;
1631+
1632+ ASSERT(vlevel < dml->soc.num_states);
1633+ /* only pipe 0 is read for voltage and dcf/soc clocks */
1634+ pipes[0].clks_cfg.voltage = vlevel;
1635+ pipes[0].clks_cfg.dcfclk_mhz = dml->soc.clock_limits[vlevel].dcfclk_mhz;
1636+ pipes[0].clks_cfg.socclk_mhz = dml->soc.clock_limits[vlevel].socclk_mhz;
1637+
1638+ dml->soc.dram_clock_change_latency_us = table_entry->pstate_latency_us;
1639+ dml->soc.sr_exit_time_us = table_entry->sr_exit_time_us;
1640+ dml->soc.sr_enter_plus_exit_time_us = table_entry->sr_enter_plus_exit_time_us;
1641+
1642+ wm_set->urgent_ns = get_wm_urgent(dml, pipes, pipe_cnt) * 1000;
1643+ wm_set->cstate_pstate.cstate_enter_plus_exit_ns = get_wm_stutter_enter_exit(dml, pipes, pipe_cnt) * 1000;
1644+ wm_set->cstate_pstate.cstate_exit_ns = get_wm_stutter_exit(dml, pipes, pipe_cnt) * 1000;
1645+ wm_set->cstate_pstate.pstate_change_ns = get_wm_dram_clock_change(dml, pipes, pipe_cnt) * 1000;
1646+ wm_set->pte_meta_urgent_ns = get_wm_memory_trip(dml, pipes, pipe_cnt) * 1000;
1647+ wm_set->frac_urg_bw_nom = get_fraction_of_urgent_bandwidth(dml, pipes, pipe_cnt) * 1000;
1648+ wm_set->frac_urg_bw_flip = get_fraction_of_urgent_bandwidth_imm_flip(dml, pipes, pipe_cnt) * 1000;
1649+ wm_set->urgent_latency_ns = get_urgent_latency(dml, pipes, pipe_cnt) * 1000;
1650+ dml->soc.dram_clock_change_latency_us = dram_clock_change_latency_cached;
1651+
1652+}
1653+
1654+static void dcn301_calculate_wm_and_dlg(
1655+ struct dc *dc, struct dc_state *context,
1656+ display_e2e_pipe_params_st *pipes,
1657+ int pipe_cnt,
1658+ int vlevel_req)
1659+{
1660+ int i, pipe_idx;
1661+ int vlevel, vlevel_max;
1662+ struct wm_range_table_entry *table_entry;
1663+ struct clk_bw_params *bw_params = dc->clk_mgr->bw_params;
1664+
1665+ ASSERT(bw_params);
1666+
1667+ vlevel_max = bw_params->clk_table.num_entries - 1;
1668+
1669+ /* WM Set D */
1670+ table_entry = &bw_params->wm_table.entries[WM_D];
1671+ if (table_entry->wm_type == WM_TYPE_RETRAINING)
1672+ vlevel = 0;
1673+ else
1674+ vlevel = vlevel_max;
1675+ calculate_wm_set_for_vlevel(vlevel, table_entry, &context->bw_ctx.bw.dcn.watermarks.d,
1676+ &context->bw_ctx.dml, pipes, pipe_cnt);
1677+ /* WM Set C */
1678+ table_entry = &bw_params->wm_table.entries[WM_C];
1679+ vlevel = min(max(vlevel_req, 2), vlevel_max);
1680+ calculate_wm_set_for_vlevel(vlevel, table_entry, &context->bw_ctx.bw.dcn.watermarks.c,
1681+ &context->bw_ctx.dml, pipes, pipe_cnt);
1682+ /* WM Set B */
1683+ table_entry = &bw_params->wm_table.entries[WM_B];
1684+ vlevel = min(max(vlevel_req, 1), vlevel_max);
1685+ calculate_wm_set_for_vlevel(vlevel, table_entry, &context->bw_ctx.bw.dcn.watermarks.b,
1686+ &context->bw_ctx.dml, pipes, pipe_cnt);
1687+
1688+ /* WM Set A */
1689+ table_entry = &bw_params->wm_table.entries[WM_A];
1690+ vlevel = min(vlevel_req, vlevel_max);
1691+ calculate_wm_set_for_vlevel(vlevel, table_entry, &context->bw_ctx.bw.dcn.watermarks.a,
1692+ &context->bw_ctx.dml, pipes, pipe_cnt);
1693+
1694+ for (i = 0, pipe_idx = 0; i < dc->res_pool->pipe_count; i++) {
1695+ if (!context->res_ctx.pipe_ctx[i].stream)
1696+ continue;
1697+
1698+ pipes[pipe_idx].clks_cfg.dispclk_mhz = get_dispclk_calculated(&context->bw_ctx.dml, pipes, pipe_cnt);
1699+ pipes[pipe_idx].clks_cfg.dppclk_mhz = get_dppclk_calculated(&context->bw_ctx.dml, pipes, pipe_cnt, pipe_idx);
1700+
1701+ if (dc->config.forced_clocks) {
1702+ pipes[pipe_idx].clks_cfg.dispclk_mhz = context->bw_ctx.dml.soc.clock_limits[0].dispclk_mhz;
1703+ pipes[pipe_idx].clks_cfg.dppclk_mhz = context->bw_ctx.dml.soc.clock_limits[0].dppclk_mhz;
1704+ }
1705+ if (dc->debug.min_disp_clk_khz > pipes[pipe_idx].clks_cfg.dispclk_mhz * 1000)
1706+ pipes[pipe_idx].clks_cfg.dispclk_mhz = dc->debug.min_disp_clk_khz / 1000.0;
1707+ if (dc->debug.min_dpp_clk_khz > pipes[pipe_idx].clks_cfg.dppclk_mhz * 1000)
1708+ pipes[pipe_idx].clks_cfg.dppclk_mhz = dc->debug.min_dpp_clk_khz / 1000.0;
1709+
1710+ pipe_idx++;
1711+ }
1712+
1713+ dcn20_calculate_dlg_params(dc, context, pipes, pipe_cnt, vlevel);
1714+}
1715+
16221716 static struct resource_funcs dcn301_res_pool_funcs = {
16231717 .destroy = dcn301_destroy_resource_pool,
16241718 .link_enc_create = dcn301_link_encoder_create,
16251719 .panel_cntl_create = dcn301_panel_cntl_create,
16261720 .validate_bandwidth = dcn30_validate_bandwidth,
1627− .calculate_wm_and_dlg = dcn30_calculate_wm_and_dlg,
1721+ .calculate_wm_and_dlg = dcn301_calculate_wm_and_dlg,
16281722 .populate_dml_pipes = dcn30_populate_dml_pipes_from_context,
16291723 .acquire_idle_pipe_for_layer = dcn20_acquire_idle_pipe_for_layer,
16301724 .add_stream_to_ctx = dcn30_add_stream_to_ctx,
drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h+2−0
@@ -191,6 +191,8 @@ struct hubp_funcs { · 190 unmodified lines
191191 bool (*hubp_in_blank)(struct hubp *hubp);
192192 void (*hubp_soft_reset)(struct hubp *hubp, bool reset);
193193
194+ void (*hubp_set_flip_int)(struct hubp *hubp);
195+
194196 };
195197
196198 #endif
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c+4−4
@@ -5216,10 +5216,10 @@ static int smu7_set_watermarks_for_clocks_ranges(struct pp_hwmgr *hwmgr, · 5215 unmodified lines
52165216 for (j = 0; j < dep_sclk_table->count; j++) {
52175217 valid_entry = false;
52185218 for (k = 0; k < watermarks->num_wm_sets; k++) {
5219− if (dep_sclk_table->entries[i].clk / 10 >= watermarks->wm_clk_ranges[k].wm_min_eng_clk_in_khz &&
5220− dep_sclk_table->entries[i].clk / 10 < watermarks->wm_clk_ranges[k].wm_max_eng_clk_in_khz &&
5221− dep_mclk_table->entries[i].clk / 10 >= watermarks->wm_clk_ranges[k].wm_min_mem_clk_in_khz &&
5222− dep_mclk_table->entries[i].clk / 10 < watermarks->wm_clk_ranges[k].wm_max_mem_clk_in_khz) {
5219+ if (dep_sclk_table->entries[i].clk >= watermarks->wm_clk_ranges[k].wm_min_eng_clk_in_khz / 10 &&
5220+ dep_sclk_table->entries[i].clk < watermarks->wm_clk_ranges[k].wm_max_eng_clk_in_khz / 10 &&
5221+ dep_mclk_table->entries[i].clk >= watermarks->wm_clk_ranges[k].wm_min_mem_clk_in_khz / 10 &&
5222+ dep_mclk_table->entries[i].clk < watermarks->wm_clk_ranges[k].wm_max_mem_clk_in_khz / 10) {
52235223 valid_entry = true;
52245224 table->DisplayWatermark[i][j] = watermarks->wm_clk_ranges[k].wm_set_id;
52255225 break;
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c+48−0
@@ -1505,6 +1505,48 @@ static int vega10_populate_single_lclk_level(struct pp_hwmgr *hwmgr, · 1504 unmodified lines
15051505 return 0;
15061506 }
15071507
1508+static int vega10_override_pcie_parameters(struct pp_hwmgr *hwmgr)
1509+{
1510+ struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev);
1511+ struct vega10_hwmgr *data =
1512+ (struct vega10_hwmgr *)(hwmgr->backend);
1513+ uint32_t pcie_gen = 0, pcie_width = 0;
1514+ PPTable_t *pp_table = &(data->smc_state_table.pp_table);
1515+ int i;
1516+
1517+ if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN4)
1518+ pcie_gen = 3;
1519+ else if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3)
1520+ pcie_gen = 2;
1521+ else if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN2)
1522+ pcie_gen = 1;
1523+ else if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN1)
1524+ pcie_gen = 0;
1525+
1526+ if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X16)
1527+ pcie_width = 6;
1528+ else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X12)
1529+ pcie_width = 5;
1530+ else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X8)
1531+ pcie_width = 4;
1532+ else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X4)
1533+ pcie_width = 3;
1534+ else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X2)
1535+ pcie_width = 2;
1536+ else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X1)
1537+ pcie_width = 1;
1538+
1539+ for (i = 0; i < NUM_LINK_LEVELS; i++) {
1540+ if (pp_table->PcieGenSpeed[i] > pcie_gen)
1541+ pp_table->PcieGenSpeed[i] = pcie_gen;
1542+
1543+ if (pp_table->PcieLaneCount[i] > pcie_width)
1544+ pp_table->PcieLaneCount[i] = pcie_width;
1545+ }
1546+
1547+ return 0;
1548+}
1549+
15081550 static int vega10_populate_smc_link_levels(struct pp_hwmgr *hwmgr)
15091551 {
15101552 int result = -1;
@@ -2556,6 +2598,11 @@ static int vega10_init_smc_table(struct pp_hwmgr *hwmgr) · 1045 unmodified lines
25562598 "Failed to initialize Link Level!",
25572599 return result);
25582600
2601+ result = vega10_override_pcie_parameters(hwmgr);
2602+ PP_ASSERT_WITH_CODE(!result,
2603+ "Failed to override pcie parameters!",
2604+ return result);
2605+
25592606 result = vega10_populate_all_graphic_levels(hwmgr);
25602607 PP_ASSERT_WITH_CODE(!result,
25612608 "Failed to initialize Graphics Level!",
@@ -2922,6 +2969,7 @@ static int vega10_start_dpm(struct pp_hwmgr *hwmgr, uint32_t bitmap) · 360 unmodified lines
29222969 return 0;
29232970 }
29242971
2972+
29252973 static int vega10_enable_disable_PCC_limit_feature(struct pp_hwmgr *hwmgr, bool enable)
29262974 {
29272975 struct vega10_hwmgr *data = hwmgr->backend;
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_hwmgr.c+66−0
@@ -481,6 +481,67 @@ static void vega12_init_dpm_state(struct vega12_dpm_state *dpm_state) · 480 unmodified lines
481481 dpm_state->hard_max_level = 0xffff;
482482 }
483483
484+static int vega12_override_pcie_parameters(struct pp_hwmgr *hwmgr)
485+{
486+ struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev);
487+ struct vega12_hwmgr *data =
488+ (struct vega12_hwmgr *)(hwmgr->backend);
489+ uint32_t pcie_gen = 0, pcie_width = 0, smu_pcie_arg, pcie_gen_arg, pcie_width_arg;
490+ PPTable_t *pp_table = &(data->smc_state_table.pp_table);
491+ int i;
492+ int ret;
493+
494+ if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN4)
495+ pcie_gen = 3;
496+ else if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3)
497+ pcie_gen = 2;
498+ else if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN2)
499+ pcie_gen = 1;
500+ else if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN1)
501+ pcie_gen = 0;
502+
503+ if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X16)
504+ pcie_width = 6;
505+ else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X12)
506+ pcie_width = 5;
507+ else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X8)
508+ pcie_width = 4;
509+ else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X4)
510+ pcie_width = 3;
511+ else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X2)
512+ pcie_width = 2;
513+ else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X1)
514+ pcie_width = 1;
515+
516+ /* Bit 31:16: LCLK DPM level. 0 is DPM0, and 1 is DPM1
517+ * Bit 15:8: PCIE GEN, 0 to 3 corresponds to GEN1 to GEN4
518+ * Bit 7:0: PCIE lane width, 1 to 7 corresponds is x1 to x32
519+ */
520+ for (i = 0; i < NUM_LINK_LEVELS; i++) {
521+ pcie_gen_arg = (pp_table->PcieGenSpeed[i] > pcie_gen) ? pcie_gen :
522+ pp_table->PcieGenSpeed[i];
523+ pcie_width_arg = (pp_table->PcieLaneCount[i] > pcie_width) ? pcie_width :
524+ pp_table->PcieLaneCount[i];
525+
526+ if (pcie_gen_arg != pp_table->PcieGenSpeed[i] || pcie_width_arg !=
527+ pp_table->PcieLaneCount[i]) {
528+ smu_pcie_arg = (i << 16) | (pcie_gen_arg << 8) | pcie_width_arg;
529+ ret = smum_send_msg_to_smc_with_parameter(hwmgr,
530+ PPSMC_MSG_OverridePcieParameters, smu_pcie_arg,
531+ NULL);
532+ PP_ASSERT_WITH_CODE(!ret,
533+ "[OverridePcieParameters] Attempt to override pcie params failed!",
534+ return ret);
535+ }
536+
537+ /* update the pptable */
538+ pp_table->PcieGenSpeed[i] = pcie_gen_arg;
539+ pp_table->PcieLaneCount[i] = pcie_width_arg;
540+ }
541+
542+ return 0;
543+}
544+
484545 static int vega12_get_number_of_dpm_level(struct pp_hwmgr *hwmgr,
485546 PPCLK_e clk_id, uint32_t *num_of_levels)
486547 {
@@ -968,6 +1029,11 @@ static int vega12_enable_dpm_tasks(struct pp_hwmgr *hwmgr) · 481 unmodified lines
9681029 "Failed to enable all smu features!",
9691030 return result);
9701031
1032+ result = vega12_override_pcie_parameters(hwmgr);
1033+ PP_ASSERT_WITH_CODE(!result,
1034+ "[EnableDPMTasks] Failed to override pcie parameters!",
1035+ return result);
1036+
9711037 tmp_result = vega12_power_control_set_level(hwmgr);
9721038 PP_ASSERT_WITH_CODE(!tmp_result,
9731039 "Failed to power control set level!",
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c+27−21
@@ -831,7 +831,9 @@ static int vega20_override_pcie_parameters(struct pp_hwmgr *hwmgr) · 830 unmodified lines
831831 struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev);
832832 struct vega20_hwmgr *data =
833833 (struct vega20_hwmgr *)(hwmgr->backend);
834− uint32_t pcie_gen = 0, pcie_width = 0, smu_pcie_arg;
834+ uint32_t pcie_gen = 0, pcie_width = 0, smu_pcie_arg, pcie_gen_arg, pcie_width_arg;
835+ PPTable_t *pp_table = &(data->smc_state_table.pp_table);
836+ int i;
835837 int ret;
836838
837839 if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN4)
@@ -860,17 +862,27 @@ static int vega20_override_pcie_parameters(struct pp_hwmgr *hwmgr) · 22 unmodified lines
860862 * Bit 15:8: PCIE GEN, 0 to 3 corresponds to GEN1 to GEN4
861863 * Bit 7:0: PCIE lane width, 1 to 7 corresponds is x1 to x32
862864 */
863− smu_pcie_arg = (1 << 16) | (pcie_gen << 8) | pcie_width;
864− ret = smum_send_msg_to_smc_with_parameter(hwmgr,
865− PPSMC_MSG_OverridePcieParameters, smu_pcie_arg,
866− NULL);
867− PP_ASSERT_WITH_CODE(!ret,
868− "[OverridePcieParameters] Attempt to override pcie params failed!",
869− return ret);
865+ for (i = 0; i < NUM_LINK_LEVELS; i++) {
866+ pcie_gen_arg = (pp_table->PcieGenSpeed[i] > pcie_gen) ? pcie_gen :
867+ pp_table->PcieGenSpeed[i];
868+ pcie_width_arg = (pp_table->PcieLaneCount[i] > pcie_width) ? pcie_width :
869+ pp_table->PcieLaneCount[i];
870+
871+ if (pcie_gen_arg != pp_table->PcieGenSpeed[i] || pcie_width_arg !=
872+ pp_table->PcieLaneCount[i]) {
873+ smu_pcie_arg = (i << 16) | (pcie_gen_arg << 8) | pcie_width_arg;
874+ ret = smum_send_msg_to_smc_with_parameter(hwmgr,
875+ PPSMC_MSG_OverridePcieParameters, smu_pcie_arg,
876+ NULL);
877+ PP_ASSERT_WITH_CODE(!ret,
878+ "[OverridePcieParameters] Attempt to override pcie params failed!",
879+ return ret);
880+ }
870881
871− data->pcie_parameters_override = true;
872− data->pcie_gen_level1 = pcie_gen;
873− data->pcie_width_level1 = pcie_width;
882+ /* update the pptable */
883+ pp_table->PcieGenSpeed[i] = pcie_gen_arg;
884+ pp_table->PcieLaneCount[i] = pcie_width_arg;
885+ }
874886
875887 return 0;
876888 }
@@ -3319,9 +3331,7 @@ static int vega20_print_clock_levels(struct pp_hwmgr *hwmgr, · 2442 unmodified lines
33193331 data->od8_settings.od8_settings_array;
33203332 OverDriveTable_t *od_table =
33213333 &(data->smc_state_table.overdrive_table);
3322− struct phm_ppt_v3_information *pptable_information =
3323− (struct phm_ppt_v3_information *)hwmgr->pptable;
3324− PPTable_t *pptable = (PPTable_t *)pptable_information->smc_pptable;
3334+ PPTable_t *pptable = &(data->smc_state_table.pp_table);
33253335 struct pp_clock_levels_with_latency clocks;
33263336 struct vega20_single_dpm_table *fclk_dpm_table =
33273337 &(data->dpm_table.fclk_table);
@@ -3420,13 +3430,9 @@ static int vega20_print_clock_levels(struct pp_hwmgr *hwmgr, · 92 unmodified lines
34203430 current_lane_width =
34213431 vega20_get_current_pcie_link_width_level(hwmgr);
34223432 for (i = 0; i < NUM_LINK_LEVELS; i++) {
3423− if (i == 1 && data->pcie_parameters_override) {
3424− gen_speed = data->pcie_gen_level1;
3425− lane_width = data->pcie_width_level1;
3426− } else {
3427− gen_speed = pptable->PcieGenSpeed[i];
3428− lane_width = pptable->PcieLaneCount[i];
3429− }
3433+ gen_speed = pptable->PcieGenSpeed[i];
3434+ lane_width = pptable->PcieLaneCount[i];
3435+
34303436 size += sprintf(buf + size, "%d: %s %s %dMhz %s\n", i,
34313437 (gen_speed == 0) ? "2.5GT/s," :
34323438 (gen_speed == 1) ? "5.0GT/s," :
drivers/gpu/drm/drm_fb_helper.c+1−1
@@ -2048,7 +2048,7 @@ static void drm_fbdev_cleanup(struct drm_fb_helper *fb_helper) · 2047 unmodified lines
20482048
20492049 if (shadow)
20502050 vfree(shadow);
2051− else
2051+ else if (fb_helper->buffer)
20522052 drm_client_buffer_vunmap(fb_helper->buffer);
20532053
20542054 drm_client_framebuffer_delete(fb_helper->buffer);
drivers/gpu/drm/drm_gem_shmem_helper.c+22−10
@@ -357,13 +357,14 @@ static void drm_gem_shmem_vunmap_locked(struct drm_gem_shmem_object *shmem, · 356 unmodified lines
357357 if (--shmem->vmap_use_count > 0)
358358 return;
359359
360− if (obj->import_attach)
360+ if (obj->import_attach) {
361361 dma_buf_vunmap(obj->import_attach->dmabuf, map);
362− else
362+ } else {
363363 vunmap(shmem->vaddr);
364+ drm_gem_shmem_put_pages(shmem);
365+ }
364366
365367 shmem->vaddr = NULL;
366− drm_gem_shmem_put_pages(shmem);
367368 }
368369
369370 /*
@@ -525,14 +526,28 @@ static vm_fault_t drm_gem_shmem_fault(struct vm_fault *vmf) · 155 unmodified lines
525526 struct drm_gem_object *obj = vma->vm_private_data;
526527 struct drm_gem_shmem_object *shmem = to_drm_gem_shmem_obj(obj);
527528 loff_t num_pages = obj->size >> PAGE_SHIFT;
529+ vm_fault_t ret;
528530 struct page *page;
531+ pgoff_t page_offset;
529532
530− if (vmf->pgoff >= num_pages || WARN_ON_ONCE(!shmem->pages))
531− return VM_FAULT_SIGBUS;
533+ /* We don't use vmf->pgoff since that has the fake offset */
534+ page_offset = (vmf->address - vma->vm_start) >> PAGE_SHIFT;
532535
533− page = shmem->pages[vmf->pgoff];
536+ mutex_lock(&shmem->pages_lock);
534537
535− return vmf_insert_page(vma, vmf->address, page);
538+ if (page_offset >= num_pages ||
539+ WARN_ON_ONCE(!shmem->pages) ||
540+ shmem->madv < 0) {
541+ ret = VM_FAULT_SIGBUS;
542+ } else {
543+ page = shmem->pages[page_offset];
544+
545+ ret = vmf_insert_page(vma, vmf->address, page);
546+ }
547+
548+ mutex_unlock(&shmem->pages_lock);
549+
550+ return ret;
536551 }
537552
538553 static void drm_gem_shmem_vm_open(struct vm_area_struct *vma)
@@ -581,9 +596,6 @@ int drm_gem_shmem_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma) · 42 unmodified lines
581596 struct drm_gem_shmem_object *shmem;
582597 int ret;
583598
584− /* Remove the fake offset */
585− vma->vm_pgoff -= drm_vma_node_start(&obj->vma_node);
586−
587599 if (obj->import_attach) {
588600 /* Drop the reference drm_gem_mmap_obj() acquired.*/
589601 drm_gem_object_put(obj);
drivers/gpu/drm/drm_ioc32.c+11−0
@@ -99,6 +99,8 @@ static int compat_drm_version(struct file *file, unsigned int cmd, · 98 unmodified lines
9999 if (copy_from_user(&v32, (void __user *)arg, sizeof(v32)))
100100 return -EFAULT;
101101
102+ memset(&v, 0, sizeof(v));
103+
102104 v = (struct drm_version) {
103105 .name_len = v32.name_len,
104106 .name = compat_ptr(v32.name),
@@ -137,6 +139,9 @@ static int compat_drm_getunique(struct file *file, unsigned int cmd, · 32 unmodified lines
137139
138140 if (copy_from_user(&uq32, (void __user *)arg, sizeof(uq32)))
139141 return -EFAULT;
142+
143+ memset(&uq, 0, sizeof(uq));
144+
140145 uq = (struct drm_unique){
141146 .unique_len = uq32.unique_len,
142147 .unique = compat_ptr(uq32.unique),
@@ -265,6 +270,8 @@ static int compat_drm_getclient(struct file *file, unsigned int cmd, · 122 unmodified lines
265270 if (copy_from_user(&c32, argp, sizeof(c32)))
266271 return -EFAULT;
267272
273+ memset(&client, 0, sizeof(client));
274+
268275 client.idx = c32.idx;
269276
270277 err = drm_ioctl_kernel(file, drm_getclient, &client, 0);
@@ -852,6 +859,8 @@ static int compat_drm_wait_vblank(struct file *file, unsigned int cmd, · 581 unmodified lines
852859 if (copy_from_user(&req32, argp, sizeof(req32)))
853860 return -EFAULT;
854861
862+ memset(&req, 0, sizeof(req));
863+
855864 req.request.type = req32.request.type;
856865 req.request.sequence = req32.request.sequence;
857866 req.request.signal = req32.request.signal;
@@ -889,6 +898,8 @@ static int compat_drm_mode_addfb2(struct file *file, unsigned int cmd, · 31 unmodified lines
889898 struct drm_mode_fb_cmd2 req64;
890899 int err;
891900
901+ memset(&req64, 0, sizeof(req64));
902+
892903 if (copy_from_user(&req64, argp,
893904 offsetof(drm_mode_fb_cmd232_t, modifier)))
894905 return -EFAULT;
drivers/gpu/drm/i915/gt/intel_engine_cs.c+6−1
@@ -713,9 +713,12 @@ static int engine_setup_common(struct intel_engine_cs *engine) · 712 unmodified lines
713713 goto err_status;
714714 }
715715
716+ err = intel_engine_init_cmd_parser(engine);
717+ if (err)
718+ goto err_cmd_parser;
719+
716720 intel_engine_init_active(engine, ENGINE_PHYSICAL);
717721 intel_engine_init_execlists(engine);
718− intel_engine_init_cmd_parser(engine);
719722 intel_engine_init__pm(engine);
720723 intel_engine_init_retire(engine);
721724
@@ -732,6 +735,8 @@ static int engine_setup_common(struct intel_engine_cs *engine) · 10 unmodified lines
732735
733736 return 0;
734737
738+err_cmd_parser:
739+ intel_breadcrumbs_free(engine->breadcrumbs);
735740 err_status:
736741 cleanup_status_page(engine);
737742 return err;
drivers/gpu/drm/i915/i915_cmd_parser.c+13−6
@@ -940,7 +940,7 @@ static void fini_hash_table(struct intel_engine_cs *engine) · 939 unmodified lines
940940 * struct intel_engine_cs based on whether the platform requires software
941941 * command parsing.
942942 */
943−void intel_engine_init_cmd_parser(struct intel_engine_cs *engine)
943+int intel_engine_init_cmd_parser(struct intel_engine_cs *engine)
944944 {
945945 const struct drm_i915_cmd_table *cmd_tables;
946946 int cmd_table_count;
@@ -948,7 +948,7 @@ void intel_engine_init_cmd_parser(struct intel_engine_cs *engine) · 1 unmodified line
948948
949949 if (!IS_GEN(engine->i915, 7) && !(IS_GEN(engine->i915, 9) &&
950950 engine->class == COPY_ENGINE_CLASS))
951− return;
951+ return 0;
952952
953953 switch (engine->class) {
954954 case RENDER_CLASS:
@@ -1013,19 +1013,19 @@ void intel_engine_init_cmd_parser(struct intel_engine_cs *engine) · 58 unmodified lines
10131013 break;
10141014 default:
10151015 MISSING_CASE(engine->class);
1016− return;
1016+ goto out;
10171017 }
10181018
10191019 if (!validate_cmds_sorted(engine, cmd_tables, cmd_table_count)) {
10201020 drm_err(&engine->i915->drm,
10211021 "%s: command descriptions are not sorted\n",
10221022 engine->name);
1023− return;
1023+ goto out;
10241024 }
10251025 if (!validate_regs_sorted(engine)) {
10261026 drm_err(&engine->i915->drm,
10271027 "%s: registers are not sorted\n", engine->name);
1028− return;
1028+ goto out;
10291029 }
10301030
10311031 ret = init_hash_table(engine, cmd_tables, cmd_table_count);
@@ -1033,10 +1033,17 @@ void intel_engine_init_cmd_parser(struct intel_engine_cs *engine) · 1 unmodified line
10331033 drm_err(&engine->i915->drm,
10341034 "%s: initialised failed!\n", engine->name);
10351035 fini_hash_table(engine);
1036− return;
1036+ goto out;
10371037 }
10381038
10391039 engine->flags |= I915_ENGINE_USING_CMD_PARSER;
1040+
1041+out:
1042+ if (intel_engine_requires_cmd_parser(engine) &&
1043+ !intel_engine_using_cmd_parser(engine))
1044+ return -EINVAL;
1045+
1046+ return 0;
10401047 }
10411048
10421049 /**
drivers/gpu/drm/i915/i915_drv.h+1−1
@@ -1952,7 +1952,7 @@ const char *i915_cache_level_str(struct drm_i915_private *i915, int type); · 1951 unmodified lines
19521952
19531953 /* i915_cmd_parser.c */
19541954 int i915_cmd_parser_get_version(struct drm_i915_private *dev_priv);
1955−void intel_engine_init_cmd_parser(struct intel_engine_cs *engine);
1955+int intel_engine_init_cmd_parser(struct intel_engine_cs *engine);
19561956 void intel_engine_cleanup_cmd_parser(struct intel_engine_cs *engine);
19571957 int intel_engine_cmd_parser(struct intel_engine_cs *engine,
19581958 struct i915_vma *batch,
drivers/gpu/drm/meson/meson_drv.c+11−0
@@ -482,6 +482,16 @@ static int meson_probe_remote(struct platform_device *pdev, · 481 unmodified lines
482482 return count;
483483 }
484484
485+static void meson_drv_shutdown(struct platform_device *pdev)
486+{
487+ struct meson_drm *priv = dev_get_drvdata(&pdev->dev);
488+ struct drm_device *drm = priv->drm;
489+
490+ DRM_DEBUG_DRIVER("\n");
491+ drm_kms_helper_poll_fini(drm);
492+ drm_atomic_helper_shutdown(drm);
493+}
494+
485495 static int meson_drv_probe(struct platform_device *pdev)
486496 {
487497 struct component_match *match = NULL;
@@ -553,6 +563,7 @@ static const struct dev_pm_ops meson_drv_pm_ops = { · 65 unmodified lines
553563
554564 static struct platform_driver meson_drm_platform_driver = {
555565 .probe = meson_drv_probe,
566+ .shutdown = meson_drv_shutdown,
556567 .driver = {
557568 .name = "meson-drm",
558569 .of_match_table = dt_match,
drivers/gpu/drm/nouveau/nouveau_bo.c+4−2
@@ -556,7 +556,8 @@ nouveau_bo_sync_for_device(struct nouveau_bo *nvbo) · 555 unmodified lines
556556 if (nvbo->force_coherent)
557557 return;
558558
559− for (i = 0; i < ttm_dma->num_pages; ++i) {
559+ i = 0;
560+ while (i < ttm_dma->num_pages) {
560561 struct page *p = ttm_dma->pages[i];
561562 size_t num_pages = 1;
562563
@@ -587,7 +588,8 @@ nouveau_bo_sync_for_cpu(struct nouveau_bo *nvbo) · 24 unmodified lines
587588 if (nvbo->force_coherent)
588589 return;
589590
590− for (i = 0; i < ttm_dma->num_pages; ++i) {
591+ i = 0;
592+ while (i < ttm_dma->num_pages) {
591593 struct page *p = ttm_dma->pages[i];
592594 size_t num_pages = 1;
593595
drivers/gpu/drm/qxl/qxl_display.c+1−0
@@ -328,6 +328,7 @@ static void qxl_crtc_update_monitors_config(struct drm_crtc *crtc, · 327 unmodified lines
328328
329329 head.id = i;
330330 head.flags = 0;
331+ head.surface_id = 0;
331332 oldcount = qdev->monitors_config->count;
332333 if (crtc->state->active) {
333334 struct drm_display_mode *mode = &crtc->mode;
drivers/gpu/drm/qxl/qxl_release.c+10−2
@@ -321,7 +321,7 @@ int qxl_alloc_release_reserved(struct qxl_device *qdev, unsigned long size, · 320 unmodified lines
321321 int type, struct qxl_release **release,
322322 struct qxl_bo **rbo)
323323 {
324− struct qxl_bo *bo;
324+ struct qxl_bo *bo, *free_bo = NULL;
325325 int idr_ret;
326326 int ret = 0;
327327 union qxl_release_info *info;
@@ -347,7 +347,7 @@ int qxl_alloc_release_reserved(struct qxl_device *qdev, unsigned long size, · 19 unmodified lines
347347
348348 mutex_lock(&qdev->release_mutex);
349349 if (qdev->current_release_bo_offset[cur_idx] + 1 >= releases_per_bo[cur_idx]) {
350− qxl_bo_unref(&qdev->current_release_bo[cur_idx]);
350+ free_bo = qdev->current_release_bo[cur_idx];
351351 qdev->current_release_bo_offset[cur_idx] = 0;
352352 qdev->current_release_bo[cur_idx] = NULL;
353353 }
@@ -355,6 +355,10 @@ int qxl_alloc_release_reserved(struct qxl_device *qdev, unsigned long size, · 1 unmodified line
355355 ret = qxl_release_bo_alloc(qdev, &qdev->current_release_bo[cur_idx]);
356356 if (ret) {
357357 mutex_unlock(&qdev->release_mutex);
358+ if (free_bo) {
359+ qxl_bo_unpin(free_bo);
360+ qxl_bo_unref(&free_bo);
361+ }
358362 qxl_release_free(qdev, *release);
359363 return ret;
360364 }
@@ -370,6 +374,10 @@ int qxl_alloc_release_reserved(struct qxl_device *qdev, unsigned long size, · 9 unmodified lines
370374 *rbo = bo;
371375
372376 mutex_unlock(&qdev->release_mutex);
377+ if (free_bo) {
378+ qxl_bo_unpin(free_bo);
379+ qxl_bo_unref(&free_bo);
380+ }
373381
374382 ret = qxl_release_list_add(*release, bo);
375383 qxl_bo_unref(&bo);
drivers/gpu/drm/radeon/radeon.h+2−0
@@ -574,6 +574,8 @@ struct radeon_gem { · 573 unmodified lines
574574 struct list_head objects;
575575 };
576576
577+extern const struct drm_gem_object_funcs radeon_gem_object_funcs;
578+
577579 int radeon_gem_init(struct radeon_device *rdev);
578580 void radeon_gem_fini(struct radeon_device *rdev);
579581 int radeon_gem_object_create(struct radeon_device *rdev, unsigned long size,
drivers/gpu/drm/radeon/radeon_gem.c+2−2
@@ -43,7 +43,7 @@ struct sg_table *radeon_gem_prime_get_sg_table(struct drm_gem_object *obj); · 42 unmodified lines
4343 int radeon_gem_prime_pin(struct drm_gem_object *obj);
4444 void radeon_gem_prime_unpin(struct drm_gem_object *obj);
4545
46−static const struct drm_gem_object_funcs radeon_gem_object_funcs;
46+const struct drm_gem_object_funcs radeon_gem_object_funcs;
4747
4848 static void radeon_gem_object_free(struct drm_gem_object *gobj)
4949 {
@@ -227,7 +227,7 @@ static int radeon_gem_handle_lockup(struct radeon_device *rdev, int r) · 177 unmodified lines
227227 return r;
228228 }
229229
230−static const struct drm_gem_object_funcs radeon_gem_object_funcs = {
230+const struct drm_gem_object_funcs radeon_gem_object_funcs = {
231231 .free = radeon_gem_object_free,
232232 .open = radeon_gem_object_open,
233233 .close = radeon_gem_object_close,
drivers/gpu/drm/radeon/radeon_prime.c+2−0
@@ -56,6 +56,8 @@ struct drm_gem_object *radeon_gem_prime_import_sg_table(struct drm_device *dev, · 55 unmodified lines
5656 if (ret)
5757 return ERR_PTR(ret);
5858
59+ bo->tbo.base.funcs = &radeon_gem_object_funcs;
60+
5961 mutex_lock(&rdev->gem.mutex);
6062 list_add_tail(&bo->list, &rdev->gem.objects);
6163 mutex_unlock(&rdev->gem.mutex);
drivers/gpu/drm/tiny/gm12u320.c+36−8
@@ -83,6 +83,7 @@ MODULE_PARM_DESC(eco_mode, "Turn on Eco mode (less bright, more silent)"); · 82 unmodified lines
8383
8484 struct gm12u320_device {
8585 struct drm_device dev;
86+ struct device *dmadev;
8687 struct drm_simple_display_pipe pipe;
8788 struct drm_connector conn;
8889 unsigned char *cmd_buf;
@@ -601,6 +602,22 @@ static const uint64_t gm12u320_pipe_modifiers[] = { · 512 unmodified lines
601602 DRM_FORMAT_MOD_INVALID
602603 };
603604
605+/*
606+ * FIXME: Dma-buf sharing requires DMA support by the importing device.
607+ * This function is a workaround to make USB devices work as well.
608+ * See todo.rst for how to fix the issue in the dma-buf framework.
609+ */
610+static struct drm_gem_object *gm12u320_gem_prime_import(struct drm_device *dev,
611+ struct dma_buf *dma_buf)
612+{
613+ struct gm12u320_device *gm12u320 = to_gm12u320(dev);
614+
615+ if (!gm12u320->dmadev)
616+ return ERR_PTR(-ENODEV);
617+
618+ return drm_gem_prime_import_dev(dev, dma_buf, gm12u320->dmadev);
619+}
620+
604621 DEFINE_DRM_GEM_FOPS(gm12u320_fops);
605622
606623 static const struct drm_driver gm12u320_drm_driver = {
@@ -614,6 +631,7 @@ static const struct drm_driver gm12u320_drm_driver = { · 7 unmodified lines
614631
615632 .fops = &gm12u320_fops,
616633 DRM_GEM_SHMEM_DRIVER_OPS,
634+ .gem_prime_import = gm12u320_gem_prime_import,
617635 };
618636
619637 static const struct drm_mode_config_funcs gm12u320_mode_config_funcs = {
@@ -640,15 +658,18 @@ static int gm12u320_usb_probe(struct usb_interface *interface, · 20 unmodified lines
640658 struct gm12u320_device, dev);
641659 if (IS_ERR(gm12u320))
642660 return PTR_ERR(gm12u320);
661+ dev = &gm12u320->dev;
662+
663+ gm12u320->dmadev = usb_intf_get_dma_device(to_usb_interface(dev->dev));
664+ if (!gm12u320->dmadev)
665+ drm_warn(dev, "buffer sharing not supported"); /* not an error */
643666
644667 INIT_DELAYED_WORK(&gm12u320->fb_update.work, gm12u320_fb_update_work);
645668 mutex_init(&gm12u320->fb_update.lock);
646669
647− dev = &gm12u320->dev;
648−
649670 ret = drmm_mode_config_init(dev);
650671 if (ret)
651− return ret;
672+ goto err_put_device;
652673
653674 dev->mode_config.min_width = GM12U320_USER_WIDTH;
654675 dev->mode_config.max_width = GM12U320_USER_WIDTH;
@@ -658,15 +679,15 @@ static int gm12u320_usb_probe(struct usb_interface *interface, · 3 unmodified lines
658679
659680 ret = gm12u320_usb_alloc(gm12u320);
660681 if (ret)
661− return ret;
682+ goto err_put_device;
662683
663684 ret = gm12u320_set_ecomode(gm12u320);
664685 if (ret)
665− return ret;
686+ goto err_put_device;
666687
667688 ret = gm12u320_conn_init(gm12u320);
668689 if (ret)
669− return ret;
690+ goto err_put_device;
670691
671692 ret = drm_simple_display_pipe_init(&gm12u320->dev,
672693 &gm12u320->pipe,
@@ -676,24 +697,31 @@ static int gm12u320_usb_probe(struct usb_interface *interface, · 3 unmodified lines
676697 gm12u320_pipe_modifiers,
677698 &gm12u320->conn);
678699 if (ret)
679− return ret;
700+ goto err_put_device;
680701
681702 drm_mode_config_reset(dev);
682703
683704 usb_set_intfdata(interface, dev);
684705 ret = drm_dev_register(dev, 0);
685706 if (ret)
686− return ret;
707+ goto err_put_device;
687708
688709 drm_fbdev_generic_setup(dev, 0);
689710
690711 return 0;
712+
713+err_put_device:
714+ put_device(gm12u320->dmadev);
715+ return ret;
691716 }
692717
693718 static void gm12u320_usb_disconnect(struct usb_interface *interface)
694719 {
695720 struct drm_device *dev = usb_get_intfdata(interface);
721+ struct gm12u320_device *gm12u320 = to_gm12u320(dev);
696722
723+ put_device(gm12u320->dmadev);
724+ gm12u320->dmadev = NULL;
697725 drm_dev_unplug(dev);
698726 drm_atomic_helper_shutdown(dev);
699727 }
drivers/gpu/drm/ttm/ttm_bo.c+6−2
@@ -136,7 +136,8 @@ void ttm_bo_move_to_lru_tail(struct ttm_buffer_object *bo, · 135 unmodified lines
136136 struct ttm_bo_device *bdev = bo->bdev;
137137 struct ttm_resource_manager *man;
138138
139− dma_resv_assert_held(bo->base.resv);
139+ if (!bo->deleted)
140+ dma_resv_assert_held(bo->base.resv);
140141
141142 if (bo->pin_count) {
142143 ttm_bo_del_from_lru(bo);
@@ -508,8 +509,11 @@ static void ttm_bo_release(struct kref *kref) · 365 unmodified lines
508509 * Make pinned bos immediately available to
509510 * shrinkers, now that they are queued for
510511 * destruction.
512+ *
513+ * FIXME: QXL is triggering this. Can be removed when the
514+ * driver is fixed.
511515 */
512− if (WARN_ON(bo->pin_count)) {
516+ if (WARN_ON_ONCE(bo->pin_count)) {
513517 bo->pin_count = 0;
514518 ttm_bo_move_to_lru_tail(bo, &bo->mem, NULL);
515519 }
drivers/gpu/drm/ttm/ttm_pool.c+2−2
@@ -268,13 +268,13 @@ static void ttm_pool_type_init(struct ttm_pool_type *pt, struct ttm_pool *pool, · 267 unmodified lines
268268 /* Remove a pool_type from the global shrinker list and free all pages */
269269 static void ttm_pool_type_fini(struct ttm_pool_type *pt)
270270 {
271− struct page *p, *tmp;
271+ struct page *p;
272272
273273 mutex_lock(&shrinker_lock);
274274 list_del(&pt->shrinker_list);
275275 mutex_unlock(&shrinker_lock);
276276
277− list_for_each_entry_safe(p, tmp, &pt->pages, lru)
277+ while ((p = ttm_pool_type_take(pt)))
278278 ttm_pool_free_page(pt->pool, pt->caching, pt->order, p);
279279 }
280280
drivers/gpu/drm/udl/udl_drv.c+17−0
@@ -32,6 +32,22 @@ static int udl_usb_resume(struct usb_interface *interface) · 31 unmodified lines
3232 return drm_mode_config_helper_resume(dev);
3333 }
3434
35+/*
36+ * FIXME: Dma-buf sharing requires DMA support by the importing device.
37+ * This function is a workaround to make USB devices work as well.
38+ * See todo.rst for how to fix the issue in the dma-buf framework.
39+ */
40+static struct drm_gem_object *udl_driver_gem_prime_import(struct drm_device *dev,
41+ struct dma_buf *dma_buf)
42+{
43+ struct udl_device *udl = to_udl(dev);
44+
45+ if (!udl->dmadev)
46+ return ERR_PTR(-ENODEV);
47+
48+ return drm_gem_prime_import_dev(dev, dma_buf, udl->dmadev);
49+}
50+
3551 DEFINE_DRM_GEM_FOPS(udl_driver_fops);
3652
3753 static const struct drm_driver driver = {
@@ -40,6 +56,7 @@ static const struct drm_driver driver = { · 2 unmodified lines
4056 /* GEM hooks */
4157 .fops = &udl_driver_fops,
4258 DRM_GEM_SHMEM_DRIVER_OPS,
59+ .gem_prime_import = udl_driver_gem_prime_import,
4360
4461 .name = DRIVER_NAME,
4562 .desc = DRIVER_DESC,
drivers/gpu/drm/udl/udl_drv.h+1−0
@@ -50,6 +50,7 @@ struct urb_list { · 49 unmodified lines
5050 struct udl_device {
5151 struct drm_device drm;
5252 struct device *dev;
53+ struct device *dmadev;
5354
5455 struct drm_simple_display_pipe display_pipe;
5556
drivers/gpu/drm/udl/udl_main.c+10−0
@@ -315,6 +315,10 @@ int udl_init(struct udl_device *udl) · 314 unmodified lines
315315
316316 DRM_DEBUG("\n");
317317
318+ udl->dmadev = usb_intf_get_dma_device(to_usb_interface(dev->dev));
319+ if (!udl->dmadev)
320+ drm_warn(dev, "buffer sharing not supported"); /* not an error */
321+
318322 mutex_init(&udl->gem_lock);
319323
320324 if (!udl_parse_vendor_descriptor(udl)) {
@@ -343,12 +347,18 @@ int udl_init(struct udl_device *udl) · 22 unmodified lines
343347 err:
344348 if (udl->urbs.count)
345349 udl_free_urb_list(dev);
350+ put_device(udl->dmadev);
346351 DRM_ERROR("%d\n", ret);
347352 return ret;
348353 }
349354
350355 int udl_drop_usb(struct drm_device *dev)
351356 {
357+ struct udl_device *udl = to_udl(dev);
358+
352359 udl_free_urb_list(dev);
360+ put_device(udl->dmadev);
361+ udl->dmadev = NULL;
362+
353363 return 0;
354364 }
drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c+1−3
@@ -500,8 +500,6 @@ vm_fault_t vmw_bo_vm_huge_fault(struct vm_fault *vmf, · 499 unmodified lines
500500 vm_fault_t ret;
501501 pgoff_t fault_page_size;
502502 bool write = vmf->flags & FAULT_FLAG_WRITE;
503− bool is_cow_mapping =
504− (vma->vm_flags & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE;
505503
506504 switch (pe_size) {
507505 case PE_SIZE_PMD:
@@ -518,7 +516,7 @@ vm_fault_t vmw_bo_vm_huge_fault(struct vm_fault *vmf, · 10 unmodified lines
518516 }
519517
520518 /* Always do write dirty-tracking and COW on PTE level. */
521− if (write && (READ_ONCE(vbo->dirty) || is_cow_mapping))
519+ if (write && (READ_ONCE(vbo->dirty) || is_cow_mapping(vma->vm_flags)))
522520 return VM_FAULT_FALLBACK;
523521
524522 ret = ttm_bo_vm_reserve(bo, vmf);
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c+1−1
@@ -49,7 +49,7 @@ int vmw_mmap(struct file *filp, struct vm_area_struct *vma) · 48 unmodified lines
4949 vma->vm_ops = &vmw_vm_ops;
5050
5151 /* Use VM_PFNMAP rather than VM_MIXEDMAP if not a COW mapping */
52− if ((vma->vm_flags & (VM_SHARED | VM_MAYWRITE)) != VM_MAYWRITE)
52+ if (!is_cow_mapping(vma->vm_flags))
5353 vma->vm_flags = (vma->vm_flags & ~VM_MIXEDMAP) | VM_PFNMAP;
5454
5555 return 0;
drivers/irqchip/Kconfig+0−9
@@ -8,7 +8,6 @@ config IRQCHIP · 7 unmodified lines
88 config ARM_GIC
99 bool
1010 select IRQ_DOMAIN_HIERARCHY
11− select GENERIC_IRQ_MULTI_HANDLER
1211 select GENERIC_IRQ_EFFECTIVE_AFF_MASK
1312
1413 config ARM_GIC_PM
@@ -33,7 +32,6 @@ config GIC_NON_BANKED · 18 unmodified lines
3332
3433 config ARM_GIC_V3
3534 bool
36− select GENERIC_IRQ_MULTI_HANDLER
3735 select IRQ_DOMAIN_HIERARCHY
3836 select PARTITION_PERCPU
3937 select GENERIC_IRQ_EFFECTIVE_AFF_MASK
@@ -64,7 +62,6 @@ config ARM_NVIC · 24 unmodified lines
6462 config ARM_VIC
6563 bool
6664 select IRQ_DOMAIN
67− select GENERIC_IRQ_MULTI_HANDLER
6865
6966 config ARM_VIC_NR
7067 int
@@ -99,14 +96,12 @@ config ATMEL_AIC_IRQ · 28 unmodified lines
9996 bool
10097 select GENERIC_IRQ_CHIP
10198 select IRQ_DOMAIN
102− select GENERIC_IRQ_MULTI_HANDLER
10399 select SPARSE_IRQ
104100
105101 config ATMEL_AIC5_IRQ
106102 bool
107103 select GENERIC_IRQ_CHIP
108104 select IRQ_DOMAIN
109− select GENERIC_IRQ_MULTI_HANDLER
110105 select SPARSE_IRQ
111106
112107 config I8259
@@ -153,7 +148,6 @@ config DW_APB_ICTL · 40 unmodified lines
153148 config FARADAY_FTINTC010
154149 bool
155150 select IRQ_DOMAIN
156− select GENERIC_IRQ_MULTI_HANDLER
157151 select SPARSE_IRQ
158152
159153 config HISILICON_IRQ_MBIGEN
@@ -169,7 +163,6 @@ config IMGPDC_IRQ · 9 unmodified lines
169163 config IXP4XX_IRQ
170164 bool
171165 select IRQ_DOMAIN
172− select GENERIC_IRQ_MULTI_HANDLER
173166 select SPARSE_IRQ
174167
175168 config MADERA_IRQ
@@ -186,7 +179,6 @@ config CLPS711X_IRQCHIP · 10 unmodified lines
186179 bool
187180 depends on ARCH_CLPS711X
188181 select IRQ_DOMAIN
189− select GENERIC_IRQ_MULTI_HANDLER
190182 select SPARSE_IRQ
191183 default y
192184
@@ -205,7 +197,6 @@ config OMAP_IRQCHIP · 12 unmodified lines
205197 config ORION_IRQCHIP
206198 bool
207199 select IRQ_DOMAIN
208− select GENERIC_IRQ_MULTI_HANDLER
209200
210201 config PIC32_EVIC
211202 bool
drivers/irqchip/irq-ingenic-tcu.c+1−0
@@ -179,5 +179,6 @@ err_free_tcu: · 178 unmodified lines
179179 }
180180 IRQCHIP_DECLARE(jz4740_tcu_irq, "ingenic,jz4740-tcu", ingenic_tcu_irq_init);
181181 IRQCHIP_DECLARE(jz4725b_tcu_irq, "ingenic,jz4725b-tcu", ingenic_tcu_irq_init);
182+IRQCHIP_DECLARE(jz4760_tcu_irq, "ingenic,jz4760-tcu", ingenic_tcu_irq_init);
182183 IRQCHIP_DECLARE(jz4770_tcu_irq, "ingenic,jz4770-tcu", ingenic_tcu_irq_init);
183184 IRQCHIP_DECLARE(x1000_tcu_irq, "ingenic,x1000-tcu", ingenic_tcu_irq_init);
drivers/irqchip/irq-ingenic.c+1−0
@@ -155,6 +155,7 @@ static int __init intc_2chip_of_init(struct device_node *node, · 154 unmodified lines
155155 {
156156 return ingenic_intc_of_init(node, 2);
157157 }
158+IRQCHIP_DECLARE(jz4760_intc, "ingenic,jz4760-intc", intc_2chip_of_init);
158159 IRQCHIP_DECLARE(jz4770_intc, "ingenic,jz4770-intc", intc_2chip_of_init);
159160 IRQCHIP_DECLARE(jz4775_intc, "ingenic,jz4775-intc", intc_2chip_of_init);
160161 IRQCHIP_DECLARE(jz4780_intc, "ingenic,jz4780-intc", intc_2chip_of_init);
drivers/leds/trigger/ledtrig-tty.c+4−7
@@ -51,10 +51,8 @@ static ssize_t ttyname_store(struct device *dev, · 50 unmodified lines
5151
5252 if (size) {
5353 ttyname = kmemdup_nul(buf, size, GFP_KERNEL);
54− if (!ttyname) {
55− ret = -ENOMEM;
56− goto out_unlock;
57− }
54+ if (!ttyname)
55+ return -ENOMEM;
5856 } else {
5957 ttyname = NULL;
6058 }
@@ -69,7 +67,6 @@ static ssize_t ttyname_store(struct device *dev, · 8 unmodified lines
6967
7068 trigger_data->ttyname = ttyname;
7169
72−out_unlock:
7370 mutex_unlock(&trigger_data->mutex);
7471
7572 if (ttyname && !running)
@@ -125,12 +122,12 @@ static void ledtrig_tty_work(struct work_struct *work) · 49 unmodified lines
125122
126123 if (icount.rx != trigger_data->rx ||
127124 icount.tx != trigger_data->tx) {
128− led_set_brightness(trigger_data->led_cdev, LED_ON);
125+ led_set_brightness_sync(trigger_data->led_cdev, LED_ON);
129126
130127 trigger_data->rx = icount.rx;
131128 trigger_data->tx = icount.tx;
132129 } else {
133− led_set_brightness(trigger_data->led_cdev, LED_OFF);
130+ led_set_brightness_sync(trigger_data->led_cdev, LED_OFF);
134131 }
135132
136133 out:
drivers/md/bcache/super.c+1−1
@@ -965,7 +965,7 @@ static int bcache_device_init(struct bcache_device *d, unsigned int block_size, · 964 unmodified lines
965965 q->limits.max_hw_sectors = UINT_MAX;
966966 q->limits.max_sectors = UINT_MAX;
967967 q->limits.max_segment_size = UINT_MAX;
968− q->limits.max_segments = BIO_MAX_PAGES;
968+ q->limits.max_segments = BIO_MAX_VECS;
969969 blk_queue_max_discard_sectors(q, UINT_MAX);
970970 q->limits.discard_granularity = 512;
971971 q->limits.io_min = block_size;
drivers/md/dm-crypt.c+4−4
@@ -229,7 +229,7 @@ static DEFINE_SPINLOCK(dm_crypt_clients_lock); · 228 unmodified lines
229229 static unsigned dm_crypt_clients_n = 0;
230230 static volatile unsigned long dm_crypt_pages_per_client;
231231 #define DM_CRYPT_MEMORY_PERCENT 2
232−#define DM_CRYPT_MIN_PAGES_PER_CLIENT (BIO_MAX_PAGES * 16)
232+#define DM_CRYPT_MIN_PAGES_PER_CLIENT (BIO_MAX_VECS * 16)
233233
234234 static void clone_init(struct dm_crypt_io *, struct bio *);
235235 static void kcryptd_queue_crypt(struct dm_crypt_io *io);
@@ -3246,7 +3246,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) · 3010 unmodified lines
32463246 ALIGN(sizeof(struct dm_crypt_io) + cc->dmreq_start + additional_req_size,
32473247 ARCH_KMALLOC_MINALIGN);
32483248
3249− ret = mempool_init(&cc->page_pool, BIO_MAX_PAGES, crypt_page_alloc, crypt_page_free, cc);
3249+ ret = mempool_init(&cc->page_pool, BIO_MAX_VECS, crypt_page_alloc, crypt_page_free, cc);
32503250 if (ret) {
32513251 ti->error = "Cannot allocate page mempool";
32523252 goto bad;
@@ -3373,9 +3373,9 @@ static int crypt_map(struct dm_target *ti, struct bio *bio) · 120 unmodified lines
33733373 /*
33743374 * Check if bio is too large, split as needed.
33753375 */
3376− if (unlikely(bio->bi_iter.bi_size > (BIO_MAX_PAGES << PAGE_SHIFT)) &&
3376+ if (unlikely(bio->bi_iter.bi_size > (BIO_MAX_VECS << PAGE_SHIFT)) &&
33773377 (bio_data_dir(bio) == WRITE || cc->on_disk_tag_size))
3378− dm_accept_partial_bio(bio, ((BIO_MAX_PAGES << PAGE_SHIFT) >> SECTOR_SHIFT));
3378+ dm_accept_partial_bio(bio, ((BIO_MAX_VECS << PAGE_SHIFT) >> SECTOR_SHIFT));
33793379
33803380 /*
33813381 * Ensure that bio is a multiple of internal sector encryption size
drivers/md/dm-writecache.c+2−2
@@ -1892,10 +1892,10 @@ restart: · 1891 unmodified lines
18921892 list_add(&g->lru, &wbl.list);
18931893 wbl.size++;
18941894 g->write_in_progress = true;
1895− g->wc_list_contiguous = BIO_MAX_PAGES;
1895+ g->wc_list_contiguous = BIO_MAX_VECS;
18961896 f = g;
18971897 e->wc_list_contiguous++;
1898− if (unlikely(e->wc_list_contiguous == BIO_MAX_PAGES)) {
1898+ if (unlikely(e->wc_list_contiguous == BIO_MAX_VECS)) {
18991899 if (unlikely(wc->writeback_all)) {
19001900 next_node = rb_next(&f->rb_node);
19011901 if (likely(next_node))
drivers/md/raid5-cache.c+2−2
@@ -735,7 +735,7 @@ static void r5l_submit_current_io(struct r5l_log *log) · 734 unmodified lines
735735
736736 static struct bio *r5l_bio_alloc(struct r5l_log *log)
737737 {
738− struct bio *bio = bio_alloc_bioset(GFP_NOIO, BIO_MAX_PAGES, &log->bs);
738+ struct bio *bio = bio_alloc_bioset(GFP_NOIO, BIO_MAX_VECS, &log->bs);
739739
740740 bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
741741 bio_set_dev(bio, log->rdev->bdev);
@@ -1634,7 +1634,7 @@ static int r5l_recovery_allocate_ra_pool(struct r5l_log *log, · 892 unmodified lines
16341634 {
16351635 struct page *page;
16361636
1637− ctx->ra_bio = bio_alloc_bioset(GFP_KERNEL, BIO_MAX_PAGES, &log->bs);
1637+ ctx->ra_bio = bio_alloc_bioset(GFP_KERNEL, BIO_MAX_VECS, &log->bs);
16381638 if (!ctx->ra_bio)
16391639 return -ENOMEM;
16401640
drivers/md/raid5-ppl.c+1−1
@@ -496,7 +496,7 @@ static void ppl_submit_iounit(struct ppl_io_unit *io) · 495 unmodified lines
496496 if (!bio_add_page(bio, sh->ppl_page, PAGE_SIZE, 0)) {
497497 struct bio *prev = bio;
498498
499− bio = bio_alloc_bioset(GFP_NOIO, BIO_MAX_PAGES,
499+ bio = bio_alloc_bioset(GFP_NOIO, BIO_MAX_VECS,
500500 &ppl_conf->bs);
501501 bio->bi_opf = prev->bi_opf;
502502 bio->bi_write_hint = prev->bi_write_hint;
drivers/media/platform/rockchip/rkisp1/rkisp1-params.c+0−1
@@ -1288,7 +1288,6 @@ static void rkisp1_params_config_parameter(struct rkisp1_params *params) · 1287 unmodified lines
12881288 memset(hst.hist_weight, 0x01, sizeof(hst.hist_weight));
12891289 rkisp1_hst_config(params, &hst);
12901290 rkisp1_param_set_bits(params, RKISP1_CIF_ISP_HIST_PROP,
1291− ~RKISP1_CIF_ISP_HIST_PROP_MODE_MASK |
12921291 rkisp1_hst_params_default_config.mode);
12931292
12941293 /* set the range */
drivers/media/platform/vsp1/vsp1_drm.c+3−3
@@ -245,7 +245,7 @@ static int vsp1_du_pipeline_setup_brx(struct vsp1_device *vsp1, · 244 unmodified lines
245245 brx = &vsp1->bru->entity;
246246 else if (pipe->brx && !drm_pipe->force_brx_release)
247247 brx = pipe->brx;
248− else if (!vsp1->bru->entity.pipe)
248+ else if (vsp1_feature(vsp1, VSP1_HAS_BRU) && !vsp1->bru->entity.pipe)
249249 brx = &vsp1->bru->entity;
250250 else
251251 brx = &vsp1->brs->entity;
@@ -462,9 +462,9 @@ static int vsp1_du_pipeline_setup_inputs(struct vsp1_device *vsp1, · 210 unmodified lines
462462 * make sure it is present in the pipeline's list of entities if it
463463 * wasn't already.
464464 */
465− if (!use_uif) {
465+ if (drm_pipe->uif && !use_uif) {
466466 drm_pipe->uif->pipe = NULL;
467− } else if (!drm_pipe->uif->pipe) {
467+ } else if (drm_pipe->uif && !drm_pipe->uif->pipe) {
468468 drm_pipe->uif->pipe = pipe;
469469 list_add_tail(&drm_pipe->uif->list_pipe, &pipe->entities);
470470 }
drivers/media/rc/Makefile+1−0
@@ -5,6 +5,7 @@ obj-y += keymaps/ · 4 unmodified lines
55 obj-$(CONFIG_RC_CORE) += rc-core.o
66 rc-core-y := rc-main.o rc-ir-raw.o
77 rc-core-$(CONFIG_LIRC) += lirc_dev.o
8+rc-core-$(CONFIG_MEDIA_CEC_RC) += keymaps/rc-cec.o
89 rc-core-$(CONFIG_BPF_LIRC_MODE2) += bpf-lirc.o
910 obj-$(CONFIG_IR_NEC_DECODER) += ir-nec-decoder.o
1011 obj-$(CONFIG_IR_RC5_DECODER) += ir-rc5-decoder.o
drivers/media/rc/keymaps/Makefile+0−1
@@ -21,7 +21,6 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ · 20 unmodified lines
2121 rc-behold.o \
2222 rc-behold-columbus.o \
2323 rc-budget-ci-old.o \
24− rc-cec.o \
2524 rc-cinergy-1400.o \
2625 rc-cinergy.o \
2726 rc-d680-dmb.o \
drivers/media/rc/keymaps/rc-cec.c+11−17
@@ -1,5 +1,15 @@
11 // SPDX-License-Identifier: GPL-2.0-or-later
22 /* Keytable for the CEC remote control
3+ *
4+ * This keymap is unusual in that it can't be built as a module,
5+ * instead it is registered directly in rc-main.c if CONFIG_MEDIA_CEC_RC
6+ * is set. This is because it can be called from drm_dp_cec_set_edid() via
7+ * cec_register_adapter() in an asynchronous context, and it is not
8+ * allowed to use request_module() to load rc-cec.ko in that case.
9+ *
10+ * Since this keymap is only used if CONFIG_MEDIA_CEC_RC is set, we
11+ * just compile this keymap into the rc-core module and never as a
12+ * separate module.
313 *
414 * Copyright (c) 2015 by Kamil Debski
515 */
@@ -152,7 +162,7 @@ static struct rc_map_table cec[] = { · 146 unmodified lines
152162 /* 0x77-0xff: Reserved */
153163 };
154164
155−static struct rc_map_list cec_map = {
165+struct rc_map_list cec_map = {
156166 .map = {
157167 .scan = cec,
158168 .size = ARRAY_SIZE(cec),
@@ -160,19 +170,3 @@ static struct rc_map_list cec_map = { · 1 unmodified line
160170 .name = RC_MAP_CEC,
161171 }
162172 };
163−
164−static int __init init_rc_map_cec(void)
165−{
166− return rc_map_register(&cec_map);
167−}
168−
169−static void __exit exit_rc_map_cec(void)
170−{
171− rc_map_unregister(&cec_map);
172−}
173−
174−module_init(init_rc_map_cec);
175−module_exit(exit_rc_map_cec);
176−
177−MODULE_LICENSE("GPL");
178−MODULE_AUTHOR("Kamil Debski");
drivers/media/rc/rc-main.c+6−0
@@ -2069,6 +2069,9 @@ static int __init rc_core_init(void) · 2068 unmodified lines
20692069
20702070 led_trigger_register_simple("rc-feedback", &led_feedback);
20712071 rc_map_register(&empty_map);
2072+#ifdef CONFIG_MEDIA_CEC_RC
2073+ rc_map_register(&cec_map);
2074+#endif
20722075
20732076 return 0;
20742077 }
@@ -2078,6 +2081,9 @@ static void __exit rc_core_exit(void) · 3 unmodified lines
20782081 lirc_dev_exit();
20792082 class_unregister(&rc_class);
20802083 led_trigger_unregister_simple(led_feedback);
2084+#ifdef CONFIG_MEDIA_CEC_RC
2085+ rc_map_unregister(&cec_map);
2086+#endif
20812087 rc_map_unregister(&empty_map);
20822088 }
20832089
drivers/media/usb/usbtv/usbtv-audio.c+1−1
@@ -371,7 +371,7 @@ void usbtv_audio_free(struct usbtv *usbtv) · 370 unmodified lines
371371 cancel_work_sync(&usbtv->snd_trigger);
372372
373373 if (usbtv->snd && usbtv->udev) {
374− snd_card_free(usbtv->snd);
374+ snd_card_free_when_closed(usbtv->snd);
375375 usbtv->snd = NULL;
376376 }
377377 }
drivers/misc/fastrpc.c+5−0
@@ -950,6 +950,11 @@ static int fastrpc_internal_invoke(struct fastrpc_user *fl, u32 kernel, · 949 unmodified lines
950950 if (!fl->cctx->rpdev)
951951 return -EPIPE;
952952
953+ if (handle == FASTRPC_INIT_HANDLE && !kernel) {
954+ dev_warn_ratelimited(fl->sctx->dev, "user app trying to send a kernel RPC message (%d)\n", handle);
955+ return -EPERM;
956+ }
957+
953958 ctx = fastrpc_context_alloc(fl, kernel, sc, args);
954959 if (IS_ERR(ctx))
955960 return PTR_ERR(ctx);
drivers/misc/habanalabs/common/debugfs.c+1−4
@@ -992,7 +992,6 @@ void hl_debugfs_add_device(struct hl_device *hdev) · 991 unmodified lines
992992 struct hl_dbg_device_entry *dev_entry = &hdev->hl_debugfs;
993993 int count = ARRAY_SIZE(hl_debugfs_list);
994994 struct hl_debugfs_entry *entry;
995− struct dentry *ent;
996995 int i;
997996
998997 dev_entry->hdev = hdev;
@@ -1105,13 +1104,11 @@ void hl_debugfs_add_device(struct hl_device *hdev) · 106 unmodified lines
11051104 &hl_security_violations_fops);
11061105
11071106 for (i = 0, entry = dev_entry->entry_arr ; i < count ; i++, entry++) {
1108−
1109− ent = debugfs_create_file(hl_debugfs_list[i].name,
1107+ debugfs_create_file(hl_debugfs_list[i].name,
11101108 0444,
11111109 dev_entry->root,
11121110 entry,
11131111 &hl_debugfs_fops);
1114− entry->dent = ent;
11151112 entry->info_ent = &hl_debugfs_list[i];
11161113 entry->dev_entry = dev_entry;
11171114 }
drivers/misc/habanalabs/common/device.c+35−5
@@ -93,12 +93,19 @@ void hl_hpriv_put(struct hl_fpriv *hpriv) · 92 unmodified lines
9393 static int hl_device_release(struct inode *inode, struct file *filp)
9494 {
9595 struct hl_fpriv *hpriv = filp->private_data;
96+ struct hl_device *hdev = hpriv->hdev;
97+
98+ filp->private_data = NULL;
99+
100+ if (!hdev) {
101+ pr_crit("Closing FD after device was removed. Memory leak will occur and it is advised to reboot.\n");
102+ put_pid(hpriv->taskpid);
103+ return 0;
104+ }
96105
97106 hl_cb_mgr_fini(hpriv->hdev, &hpriv->cb_mgr);
98107 hl_ctx_mgr_fini(hpriv->hdev, &hpriv->ctx_mgr);
99108
100− filp->private_data = NULL;
101−
102109 hl_hpriv_put(hpriv);
103110
104111 return 0;
@@ -107,15 +114,20 @@ static int hl_device_release(struct inode *inode, struct file *filp) · 2 unmodified lines
107114 static int hl_device_release_ctrl(struct inode *inode, struct file *filp)
108115 {
109116 struct hl_fpriv *hpriv = filp->private_data;
110− struct hl_device *hdev;
117+ struct hl_device *hdev = hpriv->hdev;
111118
112119 filp->private_data = NULL;
113120
114− hdev = hpriv->hdev;
121+ if (!hdev) {
122+ pr_err("Closing FD after device was removed\n");
123+ goto out;
124+ }
115125
116126 mutex_lock(&hdev->fpriv_list_lock);
117127 list_del(&hpriv->dev_node);
118128 mutex_unlock(&hdev->fpriv_list_lock);
129+out:
130+ put_pid(hpriv->taskpid);
119131
120132 kfree(hpriv);
121133
@@ -134,8 +146,14 @@ static int hl_device_release_ctrl(struct inode *inode, struct file *filp) · 12 unmodified lines
134146 static int hl_mmap(struct file *filp, struct vm_area_struct *vma)
135147 {
136148 struct hl_fpriv *hpriv = filp->private_data;
149+ struct hl_device *hdev = hpriv->hdev;
137150 unsigned long vm_pgoff;
138151
152+ if (!hdev) {
153+ pr_err_ratelimited("Trying to mmap after device was removed! Please close FD\n");
154+ return -ENODEV;
155+ }
156+
139157 vm_pgoff = vma->vm_pgoff;
140158 vma->vm_pgoff = HL_MMAP_OFFSET_VALUE_GET(vm_pgoff);
141159
@@ -883,6 +901,16 @@ wait_for_processes: · 741 unmodified lines
883901 return -EBUSY;
884902 }
885903
904+static void device_disable_open_processes(struct hl_device *hdev)
905+{
906+ struct hl_fpriv *hpriv;
907+
908+ mutex_lock(&hdev->fpriv_list_lock);
909+ list_for_each_entry(hpriv, &hdev->fpriv_list, dev_node)
910+ hpriv->hdev = NULL;
911+ mutex_unlock(&hdev->fpriv_list_lock);
912+}
913+
886914 /*
887915 * hl_device_reset - reset the device
888916 *
@@ -1556,8 +1584,10 @@ void hl_device_fini(struct hl_device *hdev) · 667 unmodified lines
15561584 HL_PENDING_RESET_LONG_SEC);
15571585
15581586 rc = device_kill_open_processes(hdev, HL_PENDING_RESET_LONG_SEC);
1559− if (rc)
1587+ if (rc) {
15601588 dev_crit(hdev->dev, "Failed to kill all open processes\n");
1589+ device_disable_open_processes(hdev);
1590+ }
15611591
15621592 hl_cb_pool_fini(hdev);
15631593
drivers/misc/habanalabs/common/habanalabs.h+0−2
@@ -1465,12 +1465,10 @@ struct hl_info_list { · 1464 unmodified lines
14651465
14661466 /**
14671467 * struct hl_debugfs_entry - debugfs dentry wrapper.
1468− * @dent: base debugfs entry structure.
14691468 * @info_ent: dentry realted ops.
14701469 * @dev_entry: ASIC specific debugfs manager.
14711470 */
14721471 struct hl_debugfs_entry {
1473− struct dentry *dent;
14741472 const struct hl_info_list *info_ent;
14751473 struct hl_dbg_device_entry *dev_entry;
14761474 };
drivers/misc/habanalabs/common/habanalabs_ioctl.c+12−0
@@ -5,6 +5,8 @@ · 4 unmodified lines
55 * All Rights Reserved.
66 */
77
8+#define pr_fmt(fmt) "habanalabs: " fmt
9+
810 #include <uapi/misc/habanalabs.h>
911 #include "habanalabs.h"
1012
@@ -682,6 +684,11 @@ long hl_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) · 671 unmodified lines
682684 const struct hl_ioctl_desc *ioctl = NULL;
683685 unsigned int nr = _IOC_NR(cmd);
684686
687+ if (!hdev) {
688+ pr_err_ratelimited("Sending ioctl after device was removed! Please close FD\n");
689+ return -ENODEV;
690+ }
691+
685692 if ((nr >= HL_COMMAND_START) && (nr < HL_COMMAND_END)) {
686693 ioctl = &hl_ioctls[nr];
687694 } else {
@@ -700,6 +707,11 @@ long hl_ioctl_control(struct file *filep, unsigned int cmd, unsigned long arg) · 12 unmodified lines
700707 const struct hl_ioctl_desc *ioctl = NULL;
701708 unsigned int nr = _IOC_NR(cmd);
702709
710+ if (!hdev) {
711+ pr_err_ratelimited("Sending ioctl after device was removed! Please close FD\n");
712+ return -ENODEV;
713+ }
714+
703715 if (nr == _IOC_NR(HL_IOCTL_INFO)) {
704716 ioctl = &hl_ioctls_control[nr];
705717 } else {
drivers/misc/habanalabs/common/irq.c+1−1
@@ -47,7 +47,7 @@ inline u32 hl_cq_inc_ptr(u32 ptr) · 46 unmodified lines
4747 * Increment ptr by 1. If it reaches the number of event queue
4848 * entries, set it to 0
4949 */
50−inline u32 hl_eq_inc_ptr(u32 ptr)
50+static inline u32 hl_eq_inc_ptr(u32 ptr)
5151 {
5252 ptr++;
5353 if (unlikely(ptr == HL_EQ_LENGTH))
drivers/misc/habanalabs/common/mmu/mmu.c+26−12
@@ -499,18 +499,32 @@ static void hl_mmu_pa_page_with_offset(struct hl_ctx *ctx, u64 virt_addr, · 498 unmodified lines
499499 else /* HL_VA_RANGE_TYPE_DRAM */
500500 p = &prop->dmmu;
501501
502− /*
503− * find the correct hop shift field in hl_mmu_properties structure
504− * in order to determine the right maks for the page offset.
505− */
506− hop0_shift_off = offsetof(struct hl_mmu_properties, hop0_shift);
507− p = (char *)p + hop0_shift_off;
508− p = (char *)p + ((hops->used_hops - 1) * sizeof(u64));
509− hop_shift = *(u64 *)p;
510− offset_mask = (1ull << hop_shift) - 1;
511− addr_mask = ~(offset_mask);
512− *phys_addr = (tmp_phys_addr & addr_mask) |
513− (virt_addr & offset_mask);
502+ if ((hops->range_type == HL_VA_RANGE_TYPE_DRAM) &&
503+ !is_power_of_2(prop->dram_page_size)) {
504+ u32 bit;
505+ u64 page_offset_mask;
506+ u64 phys_addr_mask;
507+
508+ bit = __ffs64((u64)prop->dram_page_size);
509+ page_offset_mask = ((1ull << bit) - 1);
510+ phys_addr_mask = ~page_offset_mask;
511+ *phys_addr = (tmp_phys_addr & phys_addr_mask) |
512+ (virt_addr & page_offset_mask);
513+ } else {
514+ /*
515+ * find the correct hop shift field in hl_mmu_properties
516+ * structure in order to determine the right masks
517+ * for the page offset.
518+ */
519+ hop0_shift_off = offsetof(struct hl_mmu_properties, hop0_shift);
520+ p = (char *)p + hop0_shift_off;
521+ p = (char *)p + ((hops->used_hops - 1) * sizeof(u64));
522+ hop_shift = *(u64 *)p;
523+ offset_mask = (1ull << hop_shift) - 1;
524+ addr_mask = ~(offset_mask);
525+ *phys_addr = (tmp_phys_addr & addr_mask) |
526+ (virt_addr & offset_mask);
527+ }
514528 }
515529
516530 int hl_mmu_va_to_pa(struct hl_ctx *ctx, u64 virt_addr, u64 *phys_addr)
drivers/misc/ibmvmc.c+1−3
@@ -2288,15 +2288,13 @@ crq_failed: · 2287 unmodified lines
22882288 return -EPERM;
22892289 }
22902290
2291−static int ibmvmc_remove(struct vio_dev *vdev)
2291+static void ibmvmc_remove(struct vio_dev *vdev)
22922292 {
22932293 struct crq_server_adapter *adapter = dev_get_drvdata(&vdev->dev);
22942294
22952295 dev_info(adapter->dev, "Entering remove for UA 0x%x\n",
22962296 vdev->unit_address);
22972297 ibmvmc_release_crq_queue(adapter);
2298−
2299− return 0;
23002298 }
23012299
23022300 static struct vio_device_id ibmvmc_device_table[] = {
drivers/misc/pvpanic.c+1−0
@@ -140,6 +140,7 @@ static const struct of_device_id pvpanic_mmio_match[] = { · 139 unmodified lines
140140 { .compatible = "qemu,pvpanic-mmio", },
141141 {}
142142 };
143+MODULE_DEVICE_TABLE(of, pvpanic_mmio_match);
143144
144145 static const struct acpi_device_id pvpanic_device_ids[] = {
145146 { "QEMU0001", 0 },
drivers/mmc/core/bus.c+5−6
@@ -399,11 +399,6 @@ void mmc_remove_card(struct mmc_card *card) · 398 unmodified lines
399399 mmc_remove_card_debugfs(card);
400400 #endif
401401
402− if (host->cqe_enabled) {
403− host->cqe_ops->cqe_disable(host);
404− host->cqe_enabled = false;
405− }
406−
407402 if (mmc_card_present(card)) {
408403 if (mmc_host_is_spi(card->host)) {
409404 pr_info("%s: SPI card removed\n",
@@ -416,6 +411,10 @@ void mmc_remove_card(struct mmc_card *card) · 6 unmodified lines
416411 of_node_put(card->dev.of_node);
417412 }
418413
414+ if (host->cqe_enabled) {
415+ host->cqe_ops->cqe_disable(host);
416+ host->cqe_enabled = false;
417+ }
418+
419419 put_device(&card->dev);
420420 }
421−
drivers/mmc/core/mmc.c+11−4
@@ -423,10 +423,6 @@ static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd) · 422 unmodified lines
423423
424424 /* EXT_CSD value is in units of 10ms, but we store in ms */
425425 card->ext_csd.part_time = 10 * ext_csd[EXT_CSD_PART_SWITCH_TIME];
426− /* Some eMMC set the value too low so set a minimum */
427− if (card->ext_csd.part_time &&
428− card->ext_csd.part_time < MMC_MIN_PART_SWITCH_TIME)
429− card->ext_csd.part_time = MMC_MIN_PART_SWITCH_TIME;
430426
431427 /* Sleep / awake timeout in 100ns units */
432428 if (sa_shift > 0 && sa_shift <= 0x17)
@@ -616,6 +612,17 @@ static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd) · 183 unmodified lines
616612 card->ext_csd.data_sector_size = 512;
617613 }
618614
615+ /*
616+ * GENERIC_CMD6_TIME is to be used "unless a specific timeout is defined
617+ * when accessing a specific field", so use it here if there is no
618+ * PARTITION_SWITCH_TIME.
619+ */
620+ if (!card->ext_csd.part_time)
621+ card->ext_csd.part_time = card->ext_csd.generic_cmd6_time;
622+ /* Some eMMC set the value too low so set a minimum */
623+ if (card->ext_csd.part_time < MMC_MIN_PART_SWITCH_TIME)
624+ card->ext_csd.part_time = MMC_MIN_PART_SWITCH_TIME;
625+
619626 /* eMMC v5 or later */
620627 if (card->ext_csd.rev >= 7) {
621628 memcpy(card->ext_csd.fwrev, &ext_csd[EXT_CSD_FIRMWARE_VERSION],
drivers/mmc/host/mmci.c+9−1
@@ -1242,7 +1242,11 @@ mmci_start_command(struct mmci_host *host, struct mmc_command *cmd, u32 c) · 1241 unmodified lines
12421242 if (!cmd->busy_timeout)
12431243 cmd->busy_timeout = 10 * MSEC_PER_SEC;
12441244
1245− clks = (unsigned long long)cmd->busy_timeout * host->cclk;
1245+ if (cmd->busy_timeout > host->mmc->max_busy_timeout)
1246+ clks = (unsigned long long)host->mmc->max_busy_timeout * host->cclk;
1247+ else
1248+ clks = (unsigned long long)cmd->busy_timeout * host->cclk;
1249+
12461250 do_div(clks, MSEC_PER_SEC);
12471251 writel_relaxed(clks, host->base + MMCIDATATIMER);
12481252 }
@@ -2151,6 +2155,10 @@ static int mmci_probe(struct amba_device *dev, · 902 unmodified lines
21512155 mmc->caps |= MMC_CAP_WAIT_WHILE_BUSY;
21522156 }
21532157
2158+ /* Variants with mandatory busy timeout in HW needs R1B responses. */
2159+ if (variant->busy_timeout)
2160+ mmc->caps |= MMC_CAP_NEED_RSP_BUSY;
2161+
21542162 /* Prepare a CMD12 - needed to clear the DPSM on some variants. */
21552163 host->stop_abort.opcode = MMC_STOP_TRANSMISSION;
21562164 host->stop_abort.arg = 0;
drivers/net/Kconfig+1−1
@@ -94,7 +94,7 @@ config WIREGUARD · 93 unmodified lines
9494 select CRYPTO_BLAKE2S_ARM if ARM
9595 select CRYPTO_CURVE25519_NEON if ARM && KERNEL_MODE_NEON
9696 select CRYPTO_CHACHA_MIPS if CPU_MIPS32_R2
97− select CRYPTO_POLY1305_MIPS if CPU_MIPS32 || (CPU_MIPS64 && 64BIT)
97+ select CRYPTO_POLY1305_MIPS if MIPS
9898 help
9999 WireGuard is a secure, fast, and easy to use replacement for IPSec
100100 that uses modern cryptography and clever networking tricks. It's
drivers/net/bonding/bond_main.c+6−2
@@ -3978,11 +3978,15 @@ static int bond_neigh_init(struct neighbour *n) · 3977 unmodified lines
39783978
39793979 rcu_read_lock();
39803980 slave = bond_first_slave_rcu(bond);
3981− if (!slave)
3981+ if (!slave) {
3982+ ret = -EINVAL;
39823983 goto out;
3984+ }
39833985 slave_ops = slave->dev->netdev_ops;
3984− if (!slave_ops->ndo_neigh_setup)
3986+ if (!slave_ops->ndo_neigh_setup) {
3987+ ret = -EINVAL;
39853988 goto out;
3989+ }
39863990
39873991 /* TODO: find another way [1] to implement this.
39883992 * Passing a zeroed structure is fragile,
drivers/net/can/flexcan.c+15−9
@@ -701,7 +701,7 @@ static int flexcan_chip_freeze(struct flexcan_priv *priv) · 700 unmodified lines
701701 u32 reg;
702702
703703 reg = priv->read(&regs->mcr);
704− reg |= FLEXCAN_MCR_HALT;
704+ reg |= FLEXCAN_MCR_FRZ | FLEXCAN_MCR_HALT;
705705 priv->write(reg, &regs->mcr);
706706
707707 while (timeout-- && !(priv->read(&regs->mcr) & FLEXCAN_MCR_FRZ_ACK))
@@ -1480,10 +1480,13 @@ static int flexcan_chip_start(struct net_device *dev) · 772 unmodified lines
14801480
14811481 flexcan_set_bittiming(dev);
14821482
1483+ /* set freeze, halt */
1484+ err = flexcan_chip_freeze(priv);
1485+ if (err)
1486+ goto out_chip_disable;
1487+
14831488 /* MCR
14841489 *
1485− * enable freeze
1486− * halt now
14871490 * only supervisor access
14881491 * enable warning int
14891492 * enable individual RX masking
@@ -1492,9 +1495,8 @@ static int flexcan_chip_start(struct net_device *dev) · 2 unmodified lines
14921495 */
14931496 reg_mcr = priv->read(&regs->mcr);
14941497 reg_mcr &= ~FLEXCAN_MCR_MAXMB(0xff);
1495− reg_mcr |= FLEXCAN_MCR_FRZ | FLEXCAN_MCR_HALT | FLEXCAN_MCR_SUPV |
1496− FLEXCAN_MCR_WRN_EN | FLEXCAN_MCR_IRMQ | FLEXCAN_MCR_IDAM_C |
1497− FLEXCAN_MCR_MAXMB(priv->tx_mb_idx);
1498+ reg_mcr |= FLEXCAN_MCR_SUPV | FLEXCAN_MCR_WRN_EN | FLEXCAN_MCR_IRMQ |
1499+ FLEXCAN_MCR_IDAM_C | FLEXCAN_MCR_MAXMB(priv->tx_mb_idx);
14981500
14991501 /* MCR
15001502 *
@@ -1865,10 +1867,14 @@ static int register_flexcandev(struct net_device *dev) · 364 unmodified lines
18651867 if (err)
18661868 goto out_chip_disable;
18671869
1868− /* set freeze, halt and activate FIFO, restrict register access */
1870+ /* set freeze, halt */
1871+ err = flexcan_chip_freeze(priv);
1872+ if (err)
1873+ goto out_chip_disable;
1874+
1875+ /* activate FIFO, restrict register access */
18691876 reg = priv->read(&regs->mcr);
1870− reg |= FLEXCAN_MCR_FRZ | FLEXCAN_MCR_HALT |
1871− FLEXCAN_MCR_FEN | FLEXCAN_MCR_SUPV;
1877+ reg |= FLEXCAN_MCR_FEN | FLEXCAN_MCR_SUPV;
18721878 priv->write(reg, &regs->mcr);
18731879
18741880 /* Currently we only support newer versions of this core
drivers/net/can/m_can/tcan4x5x-core.c+3−3
@@ -237,14 +237,14 @@ static int tcan4x5x_init(struct m_can_classdev *cdev) · 236 unmodified lines
237237 if (ret)
238238 return ret;
239239
240+ /* Zero out the MCAN buffers */
241+ m_can_init_ram(cdev);
242+
240243 ret = regmap_update_bits(tcan4x5x->regmap, TCAN4X5X_CONFIG,
241244 TCAN4X5X_MODE_SEL_MASK, TCAN4X5X_MODE_NORMAL);
242245 if (ret)
243246 return ret;
244247
245− /* Zero out the MCAN buffers */
246− m_can_init_ram(cdev);
247−
248248 return ret;
249249 }
250250
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c+4−17
@@ -335,8 +335,6 @@ static void mcp251xfd_ring_init(struct mcp251xfd_priv *priv) · 334 unmodified lines
335335 u8 len;
336336 int i, j;
337337
338− netdev_reset_queue(priv->ndev);
339−
340338 /* TEF */
341339 tef_ring = priv->tef;
342340 tef_ring->head = 0;
@@ -1249,8 +1247,7 @@ mcp251xfd_handle_tefif_recover(const struct mcp251xfd_priv *priv, const u32 seq) · 906 unmodified lines
12491247
12501248 static int
12511249 mcp251xfd_handle_tefif_one(struct mcp251xfd_priv *priv,
1252− const struct mcp251xfd_hw_tef_obj *hw_tef_obj,
1253− unsigned int *frame_len_ptr)
1250+ const struct mcp251xfd_hw_tef_obj *hw_tef_obj)
12541251 {
12551252 struct net_device_stats *stats = &priv->ndev->stats;
12561253 u32 seq, seq_masked, tef_tail_masked;
@@ -1272,8 +1269,7 @@ mcp251xfd_handle_tefif_one(struct mcp251xfd_priv *priv, · 15 unmodified lines
12721269 stats->tx_bytes +=
12731270 can_rx_offload_get_echo_skb(&priv->offload,
12741271 mcp251xfd_get_tef_tail(priv),
1275− hw_tef_obj->ts,
1276− frame_len_ptr);
1272+ hw_tef_obj->ts, NULL);
12771273 stats->tx_packets++;
12781274 priv->tef->tail++;
12791275
@@ -1331,7 +1327,6 @@ mcp251xfd_tef_obj_read(const struct mcp251xfd_priv *priv, · 51 unmodified lines
13311327 static int mcp251xfd_handle_tefif(struct mcp251xfd_priv *priv)
13321328 {
13331329 struct mcp251xfd_hw_tef_obj hw_tef_obj[MCP251XFD_TX_OBJ_NUM_MAX];
1334− unsigned int total_frame_len = 0;
13351330 u8 tef_tail, len, l;
13361331 int err, i;
13371332
@@ -1353,9 +1348,7 @@ static int mcp251xfd_handle_tefif(struct mcp251xfd_priv *priv) · 15 unmodified lines
13531348 }
13541349
13551350 for (i = 0; i < len; i++) {
1356− unsigned int frame_len;
1357−
1358− err = mcp251xfd_handle_tefif_one(priv, &hw_tef_obj[i], &frame_len);
1351+ err = mcp251xfd_handle_tefif_one(priv, &hw_tef_obj[i]);
13591352 /* -EAGAIN means the Sequence Number in the TEF
13601353 * doesn't match our tef_tail. This can happen if we
13611354 * read the TEF objects too early. Leave loop let the
@@ -1365,8 +1358,6 @@ static int mcp251xfd_handle_tefif(struct mcp251xfd_priv *priv) · 3 unmodified lines
13651358 goto out_netif_wake_queue;
13661359 if (err)
13671360 return err;
1368−
1369− total_frame_len += frame_len;
13701361 }
13711362
13721363 out_netif_wake_queue:
@@ -1397,7 +1388,6 @@ static int mcp251xfd_handle_tefif(struct mcp251xfd_priv *priv) · 24 unmodified lines
13971388 return err;
13981389
13991390 tx_ring->tail += len;
1400− netdev_completed_queue(priv->ndev, len, total_frame_len);
14011391
14021392 err = mcp251xfd_check_tef_tail(priv);
14031393 if (err)
@@ -2443,7 +2433,6 @@ static netdev_tx_t mcp251xfd_start_xmit(struct sk_buff *skb, · 1039 unmodified lines
24432433 struct mcp251xfd_priv *priv = netdev_priv(ndev);
24442434 struct mcp251xfd_tx_ring *tx_ring = priv->tx;
24452435 struct mcp251xfd_tx_obj *tx_obj;
2446− unsigned int frame_len;
24472436 u8 tx_head;
24482437 int err;
24492438
@@ -2462,9 +2451,7 @@ static netdev_tx_t mcp251xfd_start_xmit(struct sk_buff *skb, · 12 unmodified lines
24622451 if (mcp251xfd_get_tx_free(tx_ring) == 0)
24632452 netif_stop_queue(ndev);
24642453
2465− frame_len = can_skb_get_frame_len(skb);
2466− can_put_echo_skb(skb, ndev, tx_head, frame_len);
2467− netdev_sent_queue(priv->ndev, frame_len);
2454+ can_put_echo_skb(skb, ndev, tx_head, 0);
24682455
24692456 err = mcp251xfd_tx_obj_write(priv, tx_obj);
24702457 if (err)
drivers/net/dsa/bcm_sf2.c+3−3
@@ -406,7 +406,7 @@ static int bcm_sf2_sw_rst(struct bcm_sf2_priv *priv) · 405 unmodified lines
406406 /* The watchdog reset does not work on 7278, we need to hit the
407407 * "external" reset line through the reset controller.
408408 */
409− if (priv->type == BCM7278_DEVICE_ID && !IS_ERR(priv->rcdev)) {
409+ if (priv->type == BCM7278_DEVICE_ID) {
410410 ret = reset_control_assert(priv->rcdev);
411411 if (ret)
412412 return ret;
@@ -1265,7 +1265,7 @@ static int bcm_sf2_sw_probe(struct platform_device *pdev) · 852 unmodified lines
12651265
12661266 priv->rcdev = devm_reset_control_get_optional_exclusive(&pdev->dev,
12671267 "switch");
1268− if (PTR_ERR(priv->rcdev) == -EPROBE_DEFER)
1268+ if (IS_ERR(priv->rcdev))
12691269 return PTR_ERR(priv->rcdev);
12701270
12711271 /* Auto-detection using standard registers will not work, so
@@ -1426,7 +1426,7 @@ static int bcm_sf2_sw_remove(struct platform_device *pdev) · 154 unmodified lines
14261426 bcm_sf2_mdio_unregister(priv);
14271427 clk_disable_unprepare(priv->clk_mdiv);
14281428 clk_disable_unprepare(priv->clk);
1429− if (priv->type == BCM7278_DEVICE_ID && !IS_ERR(priv->rcdev))
1429+ if (priv->type == BCM7278_DEVICE_ID)
14301430 reset_control_assert(priv->rcdev);
14311431
14321432 return 0;
drivers/net/dsa/mt7530.c+4−0
@@ -1624,6 +1624,7 @@ mtk_get_tag_protocol(struct dsa_switch *ds, int port, · 1623 unmodified lines
16241624 }
16251625 }
16261626
1627+#ifdef CONFIG_GPIOLIB
16271628 static inline u32
16281629 mt7530_gpio_to_bit(unsigned int offset)
16291630 {
@@ -1726,6 +1727,7 @@ mt7530_setup_gpio(struct mt7530_priv *priv) · 96 unmodified lines
17261727
17271728 return devm_gpiochip_add_data(dev, gc, priv);
17281729 }
1730+#endif /* CONFIG_GPIOLIB */
17291731
17301732 static int
17311733 mt7530_setup(struct dsa_switch *ds)
@@ -1868,11 +1870,13 @@ mt7530_setup(struct dsa_switch *ds) · 136 unmodified lines
18681870 }
18691871 }
18701872
1873+#ifdef CONFIG_GPIOLIB
18711874 if (of_property_read_bool(priv->dev->of_node, "gpio-controller")) {
18721875 ret = mt7530_setup_gpio(priv);
18731876 if (ret)
18741877 return ret;
18751878 }
1879+#endif /* CONFIG_GPIOLIB */
18761880
18771881 mt7530_setup_port5(ds, interface);
18781882
drivers/net/dsa/sja1105/sja1105_main.c+3−3
@@ -1922,7 +1922,7 @@ out_unlock_ptp: · 1921 unmodified lines
19221922 speed = SPEED_1000;
19231923 else if (bmcr & BMCR_SPEED100)
19241924 speed = SPEED_100;
1925− else if (bmcr & BMCR_SPEED10)
1925+ else
19261926 speed = SPEED_10;
19271927
19281928 sja1105_sgmii_pcs_force_speed(priv, speed);
@@ -3369,14 +3369,14 @@ static int sja1105_port_ucast_bcast_flood(struct sja1105_private *priv, int to, · 1440 unmodified lines
33693369 if (flags.val & BR_FLOOD)
33703370 priv->ucast_egress_floods |= BIT(to);
33713371 else
3372− priv->ucast_egress_floods |= BIT(to);
3372+ priv->ucast_egress_floods &= ~BIT(to);
33733373 }
33743374
33753375 if (flags.mask & BR_BCAST_FLOOD) {
33763376 if (flags.val & BR_BCAST_FLOOD)
33773377 priv->bcast_egress_floods |= BIT(to);
33783378 else
3379− priv->bcast_egress_floods |= BIT(to);
3379+ priv->bcast_egress_floods &= ~BIT(to);
33803380 }
33813381
33823382 return sja1105_manage_flood_domains(priv);
drivers/net/dsa/xrs700x/xrs700x.c+8−2
@@ -528,7 +528,10 @@ static int xrs700x_hsr_join(struct dsa_switch *ds, int port, · 527 unmodified lines
528528 return -EOPNOTSUPP;
529529
530530 dsa_hsr_foreach_port(dp, ds, hsr) {
531− partner = dp;
531+ if (dp->index != port) {
532+ partner = dp;
533+ break;
534+ }
532535 }
533536
534537 /* We can't enable redundancy on the switch until both
@@ -582,7 +585,10 @@ static int xrs700x_hsr_leave(struct dsa_switch *ds, int port, · 47 unmodified lines
582585 unsigned int val;
583586
584587 dsa_hsr_foreach_port(dp, ds, hsr) {
585− partner = dp;
588+ if (dp->index != port) {
589+ partner = dp;
590+ break;
591+ }
586592 }
587593
588594 if (!partner)
drivers/net/ethernet/atheros/alx/main.c+5−2
@@ -1894,13 +1894,16 @@ static int alx_resume(struct device *dev) · 1893 unmodified lines
18941894
18951895 if (!netif_running(alx->dev))
18961896 return 0;
1897− netif_device_attach(alx->dev);
18981897
18991898 rtnl_lock();
19001899 err = __alx_open(alx, true);
19011900 rtnl_unlock();
1901+ if (err)
1902+ return err;
19021903
1903− return err;
1904+ netif_device_attach(alx->dev);
1905+
1906+ return 0;
19041907 }
19051908
19061909 static SIMPLE_DEV_PM_OPS(alx_pm_ops, alx_suspend, alx_resume);
drivers/net/ethernet/broadcom/bcm4908_enet.c+3−0
@@ -592,6 +592,9 @@ static int bcm4908_enet_poll(struct napi_struct *napi, int weight) · 591 unmodified lines
592592 bcm4908_enet_intrs_on(enet);
593593 }
594594
595+ /* Hardware could disable ring if it run out of descriptors */
596+ bcm4908_enet_dma_rx_ring_enable(enet, &enet->rx_ring);
597+
595598 return handled;
596599 }
597600
drivers/net/ethernet/broadcom/bnxt/bnxt.c+15−2
@@ -8556,10 +8556,18 @@ static void bnxt_setup_inta(struct bnxt *bp) · 8555 unmodified lines
85568556 bp->irq_tbl[0].handler = bnxt_inta;
85578557 }
85588558
8559+static int bnxt_init_int_mode(struct bnxt *bp);
8560+
85598561 static int bnxt_setup_int_mode(struct bnxt *bp)
85608562 {
85618563 int rc;
85628564
8565+ if (!bp->irq_tbl) {
8566+ rc = bnxt_init_int_mode(bp);
8567+ if (rc || !bp->irq_tbl)
8568+ return rc ?: -ENODEV;
8569+ }
8570+
85638571 if (bp->flags & BNXT_FLAG_USING_MSIX)
85648572 bnxt_setup_msix(bp);
85658573 else
@@ -8744,7 +8752,7 @@ static int bnxt_init_inta(struct bnxt *bp) · 178 unmodified lines
87448752
87458753 static int bnxt_init_int_mode(struct bnxt *bp)
87468754 {
8747− int rc = 0;
8755+ int rc = -ENODEV;
87488756
87498757 if (bp->flags & BNXT_FLAG_MSIX_CAP)
87508758 rc = bnxt_init_msix(bp);
@@ -9514,7 +9522,8 @@ static int bnxt_hwrm_if_change(struct bnxt *bp, bool up) · 763 unmodified lines
95149522 {
95159523 struct hwrm_func_drv_if_change_output *resp = bp->hwrm_cmd_resp_addr;
95169524 struct hwrm_func_drv_if_change_input req = {0};
9517− bool resc_reinit = false, fw_reset = false;
9525+ bool fw_reset = !bp->irq_tbl;
9526+ bool resc_reinit = false;
95189527 int rc, retry = 0;
95199528 u32 flags = 0;
95209529
@@ -9557,6 +9566,7 @@ static int bnxt_hwrm_if_change(struct bnxt *bp, bool up) · 36 unmodified lines
95579566
95589567 if (test_bit(BNXT_STATE_IN_FW_RESET, &bp->state) && !fw_reset) {
95599568 netdev_err(bp->dev, "RESET_DONE not set during FW reset.\n");
9569+ set_bit(BNXT_STATE_ABORT_ERR, &bp->state);
95609570 return -ENODEV;
95619571 }
95629572 if (resc_reinit || fw_reset) {
@@ -9890,6 +9900,9 @@ static int bnxt_reinit_after_abort(struct bnxt *bp) · 327 unmodified lines
98909900 if (test_bit(BNXT_STATE_IN_FW_RESET, &bp->state))
98919901 return -EBUSY;
98929902
9903+ if (bp->dev->reg_state == NETREG_UNREGISTERED)
9904+ return -ENODEV;
9905+
98939906 rc = bnxt_fw_init_one(bp);
98949907 if (!rc) {
98959908 bnxt_clear_int_mode(bp);
drivers/net/ethernet/cadence/macb_main.c+8−7
@@ -3954,6 +3954,13 @@ static int macb_init(struct platform_device *pdev) · 3953 unmodified lines
39543954 return 0;
39553955 }
39563956
3957+static const struct macb_usrio_config macb_default_usrio = {
3958+ .mii = MACB_BIT(MII),
3959+ .rmii = MACB_BIT(RMII),
3960+ .rgmii = GEM_BIT(RGMII),
3961+ .refclk = MACB_BIT(CLKEN),
3962+};
3963+
39573964 #if defined(CONFIG_OF)
39583965 /* 1518 rounded up */
39593966 #define AT91ETHER_MAX_RBUFF_SZ 0x600
@@ -4439,13 +4446,6 @@ static int fu540_c000_init(struct platform_device *pdev) · 479 unmodified lines
44394446 return macb_init(pdev);
44404447 }
44414448
4442−static const struct macb_usrio_config macb_default_usrio = {
4443− .mii = MACB_BIT(MII),
4444− .rmii = MACB_BIT(RMII),
4445− .rgmii = GEM_BIT(RGMII),
4446− .refclk = MACB_BIT(CLKEN),
4447−};
4448−
44494449 static const struct macb_usrio_config sama7g5_usrio = {
44504450 .mii = 0,
44514451 .rmii = 1,
@@ -4594,6 +4594,7 @@ static const struct macb_config default_gem_config = { · 142 unmodified lines
45944594 .dma_burst_length = 16,
45954595 .clk_init = macb_clk_init,
45964596 .init = macb_init,
4597+ .usrio = &macb_default_usrio,
45974598 .jumbo_max_len = 10240,
45984599 };
45994600
drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c+4−4
@@ -672,7 +672,7 @@ static int chcr_ktls_cpl_act_open_rpl(struct adapter *adap, · 671 unmodified lines
672672 if (tx_info->pending_close) {
673673 spin_unlock(&tx_info->lock);
674674 if (!status) {
675− /* it's a late success, tcb status is establised,
675+ /* it's a late success, tcb status is established,
676676 * mark it close.
677677 */
678678 chcr_ktls_mark_tcb_close(tx_info);
@@ -930,7 +930,7 @@ chcr_ktls_get_tx_flits(u32 nr_frags, unsigned int key_ctx_len) · 251 unmodified lines
930930 }
931931
932932 /*
933− * chcr_ktls_check_tcp_options: To check if there is any TCP option availbale
933+ * chcr_ktls_check_tcp_options: To check if there is any TCP option available
934934 * other than timestamp.
935935 * @skb - skb contains partial record..
936936 * return: 1 / 0
@@ -1115,7 +1115,7 @@ static int chcr_ktls_xmit_wr_complete(struct sk_buff *skb, · 178 unmodified lines
11151115 }
11161116
11171117 if (unlikely(credits < ETHTXQ_STOP_THRES)) {
1118− /* Credits are below the threshold vaues, stop the queue after
1118+ /* Credits are below the threshold values, stop the queue after
11191119 * injecting the Work Request for this packet.
11201120 */
11211121 chcr_eth_txq_stop(q);
@@ -2006,7 +2006,7 @@ static int chcr_ktls_xmit(struct sk_buff *skb, struct net_device *dev) · 884 unmodified lines
20062006
20072007 /* TCP segments can be in received either complete or partial.
20082008 * chcr_end_part_handler will handle cases if complete record or end
2009− * part of the record is received. Incase of partial end part of record,
2009+ * part of the record is received. In case of partial end part of record,
20102010 * we will send the complete record again.
20112011 */
20122012
drivers/net/ethernet/davicom/dm9000.c+18−5
@@ -133,6 +133,8 @@ struct board_info { · 132 unmodified lines
133133 u32 wake_state;
134134
135135 int ip_summed;
136+
137+ struct regulator *power_supply;
136138 };
137139
138140 /* debug code */
@@ -1449,7 +1451,7 @@ dm9000_probe(struct platform_device *pdev) · 1310 unmodified lines
14491451 if (ret) {
14501452 dev_err(dev, "failed to request reset gpio %d: %d\n",
14511453 reset_gpios, ret);
1452− return -ENODEV;
1454+ goto out_regulator_disable;
14531455 }
14541456
14551457 /* According to manual PWRST# Low Period Min 1ms */
@@ -1461,8 +1463,10 @@ dm9000_probe(struct platform_device *pdev) · 5 unmodified lines
14611463
14621464 if (!pdata) {
14631465 pdata = dm9000_parse_dt(&pdev->dev);
1464− if (IS_ERR(pdata))
1465− return PTR_ERR(pdata);
1466+ if (IS_ERR(pdata)) {
1467+ ret = PTR_ERR(pdata);
1468+ goto out_regulator_disable;
1469+ }
14661470 }
14671471
14681472 /* Init network device */
@@ -1479,6 +1483,8 @@ dm9000_probe(struct platform_device *pdev) · 10 unmodified lines
14791483
14801484 db->dev = &pdev->dev;
14811485 db->ndev = ndev;
1486+ if (!IS_ERR(power))
1487+ db->power_supply = power;
14821488
14831489 spin_lock_init(&db->lock);
14841490 mutex_init(&db->addr_lock);
@@ -1501,7 +1507,7 @@ dm9000_probe(struct platform_device *pdev) · 16 unmodified lines
15011507 goto out;
15021508 }
15031509
1504− db->irq_wake = platform_get_irq(pdev, 1);
1510+ db->irq_wake = platform_get_irq_optional(pdev, 1);
15051511 if (db->irq_wake >= 0) {
15061512 dev_dbg(db->dev, "wakeup irq %d\n", db->irq_wake);
15071513
@@ -1703,6 +1709,10 @@ out: · 195 unmodified lines
17031709 dm9000_release_board(pdev, db);
17041710 free_netdev(ndev);
17051711
1712+out_regulator_disable:
1713+ if (!IS_ERR(power))
1714+ regulator_disable(power);
1715+
17061716 return ret;
17071717 }
17081718
@@ -1760,10 +1770,13 @@ static int · 51 unmodified lines
17601770 dm9000_drv_remove(struct platform_device *pdev)
17611771 {
17621772 struct net_device *ndev = platform_get_drvdata(pdev);
1773+ struct board_info *dm = to_dm9000_board(ndev);
17631774
17641775 unregister_netdev(ndev);
1765− dm9000_release_board(pdev, netdev_priv(ndev));
1776+ dm9000_release_board(pdev, dm);
17661777 free_netdev(ndev); /* free device structure */
1778+ if (dm->power_supply)
1779+ regulator_disable(dm->power_supply);
17671780
17681781 dev_dbg(&pdev->dev, "released and freed device\n");
17691782 return 0;
drivers/net/ethernet/freescale/enetc/enetc.c+50−43
@@ -281,6 +281,8 @@ static int enetc_poll(struct napi_struct *napi, int budget) · 280 unmodified lines
281281 int work_done;
282282 int i;
283283
284+ enetc_lock_mdio();
285+
284286 for (i = 0; i < v->count_tx_rings; i++)
285287 if (!enetc_clean_tx_ring(&v->tx_ring[i], budget))
286288 complete = false;
@@ -291,8 +293,10 @@ static int enetc_poll(struct napi_struct *napi, int budget) · 4 unmodified lines
291293 if (work_done)
292294 v->rx_napi_work = true;
293295
294− if (!complete)
296+ if (!complete) {
297+ enetc_unlock_mdio();
295298 return budget;
299+ }
296300
297301 napi_complete_done(napi, work_done);
298302
@@ -301,8 +305,6 @@ static int enetc_poll(struct napi_struct *napi, int budget) · 2 unmodified lines
301305
302306 v->rx_napi_work = false;
303307
304− enetc_lock_mdio();
305−
306308 /* enable interrupts */
307309 enetc_wr_reg_hot(v->rbier, ENETC_RBIER_RXTIE);
308310
@@ -327,8 +329,8 @@ static void enetc_get_tx_tstamp(struct enetc_hw *hw, union enetc_tx_bd *txbd, · 18 unmodified lines
327329 {
328330 u32 lo, hi, tstamp_lo;
329331
330− lo = enetc_rd(hw, ENETC_SICTR0);
331− hi = enetc_rd(hw, ENETC_SICTR1);
332+ lo = enetc_rd_hot(hw, ENETC_SICTR0);
333+ hi = enetc_rd_hot(hw, ENETC_SICTR1);
332334 tstamp_lo = le32_to_cpu(txbd->wb.tstamp);
333335 if (lo <= tstamp_lo)
334336 hi -= 1;
@@ -342,6 +344,12 @@ static void enetc_tstamp_tx(struct sk_buff *skb, u64 tstamp) · 7 unmodified lines
342344 if (skb_shinfo(skb)->tx_flags & SKBTX_IN_PROGRESS) {
343345 memset(&shhwtstamps, 0, sizeof(shhwtstamps));
344346 shhwtstamps.hwtstamp = ns_to_ktime(tstamp);
347+ /* Ensure skb_mstamp_ns, which might have been populated with
348+ * the txtime, is not mistaken for a software timestamp,
349+ * because this will prevent the dispatch of our hardware
350+ * timestamp to the socket.
351+ */
352+ skb->tstamp = ktime_set(0, 0);
345353 skb_tstamp_tx(skb, &shhwtstamps);
346354 }
347355 }
@@ -358,9 +366,7 @@ static bool enetc_clean_tx_ring(struct enetc_bdr *tx_ring, int napi_budget) · 10 unmodified lines
358366 i = tx_ring->next_to_clean;
359367 tx_swbd = &tx_ring->tx_swbd[i];
360368
361− enetc_lock_mdio();
362369 bds_to_clean = enetc_bd_ready_count(tx_ring, i);
363− enetc_unlock_mdio();
364370
365371 do_tstamp = false;
366372
@@ -403,8 +409,6 @@ static bool enetc_clean_tx_ring(struct enetc_bdr *tx_ring, int napi_budget) · 36 unmodified lines
403409 tx_swbd = tx_ring->tx_swbd;
404410 }
405411
406− enetc_lock_mdio();
407−
408412 /* BD iteration loop end */
409413 if (is_eof) {
410414 tx_frm_cnt++;
@@ -415,8 +419,6 @@ static bool enetc_clean_tx_ring(struct enetc_bdr *tx_ring, int napi_budget) · 4 unmodified lines
415419
416420 if (unlikely(!bds_to_clean))
417421 bds_to_clean = enetc_bd_ready_count(tx_ring, i);
418−
419− enetc_unlock_mdio();
420422 }
421423
422424 tx_ring->next_to_clean = i;
@@ -527,9 +529,8 @@ static void enetc_get_rx_tstamp(struct net_device *ndev, · 104 unmodified lines
527529 static void enetc_get_offloads(struct enetc_bdr *rx_ring,
528530 union enetc_rx_bd *rxbd, struct sk_buff *skb)
529531 {
530−#ifdef CONFIG_FSL_ENETC_PTP_CLOCK
531532 struct enetc_ndev_priv *priv = netdev_priv(rx_ring->ndev);
532−#endif
533+
533534 /* TODO: hashing */
534535 if (rx_ring->ndev->features & NETIF_F_RXCSUM) {
535536 u16 inet_csum = le16_to_cpu(rxbd->r.inet_csum);
@@ -538,12 +539,31 @@ static void enetc_get_offloads(struct enetc_bdr *rx_ring, · 2 unmodified lines
538539 skb->ip_summed = CHECKSUM_COMPLETE;
539540 }
540541
541− /* copy VLAN to skb, if one is extracted, for now we assume it's a
542− * standard TPID, but HW also supports custom values
543− */
544− if (le16_to_cpu(rxbd->r.flags) & ENETC_RXBD_FLAG_VLAN)
545− __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
546− le16_to_cpu(rxbd->r.vlan_opt));
542+ if (le16_to_cpu(rxbd->r.flags) & ENETC_RXBD_FLAG_VLAN) {
543+ __be16 tpid = 0;
544+
545+ switch (le16_to_cpu(rxbd->r.flags) & ENETC_RXBD_FLAG_TPID) {
546+ case 0:
547+ tpid = htons(ETH_P_8021Q);
548+ break;
549+ case 1:
550+ tpid = htons(ETH_P_8021AD);
551+ break;
552+ case 2:
553+ tpid = htons(enetc_port_rd(&priv->si->hw,
554+ ENETC_PCVLANR1));
555+ break;
556+ case 3:
557+ tpid = htons(enetc_port_rd(&priv->si->hw,
558+ ENETC_PCVLANR2));
559+ break;
560+ default:
561+ break;
562+ }
563+
564+ __vlan_hwaccel_put_tag(skb, tpid, le16_to_cpu(rxbd->r.vlan_opt));
565+ }
566+
547567 #ifdef CONFIG_FSL_ENETC_PTP_CLOCK
548568 if (priv->active_offloads & ENETC_F_RX_TSTAMP)
549569 enetc_get_rx_tstamp(rx_ring->ndev, rxbd, skb);
@@ -660,8 +680,6 @@ static int enetc_clean_rx_ring(struct enetc_bdr *rx_ring, · 110 unmodified lines
660680 u32 bd_status;
661681 u16 size;
662682
663− enetc_lock_mdio();
664−
665683 if (cleaned_cnt >= ENETC_RXBD_BUNDLE) {
666684 int count = enetc_refill_rx_ring(rx_ring, cleaned_cnt);
667685
@@ -672,19 +690,15 @@ static int enetc_clean_rx_ring(struct enetc_bdr *rx_ring, · 4 unmodified lines
672690
673691 rxbd = enetc_rxbd(rx_ring, i);
674692 bd_status = le32_to_cpu(rxbd->r.lstatus);
675− if (!bd_status) {
676− enetc_unlock_mdio();
693+ if (!bd_status)
677694 break;
678− }
679695
680696 enetc_wr_reg_hot(rx_ring->idr, BIT(rx_ring->index));
681697 dma_rmb(); /* for reading other rxbd fields */
682698 size = le16_to_cpu(rxbd->r.buf_len);
683699 skb = enetc_map_rx_buff_to_skb(rx_ring, i, size);
684− if (!skb) {
685− enetc_unlock_mdio();
700+ if (!skb)
686701 break;
687− }
688702
689703 enetc_get_offloads(rx_ring, rxbd, skb);
690704
@@ -696,7 +710,6 @@ static int enetc_clean_rx_ring(struct enetc_bdr *rx_ring, · 5 unmodified lines
696710
697711 if (unlikely(bd_status &
698712 ENETC_RXBD_LSTATUS(ENETC_RXBD_ERR_MASK))) {
699− enetc_unlock_mdio();
700713 dev_kfree_skb(skb);
701714 while (!(bd_status & ENETC_RXBD_LSTATUS_F)) {
702715 dma_rmb();
@@ -736,8 +749,6 @@ static int enetc_clean_rx_ring(struct enetc_bdr *rx_ring, · 33 unmodified lines
736749
737750 enetc_process_skb(rx_ring, skb);
738751
739− enetc_unlock_mdio();
740−
741752 napi_gro_receive(napi, skb);
742753
743754 rx_frm_cnt++;
@@ -984,7 +995,7 @@ static void enetc_free_rxtx_rings(struct enetc_ndev_priv *priv) · 240 unmodified lines
984995 enetc_free_tx_ring(priv->tx_ring[i]);
985996 }
986997
987−static int enetc_alloc_cbdr(struct device *dev, struct enetc_cbdr *cbdr)
998+int enetc_alloc_cbdr(struct device *dev, struct enetc_cbdr *cbdr)
988999 {
9891000 int size = cbdr->bd_count * sizeof(struct enetc_cbd);
9901001
@@ -1005,7 +1016,7 @@ static int enetc_alloc_cbdr(struct device *dev, struct enetc_cbdr *cbdr) · 14 unmodified lines
10051016 return 0;
10061017 }
10071018
1008−static void enetc_free_cbdr(struct device *dev, struct enetc_cbdr *cbdr)
1019+void enetc_free_cbdr(struct device *dev, struct enetc_cbdr *cbdr)
10091020 {
10101021 int size = cbdr->bd_count * sizeof(struct enetc_cbd);
10111022
@@ -1013,7 +1024,7 @@ static void enetc_free_cbdr(struct device *dev, struct enetc_cbdr *cbdr) · 1 unmodified line
10131024 cbdr->bd_base = NULL;
10141025 }
10151026
1016−static void enetc_setup_cbdr(struct enetc_hw *hw, struct enetc_cbdr *cbdr)
1027+void enetc_setup_cbdr(struct enetc_hw *hw, struct enetc_cbdr *cbdr)
10171028 {
10181029 /* set CBDR cache attributes */
10191030 enetc_wr(hw, ENETC_SICAR2,
@@ -1033,7 +1044,7 @@ static void enetc_setup_cbdr(struct enetc_hw *hw, struct enetc_cbdr *cbdr) · 13 unmodified lines
10331044 cbdr->cir = hw->reg + ENETC_SICBDRCIR;
10341045 }
10351046
1036−static void enetc_clear_cbdr(struct enetc_hw *hw)
1047+void enetc_clear_cbdr(struct enetc_hw *hw)
10371048 {
10381049 enetc_wr(hw, ENETC_SICBDRMR, 0);
10391050 }
@@ -1058,13 +1069,12 @@ static int enetc_setup_default_rss_table(struct enetc_si *si, int num_groups) · 18 unmodified lines
10581069 return 0;
10591070 }
10601071
1061−static int enetc_configure_si(struct enetc_ndev_priv *priv)
1072+int enetc_configure_si(struct enetc_ndev_priv *priv)
10621073 {
10631074 struct enetc_si *si = priv->si;
10641075 struct enetc_hw *hw = &si->hw;
10651076 int err;
10661077
1067− enetc_setup_cbdr(hw, &si->cbd_ring);
10681078 /* set SI cache attributes */
10691079 enetc_wr(hw, ENETC_SICAR0,
10701080 ENETC_SICAR_RD_COHERENT | ENETC_SICAR_WR_COHERENT);
@@ -1112,6 +1122,8 @@ int enetc_alloc_si_resources(struct enetc_ndev_priv *priv) · 41 unmodified lines
11121122 if (err)
11131123 return err;
11141124
1125+ enetc_setup_cbdr(&si->hw, &si->cbd_ring);
1126+
11151127 priv->cls_rules = kcalloc(si->num_fs_entries, sizeof(*priv->cls_rules),
11161128 GFP_KERNEL);
11171129 if (!priv->cls_rules) {
@@ -1119,14 +1131,8 @@ int enetc_alloc_si_resources(struct enetc_ndev_priv *priv) · 1 unmodified line
11191131 goto err_alloc_cls;
11201132 }
11211133
1122− err = enetc_configure_si(priv);
1123− if (err)
1124− goto err_config_si;
1125−
11261134 return 0;
11271135
1128−err_config_si:
1129− kfree(priv->cls_rules);
11301136 err_alloc_cls:
11311137 enetc_clear_cbdr(&si->hw);
11321138 enetc_free_cbdr(priv->dev, &si->cbd_ring);
@@ -1212,7 +1218,8 @@ static void enetc_setup_rxbdr(struct enetc_hw *hw, struct enetc_bdr *rx_ring) · 79 unmodified lines
12121218 rx_ring->idr = hw->reg + ENETC_SIRXIDR;
12131219
12141220 enetc_refill_rx_ring(rx_ring, enetc_bd_unused(rx_ring));
1215− enetc_wr(hw, ENETC_SIRXIDR, rx_ring->next_to_use);
1221+ /* update ENETC's consumer index */
1222+ enetc_rxbdr_wr(hw, idx, ENETC_RBCIR, rx_ring->next_to_use);
12161223
12171224 /* enable ring */
12181225 enetc_rxbdr_wr(hw, idx, ENETC_RBMR, rbmr);
drivers/net/ethernet/freescale/enetc/enetc.h+5−0
@@ -292,6 +292,7 @@ void enetc_get_si_caps(struct enetc_si *si); · 291 unmodified lines
292292 void enetc_init_si_rings_params(struct enetc_ndev_priv *priv);
293293 int enetc_alloc_si_resources(struct enetc_ndev_priv *priv);
294294 void enetc_free_si_resources(struct enetc_ndev_priv *priv);
295+int enetc_configure_si(struct enetc_ndev_priv *priv);
295296
296297 int enetc_open(struct net_device *ndev);
297298 int enetc_close(struct net_device *ndev);
@@ -309,6 +310,10 @@ int enetc_setup_tc(struct net_device *ndev, enum tc_setup_type type, · 11 unmodified lines
309310 void enetc_set_ethtool_ops(struct net_device *ndev);
310311
311312 /* control buffer descriptor ring (CBDR) */
313+int enetc_alloc_cbdr(struct device *dev, struct enetc_cbdr *cbdr);
314+void enetc_free_cbdr(struct device *dev, struct enetc_cbdr *cbdr);
315+void enetc_setup_cbdr(struct enetc_hw *hw, struct enetc_cbdr *cbdr);
316+void enetc_clear_cbdr(struct enetc_hw *hw);
312317 int enetc_set_mac_flt_entry(struct enetc_si *si, int index,
313318 char *mac_addr, int si_map);
314319 int enetc_clear_mac_flt_entry(struct enetc_si *si, int index);
drivers/net/ethernet/freescale/enetc/enetc_hw.h+17−3
@@ -172,6 +172,8 @@ enum enetc_bdr_type {TX, RX}; · 171 unmodified lines
172172 #define ENETC_PSIPMAR0(n) (0x0100 + (n) * 0x8) /* n = SI index */
173173 #define ENETC_PSIPMAR1(n) (0x0104 + (n) * 0x8)
174174 #define ENETC_PVCLCTR 0x0208
175+#define ENETC_PCVLANR1 0x0210
176+#define ENETC_PCVLANR2 0x0214
175177 #define ENETC_VLAN_TYPE_C BIT(0)
176178 #define ENETC_VLAN_TYPE_S BIT(1)
177179 #define ENETC_PVCLCTR_OVTPIDL(bmp) ((bmp) & 0xff) /* VLAN_TYPE */
@@ -232,14 +234,23 @@ enum enetc_bdr_type {TX, RX}; · 54 unmodified lines
232234 #define ENETC_PM0_MAXFRM 0x8014
233235 #define ENETC_SET_TX_MTU(val) ((val) << 16)
234236 #define ENETC_SET_MAXFRM(val) ((val) & 0xffff)
237+#define ENETC_PM0_RX_FIFO 0x801c
238+#define ENETC_PM0_RX_FIFO_VAL 1
235239
236240 #define ENETC_PM_IMDIO_BASE 0x8030
237241
238242 #define ENETC_PM0_IF_MODE 0x8300
239−#define ENETC_PMO_IFM_RG BIT(2)
243+#define ENETC_PM0_IFM_RG BIT(2)
240244 #define ENETC_PM0_IFM_RLP (BIT(5) | BIT(11))
241−#define ENETC_PM0_IFM_RGAUTO (BIT(15) | ENETC_PMO_IFM_RG | BIT(1))
242−#define ENETC_PM0_IFM_XGMII BIT(12)
245+#define ENETC_PM0_IFM_EN_AUTO BIT(15)
246+#define ENETC_PM0_IFM_SSP_MASK GENMASK(14, 13)
247+#define ENETC_PM0_IFM_SSP_1000 (2 << 13)
248+#define ENETC_PM0_IFM_SSP_100 (0 << 13)
249+#define ENETC_PM0_IFM_SSP_10 (1 << 13)
250+#define ENETC_PM0_IFM_FULL_DPX BIT(12)
251+#define ENETC_PM0_IFM_IFMODE_MASK GENMASK(1, 0)
252+#define ENETC_PM0_IFM_IFMODE_XGMII 0
253+#define ENETC_PM0_IFM_IFMODE_GMII 2
243254 #define ENETC_PSIDCAPR 0x1b08
244255 #define ENETC_PSIDCAPR_MSK GENMASK(15, 0)
245256 #define ENETC_PSFCAPR 0x1b18
@@ -453,6 +464,8 @@ static inline u64 _enetc_rd_reg64_wa(void __iomem *reg) · 207 unmodified lines
453464 #define enetc_wr_reg(reg, val) _enetc_wr_reg_wa((reg), (val))
454465 #define enetc_rd(hw, off) enetc_rd_reg((hw)->reg + (off))
455466 #define enetc_wr(hw, off, val) enetc_wr_reg((hw)->reg + (off), val)
467+#define enetc_rd_hot(hw, off) enetc_rd_reg_hot((hw)->reg + (off))
468+#define enetc_wr_hot(hw, off, val) enetc_wr_reg_hot((hw)->reg + (off), val)
456469 #define enetc_rd64(hw, off) _enetc_rd_reg64_wa((hw)->reg + (off))
457470 /* port register accessors - PF only */
458471 #define enetc_port_rd(hw, off) enetc_rd_reg((hw)->port + (off))
@@ -568,6 +581,7 @@ union enetc_rx_bd { · 109 unmodified lines
568581 #define ENETC_RXBD_LSTATUS(flags) ((flags) << 16)
569582 #define ENETC_RXBD_FLAG_VLAN BIT(9)
570583 #define ENETC_RXBD_FLAG_TSTMP BIT(10)
584+#define ENETC_RXBD_FLAG_TPID GENMASK(1, 0)
571585
572586 #define ENETC_MAC_ADDR_FILT_CNT 8 /* # of supported entries per port */
573587 #define EMETC_MAC_ADDR_FILT_RES 3 /* # of reserved entries at the beginning */
drivers/net/ethernet/freescale/enetc/enetc_pf.c+87−17
@@ -190,7 +190,6 @@ static void enetc_pf_set_rx_mode(struct net_device *ndev) · 189 unmodified lines
190190 {
191191 struct enetc_ndev_priv *priv = netdev_priv(ndev);
192192 struct enetc_pf *pf = enetc_si_priv(priv->si);
193− char vlan_promisc_simap = pf->vlan_promisc_simap;
194193 struct enetc_hw *hw = &priv->si->hw;
195194 bool uprom = false, mprom = false;
196195 struct enetc_mac_filter *filter;
@@ -203,16 +202,12 @@ static void enetc_pf_set_rx_mode(struct net_device *ndev) · 6 unmodified lines
203202 psipmr = ENETC_PSIPMR_SET_UP(0) | ENETC_PSIPMR_SET_MP(0);
204203 uprom = true;
205204 mprom = true;
206− /* Enable VLAN promiscuous mode for SI0 (PF) */
207− vlan_promisc_simap |= BIT(0);
208205 } else if (ndev->flags & IFF_ALLMULTI) {
209206 /* enable multi cast promisc mode for SI0 (PF) */
210207 psipmr = ENETC_PSIPMR_SET_MP(0);
211208 mprom = true;
212209 }
213210
214− enetc_set_vlan_promisc(&pf->si->hw, vlan_promisc_simap);
215−
216211 /* first 2 filter entries belong to PF */
217212 if (!uprom) {
218213 /* Update unicast filters */
@@ -320,7 +315,7 @@ static void enetc_set_loopback(struct net_device *ndev, bool en) · 101 unmodified lines
320315 u32 reg;
321316
322317 reg = enetc_port_rd(hw, ENETC_PM0_IF_MODE);
323− if (reg & ENETC_PMO_IFM_RG) {
318+ if (reg & ENETC_PM0_IFM_RG) {
324319 /* RGMII mode */
325320 reg = (reg & ~ENETC_PM0_IFM_RLP) |
326321 (en ? ENETC_PM0_IFM_RLP : 0);
@@ -495,17 +490,30 @@ static void enetc_configure_port_mac(struct enetc_hw *hw) · 168 unmodified lines
495490
496491 enetc_port_wr(hw, ENETC_PM1_CMD_CFG, ENETC_PM0_CMD_PHY_TX_EN |
497492 ENETC_PM0_CMD_TXP | ENETC_PM0_PROMISC);
493+
494+ /* On LS1028A, the MAC RX FIFO defaults to 2, which is too high
495+ * and may lead to RX lock-up under traffic. Set it to 1 instead,
496+ * as recommended by the hardware team.
497+ */
498+ enetc_port_wr(hw, ENETC_PM0_RX_FIFO, ENETC_PM0_RX_FIFO_VAL);
498499 }
499500
500501 static void enetc_mac_config(struct enetc_hw *hw, phy_interface_t phy_mode)
501502 {
502− /* set auto-speed for RGMII */
503− if (enetc_port_rd(hw, ENETC_PM0_IF_MODE) & ENETC_PMO_IFM_RG ||
504− phy_interface_mode_is_rgmii(phy_mode))
505− enetc_port_wr(hw, ENETC_PM0_IF_MODE, ENETC_PM0_IFM_RGAUTO);
503+ u32 val;
504+
505+ if (phy_interface_mode_is_rgmii(phy_mode)) {
506+ val = enetc_port_rd(hw, ENETC_PM0_IF_MODE);
507+ val &= ~ENETC_PM0_IFM_EN_AUTO;
508+ val &= ENETC_PM0_IFM_IFMODE_MASK;
509+ val |= ENETC_PM0_IFM_IFMODE_GMII | ENETC_PM0_IFM_RG;
510+ enetc_port_wr(hw, ENETC_PM0_IF_MODE, val);
511+ }
506512
507− if (phy_mode == PHY_INTERFACE_MODE_USXGMII)
508− enetc_port_wr(hw, ENETC_PM0_IF_MODE, ENETC_PM0_IFM_XGMII);
513+ if (phy_mode == PHY_INTERFACE_MODE_USXGMII) {
514+ val = ENETC_PM0_IFM_FULL_DPX | ENETC_PM0_IFM_IFMODE_XGMII;
515+ enetc_port_wr(hw, ENETC_PM0_IF_MODE, val);
516+ }
509517 }
510518
511519 static void enetc_mac_enable(struct enetc_hw *hw, bool en)
@@ -937,6 +945,34 @@ static void enetc_pl_mac_config(struct phylink_config *config, · 425 unmodified lines
937945 phylink_set_pcs(priv->phylink, &pf->pcs->pcs);
938946 }
939947
948+static void enetc_force_rgmii_mac(struct enetc_hw *hw, int speed, int duplex)
949+{
950+ u32 old_val, val;
951+
952+ old_val = val = enetc_port_rd(hw, ENETC_PM0_IF_MODE);
953+
954+ if (speed == SPEED_1000) {
955+ val &= ~ENETC_PM0_IFM_SSP_MASK;
956+ val |= ENETC_PM0_IFM_SSP_1000;
957+ } else if (speed == SPEED_100) {
958+ val &= ~ENETC_PM0_IFM_SSP_MASK;
959+ val |= ENETC_PM0_IFM_SSP_100;
960+ } else if (speed == SPEED_10) {
961+ val &= ~ENETC_PM0_IFM_SSP_MASK;
962+ val |= ENETC_PM0_IFM_SSP_10;
963+ }
964+
965+ if (duplex == DUPLEX_FULL)
966+ val |= ENETC_PM0_IFM_FULL_DPX;
967+ else
968+ val &= ~ENETC_PM0_IFM_FULL_DPX;
969+
970+ if (val == old_val)
971+ return;
972+
973+ enetc_port_wr(hw, ENETC_PM0_IF_MODE, val);
974+}
975+
940976 static void enetc_pl_mac_link_up(struct phylink_config *config,
941977 struct phy_device *phy, unsigned int mode,
942978 phy_interface_t interface, int speed,
@@ -949,6 +985,10 @@ static void enetc_pl_mac_link_up(struct phylink_config *config, · 6 unmodified lines
949985 if (priv->active_offloads & ENETC_F_QBV)
950986 enetc_sched_speed_set(priv, speed);
951987
988+ if (!phylink_autoneg_inband(mode) &&
989+ phy_interface_mode_is_rgmii(interface))
990+ enetc_force_rgmii_mac(&pf->si->hw, speed, duplex);
991+
952992 enetc_mac_enable(&pf->si->hw, true);
953993 }
954994
@@ -1041,6 +1081,26 @@ static int enetc_init_port_rss_memory(struct enetc_si *si) · 86 unmodified lines
10411081 return err;
10421082 }
10431083
1084+static void enetc_init_unused_port(struct enetc_si *si)
1085+{
1086+ struct device *dev = &si->pdev->dev;
1087+ struct enetc_hw *hw = &si->hw;
1088+ int err;
1089+
1090+ si->cbd_ring.bd_count = ENETC_CBDR_DEFAULT_SIZE;
1091+ err = enetc_alloc_cbdr(dev, &si->cbd_ring);
1092+ if (err)
1093+ return;
1094+
1095+ enetc_setup_cbdr(hw, &si->cbd_ring);
1096+
1097+ enetc_init_port_rfs_memory(si);
1098+ enetc_init_port_rss_memory(si);
1099+
1100+ enetc_clear_cbdr(hw);
1101+ enetc_free_cbdr(dev, &si->cbd_ring);
1102+}
1103+
10441104 static int enetc_pf_probe(struct pci_dev *pdev,
10451105 const struct pci_device_id *ent)
10461106 {
@@ -1051,11 +1111,6 @@ static int enetc_pf_probe(struct pci_dev *pdev, · 4 unmodified lines
10511111 struct enetc_pf *pf;
10521112 int err;
10531113
1054− if (node && !of_device_is_available(node)) {
1055− dev_info(&pdev->dev, "device is disabled, skipping\n");
1056− return -ENODEV;
1057− }
1058−
10591114 err = enetc_pci_probe(pdev, KBUILD_MODNAME, sizeof(*pf));
10601115 if (err) {
10611116 dev_err(&pdev->dev, "PCI probing failed\n");
@@ -1069,6 +1124,13 @@ static int enetc_pf_probe(struct pci_dev *pdev, · 7 unmodified lines
10691124 goto err_map_pf_space;
10701125 }
10711126
1127+ if (node && !of_device_is_available(node)) {
1128+ enetc_init_unused_port(si);
1129+ dev_info(&pdev->dev, "device is disabled, skipping\n");
1130+ err = -ENODEV;
1131+ goto err_device_disabled;
1132+ }
1133+
10721134 pf = enetc_si_priv(si);
10731135 pf->si = si;
10741136 pf->total_vfs = pci_sriov_get_totalvfs(pdev);
@@ -1108,6 +1170,12 @@ static int enetc_pf_probe(struct pci_dev *pdev, · 33 unmodified lines
11081170 goto err_init_port_rss;
11091171 }
11101172
1173+ err = enetc_configure_si(priv);
1174+ if (err) {
1175+ dev_err(&pdev->dev, "Failed to configure SI\n");
1176+ goto err_config_si;
1177+ }
1178+
11111179 err = enetc_alloc_msix(priv);
11121180 if (err) {
11131181 dev_err(&pdev->dev, "MSIX alloc failed\n");
@@ -1136,6 +1204,7 @@ err_phylink_create: · 22 unmodified lines
11361204 enetc_mdiobus_destroy(pf);
11371205 err_mdiobus_create:
11381206 enetc_free_msix(priv);
1207+err_config_si:
11391208 err_init_port_rss:
11401209 err_init_port_rfs:
11411210 err_alloc_msix:
@@ -1144,6 +1213,7 @@ err_alloc_si_res: · 2 unmodified lines
11441213 si->ndev = NULL;
11451214 free_netdev(ndev);
11461215 err_alloc_netdev:
1216+err_device_disabled:
11471217 err_map_pf_space:
11481218 enetc_pci_remove(pdev);
11491219
drivers/net/ethernet/freescale/enetc/enetc_vf.c+7−0
@@ -171,6 +171,12 @@ static int enetc_vf_probe(struct pci_dev *pdev, · 170 unmodified lines
171171 goto err_alloc_si_res;
172172 }
173173
174+ err = enetc_configure_si(priv);
175+ if (err) {
176+ dev_err(&pdev->dev, "Failed to configure SI\n");
177+ goto err_config_si;
178+ }
179+
174180 err = enetc_alloc_msix(priv);
175181 if (err) {
176182 dev_err(&pdev->dev, "MSIX alloc failed\n");
@@ -187,6 +193,7 @@ static int enetc_vf_probe(struct pci_dev *pdev, · 10 unmodified lines
187193
188194 err_reg_netdev:
189195 enetc_free_msix(priv);
196+err_config_si:
190197 err_alloc_msix:
191198 enetc_free_si_resources(priv);
192199 err_alloc_si_res:
drivers/net/ethernet/freescale/fec_ptp.c+7−0
@@ -377,9 +377,16 @@ static int fec_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts) · 376 unmodified lines
377377 u64 ns;
378378 unsigned long flags;
379379
380+ mutex_lock(&adapter->ptp_clk_mutex);
381+ /* Check the ptp clock */
382+ if (!adapter->ptp_clk_on) {
383+ mutex_unlock(&adapter->ptp_clk_mutex);
384+ return -EINVAL;
385+ }
380386 spin_lock_irqsave(&adapter->tmreg_lock, flags);
381387 ns = timecounter_read(&adapter->tc);
382388 spin_unlock_irqrestore(&adapter->tmreg_lock, flags);
389+ mutex_unlock(&adapter->ptp_clk_mutex);
383390
384391 *ts = ns_to_timespec64(ns);
385392
drivers/net/ethernet/freescale/gianfar.c+15−0
@@ -2390,6 +2390,10 @@ static bool gfar_add_rx_frag(struct gfar_rx_buff *rxb, u32 lstatus, · 2389 unmodified lines
23902390 if (lstatus & BD_LFLAG(RXBD_LAST))
23912391 size -= skb->len;
23922392
2393+ WARN(size < 0, "gianfar: rx fragment size underflow");
2394+ if (size < 0)
2395+ return false;
2396+
23932397 skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page,
23942398 rxb->page_offset + RXBUF_ALIGNMENT,
23952399 size, GFAR_RXB_TRUESIZE);
@@ -2552,6 +2556,17 @@ static int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, · 156 unmodified lines
25522556 if (lstatus & BD_LFLAG(RXBD_EMPTY))
25532557 break;
25542558
2559+ /* lost RXBD_LAST descriptor due to overrun */
2560+ if (skb &&
2561+ (lstatus & BD_LFLAG(RXBD_FIRST))) {
2562+ /* discard faulty buffer */
2563+ dev_kfree_skb(skb);
2564+ skb = NULL;
2565+ rx_queue->stats.rx_dropped++;
2566+
2567+ /* can continue normally */
2568+ }
2569+
25552570 /* order rx buffer descriptor reads */
25562571 rmb();
25572572
drivers/net/ethernet/hisilicon/hns/hns_enet.c+3−1
@@ -1663,8 +1663,10 @@ static int hns_nic_clear_all_rx_fetch(struct net_device *ndev) · 1662 unmodified lines
16631663 for (j = 0; j < fetch_num; j++) {
16641664 /* alloc one skb and init */
16651665 skb = hns_assemble_skb(ndev);
1666− if (!skb)
1666+ if (!skb) {
1667+ ret = -ENOMEM;
16671668 goto out;
1669+ }
16681670 rd = &tx_ring_data(priv, skb->queue_mapping);
16691671 hns_nic_net_xmit_hw(ndev, skb, rd);
16701672
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h+3−3
@@ -1053,16 +1053,16 @@ struct hclge_fd_tcam_config_3_cmd { · 1052 unmodified lines
10531053 #define HCLGE_FD_AD_DROP_B 0
10541054 #define HCLGE_FD_AD_DIRECT_QID_B 1
10551055 #define HCLGE_FD_AD_QID_S 2
1056−#define HCLGE_FD_AD_QID_M GENMASK(12, 2)
1056+#define HCLGE_FD_AD_QID_M GENMASK(11, 2)
10571057 #define HCLGE_FD_AD_USE_COUNTER_B 12
10581058 #define HCLGE_FD_AD_COUNTER_NUM_S 13
10591059 #define HCLGE_FD_AD_COUNTER_NUM_M GENMASK(20, 13)
10601060 #define HCLGE_FD_AD_NXT_STEP_B 20
10611061 #define HCLGE_FD_AD_NXT_KEY_S 21
1062−#define HCLGE_FD_AD_NXT_KEY_M GENMASK(26, 21)
1062+#define HCLGE_FD_AD_NXT_KEY_M GENMASK(25, 21)
10631063 #define HCLGE_FD_AD_WR_RULE_ID_B 0
10641064 #define HCLGE_FD_AD_RULE_ID_S 1
1065−#define HCLGE_FD_AD_RULE_ID_M GENMASK(13, 1)
1065+#define HCLGE_FD_AD_RULE_ID_M GENMASK(12, 1)
10661066 #define HCLGE_FD_AD_TC_OVRD_B 16
10671067 #define HCLGE_FD_AD_TC_SIZE_S 17
10681068 #define HCLGE_FD_AD_TC_SIZE_M GENMASK(20, 17)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c+3−4
@@ -5245,9 +5245,9 @@ static bool hclge_fd_convert_tuple(u32 tuple_bit, u8 *key_x, u8 *key_y, · 5244 unmodified lines
52455245 case BIT(INNER_SRC_MAC):
52465246 for (i = 0; i < ETH_ALEN; i++) {
52475247 calc_x(key_x[ETH_ALEN - 1 - i], rule->tuples.src_mac[i],
5248− rule->tuples.src_mac[i]);
5248+ rule->tuples_mask.src_mac[i]);
52495249 calc_y(key_y[ETH_ALEN - 1 - i], rule->tuples.src_mac[i],
5250− rule->tuples.src_mac[i]);
5250+ rule->tuples_mask.src_mac[i]);
52515251 }
52525252
52535253 return true;
@@ -6330,8 +6330,7 @@ static void hclge_fd_get_ext_info(struct ethtool_rx_flow_spec *fs, · 1076 unmodified lines
63306330 fs->h_ext.vlan_tci = cpu_to_be16(rule->tuples.vlan_tag1);
63316331 fs->m_ext.vlan_tci =
63326332 rule->unused_tuple & BIT(INNER_VLAN_TAG_FST) ?
6333− cpu_to_be16(VLAN_VID_MASK) :
6334− cpu_to_be16(rule->tuples_mask.vlan_tag1);
6333+ 0 : cpu_to_be16(rule->tuples_mask.vlan_tag1);
63356334 }
63366335
63376336 if (fs->flow_type & FLOW_MAC_EXT) {
drivers/net/ethernet/ibm/ibmveth.c+1−3
@@ -1758,7 +1758,7 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id) · 1757 unmodified lines
17581758 return 0;
17591759 }
17601760
1761−static int ibmveth_remove(struct vio_dev *dev)
1761+static void ibmveth_remove(struct vio_dev *dev)
17621762 {
17631763 struct net_device *netdev = dev_get_drvdata(&dev->dev);
17641764 struct ibmveth_adapter *adapter = netdev_priv(netdev);
@@ -1771,8 +1771,6 @@ static int ibmveth_remove(struct vio_dev *dev) · 6 unmodified lines
17711771
17721772 free_netdev(netdev);
17731773 dev_set_drvdata(&dev->dev, NULL);
1774−
1775− return 0;
17761774 }
17771775
17781776 static struct attribute veth_active_attr;
drivers/net/ethernet/ibm/ibmvnic.c+8−14
@@ -78,7 +78,6 @@ MODULE_LICENSE("GPL"); · 77 unmodified lines
7878 MODULE_VERSION(IBMVNIC_DRIVER_VERSION);
7979
8080 static int ibmvnic_version = IBMVNIC_INITIAL_VERSION;
81−static int ibmvnic_remove(struct vio_dev *);
8281 static void release_sub_crqs(struct ibmvnic_adapter *, bool);
8382 static int ibmvnic_reset_crq(struct ibmvnic_adapter *);
8483 static int ibmvnic_send_crq_init(struct ibmvnic_adapter *);
@@ -1906,10 +1905,9 @@ static int ibmvnic_set_mac(struct net_device *netdev, void *p) · 1821 unmodified lines
19061905 if (!is_valid_ether_addr(addr->sa_data))
19071906 return -EADDRNOTAVAIL;
19081907
1909− if (adapter->state != VNIC_PROBED) {
1910− ether_addr_copy(adapter->mac_addr, addr->sa_data);
1908+ ether_addr_copy(adapter->mac_addr, addr->sa_data);
1909+ if (adapter->state != VNIC_PROBED)
19111910 rc = __ibmvnic_set_mac(netdev, addr->sa_data);
1912− }
19131911
19141912 return rc;
19151913 }
@@ -5219,16 +5217,14 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter *adapter, bool reset) · 3303 unmodified lines
52195217 {
52205218 struct device *dev = &adapter->vdev->dev;
52215219 unsigned long timeout = msecs_to_jiffies(20000);
5222− u64 old_num_rx_queues, old_num_tx_queues;
5220+ u64 old_num_rx_queues = adapter->req_rx_queues;
5221+ u64 old_num_tx_queues = adapter->req_tx_queues;
52235222 int rc;
52245223
52255224 adapter->from_passive_init = false;
52265225
5227− if (reset) {
5228− old_num_rx_queues = adapter->req_rx_queues;
5229− old_num_tx_queues = adapter->req_tx_queues;
5226+ if (reset)
52305227 reinit_completion(&adapter->init_done);
5231− }
52325228
52335229 adapter->init_done_rc = 0;
52345230 rc = ibmvnic_send_crq_init(adapter);
@@ -5396,7 +5392,7 @@ ibmvnic_init_fail: · 161 unmodified lines
53965392 return rc;
53975393 }
53985394
5399−static int ibmvnic_remove(struct vio_dev *dev)
5395+static void ibmvnic_remove(struct vio_dev *dev)
54005396 {
54015397 struct net_device *netdev = dev_get_drvdata(&dev->dev);
54025398 struct ibmvnic_adapter *adapter = netdev_priv(netdev);
@@ -5411,9 +5407,9 @@ static int ibmvnic_remove(struct vio_dev *dev) · 8 unmodified lines
54115407 * after setting state, so __ibmvnic_reset() which is called
54125408 * from the flush_work() below, can make progress.
54135409 */
5414− spin_lock_irqsave(&adapter->rwi_lock, flags);
5410+ spin_lock(&adapter->rwi_lock);
54155411 adapter->state = VNIC_REMOVING;
5416− spin_unlock_irqrestore(&adapter->rwi_lock, flags);
5412+ spin_unlock(&adapter->rwi_lock);
54175413
54185414 spin_unlock_irqrestore(&adapter->state_lock, flags);
54195415
@@ -5437,8 +5433,6 @@ static int ibmvnic_remove(struct vio_dev *dev) · 17 unmodified lines
54375433 device_remove_file(&dev->dev, &dev_attr_failover);
54385434 free_netdev(netdev);
54395435 dev_set_drvdata(&dev->dev, NULL);
5440−
5441− return 0;
54425436 }
54435437
54445438 static ssize_t failover_store(struct device *dev, struct device_attribute *attr,
drivers/net/ethernet/intel/iavf/iavf_main.c+2−1
@@ -1776,7 +1776,8 @@ static int iavf_init_get_resources(struct iavf_adapter *adapter) · 1775 unmodified lines
17761776 goto err_alloc;
17771777 }
17781778
1779− if (iavf_process_config(adapter))
1779+ err = iavf_process_config(adapter);
1780+ if (err)
17801781 goto err_alloc;
17811782 adapter->current_op = VIRTCHNL_OP_UNKNOWN;
17821783
drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c+5−0
@@ -575,6 +575,11 @@ static int ixgbe_ipsec_add_sa(struct xfrm_state *xs) · 574 unmodified lines
575575 return -EINVAL;
576576 }
577577
578+ if (xs->props.mode != XFRM_MODE_TRANSPORT) {
579+ netdev_err(dev, "Unsupported mode for ipsec offload\n");
580+ return -EINVAL;
581+ }
582+
578583 if (ixgbe_ipsec_check_mgmt_ip(xs)) {
579584 netdev_err(dev, "IPsec IP addr clash with mgmt filters\n");
580585 return -EINVAL;
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c+4−2
@@ -9565,8 +9565,10 @@ static int ixgbe_configure_clsu32(struct ixgbe_adapter *adapter, · 9564 unmodified lines
95659565 ixgbe_atr_compute_perfect_hash_82599(&input->filter, mask);
95669566 err = ixgbe_fdir_write_perfect_filter_82599(hw, &input->filter,
95679567 input->sw_idx, queue);
9568− if (!err)
9569− ixgbe_update_ethtool_fdir_entry(adapter, input, input->sw_idx);
9568+ if (err)
9569+ goto err_out_w_lock;
9570+
9571+ ixgbe_update_ethtool_fdir_entry(adapter, input, input->sw_idx);
95709572 spin_unlock(&adapter->fdir_perfect_lock);
95719573
95729574 if ((uhtid != 0x800) && (adapter->jump_tables[uhtid]))
drivers/net/ethernet/intel/ixgbevf/ipsec.c+5−0
@@ -272,6 +272,11 @@ static int ixgbevf_ipsec_add_sa(struct xfrm_state *xs) · 271 unmodified lines
272272 return -EINVAL;
273273 }
274274
275+ if (xs->props.mode != XFRM_MODE_TRANSPORT) {
276+ netdev_err(dev, "Unsupported mode for ipsec offload\n");
277+ return -EINVAL;
278+ }
279+
275280 if (xs->xso.flags & XFRM_OFFLOAD_INBOUND) {
276281 struct rx_sa rsa;
277282
drivers/net/ethernet/marvell/octeontx2/af/cgx.c+3−1
@@ -56,7 +56,9 @@ static bool is_dev_rpm(void *cgxd) · 55 unmodified lines
5656
5757 bool is_lmac_valid(struct cgx *cgx, int lmac_id)
5858 {
59− return cgx && test_bit(lmac_id, &cgx->lmac_bmap);
59+ if (!cgx || lmac_id < 0 || lmac_id >= MAX_LMAC_PER_CGX)
60+ return false;
61+ return test_bit(lmac_id, &cgx->lmac_bmap);
6062 }
6163
6264 struct mac_ops *get_mac_ops(void *cgxd)
drivers/net/ethernet/mediatek/mtk_star_emac.c+3−2
@@ -1225,8 +1225,6 @@ static int mtk_star_receive_packet(struct mtk_star_priv *priv) · 1224 unmodified lines
12251225 goto push_new_skb;
12261226 }
12271227
1228− desc_data.dma_addr = new_dma_addr;
1229−
12301228 /* We can't fail anymore at this point: it's safe to unmap the skb. */
12311229 mtk_star_dma_unmap_rx(priv, &desc_data);
12321230
@@ -1236,6 +1234,9 @@ static int mtk_star_receive_packet(struct mtk_star_priv *priv) · 3 unmodified lines
12361234 desc_data.skb->dev = ndev;
12371235 netif_receive_skb(desc_data.skb);
12381236
1237+ /* update dma_addr for new skb */
1238+ desc_data.dma_addr = new_dma_addr;
1239+
12391240 push_new_skb:
12401241 desc_data.len = skb_tailroom(new_skb);
12411242 desc_data.skb = new_skb;
drivers/net/ethernet/mellanox/mlx4/en_ethtool.c+1−1
@@ -47,7 +47,7 @@ · 46 unmodified lines
4747 #define EN_ETHTOOL_SHORT_MASK cpu_to_be16(0xffff)
4848 #define EN_ETHTOOL_WORD_MASK cpu_to_be32(0xffffffff)
4949
50−static int mlx4_en_moderation_update(struct mlx4_en_priv *priv)
50+int mlx4_en_moderation_update(struct mlx4_en_priv *priv)
5151 {
5252 int i, t;
5353 int err = 0;
drivers/net/ethernet/mellanox/mlx4/en_netdev.c+2−0
@@ -3554,6 +3554,8 @@ int mlx4_en_reset_config(struct net_device *dev, · 3553 unmodified lines
35543554 en_err(priv, "Failed starting port\n");
35553555 }
35563556
3557+ if (!err)
3558+ err = mlx4_en_moderation_update(priv);
35573559 out:
35583560 mutex_unlock(&mdev->state_lock);
35593561 kfree(tmp);
drivers/net/ethernet/mellanox/mlx4/mlx4_en.h+1−0
@@ -775,6 +775,7 @@ void mlx4_en_ptp_overflow_check(struct mlx4_en_dev *mdev); · 774 unmodified lines
775775 #define DEV_FEATURE_CHANGED(dev, new_features, feature) \
776776 ((dev->features & feature) ^ (new_features & feature))
777777
778+int mlx4_en_moderation_update(struct mlx4_en_priv *priv);
778779 int mlx4_en_reset_config(struct net_device *dev,
779780 struct hwtstamp_config ts_config,
780781 netdev_features_t new_features);
drivers/net/ethernet/mellanox/mlxsw/reg.h+1−0
@@ -4430,6 +4430,7 @@ MLXSW_ITEM32(reg, ptys, ext_eth_proto_cap, 0x08, 0, 32); · 4429 unmodified lines
44304430 #define MLXSW_REG_PTYS_ETH_SPEED_100GBASE_CR4 BIT(20)
44314431 #define MLXSW_REG_PTYS_ETH_SPEED_100GBASE_SR4 BIT(21)
44324432 #define MLXSW_REG_PTYS_ETH_SPEED_100GBASE_KR4 BIT(22)
4433+#define MLXSW_REG_PTYS_ETH_SPEED_100GBASE_LR4_ER4 BIT(23)
44334434 #define MLXSW_REG_PTYS_ETH_SPEED_25GBASE_CR BIT(27)
44344435 #define MLXSW_REG_PTYS_ETH_SPEED_25GBASE_KR BIT(28)
44354436 #define MLXSW_REG_PTYS_ETH_SPEED_25GBASE_SR BIT(29)
drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c+5−0
@@ -1169,6 +1169,11 @@ static const struct mlxsw_sp1_port_link_mode mlxsw_sp1_port_link_mode[] = { · 1168 unmodified lines
11691169 .mask_ethtool = ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT,
11701170 .speed = SPEED_100000,
11711171 },
1172+ {
1173+ .mask = MLXSW_REG_PTYS_ETH_SPEED_100GBASE_LR4_ER4,
1174+ .mask_ethtool = ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT,
1175+ .speed = SPEED_100000,
1176+ },
11721177 };
11731178
11741179 #define MLXSW_SP1_PORT_LINK_MODE_LEN ARRAY_SIZE(mlxsw_sp1_port_link_mode)
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c+7−0
@@ -5951,6 +5951,10 @@ mlxsw_sp_router_fib4_replace(struct mlxsw_sp *mlxsw_sp, · 5950 unmodified lines
59515951 if (mlxsw_sp->router->aborted)
59525952 return 0;
59535953
5954+ if (fen_info->fi->nh &&
5955+ !mlxsw_sp_nexthop_obj_group_lookup(mlxsw_sp, fen_info->fi->nh->id))
5956+ return 0;
5957+
59545958 fib_node = mlxsw_sp_fib_node_get(mlxsw_sp, fen_info->tb_id,
59555959 &fen_info->dst, sizeof(fen_info->dst),
59565960 fen_info->dst_len,
@@ -6601,6 +6605,9 @@ static int mlxsw_sp_router_fib6_replace(struct mlxsw_sp *mlxsw_sp, · 644 unmodified lines
66016605 if (mlxsw_sp_fib6_rt_should_ignore(rt))
66026606 return 0;
66036607
6608+ if (rt->nh && !mlxsw_sp_nexthop_obj_group_lookup(mlxsw_sp, rt->nh->id))
6609+ return 0;
6610+
66046611 fib_node = mlxsw_sp_fib_node_get(mlxsw_sp, rt->fib6_table->tb6_id,
66056612 &rt->fib6_dst.addr,
66066613 sizeof(rt->fib6_dst.addr),
drivers/net/ethernet/mellanox/mlxsw/switchx2.c+2−1
@@ -613,7 +613,8 @@ static const struct mlxsw_sx_port_link_mode mlxsw_sx_port_link_mode[] = { · 612 unmodified lines
613613 {
614614 .mask = MLXSW_REG_PTYS_ETH_SPEED_100GBASE_CR4 |
615615 MLXSW_REG_PTYS_ETH_SPEED_100GBASE_SR4 |
616− MLXSW_REG_PTYS_ETH_SPEED_100GBASE_KR4,
616+ MLXSW_REG_PTYS_ETH_SPEED_100GBASE_KR4 |
617+ MLXSW_REG_PTYS_ETH_SPEED_100GBASE_LR4_ER4,
617618 .speed = 100000,
618619 },
619620 };
drivers/net/ethernet/microchip/lan743x_main.c+1−1
@@ -2040,7 +2040,7 @@ lan743x_rx_trim_skb(struct sk_buff *skb, int frame_length) · 2039 unmodified lines
20402040 dev_kfree_skb_irq(skb);
20412041 return NULL;
20422042 }
2043− frame_length = max_t(int, 0, frame_length - RX_HEAD_PADDING - 2);
2043+ frame_length = max_t(int, 0, frame_length - RX_HEAD_PADDING - 4);
20442044 if (skb->len > frame_length) {
20452045 skb->tail -= skb->len - frame_length;
20462046 skb->len = frame_length;
drivers/net/ethernet/mscc/Kconfig+1−0
@@ -13,6 +13,7 @@ if NET_VENDOR_MICROSEMI · 12 unmodified lines
1313
1414 # Users should depend on NET_SWITCHDEV, HAS_IOMEM
1515 config MSCC_OCELOT_SWITCH_LIB
16+ select NET_DEVLINK
1617 select REGMAP_MMIO
1718 select PACKING
1819 select PHYLIB
drivers/net/ethernet/mscc/ocelot_flower.c+2−1
@@ -540,13 +540,14 @@ ocelot_flower_parse_key(struct ocelot *ocelot, int port, bool ingress, · 539 unmodified lines
540540 return -EOPNOTSUPP;
541541 }
542542
543+ flow_rule_match_ipv4_addrs(rule, &match);
544+
543545 if (filter->block_id == VCAP_IS1 && *(u32 *)&match.mask->dst) {
544546 NL_SET_ERR_MSG_MOD(extack,
545547 "Key type S1_NORMAL cannot match on destination IP");
546548 return -EOPNOTSUPP;
547549 }
548550
549− flow_rule_match_ipv4_addrs(rule, &match);
550551 tmp = &filter->key.ipv4.sip.value.addr[0];
551552 memcpy(tmp, &match.key->src, 4);
552553
drivers/net/ethernet/realtek/r8169_main.c+1−1
@@ -767,7 +767,7 @@ static void r8168fp_adjust_ocp_cmd(struct rtl8169_private *tp, u32 *cmd, int typ · 766 unmodified lines
767767 if (type == ERIAR_OOB &&
768768 (tp->mac_version == RTL_GIGA_MAC_VER_52 ||
769769 tp->mac_version == RTL_GIGA_MAC_VER_53))
770− *cmd |= 0x7f0 << 18;
770+ *cmd |= 0xf70 << 18;
771771 }
772772
773773 DECLARE_RTL_COND(rtl_eriar_cond)
drivers/net/ethernet/renesas/sh_eth.c+7−0
@@ -560,6 +560,8 @@ static struct sh_eth_cpu_data r7s72100_data = { · 559 unmodified lines
560560 EESR_TDE,
561561 .fdr_value = 0x0000070f,
562562
563+ .trscer_err_mask = DESC_I_RINT8 | DESC_I_RINT5,
564+
563565 .no_psr = 1,
564566 .apr = 1,
565567 .mpr = 1,
@@ -780,6 +782,8 @@ static struct sh_eth_cpu_data r7s9210_data = { · 214 unmodified lines
780782
781783 .fdr_value = 0x0000070f,
782784
785+ .trscer_err_mask = DESC_I_RINT8 | DESC_I_RINT5,
786+
783787 .apr = 1,
784788 .mpr = 1,
785789 .tpauser = 1,
@@ -1089,6 +1093,9 @@ static struct sh_eth_cpu_data sh771x_data = { · 303 unmodified lines
10891093 EESIPR_CEEFIP | EESIPR_CELFIP |
10901094 EESIPR_RRFIP | EESIPR_RTLFIP | EESIPR_RTSFIP |
10911095 EESIPR_PREIP | EESIPR_CERFIP,
1096+
1097+ .trscer_err_mask = DESC_I_RINT8,
1098+
10921099 .tsu = 1,
10931100 .dual_port = 1,
10941101 };
drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c+45−14
@@ -233,6 +233,7 @@ static void common_default_data(struct plat_stmmacenet_data *plat) · 232 unmodified lines
233233 static int intel_mgbe_common_data(struct pci_dev *pdev,
234234 struct plat_stmmacenet_data *plat)
235235 {
236+ char clk_name[20];
236237 int ret;
237238 int i;
238239
@@ -301,8 +302,10 @@ static int intel_mgbe_common_data(struct pci_dev *pdev, · 62 unmodified lines
301302 plat->eee_usecs_rate = plat->clk_ptp_rate;
302303
303304 /* Set system clock */
305+ sprintf(clk_name, "%s-%s", "stmmac", pci_name(pdev));
306+
304307 plat->stmmac_clk = clk_register_fixed_rate(&pdev->dev,
305− "stmmac-clk", NULL, 0,
308+ clk_name, NULL, 0,
306309 plat->clk_ptp_rate);
307310
308311 if (IS_ERR(plat->stmmac_clk)) {
@@ -446,8 +449,8 @@ static int tgl_common_data(struct pci_dev *pdev, · 137 unmodified lines
446449 return intel_mgbe_common_data(pdev, plat);
447450 }
448451
449−static int tgl_sgmii_data(struct pci_dev *pdev,
450− struct plat_stmmacenet_data *plat)
452+static int tgl_sgmii_phy0_data(struct pci_dev *pdev,
453+ struct plat_stmmacenet_data *plat)
451454 {
452455 plat->bus_id = 1;
453456 plat->phy_interface = PHY_INTERFACE_MODE_SGMII;
@@ -456,12 +459,26 @@ static int tgl_sgmii_data(struct pci_dev *pdev, · 2 unmodified lines
456459 return tgl_common_data(pdev, plat);
457460 }
458461
459−static struct stmmac_pci_info tgl_sgmii1g_info = {
460− .setup = tgl_sgmii_data,
462+static struct stmmac_pci_info tgl_sgmii1g_phy0_info = {
463+ .setup = tgl_sgmii_phy0_data,
461464 };
462465
463−static int adls_sgmii_data(struct pci_dev *pdev,
464− struct plat_stmmacenet_data *plat)
466+static int tgl_sgmii_phy1_data(struct pci_dev *pdev,
467+ struct plat_stmmacenet_data *plat)
468+{
469+ plat->bus_id = 2;
470+ plat->phy_interface = PHY_INTERFACE_MODE_SGMII;
471+ plat->serdes_powerup = intel_serdes_powerup;
472+ plat->serdes_powerdown = intel_serdes_powerdown;
473+ return tgl_common_data(pdev, plat);
474+}
475+
476+static struct stmmac_pci_info tgl_sgmii1g_phy1_info = {
477+ .setup = tgl_sgmii_phy1_data,
478+};
479+
480+static int adls_sgmii_phy0_data(struct pci_dev *pdev,
481+ struct plat_stmmacenet_data *plat)
465482 {
466483 plat->bus_id = 1;
467484 plat->phy_interface = PHY_INTERFACE_MODE_SGMII;
@@ -471,10 +488,24 @@ static int adls_sgmii_data(struct pci_dev *pdev, · 3 unmodified lines
471488 return tgl_common_data(pdev, plat);
472489 }
473490
474−static struct stmmac_pci_info adls_sgmii1g_info = {
475− .setup = adls_sgmii_data,
491+static struct stmmac_pci_info adls_sgmii1g_phy0_info = {
492+ .setup = adls_sgmii_phy0_data,
476493 };
477494
495+static int adls_sgmii_phy1_data(struct pci_dev *pdev,
496+ struct plat_stmmacenet_data *plat)
497+{
498+ plat->bus_id = 2;
499+ plat->phy_interface = PHY_INTERFACE_MODE_SGMII;
500+
501+ /* SerDes power up and power down are done in BIOS for ADL */
502+
503+ return tgl_common_data(pdev, plat);
504+}
505+
506+static struct stmmac_pci_info adls_sgmii1g_phy1_info = {
507+ .setup = adls_sgmii_phy1_data,
508+};
478509 static const struct stmmac_pci_func_data galileo_stmmac_func_data[] = {
479510 {
480511 .func = 6,
@@ -756,11 +787,11 @@ static const struct pci_device_id intel_eth_pci_id_table[] = { · 275 unmodified lines
756787 { PCI_DEVICE_DATA(INTEL, EHL_PSE1_RGMII1G_ID, &ehl_pse1_rgmii1g_info) },
757788 { PCI_DEVICE_DATA(INTEL, EHL_PSE1_SGMII1G_ID, &ehl_pse1_sgmii1g_info) },
758789 { PCI_DEVICE_DATA(INTEL, EHL_PSE1_SGMII2G5_ID, &ehl_pse1_sgmii1g_info) },
759− { PCI_DEVICE_DATA(INTEL, TGL_SGMII1G_ID, &tgl_sgmii1g_info) },
760− { PCI_DEVICE_DATA(INTEL, TGLH_SGMII1G_0_ID, &tgl_sgmii1g_info) },
761− { PCI_DEVICE_DATA(INTEL, TGLH_SGMII1G_1_ID, &tgl_sgmii1g_info) },
762− { PCI_DEVICE_DATA(INTEL, ADLS_SGMII1G_0_ID, &adls_sgmii1g_info) },
763− { PCI_DEVICE_DATA(INTEL, ADLS_SGMII1G_1_ID, &adls_sgmii1g_info) },
790+ { PCI_DEVICE_DATA(INTEL, TGL_SGMII1G_ID, &tgl_sgmii1g_phy0_info) },
791+ { PCI_DEVICE_DATA(INTEL, TGLH_SGMII1G_0_ID, &tgl_sgmii1g_phy0_info) },
792+ { PCI_DEVICE_DATA(INTEL, TGLH_SGMII1G_1_ID, &tgl_sgmii1g_phy1_info) },
793+ { PCI_DEVICE_DATA(INTEL, ADLS_SGMII1G_0_ID, &adls_sgmii1g_phy0_info) },
794+ { PCI_DEVICE_DATA(INTEL, ADLS_SGMII1G_1_ID, &adls_sgmii1g_phy1_info) },
764795 {}
765796 };
766797 MODULE_DEVICE_TABLE(pci, intel_eth_pci_id_table);
drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c+49−10
@@ -402,19 +402,53 @@ static void dwmac4_rd_set_tx_ic(struct dma_desc *p) · 401 unmodified lines
402402 p->des2 |= cpu_to_le32(TDES2_INTERRUPT_ON_COMPLETION);
403403 }
404404
405−static void dwmac4_display_ring(void *head, unsigned int size, bool rx)
405+static void dwmac4_display_ring(void *head, unsigned int size, bool rx,
406+ dma_addr_t dma_rx_phy, unsigned int desc_size)
406407 {
407− struct dma_desc *p = (struct dma_desc *)head;
408+ dma_addr_t dma_addr;
408409 int i;
409410
410411 pr_info("%s descriptor ring:\n", rx ? "RX" : "TX");
411412
412− for (i = 0; i < size; i++) {
413− pr_info("%03d [0x%x]: 0x%x 0x%x 0x%x 0x%x\n",
414− i, (unsigned int)virt_to_phys(p),
415− le32_to_cpu(p->des0), le32_to_cpu(p->des1),
416− le32_to_cpu(p->des2), le32_to_cpu(p->des3));
417− p++;
413+ if (desc_size == sizeof(struct dma_desc)) {
414+ struct dma_desc *p = (struct dma_desc *)head;
415+
416+ for (i = 0; i < size; i++) {
417+ dma_addr = dma_rx_phy + i * sizeof(*p);
418+ pr_info("%03d [%pad]: 0x%x 0x%x 0x%x 0x%x\n",
419+ i, &dma_addr,
420+ le32_to_cpu(p->des0), le32_to_cpu(p->des1),
421+ le32_to_cpu(p->des2), le32_to_cpu(p->des3));
422+ p++;
423+ }
424+ } else if (desc_size == sizeof(struct dma_extended_desc)) {
425+ struct dma_extended_desc *extp = (struct dma_extended_desc *)head;
426+
427+ for (i = 0; i < size; i++) {
428+ dma_addr = dma_rx_phy + i * sizeof(*extp);
429+ pr_info("%03d [%pad]: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n",
430+ i, &dma_addr,
431+ le32_to_cpu(extp->basic.des0), le32_to_cpu(extp->basic.des1),
432+ le32_to_cpu(extp->basic.des2), le32_to_cpu(extp->basic.des3),
433+ le32_to_cpu(extp->des4), le32_to_cpu(extp->des5),
434+ le32_to_cpu(extp->des6), le32_to_cpu(extp->des7));
435+ extp++;
436+ }
437+ } else if (desc_size == sizeof(struct dma_edesc)) {
438+ struct dma_edesc *ep = (struct dma_edesc *)head;
439+
440+ for (i = 0; i < size; i++) {
441+ dma_addr = dma_rx_phy + i * sizeof(*ep);
442+ pr_info("%03d [%pad]: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n",
443+ i, &dma_addr,
444+ le32_to_cpu(ep->des4), le32_to_cpu(ep->des5),
445+ le32_to_cpu(ep->des6), le32_to_cpu(ep->des7),
446+ le32_to_cpu(ep->basic.des0), le32_to_cpu(ep->basic.des1),
447+ le32_to_cpu(ep->basic.des2), le32_to_cpu(ep->basic.des3));
448+ ep++;
449+ }
450+ } else {
451+ pr_err("unsupported descriptor!");
418452 }
419453 }
420454
@@ -499,10 +533,15 @@ static void dwmac4_get_rx_header_len(struct dma_desc *p, unsigned int *len) · 78 unmodified lines
499533 *len = le32_to_cpu(p->des2) & RDES2_HL;
500534 }
501535
502−static void dwmac4_set_sec_addr(struct dma_desc *p, dma_addr_t addr)
536+static void dwmac4_set_sec_addr(struct dma_desc *p, dma_addr_t addr, bool buf2_valid)
503537 {
504538 p->des2 = cpu_to_le32(lower_32_bits(addr));
505− p->des3 = cpu_to_le32(upper_32_bits(addr) | RDES3_BUFFER2_VALID_ADDR);
539+ p->des3 = cpu_to_le32(upper_32_bits(addr));
540+
541+ if (buf2_valid)
542+ p->des3 |= cpu_to_le32(RDES3_BUFFER2_VALID_ADDR);
543+ else
544+ p->des3 &= cpu_to_le32(~RDES3_BUFFER2_VALID_ADDR);
506545 }
507546
508547 static void dwmac4_set_tbs(struct dma_edesc *p, u32 sec, u32 nsec)
drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c+18−1
@@ -124,6 +124,23 @@ static void dwmac4_dma_init_channel(void __iomem *ioaddr, · 123 unmodified lines
124124 ioaddr + DMA_CHAN_INTR_ENA(chan));
125125 }
126126
127+static void dwmac410_dma_init_channel(void __iomem *ioaddr,
128+ struct stmmac_dma_cfg *dma_cfg, u32 chan)
129+{
130+ u32 value;
131+
132+ /* common channel control register config */
133+ value = readl(ioaddr + DMA_CHAN_CONTROL(chan));
134+ if (dma_cfg->pblx8)
135+ value = value | DMA_BUS_MODE_PBL;
136+
137+ writel(value, ioaddr + DMA_CHAN_CONTROL(chan));
138+
139+ /* Mask interrupts by writing to CSR7 */
140+ writel(DMA_CHAN_INTR_DEFAULT_MASK_4_10,
141+ ioaddr + DMA_CHAN_INTR_ENA(chan));
142+}
143+
127144 static void dwmac4_dma_init(void __iomem *ioaddr,
128145 struct stmmac_dma_cfg *dma_cfg, int atds)
129146 {
@@ -523,7 +540,7 @@ const struct stmmac_dma_ops dwmac4_dma_ops = { · 393 unmodified lines
523540 const struct stmmac_dma_ops dwmac410_dma_ops = {
524541 .reset = dwmac4_dma_reset,
525542 .init = dwmac4_dma_init,
526− .init_chan = dwmac4_dma_init_channel,
543+ .init_chan = dwmac410_dma_init_channel,
527544 .init_rx_chan = dwmac4_dma_init_rx_chan,
528545 .init_tx_chan = dwmac4_dma_init_tx_chan,
529546 .axi = dwmac4_dma_axi,
drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c+0−4
@@ -53,10 +53,6 @@ void dwmac4_dma_stop_tx(void __iomem *ioaddr, u32 chan) · 52 unmodified lines
5353
5454 value &= ~DMA_CONTROL_ST;
5555 writel(value, ioaddr + DMA_CHAN_TX_CONTROL(chan));
56−
57− value = readl(ioaddr + GMAC_CONFIG);
58− value &= ~GMAC_CONFIG_TE;
59− writel(value, ioaddr + GMAC_CONFIG);
6056 }
6157
6258 void dwmac4_dma_start_rx(void __iomem *ioaddr, u32 chan)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c+1−1
@@ -292,7 +292,7 @@ static void dwxgmac2_get_rx_header_len(struct dma_desc *p, unsigned int *len) · 291 unmodified lines
292292 *len = le32_to_cpu(p->des2) & XGMAC_RDES2_HL;
293293 }
294294
295−static void dwxgmac2_set_sec_addr(struct dma_desc *p, dma_addr_t addr)
295+static void dwxgmac2_set_sec_addr(struct dma_desc *p, dma_addr_t addr, bool is_valid)
296296 {
297297 p->des2 = cpu_to_le32(lower_32_bits(addr));
298298 p->des3 = cpu_to_le32(upper_32_bits(addr));
drivers/net/ethernet/stmicro/stmmac/enh_desc.c+6−3
@@ -417,19 +417,22 @@ static int enh_desc_get_rx_timestamp_status(void *desc, void *next_desc, · 416 unmodified lines
417417 }
418418 }
419419
420−static void enh_desc_display_ring(void *head, unsigned int size, bool rx)
420+static void enh_desc_display_ring(void *head, unsigned int size, bool rx,
421+ dma_addr_t dma_rx_phy, unsigned int desc_size)
421422 {
422423 struct dma_extended_desc *ep = (struct dma_extended_desc *)head;
424+ dma_addr_t dma_addr;
423425 int i;
424426
425427 pr_info("Extended %s descriptor ring:\n", rx ? "RX" : "TX");
426428
427429 for (i = 0; i < size; i++) {
428430 u64 x;
431+ dma_addr = dma_rx_phy + i * sizeof(*ep);
429432
430433 x = *(u64 *)ep;
431− pr_info("%03d [0x%x]: 0x%x 0x%x 0x%x 0x%x\n",
432− i, (unsigned int)virt_to_phys(ep),
434+ pr_info("%03d [%pad]: 0x%x 0x%x 0x%x 0x%x\n",
435+ i, &dma_addr,
433436 (unsigned int)x, (unsigned int)(x >> 32),
434437 ep->basic.des2, ep->basic.des3);
435438 ep++;
drivers/net/ethernet/stmicro/stmmac/hwif.h+3−2
@@ -78,7 +78,8 @@ struct stmmac_desc_ops { · 77 unmodified lines
7878 /* get rx timestamp status */
7979 int (*get_rx_timestamp_status)(void *desc, void *next_desc, u32 ats);
8080 /* Display ring */
81− void (*display_ring)(void *head, unsigned int size, bool rx);
81+ void (*display_ring)(void *head, unsigned int size, bool rx,
82+ dma_addr_t dma_rx_phy, unsigned int desc_size);
8283 /* set MSS via context descriptor */
8384 void (*set_mss)(struct dma_desc *p, unsigned int mss);
8485 /* get descriptor skbuff address */
@@ -91,7 +92,7 @@ struct stmmac_desc_ops { · 6 unmodified lines
9192 int (*get_rx_hash)(struct dma_desc *p, u32 *hash,
9293 enum pkt_hash_types *type);
9394 void (*get_rx_header_len)(struct dma_desc *p, unsigned int *len);
94− void (*set_sec_addr)(struct dma_desc *p, dma_addr_t addr);
95+ void (*set_sec_addr)(struct dma_desc *p, dma_addr_t addr, bool buf2_valid);
9596 void (*set_sarc)(struct dma_desc *p, u32 sarc_type);
9697 void (*set_vlan_tag)(struct dma_desc *p, u16 tag, u16 inner_tag,
9798 u32 inner_type);
drivers/net/ethernet/stmicro/stmmac/norm_desc.c+6−3
@@ -269,19 +269,22 @@ static int ndesc_get_rx_timestamp_status(void *desc, void *next_desc, u32 ats) · 268 unmodified lines
269269 return 1;
270270 }
271271
272−static void ndesc_display_ring(void *head, unsigned int size, bool rx)
272+static void ndesc_display_ring(void *head, unsigned int size, bool rx,
273+ dma_addr_t dma_rx_phy, unsigned int desc_size)
273274 {
274275 struct dma_desc *p = (struct dma_desc *)head;
276+ dma_addr_t dma_addr;
275277 int i;
276278
277279 pr_info("%s descriptor ring:\n", rx ? "RX" : "TX");
278280
279281 for (i = 0; i < size; i++) {
280282 u64 x;
283+ dma_addr = dma_rx_phy + i * sizeof(*p);
281284
282285 x = *(u64 *)p;
283− pr_info("%03d [0x%x]: 0x%x 0x%x 0x%x 0x%x",
284− i, (unsigned int)virt_to_phys(p),
286+ pr_info("%03d [%pad]: 0x%x 0x%x 0x%x 0x%x",
287+ i, &dma_addr,
285288 (unsigned int)x, (unsigned int)(x >> 32),
286289 p->des2, p->des3);
287290 p++;
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+135−25
@@ -1133,6 +1133,7 @@ static int stmmac_phy_setup(struct stmmac_priv *priv) · 1132 unmodified lines
11331133 static void stmmac_display_rx_rings(struct stmmac_priv *priv)
11341134 {
11351135 u32 rx_cnt = priv->plat->rx_queues_to_use;
1136+ unsigned int desc_size;
11361137 void *head_rx;
11371138 u32 queue;
11381139
@@ -1142,19 +1143,24 @@ static void stmmac_display_rx_rings(struct stmmac_priv *priv) · 3 unmodified lines
11421143
11431144 pr_info("\tRX Queue %u rings\n", queue);
11441145
1145− if (priv->extend_desc)
1146+ if (priv->extend_desc) {
11461147 head_rx = (void *)rx_q->dma_erx;
1147− else
1148+ desc_size = sizeof(struct dma_extended_desc);
1149+ } else {
11481150 head_rx = (void *)rx_q->dma_rx;
1151+ desc_size = sizeof(struct dma_desc);
1152+ }
11491153
11501154 /* Display RX ring */
1151− stmmac_display_ring(priv, head_rx, priv->dma_rx_size, true);
1155+ stmmac_display_ring(priv, head_rx, priv->dma_rx_size, true,
1156+ rx_q->dma_rx_phy, desc_size);
11521157 }
11531158 }
11541159
11551160 static void stmmac_display_tx_rings(struct stmmac_priv *priv)
11561161 {
11571162 u32 tx_cnt = priv->plat->tx_queues_to_use;
1163+ unsigned int desc_size;
11581164 void *head_tx;
11591165 u32 queue;
11601166
@@ -1164,14 +1170,19 @@ static void stmmac_display_tx_rings(struct stmmac_priv *priv) · 3 unmodified lines
11641170
11651171 pr_info("\tTX Queue %d rings\n", queue);
11661172
1167− if (priv->extend_desc)
1173+ if (priv->extend_desc) {
11681174 head_tx = (void *)tx_q->dma_etx;
1169− else if (tx_q->tbs & STMMAC_TBS_AVAIL)
1175+ desc_size = sizeof(struct dma_extended_desc);
1176+ } else if (tx_q->tbs & STMMAC_TBS_AVAIL) {
11701177 head_tx = (void *)tx_q->dma_entx;
1171− else
1178+ desc_size = sizeof(struct dma_edesc);
1179+ } else {
11721180 head_tx = (void *)tx_q->dma_tx;
1181+ desc_size = sizeof(struct dma_desc);
1182+ }
11731183
1174− stmmac_display_ring(priv, head_tx, priv->dma_tx_size, false);
1184+ stmmac_display_ring(priv, head_tx, priv->dma_tx_size, false,
1185+ tx_q->dma_tx_phy, desc_size);
11751186 }
11761187 }
11771188
@@ -1303,9 +1314,10 @@ static int stmmac_init_rx_buffers(struct stmmac_priv *priv, struct dma_desc *p, · 125 unmodified lines
13031314 return -ENOMEM;
13041315
13051316 buf->sec_addr = page_pool_get_dma_addr(buf->sec_page);
1306− stmmac_set_desc_sec_addr(priv, p, buf->sec_addr);
1317+ stmmac_set_desc_sec_addr(priv, p, buf->sec_addr, true);
13071318 } else {
13081319 buf->sec_page = NULL;
1320+ stmmac_set_desc_sec_addr(priv, p, buf->sec_addr, false);
13091321 }
13101322
13111323 buf->addr = page_pool_get_dma_addr(buf->page);
@@ -1367,6 +1379,88 @@ static void stmmac_free_tx_buffer(struct stmmac_priv *priv, u32 queue, int i) · 55 unmodified lines
13671379 }
13681380 }
13691381
1382+/**
1383+ * stmmac_reinit_rx_buffers - reinit the RX descriptor buffer.
1384+ * @priv: driver private structure
1385+ * Description: this function is called to re-allocate a receive buffer, perform
1386+ * the DMA mapping and init the descriptor.
1387+ */
1388+static void stmmac_reinit_rx_buffers(struct stmmac_priv *priv)
1389+{
1390+ u32 rx_count = priv->plat->rx_queues_to_use;
1391+ u32 queue;
1392+ int i;
1393+
1394+ for (queue = 0; queue < rx_count; queue++) {
1395+ struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
1396+
1397+ for (i = 0; i < priv->dma_rx_size; i++) {
1398+ struct stmmac_rx_buffer *buf = &rx_q->buf_pool[i];
1399+
1400+ if (buf->page) {
1401+ page_pool_recycle_direct(rx_q->page_pool, buf->page);
1402+ buf->page = NULL;
1403+ }
1404+
1405+ if (priv->sph && buf->sec_page) {
1406+ page_pool_recycle_direct(rx_q->page_pool, buf->sec_page);
1407+ buf->sec_page = NULL;
1408+ }
1409+ }
1410+ }
1411+
1412+ for (queue = 0; queue < rx_count; queue++) {
1413+ struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
1414+
1415+ for (i = 0; i < priv->dma_rx_size; i++) {
1416+ struct stmmac_rx_buffer *buf = &rx_q->buf_pool[i];
1417+ struct dma_desc *p;
1418+
1419+ if (priv->extend_desc)
1420+ p = &((rx_q->dma_erx + i)->basic);
1421+ else
1422+ p = rx_q->dma_rx + i;
1423+
1424+ if (!buf->page) {
1425+ buf->page = page_pool_dev_alloc_pages(rx_q->page_pool);
1426+ if (!buf->page)
1427+ goto err_reinit_rx_buffers;
1428+
1429+ buf->addr = page_pool_get_dma_addr(buf->page);
1430+ }
1431+
1432+ if (priv->sph && !buf->sec_page) {
1433+ buf->sec_page = page_pool_dev_alloc_pages(rx_q->page_pool);
1434+ if (!buf->sec_page)
1435+ goto err_reinit_rx_buffers;
1436+
1437+ buf->sec_addr = page_pool_get_dma_addr(buf->sec_page);
1438+ }
1439+
1440+ stmmac_set_desc_addr(priv, p, buf->addr);
1441+ if (priv->sph)
1442+ stmmac_set_desc_sec_addr(priv, p, buf->sec_addr, true);
1443+ else
1444+ stmmac_set_desc_sec_addr(priv, p, buf->sec_addr, false);
1445+ if (priv->dma_buf_sz == BUF_SIZE_16KiB)
1446+ stmmac_init_desc3(priv, p);
1447+ }
1448+ }
1449+
1450+ return;
1451+
1452+err_reinit_rx_buffers:
1453+ do {
1454+ while (--i >= 0)
1455+ stmmac_free_rx_buffer(priv, queue, i);
1456+
1457+ if (queue == 0)
1458+ break;
1459+
1460+ i = priv->dma_rx_size;
1461+ } while (queue-- > 0);
1462+}
1463+
13701464 /**
13711465 * init_dma_rx_desc_rings - init the RX descriptor rings
13721466 * @dev: net device structure
@@ -3648,7 +3742,10 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue) · 2275 unmodified lines
36483742 DMA_FROM_DEVICE);
36493743
36503744 stmmac_set_desc_addr(priv, p, buf->addr);
3651− stmmac_set_desc_sec_addr(priv, p, buf->sec_addr);
3745+ if (priv->sph)
3746+ stmmac_set_desc_sec_addr(priv, p, buf->sec_addr, true);
3747+ else
3748+ stmmac_set_desc_sec_addr(priv, p, buf->sec_addr, false);
36523749 stmmac_refill_desc3(priv, rx_q, p);
36533750
36543751 rx_q->rx_count_frames++;
@@ -3736,18 +3833,23 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) · 81 unmodified lines
37363833 unsigned int count = 0, error = 0, len = 0;
37373834 int status = 0, coe = priv->hw->rx_csum;
37383835 unsigned int next_entry = rx_q->cur_rx;
3836+ unsigned int desc_size;
37393837 struct sk_buff *skb = NULL;
37403838
37413839 if (netif_msg_rx_status(priv)) {
37423840 void *rx_head;
37433841
37443842 netdev_dbg(priv->dev, "%s: descriptor ring:\n", __func__);
3745− if (priv->extend_desc)
3843+ if (priv->extend_desc) {
37463844 rx_head = (void *)rx_q->dma_erx;
3747− else
3845+ desc_size = sizeof(struct dma_extended_desc);
3846+ } else {
37483847 rx_head = (void *)rx_q->dma_rx;
3848+ desc_size = sizeof(struct dma_desc);
3849+ }
37493850
3750− stmmac_display_ring(priv, rx_head, priv->dma_rx_size, true);
3851+ stmmac_display_ring(priv, rx_head, priv->dma_rx_size, true,
3852+ rx_q->dma_rx_phy, desc_size);
37513853 }
37523854 while (count < limit) {
37533855 unsigned int buf1_len = 0, buf2_len = 0;
@@ -4315,24 +4417,27 @@ static int stmmac_set_mac_address(struct net_device *ndev, void *addr) · 561 unmodified lines
43154417 static struct dentry *stmmac_fs_dir;
43164418
43174419 static void sysfs_display_ring(void *head, int size, int extend_desc,
4318− struct seq_file *seq)
4420+ struct seq_file *seq, dma_addr_t dma_phy_addr)
43194421 {
43204422 int i;
43214423 struct dma_extended_desc *ep = (struct dma_extended_desc *)head;
43224424 struct dma_desc *p = (struct dma_desc *)head;
4425+ dma_addr_t dma_addr;
43234426
43244427 for (i = 0; i < size; i++) {
43254428 if (extend_desc) {
4326− seq_printf(seq, "%d [0x%x]: 0x%x 0x%x 0x%x 0x%x\n",
4327− i, (unsigned int)virt_to_phys(ep),
4429+ dma_addr = dma_phy_addr + i * sizeof(*ep);
4430+ seq_printf(seq, "%d [%pad]: 0x%x 0x%x 0x%x 0x%x\n",
4431+ i, &dma_addr,
43284432 le32_to_cpu(ep->basic.des0),
43294433 le32_to_cpu(ep->basic.des1),
43304434 le32_to_cpu(ep->basic.des2),
43314435 le32_to_cpu(ep->basic.des3));
43324436 ep++;
43334437 } else {
4334− seq_printf(seq, "%d [0x%x]: 0x%x 0x%x 0x%x 0x%x\n",
4335− i, (unsigned int)virt_to_phys(p),
4438+ dma_addr = dma_phy_addr + i * sizeof(*p);
4439+ seq_printf(seq, "%d [%pad]: 0x%x 0x%x 0x%x 0x%x\n",
4440+ i, &dma_addr,
43364441 le32_to_cpu(p->des0), le32_to_cpu(p->des1),
43374442 le32_to_cpu(p->des2), le32_to_cpu(p->des3));
43384443 p++;
@@ -4360,11 +4465,11 @@ static int stmmac_rings_status_show(struct seq_file *seq, void *v) · 21 unmodified lines
43604465 if (priv->extend_desc) {
43614466 seq_printf(seq, "Extended descriptor ring:\n");
43624467 sysfs_display_ring((void *)rx_q->dma_erx,
4363− priv->dma_rx_size, 1, seq);
4468+ priv->dma_rx_size, 1, seq, rx_q->dma_rx_phy);
43644469 } else {
43654470 seq_printf(seq, "Descriptor ring:\n");
43664471 sysfs_display_ring((void *)rx_q->dma_rx,
4367− priv->dma_rx_size, 0, seq);
4472+ priv->dma_rx_size, 0, seq, rx_q->dma_rx_phy);
43684473 }
43694474 }
43704475
@@ -4376,11 +4481,11 @@ static int stmmac_rings_status_show(struct seq_file *seq, void *v) · 5 unmodified lines
43764481 if (priv->extend_desc) {
43774482 seq_printf(seq, "Extended descriptor ring:\n");
43784483 sysfs_display_ring((void *)tx_q->dma_etx,
4379− priv->dma_tx_size, 1, seq);
4484+ priv->dma_tx_size, 1, seq, tx_q->dma_tx_phy);
43804485 } else if (!(tx_q->tbs & STMMAC_TBS_AVAIL)) {
43814486 seq_printf(seq, "Descriptor ring:\n");
43824487 sysfs_display_ring((void *)tx_q->dma_tx,
4383− priv->dma_tx_size, 0, seq);
4488+ priv->dma_tx_size, 0, seq, tx_q->dma_tx_phy);
43844489 }
43854490 }
43864491
@@ -5144,13 +5249,16 @@ int stmmac_dvr_remove(struct device *dev) · 757 unmodified lines
51445249 netdev_info(priv->dev, "%s: removing driver", __func__);
51455250
51465251 stmmac_stop_all_dma(priv);
5252+ stmmac_mac_set(priv, priv->ioaddr, false);
5253+ netif_carrier_off(ndev);
5254+ unregister_netdev(ndev);
51475255
5256+ /* Serdes power down needs to happen after VLAN filter
5257+ * is deleted that is triggered by unregister_netdev().
5258+ */
51485259 if (priv->plat->serdes_powerdown)
51495260 priv->plat->serdes_powerdown(ndev, priv->plat->bsp_priv);
51505261
5151− stmmac_mac_set(priv, priv->ioaddr, false);
5152− netif_carrier_off(ndev);
5153− unregister_netdev(ndev);
51545262 #ifdef CONFIG_DEBUG_FS
51555263 stmmac_exit_fs(ndev);
51565264 #endif
@@ -5257,6 +5365,8 @@ static void stmmac_reset_queues_param(struct stmmac_priv *priv) · 100 unmodified lines
52575365 tx_q->cur_tx = 0;
52585366 tx_q->dirty_tx = 0;
52595367 tx_q->mss = 0;
5368+
5369+ netdev_tx_reset_queue(netdev_get_tx_queue(priv->dev, queue));
52605370 }
52615371 }
52625372
@@ -5318,7 +5428,7 @@ int stmmac_resume(struct device *dev) · 55 unmodified lines
53185428 mutex_lock(&priv->lock);
53195429
53205430 stmmac_reset_queues_param(priv);
5321−
5431+ stmmac_reinit_rx_buffers(priv);
53225432 stmmac_free_tx_skbufs(priv);
53235433 stmmac_clear_descriptors(priv);
53245434
drivers/net/ethernet/sun/niu.c+0−2
@@ -3931,8 +3931,6 @@ static void niu_xmac_interrupt(struct niu *np) · 3930 unmodified lines
39313931 mp->rx_mcasts += RXMAC_MC_FRM_CNT_COUNT;
39323932 if (val & XRXMAC_STATUS_RXBCAST_CNT_EXP)
39333933 mp->rx_bcasts += RXMAC_BC_FRM_CNT_COUNT;
3934− if (val & XRXMAC_STATUS_RXBCAST_CNT_EXP)
3935− mp->rx_bcasts += RXMAC_BC_FRM_CNT_COUNT;
39363934 if (val & XRXMAC_STATUS_RXHIST1_CNT_EXP)
39373935 mp->rx_hist_cnt1 += RXMAC_HIST_CNT1_COUNT;
39383936 if (val & XRXMAC_STATUS_RXHIST2_CNT_EXP)
drivers/net/ethernet/tehuti/tehuti.c+1−0
@@ -2044,6 +2044,7 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 2043 unmodified lines
20442044 /*bdx_hw_reset(priv); */
20452045 if (bdx_read_mac(priv)) {
20462046 pr_err("load MAC address failed\n");
2047+ err = -EFAULT;
20472048 goto err_out_iomap;
20482049 }
20492050 SET_NETDEV_DEV(ndev, &pdev->dev);
drivers/net/hamradio/6pack.c+0−5
@@ -171,11 +171,6 @@ static void sp_encaps(struct sixpack *sp, unsigned char *icp, int len) · 170 unmodified lines
171171 goto out_drop;
172172 }
173173
174− if (len > sp->mtu) { /* sp->mtu = AX25_MTU = max. PACLEN = 256 */
175− msg = "oversized transmit packet!";
176− goto out_drop;
177− }
178−
179174 if (p[0] > 5) {
180175 msg = "invalid KISS command";
181176 goto out_drop;
drivers/net/hyperv/hyperv_net.h+1−1
@@ -229,7 +229,7 @@ int netvsc_send(struct net_device *net, · 228 unmodified lines
229229 bool xdp_tx);
230230 void netvsc_linkstatus_callback(struct net_device *net,
231231 struct rndis_message *resp,
232− void *data);
232+ void *data, u32 data_buflen);
233233 int netvsc_recv_callback(struct net_device *net,
234234 struct netvsc_device *nvdev,
235235 struct netvsc_channel *nvchan);
drivers/net/hyperv/netvsc_drv.c+9−4
@@ -744,7 +744,7 @@ static netdev_tx_t netvsc_start_xmit(struct sk_buff *skb, · 743 unmodified lines
744744 */
745745 void netvsc_linkstatus_callback(struct net_device *net,
746746 struct rndis_message *resp,
747− void *data)
747+ void *data, u32 data_buflen)
748748 {
749749 struct rndis_indicate_status *indicate = &resp->msg.indicate_status;
750750 struct net_device_context *ndev_ctx = netdev_priv(net);
@@ -765,11 +765,16 @@ void netvsc_linkstatus_callback(struct net_device *net, · 14 unmodified lines
765765 if (indicate->status == RNDIS_STATUS_LINK_SPEED_CHANGE) {
766766 u32 speed;
767767
768− /* Validate status_buf_offset */
768+ /* Validate status_buf_offset and status_buflen.
769+ *
770+ * Certain (pre-Fe) implementations of Hyper-V's vSwitch didn't account
771+ * for the status buffer field in resp->msg_len; perform the validation
772+ * using data_buflen (>= resp->msg_len).
773+ */
769774 if (indicate->status_buflen < sizeof(speed) ||
770775 indicate->status_buf_offset < sizeof(*indicate) ||
771− resp->msg_len - RNDIS_HEADER_SIZE < indicate->status_buf_offset ||
772− resp->msg_len - RNDIS_HEADER_SIZE - indicate->status_buf_offset
776+ data_buflen - RNDIS_HEADER_SIZE < indicate->status_buf_offset ||
777+ data_buflen - RNDIS_HEADER_SIZE - indicate->status_buf_offset
773778 < indicate->status_buflen) {
774779 netdev_err(net, "invalid rndis_indicate_status packet\n");
775780 return;
drivers/net/hyperv/rndis_filter.c+1−1
@@ -620,7 +620,7 @@ int rndis_filter_receive(struct net_device *ndev, · 619 unmodified lines
620620
621621 case RNDIS_MSG_INDICATE:
622622 /* notification msgs */
623− netvsc_linkstatus_callback(ndev, rndis_msg, data);
623+ netvsc_linkstatus_callback(ndev, rndis_msg, data, buflen);
624624 break;
625625 default:
626626 netdev_err(ndev,
drivers/net/netdevsim/netdev.c+1−0
@@ -294,6 +294,7 @@ nsim_create(struct nsim_dev *nsim_dev, struct nsim_dev_port *nsim_dev_port) · 293 unmodified lines
294294 dev_net_set(dev, nsim_dev_net(nsim_dev));
295295 ns = netdev_priv(dev);
296296 ns->netdev = dev;
297+ u64_stats_init(&ns->syncp);
297298 ns->nsim_dev = nsim_dev;
298299 ns->nsim_dev_port = nsim_dev_port;
299300 ns->nsim_bus_dev = nsim_dev->nsim_bus_dev;
drivers/net/phy/dp83822.c+5−4
@@ -290,6 +290,7 @@ static int dp83822_config_intr(struct phy_device *phydev) · 289 unmodified lines
290290
291291 static irqreturn_t dp83822_handle_interrupt(struct phy_device *phydev)
292292 {
293+ bool trigger_machine = false;
293294 int irq_status;
294295
295296 /* The MISR1 and MISR2 registers are holding the interrupt status in
@@ -305,7 +306,7 @@ static irqreturn_t dp83822_handle_interrupt(struct phy_device *phydev) · 9 unmodified lines
305306 return IRQ_NONE;
306307 }
307308 if (irq_status & ((irq_status & GENMASK(7, 0)) << 8))
308− goto trigger_machine;
309+ trigger_machine = true;
309310
310311 irq_status = phy_read(phydev, MII_DP83822_MISR2);
311312 if (irq_status < 0) {
@@ -313,11 +314,11 @@ static irqreturn_t dp83822_handle_interrupt(struct phy_device *phydev) · 1 unmodified line
313314 return IRQ_NONE;
314315 }
315316 if (irq_status & ((irq_status & GENMASK(7, 0)) << 8))
316− goto trigger_machine;
317+ trigger_machine = true;
317318
318− return IRQ_NONE;
319+ if (!trigger_machine)
320+ return IRQ_NONE;
319321
320−trigger_machine:
321322 phy_trigger_machine(phydev);
322323
323324 return IRQ_HANDLED;
drivers/net/phy/dp83tc811.c+6−5
@@ -264,6 +264,7 @@ static int dp83811_config_intr(struct phy_device *phydev) · 263 unmodified lines
264264
265265 static irqreturn_t dp83811_handle_interrupt(struct phy_device *phydev)
266266 {
267+ bool trigger_machine = false;
267268 int irq_status;
268269
269270 /* The INT_STAT registers 1, 2 and 3 are holding the interrupt status
@@ -279,7 +280,7 @@ static irqreturn_t dp83811_handle_interrupt(struct phy_device *phydev) · 9 unmodified lines
279280 return IRQ_NONE;
280281 }
281282 if (irq_status & ((irq_status & GENMASK(7, 0)) << 8))
282− goto trigger_machine;
283+ trigger_machine = true;
283284
284285 irq_status = phy_read(phydev, MII_DP83811_INT_STAT2);
285286 if (irq_status < 0) {
@@ -287,7 +288,7 @@ static irqreturn_t dp83811_handle_interrupt(struct phy_device *phydev) · 1 unmodified line
287288 return IRQ_NONE;
288289 }
289290 if (irq_status & ((irq_status & GENMASK(7, 0)) << 8))
290− goto trigger_machine;
291+ trigger_machine = true;
291292
292293 irq_status = phy_read(phydev, MII_DP83811_INT_STAT3);
293294 if (irq_status < 0) {
@@ -295,11 +296,11 @@ static irqreturn_t dp83811_handle_interrupt(struct phy_device *phydev) · 1 unmodified line
295296 return IRQ_NONE;
296297 }
297298 if (irq_status & ((irq_status & GENMASK(7, 0)) << 8))
298− goto trigger_machine;
299+ trigger_machine = true;
299300
300− return IRQ_NONE;
301+ if (!trigger_machine)
302+ return IRQ_NONE;
301303
302−trigger_machine:
303304 phy_trigger_machine(phydev);
304305
305306 return IRQ_HANDLED;
drivers/net/phy/phy.c+4−2
@@ -276,14 +276,16 @@ int phy_ethtool_ksettings_set(struct phy_device *phydev, · 275 unmodified lines
276276
277277 phydev->autoneg = autoneg;
278278
279− phydev->speed = speed;
279+ if (autoneg == AUTONEG_DISABLE) {
280+ phydev->speed = speed;
281+ phydev->duplex = duplex;
282+ }
280283
281284 linkmode_copy(phydev->advertising, advertising);
282285
283286 linkmode_mod_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
284287 phydev->advertising, autoneg == AUTONEG_ENABLE);
285288
286− phydev->duplex = duplex;
287289 phydev->master_slave_set = cmd->base.master_slave_cfg;
288290 phydev->mdix_ctrl = cmd->base.eth_tp_mdix_ctrl;
289291
drivers/net/phy/phy_device.c+2−4
@@ -230,7 +230,6 @@ static struct phy_driver genphy_driver; · 229 unmodified lines
230230 static LIST_HEAD(phy_fixup_list);
231231 static DEFINE_MUTEX(phy_fixup_lock);
232232
233−#ifdef CONFIG_PM
234233 static bool mdio_bus_phy_may_suspend(struct phy_device *phydev)
235234 {
236235 struct device_driver *drv = phydev->mdio.dev.driver;
@@ -270,7 +269,7 @@ out: · 33 unmodified lines
270269 return !phydev->suspended;
271270 }
272271
273−static int mdio_bus_phy_suspend(struct device *dev)
272+static __maybe_unused int mdio_bus_phy_suspend(struct device *dev)
274273 {
275274 struct phy_device *phydev = to_phy_device(dev);
276275
@@ -290,7 +289,7 @@ static int mdio_bus_phy_suspend(struct device *dev) · 13 unmodified lines
290289 return phy_suspend(phydev);
291290 }
292291
293−static int mdio_bus_phy_resume(struct device *dev)
292+static __maybe_unused int mdio_bus_phy_resume(struct device *dev)
294293 {
295294 struct phy_device *phydev = to_phy_device(dev);
296295 int ret;
@@ -316,7 +315,6 @@ no_resume: · 19 unmodified lines
316315
317316 static SIMPLE_DEV_PM_OPS(mdio_bus_phy_pm_ops, mdio_bus_phy_suspend,
318317 mdio_bus_phy_resume);
319−#endif /* CONFIG_PM */
320318
321319 /**
322320 * phy_register_fixup - creates a new phy_fixup and adds it to the list
drivers/net/usb/cdc_ncm.c+5−5
@@ -851,17 +851,17 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_ · 850 unmodified lines
851851
852852 /* check if we got everything */
853853 if (!ctx->data) {
854− dev_dbg(&intf->dev, "CDC Union missing and no IAD found\n");
854+ dev_err(&intf->dev, "CDC Union missing and no IAD found\n");
855855 goto error;
856856 }
857857 if (cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting)) {
858858 if (!ctx->mbim_desc) {
859− dev_dbg(&intf->dev, "MBIM functional descriptor missing\n");
859+ dev_err(&intf->dev, "MBIM functional descriptor missing\n");
860860 goto error;
861861 }
862862 } else {
863863 if (!ctx->ether_desc || !ctx->func_desc) {
864− dev_dbg(&intf->dev, "NCM or ECM functional descriptors missing\n");
864+ dev_err(&intf->dev, "NCM or ECM functional descriptors missing\n");
865865 goto error;
866866 }
867867 }
@@ -870,7 +870,7 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_ · 2 unmodified lines
870870 if (ctx->data != ctx->control) {
871871 temp = usb_driver_claim_interface(driver, ctx->data, dev);
872872 if (temp) {
873− dev_dbg(&intf->dev, "failed to claim data intf\n");
873+ dev_err(&intf->dev, "failed to claim data intf\n");
874874 goto error;
875875 }
876876 }
@@ -926,7 +926,7 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_ · 49 unmodified lines
926926 if (ctx->ether_desc) {
927927 temp = usbnet_get_ethernet_addr(dev, ctx->ether_desc->iMACAddress);
928928 if (temp) {
929− dev_dbg(&intf->dev, "failed to get mac address\n");
929+ dev_err(&intf->dev, "failed to get mac address\n");
930930 goto error2;
931931 }
932932 dev_info(&intf->dev, "MAC-Address: %pM\n", dev->net->dev_addr);
drivers/net/usb/qmi_wwan.c+0−14
@@ -429,13 +429,6 @@ static ssize_t add_mux_store(struct device *d, struct device_attribute *attr, c · 428 unmodified lines
429429 goto err;
430430 }
431431
432− /* we don't want to modify a running netdev */
433− if (netif_running(dev->net)) {
434− netdev_err(dev->net, "Cannot change a running device\n");
435− ret = -EBUSY;
436− goto err;
437− }
438−
439432 ret = qmimux_register_device(dev->net, mux_id);
440433 if (!ret) {
441434 info->flags |= QMI_WWAN_FLAG_MUX;
@@ -465,13 +458,6 @@ static ssize_t del_mux_store(struct device *d, struct device_attribute *attr, c · 23 unmodified lines
465458 if (!rtnl_trylock())
466459 return restart_syscall();
467460
468− /* we don't want to modify a running netdev */
469− if (netif_running(dev->net)) {
470− netdev_err(dev->net, "Cannot change a running device\n");
471− ret = -EBUSY;
472− goto err;
473− }
474−
475461 del_dev = qmimux_find_dev(dev, mux_id);
476462 if (!del_dev) {
477463 netdev_err(dev->net, "mux_id not present\n");
drivers/net/usb/r8152.c+6−29
@@ -3021,29 +3021,6 @@ static void __rtl_set_wol(struct r8152 *tp, u32 wolopts) · 3020 unmodified lines
30213021 device_set_wakeup_enable(&tp->udev->dev, false);
30223022 }
30233023
3024−static void r8153_mac_clk_spd(struct r8152 *tp, bool enable)
3025−{
3026− /* MAC clock speed down */
3027− if (enable) {
3028− ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL,
3029− ALDPS_SPDWN_RATIO);
3030− ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL2,
3031− EEE_SPDWN_RATIO);
3032− ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL3,
3033− PKT_AVAIL_SPDWN_EN | SUSPEND_SPDWN_EN |
3034− U1U2_SPDWN_EN | L1_SPDWN_EN);
3035− ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL4,
3036− PWRSAVE_SPDWN_EN | RXDV_SPDWN_EN | TX10MIDLE_EN |
3037− TP100_SPDWN_EN | TP500_SPDWN_EN | EEE_SPDWN_EN |
3038− TP1000_SPDWN_EN);
3039− } else {
3040− ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL, 0);
3041− ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL2, 0);
3042− ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL3, 0);
3043− ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL4, 0);
3044− }
3045−}
3046−
30473024 static void r8153_u1u2en(struct r8152 *tp, bool enable)
30483025 {
30493026 u8 u1u2[8];
@@ -3338,11 +3315,9 @@ static void rtl8153_runtime_enable(struct r8152 *tp, bool enable) · 288 unmodified lines
33383315 if (enable) {
33393316 r8153_u1u2en(tp, false);
33403317 r8153_u2p3en(tp, false);
3341− r8153_mac_clk_spd(tp, true);
33423318 rtl_runtime_suspend_enable(tp, true);
33433319 } else {
33443320 rtl_runtime_suspend_enable(tp, false);
3345− r8153_mac_clk_spd(tp, false);
33463321
33473322 switch (tp->version) {
33483323 case RTL_VER_03:
@@ -4718,7 +4693,6 @@ static void r8153_first_init(struct r8152 *tp) · 1369 unmodified lines
47184693 {
47194694 u32 ocp_data;
47204695
4721− r8153_mac_clk_spd(tp, false);
47224696 rxdy_gated_en(tp, true);
47234697 r8153_teredo_off(tp);
47244698
@@ -4769,8 +4743,6 @@ static void r8153_enter_oob(struct r8152 *tp) · 44 unmodified lines
47694743 {
47704744 u32 ocp_data;
47714745
4772− r8153_mac_clk_spd(tp, true);
4773−
47744746 ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL);
47754747 ocp_data &= ~NOW_IS_OOB;
47764748 ocp_write_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL, ocp_data);
@@ -5496,10 +5468,15 @@ static void r8153_init(struct r8152 *tp) · 719 unmodified lines
54965468
54975469 ocp_write_word(tp, MCU_TYPE_USB, USB_CONNECT_TIMER, 0x0001);
54985470
5471+ /* MAC clock speed down */
5472+ ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL, 0);
5473+ ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL2, 0);
5474+ ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL3, 0);
5475+ ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL4, 0);
5476+
54995477 r8153_power_cut_en(tp, false);
55005478 rtl_runtime_suspend_enable(tp, false);
55015479 r8153_u1u2en(tp, true);
5502− r8153_mac_clk_spd(tp, false);
55035480 usb_enable_lpm(tp->udev);
55045481
55055482 ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_CONFIG6);
drivers/net/usb/usbnet.c+1−1
@@ -887,7 +887,7 @@ int usbnet_open (struct net_device *net) · 886 unmodified lines
887887
888888 // insist peer be connected
889889 if (info->check_connect && (retval = info->check_connect (dev)) < 0) {
890− netif_dbg(dev, ifup, dev->net, "can't open; %d\n", retval);
890+ netif_err(dev, ifup, dev->net, "can't open; %d\n", retval);
891891 goto done;
892892 }
893893
drivers/net/wan/fsl_ucc_hdlc.c+6−2
@@ -204,14 +204,18 @@ static int uhdlc_init(struct ucc_hdlc_private *priv) · 203 unmodified lines
204204 priv->rx_skbuff = kcalloc(priv->rx_ring_size,
205205 sizeof(*priv->rx_skbuff),
206206 GFP_KERNEL);
207− if (!priv->rx_skbuff)
207+ if (!priv->rx_skbuff) {
208+ ret = -ENOMEM;
208209 goto free_ucc_pram;
210+ }
209211
210212 priv->tx_skbuff = kcalloc(priv->tx_ring_size,
211213 sizeof(*priv->tx_skbuff),
212214 GFP_KERNEL);
213− if (!priv->tx_skbuff)
215+ if (!priv->tx_skbuff) {
216+ ret = -ENOMEM;
214217 goto free_rx_skbuff;
218+ }
215219
216220 priv->skb_curtx = 0;
217221 priv->skb_dirtytx = 0;
drivers/net/wan/lapbether.c+0−3
@@ -292,7 +292,6 @@ static int lapbeth_open(struct net_device *dev) · 291 unmodified lines
292292 return -ENODEV;
293293 }
294294
295− netif_start_queue(dev);
296295 return 0;
297296 }
298297
@@ -300,8 +299,6 @@ static int lapbeth_close(struct net_device *dev) · 1 unmodified line
300299 {
301300 int err;
302301
303− netif_stop_queue(dev);
304−
305302 if ((err = lapb_unregister(dev)) != LAPB_OK)
306303 pr_err("lapb_unregister error: %d\n", err);
307304
drivers/net/wireless/ath/ath11k/mac.c+2−2
@@ -5450,8 +5450,8 @@ ath11k_mac_op_assign_vif_chanctx(struct ieee80211_hw *hw, · 5449 unmodified lines
54505450 }
54515451
54525452 if (ab->hw_params.vdev_start_delay &&
5453− (arvif->vdev_type == WMI_VDEV_TYPE_AP ||
5454− arvif->vdev_type == WMI_VDEV_TYPE_MONITOR)) {
5453+ arvif->vdev_type != WMI_VDEV_TYPE_AP &&
5454+ arvif->vdev_type != WMI_VDEV_TYPE_MONITOR) {
54555455 param.vdev_id = arvif->vdev_id;
54565456 param.peer_type = WMI_PEER_TYPE_DEFAULT;
54575457 param.peer_addr = ar->mac_addr;
drivers/net/wireless/ath/ath11k/qmi.c+2−2
@@ -1687,8 +1687,8 @@ static int ath11k_qmi_respond_fw_mem_request(struct ath11k_base *ab) · 1686 unmodified lines
16871687 req->mem_seg[i].size = ab->qmi.target_mem[i].size;
16881688 req->mem_seg[i].type = ab->qmi.target_mem[i].type;
16891689 ath11k_dbg(ab, ATH11K_DBG_QMI,
1690− "qmi req mem_seg[%d] 0x%llx %u %u\n", i,
1691− ab->qmi.target_mem[i].paddr,
1690+ "qmi req mem_seg[%d] %pad %u %u\n", i,
1691+ &ab->qmi.target_mem[i].paddr,
16921692 ab->qmi.target_mem[i].size,
16931693 ab->qmi.target_mem[i].type);
16941694 }
drivers/net/wireless/ath/ath9k/ath9k.h+2−1
@@ -177,7 +177,8 @@ struct ath_frame_info { · 176 unmodified lines
177177 s8 txq;
178178 u8 keyix;
179179 u8 rtscts_rate;
180− u8 retries : 7;
180+ u8 retries : 6;
181+ u8 dyn_smps : 1;
181182 u8 baw_tracked : 1;
182183 u8 tx_power;
183184 enum ath9k_key_type keytype:2;
drivers/net/wireless/ath/ath9k/xmit.c+6−0
@@ -1271,6 +1271,11 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, · 1270 unmodified lines
12711271 is_40, is_sgi, is_sp);
12721272 if (rix < 8 && (tx_info->flags & IEEE80211_TX_CTL_STBC))
12731273 info->rates[i].RateFlags |= ATH9K_RATESERIES_STBC;
1274+ if (rix >= 8 && fi->dyn_smps) {
1275+ info->rates[i].RateFlags |=
1276+ ATH9K_RATESERIES_RTS_CTS;
1277+ info->flags |= ATH9K_TXDESC_CTSENA;
1278+ }
12741279
12751280 info->txpower[i] = ath_get_rate_txpower(sc, bf, rix,
12761281 is_40, false);
@@ -2114,6 +2119,7 @@ static void setup_frame_info(struct ieee80211_hw *hw, · 837 unmodified lines
21142119 fi->keyix = an->ps_key;
21152120 else
21162121 fi->keyix = ATH9K_TXKEYIX_INVALID;
2122+ fi->dyn_smps = sta && sta->smps_mode == IEEE80211_SMPS_DYNAMIC;
21172123 fi->keytype = keytype;
21182124 fi->framelen = framelen;
21192125 fi->tx_power = txpower;
drivers/net/wireless/intel/iwlwifi/fw/pnvm.c+2−2
@@ -271,12 +271,12 @@ static int iwl_pnvm_get_from_efi(struct iwl_trans *trans, · 270 unmodified lines
271271 err = efivar_entry_get(pnvm_efivar, NULL, &package_size, package);
272272 if (err) {
273273 IWL_DEBUG_FW(trans,
274− "PNVM UEFI variable not found %d (len %zd)\n",
274+ "PNVM UEFI variable not found %d (len %lu)\n",
275275 err, package_size);
276276 goto out;
277277 }
278278
279− IWL_DEBUG_FW(trans, "Read PNVM fro UEFI with size %zd\n", package_size);
279+ IWL_DEBUG_FW(trans, "Read PNVM fro UEFI with size %lu\n", package_size);
280280
281281 *data = kmemdup(package->data, *len, GFP_KERNEL);
282282 if (!*data)
drivers/net/wireless/intel/iwlwifi/iwl-op-mode.h+2−0
@@ -205,6 +205,8 @@ static inline void iwl_op_mode_time_point(struct iwl_op_mode *op_mode, · 204 unmodified lines
205205 enum iwl_fw_ini_time_point tp_id,
206206 union iwl_dbg_tlv_tp_data *tp_data)
207207 {
208+ if (!op_mode || !op_mode->ops || !op_mode->ops->time_point)
209+ return;
208210 op_mode->ops->time_point(op_mode, tp_id, tp_data);
209211 }
210212
drivers/net/wireless/intel/iwlwifi/mvm/fw.c+1−0
@@ -1083,6 +1083,7 @@ static const struct dmi_system_id dmi_ppag_approved_list[] = { · 1082 unmodified lines
10831083 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTek COMPUTER INC."),
10841084 },
10851085 },
1086+ {}
10861087 };
10871088
10881089 static int iwl_mvm_ppag_init(struct iwl_mvm *mvm)
drivers/net/wireless/intel/iwlwifi/pcie/drv.c+2−1
@@ -1106,6 +1106,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 1105 unmodified lines
11061106 }
11071107 }
11081108
1109+#if IS_ENABLED(CONFIG_IWLMVM)
1110+
11091111 /*
11101112 * Workaround for problematic SnJ device: sometimes when
11111113 * certain RF modules are connected to SnJ, the device ID
@@ -1116,7 +1118,6 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 4 unmodified lines
11161118 if (CSR_HW_REV_TYPE(iwl_trans->hw_rev) == IWL_CFG_MAC_TYPE_SNJ)
11171119 iwl_trans->trans_cfg = &iwl_so_trans_cfg;
11181120
1119−#if IS_ENABLED(CONFIG_IWLMVM)
11201121 /*
11211122 * special-case 7265D, it has the same PCI IDs.
11221123 *
drivers/net/wireless/intel/iwlwifi/pcie/rx.c+2−1
@@ -1129,6 +1129,8 @@ static int _iwl_pcie_rx_init(struct iwl_trans *trans) · 1128 unmodified lines
11291129
11301130 iwl_pcie_rx_init_rxb_lists(rxq);
11311131
1132+ spin_unlock_bh(&rxq->lock);
1133+
11321134 if (!rxq->napi.poll) {
11331135 int (*poll)(struct napi_struct *, int) = iwl_pcie_napi_poll;
11341136
@@ -1149,7 +1151,6 @@ static int _iwl_pcie_rx_init(struct iwl_trans *trans) · 14 unmodified lines
11491151 napi_enable(&rxq->napi);
11501152 }
11511153
1152− spin_unlock_bh(&rxq->lock);
11531154 }
11541155
11551156 /* move the pool to the default queue and allocator ownerships */
drivers/net/wireless/mediatek/mt76/dma.c+13−13
@@ -345,7 +345,6 @@ mt76_dma_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q, · 344 unmodified lines
345345 };
346346 struct ieee80211_hw *hw;
347347 int len, n = 0, ret = -ENOMEM;
348− struct mt76_queue_entry e;
349348 struct mt76_txwi_cache *t;
350349 struct sk_buff *iter;
351350 dma_addr_t addr;
@@ -387,6 +386,11 @@ mt76_dma_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q, · 35 unmodified lines
387386 }
388387 tx_info.nbuf = n;
389388
389+ if (q->queued + (tx_info.nbuf + 1) / 2 >= q->ndesc - 1) {
390+ ret = -ENOMEM;
391+ goto unmap;
392+ }
393+
390394 dma_sync_single_for_cpu(dev->dev, t->dma_addr, dev->drv->txwi_size,
391395 DMA_TO_DEVICE);
392396 ret = dev->drv->tx_prepare_skb(dev, txwi, q->qid, wcid, sta, &tx_info);
@@ -395,11 +399,6 @@ mt76_dma_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q, · 2 unmodified lines
395399 if (ret < 0)
396400 goto unmap;
397401
398− if (q->queued + (tx_info.nbuf + 1) / 2 >= q->ndesc - 1) {
399− ret = -ENOMEM;
400− goto unmap;
401− }
402−
403402 return mt76_dma_add_buf(dev, q, tx_info.buf, tx_info.nbuf,
404403 tx_info.info, tx_info.skb, t);
405404
@@ -419,9 +418,7 @@ free: · 13 unmodified lines
419418 }
420419 #endif
421420
422− e.skb = tx_info.skb;
423− e.txwi = t;
424− dev->drv->tx_complete_skb(dev, &e);
421+ dev_kfree_skb(tx_info.skb);
425422 mt76_put_txwi(dev, t);
426423 return ret;
427424 }
@@ -515,13 +512,13 @@ mt76_add_fragment(struct mt76_dev *dev, struct mt76_queue *q, void *data, · 87 unmodified lines
515512 {
516513 struct sk_buff *skb = q->rx_head;
517514 struct skb_shared_info *shinfo = skb_shinfo(skb);
515+ int nr_frags = shinfo->nr_frags;
518516
519− if (shinfo->nr_frags < ARRAY_SIZE(shinfo->frags)) {
517+ if (nr_frags < ARRAY_SIZE(shinfo->frags)) {
520518 struct page *page = virt_to_head_page(data);
521519 int offset = data - page_address(page) + q->buf_offset;
522520
523− skb_add_rx_frag(skb, shinfo->nr_frags, page, offset, len,
524− q->buf_size);
521+ skb_add_rx_frag(skb, nr_frags, page, offset, len, q->buf_size);
525522 } else {
526523 skb_free_frag(data);
527524 }
@@ -530,7 +527,10 @@ mt76_add_fragment(struct mt76_dev *dev, struct mt76_queue *q, void *data, · 2 unmodified lines
530527 return;
531528
532529 q->rx_head = NULL;
533− dev->drv->rx_skb(dev, q - dev->q_rx, skb);
530+ if (nr_frags < ARRAY_SIZE(shinfo->frags))
531+ dev->drv->rx_skb(dev, q - dev->q_rx, skb);
532+ else
533+ dev_kfree_skb(skb);
534534 }
535535
536536 static int
drivers/net/wireless/mediatek/mt76/mt7915/mac.c+5−5
@@ -967,11 +967,6 @@ int mt7915_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, · 966 unmodified lines
967967 }
968968 txp->nbuf = nbuf;
969969
970− /* pass partial skb header to fw */
971− tx_info->buf[1].len = MT_CT_PARSE_LEN;
972− tx_info->buf[1].skip_unmap = true;
973− tx_info->nbuf = MT_CT_DMA_BUF_NUM;
974−
975970 txp->flags = cpu_to_le16(MT_CT_INFO_APPLY_TXD | MT_CT_INFO_FROM_HOST);
976971
977972 if (!key)
@@ -1009,6 +1004,11 @@ int mt7915_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, · 31 unmodified lines
10091004 txp->rept_wds_wcid = cpu_to_le16(0x3ff);
10101005 tx_info->skb = DMA_DUMMY_DATA;
10111006
1007+ /* pass partial skb header to fw */
1008+ tx_info->buf[1].len = MT_CT_PARSE_LEN;
1009+ tx_info->buf[1].skip_unmap = true;
1010+ tx_info->nbuf = MT_CT_DMA_BUF_NUM;
1011+
10121012 return 0;
10131013 }
10141014
drivers/net/wireless/mediatek/mt76/mt7915/testmode.c+2−2
@@ -543,7 +543,7 @@ mt7915_tm_set_tx_cont(struct mt7915_phy *phy, bool en) · 542 unmodified lines
543543 tx_cont->bw = CMD_CBW_20MHZ;
544544 break;
545545 default:
546− break;
546+ return -EINVAL;
547547 }
548548
549549 if (!en) {
@@ -591,7 +591,7 @@ mt7915_tm_set_tx_cont(struct mt7915_phy *phy, bool en) · 41 unmodified lines
591591 mode = MT_PHY_TYPE_HE_MU;
592592 break;
593593 default:
594− break;
594+ return -EINVAL;
595595 }
596596
597597 rateval = mode << 6 | rate_idx;
drivers/net/wireless/mediatek/mt76/mt7921/mcu.c+1−3
@@ -405,10 +405,8 @@ mt7921_mcu_tx_rate_report(struct mt7921_dev *dev, struct sk_buff *skb, · 404 unmodified lines
405405 if (wlan_idx >= MT76_N_WCIDS)
406406 return;
407407 wcid = rcu_dereference(dev->mt76.wcid[wlan_idx]);
408− if (!wcid) {
409− stats->tx_rate = rate;
408+ if (!wcid)
410409 return;
411− }
412410
413411 msta = container_of(wcid, struct mt7921_sta, wcid);
414412 stats = &msta->stats;
drivers/net/xen-netback/netback.c+2−2
@@ -557,8 +557,8 @@ check_frags: · 556 unmodified lines
557557 }
558558
559559 if (skb_has_frag_list(skb) && !first_shinfo) {
560− first_shinfo = skb_shinfo(skb);
561− shinfo = skb_shinfo(skb_shinfo(skb)->frag_list);
560+ first_shinfo = shinfo;
561+ shinfo = skb_shinfo(shinfo->frag_list);
562562 nr_frags = shinfo->nr_frags;
563563
564564 goto check_frags;
drivers/nvme/host/core.c+11−4
@@ -380,6 +380,7 @@ bool nvme_cancel_request(struct request *req, void *data, bool reserved) · 379 unmodified lines
380380 return true;
381381
382382 nvme_req(req)->status = NVME_SC_HOST_ABORTED_CMD;
383+ nvme_req(req)->flags |= NVME_REQ_CANCELLED;
383384 blk_mq_complete_request(req);
384385 return true;
385386 }
@@ -1440,7 +1441,7 @@ static int nvme_identify_ns(struct nvme_ctrl *ctrl, unsigned nsid, · 1054 unmodified lines
14401441 goto out_free_id;
14411442 }
14421443
1443− error = -ENODEV;
1444+ error = NVME_SC_INVALID_NS | NVME_SC_DNR;
14441445 if ((*id)->ncap == 0) /* namespace not allocated or attached */
14451446 goto out_free_id;
14461447
@@ -4038,7 +4039,7 @@ static void nvme_ns_remove_by_nsid(struct nvme_ctrl *ctrl, u32 nsid) · 2591 unmodified lines
40384039 static void nvme_validate_ns(struct nvme_ns *ns, struct nvme_ns_ids *ids)
40394040 {
40404041 struct nvme_id_ns *id;
4041− int ret = -ENODEV;
4042+ int ret = NVME_SC_INVALID_NS | NVME_SC_DNR;
40424043
40434044 if (test_bit(NVME_NS_DEAD, &ns->flags))
40444045 goto out;
@@ -4047,7 +4048,7 @@ static void nvme_validate_ns(struct nvme_ns *ns, struct nvme_ns_ids *ids) · 2 unmodified lines
40474048 if (ret)
40484049 goto out;
40494050
4050− ret = -ENODEV;
4051+ ret = NVME_SC_INVALID_NS | NVME_SC_DNR;
40514052 if (!nvme_ns_ids_equal(&ns->head->ids, ids)) {
40524053 dev_err(ns->ctrl->device,
40534054 "identifiers changed for nsid %d\n", ns->head->ns_id);
@@ -4065,7 +4066,7 @@ out: · 11 unmodified lines
40654066 *
40664067 * TODO: we should probably schedule a delayed retry here.
40674068 */
4068− if (ret && ret != -ENOMEM && !(ret > 0 && !(ret & NVME_SC_DNR)))
4069+ if (ret > 0 && (ret & NVME_SC_DNR))
40694070 nvme_ns_remove(ns);
40704071 }
40714072
@@ -4095,6 +4096,12 @@ static void nvme_validate_or_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid) · 23 unmodified lines
40954096 nsid);
40964097 break;
40974098 }
4099+ if (!nvme_multi_css(ctrl)) {
4100+ dev_warn(ctrl->device,
4101+ "command set not reported for nsid: %d\n",
4102+ nsid);
4103+ break;
4104+ }
40984105 nvme_alloc_ns(ctrl, nsid, &ids);
40994106 break;
41004107 default:
drivers/nvme/host/fc.c+3−2
@@ -1956,7 +1956,7 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req) · 1955 unmodified lines
19561956 sizeof(op->rsp_iu), DMA_FROM_DEVICE);
19571957
19581958 if (opstate == FCPOP_STATE_ABORTED)
1959− status = cpu_to_le16(NVME_SC_HOST_PATH_ERROR << 1);
1959+ status = cpu_to_le16(NVME_SC_HOST_ABORTED_CMD << 1);
19601960 else if (freq->status) {
19611961 status = cpu_to_le16(NVME_SC_HOST_PATH_ERROR << 1);
19621962 dev_info(ctrl->ctrl.device,
@@ -2055,7 +2055,7 @@ done: · 92 unmodified lines
20552055 nvme_fc_complete_rq(rq);
20562056
20572057 check_error:
2058− if (terminate_assoc)
2058+ if (terminate_assoc && ctrl->ctrl.state != NVME_CTRL_RESETTING)
20592059 queue_work(nvme_reset_wq, &ctrl->ioerr_work);
20602060 }
20612061
@@ -2443,6 +2443,7 @@ nvme_fc_terminate_exchange(struct request *req, void *data, bool reserved) · 381 unmodified lines
24432443 struct nvme_fc_ctrl *ctrl = to_fc_ctrl(nctrl);
24442444 struct nvme_fc_fcp_op *op = blk_mq_rq_to_pdu(req);
24452445
2446+ op->nreq.flags |= NVME_REQ_CANCELLED;
24462447 __nvme_fc_abort_op(ctrl, op);
24472448 return true;
24482449 }
drivers/nvme/host/pci.c+1−0
@@ -3246,6 +3246,7 @@ static const struct pci_device_id nvme_id_table[] = { · 3245 unmodified lines
32463246 .driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY, },
32473247 { PCI_DEVICE(0x144d, 0xa822), /* Samsung PM1725a */
32483248 .driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY |
3249+ NVME_QUIRK_DISABLE_WRITE_ZEROES|
32493250 NVME_QUIRK_IGNORE_DEV_SUBNQN, },
32503251 { PCI_DEVICE(0x1987, 0x5016), /* Phison E16 */
32513252 .driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN, },
drivers/nvme/host/zns.c+7−2
@@ -9,7 +9,13 @@ · 8 unmodified lines
99
1010 int nvme_revalidate_zones(struct nvme_ns *ns)
1111 {
12− return blk_revalidate_disk_zones(ns->disk, NULL);
12+ struct request_queue *q = ns->queue;
13+ int ret;
14+
15+ ret = blk_revalidate_disk_zones(ns->disk, NULL);
16+ if (!ret)
17+ blk_queue_max_zone_append_sectors(q, ns->ctrl->max_zone_append);
18+ return ret;
1319 }
1420
1521 static int nvme_set_max_append(struct nvme_ctrl *ctrl)
@@ -107,7 +113,6 @@ int nvme_update_zone_info(struct nvme_ns *ns, unsigned lbaf) · 91 unmodified lines
107113 blk_queue_flag_set(QUEUE_FLAG_ZONE_RESETALL, q);
108114 blk_queue_max_open_zones(q, le32_to_cpu(id->mor) + 1);
109115 blk_queue_max_active_zones(q, le32_to_cpu(id->mar) + 1);
110− blk_queue_max_zone_append_sectors(q, ns->ctrl->max_zone_append);
111116 free_data:
112117 kfree(id);
113118 return status;
drivers/nvme/target/passthru.c+3−3
@@ -50,9 +50,9 @@ static u16 nvmet_passthru_override_id_ctrl(struct nvmet_req *req) · 49 unmodified lines
5050
5151 /*
5252 * nvmet_passthru_map_sg is limitted to using a single bio so limit
53− * the mdts based on BIO_MAX_PAGES as well
53+ * the mdts based on BIO_MAX_VECS as well
5454 */
55− max_hw_sectors = min_not_zero(BIO_MAX_PAGES << (PAGE_SHIFT - 9),
55+ max_hw_sectors = min_not_zero(BIO_MAX_VECS << (PAGE_SHIFT - 9),
5656 max_hw_sectors);
5757
5858 page_shift = NVME_CAP_MPSMIN(ctrl->cap) + 12;
@@ -191,7 +191,7 @@ static int nvmet_passthru_map_sg(struct nvmet_req *req, struct request *rq) · 132 unmodified lines
191191 struct bio *bio;
192192 int i;
193193
194− if (req->sg_cnt > BIO_MAX_PAGES)
194+ if (req->sg_cnt > BIO_MAX_VECS)
195195 return -EINVAL;
196196
197197 if (req->transfer_len <= NVMET_MAX_INLINE_DATA_LEN) {
drivers/nvme/target/rdma.c+2−3
@@ -802,9 +802,8 @@ static void nvmet_rdma_write_data_done(struct ib_cq *cq, struct ib_wc *wc) · 801 unmodified lines
802802 nvmet_req_uninit(&rsp->req);
803803 nvmet_rdma_release_rsp(rsp);
804804 if (wc->status != IB_WC_WR_FLUSH_ERR) {
805− pr_info("RDMA WRITE for CQE 0x%p failed with status %s (%d).\n",
806− wc->wr_cqe, ib_wc_status_msg(wc->status),
807− wc->status);
805+ pr_info("RDMA WRITE for CQE failed with status %s (%d).\n",
806+ ib_wc_status_msg(wc->status), wc->status);
808807 nvmet_rdma_error_comp(queue);
809808 }
810809 return;
drivers/opp/core.c+25−23
@@ -1492,7 +1492,11 @@ static struct dev_pm_opp *_opp_get_next(struct opp_table *opp_table, · 1491 unmodified lines
14921492
14931493 mutex_lock(&opp_table->lock);
14941494 list_for_each_entry(temp, &opp_table->opp_list, node) {
1495− if (dynamic == temp->dynamic) {
1495+ /*
1496+ * Refcount must be dropped only once for each OPP by OPP core,
1497+ * do that with help of "removed" flag.
1498+ */
1499+ if (!temp->removed && dynamic == temp->dynamic) {
14961500 opp = temp;
14971501 break;
14981502 }
@@ -1502,10 +1506,27 @@ static struct dev_pm_opp *_opp_get_next(struct opp_table *opp_table, · 3 unmodified lines
15021506 return opp;
15031507 }
15041508
1505−bool _opp_remove_all_static(struct opp_table *opp_table)
1509+/*
1510+ * Can't call dev_pm_opp_put() from under the lock as debugfs removal needs to
1511+ * happen lock less to avoid circular dependency issues. This routine must be
1512+ * called without the opp_table->lock held.
1513+ */
1514+static void _opp_remove_all(struct opp_table *opp_table, bool dynamic)
15061515 {
15071516 struct dev_pm_opp *opp;
15081517
1518+ while ((opp = _opp_get_next(opp_table, dynamic))) {
1519+ opp->removed = true;
1520+ dev_pm_opp_put(opp);
1521+
1522+ /* Drop the references taken by dev_pm_opp_add() */
1523+ if (dynamic)
1524+ dev_pm_opp_put_opp_table(opp_table);
1525+ }
1526+}
1527+
1528+bool _opp_remove_all_static(struct opp_table *opp_table)
1529+{
15091530 mutex_lock(&opp_table->lock);
15101531
15111532 if (!opp_table->parsed_static_opps) {
@@ -1520,13 +1541,7 @@ bool _opp_remove_all_static(struct opp_table *opp_table) · 8 unmodified lines
15201541
15211542 mutex_unlock(&opp_table->lock);
15221543
1523− /*
1524− * Can't remove the OPP from under the lock, debugfs removal needs to
1525− * happen lock less to avoid circular dependency issues.
1526− */
1527− while ((opp = _opp_get_next(opp_table, false)))
1528− dev_pm_opp_put(opp);
1529−
1544+ _opp_remove_all(opp_table, false);
15301545 return true;
15311546 }
15321547
@@ -1539,25 +1554,12 @@ bool _opp_remove_all_static(struct opp_table *opp_table) · 6 unmodified lines
15391554 void dev_pm_opp_remove_all_dynamic(struct device *dev)
15401555 {
15411556 struct opp_table *opp_table;
1542− struct dev_pm_opp *opp;
1543− int count = 0;
15441557
15451558 opp_table = _find_opp_table(dev);
15461559 if (IS_ERR(opp_table))
15471560 return;
15481561
1549− /*
1550− * Can't remove the OPP from under the lock, debugfs removal needs to
1551− * happen lock less to avoid circular dependency issues.
1552− */
1553− while ((opp = _opp_get_next(opp_table, true))) {
1554− dev_pm_opp_put(opp);
1555− count++;
1556− }
1557−
1558− /* Drop the references taken by dev_pm_opp_add() */
1559− while (count--)
1560− dev_pm_opp_put_opp_table(opp_table);
1562+ _opp_remove_all(opp_table, true);
15611563
15621564 /* Drop the reference taken by _find_opp_table() */
15631565 dev_pm_opp_put_opp_table(opp_table);
drivers/opp/opp.h+2−0
@@ -56,6 +56,7 @@ extern struct list_head opp_tables, lazy_opp_tables; · 55 unmodified lines
5656 * @dynamic: not-created from static DT entries.
5757 * @turbo: true if turbo (boost) OPP
5858 * @suspend: true if suspend OPP
59+ * @removed: flag indicating that OPP's reference is dropped by OPP core.
5960 * @pstate: Device's power domain's performance state.
6061 * @rate: Frequency in hertz
6162 * @level: Performance level
@@ -78,6 +79,7 @@ struct dev_pm_opp { · 16 unmodified lines
7879 bool dynamic;
7980 bool turbo;
8081 bool suspend;
82+ bool removed;
8183 unsigned int pstate;
8284 unsigned long rate;
8385 unsigned int level;
drivers/pci/xen-pcifront.c+2−2
@@ -26,7 +26,7 @@ · 25 unmodified lines
2626 #include <xen/platform_pci.h>
2727
2828 #include <asm/xen/swiotlb-xen.h>
29−#define INVALID_GRANT_REF (0)
29+
3030 #define INVALID_EVTCHN (-1)
3131
3232 struct pci_bus_entry {
@@ -42,7 +42,7 @@ struct pcifront_device { · 9 unmodified lines
4242 struct list_head root_buses;
4343
4444 int evtchn;
45− int gnt_ref;
45+ grant_ref_t gnt_ref;
4646
4747 int irq;
4848
drivers/perf/arm_dmc620_pmu.c+1−0
@@ -681,6 +681,7 @@ static int dmc620_pmu_device_probe(struct platform_device *pdev) · 680 unmodified lines
681681 if (!name) {
682682 dev_err(&pdev->dev,
683683 "Create name failed, PMU @%pa\n", &res->start);
684+ ret = -ENOMEM;
684685 goto out_teardown_dev;
685686 }
686687
drivers/regulator/mt6315-regulator.c+2−2
@@ -41,7 +41,7 @@ struct mt6315_chip { · 40 unmodified lines
4141 .type = REGULATOR_VOLTAGE, \
4242 .id = _bid, \
4343 .owner = THIS_MODULE, \
44− .n_voltages = 0xbf, \
44+ .n_voltages = 0xc0, \
4545 .linear_ranges = mt_volt_range1, \
4646 .n_linear_ranges = ARRAY_SIZE(mt_volt_range1), \
4747 .vsel_reg = _vsel, \
@@ -69,7 +69,7 @@ static unsigned int mt6315_map_mode(u32 mode) · 21 unmodified lines
6969 case MT6315_BUCK_MODE_LP:
7070 return REGULATOR_MODE_IDLE;
7171 default:
72− return -EINVAL;
72+ return REGULATOR_MODE_INVALID;
7373 }
7474 }
7575
drivers/regulator/pca9450-regulator.c+9−1
@@ -797,6 +797,14 @@ static int pca9450_i2c_probe(struct i2c_client *i2c, · 796 unmodified lines
797797 return ret;
798798 }
799799
800+ /* Clear PRESET_EN bit in BUCK123_DVS to use DVS registers */
801+ ret = regmap_clear_bits(pca9450->regmap, PCA9450_REG_BUCK123_DVS,
802+ BUCK123_PRESET_EN);
803+ if (ret) {
804+ dev_err(&i2c->dev, "Failed to clear PRESET_EN bit: %d\n", ret);
805+ return ret;
806+ }
807+
800808 /* Set reset behavior on assertion of WDOG_B signal */
801809 ret = regmap_update_bits(pca9450->regmap, PCA9450_REG_RESET_CTRL,
802810 WDOG_B_CFG_MASK, WDOG_B_CFG_COLD_LDO12);
@@ -814,7 +822,7 @@ static int pca9450_i2c_probe(struct i2c_client *i2c, · 11 unmodified lines
814822
815823 if (IS_ERR(pca9450->sd_vsel_gpio)) {
816824 dev_err(&i2c->dev, "Failed to get SD_VSEL GPIO\n");
817− return ret;
825+ return PTR_ERR(pca9450->sd_vsel_gpio);
818826 }
819827
820828 dev_info(&i2c->dev, "%s probed.\n",
drivers/regulator/qcom-rpmh-regulator.c+3−3
@@ -726,8 +726,8 @@ static const struct rpmh_vreg_hw_data pmic5_ftsmps510 = { · 725 unmodified lines
726726 static const struct rpmh_vreg_hw_data pmic5_hfsmps515 = {
727727 .regulator_type = VRM,
728728 .ops = &rpmh_regulator_vrm_ops,
729− .voltage_range = REGULATOR_LINEAR_RANGE(2800000, 0, 4, 16000),
730− .n_voltages = 5,
729+ .voltage_range = REGULATOR_LINEAR_RANGE(320000, 0, 235, 16000),
730+ .n_voltages = 236,
731731 .pmic_mode_map = pmic_mode_map_pmic5_smps,
732732 .of_map_mode = rpmh_regulator_pmic4_smps_of_map_mode,
733733 };
@@ -901,7 +901,7 @@ static const struct rpmh_vreg_init_data pm8350_vreg_data[] = { · 167 unmodified lines
901901 };
902902
903903 static const struct rpmh_vreg_init_data pm8350c_vreg_data[] = {
904− RPMH_VREG("smps1", "smp%s1", &pmic5_hfsmps510, "vdd-s1"),
904+ RPMH_VREG("smps1", "smp%s1", &pmic5_hfsmps515, "vdd-s1"),
905905 RPMH_VREG("smps2", "smp%s2", &pmic5_ftsmps510, "vdd-s2"),
906906 RPMH_VREG("smps3", "smp%s3", &pmic5_ftsmps510, "vdd-s3"),
907907 RPMH_VREG("smps4", "smp%s4", &pmic5_ftsmps510, "vdd-s4"),
drivers/regulator/rt4831-regulator.c+2−2
@@ -153,9 +153,9 @@ static int rt4831_regulator_probe(struct platform_device *pdev) · 152 unmodified lines
153153 int i, ret;
154154
155155 regmap = dev_get_regmap(pdev->dev.parent, NULL);
156− if (IS_ERR(regmap)) {
156+ if (!regmap) {
157157 dev_err(&pdev->dev, "Failed to init regmap\n");
158− return PTR_ERR(regmap);
158+ return -ENODEV;
159159 }
160160
161161 /* Configure DSV mode to normal by default */
drivers/s390/block/dasd.c+3−3
@@ -3052,7 +3052,8 @@ static blk_status_t do_dasd_request(struct blk_mq_hw_ctx *hctx, · 3051 unmodified lines
30523052
30533053 basedev = block->base;
30543054 spin_lock_irq(&dq->lock);
3055− if (basedev->state < DASD_STATE_READY) {
3055+ if (basedev->state < DASD_STATE_READY ||
3056+ test_bit(DASD_FLAG_OFFLINE, &basedev->flags)) {
30563057 DBF_DEV_EVENT(DBF_ERR, basedev,
30573058 "device not ready for request %p", req);
30583059 rc = BLK_STS_IOERR;
@@ -3487,8 +3488,6 @@ void dasd_generic_remove(struct ccw_device *cdev) · 428 unmodified lines
34873488 struct dasd_device *device;
34883489 struct dasd_block *block;
34893490
3490− cdev->handler = NULL;
3491−
34923491 device = dasd_device_from_cdev(cdev);
34933492 if (IS_ERR(device)) {
34943493 dasd_remove_sysfs_files(cdev);
@@ -3507,6 +3506,7 @@ void dasd_generic_remove(struct ccw_device *cdev) · 12 unmodified lines
35073506 * no quite down yet.
35083507 */
35093508 dasd_set_target_state(device, DASD_STATE_NEW);
3509+ cdev->handler = NULL;
35103510 /* dasd_delete_device destroys the device reference. */
35113511 block = device->block;
35123512 dasd_delete_device(device);
drivers/s390/char/tty3270.c+4−2
@@ -424,8 +424,10 @@ tty3270_update(struct timer_list *t) · 423 unmodified lines
424424 * last output position matches the start address
425425 * of this line.
426426 */
427− if (s->string[1] == sba[0] && s->string[2] == sba[1])
428− str += 3, len -= 3;
427+ if (s->string[1] == sba[0] && s->string[2] == sba[1]) {
428+ str += 3;
429+ len -= 3;
430+ }
429431 if (raw3270_request_add_data(wrq, str, len) != 0)
430432 break;
431433 list_del_init(&s->update);
drivers/s390/char/zcore.c+27−17
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515 #include <linux/init.h>
1616 #include <linux/slab.h>
1717 #include <linux/debugfs.h>
18+#include <linux/reboot.h>
1819
1920 #include <asm/asm-offsets.h>
2021 #include <asm/ipl.h>
@@ -238,6 +239,28 @@ static int __init zcore_reipl_init(void) · 217 unmodified lines
238239 return 0;
239240 }
240241
242+static int zcore_reboot_and_on_panic_handler(struct notifier_block *self,
243+ unsigned long event,
244+ void *data)
245+{
246+ if (hsa_available)
247+ release_hsa();
248+
249+ return NOTIFY_OK;
250+}
251+
252+static struct notifier_block zcore_reboot_notifier = {
253+ .notifier_call = zcore_reboot_and_on_panic_handler,
254+ /* we need to be notified before reipl and kdump */
255+ .priority = INT_MAX,
256+};
257+
258+static struct notifier_block zcore_on_panic_notifier = {
259+ .notifier_call = zcore_reboot_and_on_panic_handler,
260+ /* we need to be notified before reipl and kdump */
261+ .priority = INT_MAX,
262+};
263+
241264 static int __init zcore_init(void)
242265 {
243266 unsigned char arch;
@@ -293,28 +316,15 @@ static int __init zcore_init(void) · 49 unmodified lines
293316 goto fail;
294317
295318 zcore_dir = debugfs_create_dir("zcore" , NULL);
296− if (!zcore_dir) {
297− rc = -ENOMEM;
298− goto fail;
299− }
300319 zcore_reipl_file = debugfs_create_file("reipl", S_IRUSR, zcore_dir,
301320 NULL, &zcore_reipl_fops);
302− if (!zcore_reipl_file) {
303− rc = -ENOMEM;
304− goto fail_dir;
305− }
306321 zcore_hsa_file = debugfs_create_file("hsa", S_IRUSR|S_IWUSR, zcore_dir,
307322 NULL, &zcore_hsa_fops);
308− if (!zcore_hsa_file) {
309− rc = -ENOMEM;
310− goto fail_reipl_file;
311− }
312− return 0;
313323
314−fail_reipl_file:
315− debugfs_remove(zcore_reipl_file);
316−fail_dir:
317− debugfs_remove(zcore_dir);
324+ register_reboot_notifier(&zcore_reboot_notifier);
325+ atomic_notifier_chain_register(&panic_notifier_list, &zcore_on_panic_notifier);
326+
327+ return 0;
318328 fail:
319329 diag308(DIAG308_REL_HSA, NULL);
320330 return rc;
drivers/s390/cio/device_fsm.c+1−1
@@ -47,7 +47,7 @@ static void ccw_timeout_log(struct ccw_device *cdev) · 46 unmodified lines
4747 orb = &private->orb;
4848 cc = stsch(sch->schid, &schib);
4949
50− printk(KERN_WARNING "cio: ccw device timeout occurred at %llx, "
50+ printk(KERN_WARNING "cio: ccw device timeout occurred at %lx, "
5151 "device information:\n", get_tod_clock());
5252 printk(KERN_WARNING "cio: orb:\n");
5353 print_hex_dump(KERN_WARNING, "cio: ", DUMP_PREFIX_NONE, 16, 1,
drivers/s390/cio/vfio_ccw_ops.c+3−3
@@ -543,7 +543,7 @@ static ssize_t vfio_ccw_mdev_ioctl(struct mdev_device *mdev, · 542 unmodified lines
543543 if (ret)
544544 return ret;
545545
546− return copy_to_user((void __user *)arg, &info, minsz);
546+ return copy_to_user((void __user *)arg, &info, minsz) ? -EFAULT : 0;
547547 }
548548 case VFIO_DEVICE_GET_REGION_INFO:
549549 {
@@ -561,7 +561,7 @@ static ssize_t vfio_ccw_mdev_ioctl(struct mdev_device *mdev, · 11 unmodified lines
561561 if (ret)
562562 return ret;
563563
564− return copy_to_user((void __user *)arg, &info, minsz);
564+ return copy_to_user((void __user *)arg, &info, minsz) ? -EFAULT : 0;
565565 }
566566 case VFIO_DEVICE_GET_IRQ_INFO:
567567 {
@@ -582,7 +582,7 @@ static ssize_t vfio_ccw_mdev_ioctl(struct mdev_device *mdev, · 14 unmodified lines
582582 if (info.count == -1)
583583 return -EINVAL;
584584
585− return copy_to_user((void __user *)arg, &info, minsz);
585+ return copy_to_user((void __user *)arg, &info, minsz) ? -EFAULT : 0;
586586 }
587587 case VFIO_DEVICE_SET_IRQS:
588588 {
drivers/s390/crypto/vfio_ap_ops.c+1−1
@@ -1286,7 +1286,7 @@ static int vfio_ap_mdev_get_device_info(unsigned long arg) · 1285 unmodified lines
12861286 info.num_regions = 0;
12871287 info.num_irqs = 0;
12881288
1289− return copy_to_user((void __user *)arg, &info, minsz);
1289+ return copy_to_user((void __user *)arg, &info, minsz) ? -EFAULT : 0;
12901290 }
12911291
12921292 static ssize_t vfio_ap_mdev_ioctl(struct mdev_device *mdev,
drivers/s390/net/qeth_core.h+2−1
@@ -436,7 +436,7 @@ struct qeth_qdio_out_buffer { · 435 unmodified lines
436436 int is_header[QDIO_MAX_ELEMENTS_PER_BUFFER];
437437
438438 struct qeth_qdio_out_q *q;
439− struct qeth_qdio_out_buffer *next_pending;
439+ struct list_head list_entry;
440440 };
441441
442442 struct qeth_card;
@@ -500,6 +500,7 @@ struct qeth_qdio_out_q { · 57 unmodified lines
500500 struct qdio_buffer *qdio_bufs[QDIO_MAX_BUFFERS_PER_Q];
501501 struct qeth_qdio_out_buffer *bufs[QDIO_MAX_BUFFERS_PER_Q];
502502 struct qdio_outbuf_state *bufstates; /* convenience pointer */
503+ struct list_head pending_bufs;
503504 struct qeth_out_q_stats stats;
504505 spinlock_t lock;
505506 unsigned int priority;
drivers/s390/net/qeth_core_main.c+60−68
@@ -73,8 +73,6 @@ static void qeth_free_qdio_queues(struct qeth_card *card); · 72 unmodified lines
7373 static void qeth_notify_skbs(struct qeth_qdio_out_q *queue,
7474 struct qeth_qdio_out_buffer *buf,
7575 enum iucv_tx_notify notification);
76−static void qeth_tx_complete_buf(struct qeth_qdio_out_buffer *buf, bool error,
77− int budget);
7876
7977 static void qeth_close_dev_handler(struct work_struct *work)
8078 {
@@ -465,41 +463,6 @@ static enum iucv_tx_notify qeth_compute_cq_notification(int sbalf15, · 384 unmodified lines
465463 return n;
466464 }
467465
468−static void qeth_cleanup_handled_pending(struct qeth_qdio_out_q *q, int bidx,
469− int forced_cleanup)
470−{
471− if (q->card->options.cq != QETH_CQ_ENABLED)
472− return;
473−
474− if (q->bufs[bidx]->next_pending != NULL) {
475− struct qeth_qdio_out_buffer *head = q->bufs[bidx];
476− struct qeth_qdio_out_buffer *c = q->bufs[bidx]->next_pending;
477−
478− while (c) {
479− if (forced_cleanup ||
480− atomic_read(&c->state) == QETH_QDIO_BUF_EMPTY) {
481− struct qeth_qdio_out_buffer *f = c;
482−
483− QETH_CARD_TEXT(f->q->card, 5, "fp");
484− QETH_CARD_TEXT_(f->q->card, 5, "%lx", (long) f);
485− /* release here to avoid interleaving between
486− outbound tasklet and inbound tasklet
487− regarding notifications and lifecycle */
488− qeth_tx_complete_buf(c, forced_cleanup, 0);
489−
490− c = f->next_pending;
491− WARN_ON_ONCE(head->next_pending != f);
492− head->next_pending = c;
493− kmem_cache_free(qeth_qdio_outbuf_cache, f);
494− } else {
495− head = c;
496− c = c->next_pending;
497− }
498−
499− }
500− }
501−}
502−
503466 static void qeth_qdio_handle_aob(struct qeth_card *card,
504467 unsigned long phys_aob_addr)
505468 {
@@ -507,6 +470,7 @@ static void qeth_qdio_handle_aob(struct qeth_card *card, · 1 unmodified line
507470 struct qaob *aob;
508471 struct qeth_qdio_out_buffer *buffer;
509472 enum iucv_tx_notify notification;
473+ struct qeth_qdio_out_q *queue;
510474 unsigned int i;
511475
512476 aob = (struct qaob *) phys_to_virt(phys_aob_addr);
@@ -537,7 +501,7 @@ static void qeth_qdio_handle_aob(struct qeth_card *card, · 24 unmodified lines
537501 qeth_notify_skbs(buffer->q, buffer, notification);
538502
539503 /* Free dangling allocations. The attached skbs are handled by
540− * qeth_cleanup_handled_pending().
504+ * qeth_tx_complete_pending_bufs().
541505 */
542506 for (i = 0;
543507 i < aob->sb_count && i < QETH_MAX_BUFFER_ELEMENTS(card);
@@ -549,7 +513,9 @@ static void qeth_qdio_handle_aob(struct qeth_card *card, · 5 unmodified lines
549513 buffer->is_header[i] = 0;
550514 }
551515
516+ queue = buffer->q;
552517 atomic_set(&buffer->state, QETH_QDIO_BUF_EMPTY);
518+ napi_schedule(&queue->napi);
553519 break;
554520 default:
555521 WARN_ON_ONCE(1);
@@ -1424,9 +1390,6 @@ static void qeth_tx_complete_buf(struct qeth_qdio_out_buffer *buf, bool error, · 868 unmodified lines
14241390 struct qeth_qdio_out_q *queue = buf->q;
14251391 struct sk_buff *skb;
14261392
1427− if (atomic_read(&buf->state) == QETH_QDIO_BUF_PENDING)
1428− qeth_notify_skbs(queue, buf, TX_NOTIFY_GENERALERROR);
1429−
14301393 /* Empty buffer? */
14311394 if (buf->next_element_to_fill == 0)
14321395 return;
@@ -1488,14 +1451,38 @@ static void qeth_clear_output_buffer(struct qeth_qdio_out_q *queue, · 55 unmodified lines
14881451 atomic_set(&buf->state, QETH_QDIO_BUF_EMPTY);
14891452 }
14901453
1454+static void qeth_tx_complete_pending_bufs(struct qeth_card *card,
1455+ struct qeth_qdio_out_q *queue,
1456+ bool drain)
1457+{
1458+ struct qeth_qdio_out_buffer *buf, *tmp;
1459+
1460+ list_for_each_entry_safe(buf, tmp, &queue->pending_bufs, list_entry) {
1461+ if (drain || atomic_read(&buf->state) == QETH_QDIO_BUF_EMPTY) {
1462+ QETH_CARD_TEXT(card, 5, "fp");
1463+ QETH_CARD_TEXT_(card, 5, "%lx", (long) buf);
1464+
1465+ if (drain)
1466+ qeth_notify_skbs(queue, buf,
1467+ TX_NOTIFY_GENERALERROR);
1468+ qeth_tx_complete_buf(buf, drain, 0);
1469+
1470+ list_del(&buf->list_entry);
1471+ kmem_cache_free(qeth_qdio_outbuf_cache, buf);
1472+ }
1473+ }
1474+}
1475+
14911476 static void qeth_drain_output_queue(struct qeth_qdio_out_q *q, bool free)
14921477 {
14931478 int j;
14941479
1480+ qeth_tx_complete_pending_bufs(q->card, q, true);
1481+
14951482 for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; ++j) {
14961483 if (!q->bufs[j])
14971484 continue;
1498− qeth_cleanup_handled_pending(q, j, 1);
1485+
14991486 qeth_clear_output_buffer(q, q->bufs[j], true, 0);
15001487 if (free) {
15011488 kmem_cache_free(qeth_qdio_outbuf_cache, q->bufs[j]);
@@ -2615,7 +2602,6 @@ static int qeth_init_qdio_out_buf(struct qeth_qdio_out_q *q, int bidx) · 1113 unmodified lines
26152602 skb_queue_head_init(&newbuf->skb_list);
26162603 lockdep_set_class(&newbuf->skb_list.lock, &qdio_out_skb_queue_key);
26172604 newbuf->q = q;
2618− newbuf->next_pending = q->bufs[bidx];
26192605 atomic_set(&newbuf->state, QETH_QDIO_BUF_EMPTY);
26202606 q->bufs[bidx] = newbuf;
26212607 return 0;
@@ -2634,15 +2620,28 @@ static void qeth_free_output_queue(struct qeth_qdio_out_q *q) · 12 unmodified lines
26342620 static struct qeth_qdio_out_q *qeth_alloc_output_queue(void)
26352621 {
26362622 struct qeth_qdio_out_q *q = kzalloc(sizeof(*q), GFP_KERNEL);
2623+ unsigned int i;
26372624
26382625 if (!q)
26392626 return NULL;
26402627
2641− if (qdio_alloc_buffers(q->qdio_bufs, QDIO_MAX_BUFFERS_PER_Q)) {
2642− kfree(q);
2643− return NULL;
2628+ if (qdio_alloc_buffers(q->qdio_bufs, QDIO_MAX_BUFFERS_PER_Q))
2629+ goto err_qdio_bufs;
2630+
2631+ for (i = 0; i < QDIO_MAX_BUFFERS_PER_Q; i++) {
2632+ if (qeth_init_qdio_out_buf(q, i))
2633+ goto err_out_bufs;
26442634 }
2635+
26452636 return q;
2637+
2638+err_out_bufs:
2639+ while (i > 0)
2640+ kmem_cache_free(qeth_qdio_outbuf_cache, q->bufs[--i]);
2641+ qdio_free_buffers(q->qdio_bufs, QDIO_MAX_BUFFERS_PER_Q);
2642+err_qdio_bufs:
2643+ kfree(q);
2644+ return NULL;
26462645 }
26472646
26482647 static void qeth_tx_completion_timer(struct timer_list *timer)
@@ -2655,7 +2654,7 @@ static void qeth_tx_completion_timer(struct timer_list *timer) · 6 unmodified lines
26552654
26562655 static int qeth_alloc_qdio_queues(struct qeth_card *card)
26572656 {
2658− int i, j;
2657+ unsigned int i;
26592658
26602659 QETH_CARD_TEXT(card, 2, "allcqdbf");
26612660
@@ -2684,18 +2683,12 @@ static int qeth_alloc_qdio_queues(struct qeth_card *card) · 22 unmodified lines
26842683 card->qdio.out_qs[i] = queue;
26852684 queue->card = card;
26862685 queue->queue_no = i;
2686+ INIT_LIST_HEAD(&queue->pending_bufs);
26872687 spin_lock_init(&queue->lock);
26882688 timer_setup(&queue->timer, qeth_tx_completion_timer, 0);
26892689 queue->coalesce_usecs = QETH_TX_COALESCE_USECS;
26902690 queue->max_coalesced_frames = QETH_TX_MAX_COALESCED_FRAMES;
26912691 queue->priority = QETH_QIB_PQUE_PRIO_DEFAULT;
2692−
2693− /* give outbound qeth_qdio_buffers their qdio_buffers */
2694− for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; ++j) {
2695− WARN_ON(queue->bufs[j]);
2696− if (qeth_init_qdio_out_buf(queue, j))
2697− goto out_freeoutqbufs;
2698− }
26992692 }
27002693
27012694 /* completion */
@@ -2704,13 +2697,6 @@ static int qeth_alloc_qdio_queues(struct qeth_card *card) · 2 unmodified lines
27042697
27052698 return 0;
27062699
2707−out_freeoutqbufs:
2708− while (j > 0) {
2709− --j;
2710− kmem_cache_free(qeth_qdio_outbuf_cache,
2711− card->qdio.out_qs[i]->bufs[j]);
2712− card->qdio.out_qs[i]->bufs[j] = NULL;
2713− }
27142700 out_freeoutq:
27152701 while (i > 0) {
27162702 qeth_free_output_queue(card->qdio.out_qs[--i]);
@@ -6107,6 +6093,8 @@ static void qeth_iqd_tx_complete(struct qeth_qdio_out_q *queue, · 3390 unmodified lines
61076093 qeth_schedule_recovery(card);
61086094 }
61096095
6096+ list_add(&buffer->list_entry,
6097+ &queue->pending_bufs);
61106098 /* Skip clearing the buffer: */
61116099 return;
61126100 case QETH_QDIO_BUF_QAOB_OK:
@@ -6162,6 +6150,8 @@ static int qeth_tx_poll(struct napi_struct *napi, int budget) · 49 unmodified lines
61626150 unsigned int bytes = 0;
61636151 int completed;
61646152
6153+ qeth_tx_complete_pending_bufs(card, queue, false);
6154+
61656155 if (qeth_out_queue_is_empty(queue)) {
61666156 napi_complete(napi);
61676157 return 0;
@@ -6194,7 +6184,6 @@ static int qeth_tx_poll(struct napi_struct *napi, int budget) · 26 unmodified lines
61946184
61956185 qeth_handle_send_error(card, buffer, error);
61966186 qeth_iqd_tx_complete(queue, bidx, error, budget);
6197− qeth_cleanup_handled_pending(queue, bidx, false);
61986187 }
61996188
62006189 netdev_tx_completed_queue(txq, packets, bytes);
@@ -7249,9 +7238,7 @@ int qeth_open(struct net_device *dev) · 1048 unmodified lines
72497238 card->data.state = CH_STATE_UP;
72507239 netif_tx_start_all_queues(dev);
72517240
7252− napi_enable(&card->napi);
72537241 local_bh_disable();
7254− napi_schedule(&card->napi);
72557242 if (IS_IQD(card)) {
72567243 struct qeth_qdio_out_q *queue;
72577244 unsigned int i;
@@ -7263,8 +7250,12 @@ int qeth_open(struct net_device *dev) · 5 unmodified lines
72637250 napi_schedule(&queue->napi);
72647251 }
72657252 }
7253+
7254+ napi_enable(&card->napi);
7255+ napi_schedule(&card->napi);
72667256 /* kick-start the NAPI softirq: */
72677257 local_bh_enable();
7258+
72687259 return 0;
72697260 }
72707261 EXPORT_SYMBOL_GPL(qeth_open);
@@ -7274,6 +7265,11 @@ int qeth_stop(struct net_device *dev) · 3 unmodified lines
72747265 struct qeth_card *card = dev->ml_priv;
72757266
72767267 QETH_CARD_TEXT(card, 4, "qethstop");
7268+
7269+ napi_disable(&card->napi);
7270+ cancel_delayed_work_sync(&card->buffer_reclaim_work);
7271+ qdio_stop_irq(CARD_DDEV(card));
7272+
72777273 if (IS_IQD(card)) {
72787274 struct qeth_qdio_out_q *queue;
72797275 unsigned int i;
@@ -7294,10 +7290,6 @@ int qeth_stop(struct net_device *dev) · 14 unmodified lines
72947290 netif_tx_disable(dev);
72957291 }
72967292
7297− napi_disable(&card->napi);
7298− cancel_delayed_work_sync(&card->buffer_reclaim_work);
7299− qdio_stop_irq(CARD_DDEV(card));
7300−
73017293 return 0;
73027294 }
73037295 EXPORT_SYMBOL_GPL(qeth_stop);
drivers/scsi/ibmvscsi/ibmvfc.c+37−28
@@ -21,6 +21,7 @@ · 20 unmodified lines
2121 #include <linux/bsg-lib.h>
2222 #include <asm/firmware.h>
2323 #include <asm/irq.h>
24+#include <asm/rtas.h>
2425 #include <asm/vio.h>
2526 #include <scsi/scsi.h>
2627 #include <scsi/scsi_cmnd.h>
@@ -158,6 +159,9 @@ static void ibmvfc_npiv_logout(struct ibmvfc_host *); · 131 unmodified lines
158159 static void ibmvfc_tgt_implicit_logout_and_del(struct ibmvfc_target *);
159160 static void ibmvfc_tgt_move_login(struct ibmvfc_target *);
160161
162+static void ibmvfc_release_sub_crqs(struct ibmvfc_host *);
163+static void ibmvfc_init_sub_crqs(struct ibmvfc_host *);
164+
161165 static const char *unknown_error = "unknown error";
162166
163167 static long h_reg_sub_crq(unsigned long unit_address, unsigned long ioba,
@@ -899,6 +903,9 @@ static int ibmvfc_reenable_crq_queue(struct ibmvfc_host *vhost) · 735 unmodified lines
899903 {
900904 int rc = 0;
901905 struct vio_dev *vdev = to_vio_dev(vhost->dev);
906+ unsigned long flags;
907+
908+ ibmvfc_release_sub_crqs(vhost);
902909
903910 /* Re-enable the CRQ */
904911 do {
@@ -910,6 +917,15 @@ static int ibmvfc_reenable_crq_queue(struct ibmvfc_host *vhost) · 5 unmodified lines
910917 if (rc)
911918 dev_err(vhost->dev, "Error enabling adapter (rc=%d)\n", rc);
912919
920+ spin_lock_irqsave(vhost->host->host_lock, flags);
921+ spin_lock(vhost->crq.q_lock);
922+ vhost->do_enquiry = 1;
923+ vhost->using_channels = 0;
924+ spin_unlock(vhost->crq.q_lock);
925+ spin_unlock_irqrestore(vhost->host->host_lock, flags);
926+
927+ ibmvfc_init_sub_crqs(vhost);
928+
913929 return rc;
914930 }
915931
@@ -926,8 +942,8 @@ static int ibmvfc_reset_crq(struct ibmvfc_host *vhost) · 10 unmodified lines
926942 unsigned long flags;
927943 struct vio_dev *vdev = to_vio_dev(vhost->dev);
928944 struct ibmvfc_queue *crq = &vhost->crq;
929− struct ibmvfc_queue *scrq;
930− int i;
945+
946+ ibmvfc_release_sub_crqs(vhost);
931947
932948 /* Close the CRQ */
933949 do {
@@ -947,16 +963,6 @@ static int ibmvfc_reset_crq(struct ibmvfc_host *vhost) · 13 unmodified lines
947963 memset(crq->msgs.crq, 0, PAGE_SIZE);
948964 crq->cur = 0;
949965
950− if (vhost->scsi_scrqs.scrqs) {
951− for (i = 0; i < nr_scsi_hw_queues; i++) {
952− scrq = &vhost->scsi_scrqs.scrqs[i];
953− spin_lock(scrq->q_lock);
954− memset(scrq->msgs.scrq, 0, PAGE_SIZE);
955− scrq->cur = 0;
956− spin_unlock(scrq->q_lock);
957− }
958− }
959−
960966 /* And re-open it again */
961967 rc = plpar_hcall_norets(H_REG_CRQ, vdev->unit_address,
962968 crq->msg_token, PAGE_SIZE);
@@ -966,9 +972,12 @@ static int ibmvfc_reset_crq(struct ibmvfc_host *vhost) · 3 unmodified lines
966972 dev_warn(vhost->dev, "Partner adapter not ready\n");
967973 else if (rc != 0)
968974 dev_warn(vhost->dev, "Couldn't register crq (rc=%d)\n", rc);
975+
969976 spin_unlock(vhost->crq.q_lock);
970977 spin_unlock_irqrestore(vhost->host->host_lock, flags);
971978
979+ ibmvfc_init_sub_crqs(vhost);
980+
972981 return rc;
973982 }
974983
@@ -5642,7 +5651,8 @@ static int ibmvfc_register_scsi_channel(struct ibmvfc_host *vhost, · 4667 unmodified lines
56425651 rc = h_reg_sub_crq(vdev->unit_address, scrq->msg_token, PAGE_SIZE,
56435652 &scrq->cookie, &scrq->hw_irq);
56445653
5645− if (rc) {
5654+ /* H_CLOSED indicates successful register, but no CRQ partner */
5655+ if (rc && rc != H_CLOSED) {
56465656 dev_warn(dev, "Error registering sub-crq: %d\n", rc);
56475657 if (rc == H_PARAMETER)
56485658 dev_warn_once(dev, "Firmware may not support MQ\n");
@@ -5675,8 +5685,8 @@ static int ibmvfc_register_scsi_channel(struct ibmvfc_host *vhost, · 26 unmodified lines
56755685
56765686 irq_failed:
56775687 do {
5678− plpar_hcall_norets(H_FREE_SUB_CRQ, vdev->unit_address, scrq->cookie);
5679− } while (rc == H_BUSY || H_IS_LONG_BUSY(rc));
5688+ rc = plpar_hcall_norets(H_FREE_SUB_CRQ, vdev->unit_address, scrq->cookie);
5689+ } while (rtas_busy_delay(rc));
56805690 reg_failed:
56815691 ibmvfc_free_queue(vhost, scrq);
56825692 LEAVE;
@@ -5694,6 +5704,7 @@ static void ibmvfc_deregister_scsi_channel(struct ibmvfc_host *vhost, int index) · 11 unmodified lines
56945704
56955705 free_irq(scrq->irq, scrq);
56965706 irq_dispose_mapping(scrq->irq);
5707+ scrq->irq = 0;
56975708
56985709 do {
56995710 rc = plpar_hcall_norets(H_FREE_SUB_CRQ, vdev->unit_address,
@@ -5707,17 +5718,21 @@ static void ibmvfc_deregister_scsi_channel(struct ibmvfc_host *vhost, int index) · 7 unmodified lines
57075718 LEAVE;
57085719 }
57095720
5710−static int ibmvfc_init_sub_crqs(struct ibmvfc_host *vhost)
5721+static void ibmvfc_init_sub_crqs(struct ibmvfc_host *vhost)
57115722 {
57125723 int i, j;
57135724
57145725 ENTER;
5726+ if (!vhost->mq_enabled)
5727+ return;
57155728
57165729 vhost->scsi_scrqs.scrqs = kcalloc(nr_scsi_hw_queues,
57175730 sizeof(*vhost->scsi_scrqs.scrqs),
57185731 GFP_KERNEL);
5719− if (!vhost->scsi_scrqs.scrqs)
5720− return -1;
5732+ if (!vhost->scsi_scrqs.scrqs) {
5733+ vhost->do_enquiry = 0;
5734+ return;
5735+ }
57215736
57225737 for (i = 0; i < nr_scsi_hw_queues; i++) {
57235738 if (ibmvfc_register_scsi_channel(vhost, i)) {
@@ -5726,13 +5741,12 @@ static int ibmvfc_init_sub_crqs(struct ibmvfc_host *vhost) · 2 unmodified lines
57265741 kfree(vhost->scsi_scrqs.scrqs);
57275742 vhost->scsi_scrqs.scrqs = NULL;
57285743 vhost->scsi_scrqs.active_queues = 0;
5729− LEAVE;
5730− return -1;
5744+ vhost->do_enquiry = 0;
5745+ break;
57315746 }
57325747 }
57335748
57345749 LEAVE;
5735− return 0;
57365750 }
57375751
57385752 static void ibmvfc_release_sub_crqs(struct ibmvfc_host *vhost)
@@ -5999,11 +6013,7 @@ static int ibmvfc_probe(struct vio_dev *vdev, const struct vio_device_id *id) · 260 unmodified lines
59996013 goto remove_shost;
60006014 }
60016015
6002− if (vhost->mq_enabled) {
6003− rc = ibmvfc_init_sub_crqs(vhost);
6004− if (rc)
6005− dev_warn(dev, "Failed to allocate Sub-CRQs. rc=%d\n", rc);
6006− }
6016+ ibmvfc_init_sub_crqs(vhost);
60076017
60086018 if (shost_to_fc_host(shost)->rqst_q)
60096019 blk_queue_max_segments(shost_to_fc_host(shost)->rqst_q, 1);
@@ -6038,7 +6048,7 @@ out: · 28 unmodified lines
60386048 * Return value:
60396049 * 0
60406050 **/
6041−static int ibmvfc_remove(struct vio_dev *vdev)
6051+static void ibmvfc_remove(struct vio_dev *vdev)
60426052 {
60436053 struct ibmvfc_host *vhost = dev_get_drvdata(&vdev->dev);
60446054 LIST_HEAD(purge);
@@ -6070,7 +6080,6 @@ static int ibmvfc_remove(struct vio_dev *vdev) · 25 unmodified lines
60706080 spin_unlock(&ibmvfc_driver_lock);
60716081 scsi_host_put(vhost->host);
60726082 LEAVE;
6073− return 0;
60746083 }
60756084
60766085 /**
drivers/scsi/ibmvscsi/ibmvscsi.c+1−3
@@ -2335,7 +2335,7 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id) · 2334 unmodified lines
23352335 return -1;
23362336 }
23372337
2338−static int ibmvscsi_remove(struct vio_dev *vdev)
2338+static void ibmvscsi_remove(struct vio_dev *vdev)
23392339 {
23402340 struct ibmvscsi_host_data *hostdata = dev_get_drvdata(&vdev->dev);
23412341
@@ -2356,8 +2356,6 @@ static int ibmvscsi_remove(struct vio_dev *vdev) · 14 unmodified lines
23562356 spin_unlock(&ibmvscsi_driver_lock);
23572357
23582358 scsi_host_put(hostdata->host);
2359−
2360− return 0;
23612359 }
23622360
23632361 /**
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c+1−3
@@ -3595,7 +3595,7 @@ free_adapter: · 3594 unmodified lines
35953595 return rc;
35963596 }
35973597
3598−static int ibmvscsis_remove(struct vio_dev *vdev)
3598+static void ibmvscsis_remove(struct vio_dev *vdev)
35993599 {
36003600 struct scsi_info *vscsi = dev_get_drvdata(&vdev->dev);
36013601
@@ -3622,8 +3622,6 @@ static int ibmvscsis_remove(struct vio_dev *vdev) · 20 unmodified lines
36223622 list_del(&vscsi->list);
36233623 spin_unlock_bh(&ibmvscsis_dev_lock);
36243624 kfree(vscsi);
3625−
3626− return 0;
36273625 }
36283626
36293627 static ssize_t system_id_show(struct device *dev,
drivers/scsi/ufs/ufs-qcom.c+10−0
@@ -253,12 +253,17 @@ static int ufs_qcom_host_reset(struct ufs_hba *hba) · 252 unmodified lines
253253 {
254254 int ret = 0;
255255 struct ufs_qcom_host *host = ufshcd_get_variant(hba);
256+ bool reenable_intr = false;
256257
257258 if (!host->core_reset) {
258259 dev_warn(hba->dev, "%s: reset control not set\n", __func__);
259260 goto out;
260261 }
261262
263+ reenable_intr = hba->is_irq_enabled;
264+ disable_irq(hba->irq);
265+ hba->is_irq_enabled = false;
266+
262267 ret = reset_control_assert(host->core_reset);
263268 if (ret) {
264269 dev_err(hba->dev, "%s: core_reset assert failed, err = %d\n",
@@ -280,6 +285,11 @@ static int ufs_qcom_host_reset(struct ufs_hba *hba) · 15 unmodified lines
280285
281286 usleep_range(1000, 1100);
282287
288+ if (reenable_intr) {
289+ enable_irq(hba->irq);
290+ hba->is_irq_enabled = true;
291+ }
292+
283293 out:
284294 return ret;
285295 }
drivers/scsi/ufs/ufshcd.c+13−28
@@ -95,8 +95,6 @@ · 94 unmodified lines
9595 16, 4, buf, __len, false); \
9696 } while (0)
9797
98−static bool early_suspend;
99−
10098 int ufshcd_dump_regs(struct ufs_hba *hba, size_t offset, size_t len,
10199 const char *prefix)
102100 {
@@ -1535,7 +1533,7 @@ static ssize_t ufshcd_clkscale_enable_show(struct device *dev, · 1432 unmodified lines
15351533 {
15361534 struct ufs_hba *hba = dev_get_drvdata(dev);
15371535
1538− return snprintf(buf, PAGE_SIZE, "%d\n", hba->clk_scaling.is_enabled);
1536+ return sysfs_emit(buf, "%d\n", hba->clk_scaling.is_enabled);
15391537 }
15401538
15411539 static ssize_t ufshcd_clkscale_enable_store(struct device *dev,
@@ -4987,6 +4985,7 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) · 3445 unmodified lines
49874985 * UFS device needs urgent BKOPs.
49884986 */
49894987 if (!hba->pm_op_in_progress &&
4988+ !ufshcd_eh_in_progress(hba) &&
49904989 ufshcd_is_exception_event(lrbp->ucd_rsp_ptr) &&
49914990 schedule_work(&hba->eeh_work)) {
49924991 /*
@@ -5784,13 +5783,20 @@ static void ufshcd_err_handling_prepare(struct ufs_hba *hba) · 791 unmodified lines
57845783 ufshcd_suspend_clkscaling(hba);
57855784 ufshcd_clk_scaling_allow(hba, false);
57865785 }
5786+ ufshcd_scsi_block_requests(hba);
5787+ /* Drain ufshcd_queuecommand() */
5788+ down_write(&hba->clk_scaling_lock);
5789+ up_write(&hba->clk_scaling_lock);
5790+ cancel_work_sync(&hba->eeh_work);
57875791 }
57885792
57895793 static void ufshcd_err_handling_unprepare(struct ufs_hba *hba)
57905794 {
5795+ ufshcd_scsi_unblock_requests(hba);
57915796 ufshcd_release(hba);
57925797 if (ufshcd_is_clkscaling_supported(hba))
57935798 ufshcd_clk_scaling_suspend(hba, false);
5799+ ufshcd_clear_ua_wluns(hba);
57945800 pm_runtime_put(hba->dev);
57955801 }
57965802
@@ -5882,8 +5888,8 @@ static void ufshcd_err_handler(struct work_struct *work) · 85 unmodified lines
58825888 spin_unlock_irqrestore(hba->host->host_lock, flags);
58835889 ufshcd_err_handling_prepare(hba);
58845890 spin_lock_irqsave(hba->host->host_lock, flags);
5885− ufshcd_scsi_block_requests(hba);
5886− hba->ufshcd_state = UFSHCD_STATE_RESET;
5891+ if (hba->ufshcd_state != UFSHCD_STATE_ERROR)
5892+ hba->ufshcd_state = UFSHCD_STATE_RESET;
58875893
58885894 /* Complete requests that have door-bell cleared by h/w */
58895895 ufshcd_complete_requests(hba);
@@ -6042,12 +6048,8 @@ skip_err_handling: · 152 unmodified lines
60426048 }
60436049 ufshcd_clear_eh_in_progress(hba);
60446050 spin_unlock_irqrestore(hba->host->host_lock, flags);
6045− ufshcd_scsi_unblock_requests(hba);
60466051 ufshcd_err_handling_unprepare(hba);
60476052 up(&hba->host_sem);
6048−
6049− if (!err && needs_reset)
6050− ufshcd_clear_ua_wluns(hba);
60516053 }
60526054
60536055 /**
@@ -7858,6 +7860,8 @@ static int ufshcd_probe_hba(struct ufs_hba *hba, bool async) · 1804 unmodified lines
78587860 unsigned long flags;
78597861 ktime_t start = ktime_get();
78607862
7863+ hba->ufshcd_state = UFSHCD_STATE_RESET;
7864+
78617865 ret = ufshcd_link_startup(hba);
78627866 if (ret)
78637867 goto out;
@@ -8972,11 +8976,6 @@ int ufshcd_system_suspend(struct ufs_hba *hba) · 1108 unmodified lines
89728976 int ret = 0;
89738977 ktime_t start = ktime_get();
89748978
8975− if (!hba) {
8976− early_suspend = true;
8977− return 0;
8978− }
8979−
89808979 down(&hba->host_sem);
89818980
89828981 if (!hba->is_powered)
@@ -9028,14 +9027,6 @@ int ufshcd_system_resume(struct ufs_hba *hba) · 45 unmodified lines
90289027 int ret = 0;
90299028 ktime_t start = ktime_get();
90309029
9031− if (!hba)
9032− return -EINVAL;
9033−
9034− if (unlikely(early_suspend)) {
9035− early_suspend = false;
9036− down(&hba->host_sem);
9037− }
9038−
90399030 if (!hba->is_powered || pm_runtime_suspended(hba->dev))
90409031 /*
90419032 * Let the runtime resume take care of resuming
@@ -9068,9 +9059,6 @@ int ufshcd_runtime_suspend(struct ufs_hba *hba) · 26 unmodified lines
90689059 int ret = 0;
90699060 ktime_t start = ktime_get();
90709061
9071− if (!hba)
9072− return -EINVAL;
9073−
90749062 if (!hba->is_powered)
90759063 goto out;
90769064 else
@@ -9109,9 +9097,6 @@ int ufshcd_runtime_resume(struct ufs_hba *hba) · 32 unmodified lines
91099097 int ret = 0;
91109098 ktime_t start = ktime_get();
91119099
9112− if (!hba)
9113− return -EINVAL;
9114−
91159100 if (!hba->is_powered)
91169101 goto out;
91179102 else
drivers/scsi/vmw_pvscsi.c+0−2
@@ -17,8 +17,6 @@ · 16 unmodified lines
1717 * along with this program; if not, write to the Free Software
1818 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1919 *
20− * Maintained by: Jim Gill <jgill@vmware.com>
21− *
2220 */
2321
2422 #include <linux/kernel.h>
drivers/scsi/vmw_pvscsi.h+0−2
@@ -17,8 +17,6 @@ · 16 unmodified lines
1717 * along with this program; if not, write to the Free Software
1818 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1919 *
20− * Maintained by: Jim Gill <jgill@vmware.com>
21− *
2220 */
2321
2422 #ifndef _VMW_PVSCSI_H_
drivers/staging/comedi/drivers/addi_apci_1032.c+3−1
@@ -260,6 +260,7 @@ static irqreturn_t apci1032_interrupt(int irq, void *d) · 259 unmodified lines
260260 struct apci1032_private *devpriv = dev->private;
261261 struct comedi_subdevice *s = dev->read_subdev;
262262 unsigned int ctrl;
263+ unsigned short val;
263264
264265 /* check interrupt is from this device */
265266 if ((inl(devpriv->amcc_iobase + AMCC_OP_REG_INTCSR) &
@@ -275,7 +276,8 @@ static irqreturn_t apci1032_interrupt(int irq, void *d) · 9 unmodified lines
275276 outl(ctrl & ~APCI1032_CTRL_INT_ENA, dev->iobase + APCI1032_CTRL_REG);
276277
277278 s->state = inl(dev->iobase + APCI1032_STATUS_REG) & 0xffff;
278− comedi_buf_write_samples(s, &s->state, 1);
279+ val = s->state;
280+ comedi_buf_write_samples(s, &val, 1);
279281 comedi_handle_events(dev, s);
280282
281283 /* enable the interrupt */
drivers/staging/comedi/drivers/addi_apci_1500.c+9−9
@@ -208,7 +208,7 @@ static irqreturn_t apci1500_interrupt(int irq, void *d) · 207 unmodified lines
208208 struct comedi_device *dev = d;
209209 struct apci1500_private *devpriv = dev->private;
210210 struct comedi_subdevice *s = dev->read_subdev;
211− unsigned int status = 0;
211+ unsigned short status = 0;
212212 unsigned int val;
213213
214214 val = inl(devpriv->amcc + AMCC_OP_REG_INTCSR);
@@ -238,14 +238,14 @@ static irqreturn_t apci1500_interrupt(int irq, void *d) · 23 unmodified lines
238238 *
239239 * Mask Meaning
240240 * ---------- ------------------------------------------
241− * 0x00000001 Event 1 has occurred
242− * 0x00000010 Event 2 has occurred
243− * 0x00000100 Counter/timer 1 has run down (not implemented)
244− * 0x00001000 Counter/timer 2 has run down (not implemented)
245− * 0x00010000 Counter 3 has run down (not implemented)
246− * 0x00100000 Watchdog has run down (not implemented)
247− * 0x01000000 Voltage error
248− * 0x10000000 Short-circuit error
241+ * 0b00000001 Event 1 has occurred
242+ * 0b00000010 Event 2 has occurred
243+ * 0b00000100 Counter/timer 1 has run down (not implemented)
244+ * 0b00001000 Counter/timer 2 has run down (not implemented)
245+ * 0b00010000 Counter 3 has run down (not implemented)
246+ * 0b00100000 Watchdog has run down (not implemented)
247+ * 0b01000000 Voltage error
248+ * 0b10000000 Short-circuit error
249249 */
250250 comedi_buf_write_samples(s, &status, 1);
251251 comedi_handle_events(dev, s);
drivers/staging/comedi/drivers/adv_pci1710.c+5−5
@@ -300,11 +300,11 @@ static int pci1710_ai_eoc(struct comedi_device *dev, · 299 unmodified lines
300300 static int pci1710_ai_read_sample(struct comedi_device *dev,
301301 struct comedi_subdevice *s,
302302 unsigned int cur_chan,
303− unsigned int *val)
303+ unsigned short *val)
304304 {
305305 const struct boardtype *board = dev->board_ptr;
306306 struct pci1710_private *devpriv = dev->private;
307− unsigned int sample;
307+ unsigned short sample;
308308 unsigned int chan;
309309
310310 sample = inw(dev->iobase + PCI171X_AD_DATA_REG);
@@ -345,7 +345,7 @@ static int pci1710_ai_insn_read(struct comedi_device *dev, · 34 unmodified lines
345345 pci1710_ai_setup_chanlist(dev, s, &insn->chanspec, 1, 1);
346346
347347 for (i = 0; i < insn->n; i++) {
348− unsigned int val;
348+ unsigned short val;
349349
350350 /* start conversion */
351351 outw(0, dev->iobase + PCI171X_SOFTTRG_REG);
@@ -395,7 +395,7 @@ static void pci1710_handle_every_sample(struct comedi_device *dev, · 43 unmodified lines
395395 {
396396 struct comedi_cmd *cmd = &s->async->cmd;
397397 unsigned int status;
398− unsigned int val;
398+ unsigned short val;
399399 int ret;
400400
401401 status = inw(dev->iobase + PCI171X_STATUS_REG);
@@ -455,7 +455,7 @@ static void pci1710_handle_fifo(struct comedi_device *dev, · 53 unmodified lines
455455 }
456456
457457 for (i = 0; i < devpriv->max_samples; i++) {
458− unsigned int val;
458+ unsigned short val;
459459 int ret;
460460
461461 ret = pci1710_ai_read_sample(dev, s, s->async->cur_chan, &val);
drivers/staging/comedi/drivers/amplc_pc236_common.c+3−1
@@ -126,7 +126,9 @@ static irqreturn_t pc236_interrupt(int irq, void *d) · 125 unmodified lines
126126
127127 handled = pc236_intr_check(dev);
128128 if (dev->attached && handled) {
129− comedi_buf_write_samples(s, &s->state, 1);
129+ unsigned short val = 0;
130+
131+ comedi_buf_write_samples(s, &val, 1);
130132 comedi_handle_events(dev, s);
131133 }
132134 return IRQ_RETVAL(handled);
drivers/staging/comedi/drivers/comedi_parport.c+2−1
@@ -210,12 +210,13 @@ static irqreturn_t parport_interrupt(int irq, void *d) · 209 unmodified lines
210210 struct comedi_device *dev = d;
211211 struct comedi_subdevice *s = dev->read_subdev;
212212 unsigned int ctrl;
213+ unsigned short val = 0;
213214
214215 ctrl = inb(dev->iobase + PARPORT_CTRL_REG);
215216 if (!(ctrl & PARPORT_CTRL_IRQ_ENA))
216217 return IRQ_NONE;
217218
218− comedi_buf_write_samples(s, &s->state, 1);
219+ comedi_buf_write_samples(s, &val, 1);
219220 comedi_handle_events(dev, s);
220221
221222 return IRQ_HANDLED;
drivers/staging/comedi/drivers/das6402.c+1−1
@@ -186,7 +186,7 @@ static irqreturn_t das6402_interrupt(int irq, void *d) · 185 unmodified lines
186186 if (status & DAS6402_STATUS_FFULL) {
187187 async->events |= COMEDI_CB_OVERFLOW;
188188 } else if (status & DAS6402_STATUS_FFNE) {
189− unsigned int val;
189+ unsigned short val;
190190
191191 val = das6402_ai_read_sample(dev, s);
192192 comedi_buf_write_samples(s, &val, 1);
drivers/staging/comedi/drivers/das800.c+1−1
@@ -427,7 +427,7 @@ static irqreturn_t das800_interrupt(int irq, void *d) · 426 unmodified lines
427427 struct comedi_cmd *cmd;
428428 unsigned long irq_flags;
429429 unsigned int status;
430− unsigned int val;
430+ unsigned short val;
431431 bool fifo_empty;
432432 bool fifo_overflow;
433433 int i;
drivers/staging/comedi/drivers/dmm32at.c+1−1
@@ -404,7 +404,7 @@ static irqreturn_t dmm32at_isr(int irq, void *d) · 403 unmodified lines
404404 {
405405 struct comedi_device *dev = d;
406406 unsigned char intstat;
407− unsigned int val;
407+ unsigned short val;
408408 int i;
409409
410410 if (!dev->attached) {
drivers/staging/comedi/drivers/me4000.c+1−1
@@ -924,7 +924,7 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) · 923 unmodified lines
924924 struct comedi_subdevice *s = dev->read_subdev;
925925 int i;
926926 int c = 0;
927− unsigned int lval;
927+ unsigned short lval;
928928
929929 if (!dev->attached)
930930 return IRQ_NONE;
drivers/staging/comedi/drivers/ni_6527.c+3−1
@@ -195,7 +195,9 @@ static irqreturn_t ni6527_interrupt(int irq, void *d) · 194 unmodified lines
195195 return IRQ_NONE;
196196
197197 if (status & NI6527_STATUS_EDGE) {
198− comedi_buf_write_samples(s, &s->state, 1);
198+ unsigned short val = 0;
199+
200+ comedi_buf_write_samples(s, &val, 1);
199201 comedi_handle_events(dev, s);
200202 }
201203
drivers/staging/comedi/drivers/ni_65xx.c+2−1
@@ -472,6 +472,7 @@ static irqreturn_t ni_65xx_interrupt(int irq, void *d) · 471 unmodified lines
472472 struct comedi_device *dev = d;
473473 struct comedi_subdevice *s = dev->read_subdev;
474474 unsigned int status;
475+ unsigned short val = 0;
475476
476477 status = readb(dev->mmio + NI_65XX_STATUS_REG);
477478 if ((status & NI_65XX_STATUS_INT) == 0)
@@ -482,7 +483,7 @@ static irqreturn_t ni_65xx_interrupt(int irq, void *d) · 4 unmodified lines
482483 writeb(NI_65XX_CLR_EDGE_INT | NI_65XX_CLR_OVERFLOW_INT,
483484 dev->mmio + NI_65XX_CLR_REG);
484485
485− comedi_buf_write_samples(s, &s->state, 1);
486+ comedi_buf_write_samples(s, &val, 1);
486487 comedi_handle_events(dev, s);
487488
488489 return IRQ_HANDLED;
drivers/staging/comedi/drivers/pcl711.c+1−1
@@ -184,7 +184,7 @@ static irqreturn_t pcl711_interrupt(int irq, void *d) · 183 unmodified lines
184184 struct comedi_device *dev = d;
185185 struct comedi_subdevice *s = dev->read_subdev;
186186 struct comedi_cmd *cmd = &s->async->cmd;
187− unsigned int data;
187+ unsigned short data;
188188
189189 if (!dev->attached) {
190190 dev_err(dev->class_dev, "spurious interrupt\n");
drivers/staging/comedi/drivers/pcl726.c+3−1
@@ -220,9 +220,11 @@ static irqreturn_t pcl726_interrupt(int irq, void *d) · 219 unmodified lines
220220 struct pcl726_private *devpriv = dev->private;
221221
222222 if (devpriv->cmd_running) {
223+ unsigned short val = 0;
224+
223225 pcl726_intr_cancel(dev, s);
224226
225− comedi_buf_write_samples(s, &s->state, 1);
227+ comedi_buf_write_samples(s, &val, 1);
226228 comedi_handle_events(dev, s);
227229 }
228230
drivers/staging/comedi/drivers/pcl818.c+1−1
@@ -423,7 +423,7 @@ static int pcl818_ai_eoc(struct comedi_device *dev, · 422 unmodified lines
423423
424424 static bool pcl818_ai_write_sample(struct comedi_device *dev,
425425 struct comedi_subdevice *s,
426− unsigned int chan, unsigned int val)
426+ unsigned int chan, unsigned short val)
427427 {
428428 struct pcl818_private *devpriv = dev->private;
429429 struct comedi_cmd *cmd = &s->async->cmd;
drivers/staging/ks7010/ks_wlan_net.c+4−2
@@ -1120,6 +1120,7 @@ static int ks_wlan_set_scan(struct net_device *dev, · 1119 unmodified lines
11201120 {
11211121 struct ks_wlan_private *priv = netdev_priv(dev);
11221122 struct iw_scan_req *req = NULL;
1123+ int len;
11231124
11241125 if (priv->sleep_mode == SLP_SLEEP)
11251126 return -EPERM;
@@ -1129,8 +1130,9 @@ static int ks_wlan_set_scan(struct net_device *dev, · 3 unmodified lines
11291130 if (wrqu->data.length == sizeof(struct iw_scan_req) &&
11301131 wrqu->data.flags & IW_SCAN_THIS_ESSID) {
11311132 req = (struct iw_scan_req *)extra;
1132− priv->scan_ssid_len = req->essid_len;
1133− memcpy(priv->scan_ssid, req->essid, priv->scan_ssid_len);
1133+ len = min_t(int, req->essid_len, IW_ESSID_MAX_SIZE);
1134+ priv->scan_ssid_len = len;
1135+ memcpy(priv->scan_ssid, req->essid, len);
11341136 } else {
11351137 priv->scan_ssid_len = 0;
11361138 }
drivers/staging/rtl8188eu/core/rtw_ap.c+5−0
@@ -791,6 +791,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) · 790 unmodified lines
791791 p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, WLAN_EID_SSID, &ie_len,
792792 pbss_network->ie_length - _BEACON_IE_OFFSET_);
793793 if (p && ie_len > 0) {
794+ ie_len = min_t(int, ie_len, sizeof(pbss_network->ssid.ssid));
794795 memset(&pbss_network->ssid, 0, sizeof(struct ndis_802_11_ssid));
795796 memcpy(pbss_network->ssid.ssid, p + 2, ie_len);
796797 pbss_network->ssid.ssid_length = ie_len;
@@ -811,6 +812,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) · 14 unmodified lines
811812 p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, WLAN_EID_SUPP_RATES, &ie_len,
812813 pbss_network->ie_length - _BEACON_IE_OFFSET_);
813814 if (p) {
815+ ie_len = min_t(int, ie_len, NDIS_802_11_LENGTH_RATES_EX);
814816 memcpy(supportRate, p + 2, ie_len);
815817 supportRateNum = ie_len;
816818 }
@@ -819,6 +821,8 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) · 2 unmodified lines
819821 p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, WLAN_EID_EXT_SUPP_RATES,
820822 &ie_len, pbss_network->ie_length - _BEACON_IE_OFFSET_);
821823 if (p) {
824+ ie_len = min_t(int, ie_len,
825+ NDIS_802_11_LENGTH_RATES_EX - supportRateNum);
822826 memcpy(supportRate + supportRateNum, p + 2, ie_len);
823827 supportRateNum += ie_len;
824828 }
@@ -934,6 +938,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) · 109 unmodified lines
934938
935939 pht_cap->mcs.rx_mask[0] = 0xff;
936940 pht_cap->mcs.rx_mask[1] = 0x0;
941+ ie_len = min_t(int, ie_len, sizeof(pmlmepriv->htpriv.ht_cap));
937942 memcpy(&pmlmepriv->htpriv.ht_cap, p + 2, ie_len);
938943 }
939944
drivers/staging/rtl8188eu/os_dep/ioctl_linux.c+4−2
@@ -1133,9 +1133,11 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a, · 1132 unmodified lines
11331133 break;
11341134 }
11351135 sec_len = *(pos++); len -= 1;
1136− if (sec_len > 0 && sec_len <= len) {
1136+ if (sec_len > 0 &&
1137+ sec_len <= len &&
1138+ sec_len <= 32) {
11371139 ssid[ssid_index].ssid_length = sec_len;
1138− memcpy(ssid[ssid_index].ssid, pos, ssid[ssid_index].ssid_length);
1140+ memcpy(ssid[ssid_index].ssid, pos, sec_len);
11391141 ssid_index++;
11401142 }
11411143 pos += sec_len;
drivers/staging/rtl8192e/Kconfig+1−0
@@ -27,6 +27,7 @@ config RTLLIB_CRYPTO_CCMP · 26 unmodified lines
2727 config RTLLIB_CRYPTO_TKIP
2828 tristate "Support for rtllib TKIP crypto"
2929 depends on RTLLIB
30+ select CRYPTO
3031 select CRYPTO_LIB_ARC4
3132 select CRYPTO_MICHAEL_MIC
3233 default y
drivers/staging/rtl8192e/rtl8192e/rtl_wx.c+4−3
@@ -406,9 +406,10 @@ static int _rtl92e_wx_set_scan(struct net_device *dev, · 405 unmodified lines
406406 struct iw_scan_req *req = (struct iw_scan_req *)b;
407407
408408 if (req->essid_len) {
409− ieee->current_network.ssid_len = req->essid_len;
410− memcpy(ieee->current_network.ssid, req->essid,
411− req->essid_len);
409+ int len = min_t(int, req->essid_len, IW_ESSID_MAX_SIZE);
410+
411+ ieee->current_network.ssid_len = len;
412+ memcpy(ieee->current_network.ssid, req->essid, len);
412413 }
413414 }
414415
drivers/staging/rtl8192u/r8192U_wx.c+4−2
@@ -331,8 +331,10 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a, · 330 unmodified lines
331331 struct iw_scan_req *req = (struct iw_scan_req *)b;
332332
333333 if (req->essid_len) {
334− ieee->current_network.ssid_len = req->essid_len;
335− memcpy(ieee->current_network.ssid, req->essid, req->essid_len);
334+ int len = min_t(int, req->essid_len, IW_ESSID_MAX_SIZE);
335+
336+ ieee->current_network.ssid_len = len;
337+ memcpy(ieee->current_network.ssid, req->essid, len);
336338 }
337339 }
338340
drivers/staging/rtl8712/rtl871x_cmd.c+4−2
@@ -192,8 +192,10 @@ u8 r8712_sitesurvey_cmd(struct _adapter *padapter, · 191 unmodified lines
192192 psurveyPara->ss_ssidlen = 0;
193193 memset(psurveyPara->ss_ssid, 0, IW_ESSID_MAX_SIZE + 1);
194194 if (pssid && pssid->SsidLength) {
195− memcpy(psurveyPara->ss_ssid, pssid->Ssid, pssid->SsidLength);
196− psurveyPara->ss_ssidlen = cpu_to_le32(pssid->SsidLength);
195+ int len = min_t(int, pssid->SsidLength, IW_ESSID_MAX_SIZE);
196+
197+ memcpy(psurveyPara->ss_ssid, pssid->Ssid, len);
198+ psurveyPara->ss_ssidlen = cpu_to_le32(len);
197199 }
198200 set_fwstate(pmlmepriv, _FW_UNDER_SURVEY);
199201 r8712_enqueue_cmd(pcmdpriv, ph2c);
drivers/staging/rtl8712/rtl871x_ioctl_linux.c+1−1
@@ -924,7 +924,7 @@ static int r871x_wx_set_priv(struct net_device *dev, · 923 unmodified lines
924924 struct iw_point *dwrq = (struct iw_point *)awrq;
925925
926926 len = dwrq->length;
927− ext = memdup_user(dwrq->pointer, len);
927+ ext = strndup_user(dwrq->pointer, len);
928928 if (IS_ERR(ext))
929929 return PTR_ERR(ext);
930930
drivers/staging/wfx/bh.c+1−0
@@ -5,6 +5,7 @@ · 4 unmodified lines
55 * Copyright (c) 2017-2020, Silicon Laboratories, Inc.
66 * Copyright (c) 2010, ST-Ericsson
77 */
8+#include <linux/gpio/consumer.h>
89 #include <net/mac80211.h>
910
1011 #include "bh.h"
drivers/staging/wfx/bh.h+4−0
@@ -8,6 +8,10 @@ · 7 unmodified lines
88 #ifndef WFX_BH_H
99 #define WFX_BH_H
1010
11+#include <linux/atomic.h>
12+#include <linux/wait.h>
13+#include <linux/workqueue.h>
14+
1115 struct wfx_dev;
1216
1317 struct wfx_hif {
drivers/staging/wfx/bus.h+3−0
@@ -8,6 +8,9 @@ · 7 unmodified lines
88 #ifndef WFX_BUS_H
99 #define WFX_BUS_H
1010
11+#include <linux/mmc/sdio_func.h>
12+#include <linux/spi/spi.h>
13+
1114 #define WFX_REG_CONFIG 0x0
1215 #define WFX_REG_CONTROL 0x1
1316 #define WFX_REG_IN_OUT_QUEUE 0x2
drivers/staging/wfx/bus_sdio.c+6−0
@@ -5,13 +5,19 @@ · 4 unmodified lines
55 * Copyright (c) 2017-2020, Silicon Laboratories, Inc.
66 * Copyright (c) 2010, ST-Ericsson
77 */
8+#include <linux/module.h>
89 #include <linux/mmc/sdio.h>
910 #include <linux/mmc/sdio_func.h>
1011 #include <linux/mmc/card.h>
12+#include <linux/interrupt.h>
1113 #include <linux/of_irq.h>
14+#include <linux/irq.h>
1215
1316 #include "bus.h"
1417 #include "wfx.h"
18+#include "hwio.h"
19+#include "main.h"
20+#include "bh.h"
1521
1622 static const struct wfx_platform_data wfx_sdio_pdata = {
1723 .file_fw = "wfm_wf200",
drivers/staging/wfx/bus_spi.c+7−0
@@ -6,12 +6,19 @@ · 5 unmodified lines
66 * Copyright (c) 2011, Sagrad Inc.
77 * Copyright (c) 2010, ST-Ericsson
88 */
9+#include <linux/module.h>
10+#include <linux/delay.h>
11+#include <linux/gpio/consumer.h>
912 #include <linux/spi/spi.h>
13+#include <linux/interrupt.h>
1014 #include <linux/irq.h>
1115 #include <linux/of.h>
1216
1317 #include "bus.h"
1418 #include "wfx.h"
19+#include "hwio.h"
20+#include "main.h"
21+#include "bh.h"
1522
1623 #define SET_WRITE 0x7FFF /* usage: and operation */
1724 #define SET_READ 0x8000 /* usage: or operation */
drivers/staging/wfx/data_rx.c+5−0
@@ -5,8 +5,13 @@ · 4 unmodified lines
55 * Copyright (c) 2017-2020, Silicon Laboratories, Inc.
66 * Copyright (c) 2010, ST-Ericsson
77 */
8+#include <linux/etherdevice.h>
9+#include <net/mac80211.h>
10+
811 #include "data_rx.h"
912 #include "wfx.h"
13+#include "bh.h"
14+#include "sta.h"
1015
1116 static void wfx_rx_handle_ba(struct wfx_vif *wvif, struct ieee80211_mgmt *mgmt)
1217 {
drivers/staging/wfx/data_tx.c+5−0
@@ -6,9 +6,14 @@ · 5 unmodified lines
66 * Copyright (c) 2010, ST-Ericsson
77 */
88 #include <net/mac80211.h>
9+#include <linux/etherdevice.h>
910
11+#include "data_tx.h"
1012 #include "wfx.h"
13+#include "bh.h"
1114 #include "sta.h"
15+#include "queue.h"
16+#include "debug.h"
1217 #include "traces.h"
1318 #include "hif_tx_mib.h"
1419
drivers/staging/wfx/data_tx.h+3−0
@@ -8,6 +8,9 @@ · 7 unmodified lines
88 #ifndef WFX_DATA_TX_H
99 #define WFX_DATA_TX_H
1010
11+#include <linux/list.h>
12+#include <net/mac80211.h>
13+
1114 #include "hif_api_cmd.h"
1215 #include "hif_api_mib.h"
1316
drivers/staging/wfx/debug.c+6−0
@@ -5,9 +5,15 @@ · 4 unmodified lines
55 * Copyright (c) 2017-2020, Silicon Laboratories, Inc.
66 * Copyright (c) 2010, ST-Ericsson
77 */
8+#include <linux/debugfs.h>
9+#include <linux/seq_file.h>
10+#include <linux/crc32.h>
11+
812 #include "debug.h"
913 #include "wfx.h"
1014 #include "sta.h"
15+#include "main.h"
16+#include "hif_tx.h"
1117 #include "hif_tx_mib.h"
1218
1319 #define CREATE_TRACE_POINTS
drivers/staging/wfx/fwio.c+2−0
@@ -6,6 +6,8 @@ · 5 unmodified lines
66 * Copyright (c) 2010, ST-Ericsson
77 */
88 #include <linux/firmware.h>
9+#include <linux/slab.h>
10+#include <linux/mm.h>
911 #include <linux/bitfield.h>
1012
1113 #include "fwio.h"
drivers/staging/wfx/hif_api_cmd.h+4−0
@@ -8,6 +8,10 @@ · 7 unmodified lines
88 #ifndef WFX_HIF_API_CMD_H
99 #define WFX_HIF_API_CMD_H
1010
11+#include <linux/ieee80211.h>
12+
13+#include "hif_api_general.h"
14+
1115 enum hif_requests_ids {
1216 HIF_REQ_ID_RESET = 0x0a,
1317 HIF_REQ_ID_READ_MIB = 0x05,
drivers/staging/wfx/hif_api_general.h+9−0
@@ -8,6 +8,15 @@ · 7 unmodified lines
88 #ifndef WFX_HIF_API_GENERAL_H
99 #define WFX_HIF_API_GENERAL_H
1010
11+#ifdef __KERNEL__
12+#include <linux/types.h>
13+#include <linux/if_ether.h>
14+#else
15+#include <net/ethernet.h>
16+#include <stdint.h>
17+#define __packed __attribute__((__packed__))
18+#endif
19+
1120 #define HIF_ID_IS_INDICATION 0x80
1221 #define HIF_COUNTER_MAX 7
1322
drivers/staging/wfx/hif_tx.c+4−0
@@ -6,7 +6,11 @@ · 5 unmodified lines
66 * Copyright (c) 2017-2020, Silicon Laboratories, Inc.
77 * Copyright (c) 2010, ST-Ericsson
88 */
9+#include <linux/etherdevice.h>
10+
11+#include "hif_tx.h"
912 #include "wfx.h"
13+#include "bh.h"
1014 #include "hwio.h"
1115 #include "debug.h"
1216 #include "sta.h"
drivers/staging/wfx/hif_tx_mib.c+5−0
@@ -6,8 +6,13 @@ · 5 unmodified lines
66 * Copyright (c) 2010, ST-Ericsson
77 * Copyright (C) 2010, ST-Ericsson SA
88 */
9+
10+#include <linux/etherdevice.h>
11+
912 #include "wfx.h"
13+#include "hif_tx.h"
1014 #include "hif_tx_mib.h"
15+#include "hif_api_mib.h"
1116
1217 int hif_set_output_power(struct wfx_vif *wvif, int val)
1318 {
drivers/staging/wfx/hwio.c+3−0
@@ -5,10 +5,13 @@ · 4 unmodified lines
55 * Copyright (c) 2017-2020, Silicon Laboratories, Inc.
66 * Copyright (c) 2010, ST-Ericsson
77 */
8+#include <linux/kernel.h>
9+#include <linux/delay.h>
810 #include <linux/slab.h>
911
1012 #include "hwio.h"
1113 #include "wfx.h"
14+#include "bus.h"
1215 #include "traces.h"
1316
1417 /*
drivers/staging/wfx/hwio.h+2−0
@@ -8,6 +8,8 @@ · 7 unmodified lines
88 #ifndef WFX_HWIO_H
99 #define WFX_HWIO_H
1010
11+#include <linux/types.h>
12+
1113 struct wfx_dev;
1214
1315 int wfx_data_read(struct wfx_dev *wdev, void *buf, size_t buf_len);
drivers/staging/wfx/key.c+2−0
@@ -5,10 +5,12 @@ · 4 unmodified lines
55 * Copyright (c) 2017-2020, Silicon Laboratories, Inc.
66 * Copyright (c) 2010, ST-Ericsson
77 */
8+#include <linux/etherdevice.h>
89 #include <net/mac80211.h>
910
1011 #include "key.h"
1112 #include "wfx.h"
13+#include "hif_tx_mib.h"
1214
1315 static int wfx_alloc_key(struct wfx_dev *wdev)
1416 {
drivers/staging/wfx/key.h+2−0
@@ -8,6 +8,8 @@ · 7 unmodified lines
88 #ifndef WFX_KEY_H
99 #define WFX_KEY_H
1010
11+#include <net/mac80211.h>
12+
1113 struct wfx_dev;
1214 struct wfx_vif;
1315
drivers/staging/wfx/main.c+7−0
@@ -10,21 +10,28 @@ · 9 unmodified lines
1010 * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net>
1111 * Copyright (c) 2004-2006 Jean-Baptiste Note <jbnote@gmail.com>, et al.
1212 */
13+#include <linux/module.h>
1314 #include <linux/of.h>
1415 #include <linux/of_net.h>
16+#include <linux/gpio/consumer.h>
1517 #include <linux/mmc/sdio_func.h>
1618 #include <linux/spi/spi.h>
19+#include <linux/etherdevice.h>
1720 #include <linux/firmware.h>
1821
22+#include "main.h"
1923 #include "wfx.h"
2024 #include "fwio.h"
2125 #include "hwio.h"
2226 #include "bus.h"
27+#include "bh.h"
2328 #include "sta.h"
2429 #include "key.h"
2530 #include "scan.h"
2631 #include "debug.h"
32+#include "data_tx.h"
2733 #include "hif_tx_mib.h"
34+#include "hif_api_cmd.h"
2835
2936 #define WFX_PDS_MAX_SIZE 1500
3037
drivers/staging/wfx/main.h+3−0
@@ -10,8 +10,11 @@ · 9 unmodified lines
1010 #ifndef WFX_MAIN_H
1111 #define WFX_MAIN_H
1212
13+#include <linux/device.h>
1314 #include <linux/gpio/consumer.h>
1415
16+#include "hif_api_general.h"
17+
1518 struct wfx_dev;
1619 struct hwbus_ops;
1720
drivers/staging/wfx/queue.c+4−0
@@ -5,9 +5,13 @@ · 4 unmodified lines
55 * Copyright (c) 2017-2020, Silicon Laboratories, Inc.
66 * Copyright (c) 2010, ST-Ericsson
77 */
8+#include <linux/sched.h>
89 #include <net/mac80211.h>
910
11+#include "queue.h"
1012 #include "wfx.h"
13+#include "sta.h"
14+#include "data_tx.h"
1115 #include "traces.h"
1216
1317 void wfx_tx_lock(struct wfx_dev *wdev)
drivers/staging/wfx/queue.h+3−0
@@ -8,6 +8,9 @@ · 7 unmodified lines
88 #ifndef WFX_QUEUE_H
99 #define WFX_QUEUE_H
1010
11+#include <linux/skbuff.h>
12+#include <linux/atomic.h>
13+
1114 struct wfx_dev;
1215 struct wfx_vif;
1316
drivers/staging/wfx/scan.h+2−0
@@ -8,6 +8,8 @@ · 7 unmodified lines
88 #ifndef WFX_SCAN_H
99 #define WFX_SCAN_H
1010
11+#include <net/mac80211.h>
12+
1113 struct wfx_dev;
1214 struct wfx_vif;
1315
drivers/staging/wfx/sta.c+6−0
@@ -5,11 +5,17 @@ · 4 unmodified lines
55 * Copyright (c) 2017-2020, Silicon Laboratories, Inc.
66 * Copyright (c) 2010, ST-Ericsson
77 */
8+#include <linux/etherdevice.h>
89 #include <net/mac80211.h>
910
1011 #include "sta.h"
1112 #include "wfx.h"
13+#include "fwio.h"
14+#include "bh.h"
15+#include "key.h"
1216 #include "scan.h"
17+#include "debug.h"
18+#include "hif_tx.h"
1319 #include "hif_tx_mib.h"
1420
1521 #define HIF_MAX_ARP_IP_ADDRTABLE_ENTRIES 2
drivers/staging/wfx/sta.h+2−0
@@ -8,6 +8,8 @@ · 7 unmodified lines
88 #ifndef WFX_STA_H
99 #define WFX_STA_H
1010
11+#include <net/mac80211.h>
12+
1113 struct wfx_dev;
1214 struct wfx_vif;
1315
drivers/staging/wfx/traces.h+3−0
@@ -12,8 +12,11 @@ · 11 unmodified lines
1212 #define _WFX_TRACE_H
1313
1414 #include <linux/tracepoint.h>
15+#include <net/mac80211.h>
1516
1617 #include "bus.h"
18+#include "hif_api_cmd.h"
19+#include "hif_api_mib.h"
1720
1821 /* The hell below need some explanations. For each symbolic number, we need to
1922 * define it with TRACE_DEFINE_ENUM() and in a list for __print_symbolic.
drivers/staging/wfx/wfx.h+3−0
@@ -10,6 +10,9 @@ · 9 unmodified lines
1010 #ifndef WFX_H
1111 #define WFX_H
1212
13+#include <linux/completion.h>
14+#include <linux/workqueue.h>
15+#include <linux/mutex.h>
1316 #include <linux/nospec.h>
1417 #include <net/mac80211.h>
1518
drivers/tty/hvc/hvcs.c+1−3
@@ -317,7 +317,6 @@ static void hvcs_hangup(struct tty_struct * tty); · 316 unmodified lines
317317
318318 static int hvcs_probe(struct vio_dev *dev,
319319 const struct vio_device_id *id);
320−static int hvcs_remove(struct vio_dev *dev);
321320 static int __init hvcs_module_init(void);
322321 static void __exit hvcs_module_exit(void);
323322 static int hvcs_initialize(void);
@@ -819,7 +818,7 @@ static int hvcs_probe( · 495 unmodified lines
819818 return 0;
820819 }
821820
822−static int hvcs_remove(struct vio_dev *dev)
821+static void hvcs_remove(struct vio_dev *dev)
823822 {
824823 struct hvcs_struct *hvcsd = dev_get_drvdata(&dev->dev);
825824 unsigned long flags;
@@ -849,7 +848,6 @@ static int hvcs_remove(struct vio_dev *dev) · 23 unmodified lines
849848
850849 printk(KERN_INFO "HVCS: vty-server@%X removed from the"
851850 " vio bus.\n", dev->unit_address);
852− return 0;
853851 };
854852
855853 static struct vio_driver hvcs_vio_driver = {
drivers/tty/pty.c+2−13
@@ -66,8 +66,7 @@ static void pty_close(struct tty_struct *tty, struct file *filp) · 65 unmodified lines
6666 wake_up_interruptible(&tty->link->read_wait);
6767 wake_up_interruptible(&tty->link->write_wait);
6868 if (tty->driver->subtype == PTY_TYPE_MASTER) {
69− struct file *f;
70−
69+ set_bit(TTY_OTHER_CLOSED, &tty->flags);
7170 #ifdef CONFIG_UNIX98_PTYS
7271 if (tty->driver == ptm_driver) {
7372 mutex_lock(&devpts_mutex);
@@ -76,17 +75,7 @@ static void pty_close(struct tty_struct *tty, struct file *filp) · 2 unmodified lines
7675 mutex_unlock(&devpts_mutex);
7776 }
7877 #endif
79−
80− /*
81− * This hack is required because a program can open a
82− * pty and redirect a console to it, but if the pty is
83− * closed and the console is not released, then the
84− * slave side will never close. So release the
85− * redirect when the master closes.
86− */
87− f = tty_release_redirect(tty->link);
88− if (f)
89− fput(f);
78+ tty_vhangup(tty->link);
9079 }
9180 }
9281
drivers/tty/serial/max310x.c+5−24
@@ -1056,9 +1056,9 @@ static int max310x_startup(struct uart_port *port) · 1055 unmodified lines
10561056 max310x_port_update(port, MAX310X_MODE1_REG,
10571057 MAX310X_MODE1_TRNSCVCTRL_BIT, 0);
10581058
1059− /* Reset FIFOs */
1060− max310x_port_write(port, MAX310X_MODE2_REG,
1061− MAX310X_MODE2_FIFORST_BIT);
1059+ /* Configure MODE2 register & Reset FIFOs*/
1060+ val = MAX310X_MODE2_RXEMPTINV_BIT | MAX310X_MODE2_FIFORST_BIT;
1061+ max310x_port_write(port, MAX310X_MODE2_REG, val);
10621062 max310x_port_update(port, MAX310X_MODE2_REG,
10631063 MAX310X_MODE2_FIFORST_BIT, 0);
10641064
@@ -1086,27 +1086,8 @@ static int max310x_startup(struct uart_port *port) · 21 unmodified lines
10861086 /* Clear IRQ status register */
10871087 max310x_port_read(port, MAX310X_IRQSTS_REG);
10881088
1089− /*
1090− * Let's ask for an interrupt after a timeout equivalent to
1091− * the receiving time of 4 characters after the last character
1092− * has been received.
1093− */
1094− max310x_port_write(port, MAX310X_RXTO_REG, 4);
1095−
1096− /*
1097− * Make sure we also get RX interrupts when the RX FIFO is
1098− * filling up quickly, so get an interrupt when half of the RX
1099− * FIFO has been filled in.
1100− */
1101− max310x_port_write(port, MAX310X_FIFOTRIGLVL_REG,
1102− MAX310X_FIFOTRIGLVL_RX(MAX310X_FIFO_SIZE / 2));
1103−
1104− /* Enable RX timeout interrupt in LSR */
1105− max310x_port_write(port, MAX310X_LSR_IRQEN_REG,
1106− MAX310X_LSR_RXTO_BIT);
1107−
1108− /* Enable LSR, RX FIFO trigger, CTS change interrupts */
1109− val = MAX310X_IRQ_LSR_BIT | MAX310X_IRQ_RXFIFO_BIT | MAX310X_IRQ_TXEMPTY_BIT;
1089+ /* Enable RX, TX, CTS change interrupts */
1090+ val = MAX310X_IRQ_RXEMPTY_BIT | MAX310X_IRQ_TXEMPTY_BIT;
11101091 max310x_port_write(port, MAX310X_IRQEN_REG, val | MAX310X_IRQ_CTS_BIT);
11111092
11121093 return 0;
drivers/tty/tty_io.c+2−3
@@ -544,9 +544,7 @@ EXPORT_SYMBOL_GPL(tty_wakeup); · 543 unmodified lines
544544 * @tty: tty device
545545 *
546546 * This is available to the pty code so if the master closes, if the
547− * slave is a redirect it can release the redirect. It returns the
548− * filp for the redirect, which must be fput when the operations on
549− * the tty are completed.
547+ * slave is a redirect it can release the redirect.
550548 */
551549 struct file *tty_release_redirect(struct tty_struct *tty)
552550 {
@@ -561,6 +559,7 @@ struct file *tty_release_redirect(struct tty_struct *tty) · 8 unmodified lines
561559
562560 return f;
563561 }
562+EXPORT_SYMBOL_GPL(tty_release_redirect);
564563
565564 /**
566565 * __tty_hangup - actual handler for hangup events
drivers/usb/class/cdc-acm.c+5−0
@@ -1935,6 +1935,11 @@ static const struct usb_device_id acm_ids[] = { · 1934 unmodified lines
19351935 .driver_info = SEND_ZERO_PACKET,
19361936 },
19371937
1938+ /* Exclude Goodix Fingerprint Reader */
1939+ { USB_DEVICE(0x27c6, 0x5395),
1940+ .driver_info = IGNORE_DEVICE,
1941+ },
1942+
19381943 /* control interfaces without any protocol set */
19391944 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM,
19401945 USB_CDC_PROTO_NONE) },
drivers/usb/class/usblp.c+12−4
@@ -494,16 +494,24 @@ static int usblp_release(struct inode *inode, struct file *file) · 493 unmodified lines
494494 /* No kernel lock - fine */
495495 static __poll_t usblp_poll(struct file *file, struct poll_table_struct *wait)
496496 {
497− __poll_t ret;
497+ struct usblp *usblp = file->private_data;
498+ __poll_t ret = 0;
498499 unsigned long flags;
499500
500− struct usblp *usblp = file->private_data;
501501 /* Should we check file->f_mode & FMODE_WRITE before poll_wait()? */
502502 poll_wait(file, &usblp->rwait, wait);
503503 poll_wait(file, &usblp->wwait, wait);
504+
505+ mutex_lock(&usblp->mut);
506+ if (!usblp->present)
507+ ret |= EPOLLHUP;
508+ mutex_unlock(&usblp->mut);
509+
504510 spin_lock_irqsave(&usblp->lock, flags);
505− ret = ((usblp->bidir && usblp->rcomplete) ? EPOLLIN | EPOLLRDNORM : 0) |
506− ((usblp->no_paper || usblp->wcomplete) ? EPOLLOUT | EPOLLWRNORM : 0);
511+ if (usblp->bidir && usblp->rcomplete)
512+ ret |= EPOLLIN | EPOLLRDNORM;
513+ if (usblp->no_paper || usblp->wcomplete)
514+ ret |= EPOLLOUT | EPOLLWRNORM;
507515 spin_unlock_irqrestore(&usblp->lock, flags);
508516 return ret;
509517 }
drivers/usb/core/usb.c+32−0
@@ -748,6 +748,38 @@ void usb_put_intf(struct usb_interface *intf) · 747 unmodified lines
748748 }
749749 EXPORT_SYMBOL_GPL(usb_put_intf);
750750
751+/**
752+ * usb_intf_get_dma_device - acquire a reference on the usb interface's DMA endpoint
753+ * @intf: the usb interface
754+ *
755+ * While a USB device cannot perform DMA operations by itself, many USB
756+ * controllers can. A call to usb_intf_get_dma_device() returns the DMA endpoint
757+ * for the given USB interface, if any. The returned device structure must be
758+ * released with put_device().
759+ *
760+ * See also usb_get_dma_device().
761+ *
762+ * Returns: A reference to the usb interface's DMA endpoint; or NULL if none
763+ * exists.
764+ */
765+struct device *usb_intf_get_dma_device(struct usb_interface *intf)
766+{
767+ struct usb_device *udev = interface_to_usbdev(intf);
768+ struct device *dmadev;
769+
770+ if (!udev->bus)
771+ return NULL;
772+
773+ dmadev = get_device(udev->bus->sysdev);
774+ if (!dmadev || !dmadev->dma_mask) {
775+ put_device(dmadev);
776+ return NULL;
777+ }
778+
779+ return dmadev;
780+}
781+EXPORT_SYMBOL_GPL(usb_intf_get_dma_device);
782+
751783 /* USB device locking
752784 *
753785 * USB devices and interfaces are locked using the semaphore in their
drivers/usb/dwc3/dwc3-qcom.c+13−5
@@ -358,8 +358,10 @@ static int dwc3_qcom_suspend(struct dwc3_qcom *qcom) · 357 unmodified lines
358358 if (ret)
359359 dev_warn(qcom->dev, "failed to disable interconnect: %d\n", ret);
360360
361+ if (device_may_wakeup(qcom->dev))
362+ dwc3_qcom_enable_interrupts(qcom);
363+
361364 qcom->is_suspended = true;
362− dwc3_qcom_enable_interrupts(qcom);
363365
364366 return 0;
365367 }
@@ -372,7 +374,8 @@ static int dwc3_qcom_resume(struct dwc3_qcom *qcom) · 6 unmodified lines
372374 if (!qcom->is_suspended)
373375 return 0;
374376
375− dwc3_qcom_disable_interrupts(qcom);
377+ if (device_may_wakeup(qcom->dev))
378+ dwc3_qcom_disable_interrupts(qcom);
376379
377380 for (i = 0; i < qcom->num_clocks; i++) {
378381 ret = clk_prepare_enable(qcom->clks[i]);
@@ -650,16 +653,19 @@ static int dwc3_qcom_of_register_core(struct platform_device *pdev) · 271 unmodified lines
650653 ret = of_platform_populate(np, NULL, NULL, dev);
651654 if (ret) {
652655 dev_err(dev, "failed to register dwc3 core - %d\n", ret);
653− return ret;
656+ goto node_put;
654657 }
655658
656659 qcom->dwc3 = of_find_device_by_node(dwc3_np);
657660 if (!qcom->dwc3) {
661+ ret = -ENODEV;
658662 dev_err(dev, "failed to get dwc3 platform device\n");
659− return -ENODEV;
660663 }
661664
662− return 0;
665+node_put:
666+ of_node_put(dwc3_np);
667+
668+ return ret;
663669 }
664670
665671 static struct platform_device *
@@ -938,6 +944,8 @@ static const struct dwc3_acpi_pdata sdm845_acpi_urs_pdata = { · 272 unmodified lines
938944 static const struct acpi_device_id dwc3_qcom_acpi_match[] = {
939945 { "QCOM2430", (unsigned long)&sdm845_acpi_pdata },
940946 { "QCOM0304", (unsigned long)&sdm845_acpi_urs_pdata },
947+ { "QCOM0497", (unsigned long)&sdm845_acpi_urs_pdata },
948+ { "QCOM04A6", (unsigned long)&sdm845_acpi_pdata },
941949 { },
942950 };
943951 MODULE_DEVICE_TABLE(acpi, dwc3_qcom_acpi_match);
drivers/usb/gadget/function/f_uac1.c+1−0
@@ -499,6 +499,7 @@ static void f_audio_disable(struct usb_function *f) · 498 unmodified lines
499499 uac1->as_out_alt = 0;
500500 uac1->as_in_alt = 0;
501501
502+ u_audio_stop_playback(&uac1->g_audio);
502503 u_audio_stop_capture(&uac1->g_audio);
503504 }
504505
drivers/usb/gadget/function/f_uac2.c+1−1
@@ -478,7 +478,7 @@ static int set_ep_max_packet_size(const struct f_uac2_opts *uac2_opts, · 477 unmodified lines
478478 }
479479
480480 max_size_bw = num_channels(chmask) * ssize *
481− DIV_ROUND_UP(srate, factor / (1 << (ep_desc->bInterval - 1)));
481+ ((srate / (factor / (1 << (ep_desc->bInterval - 1)))) + 1);
482482 ep_desc->wMaxPacketSize = cpu_to_le16(min_t(u16, max_size_bw,
483483 max_size_ep));
484484
drivers/usb/gadget/function/u_ether_configfs.h+2−3
@@ -182,12 +182,11 @@ out: \ · 181 unmodified lines
182182 size_t len) \
183183 { \
184184 struct f_##_f_##_opts *opts = to_f_##_f_##_opts(item); \
185− int ret; \
185+ int ret = -EINVAL; \
186186 u8 val; \
187187 \
188188 mutex_lock(&opts->lock); \
189− ret = sscanf(page, "%02hhx", &val); \
190− if (ret > 0) { \
189+ if (sscanf(page, "%02hhx", &val) > 0) { \
191190 opts->_n_ = val; \
192191 ret = len; \
193192 } \
drivers/usb/gadget/udc/s3c2410_udc.c+2−2
@@ -1773,8 +1773,8 @@ static int s3c2410_udc_probe(struct platform_device *pdev) · 1772 unmodified lines
17731773 udc_info = dev_get_platdata(&pdev->dev);
17741774
17751775 base_addr = devm_platform_ioremap_resource(pdev, 0);
1776− if (!base_addr) {
1777− retval = -ENOMEM;
1776+ if (IS_ERR(base_addr)) {
1777+ retval = PTR_ERR(base_addr);
17781778 goto err_mem;
17791779 }
17801780
drivers/usb/host/xhci-pci.c+11−2
@@ -66,6 +66,7 @@ · 65 unmodified lines
6666 #define PCI_DEVICE_ID_ASMEDIA_1042A_XHCI 0x1142
6767 #define PCI_DEVICE_ID_ASMEDIA_1142_XHCI 0x1242
6868 #define PCI_DEVICE_ID_ASMEDIA_2142_XHCI 0x2142
69+#define PCI_DEVICE_ID_ASMEDIA_3242_XHCI 0x3242
6970
7071 static const char hcd_name[] = "xhci_hcd";
7172
@@ -276,11 +277,14 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) · 204 unmodified lines
276277 pdev->device == PCI_DEVICE_ID_ASMEDIA_1042_XHCI)
277278 xhci->quirks |= XHCI_BROKEN_STREAMS;
278279 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
279− pdev->device == PCI_DEVICE_ID_ASMEDIA_1042A_XHCI)
280+ pdev->device == PCI_DEVICE_ID_ASMEDIA_1042A_XHCI) {
280281 xhci->quirks |= XHCI_TRUST_TX_LENGTH;
282+ xhci->quirks |= XHCI_NO_64BIT_SUPPORT;
283+ }
281284 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
282285 (pdev->device == PCI_DEVICE_ID_ASMEDIA_1142_XHCI ||
283− pdev->device == PCI_DEVICE_ID_ASMEDIA_2142_XHCI))
286+ pdev->device == PCI_DEVICE_ID_ASMEDIA_2142_XHCI ||
287+ pdev->device == PCI_DEVICE_ID_ASMEDIA_3242_XHCI))
284288 xhci->quirks |= XHCI_NO_64BIT_SUPPORT;
285289
286290 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
@@ -295,6 +299,11 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) · 8 unmodified lines
295299 pdev->device == 0x9026)
296300 xhci->quirks |= XHCI_RESET_PLL_ON_DISCONNECT;
297301
302+ if (pdev->vendor == PCI_VENDOR_ID_AMD &&
303+ (pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_2 ||
304+ pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_4))
305+ xhci->quirks |= XHCI_NO_SOFT_RETRY;
306+
298307 if (xhci->quirks & XHCI_RESET_ON_RESUME)
299308 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
300309 "QUIRK: Resetting on resume");
drivers/usb/host/xhci-ring.c+2−1
@@ -2484,7 +2484,8 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td, · 2483 unmodified lines
24842484 remaining = 0;
24852485 break;
24862486 case COMP_USB_TRANSACTION_ERROR:
2487− if ((ep_ring->err_count++ > MAX_SOFT_RETRY) ||
2487+ if (xhci->quirks & XHCI_NO_SOFT_RETRY ||
2488+ (ep_ring->err_count++ > MAX_SOFT_RETRY) ||
24882489 le32_to_cpu(slot_ctx->tt_info) & TT_SLOT)
24892490 break;
24902491
drivers/usb/host/xhci.c+43−35
@@ -883,44 +883,42 @@ static void xhci_clear_command_ring(struct xhci_hcd *xhci) · 882 unmodified lines
883883 xhci_set_cmd_ring_deq(xhci);
884884 }
885885
886−static void xhci_disable_port_wake_on_bits(struct xhci_hcd *xhci)
886+/*
887+ * Disable port wake bits if do_wakeup is not set.
888+ *
889+ * Also clear a possible internal port wake state left hanging for ports that
890+ * detected termination but never successfully enumerated (trained to 0U).
891+ * Internal wake causes immediate xHCI wake after suspend. PORT_CSC write done
892+ * at enumeration clears this wake, force one here as well for unconnected ports
893+ */
894+
895+static void xhci_disable_hub_port_wake(struct xhci_hcd *xhci,
896+ struct xhci_hub *rhub,
897+ bool do_wakeup)
887898 {
888− struct xhci_port **ports;
889− int port_index;
890899 unsigned long flags;
891900 u32 t1, t2, portsc;
901+ int i;
892902
893903 spin_lock_irqsave(&xhci->lock, flags);
894904
895− /* disable usb3 ports Wake bits */
896− port_index = xhci->usb3_rhub.num_ports;
897− ports = xhci->usb3_rhub.ports;
898− while (port_index--) {
899− t1 = readl(ports[port_index]->addr);
900− portsc = t1;
901− t1 = xhci_port_state_to_neutral(t1);
902− t2 = t1 & ~PORT_WAKE_BITS;
903− if (t1 != t2) {
904− writel(t2, ports[port_index]->addr);
905− xhci_dbg(xhci, "disable wake bits port %d-%d, portsc: 0x%x, write: 0x%x\n",
906− xhci->usb3_rhub.hcd->self.busnum,
907− port_index + 1, portsc, t2);
908− }
909− }
905+ for (i = 0; i < rhub->num_ports; i++) {
906+ portsc = readl(rhub->ports[i]->addr);
907+ t1 = xhci_port_state_to_neutral(portsc);
908+ t2 = t1;
909+
910+ /* clear wake bits if do_wake is not set */
911+ if (!do_wakeup)
912+ t2 &= ~PORT_WAKE_BITS;
913+
914+ /* Don't touch csc bit if connected or connect change is set */
915+ if (!(portsc & (PORT_CSC | PORT_CONNECT)))
916+ t2 |= PORT_CSC;
910917
911− /* disable usb2 ports Wake bits */
912− port_index = xhci->usb2_rhub.num_ports;
913− ports = xhci->usb2_rhub.ports;
914− while (port_index--) {
915− t1 = readl(ports[port_index]->addr);
916− portsc = t1;
917− t1 = xhci_port_state_to_neutral(t1);
918− t2 = t1 & ~PORT_WAKE_BITS;
919918 if (t1 != t2) {
920− writel(t2, ports[port_index]->addr);
921− xhci_dbg(xhci, "disable wake bits port %d-%d, portsc: 0x%x, write: 0x%x\n",
922− xhci->usb2_rhub.hcd->self.busnum,
923− port_index + 1, portsc, t2);
919+ writel(t2, rhub->ports[i]->addr);
920+ xhci_dbg(xhci, "config port %d-%d wake bits, portsc: 0x%x, write: 0x%x\n",
921+ rhub->hcd->self.busnum, i + 1, portsc, t2);
924922 }
925923 }
926924 spin_unlock_irqrestore(&xhci->lock, flags);
@@ -983,8 +981,8 @@ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup) · 56 unmodified lines
983981 return -EINVAL;
984982
985983 /* Clear root port wake on bits if wakeup not allowed. */
986− if (!do_wakeup)
987− xhci_disable_port_wake_on_bits(xhci);
984+ xhci_disable_hub_port_wake(xhci, &xhci->usb3_rhub, do_wakeup);
985+ xhci_disable_hub_port_wake(xhci, &xhci->usb2_rhub, do_wakeup);
988986
989987 if (!HCD_HW_ACCESSIBLE(hcd))
990988 return 0;
@@ -1088,6 +1086,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) · 97 unmodified lines
10881086 struct usb_hcd *secondary_hcd;
10891087 int retval = 0;
10901088 bool comp_timer_running = false;
1089+ bool pending_portevent = false;
10911090
10921091 if (!hcd->state)
10931092 return 0;
@@ -1226,13 +1225,22 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) · 132 unmodified lines
12261225
12271226 done:
12281227 if (retval == 0) {
1229− /* Resume root hubs only when have pending events. */
1230− if (xhci_pending_portevent(xhci)) {
1228+ /*
1229+ * Resume roothubs only if there are pending events.
1230+ * USB 3 devices resend U3 LFPS wake after a 100ms delay if
1231+ * the first wake signalling failed, give it that chance.
1232+ */
1233+ pending_portevent = xhci_pending_portevent(xhci);
1234+ if (!pending_portevent) {
1235+ msleep(120);
1236+ pending_portevent = xhci_pending_portevent(xhci);
1237+ }
1238+
1239+ if (pending_portevent) {
12311240 usb_hcd_resume_root_hub(xhci->shared_hcd);
12321241 usb_hcd_resume_root_hub(hcd);
12331242 }
12341243 }
1235−
12361244 /*
12371245 * If system is subject to the Quirk, Compliance Mode Timer needs to
12381246 * be re-initialized Always after a system resume. Ports are subject
drivers/usb/host/xhci.h+1−0
@@ -1891,6 +1891,7 @@ struct xhci_hcd { · 1890 unmodified lines
18911891 #define XHCI_SKIP_PHY_INIT BIT_ULL(37)
18921892 #define XHCI_DISABLE_SPARSE BIT_ULL(38)
18931893 #define XHCI_SG_TRB_CACHE_SIZE_QUIRK BIT_ULL(39)
1894+#define XHCI_NO_SOFT_RETRY BIT_ULL(40)
18941895
18951896 unsigned int num_active_eps;
18961897 unsigned int limit_active_eps;
drivers/usb/renesas_usbhs/pipe.c+2−0
@@ -746,6 +746,8 @@ struct usbhs_pipe *usbhs_pipe_malloc(struct usbhs_priv *priv, · 745 unmodified lines
746746
747747 void usbhs_pipe_free(struct usbhs_pipe *pipe)
748748 {
749+ usbhsp_pipe_select(pipe);
750+ usbhsp_pipe_cfg_set(pipe, 0xFFFF, 0);
749751 usbhsp_put_pipe(pipe);
750752 }
751753
drivers/usb/serial/ch341.c+1−0
@@ -86,6 +86,7 @@ static const struct usb_device_id id_table[] = { · 85 unmodified lines
8686 { USB_DEVICE(0x1a86, 0x7522) },
8787 { USB_DEVICE(0x1a86, 0x7523) },
8888 { USB_DEVICE(0x4348, 0x5523) },
89+ { USB_DEVICE(0x9986, 0x7523) },
8990 { },
9091 };
9192 MODULE_DEVICE_TABLE(usb, id_table);
drivers/usb/serial/cp210x.c+3−0
@@ -145,6 +145,7 @@ static const struct usb_device_id id_table[] = { · 144 unmodified lines
145145 { USB_DEVICE(0x10C4, 0x8857) }, /* CEL EM357 ZigBee USB Stick */
146146 { USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */
147147 { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */
148+ { USB_DEVICE(0x10C4, 0x88D8) }, /* Acuity Brands nLight Air Adapter */
148149 { USB_DEVICE(0x10C4, 0x88FB) }, /* CESINEL MEDCAL STII Network Analyzer */
149150 { USB_DEVICE(0x10C4, 0x8938) }, /* CESINEL MEDCAL S II Network Analyzer */
150151 { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */
@@ -201,6 +202,8 @@ static const struct usb_device_id id_table[] = { · 50 unmodified lines
201202 { USB_DEVICE(0x1901, 0x0194) }, /* GE Healthcare Remote Alarm Box */
202203 { USB_DEVICE(0x1901, 0x0195) }, /* GE B850/B650/B450 CP2104 DP UART interface */
203204 { USB_DEVICE(0x1901, 0x0196) }, /* GE B850 CP2105 DP UART interface */
205+ { USB_DEVICE(0x1901, 0x0197) }, /* GE CS1000 Display serial interface */
206+ { USB_DEVICE(0x1901, 0x0198) }, /* GE CS1000 M.2 Key E serial interface */
204207 { USB_DEVICE(0x199B, 0xBA30) }, /* LORD WSDA-200-USB */
205208 { USB_DEVICE(0x19CF, 0x3000) }, /* Parrot NMEA GPS Flight Recorder */
206209 { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */
drivers/usb/serial/io_edgeport.c+16−10
@@ -3003,26 +3003,32 @@ static int edge_startup(struct usb_serial *serial) · 3002 unmodified lines
30033003 response = -ENODEV;
30043004 }
30053005
3006− usb_free_urb(edge_serial->interrupt_read_urb);
3007− kfree(edge_serial->interrupt_in_buffer);
3008−
3009− usb_free_urb(edge_serial->read_urb);
3010− kfree(edge_serial->bulk_in_buffer);
3011−
3012− kfree(edge_serial);
3013−
3014− return response;
3006+ goto error;
30153007 }
30163008
30173009 /* start interrupt read for this edgeport this interrupt will
30183010 * continue as long as the edgeport is connected */
30193011 response = usb_submit_urb(edge_serial->interrupt_read_urb,
30203012 GFP_KERNEL);
3021− if (response)
3013+ if (response) {
30223014 dev_err(ddev, "%s - Error %d submitting control urb\n",
30233015 __func__, response);
3016+
3017+ goto error;
3018+ }
30243019 }
30253020 return response;
3021+
3022+error:
3023+ usb_free_urb(edge_serial->interrupt_read_urb);
3024+ kfree(edge_serial->interrupt_in_buffer);
3025+
3026+ usb_free_urb(edge_serial->read_urb);
3027+ kfree(edge_serial->bulk_in_buffer);
3028+
3029+ kfree(edge_serial);
3030+
3031+ return response;
30263032 }
30273033
30283034
drivers/usb/serial/xr_serial.c+0−25
@@ -545,37 +545,13 @@ static void xr_close(struct usb_serial_port *port) · 544 unmodified lines
545545
546546 static int xr_probe(struct usb_serial *serial, const struct usb_device_id *id)
547547 {
548− struct usb_driver *driver = serial->type->usb_driver;
549− struct usb_interface *control_interface;
550− int ret;
551−
552548 /* Don't bind to control interface */
553549 if (serial->interface->cur_altsetting->desc.bInterfaceNumber == 0)
554550 return -ENODEV;
555551
556− /* But claim the control interface during data interface probe */
557− control_interface = usb_ifnum_to_if(serial->dev, 0);
558− if (!control_interface)
559− return -ENODEV;
560−
561− ret = usb_driver_claim_interface(driver, control_interface, NULL);
562− if (ret) {
563− dev_err(&serial->interface->dev, "Failed to claim control interface\n");
564− return ret;
565− }
566−
567552 return 0;
568553 }
569554
570−static void xr_disconnect(struct usb_serial *serial)
571−{
572− struct usb_driver *driver = serial->type->usb_driver;
573− struct usb_interface *control_interface;
574−
575− control_interface = usb_ifnum_to_if(serial->dev, 0);
576− usb_driver_release_interface(driver, control_interface);
577−}
578−
579555 static const struct usb_device_id id_table[] = {
580556 { USB_DEVICE(0x04e2, 0x1410) }, /* XR21V141X */
581557 { }
@@ -590,7 +566,6 @@ static struct usb_serial_driver xr_device = { · 8 unmodified lines
590566 .id_table = id_table,
591567 .num_ports = 1,
592568 .probe = xr_probe,
593− .disconnect = xr_disconnect,
594569 .open = xr_open,
595570 .close = xr_close,
596571 .break_ctl = xr_break_ctl,
drivers/usb/usbip/stub_dev.c+35−7
@@ -46,6 +46,8 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a · 45 unmodified lines
4646 int sockfd = 0;
4747 struct socket *socket;
4848 int rv;
49+ struct task_struct *tcp_rx = NULL;
50+ struct task_struct *tcp_tx = NULL;
4951
5052 if (!sdev) {
5153 dev_err(dev, "sdev is null\n");
@@ -69,23 +71,47 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a · 17 unmodified lines
6971 }
7072
7173 socket = sockfd_lookup(sockfd, &err);
72− if (!socket)
74+ if (!socket) {
75+ dev_err(dev, "failed to lookup sock");
7376 goto err;
77+ }
7478
75− sdev->ud.tcp_socket = socket;
76− sdev->ud.sockfd = sockfd;
79+ if (socket->type != SOCK_STREAM) {
80+ dev_err(dev, "Expecting SOCK_STREAM - found %d",
81+ socket->type);
82+ goto sock_err;
83+ }
7784
85+ /* unlock and create threads and get tasks */
7886 spin_unlock_irq(&sdev->ud.lock);
87+ tcp_rx = kthread_create(stub_rx_loop, &sdev->ud, "stub_rx");
88+ if (IS_ERR(tcp_rx)) {
89+ sockfd_put(socket);
90+ return -EINVAL;
91+ }
92+ tcp_tx = kthread_create(stub_tx_loop, &sdev->ud, "stub_tx");
93+ if (IS_ERR(tcp_tx)) {
94+ kthread_stop(tcp_rx);
95+ sockfd_put(socket);
96+ return -EINVAL;
97+ }
7998
80− sdev->ud.tcp_rx = kthread_get_run(stub_rx_loop, &sdev->ud,
81− "stub_rx");
82− sdev->ud.tcp_tx = kthread_get_run(stub_tx_loop, &sdev->ud,
83− "stub_tx");
99+ /* get task structs now */
100+ get_task_struct(tcp_rx);
101+ get_task_struct(tcp_tx);
84102
103+ /* lock and update sdev->ud state */
85104 spin_lock_irq(&sdev->ud.lock);
105+ sdev->ud.tcp_socket = socket;
106+ sdev->ud.sockfd = sockfd;
107+ sdev->ud.tcp_rx = tcp_rx;
108+ sdev->ud.tcp_tx = tcp_tx;
86109 sdev->ud.status = SDEV_ST_USED;
87110 spin_unlock_irq(&sdev->ud.lock);
88111
112+ wake_up_process(sdev->ud.tcp_rx);
113+ wake_up_process(sdev->ud.tcp_tx);
114+
89115 } else {
90116 dev_info(dev, "stub down\n");
91117
@@ -100,6 +126,8 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a · 8 unmodified lines
100126
101127 return count;
102128
129+sock_err:
130+ sockfd_put(socket);
103131 err:
104132 spin_unlock_irq(&sdev->ud.lock);
105133 return -EINVAL;
drivers/usb/usbip/vhci_sysfs.c+34−5
@@ -312,6 +312,8 @@ static ssize_t attach_store(struct device *dev, struct device_attribute *attr, · 311 unmodified lines
312312 struct vhci *vhci;
313313 int err;
314314 unsigned long flags;
315+ struct task_struct *tcp_rx = NULL;
316+ struct task_struct *tcp_tx = NULL;
315317
316318 /*
317319 * @rhport: port number of vhci_hcd
@@ -349,12 +351,35 @@ static ssize_t attach_store(struct device *dev, struct device_attribute *attr, · 31 unmodified lines
349351
350352 /* Extract socket from fd. */
351353 socket = sockfd_lookup(sockfd, &err);
352− if (!socket)
354+ if (!socket) {
355+ dev_err(dev, "failed to lookup sock");
353356 return -EINVAL;
357+ }
358+ if (socket->type != SOCK_STREAM) {
359+ dev_err(dev, "Expecting SOCK_STREAM - found %d",
360+ socket->type);
361+ sockfd_put(socket);
362+ return -EINVAL;
363+ }
364+
365+ /* create threads before locking */
366+ tcp_rx = kthread_create(vhci_rx_loop, &vdev->ud, "vhci_rx");
367+ if (IS_ERR(tcp_rx)) {
368+ sockfd_put(socket);
369+ return -EINVAL;
370+ }
371+ tcp_tx = kthread_create(vhci_tx_loop, &vdev->ud, "vhci_tx");
372+ if (IS_ERR(tcp_tx)) {
373+ kthread_stop(tcp_rx);
374+ sockfd_put(socket);
375+ return -EINVAL;
376+ }
354377
355− /* now need lock until setting vdev status as used */
378+ /* get task structs now */
379+ get_task_struct(tcp_rx);
380+ get_task_struct(tcp_tx);
356381
357− /* begin a lock */
382+ /* now begin lock until setting vdev status set */
358383 spin_lock_irqsave(&vhci->lock, flags);
359384 spin_lock(&vdev->ud.lock);
360385
@@ -364,6 +389,8 @@ static ssize_t attach_store(struct device *dev, struct device_attribute *attr, · 3 unmodified lines
364389 spin_unlock_irqrestore(&vhci->lock, flags);
365390
366391 sockfd_put(socket);
392+ kthread_stop_put(tcp_rx);
393+ kthread_stop_put(tcp_tx);
367394
368395 dev_err(dev, "port %d already used\n", rhport);
369396 /*
@@ -382,6 +409,8 @@ static ssize_t attach_store(struct device *dev, struct device_attribute *attr, · 12 unmodified lines
382409 vdev->speed = speed;
383410 vdev->ud.sockfd = sockfd;
384411 vdev->ud.tcp_socket = socket;
412+ vdev->ud.tcp_rx = tcp_rx;
413+ vdev->ud.tcp_tx = tcp_tx;
385414 vdev->ud.status = VDEV_ST_NOTASSIGNED;
386415 usbip_kcov_handle_init(&vdev->ud);
387416
@@ -389,8 +418,8 @@ static ssize_t attach_store(struct device *dev, struct device_attribute *attr, · 1 unmodified line
389418 spin_unlock_irqrestore(&vhci->lock, flags);
390419 /* end the lock */
391420
392− vdev->ud.tcp_rx = kthread_get_run(vhci_rx_loop, &vdev->ud, "vhci_rx");
393− vdev->ud.tcp_tx = kthread_get_run(vhci_tx_loop, &vdev->ud, "vhci_tx");
421+ wake_up_process(vdev->ud.tcp_rx);
422+ wake_up_process(vdev->ud.tcp_tx);
394423
395424 rh_port_connect(vdev, speed);
396425
drivers/usb/usbip/vudc_sysfs.c+42−7
@@ -90,8 +90,9 @@ unlock: · 89 unmodified lines
9090 }
9191 static BIN_ATTR_RO(dev_desc, sizeof(struct usb_device_descriptor));
9292
93−static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *attr,
94− const char *in, size_t count)
93+static ssize_t usbip_sockfd_store(struct device *dev,
94+ struct device_attribute *attr,
95+ const char *in, size_t count)
9596 {
9697 struct vudc *udc = (struct vudc *) dev_get_drvdata(dev);
9798 int rv;
@@ -100,6 +101,8 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a · 2 unmodified lines
100101 struct socket *socket;
101102 unsigned long flags;
102103 int ret;
104+ struct task_struct *tcp_rx = NULL;
105+ struct task_struct *tcp_tx = NULL;
103106
104107 rv = kstrtoint(in, 0, &sockfd);
105108 if (rv != 0)
@@ -138,24 +141,54 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a · 32 unmodified lines
138141 goto unlock_ud;
139142 }
140143
141− udc->ud.tcp_socket = socket;
144+ if (socket->type != SOCK_STREAM) {
145+ dev_err(dev, "Expecting SOCK_STREAM - found %d",
146+ socket->type);
147+ ret = -EINVAL;
148+ goto sock_err;
149+ }
142150
151+ /* unlock and create threads and get tasks */
143152 spin_unlock_irq(&udc->ud.lock);
144153 spin_unlock_irqrestore(&udc->lock, flags);
145154
146− udc->ud.tcp_rx = kthread_get_run(&v_rx_loop,
147− &udc->ud, "vudc_rx");
148− udc->ud.tcp_tx = kthread_get_run(&v_tx_loop,
149− &udc->ud, "vudc_tx");
155+ tcp_rx = kthread_create(&v_rx_loop, &udc->ud, "vudc_rx");
156+ if (IS_ERR(tcp_rx)) {
157+ sockfd_put(socket);
158+ return -EINVAL;
159+ }
160+ tcp_tx = kthread_create(&v_tx_loop, &udc->ud, "vudc_tx");
161+ if (IS_ERR(tcp_tx)) {
162+ kthread_stop(tcp_rx);
163+ sockfd_put(socket);
164+ return -EINVAL;
165+ }
166+
167+ /* get task structs now */
168+ get_task_struct(tcp_rx);
169+ get_task_struct(tcp_tx);
150170
171+ /* lock and update udc->ud state */
151172 spin_lock_irqsave(&udc->lock, flags);
152173 spin_lock_irq(&udc->ud.lock);
174+
175+ udc->ud.tcp_socket = socket;
176+ udc->ud.tcp_rx = tcp_rx;
177+ udc->ud.tcp_rx = tcp_tx;
153178 udc->ud.status = SDEV_ST_USED;
179+
154180 spin_unlock_irq(&udc->ud.lock);
155181
156182 ktime_get_ts64(&udc->start_time);
157183 v_start_timer(udc);
158184 udc->connected = 1;
185+
186+ spin_unlock_irqrestore(&udc->lock, flags);
187+
188+ wake_up_process(udc->ud.tcp_rx);
189+ wake_up_process(udc->ud.tcp_tx);
190+ return count;
191+
159192 } else {
160193 if (!udc->connected) {
161194 dev_err(dev, "Device not connected");
@@ -177,6 +210,8 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a · 15 unmodified lines
177210
178211 return count;
179212
213+sock_err:
214+ sockfd_put(socket);
180215 unlock_ud:
181216 spin_unlock_irq(&udc->ud.lock);
182217 unlock:
drivers/video/fbdev/aty/atyfb.h+0−3
@@ -287,11 +287,8 @@ static inline void aty_st_8(int regindex, u8 val, const struct atyfb_par *par) · 286 unmodified lines
287287 #endif
288288 }
289289
290−#if defined(CONFIG_PMAC_BACKLIGHT) || defined (CONFIG_FB_ATY_GENERIC_LCD) || \
291−defined (CONFIG_FB_ATY_BACKLIGHT)
292290 extern void aty_st_lcd(int index, u32 val, const struct atyfb_par *par);
293291 extern u32 aty_ld_lcd(int index, const struct atyfb_par *par);
294−#endif
295292
296293 /*
297294 * DAC operations
drivers/video/fbdev/aty/atyfb_base.c+5−4
@@ -133,7 +133,7 @@ · 132 unmodified lines
133133 #define PRINTKE(fmt, args...) printk(KERN_ERR "atyfb: " fmt, ## args)
134134
135135 #if defined(CONFIG_PMAC_BACKLIGHT) || defined(CONFIG_FB_ATY_GENERIC_LCD) || \
136−defined(CONFIG_FB_ATY_BACKLIGHT)
136+defined(CONFIG_FB_ATY_BACKLIGHT) || defined (CONFIG_PPC_PMAC)
137137 static const u32 lt_lcd_regs[] = {
138138 CNFG_PANEL_LG,
139139 LCD_GEN_CNTL_LG,
@@ -175,8 +175,8 @@ u32 aty_ld_lcd(int index, const struct atyfb_par *par) · 35 unmodified lines
175175 return aty_ld_le32(LCD_DATA, par);
176176 }
177177 }
178−#else /* defined(CONFIG_PMAC_BACKLIGHT) || defined(CONFIG_FB_ATY_BACKLIGHT) \
179− defined(CONFIG_FB_ATY_GENERIC_LCD) */
178+#else /* defined(CONFIG_PMAC_BACKLIGHT) || defined(CONFIG_FB_ATY_BACKLIGHT) ||
179+ defined(CONFIG_FB_ATY_GENERIC_LCD) || defined(CONFIG_PPC_PMAC) */
180180 void aty_st_lcd(int index, u32 val, const struct atyfb_par *par)
181181 { }
182182
@@ -184,7 +184,8 @@ u32 aty_ld_lcd(int index, const struct atyfb_par *par) · 1 unmodified line
184184 {
185185 return 0;
186186 }
187−#endif /* defined(CONFIG_PMAC_BACKLIGHT) || defined (CONFIG_FB_ATY_GENERIC_LCD) */
187+#endif /* defined(CONFIG_PMAC_BACKLIGHT) || defined(CONFIG_FB_ATY_BACKLIGHT) ||
188+ defined (CONFIG_FB_ATY_GENERIC_LCD) || defined(CONFIG_PPC_PMAC) */
188189
189190 #ifdef CONFIG_FB_ATY_GENERIC_LCD
190191 /*
drivers/virt/acrn/hsm.c+10−1
@@ -333,7 +333,7 @@ static long acrn_dev_ioctl(struct file *filp, unsigned int cmd, · 332 unmodified lines
333333 acrn_ioreq_request_clear(vm);
334334 break;
335335 case ACRN_IOCTL_PM_GET_CPU_STATE:
336− if (copy_from_user(&cstate_cmd, (void *)ioctl_param,
336+ if (copy_from_user(&cstate_cmd, (void __user *)ioctl_param,
337337 sizeof(cstate_cmd)))
338338 return -EFAULT;
339339
@@ -404,6 +404,14 @@ fail_remove: · 64 unmodified lines
404404 }
405405 static DEVICE_ATTR_WO(remove_cpu);
406406
407+static umode_t acrn_attr_visible(struct kobject *kobj, struct attribute *a, int n)
408+{
409+ if (a == &dev_attr_remove_cpu.attr)
410+ return IS_ENABLED(CONFIG_HOTPLUG_CPU) ? a->mode : 0;
411+
412+ return a->mode;
413+}
414+
407415 static struct attribute *acrn_attrs[] = {
408416 &dev_attr_remove_cpu.attr,
409417 NULL
@@ -411,6 +419,7 @@ static struct attribute *acrn_attrs[] = { · 1 unmodified line
411419
412420 static struct attribute_group acrn_attr_group = {
413421 .attrs = acrn_attrs,
422+ .is_visible = acrn_attr_visible,
414423 };
415424
416425 static const struct attribute_group *acrn_attr_groups[] = {
drivers/virt/acrn/irqfd.c+3−3
@@ -112,7 +112,7 @@ static int acrn_irqfd_assign(struct acrn_vm *vm, struct acrn_irqfd *args) · 111 unmodified lines
112112 {
113113 struct eventfd_ctx *eventfd = NULL;
114114 struct hsm_irqfd *irqfd, *tmp;
115− unsigned int events;
115+ __poll_t events;
116116 struct fd f;
117117 int ret = 0;
118118
@@ -158,9 +158,9 @@ static int acrn_irqfd_assign(struct acrn_vm *vm, struct acrn_irqfd *args) · 39 unmodified lines
158158 mutex_unlock(&vm->irqfds_lock);
159159
160160 /* Check the pending event in this stage */
161− events = f.file->f_op->poll(f.file, &irqfd->pt);
161+ events = vfs_poll(f.file, &irqfd->pt);
162162
163− if (events & POLLIN)
163+ if (events & EPOLLIN)
164164 acrn_irqfd_inject(irqfd);
165165
166166 fdput(f);
drivers/xen/events/events_2l.c+15−7
@@ -47,6 +47,11 @@ static unsigned evtchn_2l_max_channels(void) · 46 unmodified lines
4747 return EVTCHN_2L_NR_CHANNELS;
4848 }
4949
50+static void evtchn_2l_remove(evtchn_port_t evtchn, unsigned int cpu)
51+{
52+ clear_bit(evtchn, BM(per_cpu(cpu_evtchn_mask, cpu)));
53+}
54+
5055 static void evtchn_2l_bind_to_cpu(evtchn_port_t evtchn, unsigned int cpu,
5156 unsigned int old_cpu)
5257 {
@@ -72,12 +77,6 @@ static bool evtchn_2l_is_pending(evtchn_port_t port) · 19 unmodified lines
7277 return sync_test_bit(port, BM(&s->evtchn_pending[0]));
7378 }
7479
75−static bool evtchn_2l_test_and_set_mask(evtchn_port_t port)
76−{
77− struct shared_info *s = HYPERVISOR_shared_info;
78− return sync_test_and_set_bit(port, BM(&s->evtchn_mask[0]));
79−}
80−
8180 static void evtchn_2l_mask(evtchn_port_t port)
8281 {
8382 struct shared_info *s = HYPERVISOR_shared_info;
@@ -355,18 +354,27 @@ static void evtchn_2l_resume(void) · 271 unmodified lines
355354 EVTCHN_2L_NR_CHANNELS/BITS_PER_EVTCHN_WORD);
356355 }
357356
357+static int evtchn_2l_percpu_deinit(unsigned int cpu)
358+{
359+ memset(per_cpu(cpu_evtchn_mask, cpu), 0, sizeof(xen_ulong_t) *
360+ EVTCHN_2L_NR_CHANNELS/BITS_PER_EVTCHN_WORD);
361+
362+ return 0;
363+}
364+
358365 static const struct evtchn_ops evtchn_ops_2l = {
359366 .max_channels = evtchn_2l_max_channels,
360367 .nr_channels = evtchn_2l_max_channels,
368+ .remove = evtchn_2l_remove,
361369 .bind_to_cpu = evtchn_2l_bind_to_cpu,
362370 .clear_pending = evtchn_2l_clear_pending,
363371 .set_pending = evtchn_2l_set_pending,
364372 .is_pending = evtchn_2l_is_pending,
365− .test_and_set_mask = evtchn_2l_test_and_set_mask,
366373 .mask = evtchn_2l_mask,
367374 .unmask = evtchn_2l_unmask,
368375 .handle_events = evtchn_2l_handle_events,
369376 .resume = evtchn_2l_resume,
377+ .percpu_deinit = evtchn_2l_percpu_deinit,
370378 };
371379
372380 void __init xen_evtchn_2l_init(void)
drivers/xen/events/events_base.c+100−30
@@ -98,13 +98,19 @@ struct irq_info { · 97 unmodified lines
9898 short refcnt;
9999 u8 spurious_cnt;
100100 u8 is_accounted;
101− enum xen_irq_type type; /* type */
101+ short type; /* type: IRQT_* */
102+ u8 mask_reason; /* Why is event channel masked */
103+#define EVT_MASK_REASON_EXPLICIT 0x01
104+#define EVT_MASK_REASON_TEMPORARY 0x02
105+#define EVT_MASK_REASON_EOI_PENDING 0x04
106+ u8 is_active; /* Is event just being handled? */
102107 unsigned irq;
103108 evtchn_port_t evtchn; /* event channel */
104109 unsigned short cpu; /* cpu bound */
105110 unsigned short eoi_cpu; /* EOI must happen on this cpu-1 */
106111 unsigned int irq_epoch; /* If eoi_cpu valid: irq_epoch of event */
107112 u64 eoi_time; /* Time in jiffies when to EOI. */
113+ spinlock_t lock;
108114
109115 union {
110116 unsigned short virq;
@@ -154,6 +160,7 @@ static DEFINE_RWLOCK(evtchn_rwlock); · 43 unmodified lines
154160 * evtchn_rwlock
155161 * IRQ-desc lock
156162 * percpu eoi_list_lock
163+ * irq_info->lock
157164 */
158165
159166 static LIST_HEAD(xen_irq_list_head);
@@ -304,6 +311,8 @@ static int xen_irq_info_common_setup(struct irq_info *info, · 144 unmodified lines
304311 info->irq = irq;
305312 info->evtchn = evtchn;
306313 info->cpu = cpu;
314+ info->mask_reason = EVT_MASK_REASON_EXPLICIT;
315+ spin_lock_init(&info->lock);
307316
308317 ret = set_evtchn_to_irq(evtchn, irq);
309318 if (ret < 0)
@@ -377,6 +386,7 @@ static int xen_irq_info_pirq_setup(unsigned irq, · 67 unmodified lines
377386 static void xen_irq_info_cleanup(struct irq_info *info)
378387 {
379388 set_evtchn_to_irq(info->evtchn, -1);
389+ xen_evtchn_port_remove(info->evtchn, info->cpu);
380390 info->evtchn = 0;
381391 channels_on_cpu_dec(info);
382392 }
@@ -458,6 +468,34 @@ unsigned int cpu_from_evtchn(evtchn_port_t evtchn) · 75 unmodified lines
458468 return ret;
459469 }
460470
471+static void do_mask(struct irq_info *info, u8 reason)
472+{
473+ unsigned long flags;
474+
475+ spin_lock_irqsave(&info->lock, flags);
476+
477+ if (!info->mask_reason)
478+ mask_evtchn(info->evtchn);
479+
480+ info->mask_reason |= reason;
481+
482+ spin_unlock_irqrestore(&info->lock, flags);
483+}
484+
485+static void do_unmask(struct irq_info *info, u8 reason)
486+{
487+ unsigned long flags;
488+
489+ spin_lock_irqsave(&info->lock, flags);
490+
491+ info->mask_reason &= ~reason;
492+
493+ if (!info->mask_reason)
494+ unmask_evtchn(info->evtchn);
495+
496+ spin_unlock_irqrestore(&info->lock, flags);
497+}
498+
461499 #ifdef CONFIG_X86
462500 static bool pirq_check_eoi_map(unsigned irq)
463501 {
@@ -604,7 +642,7 @@ static void xen_irq_lateeoi_locked(struct irq_info *info, bool spurious) · 140 unmodified lines
604642 }
605643
606644 info->eoi_time = 0;
607− unmask_evtchn(evtchn);
645+ do_unmask(info, EVT_MASK_REASON_EOI_PENDING);
608646 }
609647
610648 static void xen_irq_lateeoi_worker(struct work_struct *work)
@@ -773,6 +811,12 @@ static void xen_evtchn_close(evtchn_port_t port) · 162 unmodified lines
773811 BUG();
774812 }
775813
814+static void event_handler_exit(struct irq_info *info)
815+{
816+ smp_store_release(&info->is_active, 0);
817+ clear_evtchn(info->evtchn);
818+}
819+
776820 static void pirq_query_unmask(int irq)
777821 {
778822 struct physdev_irq_status_query irq_status;
@@ -791,14 +835,15 @@ static void pirq_query_unmask(int irq) · 12 unmodified lines
791835
792836 static void eoi_pirq(struct irq_data *data)
793837 {
794− evtchn_port_t evtchn = evtchn_from_irq(data->irq);
838+ struct irq_info *info = info_for_irq(data->irq);
839+ evtchn_port_t evtchn = info ? info->evtchn : 0;
795840 struct physdev_eoi eoi = { .irq = pirq_from_irq(data->irq) };
796841 int rc = 0;
797842
798843 if (!VALID_EVTCHN(evtchn))
799844 return;
800845
801− clear_evtchn(evtchn);
846+ event_handler_exit(info);
802847
803848 if (pirq_needs_eoi(data->irq)) {
804849 rc = HYPERVISOR_physdev_op(PHYSDEVOP_eoi, &eoi);
@@ -849,7 +894,8 @@ static unsigned int __startup_pirq(unsigned int irq) · 44 unmodified lines
849894 goto err;
850895
851896 out:
852− unmask_evtchn(evtchn);
897+ do_unmask(info, EVT_MASK_REASON_EXPLICIT);
898+
853899 eoi_pirq(irq_get_irq_data(irq));
854900
855901 return 0;
@@ -876,7 +922,7 @@ static void shutdown_pirq(struct irq_data *data) · 20 unmodified lines
876922 if (!VALID_EVTCHN(evtchn))
877923 return;
878924
879− mask_evtchn(evtchn);
925+ do_mask(info, EVT_MASK_REASON_EXPLICIT);
880926 xen_evtchn_close(evtchn);
881927 xen_irq_info_cleanup(info);
882928 }
@@ -1628,6 +1674,8 @@ void handle_irq_for_port(evtchn_port_t port, struct evtchn_loop_ctrl *ctrl) · 745 unmodified lines
16281674 }
16291675
16301676 info = info_for_irq(irq);
1677+ if (xchg_acquire(&info->is_active, 1))
1678+ return;
16311679
16321680 dev = (info->type == IRQT_EVTCHN) ? info->u.interdomain : NULL;
16331681 if (dev)
@@ -1720,10 +1768,10 @@ void rebind_evtchn_irq(evtchn_port_t evtchn, int irq) · 86 unmodified lines
17201768 }
17211769
17221770 /* Rebind an evtchn so that it gets delivered to a specific cpu */
1723−static int xen_rebind_evtchn_to_cpu(evtchn_port_t evtchn, unsigned int tcpu)
1771+static int xen_rebind_evtchn_to_cpu(struct irq_info *info, unsigned int tcpu)
17241772 {
17251773 struct evtchn_bind_vcpu bind_vcpu;
1726− int masked;
1774+ evtchn_port_t evtchn = info ? info->evtchn : 0;
17271775
17281776 if (!VALID_EVTCHN(evtchn))
17291777 return -1;
@@ -1739,7 +1787,7 @@ static int xen_rebind_evtchn_to_cpu(evtchn_port_t evtchn, unsigned int tcpu) · 9 unmodified lines
17391787 * Mask the event while changing the VCPU binding to prevent
17401788 * it being delivered on an unexpected VCPU.
17411789 */
1742− masked = test_and_set_mask(evtchn);
1790+ do_mask(info, EVT_MASK_REASON_TEMPORARY);
17431791
17441792 /*
17451793 * If this fails, it usually just indicates that we're dealing with a
@@ -1749,8 +1797,7 @@ static int xen_rebind_evtchn_to_cpu(evtchn_port_t evtchn, unsigned int tcpu) · 3 unmodified lines
17491797 if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_vcpu, &bind_vcpu) >= 0)
17501798 bind_evtchn_to_cpu(evtchn, tcpu, false);
17511799
1752− if (!masked)
1753− unmask_evtchn(evtchn);
1800+ do_unmask(info, EVT_MASK_REASON_TEMPORARY);
17541801
17551802 return 0;
17561803 }
@@ -1789,7 +1836,7 @@ static int set_affinity_irq(struct irq_data *data, const struct cpumask *dest, · 32 unmodified lines
17891836 unsigned int tcpu = select_target_cpu(dest);
17901837 int ret;
17911838
1792− ret = xen_rebind_evtchn_to_cpu(evtchn_from_irq(data->irq), tcpu);
1839+ ret = xen_rebind_evtchn_to_cpu(info_for_irq(data->irq), tcpu);
17931840 if (!ret)
17941841 irq_data_update_effective_affinity(data, cpumask_of(tcpu));
17951842
@@ -1798,28 +1845,29 @@ static int set_affinity_irq(struct irq_data *data, const struct cpumask *dest, · 2 unmodified lines
17981845
17991846 static void enable_dynirq(struct irq_data *data)
18001847 {
1801− evtchn_port_t evtchn = evtchn_from_irq(data->irq);
1848+ struct irq_info *info = info_for_irq(data->irq);
1849+ evtchn_port_t evtchn = info ? info->evtchn : 0;
18021850
18031851 if (VALID_EVTCHN(evtchn))
1804− unmask_evtchn(evtchn);
1852+ do_unmask(info, EVT_MASK_REASON_EXPLICIT);
18051853 }
18061854
18071855 static void disable_dynirq(struct irq_data *data)
18081856 {
1809− evtchn_port_t evtchn = evtchn_from_irq(data->irq);
1857+ struct irq_info *info = info_for_irq(data->irq);
1858+ evtchn_port_t evtchn = info ? info->evtchn : 0;
18101859
18111860 if (VALID_EVTCHN(evtchn))
1812− mask_evtchn(evtchn);
1861+ do_mask(info, EVT_MASK_REASON_EXPLICIT);
18131862 }
18141863
18151864 static void ack_dynirq(struct irq_data *data)
18161865 {
1817− evtchn_port_t evtchn = evtchn_from_irq(data->irq);
1866+ struct irq_info *info = info_for_irq(data->irq);
1867+ evtchn_port_t evtchn = info ? info->evtchn : 0;
18181868
1819− if (!VALID_EVTCHN(evtchn))
1820− return;
1821−
1822− clear_evtchn(evtchn);
1869+ if (VALID_EVTCHN(evtchn))
1870+ event_handler_exit(info);
18231871 }
18241872
18251873 static void mask_ack_dynirq(struct irq_data *data)
@@ -1828,18 +1876,39 @@ static void mask_ack_dynirq(struct irq_data *data) · 2 unmodified lines
18281876 ack_dynirq(data);
18291877 }
18301878
1879+static void lateeoi_ack_dynirq(struct irq_data *data)
1880+{
1881+ struct irq_info *info = info_for_irq(data->irq);
1882+ evtchn_port_t evtchn = info ? info->evtchn : 0;
1883+
1884+ if (VALID_EVTCHN(evtchn)) {
1885+ do_mask(info, EVT_MASK_REASON_EOI_PENDING);
1886+ event_handler_exit(info);
1887+ }
1888+}
1889+
1890+static void lateeoi_mask_ack_dynirq(struct irq_data *data)
1891+{
1892+ struct irq_info *info = info_for_irq(data->irq);
1893+ evtchn_port_t evtchn = info ? info->evtchn : 0;
1894+
1895+ if (VALID_EVTCHN(evtchn)) {
1896+ do_mask(info, EVT_MASK_REASON_EXPLICIT);
1897+ event_handler_exit(info);
1898+ }
1899+}
1900+
18311901 static int retrigger_dynirq(struct irq_data *data)
18321902 {
1833− evtchn_port_t evtchn = evtchn_from_irq(data->irq);
1834− int masked;
1903+ struct irq_info *info = info_for_irq(data->irq);
1904+ evtchn_port_t evtchn = info ? info->evtchn : 0;
18351905
18361906 if (!VALID_EVTCHN(evtchn))
18371907 return 0;
18381908
1839− masked = test_and_set_mask(evtchn);
1909+ do_mask(info, EVT_MASK_REASON_TEMPORARY);
18401910 set_evtchn(evtchn);
1841− if (!masked)
1842− unmask_evtchn(evtchn);
1911+ do_unmask(info, EVT_MASK_REASON_TEMPORARY);
18431912
18441913 return 1;
18451914 }
@@ -1938,10 +2007,11 @@ static void restore_cpu_ipis(unsigned int cpu) · 92 unmodified lines
19382007 /* Clear an irq's pending state, in preparation for polling on it */
19392008 void xen_clear_irq_pending(int irq)
19402009 {
1941− evtchn_port_t evtchn = evtchn_from_irq(irq);
2010+ struct irq_info *info = info_for_irq(irq);
2011+ evtchn_port_t evtchn = info ? info->evtchn : 0;
19422012
19432013 if (VALID_EVTCHN(evtchn))
1944− clear_evtchn(evtchn);
2014+ event_handler_exit(info);
19452015 }
19462016 EXPORT_SYMBOL(xen_clear_irq_pending);
19472017 void xen_set_irq_pending(int irq)
@@ -2053,8 +2123,8 @@ static struct irq_chip xen_lateeoi_chip __read_mostly = { · 105 unmodified lines
20532123 .irq_mask = disable_dynirq,
20542124 .irq_unmask = enable_dynirq,
20552125
2056− .irq_ack = mask_ack_dynirq,
2057− .irq_mask_ack = mask_ack_dynirq,
2126+ .irq_ack = lateeoi_ack_dynirq,
2127+ .irq_mask_ack = lateeoi_mask_ack_dynirq,
20582128
20592129 .irq_set_affinity = set_affinity_irq,
20602130 .irq_retrigger = retrigger_dynirq,
drivers/xen/events/events_fifo.c+0−7
@@ -209,12 +209,6 @@ static bool evtchn_fifo_is_pending(evtchn_port_t port) · 208 unmodified lines
209209 return sync_test_bit(EVTCHN_FIFO_BIT(PENDING, word), BM(word));
210210 }
211211
212−static bool evtchn_fifo_test_and_set_mask(evtchn_port_t port)
213−{
214− event_word_t *word = event_word_from_port(port);
215− return sync_test_and_set_bit(EVTCHN_FIFO_BIT(MASKED, word), BM(word));
216−}
217−
218212 static void evtchn_fifo_mask(evtchn_port_t port)
219213 {
220214 event_word_t *word = event_word_from_port(port);
@@ -423,7 +417,6 @@ static const struct evtchn_ops evtchn_ops_fifo = { · 202 unmodified lines
423417 .clear_pending = evtchn_fifo_clear_pending,
424418 .set_pending = evtchn_fifo_set_pending,
425419 .is_pending = evtchn_fifo_is_pending,
426− .test_and_set_mask = evtchn_fifo_test_and_set_mask,
427420 .mask = evtchn_fifo_mask,
428421 .unmask = evtchn_fifo_unmask,
429422 .handle_events = evtchn_fifo_handle_events,
drivers/xen/events/events_internal.h+8−6
@@ -14,13 +14,13 @@ struct evtchn_ops { · 13 unmodified lines
1414 unsigned (*nr_channels)(void);
1515
1616 int (*setup)(evtchn_port_t port);
17+ void (*remove)(evtchn_port_t port, unsigned int cpu);
1718 void (*bind_to_cpu)(evtchn_port_t evtchn, unsigned int cpu,
1819 unsigned int old_cpu);
1920
2021 void (*clear_pending)(evtchn_port_t port);
2122 void (*set_pending)(evtchn_port_t port);
2223 bool (*is_pending)(evtchn_port_t port);
23− bool (*test_and_set_mask)(evtchn_port_t port);
2424 void (*mask)(evtchn_port_t port);
2525 void (*unmask)(evtchn_port_t port);
2626
@@ -54,6 +54,13 @@ static inline int xen_evtchn_port_setup(evtchn_port_t evtchn) · 27 unmodified lines
5454 return 0;
5555 }
5656
57+static inline void xen_evtchn_port_remove(evtchn_port_t evtchn,
58+ unsigned int cpu)
59+{
60+ if (evtchn_ops->remove)
61+ evtchn_ops->remove(evtchn, cpu);
62+}
63+
5764 static inline void xen_evtchn_port_bind_to_cpu(evtchn_port_t evtchn,
5865 unsigned int cpu,
5966 unsigned int old_cpu)
@@ -76,11 +83,6 @@ static inline bool test_evtchn(evtchn_port_t port) · 16 unmodified lines
7683 return evtchn_ops->is_pending(port);
7784 }
7885
79−static inline bool test_and_set_mask(evtchn_port_t port)
80−{
81− return evtchn_ops->test_and_set_mask(port);
82−}
83−
8486 static inline void mask_evtchn(evtchn_port_t port)
8587 {
8688 return evtchn_ops->mask(port);
drivers/xen/gntdev.c+33−21
@@ -133,20 +133,26 @@ struct gntdev_grant_map *gntdev_alloc_map(struct gntdev_priv *priv, int count, · 132 unmodified lines
133133 if (NULL == add)
134134 return NULL;
135135
136− add->grants = kvcalloc(count, sizeof(add->grants[0]), GFP_KERNEL);
137− add->map_ops = kvcalloc(count, sizeof(add->map_ops[0]), GFP_KERNEL);
138− add->unmap_ops = kvcalloc(count, sizeof(add->unmap_ops[0]), GFP_KERNEL);
139− add->kmap_ops = kvcalloc(count, sizeof(add->kmap_ops[0]), GFP_KERNEL);
140− add->kunmap_ops = kvcalloc(count,
141− sizeof(add->kunmap_ops[0]), GFP_KERNEL);
136+ add->grants = kvmalloc_array(count, sizeof(add->grants[0]),
137+ GFP_KERNEL);
138+ add->map_ops = kvmalloc_array(count, sizeof(add->map_ops[0]),
139+ GFP_KERNEL);
140+ add->unmap_ops = kvmalloc_array(count, sizeof(add->unmap_ops[0]),
141+ GFP_KERNEL);
142142 add->pages = kvcalloc(count, sizeof(add->pages[0]), GFP_KERNEL);
143143 if (NULL == add->grants ||
144144 NULL == add->map_ops ||
145145 NULL == add->unmap_ops ||
146− NULL == add->kmap_ops ||
147− NULL == add->kunmap_ops ||
148146 NULL == add->pages)
149147 goto err;
148+ if (use_ptemod) {
149+ add->kmap_ops = kvmalloc_array(count, sizeof(add->kmap_ops[0]),
150+ GFP_KERNEL);
151+ add->kunmap_ops = kvmalloc_array(count, sizeof(add->kunmap_ops[0]),
152+ GFP_KERNEL);
153+ if (NULL == add->kmap_ops || NULL == add->kunmap_ops)
154+ goto err;
155+ }
150156
151157 #ifdef CONFIG_XEN_GRANT_DMA_ALLOC
152158 add->dma_flags = dma_flags;
@@ -183,10 +189,14 @@ struct gntdev_grant_map *gntdev_alloc_map(struct gntdev_priv *priv, int count, · 30 unmodified lines
183189 goto err;
184190
185191 for (i = 0; i < count; i++) {
186− add->map_ops[i].handle = -1;
187− add->unmap_ops[i].handle = -1;
188− add->kmap_ops[i].handle = -1;
189− add->kunmap_ops[i].handle = -1;
192+ add->grants[i].domid = DOMID_INVALID;
193+ add->grants[i].ref = INVALID_GRANT_REF;
194+ add->map_ops[i].handle = INVALID_GRANT_HANDLE;
195+ add->unmap_ops[i].handle = INVALID_GRANT_HANDLE;
196+ if (use_ptemod) {
197+ add->kmap_ops[i].handle = INVALID_GRANT_HANDLE;
198+ add->kunmap_ops[i].handle = INVALID_GRANT_HANDLE;
199+ }
190200 }
191201
192202 add->index = 0;
@@ -274,7 +284,7 @@ static int find_grant_ptes(pte_t *pte, unsigned long addr, void *data) · 81 unmodified lines
274284 map->grants[pgnr].ref,
275285 map->grants[pgnr].domid);
276286 gnttab_set_unmap_op(&map->unmap_ops[pgnr], pte_maddr, flags,
277− -1 /* handle */);
287+ INVALID_GRANT_HANDLE);
278288 return 0;
279289 }
280290
@@ -292,7 +302,7 @@ int gntdev_map_grant_pages(struct gntdev_grant_map *map) · 11 unmodified lines
292302
293303 if (!use_ptemod) {
294304 /* Note: it could already be mapped */
295− if (map->map_ops[0].handle != -1)
305+ if (map->map_ops[0].handle != INVALID_GRANT_HANDLE)
296306 return 0;
297307 for (i = 0; i < map->count; i++) {
298308 unsigned long addr = (unsigned long)
@@ -301,7 +311,7 @@ int gntdev_map_grant_pages(struct gntdev_grant_map *map) · 2 unmodified lines
301311 map->grants[i].ref,
302312 map->grants[i].domid);
303313 gnttab_set_unmap_op(&map->unmap_ops[i], addr,
304− map->flags, -1 /* handle */);
314+ map->flags, INVALID_GRANT_HANDLE);
305315 }
306316 } else {
307317 /*
@@ -327,13 +337,13 @@ int gntdev_map_grant_pages(struct gntdev_grant_map *map) · 19 unmodified lines
327337 map->grants[i].ref,
328338 map->grants[i].domid);
329339 gnttab_set_unmap_op(&map->kunmap_ops[i], address,
330− flags, -1);
340+ flags, INVALID_GRANT_HANDLE);
331341 }
332342 }
333343
334344 pr_debug("map %d+%d\n", map->index, map->count);
335− err = gnttab_map_refs(map->map_ops, use_ptemod ? map->kmap_ops : NULL,
336− map->pages, map->count);
345+ err = gnttab_map_refs(map->map_ops, map->kmap_ops, map->pages,
346+ map->count);
337347
338348 for (i = 0; i < map->count; i++) {
339349 if (map->map_ops[i].status == GNTST_okay)
@@ -385,7 +395,7 @@ static int __unmap_grant_pages(struct gntdev_grant_map *map, int offset, · 45 unmodified lines
385395 pr_debug("unmap handle=%d st=%d\n",
386396 map->unmap_ops[offset+i].handle,
387397 map->unmap_ops[offset+i].status);
388− map->unmap_ops[offset+i].handle = -1;
398+ map->unmap_ops[offset+i].handle = INVALID_GRANT_HANDLE;
389399 }
390400 return err;
391401 }
@@ -401,13 +411,15 @@ static int unmap_grant_pages(struct gntdev_grant_map *map, int offset, · 9 unmodified lines
401411 * already unmapped some of the grants. Only unmap valid ranges.
402412 */
403413 while (pages && !err) {
404− while (pages && map->unmap_ops[offset].handle == -1) {
414+ while (pages &&
415+ map->unmap_ops[offset].handle == INVALID_GRANT_HANDLE) {
405416 offset++;
406417 pages--;
407418 }
408419 range = 0;
409420 while (range < pages) {
410− if (map->unmap_ops[offset+range].handle == -1)
421+ if (map->unmap_ops[offset + range].handle ==
422+ INVALID_GRANT_HANDLE)
411423 break;
412424 range++;
413425 }
fs/Kconfig+1−1
@@ -203,7 +203,7 @@ config TMPFS_XATTR · 202 unmodified lines
203203
204204 config TMPFS_INODE64
205205 bool "Use 64-bit ino_t by default in tmpfs"
206− depends on TMPFS && 64BIT && !(S390 || ALPHA)
206+ depends on TMPFS && 64BIT
207207 default n
208208 help
209209 tmpfs has historically used only inode numbers as wide as an unsigned
fs/afs/dir.c+0−1
@@ -70,7 +70,6 @@ const struct inode_operations afs_dir_inode_operations = { · 69 unmodified lines
7070 .permission = afs_permission,
7171 .getattr = afs_getattr,
7272 .setattr = afs_setattr,
73− .listxattr = afs_listxattr,
7473 };
7574
7675 const struct address_space_operations afs_dir_aops = {
fs/afs/file.c+0−1
@@ -43,7 +43,6 @@ const struct inode_operations afs_file_inode_operations = { · 42 unmodified lines
4343 .getattr = afs_getattr,
4444 .setattr = afs_setattr,
4545 .permission = afs_permission,
46− .listxattr = afs_listxattr,
4746 };
4847
4948 const struct address_space_operations afs_fs_aops = {
fs/afs/fs_operation.c+5−2
@@ -181,10 +181,13 @@ void afs_wait_for_operation(struct afs_operation *op) · 180 unmodified lines
181181 if (test_bit(AFS_SERVER_FL_IS_YFS, &op->server->flags) &&
182182 op->ops->issue_yfs_rpc)
183183 op->ops->issue_yfs_rpc(op);
184− else
184+ else if (op->ops->issue_afs_rpc)
185185 op->ops->issue_afs_rpc(op);
186+ else
187+ op->ac.error = -ENOTSUPP;
186188
187− op->error = afs_wait_for_call_to_complete(op->call, &op->ac);
189+ if (op->call)
190+ op->error = afs_wait_for_call_to_complete(op->call, &op->ac);
188191 }
189192
190193 switch (op->error) {
fs/afs/inode.c+0−1
@@ -27,7 +27,6 @@ · 26 unmodified lines
2727
2828 static const struct inode_operations afs_symlink_inode_operations = {
2929 .get_link = page_get_link,
30− .listxattr = afs_listxattr,
3130 };
3231
3332 static noinline void dump_vnode(struct afs_vnode *vnode, struct afs_vnode *parent_vnode)
fs/afs/internal.h+0−1
@@ -1509,7 +1509,6 @@ extern int afs_launder_page(struct page *); · 1508 unmodified lines
15091509 * xattr.c
15101510 */
15111511 extern const struct xattr_handler *afs_xattr_handlers[];
1512−extern ssize_t afs_listxattr(struct dentry *, char *, size_t);
15131512
15141513 /*
15151514 * yfsclient.c
fs/afs/mntpt.c+0−1
@@ -32,7 +32,6 @@ const struct inode_operations afs_mntpt_inode_operations = { · 31 unmodified lines
3232 .lookup = afs_mntpt_lookup,
3333 .readlink = page_readlink,
3434 .getattr = afs_getattr,
35− .listxattr = afs_listxattr,
3635 };
3736
3837 const struct inode_operations afs_autocell_inode_operations = {
fs/afs/xattr.c+7−24
@@ -11,29 +11,6 @@ · 10 unmodified lines
1111 #include <linux/xattr.h>
1212 #include "internal.h"
1313
14−static const char afs_xattr_list[] =
15− "afs.acl\0"
16− "afs.cell\0"
17− "afs.fid\0"
18− "afs.volume\0"
19− "afs.yfs.acl\0"
20− "afs.yfs.acl_inherited\0"
21− "afs.yfs.acl_num_cleaned\0"
22− "afs.yfs.vol_acl";
23−
24−/*
25− * Retrieve a list of the supported xattrs.
26− */
27−ssize_t afs_listxattr(struct dentry *dentry, char *buffer, size_t size)
28−{
29− if (size == 0)
30− return sizeof(afs_xattr_list);
31− if (size < sizeof(afs_xattr_list))
32− return -ERANGE;
33− memcpy(buffer, afs_xattr_list, sizeof(afs_xattr_list));
34− return sizeof(afs_xattr_list);
35−}
36−
3714 /*
3815 * Deal with the result of a successful fetch ACL operation.
3916 */
@@ -231,6 +208,8 @@ static int afs_xattr_get_yfs(const struct xattr_handler *handler, · 191 unmodified lines
231208 else
232209 ret = -ERANGE;
233210 }
211+ } else if (ret == -ENOTSUPP) {
212+ ret = -ENODATA;
234213 }
235214
236215 error_yacl:
@@ -256,6 +235,7 @@ static int afs_xattr_set_yfs(const struct xattr_handler *handler, · 19 unmodified lines
256235 {
257236 struct afs_operation *op;
258237 struct afs_vnode *vnode = AFS_FS_I(inode);
238+ int ret;
259239
260240 if (flags == XATTR_CREATE ||
261241 strcmp(name, "acl") != 0)
@@ -270,7 +250,10 @@ static int afs_xattr_set_yfs(const struct xattr_handler *handler, · 8 unmodified lines
270250 return afs_put_operation(op);
271251
272252 op->ops = &yfs_store_opaque_acl2_operation;
273− return afs_do_sync_operation(op);
253+ ret = afs_do_sync_operation(op);
254+ if (ret == -ENOTSUPP)
255+ ret = -ENODATA;
256+ return ret;
274257 }
275258
276259 static const struct xattr_handler afs_xattr_yfs_handler = {
fs/binfmt_misc.c+14−15
@@ -649,12 +649,24 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer, · 648 unmodified lines
649649 struct super_block *sb = file_inode(file)->i_sb;
650650 struct dentry *root = sb->s_root, *dentry;
651651 int err = 0;
652+ struct file *f = NULL;
652653
653654 e = create_entry(buffer, count);
654655
655656 if (IS_ERR(e))
656657 return PTR_ERR(e);
657658
659+ if (e->flags & MISC_FMT_OPEN_FILE) {
660+ f = open_exec(e->interpreter);
661+ if (IS_ERR(f)) {
662+ pr_notice("register: failed to install interpreter file %s\n",
663+ e->interpreter);
664+ kfree(e);
665+ return PTR_ERR(f);
666+ }
667+ e->interp_file = f;
668+ }
669+
658670 inode_lock(d_inode(root));
659671 dentry = lookup_one_len(e->name, root, strlen(e->name));
660672 err = PTR_ERR(dentry);
@@ -678,21 +690,6 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer, · 17 unmodified lines
678690 goto out2;
679691 }
680692
681− if (e->flags & MISC_FMT_OPEN_FILE) {
682− struct file *f;
683−
684− f = open_exec(e->interpreter);
685− if (IS_ERR(f)) {
686− err = PTR_ERR(f);
687− pr_notice("register: failed to install interpreter file %s\n", e->interpreter);
688− simple_release_fs(&bm_mnt, &entry_count);
689− iput(inode);
690− inode = NULL;
691− goto out2;
692− }
693− e->interp_file = f;
694− }
695−
696693 e->dentry = dget(dentry);
697694 inode->i_private = e;
698695 inode->i_fop = &bm_entry_operations;
@@ -709,6 +706,8 @@ out: · 10 unmodified lines
709706 inode_unlock(d_inode(root));
710707
711708 if (err) {
709+ if (f)
710+ filp_close(f, NULL);
712711 kfree(e);
713712 return err;
714713 }
fs/block_dev.c+13−4
@@ -118,13 +118,22 @@ int truncate_bdev_range(struct block_device *bdev, fmode_t mode, · 117 unmodified lines
118118 if (!(mode & FMODE_EXCL)) {
119119 int err = bd_prepare_to_claim(bdev, truncate_bdev_range);
120120 if (err)
121− return err;
121+ goto invalidate;
122122 }
123123
124124 truncate_inode_pages_range(bdev->bd_inode->i_mapping, lstart, lend);
125125 if (!(mode & FMODE_EXCL))
126126 bd_abort_claiming(bdev, truncate_bdev_range);
127127 return 0;
128+
129+invalidate:
130+ /*
131+ * Someone else has handle exclusively open. Try invalidating instead.
132+ * The 'end' argument is inclusive so the rounding is safe.
133+ */
134+ return invalidate_inode_pages2_range(bdev->bd_inode->i_mapping,
135+ lstart >> PAGE_SHIFT,
136+ lend >> PAGE_SHIFT);
128137 }
129138
130139 static void set_init_blocksize(struct block_device *bdev)
@@ -423,7 +432,7 @@ static ssize_t __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, · 292 unmodified lines
423432 dio->size += bio->bi_iter.bi_size;
424433 pos += bio->bi_iter.bi_size;
425434
426− nr_pages = bio_iov_vecs_to_alloc(iter, BIO_MAX_PAGES);
435+ nr_pages = bio_iov_vecs_to_alloc(iter, BIO_MAX_VECS);
427436 if (!nr_pages) {
428437 bool polled = false;
429438
@@ -491,8 +500,8 @@ blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter) · 61 unmodified lines
491500 if (!iov_iter_count(iter))
492501 return 0;
493502
494− nr_pages = bio_iov_vecs_to_alloc(iter, BIO_MAX_PAGES + 1);
495− if (is_sync_kiocb(iocb) && nr_pages <= BIO_MAX_PAGES)
503+ nr_pages = bio_iov_vecs_to_alloc(iter, BIO_MAX_VECS + 1);
504+ if (is_sync_kiocb(iocb) && nr_pages <= BIO_MAX_VECS)
496505 return __blkdev_direct_IO_simple(iocb, iter, nr_pages);
497506
498507 return __blkdev_direct_IO(iocb, iter, bio_max_segs(nr_pages));
fs/btrfs/extent_io.c+1−1
@@ -3059,7 +3059,7 @@ struct bio *btrfs_bio_alloc(u64 first_byte) · 3058 unmodified lines
30593059 {
30603060 struct bio *bio;
30613061
3062− bio = bio_alloc_bioset(GFP_NOFS, BIO_MAX_PAGES, &btrfs_bioset);
3062+ bio = bio_alloc_bioset(GFP_NOFS, BIO_MAX_VECS, &btrfs_bioset);
30633063 bio->bi_iter.bi_sector = first_byte >> 9;
30643064 btrfs_io_bio_init(btrfs_io_bio(bio));
30653065 return bio;
fs/btrfs/scrub.c+1−1
@@ -1428,7 +1428,7 @@ static void scrub_recheck_block_on_raid56(struct btrfs_fs_info *fs_info, · 1427 unmodified lines
14281428 if (!first_page->dev->bdev)
14291429 goto out;
14301430
1431− bio = btrfs_io_bio_alloc(BIO_MAX_PAGES);
1431+ bio = btrfs_io_bio_alloc(BIO_MAX_VECS);
14321432 bio_set_dev(bio, first_page->dev->bdev);
14331433
14341434 for (page_num = 0; page_num < sblock->page_count; page_num++) {
fs/cifs/cifs_debug.c+1−1
@@ -207,7 +207,7 @@ static int cifs_debug_files_proc_show(struct seq_file *m, void *v) · 206 unmodified lines
207207 from_kuid(&init_user_ns, cfile->uid),
208208 cfile->dentry);
209209 #ifdef CONFIG_CIFS_DEBUG2
210− seq_printf(m, " 0x%llx\n", cfile->fid.mid);
210+ seq_printf(m, " %llu\n", cfile->fid.mid);
211211 #else
212212 seq_printf(m, "\n");
213213 #endif /* CIFS_DEBUG2 */
fs/cifs/cifsfs.c+1−1
@@ -290,7 +290,7 @@ cifs_statfs(struct dentry *dentry, struct kstatfs *buf) · 289 unmodified lines
290290 rc = server->ops->queryfs(xid, tcon, cifs_sb, buf);
291291
292292 free_xid(xid);
293− return 0;
293+ return rc;
294294 }
295295
296296 static long cifs_fallocate(struct file *file, int mode, loff_t off, loff_t len)
fs/cifs/cifsglob.h+10−9
@@ -257,7 +257,7 @@ struct smb_version_operations { · 256 unmodified lines
257257 /* verify the message */
258258 int (*check_message)(char *, unsigned int, struct TCP_Server_Info *);
259259 bool (*is_oplock_break)(char *, struct TCP_Server_Info *);
260− int (*handle_cancelled_mid)(char *, struct TCP_Server_Info *);
260+ int (*handle_cancelled_mid)(struct mid_q_entry *, struct TCP_Server_Info *);
261261 void (*downgrade_oplock)(struct TCP_Server_Info *server,
262262 struct cifsInodeInfo *cinode, __u32 oplock,
263263 unsigned int epoch, bool *purge_cache);
@@ -1705,16 +1705,17 @@ static inline bool is_retryable_error(int error) · 1441 unmodified lines
17051705 #define CIFS_NO_RSP_BUF 0x040 /* no response buffer required */
17061706
17071707 /* Type of request operation */
1708−#define CIFS_ECHO_OP 0x080 /* echo request */
1709−#define CIFS_OBREAK_OP 0x0100 /* oplock break request */
1710−#define CIFS_NEG_OP 0x0200 /* negotiate request */
1708+#define CIFS_ECHO_OP 0x080 /* echo request */
1709+#define CIFS_OBREAK_OP 0x0100 /* oplock break request */
1710+#define CIFS_NEG_OP 0x0200 /* negotiate request */
1711+#define CIFS_CP_CREATE_CLOSE_OP 0x0400 /* compound create+close request */
17111712 /* Lower bitmask values are reserved by others below. */
1712−#define CIFS_SESS_OP 0x2000 /* session setup request */
1713−#define CIFS_OP_MASK 0x2380 /* mask request type */
1713+#define CIFS_SESS_OP 0x2000 /* session setup request */
1714+#define CIFS_OP_MASK 0x2780 /* mask request type */
17141715
1715−#define CIFS_HAS_CREDITS 0x0400 /* already has credits */
1716−#define CIFS_TRANSFORM_REQ 0x0800 /* transform request before sending */
1717−#define CIFS_NO_SRV_RSP 0x1000 /* there is no server response */
1716+#define CIFS_HAS_CREDITS 0x0400 /* already has credits */
1717+#define CIFS_TRANSFORM_REQ 0x0800 /* transform request before sending */
1718+#define CIFS_NO_SRV_RSP 0x1000 /* there is no server response */
17181719
17191720 /* Security Flags: indicate type of session setup needed */
17201721 #define CIFSSEC_MAY_SIGN 0x00001
fs/cifs/connect.c+7−7
@@ -741,7 +741,7 @@ static void clean_demultiplex_info(struct TCP_Server_Info *server) · 740 unmodified lines
741741 spin_lock(&GlobalMid_Lock);
742742 list_for_each_safe(tmp, tmp2, &server->pending_mid_q) {
743743 mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
744− cifs_dbg(FYI, "Clearing mid 0x%llx\n", mid_entry->mid);
744+ cifs_dbg(FYI, "Clearing mid %llu\n", mid_entry->mid);
745745 kref_get(&mid_entry->refcount);
746746 mid_entry->mid_state = MID_SHUTDOWN;
747747 list_move(&mid_entry->qhead, &dispose_list);
@@ -752,7 +752,7 @@ static void clean_demultiplex_info(struct TCP_Server_Info *server) · 4 unmodified lines
752752 /* now walk dispose list and issue callbacks */
753753 list_for_each_safe(tmp, tmp2, &dispose_list) {
754754 mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
755− cifs_dbg(FYI, "Callback mid 0x%llx\n", mid_entry->mid);
755+ cifs_dbg(FYI, "Callback mid %llu\n", mid_entry->mid);
756756 list_del_init(&mid_entry->qhead);
757757 mid_entry->callback(mid_entry);
758758 cifs_mid_q_entry_release(mid_entry);
@@ -1429,6 +1429,11 @@ smbd_connected: · 670 unmodified lines
14291429 tcp_ses->min_offload = ctx->min_offload;
14301430 tcp_ses->tcpStatus = CifsNeedNegotiate;
14311431
1432+ if ((ctx->max_credits < 20) || (ctx->max_credits > 60000))
1433+ tcp_ses->max_credits = SMB2_MAX_CREDITS_AVAILABLE;
1434+ else
1435+ tcp_ses->max_credits = ctx->max_credits;
1436+
14321437 tcp_ses->nr_targets = 1;
14331438 tcp_ses->ignore_signature = ctx->ignore_signature;
14341439 /* thread spawned, put it on the list */
@@ -2832,11 +2837,6 @@ static int mount_get_conns(struct smb3_fs_context *ctx, struct cifs_sb_info *cif · 1397 unmodified lines
28322837
28332838 *nserver = server;
28342839
2835− if ((ctx->max_credits < 20) || (ctx->max_credits > 60000))
2836− server->max_credits = SMB2_MAX_CREDITS_AVAILABLE;
2837− else
2838− server->max_credits = ctx->max_credits;
2839−
28402840 /* get a reference to a SMB session */
28412841 ses = cifs_get_smb_ses(server, ctx);
28422842 if (IS_ERR(ses)) {
fs/cifs/sess.c+1−0
@@ -230,6 +230,7 @@ cifs_ses_add_channel(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses, · 229 unmodified lines
230230 ctx.noautotune = ses->server->noautotune;
231231 ctx.sockopt_tcp_nodelay = ses->server->tcp_nodelay;
232232 ctx.echo_interval = ses->server->echo_interval / HZ;
233+ ctx.max_credits = ses->server->max_credits;
233234
234235 /*
235236 * This will be used for encoding/decoding user/domain/pw
fs/cifs/smb2inode.c+1−0
@@ -358,6 +358,7 @@ smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon, · 357 unmodified lines
358358 if (cfile)
359359 goto after_close;
360360 /* Close */
361+ flags |= CIFS_CP_CREATE_CLOSE_OP;
361362 rqst[num_rqst].rq_iov = &vars->close_iov[0];
362363 rqst[num_rqst].rq_nvec = 1;
363364 rc = SMB2_close_init(tcon, server,
fs/cifs/smb2misc.c+5−5
@@ -767,7 +767,7 @@ smb2_cancelled_close_fid(struct work_struct *work) · 766 unmodified lines
767767 int rc;
768768
769769 if (cancelled->mid)
770− cifs_tcon_dbg(VFS, "Close unmatched open for MID:%llx\n",
770+ cifs_tcon_dbg(VFS, "Close unmatched open for MID:%llu\n",
771771 cancelled->mid);
772772 else
773773 cifs_tcon_dbg(VFS, "Close interrupted close\n");
@@ -844,14 +844,14 @@ smb2_handle_cancelled_close(struct cifs_tcon *tcon, __u64 persistent_fid, · 70 unmodified lines
844844 }
845845
846846 int
847−smb2_handle_cancelled_mid(char *buffer, struct TCP_Server_Info *server)
847+smb2_handle_cancelled_mid(struct mid_q_entry *mid, struct TCP_Server_Info *server)
848848 {
849− struct smb2_sync_hdr *sync_hdr = (struct smb2_sync_hdr *)buffer;
850− struct smb2_create_rsp *rsp = (struct smb2_create_rsp *)buffer;
849+ struct smb2_sync_hdr *sync_hdr = mid->resp_buf;
850+ struct smb2_create_rsp *rsp = mid->resp_buf;
851851 struct cifs_tcon *tcon;
852852 int rc;
853853
854− if (sync_hdr->Command != SMB2_CREATE ||
854+ if ((mid->optype & CIFS_CP_CREATE_CLOSE_OP) || sync_hdr->Command != SMB2_CREATE ||
855855 sync_hdr->Status != STATUS_SUCCESS)
856856 return 0;
857857
fs/cifs/smb2ops.c+5−5
@@ -1195,7 +1195,7 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon, · 1194 unmodified lines
11951195 struct TCP_Server_Info *server = cifs_pick_channel(ses);
11961196 __le16 *utf16_path = NULL;
11971197 int ea_name_len = strlen(ea_name);
1198− int flags = 0;
1198+ int flags = CIFS_CP_CREATE_CLOSE_OP;
11991199 int len;
12001200 struct smb_rqst rqst[3];
12011201 int resp_buftype[3];
@@ -1573,7 +1573,7 @@ smb2_ioctl_query_info(const unsigned int xid, · 371 unmodified lines
15731573 struct smb_query_info qi;
15741574 struct smb_query_info __user *pqi;
15751575 int rc = 0;
1576− int flags = 0;
1576+ int flags = CIFS_CP_CREATE_CLOSE_OP;
15771577 struct smb2_query_info_rsp *qi_rsp = NULL;
15781578 struct smb2_ioctl_rsp *io_rsp = NULL;
15791579 void *buffer = NULL;
@@ -2577,7 +2577,7 @@ smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon, · 997 unmodified lines
25772577 {
25782578 struct cifs_ses *ses = tcon->ses;
25792579 struct TCP_Server_Info *server = cifs_pick_channel(ses);
2580− int flags = 0;
2580+ int flags = CIFS_CP_CREATE_CLOSE_OP;
25812581 struct smb_rqst rqst[3];
25822582 int resp_buftype[3];
25832583 struct kvec rsp_iov[3];
@@ -2975,7 +2975,7 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon, · 391 unmodified lines
29752975 unsigned int sub_offset;
29762976 unsigned int print_len;
29772977 unsigned int print_offset;
2978− int flags = 0;
2978+ int flags = CIFS_CP_CREATE_CLOSE_OP;
29792979 struct smb_rqst rqst[3];
29802980 int resp_buftype[3];
29812981 struct kvec rsp_iov[3];
@@ -3157,7 +3157,7 @@ smb2_query_reparse_tag(const unsigned int xid, struct cifs_tcon *tcon, · 175 unmodified lines
31573157 struct cifs_open_parms oparms;
31583158 struct cifs_fid fid;
31593159 struct TCP_Server_Info *server = cifs_pick_channel(tcon->ses);
3160− int flags = 0;
3160+ int flags = CIFS_CP_CREATE_CLOSE_OP;
31613161 struct smb_rqst rqst[3];
31623162 int resp_buftype[3];
31633163 struct kvec rsp_iov[3];
fs/cifs/smb2pdu.c+2−4
@@ -4041,8 +4041,7 @@ smb2_async_readv(struct cifs_readdata *rdata) · 4040 unmodified lines
40414041 if (rdata->credits.value > 0) {
40424042 shdr->CreditCharge = cpu_to_le16(DIV_ROUND_UP(rdata->bytes,
40434043 SMB2_MAX_BUFFER_SIZE));
4044− shdr->CreditRequest =
4045− cpu_to_le16(le16_to_cpu(shdr->CreditCharge) + 1);
4044+ shdr->CreditRequest = cpu_to_le16(le16_to_cpu(shdr->CreditCharge) + 8);
40464045
40474046 rc = adjust_credits(server, &rdata->credits, rdata->bytes);
40484047 if (rc)
@@ -4348,8 +4347,7 @@ smb2_async_writev(struct cifs_writedata *wdata, · 299 unmodified lines
43484347 if (wdata->credits.value > 0) {
43494348 shdr->CreditCharge = cpu_to_le16(DIV_ROUND_UP(wdata->bytes,
43504349 SMB2_MAX_BUFFER_SIZE));
4351− shdr->CreditRequest =
4352− cpu_to_le16(le16_to_cpu(shdr->CreditCharge) + 1);
4350+ shdr->CreditRequest = cpu_to_le16(le16_to_cpu(shdr->CreditCharge) + 8);
43534351
43544352 rc = adjust_credits(server, &wdata->credits, wdata->bytes);
43554353 if (rc)
fs/cifs/smb2proto.h+1−2
@@ -246,8 +246,7 @@ extern int SMB2_oplock_break(const unsigned int xid, struct cifs_tcon *tcon, · 245 unmodified lines
246246 extern int smb2_handle_cancelled_close(struct cifs_tcon *tcon,
247247 __u64 persistent_fid,
248248 __u64 volatile_fid);
249−extern int smb2_handle_cancelled_mid(char *buffer,
250− struct TCP_Server_Info *server);
249+extern int smb2_handle_cancelled_mid(struct mid_q_entry *mid, struct TCP_Server_Info *server);
251250 void smb2_cancelled_close_fid(struct work_struct *work);
252251 extern int SMB2_QFS_info(const unsigned int xid, struct cifs_tcon *tcon,
253252 u64 persistent_file_id, u64 volatile_file_id,
fs/cifs/transport.c+2−2
@@ -101,7 +101,7 @@ static void _cifs_mid_q_entry_release(struct kref *refcount) · 100 unmodified lines
101101 if (midEntry->resp_buf && (midEntry->mid_flags & MID_WAIT_CANCELLED) &&
102102 midEntry->mid_state == MID_RESPONSE_RECEIVED &&
103103 server->ops->handle_cancelled_mid)
104− server->ops->handle_cancelled_mid(midEntry->resp_buf, server);
104+ server->ops->handle_cancelled_mid(midEntry, server);
105105
106106 midEntry->mid_state = MID_FREE;
107107 atomic_dec(&midCount);
@@ -1207,7 +1207,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, · 1099 unmodified lines
12071207 }
12081208 if (rc != 0) {
12091209 for (; i < num_rqst; i++) {
1210− cifs_server_dbg(VFS, "Cancelling wait for mid %llu cmd: %d\n",
1210+ cifs_server_dbg(FYI, "Cancelling wait for mid %llu cmd: %d\n",
12111211 midQ[i]->mid, le16_to_cpu(midQ[i]->command));
12121212 send_cancel(server, &rqst[i], midQ[i]);
12131213 spin_lock(&GlobalMid_Lock);
fs/configfs/file.c+2−4
@@ -378,7 +378,7 @@ static int __configfs_open_file(struct inode *inode, struct file *file, int type · 377 unmodified lines
378378
379379 attr = to_attr(dentry);
380380 if (!attr)
381− goto out_put_item;
381+ goto out_free_buffer;
382382
383383 if (type & CONFIGFS_ITEM_BIN_ATTR) {
384384 buffer->bin_attr = to_bin_attr(dentry);
@@ -391,7 +391,7 @@ static int __configfs_open_file(struct inode *inode, struct file *file, int type · 6 unmodified lines
391391 /* Grab the module reference for this attribute if we have one */
392392 error = -ENODEV;
393393 if (!try_module_get(buffer->owner))
394− goto out_put_item;
394+ goto out_free_buffer;
395395
396396 error = -EACCES;
397397 if (!buffer->item->ci_type)
@@ -435,8 +435,6 @@ static int __configfs_open_file(struct inode *inode, struct file *file, int type · 37 unmodified lines
435435
436436 out_put_module:
437437 module_put(buffer->owner);
438−out_put_item:
439− config_item_put(buffer->item);
440438 out_free_buffer:
441439 up_read(&frag->frag_sem);
442440 kfree(buffer);
fs/crypto/bio.c+3−3
@@ -52,7 +52,7 @@ static int fscrypt_zeroout_range_inline_crypt(const struct inode *inode, · 51 unmodified lines
5252 int num_pages = 0;
5353
5454 /* This always succeeds since __GFP_DIRECT_RECLAIM is set. */
55− bio = bio_alloc(GFP_NOFS, BIO_MAX_PAGES);
55+ bio = bio_alloc(GFP_NOFS, BIO_MAX_VECS);
5656
5757 while (len) {
5858 unsigned int blocks_this_page = min(len, blocks_per_page);
@@ -74,7 +74,7 @@ static int fscrypt_zeroout_range_inline_crypt(const struct inode *inode, · 15 unmodified lines
7474 len -= blocks_this_page;
7575 lblk += blocks_this_page;
7676 pblk += blocks_this_page;
77− if (num_pages == BIO_MAX_PAGES || !len ||
77+ if (num_pages == BIO_MAX_VECS || !len ||
7878 !fscrypt_mergeable_bio(bio, inode, lblk)) {
7979 err = submit_bio_wait(bio);
8080 if (err)
@@ -126,7 +126,7 @@ int fscrypt_zeroout_range(const struct inode *inode, pgoff_t lblk, · 45 unmodified lines
126126 return fscrypt_zeroout_range_inline_crypt(inode, lblk, pblk,
127127 len);
128128
129− BUILD_BUG_ON(ARRAY_SIZE(pages) > BIO_MAX_PAGES);
129+ BUILD_BUG_ON(ARRAY_SIZE(pages) > BIO_MAX_VECS);
130130 nr_pages = min_t(unsigned int, ARRAY_SIZE(pages),
131131 (len + blocks_per_page - 1) >> blocks_per_page_bits);
132132
fs/erofs/data.c+11−17
@@ -129,6 +129,7 @@ static inline struct bio *erofs_read_raw_page(struct bio *bio, · 128 unmodified lines
129129 struct page *page,
130130 erofs_off_t *last_block,
131131 unsigned int nblocks,
132+ unsigned int *eblks,
132133 bool ra)
133134 {
134135 struct inode *const inode = mapping->host;
@@ -145,8 +146,7 @@ static inline struct bio *erofs_read_raw_page(struct bio *bio, · 10 unmodified lines
145146
146147 /* note that for readpage case, bio also equals to NULL */
147148 if (bio &&
148− /* not continuous */
149− *last_block + 1 != current_block) {
149+ (*last_block + 1 != current_block || !*eblks)) {
150150 submit_bio_retry:
151151 submit_bio(bio);
152152 bio = NULL;
@@ -216,7 +216,8 @@ submit_bio_retry: · 63 unmodified lines
216216 if (nblocks > DIV_ROUND_UP(map.m_plen, PAGE_SIZE))
217217 nblocks = DIV_ROUND_UP(map.m_plen, PAGE_SIZE);
218218
219− bio = bio_alloc(GFP_NOIO, bio_max_segs(nblocks));
219+ *eblks = bio_max_segs(nblocks);
220+ bio = bio_alloc(GFP_NOIO, *eblks);
220221
221222 bio->bi_end_io = erofs_readendio;
222223 bio_set_dev(bio, sb->s_bdev);
@@ -229,16 +230,8 @@ submit_bio_retry: · 6 unmodified lines
229230 /* out of the extent or bio is full */
230231 if (err < PAGE_SIZE)
231232 goto submit_bio_retry;
232−
233+ --*eblks;
233234 *last_block = current_block;
234−
235− /* shift in advance in case of it followed by too many gaps */
236− if (bio->bi_iter.bi_size >= bio->bi_max_vecs * PAGE_SIZE) {
237− /* err should reassign to 0 after submitting */
238− err = 0;
239− goto submit_bio_out;
240− }
241−
242235 return bio;
243236
244237 err_out:
@@ -252,7 +245,6 @@ has_updated: · 7 unmodified lines
252245
253246 /* if updated manually, continuous pages has a gap */
254247 if (bio)
255−submit_bio_out:
256248 submit_bio(bio);
257249 return err ? ERR_PTR(err) : NULL;
258250 }
@@ -264,23 +256,26 @@ submit_bio_out: · 5 unmodified lines
264256 static int erofs_raw_access_readpage(struct file *file, struct page *page)
265257 {
266258 erofs_off_t last_block;
259+ unsigned int eblks;
267260 struct bio *bio;
268261
269262 trace_erofs_readpage(page, true);
270263
271264 bio = erofs_read_raw_page(NULL, page->mapping,
272− page, &last_block, 1, false);
265+ page, &last_block, 1, &eblks, false);
273266
274267 if (IS_ERR(bio))
275268 return PTR_ERR(bio);
276269
277− DBG_BUGON(bio); /* since we have only one bio -- must be NULL */
270+ if (bio)
271+ submit_bio(bio);
278272 return 0;
279273 }
280274
281275 static void erofs_raw_access_readahead(struct readahead_control *rac)
282276 {
283277 erofs_off_t last_block;
278+ unsigned int eblks;
284279 struct bio *bio = NULL;
285280 struct page *page;
286281
@@ -291,7 +286,7 @@ static void erofs_raw_access_readahead(struct readahead_control *rac) · 4 unmodified lines
291286 prefetchw(&page->flags);
292287
293288 bio = erofs_read_raw_page(bio, rac->mapping, page, &last_block,
294− readahead_count(rac), true);
289+ readahead_count(rac), &eblks, true);
295290
296291 /* all the page errors are ignored when readahead */
297292 if (IS_ERR(bio)) {
@@ -305,7 +300,6 @@ static void erofs_raw_access_readahead(struct readahead_control *rac) · 7 unmodified lines
305300 put_page(page);
306301 }
307302
308− /* the rare case (end in gaps) */
309303 if (bio)
310304 submit_bio(bio);
311305 }
fs/erofs/zdata.c+1−1
@@ -1235,7 +1235,7 @@ submit_bio_retry: · 1234 unmodified lines
12351235 }
12361236
12371237 if (!bio) {
1238− bio = bio_alloc(GFP_NOIO, BIO_MAX_PAGES);
1238+ bio = bio_alloc(GFP_NOIO, BIO_MAX_VECS);
12391239
12401240 bio->bi_end_io = z_erofs_decompressqueue_endio;
12411241 bio_set_dev(bio, sb->s_bdev);
fs/ext4/page-io.c+1−1
@@ -398,7 +398,7 @@ static void io_submit_init_bio(struct ext4_io_submit *io, · 397 unmodified lines
398398 * bio_alloc will _always_ be able to allocate a bio if
399399 * __GFP_DIRECT_RECLAIM is set, see comments for bio_alloc_bioset().
400400 */
401− bio = bio_alloc(GFP_NOIO, BIO_MAX_PAGES);
401+ bio = bio_alloc(GFP_NOIO, BIO_MAX_VECS);
402402 fscrypt_set_bio_crypt_ctx_bh(bio, bh, GFP_NOIO);
403403 bio->bi_iter.bi_sector = bh->b_blocknr * (bh->b_size >> 9);
404404 bio_set_dev(bio, bh->b_bdev);
fs/f2fs/checkpoint.c+1−1
@@ -292,7 +292,7 @@ void f2fs_ra_meta_pages_cond(struct f2fs_sb_info *sbi, pgoff_t index) · 291 unmodified lines
292292 f2fs_put_page(page, 0);
293293
294294 if (readahead)
295− f2fs_ra_meta_pages(sbi, index, BIO_MAX_PAGES, META_POR, true);
295+ f2fs_ra_meta_pages(sbi, index, BIO_MAX_VECS, META_POR, true);
296296 }
297297
298298 static int __f2fs_write_meta_page(struct page *page,
fs/f2fs/data.c+2−2
@@ -857,7 +857,7 @@ int f2fs_merge_page_bio(struct f2fs_io_info *fio) · 856 unmodified lines
857857 f2fs_submit_merged_ipu_write(fio->sbi, &bio, NULL);
858858 alloc_new:
859859 if (!bio) {
860− bio = __bio_alloc(fio, BIO_MAX_PAGES);
860+ bio = __bio_alloc(fio, BIO_MAX_VECS);
861861 __attach_io_flag(fio);
862862 f2fs_set_bio_crypt_ctx(bio, fio->page->mapping->host,
863863 fio->page->index, fio, GFP_NOIO);
@@ -932,7 +932,7 @@ alloc_new: · 68 unmodified lines
932932 fio->retry = true;
933933 goto skip;
934934 }
935− io->bio = __bio_alloc(fio, BIO_MAX_PAGES);
935+ io->bio = __bio_alloc(fio, BIO_MAX_VECS);
936936 f2fs_set_bio_crypt_ctx(io->bio, fio->page->mapping->host,
937937 bio_page->index, fio, GFP_NOIO);
938938 io->fio = *fio;
fs/f2fs/segment.c+1−1
@@ -4381,7 +4381,7 @@ static int build_sit_entries(struct f2fs_sb_info *sbi) · 4380 unmodified lines
43814381 block_t total_node_blocks = 0;
43824382
43834383 do {
4384− readed = f2fs_ra_meta_pages(sbi, start_blk, BIO_MAX_PAGES,
4384+ readed = f2fs_ra_meta_pages(sbi, start_blk, BIO_MAX_VECS,
43854385 META_SIT, true);
43864386
43874387 start = start_blk * sit_i->sents_per_block;
fs/f2fs/segment.h+2−2
@@ -851,7 +851,7 @@ static inline int nr_pages_to_skip(struct f2fs_sb_info *sbi, int type) · 850 unmodified lines
851851 else if (type == NODE)
852852 return 8 * sbi->blocks_per_seg;
853853 else if (type == META)
854− return 8 * BIO_MAX_PAGES;
854+ return 8 * BIO_MAX_VECS;
855855 else
856856 return 0;
857857 }
@@ -868,7 +868,7 @@ static inline long nr_pages_to_write(struct f2fs_sb_info *sbi, int type, · 10 unmodified lines
868868 return 0;
869869
870870 nr_to_write = wbc->nr_to_write;
871− desired = BIO_MAX_PAGES;
871+ desired = BIO_MAX_VECS;
872872 if (type == NODE)
873873 desired <<= 1;
874874
fs/f2fs/super.c+2−2
@@ -753,9 +753,9 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount) · 752 unmodified lines
753753 case Opt_io_size_bits:
754754 if (args->from && match_int(args, &arg))
755755 return -EINVAL;
756− if (arg <= 0 || arg > __ilog2_u32(BIO_MAX_PAGES)) {
756+ if (arg <= 0 || arg > __ilog2_u32(BIO_MAX_VECS)) {
757757 f2fs_warn(sbi, "Not support %d, larger than %d",
758− 1 << arg, BIO_MAX_PAGES);
758+ 1 << arg, BIO_MAX_VECS);
759759 return -EINVAL;
760760 }
761761 F2FS_OPTION(sbi).write_io_size_bits = arg;
fs/fuse/dev.c+16−10
@@ -2229,19 +2229,21 @@ static int fuse_device_clone(struct fuse_conn *fc, struct file *new) · 2228 unmodified lines
22292229 static long fuse_dev_ioctl(struct file *file, unsigned int cmd,
22302230 unsigned long arg)
22312231 {
2232− int err = -ENOTTY;
2232+ int res;
2233+ int oldfd;
2234+ struct fuse_dev *fud = NULL;
22332235
2234− if (cmd == FUSE_DEV_IOC_CLONE) {
2235− int oldfd;
2236+ if (_IOC_TYPE(cmd) != FUSE_DEV_IOC_MAGIC)
2237+ return -ENOTTY;
22362238
2237− err = -EFAULT;
2238− if (!get_user(oldfd, (__u32 __user *) arg)) {
2239+ switch (_IOC_NR(cmd)) {
2240+ case _IOC_NR(FUSE_DEV_IOC_CLONE):
2241+ res = -EFAULT;
2242+ if (!get_user(oldfd, (__u32 __user *)arg)) {
22392243 struct file *old = fget(oldfd);
22402244
2241− err = -EINVAL;
2245+ res = -EINVAL;
22422246 if (old) {
2243− struct fuse_dev *fud = NULL;
2244−
22452247 /*
22462248 * Check against file->f_op because CUSE
22472249 * uses the same ioctl handler.
@@ -2252,14 +2254,18 @@ static long fuse_dev_ioctl(struct file *file, unsigned int cmd, · 4 unmodified lines
22522254
22532255 if (fud) {
22542256 mutex_lock(&fuse_mutex);
2255− err = fuse_device_clone(fud->fc, file);
2257+ res = fuse_device_clone(fud->fc, file);
22562258 mutex_unlock(&fuse_mutex);
22572259 }
22582260 fput(old);
22592261 }
22602262 }
2263+ break;
2264+ default:
2265+ res = -ENOTTY;
2266+ break;
22612267 }
2262− return err;
2268+ return res;
22632269 }
22642270
22652271 const struct file_operations fuse_dev_operations = {
fs/fuse/fuse_i.h+1−0
@@ -863,6 +863,7 @@ static inline u64 fuse_get_attr_version(struct fuse_conn *fc) · 862 unmodified lines
863863
864864 static inline void fuse_make_bad(struct inode *inode)
865865 {
866+ remove_inode_hash(inode);
866867 set_bit(FUSE_I_BAD, &get_fuse_inode(inode)->state);
867868 }
868869
fs/fuse/virtio_fs.c+8−1
@@ -1324,8 +1324,15 @@ static int virtio_fs_fill_super(struct super_block *sb, struct fs_context *fsc) · 1323 unmodified lines
13241324
13251325 /* virtiofs allocates and installs its own fuse devices */
13261326 ctx->fudptr = NULL;
1327− if (ctx->dax)
1327+ if (ctx->dax) {
1328+ if (!fs->dax_dev) {
1329+ err = -EINVAL;
1330+ pr_err("virtio-fs: dax can't be enabled as filesystem"
1331+ " device does not support it.\n");
1332+ goto err_free_fuse_devs;
1333+ }
13281334 ctx->dax_dev = fs->dax_dev;
1335+ }
13291336 err = fuse_fill_super_common(sb, ctx);
13301337 if (err < 0)
13311338 goto err_free_fuse_devs;
fs/gfs2/log.c+5−1
@@ -998,12 +998,16 @@ static void trans_drain(struct gfs2_trans *tr) · 997 unmodified lines
998998 while (!list_empty(head)) {
999999 bd = list_first_entry(head, struct gfs2_bufdata, bd_list);
10001000 list_del_init(&bd->bd_list);
1001+ if (!list_empty(&bd->bd_ail_st_list))
1002+ gfs2_remove_from_ail(bd);
10011003 kmem_cache_free(gfs2_bufdata_cachep, bd);
10021004 }
10031005 head = &tr->tr_databuf;
10041006 while (!list_empty(head)) {
10051007 bd = list_first_entry(head, struct gfs2_bufdata, bd_list);
10061008 list_del_init(&bd->bd_list);
1009+ if (!list_empty(&bd->bd_ail_st_list))
1010+ gfs2_remove_from_ail(bd);
10071011 kmem_cache_free(gfs2_bufdata_cachep, bd);
10081012 }
10091013 }
@@ -1032,7 +1036,7 @@ repeat: · 22 unmodified lines
10321036 * Do this check while holding the log_flush_lock to prevent new
10331037 * buffers from being added to the ail via gfs2_pin()
10341038 */
1035− if (gfs2_withdrawn(sdp))
1039+ if (gfs2_withdrawn(sdp) || !test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags))
10361040 goto out;
10371041
10381042 /* Log might have been flushed while we waited for the flush lock */
fs/gfs2/lops.c+1−1
@@ -267,7 +267,7 @@ static struct bio *gfs2_log_alloc_bio(struct gfs2_sbd *sdp, u64 blkno, · 266 unmodified lines
267267 bio_end_io_t *end_io)
268268 {
269269 struct super_block *sb = sdp->sd_vfs;
270− struct bio *bio = bio_alloc(GFP_NOIO, BIO_MAX_PAGES);
270+ struct bio *bio = bio_alloc(GFP_NOIO, BIO_MAX_VECS);
271271
272272 bio->bi_iter.bi_sector = blkno << sdp->sd_fsb2bb_shift;
273273 bio_set_dev(bio, sb->s_bdev);
fs/gfs2/ops_fstype.c+1−3
@@ -1539,9 +1539,7 @@ static int gfs2_reconfigure(struct fs_context *fc) · 1538 unmodified lines
15391539 return -EINVAL;
15401540
15411541 if (fc->sb_flags & SB_RDONLY) {
1542− error = gfs2_make_fs_ro(sdp);
1543− if (error)
1544− errorfc(fc, "unable to remount read-only");
1542+ gfs2_make_fs_ro(sdp);
15451543 } else {
15461544 error = gfs2_make_fs_rw(sdp);
15471545 if (error)
fs/gfs2/super.c+2−8
@@ -587,9 +587,8 @@ out: · 586 unmodified lines
587587 * Returns: errno
588588 */
589589
590−int gfs2_make_fs_ro(struct gfs2_sbd *sdp)
590+void gfs2_make_fs_ro(struct gfs2_sbd *sdp)
591591 {
592− int error = 0;
593592 int log_write_allowed = test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags);
594593
595594 gfs2_flush_delete_work(sdp);
@@ -624,8 +623,6 @@ int gfs2_make_fs_ro(struct gfs2_sbd *sdp) · 28 unmodified lines
624623
625624 if (!log_write_allowed)
626625 sdp->sd_vfs->s_flags |= SB_RDONLY;
627−
628− return error;
629626 }
630627
631628 /**
@@ -637,7 +634,6 @@ int gfs2_make_fs_ro(struct gfs2_sbd *sdp) · 5 unmodified lines
637634 static void gfs2_put_super(struct super_block *sb)
638635 {
639636 struct gfs2_sbd *sdp = sb->s_fs_info;
640− int error;
641637 struct gfs2_jdesc *jd;
642638
643639 /* No more recovery requests */
@@ -658,9 +654,7 @@ restart: · 14 unmodified lines
658654 spin_unlock(&sdp->sd_jindex_spin);
659655
660656 if (!sb_rdonly(sb)) {
661− error = gfs2_make_fs_ro(sdp);
662− if (error)
663− gfs2_io_error(sdp);
657+ gfs2_make_fs_ro(sdp);
664658 }
665659 WARN_ON(gfs2_withdrawing(sdp));
666660
fs/gfs2/super.h+1−1
@@ -34,7 +34,7 @@ extern int gfs2_lookup_in_master_dir(struct gfs2_sbd *sdp, char *filename, · 33 unmodified lines
3434 struct gfs2_inode **ipp);
3535
3636 extern int gfs2_make_fs_rw(struct gfs2_sbd *sdp);
37−extern int gfs2_make_fs_ro(struct gfs2_sbd *sdp);
37+extern void gfs2_make_fs_ro(struct gfs2_sbd *sdp);
3838 extern void gfs2_online_uevent(struct gfs2_sbd *sdp);
3939 extern int gfs2_statfs_init(struct gfs2_sbd *sdp);
4040 extern void gfs2_statfs_change(struct gfs2_sbd *sdp, s64 total, s64 free,
fs/gfs2/trans.c+2−0
@@ -169,6 +169,8 @@ static struct gfs2_bufdata *gfs2_alloc_bufdata(struct gfs2_glock *gl, · 168 unmodified lines
169169 bd->bd_bh = bh;
170170 bd->bd_gl = gl;
171171 INIT_LIST_HEAD(&bd->bd_list);
172+ INIT_LIST_HEAD(&bd->bd_ail_st_list);
173+ INIT_LIST_HEAD(&bd->bd_ail_gl_list);
172174 bh->b_private = bd;
173175 return bd;
174176 }
fs/gfs2/util.c+11−6
@@ -119,17 +119,22 @@ void gfs2_freeze_unlock(struct gfs2_holder *freeze_gh) · 118 unmodified lines
119119 static void signal_our_withdraw(struct gfs2_sbd *sdp)
120120 {
121121 struct gfs2_glock *live_gl = sdp->sd_live_gh.gh_gl;
122− struct inode *inode = sdp->sd_jdesc->jd_inode;
123− struct gfs2_inode *ip = GFS2_I(inode);
124− struct gfs2_glock *i_gl = ip->i_gl;
125− u64 no_formal_ino = ip->i_no_formal_ino;
122+ struct inode *inode;
123+ struct gfs2_inode *ip;
124+ struct gfs2_glock *i_gl;
125+ u64 no_formal_ino;
126126 int log_write_allowed = test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags);
127127 int ret = 0;
128128 int tries;
129129
130− if (test_bit(SDF_NORECOVERY, &sdp->sd_flags))
130+ if (test_bit(SDF_NORECOVERY, &sdp->sd_flags) || !sdp->sd_jdesc)
131131 return;
132132
133+ inode = sdp->sd_jdesc->jd_inode;
134+ ip = GFS2_I(inode);
135+ i_gl = ip->i_gl;
136+ no_formal_ino = ip->i_no_formal_ino;
137+
133138 /* Prevent any glock dq until withdraw recovery is complete */
134139 set_bit(SDF_WITHDRAW_RECOVERY, &sdp->sd_flags);
135140 /*
@@ -156,7 +161,7 @@ static void signal_our_withdraw(struct gfs2_sbd *sdp) · 20 unmodified lines
156161 ret = 0;
157162 }
158163 if (!ret)
159− ret = gfs2_make_fs_ro(sdp);
164+ gfs2_make_fs_ro(sdp);
160165 gfs2_freeze_unlock(&freeze_gh);
161166 }
162167
fs/io-wq.c+12−13
@@ -110,7 +110,6 @@ struct io_wq { · 109 unmodified lines
110110 io_wq_work_fn *do_work;
111111
112112 struct task_struct *manager;
113− struct user_struct *user;
114113
115114 struct io_wq_hash *hash;
116115
@@ -592,7 +591,7 @@ static bool create_io_worker(struct io_wq *wq, struct io_wqe *wqe, int index) · 475 unmodified lines
592591 tsk->pf_io_worker = worker;
593592 worker->task = tsk;
594593 set_cpus_allowed_ptr(tsk, cpumask_of_node(wqe->node));
595− tsk->flags |= PF_NOFREEZE | PF_NO_SETAFFINITY;
594+ tsk->flags |= PF_NO_SETAFFINITY;
596595
597596 raw_spin_lock_irq(&wqe->lock);
598597 hlist_nulls_add_head_rcu(&worker->nulls_node, &wqe->free_list);
@@ -710,7 +709,6 @@ static int io_wq_manager(void *data) · 111 unmodified lines
710709 set_current_state(TASK_INTERRUPTIBLE);
711710 io_wq_check_workers(wq);
712711 schedule_timeout(HZ);
713− try_to_freeze();
714712 if (fatal_signal_pending(current))
715713 set_bit(IO_WQ_BIT_EXIT, &wq->state);
716714 } while (!test_bit(IO_WQ_BIT_EXIT, &wq->state));
@@ -722,9 +720,9 @@ static int io_wq_manager(void *data) · 5 unmodified lines
722720 io_wq_for_each_worker(wq->wqes[node], io_wq_worker_wake, NULL);
723721 rcu_read_unlock();
724722
725− /* we might not ever have created any workers */
726− if (atomic_read(&wq->worker_refs))
727− wait_for_completion(&wq->worker_done);
723+ if (atomic_dec_and_test(&wq->worker_refs))
724+ complete(&wq->worker_done);
725+ wait_for_completion(&wq->worker_done);
728726
729727 spin_lock_irq(&wq->hash->wait.lock);
730728 for_each_node(node)
@@ -774,7 +772,10 @@ static int io_wq_fork_manager(struct io_wq *wq) · 43 unmodified lines
774772 if (wq->manager)
775773 return 0;
776774
777− reinit_completion(&wq->worker_done);
775+ WARN_ON_ONCE(test_bit(IO_WQ_BIT_EXIT, &wq->state));
776+
777+ init_completion(&wq->worker_done);
778+ atomic_set(&wq->worker_refs, 1);
778779 tsk = create_io_thread(io_wq_manager, wq, NUMA_NO_NODE);
779780 if (!IS_ERR(tsk)) {
780781 wq->manager = get_task_struct(tsk);
@@ -782,6 +783,9 @@ static int io_wq_fork_manager(struct io_wq *wq) · 1 unmodified line
782783 return 0;
783784 }
784785
786+ if (atomic_dec_and_test(&wq->worker_refs))
787+ complete(&wq->worker_done);
788+
785789 return PTR_ERR(tsk);
786790 }
787791
@@ -794,8 +798,7 @@ static void io_wqe_enqueue(struct io_wqe *wqe, struct io_wq_work *work) · 6 unmodified lines
794798 /* Can only happen if manager creation fails after exec */
795799 if (io_wq_fork_manager(wqe->wq) ||
796800 test_bit(IO_WQ_BIT_EXIT, &wqe->wq->state)) {
797− work->flags |= IO_WQ_WORK_CANCEL;
798− wqe->wq->do_work(work);
801+ io_run_cancel(work, wqe);
799802 return;
800803 }
801804
@@ -1018,13 +1021,9 @@ struct io_wq *io_wq_create(unsigned bounded, struct io_wq_data *data) · 216 unmodified lines
10181021 init_completion(&wq->exited);
10191022 refcount_set(&wq->refs, 1);
10201023
1021− init_completion(&wq->worker_done);
1022− atomic_set(&wq->worker_refs, 0);
1023−
10241024 ret = io_wq_fork_manager(wq);
10251025 if (!ret)
10261026 return wq;
1027−
10281027 err:
10291028 io_wq_put_hash(data->hash);
10301029 cpuhp_state_remove_instance_nocalls(io_wq_online, &wq->cpuhp_node);
fs/io-wq.h+1−1
@@ -79,8 +79,8 @@ static inline void wq_list_del(struct io_wq_work_list *list, · 78 unmodified lines
7979
8080 struct io_wq_work {
8181 struct io_wq_work_node list;
82+ const struct cred *creds;
8283 unsigned flags;
83− unsigned short personality;
8484 };
8585
8686 static inline struct io_wq_work *wq_next_work(struct io_wq_work *work)
fs/io_uring.c+455−382
@@ -258,12 +258,10 @@ enum { · 257 unmodified lines
258258
259259 struct io_sq_data {
260260 refcount_t refs;
261− struct mutex lock;
261+ struct rw_semaphore rw_lock;
262262
263263 /* ctx's that are using this sqd */
264264 struct list_head ctx_list;
265− struct list_head ctx_new_list;
266− struct mutex ctx_lock;
267265
268266 struct task_struct *thread;
269267 struct wait_queue_head wait;
@@ -271,10 +269,9 @@ struct io_sq_data { · 1 unmodified line
271269 unsigned sq_thread_idle;
272270 int sq_cpu;
273271 pid_t task_pid;
272+ pid_t task_tgid;
274273
275274 unsigned long state;
276− struct completion startup;
277− struct completion parked;
278275 struct completion exited;
279276 };
280277
@@ -336,7 +333,6 @@ struct io_ring_ctx { · 55 unmodified lines
336333 unsigned int drain_next: 1;
337334 unsigned int eventfd_async: 1;
338335 unsigned int restricted: 1;
339− unsigned int sqo_exec: 1;
340336
341337 /*
342338 * Ring buffer of indices into array of io_uring_sqe, which is
@@ -380,6 +376,7 @@ struct io_ring_ctx { · 37 unmodified lines
380376 /* Only used for accounting purposes */
381377 struct mm_struct *mm_account;
382378
379+ const struct cred *sq_creds; /* cred used for __io_sq_thread() */
383380 struct io_sq_data *sq_data; /* if using sq thread polling */
384381
385382 struct wait_queue_head sqo_sq_wait;
@@ -400,7 +397,6 @@ struct io_ring_ctx { · 14 unmodified lines
400397 struct user_struct *user;
401398
402399 struct completion ref_comp;
403− struct completion sq_thread_comp;
404400
405401 #if defined(CONFIG_UNIX)
406402 struct socket *ring_sock;
@@ -408,7 +404,8 @@ struct io_ring_ctx { · 1 unmodified line
408404
409405 struct idr io_buffer_idr;
410406
411− struct idr personality_idr;
407+ struct xarray personalities;
408+ u32 pers_next;
412409
413410 struct {
414411 unsigned cached_cq_tail;
@@ -454,6 +451,7 @@ struct io_ring_ctx { · 39 unmodified lines
454451
455452 /* Keep this last, we don't need it for the fast path */
456453 struct work_struct exit_work;
454+ struct list_head tctx_list;
457455 };
458456
459457 /*
@@ -805,6 +803,12 @@ struct io_kiocb { · 345 unmodified lines
805803 struct io_wq_work work;
806804 };
807805
806+struct io_tctx_node {
807+ struct list_head ctx_node;
808+ struct task_struct *task;
809+ struct io_ring_ctx *ctx;
810+};
811+
808812 struct io_defer_entry {
809813 struct list_head list;
810814 struct io_kiocb *req;
@@ -979,6 +983,8 @@ static const struct io_op_def io_op_defs[] = { · 168 unmodified lines
979983 [IORING_OP_UNLINKAT] = {},
980984 };
981985
986+static bool io_disarm_next(struct io_kiocb *req);
987+static void io_uring_del_task_file(unsigned long index);
982988 static void io_uring_try_cancel_requests(struct io_ring_ctx *ctx,
983989 struct task_struct *task,
984990 struct files_struct *files);
@@ -1129,9 +1135,8 @@ static struct io_ring_ctx *io_ring_ctx_alloc(struct io_uring_params *p) · 144 unmodified lines
11291135 init_waitqueue_head(&ctx->cq_wait);
11301136 INIT_LIST_HEAD(&ctx->cq_overflow_list);
11311137 init_completion(&ctx->ref_comp);
1132− init_completion(&ctx->sq_thread_comp);
11331138 idr_init(&ctx->io_buffer_idr);
1134− idr_init(&ctx->personality_idr);
1139+ xa_init_flags(&ctx->personalities, XA_FLAGS_ALLOC1);
11351140 mutex_init(&ctx->uring_lock);
11361141 init_waitqueue_head(&ctx->wait);
11371142 spin_lock_init(&ctx->completion_lock);
@@ -1144,6 +1149,7 @@ static struct io_ring_ctx *io_ring_ctx_alloc(struct io_uring_params *p) · 6 unmodified lines
11441149 INIT_LIST_HEAD(&ctx->rsrc_ref_list);
11451150 INIT_DELAYED_WORK(&ctx->rsrc_put_work, io_rsrc_put_work);
11461151 init_llist_head(&ctx->rsrc_put_llist);
1152+ INIT_LIST_HEAD(&ctx->tctx_list);
11471153 INIT_LIST_HEAD(&ctx->submit_state.comp.free_list);
11481154 INIT_LIST_HEAD(&ctx->submit_state.comp.locked_free_list);
11491155 return ctx;
@@ -1183,6 +1189,9 @@ static void io_prep_async_work(struct io_kiocb *req) · 33 unmodified lines
11831189 const struct io_op_def *def = &io_op_defs[req->opcode];
11841190 struct io_ring_ctx *ctx = req->ctx;
11851191
1192+ if (!req->work.creds)
1193+ req->work.creds = get_current_cred();
1194+
11861195 if (req->flags & REQ_F_FORCE_ASYNC)
11871196 req->work.flags |= IO_WQ_WORK_CONCURRENT;
11881197
@@ -1514,15 +1523,14 @@ static void io_cqring_fill_event(struct io_kiocb *req, long res) · 325 unmodified lines
15141523 __io_cqring_fill_event(req, res, 0);
15151524 }
15161525
1517−static inline void io_req_complete_post(struct io_kiocb *req, long res,
1518− unsigned int cflags)
1526+static void io_req_complete_post(struct io_kiocb *req, long res,
1527+ unsigned int cflags)
15191528 {
15201529 struct io_ring_ctx *ctx = req->ctx;
15211530 unsigned long flags;
15221531
15231532 spin_lock_irqsave(&ctx->completion_lock, flags);
15241533 __io_cqring_fill_event(req, res, cflags);
1525− io_commit_cqring(ctx);
15261534 /*
15271535 * If we're the last reference to this request, add to our locked
15281536 * free_list cache.
@@ -1530,19 +1538,26 @@ static inline void io_req_complete_post(struct io_kiocb *req, long res, · 1 unmodified line
15301538 if (refcount_dec_and_test(&req->refs)) {
15311539 struct io_comp_state *cs = &ctx->submit_state.comp;
15321540
1541+ if (req->flags & (REQ_F_LINK | REQ_F_HARDLINK)) {
1542+ if (req->flags & (REQ_F_LINK_TIMEOUT | REQ_F_FAIL_LINK))
1543+ io_disarm_next(req);
1544+ if (req->link) {
1545+ io_req_task_queue(req->link);
1546+ req->link = NULL;
1547+ }
1548+ }
15331549 io_dismantle_req(req);
15341550 io_put_task(req->task, 1);
15351551 list_add(&req->compl.list, &cs->locked_free_list);
15361552 cs->locked_free_nr++;
15371553 } else
15381554 req = NULL;
1555+ io_commit_cqring(ctx);
15391556 spin_unlock_irqrestore(&ctx->completion_lock, flags);
1540−
15411557 io_cqring_ev_posted(ctx);
1542− if (req) {
1543− io_queue_next(req);
1558+
1559+ if (req)
15441560 percpu_ref_put(&ctx->refs);
1545− }
15461561 }
15471562
15481563 static void io_req_complete_state(struct io_kiocb *req, long res,
@@ -1648,6 +1663,10 @@ static void io_dismantle_req(struct io_kiocb *req) · 99 unmodified lines
16481663 io_put_file(req, req->file, (req->flags & REQ_F_FIXED_FILE));
16491664 if (req->fixed_rsrc_refs)
16501665 percpu_ref_put(req->fixed_rsrc_refs);
1666+ if (req->work.creds) {
1667+ put_cred(req->work.creds);
1668+ req->work.creds = NULL;
1669+ }
16511670
16521671 if (req->flags & REQ_F_INFLIGHT) {
16531672 struct io_ring_ctx *ctx = req->ctx;
@@ -1690,15 +1709,11 @@ static inline void io_remove_next_linked(struct io_kiocb *req) · 36 unmodified lines
16901709 nxt->link = NULL;
16911710 }
16921711
1693−static void io_kill_linked_timeout(struct io_kiocb *req)
1712+static bool io_kill_linked_timeout(struct io_kiocb *req)
1713+ __must_hold(&req->ctx->completion_lock)
16941714 {
1695− struct io_ring_ctx *ctx = req->ctx;
1696− struct io_kiocb *link;
1715+ struct io_kiocb *link = req->link;
16971716 bool cancelled = false;
1698− unsigned long flags;
1699−
1700− spin_lock_irqsave(&ctx->completion_lock, flags);
1701− link = req->link;
17021717
17031718 /*
17041719 * Can happen if a linked timeout fired and link had been like
@@ -1713,50 +1728,48 @@ static void io_kill_linked_timeout(struct io_kiocb *req) · 8 unmodified lines
17131728 ret = hrtimer_try_to_cancel(&io->timer);
17141729 if (ret != -1) {
17151730 io_cqring_fill_event(link, -ECANCELED);
1716− io_commit_cqring(ctx);
1731+ io_put_req_deferred(link, 1);
17171732 cancelled = true;
17181733 }
17191734 }
17201735 req->flags &= ~REQ_F_LINK_TIMEOUT;
1721− spin_unlock_irqrestore(&ctx->completion_lock, flags);
1722−
1723− if (cancelled) {
1724− io_cqring_ev_posted(ctx);
1725− io_put_req(link);
1726− }
1736+ return cancelled;
17271737 }
17281738
1729−
17301739 static void io_fail_links(struct io_kiocb *req)
1740+ __must_hold(&req->ctx->completion_lock)
17311741 {
1732− struct io_kiocb *link, *nxt;
1733− struct io_ring_ctx *ctx = req->ctx;
1734− unsigned long flags;
1742+ struct io_kiocb *nxt, *link = req->link;
17351743
1736− spin_lock_irqsave(&ctx->completion_lock, flags);
1737− link = req->link;
17381744 req->link = NULL;
1739−
17401745 while (link) {
17411746 nxt = link->link;
17421747 link->link = NULL;
17431748
17441749 trace_io_uring_fail_link(req, link);
17451750 io_cqring_fill_event(link, -ECANCELED);
1746−
17471751 io_put_req_deferred(link, 2);
17481752 link = nxt;
17491753 }
1750− io_commit_cqring(ctx);
1751− spin_unlock_irqrestore(&ctx->completion_lock, flags);
1754+}
17521755
1753− io_cqring_ev_posted(ctx);
1756+static bool io_disarm_next(struct io_kiocb *req)
1757+ __must_hold(&req->ctx->completion_lock)
1758+{
1759+ bool posted = false;
1760+
1761+ if (likely(req->flags & REQ_F_LINK_TIMEOUT))
1762+ posted = io_kill_linked_timeout(req);
1763+ if (unlikely(req->flags & REQ_F_FAIL_LINK)) {
1764+ posted |= (req->link != NULL);
1765+ io_fail_links(req);
1766+ }
1767+ return posted;
17541768 }
17551769
17561770 static struct io_kiocb *__io_req_find_next(struct io_kiocb *req)
17571771 {
1758− if (req->flags & REQ_F_LINK_TIMEOUT)
1759− io_kill_linked_timeout(req);
1772+ struct io_kiocb *nxt;
17601773
17611774 /*
17621775 * If LINK is set, we have dependent requests in this chain. If we
@@ -1764,14 +1777,22 @@ static struct io_kiocb *__io_req_find_next(struct io_kiocb *req) · 1 unmodified line
17641777 * dependencies to the next request. In case of failure, fail the rest
17651778 * of the chain.
17661779 */
1767− if (likely(!(req->flags & REQ_F_FAIL_LINK))) {
1768− struct io_kiocb *nxt = req->link;
1780+ if (req->flags & (REQ_F_LINK_TIMEOUT | REQ_F_FAIL_LINK)) {
1781+ struct io_ring_ctx *ctx = req->ctx;
1782+ unsigned long flags;
1783+ bool posted;
17691784
1770− req->link = NULL;
1771− return nxt;
1785+ spin_lock_irqsave(&ctx->completion_lock, flags);
1786+ posted = io_disarm_next(req);
1787+ if (posted)
1788+ io_commit_cqring(req->ctx);
1789+ spin_unlock_irqrestore(&ctx->completion_lock, flags);
1790+ if (posted)
1791+ io_cqring_ev_posted(ctx);
17721792 }
1773− io_fail_links(req);
1774− return NULL;
1793+ nxt = req->link;
1794+ req->link = NULL;
1795+ return nxt;
17751796 }
17761797
17771798 static inline struct io_kiocb *io_req_find_next(struct io_kiocb *req)
@@ -5559,22 +5580,30 @@ add: · 3781 unmodified lines
55595580 return 0;
55605581 }
55615582
5583+struct io_cancel_data {
5584+ struct io_ring_ctx *ctx;
5585+ u64 user_data;
5586+};
5587+
55625588 static bool io_cancel_cb(struct io_wq_work *work, void *data)
55635589 {
55645590 struct io_kiocb *req = container_of(work, struct io_kiocb, work);
5591+ struct io_cancel_data *cd = data;
55655592
5566− return req->user_data == (unsigned long) data;
5593+ return req->ctx == cd->ctx && req->user_data == cd->user_data;
55675594 }
55685595
5569−static int io_async_cancel_one(struct io_uring_task *tctx, void *sqe_addr)
5596+static int io_async_cancel_one(struct io_uring_task *tctx, u64 user_data,
5597+ struct io_ring_ctx *ctx)
55705598 {
5599+ struct io_cancel_data data = { .ctx = ctx, .user_data = user_data, };
55715600 enum io_wq_cancel cancel_ret;
55725601 int ret = 0;
55735602
5574− if (!tctx->io_wq)
5603+ if (!tctx || !tctx->io_wq)
55755604 return -ENOENT;
55765605
5577− cancel_ret = io_wq_cancel_cb(tctx->io_wq, io_cancel_cb, sqe_addr, false);
5606+ cancel_ret = io_wq_cancel_cb(tctx->io_wq, io_cancel_cb, &data, false);
55785607 switch (cancel_ret) {
55795608 case IO_WQ_CANCEL_OK:
55805609 ret = 0;
@@ -5597,8 +5626,7 @@ static void io_async_find_and_cancel(struct io_ring_ctx *ctx, · 16 unmodified lines
55975626 unsigned long flags;
55985627 int ret;
55995628
5600− ret = io_async_cancel_one(req->task->io_uring,
5601− (void *) (unsigned long) sqe_addr);
5629+ ret = io_async_cancel_one(req->task->io_uring, sqe_addr, ctx);
56025630 if (ret != -ENOENT) {
56035631 spin_lock_irqsave(&ctx->completion_lock, flags);
56045632 goto done;
@@ -5639,8 +5667,47 @@ static int io_async_cancel_prep(struct io_kiocb *req, · 34 unmodified lines
56395667 static int io_async_cancel(struct io_kiocb *req, unsigned int issue_flags)
56405668 {
56415669 struct io_ring_ctx *ctx = req->ctx;
5670+ u64 sqe_addr = req->cancel.addr;
5671+ struct io_tctx_node *node;
5672+ int ret;
5673+
5674+ /* tasks should wait for their io-wq threads, so safe w/o sync */
5675+ ret = io_async_cancel_one(req->task->io_uring, sqe_addr, ctx);
5676+ spin_lock_irq(&ctx->completion_lock);
5677+ if (ret != -ENOENT)
5678+ goto done;
5679+ ret = io_timeout_cancel(ctx, sqe_addr);
5680+ if (ret != -ENOENT)
5681+ goto done;
5682+ ret = io_poll_cancel(ctx, sqe_addr);
5683+ if (ret != -ENOENT)
5684+ goto done;
5685+ spin_unlock_irq(&ctx->completion_lock);
5686+
5687+ /* slow path, try all io-wq's */
5688+ io_ring_submit_lock(ctx, !(issue_flags & IO_URING_F_NONBLOCK));
5689+ ret = -ENOENT;
5690+ list_for_each_entry(node, &ctx->tctx_list, ctx_node) {
5691+ struct io_uring_task *tctx = node->task->io_uring;
5692+
5693+ if (!tctx || !tctx->io_wq)
5694+ continue;
5695+ ret = io_async_cancel_one(tctx, req->cancel.addr, ctx);
5696+ if (ret != -ENOENT)
5697+ break;
5698+ }
5699+ io_ring_submit_unlock(ctx, !(issue_flags & IO_URING_F_NONBLOCK));
56425700
5643− io_async_find_and_cancel(ctx, req, req->cancel.addr, 0);
5701+ spin_lock_irq(&ctx->completion_lock);
5702+done:
5703+ io_cqring_fill_event(req, ret);
5704+ io_commit_cqring(ctx);
5705+ spin_unlock_irq(&ctx->completion_lock);
5706+ io_cqring_ev_posted(ctx);
5707+
5708+ if (ret < 0)
5709+ req_set_fail_links(req);
5710+ io_put_req(req);
56445711 return 0;
56455712 }
56465713
@@ -5916,18 +5983,8 @@ static int io_issue_sqe(struct io_kiocb *req, unsigned int issue_flags) · 269 unmodified lines
59165983 const struct cred *creds = NULL;
59175984 int ret;
59185985
5919− if (req->work.personality) {
5920− const struct cred *new_creds;
5921−
5922− if (!(issue_flags & IO_URING_F_NONBLOCK))
5923− mutex_lock(&ctx->uring_lock);
5924− new_creds = idr_find(&ctx->personality_idr, req->work.personality);
5925− if (!(issue_flags & IO_URING_F_NONBLOCK))
5926− mutex_unlock(&ctx->uring_lock);
5927− if (!new_creds)
5928− return -EINVAL;
5929− creds = override_creds(new_creds);
5930− }
5986+ if (req->work.creds && req->work.creds != current_cred())
5987+ creds = override_creds(req->work.creds);
59315988
59325989 switch (req->opcode) {
59335990 case IORING_OP_NOP:
@@ -6291,7 +6348,7 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req, · 357 unmodified lines
62916348 {
62926349 struct io_submit_state *state;
62936350 unsigned int sqe_flags;
6294− int ret = 0;
6351+ int personality, ret = 0;
62956352
62966353 req->opcode = READ_ONCE(sqe->opcode);
62976354 /* same numerical values with corresponding REQ_F_*, safe to copy */
@@ -6306,6 +6363,9 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req, · 8 unmodified lines
63066363 refcount_set(&req->refs, 2);
63076364 req->task = current;
63086365 req->result = 0;
6366+ req->work.list.next = NULL;
6367+ req->work.creds = NULL;
6368+ req->work.flags = 0;
63096369
63106370 /* enforce forwards compatibility on users */
63116371 if (unlikely(sqe_flags & ~SQE_VALID_FLAGS)) {
@@ -6323,9 +6383,13 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req, · 11 unmodified lines
63236383 !io_op_defs[req->opcode].buffer_select)
63246384 return -EOPNOTSUPP;
63256385
6326− req->work.list.next = NULL;
6327− req->work.flags = 0;
6328− req->work.personality = READ_ONCE(sqe->personality);
6386+ personality = READ_ONCE(sqe->personality);
6387+ if (personality) {
6388+ req->work.creds = xa_load(&ctx->personalities, personality);
6389+ if (!req->work.creds)
6390+ return -EINVAL;
6391+ get_cred(req->work.creds);
6392+ }
63296393 state = &ctx->submit_state;
63306394
63316395 /*
@@ -6587,7 +6651,8 @@ static int __io_sq_thread(struct io_ring_ctx *ctx, bool cap_entries) · 255 unmodified lines
65876651 if (!list_empty(&ctx->iopoll_list))
65886652 io_do_iopoll(ctx, &nr_events, 0);
65896653
6590− if (to_submit && likely(!percpu_ref_is_dying(&ctx->refs)))
6654+ if (to_submit && likely(!percpu_ref_is_dying(&ctx->refs)) &&
6655+ !(ctx->flags & IORING_SETUP_R_DISABLED))
65916656 ret = io_submit_sqes(ctx, to_submit);
65926657 mutex_unlock(&ctx->uring_lock);
65936658 }
@@ -6611,58 +6676,6 @@ static void io_sqd_update_thread_idle(struct io_sq_data *sqd) · 17 unmodified lines
66116676 sqd->sq_thread_idle = sq_thread_idle;
66126677 }
66136678
6614−static void io_sqd_init_new(struct io_sq_data *sqd)
6615−{
6616− struct io_ring_ctx *ctx;
6617−
6618− while (!list_empty(&sqd->ctx_new_list)) {
6619− ctx = list_first_entry(&sqd->ctx_new_list, struct io_ring_ctx, sqd_list);
6620− list_move_tail(&ctx->sqd_list, &sqd->ctx_list);
6621− complete(&ctx->sq_thread_comp);
6622− }
6623−
6624− io_sqd_update_thread_idle(sqd);
6625−}
6626−
6627−static bool io_sq_thread_should_stop(struct io_sq_data *sqd)
6628−{
6629− return test_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state);
6630−}
6631−
6632−static bool io_sq_thread_should_park(struct io_sq_data *sqd)
6633−{
6634− return test_bit(IO_SQ_THREAD_SHOULD_PARK, &sqd->state);
6635−}
6636−
6637−static void io_sq_thread_parkme(struct io_sq_data *sqd)
6638−{
6639− for (;;) {
6640− /*
6641− * TASK_PARKED is a special state; we must serialize against
6642− * possible pending wakeups to avoid store-store collisions on
6643− * task->state.
6644− *
6645− * Such a collision might possibly result in the task state
6646− * changin from TASK_PARKED and us failing the
6647− * wait_task_inactive() in kthread_park().
6648− */
6649− set_special_state(TASK_PARKED);
6650− if (!test_bit(IO_SQ_THREAD_SHOULD_PARK, &sqd->state))
6651− break;
6652−
6653− /*
6654− * Thread is going to call schedule(), do not preempt it,
6655− * or the caller of kthread_park() may spend more time in
6656− * wait_task_inactive().
6657− */
6658− preempt_disable();
6659− complete(&sqd->parked);
6660− schedule_preempt_disabled();
6661− preempt_enable();
6662− }
6663− __set_current_state(TASK_RUNNING);
6664−}
6665−
66666679 static int io_sq_thread(void *data)
66676680 {
66686681 struct io_sq_data *sqd = data;
@@ -6681,31 +6694,32 @@ static int io_sq_thread(void *data) · 12 unmodified lines
66816694 set_cpus_allowed_ptr(current, cpu_online_mask);
66826695 current->flags |= PF_NO_SETAFFINITY;
66836696
6684− wait_for_completion(&sqd->startup);
6697+ down_read(&sqd->rw_lock);
66856698
6686− while (!io_sq_thread_should_stop(sqd)) {
6699+ while (!test_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state)) {
66876700 int ret;
66886701 bool cap_entries, sqt_spin, needs_sched;
66896702
6690− /*
6691− * Any changes to the sqd lists are synchronized through the
6692− * thread parking. This synchronizes the thread vs users,
6693− * the users are synchronized on the sqd->ctx_lock.
6694− */
6695− if (io_sq_thread_should_park(sqd)) {
6696− io_sq_thread_parkme(sqd);
6697− continue;
6698− }
6699− if (unlikely(!list_empty(&sqd->ctx_new_list))) {
6700− io_sqd_init_new(sqd);
6703+ if (test_bit(IO_SQ_THREAD_SHOULD_PARK, &sqd->state)) {
6704+ up_read(&sqd->rw_lock);
6705+ cond_resched();
6706+ down_read(&sqd->rw_lock);
6707+ io_run_task_work();
67016708 timeout = jiffies + sqd->sq_thread_idle;
6709+ continue;
67026710 }
67036711 if (fatal_signal_pending(current))
67046712 break;
67056713 sqt_spin = false;
67066714 cap_entries = !list_is_singular(&sqd->ctx_list);
67076715 list_for_each_entry(ctx, &sqd->ctx_list, sqd_list) {
6716+ const struct cred *creds = NULL;
6717+
6718+ if (ctx->sq_creds != current_cred())
6719+ creds = override_creds(ctx->sq_creds);
67086720 ret = __io_sq_thread(ctx, cap_entries);
6721+ if (creds)
6722+ revert_creds(creds);
67096723 if (!sqt_spin && (ret > 0 || !list_empty(&ctx->iopoll_list)))
67106724 sqt_spin = true;
67116725 }
@@ -6732,12 +6746,13 @@ static int io_sq_thread(void *data) · 20 unmodified lines
67326746 }
67336747 }
67346748
6735− if (needs_sched && !io_sq_thread_should_park(sqd)) {
6749+ if (needs_sched && !test_bit(IO_SQ_THREAD_SHOULD_PARK, &sqd->state)) {
67366750 list_for_each_entry(ctx, &sqd->ctx_list, sqd_list)
67376751 io_ring_set_wakeup_flag(ctx);
67386752
6753+ up_read(&sqd->rw_lock);
67396754 schedule();
6740− try_to_freeze();
6755+ down_read(&sqd->rw_lock);
67416756 list_for_each_entry(ctx, &sqd->ctx_list, sqd_list)
67426757 io_ring_clear_wakeup_flag(ctx);
67436758 }
@@ -6745,32 +6760,23 @@ static int io_sq_thread(void *data) · 1 unmodified line
67456760 finish_wait(&sqd->wait, &wait);
67466761 timeout = jiffies + sqd->sq_thread_idle;
67476762 }
6748−
6749− list_for_each_entry(ctx, &sqd->ctx_list, sqd_list)
6750− io_uring_cancel_sqpoll(ctx);
6751−
6752− io_run_task_work();
6753−
6763+ up_read(&sqd->rw_lock);
6764+ down_write(&sqd->rw_lock);
67546765 /*
6755− * Ensure that we park properly if racing with someone trying to park
6756− * while we're exiting. If we fail to grab the lock, check park and
6757− * park if necessary. The ordering with the park bit and the lock
6758− * ensures that we catch this reliably.
6766+ * someone may have parked and added a cancellation task_work, run
6767+ * it first because we don't want it in io_uring_cancel_sqpoll()
67596768 */
6760− if (!mutex_trylock(&sqd->lock)) {
6761− if (io_sq_thread_should_park(sqd))
6762− io_sq_thread_parkme(sqd);
6763− mutex_lock(&sqd->lock);
6764− }
6769+ io_run_task_work();
67656770
6771+ list_for_each_entry(ctx, &sqd->ctx_list, sqd_list)
6772+ io_uring_cancel_sqpoll(ctx);
67666773 sqd->thread = NULL;
6767− list_for_each_entry(ctx, &sqd->ctx_list, sqd_list) {
6768− ctx->sqo_exec = 1;
6774+ list_for_each_entry(ctx, &sqd->ctx_list, sqd_list)
67696775 io_ring_set_wakeup_flag(ctx);
6770− }
6776+ up_write(&sqd->rw_lock);
67716777
6778+ io_run_task_work();
67726779 complete(&sqd->exited);
6773− mutex_unlock(&sqd->lock);
67746780 do_exit(0);
67756781 }
67766782
@@ -7069,44 +7075,37 @@ static int io_sqe_files_unregister(struct io_ring_ctx *ctx) · 292 unmodified lines
70697075 }
70707076
70717077 static void io_sq_thread_unpark(struct io_sq_data *sqd)
7072− __releases(&sqd->lock)
7078+ __releases(&sqd->rw_lock)
70737079 {
7074− if (sqd->thread == current)
7075− return;
7080+ WARN_ON_ONCE(sqd->thread == current);
7081+
70767082 clear_bit(IO_SQ_THREAD_SHOULD_PARK, &sqd->state);
7077− if (sqd->thread)
7078− wake_up_state(sqd->thread, TASK_PARKED);
7079− mutex_unlock(&sqd->lock);
7083+ up_write(&sqd->rw_lock);
70807084 }
70817085
70827086 static void io_sq_thread_park(struct io_sq_data *sqd)
7083− __acquires(&sqd->lock)
7087+ __acquires(&sqd->rw_lock)
70847088 {
7085− if (sqd->thread == current)
7086− return;
7089+ WARN_ON_ONCE(sqd->thread == current);
7090+
70877091 set_bit(IO_SQ_THREAD_SHOULD_PARK, &sqd->state);
7088− mutex_lock(&sqd->lock);
7089− if (sqd->thread) {
7092+ down_write(&sqd->rw_lock);
7093+ /* set again for consistency, in case concurrent parks are happening */
7094+ set_bit(IO_SQ_THREAD_SHOULD_PARK, &sqd->state);
7095+ if (sqd->thread)
70907096 wake_up_process(sqd->thread);
7091− wait_for_completion(&sqd->parked);
7092− }
70937097 }
70947098
70957099 static void io_sq_thread_stop(struct io_sq_data *sqd)
70967100 {
7097− if (test_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state))
7098− return;
7099− mutex_lock(&sqd->lock);
7100− if (sqd->thread) {
7101− set_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state);
7102− WARN_ON_ONCE(test_bit(IO_SQ_THREAD_SHOULD_PARK, &sqd->state));
7101+ WARN_ON_ONCE(sqd->thread == current);
7102+
7103+ down_write(&sqd->rw_lock);
7104+ set_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state);
7105+ if (sqd->thread)
71037106 wake_up_process(sqd->thread);
7104− mutex_unlock(&sqd->lock);
7105− wait_for_completion(&sqd->exited);
7106− WARN_ON_ONCE(sqd->thread);
7107− } else {
7108− mutex_unlock(&sqd->lock);
7109− }
7107+ up_write(&sqd->rw_lock);
7108+ wait_for_completion(&sqd->exited);
71107109 }
71117110
71127111 static void io_put_sq_data(struct io_sq_data *sqd)
@@ -7122,22 +7121,15 @@ static void io_sq_thread_finish(struct io_ring_ctx *ctx) · 9 unmodified lines
71227121 struct io_sq_data *sqd = ctx->sq_data;
71237122
71247123 if (sqd) {
7125− complete(&sqd->startup);
7126− if (sqd->thread) {
7127− wait_for_completion(&ctx->sq_thread_comp);
7128− io_sq_thread_park(sqd);
7129− }
7130−
7131− mutex_lock(&sqd->ctx_lock);
7132− list_del(&ctx->sqd_list);
7124+ io_sq_thread_park(sqd);
7125+ list_del_init(&ctx->sqd_list);
71337126 io_sqd_update_thread_idle(sqd);
7134− mutex_unlock(&sqd->ctx_lock);
7135−
7136− if (sqd->thread)
7137− io_sq_thread_unpark(sqd);
7127+ io_sq_thread_unpark(sqd);
71387128
71397129 io_put_sq_data(sqd);
71407130 ctx->sq_data = NULL;
7131+ if (ctx->sq_creds)
7132+ put_cred(ctx->sq_creds);
71417133 }
71427134 }
71437135
@@ -7161,18 +7153,32 @@ static struct io_sq_data *io_attach_sq_data(struct io_uring_params *p) · 17 unmodified lines
71617153 fdput(f);
71627154 return ERR_PTR(-EINVAL);
71637155 }
7156+ if (sqd->task_tgid != current->tgid) {
7157+ fdput(f);
7158+ return ERR_PTR(-EPERM);
7159+ }
71647160
71657161 refcount_inc(&sqd->refs);
71667162 fdput(f);
71677163 return sqd;
71687164 }
71697165
7170−static struct io_sq_data *io_get_sq_data(struct io_uring_params *p)
7166+static struct io_sq_data *io_get_sq_data(struct io_uring_params *p,
7167+ bool *attached)
71717168 {
71727169 struct io_sq_data *sqd;
71737170
7174− if (p->flags & IORING_SETUP_ATTACH_WQ)
7175− return io_attach_sq_data(p);
7171+ *attached = false;
7172+ if (p->flags & IORING_SETUP_ATTACH_WQ) {
7173+ sqd = io_attach_sq_data(p);
7174+ if (!IS_ERR(sqd)) {
7175+ *attached = true;
7176+ return sqd;
7177+ }
7178+ /* fall through for EPERM case, setup new sqd/task */
7179+ if (PTR_ERR(sqd) != -EPERM)
7180+ return sqd;
7181+ }
71767182
71777183 sqd = kzalloc(sizeof(*sqd), GFP_KERNEL);
71787184 if (!sqd)
@@ -7180,12 +7186,8 @@ static struct io_sq_data *io_get_sq_data(struct io_uring_params *p) · 1 unmodified line
71807186
71817187 refcount_set(&sqd->refs, 1);
71827188 INIT_LIST_HEAD(&sqd->ctx_list);
7183− INIT_LIST_HEAD(&sqd->ctx_new_list);
7184− mutex_init(&sqd->ctx_lock);
7185− mutex_init(&sqd->lock);
7189+ init_rwsem(&sqd->rw_lock);
71867190 init_waitqueue_head(&sqd->wait);
7187− init_completion(&sqd->startup);
7188− init_completion(&sqd->parked);
71897191 init_completion(&sqd->exited);
71907192 return sqd;
71917193 }
@@ -7802,7 +7804,6 @@ static int io_uring_alloc_task_context(struct task_struct *task, · 610 unmodified lines
78027804 init_waitqueue_head(&tctx->wait);
78037805 tctx->last = NULL;
78047806 atomic_set(&tctx->in_idle, 0);
7805− tctx->sqpoll = false;
78067807 task->io_uring = tctx;
78077808 spin_lock_init(&tctx->task_lock);
78087809 INIT_WQ_LIST(&tctx->task_list);
@@ -7823,26 +7824,6 @@ void __io_uring_free(struct task_struct *tsk) · 14 unmodified lines
78237824 tsk->io_uring = NULL;
78247825 }
78257826
7826−static int io_sq_thread_fork(struct io_sq_data *sqd, struct io_ring_ctx *ctx)
7827−{
7828− struct task_struct *tsk;
7829− int ret;
7830−
7831− clear_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state);
7832− reinit_completion(&sqd->parked);
7833− ctx->sqo_exec = 0;
7834− sqd->task_pid = current->pid;
7835− tsk = create_io_thread(io_sq_thread, sqd, NUMA_NO_NODE);
7836− if (IS_ERR(tsk))
7837− return PTR_ERR(tsk);
7838− ret = io_uring_alloc_task_context(tsk, ctx);
7839− if (ret)
7840− set_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state);
7841− sqd->thread = tsk;
7842− wake_up_new_task(tsk);
7843− return ret;
7844−}
7845−
78467827 static int io_sq_offload_create(struct io_ring_ctx *ctx,
78477828 struct io_uring_params *p)
78487829 {
@@ -7865,39 +7846,51 @@ static int io_sq_offload_create(struct io_ring_ctx *ctx, · 16 unmodified lines
78657846 if (ctx->flags & IORING_SETUP_SQPOLL) {
78667847 struct task_struct *tsk;
78677848 struct io_sq_data *sqd;
7849+ bool attached;
78687850
78697851 ret = -EPERM;
78707852 if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_NICE))
78717853 goto err;
78727854
7873− sqd = io_get_sq_data(p);
7855+ sqd = io_get_sq_data(p, &attached);
78747856 if (IS_ERR(sqd)) {
78757857 ret = PTR_ERR(sqd);
78767858 goto err;
78777859 }
78787860
7861+ ctx->sq_creds = get_current_cred();
78797862 ctx->sq_data = sqd;
7880− io_sq_thread_park(sqd);
7881− mutex_lock(&sqd->ctx_lock);
7882− list_add(&ctx->sqd_list, &sqd->ctx_new_list);
7883− mutex_unlock(&sqd->ctx_lock);
7884− io_sq_thread_unpark(sqd);
7885−
78867863 ctx->sq_thread_idle = msecs_to_jiffies(p->sq_thread_idle);
78877864 if (!ctx->sq_thread_idle)
78887865 ctx->sq_thread_idle = HZ;
78897866
7890− if (sqd->thread)
7867+ ret = 0;
7868+ io_sq_thread_park(sqd);
7869+ /* don't attach to a dying SQPOLL thread, would be racy */
7870+ if (attached && !sqd->thread) {
7871+ ret = -ENXIO;
7872+ } else {
7873+ list_add(&ctx->sqd_list, &sqd->ctx_list);
7874+ io_sqd_update_thread_idle(sqd);
7875+ }
7876+ io_sq_thread_unpark(sqd);
7877+
7878+ if (ret < 0) {
7879+ io_put_sq_data(sqd);
7880+ ctx->sq_data = NULL;
7881+ return ret;
7882+ } else if (attached) {
78917883 return 0;
7884+ }
78927885
78937886 if (p->flags & IORING_SETUP_SQ_AFF) {
78947887 int cpu = p->sq_thread_cpu;
78957888
78967889 ret = -EINVAL;
78977890 if (cpu >= nr_cpu_ids)
7898− goto err;
7891+ goto err_sqpoll;
78997892 if (!cpu_online(cpu))
7900− goto err;
7893+ goto err_sqpoll;
79017894
79027895 sqd->sq_cpu = cpu;
79037896 } else {
@@ -7905,15 +7898,15 @@ static int io_sq_offload_create(struct io_ring_ctx *ctx, · 1 unmodified line
79057898 }
79067899
79077900 sqd->task_pid = current->pid;
7901+ sqd->task_tgid = current->tgid;
79087902 tsk = create_io_thread(io_sq_thread, sqd, NUMA_NO_NODE);
79097903 if (IS_ERR(tsk)) {
79107904 ret = PTR_ERR(tsk);
7911− goto err;
7905+ goto err_sqpoll;
79127906 }
7913− ret = io_uring_alloc_task_context(tsk, ctx);
7914− if (ret)
7915− set_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state);
7907+
79167908 sqd->thread = tsk;
7909+ ret = io_uring_alloc_task_context(tsk, ctx);
79177910 wake_up_new_task(tsk);
79187911 if (ret)
79197912 goto err;
@@ -7927,15 +7920,9 @@ static int io_sq_offload_create(struct io_ring_ctx *ctx, · 7 unmodified lines
79277920 err:
79287921 io_sq_thread_finish(ctx);
79297922 return ret;
7930−}
7931−
7932−static void io_sq_offload_start(struct io_ring_ctx *ctx)
7933−{
7934− struct io_sq_data *sqd = ctx->sq_data;
7935−
7936− ctx->flags &= ~IORING_SETUP_R_DISABLED;
7937− if (ctx->flags & IORING_SETUP_SQPOLL)
7938− complete(&sqd->startup);
7923+err_sqpoll:
7924+ complete(&ctx->sq_data->exited);
7925+ goto err;
79397926 }
79407927
79417928 static inline void __io_unaccount_mem(struct user_struct *user,
@@ -8418,7 +8405,6 @@ static void io_ring_ctx_free(struct io_ring_ctx *ctx) · 476 unmodified lines
84188405 mutex_unlock(&ctx->uring_lock);
84198406 io_eventfd_unregister(ctx);
84208407 io_destroy_buffers(ctx);
8421− idr_destroy(&ctx->personality_idr);
84228408
84238409 #if defined(CONFIG_UNIX)
84248410 if (ctx->ring_sock) {
@@ -8483,7 +8469,7 @@ static int io_unregister_personality(struct io_ring_ctx *ctx, unsigned id) · 58 unmodified lines
84838469 {
84848470 const struct cred *creds;
84858471
8486− creds = idr_remove(&ctx->personality_idr, id);
8472+ creds = xa_erase(&ctx->personalities, id);
84878473 if (creds) {
84888474 put_cred(creds);
84898475 return 0;
@@ -8492,14 +8478,6 @@ static int io_unregister_personality(struct io_ring_ctx *ctx, unsigned id) · 2 unmodified lines
84928478 return -EINVAL;
84938479 }
84948480
8495−static int io_remove_personalities(int id, void *p, void *data)
8496−{
8497− struct io_ring_ctx *ctx = data;
8498−
8499− io_unregister_personality(ctx, id);
8500− return 0;
8501−}
8502−
85038481 static bool io_run_ctx_fallback(struct io_ring_ctx *ctx)
85048482 {
85058483 struct callback_head *work, *next;
@@ -8522,10 +8500,34 @@ static bool io_run_ctx_fallback(struct io_ring_ctx *ctx) · 16 unmodified lines
85228500 return executed;
85238501 }
85248502
8503+struct io_tctx_exit {
8504+ struct callback_head task_work;
8505+ struct completion completion;
8506+ struct io_ring_ctx *ctx;
8507+};
8508+
8509+static void io_tctx_exit_cb(struct callback_head *cb)
8510+{
8511+ struct io_uring_task *tctx = current->io_uring;
8512+ struct io_tctx_exit *work;
8513+
8514+ work = container_of(cb, struct io_tctx_exit, task_work);
8515+ /*
8516+ * When @in_idle, we're in cancellation and it's racy to remove the
8517+ * node. It'll be removed by the end of cancellation, just ignore it.
8518+ */
8519+ if (!atomic_read(&tctx->in_idle))
8520+ io_uring_del_task_file((unsigned long)work->ctx);
8521+ complete(&work->completion);
8522+}
8523+
85258524 static void io_ring_exit_work(struct work_struct *work)
85268525 {
8527− struct io_ring_ctx *ctx = container_of(work, struct io_ring_ctx,
8528− exit_work);
8526+ struct io_ring_ctx *ctx = container_of(work, struct io_ring_ctx, exit_work);
8527+ unsigned long timeout = jiffies + HZ * 60 * 5;
8528+ struct io_tctx_exit exit;
8529+ struct io_tctx_node *node;
8530+ int ret;
85298531
85308532 /*
85318533 * If we're doing polled IO and end up having requests being
@@ -8535,19 +8537,47 @@ static void io_ring_exit_work(struct work_struct *work) · 3 unmodified lines
85358537 */
85368538 do {
85378539 io_uring_try_cancel_requests(ctx, NULL, NULL);
8540+
8541+ WARN_ON_ONCE(time_after(jiffies, timeout));
85388542 } while (!wait_for_completion_timeout(&ctx->ref_comp, HZ/20));
8543+
8544+ mutex_lock(&ctx->uring_lock);
8545+ while (!list_empty(&ctx->tctx_list)) {
8546+ WARN_ON_ONCE(time_after(jiffies, timeout));
8547+
8548+ node = list_first_entry(&ctx->tctx_list, struct io_tctx_node,
8549+ ctx_node);
8550+ exit.ctx = ctx;
8551+ init_completion(&exit.completion);
8552+ init_task_work(&exit.task_work, io_tctx_exit_cb);
8553+ ret = task_work_add(node->task, &exit.task_work, TWA_SIGNAL);
8554+ if (WARN_ON_ONCE(ret))
8555+ continue;
8556+ wake_up_process(node->task);
8557+
8558+ mutex_unlock(&ctx->uring_lock);
8559+ wait_for_completion(&exit.completion);
8560+ cond_resched();
8561+ mutex_lock(&ctx->uring_lock);
8562+ }
8563+ mutex_unlock(&ctx->uring_lock);
8564+
85398565 io_ring_ctx_free(ctx);
85408566 }
85418567
85428568 static void io_ring_ctx_wait_and_kill(struct io_ring_ctx *ctx)
85438569 {
8570+ unsigned long index;
8571+ struct creds *creds;
8572+
85448573 mutex_lock(&ctx->uring_lock);
85458574 percpu_ref_kill(&ctx->refs);
85468575 /* if force is set, the ring is going away. always drop after that */
85478576 ctx->cq_overflow_flushed = 1;
85488577 if (ctx->rings)
85498578 __io_cqring_overflow_flush(ctx, true, NULL, NULL);
8550− idr_for_each(&ctx->personality_idr, io_remove_personalities, ctx);
8579+ xa_for_each(&ctx->personalities, index, creds)
8580+ io_unregister_personality(ctx, index);
85518581 mutex_unlock(&ctx->uring_lock);
85528582
85538583 io_kill_timeouts(ctx, NULL, NULL);
@@ -8600,11 +8630,11 @@ static bool io_cancel_task_cb(struct io_wq_work *work, void *data) · 46 unmodified lines
86008630 return ret;
86018631 }
86028632
8603−static void io_cancel_defer_files(struct io_ring_ctx *ctx,
8633+static bool io_cancel_defer_files(struct io_ring_ctx *ctx,
86048634 struct task_struct *task,
86058635 struct files_struct *files)
86068636 {
8607− struct io_defer_entry *de = NULL;
8637+ struct io_defer_entry *de;
86088638 LIST_HEAD(list);
86098639
86108640 spin_lock_irq(&ctx->completion_lock);
@@ -8615,6 +8645,8 @@ static void io_cancel_defer_files(struct io_ring_ctx *ctx, · 4 unmodified lines
86158645 }
86168646 }
86178647 spin_unlock_irq(&ctx->completion_lock);
8648+ if (list_empty(&list))
8649+ return false;
86188650
86198651 while (!list_empty(&list)) {
86208652 de = list_first_entry(&list, struct io_defer_entry, list);
@@ -8624,6 +8656,38 @@ static void io_cancel_defer_files(struct io_ring_ctx *ctx, · 3 unmodified lines
86248656 io_req_complete(de->req, -ECANCELED);
86258657 kfree(de);
86268658 }
8659+ return true;
8660+}
8661+
8662+static bool io_cancel_ctx_cb(struct io_wq_work *work, void *data)
8663+{
8664+ struct io_kiocb *req = container_of(work, struct io_kiocb, work);
8665+
8666+ return req->ctx == data;
8667+}
8668+
8669+static bool io_uring_try_cancel_iowq(struct io_ring_ctx *ctx)
8670+{
8671+ struct io_tctx_node *node;
8672+ enum io_wq_cancel cret;
8673+ bool ret = false;
8674+
8675+ mutex_lock(&ctx->uring_lock);
8676+ list_for_each_entry(node, &ctx->tctx_list, ctx_node) {
8677+ struct io_uring_task *tctx = node->task->io_uring;
8678+
8679+ /*
8680+ * io_wq will stay alive while we hold uring_lock, because it's
8681+ * killed after ctx nodes, which requires to take the lock.
8682+ */
8683+ if (!tctx || !tctx->io_wq)
8684+ continue;
8685+ cret = io_wq_cancel_cb(tctx->io_wq, io_cancel_ctx_cb, ctx, true);
8686+ ret |= (cret != IO_WQ_CANCEL_NOTFOUND);
8687+ }
8688+ mutex_unlock(&ctx->uring_lock);
8689+
8690+ return ret;
86278691 }
86288692
86298693 static void io_uring_try_cancel_requests(struct io_ring_ctx *ctx,
@@ -8631,27 +8695,34 @@ static void io_uring_try_cancel_requests(struct io_ring_ctx *ctx, · 1 unmodified line
86318695 struct files_struct *files)
86328696 {
86338697 struct io_task_cancel cancel = { .task = task, .files = files, };
8634− struct task_struct *tctx_task = task ?: current;
8635− struct io_uring_task *tctx = tctx_task->io_uring;
8698+ struct io_uring_task *tctx = task ? task->io_uring : NULL;
86368699
86378700 while (1) {
86388701 enum io_wq_cancel cret;
86398702 bool ret = false;
86408703
8641− if (tctx && tctx->io_wq) {
8704+ if (!task) {
8705+ ret |= io_uring_try_cancel_iowq(ctx);
8706+ } else if (tctx && tctx->io_wq) {
8707+ /*
8708+ * Cancels requests of all rings, not only @ctx, but
8709+ * it's fine as the task is in exit/exec.
8710+ */
86428711 cret = io_wq_cancel_cb(tctx->io_wq, io_cancel_task_cb,
86438712 &cancel, true);
86448713 ret |= (cret != IO_WQ_CANCEL_NOTFOUND);
86458714 }
86468715
86478716 /* SQPOLL thread does its own polling */
8648− if (!(ctx->flags & IORING_SETUP_SQPOLL) && !files) {
8717+ if ((!(ctx->flags & IORING_SETUP_SQPOLL) && !files) ||
8718+ (ctx->sq_data && ctx->sq_data->thread == current)) {
86498719 while (!list_empty_careful(&ctx->iopoll_list)) {
86508720 io_iopoll_try_reap_events(ctx);
86518721 ret = true;
86528722 }
86538723 }
86548724
8725+ ret |= io_cancel_defer_files(ctx, task, files);
86558726 ret |= io_poll_remove_all(ctx, task, files);
86568727 ret |= io_kill_timeouts(ctx, task, files);
86578728 ret |= io_run_task_work();
@@ -8691,58 +8762,21 @@ static void io_uring_cancel_files(struct io_ring_ctx *ctx, · 33 unmodified lines
86918762
86928763 io_uring_try_cancel_requests(ctx, task, files);
86938764
8694− if (ctx->sq_data)
8695− io_sq_thread_unpark(ctx->sq_data);
86968765 prepare_to_wait(&task->io_uring->wait, &wait,
86978766 TASK_UNINTERRUPTIBLE);
86988767 if (inflight == io_uring_count_inflight(ctx, task, files))
86998768 schedule();
87008769 finish_wait(&task->io_uring->wait, &wait);
8701− if (ctx->sq_data)
8702− io_sq_thread_park(ctx->sq_data);
8703− }
8704−}
8705−
8706−/*
8707− * We need to iteratively cancel requests, in case a request has dependent
8708− * hard links. These persist even for failure of cancelations, hence keep
8709− * looping until none are found.
8710− */
8711−static void io_uring_cancel_task_requests(struct io_ring_ctx *ctx,
8712− struct files_struct *files)
8713−{
8714− struct task_struct *task = current;
8715−
8716− if ((ctx->flags & IORING_SETUP_SQPOLL) && ctx->sq_data) {
8717− /* never started, nothing to cancel */
8718− if (ctx->flags & IORING_SETUP_R_DISABLED) {
8719− io_sq_offload_start(ctx);
8720− return;
8721− }
8722− io_sq_thread_park(ctx->sq_data);
8723− task = ctx->sq_data->thread;
8724− if (task)
8725− atomic_inc(&task->io_uring->in_idle);
87268770 }
8727−
8728− io_cancel_defer_files(ctx, task, files);
8729−
8730− io_uring_cancel_files(ctx, task, files);
8731− if (!files)
8732− io_uring_try_cancel_requests(ctx, task, NULL);
8733−
8734− if (task)
8735− atomic_dec(&task->io_uring->in_idle);
8736− if (ctx->sq_data)
8737− io_sq_thread_unpark(ctx->sq_data);
87388771 }
87398772
87408773 /*
87418774 * Note that this task has used io_uring. We use it for cancelation purposes.
87428775 */
8743−static int io_uring_add_task_file(struct io_ring_ctx *ctx, struct file *file)
8776+static int io_uring_add_task_file(struct io_ring_ctx *ctx)
87448777 {
87458778 struct io_uring_task *tctx = current->io_uring;
8779+ struct io_tctx_node *node;
87468780 int ret;
87478781
87488782 if (unlikely(!tctx)) {
@@ -8751,102 +8785,151 @@ static int io_uring_add_task_file(struct io_ring_ctx *ctx, struct file *file) · 2 unmodified lines
87518785 return ret;
87528786 tctx = current->io_uring;
87538787 }
8754− if (tctx->last != file) {
8755− void *old = xa_load(&tctx->xa, (unsigned long)file);
8788+ if (tctx->last != ctx) {
8789+ void *old = xa_load(&tctx->xa, (unsigned long)ctx);
87568790
87578791 if (!old) {
8758− get_file(file);
8759− ret = xa_err(xa_store(&tctx->xa, (unsigned long)file,
8760− file, GFP_KERNEL));
8792+ node = kmalloc(sizeof(*node), GFP_KERNEL);
8793+ if (!node)
8794+ return -ENOMEM;
8795+ node->ctx = ctx;
8796+ node->task = current;
8797+
8798+ ret = xa_err(xa_store(&tctx->xa, (unsigned long)ctx,
8799+ node, GFP_KERNEL));
87618800 if (ret) {
8762− fput(file);
8801+ kfree(node);
87638802 return ret;
87648803 }
8804+
8805+ mutex_lock(&ctx->uring_lock);
8806+ list_add(&node->ctx_node, &ctx->tctx_list);
8807+ mutex_unlock(&ctx->uring_lock);
87658808 }
8766− tctx->last = file;
8809+ tctx->last = ctx;
87678810 }
8768−
8769− /*
8770− * This is race safe in that the task itself is doing this, hence it
8771− * cannot be going through the exit/cancel paths at the same time.
8772− * This cannot be modified while exit/cancel is running.
8773− */
8774− if (!tctx->sqpoll && (ctx->flags & IORING_SETUP_SQPOLL))
8775− tctx->sqpoll = true;
8776−
87778811 return 0;
87788812 }
87798813
87808814 /*
87818815 * Remove this io_uring_file -> task mapping.
87828816 */
8783−static void io_uring_del_task_file(struct file *file)
8817+static void io_uring_del_task_file(unsigned long index)
87848818 {
87858819 struct io_uring_task *tctx = current->io_uring;
8820+ struct io_tctx_node *node;
87868821
8787− if (tctx->last == file)
8822+ if (!tctx)
8823+ return;
8824+ node = xa_erase(&tctx->xa, index);
8825+ if (!node)
8826+ return;
8827+
8828+ WARN_ON_ONCE(current != node->task);
8829+ WARN_ON_ONCE(list_empty(&node->ctx_node));
8830+
8831+ mutex_lock(&node->ctx->uring_lock);
8832+ list_del(&node->ctx_node);
8833+ mutex_unlock(&node->ctx->uring_lock);
8834+
8835+ if (tctx->last == node->ctx)
87888836 tctx->last = NULL;
8789− file = xa_erase(&tctx->xa, (unsigned long)file);
8790− if (file)
8791− fput(file);
8837+ kfree(node);
87928838 }
87938839
87948840 static void io_uring_clean_tctx(struct io_uring_task *tctx)
87958841 {
8796− struct file *file;
8842+ struct io_tctx_node *node;
87978843 unsigned long index;
87988844
8799− xa_for_each(&tctx->xa, index, file)
8800− io_uring_del_task_file(file);
8845+ xa_for_each(&tctx->xa, index, node)
8846+ io_uring_del_task_file(index);
88018847 if (tctx->io_wq) {
88028848 io_wq_put_and_exit(tctx->io_wq);
88038849 tctx->io_wq = NULL;
88048850 }
88058851 }
88068852
8853+static s64 tctx_inflight(struct io_uring_task *tctx)
8854+{
8855+ return percpu_counter_sum(&tctx->inflight);
8856+}
8857+
8858+static void io_sqpoll_cancel_cb(struct callback_head *cb)
8859+{
8860+ struct io_tctx_exit *work = container_of(cb, struct io_tctx_exit, task_work);
8861+ struct io_ring_ctx *ctx = work->ctx;
8862+ struct io_sq_data *sqd = ctx->sq_data;
8863+
8864+ if (sqd->thread)
8865+ io_uring_cancel_sqpoll(ctx);
8866+ complete(&work->completion);
8867+}
8868+
8869+static void io_sqpoll_cancel_sync(struct io_ring_ctx *ctx)
8870+{
8871+ struct io_sq_data *sqd = ctx->sq_data;
8872+ struct io_tctx_exit work = { .ctx = ctx, };
8873+ struct task_struct *task;
8874+
8875+ io_sq_thread_park(sqd);
8876+ list_del_init(&ctx->sqd_list);
8877+ io_sqd_update_thread_idle(sqd);
8878+ task = sqd->thread;
8879+ if (task) {
8880+ init_completion(&work.completion);
8881+ init_task_work(&work.task_work, io_sqpoll_cancel_cb);
8882+ WARN_ON_ONCE(task_work_add(task, &work.task_work, TWA_SIGNAL));
8883+ wake_up_process(task);
8884+ }
8885+ io_sq_thread_unpark(sqd);
8886+
8887+ if (task)
8888+ wait_for_completion(&work.completion);
8889+}
8890+
88078891 void __io_uring_files_cancel(struct files_struct *files)
88088892 {
88098893 struct io_uring_task *tctx = current->io_uring;
8810− struct file *file;
8894+ struct io_tctx_node *node;
88118895 unsigned long index;
88128896
88138897 /* make sure overflow events are dropped */
88148898 atomic_inc(&tctx->in_idle);
8815− xa_for_each(&tctx->xa, index, file)
8816− io_uring_cancel_task_requests(file->private_data, files);
8899+ xa_for_each(&tctx->xa, index, node) {
8900+ struct io_ring_ctx *ctx = node->ctx;
8901+
8902+ if (ctx->sq_data) {
8903+ io_sqpoll_cancel_sync(ctx);
8904+ continue;
8905+ }
8906+ io_uring_cancel_files(ctx, current, files);
8907+ if (!files)
8908+ io_uring_try_cancel_requests(ctx, current, NULL);
8909+ }
88178910 atomic_dec(&tctx->in_idle);
88188911
88198912 if (files)
88208913 io_uring_clean_tctx(tctx);
88218914 }
88228915
8823−static s64 tctx_inflight(struct io_uring_task *tctx)
8824−{
8825− return percpu_counter_sum(&tctx->inflight);
8826−}
8827−
8916+/* should only be called by SQPOLL task */
88288917 static void io_uring_cancel_sqpoll(struct io_ring_ctx *ctx)
88298918 {
88308919 struct io_sq_data *sqd = ctx->sq_data;
8831− struct io_uring_task *tctx;
8920+ struct io_uring_task *tctx = current->io_uring;
88328921 s64 inflight;
88338922 DEFINE_WAIT(wait);
88348923
8835− if (!sqd)
8836− return;
8837− io_sq_thread_park(sqd);
8838− if (!sqd->thread || !sqd->thread->io_uring) {
8839− io_sq_thread_unpark(sqd);
8840− return;
8841− }
8842− tctx = ctx->sq_data->thread->io_uring;
8924+ WARN_ON_ONCE(!sqd || ctx->sq_data->thread != current);
8925+
88438926 atomic_inc(&tctx->in_idle);
88448927 do {
88458928 /* read completions before cancelations */
88468929 inflight = tctx_inflight(tctx);
88478930 if (!inflight)
88488931 break;
8849− io_uring_cancel_task_requests(ctx, NULL);
8932+ io_uring_try_cancel_requests(ctx, current, NULL);
88508933
88518934 prepare_to_wait(&tctx->wait, &wait, TASK_UNINTERRUPTIBLE);
88528935 /*
@@ -8859,7 +8942,6 @@ static void io_uring_cancel_sqpoll(struct io_ring_ctx *ctx) · 6 unmodified lines
88598942 finish_wait(&tctx->wait, &wait);
88608943 } while (1);
88618944 atomic_dec(&tctx->in_idle);
8862− io_sq_thread_unpark(sqd);
88638945 }
88648946
88658947 /*
@@ -8874,15 +8956,6 @@ void __io_uring_task_cancel(void) · 8 unmodified lines
88748956
88758957 /* make sure overflow events are dropped */
88768958 atomic_inc(&tctx->in_idle);
8877−
8878− if (tctx->sqpoll) {
8879− struct file *file;
8880− unsigned long index;
8881−
8882− xa_for_each(&tctx->xa, index, file)
8883− io_uring_cancel_sqpoll(file->private_data);
8884− }
8885−
88868959 do {
88878960 /* read completions before cancelations */
88888961 inflight = tctx_inflight(tctx);
@@ -8981,7 +9054,6 @@ static unsigned long io_uring_nommu_get_unmapped_area(struct file *file, · 92 unmodified lines
89819054
89829055 static int io_sqpoll_wait_sq(struct io_ring_ctx *ctx)
89839056 {
8984− int ret = 0;
89859057 DEFINE_WAIT(wait);
89869058
89879059 do {
@@ -8995,7 +9067,7 @@ static int io_sqpoll_wait_sq(struct io_ring_ctx *ctx) · 7 unmodified lines
89959067 } while (!signal_pending(current));
89969068
89979069 finish_wait(&ctx->sqo_sq_wait, &wait);
8998− return ret;
9070+ return 0;
89999071 }
90009072
90019073 static int io_get_ext_arg(unsigned flags, const void __user *argp, size_t *argsz,
@@ -9069,13 +9141,10 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit, · 67 unmodified lines
90699141 if (ctx->flags & IORING_SETUP_SQPOLL) {
90709142 io_cqring_overflow_flush(ctx, false, NULL, NULL);
90719143
9072− if (unlikely(ctx->sqo_exec)) {
9073− ret = io_sq_thread_fork(ctx->sq_data, ctx);
9074− if (ret)
9075− goto out;
9076− ctx->sqo_exec = 0;
9077− }
90789144 ret = -EOWNERDEAD;
9145+ if (unlikely(ctx->sq_data->thread == NULL)) {
9146+ goto out;
9147+ }
90799148 if (flags & IORING_ENTER_SQ_WAKEUP)
90809149 wake_up(&ctx->sq_data->wait);
90819150 if (flags & IORING_ENTER_SQ_WAIT) {
@@ -9085,7 +9154,7 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit, · 3 unmodified lines
90859154 }
90869155 submitted = to_submit;
90879156 } else if (to_submit) {
9088− ret = io_uring_add_task_file(ctx, f.file);
9157+ ret = io_uring_add_task_file(ctx);
90899158 if (unlikely(ret))
90909159 goto out;
90919160 mutex_lock(&ctx->uring_lock);
@@ -9127,10 +9196,9 @@ out_fput: · 35 unmodified lines
91279196 }
91289197
91299198 #ifdef CONFIG_PROC_FS
9130−static int io_uring_show_cred(int id, void *p, void *data)
9199+static int io_uring_show_cred(struct seq_file *m, unsigned int id,
9200+ const struct cred *cred)
91319201 {
9132− const struct cred *cred = p;
9133− struct seq_file *m = data;
91349202 struct user_namespace *uns = seq_user_ns(m);
91359203 struct group_info *gi;
91369204 kernel_cap_t cap;
@@ -9198,9 +9266,13 @@ static void __io_uring_show_fdinfo(struct io_ring_ctx *ctx, struct seq_file *m) · 61 unmodified lines
91989266 seq_printf(m, "%5u: 0x%llx/%u\n", i, buf->ubuf,
91999267 (unsigned int) buf->len);
92009268 }
9201− if (has_lock && !idr_is_empty(&ctx->personality_idr)) {
9269+ if (has_lock && !xa_empty(&ctx->personalities)) {
9270+ unsigned long index;
9271+ const struct cred *cred;
9272+
92029273 seq_printf(m, "Personalities:\n");
9203− idr_for_each(&ctx->personality_idr, io_uring_show_cred, m);
9274+ xa_for_each(&ctx->personalities, index, cred)
9275+ io_uring_show_cred(m, index, cred);
92049276 }
92059277 seq_printf(m, "PollList:\n");
92069278 spin_lock_irq(&ctx->completion_lock);
@@ -9294,7 +9366,7 @@ static int io_uring_install_fd(struct io_ring_ctx *ctx, struct file *file) · 87 unmodified lines
92949366 if (fd < 0)
92959367 return fd;
92969368
9297− ret = io_uring_add_task_file(ctx, file);
9369+ ret = io_uring_add_task_file(ctx);
92989370 if (ret) {
92999371 put_unused_fd(fd);
93009372 return ret;
@@ -9402,9 +9474,6 @@ static int io_uring_create(unsigned entries, struct io_uring_params *p, · 101 unmodified lines
94029474 if (ret)
94039475 goto err;
94049476
9405− if (!(p->flags & IORING_SETUP_R_DISABLED))
9406− io_sq_offload_start(ctx);
9407−
94089477 memset(&p->sq_off, 0, sizeof(p->sq_off));
94099478 p->sq_off.head = offsetof(struct io_rings, sq.head);
94109479 p->sq_off.tail = offsetof(struct io_rings, sq.tail);
@@ -9532,14 +9601,16 @@ out: · 121 unmodified lines
95329601 static int io_register_personality(struct io_ring_ctx *ctx)
95339602 {
95349603 const struct cred *creds;
9604+ u32 id;
95359605 int ret;
95369606
95379607 creds = get_current_cred();
95389608
9539− ret = idr_alloc_cyclic(&ctx->personality_idr, (void *) creds, 1,
9540− USHRT_MAX, GFP_KERNEL);
9541− if (ret < 0)
9542− put_cred(creds);
9609+ ret = xa_alloc_cyclic(&ctx->personalities, &id, (void *)creds,
9610+ XA_LIMIT(0, USHRT_MAX), &ctx->pers_next, GFP_KERNEL);
9611+ if (!ret)
9612+ return id;
9613+ put_cred(creds);
95439614 return ret;
95449615 }
95459616
@@ -9621,7 +9692,9 @@ static int io_register_enable_rings(struct io_ring_ctx *ctx) · 75 unmodified lines
96219692 if (ctx->restrictions.registered)
96229693 ctx->restricted = 1;
96239694
9624− io_sq_offload_start(ctx);
9695+ ctx->flags &= ~IORING_SETUP_R_DISABLED;
9696+ if (ctx->sq_data && wq_has_sleeper(&ctx->sq_data->wait))
9697+ wake_up(&ctx->sq_data->wait);
96259698 return 0;
96269699 }
96279700
fs/iomap/buffered-io.c+2−2
@@ -1221,7 +1221,7 @@ iomap_alloc_ioend(struct inode *inode, struct iomap_writepage_ctx *wpc, · 1220 unmodified lines
12211221 struct iomap_ioend *ioend;
12221222 struct bio *bio;
12231223
1224− bio = bio_alloc_bioset(GFP_NOFS, BIO_MAX_PAGES, &iomap_ioend_bioset);
1224+ bio = bio_alloc_bioset(GFP_NOFS, BIO_MAX_VECS, &iomap_ioend_bioset);
12251225 bio_set_dev(bio, wpc->iomap.bdev);
12261226 bio->bi_iter.bi_sector = sector;
12271227 bio->bi_opf = REQ_OP_WRITE | wbc_to_write_flags(wbc);
@@ -1252,7 +1252,7 @@ iomap_chain_bio(struct bio *prev) · 24 unmodified lines
12521252 {
12531253 struct bio *new;
12541254
1255− new = bio_alloc(GFP_NOFS, BIO_MAX_PAGES);
1255+ new = bio_alloc(GFP_NOFS, BIO_MAX_VECS);
12561256 bio_copy_dev(new, prev);/* also copies over blkcg information */
12571257 new->bi_iter.bi_sector = bio_end_sector(prev);
12581258 new->bi_opf = prev->bi_opf;
fs/iomap/direct-io.c+2−2
@@ -296,7 +296,7 @@ iomap_dio_bio_actor(struct inode *inode, loff_t pos, loff_t length, · 295 unmodified lines
296296 */
297297 bio_opf = iomap_dio_bio_opflags(dio, iomap, use_fua);
298298
299− nr_pages = bio_iov_vecs_to_alloc(dio->submit.iter, BIO_MAX_PAGES);
299+ nr_pages = bio_iov_vecs_to_alloc(dio->submit.iter, BIO_MAX_VECS);
300300 do {
301301 size_t n;
302302 if (dio->error) {
@@ -338,7 +338,7 @@ iomap_dio_bio_actor(struct inode *inode, loff_t pos, loff_t length, · 35 unmodified lines
338338 copied += n;
339339
340340 nr_pages = bio_iov_vecs_to_alloc(dio->submit.iter,
341− BIO_MAX_PAGES);
341+ BIO_MAX_VECS);
342342 iomap_dio_submit_bio(dio, iomap, bio, pos);
343343 pos += n;
344344 } while (nr_pages);
fs/locks.c+0−3
@@ -1808,9 +1808,6 @@ check_conflicting_open(struct file *filp, const long arg, int flags) · 1807 unmodified lines
18081808
18091809 if (flags & FL_LAYOUT)
18101810 return 0;
1811− if (flags & FL_DELEG)
1812− /* We leave these checks to the caller. */
1813− return 0;
18141811
18151812 if (arg == F_RDLCK)
18161813 return inode_is_open_for_write(inode) ? -EAGAIN : 0;
fs/mpage.c+1−1
@@ -616,7 +616,7 @@ alloc_new: · 615 unmodified lines
616616 goto out;
617617 }
618618 bio = mpage_alloc(bdev, blocks[0] << (blkbits - 9),
619− BIO_MAX_PAGES, GFP_NOFS|__GFP_HIGH);
619+ BIO_MAX_VECS, GFP_NOFS|__GFP_HIGH);
620620 if (bio == NULL)
621621 goto confused;
622622
fs/nfs/Kconfig+1−1
@@ -127,7 +127,7 @@ config PNFS_BLOCK · 126 unmodified lines
127127 config PNFS_FLEXFILE_LAYOUT
128128 tristate
129129 depends on NFS_V4_1 && NFS_V3
130− default m
130+ default NFS_V4
131131
132132 config NFS_V4_1_IMPLEMENTATION_ID_DOMAIN
133133 string "NFSv4.1 Implementation ID Domain"
fs/nfs/dir.c+33−25
@@ -81,8 +81,9 @@ static struct nfs_open_dir_context *alloc_nfs_open_dir_context(struct inode *dir · 80 unmodified lines
8181 spin_lock(&dir->i_lock);
8282 if (list_empty(&nfsi->open_files) &&
8383 (nfsi->cache_validity & NFS_INO_DATA_INVAL_DEFER))
84− nfsi->cache_validity |= NFS_INO_INVALID_DATA |
85− NFS_INO_REVAL_FORCED;
84+ nfs_set_cache_invalid(dir,
85+ NFS_INO_INVALID_DATA |
86+ NFS_INO_REVAL_FORCED);
8687 list_add(&ctx->list, &nfsi->open_files);
8788 spin_unlock(&dir->i_lock);
8889 return ctx;
@@ -1401,6 +1402,13 @@ out_force: · 1312 unmodified lines
14011402 goto out;
14021403 }
14031404
1405+static void nfs_mark_dir_for_revalidate(struct inode *inode)
1406+{
1407+ spin_lock(&inode->i_lock);
1408+ nfs_set_cache_invalid(inode, NFS_INO_REVAL_PAGECACHE);
1409+ spin_unlock(&inode->i_lock);
1410+}
1411+
14041412 /*
14051413 * We judge how long we want to trust negative
14061414 * dentries by looking at the parent inode mtime.
@@ -1435,19 +1443,14 @@ nfs_lookup_revalidate_done(struct inode *dir, struct dentry *dentry, · 28 unmodified lines
14351443 __func__, dentry);
14361444 return 1;
14371445 case 0:
1438− nfs_mark_for_revalidate(dir);
1439− if (inode && S_ISDIR(inode->i_mode)) {
1440− /* Purge readdir caches. */
1441− nfs_zap_caches(inode);
1442− /*
1443− * We can't d_drop the root of a disconnected tree:
1444− * its d_hash is on the s_anon list and d_drop() would hide
1445− * it from shrink_dcache_for_unmount(), leading to busy
1446− * inodes on unmount and further oopses.
1447− */
1448− if (IS_ROOT(dentry))
1449− return 1;
1450− }
1446+ /*
1447+ * We can't d_drop the root of a disconnected tree:
1448+ * its d_hash is on the s_anon list and d_drop() would hide
1449+ * it from shrink_dcache_for_unmount(), leading to busy
1450+ * inodes on unmount and further oopses.
1451+ */
1452+ if (inode && IS_ROOT(dentry))
1453+ return 1;
14511454 dfprintk(LOOKUPCACHE, "NFS: %s(%pd2) is invalid\n",
14521455 __func__, dentry);
14531456 return 0;
@@ -1525,6 +1528,13 @@ out: · 71 unmodified lines
15251528 nfs_free_fattr(fattr);
15261529 nfs_free_fhandle(fhandle);
15271530 nfs4_label_free(label);
1531+
1532+ /*
1533+ * If the lookup failed despite the dentry change attribute being
1534+ * a match, then we should revalidate the directory cache.
1535+ */
1536+ if (!ret && nfs_verify_change_attribute(dir, dentry->d_time))
1537+ nfs_mark_dir_for_revalidate(dir);
15281538 return nfs_lookup_revalidate_done(dir, dentry, inode, ret);
15291539 }
15301540
@@ -1567,7 +1577,7 @@ nfs_do_lookup_revalidate(struct inode *dir, struct dentry *dentry, · 36 unmodified lines
15671577 error = nfs_lookup_verify_inode(inode, flags);
15681578 if (error) {
15691579 if (error == -ESTALE)
1570− nfs_zap_caches(dir);
1580+ nfs_mark_dir_for_revalidate(dir);
15711581 goto out_bad;
15721582 }
15731583 nfs_advise_use_readdirplus(dir);
@@ -1691,10 +1701,9 @@ static void nfs_drop_nlink(struct inode *inode) · 117 unmodified lines
16911701 if (inode->i_nlink > 0)
16921702 drop_nlink(inode);
16931703 NFS_I(inode)->attr_gencount = nfs_inc_attr_generation_counter();
1694− NFS_I(inode)->cache_validity |= NFS_INO_INVALID_CHANGE
1695− | NFS_INO_INVALID_CTIME
1696− | NFS_INO_INVALID_OTHER
1697− | NFS_INO_REVAL_FORCED;
1704+ nfs_set_cache_invalid(
1705+ inode, NFS_INO_INVALID_CHANGE | NFS_INO_INVALID_CTIME |
1706+ NFS_INO_INVALID_OTHER | NFS_INO_REVAL_FORCED);
16981707 spin_unlock(&inode->i_lock);
16991708 }
17001709
@@ -1706,7 +1715,7 @@ static void nfs_dentry_iput(struct dentry *dentry, struct inode *inode) · 5 unmodified lines
17061715 {
17071716 if (S_ISDIR(inode->i_mode))
17081717 /* drop any readdir cache as it could easily be old */
1709− NFS_I(inode)->cache_validity |= NFS_INO_INVALID_DATA;
1718+ nfs_set_cache_invalid(inode, NFS_INO_INVALID_DATA);
17101719
17111720 if (dentry->d_flags & DCACHE_NFSFS_RENAMED) {
17121721 nfs_complete_unlink(dentry, inode);
@@ -2064,7 +2073,6 @@ out: · 351 unmodified lines
20642073 dput(parent);
20652074 return d;
20662075 out_error:
2067− nfs_mark_for_revalidate(dir);
20682076 d = ERR_PTR(error);
20692077 goto out;
20702078 }
@@ -2473,9 +2481,9 @@ int nfs_rename(struct user_namespace *mnt_userns, struct inode *old_dir, · 402 unmodified lines
24732481 if (error == 0) {
24742482 spin_lock(&old_inode->i_lock);
24752483 NFS_I(old_inode)->attr_gencount = nfs_inc_attr_generation_counter();
2476− NFS_I(old_inode)->cache_validity |= NFS_INO_INVALID_CHANGE
2477− | NFS_INO_INVALID_CTIME
2478− | NFS_INO_REVAL_FORCED;
2484+ nfs_set_cache_invalid(old_inode, NFS_INO_INVALID_CHANGE |
2485+ NFS_INO_INVALID_CTIME |
2486+ NFS_INO_REVAL_FORCED);
24792487 spin_unlock(&old_inode->i_lock);
24802488 }
24812489 out:
fs/nfs/inode.c+4−3
@@ -207,7 +207,7 @@ static bool nfs_has_xattr_cache(const struct nfs_inode *nfsi) · 206 unmodified lines
207207 }
208208 #endif
209209
210−static void nfs_set_cache_invalid(struct inode *inode, unsigned long flags)
210+void nfs_set_cache_invalid(struct inode *inode, unsigned long flags)
211211 {
212212 struct nfs_inode *nfsi = NFS_I(inode);
213213 bool have_delegation = NFS_PROTO(inode)->have_delegation(inode, FMODE_READ);
@@ -229,6 +229,7 @@ static void nfs_set_cache_invalid(struct inode *inode, unsigned long flags) · 15 unmodified lines
229229 if (flags & NFS_INO_INVALID_DATA)
230230 nfs_fscache_invalidate(inode);
231231 }
232+EXPORT_SYMBOL_GPL(nfs_set_cache_invalid);
232233
233234 /*
234235 * Invalidate the local caches
@@ -1067,8 +1068,8 @@ void nfs_inode_attach_open_context(struct nfs_open_context *ctx) · 832 unmodified lines
10671068 spin_lock(&inode->i_lock);
10681069 if (list_empty(&nfsi->open_files) &&
10691070 (nfsi->cache_validity & NFS_INO_DATA_INVAL_DEFER))
1070− nfsi->cache_validity |= NFS_INO_INVALID_DATA |
1071− NFS_INO_REVAL_FORCED;
1071+ nfs_set_cache_invalid(inode, NFS_INO_INVALID_DATA |
1072+ NFS_INO_REVAL_FORCED);
10721073 list_add_tail_rcu(&ctx->list, &nfsi->open_files);
10731074 spin_unlock(&inode->i_lock);
10741075 }
fs/nfs/internal.h+2−1
@@ -411,7 +411,8 @@ extern int nfs_write_inode(struct inode *, struct writeback_control *); · 410 unmodified lines
411411 extern int nfs_drop_inode(struct inode *);
412412 extern void nfs_clear_inode(struct inode *);
413413 extern void nfs_evict_inode(struct inode *);
414−void nfs_zap_acl_cache(struct inode *inode);
414+extern void nfs_zap_acl_cache(struct inode *inode);
415+extern void nfs_set_cache_invalid(struct inode *inode, unsigned long flags);
415416 extern bool nfs_check_cache_invalid(struct inode *, unsigned long);
416417 extern int nfs_wait_bit_killable(struct wait_bit_key *key, int mode);
417418 extern int nfs_wait_atomic_killable(atomic_t *p, unsigned int mode);
fs/nfs/nfs3xdr.c+2−1
@@ -36,6 +36,7 @@ · 35 unmodified lines
3636 #define NFS3_pagepad_sz (1) /* Page padding */
3737 #define NFS3_fhandle_sz (1+16)
3838 #define NFS3_fh_sz (NFS3_fhandle_sz) /* shorthand */
39+#define NFS3_post_op_fh_sz (1+NFS3_fh_sz)
3940 #define NFS3_sattr_sz (15)
4041 #define NFS3_filename_sz (1+(NFS3_MAXNAMLEN>>2))
4142 #define NFS3_path_sz (1+(NFS3_MAXPATHLEN>>2))
@@ -73,7 +74,7 @@ · 31 unmodified lines
7374 #define NFS3_readlinkres_sz (1+NFS3_post_op_attr_sz+1+NFS3_pagepad_sz)
7475 #define NFS3_readres_sz (1+NFS3_post_op_attr_sz+3+NFS3_pagepad_sz)
7576 #define NFS3_writeres_sz (1+NFS3_wcc_data_sz+4)
76−#define NFS3_createres_sz (1+NFS3_fh_sz+NFS3_post_op_attr_sz+NFS3_wcc_data_sz)
77+#define NFS3_createres_sz (1+NFS3_post_op_fh_sz+NFS3_post_op_attr_sz+NFS3_wcc_data_sz)
7778 #define NFS3_renameres_sz (1+(2 * NFS3_wcc_data_sz))
7879 #define NFS3_linkres_sz (1+NFS3_post_op_attr_sz+NFS3_wcc_data_sz)
7980 #define NFS3_readdirres_sz (1+NFS3_post_op_attr_sz+2+NFS3_pagepad_sz)
fs/nfs/nfs42proc.c+7−5
@@ -357,13 +357,15 @@ static ssize_t _nfs42_proc_copy(struct file *src, · 356 unmodified lines
357357 truncate_pagecache_range(dst_inode, pos_dst,
358358 pos_dst + res->write_res.count);
359359 spin_lock(&dst_inode->i_lock);
360− NFS_I(dst_inode)->cache_validity |= (NFS_INO_REVAL_PAGECACHE |
361− NFS_INO_REVAL_FORCED | NFS_INO_INVALID_SIZE |
362− NFS_INO_INVALID_ATTR | NFS_INO_INVALID_DATA);
360+ nfs_set_cache_invalid(
361+ dst_inode, NFS_INO_REVAL_PAGECACHE | NFS_INO_REVAL_FORCED |
362+ NFS_INO_INVALID_SIZE | NFS_INO_INVALID_ATTR |
363+ NFS_INO_INVALID_DATA);
363364 spin_unlock(&dst_inode->i_lock);
364365 spin_lock(&src_inode->i_lock);
365− NFS_I(src_inode)->cache_validity |= (NFS_INO_REVAL_PAGECACHE |
366− NFS_INO_REVAL_FORCED | NFS_INO_INVALID_ATIME);
366+ nfs_set_cache_invalid(src_inode, NFS_INO_REVAL_PAGECACHE |
367+ NFS_INO_REVAL_FORCED |
368+ NFS_INO_INVALID_ATIME);
367369 spin_unlock(&src_inode->i_lock);
368370 status = res->write_res.count;
369371 out:
fs/nfs/nfs4proc.c+16−17
@@ -1169,14 +1169,14 @@ int nfs4_call_sync(struct rpc_clnt *clnt, · 1168 unmodified lines
11691169 static void
11701170 nfs4_inc_nlink_locked(struct inode *inode)
11711171 {
1172− NFS_I(inode)->cache_validity |= NFS_INO_INVALID_OTHER;
1172+ nfs_set_cache_invalid(inode, NFS_INO_INVALID_OTHER);
11731173 inc_nlink(inode);
11741174 }
11751175
11761176 static void
11771177 nfs4_dec_nlink_locked(struct inode *inode)
11781178 {
1179− NFS_I(inode)->cache_validity |= NFS_INO_INVALID_OTHER;
1179+ nfs_set_cache_invalid(inode, NFS_INO_INVALID_OTHER);
11801180 drop_nlink(inode);
11811181 }
11821182
@@ -1187,35 +1187,31 @@ nfs4_update_changeattr_locked(struct inode *inode, · 4 unmodified lines
11871187 {
11881188 struct nfs_inode *nfsi = NFS_I(inode);
11891189
1190− nfsi->cache_validity |= NFS_INO_INVALID_CTIME
1191− | NFS_INO_INVALID_MTIME
1192− | cache_validity;
1190+ cache_validity |= NFS_INO_INVALID_CTIME | NFS_INO_INVALID_MTIME;
11931191
11941192 if (cinfo->atomic && cinfo->before == inode_peek_iversion_raw(inode)) {
11951193 nfsi->cache_validity &= ~NFS_INO_REVAL_PAGECACHE;
11961194 nfsi->attrtimeo_timestamp = jiffies;
11971195 } else {
11981196 if (S_ISDIR(inode->i_mode)) {
1199− nfsi->cache_validity |= NFS_INO_INVALID_DATA;
1197+ cache_validity |= NFS_INO_INVALID_DATA;
12001198 nfs_force_lookup_revalidate(inode);
12011199 } else {
12021200 if (!NFS_PROTO(inode)->have_delegation(inode,
12031201 FMODE_READ))
1204− nfsi->cache_validity |= NFS_INO_REVAL_PAGECACHE;
1202+ cache_validity |= NFS_INO_REVAL_PAGECACHE;
12051203 }
12061204
12071205 if (cinfo->before != inode_peek_iversion_raw(inode))
1208− nfsi->cache_validity |= NFS_INO_INVALID_ACCESS |
1209− NFS_INO_INVALID_ACL |
1210− NFS_INO_INVALID_XATTR;
1206+ cache_validity |= NFS_INO_INVALID_ACCESS |
1207+ NFS_INO_INVALID_ACL |
1208+ NFS_INO_INVALID_XATTR;
12111209 }
12121210 inode_set_iversion_raw(inode, cinfo->after);
12131211 nfsi->read_cache_jiffies = timestamp;
12141212 nfsi->attr_gencount = nfs_inc_attr_generation_counter();
1213+ nfs_set_cache_invalid(inode, cache_validity);
12151214 nfsi->cache_validity &= ~NFS_INO_INVALID_CHANGE;
1216−
1217− if (nfsi->cache_validity & NFS_INO_INVALID_DATA)
1218− nfs_fscache_invalidate(inode);
12191215 }
12201216
12211217 void
@@ -5893,6 +5889,9 @@ static int __nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t bufl · 4671 unmodified lines
58935889 unsigned int npages = DIV_ROUND_UP(buflen, PAGE_SIZE);
58945890 int ret, i;
58955891
5892+ /* You can't remove system.nfs4_acl: */
5893+ if (buflen == 0)
5894+ return -EINVAL;
58965895 if (!nfs4_server_supports_acls(server))
58975896 return -EOPNOTSUPP;
58985897 if (npages > ARRAY_SIZE(pages))
@@ -5915,9 +5914,9 @@ static int __nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t bufl · 16 unmodified lines
59155914 * so mark the attribute cache invalid.
59165915 */
59175916 spin_lock(&inode->i_lock);
5918− NFS_I(inode)->cache_validity |= NFS_INO_INVALID_CHANGE
5919− | NFS_INO_INVALID_CTIME
5920− | NFS_INO_REVAL_FORCED;
5917+ nfs_set_cache_invalid(inode, NFS_INO_INVALID_CHANGE |
5918+ NFS_INO_INVALID_CTIME |
5919+ NFS_INO_REVAL_FORCED);
59215920 spin_unlock(&inode->i_lock);
59225921 nfs_access_zap_cache(inode);
59235922 nfs_zap_acl_cache(inode);
@@ -5969,7 +5968,7 @@ static int _nfs4_get_security_label(struct inode *inode, void *buf, · 45 unmodified lines
59695968 return ret;
59705969 if (!(fattr.valid & NFS_ATTR_FATTR_V4_SECURITY_LABEL))
59715970 return -ENOENT;
5972− return 0;
5971+ return label.len;
59735972 }
59745973
59755974 static int nfs4_get_security_label(struct inode *inode, void *buf,
fs/nfs/unlink.c+3−3
@@ -500,9 +500,9 @@ nfs_sillyrename(struct inode *dir, struct dentry *dentry) · 499 unmodified lines
500500 nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
501501 spin_lock(&inode->i_lock);
502502 NFS_I(inode)->attr_gencount = nfs_inc_attr_generation_counter();
503− NFS_I(inode)->cache_validity |= NFS_INO_INVALID_CHANGE
504− | NFS_INO_INVALID_CTIME
505− | NFS_INO_REVAL_FORCED;
503+ nfs_set_cache_invalid(inode, NFS_INO_INVALID_CHANGE |
504+ NFS_INO_INVALID_CTIME |
505+ NFS_INO_REVAL_FORCED);
506506 spin_unlock(&inode->i_lock);
507507 d_move(dentry, sdentry);
508508 break;
fs/nfs/write.c+4−4
@@ -303,9 +303,9 @@ static void nfs_set_pageerror(struct address_space *mapping) · 302 unmodified lines
303303 nfs_zap_mapping(mapping->host, mapping);
304304 /* Force file size revalidation */
305305 spin_lock(&inode->i_lock);
306− NFS_I(inode)->cache_validity |= NFS_INO_REVAL_FORCED |
307− NFS_INO_REVAL_PAGECACHE |
308− NFS_INO_INVALID_SIZE;
306+ nfs_set_cache_invalid(inode, NFS_INO_REVAL_FORCED |
307+ NFS_INO_REVAL_PAGECACHE |
308+ NFS_INO_INVALID_SIZE);
309309 spin_unlock(&inode->i_lock);
310310 }
311311
@@ -1604,7 +1604,7 @@ static int nfs_writeback_done(struct rpc_task *task, · 1292 unmodified lines
16041604 /* Deal with the suid/sgid bit corner case */
16051605 if (nfs_should_remove_suid(inode)) {
16061606 spin_lock(&inode->i_lock);
1607− NFS_I(inode)->cache_validity |= NFS_INO_INVALID_OTHER;
1607+ nfs_set_cache_invalid(inode, NFS_INO_INVALID_OTHER);
16081608 spin_unlock(&inode->i_lock);
16091609 }
16101610 return 0;
fs/nfsd/Kconfig+1−0
@@ -73,6 +73,7 @@ config NFSD_V4 · 72 unmodified lines
7373 select NFSD_V3
7474 select FS_POSIX_ACL
7575 select SUNRPC_GSS
76+ select CRYPTO
7677 select CRYPTO_MD5
7778 select CRYPTO_SHA256
7879 select GRACE_PERIOD
fs/nfsd/filecache.c+2−0
@@ -898,6 +898,8 @@ nfsd_file_find_locked(struct inode *inode, unsigned int may_flags, · 897 unmodified lines
898898 continue;
899899 if (!nfsd_match_cred(nf->nf_cred, current_cred()))
900900 continue;
901+ if (!test_bit(NFSD_FILE_HASHED, &nf->nf_flags))
902+ continue;
901903 if (nfsd_file_get(nf) != NULL)
902904 return nf;
903905 }
fs/nfsd/nfs4callback.c+1−0
@@ -1189,6 +1189,7 @@ static void nfsd4_cb_done(struct rpc_task *task, void *calldata) · 1188 unmodified lines
11891189 switch (task->tk_status) {
11901190 case -EIO:
11911191 case -ETIMEDOUT:
1192+ case -EACCES:
11921193 nfsd4_mark_cb_down(clp, task->tk_status);
11931194 }
11941195 break;
fs/nfsd/nfs4proc.c+1−1
@@ -1302,7 +1302,7 @@ nfsd4_cleanup_inter_ssc(struct vfsmount *ss_mnt, struct nfsd_file *src, · 1301 unmodified lines
13021302 struct nfsd_file *dst)
13031303 {
13041304 nfs42_ssc_close(src->nf_file);
1305− /* 'src' is freed by nfsd4_do_async_copy */
1305+ fput(src->nf_file);
13061306 nfsd_file_put(dst);
13071307 mntput(ss_mnt);
13081308 }
fs/nfsd/nfs4state.c+15−40
@@ -4940,31 +4940,6 @@ static struct file_lock *nfs4_alloc_init_lease(struct nfs4_delegation *dp, · 4939 unmodified lines
49404940 return fl;
49414941 }
49424942
4943−static int nfsd4_check_conflicting_opens(struct nfs4_client *clp,
4944− struct nfs4_file *fp)
4945−{
4946− struct nfs4_clnt_odstate *co;
4947− struct file *f = fp->fi_deleg_file->nf_file;
4948− struct inode *ino = locks_inode(f);
4949− int writes = atomic_read(&ino->i_writecount);
4950−
4951− if (fp->fi_fds[O_WRONLY])
4952− writes--;
4953− if (fp->fi_fds[O_RDWR])
4954− writes--;
4955− if (writes > 0)
4956− return -EAGAIN;
4957− spin_lock(&fp->fi_lock);
4958− list_for_each_entry(co, &fp->fi_clnt_odstate, co_perfile) {
4959− if (co->co_client != clp) {
4960− spin_unlock(&fp->fi_lock);
4961− return -EAGAIN;
4962− }
4963− }
4964− spin_unlock(&fp->fi_lock);
4965− return 0;
4966−}
4967−
49684943 static struct nfs4_delegation *
49694944 nfs4_set_delegation(struct nfs4_client *clp, struct svc_fh *fh,
49704945 struct nfs4_file *fp, struct nfs4_clnt_odstate *odstate)
@@ -4984,12 +4959,9 @@ nfs4_set_delegation(struct nfs4_client *clp, struct svc_fh *fh, · 13 unmodified lines
49844959
49854960 nf = find_readable_file(fp);
49864961 if (!nf) {
4987− /*
4988− * We probably could attempt another open and get a read
4989− * delegation, but for now, don't bother until the
4990− * client actually sends us one.
4991− */
4992− return ERR_PTR(-EAGAIN);
4962+ /* We should always have a readable file here */
4963+ WARN_ON_ONCE(1);
4964+ return ERR_PTR(-EBADF);
49934965 }
49944966 spin_lock(&state_lock);
49954967 spin_lock(&fp->fi_lock);
@@ -5019,19 +4991,11 @@ nfs4_set_delegation(struct nfs4_client *clp, struct svc_fh *fh, · 23 unmodified lines
50194991 if (!fl)
50204992 goto out_clnt_odstate;
50214993
5022− status = nfsd4_check_conflicting_opens(clp, fp);
5023− if (status) {
5024− locks_free_lock(fl);
5025− goto out_clnt_odstate;
5026− }
50274994 status = vfs_setlease(fp->fi_deleg_file->nf_file, fl->fl_type, &fl, NULL);
50284995 if (fl)
50294996 locks_free_lock(fl);
50304997 if (status)
50314998 goto out_clnt_odstate;
5032− status = nfsd4_check_conflicting_opens(clp, fp);
5033− if (status)
5034− goto out_clnt_odstate;
50354999
50365000 spin_lock(&state_lock);
50375001 spin_lock(&fp->fi_lock);
@@ -5113,6 +5077,17 @@ nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open, · 75 unmodified lines
51135077 goto out_no_deleg;
51145078 if (!cb_up || !(oo->oo_flags & NFS4_OO_CONFIRMED))
51155079 goto out_no_deleg;
5080+ /*
5081+ * Also, if the file was opened for write or
5082+ * create, there's a good chance the client's
5083+ * about to write to it, resulting in an
5084+ * immediate recall (since we don't support
5085+ * write delegations):
5086+ */
5087+ if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE)
5088+ goto out_no_deleg;
5089+ if (open->op_create == NFS4_OPEN_CREATE)
5090+ goto out_no_deleg;
51165091 break;
51175092 default:
51185093 goto out_no_deleg;
@@ -5389,7 +5364,7 @@ nfs4_laundromat(struct nfsd_net *nn) · 270 unmodified lines
53895364 idr_for_each_entry(&nn->s2s_cp_stateids, cps_t, i) {
53905365 cps = container_of(cps_t, struct nfs4_cpntf_state, cp_stateid);
53915366 if (cps->cp_stateid.sc_type == NFS4_COPYNOTIFY_STID &&
5392− cps->cpntf_time > cutoff)
5367+ cps->cpntf_time < cutoff)
53935368 _free_cpntf_state_locked(nn, cps);
53945369 }
53955370 spin_unlock(&nn->s2s_cp_lock);
fs/nilfs2/segbuf.c+1−1
@@ -399,7 +399,7 @@ static void nilfs_segbuf_prepare_write(struct nilfs_segment_buffer *segbuf, · 398 unmodified lines
399399 {
400400 wi->bio = NULL;
401401 wi->rest_blocks = segbuf->sb_sum.nblocks;
402− wi->max_pages = BIO_MAX_PAGES;
402+ wi->max_pages = BIO_MAX_VECS;
403403 wi->nr_vecs = min(wi->max_pages, wi->rest_blocks);
404404 wi->start = wi->end = 0;
405405 wi->blocknr = segbuf->sb_pseg_start;
fs/pnode.h+1−1
@@ -12,7 +12,7 @@ · 11 unmodified lines
1212
1313 #define IS_MNT_SHARED(m) ((m)->mnt.mnt_flags & MNT_SHARED)
1414 #define IS_MNT_SLAVE(m) ((m)->mnt_master)
15−#define IS_MNT_NEW(m) (!(m)->mnt_ns)
15+#define IS_MNT_NEW(m) (!(m)->mnt_ns || is_anon_ns((m)->mnt_ns))
1616 #define CLEAR_MNT_SHARED(m) ((m)->mnt.mnt_flags &= ~MNT_SHARED)
1717 #define IS_MNT_UNBINDABLE(m) ((m)->mnt.mnt_flags & MNT_UNBINDABLE)
1818 #define IS_MNT_MARKED(m) ((m)->mnt.mnt_flags & MNT_MARKED)
fs/proc/task_mmu.c+0−2
@@ -1036,8 +1036,6 @@ struct clear_refs_private { · 1035 unmodified lines
10361036
10371037 #ifdef CONFIG_MEM_SOFT_DIRTY
10381038
1039−#define is_cow_mapping(flags) (((flags) & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE)
1040−
10411039 static inline bool pte_is_pinned(struct vm_area_struct *vma, unsigned long addr, pte_t pte)
10421040 {
10431041 struct page *page;
fs/squashfs/block.c+1−1
@@ -87,7 +87,7 @@ static int squashfs_bio_read(struct super_block *sb, u64 index, int length, · 86 unmodified lines
8787 int error, i;
8888 struct bio *bio;
8989
90− if (page_count <= BIO_MAX_PAGES)
90+ if (page_count <= BIO_MAX_VECS)
9191 bio = bio_alloc(GFP_NOIO, page_count);
9292 else
9393 bio = bio_kmalloc(GFP_NOIO, page_count);
fs/zonefs/super.c+1−1
@@ -684,7 +684,7 @@ static ssize_t zonefs_file_dio_append(struct kiocb *iocb, struct iov_iter *from) · 683 unmodified lines
684684 max = ALIGN_DOWN(max << SECTOR_SHIFT, inode->i_sb->s_blocksize);
685685 iov_iter_truncate(from, max);
686686
687− nr_pages = iov_iter_npages(from, BIO_MAX_PAGES);
687+ nr_pages = iov_iter_npages(from, BIO_MAX_VECS);
688688 if (!nr_pages)
689689 return 0;
690690
include/kvm/arm_pmu.h+7−2
@@ -13,6 +13,13 @@ · 12 unmodified lines
1313 #define ARMV8_PMU_CYCLE_IDX (ARMV8_PMU_MAX_COUNTERS - 1)
1414 #define ARMV8_PMU_MAX_COUNTER_PAIRS ((ARMV8_PMU_MAX_COUNTERS + 1) >> 1)
1515
16+DECLARE_STATIC_KEY_FALSE(kvm_arm_pmu_available);
17+
18+static __always_inline bool kvm_arm_support_pmu_v3(void)
19+{
20+ return static_branch_likely(&kvm_arm_pmu_available);
21+}
22+
1623 #ifdef CONFIG_HW_PERF_EVENTS
1724
1825 struct kvm_pmc {
@@ -47,7 +54,6 @@ void kvm_pmu_software_increment(struct kvm_vcpu *vcpu, u64 val); · 28 unmodified lines
4754 void kvm_pmu_handle_pmcr(struct kvm_vcpu *vcpu, u64 val);
4855 void kvm_pmu_set_counter_event_type(struct kvm_vcpu *vcpu, u64 data,
4956 u64 select_idx);
50−bool kvm_arm_support_pmu_v3(void);
5157 int kvm_arm_pmu_v3_set_attr(struct kvm_vcpu *vcpu,
5258 struct kvm_device_attr *attr);
5359 int kvm_arm_pmu_v3_get_attr(struct kvm_vcpu *vcpu,
@@ -87,7 +93,6 @@ static inline void kvm_pmu_software_increment(struct kvm_vcpu *vcpu, u64 val) {} · 33 unmodified lines
8793 static inline void kvm_pmu_handle_pmcr(struct kvm_vcpu *vcpu, u64 val) {}
8894 static inline void kvm_pmu_set_counter_event_type(struct kvm_vcpu *vcpu,
8995 u64 data, u64 select_idx) {}
90−static inline bool kvm_arm_support_pmu_v3(void) { return false; }
9196 static inline int kvm_arm_pmu_v3_set_attr(struct kvm_vcpu *vcpu,
9297 struct kvm_device_attr *attr)
9398 {
include/linux/acpi.h+8−2
@@ -1079,19 +1079,25 @@ void __acpi_handle_debug(struct _ddebug *descriptor, acpi_handle handle, const c · 1078 unmodified lines
10791079 #if defined(CONFIG_ACPI) && defined(CONFIG_GPIOLIB)
10801080 bool acpi_gpio_get_irq_resource(struct acpi_resource *ares,
10811081 struct acpi_resource_gpio **agpio);
1082−int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index);
1082+int acpi_dev_gpio_irq_get_by(struct acpi_device *adev, const char *name, int index);
10831083 #else
10841084 static inline bool acpi_gpio_get_irq_resource(struct acpi_resource *ares,
10851085 struct acpi_resource_gpio **agpio)
10861086 {
10871087 return false;
10881088 }
1089−static inline int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index)
1089+static inline int acpi_dev_gpio_irq_get_by(struct acpi_device *adev,
1090+ const char *name, int index)
10901091 {
10911092 return -ENXIO;
10921093 }
10931094 #endif
10941095
1096+static inline int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index)
1097+{
1098+ return acpi_dev_gpio_irq_get_by(adev, NULL, index);
1099+}
1100+
10951101 /* Device properties */
10961102
10971103 #ifdef CONFIG_ACPI
include/linux/atmdev.h+1−1
@@ -151,7 +151,7 @@ struct atm_dev { · 150 unmodified lines
151151 const char *type; /* device type name */
152152 int number; /* device index */
153153 void *dev_data; /* per-device data */
154− void *phy_data; /* private PHY date */
154+ void *phy_data; /* private PHY data */
155155 unsigned long flags; /* device flags (ATM_DF_*) */
156156 struct list_head local; /* local ATM addresses */
157157 struct list_head lecs; /* LECS ATM addresses learned via ILMI */
include/linux/bio.h+2−2
@@ -20,11 +20,11 @@ · 19 unmodified lines
2020 #define BIO_BUG_ON
2121 #endif
2222
23−#define BIO_MAX_PAGES 256U
23+#define BIO_MAX_VECS 256U
2424
2525 static inline unsigned int bio_max_segs(unsigned int nr_segs)
2626 {
27− return min(nr_segs, BIO_MAX_PAGES);
27+ return min(nr_segs, BIO_MAX_VECS);
2828 }
2929
3030 #define bio_prio(bio) (bio)->bi_ioprio
include/linux/can/skb.h+6−2
@@ -65,8 +65,12 @@ static inline void can_skb_reserve(struct sk_buff *skb) · 64 unmodified lines
6565
6666 static inline void can_skb_set_owner(struct sk_buff *skb, struct sock *sk)
6767 {
68− if (sk) {
69− sock_hold(sk);
68+ /* If the socket has already been closed by user space, the
69+ * refcount may already be 0 (and the socket will be freed
70+ * after the last TX skb has been freed). So only increase
71+ * socket refcount if the refcount is > 0.
72+ */
73+ if (sk && refcount_inc_not_zero(&sk->sk_refcnt)) {
7074 skb->destructor = sock_efree;
7175 skb->sk = sk;
7276 }
include/linux/compiler-clang.h+6−0
@@ -31,6 +31,12 @@ · 30 unmodified lines
3131 #define __no_sanitize_thread
3232 #endif
3333
34+#if defined(CONFIG_ARCH_USE_BUILTIN_BSWAP)
35+#define __HAVE_BUILTIN_BSWAP32__
36+#define __HAVE_BUILTIN_BSWAP64__
37+#define __HAVE_BUILTIN_BSWAP16__
38+#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
39+
3440 #if __has_feature(undefined_behavior_sanitizer)
3541 /* GCC does not have __SANITIZE_UNDEFINED__ */
3642 #define __no_sanitize_undefined \
include/linux/compiler-version.h+14−0
@@ -0,0 +1,14 @@
1+/* SPDX-License-Identifier: GPL-2.0-only */
2+
3+#ifdef __LINUX_COMPILER_VERSION_H
4+#error "Please do not include <linux/compiler-version.h>. This is done by the build system."
5+#endif
6+#define __LINUX_COMPILER_VERSION_H
7+
8+/*
9+ * This header exists to force full rebuild when the compiler is upgraded.
10+ *
11+ * When fixdep scans this, it will find this string "CONFIG_CC_VERSION_TEXT"
12+ * and add dependency on include/config/cc/version/text.h, which is touched
13+ * by Kconfig when the version string from the compiler changes.
14+ */
include/linux/cpu.h+3−0
@@ -108,6 +108,8 @@ static inline void cpu_maps_update_done(void) · 107 unmodified lines
108108 {
109109 }
110110
111+static inline int add_cpu(unsigned int cpu) { return 0;}
112+
111113 #endif /* CONFIG_SMP */
112114 extern struct bus_type cpu_subsys;
113115
@@ -137,6 +139,7 @@ static inline int cpus_read_trylock(void) { return true; } · 23 unmodified lines
137139 static inline void lockdep_assert_cpus_held(void) { }
138140 static inline void cpu_hotplug_disable(void) { }
139141 static inline void cpu_hotplug_enable(void) { }
142+static inline int remove_cpu(unsigned int cpu) { return -EPERM; }
140143 static inline void smp_shutdown_nonboot_cpus(unsigned int primary_cpu) { }
141144 #endif /* !CONFIG_HOTPLUG_CPU */
142145
include/linux/gpio/consumer.h+2−0
@@ -674,6 +674,8 @@ struct acpi_gpio_mapping { · 673 unmodified lines
674674 * get GpioIo type explicitly, this quirk may be used.
675675 */
676676 #define ACPI_GPIO_QUIRK_ONLY_GPIOIO BIT(1)
677+/* Use given pin as an absolute GPIO number in the system */
678+#define ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER BIT(2)
677679
678680 unsigned int quirks;
679681 };
include/linux/io_uring.h+1−1
@@ -18,7 +18,7 @@ struct io_uring_task { · 17 unmodified lines
1818 /* submission side */
1919 struct xarray xa;
2020 struct wait_queue_head wait;
21− struct file *last;
21+ void *last;
2222 void *io_wq;
2323 struct percpu_counter inflight;
2424 atomic_t in_idle;
include/linux/irqdomain.h+0−4
@@ -150,7 +150,6 @@ struct irq_domain_chip_generic; · 149 unmodified lines
150150 * setting up one or more generic chips for interrupt controllers
151151 * drivers using the generic chip library which uses this pointer.
152152 * @parent: Pointer to parent irq_domain to support hierarchy irq_domains
153− * @debugfs_file: dentry for the domain debugfs file
154153 *
155154 * Revmap data, used internally by irq_domain
156155 * @revmap_direct_max_irq: The largest hwirq that can be set for controllers that
@@ -174,9 +173,6 @@ struct irq_domain { · 17 unmodified lines
174173 #ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
175174 struct irq_domain *parent;
176175 #endif
177−#ifdef CONFIG_GENERIC_IRQ_DEBUGFS
178− struct dentry *debugfs_file;
179−#endif
180176
181177 /* reverse map data. The linear map gets appended to the irq_domain */
182178 irq_hw_number_t hwirq_max;
include/linux/kconfig.h+0−2
@@ -2,8 +2,6 @@ · 1 unmodified line
22 #ifndef __LINUX_KCONFIG_H
33 #define __LINUX_KCONFIG_H
44
5−/* CONFIG_CC_VERSION_TEXT (Do not delete this comment. See help in Kconfig) */
6−
75 #include <generated/autoconf.h>
86
97 #ifdef CONFIG_CPU_BIG_ENDIAN
include/linux/memblock.h+2−2
@@ -460,7 +460,7 @@ static inline void memblock_free_late(phys_addr_t base, phys_addr_t size) · 459 unmodified lines
460460 /*
461461 * Set the allocation direction to bottom-up or top-down.
462462 */
463−static inline void memblock_set_bottom_up(bool enable)
463+static inline __init void memblock_set_bottom_up(bool enable)
464464 {
465465 memblock.bottom_up = enable;
466466 }
@@ -470,7 +470,7 @@ static inline void memblock_set_bottom_up(bool enable) · 3 unmodified lines
470470 * if this is true, that said, memblock will allocate memory
471471 * in bottom-up direction.
472472 */
473−static inline bool memblock_bottom_up(void)
473+static inline __init bool memblock_bottom_up(void)
474474 {
475475 return memblock.bottom_up;
476476 }
include/linux/memcontrol.h+2−4
@@ -1061,9 +1061,7 @@ static inline void memcg_memory_event_mm(struct mm_struct *mm, · 1060 unmodified lines
10611061 rcu_read_unlock();
10621062 }
10631063
1064−#ifdef CONFIG_TRANSPARENT_HUGEPAGE
1065−void mem_cgroup_split_huge_fixup(struct page *head);
1066−#endif
1064+void split_page_memcg(struct page *head, unsigned int nr);
10671065
10681066 #else /* CONFIG_MEMCG */
10691067
@@ -1400,7 +1398,7 @@ unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order, · 330 unmodified lines
14001398 return 0;
14011399 }
14021400
1403−static inline void mem_cgroup_split_huge_fixup(struct page *head)
1401+static inline void split_page_memcg(struct page *head, unsigned int nr)
14041402 {
14051403 }
14061404
include/linux/mm.h+21−0
@@ -1300,6 +1300,27 @@ static inline bool page_maybe_dma_pinned(struct page *page) · 1299 unmodified lines
13001300 GUP_PIN_COUNTING_BIAS;
13011301 }
13021302
1303+static inline bool is_cow_mapping(vm_flags_t flags)
1304+{
1305+ return (flags & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE;
1306+}
1307+
1308+/*
1309+ * This should most likely only be called during fork() to see whether we
1310+ * should break the cow immediately for a page on the src mm.
1311+ */
1312+static inline bool page_needs_cow_for_dma(struct vm_area_struct *vma,
1313+ struct page *page)
1314+{
1315+ if (!is_cow_mapping(vma->vm_flags))
1316+ return false;
1317+
1318+ if (!atomic_read(&vma->vm_mm->has_pinned))
1319+ return false;
1320+
1321+ return page_maybe_dma_pinned(page);
1322+}
1323+
13031324 #if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
13041325 #define SECTION_IN_PAGE_FLAGS
13051326 #endif
include/linux/mm_types.h+1−0
@@ -23,6 +23,7 @@ · 22 unmodified lines
2323 #endif
2424 #define AT_VECTOR_SIZE (2*(AT_VECTOR_SIZE_ARCH + AT_VECTOR_SIZE_BASE + 1))
2525
26+#define INIT_PASID 0
2627
2728 struct address_space;
2829 struct mem_cgroup;
include/linux/netdevice.h+0−2
@@ -3959,8 +3959,6 @@ int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack, · 3958 unmodified lines
39593959 int bpf_xdp_link_attach(const union bpf_attr *attr, struct bpf_prog *prog);
39603960 u32 dev_xdp_prog_id(struct net_device *dev, enum bpf_xdp_mode mode);
39613961
3962−int xdp_umem_query(struct net_device *dev, u16 queue_id);
3963−
39643962 int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
39653963 int dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
39663964 int dev_forward_skb_nomtu(struct net_device *dev, struct sk_buff *skb);
include/linux/perf_event.h+2−0
@@ -606,6 +606,7 @@ struct swevent_hlist { · 605 unmodified lines
606606 #define PERF_ATTACH_TASK 0x04
607607 #define PERF_ATTACH_TASK_DATA 0x08
608608 #define PERF_ATTACH_ITRACE 0x10
609+#define PERF_ATTACH_SCHED_CB 0x20
609610
610611 struct perf_cgroup;
611612 struct perf_buffer;
@@ -872,6 +873,7 @@ struct perf_cpu_context { · 260 unmodified lines
872873 struct list_head cgrp_cpuctx_entry;
873874 #endif
874875
876+ struct list_head sched_cb_entry;
875877 int sched_cb_usage;
876878
877879 int online;
include/linux/pgtable.h+4−0
@@ -904,6 +904,10 @@ static inline void ptep_modify_prot_commit(struct vm_area_struct *vma, · 903 unmodified lines
904904 #define pgprot_device pgprot_noncached
905905 #endif
906906
907+#ifndef pgprot_mhp
908+#define pgprot_mhp(prot) (prot)
909+#endif
910+
907911 #ifdef CONFIG_MMU
908912 #ifndef pgprot_modify
909913 #define pgprot_modify pgprot_modify
include/linux/property.h+1−1
@@ -488,7 +488,7 @@ fwnode_create_software_node(const struct property_entry *properties, · 487 unmodified lines
488488 const struct fwnode_handle *parent);
489489 void fwnode_remove_software_node(struct fwnode_handle *fwnode);
490490
491−int device_add_software_node(struct device *dev, const struct software_node *swnode);
491+int device_add_software_node(struct device *dev, const struct software_node *node);
492492 void device_remove_software_node(struct device *dev);
493493
494494 int device_create_managed_software_node(struct device *dev,
include/linux/regulator/pca9450.h+3−0
@@ -147,6 +147,9 @@ enum { · 146 unmodified lines
147147 #define BUCK6_FPWM 0x04
148148 #define BUCK6_ENMODE_MASK 0x03
149149
150+/* PCA9450_REG_BUCK123_PRESET_EN bit */
151+#define BUCK123_PRESET_EN 0x80
152+
150153 /* PCA9450_BUCK1OUT_DVS0 bits */
151154 #define BUCK1OUT_DVS0_MASK 0x7F
152155 #define BUCK1OUT_DVS0_DEFAULT 0x14
include/linux/sched/mm.h+2−1
@@ -140,7 +140,8 @@ static inline bool in_vfork(struct task_struct *tsk) · 139 unmodified lines
140140 * another oom-unkillable task does this it should blame itself.
141141 */
142142 rcu_read_lock();
143− ret = tsk->vfork_done && tsk->real_parent->mm == tsk->mm;
143+ ret = tsk->vfork_done &&
144+ rcu_dereference(tsk->real_parent)->mm == tsk->mm;
144145 rcu_read_unlock();
145146
146147 return ret;
include/linux/seqlock.h+1−4
@@ -664,10 +664,7 @@ typedef struct { · 663 unmodified lines
664664 * seqcount_latch_init() - runtime initializer for seqcount_latch_t
665665 * @s: Pointer to the seqcount_latch_t instance
666666 */
667−static inline void seqcount_latch_init(seqcount_latch_t *s)
668−{
669− seqcount_init(&s->seqcount);
670−}
667+#define seqcount_latch_init(s) seqcount_init(&(s)->seqcount)
671668
672669 /**
673670 * raw_read_seqcount_latch() - pick even/odd latch data copy
include/linux/stop_machine.h+6−5
@@ -128,7 +128,7 @@ int stop_machine_from_inactive_cpu(cpu_stop_fn_t fn, void *data, · 127 unmodified lines
128128 const struct cpumask *cpus);
129129 #else /* CONFIG_SMP || CONFIG_HOTPLUG_CPU */
130130
131−static inline int stop_machine_cpuslocked(cpu_stop_fn_t fn, void *data,
131+static __always_inline int stop_machine_cpuslocked(cpu_stop_fn_t fn, void *data,
132132 const struct cpumask *cpus)
133133 {
134134 unsigned long flags;
@@ -139,14 +139,15 @@ static inline int stop_machine_cpuslocked(cpu_stop_fn_t fn, void *data, · 4 unmodified lines
139139 return ret;
140140 }
141141
142−static inline int stop_machine(cpu_stop_fn_t fn, void *data,
143− const struct cpumask *cpus)
142+static __always_inline int
143+stop_machine(cpu_stop_fn_t fn, void *data, const struct cpumask *cpus)
144144 {
145145 return stop_machine_cpuslocked(fn, data, cpus);
146146 }
147147
148−static inline int stop_machine_from_inactive_cpu(cpu_stop_fn_t fn, void *data,
149− const struct cpumask *cpus)
148+static __always_inline int
149+stop_machine_from_inactive_cpu(cpu_stop_fn_t fn, void *data,
150+ const struct cpumask *cpus)
150151 {
151152 return stop_machine(fn, data, cpus);
152153 }
include/linux/sunrpc/svc_rdma.h+0−1
@@ -104,7 +104,6 @@ struct svcxprt_rdma { · 103 unmodified lines
104104
105105 wait_queue_head_t sc_send_wait; /* SQ exhaustion waitlist */
106106 unsigned long sc_flags;
107− u32 sc_pending_recvs;
108107 struct list_head sc_read_complete_q;
109108 struct work_struct sc_work;
110109
include/linux/textsearch.h+1−1
@@ -23,7 +23,7 @@ struct ts_config; · 22 unmodified lines
2323 struct ts_state
2424 {
2525 unsigned int offset;
26− char cb[40];
26+ char cb[48];
2727 };
2828
2929 /**
include/linux/u64_stats_sync.h+4−3
@@ -115,12 +115,13 @@ static inline void u64_stats_inc(u64_stats_t *p) · 114 unmodified lines
115115 }
116116 #endif
117117
118+#if BITS_PER_LONG == 32 && defined(CONFIG_SMP)
119+#define u64_stats_init(syncp) seqcount_init(&(syncp)->seq)
120+#else
118121 static inline void u64_stats_init(struct u64_stats_sync *syncp)
119122 {
120−#if BITS_PER_LONG == 32 && defined(CONFIG_SMP)
121− seqcount_init(&syncp->seq);
122−#endif
123123 }
124+#endif
124125
125126 static inline void u64_stats_update_begin(struct u64_stats_sync *syncp)
126127 {
include/linux/usb.h+2−0
@@ -746,6 +746,8 @@ extern int usb_lock_device_for_reset(struct usb_device *udev, · 745 unmodified lines
746746 extern int usb_reset_device(struct usb_device *dev);
747747 extern void usb_queue_reset_device(struct usb_interface *dev);
748748
749+extern struct device *usb_intf_get_dma_device(struct usb_interface *intf);
750+
749751 #ifdef CONFIG_ACPI
750752 extern int usb_acpi_set_power_state(struct usb_device *hdev, int index,
751753 bool enable);
include/linux/virtio_net.h+6−1
@@ -79,8 +79,13 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, · 78 unmodified lines
7979 if (gso_type && skb->network_header) {
8080 struct flow_keys_basic keys;
8181
82− if (!skb->protocol)
82+ if (!skb->protocol) {
83+ __be16 protocol = dev_parse_header_protocol(skb);
84+
8385 virtio_net_hdr_set_proto(skb, hdr);
86+ if (protocol && protocol != skb->protocol)
87+ return -EINVAL;
88+ }
8489 retry:
8590 if (!skb_flow_dissect_flow_keys_basic(NULL, skb, &keys,
8691 NULL, 0, 0, 0,
include/linux/ww_mutex.h+3−2
@@ -173,9 +173,10 @@ static inline void ww_acquire_done(struct ww_acquire_ctx *ctx) · 172 unmodified lines
173173 */
174174 static inline void ww_acquire_fini(struct ww_acquire_ctx *ctx)
175175 {
176−#ifdef CONFIG_DEBUG_MUTEXES
176+#ifdef CONFIG_DEBUG_LOCK_ALLOC
177177 mutex_release(&ctx->dep_map, _THIS_IP_);
178−
178+#endif
179+#ifdef CONFIG_DEBUG_MUTEXES
179180 DEBUG_LOCKS_WARN_ON(ctx->acquired);
180181 if (!IS_ENABLED(CONFIG_PROVE_LOCKING))
181182 /*
include/media/rc-map.h+7−0
@@ -175,6 +175,13 @@ struct rc_map_list { · 174 unmodified lines
175175 struct rc_map map;
176176 };
177177
178+#ifdef CONFIG_MEDIA_CEC_RC
179+/*
180+ * rc_map_list from rc-cec.c
181+ */
182+extern struct rc_map_list cec_map;
183+#endif
184+
178185 /* Routines from rc-map.c */
179186
180187 /**
include/uapi/linux/bpf.h+0−1
@@ -3850,7 +3850,6 @@ union bpf_attr { · 3849 unmodified lines
38503850 *
38513851 * long bpf_check_mtu(void *ctx, u32 ifindex, u32 *mtu_len, s32 len_diff, u64 flags)
38523852 * Description
3853−
38543853 * Check ctx packet size against exceeding MTU of net device (based
38553854 * on *ifindex*). This helper will likely be used in combination
38563855 * with helpers that adjust/change the packet size.
include/uapi/linux/fuse.h+2−1
@@ -903,7 +903,8 @@ struct fuse_notify_retrieve_in { · 902 unmodified lines
903903 };
904904
905905 /* Device ioctls: */
906−#define FUSE_DEV_IOC_CLONE _IOR(229, 0, uint32_t)
906+#define FUSE_DEV_IOC_MAGIC 229
907+#define FUSE_DEV_IOC_CLONE _IOR(FUSE_DEV_IOC_MAGIC, 0, uint32_t)
907908
908909 struct fuse_lseek_in {
909910 uint64_t fh;
include/uapi/linux/l2tp.h+1−0
@@ -145,6 +145,7 @@ enum { · 144 unmodified lines
145145 L2TP_ATTR_RX_ERRORS, /* u64 */
146146 L2TP_ATTR_STATS_PAD,
147147 L2TP_ATTR_RX_COOKIE_DISCARDS, /* u64 */
148+ L2TP_ATTR_RX_INVALID, /* u64 */
148149 __L2TP_ATTR_STATS_MAX,
149150 };
150151
include/uapi/linux/netfilter/nfnetlink_cthelper.h+1−1
@@ -5,7 +5,7 @@ · 4 unmodified lines
55 #define NFCT_HELPER_STATUS_DISABLED 0
66 #define NFCT_HELPER_STATUS_ENABLED 1
77
8−enum nfnl_acct_msg_types {
8+enum nfnl_cthelper_msg_types {
99 NFNL_MSG_CTHELPER_NEW,
1010 NFNL_MSG_CTHELPER_GET,
1111 NFNL_MSG_CTHELPER_DEL,
include/xen/grant_table.h+7−0
@@ -50,6 +50,13 @@ · 49 unmodified lines
5050 #include <linux/page-flags.h>
5151 #include <linux/kernel.h>
5252
53+/*
54+ * Technically there's no reliably invalid grant reference or grant handle,
55+ * so pick the value that is the most unlikely one to be observed valid.
56+ */
57+#define INVALID_GRANT_REF ((grant_ref_t)-1)
58+#define INVALID_GRANT_HANDLE ((grant_handle_t)-1)
59+
5360 #define GNTTAB_RESERVED_XENSTORE 1
5461
5562 /* NR_GRANT_FRAMES must be less than or equal to that configured in Xen */
include/xen/xenbus.h+0−1
@@ -51,7 +51,6 @@ · 50 unmodified lines
5151
5252 #define XENBUS_MAX_RING_GRANT_ORDER 4
5353 #define XENBUS_MAX_RING_GRANTS (1U << XENBUS_MAX_RING_GRANT_ORDER)
54−#define INVALID_GRANT_HANDLE (~0U)
5554
5655 /* Register callback to watch this node. */
5756 struct xenbus_watch
init/Kconfig+5−6
@@ -20,10 +20,10 @@ config CC_VERSION_TEXT · 19 unmodified lines
2020 When the compiler is updated, Kconfig will be invoked.
2121
2222 - Ensure full rebuild when the compiler is updated
23− include/linux/kconfig.h contains this option in the comment line so
24− fixdep adds include/config/cc/version/text.h into the auto-generated
25− dependency. When the compiler is updated, syncconfig will touch it
26− and then every file will be rebuilt.
23+ include/linux/compiler-version.h contains this option in the comment
24+ line so fixdep adds include/config/cc/version/text.h into the
25+ auto-generated dependency. When the compiler is updated, syncconfig
26+ will touch it and then every file will be rebuilt.
2727
2828 config CC_IS_GCC
2929 def_bool $(success,test "$(cc-name)" = GCC)
@@ -119,8 +119,7 @@ config INIT_ENV_ARG_LIMIT · 89 unmodified lines
119119
120120 config COMPILE_TEST
121121 bool "Compile also drivers which will not load"
122− depends on !UML && !S390
123− default n
122+ depends on HAS_IOMEM
124123 help
125124 Some drivers can be compiled on a different platform than they are
126125 intended to be run on. Despite they cannot be loaded there (or even
kernel/bpf/btf.c+0−2
@@ -4321,8 +4321,6 @@ btf_get_prog_ctx_type(struct bpf_verifier_log *log, struct btf *btf, · 4320 unmodified lines
43214321 * is not supported yet.
43224322 * BPF_PROG_TYPE_RAW_TRACEPOINT is fine.
43234323 */
4324− if (log->level & BPF_LOG_LEVEL)
4325− bpf_log(log, "arg#%d type is not a struct\n", arg);
43264324 return NULL;
43274325 }
43284326 tname = btf_name_by_offset(btf, t->name_off);
kernel/bpf/core.c+6−0
@@ -1118,6 +1118,8 @@ static void bpf_prog_clone_free(struct bpf_prog *fp) · 1117 unmodified lines
11181118 * clone is guaranteed to not be locked.
11191119 */
11201120 fp->aux = NULL;
1121+ fp->stats = NULL;
1122+ fp->active = NULL;
11211123 __bpf_prog_free(fp);
11221124 }
11231125
@@ -2342,6 +2344,10 @@ bool __weak bpf_helper_changes_pkt_data(void *func) · 1218 unmodified lines
23422344 /* Return TRUE if the JIT backend wants verifier to enable sub-register usage
23432345 * analysis code and wants explicit zero extension inserted by verifier.
23442346 * Otherwise, return FALSE.
2347+ *
2348+ * The verifier inserts an explicit zero extension after BPF_CMPXCHGs even if
2349+ * you don't override this. JITs that don't want these extra insns can detect
2350+ * them using insn_is_zext.
23452351 */
23462352 bool __weak bpf_jit_needs_zext(void)
23472353 {
kernel/bpf/verifier.c+58−33
@@ -504,6 +504,13 @@ static bool is_ptr_cast_function(enum bpf_func_id func_id) · 503 unmodified lines
504504 func_id == BPF_FUNC_skc_to_tcp_request_sock;
505505 }
506506
507+static bool is_cmpxchg_insn(const struct bpf_insn *insn)
508+{
509+ return BPF_CLASS(insn->code) == BPF_STX &&
510+ BPF_MODE(insn->code) == BPF_ATOMIC &&
511+ insn->imm == BPF_CMPXCHG;
512+}
513+
507514 /* string representation of 'enum bpf_reg_type' */
508515 static const char * const reg_type_str[] = {
509516 [NOT_INIT] = "?",
@@ -1120,7 +1127,7 @@ static void mark_ptr_not_null_reg(struct bpf_reg_state *reg) · 610 unmodified lines
11201127 reg->type = PTR_TO_RDWR_BUF;
11211128 break;
11221129 default:
1123− WARN_ON("unknown nullable register type");
1130+ WARN_ONCE(1, "unknown nullable register type");
11241131 }
11251132 }
11261133
@@ -1703,7 +1710,11 @@ static bool is_reg64(struct bpf_verifier_env *env, struct bpf_insn *insn, · 576 unmodified lines
17031710 }
17041711
17051712 if (class == BPF_STX) {
1706− if (reg->type != SCALAR_VALUE)
1713+ /* BPF_STX (including atomic variants) has multiple source
1714+ * operands, one of which is a ptr. Check whether the caller is
1715+ * asking about it.
1716+ */
1717+ if (t == SRC_OP && reg->type != SCALAR_VALUE)
17071718 return true;
17081719 return BPF_SIZE(code) == BPF_DW;
17091720 }
@@ -1735,22 +1746,38 @@ static bool is_reg64(struct bpf_verifier_env *env, struct bpf_insn *insn, · 25 unmodified lines
17351746 return true;
17361747 }
17371748
1738−/* Return TRUE if INSN doesn't have explicit value define. */
1739−static bool insn_no_def(struct bpf_insn *insn)
1749+/* Return the regno defined by the insn, or -1. */
1750+static int insn_def_regno(const struct bpf_insn *insn)
17401751 {
1741− u8 class = BPF_CLASS(insn->code);
1742−
1743− return (class == BPF_JMP || class == BPF_JMP32 ||
1744− class == BPF_STX || class == BPF_ST);
1752+ switch (BPF_CLASS(insn->code)) {
1753+ case BPF_JMP:
1754+ case BPF_JMP32:
1755+ case BPF_ST:
1756+ return -1;
1757+ case BPF_STX:
1758+ if (BPF_MODE(insn->code) == BPF_ATOMIC &&
1759+ (insn->imm & BPF_FETCH)) {
1760+ if (insn->imm == BPF_CMPXCHG)
1761+ return BPF_REG_0;
1762+ else
1763+ return insn->src_reg;
1764+ } else {
1765+ return -1;
1766+ }
1767+ default:
1768+ return insn->dst_reg;
1769+ }
17451770 }
17461771
17471772 /* Return TRUE if INSN has defined any 32-bit value explicitly. */
17481773 static bool insn_has_def32(struct bpf_verifier_env *env, struct bpf_insn *insn)
17491774 {
1750− if (insn_no_def(insn))
1775+ int dst_reg = insn_def_regno(insn);
1776+
1777+ if (dst_reg == -1)
17511778 return false;
17521779
1753− return !is_reg64(env, insn, insn->dst_reg, NULL, DST_OP);
1780+ return !is_reg64(env, insn, dst_reg, NULL, DST_OP);
17541781 }
17551782
17561783 static void mark_insn_zext(struct bpf_verifier_env *env,
@@ -11006,9 +11033,10 @@ static int opt_subreg_zext_lo32_rnd_hi32(struct bpf_verifier_env *env, · 9249 unmodified lines
1100611033 for (i = 0; i < len; i++) {
1100711034 int adj_idx = i + delta;
1100811035 struct bpf_insn insn;
11009− u8 load_reg;
11036+ int load_reg;
1101011037
1101111038 insn = insns[adj_idx];
11039+ load_reg = insn_def_regno(&insn);
1101211040 if (!aux[adj_idx].zext_dst) {
1101311041 u8 code, class;
1101411042 u32 imm_rnd;
@@ -11018,14 +11046,14 @@ static int opt_subreg_zext_lo32_rnd_hi32(struct bpf_verifier_env *env, · 3 unmodified lines
1101811046
1101911047 code = insn.code;
1102011048 class = BPF_CLASS(code);
11021− if (insn_no_def(&insn))
11049+ if (load_reg == -1)
1102211050 continue;
1102311051
1102411052 /* NOTE: arg "reg" (the fourth one) is only used for
11025− * BPF_STX which has been ruled out in above
11026− * check, it is safe to pass NULL here.
11053+ * BPF_STX + SRC_OP, so it is safe to pass NULL
11054+ * here.
1102711055 */
11028− if (is_reg64(env, &insn, insn.dst_reg, NULL, DST_OP)) {
11056+ if (is_reg64(env, &insn, load_reg, NULL, DST_OP)) {
1102911057 if (class == BPF_LD &&
1103011058 BPF_MODE(code) == BPF_IMM)
1103111059 i++;
@@ -11040,31 +11068,28 @@ static int opt_subreg_zext_lo32_rnd_hi32(struct bpf_verifier_env *env, · 8 unmodified lines
1104011068 imm_rnd = get_random_int();
1104111069 rnd_hi32_patch[0] = insn;
1104211070 rnd_hi32_patch[1].imm = imm_rnd;
11043− rnd_hi32_patch[3].dst_reg = insn.dst_reg;
11071+ rnd_hi32_patch[3].dst_reg = load_reg;
1104411072 patch = rnd_hi32_patch;
1104511073 patch_len = 4;
1104611074 goto apply_patch_buffer;
1104711075 }
1104811076
11049− if (!bpf_jit_needs_zext())
11077+ /* Add in an zero-extend instruction if a) the JIT has requested
11078+ * it or b) it's a CMPXCHG.
11079+ *
11080+ * The latter is because: BPF_CMPXCHG always loads a value into
11081+ * R0, therefore always zero-extends. However some archs'
11082+ * equivalent instruction only does this load when the
11083+ * comparison is successful. This detail of CMPXCHG is
11084+ * orthogonal to the general zero-extension behaviour of the
11085+ * CPU, so it's treated independently of bpf_jit_needs_zext.
11086+ */
11087+ if (!bpf_jit_needs_zext() && !is_cmpxchg_insn(&insn))
1105011088 continue;
1105111089
11052− /* zext_dst means that we want to zero-extend whatever register
11053− * the insn defines, which is dst_reg most of the time, with
11054− * the notable exception of BPF_STX + BPF_ATOMIC + BPF_FETCH.
11055− */
11056− if (BPF_CLASS(insn.code) == BPF_STX &&
11057− BPF_MODE(insn.code) == BPF_ATOMIC) {
11058− /* BPF_STX + BPF_ATOMIC insns without BPF_FETCH do not
11059− * define any registers, therefore zext_dst cannot be
11060− * set.
11061− */
11062− if (WARN_ON(!(insn.imm & BPF_FETCH)))
11063− return -EINVAL;
11064− load_reg = insn.imm == BPF_CMPXCHG ? BPF_REG_0
11065− : insn.src_reg;
11066− } else {
11067− load_reg = insn.dst_reg;
11090+ if (WARN_ON(load_reg == -1)) {
11091+ verbose(env, "verifier bug. zext_dst is set, but no reg is defined\n");
11092+ return -EFAULT;
1106811093 }
1106911094
1107011095 zext_patch[0] = insn;
kernel/events/core.c+38−4
@@ -386,6 +386,7 @@ static DEFINE_MUTEX(perf_sched_mutex); · 385 unmodified lines
386386 static atomic_t perf_sched_count;
387387
388388 static DEFINE_PER_CPU(atomic_t, perf_cgroup_events);
389+static DEFINE_PER_CPU(int, perf_sched_cb_usages);
389390 static DEFINE_PER_CPU(struct pmu_event_list, pmu_sb_events);
390391
391392 static atomic_t nr_mmap_events __read_mostly;
@@ -3461,11 +3462,16 @@ unlock: · 3069 unmodified lines
34613462 }
34623463 }
34633464
3465+static DEFINE_PER_CPU(struct list_head, sched_cb_list);
3466+
34643467 void perf_sched_cb_dec(struct pmu *pmu)
34653468 {
34663469 struct perf_cpu_context *cpuctx = this_cpu_ptr(pmu->pmu_cpu_context);
34673470
3468− --cpuctx->sched_cb_usage;
3471+ this_cpu_dec(perf_sched_cb_usages);
3472+
3473+ if (!--cpuctx->sched_cb_usage)
3474+ list_del(&cpuctx->sched_cb_entry);
34693475 }
34703476
34713477
@@ -3473,7 +3479,10 @@ void perf_sched_cb_inc(struct pmu *pmu) · 1 unmodified line
34733479 {
34743480 struct perf_cpu_context *cpuctx = this_cpu_ptr(pmu->pmu_cpu_context);
34753481
3476− cpuctx->sched_cb_usage++;
3482+ if (!cpuctx->sched_cb_usage++)
3483+ list_add(&cpuctx->sched_cb_entry, this_cpu_ptr(&sched_cb_list));
3484+
3485+ this_cpu_inc(perf_sched_cb_usages);
34773486 }
34783487
34793488 /*
@@ -3502,6 +3511,24 @@ static void __perf_pmu_sched_task(struct perf_cpu_context *cpuctx, bool sched_in · 22 unmodified lines
35023511 perf_ctx_unlock(cpuctx, cpuctx->task_ctx);
35033512 }
35043513
3514+static void perf_pmu_sched_task(struct task_struct *prev,
3515+ struct task_struct *next,
3516+ bool sched_in)
3517+{
3518+ struct perf_cpu_context *cpuctx;
3519+
3520+ if (prev == next)
3521+ return;
3522+
3523+ list_for_each_entry(cpuctx, this_cpu_ptr(&sched_cb_list), sched_cb_entry) {
3524+ /* will be handled in perf_event_context_sched_in/out */
3525+ if (cpuctx->task_ctx)
3526+ continue;
3527+
3528+ __perf_pmu_sched_task(cpuctx, sched_in);
3529+ }
3530+}
3531+
35053532 static void perf_event_switch(struct task_struct *task,
35063533 struct task_struct *next_prev, bool sched_in);
35073534
@@ -3524,6 +3551,9 @@ void __perf_event_task_sched_out(struct task_struct *task, · 16 unmodified lines
35243551 {
35253552 int ctxn;
35263553
3554+ if (__this_cpu_read(perf_sched_cb_usages))
3555+ perf_pmu_sched_task(task, next, false);
3556+
35273557 if (atomic_read(&nr_switch_events))
35283558 perf_event_switch(task, next, false);
35293559
@@ -3832,6 +3862,9 @@ void __perf_event_task_sched_in(struct task_struct *prev, · 302 unmodified lines
38323862
38333863 if (atomic_read(&nr_switch_events))
38343864 perf_event_switch(task, prev, true);
3865+
3866+ if (__this_cpu_read(perf_sched_cb_usages))
3867+ perf_pmu_sched_task(prev, task, true);
38353868 }
38363869
38373870 static u64 perf_calculate_period(struct perf_event *event, u64 nsec, u64 count)
@@ -4656,7 +4689,7 @@ static void unaccount_event(struct perf_event *event) · 818 unmodified lines
46564689 if (event->parent)
46574690 return;
46584691
4659− if (event->attach_state & PERF_ATTACH_TASK)
4692+ if (event->attach_state & (PERF_ATTACH_TASK | PERF_ATTACH_SCHED_CB))
46604693 dec = true;
46614694 if (event->attr.mmap || event->attr.mmap_data)
46624695 atomic_dec(&nr_mmap_events);
@@ -11175,7 +11208,7 @@ static void account_event(struct perf_event *event) · 6512 unmodified lines
1117511208 if (event->parent)
1117611209 return;
1117711210
11178− if (event->attach_state & PERF_ATTACH_TASK)
11211+ if (event->attach_state & (PERF_ATTACH_TASK | PERF_ATTACH_SCHED_CB))
1117911212 inc = true;
1118011213 if (event->attr.mmap || event->attr.mmap_data)
1118111214 atomic_inc(&nr_mmap_events);
@@ -12972,6 +13005,7 @@ static void __init perf_event_init_all_cpus(void) · 1790 unmodified lines
1297213005 #ifdef CONFIG_CGROUP_PERF
1297313006 INIT_LIST_HEAD(&per_cpu(cgrp_cpuctx_list, cpu));
1297413007 #endif
13008+ INIT_LIST_HEAD(&per_cpu(sched_cb_list, cpu));
1297513009 }
1297613010 }
1297713011
kernel/fork.c+9−0
@@ -994,6 +994,13 @@ static void mm_init_owner(struct mm_struct *mm, struct task_struct *p) · 993 unmodified lines
994994 #endif
995995 }
996996
997+static void mm_init_pasid(struct mm_struct *mm)
998+{
999+#ifdef CONFIG_IOMMU_SUPPORT
1000+ mm->pasid = INIT_PASID;
1001+#endif
1002+}
1003+
9971004 static void mm_init_uprobes_state(struct mm_struct *mm)
9981005 {
9991006 #ifdef CONFIG_UPROBES
@@ -1024,6 +1031,7 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p, · 24 unmodified lines
10241031 mm_init_cpumask(mm);
10251032 mm_init_aio(mm);
10261033 mm_init_owner(mm, p);
1034+ mm_init_pasid(mm);
10271035 RCU_INIT_POINTER(mm->exe_file, NULL);
10281036 mmu_notifier_subscriptions_init(mm);
10291037 init_tlb_flush_pending(mm);
@@ -2436,6 +2444,7 @@ struct task_struct *create_io_thread(int (*fn)(void *), void *arg, int node) · 1406 unmodified lines
24362444 if (!IS_ERR(tsk)) {
24372445 sigfillset(&tsk->blocked);
24382446 sigdelsetmask(&tsk->blocked, sigmask(SIGKILL));
2447+ tsk->flags |= PF_NOFREEZE;
24392448 }
24402449 return tsk;
24412450 }
kernel/irq/irqdomain.c+4−5
@@ -1898,16 +1898,15 @@ DEFINE_SHOW_ATTRIBUTE(irq_domain_debug); · 1897 unmodified lines
18981898
18991899 static void debugfs_add_domain_dir(struct irq_domain *d)
19001900 {
1901− if (!d->name || !domain_dir || d->debugfs_file)
1901+ if (!d->name || !domain_dir)
19021902 return;
1903− d->debugfs_file = debugfs_create_file(d->name, 0444, domain_dir, d,
1904− &irq_domain_debug_fops);
1903+ debugfs_create_file(d->name, 0444, domain_dir, d,
1904+ &irq_domain_debug_fops);
19051905 }
19061906
19071907 static void debugfs_remove_domain_dir(struct irq_domain *d)
19081908 {
1909− debugfs_remove(d->debugfs_file);
1910− d->debugfs_file = NULL;
1909+ debugfs_remove(debugfs_lookup(d->name, domain_dir));
19111910 }
19121911
19131912 void __init irq_domain_debugfs_init(struct dentry *root)
kernel/locking/mutex.c+14−11
@@ -626,7 +626,7 @@ static inline int mutex_can_spin_on_owner(struct mutex *lock) · 625 unmodified lines
626626 */
627627 static __always_inline bool
628628 mutex_optimistic_spin(struct mutex *lock, struct ww_acquire_ctx *ww_ctx,
629− const bool use_ww_ctx, struct mutex_waiter *waiter)
629+ struct mutex_waiter *waiter)
630630 {
631631 if (!waiter) {
632632 /*
@@ -702,7 +702,7 @@ fail: · 69 unmodified lines
702702 #else
703703 static __always_inline bool
704704 mutex_optimistic_spin(struct mutex *lock, struct ww_acquire_ctx *ww_ctx,
705− const bool use_ww_ctx, struct mutex_waiter *waiter)
705+ struct mutex_waiter *waiter)
706706 {
707707 return false;
708708 }
@@ -922,6 +922,9 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, · 213 unmodified lines
922922 struct ww_mutex *ww;
923923 int ret;
924924
925+ if (!use_ww_ctx)
926+ ww_ctx = NULL;
927+
925928 might_sleep();
926929
927930 #ifdef CONFIG_DEBUG_MUTEXES
@@ -929,7 +932,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, · 1 unmodified line
929932 #endif
930933
931934 ww = container_of(lock, struct ww_mutex, base);
932− if (use_ww_ctx && ww_ctx) {
935+ if (ww_ctx) {
933936 if (unlikely(ww_ctx == READ_ONCE(ww->ctx)))
934937 return -EALREADY;
935938
@@ -946,10 +949,10 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, · 10 unmodified lines
946949 mutex_acquire_nest(&lock->dep_map, subclass, 0, nest_lock, ip);
947950
948951 if (__mutex_trylock(lock) ||
949− mutex_optimistic_spin(lock, ww_ctx, use_ww_ctx, NULL)) {
952+ mutex_optimistic_spin(lock, ww_ctx, NULL)) {
950953 /* got the lock, yay! */
951954 lock_acquired(&lock->dep_map, ip);
952− if (use_ww_ctx && ww_ctx)
955+ if (ww_ctx)
953956 ww_mutex_set_context_fastpath(ww, ww_ctx);
954957 preempt_enable();
955958 return 0;
@@ -960,7 +963,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, · 4 unmodified lines
960963 * After waiting to acquire the wait_lock, try again.
961964 */
962965 if (__mutex_trylock(lock)) {
963− if (use_ww_ctx && ww_ctx)
966+ if (ww_ctx)
964967 __ww_mutex_check_waiters(lock, ww_ctx);
965968
966969 goto skip_wait;
@@ -1013,7 +1016,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, · 46 unmodified lines
10131016 goto err;
10141017 }
10151018
1016− if (use_ww_ctx && ww_ctx) {
1019+ if (ww_ctx) {
10171020 ret = __ww_mutex_check_kill(lock, &waiter, ww_ctx);
10181021 if (ret)
10191022 goto err;
@@ -1026,7 +1029,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, · 6 unmodified lines
10261029 * ww_mutex needs to always recheck its position since its waiter
10271030 * list is not FIFO ordered.
10281031 */
1029− if ((use_ww_ctx && ww_ctx) || !first) {
1032+ if (ww_ctx || !first) {
10301033 first = __mutex_waiter_is_first(lock, &waiter);
10311034 if (first)
10321035 __mutex_set_flag(lock, MUTEX_FLAG_HANDOFF);
@@ -1039,7 +1042,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, · 6 unmodified lines
10391042 * or we must see its unlock and acquire.
10401043 */
10411044 if (__mutex_trylock(lock) ||
1042− (first && mutex_optimistic_spin(lock, ww_ctx, use_ww_ctx, &waiter)))
1045+ (first && mutex_optimistic_spin(lock, ww_ctx, &waiter)))
10431046 break;
10441047
10451048 spin_lock(&lock->wait_lock);
@@ -1048,7 +1051,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, · 2 unmodified lines
10481051 acquired:
10491052 __set_current_state(TASK_RUNNING);
10501053
1051− if (use_ww_ctx && ww_ctx) {
1054+ if (ww_ctx) {
10521055 /*
10531056 * Wound-Wait; we stole the lock (!first_waiter), check the
10541057 * waiters as anyone might want to wound us.
@@ -1068,7 +1071,7 @@ skip_wait: · 13 unmodified lines
10681071 /* got the lock - cleanup and rejoice! */
10691072 lock_acquired(&lock->dep_map, ip);
10701073
1071− if (use_ww_ctx && ww_ctx)
1074+ if (ww_ctx)
10721075 ww_mutex_lock_acquired(ww, ww_ctx);
10731076
10741077 spin_unlock(&lock->wait_lock);
kernel/sched/core.c+62−64
@@ -1862,8 +1862,13 @@ struct migration_arg { · 1861 unmodified lines
18621862 struct set_affinity_pending *pending;
18631863 };
18641864
1865+/*
1866+ * @refs: number of wait_for_completion()
1867+ * @stop_pending: is @stop_work in use
1868+ */
18651869 struct set_affinity_pending {
18661870 refcount_t refs;
1871+ unsigned int stop_pending;
18671872 struct completion done;
18681873 struct cpu_stop_work stop_work;
18691874 struct migration_arg arg;
@@ -1898,8 +1903,8 @@ static struct rq *__migrate_task(struct rq *rq, struct rq_flags *rf, · 28 unmodified lines
18981903 */
18991904 static int migration_cpu_stop(void *data)
19001905 {
1901− struct set_affinity_pending *pending;
19021906 struct migration_arg *arg = data;
1907+ struct set_affinity_pending *pending = arg->pending;
19031908 struct task_struct *p = arg->task;
19041909 int dest_cpu = arg->dest_cpu;
19051910 struct rq *rq = this_rq();
@@ -1921,7 +1926,6 @@ static int migration_cpu_stop(void *data) · 15 unmodified lines
19211926 raw_spin_lock(&p->pi_lock);
19221927 rq_lock(rq, &rf);
19231928
1924− pending = p->migration_pending;
19251929 /*
19261930 * If task_rq(p) != rq, it cannot be migrated here, because we're
19271931 * holding rq->lock, if p->on_rq == 0 it cannot get enqueued because
@@ -1932,21 +1936,14 @@ static int migration_cpu_stop(void *data) · 4 unmodified lines
19321936 goto out;
19331937
19341938 if (pending) {
1935− p->migration_pending = NULL;
1939+ if (p->migration_pending == pending)
1940+ p->migration_pending = NULL;
19361941 complete = true;
19371942 }
19381943
1939− /* migrate_enable() -- we must not race against SCA */
19401944 if (dest_cpu < 0) {
1941− /*
1942− * When this was migrate_enable() but we no longer
1943− * have a @pending, a concurrent SCA 'fixed' things
1944− * and we should be valid again. Nothing to do.
1945− */
1946− if (!pending) {
1947− WARN_ON_ONCE(!cpumask_test_cpu(task_cpu(p), &p->cpus_mask));
1945+ if (cpumask_test_cpu(task_cpu(p), &p->cpus_mask))
19481946 goto out;
1949− }
19501947
19511948 dest_cpu = cpumask_any_distribute(&p->cpus_mask);
19521949 }
@@ -1956,7 +1953,14 @@ static int migration_cpu_stop(void *data) · 3 unmodified lines
19561953 else
19571954 p->wake_cpu = dest_cpu;
19581955
1959− } else if (dest_cpu < 0 || pending) {
1956+ /*
1957+ * XXX __migrate_task() can fail, at which point we might end
1958+ * up running on a dodgy CPU, AFAICT this can only happen
1959+ * during CPU hotplug, at which point we'll get pushed out
1960+ * anyway, so it's probably not a big deal.
1961+ */
1962+
1963+ } else if (pending) {
19601964 /*
19611965 * This happens when we get migrated between migrate_enable()'s
19621966 * preempt_enable() and scheduling the stopper task. At that
@@ -1971,43 +1975,32 @@ static int migration_cpu_stop(void *data) · 8 unmodified lines
19711975 * ->pi_lock, so the allowed mask is stable - if it got
19721976 * somewhere allowed, we're done.
19731977 */
1974− if (pending && cpumask_test_cpu(task_cpu(p), p->cpus_ptr)) {
1975− p->migration_pending = NULL;
1978+ if (cpumask_test_cpu(task_cpu(p), p->cpus_ptr)) {
1979+ if (p->migration_pending == pending)
1980+ p->migration_pending = NULL;
19761981 complete = true;
19771982 goto out;
19781983 }
19791984
1980− /*
1981− * When this was migrate_enable() but we no longer have an
1982− * @pending, a concurrent SCA 'fixed' things and we should be
1983− * valid again. Nothing to do.
1984− */
1985− if (!pending) {
1986− WARN_ON_ONCE(!cpumask_test_cpu(task_cpu(p), &p->cpus_mask));
1987− goto out;
1988− }
1989−
19901985 /*
19911986 * When migrate_enable() hits a rq mis-match we can't reliably
19921987 * determine is_migration_disabled() and so have to chase after
19931988 * it.
19941989 */
1990+ WARN_ON_ONCE(!pending->stop_pending);
19951991 task_rq_unlock(rq, p, &rf);
19961992 stop_one_cpu_nowait(task_cpu(p), migration_cpu_stop,
19971993 &pending->arg, &pending->stop_work);
19981994 return 0;
19991995 }
20001996 out:
1997+ if (pending)
1998+ pending->stop_pending = false;
20011999 task_rq_unlock(rq, p, &rf);
20022000
20032001 if (complete)
20042002 complete_all(&pending->done);
20052003
2006− /* For pending->{arg,stop_work} */
2007− pending = arg->pending;
2008− if (pending && refcount_dec_and_test(&pending->refs))
2009− wake_up_var(&pending->refs);
2010−
20112004 return 0;
20122005 }
20132006
@@ -2194,11 +2187,7 @@ static int affine_move_task(struct rq *rq, struct task_struct *p, struct rq_flag · 180 unmodified lines
21942187 int dest_cpu, unsigned int flags)
21952188 {
21962189 struct set_affinity_pending my_pending = { }, *pending = NULL;
2197− struct migration_arg arg = {
2198− .task = p,
2199− .dest_cpu = dest_cpu,
2200− };
2201− bool complete = false;
2190+ bool stop_pending, complete = false;
22022191
22032192 /* Can the task run on the task's current CPU? If so, we're done */
22042193 if (cpumask_test_cpu(task_cpu(p), &p->cpus_mask)) {
@@ -2210,12 +2199,16 @@ static int affine_move_task(struct rq *rq, struct task_struct *p, struct rq_flag · 5 unmodified lines
22102199 push_task = get_task_struct(p);
22112200 }
22122201
2202+ /*
2203+ * If there are pending waiters, but no pending stop_work,
2204+ * then complete now.
2205+ */
22132206 pending = p->migration_pending;
2214− if (pending) {
2215− refcount_inc(&pending->refs);
2207+ if (pending && !pending->stop_pending) {
22162208 p->migration_pending = NULL;
22172209 complete = true;
22182210 }
2211+
22192212 task_rq_unlock(rq, p, rf);
22202213
22212214 if (push_task) {
@@ -2224,7 +2217,7 @@ static int affine_move_task(struct rq *rq, struct task_struct *p, struct rq_flag · 2 unmodified lines
22242217 }
22252218
22262219 if (complete)
2227− goto do_complete;
2220+ complete_all(&pending->done);
22282221
22292222 return 0;
22302223 }
@@ -2235,6 +2228,12 @@ static int affine_move_task(struct rq *rq, struct task_struct *p, struct rq_flag · 4 unmodified lines
22352228 /* Install the request */
22362229 refcount_set(&my_pending.refs, 1);
22372230 init_completion(&my_pending.done);
2231+ my_pending.arg = (struct migration_arg) {
2232+ .task = p,
2233+ .dest_cpu = -1, /* any */
2234+ .pending = &my_pending,
2235+ };
2236+
22382237 p->migration_pending = &my_pending;
22392238 } else {
22402239 pending = p->migration_pending;
@@ -2259,45 +2258,41 @@ static int affine_move_task(struct rq *rq, struct task_struct *p, struct rq_flag · 18 unmodified lines
22592258 return -EINVAL;
22602259 }
22612260
2262− if (flags & SCA_MIGRATE_ENABLE) {
2263−
2264− refcount_inc(&pending->refs); /* pending->{arg,stop_work} */
2265− p->migration_flags &= ~MDF_PUSH;
2266− task_rq_unlock(rq, p, rf);
2267−
2268− pending->arg = (struct migration_arg) {
2269− .task = p,
2270− .dest_cpu = -1,
2271− .pending = pending,
2272− };
2273−
2274− stop_one_cpu_nowait(cpu_of(rq), migration_cpu_stop,
2275− &pending->arg, &pending->stop_work);
2276−
2277− return 0;
2278− }
2279−
22802261 if (task_running(rq, p) || p->state == TASK_WAKING) {
22812262 /*
2282− * Lessen races (and headaches) by delegating
2283− * is_migration_disabled(p) checks to the stopper, which will
2284− * run on the same CPU as said p.
2263+ * MIGRATE_ENABLE gets here because 'p == current', but for
2264+ * anything else we cannot do is_migration_disabled(), punt
2265+ * and have the stopper function handle it all race-free.
22852266 */
2267+ stop_pending = pending->stop_pending;
2268+ if (!stop_pending)
2269+ pending->stop_pending = true;
2270+
2271+ if (flags & SCA_MIGRATE_ENABLE)
2272+ p->migration_flags &= ~MDF_PUSH;
2273+
22862274 task_rq_unlock(rq, p, rf);
2287− stop_one_cpu(cpu_of(rq), migration_cpu_stop, &arg);
22882275
2276+ if (!stop_pending) {
2277+ stop_one_cpu_nowait(cpu_of(rq), migration_cpu_stop,
2278+ &pending->arg, &pending->stop_work);
2279+ }
2280+
2281+ if (flags & SCA_MIGRATE_ENABLE)
2282+ return 0;
22892283 } else {
22902284
22912285 if (!is_migration_disabled(p)) {
22922286 if (task_on_rq_queued(p))
22932287 rq = move_queued_task(rq, rf, p, dest_cpu);
22942288
2295− p->migration_pending = NULL;
2296− complete = true;
2289+ if (!pending->stop_pending) {
2290+ p->migration_pending = NULL;
2291+ complete = true;
2292+ }
22972293 }
22982294 task_rq_unlock(rq, p, rf);
22992295
2300−do_complete:
23012296 if (complete)
23022297 complete_all(&pending->done);
23032298 }
@@ -2305,7 +2300,7 @@ do_complete: · 1 unmodified line
23052300 wait_for_completion(&pending->done);
23062301
23072302 if (refcount_dec_and_test(&pending->refs))
2308− wake_up_var(&pending->refs);
2303+ wake_up_var(&pending->refs); /* No UaF, just an address */
23092304
23102305 /*
23112306 * Block the original owner of &pending until all subsequent callers
@@ -2313,6 +2308,9 @@ do_complete: · 1 unmodified line
23132308 */
23142309 wait_var_event(&my_pending.refs, !refcount_read(&my_pending.refs));
23152310
2311+ /* ARGH */
2312+ WARN_ON_ONCE(my_pending.stop_pending);
2313+
23162314 return 0;
23172315 }
23182316
kernel/sched/membarrier.c+1−3
@@ -471,9 +471,7 @@ static int sync_runqueues_membarrier_state(struct mm_struct *mm) · 470 unmodified lines
471471 }
472472 rcu_read_unlock();
473473
474− preempt_disable();
475− smp_call_function_many(tmpmask, ipi_sync_rq_state, mm, 1);
476− preempt_enable();
474+ on_each_cpu_mask(tmpmask, ipi_sync_rq_state, mm, true);
477475
478476 free_cpumask_var(tmpmask);
479477 cpus_read_unlock();
kernel/sys.c+1−1
@@ -2079,7 +2079,7 @@ static int prctl_set_auxv(struct mm_struct *mm, unsigned long addr, · 2078 unmodified lines
20792079 * up to the caller to provide sane values here, otherwise userspace
20802080 * tools which use this vector might be unhappy.
20812081 */
2082− unsigned long user_auxv[AT_VECTOR_SIZE];
2082+ unsigned long user_auxv[AT_VECTOR_SIZE] = {};
20832083
20842084 if (len > sizeof(user_auxv))
20852085 return -EINVAL;
kernel/time/hrtimer.c+39−21
@@ -546,8 +546,11 @@ static ktime_t __hrtimer_next_event_base(struct hrtimer_cpu_base *cpu_base, · 545 unmodified lines
546546 }
547547
548548 /*
549− * Recomputes cpu_base::*next_timer and returns the earliest expires_next but
550− * does not set cpu_base::*expires_next, that is done by hrtimer_reprogram.
549+ * Recomputes cpu_base::*next_timer and returns the earliest expires_next
550+ * but does not set cpu_base::*expires_next, that is done by
551+ * hrtimer[_force]_reprogram and hrtimer_interrupt only. When updating
552+ * cpu_base::*expires_next right away, reprogramming logic would no longer
553+ * work.
551554 *
552555 * When a softirq is pending, we can ignore the HRTIMER_ACTIVE_SOFT bases,
553556 * those timers will get run whenever the softirq gets handled, at the end of
@@ -588,6 +591,37 @@ __hrtimer_get_next_event(struct hrtimer_cpu_base *cpu_base, unsigned int active_ · 34 unmodified lines
588591 return expires_next;
589592 }
590593
594+static ktime_t hrtimer_update_next_event(struct hrtimer_cpu_base *cpu_base)
595+{
596+ ktime_t expires_next, soft = KTIME_MAX;
597+
598+ /*
599+ * If the soft interrupt has already been activated, ignore the
600+ * soft bases. They will be handled in the already raised soft
601+ * interrupt.
602+ */
603+ if (!cpu_base->softirq_activated) {
604+ soft = __hrtimer_get_next_event(cpu_base, HRTIMER_ACTIVE_SOFT);
605+ /*
606+ * Update the soft expiry time. clock_settime() might have
607+ * affected it.
608+ */
609+ cpu_base->softirq_expires_next = soft;
610+ }
611+
612+ expires_next = __hrtimer_get_next_event(cpu_base, HRTIMER_ACTIVE_HARD);
613+ /*
614+ * If a softirq timer is expiring first, update cpu_base->next_timer
615+ * and program the hardware with the soft expiry time.
616+ */
617+ if (expires_next > soft) {
618+ cpu_base->next_timer = cpu_base->softirq_next_timer;
619+ expires_next = soft;
620+ }
621+
622+ return expires_next;
623+}
624+
591625 static inline ktime_t hrtimer_update_base(struct hrtimer_cpu_base *base)
592626 {
593627 ktime_t *offs_real = &base->clock_base[HRTIMER_BASE_REALTIME].offset;
@@ -628,23 +662,7 @@ hrtimer_force_reprogram(struct hrtimer_cpu_base *cpu_base, int skip_equal) · 34 unmodified lines
628662 {
629663 ktime_t expires_next;
630664
631− /*
632− * Find the current next expiration time.
633− */
634− expires_next = __hrtimer_get_next_event(cpu_base, HRTIMER_ACTIVE_ALL);
635−
636− if (cpu_base->next_timer && cpu_base->next_timer->is_soft) {
637− /*
638− * When the softirq is activated, hrtimer has to be
639− * programmed with the first hard hrtimer because soft
640− * timer interrupt could occur too late.
641− */
642− if (cpu_base->softirq_activated)
643− expires_next = __hrtimer_get_next_event(cpu_base,
644− HRTIMER_ACTIVE_HARD);
645− else
646− cpu_base->softirq_expires_next = expires_next;
647− }
665+ expires_next = hrtimer_update_next_event(cpu_base);
648666
649667 if (skip_equal && expires_next == cpu_base->expires_next)
650668 return;
@@ -1644,8 +1662,8 @@ retry: · 993 unmodified lines
16441662
16451663 __hrtimer_run_queues(cpu_base, now, flags, HRTIMER_ACTIVE_HARD);
16461664
1647− /* Reevaluate the clock bases for the next expiry */
1648− expires_next = __hrtimer_get_next_event(cpu_base, HRTIMER_ACTIVE_ALL);
1665+ /* Reevaluate the clock bases for the [soft] next expiry */
1666+ expires_next = hrtimer_update_next_event(cpu_base);
16491667 /*
16501668 * Store the new expiry value so the migration code can verify
16511669 * against it.
lib/Kconfig.kasan+1−0
@@ -156,6 +156,7 @@ config KASAN_STACK_ENABLE · 155 unmodified lines
156156
157157 config KASAN_STACK
158158 int
159+ depends on KASAN_GENERIC || KASAN_SW_TAGS
159160 default 1 if KASAN_STACK_ENABLE || CC_IS_GCC
160161 default 0
161162
lib/extable.c+0−5
@@ -21,7 +21,6 @@ static inline unsigned long ex_to_insn(const struct exception_table_entry *x) · 20 unmodified lines
2121 }
2222 #endif
2323
24−#ifndef ARCH_HAS_SORT_EXTABLE
2524 #ifndef ARCH_HAS_RELATIVE_EXTABLE
2625 #define swap_ex NULL
2726 #else
@@ -88,9 +87,6 @@ void trim_init_extable(struct module *m) · 60 unmodified lines
8887 m->num_exentries--;
8988 }
9089 #endif /* CONFIG_MODULES */
91−#endif /* !ARCH_HAS_SORT_EXTABLE */
92−
93−#ifndef ARCH_HAS_SEARCH_EXTABLE
9490
9591 static int cmp_ex_search(const void *key, const void *elt)
9692 {
@@ -120,4 +116,3 @@ search_extable(const struct exception_table_entry *base, · 23 unmodified lines
120116 return bsearch(&value, base, num,
121117 sizeof(struct exception_table_entry), cmp_ex_search);
122118 }
123−#endif
mm/highmem.c+12−5
@@ -368,20 +368,24 @@ void zero_user_segments(struct page *page, unsigned start1, unsigned end1, · 367 unmodified lines
368368
369369 BUG_ON(end1 > page_size(page) || end2 > page_size(page));
370370
371+ if (start1 >= end1)
372+ start1 = end1 = 0;
373+ if (start2 >= end2)
374+ start2 = end2 = 0;
375+
371376 for (i = 0; i < compound_nr(page); i++) {
372377 void *kaddr = NULL;
373378
374− if (start1 < PAGE_SIZE || start2 < PAGE_SIZE)
375− kaddr = kmap_atomic(page + i);
376−
377379 if (start1 >= PAGE_SIZE) {
378380 start1 -= PAGE_SIZE;
379381 end1 -= PAGE_SIZE;
380382 } else {
381383 unsigned this_end = min_t(unsigned, end1, PAGE_SIZE);
382384
383− if (end1 > start1)
385+ if (end1 > start1) {
386+ kaddr = kmap_atomic(page + i);
384387 memset(kaddr + start1, 0, this_end - start1);
388+ }
385389 end1 -= this_end;
386390 start1 = 0;
387391 }
@@ -392,8 +396,11 @@ void zero_user_segments(struct page *page, unsigned start1, unsigned end1, · 4 unmodified lines
392396 } else {
393397 unsigned this_end = min_t(unsigned, end2, PAGE_SIZE);
394398
395− if (end2 > start2)
399+ if (end2 > start2) {
400+ if (!kaddr)
401+ kaddr = kmap_atomic(page + i);
396402 memset(kaddr + start2, 0, this_end - start2);
403+ }
397404 end2 -= this_end;
398405 start2 = 0;
399406 }
mm/huge_memory.c+3−7
@@ -1100,9 +1100,7 @@ int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm, · 1099 unmodified lines
11001100 * best effort that the pinned pages won't be replaced by another
11011101 * random page during the coming copy-on-write.
11021102 */
1103− if (unlikely(is_cow_mapping(vma->vm_flags) &&
1104− atomic_read(&src_mm->has_pinned) &&
1105− page_maybe_dma_pinned(src_page))) {
1103+ if (unlikely(page_needs_cow_for_dma(vma, src_page))) {
11061104 pte_free(dst_mm, pgtable);
11071105 spin_unlock(src_ptl);
11081106 spin_unlock(dst_ptl);
@@ -1214,9 +1212,7 @@ int copy_huge_pud(struct mm_struct *dst_mm, struct mm_struct *src_mm, · 105 unmodified lines
12141212 }
12151213
12161214 /* Please refer to comments in copy_huge_pmd() */
1217− if (unlikely(is_cow_mapping(vma->vm_flags) &&
1218− atomic_read(&src_mm->has_pinned) &&
1219− page_maybe_dma_pinned(pud_page(pud)))) {
1215+ if (unlikely(page_needs_cow_for_dma(vma, pud_page(pud)))) {
12201216 spin_unlock(src_ptl);
12211217 spin_unlock(dst_ptl);
12221218 __split_huge_pud(vma, src_pud, addr);
@@ -2471,7 +2467,7 @@ static void __split_huge_page(struct page *page, struct list_head *list, · 1248 unmodified lines
24712467 int i;
24722468
24732469 /* complete memcg works before add pages to LRU */
2474− mem_cgroup_split_huge_fixup(head);
2470+ split_page_memcg(head, nr);
24752471
24762472 if (PageAnon(head) && PageSwapCache(head)) {
24772473 swp_entry_t entry = { .val = page_private(head) };
mm/hugetlb.c+91−32
@@ -331,6 +331,24 @@ static void coalesce_file_region(struct resv_map *resv, struct file_region *rg) · 330 unmodified lines
331331 }
332332 }
333333
334+static inline long
335+hugetlb_resv_map_add(struct resv_map *map, struct file_region *rg, long from,
336+ long to, struct hstate *h, struct hugetlb_cgroup *cg,
337+ long *regions_needed)
338+{
339+ struct file_region *nrg;
340+
341+ if (!regions_needed) {
342+ nrg = get_file_region_entry_from_cache(map, from, to);
343+ record_hugetlb_cgroup_uncharge_info(cg, h, map, nrg);
344+ list_add(&nrg->link, rg->link.prev);
345+ coalesce_file_region(map, nrg);
346+ } else
347+ *regions_needed += 1;
348+
349+ return to - from;
350+}
351+
334352 /*
335353 * Must be called with resv->lock held.
336354 *
@@ -346,7 +364,7 @@ static long add_reservation_in_range(struct resv_map *resv, long f, long t, · 9 unmodified lines
346364 long add = 0;
347365 struct list_head *head = &resv->regions;
348366 long last_accounted_offset = f;
349− struct file_region *rg = NULL, *trg = NULL, *nrg = NULL;
367+ struct file_region *rg = NULL, *trg = NULL;
350368
351369 if (regions_needed)
352370 *regions_needed = 0;
@@ -369,24 +387,17 @@ static long add_reservation_in_range(struct resv_map *resv, long f, long t, · 16 unmodified lines
369387 /* When we find a region that starts beyond our range, we've
370388 * finished.
371389 */
372− if (rg->from > t)
390+ if (rg->from >= t)
373391 break;
374392
375393 /* Add an entry for last_accounted_offset -> rg->from, and
376394 * update last_accounted_offset.
377395 */
378− if (rg->from > last_accounted_offset) {
379− add += rg->from - last_accounted_offset;
380− if (!regions_needed) {
381− nrg = get_file_region_entry_from_cache(
382− resv, last_accounted_offset, rg->from);
383− record_hugetlb_cgroup_uncharge_info(h_cg, h,
384− resv, nrg);
385− list_add(&nrg->link, rg->link.prev);
386− coalesce_file_region(resv, nrg);
387− } else
388− *regions_needed += 1;
389− }
396+ if (rg->from > last_accounted_offset)
397+ add += hugetlb_resv_map_add(resv, rg,
398+ last_accounted_offset,
399+ rg->from, h, h_cg,
400+ regions_needed);
390401
391402 last_accounted_offset = rg->to;
392403 }
@@ -394,17 +405,9 @@ static long add_reservation_in_range(struct resv_map *resv, long f, long t, · 1 unmodified line
394405 /* Handle the case where our range extends beyond
395406 * last_accounted_offset.
396407 */
397− if (last_accounted_offset < t) {
398− add += t - last_accounted_offset;
399− if (!regions_needed) {
400− nrg = get_file_region_entry_from_cache(
401− resv, last_accounted_offset, t);
402− record_hugetlb_cgroup_uncharge_info(h_cg, h, resv, nrg);
403− list_add(&nrg->link, rg->link.prev);
404− coalesce_file_region(resv, nrg);
405− } else
406− *regions_needed += 1;
407− }
408+ if (last_accounted_offset < t)
409+ add += hugetlb_resv_map_add(resv, rg, last_accounted_offset,
410+ t, h, h_cg, regions_needed);
408411
409412 VM_BUG_ON(add < 0);
410413 return add;
@@ -3725,21 +3728,32 @@ static bool is_hugetlb_entry_hwpoisoned(pte_t pte) · 3314 unmodified lines
37253728 return false;
37263729 }
37273730
3731+static void
3732+hugetlb_install_page(struct vm_area_struct *vma, pte_t *ptep, unsigned long addr,
3733+ struct page *new_page)
3734+{
3735+ __SetPageUptodate(new_page);
3736+ set_huge_pte_at(vma->vm_mm, addr, ptep, make_huge_pte(vma, new_page, 1));
3737+ hugepage_add_new_anon_rmap(new_page, vma, addr);
3738+ hugetlb_count_add(pages_per_huge_page(hstate_vma(vma)), vma->vm_mm);
3739+ ClearHPageRestoreReserve(new_page);
3740+ SetHPageMigratable(new_page);
3741+}
3742+
37283743 int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src,
37293744 struct vm_area_struct *vma)
37303745 {
37313746 pte_t *src_pte, *dst_pte, entry, dst_entry;
37323747 struct page *ptepage;
37333748 unsigned long addr;
3734− int cow;
3749+ bool cow = is_cow_mapping(vma->vm_flags);
37353750 struct hstate *h = hstate_vma(vma);
37363751 unsigned long sz = huge_page_size(h);
3752+ unsigned long npages = pages_per_huge_page(h);
37373753 struct address_space *mapping = vma->vm_file->f_mapping;
37383754 struct mmu_notifier_range range;
37393755 int ret = 0;
37403756
3741− cow = (vma->vm_flags & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE;
3742−
37433757 if (cow) {
37443758 mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, vma, src,
37453759 vma->vm_start,
@@ -3784,6 +3798,7 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, · 38 unmodified lines
37843798 spin_lock_nested(src_ptl, SINGLE_DEPTH_NESTING);
37853799 entry = huge_ptep_get(src_pte);
37863800 dst_entry = huge_ptep_get(dst_pte);
3801+again:
37873802 if (huge_pte_none(entry) || !huge_pte_none(dst_entry)) {
37883803 /*
37893804 * Skip if src entry none. Also, skip in the
@@ -3807,6 +3822,52 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, · 17 unmodified lines
38073822 }
38083823 set_huge_swap_pte_at(dst, addr, dst_pte, entry, sz);
38093824 } else {
3825+ entry = huge_ptep_get(src_pte);
3826+ ptepage = pte_page(entry);
3827+ get_page(ptepage);
3828+
3829+ /*
3830+ * This is a rare case where we see pinned hugetlb
3831+ * pages while they're prone to COW. We need to do the
3832+ * COW earlier during fork.
3833+ *
3834+ * When pre-allocating the page or copying data, we
3835+ * need to be without the pgtable locks since we could
3836+ * sleep during the process.
3837+ */
3838+ if (unlikely(page_needs_cow_for_dma(vma, ptepage))) {
3839+ pte_t src_pte_old = entry;
3840+ struct page *new;
3841+
3842+ spin_unlock(src_ptl);
3843+ spin_unlock(dst_ptl);
3844+ /* Do not use reserve as it's private owned */
3845+ new = alloc_huge_page(vma, addr, 1);
3846+ if (IS_ERR(new)) {
3847+ put_page(ptepage);
3848+ ret = PTR_ERR(new);
3849+ break;
3850+ }
3851+ copy_user_huge_page(new, ptepage, addr, vma,
3852+ npages);
3853+ put_page(ptepage);
3854+
3855+ /* Install the new huge page if src pte stable */
3856+ dst_ptl = huge_pte_lock(h, dst, dst_pte);
3857+ src_ptl = huge_pte_lockptr(h, src, src_pte);
3858+ spin_lock_nested(src_ptl, SINGLE_DEPTH_NESTING);
3859+ entry = huge_ptep_get(src_pte);
3860+ if (!pte_same(src_pte_old, entry)) {
3861+ put_page(new);
3862+ /* dst_entry won't change as in child */
3863+ goto again;
3864+ }
3865+ hugetlb_install_page(vma, dst_pte, addr, new);
3866+ spin_unlock(src_ptl);
3867+ spin_unlock(dst_ptl);
3868+ continue;
3869+ }
3870+
38103871 if (cow) {
38113872 /*
38123873 * No need to notify as we are downgrading page
@@ -3817,12 +3878,10 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, · 4 unmodified lines
38173878 */
38183879 huge_ptep_set_wrprotect(src, addr, src_pte);
38193880 }
3820− entry = huge_ptep_get(src_pte);
3821− ptepage = pte_page(entry);
3822− get_page(ptepage);
3881+
38233882 page_dup_rmap(ptepage, true);
38243883 set_huge_pte_at(dst, addr, dst_pte, entry);
3825− hugetlb_count_add(pages_per_huge_page(h), dst);
3884+ hugetlb_count_add(npages, dst);
38263885 }
38273886 spin_unlock(src_ptl);
38283887 spin_unlock(dst_ptl);
mm/internal.h+0−5
@@ -296,11 +296,6 @@ static inline unsigned int buddy_order(struct page *page) · 295 unmodified lines
296296 */
297297 #define buddy_order_unsafe(page) READ_ONCE(page_private(page))
298298
299−static inline bool is_cow_mapping(vm_flags_t flags)
300−{
301− return (flags & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE;
302−}
303−
304299 /*
305300 * These three helpers classifies VMAs for virtual memory accounting.
306301 */
mm/kfence/report.c+18−12
@@ -20,6 +20,11 @@ · 19 unmodified lines
2020
2121 #include "kfence.h"
2222
23+/* May be overridden by <asm/kfence.h>. */
24+#ifndef ARCH_FUNC_PREFIX
25+#define ARCH_FUNC_PREFIX ""
26+#endif
27+
2328 extern bool no_hash_pointers;
2429
2530 /* Helper function to either print to a seq_file or to console. */
@@ -67,8 +72,9 @@ static int get_stack_skipnr(const unsigned long stack_entries[], int num_entries · 41 unmodified lines
6772 for (skipnr = 0; skipnr < num_entries; skipnr++) {
6873 int len = scnprintf(buf, sizeof(buf), "%ps", (void *)stack_entries[skipnr]);
6974
70− if (str_has_prefix(buf, "kfence_") || str_has_prefix(buf, "__kfence_") ||
71− !strncmp(buf, "__slab_free", len)) {
75+ if (str_has_prefix(buf, ARCH_FUNC_PREFIX "kfence_") ||
76+ str_has_prefix(buf, ARCH_FUNC_PREFIX "__kfence_") ||
77+ !strncmp(buf, ARCH_FUNC_PREFIX "__slab_free", len)) {
7278 /*
7379 * In case of tail calls from any of the below
7480 * to any of the above.
@@ -77,10 +83,10 @@ static int get_stack_skipnr(const unsigned long stack_entries[], int num_entries · 2 unmodified lines
7783 }
7884
7985 /* Also the *_bulk() variants by only checking prefixes. */
80− if (str_has_prefix(buf, "kfree") ||
81− str_has_prefix(buf, "kmem_cache_free") ||
82− str_has_prefix(buf, "__kmalloc") ||
83− str_has_prefix(buf, "kmem_cache_alloc"))
86+ if (str_has_prefix(buf, ARCH_FUNC_PREFIX "kfree") ||
87+ str_has_prefix(buf, ARCH_FUNC_PREFIX "kmem_cache_free") ||
88+ str_has_prefix(buf, ARCH_FUNC_PREFIX "__kmalloc") ||
89+ str_has_prefix(buf, ARCH_FUNC_PREFIX "kmem_cache_alloc"))
8490 goto found;
8591 }
8692 if (fallback < num_entries)
@@ -116,12 +122,12 @@ void kfence_print_object(struct seq_file *seq, const struct kfence_metadata *met · 29 unmodified lines
116122 lockdep_assert_held(&meta->lock);
117123
118124 if (meta->state == KFENCE_OBJECT_UNUSED) {
119− seq_con_printf(seq, "kfence-#%zd unused\n", meta - kfence_metadata);
125+ seq_con_printf(seq, "kfence-#%td unused\n", meta - kfence_metadata);
120126 return;
121127 }
122128
123129 seq_con_printf(seq,
124− "kfence-#%zd [0x%p-0x%p"
130+ "kfence-#%td [0x%p-0x%p"
125131 ", size=%d, cache=%s] allocated by task %d:\n",
126132 meta - kfence_metadata, (void *)start, (void *)(start + size - 1), size,
127133 (cache && cache->name) ? cache->name : "<destroyed>", meta->alloc_track.pid);
@@ -204,7 +210,7 @@ void kfence_report_error(unsigned long address, bool is_write, struct pt_regs *r · 76 unmodified lines
204210
205211 pr_err("BUG: KFENCE: out-of-bounds %s in %pS\n\n", get_access_type(is_write),
206212 (void *)stack_entries[skipnr]);
207− pr_err("Out-of-bounds %s at 0x%p (%luB %s of kfence-#%zd):\n",
213+ pr_err("Out-of-bounds %s at 0x%p (%luB %s of kfence-#%td):\n",
208214 get_access_type(is_write), (void *)address,
209215 left_of_object ? meta->addr - address : address - meta->addr,
210216 left_of_object ? "left" : "right", object_index);
@@ -213,14 +219,14 @@ void kfence_report_error(unsigned long address, bool is_write, struct pt_regs *r · 2 unmodified lines
213219 case KFENCE_ERROR_UAF:
214220 pr_err("BUG: KFENCE: use-after-free %s in %pS\n\n", get_access_type(is_write),
215221 (void *)stack_entries[skipnr]);
216− pr_err("Use-after-free %s at 0x%p (in kfence-#%zd):\n",
222+ pr_err("Use-after-free %s at 0x%p (in kfence-#%td):\n",
217223 get_access_type(is_write), (void *)address, object_index);
218224 break;
219225 case KFENCE_ERROR_CORRUPTION:
220226 pr_err("BUG: KFENCE: memory corruption in %pS\n\n", (void *)stack_entries[skipnr]);
221227 pr_err("Corrupted memory at 0x%p ", (void *)address);
222228 print_diff_canary(address, 16, meta);
223− pr_cont(" (in kfence-#%zd):\n", object_index);
229+ pr_cont(" (in kfence-#%td):\n", object_index);
224230 break;
225231 case KFENCE_ERROR_INVALID:
226232 pr_err("BUG: KFENCE: invalid %s in %pS\n\n", get_access_type(is_write),
@@ -230,7 +236,7 @@ void kfence_report_error(unsigned long address, bool is_write, struct pt_regs *r · 3 unmodified lines
230236 break;
231237 case KFENCE_ERROR_INVALID_FREE:
232238 pr_err("BUG: KFENCE: invalid free in %pS\n\n", (void *)stack_entries[skipnr]);
233− pr_err("Invalid free of 0x%p (in kfence-#%zd):\n", (void *)address,
239+ pr_err("Invalid free of 0x%p (in kfence-#%td):\n", (void *)address,
234240 object_index);
235241 break;
236242 }
mm/madvise.c+12−1
@@ -1198,12 +1198,22 @@ SYSCALL_DEFINE5(process_madvise, int, pidfd, const struct iovec __user *, vec, · 1197 unmodified lines
11981198 goto release_task;
11991199 }
12001200
1201− mm = mm_access(task, PTRACE_MODE_ATTACH_FSCREDS);
1201+ /* Require PTRACE_MODE_READ to avoid leaking ASLR metadata. */
1202+ mm = mm_access(task, PTRACE_MODE_READ_FSCREDS);
12021203 if (IS_ERR_OR_NULL(mm)) {
12031204 ret = IS_ERR(mm) ? PTR_ERR(mm) : -ESRCH;
12041205 goto release_task;
12051206 }
12061207
1208+ /*
1209+ * Require CAP_SYS_NICE for influencing process performance. Note that
1210+ * only non-destructive hints are currently supported.
1211+ */
1212+ if (!capable(CAP_SYS_NICE)) {
1213+ ret = -EPERM;
1214+ goto release_mm;
1215+ }
1216+
12071217 total_len = iov_iter_count(&iter);
12081218
12091219 while (iov_iter_count(&iter)) {
@@ -1218,6 +1228,7 @@ SYSCALL_DEFINE5(process_madvise, int, pidfd, const struct iovec __user *, vec, · 8 unmodified lines
12181228 if (ret == 0)
12191229 ret = total_len - iov_iter_count(&iter);
12201230
1231+release_mm:
12211232 mmput(mm);
12221233 release_task:
12231234 put_task_struct(task);
mm/memcontrol.c+6−9
@@ -3287,24 +3287,21 @@ void obj_cgroup_uncharge(struct obj_cgroup *objcg, size_t size) · 3286 unmodified lines
32873287
32883288 #endif /* CONFIG_MEMCG_KMEM */
32893289
3290−#ifdef CONFIG_TRANSPARENT_HUGEPAGE
32913290 /*
3292− * Because page_memcg(head) is not set on compound tails, set it now.
3291+ * Because page_memcg(head) is not set on tails, set it now.
32933292 */
3294−void mem_cgroup_split_huge_fixup(struct page *head)
3293+void split_page_memcg(struct page *head, unsigned int nr)
32953294 {
32963295 struct mem_cgroup *memcg = page_memcg(head);
32973296 int i;
32983297
3299− if (mem_cgroup_disabled())
3298+ if (mem_cgroup_disabled() || !memcg)
33003299 return;
33013300
3302− for (i = 1; i < HPAGE_PMD_NR; i++) {
3303− css_get(&memcg->css);
3304− head[i].memcg_data = (unsigned long)memcg;
3305− }
3301+ for (i = 1; i < nr; i++)
3302+ head[i].memcg_data = head->memcg_data;
3303+ css_get_many(&memcg->css, nr - 1);
33063304 }
3307−#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
33083305
33093306 #ifdef CONFIG_MEMCG_SWAP
33103307 /**
mm/memory.c+9−7
@@ -809,12 +809,8 @@ copy_present_page(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma · 808 unmodified lines
809809 pte_t *dst_pte, pte_t *src_pte, unsigned long addr, int *rss,
810810 struct page **prealloc, pte_t pte, struct page *page)
811811 {
812− struct mm_struct *src_mm = src_vma->vm_mm;
813812 struct page *new_page;
814813
815− if (!is_cow_mapping(src_vma->vm_flags))
816− return 1;
817−
818814 /*
819815 * What we want to do is to check whether this page may
820816 * have been pinned by the parent process. If so,
@@ -828,9 +824,7 @@ copy_present_page(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma · 7 unmodified lines
828824 * the page count. That might give false positives for
829825 * for pinning, but it will work correctly.
830826 */
831− if (likely(!atomic_read(&src_mm->has_pinned)))
832− return 1;
833− if (likely(!page_maybe_dma_pinned(page)))
827+ if (likely(!page_needs_cow_for_dma(src_vma, page)))
834828 return 1;
835829
836830 new_page = *prealloc;
@@ -3103,6 +3097,14 @@ static vm_fault_t do_wp_page(struct vm_fault *vmf) · 2266 unmodified lines
31033097 return handle_userfault(vmf, VM_UFFD_WP);
31043098 }
31053099
3100+ /*
3101+ * Userfaultfd write-protect can defer flushes. Ensure the TLB
3102+ * is flushed in this case before copying.
3103+ */
3104+ if (unlikely(userfaultfd_wp(vmf->vma) &&
3105+ mm_tlb_flush_pending(vmf->vma->vm_mm)))
3106+ flush_tlb_page(vmf->vma, vmf->address);
3107+
31063108 vmf->page = vm_normal_page(vma, vmf->address, vmf->orig_pte);
31073109 if (!vmf->page) {
31083110 /*
mm/memory_hotplug.c+1−1
@@ -1072,7 +1072,7 @@ static int online_memory_block(struct memory_block *mem, void *arg) · 1071 unmodified lines
10721072 */
10731073 int __ref add_memory_resource(int nid, struct resource *res, mhp_t mhp_flags)
10741074 {
1075− struct mhp_params params = { .pgprot = PAGE_KERNEL };
1075+ struct mhp_params params = { .pgprot = pgprot_mhp(PAGE_KERNEL) };
10761076 u64 start, size;
10771077 bool new_node = false;
10781078 int ret;
mm/page_alloc.c+82−85
@@ -1281,6 +1281,12 @@ static __always_inline bool free_pages_prepare(struct page *page, · 1280 unmodified lines
12811281
12821282 kernel_poison_pages(page, 1 << order);
12831283
1284+ /*
1285+ * With hardware tag-based KASAN, memory tags must be set before the
1286+ * page becomes unavailable via debug_pagealloc or arch_free_page.
1287+ */
1288+ kasan_free_nondeferred_pages(page, order);
1289+
12841290 /*
12851291 * arch_free_page() can make the page's contents inaccessible. s390
12861292 * does this. So nothing which can access the page's contents should
@@ -1290,8 +1296,6 @@ static __always_inline bool free_pages_prepare(struct page *page, · 3 unmodified lines
12901296
12911297 debug_pagealloc_unmap_pages(page, 1 << order);
12921298
1293− kasan_free_nondeferred_pages(page, order);
1294−
12951299 return true;
12961300 }
12971301
@@ -3310,6 +3314,7 @@ void split_page(struct page *page, unsigned int order) · 2012 unmodified lines
33103314 for (i = 1; i < (1 << order); i++)
33113315 set_page_refcounted(page + i);
33123316 split_page_owner(page, 1 << order);
3317+ split_page_memcg(page, 1 << order);
33133318 }
33143319 EXPORT_SYMBOL_GPL(split_page);
33153320
@@ -6259,12 +6264,65 @@ static void __meminit zone_init_free_lists(struct zone *zone) · 2943 unmodified lines
62596264 }
62606265 }
62616266
6267+#if !defined(CONFIG_FLAT_NODE_MEM_MAP)
6268+/*
6269+ * Only struct pages that correspond to ranges defined by memblock.memory
6270+ * are zeroed and initialized by going through __init_single_page() during
6271+ * memmap_init_zone().
6272+ *
6273+ * But, there could be struct pages that correspond to holes in
6274+ * memblock.memory. This can happen because of the following reasons:
6275+ * - physical memory bank size is not necessarily the exact multiple of the
6276+ * arbitrary section size
6277+ * - early reserved memory may not be listed in memblock.memory
6278+ * - memory layouts defined with memmap= kernel parameter may not align
6279+ * nicely with memmap sections
6280+ *
6281+ * Explicitly initialize those struct pages so that:
6282+ * - PG_Reserved is set
6283+ * - zone and node links point to zone and node that span the page if the
6284+ * hole is in the middle of a zone
6285+ * - zone and node links point to adjacent zone/node if the hole falls on
6286+ * the zone boundary; the pages in such holes will be prepended to the
6287+ * zone/node above the hole except for the trailing pages in the last
6288+ * section that will be appended to the zone/node below.
6289+ */
6290+static u64 __meminit init_unavailable_range(unsigned long spfn,
6291+ unsigned long epfn,
6292+ int zone, int node)
6293+{
6294+ unsigned long pfn;
6295+ u64 pgcnt = 0;
6296+
6297+ for (pfn = spfn; pfn < epfn; pfn++) {
6298+ if (!pfn_valid(ALIGN_DOWN(pfn, pageblock_nr_pages))) {
6299+ pfn = ALIGN_DOWN(pfn, pageblock_nr_pages)
6300+ + pageblock_nr_pages - 1;
6301+ continue;
6302+ }
6303+ __init_single_page(pfn_to_page(pfn), pfn, zone, node);
6304+ __SetPageReserved(pfn_to_page(pfn));
6305+ pgcnt++;
6306+ }
6307+
6308+ return pgcnt;
6309+}
6310+#else
6311+static inline u64 init_unavailable_range(unsigned long spfn, unsigned long epfn,
6312+ int zone, int node)
6313+{
6314+ return 0;
6315+}
6316+#endif
6317+
62626318 void __meminit __weak memmap_init_zone(struct zone *zone)
62636319 {
62646320 unsigned long zone_start_pfn = zone->zone_start_pfn;
62656321 unsigned long zone_end_pfn = zone_start_pfn + zone->spanned_pages;
62666322 int i, nid = zone_to_nid(zone), zone_id = zone_idx(zone);
6323+ static unsigned long hole_pfn;
62676324 unsigned long start_pfn, end_pfn;
6325+ u64 pgcnt = 0;
62686326
62696327 for_each_mem_pfn_range(i, nid, &start_pfn, &end_pfn, NULL) {
62706328 start_pfn = clamp(start_pfn, zone_start_pfn, zone_end_pfn);
@@ -6274,7 +6332,29 @@ void __meminit __weak memmap_init_zone(struct zone *zone) · 3 unmodified lines
62746332 memmap_init_range(end_pfn - start_pfn, nid,
62756333 zone_id, start_pfn, zone_end_pfn,
62766334 MEMINIT_EARLY, NULL, MIGRATE_MOVABLE);
6335+
6336+ if (hole_pfn < start_pfn)
6337+ pgcnt += init_unavailable_range(hole_pfn, start_pfn,
6338+ zone_id, nid);
6339+ hole_pfn = end_pfn;
62776340 }
6341+
6342+#ifdef CONFIG_SPARSEMEM
6343+ /*
6344+ * Initialize the hole in the range [zone_end_pfn, section_end].
6345+ * If zone boundary falls in the middle of a section, this hole
6346+ * will be re-initialized during the call to this function for the
6347+ * higher zone.
6348+ */
6349+ end_pfn = round_up(zone_end_pfn, PAGES_PER_SECTION);
6350+ if (hole_pfn < end_pfn)
6351+ pgcnt += init_unavailable_range(hole_pfn, end_pfn,
6352+ zone_id, nid);
6353+#endif
6354+
6355+ if (pgcnt)
6356+ pr_info(" %s zone: %llu pages in unavailable ranges\n",
6357+ zone->name, pgcnt);
62786358 }
62796359
62806360 static int zone_batchsize(struct zone *zone)
@@ -7071,88 +7151,6 @@ void __init free_area_init_memoryless_node(int nid) · 790 unmodified lines
70717151 free_area_init_node(nid);
70727152 }
70737153
7074−#if !defined(CONFIG_FLAT_NODE_MEM_MAP)
7075−/*
7076− * Initialize all valid struct pages in the range [spfn, epfn) and mark them
7077− * PageReserved(). Return the number of struct pages that were initialized.
7078− */
7079−static u64 __init init_unavailable_range(unsigned long spfn, unsigned long epfn)
7080−{
7081− unsigned long pfn;
7082− u64 pgcnt = 0;
7083−
7084− for (pfn = spfn; pfn < epfn; pfn++) {
7085− if (!pfn_valid(ALIGN_DOWN(pfn, pageblock_nr_pages))) {
7086− pfn = ALIGN_DOWN(pfn, pageblock_nr_pages)
7087− + pageblock_nr_pages - 1;
7088− continue;
7089− }
7090− /*
7091− * Use a fake node/zone (0) for now. Some of these pages
7092− * (in memblock.reserved but not in memblock.memory) will
7093− * get re-initialized via reserve_bootmem_region() later.
7094− */
7095− __init_single_page(pfn_to_page(pfn), pfn, 0, 0);
7096− __SetPageReserved(pfn_to_page(pfn));
7097− pgcnt++;
7098− }
7099−
7100− return pgcnt;
7101−}
7102−
7103−/*
7104− * Only struct pages that are backed by physical memory are zeroed and
7105− * initialized by going through __init_single_page(). But, there are some
7106− * struct pages which are reserved in memblock allocator and their fields
7107− * may be accessed (for example page_to_pfn() on some configuration accesses
7108− * flags). We must explicitly initialize those struct pages.
7109− *
7110− * This function also addresses a similar issue where struct pages are left
7111− * uninitialized because the physical address range is not covered by
7112− * memblock.memory or memblock.reserved. That could happen when memblock
7113− * layout is manually configured via memmap=, or when the highest physical
7114− * address (max_pfn) does not end on a section boundary.
7115− */
7116−static void __init init_unavailable_mem(void)
7117−{
7118− phys_addr_t start, end;
7119− u64 i, pgcnt;
7120− phys_addr_t next = 0;
7121−
7122− /*
7123− * Loop through unavailable ranges not covered by memblock.memory.
7124− */
7125− pgcnt = 0;
7126− for_each_mem_range(i, &start, &end) {
7127− if (next < start)
7128− pgcnt += init_unavailable_range(PFN_DOWN(next),
7129− PFN_UP(start));
7130− next = end;
7131− }
7132−
7133− /*
7134− * Early sections always have a fully populated memmap for the whole
7135− * section - see pfn_valid(). If the last section has holes at the
7136− * end and that section is marked "online", the memmap will be
7137− * considered initialized. Make sure that memmap has a well defined
7138− * state.
7139− */
7140− pgcnt += init_unavailable_range(PFN_DOWN(next),
7141− round_up(max_pfn, PAGES_PER_SECTION));
7142−
7143− /*
7144− * Struct pages that do not have backing memory. This could be because
7145− * firmware is using some of this memory, or for some other reasons.
7146− */
7147− if (pgcnt)
7148− pr_info("Zeroed struct page in unavailable ranges: %lld pages", pgcnt);
7149−}
7150−#else
7151−static inline void __init init_unavailable_mem(void)
7152−{
7153−}
7154−#endif /* !CONFIG_FLAT_NODE_MEM_MAP */
7155−
71567154 #if MAX_NUMNODES > 1
71577155 /*
71587156 * Figure out the number of possible node ids.
@@ -7576,7 +7574,6 @@ void __init free_area_init(unsigned long *max_zone_pfn) · 417 unmodified lines
75767574 /* Initialise every node */
75777575 mminit_verify_pageflags_layout();
75787576 setup_nr_node_ids();
7579− init_unavailable_mem();
75807577 for_each_online_node(nid) {
75817578 pg_data_t *pgdat = NODE_DATA(nid);
75827579 free_area_init_node(nid);
mm/slab.c+1−1
@@ -2992,7 +2992,7 @@ static void *cache_alloc_debugcheck_after(struct kmem_cache *cachep, · 2991 unmodified lines
29922992 gfp_t flags, void *objp, unsigned long caller)
29932993 {
29942994 WARN_ON_ONCE(cachep->ctor && (flags & __GFP_ZERO));
2995− if (!objp)
2995+ if (!objp || is_kfence_address(objp))
29962996 return objp;
29972997 if (cachep->flags & SLAB_POISON) {
29982998 check_poison_obj(cachep, objp);
mm/slub.c+1−1
@@ -1993,7 +1993,7 @@ static void *get_partial_node(struct kmem_cache *s, struct kmem_cache_node *n, · 1992 unmodified lines
19931993
19941994 t = acquire_slab(s, n, page, object == NULL, &objects);
19951995 if (!t)
1996− continue; /* cmpxchg raced */
1996+ break;
19971997
19981998 available += objects;
19991999 if (!object) {
net/9p/client.c+0−4
@@ -1623,10 +1623,6 @@ p9_client_read_once(struct p9_fid *fid, u64 offset, struct iov_iter *to, · 1622 unmodified lines
16231623 }
16241624
16251625 p9_debug(P9_DEBUG_9P, "<<< RREAD count %d\n", count);
1626− if (!count) {
1627− p9_tag_remove(clnt, req);
1628− return 0;
1629− }
16301626
16311627 if (non_zc) {
16321628 int n = copy_to_iter(dataptr, count, to);
net/core/rtnetlink.c+1−1
@@ -2147,7 +2147,7 @@ out: · 2146 unmodified lines
21472147 out_err:
21482148 cb->args[1] = idx;
21492149 cb->args[0] = h;
2150− cb->seq = net->dev_base_seq;
2150+ cb->seq = tgt_net->dev_base_seq;
21512151 nl_dump_check_consistent(cb, nlmsg_hdr(skb));
21522152 if (netnsid >= 0)
21532153 put_net(tgt_net);
net/core/skbuff.c+2−0
@@ -3659,6 +3659,8 @@ unsigned int skb_find_text(struct sk_buff *skb, unsigned int from, · 3658 unmodified lines
36593659 struct ts_state state;
36603660 unsigned int ret;
36613661
3662+ BUILD_BUG_ON(sizeof(struct skb_seq_state) > sizeof(state.cb));
3663+
36623664 config->get_next_block = skb_ts_get_next_block;
36633665 config->finish = skb_ts_finish;
36643666
net/dsa/Kconfig+2−0
@@ -118,6 +118,8 @@ config NET_DSA_TAG_OCELOT · 117 unmodified lines
118118
119119 config NET_DSA_TAG_OCELOT_8021Q
120120 tristate "Tag driver for Ocelot family of switches, using VLAN"
121+ depends on MSCC_OCELOT_SWITCH_LIB || \
122+ (MSCC_OCELOT_SWITCH_LIB=n && COMPILE_TEST)
121123 select NET_DSA_TAG_8021Q
122124 help
123125 Say Y or M if you want to enable support for tagging frames with a
net/dsa/dsa_priv.h+14−11
@@ -230,8 +230,8 @@ int dsa_port_hsr_join(struct dsa_port *dp, struct net_device *hsr); · 229 unmodified lines
230230 void dsa_port_hsr_leave(struct dsa_port *dp, struct net_device *hsr);
231231 extern const struct phylink_mac_ops dsa_port_phylink_mac_ops;
232232
233−static inline bool dsa_port_offloads_netdev(struct dsa_port *dp,
234− struct net_device *dev)
233+static inline bool dsa_port_offloads_bridge_port(struct dsa_port *dp,
234+ struct net_device *dev)
235235 {
236236 /* Switchdev offloading can be configured on: */
237237
@@ -241,12 +241,6 @@ static inline bool dsa_port_offloads_netdev(struct dsa_port *dp, · 3 unmodified lines
241241 */
242242 return true;
243243
244− if (dp->bridge_dev == dev)
245− /* DSA ports connected to a bridge, and event was emitted
246− * for the bridge.
247− */
248− return true;
249−
250244 if (dp->lag_dev == dev)
251245 /* DSA ports connected to a bridge via a LAG */
252246 return true;
@@ -254,14 +248,23 @@ static inline bool dsa_port_offloads_netdev(struct dsa_port *dp, · 1 unmodified line
254248 return false;
255249 }
256250
251+static inline bool dsa_port_offloads_bridge(struct dsa_port *dp,
252+ struct net_device *bridge_dev)
253+{
254+ /* DSA ports connected to a bridge, and event was emitted
255+ * for the bridge.
256+ */
257+ return dp->bridge_dev == bridge_dev;
258+}
259+
257260 /* Returns true if any port of this tree offloads the given net_device */
258−static inline bool dsa_tree_offloads_netdev(struct dsa_switch_tree *dst,
259− struct net_device *dev)
261+static inline bool dsa_tree_offloads_bridge_port(struct dsa_switch_tree *dst,
262+ struct net_device *dev)
260263 {
261264 struct dsa_port *dp;
262265
263266 list_for_each_entry(dp, &dst->ports, list)
264− if (dsa_port_offloads_netdev(dp, dev))
267+ if (dsa_port_offloads_bridge_port(dp, dev))
265268 return true;
266269
267270 return false;
net/dsa/slave.c+43−16
@@ -278,28 +278,43 @@ static int dsa_slave_port_attr_set(struct net_device *dev, · 277 unmodified lines
278278 struct dsa_port *dp = dsa_slave_to_port(dev);
279279 int ret;
280280
281− if (!dsa_port_offloads_netdev(dp, attr->orig_dev))
282− return -EOPNOTSUPP;
283−
284281 switch (attr->id) {
285282 case SWITCHDEV_ATTR_ID_PORT_STP_STATE:
283+ if (!dsa_port_offloads_bridge_port(dp, attr->orig_dev))
284+ return -EOPNOTSUPP;
285+
286286 ret = dsa_port_set_state(dp, attr->u.stp_state);
287287 break;
288288 case SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING:
289+ if (!dsa_port_offloads_bridge(dp, attr->orig_dev))
290+ return -EOPNOTSUPP;
291+
289292 ret = dsa_port_vlan_filtering(dp, attr->u.vlan_filtering,
290293 extack);
291294 break;
292295 case SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME:
296+ if (!dsa_port_offloads_bridge(dp, attr->orig_dev))
297+ return -EOPNOTSUPP;
298+
293299 ret = dsa_port_ageing_time(dp, attr->u.ageing_time);
294300 break;
295301 case SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS:
302+ if (!dsa_port_offloads_bridge_port(dp, attr->orig_dev))
303+ return -EOPNOTSUPP;
304+
296305 ret = dsa_port_pre_bridge_flags(dp, attr->u.brport_flags,
297306 extack);
298307 break;
299308 case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
309+ if (!dsa_port_offloads_bridge_port(dp, attr->orig_dev))
310+ return -EOPNOTSUPP;
311+
300312 ret = dsa_port_bridge_flags(dp, attr->u.brport_flags, extack);
301313 break;
302314 case SWITCHDEV_ATTR_ID_BRIDGE_MROUTER:
315+ if (!dsa_port_offloads_bridge(dp, attr->orig_dev))
316+ return -EOPNOTSUPP;
317+
303318 ret = dsa_port_mrouter(dp->cpu_dp, attr->u.mrouter, extack);
304319 break;
305320 default:
@@ -341,9 +356,6 @@ static int dsa_slave_vlan_add(struct net_device *dev, · 35 unmodified lines
341356 struct switchdev_obj_port_vlan vlan;
342357 int err;
343358
344− if (!dsa_port_offloads_netdev(dp, obj->orig_dev))
345− return -EOPNOTSUPP;
346−
347359 if (dsa_port_skip_vlan_configuration(dp)) {
348360 NL_SET_ERR_MSG_MOD(extack, "skipping configuration of VLAN");
349361 return 0;
@@ -391,27 +403,36 @@ static int dsa_slave_port_obj_add(struct net_device *dev, · 41 unmodified lines
391403
392404 switch (obj->id) {
393405 case SWITCHDEV_OBJ_ID_PORT_MDB:
394− if (!dsa_port_offloads_netdev(dp, obj->orig_dev))
406+ if (!dsa_port_offloads_bridge_port(dp, obj->orig_dev))
395407 return -EOPNOTSUPP;
408+
396409 err = dsa_port_mdb_add(dp, SWITCHDEV_OBJ_PORT_MDB(obj));
397410 break;
398411 case SWITCHDEV_OBJ_ID_HOST_MDB:
412+ if (!dsa_port_offloads_bridge(dp, obj->orig_dev))
413+ return -EOPNOTSUPP;
414+
399415 /* DSA can directly translate this to a normal MDB add,
400416 * but on the CPU port.
401417 */
402418 err = dsa_port_mdb_add(dp->cpu_dp, SWITCHDEV_OBJ_PORT_MDB(obj));
403419 break;
404420 case SWITCHDEV_OBJ_ID_PORT_VLAN:
421+ if (!dsa_port_offloads_bridge_port(dp, obj->orig_dev))
422+ return -EOPNOTSUPP;
423+
405424 err = dsa_slave_vlan_add(dev, obj, extack);
406425 break;
407426 case SWITCHDEV_OBJ_ID_MRP:
408− if (!dsa_port_offloads_netdev(dp, obj->orig_dev))
427+ if (!dsa_port_offloads_bridge(dp, obj->orig_dev))
409428 return -EOPNOTSUPP;
429+
410430 err = dsa_port_mrp_add(dp, SWITCHDEV_OBJ_MRP(obj));
411431 break;
412432 case SWITCHDEV_OBJ_ID_RING_ROLE_MRP:
413− if (!dsa_port_offloads_netdev(dp, obj->orig_dev))
433+ if (!dsa_port_offloads_bridge(dp, obj->orig_dev))
414434 return -EOPNOTSUPP;
435+
415436 err = dsa_port_mrp_add_ring_role(dp,
416437 SWITCHDEV_OBJ_RING_ROLE_MRP(obj));
417438 break;
@@ -431,9 +452,6 @@ static int dsa_slave_vlan_del(struct net_device *dev, · 13 unmodified lines
431452 struct switchdev_obj_port_vlan *vlan;
432453 int err;
433454
434− if (!dsa_port_offloads_netdev(dp, obj->orig_dev))
435− return -EOPNOTSUPP;
436−
437455 if (dsa_port_skip_vlan_configuration(dp))
438456 return 0;
439457
@@ -459,27 +477,36 @@ static int dsa_slave_port_obj_del(struct net_device *dev, · 19 unmodified lines
459477
460478 switch (obj->id) {
461479 case SWITCHDEV_OBJ_ID_PORT_MDB:
462− if (!dsa_port_offloads_netdev(dp, obj->orig_dev))
480+ if (!dsa_port_offloads_bridge_port(dp, obj->orig_dev))
463481 return -EOPNOTSUPP;
482+
464483 err = dsa_port_mdb_del(dp, SWITCHDEV_OBJ_PORT_MDB(obj));
465484 break;
466485 case SWITCHDEV_OBJ_ID_HOST_MDB:
486+ if (!dsa_port_offloads_bridge(dp, obj->orig_dev))
487+ return -EOPNOTSUPP;
488+
467489 /* DSA can directly translate this to a normal MDB add,
468490 * but on the CPU port.
469491 */
470492 err = dsa_port_mdb_del(dp->cpu_dp, SWITCHDEV_OBJ_PORT_MDB(obj));
471493 break;
472494 case SWITCHDEV_OBJ_ID_PORT_VLAN:
495+ if (!dsa_port_offloads_bridge_port(dp, obj->orig_dev))
496+ return -EOPNOTSUPP;
497+
473498 err = dsa_slave_vlan_del(dev, obj);
474499 break;
475500 case SWITCHDEV_OBJ_ID_MRP:
476− if (!dsa_port_offloads_netdev(dp, obj->orig_dev))
501+ if (!dsa_port_offloads_bridge(dp, obj->orig_dev))
477502 return -EOPNOTSUPP;
503+
478504 err = dsa_port_mrp_del(dp, SWITCHDEV_OBJ_MRP(obj));
479505 break;
480506 case SWITCHDEV_OBJ_ID_RING_ROLE_MRP:
481− if (!dsa_port_offloads_netdev(dp, obj->orig_dev))
507+ if (!dsa_port_offloads_bridge(dp, obj->orig_dev))
482508 return -EOPNOTSUPP;
509+
483510 err = dsa_port_mrp_del_ring_role(dp,
484511 SWITCHDEV_OBJ_RING_ROLE_MRP(obj));
485512 break;
@@ -2298,7 +2325,7 @@ static int dsa_slave_switchdev_event(struct notifier_block *unused, · 1812 unmodified lines
22982325 * other ports bridged with the LAG should be able to
22992326 * autonomously forward towards it.
23002327 */
2301− if (dsa_tree_offloads_netdev(dp->ds->dst, dev))
2328+ if (dsa_tree_offloads_bridge_port(dp->ds->dst, dev))
23022329 return NOTIFY_DONE;
23032330 }
23042331
net/dsa/tag_mtk.c+13−6
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #define MTK_HDR_LEN 4
1414 #define MTK_HDR_XMIT_UNTAGGED 0
1515 #define MTK_HDR_XMIT_TAGGED_TPID_8100 1
16+#define MTK_HDR_XMIT_TAGGED_TPID_88A8 2
1617 #define MTK_HDR_RECV_SOURCE_PORT_MASK GENMASK(2, 0)
1718 #define MTK_HDR_XMIT_DP_BIT_MASK GENMASK(5, 0)
1819 #define MTK_HDR_XMIT_SA_DIS BIT(6)
@@ -21,8 +22,8 @@ static struct sk_buff *mtk_tag_xmit(struct sk_buff *skb, · 2 unmodified lines
2122 struct net_device *dev)
2223 {
2324 struct dsa_port *dp = dsa_slave_to_port(dev);
25+ u8 xmit_tpid;
2426 u8 *mtk_tag;
25− bool is_vlan_skb = true;
2627 unsigned char *dest = eth_hdr(skb)->h_dest;
2728 bool is_multicast_skb = is_multicast_ether_addr(dest) &&
2829 !is_broadcast_ether_addr(dest);
@@ -33,10 +34,17 @@ static struct sk_buff *mtk_tag_xmit(struct sk_buff *skb, · 4 unmodified lines
3334 * the both special and VLAN tag at the same time and then look up VLAN
3435 * table with VID.
3536 */
36− if (!skb_vlan_tagged(skb)) {
37+ switch (skb->protocol) {
38+ case htons(ETH_P_8021Q):
39+ xmit_tpid = MTK_HDR_XMIT_TAGGED_TPID_8100;
40+ break;
41+ case htons(ETH_P_8021AD):
42+ xmit_tpid = MTK_HDR_XMIT_TAGGED_TPID_88A8;
43+ break;
44+ default:
45+ xmit_tpid = MTK_HDR_XMIT_UNTAGGED;
3746 skb_push(skb, MTK_HDR_LEN);
3847 memmove(skb->data, skb->data + MTK_HDR_LEN, 2 * ETH_ALEN);
39− is_vlan_skb = false;
4048 }
4149
4250 mtk_tag = skb->data + 2 * ETH_ALEN;
@@ -44,8 +52,7 @@ static struct sk_buff *mtk_tag_xmit(struct sk_buff *skb, · 1 unmodified line
4452 /* Mark tag attribute on special tag insertion to notify hardware
4553 * whether that's a combined special tag with 802.1Q header.
4654 */
47− mtk_tag[0] = is_vlan_skb ? MTK_HDR_XMIT_TAGGED_TPID_8100 :
48− MTK_HDR_XMIT_UNTAGGED;
55+ mtk_tag[0] = xmit_tpid;
4956 mtk_tag[1] = (1 << dp->index) & MTK_HDR_XMIT_DP_BIT_MASK;
5057
5158 /* Disable SA learning for multicast frames */
@@ -53,7 +60,7 @@ static struct sk_buff *mtk_tag_xmit(struct sk_buff *skb, · 1 unmodified line
5360 mtk_tag[1] |= MTK_HDR_XMIT_SA_DIS;
5461
5562 /* Tag control information is kept for 802.1Q */
56− if (!is_vlan_skb) {
63+ if (xmit_tpid == MTK_HDR_XMIT_UNTAGGED) {
5764 mtk_tag[2] = 0;
5865 mtk_tag[3] = 0;
5966 }
net/dsa/tag_rtl4_a.c+5−7
@@ -35,14 +35,12 @@ static struct sk_buff *rtl4a_tag_xmit(struct sk_buff *skb, · 34 unmodified lines
3535 struct net_device *dev)
3636 {
3737 struct dsa_port *dp = dsa_slave_to_port(dev);
38+ __be16 *p;
3839 u8 *tag;
39− u16 *p;
4040 u16 out;
4141
4242 /* Pad out to at least 60 bytes */
43− if (unlikely(eth_skb_pad(skb)))
44− return NULL;
45− if (skb_cow_head(skb, RTL4_A_HDR_LEN) < 0)
43+ if (unlikely(__skb_put_padto(skb, ETH_ZLEN, false)))
4644 return NULL;
4745
4846 netdev_dbg(dev, "add realtek tag to package to port %d\n",
@@ -53,13 +51,13 @@ static struct sk_buff *rtl4a_tag_xmit(struct sk_buff *skb, · 4 unmodified lines
5351 tag = skb->data + 2 * ETH_ALEN;
5452
5553 /* Set Ethertype */
56− p = (u16 *)tag;
54+ p = (__be16 *)tag;
5755 *p = htons(RTL4_A_ETHERTYPE);
5856
5957 out = (RTL4_A_PROTOCOL_RTL8366RB << 12) | (2 << 8);
60− /* The lower bits is the port numer */
58+ /* The lower bits is the port number */
6159 out |= (u8)dp->index;
62− p = (u16 *)(tag + 2);
60+ p = (__be16 *)(tag + 2);
6361 *p = htons(out);
6462
6563 return skb;
net/ethtool/channels.c+13−13
@@ -116,10 +116,9 @@ int ethnl_set_channels(struct sk_buff *skb, struct genl_info *info) · 115 unmodified lines
116116 struct ethtool_channels channels = {};
117117 struct ethnl_req_info req_info = {};
118118 struct nlattr **tb = info->attrs;
119− const struct nlattr *err_attr;
119+ u32 err_attr, max_rx_in_use = 0;
120120 const struct ethtool_ops *ops;
121121 struct net_device *dev;
122− u32 max_rx_in_use = 0;
123122 int ret;
124123
125124 ret = ethnl_parse_header_dev_get(&req_info,
@@ -157,34 +156,35 @@ int ethnl_set_channels(struct sk_buff *skb, struct genl_info *info) · 31 unmodified lines
157156
158157 /* ensure new channel counts are within limits */
159158 if (channels.rx_count > channels.max_rx)
160− err_attr = tb[ETHTOOL_A_CHANNELS_RX_COUNT];
159+ err_attr = ETHTOOL_A_CHANNELS_RX_COUNT;
161160 else if (channels.tx_count > channels.max_tx)
162− err_attr = tb[ETHTOOL_A_CHANNELS_TX_COUNT];
161+ err_attr = ETHTOOL_A_CHANNELS_TX_COUNT;
163162 else if (channels.other_count > channels.max_other)
164− err_attr = tb[ETHTOOL_A_CHANNELS_OTHER_COUNT];
163+ err_attr = ETHTOOL_A_CHANNELS_OTHER_COUNT;
165164 else if (channels.combined_count > channels.max_combined)
166− err_attr = tb[ETHTOOL_A_CHANNELS_COMBINED_COUNT];
165+ err_attr = ETHTOOL_A_CHANNELS_COMBINED_COUNT;
167166 else
168− err_attr = NULL;
167+ err_attr = 0;
169168 if (err_attr) {
170169 ret = -EINVAL;
171− NL_SET_ERR_MSG_ATTR(info->extack, err_attr,
170+ NL_SET_ERR_MSG_ATTR(info->extack, tb[err_attr],
172171 "requested channel count exceeds maximum");
173172 goto out_ops;
174173 }
175174
176175 /* ensure there is at least one RX and one TX channel */
177176 if (!channels.combined_count && !channels.rx_count)
178− err_attr = tb[ETHTOOL_A_CHANNELS_RX_COUNT];
177+ err_attr = ETHTOOL_A_CHANNELS_RX_COUNT;
179178 else if (!channels.combined_count && !channels.tx_count)
180− err_attr = tb[ETHTOOL_A_CHANNELS_TX_COUNT];
179+ err_attr = ETHTOOL_A_CHANNELS_TX_COUNT;
181180 else
182− err_attr = NULL;
181+ err_attr = 0;
183182 if (err_attr) {
184183 if (mod_combined)
185− err_attr = tb[ETHTOOL_A_CHANNELS_COMBINED_COUNT];
184+ err_attr = ETHTOOL_A_CHANNELS_COMBINED_COUNT;
186185 ret = -EINVAL;
187− NL_SET_ERR_MSG_ATTR(info->extack, err_attr, "requested channel counts would result in no RX or TX channel being configured");
186+ NL_SET_ERR_MSG_ATTR(info->extack, tb[err_attr],
187+ "requested channel counts would result in no RX or TX channel being configured");
188188 goto out_ops;
189189 }
190190
net/ipv4/cipso_ipv4.c+2−11
@@ -519,16 +519,10 @@ int cipso_v4_doi_remove(u32 doi, struct netlbl_audit *audit_info) · 518 unmodified lines
519519 ret_val = -ENOENT;
520520 goto doi_remove_return;
521521 }
522− if (!refcount_dec_and_test(&doi_def->refcount)) {
523− spin_unlock(&cipso_v4_doi_list_lock);
524− ret_val = -EBUSY;
525− goto doi_remove_return;
526− }
527522 list_del_rcu(&doi_def->list);
528523 spin_unlock(&cipso_v4_doi_list_lock);
529524
530− cipso_v4_cache_invalidate();
531− call_rcu(&doi_def->rcu, cipso_v4_doi_free_rcu);
525+ cipso_v4_doi_putdef(doi_def);
532526 ret_val = 0;
533527
534528 doi_remove_return:
@@ -585,9 +579,6 @@ void cipso_v4_doi_putdef(struct cipso_v4_doi *doi_def) · 50 unmodified lines
585579
586580 if (!refcount_dec_and_test(&doi_def->refcount))
587581 return;
588− spin_lock(&cipso_v4_doi_list_lock);
589− list_del_rcu(&doi_def->list);
590− spin_unlock(&cipso_v4_doi_list_lock);
591582
592583 cipso_v4_cache_invalidate();
593584 call_rcu(&doi_def->rcu, cipso_v4_doi_free_rcu);
@@ -1162,7 +1153,7 @@ static void cipso_v4_gentag_hdr(const struct cipso_v4_doi *doi_def, · 568 unmodified lines
11621153 {
11631154 buf[0] = IPOPT_CIPSO;
11641155 buf[1] = CIPSO_V4_HDR_LEN + len;
1165− *(__be32 *)&buf[2] = htonl(doi_def->doi);
1156+ put_unaligned_be32(doi_def->doi, &buf[2]);
11661157 }
11671158
11681159 /**
net/ipv4/inetpeer.c+7−14
@@ -65,7 +65,7 @@ EXPORT_SYMBOL_GPL(inet_peer_base_init); · 64 unmodified lines
6565 #define PEER_MAX_GC 32
6666
6767 /* Exported for sysctl_net_ipv4. */
68−int inet_peer_threshold __read_mostly = 65536 + 128; /* start to throw entries more
68+int inet_peer_threshold __read_mostly; /* start to throw entries more
6969 * aggressively at this stage */
7070 int inet_peer_minttl __read_mostly = 120 * HZ; /* TTL under high load: 120 sec */
7171 int inet_peer_maxttl __read_mostly = 10 * 60 * HZ; /* usual time to live: 10 min */
@@ -73,20 +73,13 @@ int inet_peer_maxttl __read_mostly = 10 * 60 * HZ; /* usual time to live: 10 min · 1 unmodified line
7373 /* Called from ip_output.c:ip_init */
7474 void __init inet_initpeers(void)
7575 {
76− struct sysinfo si;
76+ u64 nr_entries;
7777
78− /* Use the straight interface to information about memory. */
79− si_meminfo(&si);
80− /* The values below were suggested by Alexey Kuznetsov
81− * <kuznet@ms2.inr.ac.ru>. I don't have any opinion about the values
82− * myself. --SAW
83− */
84− if (si.totalram <= (32768*1024)/PAGE_SIZE)
85− inet_peer_threshold >>= 1; /* max pool size about 1MB on IA32 */
86− if (si.totalram <= (16384*1024)/PAGE_SIZE)
87− inet_peer_threshold >>= 1; /* about 512KB */
88− if (si.totalram <= (8192*1024)/PAGE_SIZE)
89− inet_peer_threshold >>= 2; /* about 128KB */
78+ /* 1% of physical memory */
79+ nr_entries = div64_ul((u64)totalram_pages() << PAGE_SHIFT,
80+ 100 * L1_CACHE_ALIGN(sizeof(struct inet_peer)));
81+
82+ inet_peer_threshold = clamp_val(nr_entries, 4096, 65536 + 128);
9083
9184 peer_cachep = kmem_cache_create("inet_peer_cache",
9285 sizeof(struct inet_peer),
net/ipv4/ip_tunnel.c+2−3
@@ -502,8 +502,7 @@ static int tnl_update_pmtu(struct net_device *dev, struct sk_buff *skb, · 501 unmodified lines
502502 if (!skb_is_gso(skb) &&
503503 (inner_iph->frag_off & htons(IP_DF)) &&
504504 mtu < pkt_size) {
505− memset(IPCB(skb), 0, sizeof(*IPCB(skb)));
506− icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu));
505+ icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu));
507506 return -E2BIG;
508507 }
509508 }
@@ -527,7 +526,7 @@ static int tnl_update_pmtu(struct net_device *dev, struct sk_buff *skb, · 17 unmodified lines
527526
528527 if (!skb_is_gso(skb) && mtu >= IPV6_MIN_MTU &&
529528 mtu < pkt_size) {
530− icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
529+ icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
531530 return -E2BIG;
532531 }
533532 }
net/ipv4/ip_vti.c+3−3
@@ -238,13 +238,13 @@ static netdev_tx_t vti_xmit(struct sk_buff *skb, struct net_device *dev, · 237 unmodified lines
238238 if (skb->len > mtu) {
239239 skb_dst_update_pmtu_no_confirm(skb, mtu);
240240 if (skb->protocol == htons(ETH_P_IP)) {
241− icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
242− htonl(mtu));
241+ icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
242+ htonl(mtu));
243243 } else {
244244 if (mtu < IPV6_MIN_MTU)
245245 mtu = IPV6_MIN_MTU;
246246
247− icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
247+ icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
248248 }
249249
250250 dst_release(dst);
net/ipv4/nexthop.c+7−3
@@ -1399,7 +1399,7 @@ out: · 1398 unmodified lines
13991399
14001400 /* rtnl */
14011401 /* remove all nexthops tied to a device being deleted */
1402−static void nexthop_flush_dev(struct net_device *dev)
1402+static void nexthop_flush_dev(struct net_device *dev, unsigned long event)
14031403 {
14041404 unsigned int hash = nh_dev_hashfn(dev->ifindex);
14051405 struct net *net = dev_net(dev);
@@ -1411,6 +1411,10 @@ static void nexthop_flush_dev(struct net_device *dev) · 5 unmodified lines
14111411 if (nhi->fib_nhc.nhc_dev != dev)
14121412 continue;
14131413
1414+ if (nhi->reject_nh &&
1415+ (event == NETDEV_DOWN || event == NETDEV_CHANGE))
1416+ continue;
1417+
14141418 remove_nexthop(net, nhi->nh_parent, NULL);
14151419 }
14161420 }
@@ -2189,11 +2193,11 @@ static int nh_netdev_event(struct notifier_block *this, · 772 unmodified lines
21892193 switch (event) {
21902194 case NETDEV_DOWN:
21912195 case NETDEV_UNREGISTER:
2192− nexthop_flush_dev(dev);
2196+ nexthop_flush_dev(dev, event);
21932197 break;
21942198 case NETDEV_CHANGE:
21952199 if (!(dev_get_flags(dev) & (IFF_RUNNING | IFF_LOWER_UP)))
2196− nexthop_flush_dev(dev);
2200+ nexthop_flush_dev(dev, event);
21972201 break;
21982202 case NETDEV_CHANGEMTU:
21992203 info_ext = ptr;
net/ipv4/tcp.c+17−9
@@ -3469,16 +3469,23 @@ static int do_tcp_setsockopt(struct sock *sk, int level, int optname, · 3468 unmodified lines
34693469 break;
34703470
34713471 case TCP_QUEUE_SEQ:
3472− if (sk->sk_state != TCP_CLOSE)
3472+ if (sk->sk_state != TCP_CLOSE) {
34733473 err = -EPERM;
3474− else if (tp->repair_queue == TCP_SEND_QUEUE)
3475− WRITE_ONCE(tp->write_seq, val);
3476− else if (tp->repair_queue == TCP_RECV_QUEUE) {
3477− WRITE_ONCE(tp->rcv_nxt, val);
3478− WRITE_ONCE(tp->copied_seq, val);
3479− }
3480− else
3474+ } else if (tp->repair_queue == TCP_SEND_QUEUE) {
3475+ if (!tcp_rtx_queue_empty(sk))
3476+ err = -EPERM;
3477+ else
3478+ WRITE_ONCE(tp->write_seq, val);
3479+ } else if (tp->repair_queue == TCP_RECV_QUEUE) {
3480+ if (tp->rcv_nxt != tp->copied_seq) {
3481+ err = -EPERM;
3482+ } else {
3483+ WRITE_ONCE(tp->rcv_nxt, val);
3484+ WRITE_ONCE(tp->copied_seq, val);
3485+ }
3486+ } else {
34813487 err = -EINVAL;
3488+ }
34823489 break;
34833490
34843491 case TCP_REPAIR_OPTIONS:
@@ -4143,7 +4150,8 @@ static int do_tcp_getsockopt(struct sock *sk, int level, · 658 unmodified lines
41434150
41444151 if (get_user(len, optlen))
41454152 return -EFAULT;
4146− if (len < offsetofend(struct tcp_zerocopy_receive, length))
4153+ if (len < 0 ||
4154+ len < offsetofend(struct tcp_zerocopy_receive, length))
41474155 return -EINVAL;
41484156 if (unlikely(len > sizeof(zc))) {
41494157 err = check_zeroed_user(optval + sizeof(zc),
net/ipv4/udp_offload.c+1−1
@@ -526,7 +526,7 @@ struct sk_buff *udp_gro_receive(struct list_head *head, struct sk_buff *skb, · 525 unmodified lines
526526 }
527527
528528 if (!sk || NAPI_GRO_CB(skb)->encap_mark ||
529− (skb->ip_summed != CHECKSUM_PARTIAL &&
529+ (uh->check && skb->ip_summed != CHECKSUM_PARTIAL &&
530530 NAPI_GRO_CB(skb)->csum_cnt == 0 &&
531531 !NAPI_GRO_CB(skb)->csum_valid) ||
532532 !udp_sk(sk)->gro_receive)
net/ipv6/calipso.c+5−9
@@ -83,6 +83,9 @@ struct calipso_map_cache_entry { · 82 unmodified lines
8383
8484 static struct calipso_map_cache_bkt *calipso_cache;
8585
86+static void calipso_cache_invalidate(void);
87+static void calipso_doi_putdef(struct calipso_doi *doi_def);
88+
8689 /* Label Mapping Cache Functions
8790 */
8891
@@ -444,15 +447,10 @@ static int calipso_doi_remove(u32 doi, struct netlbl_audit *audit_info) · 355 unmodified lines
444447 ret_val = -ENOENT;
445448 goto doi_remove_return;
446449 }
447− if (!refcount_dec_and_test(&doi_def->refcount)) {
448− spin_unlock(&calipso_doi_list_lock);
449− ret_val = -EBUSY;
450− goto doi_remove_return;
451− }
452450 list_del_rcu(&doi_def->list);
453451 spin_unlock(&calipso_doi_list_lock);
454452
455− call_rcu(&doi_def->rcu, calipso_doi_free_rcu);
453+ calipso_doi_putdef(doi_def);
456454 ret_val = 0;
457455
458456 doi_remove_return:
@@ -508,10 +506,8 @@ static void calipso_doi_putdef(struct calipso_doi *doi_def) · 49 unmodified lines
508506
509507 if (!refcount_dec_and_test(&doi_def->refcount))
510508 return;
511− spin_lock(&calipso_doi_list_lock);
512− list_del_rcu(&doi_def->list);
513− spin_unlock(&calipso_doi_list_lock);
514509
510+ calipso_cache_invalidate();
515511 call_rcu(&doi_def->rcu, calipso_doi_free_rcu);
516512 }
517513
net/ipv6/ip6_gre.c+8−8
@@ -678,8 +678,8 @@ static int prepare_ip6gre_xmit_ipv6(struct sk_buff *skb, · 677 unmodified lines
678678
679679 tel = (struct ipv6_tlv_tnl_enc_lim *)&skb_network_header(skb)[offset];
680680 if (tel->encap_limit == 0) {
681− icmpv6_send(skb, ICMPV6_PARAMPROB,
682− ICMPV6_HDR_FIELD, offset + 2);
681+ icmpv6_ndo_send(skb, ICMPV6_PARAMPROB,
682+ ICMPV6_HDR_FIELD, offset + 2);
683683 return -1;
684684 }
685685 *encap_limit = tel->encap_limit - 1;
@@ -805,8 +805,8 @@ static inline int ip6gre_xmit_ipv4(struct sk_buff *skb, struct net_device *dev) · 119 unmodified lines
805805 if (err != 0) {
806806 /* XXX: send ICMP error even if DF is not set. */
807807 if (err == -EMSGSIZE)
808− icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
809− htonl(mtu));
808+ icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
809+ htonl(mtu));
810810 return -1;
811811 }
812812
@@ -837,7 +837,7 @@ static inline int ip6gre_xmit_ipv6(struct sk_buff *skb, struct net_device *dev) · 24 unmodified lines
837837 &mtu, skb->protocol);
838838 if (err != 0) {
839839 if (err == -EMSGSIZE)
840− icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
840+ icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
841841 return -1;
842842 }
843843
@@ -1063,10 +1063,10 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb, · 219 unmodified lines
10631063 /* XXX: send ICMP error even if DF is not set. */
10641064 if (err == -EMSGSIZE) {
10651065 if (skb->protocol == htons(ETH_P_IP))
1066− icmp_send(skb, ICMP_DEST_UNREACH,
1067− ICMP_FRAG_NEEDED, htonl(mtu));
1066+ icmp_ndo_send(skb, ICMP_DEST_UNREACH,
1067+ ICMP_FRAG_NEEDED, htonl(mtu));
10681068 else
1069− icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
1069+ icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
10701070 }
10711071
10721072 goto tx_err;
net/ipv6/ip6_tunnel.c+5−5
@@ -1332,8 +1332,8 @@ ipxip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev, · 1331 unmodified lines
13321332
13331333 tel = (void *)&skb_network_header(skb)[offset];
13341334 if (tel->encap_limit == 0) {
1335− icmpv6_send(skb, ICMPV6_PARAMPROB,
1336− ICMPV6_HDR_FIELD, offset + 2);
1335+ icmpv6_ndo_send(skb, ICMPV6_PARAMPROB,
1336+ ICMPV6_HDR_FIELD, offset + 2);
13371337 return -1;
13381338 }
13391339 encap_limit = tel->encap_limit - 1;
@@ -1385,11 +1385,11 @@ ipxip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev, · 45 unmodified lines
13851385 if (err == -EMSGSIZE)
13861386 switch (protocol) {
13871387 case IPPROTO_IPIP:
1388− icmp_send(skb, ICMP_DEST_UNREACH,
1389− ICMP_FRAG_NEEDED, htonl(mtu));
1388+ icmp_ndo_send(skb, ICMP_DEST_UNREACH,
1389+ ICMP_FRAG_NEEDED, htonl(mtu));
13901390 break;
13911391 case IPPROTO_IPV6:
1392− icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
1392+ icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
13931393 break;
13941394 default:
13951395 break;
net/ipv6/ip6_vti.c+3−3
@@ -521,10 +521,10 @@ vti6_xmit(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) · 520 unmodified lines
521521 if (mtu < IPV6_MIN_MTU)
522522 mtu = IPV6_MIN_MTU;
523523
524− icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
524+ icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
525525 } else {
526− icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
527− htonl(mtu));
526+ icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
527+ htonl(mtu));
528528 }
529529
530530 err = -EMSGSIZE;
net/ipv6/sit.c+1−1
@@ -987,7 +987,7 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb, · 986 unmodified lines
987987 skb_dst_update_pmtu_no_confirm(skb, mtu);
988988
989989 if (skb->len > mtu && !skb_is_gso(skb)) {
990− icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
990+ icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
991991 ip_rt_put(rt);
992992 goto tx_error;
993993 }
net/l2tp/l2tp_core.c+22−19
@@ -649,9 +649,9 @@ void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb, · 648 unmodified lines
649649 /* Parse and check optional cookie */
650650 if (session->peer_cookie_len > 0) {
651651 if (memcmp(ptr, &session->peer_cookie[0], session->peer_cookie_len)) {
652− pr_warn_ratelimited("%s: cookie mismatch (%u/%u). Discarding.\n",
653− tunnel->name, tunnel->tunnel_id,
654− session->session_id);
652+ pr_debug_ratelimited("%s: cookie mismatch (%u/%u). Discarding.\n",
653+ tunnel->name, tunnel->tunnel_id,
654+ session->session_id);
655655 atomic_long_inc(&session->stats.rx_cookie_discards);
656656 goto discard;
657657 }
@@ -702,8 +702,8 @@ void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb, · 44 unmodified lines
702702 * If user has configured mandatory sequence numbers, discard.
703703 */
704704 if (session->recv_seq) {
705− pr_warn_ratelimited("%s: recv data has no seq numbers when required. Discarding.\n",
706− session->name);
705+ pr_debug_ratelimited("%s: recv data has no seq numbers when required. Discarding.\n",
706+ session->name);
707707 atomic_long_inc(&session->stats.rx_seq_discards);
708708 goto discard;
709709 }
@@ -718,8 +718,8 @@ void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb, · 8 unmodified lines
718718 session->send_seq = 0;
719719 l2tp_session_set_header_len(session, tunnel->version);
720720 } else if (session->send_seq) {
721− pr_warn_ratelimited("%s: recv data has no seq numbers when required. Discarding.\n",
722− session->name);
721+ pr_debug_ratelimited("%s: recv data has no seq numbers when required. Discarding.\n",
722+ session->name);
723723 atomic_long_inc(&session->stats.rx_seq_discards);
724724 goto discard;
725725 }
@@ -809,9 +809,9 @@ static int l2tp_udp_recv_core(struct l2tp_tunnel *tunnel, struct sk_buff *skb) · 83 unmodified lines
809809
810810 /* Short packet? */
811811 if (!pskb_may_pull(skb, L2TP_HDR_SIZE_MAX)) {
812− pr_warn_ratelimited("%s: recv short packet (len=%d)\n",
813− tunnel->name, skb->len);
814− goto error;
812+ pr_debug_ratelimited("%s: recv short packet (len=%d)\n",
813+ tunnel->name, skb->len);
814+ goto invalid;
815815 }
816816
817817 /* Point to L2TP header */
@@ -824,9 +824,9 @@ static int l2tp_udp_recv_core(struct l2tp_tunnel *tunnel, struct sk_buff *skb) · 6 unmodified lines
824824 /* Check protocol version */
825825 version = hdrflags & L2TP_HDR_VER_MASK;
826826 if (version != tunnel->version) {
827− pr_warn_ratelimited("%s: recv protocol version mismatch: got %d expected %d\n",
828− tunnel->name, version, tunnel->version);
829− goto error;
827+ pr_debug_ratelimited("%s: recv protocol version mismatch: got %d expected %d\n",
828+ tunnel->name, version, tunnel->version);
829+ goto invalid;
830830 }
831831
832832 /* Get length of L2TP packet */
@@ -834,7 +834,7 @@ static int l2tp_udp_recv_core(struct l2tp_tunnel *tunnel, struct sk_buff *skb) · 1 unmodified line
834834
835835 /* If type is control packet, it is handled by userspace. */
836836 if (hdrflags & L2TP_HDRFLAG_T)
837− goto error;
837+ goto pass;
838838
839839 /* Skip flags */
840840 ptr += 2;
@@ -863,21 +863,24 @@ static int l2tp_udp_recv_core(struct l2tp_tunnel *tunnel, struct sk_buff *skb) · 22 unmodified lines
863863 l2tp_session_dec_refcount(session);
864864
865865 /* Not found? Pass to userspace to deal with */
866− pr_warn_ratelimited("%s: no session found (%u/%u). Passing up.\n",
867− tunnel->name, tunnel_id, session_id);
868− goto error;
866+ pr_debug_ratelimited("%s: no session found (%u/%u). Passing up.\n",
867+ tunnel->name, tunnel_id, session_id);
868+ goto pass;
869869 }
870870
871871 if (tunnel->version == L2TP_HDR_VER_3 &&
872872 l2tp_v3_ensure_opt_in_linear(session, skb, &ptr, &optr))
873− goto error;
873+ goto invalid;
874874
875875 l2tp_recv_common(session, skb, ptr, optr, hdrflags, length);
876876 l2tp_session_dec_refcount(session);
877877
878878 return 0;
879879
880−error:
880+invalid:
881+ atomic_long_inc(&tunnel->stats.rx_invalid);
882+
883+pass:
881884 /* Put UDP header back */
882885 __skb_push(skb, sizeof(struct udphdr));
883886
net/l2tp/l2tp_core.h+1−0
@@ -39,6 +39,7 @@ struct l2tp_stats { · 38 unmodified lines
3939 atomic_long_t rx_oos_packets;
4040 atomic_long_t rx_errors;
4141 atomic_long_t rx_cookie_discards;
42+ atomic_long_t rx_invalid;
4243 };
4344
4445 struct l2tp_tunnel;
net/l2tp/l2tp_netlink.c+6−0
@@ -428,6 +428,9 @@ static int l2tp_nl_tunnel_send(struct sk_buff *skb, u32 portid, u32 seq, int fla · 427 unmodified lines
428428 L2TP_ATTR_STATS_PAD) ||
429429 nla_put_u64_64bit(skb, L2TP_ATTR_RX_ERRORS,
430430 atomic_long_read(&tunnel->stats.rx_errors),
431+ L2TP_ATTR_STATS_PAD) ||
432+ nla_put_u64_64bit(skb, L2TP_ATTR_RX_INVALID,
433+ atomic_long_read(&tunnel->stats.rx_invalid),
431434 L2TP_ATTR_STATS_PAD))
432435 goto nla_put_failure;
433436 nla_nest_end(skb, nest);
@@ -771,6 +774,9 @@ static int l2tp_nl_session_send(struct sk_buff *skb, u32 portid, u32 seq, int fl · 337 unmodified lines
771774 L2TP_ATTR_STATS_PAD) ||
772775 nla_put_u64_64bit(skb, L2TP_ATTR_RX_ERRORS,
773776 atomic_long_read(&session->stats.rx_errors),
777+ L2TP_ATTR_STATS_PAD) ||
778+ nla_put_u64_64bit(skb, L2TP_ATTR_RX_INVALID,
779+ atomic_long_read(&session->stats.rx_invalid),
774780 L2TP_ATTR_STATS_PAD))
775781 goto nla_put_failure;
776782 nla_nest_end(skb, nest);
net/mpls/mpls_gso.c+3−0
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414 #include <linux/netdev_features.h>
1515 #include <linux/netdevice.h>
1616 #include <linux/skbuff.h>
17+#include <net/mpls.h>
1718
1819 static struct sk_buff *mpls_gso_segment(struct sk_buff *skb,
1920 netdev_features_t features)
@@ -27,6 +28,8 @@ static struct sk_buff *mpls_gso_segment(struct sk_buff *skb, · 7 unmodified lines
2728
2829 skb_reset_network_header(skb);
2930 mpls_hlen = skb_inner_network_header(skb) - skb_network_header(skb);
31+ if (unlikely(!mpls_hlen || mpls_hlen % MPLS_HLEN))
32+ goto out;
3033 if (unlikely(!pskb_may_pull(skb, mpls_hlen)))
3134 goto out;
3235
net/mptcp/protocol.c+104−61
@@ -1061,6 +1061,12 @@ out: · 1060 unmodified lines
10611061 }
10621062 }
10631063
1064+static void __mptcp_clean_una_wakeup(struct sock *sk)
1065+{
1066+ __mptcp_clean_una(sk);
1067+ mptcp_write_space(sk);
1068+}
1069+
10641070 static void mptcp_enter_memory_pressure(struct sock *sk)
10651071 {
10661072 struct mptcp_subflow_context *subflow;
@@ -1189,6 +1195,7 @@ static bool mptcp_tx_cache_refill(struct sock *sk, int size, · 122 unmodified lines
11891195 */
11901196 while (skbs->qlen > 1) {
11911197 skb = __skb_dequeue_tail(skbs);
1198+ *total_ts -= skb->truesize;
11921199 __kfree_skb(skb);
11931200 }
11941201 return skbs->qlen > 0;
@@ -1444,7 +1451,7 @@ static void mptcp_push_release(struct sock *sk, struct sock *ssk, · 249 unmodified lines
14441451 release_sock(ssk);
14451452 }
14461453
1447−static void mptcp_push_pending(struct sock *sk, unsigned int flags)
1454+static void __mptcp_push_pending(struct sock *sk, unsigned int flags)
14481455 {
14491456 struct sock *prev_ssk = NULL, *ssk = NULL;
14501457 struct mptcp_sock *msk = mptcp_sk(sk);
@@ -1696,14 +1703,14 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) · 245 unmodified lines
16961703
16971704 wait_for_memory:
16981705 mptcp_set_nospace(sk);
1699− mptcp_push_pending(sk, msg->msg_flags);
1706+ __mptcp_push_pending(sk, msg->msg_flags);
17001707 ret = sk_stream_wait_memory(sk, &timeo);
17011708 if (ret)
17021709 goto out;
17031710 }
17041711
17051712 if (copied)
1706− mptcp_push_pending(sk, msg->msg_flags);
1713+ __mptcp_push_pending(sk, msg->msg_flags);
17071714
17081715 out:
17091716 release_sock(sk);
@@ -2115,6 +2122,14 @@ static struct sock *mptcp_subflow_get_retrans(const struct mptcp_sock *msk) · 405 unmodified lines
21152122 return backup;
21162123 }
21172124
2125+static void mptcp_dispose_initial_subflow(struct mptcp_sock *msk)
2126+{
2127+ if (msk->subflow) {
2128+ iput(SOCK_INODE(msk->subflow));
2129+ msk->subflow = NULL;
2130+ }
2131+}
2132+
21182133 /* subflow sockets can be either outgoing (connect) or incoming
21192134 * (accept).
21202135 *
@@ -2126,6 +2141,8 @@ static struct sock *mptcp_subflow_get_retrans(const struct mptcp_sock *msk) · 5 unmodified lines
21262141 static void __mptcp_close_ssk(struct sock *sk, struct sock *ssk,
21272142 struct mptcp_subflow_context *subflow)
21282143 {
2144+ struct mptcp_sock *msk = mptcp_sk(sk);
2145+
21292146 list_del(&subflow->node);
21302147
21312148 lock_sock_nested(ssk, SINGLE_DEPTH_NESTING);
@@ -2154,6 +2171,18 @@ static void __mptcp_close_ssk(struct sock *sk, struct sock *ssk, · 22 unmodified lines
21542171 release_sock(ssk);
21552172
21562173 sock_put(ssk);
2174+
2175+ if (ssk == msk->last_snd)
2176+ msk->last_snd = NULL;
2177+
2178+ if (ssk == msk->ack_hint)
2179+ msk->ack_hint = NULL;
2180+
2181+ if (ssk == msk->first)
2182+ msk->first = NULL;
2183+
2184+ if (msk->subflow && ssk == msk->subflow->sk)
2185+ mptcp_dispose_initial_subflow(msk);
21572186 }
21582187
21592188 void mptcp_close_ssk(struct sock *sk, struct sock *ssk,
@@ -2238,14 +2267,58 @@ static void mptcp_check_fastclose(struct mptcp_sock *msk) · 78 unmodified lines
22382267 mptcp_close_wake_up(sk);
22392268 }
22402269
2241−static void mptcp_worker(struct work_struct *work)
2270+static void __mptcp_retrans(struct sock *sk)
22422271 {
2243− struct mptcp_sock *msk = container_of(work, struct mptcp_sock, work);
2244− struct sock *ssk, *sk = &msk->sk.icsk_inet.sk;
2272+ struct mptcp_sock *msk = mptcp_sk(sk);
22452273 struct mptcp_sendmsg_info info = {};
22462274 struct mptcp_data_frag *dfrag;
22472275 size_t copied = 0;
2248− int state, ret;
2276+ struct sock *ssk;
2277+ int ret;
2278+
2279+ __mptcp_clean_una_wakeup(sk);
2280+ dfrag = mptcp_rtx_head(sk);
2281+ if (!dfrag)
2282+ return;
2283+
2284+ ssk = mptcp_subflow_get_retrans(msk);
2285+ if (!ssk)
2286+ goto reset_timer;
2287+
2288+ lock_sock(ssk);
2289+
2290+ /* limit retransmission to the bytes already sent on some subflows */
2291+ info.sent = 0;
2292+ info.limit = dfrag->already_sent;
2293+ while (info.sent < dfrag->already_sent) {
2294+ if (!mptcp_alloc_tx_skb(sk, ssk))
2295+ break;
2296+
2297+ ret = mptcp_sendmsg_frag(sk, ssk, dfrag, &info);
2298+ if (ret <= 0)
2299+ break;
2300+
2301+ MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RETRANSSEGS);
2302+ copied += ret;
2303+ info.sent += ret;
2304+ }
2305+ if (copied)
2306+ tcp_push(ssk, 0, info.mss_now, tcp_sk(ssk)->nonagle,
2307+ info.size_goal);
2308+
2309+ mptcp_set_timeout(sk, ssk);
2310+ release_sock(ssk);
2311+
2312+reset_timer:
2313+ if (!mptcp_timer_pending(sk))
2314+ mptcp_reset_timer(sk);
2315+}
2316+
2317+static void mptcp_worker(struct work_struct *work)
2318+{
2319+ struct mptcp_sock *msk = container_of(work, struct mptcp_sock, work);
2320+ struct sock *sk = &msk->sk.icsk_inet.sk;
2321+ int state;
22492322
22502323 lock_sock(sk);
22512324 state = sk->sk_state;
@@ -2280,45 +2353,8 @@ static void mptcp_worker(struct work_struct *work) · 28 unmodified lines
22802353 if (test_and_clear_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags))
22812354 __mptcp_close_subflow(msk);
22822355
2283− if (!test_and_clear_bit(MPTCP_WORK_RTX, &msk->flags))
2284− goto unlock;
2285−
2286− __mptcp_clean_una(sk);
2287− dfrag = mptcp_rtx_head(sk);
2288− if (!dfrag)
2289− goto unlock;
2290−
2291− ssk = mptcp_subflow_get_retrans(msk);
2292− if (!ssk)
2293− goto reset_unlock;
2294−
2295− lock_sock(ssk);
2296−
2297− /* limit retransmission to the bytes already sent on some subflows */
2298− info.sent = 0;
2299− info.limit = dfrag->already_sent;
2300− while (info.sent < dfrag->already_sent) {
2301− if (!mptcp_alloc_tx_skb(sk, ssk))
2302− break;
2303−
2304− ret = mptcp_sendmsg_frag(sk, ssk, dfrag, &info);
2305− if (ret <= 0)
2306− break;
2307−
2308− MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RETRANSSEGS);
2309− copied += ret;
2310− info.sent += ret;
2311− }
2312− if (copied)
2313− tcp_push(ssk, 0, info.mss_now, tcp_sk(ssk)->nonagle,
2314− info.size_goal);
2315−
2316− mptcp_set_timeout(sk, ssk);
2317− release_sock(ssk);
2318−
2319−reset_unlock:
2320− if (!mptcp_timer_pending(sk))
2321− mptcp_reset_timer(sk);
2356+ if (test_and_clear_bit(MPTCP_WORK_RTX, &msk->flags))
2357+ __mptcp_retrans(sk);
23222358
23232359 unlock:
23242360 release_sock(sk);
@@ -2523,12 +2559,6 @@ static void __mptcp_destroy_sock(struct sock *sk) · 198 unmodified lines
25232559
25242560 might_sleep();
25252561
2526− /* dispose the ancillatory tcp socket, if any */
2527− if (msk->subflow) {
2528− iput(SOCK_INODE(msk->subflow));
2529− msk->subflow = NULL;
2530− }
2531−
25322562 /* be sure to always acquire the join list lock, to sync vs
25332563 * mptcp_finish_join().
25342564 */
@@ -2553,6 +2583,7 @@ static void __mptcp_destroy_sock(struct sock *sk) · 18 unmodified lines
25532583 sk_stream_kill_queues(sk);
25542584 xfrm_sk_free_policy(sk);
25552585 sk_refcnt_debug_release(sk);
2586+ mptcp_dispose_initial_subflow(msk);
25562587 sock_put(sk);
25572588 }
25582589
@@ -2934,13 +2965,14 @@ static void mptcp_release_cb(struct sock *sk) · 375 unmodified lines
29342965 {
29352966 unsigned long flags, nflags;
29362967
2937− /* push_pending may touch wmem_reserved, do it before the later
2938− * cleanup
2939− */
2940− if (test_and_clear_bit(MPTCP_CLEAN_UNA, &mptcp_sk(sk)->flags))
2941− __mptcp_clean_una(sk);
2942− if (test_and_clear_bit(MPTCP_PUSH_PENDING, &mptcp_sk(sk)->flags)) {
2943− /* mptcp_push_pending() acquires the subflow socket lock
2968+ for (;;) {
2969+ flags = 0;
2970+ if (test_and_clear_bit(MPTCP_PUSH_PENDING, &mptcp_sk(sk)->flags))
2971+ flags |= MPTCP_PUSH_PENDING;
2972+ if (!flags)
2973+ break;
2974+
2975+ /* the following actions acquire the subflow socket lock
29442976 *
29452977 * 1) can't be invoked in atomic scope
29462978 * 2) must avoid ABBA deadlock with msk socket spinlock: the RX
@@ -2949,13 +2981,21 @@ static void mptcp_release_cb(struct sock *sk) · 2 unmodified lines
29492981 */
29502982
29512983 spin_unlock_bh(&sk->sk_lock.slock);
2952− mptcp_push_pending(sk, 0);
2984+ if (flags & MPTCP_PUSH_PENDING)
2985+ __mptcp_push_pending(sk, 0);
2986+
2987+ cond_resched();
29532988 spin_lock_bh(&sk->sk_lock.slock);
29542989 }
2990+
2991+ if (test_and_clear_bit(MPTCP_CLEAN_UNA, &mptcp_sk(sk)->flags))
2992+ __mptcp_clean_una_wakeup(sk);
29552993 if (test_and_clear_bit(MPTCP_ERROR_REPORT, &mptcp_sk(sk)->flags))
29562994 __mptcp_error_report(sk);
29572995
2958− /* clear any wmem reservation and errors */
2996+ /* push_pending may touch wmem_reserved, ensure we do the cleanup
2997+ * later
2998+ */
29592999 __mptcp_update_wmem(sk);
29603000 __mptcp_update_rmem(sk);
29613001
@@ -3285,6 +3325,9 @@ static int mptcp_stream_accept(struct socket *sock, struct socket *newsock, · 323 unmodified lines
32853325 /* PM/worker can now acquire the first subflow socket
32863326 * lock without racing with listener queue cleanup,
32873327 * we can notify it, if needed.
3328+ *
3329+ * Even if remote has reset the initial subflow by now
3330+ * the refcnt is still at least one.
32883331 */
32893332 subflow = mptcp_subflow_ctx(msk->first);
32903333 list_add(&subflow->node, &msk->conn_list);
net/mptcp/protocol.h+8−6
@@ -52,14 +52,15 @@ · 51 unmodified lines
5252 #define TCPOLEN_MPTCP_DSS_MAP64 14
5353 #define TCPOLEN_MPTCP_DSS_CHECKSUM 2
5454 #define TCPOLEN_MPTCP_ADD_ADDR 16
55−#define TCPOLEN_MPTCP_ADD_ADDR_PORT 20
55+#define TCPOLEN_MPTCP_ADD_ADDR_PORT 18
5656 #define TCPOLEN_MPTCP_ADD_ADDR_BASE 8
57−#define TCPOLEN_MPTCP_ADD_ADDR_BASE_PORT 12
57+#define TCPOLEN_MPTCP_ADD_ADDR_BASE_PORT 10
5858 #define TCPOLEN_MPTCP_ADD_ADDR6 28
59−#define TCPOLEN_MPTCP_ADD_ADDR6_PORT 32
59+#define TCPOLEN_MPTCP_ADD_ADDR6_PORT 30
6060 #define TCPOLEN_MPTCP_ADD_ADDR6_BASE 20
61−#define TCPOLEN_MPTCP_ADD_ADDR6_BASE_PORT 24
62−#define TCPOLEN_MPTCP_PORT_LEN 4
61+#define TCPOLEN_MPTCP_ADD_ADDR6_BASE_PORT 22
62+#define TCPOLEN_MPTCP_PORT_LEN 2
63+#define TCPOLEN_MPTCP_PORT_ALIGN 2
6364 #define TCPOLEN_MPTCP_RM_ADDR_BASE 4
6465 #define TCPOLEN_MPTCP_PRIO 3
6566 #define TCPOLEN_MPTCP_PRIO_ALIGN 4
@@ -701,8 +702,9 @@ static inline unsigned int mptcp_add_addr_len(int family, bool echo, bool port) · 635 unmodified lines
701702 len = TCPOLEN_MPTCP_ADD_ADDR6_BASE;
702703 if (!echo)
703704 len += MPTCPOPT_THMAC_LEN;
705+ /* account for 2 trailing 'nop' options */
704706 if (port)
705− len += TCPOLEN_MPTCP_PORT_LEN;
707+ len += TCPOLEN_MPTCP_PORT_LEN + TCPOLEN_MPTCP_PORT_ALIGN;
706708
707709 return len;
708710 }
net/mptcp/subflow.c+8−6
@@ -687,11 +687,6 @@ create_child: · 686 unmodified lines
687687 /* move the msk reference ownership to the subflow */
688688 subflow_req->msk = NULL;
689689 ctx->conn = (struct sock *)owner;
690− if (!mptcp_finish_join(child))
691− goto dispose_child;
692−
693− SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKRX);
694− tcp_rsk(req)->drop_req = true;
695690
696691 if (subflow_use_different_sport(owner, sk)) {
697692 pr_debug("ack inet_sport=%d %d",
@@ -699,10 +694,16 @@ create_child: · 1 unmodified line
699694 ntohs(inet_sk((struct sock *)owner)->inet_sport));
700695 if (!mptcp_pm_sport_in_anno_list(owner, sk)) {
701696 SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_MISMATCHPORTACKRX);
702− goto out;
697+ goto dispose_child;
703698 }
704699 SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINPORTACKRX);
705700 }
701+
702+ if (!mptcp_finish_join(child))
703+ goto dispose_child;
704+
705+ SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKRX);
706+ tcp_rsk(req)->drop_req = true;
706707 }
707708 }
708709
@@ -1297,6 +1298,7 @@ failed_unlink: · 588 unmodified lines
12971298 spin_lock_bh(&msk->join_list_lock);
12981299 list_del(&subflow->node);
12991300 spin_unlock_bh(&msk->join_list_lock);
1301+ sock_put(mptcp_subflow_tcp_sock(subflow));
13001302
13011303 failed:
13021304 subflow->disposable = 1;
net/netfilter/nf_conntrack_helper.c+1−2
@@ -219,7 +219,7 @@ nf_ct_lookup_helper(struct nf_conn *ct, struct net *net) · 218 unmodified lines
219219 return NULL;
220220 pr_info("nf_conntrack: default automatic helper assignment "
221221 "has been turned off for security reasons and CT-based "
222− " firewall rule not found. Use the iptables CT target "
222+ "firewall rule not found. Use the iptables CT target "
223223 "to attach helpers instead.\n");
224224 net->ct.auto_assign_helper_warned = 1;
225225 return NULL;
@@ -228,7 +228,6 @@ nf_ct_lookup_helper(struct nf_conn *ct, struct net *net) · 2 unmodified lines
228228 return __nf_ct_helper_find(&ct->tuplehash[IP_CT_DIR_REPLY].tuple);
229229 }
230230
231−
232231 int __nf_ct_try_assign_helper(struct nf_conn *ct, struct nf_conn *tmpl,
233232 gfp_t flags)
234233 {
net/netfilter/nf_conntrack_proto_tcp.c+4−2
@@ -982,8 +982,10 @@ int nf_conntrack_tcp_packet(struct nf_conn *ct, · 981 unmodified lines
982982 IP_CT_EXP_CHALLENGE_ACK;
983983 }
984984 spin_unlock_bh(&ct->lock);
985− nf_ct_l4proto_log_invalid(skb, ct, "invalid packet ignored in "
986− "state %s ", tcp_conntrack_names[old_state]);
985+ nf_ct_l4proto_log_invalid(skb, ct,
986+ "packet (index %d) in dir %d ignored, state %s",
987+ index, dir,
988+ tcp_conntrack_names[old_state]);
987989 return NF_ACCEPT;
988990 case TCP_CONNTRACK_MAX:
989991 /* Special case for SYN proxy: when the SYN to the server or
net/netfilter/nf_nat_proto.c+21−4
@@ -646,8 +646,8 @@ nf_nat_ipv4_fn(void *priv, struct sk_buff *skb, · 645 unmodified lines
646646 }
647647
648648 static unsigned int
649−nf_nat_ipv4_in(void *priv, struct sk_buff *skb,
650− const struct nf_hook_state *state)
649+nf_nat_ipv4_pre_routing(void *priv, struct sk_buff *skb,
650+ const struct nf_hook_state *state)
651651 {
652652 unsigned int ret;
653653 __be32 daddr = ip_hdr(skb)->daddr;
@@ -659,6 +659,23 @@ nf_nat_ipv4_in(void *priv, struct sk_buff *skb, · 5 unmodified lines
659659 return ret;
660660 }
661661
662+static unsigned int
663+nf_nat_ipv4_local_in(void *priv, struct sk_buff *skb,
664+ const struct nf_hook_state *state)
665+{
666+ __be32 saddr = ip_hdr(skb)->saddr;
667+ struct sock *sk = skb->sk;
668+ unsigned int ret;
669+
670+ ret = nf_nat_ipv4_fn(priv, skb, state);
671+
672+ if (ret == NF_ACCEPT && sk && saddr != ip_hdr(skb)->saddr &&
673+ !inet_sk_transparent(sk))
674+ skb_orphan(skb); /* TCP edemux obtained wrong socket */
675+
676+ return ret;
677+}
678+
662679 static unsigned int
663680 nf_nat_ipv4_out(void *priv, struct sk_buff *skb,
664681 const struct nf_hook_state *state)
@@ -736,7 +753,7 @@ nf_nat_ipv4_local_fn(void *priv, struct sk_buff *skb, · 71 unmodified lines
736753 static const struct nf_hook_ops nf_nat_ipv4_ops[] = {
737754 /* Before packet filtering, change destination */
738755 {
739− .hook = nf_nat_ipv4_in,
756+ .hook = nf_nat_ipv4_pre_routing,
740757 .pf = NFPROTO_IPV4,
741758 .hooknum = NF_INET_PRE_ROUTING,
742759 .priority = NF_IP_PRI_NAT_DST,
@@ -757,7 +774,7 @@ static const struct nf_hook_ops nf_nat_ipv4_ops[] = { · 14 unmodified lines
757774 },
758775 /* After packet filtering, change source */
759776 {
760− .hook = nf_nat_ipv4_fn,
777+ .hook = nf_nat_ipv4_local_in,
761778 .pf = NFPROTO_IPV4,
762779 .hooknum = NF_INET_LOCAL_IN,
763780 .priority = NF_IP_PRI_NAT_SRC,
net/netfilter/nf_tables_api.c+14−5
@@ -916,6 +916,12 @@ static int nf_tables_updtable(struct nft_ctx *ctx) · 915 unmodified lines
916916 if (flags == ctx->table->flags)
917917 return 0;
918918
919+ if ((nft_table_has_owner(ctx->table) &&
920+ !(flags & NFT_TABLE_F_OWNER)) ||
921+ (!nft_table_has_owner(ctx->table) &&
922+ flags & NFT_TABLE_F_OWNER))
923+ return -EOPNOTSUPP;
924+
919925 trans = nft_trans_alloc(ctx, NFT_MSG_NEWTABLE,
920926 sizeof(struct nft_trans_table));
921927 if (trans == NULL)
@@ -9022,8 +9028,12 @@ static void __nft_release_hooks(struct net *net) · 8100 unmodified lines
90229028 {
90239029 struct nft_table *table;
90249030
9025− list_for_each_entry(table, &net->nft.tables, list)
9031+ list_for_each_entry(table, &net->nft.tables, list) {
9032+ if (nft_table_has_owner(table))
9033+ continue;
9034+
90269035 __nft_release_hook(net, table);
9036+ }
90279037 }
90289038
90299039 static void __nft_release_table(struct net *net, struct nft_table *table)
@@ -9073,13 +9083,12 @@ static void __nft_release_table(struct net *net, struct nft_table *table) · 43 unmodified lines
90739083 nf_tables_table_destroy(&ctx);
90749084 }
90759085
9076−static void __nft_release_tables(struct net *net, u32 nlpid)
9086+static void __nft_release_tables(struct net *net)
90779087 {
90789088 struct nft_table *table, *nt;
90799089
90809090 list_for_each_entry_safe(table, nt, &net->nft.tables, list) {
9081− if (nft_table_has_owner(table) &&
9082− nlpid != table->nlpid)
9091+ if (nft_table_has_owner(table))
90839092 continue;
90849093
90859094 __nft_release_table(net, table);
@@ -9145,7 +9154,7 @@ static void __net_exit nf_tables_exit_net(struct net *net) · 59 unmodified lines
91459154 mutex_lock(&net->nft.commit_mutex);
91469155 if (!list_empty(&net->nft.commit_list))
91479156 __nf_tables_abort(net, NFNL_ABORT_NONE);
9148− __nft_release_tables(net, 0);
9157+ __nft_release_tables(net);
91499158 mutex_unlock(&net->nft.commit_mutex);
91509159 WARN_ON_ONCE(!list_empty(&net->nft.tables));
91519160 WARN_ON_ONCE(!list_empty(&net->nft.module_list));
net/netfilter/x_tables.c+4−2
@@ -330,6 +330,7 @@ static int match_revfn(u8 af, const char *name, u8 revision, int *bestp) · 329 unmodified lines
330330 const struct xt_match *m;
331331 int have_rev = 0;
332332
333+ mutex_lock(&xt[af].mutex);
333334 list_for_each_entry(m, &xt[af].match, list) {
334335 if (strcmp(m->name, name) == 0) {
335336 if (m->revision > *bestp)
@@ -338,6 +339,7 @@ static int match_revfn(u8 af, const char *name, u8 revision, int *bestp) · 2 unmodified lines
338339 have_rev = 1;
339340 }
340341 }
342+ mutex_unlock(&xt[af].mutex);
341343
342344 if (af != NFPROTO_UNSPEC && !have_rev)
343345 return match_revfn(NFPROTO_UNSPEC, name, revision, bestp);
@@ -350,6 +352,7 @@ static int target_revfn(u8 af, const char *name, u8 revision, int *bestp) · 6 unmodified lines
350352 const struct xt_target *t;
351353 int have_rev = 0;
352354
355+ mutex_lock(&xt[af].mutex);
353356 list_for_each_entry(t, &xt[af].target, list) {
354357 if (strcmp(t->name, name) == 0) {
355358 if (t->revision > *bestp)
@@ -358,6 +361,7 @@ static int target_revfn(u8 af, const char *name, u8 revision, int *bestp) · 2 unmodified lines
358361 have_rev = 1;
359362 }
360363 }
364+ mutex_unlock(&xt[af].mutex);
361365
362366 if (af != NFPROTO_UNSPEC && !have_rev)
363367 return target_revfn(NFPROTO_UNSPEC, name, revision, bestp);
@@ -371,12 +375,10 @@ int xt_find_revision(u8 af, const char *name, u8 revision, int target, · 7 unmodified lines
371375 {
372376 int have_rev, best = -1;
373377
374− mutex_lock(&xt[af].mutex);
375378 if (target == 1)
376379 have_rev = target_revfn(af, name, revision, &best);
377380 else
378381 have_rev = match_revfn(af, name, revision, &best);
379− mutex_unlock(&xt[af].mutex);
380382
381383 /* Nothing at all? Return 0 to try loading module. */
382384 if (best == -1) {
net/netlabel/netlabel_cipso_v4.c+3−0
@@ -575,6 +575,7 @@ list_start: · 574 unmodified lines
575575
576576 break;
577577 }
578+ cipso_v4_doi_putdef(doi_def);
578579 rcu_read_unlock();
579580
580581 genlmsg_end(ans_skb, data);
@@ -583,12 +584,14 @@ list_start: · 2 unmodified lines
583584 list_retry:
584585 /* XXX - this limit is a guesstimate */
585586 if (nlsze_mult < 4) {
587+ cipso_v4_doi_putdef(doi_def);
586588 rcu_read_unlock();
587589 kfree_skb(ans_skb);
588590 nlsze_mult *= 2;
589591 goto list_start;
590592 }
591593 list_failure_lock:
594+ cipso_v4_doi_putdef(doi_def);
592595 rcu_read_unlock();
593596 list_failure:
594597 kfree_skb(ans_skb);
net/qrtr/qrtr.c+4−2
@@ -439,7 +439,7 @@ int qrtr_endpoint_post(struct qrtr_endpoint *ep, const void *data, size_t len) · 438 unmodified lines
439439 if (len == 0 || len & 3)
440440 return -EINVAL;
441441
442− skb = netdev_alloc_skb(NULL, len);
442+ skb = __netdev_alloc_skb(NULL, len, GFP_ATOMIC | __GFP_NOWARN);
443443 if (!skb)
444444 return -ENOMEM;
445445
@@ -958,8 +958,10 @@ static int qrtr_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) · 512 unmodified lines
958958 plen = (len + 3) & ~3;
959959 skb = sock_alloc_send_skb(sk, plen + QRTR_HDR_MAX_SIZE,
960960 msg->msg_flags & MSG_DONTWAIT, &rc);
961− if (!skb)
961+ if (!skb) {
962+ rc = -ENOMEM;
962963 goto out_node;
964+ }
963965
964966 skb_reserve(skb, QRTR_HDR_MAX_SIZE);
965967
net/sched/sch_api.c+4−4
@@ -2168,7 +2168,7 @@ static int tc_dump_tclass_qdisc(struct Qdisc *q, struct sk_buff *skb, · 2167 unmodified lines
21682168
21692169 static int tc_dump_tclass_root(struct Qdisc *root, struct sk_buff *skb,
21702170 struct tcmsg *tcm, struct netlink_callback *cb,
2171− int *t_p, int s_t)
2171+ int *t_p, int s_t, bool recur)
21722172 {
21732173 struct Qdisc *q;
21742174 int b;
@@ -2179,7 +2179,7 @@ static int tc_dump_tclass_root(struct Qdisc *root, struct sk_buff *skb, · 4 unmodified lines
21792179 if (tc_dump_tclass_qdisc(root, skb, tcm, cb, t_p, s_t) < 0)
21802180 return -1;
21812181
2182− if (!qdisc_dev(root))
2182+ if (!qdisc_dev(root) || !recur)
21832183 return 0;
21842184
21852185 if (tcm->tcm_parent) {
@@ -2214,13 +2214,13 @@ static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb) · 28 unmodified lines
22142214 s_t = cb->args[0];
22152215 t = 0;
22162216
2217− if (tc_dump_tclass_root(dev->qdisc, skb, tcm, cb, &t, s_t) < 0)
2217+ if (tc_dump_tclass_root(dev->qdisc, skb, tcm, cb, &t, s_t, true) < 0)
22182218 goto done;
22192219
22202220 dev_queue = dev_ingress_queue(dev);
22212221 if (dev_queue &&
22222222 tc_dump_tclass_root(dev_queue->qdisc_sleeping, skb, tcm, cb,
2223− &t, s_t) < 0)
2223+ &t, s_t, false) < 0)
22242224 goto done;
22252225
22262226 done:
net/sctp/tsnmap.c+1−1
@@ -75,7 +75,7 @@ int sctp_tsnmap_check(const struct sctp_tsnmap *map, __u32 tsn) · 74 unmodified lines
7575 return 1;
7676
7777 /* Verify that we can hold this TSN and that it will not
78− * overlfow our map
78+ * overflow our map
7979 */
8080 if (!TSN_lt(tsn, map->base_tsn + SCTP_TSN_MAP_SIZE))
8181 return -1;
net/sunrpc/auth_gss/svcauth_gss.c+7−4
@@ -1825,11 +1825,14 @@ static int · 1824 unmodified lines
18251825 svcauth_gss_release(struct svc_rqst *rqstp)
18261826 {
18271827 struct gss_svc_data *gsd = (struct gss_svc_data *)rqstp->rq_auth_data;
1828− struct rpc_gss_wire_cred *gc = &gsd->clcred;
1828+ struct rpc_gss_wire_cred *gc;
18291829 struct xdr_buf *resbuf = &rqstp->rq_res;
18301830 int stat = -EINVAL;
18311831 struct sunrpc_net *sn = net_generic(SVC_NET(rqstp), sunrpc_net_id);
18321832
1833+ if (!gsd)
1834+ goto out;
1835+ gc = &gsd->clcred;
18331836 if (gc->gc_proc != RPC_GSS_PROC_DATA)
18341837 goto out;
18351838 /* Release can be called twice, but we only wrap once. */
@@ -1870,10 +1873,10 @@ out_err: · 34 unmodified lines
18701873 if (rqstp->rq_cred.cr_group_info)
18711874 put_group_info(rqstp->rq_cred.cr_group_info);
18721875 rqstp->rq_cred.cr_group_info = NULL;
1873− if (gsd->rsci)
1876+ if (gsd && gsd->rsci) {
18741877 cache_put(&gsd->rsci->h, sn->rsc_cache);
1875− gsd->rsci = NULL;
1876−
1878+ gsd->rsci = NULL;
1879+ }
18771880 return stat;
18781881 }
18791882
net/sunrpc/sched.c+4−1
@@ -963,8 +963,11 @@ void rpc_execute(struct rpc_task *task) · 962 unmodified lines
963963
964964 rpc_set_active(task);
965965 rpc_make_runnable(rpciod_workqueue, task);
966− if (!is_async)
966+ if (!is_async) {
967+ unsigned int pflags = memalloc_nofs_save();
967968 __rpc_execute(task);
969+ memalloc_nofs_restore(pflags);
970+ }
968971 }
969972
970973 static void rpc_async_schedule(struct work_struct *work)
net/sunrpc/svc.c+4−2
@@ -1413,7 +1413,7 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv) · 1412 unmodified lines
14131413
14141414 sendit:
14151415 if (svc_authorise(rqstp))
1416− goto close;
1416+ goto close_xprt;
14171417 return 1; /* Caller can now send it */
14181418
14191419 release_dropit:
@@ -1425,6 +1425,8 @@ release_dropit: · 5 unmodified lines
14251425 return 0;
14261426
14271427 close:
1428+ svc_authorise(rqstp);
1429+close_xprt:
14281430 if (rqstp->rq_xprt && test_bit(XPT_TEMP, &rqstp->rq_xprt->xpt_flags))
14291431 svc_close_xprt(rqstp->rq_xprt);
14301432 dprintk("svc: svc_process close\n");
@@ -1433,7 +1435,7 @@ release_dropit: · 2 unmodified lines
14331435 err_short_len:
14341436 svc_printk(rqstp, "short len %zd, dropping request\n",
14351437 argv->iov_len);
1436− goto close;
1438+ goto close_xprt;
14371439
14381440 err_bad_rpc:
14391441 serv->sv_stats->rpcbadfmt++;
net/sunrpc/svc_xprt.c+2−2
@@ -1060,7 +1060,7 @@ static int svc_close_list(struct svc_serv *serv, struct list_head *xprt_list, st · 1059 unmodified lines
10601060 struct svc_xprt *xprt;
10611061 int ret = 0;
10621062
1063− spin_lock(&serv->sv_lock);
1063+ spin_lock_bh(&serv->sv_lock);
10641064 list_for_each_entry(xprt, xprt_list, xpt_list) {
10651065 if (xprt->xpt_net != net)
10661066 continue;
@@ -1068,7 +1068,7 @@ static int svc_close_list(struct svc_serv *serv, struct list_head *xprt_list, st · 1 unmodified line
10681068 set_bit(XPT_CLOSE, &xprt->xpt_flags);
10691069 svc_xprt_enqueue(xprt);
10701070 }
1071− spin_unlock(&serv->sv_lock);
1071+ spin_unlock_bh(&serv->sv_lock);
10721072 return ret;
10731073 }
10741074
net/sunrpc/xprtrdma/svc_rdma_backchannel.c+3−3
@@ -252,9 +252,9 @@ xprt_setup_rdma_bc(struct xprt_create *args) · 251 unmodified lines
252252 xprt->timeout = &xprt_rdma_bc_timeout;
253253 xprt_set_bound(xprt);
254254 xprt_set_connected(xprt);
255− xprt->bind_timeout = RPCRDMA_BIND_TO;
256− xprt->reestablish_timeout = RPCRDMA_INIT_REEST_TO;
257− xprt->idle_timeout = RPCRDMA_IDLE_DISC_TO;
255+ xprt->bind_timeout = 0;
256+ xprt->reestablish_timeout = 0;
257+ xprt->idle_timeout = 0;
258258
259259 xprt->prot = XPRT_TRANSPORT_BC_RDMA;
260260 xprt->ops = &xprt_rdma_bc_procs;
net/sunrpc/xprtrdma/svc_rdma_recvfrom.c+39−43
@@ -266,46 +266,33 @@ void svc_rdma_release_rqst(struct svc_rqst *rqstp) · 265 unmodified lines
266266 svc_rdma_recv_ctxt_put(rdma, ctxt);
267267 }
268268
269−static bool svc_rdma_refresh_recvs(struct svcxprt_rdma *rdma,
270− unsigned int wanted, bool temp)
269+static int __svc_rdma_post_recv(struct svcxprt_rdma *rdma,
270+ struct svc_rdma_recv_ctxt *ctxt)
271271 {
272− const struct ib_recv_wr *bad_wr = NULL;
273− struct svc_rdma_recv_ctxt *ctxt;
274− struct ib_recv_wr *recv_chain;
275272 int ret;
276273
277− recv_chain = NULL;
278− while (wanted--) {
279− ctxt = svc_rdma_recv_ctxt_get(rdma);
280− if (!ctxt)
281− break;
282−
283− trace_svcrdma_post_recv(ctxt);
284− ctxt->rc_temp = temp;
285− ctxt->rc_recv_wr.next = recv_chain;
286− recv_chain = &ctxt->rc_recv_wr;
287− rdma->sc_pending_recvs++;
288− }
289− if (!recv_chain)
290− return false;
291−
292− ret = ib_post_recv(rdma->sc_qp, recv_chain, &bad_wr);
274+ trace_svcrdma_post_recv(ctxt);
275+ ret = ib_post_recv(rdma->sc_qp, &ctxt->rc_recv_wr, NULL);
293276 if (ret)
294277 goto err_post;
295− return true;
278+ return 0;
296279
297280 err_post:
298− while (bad_wr) {
299− ctxt = container_of(bad_wr, struct svc_rdma_recv_ctxt,
300− rc_recv_wr);
301− bad_wr = bad_wr->next;
302− svc_rdma_recv_ctxt_put(rdma, ctxt);
303− }
304−
305281 trace_svcrdma_rq_post_err(rdma, ret);
306− /* Since we're destroying the xprt, no need to reset
307− * sc_pending_recvs. */
308− return false;
282+ svc_rdma_recv_ctxt_put(rdma, ctxt);
283+ return ret;
284+}
285+
286+static int svc_rdma_post_recv(struct svcxprt_rdma *rdma)
287+{
288+ struct svc_rdma_recv_ctxt *ctxt;
289+
290+ if (test_bit(XPT_CLOSE, &rdma->sc_xprt.xpt_flags))
291+ return 0;
292+ ctxt = svc_rdma_recv_ctxt_get(rdma);
293+ if (!ctxt)
294+ return -ENOMEM;
295+ return __svc_rdma_post_recv(rdma, ctxt);
309296 }
310297
311298 /**
@@ -316,7 +303,20 @@ err_post: · 4 unmodified lines
316303 */
317304 bool svc_rdma_post_recvs(struct svcxprt_rdma *rdma)
318305 {
319− return svc_rdma_refresh_recvs(rdma, rdma->sc_max_requests, true);
306+ struct svc_rdma_recv_ctxt *ctxt;
307+ unsigned int i;
308+ int ret;
309+
310+ for (i = 0; i < rdma->sc_max_requests; i++) {
311+ ctxt = svc_rdma_recv_ctxt_get(rdma);
312+ if (!ctxt)
313+ return false;
314+ ctxt->rc_temp = true;
315+ ret = __svc_rdma_post_recv(rdma, ctxt);
316+ if (ret)
317+ return false;
318+ }
319+ return true;
320320 }
321321
322322 /**
@@ -324,6 +324,8 @@ bool svc_rdma_post_recvs(struct svcxprt_rdma *rdma) · 1 unmodified line
324324 * @cq: Completion Queue context
325325 * @wc: Work Completion object
326326 *
327+ * NB: The svc_xprt/svcxprt_rdma is pinned whenever it's possible that
328+ * the Receive completion handler could be running.
327329 */
328330 static void svc_rdma_wc_receive(struct ib_cq *cq, struct ib_wc *wc)
329331 {
@@ -331,8 +333,6 @@ static void svc_rdma_wc_receive(struct ib_cq *cq, struct ib_wc *wc) · 1 unmodified line
331333 struct ib_cqe *cqe = wc->wr_cqe;
332334 struct svc_rdma_recv_ctxt *ctxt;
333335
334− rdma->sc_pending_recvs--;
335−
336336 /* WARNING: Only wc->wr_cqe and wc->status are reliable */
337337 ctxt = container_of(cqe, struct svc_rdma_recv_ctxt, rc_cqe);
338338
@@ -340,6 +340,9 @@ static void svc_rdma_wc_receive(struct ib_cq *cq, struct ib_wc *wc) · 1 unmodified line
340340 if (wc->status != IB_WC_SUCCESS)
341341 goto flushed;
342342
343+ if (svc_rdma_post_recv(rdma))
344+ goto post_err;
345+
343346 /* All wc fields are now known to be valid */
344347 ctxt->rc_byte_len = wc->byte_len;
345348
@@ -350,18 +353,11 @@ static void svc_rdma_wc_receive(struct ib_cq *cq, struct ib_wc *wc) · 4 unmodified lines
350353 spin_unlock(&rdma->sc_rq_dto_lock);
351354 if (!test_bit(RDMAXPRT_CONN_PENDING, &rdma->sc_flags))
352355 svc_xprt_enqueue(&rdma->sc_xprt);
353−
354− if (!test_bit(XPT_CLOSE, &rdma->sc_xprt.xpt_flags) &&
355− rdma->sc_pending_recvs < rdma->sc_max_requests)
356− if (!svc_rdma_refresh_recvs(rdma, RPCRDMA_MAX_RECV_BATCH,
357− false))
358− goto post_err;
359−
360356 return;
361357
362358 flushed:
363− svc_rdma_recv_ctxt_put(rdma, ctxt);
364359 post_err:
360+ svc_rdma_recv_ctxt_put(rdma, ctxt);
365361 set_bit(XPT_CLOSE, &rdma->sc_xprt.xpt_flags);
366362 svc_xprt_enqueue(&rdma->sc_xprt);
367363 }
samples/bpf/xdpsock_user.c+2−0
@@ -1699,5 +1699,7 @@ int main(int argc, char **argv) · 1698 unmodified lines
16991699
17001700 xdpsock_cleanup();
17011701
1702+ munmap(bufs, NUM_FRAMES * opt_xsk_frame_size);
1703+
17021704 return 0;
17031705 }
scripts/Makefile.lib+2−2
@@ -327,7 +327,7 @@ $(obj)/%.dtb.S: $(obj)/%.dtb FORCE · 326 unmodified lines
327327
328328 quiet_cmd_dtc = DTC $@
329329 cmd_dtc = $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
330− $(DTC) -O $(patsubst .%,%,$(suffix $@)) -o $@ -b 0 \
330+ $(DTC) -o $@ -b 0 \
331331 $(addprefix -i,$(dir $<) $(DTC_INCLUDE)) $(DTC_FLAGS) \
332332 -d $(depfile).dtc.tmp $(dtc-tmp) ; \
333333 cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile)
@@ -352,7 +352,7 @@ define rule_dtc · 18 unmodified lines
352352 endef
353353
354354 $(obj)/%.dt.yaml: $(src)/%.dts $(DTC) $(DT_TMP_SCHEMA) FORCE
355− $(call if_changed_rule,dtc,yaml)
355+ $(call if_changed_rule,dtc)
356356
357357 dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)
358358
scripts/dummy-tools/gcc+16−2
@@ -57,9 +57,9 @@ if arg_contain --version "$@"; then · 56 unmodified lines
5757 fi
5858
5959 if arg_contain -E "$@"; then
60− # For scripts/gcc-version.sh; This emulates GCC 20.0.0
60+ # For scripts/cc-version.sh; This emulates GCC 20.0.0
6161 if arg_contain - "$@"; then
62− sed 's/^__GNUC__$/20/; s/^__GNUC_MINOR__$/0/; s/^__GNUC_PATCHLEVEL__$/0/'
62+ sed -n '/^GCC/{s/__GNUC__/20/; s/__GNUC_MINOR__/0/; s/__GNUC_PATCHLEVEL__/0/; p;}'
6363 exit 0
6464 else
6565 echo "no input files" >&2
@@ -73,6 +73,15 @@ if arg_contain -S "$@"; then · 7 unmodified lines
7373 echo "%gs"
7474 exit 0
7575 fi
76+
77+ # For arch/powerpc/tools/gcc-check-mprofile-kernel.sh
78+ if arg_contain -m64 "$@" && arg_contain -mlittle-endian "$@" &&
79+ arg_contain -mprofile-kernel "$@"; then
80+ if ! test -t 0 && ! grep -q notrace; then
81+ echo "_mcount"
82+ fi
83+ exit 0
84+ fi
7685 fi
7786
7887 # To set GCC_PLUGINS
@@ -85,3 +94,8 @@ if arg_contain -print-file-name=plugin "$@"; then · 6 unmodified lines
8594 echo $plugin_dir
8695 exit 0
8796 fi
97+
98+# inverted return value
99+if arg_contain -D__SIZEOF_INT128__=0 "$@"; then
100+ exit 1
101+fi
scripts/gcc-plugins/Makefile+1−0
@@ -22,6 +22,7 @@ always-y += $(GCC_PLUGIN) · 21 unmodified lines
2222 GCC_PLUGINS_DIR = $(shell $(CC) -print-file-name=plugin)
2323
2424 plugin_cxxflags = -Wp,-MMD,$(depfile) $(KBUILD_HOSTCXXFLAGS) -fPIC \
25+ -include $(srctree)/include/linux/compiler-version.h \
2526 -I $(GCC_PLUGINS_DIR)/include -I $(obj) -std=gnu++11 \
2627 -fno-rtti -fno-exceptions -fasynchronous-unwind-tables \
2728 -ggdb -Wno-narrowing -Wno-unused-variable \
scripts/ld-version.sh+14−8
@@ -29,7 +29,7 @@ orig_args="$@" · 28 unmodified lines
2929 # Get the first line of the --version output.
3030 IFS='
3131 '
32−set -- $("$@" --version)
32+set -- $(LC_ALL=C "$@" --version)
3333
3434 # Split the line on spaces.
3535 IFS=' '
@@ -44,14 +44,20 @@ if [ "$1" = GNU -a "$2" = ld ]; then · 8 unmodified lines
4444 elif [ "$1" = GNU -a "$2" = gold ]; then
4545 echo "gold linker is not supported as it is not capable of linking the kernel proper." >&2
4646 exit 1
47−elif [ "$1" = LLD ]; then
48− version=$2
49− min_version=$lld_min_version
50− name=LLD
51− disp_name=LLD
5247 else
53− echo "$orig_args: unknown linker" >&2
54− exit 1
48+ while [ $# -gt 1 -a "$1" != "LLD" ]; do
49+ shift
50+ done
51+
52+ if [ "$1" = LLD ]; then
53+ version=$2
54+ min_version=$lld_min_version
55+ name=LLD
56+ disp_name=LLD
57+ else
58+ echo "$orig_args: unknown linker" >&2
59+ exit 1
60+ fi
5561 fi
5662
5763 # Some distributions append a package release number, as in 2.34-4.fc32
security/commoncap.c+1−11
@@ -543,8 +543,7 @@ int cap_convert_nscap(struct user_namespace *mnt_userns, struct dentry *dentry, · 542 unmodified lines
543543 __u32 magic, nsmagic;
544544 struct inode *inode = d_backing_inode(dentry);
545545 struct user_namespace *task_ns = current_user_ns(),
546− *fs_ns = inode->i_sb->s_user_ns,
547− *ancestor;
546+ *fs_ns = inode->i_sb->s_user_ns;
548547 kuid_t rootid;
549548 size_t newsize;
550549
@@ -567,15 +566,6 @@ int cap_convert_nscap(struct user_namespace *mnt_userns, struct dentry *dentry, · 16 unmodified lines
567566 if (nsrootid == -1)
568567 return -EINVAL;
569568
570− /*
571− * Do not allow allow adding a v3 filesystem capability xattr
572− * if the rootid field is ambiguous.
573− */
574− for (ancestor = task_ns->parent; ancestor; ancestor = ancestor->parent) {
575− if (from_kuid(ancestor, rootid) == 0)
576− return -EINVAL;
577− }
578−
579569 newsize = sizeof(struct vfs_ns_cap_data);
580570 nscap = kmalloc(newsize, GFP_ATOMIC);
581571 if (!nscap)
sound/hda/intel-nhlt.c+5−0
@@ -39,6 +39,11 @@ int intel_nhlt_get_dmic_geo(struct device *dev, struct nhlt_acpi_table *nhlt) · 38 unmodified lines
3939 if (!nhlt)
4040 return 0;
4141
42+ if (nhlt->header.length <= sizeof(struct acpi_table_header)) {
43+ dev_warn(dev, "Invalid DMIC description table\n");
44+ return 0;
45+ }
46+
4247 for (j = 0, epnt = nhlt->desc; j < nhlt->endpoint_count; j++,
4348 epnt = (struct nhlt_endpoint *)((u8 *)epnt + epnt->length)) {
4449
sound/pci/hda/hda_bind.c+4−0
@@ -47,6 +47,10 @@ static void hda_codec_unsol_event(struct hdac_device *dev, unsigned int ev) · 46 unmodified lines
4747 if (codec->bus->shutdown)
4848 return;
4949
50+ /* ignore unsol events during system suspend/resume */
51+ if (codec->core.dev.power.power_state.event != PM_EVENT_ON)
52+ return;
53+
5054 if (codec->patch_ops.unsol_event)
5155 codec->patch_ops.unsol_event(codec, ev);
5256 }
sound/pci/hda/hda_controller.c+0−7
@@ -609,13 +609,6 @@ static int azx_pcm_open(struct snd_pcm_substream *substream) · 608 unmodified lines
609609 20,
610610 178000000);
611611
612− /* by some reason, the playback stream stalls on PulseAudio with
613− * tsched=1 when a capture stream triggers. Until we figure out the
614− * real cause, disable tsched mode by telling the PCM info flag.
615− */
616− if (chip->driver_caps & AZX_DCAPS_AMD_WORKAROUND)
617− runtime->hw.info |= SNDRV_PCM_INFO_BATCH;
618−
619612 if (chip->align_buffer_size)
620613 /* constrain buffer sizes to be multiple of 128
621614 bytes. This is more efficient in terms of memory
sound/pci/hda/hda_intel.c+2−0
@@ -1026,6 +1026,8 @@ static int azx_prepare(struct device *dev) · 1025 unmodified lines
10261026 chip = card->private_data;
10271027 chip->pm_prepared = 1;
10281028
1029+ flush_work(&azx_bus(chip)->unsol_work);
1030+
10291031 /* HDA controller always requires different WAKEEN for runtime suspend
10301032 * and system suspend, so don't use direct-complete here.
10311033 */
sound/pci/hda/patch_ca0132.c+1−0
@@ -1309,6 +1309,7 @@ static const struct snd_pci_quirk ca0132_quirks[] = { · 1308 unmodified lines
13091309 SND_PCI_QUIRK(0x1102, 0x0013, "Recon3D", QUIRK_R3D),
13101310 SND_PCI_QUIRK(0x1102, 0x0018, "Recon3D", QUIRK_R3D),
13111311 SND_PCI_QUIRK(0x1102, 0x0051, "Sound Blaster AE-5", QUIRK_AE5),
1312+ SND_PCI_QUIRK(0x1102, 0x0191, "Sound Blaster AE-5 Plus", QUIRK_AE5),
13121313 SND_PCI_QUIRK(0x1102, 0x0081, "Sound Blaster AE-7", QUIRK_AE7),
13131314 {}
13141315 };
sound/pci/hda/patch_conexant.c+45−17
@@ -149,6 +149,21 @@ static int cx_auto_vmaster_mute_led(struct led_classdev *led_cdev, · 148 unmodified lines
149149 return 0;
150150 }
151151
152+static void cxt_init_gpio_led(struct hda_codec *codec)
153+{
154+ struct conexant_spec *spec = codec->spec;
155+ unsigned int mask = spec->gpio_mute_led_mask | spec->gpio_mic_led_mask;
156+
157+ if (mask) {
158+ snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_MASK,
159+ mask);
160+ snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DIRECTION,
161+ mask);
162+ snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
163+ spec->gpio_led);
164+ }
165+}
166+
152167 static int cx_auto_init(struct hda_codec *codec)
153168 {
154169 struct conexant_spec *spec = codec->spec;
@@ -156,6 +171,7 @@ static int cx_auto_init(struct hda_codec *codec) · 1 unmodified line
156171 if (!spec->dynamic_eapd)
157172 cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, true);
158173
174+ cxt_init_gpio_led(codec);
159175 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
160176
161177 return 0;
@@ -215,6 +231,7 @@ enum { · 53 unmodified lines
215231 CXT_FIXUP_HP_SPECTRE,
216232 CXT_FIXUP_HP_GATE_MIC,
217233 CXT_FIXUP_MUTE_LED_GPIO,
234+ CXT_FIXUP_HP_ZBOOK_MUTE_LED,
218235 CXT_FIXUP_HEADSET_MIC,
219236 CXT_FIXUP_HP_MIC_NO_PRESENCE,
220237 };
@@ -654,31 +671,36 @@ static int cxt_gpio_micmute_update(struct led_classdev *led_cdev, · 433 unmodified lines
654671 return 0;
655672 }

78 more lines aren’t shown here.

sound/pci/hda/patch_hdmi.c+13−0

This diff is large: its 27 lines aren’t shown here.

sound/usb/card.c+6−0

This diff is large: its 20 lines aren’t shown here.

sound/usb/quirks.c+10−1

This diff is large: its 32 lines aren’t shown here.

sound/usb/usbaudio.h+1−0

This diff is large: its 8 lines aren’t shown here.

tools/arch/s390/include/uapi/asm/ptrace.h+3−2

This diff is large: its 12 lines aren’t shown here.

tools/arch/x86/include/asm/cpufeatures.h+13−6

This diff is large: its 75 lines aren’t shown here.

tools/arch/x86/include/uapi/asm/kvm.h+1−0

This diff is large: its 8 lines aren’t shown here.

tools/arch/x86/include/uapi/asm/vmx.h+3−1

This diff is large: its 18 lines aren’t shown here.

tools/bpf/resolve_btfids/main.c+5−0

This diff is large: its 12 lines aren’t shown here.

tools/build/Makefile+7−1

This diff is large: its 20 lines aren’t shown here.

tools/include/linux/coresight-pmu.h+15−5

This diff is large: its 33 lines aren’t shown here.

tools/include/uapi/drm/drm.h+49−48

This diff is large: its 402 lines aren’t shown here.

tools/include/uapi/drm/i915_drm.h+2−1

This diff is large: its 11 lines aren’t shown here.

tools/include/uapi/linux/bpf.h+0−1

This diff is large: its 8 lines aren’t shown here.

tools/include/uapi/linux/kvm.h+73−0

This diff is large: its 134 lines aren’t shown here.

tools/include/uapi/linux/mount.h+16−0

This diff is large: its 29 lines aren’t shown here.

tools/include/uapi/linux/openat2.h+4−0

This diff is large: its 10 lines aren’t shown here.

tools/lib/bpf/xsk.c+3−2

This diff is large: its 19 lines aren’t shown here.

tools/lib/perf/evlist.c+9−4

This diff is large: its 30 lines aren’t shown here.

tools/lib/perf/include/internal/evlist.h+2−0

This diff is large: its 7 lines aren’t shown here.

tools/objtool/check.c+3−0

This diff is large: its 10 lines aren’t shown here.

tools/perf/Documentation/perf-evlist.txt+1−1

This diff is large: its 9 lines aren’t shown here.

tools/perf/Documentation/perf-ftrace.txt+2−2

This diff is large: its 11 lines aren’t shown here.

tools/perf/Documentation/perf-kallsyms.txt+1−1

This diff is large: its 7 lines aren’t shown here.

tools/perf/Documentation/perf-trace.txt+2−2

This diff is large: its 11 lines aren’t shown here.

tools/perf/Makefile.perf+2−10

This diff is large: its 33 lines aren’t shown here.

tools/perf/arch/arm/util/cs-etm.c+8−4

This diff is large: its 41 lines aren’t shown here.

tools/perf/arch/powerpc/entry/syscalls/syscall.tbl+6−15

This diff is large: its 59 lines aren’t shown here.

tools/perf/arch/s390/entry/syscalls/syscall.tbl+1−0

This diff is large: its 5 lines aren’t shown here.

tools/perf/arch/x86/Makefile+6−5

This diff is large: its 24 lines aren’t shown here.

tools/perf/arch/x86/entry/syscalls/syscall_64.tbl+1−0

This diff is large: its 8 lines aren’t shown here.

tools/perf/arch/x86/include/arch-tests.h+1−0

This diff is large: its 8 lines aren’t shown here.

tools/perf/arch/x86/tests/Build+1−0

This diff is large: its 7 lines aren’t shown here.

tools/perf/arch/x86/tests/arch-tests.c+4−0

This diff is large: its 11 lines aren’t shown here.

tools/perf/arch/x86/tests/insn-x86.c+1−1

This diff is large: its 13 lines aren’t shown here.

tools/perf/arch/x86/tests/sample-parsing.c+121−0

This diff is large: its 122 lines aren’t shown here.

tools/perf/arch/x86/util/archinsn.c+1−1

This diff is large: its 12 lines aren’t shown here.

tools/perf/bench/numa.c+29−13

This diff is large: its 125 lines aren’t shown here.

tools/perf/bench/sched-messaging.c+2−2

This diff is large: its 14 lines aren’t shown here.

tools/perf/bench/sched-pipe.c+2−2

This diff is large: its 18 lines aren’t shown here.

tools/perf/bench/syscall.c+2−2

This diff is large: its 18 lines aren’t shown here.

tools/perf/builtin-daemon.c+3−3

This diff is large: its 24 lines aren’t shown here.

tools/perf/builtin-diff.c+2−1

This diff is large: its 10 lines aren’t shown here.

tools/perf/builtin-trace.c+2−3

This diff is large: its 19 lines aren’t shown here.

tools/perf/perf-archive.sh+1−2

This diff is large: its 11 lines aren’t shown here.

tools/perf/tests/attr.c+7−1

This diff is large: its 22 lines aren’t shown here.

tools/perf/tests/code-reading.c+3−7

This diff is large: its 17 lines aren’t shown here.

tools/perf/tests/cpumap.c+2−0

This diff is large: its 9 lines aren’t shown here.

tools/perf/tests/keep-tracking.c+2−3

This diff is large: its 13 lines aren’t shown here.

tools/perf/tests/mmap-basic.c+0−2

This diff is large: its 9 lines aren’t shown here.

tools/perf/tests/perf-time-to-tsc.c+2−0

This diff is large: its 9 lines aren’t shown here.

tools/perf/tests/sample-parsing.c+0−4

This diff is large: its 18 lines aren’t shown here.

tools/perf/tests/shell/daemon.sh+16−16

This diff is large: its 118 lines aren’t shown here.

tools/perf/tests/sw-clock.c+4−8

This diff is large: its 39 lines aren’t shown here.

tools/perf/tests/switch-tracking.c+2−3

This diff is large: its 13 lines aren’t shown here.

tools/perf/tests/task-exit.c+3−7

This diff is large: its 37 lines aren’t shown here.

tools/perf/tests/thread-map.c+3−5

This diff is large: its 33 lines aren’t shown here.

tools/perf/util/evlist.c+1−0

This diff is large: its 8 lines aren’t shown here.

tools/perf/util/evsel.c+17−1

This diff is large: its 36 lines aren’t shown here.

tools/perf/util/evsel.h+3−1

This diff is large: its 23 lines aren’t shown here.

tools/perf/util/header.c+2−2

This diff is large: its 11 lines aren’t shown here.

tools/perf/util/map.c+3−4

This diff is large: its 21 lines aren’t shown here.

tools/perf/util/parse-events.y+5−1

This diff is large: its 21 lines aren’t shown here.

tools/perf/util/python-ext-sources+1−0

This diff is large: its 5 lines aren’t shown here.

tools/perf/util/sort.c+2−2

This diff is large: its 18 lines aren’t shown here.

tools/perf/util/stat-display.c+1−1

This diff is large: its 9 lines aren’t shown here.

tools/perf/util/stat.c+38−9

This diff is large: its 89 lines aren’t shown here.

tools/perf/util/trace-event-read.c+1−0

This diff is large: its 8 lines aren’t shown here.

tools/testing/selftests/arm64/fp/sve-ptrace.c+1−1

This diff is large: its 7 lines aren’t shown here.

tools/testing/selftests/bpf/progs/netif_receive_skb.c+10−3

This diff is large: its 29 lines aren’t shown here.

tools/testing/selftests/bpf/progs/test_global_func11.c+1−1

This diff is large: its 7 lines aren’t shown here.

tools/testing/selftests/bpf/progs/test_tunnel_kern.c+2−4

This diff is large: its 13 lines aren’t shown here.

tools/testing/selftests/bpf/verifier/array_access.c+2−1

This diff is large: its 15 lines aren’t shown here.

tools/testing/selftests/bpf/verifier/atomic_and.c+23−0

This diff is large: its 27 lines aren’t shown here.

tools/testing/selftests/bpf/verifier/atomic_cmpxchg.c+25−0

This diff is large: its 29 lines aren’t shown here.

tools/testing/selftests/bpf/verifier/atomic_or.c+25−0

This diff is large: its 29 lines aren’t shown here.

tools/testing/selftests/gpio/.gitignore+1−1

This diff is large: its 4 lines aren’t shown here.

tools/testing/selftests/net/fib_nexthops.sh+8−0

This diff is large: its 15 lines aren’t shown here.

tools/testing/selftests/net/forwarding/mirror_gre_bridge_1d_vlan.sh+9−0

This diff is large: its 21 lines aren’t shown here.

tools/testing/selftests/net/ipsec.c+1−1

This diff is large: its 9 lines aren’t shown here.

tools/testing/selftests/netfilter/Makefile+1−1

This diff is large: its 9 lines aren’t shown here.

tools/testing/selftests/netfilter/nf_nat_edemux.sh+99−0

This diff is large: its 100 lines aren’t shown here.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

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

Repository code

Go to file
t