History

Merge remote-tracking branch 'torvalds/master' into perf/urgent

To check if more kernel API sync is needed and also to see if the perf build tests continue to pass.

Arnaldo Carvalho de Melo committed 4 years ago

Commit 93340302 parents fc45e65 90c9e95335 files · +4741 −2199Browse files

Unified · Split

335 files
  1. .mailmap +3 −0
  2. Documentation/arm64/silicon-errata.rst +2 −0
  3. Documentation/dev-tools/kselftest.rst +8 −0
  4. Documentation/devicetree/bindings/net/qcom,ipa.yaml +6 −0
  5. Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml +3 −2
  6. Documentation/filesystems/netfs_library.rst +16 −0
  7. Documentation/gpu/todo.rst +0 −24
  8. Documentation/userspace-api/ioctl/ioctl-number.rst +3 −0
  9. MAINTAINERS +16 −3
  10. arch/arm/crypto/blake2s-shash.c +2 −2
  11. arch/arm64/Kconfig +16 −0
  12. arch/arm64/kernel/cpu_errata.c +8 −0
  13. arch/arm64/kvm/arm.c +33 −18
  14. arch/arm64/kvm/handle_exit.c +8 −0
  15. arch/arm64/kvm/hyp/include/hyp/switch.h +21 −2
  16. arch/arm64/tools/cpucaps +3 −2
  17. arch/mips/cavium-octeon/octeon-memcpy.S +1 −1
  18. arch/mips/kvm/mips.c +46 −4
  19. arch/mips/kvm/vz.c +9 −3
  20. arch/riscv/kvm/vcpu.c +31 −17
  21. arch/riscv/kvm/vcpu_sbi_base.c +2 −1
  22. arch/x86/crypto/blake2s-shash.c +2 −2
  23. arch/x86/include/asm/kvm-x86-ops.h +1 −1
  24. arch/x86/include/asm/kvm_host.h +2 −1
  25. arch/x86/include/asm/xen/hypervisor.h +0 −14
  26. arch/x86/kvm/cpuid.c +7 −6
  27. arch/x86/kvm/lapic.c +2 −8
  28. arch/x86/kvm/svm/svm.c +18 −3
  29. arch/x86/kvm/vmx/vmx.c +18 −3
  30. arch/x86/kvm/x86.c +6 −4
  31. arch/x86/kvm/x86.h +0 −45
  32. arch/x86/xen/enlighten_hvm.c +4 −9
  33. arch/x86/xen/enlighten_pv.c +0 −4
  34. arch/x86/xen/smp_pv.c +6 −20
  35. block/bio-integrity.c +1 −1
  36. block/fops.c +19 −14
  37. crypto/blake2s_generic.c +2 −2
  38. drivers/acpi/Kconfig +1 −0
  39. drivers/ata/libata-core.c +10 −0
  40. drivers/char/random.c +22 −17
  41. drivers/dma-buf/dma-heap.c +2 −0
  42. drivers/gpu/drm/amd/amdgpu/amdgpu.h +8 −2
  43. drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +32 −5
  44. drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +9 −2
  45. drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 −1
  46. drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +3 −0
  47. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn301/vg_clk_mgr.c +8 −8
  48. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_clk_mgr.c +10 −10
  49. drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +20 −0
  50. drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +0 −5
  51. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.c +0 −15
  52. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.h +0 −3
  53. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_stream_encoder.c +0 −2
  54. drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dio_stream_encoder.c +0 −2
  55. drivers/gpu/drm/amd/display/dc/inc/hw/stream_encoder.h +0 −4
  56. drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +3 −3
  57. drivers/gpu/drm/i915/display/intel_overlay.c +3 −0
  58. drivers/gpu/drm/i915/display/intel_tc.c +2 −1
  59. drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +7 −2
  60. drivers/gpu/drm/i915/gt/uc/intel_guc.h +5 −0
  61. drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +97 −17
  62. drivers/gpu/drm/i915/i915_gpu_error.c +1 −1
  63. drivers/gpu/drm/i915/i915_reg.h +2 −1
  64. drivers/gpu/drm/kmb/kmb_plane.c +0 −6
  65. drivers/gpu/drm/mxsfb/mxsfb_kms.c +5 −1
  66. drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c +1 −1
  67. drivers/infiniband/core/cm.c +1 −1
  68. drivers/infiniband/core/cma.c +12 −10
  69. drivers/infiniband/core/ucma.c +23 −11
  70. drivers/infiniband/hw/hfi1/ipoib.h +1 −1
  71. drivers/infiniband/hw/hfi1/ipoib_main.c +15 −12
  72. drivers/infiniband/hw/hfi1/ipoib_tx.c +26 −12
  73. drivers/infiniband/hw/mlx4/main.c +1 −1
  74. drivers/infiniband/sw/rdmavt/qp.c +2 −0
  75. drivers/infiniband/sw/siw/siw.h +1 −6
  76. drivers/infiniband/sw/siw/siw_qp_rx.c +11 −9
  77. drivers/infiniband/sw/siw/siw_verbs.c +2 −1
  78. drivers/input/touchscreen/wm97xx-core.c +3 −9
  79. drivers/iommu/amd/init.c +2 −0
  80. drivers/iommu/intel/irq_remapping.c +10 −3
  81. drivers/iommu/ioasid.c +1 −0
  82. drivers/iommu/iommu.c +19 −14
  83. drivers/iommu/omap-iommu.c +1 −1
  84. drivers/md/md.c +4 −4
  85. drivers/net/dsa/Kconfig +1 −0
  86. drivers/net/ethernet/amd/xgbe/xgbe-drv.c +13 −1
  87. drivers/net/ethernet/google/gve/gve_adminq.c +1 −1
  88. drivers/net/ethernet/intel/e1000e/e1000.h +3 −1
  89. drivers/net/ethernet/intel/e1000e/ich8lan.c +20 −0
  90. drivers/net/ethernet/intel/e1000e/netdev.c +21 −18
  91. drivers/net/ethernet/intel/i40e/i40e.h +1 −0
  92. drivers/net/ethernet/intel/i40e/i40e_main.c +29 −2
  93. drivers/net/ethernet/mellanox/mlx5/core/en.h +3 −3
  94. drivers/net/ethernet/mellanox/mlx5/core/en/qos.c +2 −1
  95. drivers/net/ethernet/mellanox/mlx5/core/en/rep/bond.c +14 −18
  96. drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c +4 −2
  97. drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h +5 −0
  98. drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c +3 −1
  99. drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c +11 −2
  100. drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h +6 −3
  101. drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +19 −11
  102. drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +14 −1
  103. drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +1 −1
  104. drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c +4 −0
  105. drivers/net/ethernet/mellanox/mlx5/core/esw/diag/bridge_tracepoint.h +1 −1
  106. drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c +1 −1
  107. drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c +5 −4
  108. drivers/net/ethernet/mellanox/mlx5/core/port.c +5 −4
  109. drivers/net/ethernet/microchip/sparx5/sparx5_packet.c +1 −1
  110. drivers/net/ethernet/smsc/smc911x.c +4 −4
  111. drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c +7 −2
  112. drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h +1 −0
  113. drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +17 −2
  114. drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c +12 −7
  115. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +4 −2
  116. drivers/net/ieee802154/at86rf230.c +11 −2
  117. drivers/net/ieee802154/ca8210.c +1 −0
  118. drivers/net/ieee802154/mac802154_hwsim.c +1 −0
  119. drivers/net/ieee802154/mcr20a.c +2 −2
  120. drivers/net/ipa/ipa_power.c +52 −0
  121. drivers/net/ipa/ipa_power.h +7 −0
  122. drivers/net/ipa/ipa_uc.c +5 −0
  123. drivers/net/macsec.c +21 −12
  124. drivers/net/phy/at803x.c +13 −13
  125. drivers/net/usb/ipheth.c +3 −3
  126. drivers/nvme/host/core.c +8 −1
  127. drivers/nvme/host/fabrics.h +1 −0
  128. drivers/nvme/host/rdma.c +1 −0
  129. drivers/nvme/host/tcp.c +1 −0
  130. drivers/pci/controller/cadence/pci-j721e.c +42 −43
  131. drivers/pci/controller/dwc/pcie-kirin.c +18 −13
  132. drivers/pinctrl/Makefile +1 −1
  133. drivers/pinctrl/bcm/Kconfig +1 −0
  134. drivers/pinctrl/bcm/pinctrl-bcm2835.c +15 −8
  135. drivers/pinctrl/intel/pinctrl-cherryview.c +3 −2
  136. drivers/pinctrl/intel/pinctrl-intel.c +36 −28
  137. drivers/pinctrl/pinctrl-microchip-sgpio.c +2 −1
  138. drivers/pinctrl/pinctrl-thunderbay.c +35 −55
  139. drivers/pinctrl/pinctrl-zynqmp.c +4 −6
  140. drivers/pinctrl/sunxi/pinctrl-sun50i-h616.c +4 −4
  141. drivers/platform/surface/Kconfig +1 −0
  142. drivers/platform/x86/amd-pmc.c +9 −6
  143. drivers/platform/x86/asus-tf103c-dock.c +2 −2
  144. drivers/platform/x86/intel/crystal_cove_charger.c +13 −13
  145. drivers/platform/x86/intel/speed_select_if/isst_if_common.c +63 −34
  146. drivers/platform/x86/thinkpad_acpi.c +22 −3
  147. drivers/platform/x86/touchscreen_dmi.c +24 −0
  148. drivers/platform/x86/x86-android-tablets.c +95 −10
  149. drivers/regulator/max20086-regulator.c +2 −1
  150. drivers/scsi/bnx2fc/bnx2fc_fcoe.c +13 −8
  151. drivers/scsi/hisi_sas/hisi_sas_main.c +6 −8
  152. drivers/scsi/pm8001/pm8001_hwi.c +0 −18
  153. drivers/scsi/pm8001/pm8001_sas.c +5 −0
  154. drivers/scsi/pm8001/pm80xx_hwi.c +3 −28
  155. drivers/scsi/scsi_scan.c +50 −5
  156. drivers/spi/spi-bcm-qspi.c +1 −1
  157. drivers/spi/spi-meson-spicc.c +5 −0
  158. drivers/spi/spi-mt65xx.c +1 −1
  159. drivers/spi/spi-stm32-qspi.c +17 −30
  160. drivers/spi/spi-stm32.c +4 −3
  161. drivers/spi/spi-uniphier.c +14 −4
  162. drivers/video/console/Kconfig +20 −0
  163. drivers/video/fbdev/core/bitblit.c +16 −0
  164. drivers/video/fbdev/core/fbcon.c +536 −21
  165. drivers/video/fbdev/core/fbcon.h +72 −0
  166. drivers/video/fbdev/core/fbcon_ccw.c +24 −4
  167. drivers/video/fbdev/core/fbcon_cw.c +24 −4
  168. drivers/video/fbdev/core/fbcon_rotate.h +9 −0
  169. drivers/video/fbdev/core/fbcon_ud.c +29 −8
  170. drivers/video/fbdev/core/tileblit.c +16 −0
  171. drivers/video/fbdev/skeletonfb.c +6 −6
  172. fs/9p/fid.c +4 −5
  173. fs/Makefile +1 −1
  174. fs/btrfs/block-group.c +37 −2
  175. fs/btrfs/ctree.h +6 −0
  176. fs/btrfs/ioctl.c +2 −5
  177. fs/btrfs/qgroup.c +19 −2
  178. fs/btrfs/transaction.c +24 −0
  179. fs/btrfs/transaction.h +2 −0
  180. fs/btrfs/tree-checker.c +15 −0
  181. fs/btrfs/tree-log.c +23 −0
  182. fs/cachefiles/io.c +59 −0
  183. fs/cifs/connect.c +16 −7
  184. fs/cifs/file.c +82 −139
  185. fs/cifs/fscache.c +108 −18
  186. fs/cifs/fscache.h +49 −30
  187. fs/cifs/inode.c +4 −4
  188. fs/cifs/sess.c +5 −1
  189. fs/erofs/data.c +4 −4
  190. fs/erofs/zdata.c +56 −57
  191. fs/erofs/zmap.c +7 −0
  192. fs/ext4/ext4.h +7 −7
  193. fs/ext4/hash.c +1 −1
  194. fs/ext4/namei.c +6 −6
  195. fs/ext4/super.c +5 −5
  196. fs/ext4/sysfs.c +4 −4
  197. fs/f2fs/dir.c +5 −5
  198. fs/f2fs/f2fs.h +1 −1
  199. fs/f2fs/hash.c +1 −1
  200. fs/f2fs/namei.c +2 −2
  201. fs/f2fs/recovery.c +2 −2
  202. fs/f2fs/super.c +5 −5
  203. fs/f2fs/sysfs.c +5 −5
  204. fs/iomap/buffered-io.c +48 −4
  205. fs/libfs.c +5 −5
  206. fs/lockd/svcsubs.c +10 −8
  207. fs/nfsd/nfs4state.c +3 −1
  208. fs/notify/fanotify/fanotify_user.c +3 −3
  209. fs/overlayfs/copy_up.c +13 −3
  210. fs/quota/dquot.c +8 −3
  211. fs/super.c +12 −7
  212. fs/sync.c +12 −6
  213. fs/unicode/Kconfig +5 −13
  214. fs/unicode/Makefile +4 −2
  215. fs/xfs/xfs_aops.c +15 −1
  216. fs/xfs/xfs_bmap_util.c +3 −6
  217. fs/xfs/xfs_file.c +26 −60
  218. fs/xfs/xfs_inode.h +0 −9
  219. fs/xfs/xfs_ioctl.c +1 −1
  220. fs/xfs/xfs_pnfs.c +39 −3
  221. fs/xfs/xfs_super.c +5 −1
  222. include/crypto/internal/blake2s.h +25 −15
  223. include/linux/ceph/libceph.h +1 −0
  224. include/linux/ceph/messenger.h +5 −0
  225. include/linux/fb.h +1 −1
  226. include/linux/fs.h +1 −1
  227. include/linux/if_vlan.h +4 −2
  228. include/linux/iomap.h +2 −0
  229. include/linux/kvm_host.h +109 −3
  230. include/linux/libata.h +1 −0
  231. include/linux/netfs.h +7 −0
  232. include/linux/page_table_check.h +19 −0
  233. include/linux/pgtable.h +1 −0
  234. include/linux/sched.h +0 −1
  235. include/net/ax25.h +12 −0
  236. include/net/neighbour.h +13 −5
  237. include/sound/pcm.h +15 −0
  238. include/uapi/linux/kvm.h +3 −3
  239. include/uapi/linux/smc_diag.h +5 −6
  240. include/uapi/sound/asound.h +3 −1
  241. include/uapi/xen/gntdev.h +7 −1
  242. include/xen/xenbus_dev.h +0 −2
  243. ipc/sem.c +2 −2
  244. kernel/async.c +0 −3
  245. kernel/audit.c +43 −19
  246. kernel/bpf/bpf_lsm.c +1 −1
  247. kernel/bpf/ringbuf.c +1 −1
  248. kernel/bpf/trampoline.c +3 −2
  249. kernel/cgroup/cgroup-v1.c +14 −0
  250. kernel/cgroup/cpuset.c +51 −14
  251. kernel/module.c +5 −20
  252. kernel/printk/sysctl.c +1 −1
  253. kernel/stackleak.c +2 −3
  254. lib/crypto/blake2s.c +2 −2
  255. mm/debug_vm_pgtable.c +2 −0
  256. mm/gup.c +30 −5
  257. mm/khugepaged.c +21 −16
  258. mm/kmemleak.c +7 −6
  259. mm/page_isolation.c +1 −1
  260. mm/page_table_check.c +27 −28
  261. net/ax25/af_ax25.c +16 −7
  262. net/ax25/ax25_dev.c +23 −5
  263. net/ax25/ax25_route.c +11 −2
  264. net/bridge/netfilter/nft_reject_bridge.c +4 −4
  265. net/ceph/ceph_common.c +7 −0
  266. net/ceph/messenger.c +4 −0
  267. net/ceph/messenger_v1.c +48 −6
  268. net/ceph/messenger_v2.c +186 −64
  269. net/core/neighbour.c +12 −6
  270. net/core/rtnetlink.c +4 −2
  271. net/ieee802154/nl802154.c +4 −4
  272. net/ipv4/netfilter/Kconfig +0 −4
  273. net/ipv4/tcp.c +5 −2
  274. net/ipv4/tcp_input.c +2 −0
  275. net/ipv6/netfilter/Kconfig +0 −4
  276. net/ipv6/netfilter/Makefile +0 −3
  277. net/ipv6/netfilter/nf_flow_table_ipv6.c +0 −0
  278. net/netfilter/nf_tables_api.c +0 −1
  279. net/netfilter/nft_byteorder.c +12 −0
  280. net/netfilter/nft_ct.c +4 −1
  281. net/packet/af_packet.c +6 −2
  282. net/sched/cls_api.c +7 −4
  283. net/smc/af_smc.c +118 −15
  284. net/smc/smc.h +19 −1
  285. net/smc/smc_diag.c +0 −2
  286. security/selinux/ss/conditional.c +2 −1
  287. sound/core/pcm_native.c +13 −0
  288. sound/hda/intel-sdw-acpi.c +3 −4
  289. sound/pci/hda/hda_auto_parser.c +1 −1
  290. sound/pci/hda/hda_codec.c +4 −0
  291. sound/pci/hda/hda_generic.c +15 −2
  292. sound/pci/hda/hda_generic.h +3 −0
  293. sound/pci/hda/patch_realtek.c +55 −12
  294. sound/soc/amd/acp/acp-mach-common.c +2 −2
  295. sound/soc/codecs/cpcap.c +2 −0
  296. sound/soc/codecs/hdmi-codec.c +1 −1
  297. sound/soc/codecs/lpass-rx-macro.c +4 −4
  298. sound/soc/codecs/max9759.c +2 −1
  299. sound/soc/codecs/rt5682-i2c.c +4 −11
  300. sound/soc/codecs/rt5682.c +8 −16
  301. sound/soc/codecs/rt5682.h +0 −2
  302. sound/soc/codecs/wcd938x.c +17 −14
  303. sound/soc/fsl/pcm030-audio-fabric.c +8 −3
  304. sound/soc/generic/simple-card.c +25 −1
  305. sound/soc/mediatek/Kconfig +1 −1
  306. sound/soc/qcom/qdsp6/q6apm-dai.c +5 −2
  307. sound/soc/soc-acpi.c +2 −5
  308. sound/soc/soc-ops.c +26 −3
  309. sound/soc/soc-pcm.c +12 −6
  310. sound/soc/xilinx/xlnx_formatter_pcm.c +24 −3
  311. sound/usb/mixer.c +4 −0
  312. sound/usb/quirks-table.h +1 −1
  313. tools/bpf/resolve_btfids/Makefile +5 −1
  314. tools/include/uapi/linux/lirc.h +0 −229
  315. tools/scripts/Makefile.include +1 −1
  316. tools/testing/kunit/kunit_kernel.py +1 −0
  317. tools/testing/selftests/bpf/test_lirc_mode2_user.c +0 −1
  318. tools/testing/selftests/cpufreq/main.sh +1 −1
  319. tools/testing/selftests/exec/Makefile +1 −1
  320. tools/testing/selftests/futex/Makefile +2 −2
  321. tools/testing/selftests/kselftest_harness.h +3 −1
  322. tools/testing/selftests/mincore/mincore_selftest.c +14 −6
  323. tools/testing/selftests/netfilter/nft_concat_range.sh +71 −1
  324. tools/testing/selftests/netfilter/nft_nat.sh +152 −0
  325. tools/testing/selftests/netfilter/nft_zones_many.sh +6 −6
  326. tools/testing/selftests/openat2/Makefile +1 −1
  327. tools/testing/selftests/openat2/helpers.h +7 −5
  328. tools/testing/selftests/openat2/openat2_test.c +11 −1
  329. tools/testing/selftests/rtc/settings +1 −1
  330. tools/testing/selftests/vDSO/vdso_test_abi.c +62 −73
  331. tools/testing/selftests/vm/userfaultfd.c +7 −2
  332. tools/testing/selftests/zram/zram.sh +1 −14
  333. tools/testing/selftests/zram/zram01.sh +9 −24
  334. tools/testing/selftests/zram/zram02.sh +0 −1
  335. tools/testing/selftests/zram/zram_lib.sh +88 −46
.mailmap+3−0
@@ -80,6 +80,9 @@ Chris Chiu <chris.chiu@canonical.com> <chiu@endlessos.org> · 79 unmodified lines
80Christian Borntraeger <borntraeger@linux.ibm.com> <borntraeger@de.ibm.com>80Christian Borntraeger <borntraeger@linux.ibm.com> <borntraeger@de.ibm.com>
81Christian Borntraeger <borntraeger@linux.ibm.com> <cborntra@de.ibm.com>81Christian Borntraeger <borntraeger@linux.ibm.com> <cborntra@de.ibm.com>
82Christian Borntraeger <borntraeger@linux.ibm.com> <borntrae@de.ibm.com>82Christian Borntraeger <borntraeger@linux.ibm.com> <borntrae@de.ibm.com>
83Christian Brauner <brauner@kernel.org> <christian@brauner.io>
84Christian Brauner <brauner@kernel.org> <christian.brauner@canonical.com>
85Christian Brauner <brauner@kernel.org> <christian.brauner@ubuntu.com>
83Christophe Ricard <christophe.ricard@gmail.com>86Christophe Ricard <christophe.ricard@gmail.com>
84Christoph Hellwig <hch@lst.de>87Christoph Hellwig <hch@lst.de>
85Colin Ian King <colin.king@intel.com> <colin.king@canonical.com>88Colin Ian King <colin.king@intel.com> <colin.king@canonical.com>
Documentation/arm64/silicon-errata.rst+2−0
@@ -100,6 +100,8 @@ stable kernels. · 99 unmodified lines
100+----------------+-----------------+-----------------+-----------------------------+100+----------------+-----------------+-----------------+-----------------------------+
101| ARM | Cortex-A510 | #2051678 | ARM64_ERRATUM_2051678 |101| ARM | Cortex-A510 | #2051678 | ARM64_ERRATUM_2051678 |
102+----------------+-----------------+-----------------+-----------------------------+102+----------------+-----------------+-----------------+-----------------------------+
103| ARM | Cortex-A510 | #2077057 | ARM64_ERRATUM_2077057 |
104+----------------+-----------------+-----------------+-----------------------------+
103| ARM | Cortex-A710 | #2119858 | ARM64_ERRATUM_2119858 |105| ARM | Cortex-A710 | #2119858 | ARM64_ERRATUM_2119858 |
104+----------------+-----------------+-----------------+-----------------------------+106+----------------+-----------------+-----------------+-----------------------------+
105| ARM | Cortex-A710 | #2054223 | ARM64_ERRATUM_2054223 |107| ARM | Cortex-A710 | #2054223 | ARM64_ERRATUM_2054223 |
Documentation/dev-tools/kselftest.rst+8−0
@@ -7,6 +7,14 @@ directory. These are intended to be small tests to exercise individual code · 6 unmodified lines
7paths in the kernel. Tests are intended to be run after building, installing7paths in the kernel. Tests are intended to be run after building, installing
8and booting a kernel.8and booting a kernel.
9 9
10Kselftest from mainline can be run on older stable kernels. Running tests
11from mainline offers the best coverage. Several test rings run mainline
12kselftest suite on stable releases. The reason is that when a new test
13gets added to test existing code to regression test a bug, we should be
14able to run that test on an older kernel. Hence, it is important to keep
15code that can still test an older kernel and make sure it skips the test
16gracefully on newer releases.
17
10You can find additional information on Kselftest framework, how to18You can find additional information on Kselftest framework, how to
11write new tests using the framework on Kselftest wiki:19write new tests using the framework on Kselftest wiki:
12 20
Documentation/devicetree/bindings/net/qcom,ipa.yaml+6−0
@@ -107,6 +107,10 @@ properties: · 106 unmodified lines
107 - const: imem107 - const: imem
108 - const: config108 - const: config
109 109
110 qcom,qmp:
111 $ref: /schemas/types.yaml#/definitions/phandle
112 description: phandle to the AOSS side-channel message RAM
113
110 qcom,smem-states:114 qcom,smem-states:
111 $ref: /schemas/types.yaml#/definitions/phandle-array115 $ref: /schemas/types.yaml#/definitions/phandle-array
112 description: State bits used in by the AP to signal the modem.116 description: State bits used in by the AP to signal the modem.
@@ -222,6 +226,8 @@ examples: · 109 unmodified lines
222 "imem",226 "imem",
223 "config";227 "config";
224 228
229 qcom,qmp = <&aoss_qmp>;
230
225 qcom,smem-states = <&ipa_smp2p_out 0>,231 qcom,smem-states = <&ipa_smp2p_out 0>,
226 <&ipa_smp2p_out 1>;232 <&ipa_smp2p_out 1>;
227 qcom,smem-state-names = "ipa-clock-enabled-valid",233 qcom,smem-state-names = "ipa-clock-enabled-valid",
Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml+3−2
@@ -23,8 +23,9 @@ properties: · 22 unmodified lines
23 minItems: 123 minItems: 1
24 maxItems: 25624 maxItems: 256
25 items:25 items:
26 minimum: 026 items:
27 maximum: 25627 - minimum: 0
28 maximum: 256
28 description:29 description:
29 Chip select used by the device.30 Chip select used by the device.
30 31
Documentation/filesystems/netfs_library.rst+16−0
@@ -462,6 +462,10 @@ operation table looks like the following:: · 461 unmodified lines
462 struct iov_iter *iter,462 struct iov_iter *iter,
463 netfs_io_terminated_t term_func,463 netfs_io_terminated_t term_func,
464 void *term_func_priv);464 void *term_func_priv);
465
466 int (*query_occupancy)(struct netfs_cache_resources *cres,
467 loff_t start, size_t len, size_t granularity,
468 loff_t *_data_start, size_t *_data_len);
465 };469 };
466 470
467With a termination handler function pointer::471With a termination handler function pointer::
@@ -536,6 +540,18 @@ The methods defined in the table are: · 68 unmodified lines
536 indicating whether the termination is definitely happening in the caller's540 indicating whether the termination is definitely happening in the caller's
537 context.541 context.
538 542
543 * ``query_occupancy()``
544
545 [Required] Called to find out where the next piece of data is within a
546 particular region of the cache. The start and length of the region to be
547 queried are passed in, along with the granularity to which the answer needs
548 to be aligned. The function passes back the start and length of the data,
549 if any, available within that region. Note that there may be a hole at the
550 front.
551
552 It returns 0 if some data was found, -ENODATA if there was no usable data
553 within the region or -ENOBUFS if there is no caching on this file.
554
539Note that these methods are passed a pointer to the cache resource structure,555Note that these methods are passed a pointer to the cache resource structure,
540not the read request structure as they could be used in other situations where556not the read request structure as they could be used in other situations where
541there isn't a read request structure as well, such as writing dirty data to the557there isn't a read request structure as well, such as writing dirty data to the
Documentation/gpu/todo.rst+0−24
@@ -300,30 +300,6 @@ Contact: Daniel Vetter, Noralf Tronnes · 299 unmodified lines
300 300
301Level: Advanced301Level: Advanced
302 302
303Garbage collect fbdev scrolling acceleration
304--------------------------------------------
305
306Scroll acceleration has been disabled in fbcon. Now it works as the old
307SCROLL_REDRAW mode. A ton of code was removed in fbcon.c and the hook bmove was
308removed from fbcon_ops.
309Remaining tasks:
310
311- a bunch of the hooks in fbcon_ops could be removed or simplified by calling
312 directly instead of the function table (with a switch on p->rotate)
313
314- fb_copyarea is unused after this, and can be deleted from all drivers
315
316- after that, fb_copyarea can be deleted from fb_ops in include/linux/fb.h as
317 well as cfb_copyarea
318
319Note that not all acceleration code can be deleted, since clearing and cursor
320support is still accelerated, which might be good candidates for further
321deletion projects.
322
323Contact: Daniel Vetter
324
325Level: Intermediate
326
327idr_init_base()303idr_init_base()
328---------------304---------------
329 305
Documentation/userspace-api/ioctl/ioctl-number.rst+3−0
@@ -115,6 +115,7 @@ Code Seq# Include File Comments · 114 unmodified lines
115'B' 00-1F linux/cciss_ioctl.h conflict!115'B' 00-1F linux/cciss_ioctl.h conflict!
116'B' 00-0F include/linux/pmu.h conflict!116'B' 00-0F include/linux/pmu.h conflict!
117'B' C0-FF advanced bbus <mailto:maassen@uni-freiburg.de>117'B' C0-FF advanced bbus <mailto:maassen@uni-freiburg.de>
118'B' 00-0F xen/xenbus_dev.h conflict!
118'C' all linux/soundcard.h conflict!119'C' all linux/soundcard.h conflict!
119'C' 01-2F linux/capi.h conflict!120'C' 01-2F linux/capi.h conflict!
120'C' F0-FF drivers/net/wan/cosa.h conflict!121'C' F0-FF drivers/net/wan/cosa.h conflict!
@@ -134,6 +135,7 @@ Code Seq# Include File Comments · 13 unmodified lines
134'F' 80-8F linux/arcfb.h conflict!135'F' 80-8F linux/arcfb.h conflict!
135'F' DD video/sstfb.h conflict!136'F' DD video/sstfb.h conflict!
136'G' 00-3F drivers/misc/sgi-gru/grulib.h conflict!137'G' 00-3F drivers/misc/sgi-gru/grulib.h conflict!
138'G' 00-0F xen/gntalloc.h, xen/gntdev.h conflict!
137'H' 00-7F linux/hiddev.h conflict!139'H' 00-7F linux/hiddev.h conflict!
138'H' 00-0F linux/hidraw.h conflict!140'H' 00-0F linux/hidraw.h conflict!
139'H' 01 linux/mei.h conflict!141'H' 01 linux/mei.h conflict!
@@ -176,6 +178,7 @@ Code Seq# Include File Comments · 36 unmodified lines
176'P' 60-6F sound/sscape_ioctl.h conflict!178'P' 60-6F sound/sscape_ioctl.h conflict!
177'P' 00-0F drivers/usb/class/usblp.c conflict!179'P' 00-0F drivers/usb/class/usblp.c conflict!
178'P' 01-09 drivers/misc/pci_endpoint_test.c conflict!180'P' 01-09 drivers/misc/pci_endpoint_test.c conflict!
181'P' 00-0F xen/privcmd.h conflict!
179'Q' all linux/soundcard.h182'Q' all linux/soundcard.h
180'R' 00-1F linux/random.h conflict!183'R' 00-1F linux/random.h conflict!
181'R' 01 linux/rfkill.h conflict!184'R' 01 linux/rfkill.h conflict!
MAINTAINERS+16−3
@@ -4157,9 +4157,8 @@ N: csky · 4156 unmodified lines
4157K: csky4157K: csky
4158 4158
4159CA8210 IEEE-802.15.4 RADIO DRIVER4159CA8210 IEEE-802.15.4 RADIO DRIVER
4160M: Harry Morris <h.morris@cascoda.com>
4161L: linux-wpan@vger.kernel.org4160L: linux-wpan@vger.kernel.org
4162S: Maintained4161S: Orphan
4163W: https://github.com/Cascoda/ca8210-linux.git4162W: https://github.com/Cascoda/ca8210-linux.git
4164F: Documentation/devicetree/bindings/net/ieee802154/ca8210.txt4163F: Documentation/devicetree/bindings/net/ieee802154/ca8210.txt
4165F: drivers/net/ieee802154/ca8210.c4164F: drivers/net/ieee802154/ca8210.c
@@ -10880,6 +10879,12 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git · 6714 unmodified lines
10880F: drivers/ata/pata_arasan_cf.c10879F: drivers/ata/pata_arasan_cf.c
10881F: include/linux/pata_arasan_cf_data.h10880F: include/linux/pata_arasan_cf_data.h
10882 10881
10882LIBATA PATA DRIVERS
10883R: Sergey Shtylyov <s.shtylyov@omp.ru>
10884L: linux-ide@vger.kernel.org
10885F: drivers/ata/ata_*.c
10886F: drivers/ata/pata_*.c
10887
10883LIBATA PATA FARADAY FTIDE010 AND GEMINI SATA BRIDGE DRIVERS10888LIBATA PATA FARADAY FTIDE010 AND GEMINI SATA BRIDGE DRIVERS
10884M: Linus Walleij <linus.walleij@linaro.org>10889M: Linus Walleij <linus.walleij@linaro.org>
10885L: linux-ide@vger.kernel.org10890L: linux-ide@vger.kernel.org
@@ -12400,7 +12405,7 @@ F: include/uapi/linux/membarrier.h · 1514 unmodified lines
12400F: kernel/sched/membarrier.c12405F: kernel/sched/membarrier.c
12401 12406
12402MEMBLOCK12407MEMBLOCK
12403M: Mike Rapoport <rppt@linux.ibm.com>12408M: Mike Rapoport <rppt@kernel.org>
12404L: linux-mm@kvack.org12409L: linux-mm@kvack.org
12405S: Maintained12410S: Maintained
12406F: Documentation/core-api/boot-time-mm.rst12411F: Documentation/core-api/boot-time-mm.rst
@@ -16469,6 +16474,14 @@ F: Documentation/devicetree/bindings/i2c/renesas,rmobile-iic.yaml · 4062 unmodified lines
16469F: drivers/i2c/busses/i2c-rcar.c16474F: drivers/i2c/busses/i2c-rcar.c
16470F: drivers/i2c/busses/i2c-sh_mobile.c16475F: drivers/i2c/busses/i2c-sh_mobile.c
16471 16476
16477RENESAS R-CAR SATA DRIVER
16478R: Sergey Shtylyov <s.shtylyov@omp.ru>
16479S: Supported
16480L: linux-ide@vger.kernel.org
16481L: linux-renesas-soc@vger.kernel.org
16482F: Documentation/devicetree/bindings/ata/renesas,rcar-sata.yaml
16483F: drivers/ata/sata_rcar.c
16484
16472RENESAS R-CAR THERMAL DRIVERS16485RENESAS R-CAR THERMAL DRIVERS
16473M: Niklas Söderlund <niklas.soderlund@ragnatech.se>16486M: Niklas Söderlund <niklas.soderlund@ragnatech.se>
16474L: linux-renesas-soc@vger.kernel.org16487L: linux-renesas-soc@vger.kernel.org
arch/arm/crypto/blake2s-shash.c+2−2
@@ -13,12 +13,12 @@ · 12 unmodified lines
13static int crypto_blake2s_update_arm(struct shash_desc *desc,13static int crypto_blake2s_update_arm(struct shash_desc *desc,
14 const u8 *in, unsigned int inlen)14 const u8 *in, unsigned int inlen)
15{15{
16 return crypto_blake2s_update(desc, in, inlen, blake2s_compress);16 return crypto_blake2s_update(desc, in, inlen, false);
17}17}
18 18
19static int crypto_blake2s_final_arm(struct shash_desc *desc, u8 *out)19static int crypto_blake2s_final_arm(struct shash_desc *desc, u8 *out)
20{20{
21 return crypto_blake2s_final(desc, out, blake2s_compress);21 return crypto_blake2s_final(desc, out, false);
22}22}
23 23
24#define BLAKE2S_ALG(name, driver_name, digest_size) \24#define BLAKE2S_ALG(name, driver_name, digest_size) \
arch/arm64/Kconfig+16−0
@@ -680,6 +680,22 @@ config ARM64_ERRATUM_2051678 · 679 unmodified lines
680 680
681 If unsure, say Y.681 If unsure, say Y.
682 682
683config ARM64_ERRATUM_2077057
684 bool "Cortex-A510: 2077057: workaround software-step corrupting SPSR_EL2"
685 help
686 This option adds the workaround for ARM Cortex-A510 erratum 2077057.
687 Affected Cortex-A510 may corrupt SPSR_EL2 when the a step exception is
688 expected, but a Pointer Authentication trap is taken instead. The
689 erratum causes SPSR_EL1 to be copied to SPSR_EL2, which could allow
690 EL1 to cause a return to EL2 with a guest controlled ELR_EL2.
691
692 This can only happen when EL2 is stepping EL1.
693
694 When these conditions occur, the SPSR_EL2 value is unchanged from the
695 previous guest entry, and can be restored from the in-memory copy.
696
697 If unsure, say Y.
698
683config ARM64_ERRATUM_2119858699config ARM64_ERRATUM_2119858
684 bool "Cortex-A710/X2: 2119858: workaround TRBE overwriting trace data in FILL mode"700 bool "Cortex-A710/X2: 2119858: workaround TRBE overwriting trace data in FILL mode"
685 default y701 default y
arch/arm64/kernel/cpu_errata.c+8−0
@@ -600,6 +600,14 @@ const struct arm64_cpu_capabilities arm64_errata[] = { · 599 unmodified lines
600 CAP_MIDR_RANGE_LIST(trbe_write_out_of_range_cpus),600 CAP_MIDR_RANGE_LIST(trbe_write_out_of_range_cpus),
601 },601 },
602#endif602#endif
603#ifdef CONFIG_ARM64_ERRATUM_2077057
604 {
605 .desc = "ARM erratum 2077057",
606 .capability = ARM64_WORKAROUND_2077057,
607 .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,
608 ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A510, 0, 0, 2),
609 },
610#endif
603#ifdef CONFIG_ARM64_ERRATUM_2064142611#ifdef CONFIG_ARM64_ERRATUM_2064142
604 {612 {
605 .desc = "ARM erratum 2064142",613 .desc = "ARM erratum 2064142",
arch/arm64/kvm/arm.c+33−18
@@ -797,6 +797,24 @@ static bool kvm_vcpu_exit_request(struct kvm_vcpu *vcpu, int *ret) · 796 unmodified lines
797 xfer_to_guest_mode_work_pending();797 xfer_to_guest_mode_work_pending();
798}798}
799 799
800/*
801 * Actually run the vCPU, entering an RCU extended quiescent state (EQS) while
802 * the vCPU is running.
803 *
804 * This must be noinstr as instrumentation may make use of RCU, and this is not
805 * safe during the EQS.
806 */
807static int noinstr kvm_arm_vcpu_enter_exit(struct kvm_vcpu *vcpu)
808{
809 int ret;
810
811 guest_state_enter_irqoff();
812 ret = kvm_call_hyp_ret(__kvm_vcpu_run, vcpu);
813 guest_state_exit_irqoff();
814
815 return ret;
816}
817
800/**818/**
801 * kvm_arch_vcpu_ioctl_run - the main VCPU run function to execute guest code819 * kvm_arch_vcpu_ioctl_run - the main VCPU run function to execute guest code
802 * @vcpu: The VCPU pointer820 * @vcpu: The VCPU pointer
@@ -881,9 +899,9 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) · 78 unmodified lines
881 * Enter the guest899 * Enter the guest
882 */900 */
883 trace_kvm_entry(*vcpu_pc(vcpu));901 trace_kvm_entry(*vcpu_pc(vcpu));
884 guest_enter_irqoff();902 guest_timing_enter_irqoff();
885 903
886 ret = kvm_call_hyp_ret(__kvm_vcpu_run, vcpu);904 ret = kvm_arm_vcpu_enter_exit(vcpu);
887 905
888 vcpu->mode = OUTSIDE_GUEST_MODE;906 vcpu->mode = OUTSIDE_GUEST_MODE;
889 vcpu->stat.exits++;907 vcpu->stat.exits++;
@@ -918,26 +936,23 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) · 28 unmodified lines
918 kvm_arch_vcpu_ctxsync_fp(vcpu);936 kvm_arch_vcpu_ctxsync_fp(vcpu);
919 937
920 /*938 /*
921 * We may have taken a host interrupt in HYP mode (ie939 * We must ensure that any pending interrupts are taken before
922 * while executing the guest). This interrupt is still940 * we exit guest timing so that timer ticks are accounted as
923 * pending, as we haven't serviced it yet!941 * guest time. Transiently unmask interrupts so that any
942 * pending interrupts are taken.
924 *943 *
925 * We're now back in SVC mode, with interrupts944 * Per ARM DDI 0487G.b section D1.13.4, an ISB (or other
926 * disabled. Enabling the interrupts now will have945 * context synchronization event) is necessary to ensure that
927 * the effect of taking the interrupt again, in SVC946 * pending interrupts are taken.
928 * mode this time.
929 */947 */
930 local_irq_enable();948 local_irq_enable();
949 isb();
950 local_irq_disable();
951
952 guest_timing_exit_irqoff();
953
954 local_irq_enable();
931 955
932 /*
933 * We do local_irq_enable() before calling guest_exit() so
934 * that if a timer interrupt hits while running the guest we
935 * account that tick as being spent in the guest. We enable
936 * preemption after calling guest_exit() so that if we get
937 * preempted we make sure ticks after that is not counted as
938 * guest time.
939 */
940 guest_exit();
941 trace_kvm_exit(ret, kvm_vcpu_trap_get_class(vcpu), *vcpu_pc(vcpu));956 trace_kvm_exit(ret, kvm_vcpu_trap_get_class(vcpu), *vcpu_pc(vcpu));
942 957
943 /* Exit types that need handling before we can be preempted */958 /* Exit types that need handling before we can be preempted */
arch/arm64/kvm/handle_exit.c+8−0
@@ -228,6 +228,14 @@ int handle_exit(struct kvm_vcpu *vcpu, int exception_index) · 227 unmodified lines
228{228{
229 struct kvm_run *run = vcpu->run;229 struct kvm_run *run = vcpu->run;
230 230
231 if (ARM_SERROR_PENDING(exception_index)) {
232 /*
233 * The SError is handled by handle_exit_early(). If the guest
234 * survives it will re-execute the original instruction.
235 */
236 return 1;
237 }
238
231 exception_index = ARM_EXCEPTION_CODE(exception_index);239 exception_index = ARM_EXCEPTION_CODE(exception_index);
232 240
233 switch (exception_index) {241 switch (exception_index) {
arch/arm64/kvm/hyp/include/hyp/switch.h+21−2
@@ -402,6 +402,24 @@ static inline bool kvm_hyp_handle_exit(struct kvm_vcpu *vcpu, u64 *exit_code) · 401 unmodified lines
402 return false;402 return false;
403}403}
404 404
405static inline void synchronize_vcpu_pstate(struct kvm_vcpu *vcpu, u64 *exit_code)
406{
407 /*
408 * Check for the conditions of Cortex-A510's #2077057. When these occur
409 * SPSR_EL2 can't be trusted, but isn't needed either as it is
410 * unchanged from the value in vcpu_gp_regs(vcpu)->pstate.
411 * Are we single-stepping the guest, and took a PAC exception from the
412 * active-not-pending state?
413 */
414 if (cpus_have_final_cap(ARM64_WORKAROUND_2077057) &&
415 vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP &&
416 *vcpu_cpsr(vcpu) & DBG_SPSR_SS &&
417 ESR_ELx_EC(read_sysreg_el2(SYS_ESR)) == ESR_ELx_EC_PAC)
418 write_sysreg_el2(*vcpu_cpsr(vcpu), SYS_SPSR);
419
420 vcpu->arch.ctxt.regs.pstate = read_sysreg_el2(SYS_SPSR);
421}
422
405/*423/*
406 * Return true when we were able to fixup the guest exit and should return to424 * Return true when we were able to fixup the guest exit and should return to
407 * the guest, false when we should restore the host state and return to the425 * the guest, false when we should restore the host state and return to the
@@ -413,7 +431,7 @@ static inline bool fixup_guest_exit(struct kvm_vcpu *vcpu, u64 *exit_code) · 5 unmodified lines
413 * Save PSTATE early so that we can evaluate the vcpu mode431 * Save PSTATE early so that we can evaluate the vcpu mode
414 * early on.432 * early on.
415 */433 */
416 vcpu->arch.ctxt.regs.pstate = read_sysreg_el2(SYS_SPSR);434 synchronize_vcpu_pstate(vcpu, exit_code);
417 435
418 /*436 /*
419 * Check whether we want to repaint the state one way or437 * Check whether we want to repaint the state one way or
@@ -424,7 +442,8 @@ static inline bool fixup_guest_exit(struct kvm_vcpu *vcpu, u64 *exit_code) · 4 unmodified lines
424 if (ARM_EXCEPTION_CODE(*exit_code) != ARM_EXCEPTION_IRQ)442 if (ARM_EXCEPTION_CODE(*exit_code) != ARM_EXCEPTION_IRQ)
425 vcpu->arch.fault.esr_el2 = read_sysreg_el2(SYS_ESR);443 vcpu->arch.fault.esr_el2 = read_sysreg_el2(SYS_ESR);
426 444
427 if (ARM_SERROR_PENDING(*exit_code)) {445 if (ARM_SERROR_PENDING(*exit_code) &&
446 ARM_EXCEPTION_CODE(*exit_code) != ARM_EXCEPTION_IRQ) {
428 u8 esr_ec = kvm_vcpu_trap_get_class(vcpu);447 u8 esr_ec = kvm_vcpu_trap_get_class(vcpu);
429 448
430 /*449 /*
arch/arm64/tools/cpucaps+3−2
@@ -55,9 +55,10 @@ WORKAROUND_1418040 · 54 unmodified lines
55WORKAROUND_146322555WORKAROUND_1463225
56WORKAROUND_150841256WORKAROUND_1508412
57WORKAROUND_154241957WORKAROUND_1542419
58WORKAROUND_2064142
59WORKAROUND_2038923
60WORKAROUND_190269158WORKAROUND_1902691
59WORKAROUND_2038923
60WORKAROUND_2064142
61WORKAROUND_2077057
61WORKAROUND_TRBE_OVERWRITE_FILL_MODE62WORKAROUND_TRBE_OVERWRITE_FILL_MODE
62WORKAROUND_TSB_FLUSH_FAILURE63WORKAROUND_TSB_FLUSH_FAILURE
63WORKAROUND_TRBE_WRITE_OUT_OF_RANGE64WORKAROUND_TRBE_WRITE_OUT_OF_RANGE
arch/mips/cavium-octeon/octeon-memcpy.S+1−1
@@ -74,7 +74,7 @@ · 73 unmodified lines
74#define EXC(inst_reg,addr,handler) \74#define EXC(inst_reg,addr,handler) \
759: inst_reg, addr; \759: inst_reg, addr; \
76 .section __ex_table,"a"; \76 .section __ex_table,"a"; \
77 PTR 9b, handler; \77 PTR_WD 9b, handler; \
78 .previous78 .previous
79 79
80/*80/*
arch/mips/kvm/mips.c+46−4
@@ -414,6 +414,24 @@ int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu, · 413 unmodified lines
414 return -ENOIOCTLCMD;414 return -ENOIOCTLCMD;
415}415}
416 416
417/*
418 * Actually run the vCPU, entering an RCU extended quiescent state (EQS) while
419 * the vCPU is running.
420 *
421 * This must be noinstr as instrumentation may make use of RCU, and this is not
422 * safe during the EQS.
423 */
424static int noinstr kvm_mips_vcpu_enter_exit(struct kvm_vcpu *vcpu)
425{
426 int ret;
427
428 guest_state_enter_irqoff();
429 ret = kvm_mips_callbacks->vcpu_run(vcpu);
430 guest_state_exit_irqoff();
431
432 return ret;
433}
434
417int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)435int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
418{436{
419 int r = -EINTR;437 int r = -EINTR;
@@ -434,7 +452,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) · 14 unmodified lines
434 lose_fpu(1);452 lose_fpu(1);
435 453
436 local_irq_disable();454 local_irq_disable();
437 guest_enter_irqoff();455 guest_timing_enter_irqoff();
438 trace_kvm_enter(vcpu);456 trace_kvm_enter(vcpu);
439 457
440 /*458 /*
@@ -445,10 +463,23 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) · 4 unmodified lines
445 */463 */
446 smp_store_mb(vcpu->mode, IN_GUEST_MODE);464 smp_store_mb(vcpu->mode, IN_GUEST_MODE);
447 465
448 r = kvm_mips_callbacks->vcpu_run(vcpu);466 r = kvm_mips_vcpu_enter_exit(vcpu);
467
468 /*
469 * We must ensure that any pending interrupts are taken before
470 * we exit guest timing so that timer ticks are accounted as
471 * guest time. Transiently unmask interrupts so that any
472 * pending interrupts are taken.
473 *
474 * TODO: is there a barrier which ensures that pending interrupts are
475 * recognised? Currently this just hopes that the CPU takes any pending
476 * interrupts between the enable and disable.
477 */
478 local_irq_enable();
479 local_irq_disable();
449 480
450 trace_kvm_out(vcpu);481 trace_kvm_out(vcpu);
451 guest_exit_irqoff();482 guest_timing_exit_irqoff();
452 local_irq_enable();483 local_irq_enable();
453 484
454out:485out:
@@ -1168,7 +1199,7 @@ static void kvm_mips_set_c0_status(void) · 713 unmodified lines
1168/*1199/*
1169 * Return value is in the form (errcode<<2 | RESUME_FLAG_HOST | RESUME_FLAG_NV)1200 * Return value is in the form (errcode<<2 | RESUME_FLAG_HOST | RESUME_FLAG_NV)
1170 */1201 */
1171int kvm_mips_handle_exit(struct kvm_vcpu *vcpu)1202static int __kvm_mips_handle_exit(struct kvm_vcpu *vcpu)
1172{1203{
1173 struct kvm_run *run = vcpu->run;1204 struct kvm_run *run = vcpu->run;
1174 u32 cause = vcpu->arch.host_cp0_cause;1205 u32 cause = vcpu->arch.host_cp0_cause;
@@ -1357,6 +1388,17 @@ int kvm_mips_handle_exit(struct kvm_vcpu *vcpu) · 182 unmodified lines
1357 return ret;1388 return ret;
1358}1389}
1359 1390
1391int noinstr kvm_mips_handle_exit(struct kvm_vcpu *vcpu)
1392{
1393 int ret;
1394
1395 guest_state_exit_irqoff();
1396 ret = __kvm_mips_handle_exit(vcpu);
1397 guest_state_enter_irqoff();
1398
1399 return ret;
1400}
1401
1360/* Enable FPU for guest and restore context */1402/* Enable FPU for guest and restore context */
1361void kvm_own_fpu(struct kvm_vcpu *vcpu)1403void kvm_own_fpu(struct kvm_vcpu *vcpu)
1362{1404{
arch/mips/kvm/vz.c+9−3
@@ -458,8 +458,8 @@ void kvm_vz_acquire_htimer(struct kvm_vcpu *vcpu) · 457 unmodified lines
458/**458/**
459 * _kvm_vz_save_htimer() - Switch to software emulation of guest timer.459 * _kvm_vz_save_htimer() - Switch to software emulation of guest timer.
460 * @vcpu: Virtual CPU.460 * @vcpu: Virtual CPU.
461 * @compare: Pointer to write compare value to.461 * @out_compare: Pointer to write compare value to.
462 * @cause: Pointer to write cause value to.462 * @out_cause: Pointer to write cause value to.
463 *463 *
464 * Save VZ guest timer state and switch to software emulation of guest CP0464 * Save VZ guest timer state and switch to software emulation of guest CP0
465 * timer. The hard timer must already be in use, so preemption should be465 * timer. The hard timer must already be in use, so preemption should be
@@ -1541,11 +1541,14 @@ static int kvm_trap_vz_handle_guest_exit(struct kvm_vcpu *vcpu) · 1075 unmodified lines
1541}1541}
1542 1542
1543/**1543/**
1544 * kvm_trap_vz_handle_cop_unusuable() - Guest used unusable coprocessor.1544 * kvm_trap_vz_handle_cop_unusable() - Guest used unusable coprocessor.
1545 * @vcpu: Virtual CPU context.1545 * @vcpu: Virtual CPU context.
1546 *1546 *
1547 * Handle when the guest attempts to use a coprocessor which hasn't been allowed1547 * Handle when the guest attempts to use a coprocessor which hasn't been allowed
1548 * by the root context.1548 * by the root context.
1549 *
1550 * Return: value indicating whether to resume the host or the guest
1551 * (RESUME_HOST or RESUME_GUEST)
1549 */1552 */
1550static int kvm_trap_vz_handle_cop_unusable(struct kvm_vcpu *vcpu)1553static int kvm_trap_vz_handle_cop_unusable(struct kvm_vcpu *vcpu)
1551{1554{
@@ -1592,6 +1595,9 @@ static int kvm_trap_vz_handle_cop_unusable(struct kvm_vcpu *vcpu) · 40 unmodified lines
1592 *1595 *
1593 * Handle when the guest attempts to use MSA when it is disabled in the root1596 * Handle when the guest attempts to use MSA when it is disabled in the root
1594 * context.1597 * context.
1598 *
1599 * Return: value indicating whether to resume the host or the guest
1600 * (RESUME_HOST or RESUME_GUEST)
1595 */1601 */
1596static int kvm_trap_vz_handle_msa_disabled(struct kvm_vcpu *vcpu)1602static int kvm_trap_vz_handle_msa_disabled(struct kvm_vcpu *vcpu)
1597{1603{
arch/riscv/kvm/vcpu.c+31−17
@@ -90,6 +90,7 @@ int kvm_arch_vcpu_precreate(struct kvm *kvm, unsigned int id) · 89 unmodified lines
90int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu)90int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu)
91{91{
92 struct kvm_cpu_context *cntx;92 struct kvm_cpu_context *cntx;
93 struct kvm_vcpu_csr *reset_csr = &vcpu->arch.guest_reset_csr;
93 94
94 /* Mark this VCPU never ran */95 /* Mark this VCPU never ran */
95 vcpu->arch.ran_atleast_once = false;96 vcpu->arch.ran_atleast_once = false;
@@ -106,6 +107,9 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu) · 10 unmodified lines
106 cntx->hstatus |= HSTATUS_SPVP;107 cntx->hstatus |= HSTATUS_SPVP;
107 cntx->hstatus |= HSTATUS_SPV;108 cntx->hstatus |= HSTATUS_SPV;
108 109
110 /* By default, make CY, TM, and IR counters accessible in VU mode */
111 reset_csr->scounteren = 0x7;
112
109 /* Setup VCPU timer */113 /* Setup VCPU timer */
110 kvm_riscv_vcpu_timer_init(vcpu);114 kvm_riscv_vcpu_timer_init(vcpu);
111 115
@@ -699,6 +703,20 @@ static void kvm_riscv_update_hvip(struct kvm_vcpu *vcpu) · 587 unmodified lines
699 csr_write(CSR_HVIP, csr->hvip);703 csr_write(CSR_HVIP, csr->hvip);
700}704}
701 705
706/*
707 * Actually run the vCPU, entering an RCU extended quiescent state (EQS) while
708 * the vCPU is running.
709 *
710 * This must be noinstr as instrumentation may make use of RCU, and this is not
711 * safe during the EQS.
712 */
713static void noinstr kvm_riscv_vcpu_enter_exit(struct kvm_vcpu *vcpu)
714{
715 guest_state_enter_irqoff();
716 __kvm_riscv_switch_to(&vcpu->arch);
717 guest_state_exit_irqoff();
718}
719
702int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)720int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
703{721{
704 int ret;722 int ret;
@@ -790,9 +808,9 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) · 85 unmodified lines
790 continue;808 continue;
791 }809 }
792 810
793 guest_enter_irqoff();811 guest_timing_enter_irqoff();
794 812
795 __kvm_riscv_switch_to(&vcpu->arch);813 kvm_riscv_vcpu_enter_exit(vcpu);
796 814
797 vcpu->mode = OUTSIDE_GUEST_MODE;815 vcpu->mode = OUTSIDE_GUEST_MODE;
798 vcpu->stat.exits++;816 vcpu->stat.exits++;
@@ -812,25 +830,21 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) · 13 unmodified lines
812 kvm_riscv_vcpu_sync_interrupts(vcpu);830 kvm_riscv_vcpu_sync_interrupts(vcpu);
813 831
814 /*832 /*
815 * We may have taken a host interrupt in VS/VU-mode (i.e.833 * We must ensure that any pending interrupts are taken before
816 * while executing the guest). This interrupt is still834 * we exit guest timing so that timer ticks are accounted as
817 * pending, as we haven't serviced it yet!835 * guest time. Transiently unmask interrupts so that any
836 * pending interrupts are taken.
818 *837 *
819 * We're now back in HS-mode with interrupts disabled838 * There's no barrier which ensures that pending interrupts are
820 * so enabling the interrupts now will have the effect839 * recognised, so we just hope that the CPU takes any pending
821 * of taking the interrupt again, in HS-mode this time.840 * interrupts between the enable and disable.
822 */841 */
823 local_irq_enable();842 local_irq_enable();
843 local_irq_disable();
824 844
825 /*845 guest_timing_exit_irqoff();
826 * We do local_irq_enable() before calling guest_exit() so846
827 * that if a timer interrupt hits while running the guest847 local_irq_enable();
828 * we account that tick as being spent in the guest. We
829 * enable preemption after calling guest_exit() so that if
830 * we get preempted we make sure ticks after that is not
831 * counted as guest time.
832 */
833 guest_exit();
834 848
835 preempt_enable();849 preempt_enable();
836 850
arch/riscv/kvm/vcpu_sbi_base.c+2−1
@@ -9,6 +9,7 @@ · 8 unmodified lines
9#include <linux/errno.h>9#include <linux/errno.h>
10#include <linux/err.h>10#include <linux/err.h>
11#include <linux/kvm_host.h>11#include <linux/kvm_host.h>
12#include <linux/version.h>
12#include <asm/csr.h>13#include <asm/csr.h>
13#include <asm/sbi.h>14#include <asm/sbi.h>
14#include <asm/kvm_vcpu_timer.h>15#include <asm/kvm_vcpu_timer.h>
@@ -32,7 +33,7 @@ static int kvm_sbi_ext_base_handler(struct kvm_vcpu *vcpu, struct kvm_run *run, · 17 unmodified lines
32 *out_val = KVM_SBI_IMPID;33 *out_val = KVM_SBI_IMPID;
33 break;34 break;
34 case SBI_EXT_BASE_GET_IMP_VERSION:35 case SBI_EXT_BASE_GET_IMP_VERSION:
35 *out_val = 0;36 *out_val = LINUX_VERSION_CODE;
36 break;37 break;
37 case SBI_EXT_BASE_PROBE_EXT:38 case SBI_EXT_BASE_PROBE_EXT:
38 if ((cp->a0 >= SBI_EXT_EXPERIMENTAL_START &&39 if ((cp->a0 >= SBI_EXT_EXPERIMENTAL_START &&
arch/x86/crypto/blake2s-shash.c+2−2
@@ -18,12 +18,12 @@ · 17 unmodified lines
18static int crypto_blake2s_update_x86(struct shash_desc *desc,18static int crypto_blake2s_update_x86(struct shash_desc *desc,
19 const u8 *in, unsigned int inlen)19 const u8 *in, unsigned int inlen)
20{20{
21 return crypto_blake2s_update(desc, in, inlen, blake2s_compress);21 return crypto_blake2s_update(desc, in, inlen, false);
22}22}
23 23
24static int crypto_blake2s_final_x86(struct shash_desc *desc, u8 *out)24static int crypto_blake2s_final_x86(struct shash_desc *desc, u8 *out)
25{25{
26 return crypto_blake2s_final(desc, out, blake2s_compress);26 return crypto_blake2s_final(desc, out, false);
27}27}
28 28
29#define BLAKE2S_ALG(name, driver_name, digest_size) \29#define BLAKE2S_ALG(name, driver_name, digest_size) \
arch/x86/include/asm/kvm-x86-ops.h+1−1
@@ -82,7 +82,7 @@ KVM_X86_OP_NULL(guest_apic_has_interrupt) · 81 unmodified lines
82KVM_X86_OP(load_eoi_exitmap)82KVM_X86_OP(load_eoi_exitmap)
83KVM_X86_OP(set_virtual_apic_mode)83KVM_X86_OP(set_virtual_apic_mode)
84KVM_X86_OP_NULL(set_apic_access_page_addr)84KVM_X86_OP_NULL(set_apic_access_page_addr)
85KVM_X86_OP(deliver_posted_interrupt)85KVM_X86_OP(deliver_interrupt)
86KVM_X86_OP_NULL(sync_pir_to_irr)86KVM_X86_OP_NULL(sync_pir_to_irr)
87KVM_X86_OP(set_tss_addr)87KVM_X86_OP(set_tss_addr)
88KVM_X86_OP(set_identity_map_addr)88KVM_X86_OP(set_identity_map_addr)
arch/x86/include/asm/kvm_host.h+2−1
@@ -1410,7 +1410,8 @@ struct kvm_x86_ops { · 1409 unmodified lines
1410 void (*load_eoi_exitmap)(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap);1410 void (*load_eoi_exitmap)(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap);
1411 void (*set_virtual_apic_mode)(struct kvm_vcpu *vcpu);1411 void (*set_virtual_apic_mode)(struct kvm_vcpu *vcpu);
1412 void (*set_apic_access_page_addr)(struct kvm_vcpu *vcpu);1412 void (*set_apic_access_page_addr)(struct kvm_vcpu *vcpu);
1413 int (*deliver_posted_interrupt)(struct kvm_vcpu *vcpu, int vector);1413 void (*deliver_interrupt)(struct kvm_lapic *apic, int delivery_mode,
1414 int trig_mode, int vector);
1414 int (*sync_pir_to_irr)(struct kvm_vcpu *vcpu);1415 int (*sync_pir_to_irr)(struct kvm_vcpu *vcpu);
1415 int (*set_tss_addr)(struct kvm *kvm, unsigned int addr);1416 int (*set_tss_addr)(struct kvm *kvm, unsigned int addr);
1416 int (*set_identity_map_addr)(struct kvm *kvm, u64 ident_addr);1417 int (*set_identity_map_addr)(struct kvm *kvm, u64 ident_addr);
arch/x86/include/asm/xen/hypervisor.h+0−14
@@ -43,20 +43,6 @@ static inline uint32_t xen_cpuid_base(void) · 42 unmodified lines
43 return hypervisor_cpuid_base("XenVMMXenVMM", 2);43 return hypervisor_cpuid_base("XenVMMXenVMM", 2);
44}44}
45 45
46#ifdef CONFIG_XEN
47extern bool __init xen_hvm_need_lapic(void);
48
49static inline bool __init xen_x2apic_para_available(void)
50{
51 return xen_hvm_need_lapic();
52}
53#else
54static inline bool __init xen_x2apic_para_available(void)
55{
56 return (xen_cpuid_base() != 0);
57}
58#endif
59
60struct pci_dev;46struct pci_dev;
61 47
62#ifdef CONFIG_XEN_PV_DOM048#ifdef CONFIG_XEN_PV_DOM0
arch/x86/kvm/cpuid.c+7−6
@@ -554,12 +554,13 @@ void kvm_set_cpu_caps(void) · 553 unmodified lines
554 );554 );
555 555
556 kvm_cpu_cap_mask(CPUID_7_0_EBX,556 kvm_cpu_cap_mask(CPUID_7_0_EBX,
557 F(FSGSBASE) | F(SGX) | F(BMI1) | F(HLE) | F(AVX2) | F(SMEP) |557 F(FSGSBASE) | F(SGX) | F(BMI1) | F(HLE) | F(AVX2) |
558 F(BMI2) | F(ERMS) | F(INVPCID) | F(RTM) | 0 /*MPX*/ | F(RDSEED) |558 F(FDP_EXCPTN_ONLY) | F(SMEP) | F(BMI2) | F(ERMS) | F(INVPCID) |
559 F(ADX) | F(SMAP) | F(AVX512IFMA) | F(AVX512F) | F(AVX512PF) |559 F(RTM) | F(ZERO_FCS_FDS) | 0 /*MPX*/ | F(AVX512F) |
560 F(AVX512ER) | F(AVX512CD) | F(CLFLUSHOPT) | F(CLWB) | F(AVX512DQ) |560 F(AVX512DQ) | F(RDSEED) | F(ADX) | F(SMAP) | F(AVX512IFMA) |
561 F(SHA_NI) | F(AVX512BW) | F(AVX512VL) | 0 /*INTEL_PT*/561 F(CLFLUSHOPT) | F(CLWB) | 0 /*INTEL_PT*/ | F(AVX512PF) |
562 );562 F(AVX512ER) | F(AVX512CD) | F(SHA_NI) | F(AVX512BW) |
563 F(AVX512VL));
563 564
564 kvm_cpu_cap_mask(CPUID_7_ECX,565 kvm_cpu_cap_mask(CPUID_7_ECX,
565 F(AVX512VBMI) | F(LA57) | F(PKU) | 0 /*OSPKE*/ | F(RDPID) |566 F(AVX512VBMI) | F(LA57) | F(PKU) | 0 /*OSPKE*/ | F(RDPID) |
arch/x86/kvm/lapic.c+2−8
@@ -1096,14 +1096,8 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode, · 1095 unmodified lines
1096 apic->regs + APIC_TMR);1096 apic->regs + APIC_TMR);
1097 }1097 }
1098 1098
1099 if (static_call(kvm_x86_deliver_posted_interrupt)(vcpu, vector)) {1099 static_call(kvm_x86_deliver_interrupt)(apic, delivery_mode,
1100 kvm_lapic_set_irr(vector, apic);1100 trig_mode, vector);
1101 kvm_make_request(KVM_REQ_EVENT, vcpu);
1102 kvm_vcpu_kick(vcpu);
1103 } else {
1104 trace_kvm_apicv_accept_irq(vcpu->vcpu_id, delivery_mode,
1105 trig_mode, vector);
1106 }
1107 break;1101 break;
1108 1102
1109 case APIC_DM_REMRD:1103 case APIC_DM_REMRD:
arch/x86/kvm/svm/svm.c+18−3
@@ -3291,6 +3291,21 @@ static void svm_set_irq(struct kvm_vcpu *vcpu) · 3290 unmodified lines
3291 SVM_EVTINJ_VALID | SVM_EVTINJ_TYPE_INTR;3291 SVM_EVTINJ_VALID | SVM_EVTINJ_TYPE_INTR;
3292}3292}
3293 3293
3294static void svm_deliver_interrupt(struct kvm_lapic *apic, int delivery_mode,
3295 int trig_mode, int vector)
3296{
3297 struct kvm_vcpu *vcpu = apic->vcpu;
3298
3299 if (svm_deliver_avic_intr(vcpu, vector)) {
3300 kvm_lapic_set_irr(vector, apic);
3301 kvm_make_request(KVM_REQ_EVENT, vcpu);
3302 kvm_vcpu_kick(vcpu);
3303 } else {
3304 trace_kvm_apicv_accept_irq(vcpu->vcpu_id, delivery_mode,
3305 trig_mode, vector);
3306 }
3307}
3308
3294static void svm_update_cr8_intercept(struct kvm_vcpu *vcpu, int tpr, int irr)3309static void svm_update_cr8_intercept(struct kvm_vcpu *vcpu, int tpr, int irr)
3295{3310{
3296 struct vcpu_svm *svm = to_svm(vcpu);3311 struct vcpu_svm *svm = to_svm(vcpu);
@@ -3615,7 +3630,7 @@ static noinstr void svm_vcpu_enter_exit(struct kvm_vcpu *vcpu) · 318 unmodified lines
3615 struct vcpu_svm *svm = to_svm(vcpu);3630 struct vcpu_svm *svm = to_svm(vcpu);
3616 unsigned long vmcb_pa = svm->current_vmcb->pa;3631 unsigned long vmcb_pa = svm->current_vmcb->pa;
3617 3632
3618 kvm_guest_enter_irqoff();3633 guest_state_enter_irqoff();
3619 3634
3620 if (sev_es_guest(vcpu->kvm)) {3635 if (sev_es_guest(vcpu->kvm)) {
3621 __svm_sev_es_vcpu_run(vmcb_pa);3636 __svm_sev_es_vcpu_run(vmcb_pa);
@@ -3635,7 +3650,7 @@ static noinstr void svm_vcpu_enter_exit(struct kvm_vcpu *vcpu) · 13 unmodified lines
3635 vmload(__sme_page_pa(sd->save_area));3650 vmload(__sme_page_pa(sd->save_area));
3636 }3651 }
3637 3652
3638 kvm_guest_exit_irqoff();3653 guest_state_exit_irqoff();
3639}3654}
3640 3655
3641static __no_kcsan fastpath_t svm_vcpu_run(struct kvm_vcpu *vcpu)3656static __no_kcsan fastpath_t svm_vcpu_run(struct kvm_vcpu *vcpu)
@@ -4545,7 +4560,7 @@ static struct kvm_x86_ops svm_x86_ops __initdata = { · 903 unmodified lines
4545 .pmu_ops = &amd_pmu_ops,4560 .pmu_ops = &amd_pmu_ops,
4546 .nested_ops = &svm_nested_ops,4561 .nested_ops = &svm_nested_ops,
4547 4562
4548 .deliver_posted_interrupt = svm_deliver_avic_intr,4563 .deliver_interrupt = svm_deliver_interrupt,
4549 .dy_apicv_has_pending_interrupt = svm_dy_apicv_has_pending_interrupt,4564 .dy_apicv_has_pending_interrupt = svm_dy_apicv_has_pending_interrupt,
4550 .update_pi_irte = svm_update_pi_irte,4565 .update_pi_irte = svm_update_pi_irte,
4551 .setup_mce = svm_setup_mce,4566 .setup_mce = svm_setup_mce,
arch/x86/kvm/vmx/vmx.c+18−3
@@ -4041,6 +4041,21 @@ static int vmx_deliver_posted_interrupt(struct kvm_vcpu *vcpu, int vector) · 4040 unmodified lines
4041 return 0;4041 return 0;
4042}4042}
4043 4043
4044static void vmx_deliver_interrupt(struct kvm_lapic *apic, int delivery_mode,
4045 int trig_mode, int vector)
4046{
4047 struct kvm_vcpu *vcpu = apic->vcpu;
4048
4049 if (vmx_deliver_posted_interrupt(vcpu, vector)) {
4050 kvm_lapic_set_irr(vector, apic);
4051 kvm_make_request(KVM_REQ_EVENT, vcpu);
4052 kvm_vcpu_kick(vcpu);
4053 } else {
4054 trace_kvm_apicv_accept_irq(vcpu->vcpu_id, delivery_mode,
4055 trig_mode, vector);
4056 }
4057}
4058
4044/*4059/*
4045 * Set up the vmcs's constant host-state fields, i.e., host-state fields that4060 * Set up the vmcs's constant host-state fields, i.e., host-state fields that
4046 * will not change in the lifetime of the guest.4061 * will not change in the lifetime of the guest.
@@ -6754,7 +6769,7 @@ static fastpath_t vmx_exit_handlers_fastpath(struct kvm_vcpu *vcpu) · 2707 unmodified lines
6754static noinstr void vmx_vcpu_enter_exit(struct kvm_vcpu *vcpu,6769static noinstr void vmx_vcpu_enter_exit(struct kvm_vcpu *vcpu,
6755 struct vcpu_vmx *vmx)6770 struct vcpu_vmx *vmx)
6756{6771{
6757 kvm_guest_enter_irqoff();6772 guest_state_enter_irqoff();
6758 6773
6759 /* L1D Flush includes CPU buffer clear to mitigate MDS */6774 /* L1D Flush includes CPU buffer clear to mitigate MDS */
6760 if (static_branch_unlikely(&vmx_l1d_should_flush))6775 if (static_branch_unlikely(&vmx_l1d_should_flush))
@@ -6770,7 +6785,7 @@ static noinstr void vmx_vcpu_enter_exit(struct kvm_vcpu *vcpu, · 9 unmodified lines
6770 6785
6771 vcpu->arch.cr2 = native_read_cr2();6786 vcpu->arch.cr2 = native_read_cr2();
6772 6787
6773 kvm_guest_exit_irqoff();6788 guest_state_exit_irqoff();
6774}6789}
6775 6790
6776static fastpath_t vmx_vcpu_run(struct kvm_vcpu *vcpu)6791static fastpath_t vmx_vcpu_run(struct kvm_vcpu *vcpu)
@@ -7768,7 +7783,7 @@ static struct kvm_x86_ops vmx_x86_ops __initdata = { · 991 unmodified lines
7768 .hwapic_isr_update = vmx_hwapic_isr_update,7783 .hwapic_isr_update = vmx_hwapic_isr_update,
7769 .guest_apic_has_interrupt = vmx_guest_apic_has_interrupt,7784 .guest_apic_has_interrupt = vmx_guest_apic_has_interrupt,
7770 .sync_pir_to_irr = vmx_sync_pir_to_irr,7785 .sync_pir_to_irr = vmx_sync_pir_to_irr,
7771 .deliver_posted_interrupt = vmx_deliver_posted_interrupt,7786 .deliver_interrupt = vmx_deliver_interrupt,
7772 .dy_apicv_has_pending_interrupt = pi_has_pending_interrupt,7787 .dy_apicv_has_pending_interrupt = pi_has_pending_interrupt,
7773 7788
7774 .set_tss_addr = vmx_set_tss_addr,7789 .set_tss_addr = vmx_set_tss_addr,
arch/x86/kvm/x86.c+6−4
@@ -90,6 +90,8 @@ · 89 unmodified lines
90u64 __read_mostly kvm_mce_cap_supported = MCG_CTL_P | MCG_SER_P;90u64 __read_mostly kvm_mce_cap_supported = MCG_CTL_P | MCG_SER_P;
91EXPORT_SYMBOL_GPL(kvm_mce_cap_supported);91EXPORT_SYMBOL_GPL(kvm_mce_cap_supported);
92 92
93#define ERR_PTR_USR(e) ((void __user *)ERR_PTR(e))
94
93#define emul_to_vcpu(ctxt) \95#define emul_to_vcpu(ctxt) \
94 ((struct kvm_vcpu *)(ctxt)->vcpu)96 ((struct kvm_vcpu *)(ctxt)->vcpu)
95 97
@@ -4340,7 +4342,7 @@ static inline void __user *kvm_get_attr_addr(struct kvm_device_attr *attr) · 4244 unmodified lines
4340 void __user *uaddr = (void __user*)(unsigned long)attr->addr;4342 void __user *uaddr = (void __user*)(unsigned long)attr->addr;
4341 4343
4342 if ((u64)(unsigned long)uaddr != attr->addr)4344 if ((u64)(unsigned long)uaddr != attr->addr)
4343 return ERR_PTR(-EFAULT);4345 return ERR_PTR_USR(-EFAULT);
4344 return uaddr;4346 return uaddr;
4345}4347}
4346 4348
@@ -10041,6 +10043,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) · 5694 unmodified lines
10041 set_debugreg(0, 7);10043 set_debugreg(0, 7);
10042 }10044 }
10043 10045
10046 guest_timing_enter_irqoff();
10047
10044 for (;;) {10048 for (;;) {
10045 /*10049 /*
10046 * Assert that vCPU vs. VM APICv state is consistent. An APICv10050 * Assert that vCPU vs. VM APICv state is consistent. An APICv
@@ -10125,7 +10129,7 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) · 78 unmodified lines
10125 * of accounting via context tracking, but the loss of accuracy is10129 * of accounting via context tracking, but the loss of accuracy is
10126 * acceptable for all known use cases.10130 * acceptable for all known use cases.
10127 */10131 */
10128 vtime_account_guest_exit();10132 guest_timing_exit_irqoff();
10129 10133
10130 if (lapic_in_kernel(vcpu)) {10134 if (lapic_in_kernel(vcpu)) {
10131 s64 delta = vcpu->arch.apic->lapic_timer.advance_expire_delta;10135 s64 delta = vcpu->arch.apic->lapic_timer.advance_expire_delta;
@@ -11639,8 +11643,6 @@ void kvm_arch_sync_events(struct kvm *kvm) · 1507 unmodified lines
11639 kvm_free_pit(kvm);11643 kvm_free_pit(kvm);
11640}11644}
11641 11645
11642#define ERR_PTR_USR(e) ((void __user *)ERR_PTR(e))
11643
11644/**11646/**
11645 * __x86_set_memory_region: Setup KVM internal memory slot11647 * __x86_set_memory_region: Setup KVM internal memory slot
11646 *11648 *
arch/x86/kvm/x86.h+0−45
@@ -10,51 +10,6 @@ · 9 unmodified lines
10 10
11void kvm_spurious_fault(void);11void kvm_spurious_fault(void);
12 12
13static __always_inline void kvm_guest_enter_irqoff(void)
14{
15 /*
16 * VMENTER enables interrupts (host state), but the kernel state is
17 * interrupts disabled when this is invoked. Also tell RCU about
18 * it. This is the same logic as for exit_to_user_mode().
19 *
20 * This ensures that e.g. latency analysis on the host observes
21 * guest mode as interrupt enabled.
22 *
23 * guest_enter_irqoff() informs context tracking about the
24 * transition to guest mode and if enabled adjusts RCU state
25 * accordingly.
26 */
27 instrumentation_begin();
28 trace_hardirqs_on_prepare();
29 lockdep_hardirqs_on_prepare(CALLER_ADDR0);
30 instrumentation_end();
31
32 guest_enter_irqoff();
33 lockdep_hardirqs_on(CALLER_ADDR0);
34}
35
36static __always_inline void kvm_guest_exit_irqoff(void)
37{
38 /*
39 * VMEXIT disables interrupts (host state), but tracing and lockdep
40 * have them in state 'on' as recorded before entering guest mode.
41 * Same as enter_from_user_mode().
42 *
43 * context_tracking_guest_exit() restores host context and reinstates
44 * RCU if enabled and required.
45 *
46 * This needs to be done immediately after VM-Exit, before any code
47 * that might contain tracepoints or call out to the greater world,
48 * e.g. before x86_spec_ctrl_restore_host().
49 */
50 lockdep_hardirqs_off(CALLER_ADDR0);
51 context_tracking_guest_exit();
52
53 instrumentation_begin();
54 trace_hardirqs_off_finish();
55 instrumentation_end();
56}
57
58#define KVM_NESTED_VMENTER_CONSISTENCY_CHECK(consistency_check) \13#define KVM_NESTED_VMENTER_CONSISTENCY_CHECK(consistency_check) \
59({ \14({ \
60 bool failed = (consistency_check); \15 bool failed = (consistency_check); \
arch/x86/xen/enlighten_hvm.c+4−9
@@ -9,6 +9,7 @@ · 8 unmodified lines
9#include <xen/events.h>9#include <xen/events.h>
10#include <xen/interface/memory.h>10#include <xen/interface/memory.h>
11 11
12#include <asm/apic.h>
12#include <asm/cpu.h>13#include <asm/cpu.h>
13#include <asm/smp.h>14#include <asm/smp.h>
14#include <asm/io_apic.h>15#include <asm/io_apic.h>
@@ -242,15 +243,9 @@ static __init int xen_parse_no_vector_callback(char *arg) · 227 unmodified lines
242}243}
243early_param("xen_no_vector_callback", xen_parse_no_vector_callback);244early_param("xen_no_vector_callback", xen_parse_no_vector_callback);
244 245
245bool __init xen_hvm_need_lapic(void)246static __init bool xen_x2apic_available(void)
246{247{
247 if (xen_pv_domain())248 return x2apic_supported();
248 return false;
249 if (!xen_hvm_domain())
250 return false;
251 if (xen_feature(XENFEAT_hvm_pirqs) && xen_have_vector_callback)
252 return false;
253 return true;
254}249}
255 250
256static __init void xen_hvm_guest_late_init(void)251static __init void xen_hvm_guest_late_init(void)
@@ -312,7 +307,7 @@ struct hypervisor_x86 x86_hyper_xen_hvm __initdata = { · 55 unmodified lines
312 .detect = xen_platform_hvm,307 .detect = xen_platform_hvm,
313 .type = X86_HYPER_XEN_HVM,308 .type = X86_HYPER_XEN_HVM,
314 .init.init_platform = xen_hvm_guest_init,309 .init.init_platform = xen_hvm_guest_init,
315 .init.x2apic_available = xen_x2apic_para_available,310 .init.x2apic_available = xen_x2apic_available,
316 .init.init_mem_mapping = xen_hvm_init_mem_mapping,311 .init.init_mem_mapping = xen_hvm_init_mem_mapping,
317 .init.guest_late_init = xen_hvm_guest_late_init,312 .init.guest_late_init = xen_hvm_guest_late_init,
318 .runtime.pin_vcpu = xen_pin_vcpu,313 .runtime.pin_vcpu = xen_pin_vcpu,
arch/x86/xen/enlighten_pv.c+0−4
@@ -1341,10 +1341,6 @@ asmlinkage __visible void __init xen_start_kernel(void) · 1340 unmodified lines
1341 1341
1342 xen_acpi_sleep_register();1342 xen_acpi_sleep_register();
1343 1343
1344 /* Avoid searching for BIOS MP tables */
1345 x86_init.mpparse.find_smp_config = x86_init_noop;
1346 x86_init.mpparse.get_smp_config = x86_init_uint_noop;
1347
1348 xen_boot_params_init_edd();1344 xen_boot_params_init_edd();
1349 1345
1350#ifdef CONFIG_ACPI1346#ifdef CONFIG_ACPI
arch/x86/xen/smp_pv.c+6−20
@@ -148,28 +148,12 @@ int xen_smp_intr_init_pv(unsigned int cpu) · 147 unmodified lines
148 return rc;148 return rc;
149}149}
150 150
151static void __init xen_fill_possible_map(void)151static void __init _get_smp_config(unsigned int early)
152{
153 int i, rc;
154
155 if (xen_initial_domain())
156 return;
157
158 for (i = 0; i < nr_cpu_ids; i++) {
159 rc = HYPERVISOR_vcpu_op(VCPUOP_is_up, i, NULL);
160 if (rc >= 0) {
161 num_processors++;
162 set_cpu_possible(i, true);
163 }
164 }
165}
166
167static void __init xen_filter_cpu_maps(void)
168{152{
169 int i, rc;153 int i, rc;
170 unsigned int subtract = 0;154 unsigned int subtract = 0;
171 155
172 if (!xen_initial_domain())156 if (early)
173 return;157 return;
174 158
175 num_processors = 0;159 num_processors = 0;
@@ -210,7 +194,6 @@ static void __init xen_pv_smp_prepare_boot_cpu(void) · 34 unmodified lines
210 * sure the old memory can be recycled. */194 * sure the old memory can be recycled. */
211 make_lowmem_page_readwrite(xen_initial_gdt);195 make_lowmem_page_readwrite(xen_initial_gdt);
212 196
213 xen_filter_cpu_maps();
214 xen_setup_vcpu_info_placement();197 xen_setup_vcpu_info_placement();
215 198
216 /*199 /*
@@ -476,5 +459,8 @@ static const struct smp_ops xen_smp_ops __initconst = { · 259 unmodified lines
476void __init xen_smp_init(void)459void __init xen_smp_init(void)
477{460{
478 smp_ops = xen_smp_ops;461 smp_ops = xen_smp_ops;
479 xen_fill_possible_map();462
463 /* Avoid searching for BIOS MP tables */
464 x86_init.mpparse.find_smp_config = x86_init_noop;
465 x86_init.mpparse.get_smp_config = _get_smp_config;
480}466}
block/bio-integrity.c+1−1
@@ -373,7 +373,7 @@ void bio_integrity_advance(struct bio *bio, unsigned int bytes_done) · 372 unmodified lines
373 struct blk_integrity *bi = blk_get_integrity(bio->bi_bdev->bd_disk);373 struct blk_integrity *bi = blk_get_integrity(bio->bi_bdev->bd_disk);
374 unsigned bytes = bio_integrity_bytes(bi, bytes_done >> 9);374 unsigned bytes = bio_integrity_bytes(bi, bytes_done >> 9);
375 375
376 bip->bip_iter.bi_sector += bytes_done >> 9;376 bip->bip_iter.bi_sector += bio_integrity_intervals(bi, bytes_done >> 9);
377 bvec_iter_advance(bip->bip_vec, &bip->bip_iter, bytes);377 bvec_iter_advance(bip->bip_vec, &bip->bip_iter, bytes);
378}378}
379 379
block/fops.c+19−14
@@ -566,34 +566,37 @@ static ssize_t blkdev_read_iter(struct kiocb *iocb, struct iov_iter *to) · 565 unmodified lines
566{566{
567 struct block_device *bdev = iocb->ki_filp->private_data;567 struct block_device *bdev = iocb->ki_filp->private_data;
568 loff_t size = bdev_nr_bytes(bdev);568 loff_t size = bdev_nr_bytes(bdev);
569 size_t count = iov_iter_count(to);
570 loff_t pos = iocb->ki_pos;569 loff_t pos = iocb->ki_pos;
571 size_t shorted = 0;570 size_t shorted = 0;
572 ssize_t ret = 0;571 ssize_t ret = 0;
572 size_t count;
573 573
574 if (unlikely(pos + count > size)) {574 if (unlikely(pos + iov_iter_count(to) > size)) {
575 if (pos >= size)575 if (pos >= size)
576 return 0;576 return 0;
577 size -= pos;577 size -= pos;
578 if (count > size) {578 shorted = iov_iter_count(to) - size;
579 shorted = count - size;579 iov_iter_truncate(to, size);
580 iov_iter_truncate(to, size);
581 }
582 }580 }
583 581
582 count = iov_iter_count(to);
583 if (!count)
584 goto reexpand; /* skip atime */
585
584 if (iocb->ki_flags & IOCB_DIRECT) {586 if (iocb->ki_flags & IOCB_DIRECT) {
585 struct address_space *mapping = iocb->ki_filp->f_mapping;587 struct address_space *mapping = iocb->ki_filp->f_mapping;
586 588
587 if (iocb->ki_flags & IOCB_NOWAIT) {589 if (iocb->ki_flags & IOCB_NOWAIT) {
588 if (filemap_range_needs_writeback(mapping, iocb->ki_pos,590 if (filemap_range_needs_writeback(mapping, pos,
589 iocb->ki_pos + count - 1))591 pos + count - 1)) {
590 return -EAGAIN;592 ret = -EAGAIN;
593 goto reexpand;
594 }
591 } else {595 } else {
592 ret = filemap_write_and_wait_range(mapping,596 ret = filemap_write_and_wait_range(mapping, pos,
593 iocb->ki_pos,597 pos + count - 1);
594 iocb->ki_pos + count - 1);
595 if (ret < 0)598 if (ret < 0)
596 return ret;599 goto reexpand;
597 }600 }
598 601
599 file_accessed(iocb->ki_filp);602 file_accessed(iocb->ki_filp);
@@ -603,12 +606,14 @@ static ssize_t blkdev_read_iter(struct kiocb *iocb, struct iov_iter *to) · 3 unmodified lines
603 iocb->ki_pos += ret;606 iocb->ki_pos += ret;
604 count -= ret;607 count -= ret;
605 }608 }
609 iov_iter_revert(to, count - iov_iter_count(to));
606 if (ret < 0 || !count)610 if (ret < 0 || !count)
607 return ret;611 goto reexpand;
608 }612 }
609 613
610 ret = filemap_read(iocb, to, ret);614 ret = filemap_read(iocb, to, ret);
611 615
616reexpand:
612 if (unlikely(shorted))617 if (unlikely(shorted))
613 iov_iter_reexpand(to, iov_iter_count(to) + shorted);618 iov_iter_reexpand(to, iov_iter_count(to) + shorted);
614 return ret;619 return ret;
crypto/blake2s_generic.c+2−2
@@ -15,12 +15,12 @@ · 14 unmodified lines
15static int crypto_blake2s_update_generic(struct shash_desc *desc,15static int crypto_blake2s_update_generic(struct shash_desc *desc,
16 const u8 *in, unsigned int inlen)16 const u8 *in, unsigned int inlen)
17{17{
18 return crypto_blake2s_update(desc, in, inlen, blake2s_compress_generic);18 return crypto_blake2s_update(desc, in, inlen, true);
19}19}
20 20
21static int crypto_blake2s_final_generic(struct shash_desc *desc, u8 *out)21static int crypto_blake2s_final_generic(struct shash_desc *desc, u8 *out)
22{22{
23 return crypto_blake2s_final(desc, out, blake2s_compress_generic);23 return crypto_blake2s_final(desc, out, true);
24}24}
25 25
26#define BLAKE2S_ALG(name, driver_name, digest_size) \26#define BLAKE2S_ALG(name, driver_name, digest_size) \
drivers/acpi/Kconfig+1−0
@@ -11,6 +11,7 @@ menuconfig ACPI · 10 unmodified lines
11 depends on ARCH_SUPPORTS_ACPI11 depends on ARCH_SUPPORTS_ACPI
12 select PNP12 select PNP
13 select NLS13 select NLS
14 select CRC32
14 default y if X8615 default y if X86
15 help16 help
16 Advanced Configuration and Power Interface (ACPI) support for 17 Advanced Configuration and Power Interface (ACPI) support for
drivers/ata/libata-core.c+10−0
@@ -2007,6 +2007,9 @@ static bool ata_log_supported(struct ata_device *dev, u8 log) · 2006 unmodified lines
2007{2007{
2008 struct ata_port *ap = dev->link->ap;2008 struct ata_port *ap = dev->link->ap;
2009 2009
2010 if (dev->horkage & ATA_HORKAGE_NO_LOG_DIR)
2011 return false;
2012
2010 if (ata_read_log_page(dev, ATA_LOG_DIRECTORY, 0, ap->sector_buf, 1))2013 if (ata_read_log_page(dev, ATA_LOG_DIRECTORY, 0, ap->sector_buf, 1))
2011 return false;2014 return false;
2012 return get_unaligned_le16(&ap->sector_buf[log * 2]) ? true : false;2015 return get_unaligned_le16(&ap->sector_buf[log * 2]) ? true : false;
@@ -4073,6 +4076,13 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { · 2060 unmodified lines
4073 { "WDC WD3000JD-*", NULL, ATA_HORKAGE_WD_BROKEN_LPM },4076 { "WDC WD3000JD-*", NULL, ATA_HORKAGE_WD_BROKEN_LPM },
4074 { "WDC WD3200JD-*", NULL, ATA_HORKAGE_WD_BROKEN_LPM },4077 { "WDC WD3200JD-*", NULL, ATA_HORKAGE_WD_BROKEN_LPM },
4075 4078
4079 /*
4080 * This sata dom device goes on a walkabout when the ATA_LOG_DIRECTORY
4081 * log page is accessed. Ensure we never ask for this log page with
4082 * these devices.
4083 */
4084 { "SATADOM-ML 3ME", NULL, ATA_HORKAGE_NO_LOG_DIR },
4085
4076 /* End Marker */4086 /* End Marker */
4077 { }4087 { }
4078};4088};
drivers/char/random.c+22−17
@@ -762,7 +762,7 @@ static bool crng_init_try_arch(struct crng_state *crng) · 761 unmodified lines
762 return arch_init;762 return arch_init;
763}763}
764 764
765static bool __init crng_init_try_arch_early(struct crng_state *crng)765static bool __init crng_init_try_arch_early(void)
766{766{
767 int i;767 int i;
768 bool arch_init = true;768 bool arch_init = true;
@@ -774,7 +774,7 @@ static bool __init crng_init_try_arch_early(struct crng_state *crng) · 5 unmodified lines
774 rv = random_get_entropy();774 rv = random_get_entropy();
775 arch_init = false;775 arch_init = false;
776 }776 }
777 crng->state[i] ^= rv;777 primary_crng.state[i] ^= rv;
778 }778 }
779 779
780 return arch_init;780 return arch_init;
@@ -788,22 +788,20 @@ static void crng_initialize_secondary(struct crng_state *crng) · 7 unmodified lines
788 crng->init_time = jiffies - CRNG_RESEED_INTERVAL - 1;788 crng->init_time = jiffies - CRNG_RESEED_INTERVAL - 1;
789}789}
790 790
791static void __init crng_initialize_primary(struct crng_state *crng)791static void __init crng_initialize_primary(void)
792{792{
793 _extract_entropy(&crng->state[4], sizeof(u32) * 12);793 _extract_entropy(&primary_crng.state[4], sizeof(u32) * 12);
794 if (crng_init_try_arch_early(crng) && trust_cpu && crng_init < 2) {794 if (crng_init_try_arch_early() && trust_cpu && crng_init < 2) {
795 invalidate_batched_entropy();795 invalidate_batched_entropy();
796 numa_crng_init();796 numa_crng_init();
797 crng_init = 2;797 crng_init = 2;
798 pr_notice("crng init done (trusting CPU's manufacturer)\n");798 pr_notice("crng init done (trusting CPU's manufacturer)\n");
799 }799 }
800 crng->init_time = jiffies - CRNG_RESEED_INTERVAL - 1;800 primary_crng.init_time = jiffies - CRNG_RESEED_INTERVAL - 1;
801}801}
802 802
803static void crng_finalize_init(struct crng_state *crng)803static void crng_finalize_init(void)
804{804{
805 if (crng != &primary_crng || crng_init >= 2)
806 return;
807 if (!system_wq) {805 if (!system_wq) {
808 /* We can't call numa_crng_init until we have workqueues,806 /* We can't call numa_crng_init until we have workqueues,
809 * so mark this for processing later. */807 * so mark this for processing later. */
@@ -814,6 +812,7 @@ static void crng_finalize_init(struct crng_state *crng) · 4 unmodified lines
814 invalidate_batched_entropy();812 invalidate_batched_entropy();
815 numa_crng_init();813 numa_crng_init();
816 crng_init = 2;814 crng_init = 2;
815 crng_need_final_init = false;
817 process_random_ready_list();816 process_random_ready_list();
818 wake_up_interruptible(&crng_init_wait);817 wake_up_interruptible(&crng_init_wait);
819 kill_fasync(&fasync, SIGIO, POLL_IN);818 kill_fasync(&fasync, SIGIO, POLL_IN);
@@ -980,7 +979,8 @@ static void crng_reseed(struct crng_state *crng, bool use_input_pool) · 160 unmodified lines
980 memzero_explicit(&buf, sizeof(buf));979 memzero_explicit(&buf, sizeof(buf));
981 WRITE_ONCE(crng->init_time, jiffies);980 WRITE_ONCE(crng->init_time, jiffies);
982 spin_unlock_irqrestore(&crng->lock, flags);981 spin_unlock_irqrestore(&crng->lock, flags);
983 crng_finalize_init(crng);982 if (crng == &primary_crng && crng_init < 2)
983 crng_finalize_init();
984}984}
985 985
986static void _extract_crng(struct crng_state *crng, u8 out[CHACHA_BLOCK_SIZE])986static void _extract_crng(struct crng_state *crng, u8 out[CHACHA_BLOCK_SIZE])
@@ -1697,8 +1697,8 @@ int __init rand_initialize(void) · 710 unmodified lines
1697{1697{
1698 init_std_data();1698 init_std_data();
1699 if (crng_need_final_init)1699 if (crng_need_final_init)
1700 crng_finalize_init(&primary_crng);1700 crng_finalize_init();
1701 crng_initialize_primary(&primary_crng);1701 crng_initialize_primary();
1702 crng_global_init_time = jiffies;1702 crng_global_init_time = jiffies;
1703 if (ratelimit_disable) {1703 if (ratelimit_disable) {
1704 urandom_warning.interval = 0;1704 urandom_warning.interval = 0;
@@ -1856,7 +1856,10 @@ static long random_ioctl(struct file *f, unsigned int cmd, unsigned long arg) · 151 unmodified lines
1856 */1856 */
1857 if (!capable(CAP_SYS_ADMIN))1857 if (!capable(CAP_SYS_ADMIN))
1858 return -EPERM;1858 return -EPERM;
1859 input_pool.entropy_count = 0;1859 if (xchg(&input_pool.entropy_count, 0) && random_write_wakeup_bits) {
1860 wake_up_interruptible(&random_write_wait);
1861 kill_fasync(&fasync, SIGIO, POLL_OUT);
1862 }
1860 return 0;1863 return 0;
1861 case RNDRESEEDCRNG:1864 case RNDRESEEDCRNG:
1862 if (!capable(CAP_SYS_ADMIN))1865 if (!capable(CAP_SYS_ADMIN))
@@ -2205,13 +2208,15 @@ void add_hwgenerator_randomness(const char *buffer, size_t count, · 342 unmodified lines
2205 return;2208 return;
2206 }2209 }
2207 2210
2208 /* Suspend writing if we're above the trickle threshold.2211 /* Throttle writing if we're above the trickle threshold.
2209 * We'll be woken up again once below random_write_wakeup_thresh,2212 * We'll be woken up again once below random_write_wakeup_thresh,
2210 * or when the calling thread is about to terminate.2213 * when the calling thread is about to terminate, or once
2214 * CRNG_RESEED_INTERVAL has lapsed.
2211 */2215 */
2212 wait_event_interruptible(random_write_wait,2216 wait_event_interruptible_timeout(random_write_wait,
2213 !system_wq || kthread_should_stop() ||2217 !system_wq || kthread_should_stop() ||
2214 POOL_ENTROPY_BITS() <= random_write_wakeup_bits);2218 POOL_ENTROPY_BITS() <= random_write_wakeup_bits,
2219 CRNG_RESEED_INTERVAL);
2215 mix_pool_bytes(buffer, count);2220 mix_pool_bytes(buffer, count);
2216 credit_entropy_bits(entropy);2221 credit_entropy_bits(entropy);
2217}2222}
drivers/dma-buf/dma-heap.c+2−0
@@ -14,6 +14,7 @@ · 13 unmodified lines
14#include <linux/xarray.h>14#include <linux/xarray.h>
15#include <linux/list.h>15#include <linux/list.h>
16#include <linux/slab.h>16#include <linux/slab.h>
17#include <linux/nospec.h>
17#include <linux/uaccess.h>18#include <linux/uaccess.h>
18#include <linux/syscalls.h>19#include <linux/syscalls.h>
19#include <linux/dma-heap.h>20#include <linux/dma-heap.h>
@@ -135,6 +136,7 @@ static long dma_heap_ioctl(struct file *file, unsigned int ucmd, · 115 unmodified lines
135 if (nr >= ARRAY_SIZE(dma_heap_ioctl_cmds))136 if (nr >= ARRAY_SIZE(dma_heap_ioctl_cmds))
136 return -EINVAL;137 return -EINVAL;
137 138
139 nr = array_index_nospec(nr, ARRAY_SIZE(dma_heap_ioctl_cmds));
138 /* Get the kernel ioctl cmd that matches */140 /* Get the kernel ioctl cmd that matches */
139 kcmd = dma_heap_ioctl_cmds[nr];141 kcmd = dma_heap_ioctl_cmds[nr];
140 142
drivers/gpu/drm/amd/amdgpu/amdgpu.h+8−2
@@ -1408,12 +1408,10 @@ int amdgpu_acpi_smart_shift_update(struct drm_device *dev, enum amdgpu_ss ss_sta · 1407 unmodified lines
1408int amdgpu_acpi_pcie_notify_device_ready(struct amdgpu_device *adev);1408int amdgpu_acpi_pcie_notify_device_ready(struct amdgpu_device *adev);
1409 1409
1410void amdgpu_acpi_get_backlight_caps(struct amdgpu_dm_backlight_caps *caps);1410void amdgpu_acpi_get_backlight_caps(struct amdgpu_dm_backlight_caps *caps);
1411bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev);
1412void amdgpu_acpi_detect(void);1411void amdgpu_acpi_detect(void);
1413#else1412#else
1414static inline int amdgpu_acpi_init(struct amdgpu_device *adev) { return 0; }1413static inline int amdgpu_acpi_init(struct amdgpu_device *adev) { return 0; }
1415static inline void amdgpu_acpi_fini(struct amdgpu_device *adev) { }1414static inline void amdgpu_acpi_fini(struct amdgpu_device *adev) { }
1416static inline bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev) { return false; }
1417static inline void amdgpu_acpi_detect(void) { }1415static inline void amdgpu_acpi_detect(void) { }
1418static inline bool amdgpu_acpi_is_power_shift_control_supported(void) { return false; }1416static inline bool amdgpu_acpi_is_power_shift_control_supported(void) { return false; }
1419static inline int amdgpu_acpi_power_shift_control(struct amdgpu_device *adev,1417static inline int amdgpu_acpi_power_shift_control(struct amdgpu_device *adev,
@@ -1422,6 +1420,14 @@ static inline int amdgpu_acpi_smart_shift_update(struct drm_device *dev, · 2 unmodified lines
1422 enum amdgpu_ss ss_state) { return 0; }1420 enum amdgpu_ss ss_state) { return 0; }
1423#endif1421#endif
1424 1422
1423#if defined(CONFIG_ACPI) && defined(CONFIG_SUSPEND)
1424bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev);
1425bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev);
1426#else
1427static inline bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev) { return false; }
1428static inline bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev) { return false; }
1429#endif
1430
1425int amdgpu_cs_find_mapping(struct amdgpu_cs_parser *parser,1431int amdgpu_cs_find_mapping(struct amdgpu_cs_parser *parser,
1426 uint64_t addr, struct amdgpu_bo **bo,1432 uint64_t addr, struct amdgpu_bo **bo,
1427 struct amdgpu_bo_va_mapping **mapping);1433 struct amdgpu_bo_va_mapping **mapping);
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c+32−5
@@ -1031,6 +1031,20 @@ void amdgpu_acpi_detect(void) · 1030 unmodified lines
1031 }1031 }
1032}1032}
1033 1033
1034#if IS_ENABLED(CONFIG_SUSPEND)
1035/**
1036 * amdgpu_acpi_is_s3_active
1037 *
1038 * @adev: amdgpu_device_pointer
1039 *
1040 * returns true if supported, false if not.
1041 */
1042bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev)
1043{
1044 return !(adev->flags & AMD_IS_APU) ||
1045 (pm_suspend_target_state == PM_SUSPEND_MEM);
1046}
1047
1034/**1048/**
1035 * amdgpu_acpi_is_s0ix_active1049 * amdgpu_acpi_is_s0ix_active
1036 *1050 *
@@ -1040,11 +1054,24 @@ void amdgpu_acpi_detect(void) · 3 unmodified lines
1040 */1054 */
1041bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)1055bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)
1042{1056{
1043#if IS_ENABLED(CONFIG_AMD_PMC) && IS_ENABLED(CONFIG_SUSPEND)1057 if (!(adev->flags & AMD_IS_APU) ||
1044 if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) {1058 (pm_suspend_target_state != PM_SUSPEND_TO_IDLE))
1045 if (adev->flags & AMD_IS_APU)1059 return false;
1046 return pm_suspend_target_state == PM_SUSPEND_TO_IDLE;1060
1061 if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)) {
1062 dev_warn_once(adev->dev,
1063 "Power consumption will be higher as BIOS has not been configured for suspend-to-idle.\n"
1064 "To use suspend-to-idle change the sleep mode in BIOS setup.\n");
1065 return false;
1047 }1066 }
1048#endif1067
1068#if !IS_ENABLED(CONFIG_AMD_PMC)
1069 dev_warn_once(adev->dev,
1070 "Power consumption will be higher as the kernel has not been compiled with CONFIG_AMD_PMC.\n");
1049 return false;1071 return false;
1072#else
1073 return true;
1074#endif /* CONFIG_AMD_PMC */
1050}1075}
1076
1077#endif /* CONFIG_SUSPEND */
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c+9−2
@@ -2246,13 +2246,20 @@ static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work) · 2245 unmodified lines
2246static int amdgpu_pmops_prepare(struct device *dev)2246static int amdgpu_pmops_prepare(struct device *dev)
2247{2247{
2248 struct drm_device *drm_dev = dev_get_drvdata(dev);2248 struct drm_device *drm_dev = dev_get_drvdata(dev);
2249 struct amdgpu_device *adev = drm_to_adev(drm_dev);
2249 2250
2250 /* Return a positive number here so2251 /* Return a positive number here so
2251 * DPM_FLAG_SMART_SUSPEND works properly2252 * DPM_FLAG_SMART_SUSPEND works properly
2252 */2253 */
2253 if (amdgpu_device_supports_boco(drm_dev))2254 if (amdgpu_device_supports_boco(drm_dev))
2254 return pm_runtime_suspended(dev) &&2255 return pm_runtime_suspended(dev);
2255 pm_suspend_via_firmware();2256
2257 /* if we will not support s3 or s2i for the device
2258 * then skip suspend
2259 */
2260 if (!amdgpu_acpi_is_s0ix_active(adev) &&
2261 !amdgpu_acpi_is_s3_active(adev))
2262 return 1;
2256 2263
2257 return 0;2264 return 0;
2258}2265}
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c+1−1
@@ -1904,7 +1904,7 @@ int amdgpu_copy_buffer(struct amdgpu_ring *ring, uint64_t src_offset, · 1903 unmodified lines
1904 unsigned i;1904 unsigned i;
1905 int r;1905 int r;
1906 1906
1907 if (direct_submit && !ring->sched.ready) {1907 if (!direct_submit && !ring->sched.ready) {
1908 DRM_ERROR("Trying to move memory with ring turned off.\n");1908 DRM_ERROR("Trying to move memory with ring turned off.\n");
1909 return -EINVAL;1909 return -EINVAL;
1910 }1910 }
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c+3−0
@@ -1140,6 +1140,9 @@ static void gmc_v10_0_get_clockgating_state(void *handle, u32 *flags) · 1139 unmodified lines
1140{1140{
1141 struct amdgpu_device *adev = (struct amdgpu_device *)handle;1141 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
1142 1142
1143 if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 1, 3))
1144 return;
1145
1143 adev->mmhub.funcs->get_clockgating(adev, flags);1146 adev->mmhub.funcs->get_clockgating(adev, flags);
1144 1147
1145 if (adev->ip_versions[ATHUB_HWIP][0] >= IP_VERSION(2, 1, 0))1148 if (adev->ip_versions[ATHUB_HWIP][0] >= IP_VERSION(2, 1, 0))
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn301/vg_clk_mgr.c+8−8
@@ -570,32 +570,32 @@ static struct wm_table lpddr5_wm_table = { · 569 unmodified lines
570 .wm_inst = WM_A,570 .wm_inst = WM_A,
571 .wm_type = WM_TYPE_PSTATE_CHG,571 .wm_type = WM_TYPE_PSTATE_CHG,
572 .pstate_latency_us = 11.65333,572 .pstate_latency_us = 11.65333,
573 .sr_exit_time_us = 7.95,573 .sr_exit_time_us = 13.5,
574 .sr_enter_plus_exit_time_us = 9,574 .sr_enter_plus_exit_time_us = 16.5,
575 .valid = true,575 .valid = true,
576 },576 },
577 {577 {
578 .wm_inst = WM_B,578 .wm_inst = WM_B,
579 .wm_type = WM_TYPE_PSTATE_CHG,579 .wm_type = WM_TYPE_PSTATE_CHG,
580 .pstate_latency_us = 11.65333,580 .pstate_latency_us = 11.65333,
581 .sr_exit_time_us = 9.82,581 .sr_exit_time_us = 13.5,
582 .sr_enter_plus_exit_time_us = 11.196,582 .sr_enter_plus_exit_time_us = 16.5,
583 .valid = true,583 .valid = true,
584 },584 },
585 {585 {
586 .wm_inst = WM_C,586 .wm_inst = WM_C,
587 .wm_type = WM_TYPE_PSTATE_CHG,587 .wm_type = WM_TYPE_PSTATE_CHG,
588 .pstate_latency_us = 11.65333,588 .pstate_latency_us = 11.65333,
589 .sr_exit_time_us = 9.89,589 .sr_exit_time_us = 13.5,
590 .sr_enter_plus_exit_time_us = 11.24,590 .sr_enter_plus_exit_time_us = 16.5,
591 .valid = true,591 .valid = true,
592 },592 },
593 {593 {
594 .wm_inst = WM_D,594 .wm_inst = WM_D,
595 .wm_type = WM_TYPE_PSTATE_CHG,595 .wm_type = WM_TYPE_PSTATE_CHG,
596 .pstate_latency_us = 11.65333,596 .pstate_latency_us = 11.65333,
597 .sr_exit_time_us = 9.748,597 .sr_exit_time_us = 13.5,
598 .sr_enter_plus_exit_time_us = 11.102,598 .sr_enter_plus_exit_time_us = 16.5,
599 .valid = true,599 .valid = true,
600 },600 },
601 }601 }
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_clk_mgr.c+10−10
@@ -329,38 +329,38 @@ static struct clk_bw_params dcn31_bw_params = { · 328 unmodified lines
329 329
330};330};
331 331
332static struct wm_table ddr4_wm_table = {332static struct wm_table ddr5_wm_table = {
333 .entries = {333 .entries = {
334 {334 {
335 .wm_inst = WM_A,335 .wm_inst = WM_A,
336 .wm_type = WM_TYPE_PSTATE_CHG,336 .wm_type = WM_TYPE_PSTATE_CHG,
337 .pstate_latency_us = 11.72,337 .pstate_latency_us = 11.72,
338 .sr_exit_time_us = 6.09,338 .sr_exit_time_us = 9,
339 .sr_enter_plus_exit_time_us = 7.14,339 .sr_enter_plus_exit_time_us = 11,
340 .valid = true,340 .valid = true,
341 },341 },
342 {342 {
343 .wm_inst = WM_B,343 .wm_inst = WM_B,
344 .wm_type = WM_TYPE_PSTATE_CHG,344 .wm_type = WM_TYPE_PSTATE_CHG,
345 .pstate_latency_us = 11.72,345 .pstate_latency_us = 11.72,
346 .sr_exit_time_us = 10.12,346 .sr_exit_time_us = 9,
347 .sr_enter_plus_exit_time_us = 11.48,347 .sr_enter_plus_exit_time_us = 11,
348 .valid = true,348 .valid = true,
349 },349 },
350 {350 {
351 .wm_inst = WM_C,351 .wm_inst = WM_C,
352 .wm_type = WM_TYPE_PSTATE_CHG,352 .wm_type = WM_TYPE_PSTATE_CHG,
353 .pstate_latency_us = 11.72,353 .pstate_latency_us = 11.72,
354 .sr_exit_time_us = 10.12,354 .sr_exit_time_us = 9,
355 .sr_enter_plus_exit_time_us = 11.48,355 .sr_enter_plus_exit_time_us = 11,
356 .valid = true,356 .valid = true,
357 },357 },
358 {358 {
359 .wm_inst = WM_D,359 .wm_inst = WM_D,
360 .wm_type = WM_TYPE_PSTATE_CHG,360 .wm_type = WM_TYPE_PSTATE_CHG,
361 .pstate_latency_us = 11.72,361 .pstate_latency_us = 11.72,
362 .sr_exit_time_us = 10.12,362 .sr_exit_time_us = 9,
363 .sr_enter_plus_exit_time_us = 11.48,363 .sr_enter_plus_exit_time_us = 11,
364 .valid = true,364 .valid = true,
365 },365 },
366 }366 }
@@ -687,7 +687,7 @@ void dcn31_clk_mgr_construct( · 320 unmodified lines
687 if (ctx->dc_bios->integrated_info->memory_type == LpDdr5MemType) {687 if (ctx->dc_bios->integrated_info->memory_type == LpDdr5MemType) {
688 dcn31_bw_params.wm_table = lpddr5_wm_table;688 dcn31_bw_params.wm_table = lpddr5_wm_table;
689 } else {689 } else {
690 dcn31_bw_params.wm_table = ddr4_wm_table;690 dcn31_bw_params.wm_table = ddr5_wm_table;
691 }691 }
692 /* Saved clocks configured at boot for debug purposes */692 /* Saved clocks configured at boot for debug purposes */
693 dcn31_dump_clk_registers(&clk_mgr->base.base.boot_snapshot, &clk_mgr->base.base, &log_info);693 dcn31_dump_clk_registers(&clk_mgr->base.base.boot_snapshot, &clk_mgr->base.base, &log_info);
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c+20−0
@@ -5597,6 +5597,26 @@ static bool retrieve_link_cap(struct dc_link *link) · 5596 unmodified lines
5597 dp_hw_fw_revision.ieee_fw_rev,5597 dp_hw_fw_revision.ieee_fw_rev,
5598 sizeof(dp_hw_fw_revision.ieee_fw_rev));5598 sizeof(dp_hw_fw_revision.ieee_fw_rev));
5599 5599
5600 /* Quirk for Apple MBP 2018 15" Retina panels: wrong DP_MAX_LINK_RATE */
5601 {
5602 uint8_t str_mbp_2018[] = { 101, 68, 21, 103, 98, 97 };
5603 uint8_t fwrev_mbp_2018[] = { 7, 4 };
5604 uint8_t fwrev_mbp_2018_vega[] = { 8, 4 };
5605
5606 /* We also check for the firmware revision as 16,1 models have an
5607 * identical device id and are incorrectly quirked otherwise.
5608 */
5609 if ((link->dpcd_caps.sink_dev_id == 0x0010fa) &&
5610 !memcmp(link->dpcd_caps.sink_dev_id_str, str_mbp_2018,
5611 sizeof(str_mbp_2018)) &&
5612 (!memcmp(link->dpcd_caps.sink_fw_revision, fwrev_mbp_2018,
5613 sizeof(fwrev_mbp_2018)) ||
5614 !memcmp(link->dpcd_caps.sink_fw_revision, fwrev_mbp_2018_vega,
5615 sizeof(fwrev_mbp_2018_vega)))) {
5616 link->reported_link_cap.link_rate = LINK_RATE_RBR2;
5617 }
5618 }
5619
5600 memset(&link->dpcd_caps.dsc_caps, '\0',5620 memset(&link->dpcd_caps.dsc_caps, '\0',
5601 sizeof(link->dpcd_caps.dsc_caps));5621 sizeof(link->dpcd_caps.dsc_caps));
5602 memset(&link->dpcd_caps.fec_cap, '\0', sizeof(link->dpcd_caps.fec_cap));5622 memset(&link->dpcd_caps.fec_cap, '\0', sizeof(link->dpcd_caps.fec_cap));
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c+0−5
@@ -1608,11 +1608,6 @@ static enum dc_status apply_single_controller_ctx_to_hw( · 1607 unmodified lines
1608 pipe_ctx->stream_res.stream_enc,1608 pipe_ctx->stream_res.stream_enc,
1609 pipe_ctx->stream_res.tg->inst);1609 pipe_ctx->stream_res.tg->inst);
1610 1610
1611 if (dc_is_embedded_signal(pipe_ctx->stream->signal) &&
1612 pipe_ctx->stream_res.stream_enc->funcs->reset_fifo)
1613 pipe_ctx->stream_res.stream_enc->funcs->reset_fifo(
1614 pipe_ctx->stream_res.stream_enc);
1615
1616 if (dc_is_dp_signal(pipe_ctx->stream->signal))1611 if (dc_is_dp_signal(pipe_ctx->stream->signal))
1617 dp_source_sequence_trace(link, DPCD_SOURCE_SEQ_AFTER_CONNECT_DIG_FE_OTG);1612 dp_source_sequence_trace(link, DPCD_SOURCE_SEQ_AFTER_CONNECT_DIG_FE_OTG);
1618 1613
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.c+0−15
@@ -902,19 +902,6 @@ void enc1_stream_encoder_stop_dp_info_packets( · 901 unmodified lines
902 902
903}903}
904 904
905void enc1_stream_encoder_reset_fifo(
906 struct stream_encoder *enc)
907{
908 struct dcn10_stream_encoder *enc1 = DCN10STRENC_FROM_STRENC(enc);
909
910 /* set DIG_START to 0x1 to reset FIFO */
911 REG_UPDATE(DIG_FE_CNTL, DIG_START, 1);
912 udelay(100);
913
914 /* write 0 to take the FIFO out of reset */
915 REG_UPDATE(DIG_FE_CNTL, DIG_START, 0);
916}
917
918void enc1_stream_encoder_dp_blank(905void enc1_stream_encoder_dp_blank(
919 struct dc_link *link,906 struct dc_link *link,
920 struct stream_encoder *enc)907 struct stream_encoder *enc)
@@ -1600,8 +1587,6 @@ static const struct stream_encoder_funcs dcn10_str_enc_funcs = { · 679 unmodified lines
1600 enc1_stream_encoder_send_immediate_sdp_message,1587 enc1_stream_encoder_send_immediate_sdp_message,
1601 .stop_dp_info_packets =1588 .stop_dp_info_packets =
1602 enc1_stream_encoder_stop_dp_info_packets,1589 enc1_stream_encoder_stop_dp_info_packets,
1603 .reset_fifo =
1604 enc1_stream_encoder_reset_fifo,
1605 .dp_blank =1590 .dp_blank =
1606 enc1_stream_encoder_dp_blank,1591 enc1_stream_encoder_dp_blank,
1607 .dp_unblank =1592 .dp_unblank =
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.h+0−3
@@ -626,9 +626,6 @@ void enc1_stream_encoder_send_immediate_sdp_message( · 625 unmodified lines
626void enc1_stream_encoder_stop_dp_info_packets(626void enc1_stream_encoder_stop_dp_info_packets(
627 struct stream_encoder *enc);627 struct stream_encoder *enc);
628 628
629void enc1_stream_encoder_reset_fifo(
630 struct stream_encoder *enc);
631
632void enc1_stream_encoder_dp_blank(629void enc1_stream_encoder_dp_blank(
633 struct dc_link *link,630 struct dc_link *link,
634 struct stream_encoder *enc);631 struct stream_encoder *enc);
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_stream_encoder.c+0−2
@@ -593,8 +593,6 @@ static const struct stream_encoder_funcs dcn20_str_enc_funcs = { · 592 unmodified lines
593 enc1_stream_encoder_send_immediate_sdp_message,593 enc1_stream_encoder_send_immediate_sdp_message,
594 .stop_dp_info_packets =594 .stop_dp_info_packets =
595 enc1_stream_encoder_stop_dp_info_packets,595 enc1_stream_encoder_stop_dp_info_packets,
596 .reset_fifo =
597 enc1_stream_encoder_reset_fifo,
598 .dp_blank =596 .dp_blank =
599 enc1_stream_encoder_dp_blank,597 enc1_stream_encoder_dp_blank,
600 .dp_unblank =598 .dp_unblank =
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dio_stream_encoder.c+0−2
@@ -789,8 +789,6 @@ static const struct stream_encoder_funcs dcn30_str_enc_funcs = { · 788 unmodified lines
789 enc3_stream_encoder_update_dp_info_packets,789 enc3_stream_encoder_update_dp_info_packets,
790 .stop_dp_info_packets =790 .stop_dp_info_packets =
791 enc1_stream_encoder_stop_dp_info_packets,791 enc1_stream_encoder_stop_dp_info_packets,
792 .reset_fifo =
793 enc1_stream_encoder_reset_fifo,
794 .dp_blank =792 .dp_blank =
795 enc1_stream_encoder_dp_blank,793 enc1_stream_encoder_dp_blank,
796 .dp_unblank =794 .dp_unblank =
drivers/gpu/drm/amd/display/dc/inc/hw/stream_encoder.h+0−4
@@ -164,10 +164,6 @@ struct stream_encoder_funcs { · 163 unmodified lines
164 void (*stop_dp_info_packets)(164 void (*stop_dp_info_packets)(
165 struct stream_encoder *enc);165 struct stream_encoder *enc);
166 166
167 void (*reset_fifo)(
168 struct stream_encoder *enc
169 );
170
171 void (*dp_blank)(167 void (*dp_blank)(
172 struct dc_link *link,168 struct dc_link *link,
173 struct stream_encoder *enc);169 struct stream_encoder *enc);
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c+3−3
@@ -3696,14 +3696,14 @@ static ssize_t sienna_cichlid_get_gpu_metrics(struct smu_context *smu, · 3695 unmodified lines
3696 3696
3697static int sienna_cichlid_enable_mgpu_fan_boost(struct smu_context *smu)3697static int sienna_cichlid_enable_mgpu_fan_boost(struct smu_context *smu)
3698{3698{
3699 struct smu_table_context *table_context = &smu->smu_table;3699 uint16_t *mgpu_fan_boost_limit_rpm;
3700 PPTable_t *smc_pptable = table_context->driver_pptable;
3701 3700
3701 GET_PPTABLE_MEMBER(MGpuFanBoostLimitRpm, &mgpu_fan_boost_limit_rpm);
3702 /*3702 /*
3703 * Skip the MGpuFanBoost setting for those ASICs3703 * Skip the MGpuFanBoost setting for those ASICs
3704 * which do not support it3704 * which do not support it
3705 */3705 */
3706 if (!smc_pptable->MGpuFanBoostLimitRpm)3706 if (*mgpu_fan_boost_limit_rpm == 0)
3707 return 0;3707 return 0;
3708 3708
3709 return smu_cmn_send_smc_msg_with_param(smu,3709 return smu_cmn_send_smc_msg_with_param(smu,
drivers/gpu/drm/i915/display/intel_overlay.c+3−0
@@ -959,6 +959,9 @@ static int check_overlay_dst(struct intel_overlay *overlay, · 958 unmodified lines
959 const struct intel_crtc_state *pipe_config =959 const struct intel_crtc_state *pipe_config =
960 overlay->crtc->config;960 overlay->crtc->config;
961 961
962 if (rec->dst_height == 0 || rec->dst_width == 0)
963 return -EINVAL;
964
962 if (rec->dst_x < pipe_config->pipe_src_w &&965 if (rec->dst_x < pipe_config->pipe_src_w &&
963 rec->dst_x + rec->dst_width <= pipe_config->pipe_src_w &&966 rec->dst_x + rec->dst_width <= pipe_config->pipe_src_w &&
964 rec->dst_y < pipe_config->pipe_src_h &&967 rec->dst_y < pipe_config->pipe_src_h &&
drivers/gpu/drm/i915/display/intel_tc.c+2−1
@@ -345,10 +345,11 @@ static bool icl_tc_phy_status_complete(struct intel_digital_port *dig_port) · 344 unmodified lines
345static bool adl_tc_phy_status_complete(struct intel_digital_port *dig_port)345static bool adl_tc_phy_status_complete(struct intel_digital_port *dig_port)
346{346{
347 struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);347 struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
348 enum tc_port tc_port = intel_port_to_tc(i915, dig_port->base.port);
348 struct intel_uncore *uncore = &i915->uncore;349 struct intel_uncore *uncore = &i915->uncore;
349 u32 val;350 u32 val;
350 351
351 val = intel_uncore_read(uncore, TCSS_DDI_STATUS(dig_port->tc_phy_fia_idx));352 val = intel_uncore_read(uncore, TCSS_DDI_STATUS(tc_port));
352 if (val == 0xffffffff) {353 if (val == 0xffffffff) {
353 drm_dbg_kms(&i915->drm,354 drm_dbg_kms(&i915->drm,
354 "Port %s: PHY in TCCOLD, assuming not complete\n",355 "Port %s: PHY in TCCOLD, assuming not complete\n",
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c+7−2
@@ -2505,9 +2505,14 @@ static int eb_pin_timeline(struct i915_execbuffer *eb, struct intel_context *ce, · 2504 unmodified lines
2505 timeout) < 0) {2505 timeout) < 0) {
2506 i915_request_put(rq);2506 i915_request_put(rq);
2507 2507
2508 tl = intel_context_timeline_lock(ce);2508 /*
2509 * Error path, cannot use intel_context_timeline_lock as
2510 * that is user interruptable and this clean up step
2511 * must be done.
2512 */
2513 mutex_lock(&ce->timeline->mutex);
2509 intel_context_exit(ce);2514 intel_context_exit(ce);
2510 intel_context_timeline_unlock(tl);2515 mutex_unlock(&ce->timeline->mutex);
2511 2516
2512 if (nonblock)2517 if (nonblock)
2513 return -EWOULDBLOCK;2518 return -EWOULDBLOCK;
drivers/gpu/drm/i915/gt/uc/intel_guc.h+5−0
@@ -206,6 +206,11 @@ struct intel_guc { · 205 unmodified lines
206 * context usage for overflows.206 * context usage for overflows.
207 */207 */
208 struct delayed_work work;208 struct delayed_work work;
209
210 /**
211 * @shift: Right shift value for the gpm timestamp
212 */
213 u32 shift;
209 } timestamp;214 } timestamp;
210 215
211#ifdef CONFIG_DRM_I915_SELFTEST216#ifdef CONFIG_DRM_I915_SELFTEST
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c+97−17
@@ -1113,6 +1113,19 @@ __extend_last_switch(struct intel_guc *guc, u64 *prev_start, u32 new_start) · 1112 unmodified lines
1113 if (new_start == lower_32_bits(*prev_start))1113 if (new_start == lower_32_bits(*prev_start))
1114 return;1114 return;
1115 1115
1116 /*
1117 * When gt is unparked, we update the gt timestamp and start the ping
1118 * worker that updates the gt_stamp every POLL_TIME_CLKS. As long as gt
1119 * is unparked, all switched in contexts will have a start time that is
1120 * within +/- POLL_TIME_CLKS of the most recent gt_stamp.
1121 *
1122 * If neither gt_stamp nor new_start has rolled over, then the
1123 * gt_stamp_hi does not need to be adjusted, however if one of them has
1124 * rolled over, we need to adjust gt_stamp_hi accordingly.
1125 *
1126 * The below conditions address the cases of new_start rollover and
1127 * gt_stamp_last rollover respectively.
1128 */
1116 if (new_start < gt_stamp_last &&1129 if (new_start < gt_stamp_last &&
1117 (new_start - gt_stamp_last) <= POLL_TIME_CLKS)1130 (new_start - gt_stamp_last) <= POLL_TIME_CLKS)
1118 gt_stamp_hi++;1131 gt_stamp_hi++;
@@ -1124,17 +1137,45 @@ __extend_last_switch(struct intel_guc *guc, u64 *prev_start, u32 new_start) · 5 unmodified lines
1124 *prev_start = ((u64)gt_stamp_hi << 32) | new_start;1137 *prev_start = ((u64)gt_stamp_hi << 32) | new_start;
1125}1138}
1126 1139
1127static void guc_update_engine_gt_clks(struct intel_engine_cs *engine)1140/*
1141 * GuC updates shared memory and KMD reads it. Since this is not synchronized,
1142 * we run into a race where the value read is inconsistent. Sometimes the
1143 * inconsistency is in reading the upper MSB bytes of the last_in value when
1144 * this race occurs. 2 types of cases are seen - upper 8 bits are zero and upper
1145 * 24 bits are zero. Since these are non-zero values, it is non-trivial to
1146 * determine validity of these values. Instead we read the values multiple times
1147 * until they are consistent. In test runs, 3 attempts results in consistent
1148 * values. The upper bound is set to 6 attempts and may need to be tuned as per
1149 * any new occurences.
1150 */
1151static void __get_engine_usage_record(struct intel_engine_cs *engine,
1152 u32 *last_in, u32 *id, u32 *total)
1128{1153{
1129 struct guc_engine_usage_record *rec = intel_guc_engine_usage(engine);1154 struct guc_engine_usage_record *rec = intel_guc_engine_usage(engine);
1155 int i = 0;
1156
1157 do {
1158 *last_in = READ_ONCE(rec->last_switch_in_stamp);
1159 *id = READ_ONCE(rec->current_context_index);
1160 *total = READ_ONCE(rec->total_runtime);
1161
1162 if (READ_ONCE(rec->last_switch_in_stamp) == *last_in &&
1163 READ_ONCE(rec->current_context_index) == *id &&
1164 READ_ONCE(rec->total_runtime) == *total)
1165 break;
1166 } while (++i < 6);
1167}
1168
1169static void guc_update_engine_gt_clks(struct intel_engine_cs *engine)
1170{
1130 struct intel_engine_guc_stats *stats = &engine->stats.guc;1171 struct intel_engine_guc_stats *stats = &engine->stats.guc;
1131 struct intel_guc *guc = &engine->gt->uc.guc;1172 struct intel_guc *guc = &engine->gt->uc.guc;
1132 u32 last_switch = rec->last_switch_in_stamp;1173 u32 last_switch, ctx_id, total;
1133 u32 ctx_id = rec->current_context_index;
1134 u32 total = rec->total_runtime;
1135 1174
1136 lockdep_assert_held(&guc->timestamp.lock);1175 lockdep_assert_held(&guc->timestamp.lock);
1137 1176
1177 __get_engine_usage_record(engine, &last_switch, &ctx_id, &total);
1178
1138 stats->running = ctx_id != ~0U && last_switch;1179 stats->running = ctx_id != ~0U && last_switch;
1139 if (stats->running)1180 if (stats->running)
1140 __extend_last_switch(guc, &stats->start_gt_clk, last_switch);1181 __extend_last_switch(guc, &stats->start_gt_clk, last_switch);
@@ -1149,23 +1190,51 @@ static void guc_update_engine_gt_clks(struct intel_engine_cs *engine) · 8 unmodified lines
1149 }1190 }
1150}1191}
1151 1192
1152static void guc_update_pm_timestamp(struct intel_guc *guc,1193static u32 gpm_timestamp_shift(struct intel_gt *gt)
1153 struct intel_engine_cs *engine,1194{
1154 ktime_t *now)1195 intel_wakeref_t wakeref;
1196 u32 reg, shift;
1197
1198 with_intel_runtime_pm(gt->uncore->rpm, wakeref)
1199 reg = intel_uncore_read(gt->uncore, RPM_CONFIG0);
1200
1201 shift = (reg & GEN10_RPM_CONFIG0_CTC_SHIFT_PARAMETER_MASK) >>
1202 GEN10_RPM_CONFIG0_CTC_SHIFT_PARAMETER_SHIFT;
1203
1204 return 3 - shift;
1205}
1206
1207static u64 gpm_timestamp(struct intel_gt *gt)
1208{
1209 u32 lo, hi, old_hi, loop = 0;
1210
1211 hi = intel_uncore_read(gt->uncore, MISC_STATUS1);
1212 do {
1213 lo = intel_uncore_read(gt->uncore, MISC_STATUS0);
1214 old_hi = hi;
1215 hi = intel_uncore_read(gt->uncore, MISC_STATUS1);
1216 } while (old_hi != hi && loop++ < 2);
1217
1218 return ((u64)hi << 32) | lo;
1219}
1220
1221static void guc_update_pm_timestamp(struct intel_guc *guc, ktime_t *now)
1155{1222{
1156 u32 gt_stamp_now, gt_stamp_hi;1223 struct intel_gt *gt = guc_to_gt(guc);
1224 u32 gt_stamp_lo, gt_stamp_hi;
1225 u64 gpm_ts;
1157 1226
1158 lockdep_assert_held(&guc->timestamp.lock);1227 lockdep_assert_held(&guc->timestamp.lock);
1159 1228
1160 gt_stamp_hi = upper_32_bits(guc->timestamp.gt_stamp);1229 gt_stamp_hi = upper_32_bits(guc->timestamp.gt_stamp);
1161 gt_stamp_now = intel_uncore_read(engine->uncore,1230 gpm_ts = gpm_timestamp(gt) >> guc->timestamp.shift;
1162 RING_TIMESTAMP(engine->mmio_base));1231 gt_stamp_lo = lower_32_bits(gpm_ts);
1163 *now = ktime_get();1232 *now = ktime_get();
1164 1233
1165 if (gt_stamp_now < lower_32_bits(guc->timestamp.gt_stamp))1234 if (gt_stamp_lo < lower_32_bits(guc->timestamp.gt_stamp))
1166 gt_stamp_hi++;1235 gt_stamp_hi++;
1167 1236
1168 guc->timestamp.gt_stamp = ((u64)gt_stamp_hi << 32) | gt_stamp_now;1237 guc->timestamp.gt_stamp = ((u64)gt_stamp_hi << 32) | gt_stamp_lo;
1169}1238}
1170 1239
1171/*1240/*
@@ -1208,8 +1277,12 @@ static ktime_t guc_engine_busyness(struct intel_engine_cs *engine, ktime_t *now) · 36 unmodified lines
1208 if (!in_reset && intel_gt_pm_get_if_awake(gt)) {1277 if (!in_reset && intel_gt_pm_get_if_awake(gt)) {
1209 stats_saved = *stats;1278 stats_saved = *stats;
1210 gt_stamp_saved = guc->timestamp.gt_stamp;1279 gt_stamp_saved = guc->timestamp.gt_stamp;
1280 /*
1281 * Update gt_clks, then gt timestamp to simplify the 'gt_stamp -
1282 * start_gt_clk' calculation below for active engines.
1283 */
1211 guc_update_engine_gt_clks(engine);1284 guc_update_engine_gt_clks(engine);
1212 guc_update_pm_timestamp(guc, engine, now);1285 guc_update_pm_timestamp(guc, now);
1213 intel_gt_pm_put_async(gt);1286 intel_gt_pm_put_async(gt);
1214 if (i915_reset_count(gpu_error) != reset_count) {1287 if (i915_reset_count(gpu_error) != reset_count) {
1215 *stats = stats_saved;1288 *stats = stats_saved;
@@ -1241,8 +1314,8 @@ static void __reset_guc_busyness_stats(struct intel_guc *guc) · 25 unmodified lines
1241 1314
1242 spin_lock_irqsave(&guc->timestamp.lock, flags);1315 spin_lock_irqsave(&guc->timestamp.lock, flags);
1243 1316
1317 guc_update_pm_timestamp(guc, &unused);
1244 for_each_engine(engine, gt, id) {1318 for_each_engine(engine, gt, id) {
1245 guc_update_pm_timestamp(guc, engine, &unused);
1246 guc_update_engine_gt_clks(engine);1319 guc_update_engine_gt_clks(engine);
1247 engine->stats.guc.prev_total = 0;1320 engine->stats.guc.prev_total = 0;
1248 }1321 }
@@ -1259,10 +1332,11 @@ static void __update_guc_busyness_stats(struct intel_guc *guc) · 10 unmodified lines
1259 ktime_t unused;1332 ktime_t unused;
1260 1333
1261 spin_lock_irqsave(&guc->timestamp.lock, flags);1334 spin_lock_irqsave(&guc->timestamp.lock, flags);
1262 for_each_engine(engine, gt, id) {1335
1263 guc_update_pm_timestamp(guc, engine, &unused);1336 guc_update_pm_timestamp(guc, &unused);
1337 for_each_engine(engine, gt, id)
1264 guc_update_engine_gt_clks(engine);1338 guc_update_engine_gt_clks(engine);
1265 }1339
1266 spin_unlock_irqrestore(&guc->timestamp.lock, flags);1340 spin_unlock_irqrestore(&guc->timestamp.lock, flags);
1267}1341}
1268 1342
@@ -1335,10 +1409,15 @@ void intel_guc_busyness_park(struct intel_gt *gt) · 66 unmodified lines
1335void intel_guc_busyness_unpark(struct intel_gt *gt)1409void intel_guc_busyness_unpark(struct intel_gt *gt)
1336{1410{
1337 struct intel_guc *guc = &gt->uc.guc;1411 struct intel_guc *guc = &gt->uc.guc;
1412 unsigned long flags;
1413 ktime_t unused;
1338 1414
1339 if (!guc_submission_initialized(guc))1415 if (!guc_submission_initialized(guc))
1340 return;1416 return;
1341 1417
1418 spin_lock_irqsave(&guc->timestamp.lock, flags);
1419 guc_update_pm_timestamp(guc, &unused);
1420 spin_unlock_irqrestore(&guc->timestamp.lock, flags);
1342 mod_delayed_work(system_highpri_wq, &guc->timestamp.work,1421 mod_delayed_work(system_highpri_wq, &guc->timestamp.work,
1343 guc->timestamp.ping_delay);1422 guc->timestamp.ping_delay);
1344}1423}
@@ -1783,6 +1862,7 @@ int intel_guc_submission_init(struct intel_guc *guc) · 438 unmodified lines
1783 spin_lock_init(&guc->timestamp.lock);1862 spin_lock_init(&guc->timestamp.lock);
1784 INIT_DELAYED_WORK(&guc->timestamp.work, guc_timestamp_ping);1863 INIT_DELAYED_WORK(&guc->timestamp.work, guc_timestamp_ping);
1785 guc->timestamp.ping_delay = (POLL_TIME_CLKS / gt->clock_frequency + 1) * HZ;1864 guc->timestamp.ping_delay = (POLL_TIME_CLKS / gt->clock_frequency + 1) * HZ;
1865 guc->timestamp.shift = gpm_timestamp_shift(gt);
1786 1866
1787 return 0;1867 return 0;
1788}1868}
drivers/gpu/drm/i915/i915_gpu_error.c+1−1
@@ -1522,7 +1522,7 @@ capture_engine(struct intel_engine_cs *engine, · 1521 unmodified lines
1522 struct i915_request *rq = NULL;1522 struct i915_request *rq = NULL;
1523 unsigned long flags;1523 unsigned long flags;
1524 1524
1525 ee = intel_engine_coredump_alloc(engine, GFP_KERNEL);1525 ee = intel_engine_coredump_alloc(engine, ALLOW_FAIL);
1526 if (!ee)1526 if (!ee)
1527 return NULL;1527 return NULL;
1528 1528
drivers/gpu/drm/i915/i915_reg.h+2−1
@@ -2684,7 +2684,8 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg) · 2683 unmodified lines
2684#define RING_WAIT (1 << 11) /* gen3+, PRBx_CTL */2684#define RING_WAIT (1 << 11) /* gen3+, PRBx_CTL */
2685#define RING_WAIT_SEMAPHORE (1 << 10) /* gen6+ */2685#define RING_WAIT_SEMAPHORE (1 << 10) /* gen6+ */
2686 2686
2687#define GUCPMTIMESTAMP _MMIO(0xC3E8)2687#define MISC_STATUS0 _MMIO(0xA500)
2688#define MISC_STATUS1 _MMIO(0xA504)
2688 2689
2689/* There are 16 64-bit CS General Purpose Registers per-engine on Gen8+ */2690/* There are 16 64-bit CS General Purpose Registers per-engine on Gen8+ */
2690#define GEN8_RING_CS_GPR(base, n) _MMIO((base) + 0x600 + (n) * 8)2691#define GEN8_RING_CS_GPR(base, n) _MMIO((base) + 0x600 + (n) * 8)
drivers/gpu/drm/kmb/kmb_plane.c+0−6
@@ -158,12 +158,6 @@ static void kmb_plane_atomic_disable(struct drm_plane *plane, · 157 unmodified lines
158 case LAYER_1:158 case LAYER_1:
159 kmb->plane_status[plane_id].ctrl = LCD_CTRL_VL2_ENABLE;159 kmb->plane_status[plane_id].ctrl = LCD_CTRL_VL2_ENABLE;
160 break;160 break;
161 case LAYER_2:
162 kmb->plane_status[plane_id].ctrl = LCD_CTRL_GL1_ENABLE;
163 break;
164 case LAYER_3:
165 kmb->plane_status[plane_id].ctrl = LCD_CTRL_GL2_ENABLE;
166 break;
167 }161 }
168 162
169 kmb->plane_status[plane_id].disable = true;163 kmb->plane_status[plane_id].disable = true;
drivers/gpu/drm/mxsfb/mxsfb_kms.c+5−1
@@ -361,7 +361,11 @@ static void mxsfb_crtc_atomic_enable(struct drm_crtc *crtc, · 360 unmodified lines
361 bridge_state =361 bridge_state =
362 drm_atomic_get_new_bridge_state(state,362 drm_atomic_get_new_bridge_state(state,
363 mxsfb->bridge);363 mxsfb->bridge);
364 bus_format = bridge_state->input_bus_cfg.format;364 if (!bridge_state)
365 bus_format = MEDIA_BUS_FMT_FIXED;
366 else
367 bus_format = bridge_state->input_bus_cfg.format;
368
365 if (bus_format == MEDIA_BUS_FMT_FIXED) {369 if (bus_format == MEDIA_BUS_FMT_FIXED) {
366 dev_warn_once(drm->dev,370 dev_warn_once(drm->dev,
367 "Bridge does not provide bus format, assuming MEDIA_BUS_FMT_RGB888_1X24.\n"371 "Bridge does not provide bus format, assuming MEDIA_BUS_FMT_RGB888_1X24.\n"
drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c+1−1
@@ -38,7 +38,7 @@ nvbios_addr(struct nvkm_bios *bios, u32 *addr, u8 size) · 37 unmodified lines
38 *addr += bios->imaged_addr;38 *addr += bios->imaged_addr;
39 }39 }
40 40
41 if (unlikely(*addr + size >= bios->size)) {41 if (unlikely(*addr + size > bios->size)) {
42 nvkm_error(&bios->subdev, "OOB %d %08x %08x\n", size, p, *addr);42 nvkm_error(&bios->subdev, "OOB %d %08x %08x\n", size, p, *addr);
43 return false;43 return false;
44 }44 }
drivers/infiniband/core/cm.c+1−1
@@ -3322,7 +3322,7 @@ static int cm_lap_handler(struct cm_work *work) · 3321 unmodified lines
3322 ret = cm_init_av_by_path(param->alternate_path, NULL, &alt_av);3322 ret = cm_init_av_by_path(param->alternate_path, NULL, &alt_av);
3323 if (ret) {3323 if (ret) {
3324 rdma_destroy_ah_attr(&ah_attr);3324 rdma_destroy_ah_attr(&ah_attr);
3325 return -EINVAL;3325 goto deref;
3326 }3326 }
3327 3327
3328 spin_lock_irq(&cm_id_priv->lock);3328 spin_lock_irq(&cm_id_priv->lock);
drivers/infiniband/core/cma.c+12−10
@@ -67,8 +67,8 @@ static const char * const cma_events[] = { · 66 unmodified lines
67 [RDMA_CM_EVENT_TIMEWAIT_EXIT] = "timewait exit",67 [RDMA_CM_EVENT_TIMEWAIT_EXIT] = "timewait exit",
68};68};
69 69
70static void cma_set_mgid(struct rdma_id_private *id_priv, struct sockaddr *addr,70static void cma_iboe_set_mgid(struct sockaddr *addr, union ib_gid *mgid,
71 union ib_gid *mgid);71 enum ib_gid_type gid_type);
72 72
73const char *__attribute_const__ rdma_event_msg(enum rdma_cm_event_type event)73const char *__attribute_const__ rdma_event_msg(enum rdma_cm_event_type event)
74{74{
@@ -1846,17 +1846,19 @@ static void destroy_mc(struct rdma_id_private *id_priv, · 1771 unmodified lines
1846 if (dev_addr->bound_dev_if)1846 if (dev_addr->bound_dev_if)
1847 ndev = dev_get_by_index(dev_addr->net,1847 ndev = dev_get_by_index(dev_addr->net,
1848 dev_addr->bound_dev_if);1848 dev_addr->bound_dev_if);
1849 if (ndev) {1849 if (ndev && !send_only) {
1850 enum ib_gid_type gid_type;
1850 union ib_gid mgid;1851 union ib_gid mgid;
1851 1852
1852 cma_set_mgid(id_priv, (struct sockaddr *)&mc->addr,1853 gid_type = id_priv->cma_dev->default_gid_type
1853 &mgid);1854 [id_priv->id.port_num -
1854 1855 rdma_start_port(
1855 if (!send_only)1856 id_priv->cma_dev->device)];
1856 cma_igmp_send(ndev, &mgid, false);1857 cma_iboe_set_mgid((struct sockaddr *)&mc->addr, &mgid,
1857 1858 gid_type);
1858 dev_put(ndev);1859 cma_igmp_send(ndev, &mgid, false);
1859 }1860 }
1861 dev_put(ndev);
1860 1862
1861 cancel_work_sync(&mc->iboe_join.work);1863 cancel_work_sync(&mc->iboe_join.work);
1862 }1864 }
drivers/infiniband/core/ucma.c+23−11
@@ -95,6 +95,7 @@ struct ucma_context { · 94 unmodified lines
95 u64 uid;95 u64 uid;
96 96
97 struct list_head list;97 struct list_head list;
98 struct list_head mc_list;
98 struct work_struct close_work;99 struct work_struct close_work;
99};100};
100 101
@@ -105,6 +106,7 @@ struct ucma_multicast { · 4 unmodified lines
105 106
106 u64 uid;107 u64 uid;
107 u8 join_state;108 u8 join_state;
109 struct list_head list;
108 struct sockaddr_storage addr;110 struct sockaddr_storage addr;
109};111};
110 112
@@ -198,6 +200,7 @@ static struct ucma_context *ucma_alloc_ctx(struct ucma_file *file) · 87 unmodified lines
198 200
199 INIT_WORK(&ctx->close_work, ucma_close_id);201 INIT_WORK(&ctx->close_work, ucma_close_id);
200 init_completion(&ctx->comp);202 init_completion(&ctx->comp);
203 INIT_LIST_HEAD(&ctx->mc_list);
201 /* So list_del() will work if we don't do ucma_finish_ctx() */204 /* So list_del() will work if we don't do ucma_finish_ctx() */
202 INIT_LIST_HEAD(&ctx->list);205 INIT_LIST_HEAD(&ctx->list);
203 ctx->file = file;206 ctx->file = file;
@@ -484,19 +487,19 @@ err1: · 280 unmodified lines
484 487
485static void ucma_cleanup_multicast(struct ucma_context *ctx)488static void ucma_cleanup_multicast(struct ucma_context *ctx)
486{489{
487 struct ucma_multicast *mc;490 struct ucma_multicast *mc, *tmp;
488 unsigned long index;
489 491
490 xa_for_each(&multicast_table, index, mc) {492 xa_lock(&multicast_table);
491 if (mc->ctx != ctx)493 list_for_each_entry_safe(mc, tmp, &ctx->mc_list, list) {
492 continue;494 list_del(&mc->list);
493 /*495 /*
494 * At this point mc->ctx->ref is 0 so the mc cannot leave the496 * At this point mc->ctx->ref is 0 so the mc cannot leave the
495 * lock on the reader and this is enough serialization497 * lock on the reader and this is enough serialization
496 */498 */
497 xa_erase(&multicast_table, index);499 __xa_erase(&multicast_table, mc->id);
498 kfree(mc);500 kfree(mc);
499 }501 }
502 xa_unlock(&multicast_table);
500}503}
501 504
502static void ucma_cleanup_mc_events(struct ucma_multicast *mc)505static void ucma_cleanup_mc_events(struct ucma_multicast *mc)
@@ -1469,12 +1472,16 @@ static ssize_t ucma_process_join(struct ucma_file *file, · 966 unmodified lines
1469 mc->uid = cmd->uid;1472 mc->uid = cmd->uid;
1470 memcpy(&mc->addr, addr, cmd->addr_size);1473 memcpy(&mc->addr, addr, cmd->addr_size);
1471 1474
1472 if (xa_alloc(&multicast_table, &mc->id, NULL, xa_limit_32b,1475 xa_lock(&multicast_table);
1476 if (__xa_alloc(&multicast_table, &mc->id, NULL, xa_limit_32b,
1473 GFP_KERNEL)) {1477 GFP_KERNEL)) {
1474 ret = -ENOMEM;1478 ret = -ENOMEM;
1475 goto err_free_mc;1479 goto err_free_mc;
1476 }1480 }
1477 1481
1482 list_add_tail(&mc->list, &ctx->mc_list);
1483 xa_unlock(&multicast_table);
1484
1478 mutex_lock(&ctx->mutex);1485 mutex_lock(&ctx->mutex);
1479 ret = rdma_join_multicast(ctx->cm_id, (struct sockaddr *)&mc->addr,1486 ret = rdma_join_multicast(ctx->cm_id, (struct sockaddr *)&mc->addr,
1480 join_state, mc);1487 join_state, mc);
@@ -1500,8 +1507,11 @@ err_leave_multicast: · 19 unmodified lines
1500 mutex_unlock(&ctx->mutex);1507 mutex_unlock(&ctx->mutex);
1501 ucma_cleanup_mc_events(mc);1508 ucma_cleanup_mc_events(mc);
1502err_xa_erase:1509err_xa_erase:
1503 xa_erase(&multicast_table, mc->id);1510 xa_lock(&multicast_table);
1511 list_del(&mc->list);
1512 __xa_erase(&multicast_table, mc->id);
1504err_free_mc:1513err_free_mc:
1514 xa_unlock(&multicast_table);
1505 kfree(mc);1515 kfree(mc);
1506err_put_ctx:1516err_put_ctx:
1507 ucma_put_ctx(ctx);1517 ucma_put_ctx(ctx);
@@ -1569,15 +1579,17 @@ static ssize_t ucma_leave_multicast(struct ucma_file *file, · 61 unmodified lines
1569 mc = ERR_PTR(-EINVAL);1579 mc = ERR_PTR(-EINVAL);
1570 else if (!refcount_inc_not_zero(&mc->ctx->ref))1580 else if (!refcount_inc_not_zero(&mc->ctx->ref))
1571 mc = ERR_PTR(-ENXIO);1581 mc = ERR_PTR(-ENXIO);
1572 else
1573 __xa_erase(&multicast_table, mc->id);
1574 xa_unlock(&multicast_table);
1575 1582
1576 if (IS_ERR(mc)) {1583 if (IS_ERR(mc)) {
1584 xa_unlock(&multicast_table);
1577 ret = PTR_ERR(mc);1585 ret = PTR_ERR(mc);
1578 goto out;1586 goto out;
1579 }1587 }
1580 1588
1589 list_del(&mc->list);
1590 __xa_erase(&multicast_table, mc->id);
1591 xa_unlock(&multicast_table);
1592
1581 mutex_lock(&mc->ctx->mutex);1593 mutex_lock(&mc->ctx->mutex);
1582 rdma_leave_multicast(mc->ctx->cm_id, (struct sockaddr *) &mc->addr);1594 rdma_leave_multicast(mc->ctx->cm_id, (struct sockaddr *) &mc->addr);
1583 mutex_unlock(&mc->ctx->mutex);1595 mutex_unlock(&mc->ctx->mutex);
drivers/infiniband/hw/hfi1/ipoib.h+1−1
@@ -55,7 +55,7 @@ union hfi1_ipoib_flow { · 54 unmodified lines
55 */55 */
56struct ipoib_txreq {56struct ipoib_txreq {
57 struct sdma_txreq txreq;57 struct sdma_txreq txreq;
58 struct hfi1_sdma_header sdma_hdr;58 struct hfi1_sdma_header *sdma_hdr;
59 int sdma_status;59 int sdma_status;
60 int complete;60 int complete;
61 struct hfi1_ipoib_dev_priv *priv;61 struct hfi1_ipoib_dev_priv *priv;
drivers/infiniband/hw/hfi1/ipoib_main.c+15−12
@@ -22,26 +22,35 @@ static int hfi1_ipoib_dev_init(struct net_device *dev) · 21 unmodified lines
22 int ret;22 int ret;
23 23
24 dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);24 dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
25 if (!dev->tstats)
26 return -ENOMEM;
25 27
26 ret = priv->netdev_ops->ndo_init(dev);28 ret = priv->netdev_ops->ndo_init(dev);
27 if (ret)29 if (ret)
28 return ret;30 goto out_ret;
29 31
30 ret = hfi1_netdev_add_data(priv->dd,32 ret = hfi1_netdev_add_data(priv->dd,
31 qpn_from_mac(priv->netdev->dev_addr),33 qpn_from_mac(priv->netdev->dev_addr),
32 dev);34 dev);
33 if (ret < 0) {35 if (ret < 0) {
34 priv->netdev_ops->ndo_uninit(dev);36 priv->netdev_ops->ndo_uninit(dev);
35 return ret;37 goto out_ret;
36 }38 }
37 39
38 return 0;40 return 0;
41out_ret:
42 free_percpu(dev->tstats);
43 dev->tstats = NULL;
44 return ret;
39}45}
40 46
41static void hfi1_ipoib_dev_uninit(struct net_device *dev)47static void hfi1_ipoib_dev_uninit(struct net_device *dev)
42{48{
43 struct hfi1_ipoib_dev_priv *priv = hfi1_ipoib_priv(dev);49 struct hfi1_ipoib_dev_priv *priv = hfi1_ipoib_priv(dev);
44 50
51 free_percpu(dev->tstats);
52 dev->tstats = NULL;
53
45 hfi1_netdev_remove_data(priv->dd, qpn_from_mac(priv->netdev->dev_addr));54 hfi1_netdev_remove_data(priv->dd, qpn_from_mac(priv->netdev->dev_addr));
46 55
47 priv->netdev_ops->ndo_uninit(dev);56 priv->netdev_ops->ndo_uninit(dev);
@@ -166,12 +175,7 @@ static void hfi1_ipoib_netdev_dtor(struct net_device *dev) · 118 unmodified lines
166 hfi1_ipoib_rxq_deinit(priv->netdev);175 hfi1_ipoib_rxq_deinit(priv->netdev);
167 176
168 free_percpu(dev->tstats);177 free_percpu(dev->tstats);
169}178 dev->tstats = NULL;
170
171static void hfi1_ipoib_free_rdma_netdev(struct net_device *dev)
172{
173 hfi1_ipoib_netdev_dtor(dev);
174 free_netdev(dev);
175}179}
176 180
177static void hfi1_ipoib_set_id(struct net_device *dev, int id)181static void hfi1_ipoib_set_id(struct net_device *dev, int id)
@@ -211,24 +215,23 @@ static int hfi1_ipoib_setup_rn(struct ib_device *device, · 33 unmodified lines
211 priv->port_num = port_num;215 priv->port_num = port_num;
212 priv->netdev_ops = netdev->netdev_ops;216 priv->netdev_ops = netdev->netdev_ops;
213 217
214 netdev->netdev_ops = &hfi1_ipoib_netdev_ops;
215
216 ib_query_pkey(device, port_num, priv->pkey_index, &priv->pkey);218 ib_query_pkey(device, port_num, priv->pkey_index, &priv->pkey);
217 219
218 rc = hfi1_ipoib_txreq_init(priv);220 rc = hfi1_ipoib_txreq_init(priv);
219 if (rc) {221 if (rc) {
220 dd_dev_err(dd, "IPoIB netdev TX init - failed(%d)\n", rc);222 dd_dev_err(dd, "IPoIB netdev TX init - failed(%d)\n", rc);
221 hfi1_ipoib_free_rdma_netdev(netdev);
222 return rc;223 return rc;
223 }224 }
224 225
225 rc = hfi1_ipoib_rxq_init(netdev);226 rc = hfi1_ipoib_rxq_init(netdev);
226 if (rc) {227 if (rc) {
227 dd_dev_err(dd, "IPoIB netdev RX init - failed(%d)\n", rc);228 dd_dev_err(dd, "IPoIB netdev RX init - failed(%d)\n", rc);
228 hfi1_ipoib_free_rdma_netdev(netdev);229 hfi1_ipoib_txreq_deinit(priv);
229 return rc;230 return rc;
230 }231 }
231 232
233 netdev->netdev_ops = &hfi1_ipoib_netdev_ops;
234
232 netdev->priv_destructor = hfi1_ipoib_netdev_dtor;235 netdev->priv_destructor = hfi1_ipoib_netdev_dtor;
233 netdev->needs_free_netdev = true;236 netdev->needs_free_netdev = true;
234 237
drivers/infiniband/hw/hfi1/ipoib_tx.c+26−12
@@ -122,7 +122,7 @@ static void hfi1_ipoib_free_tx(struct ipoib_txreq *tx, int budget) · 121 unmodified lines
122 dd_dev_warn(priv->dd,122 dd_dev_warn(priv->dd,
123 "%s: Status = 0x%x pbc 0x%llx txq = %d sde = %d\n",123 "%s: Status = 0x%x pbc 0x%llx txq = %d sde = %d\n",
124 __func__, tx->sdma_status,124 __func__, tx->sdma_status,
125 le64_to_cpu(tx->sdma_hdr.pbc), tx->txq->q_idx,125 le64_to_cpu(tx->sdma_hdr->pbc), tx->txq->q_idx,
126 tx->txq->sde->this_idx);126 tx->txq->sde->this_idx);
127 }127 }
128 128
@@ -231,7 +231,7 @@ static int hfi1_ipoib_build_tx_desc(struct ipoib_txreq *tx, · 102 unmodified lines
231{231{
232 struct hfi1_devdata *dd = txp->dd;232 struct hfi1_devdata *dd = txp->dd;
233 struct sdma_txreq *txreq = &tx->txreq;233 struct sdma_txreq *txreq = &tx->txreq;
234 struct hfi1_sdma_header *sdma_hdr = &tx->sdma_hdr;234 struct hfi1_sdma_header *sdma_hdr = tx->sdma_hdr;
235 u16 pkt_bytes =235 u16 pkt_bytes =
236 sizeof(sdma_hdr->pbc) + (txp->hdr_dwords << 2) + tx->skb->len;236 sizeof(sdma_hdr->pbc) + (txp->hdr_dwords << 2) + tx->skb->len;
237 int ret;237 int ret;
@@ -256,7 +256,7 @@ static void hfi1_ipoib_build_ib_tx_headers(struct ipoib_txreq *tx, · 18 unmodified lines
256 struct ipoib_txparms *txp)256 struct ipoib_txparms *txp)
257{257{
258 struct hfi1_ipoib_dev_priv *priv = tx->txq->priv;258 struct hfi1_ipoib_dev_priv *priv = tx->txq->priv;
259 struct hfi1_sdma_header *sdma_hdr = &tx->sdma_hdr;259 struct hfi1_sdma_header *sdma_hdr = tx->sdma_hdr;
260 struct sk_buff *skb = tx->skb;260 struct sk_buff *skb = tx->skb;
261 struct hfi1_pportdata *ppd = ppd_from_ibp(txp->ibp);261 struct hfi1_pportdata *ppd = ppd_from_ibp(txp->ibp);
262 struct rdma_ah_attr *ah_attr = txp->ah_attr;262 struct rdma_ah_attr *ah_attr = txp->ah_attr;
@@ -483,7 +483,7 @@ static int hfi1_ipoib_send_dma_single(struct net_device *dev, · 220 unmodified lines
483 if (likely(!ret)) {483 if (likely(!ret)) {
484tx_ok:484tx_ok:
485 trace_sdma_output_ibhdr(txq->priv->dd,485 trace_sdma_output_ibhdr(txq->priv->dd,
486 &tx->sdma_hdr.hdr,486 &tx->sdma_hdr->hdr,
487 ib_is_sc5(txp->flow.sc5));487 ib_is_sc5(txp->flow.sc5));
488 hfi1_ipoib_check_queue_depth(txq);488 hfi1_ipoib_check_queue_depth(txq);
489 return NETDEV_TX_OK;489 return NETDEV_TX_OK;
@@ -547,7 +547,7 @@ static int hfi1_ipoib_send_dma_list(struct net_device *dev, · 57 unmodified lines
547 hfi1_ipoib_check_queue_depth(txq);547 hfi1_ipoib_check_queue_depth(txq);
548 548
549 trace_sdma_output_ibhdr(txq->priv->dd,549 trace_sdma_output_ibhdr(txq->priv->dd,
550 &tx->sdma_hdr.hdr,550 &tx->sdma_hdr->hdr,
551 ib_is_sc5(txp->flow.sc5));551 ib_is_sc5(txp->flow.sc5));
552 552
553 if (!netdev_xmit_more())553 if (!netdev_xmit_more())
@@ -683,7 +683,8 @@ int hfi1_ipoib_txreq_init(struct hfi1_ipoib_dev_priv *priv) · 129 unmodified lines
683{683{
684 struct net_device *dev = priv->netdev;684 struct net_device *dev = priv->netdev;
685 u32 tx_ring_size, tx_item_size;685 u32 tx_ring_size, tx_item_size;
686 int i;686 struct hfi1_ipoib_circ_buf *tx_ring;
687 int i, j;
687 688
688 /*689 /*
689 * Ring holds 1 less than tx_ring_size690 * Ring holds 1 less than tx_ring_size
@@ -701,7 +702,9 @@ int hfi1_ipoib_txreq_init(struct hfi1_ipoib_dev_priv *priv) · 11 unmodified lines
701 702
702 for (i = 0; i < dev->num_tx_queues; i++) {703 for (i = 0; i < dev->num_tx_queues; i++) {
703 struct hfi1_ipoib_txq *txq = &priv->txqs[i];704 struct hfi1_ipoib_txq *txq = &priv->txqs[i];
705 struct ipoib_txreq *tx;
704 706
707 tx_ring = &txq->tx_ring;
705 iowait_init(&txq->wait,708 iowait_init(&txq->wait,
706 0,709 0,
707 hfi1_ipoib_flush_txq,710 hfi1_ipoib_flush_txq,
@@ -725,14 +728,19 @@ int hfi1_ipoib_txreq_init(struct hfi1_ipoib_dev_priv *priv) · 17 unmodified lines
725 priv->dd->node);728 priv->dd->node);
726 729
727 txq->tx_ring.items =730 txq->tx_ring.items =
728 kcalloc_node(tx_ring_size, tx_item_size,731 kvzalloc_node(array_size(tx_ring_size, tx_item_size),
729 GFP_KERNEL, priv->dd->node);732 GFP_KERNEL, priv->dd->node);
730 if (!txq->tx_ring.items)733 if (!txq->tx_ring.items)
731 goto free_txqs;734 goto free_txqs;
732 735
733 txq->tx_ring.max_items = tx_ring_size;736 txq->tx_ring.max_items = tx_ring_size;
734 txq->tx_ring.shift = ilog2(tx_ring_size);737 txq->tx_ring.shift = ilog2(tx_item_size);
735 txq->tx_ring.avail = hfi1_ipoib_ring_hwat(txq);738 txq->tx_ring.avail = hfi1_ipoib_ring_hwat(txq);
739 tx_ring = &txq->tx_ring;
740 for (j = 0; j < tx_ring_size; j++)
741 hfi1_txreq_from_idx(tx_ring, j)->sdma_hdr =
742 kzalloc_node(sizeof(*tx->sdma_hdr),
743 GFP_KERNEL, priv->dd->node);
736 744
737 netif_tx_napi_add(dev, &txq->napi,745 netif_tx_napi_add(dev, &txq->napi,
738 hfi1_ipoib_poll_tx_ring,746 hfi1_ipoib_poll_tx_ring,
@@ -746,7 +754,10 @@ free_txqs: · 7 unmodified lines
746 struct hfi1_ipoib_txq *txq = &priv->txqs[i];754 struct hfi1_ipoib_txq *txq = &priv->txqs[i];
747 755
748 netif_napi_del(&txq->napi);756 netif_napi_del(&txq->napi);
749 kfree(txq->tx_ring.items);757 tx_ring = &txq->tx_ring;
758 for (j = 0; j < tx_ring_size; j++)
759 kfree(hfi1_txreq_from_idx(tx_ring, j)->sdma_hdr);
760 kvfree(tx_ring->items);
750 }761 }
751 762
752 kfree(priv->txqs);763 kfree(priv->txqs);
@@ -780,17 +791,20 @@ static void hfi1_ipoib_drain_tx_list(struct hfi1_ipoib_txq *txq) · 27 unmodified lines
780 791
781void hfi1_ipoib_txreq_deinit(struct hfi1_ipoib_dev_priv *priv)792void hfi1_ipoib_txreq_deinit(struct hfi1_ipoib_dev_priv *priv)
782{793{
783 int i;794 int i, j;
784 795
785 for (i = 0; i < priv->netdev->num_tx_queues; i++) {796 for (i = 0; i < priv->netdev->num_tx_queues; i++) {
786 struct hfi1_ipoib_txq *txq = &priv->txqs[i];797 struct hfi1_ipoib_txq *txq = &priv->txqs[i];
798 struct hfi1_ipoib_circ_buf *tx_ring = &txq->tx_ring;
787 799
788 iowait_cancel_work(&txq->wait);800 iowait_cancel_work(&txq->wait);
789 iowait_sdma_drain(&txq->wait);801 iowait_sdma_drain(&txq->wait);
790 hfi1_ipoib_drain_tx_list(txq);802 hfi1_ipoib_drain_tx_list(txq);
791 netif_napi_del(&txq->napi);803 netif_napi_del(&txq->napi);
792 hfi1_ipoib_drain_tx_ring(txq);804 hfi1_ipoib_drain_tx_ring(txq);
793 kfree(txq->tx_ring.items);805 for (j = 0; j < tx_ring->max_items; j++)
806 kfree(hfi1_txreq_from_idx(tx_ring, j)->sdma_hdr);
807 kvfree(tx_ring->items);
794 }808 }
795 809
796 kfree(priv->txqs);810 kfree(priv->txqs);
drivers/infiniband/hw/mlx4/main.c+1−1
@@ -3237,7 +3237,7 @@ static void mlx4_ib_event(struct mlx4_dev *dev, void *ibdev_ptr, · 3236 unmodified lines
3237 case MLX4_DEV_EVENT_PORT_MGMT_CHANGE:3237 case MLX4_DEV_EVENT_PORT_MGMT_CHANGE:
3238 ew = kmalloc(sizeof *ew, GFP_ATOMIC);3238 ew = kmalloc(sizeof *ew, GFP_ATOMIC);
3239 if (!ew)3239 if (!ew)
3240 break;3240 return;
3241 3241
3242 INIT_WORK(&ew->work, handle_port_mgmt_change_event);3242 INIT_WORK(&ew->work, handle_port_mgmt_change_event);
3243 memcpy(&ew->ib_eqe, eqe, sizeof *eqe);3243 memcpy(&ew->ib_eqe, eqe, sizeof *eqe);
drivers/infiniband/sw/rdmavt/qp.c+2−0
@@ -3073,6 +3073,8 @@ do_write: · 3072 unmodified lines
3073 case IB_WR_ATOMIC_FETCH_AND_ADD:3073 case IB_WR_ATOMIC_FETCH_AND_ADD:
3074 if (unlikely(!(qp->qp_access_flags & IB_ACCESS_REMOTE_ATOMIC)))3074 if (unlikely(!(qp->qp_access_flags & IB_ACCESS_REMOTE_ATOMIC)))
3075 goto inv_err;3075 goto inv_err;
3076 if (unlikely(wqe->atomic_wr.remote_addr & (sizeof(u64) - 1)))
3077 goto inv_err;
3076 if (unlikely(!rvt_rkey_ok(qp, &qp->r_sge.sge, sizeof(u64),3078 if (unlikely(!rvt_rkey_ok(qp, &qp->r_sge.sge, sizeof(u64),
3077 wqe->atomic_wr.remote_addr,3079 wqe->atomic_wr.remote_addr,
3078 wqe->atomic_wr.rkey,3080 wqe->atomic_wr.rkey,
drivers/infiniband/sw/siw/siw.h+1−6
@@ -644,14 +644,9 @@ static inline struct siw_sqe *orq_get_current(struct siw_qp *qp) · 643 unmodified lines
644 return &qp->orq[qp->orq_get % qp->attrs.orq_size];644 return &qp->orq[qp->orq_get % qp->attrs.orq_size];
645}645}
646 646
647static inline struct siw_sqe *orq_get_tail(struct siw_qp *qp)
648{
649 return &qp->orq[qp->orq_put % qp->attrs.orq_size];
650}
651
652static inline struct siw_sqe *orq_get_free(struct siw_qp *qp)647static inline struct siw_sqe *orq_get_free(struct siw_qp *qp)
653{648{
654 struct siw_sqe *orq_e = orq_get_tail(qp);649 struct siw_sqe *orq_e = &qp->orq[qp->orq_put % qp->attrs.orq_size];
655 650
656 if (READ_ONCE(orq_e->flags) == 0)651 if (READ_ONCE(orq_e->flags) == 0)
657 return orq_e;652 return orq_e;
drivers/infiniband/sw/siw/siw_qp_rx.c+11−9
@@ -1153,11 +1153,12 @@ static int siw_check_tx_fence(struct siw_qp *qp) · 1152 unmodified lines
1153 1153
1154 spin_lock_irqsave(&qp->orq_lock, flags);1154 spin_lock_irqsave(&qp->orq_lock, flags);
1155 1155
1156 rreq = orq_get_current(qp);
1157
1158 /* free current orq entry */1156 /* free current orq entry */
1157 rreq = orq_get_current(qp);
1159 WRITE_ONCE(rreq->flags, 0);1158 WRITE_ONCE(rreq->flags, 0);
1160 1159
1160 qp->orq_get++;
1161
1161 if (qp->tx_ctx.orq_fence) {1162 if (qp->tx_ctx.orq_fence) {
1162 if (unlikely(tx_waiting->wr_status != SIW_WR_QUEUED)) {1163 if (unlikely(tx_waiting->wr_status != SIW_WR_QUEUED)) {
1163 pr_warn("siw: [QP %u]: fence resume: bad status %d\n",1164 pr_warn("siw: [QP %u]: fence resume: bad status %d\n",
@@ -1165,10 +1166,12 @@ static int siw_check_tx_fence(struct siw_qp *qp) · 1 unmodified line
1165 rv = -EPROTO;1166 rv = -EPROTO;
1166 goto out;1167 goto out;
1167 }1168 }
1168 /* resume SQ processing */1169 /* resume SQ processing, if possible */
1169 if (tx_waiting->sqe.opcode == SIW_OP_READ ||1170 if (tx_waiting->sqe.opcode == SIW_OP_READ ||
1170 tx_waiting->sqe.opcode == SIW_OP_READ_LOCAL_INV) {1171 tx_waiting->sqe.opcode == SIW_OP_READ_LOCAL_INV) {
1171 rreq = orq_get_tail(qp);1172
1173 /* SQ processing was stopped because of a full ORQ */
1174 rreq = orq_get_free(qp);
1172 if (unlikely(!rreq)) {1175 if (unlikely(!rreq)) {
1173 pr_warn("siw: [QP %u]: no ORQE\n", qp_id(qp));1176 pr_warn("siw: [QP %u]: no ORQE\n", qp_id(qp));
1174 rv = -EPROTO;1177 rv = -EPROTO;
@@ -1181,15 +1184,14 @@ static int siw_check_tx_fence(struct siw_qp *qp) · 6 unmodified lines
1181 resume_tx = 1;1184 resume_tx = 1;
1182 1185
1183 } else if (siw_orq_empty(qp)) {1186 } else if (siw_orq_empty(qp)) {
1187 /*
1188 * SQ processing was stopped by fenced work request.
1189 * Resume since all previous Read's are now completed.
1190 */
1184 qp->tx_ctx.orq_fence = 0;1191 qp->tx_ctx.orq_fence = 0;
1185 resume_tx = 1;1192 resume_tx = 1;
1186 } else {
1187 pr_warn("siw: [QP %u]: fence resume: orq idx: %d:%d\n",
1188 qp_id(qp), qp->orq_get, qp->orq_put);
1189 rv = -EPROTO;
1190 }1193 }
1191 }1194 }
1192 qp->orq_get++;
1193out:1195out:
1194 spin_unlock_irqrestore(&qp->orq_lock, flags);1196 spin_unlock_irqrestore(&qp->orq_lock, flags);
1195 1197
drivers/infiniband/sw/siw/siw_verbs.c+2−1
@@ -313,7 +313,8 @@ int siw_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *attrs, · 312 unmodified lines
313 313
314 if (atomic_inc_return(&sdev->num_qp) > SIW_MAX_QP) {314 if (atomic_inc_return(&sdev->num_qp) > SIW_MAX_QP) {
315 siw_dbg(base_dev, "too many QP's\n");315 siw_dbg(base_dev, "too many QP's\n");
316 return -ENOMEM;316 rv = -ENOMEM;
317 goto err_atomic;
317 }318 }
318 if (attrs->qp_type != IB_QPT_RC) {319 if (attrs->qp_type != IB_QPT_RC) {
319 siw_dbg(base_dev, "only RC QP's supported\n");320 siw_dbg(base_dev, "only RC QP's supported\n");
drivers/input/touchscreen/wm97xx-core.c+3−9
@@ -615,10 +615,9 @@ static int wm97xx_register_touch(struct wm97xx *wm) · 614 unmodified lines
615 * extensions)615 * extensions)
616 */616 */
617 wm->touch_dev = platform_device_alloc("wm97xx-touch", -1);617 wm->touch_dev = platform_device_alloc("wm97xx-touch", -1);
618 if (!wm->touch_dev) {618 if (!wm->touch_dev)
619 ret = -ENOMEM;619 return -ENOMEM;
620 goto touch_err;620
621 }
622 platform_set_drvdata(wm->touch_dev, wm);621 platform_set_drvdata(wm->touch_dev, wm);
623 wm->touch_dev->dev.parent = wm->dev;622 wm->touch_dev->dev.parent = wm->dev;
624 wm->touch_dev->dev.platform_data = pdata;623 wm->touch_dev->dev.platform_data = pdata;
@@ -629,9 +628,6 @@ static int wm97xx_register_touch(struct wm97xx *wm) · 4 unmodified lines
629 return 0;628 return 0;
630touch_reg_err:629touch_reg_err:
631 platform_device_put(wm->touch_dev);630 platform_device_put(wm->touch_dev);
632touch_err:
633 input_unregister_device(wm->input_dev);
634 wm->input_dev = NULL;
635 631
636 return ret;632 return ret;
637}633}
@@ -639,8 +635,6 @@ touch_err: · 1 unmodified line
639static void wm97xx_unregister_touch(struct wm97xx *wm)635static void wm97xx_unregister_touch(struct wm97xx *wm)
640{636{
641 platform_device_unregister(wm->touch_dev);637 platform_device_unregister(wm->touch_dev);
642 input_unregister_device(wm->input_dev);
643 wm->input_dev = NULL;
644}638}
645 639
646static int _wm97xx_probe(struct wm97xx *wm)640static int _wm97xx_probe(struct wm97xx *wm)
drivers/iommu/amd/init.c+2−0
@@ -21,6 +21,7 @@ · 20 unmodified lines
21#include <linux/export.h>21#include <linux/export.h>
22#include <linux/kmemleak.h>22#include <linux/kmemleak.h>
23#include <linux/cc_platform.h>23#include <linux/cc_platform.h>
24#include <linux/iopoll.h>
24#include <asm/pci-direct.h>25#include <asm/pci-direct.h>
25#include <asm/iommu.h>26#include <asm/iommu.h>
26#include <asm/apic.h>27#include <asm/apic.h>
@@ -834,6 +835,7 @@ static int iommu_ga_log_enable(struct amd_iommu *iommu) · 807 unmodified lines
834 status = readl(iommu->mmio_base + MMIO_STATUS_OFFSET);835 status = readl(iommu->mmio_base + MMIO_STATUS_OFFSET);
835 if (status & (MMIO_STATUS_GALOG_RUN_MASK))836 if (status & (MMIO_STATUS_GALOG_RUN_MASK))
836 break;837 break;
838 udelay(10);
837 }839 }
838 840
839 if (WARN_ON(i >= LOOP_TIMEOUT))841 if (WARN_ON(i >= LOOP_TIMEOUT))
drivers/iommu/intel/irq_remapping.c+10−3
@@ -569,9 +569,8 @@ static int intel_setup_irq_remapping(struct intel_iommu *iommu) · 568 unmodified lines
569 fn, &intel_ir_domain_ops,569 fn, &intel_ir_domain_ops,
570 iommu);570 iommu);
571 if (!iommu->ir_domain) {571 if (!iommu->ir_domain) {
572 irq_domain_free_fwnode(fn);
573 pr_err("IR%d: failed to allocate irqdomain\n", iommu->seq_id);572 pr_err("IR%d: failed to allocate irqdomain\n", iommu->seq_id);
574 goto out_free_bitmap;573 goto out_free_fwnode;
575 }574 }
576 iommu->ir_msi_domain =575 iommu->ir_msi_domain =
577 arch_create_remap_msi_irq_domain(iommu->ir_domain,576 arch_create_remap_msi_irq_domain(iommu->ir_domain,
@@ -595,7 +594,7 @@ static int intel_setup_irq_remapping(struct intel_iommu *iommu) · 17 unmodified lines
595 594
596 if (dmar_enable_qi(iommu)) {595 if (dmar_enable_qi(iommu)) {
597 pr_err("Failed to enable queued invalidation\n");596 pr_err("Failed to enable queued invalidation\n");
598 goto out_free_bitmap;597 goto out_free_ir_domain;
599 }598 }
600 }599 }
601 600
@@ -619,6 +618,14 @@ static int intel_setup_irq_remapping(struct intel_iommu *iommu) · 17 unmodified lines
619 618
620 return 0;619 return 0;
621 620
621out_free_ir_domain:
622 if (iommu->ir_msi_domain)
623 irq_domain_remove(iommu->ir_msi_domain);
624 iommu->ir_msi_domain = NULL;
625 irq_domain_remove(iommu->ir_domain);
626 iommu->ir_domain = NULL;
627out_free_fwnode:
628 irq_domain_free_fwnode(fn);
622out_free_bitmap:629out_free_bitmap:
623 bitmap_free(bitmap);630 bitmap_free(bitmap);
624out_free_pages:631out_free_pages:
drivers/iommu/ioasid.c+1−0
@@ -349,6 +349,7 @@ EXPORT_SYMBOL_GPL(ioasid_alloc); · 348 unmodified lines
349 349
350/**350/**
351 * ioasid_get - obtain a reference to the IOASID351 * ioasid_get - obtain a reference to the IOASID
352 * @ioasid: the ID to get
352 */353 */
353void ioasid_get(ioasid_t ioasid)354void ioasid_get(ioasid_t ioasid)
354{355{
drivers/iommu/iommu.c+19−14
@@ -207,9 +207,14 @@ static struct dev_iommu *dev_iommu_get(struct device *dev) · 206 unmodified lines
207 207
208static void dev_iommu_free(struct device *dev)208static void dev_iommu_free(struct device *dev)
209{209{
210 iommu_fwspec_free(dev);210 struct dev_iommu *param = dev->iommu;
211 kfree(dev->iommu);211
212 dev->iommu = NULL;212 dev->iommu = NULL;
213 if (param->fwspec) {
214 fwnode_handle_put(param->fwspec->iommu_fwnode);
215 kfree(param->fwspec);
216 }
217 kfree(param);
213}218}
214 219
215static int __iommu_probe_device(struct device *dev, struct list_head *group_list)220static int __iommu_probe_device(struct device *dev, struct list_head *group_list)
@@ -980,17 +985,6 @@ static int iommu_group_device_count(struct iommu_group *group) · 764 unmodified lines
980 return ret;985 return ret;
981}986}
982 987
983/**
984 * iommu_group_for_each_dev - iterate over each device in the group
985 * @group: the group
986 * @data: caller opaque data to be passed to callback function
987 * @fn: caller supplied callback function
988 *
989 * This function is called by group users to iterate over group devices.
990 * Callers should hold a reference count to the group during callback.
991 * The group->mutex is held across callbacks, which will block calls to
992 * iommu_group_add/remove_device.
993 */
994static int __iommu_group_for_each_dev(struct iommu_group *group, void *data,988static int __iommu_group_for_each_dev(struct iommu_group *group, void *data,
995 int (*fn)(struct device *, void *))989 int (*fn)(struct device *, void *))
996{990{
@@ -1005,7 +999,17 @@ static int __iommu_group_for_each_dev(struct iommu_group *group, void *data, · 8 unmodified lines
1005 return ret;999 return ret;
1006}1000}
1007 1001
1008 1002/**
1003 * iommu_group_for_each_dev - iterate over each device in the group
1004 * @group: the group
1005 * @data: caller opaque data to be passed to callback function
1006 * @fn: caller supplied callback function
1007 *
1008 * This function is called by group users to iterate over group devices.
1009 * Callers should hold a reference count to the group during callback.
1010 * The group->mutex is held across callbacks, which will block calls to
1011 * iommu_group_add/remove_device.
1012 */
1009int iommu_group_for_each_dev(struct iommu_group *group, void *data,1013int iommu_group_for_each_dev(struct iommu_group *group, void *data,
1010 int (*fn)(struct device *, void *))1014 int (*fn)(struct device *, void *))
1011{1015{
@@ -3032,6 +3036,7 @@ EXPORT_SYMBOL_GPL(iommu_aux_get_pasid); · 2020 unmodified lines
3032 * iommu_sva_bind_device() - Bind a process address space to a device3036 * iommu_sva_bind_device() - Bind a process address space to a device
3033 * @dev: the device3037 * @dev: the device
3034 * @mm: the mm to bind, caller must hold a reference to it3038 * @mm: the mm to bind, caller must hold a reference to it
3039 * @drvdata: opaque data pointer to pass to bind callback
3035 *3040 *
3036 * Create a bond between device and address space, allowing the device to access3041 * Create a bond between device and address space, allowing the device to access
3037 * the mm using the returned PASID. If a bond already exists between @device and3042 * the mm using the returned PASID. If a bond already exists between @device and
drivers/iommu/omap-iommu.c+1−1
@@ -1085,7 +1085,7 @@ static __maybe_unused int omap_iommu_runtime_resume(struct device *dev) · 1084 unmodified lines
1085}1085}
1086 1086
1087/**1087/**
1088 * omap_iommu_suspend_prepare - prepare() dev_pm_ops implementation1088 * omap_iommu_prepare - prepare() dev_pm_ops implementation
1089 * @dev: iommu device1089 * @dev: iommu device
1090 *1090 *
1091 * This function performs the necessary checks to determine if the IOMMU1091 * This function performs the necessary checks to determine if the IOMMU
drivers/md/md.c+4−4
@@ -5869,10 +5869,6 @@ int md_run(struct mddev *mddev) · 5868 unmodified lines
5869 nowait = nowait && blk_queue_nowait(bdev_get_queue(rdev->bdev));5869 nowait = nowait && blk_queue_nowait(bdev_get_queue(rdev->bdev));
5870 }5870 }
5871 5871
5872 /* Set the NOWAIT flags if all underlying devices support it */
5873 if (nowait)
5874 blk_queue_flag_set(QUEUE_FLAG_NOWAIT, mddev->queue);
5875
5876 if (!bioset_initialized(&mddev->bio_set)) {5872 if (!bioset_initialized(&mddev->bio_set)) {
5877 err = bioset_init(&mddev->bio_set, BIO_POOL_SIZE, 0, BIOSET_NEED_BVECS);5873 err = bioset_init(&mddev->bio_set, BIO_POOL_SIZE, 0, BIOSET_NEED_BVECS);
5878 if (err)5874 if (err)
@@ -6010,6 +6006,10 @@ int md_run(struct mddev *mddev) · 131 unmodified lines
6010 else6006 else
6011 blk_queue_flag_clear(QUEUE_FLAG_NONROT, mddev->queue);6007 blk_queue_flag_clear(QUEUE_FLAG_NONROT, mddev->queue);
6012 blk_queue_flag_set(QUEUE_FLAG_IO_STAT, mddev->queue);6008 blk_queue_flag_set(QUEUE_FLAG_IO_STAT, mddev->queue);
6009
6010 /* Set the NOWAIT flags if all underlying devices support it */
6011 if (nowait)
6012 blk_queue_flag_set(QUEUE_FLAG_NOWAIT, mddev->queue);
6013 }6013 }
6014 if (pers->sync_request) {6014 if (pers->sync_request) {
6015 if (mddev->kobj.sd &&6015 if (mddev->kobj.sd &&
drivers/net/dsa/Kconfig+1−0
@@ -36,6 +36,7 @@ config NET_DSA_LANTIQ_GSWIP · 35 unmodified lines
36config NET_DSA_MT753036config NET_DSA_MT7530
37 tristate "MediaTek MT753x and MT7621 Ethernet switch support"37 tristate "MediaTek MT753x and MT7621 Ethernet switch support"
38 select NET_DSA_TAG_MTK38 select NET_DSA_TAG_MTK
39 select MEDIATEK_GE_PHY
39 help40 help
40 This enables support for the MediaTek MT7530, MT7531, and MT762141 This enables support for the MediaTek MT7530, MT7531, and MT7621
41 Ethernet switch chips.42 Ethernet switch chips.
drivers/net/ethernet/amd/xgbe/xgbe-drv.c+13−1
@@ -721,7 +721,9 @@ static void xgbe_stop_timers(struct xgbe_prv_data *pdata) · 720 unmodified lines
721 if (!channel->tx_ring)721 if (!channel->tx_ring)
722 break;722 break;
723 723
724 /* Deactivate the Tx timer */
724 del_timer_sync(&channel->tx_timer);725 del_timer_sync(&channel->tx_timer);
726 channel->tx_timer_active = 0;
725 }727 }
726}728}
727 729
@@ -2550,6 +2552,14 @@ read_again: · 1822 unmodified lines
2550 buf2_len = xgbe_rx_buf2_len(rdata, packet, len);2552 buf2_len = xgbe_rx_buf2_len(rdata, packet, len);
2551 len += buf2_len;2553 len += buf2_len;
2552 2554
2555 if (buf2_len > rdata->rx.buf.dma_len) {
2556 /* Hardware inconsistency within the descriptors
2557 * that has resulted in a length underflow.
2558 */
2559 error = 1;
2560 goto skip_data;
2561 }
2562
2553 if (!skb) {2563 if (!skb) {
2554 skb = xgbe_create_skb(pdata, napi, rdata,2564 skb = xgbe_create_skb(pdata, napi, rdata,
2555 buf1_len);2565 buf1_len);
@@ -2579,8 +2589,10 @@ skip_data: · 23 unmodified lines
2579 if (!last || context_next)2589 if (!last || context_next)
2580 goto read_again;2590 goto read_again;
2581 2591
2582 if (!skb)2592 if (!skb || error) {
2593 dev_kfree_skb(skb);
2583 goto next_packet;2594 goto next_packet;
2595 }
2584 2596
2585 /* Be sure we don't exceed the configured MTU */2597 /* Be sure we don't exceed the configured MTU */
2586 max_len = netdev->mtu + ETH_HLEN;2598 max_len = netdev->mtu + ETH_HLEN;
drivers/net/ethernet/google/gve/gve_adminq.c+1−1
@@ -301,7 +301,7 @@ static int gve_adminq_parse_err(struct gve_priv *priv, u32 status) · 300 unmodified lines
301 */301 */
302static int gve_adminq_kick_and_wait(struct gve_priv *priv)302static int gve_adminq_kick_and_wait(struct gve_priv *priv)
303{303{
304 u32 tail, head;304 int tail, head;
305 int i;305 int i;
306 306
307 tail = ioread32be(&priv->reg_bar0->adminq_event_counter);307 tail = ioread32be(&priv->reg_bar0->adminq_event_counter);
drivers/net/ethernet/intel/e1000e/e1000.h+3−1
@@ -115,7 +115,8 @@ enum e1000_boards { · 114 unmodified lines
115 board_pch_lpt,115 board_pch_lpt,
116 board_pch_spt,116 board_pch_spt,
117 board_pch_cnp,117 board_pch_cnp,
118 board_pch_tgp118 board_pch_tgp,
119 board_pch_adp
119};120};
120 121
121struct e1000_ps_page {122struct e1000_ps_page {
@@ -502,6 +503,7 @@ extern const struct e1000_info e1000_pch_lpt_info; · 380 unmodified lines
502extern const struct e1000_info e1000_pch_spt_info;503extern const struct e1000_info e1000_pch_spt_info;
503extern const struct e1000_info e1000_pch_cnp_info;504extern const struct e1000_info e1000_pch_cnp_info;
504extern const struct e1000_info e1000_pch_tgp_info;505extern const struct e1000_info e1000_pch_tgp_info;
506extern const struct e1000_info e1000_pch_adp_info;
505extern const struct e1000_info e1000_es2_info;507extern const struct e1000_info e1000_es2_info;
506 508
507void e1000e_ptp_init(struct e1000_adapter *adapter);509void e1000e_ptp_init(struct e1000_adapter *adapter);
drivers/net/ethernet/intel/e1000e/ich8lan.c+20−0
@@ -6021,3 +6021,23 @@ const struct e1000_info e1000_pch_tgp_info = { · 6020 unmodified lines
6021 .phy_ops = &ich8_phy_ops,6021 .phy_ops = &ich8_phy_ops,
6022 .nvm_ops = &spt_nvm_ops,6022 .nvm_ops = &spt_nvm_ops,
6023};6023};
6024
6025const struct e1000_info e1000_pch_adp_info = {
6026 .mac = e1000_pch_adp,
6027 .flags = FLAG_IS_ICH
6028 | FLAG_HAS_WOL
6029 | FLAG_HAS_HW_TIMESTAMP
6030 | FLAG_HAS_CTRLEXT_ON_LOAD
6031 | FLAG_HAS_AMT
6032 | FLAG_HAS_FLASH
6033 | FLAG_HAS_JUMBO_FRAMES
6034 | FLAG_APME_IN_WUC,
6035 .flags2 = FLAG2_HAS_PHY_STATS
6036 | FLAG2_HAS_EEE,
6037 .pba = 26,
6038 .max_hw_frame_size = 9022,
6039 .get_variants = e1000_get_variants_ich8lan,
6040 .mac_ops = &ich8_mac_ops,
6041 .phy_ops = &ich8_phy_ops,
6042 .nvm_ops = &spt_nvm_ops,
6043};
drivers/net/ethernet/intel/e1000e/netdev.c+21−18
@@ -52,6 +52,7 @@ static const struct e1000_info *e1000_info_tbl[] = { · 51 unmodified lines
52 [board_pch_spt] = &e1000_pch_spt_info,52 [board_pch_spt] = &e1000_pch_spt_info,
53 [board_pch_cnp] = &e1000_pch_cnp_info,53 [board_pch_cnp] = &e1000_pch_cnp_info,
54 [board_pch_tgp] = &e1000_pch_tgp_info,54 [board_pch_tgp] = &e1000_pch_tgp_info,
55 [board_pch_adp] = &e1000_pch_adp_info,
55};56};
56 57
57struct e1000_reg_info {58struct e1000_reg_info {
@@ -6341,7 +6342,8 @@ static void e1000e_s0ix_entry_flow(struct e1000_adapter *adapter) · 6283 unmodified lines
6341 u32 mac_data;6342 u32 mac_data;
6342 u16 phy_data;6343 u16 phy_data;
6343 6344
6344 if (er32(FWSM) & E1000_ICH_FWSM_FW_VALID) {6345 if (er32(FWSM) & E1000_ICH_FWSM_FW_VALID &&
6346 hw->mac.type >= e1000_pch_adp) {
6345 /* Request ME configure the device for S0ix */6347 /* Request ME configure the device for S0ix */
6346 mac_data = er32(H2ME);6348 mac_data = er32(H2ME);
6347 mac_data |= E1000_H2ME_START_DPG;6349 mac_data |= E1000_H2ME_START_DPG;
@@ -6490,7 +6492,8 @@ static void e1000e_s0ix_exit_flow(struct e1000_adapter *adapter) · 142 unmodified lines
6490 u16 phy_data;6492 u16 phy_data;
6491 u32 i = 0;6493 u32 i = 0;
6492 6494
6493 if (er32(FWSM) & E1000_ICH_FWSM_FW_VALID) {6495 if (er32(FWSM) & E1000_ICH_FWSM_FW_VALID &&
6496 hw->mac.type >= e1000_pch_adp) {
6494 /* Request ME unconfigure the device from S0ix */6497 /* Request ME unconfigure the device from S0ix */
6495 mac_data = er32(H2ME);6498 mac_data = er32(H2ME);
6496 mac_data &= ~E1000_H2ME_START_DPG;6499 mac_data &= ~E1000_H2ME_START_DPG;
@@ -7898,22 +7901,22 @@ static const struct pci_device_id e1000_pci_tbl[] = { · 1401 unmodified lines
7898 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_V14), board_pch_tgp },7901 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_V14), board_pch_tgp },
7899 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_LM15), board_pch_tgp },7902 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_LM15), board_pch_tgp },
7900 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_V15), board_pch_tgp },7903 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_V15), board_pch_tgp },
7901 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_LM23), board_pch_tgp },7904 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_LM23), board_pch_adp },
7902 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_V23), board_pch_tgp },7905 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_V23), board_pch_adp },
7903 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_LM16), board_pch_tgp },7906 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_LM16), board_pch_adp },
7904 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_V16), board_pch_tgp },7907 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_V16), board_pch_adp },
7905 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_LM17), board_pch_tgp },7908 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_LM17), board_pch_adp },
7906 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_V17), board_pch_tgp },7909 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_V17), board_pch_adp },
7907 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_LM22), board_pch_tgp },7910 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_LM22), board_pch_adp },
7908 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_V22), board_pch_tgp },7911 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_V22), board_pch_adp },
7909 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_LM18), board_pch_tgp },7912 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_LM18), board_pch_adp },
7910 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_V18), board_pch_tgp },7913 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_V18), board_pch_adp },
7911 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_LM19), board_pch_tgp },7914 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_LM19), board_pch_adp },
7912 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_V19), board_pch_tgp },7915 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_V19), board_pch_adp },
7913 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_LM20), board_pch_tgp },7916 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_LM20), board_pch_adp },
7914 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_V20), board_pch_tgp },7917 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_V20), board_pch_adp },
7915 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_LM21), board_pch_tgp },7918 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_LM21), board_pch_adp },
7916 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_V21), board_pch_tgp },7919 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_V21), board_pch_adp },
7917 7920
7918 { 0, 0, 0, 0, 0, 0, 0 } /* terminate list */7921 { 0, 0, 0, 0, 0, 0, 0 } /* terminate list */
7919};7922};
drivers/net/ethernet/intel/i40e/i40e.h+1−0
@@ -144,6 +144,7 @@ enum i40e_state_t { · 143 unmodified lines
144 __I40E_VIRTCHNL_OP_PENDING,144 __I40E_VIRTCHNL_OP_PENDING,
145 __I40E_RECOVERY_MODE,145 __I40E_RECOVERY_MODE,
146 __I40E_VF_RESETS_DISABLED, /* disable resets during i40e_remove */146 __I40E_VF_RESETS_DISABLED, /* disable resets during i40e_remove */
147 __I40E_IN_REMOVE,
147 __I40E_VFS_RELEASING,148 __I40E_VFS_RELEASING,
148 /* This must be last as it determines the size of the BITMAP */149 /* This must be last as it determines the size of the BITMAP */
149 __I40E_STATE_SIZE__,150 __I40E_STATE_SIZE__,
drivers/net/ethernet/intel/i40e/i40e_main.c+29−2
@@ -5372,7 +5372,15 @@ static int i40e_vsi_configure_bw_alloc(struct i40e_vsi *vsi, u8 enabled_tc, · 5371 unmodified lines
5372 /* There is no need to reset BW when mqprio mode is on. */5372 /* There is no need to reset BW when mqprio mode is on. */
5373 if (pf->flags & I40E_FLAG_TC_MQPRIO)5373 if (pf->flags & I40E_FLAG_TC_MQPRIO)
5374 return 0;5374 return 0;
5375 if (!vsi->mqprio_qopt.qopt.hw && !(pf->flags & I40E_FLAG_DCB_ENABLED)) {5375
5376 if (!vsi->mqprio_qopt.qopt.hw) {
5377 if (pf->flags & I40E_FLAG_DCB_ENABLED)
5378 goto skip_reset;
5379
5380 if (IS_ENABLED(CONFIG_I40E_DCB) &&
5381 i40e_dcb_hw_get_num_tc(&pf->hw) == 1)
5382 goto skip_reset;
5383
5376 ret = i40e_set_bw_limit(vsi, vsi->seid, 0);5384 ret = i40e_set_bw_limit(vsi, vsi->seid, 0);
5377 if (ret)5385 if (ret)
5378 dev_info(&pf->pdev->dev,5386 dev_info(&pf->pdev->dev,
@@ -5380,6 +5388,8 @@ static int i40e_vsi_configure_bw_alloc(struct i40e_vsi *vsi, u8 enabled_tc, · 1 unmodified line
5380 vsi->seid);5388 vsi->seid);
5381 return ret;5389 return ret;
5382 }5390 }
5391
5392skip_reset:
5383 memset(&bw_data, 0, sizeof(bw_data));5393 memset(&bw_data, 0, sizeof(bw_data));
5384 bw_data.tc_valid_bits = enabled_tc;5394 bw_data.tc_valid_bits = enabled_tc;
5385 for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++)5395 for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++)
@@ -10853,6 +10863,9 @@ static void i40e_reset_and_rebuild(struct i40e_pf *pf, bool reinit, · 5467 unmodified lines
10853 bool lock_acquired)10863 bool lock_acquired)
10854{10864{
10855 int ret;10865 int ret;
10866
10867 if (test_bit(__I40E_IN_REMOVE, pf->state))
10868 return;
10856 /* Now we wait for GRST to settle out.10869 /* Now we wait for GRST to settle out.
10857 * We don't have to delete the VEBs or VSIs from the hw switch10870 * We don't have to delete the VEBs or VSIs from the hw switch
10858 * because the reset will make them disappear.10871 * because the reset will make them disappear.
@@ -12212,6 +12225,8 @@ int i40e_reconfig_rss_queues(struct i40e_pf *pf, int queue_count) · 1353 unmodified lines
12212 12225
12213 vsi->req_queue_pairs = queue_count;12226 vsi->req_queue_pairs = queue_count;
12214 i40e_prep_for_reset(pf);12227 i40e_prep_for_reset(pf);
12228 if (test_bit(__I40E_IN_REMOVE, pf->state))
12229 return pf->alloc_rss_size;
12215 12230
12216 pf->alloc_rss_size = new_rss_size;12231 pf->alloc_rss_size = new_rss_size;
12217 12232
@@ -13038,6 +13053,10 @@ static int i40e_xdp_setup(struct i40e_vsi *vsi, struct bpf_prog *prog, · 820 unmodified lines
13038 if (need_reset)13053 if (need_reset)
13039 i40e_prep_for_reset(pf);13054 i40e_prep_for_reset(pf);
13040 13055
13056 /* VSI shall be deleted in a moment, just return EINVAL */
13057 if (test_bit(__I40E_IN_REMOVE, pf->state))
13058 return -EINVAL;
13059
13041 old_prog = xchg(&vsi->xdp_prog, prog);13060 old_prog = xchg(&vsi->xdp_prog, prog);
13042 13061
13043 if (need_reset) {13062 if (need_reset) {
@@ -15928,8 +15947,13 @@ static void i40e_remove(struct pci_dev *pdev) · 2884 unmodified lines
15928 i40e_write_rx_ctl(hw, I40E_PFQF_HENA(0), 0);15947 i40e_write_rx_ctl(hw, I40E_PFQF_HENA(0), 0);
15929 i40e_write_rx_ctl(hw, I40E_PFQF_HENA(1), 0);15948 i40e_write_rx_ctl(hw, I40E_PFQF_HENA(1), 0);
15930 15949
15931 while (test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state))15950 /* Grab __I40E_RESET_RECOVERY_PENDING and set __I40E_IN_REMOVE
15951 * flags, once they are set, i40e_rebuild should not be called as
15952 * i40e_prep_for_reset always returns early.
15953 */
15954 while (test_and_set_bit(__I40E_RESET_RECOVERY_PENDING, pf->state))
15932 usleep_range(1000, 2000);15955 usleep_range(1000, 2000);
15956 set_bit(__I40E_IN_REMOVE, pf->state);
15933 15957
15934 if (pf->flags & I40E_FLAG_SRIOV_ENABLED) {15958 if (pf->flags & I40E_FLAG_SRIOV_ENABLED) {
15935 set_bit(__I40E_VF_RESETS_DISABLED, pf->state);15959 set_bit(__I40E_VF_RESETS_DISABLED, pf->state);
@@ -16128,6 +16152,9 @@ static void i40e_pci_error_reset_done(struct pci_dev *pdev) · 192 unmodified lines
16128{16152{
16129 struct i40e_pf *pf = pci_get_drvdata(pdev);16153 struct i40e_pf *pf = pci_get_drvdata(pdev);
16130 16154
16155 if (test_bit(__I40E_IN_REMOVE, pf->state))
16156 return;
16157
16131 i40e_reset_and_rebuild(pf, false, false);16158 i40e_reset_and_rebuild(pf, false, false);
16132}16159}
16133 16160
drivers/net/ethernet/mellanox/mlx5/core/en.h+3−3
@@ -224,7 +224,7 @@ static inline int mlx5e_get_max_num_channels(struct mlx5_core_dev *mdev) · 223 unmodified lines
224struct mlx5e_tx_wqe {224struct mlx5e_tx_wqe {
225 struct mlx5_wqe_ctrl_seg ctrl;225 struct mlx5_wqe_ctrl_seg ctrl;
226 struct mlx5_wqe_eth_seg eth;226 struct mlx5_wqe_eth_seg eth;
227 struct mlx5_wqe_data_seg data[0];227 struct mlx5_wqe_data_seg data[];
228};228};
229 229
230struct mlx5e_rx_wqe_ll {230struct mlx5e_rx_wqe_ll {
@@ -241,8 +241,8 @@ struct mlx5e_umr_wqe { · 10 unmodified lines
241 struct mlx5_wqe_umr_ctrl_seg uctrl;241 struct mlx5_wqe_umr_ctrl_seg uctrl;
242 struct mlx5_mkey_seg mkc;242 struct mlx5_mkey_seg mkc;
243 union {243 union {
244 struct mlx5_mtt inline_mtts[0];244 DECLARE_FLEX_ARRAY(struct mlx5_mtt, inline_mtts);
245 struct mlx5_klm inline_klms[0];245 DECLARE_FLEX_ARRAY(struct mlx5_klm, inline_klms);
246 };246 };
247};247};
248 248
drivers/net/ethernet/mellanox/mlx5/core/en/qos.c+2−1
@@ -570,7 +570,8 @@ static int mlx5e_htb_convert_rate(struct mlx5e_priv *priv, u64 rate, · 569 unmodified lines
570 570
571static void mlx5e_htb_convert_ceil(struct mlx5e_priv *priv, u64 ceil, u32 *max_average_bw)571static void mlx5e_htb_convert_ceil(struct mlx5e_priv *priv, u64 ceil, u32 *max_average_bw)
572{572{
573 *max_average_bw = div_u64(ceil, BYTES_IN_MBIT);573 /* Hardware treats 0 as "unlimited", set at least 1. */
574 *max_average_bw = max_t(u32, div_u64(ceil, BYTES_IN_MBIT), 1);
574 575
575 qos_dbg(priv->mdev, "Convert: ceil %llu -> max_average_bw %u\n",576 qos_dbg(priv->mdev, "Convert: ceil %llu -> max_average_bw %u\n",
576 ceil, *max_average_bw);577 ceil, *max_average_bw);
drivers/net/ethernet/mellanox/mlx5/core/en/rep/bond.c+14−18
@@ -183,18 +183,7 @@ void mlx5e_rep_bond_unslave(struct mlx5_eswitch *esw, · 182 unmodified lines
183 183
184static bool mlx5e_rep_is_lag_netdev(struct net_device *netdev)184static bool mlx5e_rep_is_lag_netdev(struct net_device *netdev)
185{185{
186 struct mlx5e_rep_priv *rpriv;186 return netif_is_lag_port(netdev) && mlx5e_eswitch_vf_rep(netdev);
187 struct mlx5e_priv *priv;
188
189 /* A given netdev is not a representor or not a slave of LAG configuration */
190 if (!mlx5e_eswitch_rep(netdev) || !netif_is_lag_port(netdev))
191 return false;
192
193 priv = netdev_priv(netdev);
194 rpriv = priv->ppriv;
195
196 /* Egress acl forward to vport is supported only non-uplink representor */
197 return rpriv->rep->vport != MLX5_VPORT_UPLINK;
198}187}
199 188
200static void mlx5e_rep_changelowerstate_event(struct net_device *netdev, void *ptr)189static void mlx5e_rep_changelowerstate_event(struct net_device *netdev, void *ptr)
@@ -210,9 +199,6 @@ static void mlx5e_rep_changelowerstate_event(struct net_device *netdev, void *pt · 9 unmodified lines
210 u16 fwd_vport_num;199 u16 fwd_vport_num;
211 int err;200 int err;
212 201
213 if (!mlx5e_rep_is_lag_netdev(netdev))
214 return;
215
216 info = ptr;202 info = ptr;
217 lag_info = info->lower_state_info;203 lag_info = info->lower_state_info;
218 /* This is not an event of a representor becoming active slave */204 /* This is not an event of a representor becoming active slave */
@@ -266,9 +252,6 @@ static void mlx5e_rep_changeupper_event(struct net_device *netdev, void *ptr) · 47 unmodified lines
266 struct net_device *lag_dev;252 struct net_device *lag_dev;
267 struct mlx5e_priv *priv;253 struct mlx5e_priv *priv;
268 254
269 if (!mlx5e_rep_is_lag_netdev(netdev))
270 return;
271
272 priv = netdev_priv(netdev);255 priv = netdev_priv(netdev);
273 rpriv = priv->ppriv;256 rpriv = priv->ppriv;
274 lag_dev = info->upper_dev;257 lag_dev = info->upper_dev;
@@ -293,6 +276,19 @@ static int mlx5e_rep_esw_bond_netevent(struct notifier_block *nb, · 18 unmodified lines
293 unsigned long event, void *ptr)276 unsigned long event, void *ptr)
294{277{
295 struct net_device *netdev = netdev_notifier_info_to_dev(ptr);278 struct net_device *netdev = netdev_notifier_info_to_dev(ptr);
279 struct mlx5e_rep_priv *rpriv;
280 struct mlx5e_rep_bond *bond;
281 struct mlx5e_priv *priv;
282
283 if (!mlx5e_rep_is_lag_netdev(netdev))
284 return NOTIFY_DONE;
285
286 bond = container_of(nb, struct mlx5e_rep_bond, nb);
287 priv = netdev_priv(netdev);
288 rpriv = mlx5_eswitch_get_uplink_priv(priv->mdev->priv.eswitch, REP_ETH);
289 /* Verify VF representor is on the same device of the bond handling the netevent. */
290 if (rpriv->uplink_priv.bond != bond)
291 return NOTIFY_DONE;
296 292
297 switch (event) {293 switch (event) {
298 case NETDEV_CHANGELOWERSTATE:294 case NETDEV_CHANGELOWERSTATE:
drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c+4−2
@@ -491,7 +491,7 @@ void mlx5e_rep_bridge_init(struct mlx5e_priv *priv) · 490 unmodified lines
491 }491 }
492 492
493 br_offloads->netdev_nb.notifier_call = mlx5_esw_bridge_switchdev_port_event;493 br_offloads->netdev_nb.notifier_call = mlx5_esw_bridge_switchdev_port_event;
494 err = register_netdevice_notifier(&br_offloads->netdev_nb);494 err = register_netdevice_notifier_net(&init_net, &br_offloads->netdev_nb);
495 if (err) {495 if (err) {
496 esw_warn(mdev, "Failed to register bridge offloads netdevice notifier (err=%d)\n",496 esw_warn(mdev, "Failed to register bridge offloads netdevice notifier (err=%d)\n",
497 err);497 err);
@@ -509,7 +509,9 @@ err_register_swdev_blk: · 11 unmodified lines
509err_register_swdev:509err_register_swdev:
510 destroy_workqueue(br_offloads->wq);510 destroy_workqueue(br_offloads->wq);
511err_alloc_wq:511err_alloc_wq:
512 rtnl_lock();
512 mlx5_esw_bridge_cleanup(esw);513 mlx5_esw_bridge_cleanup(esw);
514 rtnl_unlock();
513}515}
514 516
515void mlx5e_rep_bridge_cleanup(struct mlx5e_priv *priv)517void mlx5e_rep_bridge_cleanup(struct mlx5e_priv *priv)
@@ -524,7 +526,7 @@ void mlx5e_rep_bridge_cleanup(struct mlx5e_priv *priv) · 8 unmodified lines
524 return;526 return;
525 527
526 cancel_delayed_work_sync(&br_offloads->update_work);528 cancel_delayed_work_sync(&br_offloads->update_work);
527 unregister_netdevice_notifier(&br_offloads->netdev_nb);529 unregister_netdevice_notifier_net(&init_net, &br_offloads->netdev_nb);
528 unregister_switchdev_blocking_notifier(&br_offloads->nb_blk);530 unregister_switchdev_blocking_notifier(&br_offloads->nb_blk);
529 unregister_switchdev_notifier(&br_offloads->nb);531 unregister_switchdev_notifier(&br_offloads->nb);
530 destroy_workqueue(br_offloads->wq);532 destroy_workqueue(br_offloads->wq);
drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h+5−0
@@ -167,6 +167,11 @@ static inline u16 mlx5e_txqsq_get_next_pi(struct mlx5e_txqsq *sq, u16 size) · 166 unmodified lines
167 return pi;167 return pi;
168}168}
169 169
170static inline u16 mlx5e_shampo_get_cqe_header_index(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe)
171{
172 return be16_to_cpu(cqe->shampo.header_entry_index) & (rq->mpwqe.shampo->hd_per_wq - 1);
173}
174
170struct mlx5e_shampo_umr {175struct mlx5e_shampo_umr {
171 u16 len;176 u16 len;
172};177};
drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c+3−1
@@ -341,8 +341,10 @@ mlx5e_xmit_xdp_frame(struct mlx5e_xdpsq *sq, struct mlx5e_xmit_data *xdptxd, · 340 unmodified lines
341 341
342 /* copy the inline part if required */342 /* copy the inline part if required */
343 if (sq->min_inline_mode != MLX5_INLINE_MODE_NONE) {343 if (sq->min_inline_mode != MLX5_INLINE_MODE_NONE) {
344 memcpy(eseg->inline_hdr.start, xdptxd->data, MLX5E_XDP_MIN_INLINE);344 memcpy(eseg->inline_hdr.start, xdptxd->data, sizeof(eseg->inline_hdr.start));
345 eseg->inline_hdr.sz = cpu_to_be16(MLX5E_XDP_MIN_INLINE);345 eseg->inline_hdr.sz = cpu_to_be16(MLX5E_XDP_MIN_INLINE);
346 memcpy(dseg, xdptxd->data + sizeof(eseg->inline_hdr.start),
347 MLX5E_XDP_MIN_INLINE - sizeof(eseg->inline_hdr.start));
346 dma_len -= MLX5E_XDP_MIN_INLINE;348 dma_len -= MLX5E_XDP_MIN_INLINE;
347 dma_addr += MLX5E_XDP_MIN_INLINE;349 dma_addr += MLX5E_XDP_MIN_INLINE;
348 dseg++;350 dseg++;
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c+11−2
@@ -157,11 +157,20 @@ static void mlx5e_ipsec_set_swp(struct sk_buff *skb, · 156 unmodified lines
157 /* Tunnel mode */157 /* Tunnel mode */
158 if (mode == XFRM_MODE_TUNNEL) {158 if (mode == XFRM_MODE_TUNNEL) {
159 eseg->swp_inner_l3_offset = skb_inner_network_offset(skb) / 2;159 eseg->swp_inner_l3_offset = skb_inner_network_offset(skb) / 2;
160 eseg->swp_inner_l4_offset = skb_inner_transport_offset(skb) / 2;
161 if (xo->proto == IPPROTO_IPV6)160 if (xo->proto == IPPROTO_IPV6)
162 eseg->swp_flags |= MLX5_ETH_WQE_SWP_INNER_L3_IPV6;161 eseg->swp_flags |= MLX5_ETH_WQE_SWP_INNER_L3_IPV6;
163 if (inner_ip_hdr(skb)->protocol == IPPROTO_UDP)162
163 switch (xo->inner_ipproto) {
164 case IPPROTO_UDP:
164 eseg->swp_flags |= MLX5_ETH_WQE_SWP_INNER_L4_UDP;165 eseg->swp_flags |= MLX5_ETH_WQE_SWP_INNER_L4_UDP;
166 fallthrough;
167 case IPPROTO_TCP:
168 /* IP | ESP | IP | [TCP | UDP] */
169 eseg->swp_inner_l4_offset = skb_inner_transport_offset(skb) / 2;
170 break;
171 default:
172 break;
173 }
165 return;174 return;
166 }175 }
167 176
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h+6−3
@@ -131,14 +131,17 @@ static inline bool · 130 unmodified lines
131mlx5e_ipsec_txwqe_build_eseg_csum(struct mlx5e_txqsq *sq, struct sk_buff *skb,131mlx5e_ipsec_txwqe_build_eseg_csum(struct mlx5e_txqsq *sq, struct sk_buff *skb,
132 struct mlx5_wqe_eth_seg *eseg)132 struct mlx5_wqe_eth_seg *eseg)
133{133{
134 struct xfrm_offload *xo = xfrm_offload(skb);134 u8 inner_ipproto;
135 135
136 if (!mlx5e_ipsec_eseg_meta(eseg))136 if (!mlx5e_ipsec_eseg_meta(eseg))
137 return false;137 return false;
138 138
139 eseg->cs_flags = MLX5_ETH_WQE_L3_CSUM;139 eseg->cs_flags = MLX5_ETH_WQE_L3_CSUM;
140 if (xo->inner_ipproto) {140 inner_ipproto = xfrm_offload(skb)->inner_ipproto;
141 eseg->cs_flags |= MLX5_ETH_WQE_L4_INNER_CSUM | MLX5_ETH_WQE_L3_INNER_CSUM;141 if (inner_ipproto) {
142 eseg->cs_flags |= MLX5_ETH_WQE_L3_INNER_CSUM;
143 if (inner_ipproto == IPPROTO_TCP || inner_ipproto == IPPROTO_UDP)
144 eseg->cs_flags |= MLX5_ETH_WQE_L4_INNER_CSUM;
142 } else if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) {145 } else if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
143 eseg->cs_flags |= MLX5_ETH_WQE_L4_CSUM;146 eseg->cs_flags |= MLX5_ETH_WQE_L4_CSUM;
144 sq->stats->csum_partial_inner++;147 sq->stats->csum_partial_inner++;
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c+19−11
@@ -1117,7 +1117,7 @@ static void mlx5e_shampo_update_ipv6_udp_hdr(struct mlx5e_rq *rq, struct ipv6hdr · 1116 unmodified lines
1117static void mlx5e_shampo_update_fin_psh_flags(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe,1117static void mlx5e_shampo_update_fin_psh_flags(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe,
1118 struct tcphdr *skb_tcp_hd)1118 struct tcphdr *skb_tcp_hd)
1119{1119{
1120 u16 header_index = be16_to_cpu(cqe->shampo.header_entry_index);1120 u16 header_index = mlx5e_shampo_get_cqe_header_index(rq, cqe);
1121 struct tcphdr *last_tcp_hd;1121 struct tcphdr *last_tcp_hd;
1122 void *last_hd_addr;1122 void *last_hd_addr;
1123 1123
@@ -1871,7 +1871,7 @@ mlx5e_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi, · 747 unmodified lines
1871 return skb;1871 return skb;
1872}1872}
1873 1873
1874static void1874static struct sk_buff *
1875mlx5e_skb_from_cqe_shampo(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi,1875mlx5e_skb_from_cqe_shampo(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi,
1876 struct mlx5_cqe64 *cqe, u16 header_index)1876 struct mlx5_cqe64 *cqe, u16 header_index)
1877{1877{
@@ -1895,7 +1895,7 @@ mlx5e_skb_from_cqe_shampo(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi, · 17 unmodified lines
1895 skb = mlx5e_build_linear_skb(rq, hdr, frag_size, rx_headroom, head_size);1895 skb = mlx5e_build_linear_skb(rq, hdr, frag_size, rx_headroom, head_size);
1896 1896
1897 if (unlikely(!skb))1897 if (unlikely(!skb))
1898 return;1898 return NULL;
1899 1899
1900 /* queue up for recycling/reuse */1900 /* queue up for recycling/reuse */
1901 page_ref_inc(head->page);1901 page_ref_inc(head->page);
@@ -1907,7 +1907,7 @@ mlx5e_skb_from_cqe_shampo(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi, · 5 unmodified lines
1907 ALIGN(head_size, sizeof(long)));1907 ALIGN(head_size, sizeof(long)));
1908 if (unlikely(!skb)) {1908 if (unlikely(!skb)) {
1909 rq->stats->buff_alloc_err++;1909 rq->stats->buff_alloc_err++;
1910 return;1910 return NULL;
1911 }1911 }
1912 1912
1913 prefetchw(skb->data);1913 prefetchw(skb->data);
@@ -1918,9 +1918,7 @@ mlx5e_skb_from_cqe_shampo(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi, · 4 unmodified lines
1918 skb->tail += head_size;1918 skb->tail += head_size;
1919 skb->len += head_size;1919 skb->len += head_size;
1920 }1920 }
1921 rq->hw_gro_data->skb = skb;1921 return skb;
1922 NAPI_GRO_CB(skb)->count = 1;
1923 skb_shinfo(skb)->gso_size = mpwrq_get_cqe_byte_cnt(cqe) - head_size;
1924}1922}
1925 1923
1926static void1924static void
@@ -1973,13 +1971,14 @@ mlx5e_free_rx_shampo_hd_entry(struct mlx5e_rq *rq, u16 header_index) · 46 unmodified lines
1973static void mlx5e_handle_rx_cqe_mpwrq_shampo(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe)1971static void mlx5e_handle_rx_cqe_mpwrq_shampo(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe)
1974{1972{
1975 u16 data_bcnt = mpwrq_get_cqe_byte_cnt(cqe) - cqe->shampo.header_size;1973 u16 data_bcnt = mpwrq_get_cqe_byte_cnt(cqe) - cqe->shampo.header_size;
1976 u16 header_index = be16_to_cpu(cqe->shampo.header_entry_index);1974 u16 header_index = mlx5e_shampo_get_cqe_header_index(rq, cqe);
1977 u32 wqe_offset = be32_to_cpu(cqe->shampo.data_offset);1975 u32 wqe_offset = be32_to_cpu(cqe->shampo.data_offset);
1978 u16 cstrides = mpwrq_get_cqe_consumed_strides(cqe);1976 u16 cstrides = mpwrq_get_cqe_consumed_strides(cqe);
1979 u32 data_offset = wqe_offset & (PAGE_SIZE - 1);1977 u32 data_offset = wqe_offset & (PAGE_SIZE - 1);
1980 u32 cqe_bcnt = mpwrq_get_cqe_byte_cnt(cqe);1978 u32 cqe_bcnt = mpwrq_get_cqe_byte_cnt(cqe);
1981 u16 wqe_id = be16_to_cpu(cqe->wqe_id);1979 u16 wqe_id = be16_to_cpu(cqe->wqe_id);
1982 u32 page_idx = wqe_offset >> PAGE_SHIFT;1980 u32 page_idx = wqe_offset >> PAGE_SHIFT;
1981 u16 head_size = cqe->shampo.header_size;
1983 struct sk_buff **skb = &rq->hw_gro_data->skb;1982 struct sk_buff **skb = &rq->hw_gro_data->skb;
1984 bool flush = cqe->shampo.flush;1983 bool flush = cqe->shampo.flush;
1985 bool match = cqe->shampo.match;1984 bool match = cqe->shampo.match;
@@ -2011,9 +2010,16 @@ static void mlx5e_handle_rx_cqe_mpwrq_shampo(struct mlx5e_rq *rq, struct mlx5_cq · 25 unmodified lines
2011 }2010 }
2012 2011
2013 if (!*skb) {2012 if (!*skb) {
2014 mlx5e_skb_from_cqe_shampo(rq, wi, cqe, header_index);2013 if (likely(head_size))
2014 *skb = mlx5e_skb_from_cqe_shampo(rq, wi, cqe, header_index);
2015 else
2016 *skb = mlx5e_skb_from_cqe_mpwrq_nonlinear(rq, wi, cqe_bcnt, data_offset,
2017 page_idx);
2015 if (unlikely(!*skb))2018 if (unlikely(!*skb))
2016 goto free_hd_entry;2019 goto free_hd_entry;
2020
2021 NAPI_GRO_CB(*skb)->count = 1;
2022 skb_shinfo(*skb)->gso_size = cqe_bcnt - head_size;
2017 } else {2023 } else {
2018 NAPI_GRO_CB(*skb)->count++;2024 NAPI_GRO_CB(*skb)->count++;
2019 if (NAPI_GRO_CB(*skb)->count == 2 &&2025 if (NAPI_GRO_CB(*skb)->count == 2 &&
@@ -2027,8 +2033,10 @@ static void mlx5e_handle_rx_cqe_mpwrq_shampo(struct mlx5e_rq *rq, struct mlx5_cq · 7 unmodified lines
2027 }2033 }
2028 }2034 }
2029 2035
2030 di = &wi->umr.dma_info[page_idx];2036 if (likely(head_size)) {
2031 mlx5e_fill_skb_data(*skb, rq, di, data_bcnt, data_offset);2037 di = &wi->umr.dma_info[page_idx];
2038 mlx5e_fill_skb_data(*skb, rq, di, data_bcnt, data_offset);
2039 }
2032 2040
2033 mlx5e_shampo_complete_rx_cqe(rq, cqe, cqe_bcnt, *skb);2041 mlx5e_shampo_complete_rx_cqe(rq, cqe, cqe_bcnt, *skb);
2034 if (flush)2042 if (flush)
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c+14−1
@@ -1414,7 +1414,8 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv, · 1413 unmodified lines
1414 if (err)1414 if (err)
1415 goto err_out;1415 goto err_out;
1416 1416
1417 if (!attr->chain && esw_attr->int_port) {1417 if (!attr->chain && esw_attr->int_port &&
1418 attr->action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) {
1418 /* If decap route device is internal port, change the1419 /* If decap route device is internal port, change the
1419 * source vport value in reg_c0 back to uplink just in1420 * source vport value in reg_c0 back to uplink just in
1420 * case the rule performs goto chain > 0. If we have a miss1421 * case the rule performs goto chain > 0. If we have a miss
@@ -3191,6 +3192,18 @@ actions_match_supported(struct mlx5e_priv *priv, · 1770 unmodified lines
3191 return false;3192 return false;
3192 }3193 }
3193 3194
3195 if (!(~actions &
3196 (MLX5_FLOW_CONTEXT_ACTION_FWD_DEST | MLX5_FLOW_CONTEXT_ACTION_DROP))) {
3197 NL_SET_ERR_MSG_MOD(extack, "Rule cannot support forward+drop action");
3198 return false;
3199 }
3200
3201 if (actions & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR &&
3202 actions & MLX5_FLOW_CONTEXT_ACTION_DROP) {
3203 NL_SET_ERR_MSG_MOD(extack, "Drop with modify header action is not supported");
3204 return false;
3205 }
3206
3194 if (actions & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR &&3207 if (actions & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR &&
3195 !modify_header_match_supported(priv, &parse_attr->spec, flow_action,3208 !modify_header_match_supported(priv, &parse_attr->spec, flow_action,
3196 actions, ct_flow, ct_clear, extack))3209 actions, ct_flow, ct_clear, extack))
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c+1−1
@@ -208,7 +208,7 @@ static inline void mlx5e_insert_vlan(void *start, struct sk_buff *skb, u16 ihs) · 207 unmodified lines
208 int cpy1_sz = 2 * ETH_ALEN;208 int cpy1_sz = 2 * ETH_ALEN;
209 int cpy2_sz = ihs - cpy1_sz;209 int cpy2_sz = ihs - cpy1_sz;
210 210
211 memcpy(vhdr, skb->data, cpy1_sz);211 memcpy(&vhdr->addrs, skb->data, cpy1_sz);
212 vhdr->h_vlan_proto = skb->vlan_proto;212 vhdr->h_vlan_proto = skb->vlan_proto;
213 vhdr->h_vlan_TCI = cpu_to_be16(skb_vlan_tag_get(skb));213 vhdr->h_vlan_TCI = cpu_to_be16(skb_vlan_tag_get(skb));
214 memcpy(&vhdr->h_vlan_encapsulated_proto, skb->data + cpy1_sz, cpy2_sz);214 memcpy(&vhdr->h_vlan_encapsulated_proto, skb->data + cpy1_sz, cpy2_sz);
drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c+4−0
@@ -1574,6 +1574,8 @@ struct mlx5_esw_bridge_offloads *mlx5_esw_bridge_init(struct mlx5_eswitch *esw) · 1573 unmodified lines
1574{1574{
1575 struct mlx5_esw_bridge_offloads *br_offloads;1575 struct mlx5_esw_bridge_offloads *br_offloads;
1576 1576
1577 ASSERT_RTNL();
1578
1577 br_offloads = kvzalloc(sizeof(*br_offloads), GFP_KERNEL);1579 br_offloads = kvzalloc(sizeof(*br_offloads), GFP_KERNEL);
1578 if (!br_offloads)1580 if (!br_offloads)
1579 return ERR_PTR(-ENOMEM);1581 return ERR_PTR(-ENOMEM);
@@ -1590,6 +1592,8 @@ void mlx5_esw_bridge_cleanup(struct mlx5_eswitch *esw) · 10 unmodified lines
1590{1592{
1591 struct mlx5_esw_bridge_offloads *br_offloads = esw->br_offloads;1593 struct mlx5_esw_bridge_offloads *br_offloads = esw->br_offloads;
1592 1594
1595 ASSERT_RTNL();
1596
1593 if (!br_offloads)1597 if (!br_offloads)
1594 return;1598 return;
1595 1599
drivers/net/ethernet/mellanox/mlx5/core/esw/diag/bridge_tracepoint.h+1−1
@@ -21,7 +21,7 @@ DECLARE_EVENT_CLASS(mlx5_esw_bridge_fdb_template, · 20 unmodified lines
21 __field(unsigned int, used)21 __field(unsigned int, used)
22 ),22 ),
23 TP_fast_assign(23 TP_fast_assign(
24 strncpy(__entry->dev_name,24 strscpy(__entry->dev_name,
25 netdev_name(fdb->dev),25 netdev_name(fdb->dev),
26 IFNAMSIZ);26 IFNAMSIZ);
27 memcpy(__entry->addr, fdb->key.addr, ETH_ALEN);27 memcpy(__entry->addr, fdb->key.addr, ETH_ALEN);
drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c+1−1
@@ -132,7 +132,7 @@ static void mlx5_stop_sync_reset_poll(struct mlx5_core_dev *dev) · 131 unmodified lines
132{132{
133 struct mlx5_fw_reset *fw_reset = dev->priv.fw_reset;133 struct mlx5_fw_reset *fw_reset = dev->priv.fw_reset;
134 134
135 del_timer(&fw_reset->timer);135 del_timer_sync(&fw_reset->timer);
136}136}
137 137
138static void mlx5_sync_reset_clear_reset_requested(struct mlx5_core_dev *dev, bool poll_health)138static void mlx5_sync_reset_clear_reset_requested(struct mlx5_core_dev *dev, bool poll_health)
drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c+5−4
@@ -121,12 +121,13 @@ u32 mlx5_chains_get_nf_ft_chain(struct mlx5_fs_chains *chains) · 120 unmodified lines
121 121
122u32 mlx5_chains_get_prio_range(struct mlx5_fs_chains *chains)122u32 mlx5_chains_get_prio_range(struct mlx5_fs_chains *chains)
123{123{
124 if (!mlx5_chains_prios_supported(chains))
125 return 1;
126
127 if (mlx5_chains_ignore_flow_level_supported(chains))124 if (mlx5_chains_ignore_flow_level_supported(chains))
128 return UINT_MAX;125 return UINT_MAX;
129 126
127 if (!chains->dev->priv.eswitch ||
128 chains->dev->priv.eswitch->mode != MLX5_ESWITCH_OFFLOADS)
129 return 1;
130
130 /* We should get here only for eswitch case */131 /* We should get here only for eswitch case */
131 return FDB_TC_MAX_PRIO;132 return FDB_TC_MAX_PRIO;
132}133}
@@ -211,7 +212,7 @@ static int · 78 unmodified lines
211create_chain_restore(struct fs_chain *chain)212create_chain_restore(struct fs_chain *chain)
212{213{
213 struct mlx5_eswitch *esw = chain->chains->dev->priv.eswitch;214 struct mlx5_eswitch *esw = chain->chains->dev->priv.eswitch;
214 char modact[MLX5_UN_SZ_BYTES(set_add_copy_action_in_auto)];215 u8 modact[MLX5_UN_SZ_BYTES(set_add_copy_action_in_auto)] = {};
215 struct mlx5_fs_chains *chains = chain->chains;216 struct mlx5_fs_chains *chains = chain->chains;
216 enum mlx5e_tc_attr_to_reg chain_to_reg;217 enum mlx5e_tc_attr_to_reg chain_to_reg;
217 struct mlx5_modify_hdr *mod_hdr;218 struct mlx5_modify_hdr *mod_hdr;
drivers/net/ethernet/mellanox/mlx5/core/port.c+5−4
@@ -406,23 +406,24 @@ int mlx5_query_module_eeprom(struct mlx5_core_dev *dev, · 405 unmodified lines
406 406
407 switch (module_id) {407 switch (module_id) {
408 case MLX5_MODULE_ID_SFP:408 case MLX5_MODULE_ID_SFP:
409 mlx5_sfp_eeprom_params_set(&query.i2c_address, &query.page, &query.offset);409 mlx5_sfp_eeprom_params_set(&query.i2c_address, &query.page, &offset);
410 break;410 break;
411 case MLX5_MODULE_ID_QSFP:411 case MLX5_MODULE_ID_QSFP:
412 case MLX5_MODULE_ID_QSFP_PLUS:412 case MLX5_MODULE_ID_QSFP_PLUS:
413 case MLX5_MODULE_ID_QSFP28:413 case MLX5_MODULE_ID_QSFP28:
414 mlx5_qsfp_eeprom_params_set(&query.i2c_address, &query.page, &query.offset);414 mlx5_qsfp_eeprom_params_set(&query.i2c_address, &query.page, &offset);
415 break;415 break;
416 default:416 default:
417 mlx5_core_err(dev, "Module ID not recognized: 0x%x\n", module_id);417 mlx5_core_err(dev, "Module ID not recognized: 0x%x\n", module_id);
418 return -EINVAL;418 return -EINVAL;
419 }419 }
420 420
421 if (query.offset + size > MLX5_EEPROM_PAGE_LENGTH)421 if (offset + size > MLX5_EEPROM_PAGE_LENGTH)
422 /* Cross pages read, read until offset 256 in low page */422 /* Cross pages read, read until offset 256 in low page */
423 size -= offset + size - MLX5_EEPROM_PAGE_LENGTH;423 size = MLX5_EEPROM_PAGE_LENGTH - offset;
424 424
425 query.size = size;425 query.size = size;
426 query.offset = offset;
426 427
427 return mlx5_query_mcia(dev, &query, data);428 return mlx5_query_mcia(dev, &query, data);
428}429}
drivers/net/ethernet/microchip/sparx5/sparx5_packet.c+1−1
@@ -145,9 +145,9 @@ static void sparx5_xtr_grp(struct sparx5 *sparx5, u8 grp, bool byte_swap) · 144 unmodified lines
145 skb_put(skb, byte_cnt - ETH_FCS_LEN);145 skb_put(skb, byte_cnt - ETH_FCS_LEN);
146 eth_skb_pad(skb);146 eth_skb_pad(skb);
147 skb->protocol = eth_type_trans(skb, netdev);147 skb->protocol = eth_type_trans(skb, netdev);
148 netif_rx(skb);
149 netdev->stats.rx_bytes += skb->len;148 netdev->stats.rx_bytes += skb->len;
150 netdev->stats.rx_packets++;149 netdev->stats.rx_packets++;
150 netif_rx(skb);
151}151}
152 152
153static int sparx5_inject(struct sparx5 *sparx5,153static int sparx5_inject(struct sparx5 *sparx5,
drivers/net/ethernet/smsc/smc911x.c+4−4
@@ -1648,7 +1648,7 @@ static int smc911x_ethtool_geteeprom(struct net_device *dev, · 1647 unmodified lines
1648 return ret;1648 return ret;
1649 if ((ret=smc911x_ethtool_read_eeprom_byte(dev, &eebuf[i]))!=0)1649 if ((ret=smc911x_ethtool_read_eeprom_byte(dev, &eebuf[i]))!=0)
1650 return ret;1650 return ret;
1651 }1651 }
1652 memcpy(data, eebuf+eeprom->offset, eeprom->len);1652 memcpy(data, eebuf+eeprom->offset, eeprom->len);
1653 return 0;1653 return 0;
1654}1654}
@@ -1667,11 +1667,11 @@ static int smc911x_ethtool_seteeprom(struct net_device *dev, · 12 unmodified lines
1667 return ret;1667 return ret;
1668 /* write byte */1668 /* write byte */
1669 if ((ret=smc911x_ethtool_write_eeprom_byte(dev, *data))!=0)1669 if ((ret=smc911x_ethtool_write_eeprom_byte(dev, *data))!=0)
1670 return ret;1670 return ret;
1671 if ((ret=smc911x_ethtool_write_eeprom_cmd(dev, E2P_CMD_EPC_CMD_WRITE_, i ))!=0)1671 if ((ret=smc911x_ethtool_write_eeprom_cmd(dev, E2P_CMD_EPC_CMD_WRITE_, i ))!=0)
1672 return ret;1672 return ret;
1673 }1673 }
1674 return 0;1674 return 0;
1675}1675}
1676 1676
1677static int smc911x_ethtool_geteeprom_len(struct net_device *dev)1677static int smc911x_ethtool_geteeprom_len(struct net_device *dev)
drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c+7−2
@@ -49,13 +49,15 @@ struct visconti_eth { · 48 unmodified lines
49 void __iomem *reg;49 void __iomem *reg;
50 u32 phy_intf_sel;50 u32 phy_intf_sel;
51 struct clk *phy_ref_clk;51 struct clk *phy_ref_clk;
52 struct device *dev;
52 spinlock_t lock; /* lock to protect register update */53 spinlock_t lock; /* lock to protect register update */
53};54};
54 55
55static void visconti_eth_fix_mac_speed(void *priv, unsigned int speed)56static void visconti_eth_fix_mac_speed(void *priv, unsigned int speed)
56{57{
57 struct visconti_eth *dwmac = priv;58 struct visconti_eth *dwmac = priv;
58 unsigned int val, clk_sel_val;59 struct net_device *netdev = dev_get_drvdata(dwmac->dev);
60 unsigned int val, clk_sel_val = 0;
59 unsigned long flags;61 unsigned long flags;
60 62
61 spin_lock_irqsave(&dwmac->lock, flags);63 spin_lock_irqsave(&dwmac->lock, flags);
@@ -85,7 +87,9 @@ static void visconti_eth_fix_mac_speed(void *priv, unsigned int speed) · 23 unmodified lines
85 break;87 break;
86 default:88 default:
87 /* No bit control */89 /* No bit control */
88 break;90 netdev_err(netdev, "Unsupported speed request (%d)", speed);
91 spin_unlock_irqrestore(&dwmac->lock, flags);
92 return;
89 }93 }
90 94
91 writel(val, dwmac->reg + MAC_CTRL_REG);95 writel(val, dwmac->reg + MAC_CTRL_REG);
@@ -229,6 +233,7 @@ static int visconti_eth_dwmac_probe(struct platform_device *pdev) · 137 unmodified lines
229 233
230 spin_lock_init(&dwmac->lock);234 spin_lock_init(&dwmac->lock);
231 dwmac->reg = stmmac_res.addr;235 dwmac->reg = stmmac_res.addr;
236 dwmac->dev = &pdev->dev;
232 plat_dat->bsp_priv = dwmac;237 plat_dat->bsp_priv = dwmac;
233 plat_dat->fix_mac_speed = visconti_eth_fix_mac_speed;238 plat_dat->fix_mac_speed = visconti_eth_fix_mac_speed;
234 239
drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h+1−0
@@ -150,6 +150,7 @@ · 149 unmodified lines
150 150
151#define NUM_DWMAC100_DMA_REGS 9151#define NUM_DWMAC100_DMA_REGS 9
152#define NUM_DWMAC1000_DMA_REGS 23152#define NUM_DWMAC1000_DMA_REGS 23
153#define NUM_DWMAC4_DMA_REGS 27
153 154
154void dwmac_enable_dma_transmission(void __iomem *ioaddr);155void dwmac_enable_dma_transmission(void __iomem *ioaddr);
155void dwmac_enable_dma_irq(void __iomem *ioaddr, u32 chan, bool rx, bool tx);156void dwmac_enable_dma_irq(void __iomem *ioaddr, u32 chan, bool rx, bool tx);
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c+17−2
@@ -21,10 +21,18 @@ · 20 unmodified lines
21#include "dwxgmac2.h"21#include "dwxgmac2.h"
22 22
23#define REG_SPACE_SIZE 0x106023#define REG_SPACE_SIZE 0x1060
24#define GMAC4_REG_SPACE_SIZE 0x116C
24#define MAC100_ETHTOOL_NAME "st_mac100"25#define MAC100_ETHTOOL_NAME "st_mac100"
25#define GMAC_ETHTOOL_NAME "st_gmac"26#define GMAC_ETHTOOL_NAME "st_gmac"
26#define XGMAC_ETHTOOL_NAME "st_xgmac"27#define XGMAC_ETHTOOL_NAME "st_xgmac"
27 28
29/* Same as DMA_CHAN_BASE_ADDR defined in dwmac4_dma.h
30 *
31 * It is here because dwmac_dma.h and dwmac4_dam.h can not be included at the
32 * same time due to the conflicting macro names.
33 */
34#define GMAC4_DMA_CHAN_BASE_ADDR 0x00001100
35
28#define ETHTOOL_DMA_OFFSET 5536#define ETHTOOL_DMA_OFFSET 55
29 37
30struct stmmac_stats {38struct stmmac_stats {
@@ -434,6 +442,8 @@ static int stmmac_ethtool_get_regs_len(struct net_device *dev) · 403 unmodified lines
434 442
435 if (priv->plat->has_xgmac)443 if (priv->plat->has_xgmac)
436 return XGMAC_REGSIZE * 4;444 return XGMAC_REGSIZE * 4;
445 else if (priv->plat->has_gmac4)
446 return GMAC4_REG_SPACE_SIZE;
437 return REG_SPACE_SIZE;447 return REG_SPACE_SIZE;
438}448}
439 449
@@ -446,8 +456,13 @@ static void stmmac_ethtool_gregs(struct net_device *dev, · 6 unmodified lines
446 stmmac_dump_mac_regs(priv, priv->hw, reg_space);456 stmmac_dump_mac_regs(priv, priv->hw, reg_space);
447 stmmac_dump_dma_regs(priv, priv->ioaddr, reg_space);457 stmmac_dump_dma_regs(priv, priv->ioaddr, reg_space);
448 458
449 if (!priv->plat->has_xgmac) {459 /* Copy DMA registers to where ethtool expects them */
450 /* Copy DMA registers to where ethtool expects them */460 if (priv->plat->has_gmac4) {
461 /* GMAC4 dumps its DMA registers at its DMA_CHAN_BASE_ADDR */
462 memcpy(&reg_space[ETHTOOL_DMA_OFFSET],
463 &reg_space[GMAC4_DMA_CHAN_BASE_ADDR / 4],
464 NUM_DWMAC4_DMA_REGS * 4);
465 } else if (!priv->plat->has_xgmac) {
451 memcpy(&reg_space[ETHTOOL_DMA_OFFSET],466 memcpy(&reg_space[ETHTOOL_DMA_OFFSET],
452 &reg_space[DMA_BUS_MODE / 4],467 &reg_space[DMA_BUS_MODE / 4],
453 NUM_DWMAC1000_DMA_REGS * 4);468 NUM_DWMAC1000_DMA_REGS * 4);
drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c+12−7
@@ -145,15 +145,20 @@ static int adjust_systime(void __iomem *ioaddr, u32 sec, u32 nsec, · 144 unmodified lines
145 145
146static void get_systime(void __iomem *ioaddr, u64 *systime)146static void get_systime(void __iomem *ioaddr, u64 *systime)
147{147{
148 u64 ns;148 u64 ns, sec0, sec1;
149 149
150 /* Get the TSSS value */150 /* Get the TSS value */
151 ns = readl(ioaddr + PTP_STNSR);151 sec1 = readl_relaxed(ioaddr + PTP_STSR);
152 /* Get the TSS and convert sec time value to nanosecond */152 do {
153 ns += readl(ioaddr + PTP_STSR) * 1000000000ULL;153 sec0 = sec1;
154 /* Get the TSSS value */
155 ns = readl_relaxed(ioaddr + PTP_STNSR);
156 /* Get the TSS value */
157 sec1 = readl_relaxed(ioaddr + PTP_STSR);
158 } while (sec0 != sec1);
154 159
155 if (systime)160 if (systime)
156 *systime = ns;161 *systime = ns + (sec1 * 1000000000ULL);
157}162}
158 163
159static void get_ptptime(void __iomem *ptpaddr, u64 *ptp_time)164static void get_ptptime(void __iomem *ptpaddr, u64 *ptp_time)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+4−2
@@ -7252,6 +7252,10 @@ int stmmac_dvr_remove(struct device *dev) · 7251 unmodified lines
7252 7252
7253 netdev_info(priv->dev, "%s: removing driver", __func__);7253 netdev_info(priv->dev, "%s: removing driver", __func__);
7254 7254
7255 pm_runtime_get_sync(dev);
7256 pm_runtime_disable(dev);
7257 pm_runtime_put_noidle(dev);
7258
7255 stmmac_stop_all_dma(priv);7259 stmmac_stop_all_dma(priv);
7256 stmmac_mac_set(priv, priv->ioaddr, false);7260 stmmac_mac_set(priv, priv->ioaddr, false);
7257 netif_carrier_off(ndev);7261 netif_carrier_off(ndev);
@@ -7270,8 +7274,6 @@ int stmmac_dvr_remove(struct device *dev) · 12 unmodified lines
7270 if (priv->plat->stmmac_rst)7274 if (priv->plat->stmmac_rst)
7271 reset_control_assert(priv->plat->stmmac_rst);7275 reset_control_assert(priv->plat->stmmac_rst);
7272 reset_control_assert(priv->plat->stmmac_ahb_rst);7276 reset_control_assert(priv->plat->stmmac_ahb_rst);
7273 pm_runtime_put(dev);
7274 pm_runtime_disable(dev);
7275 if (priv->hw->pcs != STMMAC_PCS_TBI &&7277 if (priv->hw->pcs != STMMAC_PCS_TBI &&
7276 priv->hw->pcs != STMMAC_PCS_RTBI)7278 priv->hw->pcs != STMMAC_PCS_RTBI)
7277 stmmac_mdio_unregister(ndev);7279 stmmac_mdio_unregister(ndev);
drivers/net/ieee802154/at86rf230.c+11−2
@@ -100,6 +100,7 @@ struct at86rf230_local { · 99 unmodified lines
100 unsigned long cal_timeout;100 unsigned long cal_timeout;
101 bool is_tx;101 bool is_tx;
102 bool is_tx_from_off;102 bool is_tx_from_off;
103 bool was_tx;
103 u8 tx_retry;104 u8 tx_retry;
104 struct sk_buff *tx_skb;105 struct sk_buff *tx_skb;
105 struct at86rf230_state_change tx;106 struct at86rf230_state_change tx;
@@ -343,7 +344,11 @@ at86rf230_async_error_recover_complete(void *context) · 237 unmodified lines
343 if (ctx->free)344 if (ctx->free)
344 kfree(ctx);345 kfree(ctx);
345 346
346 ieee802154_wake_queue(lp->hw);347 if (lp->was_tx) {
348 lp->was_tx = 0;
349 dev_kfree_skb_any(lp->tx_skb);
350 ieee802154_wake_queue(lp->hw);
351 }
347}352}
348 353
349static void354static void
@@ -352,7 +357,11 @@ at86rf230_async_error_recover(void *context) · 2 unmodified lines
352 struct at86rf230_state_change *ctx = context;357 struct at86rf230_state_change *ctx = context;
353 struct at86rf230_local *lp = ctx->lp;358 struct at86rf230_local *lp = ctx->lp;
354 359
355 lp->is_tx = 0;360 if (lp->is_tx) {
361 lp->was_tx = 1;
362 lp->is_tx = 0;
363 }
364
356 at86rf230_async_state_change(lp, ctx, STATE_RX_AACK_ON,365 at86rf230_async_state_change(lp, ctx, STATE_RX_AACK_ON,
357 at86rf230_async_error_recover_complete);366 at86rf230_async_error_recover_complete);
358}367}
drivers/net/ieee802154/ca8210.c+1−0
@@ -1771,6 +1771,7 @@ static int ca8210_async_xmit_complete( · 1770 unmodified lines
1771 status1771 status
1772 );1772 );
1773 if (status != MAC_TRANSACTION_OVERFLOW) {1773 if (status != MAC_TRANSACTION_OVERFLOW) {
1774 dev_kfree_skb_any(priv->tx_skb);
1774 ieee802154_wake_queue(priv->hw);1775 ieee802154_wake_queue(priv->hw);
1775 return 0;1776 return 0;
1776 }1777 }
drivers/net/ieee802154/mac802154_hwsim.c+1−0
@@ -786,6 +786,7 @@ static int hwsim_add_one(struct genl_info *info, struct device *dev, · 785 unmodified lines
786 goto err_pib;786 goto err_pib;
787 }787 }
788 788
789 pib->channel = 13;
789 rcu_assign_pointer(phy->pib, pib);790 rcu_assign_pointer(phy->pib, pib);
790 phy->idx = idx;791 phy->idx = idx;
791 INIT_LIST_HEAD(&phy->edges);792 INIT_LIST_HEAD(&phy->edges);
drivers/net/ieee802154/mcr20a.c+2−2
@@ -976,8 +976,8 @@ static void mcr20a_hw_setup(struct mcr20a_local *lp) · 975 unmodified lines
976 dev_dbg(printdev(lp), "%s\n", __func__);976 dev_dbg(printdev(lp), "%s\n", __func__);
977 977
978 phy->symbol_duration = 16;978 phy->symbol_duration = 16;
979 phy->lifs_period = 40;979 phy->lifs_period = 40 * phy->symbol_duration;
980 phy->sifs_period = 12;980 phy->sifs_period = 12 * phy->symbol_duration;
981 981
982 hw->flags = IEEE802154_HW_TX_OMIT_CKSUM |982 hw->flags = IEEE802154_HW_TX_OMIT_CKSUM |
983 IEEE802154_HW_AFILT |983 IEEE802154_HW_AFILT |
drivers/net/ipa/ipa_power.c+52−0
@@ -11,6 +11,8 @@ · 10 unmodified lines
11#include <linux/pm_runtime.h>11#include <linux/pm_runtime.h>
12#include <linux/bitops.h>12#include <linux/bitops.h>
13 13
14#include "linux/soc/qcom/qcom_aoss.h"
15
14#include "ipa.h"16#include "ipa.h"
15#include "ipa_power.h"17#include "ipa_power.h"
16#include "ipa_endpoint.h"18#include "ipa_endpoint.h"
@@ -64,6 +66,7 @@ enum ipa_power_flag { · 47 unmodified lines
64 * struct ipa_power - IPA power management information66 * struct ipa_power - IPA power management information
65 * @dev: IPA device pointer67 * @dev: IPA device pointer
66 * @core: IPA core clock68 * @core: IPA core clock
69 * @qmp: QMP handle for AOSS communication
67 * @spinlock: Protects modem TX queue enable/disable70 * @spinlock: Protects modem TX queue enable/disable
68 * @flags: Boolean state flags71 * @flags: Boolean state flags
69 * @interconnect_count: Number of elements in interconnect[]72 * @interconnect_count: Number of elements in interconnect[]
@@ -72,6 +75,7 @@ enum ipa_power_flag { · 2 unmodified lines
72struct ipa_power {75struct ipa_power {
73 struct device *dev;76 struct device *dev;
74 struct clk *core;77 struct clk *core;
78 struct qmp *qmp;
75 spinlock_t spinlock; /* used with STOPPED/STARTED power flags */79 spinlock_t spinlock; /* used with STOPPED/STARTED power flags */
76 DECLARE_BITMAP(flags, IPA_POWER_FLAG_COUNT);80 DECLARE_BITMAP(flags, IPA_POWER_FLAG_COUNT);
77 u32 interconnect_count;81 u32 interconnect_count;
@@ -382,6 +386,47 @@ void ipa_power_modem_queue_active(struct ipa *ipa) · 304 unmodified lines
382 clear_bit(IPA_POWER_FLAG_STARTED, ipa->power->flags);386 clear_bit(IPA_POWER_FLAG_STARTED, ipa->power->flags);
383}387}
384 388
389static int ipa_power_retention_init(struct ipa_power *power)
390{
391 struct qmp *qmp = qmp_get(power->dev);
392
393 if (IS_ERR(qmp)) {
394 if (PTR_ERR(qmp) == -EPROBE_DEFER)
395 return -EPROBE_DEFER;
396
397 /* We assume any other error means it's not defined/needed */
398 qmp = NULL;
399 }
400 power->qmp = qmp;
401
402 return 0;
403}
404
405static void ipa_power_retention_exit(struct ipa_power *power)
406{
407 qmp_put(power->qmp);
408 power->qmp = NULL;
409}
410
411/* Control register retention on power collapse */
412void ipa_power_retention(struct ipa *ipa, bool enable)
413{
414 static const char fmt[] = "{ class: bcm, res: ipa_pc, val: %c }";
415 struct ipa_power *power = ipa->power;
416 char buf[36]; /* Exactly enough for fmt[]; size a multiple of 4 */
417 int ret;
418
419 if (!power->qmp)
420 return; /* Not needed on this platform */
421
422 (void)snprintf(buf, sizeof(buf), fmt, enable ? '1' : '0');
423
424 ret = qmp_send(power->qmp, buf, sizeof(buf));
425 if (ret)
426 dev_err(power->dev, "error %d sending QMP %sable request\n",
427 ret, enable ? "en" : "dis");
428}
429
385int ipa_power_setup(struct ipa *ipa)430int ipa_power_setup(struct ipa *ipa)
386{431{
387 int ret;432 int ret;
@@ -438,12 +483,18 @@ ipa_power_init(struct device *dev, const struct ipa_power_data *data) · 50 unmodified lines
438 if (ret)483 if (ret)
439 goto err_kfree;484 goto err_kfree;
440 485
486 ret = ipa_power_retention_init(power);
487 if (ret)
488 goto err_interconnect_exit;
489
441 pm_runtime_set_autosuspend_delay(dev, IPA_AUTOSUSPEND_DELAY);490 pm_runtime_set_autosuspend_delay(dev, IPA_AUTOSUSPEND_DELAY);
442 pm_runtime_use_autosuspend(dev);491 pm_runtime_use_autosuspend(dev);
443 pm_runtime_enable(dev);492 pm_runtime_enable(dev);
444 493
445 return power;494 return power;
446 495
496err_interconnect_exit:
497 ipa_interconnect_exit(power);
447err_kfree:498err_kfree:
448 kfree(power);499 kfree(power);
449err_clk_put:500err_clk_put:
@@ -460,6 +511,7 @@ void ipa_power_exit(struct ipa_power *power) · 10 unmodified lines
460 511
461 pm_runtime_disable(dev);512 pm_runtime_disable(dev);
462 pm_runtime_dont_use_autosuspend(dev);513 pm_runtime_dont_use_autosuspend(dev);
514 ipa_power_retention_exit(power);
463 ipa_interconnect_exit(power);515 ipa_interconnect_exit(power);
464 kfree(power);516 kfree(power);
465 clk_put(clk);517 clk_put(clk);
drivers/net/ipa/ipa_power.h+7−0
@@ -40,6 +40,13 @@ void ipa_power_modem_queue_wake(struct ipa *ipa); · 39 unmodified lines
40 */40 */
41void ipa_power_modem_queue_active(struct ipa *ipa);41void ipa_power_modem_queue_active(struct ipa *ipa);
42 42
43/**
44 * ipa_power_retention() - Control register retention on power collapse
45 * @ipa: IPA pointer
46 * @enable: Whether retention should be enabled or disabled
47 */
48void ipa_power_retention(struct ipa *ipa, bool enable);
49
43/**50/**
44 * ipa_power_setup() - Set up IPA power management51 * ipa_power_setup() - Set up IPA power management
45 * @ipa: IPA pointer52 * @ipa: IPA pointer
drivers/net/ipa/ipa_uc.c+5−0
@@ -11,6 +11,7 @@ · 10 unmodified lines
11 11
12#include "ipa.h"12#include "ipa.h"
13#include "ipa_uc.h"13#include "ipa_uc.h"
14#include "ipa_power.h"
14 15
15/**16/**
16 * DOC: The IPA embedded microcontroller17 * DOC: The IPA embedded microcontroller
@@ -154,6 +155,7 @@ static void ipa_uc_response_hdlr(struct ipa *ipa, enum ipa_irq_id irq_id) · 137 unmodified lines
154 case IPA_UC_RESPONSE_INIT_COMPLETED:155 case IPA_UC_RESPONSE_INIT_COMPLETED:
155 if (ipa->uc_powered) {156 if (ipa->uc_powered) {
156 ipa->uc_loaded = true;157 ipa->uc_loaded = true;
158 ipa_power_retention(ipa, true);
157 pm_runtime_mark_last_busy(dev);159 pm_runtime_mark_last_busy(dev);
158 (void)pm_runtime_put_autosuspend(dev);160 (void)pm_runtime_put_autosuspend(dev);
159 ipa->uc_powered = false;161 ipa->uc_powered = false;
@@ -184,6 +186,9 @@ void ipa_uc_deconfig(struct ipa *ipa) · 24 unmodified lines
184 186
185 ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_1);187 ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_1);
186 ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_0);188 ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_0);
189 if (ipa->uc_loaded)
190 ipa_power_retention(ipa, false);
191
187 if (!ipa->uc_powered)192 if (!ipa->uc_powered)
188 return;193 return;
189 194
drivers/net/macsec.c+21−12
@@ -3870,6 +3870,18 @@ static void macsec_common_dellink(struct net_device *dev, struct list_head *head · 3869 unmodified lines
3870 struct macsec_dev *macsec = macsec_priv(dev);3870 struct macsec_dev *macsec = macsec_priv(dev);
3871 struct net_device *real_dev = macsec->real_dev;3871 struct net_device *real_dev = macsec->real_dev;
3872 3872
3873 /* If h/w offloading is available, propagate to the device */
3874 if (macsec_is_offloaded(macsec)) {
3875 const struct macsec_ops *ops;
3876 struct macsec_context ctx;
3877
3878 ops = macsec_get_ops(netdev_priv(dev), &ctx);
3879 if (ops) {
3880 ctx.secy = &macsec->secy;
3881 macsec_offload(ops->mdo_del_secy, &ctx);
3882 }
3883 }
3884
3873 unregister_netdevice_queue(dev, head);3885 unregister_netdevice_queue(dev, head);
3874 list_del_rcu(&macsec->secys);3886 list_del_rcu(&macsec->secys);
3875 macsec_del_dev(macsec);3887 macsec_del_dev(macsec);
@@ -3884,18 +3896,6 @@ static void macsec_dellink(struct net_device *dev, struct list_head *head) · 8 unmodified lines
3884 struct net_device *real_dev = macsec->real_dev;3896 struct net_device *real_dev = macsec->real_dev;
3885 struct macsec_rxh_data *rxd = macsec_data_rtnl(real_dev);3897 struct macsec_rxh_data *rxd = macsec_data_rtnl(real_dev);
3886 3898
3887 /* If h/w offloading is available, propagate to the device */
3888 if (macsec_is_offloaded(macsec)) {
3889 const struct macsec_ops *ops;
3890 struct macsec_context ctx;
3891
3892 ops = macsec_get_ops(netdev_priv(dev), &ctx);
3893 if (ops) {
3894 ctx.secy = &macsec->secy;
3895 macsec_offload(ops->mdo_del_secy, &ctx);
3896 }
3897 }
3898
3899 macsec_common_dellink(dev, head);3899 macsec_common_dellink(dev, head);
3900 3900
3901 if (list_empty(&rxd->secys)) {3901 if (list_empty(&rxd->secys)) {
@@ -4018,6 +4018,15 @@ static int macsec_newlink(struct net *net, struct net_device *dev, · 116 unmodified lines
4018 !macsec_check_offload(macsec->offload, macsec))4018 !macsec_check_offload(macsec->offload, macsec))
4019 return -EOPNOTSUPP;4019 return -EOPNOTSUPP;
4020 4020
4021 /* send_sci must be set to true when transmit sci explicitly is set */
4022 if ((data && data[IFLA_MACSEC_SCI]) &&
4023 (data && data[IFLA_MACSEC_INC_SCI])) {
4024 u8 send_sci = !!nla_get_u8(data[IFLA_MACSEC_INC_SCI]);
4025
4026 if (!send_sci)
4027 return -EINVAL;
4028 }
4029
4021 if (data && data[IFLA_MACSEC_ICV_LEN])4030 if (data && data[IFLA_MACSEC_ICV_LEN])
4022 icv_len = nla_get_u8(data[IFLA_MACSEC_ICV_LEN]);4031 icv_len = nla_get_u8(data[IFLA_MACSEC_ICV_LEN]);
4023 mtu = real_dev->mtu - icv_len - macsec_extra_len(true);4032 mtu = real_dev->mtu - icv_len - macsec_extra_len(true);
drivers/net/phy/at803x.c+13−13
@@ -1688,19 +1688,19 @@ static int qca808x_read_status(struct phy_device *phydev) · 1687 unmodified lines
1688 if (ret < 0)1688 if (ret < 0)
1689 return ret;1689 return ret;
1690 1690
1691 if (phydev->link && phydev->speed == SPEED_2500)1691 if (phydev->link) {
1692 phydev->interface = PHY_INTERFACE_MODE_2500BASEX;1692 if (phydev->speed == SPEED_2500)
1693 else1693 phydev->interface = PHY_INTERFACE_MODE_2500BASEX;
1694 phydev->interface = PHY_INTERFACE_MODE_SMII;1694 else
1695 1695 phydev->interface = PHY_INTERFACE_MODE_SGMII;
1696 /* generate seed as a lower random value to make PHY linked as SLAVE easily,1696 } else {
1697 * except for master/slave configuration fault detected.1697 /* generate seed as a lower random value to make PHY linked as SLAVE easily,
1698 * the reason for not putting this code into the function link_change_notify is1698 * except for master/slave configuration fault detected.
1699 * the corner case where the link partner is also the qca8081 PHY and the seed1699 * the reason for not putting this code into the function link_change_notify is
1700 * value is configured as the same value, the link can't be up and no link change1700 * the corner case where the link partner is also the qca8081 PHY and the seed
1701 * occurs.1701 * value is configured as the same value, the link can't be up and no link change
1702 */1702 * occurs.
1703 if (!phydev->link) {1703 */
1704 if (phydev->master_slave_state == MASTER_SLAVE_STATE_ERR) {1704 if (phydev->master_slave_state == MASTER_SLAVE_STATE_ERR) {
1705 qca808x_phy_ms_seed_enable(phydev, false);1705 qca808x_phy_ms_seed_enable(phydev, false);
1706 } else {1706 } else {
drivers/net/usb/ipheth.c+3−3
@@ -121,7 +121,7 @@ static int ipheth_alloc_urbs(struct ipheth_device *iphone) · 120 unmodified lines
121 if (tx_buf == NULL)121 if (tx_buf == NULL)
122 goto free_rx_urb;122 goto free_rx_urb;
123 123
124 rx_buf = usb_alloc_coherent(iphone->udev, IPHETH_BUF_SIZE,124 rx_buf = usb_alloc_coherent(iphone->udev, IPHETH_BUF_SIZE + IPHETH_IP_ALIGN,
125 GFP_KERNEL, &rx_urb->transfer_dma);125 GFP_KERNEL, &rx_urb->transfer_dma);
126 if (rx_buf == NULL)126 if (rx_buf == NULL)
127 goto free_tx_buf;127 goto free_tx_buf;
@@ -146,7 +146,7 @@ error_nomem: · 18 unmodified lines
146 146
147static void ipheth_free_urbs(struct ipheth_device *iphone)147static void ipheth_free_urbs(struct ipheth_device *iphone)
148{148{
149 usb_free_coherent(iphone->udev, IPHETH_BUF_SIZE, iphone->rx_buf,149 usb_free_coherent(iphone->udev, IPHETH_BUF_SIZE + IPHETH_IP_ALIGN, iphone->rx_buf,
150 iphone->rx_urb->transfer_dma);150 iphone->rx_urb->transfer_dma);
151 usb_free_coherent(iphone->udev, IPHETH_BUF_SIZE, iphone->tx_buf,151 usb_free_coherent(iphone->udev, IPHETH_BUF_SIZE, iphone->tx_buf,
152 iphone->tx_urb->transfer_dma);152 iphone->tx_urb->transfer_dma);
@@ -317,7 +317,7 @@ static int ipheth_rx_submit(struct ipheth_device *dev, gfp_t mem_flags) · 164 unmodified lines
317 317
318 usb_fill_bulk_urb(dev->rx_urb, udev,318 usb_fill_bulk_urb(dev->rx_urb, udev,
319 usb_rcvbulkpipe(udev, dev->bulk_in),319 usb_rcvbulkpipe(udev, dev->bulk_in),
320 dev->rx_buf, IPHETH_BUF_SIZE,320 dev->rx_buf, IPHETH_BUF_SIZE + IPHETH_IP_ALIGN,
321 ipheth_rcvbulk_callback,321 ipheth_rcvbulk_callback,
322 dev);322 dev);
323 dev->rx_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;323 dev->rx_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
drivers/nvme/host/core.c+8−1
@@ -4253,7 +4253,14 @@ static void nvme_async_event_work(struct work_struct *work) · 4252 unmodified lines
4253 container_of(work, struct nvme_ctrl, async_event_work);4253 container_of(work, struct nvme_ctrl, async_event_work);
4254 4254
4255 nvme_aen_uevent(ctrl);4255 nvme_aen_uevent(ctrl);
4256 ctrl->ops->submit_async_event(ctrl);4256
4257 /*
4258 * The transport drivers must guarantee AER submission here is safe by
4259 * flushing ctrl async_event_work after changing the controller state
4260 * from LIVE and before freeing the admin queue.
4261 */
4262 if (ctrl->state == NVME_CTRL_LIVE)
4263 ctrl->ops->submit_async_event(ctrl);
4257}4264}
4258 4265
4259static bool nvme_ctrl_pp_status(struct nvme_ctrl *ctrl)4266static bool nvme_ctrl_pp_status(struct nvme_ctrl *ctrl)
drivers/nvme/host/fabrics.h+1−0
@@ -170,6 +170,7 @@ nvmf_ctlr_matches_baseopts(struct nvme_ctrl *ctrl, · 169 unmodified lines
170 struct nvmf_ctrl_options *opts)170 struct nvmf_ctrl_options *opts)
171{171{
172 if (ctrl->state == NVME_CTRL_DELETING ||172 if (ctrl->state == NVME_CTRL_DELETING ||
173 ctrl->state == NVME_CTRL_DELETING_NOIO ||
173 ctrl->state == NVME_CTRL_DEAD ||174 ctrl->state == NVME_CTRL_DEAD ||
174 strcmp(opts->subsysnqn, ctrl->opts->subsysnqn) ||175 strcmp(opts->subsysnqn, ctrl->opts->subsysnqn) ||
175 strcmp(opts->host->nqn, ctrl->opts->host->nqn) ||176 strcmp(opts->host->nqn, ctrl->opts->host->nqn) ||
drivers/nvme/host/rdma.c+1−0
@@ -1200,6 +1200,7 @@ static void nvme_rdma_error_recovery_work(struct work_struct *work) · 1199 unmodified lines
1200 struct nvme_rdma_ctrl, err_work);1200 struct nvme_rdma_ctrl, err_work);
1201 1201
1202 nvme_stop_keep_alive(&ctrl->ctrl);1202 nvme_stop_keep_alive(&ctrl->ctrl);
1203 flush_work(&ctrl->ctrl.async_event_work);
1203 nvme_rdma_teardown_io_queues(ctrl, false);1204 nvme_rdma_teardown_io_queues(ctrl, false);
1204 nvme_start_queues(&ctrl->ctrl);1205 nvme_start_queues(&ctrl->ctrl);
1205 nvme_rdma_teardown_admin_queue(ctrl, false);1206 nvme_rdma_teardown_admin_queue(ctrl, false);
drivers/nvme/host/tcp.c+1−0
@@ -2096,6 +2096,7 @@ static void nvme_tcp_error_recovery_work(struct work_struct *work) · 2095 unmodified lines
2096 struct nvme_ctrl *ctrl = &tcp_ctrl->ctrl;2096 struct nvme_ctrl *ctrl = &tcp_ctrl->ctrl;
2097 2097
2098 nvme_stop_keep_alive(ctrl);2098 nvme_stop_keep_alive(ctrl);
2099 flush_work(&ctrl->async_event_work);
2099 nvme_tcp_teardown_io_queues(ctrl, false);2100 nvme_tcp_teardown_io_queues(ctrl, false);
2100 /* unquiesce to fail fast pending requests */2101 /* unquiesce to fail fast pending requests */
2101 nvme_start_queues(ctrl);2102 nvme_start_queues(ctrl);
drivers/pci/controller/cadence/pci-j721e.c+42−43
@@ -356,8 +356,8 @@ static int j721e_pcie_probe(struct platform_device *pdev) · 355 unmodified lines
356 const struct j721e_pcie_data *data;356 const struct j721e_pcie_data *data;
357 struct cdns_pcie *cdns_pcie;357 struct cdns_pcie *cdns_pcie;
358 struct j721e_pcie *pcie;358 struct j721e_pcie *pcie;
359 struct cdns_pcie_rc *rc;359 struct cdns_pcie_rc *rc = NULL;
360 struct cdns_pcie_ep *ep;360 struct cdns_pcie_ep *ep = NULL;
361 struct gpio_desc *gpiod;361 struct gpio_desc *gpiod;
362 void __iomem *base;362 void __iomem *base;
363 struct clk *clk;363 struct clk *clk;
@@ -376,6 +376,46 @@ static int j721e_pcie_probe(struct platform_device *pdev) · 12 unmodified lines
376 if (!pcie)376 if (!pcie)
377 return -ENOMEM;377 return -ENOMEM;
378 378
379 switch (mode) {
380 case PCI_MODE_RC:
381 if (!IS_ENABLED(CONFIG_PCIE_CADENCE_HOST))
382 return -ENODEV;
383
384 bridge = devm_pci_alloc_host_bridge(dev, sizeof(*rc));
385 if (!bridge)
386 return -ENOMEM;
387
388 if (!data->byte_access_allowed)
389 bridge->ops = &cdns_ti_pcie_host_ops;
390 rc = pci_host_bridge_priv(bridge);
391 rc->quirk_retrain_flag = data->quirk_retrain_flag;
392 rc->quirk_detect_quiet_flag = data->quirk_detect_quiet_flag;
393
394 cdns_pcie = &rc->pcie;
395 cdns_pcie->dev = dev;
396 cdns_pcie->ops = &j721e_pcie_ops;
397 pcie->cdns_pcie = cdns_pcie;
398 break;
399 case PCI_MODE_EP:
400 if (!IS_ENABLED(CONFIG_PCIE_CADENCE_EP))
401 return -ENODEV;
402
403 ep = devm_kzalloc(dev, sizeof(*ep), GFP_KERNEL);
404 if (!ep)
405 return -ENOMEM;
406
407 ep->quirk_detect_quiet_flag = data->quirk_detect_quiet_flag;
408
409 cdns_pcie = &ep->pcie;
410 cdns_pcie->dev = dev;
411 cdns_pcie->ops = &j721e_pcie_ops;
412 pcie->cdns_pcie = cdns_pcie;
413 break;
414 default:
415 dev_err(dev, "INVALID device type %d\n", mode);
416 return 0;
417 }
418
379 pcie->mode = mode;419 pcie->mode = mode;
380 pcie->linkdown_irq_regfield = data->linkdown_irq_regfield;420 pcie->linkdown_irq_regfield = data->linkdown_irq_regfield;
381 421
@@ -426,28 +466,6 @@ static int j721e_pcie_probe(struct platform_device *pdev) · 44 unmodified lines
426 466
427 switch (mode) {467 switch (mode) {
428 case PCI_MODE_RC:468 case PCI_MODE_RC:
429 if (!IS_ENABLED(CONFIG_PCIE_CADENCE_HOST)) {
430 ret = -ENODEV;
431 goto err_get_sync;
432 }
433
434 bridge = devm_pci_alloc_host_bridge(dev, sizeof(*rc));
435 if (!bridge) {
436 ret = -ENOMEM;
437 goto err_get_sync;
438 }
439
440 if (!data->byte_access_allowed)
441 bridge->ops = &cdns_ti_pcie_host_ops;
442 rc = pci_host_bridge_priv(bridge);
443 rc->quirk_retrain_flag = data->quirk_retrain_flag;
444 rc->quirk_detect_quiet_flag = data->quirk_detect_quiet_flag;
445
446 cdns_pcie = &rc->pcie;
447 cdns_pcie->dev = dev;
448 cdns_pcie->ops = &j721e_pcie_ops;
449 pcie->cdns_pcie = cdns_pcie;
450
451 gpiod = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);469 gpiod = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
452 if (IS_ERR(gpiod)) {470 if (IS_ERR(gpiod)) {
453 ret = PTR_ERR(gpiod);471 ret = PTR_ERR(gpiod);
@@ -497,23 +515,6 @@ static int j721e_pcie_probe(struct platform_device *pdev) · 43 unmodified lines
497 515
498 break;516 break;
499 case PCI_MODE_EP:517 case PCI_MODE_EP:
500 if (!IS_ENABLED(CONFIG_PCIE_CADENCE_EP)) {
501 ret = -ENODEV;
502 goto err_get_sync;
503 }
504
505 ep = devm_kzalloc(dev, sizeof(*ep), GFP_KERNEL);
506 if (!ep) {
507 ret = -ENOMEM;
508 goto err_get_sync;
509 }
510 ep->quirk_detect_quiet_flag = data->quirk_detect_quiet_flag;
511
512 cdns_pcie = &ep->pcie;
513 cdns_pcie->dev = dev;
514 cdns_pcie->ops = &j721e_pcie_ops;
515 pcie->cdns_pcie = cdns_pcie;
516
517 ret = cdns_pcie_init_phy(dev, cdns_pcie);518 ret = cdns_pcie_init_phy(dev, cdns_pcie);
518 if (ret) {519 if (ret) {
519 dev_err(dev, "Failed to init phy\n");520 dev_err(dev, "Failed to init phy\n");
@@ -525,8 +526,6 @@ static int j721e_pcie_probe(struct platform_device *pdev) · 5 unmodified lines
525 goto err_pcie_setup;526 goto err_pcie_setup;
526 527
527 break;528 break;
528 default:
529 dev_err(dev, "INVALID device type %d\n", mode);
530 }529 }
531 530
532 return 0;531 return 0;
drivers/pci/controller/dwc/pcie-kirin.c+18−13
@@ -756,22 +756,28 @@ static int __exit kirin_pcie_remove(struct platform_device *pdev) · 755 unmodified lines
756 return 0;756 return 0;
757}757}
758 758
759struct kirin_pcie_data {
760 enum pcie_kirin_phy_type phy_type;
761};
762
763static const struct kirin_pcie_data kirin_960_data = {
764 .phy_type = PCIE_KIRIN_INTERNAL_PHY,
765};
766
767static const struct kirin_pcie_data kirin_970_data = {
768 .phy_type = PCIE_KIRIN_EXTERNAL_PHY,
769};
770
759static const struct of_device_id kirin_pcie_match[] = {771static const struct of_device_id kirin_pcie_match[] = {
760 {772 { .compatible = "hisilicon,kirin960-pcie", .data = &kirin_960_data },
761 .compatible = "hisilicon,kirin960-pcie",773 { .compatible = "hisilicon,kirin970-pcie", .data = &kirin_970_data },
762 .data = (void *)PCIE_KIRIN_INTERNAL_PHY
763 },
764 {
765 .compatible = "hisilicon,kirin970-pcie",
766 .data = (void *)PCIE_KIRIN_EXTERNAL_PHY
767 },
768 {},774 {},
769};775};
770 776
771static int kirin_pcie_probe(struct platform_device *pdev)777static int kirin_pcie_probe(struct platform_device *pdev)
772{778{
773 enum pcie_kirin_phy_type phy_type;
774 struct device *dev = &pdev->dev;779 struct device *dev = &pdev->dev;
780 const struct kirin_pcie_data *data;
775 struct kirin_pcie *kirin_pcie;781 struct kirin_pcie *kirin_pcie;
776 struct dw_pcie *pci;782 struct dw_pcie *pci;
777 int ret;783 int ret;
@@ -781,13 +787,12 @@ static int kirin_pcie_probe(struct platform_device *pdev) · 3 unmodified lines
781 return -EINVAL;787 return -EINVAL;
782 }788 }
783 789
784 phy_type = (long)of_device_get_match_data(dev);790 data = of_device_get_match_data(dev);
785 if (!phy_type) {791 if (!data) {
786 dev_err(dev, "OF data missing\n");792 dev_err(dev, "OF data missing\n");
787 return -EINVAL;793 return -EINVAL;
788 }794 }
789 795
790
791 kirin_pcie = devm_kzalloc(dev, sizeof(struct kirin_pcie), GFP_KERNEL);796 kirin_pcie = devm_kzalloc(dev, sizeof(struct kirin_pcie), GFP_KERNEL);
792 if (!kirin_pcie)797 if (!kirin_pcie)
793 return -ENOMEM;798 return -ENOMEM;
@@ -800,7 +805,7 @@ static int kirin_pcie_probe(struct platform_device *pdev) · 6 unmodified lines
800 pci->ops = &kirin_dw_pcie_ops;805 pci->ops = &kirin_dw_pcie_ops;
801 pci->pp.ops = &kirin_pcie_host_ops;806 pci->pp.ops = &kirin_pcie_host_ops;
802 kirin_pcie->pci = pci;807 kirin_pcie->pci = pci;
803 kirin_pcie->type = phy_type;808 kirin_pcie->type = data->phy_type;
804 809
805 ret = kirin_pcie_get_resource(kirin_pcie, pdev);810 ret = kirin_pcie_get_resource(kirin_pcie, pdev);
806 if (ret)811 if (ret)
drivers/pinctrl/Makefile+1−1
@@ -42,9 +42,9 @@ obj-$(CONFIG_PINCTRL_PISTACHIO) += pinctrl-pistachio.o · 41 unmodified lines
42obj-$(CONFIG_PINCTRL_RK805) += pinctrl-rk805.o42obj-$(CONFIG_PINCTRL_RK805) += pinctrl-rk805.o
43obj-$(CONFIG_PINCTRL_ROCKCHIP) += pinctrl-rockchip.o43obj-$(CONFIG_PINCTRL_ROCKCHIP) += pinctrl-rockchip.o
44obj-$(CONFIG_PINCTRL_SINGLE) += pinctrl-single.o44obj-$(CONFIG_PINCTRL_SINGLE) += pinctrl-single.o
45obj-$(CONFIG_PINCTRL_ST) += pinctrl-st.o
45obj-$(CONFIG_PINCTRL_STARFIVE) += pinctrl-starfive.o46obj-$(CONFIG_PINCTRL_STARFIVE) += pinctrl-starfive.o
46obj-$(CONFIG_PINCTRL_STMFX) += pinctrl-stmfx.o47obj-$(CONFIG_PINCTRL_STMFX) += pinctrl-stmfx.o
47obj-$(CONFIG_PINCTRL_ST) += pinctrl-st.o
48obj-$(CONFIG_PINCTRL_SX150X) += pinctrl-sx150x.o48obj-$(CONFIG_PINCTRL_SX150X) += pinctrl-sx150x.o
49obj-$(CONFIG_PINCTRL_TB10X) += pinctrl-tb10x.o49obj-$(CONFIG_PINCTRL_TB10X) += pinctrl-tb10x.o
50obj-$(CONFIG_PINCTRL_THUNDERBAY) += pinctrl-thunderbay.o50obj-$(CONFIG_PINCTRL_THUNDERBAY) += pinctrl-thunderbay.o
drivers/pinctrl/bcm/Kconfig+1−0
@@ -35,6 +35,7 @@ config PINCTRL_BCM63XX · 34 unmodified lines
35 select PINCONF35 select PINCONF
36 select GENERIC_PINCONF36 select GENERIC_PINCONF
37 select GPIOLIB37 select GPIOLIB
38 select REGMAP
38 select GPIO_REGMAP39 select GPIO_REGMAP
39 40
40config PINCTRL_BCM631841config PINCTRL_BCM6318
drivers/pinctrl/bcm/pinctrl-bcm2835.c+15−8
@@ -1269,16 +1269,18 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) · 1268 unmodified lines
1269 sizeof(*girq->parents),1269 sizeof(*girq->parents),
1270 GFP_KERNEL);1270 GFP_KERNEL);
1271 if (!girq->parents) {1271 if (!girq->parents) {
1272 pinctrl_remove_gpio_range(pc->pctl_dev, &pc->gpio_range);1272 err = -ENOMEM;
1273 return -ENOMEM;1273 goto out_remove;
1274 }1274 }
1275 1275
1276 if (is_7211) {1276 if (is_7211) {
1277 pc->wake_irq = devm_kcalloc(dev, BCM2835_NUM_IRQS,1277 pc->wake_irq = devm_kcalloc(dev, BCM2835_NUM_IRQS,
1278 sizeof(*pc->wake_irq),1278 sizeof(*pc->wake_irq),
1279 GFP_KERNEL);1279 GFP_KERNEL);
1280 if (!pc->wake_irq)1280 if (!pc->wake_irq) {
1281 return -ENOMEM;1281 err = -ENOMEM;
1282 goto out_remove;
1283 }
1282 }1284 }
1283 1285
1284 /*1286 /*
@@ -1306,8 +1308,10 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) · 21 unmodified lines
1306 1308
1307 len = strlen(dev_name(pc->dev)) + 16;1309 len = strlen(dev_name(pc->dev)) + 16;
1308 name = devm_kzalloc(pc->dev, len, GFP_KERNEL);1310 name = devm_kzalloc(pc->dev, len, GFP_KERNEL);
1309 if (!name)1311 if (!name) {
1310 return -ENOMEM;1312 err = -ENOMEM;
1313 goto out_remove;
1314 }
1311 1315
1312 snprintf(name, len, "%s:bank%d", dev_name(pc->dev), i);1316 snprintf(name, len, "%s:bank%d", dev_name(pc->dev), i);
1313 1317
@@ -1326,11 +1330,14 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) · 12 unmodified lines
1326 err = gpiochip_add_data(&pc->gpio_chip, pc);1330 err = gpiochip_add_data(&pc->gpio_chip, pc);
1327 if (err) {1331 if (err) {
1328 dev_err(dev, "could not add GPIO chip\n");1332 dev_err(dev, "could not add GPIO chip\n");
1329 pinctrl_remove_gpio_range(pc->pctl_dev, &pc->gpio_range);1333 goto out_remove;
1330 return err;
1331 }1334 }
1332 1335
1333 return 0;1336 return 0;
1337
1338out_remove:
1339 pinctrl_remove_gpio_range(pc->pctl_dev, &pc->gpio_range);
1340 return err;
1334}1341}
1335 1342
1336static struct platform_driver bcm2835_pinctrl_driver = {1343static struct platform_driver bcm2835_pinctrl_driver = {
drivers/pinctrl/intel/pinctrl-cherryview.c+3−2
@@ -1471,8 +1471,9 @@ static void chv_gpio_irq_handler(struct irq_desc *desc) · 1470 unmodified lines
1471 1471
1472 offset = cctx->intr_lines[intr_line];1472 offset = cctx->intr_lines[intr_line];
1473 if (offset == CHV_INVALID_HWIRQ) {1473 if (offset == CHV_INVALID_HWIRQ) {
1474 dev_err(dev, "interrupt on unused interrupt line %u\n", intr_line);1474 dev_warn_once(dev, "interrupt on unmapped interrupt line %u\n", intr_line);
1475 continue;1475 /* Some boards expect hwirq 0 to trigger in this case */
1476 offset = 0;
1476 }1477 }
1477 1478
1478 generic_handle_domain_irq(gc->irq.domain, offset);1479 generic_handle_domain_irq(gc->irq.domain, offset);
drivers/pinctrl/intel/pinctrl-intel.c+36−28
@@ -451,8 +451,8 @@ static void intel_gpio_set_gpio_mode(void __iomem *padcfg0) · 450 unmodified lines
451 value &= ~PADCFG0_PMODE_MASK;451 value &= ~PADCFG0_PMODE_MASK;
452 value |= PADCFG0_PMODE_GPIO;452 value |= PADCFG0_PMODE_GPIO;
453 453
454 /* Disable input and output buffers */454 /* Disable TX buffer and enable RX (this will be input) */
455 value |= PADCFG0_GPIORXDIS;455 value &= ~PADCFG0_GPIORXDIS;
456 value |= PADCFG0_GPIOTXDIS;456 value |= PADCFG0_GPIOTXDIS;
457 457
458 /* Disable SCI/SMI/NMI generation */458 /* Disable SCI/SMI/NMI generation */
@@ -497,9 +497,6 @@ static int intel_gpio_request_enable(struct pinctrl_dev *pctldev, · 38 unmodified lines
497 497
498 intel_gpio_set_gpio_mode(padcfg0);498 intel_gpio_set_gpio_mode(padcfg0);
499 499
500 /* Disable TX buffer and enable RX (this will be input) */
501 __intel_gpio_set_direction(padcfg0, true);
502
503 raw_spin_unlock_irqrestore(&pctrl->lock, flags);500 raw_spin_unlock_irqrestore(&pctrl->lock, flags);
504 501
505 return 0;502 return 0;
@@ -1115,9 +1112,6 @@ static int intel_gpio_irq_type(struct irq_data *d, unsigned int type) · 609 unmodified lines
1115 1112
1116 intel_gpio_set_gpio_mode(reg);1113 intel_gpio_set_gpio_mode(reg);
1117 1114
1118 /* Disable TX buffer and enable RX (this will be input) */
1119 __intel_gpio_set_direction(reg, true);
1120
1121 value = readl(reg);1115 value = readl(reg);
1122 1116
1123 value &= ~(PADCFG0_RXEVCFG_MASK | PADCFG0_RXINV);1117 value &= ~(PADCFG0_RXEVCFG_MASK | PADCFG0_RXINV);
@@ -1216,6 +1210,39 @@ static irqreturn_t intel_gpio_irq(int irq, void *data) · 92 unmodified lines
1216 return IRQ_RETVAL(ret);1210 return IRQ_RETVAL(ret);
1217}1211}
1218 1212
1213static void intel_gpio_irq_init(struct intel_pinctrl *pctrl)
1214{
1215 int i;
1216
1217 for (i = 0; i < pctrl->ncommunities; i++) {
1218 const struct intel_community *community;
1219 void __iomem *base;
1220 unsigned int gpp;
1221
1222 community = &pctrl->communities[i];
1223 base = community->regs;
1224
1225 for (gpp = 0; gpp < community->ngpps; gpp++) {
1226 /* Mask and clear all interrupts */
1227 writel(0, base + community->ie_offset + gpp * 4);
1228 writel(0xffff, base + community->is_offset + gpp * 4);
1229 }
1230 }
1231}
1232
1233static int intel_gpio_irq_init_hw(struct gpio_chip *gc)
1234{
1235 struct intel_pinctrl *pctrl = gpiochip_get_data(gc);
1236
1237 /*
1238 * Make sure the interrupt lines are in a proper state before
1239 * further configuration.
1240 */
1241 intel_gpio_irq_init(pctrl);
1242
1243 return 0;
1244}
1245
1219static int intel_gpio_add_community_ranges(struct intel_pinctrl *pctrl,1246static int intel_gpio_add_community_ranges(struct intel_pinctrl *pctrl,
1220 const struct intel_community *community)1247 const struct intel_community *community)
1221{1248{
@@ -1320,6 +1347,7 @@ static int intel_gpio_probe(struct intel_pinctrl *pctrl, int irq) · 98 unmodified lines
1320 girq->num_parents = 0;1347 girq->num_parents = 0;
1321 girq->default_type = IRQ_TYPE_NONE;1348 girq->default_type = IRQ_TYPE_NONE;
1322 girq->handler = handle_bad_irq;1349 girq->handler = handle_bad_irq;
1350 girq->init_hw = intel_gpio_irq_init_hw;
1323 1351
1324 ret = devm_gpiochip_add_data(pctrl->dev, &pctrl->chip, pctrl);1352 ret = devm_gpiochip_add_data(pctrl->dev, &pctrl->chip, pctrl);
1325 if (ret) {1353 if (ret) {
@@ -1695,26 +1723,6 @@ int intel_pinctrl_suspend_noirq(struct device *dev) · 369 unmodified lines
1695}1723}
1696EXPORT_SYMBOL_GPL(intel_pinctrl_suspend_noirq);1724EXPORT_SYMBOL_GPL(intel_pinctrl_suspend_noirq);
1697 1725
1698static void intel_gpio_irq_init(struct intel_pinctrl *pctrl)
1699{
1700 size_t i;
1701
1702 for (i = 0; i < pctrl->ncommunities; i++) {
1703 const struct intel_community *community;
1704 void __iomem *base;
1705 unsigned int gpp;
1706
1707 community = &pctrl->communities[i];
1708 base = community->regs;
1709
1710 for (gpp = 0; gpp < community->ngpps; gpp++) {
1711 /* Mask and clear all interrupts */
1712 writel(0, base + community->ie_offset + gpp * 4);
1713 writel(0xffff, base + community->is_offset + gpp * 4);
1714 }
1715 }
1716}
1717
1718static bool intel_gpio_update_reg(void __iomem *reg, u32 mask, u32 value)1726static bool intel_gpio_update_reg(void __iomem *reg, u32 mask, u32 value)
1719{1727{
1720 u32 curr, updated;1728 u32 curr, updated;
drivers/pinctrl/pinctrl-microchip-sgpio.c+2−1
@@ -137,7 +137,8 @@ static inline int sgpio_addr_to_pin(struct sgpio_priv *priv, int port, int bit) · 136 unmodified lines
137 137
138static inline u32 sgpio_get_addr(struct sgpio_priv *priv, u32 rno, u32 off)138static inline u32 sgpio_get_addr(struct sgpio_priv *priv, u32 rno, u32 off)
139{139{
140 return priv->properties->regoff[rno] + off;140 return (priv->properties->regoff[rno] + off) *
141 regmap_get_reg_stride(priv->regs);
141}142}
142 143
143static u32 sgpio_readl(struct sgpio_priv *priv, u32 rno, u32 off)144static u32 sgpio_readl(struct sgpio_priv *priv, u32 rno, u32 off)
drivers/pinctrl/pinctrl-thunderbay.c+35−55
@@ -773,63 +773,42 @@ static int thunderbay_build_groups(struct thunderbay_pinctrl *tpc) · 772 unmodified lines
773 773
774static int thunderbay_add_functions(struct thunderbay_pinctrl *tpc, struct function_desc *funcs)774static int thunderbay_add_functions(struct thunderbay_pinctrl *tpc, struct function_desc *funcs)
775{775{
776 struct function_desc *function = funcs;
777 int i;776 int i;
778 777
779 /* Assign the groups for each function */778 /* Assign the groups for each function */
780 for (i = 0; i < tpc->soc->npins; i++) {779 for (i = 0; i < tpc->nfuncs; i++) {
781 const struct pinctrl_pin_desc *pin_info = thunderbay_pins + i;780 struct function_desc *func = &funcs[i];
782 struct thunderbay_mux_desc *pin_mux = pin_info->drv_data;781 const char **group_names;
783 782 unsigned int grp_idx = 0;
784 while (pin_mux->name) {783 int j;
785 const char **grp;784
786 int j, grp_num, match = 0;785 group_names = devm_kcalloc(tpc->dev, func->num_group_names,
787 size_t grp_size;786 sizeof(*group_names), GFP_KERNEL);
788 struct function_desc *func;787 if (!group_names)
789 788 return -ENOMEM;
790 for (j = 0; j < tpc->nfuncs; j++) {789
791 if (!strcmp(pin_mux->name, function[j].name)) {790 for (j = 0; j < tpc->soc->npins; j++) {
792 match = 1;791 const struct pinctrl_pin_desc *pin_info = &thunderbay_pins[j];
793 break;792 struct thunderbay_mux_desc *pin_mux;
794 }793
795 }794 for (pin_mux = pin_info->drv_data; pin_mux->name; pin_mux++) {
796 795 if (!strcmp(pin_mux->name, func->name))
797 if (!match)796 group_names[grp_idx++] = pin_info->name;
798 return -EINVAL;
799
800 func = function + j;
801 grp_num = func->num_group_names;
802 grp_size = sizeof(*func->group_names);
803
804 if (!func->group_names) {
805 func->group_names = devm_kcalloc(tpc->dev,
806 grp_num,
807 grp_size,
808 GFP_KERNEL);
809 if (!func->group_names) {
810 kfree(func);
811 return -ENOMEM;
812 }
813 }797 }
814
815 grp = func->group_names;
816 while (*grp)
817 grp++;
818
819 *grp = pin_info->name;
820 pin_mux++;
821 }798 }
799
800 func->group_names = group_names;
822 }801 }
823 802
824 /* Add all functions */803 /* Add all functions */
825 for (i = 0; i < tpc->nfuncs; i++) {804 for (i = 0; i < tpc->nfuncs; i++) {
826 pinmux_generic_add_function(tpc->pctrl,805 pinmux_generic_add_function(tpc->pctrl,
827 function[i].name,806 funcs[i].name,
828 function[i].group_names,807 funcs[i].group_names,
829 function[i].num_group_names,808 funcs[i].num_group_names,
830 function[i].data);809 funcs[i].data);
831 }810 }
832 kfree(function);811 kfree(funcs);
833 return 0;812 return 0;
834}813}
835 814
@@ -839,27 +818,30 @@ static int thunderbay_build_functions(struct thunderbay_pinctrl *tpc) · 3 unmodified lines
839 void *ptr;818 void *ptr;
840 int pin;819 int pin;
841 820
842 /* Total number of functions is unknown at this point. Allocate first. */821 /*
822 * Allocate maximum possible number of functions. Assume every pin
823 * being part of 8 (hw maximum) globally unique muxes.
824 */
843 tpc->nfuncs = 0;825 tpc->nfuncs = 0;
844 thunderbay_funcs = kcalloc(tpc->soc->npins * 8,826 thunderbay_funcs = kcalloc(tpc->soc->npins * 8,
845 sizeof(*thunderbay_funcs), GFP_KERNEL);827 sizeof(*thunderbay_funcs), GFP_KERNEL);
846 if (!thunderbay_funcs)828 if (!thunderbay_funcs)
847 return -ENOMEM;829 return -ENOMEM;
848 830
849 /* Find total number of functions and each's properties */831 /* Setup 1 function for each unique mux */
850 for (pin = 0; pin < tpc->soc->npins; pin++) {832 for (pin = 0; pin < tpc->soc->npins; pin++) {
851 const struct pinctrl_pin_desc *pin_info = thunderbay_pins + pin;833 const struct pinctrl_pin_desc *pin_info = thunderbay_pins + pin;
852 struct thunderbay_mux_desc *pin_mux = pin_info->drv_data;834 struct thunderbay_mux_desc *pin_mux;
853 835
854 while (pin_mux->name) {836 for (pin_mux = pin_info->drv_data; pin_mux->name; pin_mux++) {
855 struct function_desc *func = thunderbay_funcs;837 struct function_desc *func;
856 838
857 while (func->name) {839 /* Check if we already have function for this mux */
840 for (func = thunderbay_funcs; func->name; func++) {
858 if (!strcmp(pin_mux->name, func->name)) {841 if (!strcmp(pin_mux->name, func->name)) {
859 func->num_group_names++;842 func->num_group_names++;
860 break;843 break;
861 }844 }
862 func++;
863 }845 }
864 846
865 if (!func->name) {847 if (!func->name) {
@@ -868,8 +850,6 @@ static int thunderbay_build_functions(struct thunderbay_pinctrl *tpc) · 2 unmodified lines
868 func->data = (int *)&pin_mux->mode;850 func->data = (int *)&pin_mux->mode;
869 tpc->nfuncs++;851 tpc->nfuncs++;
870 }852 }
871
872 pin_mux++;
873 }853 }
874 }854 }
875 855
drivers/pinctrl/pinctrl-zynqmp.c+4−6
@@ -809,7 +809,6 @@ static int zynqmp_pinctrl_prepare_pin_desc(struct device *dev, · 808 unmodified lines
809 unsigned int *npins)809 unsigned int *npins)
810{810{
811 struct pinctrl_pin_desc *pins, *pin;811 struct pinctrl_pin_desc *pins, *pin;
812 char **pin_names;
813 int ret;812 int ret;
814 int i;813 int i;
815 814
@@ -821,14 +820,13 @@ static int zynqmp_pinctrl_prepare_pin_desc(struct device *dev, · 5 unmodified lines
821 if (!pins)820 if (!pins)
822 return -ENOMEM;821 return -ENOMEM;
823 822
824 pin_names = devm_kasprintf_strarray(dev, ZYNQMP_PIN_PREFIX, *npins);
825 if (IS_ERR(pin_names))
826 return PTR_ERR(pin_names);
827
828 for (i = 0; i < *npins; i++) {823 for (i = 0; i < *npins; i++) {
829 pin = &pins[i];824 pin = &pins[i];
830 pin->number = i;825 pin->number = i;
831 pin->name = pin_names[i];826 pin->name = devm_kasprintf(dev, GFP_KERNEL, "%s%d",
827 ZYNQMP_PIN_PREFIX, i);
828 if (!pin->name)
829 return -ENOMEM;
832 }830 }
833 831
834 *zynqmp_pins = pins;832 *zynqmp_pins = pins;
drivers/pinctrl/sunxi/pinctrl-sun50i-h616.c+4−4
@@ -363,16 +363,16 @@ static const struct sunxi_desc_pin h616_pins[] = { · 362 unmodified lines
363 SUNXI_FUNCTION(0x0, "gpio_in"),363 SUNXI_FUNCTION(0x0, "gpio_in"),
364 SUNXI_FUNCTION(0x1, "gpio_out"),364 SUNXI_FUNCTION(0x1, "gpio_out"),
365 SUNXI_FUNCTION(0x2, "uart2"), /* CTS */365 SUNXI_FUNCTION(0x2, "uart2"), /* CTS */
366 SUNXI_FUNCTION(0x3, "i2s3"), /* DO0 */366 SUNXI_FUNCTION(0x3, "i2s3_dout0"), /* DO0 */
367 SUNXI_FUNCTION(0x4, "spi1"), /* MISO */367 SUNXI_FUNCTION(0x4, "spi1"), /* MISO */
368 SUNXI_FUNCTION(0x5, "i2s3"), /* DI1 */368 SUNXI_FUNCTION(0x5, "i2s3_din1"), /* DI1 */
369 SUNXI_FUNCTION_IRQ_BANK(0x6, 6, 8)), /* PH_EINT8 */369 SUNXI_FUNCTION_IRQ_BANK(0x6, 6, 8)), /* PH_EINT8 */
370 SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 9),370 SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 9),
371 SUNXI_FUNCTION(0x0, "gpio_in"),371 SUNXI_FUNCTION(0x0, "gpio_in"),
372 SUNXI_FUNCTION(0x1, "gpio_out"),372 SUNXI_FUNCTION(0x1, "gpio_out"),
373 SUNXI_FUNCTION(0x3, "i2s3"), /* DI0 */373 SUNXI_FUNCTION(0x3, "i2s3_din0"), /* DI0 */
374 SUNXI_FUNCTION(0x4, "spi1"), /* CS1 */374 SUNXI_FUNCTION(0x4, "spi1"), /* CS1 */
375 SUNXI_FUNCTION(0x3, "i2s3"), /* DO1 */375 SUNXI_FUNCTION(0x5, "i2s3_dout1"), /* DO1 */
376 SUNXI_FUNCTION_IRQ_BANK(0x6, 6, 9)), /* PH_EINT9 */376 SUNXI_FUNCTION_IRQ_BANK(0x6, 6, 9)), /* PH_EINT9 */
377 SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 10),377 SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 10),
378 SUNXI_FUNCTION(0x0, "gpio_in"),378 SUNXI_FUNCTION(0x0, "gpio_in"),
drivers/platform/surface/Kconfig+1−0
@@ -5,6 +5,7 @@ · 4 unmodified lines
5 5
6menuconfig SURFACE_PLATFORMS6menuconfig SURFACE_PLATFORMS
7 bool "Microsoft Surface Platform-Specific Device Drivers"7 bool "Microsoft Surface Platform-Specific Device Drivers"
8 depends on ARM64 || X86 || COMPILE_TEST
8 default y9 default y
9 help10 help
10 Say Y here to get to see options for platform-specific device drivers11 Say Y here to get to see options for platform-specific device drivers
drivers/platform/x86/amd-pmc.c+9−6
@@ -124,9 +124,10 @@ struct amd_pmc_dev { · 123 unmodified lines
124 u32 cpu_id;124 u32 cpu_id;
125 u32 active_ips;125 u32 active_ips;
126/* SMU version information */126/* SMU version information */
127 u16 major;127 u8 smu_program;
128 u16 minor;128 u8 major;
129 u16 rev;129 u8 minor;
130 u8 rev;
130 struct device *dev;131 struct device *dev;
131 struct pci_dev *rdev;132 struct pci_dev *rdev;
132 struct mutex lock; /* generic mutex lock */133 struct mutex lock; /* generic mutex lock */
@@ -180,11 +181,13 @@ static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev) · 47 unmodified lines
180 if (rc)181 if (rc)
181 return rc;182 return rc;
182 183
183 dev->major = (val >> 16) & GENMASK(15, 0);184 dev->smu_program = (val >> 24) & GENMASK(7, 0);
185 dev->major = (val >> 16) & GENMASK(7, 0);
184 dev->minor = (val >> 8) & GENMASK(7, 0);186 dev->minor = (val >> 8) & GENMASK(7, 0);
185 dev->rev = (val >> 0) & GENMASK(7, 0);187 dev->rev = (val >> 0) & GENMASK(7, 0);
186 188
187 dev_dbg(dev->dev, "SMU version is %u.%u.%u\n", dev->major, dev->minor, dev->rev);189 dev_dbg(dev->dev, "SMU program %u version is %u.%u.%u\n",
190 dev->smu_program, dev->major, dev->minor, dev->rev);
188 191
189 return 0;192 return 0;
190}193}
@@ -226,7 +229,7 @@ static int amd_pmc_stb_debugfs_release(struct inode *inode, struct file *filp) · 35 unmodified lines
226 return 0;229 return 0;
227}230}
228 231
229const struct file_operations amd_pmc_stb_debugfs_fops = {232static const struct file_operations amd_pmc_stb_debugfs_fops = {
230 .owner = THIS_MODULE,233 .owner = THIS_MODULE,
231 .open = amd_pmc_stb_debugfs_open,234 .open = amd_pmc_stb_debugfs_open,
232 .read = amd_pmc_stb_debugfs_read,235 .read = amd_pmc_stb_debugfs_read,
drivers/platform/x86/asus-tf103c-dock.c+2−2
@@ -250,7 +250,7 @@ static int tf103c_dock_hid_raw_request(struct hid_device *hid, u8 reportnum, · 249 unmodified lines
250 return 0;250 return 0;
251}251}
252 252
253struct hid_ll_driver tf103c_dock_hid_ll_driver = {253static struct hid_ll_driver tf103c_dock_hid_ll_driver = {
254 .parse = tf103c_dock_hid_parse,254 .parse = tf103c_dock_hid_parse,
255 .start = tf103c_dock_hid_start,255 .start = tf103c_dock_hid_start,
256 .stop = tf103c_dock_hid_stop,256 .stop = tf103c_dock_hid_stop,
@@ -921,7 +921,7 @@ static int __maybe_unused tf103c_dock_resume(struct device *dev) · 664 unmodified lines
921 return 0;921 return 0;
922}922}
923 923
924SIMPLE_DEV_PM_OPS(tf103c_dock_pm_ops, tf103c_dock_suspend, tf103c_dock_resume);924static SIMPLE_DEV_PM_OPS(tf103c_dock_pm_ops, tf103c_dock_suspend, tf103c_dock_resume);
925 925
926static const struct acpi_device_id tf103c_dock_acpi_match[] = {926static const struct acpi_device_id tf103c_dock_acpi_match[] = {
927 {"NPCE69A"},927 {"NPCE69A"},
drivers/platform/x86/intel/crystal_cove_charger.c+13−13
@@ -17,6 +17,7 @@ · 16 unmodified lines
17#include <linux/regmap.h>17#include <linux/regmap.h>
18 18
19#define CHGRIRQ_REG 0x0a19#define CHGRIRQ_REG 0x0a
20#define MCHGRIRQ_REG 0x17
20 21
21struct crystal_cove_charger_data {22struct crystal_cove_charger_data {
22 struct mutex buslock; /* irq_bus_lock */23 struct mutex buslock; /* irq_bus_lock */
@@ -25,8 +26,8 @@ struct crystal_cove_charger_data { · 2 unmodified lines
25 struct irq_domain *irq_domain;26 struct irq_domain *irq_domain;
26 int irq;27 int irq;
27 int charger_irq;28 int charger_irq;
28 bool irq_enabled;29 u8 mask;
29 bool irq_is_enabled;30 u8 new_mask;
30};31};
31 32
32static irqreturn_t crystal_cove_charger_irq(int irq, void *data)33static irqreturn_t crystal_cove_charger_irq(int irq, void *data)
@@ -53,13 +54,9 @@ static void crystal_cove_charger_irq_bus_sync_unlock(struct irq_data *data) · 20 unmodified lines
53{54{
54 struct crystal_cove_charger_data *charger = irq_data_get_irq_chip_data(data);55 struct crystal_cove_charger_data *charger = irq_data_get_irq_chip_data(data);
55 56
56 if (charger->irq_is_enabled != charger->irq_enabled) {57 if (charger->mask != charger->new_mask) {
57 if (charger->irq_enabled)58 regmap_write(charger->regmap, MCHGRIRQ_REG, charger->new_mask);
58 enable_irq(charger->irq);59 charger->mask = charger->new_mask;
59 else
60 disable_irq(charger->irq);
61
62 charger->irq_is_enabled = charger->irq_enabled;
63 }60 }
64 61
65 mutex_unlock(&charger->buslock);62 mutex_unlock(&charger->buslock);
@@ -69,14 +66,14 @@ static void crystal_cove_charger_irq_unmask(struct irq_data *data) · 3 unmodified lines
69{66{
70 struct crystal_cove_charger_data *charger = irq_data_get_irq_chip_data(data);67 struct crystal_cove_charger_data *charger = irq_data_get_irq_chip_data(data);
71 68
72 charger->irq_enabled = true;69 charger->new_mask &= ~BIT(data->hwirq);
73}70}
74 71
75static void crystal_cove_charger_irq_mask(struct irq_data *data)72static void crystal_cove_charger_irq_mask(struct irq_data *data)
76{73{
77 struct crystal_cove_charger_data *charger = irq_data_get_irq_chip_data(data);74 struct crystal_cove_charger_data *charger = irq_data_get_irq_chip_data(data);
78 75
79 charger->irq_enabled = false;76 charger->new_mask |= BIT(data->hwirq);
80}77}
81 78
82static void crystal_cove_charger_rm_irq_domain(void *data)79static void crystal_cove_charger_rm_irq_domain(void *data)
@@ -130,10 +127,13 @@ static int crystal_cove_charger_probe(struct platform_device *pdev) · 47 unmodified lines
130 irq_set_nested_thread(charger->charger_irq, true);127 irq_set_nested_thread(charger->charger_irq, true);
131 irq_set_noprobe(charger->charger_irq);128 irq_set_noprobe(charger->charger_irq);
132 129
130 /* Mask the single 2nd level IRQ before enabling the 1st level IRQ */
131 charger->mask = charger->new_mask = BIT(0);
132 regmap_write(charger->regmap, MCHGRIRQ_REG, charger->mask);
133
133 ret = devm_request_threaded_irq(&pdev->dev, charger->irq, NULL,134 ret = devm_request_threaded_irq(&pdev->dev, charger->irq, NULL,
134 crystal_cove_charger_irq,135 crystal_cove_charger_irq,
135 IRQF_ONESHOT | IRQF_NO_AUTOEN,136 IRQF_ONESHOT, KBUILD_MODNAME, charger);
136 KBUILD_MODNAME, charger);
137 if (ret)137 if (ret)
138 return dev_err_probe(&pdev->dev, ret, "requesting irq\n");138 return dev_err_probe(&pdev->dev, ret, "requesting irq\n");
139 139
drivers/platform/x86/intel/speed_select_if/isst_if_common.c+63−34
@@ -596,7 +596,10 @@ static long isst_if_def_ioctl(struct file *file, unsigned int cmd, · 595 unmodified lines
596 return ret;596 return ret;
597}597}
598 598
599static DEFINE_MUTEX(punit_misc_dev_lock);599/* Lock to prevent module registration when already opened by user space */
600static DEFINE_MUTEX(punit_misc_dev_open_lock);
601/* Lock to allow one share misc device for all ISST interace */
602static DEFINE_MUTEX(punit_misc_dev_reg_lock);
600static int misc_usage_count;603static int misc_usage_count;
601static int misc_device_ret;604static int misc_device_ret;
602static int misc_device_open;605static int misc_device_open;
@@ -606,7 +609,7 @@ static int isst_if_open(struct inode *inode, struct file *file) · 3 unmodified lines
606 int i, ret = 0;609 int i, ret = 0;
607 610
608 /* Fail open, if a module is going away */611 /* Fail open, if a module is going away */
609 mutex_lock(&punit_misc_dev_lock);612 mutex_lock(&punit_misc_dev_open_lock);
610 for (i = 0; i < ISST_IF_DEV_MAX; ++i) {613 for (i = 0; i < ISST_IF_DEV_MAX; ++i) {
611 struct isst_if_cmd_cb *cb = &punit_callbacks[i];614 struct isst_if_cmd_cb *cb = &punit_callbacks[i];
612 615
@@ -628,7 +631,7 @@ static int isst_if_open(struct inode *inode, struct file *file) · 15 unmodified lines
628 } else {631 } else {
629 misc_device_open++;632 misc_device_open++;
630 }633 }
631 mutex_unlock(&punit_misc_dev_lock);634 mutex_unlock(&punit_misc_dev_open_lock);
632 635
633 return ret;636 return ret;
634}637}
@@ -637,7 +640,7 @@ static int isst_if_relase(struct inode *inode, struct file *f) · 2 unmodified lines
637{640{
638 int i;641 int i;
639 642
640 mutex_lock(&punit_misc_dev_lock);643 mutex_lock(&punit_misc_dev_open_lock);
641 misc_device_open--;644 misc_device_open--;
642 for (i = 0; i < ISST_IF_DEV_MAX; ++i) {645 for (i = 0; i < ISST_IF_DEV_MAX; ++i) {
643 struct isst_if_cmd_cb *cb = &punit_callbacks[i];646 struct isst_if_cmd_cb *cb = &punit_callbacks[i];
@@ -645,7 +648,7 @@ static int isst_if_relase(struct inode *inode, struct file *f) · 1 unmodified line
645 if (cb->registered)648 if (cb->registered)
646 module_put(cb->owner);649 module_put(cb->owner);
647 }650 }
648 mutex_unlock(&punit_misc_dev_lock);651 mutex_unlock(&punit_misc_dev_open_lock);
649 652
650 return 0;653 return 0;
651}654}
@@ -662,6 +665,43 @@ static struct miscdevice isst_if_char_driver = { · 10 unmodified lines
662 .fops = &isst_if_char_driver_ops,665 .fops = &isst_if_char_driver_ops,
663};666};
664 667
668static int isst_misc_reg(void)
669{
670 mutex_lock(&punit_misc_dev_reg_lock);
671 if (misc_device_ret)
672 goto unlock_exit;
673
674 if (!misc_usage_count) {
675 misc_device_ret = isst_if_cpu_info_init();
676 if (misc_device_ret)
677 goto unlock_exit;
678
679 misc_device_ret = misc_register(&isst_if_char_driver);
680 if (misc_device_ret) {
681 isst_if_cpu_info_exit();
682 goto unlock_exit;
683 }
684 }
685 misc_usage_count++;
686
687unlock_exit:
688 mutex_unlock(&punit_misc_dev_reg_lock);
689
690 return misc_device_ret;
691}
692
693static void isst_misc_unreg(void)
694{
695 mutex_lock(&punit_misc_dev_reg_lock);
696 if (misc_usage_count)
697 misc_usage_count--;
698 if (!misc_usage_count && !misc_device_ret) {
699 misc_deregister(&isst_if_char_driver);
700 isst_if_cpu_info_exit();
701 }
702 mutex_unlock(&punit_misc_dev_reg_lock);
703}
704
665/**705/**
666 * isst_if_cdev_register() - Register callback for IOCTL706 * isst_if_cdev_register() - Register callback for IOCTL
667 * @device_type: The device type this callback handling.707 * @device_type: The device type this callback handling.
@@ -679,38 +719,31 @@ static struct miscdevice isst_if_char_driver = { · 11 unmodified lines
679 */719 */
680int isst_if_cdev_register(int device_type, struct isst_if_cmd_cb *cb)720int isst_if_cdev_register(int device_type, struct isst_if_cmd_cb *cb)
681{721{
682 if (misc_device_ret)722 int ret;
683 return misc_device_ret;
684 723
685 if (device_type >= ISST_IF_DEV_MAX)724 if (device_type >= ISST_IF_DEV_MAX)
686 return -EINVAL;725 return -EINVAL;
687 726
688 mutex_lock(&punit_misc_dev_lock);727 mutex_lock(&punit_misc_dev_open_lock);
728 /* Device is already open, we don't want to add new callbacks */
689 if (misc_device_open) {729 if (misc_device_open) {
690 mutex_unlock(&punit_misc_dev_lock);730 mutex_unlock(&punit_misc_dev_open_lock);
691 return -EAGAIN;731 return -EAGAIN;
692 }732 }
693 if (!misc_usage_count) {
694 int ret;
695
696 misc_device_ret = misc_register(&isst_if_char_driver);
697 if (misc_device_ret)
698 goto unlock_exit;
699
700 ret = isst_if_cpu_info_init();
701 if (ret) {
702 misc_deregister(&isst_if_char_driver);
703 misc_device_ret = ret;
704 goto unlock_exit;
705 }
706 }
707 memcpy(&punit_callbacks[device_type], cb, sizeof(*cb));733 memcpy(&punit_callbacks[device_type], cb, sizeof(*cb));
708 punit_callbacks[device_type].registered = 1;734 punit_callbacks[device_type].registered = 1;
709 misc_usage_count++;735 mutex_unlock(&punit_misc_dev_open_lock);
710unlock_exit:
711 mutex_unlock(&punit_misc_dev_lock);
712 736
713 return misc_device_ret;737 ret = isst_misc_reg();
738 if (ret) {
739 /*
740 * No need of mutex as the misc device register failed
741 * as no one can open device yet. Hence no contention.
742 */
743 punit_callbacks[device_type].registered = 0;
744 return ret;
745 }
746 return 0;
714}747}
715EXPORT_SYMBOL_GPL(isst_if_cdev_register);748EXPORT_SYMBOL_GPL(isst_if_cdev_register);
716 749
@@ -725,16 +758,12 @@ EXPORT_SYMBOL_GPL(isst_if_cdev_register); · 8 unmodified lines
725 */758 */
726void isst_if_cdev_unregister(int device_type)759void isst_if_cdev_unregister(int device_type)
727{760{
728 mutex_lock(&punit_misc_dev_lock);761 isst_misc_unreg();
729 misc_usage_count--;762 mutex_lock(&punit_misc_dev_open_lock);
730 punit_callbacks[device_type].registered = 0;763 punit_callbacks[device_type].registered = 0;
731 if (device_type == ISST_IF_DEV_MBOX)764 if (device_type == ISST_IF_DEV_MBOX)
732 isst_delete_hash();765 isst_delete_hash();
733 if (!misc_usage_count && !misc_device_ret) {766 mutex_unlock(&punit_misc_dev_open_lock);
734 misc_deregister(&isst_if_char_driver);
735 isst_if_cpu_info_exit();
736 }
737 mutex_unlock(&punit_misc_dev_lock);
738}767}
739EXPORT_SYMBOL_GPL(isst_if_cdev_unregister);768EXPORT_SYMBOL_GPL(isst_if_cdev_unregister);
740 769
drivers/platform/x86/thinkpad_acpi.c+22−3
@@ -8679,9 +8679,10 @@ static const struct attribute_group fan_driver_attr_group = { · 8678 unmodified lines
8679 .attrs = fan_driver_attributes,8679 .attrs = fan_driver_attributes,
8680};8680};
8681 8681
8682#define TPACPI_FAN_Q1 0x0001 /* Unitialized HFSP */8682#define TPACPI_FAN_Q1 0x0001 /* Uninitialized HFSP */
8683#define TPACPI_FAN_2FAN 0x0002 /* EC 0x31 bit 0 selects fan2 */8683#define TPACPI_FAN_2FAN 0x0002 /* EC 0x31 bit 0 selects fan2 */
8684#define TPACPI_FAN_2CTL 0x0004 /* selects fan2 control */8684#define TPACPI_FAN_2CTL 0x0004 /* selects fan2 control */
8685#define TPACPI_FAN_NOFAN 0x0008 /* no fan available */
8685 8686
8686static const struct tpacpi_quirk fan_quirk_table[] __initconst = {8687static const struct tpacpi_quirk fan_quirk_table[] __initconst = {
8687 TPACPI_QEC_IBM('1', 'Y', TPACPI_FAN_Q1),8688 TPACPI_QEC_IBM('1', 'Y', TPACPI_FAN_Q1),
@@ -8702,6 +8703,7 @@ static const struct tpacpi_quirk fan_quirk_table[] __initconst = { · 14 unmodified lines
8702 TPACPI_Q_LNV3('N', '4', '0', TPACPI_FAN_2CTL), /* P1 / X1 Extreme (4nd gen) */8703 TPACPI_Q_LNV3('N', '4', '0', TPACPI_FAN_2CTL), /* P1 / X1 Extreme (4nd gen) */
8703 TPACPI_Q_LNV3('N', '3', '0', TPACPI_FAN_2CTL), /* P15 (1st gen) / P15v (1st gen) */8704 TPACPI_Q_LNV3('N', '3', '0', TPACPI_FAN_2CTL), /* P15 (1st gen) / P15v (1st gen) */
8704 TPACPI_Q_LNV3('N', '3', '2', TPACPI_FAN_2CTL), /* X1 Carbon (9th gen) */8705 TPACPI_Q_LNV3('N', '3', '2', TPACPI_FAN_2CTL), /* X1 Carbon (9th gen) */
8706 TPACPI_Q_LNV3('N', '1', 'O', TPACPI_FAN_NOFAN), /* X1 Tablet (2nd gen) */
8705};8707};
8706 8708
8707static int __init fan_init(struct ibm_init_struct *iibm)8709static int __init fan_init(struct ibm_init_struct *iibm)
@@ -8730,6 +8732,11 @@ static int __init fan_init(struct ibm_init_struct *iibm) · 22 unmodified lines
8730 quirks = tpacpi_check_quirks(fan_quirk_table,8732 quirks = tpacpi_check_quirks(fan_quirk_table,
8731 ARRAY_SIZE(fan_quirk_table));8733 ARRAY_SIZE(fan_quirk_table));
8732 8734
8735 if (quirks & TPACPI_FAN_NOFAN) {
8736 pr_info("No integrated ThinkPad fan available\n");
8737 return -ENODEV;
8738 }
8739
8733 if (gfan_handle) {8740 if (gfan_handle) {
8734 /* 570, 600e/x, 770e, 770x */8741 /* 570, 600e/x, 770e, 770x */
8735 fan_status_access_mode = TPACPI_FAN_RD_ACPI_GFAN;8742 fan_status_access_mode = TPACPI_FAN_RD_ACPI_GFAN;
@@ -10112,6 +10119,9 @@ static struct ibm_struct proxsensor_driver_data = { · 1376 unmodified lines
10112#define DYTC_CMD_MMC_GET 8 /* To get current MMC function and mode */10119#define DYTC_CMD_MMC_GET 8 /* To get current MMC function and mode */
10113#define DYTC_CMD_RESET 0x1ff /* To reset back to default */10120#define DYTC_CMD_RESET 0x1ff /* To reset back to default */
10114 10121
10122#define DYTC_CMD_FUNC_CAP 3 /* To get DYTC capabilities */
10123#define DYTC_FC_MMC 27 /* MMC Mode supported */
10124
10115#define DYTC_GET_FUNCTION_BIT 8 /* Bits 8-11 - function setting */10125#define DYTC_GET_FUNCTION_BIT 8 /* Bits 8-11 - function setting */
10116#define DYTC_GET_MODE_BIT 12 /* Bits 12-15 - mode setting */10126#define DYTC_GET_MODE_BIT 12 /* Bits 12-15 - mode setting */
10117 10127
@@ -10324,6 +10334,15 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm) · 206 unmodified lines
10324 if (dytc_version < 5)10334 if (dytc_version < 5)
10325 return -ENODEV;10335 return -ENODEV;
10326 10336
10337 /* Check what capabilities are supported. Currently MMC is needed */
10338 err = dytc_command(DYTC_CMD_FUNC_CAP, &output);
10339 if (err)
10340 return err;
10341 if (!(output & BIT(DYTC_FC_MMC))) {
10342 dbg_printk(TPACPI_DBG_INIT, " DYTC MMC mode not supported\n");
10343 return -ENODEV;
10344 }
10345
10327 dbg_printk(TPACPI_DBG_INIT,10346 dbg_printk(TPACPI_DBG_INIT,
10328 "DYTC version %d: thermal mode available\n", dytc_version);10347 "DYTC version %d: thermal mode available\n", dytc_version);
10329 /*10348 /*
drivers/platform/x86/touchscreen_dmi.c+24−0
@@ -770,6 +770,21 @@ static const struct ts_dmi_data predia_basic_data = { · 769 unmodified lines
770 .properties = predia_basic_props,770 .properties = predia_basic_props,
771};771};
772 772
773static const struct property_entry rwc_nanote_p8_props[] = {
774 PROPERTY_ENTRY_U32("touchscreen-min-y", 46),
775 PROPERTY_ENTRY_U32("touchscreen-size-x", 1728),
776 PROPERTY_ENTRY_U32("touchscreen-size-y", 1140),
777 PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
778 PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-rwc-nanote-p8.fw"),
779 PROPERTY_ENTRY_U32("silead,max-fingers", 10),
780 { }
781};
782
783static const struct ts_dmi_data rwc_nanote_p8_data = {
784 .acpi_name = "MSSL1680:00",
785 .properties = rwc_nanote_p8_props,
786};
787
773static const struct property_entry schneider_sct101ctm_props[] = {788static const struct property_entry schneider_sct101ctm_props[] = {
774 PROPERTY_ENTRY_U32("touchscreen-size-x", 1715),789 PROPERTY_ENTRY_U32("touchscreen-size-x", 1715),
775 PROPERTY_ENTRY_U32("touchscreen-size-y", 1140),790 PROPERTY_ENTRY_U32("touchscreen-size-y", 1140),
@@ -1394,6 +1409,15 @@ const struct dmi_system_id touchscreen_dmi_table[] = { · 618 unmodified lines
1394 DMI_EXACT_MATCH(DMI_BOARD_NAME, "0E57"),1409 DMI_EXACT_MATCH(DMI_BOARD_NAME, "0E57"),
1395 },1410 },
1396 },1411 },
1412 {
1413 /* RWC NANOTE P8 */
1414 .driver_data = (void *)&rwc_nanote_p8_data,
1415 .matches = {
1416 DMI_MATCH(DMI_BOARD_VENDOR, "Default string"),
1417 DMI_MATCH(DMI_PRODUCT_NAME, "AY07J"),
1418 DMI_MATCH(DMI_PRODUCT_SKU, "0001")
1419 },
1420 },
1397 {1421 {
1398 /* Schneider SCT101CTM */1422 /* Schneider SCT101CTM */
1399 .driver_data = (void *)&schneider_sct101ctm_data,1423 .driver_data = (void *)&schneider_sct101ctm_data,
drivers/platform/x86/x86-android-tablets.c+95−10
@@ -26,6 +26,7 @@ · 25 unmodified lines
26#include <linux/string.h>26#include <linux/string.h>
27/* For gpio_get_desc() which is EXPORT_SYMBOL_GPL() */27/* For gpio_get_desc() which is EXPORT_SYMBOL_GPL() */
28#include "../../gpio/gpiolib.h"28#include "../../gpio/gpiolib.h"
29#include "../../gpio/gpiolib-acpi.h"
29 30
30/*31/*
31 * Helper code to get Linux IRQ numbers given a description of the IRQ source32 * Helper code to get Linux IRQ numbers given a description of the IRQ source
@@ -47,7 +48,7 @@ struct x86_acpi_irq_data { · 15 unmodified lines
47 int polarity; /* ACPI_ACTIVE_HIGH / ACPI_ACTIVE_LOW / ACPI_ACTIVE_BOTH */48 int polarity; /* ACPI_ACTIVE_HIGH / ACPI_ACTIVE_LOW / ACPI_ACTIVE_BOTH */
48};49};
49 50
50static int x86_acpi_irq_helper_gpiochip_find(struct gpio_chip *gc, void *data)51static int gpiochip_find_match_label(struct gpio_chip *gc, void *data)
51{52{
52 return gc->label && !strcmp(gc->label, data);53 return gc->label && !strcmp(gc->label, data);
53}54}
@@ -73,7 +74,7 @@ static int x86_acpi_irq_helper_get(const struct x86_acpi_irq_data *data) · 19 unmodified lines
73 return irq;74 return irq;
74 case X86_ACPI_IRQ_TYPE_GPIOINT:75 case X86_ACPI_IRQ_TYPE_GPIOINT:
75 /* Like acpi_dev_gpio_irq_get(), but without parsing ACPI resources */76 /* Like acpi_dev_gpio_irq_get(), but without parsing ACPI resources */
76 chip = gpiochip_find(data->chip, x86_acpi_irq_helper_gpiochip_find);77 chip = gpiochip_find(data->chip, gpiochip_find_match_label);
77 if (!chip) {78 if (!chip) {
78 pr_err("error cannot find GPIO chip %s\n", data->chip);79 pr_err("error cannot find GPIO chip %s\n", data->chip);
79 return -ENODEV;80 return -ENODEV;
@@ -143,14 +144,17 @@ struct x86_serdev_info { · 63 unmodified lines
143};144};
144 145
145struct x86_dev_info {146struct x86_dev_info {
147 char *invalid_aei_gpiochip;
146 const char * const *modules;148 const char * const *modules;
147 struct gpiod_lookup_table **gpiod_lookup_tables;149 struct gpiod_lookup_table * const *gpiod_lookup_tables;
148 const struct x86_i2c_client_info *i2c_client_info;150 const struct x86_i2c_client_info *i2c_client_info;
149 const struct platform_device_info *pdev_info;151 const struct platform_device_info *pdev_info;
150 const struct x86_serdev_info *serdev_info;152 const struct x86_serdev_info *serdev_info;
151 int i2c_client_count;153 int i2c_client_count;
152 int pdev_count;154 int pdev_count;
153 int serdev_count;155 int serdev_count;
156 int (*init)(void);
157 void (*exit)(void);
154};158};
155 159
156/* Generic / shared bq24190 settings */160/* Generic / shared bq24190 settings */
@@ -187,8 +191,8 @@ static struct bq24190_platform_data bq24190_pdata = { · 30 unmodified lines
187};191};
188 192
189static const char * const bq24190_modules[] __initconst = {193static const char * const bq24190_modules[] __initconst = {
190 "crystal_cove_charger", /* For the bq24190 IRQ */194 "intel_crystal_cove_charger", /* For the bq24190 IRQ */
191 "bq24190_charger", /* For the Vbus regulator for intel-int3496 */195 "bq24190_charger", /* For the Vbus regulator for intel-int3496 */
192 NULL196 NULL
193};197};
194 198
@@ -302,7 +306,7 @@ static struct gpiod_lookup_table asus_me176c_goodix_gpios = { · 107 unmodified lines
302 },306 },
303};307};
304 308
305static struct gpiod_lookup_table *asus_me176c_gpios[] = {309static struct gpiod_lookup_table * const asus_me176c_gpios[] = {
306 &int3496_gpo2_pin22_gpios,310 &int3496_gpo2_pin22_gpios,
307 &asus_me176c_goodix_gpios,311 &asus_me176c_goodix_gpios,
308 NULL312 NULL
@@ -317,6 +321,7 @@ static const struct x86_dev_info asus_me176c_info __initconst = { · 8 unmodified lines
317 .serdev_count = ARRAY_SIZE(asus_me176c_serdevs),321 .serdev_count = ARRAY_SIZE(asus_me176c_serdevs),
318 .gpiod_lookup_tables = asus_me176c_gpios,322 .gpiod_lookup_tables = asus_me176c_gpios,
319 .modules = bq24190_modules,323 .modules = bq24190_modules,
324 .invalid_aei_gpiochip = "INT33FC:02",
320};325};
321 326
322/* Asus TF103C tablets have an Android factory img with everything hardcoded */327/* Asus TF103C tablets have an Android factory img with everything hardcoded */
@@ -405,7 +410,7 @@ static const struct x86_i2c_client_info asus_tf103c_i2c_clients[] __initconst = · 82 unmodified lines
405 },410 },
406};411};
407 412
408static struct gpiod_lookup_table *asus_tf103c_gpios[] = {413static struct gpiod_lookup_table * const asus_tf103c_gpios[] = {
409 &int3496_gpo2_pin22_gpios,414 &int3496_gpo2_pin22_gpios,
410 NULL415 NULL
411};416};
@@ -417,6 +422,7 @@ static const struct x86_dev_info asus_tf103c_info __initconst = { · 5 unmodified lines
417 .pdev_count = ARRAY_SIZE(int3496_pdevs),422 .pdev_count = ARRAY_SIZE(int3496_pdevs),
418 .gpiod_lookup_tables = asus_tf103c_gpios,423 .gpiod_lookup_tables = asus_tf103c_gpios,
419 .modules = bq24190_modules,424 .modules = bq24190_modules,
425 .invalid_aei_gpiochip = "INT33FC:02",
420};426};
421 427
422/*428/*
@@ -490,6 +496,39 @@ static const struct x86_dev_info chuwi_hi8_info __initconst = { · 67 unmodified lines
490 .i2c_client_count = ARRAY_SIZE(chuwi_hi8_i2c_clients),496 .i2c_client_count = ARRAY_SIZE(chuwi_hi8_i2c_clients),
491};497};
492 498
499#define CZC_EC_EXTRA_PORT 0x68
500#define CZC_EC_ANDROID_KEYS 0x63
501
502static int __init czc_p10t_init(void)
503{
504 /*
505 * The device boots up in "Windows 7" mode, when the home button sends a
506 * Windows specific key sequence (Left Meta + D) and the second button
507 * sends an unknown one while also toggling the Radio Kill Switch.
508 * This is a surprising behavior when the second button is labeled "Back".
509 *
510 * The vendor-supplied Android-x86 build switches the device to a "Android"
511 * mode by writing value 0x63 to the I/O port 0x68. This just seems to just
512 * set bit 6 on address 0x96 in the EC region; switching the bit directly
513 * seems to achieve the same result. It uses a "p10t_switcher" to do the
514 * job. It doesn't seem to be able to do anything else, and no other use
515 * of the port 0x68 is known.
516 *
517 * In the Android mode, the home button sends just a single scancode,
518 * which can be handled in Linux userspace more reasonably and the back
519 * button only sends a scancode without toggling the kill switch.
520 * The scancode can then be mapped either to Back or RF Kill functionality
521 * in userspace, depending on how the button is labeled on that particular
522 * model.
523 */
524 outb(CZC_EC_ANDROID_KEYS, CZC_EC_EXTRA_PORT);
525 return 0;
526}
527
528static const struct x86_dev_info czc_p10t __initconst = {
529 .init = czc_p10t_init,
530};
531
493/*532/*
494 * Whitelabel (sold as various brands) TM800A550L tablets.533 * Whitelabel (sold as various brands) TM800A550L tablets.
495 * These tablet's DSDT contains a whole bunch of bogus ACPI I2C devices534 * These tablet's DSDT contains a whole bunch of bogus ACPI I2C devices
@@ -559,7 +598,7 @@ static struct gpiod_lookup_table whitelabel_tm800a550l_goodix_gpios = { · 63 unmodified lines
559 },598 },
560};599};
561 600
562static struct gpiod_lookup_table *whitelabel_tm800a550l_gpios[] = {601static struct gpiod_lookup_table * const whitelabel_tm800a550l_gpios[] = {
563 &whitelabel_tm800a550l_goodix_gpios,602 &whitelabel_tm800a550l_goodix_gpios,
564 NULL603 NULL
565};604};
@@ -641,6 +680,24 @@ static const struct dmi_system_id x86_android_tablet_ids[] __initconst = { · 75 unmodified lines
641 },680 },
642 .driver_data = (void *)&chuwi_hi8_info,681 .driver_data = (void *)&chuwi_hi8_info,
643 },682 },
683 {
684 /* CZC P10T */
685 .ident = "CZC ODEON TPC-10 (\"P10T\")",
686 .matches = {
687 DMI_MATCH(DMI_SYS_VENDOR, "CZC"),
688 DMI_MATCH(DMI_PRODUCT_NAME, "ODEON*TPC-10"),
689 },
690 .driver_data = (void *)&czc_p10t,
691 },
692 {
693 /* A variant of CZC P10T */
694 .ident = "ViewSonic ViewPad 10",
695 .matches = {
696 DMI_MATCH(DMI_SYS_VENDOR, "ViewSonic"),
697 DMI_MATCH(DMI_PRODUCT_NAME, "VPAD10"),
698 },
699 .driver_data = (void *)&czc_p10t,
700 },
644 {701 {
645 /* Whitelabel (sold as various brands) TM800A550L */702 /* Whitelabel (sold as various brands) TM800A550L */
646 .matches = {703 .matches = {
@@ -669,7 +726,8 @@ static int serdev_count; · 22 unmodified lines
669static struct i2c_client **i2c_clients;726static struct i2c_client **i2c_clients;
670static struct platform_device **pdevs;727static struct platform_device **pdevs;
671static struct serdev_device **serdevs;728static struct serdev_device **serdevs;
672static struct gpiod_lookup_table **gpiod_lookup_tables;729static struct gpiod_lookup_table * const *gpiod_lookup_tables;
730static void (*exit_handler)(void);
673 731
674static __init int x86_instantiate_i2c_client(const struct x86_dev_info *dev_info,732static __init int x86_instantiate_i2c_client(const struct x86_dev_info *dev_info,
675 int idx)733 int idx)
@@ -787,6 +845,9 @@ static void x86_android_tablet_cleanup(void) · 111 unmodified lines
787 845
788 kfree(i2c_clients);846 kfree(i2c_clients);
789 847
848 if (exit_handler)
849 exit_handler();
850
790 for (i = 0; gpiod_lookup_tables && gpiod_lookup_tables[i]; i++)851 for (i = 0; gpiod_lookup_tables && gpiod_lookup_tables[i]; i++)
791 gpiod_remove_lookup_table(gpiod_lookup_tables[i]);852 gpiod_remove_lookup_table(gpiod_lookup_tables[i]);
792}853}
@@ -795,6 +856,7 @@ static __init int x86_android_tablet_init(void) · 2 unmodified lines
795{856{
796 const struct x86_dev_info *dev_info;857 const struct x86_dev_info *dev_info;
797 const struct dmi_system_id *id;858 const struct dmi_system_id *id;
859 struct gpio_chip *chip;
798 int i, ret = 0;860 int i, ret = 0;
799 861
800 id = dmi_first_match(x86_android_tablet_ids);862 id = dmi_first_match(x86_android_tablet_ids);
@@ -803,6 +865,20 @@ static __init int x86_android_tablet_init(void) · 2 unmodified lines
803 865
804 dev_info = id->driver_data;866 dev_info = id->driver_data;
805 867
868 /*
869 * The broken DSDTs on these devices often also include broken
870 * _AEI (ACPI Event Interrupt) handlers, disable these.
871 */
872 if (dev_info->invalid_aei_gpiochip) {
873 chip = gpiochip_find(dev_info->invalid_aei_gpiochip,
874 gpiochip_find_match_label);
875 if (!chip) {
876 pr_err("error cannot find GPIO chip %s\n", dev_info->invalid_aei_gpiochip);
877 return -ENODEV;
878 }
879 acpi_gpiochip_free_interrupts(chip);
880 }
881
806 /*882 /*
807 * Since this runs from module_init() it cannot use -EPROBE_DEFER,883 * Since this runs from module_init() it cannot use -EPROBE_DEFER,
808 * instead pre-load any modules which are listed as requirements.884 * instead pre-load any modules which are listed as requirements.
@@ -814,6 +890,15 @@ static __init int x86_android_tablet_init(void) · 5 unmodified lines
814 for (i = 0; gpiod_lookup_tables && gpiod_lookup_tables[i]; i++)890 for (i = 0; gpiod_lookup_tables && gpiod_lookup_tables[i]; i++)
815 gpiod_add_lookup_table(gpiod_lookup_tables[i]);891 gpiod_add_lookup_table(gpiod_lookup_tables[i]);
816 892
893 if (dev_info->init) {
894 ret = dev_info->init();
895 if (ret < 0) {
896 x86_android_tablet_cleanup();
897 return ret;
898 }
899 exit_handler = dev_info->exit;
900 }
901
817 i2c_clients = kcalloc(dev_info->i2c_client_count, sizeof(*i2c_clients), GFP_KERNEL);902 i2c_clients = kcalloc(dev_info->i2c_client_count, sizeof(*i2c_clients), GFP_KERNEL);
818 if (!i2c_clients) {903 if (!i2c_clients) {
819 x86_android_tablet_cleanup();904 x86_android_tablet_cleanup();
@@ -865,6 +950,6 @@ static __init int x86_android_tablet_init(void) · 45 unmodified lines
865module_init(x86_android_tablet_init);950module_init(x86_android_tablet_init);
866module_exit(x86_android_tablet_cleanup);951module_exit(x86_android_tablet_cleanup);
867 952
868MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com");953MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>");
869MODULE_DESCRIPTION("X86 Android tablets DSDT fixups driver");954MODULE_DESCRIPTION("X86 Android tablets DSDT fixups driver");
870MODULE_LICENSE("GPL");955MODULE_LICENSE("GPL");
drivers/regulator/max20086-regulator.c+2−1
@@ -7,6 +7,7 @@ · 6 unmodified lines
7 7
8#include <linux/err.h>8#include <linux/err.h>
9#include <linux/gpio.h>9#include <linux/gpio.h>
10#include <linux/gpio/consumer.h>
10#include <linux/i2c.h>11#include <linux/i2c.h>
11#include <linux/module.h>12#include <linux/module.h>
12#include <linux/regmap.h>13#include <linux/regmap.h>
@@ -140,7 +141,7 @@ static int max20086_parse_regulators_dt(struct max20086 *chip, bool *boot_on) · 127 unmodified lines
140 node = of_get_child_by_name(chip->dev->of_node, "regulators");141 node = of_get_child_by_name(chip->dev->of_node, "regulators");
141 if (!node) {142 if (!node) {
142 dev_err(chip->dev, "regulators node not found\n");143 dev_err(chip->dev, "regulators node not found\n");
143 return PTR_ERR(node);144 return -ENODEV;
144 }145 }
145 146
146 for (i = 0; i < chip->info->num_outputs; ++i)147 for (i = 0; i < chip->info->num_outputs; ++i)
drivers/scsi/bnx2fc/bnx2fc_fcoe.c+13−8
@@ -508,7 +508,8 @@ static int bnx2fc_l2_rcv_thread(void *arg) · 507 unmodified lines
508 508
509static void bnx2fc_recv_frame(struct sk_buff *skb)509static void bnx2fc_recv_frame(struct sk_buff *skb)
510{510{
511 u32 fr_len;511 u64 crc_err;
512 u32 fr_len, fr_crc;
512 struct fc_lport *lport;513 struct fc_lport *lport;
513 struct fcoe_rcv_info *fr;514 struct fcoe_rcv_info *fr;
514 struct fc_stats *stats;515 struct fc_stats *stats;
@@ -542,6 +543,11 @@ static void bnx2fc_recv_frame(struct sk_buff *skb) · 27 unmodified lines
542 skb_pull(skb, sizeof(struct fcoe_hdr));543 skb_pull(skb, sizeof(struct fcoe_hdr));
543 fr_len = skb->len - sizeof(struct fcoe_crc_eof);544 fr_len = skb->len - sizeof(struct fcoe_crc_eof);
544 545
546 stats = per_cpu_ptr(lport->stats, get_cpu());
547 stats->RxFrames++;
548 stats->RxWords += fr_len / FCOE_WORD_TO_BYTE;
549 put_cpu();
550
545 fp = (struct fc_frame *)skb;551 fp = (struct fc_frame *)skb;
546 fc_frame_init(fp);552 fc_frame_init(fp);
547 fr_dev(fp) = lport;553 fr_dev(fp) = lport;
@@ -624,16 +630,15 @@ static void bnx2fc_recv_frame(struct sk_buff *skb) · 76 unmodified lines
624 return;630 return;
625 }631 }
626 632
627 stats = per_cpu_ptr(lport->stats, smp_processor_id());633 fr_crc = le32_to_cpu(fr_crc(fp));
628 stats->RxFrames++;
629 stats->RxWords += fr_len / FCOE_WORD_TO_BYTE;
630 634
631 if (le32_to_cpu(fr_crc(fp)) !=635 if (unlikely(fr_crc != ~crc32(~0, skb->data, fr_len))) {
632 ~crc32(~0, skb->data, fr_len)) {636 stats = per_cpu_ptr(lport->stats, get_cpu());
633 if (stats->InvalidCRCCount < 5)637 crc_err = (stats->InvalidCRCCount++);
638 put_cpu();
639 if (crc_err < 5)
634 printk(KERN_WARNING PFX "dropping frame with "640 printk(KERN_WARNING PFX "dropping frame with "
635 "CRC error\n");641 "CRC error\n");
636 stats->InvalidCRCCount++;
637 kfree_skb(skb);642 kfree_skb(skb);
638 return;643 return;
639 }644 }
drivers/scsi/hisi_sas/hisi_sas_main.c+6−8
@@ -400,8 +400,7 @@ void hisi_sas_task_deliver(struct hisi_hba *hisi_hba, · 399 unmodified lines
400 struct hisi_sas_slot *slot,400 struct hisi_sas_slot *slot,
401 struct hisi_sas_dq *dq,401 struct hisi_sas_dq *dq,
402 struct hisi_sas_device *sas_dev,402 struct hisi_sas_device *sas_dev,
403 struct hisi_sas_internal_abort *abort,403 struct hisi_sas_internal_abort *abort)
404 struct hisi_sas_tmf_task *tmf)
405{404{
406 struct hisi_sas_cmd_hdr *cmd_hdr_base;405 struct hisi_sas_cmd_hdr *cmd_hdr_base;
407 int dlvry_queue_slot, dlvry_queue;406 int dlvry_queue_slot, dlvry_queue;
@@ -427,8 +426,6 @@ void hisi_sas_task_deliver(struct hisi_hba *hisi_hba, · 19 unmodified lines
427 cmd_hdr_base = hisi_hba->cmd_hdr[dlvry_queue];426 cmd_hdr_base = hisi_hba->cmd_hdr[dlvry_queue];
428 slot->cmd_hdr = &cmd_hdr_base[dlvry_queue_slot];427 slot->cmd_hdr = &cmd_hdr_base[dlvry_queue_slot];
429 428
430 slot->tmf = tmf;
431 slot->is_internal = tmf;
432 task->lldd_task = slot;429 task->lldd_task = slot;
433 430
434 memset(slot->cmd_hdr, 0, sizeof(struct hisi_sas_cmd_hdr));431 memset(slot->cmd_hdr, 0, sizeof(struct hisi_sas_cmd_hdr));
@@ -587,7 +584,7 @@ static int hisi_sas_task_exec(struct sas_task *task, gfp_t gfp_flags, · 152 unmodified lines
587 slot->is_internal = tmf;584 slot->is_internal = tmf;
588 585
589 /* protect task_prep and start_delivery sequence */586 /* protect task_prep and start_delivery sequence */
590 hisi_sas_task_deliver(hisi_hba, slot, dq, sas_dev, NULL, tmf);587 hisi_sas_task_deliver(hisi_hba, slot, dq, sas_dev, NULL);
591 588
592 return 0;589 return 0;
593 590
@@ -1380,12 +1377,13 @@ static int hisi_sas_softreset_ata_disk(struct domain_device *device) · 786 unmodified lines
1380 struct hisi_hba *hisi_hba = dev_to_hisi_hba(device);1377 struct hisi_hba *hisi_hba = dev_to_hisi_hba(device);
1381 struct device *dev = hisi_hba->dev;1378 struct device *dev = hisi_hba->dev;
1382 int s = sizeof(struct host_to_dev_fis);1379 int s = sizeof(struct host_to_dev_fis);
1380 struct hisi_sas_tmf_task tmf = {};
1383 1381
1384 ata_for_each_link(link, ap, EDGE) {1382 ata_for_each_link(link, ap, EDGE) {
1385 int pmp = sata_srst_pmp(link);1383 int pmp = sata_srst_pmp(link);
1386 1384
1387 hisi_sas_fill_ata_reset_cmd(link->device, 1, pmp, fis);1385 hisi_sas_fill_ata_reset_cmd(link->device, 1, pmp, fis);
1388 rc = hisi_sas_exec_internal_tmf_task(device, fis, s, NULL);1386 rc = hisi_sas_exec_internal_tmf_task(device, fis, s, &tmf);
1389 if (rc != TMF_RESP_FUNC_COMPLETE)1387 if (rc != TMF_RESP_FUNC_COMPLETE)
1390 break;1388 break;
1391 }1389 }
@@ -1396,7 +1394,7 @@ static int hisi_sas_softreset_ata_disk(struct domain_device *device) · 4 unmodified lines
1396 1394
1397 hisi_sas_fill_ata_reset_cmd(link->device, 0, pmp, fis);1395 hisi_sas_fill_ata_reset_cmd(link->device, 0, pmp, fis);
1398 rc = hisi_sas_exec_internal_tmf_task(device, fis,1396 rc = hisi_sas_exec_internal_tmf_task(device, fis,
1399 s, NULL);1397 s, &tmf);
1400 if (rc != TMF_RESP_FUNC_COMPLETE)1398 if (rc != TMF_RESP_FUNC_COMPLETE)
1401 dev_err(dev, "ata disk %016llx de-reset failed\n",1399 dev_err(dev, "ata disk %016llx de-reset failed\n",
1402 SAS_ADDR(device->sas_addr));1400 SAS_ADDR(device->sas_addr));
@@ -2067,7 +2065,7 @@ hisi_sas_internal_abort_task_exec(struct hisi_hba *hisi_hba, int device_id, · 664 unmodified lines
2067 slot->port = port;2065 slot->port = port;
2068 slot->is_internal = true;2066 slot->is_internal = true;
2069 2067
2070 hisi_sas_task_deliver(hisi_hba, slot, dq, sas_dev, abort, NULL);2068 hisi_sas_task_deliver(hisi_hba, slot, dq, sas_dev, abort);
2071 2069
2072 return 0;2070 return 0;
2073 2071
drivers/scsi/pm8001/pm8001_hwi.c+0−18
@@ -2692,7 +2692,6 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha, void *piomb) · 2691 unmodified lines
2692 u32 tag = le32_to_cpu(psataPayload->tag);2692 u32 tag = le32_to_cpu(psataPayload->tag);
2693 u32 port_id = le32_to_cpu(psataPayload->port_id);2693 u32 port_id = le32_to_cpu(psataPayload->port_id);
2694 u32 dev_id = le32_to_cpu(psataPayload->device_id);2694 u32 dev_id = le32_to_cpu(psataPayload->device_id);
2695 unsigned long flags;
2696 2695
2697 if (event)2696 if (event)
2698 pm8001_dbg(pm8001_ha, FAIL, "SATA EVENT 0x%x\n", event);2697 pm8001_dbg(pm8001_ha, FAIL, "SATA EVENT 0x%x\n", event);
@@ -2724,8 +2723,6 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha, void *piomb) · 25 unmodified lines
2724 ts->resp = SAS_TASK_COMPLETE;2723 ts->resp = SAS_TASK_COMPLETE;
2725 ts->stat = SAS_DATA_OVERRUN;2724 ts->stat = SAS_DATA_OVERRUN;
2726 ts->residual = 0;2725 ts->residual = 0;
2727 if (pm8001_dev)
2728 atomic_dec(&pm8001_dev->running_req);
2729 break;2726 break;
2730 case IO_XFER_ERROR_BREAK:2727 case IO_XFER_ERROR_BREAK:
2731 pm8001_dbg(pm8001_ha, IO, "IO_XFER_ERROR_BREAK\n");2728 pm8001_dbg(pm8001_ha, IO, "IO_XFER_ERROR_BREAK\n");
@@ -2767,7 +2764,6 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha, void *piomb) · 35 unmodified lines
2767 IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS);2764 IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS);
2768 ts->resp = SAS_TASK_COMPLETE;2765 ts->resp = SAS_TASK_COMPLETE;
2769 ts->stat = SAS_QUEUE_FULL;2766 ts->stat = SAS_QUEUE_FULL;
2770 pm8001_ccb_task_free_done(pm8001_ha, t, ccb, tag);
2771 return;2767 return;
2772 }2768 }
2773 break;2769 break;
@@ -2853,20 +2849,6 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha, void *piomb) · 79 unmodified lines
2853 ts->stat = SAS_OPEN_TO;2849 ts->stat = SAS_OPEN_TO;
2854 break;2850 break;
2855 }2851 }
2856 spin_lock_irqsave(&t->task_state_lock, flags);
2857 t->task_state_flags &= ~SAS_TASK_STATE_PENDING;
2858 t->task_state_flags &= ~SAS_TASK_AT_INITIATOR;
2859 t->task_state_flags |= SAS_TASK_STATE_DONE;
2860 if (unlikely((t->task_state_flags & SAS_TASK_STATE_ABORTED))) {
2861 spin_unlock_irqrestore(&t->task_state_lock, flags);
2862 pm8001_dbg(pm8001_ha, FAIL,
2863 "task 0x%p done with io_status 0x%x resp 0x%x stat 0x%x but aborted by upper layer!\n",
2864 t, event, ts->resp, ts->stat);
2865 pm8001_ccb_task_free(pm8001_ha, t, ccb, tag);
2866 } else {
2867 spin_unlock_irqrestore(&t->task_state_lock, flags);
2868 pm8001_ccb_task_free_done(pm8001_ha, t, ccb, tag);
2869 }
2870}2852}
2871 2853
2872/*See the comments for mpi_ssp_completion */2854/*See the comments for mpi_ssp_completion */
drivers/scsi/pm8001/pm8001_sas.c+5−0
@@ -769,8 +769,13 @@ static int pm8001_exec_internal_tmf_task(struct domain_device *dev, · 768 unmodified lines
769 res = -TMF_RESP_FUNC_FAILED;769 res = -TMF_RESP_FUNC_FAILED;
770 /* Even TMF timed out, return direct. */770 /* Even TMF timed out, return direct. */
771 if (task->task_state_flags & SAS_TASK_STATE_ABORTED) {771 if (task->task_state_flags & SAS_TASK_STATE_ABORTED) {
772 struct pm8001_ccb_info *ccb = task->lldd_task;
773
772 pm8001_dbg(pm8001_ha, FAIL, "TMF task[%x]timeout.\n",774 pm8001_dbg(pm8001_ha, FAIL, "TMF task[%x]timeout.\n",
773 tmf->tmf);775 tmf->tmf);
776
777 if (ccb)
778 ccb->task = NULL;
774 goto ex_err;779 goto ex_err;
775 }780 }
776 781
drivers/scsi/pm8001/pm80xx_hwi.c+3−28
@@ -2185,9 +2185,9 @@ mpi_ssp_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) · 2184 unmodified lines
2185 pm8001_dbg(pm8001_ha, FAIL,2185 pm8001_dbg(pm8001_ha, FAIL,
2186 "task 0x%p done with io_status 0x%x resp 0x%x stat 0x%x but aborted by upper layer!\n",2186 "task 0x%p done with io_status 0x%x resp 0x%x stat 0x%x but aborted by upper layer!\n",
2187 t, status, ts->resp, ts->stat);2187 t, status, ts->resp, ts->stat);
2188 pm8001_ccb_task_free(pm8001_ha, t, ccb, tag);
2188 if (t->slow_task)2189 if (t->slow_task)
2189 complete(&t->slow_task->completion);2190 complete(&t->slow_task->completion);
2190 pm8001_ccb_task_free(pm8001_ha, t, ccb, tag);
2191 } else {2191 } else {
2192 spin_unlock_irqrestore(&t->task_state_lock, flags);2192 spin_unlock_irqrestore(&t->task_state_lock, flags);
2193 pm8001_ccb_task_free(pm8001_ha, t, ccb, tag);2193 pm8001_ccb_task_free(pm8001_ha, t, ccb, tag);
@@ -2794,9 +2794,9 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, · 600 unmodified lines
2794 pm8001_dbg(pm8001_ha, FAIL,2794 pm8001_dbg(pm8001_ha, FAIL,
2795 "task 0x%p done with io_status 0x%x resp 0x%x stat 0x%x but aborted by upper layer!\n",2795 "task 0x%p done with io_status 0x%x resp 0x%x stat 0x%x but aborted by upper layer!\n",
2796 t, status, ts->resp, ts->stat);2796 t, status, ts->resp, ts->stat);
2797 pm8001_ccb_task_free(pm8001_ha, t, ccb, tag);
2797 if (t->slow_task)2798 if (t->slow_task)
2798 complete(&t->slow_task->completion);2799 complete(&t->slow_task->completion);
2799 pm8001_ccb_task_free(pm8001_ha, t, ccb, tag);
2800 } else {2800 } else {
2801 spin_unlock_irqrestore(&t->task_state_lock, flags);2801 spin_unlock_irqrestore(&t->task_state_lock, flags);
2802 spin_unlock_irqrestore(&circularQ->oq_lock,2802 spin_unlock_irqrestore(&circularQ->oq_lock,
@@ -2821,7 +2821,6 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha, · 18 unmodified lines
2821 u32 tag = le32_to_cpu(psataPayload->tag);2821 u32 tag = le32_to_cpu(psataPayload->tag);
2822 u32 port_id = le32_to_cpu(psataPayload->port_id);2822 u32 port_id = le32_to_cpu(psataPayload->port_id);
2823 u32 dev_id = le32_to_cpu(psataPayload->device_id);2823 u32 dev_id = le32_to_cpu(psataPayload->device_id);
2824 unsigned long flags;
2825 2824
2826 if (event)2825 if (event)
2827 pm8001_dbg(pm8001_ha, FAIL, "SATA EVENT 0x%x\n", event);2826 pm8001_dbg(pm8001_ha, FAIL, "SATA EVENT 0x%x\n", event);
@@ -2854,8 +2853,6 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha, · 26 unmodified lines
2854 ts->resp = SAS_TASK_COMPLETE;2853 ts->resp = SAS_TASK_COMPLETE;
2855 ts->stat = SAS_DATA_OVERRUN;2854 ts->stat = SAS_DATA_OVERRUN;
2856 ts->residual = 0;2855 ts->residual = 0;
2857 if (pm8001_dev)
2858 atomic_dec(&pm8001_dev->running_req);
2859 break;2856 break;
2860 case IO_XFER_ERROR_BREAK:2857 case IO_XFER_ERROR_BREAK:
2861 pm8001_dbg(pm8001_ha, IO, "IO_XFER_ERROR_BREAK\n");2858 pm8001_dbg(pm8001_ha, IO, "IO_XFER_ERROR_BREAK\n");
@@ -2904,11 +2901,6 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha, · 42 unmodified lines
2904 IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS);2901 IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS);
2905 ts->resp = SAS_TASK_COMPLETE;2902 ts->resp = SAS_TASK_COMPLETE;
2906 ts->stat = SAS_QUEUE_FULL;2903 ts->stat = SAS_QUEUE_FULL;
2907 spin_unlock_irqrestore(&circularQ->oq_lock,
2908 circularQ->lock_flags);
2909 pm8001_ccb_task_free_done(pm8001_ha, t, ccb, tag);
2910 spin_lock_irqsave(&circularQ->oq_lock,
2911 circularQ->lock_flags);
2912 return;2904 return;
2913 }2905 }
2914 break;2906 break;
@@ -3008,24 +3000,6 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha, · 93 unmodified lines
3008 ts->stat = SAS_OPEN_TO;3000 ts->stat = SAS_OPEN_TO;
3009 break;3001 break;
3010 }3002 }
3011 spin_lock_irqsave(&t->task_state_lock, flags);
3012 t->task_state_flags &= ~SAS_TASK_STATE_PENDING;
3013 t->task_state_flags &= ~SAS_TASK_AT_INITIATOR;
3014 t->task_state_flags |= SAS_TASK_STATE_DONE;
3015 if (unlikely((t->task_state_flags & SAS_TASK_STATE_ABORTED))) {
3016 spin_unlock_irqrestore(&t->task_state_lock, flags);
3017 pm8001_dbg(pm8001_ha, FAIL,
3018 "task 0x%p done with io_status 0x%x resp 0x%x stat 0x%x but aborted by upper layer!\n",
3019 t, event, ts->resp, ts->stat);
3020 pm8001_ccb_task_free(pm8001_ha, t, ccb, tag);
3021 } else {
3022 spin_unlock_irqrestore(&t->task_state_lock, flags);
3023 spin_unlock_irqrestore(&circularQ->oq_lock,
3024 circularQ->lock_flags);
3025 pm8001_ccb_task_free_done(pm8001_ha, t, ccb, tag);
3026 spin_lock_irqsave(&circularQ->oq_lock,
3027 circularQ->lock_flags);
3028 }
3029}3003}
3030 3004
3031/*See the comments for mpi_ssp_completion */3005/*See the comments for mpi_ssp_completion */
@@ -3931,6 +3905,7 @@ static int ssp_coalesced_comp_resp(struct pm8001_hba_info *pm8001_ha, · 899 unmodified lines
3931/**3905/**
3932 * process_one_iomb - process one outbound Queue memory block3906 * process_one_iomb - process one outbound Queue memory block
3933 * @pm8001_ha: our hba card information3907 * @pm8001_ha: our hba card information
3908 * @circularQ: outbound circular queue
3934 * @piomb: IO message buffer3909 * @piomb: IO message buffer
3935 */3910 */
3936static void process_one_iomb(struct pm8001_hba_info *pm8001_ha,3911static void process_one_iomb(struct pm8001_hba_info *pm8001_ha,
drivers/scsi/scsi_scan.c+50−5
@@ -214,6 +214,48 @@ static void scsi_unlock_floptical(struct scsi_device *sdev, · 213 unmodified lines
214 SCSI_TIMEOUT, 3, NULL);214 SCSI_TIMEOUT, 3, NULL);
215}215}
216 216
217static int scsi_realloc_sdev_budget_map(struct scsi_device *sdev,
218 unsigned int depth)
219{
220 int new_shift = sbitmap_calculate_shift(depth);
221 bool need_alloc = !sdev->budget_map.map;
222 bool need_free = false;
223 int ret;
224 struct sbitmap sb_backup;
225
226 /*
227 * realloc if new shift is calculated, which is caused by setting
228 * up one new default queue depth after calling ->slave_configure
229 */
230 if (!need_alloc && new_shift != sdev->budget_map.shift)
231 need_alloc = need_free = true;
232
233 if (!need_alloc)
234 return 0;
235
236 /*
237 * Request queue has to be frozen for reallocating budget map,
238 * and here disk isn't added yet, so freezing is pretty fast
239 */
240 if (need_free) {
241 blk_mq_freeze_queue(sdev->request_queue);
242 sb_backup = sdev->budget_map;
243 }
244 ret = sbitmap_init_node(&sdev->budget_map,
245 scsi_device_max_queue_depth(sdev),
246 new_shift, GFP_KERNEL,
247 sdev->request_queue->node, false, true);
248 if (need_free) {
249 if (ret)
250 sdev->budget_map = sb_backup;
251 else
252 sbitmap_free(&sb_backup);
253 ret = 0;
254 blk_mq_unfreeze_queue(sdev->request_queue);
255 }
256 return ret;
257}
258
217/**259/**
218 * scsi_alloc_sdev - allocate and setup a scsi_Device260 * scsi_alloc_sdev - allocate and setup a scsi_Device
219 * @starget: which target to allocate a &scsi_device for261 * @starget: which target to allocate a &scsi_device for
@@ -306,11 +348,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget, · 86 unmodified lines
306 * default device queue depth to figure out sbitmap shift348 * default device queue depth to figure out sbitmap shift
307 * since we use this queue depth most of times.349 * since we use this queue depth most of times.
308 */350 */
309 if (sbitmap_init_node(&sdev->budget_map,351 if (scsi_realloc_sdev_budget_map(sdev, depth)) {
310 scsi_device_max_queue_depth(sdev),
311 sbitmap_calculate_shift(depth),
312 GFP_KERNEL, sdev->request_queue->node,
313 false, true)) {
314 put_device(&starget->dev);352 put_device(&starget->dev);
315 kfree(sdev);353 kfree(sdev);
316 goto out;354 goto out;
@@ -1017,6 +1055,13 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result, · 700 unmodified lines
1017 }1055 }
1018 return SCSI_SCAN_NO_RESPONSE;1056 return SCSI_SCAN_NO_RESPONSE;
1019 }1057 }
1058
1059 /*
1060 * The queue_depth is often changed in ->slave_configure.
1061 * Set up budget map again since memory consumption of
1062 * the map depends on actual queue depth.
1063 */
1064 scsi_realloc_sdev_budget_map(sdev, sdev->queue_depth);
1020 }1065 }
1021 1066
1022 if (sdev->scsi_level >= SCSI_3)1067 if (sdev->scsi_level >= SCSI_3)
drivers/spi/spi-bcm-qspi.c+1−1
@@ -585,7 +585,7 @@ static void bcm_qspi_chip_select(struct bcm_qspi *qspi, int cs) · 584 unmodified lines
585 u32 rd = 0;585 u32 rd = 0;
586 u32 wr = 0;586 u32 wr = 0;
587 587
588 if (qspi->base[CHIP_SELECT]) {588 if (cs >= 0 && qspi->base[CHIP_SELECT]) {
589 rd = bcm_qspi_read(qspi, CHIP_SELECT, 0);589 rd = bcm_qspi_read(qspi, CHIP_SELECT, 0);
590 wr = (rd & ~0xff) | (1 << cs);590 wr = (rd & ~0xff) | (1 << cs);
591 if (rd == wr)591 if (rd == wr)
drivers/spi/spi-meson-spicc.c+5−0
@@ -693,6 +693,11 @@ static int meson_spicc_probe(struct platform_device *pdev) · 692 unmodified lines
693 writel_relaxed(0, spicc->base + SPICC_INTREG);693 writel_relaxed(0, spicc->base + SPICC_INTREG);
694 694
695 irq = platform_get_irq(pdev, 0);695 irq = platform_get_irq(pdev, 0);
696 if (irq < 0) {
697 ret = irq;
698 goto out_master;
699 }
700
696 ret = devm_request_irq(&pdev->dev, irq, meson_spicc_irq,701 ret = devm_request_irq(&pdev->dev, irq, meson_spicc_irq,
697 0, NULL, spicc);702 0, NULL, spicc);
698 if (ret) {703 if (ret) {
drivers/spi/spi-mt65xx.c+1−1
@@ -624,7 +624,7 @@ static irqreturn_t mtk_spi_interrupt(int irq, void *dev_id) · 623 unmodified lines
624 else624 else
625 mdata->state = MTK_SPI_IDLE;625 mdata->state = MTK_SPI_IDLE;
626 626
627 if (!master->can_dma(master, master->cur_msg->spi, trans)) {627 if (!master->can_dma(master, NULL, trans)) {
628 if (trans->rx_buf) {628 if (trans->rx_buf) {
629 cnt = mdata->xfer_len / 4;629 cnt = mdata->xfer_len / 4;
630 ioread32_rep(mdata->base + SPI_RX_DATA_REG,630 ioread32_rep(mdata->base + SPI_RX_DATA_REG,
drivers/spi/spi-stm32-qspi.c+17−30
@@ -688,7 +688,7 @@ static int stm32_qspi_probe(struct platform_device *pdev) · 687 unmodified lines
688 struct resource *res;688 struct resource *res;
689 int ret, irq;689 int ret, irq;
690 690
691 ctrl = spi_alloc_master(dev, sizeof(*qspi));691 ctrl = devm_spi_alloc_master(dev, sizeof(*qspi));
692 if (!ctrl)692 if (!ctrl)
693 return -ENOMEM;693 return -ENOMEM;
694 694
@@ -697,58 +697,46 @@ static int stm32_qspi_probe(struct platform_device *pdev) · 2 unmodified lines
697 697
698 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "qspi");698 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "qspi");
699 qspi->io_base = devm_ioremap_resource(dev, res);699 qspi->io_base = devm_ioremap_resource(dev, res);
700 if (IS_ERR(qspi->io_base)) {700 if (IS_ERR(qspi->io_base))
701 ret = PTR_ERR(qspi->io_base);701 return PTR_ERR(qspi->io_base);
702 goto err_master_put;
703 }
704 702
705 qspi->phys_base = res->start;703 qspi->phys_base = res->start;
706 704
707 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "qspi_mm");705 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "qspi_mm");
708 qspi->mm_base = devm_ioremap_resource(dev, res);706 qspi->mm_base = devm_ioremap_resource(dev, res);
709 if (IS_ERR(qspi->mm_base)) {707 if (IS_ERR(qspi->mm_base))
710 ret = PTR_ERR(qspi->mm_base);708 return PTR_ERR(qspi->mm_base);
711 goto err_master_put;
712 }
713 709
714 qspi->mm_size = resource_size(res);710 qspi->mm_size = resource_size(res);
715 if (qspi->mm_size > STM32_QSPI_MAX_MMAP_SZ) {711 if (qspi->mm_size > STM32_QSPI_MAX_MMAP_SZ)
716 ret = -EINVAL;712 return -EINVAL;
717 goto err_master_put;
718 }
719 713
720 irq = platform_get_irq(pdev, 0);714 irq = platform_get_irq(pdev, 0);
721 if (irq < 0) {715 if (irq < 0)
722 ret = irq;716 return irq;
723 goto err_master_put;
724 }
725 717
726 ret = devm_request_irq(dev, irq, stm32_qspi_irq, 0,718 ret = devm_request_irq(dev, irq, stm32_qspi_irq, 0,
727 dev_name(dev), qspi);719 dev_name(dev), qspi);
728 if (ret) {720 if (ret) {
729 dev_err(dev, "failed to request irq\n");721 dev_err(dev, "failed to request irq\n");
730 goto err_master_put;722 return ret;
731 }723 }
732 724
733 init_completion(&qspi->data_completion);725 init_completion(&qspi->data_completion);
734 init_completion(&qspi->match_completion);726 init_completion(&qspi->match_completion);
735 727
736 qspi->clk = devm_clk_get(dev, NULL);728 qspi->clk = devm_clk_get(dev, NULL);
737 if (IS_ERR(qspi->clk)) {729 if (IS_ERR(qspi->clk))
738 ret = PTR_ERR(qspi->clk);730 return PTR_ERR(qspi->clk);
739 goto err_master_put;
740 }
741 731
742 qspi->clk_rate = clk_get_rate(qspi->clk);732 qspi->clk_rate = clk_get_rate(qspi->clk);
743 if (!qspi->clk_rate) {733 if (!qspi->clk_rate)
744 ret = -EINVAL;734 return -EINVAL;
745 goto err_master_put;
746 }
747 735
748 ret = clk_prepare_enable(qspi->clk);736 ret = clk_prepare_enable(qspi->clk);
749 if (ret) {737 if (ret) {
750 dev_err(dev, "can not enable the clock\n");738 dev_err(dev, "can not enable the clock\n");
751 goto err_master_put;739 return ret;
752 }740 }
753 741
754 rstc = devm_reset_control_get_exclusive(dev, NULL);742 rstc = devm_reset_control_get_exclusive(dev, NULL);
@@ -784,7 +772,7 @@ static int stm32_qspi_probe(struct platform_device *pdev) · 29 unmodified lines
784 pm_runtime_enable(dev);772 pm_runtime_enable(dev);
785 pm_runtime_get_noresume(dev);773 pm_runtime_get_noresume(dev);
786 774
787 ret = devm_spi_register_master(dev, ctrl);775 ret = spi_register_master(ctrl);
788 if (ret)776 if (ret)
789 goto err_pm_runtime_free;777 goto err_pm_runtime_free;
790 778
@@ -806,8 +794,6 @@ err_dma_free: · 15 unmodified lines
806 stm32_qspi_dma_free(qspi);794 stm32_qspi_dma_free(qspi);
807err_clk_disable:795err_clk_disable:
808 clk_disable_unprepare(qspi->clk);796 clk_disable_unprepare(qspi->clk);
809err_master_put:
810 spi_master_put(qspi->ctrl);
811 797
812 return ret;798 return ret;
813}799}
@@ -817,6 +803,7 @@ static int stm32_qspi_remove(struct platform_device *pdev) · 3 unmodified lines
817 struct stm32_qspi *qspi = platform_get_drvdata(pdev);803 struct stm32_qspi *qspi = platform_get_drvdata(pdev);
818 804
819 pm_runtime_get_sync(qspi->dev);805 pm_runtime_get_sync(qspi->dev);
806 spi_unregister_master(qspi->ctrl);
820 /* disable qspi */807 /* disable qspi */
821 writel_relaxed(0, qspi->io_base + QSPI_CR);808 writel_relaxed(0, qspi->io_base + QSPI_CR);
822 stm32_qspi_dma_free(qspi);809 stm32_qspi_dma_free(qspi);
drivers/spi/spi-stm32.c+4−3
@@ -221,7 +221,6 @@ struct stm32_spi; · 220 unmodified lines
221 * time between frames (if driver has this functionality)221 * time between frames (if driver has this functionality)
222 * @set_number_of_data: optional routine to configure registers to desired222 * @set_number_of_data: optional routine to configure registers to desired
223 * number of data (if driver has this functionality)223 * number of data (if driver has this functionality)
224 * @can_dma: routine to determine if the transfer is eligible for DMA use
225 * @transfer_one_dma_start: routine to start transfer a single spi_transfer224 * @transfer_one_dma_start: routine to start transfer a single spi_transfer
226 * using DMA225 * using DMA
227 * @dma_rx_cb: routine to call after DMA RX channel operation is complete226 * @dma_rx_cb: routine to call after DMA RX channel operation is complete
@@ -232,7 +231,7 @@ struct stm32_spi; · 4 unmodified lines
232 * @baud_rate_div_min: minimum baud rate divisor231 * @baud_rate_div_min: minimum baud rate divisor
233 * @baud_rate_div_max: maximum baud rate divisor232 * @baud_rate_div_max: maximum baud rate divisor
234 * @has_fifo: boolean to know if fifo is used for driver233 * @has_fifo: boolean to know if fifo is used for driver
235 * @has_startbit: boolean to know if start bit is used to start transfer234 * @flags: compatible specific SPI controller flags used at registration time
236 */235 */
237struct stm32_spi_cfg {236struct stm32_spi_cfg {
238 const struct stm32_spi_regspec *regs;237 const struct stm32_spi_regspec *regs;
@@ -253,6 +252,7 @@ struct stm32_spi_cfg { · 14 unmodified lines
253 unsigned int baud_rate_div_min;252 unsigned int baud_rate_div_min;
254 unsigned int baud_rate_div_max;253 unsigned int baud_rate_div_max;
255 bool has_fifo;254 bool has_fifo;
255 u16 flags;
256};256};
257 257
258/**258/**
@@ -1722,6 +1722,7 @@ static const struct stm32_spi_cfg stm32f4_spi_cfg = { · 1463 unmodified lines
1722 .baud_rate_div_min = STM32F4_SPI_BR_DIV_MIN,1722 .baud_rate_div_min = STM32F4_SPI_BR_DIV_MIN,
1723 .baud_rate_div_max = STM32F4_SPI_BR_DIV_MAX,1723 .baud_rate_div_max = STM32F4_SPI_BR_DIV_MAX,
1724 .has_fifo = false,1724 .has_fifo = false,
1725 .flags = SPI_MASTER_MUST_TX,
1725};1726};
1726 1727
1727static const struct stm32_spi_cfg stm32h7_spi_cfg = {1728static const struct stm32_spi_cfg stm32h7_spi_cfg = {
@@ -1854,7 +1855,7 @@ static int stm32_spi_probe(struct platform_device *pdev) · 126 unmodified lines
1854 master->prepare_message = stm32_spi_prepare_msg;1855 master->prepare_message = stm32_spi_prepare_msg;
1855 master->transfer_one = stm32_spi_transfer_one;1856 master->transfer_one = stm32_spi_transfer_one;
1856 master->unprepare_message = stm32_spi_unprepare_msg;1857 master->unprepare_message = stm32_spi_unprepare_msg;
1857 master->flags = SPI_MASTER_MUST_TX;1858 master->flags = spi->cfg->flags;
1858 1859
1859 spi->dma_tx = dma_request_chan(spi->dev, "tx");1860 spi->dma_tx = dma_request_chan(spi->dev, "tx");
1860 if (IS_ERR(spi->dma_tx)) {1861 if (IS_ERR(spi->dma_tx)) {
drivers/spi/spi-uniphier.c+14−4
@@ -726,7 +726,7 @@ static int uniphier_spi_probe(struct platform_device *pdev) · 725 unmodified lines
726 if (ret) {726 if (ret) {
727 dev_err(&pdev->dev, "failed to get TX DMA capacities: %d\n",727 dev_err(&pdev->dev, "failed to get TX DMA capacities: %d\n",
728 ret);728 ret);
729 goto out_disable_clk;729 goto out_release_dma;
730 }730 }
731 dma_tx_burst = caps.max_burst;731 dma_tx_burst = caps.max_burst;
732 }732 }
@@ -735,7 +735,7 @@ static int uniphier_spi_probe(struct platform_device *pdev) · 2 unmodified lines
735 if (IS_ERR_OR_NULL(master->dma_rx)) {735 if (IS_ERR_OR_NULL(master->dma_rx)) {
736 if (PTR_ERR(master->dma_rx) == -EPROBE_DEFER) {736 if (PTR_ERR(master->dma_rx) == -EPROBE_DEFER) {
737 ret = -EPROBE_DEFER;737 ret = -EPROBE_DEFER;
738 goto out_disable_clk;738 goto out_release_dma;
739 }739 }
740 master->dma_rx = NULL;740 master->dma_rx = NULL;
741 dma_rx_burst = INT_MAX;741 dma_rx_burst = INT_MAX;
@@ -744,7 +744,7 @@ static int uniphier_spi_probe(struct platform_device *pdev) · 2 unmodified lines
744 if (ret) {744 if (ret) {
745 dev_err(&pdev->dev, "failed to get RX DMA capacities: %d\n",745 dev_err(&pdev->dev, "failed to get RX DMA capacities: %d\n",
746 ret);746 ret);
747 goto out_disable_clk;747 goto out_release_dma;
748 }748 }
749 dma_rx_burst = caps.max_burst;749 dma_rx_burst = caps.max_burst;
750 }750 }
@@ -753,10 +753,20 @@ static int uniphier_spi_probe(struct platform_device *pdev) · 2 unmodified lines
753 753
754 ret = devm_spi_register_master(&pdev->dev, master);754 ret = devm_spi_register_master(&pdev->dev, master);
755 if (ret)755 if (ret)
756 goto out_disable_clk;756 goto out_release_dma;
757 757
758 return 0;758 return 0;
759 759
760out_release_dma:
761 if (!IS_ERR_OR_NULL(master->dma_rx)) {
762 dma_release_channel(master->dma_rx);
763 master->dma_rx = NULL;
764 }
765 if (!IS_ERR_OR_NULL(master->dma_tx)) {
766 dma_release_channel(master->dma_tx);
767 master->dma_tx = NULL;
768 }
769
760out_disable_clk:770out_disable_clk:
761 clk_disable_unprepare(priv->clk);771 clk_disable_unprepare(priv->clk);
762 772
drivers/video/console/Kconfig+20−0
@@ -78,6 +78,26 @@ config FRAMEBUFFER_CONSOLE · 77 unmodified lines
78 help78 help
79 Low-level framebuffer-based console driver.79 Low-level framebuffer-based console driver.
80 80
81config FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION
82 bool "Enable legacy fbcon hardware acceleration code"
83 depends on FRAMEBUFFER_CONSOLE
84 default y if PARISC
85 default n
86 help
87 This option enables the fbcon (framebuffer text-based) hardware
88 acceleration for graphics drivers which were written for the fbdev
89 graphics interface.
90
91 On modern machines, on mainstream machines (like x86-64) or when
92 using a modern Linux distribution those fbdev drivers usually aren't used.
93 So enabling this option wouldn't have any effect, which is why you want
94 to disable this option on such newer machines.
95
96 If you compile this kernel for older machines which still require the
97 fbdev drivers, you may want to say Y.
98
99 If unsure, select n.
100
81config FRAMEBUFFER_CONSOLE_DETECT_PRIMARY101config FRAMEBUFFER_CONSOLE_DETECT_PRIMARY
82 bool "Map the console to the primary display device"102 bool "Map the console to the primary display device"
83 depends on FRAMEBUFFER_CONSOLE103 depends on FRAMEBUFFER_CONSOLE
drivers/video/fbdev/core/bitblit.c+16−0
@@ -43,6 +43,21 @@ static void update_attr(u8 *dst, u8 *src, int attribute, · 42 unmodified lines
43 }43 }
44}44}
45 45
46static void bit_bmove(struct vc_data *vc, struct fb_info *info, int sy,
47 int sx, int dy, int dx, int height, int width)
48{
49 struct fb_copyarea area;
50
51 area.sx = sx * vc->vc_font.width;
52 area.sy = sy * vc->vc_font.height;
53 area.dx = dx * vc->vc_font.width;
54 area.dy = dy * vc->vc_font.height;
55 area.height = height * vc->vc_font.height;
56 area.width = width * vc->vc_font.width;
57
58 info->fbops->fb_copyarea(info, &area);
59}
60
46static void bit_clear(struct vc_data *vc, struct fb_info *info, int sy,61static void bit_clear(struct vc_data *vc, struct fb_info *info, int sy,
47 int sx, int height, int width)62 int sx, int height, int width)
48{63{
@@ -378,6 +393,7 @@ static int bit_update_start(struct fb_info *info) · 329 unmodified lines
378 393
379void fbcon_set_bitops(struct fbcon_ops *ops)394void fbcon_set_bitops(struct fbcon_ops *ops)
380{395{
396 ops->bmove = bit_bmove;
381 ops->clear = bit_clear;397 ops->clear = bit_clear;
382 ops->putcs = bit_putcs;398 ops->putcs = bit_putcs;
383 ops->clear_margins = bit_clear_margins;399 ops->clear_margins = bit_clear_margins;
drivers/video/fbdev/core/fbcon.c+536−21
@@ -173,6 +173,8 @@ static void fbcon_putcs(struct vc_data *vc, const unsigned short *s, · 172 unmodified lines
173 int count, int ypos, int xpos);173 int count, int ypos, int xpos);
174static void fbcon_clear_margins(struct vc_data *vc, int bottom_only);174static void fbcon_clear_margins(struct vc_data *vc, int bottom_only);
175static void fbcon_cursor(struct vc_data *vc, int mode);175static void fbcon_cursor(struct vc_data *vc, int mode);
176static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
177 int height, int width);
176static int fbcon_switch(struct vc_data *vc);178static int fbcon_switch(struct vc_data *vc);
177static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch);179static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch);
178static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table);180static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table);
@@ -180,8 +182,16 @@ static void fbcon_set_palette(struct vc_data *vc, const unsigned char *table); · 1 unmodified line
180/*182/*
181 * Internal routines183 * Internal routines
182 */184 */
185static __inline__ void ywrap_up(struct vc_data *vc, int count);
186static __inline__ void ywrap_down(struct vc_data *vc, int count);
187static __inline__ void ypan_up(struct vc_data *vc, int count);
188static __inline__ void ypan_down(struct vc_data *vc, int count);
189static void fbcon_bmove_rec(struct vc_data *vc, struct fbcon_display *p, int sy, int sx,
190 int dy, int dx, int height, int width, u_int y_break);
183static void fbcon_set_disp(struct fb_info *info, struct fb_var_screeninfo *var,191static void fbcon_set_disp(struct fb_info *info, struct fb_var_screeninfo *var,
184 int unit);192 int unit);
193static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p,
194 int line, int count, int dy);
185static void fbcon_modechanged(struct fb_info *info);195static void fbcon_modechanged(struct fb_info *info);
186static void fbcon_set_all_vcs(struct fb_info *info);196static void fbcon_set_all_vcs(struct fb_info *info);
187static void fbcon_start(void);197static void fbcon_start(void);
@@ -1015,7 +1025,7 @@ static void fbcon_init(struct vc_data *vc, int init) · 827 unmodified lines
1015 struct vc_data *svc = *default_mode;1025 struct vc_data *svc = *default_mode;
1016 struct fbcon_display *t, *p = &fb_display[vc->vc_num];1026 struct fbcon_display *t, *p = &fb_display[vc->vc_num];
1017 int logo = 1, new_rows, new_cols, rows, cols;1027 int logo = 1, new_rows, new_cols, rows, cols;
1018 int ret;1028 int cap, ret;
1019 1029
1020 if (WARN_ON(info_idx == -1))1030 if (WARN_ON(info_idx == -1))
1021 return;1031 return;
@@ -1024,6 +1034,7 @@ static void fbcon_init(struct vc_data *vc, int init) · 2 unmodified lines
1024 con2fb_map[vc->vc_num] = info_idx;1034 con2fb_map[vc->vc_num] = info_idx;
1025 1035
1026 info = registered_fb[con2fb_map[vc->vc_num]];1036 info = registered_fb[con2fb_map[vc->vc_num]];
1037 cap = info->flags;
1027 1038
1028 if (logo_shown < 0 && console_loglevel <= CONSOLE_LOGLEVEL_QUIET)1039 if (logo_shown < 0 && console_loglevel <= CONSOLE_LOGLEVEL_QUIET)
1029 logo_shown = FBCON_LOGO_DONTSHOW;1040 logo_shown = FBCON_LOGO_DONTSHOW;
@@ -1125,6 +1136,14 @@ static void fbcon_init(struct vc_data *vc, int init) · 95 unmodified lines
1125 1136
1126 ops->graphics = 0;1137 ops->graphics = 0;
1127 1138
1139#ifdef CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION
1140 if ((cap & FBINFO_HWACCEL_COPYAREA) &&
1141 !(cap & FBINFO_HWACCEL_DISABLED))
1142 p->scrollmode = SCROLL_MOVE;
1143 else /* default to something safe */
1144 p->scrollmode = SCROLL_REDRAW;
1145#endif
1146
1128 /*1147 /*
1129 * ++guenther: console.c:vc_allocate() relies on initializing1148 * ++guenther: console.c:vc_allocate() relies on initializing
1130 * vc_{cols,rows}, but we must not set those if we are only1149 * vc_{cols,rows}, but we must not set those if we are only
@@ -1211,13 +1230,14 @@ finished: · 80 unmodified lines
1211 * This system is now divided into two levels because of complications1230 * This system is now divided into two levels because of complications
1212 * caused by hardware scrolling. Top level functions:1231 * caused by hardware scrolling. Top level functions:
1213 *1232 *
1214 * fbcon_clear(), fbcon_putc(), fbcon_clear_margins()1233 * fbcon_bmove(), fbcon_clear(), fbcon_putc(), fbcon_clear_margins()
1215 *1234 *
1216 * handles y values in range [0, scr_height-1] that correspond to real1235 * handles y values in range [0, scr_height-1] that correspond to real
1217 * screen positions. y_wrap shift means that first line of bitmap may be1236 * screen positions. y_wrap shift means that first line of bitmap may be
1218 * anywhere on this display. These functions convert lineoffsets to1237 * anywhere on this display. These functions convert lineoffsets to
1219 * bitmap offsets and deal with the wrap-around case by splitting blits.1238 * bitmap offsets and deal with the wrap-around case by splitting blits.
1220 *1239 *
1240 * fbcon_bmove_physical_8() -- These functions fast implementations
1221 * fbcon_clear_physical_8() -- of original fbcon_XXX fns.1241 * fbcon_clear_physical_8() -- of original fbcon_XXX fns.
1222 * fbcon_putc_physical_8() -- (font width != 8) may be added later1242 * fbcon_putc_physical_8() -- (font width != 8) may be added later
1223 *1243 *
@@ -1390,6 +1410,224 @@ static void fbcon_set_disp(struct fb_info *info, struct fb_var_screeninfo *var, · 166 unmodified lines
1390 }1410 }
1391}1411}
1392 1412
1413static __inline__ void ywrap_up(struct vc_data *vc, int count)
1414{
1415 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
1416 struct fbcon_ops *ops = info->fbcon_par;
1417 struct fbcon_display *p = &fb_display[vc->vc_num];
1418
1419 p->yscroll += count;
1420 if (p->yscroll >= p->vrows) /* Deal with wrap */
1421 p->yscroll -= p->vrows;
1422 ops->var.xoffset = 0;
1423 ops->var.yoffset = p->yscroll * vc->vc_font.height;
1424 ops->var.vmode |= FB_VMODE_YWRAP;
1425 ops->update_start(info);
1426 scrollback_max += count;
1427 if (scrollback_max > scrollback_phys_max)
1428 scrollback_max = scrollback_phys_max;
1429 scrollback_current = 0;
1430}
1431
1432static __inline__ void ywrap_down(struct vc_data *vc, int count)
1433{
1434 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
1435 struct fbcon_ops *ops = info->fbcon_par;
1436 struct fbcon_display *p = &fb_display[vc->vc_num];
1437
1438 p->yscroll -= count;
1439 if (p->yscroll < 0) /* Deal with wrap */
1440 p->yscroll += p->vrows;
1441 ops->var.xoffset = 0;
1442 ops->var.yoffset = p->yscroll * vc->vc_font.height;
1443 ops->var.vmode |= FB_VMODE_YWRAP;
1444 ops->update_start(info);
1445 scrollback_max -= count;
1446 if (scrollback_max < 0)
1447 scrollback_max = 0;
1448 scrollback_current = 0;
1449}
1450
1451static __inline__ void ypan_up(struct vc_data *vc, int count)
1452{
1453 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
1454 struct fbcon_display *p = &fb_display[vc->vc_num];
1455 struct fbcon_ops *ops = info->fbcon_par;
1456
1457 p->yscroll += count;
1458 if (p->yscroll > p->vrows - vc->vc_rows) {
1459 ops->bmove(vc, info, p->vrows - vc->vc_rows,
1460 0, 0, 0, vc->vc_rows, vc->vc_cols);
1461 p->yscroll -= p->vrows - vc->vc_rows;
1462 }
1463
1464 ops->var.xoffset = 0;
1465 ops->var.yoffset = p->yscroll * vc->vc_font.height;
1466 ops->var.vmode &= ~FB_VMODE_YWRAP;
1467 ops->update_start(info);
1468 fbcon_clear_margins(vc, 1);
1469 scrollback_max += count;
1470 if (scrollback_max > scrollback_phys_max)
1471 scrollback_max = scrollback_phys_max;
1472 scrollback_current = 0;
1473}
1474
1475static __inline__ void ypan_up_redraw(struct vc_data *vc, int t, int count)
1476{
1477 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
1478 struct fbcon_ops *ops = info->fbcon_par;
1479 struct fbcon_display *p = &fb_display[vc->vc_num];
1480
1481 p->yscroll += count;
1482
1483 if (p->yscroll > p->vrows - vc->vc_rows) {
1484 p->yscroll -= p->vrows - vc->vc_rows;
1485 fbcon_redraw_move(vc, p, t + count, vc->vc_rows - count, t);
1486 }
1487
1488 ops->var.xoffset = 0;
1489 ops->var.yoffset = p->yscroll * vc->vc_font.height;
1490 ops->var.vmode &= ~FB_VMODE_YWRAP;
1491 ops->update_start(info);
1492 fbcon_clear_margins(vc, 1);
1493 scrollback_max += count;
1494 if (scrollback_max > scrollback_phys_max)
1495 scrollback_max = scrollback_phys_max;
1496 scrollback_current = 0;
1497}
1498
1499static __inline__ void ypan_down(struct vc_data *vc, int count)
1500{
1501 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
1502 struct fbcon_display *p = &fb_display[vc->vc_num];
1503 struct fbcon_ops *ops = info->fbcon_par;
1504
1505 p->yscroll -= count;
1506 if (p->yscroll < 0) {
1507 ops->bmove(vc, info, 0, 0, p->vrows - vc->vc_rows,
1508 0, vc->vc_rows, vc->vc_cols);
1509 p->yscroll += p->vrows - vc->vc_rows;
1510 }
1511
1512 ops->var.xoffset = 0;
1513 ops->var.yoffset = p->yscroll * vc->vc_font.height;
1514 ops->var.vmode &= ~FB_VMODE_YWRAP;
1515 ops->update_start(info);
1516 fbcon_clear_margins(vc, 1);
1517 scrollback_max -= count;
1518 if (scrollback_max < 0)
1519 scrollback_max = 0;
1520 scrollback_current = 0;
1521}
1522
1523static __inline__ void ypan_down_redraw(struct vc_data *vc, int t, int count)
1524{
1525 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
1526 struct fbcon_ops *ops = info->fbcon_par;
1527 struct fbcon_display *p = &fb_display[vc->vc_num];
1528
1529 p->yscroll -= count;
1530
1531 if (p->yscroll < 0) {
1532 p->yscroll += p->vrows - vc->vc_rows;
1533 fbcon_redraw_move(vc, p, t, vc->vc_rows - count, t + count);
1534 }
1535
1536 ops->var.xoffset = 0;
1537 ops->var.yoffset = p->yscroll * vc->vc_font.height;
1538 ops->var.vmode &= ~FB_VMODE_YWRAP;
1539 ops->update_start(info);
1540 fbcon_clear_margins(vc, 1);
1541 scrollback_max -= count;
1542 if (scrollback_max < 0)
1543 scrollback_max = 0;
1544 scrollback_current = 0;
1545}
1546
1547static void fbcon_redraw_move(struct vc_data *vc, struct fbcon_display *p,
1548 int line, int count, int dy)
1549{
1550 unsigned short *s = (unsigned short *)
1551 (vc->vc_origin + vc->vc_size_row * line);
1552
1553 while (count--) {
1554 unsigned short *start = s;
1555 unsigned short *le = advance_row(s, 1);
1556 unsigned short c;
1557 int x = 0;
1558 unsigned short attr = 1;
1559
1560 do {
1561 c = scr_readw(s);
1562 if (attr != (c & 0xff00)) {
1563 attr = c & 0xff00;
1564 if (s > start) {
1565 fbcon_putcs(vc, start, s - start,
1566 dy, x);
1567 x += s - start;
1568 start = s;
1569 }
1570 }
1571 console_conditional_schedule();
1572 s++;
1573 } while (s < le);
1574 if (s > start)
1575 fbcon_putcs(vc, start, s - start, dy, x);
1576 console_conditional_schedule();
1577 dy++;
1578 }
1579}
1580
1581static void fbcon_redraw_blit(struct vc_data *vc, struct fb_info *info,
1582 struct fbcon_display *p, int line, int count, int ycount)
1583{
1584 int offset = ycount * vc->vc_cols;
1585 unsigned short *d = (unsigned short *)
1586 (vc->vc_origin + vc->vc_size_row * line);
1587 unsigned short *s = d + offset;
1588 struct fbcon_ops *ops = info->fbcon_par;
1589
1590 while (count--) {
1591 unsigned short *start = s;
1592 unsigned short *le = advance_row(s, 1);
1593 unsigned short c;
1594 int x = 0;
1595
1596 do {
1597 c = scr_readw(s);
1598
1599 if (c == scr_readw(d)) {
1600 if (s > start) {
1601 ops->bmove(vc, info, line + ycount, x,
1602 line, x, 1, s-start);
1603 x += s - start + 1;
1604 start = s + 1;
1605 } else {
1606 x++;
1607 start++;
1608 }
1609 }
1610
1611 scr_writew(c, d);
1612 console_conditional_schedule();
1613 s++;
1614 d++;
1615 } while (s < le);
1616 if (s > start)
1617 ops->bmove(vc, info, line + ycount, x, line, x, 1,
1618 s-start);
1619 console_conditional_schedule();
1620 if (ycount > 0)
1621 line++;
1622 else {
1623 line--;
1624 /* NOTE: We subtract two lines from these pointers */
1625 s -= vc->vc_size_row;
1626 d -= vc->vc_size_row;
1627 }
1628 }
1629}
1630
1393static void fbcon_redraw(struct vc_data *vc, struct fbcon_display *p,1631static void fbcon_redraw(struct vc_data *vc, struct fbcon_display *p,
1394 int line, int count, int offset)1632 int line, int count, int offset)
1395{1633{
@@ -1450,6 +1688,7 @@ static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b, · 54 unmodified lines
1450{1688{
1451 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];1689 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
1452 struct fbcon_display *p = &fb_display[vc->vc_num];1690 struct fbcon_display *p = &fb_display[vc->vc_num];
1691 int scroll_partial = info->flags & FBINFO_PARTIAL_PAN_OK;
1453 1692
1454 if (fbcon_is_inactive(vc, info))1693 if (fbcon_is_inactive(vc, info))
1455 return true;1694 return true;
@@ -1466,32 +1705,291 @@ static bool fbcon_scroll(struct vc_data *vc, unsigned int t, unsigned int b, · 10 unmodified lines
1466 case SM_UP:1705 case SM_UP:
1467 if (count > vc->vc_rows) /* Maximum realistic size */1706 if (count > vc->vc_rows) /* Maximum realistic size */
1468 count = vc->vc_rows;1707 count = vc->vc_rows;
1469 fbcon_redraw(vc, p, t, b - t - count,1708 if (logo_shown >= 0)
1470 count * vc->vc_cols);1709 goto redraw_up;
1471 fbcon_clear(vc, b - count, 0, count, vc->vc_cols);1710 switch (fb_scrollmode(p)) {
1472 scr_memsetw((unsigned short *) (vc->vc_origin +1711 case SCROLL_MOVE:
1473 vc->vc_size_row *1712 fbcon_redraw_blit(vc, info, p, t, b - t - count,
1474 (b - count)),1713 count);
1475 vc->vc_video_erase_char,1714 fbcon_clear(vc, b - count, 0, count, vc->vc_cols);
1476 vc->vc_size_row * count);1715 scr_memsetw((unsigned short *) (vc->vc_origin +
1477 return true;1716 vc->vc_size_row *
1717 (b - count)),
1718 vc->vc_video_erase_char,
1719 vc->vc_size_row * count);
1720 return true;
1721
1722 case SCROLL_WRAP_MOVE:
1723 if (b - t - count > 3 * vc->vc_rows >> 2) {
1724 if (t > 0)
1725 fbcon_bmove(vc, 0, 0, count, 0, t,
1726 vc->vc_cols);
1727 ywrap_up(vc, count);
1728 if (vc->vc_rows - b > 0)
1729 fbcon_bmove(vc, b - count, 0, b, 0,
1730 vc->vc_rows - b,
1731 vc->vc_cols);
1732 } else if (info->flags & FBINFO_READS_FAST)
1733 fbcon_bmove(vc, t + count, 0, t, 0,
1734 b - t - count, vc->vc_cols);
1735 else
1736 goto redraw_up;
1737 fbcon_clear(vc, b - count, 0, count, vc->vc_cols);
1738 break;
1739
1740 case SCROLL_PAN_REDRAW:
1741 if ((p->yscroll + count <=
1742 2 * (p->vrows - vc->vc_rows))
1743 && ((!scroll_partial && (b - t == vc->vc_rows))
1744 || (scroll_partial
1745 && (b - t - count >
1746 3 * vc->vc_rows >> 2)))) {
1747 if (t > 0)
1748 fbcon_redraw_move(vc, p, 0, t, count);
1749 ypan_up_redraw(vc, t, count);
1750 if (vc->vc_rows - b > 0)
1751 fbcon_redraw_move(vc, p, b,
1752 vc->vc_rows - b, b);
1753 } else
1754 fbcon_redraw_move(vc, p, t + count, b - t - count, t);
1755 fbcon_clear(vc, b - count, 0, count, vc->vc_cols);
1756 break;
1757
1758 case SCROLL_PAN_MOVE:
1759 if ((p->yscroll + count <=
1760 2 * (p->vrows - vc->vc_rows))
1761 && ((!scroll_partial && (b - t == vc->vc_rows))
1762 || (scroll_partial
1763 && (b - t - count >
1764 3 * vc->vc_rows >> 2)))) {
1765 if (t > 0)
1766 fbcon_bmove(vc, 0, 0, count, 0, t,
1767 vc->vc_cols);
1768 ypan_up(vc, count);
1769 if (vc->vc_rows - b > 0)
1770 fbcon_bmove(vc, b - count, 0, b, 0,
1771 vc->vc_rows - b,
1772 vc->vc_cols);
1773 } else if (info->flags & FBINFO_READS_FAST)
1774 fbcon_bmove(vc, t + count, 0, t, 0,
1775 b - t - count, vc->vc_cols);
1776 else
1777 goto redraw_up;
1778 fbcon_clear(vc, b - count, 0, count, vc->vc_cols);
1779 break;
1780
1781 case SCROLL_REDRAW:
1782 redraw_up:
1783 fbcon_redraw(vc, p, t, b - t - count,
1784 count * vc->vc_cols);
1785 fbcon_clear(vc, b - count, 0, count, vc->vc_cols);
1786 scr_memsetw((unsigned short *) (vc->vc_origin +
1787 vc->vc_size_row *
1788 (b - count)),
1789 vc->vc_video_erase_char,
1790 vc->vc_size_row * count);
1791 return true;
1792 }
1793 break;
1478 1794
1479 case SM_DOWN:1795 case SM_DOWN:
1480 if (count > vc->vc_rows) /* Maximum realistic size */1796 if (count > vc->vc_rows) /* Maximum realistic size */
1481 count = vc->vc_rows;1797 count = vc->vc_rows;
1482 fbcon_redraw(vc, p, b - 1, b - t - count,1798 if (logo_shown >= 0)
1483 -count * vc->vc_cols);1799 goto redraw_down;
1484 fbcon_clear(vc, t, 0, count, vc->vc_cols);1800 switch (fb_scrollmode(p)) {
1485 scr_memsetw((unsigned short *) (vc->vc_origin +1801 case SCROLL_MOVE:
1486 vc->vc_size_row *1802 fbcon_redraw_blit(vc, info, p, b - 1, b - t - count,
1487 t),1803 -count);
1488 vc->vc_video_erase_char,1804 fbcon_clear(vc, t, 0, count, vc->vc_cols);
1489 vc->vc_size_row * count);1805 scr_memsetw((unsigned short *) (vc->vc_origin +
1490 return true;1806 vc->vc_size_row *
1807 t),
1808 vc->vc_video_erase_char,
1809 vc->vc_size_row * count);
1810 return true;
1811
1812 case SCROLL_WRAP_MOVE:
1813 if (b - t - count > 3 * vc->vc_rows >> 2) {
1814 if (vc->vc_rows - b > 0)
1815 fbcon_bmove(vc, b, 0, b - count, 0,
1816 vc->vc_rows - b,
1817 vc->vc_cols);
1818 ywrap_down(vc, count);
1819 if (t > 0)
1820 fbcon_bmove(vc, count, 0, 0, 0, t,
1821 vc->vc_cols);
1822 } else if (info->flags & FBINFO_READS_FAST)
1823 fbcon_bmove(vc, t, 0, t + count, 0,
1824 b - t - count, vc->vc_cols);
1825 else
1826 goto redraw_down;
1827 fbcon_clear(vc, t, 0, count, vc->vc_cols);
1828 break;
1829
1830 case SCROLL_PAN_MOVE:
1831 if ((count - p->yscroll <= p->vrows - vc->vc_rows)
1832 && ((!scroll_partial && (b - t == vc->vc_rows))
1833 || (scroll_partial
1834 && (b - t - count >
1835 3 * vc->vc_rows >> 2)))) {
1836 if (vc->vc_rows - b > 0)
1837 fbcon_bmove(vc, b, 0, b - count, 0,
1838 vc->vc_rows - b,
1839 vc->vc_cols);
1840 ypan_down(vc, count);
1841 if (t > 0)
1842 fbcon_bmove(vc, count, 0, 0, 0, t,
1843 vc->vc_cols);
1844 } else if (info->flags & FBINFO_READS_FAST)
1845 fbcon_bmove(vc, t, 0, t + count, 0,
1846 b - t - count, vc->vc_cols);
1847 else
1848 goto redraw_down;
1849 fbcon_clear(vc, t, 0, count, vc->vc_cols);
1850 break;
1851
1852 case SCROLL_PAN_REDRAW:
1853 if ((count - p->yscroll <= p->vrows - vc->vc_rows)
1854 && ((!scroll_partial && (b - t == vc->vc_rows))
1855 || (scroll_partial
1856 && (b - t - count >
1857 3 * vc->vc_rows >> 2)))) {
1858 if (vc->vc_rows - b > 0)
1859 fbcon_redraw_move(vc, p, b, vc->vc_rows - b,
1860 b - count);
1861 ypan_down_redraw(vc, t, count);
1862 if (t > 0)
1863 fbcon_redraw_move(vc, p, count, t, 0);
1864 } else
1865 fbcon_redraw_move(vc, p, t, b - t - count, t + count);
1866 fbcon_clear(vc, t, 0, count, vc->vc_cols);
1867 break;
1868
1869 case SCROLL_REDRAW:
1870 redraw_down:
1871 fbcon_redraw(vc, p, b - 1, b - t - count,
1872 -count * vc->vc_cols);
1873 fbcon_clear(vc, t, 0, count, vc->vc_cols);
1874 scr_memsetw((unsigned short *) (vc->vc_origin +
1875 vc->vc_size_row *
1876 t),
1877 vc->vc_video_erase_char,
1878 vc->vc_size_row * count);
1879 return true;
1880 }
1491 }1881 }
1492 return false;1882 return false;
1493}1883}
1494 1884
1885
1886static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
1887 int height, int width)
1888{
1889 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
1890 struct fbcon_display *p = &fb_display[vc->vc_num];
1891
1892 if (fbcon_is_inactive(vc, info))
1893 return;
1894
1895 if (!width || !height)
1896 return;
1897
1898 /* Split blits that cross physical y_wrap case.
1899 * Pathological case involves 4 blits, better to use recursive
1900 * code rather than unrolled case
1901 *
1902 * Recursive invocations don't need to erase the cursor over and
1903 * over again, so we use fbcon_bmove_rec()
1904 */
1905 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, height, width,
1906 p->vrows - p->yscroll);
1907}
1908
1909static void fbcon_bmove_rec(struct vc_data *vc, struct fbcon_display *p, int sy, int sx,
1910 int dy, int dx, int height, int width, u_int y_break)
1911{
1912 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
1913 struct fbcon_ops *ops = info->fbcon_par;
1914 u_int b;
1915
1916 if (sy < y_break && sy + height > y_break) {
1917 b = y_break - sy;
1918 if (dy < sy) { /* Avoid trashing self */
1919 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width,
1920 y_break);
1921 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx,
1922 height - b, width, y_break);
1923 } else {
1924 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx,
1925 height - b, width, y_break);
1926 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width,
1927 y_break);
1928 }
1929 return;
1930 }
1931
1932 if (dy < y_break && dy + height > y_break) {
1933 b = y_break - dy;
1934 if (dy < sy) { /* Avoid trashing self */
1935 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width,
1936 y_break);
1937 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx,
1938 height - b, width, y_break);
1939 } else {
1940 fbcon_bmove_rec(vc, p, sy + b, sx, dy + b, dx,
1941 height - b, width, y_break);
1942 fbcon_bmove_rec(vc, p, sy, sx, dy, dx, b, width,
1943 y_break);
1944 }
1945 return;
1946 }
1947 ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx,
1948 height, width);
1949}
1950
1951static void updatescrollmode_accel(struct fbcon_display *p,
1952 struct fb_info *info,
1953 struct vc_data *vc)
1954{
1955#ifdef CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION
1956 struct fbcon_ops *ops = info->fbcon_par;
1957 int cap = info->flags;
1958 u16 t = 0;
1959 int ypan = FBCON_SWAP(ops->rotate, info->fix.ypanstep,
1960 info->fix.xpanstep);
1961 int ywrap = FBCON_SWAP(ops->rotate, info->fix.ywrapstep, t);
1962 int yres = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
1963 int vyres = FBCON_SWAP(ops->rotate, info->var.yres_virtual,
1964 info->var.xres_virtual);
1965 int good_pan = (cap & FBINFO_HWACCEL_YPAN) &&
1966 divides(ypan, vc->vc_font.height) && vyres > yres;
1967 int good_wrap = (cap & FBINFO_HWACCEL_YWRAP) &&
1968 divides(ywrap, vc->vc_font.height) &&
1969 divides(vc->vc_font.height, vyres) &&
1970 divides(vc->vc_font.height, yres);
1971 int reading_fast = cap & FBINFO_READS_FAST;
1972 int fast_copyarea = (cap & FBINFO_HWACCEL_COPYAREA) &&
1973 !(cap & FBINFO_HWACCEL_DISABLED);
1974 int fast_imageblit = (cap & FBINFO_HWACCEL_IMAGEBLIT) &&
1975 !(cap & FBINFO_HWACCEL_DISABLED);
1976
1977 if (good_wrap || good_pan) {
1978 if (reading_fast || fast_copyarea)
1979 p->scrollmode = good_wrap ?
1980 SCROLL_WRAP_MOVE : SCROLL_PAN_MOVE;
1981 else
1982 p->scrollmode = good_wrap ? SCROLL_REDRAW :
1983 SCROLL_PAN_REDRAW;
1984 } else {
1985 if (reading_fast || (fast_copyarea && !fast_imageblit))
1986 p->scrollmode = SCROLL_MOVE;
1987 else
1988 p->scrollmode = SCROLL_REDRAW;
1989 }
1990#endif
1991}
1992
1495static void updatescrollmode(struct fbcon_display *p,1993static void updatescrollmode(struct fbcon_display *p,
1496 struct fb_info *info,1994 struct fb_info *info,
1497 struct vc_data *vc)1995 struct vc_data *vc)
@@ -1507,6 +2005,9 @@ static void updatescrollmode(struct fbcon_display *p, · 9 unmodified lines
1507 p->vrows -= (yres - (fh * vc->vc_rows)) / fh;2005 p->vrows -= (yres - (fh * vc->vc_rows)) / fh;
1508 if ((yres % fh) && (vyres % fh < yres % fh))2006 if ((yres % fh) && (vyres % fh < yres % fh))
1509 p->vrows--;2007 p->vrows--;
2008
2009 /* update scrollmode in case hardware acceleration is used */
2010 updatescrollmode_accel(p, info, vc);
1510}2011}
1511 2012
1512#define PITCH(w) (((w) + 7) >> 3)2013#define PITCH(w) (((w) + 7) >> 3)
@@ -1664,7 +2165,21 @@ static int fbcon_switch(struct vc_data *vc) · 151 unmodified lines
1664 2165
1665 updatescrollmode(p, info, vc);2166 updatescrollmode(p, info, vc);
1666 2167
1667 scrollback_phys_max = 0;2168 switch (fb_scrollmode(p)) {
2169 case SCROLL_WRAP_MOVE:
2170 scrollback_phys_max = p->vrows - vc->vc_rows;
2171 break;
2172 case SCROLL_PAN_MOVE:
2173 case SCROLL_PAN_REDRAW:
2174 scrollback_phys_max = p->vrows - 2 * vc->vc_rows;
2175 if (scrollback_phys_max < 0)
2176 scrollback_phys_max = 0;
2177 break;
2178 default:
2179 scrollback_phys_max = 0;
2180 break;
2181 }
2182
1668 scrollback_max = 0;2183 scrollback_max = 0;
1669 scrollback_current = 0;2184 scrollback_current = 0;
1670 2185
drivers/video/fbdev/core/fbcon.h+72−0
@@ -29,6 +29,9 @@ struct fbcon_display { · 28 unmodified lines
29 /* Filled in by the low-level console driver */29 /* Filled in by the low-level console driver */
30 const u_char *fontdata;30 const u_char *fontdata;
31 int userfont; /* != 0 if fontdata kmalloc()ed */31 int userfont; /* != 0 if fontdata kmalloc()ed */
32#ifdef CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION
33 u_short scrollmode; /* Scroll Method, use fb_scrollmode() */
34#endif
32 u_short inverse; /* != 0 text black on white as default */35 u_short inverse; /* != 0 text black on white as default */
33 short yscroll; /* Hardware scrolling */36 short yscroll; /* Hardware scrolling */
34 int vrows; /* number of virtual rows */37 int vrows; /* number of virtual rows */
@@ -51,6 +54,8 @@ struct fbcon_display { · 16 unmodified lines
51};54};
52 55
53struct fbcon_ops {56struct fbcon_ops {
57 void (*bmove)(struct vc_data *vc, struct fb_info *info, int sy,
58 int sx, int dy, int dx, int height, int width);
54 void (*clear)(struct vc_data *vc, struct fb_info *info, int sy,59 void (*clear)(struct vc_data *vc, struct fb_info *info, int sy,
55 int sx, int height, int width);60 int sx, int height, int width);
56 void (*putcs)(struct vc_data *vc, struct fb_info *info,61 void (*putcs)(struct vc_data *vc, struct fb_info *info,
@@ -149,6 +154,73 @@ static inline int attr_col_ec(int shift, struct vc_data *vc, · 92 unmodified lines
149#define attr_bgcol_ec(bgshift, vc, info) attr_col_ec(bgshift, vc, info, 0)154#define attr_bgcol_ec(bgshift, vc, info) attr_col_ec(bgshift, vc, info, 0)
150#define attr_fgcol_ec(fgshift, vc, info) attr_col_ec(fgshift, vc, info, 1)155#define attr_fgcol_ec(fgshift, vc, info) attr_col_ec(fgshift, vc, info, 1)
151 156
157 /*
158 * Scroll Method
159 */
160
161/* There are several methods fbcon can use to move text around the screen:
162 *
163 * Operation Pan Wrap
164 *---------------------------------------------
165 * SCROLL_MOVE copyarea No No
166 * SCROLL_PAN_MOVE copyarea Yes No
167 * SCROLL_WRAP_MOVE copyarea No Yes
168 * SCROLL_REDRAW imageblit No No
169 * SCROLL_PAN_REDRAW imageblit Yes No
170 * SCROLL_WRAP_REDRAW imageblit No Yes
171 *
172 * (SCROLL_WRAP_REDRAW is not implemented yet)
173 *
174 * In general, fbcon will choose the best scrolling
175 * method based on the rule below:
176 *
177 * Pan/Wrap > accel imageblit > accel copyarea >
178 * soft imageblit > (soft copyarea)
179 *
180 * Exception to the rule: Pan + accel copyarea is
181 * preferred over Pan + accel imageblit.
182 *
183 * The above is typical for PCI/AGP cards. Unless
184 * overridden, fbcon will never use soft copyarea.
185 *
186 * If you need to override the above rule, set the
187 * appropriate flags in fb_info->flags. For example,
188 * to prefer copyarea over imageblit, set
189 * FBINFO_READS_FAST.
190 *
191 * Other notes:
192 * + use the hardware engine to move the text
193 * (hw-accelerated copyarea() and fillrect())
194 * + use hardware-supported panning on a large virtual screen
195 * + amifb can not only pan, but also wrap the display by N lines
196 * (i.e. visible line i = physical line (i+N) % yres).
197 * + read what's already rendered on the screen and
198 * write it in a different place (this is cfb_copyarea())
199 * + re-render the text to the screen
200 *
201 * Whether to use wrapping or panning can only be figured out at
202 * runtime (when we know whether our font height is a multiple
203 * of the pan/wrap step)
204 *
205 */
206
207#define SCROLL_MOVE 0x001
208#define SCROLL_PAN_MOVE 0x002
209#define SCROLL_WRAP_MOVE 0x003
210#define SCROLL_REDRAW 0x004
211#define SCROLL_PAN_REDRAW 0x005
212
213static inline u_short fb_scrollmode(struct fbcon_display *fb)
214{
215#ifdef CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION
216 return fb->scrollmode;
217#else
218 /* hardcoded to SCROLL_REDRAW if acceleration was disabled. */
219 return SCROLL_REDRAW;
220#endif
221}
222
223
152#ifdef CONFIG_FB_TILEBLITTING224#ifdef CONFIG_FB_TILEBLITTING
153extern void fbcon_set_tileops(struct vc_data *vc, struct fb_info *info);225extern void fbcon_set_tileops(struct vc_data *vc, struct fb_info *info);
154#endif226#endif
drivers/video/fbdev/core/fbcon_ccw.c+24−4
@@ -59,12 +59,31 @@ static void ccw_update_attr(u8 *dst, u8 *src, int attribute, · 58 unmodified lines
59 }59 }
60}60}
61 61
62
63static void ccw_bmove(struct vc_data *vc, struct fb_info *info, int sy,
64 int sx, int dy, int dx, int height, int width)
65{
66 struct fbcon_ops *ops = info->fbcon_par;
67 struct fb_copyarea area;
68 u32 vyres = GETVYRES(ops->p, info);
69
70 area.sx = sy * vc->vc_font.height;
71 area.sy = vyres - ((sx + width) * vc->vc_font.width);
72 area.dx = dy * vc->vc_font.height;
73 area.dy = vyres - ((dx + width) * vc->vc_font.width);
74 area.width = height * vc->vc_font.height;
75 area.height = width * vc->vc_font.width;
76
77 info->fbops->fb_copyarea(info, &area);
78}
79
62static void ccw_clear(struct vc_data *vc, struct fb_info *info, int sy,80static void ccw_clear(struct vc_data *vc, struct fb_info *info, int sy,
63 int sx, int height, int width)81 int sx, int height, int width)
64{82{
83 struct fbcon_ops *ops = info->fbcon_par;
65 struct fb_fillrect region;84 struct fb_fillrect region;
66 int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;85 int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;
67 u32 vyres = info->var.yres;86 u32 vyres = GETVYRES(ops->p, info);
68 87
69 region.color = attr_bgcol_ec(bgshift,vc,info);88 region.color = attr_bgcol_ec(bgshift,vc,info);
70 region.dx = sy * vc->vc_font.height;89 region.dx = sy * vc->vc_font.height;
@@ -121,7 +140,7 @@ static void ccw_putcs(struct vc_data *vc, struct fb_info *info, · 50 unmodified lines
121 u32 cnt, pitch, size;140 u32 cnt, pitch, size;
122 u32 attribute = get_attribute(info, scr_readw(s));141 u32 attribute = get_attribute(info, scr_readw(s));
123 u8 *dst, *buf = NULL;142 u8 *dst, *buf = NULL;
124 u32 vyres = info->var.yres;143 u32 vyres = GETVYRES(ops->p, info);
125 144
126 if (!ops->fontbuffer)145 if (!ops->fontbuffer)
127 return;146 return;
@@ -210,7 +229,7 @@ static void ccw_cursor(struct vc_data *vc, struct fb_info *info, int mode, · 82 unmodified lines
210 int attribute, use_sw = vc->vc_cursor_type & CUR_SW;229 int attribute, use_sw = vc->vc_cursor_type & CUR_SW;
211 int err = 1, dx, dy;230 int err = 1, dx, dy;
212 char *src;231 char *src;
213 u32 vyres = info->var.yres;232 u32 vyres = GETVYRES(ops->p, info);
214 233
215 if (!ops->fontbuffer)234 if (!ops->fontbuffer)
216 return;235 return;
@@ -368,7 +387,7 @@ static int ccw_update_start(struct fb_info *info) · 151 unmodified lines
368{387{
369 struct fbcon_ops *ops = info->fbcon_par;388 struct fbcon_ops *ops = info->fbcon_par;
370 u32 yoffset;389 u32 yoffset;
371 u32 vyres = info->var.yres;390 u32 vyres = GETVYRES(ops->p, info);
372 int err;391 int err;
373 392
374 yoffset = (vyres - info->var.yres) - ops->var.xoffset;393 yoffset = (vyres - info->var.yres) - ops->var.xoffset;
@@ -383,6 +402,7 @@ static int ccw_update_start(struct fb_info *info) · 8 unmodified lines
383 402
384void fbcon_rotate_ccw(struct fbcon_ops *ops)403void fbcon_rotate_ccw(struct fbcon_ops *ops)
385{404{
405 ops->bmove = ccw_bmove;
386 ops->clear = ccw_clear;406 ops->clear = ccw_clear;
387 ops->putcs = ccw_putcs;407 ops->putcs = ccw_putcs;
388 ops->clear_margins = ccw_clear_margins;408 ops->clear_margins = ccw_clear_margins;
drivers/video/fbdev/core/fbcon_cw.c+24−4
@@ -44,12 +44,31 @@ static void cw_update_attr(u8 *dst, u8 *src, int attribute, · 43 unmodified lines
44 }44 }
45}45}
46 46
47
48static void cw_bmove(struct vc_data *vc, struct fb_info *info, int sy,
49 int sx, int dy, int dx, int height, int width)
50{
51 struct fbcon_ops *ops = info->fbcon_par;
52 struct fb_copyarea area;
53 u32 vxres = GETVXRES(ops->p, info);
54
55 area.sx = vxres - ((sy + height) * vc->vc_font.height);
56 area.sy = sx * vc->vc_font.width;
57 area.dx = vxres - ((dy + height) * vc->vc_font.height);
58 area.dy = dx * vc->vc_font.width;
59 area.width = height * vc->vc_font.height;
60 area.height = width * vc->vc_font.width;
61
62 info->fbops->fb_copyarea(info, &area);
63}
64
47static void cw_clear(struct vc_data *vc, struct fb_info *info, int sy,65static void cw_clear(struct vc_data *vc, struct fb_info *info, int sy,
48 int sx, int height, int width)66 int sx, int height, int width)
49{67{
68 struct fbcon_ops *ops = info->fbcon_par;
50 struct fb_fillrect region;69 struct fb_fillrect region;
51 int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;70 int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;
52 u32 vxres = info->var.xres;71 u32 vxres = GETVXRES(ops->p, info);
53 72
54 region.color = attr_bgcol_ec(bgshift,vc,info);73 region.color = attr_bgcol_ec(bgshift,vc,info);
55 region.dx = vxres - ((sy + height) * vc->vc_font.height);74 region.dx = vxres - ((sy + height) * vc->vc_font.height);
@@ -106,7 +125,7 @@ static void cw_putcs(struct vc_data *vc, struct fb_info *info, · 50 unmodified lines
106 u32 cnt, pitch, size;125 u32 cnt, pitch, size;
107 u32 attribute = get_attribute(info, scr_readw(s));126 u32 attribute = get_attribute(info, scr_readw(s));
108 u8 *dst, *buf = NULL;127 u8 *dst, *buf = NULL;
109 u32 vxres = info->var.xres;128 u32 vxres = GETVXRES(ops->p, info);
110 129
111 if (!ops->fontbuffer)130 if (!ops->fontbuffer)
112 return;131 return;
@@ -193,7 +212,7 @@ static void cw_cursor(struct vc_data *vc, struct fb_info *info, int mode, · 80 unmodified lines
193 int attribute, use_sw = vc->vc_cursor_type & CUR_SW;212 int attribute, use_sw = vc->vc_cursor_type & CUR_SW;
194 int err = 1, dx, dy;213 int err = 1, dx, dy;
195 char *src;214 char *src;
196 u32 vxres = info->var.xres;215 u32 vxres = GETVXRES(ops->p, info);
197 216
198 if (!ops->fontbuffer)217 if (!ops->fontbuffer)
199 return;218 return;
@@ -350,7 +369,7 @@ static void cw_cursor(struct vc_data *vc, struct fb_info *info, int mode, · 150 unmodified lines
350static int cw_update_start(struct fb_info *info)369static int cw_update_start(struct fb_info *info)
351{370{
352 struct fbcon_ops *ops = info->fbcon_par;371 struct fbcon_ops *ops = info->fbcon_par;
353 u32 vxres = info->var.xres;372 u32 vxres = GETVXRES(ops->p, info);
354 u32 xoffset;373 u32 xoffset;
355 int err;374 int err;
356 375
@@ -366,6 +385,7 @@ static int cw_update_start(struct fb_info *info) · 9 unmodified lines
366 385
367void fbcon_rotate_cw(struct fbcon_ops *ops)386void fbcon_rotate_cw(struct fbcon_ops *ops)
368{387{
388 ops->bmove = cw_bmove;
369 ops->clear = cw_clear;389 ops->clear = cw_clear;
370 ops->putcs = cw_putcs;390 ops->putcs = cw_putcs;
371 ops->clear_margins = cw_clear_margins;391 ops->clear_margins = cw_clear_margins;
drivers/video/fbdev/core/fbcon_rotate.h+9−0
@@ -11,6 +11,15 @@ · 10 unmodified lines
11#ifndef _FBCON_ROTATE_H11#ifndef _FBCON_ROTATE_H
12#define _FBCON_ROTATE_H12#define _FBCON_ROTATE_H
13 13
14#define GETVYRES(s,i) ({ \
15 (fb_scrollmode(s) == SCROLL_REDRAW || fb_scrollmode(s) == SCROLL_MOVE) ? \
16 (i)->var.yres : (i)->var.yres_virtual; })
17
18#define GETVXRES(s,i) ({ \
19 (fb_scrollmode(s) == SCROLL_REDRAW || fb_scrollmode(s) == SCROLL_MOVE || !(i)->fix.xpanstep) ? \
20 (i)->var.xres : (i)->var.xres_virtual; })
21
22
14static inline int pattern_test_bit(u32 x, u32 y, u32 pitch, const char *pat)23static inline int pattern_test_bit(u32 x, u32 y, u32 pitch, const char *pat)
15{24{
16 u32 tmp = (y * pitch) + x, index = tmp / 8, bit = tmp % 8;25 u32 tmp = (y * pitch) + x, index = tmp / 8, bit = tmp % 8;
drivers/video/fbdev/core/fbcon_ud.c+29−8
@@ -44,13 +44,33 @@ static void ud_update_attr(u8 *dst, u8 *src, int attribute, · 43 unmodified lines
44 }44 }
45}45}
46 46
47
48static void ud_bmove(struct vc_data *vc, struct fb_info *info, int sy,
49 int sx, int dy, int dx, int height, int width)
50{
51 struct fbcon_ops *ops = info->fbcon_par;
52 struct fb_copyarea area;
53 u32 vyres = GETVYRES(ops->p, info);
54 u32 vxres = GETVXRES(ops->p, info);
55
56 area.sy = vyres - ((sy + height) * vc->vc_font.height);
57 area.sx = vxres - ((sx + width) * vc->vc_font.width);
58 area.dy = vyres - ((dy + height) * vc->vc_font.height);
59 area.dx = vxres - ((dx + width) * vc->vc_font.width);
60 area.height = height * vc->vc_font.height;
61 area.width = width * vc->vc_font.width;
62
63 info->fbops->fb_copyarea(info, &area);
64}
65
47static void ud_clear(struct vc_data *vc, struct fb_info *info, int sy,66static void ud_clear(struct vc_data *vc, struct fb_info *info, int sy,
48 int sx, int height, int width)67 int sx, int height, int width)
49{68{
69 struct fbcon_ops *ops = info->fbcon_par;
50 struct fb_fillrect region;70 struct fb_fillrect region;
51 int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;71 int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;
52 u32 vyres = info->var.yres;72 u32 vyres = GETVYRES(ops->p, info);
53 u32 vxres = info->var.xres;73 u32 vxres = GETVXRES(ops->p, info);
54 74
55 region.color = attr_bgcol_ec(bgshift,vc,info);75 region.color = attr_bgcol_ec(bgshift,vc,info);
56 region.dy = vyres - ((sy + height) * vc->vc_font.height);76 region.dy = vyres - ((sy + height) * vc->vc_font.height);
@@ -142,8 +162,8 @@ static void ud_putcs(struct vc_data *vc, struct fb_info *info, · 85 unmodified lines
142 u32 mod = vc->vc_font.width % 8, cnt, pitch, size;162 u32 mod = vc->vc_font.width % 8, cnt, pitch, size;
143 u32 attribute = get_attribute(info, scr_readw(s));163 u32 attribute = get_attribute(info, scr_readw(s));
144 u8 *dst, *buf = NULL;164 u8 *dst, *buf = NULL;
145 u32 vyres = info->var.yres;165 u32 vyres = GETVYRES(ops->p, info);
146 u32 vxres = info->var.xres;166 u32 vxres = GETVXRES(ops->p, info);
147 167
148 if (!ops->fontbuffer)168 if (!ops->fontbuffer)
149 return;169 return;
@@ -239,8 +259,8 @@ static void ud_cursor(struct vc_data *vc, struct fb_info *info, int mode, · 89 unmodified lines
239 int attribute, use_sw = vc->vc_cursor_type & CUR_SW;259 int attribute, use_sw = vc->vc_cursor_type & CUR_SW;
240 int err = 1, dx, dy;260 int err = 1, dx, dy;
241 char *src;261 char *src;
242 u32 vyres = info->var.yres;262 u32 vyres = GETVYRES(ops->p, info);
243 u32 vxres = info->var.xres;263 u32 vxres = GETVXRES(ops->p, info);
244 264
245 if (!ops->fontbuffer)265 if (!ops->fontbuffer)
246 return;266 return;
@@ -390,8 +410,8 @@ static int ud_update_start(struct fb_info *info) · 143 unmodified lines
390{410{
391 struct fbcon_ops *ops = info->fbcon_par;411 struct fbcon_ops *ops = info->fbcon_par;
392 int xoffset, yoffset;412 int xoffset, yoffset;
393 u32 vyres = info->var.yres;413 u32 vyres = GETVYRES(ops->p, info);
394 u32 vxres = info->var.xres;414 u32 vxres = GETVXRES(ops->p, info);
395 int err;415 int err;
396 416
397 xoffset = vxres - info->var.xres - ops->var.xoffset;417 xoffset = vxres - info->var.xres - ops->var.xoffset;
@@ -409,6 +429,7 @@ static int ud_update_start(struct fb_info *info) · 11 unmodified lines
409 429
410void fbcon_rotate_ud(struct fbcon_ops *ops)430void fbcon_rotate_ud(struct fbcon_ops *ops)
411{431{
432 ops->bmove = ud_bmove;
412 ops->clear = ud_clear;433 ops->clear = ud_clear;
413 ops->putcs = ud_putcs;434 ops->putcs = ud_putcs;
414 ops->clear_margins = ud_clear_margins;435 ops->clear_margins = ud_clear_margins;
drivers/video/fbdev/core/tileblit.c+16−0
@@ -16,6 +16,21 @@ · 15 unmodified lines
16#include <asm/types.h>16#include <asm/types.h>
17#include "fbcon.h"17#include "fbcon.h"
18 18
19static void tile_bmove(struct vc_data *vc, struct fb_info *info, int sy,
20 int sx, int dy, int dx, int height, int width)
21{
22 struct fb_tilearea area;
23
24 area.sx = sx;
25 area.sy = sy;
26 area.dx = dx;
27 area.dy = dy;
28 area.height = height;
29 area.width = width;
30
31 info->tileops->fb_tilecopy(info, &area);
32}
33
19static void tile_clear(struct vc_data *vc, struct fb_info *info, int sy,34static void tile_clear(struct vc_data *vc, struct fb_info *info, int sy,
20 int sx, int height, int width)35 int sx, int height, int width)
21{36{
@@ -118,6 +133,7 @@ void fbcon_set_tileops(struct vc_data *vc, struct fb_info *info) · 96 unmodified lines
118 struct fb_tilemap map;133 struct fb_tilemap map;
119 struct fbcon_ops *ops = info->fbcon_par;134 struct fbcon_ops *ops = info->fbcon_par;
120 135
136 ops->bmove = tile_bmove;
121 ops->clear = tile_clear;137 ops->clear = tile_clear;
122 ops->putcs = tile_putcs;138 ops->putcs = tile_putcs;
123 ops->clear_margins = tile_clear_margins;139 ops->clear_margins = tile_clear_margins;
drivers/video/fbdev/skeletonfb.c+6−6
@@ -505,15 +505,15 @@ void xxxfb_fillrect(struct fb_info *p, const struct fb_fillrect *region) · 504 unmodified lines
505}505}
506 506
507/**507/**
508 * xxxfb_copyarea - OBSOLETE function.508 * xxxfb_copyarea - REQUIRED function. Can use generic routines if
509 * non acclerated hardware and packed pixel based.
509 * Copies one area of the screen to another area.510 * Copies one area of the screen to another area.
510 * Will be deleted in a future version
511 *511 *
512 * @info: frame buffer structure that represents a single frame buffer512 * @info: frame buffer structure that represents a single frame buffer
513 * @area: Structure providing the data to copy the framebuffer contents513 * @area: Structure providing the data to copy the framebuffer contents
514 * from one region to another.514 * from one region to another.
515 *515 *
516 * This drawing operation copied a rectangular area from one area of the516 * This drawing operation copies a rectangular area from one area of the
517 * screen to another area.517 * screen to another area.
518 */518 */
519void xxxfb_copyarea(struct fb_info *p, const struct fb_copyarea *area) 519void xxxfb_copyarea(struct fb_info *p, const struct fb_copyarea *area)
@@ -645,9 +645,9 @@ static const struct fb_ops xxxfb_ops = { · 125 unmodified lines
645 .fb_setcolreg = xxxfb_setcolreg,645 .fb_setcolreg = xxxfb_setcolreg,
646 .fb_blank = xxxfb_blank,646 .fb_blank = xxxfb_blank,
647 .fb_pan_display = xxxfb_pan_display,647 .fb_pan_display = xxxfb_pan_display,
648 .fb_fillrect = xxxfb_fillrect, /* Needed !!! */648 .fb_fillrect = xxxfb_fillrect, /* Needed !!! */
649 .fb_copyarea = xxxfb_copyarea, /* Obsolete */649 .fb_copyarea = xxxfb_copyarea, /* Needed !!! */
650 .fb_imageblit = xxxfb_imageblit, /* Needed !!! */650 .fb_imageblit = xxxfb_imageblit, /* Needed !!! */
651 .fb_cursor = xxxfb_cursor, /* Optional !!! */651 .fb_cursor = xxxfb_cursor, /* Optional !!! */
652 .fb_sync = xxxfb_sync,652 .fb_sync = xxxfb_sync,
653 .fb_ioctl = xxxfb_ioctl,653 .fb_ioctl = xxxfb_ioctl,
fs/9p/fid.c+4−5
@@ -96,12 +96,8 @@ static struct p9_fid *v9fs_fid_find(struct dentry *dentry, kuid_t uid, int any) · 95 unmodified lines
96 dentry, dentry, from_kuid(&init_user_ns, uid),96 dentry, dentry, from_kuid(&init_user_ns, uid),
97 any);97 any);
98 ret = NULL;98 ret = NULL;
99
100 if (d_inode(dentry))
101 ret = v9fs_fid_find_inode(d_inode(dentry), uid);
102
103 /* we'll recheck under lock if there's anything to look in */99 /* we'll recheck under lock if there's anything to look in */
104 if (!ret && dentry->d_fsdata) {100 if (dentry->d_fsdata) {
105 struct hlist_head *h = (struct hlist_head *)&dentry->d_fsdata;101 struct hlist_head *h = (struct hlist_head *)&dentry->d_fsdata;
106 102
107 spin_lock(&dentry->d_lock);103 spin_lock(&dentry->d_lock);
@@ -113,6 +109,9 @@ static struct p9_fid *v9fs_fid_find(struct dentry *dentry, kuid_t uid, int any) · 5 unmodified lines
113 }109 }
114 }110 }
115 spin_unlock(&dentry->d_lock);111 spin_unlock(&dentry->d_lock);
112 } else {
113 if (dentry->d_inode)
114 ret = v9fs_fid_find_inode(dentry->d_inode, uid);
116 }115 }
117 116
118 return ret;117 return ret;
fs/Makefile+1−1
@@ -96,7 +96,7 @@ obj-$(CONFIG_EXPORTFS) += exportfs/ · 95 unmodified lines
96obj-$(CONFIG_NFSD) += nfsd/96obj-$(CONFIG_NFSD) += nfsd/
97obj-$(CONFIG_LOCKD) += lockd/97obj-$(CONFIG_LOCKD) += lockd/
98obj-$(CONFIG_NLS) += nls/98obj-$(CONFIG_NLS) += nls/
99obj-$(CONFIG_UNICODE) += unicode/99obj-y += unicode/
100obj-$(CONFIG_SYSV_FS) += sysv/100obj-$(CONFIG_SYSV_FS) += sysv/
101obj-$(CONFIG_SMBFS_COMMON) += smbfs_common/101obj-$(CONFIG_SMBFS_COMMON) += smbfs_common/
102obj-$(CONFIG_CIFS) += cifs/102obj-$(CONFIG_CIFS) += cifs/
fs/btrfs/block-group.c+37−2
@@ -124,7 +124,16 @@ void btrfs_put_block_group(struct btrfs_block_group *cache) · 123 unmodified lines
124{124{
125 if (refcount_dec_and_test(&cache->refs)) {125 if (refcount_dec_and_test(&cache->refs)) {
126 WARN_ON(cache->pinned > 0);126 WARN_ON(cache->pinned > 0);
127 WARN_ON(cache->reserved > 0);127 /*
128 * If there was a failure to cleanup a log tree, very likely due
129 * to an IO failure on a writeback attempt of one or more of its
130 * extent buffers, we could not do proper (and cheap) unaccounting
131 * of their reserved space, so don't warn on reserved > 0 in that
132 * case.
133 */
134 if (!(cache->flags & BTRFS_BLOCK_GROUP_METADATA) ||
135 !BTRFS_FS_LOG_CLEANUP_ERROR(cache->fs_info))
136 WARN_ON(cache->reserved > 0);
128 137
129 /*138 /*
130 * A block_group shouldn't be on the discard_list anymore.139 * A block_group shouldn't be on the discard_list anymore.
@@ -2544,6 +2553,19 @@ int btrfs_inc_block_group_ro(struct btrfs_block_group *cache, · 2413 unmodified lines
2544 int ret;2553 int ret;
2545 bool dirty_bg_running;2554 bool dirty_bg_running;
2546 2555
2556 /*
2557 * This can only happen when we are doing read-only scrub on read-only
2558 * mount.
2559 * In that case we should not start a new transaction on read-only fs.
2560 * Thus here we skip all chunk allocations.
2561 */
2562 if (sb_rdonly(fs_info->sb)) {
2563 mutex_lock(&fs_info->ro_block_group_mutex);
2564 ret = inc_block_group_ro(cache, 0);
2565 mutex_unlock(&fs_info->ro_block_group_mutex);
2566 return ret;
2567 }
2568
2547 do {2569 do {
2548 trans = btrfs_join_transaction(root);2570 trans = btrfs_join_transaction(root);
2549 if (IS_ERR(trans))2571 if (IS_ERR(trans))
@@ -3974,9 +3996,22 @@ int btrfs_free_block_groups(struct btrfs_fs_info *info) · 1424 unmodified lines
3974 * important and indicates a real bug if this happens.3996 * important and indicates a real bug if this happens.
3975 */3997 */
3976 if (WARN_ON(space_info->bytes_pinned > 0 ||3998 if (WARN_ON(space_info->bytes_pinned > 0 ||
3977 space_info->bytes_reserved > 0 ||
3978 space_info->bytes_may_use > 0))3999 space_info->bytes_may_use > 0))
3979 btrfs_dump_space_info(info, space_info, 0, 0);4000 btrfs_dump_space_info(info, space_info, 0, 0);
4001
4002 /*
4003 * If there was a failure to cleanup a log tree, very likely due
4004 * to an IO failure on a writeback attempt of one or more of its
4005 * extent buffers, we could not do proper (and cheap) unaccounting
4006 * of their reserved space, so don't warn on bytes_reserved > 0 in
4007 * that case.
4008 */
4009 if (!(space_info->flags & BTRFS_BLOCK_GROUP_METADATA) ||
4010 !BTRFS_FS_LOG_CLEANUP_ERROR(info)) {
4011 if (WARN_ON(space_info->bytes_reserved > 0))
4012 btrfs_dump_space_info(info, space_info, 0, 0);
4013 }
4014
3980 WARN_ON(space_info->reclaim_size > 0);4015 WARN_ON(space_info->reclaim_size > 0);
3981 list_del(&space_info->list);4016 list_del(&space_info->list);
3982 btrfs_sysfs_remove_space_info(space_info);4017 btrfs_sysfs_remove_space_info(space_info);
fs/btrfs/ctree.h+6−0
@@ -145,6 +145,9 @@ enum { · 144 unmodified lines
145 BTRFS_FS_STATE_DUMMY_FS_INFO,145 BTRFS_FS_STATE_DUMMY_FS_INFO,
146 146
147 BTRFS_FS_STATE_NO_CSUMS,147 BTRFS_FS_STATE_NO_CSUMS,
148
149 /* Indicates there was an error cleaning up a log tree. */
150 BTRFS_FS_STATE_LOG_CLEANUP_ERROR,
148};151};
149 152
150#define BTRFS_BACKREF_REV_MAX 256153#define BTRFS_BACKREF_REV_MAX 256
@@ -3593,6 +3596,9 @@ do { \ · 3442 unmodified lines
3593 3596
3594#define BTRFS_FS_ERROR(fs_info) (unlikely(test_bit(BTRFS_FS_STATE_ERROR, \3597#define BTRFS_FS_ERROR(fs_info) (unlikely(test_bit(BTRFS_FS_STATE_ERROR, \
3595 &(fs_info)->fs_state)))3598 &(fs_info)->fs_state)))
3599#define BTRFS_FS_LOG_CLEANUP_ERROR(fs_info) \
3600 (unlikely(test_bit(BTRFS_FS_STATE_LOG_CLEANUP_ERROR, \
3601 &(fs_info)->fs_state)))
3596 3602
3597__printf(5, 6)3603__printf(5, 6)
3598__cold3604__cold
fs/btrfs/ioctl.c+2−5
@@ -805,10 +805,7 @@ static int create_snapshot(struct btrfs_root *root, struct inode *dir, · 804 unmodified lines
805 goto fail;805 goto fail;
806 }806 }
807 807
808 spin_lock(&fs_info->trans_lock);808 trans->pending_snapshot = pending_snapshot;
809 list_add(&pending_snapshot->list,
810 &trans->transaction->pending_snapshots);
811 spin_unlock(&fs_info->trans_lock);
812 809
813 ret = btrfs_commit_transaction(trans);810 ret = btrfs_commit_transaction(trans);
814 if (ret)811 if (ret)
@@ -3354,7 +3351,7 @@ static long btrfs_ioctl_rm_dev(struct file *file, void __user *arg) · 2539 unmodified lines
3354 struct block_device *bdev = NULL;3351 struct block_device *bdev = NULL;
3355 fmode_t mode;3352 fmode_t mode;
3356 int ret;3353 int ret;
3357 bool cancel;3354 bool cancel = false;
3358 3355
3359 if (!capable(CAP_SYS_ADMIN))3356 if (!capable(CAP_SYS_ADMIN))
3360 return -EPERM;3357 return -EPERM;
fs/btrfs/qgroup.c+19−2
@@ -1185,9 +1185,24 @@ int btrfs_quota_disable(struct btrfs_fs_info *fs_info) · 1184 unmodified lines
1185 struct btrfs_trans_handle *trans = NULL;1185 struct btrfs_trans_handle *trans = NULL;
1186 int ret = 0;1186 int ret = 0;
1187 1187
1188 /*
1189 * We need to have subvol_sem write locked, to prevent races between
1190 * concurrent tasks trying to disable quotas, because we will unlock
1191 * and relock qgroup_ioctl_lock across BTRFS_FS_QUOTA_ENABLED changes.
1192 */
1193 lockdep_assert_held_write(&fs_info->subvol_sem);
1194
1188 mutex_lock(&fs_info->qgroup_ioctl_lock);1195 mutex_lock(&fs_info->qgroup_ioctl_lock);
1189 if (!fs_info->quota_root)1196 if (!fs_info->quota_root)
1190 goto out;1197 goto out;
1198
1199 /*
1200 * Request qgroup rescan worker to complete and wait for it. This wait
1201 * must be done before transaction start for quota disable since it may
1202 * deadlock with transaction by the qgroup rescan worker.
1203 */
1204 clear_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags);
1205 btrfs_qgroup_wait_for_completion(fs_info, false);
1191 mutex_unlock(&fs_info->qgroup_ioctl_lock);1206 mutex_unlock(&fs_info->qgroup_ioctl_lock);
1192 1207
1193 /*1208 /*
@@ -1205,14 +1220,13 @@ int btrfs_quota_disable(struct btrfs_fs_info *fs_info) · 11 unmodified lines
1205 if (IS_ERR(trans)) {1220 if (IS_ERR(trans)) {
1206 ret = PTR_ERR(trans);1221 ret = PTR_ERR(trans);
1207 trans = NULL;1222 trans = NULL;
1223 set_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags);
1208 goto out;1224 goto out;
1209 }1225 }
1210 1226
1211 if (!fs_info->quota_root)1227 if (!fs_info->quota_root)
1212 goto out;1228 goto out;
1213 1229
1214 clear_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags);
1215 btrfs_qgroup_wait_for_completion(fs_info, false);
1216 spin_lock(&fs_info->qgroup_lock);1230 spin_lock(&fs_info->qgroup_lock);
1217 quota_root = fs_info->quota_root;1231 quota_root = fs_info->quota_root;
1218 fs_info->quota_root = NULL;1232 fs_info->quota_root = NULL;
@@ -3383,6 +3397,9 @@ qgroup_rescan_init(struct btrfs_fs_info *fs_info, u64 progress_objectid, · 2164 unmodified lines
3383 btrfs_warn(fs_info,3397 btrfs_warn(fs_info,
3384 "qgroup rescan init failed, qgroup is not enabled");3398 "qgroup rescan init failed, qgroup is not enabled");
3385 ret = -EINVAL;3399 ret = -EINVAL;
3400 } else if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags)) {
3401 /* Quota disable is in progress */
3402 ret = -EBUSY;
3386 }3403 }
3387 3404
3388 if (ret) {3405 if (ret) {
fs/btrfs/transaction.c+24−0
@@ -2000,6 +2000,27 @@ static inline void btrfs_wait_delalloc_flush(struct btrfs_fs_info *fs_info) · 1999 unmodified lines
2000 btrfs_wait_ordered_roots(fs_info, U64_MAX, 0, (u64)-1);2000 btrfs_wait_ordered_roots(fs_info, U64_MAX, 0, (u64)-1);
2001}2001}
2002 2002
2003/*
2004 * Add a pending snapshot associated with the given transaction handle to the
2005 * respective handle. This must be called after the transaction commit started
2006 * and while holding fs_info->trans_lock.
2007 * This serves to guarantee a caller of btrfs_commit_transaction() that it can
2008 * safely free the pending snapshot pointer in case btrfs_commit_transaction()
2009 * returns an error.
2010 */
2011static void add_pending_snapshot(struct btrfs_trans_handle *trans)
2012{
2013 struct btrfs_transaction *cur_trans = trans->transaction;
2014
2015 if (!trans->pending_snapshot)
2016 return;
2017
2018 lockdep_assert_held(&trans->fs_info->trans_lock);
2019 ASSERT(cur_trans->state >= TRANS_STATE_COMMIT_START);
2020
2021 list_add(&trans->pending_snapshot->list, &cur_trans->pending_snapshots);
2022}
2023
2003int btrfs_commit_transaction(struct btrfs_trans_handle *trans)2024int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
2004{2025{
2005 struct btrfs_fs_info *fs_info = trans->fs_info;2026 struct btrfs_fs_info *fs_info = trans->fs_info;
@@ -2073,6 +2094,8 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans) · 67 unmodified lines
2073 if (cur_trans->state >= TRANS_STATE_COMMIT_START) {2094 if (cur_trans->state >= TRANS_STATE_COMMIT_START) {
2074 enum btrfs_trans_state want_state = TRANS_STATE_COMPLETED;2095 enum btrfs_trans_state want_state = TRANS_STATE_COMPLETED;
2075 2096
2097 add_pending_snapshot(trans);
2098
2076 spin_unlock(&fs_info->trans_lock);2099 spin_unlock(&fs_info->trans_lock);
2077 refcount_inc(&cur_trans->use_count);2100 refcount_inc(&cur_trans->use_count);
2078 2101
@@ -2163,6 +2186,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans) · 84 unmodified lines
2163 * COMMIT_DOING so make sure to wait for num_writers to == 1 again.2186 * COMMIT_DOING so make sure to wait for num_writers to == 1 again.
2164 */2187 */
2165 spin_lock(&fs_info->trans_lock);2188 spin_lock(&fs_info->trans_lock);
2189 add_pending_snapshot(trans);
2166 cur_trans->state = TRANS_STATE_COMMIT_DOING;2190 cur_trans->state = TRANS_STATE_COMMIT_DOING;
2167 spin_unlock(&fs_info->trans_lock);2191 spin_unlock(&fs_info->trans_lock);
2168 wait_event(cur_trans->writer_wait,2192 wait_event(cur_trans->writer_wait,
fs/btrfs/transaction.h+2−0
@@ -123,6 +123,8 @@ struct btrfs_trans_handle { · 122 unmodified lines
123 struct btrfs_transaction *transaction;123 struct btrfs_transaction *transaction;
124 struct btrfs_block_rsv *block_rsv;124 struct btrfs_block_rsv *block_rsv;
125 struct btrfs_block_rsv *orig_rsv;125 struct btrfs_block_rsv *orig_rsv;
126 /* Set by a task that wants to create a snapshot. */
127 struct btrfs_pending_snapshot *pending_snapshot;
126 refcount_t use_count;128 refcount_t use_count;
127 unsigned int type;129 unsigned int type;
128 /*130 /*
fs/btrfs/tree-checker.c+15−0
@@ -965,6 +965,7 @@ static int check_dev_item(struct extent_buffer *leaf, · 964 unmodified lines
965 struct btrfs_key *key, int slot)965 struct btrfs_key *key, int slot)
966{966{
967 struct btrfs_dev_item *ditem;967 struct btrfs_dev_item *ditem;
968 const u32 item_size = btrfs_item_size(leaf, slot);
968 969
969 if (unlikely(key->objectid != BTRFS_DEV_ITEMS_OBJECTID)) {970 if (unlikely(key->objectid != BTRFS_DEV_ITEMS_OBJECTID)) {
970 dev_item_err(leaf, slot,971 dev_item_err(leaf, slot,
@@ -972,6 +973,13 @@ static int check_dev_item(struct extent_buffer *leaf, · 1 unmodified line
972 key->objectid, BTRFS_DEV_ITEMS_OBJECTID);973 key->objectid, BTRFS_DEV_ITEMS_OBJECTID);
973 return -EUCLEAN;974 return -EUCLEAN;
974 }975 }
976
977 if (unlikely(item_size != sizeof(*ditem))) {
978 dev_item_err(leaf, slot, "invalid item size: has %u expect %zu",
979 item_size, sizeof(*ditem));
980 return -EUCLEAN;
981 }
982
975 ditem = btrfs_item_ptr(leaf, slot, struct btrfs_dev_item);983 ditem = btrfs_item_ptr(leaf, slot, struct btrfs_dev_item);
976 if (unlikely(btrfs_device_id(leaf, ditem) != key->offset)) {984 if (unlikely(btrfs_device_id(leaf, ditem) != key->offset)) {
977 dev_item_err(leaf, slot,985 dev_item_err(leaf, slot,
@@ -1007,6 +1015,7 @@ static int check_inode_item(struct extent_buffer *leaf, · 29 unmodified lines
1007 struct btrfs_inode_item *iitem;1015 struct btrfs_inode_item *iitem;
1008 u64 super_gen = btrfs_super_generation(fs_info->super_copy);1016 u64 super_gen = btrfs_super_generation(fs_info->super_copy);
1009 u32 valid_mask = (S_IFMT | S_ISUID | S_ISGID | S_ISVTX | 0777);1017 u32 valid_mask = (S_IFMT | S_ISUID | S_ISGID | S_ISVTX | 0777);
1018 const u32 item_size = btrfs_item_size(leaf, slot);
1010 u32 mode;1019 u32 mode;
1011 int ret;1020 int ret;
1012 u32 flags;1021 u32 flags;
@@ -1016,6 +1025,12 @@ static int check_inode_item(struct extent_buffer *leaf, · 3 unmodified lines
1016 if (unlikely(ret < 0))1025 if (unlikely(ret < 0))
1017 return ret;1026 return ret;
1018 1027
1028 if (unlikely(item_size != sizeof(*iitem))) {
1029 generic_err(leaf, slot, "invalid item size: has %u expect %zu",
1030 item_size, sizeof(*iitem));
1031 return -EUCLEAN;
1032 }
1033
1019 iitem = btrfs_item_ptr(leaf, slot, struct btrfs_inode_item);1034 iitem = btrfs_item_ptr(leaf, slot, struct btrfs_inode_item);
1020 1035
1021 /* Here we use super block generation + 1 to handle log tree */1036 /* Here we use super block generation + 1 to handle log tree */
fs/btrfs/tree-log.c+23−0
@@ -3414,6 +3414,29 @@ static void free_log_tree(struct btrfs_trans_handle *trans, · 3413 unmodified lines
3414 if (log->node) {3414 if (log->node) {
3415 ret = walk_log_tree(trans, log, &wc);3415 ret = walk_log_tree(trans, log, &wc);
3416 if (ret) {3416 if (ret) {
3417 /*
3418 * We weren't able to traverse the entire log tree, the
3419 * typical scenario is getting an -EIO when reading an
3420 * extent buffer of the tree, due to a previous writeback
3421 * failure of it.
3422 */
3423 set_bit(BTRFS_FS_STATE_LOG_CLEANUP_ERROR,
3424 &log->fs_info->fs_state);
3425
3426 /*
3427 * Some extent buffers of the log tree may still be dirty
3428 * and not yet written back to storage, because we may
3429 * have updates to a log tree without syncing a log tree,
3430 * such as during rename and link operations. So flush
3431 * them out and wait for their writeback to complete, so
3432 * that we properly cleanup their state and pages.
3433 */
3434 btrfs_write_marked_extents(log->fs_info,
3435 &log->dirty_log_pages,
3436 EXTENT_DIRTY | EXTENT_NEW);
3437 btrfs_wait_tree_log_extents(log,
3438 EXTENT_DIRTY | EXTENT_NEW);
3439
3417 if (trans)3440 if (trans)
3418 btrfs_abort_transaction(trans, ret);3441 btrfs_abort_transaction(trans, ret);
3419 else3442 else
fs/cachefiles/io.c+59−0
@@ -191,6 +191,64 @@ presubmission_error: · 190 unmodified lines
191 return ret;191 return ret;
192}192}
193 193
194/*
195 * Query the occupancy of the cache in a region, returning where the next chunk
196 * of data starts and how long it is.
197 */
198static int cachefiles_query_occupancy(struct netfs_cache_resources *cres,
199 loff_t start, size_t len, size_t granularity,
200 loff_t *_data_start, size_t *_data_len)
201{
202 struct cachefiles_object *object;
203 struct file *file;
204 loff_t off, off2;
205
206 *_data_start = -1;
207 *_data_len = 0;
208
209 if (!fscache_wait_for_operation(cres, FSCACHE_WANT_READ))
210 return -ENOBUFS;
211
212 object = cachefiles_cres_object(cres);
213 file = cachefiles_cres_file(cres);
214 granularity = max_t(size_t, object->volume->cache->bsize, granularity);
215
216 _enter("%pD,%li,%llx,%zx/%llx",
217 file, file_inode(file)->i_ino, start, len,
218 i_size_read(file_inode(file)));
219
220 off = cachefiles_inject_read_error();
221 if (off == 0)
222 off = vfs_llseek(file, start, SEEK_DATA);
223 if (off == -ENXIO)
224 return -ENODATA; /* Beyond EOF */
225 if (off < 0 && off >= (loff_t)-MAX_ERRNO)
226 return -ENOBUFS; /* Error. */
227 if (round_up(off, granularity) >= start + len)
228 return -ENODATA; /* No data in range */
229
230 off2 = cachefiles_inject_read_error();
231 if (off2 == 0)
232 off2 = vfs_llseek(file, off, SEEK_HOLE);
233 if (off2 == -ENXIO)
234 return -ENODATA; /* Beyond EOF */
235 if (off2 < 0 && off2 >= (loff_t)-MAX_ERRNO)
236 return -ENOBUFS; /* Error. */
237
238 /* Round away partial blocks */
239 off = round_up(off, granularity);
240 off2 = round_down(off2, granularity);
241 if (off2 <= off)
242 return -ENODATA;
243
244 *_data_start = off;
245 if (off2 > start + len)
246 *_data_len = len;
247 else
248 *_data_len = off2 - off;
249 return 0;
250}
251
194/*252/*
195 * Handle completion of a write to the cache.253 * Handle completion of a write to the cache.
196 */254 */
@@ -545,6 +603,7 @@ static const struct netfs_cache_ops cachefiles_netfs_cache_ops = { · 348 unmodified lines
545 .write = cachefiles_write,603 .write = cachefiles_write,
546 .prepare_read = cachefiles_prepare_read,604 .prepare_read = cachefiles_prepare_read,
547 .prepare_write = cachefiles_prepare_write,605 .prepare_write = cachefiles_prepare_write,
606 .query_occupancy = cachefiles_query_occupancy,
548};607};
549 608
550/*609/*
fs/cifs/connect.c+16−7
@@ -162,7 +162,7 @@ static void cifs_resolve_server(struct work_struct *work) · 161 unmodified lines
162 mutex_unlock(&server->srv_mutex);162 mutex_unlock(&server->srv_mutex);
163}163}
164 164
165/**165/*
166 * Mark all sessions and tcons for reconnect.166 * Mark all sessions and tcons for reconnect.
167 *167 *
168 * @server needs to be previously set to CifsNeedReconnect.168 * @server needs to be previously set to CifsNeedReconnect.
@@ -1831,13 +1831,9 @@ void cifs_put_smb_ses(struct cifs_ses *ses) · 1662 unmodified lines
1831 int i;1831 int i;
1832 1832
1833 for (i = 1; i < chan_count; i++) {1833 for (i = 1; i < chan_count; i++) {
1834 /*1834 spin_unlock(&ses->chan_lock);
1835 * note: for now, we're okay accessing ses->chans
1836 * without chan_lock. But when chans can go away, we'll
1837 * need to introduce ref counting to make sure that chan
1838 * is not freed from under us.
1839 */
1840 cifs_put_tcp_session(ses->chans[i].server, 0);1835 cifs_put_tcp_session(ses->chans[i].server, 0);
1836 spin_lock(&ses->chan_lock);
1841 ses->chans[i].server = NULL;1837 ses->chans[i].server = NULL;
1842 }1838 }
1843 }1839 }
@@ -1981,6 +1977,19 @@ cifs_set_cifscreds(struct smb3_fs_context *ctx, struct cifs_ses *ses) · 137 unmodified lines
1981 }1977 }
1982 }1978 }
1983 1979
1980 ctx->workstation_name = kstrdup(ses->workstation_name, GFP_KERNEL);
1981 if (!ctx->workstation_name) {
1982 cifs_dbg(FYI, "Unable to allocate memory for workstation_name\n");
1983 rc = -ENOMEM;
1984 kfree(ctx->username);
1985 ctx->username = NULL;
1986 kfree_sensitive(ctx->password);
1987 ctx->password = NULL;
1988 kfree(ctx->domainname);
1989 ctx->domainname = NULL;
1990 goto out_key_put;
1991 }
1992
1984out_key_put:1993out_key_put:
1985 up_read(&key->sem);1994 up_read(&key->sem);
1986 key_put(key);1995 key_put(key);
fs/cifs/file.c+82−139
@@ -4269,8 +4269,6 @@ cifs_readv_complete(struct work_struct *work) · 4268 unmodified lines
4269 for (i = 0; i < rdata->nr_pages; i++) {4269 for (i = 0; i < rdata->nr_pages; i++) {
4270 struct page *page = rdata->pages[i];4270 struct page *page = rdata->pages[i];
4271 4271
4272 lru_cache_add(page);
4273
4274 if (rdata->result == 0 ||4272 if (rdata->result == 0 ||
4275 (rdata->result == -EAGAIN && got_bytes)) {4273 (rdata->result == -EAGAIN && got_bytes)) {
4276 flush_dcache_page(page);4274 flush_dcache_page(page);
@@ -4278,12 +4276,12 @@ cifs_readv_complete(struct work_struct *work) · 1 unmodified line
4278 } else4276 } else
4279 SetPageError(page);4277 SetPageError(page);
4280 4278
4281 unlock_page(page);
4282
4283 if (rdata->result == 0 ||4279 if (rdata->result == 0 ||
4284 (rdata->result == -EAGAIN && got_bytes))4280 (rdata->result == -EAGAIN && got_bytes))
4285 cifs_readpage_to_fscache(rdata->mapping->host, page);4281 cifs_readpage_to_fscache(rdata->mapping->host, page);
4286 4282
4283 unlock_page(page);
4284
4287 got_bytes -= min_t(unsigned int, PAGE_SIZE, got_bytes);4285 got_bytes -= min_t(unsigned int, PAGE_SIZE, got_bytes);
4288 4286
4289 put_page(page);4287 put_page(page);
@@ -4340,7 +4338,6 @@ readpages_fill_pages(struct TCP_Server_Info *server, · 50 unmodified lines
4340 * fill them until the writes are flushed.4338 * fill them until the writes are flushed.
4341 */4339 */
4342 zero_user(page, 0, PAGE_SIZE);4340 zero_user(page, 0, PAGE_SIZE);
4343 lru_cache_add(page);
4344 flush_dcache_page(page);4341 flush_dcache_page(page);
4345 SetPageUptodate(page);4342 SetPageUptodate(page);
4346 unlock_page(page);4343 unlock_page(page);
@@ -4350,7 +4347,6 @@ readpages_fill_pages(struct TCP_Server_Info *server, · 3 unmodified lines
4350 continue;4347 continue;
4351 } else {4348 } else {
4352 /* no need to hold page hostage */4349 /* no need to hold page hostage */
4353 lru_cache_add(page);
4354 unlock_page(page);4350 unlock_page(page);
4355 put_page(page);4351 put_page(page);
4356 rdata->pages[i] = NULL;4352 rdata->pages[i] = NULL;
@@ -4393,92 +4389,20 @@ cifs_readpages_copy_into_pages(struct TCP_Server_Info *server, · 36 unmodified lines
4393 return readpages_fill_pages(server, rdata, iter, iter->count);4389 return readpages_fill_pages(server, rdata, iter, iter->count);
4394}4390}
4395 4391
4396static int4392static void cifs_readahead(struct readahead_control *ractl)
4397readpages_get_pages(struct address_space *mapping, struct list_head *page_list,
4398 unsigned int rsize, struct list_head *tmplist,
4399 unsigned int *nr_pages, loff_t *offset, unsigned int *bytes)
4400{
4401 struct page *page, *tpage;
4402 unsigned int expected_index;
4403 int rc;
4404 gfp_t gfp = readahead_gfp_mask(mapping);
4405
4406 INIT_LIST_HEAD(tmplist);
4407
4408 page = lru_to_page(page_list);
4409
4410 /*
4411 * Lock the page and put it in the cache. Since no one else
4412 * should have access to this page, we're safe to simply set
4413 * PG_locked without checking it first.
4414 */
4415 __SetPageLocked(page);
4416 rc = add_to_page_cache_locked(page, mapping,
4417 page->index, gfp);
4418
4419 /* give up if we can't stick it in the cache */
4420 if (rc) {
4421 __ClearPageLocked(page);
4422 return rc;
4423 }
4424
4425 /* move first page to the tmplist */
4426 *offset = (loff_t)page->index << PAGE_SHIFT;
4427 *bytes = PAGE_SIZE;
4428 *nr_pages = 1;
4429 list_move_tail(&page->lru, tmplist);
4430
4431 /* now try and add more pages onto the request */
4432 expected_index = page->index + 1;
4433 list_for_each_entry_safe_reverse(page, tpage, page_list, lru) {
4434 /* discontinuity ? */
4435 if (page->index != expected_index)
4436 break;
4437
4438 /* would this page push the read over the rsize? */
4439 if (*bytes + PAGE_SIZE > rsize)
4440 break;
4441
4442 __SetPageLocked(page);
4443 rc = add_to_page_cache_locked(page, mapping, page->index, gfp);
4444 if (rc) {
4445 __ClearPageLocked(page);
4446 break;
4447 }
4448 list_move_tail(&page->lru, tmplist);
4449 (*bytes) += PAGE_SIZE;
4450 expected_index++;
4451 (*nr_pages)++;
4452 }
4453 return rc;
4454}
4455
4456static int cifs_readpages(struct file *file, struct address_space *mapping,
4457 struct list_head *page_list, unsigned num_pages)
4458{4393{
4459 int rc;4394 int rc;
4460 int err = 0;4395 struct cifsFileInfo *open_file = ractl->file->private_data;
4461 struct list_head tmplist;4396 struct cifs_sb_info *cifs_sb = CIFS_FILE_SB(ractl->file);
4462 struct cifsFileInfo *open_file = file->private_data;
4463 struct cifs_sb_info *cifs_sb = CIFS_FILE_SB(file);
4464 struct TCP_Server_Info *server;4397 struct TCP_Server_Info *server;
4465 pid_t pid;4398 pid_t pid;
4466 unsigned int xid;4399 unsigned int xid, nr_pages, last_batch_size = 0, cache_nr_pages = 0;
4400 pgoff_t next_cached = ULONG_MAX;
4401 bool caching = fscache_cookie_enabled(cifs_inode_cookie(ractl->mapping->host)) &&
4402 cifs_inode_cookie(ractl->mapping->host)->cache_priv;
4403 bool check_cache = caching;
4467 4404
4468 xid = get_xid();4405 xid = get_xid();
4469 /*
4470 * Reads as many pages as possible from fscache. Returns -ENOBUFS
4471 * immediately if the cookie is negative
4472 *
4473 * After this point, every page in the list might have PG_fscache set,
4474 * so we will need to clean that up off of every page we don't use.
4475 */
4476 rc = cifs_readpages_from_fscache(mapping->host, mapping, page_list,
4477 &num_pages);
4478 if (rc == 0) {
4479 free_xid(xid);
4480 return rc;
4481 }
4482 4406
4483 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD)4407 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD)
4484 pid = open_file->pid;4408 pid = open_file->pid;
@@ -4489,39 +4413,73 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, · 4 unmodified lines
4489 server = cifs_pick_channel(tlink_tcon(open_file->tlink)->ses);4413 server = cifs_pick_channel(tlink_tcon(open_file->tlink)->ses);
4490 4414
4491 cifs_dbg(FYI, "%s: file=%p mapping=%p num_pages=%u\n",4415 cifs_dbg(FYI, "%s: file=%p mapping=%p num_pages=%u\n",
4492 __func__, file, mapping, num_pages);4416 __func__, ractl->file, ractl->mapping, readahead_count(ractl));
4493 4417
4494 /*4418 /*
4495 * Start with the page at end of list and move it to private4419 * Chop the readahead request up into rsize-sized read requests.
4496 * list. Do the same with any following pages until we hit
4497 * the rsize limit, hit an index discontinuity, or run out of
4498 * pages. Issue the async read and then start the loop again
4499 * until the list is empty.
4500 *
4501 * Note that list order is important. The page_list is in
4502 * the order of declining indexes. When we put the pages in
4503 * the rdata->pages, then we want them in increasing order.
4504 */4420 */
4505 while (!list_empty(page_list) && !err) {4421 while ((nr_pages = readahead_count(ractl) - last_batch_size)) {
4506 unsigned int i, nr_pages, bytes, rsize;4422 unsigned int i, got, rsize;
4507 loff_t offset;4423 struct page *page;
4508 struct page *page, *tpage;
4509 struct cifs_readdata *rdata;4424 struct cifs_readdata *rdata;
4510 struct cifs_credits credits_on_stack;4425 struct cifs_credits credits_on_stack;
4511 struct cifs_credits *credits = &credits_on_stack;4426 struct cifs_credits *credits = &credits_on_stack;
4427 pgoff_t index = readahead_index(ractl) + last_batch_size;
4428
4429 /*
4430 * Find out if we have anything cached in the range of
4431 * interest, and if so, where the next chunk of cached data is.
4432 */
4433 if (caching) {
4434 if (check_cache) {
4435 rc = cifs_fscache_query_occupancy(
4436 ractl->mapping->host, index, nr_pages,
4437 &next_cached, &cache_nr_pages);
4438 if (rc < 0)
4439 caching = false;
4440 check_cache = false;
4441 }
4442
4443 if (index == next_cached) {
4444 /*
4445 * TODO: Send a whole batch of pages to be read
4446 * by the cache.
4447 */
4448 page = readahead_page(ractl);
4449 last_batch_size = 1 << thp_order(page);
4450 if (cifs_readpage_from_fscache(ractl->mapping->host,
4451 page) < 0) {
4452 /*
4453 * TODO: Deal with cache read failure
4454 * here, but for the moment, delegate
4455 * that to readpage.
4456 */
4457 caching = false;
4458 }
4459 unlock_page(page);
4460 next_cached++;
4461 cache_nr_pages--;
4462 if (cache_nr_pages == 0)
4463 check_cache = true;
4464 continue;
4465 }
4466 }
4512 4467
4513 if (open_file->invalidHandle) {4468 if (open_file->invalidHandle) {
4514 rc = cifs_reopen_file(open_file, true);4469 rc = cifs_reopen_file(open_file, true);
4515 if (rc == -EAGAIN)4470 if (rc) {
4516 continue;4471 if (rc == -EAGAIN)
4517 else if (rc)4472 continue;
4518 break;4473 break;
4474 }
4519 }4475 }
4520 4476
4521 rc = server->ops->wait_mtu_credits(server, cifs_sb->ctx->rsize,4477 rc = server->ops->wait_mtu_credits(server, cifs_sb->ctx->rsize,
4522 &rsize, credits);4478 &rsize, credits);
4523 if (rc)4479 if (rc)
4524 break;4480 break;
4481 nr_pages = min_t(size_t, rsize / PAGE_SIZE, readahead_count(ractl));
4482 nr_pages = min_t(size_t, nr_pages, next_cached - index);
4525 4483
4526 /*4484 /*
4527 * Give up immediately if rsize is too small to read an entire4485 * Give up immediately if rsize is too small to read an entire
@@ -4529,16 +4487,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, · 1 unmodified line
4529 * reach this point however since we set ra_pages to 0 when the4487 * reach this point however since we set ra_pages to 0 when the
4530 * rsize is smaller than a cache page.4488 * rsize is smaller than a cache page.
4531 */4489 */
4532 if (unlikely(rsize < PAGE_SIZE)) {4490 if (unlikely(!nr_pages)) {
4533 add_credits_and_wake_if(server, credits, 0);
4534 free_xid(xid);
4535 return 0;
4536 }
4537
4538 nr_pages = 0;
4539 err = readpages_get_pages(mapping, page_list, rsize, &tmplist,
4540 &nr_pages, &offset, &bytes);
4541 if (!nr_pages) {
4542 add_credits_and_wake_if(server, credits, 0);4491 add_credits_and_wake_if(server, credits, 0);
4543 break;4492 break;
4544 }4493 }
@@ -4546,36 +4495,31 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, · 1 unmodified line
4546 rdata = cifs_readdata_alloc(nr_pages, cifs_readv_complete);4495 rdata = cifs_readdata_alloc(nr_pages, cifs_readv_complete);
4547 if (!rdata) {4496 if (!rdata) {
4548 /* best to give up if we're out of mem */4497 /* best to give up if we're out of mem */
4549 list_for_each_entry_safe(page, tpage, &tmplist, lru) {
4550 list_del(&page->lru);
4551 lru_cache_add(page);
4552 unlock_page(page);
4553 put_page(page);
4554 }
4555 rc = -ENOMEM;
4556 add_credits_and_wake_if(server, credits, 0);4498 add_credits_and_wake_if(server, credits, 0);
4557 break;4499 break;
4558 }4500 }
4559 4501
4560 rdata->cfile = cifsFileInfo_get(open_file);4502 got = __readahead_batch(ractl, rdata->pages, nr_pages);
4561 rdata->server = server;4503 if (got != nr_pages) {
4562 rdata->mapping = mapping;4504 pr_warn("__readahead_batch() returned %u/%u\n",
4563 rdata->offset = offset;4505 got, nr_pages);
4564 rdata->bytes = bytes;4506 nr_pages = got;
4565 rdata->pid = pid;4507 }
4566 rdata->pagesz = PAGE_SIZE;4508
4567 rdata->tailsz = PAGE_SIZE;4509 rdata->nr_pages = nr_pages;
4510 rdata->bytes = readahead_batch_length(ractl);
4511 rdata->cfile = cifsFileInfo_get(open_file);
4512 rdata->server = server;
4513 rdata->mapping = ractl->mapping;
4514 rdata->offset = readahead_pos(ractl);
4515 rdata->pid = pid;
4516 rdata->pagesz = PAGE_SIZE;
4517 rdata->tailsz = PAGE_SIZE;
4568 rdata->read_into_pages = cifs_readpages_read_into_pages;4518 rdata->read_into_pages = cifs_readpages_read_into_pages;
4569 rdata->copy_into_pages = cifs_readpages_copy_into_pages;4519 rdata->copy_into_pages = cifs_readpages_copy_into_pages;
4570 rdata->credits = credits_on_stack;4520 rdata->credits = credits_on_stack;
4571
4572 list_for_each_entry_safe(page, tpage, &tmplist, lru) {
4573 list_del(&page->lru);
4574 rdata->pages[rdata->nr_pages++] = page;
4575 }
4576 4521
4577 rc = adjust_credits(server, &rdata->credits, rdata->bytes);4522 rc = adjust_credits(server, &rdata->credits, rdata->bytes);
4578
4579 if (!rc) {4523 if (!rc) {
4580 if (rdata->cfile->invalidHandle)4524 if (rdata->cfile->invalidHandle)
4581 rc = -EAGAIN;4525 rc = -EAGAIN;
@@ -4587,7 +4531,6 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, · 5 unmodified lines
4587 add_credits_and_wake_if(server, &rdata->credits, 0);4531 add_credits_and_wake_if(server, &rdata->credits, 0);
4588 for (i = 0; i < rdata->nr_pages; i++) {4532 for (i = 0; i < rdata->nr_pages; i++) {
4589 page = rdata->pages[i];4533 page = rdata->pages[i];
4590 lru_cache_add(page);
4591 unlock_page(page);4534 unlock_page(page);
4592 put_page(page);4535 put_page(page);
4593 }4536 }
@@ -4597,10 +4540,10 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, · 3 unmodified lines
4597 }4540 }
4598 4541
4599 kref_put(&rdata->refcount, cifs_readdata_release);4542 kref_put(&rdata->refcount, cifs_readdata_release);
4543 last_batch_size = nr_pages;
4600 }4544 }
4601 4545
4602 free_xid(xid);4546 free_xid(xid);
4603 return rc;
4604}4547}
4605 4548
4606/*4549/*
@@ -4924,7 +4867,7 @@ oplock_break_done: · 317 unmodified lines
4924 * In the non-cached mode (mount with cache=none), we shunt off direct read and write requests4867 * In the non-cached mode (mount with cache=none), we shunt off direct read and write requests
4925 * so this method should never be called.4868 * so this method should never be called.
4926 *4869 *
4927 * Direct IO is not yet supported in the cached mode. 4870 * Direct IO is not yet supported in the cached mode.
4928 */4871 */
4929static ssize_t4872static ssize_t
4930cifs_direct_io(struct kiocb *iocb, struct iov_iter *iter)4873cifs_direct_io(struct kiocb *iocb, struct iov_iter *iter)
@@ -5006,7 +4949,7 @@ static int cifs_set_page_dirty(struct page *page) · 75 unmodified lines
5006 4949
5007const struct address_space_operations cifs_addr_ops = {4950const struct address_space_operations cifs_addr_ops = {
5008 .readpage = cifs_readpage,4951 .readpage = cifs_readpage,
5009 .readpages = cifs_readpages,4952 .readahead = cifs_readahead,
5010 .writepage = cifs_writepage,4953 .writepage = cifs_writepage,
5011 .writepages = cifs_writepages,4954 .writepages = cifs_writepages,
5012 .write_begin = cifs_write_begin,4955 .write_begin = cifs_write_begin,
fs/cifs/fscache.c+108−18
@@ -134,37 +134,127 @@ void cifs_fscache_release_inode_cookie(struct inode *inode) · 133 unmodified lines
134 }134 }
135}135}
136 136
137static inline void fscache_end_operation(struct netfs_cache_resources *cres)
138{
139 const struct netfs_cache_ops *ops = fscache_operation_valid(cres);
140
141 if (ops)
142 ops->end_operation(cres);
143}
144
137/*145/*
138 * Retrieve a page from FS-Cache146 * Fallback page reading interface.
139 */147 */
140int __cifs_readpage_from_fscache(struct inode *inode, struct page *page)148static int fscache_fallback_read_page(struct inode *inode, struct page *page)
141{149{
142 cifs_dbg(FYI, "%s: (fsc:%p, p:%p, i:0x%p\n",150 struct netfs_cache_resources cres;
143 __func__, CIFS_I(inode)->fscache, page, inode);151 struct fscache_cookie *cookie = cifs_inode_cookie(inode);
144 return -ENOBUFS; // Needs conversion to using netfslib152 struct iov_iter iter;
153 struct bio_vec bvec[1];
154 int ret;
155
156 memset(&cres, 0, sizeof(cres));
157 bvec[0].bv_page = page;
158 bvec[0].bv_offset = 0;
159 bvec[0].bv_len = PAGE_SIZE;
160 iov_iter_bvec(&iter, READ, bvec, ARRAY_SIZE(bvec), PAGE_SIZE);
161
162 ret = fscache_begin_read_operation(&cres, cookie);
163 if (ret < 0)
164 return ret;
165
166 ret = fscache_read(&cres, page_offset(page), &iter, NETFS_READ_HOLE_FAIL,
167 NULL, NULL);
168 fscache_end_operation(&cres);
169 return ret;
145}170}
146 171
147/*172/*
148 * Retrieve a set of pages from FS-Cache173 * Fallback page writing interface.
149 */174 */
150int __cifs_readpages_from_fscache(struct inode *inode,175static int fscache_fallback_write_page(struct inode *inode, struct page *page,
151 struct address_space *mapping,176 bool no_space_allocated_yet)
152 struct list_head *pages,
153 unsigned *nr_pages)
154{177{
155 cifs_dbg(FYI, "%s: (0x%p/%u/0x%p)\n",178 struct netfs_cache_resources cres;
156 __func__, CIFS_I(inode)->fscache, *nr_pages, inode);179 struct fscache_cookie *cookie = cifs_inode_cookie(inode);
157 return -ENOBUFS; // Needs conversion to using netfslib180 struct iov_iter iter;
181 struct bio_vec bvec[1];
182 loff_t start = page_offset(page);
183 size_t len = PAGE_SIZE;
184 int ret;
185
186 memset(&cres, 0, sizeof(cres));
187 bvec[0].bv_page = page;
188 bvec[0].bv_offset = 0;
189 bvec[0].bv_len = PAGE_SIZE;
190 iov_iter_bvec(&iter, WRITE, bvec, ARRAY_SIZE(bvec), PAGE_SIZE);
191
192 ret = fscache_begin_write_operation(&cres, cookie);
193 if (ret < 0)
194 return ret;
195
196 ret = cres.ops->prepare_write(&cres, &start, &len, i_size_read(inode),
197 no_space_allocated_yet);
198 if (ret == 0)
199 ret = fscache_write(&cres, page_offset(page), &iter, NULL, NULL);
200 fscache_end_operation(&cres);
201 return ret;
158}202}
159 203
160void __cifs_readpage_to_fscache(struct inode *inode, struct page *page)204/*
205 * Retrieve a page from FS-Cache
206 */
207int __cifs_readpage_from_fscache(struct inode *inode, struct page *page)
161{208{
162 struct cifsInodeInfo *cifsi = CIFS_I(inode);209 int ret;
163 210
164 WARN_ON(!cifsi->fscache);211 cifs_dbg(FYI, "%s: (fsc:%p, p:%p, i:0x%p\n",
212 __func__, cifs_inode_cookie(inode), page, inode);
165 213
214 ret = fscache_fallback_read_page(inode, page);
215 if (ret < 0)
216 return ret;
217
218 /* Read completed synchronously */
219 SetPageUptodate(page);
220 return 0;
221}
222
223void __cifs_readpage_to_fscache(struct inode *inode, struct page *page)
224{
166 cifs_dbg(FYI, "%s: (fsc: %p, p: %p, i: %p)\n",225 cifs_dbg(FYI, "%s: (fsc: %p, p: %p, i: %p)\n",
167 __func__, cifsi->fscache, page, inode);226 __func__, cifs_inode_cookie(inode), page, inode);
227
228 fscache_fallback_write_page(inode, page, true);
229}
230
231/*
232 * Query the cache occupancy.
233 */
234int __cifs_fscache_query_occupancy(struct inode *inode,
235 pgoff_t first, unsigned int nr_pages,
236 pgoff_t *_data_first,
237 unsigned int *_data_nr_pages)
238{
239 struct netfs_cache_resources cres;
240 struct fscache_cookie *cookie = cifs_inode_cookie(inode);
241 loff_t start, data_start;
242 size_t len, data_len;
243 int ret;
168 244
169 // Needs conversion to using netfslib245 ret = fscache_begin_read_operation(&cres, cookie);
246 if (ret < 0)
247 return ret;
248
249 start = first * PAGE_SIZE;
250 len = nr_pages * PAGE_SIZE;
251 ret = cres.ops->query_occupancy(&cres, start, len, PAGE_SIZE,
252 &data_start, &data_len);
253 if (ret == 0) {
254 *_data_first = data_start / PAGE_SIZE;
255 *_data_nr_pages = len / PAGE_SIZE;
256 }
257
258 fscache_end_operation(&cres);
259 return ret;
170}260}
fs/cifs/fscache.h+49−30
@@ -9,6 +9,7 @@ · 8 unmodified lines
9#ifndef _CIFS_FSCACHE_H9#ifndef _CIFS_FSCACHE_H
10#define _CIFS_FSCACHE_H10#define _CIFS_FSCACHE_H
11 11
12#include <linux/swap.h>
12#include <linux/fscache.h>13#include <linux/fscache.h>
13 14
14#include "cifsglob.h"15#include "cifsglob.h"
@@ -58,14 +59,6 @@ void cifs_fscache_fill_coherency(struct inode *inode, · 43 unmodified lines
58}59}
59 60
60 61
61extern int cifs_fscache_release_page(struct page *page, gfp_t gfp);
62extern int __cifs_readpage_from_fscache(struct inode *, struct page *);
63extern int __cifs_readpages_from_fscache(struct inode *,
64 struct address_space *,
65 struct list_head *,
66 unsigned *);
67extern void __cifs_readpage_to_fscache(struct inode *, struct page *);
68
69static inline struct fscache_cookie *cifs_inode_cookie(struct inode *inode)62static inline struct fscache_cookie *cifs_inode_cookie(struct inode *inode)
70{63{
71 return CIFS_I(inode)->fscache;64 return CIFS_I(inode)->fscache;
@@ -80,33 +73,52 @@ static inline void cifs_invalidate_cache(struct inode *inode, unsigned int flags · 8 unmodified lines
80 i_size_read(inode), flags);73 i_size_read(inode), flags);
81}74}
82 75
83static inline int cifs_readpage_from_fscache(struct inode *inode,76extern int __cifs_fscache_query_occupancy(struct inode *inode,
84 struct page *page)77 pgoff_t first, unsigned int nr_pages,
85{78 pgoff_t *_data_first,
86 if (CIFS_I(inode)->fscache)79 unsigned int *_data_nr_pages);
87 return __cifs_readpage_from_fscache(inode, page);
88 80
89 return -ENOBUFS;81static inline int cifs_fscache_query_occupancy(struct inode *inode,
82 pgoff_t first, unsigned int nr_pages,
83 pgoff_t *_data_first,
84 unsigned int *_data_nr_pages)
85{
86 if (!cifs_inode_cookie(inode))
87 return -ENOBUFS;
88 return __cifs_fscache_query_occupancy(inode, first, nr_pages,
89 _data_first, _data_nr_pages);
90}90}
91 91
92static inline int cifs_readpages_from_fscache(struct inode *inode,92extern int __cifs_readpage_from_fscache(struct inode *pinode, struct page *ppage);
93 struct address_space *mapping,93extern void __cifs_readpage_to_fscache(struct inode *pinode, struct page *ppage);
94 struct list_head *pages,94
95 unsigned *nr_pages)95
96static inline int cifs_readpage_from_fscache(struct inode *inode,
97 struct page *page)
96{98{
97 if (CIFS_I(inode)->fscache)99 if (cifs_inode_cookie(inode))
98 return __cifs_readpages_from_fscache(inode, mapping, pages,100 return __cifs_readpage_from_fscache(inode, page);
99 nr_pages);
100 return -ENOBUFS;101 return -ENOBUFS;
101}102}
102 103
103static inline void cifs_readpage_to_fscache(struct inode *inode,104static inline void cifs_readpage_to_fscache(struct inode *inode,
104 struct page *page)105 struct page *page)
105{106{
106 if (PageFsCache(page))107 if (cifs_inode_cookie(inode))
107 __cifs_readpage_to_fscache(inode, page);108 __cifs_readpage_to_fscache(inode, page);
108}109}
109 110
111static inline int cifs_fscache_release_page(struct page *page, gfp_t gfp)
112{
113 if (PageFsCache(page)) {
114 if (current_is_kswapd() || !(gfp & __GFP_FS))
115 return false;
116 wait_on_page_fscache(page);
117 fscache_note_page_release(cifs_inode_cookie(page->mapping->host));
118 }
119 return true;
120}
121
110#else /* CONFIG_CIFS_FSCACHE */122#else /* CONFIG_CIFS_FSCACHE */
111static inline123static inline
112void cifs_fscache_fill_coherency(struct inode *inode,124void cifs_fscache_fill_coherency(struct inode *inode,
@@ -123,22 +135,29 @@ static inline void cifs_fscache_unuse_inode_cookie(struct inode *inode, bool upd · 10 unmodified lines
123static inline struct fscache_cookie *cifs_inode_cookie(struct inode *inode) { return NULL; }135static inline struct fscache_cookie *cifs_inode_cookie(struct inode *inode) { return NULL; }
124static inline void cifs_invalidate_cache(struct inode *inode, unsigned int flags) {}136static inline void cifs_invalidate_cache(struct inode *inode, unsigned int flags) {}
125 137
126static inline int138static inline int cifs_fscache_query_occupancy(struct inode *inode,
127cifs_readpage_from_fscache(struct inode *inode, struct page *page)139 pgoff_t first, unsigned int nr_pages,
140 pgoff_t *_data_first,
141 unsigned int *_data_nr_pages)
128{142{
143 *_data_first = ULONG_MAX;
144 *_data_nr_pages = 0;
129 return -ENOBUFS;145 return -ENOBUFS;
130}146}
131 147
132static inline int cifs_readpages_from_fscache(struct inode *inode,148static inline int
133 struct address_space *mapping,149cifs_readpage_from_fscache(struct inode *inode, struct page *page)
134 struct list_head *pages,
135 unsigned *nr_pages)
136{150{
137 return -ENOBUFS;151 return -ENOBUFS;
138}152}
139 153
140static inline void cifs_readpage_to_fscache(struct inode *inode,154static inline
141 struct page *page) {}155void cifs_readpage_to_fscache(struct inode *inode, struct page *page) {}
156
157static inline int nfs_fscache_release_page(struct page *page, gfp_t gfp)
158{
159 return true; /* May release page */
160}
142 161
143#endif /* CONFIG_CIFS_FSCACHE */162#endif /* CONFIG_CIFS_FSCACHE */
144 163
fs/cifs/inode.c+4−4
@@ -83,6 +83,7 @@ static void cifs_set_ops(struct inode *inode) · 82 unmodified lines
83static void83static void
84cifs_revalidate_cache(struct inode *inode, struct cifs_fattr *fattr)84cifs_revalidate_cache(struct inode *inode, struct cifs_fattr *fattr)
85{85{
86 struct cifs_fscache_inode_coherency_data cd;
86 struct cifsInodeInfo *cifs_i = CIFS_I(inode);87 struct cifsInodeInfo *cifs_i = CIFS_I(inode);
87 88
88 cifs_dbg(FYI, "%s: revalidating inode %llu\n",89 cifs_dbg(FYI, "%s: revalidating inode %llu\n",
@@ -113,6 +114,9 @@ cifs_revalidate_cache(struct inode *inode, struct cifs_fattr *fattr) · 24 unmodified lines
113 cifs_dbg(FYI, "%s: invalidating inode %llu mapping\n",114 cifs_dbg(FYI, "%s: invalidating inode %llu mapping\n",
114 __func__, cifs_i->uniqueid);115 __func__, cifs_i->uniqueid);
115 set_bit(CIFS_INO_INVALID_MAPPING, &cifs_i->flags);116 set_bit(CIFS_INO_INVALID_MAPPING, &cifs_i->flags);
117 /* Invalidate fscache cookie */
118 cifs_fscache_fill_coherency(&cifs_i->vfs_inode, &cd);
119 fscache_invalidate(cifs_inode_cookie(inode), &cd, i_size_read(inode), 0);
116}120}
117 121
118/*122/*
@@ -2261,8 +2265,6 @@ cifs_dentry_needs_reval(struct dentry *dentry) · 2142 unmodified lines
2261int2265int
2262cifs_invalidate_mapping(struct inode *inode)2266cifs_invalidate_mapping(struct inode *inode)
2263{2267{
2264 struct cifs_fscache_inode_coherency_data cd;
2265 struct cifsInodeInfo *cifsi = CIFS_I(inode);
2266 int rc = 0;2268 int rc = 0;
2267 2269
2268 if (inode->i_mapping && inode->i_mapping->nrpages != 0) {2270 if (inode->i_mapping && inode->i_mapping->nrpages != 0) {
@@ -2272,8 +2274,6 @@ cifs_invalidate_mapping(struct inode *inode) · 3 unmodified lines
2272 __func__, inode);2274 __func__, inode);
2273 }2275 }
2274 2276
2275 cifs_fscache_fill_coherency(&cifsi->vfs_inode, &cd);
2276 fscache_invalidate(cifs_inode_cookie(inode), &cd, i_size_read(inode), 0);
2277 return rc;2277 return rc;
2278}2278}
2279 2279
fs/cifs/sess.c+5−1
@@ -713,7 +713,11 @@ static int size_of_ntlmssp_blob(struct cifs_ses *ses, int base_size) · 712 unmodified lines
713 else713 else
714 sz += sizeof(__le16);714 sz += sizeof(__le16);
715 715
716 sz += sizeof(__le16) * strnlen(ses->workstation_name, CIFS_MAX_WORKSTATION_LEN);716 if (ses->workstation_name)
717 sz += sizeof(__le16) * strnlen(ses->workstation_name,
718 CIFS_MAX_WORKSTATION_LEN);
719 else
720 sz += sizeof(__le16);
717 721
718 return sz;722 return sz;
719}723}
fs/erofs/data.c+4−4
@@ -252,12 +252,10 @@ static int erofs_iomap_begin(struct inode *inode, loff_t offset, loff_t length, · 251 unmodified lines
252 return ret;252 return ret;
253 253
254 iomap->offset = map.m_la;254 iomap->offset = map.m_la;
255 if (flags & IOMAP_DAX) {255 if (flags & IOMAP_DAX)
256 iomap->dax_dev = mdev.m_daxdev;256 iomap->dax_dev = mdev.m_daxdev;
257 iomap->offset += mdev.m_dax_part_off;257 else
258 } else {
259 iomap->bdev = mdev.m_bdev;258 iomap->bdev = mdev.m_bdev;
260 }
261 iomap->length = map.m_llen;259 iomap->length = map.m_llen;
262 iomap->flags = 0;260 iomap->flags = 0;
263 iomap->private = NULL;261 iomap->private = NULL;
@@ -284,6 +282,8 @@ static int erofs_iomap_begin(struct inode *inode, loff_t offset, loff_t length, · 20 unmodified lines
284 } else {282 } else {
285 iomap->type = IOMAP_MAPPED;283 iomap->type = IOMAP_MAPPED;
286 iomap->addr = mdev.m_pa;284 iomap->addr = mdev.m_pa;
285 if (flags & IOMAP_DAX)
286 iomap->addr += mdev.m_dax_part_off;
287 }287 }
288 return 0;288 return 0;
289}289}
fs/erofs/zdata.c+56−57
@@ -810,68 +810,11 @@ static bool z_erofs_get_sync_decompress_policy(struct erofs_sb_info *sbi, · 809 unmodified lines
810 return false;810 return false;
811}811}
812 812
813static void z_erofs_decompressqueue_work(struct work_struct *work);
814static void z_erofs_decompress_kickoff(struct z_erofs_decompressqueue *io,
815 bool sync, int bios)
816{
817 struct erofs_sb_info *const sbi = EROFS_SB(io->sb);
818
819 /* wake up the caller thread for sync decompression */
820 if (sync) {
821 unsigned long flags;
822
823 spin_lock_irqsave(&io->u.wait.lock, flags);
824 if (!atomic_add_return(bios, &io->pending_bios))
825 wake_up_locked(&io->u.wait);
826 spin_unlock_irqrestore(&io->u.wait.lock, flags);
827 return;
828 }
829
830 if (atomic_add_return(bios, &io->pending_bios))
831 return;
832 /* Use workqueue and sync decompression for atomic contexts only */
833 if (in_atomic() || irqs_disabled()) {
834 queue_work(z_erofs_workqueue, &io->u.work);
835 /* enable sync decompression for readahead */
836 if (sbi->opt.sync_decompress == EROFS_SYNC_DECOMPRESS_AUTO)
837 sbi->opt.sync_decompress = EROFS_SYNC_DECOMPRESS_FORCE_ON;
838 return;
839 }
840 z_erofs_decompressqueue_work(&io->u.work);
841}
842
843static bool z_erofs_page_is_invalidated(struct page *page)813static bool z_erofs_page_is_invalidated(struct page *page)
844{814{
845 return !page->mapping && !z_erofs_is_shortlived_page(page);815 return !page->mapping && !z_erofs_is_shortlived_page(page);
846}816}
847 817
848static void z_erofs_decompressqueue_endio(struct bio *bio)
849{
850 tagptr1_t t = tagptr_init(tagptr1_t, bio->bi_private);
851 struct z_erofs_decompressqueue *q = tagptr_unfold_ptr(t);
852 blk_status_t err = bio->bi_status;
853 struct bio_vec *bvec;
854 struct bvec_iter_all iter_all;
855
856 bio_for_each_segment_all(bvec, bio, iter_all) {
857 struct page *page = bvec->bv_page;
858
859 DBG_BUGON(PageUptodate(page));
860 DBG_BUGON(z_erofs_page_is_invalidated(page));
861
862 if (err)
863 SetPageError(page);
864
865 if (erofs_page_is_managed(EROFS_SB(q->sb), page)) {
866 if (!err)
867 SetPageUptodate(page);
868 unlock_page(page);
869 }
870 }
871 z_erofs_decompress_kickoff(q, tagptr_unfold_tags(t), -1);
872 bio_put(bio);
873}
874
875static int z_erofs_decompress_pcluster(struct super_block *sb,818static int z_erofs_decompress_pcluster(struct super_block *sb,
876 struct z_erofs_pcluster *pcl,819 struct z_erofs_pcluster *pcl,
877 struct page **pagepool)820 struct page **pagepool)
@@ -1123,6 +1066,35 @@ static void z_erofs_decompressqueue_work(struct work_struct *work) · 245 unmodified lines
1123 kvfree(bgq);1066 kvfree(bgq);
1124}1067}
1125 1068
1069static void z_erofs_decompress_kickoff(struct z_erofs_decompressqueue *io,
1070 bool sync, int bios)
1071{
1072 struct erofs_sb_info *const sbi = EROFS_SB(io->sb);
1073
1074 /* wake up the caller thread for sync decompression */
1075 if (sync) {
1076 unsigned long flags;
1077
1078 spin_lock_irqsave(&io->u.wait.lock, flags);
1079 if (!atomic_add_return(bios, &io->pending_bios))
1080 wake_up_locked(&io->u.wait);
1081 spin_unlock_irqrestore(&io->u.wait.lock, flags);
1082 return;
1083 }
1084
1085 if (atomic_add_return(bios, &io->pending_bios))
1086 return;
1087 /* Use workqueue and sync decompression for atomic contexts only */
1088 if (in_atomic() || irqs_disabled()) {
1089 queue_work(z_erofs_workqueue, &io->u.work);
1090 /* enable sync decompression for readahead */
1091 if (sbi->opt.sync_decompress == EROFS_SYNC_DECOMPRESS_AUTO)
1092 sbi->opt.sync_decompress = EROFS_SYNC_DECOMPRESS_FORCE_ON;
1093 return;
1094 }
1095 z_erofs_decompressqueue_work(&io->u.work);
1096}
1097
1126static struct page *pickup_page_for_submission(struct z_erofs_pcluster *pcl,1098static struct page *pickup_page_for_submission(struct z_erofs_pcluster *pcl,
1127 unsigned int nr,1099 unsigned int nr,
1128 struct page **pagepool,1100 struct page **pagepool,
@@ -1300,6 +1272,33 @@ static void move_to_bypass_jobqueue(struct z_erofs_pcluster *pcl, · 171 unmodified lines
1300 qtail[JQ_BYPASS] = &pcl->next;1272 qtail[JQ_BYPASS] = &pcl->next;
1301}1273}
1302 1274
1275static void z_erofs_decompressqueue_endio(struct bio *bio)
1276{
1277 tagptr1_t t = tagptr_init(tagptr1_t, bio->bi_private);
1278 struct z_erofs_decompressqueue *q = tagptr_unfold_ptr(t);
1279 blk_status_t err = bio->bi_status;
1280 struct bio_vec *bvec;
1281 struct bvec_iter_all iter_all;
1282
1283 bio_for_each_segment_all(bvec, bio, iter_all) {
1284 struct page *page = bvec->bv_page;
1285
1286 DBG_BUGON(PageUptodate(page));
1287 DBG_BUGON(z_erofs_page_is_invalidated(page));
1288
1289 if (err)
1290 SetPageError(page);
1291
1292 if (erofs_page_is_managed(EROFS_SB(q->sb), page)) {
1293 if (!err)
1294 SetPageUptodate(page);
1295 unlock_page(page);
1296 }
1297 }
1298 z_erofs_decompress_kickoff(q, tagptr_unfold_tags(t), -1);
1299 bio_put(bio);
1300}
1301
1303static void z_erofs_submit_queue(struct super_block *sb,1302static void z_erofs_submit_queue(struct super_block *sb,
1304 struct z_erofs_decompress_frontend *f,1303 struct z_erofs_decompress_frontend *f,
1305 struct page **pagepool,1304 struct page **pagepool,
fs/erofs/zmap.c+7−0
@@ -630,6 +630,13 @@ static int z_erofs_do_map_blocks(struct inode *inode, · 629 unmodified lines
630 if (endoff >= m.clusterofs) {630 if (endoff >= m.clusterofs) {
631 m.headtype = m.type;631 m.headtype = m.type;
632 map->m_la = (m.lcn << lclusterbits) | m.clusterofs;632 map->m_la = (m.lcn << lclusterbits) | m.clusterofs;
633 /*
634 * For ztailpacking files, in order to inline data more
635 * effectively, special EOF lclusters are now supported
636 * which can have three parts at most.
637 */
638 if (ztailpacking && end > inode->i_size)
639 end = inode->i_size;
633 break;640 break;
634 }641 }
635 /* m.lcn should be >= 1 if endoff < m.clusterofs */642 /* m.lcn should be >= 1 if endoff < m.clusterofs */
fs/ext4/ext4.h+7−7
@@ -2485,7 +2485,7 @@ struct ext4_filename { · 2484 unmodified lines
2485#ifdef CONFIG_FS_ENCRYPTION2485#ifdef CONFIG_FS_ENCRYPTION
2486 struct fscrypt_str crypto_buf;2486 struct fscrypt_str crypto_buf;
2487#endif2487#endif
2488#ifdef CONFIG_UNICODE2488#if IS_ENABLED(CONFIG_UNICODE)
2489 struct fscrypt_str cf_name;2489 struct fscrypt_str cf_name;
2490#endif2490#endif
2491};2491};
@@ -2721,7 +2721,7 @@ extern unsigned ext4_free_clusters_after_init(struct super_block *sb, · 229 unmodified lines
2721 struct ext4_group_desc *gdp);2721 struct ext4_group_desc *gdp);
2722ext4_fsblk_t ext4_inode_to_goal_block(struct inode *);2722ext4_fsblk_t ext4_inode_to_goal_block(struct inode *);
2723 2723
2724#ifdef CONFIG_UNICODE2724#if IS_ENABLED(CONFIG_UNICODE)
2725extern int ext4_fname_setup_ci_filename(struct inode *dir,2725extern int ext4_fname_setup_ci_filename(struct inode *dir,
2726 const struct qstr *iname,2726 const struct qstr *iname,
2727 struct ext4_filename *fname);2727 struct ext4_filename *fname);
@@ -2754,7 +2754,7 @@ static inline int ext4_fname_setup_filename(struct inode *dir, · 26 unmodified lines
2754 2754
2755 ext4_fname_from_fscrypt_name(fname, &name);2755 ext4_fname_from_fscrypt_name(fname, &name);
2756 2756
2757#ifdef CONFIG_UNICODE2757#if IS_ENABLED(CONFIG_UNICODE)
2758 err = ext4_fname_setup_ci_filename(dir, iname, fname);2758 err = ext4_fname_setup_ci_filename(dir, iname, fname);
2759#endif2759#endif
2760 return err;2760 return err;
@@ -2773,7 +2773,7 @@ static inline int ext4_fname_prepare_lookup(struct inode *dir, · 12 unmodified lines
2773 2773
2774 ext4_fname_from_fscrypt_name(fname, &name);2774 ext4_fname_from_fscrypt_name(fname, &name);
2775 2775
2776#ifdef CONFIG_UNICODE2776#if IS_ENABLED(CONFIG_UNICODE)
2777 err = ext4_fname_setup_ci_filename(dir, &dentry->d_name, fname);2777 err = ext4_fname_setup_ci_filename(dir, &dentry->d_name, fname);
2778#endif2778#endif
2779 return err;2779 return err;
@@ -2790,7 +2790,7 @@ static inline void ext4_fname_free_filename(struct ext4_filename *fname) · 10 unmodified lines
2790 fname->usr_fname = NULL;2790 fname->usr_fname = NULL;
2791 fname->disk_name.name = NULL;2791 fname->disk_name.name = NULL;
2792 2792
2793#ifdef CONFIG_UNICODE2793#if IS_ENABLED(CONFIG_UNICODE)
2794 kfree(fname->cf_name.name);2794 kfree(fname->cf_name.name);
2795 fname->cf_name.name = NULL;2795 fname->cf_name.name = NULL;
2796#endif2796#endif
@@ -2806,7 +2806,7 @@ static inline int ext4_fname_setup_filename(struct inode *dir, · 9 unmodified lines
2806 fname->disk_name.name = (unsigned char *) iname->name;2806 fname->disk_name.name = (unsigned char *) iname->name;
2807 fname->disk_name.len = iname->len;2807 fname->disk_name.len = iname->len;
2808 2808
2809#ifdef CONFIG_UNICODE2809#if IS_ENABLED(CONFIG_UNICODE)
2810 err = ext4_fname_setup_ci_filename(dir, iname, fname);2810 err = ext4_fname_setup_ci_filename(dir, iname, fname);
2811#endif2811#endif
2812 2812
@@ -2822,7 +2822,7 @@ static inline int ext4_fname_prepare_lookup(struct inode *dir, · 9 unmodified lines
2822 2822
2823static inline void ext4_fname_free_filename(struct ext4_filename *fname)2823static inline void ext4_fname_free_filename(struct ext4_filename *fname)
2824{2824{
2825#ifdef CONFIG_UNICODE2825#if IS_ENABLED(CONFIG_UNICODE)
2826 kfree(fname->cf_name.name);2826 kfree(fname->cf_name.name);
2827 fname->cf_name.name = NULL;2827 fname->cf_name.name = NULL;
2828#endif2828#endif
fs/ext4/hash.c+1−1
@@ -290,7 +290,7 @@ static int __ext4fs_dirhash(const struct inode *dir, const char *name, int len, · 289 unmodified lines
290int ext4fs_dirhash(const struct inode *dir, const char *name, int len,290int ext4fs_dirhash(const struct inode *dir, const char *name, int len,
291 struct dx_hash_info *hinfo)291 struct dx_hash_info *hinfo)
292{292{
293#ifdef CONFIG_UNICODE293#if IS_ENABLED(CONFIG_UNICODE)
294 const struct unicode_map *um = dir->i_sb->s_encoding;294 const struct unicode_map *um = dir->i_sb->s_encoding;
295 int r, dlen;295 int r, dlen;
296 unsigned char *buff;296 unsigned char *buff;
fs/ext4/namei.c+6−6
@@ -1317,7 +1317,7 @@ static void dx_insert_block(struct dx_frame *frame, u32 hash, ext4_lblk_t block) · 1316 unmodified lines
1317 dx_set_count(entries, count + 1);1317 dx_set_count(entries, count + 1);
1318}1318}
1319 1319
1320#ifdef CONFIG_UNICODE1320#if IS_ENABLED(CONFIG_UNICODE)
1321/*1321/*
1322 * Test whether a case-insensitive directory entry matches the filename1322 * Test whether a case-insensitive directory entry matches the filename
1323 * being searched for. If quick is set, assume the name being looked up1323 * being searched for. If quick is set, assume the name being looked up
@@ -1428,7 +1428,7 @@ static bool ext4_match(struct inode *parent, · 104 unmodified lines
1428 f.crypto_buf = fname->crypto_buf;1428 f.crypto_buf = fname->crypto_buf;
1429#endif1429#endif
1430 1430
1431#ifdef CONFIG_UNICODE1431#if IS_ENABLED(CONFIG_UNICODE)
1432 if (parent->i_sb->s_encoding && IS_CASEFOLDED(parent) &&1432 if (parent->i_sb->s_encoding && IS_CASEFOLDED(parent) &&
1433 (!IS_ENCRYPTED(parent) || fscrypt_has_encryption_key(parent))) {1433 (!IS_ENCRYPTED(parent) || fscrypt_has_encryption_key(parent))) {
1434 if (fname->cf_name.name) {1434 if (fname->cf_name.name) {
@@ -1800,7 +1800,7 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsi · 365 unmodified lines
1800 }1800 }
1801 }1801 }
1802 1802
1803#ifdef CONFIG_UNICODE1803#if IS_ENABLED(CONFIG_UNICODE)
1804 if (!inode && IS_CASEFOLDED(dir)) {1804 if (!inode && IS_CASEFOLDED(dir)) {
1805 /* Eventually we want to call d_add_ci(dentry, NULL)1805 /* Eventually we want to call d_add_ci(dentry, NULL)
1806 * for negative dentries in the encoding case as1806 * for negative dentries in the encoding case as
@@ -2308,7 +2308,7 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry, · 501 unmodified lines
2308 if (fscrypt_is_nokey_name(dentry))2308 if (fscrypt_is_nokey_name(dentry))
2309 return -ENOKEY;2309 return -ENOKEY;
2310 2310
2311#ifdef CONFIG_UNICODE2311#if IS_ENABLED(CONFIG_UNICODE)
2312 if (sb_has_strict_encoding(sb) && IS_CASEFOLDED(dir) &&2312 if (sb_has_strict_encoding(sb) && IS_CASEFOLDED(dir) &&
2313 sb->s_encoding && utf8_validate(sb->s_encoding, &dentry->d_name))2313 sb->s_encoding && utf8_validate(sb->s_encoding, &dentry->d_name))
2314 return -EINVAL;2314 return -EINVAL;
@@ -3126,7 +3126,7 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry) · 811 unmodified lines
3126 ext4_fc_track_unlink(handle, dentry);3126 ext4_fc_track_unlink(handle, dentry);
3127 retval = ext4_mark_inode_dirty(handle, dir);3127 retval = ext4_mark_inode_dirty(handle, dir);
3128 3128
3129#ifdef CONFIG_UNICODE3129#if IS_ENABLED(CONFIG_UNICODE)
3130 /* VFS negative dentries are incompatible with Encoding and3130 /* VFS negative dentries are incompatible with Encoding and
3131 * Case-insensitiveness. Eventually we'll want avoid3131 * Case-insensitiveness. Eventually we'll want avoid
3132 * invalidating the dentries here, alongside with returning the3132 * invalidating the dentries here, alongside with returning the
@@ -3231,7 +3231,7 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry) · 98 unmodified lines
3231 retval = __ext4_unlink(handle, dir, &dentry->d_name, d_inode(dentry));3231 retval = __ext4_unlink(handle, dir, &dentry->d_name, d_inode(dentry));
3232 if (!retval)3232 if (!retval)
3233 ext4_fc_track_unlink(handle, dentry);3233 ext4_fc_track_unlink(handle, dentry);
3234#ifdef CONFIG_UNICODE3234#if IS_ENABLED(CONFIG_UNICODE)
3235 /* VFS negative dentries are incompatible with Encoding and3235 /* VFS negative dentries are incompatible with Encoding and
3236 * Case-insensitiveness. Eventually we'll want avoid3236 * Case-insensitiveness. Eventually we'll want avoid
3237 * invalidating the dentries here, alongside with returning the3237 * invalidating the dentries here, alongside with returning the
fs/ext4/super.c+5−5
@@ -1301,7 +1301,7 @@ static void ext4_put_super(struct super_block *sb) · 1300 unmodified lines
1301 kfree(sbi->s_blockgroup_lock);1301 kfree(sbi->s_blockgroup_lock);
1302 fs_put_dax(sbi->s_daxdev);1302 fs_put_dax(sbi->s_daxdev);
1303 fscrypt_free_dummy_policy(&sbi->s_dummy_enc_policy);1303 fscrypt_free_dummy_policy(&sbi->s_dummy_enc_policy);
1304#ifdef CONFIG_UNICODE1304#if IS_ENABLED(CONFIG_UNICODE)
1305 utf8_unload(sb->s_encoding);1305 utf8_unload(sb->s_encoding);
1306#endif1306#endif
1307 kfree(sbi);1307 kfree(sbi);
@@ -1961,7 +1961,7 @@ static const struct mount_opts { · 653 unmodified lines
1961 {Opt_err, 0, 0}1961 {Opt_err, 0, 0}
1962};1962};
1963 1963
1964#ifdef CONFIG_UNICODE1964#if IS_ENABLED(CONFIG_UNICODE)
1965static const struct ext4_sb_encodings {1965static const struct ext4_sb_encodings {
1966 __u16 magic;1966 __u16 magic;
1967 char *name;1967 char *name;
@@ -3606,7 +3606,7 @@ int ext4_feature_set_ok(struct super_block *sb, int readonly) · 1638 unmodified lines
3606 return 0;3606 return 0;
3607 }3607 }
3608 3608
3609#ifndef CONFIG_UNICODE3609#if !IS_ENABLED(CONFIG_UNICODE)
3610 if (ext4_has_feature_casefold(sb)) {3610 if (ext4_has_feature_casefold(sb)) {
3611 ext4_msg(sb, KERN_ERR,3611 ext4_msg(sb, KERN_ERR,
3612 "Filesystem with casefold feature cannot be "3612 "Filesystem with casefold feature cannot be "
@@ -4610,7 +4610,7 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb) · 997 unmodified lines
4610 if (err < 0)4610 if (err < 0)
4611 goto failed_mount;4611 goto failed_mount;
4612 4612
4613#ifdef CONFIG_UNICODE4613#if IS_ENABLED(CONFIG_UNICODE)
4614 if (ext4_has_feature_casefold(sb) && !sb->s_encoding) {4614 if (ext4_has_feature_casefold(sb) && !sb->s_encoding) {
4615 const struct ext4_sb_encodings *encoding_info;4615 const struct ext4_sb_encodings *encoding_info;
4616 struct unicode_map *encoding;4616 struct unicode_map *encoding;
@@ -5514,7 +5514,7 @@ failed_mount: · 897 unmodified lines
5514 if (sbi->s_chksum_driver)5514 if (sbi->s_chksum_driver)
5515 crypto_free_shash(sbi->s_chksum_driver);5515 crypto_free_shash(sbi->s_chksum_driver);
5516 5516
5517#ifdef CONFIG_UNICODE5517#if IS_ENABLED(CONFIG_UNICODE)
5518 utf8_unload(sb->s_encoding);5518 utf8_unload(sb->s_encoding);
5519#endif5519#endif
5520 5520
fs/ext4/sysfs.c+4−4
@@ -309,7 +309,7 @@ EXT4_ATTR_FEATURE(meta_bg_resize); · 308 unmodified lines
309EXT4_ATTR_FEATURE(encryption);309EXT4_ATTR_FEATURE(encryption);
310EXT4_ATTR_FEATURE(test_dummy_encryption_v2);310EXT4_ATTR_FEATURE(test_dummy_encryption_v2);
311#endif311#endif
312#ifdef CONFIG_UNICODE312#if IS_ENABLED(CONFIG_UNICODE)
313EXT4_ATTR_FEATURE(casefold);313EXT4_ATTR_FEATURE(casefold);
314#endif314#endif
315#ifdef CONFIG_FS_VERITY315#ifdef CONFIG_FS_VERITY
@@ -317,7 +317,7 @@ EXT4_ATTR_FEATURE(verity); · 1 unmodified line
317#endif317#endif
318EXT4_ATTR_FEATURE(metadata_csum_seed);318EXT4_ATTR_FEATURE(metadata_csum_seed);
319EXT4_ATTR_FEATURE(fast_commit);319EXT4_ATTR_FEATURE(fast_commit);
320#if defined(CONFIG_UNICODE) && defined(CONFIG_FS_ENCRYPTION)320#if IS_ENABLED(CONFIG_UNICODE) && defined(CONFIG_FS_ENCRYPTION)
321EXT4_ATTR_FEATURE(encrypted_casefold);321EXT4_ATTR_FEATURE(encrypted_casefold);
322#endif322#endif
323 323
@@ -329,7 +329,7 @@ static struct attribute *ext4_feat_attrs[] = { · 5 unmodified lines
329 ATTR_LIST(encryption),329 ATTR_LIST(encryption),
330 ATTR_LIST(test_dummy_encryption_v2),330 ATTR_LIST(test_dummy_encryption_v2),
331#endif331#endif
332#ifdef CONFIG_UNICODE332#if IS_ENABLED(CONFIG_UNICODE)
333 ATTR_LIST(casefold),333 ATTR_LIST(casefold),
334#endif334#endif
335#ifdef CONFIG_FS_VERITY335#ifdef CONFIG_FS_VERITY
@@ -337,7 +337,7 @@ static struct attribute *ext4_feat_attrs[] = { · 1 unmodified line
337#endif337#endif
338 ATTR_LIST(metadata_csum_seed),338 ATTR_LIST(metadata_csum_seed),
339 ATTR_LIST(fast_commit),339 ATTR_LIST(fast_commit),
340#if defined(CONFIG_UNICODE) && defined(CONFIG_FS_ENCRYPTION)340#if IS_ENABLED(CONFIG_UNICODE) && defined(CONFIG_FS_ENCRYPTION)
341 ATTR_LIST(encrypted_casefold),341 ATTR_LIST(encrypted_casefold),
342#endif342#endif
343 NULL,343 NULL,
fs/f2fs/dir.c+5−5
@@ -16,7 +16,7 @@ · 15 unmodified lines
16#include "xattr.h"16#include "xattr.h"
17#include <trace/events/f2fs.h>17#include <trace/events/f2fs.h>
18 18
19#ifdef CONFIG_UNICODE19#if IS_ENABLED(CONFIG_UNICODE)
20extern struct kmem_cache *f2fs_cf_name_slab;20extern struct kmem_cache *f2fs_cf_name_slab;
21#endif21#endif
22 22
@@ -79,7 +79,7 @@ unsigned char f2fs_get_de_type(struct f2fs_dir_entry *de) · 56 unmodified lines
79int f2fs_init_casefolded_name(const struct inode *dir,79int f2fs_init_casefolded_name(const struct inode *dir,
80 struct f2fs_filename *fname)80 struct f2fs_filename *fname)
81{81{
82#ifdef CONFIG_UNICODE82#if IS_ENABLED(CONFIG_UNICODE)
83 struct super_block *sb = dir->i_sb;83 struct super_block *sb = dir->i_sb;
84 84
85 if (IS_CASEFOLDED(dir)) {85 if (IS_CASEFOLDED(dir)) {
@@ -174,7 +174,7 @@ void f2fs_free_filename(struct f2fs_filename *fname) · 88 unmodified lines
174 kfree(fname->crypto_buf.name);174 kfree(fname->crypto_buf.name);
175 fname->crypto_buf.name = NULL;175 fname->crypto_buf.name = NULL;
176#endif176#endif
177#ifdef CONFIG_UNICODE177#if IS_ENABLED(CONFIG_UNICODE)
178 if (fname->cf_name.name) {178 if (fname->cf_name.name) {
179 kmem_cache_free(f2fs_cf_name_slab, fname->cf_name.name);179 kmem_cache_free(f2fs_cf_name_slab, fname->cf_name.name);
180 fname->cf_name.name = NULL;180 fname->cf_name.name = NULL;
@@ -208,7 +208,7 @@ static struct f2fs_dir_entry *find_in_block(struct inode *dir, · 27 unmodified lines
208 return f2fs_find_target_dentry(&d, fname, max_slots);208 return f2fs_find_target_dentry(&d, fname, max_slots);
209}209}
210 210
211#ifdef CONFIG_UNICODE211#if IS_ENABLED(CONFIG_UNICODE)
212/*212/*
213 * Test whether a case-insensitive directory entry matches the filename213 * Test whether a case-insensitive directory entry matches the filename
214 * being searched for.214 * being searched for.
@@ -266,7 +266,7 @@ static inline int f2fs_match_name(const struct inode *dir, · 51 unmodified lines
266{266{
267 struct fscrypt_name f;267 struct fscrypt_name f;
268 268
269#ifdef CONFIG_UNICODE269#if IS_ENABLED(CONFIG_UNICODE)
270 if (fname->cf_name.name) {270 if (fname->cf_name.name) {
271 struct qstr cf = FSTR_TO_QSTR(&fname->cf_name);271 struct qstr cf = FSTR_TO_QSTR(&fname->cf_name);
272 272
fs/f2fs/f2fs.h+1−1
@@ -488,7 +488,7 @@ struct f2fs_filename { · 487 unmodified lines
488 */488 */
489 struct fscrypt_str crypto_buf;489 struct fscrypt_str crypto_buf;
490#endif490#endif
491#ifdef CONFIG_UNICODE491#if IS_ENABLED(CONFIG_UNICODE)
492 /*492 /*
493 * For casefolded directories: the casefolded name, but it's left NULL493 * For casefolded directories: the casefolded name, but it's left NULL
494 * if the original name is not valid Unicode, if the directory is both494 * if the original name is not valid Unicode, if the directory is both
fs/f2fs/hash.c+1−1
@@ -105,7 +105,7 @@ void f2fs_hash_filename(const struct inode *dir, struct f2fs_filename *fname) · 104 unmodified lines
105 return;105 return;
106 }106 }
107 107
108#ifdef CONFIG_UNICODE108#if IS_ENABLED(CONFIG_UNICODE)
109 if (IS_CASEFOLDED(dir)) {109 if (IS_CASEFOLDED(dir)) {
110 /*110 /*
111 * If the casefolded name is provided, hash it instead of the111 * If the casefolded name is provided, hash it instead of the
fs/f2fs/namei.c+2−2
@@ -561,7 +561,7 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry, · 560 unmodified lines
561 goto out_iput;561 goto out_iput;
562 }562 }
563out_splice:563out_splice:
564#ifdef CONFIG_UNICODE564#if IS_ENABLED(CONFIG_UNICODE)
565 if (!inode && IS_CASEFOLDED(dir)) {565 if (!inode && IS_CASEFOLDED(dir)) {
566 /* Eventually we want to call d_add_ci(dentry, NULL)566 /* Eventually we want to call d_add_ci(dentry, NULL)
567 * for negative dentries in the encoding case as567 * for negative dentries in the encoding case as
@@ -622,7 +622,7 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry) · 54 unmodified lines
622 goto fail;622 goto fail;
623 }623 }
624 f2fs_delete_entry(de, page, dir, inode);624 f2fs_delete_entry(de, page, dir, inode);
625#ifdef CONFIG_UNICODE625#if IS_ENABLED(CONFIG_UNICODE)
626 /* VFS negative dentries are incompatible with Encoding and626 /* VFS negative dentries are incompatible with Encoding and
627 * Case-insensitiveness. Eventually we'll want avoid627 * Case-insensitiveness. Eventually we'll want avoid
628 * invalidating the dentries here, alongside with returning the628 * invalidating the dentries here, alongside with returning the
fs/f2fs/recovery.c+2−2
@@ -46,7 +46,7 @@ · 45 unmodified lines
46 46
47static struct kmem_cache *fsync_entry_slab;47static struct kmem_cache *fsync_entry_slab;
48 48
49#ifdef CONFIG_UNICODE49#if IS_ENABLED(CONFIG_UNICODE)
50extern struct kmem_cache *f2fs_cf_name_slab;50extern struct kmem_cache *f2fs_cf_name_slab;
51#endif51#endif
52 52
@@ -149,7 +149,7 @@ static int init_recovered_filename(const struct inode *dir, · 96 unmodified lines
149 if (err)149 if (err)
150 return err;150 return err;
151 f2fs_hash_filename(dir, fname);151 f2fs_hash_filename(dir, fname);
152#ifdef CONFIG_UNICODE152#if IS_ENABLED(CONFIG_UNICODE)
153 /* Case-sensitive match is fine for recovery */153 /* Case-sensitive match is fine for recovery */
154 kmem_cache_free(f2fs_cf_name_slab, fname->cf_name.name);154 kmem_cache_free(f2fs_cf_name_slab, fname->cf_name.name);
155 fname->cf_name.name = NULL;155 fname->cf_name.name = NULL;
fs/f2fs/super.c+5−5
@@ -257,7 +257,7 @@ void f2fs_printk(struct f2fs_sb_info *sbi, const char *fmt, ...) · 256 unmodified lines
257 va_end(args);257 va_end(args);
258}258}
259 259
260#ifdef CONFIG_UNICODE260#if IS_ENABLED(CONFIG_UNICODE)
261static const struct f2fs_sb_encodings {261static const struct f2fs_sb_encodings {
262 __u16 magic;262 __u16 magic;
263 char *name;263 char *name;
@@ -1259,7 +1259,7 @@ default_check: · 995 unmodified lines
1259 return -EINVAL;1259 return -EINVAL;
1260 }1260 }
1261#endif1261#endif
1262#ifndef CONFIG_UNICODE1262#if !IS_ENABLED(CONFIG_UNICODE)
1263 if (f2fs_sb_has_casefold(sbi)) {1263 if (f2fs_sb_has_casefold(sbi)) {
1264 f2fs_err(sbi,1264 f2fs_err(sbi,
1265 "Filesystem with casefold feature cannot be mounted without CONFIG_UNICODE");1265 "Filesystem with casefold feature cannot be mounted without CONFIG_UNICODE");
@@ -1619,7 +1619,7 @@ static void f2fs_put_super(struct super_block *sb) · 353 unmodified lines
1619 f2fs_destroy_iostat(sbi);1619 f2fs_destroy_iostat(sbi);
1620 for (i = 0; i < NR_PAGE_TYPE; i++)1620 for (i = 0; i < NR_PAGE_TYPE; i++)
1621 kvfree(sbi->write_io[i]);1621 kvfree(sbi->write_io[i]);
1622#ifdef CONFIG_UNICODE1622#if IS_ENABLED(CONFIG_UNICODE)
1623 utf8_unload(sb->s_encoding);1623 utf8_unload(sb->s_encoding);
1624#endif1624#endif
1625 kfree(sbi);1625 kfree(sbi);
@@ -3903,7 +3903,7 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi) · 2277 unmodified lines
3903 3903
3904static int f2fs_setup_casefold(struct f2fs_sb_info *sbi)3904static int f2fs_setup_casefold(struct f2fs_sb_info *sbi)
3905{3905{
3906#ifdef CONFIG_UNICODE3906#if IS_ENABLED(CONFIG_UNICODE)
3907 if (f2fs_sb_has_casefold(sbi) && !sbi->sb->s_encoding) {3907 if (f2fs_sb_has_casefold(sbi) && !sbi->sb->s_encoding) {
3908 const struct f2fs_sb_encodings *encoding_info;3908 const struct f2fs_sb_encodings *encoding_info;
3909 struct unicode_map *encoding;3909 struct unicode_map *encoding;
@@ -4458,7 +4458,7 @@ free_bio_info: · 548 unmodified lines
4458 for (i = 0; i < NR_PAGE_TYPE; i++)4458 for (i = 0; i < NR_PAGE_TYPE; i++)
4459 kvfree(sbi->write_io[i]);4459 kvfree(sbi->write_io[i]);
4460 4460
4461#ifdef CONFIG_UNICODE4461#if IS_ENABLED(CONFIG_UNICODE)
4462 utf8_unload(sb->s_encoding);4462 utf8_unload(sb->s_encoding);
4463 sb->s_encoding = NULL;4463 sb->s_encoding = NULL;
4464#endif4464#endif
fs/f2fs/sysfs.c+5−5
@@ -201,7 +201,7 @@ static ssize_t unusable_show(struct f2fs_attr *a, · 200 unmodified lines
201static ssize_t encoding_show(struct f2fs_attr *a,201static ssize_t encoding_show(struct f2fs_attr *a,
202 struct f2fs_sb_info *sbi, char *buf)202 struct f2fs_sb_info *sbi, char *buf)
203{203{
204#ifdef CONFIG_UNICODE204#if IS_ENABLED(CONFIG_UNICODE)
205 struct super_block *sb = sbi->sb;205 struct super_block *sb = sbi->sb;
206 206
207 if (f2fs_sb_has_casefold(sbi))207 if (f2fs_sb_has_casefold(sbi))
@@ -778,7 +778,7 @@ F2FS_GENERAL_RO_ATTR(avg_vblocks); · 570 unmodified lines
778#ifdef CONFIG_FS_ENCRYPTION778#ifdef CONFIG_FS_ENCRYPTION
779F2FS_FEATURE_RO_ATTR(encryption);779F2FS_FEATURE_RO_ATTR(encryption);
780F2FS_FEATURE_RO_ATTR(test_dummy_encryption_v2);780F2FS_FEATURE_RO_ATTR(test_dummy_encryption_v2);
781#ifdef CONFIG_UNICODE781#if IS_ENABLED(CONFIG_UNICODE)
782F2FS_FEATURE_RO_ATTR(encrypted_casefold);782F2FS_FEATURE_RO_ATTR(encrypted_casefold);
783#endif783#endif
784#endif /* CONFIG_FS_ENCRYPTION */784#endif /* CONFIG_FS_ENCRYPTION */
@@ -797,7 +797,7 @@ F2FS_FEATURE_RO_ATTR(lost_found); · 12 unmodified lines
797F2FS_FEATURE_RO_ATTR(verity);797F2FS_FEATURE_RO_ATTR(verity);
798#endif798#endif
799F2FS_FEATURE_RO_ATTR(sb_checksum);799F2FS_FEATURE_RO_ATTR(sb_checksum);
800#ifdef CONFIG_UNICODE800#if IS_ENABLED(CONFIG_UNICODE)
801F2FS_FEATURE_RO_ATTR(casefold);801F2FS_FEATURE_RO_ATTR(casefold);
802#endif802#endif
803F2FS_FEATURE_RO_ATTR(readonly);803F2FS_FEATURE_RO_ATTR(readonly);
@@ -910,7 +910,7 @@ static struct attribute *f2fs_feat_attrs[] = { · 106 unmodified lines
910#ifdef CONFIG_FS_ENCRYPTION910#ifdef CONFIG_FS_ENCRYPTION
911 ATTR_LIST(encryption),911 ATTR_LIST(encryption),
912 ATTR_LIST(test_dummy_encryption_v2),912 ATTR_LIST(test_dummy_encryption_v2),
913#ifdef CONFIG_UNICODE913#if IS_ENABLED(CONFIG_UNICODE)
914 ATTR_LIST(encrypted_casefold),914 ATTR_LIST(encrypted_casefold),
915#endif915#endif
916#endif /* CONFIG_FS_ENCRYPTION */916#endif /* CONFIG_FS_ENCRYPTION */
@@ -929,7 +929,7 @@ static struct attribute *f2fs_feat_attrs[] = { · 12 unmodified lines
929 ATTR_LIST(verity),929 ATTR_LIST(verity),
930#endif930#endif
931 ATTR_LIST(sb_checksum),931 ATTR_LIST(sb_checksum),
932#ifdef CONFIG_UNICODE932#if IS_ENABLED(CONFIG_UNICODE)
933 ATTR_LIST(casefold),933 ATTR_LIST(casefold),
934#endif934#endif
935 ATTR_LIST(readonly),935 ATTR_LIST(readonly),
fs/iomap/buffered-io.c+48−4
@@ -21,6 +21,8 @@ · 20 unmodified lines
21 21
22#include "../internal.h"22#include "../internal.h"
23 23
24#define IOEND_BATCH_SIZE 4096
25
24/*26/*
25 * Structure allocated for each folio when block size < folio size27 * Structure allocated for each folio when block size < folio size
26 * to track sub-folio uptodate status and I/O completions.28 * to track sub-folio uptodate status and I/O completions.
@@ -1039,7 +1041,7 @@ static void iomap_finish_folio_write(struct inode *inode, struct folio *folio, · 1012 unmodified lines
1039 * state, release holds on bios, and finally free up memory. Do not use the1041 * state, release holds on bios, and finally free up memory. Do not use the
1040 * ioend after this.1042 * ioend after this.
1041 */1043 */
1042static void1044static u32
1043iomap_finish_ioend(struct iomap_ioend *ioend, int error)1045iomap_finish_ioend(struct iomap_ioend *ioend, int error)
1044{1046{
1045 struct inode *inode = ioend->io_inode;1047 struct inode *inode = ioend->io_inode;
@@ -1048,6 +1050,7 @@ iomap_finish_ioend(struct iomap_ioend *ioend, int error) · 2 unmodified lines
1048 u64 start = bio->bi_iter.bi_sector;1050 u64 start = bio->bi_iter.bi_sector;
1049 loff_t offset = ioend->io_offset;1051 loff_t offset = ioend->io_offset;
1050 bool quiet = bio_flagged(bio, BIO_QUIET);1052 bool quiet = bio_flagged(bio, BIO_QUIET);
1053 u32 folio_count = 0;
1051 1054
1052 for (bio = &ioend->io_inline_bio; bio; bio = next) {1055 for (bio = &ioend->io_inline_bio; bio; bio = next) {
1053 struct folio_iter fi;1056 struct folio_iter fi;
@@ -1062,9 +1065,11 @@ iomap_finish_ioend(struct iomap_ioend *ioend, int error) · 8 unmodified lines
1062 next = bio->bi_private;1065 next = bio->bi_private;
1063 1066
1064 /* walk all folios in bio, ending page IO on them */1067 /* walk all folios in bio, ending page IO on them */
1065 bio_for_each_folio_all(fi, bio)1068 bio_for_each_folio_all(fi, bio) {
1066 iomap_finish_folio_write(inode, fi.folio, fi.length,1069 iomap_finish_folio_write(inode, fi.folio, fi.length,
1067 error);1070 error);
1071 folio_count++;
1072 }
1068 bio_put(bio);1073 bio_put(bio);
1069 }1074 }
1070 /* The ioend has been freed by bio_put() */1075 /* The ioend has been freed by bio_put() */
@@ -1074,20 +1079,36 @@ iomap_finish_ioend(struct iomap_ioend *ioend, int error) · 3 unmodified lines
1074"%s: writeback error on inode %lu, offset %lld, sector %llu",1079"%s: writeback error on inode %lu, offset %lld, sector %llu",
1075 inode->i_sb->s_id, inode->i_ino, offset, start);1080 inode->i_sb->s_id, inode->i_ino, offset, start);
1076 }1081 }
1082 return folio_count;
1077}1083}
1078 1084
1085/*
1086 * Ioend completion routine for merged bios. This can only be called from task
1087 * contexts as merged ioends can be of unbound length. Hence we have to break up
1088 * the writeback completions into manageable chunks to avoid long scheduler
1089 * holdoffs. We aim to keep scheduler holdoffs down below 10ms so that we get
1090 * good batch processing throughput without creating adverse scheduler latency
1091 * conditions.
1092 */
1079void1093void
1080iomap_finish_ioends(struct iomap_ioend *ioend, int error)1094iomap_finish_ioends(struct iomap_ioend *ioend, int error)
1081{1095{
1082 struct list_head tmp;1096 struct list_head tmp;
1097 u32 completions;
1098
1099 might_sleep();
1083 1100
1084 list_replace_init(&ioend->io_list, &tmp);1101 list_replace_init(&ioend->io_list, &tmp);
1085 iomap_finish_ioend(ioend, error);1102 completions = iomap_finish_ioend(ioend, error);
1086 1103
1087 while (!list_empty(&tmp)) {1104 while (!list_empty(&tmp)) {
1105 if (completions > IOEND_BATCH_SIZE * 8) {
1106 cond_resched();
1107 completions = 0;
1108 }
1088 ioend = list_first_entry(&tmp, struct iomap_ioend, io_list);1109 ioend = list_first_entry(&tmp, struct iomap_ioend, io_list);
1089 list_del_init(&ioend->io_list);1110 list_del_init(&ioend->io_list);
1090 iomap_finish_ioend(ioend, error);1111 completions += iomap_finish_ioend(ioend, error);
1091 }1112 }
1092}1113}
1093EXPORT_SYMBOL_GPL(iomap_finish_ioends);1114EXPORT_SYMBOL_GPL(iomap_finish_ioends);
@@ -1108,6 +1129,18 @@ iomap_ioend_can_merge(struct iomap_ioend *ioend, struct iomap_ioend *next) · 14 unmodified lines
1108 return false;1129 return false;
1109 if (ioend->io_offset + ioend->io_size != next->io_offset)1130 if (ioend->io_offset + ioend->io_size != next->io_offset)
1110 return false;1131 return false;
1132 /*
1133 * Do not merge physically discontiguous ioends. The filesystem
1134 * completion functions will have to iterate the physical
1135 * discontiguities even if we merge the ioends at a logical level, so
1136 * we don't gain anything by merging physical discontiguities here.
1137 *
1138 * We cannot use bio->bi_iter.bi_sector here as it is modified during
1139 * submission so does not point to the start sector of the bio at
1140 * completion.
1141 */
1142 if (ioend->io_sector + (ioend->io_size >> 9) != next->io_sector)
1143 return false;
1111 return true;1144 return true;
1112}1145}
1113 1146
@@ -1209,8 +1242,10 @@ iomap_alloc_ioend(struct inode *inode, struct iomap_writepage_ctx *wpc, · 95 unmodified lines
1209 ioend->io_flags = wpc->iomap.flags;1242 ioend->io_flags = wpc->iomap.flags;
1210 ioend->io_inode = inode;1243 ioend->io_inode = inode;
1211 ioend->io_size = 0;1244 ioend->io_size = 0;
1245 ioend->io_folios = 0;
1212 ioend->io_offset = offset;1246 ioend->io_offset = offset;
1213 ioend->io_bio = bio;1247 ioend->io_bio = bio;
1248 ioend->io_sector = sector;
1214 return ioend;1249 return ioend;
1215}1250}
1216 1251
@@ -1251,6 +1286,13 @@ iomap_can_add_to_ioend(struct iomap_writepage_ctx *wpc, loff_t offset, · 34 unmodified lines
1251 return false;1286 return false;
1252 if (sector != bio_end_sector(wpc->ioend->io_bio))1287 if (sector != bio_end_sector(wpc->ioend->io_bio))
1253 return false;1288 return false;
1289 /*
1290 * Limit ioend bio chain lengths to minimise IO completion latency. This
1291 * also prevents long tight loops ending page writeback on all the
1292 * folios in the ioend.
1293 */
1294 if (wpc->ioend->io_folios >= IOEND_BATCH_SIZE)
1295 return false;
1254 return true;1296 return true;
1255}1297}
1256 1298
@@ -1335,6 +1377,8 @@ iomap_writepage_map(struct iomap_writepage_ctx *wpc, · 78 unmodified lines
1335 &submit_list);1377 &submit_list);
1336 count++;1378 count++;
1337 }1379 }
1380 if (count)
1381 wpc->ioend->io_folios++;
1338 1382
1339 WARN_ON_ONCE(!wpc->ioend && !list_empty(&submit_list));1383 WARN_ON_ONCE(!wpc->ioend && !list_empty(&submit_list));
1340 WARN_ON_ONCE(!folio_test_locked(folio));1384 WARN_ON_ONCE(!folio_test_locked(folio));
fs/libfs.c+5−5
@@ -1379,7 +1379,7 @@ bool is_empty_dir_inode(struct inode *inode) · 1378 unmodified lines
1379 (inode->i_op == &empty_dir_inode_operations);1379 (inode->i_op == &empty_dir_inode_operations);
1380}1380}
1381 1381
1382#ifdef CONFIG_UNICODE1382#if IS_ENABLED(CONFIG_UNICODE)
1383/*1383/*
1384 * Determine if the name of a dentry should be casefolded.1384 * Determine if the name of a dentry should be casefolded.
1385 *1385 *
@@ -1473,7 +1473,7 @@ static const struct dentry_operations generic_encrypted_dentry_ops = { · 87 unmodified lines
1473};1473};
1474#endif1474#endif
1475 1475
1476#if defined(CONFIG_FS_ENCRYPTION) && defined(CONFIG_UNICODE)1476#if defined(CONFIG_FS_ENCRYPTION) && IS_ENABLED(CONFIG_UNICODE)
1477static const struct dentry_operations generic_encrypted_ci_dentry_ops = {1477static const struct dentry_operations generic_encrypted_ci_dentry_ops = {
1478 .d_hash = generic_ci_d_hash,1478 .d_hash = generic_ci_d_hash,
1479 .d_compare = generic_ci_d_compare,1479 .d_compare = generic_ci_d_compare,
@@ -1508,10 +1508,10 @@ void generic_set_encrypted_ci_d_ops(struct dentry *dentry) · 28 unmodified lines
1508#ifdef CONFIG_FS_ENCRYPTION1508#ifdef CONFIG_FS_ENCRYPTION
1509 bool needs_encrypt_ops = dentry->d_flags & DCACHE_NOKEY_NAME;1509 bool needs_encrypt_ops = dentry->d_flags & DCACHE_NOKEY_NAME;
1510#endif1510#endif
1511#ifdef CONFIG_UNICODE1511#if IS_ENABLED(CONFIG_UNICODE)
1512 bool needs_ci_ops = dentry->d_sb->s_encoding;1512 bool needs_ci_ops = dentry->d_sb->s_encoding;
1513#endif1513#endif
1514#if defined(CONFIG_FS_ENCRYPTION) && defined(CONFIG_UNICODE)1514#if defined(CONFIG_FS_ENCRYPTION) && IS_ENABLED(CONFIG_UNICODE)
1515 if (needs_encrypt_ops && needs_ci_ops) {1515 if (needs_encrypt_ops && needs_ci_ops) {
1516 d_set_d_op(dentry, &generic_encrypted_ci_dentry_ops);1516 d_set_d_op(dentry, &generic_encrypted_ci_dentry_ops);
1517 return;1517 return;
@@ -1523,7 +1523,7 @@ void generic_set_encrypted_ci_d_ops(struct dentry *dentry) · 5 unmodified lines
1523 return;1523 return;
1524 }1524 }
1525#endif1525#endif
1526#ifdef CONFIG_UNICODE1526#if IS_ENABLED(CONFIG_UNICODE)
1527 if (needs_ci_ops) {1527 if (needs_ci_ops) {
1528 d_set_d_op(dentry, &generic_ci_dentry_ops);1528 d_set_d_op(dentry, &generic_ci_dentry_ops);
1529 return;1529 return;
fs/lockd/svcsubs.c+10−8
@@ -179,19 +179,21 @@ nlm_delete_file(struct nlm_file *file) · 178 unmodified lines
179static int nlm_unlock_files(struct nlm_file *file)179static int nlm_unlock_files(struct nlm_file *file)
180{180{
181 struct file_lock lock;181 struct file_lock lock;
182 struct file *f;
183 182
183 locks_init_lock(&lock);
184 lock.fl_type = F_UNLCK;184 lock.fl_type = F_UNLCK;
185 lock.fl_start = 0;185 lock.fl_start = 0;
186 lock.fl_end = OFFSET_MAX;186 lock.fl_end = OFFSET_MAX;
187 for (f = file->f_file[0]; f <= file->f_file[1]; f++) {187 if (file->f_file[O_RDONLY] &&
188 if (f && vfs_lock_file(f, F_SETLK, &lock, NULL) < 0) {188 vfs_lock_file(file->f_file[O_RDONLY], F_SETLK, &lock, NULL))
189 pr_warn("lockd: unlock failure in %s:%d\n",189 goto out_err;
190 __FILE__, __LINE__);190 if (file->f_file[O_WRONLY] &&
191 return 1;191 vfs_lock_file(file->f_file[O_WRONLY], F_SETLK, &lock, NULL))
192 }192 goto out_err;
193 }
194 return 0;193 return 0;
194out_err:
195 pr_warn("lockd: unlock failure in %s:%d\n", __FILE__, __LINE__);
196 return 1;
195}197}
196 198
197/*199/*
fs/nfsd/nfs4state.c+3−1
@@ -4130,8 +4130,10 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, · 4129 unmodified lines
4130 status = nfserr_clid_inuse;4130 status = nfserr_clid_inuse;
4131 if (client_has_state(old)4131 if (client_has_state(old)
4132 && !same_creds(&unconf->cl_cred,4132 && !same_creds(&unconf->cl_cred,
4133 &old->cl_cred))4133 &old->cl_cred)) {
4134 old = NULL;
4134 goto out;4135 goto out;
4136 }
4135 status = mark_client_expired_locked(old);4137 status = mark_client_expired_locked(old);
4136 if (status) {4138 if (status) {
4137 old = NULL;4139 old = NULL;
fs/notify/fanotify/fanotify_user.c+3−3
@@ -701,9 +701,6 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group, · 700 unmodified lines
701 if (fanotify_is_perm_event(event->mask))701 if (fanotify_is_perm_event(event->mask))
702 FANOTIFY_PERM(event)->fd = fd;702 FANOTIFY_PERM(event)->fd = fd;
703 703
704 if (f)
705 fd_install(fd, f);
706
707 if (info_mode) {704 if (info_mode) {
708 ret = copy_info_records_to_user(event, info, info_mode, pidfd,705 ret = copy_info_records_to_user(event, info, info_mode, pidfd,
709 buf, count);706 buf, count);
@@ -711,6 +708,9 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group, · 1 unmodified line
711 goto out_close_fd;708 goto out_close_fd;
712 }709 }
713 710
711 if (f)
712 fd_install(fd, f);
713
714 return metadata.event_len;714 return metadata.event_len;
715 715
716out_close_fd:716out_close_fd:
fs/overlayfs/copy_up.c+13−3
@@ -145,7 +145,7 @@ static int ovl_copy_fileattr(struct inode *inode, struct path *old, · 144 unmodified lines
145 if (err == -ENOTTY || err == -EINVAL)145 if (err == -ENOTTY || err == -EINVAL)
146 return 0;146 return 0;
147 pr_warn("failed to retrieve lower fileattr (%pd2, err=%i)\n",147 pr_warn("failed to retrieve lower fileattr (%pd2, err=%i)\n",
148 old, err);148 old->dentry, err);
149 return err;149 return err;
150 }150 }
151 151
@@ -157,7 +157,9 @@ static int ovl_copy_fileattr(struct inode *inode, struct path *old, · 5 unmodified lines
157 */157 */
158 if (oldfa.flags & OVL_PROT_FS_FLAGS_MASK) {158 if (oldfa.flags & OVL_PROT_FS_FLAGS_MASK) {
159 err = ovl_set_protattr(inode, new->dentry, &oldfa);159 err = ovl_set_protattr(inode, new->dentry, &oldfa);
160 if (err)160 if (err == -EPERM)
161 pr_warn_once("copying fileattr: no xattr on upper\n");
162 else if (err)
161 return err;163 return err;
162 }164 }
163 165
@@ -167,8 +169,16 @@ static int ovl_copy_fileattr(struct inode *inode, struct path *old, · 3 unmodified lines
167 169
168 err = ovl_real_fileattr_get(new, &newfa);170 err = ovl_real_fileattr_get(new, &newfa);
169 if (err) {171 if (err) {
172 /*
173 * Returning an error if upper doesn't support fileattr will
174 * result in a regression, so revert to the old behavior.
175 */
176 if (err == -ENOTTY || err == -EINVAL) {
177 pr_warn_once("copying fileattr: no support on upper\n");
178 return 0;
179 }
170 pr_warn("failed to retrieve upper fileattr (%pd2, err=%i)\n",180 pr_warn("failed to retrieve upper fileattr (%pd2, err=%i)\n",
171 new, err);181 new->dentry, err);
172 return err;182 return err;
173 }183 }
174 184
fs/quota/dquot.c+8−3
@@ -690,9 +690,14 @@ int dquot_quota_sync(struct super_block *sb, int type) · 689 unmodified lines
690 /* This is not very clever (and fast) but currently I don't know about690 /* This is not very clever (and fast) but currently I don't know about
691 * any other simple way of getting quota data to disk and we must get691 * any other simple way of getting quota data to disk and we must get
692 * them there for userspace to be visible... */692 * them there for userspace to be visible... */
693 if (sb->s_op->sync_fs)693 if (sb->s_op->sync_fs) {
694 sb->s_op->sync_fs(sb, 1);694 ret = sb->s_op->sync_fs(sb, 1);
695 sync_blockdev(sb->s_bdev);695 if (ret)
696 return ret;
697 }
698 ret = sync_blockdev(sb->s_bdev);
699 if (ret)
700 return ret;
696 701
697 /*702 /*
698 * Now when everything is written we can discard the pagecache so703 * Now when everything is written we can discard the pagecache so
fs/super.c+12−7
@@ -1616,11 +1616,9 @@ static void lockdep_sb_freeze_acquire(struct super_block *sb) · 1615 unmodified lines
1616 percpu_rwsem_acquire(sb->s_writers.rw_sem + level, 0, _THIS_IP_);1616 percpu_rwsem_acquire(sb->s_writers.rw_sem + level, 0, _THIS_IP_);
1617}1617}
1618 1618
1619static void sb_freeze_unlock(struct super_block *sb)1619static void sb_freeze_unlock(struct super_block *sb, int level)
1620{1620{
1621 int level;1621 for (level--; level >= 0; level--)
1622
1623 for (level = SB_FREEZE_LEVELS - 1; level >= 0; level--)
1624 percpu_up_write(sb->s_writers.rw_sem + level);1622 percpu_up_write(sb->s_writers.rw_sem + level);
1625}1623}
1626 1624
@@ -1691,7 +1689,14 @@ int freeze_super(struct super_block *sb) · 64 unmodified lines
1691 sb_wait_write(sb, SB_FREEZE_PAGEFAULT);1689 sb_wait_write(sb, SB_FREEZE_PAGEFAULT);
1692 1690
1693 /* All writers are done so after syncing there won't be dirty data */1691 /* All writers are done so after syncing there won't be dirty data */
1694 sync_filesystem(sb);1692 ret = sync_filesystem(sb);
1693 if (ret) {
1694 sb->s_writers.frozen = SB_UNFROZEN;
1695 sb_freeze_unlock(sb, SB_FREEZE_PAGEFAULT);
1696 wake_up(&sb->s_writers.wait_unfrozen);
1697 deactivate_locked_super(sb);
1698 return ret;
1699 }
1695 1700
1696 /* Now wait for internal filesystem counter */1701 /* Now wait for internal filesystem counter */
1697 sb->s_writers.frozen = SB_FREEZE_FS;1702 sb->s_writers.frozen = SB_FREEZE_FS;
@@ -1703,7 +1708,7 @@ int freeze_super(struct super_block *sb) · 5 unmodified lines
1703 printk(KERN_ERR1708 printk(KERN_ERR
1704 "VFS:Filesystem freeze failed\n");1709 "VFS:Filesystem freeze failed\n");
1705 sb->s_writers.frozen = SB_UNFROZEN;1710 sb->s_writers.frozen = SB_UNFROZEN;
1706 sb_freeze_unlock(sb);1711 sb_freeze_unlock(sb, SB_FREEZE_FS);
1707 wake_up(&sb->s_writers.wait_unfrozen);1712 wake_up(&sb->s_writers.wait_unfrozen);
1708 deactivate_locked_super(sb);1713 deactivate_locked_super(sb);
1709 return ret;1714 return ret;
@@ -1748,7 +1753,7 @@ static int thaw_super_locked(struct super_block *sb) · 38 unmodified lines
1748 }1753 }
1749 1754
1750 sb->s_writers.frozen = SB_UNFROZEN;1755 sb->s_writers.frozen = SB_UNFROZEN;
1751 sb_freeze_unlock(sb);1756 sb_freeze_unlock(sb, SB_FREEZE_FS);
1752out:1757out:
1753 wake_up(&sb->s_writers.wait_unfrozen);1758 wake_up(&sb->s_writers.wait_unfrozen);
1754 deactivate_locked_super(sb);1759 deactivate_locked_super(sb);
fs/sync.c+12−6
@@ -29,7 +29,7 @@ · 28 unmodified lines
29 */29 */
30int sync_filesystem(struct super_block *sb)30int sync_filesystem(struct super_block *sb)
31{31{
32 int ret;32 int ret = 0;
33 33
34 /*34 /*
35 * We need to be protected against the filesystem going from35 * We need to be protected against the filesystem going from
@@ -52,15 +52,21 @@ int sync_filesystem(struct super_block *sb) · 16 unmodified lines
52 * at a time.52 * at a time.
53 */53 */
54 writeback_inodes_sb(sb, WB_REASON_SYNC);54 writeback_inodes_sb(sb, WB_REASON_SYNC);
55 if (sb->s_op->sync_fs)55 if (sb->s_op->sync_fs) {
56 sb->s_op->sync_fs(sb, 0);56 ret = sb->s_op->sync_fs(sb, 0);
57 if (ret)
58 return ret;
59 }
57 ret = sync_blockdev_nowait(sb->s_bdev);60 ret = sync_blockdev_nowait(sb->s_bdev);
58 if (ret < 0)61 if (ret)
59 return ret;62 return ret;
60 63
61 sync_inodes_sb(sb);64 sync_inodes_sb(sb);
62 if (sb->s_op->sync_fs)65 if (sb->s_op->sync_fs) {
63 sb->s_op->sync_fs(sb, 1);66 ret = sb->s_op->sync_fs(sb, 1);
67 if (ret)
68 return ret;
69 }
64 return sync_blockdev(sb->s_bdev);70 return sync_blockdev(sb->s_bdev);
65}71}
66EXPORT_SYMBOL(sync_filesystem);72EXPORT_SYMBOL(sync_filesystem);
fs/unicode/Kconfig+5−13
@@ -3,21 +3,13 @@ · 2 unmodified lines
3# UTF-8 normalization3# UTF-8 normalization
4#4#
5config UNICODE5config UNICODE
6 bool "UTF-8 normalization and casefolding support"6 tristate "UTF-8 normalization and casefolding support"
7 help7 help
8 Say Y here to enable UTF-8 NFD normalization and NFD+CF casefolding8 Say Y here to enable UTF-8 NFD normalization and NFD+CF casefolding
9 support.9 support. If you say M here the large table of case foldings will
10 10 be a separate loadable module that gets requested only when a file
11config UNICODE_UTF8_DATA11 system actually use it.
12 tristate "UTF-8 normalization and casefolding tables"
13 depends on UNICODE
14 default UNICODE
15 help
16 This contains a large table of case foldings, which can be loaded as
17 a separate module if you say M here. To be on the safe side stick
18 to the default of Y. Saying N here makes no sense, if you do not want
19 utf8 casefolding support, disable CONFIG_UNICODE instead.
20 12
21config UNICODE_NORMALIZATION_SELFTEST13config UNICODE_NORMALIZATION_SELFTEST
22 tristate "Test UTF-8 normalization support"14 tristate "Test UTF-8 normalization support"
23 depends on UNICODE_UTF8_DATA15 depends on UNICODE
fs/unicode/Makefile+4−2
@@ -1,8 +1,10 @@
1# SPDX-License-Identifier: GPL-2.01# SPDX-License-Identifier: GPL-2.0
2 2
3obj-$(CONFIG_UNICODE) += unicode.o3ifneq ($(CONFIG_UNICODE),)
4obj-y += unicode.o
5endif
6obj-$(CONFIG_UNICODE) += utf8data.o
4obj-$(CONFIG_UNICODE_NORMALIZATION_SELFTEST) += utf8-selftest.o7obj-$(CONFIG_UNICODE_NORMALIZATION_SELFTEST) += utf8-selftest.o
5obj-$(CONFIG_UNICODE_UTF8_DATA) += utf8data.o
6 8
7unicode-y := utf8-norm.o utf8-core.o9unicode-y := utf8-norm.o utf8-core.o
8 10
fs/xfs/xfs_aops.c+15−1
@@ -136,7 +136,20 @@ done: · 135 unmodified lines
136 memalloc_nofs_restore(nofs_flag);136 memalloc_nofs_restore(nofs_flag);
137}137}
138 138
139/* Finish all pending io completions. */139/*
140 * Finish all pending IO completions that require transactional modifications.
141 *
142 * We try to merge physical and logically contiguous ioends before completion to
143 * minimise the number of transactions we need to perform during IO completion.
144 * Both unwritten extent conversion and COW remapping need to iterate and modify
145 * one physical extent at a time, so we gain nothing by merging physically
146 * discontiguous extents here.
147 *
148 * The ioend chain length that we can be processing here is largely unbound in
149 * length and we may have to perform significant amounts of work on each ioend
150 * to complete it. Hence we have to be careful about holding the CPU for too
151 * long in this loop.
152 */
140void153void
141xfs_end_io(154xfs_end_io(
142 struct work_struct *work)155 struct work_struct *work)
@@ -157,6 +170,7 @@ xfs_end_io( · 14 unmodified lines
157 list_del_init(&ioend->io_list);170 list_del_init(&ioend->io_list);
158 iomap_ioend_try_merge(ioend, &tmp);171 iomap_ioend_try_merge(ioend, &tmp);
159 xfs_end_ioend(ioend);172 xfs_end_ioend(ioend);
173 cond_resched();
160 }174 }
161}175}
162 176
fs/xfs/xfs_bmap_util.c+3−6
@@ -850,9 +850,6 @@ xfs_alloc_file_space( · 849 unmodified lines
850 rblocks = 0;850 rblocks = 0;
851 }851 }
852 852
853 /*
854 * Allocate and setup the transaction.
855 */
856 error = xfs_trans_alloc_inode(ip, &M_RES(mp)->tr_write,853 error = xfs_trans_alloc_inode(ip, &M_RES(mp)->tr_write,
857 dblocks, rblocks, false, &tp);854 dblocks, rblocks, false, &tp);
858 if (error)855 if (error)
@@ -869,9 +866,9 @@ xfs_alloc_file_space( · 10 unmodified lines
869 if (error)866 if (error)
870 goto error;867 goto error;
871 868
872 /*869 ip->i_diflags |= XFS_DIFLAG_PREALLOC;
873 * Complete the transaction870 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
874 */871
875 error = xfs_trans_commit(tp);872 error = xfs_trans_commit(tp);
876 xfs_iunlock(ip, XFS_ILOCK_EXCL);873 xfs_iunlock(ip, XFS_ILOCK_EXCL);
877 if (error)874 if (error)
fs/xfs/xfs_file.c+26−60
@@ -66,40 +66,6 @@ xfs_is_falloc_aligned( · 65 unmodified lines
66 return !((pos | len) & mask);66 return !((pos | len) & mask);
67}67}
68 68
69int
70xfs_update_prealloc_flags(
71 struct xfs_inode *ip,
72 enum xfs_prealloc_flags flags)
73{
74 struct xfs_trans *tp;
75 int error;
76
77 error = xfs_trans_alloc(ip->i_mount, &M_RES(ip->i_mount)->tr_writeid,
78 0, 0, 0, &tp);
79 if (error)
80 return error;
81
82 xfs_ilock(ip, XFS_ILOCK_EXCL);
83 xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
84
85 if (!(flags & XFS_PREALLOC_INVISIBLE)) {
86 VFS_I(ip)->i_mode &= ~S_ISUID;
87 if (VFS_I(ip)->i_mode & S_IXGRP)
88 VFS_I(ip)->i_mode &= ~S_ISGID;
89 xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
90 }
91
92 if (flags & XFS_PREALLOC_SET)
93 ip->i_diflags |= XFS_DIFLAG_PREALLOC;
94 if (flags & XFS_PREALLOC_CLEAR)
95 ip->i_diflags &= ~XFS_DIFLAG_PREALLOC;
96
97 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
98 if (flags & XFS_PREALLOC_SYNC)
99 xfs_trans_set_sync(tp);
100 return xfs_trans_commit(tp);
101}
102
103/*69/*
104 * Fsync operations on directories are much simpler than on regular files,70 * Fsync operations on directories are much simpler than on regular files,
105 * as there is no file data to flush, and thus also no need for explicit71 * as there is no file data to flush, and thus also no need for explicit
@@ -895,6 +861,21 @@ xfs_break_layouts( · 789 unmodified lines
895 return error;861 return error;
896}862}
897 863
864/* Does this file, inode, or mount want synchronous writes? */
865static inline bool xfs_file_sync_writes(struct file *filp)
866{
867 struct xfs_inode *ip = XFS_I(file_inode(filp));
868
869 if (xfs_has_wsync(ip->i_mount))
870 return true;
871 if (filp->f_flags & (__O_SYNC | O_DSYNC))
872 return true;
873 if (IS_SYNC(file_inode(filp)))
874 return true;
875
876 return false;
877}
878
898#define XFS_FALLOC_FL_SUPPORTED \879#define XFS_FALLOC_FL_SUPPORTED \
899 (FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE | \880 (FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE | \
900 FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_ZERO_RANGE | \881 FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_ZERO_RANGE | \
@@ -910,7 +891,6 @@ xfs_file_fallocate( · 9 unmodified lines
910 struct inode *inode = file_inode(file);891 struct inode *inode = file_inode(file);
911 struct xfs_inode *ip = XFS_I(inode);892 struct xfs_inode *ip = XFS_I(inode);
912 long error;893 long error;
913 enum xfs_prealloc_flags flags = 0;
914 uint iolock = XFS_IOLOCK_EXCL | XFS_MMAPLOCK_EXCL;894 uint iolock = XFS_IOLOCK_EXCL | XFS_MMAPLOCK_EXCL;
915 loff_t new_size = 0;895 loff_t new_size = 0;
916 bool do_file_insert = false;896 bool do_file_insert = false;
@@ -955,6 +935,10 @@ xfs_file_fallocate( · 38 unmodified lines
955 goto out_unlock;935 goto out_unlock;
956 }936 }
957 937
938 error = file_modified(file);
939 if (error)
940 goto out_unlock;
941
958 if (mode & FALLOC_FL_PUNCH_HOLE) {942 if (mode & FALLOC_FL_PUNCH_HOLE) {
959 error = xfs_free_file_space(ip, offset, len);943 error = xfs_free_file_space(ip, offset, len);
960 if (error)944 if (error)
@@ -1004,8 +988,6 @@ xfs_file_fallocate( · 43 unmodified lines
1004 }988 }
1005 do_file_insert = true;989 do_file_insert = true;
1006 } else {990 } else {
1007 flags |= XFS_PREALLOC_SET;
1008
1009 if (!(mode & FALLOC_FL_KEEP_SIZE) &&991 if (!(mode & FALLOC_FL_KEEP_SIZE) &&
1010 offset + len > i_size_read(inode)) {992 offset + len > i_size_read(inode)) {
1011 new_size = offset + len;993 new_size = offset + len;
@@ -1057,13 +1039,6 @@ xfs_file_fallocate( · 45 unmodified lines
1057 }1039 }
1058 }1040 }
1059 1041
1060 if (file->f_flags & O_DSYNC)
1061 flags |= XFS_PREALLOC_SYNC;
1062
1063 error = xfs_update_prealloc_flags(ip, flags);
1064 if (error)
1065 goto out_unlock;
1066
1067 /* Change file size if needed */1042 /* Change file size if needed */
1068 if (new_size) {1043 if (new_size) {
1069 struct iattr iattr;1044 struct iattr iattr;
@@ -1082,8 +1057,14 @@ xfs_file_fallocate( · 12 unmodified lines
1082 * leave shifted extents past EOF and hence losing access to1057 * leave shifted extents past EOF and hence losing access to
1083 * the data that is contained within them.1058 * the data that is contained within them.
1084 */1059 */
1085 if (do_file_insert)1060 if (do_file_insert) {
1086 error = xfs_insert_file_space(ip, offset, len);1061 error = xfs_insert_file_space(ip, offset, len);
1062 if (error)
1063 goto out_unlock;
1064 }
1065
1066 if (xfs_file_sync_writes(file))
1067 error = xfs_log_force_inode(ip);
1087 1068
1088out_unlock:1069out_unlock:
1089 xfs_iunlock(ip, iolock);1070 xfs_iunlock(ip, iolock);
@@ -1115,21 +1096,6 @@ xfs_file_fadvise( · 25 unmodified lines
1115 return ret;1096 return ret;
1116}1097}
1117 1098
1118/* Does this file, inode, or mount want synchronous writes? */
1119static inline bool xfs_file_sync_writes(struct file *filp)
1120{
1121 struct xfs_inode *ip = XFS_I(file_inode(filp));
1122
1123 if (xfs_has_wsync(ip->i_mount))
1124 return true;
1125 if (filp->f_flags & (__O_SYNC | O_DSYNC))
1126 return true;
1127 if (IS_SYNC(file_inode(filp)))
1128 return true;
1129
1130 return false;
1131}
1132
1133STATIC loff_t1099STATIC loff_t
1134xfs_file_remap_range(1100xfs_file_remap_range(
1135 struct file *file_in,1101 struct file *file_in,
fs/xfs/xfs_inode.h+0−9
@@ -462,15 +462,6 @@ xfs_itruncate_extents( · 461 unmodified lines
462}462}
463 463
464/* from xfs_file.c */464/* from xfs_file.c */
465enum xfs_prealloc_flags {
466 XFS_PREALLOC_SET = (1 << 1),
467 XFS_PREALLOC_CLEAR = (1 << 2),
468 XFS_PREALLOC_SYNC = (1 << 3),
469 XFS_PREALLOC_INVISIBLE = (1 << 4),
470};
471
472int xfs_update_prealloc_flags(struct xfs_inode *ip,
473 enum xfs_prealloc_flags flags);
474int xfs_break_layouts(struct inode *inode, uint *iolock,465int xfs_break_layouts(struct inode *inode, uint *iolock,
475 enum layout_break_reason reason);466 enum layout_break_reason reason);
476 467
fs/xfs/xfs_ioctl.c+1−1
@@ -1464,7 +1464,7 @@ xfs_ioc_getbmap( · 1463 unmodified lines
1464 1464
1465 if (bmx.bmv_count < 2)1465 if (bmx.bmv_count < 2)
1466 return -EINVAL;1466 return -EINVAL;
1467 if (bmx.bmv_count > ULONG_MAX / recsize)1467 if (bmx.bmv_count >= INT_MAX / recsize)
1468 return -ENOMEM;1468 return -ENOMEM;
1469 1469
1470 buf = kvcalloc(bmx.bmv_count, sizeof(*buf), GFP_KERNEL);1470 buf = kvcalloc(bmx.bmv_count, sizeof(*buf), GFP_KERNEL);
fs/xfs/xfs_pnfs.c+39−3
@@ -70,6 +70,40 @@ xfs_fs_get_uuid( · 69 unmodified lines
70 return 0;70 return 0;
71}71}
72 72
73/*
74 * We cannot use file based VFS helpers such as file_modified() to update
75 * inode state as we modify the data/metadata in the inode here. Hence we have
76 * to open code the timestamp updates and SUID/SGID stripping. We also need
77 * to set the inode prealloc flag to ensure that the extents we allocate are not
78 * removed if the inode is reclaimed from memory before xfs_fs_block_commit()
79 * is from the client to indicate that data has been written and the file size
80 * can be extended.
81 */
82static int
83xfs_fs_map_update_inode(
84 struct xfs_inode *ip)
85{
86 struct xfs_trans *tp;
87 int error;
88
89 error = xfs_trans_alloc(ip->i_mount, &M_RES(ip->i_mount)->tr_writeid,
90 0, 0, 0, &tp);
91 if (error)
92 return error;
93
94 xfs_ilock(ip, XFS_ILOCK_EXCL);
95 xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
96
97 VFS_I(ip)->i_mode &= ~S_ISUID;
98 if (VFS_I(ip)->i_mode & S_IXGRP)
99 VFS_I(ip)->i_mode &= ~S_ISGID;
100 xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
101 ip->i_diflags |= XFS_DIFLAG_PREALLOC;
102
103 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
104 return xfs_trans_commit(tp);
105}
106
73/*107/*
74 * Get a layout for the pNFS client.108 * Get a layout for the pNFS client.
75 */109 */
@@ -164,10 +198,12 @@ xfs_fs_map_blocks( · 88 unmodified lines
164 * that the blocks allocated and handed out to the client are198 * that the blocks allocated and handed out to the client are
165 * guaranteed to be present even after a server crash.199 * guaranteed to be present even after a server crash.
166 */200 */
167 error = xfs_update_prealloc_flags(ip,201 error = xfs_fs_map_update_inode(ip);
168 XFS_PREALLOC_SET | XFS_PREALLOC_SYNC);202 if (!error)
203 error = xfs_log_force_inode(ip);
169 if (error)204 if (error)
170 goto out_unlock;205 goto out_unlock;
206
171 } else {207 } else {
172 xfs_iunlock(ip, lock_flags);208 xfs_iunlock(ip, lock_flags);
173 }209 }
@@ -255,7 +291,7 @@ xfs_fs_commit_blocks( · 81 unmodified lines
255 length = end - start;291 length = end - start;
256 if (!length)292 if (!length)
257 continue;293 continue;
258 294
259 /*295 /*
260 * Make sure reads through the pagecache see the new data.296 * Make sure reads through the pagecache see the new data.
261 */297 */
fs/xfs/xfs_super.c+5−1
@@ -735,6 +735,7 @@ xfs_fs_sync_fs( · 734 unmodified lines
735 int wait)735 int wait)
736{736{
737 struct xfs_mount *mp = XFS_M(sb);737 struct xfs_mount *mp = XFS_M(sb);
738 int error;
738 739
739 trace_xfs_fs_sync_fs(mp, __return_address);740 trace_xfs_fs_sync_fs(mp, __return_address);
740 741
@@ -744,7 +745,10 @@ xfs_fs_sync_fs( · 3 unmodified lines
744 if (!wait)745 if (!wait)
745 return 0;746 return 0;
746 747
747 xfs_log_force(mp, XFS_LOG_SYNC);748 error = xfs_log_force(mp, XFS_LOG_SYNC);
749 if (error)
750 return error;
751
748 if (laptop_mode) {752 if (laptop_mode) {
749 /*753 /*
750 * The disk must be active because we're syncing.754 * The disk must be active because we're syncing.
include/crypto/internal/blake2s.h+25−15
@@ -24,14 +24,11 @@ static inline void blake2s_set_lastblock(struct blake2s_state *state) · 23 unmodified lines
24 state->f[0] = -1;24 state->f[0] = -1;
25}25}
26 26
27typedef void (*blake2s_compress_t)(struct blake2s_state *state,
28 const u8 *block, size_t nblocks, u32 inc);
29
30/* Helper functions for BLAKE2s shared by the library and shash APIs */27/* Helper functions for BLAKE2s shared by the library and shash APIs */
31 28
32static inline void __blake2s_update(struct blake2s_state *state,29static __always_inline void
33 const u8 *in, size_t inlen,30__blake2s_update(struct blake2s_state *state, const u8 *in, size_t inlen,
34 blake2s_compress_t compress)31 bool force_generic)
35{32{
36 const size_t fill = BLAKE2S_BLOCK_SIZE - state->buflen;33 const size_t fill = BLAKE2S_BLOCK_SIZE - state->buflen;
37 34
@@ -39,7 +36,12 @@ static inline void __blake2s_update(struct blake2s_state *state, · 1 unmodified line
39 return;36 return;
40 if (inlen > fill) {37 if (inlen > fill) {
41 memcpy(state->buf + state->buflen, in, fill);38 memcpy(state->buf + state->buflen, in, fill);
42 (*compress)(state, state->buf, 1, BLAKE2S_BLOCK_SIZE);39 if (force_generic)
40 blake2s_compress_generic(state, state->buf, 1,
41 BLAKE2S_BLOCK_SIZE);
42 else
43 blake2s_compress(state, state->buf, 1,
44 BLAKE2S_BLOCK_SIZE);
43 state->buflen = 0;45 state->buflen = 0;
44 in += fill;46 in += fill;
45 inlen -= fill;47 inlen -= fill;
@@ -47,7 +49,12 @@ static inline void __blake2s_update(struct blake2s_state *state, · 1 unmodified line
47 if (inlen > BLAKE2S_BLOCK_SIZE) {49 if (inlen > BLAKE2S_BLOCK_SIZE) {
48 const size_t nblocks = DIV_ROUND_UP(inlen, BLAKE2S_BLOCK_SIZE);50 const size_t nblocks = DIV_ROUND_UP(inlen, BLAKE2S_BLOCK_SIZE);
49 /* Hash one less (full) block than strictly possible */51 /* Hash one less (full) block than strictly possible */
50 (*compress)(state, in, nblocks - 1, BLAKE2S_BLOCK_SIZE);52 if (force_generic)
53 blake2s_compress_generic(state, in, nblocks - 1,
54 BLAKE2S_BLOCK_SIZE);
55 else
56 blake2s_compress(state, in, nblocks - 1,
57 BLAKE2S_BLOCK_SIZE);
51 in += BLAKE2S_BLOCK_SIZE * (nblocks - 1);58 in += BLAKE2S_BLOCK_SIZE * (nblocks - 1);
52 inlen -= BLAKE2S_BLOCK_SIZE * (nblocks - 1);59 inlen -= BLAKE2S_BLOCK_SIZE * (nblocks - 1);
53 }60 }
@@ -55,13 +62,16 @@ static inline void __blake2s_update(struct blake2s_state *state, · 1 unmodified line
55 state->buflen += inlen;62 state->buflen += inlen;
56}63}
57 64
58static inline void __blake2s_final(struct blake2s_state *state, u8 *out,65static __always_inline void
59 blake2s_compress_t compress)66__blake2s_final(struct blake2s_state *state, u8 *out, bool force_generic)
60{67{
61 blake2s_set_lastblock(state);68 blake2s_set_lastblock(state);
62 memset(state->buf + state->buflen, 0,69 memset(state->buf + state->buflen, 0,
63 BLAKE2S_BLOCK_SIZE - state->buflen); /* Padding */70 BLAKE2S_BLOCK_SIZE - state->buflen); /* Padding */
64 (*compress)(state, state->buf, 1, state->buflen);71 if (force_generic)
72 blake2s_compress_generic(state, state->buf, 1, state->buflen);
73 else
74 blake2s_compress(state, state->buf, 1, state->buflen);
65 cpu_to_le32_array(state->h, ARRAY_SIZE(state->h));75 cpu_to_le32_array(state->h, ARRAY_SIZE(state->h));
66 memcpy(out, state->h, state->outlen);76 memcpy(out, state->h, state->outlen);
67}77}
@@ -99,20 +109,20 @@ static inline int crypto_blake2s_init(struct shash_desc *desc) · 31 unmodified lines
99 109
100static inline int crypto_blake2s_update(struct shash_desc *desc,110static inline int crypto_blake2s_update(struct shash_desc *desc,
101 const u8 *in, unsigned int inlen,111 const u8 *in, unsigned int inlen,
102 blake2s_compress_t compress)112 bool force_generic)
103{113{
104 struct blake2s_state *state = shash_desc_ctx(desc);114 struct blake2s_state *state = shash_desc_ctx(desc);
105 115
106 __blake2s_update(state, in, inlen, compress);116 __blake2s_update(state, in, inlen, force_generic);
107 return 0;117 return 0;
108}118}
109 119
110static inline int crypto_blake2s_final(struct shash_desc *desc, u8 *out,120static inline int crypto_blake2s_final(struct shash_desc *desc, u8 *out,
111 blake2s_compress_t compress)121 bool force_generic)
112{122{
113 struct blake2s_state *state = shash_desc_ctx(desc);123 struct blake2s_state *state = shash_desc_ctx(desc);
114 124
115 __blake2s_final(state, out, compress);125 __blake2s_final(state, out, force_generic);
116 return 0;126 return 0;
117}127}
118 128
include/linux/ceph/libceph.h+1−0
@@ -35,6 +35,7 @@ · 34 unmodified lines
35#define CEPH_OPT_TCP_NODELAY (1<<4) /* TCP_NODELAY on TCP sockets */35#define CEPH_OPT_TCP_NODELAY (1<<4) /* TCP_NODELAY on TCP sockets */
36#define CEPH_OPT_NOMSGSIGN (1<<5) /* don't sign msgs (msgr1) */36#define CEPH_OPT_NOMSGSIGN (1<<5) /* don't sign msgs (msgr1) */
37#define CEPH_OPT_ABORT_ON_FULL (1<<6) /* abort w/ ENOSPC when full */37#define CEPH_OPT_ABORT_ON_FULL (1<<6) /* abort w/ ENOSPC when full */
38#define CEPH_OPT_RXBOUNCE (1<<7) /* double-buffer read data */
38 39
39#define CEPH_OPT_DEFAULT (CEPH_OPT_TCP_NODELAY)40#define CEPH_OPT_DEFAULT (CEPH_OPT_TCP_NODELAY)
40 41
include/linux/ceph/messenger.h+5−0
@@ -383,6 +383,10 @@ struct ceph_connection_v2_info { · 382 unmodified lines
383 struct ceph_gcm_nonce in_gcm_nonce;383 struct ceph_gcm_nonce in_gcm_nonce;
384 struct ceph_gcm_nonce out_gcm_nonce;384 struct ceph_gcm_nonce out_gcm_nonce;
385 385
386 struct page **in_enc_pages;
387 int in_enc_page_cnt;
388 int in_enc_resid;
389 int in_enc_i;
386 struct page **out_enc_pages;390 struct page **out_enc_pages;
387 int out_enc_page_cnt;391 int out_enc_page_cnt;
388 int out_enc_resid;392 int out_enc_resid;
@@ -457,6 +461,7 @@ struct ceph_connection { · 68 unmodified lines
457 struct ceph_msg *out_msg; /* sending message (== tail of461 struct ceph_msg *out_msg; /* sending message (== tail of
458 out_sent) */462 out_sent) */
459 463
464 struct page *bounce_page;
460 u32 in_front_crc, in_middle_crc, in_data_crc; /* calculated crc */465 u32 in_front_crc, in_middle_crc, in_data_crc; /* calculated crc */
461 466
462 struct timespec64 last_keepalive_ack; /* keepalive2 ack stamp */467 struct timespec64 last_keepalive_ack; /* keepalive2 ack stamp */
include/linux/fb.h+1−1
@@ -262,7 +262,7 @@ struct fb_ops { · 261 unmodified lines
262 262
263 /* Draws a rectangle */263 /* Draws a rectangle */
264 void (*fb_fillrect) (struct fb_info *info, const struct fb_fillrect *rect);264 void (*fb_fillrect) (struct fb_info *info, const struct fb_fillrect *rect);
265 /* Copy data from area to another. Obsolete. */265 /* Copy data from area to another */
266 void (*fb_copyarea) (struct fb_info *info, const struct fb_copyarea *region);266 void (*fb_copyarea) (struct fb_info *info, const struct fb_copyarea *region);
267 /* Draws a image to the display */267 /* Draws a image to the display */
268 void (*fb_imageblit) (struct fb_info *info, const struct fb_image *image);268 void (*fb_imageblit) (struct fb_info *info, const struct fb_image *image);
include/linux/fs.h+1−1
@@ -1483,7 +1483,7 @@ struct super_block { · 1482 unmodified lines
1483#ifdef CONFIG_FS_VERITY1483#ifdef CONFIG_FS_VERITY
1484 const struct fsverity_operations *s_vop;1484 const struct fsverity_operations *s_vop;
1485#endif1485#endif
1486#ifdef CONFIG_UNICODE1486#if IS_ENABLED(CONFIG_UNICODE)
1487 struct unicode_map *s_encoding;1487 struct unicode_map *s_encoding;
1488 __u16 s_encoding_flags;1488 __u16 s_encoding_flags;
1489#endif1489#endif
include/linux/if_vlan.h+4−2
@@ -46,8 +46,10 @@ struct vlan_hdr { · 45 unmodified lines
46 * @h_vlan_encapsulated_proto: packet type ID or len46 * @h_vlan_encapsulated_proto: packet type ID or len
47 */47 */
48struct vlan_ethhdr {48struct vlan_ethhdr {
49 unsigned char h_dest[ETH_ALEN];49 struct_group(addrs,
50 unsigned char h_source[ETH_ALEN];50 unsigned char h_dest[ETH_ALEN];
51 unsigned char h_source[ETH_ALEN];
52 );
51 __be16 h_vlan_proto;53 __be16 h_vlan_proto;
52 __be16 h_vlan_TCI;54 __be16 h_vlan_TCI;
53 __be16 h_vlan_encapsulated_proto;55 __be16 h_vlan_encapsulated_proto;
include/linux/iomap.h+2−0
@@ -263,9 +263,11 @@ struct iomap_ioend { · 262 unmodified lines
263 struct list_head io_list; /* next ioend in chain */263 struct list_head io_list; /* next ioend in chain */
264 u16 io_type;264 u16 io_type;
265 u16 io_flags; /* IOMAP_F_* */265 u16 io_flags; /* IOMAP_F_* */
266 u32 io_folios; /* folios added to ioend */
266 struct inode *io_inode; /* file being written to */267 struct inode *io_inode; /* file being written to */
267 size_t io_size; /* size of the extent */268 size_t io_size; /* size of the extent */
268 loff_t io_offset; /* offset in the file */269 loff_t io_offset; /* offset in the file */
270 sector_t io_sector; /* start sector of ioend */
269 struct bio *io_bio; /* bio being built */271 struct bio *io_bio; /* bio being built */
270 struct bio io_inline_bio; /* MUST BE LAST! */272 struct bio io_inline_bio; /* MUST BE LAST! */
271};273};
include/linux/kvm_host.h+109−3
@@ -29,7 +29,9 @@ · 28 unmodified lines
29#include <linux/refcount.h>29#include <linux/refcount.h>
30#include <linux/nospec.h>30#include <linux/nospec.h>
31#include <linux/notifier.h>31#include <linux/notifier.h>
32#include <linux/ftrace.h>
32#include <linux/hashtable.h>33#include <linux/hashtable.h>
34#include <linux/instrumentation.h>
33#include <linux/interval_tree.h>35#include <linux/interval_tree.h>
34#include <linux/rbtree.h>36#include <linux/rbtree.h>
35#include <linux/xarray.h>37#include <linux/xarray.h>
@@ -368,8 +370,11 @@ struct kvm_vcpu { · 332 unmodified lines
368 u64 last_used_slot_gen;370 u64 last_used_slot_gen;
369};371};
370 372
371/* must be called with irqs disabled */373/*
372static __always_inline void guest_enter_irqoff(void)374 * Start accounting time towards a guest.
375 * Must be called before entering guest context.
376 */
377static __always_inline void guest_timing_enter_irqoff(void)
373{378{
374 /*379 /*
375 * This is running in ioctl context so its safe to assume that it's the380 * This is running in ioctl context so its safe to assume that it's the
@@ -378,7 +383,18 @@ static __always_inline void guest_enter_irqoff(void) · 2 unmodified lines
378 instrumentation_begin();383 instrumentation_begin();
379 vtime_account_guest_enter();384 vtime_account_guest_enter();
380 instrumentation_end();385 instrumentation_end();
386}
381 387
388/*
389 * Enter guest context and enter an RCU extended quiescent state.
390 *
391 * Between guest_context_enter_irqoff() and guest_context_exit_irqoff() it is
392 * unsafe to use any code which may directly or indirectly use RCU, tracing
393 * (including IRQ flag tracing), or lockdep. All code in this period must be
394 * non-instrumentable.
395 */
396static __always_inline void guest_context_enter_irqoff(void)
397{
382 /*398 /*
383 * KVM does not hold any references to rcu protected data when it399 * KVM does not hold any references to rcu protected data when it
384 * switches CPU into a guest mode. In fact switching to a guest mode400 * switches CPU into a guest mode. In fact switching to a guest mode
@@ -394,16 +410,79 @@ static __always_inline void guest_enter_irqoff(void) · 9 unmodified lines
394 }410 }
395}411}
396 412
397static __always_inline void guest_exit_irqoff(void)413/*
414 * Deprecated. Architectures should move to guest_timing_enter_irqoff() and
415 * guest_state_enter_irqoff().
416 */
417static __always_inline void guest_enter_irqoff(void)
418{
419 guest_timing_enter_irqoff();
420 guest_context_enter_irqoff();
421}
422
423/**
424 * guest_state_enter_irqoff - Fixup state when entering a guest
425 *
426 * Entry to a guest will enable interrupts, but the kernel state is interrupts
427 * disabled when this is invoked. Also tell RCU about it.
428 *
429 * 1) Trace interrupts on state
430 * 2) Invoke context tracking if enabled to adjust RCU state
431 * 3) Tell lockdep that interrupts are enabled
432 *
433 * Invoked from architecture specific code before entering a guest.
434 * Must be called with interrupts disabled and the caller must be
435 * non-instrumentable.
436 * The caller has to invoke guest_timing_enter_irqoff() before this.
437 *
438 * Note: this is analogous to exit_to_user_mode().
439 */
440static __always_inline void guest_state_enter_irqoff(void)
441{
442 instrumentation_begin();
443 trace_hardirqs_on_prepare();
444 lockdep_hardirqs_on_prepare(CALLER_ADDR0);
445 instrumentation_end();
446
447 guest_context_enter_irqoff();
448 lockdep_hardirqs_on(CALLER_ADDR0);
449}
450
451/*
452 * Exit guest context and exit an RCU extended quiescent state.
453 *
454 * Between guest_context_enter_irqoff() and guest_context_exit_irqoff() it is
455 * unsafe to use any code which may directly or indirectly use RCU, tracing
456 * (including IRQ flag tracing), or lockdep. All code in this period must be
457 * non-instrumentable.
458 */
459static __always_inline void guest_context_exit_irqoff(void)
398{460{
399 context_tracking_guest_exit();461 context_tracking_guest_exit();
462}
400 463
464/*
465 * Stop accounting time towards a guest.
466 * Must be called after exiting guest context.
467 */
468static __always_inline void guest_timing_exit_irqoff(void)
469{
401 instrumentation_begin();470 instrumentation_begin();
402 /* Flush the guest cputime we spent on the guest */471 /* Flush the guest cputime we spent on the guest */
403 vtime_account_guest_exit();472 vtime_account_guest_exit();
404 instrumentation_end();473 instrumentation_end();
405}474}
406 475
476/*
477 * Deprecated. Architectures should move to guest_state_exit_irqoff() and
478 * guest_timing_exit_irqoff().
479 */
480static __always_inline void guest_exit_irqoff(void)
481{
482 guest_context_exit_irqoff();
483 guest_timing_exit_irqoff();
484}
485
407static inline void guest_exit(void)486static inline void guest_exit(void)
408{487{
409 unsigned long flags;488 unsigned long flags;
@@ -413,6 +492,33 @@ static inline void guest_exit(void) · 3 unmodified lines
413 local_irq_restore(flags);492 local_irq_restore(flags);
414}493}
415 494
495/**
496 * guest_state_exit_irqoff - Establish state when returning from guest mode
497 *
498 * Entry from a guest disables interrupts, but guest mode is traced as
499 * interrupts enabled. Also with NO_HZ_FULL RCU might be idle.
500 *
501 * 1) Tell lockdep that interrupts are disabled
502 * 2) Invoke context tracking if enabled to reactivate RCU
503 * 3) Trace interrupts off state
504 *
505 * Invoked from architecture specific code after exiting a guest.
506 * Must be invoked with interrupts disabled and the caller must be
507 * non-instrumentable.
508 * The caller has to invoke guest_timing_exit_irqoff() after this.
509 *
510 * Note: this is analogous to enter_from_user_mode().
511 */
512static __always_inline void guest_state_exit_irqoff(void)
513{
514 lockdep_hardirqs_off(CALLER_ADDR0);
515 guest_context_exit_irqoff();
516
517 instrumentation_begin();
518 trace_hardirqs_off_finish();
519 instrumentation_end();
520}
521
416static inline int kvm_vcpu_exiting_guest_mode(struct kvm_vcpu *vcpu)522static inline int kvm_vcpu_exiting_guest_mode(struct kvm_vcpu *vcpu)
417{523{
418 /*524 /*
include/linux/libata.h+1−0
@@ -380,6 +380,7 @@ enum { · 379 unmodified lines
380 ATA_HORKAGE_MAX_TRIM_128M = (1 << 26), /* Limit max trim size to 128M */380 ATA_HORKAGE_MAX_TRIM_128M = (1 << 26), /* Limit max trim size to 128M */
381 ATA_HORKAGE_NO_NCQ_ON_ATI = (1 << 27), /* Disable NCQ on ATI chipset */381 ATA_HORKAGE_NO_NCQ_ON_ATI = (1 << 27), /* Disable NCQ on ATI chipset */
382 ATA_HORKAGE_NO_ID_DEV_LOG = (1 << 28), /* Identify device log missing */382 ATA_HORKAGE_NO_ID_DEV_LOG = (1 << 28), /* Identify device log missing */
383 ATA_HORKAGE_NO_LOG_DIR = (1 << 29), /* Do not read log directory */
383 384
384 /* DMA mask for user DMA control: User visible values; DO NOT385 /* DMA mask for user DMA control: User visible values; DO NOT
385 renumber */386 renumber */
include/linux/netfs.h+7−0
@@ -244,6 +244,13 @@ struct netfs_cache_ops { · 243 unmodified lines
244 int (*prepare_write)(struct netfs_cache_resources *cres,244 int (*prepare_write)(struct netfs_cache_resources *cres,
245 loff_t *_start, size_t *_len, loff_t i_size,245 loff_t *_start, size_t *_len, loff_t i_size,
246 bool no_space_allocated_yet);246 bool no_space_allocated_yet);
247
248 /* Query the occupancy of the cache in a region, returning where the
249 * next chunk of data starts and how long it is.
250 */
251 int (*query_occupancy)(struct netfs_cache_resources *cres,
252 loff_t start, size_t len, size_t granularity,
253 loff_t *_data_start, size_t *_data_len);
247};254};
248 255
249struct readahead_control;256struct readahead_control;
include/linux/page_table_check.h+19−0
@@ -26,6 +26,9 @@ void __page_table_check_pmd_set(struct mm_struct *mm, unsigned long addr, · 25 unmodified lines
26 pmd_t *pmdp, pmd_t pmd);26 pmd_t *pmdp, pmd_t pmd);
27void __page_table_check_pud_set(struct mm_struct *mm, unsigned long addr,27void __page_table_check_pud_set(struct mm_struct *mm, unsigned long addr,
28 pud_t *pudp, pud_t pud);28 pud_t *pudp, pud_t pud);
29void __page_table_check_pte_clear_range(struct mm_struct *mm,
30 unsigned long addr,
31 pmd_t pmd);
29 32
30static inline void page_table_check_alloc(struct page *page, unsigned int order)33static inline void page_table_check_alloc(struct page *page, unsigned int order)
31{34{
@@ -100,6 +103,16 @@ static inline void page_table_check_pud_set(struct mm_struct *mm, · 68 unmodified lines
100 __page_table_check_pud_set(mm, addr, pudp, pud);103 __page_table_check_pud_set(mm, addr, pudp, pud);
101}104}
102 105
106static inline void page_table_check_pte_clear_range(struct mm_struct *mm,
107 unsigned long addr,
108 pmd_t pmd)
109{
110 if (static_branch_likely(&page_table_check_disabled))
111 return;
112
113 __page_table_check_pte_clear_range(mm, addr, pmd);
114}
115
103#else116#else
104 117
105static inline void page_table_check_alloc(struct page *page, unsigned int order)118static inline void page_table_check_alloc(struct page *page, unsigned int order)
@@ -143,5 +156,11 @@ static inline void page_table_check_pud_set(struct mm_struct *mm, · 37 unmodified lines
143{156{
144}157}
145 158
159static inline void page_table_check_pte_clear_range(struct mm_struct *mm,
160 unsigned long addr,
161 pmd_t pmd)
162{
163}
164
146#endif /* CONFIG_PAGE_TABLE_CHECK */165#endif /* CONFIG_PAGE_TABLE_CHECK */
147#endif /* __LINUX_PAGE_TABLE_CHECK_H */166#endif /* __LINUX_PAGE_TABLE_CHECK_H */
include/linux/pgtable.h+1−0
@@ -62,6 +62,7 @@ static inline unsigned long pte_index(unsigned long address) · 61 unmodified lines
62{62{
63 return (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1);63 return (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1);
64}64}
65#define pte_index pte_index
65 66
66#ifndef pmd_index67#ifndef pmd_index
67static inline unsigned long pmd_index(unsigned long address)68static inline unsigned long pmd_index(unsigned long address)
include/linux/sched.h+0−1
@@ -1680,7 +1680,6 @@ extern struct pid *cad_pid; · 1679 unmodified lines
1680#define PF_MEMALLOC 0x00000800 /* Allocating memory */1680#define PF_MEMALLOC 0x00000800 /* Allocating memory */
1681#define PF_NPROC_EXCEEDED 0x00001000 /* set_user() noticed that RLIMIT_NPROC was exceeded */1681#define PF_NPROC_EXCEEDED 0x00001000 /* set_user() noticed that RLIMIT_NPROC was exceeded */
1682#define PF_USED_MATH 0x00002000 /* If unset the fpu must be initialized before use */1682#define PF_USED_MATH 0x00002000 /* If unset the fpu must be initialized before use */
1683#define PF_USED_ASYNC 0x00004000 /* Used async_schedule*(), used by module init */
1684#define PF_NOFREEZE 0x00008000 /* This thread should not be frozen */1683#define PF_NOFREEZE 0x00008000 /* This thread should not be frozen */
1685#define PF_FROZEN 0x00010000 /* Frozen for system suspend */1684#define PF_FROZEN 0x00010000 /* Frozen for system suspend */
1686#define PF_KSWAPD 0x00020000 /* I am kswapd */1685#define PF_KSWAPD 0x00020000 /* I am kswapd */
include/net/ax25.h+12−0
@@ -239,6 +239,7 @@ typedef struct ax25_dev { · 238 unmodified lines
239#if defined(CONFIG_AX25_DAMA_SLAVE) || defined(CONFIG_AX25_DAMA_MASTER)239#if defined(CONFIG_AX25_DAMA_SLAVE) || defined(CONFIG_AX25_DAMA_MASTER)
240 ax25_dama_info dama;240 ax25_dama_info dama;
241#endif241#endif
242 refcount_t refcount;
242} ax25_dev;243} ax25_dev;
243 244
244typedef struct ax25_cb {245typedef struct ax25_cb {
@@ -293,6 +294,17 @@ static __inline__ void ax25_cb_put(ax25_cb *ax25) · 48 unmodified lines
293 }294 }
294}295}
295 296
297static inline void ax25_dev_hold(ax25_dev *ax25_dev)
298{
299 refcount_inc(&ax25_dev->refcount);
300}
301
302static inline void ax25_dev_put(ax25_dev *ax25_dev)
303{
304 if (refcount_dec_and_test(&ax25_dev->refcount)) {
305 kfree(ax25_dev);
306 }
307}
296static inline __be16 ax25_type_trans(struct sk_buff *skb, struct net_device *dev)308static inline __be16 ax25_type_trans(struct sk_buff *skb, struct net_device *dev)
297{309{
298 skb->dev = dev;310 skb->dev = dev;
include/net/neighbour.h+13−5
@@ -350,7 +350,8 @@ static inline struct neighbour *neigh_create(struct neigh_table *tbl, · 349 unmodified lines
350 return __neigh_create(tbl, pkey, dev, true);350 return __neigh_create(tbl, pkey, dev, true);
351}351}
352void neigh_destroy(struct neighbour *neigh);352void neigh_destroy(struct neighbour *neigh);
353int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb);353int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb,
354 const bool immediate_ok);
354int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new, u32 flags,355int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new, u32 flags,
355 u32 nlmsg_pid);356 u32 nlmsg_pid);
356void __neigh_set_probe_once(struct neighbour *neigh);357void __neigh_set_probe_once(struct neighbour *neigh);
@@ -460,17 +461,24 @@ static inline struct neighbour * neigh_clone(struct neighbour *neigh) · 103 unmodified lines
460 461
461#define neigh_hold(n) refcount_inc(&(n)->refcnt)462#define neigh_hold(n) refcount_inc(&(n)->refcnt)
462 463
463static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)464static __always_inline int neigh_event_send_probe(struct neighbour *neigh,
465 struct sk_buff *skb,
466 const bool immediate_ok)
464{467{
465 unsigned long now = jiffies;468 unsigned long now = jiffies;
466 469
467 if (READ_ONCE(neigh->used) != now)470 if (READ_ONCE(neigh->used) != now)
468 WRITE_ONCE(neigh->used, now);471 WRITE_ONCE(neigh->used, now);
469 if (!(neigh->nud_state&(NUD_CONNECTED|NUD_DELAY|NUD_PROBE)))472 if (!(neigh->nud_state & (NUD_CONNECTED | NUD_DELAY | NUD_PROBE)))
470 return __neigh_event_send(neigh, skb);473 return __neigh_event_send(neigh, skb, immediate_ok);
471 return 0;474 return 0;
472}475}
473 476
477static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
478{
479 return neigh_event_send_probe(neigh, skb, true);
480}
481
474#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)482#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
475static inline int neigh_hh_bridge(struct hh_cache *hh, struct sk_buff *skb)483static inline int neigh_hh_bridge(struct hh_cache *hh, struct sk_buff *skb)
476{484{
include/sound/pcm.h+15−0
@@ -617,6 +617,7 @@ void snd_pcm_stream_unlock(struct snd_pcm_substream *substream); · 616 unmodified lines
617void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream);617void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream);
618void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream);618void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream);
619unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream);619unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream);
620unsigned long _snd_pcm_stream_lock_irqsave_nested(struct snd_pcm_substream *substream);
620 621
621/**622/**
622 * snd_pcm_stream_lock_irqsave - Lock the PCM stream623 * snd_pcm_stream_lock_irqsave - Lock the PCM stream
@@ -635,6 +636,20 @@ unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream); · 12 unmodified lines
635void snd_pcm_stream_unlock_irqrestore(struct snd_pcm_substream *substream,636void snd_pcm_stream_unlock_irqrestore(struct snd_pcm_substream *substream,
636 unsigned long flags);637 unsigned long flags);
637 638
639/**
640 * snd_pcm_stream_lock_irqsave_nested - Single-nested PCM stream locking
641 * @substream: PCM substream
642 * @flags: irq flags
643 *
644 * This locks the PCM stream like snd_pcm_stream_lock_irqsave() but with
645 * the single-depth lockdep subclass.
646 */
647#define snd_pcm_stream_lock_irqsave_nested(substream, flags) \
648 do { \
649 typecheck(unsigned long, flags); \
650 flags = _snd_pcm_stream_lock_irqsave_nested(substream); \
651 } while (0)
652
638/**653/**
639 * snd_pcm_group_for_each_entry - iterate over the linked substreams654 * snd_pcm_group_for_each_entry - iterate over the linked substreams
640 * @s: the iterator655 * @s: the iterator
include/uapi/linux/kvm.h+3−3
@@ -1624,9 +1624,6 @@ struct kvm_enc_region { · 1623 unmodified lines
1624#define KVM_S390_NORMAL_RESET _IO(KVMIO, 0xc3)1624#define KVM_S390_NORMAL_RESET _IO(KVMIO, 0xc3)
1625#define KVM_S390_CLEAR_RESET _IO(KVMIO, 0xc4)1625#define KVM_S390_CLEAR_RESET _IO(KVMIO, 0xc4)
1626 1626
1627/* Available with KVM_CAP_XSAVE2 */
1628#define KVM_GET_XSAVE2 _IOR(KVMIO, 0xcf, struct kvm_xsave)
1629
1630struct kvm_s390_pv_sec_parm {1627struct kvm_s390_pv_sec_parm {
1631 __u64 origin;1628 __u64 origin;
1632 __u64 length;1629 __u64 length;
@@ -2048,4 +2045,7 @@ struct kvm_stats_desc { · 415 unmodified lines
2048 2045
2049#define KVM_GET_STATS_FD _IO(KVMIO, 0xce)2046#define KVM_GET_STATS_FD _IO(KVMIO, 0xce)
2050 2047
2048/* Available with KVM_CAP_XSAVE2 */
2049#define KVM_GET_XSAVE2 _IOR(KVMIO, 0xcf, struct kvm_xsave)
2050
2051#endif /* __LINUX_KVM_H */2051#endif /* __LINUX_KVM_H */
include/uapi/linux/smc_diag.h+5−6
@@ -84,12 +84,11 @@ struct smc_diag_conninfo { · 83 unmodified lines
84/* SMC_DIAG_LINKINFO */84/* SMC_DIAG_LINKINFO */
85 85
86struct smc_diag_linkinfo {86struct smc_diag_linkinfo {
87 __u8 link_id; /* link identifier */87 __u8 link_id; /* link identifier */
88 __u8 ibname[IB_DEVICE_NAME_MAX]; /* name of the RDMA device */88 __u8 ibname[IB_DEVICE_NAME_MAX]; /* name of the RDMA device */
89 __u8 ibport; /* RDMA device port number */89 __u8 ibport; /* RDMA device port number */
90 __u8 gid[40]; /* local GID */90 __u8 gid[40]; /* local GID */
91 __u8 peer_gid[40]; /* peer GID */91 __u8 peer_gid[40]; /* peer GID */
92 __aligned_u64 net_cookie; /* RDMA device net namespace */
93};92};
94 93
95struct smc_diag_lgrinfo {94struct smc_diag_lgrinfo {
include/uapi/sound/asound.h+3−1
@@ -56,8 +56,10 @@ · 55 unmodified lines
56 * *56 * *
57 ****************************************************************************/57 ****************************************************************************/
58 58
59#define AES_IEC958_STATUS_SIZE 24
60
59struct snd_aes_iec958 {61struct snd_aes_iec958 {
60 unsigned char status[24]; /* AES/IEC958 channel status bits */62 unsigned char status[AES_IEC958_STATUS_SIZE]; /* AES/IEC958 channel status bits */
61 unsigned char subcode[147]; /* AES/IEC958 subcode bits */63 unsigned char subcode[147]; /* AES/IEC958 subcode bits */
62 unsigned char pad; /* nothing */64 unsigned char pad; /* nothing */
63 unsigned char dig_subframe[4]; /* AES/IEC958 subframe bits */65 unsigned char dig_subframe[4]; /* AES/IEC958 subframe bits */
include/uapi/xen/gntdev.h+7−1
@@ -47,7 +47,13 @@ struct ioctl_gntdev_grant_ref { · 46 unmodified lines
47/*47/*
48 * Inserts the grant references into the mapping table of an instance48 * Inserts the grant references into the mapping table of an instance
49 * of gntdev. N.B. This does not perform the mapping, which is deferred49 * of gntdev. N.B. This does not perform the mapping, which is deferred
50 * until mmap() is called with @index as the offset.50 * until mmap() is called with @index as the offset. @index should be
51 * considered opaque to userspace, with one exception: if no grant
52 * references have ever been inserted into the mapping table of this
53 * instance, @index will be set to 0. This is necessary to use gntdev
54 * with userspace APIs that expect a file descriptor that can be
55 * mmap()'d at offset 0, such as Wayland. If @count is set to 0, this
56 * ioctl will fail.
51 */57 */
52#define IOCTL_GNTDEV_MAP_GRANT_REF \58#define IOCTL_GNTDEV_MAP_GRANT_REF \
53_IOC(_IOC_NONE, 'G', 0, sizeof(struct ioctl_gntdev_map_grant_ref))59_IOC(_IOC_NONE, 'G', 0, sizeof(struct ioctl_gntdev_map_grant_ref))
include/xen/xenbus_dev.h+0−2
@@ -1,6 +1,4 @@
1/******************************************************************************1/******************************************************************************
2 * evtchn.h
3 *
4 * Interface to /dev/xen/xenbus_backend.2 * Interface to /dev/xen/xenbus_backend.
5 *3 *
6 * Copyright (c) 2011 Bastian Blank <waldi@debian.org>4 * Copyright (c) 2011 Bastian Blank <waldi@debian.org>
ipc/sem.c+2−2
@@ -1964,6 +1964,7 @@ static struct sem_undo *find_alloc_undo(struct ipc_namespace *ns, int semid) · 1963 unmodified lines
1964 */1964 */
1965 un = lookup_undo(ulp, semid);1965 un = lookup_undo(ulp, semid);
1966 if (un) {1966 if (un) {
1967 spin_unlock(&ulp->lock);
1967 kvfree(new);1968 kvfree(new);
1968 goto success;1969 goto success;
1969 }1970 }
@@ -1976,9 +1977,8 @@ static struct sem_undo *find_alloc_undo(struct ipc_namespace *ns, int semid) · 6 unmodified lines
1976 ipc_assert_locked_object(&sma->sem_perm);1977 ipc_assert_locked_object(&sma->sem_perm);
1977 list_add(&new->list_id, &sma->list_id);1978 list_add(&new->list_id, &sma->list_id);
1978 un = new;1979 un = new;
1979
1980success:
1981 spin_unlock(&ulp->lock);1980 spin_unlock(&ulp->lock);
1981success:
1982 sem_unlock(sma, -1);1982 sem_unlock(sma, -1);
1983out:1983out:
1984 return un;1984 return un;
kernel/async.c+0−3
@@ -205,9 +205,6 @@ async_cookie_t async_schedule_node_domain(async_func_t func, void *data, · 204 unmodified lines
205 atomic_inc(&entry_count);205 atomic_inc(&entry_count);
206 spin_unlock_irqrestore(&async_lock, flags);206 spin_unlock_irqrestore(&async_lock, flags);
207 207
208 /* mark that this task has queued an async job, used by module init */
209 current->flags |= PF_USED_ASYNC;
210
211 /* schedule for execution */208 /* schedule for execution */
212 queue_work_node(node, system_unbound_wq, &entry->work);209 queue_work_node(node, system_unbound_wq, &entry->work);
213 210
kernel/audit.c+43−19
@@ -541,20 +541,22 @@ static void kauditd_printk_skb(struct sk_buff *skb) · 540 unmodified lines
541/**541/**
542 * kauditd_rehold_skb - Handle a audit record send failure in the hold queue542 * kauditd_rehold_skb - Handle a audit record send failure in the hold queue
543 * @skb: audit record543 * @skb: audit record
544 * @error: error code (unused)
544 *545 *
545 * Description:546 * Description:
546 * This should only be used by the kauditd_thread when it fails to flush the547 * This should only be used by the kauditd_thread when it fails to flush the
547 * hold queue.548 * hold queue.
548 */549 */
549static void kauditd_rehold_skb(struct sk_buff *skb)550static void kauditd_rehold_skb(struct sk_buff *skb, __always_unused int error)
550{551{
551 /* put the record back in the queue at the same place */552 /* put the record back in the queue */
552 skb_queue_head(&audit_hold_queue, skb);553 skb_queue_tail(&audit_hold_queue, skb);
553}554}
554 555
555/**556/**
556 * kauditd_hold_skb - Queue an audit record, waiting for auditd557 * kauditd_hold_skb - Queue an audit record, waiting for auditd
557 * @skb: audit record558 * @skb: audit record
559 * @error: error code
558 *560 *
559 * Description:561 * Description:
560 * Queue the audit record, waiting for an instance of auditd. When this562 * Queue the audit record, waiting for an instance of auditd. When this
@@ -564,19 +566,31 @@ static void kauditd_rehold_skb(struct sk_buff *skb) · 3 unmodified lines
564 * and queue it, if we have room. If we want to hold on to the record, but we566 * and queue it, if we have room. If we want to hold on to the record, but we
565 * don't have room, record a record lost message.567 * don't have room, record a record lost message.
566 */568 */
567static void kauditd_hold_skb(struct sk_buff *skb)569static void kauditd_hold_skb(struct sk_buff *skb, int error)
568{570{
569 /* at this point it is uncertain if we will ever send this to auditd so571 /* at this point it is uncertain if we will ever send this to auditd so
570 * try to send the message via printk before we go any further */572 * try to send the message via printk before we go any further */
571 kauditd_printk_skb(skb);573 kauditd_printk_skb(skb);
572 574
573 /* can we just silently drop the message? */575 /* can we just silently drop the message? */
574 if (!audit_default) {576 if (!audit_default)
575 kfree_skb(skb);577 goto drop;
576 return;578
579 /* the hold queue is only for when the daemon goes away completely,
580 * not -EAGAIN failures; if we are in a -EAGAIN state requeue the
581 * record on the retry queue unless it's full, in which case drop it
582 */
583 if (error == -EAGAIN) {
584 if (!audit_backlog_limit ||
585 skb_queue_len(&audit_retry_queue) < audit_backlog_limit) {
586 skb_queue_tail(&audit_retry_queue, skb);
587 return;
588 }
589 audit_log_lost("kauditd retry queue overflow");
590 goto drop;
577 }591 }
578 592
579 /* if we have room, queue the message */593 /* if we have room in the hold queue, queue the message */
580 if (!audit_backlog_limit ||594 if (!audit_backlog_limit ||
581 skb_queue_len(&audit_hold_queue) < audit_backlog_limit) {595 skb_queue_len(&audit_hold_queue) < audit_backlog_limit) {
582 skb_queue_tail(&audit_hold_queue, skb);596 skb_queue_tail(&audit_hold_queue, skb);
@@ -585,24 +599,32 @@ static void kauditd_hold_skb(struct sk_buff *skb) · 2 unmodified lines
585 599
586 /* we have no other options - drop the message */600 /* we have no other options - drop the message */
587 audit_log_lost("kauditd hold queue overflow");601 audit_log_lost("kauditd hold queue overflow");
602drop:
588 kfree_skb(skb);603 kfree_skb(skb);
589}604}
590 605
591/**606/**
592 * kauditd_retry_skb - Queue an audit record, attempt to send again to auditd607 * kauditd_retry_skb - Queue an audit record, attempt to send again to auditd
593 * @skb: audit record608 * @skb: audit record
609 * @error: error code (unused)
594 *610 *
595 * Description:611 * Description:
596 * Not as serious as kauditd_hold_skb() as we still have a connected auditd,612 * Not as serious as kauditd_hold_skb() as we still have a connected auditd,
597 * but for some reason we are having problems sending it audit records so613 * but for some reason we are having problems sending it audit records so
598 * queue the given record and attempt to resend.614 * queue the given record and attempt to resend.
599 */615 */
600static void kauditd_retry_skb(struct sk_buff *skb)616static void kauditd_retry_skb(struct sk_buff *skb, __always_unused int error)
601{617{
602 /* NOTE: because records should only live in the retry queue for a618 if (!audit_backlog_limit ||
603 * short period of time, before either being sent or moved to the hold619 skb_queue_len(&audit_retry_queue) < audit_backlog_limit) {
604 * queue, we don't currently enforce a limit on this queue */620 skb_queue_tail(&audit_retry_queue, skb);
605 skb_queue_tail(&audit_retry_queue, skb);621 return;
622 }
623
624 /* we have to drop the record, send it via printk as a last effort */
625 kauditd_printk_skb(skb);
626 audit_log_lost("kauditd retry queue overflow");
627 kfree_skb(skb);
606}628}
607 629
608/**630/**
@@ -640,7 +662,7 @@ static void auditd_reset(const struct auditd_connection *ac) · 31 unmodified lines
640 /* flush the retry queue to the hold queue, but don't touch the main662 /* flush the retry queue to the hold queue, but don't touch the main
641 * queue since we need to process that normally for multicast */663 * queue since we need to process that normally for multicast */
642 while ((skb = skb_dequeue(&audit_retry_queue)))664 while ((skb = skb_dequeue(&audit_retry_queue)))
643 kauditd_hold_skb(skb);665 kauditd_hold_skb(skb, -ECONNREFUSED);
644}666}
645 667
646/**668/**
@@ -714,16 +736,18 @@ static int kauditd_send_queue(struct sock *sk, u32 portid, · 67 unmodified lines
714 struct sk_buff_head *queue,736 struct sk_buff_head *queue,
715 unsigned int retry_limit,737 unsigned int retry_limit,
716 void (*skb_hook)(struct sk_buff *skb),738 void (*skb_hook)(struct sk_buff *skb),
717 void (*err_hook)(struct sk_buff *skb))739 void (*err_hook)(struct sk_buff *skb, int error))
718{740{
719 int rc = 0;741 int rc = 0;
720 struct sk_buff *skb;742 struct sk_buff *skb = NULL;
743 struct sk_buff *skb_tail;
721 unsigned int failed = 0;744 unsigned int failed = 0;
722 745
723 /* NOTE: kauditd_thread takes care of all our locking, we just use746 /* NOTE: kauditd_thread takes care of all our locking, we just use
724 * the netlink info passed to us (e.g. sk and portid) */747 * the netlink info passed to us (e.g. sk and portid) */
725 748
726 while ((skb = skb_dequeue(queue))) {749 skb_tail = skb_peek_tail(queue);
750 while ((skb != skb_tail) && (skb = skb_dequeue(queue))) {
727 /* call the skb_hook for each skb we touch */751 /* call the skb_hook for each skb we touch */
728 if (skb_hook)752 if (skb_hook)
729 (*skb_hook)(skb);753 (*skb_hook)(skb);
@@ -731,7 +755,7 @@ static int kauditd_send_queue(struct sock *sk, u32 portid, · 1 unmodified line
731 /* can we send to anyone via unicast? */755 /* can we send to anyone via unicast? */
732 if (!sk) {756 if (!sk) {
733 if (err_hook)757 if (err_hook)
734 (*err_hook)(skb);758 (*err_hook)(skb, -ECONNREFUSED);
735 continue;759 continue;
736 }760 }
737 761
@@ -745,7 +769,7 @@ retry: · 7 unmodified lines
745 rc == -ECONNREFUSED || rc == -EPERM) {769 rc == -ECONNREFUSED || rc == -EPERM) {
746 sk = NULL;770 sk = NULL;
747 if (err_hook)771 if (err_hook)
748 (*err_hook)(skb);772 (*err_hook)(skb, rc);
749 if (rc == -EAGAIN)773 if (rc == -EAGAIN)
750 rc = 0;774 rc = 0;
751 /* continue to drain the queue */775 /* continue to drain the queue */
kernel/bpf/bpf_lsm.c+1−1
@@ -207,7 +207,7 @@ BTF_ID(func, bpf_lsm_socket_socketpair) · 206 unmodified lines
207 207
208BTF_ID(func, bpf_lsm_syslog)208BTF_ID(func, bpf_lsm_syslog)
209BTF_ID(func, bpf_lsm_task_alloc)209BTF_ID(func, bpf_lsm_task_alloc)
210BTF_ID(func, bpf_lsm_task_getsecid_subj)210BTF_ID(func, bpf_lsm_current_getsecid_subj)
211BTF_ID(func, bpf_lsm_task_getsecid_obj)211BTF_ID(func, bpf_lsm_task_getsecid_obj)
212BTF_ID(func, bpf_lsm_task_prctl)212BTF_ID(func, bpf_lsm_task_prctl)
213BTF_ID(func, bpf_lsm_task_setscheduler)213BTF_ID(func, bpf_lsm_task_setscheduler)
kernel/bpf/ringbuf.c+1−1
@@ -104,7 +104,7 @@ static struct bpf_ringbuf *bpf_ringbuf_area_alloc(size_t data_sz, int numa_node) · 103 unmodified lines
104 }104 }
105 105
106 rb = vmap(pages, nr_meta_pages + 2 * nr_data_pages,106 rb = vmap(pages, nr_meta_pages + 2 * nr_data_pages,
107 VM_ALLOC | VM_USERMAP, PAGE_KERNEL);107 VM_MAP | VM_USERMAP, PAGE_KERNEL);
108 if (rb) {108 if (rb) {
109 kmemleak_not_leak(pages);109 kmemleak_not_leak(pages);
110 rb->pages = pages;110 rb->pages = pages;
kernel/bpf/trampoline.c+3−2
@@ -550,11 +550,12 @@ static __always_inline u64 notrace bpf_prog_start_time(void) · 549 unmodified lines
550static void notrace inc_misses_counter(struct bpf_prog *prog)550static void notrace inc_misses_counter(struct bpf_prog *prog)
551{551{
552 struct bpf_prog_stats *stats;552 struct bpf_prog_stats *stats;
553 unsigned int flags;
553 554
554 stats = this_cpu_ptr(prog->stats);555 stats = this_cpu_ptr(prog->stats);
555 u64_stats_update_begin(&stats->syncp);556 flags = u64_stats_update_begin_irqsave(&stats->syncp);
556 u64_stats_inc(&stats->misses);557 u64_stats_inc(&stats->misses);
557 u64_stats_update_end(&stats->syncp);558 u64_stats_update_end_irqrestore(&stats->syncp, flags);
558}559}
559 560
560/* The logic is similar to bpf_prog_run(), but with an explicit561/* The logic is similar to bpf_prog_run(), but with an explicit
kernel/cgroup/cgroup-v1.c+14−0
@@ -549,6 +549,14 @@ static ssize_t cgroup_release_agent_write(struct kernfs_open_file *of, · 548 unmodified lines
549 549
550 BUILD_BUG_ON(sizeof(cgrp->root->release_agent_path) < PATH_MAX);550 BUILD_BUG_ON(sizeof(cgrp->root->release_agent_path) < PATH_MAX);
551 551
552 /*
553 * Release agent gets called with all capabilities,
554 * require capabilities to set release agent.
555 */
556 if ((of->file->f_cred->user_ns != &init_user_ns) ||
557 !capable(CAP_SYS_ADMIN))
558 return -EPERM;
559
552 cgrp = cgroup_kn_lock_live(of->kn, false);560 cgrp = cgroup_kn_lock_live(of->kn, false);
553 if (!cgrp)561 if (!cgrp)
554 return -ENODEV;562 return -ENODEV;
@@ -954,6 +962,12 @@ int cgroup1_parse_param(struct fs_context *fc, struct fs_parameter *param) · 399 unmodified lines
954 /* Specifying two release agents is forbidden */962 /* Specifying two release agents is forbidden */
955 if (ctx->release_agent)963 if (ctx->release_agent)
956 return invalfc(fc, "release_agent respecified");964 return invalfc(fc, "release_agent respecified");
965 /*
966 * Release agent gets called with all capabilities,
967 * require capabilities to set release agent.
968 */
969 if ((fc->user_ns != &init_user_ns) || !capable(CAP_SYS_ADMIN))
970 return invalfc(fc, "Setting release_agent not allowed");
957 ctx->release_agent = param->string;971 ctx->release_agent = param->string;
958 param->string = NULL;972 param->string = NULL;
959 break;973 break;
kernel/cgroup/cpuset.c+51−14
@@ -590,6 +590,35 @@ static inline void free_cpuset(struct cpuset *cs) · 589 unmodified lines
590 kfree(cs);590 kfree(cs);
591}591}
592 592
593/*
594 * validate_change_legacy() - Validate conditions specific to legacy (v1)
595 * behavior.
596 */
597static int validate_change_legacy(struct cpuset *cur, struct cpuset *trial)
598{
599 struct cgroup_subsys_state *css;
600 struct cpuset *c, *par;
601 int ret;
602
603 WARN_ON_ONCE(!rcu_read_lock_held());
604
605 /* Each of our child cpusets must be a subset of us */
606 ret = -EBUSY;
607 cpuset_for_each_child(c, css, cur)
608 if (!is_cpuset_subset(c, trial))
609 goto out;
610
611 /* On legacy hierarchy, we must be a subset of our parent cpuset. */
612 ret = -EACCES;
613 par = parent_cs(cur);
614 if (par && !is_cpuset_subset(trial, par))
615 goto out;
616
617 ret = 0;
618out:
619 return ret;
620}
621
593/*622/*
594 * validate_change() - Used to validate that any proposed cpuset change623 * validate_change() - Used to validate that any proposed cpuset change
595 * follows the structural rules for cpusets.624 * follows the structural rules for cpusets.
@@ -614,20 +643,21 @@ static int validate_change(struct cpuset *cur, struct cpuset *trial) · 18 unmodified lines
614{643{
615 struct cgroup_subsys_state *css;644 struct cgroup_subsys_state *css;
616 struct cpuset *c, *par;645 struct cpuset *c, *par;
617 int ret;646 int ret = 0;
618
619 /* The checks don't apply to root cpuset */
620 if (cur == &top_cpuset)
621 return 0;
622 647
623 rcu_read_lock();648 rcu_read_lock();
624 par = parent_cs(cur);
625 649
626 /* On legacy hierarchy, we must be a subset of our parent cpuset. */650 if (!is_in_v2_mode())
627 ret = -EACCES;651 ret = validate_change_legacy(cur, trial);
628 if (!is_in_v2_mode() && !is_cpuset_subset(trial, par))652 if (ret)
653 goto out;
654
655 /* Remaining checks don't apply to root cpuset */
656 if (cur == &top_cpuset)
629 goto out;657 goto out;
630 658
659 par = parent_cs(cur);
660
631 /*661 /*
632 * If either I or some sibling (!= me) is exclusive, we can't662 * If either I or some sibling (!= me) is exclusive, we can't
633 * overlap663 * overlap
@@ -1175,9 +1205,7 @@ enum subparts_cmd { · 541 unmodified lines
1175 *1205 *
1176 * Because of the implicit cpu exclusive nature of a partition root,1206 * Because of the implicit cpu exclusive nature of a partition root,
1177 * cpumask changes that violates the cpu exclusivity rule will not be1207 * cpumask changes that violates the cpu exclusivity rule will not be
1178 * permitted when checked by validate_change(). The validate_change()1208 * permitted when checked by validate_change().
1179 * function will also prevent any changes to the cpu list if it is not
1180 * a superset of children's cpu lists.
1181 */1209 */
1182static int update_parent_subparts_cpumask(struct cpuset *cpuset, int cmd,1210static int update_parent_subparts_cpumask(struct cpuset *cpuset, int cmd,
1183 struct cpumask *newmask,1211 struct cpumask *newmask,
@@ -1522,10 +1550,15 @@ static void update_sibling_cpumasks(struct cpuset *parent, struct cpuset *cs, · 338 unmodified lines
1522 struct cpuset *sibling;1550 struct cpuset *sibling;
1523 struct cgroup_subsys_state *pos_css;1551 struct cgroup_subsys_state *pos_css;
1524 1552
1553 percpu_rwsem_assert_held(&cpuset_rwsem);
1554
1525 /*1555 /*
1526 * Check all its siblings and call update_cpumasks_hier()1556 * Check all its siblings and call update_cpumasks_hier()
1527 * if their use_parent_ecpus flag is set in order for them1557 * if their use_parent_ecpus flag is set in order for them
1528 * to use the right effective_cpus value.1558 * to use the right effective_cpus value.
1559 *
1560 * The update_cpumasks_hier() function may sleep. So we have to
1561 * release the RCU read lock before calling it.
1529 */1562 */
1530 rcu_read_lock();1563 rcu_read_lock();
1531 cpuset_for_each_child(sibling, pos_css, parent) {1564 cpuset_for_each_child(sibling, pos_css, parent) {
@@ -1533,8 +1566,13 @@ static void update_sibling_cpumasks(struct cpuset *parent, struct cpuset *cs, · 1 unmodified line
1533 continue;1566 continue;
1534 if (!sibling->use_parent_ecpus)1567 if (!sibling->use_parent_ecpus)
1535 continue;1568 continue;
1569 if (!css_tryget_online(&sibling->css))
1570 continue;
1536 1571
1572 rcu_read_unlock();
1537 update_cpumasks_hier(sibling, tmp);1573 update_cpumasks_hier(sibling, tmp);
1574 rcu_read_lock();
1575 css_put(&sibling->css);
1538 }1576 }
1539 rcu_read_unlock();1577 rcu_read_unlock();
1540}1578}
@@ -1607,8 +1645,7 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs, · 66 unmodified lines
1607 * Make sure that subparts_cpus is a subset of cpus_allowed.1645 * Make sure that subparts_cpus is a subset of cpus_allowed.
1608 */1646 */
1609 if (cs->nr_subparts_cpus) {1647 if (cs->nr_subparts_cpus) {
1610 cpumask_andnot(cs->subparts_cpus, cs->subparts_cpus,1648 cpumask_and(cs->subparts_cpus, cs->subparts_cpus, cs->cpus_allowed);
1611 cs->cpus_allowed);
1612 cs->nr_subparts_cpus = cpumask_weight(cs->subparts_cpus);1649 cs->nr_subparts_cpus = cpumask_weight(cs->subparts_cpus);
1613 }1650 }
1614 spin_unlock_irq(&callback_lock);1651 spin_unlock_irq(&callback_lock);
kernel/module.c+5−20
@@ -3725,12 +3725,6 @@ static noinline int do_init_module(struct module *mod) · 3724 unmodified lines
3725 }3725 }
3726 freeinit->module_init = mod->init_layout.base;3726 freeinit->module_init = mod->init_layout.base;
3727 3727
3728 /*
3729 * We want to find out whether @mod uses async during init. Clear
3730 * PF_USED_ASYNC. async_schedule*() will set it.
3731 */
3732 current->flags &= ~PF_USED_ASYNC;
3733
3734 do_mod_ctors(mod);3728 do_mod_ctors(mod);
3735 /* Start the module */3729 /* Start the module */
3736 if (mod->init != NULL)3730 if (mod->init != NULL)
@@ -3756,22 +3750,13 @@ static noinline int do_init_module(struct module *mod) · 19 unmodified lines
3756 3750
3757 /*3751 /*
3758 * We need to finish all async code before the module init sequence3752 * We need to finish all async code before the module init sequence
3759 * is done. This has potential to deadlock. For example, a newly3753 * is done. This has potential to deadlock if synchronous module
3760 * detected block device can trigger request_module() of the3754 * loading is requested from async (which is not allowed!).
3761 * default iosched from async probing task. Once userland helper
3762 * reaches here, async_synchronize_full() will wait on the async
3763 * task waiting on request_module() and deadlock.
3764 *
3765 * This deadlock is avoided by perfomring async_synchronize_full()
3766 * iff module init queued any async jobs. This isn't a full
3767 * solution as it will deadlock the same if module loading from
3768 * async jobs nests more than once; however, due to the various
3769 * constraints, this hack seems to be the best option for now.
3770 * Please refer to the following thread for details.
3771 *3755 *
3772 * http://thread.gmane.org/gmane.linux.kernel/14208143756 * See commit 0fdff3ec6d87 ("async, kmod: warn on synchronous
3757 * request_module() from async workers") for more details.
3773 */3758 */
3774 if (!mod->async_probe_requested && (current->flags & PF_USED_ASYNC))3759 if (!mod->async_probe_requested)
3775 async_synchronize_full();3760 async_synchronize_full();
3776 3761
3777 ftrace_free_mem(mod, mod->init_layout.base, mod->init_layout.base +3762 ftrace_free_mem(mod, mod->init_layout.base, mod->init_layout.base +
kernel/printk/sysctl.c+1−1
@@ -12,7 +12,7 @@ · 11 unmodified lines
12static const int ten_thousand = 10000;12static const int ten_thousand = 10000;
13 13
14static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,14static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
15 void __user *buffer, size_t *lenp, loff_t *ppos)15 void *buffer, size_t *lenp, loff_t *ppos)
16{16{
17 if (write && !capable(CAP_SYS_ADMIN))17 if (write && !capable(CAP_SYS_ADMIN))
18 return -EPERM;18 return -EPERM;
kernel/stackleak.c+2−3
@@ -70,7 +70,7 @@ late_initcall(stackleak_sysctls_init); · 69 unmodified lines
70#define skip_erasing() false70#define skip_erasing() false
71#endif /* CONFIG_STACKLEAK_RUNTIME_DISABLE */71#endif /* CONFIG_STACKLEAK_RUNTIME_DISABLE */
72 72
73asmlinkage void notrace stackleak_erase(void)73asmlinkage void noinstr stackleak_erase(void)
74{74{
75 /* It would be nice not to have 'kstack_ptr' and 'boundary' on stack */75 /* It would be nice not to have 'kstack_ptr' and 'boundary' on stack */
76 unsigned long kstack_ptr = current->lowest_stack;76 unsigned long kstack_ptr = current->lowest_stack;
@@ -124,9 +124,8 @@ asmlinkage void notrace stackleak_erase(void) · 47 unmodified lines
124 /* Reset the 'lowest_stack' value for the next syscall */124 /* Reset the 'lowest_stack' value for the next syscall */
125 current->lowest_stack = current_top_of_stack() - THREAD_SIZE/64;125 current->lowest_stack = current_top_of_stack() - THREAD_SIZE/64;
126}126}
127NOKPROBE_SYMBOL(stackleak_erase);
128 127
129void __used __no_caller_saved_registers notrace stackleak_track_stack(void)128void __used __no_caller_saved_registers noinstr stackleak_track_stack(void)
130{129{
131 unsigned long sp = current_stack_pointer;130 unsigned long sp = current_stack_pointer;
132 131
lib/crypto/blake2s.c+2−2
@@ -18,14 +18,14 @@ · 17 unmodified lines
18 18
19void blake2s_update(struct blake2s_state *state, const u8 *in, size_t inlen)19void blake2s_update(struct blake2s_state *state, const u8 *in, size_t inlen)
20{20{
21 __blake2s_update(state, in, inlen, blake2s_compress);21 __blake2s_update(state, in, inlen, false);
22}22}
23EXPORT_SYMBOL(blake2s_update);23EXPORT_SYMBOL(blake2s_update);
24 24
25void blake2s_final(struct blake2s_state *state, u8 *out)25void blake2s_final(struct blake2s_state *state, u8 *out)
26{26{
27 WARN_ON(IS_ENABLED(DEBUG) && !out);27 WARN_ON(IS_ENABLED(DEBUG) && !out);
28 __blake2s_final(state, out, blake2s_compress);28 __blake2s_final(state, out, false);
29 memzero_explicit(state, sizeof(*state));29 memzero_explicit(state, sizeof(*state));
30}30}
31EXPORT_SYMBOL(blake2s_final);31EXPORT_SYMBOL(blake2s_final);
mm/debug_vm_pgtable.c+2−0
@@ -171,6 +171,8 @@ static void __init pte_advanced_tests(struct pgtable_debug_args *args) · 170 unmodified lines
171 ptep_test_and_clear_young(args->vma, args->vaddr, args->ptep);171 ptep_test_and_clear_young(args->vma, args->vaddr, args->ptep);
172 pte = ptep_get(args->ptep);172 pte = ptep_get(args->ptep);
173 WARN_ON(pte_young(pte));173 WARN_ON(pte_young(pte));
174
175 ptep_get_and_clear_full(args->mm, args->vaddr, args->ptep, 1);
174}176}
175 177
176static void __init pte_savedwrite_tests(struct pgtable_debug_args *args)178static void __init pte_savedwrite_tests(struct pgtable_debug_args *args)
mm/gup.c+30−5
@@ -124,8 +124,8 @@ static inline struct page *try_get_compound_head(struct page *page, int refs) · 123 unmodified lines
124 * considered failure, and furthermore, a likely bug in the caller, so a warning124 * considered failure, and furthermore, a likely bug in the caller, so a warning
125 * is also emitted.125 * is also emitted.
126 */126 */
127struct page *try_grab_compound_head(struct page *page,127__maybe_unused struct page *try_grab_compound_head(struct page *page,
128 int refs, unsigned int flags)128 int refs, unsigned int flags)
129{129{
130 if (flags & FOLL_GET)130 if (flags & FOLL_GET)
131 return try_get_compound_head(page, refs);131 return try_get_compound_head(page, refs);
@@ -208,10 +208,35 @@ static void put_compound_head(struct page *page, int refs, unsigned int flags) · 76 unmodified lines
208 */208 */
209bool __must_check try_grab_page(struct page *page, unsigned int flags)209bool __must_check try_grab_page(struct page *page, unsigned int flags)
210{210{
211 if (!(flags & (FOLL_GET | FOLL_PIN)))211 WARN_ON_ONCE((flags & (FOLL_GET | FOLL_PIN)) == (FOLL_GET | FOLL_PIN));
212 return true;
213 212
214 return try_grab_compound_head(page, 1, flags);213 if (flags & FOLL_GET)
214 return try_get_page(page);
215 else if (flags & FOLL_PIN) {
216 int refs = 1;
217
218 page = compound_head(page);
219
220 if (WARN_ON_ONCE(page_ref_count(page) <= 0))
221 return false;
222
223 if (hpage_pincount_available(page))
224 hpage_pincount_add(page, 1);
225 else
226 refs = GUP_PIN_COUNTING_BIAS;
227
228 /*
229 * Similar to try_grab_compound_head(): even if using the
230 * hpage_pincount_add/_sub() routines, be sure to
231 * *also* increment the normal page refcount field at least
232 * once, so that the page really is pinned.
233 */
234 page_ref_add(page, refs);
235
236 mod_node_page_state(page_pgdat(page), NR_FOLL_PIN_ACQUIRED, 1);
237 }
238
239 return true;
215}240}
216 241
217/**242/**
mm/khugepaged.c+21−16
@@ -16,6 +16,7 @@ · 15 unmodified lines
16#include <linux/hashtable.h>16#include <linux/hashtable.h>
17#include <linux/userfaultfd_k.h>17#include <linux/userfaultfd_k.h>
18#include <linux/page_idle.h>18#include <linux/page_idle.h>
19#include <linux/page_table_check.h>
19#include <linux/swapops.h>20#include <linux/swapops.h>
20#include <linux/shmem_fs.h>21#include <linux/shmem_fs.h>
21 22
@@ -1416,6 +1417,21 @@ static int khugepaged_add_pte_mapped_thp(struct mm_struct *mm, · 1394 unmodified lines
1416 return 0;1417 return 0;
1417}1418}
1418 1419
1420static void collapse_and_free_pmd(struct mm_struct *mm, struct vm_area_struct *vma,
1421 unsigned long addr, pmd_t *pmdp)
1422{
1423 spinlock_t *ptl;
1424 pmd_t pmd;
1425
1426 mmap_assert_write_locked(mm);
1427 ptl = pmd_lock(vma->vm_mm, pmdp);
1428 pmd = pmdp_collapse_flush(vma, addr, pmdp);
1429 spin_unlock(ptl);
1430 mm_dec_nr_ptes(mm);
1431 page_table_check_pte_clear_range(mm, addr, pmd);
1432 pte_free(mm, pmd_pgtable(pmd));
1433}
1434
1419/**1435/**
1420 * collapse_pte_mapped_thp - Try to collapse a pte-mapped THP for mm at1436 * collapse_pte_mapped_thp - Try to collapse a pte-mapped THP for mm at
1421 * address haddr.1437 * address haddr.
@@ -1433,7 +1449,7 @@ void collapse_pte_mapped_thp(struct mm_struct *mm, unsigned long addr) · 11 unmodified lines
1433 struct vm_area_struct *vma = find_vma(mm, haddr);1449 struct vm_area_struct *vma = find_vma(mm, haddr);
1434 struct page *hpage;1450 struct page *hpage;
1435 pte_t *start_pte, *pte;1451 pte_t *start_pte, *pte;
1436 pmd_t *pmd, _pmd;1452 pmd_t *pmd;
1437 spinlock_t *ptl;1453 spinlock_t *ptl;
1438 int count = 0;1454 int count = 0;
1439 int i;1455 int i;
@@ -1509,12 +1525,7 @@ void collapse_pte_mapped_thp(struct mm_struct *mm, unsigned long addr) · 69 unmodified lines
1509 }1525 }
1510 1526
1511 /* step 4: collapse pmd */1527 /* step 4: collapse pmd */
1512 ptl = pmd_lock(vma->vm_mm, pmd);1528 collapse_and_free_pmd(mm, vma, haddr, pmd);
1513 _pmd = pmdp_collapse_flush(vma, haddr, pmd);
1514 spin_unlock(ptl);
1515 mm_dec_nr_ptes(mm);
1516 pte_free(mm, pmd_pgtable(_pmd));
1517
1518drop_hpage:1529drop_hpage:
1519 unlock_page(hpage);1530 unlock_page(hpage);
1520 put_page(hpage);1531 put_page(hpage);
@@ -1552,7 +1563,7 @@ static void retract_page_tables(struct address_space *mapping, pgoff_t pgoff) · 31 unmodified lines
1552 struct vm_area_struct *vma;1563 struct vm_area_struct *vma;
1553 struct mm_struct *mm;1564 struct mm_struct *mm;
1554 unsigned long addr;1565 unsigned long addr;
1555 pmd_t *pmd, _pmd;1566 pmd_t *pmd;
1556 1567
1557 i_mmap_lock_write(mapping);1568 i_mmap_lock_write(mapping);
1558 vma_interval_tree_foreach(vma, &mapping->i_mmap, pgoff, pgoff) {1569 vma_interval_tree_foreach(vma, &mapping->i_mmap, pgoff, pgoff) {
@@ -1591,14 +1602,8 @@ static void retract_page_tables(struct address_space *mapping, pgoff_t pgoff) · 32 unmodified lines
1591 * reverse order. Trylock is a way to avoid deadlock.1602 * reverse order. Trylock is a way to avoid deadlock.
1592 */1603 */
1593 if (mmap_write_trylock(mm)) {1604 if (mmap_write_trylock(mm)) {
1594 if (!khugepaged_test_exit(mm)) {1605 if (!khugepaged_test_exit(mm))
1595 spinlock_t *ptl = pmd_lock(mm, pmd);1606 collapse_and_free_pmd(mm, vma, addr, pmd);
1596 /* assume page table is clear */
1597 _pmd = pmdp_collapse_flush(vma, addr, pmd);
1598 spin_unlock(ptl);
1599 mm_dec_nr_ptes(mm);
1600 pte_free(mm, pmd_pgtable(_pmd));
1601 }
1602 mmap_write_unlock(mm);1607 mmap_write_unlock(mm);
1603 } else {1608 } else {
1604 /* Try again later */1609 /* Try again later */
mm/kmemleak.c+7−6
@@ -1410,7 +1410,8 @@ static void kmemleak_scan(void) · 1409 unmodified lines
1410{1410{
1411 unsigned long flags;1411 unsigned long flags;
1412 struct kmemleak_object *object;1412 struct kmemleak_object *object;
1413 int i;1413 struct zone *zone;
1414 int __maybe_unused i;
1414 int new_leaks = 0;1415 int new_leaks = 0;
1415 1416
1416 jiffies_last_scan = jiffies;1417 jiffies_last_scan = jiffies;
@@ -1450,9 +1451,9 @@ static void kmemleak_scan(void) · 33 unmodified lines
1450 * Struct page scanning for each node.1451 * Struct page scanning for each node.
1451 */1452 */
1452 get_online_mems();1453 get_online_mems();
1453 for_each_online_node(i) {1454 for_each_populated_zone(zone) {
1454 unsigned long start_pfn = node_start_pfn(i);1455 unsigned long start_pfn = zone->zone_start_pfn;
1455 unsigned long end_pfn = node_end_pfn(i);1456 unsigned long end_pfn = zone_end_pfn(zone);
1456 unsigned long pfn;1457 unsigned long pfn;
1457 1458
1458 for (pfn = start_pfn; pfn < end_pfn; pfn++) {1459 for (pfn = start_pfn; pfn < end_pfn; pfn++) {
@@ -1461,8 +1462,8 @@ static void kmemleak_scan(void) · 2 unmodified lines
1461 if (!page)1462 if (!page)
1462 continue;1463 continue;
1463 1464
1464 /* only scan pages belonging to this node */1465 /* only scan pages belonging to this zone */
1465 if (page_to_nid(page) != i)1466 if (page_zone(page) != zone)
1466 continue;1467 continue;
1467 /* only scan if page is in use */1468 /* only scan if page is in use */
1468 if (page_count(page) == 0)1469 if (page_count(page) == 0)
mm/page_isolation.c+1−1
@@ -115,7 +115,7 @@ static void unset_migratetype_isolate(struct page *page, unsigned migratetype) · 114 unmodified lines
115 * onlining - just onlined memory won't immediately be considered for115 * onlining - just onlined memory won't immediately be considered for
116 * allocation.116 * allocation.
117 */117 */
118 if (!isolated_page && PageBuddy(page)) {118 if (!isolated_page) {
119 nr_pages = move_freepages_block(zone, page, migratetype, NULL);119 nr_pages = move_freepages_block(zone, page, migratetype, NULL);
120 __mod_zone_freepage_state(zone, nr_pages, migratetype);120 __mod_zone_freepage_state(zone, nr_pages, migratetype);
121 }121 }
mm/page_table_check.c+27−28
@@ -86,8 +86,8 @@ static void page_table_check_clear(struct mm_struct *mm, unsigned long addr, · 85 unmodified lines
86{86{
87 struct page_ext *page_ext;87 struct page_ext *page_ext;
88 struct page *page;88 struct page *page;
89 unsigned long i;
89 bool anon;90 bool anon;
90 int i;
91 91
92 if (!pfn_valid(pfn))92 if (!pfn_valid(pfn))
93 return;93 return;
@@ -121,8 +121,8 @@ static void page_table_check_set(struct mm_struct *mm, unsigned long addr, · 27 unmodified lines
121{121{
122 struct page_ext *page_ext;122 struct page_ext *page_ext;
123 struct page *page;123 struct page *page;
124 unsigned long i;
124 bool anon;125 bool anon;
125 int i;
126 126
127 if (!pfn_valid(pfn))127 if (!pfn_valid(pfn))
128 return;128 return;
@@ -152,10 +152,10 @@ static void page_table_check_set(struct mm_struct *mm, unsigned long addr, · 23 unmodified lines
152void __page_table_check_zero(struct page *page, unsigned int order)152void __page_table_check_zero(struct page *page, unsigned int order)
153{153{
154 struct page_ext *page_ext = lookup_page_ext(page);154 struct page_ext *page_ext = lookup_page_ext(page);
155 int i;155 unsigned long i;
156 156
157 BUG_ON(!page_ext);157 BUG_ON(!page_ext);
158 for (i = 0; i < (1 << order); i++) {158 for (i = 0; i < (1ul << order); i++) {
159 struct page_table_check *ptc = get_page_table_check(page_ext);159 struct page_table_check *ptc = get_page_table_check(page_ext);
160 160
161 BUG_ON(atomic_read(&ptc->anon_map_count));161 BUG_ON(atomic_read(&ptc->anon_map_count));
@@ -206,17 +206,10 @@ EXPORT_SYMBOL(__page_table_check_pud_clear); · 44 unmodified lines
206void __page_table_check_pte_set(struct mm_struct *mm, unsigned long addr,206void __page_table_check_pte_set(struct mm_struct *mm, unsigned long addr,
207 pte_t *ptep, pte_t pte)207 pte_t *ptep, pte_t pte)
208{208{
209 pte_t old_pte;
210
211 if (&init_mm == mm)209 if (&init_mm == mm)
212 return;210 return;
213 211
214 old_pte = *ptep;212 __page_table_check_pte_clear(mm, addr, *ptep);
215 if (pte_user_accessible_page(old_pte)) {
216 page_table_check_clear(mm, addr, pte_pfn(old_pte),
217 PAGE_SIZE >> PAGE_SHIFT);
218 }
219
220 if (pte_user_accessible_page(pte)) {213 if (pte_user_accessible_page(pte)) {
221 page_table_check_set(mm, addr, pte_pfn(pte),214 page_table_check_set(mm, addr, pte_pfn(pte),
222 PAGE_SIZE >> PAGE_SHIFT,215 PAGE_SIZE >> PAGE_SHIFT,
@@ -228,17 +221,10 @@ EXPORT_SYMBOL(__page_table_check_pte_set); · 5 unmodified lines
228void __page_table_check_pmd_set(struct mm_struct *mm, unsigned long addr,221void __page_table_check_pmd_set(struct mm_struct *mm, unsigned long addr,
229 pmd_t *pmdp, pmd_t pmd)222 pmd_t *pmdp, pmd_t pmd)
230{223{
231 pmd_t old_pmd;
232
233 if (&init_mm == mm)224 if (&init_mm == mm)
234 return;225 return;
235 226
236 old_pmd = *pmdp;227 __page_table_check_pmd_clear(mm, addr, *pmdp);
237 if (pmd_user_accessible_page(old_pmd)) {
238 page_table_check_clear(mm, addr, pmd_pfn(old_pmd),
239 PMD_PAGE_SIZE >> PAGE_SHIFT);
240 }
241
242 if (pmd_user_accessible_page(pmd)) {228 if (pmd_user_accessible_page(pmd)) {
243 page_table_check_set(mm, addr, pmd_pfn(pmd),229 page_table_check_set(mm, addr, pmd_pfn(pmd),
244 PMD_PAGE_SIZE >> PAGE_SHIFT,230 PMD_PAGE_SIZE >> PAGE_SHIFT,
@@ -250,17 +236,10 @@ EXPORT_SYMBOL(__page_table_check_pmd_set); · 5 unmodified lines
250void __page_table_check_pud_set(struct mm_struct *mm, unsigned long addr,236void __page_table_check_pud_set(struct mm_struct *mm, unsigned long addr,
251 pud_t *pudp, pud_t pud)237 pud_t *pudp, pud_t pud)
252{238{
253 pud_t old_pud;
254
255 if (&init_mm == mm)239 if (&init_mm == mm)
256 return;240 return;
257 241
258 old_pud = *pudp;242 __page_table_check_pud_clear(mm, addr, *pudp);
259 if (pud_user_accessible_page(old_pud)) {
260 page_table_check_clear(mm, addr, pud_pfn(old_pud),
261 PUD_PAGE_SIZE >> PAGE_SHIFT);
262 }
263
264 if (pud_user_accessible_page(pud)) {243 if (pud_user_accessible_page(pud)) {
265 page_table_check_set(mm, addr, pud_pfn(pud),244 page_table_check_set(mm, addr, pud_pfn(pud),
266 PUD_PAGE_SIZE >> PAGE_SHIFT,245 PUD_PAGE_SIZE >> PAGE_SHIFT,
@@ -268,3 +247,23 @@ void __page_table_check_pud_set(struct mm_struct *mm, unsigned long addr, · 1 unmodified line
268 }247 }
269}248}
270EXPORT_SYMBOL(__page_table_check_pud_set);249EXPORT_SYMBOL(__page_table_check_pud_set);
250
251void __page_table_check_pte_clear_range(struct mm_struct *mm,
252 unsigned long addr,
253 pmd_t pmd)
254{
255 if (&init_mm == mm)
256 return;
257
258 if (!pmd_bad(pmd) && !pmd_leaf(pmd)) {
259 pte_t *ptep = pte_offset_map(&pmd, addr);
260 unsigned long i;
261
262 pte_unmap(ptep);
263 for (i = 0; i < PTRS_PER_PTE; i++) {
264 __page_table_check_pte_clear(mm, addr, *ptep);
265 addr += PAGE_SIZE;
266 ptep++;
267 }
268 }
269}
net/ax25/af_ax25.c+16−7
@@ -77,6 +77,7 @@ static void ax25_kill_by_device(struct net_device *dev) · 76 unmodified lines
77{77{
78 ax25_dev *ax25_dev;78 ax25_dev *ax25_dev;
79 ax25_cb *s;79 ax25_cb *s;
80 struct sock *sk;
80 81
81 if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL)82 if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL)
82 return;83 return;
@@ -85,13 +86,16 @@ static void ax25_kill_by_device(struct net_device *dev) · 2 unmodified lines
85again:86again:
86 ax25_for_each(s, &ax25_list) {87 ax25_for_each(s, &ax25_list) {
87 if (s->ax25_dev == ax25_dev) {88 if (s->ax25_dev == ax25_dev) {
89 sk = s->sk;
90 sock_hold(sk);
88 spin_unlock_bh(&ax25_list_lock);91 spin_unlock_bh(&ax25_list_lock);
89 lock_sock(s->sk);92 lock_sock(sk);
90 s->ax25_dev = NULL;93 s->ax25_dev = NULL;
91 release_sock(s->sk);94 ax25_dev_put(ax25_dev);
95 release_sock(sk);
92 ax25_disconnect(s, ENETUNREACH);96 ax25_disconnect(s, ENETUNREACH);
93 spin_lock_bh(&ax25_list_lock);97 spin_lock_bh(&ax25_list_lock);
94 98 sock_put(sk);
95 /* The entry could have been deleted from the99 /* The entry could have been deleted from the
96 * list meanwhile and thus the next pointer is100 * list meanwhile and thus the next pointer is
97 * no longer valid. Play it safe and restart101 * no longer valid. Play it safe and restart
@@ -355,21 +359,25 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void __user *arg) · 257 unmodified lines
355 if (copy_from_user(&ax25_ctl, arg, sizeof(ax25_ctl)))359 if (copy_from_user(&ax25_ctl, arg, sizeof(ax25_ctl)))
356 return -EFAULT;360 return -EFAULT;
357 361
358 if ((ax25_dev = ax25_addr_ax25dev(&ax25_ctl.port_addr)) == NULL)
359 return -ENODEV;
360
361 if (ax25_ctl.digi_count > AX25_MAX_DIGIS)362 if (ax25_ctl.digi_count > AX25_MAX_DIGIS)
362 return -EINVAL;363 return -EINVAL;
363 364
364 if (ax25_ctl.arg > ULONG_MAX / HZ && ax25_ctl.cmd != AX25_KILL)365 if (ax25_ctl.arg > ULONG_MAX / HZ && ax25_ctl.cmd != AX25_KILL)
365 return -EINVAL;366 return -EINVAL;
366 367
368 ax25_dev = ax25_addr_ax25dev(&ax25_ctl.port_addr);
369 if (!ax25_dev)
370 return -ENODEV;
371
367 digi.ndigi = ax25_ctl.digi_count;372 digi.ndigi = ax25_ctl.digi_count;
368 for (k = 0; k < digi.ndigi; k++)373 for (k = 0; k < digi.ndigi; k++)
369 digi.calls[k] = ax25_ctl.digi_addr[k];374 digi.calls[k] = ax25_ctl.digi_addr[k];
370 375
371 if ((ax25 = ax25_find_cb(&ax25_ctl.source_addr, &ax25_ctl.dest_addr, &digi, ax25_dev->dev)) == NULL)376 ax25 = ax25_find_cb(&ax25_ctl.source_addr, &ax25_ctl.dest_addr, &digi, ax25_dev->dev);
377 if (!ax25) {
378 ax25_dev_put(ax25_dev);
372 return -ENOTCONN;379 return -ENOTCONN;
380 }
373 381
374 switch (ax25_ctl.cmd) {382 switch (ax25_ctl.cmd) {
375 case AX25_KILL:383 case AX25_KILL:
@@ -436,6 +444,7 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void __user *arg) · 60 unmodified lines
436 }444 }
437 445
438out_put:446out_put:
447 ax25_dev_put(ax25_dev);
439 ax25_cb_put(ax25);448 ax25_cb_put(ax25);
440 return ret;449 return ret;
441 450
net/ax25/ax25_dev.c+23−5
@@ -37,6 +37,7 @@ ax25_dev *ax25_addr_ax25dev(ax25_address *addr) · 36 unmodified lines
37 for (ax25_dev = ax25_dev_list; ax25_dev != NULL; ax25_dev = ax25_dev->next)37 for (ax25_dev = ax25_dev_list; ax25_dev != NULL; ax25_dev = ax25_dev->next)
38 if (ax25cmp(addr, (const ax25_address *)ax25_dev->dev->dev_addr) == 0) {38 if (ax25cmp(addr, (const ax25_address *)ax25_dev->dev->dev_addr) == 0) {
39 res = ax25_dev;39 res = ax25_dev;
40 ax25_dev_hold(ax25_dev);
40 }41 }
41 spin_unlock_bh(&ax25_dev_lock);42 spin_unlock_bh(&ax25_dev_lock);
42 43
@@ -56,6 +57,7 @@ void ax25_dev_device_up(struct net_device *dev) · 13 unmodified lines
56 return;57 return;
57 }58 }
58 59
60 refcount_set(&ax25_dev->refcount, 1);
59 dev->ax25_ptr = ax25_dev;61 dev->ax25_ptr = ax25_dev;
60 ax25_dev->dev = dev;62 ax25_dev->dev = dev;
61 dev_hold_track(dev, &ax25_dev->dev_tracker, GFP_ATOMIC);63 dev_hold_track(dev, &ax25_dev->dev_tracker, GFP_ATOMIC);
@@ -84,6 +86,7 @@ void ax25_dev_device_up(struct net_device *dev) · 22 unmodified lines
84 ax25_dev->next = ax25_dev_list;86 ax25_dev->next = ax25_dev_list;
85 ax25_dev_list = ax25_dev;87 ax25_dev_list = ax25_dev;
86 spin_unlock_bh(&ax25_dev_lock);88 spin_unlock_bh(&ax25_dev_lock);
89 ax25_dev_hold(ax25_dev);
87 90
88 ax25_register_dev_sysctl(ax25_dev);91 ax25_register_dev_sysctl(ax25_dev);
89}92}
@@ -113,9 +116,10 @@ void ax25_dev_device_down(struct net_device *dev) · 23 unmodified lines
113 if ((s = ax25_dev_list) == ax25_dev) {116 if ((s = ax25_dev_list) == ax25_dev) {
114 ax25_dev_list = s->next;117 ax25_dev_list = s->next;
115 spin_unlock_bh(&ax25_dev_lock);118 spin_unlock_bh(&ax25_dev_lock);
119 ax25_dev_put(ax25_dev);
116 dev->ax25_ptr = NULL;120 dev->ax25_ptr = NULL;
117 dev_put_track(dev, &ax25_dev->dev_tracker);121 dev_put_track(dev, &ax25_dev->dev_tracker);
118 kfree(ax25_dev);122 ax25_dev_put(ax25_dev);
119 return;123 return;
120 }124 }
121 125
@@ -123,9 +127,10 @@ void ax25_dev_device_down(struct net_device *dev) · 1 unmodified line
123 if (s->next == ax25_dev) {127 if (s->next == ax25_dev) {
124 s->next = ax25_dev->next;128 s->next = ax25_dev->next;
125 spin_unlock_bh(&ax25_dev_lock);129 spin_unlock_bh(&ax25_dev_lock);
130 ax25_dev_put(ax25_dev);
126 dev->ax25_ptr = NULL;131 dev->ax25_ptr = NULL;
127 dev_put_track(dev, &ax25_dev->dev_tracker);132 dev_put_track(dev, &ax25_dev->dev_tracker);
128 kfree(ax25_dev);133 ax25_dev_put(ax25_dev);
129 return;134 return;
130 }135 }
131 136
@@ -133,6 +138,7 @@ void ax25_dev_device_down(struct net_device *dev) · 1 unmodified line
133 }138 }
134 spin_unlock_bh(&ax25_dev_lock);139 spin_unlock_bh(&ax25_dev_lock);
135 dev->ax25_ptr = NULL;140 dev->ax25_ptr = NULL;
141 ax25_dev_put(ax25_dev);
136}142}
137 143
138int ax25_fwd_ioctl(unsigned int cmd, struct ax25_fwd_struct *fwd)144int ax25_fwd_ioctl(unsigned int cmd, struct ax25_fwd_struct *fwd)
@@ -144,20 +150,32 @@ int ax25_fwd_ioctl(unsigned int cmd, struct ax25_fwd_struct *fwd) · 5 unmodified lines
144 150
145 switch (cmd) {151 switch (cmd) {
146 case SIOCAX25ADDFWD:152 case SIOCAX25ADDFWD:
147 if ((fwd_dev = ax25_addr_ax25dev(&fwd->port_to)) == NULL)153 fwd_dev = ax25_addr_ax25dev(&fwd->port_to);
154 if (!fwd_dev) {
155 ax25_dev_put(ax25_dev);
148 return -EINVAL;156 return -EINVAL;
149 if (ax25_dev->forward != NULL)157 }
158 if (ax25_dev->forward) {
159 ax25_dev_put(fwd_dev);
160 ax25_dev_put(ax25_dev);
150 return -EINVAL;161 return -EINVAL;
162 }
151 ax25_dev->forward = fwd_dev->dev;163 ax25_dev->forward = fwd_dev->dev;
164 ax25_dev_put(fwd_dev);
165 ax25_dev_put(ax25_dev);
152 break;166 break;
153 167
154 case SIOCAX25DELFWD:168 case SIOCAX25DELFWD:
155 if (ax25_dev->forward == NULL)169 if (!ax25_dev->forward) {
170 ax25_dev_put(ax25_dev);
156 return -EINVAL;171 return -EINVAL;
172 }
157 ax25_dev->forward = NULL;173 ax25_dev->forward = NULL;
174 ax25_dev_put(ax25_dev);
158 break;175 break;
159 176
160 default:177 default:
178 ax25_dev_put(ax25_dev);
161 return -EINVAL;179 return -EINVAL;
162 }180 }
163 181
net/ax25/ax25_route.c+11−2
@@ -75,11 +75,13 @@ static int __must_check ax25_rt_add(struct ax25_routes_struct *route) · 74 unmodified lines
75 ax25_dev *ax25_dev;75 ax25_dev *ax25_dev;
76 int i;76 int i;
77 77
78 if ((ax25_dev = ax25_addr_ax25dev(&route->port_addr)) == NULL)
79 return -EINVAL;
80 if (route->digi_count > AX25_MAX_DIGIS)78 if (route->digi_count > AX25_MAX_DIGIS)
81 return -EINVAL;79 return -EINVAL;
82 80
81 ax25_dev = ax25_addr_ax25dev(&route->port_addr);
82 if (!ax25_dev)
83 return -EINVAL;
84
83 write_lock_bh(&ax25_route_lock);85 write_lock_bh(&ax25_route_lock);
84 86
85 ax25_rt = ax25_route_list;87 ax25_rt = ax25_route_list;
@@ -91,6 +93,7 @@ static int __must_check ax25_rt_add(struct ax25_routes_struct *route) · 5 unmodified lines
91 if (route->digi_count != 0) {93 if (route->digi_count != 0) {
92 if ((ax25_rt->digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) == NULL) {94 if ((ax25_rt->digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) == NULL) {
93 write_unlock_bh(&ax25_route_lock);95 write_unlock_bh(&ax25_route_lock);
96 ax25_dev_put(ax25_dev);
94 return -ENOMEM;97 return -ENOMEM;
95 }98 }
96 ax25_rt->digipeat->lastrepeat = -1;99 ax25_rt->digipeat->lastrepeat = -1;
@@ -101,6 +104,7 @@ static int __must_check ax25_rt_add(struct ax25_routes_struct *route) · 4 unmodified lines
101 }104 }
102 }105 }
103 write_unlock_bh(&ax25_route_lock);106 write_unlock_bh(&ax25_route_lock);
107 ax25_dev_put(ax25_dev);
104 return 0;108 return 0;
105 }109 }
106 ax25_rt = ax25_rt->next;110 ax25_rt = ax25_rt->next;
@@ -108,6 +112,7 @@ static int __must_check ax25_rt_add(struct ax25_routes_struct *route) · 1 unmodified line
108 112
109 if ((ax25_rt = kmalloc(sizeof(ax25_route), GFP_ATOMIC)) == NULL) {113 if ((ax25_rt = kmalloc(sizeof(ax25_route), GFP_ATOMIC)) == NULL) {
110 write_unlock_bh(&ax25_route_lock);114 write_unlock_bh(&ax25_route_lock);
115 ax25_dev_put(ax25_dev);
111 return -ENOMEM;116 return -ENOMEM;
112 }117 }
113 118
@@ -120,6 +125,7 @@ static int __must_check ax25_rt_add(struct ax25_routes_struct *route) · 6 unmodified lines
120 if ((ax25_rt->digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) == NULL) {125 if ((ax25_rt->digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) == NULL) {
121 write_unlock_bh(&ax25_route_lock);126 write_unlock_bh(&ax25_route_lock);
122 kfree(ax25_rt);127 kfree(ax25_rt);
128 ax25_dev_put(ax25_dev);
123 return -ENOMEM;129 return -ENOMEM;
124 }130 }
125 ax25_rt->digipeat->lastrepeat = -1;131 ax25_rt->digipeat->lastrepeat = -1;
@@ -132,6 +138,7 @@ static int __must_check ax25_rt_add(struct ax25_routes_struct *route) · 6 unmodified lines
132 ax25_rt->next = ax25_route_list;138 ax25_rt->next = ax25_route_list;
133 ax25_route_list = ax25_rt;139 ax25_route_list = ax25_rt;
134 write_unlock_bh(&ax25_route_lock);140 write_unlock_bh(&ax25_route_lock);
141 ax25_dev_put(ax25_dev);
135 142
136 return 0;143 return 0;
137}144}
@@ -173,6 +180,7 @@ static int ax25_rt_del(struct ax25_routes_struct *route) · 35 unmodified lines
173 }180 }
174 }181 }
175 write_unlock_bh(&ax25_route_lock);182 write_unlock_bh(&ax25_route_lock);
183 ax25_dev_put(ax25_dev);
176 184
177 return 0;185 return 0;
178}186}
@@ -215,6 +223,7 @@ static int ax25_rt_opt(struct ax25_route_opt_struct *rt_option) · 36 unmodified lines
215 223
216out:224out:
217 write_unlock_bh(&ax25_route_lock);225 write_unlock_bh(&ax25_route_lock);
226 ax25_dev_put(ax25_dev);
218 return err;227 return err;
219}228}
220 229
net/bridge/netfilter/nft_reject_bridge.c+4−4
@@ -49,7 +49,7 @@ static void nft_reject_br_send_v4_tcp_reset(struct net *net, · 48 unmodified lines
49{49{
50 struct sk_buff *nskb;50 struct sk_buff *nskb;
51 51
52 nskb = nf_reject_skb_v4_tcp_reset(net, oldskb, dev, hook);52 nskb = nf_reject_skb_v4_tcp_reset(net, oldskb, NULL, hook);
53 if (!nskb)53 if (!nskb)
54 return;54 return;
55 55
@@ -65,7 +65,7 @@ static void nft_reject_br_send_v4_unreach(struct net *net, · 9 unmodified lines
65{65{
66 struct sk_buff *nskb;66 struct sk_buff *nskb;
67 67
68 nskb = nf_reject_skb_v4_unreach(net, oldskb, dev, hook, code);68 nskb = nf_reject_skb_v4_unreach(net, oldskb, NULL, hook, code);
69 if (!nskb)69 if (!nskb)
70 return;70 return;
71 71
@@ -81,7 +81,7 @@ static void nft_reject_br_send_v6_tcp_reset(struct net *net, · 9 unmodified lines
81{81{
82 struct sk_buff *nskb;82 struct sk_buff *nskb;
83 83
84 nskb = nf_reject_skb_v6_tcp_reset(net, oldskb, dev, hook);84 nskb = nf_reject_skb_v6_tcp_reset(net, oldskb, NULL, hook);
85 if (!nskb)85 if (!nskb)
86 return;86 return;
87 87
@@ -98,7 +98,7 @@ static void nft_reject_br_send_v6_unreach(struct net *net, · 10 unmodified lines
98{98{
99 struct sk_buff *nskb;99 struct sk_buff *nskb;
100 100
101 nskb = nf_reject_skb_v6_unreach(net, oldskb, dev, hook, code);101 nskb = nf_reject_skb_v6_unreach(net, oldskb, NULL, hook, code);
102 if (!nskb)102 if (!nskb)
103 return;103 return;
104 104
net/ceph/ceph_common.c+7−0
@@ -246,6 +246,7 @@ enum { · 245 unmodified lines
246 Opt_cephx_sign_messages,246 Opt_cephx_sign_messages,
247 Opt_tcp_nodelay,247 Opt_tcp_nodelay,
248 Opt_abort_on_full,248 Opt_abort_on_full,
249 Opt_rxbounce,
249};250};
250 251
251enum {252enum {
@@ -295,6 +296,7 @@ static const struct fs_parameter_spec ceph_parameters[] = { · 43 unmodified lines
295 fsparam_u32 ("osdkeepalive", Opt_osdkeepalivetimeout),296 fsparam_u32 ("osdkeepalive", Opt_osdkeepalivetimeout),
296 fsparam_enum ("read_from_replica", Opt_read_from_replica,297 fsparam_enum ("read_from_replica", Opt_read_from_replica,
297 ceph_param_read_from_replica),298 ceph_param_read_from_replica),
299 fsparam_flag ("rxbounce", Opt_rxbounce),
298 fsparam_enum ("ms_mode", Opt_ms_mode,300 fsparam_enum ("ms_mode", Opt_ms_mode,
299 ceph_param_ms_mode),301 ceph_param_ms_mode),
300 fsparam_string ("secret", Opt_secret),302 fsparam_string ("secret", Opt_secret),
@@ -584,6 +586,9 @@ int ceph_parse_param(struct fs_parameter *param, struct ceph_options *opt, · 283 unmodified lines
584 case Opt_abort_on_full:586 case Opt_abort_on_full:
585 opt->flags |= CEPH_OPT_ABORT_ON_FULL;587 opt->flags |= CEPH_OPT_ABORT_ON_FULL;
586 break;588 break;
589 case Opt_rxbounce:
590 opt->flags |= CEPH_OPT_RXBOUNCE;
591 break;
587 592
588 default:593 default:
589 BUG();594 BUG();
@@ -660,6 +665,8 @@ int ceph_print_client_options(struct seq_file *m, struct ceph_client *client, · 70 unmodified lines
660 seq_puts(m, "notcp_nodelay,");665 seq_puts(m, "notcp_nodelay,");
661 if (show_all && (opt->flags & CEPH_OPT_ABORT_ON_FULL))666 if (show_all && (opt->flags & CEPH_OPT_ABORT_ON_FULL))
662 seq_puts(m, "abort_on_full,");667 seq_puts(m, "abort_on_full,");
668 if (opt->flags & CEPH_OPT_RXBOUNCE)
669 seq_puts(m, "rxbounce,");
663 670
664 if (opt->mount_timeout != CEPH_MOUNT_TIMEOUT_DEFAULT)671 if (opt->mount_timeout != CEPH_MOUNT_TIMEOUT_DEFAULT)
665 seq_printf(m, "mount_timeout=%d,",672 seq_printf(m, "mount_timeout=%d,",
net/ceph/messenger.c+4−0
@@ -515,6 +515,10 @@ static void ceph_con_reset_protocol(struct ceph_connection *con) · 514 unmodified lines
515 ceph_msg_put(con->out_msg);515 ceph_msg_put(con->out_msg);
516 con->out_msg = NULL;516 con->out_msg = NULL;
517 }517 }
518 if (con->bounce_page) {
519 __free_page(con->bounce_page);
520 con->bounce_page = NULL;
521 }
518 522
519 if (ceph_msgr2(from_msgr(con->msgr)))523 if (ceph_msgr2(from_msgr(con->msgr)))
520 ceph_con_v2_reset_protocol(con);524 ceph_con_v2_reset_protocol(con);
net/ceph/messenger_v1.c+48−6
@@ -992,8 +992,7 @@ static int read_partial_message_section(struct ceph_connection *con, · 991 unmodified lines
992 992
993static int read_partial_msg_data(struct ceph_connection *con)993static int read_partial_msg_data(struct ceph_connection *con)
994{994{
995 struct ceph_msg *msg = con->in_msg;995 struct ceph_msg_data_cursor *cursor = &con->in_msg->cursor;
996 struct ceph_msg_data_cursor *cursor = &msg->cursor;
997 bool do_datacrc = !ceph_test_opt(from_msgr(con->msgr), NOCRC);996 bool do_datacrc = !ceph_test_opt(from_msgr(con->msgr), NOCRC);
998 struct page *page;997 struct page *page;
999 size_t page_offset;998 size_t page_offset;
@@ -1001,9 +1000,6 @@ static int read_partial_msg_data(struct ceph_connection *con) · 1 unmodified line
1001 u32 crc = 0;1000 u32 crc = 0;
1002 int ret;1001 int ret;
1003 1002
1004 if (!msg->num_data_items)
1005 return -EIO;
1006
1007 if (do_datacrc)1003 if (do_datacrc)
1008 crc = con->in_data_crc;1004 crc = con->in_data_crc;
1009 while (cursor->total_resid) {1005 while (cursor->total_resid) {
@@ -1031,6 +1027,46 @@ static int read_partial_msg_data(struct ceph_connection *con) · 21 unmodified lines
1031 return 1; /* must return > 0 to indicate success */1027 return 1; /* must return > 0 to indicate success */
1032}1028}
1033 1029
1030static int read_partial_msg_data_bounce(struct ceph_connection *con)
1031{
1032 struct ceph_msg_data_cursor *cursor = &con->in_msg->cursor;
1033 struct page *page;
1034 size_t off, len;
1035 u32 crc;
1036 int ret;
1037
1038 if (unlikely(!con->bounce_page)) {
1039 con->bounce_page = alloc_page(GFP_NOIO);
1040 if (!con->bounce_page) {
1041 pr_err("failed to allocate bounce page\n");
1042 return -ENOMEM;
1043 }
1044 }
1045
1046 crc = con->in_data_crc;
1047 while (cursor->total_resid) {
1048 if (!cursor->resid) {
1049 ceph_msg_data_advance(cursor, 0);
1050 continue;
1051 }
1052
1053 page = ceph_msg_data_next(cursor, &off, &len, NULL);
1054 ret = ceph_tcp_recvpage(con->sock, con->bounce_page, 0, len);
1055 if (ret <= 0) {
1056 con->in_data_crc = crc;
1057 return ret;
1058 }
1059
1060 crc = crc32c(crc, page_address(con->bounce_page), ret);
1061 memcpy_to_page(page, off, page_address(con->bounce_page), ret);
1062
1063 ceph_msg_data_advance(cursor, ret);
1064 }
1065 con->in_data_crc = crc;
1066
1067 return 1; /* must return > 0 to indicate success */
1068}
1069
1034/*1070/*
1035 * read (part of) a message.1071 * read (part of) a message.
1036 */1072 */
@@ -1141,7 +1177,13 @@ static int read_partial_message(struct ceph_connection *con) · 104 unmodified lines
1141 1177
1142 /* (page) data */1178 /* (page) data */
1143 if (data_len) {1179 if (data_len) {
1144 ret = read_partial_msg_data(con);1180 if (!m->num_data_items)
1181 return -EIO;
1182
1183 if (ceph_test_opt(from_msgr(con->msgr), RXBOUNCE))
1184 ret = read_partial_msg_data_bounce(con);
1185 else
1186 ret = read_partial_msg_data(con);
1145 if (ret <= 0)1187 if (ret <= 0)
1146 return ret;1188 return ret;
1147 }1189 }
net/ceph/messenger_v2.c+186−64
@@ -57,8 +57,9 @@ · 56 unmodified lines
57#define IN_S_HANDLE_CONTROL_REMAINDER 357#define IN_S_HANDLE_CONTROL_REMAINDER 3
58#define IN_S_PREPARE_READ_DATA 458#define IN_S_PREPARE_READ_DATA 4
59#define IN_S_PREPARE_READ_DATA_CONT 559#define IN_S_PREPARE_READ_DATA_CONT 5
60#define IN_S_HANDLE_EPILOGUE 660#define IN_S_PREPARE_READ_ENC_PAGE 6
61#define IN_S_FINISH_SKIP 761#define IN_S_HANDLE_EPILOGUE 7
62#define IN_S_FINISH_SKIP 8
62 63
63#define OUT_S_QUEUE_DATA 164#define OUT_S_QUEUE_DATA 1
64#define OUT_S_QUEUE_DATA_CONT 265#define OUT_S_QUEUE_DATA_CONT 2
@@ -1032,22 +1033,41 @@ static int decrypt_control_remainder(struct ceph_connection *con) · 967 unmodified lines
1032 padded_len(rem_len) + CEPH_GCM_TAG_LEN);1033 padded_len(rem_len) + CEPH_GCM_TAG_LEN);
1033}1034}
1034 1035
1035static int decrypt_message(struct ceph_connection *con)1036static int decrypt_tail(struct ceph_connection *con)
1036{1037{
1038 struct sg_table enc_sgt = {};
1037 struct sg_table sgt = {};1039 struct sg_table sgt = {};
1040 int tail_len;
1038 int ret;1041 int ret;
1039 1042
1043 tail_len = tail_onwire_len(con->in_msg, true);
1044 ret = sg_alloc_table_from_pages(&enc_sgt, con->v2.in_enc_pages,
1045 con->v2.in_enc_page_cnt, 0, tail_len,
1046 GFP_NOIO);
1047 if (ret)
1048 goto out;
1049
1040 ret = setup_message_sgs(&sgt, con->in_msg, FRONT_PAD(con->v2.in_buf),1050 ret = setup_message_sgs(&sgt, con->in_msg, FRONT_PAD(con->v2.in_buf),
1041 MIDDLE_PAD(con->v2.in_buf), DATA_PAD(con->v2.in_buf),1051 MIDDLE_PAD(con->v2.in_buf), DATA_PAD(con->v2.in_buf),
1042 con->v2.in_buf, true);1052 con->v2.in_buf, true);
1043 if (ret)1053 if (ret)
1044 goto out;1054 goto out;
1045 1055
1046 ret = gcm_crypt(con, false, sgt.sgl, sgt.sgl,1056 dout("%s con %p msg %p enc_page_cnt %d sg_cnt %d\n", __func__, con,
1047 tail_onwire_len(con->in_msg, true));1057 con->in_msg, con->v2.in_enc_page_cnt, sgt.orig_nents);
1058 ret = gcm_crypt(con, false, enc_sgt.sgl, sgt.sgl, tail_len);
1059 if (ret)
1060 goto out;
1061
1062 WARN_ON(!con->v2.in_enc_page_cnt);
1063 ceph_release_page_vector(con->v2.in_enc_pages,
1064 con->v2.in_enc_page_cnt);
1065 con->v2.in_enc_pages = NULL;
1066 con->v2.in_enc_page_cnt = 0;
1048 1067
1049out:1068out:
1050 sg_free_table(&sgt);1069 sg_free_table(&sgt);
1070 sg_free_table(&enc_sgt);
1051 return ret;1071 return ret;
1052}1072}
1053 1073
@@ -1733,54 +1753,157 @@ static int prepare_read_control_remainder(struct ceph_connection *con) · 679 unmodified lines
1733 return 0;1753 return 0;
1734}1754}
1735 1755
1736static void prepare_read_data(struct ceph_connection *con)1756static int prepare_read_data(struct ceph_connection *con)
1737{1757{
1738 struct bio_vec bv;1758 struct bio_vec bv;
1739 1759
1740 if (!con_secure(con))1760 con->in_data_crc = -1;
1741 con->in_data_crc = -1;
1742 ceph_msg_data_cursor_init(&con->v2.in_cursor, con->in_msg,1761 ceph_msg_data_cursor_init(&con->v2.in_cursor, con->in_msg,
1743 data_len(con->in_msg));1762 data_len(con->in_msg));
1744 1763
1745 get_bvec_at(&con->v2.in_cursor, &bv);1764 get_bvec_at(&con->v2.in_cursor, &bv);
1746 set_in_bvec(con, &bv);1765 if (ceph_test_opt(from_msgr(con->msgr), RXBOUNCE)) {
1766 if (unlikely(!con->bounce_page)) {
1767 con->bounce_page = alloc_page(GFP_NOIO);
1768 if (!con->bounce_page) {
1769 pr_err("failed to allocate bounce page\n");
1770 return -ENOMEM;
1771 }
1772 }
1773
1774 bv.bv_page = con->bounce_page;
1775 bv.bv_offset = 0;
1776 set_in_bvec(con, &bv);
1777 } else {
1778 set_in_bvec(con, &bv);
1779 }
1747 con->v2.in_state = IN_S_PREPARE_READ_DATA_CONT;1780 con->v2.in_state = IN_S_PREPARE_READ_DATA_CONT;
1781 return 0;
1748}1782}
1749 1783
1750static void prepare_read_data_cont(struct ceph_connection *con)1784static void prepare_read_data_cont(struct ceph_connection *con)
1751{1785{
1752 struct bio_vec bv;1786 struct bio_vec bv;
1753 1787
1754 if (!con_secure(con))1788 if (ceph_test_opt(from_msgr(con->msgr), RXBOUNCE)) {
1789 con->in_data_crc = crc32c(con->in_data_crc,
1790 page_address(con->bounce_page),
1791 con->v2.in_bvec.bv_len);
1792
1793 get_bvec_at(&con->v2.in_cursor, &bv);
1794 memcpy_to_page(bv.bv_page, bv.bv_offset,
1795 page_address(con->bounce_page),
1796 con->v2.in_bvec.bv_len);
1797 } else {
1755 con->in_data_crc = ceph_crc32c_page(con->in_data_crc,1798 con->in_data_crc = ceph_crc32c_page(con->in_data_crc,
1756 con->v2.in_bvec.bv_page,1799 con->v2.in_bvec.bv_page,
1757 con->v2.in_bvec.bv_offset,1800 con->v2.in_bvec.bv_offset,
1758 con->v2.in_bvec.bv_len);1801 con->v2.in_bvec.bv_len);
1802 }
1759 1803
1760 ceph_msg_data_advance(&con->v2.in_cursor, con->v2.in_bvec.bv_len);1804 ceph_msg_data_advance(&con->v2.in_cursor, con->v2.in_bvec.bv_len);
1761 if (con->v2.in_cursor.total_resid) {1805 if (con->v2.in_cursor.total_resid) {
1762 get_bvec_at(&con->v2.in_cursor, &bv);1806 get_bvec_at(&con->v2.in_cursor, &bv);
1763 set_in_bvec(con, &bv);1807 if (ceph_test_opt(from_msgr(con->msgr), RXBOUNCE)) {
1808 bv.bv_page = con->bounce_page;
1809 bv.bv_offset = 0;
1810 set_in_bvec(con, &bv);
1811 } else {
1812 set_in_bvec(con, &bv);
1813 }
1764 WARN_ON(con->v2.in_state != IN_S_PREPARE_READ_DATA_CONT);1814 WARN_ON(con->v2.in_state != IN_S_PREPARE_READ_DATA_CONT);
1765 return;1815 return;
1766 }1816 }
1767 1817
1768 /*1818 /*
1769 * We've read all data. Prepare to read data padding (if any)1819 * We've read all data. Prepare to read epilogue.
1770 * and epilogue.
1771 */1820 */
1772 reset_in_kvecs(con);1821 reset_in_kvecs(con);
1773 if (con_secure(con)) {1822 add_in_kvec(con, con->v2.in_buf, CEPH_EPILOGUE_PLAIN_LEN);
1774 if (need_padding(data_len(con->in_msg)))1823 con->v2.in_state = IN_S_HANDLE_EPILOGUE;
1775 add_in_kvec(con, DATA_PAD(con->v2.in_buf),1824}
1776 padding_len(data_len(con->in_msg)));1825
1777 add_in_kvec(con, con->v2.in_buf, CEPH_EPILOGUE_SECURE_LEN);1826static int prepare_read_tail_plain(struct ceph_connection *con)
1827{
1828 struct ceph_msg *msg = con->in_msg;
1829
1830 if (!front_len(msg) && !middle_len(msg)) {
1831 WARN_ON(!data_len(msg));
1832 return prepare_read_data(con);
1833 }
1834
1835 reset_in_kvecs(con);
1836 if (front_len(msg)) {
1837 add_in_kvec(con, msg->front.iov_base, front_len(msg));
1838 WARN_ON(msg->front.iov_len != front_len(msg));
1839 }
1840 if (middle_len(msg)) {
1841 add_in_kvec(con, msg->middle->vec.iov_base, middle_len(msg));
1842 WARN_ON(msg->middle->vec.iov_len != middle_len(msg));
1843 }
1844
1845 if (data_len(msg)) {
1846 con->v2.in_state = IN_S_PREPARE_READ_DATA;
1778 } else {1847 } else {
1779 add_in_kvec(con, con->v2.in_buf, CEPH_EPILOGUE_PLAIN_LEN);1848 add_in_kvec(con, con->v2.in_buf, CEPH_EPILOGUE_PLAIN_LEN);
1849 con->v2.in_state = IN_S_HANDLE_EPILOGUE;
1780 }1850 }
1851 return 0;
1852}
1853
1854static void prepare_read_enc_page(struct ceph_connection *con)
1855{
1856 struct bio_vec bv;
1857
1858 dout("%s con %p i %d resid %d\n", __func__, con, con->v2.in_enc_i,
1859 con->v2.in_enc_resid);
1860 WARN_ON(!con->v2.in_enc_resid);
1861
1862 bv.bv_page = con->v2.in_enc_pages[con->v2.in_enc_i];
1863 bv.bv_offset = 0;
1864 bv.bv_len = min(con->v2.in_enc_resid, (int)PAGE_SIZE);
1865
1866 set_in_bvec(con, &bv);
1867 con->v2.in_enc_i++;
1868 con->v2.in_enc_resid -= bv.bv_len;
1869
1870 if (con->v2.in_enc_resid) {
1871 con->v2.in_state = IN_S_PREPARE_READ_ENC_PAGE;
1872 return;
1873 }
1874
1875 /*
1876 * We are set to read the last piece of ciphertext (ending
1877 * with epilogue) + auth tag.
1878 */
1879 WARN_ON(con->v2.in_enc_i != con->v2.in_enc_page_cnt);
1781 con->v2.in_state = IN_S_HANDLE_EPILOGUE;1880 con->v2.in_state = IN_S_HANDLE_EPILOGUE;
1782}1881}
1783 1882
1883static int prepare_read_tail_secure(struct ceph_connection *con)
1884{
1885 struct page **enc_pages;
1886 int enc_page_cnt;
1887 int tail_len;
1888
1889 tail_len = tail_onwire_len(con->in_msg, true);
1890 WARN_ON(!tail_len);
1891
1892 enc_page_cnt = calc_pages_for(0, tail_len);
1893 enc_pages = ceph_alloc_page_vector(enc_page_cnt, GFP_NOIO);
1894 if (IS_ERR(enc_pages))
1895 return PTR_ERR(enc_pages);
1896
1897 WARN_ON(con->v2.in_enc_pages || con->v2.in_enc_page_cnt);
1898 con->v2.in_enc_pages = enc_pages;
1899 con->v2.in_enc_page_cnt = enc_page_cnt;
1900 con->v2.in_enc_resid = tail_len;
1901 con->v2.in_enc_i = 0;
1902
1903 prepare_read_enc_page(con);
1904 return 0;
1905}
1906
1784static void __finish_skip(struct ceph_connection *con)1907static void __finish_skip(struct ceph_connection *con)
1785{1908{
1786 con->in_seq++;1909 con->in_seq++;
@@ -2589,47 +2712,26 @@ static int __handle_control(struct ceph_connection *con, void *p) · 802 unmodified lines
2589 }2712 }
2590 2713
2591 msg = con->in_msg; /* set in process_message_header() */2714 msg = con->in_msg; /* set in process_message_header() */
2592 if (!front_len(msg) && !middle_len(msg)) {
2593 if (!data_len(msg))
2594 return process_message(con);
2595
2596 prepare_read_data(con);
2597 return 0;
2598 }
2599
2600 reset_in_kvecs(con);
2601 if (front_len(msg)) {2715 if (front_len(msg)) {
2602 WARN_ON(front_len(msg) > msg->front_alloc_len);2716 WARN_ON(front_len(msg) > msg->front_alloc_len);
2603 add_in_kvec(con, msg->front.iov_base, front_len(msg));
2604 msg->front.iov_len = front_len(msg);2717 msg->front.iov_len = front_len(msg);
2605
2606 if (con_secure(con) && need_padding(front_len(msg)))
2607 add_in_kvec(con, FRONT_PAD(con->v2.in_buf),
2608 padding_len(front_len(msg)));
2609 } else {2718 } else {
2610 msg->front.iov_len = 0;2719 msg->front.iov_len = 0;
2611 }2720 }
2612 if (middle_len(msg)) {2721 if (middle_len(msg)) {
2613 WARN_ON(middle_len(msg) > msg->middle->alloc_len);2722 WARN_ON(middle_len(msg) > msg->middle->alloc_len);
2614 add_in_kvec(con, msg->middle->vec.iov_base, middle_len(msg));
2615 msg->middle->vec.iov_len = middle_len(msg);2723 msg->middle->vec.iov_len = middle_len(msg);
2616
2617 if (con_secure(con) && need_padding(middle_len(msg)))
2618 add_in_kvec(con, MIDDLE_PAD(con->v2.in_buf),
2619 padding_len(middle_len(msg)));
2620 } else if (msg->middle) {2724 } else if (msg->middle) {
2621 msg->middle->vec.iov_len = 0;2725 msg->middle->vec.iov_len = 0;
2622 }2726 }
2623 2727
2624 if (data_len(msg)) {2728 if (!front_len(msg) && !middle_len(msg) && !data_len(msg))
2625 con->v2.in_state = IN_S_PREPARE_READ_DATA;2729 return process_message(con);
2626 } else {2730
2627 add_in_kvec(con, con->v2.in_buf,2731 if (con_secure(con))
2628 con_secure(con) ? CEPH_EPILOGUE_SECURE_LEN :2732 return prepare_read_tail_secure(con);
2629 CEPH_EPILOGUE_PLAIN_LEN);2733
2630 con->v2.in_state = IN_S_HANDLE_EPILOGUE;2734 return prepare_read_tail_plain(con);
2631 }
2632 return 0;
2633}2735}
2634 2736
2635static int handle_preamble(struct ceph_connection *con)2737static int handle_preamble(struct ceph_connection *con)
@@ -2717,7 +2819,7 @@ static int handle_epilogue(struct ceph_connection *con) · 81 unmodified lines
2717 int ret;2819 int ret;
2718 2820
2719 if (con_secure(con)) {2821 if (con_secure(con)) {
2720 ret = decrypt_message(con);2822 ret = decrypt_tail(con);
2721 if (ret) {2823 if (ret) {
2722 if (ret == -EBADMSG)2824 if (ret == -EBADMSG)
2723 con->error_msg = "integrity error, bad epilogue auth tag";2825 con->error_msg = "integrity error, bad epilogue auth tag";
@@ -2785,13 +2887,16 @@ static int populate_in_iter(struct ceph_connection *con) · 61 unmodified lines
2785 ret = handle_control_remainder(con);2887 ret = handle_control_remainder(con);
2786 break;2888 break;
2787 case IN_S_PREPARE_READ_DATA:2889 case IN_S_PREPARE_READ_DATA:
2788 prepare_read_data(con);2890 ret = prepare_read_data(con);
2789 ret = 0;
2790 break;2891 break;
2791 case IN_S_PREPARE_READ_DATA_CONT:2892 case IN_S_PREPARE_READ_DATA_CONT:
2792 prepare_read_data_cont(con);2893 prepare_read_data_cont(con);
2793 ret = 0;2894 ret = 0;
2794 break;2895 break;
2896 case IN_S_PREPARE_READ_ENC_PAGE:
2897 prepare_read_enc_page(con);
2898 ret = 0;
2899 break;
2795 case IN_S_HANDLE_EPILOGUE:2900 case IN_S_HANDLE_EPILOGUE:
2796 ret = handle_epilogue(con);2901 ret = handle_epilogue(con);
2797 break;2902 break;
@@ -3326,20 +3431,16 @@ void ceph_con_v2_revoke(struct ceph_connection *con) · 528 unmodified lines
3326 3431
3327static void revoke_at_prepare_read_data(struct ceph_connection *con)3432static void revoke_at_prepare_read_data(struct ceph_connection *con)
3328{3433{
3329 int remaining; /* data + [data padding] + epilogue */3434 int remaining;
3330 int resid;3435 int resid;
3331 3436
3437 WARN_ON(con_secure(con));
3332 WARN_ON(!data_len(con->in_msg));3438 WARN_ON(!data_len(con->in_msg));
3333 WARN_ON(!iov_iter_is_kvec(&con->v2.in_iter));3439 WARN_ON(!iov_iter_is_kvec(&con->v2.in_iter));
3334 resid = iov_iter_count(&con->v2.in_iter);3440 resid = iov_iter_count(&con->v2.in_iter);
3335 WARN_ON(!resid);3441 WARN_ON(!resid);
3336 3442
3337 if (con_secure(con))3443 remaining = data_len(con->in_msg) + CEPH_EPILOGUE_PLAIN_LEN;
3338 remaining = padded_len(data_len(con->in_msg)) +
3339 CEPH_EPILOGUE_SECURE_LEN;
3340 else
3341 remaining = data_len(con->in_msg) + CEPH_EPILOGUE_PLAIN_LEN;
3342
3343 dout("%s con %p resid %d remaining %d\n", __func__, con, resid,3444 dout("%s con %p resid %d remaining %d\n", __func__, con, resid,
3344 remaining);3445 remaining);
3345 con->v2.in_iter.count -= resid;3446 con->v2.in_iter.count -= resid;
@@ -3350,8 +3451,9 @@ static void revoke_at_prepare_read_data(struct ceph_connection *con) · 4 unmodified lines
3350static void revoke_at_prepare_read_data_cont(struct ceph_connection *con)3451static void revoke_at_prepare_read_data_cont(struct ceph_connection *con)
3351{3452{
3352 int recved, resid; /* current piece of data */3453 int recved, resid; /* current piece of data */
3353 int remaining; /* [data padding] + epilogue */3454 int remaining;
3354 3455
3456 WARN_ON(con_secure(con));
3355 WARN_ON(!data_len(con->in_msg));3457 WARN_ON(!data_len(con->in_msg));
3356 WARN_ON(!iov_iter_is_bvec(&con->v2.in_iter));3458 WARN_ON(!iov_iter_is_bvec(&con->v2.in_iter));
3357 resid = iov_iter_count(&con->v2.in_iter);3459 resid = iov_iter_count(&con->v2.in_iter);
@@ -3363,12 +3465,7 @@ static void revoke_at_prepare_read_data_cont(struct ceph_connection *con) · 5 unmodified lines
3363 ceph_msg_data_advance(&con->v2.in_cursor, recved);3465 ceph_msg_data_advance(&con->v2.in_cursor, recved);
3364 WARN_ON(resid > con->v2.in_cursor.total_resid);3466 WARN_ON(resid > con->v2.in_cursor.total_resid);
3365 3467
3366 if (con_secure(con))3468 remaining = CEPH_EPILOGUE_PLAIN_LEN;
3367 remaining = padding_len(data_len(con->in_msg)) +
3368 CEPH_EPILOGUE_SECURE_LEN;
3369 else
3370 remaining = CEPH_EPILOGUE_PLAIN_LEN;
3371
3372 dout("%s con %p total_resid %zu remaining %d\n", __func__, con,3469 dout("%s con %p total_resid %zu remaining %d\n", __func__, con,
3373 con->v2.in_cursor.total_resid, remaining);3470 con->v2.in_cursor.total_resid, remaining);
3374 con->v2.in_iter.count -= resid;3471 con->v2.in_iter.count -= resid;
@@ -3376,11 +3473,26 @@ static void revoke_at_prepare_read_data_cont(struct ceph_connection *con) · 1 unmodified line
3376 con->v2.in_state = IN_S_FINISH_SKIP;3473 con->v2.in_state = IN_S_FINISH_SKIP;
3377}3474}
3378 3475
3476static void revoke_at_prepare_read_enc_page(struct ceph_connection *con)
3477{
3478 int resid; /* current enc page (not necessarily data) */
3479
3480 WARN_ON(!con_secure(con));
3481 WARN_ON(!iov_iter_is_bvec(&con->v2.in_iter));
3482 resid = iov_iter_count(&con->v2.in_iter);
3483 WARN_ON(!resid || resid > con->v2.in_bvec.bv_len);
3484
3485 dout("%s con %p resid %d enc_resid %d\n", __func__, con, resid,
3486 con->v2.in_enc_resid);
3487 con->v2.in_iter.count -= resid;
3488 set_in_skip(con, resid + con->v2.in_enc_resid);
3489 con->v2.in_state = IN_S_FINISH_SKIP;
3490}
3491
3379static void revoke_at_handle_epilogue(struct ceph_connection *con)3492static void revoke_at_handle_epilogue(struct ceph_connection *con)
3380{3493{
3381 int resid;3494 int resid;
3382 3495
3383 WARN_ON(!iov_iter_is_kvec(&con->v2.in_iter));
3384 resid = iov_iter_count(&con->v2.in_iter);3496 resid = iov_iter_count(&con->v2.in_iter);
3385 WARN_ON(!resid);3497 WARN_ON(!resid);
3386 3498
@@ -3399,6 +3511,9 @@ void ceph_con_v2_revoke_incoming(struct ceph_connection *con) · 12 unmodified lines
3399 case IN_S_PREPARE_READ_DATA_CONT:3511 case IN_S_PREPARE_READ_DATA_CONT:
3400 revoke_at_prepare_read_data_cont(con);3512 revoke_at_prepare_read_data_cont(con);
3401 break;3513 break;
3514 case IN_S_PREPARE_READ_ENC_PAGE:
3515 revoke_at_prepare_read_enc_page(con);
3516 break;
3402 case IN_S_HANDLE_EPILOGUE:3517 case IN_S_HANDLE_EPILOGUE:
3403 revoke_at_handle_epilogue(con);3518 revoke_at_handle_epilogue(con);
3404 break;3519 break;
@@ -3432,6 +3547,13 @@ void ceph_con_v2_reset_protocol(struct ceph_connection *con) · 27 unmodified lines
3432 clear_out_sign_kvecs(con);3547 clear_out_sign_kvecs(con);
3433 free_conn_bufs(con);3548 free_conn_bufs(con);
3434 3549
3550 if (con->v2.in_enc_pages) {
3551 WARN_ON(!con->v2.in_enc_page_cnt);
3552 ceph_release_page_vector(con->v2.in_enc_pages,
3553 con->v2.in_enc_page_cnt);
3554 con->v2.in_enc_pages = NULL;
3555 con->v2.in_enc_page_cnt = 0;
3556 }
3435 if (con->v2.out_enc_pages) {3557 if (con->v2.out_enc_pages) {
3436 WARN_ON(!con->v2.out_enc_page_cnt);3558 WARN_ON(!con->v2.out_enc_page_cnt);
3437 ceph_release_page_vector(con->v2.out_enc_pages,3559 ceph_release_page_vector(con->v2.out_enc_pages,
net/core/neighbour.c+12−6
@@ -1133,7 +1133,8 @@ out: · 1132 unmodified lines
1133 neigh_release(neigh);1133 neigh_release(neigh);
1134}1134}
1135 1135
1136int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)1136int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb,
1137 const bool immediate_ok)
1137{1138{
1138 int rc;1139 int rc;
1139 bool immediate_probe = false;1140 bool immediate_probe = false;
@@ -1154,12 +1155,17 @@ int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) · 14 unmodified lines
1154 atomic_set(&neigh->probes,1155 atomic_set(&neigh->probes,
1155 NEIGH_VAR(neigh->parms, UCAST_PROBES));1156 NEIGH_VAR(neigh->parms, UCAST_PROBES));
1156 neigh_del_timer(neigh);1157 neigh_del_timer(neigh);
1157 neigh->nud_state = NUD_INCOMPLETE;1158 neigh->nud_state = NUD_INCOMPLETE;
1158 neigh->updated = now;1159 neigh->updated = now;
1159 next = now + max(NEIGH_VAR(neigh->parms, RETRANS_TIME),1160 if (!immediate_ok) {
1160 HZ/100);1161 next = now + 1;
1162 } else {
1163 immediate_probe = true;
1164 next = now + max(NEIGH_VAR(neigh->parms,
1165 RETRANS_TIME),
1166 HZ / 100);
1167 }
1161 neigh_add_timer(neigh, next);1168 neigh_add_timer(neigh, next);
1162 immediate_probe = true;
1163 } else {1169 } else {
1164 neigh->nud_state = NUD_FAILED;1170 neigh->nud_state = NUD_FAILED;
1165 neigh->updated = jiffies;1171 neigh->updated = jiffies;
@@ -1571,7 +1577,7 @@ static void neigh_managed_work(struct work_struct *work) · 405 unmodified lines
1571 1577
1572 write_lock_bh(&tbl->lock);1578 write_lock_bh(&tbl->lock);
1573 list_for_each_entry(neigh, &tbl->managed_list, managed_list)1579 list_for_each_entry(neigh, &tbl->managed_list, managed_list)
1574 neigh_event_send(neigh, NULL);1580 neigh_event_send_probe(neigh, NULL, false);
1575 queue_delayed_work(system_power_efficient_wq, &tbl->managed_work,1581 queue_delayed_work(system_power_efficient_wq, &tbl->managed_work,
1576 NEIGH_VAR(&tbl->parms, DELAY_PROBE_TIME));1582 NEIGH_VAR(&tbl->parms, DELAY_PROBE_TIME));
1577 write_unlock_bh(&tbl->lock);1583 write_unlock_bh(&tbl->lock);
net/core/rtnetlink.c+4−2
@@ -3275,8 +3275,8 @@ static int __rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh, · 3274 unmodified lines
3275 struct nlattr *slave_attr[RTNL_SLAVE_MAX_TYPE + 1];3275 struct nlattr *slave_attr[RTNL_SLAVE_MAX_TYPE + 1];
3276 unsigned char name_assign_type = NET_NAME_USER;3276 unsigned char name_assign_type = NET_NAME_USER;
3277 struct nlattr *linkinfo[IFLA_INFO_MAX + 1];3277 struct nlattr *linkinfo[IFLA_INFO_MAX + 1];
3278 const struct rtnl_link_ops *m_ops = NULL;3278 const struct rtnl_link_ops *m_ops;
3279 struct net_device *master_dev = NULL;3279 struct net_device *master_dev;
3280 struct net *net = sock_net(skb->sk);3280 struct net *net = sock_net(skb->sk);
3281 const struct rtnl_link_ops *ops;3281 const struct rtnl_link_ops *ops;
3282 struct nlattr *tb[IFLA_MAX + 1];3282 struct nlattr *tb[IFLA_MAX + 1];
@@ -3314,6 +3314,8 @@ replay: · 31 unmodified lines
3314 else3314 else
3315 dev = NULL;3315 dev = NULL;
3316 3316
3317 master_dev = NULL;
3318 m_ops = NULL;
3317 if (dev) {3319 if (dev) {
3318 master_dev = netdev_master_upper_dev_get(dev);3320 master_dev = netdev_master_upper_dev_get(dev);
3319 if (master_dev)3321 if (master_dev)
net/ieee802154/nl802154.c+4−4
@@ -1441,7 +1441,7 @@ static int nl802154_send_key(struct sk_buff *msg, u32 cmd, u32 portid, · 1440 unmodified lines
1441 1441
1442 hdr = nl802154hdr_put(msg, portid, seq, flags, cmd);1442 hdr = nl802154hdr_put(msg, portid, seq, flags, cmd);
1443 if (!hdr)1443 if (!hdr)
1444 return -1;1444 return -ENOBUFS;
1445 1445
1446 if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex))1446 if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex))
1447 goto nla_put_failure;1447 goto nla_put_failure;
@@ -1634,7 +1634,7 @@ static int nl802154_send_device(struct sk_buff *msg, u32 cmd, u32 portid, · 186 unmodified lines
1634 1634
1635 hdr = nl802154hdr_put(msg, portid, seq, flags, cmd);1635 hdr = nl802154hdr_put(msg, portid, seq, flags, cmd);
1636 if (!hdr)1636 if (!hdr)
1637 return -1;1637 return -ENOBUFS;
1638 1638
1639 if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex))1639 if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex))
1640 goto nla_put_failure;1640 goto nla_put_failure;
@@ -1812,7 +1812,7 @@ static int nl802154_send_devkey(struct sk_buff *msg, u32 cmd, u32 portid, · 171 unmodified lines
1812 1812
1813 hdr = nl802154hdr_put(msg, portid, seq, flags, cmd);1813 hdr = nl802154hdr_put(msg, portid, seq, flags, cmd);
1814 if (!hdr)1814 if (!hdr)
1815 return -1;1815 return -ENOBUFS;
1816 1816
1817 if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex))1817 if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex))
1818 goto nla_put_failure;1818 goto nla_put_failure;
@@ -1988,7 +1988,7 @@ static int nl802154_send_seclevel(struct sk_buff *msg, u32 cmd, u32 portid, · 169 unmodified lines
1988 1988
1989 hdr = nl802154hdr_put(msg, portid, seq, flags, cmd);1989 hdr = nl802154hdr_put(msg, portid, seq, flags, cmd);
1990 if (!hdr)1990 if (!hdr)
1991 return -1;1991 return -ENOBUFS;
1992 1992
1993 if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex))1993 if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex))
1994 goto nla_put_failure;1994 goto nla_put_failure;
net/ipv4/netfilter/Kconfig+0−4
@@ -58,10 +58,6 @@ config NF_TABLES_ARP · 57 unmodified lines
58 58
59endif # NF_TABLES59endif # NF_TABLES
60 60
61config NF_FLOW_TABLE_IPV4
62 tristate
63 select NF_FLOW_TABLE_INET
64
65config NF_DUP_IPV461config NF_DUP_IPV4
66 tristate "Netfilter IPv4 packet duplication to alternate destination"62 tristate "Netfilter IPv4 packet duplication to alternate destination"
67 depends on !NF_CONNTRACK || NF_CONNTRACK63 depends on !NF_CONNTRACK || NF_CONNTRACK
net/ipv4/tcp.c+5−2
@@ -1322,10 +1322,13 @@ new_segment: · 1321 unmodified lines
1322 1322
1323 /* skb changing from pure zc to mixed, must charge zc */1323 /* skb changing from pure zc to mixed, must charge zc */
1324 if (unlikely(skb_zcopy_pure(skb))) {1324 if (unlikely(skb_zcopy_pure(skb))) {
1325 if (!sk_wmem_schedule(sk, skb->data_len))1325 u32 extra = skb->truesize -
1326 SKB_TRUESIZE(skb_end_offset(skb));
1327
1328 if (!sk_wmem_schedule(sk, extra))
1326 goto wait_for_space;1329 goto wait_for_space;
1327 1330
1328 sk_mem_charge(sk, skb->data_len);1331 sk_mem_charge(sk, extra);
1329 skb_shinfo(skb)->flags &= ~SKBFL_PURE_ZEROCOPY;1332 skb_shinfo(skb)->flags &= ~SKBFL_PURE_ZEROCOPY;
1330 }1333 }
1331 1334
net/ipv4/tcp_input.c+2−0
@@ -1660,6 +1660,8 @@ static struct sk_buff *tcp_shift_skb_data(struct sock *sk, struct sk_buff *skb, · 1659 unmodified lines
1660 (mss != tcp_skb_seglen(skb)))1660 (mss != tcp_skb_seglen(skb)))
1661 goto out;1661 goto out;
1662 1662
1663 if (!tcp_skb_can_collapse(prev, skb))
1664 goto out;
1663 len = skb->len;1665 len = skb->len;
1664 pcount = tcp_skb_pcount(skb);1666 pcount = tcp_skb_pcount(skb);
1665 if (tcp_skb_shift(prev, skb, pcount, len))1667 if (tcp_skb_shift(prev, skb, pcount, len))
net/ipv6/netfilter/Kconfig+0−4
@@ -47,10 +47,6 @@ config NFT_FIB_IPV6 · 46 unmodified lines
47endif # NF_TABLES_IPV647endif # NF_TABLES_IPV6
48endif # NF_TABLES48endif # NF_TABLES
49 49
50config NF_FLOW_TABLE_IPV6
51 tristate
52 select NF_FLOW_TABLE_INET
53
54config NF_DUP_IPV650config NF_DUP_IPV6
55 tristate "Netfilter IPv6 packet duplication to alternate destination"51 tristate "Netfilter IPv6 packet duplication to alternate destination"
56 depends on !NF_CONNTRACK || NF_CONNTRACK52 depends on !NF_CONNTRACK || NF_CONNTRACK
net/ipv6/netfilter/Makefile+0−3
@@ -28,9 +28,6 @@ obj-$(CONFIG_NFT_REJECT_IPV6) += nft_reject_ipv6.o · 27 unmodified lines
28obj-$(CONFIG_NFT_DUP_IPV6) += nft_dup_ipv6.o28obj-$(CONFIG_NFT_DUP_IPV6) += nft_dup_ipv6.o
29obj-$(CONFIG_NFT_FIB_IPV6) += nft_fib_ipv6.o29obj-$(CONFIG_NFT_FIB_IPV6) += nft_fib_ipv6.o
30 30
31# flow table support
32obj-$(CONFIG_NF_FLOW_TABLE_IPV6) += nf_flow_table_ipv6.o
33
34# matches31# matches
35obj-$(CONFIG_IP6_NF_MATCH_AH) += ip6t_ah.o32obj-$(CONFIG_IP6_NF_MATCH_AH) += ip6t_ah.o
36obj-$(CONFIG_IP6_NF_MATCH_EUI64) += ip6t_eui64.o33obj-$(CONFIG_IP6_NF_MATCH_EUI64) += ip6t_eui64.o
net/ipv6/netfilter/nf_flow_table_ipv6.c+0−0

Empty file deleted.

net/netfilter/nf_tables_api.c+0−1
@@ -2011,7 +2011,6 @@ static void nft_last_rule(struct nft_rule_blob *blob, const void *ptr) · 2010 unmodified lines
2011 2011
2012 prule = (struct nft_rule_dp *)ptr;2012 prule = (struct nft_rule_dp *)ptr;
2013 prule->is_last = 1;2013 prule->is_last = 1;
2014 ptr += offsetof(struct nft_rule_dp, data);
2015 /* blob size does not include the trailer rule */2014 /* blob size does not include the trailer rule */
2016}2015}
2017 2016
net/netfilter/nft_byteorder.c+12−0
@@ -167,12 +167,24 @@ nla_put_failure: · 166 unmodified lines
167 return -1;167 return -1;
168}168}
169 169
170static bool nft_byteorder_reduce(struct nft_regs_track *track,
171 const struct nft_expr *expr)
172{
173 struct nft_byteorder *priv = nft_expr_priv(expr);
174
175 track->regs[priv->dreg].selector = NULL;
176 track->regs[priv->dreg].bitwise = NULL;
177
178 return false;
179}
180
170static const struct nft_expr_ops nft_byteorder_ops = {181static const struct nft_expr_ops nft_byteorder_ops = {
171 .type = &nft_byteorder_type,182 .type = &nft_byteorder_type,
172 .size = NFT_EXPR_SIZE(sizeof(struct nft_byteorder)),183 .size = NFT_EXPR_SIZE(sizeof(struct nft_byteorder)),
173 .eval = nft_byteorder_eval,184 .eval = nft_byteorder_eval,
174 .init = nft_byteorder_init,185 .init = nft_byteorder_init,
175 .dump = nft_byteorder_dump,186 .dump = nft_byteorder_dump,
187 .reduce = nft_byteorder_reduce,
176};188};
177 189
178struct nft_expr_type nft_byteorder_type __read_mostly = {190struct nft_expr_type nft_byteorder_type __read_mostly = {
net/netfilter/nft_ct.c+4−1
@@ -260,9 +260,12 @@ static void nft_ct_set_zone_eval(const struct nft_expr *expr, · 259 unmodified lines
260 ct = this_cpu_read(nft_ct_pcpu_template);260 ct = this_cpu_read(nft_ct_pcpu_template);
261 261
262 if (likely(refcount_read(&ct->ct_general.use) == 1)) {262 if (likely(refcount_read(&ct->ct_general.use) == 1)) {
263 refcount_inc(&ct->ct_general.use);
263 nf_ct_zone_add(ct, &zone);264 nf_ct_zone_add(ct, &zone);
264 } else {265 } else {
265 /* previous skb got queued to userspace */266 /* previous skb got queued to userspace, allocate temporary
267 * one until percpu template can be reused.
268 */
266 ct = nf_ct_tmpl_alloc(nft_net(pkt), &zone, GFP_ATOMIC);269 ct = nf_ct_tmpl_alloc(nft_net(pkt), &zone, GFP_ATOMIC);
267 if (!ct) {270 if (!ct) {
268 regs->verdict.code = NF_DROP;271 regs->verdict.code = NF_DROP;
net/packet/af_packet.c+6−2
@@ -1789,7 +1789,10 @@ static int fanout_add(struct sock *sk, struct fanout_args *args) · 1788 unmodified lines
1789 err = -ENOSPC;1789 err = -ENOSPC;
1790 if (refcount_read(&match->sk_ref) < match->max_num_members) {1790 if (refcount_read(&match->sk_ref) < match->max_num_members) {
1791 __dev_remove_pack(&po->prot_hook);1791 __dev_remove_pack(&po->prot_hook);
1792 po->fanout = match;1792
1793 /* Paired with packet_setsockopt(PACKET_FANOUT_DATA) */
1794 WRITE_ONCE(po->fanout, match);
1795
1793 po->rollover = rollover;1796 po->rollover = rollover;
1794 rollover = NULL;1797 rollover = NULL;
1795 refcount_set(&match->sk_ref, refcount_read(&match->sk_ref) + 1);1798 refcount_set(&match->sk_ref, refcount_read(&match->sk_ref) + 1);
@@ -3934,7 +3937,8 @@ packet_setsockopt(struct socket *sock, int level, int optname, sockptr_t optval, · 2138 unmodified lines
3934 }3937 }
3935 case PACKET_FANOUT_DATA:3938 case PACKET_FANOUT_DATA:
3936 {3939 {
3937 if (!po->fanout)3940 /* Paired with the WRITE_ONCE() in fanout_add() */
3941 if (!READ_ONCE(po->fanout))
3938 return -EINVAL;3942 return -EINVAL;
3939 3943
3940 return fanout_set_data(po, optval, optlen);3944 return fanout_set_data(po, optval, optlen);
net/sched/cls_api.c+7−4
@@ -1945,9 +1945,9 @@ static int tc_new_tfilter(struct sk_buff *skb, struct nlmsghdr *n, · 1944 unmodified lines
1945 bool prio_allocate;1945 bool prio_allocate;
1946 u32 parent;1946 u32 parent;
1947 u32 chain_index;1947 u32 chain_index;
1948 struct Qdisc *q = NULL;1948 struct Qdisc *q;
1949 struct tcf_chain_info chain_info;1949 struct tcf_chain_info chain_info;
1950 struct tcf_chain *chain = NULL;1950 struct tcf_chain *chain;
1951 struct tcf_block *block;1951 struct tcf_block *block;
1952 struct tcf_proto *tp;1952 struct tcf_proto *tp;
1953 unsigned long cl;1953 unsigned long cl;
@@ -1976,6 +1976,8 @@ replay: · 22 unmodified lines
1976 tp = NULL;1976 tp = NULL;
1977 cl = 0;1977 cl = 0;
1978 block = NULL;1978 block = NULL;
1979 q = NULL;
1980 chain = NULL;
1979 flags = 0;1981 flags = 0;
1980 1982
1981 if (prio == 0) {1983 if (prio == 0) {
@@ -2798,8 +2800,8 @@ static int tc_ctl_chain(struct sk_buff *skb, struct nlmsghdr *n, · 816 unmodified lines
2798 struct tcmsg *t;2800 struct tcmsg *t;
2799 u32 parent;2801 u32 parent;
2800 u32 chain_index;2802 u32 chain_index;
2801 struct Qdisc *q = NULL;2803 struct Qdisc *q;
2802 struct tcf_chain *chain = NULL;2804 struct tcf_chain *chain;
2803 struct tcf_block *block;2805 struct tcf_block *block;
2804 unsigned long cl;2806 unsigned long cl;
2805 int err;2807 int err;
@@ -2809,6 +2811,7 @@ static int tc_ctl_chain(struct sk_buff *skb, struct nlmsghdr *n, · 3 unmodified lines
2809 return -EPERM;2811 return -EPERM;
2810 2812
2811replay:2813replay:
2814 q = NULL;
2812 err = nlmsg_parse_deprecated(n, sizeof(*t), tca, TCA_MAX,2815 err = nlmsg_parse_deprecated(n, sizeof(*t), tca, TCA_MAX,
2813 rtm_tca_policy, extack);2816 rtm_tca_policy, extack);
2814 if (err < 0)2817 if (err < 0)
net/smc/af_smc.c+118−15
@@ -566,17 +566,115 @@ static void smc_stat_fallback(struct smc_sock *smc) · 565 unmodified lines
566 mutex_unlock(&net->smc.mutex_fback_rsn);566 mutex_unlock(&net->smc.mutex_fback_rsn);
567}567}
568 568
569/* must be called under rcu read lock */
570static void smc_fback_wakeup_waitqueue(struct smc_sock *smc, void *key)
571{
572 struct socket_wq *wq;
573 __poll_t flags;
574
575 wq = rcu_dereference(smc->sk.sk_wq);
576 if (!skwq_has_sleeper(wq))
577 return;
578
579 /* wake up smc sk->sk_wq */
580 if (!key) {
581 /* sk_state_change */
582 wake_up_interruptible_all(&wq->wait);
583 } else {
584 flags = key_to_poll(key);
585 if (flags & (EPOLLIN | EPOLLOUT))
586 /* sk_data_ready or sk_write_space */
587 wake_up_interruptible_sync_poll(&wq->wait, flags);
588 else if (flags & EPOLLERR)
589 /* sk_error_report */
590 wake_up_interruptible_poll(&wq->wait, flags);
591 }
592}
593
594static int smc_fback_mark_woken(wait_queue_entry_t *wait,
595 unsigned int mode, int sync, void *key)
596{
597 struct smc_mark_woken *mark =
598 container_of(wait, struct smc_mark_woken, wait_entry);
599
600 mark->woken = true;
601 mark->key = key;
602 return 0;
603}
604
605static void smc_fback_forward_wakeup(struct smc_sock *smc, struct sock *clcsk,
606 void (*clcsock_callback)(struct sock *sk))
607{
608 struct smc_mark_woken mark = { .woken = false };
609 struct socket_wq *wq;
610
611 init_waitqueue_func_entry(&mark.wait_entry,
612 smc_fback_mark_woken);
613 rcu_read_lock();
614 wq = rcu_dereference(clcsk->sk_wq);
615 if (!wq)
616 goto out;
617 add_wait_queue(sk_sleep(clcsk), &mark.wait_entry);
618 clcsock_callback(clcsk);
619 remove_wait_queue(sk_sleep(clcsk), &mark.wait_entry);
620
621 if (mark.woken)
622 smc_fback_wakeup_waitqueue(smc, mark.key);
623out:
624 rcu_read_unlock();
625}
626
627static void smc_fback_state_change(struct sock *clcsk)
628{
629 struct smc_sock *smc =
630 smc_clcsock_user_data(clcsk);
631
632 if (!smc)
633 return;
634 smc_fback_forward_wakeup(smc, clcsk, smc->clcsk_state_change);
635}
636
637static void smc_fback_data_ready(struct sock *clcsk)
638{
639 struct smc_sock *smc =
640 smc_clcsock_user_data(clcsk);
641
642 if (!smc)
643 return;
644 smc_fback_forward_wakeup(smc, clcsk, smc->clcsk_data_ready);
645}
646
647static void smc_fback_write_space(struct sock *clcsk)
648{
649 struct smc_sock *smc =
650 smc_clcsock_user_data(clcsk);
651
652 if (!smc)
653 return;
654 smc_fback_forward_wakeup(smc, clcsk, smc->clcsk_write_space);
655}
656
657static void smc_fback_error_report(struct sock *clcsk)
658{
659 struct smc_sock *smc =
660 smc_clcsock_user_data(clcsk);
661
662 if (!smc)
663 return;
664 smc_fback_forward_wakeup(smc, clcsk, smc->clcsk_error_report);
665}
666
569static int smc_switch_to_fallback(struct smc_sock *smc, int reason_code)667static int smc_switch_to_fallback(struct smc_sock *smc, int reason_code)
570{668{
571 wait_queue_head_t *smc_wait = sk_sleep(&smc->sk);669 struct sock *clcsk;
572 wait_queue_head_t *clc_wait;
573 unsigned long flags;
574 670
575 mutex_lock(&smc->clcsock_release_lock);671 mutex_lock(&smc->clcsock_release_lock);
576 if (!smc->clcsock) {672 if (!smc->clcsock) {
577 mutex_unlock(&smc->clcsock_release_lock);673 mutex_unlock(&smc->clcsock_release_lock);
578 return -EBADF;674 return -EBADF;
579 }675 }
676 clcsk = smc->clcsock->sk;
677
580 smc->use_fallback = true;678 smc->use_fallback = true;
581 smc->fallback_rsn = reason_code;679 smc->fallback_rsn = reason_code;
582 smc_stat_fallback(smc);680 smc_stat_fallback(smc);
@@ -587,16 +685,22 @@ static int smc_switch_to_fallback(struct smc_sock *smc, int reason_code) · 4 unmodified lines
587 smc->clcsock->wq.fasync_list =685 smc->clcsock->wq.fasync_list =
588 smc->sk.sk_socket->wq.fasync_list;686 smc->sk.sk_socket->wq.fasync_list;
589 687
590 /* There may be some entries remaining in688 /* There might be some wait entries remaining
591 * smc socket->wq, which should be removed689 * in smc sk->sk_wq and they should be woken up
592 * to clcsocket->wq during the fallback.690 * as clcsock's wait queue is woken up.
593 */691 */
594 clc_wait = sk_sleep(smc->clcsock->sk);692 smc->clcsk_state_change = clcsk->sk_state_change;
595 spin_lock_irqsave(&smc_wait->lock, flags);693 smc->clcsk_data_ready = clcsk->sk_data_ready;
596 spin_lock_nested(&clc_wait->lock, SINGLE_DEPTH_NESTING);694 smc->clcsk_write_space = clcsk->sk_write_space;
597 list_splice_init(&smc_wait->head, &clc_wait->head);695 smc->clcsk_error_report = clcsk->sk_error_report;
598 spin_unlock(&clc_wait->lock);696
599 spin_unlock_irqrestore(&smc_wait->lock, flags);697 clcsk->sk_state_change = smc_fback_state_change;
698 clcsk->sk_data_ready = smc_fback_data_ready;
699 clcsk->sk_write_space = smc_fback_write_space;
700 clcsk->sk_error_report = smc_fback_error_report;
701
702 smc->clcsock->sk->sk_user_data =
703 (void *)((uintptr_t)smc | SK_USER_DATA_NOCOPY);
600 }704 }
601 mutex_unlock(&smc->clcsock_release_lock);705 mutex_unlock(&smc->clcsock_release_lock);
602 return 0;706 return 0;
@@ -2115,10 +2219,9 @@ out: · 1512 unmodified lines
2115 2219
2116static void smc_clcsock_data_ready(struct sock *listen_clcsock)2220static void smc_clcsock_data_ready(struct sock *listen_clcsock)
2117{2221{
2118 struct smc_sock *lsmc;2222 struct smc_sock *lsmc =
2223 smc_clcsock_user_data(listen_clcsock);
2119 2224
2120 lsmc = (struct smc_sock *)
2121 ((uintptr_t)listen_clcsock->sk_user_data & ~SK_USER_DATA_NOCOPY);
2122 if (!lsmc)2225 if (!lsmc)
2123 return;2226 return;
2124 lsmc->clcsk_data_ready(listen_clcsock);2227 lsmc->clcsk_data_ready(listen_clcsock);
net/smc/smc.h+19−1
@@ -139,6 +139,12 @@ enum smc_urg_state { · 138 unmodified lines
139 SMC_URG_READ = 3, /* data was already read */139 SMC_URG_READ = 3, /* data was already read */
140};140};
141 141
142struct smc_mark_woken {
143 bool woken;
144 void *key;
145 wait_queue_entry_t wait_entry;
146};
147
142struct smc_connection {148struct smc_connection {
143 struct rb_node alert_node;149 struct rb_node alert_node;
144 struct smc_link_group *lgr; /* link group of connection */150 struct smc_link_group *lgr; /* link group of connection */
@@ -228,8 +234,14 @@ struct smc_connection { · 83 unmodified lines
228struct smc_sock { /* smc sock container */234struct smc_sock { /* smc sock container */
229 struct sock sk;235 struct sock sk;
230 struct socket *clcsock; /* internal tcp socket */236 struct socket *clcsock; /* internal tcp socket */
237 void (*clcsk_state_change)(struct sock *sk);
238 /* original stat_change fct. */
231 void (*clcsk_data_ready)(struct sock *sk);239 void (*clcsk_data_ready)(struct sock *sk);
232 /* original data_ready fct. **/240 /* original data_ready fct. */
241 void (*clcsk_write_space)(struct sock *sk);
242 /* original write_space fct. */
243 void (*clcsk_error_report)(struct sock *sk);
244 /* original error_report fct. */
233 struct smc_connection conn; /* smc connection */245 struct smc_connection conn; /* smc connection */
234 struct smc_sock *listen_smc; /* listen parent */246 struct smc_sock *listen_smc; /* listen parent */
235 struct work_struct connect_work; /* handle non-blocking connect*/247 struct work_struct connect_work; /* handle non-blocking connect*/
@@ -264,6 +276,12 @@ static inline struct smc_sock *smc_sk(const struct sock *sk) · 28 unmodified lines
264 return (struct smc_sock *)sk;276 return (struct smc_sock *)sk;
265}277}
266 278
279static inline struct smc_sock *smc_clcsock_user_data(struct sock *clcsk)
280{
281 return (struct smc_sock *)
282 ((uintptr_t)clcsk->sk_user_data & ~SK_USER_DATA_NOCOPY);
283}
284
267extern struct workqueue_struct *smc_hs_wq; /* wq for handshake work */285extern struct workqueue_struct *smc_hs_wq; /* wq for handshake work */
268extern struct workqueue_struct *smc_close_wq; /* wq for close work */286extern struct workqueue_struct *smc_close_wq; /* wq for close work */
269 287
net/smc/smc_diag.c+0−2
@@ -146,13 +146,11 @@ static int __smc_diag_dump(struct sock *sk, struct sk_buff *skb, · 145 unmodified lines
146 (req->diag_ext & (1 << (SMC_DIAG_LGRINFO - 1))) &&146 (req->diag_ext & (1 << (SMC_DIAG_LGRINFO - 1))) &&
147 !list_empty(&smc->conn.lgr->list)) {147 !list_empty(&smc->conn.lgr->list)) {
148 struct smc_link *link = smc->conn.lnk;148 struct smc_link *link = smc->conn.lnk;
149 struct net *net = read_pnet(&link->smcibdev->ibdev->coredev.rdma_net);
150 149
151 struct smc_diag_lgrinfo linfo = {150 struct smc_diag_lgrinfo linfo = {
152 .role = smc->conn.lgr->role,151 .role = smc->conn.lgr->role,
153 .lnk[0].ibport = link->ibport,152 .lnk[0].ibport = link->ibport,
154 .lnk[0].link_id = link->link_id,153 .lnk[0].link_id = link->link_id,
155 .lnk[0].net_cookie = net->net_cookie,
156 };154 };
157 155
158 memcpy(linfo.lnk[0].ibname,156 memcpy(linfo.lnk[0].ibname,
security/selinux/ss/conditional.c+2−1
@@ -152,6 +152,8 @@ static void cond_list_destroy(struct policydb *p) · 151 unmodified lines
152 for (i = 0; i < p->cond_list_len; i++)152 for (i = 0; i < p->cond_list_len; i++)
153 cond_node_destroy(&p->cond_list[i]);153 cond_node_destroy(&p->cond_list[i]);
154 kfree(p->cond_list);154 kfree(p->cond_list);
155 p->cond_list = NULL;
156 p->cond_list_len = 0;
155}157}
156 158
157void cond_policydb_destroy(struct policydb *p)159void cond_policydb_destroy(struct policydb *p)
@@ -441,7 +443,6 @@ int cond_read_list(struct policydb *p, void *fp) · 283 unmodified lines
441 return 0;443 return 0;
442err:444err:
443 cond_list_destroy(p);445 cond_list_destroy(p);
444 p->cond_list = NULL;
445 return rc;446 return rc;
446}447}
447 448
sound/core/pcm_native.c+13−0
@@ -172,6 +172,19 @@ unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream) · 171 unmodified lines
172}172}
173EXPORT_SYMBOL_GPL(_snd_pcm_stream_lock_irqsave);173EXPORT_SYMBOL_GPL(_snd_pcm_stream_lock_irqsave);
174 174
175unsigned long _snd_pcm_stream_lock_irqsave_nested(struct snd_pcm_substream *substream)
176{
177 unsigned long flags = 0;
178 if (substream->pcm->nonatomic)
179 mutex_lock_nested(&substream->self_group.mutex,
180 SINGLE_DEPTH_NESTING);
181 else
182 spin_lock_irqsave_nested(&substream->self_group.lock, flags,
183 SINGLE_DEPTH_NESTING);
184 return flags;
185}
186EXPORT_SYMBOL_GPL(_snd_pcm_stream_lock_irqsave_nested);
187
175/**188/**
176 * snd_pcm_stream_unlock_irqrestore - Unlock the PCM stream189 * snd_pcm_stream_unlock_irqrestore - Unlock the PCM stream
177 * @substream: PCM substream190 * @substream: PCM substream
sound/hda/intel-sdw-acpi.c+3−4
@@ -50,11 +50,11 @@ static bool is_link_enabled(struct fwnode_handle *fw_node, int i) · 49 unmodified lines
50static int50static int
51sdw_intel_scan_controller(struct sdw_intel_acpi_info *info)51sdw_intel_scan_controller(struct sdw_intel_acpi_info *info)
52{52{
53 struct acpi_device *adev;53 struct acpi_device *adev = acpi_fetch_acpi_dev(info->handle);
54 int ret, i;54 int ret, i;
55 u8 count;55 u8 count;
56 56
57 if (acpi_bus_get_device(info->handle, &adev))57 if (!adev)
58 return -EINVAL;58 return -EINVAL;
59 59
60 /* Found controller, find links supported */60 /* Found controller, find links supported */
@@ -119,7 +119,6 @@ static acpi_status sdw_intel_acpi_cb(acpi_handle handle, u32 level, · 58 unmodified lines
119 void *cdata, void **return_value)119 void *cdata, void **return_value)
120{120{
121 struct sdw_intel_acpi_info *info = cdata;121 struct sdw_intel_acpi_info *info = cdata;
122 struct acpi_device *adev;
123 acpi_status status;122 acpi_status status;
124 u64 adr;123 u64 adr;
125 124
@@ -127,7 +126,7 @@ static acpi_status sdw_intel_acpi_cb(acpi_handle handle, u32 level, · 1 unmodified line
127 if (ACPI_FAILURE(status))126 if (ACPI_FAILURE(status))
128 return AE_OK; /* keep going */127 return AE_OK; /* keep going */
129 128
130 if (acpi_bus_get_device(handle, &adev)) {129 if (!acpi_fetch_acpi_dev(handle)) {
131 pr_err("%s: Couldn't find ACPI handle\n", __func__);130 pr_err("%s: Couldn't find ACPI handle\n", __func__);
132 return AE_NOT_FOUND;131 return AE_NOT_FOUND;
133 }132 }
sound/pci/hda/hda_auto_parser.c+1−1
@@ -981,7 +981,7 @@ void snd_hda_pick_fixup(struct hda_codec *codec, · 980 unmodified lines
981 int id = HDA_FIXUP_ID_NOT_SET;981 int id = HDA_FIXUP_ID_NOT_SET;
982 const char *name = NULL;982 const char *name = NULL;
983 const char *type = NULL;983 const char *type = NULL;
984 int vendor, device;984 unsigned int vendor, device;
985 985
986 if (codec->fixup_id != HDA_FIXUP_ID_NOT_SET)986 if (codec->fixup_id != HDA_FIXUP_ID_NOT_SET)
987 return;987 return;
sound/pci/hda/hda_codec.c+4−0
@@ -3000,6 +3000,10 @@ void snd_hda_codec_shutdown(struct hda_codec *codec) · 2999 unmodified lines
3000{3000{
3001 struct hda_pcm *cpcm;3001 struct hda_pcm *cpcm;
3002 3002
3003 /* Skip the shutdown if codec is not registered */
3004 if (!codec->registered)
3005 return;
3006
3003 list_for_each_entry(cpcm, &codec->pcm_list_head, list)3007 list_for_each_entry(cpcm, &codec->pcm_list_head, list)
3004 snd_pcm_suspend_all(cpcm->pcm);3008 snd_pcm_suspend_all(cpcm->pcm);
3005 3009
sound/pci/hda/hda_generic.c+15−2
@@ -91,6 +91,12 @@ static void snd_hda_gen_spec_free(struct hda_gen_spec *spec) · 90 unmodified lines
91 free_kctls(spec);91 free_kctls(spec);
92 snd_array_free(&spec->paths);92 snd_array_free(&spec->paths);
93 snd_array_free(&spec->loopback_list);93 snd_array_free(&spec->loopback_list);
94#ifdef CONFIG_SND_HDA_GENERIC_LEDS
95 if (spec->led_cdevs[LED_AUDIO_MUTE])
96 led_classdev_unregister(spec->led_cdevs[LED_AUDIO_MUTE]);
97 if (spec->led_cdevs[LED_AUDIO_MICMUTE])
98 led_classdev_unregister(spec->led_cdevs[LED_AUDIO_MICMUTE]);
99#endif
94}100}
95 101
96/*102/*
@@ -3922,7 +3928,10 @@ static int create_mute_led_cdev(struct hda_codec *codec, · 3825 unmodified lines
3922 enum led_brightness),3928 enum led_brightness),
3923 bool micmute)3929 bool micmute)
3924{3930{
3931 struct hda_gen_spec *spec = codec->spec;
3925 struct led_classdev *cdev;3932 struct led_classdev *cdev;
3933 int idx = micmute ? LED_AUDIO_MICMUTE : LED_AUDIO_MUTE;
3934 int err;
3926 3935
3927 cdev = devm_kzalloc(&codec->core.dev, sizeof(*cdev), GFP_KERNEL);3936 cdev = devm_kzalloc(&codec->core.dev, sizeof(*cdev), GFP_KERNEL);
3928 if (!cdev)3937 if (!cdev)
@@ -3932,10 +3941,14 @@ static int create_mute_led_cdev(struct hda_codec *codec, · 3 unmodified lines
3932 cdev->max_brightness = 1;3941 cdev->max_brightness = 1;
3933 cdev->default_trigger = micmute ? "audio-micmute" : "audio-mute";3942 cdev->default_trigger = micmute ? "audio-micmute" : "audio-mute";
3934 cdev->brightness_set_blocking = callback;3943 cdev->brightness_set_blocking = callback;
3935 cdev->brightness = ledtrig_audio_get(micmute ? LED_AUDIO_MICMUTE : LED_AUDIO_MUTE);3944 cdev->brightness = ledtrig_audio_get(idx);
3936 cdev->flags = LED_CORE_SUSPENDRESUME;3945 cdev->flags = LED_CORE_SUSPENDRESUME;
3937 3946
3938 return devm_led_classdev_register(&codec->core.dev, cdev);3947 err = led_classdev_register(&codec->core.dev, cdev);
3948 if (err < 0)
3949 return err;
3950 spec->led_cdevs[idx] = cdev;
3951 return 0;
3939}3952}
3940 3953
3941/**3954/**
sound/pci/hda/hda_generic.h+3−0
@@ -294,6 +294,9 @@ struct hda_gen_spec { · 293 unmodified lines
294 struct hda_jack_callback *cb);294 struct hda_jack_callback *cb);
295 void (*mic_autoswitch_hook)(struct hda_codec *codec,295 void (*mic_autoswitch_hook)(struct hda_codec *codec,
296 struct hda_jack_callback *cb);296 struct hda_jack_callback *cb);
297
298 /* leds */
299 struct led_classdev *led_cdevs[NUM_AUDIO_LEDS];
297};300};
298 301
299/* values for add_stereo_mix_input flag */302/* values for add_stereo_mix_input flag */
sound/pci/hda/patch_realtek.c+55−12
@@ -98,6 +98,7 @@ struct alc_spec { · 97 unmodified lines
98 unsigned int gpio_mic_led_mask;98 unsigned int gpio_mic_led_mask;
99 struct alc_coef_led mute_led_coef;99 struct alc_coef_led mute_led_coef;
100 struct alc_coef_led mic_led_coef;100 struct alc_coef_led mic_led_coef;
101 struct mutex coef_mutex;
101 102
102 hda_nid_t headset_mic_pin;103 hda_nid_t headset_mic_pin;
103 hda_nid_t headphone_mic_pin;104 hda_nid_t headphone_mic_pin;
@@ -137,8 +138,8 @@ struct alc_spec { · 33 unmodified lines
137 * COEF access helper functions138 * COEF access helper functions
138 */139 */
139 140
140static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,141static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
141 unsigned int coef_idx)142 unsigned int coef_idx)
142{143{
143 unsigned int val;144 unsigned int val;
144 145
@@ -147,28 +148,61 @@ static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, · 2 unmodified lines
147 return val;148 return val;
148}149}
149 150
151static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
152 unsigned int coef_idx)
153{
154 struct alc_spec *spec = codec->spec;
155 unsigned int val;
156
157 mutex_lock(&spec->coef_mutex);
158 val = __alc_read_coefex_idx(codec, nid, coef_idx);
159 mutex_unlock(&spec->coef_mutex);
160 return val;
161}
162
150#define alc_read_coef_idx(codec, coef_idx) \163#define alc_read_coef_idx(codec, coef_idx) \
151 alc_read_coefex_idx(codec, 0x20, coef_idx)164 alc_read_coefex_idx(codec, 0x20, coef_idx)
152 165
153static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,166static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
154 unsigned int coef_idx, unsigned int coef_val)167 unsigned int coef_idx, unsigned int coef_val)
155{168{
156 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);169 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
157 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);170 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
158}171}
159 172
173static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
174 unsigned int coef_idx, unsigned int coef_val)
175{
176 struct alc_spec *spec = codec->spec;
177
178 mutex_lock(&spec->coef_mutex);
179 __alc_write_coefex_idx(codec, nid, coef_idx, coef_val);
180 mutex_unlock(&spec->coef_mutex);
181}
182
160#define alc_write_coef_idx(codec, coef_idx, coef_val) \183#define alc_write_coef_idx(codec, coef_idx, coef_val) \
161 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)184 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
162 185
186static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
187 unsigned int coef_idx, unsigned int mask,
188 unsigned int bits_set)
189{
190 unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx);
191
192 if (val != -1)
193 __alc_write_coefex_idx(codec, nid, coef_idx,
194 (val & ~mask) | bits_set);
195}
196
163static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,197static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
164 unsigned int coef_idx, unsigned int mask,198 unsigned int coef_idx, unsigned int mask,
165 unsigned int bits_set)199 unsigned int bits_set)
166{200{
167 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx);201 struct alc_spec *spec = codec->spec;
168 202
169 if (val != -1)203 mutex_lock(&spec->coef_mutex);
170 alc_write_coefex_idx(codec, nid, coef_idx,204 __alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set);
171 (val & ~mask) | bits_set);205 mutex_unlock(&spec->coef_mutex);
172}206}
173 207
174#define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \208#define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
@@ -201,13 +235,17 @@ struct coef_fw { · 26 unmodified lines
201static void alc_process_coef_fw(struct hda_codec *codec,235static void alc_process_coef_fw(struct hda_codec *codec,
202 const struct coef_fw *fw)236 const struct coef_fw *fw)
203{237{
238 struct alc_spec *spec = codec->spec;
239
240 mutex_lock(&spec->coef_mutex);
204 for (; fw->nid; fw++) {241 for (; fw->nid; fw++) {
205 if (fw->mask == (unsigned short)-1)242 if (fw->mask == (unsigned short)-1)
206 alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);243 __alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
207 else244 else
208 alc_update_coefex_idx(codec, fw->nid, fw->idx,245 __alc_update_coefex_idx(codec, fw->nid, fw->idx,
209 fw->mask, fw->val);246 fw->mask, fw->val);
210 }247 }
248 mutex_unlock(&spec->coef_mutex);
211}249}
212 250
213/*251/*
@@ -1153,6 +1191,7 @@ static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid) · 939 unmodified lines
1153 codec->spdif_status_reset = 1;1191 codec->spdif_status_reset = 1;
1154 codec->forced_resume = 1;1192 codec->forced_resume = 1;
1155 codec->patch_ops = alc_patch_ops;1193 codec->patch_ops = alc_patch_ops;
1194 mutex_init(&spec->coef_mutex);
1156 1195
1157 err = alc_codec_rename_from_preset(codec);1196 err = alc_codec_rename_from_preset(codec);
1158 if (err < 0) {1197 if (err < 0) {
@@ -2125,6 +2164,7 @@ static void alc1220_fixup_gb_x570(struct hda_codec *codec, · 966 unmodified lines
2125{2164{
2126 static const hda_nid_t conn1[] = { 0x0c };2165 static const hda_nid_t conn1[] = { 0x0c };
2127 static const struct coef_fw gb_x570_coefs[] = {2166 static const struct coef_fw gb_x570_coefs[] = {
2167 WRITE_COEF(0x07, 0x03c0),
2128 WRITE_COEF(0x1a, 0x01c1),2168 WRITE_COEF(0x1a, 0x01c1),
2129 WRITE_COEF(0x1b, 0x0202),2169 WRITE_COEF(0x1b, 0x0202),
2130 WRITE_COEF(0x43, 0x3005),2170 WRITE_COEF(0x43, 0x3005),
@@ -2551,7 +2591,8 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { · 420 unmodified lines
2551 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),2591 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2552 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),2592 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2553 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),2593 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
2554 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950),2594 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570),
2595 SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570),
2555 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),2596 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
2556 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),2597 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
2557 SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),2598 SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
@@ -2626,6 +2667,7 @@ static const struct hda_model_fixup alc882_fixup_models[] = { · 68 unmodified lines
2626 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},2667 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2627 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},2668 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
2628 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},2669 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
2670 {.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
2629 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},2671 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
2630 {}2672 {}
2631};2673};
@@ -8969,6 +9011,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 6337 unmodified lines
8969 SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),9011 SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
8970 SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),9012 SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
8971 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),9013 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
9014 SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
8972 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),9015 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
8973 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),9016 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
8974 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),9017 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
sound/soc/amd/acp/acp-mach-common.c+2−2
@@ -303,11 +303,11 @@ static const struct snd_soc_dapm_route rt1019_map_lr[] = { · 302 unmodified lines
303 303
304static struct snd_soc_codec_conf rt1019_conf[] = {304static struct snd_soc_codec_conf rt1019_conf[] = {
305 {305 {
306 .dlc = COMP_CODEC_CONF("i2c-10EC1019:00"),306 .dlc = COMP_CODEC_CONF("i2c-10EC1019:01"),
307 .name_prefix = "Left",307 .name_prefix = "Left",
308 },308 },
309 {309 {
310 .dlc = COMP_CODEC_CONF("i2c-10EC1019:01"),310 .dlc = COMP_CODEC_CONF("i2c-10EC1019:00"),
311 .name_prefix = "Right",311 .name_prefix = "Right",
312 },312 },
313};313};
sound/soc/codecs/cpcap.c+2−0
@@ -1667,6 +1667,8 @@ static int cpcap_codec_probe(struct platform_device *pdev) · 1666 unmodified lines
1667{1667{
1668 struct device_node *codec_node =1668 struct device_node *codec_node =
1669 of_get_child_by_name(pdev->dev.parent->of_node, "audio-codec");1669 of_get_child_by_name(pdev->dev.parent->of_node, "audio-codec");
1670 if (!codec_node)
1671 return -ENODEV;
1670 1672
1671 pdev->dev.of_node = codec_node;1673 pdev->dev.of_node = codec_node;
1672 1674
sound/soc/codecs/hdmi-codec.c+1−1
@@ -277,7 +277,7 @@ struct hdmi_codec_priv { · 276 unmodified lines
277 bool busy;277 bool busy;
278 struct snd_soc_jack *jack;278 struct snd_soc_jack *jack;
279 unsigned int jack_status;279 unsigned int jack_status;
280 u8 iec_status[5];280 u8 iec_status[AES_IEC958_STATUS_SIZE];
281};281};
282 282
283static const struct snd_soc_dapm_widget hdmi_widgets[] = {283static const struct snd_soc_dapm_widget hdmi_widgets[] = {
sound/soc/codecs/lpass-rx-macro.c+4−4
@@ -2688,8 +2688,8 @@ static uint32_t get_iir_band_coeff(struct snd_soc_component *component, · 2687 unmodified lines
2688 int reg, b2_reg;2688 int reg, b2_reg;
2689 2689
2690 /* Address does not automatically update if reading */2690 /* Address does not automatically update if reading */
2691 reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL + 16 * iir_idx;2691 reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL + 0x80 * iir_idx;
2692 b2_reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL + 16 * iir_idx;2692 b2_reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL + 0x80 * iir_idx;
2693 2693
2694 snd_soc_component_write(component, reg,2694 snd_soc_component_write(component, reg,
2695 ((band_idx * BAND_MAX + coeff_idx) *2695 ((band_idx * BAND_MAX + coeff_idx) *
@@ -2718,7 +2718,7 @@ static uint32_t get_iir_band_coeff(struct snd_soc_component *component, · 22 unmodified lines
2718static void set_iir_band_coeff(struct snd_soc_component *component,2718static void set_iir_band_coeff(struct snd_soc_component *component,
2719 int iir_idx, int band_idx, uint32_t value)2719 int iir_idx, int band_idx, uint32_t value)
2720{2720{
2721 int reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL + 16 * iir_idx;2721 int reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL + 0x80 * iir_idx;
2722 2722
2723 snd_soc_component_write(component, reg, (value & 0xFF));2723 snd_soc_component_write(component, reg, (value & 0xFF));
2724 snd_soc_component_write(component, reg, (value >> 8) & 0xFF);2724 snd_soc_component_write(component, reg, (value >> 8) & 0xFF);
@@ -2739,7 +2739,7 @@ static int rx_macro_put_iir_band_audio_mixer( · 14 unmodified lines
2739 int iir_idx = ctl->iir_idx;2739 int iir_idx = ctl->iir_idx;
2740 int band_idx = ctl->band_idx;2740 int band_idx = ctl->band_idx;
2741 u32 coeff[BAND_MAX];2741 u32 coeff[BAND_MAX];
2742 int reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL + 16 * iir_idx;2742 int reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL + 0x80 * iir_idx;
2743 2743
2744 memcpy(&coeff[0], ucontrol->value.bytes.data, params->max);2744 memcpy(&coeff[0], ucontrol->value.bytes.data, params->max);
2745 2745
sound/soc/codecs/max9759.c+2−1
@@ -64,7 +64,8 @@ static int speaker_gain_control_put(struct snd_kcontrol *kcontrol, · 63 unmodified lines
64 struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol);64 struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol);
65 struct max9759 *priv = snd_soc_component_get_drvdata(c);65 struct max9759 *priv = snd_soc_component_get_drvdata(c);
66 66
67 if (ucontrol->value.integer.value[0] > 3)67 if (ucontrol->value.integer.value[0] < 0 ||
68 ucontrol->value.integer.value[0] > 3)
68 return -EINVAL;69 return -EINVAL;
69 70
70 priv->gain = ucontrol->value.integer.value[0];71 priv->gain = ucontrol->value.integer.value[0];
sound/soc/codecs/rt5682-i2c.c+4−11
@@ -59,18 +59,12 @@ static void rt5682_jd_check_handler(struct work_struct *work) · 58 unmodified lines
59 struct rt5682_priv *rt5682 = container_of(work, struct rt5682_priv,59 struct rt5682_priv *rt5682 = container_of(work, struct rt5682_priv,
60 jd_check_work.work);60 jd_check_work.work);
61 61
62 if (snd_soc_component_read(rt5682->component, RT5682_AJD1_CTRL)62 if (snd_soc_component_read(rt5682->component, RT5682_AJD1_CTRL) & RT5682_JDH_RS_MASK)
63 & RT5682_JDH_RS_MASK) {
64 /* jack out */63 /* jack out */
65 rt5682->jack_type = rt5682_headset_detect(rt5682->component, 0);64 mod_delayed_work(system_power_efficient_wq,
66 65 &rt5682->jack_detect_work, 0);
67 snd_soc_jack_report(rt5682->hs_jack, rt5682->jack_type,66 else
68 SND_JACK_HEADSET |
69 SND_JACK_BTN_0 | SND_JACK_BTN_1 |
70 SND_JACK_BTN_2 | SND_JACK_BTN_3);
71 } else {
72 schedule_delayed_work(&rt5682->jd_check_work, 500);67 schedule_delayed_work(&rt5682->jd_check_work, 500);
73 }
74}68}
75 69
76static irqreturn_t rt5682_irq(int irq, void *data)70static irqreturn_t rt5682_irq(int irq, void *data)
@@ -198,7 +192,6 @@ static int rt5682_i2c_probe(struct i2c_client *i2c, · 121 unmodified lines
198 }192 }
199 193
200 mutex_init(&rt5682->calibrate_mutex);194 mutex_init(&rt5682->calibrate_mutex);
201 mutex_init(&rt5682->jdet_mutex);
202 rt5682_calibrate(rt5682);195 rt5682_calibrate(rt5682);
203 196
204 rt5682_apply_patch_list(rt5682, &i2c->dev);197 rt5682_apply_patch_list(rt5682, &i2c->dev);
sound/soc/codecs/rt5682.c+8−16
@@ -922,15 +922,13 @@ static void rt5682_enable_push_button_irq(struct snd_soc_component *component, · 921 unmodified lines
922 *922 *
923 * Returns detect status.923 * Returns detect status.
924 */924 */
925int rt5682_headset_detect(struct snd_soc_component *component, int jack_insert)925static int rt5682_headset_detect(struct snd_soc_component *component, int jack_insert)
926{926{
927 struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);927 struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
928 struct snd_soc_dapm_context *dapm = &component->dapm;928 struct snd_soc_dapm_context *dapm = &component->dapm;
929 unsigned int val, count;929 unsigned int val, count;
930 930
931 if (jack_insert) {931 if (jack_insert) {
932 snd_soc_dapm_mutex_lock(dapm);
933
934 snd_soc_component_update_bits(component, RT5682_PWR_ANLG_1,932 snd_soc_component_update_bits(component, RT5682_PWR_ANLG_1,
935 RT5682_PWR_VREF2 | RT5682_PWR_MB,933 RT5682_PWR_VREF2 | RT5682_PWR_MB,
936 RT5682_PWR_VREF2 | RT5682_PWR_MB);934 RT5682_PWR_VREF2 | RT5682_PWR_MB);
@@ -981,8 +979,6 @@ int rt5682_headset_detect(struct snd_soc_component *component, int jack_insert) · 44 unmodified lines
981 snd_soc_component_update_bits(component, RT5682_MICBIAS_2,979 snd_soc_component_update_bits(component, RT5682_MICBIAS_2,
982 RT5682_PWR_CLK25M_MASK | RT5682_PWR_CLK1M_MASK,980 RT5682_PWR_CLK25M_MASK | RT5682_PWR_CLK1M_MASK,
983 RT5682_PWR_CLK25M_PU | RT5682_PWR_CLK1M_PU);981 RT5682_PWR_CLK25M_PU | RT5682_PWR_CLK1M_PU);
984
985 snd_soc_dapm_mutex_unlock(dapm);
986 } else {982 } else {
987 rt5682_enable_push_button_irq(component, false);983 rt5682_enable_push_button_irq(component, false);
988 snd_soc_component_update_bits(component, RT5682_CBJ_CTRL_1,984 snd_soc_component_update_bits(component, RT5682_CBJ_CTRL_1,
@@ -1011,7 +1007,6 @@ int rt5682_headset_detect(struct snd_soc_component *component, int jack_insert) · 22 unmodified lines
1011 dev_dbg(component->dev, "jack_type = %d\n", rt5682->jack_type);1007 dev_dbg(component->dev, "jack_type = %d\n", rt5682->jack_type);
1012 return rt5682->jack_type;1008 return rt5682->jack_type;
1013}1009}
1014EXPORT_SYMBOL_GPL(rt5682_headset_detect);
1015 1010
1016static int rt5682_set_jack_detect(struct snd_soc_component *component,1011static int rt5682_set_jack_detect(struct snd_soc_component *component,
1017 struct snd_soc_jack *hs_jack, void *data)1012 struct snd_soc_jack *hs_jack, void *data)
@@ -1094,6 +1089,7 @@ void rt5682_jack_detect_handler(struct work_struct *work) · 76 unmodified lines
1094{1089{
1095 struct rt5682_priv *rt5682 =1090 struct rt5682_priv *rt5682 =
1096 container_of(work, struct rt5682_priv, jack_detect_work.work);1091 container_of(work, struct rt5682_priv, jack_detect_work.work);
1092 struct snd_soc_dapm_context *dapm;
1097 int val, btn_type;1093 int val, btn_type;
1098 1094
1099 while (!rt5682->component)1095 while (!rt5682->component)
@@ -1102,7 +1098,9 @@ void rt5682_jack_detect_handler(struct work_struct *work) · 2 unmodified lines
1102 while (!rt5682->component->card->instantiated)1098 while (!rt5682->component->card->instantiated)
1103 usleep_range(10000, 15000);1099 usleep_range(10000, 15000);
1104 1100
1105 mutex_lock(&rt5682->jdet_mutex);1101 dapm = snd_soc_component_get_dapm(rt5682->component);
1102
1103 snd_soc_dapm_mutex_lock(dapm);
1106 mutex_lock(&rt5682->calibrate_mutex);1104 mutex_lock(&rt5682->calibrate_mutex);
1107 1105
1108 val = snd_soc_component_read(rt5682->component, RT5682_AJD1_CTRL)1106 val = snd_soc_component_read(rt5682->component, RT5682_AJD1_CTRL)
@@ -1162,6 +1160,9 @@ void rt5682_jack_detect_handler(struct work_struct *work) · 53 unmodified lines
1162 rt5682->irq_work_delay_time = 50;1160 rt5682->irq_work_delay_time = 50;
1163 }1161 }
1164 1162
1163 mutex_unlock(&rt5682->calibrate_mutex);
1164 snd_soc_dapm_mutex_unlock(dapm);
1165
1165 snd_soc_jack_report(rt5682->hs_jack, rt5682->jack_type,1166 snd_soc_jack_report(rt5682->hs_jack, rt5682->jack_type,
1166 SND_JACK_HEADSET |1167 SND_JACK_HEADSET |
1167 SND_JACK_BTN_0 | SND_JACK_BTN_1 |1168 SND_JACK_BTN_0 | SND_JACK_BTN_1 |
@@ -1174,9 +1175,6 @@ void rt5682_jack_detect_handler(struct work_struct *work) · 6 unmodified lines
1174 else1175 else
1175 cancel_delayed_work_sync(&rt5682->jd_check_work);1176 cancel_delayed_work_sync(&rt5682->jd_check_work);
1176 }1177 }
1177
1178 mutex_unlock(&rt5682->calibrate_mutex);
1179 mutex_unlock(&rt5682->jdet_mutex);
1180}1178}
1181EXPORT_SYMBOL_GPL(rt5682_jack_detect_handler);1179EXPORT_SYMBOL_GPL(rt5682_jack_detect_handler);
1182 1180
@@ -1526,7 +1524,6 @@ static int rt5682_hp_event(struct snd_soc_dapm_widget *w, · 343 unmodified lines
1526{1524{
1527 struct snd_soc_component *component =1525 struct snd_soc_component *component =
1528 snd_soc_dapm_to_component(w->dapm);1526 snd_soc_dapm_to_component(w->dapm);
1529 struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
1530 1527
1531 switch (event) {1528 switch (event) {
1532 case SND_SOC_DAPM_PRE_PMU:1529 case SND_SOC_DAPM_PRE_PMU:
@@ -1538,17 +1535,12 @@ static int rt5682_hp_event(struct snd_soc_dapm_widget *w, · 5 unmodified lines
1538 RT5682_DEPOP_1, 0x60, 0x60);1535 RT5682_DEPOP_1, 0x60, 0x60);
1539 snd_soc_component_update_bits(component,1536 snd_soc_component_update_bits(component,
1540 RT5682_DAC_ADC_DIG_VOL1, 0x00c0, 0x0080);1537 RT5682_DAC_ADC_DIG_VOL1, 0x00c0, 0x0080);
1541
1542 mutex_lock(&rt5682->jdet_mutex);
1543
1544 snd_soc_component_update_bits(component, RT5682_HP_CTRL_2,1538 snd_soc_component_update_bits(component, RT5682_HP_CTRL_2,
1545 RT5682_HP_C2_DAC_L_EN | RT5682_HP_C2_DAC_R_EN,1539 RT5682_HP_C2_DAC_L_EN | RT5682_HP_C2_DAC_R_EN,
1546 RT5682_HP_C2_DAC_L_EN | RT5682_HP_C2_DAC_R_EN);1540 RT5682_HP_C2_DAC_L_EN | RT5682_HP_C2_DAC_R_EN);
1547 usleep_range(5000, 10000);1541 usleep_range(5000, 10000);
1548 snd_soc_component_update_bits(component, RT5682_CHARGE_PUMP_1,1542 snd_soc_component_update_bits(component, RT5682_CHARGE_PUMP_1,
1549 RT5682_CP_SW_SIZE_MASK, RT5682_CP_SW_SIZE_L);1543 RT5682_CP_SW_SIZE_MASK, RT5682_CP_SW_SIZE_L);
1550
1551 mutex_unlock(&rt5682->jdet_mutex);
1552 break;1544 break;
1553 1545
1554 case SND_SOC_DAPM_POST_PMD:1546 case SND_SOC_DAPM_POST_PMD:
sound/soc/codecs/rt5682.h+0−2
@@ -1463,7 +1463,6 @@ struct rt5682_priv { · 1462 unmodified lines
1463 1463
1464 int jack_type;1464 int jack_type;
1465 int irq_work_delay_time;1465 int irq_work_delay_time;
1466 struct mutex jdet_mutex;
1467};1466};
1468 1467
1469extern const char *rt5682_supply_names[RT5682_NUM_SUPPLIES];1468extern const char *rt5682_supply_names[RT5682_NUM_SUPPLIES];
@@ -1473,7 +1472,6 @@ int rt5682_sel_asrc_clk_src(struct snd_soc_component *component, · 3 unmodified lines
1473 1472
1474void rt5682_apply_patch_list(struct rt5682_priv *rt5682, struct device *dev);1473void rt5682_apply_patch_list(struct rt5682_priv *rt5682, struct device *dev);
1475 1474
1476int rt5682_headset_detect(struct snd_soc_component *component, int jack_insert);
1477void rt5682_jack_detect_handler(struct work_struct *work);1475void rt5682_jack_detect_handler(struct work_struct *work);
1478 1476
1479bool rt5682_volatile_register(struct device *dev, unsigned int reg);1477bool rt5682_volatile_register(struct device *dev, unsigned int reg);
sound/soc/codecs/wcd938x.c+17−14
@@ -1432,14 +1432,10 @@ static int wcd938x_sdw_connect_port(struct wcd938x_sdw_ch_info *ch_info, · 1431 unmodified lines
1432 return 0;1432 return 0;
1433}1433}
1434 1434
1435static int wcd938x_connect_port(struct wcd938x_sdw_priv *wcd, u8 ch_id, u8 enable)1435static int wcd938x_connect_port(struct wcd938x_sdw_priv *wcd, u8 port_num, u8 ch_id, u8 enable)
1436{1436{
1437 u8 port_num;
1438
1439 port_num = wcd->ch_info[ch_id].port_num;
1440
1441 return wcd938x_sdw_connect_port(&wcd->ch_info[ch_id],1437 return wcd938x_sdw_connect_port(&wcd->ch_info[ch_id],
1442 &wcd->port_config[port_num],1438 &wcd->port_config[port_num - 1],
1443 enable);1439 enable);
1444}1440}
1445 1441
@@ -2563,7 +2559,7 @@ static int wcd938x_ear_pa_put_gain(struct snd_kcontrol *kcontrol, · 1117 unmodified lines
2563 WCD938X_EAR_GAIN_MASK,2559 WCD938X_EAR_GAIN_MASK,
2564 ucontrol->value.integer.value[0]);2560 ucontrol->value.integer.value[0]);
2565 2561
2566 return 0;2562 return 1;
2567}2563}
2568 2564
2569static int wcd938x_get_compander(struct snd_kcontrol *kcontrol,2565static int wcd938x_get_compander(struct snd_kcontrol *kcontrol,
@@ -2593,6 +2589,7 @@ static int wcd938x_set_compander(struct snd_kcontrol *kcontrol, · 23 unmodified lines
2593 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component);2589 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component);
2594 struct wcd938x_sdw_priv *wcd;2590 struct wcd938x_sdw_priv *wcd;
2595 int value = ucontrol->value.integer.value[0];2591 int value = ucontrol->value.integer.value[0];
2592 int portidx;
2596 struct soc_mixer_control *mc;2593 struct soc_mixer_control *mc;
2597 bool hphr;2594 bool hphr;
2598 2595
@@ -2606,12 +2603,14 @@ static int wcd938x_set_compander(struct snd_kcontrol *kcontrol, · 7 unmodified lines
2606 else2603 else
2607 wcd938x->comp1_enable = value;2604 wcd938x->comp1_enable = value;
2608 2605
2606 portidx = wcd->ch_info[mc->reg].port_num;
2607
2609 if (value)2608 if (value)
2610 wcd938x_connect_port(wcd, mc->reg, true);2609 wcd938x_connect_port(wcd, portidx, mc->reg, true);
2611 else2610 else
2612 wcd938x_connect_port(wcd, mc->reg, false);2611 wcd938x_connect_port(wcd, portidx, mc->reg, false);
2613 2612
2614 return 0;2613 return 1;
2615}2614}
2616 2615
2617static int wcd938x_ldoh_get(struct snd_kcontrol *kcontrol,2616static int wcd938x_ldoh_get(struct snd_kcontrol *kcontrol,
@@ -2882,9 +2881,11 @@ static int wcd938x_get_swr_port(struct snd_kcontrol *kcontrol, · 264 unmodified lines
2882 struct wcd938x_sdw_priv *wcd;2881 struct wcd938x_sdw_priv *wcd;
2883 struct soc_mixer_control *mixer = (struct soc_mixer_control *)kcontrol->private_value;2882 struct soc_mixer_control *mixer = (struct soc_mixer_control *)kcontrol->private_value;
2884 int dai_id = mixer->shift;2883 int dai_id = mixer->shift;
2885 int portidx = mixer->reg;2884 int portidx, ch_idx = mixer->reg;
2885
2886 2886
2887 wcd = wcd938x->sdw_priv[dai_id];2887 wcd = wcd938x->sdw_priv[dai_id];
2888 portidx = wcd->ch_info[ch_idx].port_num;
2888 2889
2889 ucontrol->value.integer.value[0] = wcd->port_enable[portidx];2890 ucontrol->value.integer.value[0] = wcd->port_enable[portidx];
2890 2891
@@ -2899,12 +2900,14 @@ static int wcd938x_set_swr_port(struct snd_kcontrol *kcontrol, · 8 unmodified lines
2899 struct wcd938x_sdw_priv *wcd;2900 struct wcd938x_sdw_priv *wcd;
2900 struct soc_mixer_control *mixer =2901 struct soc_mixer_control *mixer =
2901 (struct soc_mixer_control *)kcontrol->private_value;2902 (struct soc_mixer_control *)kcontrol->private_value;
2902 int portidx = mixer->reg;2903 int ch_idx = mixer->reg;
2904 int portidx;
2903 int dai_id = mixer->shift;2905 int dai_id = mixer->shift;
2904 bool enable;2906 bool enable;
2905 2907
2906 wcd = wcd938x->sdw_priv[dai_id];2908 wcd = wcd938x->sdw_priv[dai_id];
2907 2909
2910 portidx = wcd->ch_info[ch_idx].port_num;
2908 if (ucontrol->value.integer.value[0])2911 if (ucontrol->value.integer.value[0])
2909 enable = true;2912 enable = true;
2910 else2913 else
@@ -2912,9 +2915,9 @@ static int wcd938x_set_swr_port(struct snd_kcontrol *kcontrol, · 1 unmodified line
2912 2915
2913 wcd->port_enable[portidx] = enable;2916 wcd->port_enable[portidx] = enable;
2914 2917
2915 wcd938x_connect_port(wcd, portidx, enable);2918 wcd938x_connect_port(wcd, portidx, ch_idx, enable);
2916 2919
2917 return 0;2920 return 1;
2918 2921
2919}2922}
2920 2923
sound/soc/fsl/pcm030-audio-fabric.c+8−3
@@ -93,16 +93,21 @@ static int pcm030_fabric_probe(struct platform_device *op) · 92 unmodified lines
93 dev_err(&op->dev, "platform_device_alloc() failed\n");93 dev_err(&op->dev, "platform_device_alloc() failed\n");
94 94
95 ret = platform_device_add(pdata->codec_device);95 ret = platform_device_add(pdata->codec_device);
96 if (ret)96 if (ret) {
97 dev_err(&op->dev, "platform_device_add() failed: %d\n", ret);97 dev_err(&op->dev, "platform_device_add() failed: %d\n", ret);
98 platform_device_put(pdata->codec_device);
99 }
98 100
99 ret = snd_soc_register_card(card);101 ret = snd_soc_register_card(card);
100 if (ret)102 if (ret) {
101 dev_err(&op->dev, "snd_soc_register_card() failed: %d\n", ret);103 dev_err(&op->dev, "snd_soc_register_card() failed: %d\n", ret);
104 platform_device_del(pdata->codec_device);
105 platform_device_put(pdata->codec_device);
106 }
102 107
103 platform_set_drvdata(op, pdata);108 platform_set_drvdata(op, pdata);
104
105 return ret;109 return ret;
110
106}111}
107 112
108static int pcm030_fabric_remove(struct platform_device *op)113static int pcm030_fabric_remove(struct platform_device *op)
sound/soc/generic/simple-card.c+25−1
@@ -28,6 +28,30 @@ static const struct snd_soc_ops simple_ops = { · 27 unmodified lines
28 .hw_params = asoc_simple_hw_params,28 .hw_params = asoc_simple_hw_params,
29};29};
30 30
31static int asoc_simple_parse_platform(struct device_node *node,
32 struct snd_soc_dai_link_component *dlc)
33{
34 struct of_phandle_args args;
35 int ret;
36
37 if (!node)
38 return 0;
39
40 /*
41 * Get node via "sound-dai = <&phandle port>"
42 * it will be used as xxx_of_node on soc_bind_dai_link()
43 */
44 ret = of_parse_phandle_with_args(node, DAI, CELL, 0, &args);
45 if (ret)
46 return ret;
47
48 /* dai_name is not required and may not exist for plat component */
49
50 dlc->of_node = args.np;
51
52 return 0;
53}
54
31static int asoc_simple_parse_dai(struct device_node *node,55static int asoc_simple_parse_dai(struct device_node *node,
32 struct snd_soc_dai_link_component *dlc,56 struct snd_soc_dai_link_component *dlc,
33 int *is_single_link)57 int *is_single_link)
@@ -289,7 +313,7 @@ static int simple_dai_link_of(struct asoc_simple_priv *priv, · 255 unmodified lines
289 if (ret < 0)313 if (ret < 0)
290 goto dai_link_of_err;314 goto dai_link_of_err;
291 315
292 ret = asoc_simple_parse_dai(plat, platforms, NULL);316 ret = asoc_simple_parse_platform(plat, platforms);
293 if (ret < 0)317 if (ret < 0)
294 goto dai_link_of_err;318 goto dai_link_of_err;
295 319
sound/soc/mediatek/Kconfig+1−1
@@ -216,7 +216,7 @@ config SND_SOC_MT8195_MT6359_RT1019_RT5682 · 215 unmodified lines
216 216
217config SND_SOC_MT8195_MT6359_RT1011_RT5682217config SND_SOC_MT8195_MT6359_RT1011_RT5682
218 tristate "ASoC Audio driver for MT8195 with MT6359 RT1011 RT5682 codec"218 tristate "ASoC Audio driver for MT8195 with MT6359 RT1011 RT5682 codec"
219 depends on I2C219 depends on I2C && GPIOLIB
220 depends on SND_SOC_MT8195 && MTK_PMIC_WRAP220 depends on SND_SOC_MT8195 && MTK_PMIC_WRAP
221 select SND_SOC_MT6359221 select SND_SOC_MT6359
222 select SND_SOC_RT1011222 select SND_SOC_RT1011
sound/soc/qcom/qdsp6/q6apm-dai.c+5−2
@@ -308,8 +308,11 @@ static int q6apm_dai_close(struct snd_soc_component *component, · 307 unmodified lines
308 struct snd_pcm_runtime *runtime = substream->runtime;308 struct snd_pcm_runtime *runtime = substream->runtime;
309 struct q6apm_dai_rtd *prtd = runtime->private_data;309 struct q6apm_dai_rtd *prtd = runtime->private_data;
310 310
311 q6apm_graph_stop(prtd->graph);311 if (prtd->state) { /* only stop graph that is started */
312 q6apm_unmap_memory_regions(prtd->graph, substream->stream);312 q6apm_graph_stop(prtd->graph);
313 q6apm_unmap_memory_regions(prtd->graph, substream->stream);
314 }
315
313 q6apm_graph_close(prtd->graph);316 q6apm_graph_close(prtd->graph);
314 prtd->graph = NULL;317 prtd->graph = NULL;
315 kfree(prtd);318 kfree(prtd);
sound/soc/soc-acpi.c+2−5
@@ -55,16 +55,13 @@ EXPORT_SYMBOL_GPL(snd_soc_acpi_find_machine); · 54 unmodified lines
55static acpi_status snd_soc_acpi_find_package(acpi_handle handle, u32 level,55static acpi_status snd_soc_acpi_find_package(acpi_handle handle, u32 level,
56 void *context, void **ret)56 void *context, void **ret)
57{57{
58 struct acpi_device *adev;58 struct acpi_device *adev = acpi_fetch_acpi_dev(handle);
59 acpi_status status;59 acpi_status status;
60 struct snd_soc_acpi_package_context *pkg_ctx = context;60 struct snd_soc_acpi_package_context *pkg_ctx = context;
61 61
62 pkg_ctx->data_valid = false;62 pkg_ctx->data_valid = false;
63 63
64 if (acpi_bus_get_device(handle, &adev))64 if (adev && adev->status.present && adev->status.functional) {
65 return AE_OK;
66
67 if (adev->status.present && adev->status.functional) {
68 struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};65 struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
69 union acpi_object *myobj = NULL;66 union acpi_object *myobj = NULL;
70 67
sound/soc/soc-ops.c+26−3
@@ -316,13 +316,27 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol, · 315 unmodified lines
316 if (sign_bit)316 if (sign_bit)
317 mask = BIT(sign_bit + 1) - 1;317 mask = BIT(sign_bit + 1) - 1;
318 318
319 val = ((ucontrol->value.integer.value[0] + min) & mask);319 if (ucontrol->value.integer.value[0] < 0)
320 return -EINVAL;
321 val = ucontrol->value.integer.value[0];
322 if (mc->platform_max && val > mc->platform_max)
323 return -EINVAL;
324 if (val > max - min)
325 return -EINVAL;
326 val = (val + min) & mask;
320 if (invert)327 if (invert)
321 val = max - val;328 val = max - val;
322 val_mask = mask << shift;329 val_mask = mask << shift;
323 val = val << shift;330 val = val << shift;
324 if (snd_soc_volsw_is_stereo(mc)) {331 if (snd_soc_volsw_is_stereo(mc)) {
325 val2 = ((ucontrol->value.integer.value[1] + min) & mask);332 if (ucontrol->value.integer.value[1] < 0)
333 return -EINVAL;
334 val2 = ucontrol->value.integer.value[1];
335 if (mc->platform_max && val2 > mc->platform_max)
336 return -EINVAL;
337 if (val2 > max - min)
338 return -EINVAL;
339 val2 = (val2 + min) & mask;
326 if (invert)340 if (invert)
327 val2 = max - val2;341 val2 = max - val2;
328 if (reg == reg2) {342 if (reg == reg2) {
@@ -409,8 +423,15 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol, · 80 unmodified lines
409 int err = 0;423 int err = 0;
410 unsigned int val, val_mask;424 unsigned int val, val_mask;
411 425
426 if (ucontrol->value.integer.value[0] < 0)
427 return -EINVAL;
428 val = ucontrol->value.integer.value[0];
429 if (mc->platform_max && val > mc->platform_max)
430 return -EINVAL;
431 if (val > max - min)
432 return -EINVAL;
412 val_mask = mask << shift;433 val_mask = mask << shift;
413 val = (ucontrol->value.integer.value[0] + min) & mask;434 val = (val + min) & mask;
414 val = val << shift;435 val = val << shift;
415 436
416 err = snd_soc_component_update_bits(component, reg, val_mask, val);437 err = snd_soc_component_update_bits(component, reg, val_mask, val);
@@ -858,6 +879,8 @@ int snd_soc_put_xr_sx(struct snd_kcontrol *kcontrol, · 441 unmodified lines
858 long val = ucontrol->value.integer.value[0];879 long val = ucontrol->value.integer.value[0];
859 unsigned int i;880 unsigned int i;
860 881
882 if (val < mc->min || val > mc->max)
883 return -EINVAL;
861 if (invert)884 if (invert)
862 val = max - val;885 val = max - val;
863 val &= mask;886 val &= mask;
sound/soc/soc-pcm.c+12−6
@@ -46,8 +46,8 @@ static inline void snd_soc_dpcm_stream_lock_irq(struct snd_soc_pcm_runtime *rtd, · 45 unmodified lines
46 snd_pcm_stream_lock_irq(snd_soc_dpcm_get_substream(rtd, stream));46 snd_pcm_stream_lock_irq(snd_soc_dpcm_get_substream(rtd, stream));
47}47}
48 48
49#define snd_soc_dpcm_stream_lock_irqsave(rtd, stream, flags) \49#define snd_soc_dpcm_stream_lock_irqsave_nested(rtd, stream, flags) \
50 snd_pcm_stream_lock_irqsave(snd_soc_dpcm_get_substream(rtd, stream), flags)50 snd_pcm_stream_lock_irqsave_nested(snd_soc_dpcm_get_substream(rtd, stream), flags)
51 51
52static inline void snd_soc_dpcm_stream_unlock_irq(struct snd_soc_pcm_runtime *rtd,52static inline void snd_soc_dpcm_stream_unlock_irq(struct snd_soc_pcm_runtime *rtd,
53 int stream)53 int stream)
@@ -1268,6 +1268,7 @@ static void dpcm_be_reparent(struct snd_soc_pcm_runtime *fe, · 1214 unmodified lines
1268void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream)1268void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream)
1269{1269{
1270 struct snd_soc_dpcm *dpcm, *d;1270 struct snd_soc_dpcm *dpcm, *d;
1271 LIST_HEAD(deleted_dpcms);
1271 1272
1272 snd_soc_dpcm_mutex_assert_held(fe);1273 snd_soc_dpcm_mutex_assert_held(fe);
1273 1274
@@ -1287,13 +1288,18 @@ void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream) · 13 unmodified lines
1287 /* BEs still alive need new FE */1288 /* BEs still alive need new FE */
1288 dpcm_be_reparent(fe, dpcm->be, stream);1289 dpcm_be_reparent(fe, dpcm->be, stream);
1289 1290
1290 dpcm_remove_debugfs_state(dpcm);
1291
1292 list_del(&dpcm->list_be);1291 list_del(&dpcm->list_be);
1292 list_move(&dpcm->list_fe, &deleted_dpcms);
1293 }
1294 snd_soc_dpcm_stream_unlock_irq(fe, stream);
1295
1296 while (!list_empty(&deleted_dpcms)) {
1297 dpcm = list_first_entry(&deleted_dpcms, struct snd_soc_dpcm,
1298 list_fe);
1293 list_del(&dpcm->list_fe);1299 list_del(&dpcm->list_fe);
1300 dpcm_remove_debugfs_state(dpcm);
1294 kfree(dpcm);1301 kfree(dpcm);
1295 }1302 }
1296 snd_soc_dpcm_stream_unlock_irq(fe, stream);
1297}1303}
1298 1304
1299/* get BE for DAI widget and stream */1305/* get BE for DAI widget and stream */
@@ -2094,7 +2100,7 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, · 794 unmodified lines
2094 be = dpcm->be;2100 be = dpcm->be;
2095 be_substream = snd_soc_dpcm_get_substream(be, stream);2101 be_substream = snd_soc_dpcm_get_substream(be, stream);
2096 2102
2097 snd_soc_dpcm_stream_lock_irqsave(be, stream, flags);2103 snd_soc_dpcm_stream_lock_irqsave_nested(be, stream, flags);
2098 2104
2099 /* is this op for this BE ? */2105 /* is this op for this BE ? */
2100 if (!snd_soc_dpcm_be_can_update(fe, be, stream))2106 if (!snd_soc_dpcm_be_can_update(fe, be, stream))
sound/soc/xilinx/xlnx_formatter_pcm.c+24−3
@@ -37,6 +37,7 @@ · 36 unmodified lines
37#define XLNX_AUD_XFER_COUNT 0x2837#define XLNX_AUD_XFER_COUNT 0x28
38#define XLNX_AUD_CH_STS_START 0x2C38#define XLNX_AUD_CH_STS_START 0x2C
39#define XLNX_BYTES_PER_CH 0x4439#define XLNX_BYTES_PER_CH 0x44
40#define XLNX_AUD_ALIGN_BYTES 64
40 41
41#define AUD_STS_IOC_IRQ_MASK BIT(31)42#define AUD_STS_IOC_IRQ_MASK BIT(31)
42#define AUD_STS_CH_STS_MASK BIT(29)43#define AUD_STS_CH_STS_MASK BIT(29)
@@ -368,12 +369,32 @@ static int xlnx_formatter_pcm_open(struct snd_soc_component *component, · 325 unmodified lines
368 snd_soc_set_runtime_hwparams(substream, &xlnx_pcm_hardware);369 snd_soc_set_runtime_hwparams(substream, &xlnx_pcm_hardware);
369 runtime->private_data = stream_data;370 runtime->private_data = stream_data;
370 371
371 /* Resize the period size divisible by 64 */372 /* Resize the period bytes as divisible by 64 */
372 err = snd_pcm_hw_constraint_step(runtime, 0,373 err = snd_pcm_hw_constraint_step(runtime, 0,
373 SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64);374 SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
375 XLNX_AUD_ALIGN_BYTES);
374 if (err) {376 if (err) {
375 dev_err(component->dev,377 dev_err(component->dev,
376 "unable to set constraint on period bytes\n");378 "Unable to set constraint on period bytes\n");
379 return err;
380 }
381
382 /* Resize the buffer bytes as divisible by 64 */
383 err = snd_pcm_hw_constraint_step(runtime, 0,
384 SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
385 XLNX_AUD_ALIGN_BYTES);
386 if (err) {
387 dev_err(component->dev,
388 "Unable to set constraint on buffer bytes\n");
389 return err;
390 }
391
392 /* Set periods as integer multiple */
393 err = snd_pcm_hw_constraint_integer(runtime,
394 SNDRV_PCM_HW_PARAM_PERIODS);
395 if (err < 0) {
396 dev_err(component->dev,
397 "Unable to set constraint on periods to be integer\n");
377 return err;398 return err;
378 }399 }
379 400
sound/usb/mixer.c+4−0
@@ -1527,6 +1527,10 @@ error: · 1526 unmodified lines
1527 usb_audio_err(chip,1527 usb_audio_err(chip,
1528 "cannot get connectors status: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n",1528 "cannot get connectors status: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n",
1529 UAC_GET_CUR, validx, idx, cval->val_type);1529 UAC_GET_CUR, validx, idx, cval->val_type);
1530
1531 if (val)
1532 *val = 0;
1533
1530 return filter_error(cval, ret);1534 return filter_error(cval, ret);
1531 }1535 }
1532 1536
sound/usb/quirks-table.h+1−1
@@ -84,7 +84,7 @@ · 83 unmodified lines
84 * combination.84 * combination.
85 */85 */
86{86{
87 USB_DEVICE(0x041e, 0x4095),87 USB_AUDIO_DEVICE(0x041e, 0x4095),
88 .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {88 .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
89 .ifnum = QUIRK_ANY_INTERFACE,89 .ifnum = QUIRK_ANY_INTERFACE,
90 .type = QUIRK_COMPOSITE,90 .type = QUIRK_COMPOSITE,
tools/bpf/resolve_btfids/Makefile+5−1
@@ -9,7 +9,11 @@ ifeq ($(V),1) · 8 unmodified lines
9 msg =9 msg =
10else10else
11 Q = @11 Q = @
12 msg = @printf ' %-8s %s%s\n' "$(1)" "$(notdir $(2))" "$(if $(3), $(3))";12 ifeq ($(silent),1)
13 msg =
14 else
15 msg = @printf ' %-8s %s%s\n' "$(1)" "$(notdir $(2))" "$(if $(3), $(3))";
16 endif
13 MAKEFLAGS=--no-print-directory17 MAKEFLAGS=--no-print-directory
14endif18endif
15 19
tools/include/uapi/linux/lirc.h+0−229
@@ -1,229 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/*
3 * lirc.h - linux infrared remote control header file
4 * last modified 2010/07/13 by Jarod Wilson
5 */
6
7#ifndef _LINUX_LIRC_H
8#define _LINUX_LIRC_H
9
10#include <linux/types.h>
11#include <linux/ioctl.h>
12
13#define PULSE_BIT 0x01000000
14#define PULSE_MASK 0x00FFFFFF
15
16#define LIRC_MODE2_SPACE 0x00000000
17#define LIRC_MODE2_PULSE 0x01000000
18#define LIRC_MODE2_FREQUENCY 0x02000000
19#define LIRC_MODE2_TIMEOUT 0x03000000
20
21#define LIRC_VALUE_MASK 0x00FFFFFF
22#define LIRC_MODE2_MASK 0xFF000000
23
24#define LIRC_SPACE(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_SPACE)
25#define LIRC_PULSE(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_PULSE)
26#define LIRC_FREQUENCY(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_FREQUENCY)
27#define LIRC_TIMEOUT(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_TIMEOUT)
28
29#define LIRC_VALUE(val) ((val)&LIRC_VALUE_MASK)
30#define LIRC_MODE2(val) ((val)&LIRC_MODE2_MASK)
31
32#define LIRC_IS_SPACE(val) (LIRC_MODE2(val) == LIRC_MODE2_SPACE)
33#define LIRC_IS_PULSE(val) (LIRC_MODE2(val) == LIRC_MODE2_PULSE)
34#define LIRC_IS_FREQUENCY(val) (LIRC_MODE2(val) == LIRC_MODE2_FREQUENCY)
35#define LIRC_IS_TIMEOUT(val) (LIRC_MODE2(val) == LIRC_MODE2_TIMEOUT)
36
37/* used heavily by lirc userspace */
38#define lirc_t int
39
40/*** lirc compatible hardware features ***/
41
42#define LIRC_MODE2SEND(x) (x)
43#define LIRC_SEND2MODE(x) (x)
44#define LIRC_MODE2REC(x) ((x) << 16)
45#define LIRC_REC2MODE(x) ((x) >> 16)
46
47#define LIRC_MODE_RAW 0x00000001
48#define LIRC_MODE_PULSE 0x00000002
49#define LIRC_MODE_MODE2 0x00000004
50#define LIRC_MODE_SCANCODE 0x00000008
51#define LIRC_MODE_LIRCCODE 0x00000010
52
53
54#define LIRC_CAN_SEND_RAW LIRC_MODE2SEND(LIRC_MODE_RAW)
55#define LIRC_CAN_SEND_PULSE LIRC_MODE2SEND(LIRC_MODE_PULSE)
56#define LIRC_CAN_SEND_MODE2 LIRC_MODE2SEND(LIRC_MODE_MODE2)
57#define LIRC_CAN_SEND_LIRCCODE LIRC_MODE2SEND(LIRC_MODE_LIRCCODE)
58
59#define LIRC_CAN_SEND_MASK 0x0000003f
60
61#define LIRC_CAN_SET_SEND_CARRIER 0x00000100
62#define LIRC_CAN_SET_SEND_DUTY_CYCLE 0x00000200
63#define LIRC_CAN_SET_TRANSMITTER_MASK 0x00000400
64
65#define LIRC_CAN_REC_RAW LIRC_MODE2REC(LIRC_MODE_RAW)
66#define LIRC_CAN_REC_PULSE LIRC_MODE2REC(LIRC_MODE_PULSE)
67#define LIRC_CAN_REC_MODE2 LIRC_MODE2REC(LIRC_MODE_MODE2)
68#define LIRC_CAN_REC_SCANCODE LIRC_MODE2REC(LIRC_MODE_SCANCODE)
69#define LIRC_CAN_REC_LIRCCODE LIRC_MODE2REC(LIRC_MODE_LIRCCODE)
70
71#define LIRC_CAN_REC_MASK LIRC_MODE2REC(LIRC_CAN_SEND_MASK)
72
73#define LIRC_CAN_SET_REC_CARRIER (LIRC_CAN_SET_SEND_CARRIER << 16)
74#define LIRC_CAN_SET_REC_DUTY_CYCLE (LIRC_CAN_SET_SEND_DUTY_CYCLE << 16)
75
76#define LIRC_CAN_SET_REC_DUTY_CYCLE_RANGE 0x40000000
77#define LIRC_CAN_SET_REC_CARRIER_RANGE 0x80000000
78#define LIRC_CAN_GET_REC_RESOLUTION 0x20000000
79#define LIRC_CAN_SET_REC_TIMEOUT 0x10000000
80#define LIRC_CAN_SET_REC_FILTER 0x08000000
81
82#define LIRC_CAN_MEASURE_CARRIER 0x02000000
83#define LIRC_CAN_USE_WIDEBAND_RECEIVER 0x04000000
84
85#define LIRC_CAN_SEND(x) ((x)&LIRC_CAN_SEND_MASK)
86#define LIRC_CAN_REC(x) ((x)&LIRC_CAN_REC_MASK)
87
88#define LIRC_CAN_NOTIFY_DECODE 0x01000000
89
90/*** IOCTL commands for lirc driver ***/
91
92#define LIRC_GET_FEATURES _IOR('i', 0x00000000, __u32)
93
94#define LIRC_GET_SEND_MODE _IOR('i', 0x00000001, __u32)
95#define LIRC_GET_REC_MODE _IOR('i', 0x00000002, __u32)
96#define LIRC_GET_REC_RESOLUTION _IOR('i', 0x00000007, __u32)
97
98#define LIRC_GET_MIN_TIMEOUT _IOR('i', 0x00000008, __u32)
99#define LIRC_GET_MAX_TIMEOUT _IOR('i', 0x00000009, __u32)
100
101/* code length in bits, currently only for LIRC_MODE_LIRCCODE */
102#define LIRC_GET_LENGTH _IOR('i', 0x0000000f, __u32)
103
104#define LIRC_SET_SEND_MODE _IOW('i', 0x00000011, __u32)
105#define LIRC_SET_REC_MODE _IOW('i', 0x00000012, __u32)
106/* Note: these can reset the according pulse_width */
107#define LIRC_SET_SEND_CARRIER _IOW('i', 0x00000013, __u32)
108#define LIRC_SET_REC_CARRIER _IOW('i', 0x00000014, __u32)
109#define LIRC_SET_SEND_DUTY_CYCLE _IOW('i', 0x00000015, __u32)
110#define LIRC_SET_TRANSMITTER_MASK _IOW('i', 0x00000017, __u32)
111
112/*
113 * when a timeout != 0 is set the driver will send a
114 * LIRC_MODE2_TIMEOUT data packet, otherwise LIRC_MODE2_TIMEOUT is
115 * never sent, timeout is disabled by default
116 */
117#define LIRC_SET_REC_TIMEOUT _IOW('i', 0x00000018, __u32)
118
119/* 1 enables, 0 disables timeout reports in MODE2 */
120#define LIRC_SET_REC_TIMEOUT_REPORTS _IOW('i', 0x00000019, __u32)
121
122/*
123 * if enabled from the next key press on the driver will send
124 * LIRC_MODE2_FREQUENCY packets
125 */
126#define LIRC_SET_MEASURE_CARRIER_MODE _IOW('i', 0x0000001d, __u32)
127
128/*
129 * to set a range use LIRC_SET_REC_CARRIER_RANGE with the
130 * lower bound first and later LIRC_SET_REC_CARRIER with the upper bound
131 */
132#define LIRC_SET_REC_CARRIER_RANGE _IOW('i', 0x0000001f, __u32)
133
134#define LIRC_SET_WIDEBAND_RECEIVER _IOW('i', 0x00000023, __u32)
135
136/*
137 * Return the recording timeout, which is either set by
138 * the ioctl LIRC_SET_REC_TIMEOUT or by the kernel after setting the protocols.
139 */
140#define LIRC_GET_REC_TIMEOUT _IOR('i', 0x00000024, __u32)
141
142/*
143 * struct lirc_scancode - decoded scancode with protocol for use with
144 * LIRC_MODE_SCANCODE
145 *
146 * @timestamp: Timestamp in nanoseconds using CLOCK_MONOTONIC when IR
147 * was decoded.
148 * @flags: should be 0 for transmit. When receiving scancodes,
149 * LIRC_SCANCODE_FLAG_TOGGLE or LIRC_SCANCODE_FLAG_REPEAT can be set
150 * depending on the protocol
151 * @rc_proto: see enum rc_proto
152 * @keycode: the translated keycode. Set to 0 for transmit.
153 * @scancode: the scancode received or to be sent
154 */
155struct lirc_scancode {
156 __u64 timestamp;
157 __u16 flags;
158 __u16 rc_proto;
159 __u32 keycode;
160 __u64 scancode;
161};
162
163/* Set if the toggle bit of rc-5 or rc-6 is enabled */
164#define LIRC_SCANCODE_FLAG_TOGGLE 1
165/* Set if this is a nec or sanyo repeat */
166#define LIRC_SCANCODE_FLAG_REPEAT 2
167
168/**
169 * enum rc_proto - the Remote Controller protocol
170 *
171 * @RC_PROTO_UNKNOWN: Protocol not known
172 * @RC_PROTO_OTHER: Protocol known but proprietary
173 * @RC_PROTO_RC5: Philips RC5 protocol
174 * @RC_PROTO_RC5X_20: Philips RC5x 20 bit protocol
175 * @RC_PROTO_RC5_SZ: StreamZap variant of RC5
176 * @RC_PROTO_JVC: JVC protocol
177 * @RC_PROTO_SONY12: Sony 12 bit protocol
178 * @RC_PROTO_SONY15: Sony 15 bit protocol
179 * @RC_PROTO_SONY20: Sony 20 bit protocol
180 * @RC_PROTO_NEC: NEC protocol
181 * @RC_PROTO_NECX: Extended NEC protocol
182 * @RC_PROTO_NEC32: NEC 32 bit protocol
183 * @RC_PROTO_SANYO: Sanyo protocol
184 * @RC_PROTO_MCIR2_KBD: RC6-ish MCE keyboard
185 * @RC_PROTO_MCIR2_MSE: RC6-ish MCE mouse
186 * @RC_PROTO_RC6_0: Philips RC6-0-16 protocol
187 * @RC_PROTO_RC6_6A_20: Philips RC6-6A-20 protocol
188 * @RC_PROTO_RC6_6A_24: Philips RC6-6A-24 protocol
189 * @RC_PROTO_RC6_6A_32: Philips RC6-6A-32 protocol
190 * @RC_PROTO_RC6_MCE: MCE (Philips RC6-6A-32 subtype) protocol
191 * @RC_PROTO_SHARP: Sharp protocol
192 * @RC_PROTO_XMP: XMP protocol
193 * @RC_PROTO_CEC: CEC protocol
194 * @RC_PROTO_IMON: iMon Pad protocol
195 * @RC_PROTO_RCMM12: RC-MM protocol 12 bits
196 * @RC_PROTO_RCMM24: RC-MM protocol 24 bits
197 * @RC_PROTO_RCMM32: RC-MM protocol 32 bits
198 */
199enum rc_proto {
200 RC_PROTO_UNKNOWN = 0,
201 RC_PROTO_OTHER = 1,
202 RC_PROTO_RC5 = 2,
203 RC_PROTO_RC5X_20 = 3,
204 RC_PROTO_RC5_SZ = 4,
205 RC_PROTO_JVC = 5,
206 RC_PROTO_SONY12 = 6,
207 RC_PROTO_SONY15 = 7,
208 RC_PROTO_SONY20 = 8,
209 RC_PROTO_NEC = 9,
210 RC_PROTO_NECX = 10,
211 RC_PROTO_NEC32 = 11,
212 RC_PROTO_SANYO = 12,
213 RC_PROTO_MCIR2_KBD = 13,
214 RC_PROTO_MCIR2_MSE = 14,
215 RC_PROTO_RC6_0 = 15,
216 RC_PROTO_RC6_6A_20 = 16,
217 RC_PROTO_RC6_6A_24 = 17,
218 RC_PROTO_RC6_6A_32 = 18,
219 RC_PROTO_RC6_MCE = 19,
220 RC_PROTO_SHARP = 20,
221 RC_PROTO_XMP = 21,
222 RC_PROTO_CEC = 22,
223 RC_PROTO_IMON = 23,
224 RC_PROTO_RCMM12 = 24,
225 RC_PROTO_RCMM24 = 25,
226 RC_PROTO_RCMM32 = 26,
227};
228
229#endif
tools/scripts/Makefile.include+1−1
@@ -90,7 +90,7 @@ EXTRA_WARNINGS += -Wstrict-aliasing=3 · 89 unmodified lines
90 90
91else ifneq ($(CROSS_COMPILE),)91else ifneq ($(CROSS_COMPILE),)
92CLANG_CROSS_FLAGS := --target=$(notdir $(CROSS_COMPILE:%-=%))92CLANG_CROSS_FLAGS := --target=$(notdir $(CROSS_COMPILE:%-=%))
93GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)gcc))93GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)gcc 2>/dev/null))
94ifneq ($(GCC_TOOLCHAIN_DIR),)94ifneq ($(GCC_TOOLCHAIN_DIR),)
95CLANG_CROSS_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))95CLANG_CROSS_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
96CLANG_CROSS_FLAGS += --sysroot=$(shell $(CROSS_COMPILE)gcc -print-sysroot)96CLANG_CROSS_FLAGS += --sysroot=$(shell $(CROSS_COMPILE)gcc -print-sysroot)
tools/testing/kunit/kunit_kernel.py+1−0
@@ -6,6 +6,7 @@ · 5 unmodified lines
6# Author: Felix Guo <felixguoxiuping@gmail.com>6# Author: Felix Guo <felixguoxiuping@gmail.com>
7# Author: Brendan Higgins <brendanhiggins@google.com>7# Author: Brendan Higgins <brendanhiggins@google.com>
8 8
9import importlib.abc
9import importlib.util10import importlib.util
10import logging11import logging
11import subprocess12import subprocess
tools/testing/selftests/bpf/test_lirc_mode2_user.c+0−1
@@ -28,7 +28,6 @@ · 27 unmodified lines
28// 5. We can read keycode from same /dev/lirc device28// 5. We can read keycode from same /dev/lirc device
29 29
30#include <linux/bpf.h>30#include <linux/bpf.h>
31#include <linux/lirc.h>
32#include <linux/input.h>31#include <linux/input.h>
33#include <errno.h>32#include <errno.h>
34#include <stdio.h>33#include <stdio.h>
tools/testing/selftests/cpufreq/main.sh+1−1
@@ -194,5 +194,5 @@ prerequisite · 193 unmodified lines
194 194
195# Run requested functions195# Run requested functions
196clear_dumps $OUTFILE196clear_dumps $OUTFILE
197do_test >> $OUTFILE.txt197do_test | tee -a $OUTFILE.txt
198dmesg_dumps $OUTFILE198dmesg_dumps $OUTFILE
tools/testing/selftests/exec/Makefile+1−1
@@ -5,7 +5,7 @@ CFLAGS += -D_GNU_SOURCE · 4 unmodified lines
5 5
6TEST_PROGS := binfmt_script non-regular6TEST_PROGS := binfmt_script non-regular
7TEST_GEN_PROGS := execveat load_address_4096 load_address_2097152 load_address_167772167TEST_GEN_PROGS := execveat load_address_4096 load_address_2097152 load_address_16777216
8TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir pipe8TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir
9# Makefile is a run-time dependency, since it's accessed by the execveat test9# Makefile is a run-time dependency, since it's accessed by the execveat test
10TEST_FILES := Makefile10TEST_FILES := Makefile
11 11
tools/testing/selftests/futex/Makefile+2−2
@@ -11,7 +11,7 @@ all: · 10 unmodified lines
11 @for DIR in $(SUBDIRS); do \11 @for DIR in $(SUBDIRS); do \
12 BUILD_TARGET=$(OUTPUT)/$$DIR; \12 BUILD_TARGET=$(OUTPUT)/$$DIR; \
13 mkdir $$BUILD_TARGET -p; \13 mkdir $$BUILD_TARGET -p; \
14 make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\14 $(MAKE) OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
15 if [ -e $$DIR/$(TEST_PROGS) ]; then \15 if [ -e $$DIR/$(TEST_PROGS) ]; then \
16 rsync -a $$DIR/$(TEST_PROGS) $$BUILD_TARGET/; \16 rsync -a $$DIR/$(TEST_PROGS) $$BUILD_TARGET/; \
17 fi \17 fi \
@@ -32,6 +32,6 @@ override define CLEAN · 14 unmodified lines
32 @for DIR in $(SUBDIRS); do \32 @for DIR in $(SUBDIRS); do \
33 BUILD_TARGET=$(OUTPUT)/$$DIR; \33 BUILD_TARGET=$(OUTPUT)/$$DIR; \
34 mkdir $$BUILD_TARGET -p; \34 mkdir $$BUILD_TARGET -p; \
35 make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\35 $(MAKE) OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
36 done36 done
37endef37endef
tools/testing/selftests/kselftest_harness.h+3−1
@@ -877,7 +877,8 @@ static void __timeout_handler(int sig, siginfo_t *info, void *ucontext) · 876 unmodified lines
877 }877 }
878 878
879 t->timed_out = true;879 t->timed_out = true;
880 kill(t->pid, SIGKILL);880 // signal process group
881 kill(-(t->pid), SIGKILL);
881}882}
882 883
883void __wait_for_test(struct __test_metadata *t)884void __wait_for_test(struct __test_metadata *t)
@@ -987,6 +988,7 @@ void __run_test(struct __fixture_metadata *f, · 103 unmodified lines
987 ksft_print_msg("ERROR SPAWNING TEST CHILD\n");988 ksft_print_msg("ERROR SPAWNING TEST CHILD\n");
988 t->passed = 0;989 t->passed = 0;
989 } else if (t->pid == 0) {990 } else if (t->pid == 0) {
991 setpgrp();
990 t->fn(t, variant);992 t->fn(t, variant);
991 if (t->skip)993 if (t->skip)
992 _exit(255);994 _exit(255);
tools/testing/selftests/mincore/mincore_selftest.c+14−6
@@ -207,15 +207,21 @@ TEST(check_file_mmap) · 206 unmodified lines
207 207
208 errno = 0;208 errno = 0;
209 fd = open(".", O_TMPFILE | O_RDWR, 0600);209 fd = open(".", O_TMPFILE | O_RDWR, 0600);
210 ASSERT_NE(-1, fd) {210 if (fd < 0) {
211 TH_LOG("Can't create temporary file: %s",211 ASSERT_EQ(errno, EOPNOTSUPP) {
212 strerror(errno));212 TH_LOG("Can't create temporary file: %s",
213 strerror(errno));
214 }
215 SKIP(goto out_free, "O_TMPFILE not supported by filesystem.");
213 }216 }
214 errno = 0;217 errno = 0;
215 retval = fallocate(fd, 0, 0, FILE_SIZE);218 retval = fallocate(fd, 0, 0, FILE_SIZE);
216 ASSERT_EQ(0, retval) {219 if (retval) {
217 TH_LOG("Error allocating space for the temporary file: %s",220 ASSERT_EQ(errno, EOPNOTSUPP) {
218 strerror(errno));221 TH_LOG("Error allocating space for the temporary file: %s",
222 strerror(errno));
223 }
224 SKIP(goto out_close, "fallocate not supported by filesystem.");
219 }225 }
220 226
221 /*227 /*
@@ -271,7 +277,9 @@ TEST(check_file_mmap) · 49 unmodified lines
271 }277 }
272 278
273 munmap(addr, FILE_SIZE);279 munmap(addr, FILE_SIZE);
280out_close:
274 close(fd);281 close(fd);
282out_free:
275 free(vec);283 free(vec);
276}284}
277 285
tools/testing/selftests/netfilter/nft_concat_range.sh+71−1
@@ -27,7 +27,7 @@ TYPES="net_port port_net net6_port port_proto net6_port_mac net6_port_mac_proto · 26 unmodified lines
27 net6_port_net6_port net_port_mac_proto_net"27 net6_port_net6_port net_port_mac_proto_net"
28 28
29# Reported bugs, also described by TYPE_ variables below29# Reported bugs, also described by TYPE_ variables below
30BUGS="flush_remove_add"30BUGS="flush_remove_add reload"
31 31
32# List of possible paths to pktgen script from kernel tree for performance tests32# List of possible paths to pktgen script from kernel tree for performance tests
33PKTGEN_SCRIPT_PATHS="33PKTGEN_SCRIPT_PATHS="
@@ -354,6 +354,23 @@ TYPE_flush_remove_add=" · 320 unmodified lines
354display Add two elements, flush, re-add354display Add two elements, flush, re-add
355"355"
356 356
357TYPE_reload="
358display net,mac with reload
359type_spec ipv4_addr . ether_addr
360chain_spec ip daddr . ether saddr
361dst addr4
362src mac
363start 1
364count 1
365src_delta 2000
366tools sendip nc bash
367proto udp
368
369race_repeat 0
370
371perf_duration 0
372"
373
357# Set template for all tests, types and rules are filled in depending on test374# Set template for all tests, types and rules are filled in depending on test
358set_template='375set_template='
359flush ruleset376flush ruleset
@@ -1473,6 +1490,59 @@ test_bug_flush_remove_add() { · 1113 unmodified lines
1473 nft flush ruleset1490 nft flush ruleset
1474}1491}
1475 1492
1493# - add ranged element, check that packets match it
1494# - reload the set, check packets still match
1495test_bug_reload() {
1496 setup veth send_"${proto}" set || return ${KSELFTEST_SKIP}
1497 rstart=${start}
1498
1499 range_size=1
1500 for i in $(seq "${start}" $((start + count))); do
1501 end=$((start + range_size))
1502
1503 # Avoid negative or zero-sized port ranges
1504 if [ $((end / 65534)) -gt $((start / 65534)) ]; then
1505 start=${end}
1506 end=$((end + 1))
1507 fi
1508 srcstart=$((start + src_delta))
1509 srcend=$((end + src_delta))
1510
1511 add "$(format)" || return 1
1512 range_size=$((range_size + 1))
1513 start=$((end + range_size))
1514 done
1515
1516 # check kernel does allocate pcpu sctrach map
1517 # for reload with no elemet add/delete
1518 ( echo flush set inet filter test ;
1519 nft list set inet filter test ) | nft -f -
1520
1521 start=${rstart}
1522 range_size=1
1523
1524 for i in $(seq "${start}" $((start + count))); do
1525 end=$((start + range_size))
1526
1527 # Avoid negative or zero-sized port ranges
1528 if [ $((end / 65534)) -gt $((start / 65534)) ]; then
1529 start=${end}
1530 end=$((end + 1))
1531 fi
1532 srcstart=$((start + src_delta))
1533 srcend=$((end + src_delta))
1534
1535 for j in $(seq ${start} $((range_size / 2 + 1)) ${end}); do
1536 send_match "${j}" $((j + src_delta)) || return 1
1537 done
1538
1539 range_size=$((range_size + 1))
1540 start=$((end + range_size))
1541 done
1542
1543 nft flush ruleset
1544}
1545
1476test_reported_issues() {1546test_reported_issues() {
1477 eval test_bug_"${subtest}"1547 eval test_bug_"${subtest}"
1478}1548}
tools/testing/selftests/netfilter/nft_nat.sh+152−0
@@ -899,6 +899,144 @@ EOF · 898 unmodified lines
899 ip netns exec "$ns0" nft delete table $family nat899 ip netns exec "$ns0" nft delete table $family nat
900}900}
901 901
902test_stateless_nat_ip()
903{
904 local lret=0
905
906 ip netns exec "$ns0" sysctl net.ipv4.conf.veth0.forwarding=1 > /dev/null
907 ip netns exec "$ns0" sysctl net.ipv4.conf.veth1.forwarding=1 > /dev/null
908
909 ip netns exec "$ns2" ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1
910 if [ $? -ne 0 ] ; then
911 echo "ERROR: cannot ping $ns1 from $ns2 before loading stateless rules"
912 return 1
913 fi
914
915ip netns exec "$ns0" nft -f /dev/stdin <<EOF
916table ip stateless {
917 map xlate_in {
918 typeof meta iifname . ip saddr . ip daddr : ip daddr
919 elements = {
920 "veth1" . 10.0.2.99 . 10.0.1.99 : 10.0.2.2,
921 }
922 }
923 map xlate_out {
924 typeof meta iifname . ip saddr . ip daddr : ip daddr
925 elements = {
926 "veth0" . 10.0.1.99 . 10.0.2.2 : 10.0.2.99
927 }
928 }
929
930 chain prerouting {
931 type filter hook prerouting priority -400; policy accept;
932 ip saddr set meta iifname . ip saddr . ip daddr map @xlate_in
933 ip daddr set meta iifname . ip saddr . ip daddr map @xlate_out
934 }
935}
936EOF
937 if [ $? -ne 0 ]; then
938 echo "SKIP: Could not add ip statless rules"
939 return $ksft_skip
940 fi
941
942 reset_counters
943
944 ip netns exec "$ns2" ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1
945 if [ $? -ne 0 ] ; then
946 echo "ERROR: cannot ping $ns1 from $ns2 with stateless rules"
947 lret=1
948 fi
949
950 # ns1 should have seen packets from .2.2, due to stateless rewrite.
951 expect="packets 1 bytes 84"
952 cnt=$(ip netns exec "$ns1" nft list counter inet filter ns0insl | grep -q "$expect")
953 if [ $? -ne 0 ]; then
954 bad_counter "$ns1" ns0insl "$expect" "test_stateless 1"
955 lret=1
956 fi
957
958 for dir in "in" "out" ; do
959 cnt=$(ip netns exec "$ns2" nft list counter inet filter ns1${dir} | grep -q "$expect")
960 if [ $? -ne 0 ]; then
961 bad_counter "$ns2" ns1$dir "$expect" "test_stateless 2"
962 lret=1
963 fi
964 done
965
966 # ns1 should not have seen packets from ns2, due to masquerade
967 expect="packets 0 bytes 0"
968 for dir in "in" "out" ; do
969 cnt=$(ip netns exec "$ns1" nft list counter inet filter ns2${dir} | grep -q "$expect")
970 if [ $? -ne 0 ]; then
971 bad_counter "$ns1" ns0$dir "$expect" "test_stateless 3"
972 lret=1
973 fi
974
975 cnt=$(ip netns exec "$ns0" nft list counter inet filter ns1${dir} | grep -q "$expect")
976 if [ $? -ne 0 ]; then
977 bad_counter "$ns0" ns1$dir "$expect" "test_stateless 4"
978 lret=1
979 fi
980 done
981
982 reset_counters
983
984 socat -h > /dev/null 2>&1
985 if [ $? -ne 0 ];then
986 echo "SKIP: Could not run stateless nat frag test without socat tool"
987 if [ $lret -eq 0 ]; then
988 return $ksft_skip
989 fi
990
991 ip netns exec "$ns0" nft delete table ip stateless
992 return $lret
993 fi
994
995 local tmpfile=$(mktemp)
996 dd if=/dev/urandom of=$tmpfile bs=4096 count=1 2>/dev/null
997
998 local outfile=$(mktemp)
999 ip netns exec "$ns1" timeout 3 socat -u UDP4-RECV:4233 OPEN:$outfile < /dev/null &
1000 sc_r=$!
1001
1002 sleep 1
1003 # re-do with large ping -> ip fragmentation
1004 ip netns exec "$ns2" timeout 3 socat - UDP4-SENDTO:"10.0.1.99:4233" < "$tmpfile" > /dev/null
1005 if [ $? -ne 0 ] ; then
1006 echo "ERROR: failed to test udp $ns1 to $ns2 with stateless ip nat" 1>&2
1007 lret=1
1008 fi
1009
1010 wait
1011
1012 cmp "$tmpfile" "$outfile"
1013 if [ $? -ne 0 ]; then
1014 ls -l "$tmpfile" "$outfile"
1015 echo "ERROR: in and output file mismatch when checking udp with stateless nat" 1>&2
1016 lret=1
1017 fi
1018
1019 rm -f "$tmpfile" "$outfile"
1020
1021 # ns1 should have seen packets from 2.2, due to stateless rewrite.
1022 expect="packets 3 bytes 4164"
1023 cnt=$(ip netns exec "$ns1" nft list counter inet filter ns0insl | grep -q "$expect")
1024 if [ $? -ne 0 ]; then
1025 bad_counter "$ns1" ns0insl "$expect" "test_stateless 5"
1026 lret=1
1027 fi
1028
1029 ip netns exec "$ns0" nft delete table ip stateless
1030 if [ $? -ne 0 ]; then
1031 echo "ERROR: Could not delete table ip stateless" 1>&2
1032 lret=1
1033 fi
1034
1035 test $lret -eq 0 && echo "PASS: IP statless for $ns2"
1036
1037 return $lret
1038}
1039
902# ip netns exec "$ns0" ping -c 1 -q 10.0.$i.991040# ip netns exec "$ns0" ping -c 1 -q 10.0.$i.99
903for i in 0 1 2; do1041for i in 0 1 2; do
904ip netns exec ns$i-$sfx nft -f /dev/stdin <<EOF1042ip netns exec ns$i-$sfx nft -f /dev/stdin <<EOF
@@ -965,6 +1103,19 @@ table inet filter { · 60 unmodified lines
965EOF1103EOF
966done1104done
967 1105
1106# special case for stateless nat check, counter needs to
1107# be done before (input) ip defragmentation
1108ip netns exec ns1-$sfx nft -f /dev/stdin <<EOF
1109table inet filter {
1110 counter ns0insl {}
1111
1112 chain pre {
1113 type filter hook prerouting priority -400; policy accept;
1114 ip saddr 10.0.2.2 counter name "ns0insl"
1115 }
1116}
1117EOF
1118
968sleep 31119sleep 3
969# test basic connectivity1120# test basic connectivity
970for i in 1 2; do1121for i in 1 2; do
@@ -1019,6 +1170,7 @@ $test_inet_nat && test_redirect inet · 48 unmodified lines
1019$test_inet_nat && test_redirect6 inet1170$test_inet_nat && test_redirect6 inet
1020 1171
1021test_port_shadowing1172test_port_shadowing
1173test_stateless_nat_ip
1022 1174
1023if [ $ret -ne 0 ];then1175if [ $ret -ne 0 ];then
1024 echo -n "FAIL: "1176 echo -n "FAIL: "
tools/testing/selftests/netfilter/nft_zones_many.sh+6−6
@@ -9,7 +9,7 @@ ns="ns-$sfx" · 8 unmodified lines
9# Kselftest framework requirement - SKIP code is 4.9# Kselftest framework requirement - SKIP code is 4.
10ksft_skip=410ksft_skip=4
11 11
12zones=2000012zones=2000
13have_ct_tool=013have_ct_tool=0
14ret=014ret=0
15 15
@@ -75,10 +75,10 @@ EOF · 59 unmodified lines
75 75
76 while [ $i -lt $max_zones ]; do76 while [ $i -lt $max_zones ]; do
77 local start=$(date +%s%3N)77 local start=$(date +%s%3N)
78 i=$((i + 10000))78 i=$((i + 1000))
79 j=$((j + 1))79 j=$((j + 1))
80 # nft rule in output places each packet in a different zone.80 # nft rule in output places each packet in a different zone.
81 dd if=/dev/zero of=/dev/stdout bs=8k count=10000 2>/dev/null | ip netns exec "$ns" socat STDIN UDP:127.0.0.1:12345,sourceport=1234581 dd if=/dev/zero of=/dev/stdout bs=8k count=1000 2>/dev/null | ip netns exec "$ns" socat STDIN UDP:127.0.0.1:12345,sourceport=12345
82 if [ $? -ne 0 ] ;then82 if [ $? -ne 0 ] ;then
83 ret=183 ret=1
84 break84 break
@@ -86,7 +86,7 @@ EOF · 1 unmodified line
86 86
87 stop=$(date +%s%3N)87 stop=$(date +%s%3N)
88 local duration=$((stop-start))88 local duration=$((stop-start))
89 echo "PASS: added 10000 entries in $duration ms (now $i total, loop $j)"89 echo "PASS: added 1000 entries in $duration ms (now $i total, loop $j)"
90 done90 done
91 91
92 if [ $have_ct_tool -eq 1 ]; then92 if [ $have_ct_tool -eq 1 ]; then
@@ -128,11 +128,11 @@ test_conntrack_tool() { · 35 unmodified lines
128 break128 break
129 fi129 fi
130 130
131 if [ $((i%10000)) -eq 0 ];then131 if [ $((i%1000)) -eq 0 ];then
132 stop=$(date +%s%3N)132 stop=$(date +%s%3N)
133 133
134 local duration=$((stop-start))134 local duration=$((stop-start))
135 echo "PASS: added 10000 entries in $duration ms (now $i total)"135 echo "PASS: added 1000 entries in $duration ms (now $i total)"
136 start=$stop136 start=$stop
137 fi137 fi
138 done138 done
tools/testing/selftests/openat2/Makefile+1−1
@@ -5,4 +5,4 @@ TEST_GEN_PROGS := openat2_test resolve_test rename_attack_test · 4 unmodified lines
5 5
6include ../lib.mk6include ../lib.mk
7 7
8$(TEST_GEN_PROGS): helpers.c8$(TEST_GEN_PROGS): helpers.c helpers.h
tools/testing/selftests/openat2/helpers.h+7−5
@@ -9,6 +9,7 @@ · 8 unmodified lines
9 9
10#define _GNU_SOURCE10#define _GNU_SOURCE
11#include <stdint.h>11#include <stdint.h>
12#include <stdbool.h>
12#include <errno.h>13#include <errno.h>
13#include <linux/types.h>14#include <linux/types.h>
14#include "../kselftest.h"15#include "../kselftest.h"
@@ -62,11 +63,12 @@ bool needs_openat2(const struct open_how *how); · 47 unmodified lines
62 (similar to chroot(2)). */63 (similar to chroot(2)). */
63#endif /* RESOLVE_IN_ROOT */64#endif /* RESOLVE_IN_ROOT */
64 65
65#define E_func(func, ...) \66#define E_func(func, ...) \
66 do { \67 do { \
67 if (func(__VA_ARGS__) < 0) \68 errno = 0; \
68 ksft_exit_fail_msg("%s:%d %s failed\n", \69 if (func(__VA_ARGS__) < 0) \
69 __FILE__, __LINE__, #func);\70 ksft_exit_fail_msg("%s:%d %s failed - errno:%d\n", \
71 __FILE__, __LINE__, #func, errno); \
70 } while (0)72 } while (0)
71 73
72#define E_asprintf(...) E_func(asprintf, __VA_ARGS__)74#define E_asprintf(...) E_func(asprintf, __VA_ARGS__)
tools/testing/selftests/openat2/openat2_test.c+11−1
@@ -259,6 +259,16 @@ void test_openat2_flags(void) · 258 unmodified lines
259 unlink(path);259 unlink(path);
260 260
261 fd = sys_openat2(AT_FDCWD, path, &test->how);261 fd = sys_openat2(AT_FDCWD, path, &test->how);
262 if (fd < 0 && fd == -EOPNOTSUPP) {
263 /*
264 * Skip the testcase if it failed because not supported
265 * by FS. (e.g. a valid O_TMPFILE combination on NFS)
266 */
267 ksft_test_result_skip("openat2 with %s fails with %d (%s)\n",
268 test->name, fd, strerror(-fd));
269 goto next;
270 }
271
262 if (test->err >= 0)272 if (test->err >= 0)
263 failed = (fd < 0);273 failed = (fd < 0);
264 else274 else
@@ -303,7 +313,7 @@ skip: · 38 unmodified lines
303 else313 else
304 resultfn("openat2 with %s fails with %d (%s)\n",314 resultfn("openat2 with %s fails with %d (%s)\n",
305 test->name, test->err, strerror(-test->err));315 test->name, test->err, strerror(-test->err));
306 316next:
307 free(fdpath);317 free(fdpath);
308 fflush(stdout);318 fflush(stdout);
309 }319 }
tools/testing/selftests/rtc/settings+1−1
@@ -1 +1 @@
1timeout=901timeout=180
tools/testing/selftests/vDSO/vdso_test_abi.c+62−73
@@ -33,110 +33,114 @@ typedef long (*vdso_clock_gettime_t)(clockid_t clk_id, struct timespec *ts); · 32 unmodified lines
33typedef long (*vdso_clock_getres_t)(clockid_t clk_id, struct timespec *ts);33typedef long (*vdso_clock_getres_t)(clockid_t clk_id, struct timespec *ts);
34typedef time_t (*vdso_time_t)(time_t *t);34typedef time_t (*vdso_time_t)(time_t *t);
35 35
36static int vdso_test_gettimeofday(void)36#define VDSO_TEST_PASS_MSG() "\n%s(): PASS\n", __func__
37#define VDSO_TEST_FAIL_MSG(x) "\n%s(): %s FAIL\n", __func__, x
38#define VDSO_TEST_SKIP_MSG(x) "\n%s(): SKIP: Could not find %s\n", __func__, x
39
40static void vdso_test_gettimeofday(void)
37{41{
38 /* Find gettimeofday. */42 /* Find gettimeofday. */
39 vdso_gettimeofday_t vdso_gettimeofday =43 vdso_gettimeofday_t vdso_gettimeofday =
40 (vdso_gettimeofday_t)vdso_sym(version, name[0]);44 (vdso_gettimeofday_t)vdso_sym(version, name[0]);
41 45
42 if (!vdso_gettimeofday) {46 if (!vdso_gettimeofday) {
43 printf("Could not find %s\n", name[0]);47 ksft_test_result_skip(VDSO_TEST_SKIP_MSG(name[0]));
44 return KSFT_SKIP;48 return;
45 }49 }
46 50
47 struct timeval tv;51 struct timeval tv;
48 long ret = vdso_gettimeofday(&tv, 0);52 long ret = vdso_gettimeofday(&tv, 0);
49 53
50 if (ret == 0) {54 if (ret == 0) {
51 printf("The time is %lld.%06lld\n",55 ksft_print_msg("The time is %lld.%06lld\n",
52 (long long)tv.tv_sec, (long long)tv.tv_usec);56 (long long)tv.tv_sec, (long long)tv.tv_usec);
57 ksft_test_result_pass(VDSO_TEST_PASS_MSG());
53 } else {58 } else {
54 printf("%s failed\n", name[0]);59 ksft_test_result_fail(VDSO_TEST_FAIL_MSG(name[0]));
55 return KSFT_FAIL;
56 }60 }
57
58 return KSFT_PASS;
59}61}
60 62
61static int vdso_test_clock_gettime(clockid_t clk_id)63static void vdso_test_clock_gettime(clockid_t clk_id)
62{64{
63 /* Find clock_gettime. */65 /* Find clock_gettime. */
64 vdso_clock_gettime_t vdso_clock_gettime =66 vdso_clock_gettime_t vdso_clock_gettime =
65 (vdso_clock_gettime_t)vdso_sym(version, name[1]);67 (vdso_clock_gettime_t)vdso_sym(version, name[1]);
66 68
67 if (!vdso_clock_gettime) {69 if (!vdso_clock_gettime) {
68 printf("Could not find %s\n", name[1]);70 ksft_test_result_skip(VDSO_TEST_SKIP_MSG(name[1]));
69 return KSFT_SKIP;71 return;
70 }72 }
71 73
72 struct timespec ts;74 struct timespec ts;
73 long ret = vdso_clock_gettime(clk_id, &ts);75 long ret = vdso_clock_gettime(clk_id, &ts);
74 76
75 if (ret == 0) {77 if (ret == 0) {
76 printf("The time is %lld.%06lld\n",78 ksft_print_msg("The time is %lld.%06lld\n",
77 (long long)ts.tv_sec, (long long)ts.tv_nsec);79 (long long)ts.tv_sec, (long long)ts.tv_nsec);
80 ksft_test_result_pass(VDSO_TEST_PASS_MSG());
78 } else {81 } else {
79 printf("%s failed\n", name[1]);82 ksft_test_result_fail(VDSO_TEST_FAIL_MSG(name[1]));
80 return KSFT_FAIL;
81 }83 }
82
83 return KSFT_PASS;
84}84}
85 85
86static int vdso_test_time(void)86static void vdso_test_time(void)
87{87{
88 /* Find time. */88 /* Find time. */
89 vdso_time_t vdso_time =89 vdso_time_t vdso_time =
90 (vdso_time_t)vdso_sym(version, name[2]);90 (vdso_time_t)vdso_sym(version, name[2]);
91 91
92 if (!vdso_time) {92 if (!vdso_time) {
93 printf("Could not find %s\n", name[2]);93 ksft_test_result_skip(VDSO_TEST_SKIP_MSG(name[2]));
94 return KSFT_SKIP;94 return;
95 }95 }
96 96
97 long ret = vdso_time(NULL);97 long ret = vdso_time(NULL);
98 98
99 if (ret > 0) {99 if (ret > 0) {
100 printf("The time in hours since January 1, 1970 is %lld\n",100 ksft_print_msg("The time in hours since January 1, 1970 is %lld\n",
101 (long long)(ret / 3600));101 (long long)(ret / 3600));
102 ksft_test_result_pass(VDSO_TEST_PASS_MSG());
102 } else {103 } else {
103 printf("%s failed\n", name[2]);104 ksft_test_result_fail(VDSO_TEST_FAIL_MSG(name[2]));
104 return KSFT_FAIL;
105 }105 }
106
107 return KSFT_PASS;
108}106}
109 107
110static int vdso_test_clock_getres(clockid_t clk_id)108static void vdso_test_clock_getres(clockid_t clk_id)
111{109{
110 int clock_getres_fail = 0;
111
112 /* Find clock_getres. */112 /* Find clock_getres. */
113 vdso_clock_getres_t vdso_clock_getres =113 vdso_clock_getres_t vdso_clock_getres =
114 (vdso_clock_getres_t)vdso_sym(version, name[3]);114 (vdso_clock_getres_t)vdso_sym(version, name[3]);
115 115
116 if (!vdso_clock_getres) {116 if (!vdso_clock_getres) {
117 printf("Could not find %s\n", name[3]);117 ksft_test_result_skip(VDSO_TEST_SKIP_MSG(name[3]));
118 return KSFT_SKIP;118 return;
119 }119 }
120 120
121 struct timespec ts, sys_ts;121 struct timespec ts, sys_ts;
122 long ret = vdso_clock_getres(clk_id, &ts);122 long ret = vdso_clock_getres(clk_id, &ts);
123 123
124 if (ret == 0) {124 if (ret == 0) {
125 printf("The resolution is %lld %lld\n",125 ksft_print_msg("The vdso resolution is %lld %lld\n",
126 (long long)ts.tv_sec, (long long)ts.tv_nsec);126 (long long)ts.tv_sec, (long long)ts.tv_nsec);
127 } else {127 } else {
128 printf("%s failed\n", name[3]);128 clock_getres_fail++;
129 return KSFT_FAIL;
130 }129 }
131 130
132 ret = syscall(SYS_clock_getres, clk_id, &sys_ts);131 ret = syscall(SYS_clock_getres, clk_id, &sys_ts);
133 132
134 if ((sys_ts.tv_sec != ts.tv_sec) || (sys_ts.tv_nsec != ts.tv_nsec)) {133 ksft_print_msg("The syscall resolution is %lld %lld\n",
135 printf("%s failed\n", name[3]);134 (long long)sys_ts.tv_sec, (long long)sys_ts.tv_nsec);
136 return KSFT_FAIL;
137 }
138 135
139 return KSFT_PASS;136 if ((sys_ts.tv_sec != ts.tv_sec) || (sys_ts.tv_nsec != ts.tv_nsec))
137 clock_getres_fail++;
138
139 if (clock_getres_fail > 0) {
140 ksft_test_result_fail(VDSO_TEST_FAIL_MSG(name[3]));
141 } else {
142 ksft_test_result_pass(VDSO_TEST_PASS_MSG());
143 }
140}144}
141 145
142const char *vdso_clock_name[12] = {146const char *vdso_clock_name[12] = {
@@ -158,36 +162,23 @@ const char *vdso_clock_name[12] = { · 15 unmodified lines
158 * This function calls vdso_test_clock_gettime and vdso_test_clock_getres162 * This function calls vdso_test_clock_gettime and vdso_test_clock_getres
159 * with different values for clock_id.163 * with different values for clock_id.
160 */164 */
161static inline int vdso_test_clock(clockid_t clock_id)165static inline void vdso_test_clock(clockid_t clock_id)
162{166{
163 int ret0, ret1;167 ksft_print_msg("\nclock_id: %s\n", vdso_clock_name[clock_id]);
164
165 ret0 = vdso_test_clock_gettime(clock_id);
166 /* A skipped test is considered passed */
167 if (ret0 == KSFT_SKIP)
168 ret0 = KSFT_PASS;
169
170 ret1 = vdso_test_clock_getres(clock_id);
171 /* A skipped test is considered passed */
172 if (ret1 == KSFT_SKIP)
173 ret1 = KSFT_PASS;
174 168
175 ret0 += ret1;169 vdso_test_clock_gettime(clock_id);
176 170
177 printf("clock_id: %s", vdso_clock_name[clock_id]);171 vdso_test_clock_getres(clock_id);
178
179 if (ret0 > 0)
180 printf(" [FAIL]\n");
181 else
182 printf(" [PASS]\n");
183
184 return ret0;
185}172}
186 173
174#define VDSO_TEST_PLAN 16
175
187int main(int argc, char **argv)176int main(int argc, char **argv)
188{177{
189 unsigned long sysinfo_ehdr = getauxval(AT_SYSINFO_EHDR);178 unsigned long sysinfo_ehdr = getauxval(AT_SYSINFO_EHDR);
190 int ret;179
180 ksft_print_header();
181 ksft_set_plan(VDSO_TEST_PLAN);
191 182
192 if (!sysinfo_ehdr) {183 if (!sysinfo_ehdr) {
193 printf("AT_SYSINFO_EHDR is not present!\n");184 printf("AT_SYSINFO_EHDR is not present!\n");
@@ -201,44 +192,42 @@ int main(int argc, char **argv) · 7 unmodified lines
201 192
202 vdso_init_from_sysinfo_ehdr(getauxval(AT_SYSINFO_EHDR));193 vdso_init_from_sysinfo_ehdr(getauxval(AT_SYSINFO_EHDR));
203 194
204 ret = vdso_test_gettimeofday();195 vdso_test_gettimeofday();
205 196
206#if _POSIX_TIMERS > 0197#if _POSIX_TIMERS > 0
207 198
208#ifdef CLOCK_REALTIME199#ifdef CLOCK_REALTIME
209 ret += vdso_test_clock(CLOCK_REALTIME);200 vdso_test_clock(CLOCK_REALTIME);
210#endif201#endif
211 202
212#ifdef CLOCK_BOOTTIME203#ifdef CLOCK_BOOTTIME
213 ret += vdso_test_clock(CLOCK_BOOTTIME);204 vdso_test_clock(CLOCK_BOOTTIME);
214#endif205#endif
215 206
216#ifdef CLOCK_TAI207#ifdef CLOCK_TAI
217 ret += vdso_test_clock(CLOCK_TAI);208 vdso_test_clock(CLOCK_TAI);
218#endif209#endif
219 210
220#ifdef CLOCK_REALTIME_COARSE211#ifdef CLOCK_REALTIME_COARSE
221 ret += vdso_test_clock(CLOCK_REALTIME_COARSE);212 vdso_test_clock(CLOCK_REALTIME_COARSE);
222#endif213#endif
223 214
224#ifdef CLOCK_MONOTONIC215#ifdef CLOCK_MONOTONIC
225 ret += vdso_test_clock(CLOCK_MONOTONIC);216 vdso_test_clock(CLOCK_MONOTONIC);
226#endif217#endif
227 218
228#ifdef CLOCK_MONOTONIC_RAW219#ifdef CLOCK_MONOTONIC_RAW
229 ret += vdso_test_clock(CLOCK_MONOTONIC_RAW);220 vdso_test_clock(CLOCK_MONOTONIC_RAW);
230#endif221#endif
231 222
232#ifdef CLOCK_MONOTONIC_COARSE223#ifdef CLOCK_MONOTONIC_COARSE
233 ret += vdso_test_clock(CLOCK_MONOTONIC_COARSE);224 vdso_test_clock(CLOCK_MONOTONIC_COARSE);
234#endif225#endif
235 226
236#endif227#endif
237 228
238 ret += vdso_test_time();229 vdso_test_time();
239
240 if (ret > 0)
241 return KSFT_FAIL;
242 230
243 return KSFT_PASS;231 ksft_print_cnts();
232 return ksft_get_fail_cnt() == 0 ? KSFT_PASS : KSFT_FAIL;
244}233}
tools/testing/selftests/vm/userfaultfd.c+7−2
@@ -1417,6 +1417,7 @@ static void userfaultfd_pagemap_test(unsigned int test_pgsize) · 1416 unmodified lines
1417static int userfaultfd_stress(void)1417static int userfaultfd_stress(void)
1418{1418{
1419 void *area;1419 void *area;
1420 char *tmp_area;
1420 unsigned long nr;1421 unsigned long nr;
1421 struct uffdio_register uffdio_register;1422 struct uffdio_register uffdio_register;
1422 struct uffd_stats uffd_stats[nr_cpus];1423 struct uffd_stats uffd_stats[nr_cpus];
@@ -1527,9 +1528,13 @@ static int userfaultfd_stress(void) · 104 unmodified lines
1527 count_verify[nr], nr);1528 count_verify[nr], nr);
1528 1529
1529 /* prepare next bounce */1530 /* prepare next bounce */
1530 swap(area_src, area_dst);1531 tmp_area = area_src;
1532 area_src = area_dst;
1533 area_dst = tmp_area;
1531 1534
1532 swap(area_src_alias, area_dst_alias);1535 tmp_area = area_src_alias;
1536 area_src_alias = area_dst_alias;
1537 area_dst_alias = tmp_area;
1533 1538
1534 uffd_stats_report(uffd_stats, nr_cpus);1539 uffd_stats_report(uffd_stats, nr_cpus);
1535 }1540 }
tools/testing/selftests/zram/zram.sh+1−14
@@ -2,9 +2,6 @@ · 1 unmodified line
2# SPDX-License-Identifier: GPL-2.02# SPDX-License-Identifier: GPL-2.0
3TCID="zram.sh"3TCID="zram.sh"
4 4
5# Kselftest framework requirement - SKIP code is 4.
6ksft_skip=4
7
8. ./zram_lib.sh5. ./zram_lib.sh
9 6
10run_zram () {7run_zram () {
@@ -18,14 +15,4 @@ echo "" · 7 unmodified lines
18 15
19check_prereqs16check_prereqs
20 17
21# check zram module exists18run_zram
22MODULE_PATH=/lib/modules/`uname -r`/kernel/drivers/block/zram/zram.ko
23if [ -f $MODULE_PATH ]; then
24 run_zram
25elif [ -b /dev/zram0 ]; then
26 run_zram
27else
28 echo "$TCID : No zram.ko module or /dev/zram0 device file not found"
29 echo "$TCID : CONFIG_ZRAM is not set"
30 exit $ksft_skip
31fi
tools/testing/selftests/zram/zram01.sh+9−24
@@ -33,9 +33,7 @@ zram_algs="lzo" · 32 unmodified lines
33 33
34zram_fill_fs()34zram_fill_fs()
35{35{
36 local mem_free0=$(free -m | awk 'NR==2 {print $4}')36 for i in $(seq $dev_start $dev_end); do
37
38 for i in $(seq 0 $(($dev_num - 1))); do
39 echo "fill zram$i..."37 echo "fill zram$i..."
40 local b=038 local b=0
41 while [ true ]; do39 while [ true ]; do
@@ -45,29 +43,17 @@ zram_fill_fs() · 3 unmodified lines
45 b=$(($b + 1))43 b=$(($b + 1))
46 done44 done
47 echo "zram$i can be filled with '$b' KB"45 echo "zram$i can be filled with '$b' KB"
48 done
49 46
50 local mem_free1=$(free -m | awk 'NR==2 {print $4}')47 local mem_used_total=`awk '{print $3}' "/sys/block/zram$i/mm_stat"`
51 local used_mem=$(($mem_free0 - $mem_free1))48 local v=$((100 * 1024 * $b / $mem_used_total))
49 if [ "$v" -lt 100 ]; then
50 echo "FAIL compression ratio: 0.$v:1"
51 ERR_CODE=-1
52 return
53 fi
52 54
53 local total_size=055 echo "zram compression ratio: $(echo "scale=2; $v / 100 " | bc):1: OK"
54 for sm in $zram_sizes; do
55 local s=$(echo $sm | sed 's/M//')
56 total_size=$(($total_size + $s))
57 done56 done
58
59 echo "zram used ${used_mem}M, zram disk sizes ${total_size}M"
60
61 local v=$((100 * $total_size / $used_mem))
62
63 if [ "$v" -lt 100 ]; then
64 echo "FAIL compression ratio: 0.$v:1"
65 ERR_CODE=-1
66 zram_cleanup
67 return
68 fi
69
70 echo "zram compression ratio: $(echo "scale=2; $v / 100 " | bc):1: OK"
71}57}
72 58
73check_prereqs59check_prereqs
@@ -81,7 +67,6 @@ zram_mount · 7 unmodified lines
81 67
82zram_fill_fs68zram_fill_fs
83zram_cleanup69zram_cleanup
84zram_unload
85 70
86if [ $ERR_CODE -ne 0 ]; then71if [ $ERR_CODE -ne 0 ]; then
87 echo "$TCID : [FAIL]"72 echo "$TCID : [FAIL]"
tools/testing/selftests/zram/zram02.sh+0−1
@@ -36,7 +36,6 @@ zram_set_memlimit · 35 unmodified lines
36zram_makeswap36zram_makeswap
37zram_swapoff37zram_swapoff
38zram_cleanup38zram_cleanup
39zram_unload
40 39
41if [ $ERR_CODE -ne 0 ]; then40if [ $ERR_CODE -ne 0 ]; then
42 echo "$TCID : [FAIL]"41 echo "$TCID : [FAIL]"
tools/testing/selftests/zram/zram_lib.sh+88−46
@@ -5,12 +5,17 @@ · 4 unmodified lines
5# Author: Alexey Kodanev <alexey.kodanev@oracle.com>5# Author: Alexey Kodanev <alexey.kodanev@oracle.com>
6# Modified: Naresh Kamboju <naresh.kamboju@linaro.org>6# Modified: Naresh Kamboju <naresh.kamboju@linaro.org>
7 7
8MODULE=0
9dev_makeswap=-18dev_makeswap=-1
10dev_mounted=-19dev_mounted=-1
11 10dev_start=0
11dev_end=-1
12module_load=-1
13sys_control=-1
12# Kselftest framework requirement - SKIP code is 4.14# Kselftest framework requirement - SKIP code is 4.
13ksft_skip=415ksft_skip=4
16kernel_version=`uname -r | cut -d'.' -f1,2`
17kernel_major=${kernel_version%.*}
18kernel_minor=${kernel_version#*.}
14 19
15trap INT20trap INT
16 21
@@ -25,68 +30,104 @@ check_prereqs() · 8 unmodified lines
25 fi30 fi
26}31}
27 32
33kernel_gte()
34{
35 major=${1%.*}
36 minor=${1#*.}
37
38 if [ $kernel_major -gt $major ]; then
39 return 0
40 elif [[ $kernel_major -eq $major && $kernel_minor -ge $minor ]]; then
41 return 0
42 fi
43
44 return 1
45}
46
28zram_cleanup()47zram_cleanup()
29{48{
30 echo "zram cleanup"49 echo "zram cleanup"
31 local i=50 local i=
32 for i in $(seq 0 $dev_makeswap); do51 for i in $(seq $dev_start $dev_makeswap); do
33 swapoff /dev/zram$i52 swapoff /dev/zram$i
34 done53 done
35 54
36 for i in $(seq 0 $dev_mounted); do55 for i in $(seq $dev_start $dev_mounted); do
37 umount /dev/zram$i56 umount /dev/zram$i
38 done57 done
39 58
40 for i in $(seq 0 $(($dev_num - 1))); do59 for i in $(seq $dev_start $dev_end); do
41 echo 1 > /sys/block/zram${i}/reset60 echo 1 > /sys/block/zram${i}/reset
42 rm -rf zram$i61 rm -rf zram$i
43 done62 done
44 63
45}64 if [ $sys_control -eq 1 ]; then
65 for i in $(seq $dev_start $dev_end); do
66 echo $i > /sys/class/zram-control/hot_remove
67 done
68 fi
46 69
47zram_unload()70 if [ $module_load -eq 1 ]; then
48{
49 if [ $MODULE -ne 0 ] ; then
50 echo "zram rmmod zram"
51 rmmod zram > /dev/null 2>&171 rmmod zram > /dev/null 2>&1
52 fi72 fi
53}73}
54 74
55zram_load()75zram_load()
56{76{
57 # check zram module exists77 echo "create '$dev_num' zram device(s)"
58 MODULE_PATH=/lib/modules/`uname -r`/kernel/drivers/block/zram/zram.ko78
59 if [ -f $MODULE_PATH ]; then79 # zram module loaded, new kernel
60 MODULE=180 if [ -d "/sys/class/zram-control" ]; then
61 echo "create '$dev_num' zram device(s)"81 echo "zram modules already loaded, kernel supports" \
62 modprobe zram num_devices=$dev_num82 "zram-control interface"
63 if [ $? -ne 0 ]; then83 dev_start=$(ls /dev/zram* | wc -w)
64 echo "failed to insert zram module"84 dev_end=$(($dev_start + $dev_num - 1))
65 exit 185 sys_control=1
66 fi86
67 87 for i in $(seq $dev_start $dev_end); do
68 dev_num_created=$(ls /dev/zram* | wc -w)88 cat /sys/class/zram-control/hot_add > /dev/null
89 done
90
91 echo "all zram devices (/dev/zram$dev_start~$dev_end" \
92 "successfully created"
93 return 0
94 fi
69 95
70 if [ "$dev_num_created" -ne "$dev_num" ]; then96 # detect old kernel or built-in
71 echo "unexpected num of devices: $dev_num_created"97 modprobe zram num_devices=$dev_num
72 ERR_CODE=-198 if [ ! -d "/sys/class/zram-control" ]; then
99 if grep -q '^zram' /proc/modules; then
100 rmmod zram > /dev/null 2>&1
101 if [ $? -ne 0 ]; then
102 echo "zram module is being used on old kernel" \
103 "without zram-control interface"
104 exit $ksft_skip
105 fi
73 else106 else
74 echo "zram load module successful"107 echo "test needs CONFIG_ZRAM=m on old kernel without" \
108 "zram-control interface"
109 exit $ksft_skip
75 fi110 fi
76 elif [ -b /dev/zram0 ]; then111 modprobe zram num_devices=$dev_num
77 echo "/dev/zram0 device file found: OK"
78 else
79 echo "ERROR: No zram.ko module or no /dev/zram0 device found"
80 echo "$TCID : CONFIG_ZRAM is not set"
81 exit 1
82 fi112 fi
113
114 module_load=1
115 dev_end=$(($dev_num - 1))
116 echo "all zram devices (/dev/zram0~$dev_end) successfully created"
83}117}
84 118
85zram_max_streams()119zram_max_streams()
86{120{
87 echo "set max_comp_streams to zram device(s)"121 echo "set max_comp_streams to zram device(s)"
88 122
89 local i=0123 kernel_gte 4.7
124 if [ $? -eq 0 ]; then
125 echo "The device attribute max_comp_streams was"\
126 "deprecated in 4.7"
127 return 0
128 fi
129
130 local i=$dev_start
90 for max_s in $zram_max_streams; do131 for max_s in $zram_max_streams; do
91 local sys_path="/sys/block/zram${i}/max_comp_streams"132 local sys_path="/sys/block/zram${i}/max_comp_streams"
92 echo $max_s > $sys_path || \133 echo $max_s > $sys_path || \
@@ -98,7 +139,7 @@ zram_max_streams() · 5 unmodified lines
98 echo "FAIL can't set max_streams '$max_s', get $max_stream"139 echo "FAIL can't set max_streams '$max_s', get $max_stream"
99 140
100 i=$(($i + 1))141 i=$(($i + 1))
101 echo "$sys_path = '$max_streams' ($i/$dev_num)"142 echo "$sys_path = '$max_streams'"
102 done143 done
103 144
104 echo "zram max streams: OK"145 echo "zram max streams: OK"
@@ -108,15 +149,16 @@ zram_compress_alg() · 3 unmodified lines
108{149{
109 echo "test that we can set compression algorithm"150 echo "test that we can set compression algorithm"
110 151
111 local algs=$(cat /sys/block/zram0/comp_algorithm)152 local i=$dev_start
153 local algs=$(cat /sys/block/zram${i}/comp_algorithm)
112 echo "supported algs: $algs"154 echo "supported algs: $algs"
113 local i=0155
114 for alg in $zram_algs; do156 for alg in $zram_algs; do
115 local sys_path="/sys/block/zram${i}/comp_algorithm"157 local sys_path="/sys/block/zram${i}/comp_algorithm"
116 echo "$alg" > $sys_path || \158 echo "$alg" > $sys_path || \
117 echo "FAIL can't set '$alg' to $sys_path"159 echo "FAIL can't set '$alg' to $sys_path"
118 i=$(($i + 1))160 i=$(($i + 1))
119 echo "$sys_path = '$alg' ($i/$dev_num)"161 echo "$sys_path = '$alg'"
120 done162 done
121 163
122 echo "zram set compression algorithm: OK"164 echo "zram set compression algorithm: OK"
@@ -125,14 +167,14 @@ zram_compress_alg() · 2 unmodified lines
125zram_set_disksizes()167zram_set_disksizes()
126{168{
127 echo "set disk size to zram device(s)"169 echo "set disk size to zram device(s)"
128 local i=0170 local i=$dev_start
129 for ds in $zram_sizes; do171 for ds in $zram_sizes; do
130 local sys_path="/sys/block/zram${i}/disksize"172 local sys_path="/sys/block/zram${i}/disksize"
131 echo "$ds" > $sys_path || \173 echo "$ds" > $sys_path || \
132 echo "FAIL can't set '$ds' to $sys_path"174 echo "FAIL can't set '$ds' to $sys_path"
133 175
134 i=$(($i + 1))176 i=$(($i + 1))
135 echo "$sys_path = '$ds' ($i/$dev_num)"177 echo "$sys_path = '$ds'"
136 done178 done
137 179
138 echo "zram set disksizes: OK"180 echo "zram set disksizes: OK"
@@ -142,14 +184,14 @@ zram_set_memlimit() · 3 unmodified lines
142{184{
143 echo "set memory limit to zram device(s)"185 echo "set memory limit to zram device(s)"
144 186
145 local i=0187 local i=$dev_start
146 for ds in $zram_mem_limits; do188 for ds in $zram_mem_limits; do
147 local sys_path="/sys/block/zram${i}/mem_limit"189 local sys_path="/sys/block/zram${i}/mem_limit"
148 echo "$ds" > $sys_path || \190 echo "$ds" > $sys_path || \
149 echo "FAIL can't set '$ds' to $sys_path"191 echo "FAIL can't set '$ds' to $sys_path"
150 192
151 i=$(($i + 1))193 i=$(($i + 1))
152 echo "$sys_path = '$ds' ($i/$dev_num)"194 echo "$sys_path = '$ds'"
153 done195 done
154 196
155 echo "zram set memory limit: OK"197 echo "zram set memory limit: OK"
@@ -158,8 +200,8 @@ zram_set_memlimit() · 2 unmodified lines
158zram_makeswap()200zram_makeswap()
159{201{
160 echo "make swap with zram device(s)"202 echo "make swap with zram device(s)"
161 local i=0203 local i=$dev_start
162 for i in $(seq 0 $(($dev_num - 1))); do204 for i in $(seq $dev_start $dev_end); do
163 mkswap /dev/zram$i > err.log 2>&1205 mkswap /dev/zram$i > err.log 2>&1
164 if [ $? -ne 0 ]; then206 if [ $? -ne 0 ]; then
165 cat err.log207 cat err.log
@@ -182,7 +224,7 @@ zram_makeswap() · 16 unmodified lines
182zram_swapoff()224zram_swapoff()
183{225{
184 local i=226 local i=
185 for i in $(seq 0 $dev_makeswap); do227 for i in $(seq $dev_start $dev_end); do
186 swapoff /dev/zram$i > err.log 2>&1228 swapoff /dev/zram$i > err.log 2>&1
187 if [ $? -ne 0 ]; then229 if [ $? -ne 0 ]; then
188 cat err.log230 cat err.log
@@ -196,7 +238,7 @@ zram_swapoff() · 7 unmodified lines
196 238
197zram_makefs()239zram_makefs()
198{240{
199 local i=0241 local i=$dev_start
200 for fs in $zram_filesystems; do242 for fs in $zram_filesystems; do
201 # if requested fs not supported default it to ext2243 # if requested fs not supported default it to ext2
202 which mkfs.$fs > /dev/null 2>&1 || fs=ext2244 which mkfs.$fs > /dev/null 2>&1 || fs=ext2
@@ -215,7 +257,7 @@ zram_makefs() · 12 unmodified lines
215zram_mount()257zram_mount()
216{258{
217 local i=0259 local i=0
218 for i in $(seq 0 $(($dev_num - 1))); do260 for i in $(seq $dev_start $dev_end); do
219 echo "mount /dev/zram$i"261 echo "mount /dev/zram$i"
220 mkdir zram$i262 mkdir zram$i
221 mount /dev/zram$i zram$i > /dev/null || \263 mount /dev/zram$i zram$i > /dev/null || \

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