History

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

David S. Miller committed 5 years ago

Commit efd13b72 parents 84c7f6c 00232241022 files · +8206 −4635Browse files

Unified · Split

1022 files
  1. .mailmap +3 −0
  2. Documentation/ABI/testing/sysfs-fs-xfs +1 −1
  3. Documentation/arm64/acpi_object_usage.rst +5 −5
  4. Documentation/arm64/silicon-errata.rst +3 −0
  5. Documentation/devicetree/bindings/interrupt-controller/ingenic,intc.yaml +1 −0
  6. Documentation/devicetree/bindings/sound/fsl,spdif.yaml +4 −0
  7. Documentation/gpu/todo.rst +21 −0
  8. Documentation/networking/device_drivers/ethernet/amazon/ena.rst +1 −1
  9. Documentation/networking/devlink/devlink-dpipe.rst +1 −1
  10. Documentation/networking/devlink/devlink-port.rst +2 −2
  11. Documentation/networking/xfrm_device.rst +1 −1
  12. Documentation/virt/kvm/api.rst +9 −3
  13. MAINTAINERS +14 −16
  14. Makefile +4 −2
  15. arch/Kconfig +1 −2
  16. arch/arm/Kconfig +1 −0
  17. arch/arm/xen/p2m.c +2 −3
  18. arch/arm64/Kconfig +12 −10
  19. arch/arm64/include/asm/checksum.h +1 −1
  20. arch/arm64/include/asm/cpucaps.h +2 −1
  21. arch/arm64/include/asm/kvm_asm.h +4 −4
  22. arch/arm64/include/asm/kvm_hyp.h +7 −1
  23. arch/arm64/include/asm/memory.h +5 −0
  24. arch/arm64/include/asm/mmu_context.h +0 −17
  25. arch/arm64/include/asm/pgtable-prot.h +0 −1
  26. arch/arm64/include/asm/pgtable.h +3 −0
  27. arch/arm64/include/asm/processor.h +2 −0
  28. arch/arm64/include/asm/sysreg.h +14 −6
  29. arch/arm64/include/asm/thread_info.h +2 −0
  30. arch/arm64/kernel/cpu_errata.c +8 −0
  31. arch/arm64/kernel/cpufeature.c +4 −1
  32. arch/arm64/kernel/cpuinfo.c +1 −1
  33. arch/arm64/kernel/crash_dump.c +2 −0
  34. arch/arm64/kernel/head.S +5 −3
  35. arch/arm64/kernel/idreg-override.c +23 −20
  36. arch/arm64/kernel/image-vars.h +3 −0
  37. arch/arm64/kernel/perf_event.c +1 −1
  38. arch/arm64/kernel/process.c +2 −0
  39. arch/arm64/kernel/stacktrace.c +5 −4
  40. arch/arm64/kvm/arm.c +6 −1
  41. arch/arm64/kvm/hyp/entry.S +5 −3
  42. arch/arm64/kvm/hyp/include/hyp/switch.h +6 −3
  43. arch/arm64/kvm/hyp/nvhe/debug-sr.c +10 −2
  44. arch/arm64/kvm/hyp/nvhe/host.S +8 −7
  45. arch/arm64/kvm/hyp/nvhe/hyp-main.c +6 −6
  46. arch/arm64/kvm/hyp/nvhe/switch.c +11 −3
  47. arch/arm64/kvm/hyp/nvhe/tlb.c +2 −1
  48. arch/arm64/kvm/hyp/pgtable.c +1 −0
  49. arch/arm64/kvm/hyp/vgic-v3-sr.c +38 −2
  50. arch/arm64/kvm/hyp/vhe/tlb.c +2 −1
  51. arch/arm64/kvm/mmu.c +1 −2
  52. arch/arm64/kvm/perf.c +10 −0
  53. arch/arm64/kvm/pmu-emul.c +0 −10
  54. arch/arm64/kvm/reset.c +14 −8
  55. arch/arm64/kvm/vgic/vgic-v3.c +9 −3
  56. arch/arm64/mm/init.c +26 −3
  57. arch/arm64/mm/mmu.c +22 −4
  58. arch/csky/kernel/probes/ftrace.c +1 −1
  59. arch/ia64/include/asm/syscall.h +1 −1
  60. arch/ia64/kernel/err_inject.c +11 −11
  61. arch/ia64/kernel/mca.c +1 −1
  62. arch/ia64/kernel/ptrace.c +18 −6
  63. arch/mips/kernel/vmlinux.lds.S +1 −1
  64. arch/powerpc/include/asm/code-patching.h +4 −3
  65. arch/powerpc/include/asm/cpu_has_feature.h +2 −2
  66. arch/powerpc/include/asm/interrupt.h +2 −1
  67. arch/powerpc/include/asm/ptrace.h +2 −2
  68. arch/powerpc/include/asm/switch_to.h +10 −0
  69. arch/powerpc/kernel/exceptions-64s.S +1 −1
  70. arch/powerpc/kernel/interrupt.c +0 −1
  71. arch/powerpc/kernel/traps.c +1 −1
  72. arch/powerpc/kernel/vdso32/gettimeofday.S +11 −0
  73. arch/riscv/Kconfig +2 −2
  74. arch/riscv/Kconfig.socs +2 −0
  75. arch/riscv/include/asm/asm-prototypes.h +16 −0
  76. arch/riscv/include/asm/irq.h +2 −0
  77. arch/riscv/include/asm/processor.h +1 −0
  78. arch/riscv/include/asm/ptrace.h +5 −0
  79. arch/riscv/include/asm/sbi.h +2 −2
  80. arch/riscv/include/asm/timex.h +2 −0
  81. arch/riscv/kernel/Makefile +1 −0
  82. arch/riscv/kernel/probes/ftrace.c +10 −8
  83. arch/riscv/kernel/probes/kprobes.c +1 −2
  84. arch/riscv/kernel/process.c +1 −0
  85. arch/riscv/kernel/sbi.c +1 −1
  86. arch/riscv/kernel/setup.c +2 −1
  87. arch/riscv/kernel/time.c +1 −0
  88. arch/riscv/kernel/traps.c +1 −0
  89. arch/riscv/mm/kasan_init.c +3 −1
  90. arch/s390/configs/debug_defconfig +3 −13
  91. arch/s390/configs/defconfig +2 −9
  92. arch/s390/configs/zfcpdump_defconfig +0 −3
  93. arch/s390/include/asm/idle.h +6 −6
  94. arch/s390/include/asm/pci.h +1 −1
  95. arch/s390/include/asm/timex.h +18 −18
  96. arch/s390/include/uapi/asm/hwctrset.h +0 −0
  97. arch/s390/kernel/idle.c +6 −6
  98. arch/s390/kernel/perf_cpum_cf.c +1 −1
  99. arch/s390/kernel/perf_cpum_cf_diag.c +5 −18
  100. arch/s390/kernel/time.c +14 −14
  101. arch/s390/kernel/topology.c +0 −2
  102. arch/s390/kernel/vtime.c +1 −1
  103. arch/s390/kvm/interrupt.c +1 −1
  104. arch/s390/pci/pci.c +24 −4
  105. arch/s390/pci/pci_event.c +6 −12
  106. arch/x86/entry/common.c +2 −1
  107. arch/x86/entry/entry_64_compat.S +2 −0
  108. arch/x86/events/core.c +6 −9
  109. arch/x86/events/intel/core.c +7 −1
  110. arch/x86/events/intel/ds.c +1 −1
  111. arch/x86/include/asm/insn-eval.h +2 −0
  112. arch/x86/include/asm/kvm_host.h +28 −10
  113. arch/x86/include/asm/processor.h +0 −9
  114. arch/x86/include/asm/proto.h +1 −0
  115. arch/x86/include/asm/ptrace.h +15 −0
  116. arch/x86/include/asm/smap.h +4 −6
  117. arch/x86/include/asm/thread_info.h +14 −1
  118. arch/x86/kernel/apic/apic.c +5 −0
  119. arch/x86/kernel/apic/io_apic.c +10 −0
  120. arch/x86/kernel/kprobes/ftrace.c +1 −1
  121. arch/x86/kernel/kvm.c +10 −13
  122. arch/x86/kernel/kvmclock.c +9 −10
  123. arch/x86/kernel/sev-es.c +17 −5
  124. arch/x86/kernel/signal.c +1 −23
  125. arch/x86/kernel/traps.c +1 −2
  126. arch/x86/kernel/unwind_orc.c +7 −7
  127. arch/x86/kvm/hyperv.c +81 −10
  128. arch/x86/kvm/hyperv.h +1 −0
  129. arch/x86/kvm/lapic.c +11 −1
  130. arch/x86/kvm/mmu/mmu_internal.h +5 −0
  131. arch/x86/kvm/mmu/tdp_iter.c +18 −12
  132. arch/x86/kvm/mmu/tdp_iter.h +3 −1
  133. arch/x86/kvm/mmu/tdp_mmu.c +26 −25
  134. arch/x86/kvm/svm/svm.c +13 −12
  135. arch/x86/kvm/vmx/vmx.c +1 −1
  136. arch/x86/kvm/x86.c +69 −46
  137. arch/x86/lib/insn-eval.c +52 −14
  138. arch/x86/net/bpf_jit_comp.c +25 −6
  139. arch/x86/platform/iris/iris.c +0 −1
  140. arch/x86/xen/p2m.c +2 −4
  141. block/bio.c +7 −7
  142. block/blk-cgroup-rwstat.c +2 −1
  143. block/blk-crypto-fallback.c +1 −1
  144. block/blk-lib.c +1 −1
  145. block/blk-map.c +1 −1
  146. block/blk-zoned.c +37 −3
  147. block/bounce.c +3 −3
  148. block/genhd.c +1 −3
  149. drivers/atm/fore200e.c +0 −2
  150. drivers/base/power/runtime.c +25 −37
  151. drivers/base/swnode.c +20 −9
  152. drivers/block/drbd/drbd_int.h +1 −1
  153. drivers/block/floppy.c +0 −1
  154. drivers/block/rsxx/core.c +1 −0
  155. drivers/block/umem.c +4 −1
  156. drivers/block/zram/zram_drv.c +11 −6
  157. drivers/bluetooth/btrsi.c +0 −1
  158. drivers/char/applicom.c +0 −3
  159. drivers/char/toshiba.c +0 −1
  160. drivers/clk/qcom/clk-rcg2.c +9 −8
  161. drivers/clk/qcom/clk-rpmh.c +5 −2
  162. drivers/clk/qcom/gcc-sc7180.c +2 −2
  163. drivers/counter/stm32-timer-cnt.c +33 −22
  164. drivers/cpufreq/cpufreq-dt-platdev.c +2 −0
  165. drivers/cpufreq/qcom-cpufreq-hw.c +3 −3
  166. drivers/firmware/efi/efi.c +2 −1
  167. drivers/firmware/efi/libstub/arm64-stub.c +1 −1
  168. drivers/firmware/efi/libstub/efi-stub.c +16 −0
  169. drivers/firmware/efi/vars.c +4 −0
  170. drivers/gpio/gpiolib.c +9 −1
  171. drivers/gpu/drm/Kconfig +1 −0
  172. drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 −0
  173. drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +1 −1
  174. drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +4 −0
  175. drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +1 −1
  176. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +30 −20
  177. drivers/gpu/drm/amd/display/dc/core/dc_link.c +0 −1
  178. drivers/gpu/drm/amd/display/dc/dc.h +1 −0
  179. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c +11 −0
  180. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.h +6 −0
  181. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +7 −0
  182. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hubp.c +1 −0
  183. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +8 −32
  184. drivers/gpu/drm/amd/display/dc/dcn21/dcn21_hubp.c +1 −0
  185. drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c +7 −6
  186. drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c +18 −8
  187. drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hubp.c +1 −0
  188. drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c +31 −0
  189. drivers/gpu/drm/amd/display/dc/dcn301/dcn301_resource.c +95 −1
  190. drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h +2 −0
  191. drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +4 −4
  192. drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c +48 −0
  193. drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_hwmgr.c +66 −0
  194. drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c +27 −21
  195. drivers/gpu/drm/drm_fb_helper.c +1 −1
  196. drivers/gpu/drm/drm_gem_shmem_helper.c +22 −10
  197. drivers/gpu/drm/drm_ioc32.c +11 −0
  198. drivers/gpu/drm/i915/gt/intel_engine_cs.c +6 −1
  199. drivers/gpu/drm/i915/i915_cmd_parser.c +13 −6
  200. drivers/gpu/drm/i915/i915_drv.h +1 −1
  201. drivers/gpu/drm/i915/i915_perf.c +5 −8
  202. drivers/gpu/drm/i915/i915_reg.h +22 −1
  203. drivers/gpu/drm/i915/intel_pm.c +15 −1
  204. drivers/gpu/drm/meson/meson_drv.c +11 −0
  205. drivers/gpu/drm/nouveau/nouveau_bo.c +12 −2
  206. drivers/gpu/drm/omapdrm/dss/dsi.c +4 −3
  207. drivers/gpu/drm/qxl/qxl_display.c +1 −0
  208. drivers/gpu/drm/qxl/qxl_release.c +10 −2
  209. drivers/gpu/drm/radeon/radeon.h +2 −0
  210. drivers/gpu/drm/radeon/radeon_gem.c +2 −2
  211. drivers/gpu/drm/radeon/radeon_prime.c +2 −0
  212. drivers/gpu/drm/tiny/gm12u320.c +36 −8
  213. drivers/gpu/drm/ttm/ttm_bo.c +6 −2
  214. drivers/gpu/drm/ttm/ttm_pool.c +2 −2
  215. drivers/gpu/drm/udl/udl_drv.c +17 −0
  216. drivers/gpu/drm/udl/udl_drv.h +1 −0
  217. drivers/gpu/drm/udl/udl_main.c +10 −0
  218. drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c +1 −3
  219. drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c +1 −1
  220. drivers/iio/adc/Kconfig +3 −0
  221. drivers/iio/adc/ab8500-gpadc.c +1 −1
  222. drivers/iio/adc/ad7949.c +1 −1
  223. drivers/iio/adc/qcom-spmi-vadc.c +1 −1
  224. drivers/iio/gyro/mpu3050-core.c +2 −0
  225. drivers/iio/humidity/hid-sensor-humidity.c +7 −5
  226. drivers/iio/imu/adis16400.c +1 −2
  227. drivers/iio/light/hid-sensor-prox.c +11 −2
  228. drivers/iio/temperature/hid-sensor-temperature.c +8 −6
  229. drivers/infiniband/hw/cxgb4/cm.c +2 −2
  230. drivers/infiniband/hw/hns/hns_roce_hw_v2.c +3 −1
  231. drivers/infiniband/hw/mlx5/devx.c +1 −1
  232. drivers/infiniband/hw/mlx5/qp.c +14 −4
  233. drivers/input/joydev.c +0 −1
  234. drivers/iommu/amd/init.c +20 −16
  235. drivers/iommu/tegra-smmu.c +3 −4
  236. drivers/irqchip/Kconfig +0 −9
  237. drivers/irqchip/irq-ingenic-tcu.c +1 −0
  238. drivers/irqchip/irq-ingenic.c +1 −0
  239. drivers/isdn/capi/kcapi.c +2 −2
  240. drivers/isdn/hardware/mISDN/mISDNipac.c +1 −1
  241. drivers/leds/trigger/ledtrig-tty.c +4 −7
  242. drivers/md/bcache/super.c +1 −1
  243. drivers/md/dm-crypt.c +4 −4
  244. drivers/md/dm-writecache.c +2 −2
  245. drivers/md/raid5-cache.c +2 −2
  246. drivers/md/raid5-ppl.c +1 −1
  247. drivers/media/firewire/firedtv-fw.c +0 −1
  248. drivers/media/pci/cx18/cx18-alsa-main.c +0 −1
  249. drivers/media/pci/cx18/cx18-driver.c +0 −1
  250. drivers/media/pci/cx25821/cx25821-alsa.c +0 −1
  251. drivers/media/pci/cx88/cx88-alsa.c +0 −1
  252. drivers/media/pci/ivtv/ivtv-alsa-main.c +0 −1
  253. drivers/media/pci/ivtv/ivtv-driver.c +0 −3
  254. drivers/media/pci/sta2x11/sta2x11_vip.c +0 −1
  255. drivers/media/platform/atmel/atmel-isi.c +0 −1
  256. drivers/media/platform/atmel/atmel-sama5d2-isc.c +0 −1
  257. drivers/media/platform/marvell-ccic/cafe-driver.c +0 −4
  258. drivers/media/platform/rockchip/rkisp1/rkisp1-params.c +0 −1
  259. drivers/media/platform/stm32/stm32-dcmi.c +0 −1
  260. drivers/media/platform/vsp1/vsp1_drm.c +3 −3
  261. drivers/media/rc/Makefile +1 −0
  262. drivers/media/rc/keymaps/Makefile +0 −1
  263. drivers/media/rc/keymaps/rc-cec.c +11 −17
  264. drivers/media/rc/rc-main.c +6 −0
  265. drivers/media/usb/cpia2/cpia2_v4l.c +0 −1
  266. drivers/media/usb/tm6000/tm6000-alsa.c +0 −1
  267. drivers/media/usb/tm6000/tm6000-dvb.c +0 −2
  268. drivers/media/usb/usbtv/usbtv-audio.c +1 −1
  269. drivers/mfd/intel_quark_i2c_gpio.c +4 −2
  270. drivers/misc/fastrpc.c +5 −0
  271. drivers/misc/habanalabs/common/debugfs.c +1 −4
  272. drivers/misc/habanalabs/common/device.c +35 −5
  273. drivers/misc/habanalabs/common/habanalabs.h +0 −2
  274. drivers/misc/habanalabs/common/habanalabs_ioctl.c +12 −0
  275. drivers/misc/habanalabs/common/irq.c +1 −1
  276. drivers/misc/habanalabs/common/mmu/mmu.c +26 −12
  277. drivers/misc/pvpanic.c +1 −0
  278. drivers/mmc/core/bus.c +5 −6
  279. drivers/mmc/core/mmc.c +11 −4
  280. drivers/mmc/host/mmci.c +9 −1
  281. drivers/mtd/maps/sun_uflash.c +0 −1
  282. drivers/net/arcnet/com20020-pci.c +19 −15
  283. drivers/net/bonding/bond_main.c +2 −6
  284. drivers/net/can/c_can/c_can.c +1 −23
  285. drivers/net/can/c_can/c_can_pci.c +2 −1
  286. drivers/net/can/c_can/c_can_platform.c +5 −1
  287. drivers/net/can/dev/netlink.c +1 −0
  288. drivers/net/can/flexcan.c +7 −1
  289. drivers/net/can/kvaser_pciefd.c +4 −0
  290. drivers/net/can/m_can/m_can.c +1 −4
  291. drivers/net/can/peak_canfd/peak_pciefd_main.c +0 −1
  292. drivers/net/can/sja1000/ems_pci.c +0 −1
  293. drivers/net/can/sja1000/ems_pcmcia.c +0 −1
  294. drivers/net/can/sja1000/kvaser_pci.c +0 −1
  295. drivers/net/can/sja1000/peak_pci.c +0 −2
  296. drivers/net/can/sja1000/peak_pcmcia.c +0 −1
  297. drivers/net/can/sja1000/plx_pci.c +0 −12
  298. drivers/net/can/usb/Kconfig +1 −0
  299. drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c +3 −1
  300. drivers/net/can/usb/peak_usb/pcan_usb.c +0 −2
  301. drivers/net/can/usb/peak_usb/pcan_usb_fd.c +0 −3
  302. drivers/net/can/usb/peak_usb/pcan_usb_pro.c +0 −2
  303. drivers/net/dsa/b53/b53_common.c +7 −7
  304. drivers/net/dsa/bcm_sf2.c +8 −3
  305. drivers/net/dsa/mt7530.c +25 −27
  306. drivers/net/ethernet/broadcom/Kconfig +1 −1
  307. drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c +1 −1
  308. drivers/net/ethernet/faraday/ftgmac100.c +1 −0
  309. drivers/net/ethernet/intel/e1000e/82571.c +2 −0
  310. drivers/net/ethernet/intel/e1000e/hw.h +3 −3
  311. drivers/net/ethernet/intel/e1000e/netdev.c +5 −1
  312. drivers/net/ethernet/intel/i40e/i40e_main.c +13 −0
  313. drivers/net/ethernet/intel/i40e/i40e_txrx.c +0 −12
  314. drivers/net/ethernet/intel/ice/ice_base.c +22 −2
  315. drivers/net/ethernet/intel/ice/ice_txrx.c +0 −17
  316. drivers/net/ethernet/intel/ice/ice_xsk.c +5 −5
  317. drivers/net/ethernet/intel/igb/e1000_hw.h +3 −3
  318. drivers/net/ethernet/intel/igb/igb.h +2 −2
  319. drivers/net/ethernet/intel/igb/igb_main.c +21 −12
  320. drivers/net/ethernet/intel/igb/igb_ptp.c +24 −7
  321. drivers/net/ethernet/intel/igc/igc.h +1 −1
  322. drivers/net/ethernet/intel/igc/igc_ethtool.c +4 −3
  323. drivers/net/ethernet/intel/igc/igc_main.c +9 −0
  324. drivers/net/ethernet/intel/igc/igc_ptp.c +40 −32
  325. drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +2 −1
  326. drivers/net/ethernet/marvell/Kconfig +2 −2
  327. drivers/net/ethernet/marvell/mv643xx_eth.c +1 −1
  328. drivers/net/ethernet/marvell/octeontx2/af/npc_profile.h +0 −2
  329. drivers/net/ethernet/marvell/octeontx2/af/rvu.c +4 −2
  330. drivers/net/ethernet/marvell/octeontx2/af/rvu.h +1 −0
  331. drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c +16 −2
  332. drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c +36 −21
  333. drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +1 −1
  334. drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +1 −1
  335. drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c +3 −1
  336. drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +5 −0
  337. drivers/net/ethernet/marvell/pxa168_eth.c +1 −1
  338. drivers/net/ethernet/mellanox/mlx5/core/en.h +4 −3
  339. drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +2 −1
  340. drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c +4 −4
  341. drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c +2 −1
  342. drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_geneve.c +4 −0
  343. drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +10 −1
  344. drivers/net/ethernet/mellanox/mlx5/core/en_main.c +57 −24
  345. drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +2 −2
  346. drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +45 −12
  347. drivers/net/ethernet/mellanox/mlx5/core/en_tc.h +1 −0
  348. drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +2 −1
  349. drivers/net/ethernet/mellanox/mlx5/core/fpga/conn.c +1 −0
  350. drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c +3 −1
  351. drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c +4 −4
  352. drivers/net/ethernet/mellanox/mlx5/core/sf/dev/dev.c +1 −3
  353. drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c +5 −5
  354. drivers/net/ethernet/mellanox/mlx5/core/sf/mlx5_ifc_vhca_event.h +1 −1
  355. drivers/net/ethernet/mellanox/mlx5/core/sf/vhca_event.c +11 −12
  356. drivers/net/ethernet/mellanox/mlx5/core/sf/vhca_event.h +3 −4
  357. drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c +1 −0
  358. drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v1.c +2 −2
  359. drivers/net/ethernet/netronome/nfp/flower/metadata.c +17 −7
  360. drivers/net/ethernet/netronome/nfp/flower/offload.c +18 −0
  361. drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c +13 −2
  362. drivers/net/ethernet/pensando/ionic/ionic_txrx.c +7 −5
  363. drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c +3 −0
  364. drivers/net/ethernet/realtek/r8169_main.c +4 −2
  365. drivers/net/ethernet/socionext/netsec.c +6 −3
  366. drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +2 −0
  367. drivers/net/ethernet/xilinx/xilinx_axienet_main.c +25 −12
  368. drivers/net/hamradio/scc.c +0 −1
  369. drivers/net/ipa/ipa_cmd.c +33 −17
  370. drivers/net/ipa/ipa_qmi.c +2 −0
  371. drivers/net/phy/broadcom.c +9 −0
  372. drivers/net/phy/phylink.c +1 −1
  373. drivers/net/usb/cdc-phonet.c +2 −0
  374. drivers/net/usb/r8152.c +4 −1
  375. drivers/net/veth.c +1 −2
  376. drivers/net/wan/hdlc_x25.c +41 −1
  377. drivers/net/wireless/admtek/adm8211.c +0 −1
  378. drivers/net/wireless/ath/ath5k/base.c +0 −1
  379. drivers/net/wireless/ath/ath9k/hw.c +0 −1
  380. drivers/net/wireless/ath/ath9k/init.c +0 −1
  381. drivers/net/wireless/atmel/atmel.c +0 −1
  382. drivers/net/wireless/atmel/atmel_cs.c +0 −1
  383. drivers/net/wireless/atmel/atmel_pci.c +0 −1
  384. drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c +0 −1
  385. drivers/net/wireless/broadcom/brcm80211/brcmutil/utils.c +0 −1
  386. drivers/net/wireless/cisco/airo.c +0 −1
  387. drivers/net/wireless/cisco/airo_cs.c +0 −1
  388. drivers/net/wireless/intersil/hostap/hostap_cs.c +0 −1
  389. drivers/net/wireless/intersil/hostap/hostap_pci.c +0 −1
  390. drivers/net/wireless/intersil/hostap/hostap_plx.c +0 −1
  391. drivers/net/wireless/ralink/rt2x00/rt2400pci.c +0 −1
  392. drivers/net/wireless/ralink/rt2x00/rt2500pci.c +0 −1
  393. drivers/net/wireless/ralink/rt2x00/rt2500usb.c +0 −1
  394. drivers/net/wireless/ralink/rt2x00/rt2800pci.c +0 −1
  395. drivers/net/wireless/ralink/rt2x00/rt2800usb.c +0 −1
  396. drivers/net/wireless/ralink/rt2x00/rt61pci.c +0 −2
  397. drivers/net/wireless/ralink/rt2x00/rt73usb.c +0 −1
  398. drivers/net/wireless/rsi/rsi_91x_main.c +0 −1
  399. drivers/net/wireless/rsi/rsi_91x_sdio.c +0 −1
  400. drivers/net/wireless/rsi/rsi_91x_usb.c +0 −1
  401. drivers/nvme/host/core.c +32 −47
  402. drivers/nvme/host/fabrics.h +7 −0
  403. drivers/nvme/host/fc.c +5 −4
  404. drivers/nvme/host/pci.c +1 −0
  405. drivers/nvme/host/rdma.c +7 −4
  406. drivers/nvme/host/tcp.c +15 −5
  407. drivers/nvme/host/zns.c +7 −2
  408. drivers/nvme/target/core.c +14 −3
  409. drivers/nvme/target/loop.c +2 −2
  410. drivers/nvme/target/passthru.c +3 −3
  411. drivers/nvme/target/rdma.c +2 −3
  412. drivers/nvme/target/tcp.c +1 −1
  413. drivers/opp/core.c +25 −23
  414. drivers/opp/opp.h +2 −0
  415. drivers/parport/parport_amiga.c +0 −1
  416. drivers/parport/parport_atari.c +0 −1
  417. drivers/parport/parport_gsc.c +0 −1
  418. drivers/parport/parport_mfc3.c +0 −1
  419. drivers/parport/parport_sunbpp.c +0 −1
  420. drivers/pci/hotplug/rpadlpar_sysfs.c +6 −8
  421. drivers/pci/hotplug/s390_pci_hpc.c +2 −1
  422. drivers/pci/xen-pcifront.c +2 −2
  423. drivers/perf/arm_dmc620_pmu.c +1 −0
  424. drivers/platform/x86/Kconfig +8 −3
  425. drivers/platform/x86/dell/dell-wmi-sysman/enum-attributes.c +3 −0
  426. drivers/platform/x86/dell/dell-wmi-sysman/int-attributes.c +3 −0
  427. drivers/platform/x86/dell/dell-wmi-sysman/passobj-attributes.c +3 −0
  428. drivers/platform/x86/dell/dell-wmi-sysman/string-attributes.c +3 −0
  429. drivers/platform/x86/dell/dell-wmi-sysman/sysman.c +32 −52
  430. drivers/platform/x86/intel-hid.c +7 −0
  431. drivers/platform/x86/intel-vbtn.c +10 −2
  432. drivers/platform/x86/intel_pmc_core.c +35 −15
  433. drivers/platform/x86/intel_pmt_class.c +1 −1
  434. drivers/platform/x86/intel_pmt_crashlog.c +6 −7
  435. drivers/platform/x86/thinkpad_acpi.c +79 −29
  436. drivers/ptp/ptp_qoriq.c +7 −6
  437. drivers/regulator/mt6315-regulator.c +2 −2
  438. drivers/regulator/pca9450-regulator.c +9 −1
  439. drivers/regulator/qcom-rpmh-regulator.c +3 −3
  440. drivers/regulator/rt4831-regulator.c +2 −2
  441. drivers/s390/block/dasd.c +3 −4
  442. drivers/s390/char/tty3270.c +4 −2
  443. drivers/s390/char/zcore.c +27 −17
  444. drivers/s390/cio/device_fsm.c +1 −1
  445. drivers/s390/cio/vfio_ccw_ops.c +3 −3
  446. drivers/s390/crypto/vfio_ap_ops.c +1 −1
  447. drivers/sbus/char/display7seg.c +0 −1
  448. drivers/scsi/hpsa.c +0 −1
  449. drivers/scsi/ibmvscsi/ibmvfc.c +38 −26
  450. drivers/scsi/lpfc/lpfc_debugfs.c +2 −2
  451. drivers/scsi/mpt3sas/mpt3sas_scsih.c +1 −1
  452. drivers/scsi/myrs.c +1 −1
  453. drivers/scsi/pcmcia/nsp_cs.c +0 −1
  454. drivers/scsi/qla2xxx/qla_target.h +1 −1
  455. drivers/scsi/sd_zbc.c +11 −8
  456. drivers/scsi/smartpqi/smartpqi_init.c +0 −1
  457. drivers/scsi/st.c +1 −1
  458. drivers/scsi/ufs/ufs-mediatek.c +1 −1
  459. drivers/scsi/ufs/ufs-qcom.c +10 −0
  460. drivers/scsi/ufs/ufshcd.c +13 −28
  461. drivers/scsi/vmw_pvscsi.c +0 −2
  462. drivers/scsi/vmw_pvscsi.h +0 −2
  463. drivers/sh/maple/maple.c +0 −1
  464. drivers/spi/spi-cadence-quadspi.c +1 −0
  465. drivers/staging/comedi/drivers/addi_apci_1032.c +3 −1
  466. drivers/staging/comedi/drivers/addi_apci_1500.c +9 −9
  467. drivers/staging/comedi/drivers/adv_pci1710.c +5 −5
  468. drivers/staging/comedi/drivers/amplc_pc236_common.c +3 −1
  469. drivers/staging/comedi/drivers/cb_pcidas.c +1 −1
  470. drivers/staging/comedi/drivers/cb_pcidas64.c +1 −1
  471. drivers/staging/comedi/drivers/comedi_parport.c +2 −1
  472. drivers/staging/comedi/drivers/das6402.c +1 −1
  473. drivers/staging/comedi/drivers/das800.c +1 −1
  474. drivers/staging/comedi/drivers/dmm32at.c +1 −1
  475. drivers/staging/comedi/drivers/me4000.c +1 −1
  476. drivers/staging/comedi/drivers/ni_6527.c +3 −1
  477. drivers/staging/comedi/drivers/ni_65xx.c +2 −1
  478. drivers/staging/comedi/drivers/pcl711.c +1 −1
  479. drivers/staging/comedi/drivers/pcl726.c +3 −1
  480. drivers/staging/comedi/drivers/pcl818.c +1 −1
  481. drivers/staging/comedi/drivers/vmk80xx.c +0 −1
  482. drivers/staging/ks7010/ks_wlan_net.c +4 −2
  483. drivers/staging/rtl8188eu/core/rtw_ap.c +5 −0
  484. drivers/staging/rtl8188eu/os_dep/ioctl_linux.c +4 −2
  485. drivers/staging/rtl8192e/Kconfig +1 −0
  486. drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +4 −3
  487. drivers/staging/rtl8192u/r8192U_wx.c +4 −2
  488. drivers/staging/rtl8712/rtl871x_cmd.c +4 −2
  489. drivers/staging/rtl8712/rtl871x_ioctl_linux.c +1 −1
  490. drivers/staging/vt6655/rxtx.h +2 −2
  491. drivers/staging/wfx/bh.c +1 −0
  492. drivers/staging/wfx/bh.h +4 −0
  493. drivers/staging/wfx/bus.h +3 −0
  494. drivers/staging/wfx/bus_sdio.c +6 −0
  495. drivers/staging/wfx/bus_spi.c +7 −0
  496. drivers/staging/wfx/data_rx.c +5 −0
  497. drivers/staging/wfx/data_tx.c +5 −0
  498. drivers/staging/wfx/data_tx.h +3 −0
  499. drivers/staging/wfx/debug.c +6 −0
  500. drivers/staging/wfx/fwio.c +2 −0
  501. drivers/staging/wfx/hif_api_cmd.h +4 −0
  502. drivers/staging/wfx/hif_api_general.h +9 −0
  503. drivers/staging/wfx/hif_tx.c +4 −0
  504. drivers/staging/wfx/hif_tx_mib.c +5 −0
  505. drivers/staging/wfx/hwio.c +3 −0
  506. drivers/staging/wfx/hwio.h +2 −0
  507. drivers/staging/wfx/key.c +2 −0
  508. drivers/staging/wfx/key.h +2 −0
  509. drivers/staging/wfx/main.c +7 −0
  510. drivers/staging/wfx/main.h +3 −0
  511. drivers/staging/wfx/queue.c +4 −0
  512. drivers/staging/wfx/queue.h +3 −0
  513. drivers/staging/wfx/scan.h +2 −0
  514. drivers/staging/wfx/sta.c +6 −0
  515. drivers/staging/wfx/sta.h +2 −0
  516. drivers/staging/wfx/traces.h +3 −0
  517. drivers/staging/wfx/wfx.h +3 −0
  518. drivers/tee/optee/core.c +0 −1
  519. drivers/thermal/thermal_sysfs.c +3 −0
  520. drivers/thunderbolt/switch.c +8 −10
  521. drivers/thunderbolt/tb.c +4 −0
  522. drivers/tty/pty.c +2 −13
  523. drivers/tty/serial/icom.c +0 −2
  524. drivers/tty/serial/jsm/jsm_driver.c +0 −1
  525. drivers/tty/serial/max310x.c +5 −24
  526. drivers/tty/tty_io.c +2 −3
  527. drivers/usb/cdns3/cdnsp-ring.c +4 −1
  528. drivers/usb/class/cdc-acm.c +5 −0
  529. drivers/usb/class/usblp.c +12 −4
  530. drivers/usb/core/usb.c +32 −0
  531. drivers/usb/dwc3/dwc3-qcom.c +13 −5
  532. drivers/usb/dwc3/gadget.c +5 −6
  533. drivers/usb/gadget/configfs.c +10 −4
  534. drivers/usb/gadget/function/f_uac1.c +1 −0
  535. drivers/usb/gadget/function/f_uac2.c +1 −1
  536. drivers/usb/gadget/function/u_ether_configfs.h +2 −3
  537. drivers/usb/gadget/udc/s3c2410_udc.c +2 −2
  538. drivers/usb/host/xhci-pci.c +11 −2
  539. drivers/usb/host/xhci-ring.c +2 −1
  540. drivers/usb/host/xhci.c +43 −35
  541. drivers/usb/host/xhci.h +1 −0
  542. drivers/usb/misc/ldusb.c +0 −1
  543. drivers/usb/renesas_usbhs/pipe.c +2 −0
  544. drivers/usb/serial/ch341.c +1 −0
  545. drivers/usb/serial/cp210x.c +3 −0
  546. drivers/usb/serial/io_edgeport.c +16 −10
  547. drivers/usb/serial/xr_serial.c +0 −25
  548. drivers/usb/storage/transport.c +7 −0
  549. drivers/usb/storage/unusual_devs.h +12 −0
  550. drivers/usb/typec/tcpm/tcpm.c +9 −2
  551. drivers/usb/typec/tps6598x.c +0 −1
  552. drivers/usb/usbip/stub_dev.c +35 −7
  553. drivers/usb/usbip/vhci_sysfs.c +34 −5
  554. drivers/usb/usbip/vudc_sysfs.c +42 −7
  555. drivers/vdpa/ifcvf/ifcvf_main.c +2 −3
  556. drivers/vdpa/mlx5/net/mlx5_vnet.c +2 −2
  557. drivers/vdpa/vdpa.c +10 −8
  558. drivers/vdpa/vdpa_sim/vdpa_sim.c +1 −1
  559. drivers/vdpa/vdpa_sim/vdpa_sim_net.c +2 −3
  560. drivers/vfio/Kconfig +2 −2
  561. drivers/vfio/platform/Kconfig +2 −2
  562. drivers/vfio/vfio_iommu_type1.c +12 −8
  563. drivers/vhost/vdpa.c +11 −9
  564. drivers/vhost/vhost.c +1 −1
  565. drivers/video/fbdev/aty/atyfb.h +0 −3
  566. drivers/video/fbdev/aty/atyfb_base.c +5 −4
  567. drivers/virt/acrn/hsm.c +10 −1
  568. drivers/virt/acrn/irqfd.c +3 −3
  569. drivers/virtio/virtio.c +2 −4
  570. drivers/virtio/virtio_mmio.c +1 −2
  571. drivers/watchdog/cpu5wdt.c +0 −1
  572. drivers/watchdog/cpwd.c +0 −1
  573. drivers/watchdog/riowd.c +0 −1
  574. drivers/xen/events/events_2l.c +15 −7
  575. drivers/xen/events/events_base.c +100 −30
  576. drivers/xen/events/events_fifo.c +0 −7
  577. drivers/xen/events/events_internal.h +8 −6
  578. drivers/xen/gntdev.c +33 −21
  579. fs/Kconfig +1 −1
  580. fs/afs/dir.c +0 −1
  581. fs/afs/file.c +0 −1
  582. fs/afs/fs_operation.c +5 −2
  583. fs/afs/inode.c +0 −1
  584. fs/afs/internal.h +0 −1
  585. fs/afs/mntpt.c +0 −1
  586. fs/afs/write.c +1 −2
  587. fs/afs/xattr.c +7 −24
  588. fs/binfmt_misc.c +14 −15
  589. fs/block_dev.c +13 −4
  590. fs/btrfs/ctree.c +2 −0
  591. fs/btrfs/extent-tree.c +22 −1
  592. fs/btrfs/extent_io.c +32 −3
  593. fs/btrfs/inode.c +26 −11
  594. fs/btrfs/reada.c +18 −17
  595. fs/btrfs/scrub.c +1 −1
  596. fs/btrfs/tree-log.c +4 −4
  597. fs/cachefiles/bind.c +6 −0
  598. fs/cachefiles/rdwr.c +3 −4
  599. fs/cifs/cifs_debug.c +1 −1
  600. fs/cifs/cifs_swn.c +1 −1
  601. fs/cifs/cifsacl.c +6 −3
  602. fs/cifs/cifsfs.c +1 −1
  603. fs/cifs/cifsglob.h +10 −9
  604. fs/cifs/connect.c +7 −7
  605. fs/cifs/fs_context.c +4 −2
  606. fs/cifs/inode.c +9 −1
  607. fs/cifs/sess.c +1 −0
  608. fs/cifs/smb2inode.c +1 −0
  609. fs/cifs/smb2misc.c +5 −5
  610. fs/cifs/smb2ops.c +5 −5
  611. fs/cifs/smb2pdu.c +2 −4
  612. fs/cifs/smb2proto.h +1 −2
  613. fs/cifs/transport.c +8 −3
  614. fs/configfs/file.c +2 −4
  615. fs/crypto/bio.c +3 −3
  616. fs/erofs/data.c +11 −17
  617. fs/erofs/zdata.c +1 −1
  618. fs/ext4/balloc.c +26 −12
  619. fs/ext4/ext4.h +3 −0
  620. fs/ext4/extents.c +1 −1
  621. fs/ext4/fast_commit.c +7 −2
  622. fs/ext4/inode.c +10 −8
  623. fs/ext4/mballoc.c +9 −2
  624. fs/ext4/namei.c +39 −11
  625. fs/ext4/page-io.c +1 −1
  626. fs/ext4/super.c +6 −1
  627. fs/ext4/sysfs.c +7 −0
  628. fs/ext4/verity.c +55 −34
  629. fs/ext4/xattr.c +5 −1
  630. fs/f2fs/checkpoint.c +1 −1
  631. fs/f2fs/data.c +2 −2
  632. fs/f2fs/segment.c +1 −1
  633. fs/f2fs/segment.h +2 −2
  634. fs/f2fs/super.c +2 −2
  635. fs/fuse/dev.c +16 −10
  636. fs/fuse/fuse_i.h +1 −0
  637. fs/fuse/virtio_fs.c +8 −1
  638. fs/gfs2/log.c +5 −1
  639. fs/gfs2/lops.c +1 −1
  640. fs/gfs2/ops_fstype.c +1 −3
  641. fs/gfs2/super.c +2 −8
  642. fs/gfs2/super.h +1 −1
  643. fs/gfs2/trans.c +2 −0
  644. fs/gfs2/util.c +11 −6
  645. fs/io-wq.c +22 −15
  646. fs/io-wq.h +10 −2
  647. fs/io_uring.c +551 −436
  648. fs/iomap/buffered-io.c +2 −2
  649. fs/iomap/direct-io.c +2 −2
  650. fs/iomap/swapfile.c +10 −0
  651. fs/locks.c +0 −3
  652. fs/mpage.c +1 −1
  653. fs/nfs/Kconfig +1 −1
  654. fs/nfs/dir.c +33 −25
  655. fs/nfs/inode.c +4 −3
  656. fs/nfs/internal.h +2 −1
  657. fs/nfs/nfs3xdr.c +2 −1
  658. fs/nfs/nfs42proc.c +7 −5
  659. fs/nfs/nfs4proc.c +16 −17
  660. fs/nfs/unlink.c +3 −3
  661. fs/nfs/write.c +4 −4
  662. fs/nfsd/Kconfig +1 −0
  663. fs/nfsd/filecache.c +2 −0
  664. fs/nfsd/nfs4callback.c +1 −0
  665. fs/nfsd/nfs4proc.c +1 −1
  666. fs/nfsd/nfs4state.c +15 −40
  667. fs/nilfs2/segbuf.c +1 −1
  668. fs/pnode.h +1 −1
  669. fs/proc/task_mmu.c +0 −2
  670. fs/select.c +4 −6
  671. fs/squashfs/block.c +1 −1
  672. fs/squashfs/export.c +6 −2
  673. fs/squashfs/id.c +4 −2
  674. fs/squashfs/squashfs_fs.h +1 −0
  675. fs/squashfs/xattr_id.c +4 −2
  676. fs/xfs/xfs_inode.c +8 −6
  677. fs/xfs/xfs_itable.c +6 −0
  678. fs/xfs/xfs_mount.c +44 −46
  679. fs/xfs/xfs_symlink.c +2 −1
  680. fs/zonefs/super.c +88 −15
  681. include/drm/ttm/ttm_bo_api.h +4 −2
  682. include/kvm/arm_pmu.h +7 −2
  683. include/linux/amba/bus.h +11 −0
  684. include/linux/bio.h +2 −2
  685. include/linux/bpf.h +25 −8
  686. include/linux/compiler-clang.h +6 −0
  687. include/linux/compiler-version.h +14 −0
  688. include/linux/cpu.h +3 −0
  689. include/linux/efi.h +4 −2
  690. include/linux/hugetlb_cgroup.h +13 −2
  691. include/linux/if_macvlan.h +2 −1
  692. include/linux/io_uring.h +0 −25
  693. include/linux/irqdomain.h +0 −4
  694. include/linux/kconfig.h +0 −2
  695. include/linux/memblock.h +2 −2
  696. include/linux/memcontrol.h +2 −4
  697. include/linux/mlx5/qp.h +7 −0
  698. include/linux/mm.h +36 −3
  699. include/linux/mm_types.h +1 −0
  700. include/linux/mmu_notifier.h +5 −5
  701. include/linux/module.h +0 −3
  702. include/linux/netdevice.h +2 −0
  703. include/linux/netfilter/x_tables.h +2 −5
  704. include/linux/pagemap.h +1 −1
  705. include/linux/perf_event.h +2 −0
  706. include/linux/pgtable.h +4 −0
  707. include/linux/property.h +1 −1
  708. include/linux/regulator/pca9450.h +3 −0
  709. include/linux/restart_block.h +1 −0
  710. include/linux/sched/mm.h +2 −1
  711. include/linux/seqlock.h +1 −4
  712. include/linux/skbuff.h +1 −0
  713. include/linux/stop_machine.h +6 −5
  714. include/linux/sunrpc/svc_rdma.h +0 −1
  715. include/linux/thread_info.h +13 −0
  716. include/linux/u64_stats_sync.h +4 −3
  717. include/linux/usb.h +2 −0
  718. include/linux/usb_usual.h +2 −0
  719. include/linux/usermode_driver.h +1 −0
  720. include/linux/vdpa.h +5 −5
  721. include/linux/virtio.h +0 −2
  722. include/linux/ww_mutex.h +3 −2
  723. include/media/rc-map.h +7 −0
  724. include/net/dst.h +11 −0
  725. include/net/inet_connection_sock.h +1 −1
  726. include/net/netfilter/nf_tables.h +3 −0
  727. include/net/nexthop.h +24 −0
  728. include/net/red.h +10 −2
  729. include/net/rtnetlink.h +2 −0
  730. include/net/sock.h +1 −1
  731. include/trace/events/workqueue.h +3 −3
  732. include/uapi/linux/bpf.h +11 −5
  733. include/uapi/linux/fuse.h +2 −1
  734. include/uapi/linux/psample.h +1 −4
  735. include/xen/grant_table.h +7 −0
  736. include/xen/xenbus.h +0 −1
  737. init/Kconfig +5 −6
  738. kernel/bpf/bpf_inode_storage.c +1 −1
  739. kernel/bpf/bpf_struct_ops.c +1 −1
  740. kernel/bpf/core.c +2 −2
  741. kernel/bpf/preload/bpf_preload_kern.c +15 −4
  742. kernel/bpf/syscall.c +5 −0
  743. kernel/bpf/trampoline.c +168 −50
  744. kernel/bpf/verifier.c +25 −12
  745. kernel/events/core.c +38 −4
  746. kernel/fork.c +8 −0
  747. kernel/freezer.c +1 −1
  748. kernel/futex.c +1 −2
  749. kernel/gcov/clang.c +69 −0
  750. kernel/irq/irq_sim.c +2 −2
  751. kernel/irq/irqdomain.c +4 −5
  752. kernel/irq/manage.c +4 −0
  753. kernel/jump_label.c +8 −0
  754. kernel/locking/mutex.c +14 −11
  755. kernel/reboot.c +0 −2
  756. kernel/sched/core.c +62 −64
  757. kernel/sched/membarrier.c +1 −3
  758. kernel/signal.c +5 −1
  759. kernel/static_call.c +27 −20
  760. kernel/sys.c +1 −1
  761. kernel/time/alarmtimer.c +1 −1
  762. kernel/time/hrtimer.c +40 −22
  763. kernel/time/posix-cpu-timers.c +1 −1
  764. kernel/trace/ftrace.c +38 −5
  765. kernel/usermode_driver.c +15 −6
  766. lib/Kconfig.kasan +1 −0
  767. lib/math/div64.c +1 −0
  768. mm/highmem.c +14 −7
  769. mm/huge_memory.c +3 −7
  770. mm/hugetlb.c +128 −36
  771. mm/hugetlb_cgroup.c +8 −2
  772. mm/internal.h +0 −5
  773. mm/kfence/core.c +9 −0
  774. mm/kfence/report.c +18 −12
  775. mm/kmemleak.c +2 −1
  776. mm/madvise.c +12 −1
  777. mm/memcontrol.c +6 −9
  778. mm/memory.c +9 −7
  779. mm/memory_hotplug.c +1 −1
  780. mm/mmu_notifier.c +23 −0
  781. mm/page-writeback.c +16 −0
  782. mm/page_alloc.c +82 −85
  783. mm/slab.c +1 −1
  784. mm/slub.c +1 −1
  785. mm/z3fold.c +15 −1
  786. net/batman-adv/main.c +0 −1
  787. net/bridge/br_switchdev.c +2 −0
  788. net/can/isotp.c +8 −10
  789. net/core/dev.c +31 −2
  790. net/core/drop_monitor.c +23 −0
  791. net/core/dst.c +42 −17
  792. net/core/filter.c +10 −2
  793. net/core/flow_dissector.c +1 −1
  794. net/core/sock.c +28 −16
  795. net/dccp/ipv6.c +5 −0
  796. net/dsa/dsa2.c +7 −4
  797. net/ipv4/inet_connection_sock.c +5 −2
  798. net/ipv4/ipconfig.c +8 −6
  799. net/ipv4/netfilter/arp_tables.c +8 −8
  800. net/ipv4/netfilter/ip_tables.c +8 −8
  801. net/ipv4/route.c +8 −37
  802. net/ipv4/tcp_minisocks.c +5 −2
  803. net/ipv6/ip6_fib.c +1 −1
  804. net/ipv6/ip6_input.c +0 −10
  805. net/ipv6/netfilter/ip6_tables.c +8 −8
  806. net/ipv6/route.c +9 −27
  807. net/ipv6/tcp_ipv6.c +5 −0
  808. net/mac80211/aead_api.c +3 −2
  809. net/mac80211/aes_gmac.c +3 −2
  810. net/mac80211/cfg.c +2 −2
  811. net/mac80211/ibss.c +2 −0
  812. net/mac80211/main.c +12 −1
  813. net/mac80211/mlme.c +1 −1
  814. net/mac80211/rc80211_minstrel_ht.c +0 −2
  815. net/mac80211/util.c +1 −1
  816. net/mptcp/options.c +14 −10
  817. net/mptcp/protocol.c +2 −2
  818. net/mptcp/subflow.c +5 −0
  819. net/netfilter/nf_conntrack_netlink.c +1 −0
  820. net/netfilter/nf_conntrack_proto_gre.c +0 −3
  821. net/netfilter/nf_flow_table_core.c +1 −1
  822. net/netfilter/nf_tables_api.c +21 −1
  823. net/netfilter/x_tables.c +34 −15
  824. net/openvswitch/conntrack.c +5 −3
  825. net/openvswitch/conntrack.h +4 −2
  826. net/openvswitch/flow.c +3 −1
  827. net/qrtr/qrtr.c +5 −0
  828. net/sched/act_ct.c +4 −2
  829. net/sched/cls_api.c +1 −0
  830. net/sched/cls_flower.c +1 −1
  831. net/sched/sch_choke.c +4 −3
  832. net/sched/sch_gred.c +1 −1
  833. net/sched/sch_htb.c +13 −6
  834. net/sched/sch_red.c +5 −2
  835. net/sched/sch_sfq.c +1 −1
  836. net/sctp/output.c +0 −7
  837. net/sctp/outqueue.c +7 −0
  838. net/sunrpc/auth_gss/svcauth_gss.c +7 −4
  839. net/sunrpc/sched.c +4 −1
  840. net/sunrpc/svc.c +4 −2
  841. net/sunrpc/svc_xprt.c +2 −2
  842. net/sunrpc/xprtrdma/svc_rdma_backchannel.c +3 −3
  843. net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +39 −43
  844. net/tipc/node.c +8 −3
  845. net/vmw_vsock/af_vsock.c +1 −0
  846. net/wireless/nl80211.c +8 −4
  847. scripts/Makefile.lib +2 −2
  848. scripts/dummy-tools/gcc +16 −2
  849. scripts/gcc-plugins/Makefile +1 −0
  850. scripts/ld-version.sh +14 −8
  851. security/commoncap.c +1 −11
  852. security/selinux/include/security.h +11 −4
  853. security/selinux/selinuxfs.c +9 −13
  854. security/selinux/ss/services.c +39 −24
  855. sound/drivers/aloop.c +0 −1
  856. sound/drivers/dummy.c +0 −1
  857. sound/drivers/mtpav.c +0 −1
  858. sound/drivers/mts64.c +0 −1
  859. sound/drivers/pcsp/pcsp.c +0 −1
  860. sound/drivers/portman2x4.c +0 −1
  861. sound/drivers/serial-u16550.c +0 −1
  862. sound/drivers/virmidi.c +0 −1
  863. sound/firewire/dice/dice-stream.c +2 −3
  864. sound/hda/intel-nhlt.c +5 −0
  865. sound/isa/ad1816a/ad1816a.c +0 −7
  866. sound/isa/ad1848/ad1848.c +0 −3
  867. sound/isa/als100.c +0 −11
  868. sound/isa/azt2320.c +0 −5
  869. sound/isa/cmi8330.c +0 −1
  870. sound/isa/cs423x/cs4231.c +0 −1
  871. sound/isa/cs423x/cs4236.c +0 −34
  872. sound/isa/es1688/es1688.c +0 −5
  873. sound/isa/es18xx.c +1 −9
  874. sound/isa/gus/gusclassic.c +0 −1
  875. sound/isa/gus/gusextreme.c +0 −1
  876. sound/isa/gus/gusmax.c +0 −1
  877. sound/isa/gus/interwave.c +0 −6
  878. sound/isa/opl3sa2.c +0 −5
  879. sound/isa/opti9xx/miro.c +0 −3
  880. sound/isa/opti9xx/opti92x-ad1848.c +0 −6
  881. sound/isa/sb/jazz16.c +0 −3
  882. sound/isa/sb/sb16.c +0 −8
  883. sound/isa/sb/sb8.c +0 −1
  884. sound/isa/sc6000.c +0 −3
  885. sound/isa/wavefront/wavefront.c +0 −1
  886. sound/mips/sgio2audio.c +0 −1
  887. sound/pci/ad1889.c +0 −1
  888. sound/pci/ali5451/ali5451.c +0 −1
  889. sound/pci/als300.c +0 −1
  890. sound/pci/als4000.c +0 −1
  891. sound/pci/atiixp.c +0 −1
  892. sound/pci/atiixp_modem.c +0 −1
  893. sound/pci/au88x0/au88x0.c +0 −2
  894. sound/pci/azt3328.c +0 −1
  895. sound/pci/bt87x.c +0 −2
  896. sound/pci/ca0106/ca0106_main.c +0 −1
  897. sound/pci/cmipci.c +0 −4
  898. sound/pci/cs4281.c +0 −1
  899. sound/pci/cs46xx/cs46xx.c +0 −7
  900. sound/pci/cs5535audio/cs5535audio.c +0 −1
  901. sound/pci/ctxfi/xfi.c +0 −1
  902. sound/pci/echoaudio/echoaudio.c +0 −1
  903. sound/pci/emu10k1/emu10k1.c +0 −2
  904. sound/pci/emu10k1/emu10k1x.c +0 −1
  905. sound/pci/ens1370.c +0 −8
  906. sound/pci/es1938.c +0 −4
  907. sound/pci/es1968.c +0 −4
  908. sound/pci/fm801.c +0 −2
  909. sound/pci/hda/hda_bind.c +4 −0
  910. sound/pci/hda/hda_controller.c +0 −7
  911. sound/pci/hda/hda_generic.c +1 −1
  912. sound/pci/hda/hda_intel.c +2 −34
  913. sound/pci/hda/patch_ca0132.c +1 −0
  914. sound/pci/hda/patch_conexant.c +45 −17
  915. sound/pci/hda/patch_hdmi.c +13 −0
  916. sound/pci/hda/patch_realtek.c +16 −0
  917. sound/pci/ice1712/ice1712.c +0 −6
  918. sound/pci/ice1712/ice1724.c +0 −19
  919. sound/pci/intel8x0.c +0 −23
  920. sound/pci/intel8x0m.c +0 −15
  921. sound/pci/korg1212/korg1212.c +0 −1
  922. sound/pci/lola/lola.c +0 −1
  923. sound/pci/lx6464es/lx6464es.c +0 −2
  924. sound/pci/maestro3.c +0 −5
  925. sound/pci/mixart/mixart.c +0 −1
  926. sound/pci/nm256/nm256.c +0 −2
  927. sound/pci/oxygen/oxygen.c +0 −3
  928. sound/pci/oxygen/se6x.c +0 −1
  929. sound/pci/oxygen/virtuoso.c +0 −1
  930. sound/pci/pcxhr/pcxhr.c +0 −1
  931. sound/pci/riptide/riptide.c +0 −1
  932. sound/pci/rme32.c +0 −1
  933. sound/pci/rme96.c +0 −5
  934. sound/pci/rme9652/hdsp.c +0 −3
  935. sound/pci/rme9652/hdspm.c +0 −1
  936. sound/pci/rme9652/rme9652.c +0 −2
  937. sound/pci/sis7019.c +0 −1
  938. sound/pci/sonicvibes.c +0 −1
  939. sound/pci/trident/trident.c +0 −12
  940. sound/pci/via82xx.c +0 −1
  941. sound/pci/via82xx_modem.c +0 −1
  942. sound/pci/vx222/vx222.c +0 −1
  943. sound/pci/ymfpci/ymfpci.c +0 −6
  944. sound/pcmcia/pdaudiocf/pdaudiocf.c +0 −1
  945. sound/pcmcia/vx/vxpocket.c +0 −4
  946. sound/ppc/powermac.c +0 −1
  947. sound/sh/aica.c +0 −1
  948. sound/sh/sh_dac_audio.c +0 −1
  949. sound/soc/codecs/Kconfig +0 −5
  950. sound/soc/codecs/ak4458.c +1 −0
  951. sound/soc/codecs/ak5558.c +1 −0
  952. sound/soc/codecs/cs42l42.c +34 −78
  953. sound/soc/codecs/cs42l42.h +7 −6
  954. sound/soc/codecs/es8316.c +2 −7
  955. sound/soc/codecs/lpass-rx-macro.c +1 −1
  956. sound/soc/codecs/lpass-va-macro.c +13 −15
  957. sound/soc/codecs/lpass-wsa-macro.c +11 −9
  958. sound/soc/codecs/rt1015.c +2 −0
  959. sound/soc/codecs/rt5640.c +2 −2
  960. sound/soc/codecs/rt5651.c +2 −2
  961. sound/soc/codecs/rt5659.c +5 −0
  962. sound/soc/codecs/rt5670.c +96 −14
  963. sound/soc/codecs/rt5670.h +5 −4
  964. sound/soc/codecs/rt711.c +8 −0
  965. sound/soc/codecs/sgtl5000.c +1 −1
  966. sound/soc/codecs/sirf-audio-codec.h +0 −124
  967. sound/soc/codecs/wcd934x.c +6 −0
  968. sound/soc/fsl/fsl_ssi.c +4 −2
  969. sound/soc/generic/simple-card-utils.c +7 −6
  970. sound/soc/intel/boards/bytcr_rt5640.c +1 −1
  971. sound/soc/mediatek/mt8192/mt8192-dai-tdm.c +3 −1
  972. sound/soc/mediatek/mt8192/mt8192-reg.h +5 −3
  973. sound/soc/qcom/lpass-cpu.c +1 −1
  974. sound/soc/qcom/sdm845.c +3 −3
  975. sound/soc/soc-core.c +4 −0
  976. sound/soc/sof/intel/hda-dsp.c +1 −1
  977. sound/soc/sof/intel/hda.c +1 −0
  978. sound/sparc/amd7930.c +0 −1
  979. sound/sparc/cs4231.c +0 −1
  980. sound/sparc/dbri.c +0 −1
  981. sound/usb/6fire/chip.c +0 −1
  982. sound/usb/caiaq/device.c +0 −14
  983. sound/usb/card.c +6 −2
  984. sound/usb/hiface/chip.c +0 −17
  985. sound/usb/misc/ua101.c +0 −1
  986. sound/usb/mixer_quirks.c +2 −2
  987. sound/usb/quirks.c +10 −1
  988. sound/usb/usbaudio.h +1 −0
  989. sound/usb/usx2y/usbusx2y.c +0 −1
  990. sound/x86/intel_hdmi_audio.c +0 −1
  991. sound/xen/xen_snd_front.c +0 −1
  992. tools/lib/bpf/Makefile +1 −1
  993. tools/lib/bpf/btf_dump.c +1 −1
  994. tools/lib/bpf/libbpf.c +2 −1
  995. tools/lib/bpf/netlink.c +1 −1
  996. tools/objtool/check.c +3 −0
  997. tools/testing/kunit/configs/broken_on_uml.config +2 −0
  998. tools/testing/kunit/kunit_config.py +1 −1
  999. tools/testing/selftests/arm64/fp/sve-ptrace.c +1 −1
  1000. tools/testing/selftests/arm64/fp/sve-test.S +17 −5
  1001. tools/testing/selftests/bpf/prog_tests/check_mtu.c +4 −0
  1002. tools/testing/selftests/bpf/prog_tests/fexit_sleep.c +82 −0
  1003. tools/testing/selftests/bpf/progs/btf_dump_test_case_syntax.c +8 −0
  1004. tools/testing/selftests/bpf/progs/fexit_sleep.c +31 −0
  1005. tools/testing/selftests/bpf/progs/test_check_mtu.c +92 −0
  1006. tools/testing/selftests/bpf/progs/test_tunnel_kern.c +2 −4
  1007. tools/testing/selftests/bpf/verifier/bounds_deduction.c +19 −8
  1008. tools/testing/selftests/bpf/verifier/map_ptr.c +4 −0
  1009. tools/testing/selftests/bpf/verifier/unpriv.c +14 −1
  1010. tools/testing/selftests/bpf/verifier/value_ptr_arith.c +22 −1
  1011. tools/testing/selftests/kvm/.gitignore +3 −0
  1012. tools/testing/selftests/kvm/Makefile +3 −0
  1013. tools/testing/selftests/kvm/include/kvm_util.h +2 −0
  1014. tools/testing/selftests/kvm/lib/kvm_util.c +6 −1
  1015. tools/testing/selftests/kvm/lib/kvm_util_internal.h +0 −2
  1016. tools/testing/selftests/kvm/x86_64/get_msr_index_features.c +134 −0
  1017. tools/testing/selftests/kvm/x86_64/hyperv_clock.c +260 −0
  1018. tools/testing/selftests/kvm/x86_64/set_boot_cpu_id.c +166 −0
  1019. tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh +1 −1
  1020. tools/testing/selftests/net/mptcp/mptcp_join.sh +20 −10
  1021. tools/testing/selftests/net/reuseaddr_ports_exhausted.c +16 −16
  1022. tools/testing/selftests/vm/Makefile +2 −2
.mailmap+3−0
@@ -36,6 +36,7 @@ Andrew Morton <akpm@linux-foundation.org> · 35 unmodified lines
3636 Andrew Murray <amurray@thegoodpenguin.co.uk> <amurray@embedded-bits.co.uk>
3737 Andrew Murray <amurray@thegoodpenguin.co.uk> <andrew.murray@arm.com>
3838 Andrew Vasquez <andrew.vasquez@qlogic.com>
39+Andrey Konovalov <andreyknvl@gmail.com> <andreyknvl@google.com>
3940 Andrey Ryabinin <ryabinin.a.a@gmail.com> <a.ryabinin@samsung.com>
4041 Andrey Ryabinin <ryabinin.a.a@gmail.com> <aryabinin@virtuozzo.com>
4142 Andy Adamson <andros@citi.umich.edu>
@@ -65,6 +66,8 @@ Changbin Du <changbin.du@intel.com> <changbin.du@gmail.com> · 23 unmodified lines
6566 Changbin Du <changbin.du@intel.com> <changbin.du@intel.com>
6667 Chao Yu <chao@kernel.org> <chao2.yu@samsung.com>
6768 Chao Yu <chao@kernel.org> <yuchao0@huawei.com>
69+Chris Chiu <chris.chiu@canonical.com> <chiu@endlessm.com>
70+Chris Chiu <chris.chiu@canonical.com> <chiu@endlessos.org>
6871 Christophe Ricard <christophe.ricard@gmail.com>
6972 Christoph Hellwig <hch@lst.de>
7073 Corey Minyard <minyard@acm.org>
Documentation/ABI/testing/sysfs-fs-xfs+1−1
@@ -33,7 +33,7 @@ Contact: xfs@oss.sgi.com · 32 unmodified lines
3333 Description:
3434 The current state of the log write grant head. It
3535 represents the total log reservation of all currently
36− oustanding transactions, including regrants due to
36+ outstanding transactions, including regrants due to
3737 rolling transactions. The grant head is exported in
3838 "cycle:bytes" format.
3939 Users: xfstests
Documentation/arm64/acpi_object_usage.rst+5−5
@@ -17,12 +17,12 @@ For ACPI on arm64, tables also fall into the following categories: · 16 unmodified lines
1717
1818 - Recommended: BERT, EINJ, ERST, HEST, PCCT, SSDT
1919
20− - Optional: BGRT, CPEP, CSRT, DBG2, DRTM, ECDT, FACS, FPDT, IORT,
21− MCHI, MPST, MSCT, NFIT, PMTT, RASF, SBST, SLIT, SPMI, SRAT, STAO,
22− TCPA, TPM2, UEFI, XENV
20+ - Optional: BGRT, CPEP, CSRT, DBG2, DRTM, ECDT, FACS, FPDT, IBFT,
21+ IORT, MCHI, MPST, MSCT, NFIT, PMTT, RASF, SBST, SLIT, SPMI, SRAT,
22+ STAO, TCPA, TPM2, UEFI, XENV
2323
24− - Not supported: BOOT, DBGP, DMAR, ETDT, HPET, IBFT, IVRS, LPIT,
25− MSDM, OEMx, PSDT, RSDT, SLIC, WAET, WDAT, WDRT, WPBT
24+ - Not supported: BOOT, DBGP, DMAR, ETDT, HPET, IVRS, LPIT, MSDM, OEMx,
25+ PSDT, RSDT, SLIC, WAET, WDAT, WDRT, WPBT
2626
2727 ====== ========================================================================
2828 Table Usage for ARMv8 Linux
Documentation/arm64/silicon-errata.rst+3−0
@@ -130,6 +130,9 @@ stable kernels. · 129 unmodified lines
130130 | Marvell | ARM-MMU-500 | #582743 | N/A |
131131 +----------------+-----------------+-----------------+-----------------------------+
132132 +----------------+-----------------+-----------------+-----------------------------+
133+| NVIDIA | Carmel Core | N/A | NVIDIA_CARMEL_CNP_ERRATUM |
134++----------------+-----------------+-----------------+-----------------------------+
135++----------------+-----------------+-----------------+-----------------------------+
133136 | Freescale/NXP | LS2080A/LS1043A | A-008585 | FSL_ERRATUM_A008585 |
134137 +----------------+-----------------+-----------------+-----------------------------+
135138 +----------------+-----------------+-----------------+-----------------------------+
Documentation/devicetree/bindings/interrupt-controller/ingenic,intc.yaml+1−0
@@ -23,6 +23,7 @@ properties: · 22 unmodified lines
2323 - enum:
2424 - ingenic,jz4775-intc
2525 - ingenic,jz4770-intc
26+ - ingenic,jz4760b-intc
2627 - const: ingenic,jz4760-intc
2728 - items:
2829 - const: ingenic,x1000-intc
Documentation/devicetree/bindings/sound/fsl,spdif.yaml+4−0
@@ -21,6 +21,10 @@ properties: · 20 unmodified lines
2121 - fsl,vf610-spdif
2222 - fsl,imx6sx-spdif
2323 - fsl,imx8qm-spdif
24+ - fsl,imx8qxp-spdif
25+ - fsl,imx8mq-spdif
26+ - fsl,imx8mm-spdif
27+ - fsl,imx8mn-spdif
2428
2529 reg:
2630 maxItems: 1
Documentation/gpu/todo.rst+21−0
@@ -613,6 +613,27 @@ Some of these date from the very introduction of KMS in 2008 ... · 612 unmodified lines
613613
614614 Level: Intermediate
615615
616+Remove automatic page mapping from dma-buf importing
617+----------------------------------------------------
618+
619+When importing dma-bufs, the dma-buf and PRIME frameworks automatically map
620+imported pages into the importer's DMA area. drm_gem_prime_fd_to_handle() and
621+drm_gem_prime_handle_to_fd() require that importers call dma_buf_attach()
622+even if they never do actual device DMA, but only CPU access through
623+dma_buf_vmap(). This is a problem for USB devices, which do not support DMA
624+operations.
625+
626+To fix the issue, automatic page mappings should be removed from the
627+buffer-sharing code. Fixing this is a bit more involved, since the import/export
628+cache is also tied to &drm_gem_object.import_attach. Meanwhile we paper over
629+this problem for USB devices by fishing out the USB host controller device, as
630+long as that supports DMA. Otherwise importing can still needlessly fail.
631+
632+Contact: Thomas Zimmermann <tzimmermann@suse.de>, Daniel Vetter
633+
634+Level: Advanced
635+
636+
616637 Better Testing
617638 ==============
618639
Documentation/networking/device_drivers/ethernet/amazon/ena.rst+1−1
@@ -267,7 +267,7 @@ DATA PATH · 266 unmodified lines
267267 Tx
268268 --
269269
270−end_start_xmit() is called by the stack. This function does the following:
270+ena_start_xmit() is called by the stack. This function does the following:
271271
272272 - Maps data buffers (skb->data and frags).
273273 - Populates ena_buf for the push buffer (if the driver and device are
Documentation/networking/devlink/devlink-dpipe.rst+1−1
@@ -52,7 +52,7 @@ purposes as a standard complementary tool. The system's view from · 51 unmodified lines
5252 ``devlink-dpipe`` should change according to the changes done by the
5353 standard configuration tools.
5454
55−For example, it’s quiet common to implement Access Control Lists (ACL)
55+For example, it’s quite common to implement Access Control Lists (ACL)
5656 using Ternary Content Addressable Memory (TCAM). The TCAM memory can be
5757 divided into TCAM regions. Complex TC filters can have multiple rules with
5858 different priorities and different lookup keys. On the other hand hardware
Documentation/networking/devlink/devlink-port.rst+2−2
@@ -151,7 +151,7 @@ representor netdevice. · 150 unmodified lines
151151 -------------
152152 A subfunction devlink port is created but it is not active yet. That means the
153153 entities are created on devlink side, the e-switch port representor is created,
154−but the subfunction device itself it not created. A user might use e-switch port
154+but the subfunction device itself is not created. A user might use e-switch port
155155 representor to do settings, putting it into bridge, adding TC rules, etc. A user
156156 might as well configure the hardware address (such as MAC address) of the
157157 subfunction while subfunction is inactive.
@@ -173,7 +173,7 @@ Terms and Definitions · 15 unmodified lines
173173 * - Term
174174 - Definitions
175175 * - ``PCI device``
176− - A physical PCI device having one or more PCI bus consists of one or
176+ - A physical PCI device having one or more PCI buses consists of one or
177177 more PCI controllers.
178178 * - ``PCI controller``
179179 - A controller consists of potentially multiple physical functions,
Documentation/networking/xfrm_device.rst+1−1
@@ -50,7 +50,7 @@ Callbacks to implement · 49 unmodified lines
5050
5151 The NIC driver offering ipsec offload will need to implement these
5252 callbacks to make the offload available to the network stack's
53−XFRM subsytem. Additionally, the feature bits NETIF_F_HW_ESP and
53+XFRM subsystem. Additionally, the feature bits NETIF_F_HW_ESP and
5454 NETIF_F_HW_ESP_TX_CSUM will signal the availability of the offload.
5555
5656
Documentation/virt/kvm/api.rst+9−3
@@ -182,6 +182,9 @@ is dependent on the CPU capability and the kernel configuration. The limit can · 181 unmodified lines
182182 be retrieved using KVM_CAP_ARM_VM_IPA_SIZE of the KVM_CHECK_EXTENSION
183183 ioctl() at run-time.
184184
185+Creation of the VM will fail if the requested IPA size (whether it is
186+implicit or explicit) is unsupported on the host.
187+
185188 Please note that configuring the IPA size does not affect the capability
186189 exposed by the guest CPUs in ID_AA64MMFR0_EL1[PARange]. It only affects
187190 size of the address translated by the stage2 level (guest physical to
@@ -1492,7 +1495,8 @@ Fails if any VCPU has already been created. · 1304 unmodified lines
14921495
14931496 Define which vcpu is the Bootstrap Processor (BSP). Values are the same
14941497 as the vcpu id in KVM_CREATE_VCPU. If this ioctl is not called, the default
1495−is vcpu 0.
1498+is vcpu 0. This ioctl has to be called before vcpu creation,
1499+otherwise it will return EBUSY error.
14961500
14971501
14981502 4.42 KVM_GET_XSAVE
@@ -4803,8 +4807,10 @@ If an MSR access is not permitted through the filtering, it generates a · 3304 unmodified lines
48034807 allows user space to deflect and potentially handle various MSR accesses
48044808 into user space.
48054809
4806−If a vCPU is in running state while this ioctl is invoked, the vCPU may
4807−experience inconsistent filtering behavior on MSR accesses.
4810+Note, invoking this ioctl with a vCPU is running is inherently racy. However,
4811+KVM does guarantee that vCPUs will see either the previous filter or the new
4812+filter, e.g. MSRs with identical settings in both the old and new filter will
4813+have deterministic behavior.
48084814
48094815 4.127 KVM_XEN_HVM_SET_ATTR
48104816 --------------------------
MAINTAINERS+14−16
@@ -261,8 +261,8 @@ ABI/API · 260 unmodified lines
261261 L: linux-api@vger.kernel.org
262262 F: include/linux/syscalls.h
263263 F: kernel/sys_ni.c
264−F: include/uapi/
265−F: arch/*/include/uapi/
264+X: include/uapi/
265+X: arch/*/include/uapi/
266266
267267 ABIT UGURU 1,2 HARDWARE MONITOR DRIVER
268268 M: Hans de Goede <hdegoede@redhat.com>
@@ -1181,7 +1181,7 @@ M: Joel Fernandes <joel@joelfernandes.org> · 912 unmodified lines
11811181 M: Christian Brauner <christian@brauner.io>
11821182 M: Hridya Valsaraju <hridya@google.com>
11831183 M: Suren Baghdasaryan <surenb@google.com>
1184−L: devel@driverdev.osuosl.org
1184+L: linux-kernel@vger.kernel.org
11851185 S: Supported
11861186 T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
11871187 F: drivers/android/
@@ -5839,7 +5839,7 @@ M: David Airlie <airlied@linux.ie> · 4651 unmodified lines
58395839 M: Daniel Vetter <daniel@ffwll.ch>
58405840 L: dri-devel@lists.freedesktop.org
58415841 S: Maintained
5842−B: https://bugs.freedesktop.org/
5842+B: https://gitlab.freedesktop.org/drm
58435843 C: irc://chat.freenode.net/dri-devel
58445844 T: git git://anongit.freedesktop.org/drm/drm
58455845 F: Documentation/devicetree/bindings/display/
@@ -8120,7 +8120,6 @@ F: drivers/crypto/hisilicon/sec2/sec_main.c · 2274 unmodified lines
81208120
81218121 HISILICON STAGING DRIVERS FOR HIKEY 960/970
81228122 M: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
8123−L: devel@driverdev.osuosl.org
81248123 S: Maintained
81258124 F: drivers/staging/hikey9xx/
81268125
@@ -8525,6 +8524,7 @@ IBM Power SRIOV Virtual NIC Device Driver · 398 unmodified lines
85258524 M: Dany Madden <drt@linux.ibm.com>
85268525 M: Lijun Pan <ljp@linux.ibm.com>
85278526 M: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
8527+R: Thomas Falcon <tlfalcon@linux.ibm.com>
85288528 L: netdev@vger.kernel.org
85298529 S: Supported
85308530 F: drivers/net/ethernet/ibm/ibmvnic.*
@@ -12542,7 +12542,7 @@ NETWORKING [MPTCP] · 4011 unmodified lines
1254212542 M: Mat Martineau <mathew.j.martineau@linux.intel.com>
1254312543 M: Matthieu Baerts <matthieu.baerts@tessares.net>
1254412544 L: netdev@vger.kernel.org
12545−L: mptcp@lists.01.org
12545+L: mptcp@lists.linux.dev
1254612546 S: Maintained
1254712547 W: https://github.com/multipath-tcp/mptcp_net-next/wiki
1254812548 B: https://github.com/multipath-tcp/mptcp_net-next/issues
@@ -14713,15 +14713,11 @@ F: drivers/net/ethernet/qlogic/qlcnic/ · 2164 unmodified lines
1471314713 QLOGIC QLGE 10Gb ETHERNET DRIVER
1471414714 M: Manish Chopra <manishc@marvell.com>
1471514715 M: GR-Linux-NIC-Dev@marvell.com
14716−L: netdev@vger.kernel.org
14717−S: Supported
14718−F: drivers/staging/qlge/
14719−
14720−QLOGIC QLGE 10Gb ETHERNET DRIVER
1472114716 M: Coiby Xu <coiby.xu@gmail.com>
1472214717 L: netdev@vger.kernel.org
14723−S: Maintained
14718+S: Supported
1472414719 F: Documentation/networking/device_drivers/qlogic/qlge.rst
14720+F: drivers/staging/qlge/
1472514721
1472614722 QM1D1B0004 MEDIA DRIVER
1472714723 M: Akihiro Tsukada <tskd08@gmail.com>
@@ -16891,8 +16887,10 @@ F: tools/spi/ · 2163 unmodified lines
1689116887
1689216888 SPIDERNET NETWORK DRIVER for CELL
1689316889 M: Ishizaki Kou <kou.ishizaki@toshiba.co.jp>
16890+M: Geoff Levand <geoff@infradead.org>
1689416891 L: netdev@vger.kernel.org
16895−S: Supported
16892+L: linuxppc-dev@lists.ozlabs.org
16893+S: Maintained
1689616894 F: Documentation/networking/device_drivers/ethernet/toshiba/spider_net.rst
1689716895 F: drivers/net/ethernet/toshiba/spider_net*
1689816896
@@ -17044,7 +17042,7 @@ F: drivers/staging/vt665?/ · 145 unmodified lines
1704417042
1704517043 STAGING SUBSYSTEM
1704617044 M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
17047−L: devel@driverdev.osuosl.org
17045+L: linux-staging@lists.linux.dev
1704817046 S: Supported
1704917047 T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
1705017048 F: drivers/staging/
@@ -19139,7 +19137,7 @@ VME SUBSYSTEM · 2088 unmodified lines
1913919137 M: Martyn Welch <martyn@welchs.me.uk>
1914019138 M: Manohar Vanga <manohar.vanga@gmail.com>
1914119139 M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19142−L: devel@driverdev.osuosl.org
19140+L: linux-kernel@vger.kernel.org
1914319141 S: Maintained
1914419142 T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
1914519143 F: Documentation/driver-api/vme.rst
@@ -19170,7 +19168,7 @@ S: Maintained · 24 unmodified lines
1917019168 F: drivers/infiniband/hw/vmw_pvrdma/
1917119169
1917219170 VMware PVSCSI driver
19173−M: Jim Gill <jgill@vmware.com>
19171+M: Vishal Bhakta <vbhakta@vmware.com>
1917419172 M: VMware PV-Drivers <pv-drivers@vmware.com>
1917519173 L: linux-scsi@vger.kernel.org
1917619174 S: Maintained
Makefile+4−2
@@ -2,7 +2,7 @@ · 1 unmodified line
22 VERSION = 5
33 PATCHLEVEL = 12
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc2
5+EXTRAVERSION = -rc4
66 NAME = Frozen Wasteland
77
88 # *DOCUMENTATION*
@@ -264,7 +264,8 @@ no-dot-config-targets := $(clean-targets) \ · 255 unmodified lines
264264 $(version_h) headers headers_% archheaders archscripts \
265265 %asm-generic kernelversion %src-pkg dt_binding_check \
266266 outputmakefile
267−no-sync-config-targets := $(no-dot-config-targets) %install kernelrelease
267+no-sync-config-targets := $(no-dot-config-targets) %install kernelrelease \
268+ image_name
268269 single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.s %.symtypes %/
269270
270271 config-build :=
@@ -478,6 +479,7 @@ USERINCLUDE := \ · 207 unmodified lines
478479 -I$(objtree)/arch/$(SRCARCH)/include/generated/uapi \
479480 -I$(srctree)/include/uapi \
480481 -I$(objtree)/include/generated/uapi \
482+ -include $(srctree)/include/linux/compiler-version.h \
481483 -include $(srctree)/include/linux/kconfig.h
482484
483485 # Use LINUXINCLUDE when you must reference the include/ directory.
arch/Kconfig+1−2
@@ -632,13 +632,12 @@ config HAS_LTO_CLANG · 631 unmodified lines
632632 def_bool y
633633 # Clang >= 11: https://github.com/ClangBuiltLinux/linux/issues/510
634634 depends on CC_IS_CLANG && CLANG_VERSION >= 110000 && LD_IS_LLD
635− depends on $(success,test $(LLVM) -eq 1)
636635 depends on $(success,test $(LLVM_IAS) -eq 1)
637636 depends on $(success,$(NM) --help | head -n 1 | grep -qi llvm)
638637 depends on $(success,$(AR) --help | head -n 1 | grep -qi llvm)
639638 depends on ARCH_SUPPORTS_LTO_CLANG
640639 depends on !FTRACE_MCOUNT_USE_RECORDMCOUNT
641− depends on !KASAN
640+ depends on !KASAN || KASAN_HW_TAGS
642641 depends on !GCOV_KERNEL
643642 help
644643 The compiler and Kconfig options support building with Clang's
arch/arm/Kconfig+1−0
@@ -348,6 +348,7 @@ config ARCH_EP93XX · 347 unmodified lines
348348 select ARM_AMBA
349349 imply ARM_PATCH_PHYS_VIRT
350350 select ARM_VIC
351+ select GENERIC_IRQ_MULTI_HANDLER
351352 select AUTO_ZRELADDR
352353 select CLKDEV_LOOKUP
353354 select CLKSRC_MMIO
arch/arm/xen/p2m.c+2−3
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111
1212 #include <xen/xen.h>
1313 #include <xen/interface/memory.h>
14+#include <xen/grant_table.h>
1415 #include <xen/page.h>
1516 #include <xen/swiotlb-xen.h>
1617
@@ -109,7 +110,7 @@ int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops, · 92 unmodified lines
109110 map_ops[i].status = GNTST_general_error;
110111 unmap.host_addr = map_ops[i].host_addr,
111112 unmap.handle = map_ops[i].handle;
112− map_ops[i].handle = ~0;
113+ map_ops[i].handle = INVALID_GRANT_HANDLE;
113114 if (map_ops[i].flags & GNTMAP_device_map)
114115 unmap.dev_bus_addr = map_ops[i].dev_bus_addr;
115116 else
@@ -130,7 +131,6 @@ int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops, · 14 unmodified lines
130131
131132 return 0;
132133 }
133−EXPORT_SYMBOL_GPL(set_foreign_p2m_mapping);
134134
135135 int clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref *unmap_ops,
136136 struct gnttab_unmap_grant_ref *kunmap_ops,
@@ -145,7 +145,6 @@ int clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref *unmap_ops, · 8 unmodified lines
145145
146146 return 0;
147147 }
148−EXPORT_SYMBOL_GPL(clear_foreign_p2m_mapping);
149148
150149 bool __set_phys_to_machine_multi(unsigned long pfn,
151150 unsigned long mfn, unsigned long nr_pages)
arch/arm64/Kconfig+12−10
@@ -810,6 +810,16 @@ config QCOM_FALKOR_ERRATUM_E1041 · 809 unmodified lines
810810
811811 If unsure, say Y.
812812
813+config NVIDIA_CARMEL_CNP_ERRATUM
814+ bool "NVIDIA Carmel CNP: CNP on Carmel semantically different than ARM cores"
815+ default y
816+ help
817+ If CNP is enabled on Carmel cores, non-sharable TLBIs on a core will not
818+ invalidate shared TLB entries installed by a different core, as it would
819+ on standard ARM cores.
820+
821+ If unsure, say Y.
822+
813823 config SOCIONEXT_SYNQUACER_PREITS
814824 bool "Socionext Synquacer: Workaround for GICv3 pre-ITS"
815825 default y
@@ -1055,8 +1065,6 @@ config HW_PERF_EVENTS · 239 unmodified lines
10551065 config SYS_SUPPORTS_HUGETLBFS
10561066 def_bool y
10571067
1058−config ARCH_WANT_HUGE_PMD_SHARE
1059−
10601068 config ARCH_HAS_CACHE_LINE_SIZE
10611069 def_bool y
10621070
@@ -1157,8 +1165,8 @@ config XEN · 94 unmodified lines
11571165
11581166 config FORCE_MAX_ZONEORDER
11591167 int
1160− default "14" if (ARM64_64K_PAGES && TRANSPARENT_HUGEPAGE)
1161− default "12" if (ARM64_16K_PAGES && TRANSPARENT_HUGEPAGE)
1168+ default "14" if ARM64_64K_PAGES
1169+ default "12" if ARM64_16K_PAGES
11621170 default "11"
11631171 help
11641172 The kernel memory allocator divides physically contiguous memory
@@ -1855,12 +1863,6 @@ config CMDLINE_FROM_BOOTLOADER · 690 unmodified lines
18551863 the boot loader doesn't provide any, the default kernel command
18561864 string provided in CMDLINE will be used.
18571865
1858−config CMDLINE_EXTEND
1859− bool "Extend bootloader kernel arguments"
1860− help
1861− The command-line arguments provided by the boot loader will be
1862− appended to the default kernel command string.
1863−
18641866 config CMDLINE_FORCE
18651867 bool "Always use the default kernel command string"
18661868 help
arch/arm64/include/asm/checksum.h+1−1
@@ -37,7 +37,7 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl) · 36 unmodified lines
3737 } while (--n > 0);
3838
3939 sum += ((sum >> 32) | (sum << 32));
40− return csum_fold((__force u32)(sum >> 32));
40+ return csum_fold((__force __wsum)(sum >> 32));
4141 }
4242 #define ip_fast_csum ip_fast_csum
4343
arch/arm64/include/asm/cpucaps.h+2−1
@@ -66,7 +66,8 @@ · 65 unmodified lines
6666 #define ARM64_WORKAROUND_1508412 58
6767 #define ARM64_HAS_LDAPR 59
6868 #define ARM64_KVM_PROTECTED_MODE 60
69+#define ARM64_WORKAROUND_NVIDIA_CARMEL_CNP 61
6970
70−#define ARM64_NCAPS 61
71+#define ARM64_NCAPS 62
7172
7273 #endif /* __ASM_CPUCAPS_H */
arch/arm64/include/asm/kvm_asm.h+4−4
@@ -47,10 +47,10 @@ · 46 unmodified lines
4747 #define __KVM_HOST_SMCCC_FUNC___kvm_flush_vm_context 2
4848 #define __KVM_HOST_SMCCC_FUNC___kvm_tlb_flush_vmid_ipa 3
4949 #define __KVM_HOST_SMCCC_FUNC___kvm_tlb_flush_vmid 4
50−#define __KVM_HOST_SMCCC_FUNC___kvm_tlb_flush_local_vmid 5
50+#define __KVM_HOST_SMCCC_FUNC___kvm_flush_cpu_context 5
5151 #define __KVM_HOST_SMCCC_FUNC___kvm_timer_set_cntvoff 6
5252 #define __KVM_HOST_SMCCC_FUNC___kvm_enable_ssbs 7
53−#define __KVM_HOST_SMCCC_FUNC___vgic_v3_get_ich_vtr_el2 8
53+#define __KVM_HOST_SMCCC_FUNC___vgic_v3_get_gic_config 8
5454 #define __KVM_HOST_SMCCC_FUNC___vgic_v3_read_vmcr 9
5555 #define __KVM_HOST_SMCCC_FUNC___vgic_v3_write_vmcr 10
5656 #define __KVM_HOST_SMCCC_FUNC___vgic_v3_init_lrs 11
@@ -183,16 +183,16 @@ DECLARE_KVM_HYP_SYM(__bp_harden_hyp_vecs); · 126 unmodified lines
183183 #define __bp_harden_hyp_vecs CHOOSE_HYP_SYM(__bp_harden_hyp_vecs)
184184
185185 extern void __kvm_flush_vm_context(void);
186+extern void __kvm_flush_cpu_context(struct kvm_s2_mmu *mmu);
186187 extern void __kvm_tlb_flush_vmid_ipa(struct kvm_s2_mmu *mmu, phys_addr_t ipa,
187188 int level);
188189 extern void __kvm_tlb_flush_vmid(struct kvm_s2_mmu *mmu);
189−extern void __kvm_tlb_flush_local_vmid(struct kvm_s2_mmu *mmu);
190190
191191 extern void __kvm_timer_set_cntvoff(u64 cntvoff);
192192
193193 extern int __kvm_vcpu_run(struct kvm_vcpu *vcpu);
194194
195−extern u64 __vgic_v3_get_ich_vtr_el2(void);
195+extern u64 __vgic_v3_get_gic_config(void);
196196 extern u64 __vgic_v3_read_vmcr(void);
197197 extern void __vgic_v3_write_vmcr(u32 vmcr);
198198 extern void __vgic_v3_init_lrs(void);
arch/arm64/include/asm/kvm_hyp.h+7−1
@@ -83,6 +83,11 @@ void sysreg_restore_guest_state_vhe(struct kvm_cpu_context *ctxt); · 82 unmodified lines
8383 void __debug_switch_to_guest(struct kvm_vcpu *vcpu);
8484 void __debug_switch_to_host(struct kvm_vcpu *vcpu);
8585
86+#ifdef __KVM_NVHE_HYPERVISOR__
87+void __debug_save_host_buffers_nvhe(struct kvm_vcpu *vcpu);
88+void __debug_restore_host_buffers_nvhe(struct kvm_vcpu *vcpu);
89+#endif
90+
8691 void __fpsimd_save_state(struct user_fpsimd_state *fp_regs);
8792 void __fpsimd_restore_state(struct user_fpsimd_state *fp_regs);
8893
@@ -97,7 +102,8 @@ bool kvm_host_psci_handler(struct kvm_cpu_context *host_ctxt); · 8 unmodified lines
97102
98103 void __noreturn hyp_panic(void);
99104 #ifdef __KVM_NVHE_HYPERVISOR__
100−void __noreturn __hyp_do_panic(bool restore_host, u64 spsr, u64 elr, u64 par);
105+void __noreturn __hyp_do_panic(struct kvm_cpu_context *host_ctxt, u64 spsr,
106+ u64 elr, u64 par);
101107 #endif
102108
103109 #endif /* __ARM64_KVM_HYP_H__ */
arch/arm64/include/asm/memory.h+5−0
@@ -328,6 +328,11 @@ static inline void *phys_to_virt(phys_addr_t x) · 327 unmodified lines
328328 #define ARCH_PFN_OFFSET ((unsigned long)PHYS_PFN_OFFSET)
329329
330330 #if !defined(CONFIG_SPARSEMEM_VMEMMAP) || defined(CONFIG_DEBUG_VIRTUAL)
331+#define page_to_virt(x) ({ \
332+ __typeof__(x) __page = x; \
333+ void *__addr = __va(page_to_phys(__page)); \
334+ (void *)__tag_set((const void *)__addr, page_kasan_tag(__page));\
335+})
331336 #define virt_to_page(x) pfn_to_page(virt_to_pfn(x))
332337 #else
333338 #define page_to_virt(x) ({ \
arch/arm64/include/asm/mmu_context.h+0−17
@@ -63,23 +63,6 @@ static inline void cpu_switch_mm(pgd_t *pgd, struct mm_struct *mm) · 62 unmodified lines
6363 extern u64 idmap_t0sz;
6464 extern u64 idmap_ptrs_per_pgd;
6565
66−static inline bool __cpu_uses_extended_idmap(void)
67−{
68− if (IS_ENABLED(CONFIG_ARM64_VA_BITS_52))
69− return false;
70−
71− return unlikely(idmap_t0sz != TCR_T0SZ(VA_BITS));
72−}
73−
74−/*
75− * True if the extended ID map requires an extra level of translation table
76− * to be configured.
77− */
78−static inline bool __cpu_uses_extended_idmap_level(void)
79−{
80− return ARM64_HW_PGTABLE_LEVELS(64 - idmap_t0sz) > CONFIG_PGTABLE_LEVELS;
81−}
82−
8366 /*
8467 * Ensure TCR.T0SZ is set to the provided value.
8568 */
arch/arm64/include/asm/pgtable-prot.h+0−1
@@ -66,7 +66,6 @@ extern bool arm64_use_ng_mappings; · 65 unmodified lines
6666 #define _PAGE_DEFAULT (_PROT_DEFAULT | PTE_ATTRINDX(MT_NORMAL))
6767
6868 #define PAGE_KERNEL __pgprot(PROT_NORMAL)
69−#define PAGE_KERNEL_TAGGED __pgprot(PROT_NORMAL_TAGGED)
7069 #define PAGE_KERNEL_RO __pgprot((PROT_NORMAL & ~PTE_WRITE) | PTE_RDONLY)
7170 #define PAGE_KERNEL_ROX __pgprot((PROT_NORMAL & ~(PTE_WRITE | PTE_PXN)) | PTE_RDONLY)
7271 #define PAGE_KERNEL_EXEC __pgprot(PROT_NORMAL & ~PTE_PXN)
arch/arm64/include/asm/pgtable.h+3−0
@@ -486,6 +486,9 @@ static inline pmd_t pmd_mkdevmap(pmd_t pmd) · 485 unmodified lines
486486 __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_NC) | PTE_PXN | PTE_UXN)
487487 #define pgprot_device(prot) \
488488 __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_DEVICE_nGnRE) | PTE_PXN | PTE_UXN)
489+#define pgprot_tagged(prot) \
490+ __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_TAGGED))
491+#define pgprot_mhp pgprot_tagged
489492 /*
490493 * DMA allocations for non-coherent devices use what the Arm architecture calls
491494 * "Normal non-cacheable" memory, which permits speculation, unaligned accesses
arch/arm64/include/asm/processor.h+2−0
@@ -251,6 +251,8 @@ unsigned long get_wchan(struct task_struct *p); · 250 unmodified lines
251251 extern struct task_struct *cpu_switch_to(struct task_struct *prev,
252252 struct task_struct *next);
253253
254+asmlinkage void arm64_preempt_schedule_irq(void);
255+
254256 #define task_pt_regs(p) \
255257 ((struct pt_regs *)(THREAD_SIZE + task_stack_page(p)) - 1)
256258
arch/arm64/include/asm/sysreg.h+14−6
@@ -796,6 +796,11 @@ · 795 unmodified lines
796796 #define ID_AA64MMFR0_PARANGE_48 0x5
797797 #define ID_AA64MMFR0_PARANGE_52 0x6
798798
799+#define ID_AA64MMFR0_TGRAN_2_SUPPORTED_DEFAULT 0x0
800+#define ID_AA64MMFR0_TGRAN_2_SUPPORTED_NONE 0x1
801+#define ID_AA64MMFR0_TGRAN_2_SUPPORTED_MIN 0x2
802+#define ID_AA64MMFR0_TGRAN_2_SUPPORTED_MAX 0x7
803+
799804 #ifdef CONFIG_ARM64_PA_BITS_52
800805 #define ID_AA64MMFR0_PARANGE_MAX ID_AA64MMFR0_PARANGE_52
801806 #else
@@ -961,14 +966,17 @@ · 159 unmodified lines
961966 #define ID_PFR1_PROGMOD_SHIFT 0
962967
963968 #if defined(CONFIG_ARM64_4K_PAGES)
964−#define ID_AA64MMFR0_TGRAN_SHIFT ID_AA64MMFR0_TGRAN4_SHIFT
965−#define ID_AA64MMFR0_TGRAN_SUPPORTED ID_AA64MMFR0_TGRAN4_SUPPORTED
969+#define ID_AA64MMFR0_TGRAN_SHIFT ID_AA64MMFR0_TGRAN4_SHIFT
970+#define ID_AA64MMFR0_TGRAN_SUPPORTED_MIN ID_AA64MMFR0_TGRAN4_SUPPORTED
971+#define ID_AA64MMFR0_TGRAN_SUPPORTED_MAX 0x7
966972 #elif defined(CONFIG_ARM64_16K_PAGES)
967−#define ID_AA64MMFR0_TGRAN_SHIFT ID_AA64MMFR0_TGRAN16_SHIFT
968−#define ID_AA64MMFR0_TGRAN_SUPPORTED ID_AA64MMFR0_TGRAN16_SUPPORTED
973+#define ID_AA64MMFR0_TGRAN_SHIFT ID_AA64MMFR0_TGRAN16_SHIFT
974+#define ID_AA64MMFR0_TGRAN_SUPPORTED_MIN ID_AA64MMFR0_TGRAN16_SUPPORTED
975+#define ID_AA64MMFR0_TGRAN_SUPPORTED_MAX 0xF
969976 #elif defined(CONFIG_ARM64_64K_PAGES)
970−#define ID_AA64MMFR0_TGRAN_SHIFT ID_AA64MMFR0_TGRAN64_SHIFT
971−#define ID_AA64MMFR0_TGRAN_SUPPORTED ID_AA64MMFR0_TGRAN64_SUPPORTED
977+#define ID_AA64MMFR0_TGRAN_SHIFT ID_AA64MMFR0_TGRAN64_SHIFT
978+#define ID_AA64MMFR0_TGRAN_SUPPORTED_MIN ID_AA64MMFR0_TGRAN64_SUPPORTED
979+#define ID_AA64MMFR0_TGRAN_SUPPORTED_MAX 0x7
972980 #endif
973981
974982 #define MVFR2_FPMISC_SHIFT 4
arch/arm64/include/asm/thread_info.h+2−0
@@ -55,6 +55,8 @@ void arch_setup_new_exec(void); · 54 unmodified lines
5555 #define arch_setup_new_exec arch_setup_new_exec
5656
5757 void arch_release_task_struct(struct task_struct *tsk);
58+int arch_dup_task_struct(struct task_struct *dst,
59+ struct task_struct *src);
5860
5961 #endif
6062
arch/arm64/kernel/cpu_errata.c+8−0
@@ -525,6 +525,14 @@ const struct arm64_cpu_capabilities arm64_errata[] = { · 524 unmodified lines
525525 0, 0,
526526 1, 0),
527527 },
528+#endif
529+#ifdef CONFIG_NVIDIA_CARMEL_CNP_ERRATUM
530+ {
531+ /* NVIDIA Carmel */
532+ .desc = "NVIDIA Carmel CNP erratum",
533+ .capability = ARM64_WORKAROUND_NVIDIA_CARMEL_CNP,
534+ ERRATA_MIDR_ALL_VERSIONS(MIDR_NVIDIA_CARMEL),
535+ },
528536 #endif
529537 {
530538 }
arch/arm64/kernel/cpufeature.c+4−1
@@ -1321,7 +1321,10 @@ has_useable_cnp(const struct arm64_cpu_capabilities *entry, int scope) · 1320 unmodified lines
13211321 * may share TLB entries with a CPU stuck in the crashed
13221322 * kernel.
13231323 */
1324− if (is_kdump_kernel())
1324+ if (is_kdump_kernel())
1325+ return false;
1326+
1327+ if (cpus_have_const_cap(ARM64_WORKAROUND_NVIDIA_CARMEL_CNP))
13251328 return false;
13261329
13271330 return has_cpuid_feature(entry, scope);
arch/arm64/kernel/cpuinfo.c+1−1
@@ -353,7 +353,7 @@ static void __cpuinfo_store_cpu(struct cpuinfo_arm64 *info) · 352 unmodified lines
353353 * with the CLIDR_EL1 fields to avoid triggering false warnings
354354 * when there is a mismatch across the CPUs. Keep track of the
355355 * effective value of the CTR_EL0 in our internal records for
356− * acurate sanity check and feature enablement.
356+ * accurate sanity check and feature enablement.
357357 */
358358 info->reg_ctr = read_cpuid_effective_cachetype();
359359 info->reg_dczid = read_cpuid(DCZID_EL0);
arch/arm64/kernel/crash_dump.c+2−0
@@ -64,5 +64,7 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf, · 63 unmodified lines
6464 ssize_t elfcorehdr_read(char *buf, size_t count, u64 *ppos)
6565 {
6666 memcpy(buf, phys_to_virt((phys_addr_t)*ppos), count);
67+ *ppos += count;
68+
6769 return count;
6870 }
arch/arm64/kernel/head.S+5−3
@@ -319,7 +319,7 @@ SYM_FUNC_START_LOCAL(__create_page_tables) · 318 unmodified lines
319319 */
320320 adrp x5, __idmap_text_end
321321 clz x5, x5
322− cmp x5, TCR_T0SZ(VA_BITS) // default T0SZ small enough?
322+ cmp x5, TCR_T0SZ(VA_BITS_MIN) // default T0SZ small enough?
323323 b.ge 1f // .. then skip VA range extension
324324
325325 adr_l x6, idmap_t0sz
@@ -655,8 +655,10 @@ SYM_FUNC_END(__secondary_too_slow) · 329 unmodified lines
655655 SYM_FUNC_START(__enable_mmu)
656656 mrs x2, ID_AA64MMFR0_EL1
657657 ubfx x2, x2, #ID_AA64MMFR0_TGRAN_SHIFT, 4
658− cmp x2, #ID_AA64MMFR0_TGRAN_SUPPORTED
659− b.ne __no_granule_support
658+ cmp x2, #ID_AA64MMFR0_TGRAN_SUPPORTED_MIN
659+ b.lt __no_granule_support
660+ cmp x2, #ID_AA64MMFR0_TGRAN_SUPPORTED_MAX
661+ b.gt __no_granule_support
660662 update_early_cpu_boot_status 0, x2, x3
661663 adrp x2, idmap_pg_dir
662664 phys_to_ttbr x1, x1
arch/arm64/kernel/idreg-override.c+23−20
@@ -163,33 +163,36 @@ static __init void __parse_cmdline(const char *cmdline, bool parse_aliases) · 162 unmodified lines
163163 } while (1);
164164 }
165165
166−static __init void parse_cmdline(void)
166+static __init const u8 *get_bootargs_cmdline(void)
167167 {
168− if (!IS_ENABLED(CONFIG_CMDLINE_FORCE)) {
169− const u8 *prop;
170− void *fdt;
171− int node;
168+ const u8 *prop;
169+ void *fdt;
170+ int node;
172171
173− fdt = get_early_fdt_ptr();
174− if (!fdt)
175− goto out;
172+ fdt = get_early_fdt_ptr();
173+ if (!fdt)
174+ return NULL;
176175
177− node = fdt_path_offset(fdt, "/chosen");
178− if (node < 0)
179− goto out;
176+ node = fdt_path_offset(fdt, "/chosen");
177+ if (node < 0)
178+ return NULL;
180179
181− prop = fdt_getprop(fdt, node, "bootargs", NULL);
182− if (!prop)
183− goto out;
180+ prop = fdt_getprop(fdt, node, "bootargs", NULL);
181+ if (!prop)
182+ return NULL;
184183
185− __parse_cmdline(prop, true);
184+ return strlen(prop) ? prop : NULL;
185+}
186186
187− if (!IS_ENABLED(CONFIG_CMDLINE_EXTEND))
188− return;
189− }
187+static __init void parse_cmdline(void)
188+{
189+ const u8 *prop = get_bootargs_cmdline();
190190
191−out:
192− __parse_cmdline(CONFIG_CMDLINE, true);
191+ if (IS_ENABLED(CONFIG_CMDLINE_FORCE) || !prop)
192+ __parse_cmdline(CONFIG_CMDLINE, true);
193+
194+ if (!IS_ENABLED(CONFIG_CMDLINE_FORCE) && prop)
195+ __parse_cmdline(prop, true);
193196 }
194197
195198 /* Keep checkers quiet */
arch/arm64/kernel/image-vars.h+3−0
@@ -101,6 +101,9 @@ KVM_NVHE_ALIAS(__stop___kvm_ex_table); · 100 unmodified lines
101101 /* Array containing bases of nVHE per-CPU memory regions. */
102102 KVM_NVHE_ALIAS(kvm_arm_hyp_percpu_base);
103103
104+/* PMU available static key */
105+KVM_NVHE_ALIAS(kvm_arm_pmu_available);
106+
104107 #endif /* CONFIG_KVM */
105108
106109 #endif /* __ARM64_KERNEL_IMAGE_VARS_H */
arch/arm64/kernel/perf_event.c+1−1
@@ -460,7 +460,7 @@ static inline int armv8pmu_counter_has_overflowed(u32 pmnc, int idx) · 459 unmodified lines
460460 return pmnc & BIT(ARMV8_IDX_TO_COUNTER(idx));
461461 }
462462
463−static inline u32 armv8pmu_read_evcntr(int idx)
463+static inline u64 armv8pmu_read_evcntr(int idx)
464464 {
465465 u32 counter = ARMV8_IDX_TO_COUNTER(idx);
466466
arch/arm64/kernel/process.c+2−0
@@ -57,6 +57,8 @@ · 56 unmodified lines
5757 #include <asm/processor.h>
5858 #include <asm/pointer_auth.h>
5959 #include <asm/stacktrace.h>
60+#include <asm/switch_to.h>
61+#include <asm/system_misc.h>
6062
6163 #if defined(CONFIG_STACKPROTECTOR) && !defined(CONFIG_STACKPROTECTOR_PER_TASK)
6264 #include <linux/stackprotector.h>
arch/arm64/kernel/stacktrace.c+5−4
@@ -194,8 +194,9 @@ void show_stack(struct task_struct *tsk, unsigned long *sp, const char *loglvl) · 193 unmodified lines
194194
195195 #ifdef CONFIG_STACKTRACE
196196
197−void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie,
198− struct task_struct *task, struct pt_regs *regs)
197+noinline void arch_stack_walk(stack_trace_consume_fn consume_entry,
198+ void *cookie, struct task_struct *task,
199+ struct pt_regs *regs)
199200 {
200201 struct stackframe frame;
201202
@@ -203,8 +204,8 @@ void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie, · 1 unmodified line
203204 start_backtrace(&frame, regs->regs[29], regs->pc);
204205 else if (task == current)
205206 start_backtrace(&frame,
206− (unsigned long)__builtin_frame_address(0),
207− (unsigned long)arch_stack_walk);
207+ (unsigned long)__builtin_frame_address(1),
208+ (unsigned long)__builtin_return_address(0));
208209 else
209210 start_backtrace(&frame, thread_saved_fp(task),
210211 thread_saved_pc(task));
arch/arm64/kvm/arm.c+6−1
@@ -385,11 +385,16 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) · 384 unmodified lines
385385 last_ran = this_cpu_ptr(mmu->last_vcpu_ran);
386386
387387 /*
388+ * We guarantee that both TLBs and I-cache are private to each
389+ * vcpu. If detecting that a vcpu from the same VM has
390+ * previously run on the same physical CPU, call into the
391+ * hypervisor code to nuke the relevant contexts.
392+ *
388393 * We might get preempted before the vCPU actually runs, but
389394 * over-invalidation doesn't affect correctness.
390395 */
391396 if (*last_ran != vcpu->vcpu_id) {
392− kvm_call_hyp(__kvm_tlb_flush_local_vmid, mmu);
397+ kvm_call_hyp(__kvm_flush_cpu_context, mmu);
393398 *last_ran = vcpu->vcpu_id;
394399 }
395400
arch/arm64/kvm/hyp/entry.S+5−3
@@ -85,8 +85,10 @@ SYM_INNER_LABEL(__guest_exit_panic, SYM_L_GLOBAL) · 84 unmodified lines
8585
8686 // If the hyp context is loaded, go straight to hyp_panic
8787 get_loaded_vcpu x0, x1
88− cbz x0, hyp_panic
88+ cbnz x0, 1f
89+ b hyp_panic
8990
91+1:
9092 // The hyp context is saved so make sure it is restored to allow
9193 // hyp_panic to run at hyp and, subsequently, panic to run in the host.
9294 // This makes use of __guest_exit to avoid duplication but sets the
@@ -94,7 +96,7 @@ SYM_INNER_LABEL(__guest_exit_panic, SYM_L_GLOBAL) · 1 unmodified line
9496 // current state is saved to the guest context but it will only be
9597 // accurate if the guest had been completely restored.
9698 adr_this_cpu x0, kvm_hyp_ctxt, x1
97− adr x1, hyp_panic
99+ adr_l x1, hyp_panic
98100 str x1, [x0, #CPU_XREG_OFFSET(30)]
99101
100102 get_vcpu_ptr x1, x0
@@ -146,7 +148,7 @@ SYM_INNER_LABEL(__guest_exit, SYM_L_GLOBAL) · 45 unmodified lines
146148 // Now restore the hyp regs
147149 restore_callee_saved_regs x2
148150
149− set_loaded_vcpu xzr, x1, x2
151+ set_loaded_vcpu xzr, x2, x3
150152
151153 alternative_if ARM64_HAS_RAS_EXTN
152154 // If we have the RAS extensions we can consume a pending error
arch/arm64/kvm/hyp/include/hyp/switch.h+6−3
@@ -90,15 +90,18 @@ static inline void __activate_traps_common(struct kvm_vcpu *vcpu) · 89 unmodified lines
9090 * counter, which could make a PMXEVCNTR_EL0 access UNDEF at
9191 * EL1 instead of being trapped to EL2.
9292 */
93− write_sysreg(0, pmselr_el0);
94− write_sysreg(ARMV8_PMU_USERENR_MASK, pmuserenr_el0);
93+ if (kvm_arm_support_pmu_v3()) {
94+ write_sysreg(0, pmselr_el0);
95+ write_sysreg(ARMV8_PMU_USERENR_MASK, pmuserenr_el0);
96+ }
9597 write_sysreg(vcpu->arch.mdcr_el2, mdcr_el2);
9698 }
9799
98100 static inline void __deactivate_traps_common(void)
99101 {
100102 write_sysreg(0, hstr_el2);
101− write_sysreg(0, pmuserenr_el0);
103+ if (kvm_arm_support_pmu_v3())
104+ write_sysreg(0, pmuserenr_el0);
102105 }
103106
104107 static inline void ___activate_traps(struct kvm_vcpu *vcpu)
arch/arm64/kvm/hyp/nvhe/debug-sr.c+10−2
@@ -58,16 +58,24 @@ static void __debug_restore_spe(u64 pmscr_el1) · 57 unmodified lines
5858 write_sysreg_s(pmscr_el1, SYS_PMSCR_EL1);
5959 }
6060
61−void __debug_switch_to_guest(struct kvm_vcpu *vcpu)
61+void __debug_save_host_buffers_nvhe(struct kvm_vcpu *vcpu)
6262 {
6363 /* Disable and flush SPE data generation */
6464 __debug_save_spe(&vcpu->arch.host_debug_state.pmscr_el1);
65+}
66+
67+void __debug_switch_to_guest(struct kvm_vcpu *vcpu)
68+{
6569 __debug_switch_to_guest_common(vcpu);
6670 }
6771
68−void __debug_switch_to_host(struct kvm_vcpu *vcpu)
72+void __debug_restore_host_buffers_nvhe(struct kvm_vcpu *vcpu)
6973 {
7074 __debug_restore_spe(vcpu->arch.host_debug_state.pmscr_el1);
75+}
76+
77+void __debug_switch_to_host(struct kvm_vcpu *vcpu)
78+{
7179 __debug_switch_to_host_common(vcpu);
7280 }
7381
arch/arm64/kvm/hyp/nvhe/host.S+8−7
@@ -71,7 +71,8 @@ SYM_FUNC_START(__host_enter) · 70 unmodified lines
7171 SYM_FUNC_END(__host_enter)
7272
7373 /*
74− * void __noreturn __hyp_do_panic(bool restore_host, u64 spsr, u64 elr, u64 par);
74+ * void __noreturn __hyp_do_panic(struct kvm_cpu_context *host_ctxt, u64 spsr,
75+ * u64 elr, u64 par);
7576 */
7677 SYM_FUNC_START(__hyp_do_panic)
7778 /* Prepare and exit to the host's panic funciton. */
@@ -82,9 +83,11 @@ SYM_FUNC_START(__hyp_do_panic) · 4 unmodified lines
8283 hyp_kimg_va lr, x6
8384 msr elr_el2, lr
8485
85− /* Set the panic format string. Use the, now free, LR as scratch. */
86− ldr lr, =__hyp_panic_string
87− hyp_kimg_va lr, x6
86+ mov x29, x0
87+
88+ /* Load the format string into x0 and arguments into x1-7 */
89+ ldr x0, =__hyp_panic_string
90+ hyp_kimg_va x0, x6
8891
8992 /* Load the format arguments into x1-7. */
9093 mov x6, x3
@@ -94,9 +97,7 @@ SYM_FUNC_START(__hyp_do_panic) · 3 unmodified lines
9497 mrs x5, hpfar_el2
9598
9699 /* Enter the host, conditionally restoring the host context. */
97− cmp x0, xzr
98− mov x0, lr
99− b.eq __host_enter_without_restoring
100+ cbz x29, __host_enter_without_restoring
100101 b __host_enter_for_panic
101102 SYM_FUNC_END(__hyp_do_panic)
102103
arch/arm64/kvm/hyp/nvhe/hyp-main.c+6−6
@@ -46,11 +46,11 @@ static void handle___kvm_tlb_flush_vmid(struct kvm_cpu_context *host_ctxt) · 45 unmodified lines
4646 __kvm_tlb_flush_vmid(kern_hyp_va(mmu));
4747 }
4848
49−static void handle___kvm_tlb_flush_local_vmid(struct kvm_cpu_context *host_ctxt)
49+static void handle___kvm_flush_cpu_context(struct kvm_cpu_context *host_ctxt)
5050 {
5151 DECLARE_REG(struct kvm_s2_mmu *, mmu, host_ctxt, 1);
5252
53− __kvm_tlb_flush_local_vmid(kern_hyp_va(mmu));
53+ __kvm_flush_cpu_context(kern_hyp_va(mmu));
5454 }
5555
5656 static void handle___kvm_timer_set_cntvoff(struct kvm_cpu_context *host_ctxt)
@@ -67,9 +67,9 @@ static void handle___kvm_enable_ssbs(struct kvm_cpu_context *host_ctxt) · 10 unmodified lines
6767 write_sysreg_el2(tmp, SYS_SCTLR);
6868 }
6969
70−static void handle___vgic_v3_get_ich_vtr_el2(struct kvm_cpu_context *host_ctxt)
70+static void handle___vgic_v3_get_gic_config(struct kvm_cpu_context *host_ctxt)
7171 {
72− cpu_reg(host_ctxt, 1) = __vgic_v3_get_ich_vtr_el2();
72+ cpu_reg(host_ctxt, 1) = __vgic_v3_get_gic_config();
7373 }
7474
7575 static void handle___vgic_v3_read_vmcr(struct kvm_cpu_context *host_ctxt)
@@ -115,10 +115,10 @@ static const hcall_t host_hcall[] = { · 39 unmodified lines
115115 HANDLE_FUNC(__kvm_flush_vm_context),
116116 HANDLE_FUNC(__kvm_tlb_flush_vmid_ipa),
117117 HANDLE_FUNC(__kvm_tlb_flush_vmid),
118− HANDLE_FUNC(__kvm_tlb_flush_local_vmid),
118+ HANDLE_FUNC(__kvm_flush_cpu_context),
119119 HANDLE_FUNC(__kvm_timer_set_cntvoff),
120120 HANDLE_FUNC(__kvm_enable_ssbs),
121− HANDLE_FUNC(__vgic_v3_get_ich_vtr_el2),
121+ HANDLE_FUNC(__vgic_v3_get_gic_config),
122122 HANDLE_FUNC(__vgic_v3_read_vmcr),
123123 HANDLE_FUNC(__vgic_v3_write_vmcr),
124124 HANDLE_FUNC(__vgic_v3_init_lrs),
arch/arm64/kvm/hyp/nvhe/switch.c+11−3
@@ -192,6 +192,14 @@ int __kvm_vcpu_run(struct kvm_vcpu *vcpu) · 191 unmodified lines
192192 pmu_switch_needed = __pmu_switch_to_guest(host_ctxt);
193193
194194 __sysreg_save_state_nvhe(host_ctxt);
195+ /*
196+ * We must flush and disable the SPE buffer for nVHE, as
197+ * the translation regime(EL1&0) is going to be loaded with
198+ * that of the guest. And we must do this before we change the
199+ * translation regime to EL2 (via MDCR_EL2_E2PB == 0) and
200+ * before we load guest Stage1.
201+ */
202+ __debug_save_host_buffers_nvhe(vcpu);
195203
196204 __adjust_pc(vcpu);
197205
@@ -234,11 +242,12 @@ int __kvm_vcpu_run(struct kvm_vcpu *vcpu) · 36 unmodified lines
234242 if (vcpu->arch.flags & KVM_ARM64_FP_ENABLED)
235243 __fpsimd_save_fpexc32(vcpu);
236244
245+ __debug_switch_to_host(vcpu);
237246 /*
238247 * This must come after restoring the host sysregs, since a non-VHE
239248 * system may enable SPE here and make use of the TTBRs.
240249 */
241− __debug_switch_to_host(vcpu);
250+ __debug_restore_host_buffers_nvhe(vcpu);
242251
243252 if (pmu_switch_needed)
244253 __pmu_switch_to_host(host_ctxt);
@@ -257,7 +266,6 @@ void __noreturn hyp_panic(void) · 12 unmodified lines
257266 u64 spsr = read_sysreg_el2(SYS_SPSR);
258267 u64 elr = read_sysreg_el2(SYS_ELR);
259268 u64 par = read_sysreg_par();
260− bool restore_host = true;
261269 struct kvm_cpu_context *host_ctxt;
262270 struct kvm_vcpu *vcpu;
263271
@@ -271,7 +279,7 @@ void __noreturn hyp_panic(void) · 7 unmodified lines
271279 __sysreg_restore_state_nvhe(host_ctxt);
272280 }
273281
274− __hyp_do_panic(restore_host, spsr, elr, par);
282+ __hyp_do_panic(host_ctxt, spsr, elr, par);
275283 unreachable();
276284 }
277285
arch/arm64/kvm/hyp/nvhe/tlb.c+2−1
@@ -123,7 +123,7 @@ void __kvm_tlb_flush_vmid(struct kvm_s2_mmu *mmu) · 122 unmodified lines
123123 __tlb_switch_to_host(&cxt);
124124 }
125125
126−void __kvm_tlb_flush_local_vmid(struct kvm_s2_mmu *mmu)
126+void __kvm_flush_cpu_context(struct kvm_s2_mmu *mmu)
127127 {
128128 struct tlb_inv_context cxt;
129129
@@ -131,6 +131,7 @@ void __kvm_tlb_flush_local_vmid(struct kvm_s2_mmu *mmu) · 1 unmodified line
131131 __tlb_switch_to_guest(mmu, &cxt);
132132
133133 __tlbi(vmalle1);
134+ asm volatile("ic iallu");
134135 dsb(nsh);
135136 isb();
136137
arch/arm64/kvm/hyp/pgtable.c+1−0
@@ -223,6 +223,7 @@ static inline int __kvm_pgtable_visit(struct kvm_pgtable_walk_data *data, · 222 unmodified lines
223223 goto out;
224224
225225 if (!table) {
226+ data->addr = ALIGN_DOWN(data->addr, kvm_granule_size(level));
226227 data->addr += kvm_granule_size(level);
227228 goto out;
228229 }
arch/arm64/kvm/hyp/vgic-v3-sr.c+38−2
@@ -405,9 +405,45 @@ void __vgic_v3_init_lrs(void) · 404 unmodified lines
405405 __gic_v3_set_lr(0, i);
406406 }
407407
408−u64 __vgic_v3_get_ich_vtr_el2(void)
408+/*
409+ * Return the GIC CPU configuration:
410+ * - [31:0] ICH_VTR_EL2
411+ * - [62:32] RES0
412+ * - [63] MMIO (GICv2) capable
413+ */
414+u64 __vgic_v3_get_gic_config(void)
409415 {
410− return read_gicreg(ICH_VTR_EL2);
416+ u64 val, sre = read_gicreg(ICC_SRE_EL1);
417+ unsigned long flags = 0;
418+
419+ /*
420+ * To check whether we have a MMIO-based (GICv2 compatible)
421+ * CPU interface, we need to disable the system register
422+ * view. To do that safely, we have to prevent any interrupt
423+ * from firing (which would be deadly).
424+ *
425+ * Note that this only makes sense on VHE, as interrupts are
426+ * already masked for nVHE as part of the exception entry to
427+ * EL2.
428+ */
429+ if (has_vhe())
430+ flags = local_daif_save();
431+
432+ write_gicreg(0, ICC_SRE_EL1);
433+ isb();
434+
435+ val = read_gicreg(ICC_SRE_EL1);
436+
437+ write_gicreg(sre, ICC_SRE_EL1);
438+ isb();
439+
440+ if (has_vhe())
441+ local_daif_restore(flags);
442+
443+ val = (val & ICC_SRE_EL1_SRE) ? 0 : (1ULL << 63);
444+ val |= read_gicreg(ICH_VTR_EL2);
445+
446+ return val;
411447 }
412448
413449 u64 __vgic_v3_read_vmcr(void)
arch/arm64/kvm/hyp/vhe/tlb.c+2−1
@@ -127,7 +127,7 @@ void __kvm_tlb_flush_vmid(struct kvm_s2_mmu *mmu) · 126 unmodified lines
127127 __tlb_switch_to_host(&cxt);
128128 }
129129
130−void __kvm_tlb_flush_local_vmid(struct kvm_s2_mmu *mmu)
130+void __kvm_flush_cpu_context(struct kvm_s2_mmu *mmu)
131131 {
132132 struct tlb_inv_context cxt;
133133
@@ -135,6 +135,7 @@ void __kvm_tlb_flush_local_vmid(struct kvm_s2_mmu *mmu) · 1 unmodified line
135135 __tlb_switch_to_guest(mmu, &cxt);
136136
137137 __tlbi(vmalle1);
138+ asm volatile("ic iallu");
138139 dsb(nsh);
139140 isb();
140141
arch/arm64/kvm/mmu.c+1−2
@@ -1312,8 +1312,7 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm, · 1311 unmodified lines
13121312 * Prevent userspace from creating a memory region outside of the IPA
13131313 * space addressable by the KVM guest IPA space.
13141314 */
1315− if (memslot->base_gfn + memslot->npages >=
1316− (kvm_phys_size(kvm) >> PAGE_SHIFT))
1315+ if ((memslot->base_gfn + memslot->npages) > (kvm_phys_size(kvm) >> PAGE_SHIFT))
13171316 return -EFAULT;
13181317
13191318 mmap_read_lock(current->mm);
arch/arm64/kvm/perf.c+10−0
@@ -11,6 +11,8 @@ · 10 unmodified lines
1111
1212 #include <asm/kvm_emulate.h>
1313
14+DEFINE_STATIC_KEY_FALSE(kvm_arm_pmu_available);
15+
1416 static int kvm_is_in_guest(void)
1517 {
1618 return kvm_get_running_vcpu() != NULL;
@@ -48,6 +50,14 @@ static struct perf_guest_info_callbacks kvm_guest_cbs = { · 31 unmodified lines
4850
4951 int kvm_perf_init(void)
5052 {
53+ /*
54+ * Check if HW_PERF_EVENTS are supported by checking the number of
55+ * hardware performance counters. This could ensure the presence of
56+ * a physical PMU and CONFIG_PERF_EVENT is selected.
57+ */
58+ if (IS_ENABLED(CONFIG_ARM_PMU) && perf_num_counters() > 0)
59+ static_branch_enable(&kvm_arm_pmu_available);
60+
5161 return perf_register_guest_info_callbacks(&kvm_guest_cbs);
5262 }
5363
arch/arm64/kvm/pmu-emul.c+0−10
@@ -823,16 +823,6 @@ u64 kvm_pmu_get_pmceid(struct kvm_vcpu *vcpu, bool pmceid1) · 822 unmodified lines
823823 return val & mask;
824824 }
825825
826−bool kvm_arm_support_pmu_v3(void)
827−{
828− /*
829− * Check if HW_PERF_EVENTS are supported by checking the number of
830− * hardware performance counters. This could ensure the presence of
831− * a physical PMU and CONFIG_PERF_EVENT is selected.
832− */
833− return (perf_num_counters() > 0);
834−}
835−
836826 int kvm_arm_pmu_v3_enable(struct kvm_vcpu *vcpu)
837827 {
838828 if (!kvm_vcpu_has_pmu(vcpu))
arch/arm64/kvm/reset.c+14−8
@@ -311,23 +311,24 @@ int kvm_set_ipa_limit(void) · 310 unmodified lines
311311 }
312312
313313 switch (cpuid_feature_extract_unsigned_field(mmfr0, tgran_2)) {
314− default:
315− case 1:
314+ case ID_AA64MMFR0_TGRAN_2_SUPPORTED_NONE:
316315 kvm_err("PAGE_SIZE not supported at Stage-2, giving up\n");
317316 return -EINVAL;
318− case 0:
317+ case ID_AA64MMFR0_TGRAN_2_SUPPORTED_DEFAULT:
319318 kvm_debug("PAGE_SIZE supported at Stage-2 (default)\n");
320319 break;
321− case 2:
320+ case ID_AA64MMFR0_TGRAN_2_SUPPORTED_MIN ... ID_AA64MMFR0_TGRAN_2_SUPPORTED_MAX:
322321 kvm_debug("PAGE_SIZE supported at Stage-2 (advertised)\n");
323322 break;
323+ default:
324+ kvm_err("Unsupported value for TGRAN_2, giving up\n");
325+ return -EINVAL;
324326 }
325327
326328 kvm_ipa_limit = id_aa64mmfr0_parange_to_phys_shift(parange);
327− WARN(kvm_ipa_limit < KVM_PHYS_SHIFT,
328− "KVM IPA Size Limit (%d bits) is smaller than default size\n",
329− kvm_ipa_limit);
330− kvm_info("IPA Size Limit: %d bits\n", kvm_ipa_limit);
329+ kvm_info("IPA Size Limit: %d bits%s\n", kvm_ipa_limit,
330+ ((kvm_ipa_limit < KVM_PHYS_SHIFT) ?
331+ " (Reduced IPA size, limited VM/VMM compatibility)" : ""));
331332
332333 return 0;
333334 }
@@ -356,6 +357,11 @@ int kvm_arm_setup_stage2(struct kvm *kvm, unsigned long type) · 22 unmodified lines
356357 return -EINVAL;
357358 } else {
358359 phys_shift = KVM_PHYS_SHIFT;
360+ if (phys_shift > kvm_ipa_limit) {
361+ pr_warn_once("%s using unsupported default IPA limit, upgrade your VMM\n",
362+ current->comm);
363+ return -EINVAL;
364+ }
359365 }
360366
361367 mmfr0 = read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1);
arch/arm64/kvm/vgic/vgic-v3.c+9−3
@@ -574,9 +574,13 @@ early_param("kvm-arm.vgic_v4_enable", early_gicv4_enable); · 573 unmodified lines
574574 */
575575 int vgic_v3_probe(const struct gic_kvm_info *info)
576576 {
577− u32 ich_vtr_el2 = kvm_call_hyp_ret(__vgic_v3_get_ich_vtr_el2);
577+ u64 ich_vtr_el2 = kvm_call_hyp_ret(__vgic_v3_get_gic_config);
578+ bool has_v2;
578579 int ret;
579580
581+ has_v2 = ich_vtr_el2 >> 63;
582+ ich_vtr_el2 = (u32)ich_vtr_el2;
583+
580584 /*
581585 * The ListRegs field is 5 bits, but there is an architectural
582586 * maximum of 16 list registers. Just ignore bit 4...
@@ -594,13 +598,15 @@ int vgic_v3_probe(const struct gic_kvm_info *info) · 11 unmodified lines
594598 gicv4_enable ? "en" : "dis");
595599 }
596600
601+ kvm_vgic_global_state.vcpu_base = 0;
602+
597603 if (!info->vcpu.start) {
598604 kvm_info("GICv3: no GICV resource entry\n");
599− kvm_vgic_global_state.vcpu_base = 0;
605+ } else if (!has_v2) {
606+ pr_warn(FW_BUG "CPU interface incapable of MMIO access\n");
600607 } else if (!PAGE_ALIGNED(info->vcpu.start)) {
601608 pr_warn("GICV physical address 0x%llx not page aligned\n",
602609 (unsigned long long)info->vcpu.start);
603− kvm_vgic_global_state.vcpu_base = 0;
604610 } else {
605611 kvm_vgic_global_state.vcpu_base = info->vcpu.start;
606612 kvm_vgic_global_state.can_emulate_gicv2 = true;
arch/arm64/mm/init.c+26−3
@@ -219,17 +219,40 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max) · 218 unmodified lines
219219
220220 int pfn_valid(unsigned long pfn)
221221 {
222− phys_addr_t addr = pfn << PAGE_SHIFT;
222+ phys_addr_t addr = PFN_PHYS(pfn);
223223
224− if ((addr >> PAGE_SHIFT) != pfn)
224+ /*
225+ * Ensure the upper PAGE_SHIFT bits are clear in the
226+ * pfn. Else it might lead to false positives when
227+ * some of the upper bits are set, but the lower bits
228+ * match a valid pfn.
229+ */
230+ if (PHYS_PFN(addr) != pfn)
225231 return 0;
226232
227233 #ifdef CONFIG_SPARSEMEM
234+{
235+ struct mem_section *ms;
236+
228237 if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS)
229238 return 0;
230239
231− if (!valid_section(__pfn_to_section(pfn)))
240+ ms = __pfn_to_section(pfn);
241+ if (!valid_section(ms))
232242 return 0;
243+
244+ /*
245+ * ZONE_DEVICE memory does not have the memblock entries.
246+ * memblock_is_map_memory() check for ZONE_DEVICE based
247+ * addresses will always fail. Even the normal hotplugged
248+ * memory will never have MEMBLOCK_NOMAP flag set in their
249+ * memblock entries. Skip memblock search for all non early
250+ * memory sections covering all of hotplug memory including
251+ * both normal and ZONE_DEVICE based.
252+ */
253+ if (!early_section(ms))
254+ return pfn_section_valid(ms, pfn);
255+}
233256 #endif
234257 return memblock_is_map_memory(addr);
235258 }
arch/arm64/mm/mmu.c+22−4
@@ -40,7 +40,7 @@ · 39 unmodified lines
4040 #define NO_BLOCK_MAPPINGS BIT(0)
4141 #define NO_CONT_MAPPINGS BIT(1)
4242
43−u64 idmap_t0sz = TCR_T0SZ(VA_BITS);
43+u64 idmap_t0sz = TCR_T0SZ(VA_BITS_MIN);
4444 u64 idmap_ptrs_per_pgd = PTRS_PER_PGD;
4545
4646 u64 __section(".mmuoff.data.write") vabits_actual;
@@ -512,7 +512,8 @@ static void __init map_mem(pgd_t *pgdp) · 465 unmodified lines
512512 * if MTE is present. Otherwise, it has the same attributes as
513513 * PAGE_KERNEL.
514514 */
515− __map_memblock(pgdp, start, end, PAGE_KERNEL_TAGGED, flags);
515+ __map_memblock(pgdp, start, end, pgprot_tagged(PAGE_KERNEL),
516+ flags);
516517 }
517518
518519 /*
@@ -1447,6 +1448,22 @@ static void __remove_pgd_mapping(pgd_t *pgdir, unsigned long start, u64 size) · 928 unmodified lines
14471448 struct range arch_get_mappable_range(void)
14481449 {
14491450 struct range mhp_range;
1451+ u64 start_linear_pa = __pa(_PAGE_OFFSET(vabits_actual));
1452+ u64 end_linear_pa = __pa(PAGE_END - 1);
1453+
1454+ if (IS_ENABLED(CONFIG_RANDOMIZE_BASE)) {
1455+ /*
1456+ * Check for a wrap, it is possible because of randomized linear
1457+ * mapping the start physical address is actually bigger than
1458+ * the end physical address. In this case set start to zero
1459+ * because [0, end_linear_pa] range must still be able to cover
1460+ * all addressable physical addresses.
1461+ */
1462+ if (start_linear_pa > end_linear_pa)
1463+ start_linear_pa = 0;
1464+ }
1465+
1466+ WARN_ON(start_linear_pa > end_linear_pa);
14501467
14511468 /*
14521469 * Linear mapping region is the range [PAGE_OFFSET..(PAGE_END - 1)]
@@ -1454,8 +1471,9 @@ struct range arch_get_mappable_range(void) · 1 unmodified line
14541471 * range which can be mapped inside this linear mapping range, must
14551472 * also be derived from its end points.
14561473 */
1457− mhp_range.start = __pa(_PAGE_OFFSET(vabits_actual));
1458− mhp_range.end = __pa(PAGE_END - 1);
1474+ mhp_range.start = start_linear_pa;
1475+ mhp_range.end = end_linear_pa;
1476+
14591477 return mhp_range;
14601478 }
14611479
arch/csky/kernel/probes/ftrace.c+1−1
@@ -9,7 +9,7 @@ int arch_check_ftrace_location(struct kprobe *p) · 8 unmodified lines
99 return 0;
1010 }
1111
12−/* Ftrace callback handler for kprobes -- called under preepmt disabed */
12+/* Ftrace callback handler for kprobes -- called under preepmt disabled */
1313 void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
1414 struct ftrace_ops *ops, struct ftrace_regs *fregs)
1515 {
arch/ia64/include/asm/syscall.h+1−1
@@ -32,7 +32,7 @@ static inline void syscall_rollback(struct task_struct *task, · 31 unmodified lines
3232 static inline long syscall_get_error(struct task_struct *task,
3333 struct pt_regs *regs)
3434 {
35− return regs->r10 == -1 ? regs->r8:0;
35+ return regs->r10 == -1 ? -regs->r8:0;
3636 }
3737
3838 static inline long syscall_get_return_value(struct task_struct *task,
arch/ia64/kernel/err_inject.c+11−11
@@ -59,7 +59,7 @@ show_##name(struct device *dev, struct device_attribute *attr, \ · 58 unmodified lines
5959 char *buf) \
6060 { \
6161 u32 cpu=dev->id; \
62− return sprintf(buf, "%lx\n", name[cpu]); \
62+ return sprintf(buf, "%llx\n", name[cpu]); \
6363 }
6464
6565 #define store(name) \
@@ -86,9 +86,9 @@ store_call_start(struct device *dev, struct device_attribute *attr, · 20 unmodified lines
8686
8787 #ifdef ERR_INJ_DEBUG
8888 printk(KERN_DEBUG "pal_mc_err_inject for cpu%d:\n", cpu);
89− printk(KERN_DEBUG "err_type_info=%lx,\n", err_type_info[cpu]);
90− printk(KERN_DEBUG "err_struct_info=%lx,\n", err_struct_info[cpu]);
91− printk(KERN_DEBUG "err_data_buffer=%lx, %lx, %lx.\n",
89+ printk(KERN_DEBUG "err_type_info=%llx,\n", err_type_info[cpu]);
90+ printk(KERN_DEBUG "err_struct_info=%llx,\n", err_struct_info[cpu]);
91+ printk(KERN_DEBUG "err_data_buffer=%llx, %llx, %llx.\n",
9292 err_data_buffer[cpu].data1,
9393 err_data_buffer[cpu].data2,
9494 err_data_buffer[cpu].data3);
@@ -117,8 +117,8 @@ store_call_start(struct device *dev, struct device_attribute *attr, · 22 unmodified lines
117117
118118 #ifdef ERR_INJ_DEBUG
119119 printk(KERN_DEBUG "Returns: status=%d,\n", (int)status[cpu]);
120− printk(KERN_DEBUG "capabilities=%lx,\n", capabilities[cpu]);
121− printk(KERN_DEBUG "resources=%lx\n", resources[cpu]);
120+ printk(KERN_DEBUG "capabilities=%llx,\n", capabilities[cpu]);
121+ printk(KERN_DEBUG "resources=%llx\n", resources[cpu]);
122122 #endif
123123 return size;
124124 }
@@ -131,7 +131,7 @@ show_virtual_to_phys(struct device *dev, struct device_attribute *attr, · 6 unmodified lines
131131 char *buf)
132132 {
133133 unsigned int cpu=dev->id;
134− return sprintf(buf, "%lx\n", phys_addr[cpu]);
134+ return sprintf(buf, "%llx\n", phys_addr[cpu]);
135135 }
136136
137137 static ssize_t
@@ -145,7 +145,7 @@ store_virtual_to_phys(struct device *dev, struct device_attribute *attr, · 7 unmodified lines
145145 ret = get_user_pages_fast(virt_addr, 1, FOLL_WRITE, NULL);
146146 if (ret<=0) {
147147 #ifdef ERR_INJ_DEBUG
148− printk("Virtual address %lx is not existing.\n",virt_addr);
148+ printk("Virtual address %llx is not existing.\n", virt_addr);
149149 #endif
150150 return -EINVAL;
151151 }
@@ -163,7 +163,7 @@ show_err_data_buffer(struct device *dev, · 11 unmodified lines
163163 {
164164 unsigned int cpu=dev->id;
165165
166− return sprintf(buf, "%lx, %lx, %lx\n",
166+ return sprintf(buf, "%llx, %llx, %llx\n",
167167 err_data_buffer[cpu].data1,
168168 err_data_buffer[cpu].data2,
169169 err_data_buffer[cpu].data3);
@@ -178,13 +178,13 @@ store_err_data_buffer(struct device *dev, · 8 unmodified lines
178178 int ret;
179179
180180 #ifdef ERR_INJ_DEBUG
181− printk("write err_data_buffer=[%lx,%lx,%lx] on cpu%d\n",
181+ printk("write err_data_buffer=[%llx,%llx,%llx] on cpu%d\n",
182182 err_data_buffer[cpu].data1,
183183 err_data_buffer[cpu].data2,
184184 err_data_buffer[cpu].data3,
185185 cpu);
186186 #endif
187− ret=sscanf(buf, "%lx, %lx, %lx",
187+ ret = sscanf(buf, "%llx, %llx, %llx",
188188 &err_data_buffer[cpu].data1,
189189 &err_data_buffer[cpu].data2,
190190 &err_data_buffer[cpu].data3);
arch/ia64/kernel/mca.c+1−1
@@ -1824,7 +1824,7 @@ ia64_mca_cpu_init(void *cpu_data) · 1823 unmodified lines
18241824 data = mca_bootmem();
18251825 first_time = 0;
18261826 } else
1827− data = (void *)__get_free_pages(GFP_KERNEL,
1827+ data = (void *)__get_free_pages(GFP_ATOMIC,
18281828 get_order(sz));
18291829 if (!data)
18301830 panic("Could not allocate MCA memory for cpu %d\n",
arch/ia64/kernel/ptrace.c+18−6
@@ -2013,27 +2013,39 @@ static void syscall_get_set_args_cb(struct unw_frame_info *info, void *data) · 2012 unmodified lines
20132013 {
20142014 struct syscall_get_set_args *args = data;
20152015 struct pt_regs *pt = args->regs;
2016− unsigned long *krbs, cfm, ndirty;
2016+ unsigned long *krbs, cfm, ndirty, nlocals, nouts;
20172017 int i, count;
20182018
20192019 if (unw_unwind_to_user(info) < 0)
20202020 return;
20212021
2022+ /*
2023+ * We get here via a few paths:
2024+ * - break instruction: cfm is shared with caller.
2025+ * syscall args are in out= regs, locals are non-empty.
2026+ * - epsinstruction: cfm is set by br.call
2027+ * locals don't exist.
2028+ *
2029+ * For both cases argguments are reachable in cfm.sof - cfm.sol.
2030+ * CFM: [ ... | sor: 17..14 | sol : 13..7 | sof : 6..0 ]
2031+ */
20222032 cfm = pt->cr_ifs;
2033+ nlocals = (cfm >> 7) & 0x7f; /* aka sol */
2034+ nouts = (cfm & 0x7f) - nlocals; /* aka sof - sol */
20232035 krbs = (unsigned long *)info->task + IA64_RBS_OFFSET/8;
20242036 ndirty = ia64_rse_num_regs(krbs, krbs + (pt->loadrs >> 19));
20252037
20262038 count = 0;
20272039 if (in_syscall(pt))
2028− count = min_t(int, args->n, cfm & 0x7f);
2040+ count = min_t(int, args->n, nouts);
20292041
2042+ /* Iterate over outs. */
20302043 for (i = 0; i < count; i++) {
2044+ int j = ndirty + nlocals + i + args->i;
20312045 if (args->rw)
2032− *ia64_rse_skip_regs(krbs, ndirty + i + args->i) =
2033− args->args[i];
2046+ *ia64_rse_skip_regs(krbs, j) = args->args[i];
20342047 else
2035− args->args[i] = *ia64_rse_skip_regs(krbs,
2036− ndirty + i + args->i);
2048+ args->args[i] = *ia64_rse_skip_regs(krbs, j);
20372049 }
20382050
20392051 if (!args->rw) {
arch/mips/kernel/vmlinux.lds.S+1−1
@@ -176,7 +176,7 @@ SECTIONS · 175 unmodified lines
176176 .fill : {
177177 FILL(0);
178178 BYTE(0);
179− . = ALIGN(8);
179+ STRUCT_ALIGN();
180180 }
181181 __appended_dtb = .;
182182 /* leave space for appended DTB */
arch/powerpc/include/asm/code-patching.h+4−3
@@ -73,9 +73,10 @@ void __patch_exception(int exc, unsigned long addr); · 72 unmodified lines
7373 #endif
7474
7575 #define OP_RT_RA_MASK 0xffff0000UL
76−#define LIS_R2 0x3c020000UL
77−#define ADDIS_R2_R12 0x3c4c0000UL
78−#define ADDI_R2_R2 0x38420000UL
76+#define LIS_R2 (PPC_INST_ADDIS | __PPC_RT(R2))
77+#define ADDIS_R2_R12 (PPC_INST_ADDIS | __PPC_RT(R2) | __PPC_RA(R12))
78+#define ADDI_R2_R2 (PPC_INST_ADDI | __PPC_RT(R2) | __PPC_RA(R2))
79+
7980
8081 static inline unsigned long ppc_function_entry(void *func)
8182 {
arch/powerpc/include/asm/cpu_has_feature.h+2−2
@@ -7,7 +7,7 @@ · 6 unmodified lines
77 #include <linux/bug.h>
88 #include <asm/cputable.h>
99
10−static inline bool early_cpu_has_feature(unsigned long feature)
10+static __always_inline bool early_cpu_has_feature(unsigned long feature)
1111 {
1212 return !!((CPU_FTRS_ALWAYS & feature) ||
1313 (CPU_FTRS_POSSIBLE & cur_cpu_spec->cpu_features & feature));
@@ -46,7 +46,7 @@ static __always_inline bool cpu_has_feature(unsigned long feature) · 32 unmodified lines
4646 return static_branch_likely(&cpu_feature_keys[i]);
4747 }
4848 #else
49−static inline bool cpu_has_feature(unsigned long feature)
49+static __always_inline bool cpu_has_feature(unsigned long feature)
5050 {
5151 return early_cpu_has_feature(feature);
5252 }
arch/powerpc/include/asm/interrupt.h+2−1
@@ -410,7 +410,6 @@ DECLARE_INTERRUPT_HANDLER(altivec_assist_exception); · 409 unmodified lines
410410 DECLARE_INTERRUPT_HANDLER(CacheLockingException);
411411 DECLARE_INTERRUPT_HANDLER(SPEFloatingPointException);
412412 DECLARE_INTERRUPT_HANDLER(SPEFloatingPointRoundException);
413−DECLARE_INTERRUPT_HANDLER(unrecoverable_exception);
414413 DECLARE_INTERRUPT_HANDLER(WatchdogException);
415414 DECLARE_INTERRUPT_HANDLER(kernel_bad_stack);
416415
@@ -437,6 +436,8 @@ DECLARE_INTERRUPT_HANDLER_NMI(hmi_exception_realmode); · 20 unmodified lines
437436
438437 DECLARE_INTERRUPT_HANDLER_ASYNC(TAUException);
439438
439+void unrecoverable_exception(struct pt_regs *regs);
440+
440441 void replay_system_reset(void);
441442 void replay_soft_interrupts(void);
442443
arch/powerpc/include/asm/ptrace.h+2−2
@@ -195,7 +195,7 @@ static inline void regs_set_return_value(struct pt_regs *regs, unsigned long rc) · 194 unmodified lines
195195 #define TRAP_FLAGS_MASK 0x11
196196 #define TRAP(regs) ((regs)->trap & ~TRAP_FLAGS_MASK)
197197 #define FULL_REGS(regs) (((regs)->trap & 1) == 0)
198−#define SET_FULL_REGS(regs) ((regs)->trap |= 1)
198+#define SET_FULL_REGS(regs) ((regs)->trap &= ~1)
199199 #endif
200200 #define CHECK_FULL_REGS(regs) BUG_ON(!FULL_REGS(regs))
201201 #define NV_REG_POISON 0xdeadbeefdeadbeefUL
@@ -210,7 +210,7 @@ static inline void regs_set_return_value(struct pt_regs *regs, unsigned long rc) · 8 unmodified lines
210210 #define TRAP_FLAGS_MASK 0x1F
211211 #define TRAP(regs) ((regs)->trap & ~TRAP_FLAGS_MASK)
212212 #define FULL_REGS(regs) (((regs)->trap & 1) == 0)
213−#define SET_FULL_REGS(regs) ((regs)->trap |= 1)
213+#define SET_FULL_REGS(regs) ((regs)->trap &= ~1)
214214 #define IS_CRITICAL_EXC(regs) (((regs)->trap & 2) != 0)
215215 #define IS_MCHECK_EXC(regs) (((regs)->trap & 4) != 0)
216216 #define IS_DEBUG_EXC(regs) (((regs)->trap & 8) != 0)
arch/powerpc/include/asm/switch_to.h+10−0
@@ -71,6 +71,16 @@ static inline void disable_kernel_vsx(void) · 70 unmodified lines
7171 {
7272 msr_check_and_clear(MSR_FP|MSR_VEC|MSR_VSX);
7373 }
74+#else
75+static inline void enable_kernel_vsx(void)
76+{
77+ BUILD_BUG();
78+}
79+
80+static inline void disable_kernel_vsx(void)
81+{
82+ BUILD_BUG();
83+}
7484 #endif
7585
7686 #ifdef CONFIG_SPE
arch/powerpc/kernel/exceptions-64s.S+1−1
@@ -466,7 +466,7 @@ DEFINE_FIXED_SYMBOL(\name\()_common_real) · 465 unmodified lines
466466
467467 ld r10,PACAKMSR(r13) /* get MSR value for kernel */
468468 /* MSR[RI] is clear iff using SRR regs */
469− .if IHSRR == EXC_HV_OR_STD
469+ .if IHSRR_IF_HVMODE
470470 BEGIN_FTR_SECTION
471471 xori r10,r10,MSR_RI
472472 END_FTR_SECTION_IFCLR(CPU_FTR_HVMODE)
arch/powerpc/kernel/interrupt.c+0−1
@@ -436,7 +436,6 @@ again: · 435 unmodified lines
436436 return ret;
437437 }
438438
439−void unrecoverable_exception(struct pt_regs *regs);
440439 void preempt_schedule_irq(void);
441440
442441 notrace unsigned long interrupt_exit_kernel_prepare(struct pt_regs *regs, unsigned long msr)
arch/powerpc/kernel/traps.c+1−1
@@ -2170,7 +2170,7 @@ DEFINE_INTERRUPT_HANDLER(SPEFloatingPointRoundException) · 2169 unmodified lines
21702170 * in the MSR is 0. This indicates that SRR0/1 are live, and that
21712171 * we therefore lost state by taking this exception.
21722172 */
2173−DEFINE_INTERRUPT_HANDLER(unrecoverable_exception)
2173+void unrecoverable_exception(struct pt_regs *regs)
21742174 {
21752175 pr_emerg("Unrecoverable exception %lx at %lx (msr=%lx)\n",
21762176 regs->trap, regs->nip, regs->msr);
arch/powerpc/kernel/vdso32/gettimeofday.S+11−0
@@ -65,3 +65,14 @@ V_FUNCTION_END(__kernel_clock_getres) · 64 unmodified lines
6565 V_FUNCTION_BEGIN(__kernel_time)
6666 cvdso_call_time __c_kernel_time
6767 V_FUNCTION_END(__kernel_time)
68+
69+/* Routines for restoring integer registers, called by the compiler. */
70+/* Called with r11 pointing to the stack header word of the caller of the */
71+/* function, just beyond the end of the integer restore area. */
72+_GLOBAL(_restgpr_31_x)
73+_GLOBAL(_rest32gpr_31_x)
74+ lwz r0,4(r11)
75+ lwz r31,-4(r11)
76+ mtlr r0
77+ mr r1,r11
78+ blr
arch/riscv/Kconfig+2−2
@@ -93,7 +93,6 @@ config RISCV · 92 unmodified lines
9393 select PCI_MSI if PCI
9494 select RISCV_INTC
9595 select RISCV_TIMER if RISCV_SBI
96− select SPARSEMEM_STATIC if 32BIT
9796 select SPARSE_IRQ
9897 select SYSCTL_EXCEPTION_TRACE
9998 select THREAD_INFO_IN_TASK
@@ -154,7 +153,8 @@ config ARCH_FLATMEM_ENABLE · 54 unmodified lines
154153 config ARCH_SPARSEMEM_ENABLE
155154 def_bool y
156155 depends on MMU
157− select SPARSEMEM_VMEMMAP_ENABLE
156+ select SPARSEMEM_STATIC if 32BIT && SPARSMEM
157+ select SPARSEMEM_VMEMMAP_ENABLE if 64BIT
158158
159159 config ARCH_SELECT_MEMORY_MODEL
160160 def_bool ARCH_SPARSEMEM_ENABLE
arch/riscv/Kconfig.socs+2−0
@@ -31,6 +31,8 @@ config SOC_CANAAN · 30 unmodified lines
3131 select SIFIVE_PLIC
3232 select ARCH_HAS_RESET_CONTROLLER
3333 select PINCTRL
34+ select COMMON_CLK
35+ select COMMON_CLK_K210
3436 help
3537 This enables support for Canaan Kendryte K210 SoC platform hardware.
3638
arch/riscv/include/asm/asm-prototypes.h+16−0
@@ -9,4 +9,20 @@ long long __lshrti3(long long a, int b); · 8 unmodified lines
99 long long __ashrti3(long long a, int b);
1010 long long __ashlti3(long long a, int b);
1111
12+
13+#define DECLARE_DO_ERROR_INFO(name) asmlinkage void name(struct pt_regs *regs)
14+
15+DECLARE_DO_ERROR_INFO(do_trap_unknown);
16+DECLARE_DO_ERROR_INFO(do_trap_insn_misaligned);
17+DECLARE_DO_ERROR_INFO(do_trap_insn_fault);
18+DECLARE_DO_ERROR_INFO(do_trap_insn_illegal);
19+DECLARE_DO_ERROR_INFO(do_trap_load_fault);
20+DECLARE_DO_ERROR_INFO(do_trap_load_misaligned);
21+DECLARE_DO_ERROR_INFO(do_trap_store_misaligned);
22+DECLARE_DO_ERROR_INFO(do_trap_store_fault);
23+DECLARE_DO_ERROR_INFO(do_trap_ecall_u);
24+DECLARE_DO_ERROR_INFO(do_trap_ecall_s);
25+DECLARE_DO_ERROR_INFO(do_trap_ecall_m);
26+DECLARE_DO_ERROR_INFO(do_trap_break);
27+
1228 #endif /* _ASM_RISCV_PROTOTYPES_H */
arch/riscv/include/asm/irq.h+2−0
@@ -12,4 +12,6 @@ · 11 unmodified lines
1212
1313 #include <asm-generic/irq.h>
1414
15+extern void __init init_IRQ(void);
16+
1517 #endif /* _ASM_RISCV_IRQ_H */
arch/riscv/include/asm/processor.h+1−0
@@ -71,6 +71,7 @@ int riscv_of_processor_hartid(struct device_node *node); · 70 unmodified lines
7171 int riscv_of_parent_hartid(struct device_node *node);
7272
7373 extern void riscv_fill_hwcap(void);
74+extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
7475
7576 #endif /* __ASSEMBLY__ */
7677
arch/riscv/include/asm/ptrace.h+5−0
@@ -119,6 +119,11 @@ extern int regs_query_register_offset(const char *name); · 118 unmodified lines
119119 extern unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,
120120 unsigned int n);
121121
122+void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr,
123+ unsigned long frame_pointer);
124+int do_syscall_trace_enter(struct pt_regs *regs);
125+void do_syscall_trace_exit(struct pt_regs *regs);
126+
122127 /**
123128 * regs_get_register() - get register value from its offset
124129 * @regs: pt_regs from which register value is gotten
arch/riscv/include/asm/sbi.h+2−2
@@ -51,10 +51,10 @@ enum sbi_ext_rfence_fid { · 50 unmodified lines
5151 SBI_EXT_RFENCE_REMOTE_FENCE_I = 0,
5252 SBI_EXT_RFENCE_REMOTE_SFENCE_VMA,
5353 SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID,
54− SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA,
5554 SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA_VMID,
56− SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA,
55+ SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA,
5756 SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA_ASID,
57+ SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA,
5858 };
5959
6060 enum sbi_ext_hsm_fid {
arch/riscv/include/asm/timex.h+2−0
@@ -88,4 +88,6 @@ static inline int read_current_timer(unsigned long *timer_val) · 87 unmodified lines
8888 return 0;
8989 }
9090
91+extern void time_init(void);
92+
9193 #endif /* _ASM_RISCV_TIMEX_H */
arch/riscv/kernel/Makefile+1−0
@@ -8,6 +8,7 @@ CFLAGS_REMOVE_ftrace.o = $(CC_FLAGS_FTRACE) · 7 unmodified lines
88 CFLAGS_REMOVE_patch.o = $(CC_FLAGS_FTRACE)
99 CFLAGS_REMOVE_sbi.o = $(CC_FLAGS_FTRACE)
1010 endif
11+CFLAGS_syscall_table.o += $(call cc-option,-Wno-override-init,)
1112
1213 extra-y += head.o
1314 extra-y += vmlinux.lds
arch/riscv/kernel/probes/ftrace.c+10−8
@@ -2,39 +2,41 @@ · 1 unmodified line
22
33 #include <linux/kprobes.h>
44
5−/* Ftrace callback handler for kprobes -- called under preepmt disabed */
5+/* Ftrace callback handler for kprobes -- called under preepmt disabled */
66 void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
7− struct ftrace_ops *ops, struct ftrace_regs *regs)
7+ struct ftrace_ops *ops, struct ftrace_regs *fregs)
88 {
99 struct kprobe *p;
10+ struct pt_regs *regs;
1011 struct kprobe_ctlblk *kcb;
1112
1213 p = get_kprobe((kprobe_opcode_t *)ip);
1314 if (unlikely(!p) || kprobe_disabled(p))
1415 return;
1516
17+ regs = ftrace_get_regs(fregs);
1618 kcb = get_kprobe_ctlblk();
1719 if (kprobe_running()) {
1820 kprobes_inc_nmissed_count(p);
1921 } else {
20− unsigned long orig_ip = instruction_pointer(&(regs->regs));
22+ unsigned long orig_ip = instruction_pointer(regs);
2123
22− instruction_pointer_set(&(regs->regs), ip);
24+ instruction_pointer_set(regs, ip);
2325
2426 __this_cpu_write(current_kprobe, p);
2527 kcb->kprobe_status = KPROBE_HIT_ACTIVE;
26− if (!p->pre_handler || !p->pre_handler(p, &(regs->regs))) {
28+ if (!p->pre_handler || !p->pre_handler(p, regs)) {
2729 /*
2830 * Emulate singlestep (and also recover regs->pc)
2931 * as if there is a nop
3032 */
31− instruction_pointer_set(&(regs->regs),
33+ instruction_pointer_set(regs,
3234 (unsigned long)p->addr + MCOUNT_INSN_SIZE);
3335 if (unlikely(p->post_handler)) {
3436 kcb->kprobe_status = KPROBE_HIT_SSDONE;
35− p->post_handler(p, &(regs->regs), 0);
37+ p->post_handler(p, regs, 0);
3638 }
37− instruction_pointer_set(&(regs->regs), orig_ip);
39+ instruction_pointer_set(regs, orig_ip);
3840 }
3941
4042 /*
arch/riscv/kernel/probes/kprobes.c+1−2
@@ -256,8 +256,7 @@ int __kprobes kprobe_fault_handler(struct pt_regs *regs, unsigned int trapnr) · 255 unmodified lines
256256 * normal page fault.
257257 */
258258 regs->epc = (unsigned long) cur->addr;
259− if (!instruction_pointer(regs))
260− BUG();
259+ BUG_ON(!instruction_pointer(regs));
261260
262261 if (kcb->kprobe_status == KPROBE_REENTER)
263262 restore_previous_kprobe(kcb);
arch/riscv/kernel/process.c+1−0
@@ -10,6 +10,7 @@ · 9 unmodified lines
1010 #include <linux/cpu.h>
1111 #include <linux/kernel.h>
1212 #include <linux/sched.h>
13+#include <linux/sched/debug.h>
1314 #include <linux/sched/task_stack.h>
1415 #include <linux/tick.h>
1516 #include <linux/ptrace.h>
arch/riscv/kernel/sbi.c+1−1
@@ -116,7 +116,7 @@ void sbi_clear_ipi(void) · 115 unmodified lines
116116 EXPORT_SYMBOL(sbi_clear_ipi);
117117
118118 /**
119− * sbi_set_timer_v01() - Program the timer for next timer event.
119+ * __sbi_set_timer_v01() - Program the timer for next timer event.
120120 * @stime_value: The value after which next timer event should fire.
121121 *
122122 * Return: None
arch/riscv/kernel/setup.c+2−1
@@ -147,7 +147,8 @@ static void __init init_resources(void) · 146 unmodified lines
147147 bss_res.end = __pa_symbol(__bss_stop) - 1;
148148 bss_res.flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
149149
150− mem_res_sz = (memblock.memory.cnt + memblock.reserved.cnt) * sizeof(*mem_res);
150+ /* + 1 as memblock_alloc() might increase memblock.reserved.cnt */
151+ mem_res_sz = (memblock.memory.cnt + memblock.reserved.cnt + 1) * sizeof(*mem_res);
151152 mem_res = memblock_alloc(mem_res_sz, SMP_CACHE_BYTES);
152153 if (!mem_res)
153154 panic("%s: Failed to allocate %zu bytes\n", __func__, mem_res_sz);
arch/riscv/kernel/time.c+1−0
@@ -9,6 +9,7 @@ · 8 unmodified lines
99 #include <linux/delay.h>
1010 #include <asm/sbi.h>
1111 #include <asm/processor.h>
12+#include <asm/timex.h>
1213
1314 unsigned long riscv_timebase;
1415 EXPORT_SYMBOL_GPL(riscv_timebase);
arch/riscv/kernel/traps.c+1−0
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 #include <linux/module.h>
1818 #include <linux/irq.h>
1919
20+#include <asm/asm-prototypes.h>
2021 #include <asm/bug.h>
2122 #include <asm/processor.h>
2223 #include <asm/ptrace.h>
arch/riscv/mm/kasan_init.c+3−1
@@ -155,7 +155,7 @@ static void __init kasan_populate(void *start, void *end) · 154 unmodified lines
155155 memset(start, KASAN_SHADOW_INIT, end - start);
156156 }
157157
158−void __init kasan_shallow_populate(void *start, void *end)
158+static void __init kasan_shallow_populate(void *start, void *end)
159159 {
160160 unsigned long vaddr = (unsigned long)start & PAGE_MASK;
161161 unsigned long vend = PAGE_ALIGN((unsigned long)end);
@@ -187,6 +187,8 @@ void __init kasan_shallow_populate(void *start, void *end) · 25 unmodified lines
187187 }
188188 vaddr += PAGE_SIZE;
189189 }
190+
191+ local_flush_tlb_all();
190192 }
191193
192194 void __init kasan_init(void)
arch/s390/configs/debug_defconfig+3−13
@@ -275,9 +275,9 @@ CONFIG_IP_VS_DH=m · 274 unmodified lines
275275 CONFIG_IP_VS_SH=m
276276 CONFIG_IP_VS_SED=m
277277 CONFIG_IP_VS_NQ=m
278+CONFIG_IP_VS_TWOS=m
278279 CONFIG_IP_VS_FTP=m
279280 CONFIG_IP_VS_PE_SIP=m
280−CONFIG_NF_TABLES_IPV4=y
281281 CONFIG_NFT_FIB_IPV4=m
282282 CONFIG_NF_TABLES_ARP=y
283283 CONFIG_IP_NF_IPTABLES=m
@@ -298,7 +298,6 @@ CONFIG_IP_NF_SECURITY=m · 14 unmodified lines
298298 CONFIG_IP_NF_ARPTABLES=m
299299 CONFIG_IP_NF_ARPFILTER=m
300300 CONFIG_IP_NF_ARP_MANGLE=m
301−CONFIG_NF_TABLES_IPV6=y
302301 CONFIG_NFT_FIB_IPV6=m
303302 CONFIG_IP6_NF_IPTABLES=m
304303 CONFIG_IP6_NF_MATCH_AH=m
@@ -481,7 +480,6 @@ CONFIG_NLMON=m · 176 unmodified lines
481480 # CONFIG_NET_VENDOR_AQUANTIA is not set
482481 # CONFIG_NET_VENDOR_ARC is not set
483482 # CONFIG_NET_VENDOR_ATHEROS is not set
484−# CONFIG_NET_VENDOR_AURORA is not set
485483 # CONFIG_NET_VENDOR_BROADCOM is not set
486484 # CONFIG_NET_VENDOR_BROCADE is not set
487485 # CONFIG_NET_VENDOR_CADENCE is not set
@@ -581,7 +579,6 @@ CONFIG_VIRTIO_BALLOON=m · 93 unmodified lines
581579 CONFIG_VIRTIO_INPUT=y
582580 CONFIG_VHOST_NET=m
583581 CONFIG_VHOST_VSOCK=m
584−# CONFIG_SURFACE_PLATFORMS is not set
585582 CONFIG_S390_CCW_IOMMU=y
586583 CONFIG_S390_AP_IOMMU=y
587584 CONFIG_EXT4_FS=y
@@ -635,6 +632,7 @@ CONFIG_NTFS_RW=y · 47 unmodified lines
635632 CONFIG_PROC_KCORE=y
636633 CONFIG_TMPFS=y
637634 CONFIG_TMPFS_POSIX_ACL=y
635+CONFIG_TMPFS_INODE64=y
638636 CONFIG_HUGETLBFS=y
639637 CONFIG_CONFIGFS_FS=m
640638 CONFIG_ECRYPT_FS=m
@@ -714,12 +712,8 @@ CONFIG_CRYPTO_VMAC=m · 73 unmodified lines
714712 CONFIG_CRYPTO_CRC32=m
715713 CONFIG_CRYPTO_BLAKE2S=m
716714 CONFIG_CRYPTO_MICHAEL_MIC=m
717−CONFIG_CRYPTO_RMD128=m
718715 CONFIG_CRYPTO_RMD160=m
719−CONFIG_CRYPTO_RMD256=m
720−CONFIG_CRYPTO_RMD320=m
721716 CONFIG_CRYPTO_SHA3=m
722−CONFIG_CRYPTO_TGR192=m
723717 CONFIG_CRYPTO_WP512=m
724718 CONFIG_CRYPTO_AES_TI=m
725719 CONFIG_CRYPTO_ANUBIS=m
@@ -731,7 +725,6 @@ CONFIG_CRYPTO_CAST6=m · 5 unmodified lines
731725 CONFIG_CRYPTO_DES=m
732726 CONFIG_CRYPTO_FCRYPT=m
733727 CONFIG_CRYPTO_KHAZAD=m
734−CONFIG_CRYPTO_SALSA20=m
735728 CONFIG_CRYPTO_SEED=m
736729 CONFIG_CRYPTO_SERPENT=m
737730 CONFIG_CRYPTO_SM4=m
@@ -796,12 +789,9 @@ CONFIG_DEBUG_OBJECTS_RCU_HEAD=y · 58 unmodified lines
796789 CONFIG_DEBUG_OBJECTS_PERCPU_COUNTER=y
797790 CONFIG_SLUB_DEBUG_ON=y
798791 CONFIG_SLUB_STATS=y
799−CONFIG_DEBUG_KMEMLEAK=y
800−CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF=y
801792 CONFIG_DEBUG_STACK_USAGE=y
802793 CONFIG_DEBUG_VM=y
803794 CONFIG_DEBUG_VM_VMACACHE=y
804−CONFIG_DEBUG_VM_RB=y
805795 CONFIG_DEBUG_VM_PGFLAGS=y
806796 CONFIG_DEBUG_MEMORY_INIT=y
807797 CONFIG_MEMORY_NOTIFIER_ERROR_INJECT=m
@@ -838,6 +828,7 @@ CONFIG_BPF_KPROBE_OVERRIDE=y · 30 unmodified lines
838828 CONFIG_HIST_TRIGGERS=y
839829 CONFIG_FTRACE_STARTUP_TEST=y
840830 # CONFIG_EVENT_TRACE_STARTUP_TEST is not set
831+CONFIG_DEBUG_ENTRY=y
841832 CONFIG_NOTIFIER_ERROR_INJECTION=m
842833 CONFIG_NETDEV_NOTIFIER_ERROR_INJECT=m
843834 CONFIG_FAULT_INJECTION=y
@@ -861,4 +852,3 @@ CONFIG_PERCPU_TEST=m · 17 unmodified lines
861852 CONFIG_ATOMIC64_SELFTEST=y
862853 CONFIG_TEST_BITOPS=m
863854 CONFIG_TEST_BPF=m
864−CONFIG_DEBUG_ENTRY=y
arch/s390/configs/defconfig+2−9
@@ -266,9 +266,9 @@ CONFIG_IP_VS_DH=m · 265 unmodified lines
266266 CONFIG_IP_VS_SH=m
267267 CONFIG_IP_VS_SED=m
268268 CONFIG_IP_VS_NQ=m
269+CONFIG_IP_VS_TWOS=m
269270 CONFIG_IP_VS_FTP=m
270271 CONFIG_IP_VS_PE_SIP=m
271−CONFIG_NF_TABLES_IPV4=y
272272 CONFIG_NFT_FIB_IPV4=m
273273 CONFIG_NF_TABLES_ARP=y
274274 CONFIG_IP_NF_IPTABLES=m
@@ -289,7 +289,6 @@ CONFIG_IP_NF_SECURITY=m · 14 unmodified lines
289289 CONFIG_IP_NF_ARPTABLES=m
290290 CONFIG_IP_NF_ARPFILTER=m
291291 CONFIG_IP_NF_ARP_MANGLE=m
292−CONFIG_NF_TABLES_IPV6=y
293292 CONFIG_NFT_FIB_IPV6=m
294293 CONFIG_IP6_NF_IPTABLES=m
295294 CONFIG_IP6_NF_MATCH_AH=m
@@ -473,7 +472,6 @@ CONFIG_NLMON=m · 177 unmodified lines
473472 # CONFIG_NET_VENDOR_AQUANTIA is not set
474473 # CONFIG_NET_VENDOR_ARC is not set
475474 # CONFIG_NET_VENDOR_ATHEROS is not set
476−# CONFIG_NET_VENDOR_AURORA is not set
477475 # CONFIG_NET_VENDOR_BROADCOM is not set
478476 # CONFIG_NET_VENDOR_BROCADE is not set
479477 # CONFIG_NET_VENDOR_CADENCE is not set
@@ -573,7 +571,6 @@ CONFIG_VIRTIO_BALLOON=m · 93 unmodified lines
573571 CONFIG_VIRTIO_INPUT=y
574572 CONFIG_VHOST_NET=m
575573 CONFIG_VHOST_VSOCK=m
576−# CONFIG_SURFACE_PLATFORMS is not set
577574 CONFIG_S390_CCW_IOMMU=y
578575 CONFIG_S390_AP_IOMMU=y
579576 CONFIG_EXT4_FS=y
@@ -623,6 +620,7 @@ CONFIG_NTFS_RW=y · 43 unmodified lines
623620 CONFIG_PROC_KCORE=y
624621 CONFIG_TMPFS=y
625622 CONFIG_TMPFS_POSIX_ACL=y
623+CONFIG_TMPFS_INODE64=y
626624 CONFIG_HUGETLBFS=y
627625 CONFIG_CONFIGFS_FS=m
628626 CONFIG_ECRYPT_FS=m
@@ -703,12 +701,8 @@ CONFIG_CRYPTO_VMAC=m · 74 unmodified lines
703701 CONFIG_CRYPTO_CRC32=m
704702 CONFIG_CRYPTO_BLAKE2S=m
705703 CONFIG_CRYPTO_MICHAEL_MIC=m
706−CONFIG_CRYPTO_RMD128=m
707704 CONFIG_CRYPTO_RMD160=m
708−CONFIG_CRYPTO_RMD256=m
709−CONFIG_CRYPTO_RMD320=m
710705 CONFIG_CRYPTO_SHA3=m
711−CONFIG_CRYPTO_TGR192=m
712706 CONFIG_CRYPTO_WP512=m
713707 CONFIG_CRYPTO_AES_TI=m
714708 CONFIG_CRYPTO_ANUBIS=m
@@ -720,7 +714,6 @@ CONFIG_CRYPTO_CAST6=m · 5 unmodified lines
720714 CONFIG_CRYPTO_DES=m
721715 CONFIG_CRYPTO_FCRYPT=m
722716 CONFIG_CRYPTO_KHAZAD=m
723−CONFIG_CRYPTO_SALSA20=m
724717 CONFIG_CRYPTO_SEED=m
725718 CONFIG_CRYPTO_SERPENT=m
726719 CONFIG_CRYPTO_SM4=m
arch/s390/configs/zfcpdump_defconfig+0−3
@@ -26,7 +26,6 @@ CONFIG_CRASH_DUMP=y · 25 unmodified lines
2626 # CONFIG_SECCOMP is not set
2727 # CONFIG_GCC_PLUGINS is not set
2828 CONFIG_PARTITION_ADVANCED=y
29−CONFIG_IBM_PARTITION=y
3029 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
3130 # CONFIG_COMPACTION is not set
3231 # CONFIG_MIGRATION is not set
@@ -61,11 +60,9 @@ CONFIG_RAW_DRIVER=y · 28 unmodified lines
6160 # CONFIG_HID is not set
6261 # CONFIG_VIRTIO_MENU is not set
6362 # CONFIG_VHOST_MENU is not set
64−# CONFIG_SURFACE_PLATFORMS is not set
6563 # CONFIG_IOMMU_SUPPORT is not set
6664 # CONFIG_DNOTIFY is not set
6765 # CONFIG_INOTIFY_USER is not set
68−CONFIG_CONFIGFS_FS=y
6966 # CONFIG_MISC_FILESYSTEMS is not set
7067 # CONFIG_NETWORK_FILESYSTEMS is not set
7168 CONFIG_LSM="yama,loadpin,safesetid,integrity"
arch/s390/include/asm/idle.h+6−6
@@ -14,12 +14,12 @@ · 13 unmodified lines
1414
1515 struct s390_idle_data {
1616 seqcount_t seqcount;
17− unsigned long long idle_count;
18− unsigned long long idle_time;
19− unsigned long long clock_idle_enter;
20− unsigned long long clock_idle_exit;
21− unsigned long long timer_idle_enter;
22− unsigned long long timer_idle_exit;
17+ unsigned long idle_count;
18+ unsigned long idle_time;
19+ unsigned long clock_idle_enter;
20+ unsigned long clock_idle_exit;
21+ unsigned long timer_idle_enter;
22+ unsigned long timer_idle_exit;
2323 unsigned long mt_cycles_enter[8];
2424 };
2525
arch/s390/include/asm/pci.h+1−1
@@ -202,7 +202,7 @@ extern unsigned int s390_pci_no_rid; · 201 unmodified lines
202202 ----------------------------------------------------------------------------- */
203203 /* Base stuff */
204204 int zpci_create_device(u32 fid, u32 fh, enum zpci_state state);
205−void zpci_remove_device(struct zpci_dev *zdev);
205+void zpci_remove_device(struct zpci_dev *zdev, bool set_error);
206206 int zpci_enable_device(struct zpci_dev *);
207207 int zpci_disable_device(struct zpci_dev *);
208208 int zpci_register_ioat(struct zpci_dev *, u8, u64, u64, u64);
arch/s390/include/asm/timex.h+18−18
@@ -98,10 +98,10 @@ extern unsigned char ptff_function_mask[16]; · 97 unmodified lines
9898
9999 /* Query TOD offset result */
100100 struct ptff_qto {
101− unsigned long long physical_clock;
102− unsigned long long tod_offset;
103− unsigned long long logical_tod_offset;
104− unsigned long long tod_epoch_difference;
101+ unsigned long physical_clock;
102+ unsigned long tod_offset;
103+ unsigned long logical_tod_offset;
104+ unsigned long tod_epoch_difference;
105105 } __packed;
106106
107107 static inline int ptff_query(unsigned int nr)
@@ -151,9 +151,9 @@ struct ptff_qui { · 43 unmodified lines
151151 rc; \
152152 })
153153
154−static inline unsigned long long local_tick_disable(void)
154+static inline unsigned long local_tick_disable(void)
155155 {
156− unsigned long long old;
156+ unsigned long old;
157157
158158 old = S390_lowcore.clock_comparator;
159159 S390_lowcore.clock_comparator = clock_comparator_max;
@@ -161,7 +161,7 @@ static inline unsigned long long local_tick_disable(void) · 1 unmodified line
161161 return old;
162162 }
163163
164−static inline void local_tick_enable(unsigned long long comp)
164+static inline void local_tick_enable(unsigned long comp)
165165 {
166166 S390_lowcore.clock_comparator = comp;
167167 set_clock_comparator(S390_lowcore.clock_comparator);
@@ -169,9 +169,9 @@ static inline void local_tick_enable(unsigned long long comp) · 1 unmodified line
169169
170170 #define CLOCK_TICK_RATE 1193180 /* Underlying HZ */
171171
172−typedef unsigned long long cycles_t;
172+typedef unsigned long cycles_t;
173173
174−static inline unsigned long long get_tod_clock(void)
174+static inline unsigned long get_tod_clock(void)
175175 {
176176 union tod_clock clk;
177177
@@ -179,10 +179,10 @@ static inline unsigned long long get_tod_clock(void) · 1 unmodified line
179179 return clk.tod;
180180 }
181181
182−static inline unsigned long long get_tod_clock_fast(void)
182+static inline unsigned long get_tod_clock_fast(void)
183183 {
184184 #ifdef CONFIG_HAVE_MARCH_Z9_109_FEATURES
185− unsigned long long clk;
185+ unsigned long clk;
186186
187187 asm volatile("stckf %0" : "=Q" (clk) : : "cc");
188188 return clk;
@@ -208,9 +208,9 @@ extern union tod_clock tod_clock_base; · 19 unmodified lines
208208 * Therefore preemption must be disabled, otherwise the returned
209209 * value is not guaranteed to be monotonic.
210210 */
211−static inline unsigned long long get_tod_clock_monotonic(void)
211+static inline unsigned long get_tod_clock_monotonic(void)
212212 {
213− unsigned long long tod;
213+ unsigned long tod;
214214
215215 preempt_disable_notrace();
216216 tod = get_tod_clock() - tod_clock_base.tod;
@@ -237,7 +237,7 @@ static inline unsigned long long get_tod_clock_monotonic(void) · 20 unmodified lines
237237 * -> ns = (th * 125) + ((tl * 125) >> 9);
238238 *
239239 */
240−static inline unsigned long long tod_to_ns(unsigned long long todval)
240+static inline unsigned long tod_to_ns(unsigned long todval)
241241 {
242242 return ((todval >> 9) * 125) + (((todval & 0x1ff) * 125) >> 9);
243243 }
@@ -249,10 +249,10 @@ static inline unsigned long long tod_to_ns(unsigned long long todval) · 5 unmodified lines
249249 *
250250 * Returns: true if a is later than b
251251 */
252−static inline int tod_after(unsigned long long a, unsigned long long b)
252+static inline int tod_after(unsigned long a, unsigned long b)
253253 {
254254 if (MACHINE_HAS_SCC)
255− return (long long) a > (long long) b;
255+ return (long) a > (long) b;
256256 return a > b;
257257 }
258258
@@ -263,10 +263,10 @@ static inline int tod_after(unsigned long long a, unsigned long long b) · 4 unmodified lines
263263 *
264264 * Returns: true if a is later than b
265265 */
266−static inline int tod_after_eq(unsigned long long a, unsigned long long b)
266+static inline int tod_after_eq(unsigned long a, unsigned long b)
267267 {
268268 if (MACHINE_HAS_SCC)
269− return (long long) a >= (long long) b;
269+ return (long) a >= (long) b;
270270 return a >= b;
271271 }
272272
arch/s390/include/uapi/asm/hwctrset.hrenamed from arch/s390/include/uapi/asm/perf_cpum_cf_diag.h+0−0

File renamed without changes.

arch/s390/kernel/idle.c+6−6
@@ -47,7 +47,7 @@ void account_idle_time_irq(void) · 46 unmodified lines
4747 void arch_cpu_idle(void)
4848 {
4949 struct s390_idle_data *idle = this_cpu_ptr(&s390_idle);
50− unsigned long long idle_time;
50+ unsigned long idle_time;
5151 unsigned long psw_mask;
5252
5353 /* Wait for external, I/O or machine check interrupt. */
@@ -73,7 +73,7 @@ static ssize_t show_idle_count(struct device *dev, · 19 unmodified lines
7373 struct device_attribute *attr, char *buf)
7474 {
7575 struct s390_idle_data *idle = &per_cpu(s390_idle, dev->id);
76− unsigned long long idle_count;
76+ unsigned long idle_count;
7777 unsigned int seq;
7878
7979 do {
@@ -82,14 +82,14 @@ static ssize_t show_idle_count(struct device *dev, · 2 unmodified lines
8282 if (READ_ONCE(idle->clock_idle_enter))
8383 idle_count++;
8484 } while (read_seqcount_retry(&idle->seqcount, seq));
85− return sprintf(buf, "%llu\n", idle_count);
85+ return sprintf(buf, "%lu\n", idle_count);
8686 }
8787 DEVICE_ATTR(idle_count, 0444, show_idle_count, NULL);
8888
8989 static ssize_t show_idle_time(struct device *dev,
9090 struct device_attribute *attr, char *buf)
9191 {
92− unsigned long long now, idle_time, idle_enter, idle_exit, in_idle;
92+ unsigned long now, idle_time, idle_enter, idle_exit, in_idle;
9393 struct s390_idle_data *idle = &per_cpu(s390_idle, dev->id);
9494 unsigned int seq;
9595
@@ -109,14 +109,14 @@ static ssize_t show_idle_time(struct device *dev, · 13 unmodified lines
109109 }
110110 }
111111 idle_time += in_idle;
112− return sprintf(buf, "%llu\n", idle_time >> 12);
112+ return sprintf(buf, "%lu\n", idle_time >> 12);
113113 }
114114 DEVICE_ATTR(idle_time_us, 0444, show_idle_time, NULL);
115115
116116 u64 arch_cpu_idle_time(int cpu)
117117 {
118118 struct s390_idle_data *idle = &per_cpu(s390_idle, cpu);
119− unsigned long long now, idle_enter, idle_exit, in_idle;
119+ unsigned long now, idle_enter, idle_exit, in_idle;
120120 unsigned int seq;
121121
122122 do {
arch/s390/kernel/perf_cpum_cf.c+1−1
@@ -269,7 +269,7 @@ static int __hw_perf_event_init(struct perf_event *event, unsigned int type) · 268 unmodified lines
269269 case CPUMF_CTR_SET_MAX:
270270 /* The counter could not be associated to a counter set */
271271 return -EINVAL;
272− };
272+ }
273273
274274 /* Initialize for using the CPU-measurement counter facility */
275275 if (!atomic_inc_not_zero(&num_events)) {
arch/s390/kernel/perf_cpum_cf_diag.c+5−18
@@ -26,12 +26,10 @@ · 25 unmodified lines
2626 #include <asm/timex.h>
2727 #include <asm/debug.h>
2828
29−#include <asm/perf_cpum_cf_diag.h>
29+#include <asm/hwctrset.h>
3030
3131 #define CF_DIAG_CTRSET_DEF 0xfeef /* Counter set header mark */
32−#define CF_DIAG_MIN_INTERVAL 60 /* Minimum counter set read */
3332 /* interval in seconds */
34−static unsigned long cf_diag_interval = CF_DIAG_MIN_INTERVAL;
3533 static unsigned int cf_diag_cpu_speed;
3634 static debug_info_t *cf_diag_dbg;
3735
@@ -729,7 +727,6 @@ static DEFINE_MUTEX(cf_diag_ctrset_mutex); · 691 unmodified lines
729727 static struct cf_diag_ctrset {
730728 unsigned long ctrset; /* Bit mask of counter set to read */
731729 cpumask_t mask; /* CPU mask to read from */
732− time64_t lastread; /* Epoch counter set last read */
733730 } cf_diag_ctrset;
734731
735732 static void cf_diag_ctrset_clear(void)
@@ -866,27 +863,16 @@ static int cf_diag_all_read(unsigned long arg) · 130 unmodified lines
866863 {
867864 struct cf_diag_call_on_cpu_parm p;
868865 cpumask_var_t mask;
869− time64_t now;
870− int rc = 0;
866+ int rc;
871867
872868 debug_sprintf_event(cf_diag_dbg, 5, "%s\n", __func__);
873869 if (!alloc_cpumask_var(&mask, GFP_KERNEL))
874870 return -ENOMEM;
875− now = ktime_get_seconds();
876− if (cf_diag_ctrset.lastread + cf_diag_interval > now) {
877− debug_sprintf_event(cf_diag_dbg, 5, "%s now %lld "
878− " lastread %lld\n", __func__, now,
879− cf_diag_ctrset.lastread);
880− rc = -EAGAIN;
881− goto out;
882− } else {
883− cf_diag_ctrset.lastread = now;
884− }
871+
885872 p.sets = cf_diag_ctrset.ctrset;
886873 cpumask_and(mask, &cf_diag_ctrset.mask, cpu_online_mask);
887874 on_each_cpu_mask(mask, cf_diag_cpu_read, &p, 1);
888875 rc = cf_diag_all_copy(arg, mask);
889−out:
890876 free_cpumask_var(mask);
891877 debug_sprintf_event(cf_diag_dbg, 5, "%s rc %d\n", __func__, rc);
892878 return rc;
@@ -982,7 +968,7 @@ static int cf_diag_all_start(void) · 89 unmodified lines
982968 */
983969 static size_t cf_diag_needspace(unsigned int sets)
984970 {
985− struct cpu_cf_events *cpuhw = this_cpu_ptr(&cpu_cf_events);
971+ struct cpu_cf_events *cpuhw = get_cpu_ptr(&cpu_cf_events);
986972 size_t bytes = 0;
987973 int i;
988974
@@ -998,6 +984,7 @@ static size_t cf_diag_needspace(unsigned int sets) · 9 unmodified lines
998984 sizeof(((struct s390_ctrset_cpudata *)0)->no_sets));
999985 debug_sprintf_event(cf_diag_dbg, 5, "%s bytes %ld\n", __func__,
1000986 bytes);
987+ put_cpu_ptr(&cpu_cf_events);
1001988 return bytes;
1002989 }
1003990
arch/s390/kernel/time.c+14−14
@@ -68,10 +68,10 @@ EXPORT_SYMBOL(s390_epoch_delta_notifier); · 67 unmodified lines
6868
6969 unsigned char ptff_function_mask[16];
7070
71−static unsigned long long lpar_offset;
72−static unsigned long long initial_leap_seconds;
73−static unsigned long long tod_steering_end;
74−static long long tod_steering_delta;
71+static unsigned long lpar_offset;
72+static unsigned long initial_leap_seconds;
73+static unsigned long tod_steering_end;
74+static long tod_steering_delta;
7575
7676 /*
7777 * Get time offsets with PTFF
@@ -96,7 +96,7 @@ void __init time_early_init(void) · 18 unmodified lines
9696
9797 /* get initial leap seconds */
9898 if (ptff_query(PTFF_QUI) && ptff(&qui, sizeof(qui), PTFF_QUI) == 0)
99− initial_leap_seconds = (unsigned long long)
99+ initial_leap_seconds = (unsigned long)
100100 ((long) qui.old_leap * 4096000000L);
101101 }
102102
@@ -222,7 +222,7 @@ void __init read_persistent_wall_and_boot_offset(struct timespec64 *wall_time, · 119 unmodified lines
222222
223223 static u64 read_tod_clock(struct clocksource *cs)
224224 {
225− unsigned long long now, adj;
225+ unsigned long now, adj;
226226
227227 preempt_disable(); /* protect from changes to steering parameters */
228228 now = get_tod_clock();
@@ -362,7 +362,7 @@ static inline int check_sync_clock(void) · 133 unmodified lines
362362 * Apply clock delta to the global data structures.
363363 * This is called once on the CPU that performed the clock sync.
364364 */
365−static void clock_sync_global(unsigned long long delta)
365+static void clock_sync_global(unsigned long delta)
366366 {
367367 unsigned long now, adj;
368368 struct ptff_qto qto;
@@ -378,7 +378,7 @@ static void clock_sync_global(unsigned long long delta) · 9 unmodified lines
378378 -(adj >> 15) : (adj >> 15);
379379 tod_steering_delta += delta;
380380 if ((abs(tod_steering_delta) >> 48) != 0)
381− panic("TOD clock sync offset %lli is too large to drift\n",
381+ panic("TOD clock sync offset %li is too large to drift\n",
382382 tod_steering_delta);
383383 tod_steering_end = now + (abs(tod_steering_delta) << 15);
384384 vdso_data->arch_data.tod_steering_end = tod_steering_end;
@@ -394,7 +394,7 @@ static void clock_sync_global(unsigned long long delta) · 9 unmodified lines
394394 * Apply clock delta to the per-CPU data structures of this CPU.
395395 * This is called for each online CPU after the call to clock_sync_global.
396396 */
397−static void clock_sync_local(unsigned long long delta)
397+static void clock_sync_local(unsigned long delta)
398398 {
399399 /* Add the delta to the clock comparator. */
400400 if (S390_lowcore.clock_comparator != clock_comparator_max) {
@@ -418,7 +418,7 @@ static void __init time_init_wq(void) · 17 unmodified lines
418418 struct clock_sync_data {
419419 atomic_t cpus;
420420 int in_sync;
421− unsigned long long clock_delta;
421+ unsigned long clock_delta;
422422 };
423423
424424 /*
@@ -538,7 +538,7 @@ static int stpinfo_valid(void) · 113 unmodified lines
538538 static int stp_sync_clock(void *data)
539539 {
540540 struct clock_sync_data *sync = data;
541− unsigned long long clock_delta, flags;
541+ u64 clock_delta, flags;
542542 static int first;
543543 int rc;
544544
@@ -720,8 +720,8 @@ static ssize_t ctn_id_show(struct device *dev, · 175 unmodified lines
720720
721721 mutex_lock(&stp_mutex);
722722 if (stpinfo_valid())
723− ret = sprintf(buf, "%016llx\n",
724− *(unsigned long long *) stp_info.ctnid);
723+ ret = sprintf(buf, "%016lx\n",
724+ *(unsigned long *) stp_info.ctnid);
725725 mutex_unlock(&stp_mutex);
726726 return ret;
727727 }
@@ -794,7 +794,7 @@ static ssize_t leap_seconds_scheduled_show(struct device *dev, · 66 unmodified lines
794794 if (!stzi.lsoib.p)
795795 return sprintf(buf, "0,0\n");
796796
797− return sprintf(buf, "%llu,%d\n",
797+ return sprintf(buf, "%lu,%d\n",
798798 tod_to_ns(stzi.lsoib.nlsout - TOD_UNIX_EPOCH) / NSEC_PER_SEC,
799799 stzi.lsoib.nlso - stzi.lsoib.also);
800800 }
arch/s390/kernel/topology.c+0−2
@@ -76,8 +76,6 @@ static void cpu_group_map(cpumask_t *dst, struct mask_info *info, unsigned int c · 75 unmodified lines
7676 }
7777 info = info->next;
7878 }
79− if (cpumask_empty(&mask))
80− cpumask_copy(&mask, cpumask_of(cpu));
8179 break;
8280 case TOPOLOGY_MODE_PACKAGE:
8381 cpumask_copy(&mask, cpu_present_mask);
arch/s390/kernel/vtime.c+1−1
@@ -214,7 +214,7 @@ void vtime_flush(struct task_struct *tsk) · 213 unmodified lines
214214 avg_steal = S390_lowcore.avg_steal_timer / 2;
215215 if ((s64) steal > 0) {
216216 S390_lowcore.steal_timer = 0;
217− account_steal_time(steal);
217+ account_steal_time(cputime_to_nsecs(steal));
218218 avg_steal += steal;
219219 }
220220 S390_lowcore.avg_steal_timer = avg_steal;
arch/s390/kvm/interrupt.c+1−1
@@ -1287,7 +1287,7 @@ static u64 __calculate_sltime(struct kvm_vcpu *vcpu) · 1286 unmodified lines
12871287 /* already expired? */
12881288 if (cputm >> 63)
12891289 return 0;
1290− return min(sltime, tod_to_ns(cputm));
1290+ return min_t(u64, sltime, tod_to_ns(cputm));
12911291 }
12921292 } else if (cpu_timer_interrupts_enabled(vcpu)) {
12931293 sltime = kvm_s390_get_cpu_timer(vcpu);
arch/s390/pci/pci.c+24−4
@@ -682,16 +682,36 @@ int zpci_disable_device(struct zpci_dev *zdev) · 681 unmodified lines
682682 }
683683 EXPORT_SYMBOL_GPL(zpci_disable_device);
684684
685−void zpci_remove_device(struct zpci_dev *zdev)
685+/* zpci_remove_device - Removes the given zdev from the PCI core
686+ * @zdev: the zdev to be removed from the PCI core
687+ * @set_error: if true the device's error state is set to permanent failure
688+ *
689+ * Sets a zPCI device to a configured but offline state; the zPCI
690+ * device is still accessible through its hotplug slot and the zPCI
691+ * API but is removed from the common code PCI bus, making it
692+ * no longer available to drivers.
693+ */
694+void zpci_remove_device(struct zpci_dev *zdev, bool set_error)
686695 {
687696 struct zpci_bus *zbus = zdev->zbus;
688697 struct pci_dev *pdev;
689698
699+ if (!zdev->zbus->bus)
700+ return;
701+
690702 pdev = pci_get_slot(zbus->bus, zdev->devfn);
691703 if (pdev) {
692− if (pdev->is_virtfn)
693− return zpci_iov_remove_virtfn(pdev, zdev->vfn);
704+ if (set_error)
705+ pdev->error_state = pci_channel_io_perm_failure;
706+ if (pdev->is_virtfn) {
707+ zpci_iov_remove_virtfn(pdev, zdev->vfn);
708+ /* balance pci_get_slot */
709+ pci_dev_put(pdev);
710+ return;
711+ }
694712 pci_stop_and_remove_bus_device_locked(pdev);
713+ /* balance pci_get_slot */
714+ pci_dev_put(pdev);
695715 }
696716 }
697717
@@ -765,7 +785,7 @@ void zpci_release_device(struct kref *kref) · 67 unmodified lines
765785 struct zpci_dev *zdev = container_of(kref, struct zpci_dev, kref);
766786
767787 if (zdev->zbus->bus)
768− zpci_remove_device(zdev);
788+ zpci_remove_device(zdev, false);
769789
770790 switch (zdev->state) {
771791 case ZPCI_FN_STATE_ONLINE:
arch/s390/pci/pci_event.c+6−12
@@ -76,13 +76,10 @@ void zpci_event_error(void *data) · 75 unmodified lines
7676 static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf)
7777 {
7878 struct zpci_dev *zdev = get_zdev_by_fid(ccdf->fid);
79− struct pci_dev *pdev = NULL;
8079 enum zpci_state state;
80+ struct pci_dev *pdev;
8181 int ret;
8282
83− if (zdev && zdev->zbus->bus)
84− pdev = pci_get_slot(zdev->zbus->bus, zdev->devfn);
85−
8683 zpci_err("avail CCDF:\n");
8784 zpci_err_hex(ccdf, sizeof(*ccdf));
8885
@@ -124,8 +121,7 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf) · 35 unmodified lines
124121 case 0x0303: /* Deconfiguration requested */
125122 if (!zdev)
126123 break;
127− if (pdev)
128− zpci_remove_device(zdev);
124+ zpci_remove_device(zdev, false);
129125
130126 ret = zpci_disable_device(zdev);
131127 if (ret)
@@ -140,12 +136,10 @@ static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf) · 8 unmodified lines
140136 case 0x0304: /* Configured -> Standby|Reserved */
141137 if (!zdev)
142138 break;
143− if (pdev) {
144− /* Give the driver a hint that the function is
145− * already unusable. */
146− pdev->error_state = pci_channel_io_perm_failure;
147− zpci_remove_device(zdev);
148− }
139+ /* Give the driver a hint that the function is
140+ * already unusable.
141+ */
142+ zpci_remove_device(zdev, true);
149143
150144 zdev->fh = ccdf->fh;
151145 zpci_disable_device(zdev);
arch/x86/entry/common.c+2−1
@@ -128,7 +128,8 @@ static noinstr bool __do_fast_syscall_32(struct pt_regs *regs) · 127 unmodified lines
128128 regs->ax = -EFAULT;
129129
130130 instrumentation_end();
131− syscall_exit_to_user_mode(regs);
131+ local_irq_disable();
132+ irqentry_exit_to_user_mode(regs);
132133 return false;
133134 }
134135
arch/x86/entry/entry_64_compat.S+2−0
@@ -210,6 +210,8 @@ SYM_CODE_START(entry_SYSCALL_compat) · 209 unmodified lines
210210 /* Switch to the kernel stack */
211211 movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp
212212
213+SYM_INNER_LABEL(entry_SYSCALL_compat_safe_stack, SYM_L_GLOBAL)
214+
213215 /* Construct struct pt_regs on stack */
214216 pushq $__USER32_DS /* pt_regs->ss */
215217 pushq %r8 /* pt_regs->sp */
arch/x86/events/core.c+6−9
@@ -81,7 +81,11 @@ DEFINE_STATIC_CALL_NULL(x86_pmu_swap_task_ctx, *x86_pmu.swap_task_ctx); · 80 unmodified lines
8181 DEFINE_STATIC_CALL_NULL(x86_pmu_drain_pebs, *x86_pmu.drain_pebs);
8282 DEFINE_STATIC_CALL_NULL(x86_pmu_pebs_aliases, *x86_pmu.pebs_aliases);
8383
84−DEFINE_STATIC_CALL_NULL(x86_pmu_guest_get_msrs, *x86_pmu.guest_get_msrs);
84+/*
85+ * This one is magic, it will get called even when PMU init fails (because
86+ * there is no PMU), in which case it should simply return NULL.
87+ */
88+DEFINE_STATIC_CALL_RET0(x86_pmu_guest_get_msrs, *x86_pmu.guest_get_msrs);
8589
8690 u64 __read_mostly hw_cache_event_ids
8791 [PERF_COUNT_HW_CACHE_MAX]
@@ -1944,13 +1948,6 @@ static void _x86_pmu_read(struct perf_event *event) · 1856 unmodified lines
19441948 x86_perf_event_update(event);
19451949 }
19461950
1947−static inline struct perf_guest_switch_msr *
1948−perf_guest_get_msrs_nop(int *nr)
1949−{
1950− *nr = 0;
1951− return NULL;
1952−}
1953−
19541951 static int __init init_hw_perf_events(void)
19551952 {
19561953 struct x86_pmu_quirk *quirk;
@@ -2025,7 +2022,7 @@ static int __init init_hw_perf_events(void) · 68 unmodified lines
20252022 x86_pmu.read = _x86_pmu_read;
20262023
20272024 if (!x86_pmu.guest_get_msrs)
2028− x86_pmu.guest_get_msrs = perf_guest_get_msrs_nop;
2025+ x86_pmu.guest_get_msrs = (void *)&__static_call_return0;
20292026
20302027 x86_pmu_static_call_update();
20312028
arch/x86/events/intel/core.c+7−1
@@ -3659,11 +3659,16 @@ static int intel_pmu_hw_config(struct perf_event *event) · 3658 unmodified lines
36593659 return ret;
36603660
36613661 if (event->attr.precise_ip) {
3662+ if ((event->attr.config & INTEL_ARCH_EVENT_MASK) == INTEL_FIXED_VLBR_EVENT)
3663+ return -EINVAL;
3664+
36623665 if (!(event->attr.freq || (event->attr.wakeup_events && !event->attr.watermark))) {
36633666 event->hw.flags |= PERF_X86_EVENT_AUTO_RELOAD;
36643667 if (!(event->attr.sample_type &
3665− ~intel_pmu_large_pebs_flags(event)))
3668+ ~intel_pmu_large_pebs_flags(event))) {
36663669 event->hw.flags |= PERF_X86_EVENT_LARGE_PEBS;
3670+ event->attach_state |= PERF_ATTACH_SCHED_CB;
3671+ }
36673672 }
36683673 if (x86_pmu.pebs_aliases)
36693674 x86_pmu.pebs_aliases(event);
@@ -3676,6 +3681,7 @@ static int intel_pmu_hw_config(struct perf_event *event) · 6 unmodified lines
36763681 ret = intel_pmu_setup_lbr_filter(event);
36773682 if (ret)
36783683 return ret;
3684+ event->attach_state |= PERF_ATTACH_SCHED_CB;
36793685
36803686 /*
36813687 * BTS is set up earlier in this path, so don't account twice
arch/x86/events/intel/ds.c+1−1
@@ -2010,7 +2010,7 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs, struct perf_sample_d · 2009 unmodified lines
20102010 */
20112011 if (!pebs_status && cpuc->pebs_enabled &&
20122012 !(cpuc->pebs_enabled & (cpuc->pebs_enabled-1)))
2013− pebs_status = cpuc->pebs_enabled;
2013+ pebs_status = p->status = cpuc->pebs_enabled;
20142014
20152015 bit = find_first_bit((unsigned long *)&pebs_status,
20162016 x86_pmu.max_pebs_events);
arch/x86/include/asm/insn-eval.h+2−0
@@ -23,6 +23,8 @@ unsigned long insn_get_seg_base(struct pt_regs *regs, int seg_reg_idx); · 22 unmodified lines
2323 int insn_get_code_seg_params(struct pt_regs *regs);
2424 int insn_fetch_from_user(struct pt_regs *regs,
2525 unsigned char buf[MAX_INSN_SIZE]);
26+int insn_fetch_from_user_inatomic(struct pt_regs *regs,
27+ unsigned char buf[MAX_INSN_SIZE]);
2628 bool insn_decode(struct insn *insn, struct pt_regs *regs,
2729 unsigned char buf[MAX_INSN_SIZE], int buf_size);
2830
arch/x86/include/asm/kvm_host.h+28−10
@@ -884,12 +884,29 @@ struct kvm_hv_syndbg { · 883 unmodified lines
884884 u64 options;
885885 };
886886
887+/* Current state of Hyper-V TSC page clocksource */
888+enum hv_tsc_page_status {
889+ /* TSC page was not set up or disabled */
890+ HV_TSC_PAGE_UNSET = 0,
891+ /* TSC page MSR was written by the guest, update pending */
892+ HV_TSC_PAGE_GUEST_CHANGED,
893+ /* TSC page MSR was written by KVM userspace, update pending */
894+ HV_TSC_PAGE_HOST_CHANGED,
895+ /* TSC page was properly set up and is currently active */
896+ HV_TSC_PAGE_SET,
897+ /* TSC page is currently being updated and therefore is inactive */
898+ HV_TSC_PAGE_UPDATING,
899+ /* TSC page was set up with an inaccessible GPA */
900+ HV_TSC_PAGE_BROKEN,
901+};
902+
887903 /* Hyper-V emulation context */
888904 struct kvm_hv {
889905 struct mutex hv_lock;
890906 u64 hv_guest_os_id;
891907 u64 hv_hypercall;
892908 u64 hv_tsc_page;
909+ enum hv_tsc_page_status hv_tsc_page_status;
893910
894911 /* Hyper-v based guest crash (NT kernel bugcheck) parameters */
895912 u64 hv_crash_param[HV_X64_MSR_CRASH_PARAMS];
@@ -931,6 +948,12 @@ enum kvm_irqchip_mode { · 35 unmodified lines
931948 KVM_IRQCHIP_SPLIT, /* created with KVM_CAP_SPLIT_IRQCHIP */
932949 };
933950
951+struct kvm_x86_msr_filter {
952+ u8 count;
953+ bool default_allow:1;
954+ struct msr_bitmap_range ranges[16];
955+};
956+
934957 #define APICV_INHIBIT_REASON_DISABLE 0
935958 #define APICV_INHIBIT_REASON_HYPERV 1
936959 #define APICV_INHIBIT_REASON_NESTED 2
@@ -963,7 +986,7 @@ struct kvm_arch { · 26 unmodified lines
963986 struct kvm_pit *vpit;
964987 atomic_t vapics_in_nmi_mode;
965988 struct mutex apic_map_lock;
966− struct kvm_apic_map *apic_map;
989+ struct kvm_apic_map __rcu *apic_map;
967990 atomic_t apic_map_dirty;
968991
969992 bool apic_access_page_done;
@@ -1025,18 +1048,13 @@ struct kvm_arch { · 55 unmodified lines
10251048 bool guest_can_read_msr_platform_info;
10261049 bool exception_payload_enabled;
10271050
1051+ bool bus_lock_detection_enabled;
1052+
10281053 /* Deflect RDMSR and WRMSR to user space when they trigger a #GP */
10291054 u32 user_space_msr_mask;
1055+ struct kvm_x86_msr_filter __rcu *msr_filter;
10301056
1031− struct {
1032− u8 count;
1033− bool default_allow:1;
1034− struct msr_bitmap_range ranges[16];
1035− } msr_filter;
1036−
1037− bool bus_lock_detection_enabled;
1038−
1039− struct kvm_pmu_event_filter *pmu_event_filter;
1057+ struct kvm_pmu_event_filter __rcu *pmu_event_filter;
10401058 struct task_struct *nx_lpage_recovery_thread;
10411059
10421060 #ifdef CONFIG_X86_64
arch/x86/include/asm/processor.h+0−9
@@ -551,15 +551,6 @@ static inline void arch_thread_struct_whitelist(unsigned long *offset, · 550 unmodified lines
551551 *size = fpu_kernel_xstate_size;
552552 }
553553
554−/*
555− * Thread-synchronous status.
556− *
557− * This is different from the flags in that nobody else
558− * ever touches our thread-synchronous status, so we don't
559− * have to worry about atomic accesses.
560− */
561−#define TS_COMPAT 0x0002 /* 32bit syscall active (64BIT)*/
562−
563554 static inline void
564555 native_load_sp0(unsigned long sp0)
565556 {
arch/x86/include/asm/proto.h+1−0
@@ -25,6 +25,7 @@ void __end_SYSENTER_singlestep_region(void); · 24 unmodified lines
2525 void entry_SYSENTER_compat(void);
2626 void __end_entry_SYSENTER_compat(void);
2727 void entry_SYSCALL_compat(void);
28+void entry_SYSCALL_compat_safe_stack(void);
2829 void entry_INT80_compat(void);
2930 #ifdef CONFIG_XEN_PV
3031 void xen_entry_INT80_compat(void);
arch/x86/include/asm/ptrace.h+15−0
@@ -94,6 +94,8 @@ struct pt_regs { · 93 unmodified lines
9494 #include <asm/paravirt_types.h>
9595 #endif
9696
97+#include <asm/proto.h>
98+
9799 struct cpuinfo_x86;
98100 struct task_struct;
99101
@@ -175,6 +177,19 @@ static inline bool any_64bit_mode(struct pt_regs *regs) · 75 unmodified lines
175177 #ifdef CONFIG_X86_64
176178 #define current_user_stack_pointer() current_pt_regs()->sp
177179 #define compat_user_stack_pointer() current_pt_regs()->sp
180+
181+static inline bool ip_within_syscall_gap(struct pt_regs *regs)
182+{
183+ bool ret = (regs->ip >= (unsigned long)entry_SYSCALL_64 &&
184+ regs->ip < (unsigned long)entry_SYSCALL_64_safe_stack);
185+
186+#ifdef CONFIG_IA32_EMULATION
187+ ret = ret || (regs->ip >= (unsigned long)entry_SYSCALL_compat &&
188+ regs->ip < (unsigned long)entry_SYSCALL_compat_safe_stack);
189+#endif
190+
191+ return ret;
192+}
178193 #endif
179194
180195 static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
arch/x86/include/asm/smap.h+4−6
@@ -58,9 +58,8 @@ static __always_inline unsigned long smap_save(void) · 57 unmodified lines
5858 unsigned long flags;
5959
6060 asm volatile ("# smap_save\n\t"
61− ALTERNATIVE("jmp 1f", "", X86_FEATURE_SMAP)
62− "pushf; pop %0; " __ASM_CLAC "\n\t"
63− "1:"
61+ ALTERNATIVE("", "pushf; pop %0; " __ASM_CLAC "\n\t",
62+ X86_FEATURE_SMAP)
6463 : "=rm" (flags) : : "memory", "cc");
6564
6665 return flags;
@@ -69,9 +68,8 @@ static __always_inline unsigned long smap_save(void) · 2 unmodified lines
6968 static __always_inline void smap_restore(unsigned long flags)
7069 {
7170 asm volatile ("# smap_restore\n\t"
72− ALTERNATIVE("jmp 1f", "", X86_FEATURE_SMAP)
73− "push %0; popf\n\t"
74− "1:"
71+ ALTERNATIVE("", "push %0; popf\n\t",
72+ X86_FEATURE_SMAP)
7573 : : "g" (flags) : "memory", "cc");
7674 }
7775
arch/x86/include/asm/thread_info.h+14−1
@@ -205,10 +205,23 @@ static inline int arch_within_stack_frames(const void * const stack, · 204 unmodified lines
205205
206206 #endif
207207
208+/*
209+ * Thread-synchronous status.
210+ *
211+ * This is different from the flags in that nobody else
212+ * ever touches our thread-synchronous status, so we don't
213+ * have to worry about atomic accesses.
214+ */
215+#define TS_COMPAT 0x0002 /* 32bit syscall active (64BIT)*/
216+
217+#ifndef __ASSEMBLY__
208218 #ifdef CONFIG_COMPAT
209219 #define TS_I386_REGS_POKED 0x0004 /* regs poked by 32-bit ptracer */
220+
221+#define arch_set_restart_data(restart) \
222+ do { restart->arch_data = current_thread_info()->status; } while (0)
223+
210224 #endif
211−#ifndef __ASSEMBLY__
212225
213226 #ifdef CONFIG_X86_32
214227 #define in_ia32_syscall() true
arch/x86/kernel/apic/apic.c+5−0
@@ -2342,6 +2342,11 @@ static int cpuid_to_apicid[] = { · 2341 unmodified lines
23422342 [0 ... NR_CPUS - 1] = -1,
23432343 };
23442344
2345+bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
2346+{
2347+ return phys_id == cpuid_to_apicid[cpu];
2348+}
2349+
23452350 #ifdef CONFIG_SMP
23462351 /**
23472352 * apic_id_is_primary_thread - Check whether APIC ID belongs to a primary thread
arch/x86/kernel/apic/io_apic.c+10−0
@@ -1032,6 +1032,16 @@ static int mp_map_pin_to_irq(u32 gsi, int idx, int ioapic, int pin, · 1031 unmodified lines
10321032 if (idx >= 0 && test_bit(mp_irqs[idx].srcbus, mp_bus_not_pci)) {
10331033 irq = mp_irqs[idx].srcbusirq;
10341034 legacy = mp_is_legacy_irq(irq);
1035+ /*
1036+ * IRQ2 is unusable for historical reasons on systems which
1037+ * have a legacy PIC. See the comment vs. IRQ2 further down.
1038+ *
1039+ * If this gets removed at some point then the related code
1040+ * in lapic_assign_system_vectors() needs to be adjusted as
1041+ * well.
1042+ */
1043+ if (legacy && irq == PIC_CASCADE_IR)
1044+ return -EINVAL;
10351045 }
10361046
10371047 mutex_lock(&ioapic_mutex);
arch/x86/kernel/kprobes/ftrace.c+1−1
@@ -12,7 +12,7 @@ · 11 unmodified lines
1212
1313 #include "common.h"
1414
15−/* Ftrace callback handler for kprobes -- called under preepmt disabed */
15+/* Ftrace callback handler for kprobes -- called under preepmt disabled */
1616 void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
1717 struct ftrace_ops *ops, struct ftrace_regs *fregs)
1818 {
arch/x86/kernel/kvm.c+10−13
@@ -836,28 +836,25 @@ static void kvm_kick_cpu(int cpu) · 835 unmodified lines
836836
837837 static void kvm_wait(u8 *ptr, u8 val)
838838 {
839− unsigned long flags;
840−
841839 if (in_nmi())
842840 return;
843841
844− local_irq_save(flags);
845−
846− if (READ_ONCE(*ptr) != val)
847− goto out;
848−
849842 /*
850843 * halt until it's our turn and kicked. Note that we do safe halt
851844 * for irq enabled case to avoid hang when lock info is overwritten
852845 * in irq spinlock slowpath and no spurious interrupt occur to save us.
853846 */
854− if (arch_irqs_disabled_flags(flags))
855− halt();
856− else
857− safe_halt();
847+ if (irqs_disabled()) {
848+ if (READ_ONCE(*ptr) == val)
849+ halt();
850+ } else {
851+ local_irq_disable();
858852
859−out:
860− local_irq_restore(flags);
853+ if (READ_ONCE(*ptr) == val)
854+ safe_halt();
855+
856+ local_irq_enable();
857+ }
861858 }
862859
863860 #ifdef CONFIG_X86_32
arch/x86/kernel/kvmclock.c+9−10
@@ -268,21 +268,20 @@ static void __init kvmclock_init_mem(void) · 267 unmodified lines
268268
269269 static int __init kvm_setup_vsyscall_timeinfo(void)
270270 {
271−#ifdef CONFIG_X86_64
272− u8 flags;
271+ kvmclock_init_mem();
273272
274− if (!per_cpu(hv_clock_per_cpu, 0) || !kvmclock_vsyscall)
275− return 0;
273+#ifdef CONFIG_X86_64
274+ if (per_cpu(hv_clock_per_cpu, 0) && kvmclock_vsyscall) {
275+ u8 flags;
276276
277− flags = pvclock_read_flags(&hv_clock_boot[0].pvti);
278− if (!(flags & PVCLOCK_TSC_STABLE_BIT))
279− return 0;
277+ flags = pvclock_read_flags(&hv_clock_boot[0].pvti);
278+ if (!(flags & PVCLOCK_TSC_STABLE_BIT))
279+ return 0;
280280
281− kvm_clock.vdso_clock_mode = VDSO_CLOCKMODE_PVCLOCK;
281+ kvm_clock.vdso_clock_mode = VDSO_CLOCKMODE_PVCLOCK;
282+ }
282283 #endif
283284
284− kvmclock_init_mem();
285−
286285 return 0;
287286 }
288287 early_initcall(kvm_setup_vsyscall_timeinfo);
arch/x86/kernel/sev-es.c+17−5
@@ -121,8 +121,18 @@ static void __init setup_vc_stacks(int cpu) · 120 unmodified lines
121121 cea_set_pte((void *)vaddr, pa, PAGE_KERNEL);
122122 }
123123
124−static __always_inline bool on_vc_stack(unsigned long sp)
124+static __always_inline bool on_vc_stack(struct pt_regs *regs)
125125 {
126+ unsigned long sp = regs->sp;
127+
128+ /* User-mode RSP is not trusted */
129+ if (user_mode(regs))
130+ return false;
131+
132+ /* SYSCALL gap still has user-mode RSP */
133+ if (ip_within_syscall_gap(regs))
134+ return false;
135+
126136 return ((sp >= __this_cpu_ist_bottom_va(VC)) && (sp < __this_cpu_ist_top_va(VC)));
127137 }
128138
@@ -144,7 +154,7 @@ void noinstr __sev_es_ist_enter(struct pt_regs *regs) · 15 unmodified lines
144154 old_ist = __this_cpu_read(cpu_tss_rw.x86_tss.ist[IST_INDEX_VC]);
145155
146156 /* Make room on the IST stack */
147− if (on_vc_stack(regs->sp))
157+ if (on_vc_stack(regs))
148158 new_ist = ALIGN_DOWN(regs->sp, 8) - sizeof(old_ist);
149159 else
150160 new_ist = old_ist - sizeof(old_ist);
@@ -248,7 +258,7 @@ static enum es_result vc_decode_insn(struct es_em_ctxt *ctxt) · 97 unmodified lines
248258 int res;
249259
250260 if (user_mode(ctxt->regs)) {
251− res = insn_fetch_from_user(ctxt->regs, buffer);
261+ res = insn_fetch_from_user_inatomic(ctxt->regs, buffer);
252262 if (!res) {
253263 ctxt->fi.vector = X86_TRAP_PF;
254264 ctxt->fi.error_code = X86_PF_INSTR | X86_PF_USER;
@@ -1248,13 +1258,12 @@ static __always_inline bool on_vc_fallback_stack(struct pt_regs *regs) · 993 unmodified lines
12481258 DEFINE_IDTENTRY_VC_SAFE_STACK(exc_vmm_communication)
12491259 {
12501260 struct sev_es_runtime_data *data = this_cpu_read(runtime_data);
1261+ irqentry_state_t irq_state;
12511262 struct ghcb_state state;
12521263 struct es_em_ctxt ctxt;
12531264 enum es_result result;
12541265 struct ghcb *ghcb;
12551266
1256− lockdep_assert_irqs_disabled();
1257−
12581267 /*
12591268 * Handle #DB before calling into !noinstr code to avoid recursive #DB.
12601269 */
@@ -1263,6 +1272,8 @@ DEFINE_IDTENTRY_VC_SAFE_STACK(exc_vmm_communication) · 2 unmodified lines
12631272 return;
12641273 }
12651274
1275+ irq_state = irqentry_nmi_enter(regs);
1276+ lockdep_assert_irqs_disabled();
12661277 instrumentation_begin();
12671278
12681279 /*
@@ -1325,6 +1336,7 @@ DEFINE_IDTENTRY_VC_SAFE_STACK(exc_vmm_communication) · 56 unmodified lines
13251336
13261337 out:
13271338 instrumentation_end();
1339+ irqentry_nmi_exit(regs, irq_state);
13281340
13291341 return;
13301342
arch/x86/kernel/signal.c+1−23
@@ -766,30 +766,8 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs) · 765 unmodified lines
766766
767767 static inline unsigned long get_nr_restart_syscall(const struct pt_regs *regs)
768768 {
769− /*
770− * This function is fundamentally broken as currently
771− * implemented.
772− *
773− * The idea is that we want to trigger a call to the
774− * restart_block() syscall and that we want in_ia32_syscall(),
775− * in_x32_syscall(), etc. to match whatever they were in the
776− * syscall being restarted. We assume that the syscall
777− * instruction at (regs->ip - 2) matches whatever syscall
778− * instruction we used to enter in the first place.
779− *
780− * The problem is that we can get here when ptrace pokes
781− * syscall-like values into regs even if we're not in a syscall
782− * at all.
783− *
784− * For now, we maintain historical behavior and guess based on
785− * stored state. We could do better by saving the actual
786− * syscall arch in restart_block or (with caveats on x32) by
787− * checking if regs->ip points to 'int $0x80'. The current
788− * behavior is incorrect if a tracer has a different bitness
789− * than the tracee.
790− */
791769 #ifdef CONFIG_IA32_EMULATION
792− if (current_thread_info()->status & (TS_COMPAT|TS_I386_REGS_POKED))
770+ if (current->restart_block.arch_data & TS_COMPAT)
793771 return __NR_ia32_restart_syscall;
794772 #endif
795773 #ifdef CONFIG_X86_X32_ABI
arch/x86/kernel/traps.c+1−2
@@ -694,8 +694,7 @@ asmlinkage __visible noinstr struct pt_regs *vc_switch_off_ist(struct pt_regs *r · 693 unmodified lines
694694 * In the SYSCALL entry path the RSP value comes from user-space - don't
695695 * trust it and switch to the current kernel stack
696696 */
697− if (regs->ip >= (unsigned long)entry_SYSCALL_64 &&
698− regs->ip < (unsigned long)entry_SYSCALL_64_safe_stack) {
697+ if (ip_within_syscall_gap(regs)) {
699698 sp = this_cpu_read(cpu_current_top_of_stack);
700699 goto sync;
701700 }
arch/x86/kernel/unwind_orc.c+7−7
@@ -13,7 +13,7 @@ · 12 unmodified lines
1313
1414 #define orc_warn_current(args...) \
1515 ({ \
16− if (state->task == current) \
16+ if (state->task == current && !state->error) \
1717 orc_warn(args); \
1818 })
1919
@@ -367,8 +367,8 @@ static bool deref_stack_regs(struct unwind_state *state, unsigned long addr, · 347 unmodified lines
367367 if (!stack_access_ok(state, addr, sizeof(struct pt_regs)))
368368 return false;
369369
370− *ip = regs->ip;
371− *sp = regs->sp;
370+ *ip = READ_ONCE_NOCHECK(regs->ip);
371+ *sp = READ_ONCE_NOCHECK(regs->sp);
372372 return true;
373373 }
374374
@@ -380,8 +380,8 @@ static bool deref_stack_iret_regs(struct unwind_state *state, unsigned long addr · 5 unmodified lines
380380 if (!stack_access_ok(state, addr, IRET_FRAME_SIZE))
381381 return false;
382382
383− *ip = regs->ip;
384− *sp = regs->sp;
383+ *ip = READ_ONCE_NOCHECK(regs->ip);
384+ *sp = READ_ONCE_NOCHECK(regs->sp);
385385 return true;
386386 }
387387
@@ -402,12 +402,12 @@ static bool get_reg(struct unwind_state *state, unsigned int reg_off, · 14 unmodified lines
402402 return false;
403403
404404 if (state->full_regs) {
405− *val = ((unsigned long *)state->regs)[reg];
405+ *val = READ_ONCE_NOCHECK(((unsigned long *)state->regs)[reg]);
406406 return true;
407407 }
408408
409409 if (state->prev_regs) {
410− *val = ((unsigned long *)state->prev_regs)[reg];
410+ *val = READ_ONCE_NOCHECK(((unsigned long *)state->prev_regs)[reg]);
411411 return true;
412412 }
413413
arch/x86/kvm/hyperv.c+81−10
@@ -520,10 +520,10 @@ static u64 get_time_ref_counter(struct kvm *kvm) · 519 unmodified lines
520520 u64 tsc;
521521
522522 /*
523− * The guest has not set up the TSC page or the clock isn't
524− * stable, fall back to get_kvmclock_ns.
523+ * Fall back to get_kvmclock_ns() when TSC page hasn't been set up,
524+ * is broken, disabled or being updated.
525525 */
526− if (!hv->tsc_ref.tsc_sequence)
526+ if (hv->hv_tsc_page_status != HV_TSC_PAGE_SET)
527527 return div_u64(get_kvmclock_ns(kvm), 100);
528528
529529 vcpu = kvm_get_vcpu(kvm, 0);
@@ -1077,6 +1077,21 @@ static bool compute_tsc_page_parameters(struct pvclock_vcpu_time_info *hv_clock, · 547 unmodified lines
10771077 return true;
10781078 }
10791079
1080+/*
1081+ * Don't touch TSC page values if the guest has opted for TSC emulation after
1082+ * migration. KVM doesn't fully support reenlightenment notifications and TSC
1083+ * access emulation and Hyper-V is known to expect the values in TSC page to
1084+ * stay constant before TSC access emulation is disabled from guest side
1085+ * (HV_X64_MSR_TSC_EMULATION_STATUS). KVM userspace is expected to preserve TSC
1086+ * frequency and guest visible TSC value across migration (and prevent it when
1087+ * TSC scaling is unsupported).
1088+ */
1089+static inline bool tsc_page_update_unsafe(struct kvm_hv *hv)
1090+{
1091+ return (hv->hv_tsc_page_status != HV_TSC_PAGE_GUEST_CHANGED) &&
1092+ hv->hv_tsc_emulation_control;
1093+}
1094+
10801095 void kvm_hv_setup_tsc_page(struct kvm *kvm,
10811096 struct pvclock_vcpu_time_info *hv_clock)
10821097 {
@@ -1087,7 +1102,8 @@ void kvm_hv_setup_tsc_page(struct kvm *kvm, · 4 unmodified lines
10871102 BUILD_BUG_ON(sizeof(tsc_seq) != sizeof(hv->tsc_ref.tsc_sequence));
10881103 BUILD_BUG_ON(offsetof(struct ms_hyperv_tsc_page, tsc_sequence) != 0);
10891104
1090− if (!(hv->hv_tsc_page & HV_X64_MSR_TSC_REFERENCE_ENABLE))
1105+ if (hv->hv_tsc_page_status == HV_TSC_PAGE_BROKEN ||
1106+ hv->hv_tsc_page_status == HV_TSC_PAGE_UNSET)
10911107 return;
10921108
10931109 mutex_lock(&hv->hv_lock);
@@ -1101,7 +1117,15 @@ void kvm_hv_setup_tsc_page(struct kvm *kvm, · 7 unmodified lines
11011117 */
11021118 if (unlikely(kvm_read_guest(kvm, gfn_to_gpa(gfn),
11031119 &tsc_seq, sizeof(tsc_seq))))
1120+ goto out_err;
1121+
1122+ if (tsc_seq && tsc_page_update_unsafe(hv)) {
1123+ if (kvm_read_guest(kvm, gfn_to_gpa(gfn), &hv->tsc_ref, sizeof(hv->tsc_ref)))
1124+ goto out_err;
1125+
1126+ hv->hv_tsc_page_status = HV_TSC_PAGE_SET;
11041127 goto out_unlock;
1128+ }
11051129
11061130 /*
11071131 * While we're computing and writing the parameters, force the
@@ -1110,15 +1134,15 @@ void kvm_hv_setup_tsc_page(struct kvm *kvm, · 2 unmodified lines
11101134 hv->tsc_ref.tsc_sequence = 0;
11111135 if (kvm_write_guest(kvm, gfn_to_gpa(gfn),
11121136 &hv->tsc_ref, sizeof(hv->tsc_ref.tsc_sequence)))
1113− goto out_unlock;
1137+ goto out_err;
11141138
11151139 if (!compute_tsc_page_parameters(hv_clock, &hv->tsc_ref))
1116− goto out_unlock;
1140+ goto out_err;
11171141
11181142 /* Ensure sequence is zero before writing the rest of the struct. */
11191143 smp_wmb();
11201144 if (kvm_write_guest(kvm, gfn_to_gpa(gfn), &hv->tsc_ref, sizeof(hv->tsc_ref)))
1121− goto out_unlock;
1145+ goto out_err;
11221146
11231147 /*
11241148 * Now switch to the TSC page mechanism by writing the sequence.
@@ -1131,8 +1155,45 @@ void kvm_hv_setup_tsc_page(struct kvm *kvm, · 6 unmodified lines
11311155 smp_wmb();
11321156
11331157 hv->tsc_ref.tsc_sequence = tsc_seq;
1134− kvm_write_guest(kvm, gfn_to_gpa(gfn),
1135− &hv->tsc_ref, sizeof(hv->tsc_ref.tsc_sequence));
1158+ if (kvm_write_guest(kvm, gfn_to_gpa(gfn),
1159+ &hv->tsc_ref, sizeof(hv->tsc_ref.tsc_sequence)))
1160+ goto out_err;
1161+
1162+ hv->hv_tsc_page_status = HV_TSC_PAGE_SET;
1163+ goto out_unlock;
1164+
1165+out_err:
1166+ hv->hv_tsc_page_status = HV_TSC_PAGE_BROKEN;
1167+out_unlock:
1168+ mutex_unlock(&hv->hv_lock);
1169+}
1170+
1171+void kvm_hv_invalidate_tsc_page(struct kvm *kvm)
1172+{
1173+ struct kvm_hv *hv = to_kvm_hv(kvm);
1174+ u64 gfn;
1175+
1176+ if (hv->hv_tsc_page_status == HV_TSC_PAGE_BROKEN ||
1177+ hv->hv_tsc_page_status == HV_TSC_PAGE_UNSET ||
1178+ tsc_page_update_unsafe(hv))
1179+ return;
1180+
1181+ mutex_lock(&hv->hv_lock);
1182+
1183+ if (!(hv->hv_tsc_page & HV_X64_MSR_TSC_REFERENCE_ENABLE))
1184+ goto out_unlock;
1185+
1186+ /* Preserve HV_TSC_PAGE_GUEST_CHANGED/HV_TSC_PAGE_HOST_CHANGED states */
1187+ if (hv->hv_tsc_page_status == HV_TSC_PAGE_SET)
1188+ hv->hv_tsc_page_status = HV_TSC_PAGE_UPDATING;
1189+
1190+ gfn = hv->hv_tsc_page >> HV_X64_MSR_TSC_REFERENCE_ADDRESS_SHIFT;
1191+
1192+ hv->tsc_ref.tsc_sequence = 0;
1193+ if (kvm_write_guest(kvm, gfn_to_gpa(gfn),
1194+ &hv->tsc_ref, sizeof(hv->tsc_ref.tsc_sequence)))
1195+ hv->hv_tsc_page_status = HV_TSC_PAGE_BROKEN;
1196+
11361197 out_unlock:
11371198 mutex_unlock(&hv->hv_lock);
11381199 }
@@ -1193,8 +1254,15 @@ static int kvm_hv_set_msr_pw(struct kvm_vcpu *vcpu, u32 msr, u64 data, · 54 unmodified lines
11931254 }
11941255 case HV_X64_MSR_REFERENCE_TSC:
11951256 hv->hv_tsc_page = data;
1196− if (hv->hv_tsc_page & HV_X64_MSR_TSC_REFERENCE_ENABLE)
1257+ if (hv->hv_tsc_page & HV_X64_MSR_TSC_REFERENCE_ENABLE) {
1258+ if (!host)
1259+ hv->hv_tsc_page_status = HV_TSC_PAGE_GUEST_CHANGED;
1260+ else
1261+ hv->hv_tsc_page_status = HV_TSC_PAGE_HOST_CHANGED;
11971262 kvm_make_request(KVM_REQ_MASTERCLOCK_UPDATE, vcpu);
1263+ } else {
1264+ hv->hv_tsc_page_status = HV_TSC_PAGE_UNSET;
1265+ }
11981266 break;
11991267 case HV_X64_MSR_CRASH_P0 ... HV_X64_MSR_CRASH_P4:
12001268 return kvm_hv_msr_set_crash_data(kvm,
@@ -1229,6 +1297,9 @@ static int kvm_hv_set_msr_pw(struct kvm_vcpu *vcpu, u32 msr, u64 data, · 28 unmodified lines
12291297 hv->hv_tsc_emulation_control = data;
12301298 break;
12311299 case HV_X64_MSR_TSC_EMULATION_STATUS:
1300+ if (data && !host)
1301+ return 1;
1302+
12321303 hv->hv_tsc_emulation_status = data;
12331304 break;
12341305 case HV_X64_MSR_TIME_REF_COUNT:
arch/x86/kvm/hyperv.h+1−0
@@ -133,6 +133,7 @@ void kvm_hv_process_stimers(struct kvm_vcpu *vcpu); · 132 unmodified lines
133133
134134 void kvm_hv_setup_tsc_page(struct kvm *kvm,
135135 struct pvclock_vcpu_time_info *hv_clock);
136+void kvm_hv_invalidate_tsc_page(struct kvm *kvm);
136137
137138 void kvm_hv_init_vm(struct kvm *kvm);
138139 void kvm_hv_destroy_vm(struct kvm *kvm);
arch/x86/kvm/lapic.c+11−1
@@ -1642,7 +1642,16 @@ static void apic_timer_expired(struct kvm_lapic *apic, bool from_timer_fn) · 1641 unmodified lines
16421642 }
16431643
16441644 if (kvm_use_posted_timer_interrupt(apic->vcpu)) {
1645− kvm_wait_lapic_expire(vcpu);
1645+ /*
1646+ * Ensure the guest's timer has truly expired before posting an
1647+ * interrupt. Open code the relevant checks to avoid querying
1648+ * lapic_timer_int_injected(), which will be false since the
1649+ * interrupt isn't yet injected. Waiting until after injecting
1650+ * is not an option since that won't help a posted interrupt.
1651+ */
1652+ if (vcpu->arch.apic->lapic_timer.expired_tscdeadline &&
1653+ vcpu->arch.apic->lapic_timer.timer_advance_ns)
1654+ __kvm_wait_lapic_expire(vcpu);
16461655 kvm_apic_inject_pending_timer_irqs(apic);
16471656 return;
16481657 }
@@ -2595,6 +2604,7 @@ int kvm_apic_set_state(struct kvm_vcpu *vcpu, struct kvm_lapic_state *s) · 946 unmodified lines
25952604
25962605 apic_update_ppr(apic);
25972606 hrtimer_cancel(&apic->lapic_timer.timer);
2607+ apic->lapic_timer.expired_tscdeadline = 0;
25982608 apic_update_lvtt(apic);
25992609 apic_manage_nmi_watchdog(apic, kvm_lapic_get_reg(apic, APIC_LVT0));
26002610 update_divide_count(apic);
arch/x86/kvm/mmu/mmu_internal.h+5−0
@@ -78,6 +78,11 @@ static inline struct kvm_mmu_page *sptep_to_sp(u64 *sptep) · 77 unmodified lines
7878 return to_shadow_page(__pa(sptep));
7979 }
8080
81+static inline int kvm_mmu_page_as_id(struct kvm_mmu_page *sp)
82+{
83+ return sp->role.smm ? 1 : 0;
84+}
85+
8186 static inline bool kvm_vcpu_ad_need_write_protect(struct kvm_vcpu *vcpu)
8287 {
8388 /*
arch/x86/kvm/mmu/tdp_iter.c+18−12
@@ -20,6 +20,21 @@ static gfn_t round_gfn_for_level(gfn_t gfn, int level) · 19 unmodified lines
2020 return gfn & -KVM_PAGES_PER_HPAGE(level);
2121 }
2222
23+/*
24+ * Return the TDP iterator to the root PT and allow it to continue its
25+ * traversal over the paging structure from there.
26+ */
27+void tdp_iter_restart(struct tdp_iter *iter)
28+{
29+ iter->yielded_gfn = iter->next_last_level_gfn;
30+ iter->level = iter->root_level;
31+
32+ iter->gfn = round_gfn_for_level(iter->next_last_level_gfn, iter->level);
33+ tdp_iter_refresh_sptep(iter);
34+
35+ iter->valid = true;
36+}
37+
2338 /*
2439 * Sets a TDP iterator to walk a pre-order traversal of the paging structure
2540 * rooted at root_pt, starting with the walk to translate next_last_level_gfn.
@@ -31,16 +46,12 @@ void tdp_iter_start(struct tdp_iter *iter, u64 *root_pt, int root_level, · 5 unmodified lines
3146 WARN_ON(root_level > PT64_ROOT_MAX_LEVEL);
3247
3348 iter->next_last_level_gfn = next_last_level_gfn;
34− iter->yielded_gfn = iter->next_last_level_gfn;
3549 iter->root_level = root_level;
3650 iter->min_level = min_level;
37− iter->level = root_level;
38− iter->pt_path[iter->level - 1] = (tdp_ptep_t)root_pt;
39−
40− iter->gfn = round_gfn_for_level(iter->next_last_level_gfn, iter->level);
41− tdp_iter_refresh_sptep(iter);
51+ iter->pt_path[iter->root_level - 1] = (tdp_ptep_t)root_pt;
52+ iter->as_id = kvm_mmu_page_as_id(sptep_to_sp(root_pt));
4253
43− iter->valid = true;
54+ tdp_iter_restart(iter);
4455 }
4556
4657 /*
@@ -159,8 +170,3 @@ void tdp_iter_next(struct tdp_iter *iter) · 112 unmodified lines
159170 iter->valid = false;
160171 }
161172
162−tdp_ptep_t tdp_iter_root_pt(struct tdp_iter *iter)
163−{
164− return iter->pt_path[iter->root_level - 1];
165−}
166−
arch/x86/kvm/mmu/tdp_iter.h+3−1
@@ -36,6 +36,8 @@ struct tdp_iter { · 35 unmodified lines
3636 int min_level;
3737 /* The iterator's current level within the paging structure */
3838 int level;
39+ /* The address space ID, i.e. SMM vs. regular. */
40+ int as_id;
3941 /* A snapshot of the value at sptep */
4042 u64 old_spte;
4143 /*
@@ -62,6 +64,6 @@ tdp_ptep_t spte_to_child_pt(u64 pte, int level); · 20 unmodified lines
6264 void tdp_iter_start(struct tdp_iter *iter, u64 *root_pt, int root_level,
6365 int min_level, gfn_t next_last_level_gfn);
6466 void tdp_iter_next(struct tdp_iter *iter);
65−tdp_ptep_t tdp_iter_root_pt(struct tdp_iter *iter);
67+void tdp_iter_restart(struct tdp_iter *iter);
6668
6769 #endif /* __KVM_X86_MMU_TDP_ITER_H */
arch/x86/kvm/mmu/tdp_mmu.c+26−25
@@ -203,11 +203,6 @@ static void handle_changed_spte(struct kvm *kvm, int as_id, gfn_t gfn, · 202 unmodified lines
203203 u64 old_spte, u64 new_spte, int level,
204204 bool shared);
205205
206−static int kvm_mmu_page_as_id(struct kvm_mmu_page *sp)
207−{
208− return sp->role.smm ? 1 : 0;
209−}
210−
211206 static void handle_changed_spte_acc_track(u64 old_spte, u64 new_spte, int level)
212207 {
213208 bool pfn_changed = spte_to_pfn(old_spte) != spte_to_pfn(new_spte);
@@ -301,11 +296,16 @@ static void tdp_mmu_unlink_page(struct kvm *kvm, struct kvm_mmu_page *sp, · 87 unmodified lines
301296 *
302297 * Given a page table that has been removed from the TDP paging structure,
303298 * iterates through the page table to clear SPTEs and free child page tables.
299+ *
300+ * Note that pt is passed in as a tdp_ptep_t, but it does not need RCU
301+ * protection. Since this thread removed it from the paging structure,
302+ * this thread will be responsible for ensuring the page is freed. Hence the
303+ * early rcu_dereferences in the function.
304304 */
305−static void handle_removed_tdp_mmu_page(struct kvm *kvm, u64 *pt,
305+static void handle_removed_tdp_mmu_page(struct kvm *kvm, tdp_ptep_t pt,
306306 bool shared)
307307 {
308− struct kvm_mmu_page *sp = sptep_to_sp(pt);
308+ struct kvm_mmu_page *sp = sptep_to_sp(rcu_dereference(pt));
309309 int level = sp->role.level;
310310 gfn_t base_gfn = sp->gfn;
311311 u64 old_child_spte;
@@ -318,7 +318,7 @@ static void handle_removed_tdp_mmu_page(struct kvm *kvm, u64 *pt, · 6 unmodified lines
318318 tdp_mmu_unlink_page(kvm, sp, shared);
319319
320320 for (i = 0; i < PT64_ENT_PER_PAGE; i++) {
321− sptep = pt + i;
321+ sptep = rcu_dereference(pt) + i;
322322 gfn = base_gfn + (i * KVM_PAGES_PER_HPAGE(level - 1));
323323
324324 if (shared) {
@@ -337,7 +337,18 @@ static void handle_removed_tdp_mmu_page(struct kvm *kvm, u64 *pt, · 12 unmodified lines
337337 cpu_relax();
338338 }
339339 } else {
340+ /*
341+ * If the SPTE is not MMU-present, there is no backing
342+ * page associated with the SPTE and so no side effects
343+ * that need to be recorded, and exclusive ownership of
344+ * mmu_lock ensures the SPTE can't be made present.
345+ * Note, zapping MMIO SPTEs is also unnecessary as they
346+ * are guarded by the memslots generation, not by being
347+ * unreachable.
348+ */
340349 old_child_spte = READ_ONCE(*sptep);
350+ if (!is_shadow_present_pte(old_child_spte))
351+ continue;
341352
342353 /*
343354 * Marking the SPTE as a removed SPTE is not
@@ -481,10 +492,6 @@ static inline bool tdp_mmu_set_spte_atomic(struct kvm *kvm, · 137 unmodified lines
481492 struct tdp_iter *iter,
482493 u64 new_spte)
483494 {
484− u64 *root_pt = tdp_iter_root_pt(iter);
485− struct kvm_mmu_page *root = sptep_to_sp(root_pt);
486− int as_id = kvm_mmu_page_as_id(root);
487−
488495 lockdep_assert_held_read(&kvm->mmu_lock);
489496
490497 /*
@@ -498,8 +505,8 @@ static inline bool tdp_mmu_set_spte_atomic(struct kvm *kvm, · 7 unmodified lines
498505 new_spte) != iter->old_spte)
499506 return false;
500507
501− handle_changed_spte(kvm, as_id, iter->gfn, iter->old_spte, new_spte,
502− iter->level, true);
508+ handle_changed_spte(kvm, iter->as_id, iter->gfn, iter->old_spte,
509+ new_spte, iter->level, true);
503510
504511 return true;
505512 }
@@ -527,7 +534,7 @@ static inline bool tdp_mmu_zap_spte_atomic(struct kvm *kvm, · 21 unmodified lines
527534 * here since the SPTE is going from non-present
528535 * to non-present.
529536 */
530− WRITE_ONCE(*iter->sptep, 0);
537+ WRITE_ONCE(*rcu_dereference(iter->sptep), 0);
531538
532539 return true;
533540 }
@@ -553,10 +560,6 @@ static inline void __tdp_mmu_set_spte(struct kvm *kvm, struct tdp_iter *iter, · 19 unmodified lines
553560 u64 new_spte, bool record_acc_track,
554561 bool record_dirty_log)
555562 {
556− tdp_ptep_t root_pt = tdp_iter_root_pt(iter);
557− struct kvm_mmu_page *root = sptep_to_sp(root_pt);
558− int as_id = kvm_mmu_page_as_id(root);
559−
560563 lockdep_assert_held_write(&kvm->mmu_lock);
561564
562565 /*
@@ -570,13 +573,13 @@ static inline void __tdp_mmu_set_spte(struct kvm *kvm, struct tdp_iter *iter, · 7 unmodified lines
570573
571574 WRITE_ONCE(*rcu_dereference(iter->sptep), new_spte);
572575
573− __handle_changed_spte(kvm, as_id, iter->gfn, iter->old_spte, new_spte,
574− iter->level, false);
576+ __handle_changed_spte(kvm, iter->as_id, iter->gfn, iter->old_spte,
577+ new_spte, iter->level, false);
575578 if (record_acc_track)
576579 handle_changed_spte_acc_track(iter->old_spte, new_spte,
577580 iter->level);
578581 if (record_dirty_log)
579− handle_changed_spte_dirty_log(kvm, as_id, iter->gfn,
582+ handle_changed_spte_dirty_log(kvm, iter->as_id, iter->gfn,
580583 iter->old_spte, new_spte,
581584 iter->level);
582585 }
@@ -648,9 +651,7 @@ static inline bool tdp_mmu_iter_cond_resched(struct kvm *kvm, · 65 unmodified lines
648651
649652 WARN_ON(iter->gfn > iter->next_last_level_gfn);
650653
651− tdp_iter_start(iter, iter->pt_path[iter->root_level - 1],
652− iter->root_level, iter->min_level,
653− iter->next_last_level_gfn);
654+ tdp_iter_restart(iter);
654655
655656 return true;
656657 }
arch/x86/kvm/svm/svm.c+13−12
@@ -115,13 +115,6 @@ static const struct svm_direct_access_msrs { · 114 unmodified lines
115115 { .index = MSR_INVALID, .always = false },
116116 };
117117
118−/* enable NPT for AMD64 and X86 with PAE */
119−#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
120−bool npt_enabled = true;
121−#else
122−bool npt_enabled;
123−#endif
124−
125118 /*
126119 * These 2 parameters are used to config the controls for Pause-Loop Exiting:
127120 * pause_filter_count: On processors that support Pause filtering(indicated
@@ -170,9 +163,12 @@ module_param(pause_filter_count_shrink, ushort, 0444); · 42 unmodified lines
170163 static unsigned short pause_filter_count_max = KVM_SVM_DEFAULT_PLE_WINDOW_MAX;
171164 module_param(pause_filter_count_max, ushort, 0444);
172165
173−/* allow nested paging (virtualized MMU) for all guests */
174−static int npt = true;
175−module_param(npt, int, S_IRUGO);
166+/*
167+ * Use nested page tables by default. Note, NPT may get forced off by
168+ * svm_hardware_setup() if it's unsupported by hardware or the host kernel.
169+ */
170+bool npt_enabled = true;
171+module_param_named(npt, npt_enabled, bool, 0444);
176172
177173 /* allow nested virtualization in KVM/SVM */
178174 static int nested = true;
@@ -988,10 +984,15 @@ static __init int svm_hardware_setup(void) · 809 unmodified lines
988984 goto err;
989985 }
990986
991− if (!boot_cpu_has(X86_FEATURE_NPT))
987+ /*
988+ * KVM's MMU doesn't support using 2-level paging for itself, and thus
989+ * NPT isn't supported if the host is using 2-level paging since host
990+ * CR4 is unchanged on VMRUN.
991+ */
992+ if (!IS_ENABLED(CONFIG_X86_64) && !IS_ENABLED(CONFIG_X86_PAE))
992993 npt_enabled = false;
993994
994− if (npt_enabled && !npt)
995+ if (!boot_cpu_has(X86_FEATURE_NPT))
995996 npt_enabled = false;
996997
997998 kvm_configure_mmu(npt_enabled, get_max_npt_level(), PG_LEVEL_1G);
arch/x86/kvm/vmx/vmx.c+1−1
@@ -6580,8 +6580,8 @@ static void atomic_switch_perf_msrs(struct vcpu_vmx *vmx) · 6579 unmodified lines
65806580 int i, nr_msrs;
65816581 struct perf_guest_switch_msr *msrs;
65826582
6583+ /* Note, nr_msrs may be garbage if perf_guest_get_msrs() returns NULL. */
65836584 msrs = perf_guest_get_msrs(&nr_msrs);
6584−
65856585 if (!msrs)
65866586 return;
65876587
arch/x86/kvm/x86.c+69−46
@@ -1526,35 +1526,44 @@ EXPORT_SYMBOL_GPL(kvm_enable_efer_bits); · 1525 unmodified lines
15261526
15271527 bool kvm_msr_allowed(struct kvm_vcpu *vcpu, u32 index, u32 type)
15281528 {
1529+ struct kvm_x86_msr_filter *msr_filter;
1530+ struct msr_bitmap_range *ranges;
15291531 struct kvm *kvm = vcpu->kvm;
1530− struct msr_bitmap_range *ranges = kvm->arch.msr_filter.ranges;
1531− u32 count = kvm->arch.msr_filter.count;
1532− u32 i;
1533− bool r = kvm->arch.msr_filter.default_allow;
1532+ bool allowed;
15341533 int idx;
1534+ u32 i;
15351535
1536− /* MSR filtering not set up or x2APIC enabled, allow everything */
1537− if (!count || (index >= 0x800 && index <= 0x8ff))
1536+ /* x2APIC MSRs do not support filtering. */
1537+ if (index >= 0x800 && index <= 0x8ff)
15381538 return true;
15391539
1540− /* Prevent collision with set_msr_filter */
15411540 idx = srcu_read_lock(&kvm->srcu);
15421541
1543− for (i = 0; i < count; i++) {
1542+ msr_filter = srcu_dereference(kvm->arch.msr_filter, &kvm->srcu);
1543+ if (!msr_filter) {
1544+ allowed = true;
1545+ goto out;
1546+ }
1547+
1548+ allowed = msr_filter->default_allow;
1549+ ranges = msr_filter->ranges;
1550+
1551+ for (i = 0; i < msr_filter->count; i++) {
15441552 u32 start = ranges[i].base;
15451553 u32 end = start + ranges[i].nmsrs;
15461554 u32 flags = ranges[i].flags;
15471555 unsigned long *bitmap = ranges[i].bitmap;
15481556
15491557 if ((index >= start) && (index < end) && (flags & type)) {
1550− r = !!test_bit(index - start, bitmap);
1558+ allowed = !!test_bit(index - start, bitmap);
15511559 break;
15521560 }
15531561 }
15541562
1563+out:
15551564 srcu_read_unlock(&kvm->srcu, idx);
15561565
1557− return r;
1566+ return allowed;
15581567 }
15591568 EXPORT_SYMBOL_GPL(kvm_msr_allowed);
15601569
@@ -2551,6 +2560,8 @@ static void kvm_gen_update_masterclock(struct kvm *kvm) · 990 unmodified lines
25512560 struct kvm_vcpu *vcpu;
25522561 struct kvm_arch *ka = &kvm->arch;
25532562
2563+ kvm_hv_invalidate_tsc_page(kvm);
2564+
25542565 spin_lock(&ka->pvclock_gtod_sync_lock);
25552566 kvm_make_mclock_inprogress_request(kvm);
25562567 /* no guest entries from this point */
@@ -5352,25 +5363,34 @@ split_irqchip_unlock: · 2795 unmodified lines
53525363 return r;
53535364 }
53545365
5355−static void kvm_clear_msr_filter(struct kvm *kvm)
5366+static struct kvm_x86_msr_filter *kvm_alloc_msr_filter(bool default_allow)
5367+{
5368+ struct kvm_x86_msr_filter *msr_filter;
5369+
5370+ msr_filter = kzalloc(sizeof(*msr_filter), GFP_KERNEL_ACCOUNT);
5371+ if (!msr_filter)
5372+ return NULL;
5373+
5374+ msr_filter->default_allow = default_allow;
5375+ return msr_filter;
5376+}
5377+
5378+static void kvm_free_msr_filter(struct kvm_x86_msr_filter *msr_filter)
53565379 {
53575380 u32 i;
5358− u32 count = kvm->arch.msr_filter.count;
5359− struct msr_bitmap_range ranges[16];
53605381
5361− mutex_lock(&kvm->lock);
5362− kvm->arch.msr_filter.count = 0;
5363− memcpy(ranges, kvm->arch.msr_filter.ranges, count * sizeof(ranges[0]));
5364− mutex_unlock(&kvm->lock);
5365− synchronize_srcu(&kvm->srcu);
5382+ if (!msr_filter)
5383+ return;
5384+
5385+ for (i = 0; i < msr_filter->count; i++)
5386+ kfree(msr_filter->ranges[i].bitmap);
53665387
5367− for (i = 0; i < count; i++)
5368− kfree(ranges[i].bitmap);
5388+ kfree(msr_filter);
53695389 }
53705390
5371−static int kvm_add_msr_filter(struct kvm *kvm, struct kvm_msr_filter_range *user_range)
5391+static int kvm_add_msr_filter(struct kvm_x86_msr_filter *msr_filter,
5392+ struct kvm_msr_filter_range *user_range)
53725393 {
5373− struct msr_bitmap_range *ranges = kvm->arch.msr_filter.ranges;
53745394 struct msr_bitmap_range range;
53755395 unsigned long *bitmap = NULL;
53765396 size_t bitmap_size;
@@ -5404,11 +5424,9 @@ static int kvm_add_msr_filter(struct kvm *kvm, struct kvm_msr_filter_range *user · 27 unmodified lines
54045424 goto err;
54055425 }
54065426
5407− /* Everything ok, add this range identifier to our global pool */
5408− ranges[kvm->arch.msr_filter.count] = range;
5409− /* Make sure we filled the array before we tell anyone to walk it */
5410− smp_wmb();
5411− kvm->arch.msr_filter.count++;
5427+ /* Everything ok, add this range identifier. */
5428+ msr_filter->ranges[msr_filter->count] = range;
5429+ msr_filter->count++;
54125430
54135431 return 0;
54145432 err:
@@ -5419,10 +5437,11 @@ err: · 4 unmodified lines
54195437 static int kvm_vm_ioctl_set_msr_filter(struct kvm *kvm, void __user *argp)
54205438 {
54215439 struct kvm_msr_filter __user *user_msr_filter = argp;
5440+ struct kvm_x86_msr_filter *new_filter, *old_filter;
54225441 struct kvm_msr_filter filter;
54235442 bool default_allow;
5424− int r = 0;
54255443 bool empty = true;
5444+ int r = 0;
54265445 u32 i;
54275446
54285447 if (copy_from_user(&filter, user_msr_filter, sizeof(filter)))
@@ -5435,25 +5454,32 @@ static int kvm_vm_ioctl_set_msr_filter(struct kvm *kvm, void __user *argp) · 6 unmodified lines
54355454 if (empty && !default_allow)
54365455 return -EINVAL;
54375456
5438− kvm_clear_msr_filter(kvm);
5439−
5440− kvm->arch.msr_filter.default_allow = default_allow;
5457+ new_filter = kvm_alloc_msr_filter(default_allow);
5458+ if (!new_filter)
5459+ return -ENOMEM;
54415460
5442− /*
5443− * Protect from concurrent calls to this function that could trigger
5444− * a TOCTOU violation on kvm->arch.msr_filter.count.
5445− */
5446− mutex_lock(&kvm->lock);
54475461 for (i = 0; i < ARRAY_SIZE(filter.ranges); i++) {
5448− r = kvm_add_msr_filter(kvm, &filter.ranges[i]);
5449− if (r)
5450− break;
5462+ r = kvm_add_msr_filter(new_filter, &filter.ranges[i]);
5463+ if (r) {
5464+ kvm_free_msr_filter(new_filter);
5465+ return r;
5466+ }
54515467 }
54525468
5469+ mutex_lock(&kvm->lock);
5470+
5471+ /* The per-VM filter is protected by kvm->lock... */
5472+ old_filter = srcu_dereference_check(kvm->arch.msr_filter, &kvm->srcu, 1);
5473+
5474+ rcu_assign_pointer(kvm->arch.msr_filter, new_filter);
5475+ synchronize_srcu(&kvm->srcu);
5476+
5477+ kvm_free_msr_filter(old_filter);
5478+
54535479 kvm_make_all_cpus_request(kvm, KVM_REQ_MSR_FILTER_CHANGED);
54545480 mutex_unlock(&kvm->lock);
54555481
5456− return r;
5482+ return 0;
54575483 }
54585484
54595485 long kvm_arch_vm_ioctl(struct file *filp,
@@ -6603,7 +6629,7 @@ static int kvm_emulate_wbinvd_noskip(struct kvm_vcpu *vcpu) · 1143 unmodified lines
66036629 int cpu = get_cpu();
66046630
66056631 cpumask_set_cpu(cpu, vcpu->arch.wbinvd_dirty_mask);
6606− smp_call_function_many(vcpu->arch.wbinvd_dirty_mask,
6632+ on_each_cpu_mask(vcpu->arch.wbinvd_dirty_mask,
66076633 wbinvd_ipi, NULL, 1);
66086634 put_cpu();
66096635 cpumask_clear(vcpu->arch.wbinvd_dirty_mask);
@@ -10601,7 +10627,7 @@ void __user * __x86_set_memory_region(struct kvm *kvm, int id, gpa_t gpa, · 3991 unmodified lines
1060110627 return (void __user *)hva;
1060210628 } else {
1060310629 if (!slot || !slot->npages)
10604− return 0;
10630+ return NULL;
1060510631
1060610632 old_npages = slot->npages;
1060710633 hva = slot->userspace_addr;
@@ -10634,8 +10660,6 @@ void kvm_arch_pre_destroy_vm(struct kvm *kvm) · 26 unmodified lines
1063410660
1063510661 void kvm_arch_destroy_vm(struct kvm *kvm)
1063610662 {
10637− u32 i;
10638−
1063910663 if (current->mm == kvm->mm) {
1064010664 /*
1064110665 * Free memory regions allocated on behalf of userspace,
@@ -10651,8 +10675,7 @@ void kvm_arch_destroy_vm(struct kvm *kvm) · 9 unmodified lines
1065110675 mutex_unlock(&kvm->slots_lock);
1065210676 }
1065310677 static_call_cond(kvm_x86_vm_destroy)(kvm);
10654− for (i = 0; i < kvm->arch.msr_filter.count; i++)
10655− kfree(kvm->arch.msr_filter.ranges[i].bitmap);
10678+ kvm_free_msr_filter(srcu_dereference_check(kvm->arch.msr_filter, &kvm->srcu, 1));
1065610679 kvm_pic_destroy(kvm);
1065710680 kvm_ioapic_destroy(kvm);
1065810681 kvm_free_vcpus(kvm);
arch/x86/lib/insn-eval.c+52−14
@@ -1415,6 +1415,25 @@ void __user *insn_get_addr_ref(struct insn *insn, struct pt_regs *regs) · 1414 unmodified lines
14151415 }
14161416 }
14171417
1418+static unsigned long insn_get_effective_ip(struct pt_regs *regs)
1419+{
1420+ unsigned long seg_base = 0;
1421+
1422+ /*
1423+ * If not in user-space long mode, a custom code segment could be in
1424+ * use. This is true in protected mode (if the process defined a local
1425+ * descriptor table), or virtual-8086 mode. In most of the cases
1426+ * seg_base will be zero as in USER_CS.
1427+ */
1428+ if (!user_64bit_mode(regs)) {
1429+ seg_base = insn_get_seg_base(regs, INAT_SEG_REG_CS);
1430+ if (seg_base == -1L)
1431+ return 0;
1432+ }
1433+
1434+ return seg_base + regs->ip;
1435+}
1436+
14181437 /**
14191438 * insn_fetch_from_user() - Copy instruction bytes from user-space memory
14201439 * @regs: Structure with register values as seen when entering kernel mode
@@ -1431,24 +1450,43 @@ void __user *insn_get_addr_ref(struct insn *insn, struct pt_regs *regs) · 10 unmodified lines
14311450 */
14321451 int insn_fetch_from_user(struct pt_regs *regs, unsigned char buf[MAX_INSN_SIZE])
14331452 {
1434− unsigned long seg_base = 0;
1453+ unsigned long ip;
14351454 int not_copied;
14361455
1437− /*
1438− * If not in user-space long mode, a custom code segment could be in
1439− * use. This is true in protected mode (if the process defined a local
1440− * descriptor table), or virtual-8086 mode. In most of the cases
1441− * seg_base will be zero as in USER_CS.
1442− */
1443− if (!user_64bit_mode(regs)) {
1444− seg_base = insn_get_seg_base(regs, INAT_SEG_REG_CS);
1445− if (seg_base == -1L)
1446− return 0;
1447− }
1456+ ip = insn_get_effective_ip(regs);
1457+ if (!ip)
1458+ return 0;
1459+
1460+ not_copied = copy_from_user(buf, (void __user *)ip, MAX_INSN_SIZE);
14481461
1462+ return MAX_INSN_SIZE - not_copied;
1463+}
1464+
1465+/**
1466+ * insn_fetch_from_user_inatomic() - Copy instruction bytes from user-space memory
1467+ * while in atomic code
1468+ * @regs: Structure with register values as seen when entering kernel mode
1469+ * @buf: Array to store the fetched instruction
1470+ *
1471+ * Gets the linear address of the instruction and copies the instruction bytes
1472+ * to the buf. This function must be used in atomic context.
1473+ *
1474+ * Returns:
1475+ *
1476+ * Number of instruction bytes copied.
1477+ *
1478+ * 0 if nothing was copied.
1479+ */
1480+int insn_fetch_from_user_inatomic(struct pt_regs *regs, unsigned char buf[MAX_INSN_SIZE])
1481+{
1482+ unsigned long ip;
1483+ int not_copied;
1484+
1485+ ip = insn_get_effective_ip(regs);
1486+ if (!ip)
1487+ return 0;
14491488
1450− not_copied = copy_from_user(buf, (void __user *)(seg_base + regs->ip),
1451− MAX_INSN_SIZE);
1489+ not_copied = __copy_from_user_inatomic(buf, (void __user *)ip, MAX_INSN_SIZE);
14521490
14531491 return MAX_INSN_SIZE - not_copied;
14541492 }
arch/x86/net/bpf_jit_comp.c+25−6
@@ -1936,7 +1936,7 @@ static int invoke_bpf_mod_ret(const struct btf_func_model *m, u8 **pprog, · 1935 unmodified lines
19361936 * add rsp, 8 // skip eth_type_trans's frame
19371937 * ret // return to its caller
19381938 */
1939−int arch_prepare_bpf_trampoline(void *image, void *image_end,
1939+int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image, void *image_end,
19401940 const struct btf_func_model *m, u32 flags,
19411941 struct bpf_tramp_progs *tprogs,
19421942 void *orig_call)
@@ -1975,6 +1975,15 @@ int arch_prepare_bpf_trampoline(void *image, void *image_end, · 32 unmodified lines
19751975
19761976 save_regs(m, &prog, nr_args, stack_size);
19771977
1978+ if (flags & BPF_TRAMP_F_CALL_ORIG) {
1979+ /* arg1: mov rdi, im */
1980+ emit_mov_imm64(&prog, BPF_REG_1, (long) im >> 32, (u32) (long) im);
1981+ if (emit_call(&prog, __bpf_tramp_enter, prog)) {
1982+ ret = -EINVAL;
1983+ goto cleanup;
1984+ }
1985+ }
1986+
19781987 if (fentry->nr_progs)
19791988 if (invoke_bpf(m, &prog, fentry, stack_size))
19801989 return -EINVAL;
@@ -1993,8 +2002,7 @@ int arch_prepare_bpf_trampoline(void *image, void *image_end, · 12 unmodified lines
19932002 }
19942003
19952004 if (flags & BPF_TRAMP_F_CALL_ORIG) {
1996− if (fentry->nr_progs || fmod_ret->nr_progs)
1997− restore_regs(m, &prog, nr_args, stack_size);
2005+ restore_regs(m, &prog, nr_args, stack_size);
19982006
19992007 /* call original function */
20002008 if (emit_call(&prog, orig_call, prog)) {
@@ -2003,6 +2011,9 @@ int arch_prepare_bpf_trampoline(void *image, void *image_end, · 2 unmodified lines
20032011 }
20042012 /* remember return value in a stack for bpf prog to access */
20052013 emit_stx(&prog, BPF_DW, BPF_REG_FP, BPF_REG_0, -8);
2014+ im->ip_after_call = prog;
2015+ memcpy(prog, ideal_nops[NOP_ATOMIC5], X86_PATCH_SIZE);
2016+ prog += X86_PATCH_SIZE;
20062017 }
20072018
20082019 if (fmod_ret->nr_progs) {
@@ -2033,9 +2044,17 @@ int arch_prepare_bpf_trampoline(void *image, void *image_end, · 24 unmodified lines
20332044 * the return value is only updated on the stack and still needs to be
20342045 * restored to R0.
20352046 */
2036− if (flags & BPF_TRAMP_F_CALL_ORIG)
2047+ if (flags & BPF_TRAMP_F_CALL_ORIG) {
2048+ im->ip_epilogue = prog;
2049+ /* arg1: mov rdi, im */
2050+ emit_mov_imm64(&prog, BPF_REG_1, (long) im >> 32, (u32) (long) im);
2051+ if (emit_call(&prog, __bpf_tramp_exit, prog)) {
2052+ ret = -EINVAL;
2053+ goto cleanup;
2054+ }
20372055 /* restore original return value back into RAX */
20382056 emit_ldx(&prog, BPF_DW, BPF_REG_0, BPF_REG_FP, -8);
2057+ }
20392058
20402059 EMIT1(0x5B); /* pop rbx */
20412060 EMIT1(0xC9); /* leave */
@@ -2225,7 +2244,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) · 183 unmodified lines
22252244 padding = true;
22262245 goto skip_init_addrs;
22272246 }
2228− addrs = kmalloc_array(prog->len + 1, sizeof(*addrs), GFP_KERNEL);
2247+ addrs = kvmalloc_array(prog->len + 1, sizeof(*addrs), GFP_KERNEL);
22292248 if (!addrs) {
22302249 prog = orig_prog;
22312250 goto out_addrs;
@@ -2317,7 +2336,7 @@ out_image: · 85 unmodified lines
23172336 if (image)
23182337 bpf_prog_fill_jited_linfo(prog, addrs + 1);
23192338 out_addrs:
2320− kfree(addrs);
2339+ kvfree(addrs);
23212340 kfree(jit_data);
23222341 prog->aux->jit_data = NULL;
23232342 }
arch/x86/platform/iris/iris.c+0−1
@@ -27,7 +27,6 @@ · 26 unmodified lines
2727 MODULE_LICENSE("GPL");
2828 MODULE_AUTHOR("Sébastien Hinderer <Sebastien.Hinderer@ens-lyon.org>");
2929 MODULE_DESCRIPTION("A power_off handler for Iris devices from EuroBraille");
30−MODULE_SUPPORTED_DEVICE("Eurobraille/Iris");
3130
3231 static bool force;
3332
arch/x86/xen/p2m.c+2−4
@@ -741,7 +741,7 @@ int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops, · 740 unmodified lines
741741 map_ops[i].status = GNTST_general_error;
742742 unmap[0].host_addr = map_ops[i].host_addr,
743743 unmap[0].handle = map_ops[i].handle;
744− map_ops[i].handle = ~0;
744+ map_ops[i].handle = INVALID_GRANT_HANDLE;
745745 if (map_ops[i].flags & GNTMAP_device_map)
746746 unmap[0].dev_bus_addr = map_ops[i].dev_bus_addr;
747747 else
@@ -751,7 +751,7 @@ int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops, · 3 unmodified lines
751751 kmap_ops[i].status = GNTST_general_error;
752752 unmap[1].host_addr = kmap_ops[i].host_addr,
753753 unmap[1].handle = kmap_ops[i].handle;
754− kmap_ops[i].handle = ~0;
754+ kmap_ops[i].handle = INVALID_GRANT_HANDLE;
755755 if (kmap_ops[i].flags & GNTMAP_device_map)
756756 unmap[1].dev_bus_addr = kmap_ops[i].dev_bus_addr;
757757 else
@@ -776,7 +776,6 @@ int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops, · 18 unmodified lines
776776 out:
777777 return ret;
778778 }
779−EXPORT_SYMBOL_GPL(set_foreign_p2m_mapping);
780779
781780 int clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref *unmap_ops,
782781 struct gnttab_unmap_grant_ref *kunmap_ops,
@@ -802,7 +801,6 @@ int clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref *unmap_ops, · 19 unmodified lines
802801
803802 return ret;
804803 }
805−EXPORT_SYMBOL_GPL(clear_foreign_p2m_mapping);
806804
807805 #ifdef CONFIG_XEN_DEBUG_FS
808806 #include <linux/debugfs.h>
block/bio.c+7−7
@@ -33,7 +33,7 @@ static struct biovec_slab { · 32 unmodified lines
3333 { .nr_vecs = 16, .name = "biovec-16" },
3434 { .nr_vecs = 64, .name = "biovec-64" },
3535 { .nr_vecs = 128, .name = "biovec-128" },
36− { .nr_vecs = BIO_MAX_PAGES, .name = "biovec-max" },
36+ { .nr_vecs = BIO_MAX_VECS, .name = "biovec-max" },
3737 };
3838
3939 static struct biovec_slab *biovec_slab(unsigned short nr_vecs)
@@ -46,7 +46,7 @@ static struct biovec_slab *biovec_slab(unsigned short nr_vecs) · 6 unmodified lines
4646 return &bvec_slabs[1];
4747 case 65 ... 128:
4848 return &bvec_slabs[2];
49− case 129 ... BIO_MAX_PAGES:
49+ case 129 ... BIO_MAX_VECS:
5050 return &bvec_slabs[3];
5151 default:
5252 BUG();
@@ -151,9 +151,9 @@ out: · 98 unmodified lines
151151
152152 void bvec_free(mempool_t *pool, struct bio_vec *bv, unsigned short nr_vecs)
153153 {
154− BIO_BUG_ON(nr_vecs > BIO_MAX_PAGES);
154+ BIO_BUG_ON(nr_vecs > BIO_MAX_VECS);
155155
156− if (nr_vecs == BIO_MAX_PAGES)
156+ if (nr_vecs == BIO_MAX_VECS)
157157 mempool_free(bv, pool);
158158 else if (nr_vecs > BIO_INLINE_VECS)
159159 kmem_cache_free(biovec_slab(nr_vecs)->slab, bv);
@@ -186,15 +186,15 @@ struct bio_vec *bvec_alloc(mempool_t *pool, unsigned short *nr_vecs, · 26 unmodified lines
186186 /*
187187 * Try a slab allocation first for all smaller allocations. If that
188188 * fails and __GFP_DIRECT_RECLAIM is set retry with the mempool.
189− * The mempool is sized to handle up to BIO_MAX_PAGES entries.
189+ * The mempool is sized to handle up to BIO_MAX_VECS entries.
190190 */
191− if (*nr_vecs < BIO_MAX_PAGES) {
191+ if (*nr_vecs < BIO_MAX_VECS) {
192192 struct bio_vec *bvl;
193193
194194 bvl = kmem_cache_alloc(bvs->slab, bvec_alloc_gfp(gfp_mask));
195195 if (likely(bvl) || !(gfp_mask & __GFP_DIRECT_RECLAIM))
196196 return bvl;
197− *nr_vecs = BIO_MAX_PAGES;
197+ *nr_vecs = BIO_MAX_VECS;
198198 }
199199
200200 return mempool_alloc(pool, gfp_mask);
block/blk-cgroup-rwstat.c+2−1
@@ -109,6 +109,7 @@ void blkg_rwstat_recursive_sum(struct blkcg_gq *blkg, struct blkcg_policy *pol, · 108 unmodified lines
109109
110110 lockdep_assert_held(&blkg->q->queue_lock);
111111
112+ memset(sum, 0, sizeof(*sum));
112113 rcu_read_lock();
113114 blkg_for_each_descendant_pre(pos_blkg, pos_css, blkg) {
114115 struct blkg_rwstat *rwstat;
@@ -122,7 +123,7 @@ void blkg_rwstat_recursive_sum(struct blkcg_gq *blkg, struct blkcg_policy *pol, · 7 unmodified lines
122123 rwstat = (void *)pos_blkg + off;
123124
124125 for (i = 0; i < BLKG_RWSTAT_NR; i++)
125− sum->cnt[i] = blkg_rwstat_read_counter(rwstat, i);
126+ sum->cnt[i] += blkg_rwstat_read_counter(rwstat, i);
126127 }
127128 rcu_read_unlock();
128129 }
block/blk-crypto-fallback.c+1−1
@@ -219,7 +219,7 @@ static bool blk_crypto_split_bio_if_needed(struct bio **bio_ptr) · 218 unmodified lines
219219
220220 bio_for_each_segment(bv, bio, iter) {
221221 num_sectors += bv.bv_len >> SECTOR_SHIFT;
222− if (++i == BIO_MAX_PAGES)
222+ if (++i == BIO_MAX_VECS)
223223 break;
224224 }
225225 if (num_sectors < bio_sectors(bio)) {
block/blk-lib.c+1−1
@@ -296,7 +296,7 @@ static unsigned int __blkdev_sectors_to_bio_pages(sector_t nr_sects) · 295 unmodified lines
296296 {
297297 sector_t pages = DIV_ROUND_UP_SECTOR_T(nr_sects, PAGE_SIZE / 512);
298298
299− return min(pages, (sector_t)BIO_MAX_PAGES);
299+ return min(pages, (sector_t)BIO_MAX_VECS);
300300 }
301301
302302 static int __blkdev_issue_zero_pages(struct block_device *bdev,
block/blk-map.c+1−1
@@ -249,7 +249,7 @@ static int bio_map_user_iov(struct request *rq, struct iov_iter *iter, · 248 unmodified lines
249249 if (!iov_iter_count(iter))
250250 return -EINVAL;
251251
252− bio = bio_kmalloc(gfp_mask, iov_iter_npages(iter, BIO_MAX_PAGES));
252+ bio = bio_kmalloc(gfp_mask, iov_iter_npages(iter, BIO_MAX_VECS));
253253 if (!bio)
254254 return -ENOMEM;
255255 bio->bi_opf |= req_op(rq);
block/blk-zoned.c+37−3
@@ -240,7 +240,7 @@ int blkdev_zone_mgmt(struct block_device *bdev, enum req_opf op, · 239 unmodified lines
240240 */
241241 if (op == REQ_OP_ZONE_RESET &&
242242 blkdev_allow_reset_all_zones(bdev, sector, nr_sectors)) {
243− bio->bi_opf = REQ_OP_ZONE_RESET_ALL;
243+ bio->bi_opf = REQ_OP_ZONE_RESET_ALL | REQ_SYNC;
244244 break;
245245 }
246246
@@ -318,6 +318,22 @@ int blkdev_report_zones_ioctl(struct block_device *bdev, fmode_t mode, · 71 unmodified lines
318318 return 0;
319319 }
320320
321+static int blkdev_truncate_zone_range(struct block_device *bdev, fmode_t mode,
322+ const struct blk_zone_range *zrange)
323+{
324+ loff_t start, end;
325+
326+ if (zrange->sector + zrange->nr_sectors <= zrange->sector ||
327+ zrange->sector + zrange->nr_sectors > get_capacity(bdev->bd_disk))
328+ /* Out of range */
329+ return -EINVAL;
330+
331+ start = zrange->sector << SECTOR_SHIFT;
332+ end = ((zrange->sector + zrange->nr_sectors) << SECTOR_SHIFT) - 1;
333+
334+ return truncate_bdev_range(bdev, mode, start, end);
335+}
336+
321337 /*
322338 * BLKRESETZONE, BLKOPENZONE, BLKCLOSEZONE and BLKFINISHZONE ioctl processing.
323339 * Called from blkdev_ioctl.
@@ -329,6 +345,7 @@ int blkdev_zone_mgmt_ioctl(struct block_device *bdev, fmode_t mode, · 5 unmodified lines
329345 struct request_queue *q;
330346 struct blk_zone_range zrange;
331347 enum req_opf op;
348+ int ret;
332349
333350 if (!argp)
334351 return -EINVAL;
@@ -352,6 +369,11 @@ int blkdev_zone_mgmt_ioctl(struct block_device *bdev, fmode_t mode, · 17 unmodified lines
352369 switch (cmd) {
353370 case BLKRESETZONE:
354371 op = REQ_OP_ZONE_RESET;
372+
373+ /* Invalidate the page cache, including dirty pages. */
374+ ret = blkdev_truncate_zone_range(bdev, mode, &zrange);
375+ if (ret)
376+ return ret;
355377 break;
356378 case BLKOPENZONE:
357379 op = REQ_OP_ZONE_OPEN;
@@ -366,8 +388,20 @@ int blkdev_zone_mgmt_ioctl(struct block_device *bdev, fmode_t mode, · 8 unmodified lines
366388 return -ENOTTY;
367389 }
368390
369− return blkdev_zone_mgmt(bdev, op, zrange.sector, zrange.nr_sectors,
370− GFP_KERNEL);
391+ ret = blkdev_zone_mgmt(bdev, op, zrange.sector, zrange.nr_sectors,
392+ GFP_KERNEL);
393+
394+ /*
395+ * Invalidate the page cache again for zone reset: writes can only be
396+ * direct for zoned devices so concurrent writes would not add any page
397+ * to the page cache after/during reset. The page cache may be filled
398+ * again due to concurrent reads though and dropping the pages for
399+ * these is fine.
400+ */
401+ if (!ret && cmd == BLKRESETZONE)
402+ ret = blkdev_truncate_zone_range(bdev, mode, &zrange);
403+
404+ return ret;
371405 }
372406
373407 static inline unsigned long *blk_alloc_zone_bitmap(int node,
block/bounce.c+3−3
@@ -229,10 +229,10 @@ static struct bio *bounce_clone_bio(struct bio *bio_src) · 228 unmodified lines
229229 * - The point of cloning the biovec is to produce a bio with a biovec
230230 * the caller can modify: bi_idx and bi_bvec_done should be 0.
231231 *
232− * - The original bio could've had more than BIO_MAX_PAGES biovecs; if
232+ * - The original bio could've had more than BIO_MAX_VECS biovecs; if
233233 * we tried to clone the whole thing bio_alloc_bioset() would fail.
234234 * But the clone should succeed as long as the number of biovecs we
235− * actually need to allocate is fewer than BIO_MAX_PAGES.
235+ * actually need to allocate is fewer than BIO_MAX_VECS.
236236 *
237237 * - Lastly, bi_vcnt should not be looked at or relied upon by code
238238 * that does not own the bio - reason being drivers don't use it for
@@ -299,7 +299,7 @@ static void __blk_queue_bounce(struct request_queue *q, struct bio **bio_orig, · 60 unmodified lines
299299 int sectors = 0;
300300
301301 bio_for_each_segment(from, *bio_orig, iter) {
302− if (i++ < BIO_MAX_PAGES)
302+ if (i++ < BIO_MAX_VECS)
303303 sectors += from.bv_len >> 9;
304304 if (page_to_pfn(from.bv_page) > q->limits.bounce_pfn)
305305 bounce = true;
block/genhd.c+1−3
@@ -534,10 +534,8 @@ static void register_disk(struct device *parent, struct gendisk *disk, · 533 unmodified lines
534534 kobject_create_and_add("holders", &ddev->kobj);
535535 disk->slave_dir = kobject_create_and_add("slaves", &ddev->kobj);
536536
537− if (disk->flags & GENHD_FL_HIDDEN) {
538− dev_set_uevent_suppress(ddev, 0);
537+ if (disk->flags & GENHD_FL_HIDDEN)
539538 return;
540− }
541539
542540 disk_scan_partitions(disk);
543541
drivers/atm/fore200e.c+0−2
@@ -99,8 +99,6 @@ static LIST_HEAD(fore200e_boards); · 98 unmodified lines
9999
100100 MODULE_AUTHOR("Christophe Lizzi - credits to Uwe Dannowski and Heikki Vatiainen");
101101 MODULE_DESCRIPTION("FORE Systems 200E-series ATM driver - version " FORE200E_VERSION);
102−MODULE_SUPPORTED_DEVICE("PCA-200E, SBA-200E");
103−
104102
105103 static const int fore200e_rx_buf_nbr[ BUFFER_SCHEME_NBR ][ BUFFER_MAGN_NBR ] = {
106104 { BUFFER_S1_NBR, BUFFER_L1_NBR },
drivers/base/power/runtime.c+25−37
@@ -325,22 +325,22 @@ static void rpm_put_suppliers(struct device *dev) · 324 unmodified lines
325325 static int __rpm_callback(int (*cb)(struct device *), struct device *dev)
326326 __releases(&dev->power.lock) __acquires(&dev->power.lock)
327327 {
328− bool use_links = dev->power.links_count > 0;
329− bool get = false;
330328 int retval, idx;
331− bool put;
329+ bool use_links = dev->power.links_count > 0;
332330
333331 if (dev->power.irq_safe) {
334332 spin_unlock(&dev->power.lock);
335− } else if (!use_links) {
336− spin_unlock_irq(&dev->power.lock);
337333 } else {
338− get = dev->power.runtime_status == RPM_RESUMING;
339−
340334 spin_unlock_irq(&dev->power.lock);
341335
342− /* Resume suppliers if necessary. */
343− if (get) {
336+ /*
337+ * Resume suppliers if necessary.
338+ *
339+ * The device's runtime PM status cannot change until this
340+ * routine returns, so it is safe to read the status outside of
341+ * the lock.
342+ */
343+ if (use_links && dev->power.runtime_status == RPM_RESUMING) {
344344 idx = device_links_read_lock();
345345
346346 retval = rpm_get_suppliers(dev);
@@ -355,36 +355,24 @@ static int __rpm_callback(int (*cb)(struct device *), struct device *dev) · 8 unmodified lines
355355
356356 if (dev->power.irq_safe) {
357357 spin_lock(&dev->power.lock);
358− return retval;
359− }
360−
361− spin_lock_irq(&dev->power.lock);
362−
363− if (!use_links)
364− return retval;
365−
366− /*
367− * If the device is suspending and the callback has returned success,
368− * drop the usage counters of the suppliers that have been reference
369− * counted on its resume.
370− *
371− * Do that if the resume fails too.
372− */
373− put = dev->power.runtime_status == RPM_SUSPENDING && !retval;
374− if (put)
375− __update_runtime_status(dev, RPM_SUSPENDED);
376− else
377− put = get && retval;
378−
379− if (put) {
380− spin_unlock_irq(&dev->power.lock);
381−
382− idx = device_links_read_lock();
358+ } else {
359+ /*
360+ * If the device is suspending and the callback has returned
361+ * success, drop the usage counters of the suppliers that have
362+ * been reference counted on its resume.
363+ *
364+ * Do that if resume fails too.
365+ */
366+ if (use_links
367+ && ((dev->power.runtime_status == RPM_SUSPENDING && !retval)
368+ || (dev->power.runtime_status == RPM_RESUMING && retval))) {
369+ idx = device_links_read_lock();
383370
384−fail:
385− rpm_put_suppliers(dev);
371+ fail:
372+ rpm_put_suppliers(dev);
386373
387− device_links_read_unlock(idx);
374+ device_links_read_unlock(idx);
375+ }
388376
389377 spin_lock_irq(&dev->power.lock);
390378 }
drivers/base/swnode.c+20−9
@@ -938,6 +938,9 @@ int software_node_register(const struct software_node *node) · 937 unmodified lines
938938 if (software_node_to_swnode(node))
939939 return -EEXIST;
940940
941+ if (node->parent && !parent)
942+ return -EINVAL;
943+
941944 return PTR_ERR_OR_ZERO(swnode_register(node, parent, 0));
942945 }
943946 EXPORT_SYMBOL_GPL(software_node_register);
@@ -1002,25 +1005,33 @@ EXPORT_SYMBOL_GPL(fwnode_remove_software_node); · 58 unmodified lines
10021005 /**
10031006 * device_add_software_node - Assign software node to a device
10041007 * @dev: The device the software node is meant for.
1005− * @swnode: The software node.
1008+ * @node: The software node.
10061009 *
1007− * This function will register @swnode and make it the secondary firmware node
1008− * pointer of @dev. If @dev has no primary node, then @swnode will become the primary
1009− * node.
1010+ * This function will make @node the secondary firmware node pointer of @dev. If
1011+ * @dev has no primary node, then @node will become the primary node. The
1012+ * function will register @node automatically if it wasn't already registered.
10101013 */
1011−int device_add_software_node(struct device *dev, const struct software_node *swnode)
1014+int device_add_software_node(struct device *dev, const struct software_node *node)
10121015 {
1016+ struct swnode *swnode;
10131017 int ret;
10141018
10151019 /* Only one software node per device. */
10161020 if (dev_to_swnode(dev))
10171021 return -EBUSY;
10181022
1019− ret = software_node_register(swnode);
1020− if (ret)
1021− return ret;
1023+ swnode = software_node_to_swnode(node);
1024+ if (swnode) {
1025+ kobject_get(&swnode->kobj);
1026+ } else {
1027+ ret = software_node_register(node);
1028+ if (ret)
1029+ return ret;
1030+
1031+ swnode = software_node_to_swnode(node);
1032+ }
10221033
1023− set_secondary_fwnode(dev, software_node_fwnode(swnode));
1034+ set_secondary_fwnode(dev, &swnode->fwnode);
10241035
10251036 return 0;
10261037 }
drivers/block/drbd/drbd_int.h+1−1
@@ -1324,7 +1324,7 @@ struct bm_extent { · 1323 unmodified lines
13241324 * A followup commit may allow even bigger BIO sizes,
13251325 * once we thought that through. */
13261326 #define DRBD_MAX_BIO_SIZE (1U << 20)
1327−#if DRBD_MAX_BIO_SIZE > (BIO_MAX_PAGES << PAGE_SHIFT)
1327+#if DRBD_MAX_BIO_SIZE > (BIO_MAX_VECS << PAGE_SHIFT)
13281328 #error Architecture not supported: DRBD_MAX_BIO_SIZE > BIO_MAX_SIZE
13291329 #endif
13301330 #define DRBD_MAX_BIO_SIZE_SAFE (1U << 12) /* Works always = 4k */
drivers/block/floppy.c+0−1
@@ -5091,7 +5091,6 @@ module_param(floppy, charp, 0); · 5090 unmodified lines
50915091 module_param(FLOPPY_IRQ, int, 0);
50925092 module_param(FLOPPY_DMA, int, 0);
50935093 MODULE_AUTHOR("Alain L. Knaff");
5094−MODULE_SUPPORTED_DEVICE("fd");
50955094 MODULE_LICENSE("GPL");
50965095
50975096 /* This doesn't actually get used other than for module information */
drivers/block/rsxx/core.c+1−0
@@ -871,6 +871,7 @@ static int rsxx_pci_probe(struct pci_dev *dev, · 870 unmodified lines
871871 card->event_wq = create_singlethread_workqueue(DRIVER_NAME"_event");
872872 if (!card->event_wq) {
873873 dev_err(CARD_TO_DEV(card), "Failed card event setup.\n");
874+ st = -ENOMEM;
874875 goto failed_event_handler;
875876 }
876877
drivers/block/umem.c+4−1
@@ -877,6 +877,7 @@ static int mm_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) · 876 unmodified lines
877877 if (card->mm_pages[0].desc == NULL ||
878878 card->mm_pages[1].desc == NULL) {
879879 dev_printk(KERN_ERR, &card->dev->dev, "alloc failed\n");
880+ ret = -ENOMEM;
880881 goto failed_alloc;
881882 }
882883 reset_page(&card->mm_pages[0]);
@@ -888,8 +889,10 @@ static int mm_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) · 5 unmodified lines
888889 spin_lock_init(&card->lock);
889890
890891 card->queue = blk_alloc_queue(NUMA_NO_NODE);
891− if (!card->queue)
892+ if (!card->queue) {
893+ ret = -ENOMEM;
892894 goto failed_alloc;
895+ }
893896
894897 tasklet_init(&card->tasklet, process_page, (unsigned long)card);
895898
drivers/block/zram/zram_drv.c+11−6
@@ -627,7 +627,7 @@ static ssize_t writeback_store(struct device *dev, · 626 unmodified lines
627627 struct bio_vec bio_vec;
628628 struct page *page;
629629 ssize_t ret = len;
630− int mode;
630+ int mode, err;
631631 unsigned long blk_idx = 0;
632632
633633 if (sysfs_streq(buf, "idle"))
@@ -638,8 +638,8 @@ static ssize_t writeback_store(struct device *dev, · 4 unmodified lines
638638 if (strncmp(buf, PAGE_WB_SIG, sizeof(PAGE_WB_SIG) - 1))
639639 return -EINVAL;
640640
641− ret = kstrtol(buf + sizeof(PAGE_WB_SIG) - 1, 10, &index);
642− if (ret || index >= nr_pages)
641+ if (kstrtol(buf + sizeof(PAGE_WB_SIG) - 1, 10, &index) ||
642+ index >= nr_pages)
643643 return -EINVAL;
644644
645645 nr_pages = 1;
@@ -663,7 +663,7 @@ static ssize_t writeback_store(struct device *dev, · 17 unmodified lines
663663 goto release_init_lock;
664664 }
665665
666− while (nr_pages--) {
666+ for (; nr_pages != 0; index++, nr_pages--) {
667667 struct bio_vec bvec;
668668
669669 bvec.bv_page = page;
@@ -728,12 +728,17 @@ static ssize_t writeback_store(struct device *dev, · 58 unmodified lines
728728 * XXX: A single page IO would be inefficient for write
729729 * but it would be not bad as starter.
730730 */
731− ret = submit_bio_wait(&bio);
732− if (ret) {
731+ err = submit_bio_wait(&bio);
732+ if (err) {
733733 zram_slot_lock(zram, index);
734734 zram_clear_flag(zram, index, ZRAM_UNDER_WB);
735735 zram_clear_flag(zram, index, ZRAM_IDLE);
736736 zram_slot_unlock(zram, index);
737+ /*
738+ * Return last IO error unless every IO were
739+ * not suceeded.
740+ */
741+ ret = err;
737742 continue;
738743 }
739744
drivers/bluetooth/btrsi.c+0−1
@@ -194,5 +194,4 @@ module_init(rsi_91x_bt_module_init); · 193 unmodified lines
194194 module_exit(rsi_91x_bt_module_exit);
195195 MODULE_AUTHOR("Redpine Signals Inc");
196196 MODULE_DESCRIPTION("RSI BT driver");
197−MODULE_SUPPORTED_DEVICE("RSI-BT");
198197 MODULE_LICENSE("Dual BSD/GPL");
drivers/char/applicom.c+0−3
@@ -81,9 +81,6 @@ MODULE_DESCRIPTION("Driver for Applicom Profibus card"); · 80 unmodified lines
8181 MODULE_LICENSE("GPL");
8282 MODULE_ALIAS_MISCDEV(AC_MINOR);
8383
84−MODULE_SUPPORTED_DEVICE("ac");
85−
86−
8784 static struct applicom_board {
8885 unsigned long PhysIO;
8986 void __iomem *RamIO;
drivers/char/toshiba.c+0−1
@@ -64,7 +64,6 @@ · 63 unmodified lines
6464 MODULE_LICENSE("GPL");
6565 MODULE_AUTHOR("Jonathan Buzzard <jonathan@buzzard.org.uk>");
6666 MODULE_DESCRIPTION("Toshiba laptop SMM driver");
67−MODULE_SUPPORTED_DEVICE("toshiba");
6867
6968 static DEFINE_MUTEX(tosh_mutex);
7069 static int tosh_fn;
drivers/clk/qcom/clk-rcg2.c+9−8
@@ -730,7 +730,8 @@ static int clk_gfx3d_determine_rate(struct clk_hw *hw, · 729 unmodified lines
730730 struct clk_rate_request parent_req = { };
731731 struct clk_rcg2_gfx3d *cgfx = to_clk_rcg2_gfx3d(hw);
732732 struct clk_hw *xo, *p0, *p1, *p2;
733− unsigned long request, p0_rate;
733+ unsigned long p0_rate;
734+ u8 mux_div = cgfx->div;
734735 int ret;
735736
736737 p0 = cgfx->hws[0];
@@ -750,14 +751,15 @@ static int clk_gfx3d_determine_rate(struct clk_hw *hw, · 13 unmodified lines
750751 return 0;
751752 }
752753
753− request = req->rate;
754− if (cgfx->div > 1)
755− parent_req.rate = request = request * cgfx->div;
754+ if (mux_div == 0)
755+ mux_div = 1;
756+
757+ parent_req.rate = req->rate * mux_div;
756758
757759 /* This has to be a fixed rate PLL */
758760 p0_rate = clk_hw_get_rate(p0);
759761
760− if (request == p0_rate) {
762+ if (parent_req.rate == p0_rate) {
761763 req->rate = req->best_parent_rate = p0_rate;
762764 req->best_parent_hw = p0;
763765 return 0;
@@ -765,7 +767,7 @@ static int clk_gfx3d_determine_rate(struct clk_hw *hw, · 1 unmodified line
765767
766768 if (req->best_parent_hw == p0) {
767769 /* Are we going back to a previously used rate? */
768− if (clk_hw_get_rate(p2) == request)
770+ if (clk_hw_get_rate(p2) == parent_req.rate)
769771 req->best_parent_hw = p2;
770772 else
771773 req->best_parent_hw = p1;
@@ -780,8 +782,7 @@ static int clk_gfx3d_determine_rate(struct clk_hw *hw, · 8 unmodified lines
780782 return ret;
781783
782784 req->rate = req->best_parent_rate = parent_req.rate;
783− if (cgfx->div > 1)
784− req->rate /= cgfx->div;
785+ req->rate /= mux_div;
785786
786787 return 0;
787788 }
drivers/clk/qcom/clk-rpmh.c+5−2
@@ -510,9 +510,12 @@ static const struct clk_rpmh_desc clk_rpmh_sm8350 = { · 509 unmodified lines
510510 .num_clks = ARRAY_SIZE(sm8350_rpmh_clocks),
511511 };
512512
513+/* Resource name must match resource id present in cmd-db */
514+DEFINE_CLK_RPMH_ARC(sc7280, bi_tcxo, bi_tcxo_ao, "xo.lvl", 0x3, 4);
515+
513516 static struct clk_hw *sc7280_rpmh_clocks[] = {
514− [RPMH_CXO_CLK] = &sdm845_bi_tcxo.hw,
515− [RPMH_CXO_CLK_A] = &sdm845_bi_tcxo_ao.hw,
517+ [RPMH_CXO_CLK] = &sc7280_bi_tcxo.hw,
518+ [RPMH_CXO_CLK_A] = &sc7280_bi_tcxo_ao.hw,
516519 [RPMH_LN_BB_CLK2] = &sdm845_ln_bb_clk2.hw,
517520 [RPMH_LN_BB_CLK2_A] = &sdm845_ln_bb_clk2_ao.hw,
518521 [RPMH_RF_CLK1] = &sdm845_rf_clk1.hw,
drivers/clk/qcom/gcc-sc7180.c+2−2
@@ -620,7 +620,7 @@ static struct clk_rcg2 gcc_sdcc1_apps_clk_src = { · 619 unmodified lines
620620 .name = "gcc_sdcc1_apps_clk_src",
621621 .parent_data = gcc_parent_data_1,
622622 .num_parents = 5,
623− .ops = &clk_rcg2_ops,
623+ .ops = &clk_rcg2_floor_ops,
624624 },
625625 };
626626
@@ -642,7 +642,7 @@ static struct clk_rcg2 gcc_sdcc1_ice_core_clk_src = { · 15 unmodified lines
642642 .name = "gcc_sdcc1_ice_core_clk_src",
643643 .parent_data = gcc_parent_data_0,
644644 .num_parents = 4,
645− .ops = &clk_rcg2_floor_ops,
645+ .ops = &clk_rcg2_ops,
646646 },
647647 };
648648
drivers/counter/stm32-timer-cnt.c+33−22
@@ -31,7 +31,7 @@ struct stm32_timer_cnt { · 30 unmodified lines
3131 struct counter_device counter;
3232 struct regmap *regmap;
3333 struct clk *clk;
34− u32 ceiling;
34+ u32 max_arr;
3535 bool enabled;
3636 struct stm32_timer_regs bak;
3737 };
@@ -44,13 +44,14 @@ struct stm32_timer_cnt { · 6 unmodified lines
4444 * @STM32_COUNT_ENCODER_MODE_3: counts on both TI1FP1 and TI2FP2 edges
4545 */
4646 enum stm32_count_function {
47− STM32_COUNT_SLAVE_MODE_DISABLED = -1,
47+ STM32_COUNT_SLAVE_MODE_DISABLED,
4848 STM32_COUNT_ENCODER_MODE_1,
4949 STM32_COUNT_ENCODER_MODE_2,
5050 STM32_COUNT_ENCODER_MODE_3,
5151 };
5252
5353 static enum counter_count_function stm32_count_functions[] = {
54+ [STM32_COUNT_SLAVE_MODE_DISABLED] = COUNTER_COUNT_FUNCTION_INCREASE,
5455 [STM32_COUNT_ENCODER_MODE_1] = COUNTER_COUNT_FUNCTION_QUADRATURE_X2_A,
5556 [STM32_COUNT_ENCODER_MODE_2] = COUNTER_COUNT_FUNCTION_QUADRATURE_X2_B,
5657 [STM32_COUNT_ENCODER_MODE_3] = COUNTER_COUNT_FUNCTION_QUADRATURE_X4,
@@ -73,8 +74,10 @@ static int stm32_count_write(struct counter_device *counter, · 16 unmodified lines
7374 const unsigned long val)
7475 {
7576 struct stm32_timer_cnt *const priv = counter->priv;
77+ u32 ceiling;
7678
77− if (val > priv->ceiling)
79+ regmap_read(priv->regmap, TIM_ARR, &ceiling);
80+ if (val > ceiling)
7881 return -EINVAL;
7982
8083 return regmap_write(priv->regmap, TIM_CNT, val);
@@ -90,6 +93,9 @@ static int stm32_count_function_get(struct counter_device *counter, · 9 unmodified lines
9093 regmap_read(priv->regmap, TIM_SMCR, &smcr);
9194
9295 switch (smcr & TIM_SMCR_SMS) {
96+ case 0:
97+ *function = STM32_COUNT_SLAVE_MODE_DISABLED;
98+ return 0;
9399 case 1:
94100 *function = STM32_COUNT_ENCODER_MODE_1;
95101 return 0;
@@ -99,9 +105,9 @@ static int stm32_count_function_get(struct counter_device *counter, · 3 unmodified lines
99105 case 3:
100106 *function = STM32_COUNT_ENCODER_MODE_3;
101107 return 0;
108+ default:
109+ return -EINVAL;
102110 }
103−
104− return -EINVAL;
105111 }
106112
107113 static int stm32_count_function_set(struct counter_device *counter,
@@ -112,6 +118,9 @@ static int stm32_count_function_set(struct counter_device *counter, · 4 unmodified lines
112118 u32 cr1, sms;
113119
114120 switch (function) {
121+ case STM32_COUNT_SLAVE_MODE_DISABLED:
122+ sms = 0;
123+ break;
115124 case STM32_COUNT_ENCODER_MODE_1:
116125 sms = 1;
117126 break;
@@ -122,8 +131,7 @@ static int stm32_count_function_set(struct counter_device *counter, · 4 unmodified lines
122131 sms = 3;
123132 break;
124133 default:
125− sms = 0;
126− break;
134+ return -EINVAL;
127135 }
128136
129137 /* Store enable status */
@@ -131,10 +139,6 @@ static int stm32_count_function_set(struct counter_device *counter, · 1 unmodified line
131139
132140 regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_CEN, 0);
133141
134− /* TIMx_ARR register shouldn't be buffered (ARPE=0) */
135− regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_ARPE, 0);
136− regmap_write(priv->regmap, TIM_ARR, priv->ceiling);
137−
138142 regmap_update_bits(priv->regmap, TIM_SMCR, TIM_SMCR_SMS, sms);
139143
140144 /* Make sure that registers are updated */
@@ -185,11 +189,13 @@ static ssize_t stm32_count_ceiling_write(struct counter_device *counter, · 44 unmodified lines
185189 if (ret)
186190 return ret;
187191
192+ if (ceiling > priv->max_arr)
193+ return -ERANGE;
194+
188195 /* TIMx_ARR register shouldn't be buffered (ARPE=0) */
189196 regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_ARPE, 0);
190197 regmap_write(priv->regmap, TIM_ARR, ceiling);
191198
192− priv->ceiling = ceiling;
193199 return len;
194200 }
195201
@@ -274,31 +280,36 @@ static int stm32_action_get(struct counter_device *counter, · 78 unmodified lines
274280 size_t function;
275281 int err;
276282
277− /* Default action mode (e.g. STM32_COUNT_SLAVE_MODE_DISABLED) */
278− *action = STM32_SYNAPSE_ACTION_NONE;
279−
280283 err = stm32_count_function_get(counter, count, &function);
281284 if (err)
282− return 0;
285+ return err;
283286
284287 switch (function) {
288+ case STM32_COUNT_SLAVE_MODE_DISABLED:
289+ /* counts on internal clock when CEN=1 */
290+ *action = STM32_SYNAPSE_ACTION_NONE;
291+ return 0;
285292 case STM32_COUNT_ENCODER_MODE_1:
286293 /* counts up/down on TI1FP1 edge depending on TI2FP2 level */
287294 if (synapse->signal->id == count->synapses[0].signal->id)
288295 *action = STM32_SYNAPSE_ACTION_BOTH_EDGES;
289− break;
296+ else
297+ *action = STM32_SYNAPSE_ACTION_NONE;
298+ return 0;
290299 case STM32_COUNT_ENCODER_MODE_2:
291300 /* counts up/down on TI2FP2 edge depending on TI1FP1 level */
292301 if (synapse->signal->id == count->synapses[1].signal->id)
293302 *action = STM32_SYNAPSE_ACTION_BOTH_EDGES;
294− break;
303+ else
304+ *action = STM32_SYNAPSE_ACTION_NONE;
305+ return 0;
295306 case STM32_COUNT_ENCODER_MODE_3:
296307 /* counts up/down on both TI1FP1 and TI2FP2 edges */
297308 *action = STM32_SYNAPSE_ACTION_BOTH_EDGES;
298− break;
309+ return 0;
310+ default:
311+ return -EINVAL;
299312 }
300−
301− return 0;
302313 }
303314
304315 static const struct counter_ops stm32_timer_cnt_ops = {
@@ -359,7 +370,7 @@ static int stm32_timer_cnt_probe(struct platform_device *pdev) · 54 unmodified lines
359370
360371 priv->regmap = ddata->regmap;
361372 priv->clk = ddata->clk;
362− priv->ceiling = ddata->max_arr;
373+ priv->max_arr = ddata->max_arr;
363374
364375 priv->counter.name = dev_name(dev);
365376 priv->counter.parent = dev;
drivers/cpufreq/cpufreq-dt-platdev.c+2−0
@@ -103,6 +103,8 @@ static const struct of_device_id whitelist[] __initconst = { · 102 unmodified lines
103103 static const struct of_device_id blacklist[] __initconst = {
104104 { .compatible = "allwinner,sun50i-h6", },
105105
106+ { .compatible = "arm,vexpress", },
107+
106108 { .compatible = "calxeda,highbank", },
107109 { .compatible = "calxeda,ecx-2000", },
108110
drivers/cpufreq/qcom-cpufreq-hw.c+3−3
@@ -317,9 +317,9 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy) · 316 unmodified lines
317317 }
318318
319319 base = ioremap(res->start, resource_size(res));
320− if (IS_ERR(base)) {
320+ if (!base) {
321321 dev_err(dev, "failed to map resource %pR\n", res);
322− ret = PTR_ERR(base);
322+ ret = -ENOMEM;
323323 goto release_region;
324324 }
325325
@@ -374,7 +374,7 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy) · 48 unmodified lines
374374 error:
375375 kfree(data);
376376 unmap_base:
377− iounmap(data->base);
377+ iounmap(base);
378378 release_region:
379379 release_mem_region(res->start, resource_size(res));
380380 return ret;
drivers/firmware/efi/efi.c+2−1
@@ -927,7 +927,7 @@ int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size) · 926 unmodified lines
927927 }
928928
929929 /* first try to find a slot in an existing linked list entry */
930− for (prsv = efi_memreserve_root->next; prsv; prsv = rsv->next) {
930+ for (prsv = efi_memreserve_root->next; prsv; ) {
931931 rsv = memremap(prsv, sizeof(*rsv), MEMREMAP_WB);
932932 index = atomic_fetch_add_unless(&rsv->count, 1, rsv->size);
933933 if (index < rsv->size) {
@@ -937,6 +937,7 @@ int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size) · 3 unmodified lines
937937 memunmap(rsv);
938938 return efi_mem_reserve_iomem(addr, size);
939939 }
940+ prsv = rsv->next;
940941 memunmap(rsv);
941942 }
942943
drivers/firmware/efi/libstub/arm64-stub.c+1−1
@@ -24,7 +24,7 @@ efi_status_t check_platform_features(void) · 23 unmodified lines
2424 return EFI_SUCCESS;
2525
2626 tg = (read_cpuid(ID_AA64MMFR0_EL1) >> ID_AA64MMFR0_TGRAN_SHIFT) & 0xf;
27− if (tg != ID_AA64MMFR0_TGRAN_SUPPORTED) {
27+ if (tg < ID_AA64MMFR0_TGRAN_SUPPORTED_MIN || tg > ID_AA64MMFR0_TGRAN_SUPPORTED_MAX) {
2828 if (IS_ENABLED(CONFIG_ARM64_64K_PAGES))
2929 efi_err("This 64 KB granular kernel is not supported by your CPU\n");
3030 else
drivers/firmware/efi/libstub/efi-stub.c+16−0
@@ -96,6 +96,18 @@ static void install_memreserve_table(void) · 95 unmodified lines
9696 efi_err("Failed to install memreserve config table!\n");
9797 }
9898
99+static u32 get_supported_rt_services(void)
100+{
101+ const efi_rt_properties_table_t *rt_prop_table;
102+ u32 supported = EFI_RT_SUPPORTED_ALL;
103+
104+ rt_prop_table = get_efi_config_table(EFI_RT_PROPERTIES_TABLE_GUID);
105+ if (rt_prop_table)
106+ supported &= rt_prop_table->runtime_services_supported;
107+
108+ return supported;
109+}
110+
99111 /*
100112 * EFI entry point for the arm/arm64 EFI stubs. This is the entrypoint
101113 * that is described in the PE/COFF header. Most of the code is the same
@@ -250,6 +262,10 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle, · 148 unmodified lines
250262 (prop_tbl->memory_protection_attribute &
251263 EFI_PROPERTIES_RUNTIME_MEMORY_PROTECTION_NON_EXECUTABLE_PE_DATA);
252264
265+ /* force efi_novamap if SetVirtualAddressMap() is unsupported */
266+ efi_novamap |= !(get_supported_rt_services() &
267+ EFI_RT_SUPPORTED_SET_VIRTUAL_ADDRESS_MAP);
268+
253269 /* hibernation expects the runtime regions to stay in the same place */
254270 if (!IS_ENABLED(CONFIG_HIBERNATION) && !efi_nokaslr && !flat_va_mapping) {
255271 /*
drivers/firmware/efi/vars.c+4−0
@@ -484,6 +484,10 @@ int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *), · 483 unmodified lines
484484 }
485485 }
486486
487+ break;
488+ case EFI_UNSUPPORTED:
489+ err = -EOPNOTSUPP;
490+ status = EFI_NOT_FOUND;
487491 break;
488492 case EFI_NOT_FOUND:
489493 break;
drivers/gpio/gpiolib.c+9−1
@@ -571,6 +571,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data, · 570 unmodified lines
571571 struct lock_class_key *lock_key,
572572 struct lock_class_key *request_key)
573573 {
574+ struct fwnode_handle *fwnode = gc->parent ? dev_fwnode(gc->parent) : NULL;
574575 unsigned long flags;
575576 int ret = 0;
576577 unsigned i;
@@ -594,6 +595,12 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data, · 17 unmodified lines
594595
595596 of_gpio_dev_init(gc, gdev);
596597
598+ /*
599+ * Assign fwnode depending on the result of the previous calls,
600+ * if none of them succeed, assign it to the parent's one.
601+ */
602+ gdev->dev.fwnode = dev_fwnode(&gdev->dev) ?: fwnode;
603+
597604 gdev->id = ida_alloc(&gpio_ida, GFP_KERNEL);
598605 if (gdev->id < 0) {
599606 ret = gdev->id;
@@ -4256,7 +4263,8 @@ static int __init gpiolib_dev_init(void) · 3656 unmodified lines
42564263 return ret;
42574264 }
42584265
4259− if (driver_register(&gpio_stub_drv) < 0) {
4266+ ret = driver_register(&gpio_stub_drv);
4267+ if (ret < 0) {
42604268 pr_err("gpiolib: could not register GPIO stub driver\n");
42614269 bus_unregister(&gpio_bus_type);
42624270 return ret;
drivers/gpu/drm/Kconfig+1−0
@@ -228,6 +228,7 @@ source "drivers/gpu/drm/arm/Kconfig" · 227 unmodified lines
228228 config DRM_RADEON
229229 tristate "ATI Radeon"
230230 depends on DRM && PCI && MMU
231+ depends on AGP || !AGP
231232 select FW_LOADER
232233 select DRM_KMS_HELPER
233234 select DRM_TTM
drivers/gpu/drm/amd/amdgpu/amdgpu.h+1−0
@@ -180,6 +180,7 @@ extern uint amdgpu_smu_memory_pool_size; · 179 unmodified lines
180180 extern uint amdgpu_dc_feature_mask;
181181 extern uint amdgpu_dc_debug_mask;
182182 extern uint amdgpu_dm_abm_level;
183+extern int amdgpu_backlight;
183184 extern struct amdgpu_mgpu_info mgpu_info;
184185 extern int amdgpu_ras_enable;
185186 extern uint amdgpu_ras_mask;
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c+1−1
@@ -903,7 +903,7 @@ void amdgpu_acpi_fini(struct amdgpu_device *adev) · 902 unmodified lines
903903 */
904904 bool amdgpu_acpi_is_s0ix_supported(struct amdgpu_device *adev)
905905 {
906−#if defined(CONFIG_AMD_PMC)
906+#if defined(CONFIG_AMD_PMC) || defined(CONFIG_AMD_PMC_MODULE)
907907 if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) {
908908 if (adev->flags & AMD_IS_APU)
909909 return true;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c+4−0
@@ -781,6 +781,10 @@ uint amdgpu_dm_abm_level; · 780 unmodified lines
781781 MODULE_PARM_DESC(abmlevel, "ABM level (0 = off (default), 1-4 = backlight reduction level) ");
782782 module_param_named(abmlevel, amdgpu_dm_abm_level, uint, 0444);
783783
784+int amdgpu_backlight = -1;
785+MODULE_PARM_DESC(backlight, "Backlight control (0 = pwm, 1 = aux, -1 auto (default))");
786+module_param_named(backlight, amdgpu_backlight, bint, 0444);
787+
784788 /**
785789 * DOC: tmz (int)
786790 * Trusted Memory Zone (TMZ) is a method to protect data being written
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c+1−1
@@ -146,7 +146,7 @@ static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev, · 145 unmodified lines
146146 size = mode_cmd->pitches[0] * height;
147147 aligned_size = ALIGN(size, PAGE_SIZE);
148148 ret = amdgpu_gem_object_create(adev, aligned_size, 0, domain, flags,
149− ttm_bo_type_kernel, NULL, &gobj);
149+ ttm_bo_type_device, NULL, &gobj);
150150 if (ret) {
151151 pr_err("failed to allocate framebuffer (%d)\n", aligned_size);
152152 return -ENOMEM;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c+30−20
@@ -2267,6 +2267,11 @@ static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnector) · 2266 unmodified lines
22672267 caps->ext_caps->bits.hdr_aux_backlight_control == 1)
22682268 caps->aux_support = true;
22692269
2270+ if (amdgpu_backlight == 0)
2271+ caps->aux_support = false;
2272+ else if (amdgpu_backlight == 1)
2273+ caps->aux_support = true;
2274+
22702275 /* From the specification (CTA-861-G), for calculating the maximum
22712276 * luminance we need to use:
22722277 * Luminance = 50*2**(CV/32)
@@ -3185,19 +3190,6 @@ static void amdgpu_dm_update_backlight_caps(struct amdgpu_display_manager *dm) · 912 unmodified lines
31853190 #endif
31863191 }
31873192
3188−static int set_backlight_via_aux(struct dc_link *link, uint32_t brightness)
3189−{
3190− bool rc;
3191−
3192− if (!link)
3193− return 1;
3194−
3195− rc = dc_link_set_backlight_level_nits(link, true, brightness,
3196− AUX_BL_DEFAULT_TRANSITION_TIME_MS);
3197−
3198− return rc ? 0 : 1;
3199−}
3200−
32013193 static int get_brightness_range(const struct amdgpu_dm_backlight_caps *caps,
32023194 unsigned *min, unsigned *max)
32033195 {
@@ -3260,9 +3252,10 @@ static int amdgpu_dm_backlight_update_status(struct backlight_device *bd) · 56 unmodified lines
32603252 brightness = convert_brightness_from_user(&caps, bd->props.brightness);
32613253 // Change brightness based on AUX property
32623254 if (caps.aux_support)
3263− return set_backlight_via_aux(link, brightness);
3264−
3265− rc = dc_link_set_backlight_level(dm->backlight_link, brightness, 0);
3255+ rc = dc_link_set_backlight_level_nits(link, true, brightness,
3256+ AUX_BL_DEFAULT_TRANSITION_TIME_MS);
3257+ else
3258+ rc = dc_link_set_backlight_level(dm->backlight_link, brightness, 0);
32663259
32673260 return rc ? 0 : 1;
32683261 }
@@ -3270,11 +3263,27 @@ static int amdgpu_dm_backlight_update_status(struct backlight_device *bd) · 1 unmodified line
32703263 static int amdgpu_dm_backlight_get_brightness(struct backlight_device *bd)
32713264 {
32723265 struct amdgpu_display_manager *dm = bl_get_data(bd);
3273− int ret = dc_link_get_backlight_level(dm->backlight_link);
3266+ struct amdgpu_dm_backlight_caps caps;
3267+
3268+ amdgpu_dm_update_backlight_caps(dm);
3269+ caps = dm->backlight_caps;
3270+
3271+ if (caps.aux_support) {
3272+ struct dc_link *link = (struct dc_link *)dm->backlight_link;
3273+ u32 avg, peak;
3274+ bool rc;
32743275
3275− if (ret == DC_ERROR_UNEXPECTED)
3276− return bd->props.brightness;
3277− return convert_brightness_to_user(&dm->backlight_caps, ret);
3276+ rc = dc_link_get_backlight_level_nits(link, &avg, &peak);
3277+ if (!rc)
3278+ return bd->props.brightness;
3279+ return convert_brightness_to_user(&caps, avg);
3280+ } else {
3281+ int ret = dc_link_get_backlight_level(dm->backlight_link);
3282+
3283+ if (ret == DC_ERROR_UNEXPECTED)
3284+ return bd->props.brightness;
3285+ return convert_brightness_to_user(&caps, ret);
3286+ }
32783287 }
32793288
32803289 static const struct backlight_ops amdgpu_dm_backlight_ops = {
@@ -4716,6 +4725,7 @@ static int fill_dc_plane_attributes(struct amdgpu_device *adev, · 1435 unmodified lines
47164725 dc_plane_state->global_alpha_value = plane_info.global_alpha_value;
47174726 dc_plane_state->dcc = plane_info.dcc;
47184727 dc_plane_state->layer_index = plane_info.layer_index; // Always returns 0
4728+ dc_plane_state->flip_int_enabled = true;
47194729
47204730 /*
47214731 * Always set input transfer function, since plane state is refreshed
drivers/gpu/drm/amd/display/dc/core/dc_link.c+0−1
@@ -2602,7 +2602,6 @@ bool dc_link_set_backlight_level(const struct dc_link *link, · 2601 unmodified lines
26022602 if (pipe_ctx->plane_state == NULL)
26032603 frame_ramp = 0;
26042604 } else {
2605− ASSERT(false);
26062605 return false;
26072606 }
26082607
drivers/gpu/drm/amd/display/dc/dc.h+1−0
@@ -887,6 +887,7 @@ struct dc_plane_state { · 886 unmodified lines
887887 int layer_index;
888888
889889 union surface_update_flags update_flags;
890+ bool flip_int_enabled;
890891 /* private to DC core */
891892 struct dc_plane_status status;
892893 struct dc_context *ctx;
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c+11−0
@@ -1257,6 +1257,16 @@ void hubp1_soft_reset(struct hubp *hubp, bool reset) · 1256 unmodified lines
12571257 REG_UPDATE(DCHUBP_CNTL, HUBP_DISABLE, reset ? 1 : 0);
12581258 }
12591259
1260+void hubp1_set_flip_int(struct hubp *hubp)
1261+{
1262+ struct dcn10_hubp *hubp1 = TO_DCN10_HUBP(hubp);
1263+
1264+ REG_UPDATE(DCSURF_SURFACE_FLIP_INTERRUPT,
1265+ SURFACE_FLIP_INT_MASK, 1);
1266+
1267+ return;
1268+}
1269+
12601270 void hubp1_init(struct hubp *hubp)
12611271 {
12621272 //do nothing
@@ -1290,6 +1300,7 @@ static const struct hubp_funcs dcn10_hubp_funcs = { · 27 unmodified lines
12901300 .dmdata_load = NULL,
12911301 .hubp_soft_reset = hubp1_soft_reset,
12921302 .hubp_in_blank = hubp1_in_blank,
1303+ .hubp_set_flip_int = hubp1_set_flip_int,
12931304 };
12941305
12951306 /*****************************************/
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.h+6−0
@@ -74,6 +74,7 @@ · 73 unmodified lines
7474 SRI(DCSURF_SURFACE_EARLIEST_INUSE_C, HUBPREQ, id),\
7575 SRI(DCSURF_SURFACE_EARLIEST_INUSE_HIGH_C, HUBPREQ, id),\
7676 SRI(DCSURF_SURFACE_CONTROL, HUBPREQ, id),\
77+ SRI(DCSURF_SURFACE_FLIP_INTERRUPT, HUBPREQ, id),\
7778 SRI(HUBPRET_CONTROL, HUBPRET, id),\
7879 SRI(DCN_EXPANSION_MODE, HUBPREQ, id),\
7980 SRI(DCHUBP_REQ_SIZE_CONFIG, HUBP, id),\
@@ -183,6 +184,7 @@ · 103 unmodified lines
183184 uint32_t DCSURF_SURFACE_EARLIEST_INUSE_C; \
184185 uint32_t DCSURF_SURFACE_EARLIEST_INUSE_HIGH_C; \
185186 uint32_t DCSURF_SURFACE_CONTROL; \
187+ uint32_t DCSURF_SURFACE_FLIP_INTERRUPT; \
186188 uint32_t HUBPRET_CONTROL; \
187189 uint32_t DCN_EXPANSION_MODE; \
188190 uint32_t DCHUBP_REQ_SIZE_CONFIG; \
@@ -332,6 +334,7 @@ · 143 unmodified lines
332334 HUBP_SF(HUBPREQ0_DCSURF_SURFACE_CONTROL, SECONDARY_META_SURFACE_TMZ_C, mask_sh),\
333335 HUBP_SF(HUBPREQ0_DCSURF_SURFACE_CONTROL, SECONDARY_SURFACE_DCC_EN, mask_sh),\
334336 HUBP_SF(HUBPREQ0_DCSURF_SURFACE_CONTROL, SECONDARY_SURFACE_DCC_IND_64B_BLK, mask_sh),\
337+ HUBP_SF(HUBPREQ0_DCSURF_SURFACE_FLIP_INTERRUPT, SURFACE_FLIP_INT_MASK, mask_sh),\
335338 HUBP_SF(HUBPRET0_HUBPRET_CONTROL, DET_BUF_PLANE1_BASE_ADDRESS, mask_sh),\
336339 HUBP_SF(HUBPRET0_HUBPRET_CONTROL, CROSSBAR_SRC_CB_B, mask_sh),\
337340 HUBP_SF(HUBPRET0_HUBPRET_CONTROL, CROSSBAR_SRC_CR_R, mask_sh),\
@@ -531,6 +534,7 @@ · 193 unmodified lines
531534 type PRIMARY_SURFACE_DCC_IND_64B_BLK;\
532535 type SECONDARY_SURFACE_DCC_EN;\
533536 type SECONDARY_SURFACE_DCC_IND_64B_BLK;\
537+ type SURFACE_FLIP_INT_MASK;\
534538 type DET_BUF_PLANE1_BASE_ADDRESS;\
535539 type CROSSBAR_SRC_CB_B;\
536540 type CROSSBAR_SRC_CR_R;\
@@ -777,4 +781,6 @@ void hubp1_read_state_common(struct hubp *hubp); · 240 unmodified lines
777781 bool hubp1_in_blank(struct hubp *hubp);
778782 void hubp1_soft_reset(struct hubp *hubp, bool reset);
779783
784+void hubp1_set_flip_int(struct hubp *hubp);
785+
780786 #endif
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c+7−0
@@ -2196,6 +2196,13 @@ static void dcn10_enable_plane( · 2195 unmodified lines
21962196 if (dc->debug.sanity_checks) {
21972197 hws->funcs.verify_allow_pstate_change_high(dc);
21982198 }
2199+
2200+ if (!pipe_ctx->top_pipe
2201+ && pipe_ctx->plane_state
2202+ && pipe_ctx->plane_state->flip_int_enabled
2203+ && pipe_ctx->plane_res.hubp->funcs->hubp_set_flip_int)
2204+ pipe_ctx->plane_res.hubp->funcs->hubp_set_flip_int(pipe_ctx->plane_res.hubp);
2205+
21992206 }
22002207
22012208 void dcn10_program_gamut_remap(struct pipe_ctx *pipe_ctx)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hubp.c+1−0
@@ -1597,6 +1597,7 @@ static struct hubp_funcs dcn20_hubp_funcs = { · 1596 unmodified lines
15971597 .validate_dml_output = hubp2_validate_dml_output,
15981598 .hubp_in_blank = hubp1_in_blank,
15991599 .hubp_soft_reset = hubp1_soft_reset,
1600+ .hubp_set_flip_int = hubp1_set_flip_int,
16001601 };
16011602
16021603
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c+8−32
@@ -1146,6 +1146,12 @@ void dcn20_enable_plane( · 1145 unmodified lines
11461146 pipe_ctx->plane_res.hubp->funcs->hubp_set_vm_system_aperture_settings(pipe_ctx->plane_res.hubp, &apt);
11471147 }
11481148
1149+ if (!pipe_ctx->top_pipe
1150+ && pipe_ctx->plane_state
1151+ && pipe_ctx->plane_state->flip_int_enabled
1152+ && pipe_ctx->plane_res.hubp->funcs->hubp_set_flip_int)
1153+ pipe_ctx->plane_res.hubp->funcs->hubp_set_flip_int(pipe_ctx->plane_res.hubp);
1154+
11491155 // if (dc->debug.sanity_checks) {
11501156 // dcn10_verify_allow_pstate_change_high(dc);
11511157 // }
@@ -1501,38 +1507,8 @@ static void dcn20_update_dchubp_dpp( · 349 unmodified lines
15011507 if (pipe_ctx->update_flags.bits.enable || pipe_ctx->update_flags.bits.opp_changed
15021508 || pipe_ctx->stream->update_flags.bits.gamut_remap
15031509 || pipe_ctx->stream->update_flags.bits.out_csc) {
1504− struct mpc *mpc = pipe_ctx->stream_res.opp->ctx->dc->res_pool->mpc;
1505−
1506− if (mpc->funcs->set_gamut_remap) {
1507− int i;
1508− int mpcc_id = hubp->inst;
1509− struct mpc_grph_gamut_adjustment adjust;
1510− bool enable_remap_dpp = false;
1511−
1512− memset(&adjust, 0, sizeof(adjust));
1513− adjust.gamut_adjust_type = GRAPHICS_GAMUT_ADJUST_TYPE_BYPASS;
1514−
1515− /* save the enablement of gamut remap for dpp */
1516− enable_remap_dpp = pipe_ctx->stream->gamut_remap_matrix.enable_remap;
1517−
1518− /* force bypass gamut remap for dpp/cm */
1519− pipe_ctx->stream->gamut_remap_matrix.enable_remap = false;
1520− dc->hwss.program_gamut_remap(pipe_ctx);
1521−
1522− /* restore gamut remap flag and use this remap into mpc */
1523− pipe_ctx->stream->gamut_remap_matrix.enable_remap = enable_remap_dpp;
1524−
1525− /* build remap matrix for top plane if enabled */
1526− if (enable_remap_dpp && pipe_ctx->top_pipe == NULL) {
1527− adjust.gamut_adjust_type = GRAPHICS_GAMUT_ADJUST_TYPE_SW;
1528− for (i = 0; i < CSC_TEMPERATURE_MATRIX_SIZE; i++)
1529− adjust.temperature_matrix[i] =
1530− pipe_ctx->stream->gamut_remap_matrix.matrix[i];
1531− }
1532− mpc->funcs->set_gamut_remap(mpc, mpcc_id, &adjust);
1533− } else
1534− /* dpp/cm gamut remap*/
1535− dc->hwss.program_gamut_remap(pipe_ctx);
1510+ /* dpp/cm gamut remap*/
1511+ dc->hwss.program_gamut_remap(pipe_ctx);
15361512
15371513 /*call the dcn2 method which uses mpc csc*/
15381514 dc->hwss.program_output_csc(dc,
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_hubp.c+1−0
@@ -838,6 +838,7 @@ static struct hubp_funcs dcn21_hubp_funcs = { · 837 unmodified lines
838838 .hubp_set_flip_control_surface_gsl = hubp2_set_flip_control_surface_gsl,
839839 .hubp_init = hubp21_init,
840840 .validate_dml_output = hubp21_validate_dml_output,
841+ .hubp_set_flip_int = hubp1_set_flip_int,
841842 };
842843
843844 bool hubp21_construct(
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c+7−6
@@ -296,7 +296,7 @@ struct _vcs_dpi_soc_bounding_box_st dcn2_1_soc = { · 295 unmodified lines
296296 .num_banks = 8,
297297 .num_chans = 4,
298298 .vmm_page_size_bytes = 4096,
299− .dram_clock_change_latency_us = 11.72,
299+ .dram_clock_change_latency_us = 23.84,
300300 .return_bus_width_bytes = 64,
301301 .dispclk_dppclk_vco_speed_mhz = 3600,
302302 .xfc_bus_transport_time_us = 4,
@@ -1062,8 +1062,6 @@ static void patch_bounding_box(struct dc *dc, struct _vcs_dpi_soc_bounding_box_s · 759 unmodified lines
10621062 {
10631063 int i;
10641064
1065− DC_FP_START();
1066−
10671065 if (dc->bb_overrides.sr_exit_time_ns) {
10681066 for (i = 0; i < WM_SET_COUNT; i++) {
10691067 dc->clk_mgr->bw_params->wm_table.entries[i].sr_exit_time_us =
@@ -1088,8 +1086,6 @@ static void patch_bounding_box(struct dc *dc, struct _vcs_dpi_soc_bounding_box_s · 18 unmodified lines
10881086 dc->bb_overrides.dram_clock_change_latency_ns / 1000.0;
10891087 }
10901088 }
1091−
1092− DC_FP_END();
10931089 }
10941090
10951091 void dcn21_calculate_wm(
@@ -1339,7 +1335,7 @@ static noinline bool dcn21_validate_bandwidth_fp(struct dc *dc, · 243 unmodified lines
13391335 int vlevel = 0;
13401336 int pipe_split_from[MAX_PIPES];
13411337 int pipe_cnt = 0;
1342− display_e2e_pipe_params_st *pipes = kzalloc(dc->res_pool->pipe_count * sizeof(display_e2e_pipe_params_st), GFP_KERNEL);
1338+ display_e2e_pipe_params_st *pipes = kzalloc(dc->res_pool->pipe_count * sizeof(display_e2e_pipe_params_st), GFP_ATOMIC);
13431339 DC_LOGGER_INIT(dc->ctx->logger);
13441340
13451341 BW_VAL_TRACE_COUNT();
@@ -1599,6 +1595,11 @@ static void update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_param · 253 unmodified lines
15991595 dcn2_1_soc.num_chans = bw_params->num_channels;
16001596
16011597 ASSERT(clk_table->num_entries);
1598+ /* Copy dcn2_1_soc.clock_limits to clock_limits to avoid copying over null states later */
1599+ for (i = 0; i < dcn2_1_soc.num_states + 1; i++) {
1600+ clock_limits[i] = dcn2_1_soc.clock_limits[i];
1601+ }
1602+
16021603 for (i = 0; i < clk_table->num_entries; i++) {
16031604 /* loop backwards*/
16041605 for (closest_clk_lvl = 0, j = dcn2_1_soc.num_states - 1; j >= 0; j--) {
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c+18−8
@@ -113,6 +113,7 @@ bool cm3_helper_translate_curve_to_hw_format( · 112 unmodified lines
113113 struct pwl_result_data *rgb_resulted;
114114 struct pwl_result_data *rgb;
115115 struct pwl_result_data *rgb_plus_1;
116+ struct pwl_result_data *rgb_minus_1;
116117 struct fixed31_32 end_value;
117118
118119 int32_t region_start, region_end;
@@ -140,7 +141,7 @@ bool cm3_helper_translate_curve_to_hw_format( · 21 unmodified lines
140141 region_start = -MAX_LOW_POINT;
141142 region_end = NUMBER_REGIONS - MAX_LOW_POINT;
142143 } else {
143− /* 10 segments
144+ /* 11 segments
144145 * segment is from 2^-10 to 2^0
145146 * There are less than 256 points, for optimization
146147 */
@@ -154,9 +155,10 @@ bool cm3_helper_translate_curve_to_hw_format( · 7 unmodified lines
154155 seg_distr[7] = 4;
155156 seg_distr[8] = 4;
156157 seg_distr[9] = 4;
158+ seg_distr[10] = 1;
157159
158160 region_start = -10;
159− region_end = 0;
161+ region_end = 1;
160162 }
161163
162164 for (i = region_end - region_start; i < MAX_REGIONS_NUMBER ; i++)
@@ -189,6 +191,10 @@ bool cm3_helper_translate_curve_to_hw_format( · 26 unmodified lines
189191 rgb_resulted[hw_points - 1].green = output_tf->tf_pts.green[start_index];
190192 rgb_resulted[hw_points - 1].blue = output_tf->tf_pts.blue[start_index];
191193
194+ rgb_resulted[hw_points].red = rgb_resulted[hw_points - 1].red;
195+ rgb_resulted[hw_points].green = rgb_resulted[hw_points - 1].green;
196+ rgb_resulted[hw_points].blue = rgb_resulted[hw_points - 1].blue;
197+
192198 // All 3 color channels have same x
193199 corner_points[0].red.x = dc_fixpt_pow(dc_fixpt_from_int(2),
194200 dc_fixpt_from_int(region_start));
@@ -259,15 +265,18 @@ bool cm3_helper_translate_curve_to_hw_format( · 64 unmodified lines
259265
260266 rgb = rgb_resulted;
261267 rgb_plus_1 = rgb_resulted + 1;
268+ rgb_minus_1 = rgb;
262269
263270 i = 1;
264271 while (i != hw_points + 1) {
265− if (dc_fixpt_lt(rgb_plus_1->red, rgb->red))
266− rgb_plus_1->red = rgb->red;
267− if (dc_fixpt_lt(rgb_plus_1->green, rgb->green))
268− rgb_plus_1->green = rgb->green;
269− if (dc_fixpt_lt(rgb_plus_1->blue, rgb->blue))
270− rgb_plus_1->blue = rgb->blue;
272+ if (i >= hw_points - 1) {
273+ if (dc_fixpt_lt(rgb_plus_1->red, rgb->red))
274+ rgb_plus_1->red = dc_fixpt_add(rgb->red, rgb_minus_1->delta_red);
275+ if (dc_fixpt_lt(rgb_plus_1->green, rgb->green))
276+ rgb_plus_1->green = dc_fixpt_add(rgb->green, rgb_minus_1->delta_green);
277+ if (dc_fixpt_lt(rgb_plus_1->blue, rgb->blue))
278+ rgb_plus_1->blue = dc_fixpt_add(rgb->blue, rgb_minus_1->delta_blue);
279+ }
271280
272281 rgb->delta_red = dc_fixpt_sub(rgb_plus_1->red, rgb->red);
273282 rgb->delta_green = dc_fixpt_sub(rgb_plus_1->green, rgb->green);
@@ -283,6 +292,7 @@ bool cm3_helper_translate_curve_to_hw_format( · 9 unmodified lines
283292 }
284293
285294 ++rgb_plus_1;
295+ rgb_minus_1 = rgb;
286296 ++rgb;
287297 ++i;
288298 }
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hubp.c+1−0
@@ -511,6 +511,7 @@ static struct hubp_funcs dcn30_hubp_funcs = { · 510 unmodified lines
511511 .hubp_init = hubp3_init,
512512 .hubp_in_blank = hubp1_in_blank,
513513 .hubp_soft_reset = hubp1_soft_reset,
514+ .hubp_set_flip_int = hubp1_set_flip_int,
514515 };
515516
516517 bool hubp3_construct(
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c+31−0
@@ -2508,6 +2508,19 @@ static const struct resource_funcs dcn30_res_pool_funcs = { · 2507 unmodified lines
25082508 .patch_unknown_plane_state = dcn20_patch_unknown_plane_state,
25092509 };
25102510
2511+#define CTX ctx
2512+
2513+#define REG(reg_name) \
2514+ (DCN_BASE.instance[0].segment[mm ## reg_name ## _BASE_IDX] + mm ## reg_name)
2515+
2516+static uint32_t read_pipe_fuses(struct dc_context *ctx)
2517+{
2518+ uint32_t value = REG_READ(CC_DC_PIPE_DIS);
2519+ /* Support for max 6 pipes */
2520+ value = value & 0x3f;
2521+ return value;
2522+}
2523+
25112524 static bool dcn30_resource_construct(
25122525 uint8_t num_virtual_links,
25132526 struct dc *dc,
@@ -2517,6 +2530,15 @@ static bool dcn30_resource_construct( · 3 unmodified lines
25172530 struct dc_context *ctx = dc->ctx;
25182531 struct irq_service_init_data init_data;
25192532 struct ddc_service_init_data ddc_init_data;
2533+ uint32_t pipe_fuses = read_pipe_fuses(ctx);
2534+ uint32_t num_pipes = 0;
2535+
2536+ if (!(pipe_fuses == 0 || pipe_fuses == 0x3e)) {
2537+ BREAK_TO_DEBUGGER();
2538+ dm_error("DC: Unexpected fuse recipe for navi2x !\n");
2539+ /* fault to single pipe */
2540+ pipe_fuses = 0x3e;
2541+ }
25202542
25212543 DC_FP_START();
25222544
@@ -2650,6 +2672,15 @@ static bool dcn30_resource_construct( · 127 unmodified lines
26502672 /* PP Lib and SMU interfaces */
26512673 init_soc_bounding_box(dc, pool);
26522674
2675+ num_pipes = dcn3_0_ip.max_num_dpp;
2676+
2677+ for (i = 0; i < dcn3_0_ip.max_num_dpp; i++)
2678+ if (pipe_fuses & 1 << i)
2679+ num_pipes--;
2680+
2681+ dcn3_0_ip.max_num_dpp = num_pipes;
2682+ dcn3_0_ip.max_num_otg = num_pipes;
2683+
26532684 dml_init_instance(&dc->dml, &dcn3_0_soc, &dcn3_0_ip, DML_PROJECT_DCN30);
26542685
26552686 /* IRQ */
drivers/gpu/drm/amd/display/dc/dcn301/dcn301_resource.c+95−1
@@ -1619,12 +1619,106 @@ static void dcn301_update_bw_bounding_box(struct dc *dc, struct clk_bw_params *b · 1618 unmodified lines
16191619 dml_init_instance(&dc->dml, &dcn3_01_soc, &dcn3_01_ip, DML_PROJECT_DCN30);
16201620 }
16211621
1622+static void calculate_wm_set_for_vlevel(
1623+ int vlevel,
1624+ struct wm_range_table_entry *table_entry,
1625+ struct dcn_watermarks *wm_set,
1626+ struct display_mode_lib *dml,
1627+ display_e2e_pipe_params_st *pipes,
1628+ int pipe_cnt)
1629+{
1630+ double dram_clock_change_latency_cached = dml->soc.dram_clock_change_latency_us;
1631+
1632+ ASSERT(vlevel < dml->soc.num_states);
1633+ /* only pipe 0 is read for voltage and dcf/soc clocks */
1634+ pipes[0].clks_cfg.voltage = vlevel;
1635+ pipes[0].clks_cfg.dcfclk_mhz = dml->soc.clock_limits[vlevel].dcfclk_mhz;
1636+ pipes[0].clks_cfg.socclk_mhz = dml->soc.clock_limits[vlevel].socclk_mhz;
1637+
1638+ dml->soc.dram_clock_change_latency_us = table_entry->pstate_latency_us;
1639+ dml->soc.sr_exit_time_us = table_entry->sr_exit_time_us;
1640+ dml->soc.sr_enter_plus_exit_time_us = table_entry->sr_enter_plus_exit_time_us;
1641+
1642+ wm_set->urgent_ns = get_wm_urgent(dml, pipes, pipe_cnt) * 1000;
1643+ wm_set->cstate_pstate.cstate_enter_plus_exit_ns = get_wm_stutter_enter_exit(dml, pipes, pipe_cnt) * 1000;
1644+ wm_set->cstate_pstate.cstate_exit_ns = get_wm_stutter_exit(dml, pipes, pipe_cnt) * 1000;
1645+ wm_set->cstate_pstate.pstate_change_ns = get_wm_dram_clock_change(dml, pipes, pipe_cnt) * 1000;
1646+ wm_set->pte_meta_urgent_ns = get_wm_memory_trip(dml, pipes, pipe_cnt) * 1000;
1647+ wm_set->frac_urg_bw_nom = get_fraction_of_urgent_bandwidth(dml, pipes, pipe_cnt) * 1000;
1648+ wm_set->frac_urg_bw_flip = get_fraction_of_urgent_bandwidth_imm_flip(dml, pipes, pipe_cnt) * 1000;
1649+ wm_set->urgent_latency_ns = get_urgent_latency(dml, pipes, pipe_cnt) * 1000;
1650+ dml->soc.dram_clock_change_latency_us = dram_clock_change_latency_cached;
1651+
1652+}
1653+
1654+static void dcn301_calculate_wm_and_dlg(
1655+ struct dc *dc, struct dc_state *context,
1656+ display_e2e_pipe_params_st *pipes,
1657+ int pipe_cnt,
1658+ int vlevel_req)
1659+{
1660+ int i, pipe_idx;
1661+ int vlevel, vlevel_max;
1662+ struct wm_range_table_entry *table_entry;
1663+ struct clk_bw_params *bw_params = dc->clk_mgr->bw_params;
1664+
1665+ ASSERT(bw_params);
1666+
1667+ vlevel_max = bw_params->clk_table.num_entries - 1;
1668+
1669+ /* WM Set D */
1670+ table_entry = &bw_params->wm_table.entries[WM_D];
1671+ if (table_entry->wm_type == WM_TYPE_RETRAINING)
1672+ vlevel = 0;
1673+ else
1674+ vlevel = vlevel_max;
1675+ calculate_wm_set_for_vlevel(vlevel, table_entry, &context->bw_ctx.bw.dcn.watermarks.d,
1676+ &context->bw_ctx.dml, pipes, pipe_cnt);
1677+ /* WM Set C */
1678+ table_entry = &bw_params->wm_table.entries[WM_C];
1679+ vlevel = min(max(vlevel_req, 2), vlevel_max);
1680+ calculate_wm_set_for_vlevel(vlevel, table_entry, &context->bw_ctx.bw.dcn.watermarks.c,
1681+ &context->bw_ctx.dml, pipes, pipe_cnt);
1682+ /* WM Set B */
1683+ table_entry = &bw_params->wm_table.entries[WM_B];
1684+ vlevel = min(max(vlevel_req, 1), vlevel_max);
1685+ calculate_wm_set_for_vlevel(vlevel, table_entry, &context->bw_ctx.bw.dcn.watermarks.b,
1686+ &context->bw_ctx.dml, pipes, pipe_cnt);
1687+
1688+ /* WM Set A */
1689+ table_entry = &bw_params->wm_table.entries[WM_A];
1690+ vlevel = min(vlevel_req, vlevel_max);
1691+ calculate_wm_set_for_vlevel(vlevel, table_entry, &context->bw_ctx.bw.dcn.watermarks.a,
1692+ &context->bw_ctx.dml, pipes, pipe_cnt);
1693+
1694+ for (i = 0, pipe_idx = 0; i < dc->res_pool->pipe_count; i++) {
1695+ if (!context->res_ctx.pipe_ctx[i].stream)
1696+ continue;
1697+
1698+ pipes[pipe_idx].clks_cfg.dispclk_mhz = get_dispclk_calculated(&context->bw_ctx.dml, pipes, pipe_cnt);
1699+ pipes[pipe_idx].clks_cfg.dppclk_mhz = get_dppclk_calculated(&context->bw_ctx.dml, pipes, pipe_cnt, pipe_idx);
1700+
1701+ if (dc->config.forced_clocks) {
1702+ pipes[pipe_idx].clks_cfg.dispclk_mhz = context->bw_ctx.dml.soc.clock_limits[0].dispclk_mhz;
1703+ pipes[pipe_idx].clks_cfg.dppclk_mhz = context->bw_ctx.dml.soc.clock_limits[0].dppclk_mhz;
1704+ }
1705+ if (dc->debug.min_disp_clk_khz > pipes[pipe_idx].clks_cfg.dispclk_mhz * 1000)
1706+ pipes[pipe_idx].clks_cfg.dispclk_mhz = dc->debug.min_disp_clk_khz / 1000.0;
1707+ if (dc->debug.min_dpp_clk_khz > pipes[pipe_idx].clks_cfg.dppclk_mhz * 1000)
1708+ pipes[pipe_idx].clks_cfg.dppclk_mhz = dc->debug.min_dpp_clk_khz / 1000.0;
1709+
1710+ pipe_idx++;
1711+ }
1712+
1713+ dcn20_calculate_dlg_params(dc, context, pipes, pipe_cnt, vlevel);
1714+}
1715+
16221716 static struct resource_funcs dcn301_res_pool_funcs = {
16231717 .destroy = dcn301_destroy_resource_pool,
16241718 .link_enc_create = dcn301_link_encoder_create,
16251719 .panel_cntl_create = dcn301_panel_cntl_create,
16261720 .validate_bandwidth = dcn30_validate_bandwidth,
1627− .calculate_wm_and_dlg = dcn30_calculate_wm_and_dlg,
1721+ .calculate_wm_and_dlg = dcn301_calculate_wm_and_dlg,
16281722 .populate_dml_pipes = dcn30_populate_dml_pipes_from_context,
16291723 .acquire_idle_pipe_for_layer = dcn20_acquire_idle_pipe_for_layer,
16301724 .add_stream_to_ctx = dcn30_add_stream_to_ctx,
drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h+2−0
@@ -191,6 +191,8 @@ struct hubp_funcs { · 190 unmodified lines
191191 bool (*hubp_in_blank)(struct hubp *hubp);
192192 void (*hubp_soft_reset)(struct hubp *hubp, bool reset);
193193
194+ void (*hubp_set_flip_int)(struct hubp *hubp);
195+
194196 };
195197
196198 #endif
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c+4−4
@@ -5216,10 +5216,10 @@ static int smu7_set_watermarks_for_clocks_ranges(struct pp_hwmgr *hwmgr, · 5215 unmodified lines
52165216 for (j = 0; j < dep_sclk_table->count; j++) {
52175217 valid_entry = false;
52185218 for (k = 0; k < watermarks->num_wm_sets; k++) {
5219− if (dep_sclk_table->entries[i].clk / 10 >= watermarks->wm_clk_ranges[k].wm_min_eng_clk_in_khz &&
5220− dep_sclk_table->entries[i].clk / 10 < watermarks->wm_clk_ranges[k].wm_max_eng_clk_in_khz &&
5221− dep_mclk_table->entries[i].clk / 10 >= watermarks->wm_clk_ranges[k].wm_min_mem_clk_in_khz &&
5222− dep_mclk_table->entries[i].clk / 10 < watermarks->wm_clk_ranges[k].wm_max_mem_clk_in_khz) {
5219+ if (dep_sclk_table->entries[i].clk >= watermarks->wm_clk_ranges[k].wm_min_eng_clk_in_khz / 10 &&
5220+ dep_sclk_table->entries[i].clk < watermarks->wm_clk_ranges[k].wm_max_eng_clk_in_khz / 10 &&
5221+ dep_mclk_table->entries[i].clk >= watermarks->wm_clk_ranges[k].wm_min_mem_clk_in_khz / 10 &&
5222+ dep_mclk_table->entries[i].clk < watermarks->wm_clk_ranges[k].wm_max_mem_clk_in_khz / 10) {
52235223 valid_entry = true;
52245224 table->DisplayWatermark[i][j] = watermarks->wm_clk_ranges[k].wm_set_id;
52255225 break;
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c+48−0
@@ -1505,6 +1505,48 @@ static int vega10_populate_single_lclk_level(struct pp_hwmgr *hwmgr, · 1504 unmodified lines
15051505 return 0;
15061506 }
15071507
1508+static int vega10_override_pcie_parameters(struct pp_hwmgr *hwmgr)
1509+{
1510+ struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev);
1511+ struct vega10_hwmgr *data =
1512+ (struct vega10_hwmgr *)(hwmgr->backend);
1513+ uint32_t pcie_gen = 0, pcie_width = 0;
1514+ PPTable_t *pp_table = &(data->smc_state_table.pp_table);
1515+ int i;
1516+
1517+ if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN4)
1518+ pcie_gen = 3;
1519+ else if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3)
1520+ pcie_gen = 2;
1521+ else if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN2)
1522+ pcie_gen = 1;
1523+ else if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN1)
1524+ pcie_gen = 0;
1525+
1526+ if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X16)
1527+ pcie_width = 6;
1528+ else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X12)
1529+ pcie_width = 5;
1530+ else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X8)
1531+ pcie_width = 4;
1532+ else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X4)
1533+ pcie_width = 3;
1534+ else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X2)
1535+ pcie_width = 2;
1536+ else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X1)
1537+ pcie_width = 1;
1538+
1539+ for (i = 0; i < NUM_LINK_LEVELS; i++) {
1540+ if (pp_table->PcieGenSpeed[i] > pcie_gen)
1541+ pp_table->PcieGenSpeed[i] = pcie_gen;
1542+
1543+ if (pp_table->PcieLaneCount[i] > pcie_width)
1544+ pp_table->PcieLaneCount[i] = pcie_width;
1545+ }
1546+
1547+ return 0;
1548+}
1549+
15081550 static int vega10_populate_smc_link_levels(struct pp_hwmgr *hwmgr)
15091551 {
15101552 int result = -1;
@@ -2556,6 +2598,11 @@ static int vega10_init_smc_table(struct pp_hwmgr *hwmgr) · 1045 unmodified lines
25562598 "Failed to initialize Link Level!",
25572599 return result);
25582600
2601+ result = vega10_override_pcie_parameters(hwmgr);
2602+ PP_ASSERT_WITH_CODE(!result,
2603+ "Failed to override pcie parameters!",
2604+ return result);
2605+
25592606 result = vega10_populate_all_graphic_levels(hwmgr);
25602607 PP_ASSERT_WITH_CODE(!result,
25612608 "Failed to initialize Graphics Level!",
@@ -2922,6 +2969,7 @@ static int vega10_start_dpm(struct pp_hwmgr *hwmgr, uint32_t bitmap) · 360 unmodified lines
29222969 return 0;
29232970 }
29242971
2972+
29252973 static int vega10_enable_disable_PCC_limit_feature(struct pp_hwmgr *hwmgr, bool enable)
29262974 {
29272975 struct vega10_hwmgr *data = hwmgr->backend;
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega12_hwmgr.c+66−0
@@ -481,6 +481,67 @@ static void vega12_init_dpm_state(struct vega12_dpm_state *dpm_state) · 480 unmodified lines
481481 dpm_state->hard_max_level = 0xffff;
482482 }
483483
484+static int vega12_override_pcie_parameters(struct pp_hwmgr *hwmgr)
485+{
486+ struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev);
487+ struct vega12_hwmgr *data =
488+ (struct vega12_hwmgr *)(hwmgr->backend);
489+ uint32_t pcie_gen = 0, pcie_width = 0, smu_pcie_arg, pcie_gen_arg, pcie_width_arg;
490+ PPTable_t *pp_table = &(data->smc_state_table.pp_table);
491+ int i;
492+ int ret;
493+
494+ if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN4)
495+ pcie_gen = 3;
496+ else if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3)
497+ pcie_gen = 2;
498+ else if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN2)
499+ pcie_gen = 1;
500+ else if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN1)
501+ pcie_gen = 0;
502+
503+ if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X16)
504+ pcie_width = 6;
505+ else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X12)
506+ pcie_width = 5;
507+ else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X8)
508+ pcie_width = 4;
509+ else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X4)
510+ pcie_width = 3;
511+ else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X2)
512+ pcie_width = 2;
513+ else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X1)
514+ pcie_width = 1;
515+
516+ /* Bit 31:16: LCLK DPM level. 0 is DPM0, and 1 is DPM1
517+ * Bit 15:8: PCIE GEN, 0 to 3 corresponds to GEN1 to GEN4
518+ * Bit 7:0: PCIE lane width, 1 to 7 corresponds is x1 to x32
519+ */
520+ for (i = 0; i < NUM_LINK_LEVELS; i++) {
521+ pcie_gen_arg = (pp_table->PcieGenSpeed[i] > pcie_gen) ? pcie_gen :
522+ pp_table->PcieGenSpeed[i];
523+ pcie_width_arg = (pp_table->PcieLaneCount[i] > pcie_width) ? pcie_width :
524+ pp_table->PcieLaneCount[i];
525+
526+ if (pcie_gen_arg != pp_table->PcieGenSpeed[i] || pcie_width_arg !=
527+ pp_table->PcieLaneCount[i]) {
528+ smu_pcie_arg = (i << 16) | (pcie_gen_arg << 8) | pcie_width_arg;
529+ ret = smum_send_msg_to_smc_with_parameter(hwmgr,
530+ PPSMC_MSG_OverridePcieParameters, smu_pcie_arg,
531+ NULL);
532+ PP_ASSERT_WITH_CODE(!ret,
533+ "[OverridePcieParameters] Attempt to override pcie params failed!",
534+ return ret);
535+ }
536+
537+ /* update the pptable */
538+ pp_table->PcieGenSpeed[i] = pcie_gen_arg;
539+ pp_table->PcieLaneCount[i] = pcie_width_arg;
540+ }
541+
542+ return 0;
543+}
544+
484545 static int vega12_get_number_of_dpm_level(struct pp_hwmgr *hwmgr,
485546 PPCLK_e clk_id, uint32_t *num_of_levels)
486547 {
@@ -968,6 +1029,11 @@ static int vega12_enable_dpm_tasks(struct pp_hwmgr *hwmgr) · 481 unmodified lines
9681029 "Failed to enable all smu features!",
9691030 return result);
9701031
1032+ result = vega12_override_pcie_parameters(hwmgr);
1033+ PP_ASSERT_WITH_CODE(!result,
1034+ "[EnableDPMTasks] Failed to override pcie parameters!",
1035+ return result);
1036+
9711037 tmp_result = vega12_power_control_set_level(hwmgr);
9721038 PP_ASSERT_WITH_CODE(!tmp_result,
9731039 "Failed to power control set level!",
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c+27−21
@@ -831,7 +831,9 @@ static int vega20_override_pcie_parameters(struct pp_hwmgr *hwmgr) · 830 unmodified lines
831831 struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev);
832832 struct vega20_hwmgr *data =
833833 (struct vega20_hwmgr *)(hwmgr->backend);
834− uint32_t pcie_gen = 0, pcie_width = 0, smu_pcie_arg;
834+ uint32_t pcie_gen = 0, pcie_width = 0, smu_pcie_arg, pcie_gen_arg, pcie_width_arg;
835+ PPTable_t *pp_table = &(data->smc_state_table.pp_table);
836+ int i;
835837 int ret;
836838
837839 if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN4)
@@ -860,17 +862,27 @@ static int vega20_override_pcie_parameters(struct pp_hwmgr *hwmgr) · 22 unmodified lines
860862 * Bit 15:8: PCIE GEN, 0 to 3 corresponds to GEN1 to GEN4
861863 * Bit 7:0: PCIE lane width, 1 to 7 corresponds is x1 to x32
862864 */
863− smu_pcie_arg = (1 << 16) | (pcie_gen << 8) | pcie_width;
864− ret = smum_send_msg_to_smc_with_parameter(hwmgr,
865− PPSMC_MSG_OverridePcieParameters, smu_pcie_arg,
866− NULL);
867− PP_ASSERT_WITH_CODE(!ret,
868− "[OverridePcieParameters] Attempt to override pcie params failed!",
869− return ret);
865+ for (i = 0; i < NUM_LINK_LEVELS; i++) {
866+ pcie_gen_arg = (pp_table->PcieGenSpeed[i] > pcie_gen) ? pcie_gen :
867+ pp_table->PcieGenSpeed[i];
868+ pcie_width_arg = (pp_table->PcieLaneCount[i] > pcie_width) ? pcie_width :
869+ pp_table->PcieLaneCount[i];
870+
871+ if (pcie_gen_arg != pp_table->PcieGenSpeed[i] || pcie_width_arg !=
872+ pp_table->PcieLaneCount[i]) {
873+ smu_pcie_arg = (i << 16) | (pcie_gen_arg << 8) | pcie_width_arg;
874+ ret = smum_send_msg_to_smc_with_parameter(hwmgr,
875+ PPSMC_MSG_OverridePcieParameters, smu_pcie_arg,
876+ NULL);
877+ PP_ASSERT_WITH_CODE(!ret,
878+ "[OverridePcieParameters] Attempt to override pcie params failed!",
879+ return ret);
880+ }
870881
871− data->pcie_parameters_override = true;
872− data->pcie_gen_level1 = pcie_gen;
873− data->pcie_width_level1 = pcie_width;
882+ /* update the pptable */
883+ pp_table->PcieGenSpeed[i] = pcie_gen_arg;
884+ pp_table->PcieLaneCount[i] = pcie_width_arg;
885+ }
874886
875887 return 0;
876888 }
@@ -3319,9 +3331,7 @@ static int vega20_print_clock_levels(struct pp_hwmgr *hwmgr, · 2442 unmodified lines
33193331 data->od8_settings.od8_settings_array;
33203332 OverDriveTable_t *od_table =
33213333 &(data->smc_state_table.overdrive_table);
3322− struct phm_ppt_v3_information *pptable_information =
3323− (struct phm_ppt_v3_information *)hwmgr->pptable;
3324− PPTable_t *pptable = (PPTable_t *)pptable_information->smc_pptable;
3334+ PPTable_t *pptable = &(data->smc_state_table.pp_table);
33253335 struct pp_clock_levels_with_latency clocks;
33263336 struct vega20_single_dpm_table *fclk_dpm_table =
33273337 &(data->dpm_table.fclk_table);
@@ -3420,13 +3430,9 @@ static int vega20_print_clock_levels(struct pp_hwmgr *hwmgr, · 92 unmodified lines
34203430 current_lane_width =
34213431 vega20_get_current_pcie_link_width_level(hwmgr);
34223432 for (i = 0; i < NUM_LINK_LEVELS; i++) {
3423− if (i == 1 && data->pcie_parameters_override) {
3424− gen_speed = data->pcie_gen_level1;
3425− lane_width = data->pcie_width_level1;
3426− } else {
3427− gen_speed = pptable->PcieGenSpeed[i];
3428− lane_width = pptable->PcieLaneCount[i];
3429− }
3433+ gen_speed = pptable->PcieGenSpeed[i];
3434+ lane_width = pptable->PcieLaneCount[i];
3435+
34303436 size += sprintf(buf + size, "%d: %s %s %dMhz %s\n", i,
34313437 (gen_speed == 0) ? "2.5GT/s," :
34323438 (gen_speed == 1) ? "5.0GT/s," :
drivers/gpu/drm/drm_fb_helper.c+1−1
@@ -2048,7 +2048,7 @@ static void drm_fbdev_cleanup(struct drm_fb_helper *fb_helper) · 2047 unmodified lines
20482048
20492049 if (shadow)
20502050 vfree(shadow);
2051− else
2051+ else if (fb_helper->buffer)
20522052 drm_client_buffer_vunmap(fb_helper->buffer);
20532053
20542054 drm_client_framebuffer_delete(fb_helper->buffer);
drivers/gpu/drm/drm_gem_shmem_helper.c+22−10
@@ -357,13 +357,14 @@ static void drm_gem_shmem_vunmap_locked(struct drm_gem_shmem_object *shmem, · 356 unmodified lines
357357 if (--shmem->vmap_use_count > 0)
358358 return;
359359
360− if (obj->import_attach)
360+ if (obj->import_attach) {
361361 dma_buf_vunmap(obj->import_attach->dmabuf, map);
362− else
362+ } else {
363363 vunmap(shmem->vaddr);
364+ drm_gem_shmem_put_pages(shmem);
365+ }
364366
365367 shmem->vaddr = NULL;
366− drm_gem_shmem_put_pages(shmem);
367368 }
368369
369370 /*
@@ -525,14 +526,28 @@ static vm_fault_t drm_gem_shmem_fault(struct vm_fault *vmf) · 155 unmodified lines
525526 struct drm_gem_object *obj = vma->vm_private_data;
526527 struct drm_gem_shmem_object *shmem = to_drm_gem_shmem_obj(obj);
527528 loff_t num_pages = obj->size >> PAGE_SHIFT;
529+ vm_fault_t ret;
528530 struct page *page;
531+ pgoff_t page_offset;
529532
530− if (vmf->pgoff >= num_pages || WARN_ON_ONCE(!shmem->pages))
531− return VM_FAULT_SIGBUS;
533+ /* We don't use vmf->pgoff since that has the fake offset */
534+ page_offset = (vmf->address - vma->vm_start) >> PAGE_SHIFT;
532535
533− page = shmem->pages[vmf->pgoff];
536+ mutex_lock(&shmem->pages_lock);
534537
535− return vmf_insert_page(vma, vmf->address, page);
538+ if (page_offset >= num_pages ||
539+ WARN_ON_ONCE(!shmem->pages) ||
540+ shmem->madv < 0) {
541+ ret = VM_FAULT_SIGBUS;
542+ } else {
543+ page = shmem->pages[page_offset];
544+
545+ ret = vmf_insert_page(vma, vmf->address, page);
546+ }
547+
548+ mutex_unlock(&shmem->pages_lock);
549+
550+ return ret;
536551 }
537552
538553 static void drm_gem_shmem_vm_open(struct vm_area_struct *vma)
@@ -581,9 +596,6 @@ int drm_gem_shmem_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma) · 42 unmodified lines
581596 struct drm_gem_shmem_object *shmem;
582597 int ret;
583598
584− /* Remove the fake offset */
585− vma->vm_pgoff -= drm_vma_node_start(&obj->vma_node);
586−
587599 if (obj->import_attach) {
588600 /* Drop the reference drm_gem_mmap_obj() acquired.*/
589601 drm_gem_object_put(obj);
drivers/gpu/drm/drm_ioc32.c+11−0
@@ -99,6 +99,8 @@ static int compat_drm_version(struct file *file, unsigned int cmd, · 98 unmodified lines
9999 if (copy_from_user(&v32, (void __user *)arg, sizeof(v32)))
100100 return -EFAULT;
101101
102+ memset(&v, 0, sizeof(v));
103+
102104 v = (struct drm_version) {
103105 .name_len = v32.name_len,
104106 .name = compat_ptr(v32.name),
@@ -137,6 +139,9 @@ static int compat_drm_getunique(struct file *file, unsigned int cmd, · 32 unmodified lines
137139
138140 if (copy_from_user(&uq32, (void __user *)arg, sizeof(uq32)))
139141 return -EFAULT;
142+
143+ memset(&uq, 0, sizeof(uq));
144+
140145 uq = (struct drm_unique){
141146 .unique_len = uq32.unique_len,
142147 .unique = compat_ptr(uq32.unique),
@@ -265,6 +270,8 @@ static int compat_drm_getclient(struct file *file, unsigned int cmd, · 122 unmodified lines
265270 if (copy_from_user(&c32, argp, sizeof(c32)))
266271 return -EFAULT;
267272
273+ memset(&client, 0, sizeof(client));
274+
268275 client.idx = c32.idx;
269276
270277 err = drm_ioctl_kernel(file, drm_getclient, &client, 0);
@@ -852,6 +859,8 @@ static int compat_drm_wait_vblank(struct file *file, unsigned int cmd, · 581 unmodified lines
852859 if (copy_from_user(&req32, argp, sizeof(req32)))
853860 return -EFAULT;
854861
862+ memset(&req, 0, sizeof(req));
863+
855864 req.request.type = req32.request.type;
856865 req.request.sequence = req32.request.sequence;
857866 req.request.signal = req32.request.signal;
@@ -889,6 +898,8 @@ static int compat_drm_mode_addfb2(struct file *file, unsigned int cmd, · 31 unmodified lines
889898 struct drm_mode_fb_cmd2 req64;
890899 int err;
891900
901+ memset(&req64, 0, sizeof(req64));
902+
892903 if (copy_from_user(&req64, argp,
893904 offsetof(drm_mode_fb_cmd232_t, modifier)))
894905 return -EFAULT;
drivers/gpu/drm/i915/gt/intel_engine_cs.c+6−1
@@ -713,9 +713,12 @@ static int engine_setup_common(struct intel_engine_cs *engine) · 712 unmodified lines
713713 goto err_status;
714714 }
715715
716+ err = intel_engine_init_cmd_parser(engine);
717+ if (err)
718+ goto err_cmd_parser;
719+
716720 intel_engine_init_active(engine, ENGINE_PHYSICAL);
717721 intel_engine_init_execlists(engine);
718− intel_engine_init_cmd_parser(engine);
719722 intel_engine_init__pm(engine);
720723 intel_engine_init_retire(engine);
721724
@@ -732,6 +735,8 @@ static int engine_setup_common(struct intel_engine_cs *engine) · 10 unmodified lines
732735
733736 return 0;
734737
738+err_cmd_parser:
739+ intel_breadcrumbs_free(engine->breadcrumbs);
735740 err_status:
736741 cleanup_status_page(engine);
737742 return err;
drivers/gpu/drm/i915/i915_cmd_parser.c+13−6
@@ -940,7 +940,7 @@ static void fini_hash_table(struct intel_engine_cs *engine) · 939 unmodified lines
940940 * struct intel_engine_cs based on whether the platform requires software
941941 * command parsing.
942942 */
943−void intel_engine_init_cmd_parser(struct intel_engine_cs *engine)
943+int intel_engine_init_cmd_parser(struct intel_engine_cs *engine)
944944 {
945945 const struct drm_i915_cmd_table *cmd_tables;
946946 int cmd_table_count;
@@ -948,7 +948,7 @@ void intel_engine_init_cmd_parser(struct intel_engine_cs *engine) · 1 unmodified line
948948
949949 if (!IS_GEN(engine->i915, 7) && !(IS_GEN(engine->i915, 9) &&
950950 engine->class == COPY_ENGINE_CLASS))
951− return;
951+ return 0;
952952
953953 switch (engine->class) {
954954 case RENDER_CLASS:
@@ -1013,19 +1013,19 @@ void intel_engine_init_cmd_parser(struct intel_engine_cs *engine) · 58 unmodified lines
10131013 break;
10141014 default:
10151015 MISSING_CASE(engine->class);
1016− return;
1016+ goto out;
10171017 }
10181018
10191019 if (!validate_cmds_sorted(engine, cmd_tables, cmd_table_count)) {
10201020 drm_err(&engine->i915->drm,
10211021 "%s: command descriptions are not sorted\n",
10221022 engine->name);
1023− return;
1023+ goto out;
10241024 }
10251025 if (!validate_regs_sorted(engine)) {
10261026 drm_err(&engine->i915->drm,
10271027 "%s: registers are not sorted\n", engine->name);
1028− return;
1028+ goto out;
10291029 }
10301030
10311031 ret = init_hash_table(engine, cmd_tables, cmd_table_count);
@@ -1033,10 +1033,17 @@ void intel_engine_init_cmd_parser(struct intel_engine_cs *engine) · 1 unmodified line
10331033 drm_err(&engine->i915->drm,
10341034 "%s: initialised failed!\n", engine->name);
10351035 fini_hash_table(engine);
1036− return;
1036+ goto out;
10371037 }
10381038
10391039 engine->flags |= I915_ENGINE_USING_CMD_PARSER;
1040+
1041+out:
1042+ if (intel_engine_requires_cmd_parser(engine) &&
1043+ !intel_engine_using_cmd_parser(engine))
1044+ return -EINVAL;
1045+
1046+ return 0;
10401047 }
10411048
10421049 /**
drivers/gpu/drm/i915/i915_drv.h+1−1
@@ -1952,7 +1952,7 @@ const char *i915_cache_level_str(struct drm_i915_private *i915, int type); · 1951 unmodified lines
19521952
19531953 /* i915_cmd_parser.c */
19541954 int i915_cmd_parser_get_version(struct drm_i915_private *dev_priv);
1955−void intel_engine_init_cmd_parser(struct intel_engine_cs *engine);
1955+int intel_engine_init_cmd_parser(struct intel_engine_cs *engine);
19561956 void intel_engine_cleanup_cmd_parser(struct intel_engine_cs *engine);
19571957 int intel_engine_cmd_parser(struct intel_engine_cs *engine,
19581958 struct i915_vma *batch,
drivers/gpu/drm/i915/i915_perf.c+5−8
@@ -603,7 +603,6 @@ static int append_oa_sample(struct i915_perf_stream *stream, · 602 unmodified lines
603603 {
604604 int report_size = stream->oa_buffer.format_size;
605605 struct drm_i915_perf_record_header header;
606− u32 sample_flags = stream->sample_flags;
607606
608607 header.type = DRM_I915_PERF_RECORD_SAMPLE;
609608 header.pad = 0;
@@ -617,10 +616,8 @@ static int append_oa_sample(struct i915_perf_stream *stream, · 7 unmodified lines
617616 return -EFAULT;
618617 buf += sizeof(header);
619618
620− if (sample_flags & SAMPLE_OA_REPORT) {
621− if (copy_to_user(buf, report, report_size))
622− return -EFAULT;
623− }
619+ if (copy_to_user(buf, report, report_size))
620+ return -EFAULT;
624621
625622 (*offset) += header.size;
626623
@@ -2682,7 +2679,7 @@ static void i915_oa_stream_enable(struct i915_perf_stream *stream) · 2055 unmodified lines
26822679
26832680 stream->perf->ops.oa_enable(stream);
26842681
2685− if (stream->periodic)
2682+ if (stream->sample_flags & SAMPLE_OA_REPORT)
26862683 hrtimer_start(&stream->poll_check_timer,
26872684 ns_to_ktime(stream->poll_oa_period),
26882685 HRTIMER_MODE_REL_PINNED);
@@ -2745,7 +2742,7 @@ static void i915_oa_stream_disable(struct i915_perf_stream *stream) · 56 unmodified lines
27452742 {
27462743 stream->perf->ops.oa_disable(stream);
27472744
2748− if (stream->periodic)
2745+ if (stream->sample_flags & SAMPLE_OA_REPORT)
27492746 hrtimer_cancel(&stream->poll_check_timer);
27502747 }
27512748
@@ -3028,7 +3025,7 @@ static ssize_t i915_perf_read(struct file *file, · 276 unmodified lines
30283025 * disabled stream as an error. In particular it might otherwise lead
30293026 * to a deadlock for blocking file descriptors...
30303027 */
3031− if (!stream->enabled)
3028+ if (!stream->enabled || !(stream->sample_flags & SAMPLE_OA_REPORT))
30323029 return -EIO;
30333030
30343031 if (!(file->f_flags & O_NONBLOCK)) {
drivers/gpu/drm/i915/i915_reg.h+22−1
@@ -3316,7 +3316,18 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg) · 3315 unmodified lines
33163316
33173317 #define ILK_DISPLAY_CHICKEN1 _MMIO(0x42000)
33183318 #define ILK_FBCQ_DIS (1 << 22)
3319−#define ILK_PABSTRETCH_DIS (1 << 21)
3319+#define ILK_PABSTRETCH_DIS REG_BIT(21)
3320+#define ILK_SABSTRETCH_DIS REG_BIT(20)
3321+#define IVB_PRI_STRETCH_MAX_MASK REG_GENMASK(21, 20)
3322+#define IVB_PRI_STRETCH_MAX_X8 REG_FIELD_PREP(IVB_PRI_STRETCH_MAX_MASK, 0)
3323+#define IVB_PRI_STRETCH_MAX_X4 REG_FIELD_PREP(IVB_PRI_STRETCH_MAX_MASK, 1)
3324+#define IVB_PRI_STRETCH_MAX_X2 REG_FIELD_PREP(IVB_PRI_STRETCH_MAX_MASK, 2)
3325+#define IVB_PRI_STRETCH_MAX_X1 REG_FIELD_PREP(IVB_PRI_STRETCH_MAX_MASK, 3)
3326+#define IVB_SPR_STRETCH_MAX_MASK REG_GENMASK(19, 18)
3327+#define IVB_SPR_STRETCH_MAX_X8 REG_FIELD_PREP(IVB_SPR_STRETCH_MAX_MASK, 0)
3328+#define IVB_SPR_STRETCH_MAX_X4 REG_FIELD_PREP(IVB_SPR_STRETCH_MAX_MASK, 1)
3329+#define IVB_SPR_STRETCH_MAX_X2 REG_FIELD_PREP(IVB_SPR_STRETCH_MAX_MASK, 2)
3330+#define IVB_SPR_STRETCH_MAX_X1 REG_FIELD_PREP(IVB_SPR_STRETCH_MAX_MASK, 3)
33203331
33213332
33223333 /*
@@ -8039,6 +8050,16 @@ enum { · 4716 unmodified lines
80398050
80408051 #define _CHICKEN_PIPESL_1_A 0x420b0
80418052 #define _CHICKEN_PIPESL_1_B 0x420b4
8053+#define HSW_PRI_STRETCH_MAX_MASK REG_GENMASK(28, 27)
8054+#define HSW_PRI_STRETCH_MAX_X8 REG_FIELD_PREP(HSW_PRI_STRETCH_MAX_MASK, 0)
8055+#define HSW_PRI_STRETCH_MAX_X4 REG_FIELD_PREP(HSW_PRI_STRETCH_MAX_MASK, 1)
8056+#define HSW_PRI_STRETCH_MAX_X2 REG_FIELD_PREP(HSW_PRI_STRETCH_MAX_MASK, 2)
8057+#define HSW_PRI_STRETCH_MAX_X1 REG_FIELD_PREP(HSW_PRI_STRETCH_MAX_MASK, 3)
8058+#define HSW_SPR_STRETCH_MAX_MASK REG_GENMASK(26, 25)
8059+#define HSW_SPR_STRETCH_MAX_X8 REG_FIELD_PREP(HSW_SPR_STRETCH_MAX_MASK, 0)
8060+#define HSW_SPR_STRETCH_MAX_X4 REG_FIELD_PREP(HSW_SPR_STRETCH_MAX_MASK, 1)
8061+#define HSW_SPR_STRETCH_MAX_X2 REG_FIELD_PREP(HSW_SPR_STRETCH_MAX_MASK, 2)
8062+#define HSW_SPR_STRETCH_MAX_X1 REG_FIELD_PREP(HSW_SPR_STRETCH_MAX_MASK, 3)
80428063 #define HSW_FBCQ_DIS (1 << 22)
80438064 #define BDW_DPRS_MASK_VBLANK_SRD (1 << 0)
80448065 #define CHICKEN_PIPESL_1(pipe) _MMIO_PIPE(pipe, _CHICKEN_PIPESL_1_A, _CHICKEN_PIPESL_1_B)
drivers/gpu/drm/i915/intel_pm.c+15−1
@@ -7245,11 +7245,16 @@ static void bdw_init_clock_gating(struct drm_i915_private *dev_priv) · 7244 unmodified lines
72457245 intel_uncore_write(&dev_priv->uncore, CHICKEN_PAR1_1,
72467246 intel_uncore_read(&dev_priv->uncore, CHICKEN_PAR1_1) | DPA_MASK_VBLANK_SRD);
72477247
7248− /* WaPsrDPRSUnmaskVBlankInSRD:bdw */
72497248 for_each_pipe(dev_priv, pipe) {
7249+ /* WaPsrDPRSUnmaskVBlankInSRD:bdw */
72507250 intel_uncore_write(&dev_priv->uncore, CHICKEN_PIPESL_1(pipe),
72517251 intel_uncore_read(&dev_priv->uncore, CHICKEN_PIPESL_1(pipe)) |
72527252 BDW_DPRS_MASK_VBLANK_SRD);
7253+
7254+ /* Undocumented but fixes async flip + VT-d corruption */
7255+ if (intel_vtd_active())
7256+ intel_uncore_rmw(&dev_priv->uncore, CHICKEN_PIPESL_1(pipe),
7257+ HSW_PRI_STRETCH_MAX_MASK, HSW_PRI_STRETCH_MAX_X1);
72537258 }
72547259
72557260 /* WaVSRefCountFullforceMissDisable:bdw */
@@ -7285,11 +7290,20 @@ static void bdw_init_clock_gating(struct drm_i915_private *dev_priv) · 29 unmodified lines
72857290
72867291 static void hsw_init_clock_gating(struct drm_i915_private *dev_priv)
72877292 {
7293+ enum pipe pipe;
7294+
72887295 /* WaFbcAsynchFlipDisableFbcQueue:hsw,bdw */
72897296 intel_uncore_write(&dev_priv->uncore, CHICKEN_PIPESL_1(PIPE_A),
72907297 intel_uncore_read(&dev_priv->uncore, CHICKEN_PIPESL_1(PIPE_A)) |
72917298 HSW_FBCQ_DIS);
72927299
7300+ for_each_pipe(dev_priv, pipe) {
7301+ /* Undocumented but fixes async flip + VT-d corruption */
7302+ if (intel_vtd_active())
7303+ intel_uncore_rmw(&dev_priv->uncore, CHICKEN_PIPESL_1(pipe),
7304+ HSW_PRI_STRETCH_MAX_MASK, HSW_PRI_STRETCH_MAX_X1);
7305+ }
7306+
72937307 /* This is required by WaCatErrorRejectionIssue:hsw */
72947308 intel_uncore_write(&dev_priv->uncore, GEN7_SQ_CHICKEN_MBCUNIT_CONFIG,
72957309 intel_uncore_read(&dev_priv->uncore, GEN7_SQ_CHICKEN_MBCUNIT_CONFIG) |
drivers/gpu/drm/meson/meson_drv.c+11−0
@@ -482,6 +482,16 @@ static int meson_probe_remote(struct platform_device *pdev, · 481 unmodified lines
482482 return count;
483483 }
484484
485+static void meson_drv_shutdown(struct platform_device *pdev)
486+{
487+ struct meson_drm *priv = dev_get_drvdata(&pdev->dev);
488+ struct drm_device *drm = priv->drm;
489+
490+ DRM_DEBUG_DRIVER("\n");
491+ drm_kms_helper_poll_fini(drm);
492+ drm_atomic_helper_shutdown(drm);
493+}
494+
485495 static int meson_drv_probe(struct platform_device *pdev)
486496 {
487497 struct component_match *match = NULL;
@@ -553,6 +563,7 @@ static const struct dev_pm_ops meson_drv_pm_ops = { · 65 unmodified lines
553563
554564 static struct platform_driver meson_drm_platform_driver = {
555565 .probe = meson_drv_probe,
566+ .shutdown = meson_drv_shutdown,
556567 .driver = {
557568 .name = "meson-drm",
558569 .of_match_table = dt_match,
drivers/gpu/drm/nouveau/nouveau_bo.c+12−2
@@ -551,12 +551,17 @@ nouveau_bo_sync_for_device(struct nouveau_bo *nvbo) · 550 unmodified lines
551551
552552 if (!ttm_dma)
553553 return;
554+ if (!ttm_dma->pages) {
555+ NV_DEBUG(drm, "ttm_dma 0x%p: pages NULL\n", ttm_dma);
556+ return;
557+ }
554558
555559 /* Don't waste time looping if the object is coherent */
556560 if (nvbo->force_coherent)
557561 return;
558562
559− for (i = 0; i < ttm_dma->num_pages; ++i) {
563+ i = 0;
564+ while (i < ttm_dma->num_pages) {
560565 struct page *p = ttm_dma->pages[i];
561566 size_t num_pages = 1;
562567
@@ -582,12 +587,17 @@ nouveau_bo_sync_for_cpu(struct nouveau_bo *nvbo) · 19 unmodified lines
582587
583588 if (!ttm_dma)
584589 return;
590+ if (!ttm_dma->pages) {
591+ NV_DEBUG(drm, "ttm_dma 0x%p: pages NULL\n", ttm_dma);
592+ return;
593+ }
585594
586595 /* Don't waste time looping if the object is coherent */
587596 if (nvbo->force_coherent)
588597 return;
589598
590− for (i = 0; i < ttm_dma->num_pages; ++i) {
599+ i = 0;
600+ while (i < ttm_dma->num_pages) {
591601 struct page *p = ttm_dma->pages[i];
592602 size_t num_pages = 1;
593603
drivers/gpu/drm/omapdrm/dss/dsi.c+4−3
@@ -2149,11 +2149,12 @@ static int dsi_vc_send_short(struct dsi_data *dsi, int vc, · 2148 unmodified lines
21492149 const struct mipi_dsi_msg *msg)
21502150 {
21512151 struct mipi_dsi_packet pkt;
2152+ int ret;
21522153 u32 r;
21532154
2154− r = mipi_dsi_create_packet(&pkt, msg);
2155− if (r < 0)
2156− return r;
2155+ ret = mipi_dsi_create_packet(&pkt, msg);
2156+ if (ret < 0)
2157+ return ret;
21572158
21582159 WARN_ON(!dsi_bus_is_locked(dsi));
21592160
drivers/gpu/drm/qxl/qxl_display.c+1−0
@@ -328,6 +328,7 @@ static void qxl_crtc_update_monitors_config(struct drm_crtc *crtc, · 327 unmodified lines
328328
329329 head.id = i;
330330 head.flags = 0;
331+ head.surface_id = 0;
331332 oldcount = qdev->monitors_config->count;
332333 if (crtc->state->active) {
333334 struct drm_display_mode *mode = &crtc->mode;
drivers/gpu/drm/qxl/qxl_release.c+10−2
@@ -321,7 +321,7 @@ int qxl_alloc_release_reserved(struct qxl_device *qdev, unsigned long size, · 320 unmodified lines
321321 int type, struct qxl_release **release,
322322 struct qxl_bo **rbo)
323323 {
324− struct qxl_bo *bo;
324+ struct qxl_bo *bo, *free_bo = NULL;
325325 int idr_ret;
326326 int ret = 0;
327327 union qxl_release_info *info;
@@ -347,7 +347,7 @@ int qxl_alloc_release_reserved(struct qxl_device *qdev, unsigned long size, · 19 unmodified lines
347347
348348 mutex_lock(&qdev->release_mutex);
349349 if (qdev->current_release_bo_offset[cur_idx] + 1 >= releases_per_bo[cur_idx]) {
350− qxl_bo_unref(&qdev->current_release_bo[cur_idx]);
350+ free_bo = qdev->current_release_bo[cur_idx];
351351 qdev->current_release_bo_offset[cur_idx] = 0;
352352 qdev->current_release_bo[cur_idx] = NULL;
353353 }
@@ -355,6 +355,10 @@ int qxl_alloc_release_reserved(struct qxl_device *qdev, unsigned long size, · 1 unmodified line
355355 ret = qxl_release_bo_alloc(qdev, &qdev->current_release_bo[cur_idx]);
356356 if (ret) {
357357 mutex_unlock(&qdev->release_mutex);
358+ if (free_bo) {
359+ qxl_bo_unpin(free_bo);
360+ qxl_bo_unref(&free_bo);
361+ }
358362 qxl_release_free(qdev, *release);
359363 return ret;
360364 }
@@ -370,6 +374,10 @@ int qxl_alloc_release_reserved(struct qxl_device *qdev, unsigned long size, · 9 unmodified lines
370374 *rbo = bo;
371375
372376 mutex_unlock(&qdev->release_mutex);
377+ if (free_bo) {
378+ qxl_bo_unpin(free_bo);
379+ qxl_bo_unref(&free_bo);
380+ }
373381
374382 ret = qxl_release_list_add(*release, bo);
375383 qxl_bo_unref(&bo);
drivers/gpu/drm/radeon/radeon.h+2−0
@@ -574,6 +574,8 @@ struct radeon_gem { · 573 unmodified lines
574574 struct list_head objects;
575575 };
576576
577+extern const struct drm_gem_object_funcs radeon_gem_object_funcs;
578+
577579 int radeon_gem_init(struct radeon_device *rdev);
578580 void radeon_gem_fini(struct radeon_device *rdev);
579581 int radeon_gem_object_create(struct radeon_device *rdev, unsigned long size,
drivers/gpu/drm/radeon/radeon_gem.c+2−2
@@ -43,7 +43,7 @@ struct sg_table *radeon_gem_prime_get_sg_table(struct drm_gem_object *obj); · 42 unmodified lines
4343 int radeon_gem_prime_pin(struct drm_gem_object *obj);
4444 void radeon_gem_prime_unpin(struct drm_gem_object *obj);
4545
46−static const struct drm_gem_object_funcs radeon_gem_object_funcs;
46+const struct drm_gem_object_funcs radeon_gem_object_funcs;
4747
4848 static void radeon_gem_object_free(struct drm_gem_object *gobj)
4949 {
@@ -227,7 +227,7 @@ static int radeon_gem_handle_lockup(struct radeon_device *rdev, int r) · 177 unmodified lines
227227 return r;
228228 }
229229
230−static const struct drm_gem_object_funcs radeon_gem_object_funcs = {
230+const struct drm_gem_object_funcs radeon_gem_object_funcs = {
231231 .free = radeon_gem_object_free,
232232 .open = radeon_gem_object_open,
233233 .close = radeon_gem_object_close,
drivers/gpu/drm/radeon/radeon_prime.c+2−0
@@ -56,6 +56,8 @@ struct drm_gem_object *radeon_gem_prime_import_sg_table(struct drm_device *dev, · 55 unmodified lines
5656 if (ret)
5757 return ERR_PTR(ret);
5858
59+ bo->tbo.base.funcs = &radeon_gem_object_funcs;
60+
5961 mutex_lock(&rdev->gem.mutex);
6062 list_add_tail(&bo->list, &rdev->gem.objects);
6163 mutex_unlock(&rdev->gem.mutex);
drivers/gpu/drm/tiny/gm12u320.c+36−8
@@ -83,6 +83,7 @@ MODULE_PARM_DESC(eco_mode, "Turn on Eco mode (less bright, more silent)"); · 82 unmodified lines
8383
8484 struct gm12u320_device {
8585 struct drm_device dev;
86+ struct device *dmadev;
8687 struct drm_simple_display_pipe pipe;
8788 struct drm_connector conn;
8889 unsigned char *cmd_buf;
@@ -601,6 +602,22 @@ static const uint64_t gm12u320_pipe_modifiers[] = { · 512 unmodified lines
601602 DRM_FORMAT_MOD_INVALID
602603 };
603604
605+/*
606+ * FIXME: Dma-buf sharing requires DMA support by the importing device.
607+ * This function is a workaround to make USB devices work as well.
608+ * See todo.rst for how to fix the issue in the dma-buf framework.
609+ */
610+static struct drm_gem_object *gm12u320_gem_prime_import(struct drm_device *dev,
611+ struct dma_buf *dma_buf)
612+{
613+ struct gm12u320_device *gm12u320 = to_gm12u320(dev);
614+
615+ if (!gm12u320->dmadev)
616+ return ERR_PTR(-ENODEV);
617+
618+ return drm_gem_prime_import_dev(dev, dma_buf, gm12u320->dmadev);
619+}
620+
604621 DEFINE_DRM_GEM_FOPS(gm12u320_fops);
605622
606623 static const struct drm_driver gm12u320_drm_driver = {
@@ -614,6 +631,7 @@ static const struct drm_driver gm12u320_drm_driver = { · 7 unmodified lines
614631
615632 .fops = &gm12u320_fops,
616633 DRM_GEM_SHMEM_DRIVER_OPS,
634+ .gem_prime_import = gm12u320_gem_prime_import,
617635 };
618636
619637 static const struct drm_mode_config_funcs gm12u320_mode_config_funcs = {
@@ -640,15 +658,18 @@ static int gm12u320_usb_probe(struct usb_interface *interface, · 20 unmodified lines
640658 struct gm12u320_device, dev);
641659 if (IS_ERR(gm12u320))
642660 return PTR_ERR(gm12u320);
661+ dev = &gm12u320->dev;
662+
663+ gm12u320->dmadev = usb_intf_get_dma_device(to_usb_interface(dev->dev));
664+ if (!gm12u320->dmadev)
665+ drm_warn(dev, "buffer sharing not supported"); /* not an error */
643666
644667 INIT_DELAYED_WORK(&gm12u320->fb_update.work, gm12u320_fb_update_work);
645668 mutex_init(&gm12u320->fb_update.lock);
646669
647− dev = &gm12u320->dev;
648−
649670 ret = drmm_mode_config_init(dev);
650671 if (ret)
651− return ret;
672+ goto err_put_device;
652673
653674 dev->mode_config.min_width = GM12U320_USER_WIDTH;
654675 dev->mode_config.max_width = GM12U320_USER_WIDTH;
@@ -658,15 +679,15 @@ static int gm12u320_usb_probe(struct usb_interface *interface, · 3 unmodified lines
658679
659680 ret = gm12u320_usb_alloc(gm12u320);
660681 if (ret)
661− return ret;
682+ goto err_put_device;
662683
663684 ret = gm12u320_set_ecomode(gm12u320);
664685 if (ret)
665− return ret;
686+ goto err_put_device;
666687
667688 ret = gm12u320_conn_init(gm12u320);
668689 if (ret)
669− return ret;
690+ goto err_put_device;
670691
671692 ret = drm_simple_display_pipe_init(&gm12u320->dev,
672693 &gm12u320->pipe,
@@ -676,24 +697,31 @@ static int gm12u320_usb_probe(struct usb_interface *interface, · 3 unmodified lines
676697 gm12u320_pipe_modifiers,
677698 &gm12u320->conn);
678699 if (ret)
679− return ret;
700+ goto err_put_device;
680701
681702 drm_mode_config_reset(dev);
682703
683704 usb_set_intfdata(interface, dev);
684705 ret = drm_dev_register(dev, 0);
685706 if (ret)
686− return ret;
707+ goto err_put_device;
687708
688709 drm_fbdev_generic_setup(dev, 0);
689710
690711 return 0;
712+
713+err_put_device:
714+ put_device(gm12u320->dmadev);
715+ return ret;
691716 }
692717
693718 static void gm12u320_usb_disconnect(struct usb_interface *interface)
694719 {
695720 struct drm_device *dev = usb_get_intfdata(interface);
721+ struct gm12u320_device *gm12u320 = to_gm12u320(dev);
696722
723+ put_device(gm12u320->dmadev);
724+ gm12u320->dmadev = NULL;
697725 drm_dev_unplug(dev);
698726 drm_atomic_helper_shutdown(dev);
699727 }
drivers/gpu/drm/ttm/ttm_bo.c+6−2
@@ -136,7 +136,8 @@ void ttm_bo_move_to_lru_tail(struct ttm_buffer_object *bo, · 135 unmodified lines
136136 struct ttm_bo_device *bdev = bo->bdev;
137137 struct ttm_resource_manager *man;
138138
139− dma_resv_assert_held(bo->base.resv);
139+ if (!bo->deleted)
140+ dma_resv_assert_held(bo->base.resv);
140141
141142 if (bo->pin_count) {
142143 ttm_bo_del_from_lru(bo);
@@ -508,8 +509,11 @@ static void ttm_bo_release(struct kref *kref) · 365 unmodified lines
508509 * Make pinned bos immediately available to
509510 * shrinkers, now that they are queued for
510511 * destruction.
512+ *
513+ * FIXME: QXL is triggering this. Can be removed when the
514+ * driver is fixed.
511515 */
512− if (WARN_ON(bo->pin_count)) {
516+ if (WARN_ON_ONCE(bo->pin_count)) {
513517 bo->pin_count = 0;
514518 ttm_bo_move_to_lru_tail(bo, &bo->mem, NULL);
515519 }
drivers/gpu/drm/ttm/ttm_pool.c+2−2
@@ -268,13 +268,13 @@ static void ttm_pool_type_init(struct ttm_pool_type *pt, struct ttm_pool *pool, · 267 unmodified lines
268268 /* Remove a pool_type from the global shrinker list and free all pages */
269269 static void ttm_pool_type_fini(struct ttm_pool_type *pt)
270270 {
271− struct page *p, *tmp;
271+ struct page *p;
272272
273273 mutex_lock(&shrinker_lock);
274274 list_del(&pt->shrinker_list);
275275 mutex_unlock(&shrinker_lock);
276276
277− list_for_each_entry_safe(p, tmp, &pt->pages, lru)
277+ while ((p = ttm_pool_type_take(pt)))
278278 ttm_pool_free_page(pt->pool, pt->caching, pt->order, p);
279279 }
280280
drivers/gpu/drm/udl/udl_drv.c+17−0
@@ -32,6 +32,22 @@ static int udl_usb_resume(struct usb_interface *interface) · 31 unmodified lines
3232 return drm_mode_config_helper_resume(dev);
3333 }
3434
35+/*
36+ * FIXME: Dma-buf sharing requires DMA support by the importing device.
37+ * This function is a workaround to make USB devices work as well.
38+ * See todo.rst for how to fix the issue in the dma-buf framework.
39+ */
40+static struct drm_gem_object *udl_driver_gem_prime_import(struct drm_device *dev,
41+ struct dma_buf *dma_buf)
42+{
43+ struct udl_device *udl = to_udl(dev);
44+
45+ if (!udl->dmadev)
46+ return ERR_PTR(-ENODEV);
47+
48+ return drm_gem_prime_import_dev(dev, dma_buf, udl->dmadev);
49+}
50+
3551 DEFINE_DRM_GEM_FOPS(udl_driver_fops);
3652
3753 static const struct drm_driver driver = {
@@ -40,6 +56,7 @@ static const struct drm_driver driver = { · 2 unmodified lines
4056 /* GEM hooks */
4157 .fops = &udl_driver_fops,
4258 DRM_GEM_SHMEM_DRIVER_OPS,
59+ .gem_prime_import = udl_driver_gem_prime_import,
4360
4461 .name = DRIVER_NAME,
4562 .desc = DRIVER_DESC,
drivers/gpu/drm/udl/udl_drv.h+1−0
@@ -50,6 +50,7 @@ struct urb_list { · 49 unmodified lines
5050 struct udl_device {
5151 struct drm_device drm;
5252 struct device *dev;
53+ struct device *dmadev;
5354
5455 struct drm_simple_display_pipe display_pipe;
5556
drivers/gpu/drm/udl/udl_main.c+10−0
@@ -315,6 +315,10 @@ int udl_init(struct udl_device *udl) · 314 unmodified lines
315315
316316 DRM_DEBUG("\n");
317317
318+ udl->dmadev = usb_intf_get_dma_device(to_usb_interface(dev->dev));
319+ if (!udl->dmadev)
320+ drm_warn(dev, "buffer sharing not supported"); /* not an error */
321+
318322 mutex_init(&udl->gem_lock);
319323
320324 if (!udl_parse_vendor_descriptor(udl)) {
@@ -343,12 +347,18 @@ int udl_init(struct udl_device *udl) · 22 unmodified lines
343347 err:
344348 if (udl->urbs.count)
345349 udl_free_urb_list(dev);
350+ put_device(udl->dmadev);
346351 DRM_ERROR("%d\n", ret);
347352 return ret;
348353 }
349354
350355 int udl_drop_usb(struct drm_device *dev)
351356 {
357+ struct udl_device *udl = to_udl(dev);
358+
352359 udl_free_urb_list(dev);
360+ put_device(udl->dmadev);
361+ udl->dmadev = NULL;
362+
353363 return 0;
354364 }
drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c+1−3
@@ -500,8 +500,6 @@ vm_fault_t vmw_bo_vm_huge_fault(struct vm_fault *vmf, · 499 unmodified lines
500500 vm_fault_t ret;
501501 pgoff_t fault_page_size;
502502 bool write = vmf->flags & FAULT_FLAG_WRITE;
503− bool is_cow_mapping =
504− (vma->vm_flags & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE;
505503
506504 switch (pe_size) {
507505 case PE_SIZE_PMD:
@@ -518,7 +516,7 @@ vm_fault_t vmw_bo_vm_huge_fault(struct vm_fault *vmf, · 10 unmodified lines
518516 }
519517
520518 /* Always do write dirty-tracking and COW on PTE level. */
521− if (write && (READ_ONCE(vbo->dirty) || is_cow_mapping))
519+ if (write && (READ_ONCE(vbo->dirty) || is_cow_mapping(vma->vm_flags)))
522520 return VM_FAULT_FALLBACK;
523521
524522 ret = ttm_bo_vm_reserve(bo, vmf);
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c+1−1
@@ -49,7 +49,7 @@ int vmw_mmap(struct file *filp, struct vm_area_struct *vma) · 48 unmodified lines
4949 vma->vm_ops = &vmw_vm_ops;
5050
5151 /* Use VM_PFNMAP rather than VM_MIXEDMAP if not a COW mapping */
52− if ((vma->vm_flags & (VM_SHARED | VM_MAYWRITE)) != VM_MAYWRITE)
52+ if (!is_cow_mapping(vma->vm_flags))
5353 vma->vm_flags = (vma->vm_flags & ~VM_MIXEDMAP) | VM_PFNMAP;
5454
5555 return 0;
drivers/iio/adc/Kconfig+3−0
@@ -266,6 +266,8 @@ config ADI_AXI_ADC · 265 unmodified lines
266266 select IIO_BUFFER
267267 select IIO_BUFFER_HW_CONSUMER
268268 select IIO_BUFFER_DMAENGINE
269+ depends on HAS_IOMEM
270+ depends on OF
269271 help
270272 Say yes here to build support for Analog Devices Generic
271273 AXI ADC IP core. The IP core is used for interfacing with
@@ -923,6 +925,7 @@ config STM32_ADC_CORE · 651 unmodified lines
923925 depends on ARCH_STM32 || COMPILE_TEST
924926 depends on OF
925927 depends on REGULATOR
928+ depends on HAS_IOMEM
926929 select IIO_BUFFER
927930 select MFD_STM32_TIMERS
928931 select IIO_STM32_TIMER_TRIGGER
drivers/iio/adc/ab8500-gpadc.c+1−1
@@ -918,7 +918,7 @@ static int ab8500_gpadc_read_raw(struct iio_dev *indio_dev, · 917 unmodified lines
918918 return processed;
919919
920920 /* Return millivolt or milliamps or millicentigrades */
921− *val = processed * 1000;
921+ *val = processed;
922922 return IIO_VAL_INT;
923923 }
924924
drivers/iio/adc/ad7949.c+1−1
@@ -91,7 +91,7 @@ static int ad7949_spi_read_channel(struct ad7949_adc_chip *ad7949_adc, int *val, · 90 unmodified lines
9191 int ret;
9292 int i;
9393 int bits_per_word = ad7949_adc->resolution;
94− int mask = GENMASK(ad7949_adc->resolution, 0);
94+ int mask = GENMASK(ad7949_adc->resolution - 1, 0);
9595 struct spi_message msg;
9696 struct spi_transfer tx[] = {
9797 {
drivers/iio/adc/qcom-spmi-vadc.c+1−1
@@ -597,7 +597,7 @@ static const struct vadc_channels vadc_chans[] = { · 596 unmodified lines
597597 VADC_CHAN_NO_SCALE(P_MUX16_1_3, 1)
598598
599599 VADC_CHAN_NO_SCALE(LR_MUX1_BAT_THERM, 0)
600− VADC_CHAN_NO_SCALE(LR_MUX2_BAT_ID, 0)
600+ VADC_CHAN_VOLT(LR_MUX2_BAT_ID, 0, SCALE_DEFAULT)
601601 VADC_CHAN_NO_SCALE(LR_MUX3_XO_THERM, 0)
602602 VADC_CHAN_NO_SCALE(LR_MUX4_AMUX_THM1, 0)
603603 VADC_CHAN_NO_SCALE(LR_MUX5_AMUX_THM2, 0)
drivers/iio/gyro/mpu3050-core.c+2−0
@@ -551,6 +551,8 @@ static irqreturn_t mpu3050_trigger_handler(int irq, void *p) · 550 unmodified lines
551551 MPU3050_FIFO_R,
552552 &fifo_values[offset],
553553 toread);
554+ if (ret)
555+ goto out_trigger_unlock;
554556
555557 dev_dbg(mpu3050->dev,
556558 "%04x %04x %04x %04x %04x\n",
drivers/iio/humidity/hid-sensor-humidity.c+7−5
@@ -15,7 +15,10 @@ · 14 unmodified lines
1515 struct hid_humidity_state {
1616 struct hid_sensor_common common_attributes;
1717 struct hid_sensor_hub_attribute_info humidity_attr;
18− s32 humidity_data;
18+ struct {
19+ s32 humidity_data;
20+ u64 timestamp __aligned(8);
21+ } scan;
1922 int scale_pre_decml;
2023 int scale_post_decml;
2124 int scale_precision;
@@ -125,9 +128,8 @@ static int humidity_proc_event(struct hid_sensor_hub_device *hsdev, · 103 unmodified lines
125128 struct hid_humidity_state *humid_st = iio_priv(indio_dev);
126129
127130 if (atomic_read(&humid_st->common_attributes.data_ready))
128− iio_push_to_buffers_with_timestamp(indio_dev,
129− &humid_st->humidity_data,
130− iio_get_time_ns(indio_dev));
131+ iio_push_to_buffers_with_timestamp(indio_dev, &humid_st->scan,
132+ iio_get_time_ns(indio_dev));
131133
132134 return 0;
133135 }
@@ -142,7 +144,7 @@ static int humidity_capture_sample(struct hid_sensor_hub_device *hsdev, · 8 unmodified lines
142144
143145 switch (usage_id) {
144146 case HID_USAGE_SENSOR_ATMOSPHERIC_HUMIDITY:
145− humid_st->humidity_data = *(s32 *)raw_data;
147+ humid_st->scan.humidity_data = *(s32 *)raw_data;
146148
147149 return 0;
148150 default:
drivers/iio/imu/adis16400.c+1−2
@@ -462,8 +462,7 @@ static int adis16400_initial_setup(struct iio_dev *indio_dev) · 461 unmodified lines
462462 if (ret)
463463 goto err_ret;
464464
465− ret = sscanf(indio_dev->name, "adis%u\n", &device_id);
466− if (ret != 1) {
465+ if (sscanf(indio_dev->name, "adis%u\n", &device_id) != 1) {
467466 ret = -EINVAL;
468467 goto err_ret;
469468 }
drivers/iio/light/hid-sensor-prox.c+11−2
@@ -23,6 +23,9 @@ struct prox_state { · 22 unmodified lines
2323 struct hid_sensor_common common_attributes;
2424 struct hid_sensor_hub_attribute_info prox_attr;
2525 u32 human_presence;
26+ int scale_pre_decml;
27+ int scale_post_decml;
28+ int scale_precision;
2629 };
2730
2831 /* Channel definitions */
@@ -93,8 +96,9 @@ static int prox_read_raw(struct iio_dev *indio_dev, · 64 unmodified lines
9396 ret_type = IIO_VAL_INT;
9497 break;
9598 case IIO_CHAN_INFO_SCALE:
96− *val = prox_state->prox_attr.units;
97− ret_type = IIO_VAL_INT;
99+ *val = prox_state->scale_pre_decml;
100+ *val2 = prox_state->scale_post_decml;
101+ ret_type = prox_state->scale_precision;
98102 break;
99103 case IIO_CHAN_INFO_OFFSET:
100104 *val = hid_sensor_convert_exponent(
@@ -234,6 +238,11 @@ static int prox_parse_report(struct platform_device *pdev, · 133 unmodified lines
234238 HID_USAGE_SENSOR_HUMAN_PRESENCE,
235239 &st->common_attributes.sensitivity);
236240
241+ st->scale_precision = hid_sensor_format_scale(
242+ hsdev->usage,
243+ &st->prox_attr,
244+ &st->scale_pre_decml, &st->scale_post_decml);
245+
237246 return ret;
238247 }
239248
drivers/iio/temperature/hid-sensor-temperature.c+8−6
@@ -15,7 +15,10 @@ · 14 unmodified lines
1515 struct temperature_state {
1616 struct hid_sensor_common common_attributes;
1717 struct hid_sensor_hub_attribute_info temperature_attr;
18− s32 temperature_data;
18+ struct {
19+ s32 temperature_data;
20+ u64 timestamp __aligned(8);
21+ } scan;
1922 int scale_pre_decml;
2023 int scale_post_decml;
2124 int scale_precision;
@@ -32,7 +35,7 @@ static const struct iio_chan_spec temperature_channels[] = { · 10 unmodified lines
3235 BIT(IIO_CHAN_INFO_SAMP_FREQ) |
3336 BIT(IIO_CHAN_INFO_HYSTERESIS),
3437 },
35− IIO_CHAN_SOFT_TIMESTAMP(3),
38+ IIO_CHAN_SOFT_TIMESTAMP(1),
3639 };
3740
3841 /* Adjust channel real bits based on report descriptor */
@@ -123,9 +126,8 @@ static int temperature_proc_event(struct hid_sensor_hub_device *hsdev, · 84 unmodified lines
123126 struct temperature_state *temp_st = iio_priv(indio_dev);
124127
125128 if (atomic_read(&temp_st->common_attributes.data_ready))
126− iio_push_to_buffers_with_timestamp(indio_dev,
127− &temp_st->temperature_data,
128− iio_get_time_ns(indio_dev));
129+ iio_push_to_buffers_with_timestamp(indio_dev, &temp_st->scan,
130+ iio_get_time_ns(indio_dev));
129131
130132 return 0;
131133 }
@@ -140,7 +142,7 @@ static int temperature_capture_sample(struct hid_sensor_hub_device *hsdev, · 8 unmodified lines
140142
141143 switch (usage_id) {
142144 case HID_USAGE_SENSOR_DATA_ENVIRONMENTAL_TEMPERATURE:
143− temp_st->temperature_data = *(s32 *)raw_data;
145+ temp_st->scan.temperature_data = *(s32 *)raw_data;
144146 return 0;
145147 default:
146148 return -EINVAL;
drivers/infiniband/hw/cxgb4/cm.c+2−2
@@ -3610,13 +3610,13 @@ int c4iw_destroy_listen(struct iw_cm_id *cm_id) · 3609 unmodified lines
36103610 ep->com.local_addr.ss_family == AF_INET) {
36113611 err = cxgb4_remove_server_filter(
36123612 ep->com.dev->rdev.lldi.ports[0], ep->stid,
3613− ep->com.dev->rdev.lldi.rxq_ids[0], 0);
3613+ ep->com.dev->rdev.lldi.rxq_ids[0], false);
36143614 } else {
36153615 struct sockaddr_in6 *sin6;
36163616 c4iw_init_wr_wait(ep->com.wr_waitp);
36173617 err = cxgb4_remove_server(
36183618 ep->com.dev->rdev.lldi.ports[0], ep->stid,
3619− ep->com.dev->rdev.lldi.rxq_ids[0], 0);
3619+ ep->com.dev->rdev.lldi.rxq_ids[0], true);
36203620 if (err)
36213621 goto done;
36223622 err = c4iw_wait_for_reply(&ep->com.dev->rdev, ep->com.wr_waitp,
drivers/infiniband/hw/hns/hns_roce_hw_v2.c+3−1
@@ -1194,8 +1194,10 @@ static void hns_roce_cmq_init_regs(struct hns_roce_dev *hr_dev, bool ring_type) · 1193 unmodified lines
11941194 upper_32_bits(dma));
11951195 roce_write(hr_dev, ROCEE_TX_CMQ_DEPTH_REG,
11961196 (u32)ring->desc_num >> HNS_ROCE_CMQ_DESC_NUM_S);
1197− roce_write(hr_dev, ROCEE_TX_CMQ_HEAD_REG, 0);
1197+
1198+ /* Make sure to write tail first and then head */
11981199 roce_write(hr_dev, ROCEE_TX_CMQ_TAIL_REG, 0);
1200+ roce_write(hr_dev, ROCEE_TX_CMQ_HEAD_REG, 0);
11991201 } else {
12001202 roce_write(hr_dev, ROCEE_RX_CMQ_BASEADDR_L_REG, (u32)dma);
12011203 roce_write(hr_dev, ROCEE_RX_CMQ_BASEADDR_H_REG,
drivers/infiniband/hw/mlx5/devx.c+1−1
@@ -1116,7 +1116,7 @@ static void devx_obj_build_destroy_cmd(void *in, void *out, void *din, · 1115 unmodified lines
11161116 case MLX5_CMD_OP_CREATE_MKEY:
11171117 MLX5_SET(destroy_mkey_in, din, opcode,
11181118 MLX5_CMD_OP_DESTROY_MKEY);
1119− MLX5_SET(destroy_mkey_in, in, mkey_index, *obj_id);
1119+ MLX5_SET(destroy_mkey_in, din, mkey_index, *obj_id);
11201120 break;
11211121 case MLX5_CMD_OP_CREATE_CQ:
11221122 MLX5_SET(destroy_cq_in, din, opcode, MLX5_CMD_OP_DESTROY_CQ);
drivers/infiniband/hw/mlx5/qp.c+14−4
@@ -1078,7 +1078,7 @@ static int _create_kernel_qp(struct mlx5_ib_dev *dev, · 1077 unmodified lines
10781078
10791079 qpc = MLX5_ADDR_OF(create_qp_in, *in, qpc);
10801080 MLX5_SET(qpc, qpc, uar_page, uar_index);
1081− MLX5_SET(qpc, qpc, ts_format, MLX5_QPC_TIMESTAMP_FORMAT_DEFAULT);
1081+ MLX5_SET(qpc, qpc, ts_format, mlx5_get_qp_default_ts(dev->mdev));
10821082 MLX5_SET(qpc, qpc, log_page_size, qp->buf.page_shift - MLX5_ADAPTER_PAGE_SHIFT);
10831083
10841084 /* Set "fast registration enabled" for all kernel QPs */
@@ -1188,7 +1188,8 @@ static int get_rq_ts_format(struct mlx5_ib_dev *dev, struct mlx5_ib_cq *send_cq) · 103 unmodified lines
11881188 }
11891189 return MLX5_RQC_TIMESTAMP_FORMAT_FREE_RUNNING;
11901190 }
1191− return MLX5_RQC_TIMESTAMP_FORMAT_DEFAULT;
1191+ return fr_supported ? MLX5_RQC_TIMESTAMP_FORMAT_FREE_RUNNING :
1192+ MLX5_RQC_TIMESTAMP_FORMAT_DEFAULT;
11921193 }
11931194
11941195 static int get_sq_ts_format(struct mlx5_ib_dev *dev, struct mlx5_ib_cq *send_cq)
@@ -1206,7 +1207,8 @@ static int get_sq_ts_format(struct mlx5_ib_dev *dev, struct mlx5_ib_cq *send_cq) · 11 unmodified lines
12061207 }
12071208 return MLX5_SQC_TIMESTAMP_FORMAT_FREE_RUNNING;
12081209 }
1209− return MLX5_SQC_TIMESTAMP_FORMAT_DEFAULT;
1210+ return fr_supported ? MLX5_SQC_TIMESTAMP_FORMAT_FREE_RUNNING :
1211+ MLX5_SQC_TIMESTAMP_FORMAT_DEFAULT;
12101212 }
12111213
12121214 static int get_qp_ts_format(struct mlx5_ib_dev *dev, struct mlx5_ib_cq *send_cq,
@@ -1217,7 +1219,8 @@ static int get_qp_ts_format(struct mlx5_ib_dev *dev, struct mlx5_ib_cq *send_cq, · 4 unmodified lines
12171219 MLX5_QP_TIMESTAMP_FORMAT_CAP_FREE_RUNNING ||
12181220 MLX5_CAP_ROCE(dev->mdev, qp_ts_format) ==
12191221 MLX5_QP_TIMESTAMP_FORMAT_CAP_FREE_RUNNING_AND_REAL_TIME;
1220− int ts_format = MLX5_QPC_TIMESTAMP_FORMAT_DEFAULT;
1222+ int ts_format = fr_supported ? MLX5_QPC_TIMESTAMP_FORMAT_FREE_RUNNING :
1223+ MLX5_QPC_TIMESTAMP_FORMAT_DEFAULT;
12211224
12221225 if (recv_cq &&
12231226 recv_cq->create_flags & IB_UVERBS_CQ_FLAGS_TIMESTAMP_COMPLETION)
@@ -1930,6 +1933,7 @@ static int create_xrc_tgt_qp(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp, · 706 unmodified lines
19301933 if (qp->flags & IB_QP_CREATE_MANAGED_RECV)
19311934 MLX5_SET(qpc, qpc, cd_slave_receive, 1);
19321935
1936+ MLX5_SET(qpc, qpc, ts_format, mlx5_get_qp_default_ts(dev->mdev));
19331937 MLX5_SET(qpc, qpc, rq_type, MLX5_SRQ_RQ);
19341938 MLX5_SET(qpc, qpc, no_sq, 1);
19351939 MLX5_SET(qpc, qpc, cqn_rcv, to_mcq(devr->c0)->mcq.cqn);
@@ -4873,6 +4877,7 @@ static int create_rq(struct mlx5_ib_rwq *rwq, struct ib_pd *pd, · 2937 unmodified lines
48734877 struct mlx5_ib_dev *dev;
48744878 int has_net_offloads;
48754879 __be64 *rq_pas0;
4880+ int ts_format;
48764881 void *in;
48774882 void *rqc;
48784883 void *wq;
@@ -4881,6 +4886,10 @@ static int create_rq(struct mlx5_ib_rwq *rwq, struct ib_pd *pd, · 2 unmodified lines
48814886
48824887 dev = to_mdev(pd->device);
48834888
4889+ ts_format = get_rq_ts_format(dev, to_mcq(init_attr->cq));
4890+ if (ts_format < 0)
4891+ return ts_format;
4892+
48844893 inlen = MLX5_ST_SZ_BYTES(create_rq_in) + sizeof(u64) * rwq->rq_num_pas;
48854894 in = kvzalloc(inlen, GFP_KERNEL);
48864895 if (!in)
@@ -4890,6 +4899,7 @@ static int create_rq(struct mlx5_ib_rwq *rwq, struct ib_pd *pd, · 3 unmodified lines
48904899 rqc = MLX5_ADDR_OF(create_rq_in, in, ctx);
48914900 MLX5_SET(rqc, rqc, mem_rq_type,
48924901 MLX5_RQC_MEM_RQ_TYPE_MEMORY_RQ_INLINE);
4902+ MLX5_SET(rqc, rqc, ts_format, ts_format);
48934903 MLX5_SET(rqc, rqc, user_index, rwq->user_index);
48944904 MLX5_SET(rqc, rqc, cqn, to_mcq(init_attr->cq)->mcq.cqn);
48954905 MLX5_SET(rqc, rqc, state, MLX5_RQC_STATE_RST);
drivers/input/joydev.c+0−1
@@ -26,7 +26,6 @@ · 25 unmodified lines
2626
2727 MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
2828 MODULE_DESCRIPTION("Joystick device interfaces");
29−MODULE_SUPPORTED_DEVICE("input/js");
3029 MODULE_LICENSE("GPL");
3130
3231 #define JOYDEV_MINOR_BASE 0
drivers/iommu/amd/init.c+20−16
@@ -2714,7 +2714,6 @@ static int __init early_amd_iommu_init(void) · 2713 unmodified lines
27142714 struct acpi_table_header *ivrs_base;
27152715 int i, remap_cache_sz, ret;
27162716 acpi_status status;
2717− u32 pci_id;
27182717
27192718 if (!amd_iommu_detected)
27202719 return -ENODEV;
@@ -2804,16 +2803,6 @@ static int __init early_amd_iommu_init(void) · 83 unmodified lines
28042803 if (ret)
28052804 goto out;
28062805
2807− /* Disable IOMMU if there's Stoney Ridge graphics */
2808− for (i = 0; i < 32; i++) {
2809− pci_id = read_pci_config(0, i, 0, 0);
2810− if ((pci_id & 0xffff) == 0x1002 && (pci_id >> 16) == 0x98e4) {
2811− pr_info("Disable IOMMU on Stoney Ridge\n");
2812− amd_iommu_disabled = true;
2813− break;
2814− }
2815− }
2816−
28172806 /* Disable any previously enabled IOMMUs */
28182807 if (!is_kdump_kernel() || amd_iommu_disabled)
28192808 disable_iommus();
@@ -2880,6 +2869,7 @@ static bool detect_ivrs(void) · 60 unmodified lines
28802869 {
28812870 struct acpi_table_header *ivrs_base;
28822871 acpi_status status;
2872+ int i;
28832873
28842874 status = acpi_get_table("IVRS", 0, &ivrs_base);
28852875 if (status == AE_NOT_FOUND)
@@ -2892,6 +2882,17 @@ static bool detect_ivrs(void) · 6 unmodified lines
28922882
28932883 acpi_put_table(ivrs_base);
28942884
2885+ /* Don't use IOMMU if there is Stoney Ridge graphics */
2886+ for (i = 0; i < 32; i++) {
2887+ u32 pci_id;
2888+
2889+ pci_id = read_pci_config(0, i, 0, 0);
2890+ if ((pci_id & 0xffff) == 0x1002 && (pci_id >> 16) == 0x98e4) {
2891+ pr_info("Disable IOMMU on Stoney Ridge\n");
2892+ return false;
2893+ }
2894+ }
2895+
28952896 /* Make sure ACS will be enabled during PCI probe */
28962897 pci_request_acs();
28972898
@@ -2918,12 +2919,12 @@ static int __init state_next(void) · 20 unmodified lines
29182919 }
29192920 break;
29202921 case IOMMU_IVRS_DETECTED:
2921− ret = early_amd_iommu_init();
2922− init_state = ret ? IOMMU_INIT_ERROR : IOMMU_ACPI_FINISHED;
2923− if (init_state == IOMMU_ACPI_FINISHED && amd_iommu_disabled) {
2924− pr_info("AMD IOMMU disabled\n");
2922+ if (amd_iommu_disabled) {
29252923 init_state = IOMMU_CMDLINE_DISABLED;
29262924 ret = -EINVAL;
2925+ } else {
2926+ ret = early_amd_iommu_init();
2927+ init_state = ret ? IOMMU_INIT_ERROR : IOMMU_ACPI_FINISHED;
29272928 }
29282929 break;
29292930 case IOMMU_ACPI_FINISHED:
@@ -3001,8 +3002,11 @@ int __init amd_iommu_prepare(void) · 71 unmodified lines
30013002 amd_iommu_irq_remap = true;
30023003
30033004 ret = iommu_go_to_state(IOMMU_ACPI_FINISHED);
3004− if (ret)
3005+ if (ret) {
3006+ amd_iommu_irq_remap = false;
30053007 return ret;
3008+ }
3009+
30063010 return amd_iommu_irq_remap ? 0 : -ENODEV;
30073011 }
30083012
drivers/iommu/tegra-smmu.c+3−4
@@ -849,12 +849,11 @@ static struct iommu_device *tegra_smmu_probe_device(struct device *dev) · 848 unmodified lines
849849 smmu = tegra_smmu_find(args.np);
850850 if (smmu) {
851851 err = tegra_smmu_configure(smmu, dev, &args);
852− of_node_put(args.np);
853852
854− if (err < 0)
853+ if (err < 0) {
854+ of_node_put(args.np);
855855 return ERR_PTR(err);
856−
857− break;
856+ }
858857 }
859858
860859 of_node_put(args.np);
drivers/irqchip/Kconfig+0−9
@@ -8,7 +8,6 @@ config IRQCHIP · 7 unmodified lines
88 config ARM_GIC
99 bool
1010 select IRQ_DOMAIN_HIERARCHY
11− select GENERIC_IRQ_MULTI_HANDLER
1211 select GENERIC_IRQ_EFFECTIVE_AFF_MASK
1312
1413 config ARM_GIC_PM
@@ -33,7 +32,6 @@ config GIC_NON_BANKED · 18 unmodified lines
3332
3433 config ARM_GIC_V3
3534 bool
36− select GENERIC_IRQ_MULTI_HANDLER
3735 select IRQ_DOMAIN_HIERARCHY
3836 select PARTITION_PERCPU
3937 select GENERIC_IRQ_EFFECTIVE_AFF_MASK
@@ -64,7 +62,6 @@ config ARM_NVIC · 24 unmodified lines
6462 config ARM_VIC
6563 bool
6664 select IRQ_DOMAIN
67− select GENERIC_IRQ_MULTI_HANDLER
6865
6966 config ARM_VIC_NR
7067 int
@@ -99,14 +96,12 @@ config ATMEL_AIC_IRQ · 28 unmodified lines
9996 bool
10097 select GENERIC_IRQ_CHIP
10198 select IRQ_DOMAIN
102− select GENERIC_IRQ_MULTI_HANDLER
10399 select SPARSE_IRQ
104100
105101 config ATMEL_AIC5_IRQ
106102 bool
107103 select GENERIC_IRQ_CHIP
108104 select IRQ_DOMAIN
109− select GENERIC_IRQ_MULTI_HANDLER
110105 select SPARSE_IRQ
111106
112107 config I8259
@@ -153,7 +148,6 @@ config DW_APB_ICTL · 40 unmodified lines
153148 config FARADAY_FTINTC010
154149 bool
155150 select IRQ_DOMAIN
156− select GENERIC_IRQ_MULTI_HANDLER
157151 select SPARSE_IRQ
158152
159153 config HISILICON_IRQ_MBIGEN
@@ -169,7 +163,6 @@ config IMGPDC_IRQ · 9 unmodified lines
169163 config IXP4XX_IRQ
170164 bool
171165 select IRQ_DOMAIN
172− select GENERIC_IRQ_MULTI_HANDLER
173166 select SPARSE_IRQ
174167
175168 config MADERA_IRQ
@@ -186,7 +179,6 @@ config CLPS711X_IRQCHIP · 10 unmodified lines
186179 bool
187180 depends on ARCH_CLPS711X
188181 select IRQ_DOMAIN
189− select GENERIC_IRQ_MULTI_HANDLER
190182 select SPARSE_IRQ
191183 default y
192184
@@ -205,7 +197,6 @@ config OMAP_IRQCHIP · 12 unmodified lines
205197 config ORION_IRQCHIP
206198 bool
207199 select IRQ_DOMAIN
208− select GENERIC_IRQ_MULTI_HANDLER
209200
210201 config PIC32_EVIC
211202 bool
drivers/irqchip/irq-ingenic-tcu.c+1−0
@@ -179,5 +179,6 @@ err_free_tcu: · 178 unmodified lines
179179 }
180180 IRQCHIP_DECLARE(jz4740_tcu_irq, "ingenic,jz4740-tcu", ingenic_tcu_irq_init);
181181 IRQCHIP_DECLARE(jz4725b_tcu_irq, "ingenic,jz4725b-tcu", ingenic_tcu_irq_init);
182+IRQCHIP_DECLARE(jz4760_tcu_irq, "ingenic,jz4760-tcu", ingenic_tcu_irq_init);
182183 IRQCHIP_DECLARE(jz4770_tcu_irq, "ingenic,jz4770-tcu", ingenic_tcu_irq_init);
183184 IRQCHIP_DECLARE(x1000_tcu_irq, "ingenic,x1000-tcu", ingenic_tcu_irq_init);
drivers/irqchip/irq-ingenic.c+1−0
@@ -155,6 +155,7 @@ static int __init intc_2chip_of_init(struct device_node *node, · 154 unmodified lines
155155 {
156156 return ingenic_intc_of_init(node, 2);
157157 }
158+IRQCHIP_DECLARE(jz4760_intc, "ingenic,jz4760-intc", intc_2chip_of_init);
158159 IRQCHIP_DECLARE(jz4770_intc, "ingenic,jz4770-intc", intc_2chip_of_init);
159160 IRQCHIP_DECLARE(jz4775_intc, "ingenic,jz4775-intc", intc_2chip_of_init);
160161 IRQCHIP_DECLARE(jz4780_intc, "ingenic,jz4780-intc", intc_2chip_of_init);
drivers/isdn/capi/kcapi.c+2−2
@@ -721,7 +721,7 @@ u16 capi20_put_message(struct capi20_appl *ap, struct sk_buff *skb) · 720 unmodified lines
721721 * Return value: CAPI result code
722722 */
723723
724−u16 capi20_get_manufacturer(u32 contr, u8 *buf)
724+u16 capi20_get_manufacturer(u32 contr, u8 buf[CAPI_MANUFACTURER_LEN])
725725 {
726726 struct capi_ctr *ctr;
727727 u16 ret;
@@ -787,7 +787,7 @@ u16 capi20_get_version(u32 contr, struct capi_version *verp) · 59 unmodified lines
787787 * Return value: CAPI result code
788788 */
789789
790−u16 capi20_get_serial(u32 contr, u8 *serial)
790+u16 capi20_get_serial(u32 contr, u8 serial[CAPI_SERIAL_LEN])
791791 {
792792 struct capi_ctr *ctr;
793793 u16 ret;
drivers/isdn/hardware/mISDN/mISDNipac.c+1−1
@@ -694,7 +694,7 @@ isac_release(struct isac_hw *isac) · 693 unmodified lines
694694 {
695695 if (isac->type & IPAC_TYPE_ISACX)
696696 WriteISAC(isac, ISACX_MASK, 0xff);
697− else
697+ else if (isac->type != 0)
698698 WriteISAC(isac, ISAC_MASK, 0xff);
699699 if (isac->dch.timer.function != NULL) {
700700 del_timer(&isac->dch.timer);
drivers/leds/trigger/ledtrig-tty.c+4−7
@@ -51,10 +51,8 @@ static ssize_t ttyname_store(struct device *dev, · 50 unmodified lines
5151
5252 if (size) {
5353 ttyname = kmemdup_nul(buf, size, GFP_KERNEL);
54− if (!ttyname) {
55− ret = -ENOMEM;
56− goto out_unlock;
57− }
54+ if (!ttyname)
55+ return -ENOMEM;
5856 } else {
5957 ttyname = NULL;
6058 }
@@ -69,7 +67,6 @@ static ssize_t ttyname_store(struct device *dev, · 8 unmodified lines
6967
7068 trigger_data->ttyname = ttyname;
7169
72−out_unlock:
7370 mutex_unlock(&trigger_data->mutex);
7471
7572 if (ttyname && !running)
@@ -125,12 +122,12 @@ static void ledtrig_tty_work(struct work_struct *work) · 49 unmodified lines
125122
126123 if (icount.rx != trigger_data->rx ||
127124 icount.tx != trigger_data->tx) {
128− led_set_brightness(trigger_data->led_cdev, LED_ON);
125+ led_set_brightness_sync(trigger_data->led_cdev, LED_ON);
129126
130127 trigger_data->rx = icount.rx;
131128 trigger_data->tx = icount.tx;
132129 } else {
133− led_set_brightness(trigger_data->led_cdev, LED_OFF);
130+ led_set_brightness_sync(trigger_data->led_cdev, LED_OFF);
134131 }
135132
136133 out:
drivers/md/bcache/super.c+1−1
@@ -965,7 +965,7 @@ static int bcache_device_init(struct bcache_device *d, unsigned int block_size, · 964 unmodified lines
965965 q->limits.max_hw_sectors = UINT_MAX;
966966 q->limits.max_sectors = UINT_MAX;
967967 q->limits.max_segment_size = UINT_MAX;
968− q->limits.max_segments = BIO_MAX_PAGES;
968+ q->limits.max_segments = BIO_MAX_VECS;
969969 blk_queue_max_discard_sectors(q, UINT_MAX);
970970 q->limits.discard_granularity = 512;
971971 q->limits.io_min = block_size;
drivers/md/dm-crypt.c+4−4
@@ -229,7 +229,7 @@ static DEFINE_SPINLOCK(dm_crypt_clients_lock); · 228 unmodified lines
229229 static unsigned dm_crypt_clients_n = 0;
230230 static volatile unsigned long dm_crypt_pages_per_client;
231231 #define DM_CRYPT_MEMORY_PERCENT 2
232−#define DM_CRYPT_MIN_PAGES_PER_CLIENT (BIO_MAX_PAGES * 16)
232+#define DM_CRYPT_MIN_PAGES_PER_CLIENT (BIO_MAX_VECS * 16)
233233
234234 static void clone_init(struct dm_crypt_io *, struct bio *);
235235 static void kcryptd_queue_crypt(struct dm_crypt_io *io);
@@ -3246,7 +3246,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) · 3010 unmodified lines
32463246 ALIGN(sizeof(struct dm_crypt_io) + cc->dmreq_start + additional_req_size,
32473247 ARCH_KMALLOC_MINALIGN);
32483248
3249− ret = mempool_init(&cc->page_pool, BIO_MAX_PAGES, crypt_page_alloc, crypt_page_free, cc);
3249+ ret = mempool_init(&cc->page_pool, BIO_MAX_VECS, crypt_page_alloc, crypt_page_free, cc);
32503250 if (ret) {
32513251 ti->error = "Cannot allocate page mempool";
32523252 goto bad;
@@ -3373,9 +3373,9 @@ static int crypt_map(struct dm_target *ti, struct bio *bio) · 120 unmodified lines
33733373 /*
33743374 * Check if bio is too large, split as needed.
33753375 */
3376− if (unlikely(bio->bi_iter.bi_size > (BIO_MAX_PAGES << PAGE_SHIFT)) &&
3376+ if (unlikely(bio->bi_iter.bi_size > (BIO_MAX_VECS << PAGE_SHIFT)) &&
33773377 (bio_data_dir(bio) == WRITE || cc->on_disk_tag_size))
3378− dm_accept_partial_bio(bio, ((BIO_MAX_PAGES << PAGE_SHIFT) >> SECTOR_SHIFT));
3378+ dm_accept_partial_bio(bio, ((BIO_MAX_VECS << PAGE_SHIFT) >> SECTOR_SHIFT));
33793379
33803380 /*
33813381 * Ensure that bio is a multiple of internal sector encryption size
drivers/md/dm-writecache.c+2−2
@@ -1892,10 +1892,10 @@ restart: · 1891 unmodified lines
18921892 list_add(&g->lru, &wbl.list);
18931893 wbl.size++;
18941894 g->write_in_progress = true;
1895− g->wc_list_contiguous = BIO_MAX_PAGES;
1895+ g->wc_list_contiguous = BIO_MAX_VECS;
18961896 f = g;
18971897 e->wc_list_contiguous++;
1898− if (unlikely(e->wc_list_contiguous == BIO_MAX_PAGES)) {
1898+ if (unlikely(e->wc_list_contiguous == BIO_MAX_VECS)) {
18991899 if (unlikely(wc->writeback_all)) {
19001900 next_node = rb_next(&f->rb_node);
19011901 if (likely(next_node))
drivers/md/raid5-cache.c+2−2
@@ -735,7 +735,7 @@ static void r5l_submit_current_io(struct r5l_log *log) · 734 unmodified lines
735735
736736 static struct bio *r5l_bio_alloc(struct r5l_log *log)
737737 {
738− struct bio *bio = bio_alloc_bioset(GFP_NOIO, BIO_MAX_PAGES, &log->bs);
738+ struct bio *bio = bio_alloc_bioset(GFP_NOIO, BIO_MAX_VECS, &log->bs);
739739
740740 bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
741741 bio_set_dev(bio, log->rdev->bdev);
@@ -1634,7 +1634,7 @@ static int r5l_recovery_allocate_ra_pool(struct r5l_log *log, · 892 unmodified lines
16341634 {
16351635 struct page *page;
16361636
1637− ctx->ra_bio = bio_alloc_bioset(GFP_KERNEL, BIO_MAX_PAGES, &log->bs);
1637+ ctx->ra_bio = bio_alloc_bioset(GFP_KERNEL, BIO_MAX_VECS, &log->bs);
16381638 if (!ctx->ra_bio)
16391639 return -ENOMEM;
16401640
drivers/md/raid5-ppl.c+1−1
@@ -496,7 +496,7 @@ static void ppl_submit_iounit(struct ppl_io_unit *io) · 495 unmodified lines
496496 if (!bio_add_page(bio, sh->ppl_page, PAGE_SIZE, 0)) {
497497 struct bio *prev = bio;
498498
499− bio = bio_alloc_bioset(GFP_NOIO, BIO_MAX_PAGES,
499+ bio = bio_alloc_bioset(GFP_NOIO, BIO_MAX_VECS,
500500 &ppl_conf->bs);
501501 bio->bi_opf = prev->bi_opf;
502502 bio->bi_write_hint = prev->bi_write_hint;
drivers/media/firewire/firedtv-fw.c+0−1
@@ -430,4 +430,3 @@ MODULE_AUTHOR("Andreas Monitzer <andy@monitzer.com>"); · 429 unmodified lines
430430 MODULE_AUTHOR("Ben Backx <ben@bbackx.com>");
431431 MODULE_DESCRIPTION("FireDTV DVB Driver");
432432 MODULE_LICENSE("GPL");
433−MODULE_SUPPORTED_DEVICE("FireDTV DVB");
drivers/media/pci/cx18/cx18-alsa-main.c+0−1
@@ -41,7 +41,6 @@ MODULE_PARM_DESC(debug, · 40 unmodified lines
4141
4242 MODULE_AUTHOR("Andy Walls");
4343 MODULE_DESCRIPTION("CX23418 ALSA Interface");
44−MODULE_SUPPORTED_DEVICE("CX23418 MPEG2 encoder");
4544 MODULE_LICENSE("GPL");
4645
4746 MODULE_VERSION(CX18_VERSION);
drivers/media/pci/cx18/cx18-driver.c+0−1
@@ -232,7 +232,6 @@ MODULE_PARM_DESC(cx18_first_minor, · 231 unmodified lines
232232
233233 MODULE_AUTHOR("Hans Verkuil");
234234 MODULE_DESCRIPTION("CX23418 driver");
235−MODULE_SUPPORTED_DEVICE("CX23418 MPEG2 encoder");
236235 MODULE_LICENSE("GPL");
237236
238237 MODULE_VERSION(CX18_VERSION);
drivers/media/pci/cx25821/cx25821-alsa.c+0−1
@@ -104,7 +104,6 @@ MODULE_PARM_DESC(index, "Index value for cx25821 capture interface(s)."); · 103 unmodified lines
104104 MODULE_DESCRIPTION("ALSA driver module for cx25821 based capture cards");
105105 MODULE_AUTHOR("Hiep Huynh");
106106 MODULE_LICENSE("GPL");
107−MODULE_SUPPORTED_DEVICE("{{Conexant,25821}"); /* "{{Conexant,23881}," */
108107
109108 static unsigned int debug;
110109 module_param(debug, int, 0644);
drivers/media/pci/cx88/cx88-alsa.c+0−1
@@ -98,7 +98,6 @@ MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@kernel.org>"); · 97 unmodified lines
9898 MODULE_LICENSE("GPL v2");
9999 MODULE_VERSION(CX88_VERSION);
100100
101−MODULE_SUPPORTED_DEVICE("{{Conexant,23881},{{Conexant,23882},{{Conexant,23883}");
102101 static unsigned int debug;
103102 module_param(debug, int, 0644);
104103 MODULE_PARM_DESC(debug, "enable debug messages");
drivers/media/pci/ivtv/ivtv-alsa-main.c+0−1
@@ -38,7 +38,6 @@ MODULE_PARM_DESC(index, · 37 unmodified lines
3838
3939 MODULE_AUTHOR("Andy Walls");
4040 MODULE_DESCRIPTION("CX23415/CX23416 ALSA Interface");
41−MODULE_SUPPORTED_DEVICE("CX23415/CX23416 MPEG2 encoder");
4241 MODULE_LICENSE("GPL");
4342
4443 MODULE_VERSION(IVTV_VERSION);
drivers/media/pci/ivtv/ivtv-driver.c+0−3
@@ -275,9 +275,6 @@ MODULE_PARM_DESC(ivtv_first_minor, "Set device node number assigned to first car · 274 unmodified lines
275275
276276 MODULE_AUTHOR("Kevin Thayer, Chris Kennedy, Hans Verkuil");
277277 MODULE_DESCRIPTION("CX23415/CX23416 driver");
278−MODULE_SUPPORTED_DEVICE
279− ("CX23415/CX23416 MPEG2 encoder (WinTV PVR-150/250/350/500,\n"
280− "\t\t\tYuan MPG series and similar)");
281278 MODULE_LICENSE("GPL");
282279
283280 MODULE_VERSION(IVTV_VERSION);
drivers/media/pci/sta2x11/sta2x11_vip.c+0−1
@@ -1269,6 +1269,5 @@ late_initcall_sync(sta2x11_vip_init_module); · 1268 unmodified lines
12691269 MODULE_DESCRIPTION("STA2X11 Video Input Port driver");
12701270 MODULE_AUTHOR("Wind River");
12711271 MODULE_LICENSE("GPL v2");
1272−MODULE_SUPPORTED_DEVICE("sta2x11 video input");
12731272 MODULE_VERSION(DRV_VERSION);
12741273 MODULE_DEVICE_TABLE(pci, sta2x11_vip_pci_tbl);
drivers/media/platform/atmel/atmel-isi.c+0−1
@@ -1363,4 +1363,3 @@ module_platform_driver(atmel_isi_driver); · 1362 unmodified lines
13631363 MODULE_AUTHOR("Josh Wu <josh.wu@atmel.com>");
13641364 MODULE_DESCRIPTION("The V4L2 driver for Atmel Linux");
13651365 MODULE_LICENSE("GPL");
1366−MODULE_SUPPORTED_DEVICE("video");
drivers/media/platform/atmel/atmel-sama5d2-isc.c+0−1
@@ -330,4 +330,3 @@ module_platform_driver(atmel_isc_driver); · 329 unmodified lines
330330 MODULE_AUTHOR("Songjun Wu");
331331 MODULE_DESCRIPTION("The V4L2 driver for Atmel-ISC");
332332 MODULE_LICENSE("GPL v2");
333−MODULE_SUPPORTED_DEVICE("video");
drivers/media/platform/marvell-ccic/cafe-driver.c+0−4
@@ -44,10 +44,6 @@ · 43 unmodified lines
4444 MODULE_AUTHOR("Jonathan Corbet <corbet@lwn.net>");
4545 MODULE_DESCRIPTION("Marvell 88ALP01 CMOS Camera Controller driver");
4646 MODULE_LICENSE("GPL");
47−MODULE_SUPPORTED_DEVICE("Video");
48−
49−
50−
5147
5248 struct cafe_camera {
5349 int registered; /* Fully initialized? */
drivers/media/platform/rockchip/rkisp1/rkisp1-params.c+0−1
@@ -1288,7 +1288,6 @@ static void rkisp1_params_config_parameter(struct rkisp1_params *params) · 1287 unmodified lines
12881288 memset(hst.hist_weight, 0x01, sizeof(hst.hist_weight));
12891289 rkisp1_hst_config(params, &hst);
12901290 rkisp1_param_set_bits(params, RKISP1_CIF_ISP_HIST_PROP,
1291− ~RKISP1_CIF_ISP_HIST_PROP_MODE_MASK |
12921291 rkisp1_hst_params_default_config.mode);
12931292
12941293 /* set the range */
drivers/media/platform/stm32/stm32-dcmi.c+0−1
@@ -2149,4 +2149,3 @@ MODULE_AUTHOR("Yannick Fertre <yannick.fertre@st.com>"); · 2148 unmodified lines
21492149 MODULE_AUTHOR("Hugues Fruchet <hugues.fruchet@st.com>");
21502150 MODULE_DESCRIPTION("STMicroelectronics STM32 Digital Camera Memory Interface driver");
21512151 MODULE_LICENSE("GPL");
2152−MODULE_SUPPORTED_DEVICE("video");
drivers/media/platform/vsp1/vsp1_drm.c+3−3
@@ -245,7 +245,7 @@ static int vsp1_du_pipeline_setup_brx(struct vsp1_device *vsp1, · 244 unmodified lines
245245 brx = &vsp1->bru->entity;
246246 else if (pipe->brx && !drm_pipe->force_brx_release)
247247 brx = pipe->brx;
248− else if (!vsp1->bru->entity.pipe)
248+ else if (vsp1_feature(vsp1, VSP1_HAS_BRU) && !vsp1->bru->entity.pipe)
249249 brx = &vsp1->bru->entity;
250250 else
251251 brx = &vsp1->brs->entity;
@@ -462,9 +462,9 @@ static int vsp1_du_pipeline_setup_inputs(struct vsp1_device *vsp1, · 210 unmodified lines
462462 * make sure it is present in the pipeline's list of entities if it
463463 * wasn't already.
464464 */
465− if (!use_uif) {
465+ if (drm_pipe->uif && !use_uif) {
466466 drm_pipe->uif->pipe = NULL;
467− } else if (!drm_pipe->uif->pipe) {
467+ } else if (drm_pipe->uif && !drm_pipe->uif->pipe) {
468468 drm_pipe->uif->pipe = pipe;
469469 list_add_tail(&drm_pipe->uif->list_pipe, &pipe->entities);
470470 }
drivers/media/rc/Makefile+1−0
@@ -5,6 +5,7 @@ obj-y += keymaps/ · 4 unmodified lines
55 obj-$(CONFIG_RC_CORE) += rc-core.o
66 rc-core-y := rc-main.o rc-ir-raw.o
77 rc-core-$(CONFIG_LIRC) += lirc_dev.o
8+rc-core-$(CONFIG_MEDIA_CEC_RC) += keymaps/rc-cec.o
89 rc-core-$(CONFIG_BPF_LIRC_MODE2) += bpf-lirc.o
910 obj-$(CONFIG_IR_NEC_DECODER) += ir-nec-decoder.o
1011 obj-$(CONFIG_IR_RC5_DECODER) += ir-rc5-decoder.o
drivers/media/rc/keymaps/Makefile+0−1
@@ -21,7 +21,6 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ · 20 unmodified lines
2121 rc-behold.o \
2222 rc-behold-columbus.o \
2323 rc-budget-ci-old.o \
24− rc-cec.o \
2524 rc-cinergy-1400.o \
2625 rc-cinergy.o \
2726 rc-d680-dmb.o \
drivers/media/rc/keymaps/rc-cec.c+11−17
@@ -1,5 +1,15 @@
11 // SPDX-License-Identifier: GPL-2.0-or-later
22 /* Keytable for the CEC remote control
3+ *
4+ * This keymap is unusual in that it can't be built as a module,
5+ * instead it is registered directly in rc-main.c if CONFIG_MEDIA_CEC_RC
6+ * is set. This is because it can be called from drm_dp_cec_set_edid() via
7+ * cec_register_adapter() in an asynchronous context, and it is not
8+ * allowed to use request_module() to load rc-cec.ko in that case.
9+ *
10+ * Since this keymap is only used if CONFIG_MEDIA_CEC_RC is set, we
11+ * just compile this keymap into the rc-core module and never as a
12+ * separate module.
313 *
414 * Copyright (c) 2015 by Kamil Debski
515 */
@@ -152,7 +162,7 @@ static struct rc_map_table cec[] = { · 146 unmodified lines
152162 /* 0x77-0xff: Reserved */
153163 };
154164
155−static struct rc_map_list cec_map = {
165+struct rc_map_list cec_map = {
156166 .map = {
157167 .scan = cec,
158168 .size = ARRAY_SIZE(cec),
@@ -160,19 +170,3 @@ static struct rc_map_list cec_map = { · 1 unmodified line
160170 .name = RC_MAP_CEC,
161171 }
162172 };
163−
164−static int __init init_rc_map_cec(void)
165−{
166− return rc_map_register(&cec_map);
167−}
168−
169−static void __exit exit_rc_map_cec(void)
170−{
171− rc_map_unregister(&cec_map);
172−}
173−
174−module_init(init_rc_map_cec);
175−module_exit(exit_rc_map_cec);
176−
177−MODULE_LICENSE("GPL");
178−MODULE_AUTHOR("Kamil Debski");
drivers/media/rc/rc-main.c+6−0
@@ -2069,6 +2069,9 @@ static int __init rc_core_init(void) · 2068 unmodified lines
20692069
20702070 led_trigger_register_simple("rc-feedback", &led_feedback);
20712071 rc_map_register(&empty_map);
2072+#ifdef CONFIG_MEDIA_CEC_RC
2073+ rc_map_register(&cec_map);
2074+#endif
20722075
20732076 return 0;
20742077 }
@@ -2078,6 +2081,9 @@ static void __exit rc_core_exit(void) · 3 unmodified lines
20782081 lirc_dev_exit();
20792082 class_unregister(&rc_class);
20802083 led_trigger_unregister_simple(led_feedback);
2084+#ifdef CONFIG_MEDIA_CEC_RC
2085+ rc_map_unregister(&cec_map);
2086+#endif
20812087 rc_map_unregister(&empty_map);
20822088 }
20832089
drivers/media/usb/cpia2/cpia2_v4l.c+0−1
@@ -56,7 +56,6 @@ MODULE_PARM_DESC(flicker_mode, "Flicker frequency (0 (disabled), " __stringify(5 · 55 unmodified lines
5656
5757 MODULE_AUTHOR("Steve Miller (STMicroelectronics) <steve.miller@st.com>");
5858 MODULE_DESCRIPTION("V4L-driver for STMicroelectronics CPiA2 based cameras");
59−MODULE_SUPPORTED_DEVICE("video");
6059 MODULE_LICENSE("GPL");
6160 MODULE_VERSION(CPIA_VERSION);
6261
drivers/media/usb/tm6000/tm6000-alsa.c+0−1
@@ -51,7 +51,6 @@ MODULE_PARM_DESC(index, "Index value for tm6000x capture interface(s)."); · 50 unmodified lines
5151 MODULE_DESCRIPTION("ALSA driver module for tm5600/tm6000/tm6010 based TV cards");
5252 MODULE_AUTHOR("Mauro Carvalho Chehab");
5353 MODULE_LICENSE("GPL v2");
54−MODULE_SUPPORTED_DEVICE("{{Trident,tm5600},{{Trident,tm6000},{{Trident,tm6010}");
5554 static unsigned int debug;
5655 module_param(debug, int, 0644);
5756 MODULE_PARM_DESC(debug, "enable debug messages");
drivers/media/usb/tm6000/tm6000-dvb.c+0−2
@@ -23,8 +23,6 @@ MODULE_DESCRIPTION("DVB driver extension module for tm5600/6000/6010 based TV ca · 22 unmodified lines
2323 MODULE_AUTHOR("Mauro Carvalho Chehab");
2424 MODULE_LICENSE("GPL");
2525
26−MODULE_SUPPORTED_DEVICE("{{Trident, tm5600},{{Trident, tm6000},{{Trident, tm6010}");
27−
2826 static int debug;
2927
3028 module_param(debug, int, 0644);
drivers/media/usb/usbtv/usbtv-audio.c+1−1
@@ -371,7 +371,7 @@ void usbtv_audio_free(struct usbtv *usbtv) · 370 unmodified lines
371371 cancel_work_sync(&usbtv->snd_trigger);
372372
373373 if (usbtv->snd && usbtv->udev) {
374− snd_card_free(usbtv->snd);
374+ snd_card_free_when_closed(usbtv->snd);
375375 usbtv->snd = NULL;
376376 }
377377 }
drivers/mfd/intel_quark_i2c_gpio.c+4−2
@@ -72,7 +72,8 @@ static const struct dmi_system_id dmi_platform_info[] = { · 71 unmodified lines
7272 {}
7373 };
7474
75−static const struct resource intel_quark_i2c_res[] = {
75+/* This is used as a place holder and will be modified at run-time */
76+static struct resource intel_quark_i2c_res[] = {
7677 [INTEL_QUARK_IORES_MEM] = {
7778 .flags = IORESOURCE_MEM,
7879 },
@@ -85,7 +86,8 @@ static struct mfd_cell_acpi_match intel_quark_acpi_match_i2c = { · 6 unmodified lines
8586 .adr = MFD_ACPI_MATCH_I2C,
8687 };
8788
88−static const struct resource intel_quark_gpio_res[] = {
89+/* This is used as a place holder and will be modified at run-time */
90+static struct resource intel_quark_gpio_res[] = {
8991 [INTEL_QUARK_IORES_MEM] = {
9092 .flags = IORESOURCE_MEM,
9193 },
drivers/misc/fastrpc.c+5−0
@@ -950,6 +950,11 @@ static int fastrpc_internal_invoke(struct fastrpc_user *fl, u32 kernel, · 949 unmodified lines
950950 if (!fl->cctx->rpdev)
951951 return -EPIPE;
952952
953+ if (handle == FASTRPC_INIT_HANDLE && !kernel) {
954+ dev_warn_ratelimited(fl->sctx->dev, "user app trying to send a kernel RPC message (%d)\n", handle);
955+ return -EPERM;
956+ }
957+
953958 ctx = fastrpc_context_alloc(fl, kernel, sc, args);
954959 if (IS_ERR(ctx))
955960 return PTR_ERR(ctx);
drivers/misc/habanalabs/common/debugfs.c+1−4
@@ -992,7 +992,6 @@ void hl_debugfs_add_device(struct hl_device *hdev) · 991 unmodified lines
992992 struct hl_dbg_device_entry *dev_entry = &hdev->hl_debugfs;
993993 int count = ARRAY_SIZE(hl_debugfs_list);
994994 struct hl_debugfs_entry *entry;
995− struct dentry *ent;
996995 int i;
997996
998997 dev_entry->hdev = hdev;
@@ -1105,13 +1104,11 @@ void hl_debugfs_add_device(struct hl_device *hdev) · 106 unmodified lines
11051104 &hl_security_violations_fops);
11061105
11071106 for (i = 0, entry = dev_entry->entry_arr ; i < count ; i++, entry++) {
1108−
1109− ent = debugfs_create_file(hl_debugfs_list[i].name,
1107+ debugfs_create_file(hl_debugfs_list[i].name,
11101108 0444,
11111109 dev_entry->root,
11121110 entry,
11131111 &hl_debugfs_fops);
1114− entry->dent = ent;
11151112 entry->info_ent = &hl_debugfs_list[i];
11161113 entry->dev_entry = dev_entry;
11171114 }
drivers/misc/habanalabs/common/device.c+35−5
@@ -93,12 +93,19 @@ void hl_hpriv_put(struct hl_fpriv *hpriv) · 92 unmodified lines
9393 static int hl_device_release(struct inode *inode, struct file *filp)
9494 {
9595 struct hl_fpriv *hpriv = filp->private_data;
96+ struct hl_device *hdev = hpriv->hdev;
97+
98+ filp->private_data = NULL;
99+
100+ if (!hdev) {
101+ pr_crit("Closing FD after device was removed. Memory leak will occur and it is advised to reboot.\n");
102+ put_pid(hpriv->taskpid);
103+ return 0;
104+ }
96105
97106 hl_cb_mgr_fini(hpriv->hdev, &hpriv->cb_mgr);
98107 hl_ctx_mgr_fini(hpriv->hdev, &hpriv->ctx_mgr);
99108
100− filp->private_data = NULL;
101−
102109 hl_hpriv_put(hpriv);
103110
104111 return 0;
@@ -107,15 +114,20 @@ static int hl_device_release(struct inode *inode, struct file *filp) · 2 unmodified lines
107114 static int hl_device_release_ctrl(struct inode *inode, struct file *filp)
108115 {
109116 struct hl_fpriv *hpriv = filp->private_data;
110− struct hl_device *hdev;
117+ struct hl_device *hdev = hpriv->hdev;
111118
112119 filp->private_data = NULL;
113120
114− hdev = hpriv->hdev;
121+ if (!hdev) {
122+ pr_err("Closing FD after device was removed\n");
123+ goto out;
124+ }
115125
116126 mutex_lock(&hdev->fpriv_list_lock);
117127 list_del(&hpriv->dev_node);
118128 mutex_unlock(&hdev->fpriv_list_lock);
129+out:
130+ put_pid(hpriv->taskpid);
119131
120132 kfree(hpriv);
121133
@@ -134,8 +146,14 @@ static int hl_device_release_ctrl(struct inode *inode, struct file *filp) · 12 unmodified lines
134146 static int hl_mmap(struct file *filp, struct vm_area_struct *vma)
135147 {
136148 struct hl_fpriv *hpriv = filp->private_data;
149+ struct hl_device *hdev = hpriv->hdev;
137150 unsigned long vm_pgoff;
138151
152+ if (!hdev) {
153+ pr_err_ratelimited("Trying to mmap after device was removed! Please close FD\n");
154+ return -ENODEV;
155+ }
156+
139157 vm_pgoff = vma->vm_pgoff;
140158 vma->vm_pgoff = HL_MMAP_OFFSET_VALUE_GET(vm_pgoff);
141159
@@ -883,6 +901,16 @@ wait_for_processes: · 741 unmodified lines
883901 return -EBUSY;
884902 }
885903
904+static void device_disable_open_processes(struct hl_device *hdev)
905+{
906+ struct hl_fpriv *hpriv;
907+
908+ mutex_lock(&hdev->fpriv_list_lock);
909+ list_for_each_entry(hpriv, &hdev->fpriv_list, dev_node)
910+ hpriv->hdev = NULL;
911+ mutex_unlock(&hdev->fpriv_list_lock);
912+}
913+
886914 /*
887915 * hl_device_reset - reset the device
888916 *
@@ -1556,8 +1584,10 @@ void hl_device_fini(struct hl_device *hdev) · 667 unmodified lines
15561584 HL_PENDING_RESET_LONG_SEC);
15571585
15581586 rc = device_kill_open_processes(hdev, HL_PENDING_RESET_LONG_SEC);
1559− if (rc)
1587+ if (rc) {
15601588 dev_crit(hdev->dev, "Failed to kill all open processes\n");
1589+ device_disable_open_processes(hdev);
1590+ }
15611591
15621592 hl_cb_pool_fini(hdev);
15631593
drivers/misc/habanalabs/common/habanalabs.h+0−2
@@ -1465,12 +1465,10 @@ struct hl_info_list { · 1464 unmodified lines
14651465
14661466 /**
14671467 * struct hl_debugfs_entry - debugfs dentry wrapper.
1468− * @dent: base debugfs entry structure.
14691468 * @info_ent: dentry realted ops.
14701469 * @dev_entry: ASIC specific debugfs manager.
14711470 */
14721471 struct hl_debugfs_entry {
1473− struct dentry *dent;
14741472 const struct hl_info_list *info_ent;
14751473 struct hl_dbg_device_entry *dev_entry;
14761474 };
drivers/misc/habanalabs/common/habanalabs_ioctl.c+12−0
@@ -5,6 +5,8 @@ · 4 unmodified lines
55 * All Rights Reserved.
66 */
77
8+#define pr_fmt(fmt) "habanalabs: " fmt
9+
810 #include <uapi/misc/habanalabs.h>
911 #include "habanalabs.h"
1012
@@ -682,6 +684,11 @@ long hl_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) · 671 unmodified lines
682684 const struct hl_ioctl_desc *ioctl = NULL;
683685 unsigned int nr = _IOC_NR(cmd);
684686
687+ if (!hdev) {
688+ pr_err_ratelimited("Sending ioctl after device was removed! Please close FD\n");
689+ return -ENODEV;
690+ }
691+
685692 if ((nr >= HL_COMMAND_START) && (nr < HL_COMMAND_END)) {
686693 ioctl = &hl_ioctls[nr];
687694 } else {
@@ -700,6 +707,11 @@ long hl_ioctl_control(struct file *filep, unsigned int cmd, unsigned long arg) · 12 unmodified lines
700707 const struct hl_ioctl_desc *ioctl = NULL;
701708 unsigned int nr = _IOC_NR(cmd);
702709
710+ if (!hdev) {
711+ pr_err_ratelimited("Sending ioctl after device was removed! Please close FD\n");
712+ return -ENODEV;
713+ }
714+
703715 if (nr == _IOC_NR(HL_IOCTL_INFO)) {
704716 ioctl = &hl_ioctls_control[nr];
705717 } else {
drivers/misc/habanalabs/common/irq.c+1−1
@@ -47,7 +47,7 @@ inline u32 hl_cq_inc_ptr(u32 ptr) · 46 unmodified lines
4747 * Increment ptr by 1. If it reaches the number of event queue
4848 * entries, set it to 0
4949 */
50−inline u32 hl_eq_inc_ptr(u32 ptr)
50+static inline u32 hl_eq_inc_ptr(u32 ptr)
5151 {
5252 ptr++;
5353 if (unlikely(ptr == HL_EQ_LENGTH))
drivers/misc/habanalabs/common/mmu/mmu.c+26−12
@@ -499,18 +499,32 @@ static void hl_mmu_pa_page_with_offset(struct hl_ctx *ctx, u64 virt_addr, · 498 unmodified lines
499499 else /* HL_VA_RANGE_TYPE_DRAM */
500500 p = &prop->dmmu;
501501
502− /*
503− * find the correct hop shift field in hl_mmu_properties structure
504− * in order to determine the right maks for the page offset.
505− */
506− hop0_shift_off = offsetof(struct hl_mmu_properties, hop0_shift);
507− p = (char *)p + hop0_shift_off;
508− p = (char *)p + ((hops->used_hops - 1) * sizeof(u64));
509− hop_shift = *(u64 *)p;
510− offset_mask = (1ull << hop_shift) - 1;
511− addr_mask = ~(offset_mask);
512− *phys_addr = (tmp_phys_addr & addr_mask) |
513− (virt_addr & offset_mask);
502+ if ((hops->range_type == HL_VA_RANGE_TYPE_DRAM) &&
503+ !is_power_of_2(prop->dram_page_size)) {
504+ u32 bit;
505+ u64 page_offset_mask;
506+ u64 phys_addr_mask;
507+
508+ bit = __ffs64((u64)prop->dram_page_size);
509+ page_offset_mask = ((1ull << bit) - 1);
510+ phys_addr_mask = ~page_offset_mask;
511+ *phys_addr = (tmp_phys_addr & phys_addr_mask) |
512+ (virt_addr & page_offset_mask);
513+ } else {
514+ /*
515+ * find the correct hop shift field in hl_mmu_properties
516+ * structure in order to determine the right masks
517+ * for the page offset.
518+ */
519+ hop0_shift_off = offsetof(struct hl_mmu_properties, hop0_shift);
520+ p = (char *)p + hop0_shift_off;
521+ p = (char *)p + ((hops->used_hops - 1) * sizeof(u64));
522+ hop_shift = *(u64 *)p;
523+ offset_mask = (1ull << hop_shift) - 1;
524+ addr_mask = ~(offset_mask);
525+ *phys_addr = (tmp_phys_addr & addr_mask) |
526+ (virt_addr & offset_mask);
527+ }
514528 }
515529
516530 int hl_mmu_va_to_pa(struct hl_ctx *ctx, u64 virt_addr, u64 *phys_addr)
drivers/misc/pvpanic.c+1−0
@@ -140,6 +140,7 @@ static const struct of_device_id pvpanic_mmio_match[] = { · 139 unmodified lines
140140 { .compatible = "qemu,pvpanic-mmio", },
141141 {}
142142 };
143+MODULE_DEVICE_TABLE(of, pvpanic_mmio_match);
143144
144145 static const struct acpi_device_id pvpanic_device_ids[] = {
145146 { "QEMU0001", 0 },
drivers/mmc/core/bus.c+5−6
@@ -399,11 +399,6 @@ void mmc_remove_card(struct mmc_card *card) · 398 unmodified lines
399399 mmc_remove_card_debugfs(card);
400400 #endif
401401
402− if (host->cqe_enabled) {
403− host->cqe_ops->cqe_disable(host);
404− host->cqe_enabled = false;
405− }
406−
407402 if (mmc_card_present(card)) {
408403 if (mmc_host_is_spi(card->host)) {
409404 pr_info("%s: SPI card removed\n",
@@ -416,6 +411,10 @@ void mmc_remove_card(struct mmc_card *card) · 6 unmodified lines
416411 of_node_put(card->dev.of_node);
417412 }
418413
414+ if (host->cqe_enabled) {
415+ host->cqe_ops->cqe_disable(host);
416+ host->cqe_enabled = false;
417+ }
418+
419419 put_device(&card->dev);
420420 }
421−
drivers/mmc/core/mmc.c+11−4
@@ -423,10 +423,6 @@ static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd) · 422 unmodified lines
423423
424424 /* EXT_CSD value is in units of 10ms, but we store in ms */
425425 card->ext_csd.part_time = 10 * ext_csd[EXT_CSD_PART_SWITCH_TIME];
426− /* Some eMMC set the value too low so set a minimum */
427− if (card->ext_csd.part_time &&
428− card->ext_csd.part_time < MMC_MIN_PART_SWITCH_TIME)
429− card->ext_csd.part_time = MMC_MIN_PART_SWITCH_TIME;
430426
431427 /* Sleep / awake timeout in 100ns units */
432428 if (sa_shift > 0 && sa_shift <= 0x17)
@@ -616,6 +612,17 @@ static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd) · 183 unmodified lines
616612 card->ext_csd.data_sector_size = 512;
617613 }
618614
615+ /*
616+ * GENERIC_CMD6_TIME is to be used "unless a specific timeout is defined
617+ * when accessing a specific field", so use it here if there is no
618+ * PARTITION_SWITCH_TIME.
619+ */
620+ if (!card->ext_csd.part_time)
621+ card->ext_csd.part_time = card->ext_csd.generic_cmd6_time;
622+ /* Some eMMC set the value too low so set a minimum */
623+ if (card->ext_csd.part_time < MMC_MIN_PART_SWITCH_TIME)
624+ card->ext_csd.part_time = MMC_MIN_PART_SWITCH_TIME;
625+
619626 /* eMMC v5 or later */
620627 if (card->ext_csd.rev >= 7) {
621628 memcpy(card->ext_csd.fwrev, &ext_csd[EXT_CSD_FIRMWARE_VERSION],
drivers/mmc/host/mmci.c+9−1
@@ -1242,7 +1242,11 @@ mmci_start_command(struct mmci_host *host, struct mmc_command *cmd, u32 c) · 1241 unmodified lines
12421242 if (!cmd->busy_timeout)
12431243 cmd->busy_timeout = 10 * MSEC_PER_SEC;
12441244
1245− clks = (unsigned long long)cmd->busy_timeout * host->cclk;
1245+ if (cmd->busy_timeout > host->mmc->max_busy_timeout)
1246+ clks = (unsigned long long)host->mmc->max_busy_timeout * host->cclk;
1247+ else
1248+ clks = (unsigned long long)cmd->busy_timeout * host->cclk;
1249+
12461250 do_div(clks, MSEC_PER_SEC);
12471251 writel_relaxed(clks, host->base + MMCIDATATIMER);
12481252 }
@@ -2151,6 +2155,10 @@ static int mmci_probe(struct amba_device *dev, · 902 unmodified lines
21512155 mmc->caps |= MMC_CAP_WAIT_WHILE_BUSY;
21522156 }
21532157
2158+ /* Variants with mandatory busy timeout in HW needs R1B responses. */
2159+ if (variant->busy_timeout)
2160+ mmc->caps |= MMC_CAP_NEED_RSP_BUSY;
2161+
21542162 /* Prepare a CMD12 - needed to clear the DPSM on some variants. */
21552163 host->stop_abort.opcode = MMC_STOP_TRANSMISSION;
21562164 host->stop_abort.arg = 0;
drivers/mtd/maps/sun_uflash.c+0−1
@@ -32,7 +32,6 @@ · 31 unmodified lines
3232
3333 MODULE_AUTHOR("Eric Brower <ebrower@usa.net>");
3434 MODULE_DESCRIPTION("User-programmable flash device on Sun Microsystems boardsets");
35−MODULE_SUPPORTED_DEVICE(DRIVER_NAME);
3635 MODULE_LICENSE("GPL");
3736 MODULE_VERSION("2.1");
3837
drivers/net/arcnet/com20020-pci.c+19−15
@@ -127,6 +127,8 @@ static int com20020pci_probe(struct pci_dev *pdev, · 126 unmodified lines
127127 int i, ioaddr, ret;
128128 struct resource *r;
129129
130+ ret = 0;
131+
130132 if (pci_enable_device(pdev))
131133 return -EIO;
132134
@@ -139,6 +141,8 @@ static int com20020pci_probe(struct pci_dev *pdev, · 6 unmodified lines
139141 priv->ci = ci;
140142 mm = &ci->misc_map;
141143
144+ pci_set_drvdata(pdev, priv);
145+
142146 INIT_LIST_HEAD(&priv->list_dev);
143147
144148 if (mm->size) {
@@ -161,7 +165,7 @@ static int com20020pci_probe(struct pci_dev *pdev, · 16 unmodified lines
161165 dev = alloc_arcdev(device);
162166 if (!dev) {
163167 ret = -ENOMEM;
164− goto out_port;
168+ break;
165169 }
166170 dev->dev_port = i;
167171
@@ -178,7 +182,7 @@ static int com20020pci_probe(struct pci_dev *pdev, · 10 unmodified lines
178182 pr_err("IO region %xh-%xh already allocated\n",
179183 ioaddr, ioaddr + cm->size - 1);
180184 ret = -EBUSY;
181− goto out_port;
185+ goto err_free_arcdev;
182186 }
183187
184188 /* Dummy access after Reset
@@ -216,18 +220,18 @@ static int com20020pci_probe(struct pci_dev *pdev, · 31 unmodified lines
216220 if (arcnet_inb(ioaddr, COM20020_REG_R_STATUS) == 0xFF) {
217221 pr_err("IO address %Xh is empty!\n", ioaddr);
218222 ret = -EIO;
219− goto out_port;
223+ goto err_free_arcdev;
220224 }
221225 if (com20020_check(dev)) {
222226 ret = -EIO;
223− goto out_port;
227+ goto err_free_arcdev;
224228 }
225229
226230 card = devm_kzalloc(&pdev->dev, sizeof(struct com20020_dev),
227231 GFP_KERNEL);
228232 if (!card) {
229233 ret = -ENOMEM;
230− goto out_port;
234+ goto err_free_arcdev;
231235 }
232236
233237 card->index = i;
@@ -253,29 +257,29 @@ static int com20020pci_probe(struct pci_dev *pdev, · 19 unmodified lines
253257
254258 ret = devm_led_classdev_register(&pdev->dev, &card->tx_led);
255259 if (ret)
256− goto out_port;
260+ goto err_free_arcdev;
257261
258262 ret = devm_led_classdev_register(&pdev->dev, &card->recon_led);
259263 if (ret)
260− goto out_port;
264+ goto err_free_arcdev;
261265
262266 dev_set_drvdata(&dev->dev, card);
263267
264268 ret = com20020_found(dev, IRQF_SHARED);
265269 if (ret)
266− goto out_port;
270+ goto err_free_arcdev;
267271
268272 devm_arcnet_led_init(dev, dev->dev_id, i);
269273
270274 list_add(&card->list, &priv->list_dev);
271− }
275+ continue;
272276
273− pci_set_drvdata(pdev, priv);
274−
275− return 0;
276−
277−out_port:
278− com20020pci_remove(pdev);
277+err_free_arcdev:
278+ free_arcdev(dev);
279+ break;
280+ }
281+ if (ret)
282+ com20020pci_remove(pdev);
279283 return ret;
280284 }
281285
drivers/net/bonding/bond_main.c+2−6
@@ -3978,15 +3978,11 @@ static int bond_neigh_init(struct neighbour *n) · 3977 unmodified lines
39783978
39793979 rcu_read_lock();
39803980 slave = bond_first_slave_rcu(bond);
3981− if (!slave) {
3982− ret = -EINVAL;
3981+ if (!slave)
39833982 goto out;
3984− }
39853983 slave_ops = slave->dev->netdev_ops;
3986− if (!slave_ops->ndo_neigh_setup) {
3987− ret = -EINVAL;
3984+ if (!slave_ops->ndo_neigh_setup)
39883985 goto out;
3989− }
39903986
39913987 /* TODO: find another way [1] to implement this.
39923988 * Passing a zeroed structure is fragile,
drivers/net/can/c_can/c_can.c+1−23
@@ -212,18 +212,6 @@ static const struct can_bittiming_const c_can_bittiming_const = { · 211 unmodified lines
212212 .brp_inc = 1,
213213 };
214214
215−static inline void c_can_pm_runtime_enable(const struct c_can_priv *priv)
216−{
217− if (priv->device)
218− pm_runtime_enable(priv->device);
219−}
220−
221−static inline void c_can_pm_runtime_disable(const struct c_can_priv *priv)
222−{
223− if (priv->device)
224− pm_runtime_disable(priv->device);
225−}
226−
227215 static inline void c_can_pm_runtime_get_sync(const struct c_can_priv *priv)
228216 {
229217 if (priv->device)
@@ -1335,7 +1323,6 @@ static const struct net_device_ops c_can_netdev_ops = { · 1105 unmodified lines
13351323
13361324 int register_c_can_dev(struct net_device *dev)
13371325 {
1338− struct c_can_priv *priv = netdev_priv(dev);
13391326 int err;
13401327
13411328 /* Deactivate pins to prevent DRA7 DCAN IP from being
@@ -1345,28 +1332,19 @@ int register_c_can_dev(struct net_device *dev) · 3 unmodified lines
13451332 */
13461333 pinctrl_pm_select_sleep_state(dev->dev.parent);
13471334
1348− c_can_pm_runtime_enable(priv);
1349−
13501335 dev->flags |= IFF_ECHO; /* we support local echo */
13511336 dev->netdev_ops = &c_can_netdev_ops;
13521337
13531338 err = register_candev(dev);
1354− if (err)
1355− c_can_pm_runtime_disable(priv);
1356− else
1339+ if (!err)
13571340 devm_can_led_init(dev);
1358−
13591341 return err;
13601342 }
13611343 EXPORT_SYMBOL_GPL(register_c_can_dev);
13621344
13631345 void unregister_c_can_dev(struct net_device *dev)
13641346 {
1365− struct c_can_priv *priv = netdev_priv(dev);
1366−
13671347 unregister_candev(dev);
1368−
1369− c_can_pm_runtime_disable(priv);
13701348 }
13711349 EXPORT_SYMBOL_GPL(unregister_c_can_dev);
13721350
drivers/net/can/c_can/c_can_pci.c+2−1
@@ -239,12 +239,13 @@ static void c_can_pci_remove(struct pci_dev *pdev) · 238 unmodified lines
239239 {
240240 struct net_device *dev = pci_get_drvdata(pdev);
241241 struct c_can_priv *priv = netdev_priv(dev);
242+ void __iomem *addr = priv->base;
242243
243244 unregister_c_can_dev(dev);
244245
245246 free_c_can_dev(dev);
246247
247− pci_iounmap(pdev, priv->base);
248+ pci_iounmap(pdev, addr);
248249 pci_disable_msi(pdev);
249250 pci_clear_master(pdev);
250251 pci_release_regions(pdev);
drivers/net/can/c_can/c_can_platform.c+5−1
@@ -29,6 +29,7 @@ · 28 unmodified lines
2929 #include <linux/list.h>
3030 #include <linux/io.h>
3131 #include <linux/platform_device.h>
32+#include <linux/pm_runtime.h>
3233 #include <linux/clk.h>
3334 #include <linux/of.h>
3435 #include <linux/of_device.h>
@@ -386,6 +387,7 @@ static int c_can_plat_probe(struct platform_device *pdev) · 351 unmodified lines
386387 platform_set_drvdata(pdev, dev);
387388 SET_NETDEV_DEV(dev, &pdev->dev);
388389
390+ pm_runtime_enable(priv->device);
389391 ret = register_c_can_dev(dev);
390392 if (ret) {
391393 dev_err(&pdev->dev, "registering %s failed (err=%d)\n",
@@ -398,6 +400,7 @@ static int c_can_plat_probe(struct platform_device *pdev) · 6 unmodified lines
398400 return 0;
399401
400402 exit_free_device:
403+ pm_runtime_disable(priv->device);
401404 free_c_can_dev(dev);
402405 exit:
403406 dev_err(&pdev->dev, "probe failed\n");
@@ -408,9 +411,10 @@ exit: · 4 unmodified lines
408411 static int c_can_plat_remove(struct platform_device *pdev)
409412 {
410413 struct net_device *dev = platform_get_drvdata(pdev);
414+ struct c_can_priv *priv = netdev_priv(dev);
411415
412416 unregister_c_can_dev(dev);
413−
417+ pm_runtime_disable(priv->device);
414418 free_c_can_dev(dev);
415419
416420 return 0;
drivers/net/can/dev/netlink.c+1−0
@@ -355,6 +355,7 @@ static void can_dellink(struct net_device *dev, struct list_head *head) · 354 unmodified lines
355355
356356 struct rtnl_link_ops can_link_ops __read_mostly = {
357357 .kind = "can",
358+ .netns_refund = true,
358359 .maxtype = IFLA_CAN_MAX,
359360 .policy = can_policy,
360361 .setup = can_setup,
drivers/net/can/flexcan.c+7−1
@@ -697,9 +697,15 @@ static int flexcan_chip_disable(struct flexcan_priv *priv) · 696 unmodified lines
697697 static int flexcan_chip_freeze(struct flexcan_priv *priv)
698698 {
699699 struct flexcan_regs __iomem *regs = priv->regs;
700− unsigned int timeout = 1000 * 1000 * 10 / priv->can.bittiming.bitrate;
700+ unsigned int timeout;
701+ u32 bitrate = priv->can.bittiming.bitrate;
701702 u32 reg;
702703
704+ if (bitrate)
705+ timeout = 1000 * 1000 * 10 / bitrate;
706+ else
707+ timeout = FLEXCAN_TIMEOUT_US / 10;
708+
703709 reg = priv->read(&regs->mcr);
704710 reg |= FLEXCAN_MCR_FRZ | FLEXCAN_MCR_HALT;
705711 priv->write(reg, &regs->mcr);
drivers/net/can/kvaser_pciefd.c+4−0
@@ -57,6 +57,7 @@ MODULE_DESCRIPTION("CAN driver for Kvaser CAN/PCIe devices"); · 56 unmodified lines
5757 #define KVASER_PCIEFD_KCAN_STAT_REG 0x418
5858 #define KVASER_PCIEFD_KCAN_MODE_REG 0x41c
5959 #define KVASER_PCIEFD_KCAN_BTRN_REG 0x420
60+#define KVASER_PCIEFD_KCAN_BUS_LOAD_REG 0x424
6061 #define KVASER_PCIEFD_KCAN_BTRD_REG 0x428
6162 #define KVASER_PCIEFD_KCAN_PWM_REG 0x430
6263 /* Loopback control register */
@@ -949,6 +950,9 @@ static int kvaser_pciefd_setup_can_ctrls(struct kvaser_pciefd *pcie) · 886 unmodified lines
949950 timer_setup(&can->bec_poll_timer, kvaser_pciefd_bec_poll_timer,
950951 0);
951952
953+ /* Disable Bus load reporting */
954+ iowrite32(0, can->reg_base + KVASER_PCIEFD_KCAN_BUS_LOAD_REG);
955+
952956 tx_npackets = ioread32(can->reg_base +
953957 KVASER_PCIEFD_KCAN_TX_NPACKETS_REG);
954958 if (((tx_npackets >> KVASER_PCIEFD_KCAN_TX_NPACKETS_MAX_SHIFT) &
drivers/net/can/m_can/m_can.c+1−4
@@ -501,9 +501,6 @@ static int m_can_do_rx_poll(struct net_device *dev, int quota) · 500 unmodified lines
501501 }
502502
503503 while ((rxfs & RXFS_FFL_MASK) && (quota > 0)) {
504− if (rxfs & RXFS_RFL)
505− netdev_warn(dev, "Rx FIFO 0 Message Lost\n");
506−
507504 m_can_read_fifo(dev, rxfs);
508505
509506 quota--;
@@ -876,7 +873,7 @@ static int m_can_rx_peripheral(struct net_device *dev) · 366 unmodified lines
876873 {
877874 struct m_can_classdev *cdev = netdev_priv(dev);
878875
879− m_can_rx_handler(dev, 1);
876+ m_can_rx_handler(dev, M_CAN_NAPI_WEIGHT);
880877
881878 m_can_enable_all_interrupts(cdev);
882879
drivers/net/can/peak_canfd/peak_pciefd_main.c+0−1
@@ -21,7 +21,6 @@ · 20 unmodified lines
2121
2222 MODULE_AUTHOR("Stephane Grosjean <s.grosjean@peak-system.com>");
2323 MODULE_DESCRIPTION("Socket-CAN driver for PEAK PCAN PCIe/M.2 FD family cards");
24−MODULE_SUPPORTED_DEVICE("PEAK PCAN PCIe/M.2 FD CAN cards");
2524 MODULE_LICENSE("GPL v2");
2625
2726 #define PCIEFD_DRV_NAME "peak_pciefd"
drivers/net/can/sja1000/ems_pci.c+0−1
@@ -21,7 +21,6 @@ · 20 unmodified lines
2121
2222 MODULE_AUTHOR("Sebastian Haas <haas@ems-wuenche.com>");
2323 MODULE_DESCRIPTION("Socket-CAN driver for EMS CPC-PCI/PCIe/104P CAN cards");
24−MODULE_SUPPORTED_DEVICE("EMS CPC-PCI/PCIe/104P CAN card");
2524 MODULE_LICENSE("GPL v2");
2625
2726 #define EMS_PCI_V1_MAX_CHAN 2
drivers/net/can/sja1000/ems_pcmcia.c+0−1
@@ -21,7 +21,6 @@ · 20 unmodified lines
2121
2222 MODULE_AUTHOR("Markus Plessing <plessing@ems-wuensche.com>");
2323 MODULE_DESCRIPTION("Socket-CAN driver for EMS CPC-CARD cards");
24−MODULE_SUPPORTED_DEVICE("EMS CPC-CARD CAN card");
2524 MODULE_LICENSE("GPL v2");
2625
2726 #define EMS_PCMCIA_MAX_CHAN 2
drivers/net/can/sja1000/kvaser_pci.c+0−1
@@ -33,7 +33,6 @@ · 32 unmodified lines
3333
3434 MODULE_AUTHOR("Per Dalen <per.dalen@cnw.se>");
3535 MODULE_DESCRIPTION("Socket-CAN driver for KVASER PCAN PCI cards");
36−MODULE_SUPPORTED_DEVICE("KVASER PCAN PCI CAN card");
3736 MODULE_LICENSE("GPL v2");
3837
3938 #define MAX_NO_OF_CHANNELS 4 /* max no of channels on a single card */
drivers/net/can/sja1000/peak_pci.c+0−2
@@ -24,8 +24,6 @@ · 23 unmodified lines
2424
2525 MODULE_AUTHOR("Stephane Grosjean <s.grosjean@peak-system.com>");
2626 MODULE_DESCRIPTION("Socket-CAN driver for PEAK PCAN PCI family cards");
27−MODULE_SUPPORTED_DEVICE("PEAK PCAN PCI/PCIe/PCIeC miniPCI CAN cards");
28−MODULE_SUPPORTED_DEVICE("PEAK PCAN miniPCIe/cPCI PC/104+ PCI/104e CAN Cards");
2927 MODULE_LICENSE("GPL v2");
3028
3129 #define DRV_NAME "peak_pci"
drivers/net/can/sja1000/peak_pcmcia.c+0−1
@@ -22,7 +22,6 @@ · 21 unmodified lines
2222 MODULE_AUTHOR("Stephane Grosjean <s.grosjean@peak-system.com>");
2323 MODULE_DESCRIPTION("CAN driver for PEAK-System PCAN-PC Cards");
2424 MODULE_LICENSE("GPL v2");
25−MODULE_SUPPORTED_DEVICE("PEAK PCAN-PC Card");
2625
2726 /* PEAK-System PCMCIA driver name */
2827 #define PCC_NAME "peak_pcmcia"
drivers/net/can/sja1000/plx_pci.c+0−12
@@ -25,18 +25,6 @@ · 24 unmodified lines
2525 MODULE_AUTHOR("Pavel Cheblakov <P.B.Cheblakov@inp.nsk.su>");
2626 MODULE_DESCRIPTION("Socket-CAN driver for PLX90xx PCI-bridge cards with "
2727 "the SJA1000 chips");
28−MODULE_SUPPORTED_DEVICE("Adlink PCI-7841/cPCI-7841, "
29− "Adlink PCI-7841/cPCI-7841 SE, "
30− "Marathon CAN-bus-PCI, "
31− "Marathon CAN-bus-PCIe, "
32− "TEWS TECHNOLOGIES TPMC810, "
33− "esd CAN-PCI/CPCI/PCI104/200, "
34− "esd CAN-PCI/PMC/266, "
35− "esd CAN-PCIe/2000, "
36− "Connect Tech Inc. CANpro/104-Plus Opto (CRG001), "
37− "IXXAT PC-I 04/PCI, "
38− "ELCUS CAN-200-PCI, "
39− "ASEM DUAL CAN-RAW")
4028 MODULE_LICENSE("GPL v2");
4129
4230 #define PLX_PCI_MAX_CHAN 2
drivers/net/can/usb/Kconfig+1−0
@@ -73,6 +73,7 @@ config CAN_KVASER_USB · 72 unmodified lines
7373 - Kvaser Memorator Pro 5xHS
7474 - Kvaser USBcan Light 4xHS
7575 - Kvaser USBcan Pro 2xHS v2
76+ - Kvaser USBcan Pro 4xHS
7677 - Kvaser USBcan Pro 5xHS
7778 - Kvaser U100
7879 - Kvaser U100P
drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c+3−1
@@ -86,8 +86,9 @@ · 85 unmodified lines
8686 #define USB_U100_PRODUCT_ID 273
8787 #define USB_U100P_PRODUCT_ID 274
8888 #define USB_U100S_PRODUCT_ID 275
89+#define USB_USBCAN_PRO_4HS_PRODUCT_ID 276
8990 #define USB_HYDRA_PRODUCT_ID_END \
90− USB_U100S_PRODUCT_ID
91+ USB_USBCAN_PRO_4HS_PRODUCT_ID
9192
9293 static inline bool kvaser_is_leaf(const struct usb_device_id *id)
9394 {
@@ -193,6 +194,7 @@ static const struct usb_device_id kvaser_usb_table[] = { · 99 unmodified lines
193194 { USB_DEVICE(KVASER_VENDOR_ID, USB_U100_PRODUCT_ID) },
194195 { USB_DEVICE(KVASER_VENDOR_ID, USB_U100P_PRODUCT_ID) },
195196 { USB_DEVICE(KVASER_VENDOR_ID, USB_U100S_PRODUCT_ID) },
197+ { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN_PRO_4HS_PRODUCT_ID) },
196198 { }
197199 };
198200 MODULE_DEVICE_TABLE(usb, kvaser_usb_table);
drivers/net/can/usb/peak_usb/pcan_usb.c+0−2
@@ -18,8 +18,6 @@ · 17 unmodified lines
1818
1919 #include "pcan_usb_core.h"
2020
21−MODULE_SUPPORTED_DEVICE("PEAK-System PCAN-USB adapter");
22−
2321 /* PCAN-USB Endpoints */
2422 #define PCAN_USB_EP_CMDOUT 1
2523 #define PCAN_USB_EP_CMDIN (PCAN_USB_EP_CMDOUT | USB_DIR_IN)
drivers/net/can/usb/peak_usb/pcan_usb_fd.c+0−3
@@ -16,9 +16,6 @@ · 15 unmodified lines
1616 #include "pcan_usb_core.h"
1717 #include "pcan_usb_pro.h"
1818
19−MODULE_SUPPORTED_DEVICE("PEAK-System PCAN-USB FD adapter");
20−MODULE_SUPPORTED_DEVICE("PEAK-System PCAN-USB Pro FD adapter");
21−
2219 #define PCAN_USBPROFD_CHANNEL_COUNT 2
2320 #define PCAN_USBFD_CHANNEL_COUNT 1
2421
drivers/net/can/usb/peak_usb/pcan_usb_pro.c+0−2
@@ -17,8 +17,6 @@ · 16 unmodified lines
1717 #include "pcan_usb_core.h"
1818 #include "pcan_usb_pro.h"
1919
20−MODULE_SUPPORTED_DEVICE("PEAK-System PCAN-USB Pro adapter");
21−
2220 #define PCAN_USBPRO_CHANNEL_COUNT 2
2321
2422 /* PCAN-USB Pro adapter internal clock (MHz) */
drivers/net/dsa/b53/b53_common.c+7−7
@@ -1108,13 +1108,6 @@ static int b53_setup(struct dsa_switch *ds) · 1107 unmodified lines
11081108 b53_disable_port(ds, port);
11091109 }
11101110
1111− /* Let DSA handle the case were multiple bridges span the same switch
1112− * device and different VLAN awareness settings are requested, which
1113− * would be breaking filtering semantics for any of the other bridge
1114− * devices. (not hardware supported)
1115− */
1116− ds->vlan_filtering_is_global = true;
1117−
11181111 return b53_setup_devlink_resources(ds);
11191112 }
11201113
@@ -2669,6 +2662,13 @@ struct b53_device *b53_switch_alloc(struct device *base, · 1548 unmodified lines
26692662 ds->ops = &b53_switch_ops;
26702663 ds->untag_bridge_pvid = true;
26712664 dev->vlan_enabled = true;
2665+ /* Let DSA handle the case were multiple bridges span the same switch
2666+ * device and different VLAN awareness settings are requested, which
2667+ * would be breaking filtering semantics for any of the other bridge
2668+ * devices. (not hardware supported)
2669+ */
2670+ ds->vlan_filtering_is_global = true;
2671+
26722672 mutex_init(&dev->reg_mutex);
26732673 mutex_init(&dev->stats_mutex);
26742674
drivers/net/dsa/bcm_sf2.c+8−3
@@ -144,7 +144,10 @@ static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port) · 143 unmodified lines
144144 /* Force link status for IMP port */
145145 reg = core_readl(priv, offset);
146146 reg |= (MII_SW_OR | LINK_STS);
147− reg &= ~GMII_SPEED_UP_2G;
147+ if (priv->type == BCM4908_DEVICE_ID)
148+ reg |= GMII_SPEED_UP_2G;
149+ else
150+ reg &= ~GMII_SPEED_UP_2G;
148151 core_writel(priv, reg, offset);
149152
150153 /* Enable Broadcast, Multicast, Unicast forwarding to IMP port */
@@ -661,8 +664,10 @@ static u32 bcm_sf2_sw_get_phy_flags(struct dsa_switch *ds, int port) · 510 unmodified lines
661664 * in bits 15:8 and the patch level in bits 7:0 which is exactly what
662665 * the REG_PHY_REVISION register layout is.
663666 */
664−
665− return priv->hw_params.gphy_rev;
667+ if (priv->int_phy_mask & BIT(port))
668+ return priv->hw_params.gphy_rev;
669+ else
670+ return 0;
666671 }
667672
668673 static void bcm_sf2_sw_validate(struct dsa_switch *ds, int port,
drivers/net/dsa/mt7530.c+25−27
@@ -436,34 +436,32 @@ mt7530_pad_clk_setup(struct dsa_switch *ds, phy_interface_t interface) · 435 unmodified lines
436436 TD_DM_DRVP(8) | TD_DM_DRVN(8));
437437
438438 /* Setup core clock for MT7530 */
439− if (!trgint) {
440− /* Disable MT7530 core clock */
441− core_clear(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN);
442−
443− /* Disable PLL, since phy_device has not yet been created
444− * provided for phy_[read,write]_mmd_indirect is called, we
445− * provide our own core_write_mmd_indirect to complete this
446− * function.
447− */
448− core_write_mmd_indirect(priv,
449− CORE_GSWPLL_GRP1,
450− MDIO_MMD_VEND2,
451− 0);
452−
453− /* Set core clock into 500Mhz */
454− core_write(priv, CORE_GSWPLL_GRP2,
455− RG_GSWPLL_POSDIV_500M(1) |
456− RG_GSWPLL_FBKDIV_500M(25));
439+ /* Disable MT7530 core clock */
440+ core_clear(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN);
457441
458− /* Enable PLL */
459− core_write(priv, CORE_GSWPLL_GRP1,
460− RG_GSWPLL_EN_PRE |
461− RG_GSWPLL_POSDIV_200M(2) |
462− RG_GSWPLL_FBKDIV_200M(32));
463−
464− /* Enable MT7530 core clock */
465− core_set(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN);
466− }
442+ /* Disable PLL, since phy_device has not yet been created
443+ * provided for phy_[read,write]_mmd_indirect is called, we
444+ * provide our own core_write_mmd_indirect to complete this
445+ * function.
446+ */
447+ core_write_mmd_indirect(priv,
448+ CORE_GSWPLL_GRP1,
449+ MDIO_MMD_VEND2,
450+ 0);
451+
452+ /* Set core clock into 500Mhz */
453+ core_write(priv, CORE_GSWPLL_GRP2,
454+ RG_GSWPLL_POSDIV_500M(1) |
455+ RG_GSWPLL_FBKDIV_500M(25));
456+
457+ /* Enable PLL */
458+ core_write(priv, CORE_GSWPLL_GRP1,
459+ RG_GSWPLL_EN_PRE |
460+ RG_GSWPLL_POSDIV_200M(2) |
461+ RG_GSWPLL_FBKDIV_200M(32));
462+
463+ /* Enable MT7530 core clock */
464+ core_set(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN);
467465
468466 /* Setup the MT7530 TRGMII Tx Clock */
469467 core_set(priv, CORE_TRGMII_GSW_CLK_CG, REG_GSWCK_EN);
drivers/net/ethernet/broadcom/Kconfig+1−1
@@ -54,7 +54,7 @@ config B44_PCI · 53 unmodified lines
5454 config BCM4908_ENET
5555 tristate "Broadcom BCM4908 internal mac support"
5656 depends on ARCH_BCM4908 || COMPILE_TEST
57− default y
57+ default y if ARCH_BCM4908
5858 help
5959 This driver supports Ethernet controller integrated into Broadcom
6060 BCM4908 family SoCs.
drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c+1−1
@@ -722,7 +722,7 @@ static int chcr_ktls_cpl_set_tcb_rpl(struct adapter *adap, unsigned char *input) · 721 unmodified lines
722722 kvfree(tx_info);
723723 return 0;
724724 }
725− tx_info->open_state = false;
725+ tx_info->open_state = CH_KTLS_OPEN_SUCCESS;
726726 spin_unlock(&tx_info->lock);
727727
728728 complete(&tx_info->completion);
drivers/net/ethernet/faraday/ftgmac100.c+1−0
@@ -1337,6 +1337,7 @@ static int ftgmac100_poll(struct napi_struct *napi, int budget) · 1336 unmodified lines
13371337 */
13381338 if (unlikely(priv->need_mac_restart)) {
13391339 ftgmac100_start_hw(priv);
1340+ priv->need_mac_restart = false;
13401341
13411342 /* Re-enable "bad" interrupts */
13421343 iowrite32(FTGMAC100_INT_BAD,
drivers/net/ethernet/intel/e1000e/82571.c+2−0
@@ -899,6 +899,8 @@ static s32 e1000_set_d0_lplu_state_82571(struct e1000_hw *hw, bool active) · 898 unmodified lines
899899 } else {
900900 data &= ~IGP02E1000_PM_D0_LPLU;
901901 ret_val = e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, data);
902+ if (ret_val)
903+ return ret_val;
902904 /* LPLU and SmartSpeed are mutually exclusive. LPLU is used
903905 * during Dx states where the power conservation is most
904906 * important. During driver activity we should enable
drivers/net/ethernet/intel/e1000e/hw.h+3−3
@@ -1,8 +1,8 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
22 /* Copyright(c) 1999 - 2018 Intel Corporation. */
33
4−#ifndef _E1000_HW_H_
5−#define _E1000_HW_H_
4+#ifndef _E1000E_HW_H_
5+#define _E1000E_HW_H_
66
77 #include "regs.h"
88 #include "defines.h"
@@ -714,4 +714,4 @@ struct e1000_hw { · 705 unmodified lines
714714 #include "80003es2lan.h"
715715 #include "ich8lan.h"
716716
717−#endif
717+#endif /* _E1000E_HW_H_ */
drivers/net/ethernet/intel/e1000e/netdev.c+5−1
@@ -5975,15 +5975,19 @@ static void e1000_reset_task(struct work_struct *work) · 5974 unmodified lines
59755975 struct e1000_adapter *adapter;
59765976 adapter = container_of(work, struct e1000_adapter, reset_task);
59775977
5978+ rtnl_lock();
59785979 /* don't run the task if already down */
5979− if (test_bit(__E1000_DOWN, &adapter->state))
5980+ if (test_bit(__E1000_DOWN, &adapter->state)) {
5981+ rtnl_unlock();
59805982 return;
5983+ }
59815984
59825985 if (!(adapter->flags & FLAG_RESTART_NOW)) {
59835986 e1000e_dump(adapter);
59845987 e_err("Reset adapter unexpectedly\n");
59855988 }
59865989 e1000e_reinit_locked(adapter);
5990+ rtnl_unlock();
59875991 }
59885992
59895993 /**
drivers/net/ethernet/intel/i40e/i40e_main.c+13−0
@@ -3258,6 +3258,17 @@ static int i40e_configure_tx_ring(struct i40e_ring *ring) · 3257 unmodified lines
32583258 return 0;
32593259 }
32603260
3261+/**
3262+ * i40e_rx_offset - Return expected offset into page to access data
3263+ * @rx_ring: Ring we are requesting offset of
3264+ *
3265+ * Returns the offset value for ring into the data buffer.
3266+ */
3267+static unsigned int i40e_rx_offset(struct i40e_ring *rx_ring)
3268+{
3269+ return ring_uses_build_skb(rx_ring) ? I40E_SKB_PAD : 0;
3270+}
3271+
32613272 /**
32623273 * i40e_configure_rx_ring - Configure a receive ring context
32633274 * @ring: The Rx ring to configure
@@ -3369,6 +3380,8 @@ static int i40e_configure_rx_ring(struct i40e_ring *ring) · 105 unmodified lines
33693380 else
33703381 set_ring_build_skb_enabled(ring);
33713382
3383+ ring->rx_offset = i40e_rx_offset(ring);
3384+
33723385 /* cache tail for quicker writes, and clear the reg before use */
33733386 ring->tail = hw->hw_addr + I40E_QRX_TAIL(pf_q);
33743387 writel(0, ring->tail);
drivers/net/ethernet/intel/i40e/i40e_txrx.c+0−12
@@ -1569,17 +1569,6 @@ void i40e_free_rx_resources(struct i40e_ring *rx_ring) · 1568 unmodified lines
15691569 }
15701570 }
15711571
1572−/**
1573− * i40e_rx_offset - Return expected offset into page to access data
1574− * @rx_ring: Ring we are requesting offset of
1575− *
1576− * Returns the offset value for ring into the data buffer.
1577− */
1578−static unsigned int i40e_rx_offset(struct i40e_ring *rx_ring)
1579−{
1580− return ring_uses_build_skb(rx_ring) ? I40E_SKB_PAD : 0;
1581−}
1582−
15831572 /**
15841573 * i40e_setup_rx_descriptors - Allocate Rx descriptors
15851574 * @rx_ring: Rx descriptor ring (for a specific queue) to setup
@@ -1608,7 +1597,6 @@ int i40e_setup_rx_descriptors(struct i40e_ring *rx_ring) · 22 unmodified lines
16081597 rx_ring->next_to_alloc = 0;
16091598 rx_ring->next_to_clean = 0;
16101599 rx_ring->next_to_use = 0;
1611− rx_ring->rx_offset = i40e_rx_offset(rx_ring);
16121600
16131601 /* XDP RX-queue info only needed for RX rings exposed to XDP */
16141602 if (rx_ring->vsi->type == I40E_VSI_MAIN) {
drivers/net/ethernet/intel/ice/ice_base.c+22−2
@@ -274,6 +274,22 @@ ice_setup_tx_ctx(struct ice_ring *ring, struct ice_tlan_ctx *tlan_ctx, u16 pf_q) · 273 unmodified lines
274274 tlan_ctx->legacy_int = ICE_TX_LEGACY;
275275 }
276276
277+/**
278+ * ice_rx_offset - Return expected offset into page to access data
279+ * @rx_ring: Ring we are requesting offset of
280+ *
281+ * Returns the offset value for ring into the data buffer.
282+ */
283+static unsigned int ice_rx_offset(struct ice_ring *rx_ring)
284+{
285+ if (ice_ring_uses_build_skb(rx_ring))
286+ return ICE_SKB_PAD;
287+ else if (ice_is_xdp_ena_vsi(rx_ring->vsi))
288+ return XDP_PACKET_HEADROOM;
289+
290+ return 0;
291+}
292+
277293 /**
278294 * ice_setup_rx_ctx - Configure a receive ring context
279295 * @ring: The Rx ring to configure
@@ -413,11 +429,15 @@ int ice_setup_rx_ctx(struct ice_ring *ring) · 133 unmodified lines
413429 else
414430 ice_set_ring_build_skb_ena(ring);
415431
432+ ring->rx_offset = ice_rx_offset(ring);
433+
416434 /* init queue specific tail register */
417435 ring->tail = hw->hw_addr + QRX_TAIL(pf_q);
418436 writel(0, ring->tail);
419437
420438 if (ring->xsk_pool) {
439+ bool ok;
440+
421441 if (!xsk_buff_can_alloc(ring->xsk_pool, num_bufs)) {
422442 dev_warn(dev, "XSK buffer pool does not provide enough addresses to fill %d buffers on Rx ring %d\n",
423443 num_bufs, ring->q_index);
@@ -426,8 +446,8 @@ int ice_setup_rx_ctx(struct ice_ring *ring) · 2 unmodified lines
426446 return 0;
427447 }
428448
429− err = ice_alloc_rx_bufs_zc(ring, num_bufs);
430− if (err)
449+ ok = ice_alloc_rx_bufs_zc(ring, num_bufs);
450+ if (!ok)
431451 dev_info(dev, "Failed to allocate some buffers on XSK buffer pool enabled Rx ring %d (pf_q %d)\n",
432452 ring->q_index, pf_q);
433453 return 0;
drivers/net/ethernet/intel/ice/ice_txrx.c+0−17
@@ -443,22 +443,6 @@ void ice_free_rx_ring(struct ice_ring *rx_ring) · 442 unmodified lines
443443 }
444444 }
445445
446−/**
447− * ice_rx_offset - Return expected offset into page to access data
448− * @rx_ring: Ring we are requesting offset of
449− *
450− * Returns the offset value for ring into the data buffer.
451− */
452−static unsigned int ice_rx_offset(struct ice_ring *rx_ring)
453−{
454− if (ice_ring_uses_build_skb(rx_ring))
455− return ICE_SKB_PAD;
456− else if (ice_is_xdp_ena_vsi(rx_ring->vsi))
457− return XDP_PACKET_HEADROOM;
458−
459− return 0;
460−}
461−
462446 /**
463447 * ice_setup_rx_ring - Allocate the Rx descriptors
464448 * @rx_ring: the Rx ring to set up
@@ -493,7 +477,6 @@ int ice_setup_rx_ring(struct ice_ring *rx_ring) · 28 unmodified lines
493477
494478 rx_ring->next_to_use = 0;
495479 rx_ring->next_to_clean = 0;
496− rx_ring->rx_offset = ice_rx_offset(rx_ring);
497480
498481 if (ice_is_xdp_ena_vsi(rx_ring->vsi))
499482 WRITE_ONCE(rx_ring->xdp_prog, rx_ring->vsi->xdp_prog);
drivers/net/ethernet/intel/ice/ice_xsk.c+5−5
@@ -358,18 +358,18 @@ xsk_pool_if_up: · 357 unmodified lines
358358 * This function allocates a number of Rx buffers from the fill ring
359359 * or the internal recycle mechanism and places them on the Rx ring.
360360 *
361− * Returns false if all allocations were successful, true if any fail.
361+ * Returns true if all allocations were successful, false if any fail.
362362 */
363363 bool ice_alloc_rx_bufs_zc(struct ice_ring *rx_ring, u16 count)
364364 {
365365 union ice_32b_rx_flex_desc *rx_desc;
366366 u16 ntu = rx_ring->next_to_use;
367367 struct ice_rx_buf *rx_buf;
368− bool ret = false;
368+ bool ok = true;
369369 dma_addr_t dma;
370370
371371 if (!count)
372− return false;
372+ return true;
373373
374374 rx_desc = ICE_RX_DESC(rx_ring, ntu);
375375 rx_buf = &rx_ring->rx_buf[ntu];
@@ -377,7 +377,7 @@ bool ice_alloc_rx_bufs_zc(struct ice_ring *rx_ring, u16 count) · 1 unmodified line
377377 do {
378378 rx_buf->xdp = xsk_buff_alloc(rx_ring->xsk_pool);
379379 if (!rx_buf->xdp) {
380− ret = true;
380+ ok = false;
381381 break;
382382 }
383383
@@ -402,7 +402,7 @@ bool ice_alloc_rx_bufs_zc(struct ice_ring *rx_ring, u16 count) · 18 unmodified lines
402402 ice_release_rx_desc(rx_ring, ntu);
403403 }
404404
405− return ret;
405+ return ok;
406406 }
407407
408408 /**
drivers/net/ethernet/intel/igb/e1000_hw.h+3−3
@@ -1,8 +1,8 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
22 /* Copyright(c) 2007 - 2018 Intel Corporation. */
33
4−#ifndef _E1000_HW_H_
5−#define _E1000_HW_H_
4+#ifndef _E1000_IGB_HW_H_
5+#define _E1000_IGB_HW_H_
66
77 #include <linux/types.h>
88 #include <linux/delay.h>
@@ -551,4 +551,4 @@ s32 igb_write_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value); · 542 unmodified lines
551551
552552 void igb_read_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value);
553553 void igb_write_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value);
554−#endif /* _E1000_HW_H_ */
554+#endif /* _E1000_IGB_HW_H_ */
drivers/net/ethernet/intel/igb/igb.h+2−2
@@ -748,8 +748,8 @@ void igb_ptp_suspend(struct igb_adapter *adapter); · 747 unmodified lines
748748 void igb_ptp_rx_hang(struct igb_adapter *adapter);
749749 void igb_ptp_tx_hang(struct igb_adapter *adapter);
750750 void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector, struct sk_buff *skb);
751−void igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, void *va,
752− struct sk_buff *skb);
751+int igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, void *va,
752+ struct sk_buff *skb);
753753 int igb_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr);
754754 int igb_ptp_get_ts_config(struct net_device *netdev, struct ifreq *ifr);
755755 void igb_set_flag_queue_pairs(struct igb_adapter *, const u32);
drivers/net/ethernet/intel/igb/igb_main.c+21−12
@@ -8214,7 +8214,8 @@ static void igb_reuse_rx_page(struct igb_ring *rx_ring, · 8213 unmodified lines
82148214 new_buff->pagecnt_bias = old_buff->pagecnt_bias;
82158215 }
82168216
8217−static bool igb_can_reuse_rx_page(struct igb_rx_buffer *rx_buffer)
8217+static bool igb_can_reuse_rx_page(struct igb_rx_buffer *rx_buffer,
8218+ int rx_buf_pgcnt)
82188219 {
82198220 unsigned int pagecnt_bias = rx_buffer->pagecnt_bias;
82208221 struct page *page = rx_buffer->page;
@@ -8225,7 +8226,7 @@ static bool igb_can_reuse_rx_page(struct igb_rx_buffer *rx_buffer) · 4 unmodified lines
82258226
82268227 #if (PAGE_SIZE < 8192)
82278228 /* if we are only owner of page we can reuse it */
8228− if (unlikely((page_ref_count(page) - pagecnt_bias) > 1))
8229+ if (unlikely((rx_buf_pgcnt - pagecnt_bias) > 1))
82298230 return false;
82308231 #else
82318232 #define IGB_LAST_OFFSET \
@@ -8301,9 +8302,10 @@ static struct sk_buff *igb_construct_skb(struct igb_ring *rx_ring, · 69 unmodified lines
83018302 return NULL;
83028303
83038304 if (unlikely(igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP))) {
8304− igb_ptp_rx_pktstamp(rx_ring->q_vector, xdp->data, skb);
8305− xdp->data += IGB_TS_HDR_LEN;
8306− size -= IGB_TS_HDR_LEN;
8305+ if (!igb_ptp_rx_pktstamp(rx_ring->q_vector, xdp->data, skb)) {
8306+ xdp->data += IGB_TS_HDR_LEN;
8307+ size -= IGB_TS_HDR_LEN;
8308+ }
83078309 }
83088310
83098311 /* Determine available headroom for copy */
@@ -8364,8 +8366,8 @@ static struct sk_buff *igb_build_skb(struct igb_ring *rx_ring, · 54 unmodified lines
83648366
83658367 /* pull timestamp out of packet data */
83668368 if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) {
8367− igb_ptp_rx_pktstamp(rx_ring->q_vector, skb->data, skb);
8368− __skb_pull(skb, IGB_TS_HDR_LEN);
8369+ if (!igb_ptp_rx_pktstamp(rx_ring->q_vector, skb->data, skb))
8370+ __skb_pull(skb, IGB_TS_HDR_LEN);
83698371 }
83708372
83718373 /* update buffer offset */
@@ -8614,11 +8616,17 @@ static unsigned int igb_rx_offset(struct igb_ring *rx_ring) · 242 unmodified lines
86148616 }
86158617
86168618 static struct igb_rx_buffer *igb_get_rx_buffer(struct igb_ring *rx_ring,
8617− const unsigned int size)
8619+ const unsigned int size, int *rx_buf_pgcnt)
86188620 {
86198621 struct igb_rx_buffer *rx_buffer;
86208622
86218623 rx_buffer = &rx_ring->rx_buffer_info[rx_ring->next_to_clean];
8624+ *rx_buf_pgcnt =
8625+#if (PAGE_SIZE < 8192)
8626+ page_count(rx_buffer->page);
8627+#else
8628+ 0;
8629+#endif
86228630 prefetchw(rx_buffer->page);
86238631
86248632 /* we are reusing so sync this buffer for CPU use */
@@ -8634,9 +8642,9 @@ static struct igb_rx_buffer *igb_get_rx_buffer(struct igb_ring *rx_ring, · 9 unmodified lines
86348642 }
86358643
86368644 static void igb_put_rx_buffer(struct igb_ring *rx_ring,
8637− struct igb_rx_buffer *rx_buffer)
8645+ struct igb_rx_buffer *rx_buffer, int rx_buf_pgcnt)
86388646 {
8639− if (igb_can_reuse_rx_page(rx_buffer)) {
8647+ if (igb_can_reuse_rx_page(rx_buffer, rx_buf_pgcnt)) {
86408648 /* hand second half of page back to the ring */
86418649 igb_reuse_rx_page(rx_ring, rx_buffer);
86428650 } else {
@@ -8664,6 +8672,7 @@ static int igb_clean_rx_irq(struct igb_q_vector *q_vector, const int budget) · 21 unmodified lines
86648672 unsigned int xdp_xmit = 0;
86658673 struct xdp_buff xdp;
86668674 u32 frame_sz = 0;
8675+ int rx_buf_pgcnt;
86678676
86688677 /* Frame size depend on rx_ring setup when PAGE_SIZE=4K */
86698678 #if (PAGE_SIZE < 8192)
@@ -8693,7 +8702,7 @@ static int igb_clean_rx_irq(struct igb_q_vector *q_vector, const int budget) · 23 unmodified lines
86938702 */
86948703 dma_rmb();
86958704
8696− rx_buffer = igb_get_rx_buffer(rx_ring, size);
8705+ rx_buffer = igb_get_rx_buffer(rx_ring, size, &rx_buf_pgcnt);
86978706
86988707 /* retrieve a buffer from the ring */
86998708 if (!skb) {
@@ -8736,7 +8745,7 @@ static int igb_clean_rx_irq(struct igb_q_vector *q_vector, const int budget) · 36 unmodified lines
87368745 break;
87378746 }
87388747
8739− igb_put_rx_buffer(rx_ring, rx_buffer);
8748+ igb_put_rx_buffer(rx_ring, rx_buffer, rx_buf_pgcnt);
87408749 cleaned_count++;
87418750
87428751 /* fetch next buffer in frame if non-eop */
drivers/net/ethernet/intel/igb/igb_ptp.c+24−7
@@ -856,6 +856,9 @@ static void igb_ptp_tx_hwtstamp(struct igb_adapter *adapter) · 855 unmodified lines
856856 dev_kfree_skb_any(skb);
857857 }
858858
859+#define IGB_RET_PTP_DISABLED 1
860+#define IGB_RET_PTP_INVALID 2
861+
859862 /**
860863 * igb_ptp_rx_pktstamp - retrieve Rx per packet timestamp
861864 * @q_vector: Pointer to interrupt specific structure
@@ -864,19 +867,29 @@ static void igb_ptp_tx_hwtstamp(struct igb_adapter *adapter) · 2 unmodified lines
864867 *
865868 * This function is meant to retrieve a timestamp from the first buffer of an
866869 * incoming frame. The value is stored in little endian format starting on
867− * byte 8.
870+ * byte 8
871+ *
872+ * Returns: 0 if success, nonzero if failure
868873 **/
869−void igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, void *va,
870− struct sk_buff *skb)
874+int igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, void *va,
875+ struct sk_buff *skb)
871876 {
872− __le64 *regval = (__le64 *)va;
873877 struct igb_adapter *adapter = q_vector->adapter;
878+ __le64 *regval = (__le64 *)va;
874879 int adjust = 0;
875880
881+ if (!(adapter->ptp_flags & IGB_PTP_ENABLED))
882+ return IGB_RET_PTP_DISABLED;
883+
876884 /* The timestamp is recorded in little endian format.
877885 * DWORD: 0 1 2 3
878886 * Field: Reserved Reserved SYSTIML SYSTIMH
879887 */
888+
889+ /* check reserved dwords are zero, be/le doesn't matter for zero */
890+ if (regval[0])
891+ return IGB_RET_PTP_INVALID;
892+
880893 igb_ptp_systim_to_hwtstamp(adapter, skb_hwtstamps(skb),
881894 le64_to_cpu(regval[1]));
882895
@@ -896,6 +909,8 @@ void igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, void *va, · 13 unmodified lines
896909 }
897910 skb_hwtstamps(skb)->hwtstamp =
898911 ktime_sub_ns(skb_hwtstamps(skb)->hwtstamp, adjust);
912+
913+ return 0;
899914 }
900915
901916 /**
@@ -906,13 +921,15 @@ void igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, void *va, · 4 unmodified lines
906921 * This function is meant to retrieve a timestamp from the internal registers
907922 * of the adapter and store it in the skb.
908923 **/
909−void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector,
910− struct sk_buff *skb)
924+void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector, struct sk_buff *skb)
911925 {
912926 struct igb_adapter *adapter = q_vector->adapter;
913927 struct e1000_hw *hw = &adapter->hw;
914− u64 regval;
915928 int adjust = 0;
929+ u64 regval;
930+
931+ if (!(adapter->ptp_flags & IGB_PTP_ENABLED))
932+ return;
916933
917934 /* If this bit is set, then the RX registers contain the time stamp. No
918935 * other packet will be time stamped until we read these registers, so
drivers/net/ethernet/intel/igc/igc.h+1−1
@@ -547,7 +547,7 @@ void igc_ptp_init(struct igc_adapter *adapter); · 546 unmodified lines
547547 void igc_ptp_reset(struct igc_adapter *adapter);
548548 void igc_ptp_suspend(struct igc_adapter *adapter);
549549 void igc_ptp_stop(struct igc_adapter *adapter);
550−void igc_ptp_rx_pktstamp(struct igc_q_vector *q_vector, void *va,
550+void igc_ptp_rx_pktstamp(struct igc_q_vector *q_vector, __le32 *va,
551551 struct sk_buff *skb);
552552 int igc_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr);
553553 int igc_ptp_get_ts_config(struct net_device *netdev, struct ifreq *ifr);
drivers/net/ethernet/intel/igc/igc_ethtool.c+4−3
@@ -1711,6 +1711,9 @@ static int igc_ethtool_get_link_ksettings(struct net_device *netdev, · 1710 unmodified lines
17111711 Autoneg);
17121712 }
17131713
1714+ /* Set pause flow control settings */
1715+ ethtool_link_ksettings_add_link_mode(cmd, supported, Pause);
1716+
17141717 switch (hw->fc.requested_mode) {
17151718 case igc_fc_full:
17161719 ethtool_link_ksettings_add_link_mode(cmd, advertising, Pause);
@@ -1725,9 +1728,7 @@ static int igc_ethtool_get_link_ksettings(struct net_device *netdev, · 8 unmodified lines
17251728 Asym_Pause);
17261729 break;
17271730 default:
1728− ethtool_link_ksettings_add_link_mode(cmd, advertising, Pause);
1729− ethtool_link_ksettings_add_link_mode(cmd, advertising,
1730− Asym_Pause);
1731+ break;
17311732 }
17321733
17331734 status = pm_runtime_suspended(&adapter->pdev->dev) ?
drivers/net/ethernet/intel/igc/igc_main.c+9−0
@@ -3831,10 +3831,19 @@ static void igc_reset_task(struct work_struct *work) · 3830 unmodified lines
38313831
38323832 adapter = container_of(work, struct igc_adapter, reset_task);
38333833
3834+ rtnl_lock();
3835+ /* If we're already down or resetting, just bail */
3836+ if (test_bit(__IGC_DOWN, &adapter->state) ||
3837+ test_bit(__IGC_RESETTING, &adapter->state)) {
3838+ rtnl_unlock();
3839+ return;
3840+ }
3841+
38343842 igc_rings_dump(adapter);
38353843 igc_regs_dump(adapter);
38363844 netdev_err(adapter->netdev, "Reset adapter\n");
38373845 igc_reinit_locked(adapter);
3846+ rtnl_unlock();
38383847 }
38393848
38403849 /**
drivers/net/ethernet/intel/igc/igc_ptp.c+40−32
@@ -152,46 +152,54 @@ static void igc_ptp_systim_to_hwtstamp(struct igc_adapter *adapter, · 151 unmodified lines
152152 }
153153
154154 /**
155− * igc_ptp_rx_pktstamp - retrieve Rx per packet timestamp
155+ * igc_ptp_rx_pktstamp - Retrieve timestamp from Rx packet buffer
156156 * @q_vector: Pointer to interrupt specific structure
157157 * @va: Pointer to address containing Rx buffer
158158 * @skb: Buffer containing timestamp and packet
159159 *
160− * This function is meant to retrieve the first timestamp from the
161− * first buffer of an incoming frame. The value is stored in little
162− * endian format starting on byte 0. There's a second timestamp
163− * starting on byte 8.
164− **/
165−void igc_ptp_rx_pktstamp(struct igc_q_vector *q_vector, void *va,
160+ * This function retrieves the timestamp saved in the beginning of packet
161+ * buffer. While two timestamps are available, one in timer0 reference and the
162+ * other in timer1 reference, this function considers only the timestamp in
163+ * timer0 reference.
164+ */
165+void igc_ptp_rx_pktstamp(struct igc_q_vector *q_vector, __le32 *va,
166166 struct sk_buff *skb)
167167 {
168168 struct igc_adapter *adapter = q_vector->adapter;
169− __le64 *regval = (__le64 *)va;
170− int adjust = 0;
171−
172− /* The timestamp is recorded in little endian format.
173− * DWORD: | 0 | 1 | 2 | 3
174− * Field: | Timer0 Low | Timer0 High | Timer1 Low | Timer1 High
169+ u64 regval;
170+ int adjust;
171+
172+ /* Timestamps are saved in little endian at the beginning of the packet
173+ * buffer following the layout:
174+ *
175+ * DWORD: | 0 | 1 | 2 | 3 |
176+ * Field: | Timer1 SYSTIML | Timer1 SYSTIMH | Timer0 SYSTIML | Timer0 SYSTIMH |
177+ *
178+ * SYSTIML holds the nanoseconds part while SYSTIMH holds the seconds
179+ * part of the timestamp.
175180 */
176− igc_ptp_systim_to_hwtstamp(adapter, skb_hwtstamps(skb),
177− le64_to_cpu(regval[0]));
178−
179− /* adjust timestamp for the RX latency based on link speed */
180− if (adapter->hw.mac.type == igc_i225) {
181− switch (adapter->link_speed) {
182− case SPEED_10:
183− adjust = IGC_I225_RX_LATENCY_10;
184− break;
185− case SPEED_100:
186− adjust = IGC_I225_RX_LATENCY_100;
187− break;
188− case SPEED_1000:
189− adjust = IGC_I225_RX_LATENCY_1000;
190− break;
191− case SPEED_2500:
192− adjust = IGC_I225_RX_LATENCY_2500;
193− break;
194− }
181+ regval = le32_to_cpu(va[2]);
182+ regval |= (u64)le32_to_cpu(va[3]) << 32;
183+ igc_ptp_systim_to_hwtstamp(adapter, skb_hwtstamps(skb), regval);
184+
185+ /* Adjust timestamp for the RX latency based on link speed */
186+ switch (adapter->link_speed) {
187+ case SPEED_10:
188+ adjust = IGC_I225_RX_LATENCY_10;
189+ break;
190+ case SPEED_100:
191+ adjust = IGC_I225_RX_LATENCY_100;
192+ break;
193+ case SPEED_1000:
194+ adjust = IGC_I225_RX_LATENCY_1000;
195+ break;
196+ case SPEED_2500:
197+ adjust = IGC_I225_RX_LATENCY_2500;
198+ break;
199+ default:
200+ adjust = 0;
201+ netdev_warn_once(adapter->netdev, "Imprecise timestamp\n");
202+ break;
195203 }
196204 skb_hwtstamps(skb)->hwtstamp =
197205 ktime_sub_ns(skb_hwtstamps(skb)->hwtstamp, adjust);
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c+2−1
@@ -4118,6 +4118,8 @@ void ixgbe_configure_rx_ring(struct ixgbe_adapter *adapter, · 4117 unmodified lines
41184118 #endif
41194119 }
41204120
4121+ ring->rx_offset = ixgbe_rx_offset(ring);
4122+
41214123 if (ring->xsk_pool && hw->mac.type != ixgbe_mac_82599EB) {
41224124 u32 xsk_buf_len = xsk_pool_get_rx_frame_size(ring->xsk_pool);
41234125
@@ -6578,7 +6580,6 @@ int ixgbe_setup_rx_resources(struct ixgbe_adapter *adapter, · 2454 unmodified lines
65786580
65796581 rx_ring->next_to_clean = 0;
65806582 rx_ring->next_to_use = 0;
6581− rx_ring->rx_offset = ixgbe_rx_offset(rx_ring);
65826583
65836584 /* XDP RX-queue info */
65846585 if (xdp_rxq_info_reg(&rx_ring->xdp_rxq, adapter->netdev,
drivers/net/ethernet/marvell/Kconfig+2−2
@@ -6,7 +6,7 @@ · 5 unmodified lines
66 config NET_VENDOR_MARVELL
77 bool "Marvell devices"
88 default y
9− depends on PCI || CPU_PXA168 || MV64X60 || PPC32 || PLAT_ORION || INET || COMPILE_TEST
9+ depends on PCI || CPU_PXA168 || PPC32 || PLAT_ORION || INET || COMPILE_TEST
1010 help
1111 If you have a network (Ethernet) card belonging to this class, say Y.
1212
@@ -19,7 +19,7 @@ if NET_VENDOR_MARVELL · 6 unmodified lines
1919
2020 config MV643XX_ETH
2121 tristate "Marvell Discovery (643XX) and Orion ethernet support"
22− depends on MV64X60 || PPC32 || PLAT_ORION || COMPILE_TEST
22+ depends on PPC32 || PLAT_ORION || COMPILE_TEST
2323 depends on INET
2424 select PHYLIB
2525 select MVMDIO
drivers/net/ethernet/marvell/mv643xx_eth.c+1−1
@@ -2684,7 +2684,7 @@ static const struct of_device_id mv643xx_eth_shared_ids[] = { · 2683 unmodified lines
26842684 MODULE_DEVICE_TABLE(of, mv643xx_eth_shared_ids);
26852685 #endif
26862686
2687−#if defined(CONFIG_OF_IRQ) && !defined(CONFIG_MV64X60)
2687+#ifdef CONFIG_OF_IRQ
26882688 #define mv643xx_eth_property(_np, _name, _v) \
26892689 do { \
26902690 u32 tmp; \
drivers/net/ethernet/marvell/octeontx2/af/npc_profile.h+0−2
@@ -13499,8 +13499,6 @@ static struct npc_mcam_kex npc_mkex_default = { · 13498 unmodified lines
1349913499 [NPC_LT_LC_IP] = {
1350013500 /* SIP+DIP: 8 bytes, KW2[63:0] */
1350113501 KEX_LD_CFG(0x07, 0xc, 0x1, 0x0, 0x10),
13502− /* TOS: 1 byte, KW1[63:56] */
13503− KEX_LD_CFG(0x0, 0x1, 0x1, 0x0, 0xf),
1350413502 },
1350513503 /* Layer C: IPv6 */
1350613504 [NPC_LT_LC_IP6] = {
drivers/net/ethernet/marvell/octeontx2/af/rvu.c+4−2
@@ -2462,8 +2462,10 @@ static void rvu_unregister_interrupts(struct rvu *rvu) · 2461 unmodified lines
24622462 INTR_MASK(rvu->hw->total_pfs) & ~1ULL);
24632463
24642464 for (irq = 0; irq < rvu->num_vec; irq++) {
2465− if (rvu->irq_allocated[irq])
2465+ if (rvu->irq_allocated[irq]) {
24662466 free_irq(pci_irq_vector(rvu->pdev, irq), rvu);
2467+ rvu->irq_allocated[irq] = false;
2468+ }
24672469 }
24682470
24692471 pci_free_irq_vectors(rvu->pdev);
@@ -2975,8 +2977,8 @@ static void rvu_remove(struct pci_dev *pdev) · 505 unmodified lines
29752977 struct rvu *rvu = pci_get_drvdata(pdev);
29762978
29772979 rvu_dbg_exit(rvu);
2978− rvu_unregister_interrupts(rvu);
29792980 rvu_unregister_dl(rvu);
2981+ rvu_unregister_interrupts(rvu);
29802982 rvu_flr_wq_destroy(rvu);
29812983 rvu_cgx_exit(rvu);
29822984 rvu_fwdata_exit(rvu);
drivers/net/ethernet/marvell/octeontx2/af/rvu.h+1−0
@@ -682,6 +682,7 @@ void npc_read_mcam_entry(struct rvu *rvu, struct npc_mcam *mcam, · 681 unmodified lines
682682 u8 *intf, u8 *ena);
683683 bool is_mac_feature_supported(struct rvu *rvu, int pf, int feature);
684684 u32 rvu_cgx_get_fifolen(struct rvu *rvu);
685+void *rvu_first_cgx_pdata(struct rvu *rvu);
685686
686687 int npc_get_nixlf_mcam_index(struct npc_mcam *mcam, u16 pcifunc, int nixlf,
687688 int type);
drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c+16−2
@@ -89,6 +89,21 @@ void *rvu_cgx_pdata(u8 cgx_id, struct rvu *rvu) · 88 unmodified lines
8989 return rvu->cgx_idmap[cgx_id];
9090 }
9191
92+/* Return first enabled CGX instance if none are enabled then return NULL */
93+void *rvu_first_cgx_pdata(struct rvu *rvu)
94+{
95+ int first_enabled_cgx = 0;
96+ void *cgxd = NULL;
97+
98+ for (; first_enabled_cgx < rvu->cgx_cnt_max; first_enabled_cgx++) {
99+ cgxd = rvu_cgx_pdata(first_enabled_cgx, rvu);
100+ if (cgxd)
101+ break;
102+ }
103+
104+ return cgxd;
105+}
106+
92107 /* Based on P2X connectivity find mapped NIX block for a PF */
93108 static void rvu_map_cgx_nix_block(struct rvu *rvu, int pf,
94109 int cgx_id, int lmac_id)
@@ -711,10 +726,9 @@ int rvu_mbox_handler_cgx_features_get(struct rvu *rvu, · 616 unmodified lines
711726 u32 rvu_cgx_get_fifolen(struct rvu *rvu)
712727 {
713728 struct mac_ops *mac_ops;
714− int rvu_def_cgx_id = 0;
715729 u32 fifo_len;
716730
717− mac_ops = get_mac_ops(rvu_cgx_pdata(rvu_def_cgx_id, rvu));
731+ mac_ops = get_mac_ops(rvu_first_cgx_pdata(rvu));
718732 fifo_len = mac_ops ? mac_ops->fifo_len : 0;
719733
720734 return fifo_len;
drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c+36−21
@@ -234,12 +234,14 @@ static ssize_t rvu_dbg_rsrc_attach_status(struct file *filp, · 233 unmodified lines
234234 char __user *buffer,
235235 size_t count, loff_t *ppos)
236236 {
237− int index, off = 0, flag = 0, go_back = 0, off_prev;
237+ int index, off = 0, flag = 0, go_back = 0, len = 0;
238238 struct rvu *rvu = filp->private_data;
239239 int lf, pf, vf, pcifunc;
240240 struct rvu_block block;
241241 int bytes_not_copied;
242+ int lf_str_size = 12;
242243 int buf_size = 2048;
244+ char *lfs;
243245 char *buf;
244246
245247 /* don't allow partial reads */
@@ -249,12 +251,20 @@ static ssize_t rvu_dbg_rsrc_attach_status(struct file *filp, · 3 unmodified lines
249251 buf = kzalloc(buf_size, GFP_KERNEL);
250252 if (!buf)
251253 return -ENOSPC;
252− off += scnprintf(&buf[off], buf_size - 1 - off, "\npcifunc\t\t");
254+
255+ lfs = kzalloc(lf_str_size, GFP_KERNEL);
256+ if (!lfs) {
257+ kfree(buf);
258+ return -ENOMEM;
259+ }
260+ off += scnprintf(&buf[off], buf_size - 1 - off, "%-*s", lf_str_size,
261+ "pcifunc");
253262 for (index = 0; index < BLK_COUNT; index++)
254− if (strlen(rvu->hw->block[index].name))
255− off += scnprintf(&buf[off], buf_size - 1 - off,
256− "%*s\t", (index - 1) * 2,
257− rvu->hw->block[index].name);
263+ if (strlen(rvu->hw->block[index].name)) {
264+ off += scnprintf(&buf[off], buf_size - 1 - off,
265+ "%-*s", lf_str_size,
266+ rvu->hw->block[index].name);
267+ }
258268 off += scnprintf(&buf[off], buf_size - 1 - off, "\n");
259269 for (pf = 0; pf < rvu->hw->total_pfs; pf++) {
260270 for (vf = 0; vf <= rvu->hw->total_vfs; vf++) {
@@ -263,14 +273,15 @@ static ssize_t rvu_dbg_rsrc_attach_status(struct file *filp, · 2 unmodified lines
263273 continue;
264274
265275 if (vf) {
276+ sprintf(lfs, "PF%d:VF%d", pf, vf - 1);
266277 go_back = scnprintf(&buf[off],
267278 buf_size - 1 - off,
268− "PF%d:VF%d\t\t", pf,
269− vf - 1);
279+ "%-*s", lf_str_size, lfs);
270280 } else {
281+ sprintf(lfs, "PF%d", pf);
271282 go_back = scnprintf(&buf[off],
272283 buf_size - 1 - off,
273− "PF%d\t\t", pf);
284+ "%-*s", lf_str_size, lfs);
274285 }
275286
276287 off += go_back;
@@ -278,20 +289,22 @@ static ssize_t rvu_dbg_rsrc_attach_status(struct file *filp, · 1 unmodified line
278289 block = rvu->hw->block[index];
279290 if (!strlen(block.name))
280291 continue;
281− off_prev = off;
292+ len = 0;
293+ lfs[len] = '\0';
282294 for (lf = 0; lf < block.lf.max; lf++) {
283295 if (block.fn_map[lf] != pcifunc)
284296 continue;
285297 flag = 1;
286− off += scnprintf(&buf[off], buf_size - 1
287− - off, "%3d,", lf);
298+ len += sprintf(&lfs[len], "%d,", lf);
288299 }
289− if (flag && off_prev != off)
290− off--;
291− else
292− go_back++;
300+
301+ if (flag)
302+ len--;
303+ lfs[len] = '\0';
293304 off += scnprintf(&buf[off], buf_size - 1 - off,
294− "\t");
305+ "%-*s", lf_str_size, lfs);
306+ if (!strlen(lfs))
307+ go_back += lf_str_size;
295308 }
296309 if (!flag)
297310 off -= go_back;
@@ -303,6 +316,7 @@ static ssize_t rvu_dbg_rsrc_attach_status(struct file *filp, · 5 unmodified lines
303316 }
304317
305318 bytes_not_copied = copy_to_user(buffer, buf, off);
319+ kfree(lfs);
306320 kfree(buf);
307321
308322 if (bytes_not_copied)
@@ -319,7 +333,6 @@ static int rvu_dbg_rvu_pf_cgx_map_display(struct seq_file *filp, void *unused) · 10 unmodified lines
319333 struct rvu *rvu = filp->private;
320334 struct pci_dev *pdev = NULL;
321335 struct mac_ops *mac_ops;
322− int rvu_def_cgx_id = 0;
323336 char cgx[10], lmac[10];
324337 struct rvu_pfvf *pfvf;
325338 int pf, domain, blkid;
@@ -327,7 +340,10 @@ static int rvu_dbg_rvu_pf_cgx_map_display(struct seq_file *filp, void *unused) · 1 unmodified line
327340 u16 pcifunc;
328341
329342 domain = 2;
330− mac_ops = get_mac_ops(rvu_cgx_pdata(rvu_def_cgx_id, rvu));
343+ mac_ops = get_mac_ops(rvu_first_cgx_pdata(rvu));
344+ /* There can be no CGX devices at all */
345+ if (!mac_ops)
346+ return 0;
331347 seq_printf(filp, "PCI dev\t\tRVU PF Func\tNIX block\t%s\tLMAC\n",
332348 mac_ops->name);
333349 for (pf = 0; pf < rvu->hw->total_pfs; pf++) {
@@ -1818,7 +1834,6 @@ static void rvu_dbg_cgx_init(struct rvu *rvu) · 1484 unmodified lines
18181834 {
18191835 struct mac_ops *mac_ops;
18201836 unsigned long lmac_bmap;
1821− int rvu_def_cgx_id = 0;
18221837 int i, lmac_id;
18231838 char dname[20];
18241839 void *cgx;
@@ -1826,7 +1841,7 @@ static void rvu_dbg_cgx_init(struct rvu *rvu) · 1 unmodified line
18261841 if (!cgx_get_cgxcnt_max())
18271842 return;
18281843
1829− mac_ops = get_mac_ops(rvu_cgx_pdata(rvu_def_cgx_id, rvu));
1844+ mac_ops = get_mac_ops(rvu_first_cgx_pdata(rvu));
18301845 if (!mac_ops)
18311846 return;
18321847
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c+1−1
@@ -2630,7 +2630,7 @@ static int set_flowkey_fields(struct nix_rx_flowkey_alg *alg, u32 flow_cfg) · 2629 unmodified lines
26302630 struct nix_rx_flowkey_alg *field;
26312631 struct nix_rx_flowkey_alg tmp;
26322632 u32 key_type, valid_key;
2633− int l4_key_offset;
2633+ int l4_key_offset = 0;
26342634
26352635 if (!alg)
26362636 return -EINVAL;
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c+1−1
@@ -2521,10 +2521,10 @@ int rvu_mbox_handler_npc_mcam_free_counter(struct rvu *rvu, · 2520 unmodified lines
25212521 index = find_next_bit(mcam->bmap, mcam->bmap_entries, entry);
25222522 if (index >= mcam->bmap_entries)
25232523 break;
2524+ entry = index + 1;
25242525 if (mcam->entry2cntr_map[index] != req->cntr)
25252526 continue;
25262527
2527− entry = index + 1;
25282528 npc_unmap_mcam_entry_and_cntr(rvu, mcam, blkaddr,
25292529 index, req->cntr);
25302530 }
drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c+3−1
@@ -262,17 +262,19 @@ int otx2_get_flow(struct otx2_nic *pfvf, struct ethtool_rxnfc *nfc, · 261 unmodified lines
262262 int otx2_get_all_flows(struct otx2_nic *pfvf, struct ethtool_rxnfc *nfc,
263263 u32 *rule_locs)
264264 {
265+ u32 rule_cnt = nfc->rule_cnt;
265266 u32 location = 0;
266267 int idx = 0;
267268 int err = 0;
268269
269270 nfc->data = pfvf->flow_cfg->ntuple_max_flows;
270− while ((!err || err == -ENOENT) && idx < nfc->rule_cnt) {
271+ while ((!err || err == -ENOENT) && idx < rule_cnt) {
271272 err = otx2_get_flow(pfvf, nfc, location);
272273 if (!err)
273274 rule_locs[idx++] = location;
274275 location++;
275276 }
277+ nfc->rule_cnt = rule_cnt;
276278
277279 return err;
278280 }
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c+5−0
@@ -1672,6 +1672,7 @@ int otx2_stop(struct net_device *netdev) · 1671 unmodified lines
16721672 struct otx2_nic *pf = netdev_priv(netdev);
16731673 struct otx2_cq_poll *cq_poll = NULL;
16741674 struct otx2_qset *qset = &pf->qset;
1675+ struct otx2_rss_info *rss;
16751676 int qidx, vec, wrk;
16761677
16771678 netif_carrier_off(netdev);
@@ -1684,6 +1685,10 @@ int otx2_stop(struct net_device *netdev) · 6 unmodified lines
16841685 /* First stop packet Rx/Tx */
16851686 otx2_rxtx_enable(pf, false);
16861687
1688+ /* Clear RSS enable flag */
1689+ rss = &pf->hw.rss_info;
1690+ rss->enable = false;
1691+
16871692 /* Cleanup Queue IRQ */
16881693 vec = pci_irq_vector(pf->pdev,
16891694 pf->hw.nix_msixoff + NIX_LF_QINT_VEC_START);
drivers/net/ethernet/marvell/pxa168_eth.c+1−1
@@ -1544,8 +1544,8 @@ static int pxa168_eth_remove(struct platform_device *pdev) · 1543 unmodified lines
15441544 clk_disable_unprepare(pep->clk);
15451545 mdiobus_unregister(pep->smi_bus);
15461546 mdiobus_free(pep->smi_bus);
1547− unregister_netdev(dev);
15481547 cancel_work_sync(&pep->tx_timeout_task);
1548+ unregister_netdev(dev);
15491549 free_netdev(dev);
15501550 return 0;
15511551 }
drivers/net/ethernet/mellanox/mlx5/core/en.h+4−3
@@ -92,14 +92,15 @@ struct page_pool; · 91 unmodified lines
9292 MLX5_MPWRQ_LOG_WQE_SZ - PAGE_SHIFT : 0)
9393 #define MLX5_MPWRQ_PAGES_PER_WQE BIT(MLX5_MPWRQ_WQE_PAGE_ORDER)
9494
95−#define MLX5_MTT_OCTW(npages) (ALIGN(npages, 8) / 2)
95+#define MLX5_ALIGN_MTTS(mtts) (ALIGN(mtts, 8))
96+#define MLX5_ALIGNED_MTTS_OCTW(mtts) ((mtts) / 2)
97+#define MLX5_MTT_OCTW(mtts) (MLX5_ALIGNED_MTTS_OCTW(MLX5_ALIGN_MTTS(mtts)))
9698 /* Add another page to MLX5E_REQUIRED_WQE_MTTS as a buffer between
9799 * WQEs, This page will absorb write overflow by the hardware, when
98100 * receiving packets larger than MTU. These oversize packets are
99101 * dropped by the driver at a later stage.
100102 */
101−#define MLX5E_REQUIRED_WQE_MTTS (ALIGN(MLX5_MPWRQ_PAGES_PER_WQE + 1, 8))
102−#define MLX5E_LOG_ALIGNED_MPWQE_PPW (ilog2(MLX5E_REQUIRED_WQE_MTTS))
103+#define MLX5E_REQUIRED_WQE_MTTS (MLX5_ALIGN_MTTS(MLX5_MPWRQ_PAGES_PER_WQE + 1))
103104 #define MLX5E_REQUIRED_MTTS(wqes) (wqes * MLX5E_REQUIRED_WQE_MTTS)
104105 #define MLX5E_MAX_RQ_NUM_MTTS \
105106 ((1 << 16) * 2) /* So that MLX5_MTT_OCTW(num_mtts) fits into u16 */
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c+2−1
@@ -1181,7 +1181,8 @@ int mlx5_tc_ct_add_no_trk_match(struct mlx5_flow_spec *spec) · 1180 unmodified lines
11811181
11821182 mlx5e_tc_match_to_reg_get_match(spec, CTSTATE_TO_REG,
11831183 &ctstate, &ctstate_mask);
1184− if (ctstate_mask)
1184+
1185+ if ((ctstate & ctstate_mask) == MLX5_CT_STATE_TRK_BIT)
11851186 return -EOPNOTSUPP;
11861187
11871188 ctstate_mask |= MLX5_CT_STATE_TRK_BIT;
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c+4−4
@@ -685,14 +685,14 @@ int mlx5e_tc_tun_route_lookup(struct mlx5e_priv *priv, · 684 unmodified lines
685685 u16 vport_num;
686686 int err = 0;
687687
688− if (flow_attr->ip_version == 4) {
688+ if (flow_attr->tun_ip_version == 4) {
689689 /* Addresses are swapped for decap */
690690 attr.fl.fl4.saddr = esw_attr->rx_tun_attr->dst_ip.v4;
691691 attr.fl.fl4.daddr = esw_attr->rx_tun_attr->src_ip.v4;
692692 err = mlx5e_route_lookup_ipv4_get(priv, priv->netdev, &attr);
693693 }
694694 #if IS_ENABLED(CONFIG_INET) && IS_ENABLED(CONFIG_IPV6)
695− else if (flow_attr->ip_version == 6) {
695+ else if (flow_attr->tun_ip_version == 6) {
696696 /* Addresses are swapped for decap */
697697 attr.fl.fl6.saddr = esw_attr->rx_tun_attr->dst_ip.v6;
698698 attr.fl.fl6.daddr = esw_attr->rx_tun_attr->src_ip.v6;
@@ -718,10 +718,10 @@ int mlx5e_tc_tun_route_lookup(struct mlx5e_priv *priv, · 19 unmodified lines
718718 esw_attr->rx_tun_attr->decap_vport = vport_num;
719719
720720 out:
721− if (flow_attr->ip_version == 4)
721+ if (flow_attr->tun_ip_version == 4)
722722 mlx5e_route_lookup_ipv4_put(&attr);
723723 #if IS_ENABLED(CONFIG_INET) && IS_ENABLED(CONFIG_IPV6)
724− else if (flow_attr->ip_version == 6)
724+ else if (flow_attr->tun_ip_version == 6)
725725 mlx5e_route_lookup_ipv6_put(&attr);
726726 #endif
727727 return err;
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c+2−1
@@ -90,6 +90,7 @@ int mlx5e_tc_set_attr_rx_tun(struct mlx5e_tc_flow *flow, · 89 unmodified lines
9090 * required to establish routing.
9191 */
9292 flow_flag_set(flow, TUN_RX);
93+ flow->attr->tun_ip_version = ip_version;
9394 return 0;
9495 }
9596
@@ -1092,7 +1093,7 @@ int mlx5e_attach_decap_route(struct mlx5e_priv *priv, · 996 unmodified lines
10921093 if (err || !esw_attr->rx_tun_attr->decap_vport)
10931094 goto out;
10941095
1095− key.ip_version = attr->ip_version;
1096+ key.ip_version = attr->tun_ip_version;
10961097 if (key.ip_version == 4)
10971098 key.endpoint_ip.v4 = esw_attr->rx_tun_attr->dst_ip.v4;
10981099 else
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_geneve.c+4−0
@@ -227,6 +227,10 @@ static int mlx5e_tc_tun_parse_geneve_options(struct mlx5e_priv *priv, · 226 unmodified lines
227227 option_key = (struct geneve_opt *)&enc_opts.key->data[0];
228228 option_mask = (struct geneve_opt *)&enc_opts.mask->data[0];
229229
230+ if (option_mask->opt_class == 0 && option_mask->type == 0 &&
231+ !memchr_inv(option_mask->opt_data, 0, option_mask->length * 4))
232+ return 0;
233+
230234 if (option_key->length > max_tlv_option_data_len) {
231235 NL_SET_ERR_MSG_MOD(extack,
232236 "Matching on GENEVE options: unsupported option len");
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c+10−1
@@ -1887,6 +1887,7 @@ static int set_pflag_rx_cqe_compress(struct net_device *netdev, · 1886 unmodified lines
18871887 {
18881888 struct mlx5e_priv *priv = netdev_priv(netdev);
18891889 struct mlx5_core_dev *mdev = priv->mdev;
1890+ int err;
18901891
18911892 if (!MLX5_CAP_GEN(mdev, cqe_compression))
18921893 return -EOPNOTSUPP;
@@ -1896,7 +1897,10 @@ static int set_pflag_rx_cqe_compress(struct net_device *netdev, · 3 unmodified lines
18961897 return -EINVAL;
18971898 }
18981899
1899− mlx5e_modify_rx_cqe_compression_locked(priv, enable);
1900+ err = mlx5e_modify_rx_cqe_compression_locked(priv, enable);
1901+ if (err)
1902+ return err;
1903+
19001904 priv->channels.params.rx_cqe_compress_def = enable;
19011905
19021906 return 0;
@@ -2014,8 +2018,13 @@ static int set_pflag_tx_port_ts(struct net_device *netdev, bool enable) · 111 unmodified lines
20142018 */
20152019
20162020 if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) {
2021+ struct mlx5e_params old_params;
2022+
2023+ old_params = priv->channels.params;
20172024 priv->channels.params = new_channels.params;
20182025 err = mlx5e_num_channels_changed(priv);
2026+ if (err)
2027+ priv->channels.params = old_params;
20192028 goto out;
20202029 }
20212030
drivers/net/ethernet/mellanox/mlx5/core/en_main.c+57−24
@@ -334,9 +334,9 @@ static int mlx5e_create_rq_umr_mkey(struct mlx5_core_dev *mdev, struct mlx5e_rq · 333 unmodified lines
334334 rq->wqe_overflow.addr);
335335 }
336336
337−static inline u64 mlx5e_get_mpwqe_offset(struct mlx5e_rq *rq, u16 wqe_ix)
337+static u64 mlx5e_get_mpwqe_offset(u16 wqe_ix)
338338 {
339− return (wqe_ix << MLX5E_LOG_ALIGNED_MPWQE_PPW) << PAGE_SHIFT;
339+ return MLX5E_REQUIRED_MTTS(wqe_ix) << PAGE_SHIFT;
340340 }
341341
342342 static void mlx5e_init_frags_partition(struct mlx5e_rq *rq)
@@ -577,7 +577,7 @@ static int mlx5e_alloc_rq(struct mlx5e_channel *c, · 234 unmodified lines
577577 mlx5_wq_ll_get_wqe(&rq->mpwqe.wq, i);
578578 u32 byte_count =
579579 rq->mpwqe.num_strides << rq->mpwqe.log_stride_sz;
580− u64 dma_offset = mlx5e_get_mpwqe_offset(rq, i);
580+ u64 dma_offset = mlx5e_get_mpwqe_offset(i);
581581
582582 wqe->data[0].addr = cpu_to_be64(dma_offset + rq->buff.headroom);
583583 wqe->data[0].byte_count = cpu_to_be32(byte_count);
@@ -2368,8 +2368,9 @@ static u8 mlx5e_build_icosq_log_wq_sz(struct mlx5e_params *params, · 1784 unmodified lines
23682368 {
23692369 switch (params->rq_wq_type) {
23702370 case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ:
2371− return order_base_2(MLX5E_UMR_WQEBBS) +
2372− mlx5e_get_rq_log_wq_sz(rqp->rqc);
2371+ return max_t(u8, MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE,
2372+ order_base_2(MLX5E_UMR_WQEBBS) +
2373+ mlx5e_get_rq_log_wq_sz(rqp->rqc));
23732374 default: /* MLX5_WQ_TYPE_CYCLIC */
23742375 return MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE;
23752376 }
@@ -2502,8 +2503,10 @@ void mlx5e_close_channels(struct mlx5e_channels *chs) · 126 unmodified lines
25022503 {
25032504 int i;
25042505
2505− if (chs->port_ptp)
2506+ if (chs->port_ptp) {
25062507 mlx5e_port_ptp_close(chs->port_ptp);
2508+ chs->port_ptp = NULL;
2509+ }
25072510
25082511 for (i = 0; i < chs->num; i++)
25092512 mlx5e_close_channel(chs->c[i]);
@@ -3818,6 +3821,15 @@ void mlx5e_fold_sw_stats64(struct mlx5e_priv *priv, struct rtnl_link_stats64 *s) · 1308 unmodified lines
38183821 for (j = 0; j < priv->max_opened_tc; j++) {
38193822 struct mlx5e_sq_stats *sq_stats = &channel_stats->sq[j];
38203823
3824+ s->tx_packets += sq_stats->packets;
3825+ s->tx_bytes += sq_stats->bytes;
3826+ s->tx_dropped += sq_stats->dropped;
3827+ }
3828+ }
3829+ if (priv->port_ptp_opened) {
3830+ for (i = 0; i < priv->max_opened_tc; i++) {
3831+ struct mlx5e_sq_stats *sq_stats = &priv->port_ptp_stats.sq[i];
3832+
38213833 s->tx_packets += sq_stats->packets;
38223834 s->tx_bytes += sq_stats->bytes;
38233835 s->tx_dropped += sq_stats->dropped;
@@ -3845,10 +3857,17 @@ mlx5e_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats) · 21 unmodified lines
38453857 }
38463858
38473859 if (mlx5e_is_uplink_rep(priv)) {
3860+ struct mlx5e_vport_stats *vstats = &priv->stats.vport;
3861+
38483862 stats->rx_packets = PPORT_802_3_GET(pstats, a_frames_received_ok);
38493863 stats->rx_bytes = PPORT_802_3_GET(pstats, a_octets_received_ok);
38503864 stats->tx_packets = PPORT_802_3_GET(pstats, a_frames_transmitted_ok);
38513865 stats->tx_bytes = PPORT_802_3_GET(pstats, a_octets_transmitted_ok);
3866+
3867+ /* vport multicast also counts packets that are dropped due to steering
3868+ * or rx out of buffer
3869+ */
3870+ stats->multicast = VPORT_COUNTER_GET(vstats, received_eth_multicast.packets);
38523871 } else {
38533872 mlx5e_fold_sw_stats64(priv, stats);
38543873 }
@@ -4734,8 +4753,10 @@ static int mlx5e_xdp_set(struct net_device *netdev, struct bpf_prog *prog) · 879 unmodified lines
47344753 struct mlx5e_channel *c = priv->channels.c[i];
47354754
47364755 mlx5e_rq_replace_xdp_prog(&c->rq, prog);
4737− if (test_bit(MLX5E_CHANNEL_STATE_XSK, c->state))
4756+ if (test_bit(MLX5E_CHANNEL_STATE_XSK, c->state)) {
4757+ bpf_prog_inc(prog);
47384758 mlx5e_rq_replace_xdp_prog(&c->xskrq, prog);
4759+ }
47394760 }
47404761
47414762 unlock:
@@ -5011,6 +5032,11 @@ void mlx5e_build_nic_params(struct mlx5e_priv *priv, struct mlx5e_xsk *xsk, u16 · 269 unmodified lines
50115032 priv->max_nch);
50125033 params->num_tc = 1;
50135034
5035+ /* Set an initial non-zero value, so that mlx5e_select_queue won't
5036+ * divide by zero if called before first activating channels.
5037+ */
5038+ priv->num_tc_x_num_ch = params->num_channels * params->num_tc;
5039+
50145040 /* SQ */
50155041 params->log_sq_size = is_kdump_kernel() ?
50165042 MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE :
@@ -5522,8 +5548,6 @@ int mlx5e_priv_init(struct mlx5e_priv *priv, · 505 unmodified lines
55225548 struct net_device *netdev,
55235549 struct mlx5_core_dev *mdev)
55245550 {
5525− memset(priv, 0, sizeof(*priv));
5526−
55275551 /* priv init */
55285552 priv->mdev = mdev;
55295553 priv->netdev = netdev;
@@ -5556,12 +5580,18 @@ void mlx5e_priv_cleanup(struct mlx5e_priv *priv) · 26 unmodified lines
55565580 {
55575581 int i;
55585582
5583+ /* bail if change profile failed and also rollback failed */
5584+ if (!priv->mdev)
5585+ return;
5586+
55595587 destroy_workqueue(priv->wq);
55605588 free_cpumask_var(priv->scratchpad.cpumask);
55615589
55625590 for (i = 0; i < priv->htb.max_qos_sqs; i++)
55635591 kfree(priv->htb.qos_sq_stats[i]);
55645592 kvfree(priv->htb.qos_sq_stats);
5593+
5594+ memset(priv, 0, sizeof(*priv));
55655595 }
55665596
55675597 struct net_device *
@@ -5678,11 +5708,10 @@ void mlx5e_detach_netdev(struct mlx5e_priv *priv) · 110 unmodified lines
56785708 }
56795709
56805710 static int
5681−mlx5e_netdev_attach_profile(struct mlx5e_priv *priv,
5711+mlx5e_netdev_attach_profile(struct net_device *netdev, struct mlx5_core_dev *mdev,
56825712 const struct mlx5e_profile *new_profile, void *new_ppriv)
56835713 {
5684− struct net_device *netdev = priv->netdev;
5685− struct mlx5_core_dev *mdev = priv->mdev;
5714+ struct mlx5e_priv *priv = netdev_priv(netdev);
56865715 int err;
56875716
56885717 err = mlx5e_priv_init(priv, netdev, mdev);
@@ -5695,10 +5724,16 @@ mlx5e_netdev_attach_profile(struct mlx5e_priv *priv, · 6 unmodified lines
56955724 priv->ppriv = new_ppriv;
56965725 err = new_profile->init(priv->mdev, priv->netdev);
56975726 if (err)
5698− return err;
5727+ goto priv_cleanup;
56995728 err = mlx5e_attach_netdev(priv);
57005729 if (err)
5701− new_profile->cleanup(priv);
5730+ goto profile_cleanup;
5731+ return err;
5732+
5733+profile_cleanup:
5734+ new_profile->cleanup(priv);
5735+priv_cleanup:
5736+ mlx5e_priv_cleanup(priv);
57025737 return err;
57035738 }
57045739
@@ -5707,13 +5742,14 @@ int mlx5e_netdev_change_profile(struct mlx5e_priv *priv, · 2 unmodified lines
57075742 {
57085743 unsigned int new_max_nch = mlx5e_calc_max_nch(priv, new_profile);
57095744 const struct mlx5e_profile *orig_profile = priv->profile;
5745+ struct net_device *netdev = priv->netdev;
5746+ struct mlx5_core_dev *mdev = priv->mdev;
57105747 void *orig_ppriv = priv->ppriv;
57115748 int err, rollback_err;
57125749
57135750 /* sanity */
57145751 if (new_max_nch != priv->max_nch) {
5715− netdev_warn(priv->netdev,
5716− "%s: Replacing profile with different max channels\n",
5752+ netdev_warn(netdev, "%s: Replacing profile with different max channels\n",
57175753 __func__);
57185754 return -EINVAL;
57195755 }
@@ -5723,22 +5759,19 @@ int mlx5e_netdev_change_profile(struct mlx5e_priv *priv, · 3 unmodified lines
57235759 priv->profile->cleanup(priv);
57245760 mlx5e_priv_cleanup(priv);
57255761
5726− err = mlx5e_netdev_attach_profile(priv, new_profile, new_ppriv);
5762+ err = mlx5e_netdev_attach_profile(netdev, mdev, new_profile, new_ppriv);
57275763 if (err) { /* roll back to original profile */
5728− netdev_warn(priv->netdev, "%s: new profile init failed, %d\n",
5729− __func__, err);
5764+ netdev_warn(netdev, "%s: new profile init failed, %d\n", __func__, err);
57305765 goto rollback;
57315766 }
57325767
57335768 return 0;
57345769
57355770 rollback:
5736− rollback_err = mlx5e_netdev_attach_profile(priv, orig_profile, orig_ppriv);
5737− if (rollback_err) {
5738− netdev_err(priv->netdev,
5739− "%s: failed to rollback to orig profile, %d\n",
5771+ rollback_err = mlx5e_netdev_attach_profile(netdev, mdev, orig_profile, orig_ppriv);
5772+ if (rollback_err)
5773+ netdev_err(netdev, "%s: failed to rollback to orig profile, %d\n",
57405774 __func__, rollback_err);
5741− }
57425775 return err;
57435776 }
57445777
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c+2−2
@@ -501,7 +501,6 @@ static int mlx5e_alloc_rx_mpwqe(struct mlx5e_rq *rq, u16 ix) · 500 unmodified lines
501501 struct mlx5e_icosq *sq = rq->icosq;
502502 struct mlx5_wq_cyc *wq = &sq->wq;
503503 struct mlx5e_umr_wqe *umr_wqe;
504− u16 xlt_offset = ix << (MLX5E_LOG_ALIGNED_MPWQE_PPW - 1);
505504 u16 pi;
506505 int err;
507506 int i;
@@ -532,7 +531,8 @@ static int mlx5e_alloc_rx_mpwqe(struct mlx5e_rq *rq, u16 ix) · 24 unmodified lines
532531 umr_wqe->ctrl.opmod_idx_opcode =
533532 cpu_to_be32((sq->pc << MLX5_WQE_CTRL_WQE_INDEX_SHIFT) |
534533 MLX5_OPCODE_UMR);
535− umr_wqe->uctrl.xlt_offset = cpu_to_be16(xlt_offset);
534+ umr_wqe->uctrl.xlt_offset =
535+ cpu_to_be16(MLX5_ALIGNED_MTTS_OCTW(MLX5E_REQUIRED_MTTS(ix)));
536536
537537 sq->db.wqe_info[pi] = (struct mlx5e_icosq_wqe_info) {
538538 .wqe_type = MLX5E_ICOSQ_WQE_UMR_RX,
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c+45−12
@@ -2357,6 +2357,16 @@ static int __parse_cls_flower(struct mlx5e_priv *priv, · 2356 unmodified lines
23572357 spec->match_criteria_enable |= MLX5_MATCH_MISC_PARAMETERS_3;
23582358 }
23592359 }
2360+ /* Currenlty supported only for MPLS over UDP */
2361+ if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_MPLS) &&
2362+ !netif_is_bareudp(filter_dev)) {
2363+ NL_SET_ERR_MSG_MOD(extack,
2364+ "Matching on MPLS is supported only for MPLS over UDP");
2365+ netdev_err(priv->netdev,
2366+ "Matching on MPLS is supported only for MPLS over UDP\n");
2367+ return -EOPNOTSUPP;
2368+ }
2369+
23602370 return 0;
23612371 }
23622372
@@ -2960,6 +2970,37 @@ static int is_action_keys_supported(const struct flow_action_entry *act, · 597 unmodified lines
29602970 return 0;
29612971 }
29622972
2973+static bool modify_tuple_supported(bool modify_tuple, bool ct_clear,
2974+ bool ct_flow, struct netlink_ext_ack *extack,
2975+ struct mlx5e_priv *priv,
2976+ struct mlx5_flow_spec *spec)
2977+{
2978+ if (!modify_tuple || ct_clear)
2979+ return true;
2980+
2981+ if (ct_flow) {
2982+ NL_SET_ERR_MSG_MOD(extack,
2983+ "can't offload tuple modification with non-clear ct()");
2984+ netdev_info(priv->netdev,
2985+ "can't offload tuple modification with non-clear ct()");
2986+ return false;
2987+ }
2988+
2989+ /* Add ct_state=-trk match so it will be offloaded for non ct flows
2990+ * (or after clear action), as otherwise, since the tuple is changed,
2991+ * we can't restore ct state
2992+ */
2993+ if (mlx5_tc_ct_add_no_trk_match(spec)) {
2994+ NL_SET_ERR_MSG_MOD(extack,
2995+ "can't offload tuple modification with ct matches and no ct(clear) action");
2996+ netdev_info(priv->netdev,
2997+ "can't offload tuple modification with ct matches and no ct(clear) action");
2998+ return false;
2999+ }
3000+
3001+ return true;
3002+}
3003+
29633004 static bool modify_header_match_supported(struct mlx5e_priv *priv,
29643005 struct mlx5_flow_spec *spec,
29653006 struct flow_action *flow_action,
@@ -2998,18 +3039,9 @@ static bool modify_header_match_supported(struct mlx5e_priv *priv, · 32 unmodified lines
29983039 return err;
29993040 }
30003041
3001− /* Add ct_state=-trk match so it will be offloaded for non ct flows
3002− * (or after clear action), as otherwise, since the tuple is changed,
3003− * we can't restore ct state
3004− */
3005− if (!ct_clear && modify_tuple &&
3006− mlx5_tc_ct_add_no_trk_match(spec)) {
3007− NL_SET_ERR_MSG_MOD(extack,
3008− "can't offload tuple modify header with ct matches");
3009− netdev_info(priv->netdev,
3010− "can't offload tuple modify header with ct matches");
3042+ if (!modify_tuple_supported(modify_tuple, ct_clear, ct_flow, extack,
3043+ priv, spec))
30113044 return false;
3012− }
30133045
30143046 ip_proto = MLX5_GET(fte_match_set_lyr_2_4, headers_v, ip_protocol);
30153047 if (modify_ip_header && ip_proto != IPPROTO_TCP &&
@@ -4512,7 +4544,8 @@ static int apply_police_params(struct mlx5e_priv *priv, u64 rate, · 1496 unmodified lines
45124544 */
45134545 if (rate) {
45144546 rate = (rate * BITS_PER_BYTE) + 500000;
4515− rate_mbps = max_t(u64, do_div(rate, 1000000), 1);
4547+ do_div(rate, 1000000);
4548+ rate_mbps = max_t(u32, rate, 1);
45164549 }
45174550
45184551 err = mlx5_esw_modify_vport_rate(esw, vport_num, rate_mbps);
drivers/net/ethernet/mellanox/mlx5/core/en_tc.h+1−0
@@ -79,6 +79,7 @@ struct mlx5_flow_attr { · 78 unmodified lines
7979 u8 inner_match_level;
8080 u8 outer_match_level;
8181 u8 ip_version;
82+ u8 tun_ip_version;
8283 u32 flags;
8384 union {
8485 struct mlx5_esw_flow_attr esw_attr[0];
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c+2−1
@@ -550,7 +550,8 @@ esw_setup_dests(struct mlx5_flow_destination *dest, · 549 unmodified lines
550550
551551 if (!mlx5_eswitch_termtbl_required(esw, attr, flow_act, spec) &&
552552 MLX5_CAP_GEN(esw_attr->in_mdev, reg_c_preserve) &&
553− mlx5_eswitch_vport_match_metadata_enabled(esw))
553+ mlx5_eswitch_vport_match_metadata_enabled(esw) &&
554+ MLX5_CAP_ESW_FLOWTABLE_FDB(esw->dev, ignore_flow_level))
554555 attr->flags |= MLX5_ESW_ATTR_FLAG_SRC_REWRITE;
555556
556557 if (attr->dest_ft) {
drivers/net/ethernet/mellanox/mlx5/core/fpga/conn.c+1−0
@@ -575,6 +575,7 @@ static int mlx5_fpga_conn_create_qp(struct mlx5_fpga_conn *conn, · 574 unmodified lines
575575 MLX5_SET(qpc, qpc, log_sq_size, ilog2(conn->qp.sq.size));
576576 MLX5_SET(qpc, qpc, cqn_snd, conn->cq.mcq.cqn);
577577 MLX5_SET(qpc, qpc, cqn_rcv, conn->cq.mcq.cqn);
578+ MLX5_SET(qpc, qpc, ts_format, mlx5_get_qp_default_ts(mdev));
578579 MLX5_SET64(qpc, qpc, dbr_addr, conn->qp.wq_ctrl.db.dma);
579580 if (MLX5_CAP_GEN(mdev, cqe_version) == 1)
580581 MLX5_SET(qpc, qpc, user_index, 0xFFFFFF);
drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c+3−1
@@ -233,6 +233,7 @@ int mlx5i_create_underlay_qp(struct mlx5e_priv *priv) · 232 unmodified lines
233233 }
234234
235235 qpc = MLX5_ADDR_OF(create_qp_in, in, qpc);
236+ MLX5_SET(qpc, qpc, ts_format, mlx5_get_qp_default_ts(priv->mdev));
236237 MLX5_SET(qpc, qpc, st, MLX5_QP_ST_UD);
237238 MLX5_SET(qpc, qpc, pm_state, MLX5_QP_PM_MIGRATED);
238239 MLX5_SET(qpc, qpc, ulp_stateless_offload_mode,
@@ -694,6 +695,7 @@ static int mlx5i_check_required_hca_cap(struct mlx5_core_dev *mdev) · 455 unmodified lines
694695 static void mlx5_rdma_netdev_free(struct net_device *netdev)
695696 {
696697 struct mlx5e_priv *priv = mlx5i_epriv(netdev);
698+ struct mlx5_core_dev *mdev = priv->mdev;
697699 struct mlx5i_priv *ipriv = priv->ppriv;
698700 const struct mlx5e_profile *profile = priv->profile;
699701
@@ -702,7 +704,7 @@ static void mlx5_rdma_netdev_free(struct net_device *netdev) · 2 unmodified lines
702704
703705 if (!ipriv->sub_interface) {
704706 mlx5i_pkey_qpn_ht_cleanup(netdev);
705− mlx5e_destroy_mdev_resources(priv->mdev);
707+ mlx5e_destroy_mdev_resources(mdev);
706708 }
707709 }
708710
drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c+4−4
@@ -495,15 +495,15 @@ static int mlx5_perout_configure(struct ptp_clock_info *ptp, · 494 unmodified lines
495495 return -EINVAL;
496496
497497 field_select = MLX5_MTPPS_FS_ENABLE;
498+ pin = ptp_find_pin(clock->ptp, PTP_PF_PEROUT, rq->perout.index);
499+ if (pin < 0)
500+ return -EBUSY;
501+
498502 if (on) {
499503 bool rt_mode = mlx5_real_time_mode(mdev);
500504 u32 nsec;
501505 s64 sec;
502506
503− pin = ptp_find_pin(clock->ptp, PTP_PF_PEROUT, rq->perout.index);
504− if (pin < 0)
505− return -EBUSY;
506−
507507 pin_mode = MLX5_PIN_MODE_OUT;
508508 pattern = MLX5_OUT_PATTERN_PERIODIC;
509509 ts.tv_sec = rq->perout.period.sec;
drivers/net/ethernet/mellanox/mlx5/core/sf/dev/dev.c+1−3
@@ -181,15 +181,13 @@ static int mlx5_sf_dev_vhca_arm_all(struct mlx5_sf_dev_table *table) · 180 unmodified lines
181181 u16 max_functions;
182182 u16 function_id;
183183 int err = 0;
184− bool ecpu;
185184 int i;
186185
187186 max_functions = mlx5_sf_max_functions(dev);
188187 function_id = MLX5_CAP_GEN(dev, sf_base_id);
189− ecpu = mlx5_read_embedded_cpu(dev);
190188 /* Arm the vhca context as the vhca event notifier */
191189 for (i = 0; i < max_functions; i++) {
192− err = mlx5_vhca_event_arm(dev, function_id, ecpu);
190+ err = mlx5_vhca_event_arm(dev, function_id);
193191 if (err)
194192 return err;
195193
drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c+5−5
@@ -6,6 +6,8 @@ · 5 unmodified lines
66 #include "sf.h"
77 #include "mlx5_ifc_vhca_event.h"
88 #include "ecpf.h"
9+#include "vhca_event.h"
10+#include "mlx5_core.h"
911
1012 struct mlx5_sf_hw {
1113 u32 usr_sfnum;
@@ -17,7 +19,6 @@ struct mlx5_sf_hw_table { · 5 unmodified lines
1719 struct mlx5_core_dev *dev;
1820 struct mlx5_sf_hw *sfs;
1921 int max_local_functions;
20− u8 ecpu: 1;
2122 struct mutex table_lock; /* Serializes sf deletion and vhca state change handler. */
2223 struct notifier_block vhca_nb;
2324 };
@@ -63,7 +64,7 @@ int mlx5_sf_hw_table_sf_alloc(struct mlx5_core_dev *dev, u32 usr_sfnum) · 39 unmodified lines
6364 }
6465 if (sw_id == -ENOSPC) {
6566 err = -ENOSPC;
66− goto err;
67+ goto exist_err;
6768 }
6869
6970 hw_fn_id = mlx5_sf_sw_to_hw_id(table->dev, sw_id);
@@ -71,7 +72,7 @@ int mlx5_sf_hw_table_sf_alloc(struct mlx5_core_dev *dev, u32 usr_sfnum) · 1 unmodified line
7172 if (err)
7273 goto err;
7374
74− err = mlx5_modify_vhca_sw_id(dev, hw_fn_id, table->ecpu, usr_sfnum);
75+ err = mlx5_modify_vhca_sw_id(dev, hw_fn_id, usr_sfnum);
7576 if (err)
7677 goto vhca_err;
7778
@@ -117,7 +118,7 @@ void mlx5_sf_hw_table_sf_deferred_free(struct mlx5_core_dev *dev, u16 id) · 39 unmodified lines
117118
118119 hw_fn_id = mlx5_sf_sw_to_hw_id(dev, id);
119120 mutex_lock(&table->table_lock);
120− err = mlx5_cmd_query_vhca_state(dev, hw_fn_id, table->ecpu, out, sizeof(out));
121+ err = mlx5_cmd_query_vhca_state(dev, hw_fn_id, out, sizeof(out));
121122 if (err)
122123 goto err;
123124 state = MLX5_GET(query_vhca_state_out, out, vhca_state_context.vhca_state);
@@ -163,7 +164,6 @@ int mlx5_sf_hw_table_init(struct mlx5_core_dev *dev) · 39 unmodified lines
163164 table->dev = dev;
164165 table->sfs = sfs;
165166 table->max_local_functions = max_functions;
166− table->ecpu = mlx5_read_embedded_cpu(dev);
167167 dev->priv.sf_hw_table = table;
168168 mlx5_core_dbg(dev, "SF HW table: max sfs = %d\n", max_functions);
169169 return 0;
drivers/net/ethernet/mellanox/mlx5/core/sf/mlx5_ifc_vhca_event.h+1−1
@@ -20,7 +20,7 @@ struct mlx5_ifc_vhca_state_context_bits { · 19 unmodified lines
2020
2121 u8 sw_function_id[0x20];
2222
23− u8 reserved_at_40[0x80];
23+ u8 reserved_at_40[0x40];
2424 };
2525
2626 struct mlx5_ifc_query_vhca_state_out_bits {
drivers/net/ethernet/mellanox/mlx5/core/sf/vhca_event.c+11−12
@@ -19,52 +19,51 @@ struct mlx5_vhca_event_work { · 18 unmodified lines
1919 struct mlx5_vhca_state_event event;
2020 };
2121
22−int mlx5_cmd_query_vhca_state(struct mlx5_core_dev *dev, u16 function_id,
23− bool ecpu, u32 *out, u32 outlen)
22+int mlx5_cmd_query_vhca_state(struct mlx5_core_dev *dev, u16 function_id, u32 *out, u32 outlen)
2423 {
2524 u32 in[MLX5_ST_SZ_DW(query_vhca_state_in)] = {};
2625
2726 MLX5_SET(query_vhca_state_in, in, opcode, MLX5_CMD_OP_QUERY_VHCA_STATE);
2827 MLX5_SET(query_vhca_state_in, in, function_id, function_id);
29− MLX5_SET(query_vhca_state_in, in, embedded_cpu_function, ecpu);
28+ MLX5_SET(query_vhca_state_in, in, embedded_cpu_function, 0);
3029
3130 return mlx5_cmd_exec(dev, in, sizeof(in), out, outlen);
3231 }
3332
3433 static int mlx5_cmd_modify_vhca_state(struct mlx5_core_dev *dev, u16 function_id,
35− bool ecpu, u32 *in, u32 inlen)
34+ u32 *in, u32 inlen)
3635 {
3736 u32 out[MLX5_ST_SZ_DW(modify_vhca_state_out)] = {};
3837
3938 MLX5_SET(modify_vhca_state_in, in, opcode, MLX5_CMD_OP_MODIFY_VHCA_STATE);
4039 MLX5_SET(modify_vhca_state_in, in, function_id, function_id);
41− MLX5_SET(modify_vhca_state_in, in, embedded_cpu_function, ecpu);
40+ MLX5_SET(modify_vhca_state_in, in, embedded_cpu_function, 0);
4241
4342 return mlx5_cmd_exec(dev, in, inlen, out, sizeof(out));
4443 }
4544
46−int mlx5_modify_vhca_sw_id(struct mlx5_core_dev *dev, u16 function_id, bool ecpu, u32 sw_fn_id)
45+int mlx5_modify_vhca_sw_id(struct mlx5_core_dev *dev, u16 function_id, u32 sw_fn_id)
4746 {
4847 u32 out[MLX5_ST_SZ_DW(modify_vhca_state_out)] = {};
4948 u32 in[MLX5_ST_SZ_DW(modify_vhca_state_in)] = {};
5049
5150 MLX5_SET(modify_vhca_state_in, in, opcode, MLX5_CMD_OP_MODIFY_VHCA_STATE);
5251 MLX5_SET(modify_vhca_state_in, in, function_id, function_id);
53− MLX5_SET(modify_vhca_state_in, in, embedded_cpu_function, ecpu);
52+ MLX5_SET(modify_vhca_state_in, in, embedded_cpu_function, 0);
5453 MLX5_SET(modify_vhca_state_in, in, vhca_state_field_select.sw_function_id, 1);
5554 MLX5_SET(modify_vhca_state_in, in, vhca_state_context.sw_function_id, sw_fn_id);
5655
5756 return mlx5_cmd_exec_inout(dev, modify_vhca_state, in, out);
5857 }
5958
60−int mlx5_vhca_event_arm(struct mlx5_core_dev *dev, u16 function_id, bool ecpu)
59+int mlx5_vhca_event_arm(struct mlx5_core_dev *dev, u16 function_id)
6160 {
6261 u32 in[MLX5_ST_SZ_DW(modify_vhca_state_in)] = {};
6362
6463 MLX5_SET(modify_vhca_state_in, in, vhca_state_context.arm_change_event, 1);
6564 MLX5_SET(modify_vhca_state_in, in, vhca_state_field_select.arm_change_event, 1);
6665
67− return mlx5_cmd_modify_vhca_state(dev, function_id, ecpu, in, sizeof(in));
66+ return mlx5_cmd_modify_vhca_state(dev, function_id, in, sizeof(in));
6867 }
6968
7069 static void
@@ -73,7 +72,7 @@ mlx5_vhca_event_notify(struct mlx5_core_dev *dev, struct mlx5_vhca_state_event * · 2 unmodified lines
7372 u32 out[MLX5_ST_SZ_DW(query_vhca_state_out)] = {};
7473 int err;
7574
76− err = mlx5_cmd_query_vhca_state(dev, event->function_id, event->ecpu, out, sizeof(out));
75+ err = mlx5_cmd_query_vhca_state(dev, event->function_id, out, sizeof(out));
7776 if (err)
7877 return;
7978
@@ -82,7 +81,7 @@ mlx5_vhca_event_notify(struct mlx5_core_dev *dev, struct mlx5_vhca_state_event * · 2 unmodified lines
8281 event->new_vhca_state = MLX5_GET(query_vhca_state_out, out,
8382 vhca_state_context.vhca_state);
8483
85− mlx5_vhca_event_arm(dev, event->function_id, event->ecpu);
84+ mlx5_vhca_event_arm(dev, event->function_id);
8685
8786 blocking_notifier_call_chain(&dev->priv.vhca_state_notifier->n_head, 0, event);
8887 }
@@ -94,6 +93,7 @@ static void mlx5_vhca_state_work_handler(struct work_struct *_work) · 5 unmodified lines
9493 struct mlx5_core_dev *dev = notifier->dev;
9594
9695 mlx5_vhca_event_notify(dev, &work->event);
96+ kfree(work);
9797 }
9898
9999 static int
@@ -110,7 +110,6 @@ mlx5_vhca_state_change_notifier(struct notifier_block *nb, unsigned long type, v · 10 unmodified lines
110110 INIT_WORK(&work->work, &mlx5_vhca_state_work_handler);
111111 work->notifier = notifier;
112112 work->event.function_id = be16_to_cpu(eqe->data.vhca_state.function_id);
113− work->event.ecpu = be16_to_cpu(eqe->data.vhca_state.ec_function);
114113 mlx5_events_work_enqueue(notifier->dev, &work->work);
115114 return NOTIFY_OK;
116115 }
drivers/net/ethernet/mellanox/mlx5/core/sf/vhca_event.h+3−4
@@ -10,7 +10,6 @@ struct mlx5_vhca_state_event { · 9 unmodified lines
1010 u16 function_id;
1111 u16 sw_function_id;
1212 u8 new_vhca_state;
13− bool ecpu;
1413 };
1514
1615 static inline bool mlx5_vhca_event_supported(const struct mlx5_core_dev *dev)
@@ -25,10 +24,10 @@ void mlx5_vhca_event_start(struct mlx5_core_dev *dev); · 8 unmodified lines
2524 void mlx5_vhca_event_stop(struct mlx5_core_dev *dev);
2625 int mlx5_vhca_event_notifier_register(struct mlx5_core_dev *dev, struct notifier_block *nb);
2726 void mlx5_vhca_event_notifier_unregister(struct mlx5_core_dev *dev, struct notifier_block *nb);
28−int mlx5_modify_vhca_sw_id(struct mlx5_core_dev *dev, u16 function_id, bool ecpu, u32 sw_fn_id);
29−int mlx5_vhca_event_arm(struct mlx5_core_dev *dev, u16 function_id, bool ecpu);
27+int mlx5_modify_vhca_sw_id(struct mlx5_core_dev *dev, u16 function_id, u32 sw_fn_id);
28+int mlx5_vhca_event_arm(struct mlx5_core_dev *dev, u16 function_id);
3029 int mlx5_cmd_query_vhca_state(struct mlx5_core_dev *dev, u16 function_id,
31− bool ecpu, u32 *out, u32 outlen);
30+ u32 *out, u32 outlen);
3231 #else
3332
3433 static inline void mlx5_vhca_state_cap_handle(struct mlx5_core_dev *dev, void *set_hca_cap)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c+1−0
@@ -169,6 +169,7 @@ static struct mlx5dr_qp *dr_create_rc_qp(struct mlx5_core_dev *mdev, · 168 unmodified lines
169169 MLX5_SET(qpc, qpc, log_rq_size, ilog2(dr_qp->rq.wqe_cnt));
170170 MLX5_SET(qpc, qpc, rq_type, MLX5_NON_ZERO_RQ);
171171 MLX5_SET(qpc, qpc, log_sq_size, ilog2(dr_qp->sq.wqe_cnt));
172+ MLX5_SET(qpc, qpc, ts_format, mlx5_get_qp_default_ts(mdev));
172173 MLX5_SET64(qpc, qpc, dbr_addr, dr_qp->wq_ctrl.db.dma);
173174 if (MLX5_CAP_GEN(mdev, cqe_version) == 1)
174175 MLX5_SET(qpc, qpc, user_index, 0xFFFFFF);
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v1.c+2−2
@@ -264,8 +264,8 @@ static void dr_ste_v1_set_miss_addr(u8 *hw_ste_p, u64 miss_addr) · 263 unmodified lines
264264 static u64 dr_ste_v1_get_miss_addr(u8 *hw_ste_p)
265265 {
266266 u64 index =
267− (MLX5_GET(ste_match_bwc_v1, hw_ste_p, miss_address_31_6) |
268− MLX5_GET(ste_match_bwc_v1, hw_ste_p, miss_address_39_32) << 26);
267+ ((u64)MLX5_GET(ste_match_bwc_v1, hw_ste_p, miss_address_31_6) |
268+ ((u64)MLX5_GET(ste_match_bwc_v1, hw_ste_p, miss_address_39_32)) << 26);
269269
270270 return index << 6;
271271 }
drivers/net/ethernet/netronome/nfp/flower/metadata.c+17−7
@@ -327,8 +327,14 @@ int nfp_compile_flow_metadata(struct nfp_app *app, · 326 unmodified lines
327327 goto err_free_ctx_entry;
328328 }
329329
330+ /* Do net allocate a mask-id for pre_tun_rules. These flows are used to
331+ * configure the pre_tun table and are never actually send to the
332+ * firmware as an add-flow message. This causes the mask-id allocation
333+ * on the firmware to get out of sync if allocated here.
334+ */
330335 new_mask_id = 0;
331− if (!nfp_check_mask_add(app, nfp_flow->mask_data,
336+ if (!nfp_flow->pre_tun_rule.dev &&
337+ !nfp_check_mask_add(app, nfp_flow->mask_data,
332338 nfp_flow->meta.mask_len,
333339 &nfp_flow->meta.flags, &new_mask_id)) {
334340 NL_SET_ERR_MSG_MOD(extack, "invalid entry: cannot allocate a new mask id");
@@ -359,7 +365,8 @@ int nfp_compile_flow_metadata(struct nfp_app *app, · 24 unmodified lines
359365 goto err_remove_mask;
360366 }
361367
362− if (!nfp_check_mask_remove(app, nfp_flow->mask_data,
368+ if (!nfp_flow->pre_tun_rule.dev &&
369+ !nfp_check_mask_remove(app, nfp_flow->mask_data,
363370 nfp_flow->meta.mask_len,
364371 NULL, &new_mask_id)) {
365372 NL_SET_ERR_MSG_MOD(extack, "invalid entry: cannot release mask id");
@@ -374,8 +381,10 @@ int nfp_compile_flow_metadata(struct nfp_app *app, · 8 unmodified lines
374381 return 0;
375382
376383 err_remove_mask:
377− nfp_check_mask_remove(app, nfp_flow->mask_data, nfp_flow->meta.mask_len,
378− NULL, &new_mask_id);
384+ if (!nfp_flow->pre_tun_rule.dev)
385+ nfp_check_mask_remove(app, nfp_flow->mask_data,
386+ nfp_flow->meta.mask_len,
387+ NULL, &new_mask_id);
379388 err_remove_rhash:
380389 WARN_ON_ONCE(rhashtable_remove_fast(&priv->stats_ctx_table,
381390 &ctx_entry->ht_node,
@@ -406,9 +415,10 @@ int nfp_modify_flow_metadata(struct nfp_app *app, · 24 unmodified lines
406415
407416 __nfp_modify_flow_metadata(priv, nfp_flow);
408417
409− nfp_check_mask_remove(app, nfp_flow->mask_data,
410− nfp_flow->meta.mask_len, &nfp_flow->meta.flags,
411− &new_mask_id);
418+ if (!nfp_flow->pre_tun_rule.dev)
419+ nfp_check_mask_remove(app, nfp_flow->mask_data,
420+ nfp_flow->meta.mask_len, &nfp_flow->meta.flags,
421+ &new_mask_id);
412422
413423 /* Update flow payload with mask ids. */
414424 nfp_flow->unmasked_data[NFP_FL_MASK_ID_LOCATION] = new_mask_id;
drivers/net/ethernet/netronome/nfp/flower/offload.c+18−0
@@ -1142,6 +1142,12 @@ nfp_flower_validate_pre_tun_rule(struct nfp_app *app, · 1141 unmodified lines
11421142 return -EOPNOTSUPP;
11431143 }
11441144
1145+ if (!(key_layer & NFP_FLOWER_LAYER_IPV4) &&
1146+ !(key_layer & NFP_FLOWER_LAYER_IPV6)) {
1147+ NL_SET_ERR_MSG_MOD(extack, "unsupported pre-tunnel rule: match on ipv4/ipv6 eth_type must be present");
1148+ return -EOPNOTSUPP;
1149+ }
1150+
11451151 /* Skip fields known to exist. */
11461152 mask += sizeof(struct nfp_flower_meta_tci);
11471153 ext += sizeof(struct nfp_flower_meta_tci);
@@ -1152,6 +1158,13 @@ nfp_flower_validate_pre_tun_rule(struct nfp_app *app, · 4 unmodified lines
11521158 mask += sizeof(struct nfp_flower_in_port);
11531159 ext += sizeof(struct nfp_flower_in_port);
11541160
1161+ /* Ensure destination MAC address matches pre_tun_dev. */
1162+ mac = (struct nfp_flower_mac_mpls *)ext;
1163+ if (memcmp(&mac->mac_dst[0], flow->pre_tun_rule.dev->dev_addr, 6)) {
1164+ NL_SET_ERR_MSG_MOD(extack, "unsupported pre-tunnel rule: dest MAC must match output dev MAC");
1165+ return -EOPNOTSUPP;
1166+ }
1167+
11551168 /* Ensure destination MAC address is fully matched. */
11561169 mac = (struct nfp_flower_mac_mpls *)mask;
11571170 if (!is_broadcast_ether_addr(&mac->mac_dst[0])) {
@@ -1159,6 +1172,11 @@ nfp_flower_validate_pre_tun_rule(struct nfp_app *app, · 1 unmodified line
11591172 return -EOPNOTSUPP;
11601173 }
11611174
1175+ if (mac->mpls_lse) {
1176+ NL_SET_ERR_MSG_MOD(extack, "unsupported pre-tunnel rule: MPLS not supported");
1177+ return -EOPNOTSUPP;
1178+ }
1179+
11621180 mask += sizeof(struct nfp_flower_mac_mpls);
11631181 ext += sizeof(struct nfp_flower_mac_mpls);
11641182 if (key_layer & NFP_FLOWER_LAYER_IPV4 ||
drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c+13−2
@@ -16,8 +16,9 @@ · 15 unmodified lines
1616 #define NFP_FL_MAX_ROUTES 32
1717
1818 #define NFP_TUN_PRE_TUN_RULE_LIMIT 32
19−#define NFP_TUN_PRE_TUN_RULE_DEL 0x1
20−#define NFP_TUN_PRE_TUN_IDX_BIT 0x8
19+#define NFP_TUN_PRE_TUN_RULE_DEL BIT(0)
20+#define NFP_TUN_PRE_TUN_IDX_BIT BIT(3)
21+#define NFP_TUN_PRE_TUN_IPV6_BIT BIT(7)
2122
2223 /**
2324 * struct nfp_tun_pre_run_rule - rule matched before decap
@@ -1268,6 +1269,7 @@ int nfp_flower_xmit_pre_tun_flow(struct nfp_app *app, · 1244 unmodified lines
12681269 {
12691270 struct nfp_flower_priv *app_priv = app->priv;
12701271 struct nfp_tun_offloaded_mac *mac_entry;
1272+ struct nfp_flower_meta_tci *key_meta;
12711273 struct nfp_tun_pre_tun_rule payload;
12721274 struct net_device *internal_dev;
12731275 int err;
@@ -1290,6 +1292,15 @@ int nfp_flower_xmit_pre_tun_flow(struct nfp_app *app, · 16 unmodified lines
12901292 if (!mac_entry)
12911293 return -ENOENT;
12921294
1295+ /* Set/clear IPV6 bit. cpu_to_be16() swap will lead to MSB being
1296+ * set/clear for port_idx.
1297+ */
1298+ key_meta = (struct nfp_flower_meta_tci *)flow->unmasked_data;
1299+ if (key_meta->nfp_flow_key_layer & NFP_FLOWER_LAYER_IPV6)
1300+ mac_entry->index |= NFP_TUN_PRE_TUN_IPV6_BIT;
1301+ else
1302+ mac_entry->index &= ~NFP_TUN_PRE_TUN_IPV6_BIT;
1303+
12931304 payload.port_idx = cpu_to_be16(mac_entry->index);
12941305
12951306 /* Copy mac id and vlan to flow - dev may not exist at delete time. */
drivers/net/ethernet/pensando/ionic/ionic_txrx.c+7−5
@@ -1083,15 +1083,18 @@ static int ionic_tx(struct ionic_queue *q, struct sk_buff *skb) · 1082 unmodified lines
10831083 static int ionic_tx_descs_needed(struct ionic_queue *q, struct sk_buff *skb)
10841084 {
10851085 struct ionic_tx_stats *stats = q_to_tx_stats(q);
1086+ int ndescs;
10861087 int err;
10871088
1088− /* If TSO, need roundup(skb->len/mss) descs */
1089+ /* Each desc is mss long max, so a descriptor for each gso_seg */
10891090 if (skb_is_gso(skb))
1090− return (skb->len / skb_shinfo(skb)->gso_size) + 1;
1091+ ndescs = skb_shinfo(skb)->gso_segs;
1092+ else
1093+ ndescs = 1;
10911094
10921095 /* If non-TSO, just need 1 desc and nr_frags sg elems */
10931096 if (skb_shinfo(skb)->nr_frags <= q->max_sg_elems)
1094− return 1;
1097+ return ndescs;
10951098
10961099 /* Too many frags, so linearize */
10971100 err = skb_linearize(skb);
@@ -1100,8 +1103,7 @@ static int ionic_tx_descs_needed(struct ionic_queue *q, struct sk_buff *skb) · 2 unmodified lines
11001103
11011104 stats->linearize++;
11021105
1103− /* Need 1 desc and zero sg elems */
1104− return 1;
1106+ return ndescs;
11051107 }
11061108
11071109 static int ionic_maybe_stop_tx(struct ionic_queue *q, int ndescs)
drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c+3−0
@@ -1425,6 +1425,7 @@ void qlcnic_83xx_get_minidump_template(struct qlcnic_adapter *adapter) · 1424 unmodified lines
14251425
14261426 if (fw_dump->tmpl_hdr == NULL || current_version > prev_version) {
14271427 vfree(fw_dump->tmpl_hdr);
1428+ fw_dump->tmpl_hdr = NULL;
14281429
14291430 if (qlcnic_83xx_md_check_extended_dump_capability(adapter))
14301431 extended = !qlcnic_83xx_extend_md_capab(adapter);
@@ -1443,6 +1444,8 @@ void qlcnic_83xx_get_minidump_template(struct qlcnic_adapter *adapter) · 12 unmodified lines
14431444 struct qlcnic_83xx_dump_template_hdr *hdr;
14441445
14451446 hdr = fw_dump->tmpl_hdr;
1447+ if (!hdr)
1448+ return;
14461449 hdr->drv_cap_mask = 0x1f;
14471450 fw_dump->cap_mask = 0x1f;
14481451 dev_info(&pdev->dev,
drivers/net/ethernet/realtek/r8169_main.c+4−2
@@ -4654,6 +4654,9 @@ static void rtl8169_down(struct rtl8169_private *tp) · 4653 unmodified lines
46544654
46554655 rtl8169_update_counters(tp);
46564656
4657+ pci_clear_master(tp->pci_dev);
4658+ rtl_pci_commit(tp);
4659+
46574660 rtl8169_cleanup(tp, true);
46584661
46594662 rtl_prepare_power_down(tp);
@@ -4661,6 +4664,7 @@ static void rtl8169_down(struct rtl8169_private *tp) · 1 unmodified line
46614664
46624665 static void rtl8169_up(struct rtl8169_private *tp)
46634666 {
4667+ pci_set_master(tp->pci_dev);
46644668 phy_resume(tp->phydev);
46654669 rtl8169_init_phy(tp);
46664670 napi_enable(&tp->napi);
@@ -5315,8 +5319,6 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 648 unmodified lines
53155319
53165320 rtl_hw_reset(tp);
53175321
5318− pci_set_master(pdev);
5319−
53205322 rc = rtl_alloc_irq(tp);
53215323 if (rc < 0) {
53225324 dev_err(&pdev->dev, "Can't allocate interrupt\n");
drivers/net/ethernet/socionext/netsec.c+6−3
@@ -1715,14 +1715,17 @@ static int netsec_netdev_init(struct net_device *ndev) · 1714 unmodified lines
17151715 goto err1;
17161716
17171717 /* set phy power down */
1718− data = netsec_phy_read(priv->mii_bus, priv->phy_addr, MII_BMCR) |
1719− BMCR_PDOWN;
1720− netsec_phy_write(priv->mii_bus, priv->phy_addr, MII_BMCR, data);
1718+ data = netsec_phy_read(priv->mii_bus, priv->phy_addr, MII_BMCR);
1719+ netsec_phy_write(priv->mii_bus, priv->phy_addr, MII_BMCR,
1720+ data | BMCR_PDOWN);
17211721
17221722 ret = netsec_reset_hardware(priv, true);
17231723 if (ret)
17241724 goto err2;
17251725
1726+ /* Restore phy power state */
1727+ netsec_phy_write(priv->mii_bus, priv->phy_addr, MII_BMCR, data);
1728+
17261729 spin_lock_init(&priv->desc_ring[NETSEC_RING_TX].lock);
17271730 spin_lock_init(&priv->desc_ring[NETSEC_RING_RX].lock);
17281731
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c+2−0
@@ -1214,6 +1214,8 @@ static int sun8i_dwmac_probe(struct platform_device *pdev) · 1213 unmodified lines
12141214 plat_dat->init = sun8i_dwmac_init;
12151215 plat_dat->exit = sun8i_dwmac_exit;
12161216 plat_dat->setup = sun8i_dwmac_setup;
1217+ plat_dat->tx_fifo_size = 4096;
1218+ plat_dat->rx_fifo_size = 16384;
12171219
12181220 ret = sun8i_dwmac_set_syscon(&pdev->dev, plat_dat);
12191221 if (ret)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c+25−12
@@ -1880,7 +1880,7 @@ static int axienet_probe(struct platform_device *pdev) · 1879 unmodified lines
18801880 if (IS_ERR(lp->regs)) {
18811881 dev_err(&pdev->dev, "could not map Axi Ethernet regs.\n");
18821882 ret = PTR_ERR(lp->regs);
1883− goto free_netdev;
1883+ goto cleanup_clk;
18841884 }
18851885 lp->regs_start = ethres->start;
18861886
@@ -1958,18 +1958,18 @@ static int axienet_probe(struct platform_device *pdev) · 71 unmodified lines
19581958 break;
19591959 default:
19601960 ret = -EINVAL;
1961− goto free_netdev;
1961+ goto cleanup_clk;
19621962 }
19631963 } else {
19641964 ret = of_get_phy_mode(pdev->dev.of_node, &lp->phy_mode);
19651965 if (ret)
1966− goto free_netdev;
1966+ goto cleanup_clk;
19671967 }
19681968 if (lp->switch_x_sgmii && lp->phy_mode != PHY_INTERFACE_MODE_SGMII &&
19691969 lp->phy_mode != PHY_INTERFACE_MODE_1000BASEX) {
19701970 dev_err(&pdev->dev, "xlnx,switch-x-sgmii only supported with SGMII or 1000BaseX\n");
19711971 ret = -EINVAL;
1972− goto free_netdev;
1972+ goto cleanup_clk;
19731973 }
19741974
19751975 /* Find the DMA node, map the DMA registers, and decode the DMA IRQs */
@@ -1982,7 +1982,7 @@ static int axienet_probe(struct platform_device *pdev) · 6 unmodified lines
19821982 dev_err(&pdev->dev,
19831983 "unable to get DMA resource\n");
19841984 of_node_put(np);
1985− goto free_netdev;
1985+ goto cleanup_clk;
19861986 }
19871987 lp->dma_regs = devm_ioremap_resource(&pdev->dev,
19881988 &dmares);
@@ -2002,12 +2002,12 @@ static int axienet_probe(struct platform_device *pdev) · 13 unmodified lines
20022002 if (IS_ERR(lp->dma_regs)) {
20032003 dev_err(&pdev->dev, "could not map DMA regs\n");
20042004 ret = PTR_ERR(lp->dma_regs);
2005− goto free_netdev;
2005+ goto cleanup_clk;
20062006 }
20072007 if ((lp->rx_irq <= 0) || (lp->tx_irq <= 0)) {
20082008 dev_err(&pdev->dev, "could not determine irqs\n");
20092009 ret = -ENOMEM;
2010− goto free_netdev;
2010+ goto cleanup_clk;
20112011 }
20122012
20132013 /* Autodetect the need for 64-bit DMA pointers.
@@ -2037,7 +2037,7 @@ static int axienet_probe(struct platform_device *pdev) · 23 unmodified lines
20372037 ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(addr_width));
20382038 if (ret) {
20392039 dev_err(&pdev->dev, "No suitable DMA available\n");
2040− goto free_netdev;
2040+ goto cleanup_clk;
20412041 }
20422042
20432043 /* Check for Ethernet core IRQ (optional) */
@@ -2068,12 +2068,12 @@ static int axienet_probe(struct platform_device *pdev) · 24 unmodified lines
20682068 if (!lp->phy_node) {
20692069 dev_err(&pdev->dev, "phy-handle required for 1000BaseX/SGMII\n");
20702070 ret = -EINVAL;
2071− goto free_netdev;
2071+ goto cleanup_mdio;
20722072 }
20732073 lp->pcs_phy = of_mdio_find_device(lp->phy_node);
20742074 if (!lp->pcs_phy) {
20752075 ret = -EPROBE_DEFER;
2076− goto free_netdev;
2076+ goto cleanup_mdio;
20772077 }
20782078 lp->phylink_config.pcs_poll = true;
20792079 }
@@ -2087,17 +2087,30 @@ static int axienet_probe(struct platform_device *pdev) · 7 unmodified lines
20872087 if (IS_ERR(lp->phylink)) {
20882088 ret = PTR_ERR(lp->phylink);
20892089 dev_err(&pdev->dev, "phylink_create error (%i)\n", ret);
2090− goto free_netdev;
2090+ goto cleanup_mdio;
20912091 }
20922092
20932093 ret = register_netdev(lp->ndev);
20942094 if (ret) {
20952095 dev_err(lp->dev, "register_netdev() error (%i)\n", ret);
2096− goto free_netdev;
2096+ goto cleanup_phylink;
20972097 }
20982098
20992099 return 0;
21002100
2101+cleanup_phylink:
2102+ phylink_destroy(lp->phylink);
2103+
2104+cleanup_mdio:
2105+ if (lp->pcs_phy)
2106+ put_device(&lp->pcs_phy->dev);
2107+ if (lp->mii_bus)
2108+ axienet_mdio_teardown(lp);
2109+ of_node_put(lp->phy_node);
2110+
2111+cleanup_clk:
2112+ clk_disable_unprepare(lp->clk);
2113+
21012114 free_netdev:
21022115 free_netdev(ndev);
21032116
drivers/net/hamradio/scc.c+0−1
@@ -2167,7 +2167,6 @@ static void __exit scc_cleanup_driver(void) · 2166 unmodified lines
21672167
21682168 MODULE_AUTHOR("Joerg Reuter <jreuter@yaina.de>");
21692169 MODULE_DESCRIPTION("AX.25 Device Driver for Z8530 based HDLC cards");
2170−MODULE_SUPPORTED_DEVICE("Z8530 based SCC cards for Amateur Radio");
21712170 MODULE_LICENSE("GPL");
21722171 module_init(scc_init_driver);
21732172 module_exit(scc_cleanup_driver);
drivers/net/ipa/ipa_cmd.c+33−17
@@ -174,21 +174,23 @@ bool ipa_cmd_table_valid(struct ipa *ipa, const struct ipa_mem *mem, · 173 unmodified lines
174174 : field_max(IP_FLTRT_FLAGS_NHASH_ADDR_FMASK);
175175 if (mem->offset > offset_max ||
176176 ipa->mem_offset > offset_max - mem->offset) {
177− dev_err(dev, "IPv%c %s%s table region offset too large "
178− "(0x%04x + 0x%04x > 0x%04x)\n",
179− ipv6 ? '6' : '4', hashed ? "hashed " : "",
180− route ? "route" : "filter",
181− ipa->mem_offset, mem->offset, offset_max);
177+ dev_err(dev, "IPv%c %s%s table region offset too large\n",
178+ ipv6 ? '6' : '4', hashed ? "hashed " : "",
179+ route ? "route" : "filter");
180+ dev_err(dev, " (0x%04x + 0x%04x > 0x%04x)\n",
181+ ipa->mem_offset, mem->offset, offset_max);
182+
182183 return false;
183184 }
184185
185186 if (mem->offset > ipa->mem_size ||
186187 mem->size > ipa->mem_size - mem->offset) {
187− dev_err(dev, "IPv%c %s%s table region out of range "
188− "(0x%04x + 0x%04x > 0x%04x)\n",
189− ipv6 ? '6' : '4', hashed ? "hashed " : "",
190− route ? "route" : "filter",
191− mem->offset, mem->size, ipa->mem_size);
188+ dev_err(dev, "IPv%c %s%s table region out of range\n",
189+ ipv6 ? '6' : '4', hashed ? "hashed " : "",
190+ route ? "route" : "filter");
191+ dev_err(dev, " (0x%04x + 0x%04x > 0x%04x)\n",
192+ mem->offset, mem->size, ipa->mem_size);
193+
192194 return false;
193195 }
194196
@@ -204,22 +206,36 @@ static bool ipa_cmd_header_valid(struct ipa *ipa) · 9 unmodified lines
204206 u32 size_max;
205207 u32 size;
206208
209+ /* In ipa_cmd_hdr_init_local_add() we record the offset and size
210+ * of the header table memory area. Make sure the offset and size
211+ * fit in the fields that need to hold them, and that the entire
212+ * range is within the overall IPA memory range.
213+ */
207214 offset_max = field_max(HDR_INIT_LOCAL_FLAGS_HDR_ADDR_FMASK);
208215 if (mem->offset > offset_max ||
209216 ipa->mem_offset > offset_max - mem->offset) {
210− dev_err(dev, "header table region offset too large "
211− "(0x%04x + 0x%04x > 0x%04x)\n",
212− ipa->mem_offset + mem->offset, offset_max);
217+ dev_err(dev, "header table region offset too large\n");
218+ dev_err(dev, " (0x%04x + 0x%04x > 0x%04x)\n",
219+ ipa->mem_offset, mem->offset, offset_max);
220+
213221 return false;
214222 }
215223
216224 size_max = field_max(HDR_INIT_LOCAL_FLAGS_TABLE_SIZE_FMASK);
217225 size = ipa->mem[IPA_MEM_MODEM_HEADER].size;
218226 size += ipa->mem[IPA_MEM_AP_HEADER].size;
219− if (mem->offset > ipa->mem_size || size > ipa->mem_size - mem->offset) {
220− dev_err(dev, "header table region out of range "
221− "(0x%04x + 0x%04x > 0x%04x)\n",
222− mem->offset, size, ipa->mem_size);
227+
228+ if (size > size_max) {
229+ dev_err(dev, "header table region size too large\n");
230+ dev_err(dev, " (0x%04x > 0x%08x)\n", size, size_max);
231+
232+ return false;
233+ }
234+ if (size > ipa->mem_size || mem->offset > ipa->mem_size - size) {
235+ dev_err(dev, "header table region out of range\n");
236+ dev_err(dev, " (0x%04x + 0x%04x > 0x%04x)\n",
237+ mem->offset, size, ipa->mem_size);
238+
223239 return false;
224240 }
225241
drivers/net/ipa/ipa_qmi.c+2−0
@@ -249,6 +249,7 @@ static const struct qmi_msg_handler ipa_server_msg_handlers[] = { · 248 unmodified lines
249249 .decoded_size = IPA_QMI_DRIVER_INIT_COMPLETE_REQ_SZ,
250250 .fn = ipa_server_driver_init_complete,
251251 },
252+ { },
252253 };
253254
254255 /* Handle an INIT_DRIVER response message from the modem. */
@@ -269,6 +270,7 @@ static const struct qmi_msg_handler ipa_client_msg_handlers[] = { · 14 unmodified lines
269270 .decoded_size = IPA_QMI_INIT_DRIVER_RSP_SZ,
270271 .fn = ipa_client_init_driver,
271272 },
273+ { },
272274 };
273275
274276 /* Return a pointer to an init modem driver request structure, which contains
drivers/net/phy/broadcom.c+9−0
@@ -342,6 +342,10 @@ static int bcm54xx_config_init(struct phy_device *phydev) · 341 unmodified lines
342342 bcm54xx_adjust_rxrefclk(phydev);
343343
344344 switch (BRCM_PHY_MODEL(phydev)) {
345+ case PHY_ID_BCM50610:
346+ case PHY_ID_BCM50610M:
347+ err = bcm54xx_config_clock_delay(phydev);
348+ break;
345349 case PHY_ID_BCM54210E:
346350 err = bcm54210e_config_init(phydev);
347351 break;
@@ -399,6 +403,11 @@ static int bcm54xx_resume(struct phy_device *phydev) · 51 unmodified lines
399403 if (ret < 0)
400404 return ret;
401405
406+ /* Upon exiting power down, the PHY remains in an internal reset state
407+ * for 40us
408+ */
409+ fsleep(40);
410+
402411 return bcm54xx_config_init(phydev);
403412 }
404413
drivers/net/phy/phylink.c+1−1
@@ -477,7 +477,7 @@ static void phylink_major_config(struct phylink *pl, bool restart, · 476 unmodified lines
477477 err = pl->mac_ops->mac_finish(pl->config, pl->cur_link_an_mode,
478478 state->interface);
479479 if (err < 0)
480− phylink_err(pl, "mac_prepare failed: %pe\n",
480+ phylink_err(pl, "mac_finish failed: %pe\n",
481481 ERR_PTR(err));
482482 }
483483 }
drivers/net/usb/cdc-phonet.c+2−0
@@ -387,6 +387,8 @@ static int usbpn_probe(struct usb_interface *intf, const struct usb_device_id *i · 386 unmodified lines
387387
388388 err = register_netdev(dev);
389389 if (err) {
390+ /* Set disconnected flag so that disconnect() returns early. */
391+ pnd->disconnected = 1;
390392 usb_driver_release_interface(&usbpn_driver, data_intf);
391393 goto out;
392394 }
drivers/net/usb/r8152.c+4−1
@@ -6553,7 +6553,10 @@ static int rtl_ops_init(struct r8152 *tp) · 6552 unmodified lines
65536553 ops->in_nway = rtl8153_in_nway;
65546554 ops->hw_phy_cfg = r8153_hw_phy_cfg;
65556555 ops->autosuspend_en = rtl8153_runtime_enable;
6556− tp->rx_buf_sz = 32 * 1024;
6556+ if (tp->udev->speed < USB_SPEED_SUPER)
6557+ tp->rx_buf_sz = 16 * 1024;
6558+ else
6559+ tp->rx_buf_sz = 32 * 1024;
65576560 tp->eee_en = true;
65586561 tp->eee_adv = MDIO_EEE_1000T | MDIO_EEE_100TX;
65596562 break;
drivers/net/veth.c+1−2
@@ -302,8 +302,7 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev) · 301 unmodified lines
302302 if (rxq < rcv->real_num_rx_queues) {
303303 rq = &rcv_priv->rq[rxq];
304304 rcv_xdp = rcu_access_pointer(rq->xdp_prog);
305− if (rcv_xdp)
306− skb_record_rx_queue(skb, rxq);
305+ skb_record_rx_queue(skb, rxq);
307306 }
308307
309308 skb_tx_timestamp(skb);
drivers/net/wan/hdlc_x25.c+41−1
@@ -23,6 +23,8 @@ · 22 unmodified lines
2323
2424 struct x25_state {
2525 x25_hdlc_proto settings;
26+ bool up;
27+ spinlock_t up_lock; /* Protects "up" */
2628 };
2729
2830 static int x25_ioctl(struct net_device *dev, struct ifreq *ifr);
@@ -104,6 +106,8 @@ static void x25_data_transmit(struct net_device *dev, struct sk_buff *skb) · 75 unmodified lines
104106
105107 static netdev_tx_t x25_xmit(struct sk_buff *skb, struct net_device *dev)
106108 {
109+ hdlc_device *hdlc = dev_to_hdlc(dev);
110+ struct x25_state *x25st = state(hdlc);
107111 int result;
108112
109113 /* There should be a pseudo header of 1 byte added by upper layers.
@@ -114,11 +118,19 @@ static netdev_tx_t x25_xmit(struct sk_buff *skb, struct net_device *dev) · 4 unmodified lines
114118 return NETDEV_TX_OK;
115119 }
116120
121+ spin_lock_bh(&x25st->up_lock);
122+ if (!x25st->up) {
123+ spin_unlock_bh(&x25st->up_lock);
124+ kfree_skb(skb);
125+ return NETDEV_TX_OK;
126+ }
127+
117128 switch (skb->data[0]) {
118129 case X25_IFACE_DATA: /* Data to be transmitted */
119130 skb_pull(skb, 1);
120131 if ((result = lapb_data_request(dev, skb)) != LAPB_OK)
121132 dev_kfree_skb(skb);
133+ spin_unlock_bh(&x25st->up_lock);
122134 return NETDEV_TX_OK;
123135
124136 case X25_IFACE_CONNECT:
@@ -147,6 +159,7 @@ static netdev_tx_t x25_xmit(struct sk_buff *skb, struct net_device *dev) · 22 unmodified lines
147159 break;
148160 }
149161
162+ spin_unlock_bh(&x25st->up_lock);
150163 dev_kfree_skb(skb);
151164 return NETDEV_TX_OK;
152165 }
@@ -164,6 +177,7 @@ static int x25_open(struct net_device *dev) · 11 unmodified lines
164177 .data_transmit = x25_data_transmit,
165178 };
166179 hdlc_device *hdlc = dev_to_hdlc(dev);
180+ struct x25_state *x25st = state(hdlc);
167181 struct lapb_parms_struct params;
168182 int result;
169183
@@ -190,6 +204,10 @@ static int x25_open(struct net_device *dev) · 20 unmodified lines
190204 if (result != LAPB_OK)
191205 return -EINVAL;
192206
207+ spin_lock_bh(&x25st->up_lock);
208+ x25st->up = true;
209+ spin_unlock_bh(&x25st->up_lock);
210+
193211 return 0;
194212 }
195213
@@ -197,6 +215,13 @@ static int x25_open(struct net_device *dev) · 1 unmodified line
197215
198216 static void x25_close(struct net_device *dev)
199217 {
218+ hdlc_device *hdlc = dev_to_hdlc(dev);
219+ struct x25_state *x25st = state(hdlc);
220+
221+ spin_lock_bh(&x25st->up_lock);
222+ x25st->up = false;
223+ spin_unlock_bh(&x25st->up_lock);
224+
200225 lapb_unregister(dev);
201226 }
202227
@@ -205,15 +230,28 @@ static void x25_close(struct net_device *dev) · 2 unmodified lines
205230 static int x25_rx(struct sk_buff *skb)
206231 {
207232 struct net_device *dev = skb->dev;
233+ hdlc_device *hdlc = dev_to_hdlc(dev);
234+ struct x25_state *x25st = state(hdlc);
208235
209236 if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) {
210237 dev->stats.rx_dropped++;
211238 return NET_RX_DROP;
212239 }
213240
214− if (lapb_data_received(dev, skb) == LAPB_OK)
241+ spin_lock_bh(&x25st->up_lock);
242+ if (!x25st->up) {
243+ spin_unlock_bh(&x25st->up_lock);
244+ kfree_skb(skb);
245+ dev->stats.rx_dropped++;
246+ return NET_RX_DROP;
247+ }
248+
249+ if (lapb_data_received(dev, skb) == LAPB_OK) {
250+ spin_unlock_bh(&x25st->up_lock);
215251 return NET_RX_SUCCESS;
252+ }
216253
254+ spin_unlock_bh(&x25st->up_lock);
217255 dev->stats.rx_errors++;
218256 dev_kfree_skb_any(skb);
219257 return NET_RX_DROP;
@@ -298,6 +336,8 @@ static int x25_ioctl(struct net_device *dev, struct ifreq *ifr) · 78 unmodified lines
298336 return result;
299337
300338 memcpy(&state(hdlc)->settings, &new_settings, size);
339+ state(hdlc)->up = false;
340+ spin_lock_init(&state(hdlc)->up_lock);
301341
302342 /* There's no header_ops so hard_header_len should be 0. */
303343 dev->hard_header_len = 0;
drivers/net/wireless/admtek/adm8211.c+0−1
@@ -28,7 +28,6 @@ · 27 unmodified lines
2828 MODULE_AUTHOR("Michael Wu <flamingice@sourmilk.net>");
2929 MODULE_AUTHOR("Jouni Malinen <j@w1.fi>");
3030 MODULE_DESCRIPTION("Driver for IEEE 802.11b wireless cards based on ADMtek ADM8211");
31−MODULE_SUPPORTED_DEVICE("ADM8211");
3231 MODULE_LICENSE("GPL");
3332
3433 static unsigned int tx_ring_size __read_mostly = 16;
drivers/net/wireless/ath/ath5k/base.c+0−1
@@ -90,7 +90,6 @@ MODULE_PARM_DESC(no_hw_rfkill_switch, "Ignore the GPIO RFKill switch state"); · 89 unmodified lines
9090 MODULE_AUTHOR("Jiri Slaby");
9191 MODULE_AUTHOR("Nick Kossifidis");
9292 MODULE_DESCRIPTION("Support for 5xxx series of Atheros 802.11 wireless LAN cards.");
93−MODULE_SUPPORTED_DEVICE("Atheros 5xxx WLAN cards");
9493 MODULE_LICENSE("Dual BSD/GPL");
9594
9695 static int ath5k_init(struct ieee80211_hw *hw);
drivers/net/wireless/ath/ath9k/hw.c+0−1
@@ -34,7 +34,6 @@ static bool ath9k_hw_set_reset_reg(struct ath_hw *ah, u32 type); · 33 unmodified lines
3434
3535 MODULE_AUTHOR("Atheros Communications");
3636 MODULE_DESCRIPTION("Support for Atheros 802.11n wireless LAN cards.");
37−MODULE_SUPPORTED_DEVICE("Atheros 802.11n WLAN cards");
3837 MODULE_LICENSE("Dual BSD/GPL");
3938
4039 static void ath9k_hw_set_clockrate(struct ath_hw *ah)
drivers/net/wireless/ath/ath9k/init.c+0−1
@@ -37,7 +37,6 @@ static char *dev_info = "ath9k"; · 36 unmodified lines
3737
3838 MODULE_AUTHOR("Atheros Communications");
3939 MODULE_DESCRIPTION("Support for Atheros 802.11n wireless LAN cards.");
40−MODULE_SUPPORTED_DEVICE("Atheros 802.11n WLAN cards");
4140 MODULE_LICENSE("Dual BSD/GPL");
4241
4342 static unsigned int ath9k_debug = ATH_DBG_DEFAULT;
drivers/net/wireless/atmel/atmel.c+0−1
@@ -75,7 +75,6 @@ · 74 unmodified lines
7575 MODULE_AUTHOR("Simon Kelley");
7676 MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards.");
7777 MODULE_LICENSE("GPL");
78−MODULE_SUPPORTED_DEVICE("Atmel at76c50x wireless cards");
7978
8079 /* The name of the firmware file to be loaded
8180 over-rides any automatic selection */
drivers/net/wireless/atmel/atmel_cs.c+0−1
@@ -57,7 +57,6 @@ · 56 unmodified lines
5757 MODULE_AUTHOR("Simon Kelley");
5858 MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards.");
5959 MODULE_LICENSE("GPL");
60−MODULE_SUPPORTED_DEVICE("Atmel at76c50x PCMCIA cards");
6160
6261 /*====================================================================*/
6362
drivers/net/wireless/atmel/atmel_pci.c+0−1
@@ -16,7 +16,6 @@ · 15 unmodified lines
1616 MODULE_AUTHOR("Simon Kelley");
1717 MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards.");
1818 MODULE_LICENSE("GPL");
19−MODULE_SUPPORTED_DEVICE("Atmel at76c506 PCI wireless cards");
2019
2120 static const struct pci_device_id card_ids[] = {
2221 { 0x1114, 0x0506, PCI_ANY_ID, PCI_ANY_ID },
drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c+0−1
@@ -87,7 +87,6 @@ static int n_adapters_found; · 86 unmodified lines
8787
8888 MODULE_AUTHOR("Broadcom Corporation");
8989 MODULE_DESCRIPTION("Broadcom 802.11n wireless LAN driver.");
90−MODULE_SUPPORTED_DEVICE("Broadcom 802.11n WLAN cards");
9190 MODULE_LICENSE("Dual BSD/GPL");
9291 /* This needs to be adjusted when brcms_firmwares changes */
9392 MODULE_FIRMWARE("brcm/bcm43xx-0.fw");
drivers/net/wireless/broadcom/brcm80211/brcmutil/utils.c+0−1
@@ -12,7 +12,6 @@ · 11 unmodified lines
1212
1313 MODULE_AUTHOR("Broadcom Corporation");
1414 MODULE_DESCRIPTION("Broadcom 802.11n wireless LAN driver utilities.");
15−MODULE_SUPPORTED_DEVICE("Broadcom 802.11n WLAN cards");
1615 MODULE_LICENSE("Dual BSD/GPL");
1716
1817 struct sk_buff *brcmu_pkt_buf_get_skb(uint len)
drivers/net/wireless/cisco/airo.c+0−1
@@ -251,7 +251,6 @@ MODULE_AUTHOR("Benjamin Reed"); · 250 unmodified lines
251251 MODULE_DESCRIPTION("Support for Cisco/Aironet 802.11 wireless ethernet cards. "
252252 "Direct support for ISA/PCI/MPI cards and support for PCMCIA when used with airo_cs.");
253253 MODULE_LICENSE("Dual BSD/GPL");
254−MODULE_SUPPORTED_DEVICE("Aironet 4500, 4800 and Cisco 340/350");
255254 module_param_hw_array(io, int, ioport, NULL, 0);
256255 module_param_hw_array(irq, int, irq, NULL, 0);
257256 module_param_array(rates, int, NULL, 0);
drivers/net/wireless/cisco/airo_cs.c+0−1
@@ -47,7 +47,6 @@ MODULE_DESCRIPTION("Support for Cisco/Aironet 802.11 wireless ethernet " · 46 unmodified lines
4747 "cards. This is the module that links the PCMCIA card "
4848 "with the airo module.");
4949 MODULE_LICENSE("Dual BSD/GPL");
50−MODULE_SUPPORTED_DEVICE("Aironet 4500, 4800 and Cisco 340 PCMCIA cards");
5150
5251 /*====================================================================*/
5352
drivers/net/wireless/intersil/hostap/hostap_cs.c+0−1
@@ -26,7 +26,6 @@ static char *dev_info = "hostap_cs"; · 25 unmodified lines
2626 MODULE_AUTHOR("Jouni Malinen");
2727 MODULE_DESCRIPTION("Support for Intersil Prism2-based 802.11 wireless LAN "
2828 "cards (PC Card).");
29−MODULE_SUPPORTED_DEVICE("Intersil Prism2-based WLAN cards (PC Card)");
3029 MODULE_LICENSE("GPL");
3130
3231
drivers/net/wireless/intersil/hostap/hostap_pci.c+0−1
@@ -27,7 +27,6 @@ static char *dev_info = "hostap_pci"; · 26 unmodified lines
2727 MODULE_AUTHOR("Jouni Malinen");
2828 MODULE_DESCRIPTION("Support for Intersil Prism2.5-based 802.11 wireless LAN "
2929 "PCI cards.");
30−MODULE_SUPPORTED_DEVICE("Intersil Prism2.5-based WLAN PCI cards");
3130 MODULE_LICENSE("GPL");
3231
3332
drivers/net/wireless/intersil/hostap/hostap_plx.c+0−1
@@ -30,7 +30,6 @@ static char *dev_info = "hostap_plx"; · 29 unmodified lines
3030 MODULE_AUTHOR("Jouni Malinen");
3131 MODULE_DESCRIPTION("Support for Intersil Prism2-based 802.11 wireless LAN "
3232 "cards (PLX).");
33−MODULE_SUPPORTED_DEVICE("Intersil Prism2-based WLAN cards (PLX)");
3433 MODULE_LICENSE("GPL");
3534
3635
drivers/net/wireless/ralink/rt2x00/rt2400pci.c+0−1
@@ -1821,7 +1821,6 @@ static const struct pci_device_id rt2400pci_device_table[] = { · 1820 unmodified lines
18211821 MODULE_AUTHOR(DRV_PROJECT);
18221822 MODULE_VERSION(DRV_VERSION);
18231823 MODULE_DESCRIPTION("Ralink RT2400 PCI & PCMCIA Wireless LAN driver.");
1824−MODULE_SUPPORTED_DEVICE("Ralink RT2460 PCI & PCMCIA chipset based cards");
18251824 MODULE_DEVICE_TABLE(pci, rt2400pci_device_table);
18261825 MODULE_LICENSE("GPL");
18271826
drivers/net/wireless/ralink/rt2x00/rt2500pci.c+0−1
@@ -2119,7 +2119,6 @@ static const struct pci_device_id rt2500pci_device_table[] = { · 2118 unmodified lines
21192119 MODULE_AUTHOR(DRV_PROJECT);
21202120 MODULE_VERSION(DRV_VERSION);
21212121 MODULE_DESCRIPTION("Ralink RT2500 PCI & PCMCIA Wireless LAN driver.");
2122−MODULE_SUPPORTED_DEVICE("Ralink RT2560 PCI & PCMCIA chipset based cards");
21232122 MODULE_DEVICE_TABLE(pci, rt2500pci_device_table);
21242123 MODULE_LICENSE("GPL");
21252124
drivers/net/wireless/ralink/rt2x00/rt2500usb.c+0−1
@@ -1956,7 +1956,6 @@ static const struct usb_device_id rt2500usb_device_table[] = { · 1955 unmodified lines
19561956 MODULE_AUTHOR(DRV_PROJECT);
19571957 MODULE_VERSION(DRV_VERSION);
19581958 MODULE_DESCRIPTION("Ralink RT2500 USB Wireless LAN driver.");
1959−MODULE_SUPPORTED_DEVICE("Ralink RT2570 USB chipset based cards");
19601959 MODULE_DEVICE_TABLE(usb, rt2500usb_device_table);
19611960 MODULE_LICENSE("GPL");
19621961
drivers/net/wireless/ralink/rt2x00/rt2800pci.c+0−1
@@ -439,7 +439,6 @@ static const struct pci_device_id rt2800pci_device_table[] = { · 438 unmodified lines
439439 MODULE_AUTHOR(DRV_PROJECT);
440440 MODULE_VERSION(DRV_VERSION);
441441 MODULE_DESCRIPTION("Ralink RT2800 PCI & PCMCIA Wireless LAN driver.");
442−MODULE_SUPPORTED_DEVICE("Ralink RT2860 PCI & PCMCIA chipset based cards");
443442 MODULE_FIRMWARE(FIRMWARE_RT2860);
444443 MODULE_DEVICE_TABLE(pci, rt2800pci_device_table);
445444 MODULE_LICENSE("GPL");
drivers/net/wireless/ralink/rt2x00/rt2800usb.c+0−1
@@ -1248,7 +1248,6 @@ static const struct usb_device_id rt2800usb_device_table[] = { · 1247 unmodified lines
12481248 MODULE_AUTHOR(DRV_PROJECT);
12491249 MODULE_VERSION(DRV_VERSION);
12501250 MODULE_DESCRIPTION("Ralink RT2800 USB Wireless LAN driver.");
1251−MODULE_SUPPORTED_DEVICE("Ralink RT2870 USB chipset based cards");
12521251 MODULE_DEVICE_TABLE(usb, rt2800usb_device_table);
12531252 MODULE_FIRMWARE(FIRMWARE_RT2870);
12541253 MODULE_LICENSE("GPL");
drivers/net/wireless/ralink/rt2x00/rt61pci.c+0−2
@@ -2993,8 +2993,6 @@ static const struct pci_device_id rt61pci_device_table[] = { · 2992 unmodified lines
29932993 MODULE_AUTHOR(DRV_PROJECT);
29942994 MODULE_VERSION(DRV_VERSION);
29952995 MODULE_DESCRIPTION("Ralink RT61 PCI & PCMCIA Wireless LAN driver.");
2996−MODULE_SUPPORTED_DEVICE("Ralink RT2561, RT2561s & RT2661 "
2997− "PCI & PCMCIA chipset based cards");
29982996 MODULE_DEVICE_TABLE(pci, rt61pci_device_table);
29992997 MODULE_FIRMWARE(FIRMWARE_RT2561);
30002998 MODULE_FIRMWARE(FIRMWARE_RT2561s);
drivers/net/wireless/ralink/rt2x00/rt73usb.c+0−1
@@ -2513,7 +2513,6 @@ static const struct usb_device_id rt73usb_device_table[] = { · 2512 unmodified lines
25132513 MODULE_AUTHOR(DRV_PROJECT);
25142514 MODULE_VERSION(DRV_VERSION);
25152515 MODULE_DESCRIPTION("Ralink RT73 USB Wireless LAN driver.");
2516−MODULE_SUPPORTED_DEVICE("Ralink RT2571W & RT2671 USB chipset based cards");
25172516 MODULE_DEVICE_TABLE(usb, rt73usb_device_table);
25182517 MODULE_FIRMWARE(FIRMWARE_RT2571);
25192518 MODULE_LICENSE("GPL");
drivers/net/wireless/rsi/rsi_91x_main.c+0−1
@@ -441,6 +441,5 @@ module_init(rsi_91x_hal_module_init); · 440 unmodified lines
441441 module_exit(rsi_91x_hal_module_exit);
442442 MODULE_AUTHOR("Redpine Signals Inc");
443443 MODULE_DESCRIPTION("Station driver for RSI 91x devices");
444−MODULE_SUPPORTED_DEVICE("RSI-91x");
445444 MODULE_VERSION("0.1");
446445 MODULE_LICENSE("Dual BSD/GPL");
drivers/net/wireless/rsi/rsi_91x_sdio.c+0−1
@@ -1571,7 +1571,6 @@ module_exit(rsi_module_exit); · 1570 unmodified lines
15711571
15721572 MODULE_AUTHOR("Redpine Signals Inc");
15731573 MODULE_DESCRIPTION("Common SDIO layer for RSI drivers");
1574−MODULE_SUPPORTED_DEVICE("RSI-91x");
15751574 MODULE_DEVICE_TABLE(sdio, rsi_dev_table);
15761575 MODULE_FIRMWARE(FIRMWARE_RSI9113);
15771576 MODULE_VERSION("0.1");
drivers/net/wireless/rsi/rsi_91x_usb.c+0−1
@@ -928,7 +928,6 @@ module_usb_driver(rsi_driver); · 927 unmodified lines
928928
929929 MODULE_AUTHOR("Redpine Signals Inc");
930930 MODULE_DESCRIPTION("Common USB layer for RSI drivers");
931−MODULE_SUPPORTED_DEVICE("RSI-91x");
932931 MODULE_DEVICE_TABLE(usb, rsi_dev_table);
933932 MODULE_FIRMWARE(FIRMWARE_RSI9113);
934933 MODULE_VERSION("0.1");
drivers/nvme/host/core.c+32−47
@@ -380,6 +380,7 @@ bool nvme_cancel_request(struct request *req, void *data, bool reserved) · 379 unmodified lines
380380 return true;
381381
382382 nvme_req(req)->status = NVME_SC_HOST_ABORTED_CMD;
383+ nvme_req(req)->flags |= NVME_REQ_CANCELLED;
383384 blk_mq_complete_request(req);
384385 return true;
385386 }
@@ -1225,28 +1226,12 @@ static void nvme_keep_alive_end_io(struct request *rq, blk_status_t status) · 839 unmodified lines
12251226 queue_delayed_work(nvme_wq, &ctrl->ka_work, ctrl->kato * HZ);
12261227 }
12271228
1228−static int nvme_keep_alive(struct nvme_ctrl *ctrl)
1229−{
1230− struct request *rq;
1231−
1232− rq = nvme_alloc_request(ctrl->admin_q, &ctrl->ka_cmd,
1233− BLK_MQ_REQ_RESERVED);
1234− if (IS_ERR(rq))
1235− return PTR_ERR(rq);
1236−
1237− rq->timeout = ctrl->kato * HZ;
1238− rq->end_io_data = ctrl;
1239−
1240− blk_execute_rq_nowait(NULL, rq, 0, nvme_keep_alive_end_io);
1241−
1242− return 0;
1243−}
1244−
12451229 static void nvme_keep_alive_work(struct work_struct *work)
12461230 {
12471231 struct nvme_ctrl *ctrl = container_of(to_delayed_work(work),
12481232 struct nvme_ctrl, ka_work);
12491233 bool comp_seen = ctrl->comp_seen;
1234+ struct request *rq;
12501235
12511236 if ((ctrl->ctratt & NVME_CTRL_ATTR_TBKAS) && comp_seen) {
12521237 dev_dbg(ctrl->device,
@@ -1256,12 +1241,18 @@ static void nvme_keep_alive_work(struct work_struct *work) · 3 unmodified lines
12561241 return;
12571242 }
12581243
1259− if (nvme_keep_alive(ctrl)) {
1244+ rq = nvme_alloc_request(ctrl->admin_q, &ctrl->ka_cmd,
1245+ BLK_MQ_REQ_RESERVED | BLK_MQ_REQ_NOWAIT);
1246+ if (IS_ERR(rq)) {
12601247 /* allocation failure, reset the controller */
1261− dev_err(ctrl->device, "keep-alive failed\n");
1248+ dev_err(ctrl->device, "keep-alive failed: %ld\n", PTR_ERR(rq));
12621249 nvme_reset_ctrl(ctrl);
12631250 return;
12641251 }
1252+
1253+ rq->timeout = ctrl->kato * HZ;
1254+ rq->end_io_data = ctrl;
1255+ blk_execute_rq_nowait(NULL, rq, 0, nvme_keep_alive_end_io);
12651256 }
12661257
12671258 static void nvme_start_keep_alive(struct nvme_ctrl *ctrl)
@@ -1440,7 +1431,7 @@ static int nvme_identify_ns(struct nvme_ctrl *ctrl, unsigned nsid, · 172 unmodified lines
14401431 goto out_free_id;
14411432 }
14421433
1443− error = -ENODEV;
1434+ error = NVME_SC_INVALID_NS | NVME_SC_DNR;
14441435 if ((*id)->ncap == 0) /* namespace not allocated or attached */
14451436 goto out_free_id;
14461437
@@ -1963,30 +1954,18 @@ static void nvme_config_discard(struct gendisk *disk, struct nvme_ns *ns) · 516 unmodified lines
19631954 blk_queue_max_write_zeroes_sectors(queue, UINT_MAX);
19641955 }
19651956
1966−static void nvme_config_write_zeroes(struct gendisk *disk, struct nvme_ns *ns)
1957+/*
1958+ * Even though NVMe spec explicitly states that MDTS is not applicable to the
1959+ * write-zeroes, we are cautious and limit the size to the controllers
1960+ * max_hw_sectors value, which is based on the MDTS field and possibly other
1961+ * limiting factors.
1962+ */
1963+static void nvme_config_write_zeroes(struct request_queue *q,
1964+ struct nvme_ctrl *ctrl)
19671965 {
1968− u64 max_blocks;
1969−
1970− if (!(ns->ctrl->oncs & NVME_CTRL_ONCS_WRITE_ZEROES) ||
1971− (ns->ctrl->quirks & NVME_QUIRK_DISABLE_WRITE_ZEROES))
1972− return;
1973− /*
1974− * Even though NVMe spec explicitly states that MDTS is not
1975− * applicable to the write-zeroes:- "The restriction does not apply to
1976− * commands that do not transfer data between the host and the
1977− * controller (e.g., Write Uncorrectable ro Write Zeroes command).".
1978− * In order to be more cautious use controller's max_hw_sectors value
1979− * to configure the maximum sectors for the write-zeroes which is
1980− * configured based on the controller's MDTS field in the
1981− * nvme_init_identify() if available.
1982− */
1983− if (ns->ctrl->max_hw_sectors == UINT_MAX)
1984− max_blocks = (u64)USHRT_MAX + 1;
1985− else
1986− max_blocks = ns->ctrl->max_hw_sectors + 1;
1987−
1988− blk_queue_max_write_zeroes_sectors(disk->queue,
1989− nvme_lba_to_sect(ns, max_blocks));
1966+ if ((ctrl->oncs & NVME_CTRL_ONCS_WRITE_ZEROES) &&
1967+ !(ctrl->quirks & NVME_QUIRK_DISABLE_WRITE_ZEROES))
1968+ blk_queue_max_write_zeroes_sectors(q, ctrl->max_hw_sectors);
19901969 }
19911970
19921971 static bool nvme_ns_ids_valid(struct nvme_ns_ids *ids)
@@ -2158,7 +2137,7 @@ static void nvme_update_disk_info(struct gendisk *disk, · 165 unmodified lines
21582137 set_capacity_and_notify(disk, capacity);
21592138
21602139 nvme_config_discard(disk, ns);
2161− nvme_config_write_zeroes(disk, ns);
2140+ nvme_config_write_zeroes(disk->queue, ns->ctrl);
21622141
21632142 set_disk_ro(disk, (id->nsattr & NVME_NS_ATTR_RO) ||
21642143 test_bit(NVME_NS_FORCE_RO, &ns->flags));
@@ -4038,7 +4017,7 @@ static void nvme_ns_remove_by_nsid(struct nvme_ctrl *ctrl, u32 nsid) · 1873 unmodified lines
40384017 static void nvme_validate_ns(struct nvme_ns *ns, struct nvme_ns_ids *ids)
40394018 {
40404019 struct nvme_id_ns *id;
4041− int ret = -ENODEV;
4020+ int ret = NVME_SC_INVALID_NS | NVME_SC_DNR;
40424021
40434022 if (test_bit(NVME_NS_DEAD, &ns->flags))
40444023 goto out;
@@ -4047,7 +4026,7 @@ static void nvme_validate_ns(struct nvme_ns *ns, struct nvme_ns_ids *ids) · 2 unmodified lines
40474026 if (ret)
40484027 goto out;
40494028
4050− ret = -ENODEV;
4029+ ret = NVME_SC_INVALID_NS | NVME_SC_DNR;
40514030 if (!nvme_ns_ids_equal(&ns->head->ids, ids)) {
40524031 dev_err(ns->ctrl->device,
40534032 "identifiers changed for nsid %d\n", ns->head->ns_id);
@@ -4065,7 +4044,7 @@ out: · 11 unmodified lines
40654044 *
40664045 * TODO: we should probably schedule a delayed retry here.
40674046 */
4068− if (ret && ret != -ENOMEM && !(ret > 0 && !(ret & NVME_SC_DNR)))
4047+ if (ret > 0 && (ret & NVME_SC_DNR))
40694048 nvme_ns_remove(ns);
40704049 }
40714050
@@ -4095,6 +4074,12 @@ static void nvme_validate_or_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid) · 23 unmodified lines
40954074 nsid);
40964075 break;
40974076 }
4077+ if (!nvme_multi_css(ctrl)) {
4078+ dev_warn(ctrl->device,
4079+ "command set not reported for nsid: %d\n",
4080+ nsid);
4081+ break;
4082+ }
40984083 nvme_alloc_ns(ctrl, nsid, &ids);
40994084 break;
41004085 default:
drivers/nvme/host/fabrics.h+7−0
@@ -18,6 +18,13 @@ · 17 unmodified lines
1818 /* default is -1: the fail fast mechanism is disabled */
1919 #define NVMF_DEF_FAIL_FAST_TMO -1
2020
21+/*
22+ * Reserved one command for internal usage. This command is used for sending
23+ * the connect command, as well as for the keep alive command on the admin
24+ * queue once live.
25+ */
26+#define NVMF_RESERVED_TAGS 1
27+
2128 /*
2229 * Define a host as seen by the target. We allocate one at boot, but also
2330 * allow the override it when creating controllers. This is both to provide
drivers/nvme/host/fc.c+5−4
@@ -1956,7 +1956,7 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req) · 1955 unmodified lines
19561956 sizeof(op->rsp_iu), DMA_FROM_DEVICE);
19571957
19581958 if (opstate == FCPOP_STATE_ABORTED)
1959− status = cpu_to_le16(NVME_SC_HOST_PATH_ERROR << 1);
1959+ status = cpu_to_le16(NVME_SC_HOST_ABORTED_CMD << 1);
19601960 else if (freq->status) {
19611961 status = cpu_to_le16(NVME_SC_HOST_PATH_ERROR << 1);
19621962 dev_info(ctrl->ctrl.device,
@@ -2055,7 +2055,7 @@ done: · 92 unmodified lines
20552055 nvme_fc_complete_rq(rq);
20562056
20572057 check_error:
2058− if (terminate_assoc)
2058+ if (terminate_assoc && ctrl->ctrl.state != NVME_CTRL_RESETTING)
20592059 queue_work(nvme_reset_wq, &ctrl->ioerr_work);
20602060 }
20612061
@@ -2443,6 +2443,7 @@ nvme_fc_terminate_exchange(struct request *req, void *data, bool reserved) · 381 unmodified lines
24432443 struct nvme_fc_ctrl *ctrl = to_fc_ctrl(nctrl);
24442444 struct nvme_fc_fcp_op *op = blk_mq_rq_to_pdu(req);
24452445
2446+ op->nreq.flags |= NVME_REQ_CANCELLED;
24462447 __nvme_fc_abort_op(ctrl, op);
24472448 return true;
24482449 }
@@ -2862,7 +2863,7 @@ nvme_fc_create_io_queues(struct nvme_fc_ctrl *ctrl) · 413 unmodified lines
28622863 memset(&ctrl->tag_set, 0, sizeof(ctrl->tag_set));
28632864 ctrl->tag_set.ops = &nvme_fc_mq_ops;
28642865 ctrl->tag_set.queue_depth = ctrl->ctrl.opts->queue_size;
2865− ctrl->tag_set.reserved_tags = 1; /* fabric connect */
2866+ ctrl->tag_set.reserved_tags = NVMF_RESERVED_TAGS;
28662867 ctrl->tag_set.numa_node = ctrl->ctrl.numa_node;
28672868 ctrl->tag_set.flags = BLK_MQ_F_SHOULD_MERGE;
28682869 ctrl->tag_set.cmd_size =
@@ -3484,7 +3485,7 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, · 615 unmodified lines
34843485 memset(&ctrl->admin_tag_set, 0, sizeof(ctrl->admin_tag_set));
34853486 ctrl->admin_tag_set.ops = &nvme_fc_admin_mq_ops;
34863487 ctrl->admin_tag_set.queue_depth = NVME_AQ_MQ_TAG_DEPTH;
3487− ctrl->admin_tag_set.reserved_tags = 2; /* fabric connect + Keep-Alive */
3488+ ctrl->admin_tag_set.reserved_tags = NVMF_RESERVED_TAGS;
34883489 ctrl->admin_tag_set.numa_node = ctrl->ctrl.numa_node;
34893490 ctrl->admin_tag_set.cmd_size =
34903491 struct_size((struct nvme_fcp_op_w_sgl *)NULL, priv,
drivers/nvme/host/pci.c+1−0
@@ -3246,6 +3246,7 @@ static const struct pci_device_id nvme_id_table[] = { · 3245 unmodified lines
32463246 .driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY, },
32473247 { PCI_DEVICE(0x144d, 0xa822), /* Samsung PM1725a */
32483248 .driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY |
3249+ NVME_QUIRK_DISABLE_WRITE_ZEROES|
32493250 NVME_QUIRK_IGNORE_DEV_SUBNQN, },
32503251 { PCI_DEVICE(0x1987, 0x5016), /* Phison E16 */
32513252 .driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN, },
drivers/nvme/host/rdma.c+7−4
@@ -736,8 +736,11 @@ static int nvme_rdma_alloc_io_queues(struct nvme_rdma_ctrl *ctrl) · 735 unmodified lines
736736 return ret;
737737
738738 ctrl->ctrl.queue_count = nr_io_queues + 1;
739− if (ctrl->ctrl.queue_count < 2)
740− return 0;
739+ if (ctrl->ctrl.queue_count < 2) {
740+ dev_err(ctrl->ctrl.device,
741+ "unable to set any I/O queues\n");
742+ return -ENOMEM;
743+ }
741744
742745 dev_info(ctrl->ctrl.device,
743746 "creating %d I/O queues.\n", nr_io_queues);
@@ -798,7 +801,7 @@ static struct blk_mq_tag_set *nvme_rdma_alloc_tagset(struct nvme_ctrl *nctrl, · 54 unmodified lines
798801 memset(set, 0, sizeof(*set));
799802 set->ops = &nvme_rdma_admin_mq_ops;
800803 set->queue_depth = NVME_AQ_MQ_TAG_DEPTH;
801− set->reserved_tags = 2; /* connect + keep-alive */
804+ set->reserved_tags = NVMF_RESERVED_TAGS;
802805 set->numa_node = nctrl->numa_node;
803806 set->cmd_size = sizeof(struct nvme_rdma_request) +
804807 NVME_RDMA_DATA_SGL_SIZE;
@@ -811,7 +814,7 @@ static struct blk_mq_tag_set *nvme_rdma_alloc_tagset(struct nvme_ctrl *nctrl, · 6 unmodified lines
811814 memset(set, 0, sizeof(*set));
812815 set->ops = &nvme_rdma_mq_ops;
813816 set->queue_depth = nctrl->sqsize + 1;
814− set->reserved_tags = 1; /* fabric connect */
817+ set->reserved_tags = NVMF_RESERVED_TAGS;
815818 set->numa_node = nctrl->numa_node;
816819 set->flags = BLK_MQ_F_SHOULD_MERGE;
817820 set->cmd_size = sizeof(struct nvme_rdma_request) +
drivers/nvme/host/tcp.c+15−5
@@ -287,7 +287,7 @@ static inline void nvme_tcp_queue_request(struct nvme_tcp_request *req, · 286 unmodified lines
287287 * directly, otherwise queue io_work. Also, only do that if we
288288 * are on the same cpu, so we don't introduce contention.
289289 */
290− if (queue->io_cpu == __smp_processor_id() &&
290+ if (queue->io_cpu == raw_smp_processor_id() &&
291291 sync && empty && mutex_trylock(&queue->send_mutex)) {
292292 queue->more_requests = !last;
293293 nvme_tcp_send_all(queue);
@@ -568,6 +568,13 @@ static int nvme_tcp_setup_h2c_data_pdu(struct nvme_tcp_request *req, · 274 unmodified lines
568568 req->pdu_len = le32_to_cpu(pdu->r2t_length);
569569 req->pdu_sent = 0;
570570
571+ if (unlikely(!req->pdu_len)) {
572+ dev_err(queue->ctrl->ctrl.device,
573+ "req %d r2t len is %u, probably a bug...\n",
574+ rq->tag, req->pdu_len);
575+ return -EPROTO;
576+ }
577+
571578 if (unlikely(req->data_sent + req->pdu_len > req->data_len)) {
572579 dev_err(queue->ctrl->ctrl.device,
573580 "req %d r2t len %u exceeded data len %u (%zu sent)\n",
@@ -1575,7 +1582,7 @@ static struct blk_mq_tag_set *nvme_tcp_alloc_tagset(struct nvme_ctrl *nctrl, · 1001 unmodified lines
15751582 memset(set, 0, sizeof(*set));
15761583 set->ops = &nvme_tcp_admin_mq_ops;
15771584 set->queue_depth = NVME_AQ_MQ_TAG_DEPTH;
1578− set->reserved_tags = 2; /* connect + keep-alive */
1585+ set->reserved_tags = NVMF_RESERVED_TAGS;
15791586 set->numa_node = nctrl->numa_node;
15801587 set->flags = BLK_MQ_F_BLOCKING;
15811588 set->cmd_size = sizeof(struct nvme_tcp_request);
@@ -1587,7 +1594,7 @@ static struct blk_mq_tag_set *nvme_tcp_alloc_tagset(struct nvme_ctrl *nctrl, · 5 unmodified lines
15871594 memset(set, 0, sizeof(*set));
15881595 set->ops = &nvme_tcp_mq_ops;
15891596 set->queue_depth = nctrl->sqsize + 1;
1590− set->reserved_tags = 1; /* fabric connect */
1597+ set->reserved_tags = NVMF_RESERVED_TAGS;
15911598 set->numa_node = nctrl->numa_node;
15921599 set->flags = BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_BLOCKING;
15931600 set->cmd_size = sizeof(struct nvme_tcp_request);
@@ -1745,8 +1752,11 @@ static int nvme_tcp_alloc_io_queues(struct nvme_ctrl *ctrl) · 151 unmodified lines
17451752 return ret;
17461753
17471754 ctrl->queue_count = nr_io_queues + 1;
1748− if (ctrl->queue_count < 2)
1749− return 0;
1755+ if (ctrl->queue_count < 2) {
1756+ dev_err(ctrl->device,
1757+ "unable to set any I/O queues\n");
1758+ return -ENOMEM;
1759+ }
17501760
17511761 dev_info(ctrl->device,
17521762 "creating %d I/O queues.\n", nr_io_queues);
drivers/nvme/host/zns.c+7−2
@@ -9,7 +9,13 @@ · 8 unmodified lines
99
1010 int nvme_revalidate_zones(struct nvme_ns *ns)
1111 {
12− return blk_revalidate_disk_zones(ns->disk, NULL);
12+ struct request_queue *q = ns->queue;
13+ int ret;
14+
15+ ret = blk_revalidate_disk_zones(ns->disk, NULL);
16+ if (!ret)
17+ blk_queue_max_zone_append_sectors(q, ns->ctrl->max_zone_append);
18+ return ret;
1319 }
1420
1521 static int nvme_set_max_append(struct nvme_ctrl *ctrl)
@@ -107,7 +113,6 @@ int nvme_update_zone_info(struct nvme_ns *ns, unsigned lbaf) · 91 unmodified lines
107113 blk_queue_flag_set(QUEUE_FLAG_ZONE_RESETALL, q);
108114 blk_queue_max_open_zones(q, le32_to_cpu(id->mor) + 1);
109115 blk_queue_max_active_zones(q, le32_to_cpu(id->mar) + 1);
110− blk_queue_max_zone_append_sectors(q, ns->ctrl->max_zone_append);
111116 free_data:
112117 kfree(id);
113118 return status;
drivers/nvme/target/core.c+14−3
@@ -1118,9 +1118,20 @@ static void nvmet_start_ctrl(struct nvmet_ctrl *ctrl) · 1117 unmodified lines
11181118 {
11191119 lockdep_assert_held(&ctrl->lock);
11201120
1121− if (nvmet_cc_iosqes(ctrl->cc) != NVME_NVM_IOSQES ||
1122− nvmet_cc_iocqes(ctrl->cc) != NVME_NVM_IOCQES ||
1123− nvmet_cc_mps(ctrl->cc) != 0 ||
1121+ /*
1122+ * Only I/O controllers should verify iosqes,iocqes.
1123+ * Strictly speaking, the spec says a discovery controller
1124+ * should verify iosqes,iocqes are zeroed, however that
1125+ * would break backwards compatibility, so don't enforce it.
1126+ */
1127+ if (ctrl->subsys->type != NVME_NQN_DISC &&
1128+ (nvmet_cc_iosqes(ctrl->cc) != NVME_NVM_IOSQES ||
1129+ nvmet_cc_iocqes(ctrl->cc) != NVME_NVM_IOCQES)) {
1130+ ctrl->csts = NVME_CSTS_CFS;
1131+ return;
1132+ }
1133+
1134+ if (nvmet_cc_mps(ctrl->cc) != 0 ||
11241135 nvmet_cc_ams(ctrl->cc) != 0 ||
11251136 nvmet_cc_css(ctrl->cc) != 0) {
11261137 ctrl->csts = NVME_CSTS_CFS;
drivers/nvme/target/loop.c+2−2
@@ -349,7 +349,7 @@ static int nvme_loop_configure_admin_queue(struct nvme_loop_ctrl *ctrl) · 348 unmodified lines
349349 memset(&ctrl->admin_tag_set, 0, sizeof(ctrl->admin_tag_set));
350350 ctrl->admin_tag_set.ops = &nvme_loop_admin_mq_ops;
351351 ctrl->admin_tag_set.queue_depth = NVME_AQ_MQ_TAG_DEPTH;
352− ctrl->admin_tag_set.reserved_tags = 2; /* connect + keep-alive */
352+ ctrl->admin_tag_set.reserved_tags = NVMF_RESERVED_TAGS;
353353 ctrl->admin_tag_set.numa_node = ctrl->ctrl.numa_node;
354354 ctrl->admin_tag_set.cmd_size = sizeof(struct nvme_loop_iod) +
355355 NVME_INLINE_SG_CNT * sizeof(struct scatterlist);
@@ -520,7 +520,7 @@ static int nvme_loop_create_io_queues(struct nvme_loop_ctrl *ctrl) · 164 unmodified lines
520520 memset(&ctrl->tag_set, 0, sizeof(ctrl->tag_set));
521521 ctrl->tag_set.ops = &nvme_loop_mq_ops;
522522 ctrl->tag_set.queue_depth = ctrl->ctrl.opts->queue_size;
523− ctrl->tag_set.reserved_tags = 1; /* fabric connect */
523+ ctrl->tag_set.reserved_tags = NVMF_RESERVED_TAGS;
524524 ctrl->tag_set.numa_node = ctrl->ctrl.numa_node;
525525 ctrl->tag_set.flags = BLK_MQ_F_SHOULD_MERGE;
526526 ctrl->tag_set.cmd_size = sizeof(struct nvme_loop_iod) +
drivers/nvme/target/passthru.c+3−3
@@ -50,9 +50,9 @@ static u16 nvmet_passthru_override_id_ctrl(struct nvmet_req *req) · 49 unmodified lines
5050
5151 /*
5252 * nvmet_passthru_map_sg is limitted to using a single bio so limit
53− * the mdts based on BIO_MAX_PAGES as well
53+ * the mdts based on BIO_MAX_VECS as well
5454 */
55− max_hw_sectors = min_not_zero(BIO_MAX_PAGES << (PAGE_SHIFT - 9),
55+ max_hw_sectors = min_not_zero(BIO_MAX_VECS << (PAGE_SHIFT - 9),
5656 max_hw_sectors);
5757
5858 page_shift = NVME_CAP_MPSMIN(ctrl->cap) + 12;
@@ -191,7 +191,7 @@ static int nvmet_passthru_map_sg(struct nvmet_req *req, struct request *rq) · 132 unmodified lines
191191 struct bio *bio;
192192 int i;
193193
194− if (req->sg_cnt > BIO_MAX_PAGES)
194+ if (req->sg_cnt > BIO_MAX_VECS)
195195 return -EINVAL;
196196
197197 if (req->transfer_len <= NVMET_MAX_INLINE_DATA_LEN) {
drivers/nvme/target/rdma.c+2−3
@@ -802,9 +802,8 @@ static void nvmet_rdma_write_data_done(struct ib_cq *cq, struct ib_wc *wc) · 801 unmodified lines
802802 nvmet_req_uninit(&rsp->req);
803803 nvmet_rdma_release_rsp(rsp);
804804 if (wc->status != IB_WC_WR_FLUSH_ERR) {
805− pr_info("RDMA WRITE for CQE 0x%p failed with status %s (%d).\n",
806− wc->wr_cqe, ib_wc_status_msg(wc->status),
807− wc->status);
805+ pr_info("RDMA WRITE for CQE failed with status %s (%d).\n",
806+ ib_wc_status_msg(wc->status), wc->status);
808807 nvmet_rdma_error_comp(queue);
809808 }
810809 return;
drivers/nvme/target/tcp.c+1−1
@@ -1098,11 +1098,11 @@ static int nvmet_tcp_try_recv_data(struct nvmet_tcp_queue *queue) · 1097 unmodified lines
10981098 cmd->rbytes_done += ret;
10991099 }
11001100
1101+ nvmet_tcp_unmap_pdu_iovec(cmd);
11011102 if (queue->data_digest) {
11021103 nvmet_tcp_prep_recv_ddgst(cmd);
11031104 return 0;
11041105 }
1105− nvmet_tcp_unmap_pdu_iovec(cmd);
11061106
11071107 if (!(cmd->flags & NVMET_TCP_F_INIT_FAILED) &&
11081108 cmd->rbytes_done == cmd->req.transfer_len) {
drivers/opp/core.c+25−23
@@ -1492,7 +1492,11 @@ static struct dev_pm_opp *_opp_get_next(struct opp_table *opp_table, · 1491 unmodified lines
14921492
14931493 mutex_lock(&opp_table->lock);
14941494 list_for_each_entry(temp, &opp_table->opp_list, node) {
1495− if (dynamic == temp->dynamic) {
1495+ /*
1496+ * Refcount must be dropped only once for each OPP by OPP core,
1497+ * do that with help of "removed" flag.
1498+ */
1499+ if (!temp->removed && dynamic == temp->dynamic) {
14961500 opp = temp;
14971501 break;
14981502 }
@@ -1502,10 +1506,27 @@ static struct dev_pm_opp *_opp_get_next(struct opp_table *opp_table, · 3 unmodified lines
15021506 return opp;
15031507 }
15041508
1505−bool _opp_remove_all_static(struct opp_table *opp_table)
1509+/*
1510+ * Can't call dev_pm_opp_put() from under the lock as debugfs removal needs to
1511+ * happen lock less to avoid circular dependency issues. This routine must be
1512+ * called without the opp_table->lock held.
1513+ */
1514+static void _opp_remove_all(struct opp_table *opp_table, bool dynamic)
15061515 {
15071516 struct dev_pm_opp *opp;
15081517
1518+ while ((opp = _opp_get_next(opp_table, dynamic))) {
1519+ opp->removed = true;
1520+ dev_pm_opp_put(opp);
1521+
1522+ /* Drop the references taken by dev_pm_opp_add() */
1523+ if (dynamic)
1524+ dev_pm_opp_put_opp_table(opp_table);
1525+ }
1526+}
1527+
1528+bool _opp_remove_all_static(struct opp_table *opp_table)
1529+{
15091530 mutex_lock(&opp_table->lock);
15101531
15111532 if (!opp_table->parsed_static_opps) {
@@ -1520,13 +1541,7 @@ bool _opp_remove_all_static(struct opp_table *opp_table) · 8 unmodified lines
15201541
15211542 mutex_unlock(&opp_table->lock);
15221543
1523− /*
1524− * Can't remove the OPP from under the lock, debugfs removal needs to
1525− * happen lock less to avoid circular dependency issues.
1526− */
1527− while ((opp = _opp_get_next(opp_table, false)))
1528− dev_pm_opp_put(opp);
1529−
1544+ _opp_remove_all(opp_table, false);
15301545 return true;
15311546 }
15321547
@@ -1539,25 +1554,12 @@ bool _opp_remove_all_static(struct opp_table *opp_table) · 6 unmodified lines
15391554 void dev_pm_opp_remove_all_dynamic(struct device *dev)
15401555 {
15411556 struct opp_table *opp_table;
1542− struct dev_pm_opp *opp;
1543− int count = 0;
15441557
15451558 opp_table = _find_opp_table(dev);
15461559 if (IS_ERR(opp_table))
15471560 return;
15481561
1549− /*
1550− * Can't remove the OPP from under the lock, debugfs removal needs to
1551− * happen lock less to avoid circular dependency issues.
1552− */
1553− while ((opp = _opp_get_next(opp_table, true))) {
1554− dev_pm_opp_put(opp);
1555− count++;
1556− }
1557−
1558− /* Drop the references taken by dev_pm_opp_add() */
1559− while (count--)
1560− dev_pm_opp_put_opp_table(opp_table);
1562+ _opp_remove_all(opp_table, true);
15611563
15621564 /* Drop the reference taken by _find_opp_table() */
15631565 dev_pm_opp_put_opp_table(opp_table);
drivers/opp/opp.h+2−0
@@ -56,6 +56,7 @@ extern struct list_head opp_tables, lazy_opp_tables; · 55 unmodified lines
5656 * @dynamic: not-created from static DT entries.
5757 * @turbo: true if turbo (boost) OPP
5858 * @suspend: true if suspend OPP
59+ * @removed: flag indicating that OPP's reference is dropped by OPP core.
5960 * @pstate: Device's power domain's performance state.
6061 * @rate: Frequency in hertz
6162 * @level: Performance level
@@ -78,6 +79,7 @@ struct dev_pm_opp { · 16 unmodified lines
7879 bool dynamic;
7980 bool turbo;
8081 bool suspend;
82+ bool removed;
8183 unsigned int pstate;
8284 unsigned long rate;
8385 unsigned int level;
drivers/parport/parport_amiga.c+0−1
@@ -241,6 +241,5 @@ module_platform_driver_probe(amiga_parallel_driver, amiga_parallel_probe); · 240 unmodified lines
241241
242242 MODULE_AUTHOR("Joerg Dorchain <joerg@dorchain.net>");
243243 MODULE_DESCRIPTION("Parport Driver for Amiga builtin Port");
244−MODULE_SUPPORTED_DEVICE("Amiga builtin Parallel Port");
245244 MODULE_LICENSE("GPL");
246245 MODULE_ALIAS("platform:amiga-parallel");
drivers/parport/parport_atari.c+0−1
@@ -218,7 +218,6 @@ static void __exit parport_atari_exit(void) · 217 unmodified lines
218218
219219 MODULE_AUTHOR("Andreas Schwab");
220220 MODULE_DESCRIPTION("Parport Driver for Atari builtin Port");
221−MODULE_SUPPORTED_DEVICE("Atari builtin Parallel Port");
222221 MODULE_LICENSE("GPL");
223222
224223 module_init(parport_atari_init)
drivers/parport/parport_gsc.c+0−1
@@ -41,7 +41,6 @@ · 40 unmodified lines
4141
4242 MODULE_AUTHOR("Helge Deller <deller@gmx.de>");
4343 MODULE_DESCRIPTION("HP-PARISC PC-style parallel port driver");
44−MODULE_SUPPORTED_DEVICE("integrated PC-style parallel port");
4544 MODULE_LICENSE("GPL");
4645
4746
drivers/parport/parport_mfc3.c+0−1
@@ -359,7 +359,6 @@ static void __exit parport_mfc3_exit(void) · 358 unmodified lines
359359
360360 MODULE_AUTHOR("Joerg Dorchain <joerg@dorchain.net>");
361361 MODULE_DESCRIPTION("Parport Driver for Multiface 3 expansion cards Parallel Port");
362−MODULE_SUPPORTED_DEVICE("Multiface 3 Parallel Port");
363362 MODULE_LICENSE("GPL");
364363
365364 module_init(parport_mfc3_init)
drivers/parport/parport_sunbpp.c+0−1
@@ -377,6 +377,5 @@ module_platform_driver(bpp_sbus_driver); · 376 unmodified lines
377377
378378 MODULE_AUTHOR("Derrick J Brashear");
379379 MODULE_DESCRIPTION("Parport Driver for Sparc bidirectional Port");
380−MODULE_SUPPORTED_DEVICE("Sparc Bidirectional Parallel Port");
381380 MODULE_VERSION("2.0");
382381 MODULE_LICENSE("GPL");
drivers/pci/hotplug/rpadlpar_sysfs.c+6−8
@@ -34,12 +34,11 @@ static ssize_t add_slot_store(struct kobject *kobj, struct kobj_attribute *attr, · 33 unmodified lines
3434 if (nbytes >= MAX_DRC_NAME_LEN)
3535 return 0;
3636
37− memcpy(drc_name, buf, nbytes);
37+ strscpy(drc_name, buf, nbytes + 1);
3838
3939 end = strchr(drc_name, '\n');
40− if (!end)
41− end = &drc_name[nbytes];
42− *end = '\0';
40+ if (end)
41+ *end = '\0';
4342
4443 rc = dlpar_add_slot(drc_name);
4544 if (rc)
@@ -65,12 +64,11 @@ static ssize_t remove_slot_store(struct kobject *kobj, · 19 unmodified lines
6564 if (nbytes >= MAX_DRC_NAME_LEN)
6665 return 0;
6766
68− memcpy(drc_name, buf, nbytes);
67+ strscpy(drc_name, buf, nbytes + 1);
6968
7069 end = strchr(drc_name, '\n');
71− if (!end)
72− end = &drc_name[nbytes];
73− *end = '\0';
70+ if (end)
71+ *end = '\0';
7472
7573 rc = dlpar_remove_slot(drc_name);
7674 if (rc)
drivers/pci/hotplug/s390_pci_hpc.c+2−1
@@ -93,8 +93,9 @@ static int disable_slot(struct hotplug_slot *hotplug_slot) · 92 unmodified lines
9393 pci_dev_put(pdev);
9494 return -EBUSY;
9595 }
96+ pci_dev_put(pdev);
9697
97− zpci_remove_device(zdev);
98+ zpci_remove_device(zdev, false);
9899
99100 rc = zpci_disable_device(zdev);
100101 if (rc)
drivers/pci/xen-pcifront.c+2−2
@@ -26,7 +26,7 @@ · 25 unmodified lines
2626 #include <xen/platform_pci.h>
2727
2828 #include <asm/xen/swiotlb-xen.h>
29−#define INVALID_GRANT_REF (0)
29+
3030 #define INVALID_EVTCHN (-1)
3131
3232 struct pci_bus_entry {
@@ -42,7 +42,7 @@ struct pcifront_device { · 9 unmodified lines
4242 struct list_head root_buses;
4343
4444 int evtchn;
45− int gnt_ref;
45+ grant_ref_t gnt_ref;
4646
4747 int irq;
4848
drivers/perf/arm_dmc620_pmu.c+1−0
@@ -681,6 +681,7 @@ static int dmc620_pmu_device_probe(struct platform_device *pdev) · 680 unmodified lines
681681 if (!name) {
682682 dev_err(&pdev->dev,
683683 "Create name failed, PMU @%pa\n", &res->start);
684+ ret = -ENOMEM;
684685 goto out_teardown_dev;
685686 }
686687
drivers/platform/x86/Kconfig+8−3
@@ -1173,15 +1173,20 @@ config INTEL_PMC_CORE · 1172 unmodified lines
11731173 depends on PCI
11741174 help
11751175 The Intel Platform Controller Hub for Intel Core SoCs provides access
1176− to Power Management Controller registers via a PCI interface. This
1176+ to Power Management Controller registers via various interfaces. This
11771177 driver can utilize debugging capabilities and supported features as
1178− exposed by the Power Management Controller.
1178+ exposed by the Power Management Controller. It also may perform some
1179+ tasks in the PMC in order to enable transition into the SLPS0 state.
1180+ It should be selected on all Intel platforms supported by the driver.
11791181
11801182 Supported features:
11811183 - SLP_S0_RESIDENCY counter
11821184 - PCH IP Power Gating status
1183− - LTR Ignore
1185+ - LTR Ignore / LTR Show
11841186 - MPHY/PLL gating status (Sunrisepoint PCH only)
1187+ - SLPS0 Debug registers (Cannonlake/Icelake PCH)
1188+ - Low Power Mode registers (Tigerlake and beyond)
1189+ - PMC quirks as needed to enable SLPS0/S0ix
11851190
11861191 config INTEL_PMT_CLASS
11871192 tristate
drivers/platform/x86/dell/dell-wmi-sysman/enum-attributes.c+3−0
@@ -185,5 +185,8 @@ void exit_enum_attributes(void) · 184 unmodified lines
185185 sysfs_remove_group(wmi_priv.enumeration_data[instance_id].attr_name_kobj,
186186 &enumeration_attr_group);
187187 }
188+ wmi_priv.enumeration_instances_count = 0;
189+
188190 kfree(wmi_priv.enumeration_data);
191+ wmi_priv.enumeration_data = NULL;
189192 }
drivers/platform/x86/dell/dell-wmi-sysman/int-attributes.c+3−0
@@ -175,5 +175,8 @@ void exit_int_attributes(void) · 174 unmodified lines
175175 sysfs_remove_group(wmi_priv.integer_data[instance_id].attr_name_kobj,
176176 &integer_attr_group);
177177 }
178+ wmi_priv.integer_instances_count = 0;
179+
178180 kfree(wmi_priv.integer_data);
181+ wmi_priv.integer_data = NULL;
179182 }
drivers/platform/x86/dell/dell-wmi-sysman/passobj-attributes.c+3−0
@@ -183,5 +183,8 @@ void exit_po_attributes(void) · 182 unmodified lines
183183 sysfs_remove_group(wmi_priv.po_data[instance_id].attr_name_kobj,
184184 &po_attr_group);
185185 }
186+ wmi_priv.po_instances_count = 0;
187+
186188 kfree(wmi_priv.po_data);
189+ wmi_priv.po_data = NULL;
187190 }
drivers/platform/x86/dell/dell-wmi-sysman/string-attributes.c+3−0
@@ -155,5 +155,8 @@ void exit_str_attributes(void) · 154 unmodified lines
155155 sysfs_remove_group(wmi_priv.str_data[instance_id].attr_name_kobj,
156156 &str_attr_group);
157157 }
158+ wmi_priv.str_instances_count = 0;
159+
158160 kfree(wmi_priv.str_data);
161+ wmi_priv.str_data = NULL;
159162 }
drivers/platform/x86/dell/dell-wmi-sysman/sysman.c+32−52
@@ -210,25 +210,17 @@ static struct kobj_attribute pending_reboot = __ATTR_RO(pending_reboot); · 209 unmodified lines
210210 */
211211 static int create_attributes_level_sysfs_files(void)
212212 {
213− int ret = sysfs_create_file(&wmi_priv.main_dir_kset->kobj, &reset_bios.attr);
213+ int ret;
214214
215− if (ret) {
216− pr_debug("could not create reset_bios file\n");
215+ ret = sysfs_create_file(&wmi_priv.main_dir_kset->kobj, &reset_bios.attr);
216+ if (ret)
217217 return ret;
218− }
219218
220219 ret = sysfs_create_file(&wmi_priv.main_dir_kset->kobj, &pending_reboot.attr);
221− if (ret) {
222− pr_debug("could not create changing_pending_reboot file\n");
223− sysfs_remove_file(&wmi_priv.main_dir_kset->kobj, &reset_bios.attr);
224− }
225− return ret;
226−}
220+ if (ret)
221+ return ret;
227222
228−static void release_reset_bios_data(void)
229−{
230− sysfs_remove_file(&wmi_priv.main_dir_kset->kobj, &reset_bios.attr);
231− sysfs_remove_file(&wmi_priv.main_dir_kset->kobj, &pending_reboot.attr);
223+ return 0;
232224 }
233225
234226 static ssize_t wmi_sysman_attr_show(struct kobject *kobj, struct attribute *attr,
@@ -373,8 +365,6 @@ static void destroy_attribute_objs(struct kset *kset) · 138 unmodified lines
373365 */
374366 static void release_attributes_data(void)
375367 {
376− release_reset_bios_data();
377−
378368 mutex_lock(&wmi_priv.mutex);
379369 exit_enum_attributes();
380370 exit_int_attributes();
@@ -386,11 +376,13 @@ static void release_attributes_data(void) · 5 unmodified lines
386376 wmi_priv.authentication_dir_kset = NULL;
387377 }
388378 if (wmi_priv.main_dir_kset) {
379+ sysfs_remove_file(&wmi_priv.main_dir_kset->kobj, &reset_bios.attr);
380+ sysfs_remove_file(&wmi_priv.main_dir_kset->kobj, &pending_reboot.attr);
389381 destroy_attribute_objs(wmi_priv.main_dir_kset);
390382 kset_unregister(wmi_priv.main_dir_kset);
383+ wmi_priv.main_dir_kset = NULL;
391384 }
392385 mutex_unlock(&wmi_priv.mutex);
393−
394386 }
395387
396388 /**
@@ -497,7 +489,6 @@ nextobj: · 100 unmodified lines
497489
498490 err_attr_init:
499491 mutex_unlock(&wmi_priv.mutex);
500− release_attributes_data();
501492 kfree(obj);
502493 return retval;
503494 }
@@ -513,102 +504,91 @@ static int __init sysman_init(void) · 9 unmodified lines
513504 }
514505
515506 ret = init_bios_attr_set_interface();
516− if (ret || !wmi_priv.bios_attr_wdev) {
517− pr_debug("failed to initialize set interface\n");
518− goto fail_set_interface;
519− }
507+ if (ret)
508+ return ret;
520509
521510 ret = init_bios_attr_pass_interface();
522− if (ret || !wmi_priv.password_attr_wdev) {
523− pr_debug("failed to initialize pass interface\n");
524− goto fail_pass_interface;
511+ if (ret)
512+ goto err_exit_bios_attr_set_interface;
513+
514+ if (!wmi_priv.bios_attr_wdev || !wmi_priv.password_attr_wdev) {
515+ pr_debug("failed to find set or pass interface\n");
516+ ret = -ENODEV;
517+ goto err_exit_bios_attr_pass_interface;
525518 }
526519
527520 ret = class_register(&firmware_attributes_class);
528521 if (ret)
529− goto fail_class;
522+ goto err_exit_bios_attr_pass_interface;
530523
531524 wmi_priv.class_dev = device_create(&firmware_attributes_class, NULL, MKDEV(0, 0),
532525 NULL, "%s", DRIVER_NAME);
533526 if (IS_ERR(wmi_priv.class_dev)) {
534527 ret = PTR_ERR(wmi_priv.class_dev);
535− goto fail_classdev;
528+ goto err_unregister_class;
536529 }
537530
538531 wmi_priv.main_dir_kset = kset_create_and_add("attributes", NULL,
539532 &wmi_priv.class_dev->kobj);
540533 if (!wmi_priv.main_dir_kset) {
541534 ret = -ENOMEM;
542− goto fail_main_kset;
535+ goto err_destroy_classdev;
543536 }
544537
545538 wmi_priv.authentication_dir_kset = kset_create_and_add("authentication", NULL,
546539 &wmi_priv.class_dev->kobj);
547540 if (!wmi_priv.authentication_dir_kset) {
548541 ret = -ENOMEM;
549− goto fail_authentication_kset;
542+ goto err_release_attributes_data;
550543 }
551544
552545 ret = create_attributes_level_sysfs_files();
553546 if (ret) {
554547 pr_debug("could not create reset BIOS attribute\n");
555− goto fail_reset_bios;
548+ goto err_release_attributes_data;
556549 }
557550
558551 ret = init_bios_attributes(ENUM, DELL_WMI_BIOS_ENUMERATION_ATTRIBUTE_GUID);
559552 if (ret) {
560553 pr_debug("failed to populate enumeration type attributes\n");
561− goto fail_create_group;
554+ goto err_release_attributes_data;
562555 }
563556
564557 ret = init_bios_attributes(INT, DELL_WMI_BIOS_INTEGER_ATTRIBUTE_GUID);
565558 if (ret) {
566559 pr_debug("failed to populate integer type attributes\n");
567− goto fail_create_group;
560+ goto err_release_attributes_data;
568561 }
569562
570563 ret = init_bios_attributes(STR, DELL_WMI_BIOS_STRING_ATTRIBUTE_GUID);
571564 if (ret) {
572565 pr_debug("failed to populate string type attributes\n");
573− goto fail_create_group;
566+ goto err_release_attributes_data;
574567 }
575568
576569 ret = init_bios_attributes(PO, DELL_WMI_BIOS_PASSOBJ_ATTRIBUTE_GUID);
577570 if (ret) {
578571 pr_debug("failed to populate pass object type attributes\n");
579− goto fail_create_group;
572+ goto err_release_attributes_data;
580573 }
581574
582575 return 0;
583576
584−fail_create_group:
577+err_release_attributes_data:
585578 release_attributes_data();
586579
587−fail_reset_bios:
588− if (wmi_priv.authentication_dir_kset) {
589− kset_unregister(wmi_priv.authentication_dir_kset);
590− wmi_priv.authentication_dir_kset = NULL;
591− }
592−
593−fail_authentication_kset:
594− if (wmi_priv.main_dir_kset) {
595− kset_unregister(wmi_priv.main_dir_kset);
596− wmi_priv.main_dir_kset = NULL;
597− }
598−
599−fail_main_kset:
580+err_destroy_classdev:
600581 device_destroy(&firmware_attributes_class, MKDEV(0, 0));
601582
602−fail_classdev:
583+err_unregister_class:
603584 class_unregister(&firmware_attributes_class);
604585
605−fail_class:
586+err_exit_bios_attr_pass_interface:
606587 exit_bios_attr_pass_interface();
607588
608−fail_pass_interface:
589+err_exit_bios_attr_set_interface:
609590 exit_bios_attr_set_interface();
610591
611−fail_set_interface:
612592 return ret;
613593 }
614594
drivers/platform/x86/intel-hid.c+7−0
@@ -90,6 +90,13 @@ static const struct dmi_system_id button_array_table[] = { · 89 unmodified lines
9090 DMI_MATCH(DMI_PRODUCT_NAME, "HP Spectre x2 Detachable"),
9191 },
9292 },
93+ {
94+ .ident = "Lenovo ThinkPad X1 Tablet Gen 2",
95+ .matches = {
96+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
97+ DMI_MATCH(DMI_PRODUCT_FAMILY, "ThinkPad X1 Tablet Gen 2"),
98+ },
99+ },
93100 { }
94101 };
95102
drivers/platform/x86/intel-vbtn.c+10−2
@@ -48,8 +48,16 @@ static const struct key_entry intel_vbtn_keymap[] = { · 47 unmodified lines
4848 };
4949
5050 static const struct key_entry intel_vbtn_switchmap[] = {
51− { KE_SW, 0xCA, { .sw = { SW_DOCK, 1 } } }, /* Docked */
52− { KE_SW, 0xCB, { .sw = { SW_DOCK, 0 } } }, /* Undocked */
51+ /*
52+ * SW_DOCK should only be reported for docking stations, but DSDTs using the
53+ * intel-vbtn code, always seem to use this for 2-in-1s / convertibles and set
54+ * SW_DOCK=1 when in laptop-mode (in tandem with setting SW_TABLET_MODE=0).
55+ * This causes userspace to think the laptop is docked to a port-replicator
56+ * and to disable suspend-on-lid-close, which is undesirable.
57+ * Map the dock events to KEY_IGNORE to avoid this broken SW_DOCK reporting.
58+ */
59+ { KE_IGNORE, 0xCA, { .sw = { SW_DOCK, 1 } } }, /* Docked */
60+ { KE_IGNORE, 0xCB, { .sw = { SW_DOCK, 0 } } }, /* Undocked */
5361 { KE_SW, 0xCC, { .sw = { SW_TABLET_MODE, 1 } } }, /* Tablet */
5462 { KE_SW, 0xCD, { .sw = { SW_TABLET_MODE, 0 } } }, /* Laptop */
5563 { KE_END }
drivers/platform/x86/intel_pmc_core.c+35−15
@@ -863,34 +863,45 @@ out_unlock: · 862 unmodified lines
863863 }
864864 DEFINE_SHOW_ATTRIBUTE(pmc_core_pll);
865865
866−static ssize_t pmc_core_ltr_ignore_write(struct file *file,
867− const char __user *userbuf,
868− size_t count, loff_t *ppos)
866+static int pmc_core_send_ltr_ignore(u32 value)
869867 {
870868 struct pmc_dev *pmcdev = &pmc;
871869 const struct pmc_reg_map *map = pmcdev->map;
872− u32 val, buf_size, fd;
873− int err;
874−
875− buf_size = count < 64 ? count : 64;
876−
877− err = kstrtou32_from_user(userbuf, buf_size, 10, &val);
878− if (err)
879− return err;
870+ u32 reg;
871+ int err = 0;
880872
881873 mutex_lock(&pmcdev->lock);
882874
883− if (val > map->ltr_ignore_max) {
875+ if (value > map->ltr_ignore_max) {
884876 err = -EINVAL;
885877 goto out_unlock;
886878 }
887879
888− fd = pmc_core_reg_read(pmcdev, map->ltr_ignore_offset);
889− fd |= (1U << val);
890− pmc_core_reg_write(pmcdev, map->ltr_ignore_offset, fd);
880+ reg = pmc_core_reg_read(pmcdev, map->ltr_ignore_offset);
881+ reg |= BIT(value);
882+ pmc_core_reg_write(pmcdev, map->ltr_ignore_offset, reg);
891883
892884 out_unlock:
893885 mutex_unlock(&pmcdev->lock);
886+
887+ return err;
888+}
889+
890+static ssize_t pmc_core_ltr_ignore_write(struct file *file,
891+ const char __user *userbuf,
892+ size_t count, loff_t *ppos)
893+{
894+ u32 buf_size, value;
895+ int err;
896+
897+ buf_size = min_t(u32, count, 64);
898+
899+ err = kstrtou32_from_user(userbuf, buf_size, 10, &value);
900+ if (err)
901+ return err;
902+
903+ err = pmc_core_send_ltr_ignore(value);
904+
894905 return err == 0 ? count : err;
895906 }
896907
@@ -1244,6 +1255,15 @@ static int pmc_core_probe(struct platform_device *pdev) · 347 unmodified lines
12441255 pmcdev->pmc_xram_read_bit = pmc_core_check_read_lock_bit();
12451256 dmi_check_system(pmc_core_dmi_table);
12461257
1258+ /*
1259+ * On TGL, due to a hardware limitation, the GBE LTR blocks PC10 when
1260+ * a cable is attached. Tell the PMC to ignore it.
1261+ */
1262+ if (pmcdev->map == &tgl_reg_map) {
1263+ dev_dbg(&pdev->dev, "ignoring GBE LTR\n");
1264+ pmc_core_send_ltr_ignore(3);
1265+ }
1266+
12471267 pmc_core_dbgfs_register(pmcdev);
12481268
12491269 device_initialized = true;
drivers/platform/x86/intel_pmt_class.c+1−1
@@ -173,7 +173,7 @@ static int intel_pmt_dev_register(struct intel_pmt_entry *entry, · 172 unmodified lines
173173 struct intel_pmt_namespace *ns,
174174 struct device *parent)
175175 {
176− struct resource res;
176+ struct resource res = {0};
177177 struct device *dev;
178178 int ret;
179179
drivers/platform/x86/intel_pmt_crashlog.c+6−7
@@ -23,18 +23,17 @@ · 22 unmodified lines
2323 #define CRASH_TYPE_OOBMSM 1
2424
2525 /* Control Flags */
26−#define CRASHLOG_FLAG_DISABLE BIT(27)
26+#define CRASHLOG_FLAG_DISABLE BIT(28)
2727
2828 /*
29− * Bits 28 and 29 control the state of bit 31.
29+ * Bits 29 and 30 control the state of bit 31.
3030 *
31− * Bit 28 will clear bit 31, if set, allowing a new crashlog to be captured.
32− * Bit 29 will immediately trigger a crashlog to be generated, setting bit 31.
33− * Bit 30 is read-only and reserved as 0.
31+ * Bit 29 will clear bit 31, if set, allowing a new crashlog to be captured.
32+ * Bit 30 will immediately trigger a crashlog to be generated, setting bit 31.
3433 * Bit 31 is the read-only status with a 1 indicating log is complete.
3534 */
36−#define CRASHLOG_FLAG_TRIGGER_CLEAR BIT(28)
37−#define CRASHLOG_FLAG_TRIGGER_EXECUTE BIT(29)
35+#define CRASHLOG_FLAG_TRIGGER_CLEAR BIT(29)
36+#define CRASHLOG_FLAG_TRIGGER_EXECUTE BIT(30)
3837 #define CRASHLOG_FLAG_TRIGGER_COMPLETE BIT(31)
3938 #define CRASHLOG_FLAG_TRIGGER_MASK GENMASK(31, 28)
4039
drivers/platform/x86/thinkpad_acpi.c+79−29
@@ -4081,13 +4081,19 @@ static bool hotkey_notify_6xxx(const u32 hkey, · 4080 unmodified lines
40814081
40824082 case TP_HKEY_EV_KEY_NUMLOCK:
40834083 case TP_HKEY_EV_KEY_FN:
4084− case TP_HKEY_EV_KEY_FN_ESC:
40854084 /* key press events, we just ignore them as long as the EC
40864085 * is still reporting them in the normal keyboard stream */
40874086 *send_acpi_ev = false;
40884087 *ignore_acpi_ev = true;
40894088 return true;
40904089
4090+ case TP_HKEY_EV_KEY_FN_ESC:
4091+ /* Get the media key status to foce the status LED to update */
4092+ acpi_evalf(hkey_handle, NULL, "GMKS", "v");
4093+ *send_acpi_ev = false;
4094+ *ignore_acpi_ev = true;
4095+ return true;
4096+
40914097 case TP_HKEY_EV_TABLET_CHANGED:
40924098 tpacpi_input_send_tabletsw();
40934099 hotkey_tablet_mode_notify_change();
@@ -9845,6 +9851,11 @@ static struct ibm_struct lcdshadow_driver_data = { · 5751 unmodified lines
98459851 * Thinkpad sensor interfaces
98469852 */
98479853
9854+#define DYTC_CMD_QUERY 0 /* To get DYTC status - enable/revision */
9855+#define DYTC_QUERY_ENABLE_BIT 8 /* Bit 8 - 0 = disabled, 1 = enabled */
9856+#define DYTC_QUERY_SUBREV_BIT 16 /* Bits 16 - 27 - sub revision */
9857+#define DYTC_QUERY_REV_BIT 28 /* Bits 28 - 31 - revision */
9858+
98489859 #define DYTC_CMD_GET 2 /* To get current IC function and mode */
98499860 #define DYTC_GET_LAPMODE_BIT 17 /* Set when in lapmode */
98509861
@@ -9855,6 +9866,7 @@ static bool has_palmsensor; · 4 unmodified lines
98559866 static bool has_lapsensor;
98569867 static bool palm_state;
98579868 static bool lap_state;
9869+static int dytc_version;
98589870
98599871 static int dytc_command(int command, int *output)
98609872 {
@@ -9869,6 +9881,33 @@ static int dytc_command(int command, int *output) · 8 unmodified lines
98699881 return 0;
98709882 }
98719883
9884+static int dytc_get_version(void)
9885+{
9886+ int err, output;
9887+
9888+ /* Check if we've been called before - and just return cached value */
9889+ if (dytc_version)
9890+ return dytc_version;
9891+
9892+ /* Otherwise query DYTC and extract version information */
9893+ err = dytc_command(DYTC_CMD_QUERY, &output);
9894+ /*
9895+ * If support isn't available (ENODEV) then don't return an error
9896+ * and don't create the sysfs group
9897+ */
9898+ if (err == -ENODEV)
9899+ return 0;
9900+ /* For all other errors we can flag the failure */
9901+ if (err)
9902+ return err;
9903+
9904+ /* Check DYTC is enabled and supports mode setting */
9905+ if (output & BIT(DYTC_QUERY_ENABLE_BIT))
9906+ dytc_version = (output >> DYTC_QUERY_REV_BIT) & 0xF;
9907+
9908+ return 0;
9909+}
9910+
98729911 static int lapsensor_get(bool *present, bool *state)
98739912 {
98749913 int output, err;
@@ -9974,7 +10013,18 @@ static int tpacpi_proxsensor_init(struct ibm_init_struct *iibm) · 99 unmodified lines
997410013 if (err)
997510014 return err;
997610015 }
9977− if (has_lapsensor) {
10016+
10017+ /* Check if we know the DYTC version, if we don't then get it */
10018+ if (!dytc_version) {
10019+ err = dytc_get_version();
10020+ if (err)
10021+ return err;
10022+ }
10023+ /*
10024+ * Platforms before DYTC version 5 claim to have a lap sensor, but it doesn't work, so we
10025+ * ignore them
10026+ */
10027+ if (has_lapsensor && (dytc_version >= 5)) {
997810028 err = sysfs_create_file(&tpacpi_pdev->dev.kobj, &dev_attr_dytc_lapmode.attr);
997910029 if (err)
998010030 return err;
@@ -9999,14 +10049,9 @@ static struct ibm_struct proxsensor_driver_data = { · 18 unmodified lines
999910049 * DYTC Platform Profile interface
1000010050 */
1000110051
10002−#define DYTC_CMD_QUERY 0 /* To get DYTC status - enable/revision */
1000310052 #define DYTC_CMD_SET 1 /* To enable/disable IC function mode */
1000410053 #define DYTC_CMD_RESET 0x1ff /* To reset back to default */
1000510054
10006−#define DYTC_QUERY_ENABLE_BIT 8 /* Bit 8 - 0 = disabled, 1 = enabled */
10007−#define DYTC_QUERY_SUBREV_BIT 16 /* Bits 16 - 27 - sub revision */
10008−#define DYTC_QUERY_REV_BIT 28 /* Bits 28 - 31 - revision */
10009−
1001010055 #define DYTC_GET_FUNCTION_BIT 8 /* Bits 8-11 - function setting */
1001110056 #define DYTC_GET_MODE_BIT 12 /* Bits 12-15 - mode setting */
1001210057
@@ -10142,8 +10187,13 @@ static int dytc_profile_set(struct platform_profile_handler *pprof, · 129 unmodified lines
1014210187 return err;
1014310188
1014410189 if (profile == PLATFORM_PROFILE_BALANCED) {
10145− /* To get back to balanced mode we just issue a reset command */
10146− err = dytc_command(DYTC_CMD_RESET, &output);
10190+ /*
10191+ * To get back to balanced mode we need to issue a reset command.
10192+ * Note we still need to disable CQL mode before hand and re-enable
10193+ * it afterwards, otherwise dytc_lapmode gets reset to 0 and stays
10194+ * stuck at 0 for aprox. 30 minutes.
10195+ */
10196+ err = dytc_cql_command(DYTC_CMD_RESET, &output);
1014710197 if (err)
1014810198 goto unlock;
1014910199 } else {
@@ -10211,28 +10261,28 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm) · 61 unmodified lines
1021110261 if (err)
1021210262 return err;
1021310263
10264+ /* Check if we know the DYTC version, if we don't then get it */
10265+ if (!dytc_version) {
10266+ err = dytc_get_version();
10267+ if (err)
10268+ return err;
10269+ }
1021410270 /* Check DYTC is enabled and supports mode setting */
10215− if (output & BIT(DYTC_QUERY_ENABLE_BIT)) {
10216− /* Only DYTC v5.0 and later has this feature. */
10217− int dytc_version;
10218−
10219− dytc_version = (output >> DYTC_QUERY_REV_BIT) & 0xF;
10220− if (dytc_version >= 5) {
10221− dbg_printk(TPACPI_DBG_INIT,
10222− "DYTC version %d: thermal mode available\n", dytc_version);
10223− /* Create platform_profile structure and register */
10224− err = platform_profile_register(&dytc_profile);
10225− /*
10226− * If for some reason platform_profiles aren't enabled
10227− * don't quit terminally.
10228− */
10229− if (err)
10230− return 0;
10271+ if (dytc_version >= 5) {
10272+ dbg_printk(TPACPI_DBG_INIT,
10273+ "DYTC version %d: thermal mode available\n", dytc_version);
10274+ /* Create platform_profile structure and register */
10275+ err = platform_profile_register(&dytc_profile);
10276+ /*
10277+ * If for some reason platform_profiles aren't enabled
10278+ * don't quit terminally.
10279+ */
10280+ if (err)
10281+ return 0;
1023110282
10232− dytc_profile_available = true;
10233− /* Ensure initial values are correct */
10234− dytc_profile_refresh();
10235− }
10283+ dytc_profile_available = true;
10284+ /* Ensure initial values are correct */
10285+ dytc_profile_refresh();
1023610286 }
1023710287 return 0;
1023810288 }
drivers/ptp/ptp_qoriq.c+7−6
@@ -189,15 +189,16 @@ int ptp_qoriq_adjfine(struct ptp_clock_info *ptp, long scaled_ppm) · 188 unmodified lines
189189 tmr_add = ptp_qoriq->tmr_add;
190190 adj = tmr_add;
191191
192− /* calculate diff as adj*(scaled_ppm/65536)/1000000
193− * and round() to the nearest integer
192+ /*
193+ * Calculate diff and round() to the nearest integer
194+ *
195+ * diff = adj * (ppb / 1000000000)
196+ * = adj * scaled_ppm / 65536000000
194197 */
195− adj *= scaled_ppm;
196− diff = div_u64(adj, 8000000);
197− diff = (diff >> 13) + ((diff >> 12) & 1);
198+ diff = mul_u64_u64_div_u64(adj, scaled_ppm, 32768000000);
199+ diff = DIV64_U64_ROUND_UP(diff, 2);
198200
199201 tmr_add = neg_adj ? tmr_add - diff : tmr_add + diff;
200−
201202 ptp_qoriq->write(&regs->ctrl_regs->tmr_add, tmr_add);
202203
203204 return 0;
drivers/regulator/mt6315-regulator.c+2−2
@@ -41,7 +41,7 @@ struct mt6315_chip { · 40 unmodified lines
4141 .type = REGULATOR_VOLTAGE, \
4242 .id = _bid, \
4343 .owner = THIS_MODULE, \
44− .n_voltages = 0xbf, \
44+ .n_voltages = 0xc0, \
4545 .linear_ranges = mt_volt_range1, \
4646 .n_linear_ranges = ARRAY_SIZE(mt_volt_range1), \
4747 .vsel_reg = _vsel, \
@@ -69,7 +69,7 @@ static unsigned int mt6315_map_mode(u32 mode) · 21 unmodified lines
6969 case MT6315_BUCK_MODE_LP:
7070 return REGULATOR_MODE_IDLE;
7171 default:
72− return -EINVAL;
72+ return REGULATOR_MODE_INVALID;
7373 }
7474 }
7575
drivers/regulator/pca9450-regulator.c+9−1
@@ -797,6 +797,14 @@ static int pca9450_i2c_probe(struct i2c_client *i2c, · 796 unmodified lines
797797 return ret;
798798 }
799799
800+ /* Clear PRESET_EN bit in BUCK123_DVS to use DVS registers */
801+ ret = regmap_clear_bits(pca9450->regmap, PCA9450_REG_BUCK123_DVS,
802+ BUCK123_PRESET_EN);
803+ if (ret) {
804+ dev_err(&i2c->dev, "Failed to clear PRESET_EN bit: %d\n", ret);
805+ return ret;
806+ }
807+
800808 /* Set reset behavior on assertion of WDOG_B signal */
801809 ret = regmap_update_bits(pca9450->regmap, PCA9450_REG_RESET_CTRL,
802810 WDOG_B_CFG_MASK, WDOG_B_CFG_COLD_LDO12);
@@ -814,7 +822,7 @@ static int pca9450_i2c_probe(struct i2c_client *i2c, · 11 unmodified lines
814822
815823 if (IS_ERR(pca9450->sd_vsel_gpio)) {
816824 dev_err(&i2c->dev, "Failed to get SD_VSEL GPIO\n");
817− return ret;
825+ return PTR_ERR(pca9450->sd_vsel_gpio);
818826 }
819827
820828 dev_info(&i2c->dev, "%s probed.\n",
drivers/regulator/qcom-rpmh-regulator.c+3−3
@@ -726,8 +726,8 @@ static const struct rpmh_vreg_hw_data pmic5_ftsmps510 = { · 725 unmodified lines
726726 static const struct rpmh_vreg_hw_data pmic5_hfsmps515 = {
727727 .regulator_type = VRM,
728728 .ops = &rpmh_regulator_vrm_ops,
729− .voltage_range = REGULATOR_LINEAR_RANGE(2800000, 0, 4, 16000),
730− .n_voltages = 5,
729+ .voltage_range = REGULATOR_LINEAR_RANGE(320000, 0, 235, 16000),
730+ .n_voltages = 236,
731731 .pmic_mode_map = pmic_mode_map_pmic5_smps,
732732 .of_map_mode = rpmh_regulator_pmic4_smps_of_map_mode,
733733 };
@@ -901,7 +901,7 @@ static const struct rpmh_vreg_init_data pm8350_vreg_data[] = { · 167 unmodified lines
901901 };
902902
903903 static const struct rpmh_vreg_init_data pm8350c_vreg_data[] = {
904− RPMH_VREG("smps1", "smp%s1", &pmic5_hfsmps510, "vdd-s1"),
904+ RPMH_VREG("smps1", "smp%s1", &pmic5_hfsmps515, "vdd-s1"),
905905 RPMH_VREG("smps2", "smp%s2", &pmic5_ftsmps510, "vdd-s2"),
906906 RPMH_VREG("smps3", "smp%s3", &pmic5_ftsmps510, "vdd-s3"),
907907 RPMH_VREG("smps4", "smp%s4", &pmic5_ftsmps510, "vdd-s4"),
drivers/regulator/rt4831-regulator.c+2−2
@@ -153,9 +153,9 @@ static int rt4831_regulator_probe(struct platform_device *pdev) · 152 unmodified lines
153153 int i, ret;
154154
155155 regmap = dev_get_regmap(pdev->dev.parent, NULL);
156− if (IS_ERR(regmap)) {
156+ if (!regmap) {
157157 dev_err(&pdev->dev, "Failed to init regmap\n");
158− return PTR_ERR(regmap);
158+ return -ENODEV;
159159 }
160160
161161 /* Configure DSV mode to normal by default */
drivers/s390/block/dasd.c+3−4
@@ -63,7 +63,6 @@ void dasd_int_handler(struct ccw_device *, unsigned long, struct irb *); · 62 unmodified lines
6363 MODULE_AUTHOR("Holger Smolinski <Holger.Smolinski@de.ibm.com>");
6464 MODULE_DESCRIPTION("Linux on S/390 DASD device driver,"
6565 " Copyright IBM Corp. 2000");
66−MODULE_SUPPORTED_DEVICE("dasd");
6766 MODULE_LICENSE("GPL");
6867
6968 /*
@@ -3052,7 +3051,8 @@ static blk_status_t do_dasd_request(struct blk_mq_hw_ctx *hctx, · 2982 unmodified lines
30523051
30533052 basedev = block->base;
30543053 spin_lock_irq(&dq->lock);
3055− if (basedev->state < DASD_STATE_READY) {
3054+ if (basedev->state < DASD_STATE_READY ||
3055+ test_bit(DASD_FLAG_OFFLINE, &basedev->flags)) {
30563056 DBF_DEV_EVENT(DBF_ERR, basedev,
30573057 "device not ready for request %p", req);
30583058 rc = BLK_STS_IOERR;
@@ -3487,8 +3487,6 @@ void dasd_generic_remove(struct ccw_device *cdev) · 428 unmodified lines
34873487 struct dasd_device *device;
34883488 struct dasd_block *block;
34893489
3490− cdev->handler = NULL;
3491−
34923490 device = dasd_device_from_cdev(cdev);
34933491 if (IS_ERR(device)) {
34943492 dasd_remove_sysfs_files(cdev);
@@ -3507,6 +3505,7 @@ void dasd_generic_remove(struct ccw_device *cdev) · 12 unmodified lines
35073505 * no quite down yet.
35083506 */
35093507 dasd_set_target_state(device, DASD_STATE_NEW);
3508+ cdev->handler = NULL;
35103509 /* dasd_delete_device destroys the device reference. */
35113510 block = device->block;
35123511 dasd_delete_device(device);
drivers/s390/char/tty3270.c+4−2
@@ -424,8 +424,10 @@ tty3270_update(struct timer_list *t) · 423 unmodified lines
424424 * last output position matches the start address
425425 * of this line.
426426 */
427− if (s->string[1] == sba[0] && s->string[2] == sba[1])
428− str += 3, len -= 3;
427+ if (s->string[1] == sba[0] && s->string[2] == sba[1]) {
428+ str += 3;
429+ len -= 3;
430+ }
429431 if (raw3270_request_add_data(wrq, str, len) != 0)
430432 break;
431433 list_del_init(&s->update);
drivers/s390/char/zcore.c+27−17
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515 #include <linux/init.h>
1616 #include <linux/slab.h>
1717 #include <linux/debugfs.h>
18+#include <linux/reboot.h>
1819
1920 #include <asm/asm-offsets.h>
2021 #include <asm/ipl.h>
@@ -238,6 +239,28 @@ static int __init zcore_reipl_init(void) · 217 unmodified lines
238239 return 0;
239240 }
240241
242+static int zcore_reboot_and_on_panic_handler(struct notifier_block *self,
243+ unsigned long event,
244+ void *data)
245+{
246+ if (hsa_available)
247+ release_hsa();
248+
249+ return NOTIFY_OK;
250+}
251+
252+static struct notifier_block zcore_reboot_notifier = {
253+ .notifier_call = zcore_reboot_and_on_panic_handler,
254+ /* we need to be notified before reipl and kdump */
255+ .priority = INT_MAX,
256+};
257+
258+static struct notifier_block zcore_on_panic_notifier = {
259+ .notifier_call = zcore_reboot_and_on_panic_handler,
260+ /* we need to be notified before reipl and kdump */
261+ .priority = INT_MAX,
262+};
263+
241264 static int __init zcore_init(void)
242265 {
243266 unsigned char arch;
@@ -293,28 +316,15 @@ static int __init zcore_init(void) · 49 unmodified lines
293316 goto fail;
294317
295318 zcore_dir = debugfs_create_dir("zcore" , NULL);
296− if (!zcore_dir) {
297− rc = -ENOMEM;
298− goto fail;
299− }
300319 zcore_reipl_file = debugfs_create_file("reipl", S_IRUSR, zcore_dir,
301320 NULL, &zcore_reipl_fops);
302− if (!zcore_reipl_file) {
303− rc = -ENOMEM;
304− goto fail_dir;
305− }
306321 zcore_hsa_file = debugfs_create_file("hsa", S_IRUSR|S_IWUSR, zcore_dir,
307322 NULL, &zcore_hsa_fops);
308− if (!zcore_hsa_file) {
309− rc = -ENOMEM;
310− goto fail_reipl_file;
311− }
312− return 0;
313323
314−fail_reipl_file:
315− debugfs_remove(zcore_reipl_file);
316−fail_dir:
317− debugfs_remove(zcore_dir);
324+ register_reboot_notifier(&zcore_reboot_notifier);
325+ atomic_notifier_chain_register(&panic_notifier_list, &zcore_on_panic_notifier);
326+
327+ return 0;
318328 fail:
319329 diag308(DIAG308_REL_HSA, NULL);
320330 return rc;
drivers/s390/cio/device_fsm.c+1−1
@@ -47,7 +47,7 @@ static void ccw_timeout_log(struct ccw_device *cdev) · 46 unmodified lines
4747 orb = &private->orb;
4848 cc = stsch(sch->schid, &schib);
4949
50− printk(KERN_WARNING "cio: ccw device timeout occurred at %llx, "
50+ printk(KERN_WARNING "cio: ccw device timeout occurred at %lx, "
5151 "device information:\n", get_tod_clock());
5252 printk(KERN_WARNING "cio: orb:\n");
5353 print_hex_dump(KERN_WARNING, "cio: ", DUMP_PREFIX_NONE, 16, 1,
drivers/s390/cio/vfio_ccw_ops.c+3−3
@@ -543,7 +543,7 @@ static ssize_t vfio_ccw_mdev_ioctl(struct mdev_device *mdev, · 542 unmodified lines
543543 if (ret)
544544 return ret;
545545
546− return copy_to_user((void __user *)arg, &info, minsz);
546+ return copy_to_user((void __user *)arg, &info, minsz) ? -EFAULT : 0;
547547 }
548548 case VFIO_DEVICE_GET_REGION_INFO:
549549 {
@@ -561,7 +561,7 @@ static ssize_t vfio_ccw_mdev_ioctl(struct mdev_device *mdev, · 11 unmodified lines
561561 if (ret)
562562 return ret;
563563
564− return copy_to_user((void __user *)arg, &info, minsz);
564+ return copy_to_user((void __user *)arg, &info, minsz) ? -EFAULT : 0;
565565 }
566566 case VFIO_DEVICE_GET_IRQ_INFO:
567567 {
@@ -582,7 +582,7 @@ static ssize_t vfio_ccw_mdev_ioctl(struct mdev_device *mdev, · 14 unmodified lines
582582 if (info.count == -1)
583583 return -EINVAL;
584584
585− return copy_to_user((void __user *)arg, &info, minsz);
585+ return copy_to_user((void __user *)arg, &info, minsz) ? -EFAULT : 0;
586586 }
587587 case VFIO_DEVICE_SET_IRQS:
588588 {
drivers/s390/crypto/vfio_ap_ops.c+1−1
@@ -1286,7 +1286,7 @@ static int vfio_ap_mdev_get_device_info(unsigned long arg) · 1285 unmodified lines
12861286 info.num_regions = 0;
12871287 info.num_irqs = 0;
12881288
1289− return copy_to_user((void __user *)arg, &info, minsz);
1289+ return copy_to_user((void __user *)arg, &info, minsz) ? -EFAULT : 0;
12901290 }
12911291
12921292 static ssize_t vfio_ap_mdev_ioctl(struct mdev_device *mdev,
drivers/sbus/char/display7seg.c+0−1
@@ -50,7 +50,6 @@ MODULE_PARM_DESC(sol_compat, · 49 unmodified lines
5050 MODULE_AUTHOR("Eric Brower <ebrower@usa.net>");
5151 MODULE_DESCRIPTION("7-Segment Display driver for Sun Microsystems CP1400/1500");
5252 MODULE_LICENSE("GPL");
53−MODULE_SUPPORTED_DEVICE("d7s");
5453
5554 struct d7s {
5655 void __iomem *regs;
drivers/scsi/hpsa.c+0−1
@@ -80,7 +80,6 @@ · 79 unmodified lines
8080 MODULE_AUTHOR("Hewlett-Packard Company");
8181 MODULE_DESCRIPTION("Driver for HP Smart Array Controller version " \
8282 HPSA_DRIVER_VERSION);
83−MODULE_SUPPORTED_DEVICE("HP Smart Array Controllers");
8483 MODULE_VERSION(HPSA_DRIVER_VERSION);
8584 MODULE_LICENSE("GPL");
8685 MODULE_ALIAS("cciss");
drivers/scsi/ibmvscsi/ibmvfc.c+38−26
@@ -21,6 +21,7 @@ · 20 unmodified lines
2121 #include <linux/bsg-lib.h>
2222 #include <asm/firmware.h>
2323 #include <asm/irq.h>
24+#include <asm/rtas.h>
2425 #include <asm/vio.h>
2526 #include <scsi/scsi.h>
2627 #include <scsi/scsi_cmnd.h>
@@ -158,6 +159,9 @@ static void ibmvfc_npiv_logout(struct ibmvfc_host *); · 131 unmodified lines
158159 static void ibmvfc_tgt_implicit_logout_and_del(struct ibmvfc_target *);
159160 static void ibmvfc_tgt_move_login(struct ibmvfc_target *);
160161
162+static void ibmvfc_release_sub_crqs(struct ibmvfc_host *);
163+static void ibmvfc_init_sub_crqs(struct ibmvfc_host *);
164+
161165 static const char *unknown_error = "unknown error";
162166
163167 static long h_reg_sub_crq(unsigned long unit_address, unsigned long ioba,
@@ -899,6 +903,9 @@ static int ibmvfc_reenable_crq_queue(struct ibmvfc_host *vhost) · 735 unmodified lines
899903 {
900904 int rc = 0;
901905 struct vio_dev *vdev = to_vio_dev(vhost->dev);
906+ unsigned long flags;
907+
908+ ibmvfc_release_sub_crqs(vhost);
902909
903910 /* Re-enable the CRQ */
904911 do {
@@ -910,6 +917,15 @@ static int ibmvfc_reenable_crq_queue(struct ibmvfc_host *vhost) · 5 unmodified lines
910917 if (rc)
911918 dev_err(vhost->dev, "Error enabling adapter (rc=%d)\n", rc);
912919
920+ spin_lock_irqsave(vhost->host->host_lock, flags);
921+ spin_lock(vhost->crq.q_lock);
922+ vhost->do_enquiry = 1;
923+ vhost->using_channels = 0;
924+ spin_unlock(vhost->crq.q_lock);
925+ spin_unlock_irqrestore(vhost->host->host_lock, flags);
926+
927+ ibmvfc_init_sub_crqs(vhost);
928+
913929 return rc;
914930 }
915931
@@ -926,8 +942,8 @@ static int ibmvfc_reset_crq(struct ibmvfc_host *vhost) · 10 unmodified lines
926942 unsigned long flags;
927943 struct vio_dev *vdev = to_vio_dev(vhost->dev);
928944 struct ibmvfc_queue *crq = &vhost->crq;
929− struct ibmvfc_queue *scrq;
930− int i;
945+
946+ ibmvfc_release_sub_crqs(vhost);
931947
932948 /* Close the CRQ */
933949 do {
@@ -947,16 +963,6 @@ static int ibmvfc_reset_crq(struct ibmvfc_host *vhost) · 13 unmodified lines
947963 memset(crq->msgs.crq, 0, PAGE_SIZE);
948964 crq->cur = 0;
949965
950− if (vhost->scsi_scrqs.scrqs) {
951− for (i = 0; i < nr_scsi_hw_queues; i++) {
952− scrq = &vhost->scsi_scrqs.scrqs[i];
953− spin_lock(scrq->q_lock);
954− memset(scrq->msgs.scrq, 0, PAGE_SIZE);
955− scrq->cur = 0;
956− spin_unlock(scrq->q_lock);
957− }
958− }
959−
960966 /* And re-open it again */
961967 rc = plpar_hcall_norets(H_REG_CRQ, vdev->unit_address,
962968 crq->msg_token, PAGE_SIZE);
@@ -966,9 +972,12 @@ static int ibmvfc_reset_crq(struct ibmvfc_host *vhost) · 3 unmodified lines
966972 dev_warn(vhost->dev, "Partner adapter not ready\n");
967973 else if (rc != 0)
968974 dev_warn(vhost->dev, "Couldn't register crq (rc=%d)\n", rc);
975+
969976 spin_unlock(vhost->crq.q_lock);
970977 spin_unlock_irqrestore(vhost->host->host_lock, flags);
971978
979+ ibmvfc_init_sub_crqs(vhost);
980+
972981 return rc;
973982 }
974983
@@ -5642,7 +5651,8 @@ static int ibmvfc_register_scsi_channel(struct ibmvfc_host *vhost, · 4667 unmodified lines
56425651 rc = h_reg_sub_crq(vdev->unit_address, scrq->msg_token, PAGE_SIZE,
56435652 &scrq->cookie, &scrq->hw_irq);
56445653
5645− if (rc) {
5654+ /* H_CLOSED indicates successful register, but no CRQ partner */
5655+ if (rc && rc != H_CLOSED) {
56465656 dev_warn(dev, "Error registering sub-crq: %d\n", rc);
56475657 if (rc == H_PARAMETER)
56485658 dev_warn_once(dev, "Firmware may not support MQ\n");
@@ -5675,8 +5685,8 @@ static int ibmvfc_register_scsi_channel(struct ibmvfc_host *vhost, · 26 unmodified lines
56755685
56765686 irq_failed:
56775687 do {
5678− plpar_hcall_norets(H_FREE_SUB_CRQ, vdev->unit_address, scrq->cookie);
5679− } while (rc == H_BUSY || H_IS_LONG_BUSY(rc));
5688+ rc = plpar_hcall_norets(H_FREE_SUB_CRQ, vdev->unit_address, scrq->cookie);
5689+ } while (rtas_busy_delay(rc));
56805690 reg_failed:
56815691 ibmvfc_free_queue(vhost, scrq);
56825692 LEAVE;
@@ -5694,6 +5704,7 @@ static void ibmvfc_deregister_scsi_channel(struct ibmvfc_host *vhost, int index) · 11 unmodified lines
56945704
56955705 free_irq(scrq->irq, scrq);
56965706 irq_dispose_mapping(scrq->irq);
5707+ scrq->irq = 0;
56975708
56985709 do {
56995710 rc = plpar_hcall_norets(H_FREE_SUB_CRQ, vdev->unit_address,
@@ -5707,17 +5718,21 @@ static void ibmvfc_deregister_scsi_channel(struct ibmvfc_host *vhost, int index) · 7 unmodified lines
57075718 LEAVE;
57085719 }
57095720
5710−static int ibmvfc_init_sub_crqs(struct ibmvfc_host *vhost)
5721+static void ibmvfc_init_sub_crqs(struct ibmvfc_host *vhost)
57115722 {
57125723 int i, j;
57135724
57145725 ENTER;
5726+ if (!vhost->mq_enabled)
5727+ return;
57155728
57165729 vhost->scsi_scrqs.scrqs = kcalloc(nr_scsi_hw_queues,
57175730 sizeof(*vhost->scsi_scrqs.scrqs),
57185731 GFP_KERNEL);
5719− if (!vhost->scsi_scrqs.scrqs)
5720− return -1;
5732+ if (!vhost->scsi_scrqs.scrqs) {
5733+ vhost->do_enquiry = 0;
5734+ return;
5735+ }
57215736
57225737 for (i = 0; i < nr_scsi_hw_queues; i++) {
57235738 if (ibmvfc_register_scsi_channel(vhost, i)) {
@@ -5726,13 +5741,12 @@ static int ibmvfc_init_sub_crqs(struct ibmvfc_host *vhost) · 2 unmodified lines
57265741 kfree(vhost->scsi_scrqs.scrqs);
57275742 vhost->scsi_scrqs.scrqs = NULL;
57285743 vhost->scsi_scrqs.active_queues = 0;
5729− LEAVE;
5730− return -1;
5744+ vhost->do_enquiry = 0;
5745+ break;
57315746 }
57325747 }
57335748
57345749 LEAVE;
5735− return 0;
57365750 }
57375751
57385752 static void ibmvfc_release_sub_crqs(struct ibmvfc_host *vhost)
@@ -5770,6 +5784,8 @@ static void ibmvfc_free_mem(struct ibmvfc_host *vhost) · 31 unmodified lines
57705784 vhost->disc_buf_dma);
57715785 dma_free_coherent(vhost->dev, sizeof(*vhost->login_buf),
57725786 vhost->login_buf, vhost->login_buf_dma);
5787+ dma_free_coherent(vhost->dev, sizeof(*vhost->channel_setup_buf),
5788+ vhost->channel_setup_buf, vhost->channel_setup_dma);
57735789 dma_pool_destroy(vhost->sg_pool);
57745790 ibmvfc_free_queue(vhost, async_q);
57755791 LEAVE;
@@ -5999,11 +6015,7 @@ static int ibmvfc_probe(struct vio_dev *vdev, const struct vio_device_id *id) · 223 unmodified lines
59996015 goto remove_shost;
60006016 }
60016017
6002− if (vhost->mq_enabled) {
6003− rc = ibmvfc_init_sub_crqs(vhost);
6004− if (rc)
6005− dev_warn(dev, "Failed to allocate Sub-CRQs. rc=%d\n", rc);
6006− }
6018+ ibmvfc_init_sub_crqs(vhost);
60076019
60086020 if (shost_to_fc_host(shost)->rqst_q)
60096021 blk_queue_max_segments(shost_to_fc_host(shost)->rqst_q, 1);
drivers/scsi/lpfc/lpfc_debugfs.c+2−2
@@ -2421,7 +2421,7 @@ lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf, · 2420 unmodified lines
24212421 memset(dstbuf, 0, 33);
24222422 size = (nbytes < 32) ? nbytes : 32;
24232423 if (copy_from_user(dstbuf, buf, size))
2424− return 0;
2424+ return -EFAULT;
24252425
24262426 if (dent == phba->debug_InjErrLBA) {
24272427 if ((dstbuf[0] == 'o') && (dstbuf[1] == 'f') &&
@@ -2430,7 +2430,7 @@ lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf, · 2 unmodified lines
24302430 }
24312431
24322432 if ((tmp == 0) && (kstrtoull(dstbuf, 0, &tmp)))
2433− return 0;
2433+ return -EINVAL;
24342434
24352435 if (dent == phba->debug_writeGuard)
24362436 phba->lpfc_injerr_wgrd_cnt = (uint32_t)tmp;
drivers/scsi/mpt3sas/mpt3sas_scsih.c+1−1
@@ -413,7 +413,7 @@ mpt3sas_get_port_by_id(struct MPT3SAS_ADAPTER *ioc, · 412 unmodified lines
413413 * And add this object to port_table_list.
414414 */
415415 if (!ioc->multipath_on_hba) {
416− port = kzalloc(sizeof(struct hba_port), GFP_KERNEL);
416+ port = kzalloc(sizeof(struct hba_port), GFP_ATOMIC);
417417 if (!port)
418418 return NULL;
419419
drivers/scsi/myrs.c+1−1
@@ -2273,12 +2273,12 @@ static void myrs_cleanup(struct myrs_hba *cs) · 2272 unmodified lines
22732273 if (cs->mmio_base) {
22742274 cs->disable_intr(cs);
22752275 iounmap(cs->mmio_base);
2276+ cs->mmio_base = NULL;
22762277 }
22772278 if (cs->irq)
22782279 free_irq(cs->irq, cs);
22792280 if (cs->io_addr)
22802281 release_region(cs->io_addr, 0x80);
2281− iounmap(cs->mmio_base);
22822282 pci_set_drvdata(pdev, NULL);
22832283 pci_disable_device(pdev);
22842284 scsi_host_put(cs->host);
drivers/scsi/pcmcia/nsp_cs.c+0−1
@@ -55,7 +55,6 @@ · 54 unmodified lines
5555
5656 MODULE_AUTHOR("YOKOTA Hiroshi <yokota@netlab.is.tsukuba.ac.jp>");
5757 MODULE_DESCRIPTION("WorkBit NinjaSCSI-3 / NinjaSCSI-32Bi(16bit) PCMCIA SCSI host adapter module");
58−MODULE_SUPPORTED_DEVICE("sd,sr,sg,st");
5958 MODULE_LICENSE("GPL");
6059
6160 #include "nsp_io.h"
drivers/scsi/qla2xxx/qla_target.h+1−1
@@ -116,7 +116,6 @@ · 115 unmodified lines
116116 (min(1270, ((ql) > 0) ? (QLA_TGT_DATASEGS_PER_CMD_24XX + \
117117 QLA_TGT_DATASEGS_PER_CONT_24XX*((ql) - 1)) : 0))
118118 #endif
119−#endif
120119
121120 #define GET_TARGET_ID(ha, iocb) ((HAS_EXTENDED_IDS(ha)) \
122121 ? le16_to_cpu((iocb)->u.isp2x.target.extended) \
@@ -244,6 +243,7 @@ struct ctio_to_2xxx { · 121 unmodified lines
244243 #ifndef CTIO_RET_TYPE
245244 #define CTIO_RET_TYPE 0x17 /* CTIO return entry */
246245 #define ATIO_TYPE7 0x06 /* Accept target I/O entry for 24xx */
246+#endif
247247
248248 struct fcp_hdr {
249249 uint8_t r_ctl;
drivers/scsi/sd_zbc.c+11−8
@@ -280,27 +280,28 @@ static int sd_zbc_update_wp_offset_cb(struct blk_zone *zone, unsigned int idx, · 279 unmodified lines
280280 static void sd_zbc_update_wp_offset_workfn(struct work_struct *work)
281281 {
282282 struct scsi_disk *sdkp;
283+ unsigned long flags;
283284 unsigned int zno;
284285 int ret;
285286
286287 sdkp = container_of(work, struct scsi_disk, zone_wp_offset_work);
287288
288− spin_lock_bh(&sdkp->zones_wp_offset_lock);
289+ spin_lock_irqsave(&sdkp->zones_wp_offset_lock, flags);
289290 for (zno = 0; zno < sdkp->nr_zones; zno++) {
290291 if (sdkp->zones_wp_offset[zno] != SD_ZBC_UPDATING_WP_OFST)
291292 continue;
292293
293− spin_unlock_bh(&sdkp->zones_wp_offset_lock);
294+ spin_unlock_irqrestore(&sdkp->zones_wp_offset_lock, flags);
294295 ret = sd_zbc_do_report_zones(sdkp, sdkp->zone_wp_update_buf,
295296 SD_BUF_SIZE,
296297 zno * sdkp->zone_blocks, true);
297− spin_lock_bh(&sdkp->zones_wp_offset_lock);
298+ spin_lock_irqsave(&sdkp->zones_wp_offset_lock, flags);
298299 if (!ret)
299300 sd_zbc_parse_report(sdkp, sdkp->zone_wp_update_buf + 64,
300301 zno, sd_zbc_update_wp_offset_cb,
301302 sdkp);
302303 }
303− spin_unlock_bh(&sdkp->zones_wp_offset_lock);
304+ spin_unlock_irqrestore(&sdkp->zones_wp_offset_lock, flags);
304305
305306 scsi_device_put(sdkp->device);
306307 }
@@ -324,6 +325,7 @@ blk_status_t sd_zbc_prepare_zone_append(struct scsi_cmnd *cmd, sector_t *lba, · 17 unmodified lines
324325 struct request *rq = cmd->request;
325326 struct scsi_disk *sdkp = scsi_disk(rq->rq_disk);
326327 unsigned int wp_offset, zno = blk_rq_zone_no(rq);
328+ unsigned long flags;
327329 blk_status_t ret;
328330
329331 ret = sd_zbc_cmnd_checks(cmd);
@@ -337,7 +339,7 @@ blk_status_t sd_zbc_prepare_zone_append(struct scsi_cmnd *cmd, sector_t *lba, · 7 unmodified lines
337339 if (!blk_req_zone_write_trylock(rq))
338340 return BLK_STS_ZONE_RESOURCE;
339341
340− spin_lock_bh(&sdkp->zones_wp_offset_lock);
342+ spin_lock_irqsave(&sdkp->zones_wp_offset_lock, flags);
341343 wp_offset = sdkp->zones_wp_offset[zno];
342344 switch (wp_offset) {
343345 case SD_ZBC_INVALID_WP_OFST:
@@ -366,7 +368,7 @@ blk_status_t sd_zbc_prepare_zone_append(struct scsi_cmnd *cmd, sector_t *lba, · 22 unmodified lines
366368
367369 *lba += wp_offset;
368370 }
369− spin_unlock_bh(&sdkp->zones_wp_offset_lock);
371+ spin_unlock_irqrestore(&sdkp->zones_wp_offset_lock, flags);
370372 if (ret)
371373 blk_req_zone_write_unlock(rq);
372374 return ret;
@@ -445,6 +447,7 @@ static unsigned int sd_zbc_zone_wp_update(struct scsi_cmnd *cmd, · 72 unmodified lines
445447 struct scsi_disk *sdkp = scsi_disk(rq->rq_disk);
446448 unsigned int zno = blk_rq_zone_no(rq);
447449 enum req_opf op = req_op(rq);
450+ unsigned long flags;
448451
449452 /*
450453 * If we got an error for a command that needs updating the write
@@ -452,7 +455,7 @@ static unsigned int sd_zbc_zone_wp_update(struct scsi_cmnd *cmd, · 1 unmodified line
452455 * invalid to force an update from disk the next time a zone append
453456 * command is issued.
454457 */
455− spin_lock_bh(&sdkp->zones_wp_offset_lock);
458+ spin_lock_irqsave(&sdkp->zones_wp_offset_lock, flags);
456459
457460 if (result && op != REQ_OP_ZONE_RESET_ALL) {
458461 if (op == REQ_OP_ZONE_APPEND) {
@@ -496,7 +499,7 @@ static unsigned int sd_zbc_zone_wp_update(struct scsi_cmnd *cmd, · 37 unmodified lines
496499 }
497500
498501 unlock_wp_offset:
499− spin_unlock_bh(&sdkp->zones_wp_offset_lock);
502+ spin_unlock_irqrestore(&sdkp->zones_wp_offset_lock, flags);
500503
501504 return good_bytes;
502505 }
drivers/scsi/smartpqi/smartpqi_init.c+0−1
@@ -48,7 +48,6 @@ · 47 unmodified lines
4848 MODULE_AUTHOR("Microsemi");
4949 MODULE_DESCRIPTION("Driver for Microsemi Smart Family Controller version "
5050 DRIVER_VERSION);
51−MODULE_SUPPORTED_DEVICE("Microsemi Smart Family Controllers");
5251 MODULE_VERSION(DRIVER_VERSION);
5352 MODULE_LICENSE("GPL");
5453
drivers/scsi/st.c+1−1
@@ -1269,8 +1269,8 @@ static int st_open(struct inode *inode, struct file *filp) · 1268 unmodified lines
12691269 spin_lock(&st_use_lock);
12701270 if (STp->in_use) {
12711271 spin_unlock(&st_use_lock);
1272− scsi_tape_put(STp);
12731272 DEBC_printk(STp, "Device already in use.\n");
1273+ scsi_tape_put(STp);
12741274 return (-EBUSY);
12751275 }
12761276
drivers/scsi/ufs/ufs-mediatek.c+1−1
@@ -911,7 +911,7 @@ static void ufs_mtk_vreg_set_lpm(struct ufs_hba *hba, bool lpm) · 910 unmodified lines
911911 if (!hba->vreg_info.vccq2 || !hba->vreg_info.vcc)
912912 return;
913913
914− if (lpm & !hba->vreg_info.vcc->enabled)
914+ if (lpm && !hba->vreg_info.vcc->enabled)
915915 regulator_set_mode(hba->vreg_info.vccq2->reg,
916916 REGULATOR_MODE_IDLE);
917917 else if (!lpm)
drivers/scsi/ufs/ufs-qcom.c+10−0
@@ -253,12 +253,17 @@ static int ufs_qcom_host_reset(struct ufs_hba *hba) · 252 unmodified lines
253253 {
254254 int ret = 0;
255255 struct ufs_qcom_host *host = ufshcd_get_variant(hba);
256+ bool reenable_intr = false;
256257
257258 if (!host->core_reset) {
258259 dev_warn(hba->dev, "%s: reset control not set\n", __func__);
259260 goto out;
260261 }
261262
263+ reenable_intr = hba->is_irq_enabled;
264+ disable_irq(hba->irq);
265+ hba->is_irq_enabled = false;
266+
262267 ret = reset_control_assert(host->core_reset);
263268 if (ret) {
264269 dev_err(hba->dev, "%s: core_reset assert failed, err = %d\n",
@@ -280,6 +285,11 @@ static int ufs_qcom_host_reset(struct ufs_hba *hba) · 15 unmodified lines
280285
281286 usleep_range(1000, 1100);
282287
288+ if (reenable_intr) {
289+ enable_irq(hba->irq);
290+ hba->is_irq_enabled = true;
291+ }
292+
283293 out:
284294 return ret;
285295 }
drivers/scsi/ufs/ufshcd.c+13−28
@@ -95,8 +95,6 @@ · 94 unmodified lines
9595 16, 4, buf, __len, false); \
9696 } while (0)
9797
98−static bool early_suspend;
99−
10098 int ufshcd_dump_regs(struct ufs_hba *hba, size_t offset, size_t len,
10199 const char *prefix)
102100 {
@@ -1535,7 +1533,7 @@ static ssize_t ufshcd_clkscale_enable_show(struct device *dev, · 1432 unmodified lines
15351533 {
15361534 struct ufs_hba *hba = dev_get_drvdata(dev);
15371535
1538− return snprintf(buf, PAGE_SIZE, "%d\n", hba->clk_scaling.is_enabled);
1536+ return sysfs_emit(buf, "%d\n", hba->clk_scaling.is_enabled);
15391537 }
15401538
15411539 static ssize_t ufshcd_clkscale_enable_store(struct device *dev,
@@ -4987,6 +4985,7 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) · 3445 unmodified lines
49874985 * UFS device needs urgent BKOPs.
49884986 */
49894987 if (!hba->pm_op_in_progress &&
4988+ !ufshcd_eh_in_progress(hba) &&
49904989 ufshcd_is_exception_event(lrbp->ucd_rsp_ptr) &&
49914990 schedule_work(&hba->eeh_work)) {
49924991 /*
@@ -5784,13 +5783,20 @@ static void ufshcd_err_handling_prepare(struct ufs_hba *hba) · 791 unmodified lines
57845783 ufshcd_suspend_clkscaling(hba);
57855784 ufshcd_clk_scaling_allow(hba, false);
57865785 }
5786+ ufshcd_scsi_block_requests(hba);
5787+ /* Drain ufshcd_queuecommand() */
5788+ down_write(&hba->clk_scaling_lock);
5789+ up_write(&hba->clk_scaling_lock);
5790+ cancel_work_sync(&hba->eeh_work);
57875791 }
57885792
57895793 static void ufshcd_err_handling_unprepare(struct ufs_hba *hba)
57905794 {
5795+ ufshcd_scsi_unblock_requests(hba);
57915796 ufshcd_release(hba);
57925797 if (ufshcd_is_clkscaling_supported(hba))
57935798 ufshcd_clk_scaling_suspend(hba, false);
5799+ ufshcd_clear_ua_wluns(hba);
57945800 pm_runtime_put(hba->dev);
57955801 }
57965802
@@ -5882,8 +5888,8 @@ static void ufshcd_err_handler(struct work_struct *work) · 85 unmodified lines
58825888 spin_unlock_irqrestore(hba->host->host_lock, flags);
58835889 ufshcd_err_handling_prepare(hba);
58845890 spin_lock_irqsave(hba->host->host_lock, flags);
5885− ufshcd_scsi_block_requests(hba);
5886− hba->ufshcd_state = UFSHCD_STATE_RESET;
5891+ if (hba->ufshcd_state != UFSHCD_STATE_ERROR)
5892+ hba->ufshcd_state = UFSHCD_STATE_RESET;
58875893
58885894 /* Complete requests that have door-bell cleared by h/w */
58895895 ufshcd_complete_requests(hba);
@@ -6042,12 +6048,8 @@ skip_err_handling: · 152 unmodified lines
60426048 }
60436049 ufshcd_clear_eh_in_progress(hba);
60446050 spin_unlock_irqrestore(hba->host->host_lock, flags);
6045− ufshcd_scsi_unblock_requests(hba);
60466051 ufshcd_err_handling_unprepare(hba);
60476052 up(&hba->host_sem);
6048−
6049− if (!err && needs_reset)
6050− ufshcd_clear_ua_wluns(hba);
60516053 }
60526054
60536055 /**
@@ -7858,6 +7860,8 @@ static int ufshcd_probe_hba(struct ufs_hba *hba, bool async) · 1804 unmodified lines
78587860 unsigned long flags;
78597861 ktime_t start = ktime_get();
78607862
7863+ hba->ufshcd_state = UFSHCD_STATE_RESET;
7864+
78617865 ret = ufshcd_link_startup(hba);
78627866 if (ret)
78637867 goto out;
@@ -8972,11 +8976,6 @@ int ufshcd_system_suspend(struct ufs_hba *hba) · 1108 unmodified lines
89728976 int ret = 0;
89738977 ktime_t start = ktime_get();
89748978
8975− if (!hba) {
8976− early_suspend = true;
8977− return 0;
8978− }
8979−
89808979 down(&hba->host_sem);
89818980
89828981 if (!hba->is_powered)
@@ -9028,14 +9027,6 @@ int ufshcd_system_resume(struct ufs_hba *hba) · 45 unmodified lines
90289027 int ret = 0;
90299028 ktime_t start = ktime_get();
90309029
9031− if (!hba)
9032− return -EINVAL;
9033−
9034− if (unlikely(early_suspend)) {
9035− early_suspend = false;
9036− down(&hba->host_sem);
9037− }
9038−
90399030 if (!hba->is_powered || pm_runtime_suspended(hba->dev))
90409031 /*
90419032 * Let the runtime resume take care of resuming
@@ -9068,9 +9059,6 @@ int ufshcd_runtime_suspend(struct ufs_hba *hba) · 26 unmodified lines
90689059 int ret = 0;
90699060 ktime_t start = ktime_get();
90709061
9071− if (!hba)
9072− return -EINVAL;
9073−
90749062 if (!hba->is_powered)
90759063 goto out;
90769064 else
@@ -9109,9 +9097,6 @@ int ufshcd_runtime_resume(struct ufs_hba *hba) · 32 unmodified lines
91099097 int ret = 0;
91109098 ktime_t start = ktime_get();
91119099
9112− if (!hba)
9113− return -EINVAL;
9114−
91159100 if (!hba->is_powered)
91169101 goto out;
91179102 else
drivers/scsi/vmw_pvscsi.c+0−2
@@ -17,8 +17,6 @@ · 16 unmodified lines
1717 * along with this program; if not, write to the Free Software
1818 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1919 *
20− * Maintained by: Jim Gill <jgill@vmware.com>
21− *
2220 */
2321
2422 #include <linux/kernel.h>
drivers/scsi/vmw_pvscsi.h+0−2
@@ -17,8 +17,6 @@ · 16 unmodified lines
1717 * along with this program; if not, write to the Free Software
1818 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1919 *
20− * Maintained by: Jim Gill <jgill@vmware.com>
21− *
2220 */
2321
2422 #ifndef _VMW_PVSCSI_H_
drivers/sh/maple/maple.c+0−1
@@ -30,7 +30,6 @@ · 29 unmodified lines
3030 MODULE_AUTHOR("Adrian McMenamin <adrian@mcmen.demon.co.uk>");
3131 MODULE_DESCRIPTION("Maple bus driver for Dreamcast");
3232 MODULE_LICENSE("GPL v2");
33−MODULE_SUPPORTED_DEVICE("{{SEGA, Dreamcast/Maple}}");
3433
3534 static void maple_dma_handler(struct work_struct *work);
3635 static void maple_vblank_handler(struct work_struct *work);
drivers/spi/spi-cadence-quadspi.c+1−0
@@ -1433,6 +1433,7 @@ static int cqspi_probe(struct platform_device *pdev) · 1432 unmodified lines
14331433 cqspi = spi_master_get_devdata(master);
14341434
14351435 cqspi->pdev = pdev;
1436+ platform_set_drvdata(pdev, cqspi);
14361437
14371438 /* Obtain configuration from OF. */
14381439 ret = cqspi_of_get_pdata(cqspi);
drivers/staging/comedi/drivers/addi_apci_1032.c+3−1
@@ -260,6 +260,7 @@ static irqreturn_t apci1032_interrupt(int irq, void *d) · 259 unmodified lines
260260 struct apci1032_private *devpriv = dev->private;
261261 struct comedi_subdevice *s = dev->read_subdev;
262262 unsigned int ctrl;
263+ unsigned short val;
263264
264265 /* check interrupt is from this device */
265266 if ((inl(devpriv->amcc_iobase + AMCC_OP_REG_INTCSR) &
@@ -275,7 +276,8 @@ static irqreturn_t apci1032_interrupt(int irq, void *d) · 9 unmodified lines
275276 outl(ctrl & ~APCI1032_CTRL_INT_ENA, dev->iobase + APCI1032_CTRL_REG);
276277
277278 s->state = inl(dev->iobase + APCI1032_STATUS_REG) & 0xffff;
278− comedi_buf_write_samples(s, &s->state, 1);
279+ val = s->state;
280+ comedi_buf_write_samples(s, &val, 1);
279281 comedi_handle_events(dev, s);
280282
281283 /* enable the interrupt */
drivers/staging/comedi/drivers/addi_apci_1500.c+9−9
@@ -208,7 +208,7 @@ static irqreturn_t apci1500_interrupt(int irq, void *d) · 207 unmodified lines
208208 struct comedi_device *dev = d;
209209 struct apci1500_private *devpriv = dev->private;
210210 struct comedi_subdevice *s = dev->read_subdev;
211− unsigned int status = 0;
211+ unsigned short status = 0;
212212 unsigned int val;
213213
214214 val = inl(devpriv->amcc + AMCC_OP_REG_INTCSR);
@@ -238,14 +238,14 @@ static irqreturn_t apci1500_interrupt(int irq, void *d) · 23 unmodified lines
238238 *
239239 * Mask Meaning
240240 * ---------- ------------------------------------------
241− * 0x00000001 Event 1 has occurred
242− * 0x00000010 Event 2 has occurred
243− * 0x00000100 Counter/timer 1 has run down (not implemented)
244− * 0x00001000 Counter/timer 2 has run down (not implemented)
245− * 0x00010000 Counter 3 has run down (not implemented)
246− * 0x00100000 Watchdog has run down (not implemented)
247− * 0x01000000 Voltage error
248− * 0x10000000 Short-circuit error
241+ * 0b00000001 Event 1 has occurred
242+ * 0b00000010 Event 2 has occurred
243+ * 0b00000100 Counter/timer 1 has run down (not implemented)
244+ * 0b00001000 Counter/timer 2 has run down (not implemented)
245+ * 0b00010000 Counter 3 has run down (not implemented)
246+ * 0b00100000 Watchdog has run down (not implemented)
247+ * 0b01000000 Voltage error
248+ * 0b10000000 Short-circuit error
249249 */
250250 comedi_buf_write_samples(s, &status, 1);
251251 comedi_handle_events(dev, s);
drivers/staging/comedi/drivers/adv_pci1710.c+5−5
@@ -300,11 +300,11 @@ static int pci1710_ai_eoc(struct comedi_device *dev, · 299 unmodified lines
300300 static int pci1710_ai_read_sample(struct comedi_device *dev,
301301 struct comedi_subdevice *s,
302302 unsigned int cur_chan,
303− unsigned int *val)
303+ unsigned short *val)
304304 {
305305 const struct boardtype *board = dev->board_ptr;
306306 struct pci1710_private *devpriv = dev->private;
307− unsigned int sample;
307+ unsigned short sample;
308308 unsigned int chan;
309309
310310 sample = inw(dev->iobase + PCI171X_AD_DATA_REG);
@@ -345,7 +345,7 @@ static int pci1710_ai_insn_read(struct comedi_device *dev, · 34 unmodified lines
345345 pci1710_ai_setup_chanlist(dev, s, &insn->chanspec, 1, 1);
346346
347347 for (i = 0; i < insn->n; i++) {
348− unsigned int val;
348+ unsigned short val;
349349
350350 /* start conversion */
351351 outw(0, dev->iobase + PCI171X_SOFTTRG_REG);
@@ -395,7 +395,7 @@ static void pci1710_handle_every_sample(struct comedi_device *dev, · 43 unmodified lines
395395 {
396396 struct comedi_cmd *cmd = &s->async->cmd;
397397 unsigned int status;
398− unsigned int val;
398+ unsigned short val;
399399 int ret;
400400
401401 status = inw(dev->iobase + PCI171X_STATUS_REG);
@@ -455,7 +455,7 @@ static void pci1710_handle_fifo(struct comedi_device *dev, · 53 unmodified lines
455455 }
456456
457457 for (i = 0; i < devpriv->max_samples; i++) {
458− unsigned int val;
458+ unsigned short val;
459459 int ret;
460460
461461 ret = pci1710_ai_read_sample(dev, s, s->async->cur_chan, &val);
drivers/staging/comedi/drivers/amplc_pc236_common.c+3−1
@@ -126,7 +126,9 @@ static irqreturn_t pc236_interrupt(int irq, void *d) · 125 unmodified lines
126126
127127 handled = pc236_intr_check(dev);
128128 if (dev->attached && handled) {
129− comedi_buf_write_samples(s, &s->state, 1);
129+ unsigned short val = 0;
130+
131+ comedi_buf_write_samples(s, &val, 1);
130132 comedi_handle_events(dev, s);
131133 }
132134 return IRQ_RETVAL(handled);
drivers/staging/comedi/drivers/cb_pcidas.c+1−1
@@ -1281,7 +1281,7 @@ static int cb_pcidas_auto_attach(struct comedi_device *dev, · 1280 unmodified lines
12811281 devpriv->amcc + AMCC_OP_REG_INTCSR);
12821282
12831283 ret = request_irq(pcidev->irq, cb_pcidas_interrupt, IRQF_SHARED,
1284− dev->board_name, dev);
1284+ "cb_pcidas", dev);
12851285 if (ret) {
12861286 dev_dbg(dev->class_dev, "unable to allocate irq %d\n",
12871287 pcidev->irq);
drivers/staging/comedi/drivers/cb_pcidas64.c+1−1
@@ -4035,7 +4035,7 @@ static int auto_attach(struct comedi_device *dev, · 4034 unmodified lines
40354035 init_stc_registers(dev);
40364036
40374037 retval = request_irq(pcidev->irq, handle_interrupt, IRQF_SHARED,
4038− dev->board_name, dev);
4038+ "cb_pcidas64", dev);
40394039 if (retval) {
40404040 dev_dbg(dev->class_dev, "unable to allocate irq %u\n",
40414041 pcidev->irq);
drivers/staging/comedi/drivers/comedi_parport.c+2−1
@@ -210,12 +210,13 @@ static irqreturn_t parport_interrupt(int irq, void *d) · 209 unmodified lines
210210 struct comedi_device *dev = d;
211211 struct comedi_subdevice *s = dev->read_subdev;
212212 unsigned int ctrl;
213+ unsigned short val = 0;
213214
214215 ctrl = inb(dev->iobase + PARPORT_CTRL_REG);
215216 if (!(ctrl & PARPORT_CTRL_IRQ_ENA))
216217 return IRQ_NONE;
217218
218− comedi_buf_write_samples(s, &s->state, 1);
219+ comedi_buf_write_samples(s, &val, 1);
219220 comedi_handle_events(dev, s);
220221
221222 return IRQ_HANDLED;
drivers/staging/comedi/drivers/das6402.c+1−1
@@ -186,7 +186,7 @@ static irqreturn_t das6402_interrupt(int irq, void *d) · 185 unmodified lines
186186 if (status & DAS6402_STATUS_FFULL) {
187187 async->events |= COMEDI_CB_OVERFLOW;
188188 } else if (status & DAS6402_STATUS_FFNE) {
189− unsigned int val;
189+ unsigned short val;
190190
191191 val = das6402_ai_read_sample(dev, s);
192192 comedi_buf_write_samples(s, &val, 1);
drivers/staging/comedi/drivers/das800.c+1−1
@@ -427,7 +427,7 @@ static irqreturn_t das800_interrupt(int irq, void *d) · 426 unmodified lines
427427 struct comedi_cmd *cmd;
428428 unsigned long irq_flags;
429429 unsigned int status;
430− unsigned int val;
430+ unsigned short val;
431431 bool fifo_empty;
432432 bool fifo_overflow;
433433 int i;
drivers/staging/comedi/drivers/dmm32at.c+1−1
@@ -404,7 +404,7 @@ static irqreturn_t dmm32at_isr(int irq, void *d) · 403 unmodified lines
404404 {
405405 struct comedi_device *dev = d;
406406 unsigned char intstat;
407− unsigned int val;
407+ unsigned short val;
408408 int i;
409409
410410 if (!dev->attached) {
drivers/staging/comedi/drivers/me4000.c+1−1
@@ -924,7 +924,7 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) · 923 unmodified lines
924924 struct comedi_subdevice *s = dev->read_subdev;
925925 int i;
926926 int c = 0;
927− unsigned int lval;
927+ unsigned short lval;
928928
929929 if (!dev->attached)
930930 return IRQ_NONE;
drivers/staging/comedi/drivers/ni_6527.c+3−1
@@ -195,7 +195,9 @@ static irqreturn_t ni6527_interrupt(int irq, void *d) · 194 unmodified lines
195195 return IRQ_NONE;
196196
197197 if (status & NI6527_STATUS_EDGE) {
198− comedi_buf_write_samples(s, &s->state, 1);
198+ unsigned short val = 0;
199+
200+ comedi_buf_write_samples(s, &val, 1);
199201 comedi_handle_events(dev, s);
200202 }
201203
drivers/staging/comedi/drivers/ni_65xx.c+2−1
@@ -472,6 +472,7 @@ static irqreturn_t ni_65xx_interrupt(int irq, void *d) · 471 unmodified lines
472472 struct comedi_device *dev = d;
473473 struct comedi_subdevice *s = dev->read_subdev;
474474 unsigned int status;
475+ unsigned short val = 0;
475476
476477 status = readb(dev->mmio + NI_65XX_STATUS_REG);
477478 if ((status & NI_65XX_STATUS_INT) == 0)
@@ -482,7 +483,7 @@ static irqreturn_t ni_65xx_interrupt(int irq, void *d) · 4 unmodified lines
482483 writeb(NI_65XX_CLR_EDGE_INT | NI_65XX_CLR_OVERFLOW_INT,
483484 dev->mmio + NI_65XX_CLR_REG);
484485
485− comedi_buf_write_samples(s, &s->state, 1);
486+ comedi_buf_write_samples(s, &val, 1);
486487 comedi_handle_events(dev, s);
487488
488489 return IRQ_HANDLED;
drivers/staging/comedi/drivers/pcl711.c+1−1
@@ -184,7 +184,7 @@ static irqreturn_t pcl711_interrupt(int irq, void *d) · 183 unmodified lines
184184 struct comedi_device *dev = d;
185185 struct comedi_subdevice *s = dev->read_subdev;
186186 struct comedi_cmd *cmd = &s->async->cmd;
187− unsigned int data;
187+ unsigned short data;
188188
189189 if (!dev->attached) {
190190 dev_err(dev->class_dev, "spurious interrupt\n");
drivers/staging/comedi/drivers/pcl726.c+3−1
@@ -220,9 +220,11 @@ static irqreturn_t pcl726_interrupt(int irq, void *d) · 219 unmodified lines
220220 struct pcl726_private *devpriv = dev->private;
221221
222222 if (devpriv->cmd_running) {
223+ unsigned short val = 0;
224+
223225 pcl726_intr_cancel(dev, s);
224226
225− comedi_buf_write_samples(s, &s->state, 1);
227+ comedi_buf_write_samples(s, &val, 1);
226228 comedi_handle_events(dev, s);
227229 }
228230
drivers/staging/comedi/drivers/pcl818.c+1−1
@@ -423,7 +423,7 @@ static int pcl818_ai_eoc(struct comedi_device *dev, · 422 unmodified lines
423423
424424 static bool pcl818_ai_write_sample(struct comedi_device *dev,
425425 struct comedi_subdevice *s,
426− unsigned int chan, unsigned int val)
426+ unsigned int chan, unsigned short val)
427427 {
428428 struct pcl818_private *devpriv = dev->private;
429429 struct comedi_cmd *cmd = &s->async->cmd;
drivers/staging/comedi/drivers/vmk80xx.c+0−1
@@ -877,5 +877,4 @@ module_comedi_usb_driver(vmk80xx_driver, vmk80xx_usb_driver); · 876 unmodified lines
877877
878878 MODULE_AUTHOR("Manuel Gebele <forensixs@gmx.de>");
879879 MODULE_DESCRIPTION("Velleman USB Board Low-Level Driver");
880−MODULE_SUPPORTED_DEVICE("K8055/K8061 aka VM110/VM140");
881880 MODULE_LICENSE("GPL");
drivers/staging/ks7010/ks_wlan_net.c+4−2
@@ -1120,6 +1120,7 @@ static int ks_wlan_set_scan(struct net_device *dev, · 1119 unmodified lines
11201120 {
11211121 struct ks_wlan_private *priv = netdev_priv(dev);
11221122 struct iw_scan_req *req = NULL;
1123+ int len;
11231124
11241125 if (priv->sleep_mode == SLP_SLEEP)
11251126 return -EPERM;
@@ -1129,8 +1130,9 @@ static int ks_wlan_set_scan(struct net_device *dev, · 3 unmodified lines
11291130 if (wrqu->data.length == sizeof(struct iw_scan_req) &&
11301131 wrqu->data.flags & IW_SCAN_THIS_ESSID) {
11311132 req = (struct iw_scan_req *)extra;
1132− priv->scan_ssid_len = req->essid_len;
1133− memcpy(priv->scan_ssid, req->essid, priv->scan_ssid_len);
1133+ len = min_t(int, req->essid_len, IW_ESSID_MAX_SIZE);
1134+ priv->scan_ssid_len = len;
1135+ memcpy(priv->scan_ssid, req->essid, len);
11341136 } else {
11351137 priv->scan_ssid_len = 0;
11361138 }
drivers/staging/rtl8188eu/core/rtw_ap.c+5−0
@@ -791,6 +791,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) · 790 unmodified lines
791791 p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, WLAN_EID_SSID, &ie_len,
792792 pbss_network->ie_length - _BEACON_IE_OFFSET_);
793793 if (p && ie_len > 0) {
794+ ie_len = min_t(int, ie_len, sizeof(pbss_network->ssid.ssid));
794795 memset(&pbss_network->ssid, 0, sizeof(struct ndis_802_11_ssid));
795796 memcpy(pbss_network->ssid.ssid, p + 2, ie_len);
796797 pbss_network->ssid.ssid_length = ie_len;
@@ -811,6 +812,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) · 14 unmodified lines
811812 p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, WLAN_EID_SUPP_RATES, &ie_len,
812813 pbss_network->ie_length - _BEACON_IE_OFFSET_);
813814 if (p) {
815+ ie_len = min_t(int, ie_len, NDIS_802_11_LENGTH_RATES_EX);
814816 memcpy(supportRate, p + 2, ie_len);
815817 supportRateNum = ie_len;
816818 }
@@ -819,6 +821,8 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) · 2 unmodified lines
819821 p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, WLAN_EID_EXT_SUPP_RATES,
820822 &ie_len, pbss_network->ie_length - _BEACON_IE_OFFSET_);
821823 if (p) {
824+ ie_len = min_t(int, ie_len,
825+ NDIS_802_11_LENGTH_RATES_EX - supportRateNum);
822826 memcpy(supportRate + supportRateNum, p + 2, ie_len);
823827 supportRateNum += ie_len;
824828 }
@@ -934,6 +938,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) · 109 unmodified lines
934938
935939 pht_cap->mcs.rx_mask[0] = 0xff;
936940 pht_cap->mcs.rx_mask[1] = 0x0;
941+ ie_len = min_t(int, ie_len, sizeof(pmlmepriv->htpriv.ht_cap));
937942 memcpy(&pmlmepriv->htpriv.ht_cap, p + 2, ie_len);
938943 }
939944
drivers/staging/rtl8188eu/os_dep/ioctl_linux.c+4−2
@@ -1133,9 +1133,11 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a, · 1132 unmodified lines
11331133 break;
11341134 }
11351135 sec_len = *(pos++); len -= 1;
1136− if (sec_len > 0 && sec_len <= len) {
1136+ if (sec_len > 0 &&
1137+ sec_len <= len &&
1138+ sec_len <= 32) {
11371139 ssid[ssid_index].ssid_length = sec_len;
1138− memcpy(ssid[ssid_index].ssid, pos, ssid[ssid_index].ssid_length);
1140+ memcpy(ssid[ssid_index].ssid, pos, sec_len);
11391141 ssid_index++;
11401142 }
11411143 pos += sec_len;
drivers/staging/rtl8192e/Kconfig+1−0
@@ -27,6 +27,7 @@ config RTLLIB_CRYPTO_CCMP · 26 unmodified lines
2727 config RTLLIB_CRYPTO_TKIP
2828 tristate "Support for rtllib TKIP crypto"
2929 depends on RTLLIB
30+ select CRYPTO
3031 select CRYPTO_LIB_ARC4
3132 select CRYPTO_MICHAEL_MIC
3233 default y
drivers/staging/rtl8192e/rtl8192e/rtl_wx.c+4−3
@@ -406,9 +406,10 @@ static int _rtl92e_wx_set_scan(struct net_device *dev, · 405 unmodified lines
406406 struct iw_scan_req *req = (struct iw_scan_req *)b;
407407
408408 if (req->essid_len) {
409− ieee->current_network.ssid_len = req->essid_len;
410− memcpy(ieee->current_network.ssid, req->essid,
411− req->essid_len);
409+ int len = min_t(int, req->essid_len, IW_ESSID_MAX_SIZE);
410+
411+ ieee->current_network.ssid_len = len;
412+ memcpy(ieee->current_network.ssid, req->essid, len);
412413 }
413414 }
414415
drivers/staging/rtl8192u/r8192U_wx.c+4−2
@@ -331,8 +331,10 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a, · 330 unmodified lines
331331 struct iw_scan_req *req = (struct iw_scan_req *)b;
332332
333333 if (req->essid_len) {
334− ieee->current_network.ssid_len = req->essid_len;
335− memcpy(ieee->current_network.ssid, req->essid, req->essid_len);
334+ int len = min_t(int, req->essid_len, IW_ESSID_MAX_SIZE);
335+
336+ ieee->current_network.ssid_len = len;
337+ memcpy(ieee->current_network.ssid, req->essid, len);
336338 }
337339 }
338340
drivers/staging/rtl8712/rtl871x_cmd.c+4−2
@@ -192,8 +192,10 @@ u8 r8712_sitesurvey_cmd(struct _adapter *padapter, · 191 unmodified lines
192192 psurveyPara->ss_ssidlen = 0;
193193 memset(psurveyPara->ss_ssid, 0, IW_ESSID_MAX_SIZE + 1);
194194 if (pssid && pssid->SsidLength) {
195− memcpy(psurveyPara->ss_ssid, pssid->Ssid, pssid->SsidLength);
196− psurveyPara->ss_ssidlen = cpu_to_le32(pssid->SsidLength);
195+ int len = min_t(int, pssid->SsidLength, IW_ESSID_MAX_SIZE);
196+
197+ memcpy(psurveyPara->ss_ssid, pssid->Ssid, len);
198+ psurveyPara->ss_ssidlen = cpu_to_le32(len);
197199 }
198200 set_fwstate(pmlmepriv, _FW_UNDER_SURVEY);
199201 r8712_enqueue_cmd(pcmdpriv, ph2c);
drivers/staging/rtl8712/rtl871x_ioctl_linux.c+1−1
@@ -924,7 +924,7 @@ static int r871x_wx_set_priv(struct net_device *dev, · 923 unmodified lines
924924 struct iw_point *dwrq = (struct iw_point *)awrq;
925925
926926 len = dwrq->length;
927− ext = memdup_user(dwrq->pointer, len);
927+ ext = strndup_user(dwrq->pointer, len);
928928 if (IS_ERR(ext))
929929 return PTR_ERR(ext);
930930
drivers/staging/vt6655/rxtx.h+2−2
@@ -150,7 +150,7 @@ struct vnt_cts { · 149 unmodified lines
150150 u16 reserved;
151151 struct ieee80211_cts data;
152152 u16 reserved2;
153−} __packed;
153+} __packed __aligned(2);
154154
155155 struct vnt_cts_fb {
156156 struct vnt_phy_field b;
@@ -160,7 +160,7 @@ struct vnt_cts_fb { · 3 unmodified lines
160160 __le16 cts_duration_ba_f1;
161161 struct ieee80211_cts data;
162162 u16 reserved2;
163−} __packed;
163+} __packed __aligned(2);
164164
165165 struct vnt_tx_fifo_head {
166166 u8 tx_key[WLAN_KEY_LEN_CCMP];
drivers/staging/wfx/bh.c+1−0
@@ -5,6 +5,7 @@ · 4 unmodified lines
55 * Copyright (c) 2017-2020, Silicon Laboratories, Inc.
66 * Copyright (c) 2010, ST-Ericsson
77 */
8+#include <linux/gpio/consumer.h>
89 #include <net/mac80211.h>
910
1011 #include "bh.h"
drivers/staging/wfx/bh.h+4−0
@@ -8,6 +8,10 @@ · 7 unmodified lines
88 #ifndef WFX_BH_H
99 #define WFX_BH_H
1010
11+#include <linux/atomic.h>
12+#include <linux/wait.h>
13+#include <linux/workqueue.h>
14+
1115 struct wfx_dev;
1216
1317 struct wfx_hif {
drivers/staging/wfx/bus.h+3−0
@@ -8,6 +8,9 @@ · 7 unmodified lines
88 #ifndef WFX_BUS_H
99 #define WFX_BUS_H
1010
11+#include <linux/mmc/sdio_func.h>
12+#include <linux/spi/spi.h>
13+
1114 #define WFX_REG_CONFIG 0x0
1215 #define WFX_REG_CONTROL 0x1
1316 #define WFX_REG_IN_OUT_QUEUE 0x2
drivers/staging/wfx/bus_sdio.c+6−0
@@ -5,13 +5,19 @@ · 4 unmodified lines
55 * Copyright (c) 2017-2020, Silicon Laboratories, Inc.
66 * Copyright (c) 2010, ST-Ericsson
77 */
8+#include <linux/module.h>
89 #include <linux/mmc/sdio.h>
910 #include <linux/mmc/sdio_func.h>
1011 #include <linux/mmc/card.h>
12+#include <linux/interrupt.h>
1113 #include <linux/of_irq.h>
14+#include <linux/irq.h>
1215
1316 #include "bus.h"
1417 #include "wfx.h"
18+#include "hwio.h"
19+#include "main.h"
20+#include "bh.h"
1521
1622 static const struct wfx_platform_data wfx_sdio_pdata = {
1723 .file_fw = "wfm_wf200",
drivers/staging/wfx/bus_spi.c+7−0
@@ -6,12 +6,19 @@ · 5 unmodified lines
66 * Copyright (c) 2011, Sagrad Inc.
77 * Copyright (c) 2010, ST-Ericsson
88 */
9+#include <linux/module.h>
10+#include <linux/delay.h>
11+#include <linux/gpio/consumer.h>
912 #include <linux/spi/spi.h>
13+#include <linux/interrupt.h>
1014 #include <linux/irq.h>
1115 #include <linux/of.h>
1216
1317 #include "bus.h"
1418 #include "wfx.h"
19+#include "hwio.h"
20+#include "main.h"
21+#include "bh.h"
1522
1623 #define SET_WRITE 0x7FFF /* usage: and operation */
1724 #define SET_READ 0x8000 /* usage: or operation */
drivers/staging/wfx/data_rx.c+5−0
@@ -5,8 +5,13 @@ · 4 unmodified lines
55 * Copyright (c) 2017-2020, Silicon Laboratories, Inc.
66 * Copyright (c) 2010, ST-Ericsson
77 */
8+#include <linux/etherdevice.h>
9+#include <net/mac80211.h>
10+
811 #include "data_rx.h"
912 #include "wfx.h"
13+#include "bh.h"
14+#include "sta.h"
1015
1116 static void wfx_rx_handle_ba(struct wfx_vif *wvif, struct ieee80211_mgmt *mgmt)
1217 {
drivers/staging/wfx/data_tx.c+5−0
@@ -6,9 +6,14 @@ · 5 unmodified lines
66 * Copyright (c) 2010, ST-Ericsson
77 */
88 #include <net/mac80211.h>
9+#include <linux/etherdevice.h>
910
11+#include "data_tx.h"
1012 #include "wfx.h"
13+#include "bh.h"
1114 #include "sta.h"
15+#include "queue.h"
16+#include "debug.h"
1217 #include "traces.h"
1318 #include "hif_tx_mib.h"
1419
drivers/staging/wfx/data_tx.h+3−0
@@ -8,6 +8,9 @@ · 7 unmodified lines
88 #ifndef WFX_DATA_TX_H
99 #define WFX_DATA_TX_H
1010
11+#include <linux/list.h>
12+#include <net/mac80211.h>
13+
1114 #include "hif_api_cmd.h"
1215 #include "hif_api_mib.h"
1316
drivers/staging/wfx/debug.c+6−0
@@ -5,9 +5,15 @@ · 4 unmodified lines
55 * Copyright (c) 2017-2020, Silicon Laboratories, Inc.
66 * Copyright (c) 2010, ST-Ericsson
77 */
8+#include <linux/debugfs.h>
9+#include <linux/seq_file.h>
10+#include <linux/crc32.h>
11+
812 #include "debug.h"
913 #include "wfx.h"
1014 #include "sta.h"
15+#include "main.h"
16+#include "hif_tx.h"
1117 #include "hif_tx_mib.h"
1218
1319 #define CREATE_TRACE_POINTS
drivers/staging/wfx/fwio.c+2−0
@@ -6,6 +6,8 @@ · 5 unmodified lines
66 * Copyright (c) 2010, ST-Ericsson
77 */
88 #include <linux/firmware.h>
9+#include <linux/slab.h>
10+#include <linux/mm.h>
911 #include <linux/bitfield.h>
1012
1113 #include "fwio.h"
drivers/staging/wfx/hif_api_cmd.h+4−0
@@ -8,6 +8,10 @@ · 7 unmodified lines
88 #ifndef WFX_HIF_API_CMD_H
99 #define WFX_HIF_API_CMD_H
1010
11+#include <linux/ieee80211.h>
12+
13+#include "hif_api_general.h"
14+
1115 enum hif_requests_ids {
1216 HIF_REQ_ID_RESET = 0x0a,
1317 HIF_REQ_ID_READ_MIB = 0x05,
drivers/staging/wfx/hif_api_general.h+9−0
@@ -8,6 +8,15 @@ · 7 unmodified lines
88 #ifndef WFX_HIF_API_GENERAL_H
99 #define WFX_HIF_API_GENERAL_H
1010
11+#ifdef __KERNEL__
12+#include <linux/types.h>
13+#include <linux/if_ether.h>
14+#else
15+#include <net/ethernet.h>
16+#include <stdint.h>
17+#define __packed __attribute__((__packed__))
18+#endif
19+
1120 #define HIF_ID_IS_INDICATION 0x80
1221 #define HIF_COUNTER_MAX 7
1322
drivers/staging/wfx/hif_tx.c+4−0
@@ -6,7 +6,11 @@ · 5 unmodified lines
66 * Copyright (c) 2017-2020, Silicon Laboratories, Inc.
77 * Copyright (c) 2010, ST-Ericsson
88 */
9+#include <linux/etherdevice.h>
10+
11+#include "hif_tx.h"
912 #include "wfx.h"
13+#include "bh.h"
1014 #include "hwio.h"
1115 #include "debug.h"
1216 #include "sta.h"
drivers/staging/wfx/hif_tx_mib.c+5−0
@@ -6,8 +6,13 @@ · 5 unmodified lines
66 * Copyright (c) 2010, ST-Ericsson
77 * Copyright (C) 2010, ST-Ericsson SA
88 */
9+
10+#include <linux/etherdevice.h>
11+
912 #include "wfx.h"
13+#include "hif_tx.h"
1014 #include "hif_tx_mib.h"
15+#include "hif_api_mib.h"
1116
1217 int hif_set_output_power(struct wfx_vif *wvif, int val)
1318 {
drivers/staging/wfx/hwio.c+3−0
@@ -5,10 +5,13 @@ · 4 unmodified lines
55 * Copyright (c) 2017-2020, Silicon Laboratories, Inc.
66 * Copyright (c) 2010, ST-Ericsson
77 */
8+#include <linux/kernel.h>
9+#include <linux/delay.h>
810 #include <linux/slab.h>
911
1012 #include "hwio.h"
1113 #include "wfx.h"
14+#include "bus.h"
1215 #include "traces.h"
1316
1417 /*
drivers/staging/wfx/hwio.h+2−0
@@ -8,6 +8,8 @@ · 7 unmodified lines
88 #ifndef WFX_HWIO_H
99 #define WFX_HWIO_H
1010
11+#include <linux/types.h>
12+
1113 struct wfx_dev;
1214
1315 int wfx_data_read(struct wfx_dev *wdev, void *buf, size_t buf_len);
drivers/staging/wfx/key.c+2−0
@@ -5,10 +5,12 @@ · 4 unmodified lines
55 * Copyright (c) 2017-2020, Silicon Laboratories, Inc.
66 * Copyright (c) 2010, ST-Ericsson
77 */
8+#include <linux/etherdevice.h>
89 #include <net/mac80211.h>
910
1011 #include "key.h"
1112 #include "wfx.h"
13+#include "hif_tx_mib.h"
1214
1315 static int wfx_alloc_key(struct wfx_dev *wdev)
1416 {
drivers/staging/wfx/key.h+2−0
@@ -8,6 +8,8 @@ · 7 unmodified lines
88 #ifndef WFX_KEY_H
99 #define WFX_KEY_H
1010
11+#include <net/mac80211.h>
12+
1113 struct wfx_dev;
1214 struct wfx_vif;
1315
drivers/staging/wfx/main.c+7−0
@@ -10,21 +10,28 @@ · 9 unmodified lines
1010 * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net>
1111 * Copyright (c) 2004-2006 Jean-Baptiste Note <jbnote@gmail.com>, et al.
1212 */
13+#include <linux/module.h>
1314 #include <linux/of.h>
1415 #include <linux/of_net.h>
16+#include <linux/gpio/consumer.h>
1517 #include <linux/mmc/sdio_func.h>
1618 #include <linux/spi/spi.h>
19+#include <linux/etherdevice.h>
1720 #include <linux/firmware.h>
1821
22+#include "main.h"
1923 #include "wfx.h"
2024 #include "fwio.h"
2125 #include "hwio.h"
2226 #include "bus.h"
27+#include "bh.h"
2328 #include "sta.h"
2429 #include "key.h"
2530 #include "scan.h"
2631 #include "debug.h"
32+#include "data_tx.h"
2733 #include "hif_tx_mib.h"
34+#include "hif_api_cmd.h"
2835
2936 #define WFX_PDS_MAX_SIZE 1500
3037
drivers/staging/wfx/main.h+3−0
@@ -10,8 +10,11 @@ · 9 unmodified lines
1010 #ifndef WFX_MAIN_H
1111 #define WFX_MAIN_H
1212
13+#include <linux/device.h>
1314 #include <linux/gpio/consumer.h>
1415
16+#include "hif_api_general.h"
17+
1518 struct wfx_dev;
1619 struct hwbus_ops;
1720
drivers/staging/wfx/queue.c+4−0
@@ -5,9 +5,13 @@ · 4 unmodified lines
55 * Copyright (c) 2017-2020, Silicon Laboratories, Inc.
66 * Copyright (c) 2010, ST-Ericsson
77 */
8+#include <linux/sched.h>
89 #include <net/mac80211.h>
910
11+#include "queue.h"
1012 #include "wfx.h"
13+#include "sta.h"
14+#include "data_tx.h"
1115 #include "traces.h"
1216
1317 void wfx_tx_lock(struct wfx_dev *wdev)
drivers/staging/wfx/queue.h+3−0
@@ -8,6 +8,9 @@ · 7 unmodified lines
88 #ifndef WFX_QUEUE_H
99 #define WFX_QUEUE_H
1010
11+#include <linux/skbuff.h>
12+#include <linux/atomic.h>
13+
1114 struct wfx_dev;
1215 struct wfx_vif;
1316
drivers/staging/wfx/scan.h+2−0
@@ -8,6 +8,8 @@ · 7 unmodified lines
88 #ifndef WFX_SCAN_H
99 #define WFX_SCAN_H
1010
11+#include <net/mac80211.h>
12+
1113 struct wfx_dev;
1214 struct wfx_vif;
1315
drivers/staging/wfx/sta.c+6−0
@@ -5,11 +5,17 @@ · 4 unmodified lines
55 * Copyright (c) 2017-2020, Silicon Laboratories, Inc.
66 * Copyright (c) 2010, ST-Ericsson
77 */
8+#include <linux/etherdevice.h>
89 #include <net/mac80211.h>
910
1011 #include "sta.h"
1112 #include "wfx.h"
13+#include "fwio.h"
14+#include "bh.h"
15+#include "key.h"
1216 #include "scan.h"
17+#include "debug.h"
18+#include "hif_tx.h"
1319 #include "hif_tx_mib.h"
1420
1521 #define HIF_MAX_ARP_IP_ADDRTABLE_ENTRIES 2
drivers/staging/wfx/sta.h+2−0
@@ -8,6 +8,8 @@ · 7 unmodified lines
88 #ifndef WFX_STA_H
99 #define WFX_STA_H
1010
11+#include <net/mac80211.h>
12+
1113 struct wfx_dev;
1214 struct wfx_vif;
1315
drivers/staging/wfx/traces.h+3−0
@@ -12,8 +12,11 @@ · 11 unmodified lines
1212 #define _WFX_TRACE_H
1313
1414 #include <linux/tracepoint.h>
15+#include <net/mac80211.h>
1516
1617 #include "bus.h"
18+#include "hif_api_cmd.h"
19+#include "hif_api_mib.h"
1720
1821 /* The hell below need some explanations. For each symbolic number, we need to
1922 * define it with TRACE_DEFINE_ENUM() and in a list for __print_symbolic.
drivers/staging/wfx/wfx.h+3−0
@@ -10,6 +10,9 @@ · 9 unmodified lines
1010 #ifndef WFX_H
1111 #define WFX_H
1212
13+#include <linux/completion.h>
14+#include <linux/workqueue.h>
15+#include <linux/mutex.h>
1316 #include <linux/nospec.h>
1417 #include <net/mac80211.h>
1518
drivers/tee/optee/core.c+0−1
@@ -747,7 +747,6 @@ module_platform_driver(optee_driver); · 746 unmodified lines
747747
748748 MODULE_AUTHOR("Linaro");
749749 MODULE_DESCRIPTION("OP-TEE driver");
750−MODULE_SUPPORTED_DEVICE("");
751750 MODULE_VERSION("1.0");
752751 MODULE_LICENSE("GPL v2");
753752 MODULE_ALIAS("platform:optee");
drivers/thermal/thermal_sysfs.c+3−0
@@ -674,6 +674,9 @@ void thermal_cooling_device_stats_update(struct thermal_cooling_device *cdev, · 673 unmodified lines
674674 {
675675 struct cooling_dev_stats *stats = cdev->stats;
676676
677+ if (!stats)
678+ return;
679+
677680 spin_lock(&stats->lock);
678681
679682 if (stats->state == new_state)
drivers/thunderbolt/switch.c+8−10
@@ -768,12 +768,6 @@ static int tb_init_port(struct tb_port *port) · 767 unmodified lines
768768
769769 tb_dump_port(port->sw->tb, &port->config);
770770
771− /* Control port does not need HopID allocation */
772− if (port->port) {
773− ida_init(&port->in_hopids);
774− ida_init(&port->out_hopids);
775− }
776−
777771 INIT_LIST_HEAD(&port->list);
778772 return 0;
779773
@@ -1842,10 +1836,8 @@ static void tb_switch_release(struct device *dev) · 1062 unmodified lines
18421836 dma_port_free(sw->dma_port);
18431837
18441838 tb_switch_for_each_port(sw, port) {
1845− if (!port->disabled) {
1846− ida_destroy(&port->in_hopids);
1847− ida_destroy(&port->out_hopids);
1848− }
1839+ ida_destroy(&port->in_hopids);
1840+ ida_destroy(&port->out_hopids);
18491841 }
18501842
18511843 kfree(sw->uuid);
@@ -2025,6 +2017,12 @@ struct tb_switch *tb_switch_alloc(struct tb *tb, struct device *parent, · 173 unmodified lines
20252017 /* minimum setup for tb_find_cap and tb_drom_read to work */
20262018 sw->ports[i].sw = sw;
20272019 sw->ports[i].port = i;
2020+
2021+ /* Control port does not need HopID allocation */
2022+ if (i) {
2023+ ida_init(&sw->ports[i].in_hopids);
2024+ ida_init(&sw->ports[i].out_hopids);
2025+ }
20282026 }
20292027
20302028 ret = tb_switch_find_vse_cap(sw, TB_VSE_CAP_PLUG_EVENTS);
drivers/thunderbolt/tb.c+4−0
@@ -138,6 +138,10 @@ static void tb_discover_tunnels(struct tb_switch *sw) · 137 unmodified lines
138138 parent->boot = true;
139139 parent = tb_switch_parent(parent);
140140 }
141+ } else if (tb_tunnel_is_dp(tunnel)) {
142+ /* Keep the domain from powering down */
143+ pm_runtime_get_sync(&tunnel->src_port->sw->dev);
144+ pm_runtime_get_sync(&tunnel->dst_port->sw->dev);
141145 }
142146
143147 list_add_tail(&tunnel->list, &tcm->tunnel_list);
drivers/tty/pty.c+2−13
@@ -66,8 +66,7 @@ static void pty_close(struct tty_struct *tty, struct file *filp) · 65 unmodified lines
6666 wake_up_interruptible(&tty->link->read_wait);
6767 wake_up_interruptible(&tty->link->write_wait);
6868 if (tty->driver->subtype == PTY_TYPE_MASTER) {
69− struct file *f;
70−
69+ set_bit(TTY_OTHER_CLOSED, &tty->flags);
7170 #ifdef CONFIG_UNIX98_PTYS
7271 if (tty->driver == ptm_driver) {
7372 mutex_lock(&devpts_mutex);
@@ -76,17 +75,7 @@ static void pty_close(struct tty_struct *tty, struct file *filp) · 2 unmodified lines
7675 mutex_unlock(&devpts_mutex);
7776 }
7877 #endif
79−
80− /*
81− * This hack is required because a program can open a
82− * pty and redirect a console to it, but if the pty is
83− * closed and the console is not released, then the
84− * slave side will never close. So release the
85− * redirect when the master closes.
86− */
87− f = tty_release_redirect(tty->link);
88− if (f)
89− fput(f);
78+ tty_vhangup(tty->link);
9079 }
9180 }
9281
drivers/tty/serial/icom.c+0−2
@@ -1639,8 +1639,6 @@ module_exit(icom_exit); · 1638 unmodified lines
16391639
16401640 MODULE_AUTHOR("Michael Anderson <mjanders@us.ibm.com>");
16411641 MODULE_DESCRIPTION("IBM iSeries Serial IOA driver");
1642−MODULE_SUPPORTED_DEVICE
1643− ("IBM iSeries 2745, 2771, 2772, 2742, 2793 and 2805 Communications adapters");
16441642 MODULE_LICENSE("GPL");
16451643 MODULE_FIRMWARE("icom_call_setup.bin");
16461644 MODULE_FIRMWARE("icom_res_dce.bin");
drivers/tty/serial/jsm/jsm_driver.c+0−1
@@ -19,7 +19,6 @@ · 18 unmodified lines
1919 MODULE_AUTHOR("Digi International, https://www.digi.com");
2020 MODULE_DESCRIPTION("Driver for the Digi International Neo and Classic PCI based product line");
2121 MODULE_LICENSE("GPL");
22−MODULE_SUPPORTED_DEVICE("jsm");
2322
2423 #define JSM_DRIVER_NAME "jsm"
2524 #define NR_PORTS 32
drivers/tty/serial/max310x.c+5−24
@@ -1056,9 +1056,9 @@ static int max310x_startup(struct uart_port *port) · 1055 unmodified lines
10561056 max310x_port_update(port, MAX310X_MODE1_REG,
10571057 MAX310X_MODE1_TRNSCVCTRL_BIT, 0);
10581058
1059− /* Reset FIFOs */
1060− max310x_port_write(port, MAX310X_MODE2_REG,
1061− MAX310X_MODE2_FIFORST_BIT);
1059+ /* Configure MODE2 register & Reset FIFOs*/
1060+ val = MAX310X_MODE2_RXEMPTINV_BIT | MAX310X_MODE2_FIFORST_BIT;
1061+ max310x_port_write(port, MAX310X_MODE2_REG, val);
10621062 max310x_port_update(port, MAX310X_MODE2_REG,
10631063 MAX310X_MODE2_FIFORST_BIT, 0);
10641064
@@ -1086,27 +1086,8 @@ static int max310x_startup(struct uart_port *port) · 21 unmodified lines
10861086 /* Clear IRQ status register */
10871087 max310x_port_read(port, MAX310X_IRQSTS_REG);
10881088
1089− /*
1090− * Let's ask for an interrupt after a timeout equivalent to
1091− * the receiving time of 4 characters after the last character
1092− * has been received.
1093− */
1094− max310x_port_write(port, MAX310X_RXTO_REG, 4);
1095−
1096− /*
1097− * Make sure we also get RX interrupts when the RX FIFO is
1098− * filling up quickly, so get an interrupt when half of the RX
1099− * FIFO has been filled in.
1100− */
1101− max310x_port_write(port, MAX310X_FIFOTRIGLVL_REG,
1102− MAX310X_FIFOTRIGLVL_RX(MAX310X_FIFO_SIZE / 2));
1103−
1104− /* Enable RX timeout interrupt in LSR */
1105− max310x_port_write(port, MAX310X_LSR_IRQEN_REG,
1106− MAX310X_LSR_RXTO_BIT);
1107−
1108− /* Enable LSR, RX FIFO trigger, CTS change interrupts */
1109− val = MAX310X_IRQ_LSR_BIT | MAX310X_IRQ_RXFIFO_BIT | MAX310X_IRQ_TXEMPTY_BIT;
1089+ /* Enable RX, TX, CTS change interrupts */
1090+ val = MAX310X_IRQ_RXEMPTY_BIT | MAX310X_IRQ_TXEMPTY_BIT;
11101091 max310x_port_write(port, MAX310X_IRQEN_REG, val | MAX310X_IRQ_CTS_BIT);
11111092
11121093 return 0;
drivers/tty/tty_io.c+2−3
@@ -544,9 +544,7 @@ EXPORT_SYMBOL_GPL(tty_wakeup); · 543 unmodified lines
544544 * @tty: tty device
545545 *
546546 * This is available to the pty code so if the master closes, if the
547− * slave is a redirect it can release the redirect. It returns the
548− * filp for the redirect, which must be fput when the operations on
549− * the tty are completed.
547+ * slave is a redirect it can release the redirect.
550548 */
551549 struct file *tty_release_redirect(struct tty_struct *tty)
552550 {
@@ -561,6 +559,7 @@ struct file *tty_release_redirect(struct tty_struct *tty) · 8 unmodified lines
561559
562560 return f;
563561 }
562+EXPORT_SYMBOL_GPL(tty_release_redirect);
564563
565564 /**
566565 * __tty_hangup - actual handler for hangup events
drivers/usb/cdns3/cdnsp-ring.c+4−1
@@ -2197,7 +2197,10 @@ static int cdnsp_queue_isoc_tx(struct cdnsp_device *pdev, · 2196 unmodified lines
21972197 * inverted in the first TDs isoc TRB.
21982198 */
21992199 field = TRB_TYPE(TRB_ISOC) | TRB_TLBPC(last_burst_pkt) |
2200− start_cycle ? 0 : 1 | TRB_SIA | TRB_TBC(burst_count);
2200+ TRB_SIA | TRB_TBC(burst_count);
2201+
2202+ if (!start_cycle)
2203+ field |= TRB_CYCLE;
22012204
22022205 /* Fill the rest of the TRB fields, and remaining normal TRBs. */
22032206 for (i = 0; i < trbs_per_td; i++) {
drivers/usb/class/cdc-acm.c+5−0
@@ -1935,6 +1935,11 @@ static const struct usb_device_id acm_ids[] = { · 1934 unmodified lines
19351935 .driver_info = SEND_ZERO_PACKET,
19361936 },
19371937
1938+ /* Exclude Goodix Fingerprint Reader */
1939+ { USB_DEVICE(0x27c6, 0x5395),
1940+ .driver_info = IGNORE_DEVICE,
1941+ },
1942+
19381943 /* control interfaces without any protocol set */
19391944 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM,
19401945 USB_CDC_PROTO_NONE) },
drivers/usb/class/usblp.c+12−4
@@ -494,16 +494,24 @@ static int usblp_release(struct inode *inode, struct file *file) · 493 unmodified lines
494494 /* No kernel lock - fine */
495495 static __poll_t usblp_poll(struct file *file, struct poll_table_struct *wait)
496496 {
497− __poll_t ret;
497+ struct usblp *usblp = file->private_data;
498+ __poll_t ret = 0;
498499 unsigned long flags;
499500
500− struct usblp *usblp = file->private_data;
501501 /* Should we check file->f_mode & FMODE_WRITE before poll_wait()? */
502502 poll_wait(file, &usblp->rwait, wait);
503503 poll_wait(file, &usblp->wwait, wait);
504+
505+ mutex_lock(&usblp->mut);
506+ if (!usblp->present)
507+ ret |= EPOLLHUP;
508+ mutex_unlock(&usblp->mut);
509+
504510 spin_lock_irqsave(&usblp->lock, flags);
505− ret = ((usblp->bidir && usblp->rcomplete) ? EPOLLIN | EPOLLRDNORM : 0) |
506− ((usblp->no_paper || usblp->wcomplete) ? EPOLLOUT | EPOLLWRNORM : 0);
511+ if (usblp->bidir && usblp->rcomplete)
512+ ret |= EPOLLIN | EPOLLRDNORM;
513+ if (usblp->no_paper || usblp->wcomplete)
514+ ret |= EPOLLOUT | EPOLLWRNORM;
507515 spin_unlock_irqrestore(&usblp->lock, flags);
508516 return ret;
509517 }
drivers/usb/core/usb.c+32−0
@@ -748,6 +748,38 @@ void usb_put_intf(struct usb_interface *intf) · 747 unmodified lines
748748 }
749749 EXPORT_SYMBOL_GPL(usb_put_intf);
750750
751+/**
752+ * usb_intf_get_dma_device - acquire a reference on the usb interface's DMA endpoint
753+ * @intf: the usb interface
754+ *
755+ * While a USB device cannot perform DMA operations by itself, many USB
756+ * controllers can. A call to usb_intf_get_dma_device() returns the DMA endpoint
757+ * for the given USB interface, if any. The returned device structure must be
758+ * released with put_device().
759+ *
760+ * See also usb_get_dma_device().
761+ *
762+ * Returns: A reference to the usb interface's DMA endpoint; or NULL if none
763+ * exists.
764+ */
765+struct device *usb_intf_get_dma_device(struct usb_interface *intf)
766+{
767+ struct usb_device *udev = interface_to_usbdev(intf);
768+ struct device *dmadev;
769+
770+ if (!udev->bus)
771+ return NULL;
772+
773+ dmadev = get_device(udev->bus->sysdev);
774+ if (!dmadev || !dmadev->dma_mask) {
775+ put_device(dmadev);
776+ return NULL;
777+ }
778+
779+ return dmadev;
780+}
781+EXPORT_SYMBOL_GPL(usb_intf_get_dma_device);
782+
751783 /* USB device locking
752784 *
753785 * USB devices and interfaces are locked using the semaphore in their
drivers/usb/dwc3/dwc3-qcom.c+13−5
@@ -358,8 +358,10 @@ static int dwc3_qcom_suspend(struct dwc3_qcom *qcom) · 357 unmodified lines
358358 if (ret)
359359 dev_warn(qcom->dev, "failed to disable interconnect: %d\n", ret);
360360
361+ if (device_may_wakeup(qcom->dev))
362+ dwc3_qcom_enable_interrupts(qcom);
363+
361364 qcom->is_suspended = true;
362− dwc3_qcom_enable_interrupts(qcom);
363365
364366 return 0;
365367 }
@@ -372,7 +374,8 @@ static int dwc3_qcom_resume(struct dwc3_qcom *qcom) · 6 unmodified lines
372374 if (!qcom->is_suspended)
373375 return 0;
374376
375− dwc3_qcom_disable_interrupts(qcom);
377+ if (device_may_wakeup(qcom->dev))
378+ dwc3_qcom_disable_interrupts(qcom);
376379
377380 for (i = 0; i < qcom->num_clocks; i++) {
378381 ret = clk_prepare_enable(qcom->clks[i]);
@@ -650,16 +653,19 @@ static int dwc3_qcom_of_register_core(struct platform_device *pdev) · 271 unmodified lines
650653 ret = of_platform_populate(np, NULL, NULL, dev);
651654 if (ret) {
652655 dev_err(dev, "failed to register dwc3 core - %d\n", ret);
653− return ret;
656+ goto node_put;
654657 }
655658
656659 qcom->dwc3 = of_find_device_by_node(dwc3_np);
657660 if (!qcom->dwc3) {
661+ ret = -ENODEV;
658662 dev_err(dev, "failed to get dwc3 platform device\n");
659− return -ENODEV;
660663 }
661664
662− return 0;
665+node_put:
666+ of_node_put(dwc3_np);
667+
668+ return ret;
663669 }
664670
665671 static struct platform_device *
@@ -938,6 +944,8 @@ static const struct dwc3_acpi_pdata sdm845_acpi_urs_pdata = { · 272 unmodified lines
938944 static const struct acpi_device_id dwc3_qcom_acpi_match[] = {
939945 { "QCOM2430", (unsigned long)&sdm845_acpi_pdata },
940946 { "QCOM0304", (unsigned long)&sdm845_acpi_urs_pdata },
947+ { "QCOM0497", (unsigned long)&sdm845_acpi_urs_pdata },
948+ { "QCOM04A6", (unsigned long)&sdm845_acpi_pdata },
941949 { },
942950 };
943951 MODULE_DEVICE_TABLE(acpi, dwc3_qcom_acpi_match);
drivers/usb/dwc3/gadget.c+5−6
@@ -783,8 +783,6 @@ static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep) · 782 unmodified lines
783783
784784 trace_dwc3_gadget_ep_disable(dep);
785785
786− dwc3_remove_requests(dwc, dep);
787−
788786 /* make sure HW endpoint isn't stalled */
789787 if (dep->flags & DWC3_EP_STALL)
790788 __dwc3_gadget_ep_set_halt(dep, 0, false);
@@ -803,6 +801,8 @@ static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep) · 12 unmodified lines
803801 dep->endpoint.desc = NULL;
804802 }
805803
804+ dwc3_remove_requests(dwc, dep);
805+
806806 return 0;
807807 }
808808
@@ -1617,7 +1617,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) · 808 unmodified lines
16171617 {
16181618 struct dwc3 *dwc = dep->dwc;
16191619
1620− if (!dep->endpoint.desc || !dwc->pullups_connected) {
1620+ if (!dep->endpoint.desc || !dwc->pullups_connected || !dwc->connected) {
16211621 dev_err(dwc->dev, "%s: can't queue to disabled endpoint\n",
16221622 dep->name);
16231623 return -ESHUTDOWN;
@@ -2247,6 +2247,7 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on) · 623 unmodified lines
22472247 if (!is_on) {
22482248 u32 count;
22492249
2250+ dwc->connected = false;
22502251 /*
22512252 * In the Synopsis DesignWare Cores USB3 Databook Rev. 3.30a
22522253 * Section 4.1.8 Table 4-7, it states that for a device-initiated
@@ -2271,7 +2272,6 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on) · 18 unmodified lines
22712272 dwc->ev_buf->lpos = (dwc->ev_buf->lpos + count) %
22722273 dwc->ev_buf->length;
22732274 }
2274− dwc->connected = false;
22752275 } else {
22762276 __dwc3_gadget_start(dwc);
22772277 }
@@ -3321,8 +3321,6 @@ static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc) · 1043 unmodified lines
33213321 {
33223322 u32 reg;
33233323
3324− dwc->connected = true;
3325−
33263324 /*
33273325 * WORKAROUND: DWC3 revisions <1.88a have an issue which
33283326 * would cause a missing Disconnect Event if there's a
@@ -3362,6 +3360,7 @@ static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc) · 33 unmodified lines
33623360 * transfers."
33633361 */
33643362 dwc3_stop_active_transfers(dwc);
3363+ dwc->connected = true;
33653364
33663365 reg = dwc3_readl(dwc->regs, DWC3_DCTL);
33673366 reg &= ~DWC3_DCTL_TSTCTRL_MASK;
drivers/usb/gadget/configfs.c+10−4
@@ -97,6 +97,8 @@ struct gadget_config_name { · 96 unmodified lines
9797 struct list_head list;
9898 };
9999
100+#define USB_MAX_STRING_WITH_NULL_LEN (USB_MAX_STRING_LEN+1)
101+
100102 static int usb_string_copy(const char *s, char **s_copy)
101103 {
102104 int ret;
@@ -106,12 +108,16 @@ static int usb_string_copy(const char *s, char **s_copy) · 3 unmodified lines
106108 if (ret > USB_MAX_STRING_LEN)
107109 return -EOVERFLOW;
108110
109− str = kstrdup(s, GFP_KERNEL);
110− if (!str)
111− return -ENOMEM;
111+ if (copy) {
112+ str = copy;
113+ } else {
114+ str = kmalloc(USB_MAX_STRING_WITH_NULL_LEN, GFP_KERNEL);
115+ if (!str)
116+ return -ENOMEM;
117+ }
118+ strcpy(str, s);
112119 if (str[ret - 1] == '\n')
113120 str[ret - 1] = '\0';
114− kfree(copy);
115121 *s_copy = str;
116122 return 0;
117123 }
drivers/usb/gadget/function/f_uac1.c+1−0
@@ -499,6 +499,7 @@ static void f_audio_disable(struct usb_function *f) · 498 unmodified lines
499499 uac1->as_out_alt = 0;
500500 uac1->as_in_alt = 0;
501501
502+ u_audio_stop_playback(&uac1->g_audio);
502503 u_audio_stop_capture(&uac1->g_audio);
503504 }
504505
drivers/usb/gadget/function/f_uac2.c+1−1
@@ -478,7 +478,7 @@ static int set_ep_max_packet_size(const struct f_uac2_opts *uac2_opts, · 477 unmodified lines
478478 }
479479
480480 max_size_bw = num_channels(chmask) * ssize *
481− DIV_ROUND_UP(srate, factor / (1 << (ep_desc->bInterval - 1)));
481+ ((srate / (factor / (1 << (ep_desc->bInterval - 1)))) + 1);
482482 ep_desc->wMaxPacketSize = cpu_to_le16(min_t(u16, max_size_bw,
483483 max_size_ep));
484484
drivers/usb/gadget/function/u_ether_configfs.h+2−3
@@ -182,12 +182,11 @@ out: \ · 181 unmodified lines
182182 size_t len) \
183183 { \
184184 struct f_##_f_##_opts *opts = to_f_##_f_##_opts(item); \
185− int ret; \
185+ int ret = -EINVAL; \
186186 u8 val; \
187187 \
188188 mutex_lock(&opts->lock); \
189− ret = sscanf(page, "%02hhx", &val); \
190− if (ret > 0) { \
189+ if (sscanf(page, "%02hhx", &val) > 0) { \
191190 opts->_n_ = val; \
192191 ret = len; \
193192 } \
drivers/usb/gadget/udc/s3c2410_udc.c+2−2
@@ -1773,8 +1773,8 @@ static int s3c2410_udc_probe(struct platform_device *pdev) · 1772 unmodified lines
17731773 udc_info = dev_get_platdata(&pdev->dev);
17741774
17751775 base_addr = devm_platform_ioremap_resource(pdev, 0);
1776− if (!base_addr) {
1777− retval = -ENOMEM;
1776+ if (IS_ERR(base_addr)) {
1777+ retval = PTR_ERR(base_addr);
17781778 goto err_mem;
17791779 }
17801780
drivers/usb/host/xhci-pci.c+11−2
@@ -66,6 +66,7 @@ · 65 unmodified lines
6666 #define PCI_DEVICE_ID_ASMEDIA_1042A_XHCI 0x1142
6767 #define PCI_DEVICE_ID_ASMEDIA_1142_XHCI 0x1242
6868 #define PCI_DEVICE_ID_ASMEDIA_2142_XHCI 0x2142
69+#define PCI_DEVICE_ID_ASMEDIA_3242_XHCI 0x3242
6970
7071 static const char hcd_name[] = "xhci_hcd";
7172
@@ -276,11 +277,14 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) · 204 unmodified lines
276277 pdev->device == PCI_DEVICE_ID_ASMEDIA_1042_XHCI)
277278 xhci->quirks |= XHCI_BROKEN_STREAMS;
278279 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
279− pdev->device == PCI_DEVICE_ID_ASMEDIA_1042A_XHCI)
280+ pdev->device == PCI_DEVICE_ID_ASMEDIA_1042A_XHCI) {
280281 xhci->quirks |= XHCI_TRUST_TX_LENGTH;
282+ xhci->quirks |= XHCI_NO_64BIT_SUPPORT;
283+ }
281284 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
282285 (pdev->device == PCI_DEVICE_ID_ASMEDIA_1142_XHCI ||
283− pdev->device == PCI_DEVICE_ID_ASMEDIA_2142_XHCI))
286+ pdev->device == PCI_DEVICE_ID_ASMEDIA_2142_XHCI ||
287+ pdev->device == PCI_DEVICE_ID_ASMEDIA_3242_XHCI))
284288 xhci->quirks |= XHCI_NO_64BIT_SUPPORT;
285289
286290 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
@@ -295,6 +299,11 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) · 8 unmodified lines
295299 pdev->device == 0x9026)
296300 xhci->quirks |= XHCI_RESET_PLL_ON_DISCONNECT;
297301
302+ if (pdev->vendor == PCI_VENDOR_ID_AMD &&
303+ (pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_2 ||
304+ pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_4))
305+ xhci->quirks |= XHCI_NO_SOFT_RETRY;
306+
298307 if (xhci->quirks & XHCI_RESET_ON_RESUME)
299308 xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
300309 "QUIRK: Resetting on resume");
drivers/usb/host/xhci-ring.c+2−1
@@ -2484,7 +2484,8 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td, · 2483 unmodified lines
24842484 remaining = 0;
24852485 break;
24862486 case COMP_USB_TRANSACTION_ERROR:
2487− if ((ep_ring->err_count++ > MAX_SOFT_RETRY) ||
2487+ if (xhci->quirks & XHCI_NO_SOFT_RETRY ||
2488+ (ep_ring->err_count++ > MAX_SOFT_RETRY) ||
24882489 le32_to_cpu(slot_ctx->tt_info) & TT_SLOT)
24892490 break;
24902491
drivers/usb/host/xhci.c+43−35
@@ -883,44 +883,42 @@ static void xhci_clear_command_ring(struct xhci_hcd *xhci) · 882 unmodified lines
883883 xhci_set_cmd_ring_deq(xhci);
884884 }
885885
886−static void xhci_disable_port_wake_on_bits(struct xhci_hcd *xhci)
886+/*
887+ * Disable port wake bits if do_wakeup is not set.
888+ *
889+ * Also clear a possible internal port wake state left hanging for ports that
890+ * detected termination but never successfully enumerated (trained to 0U).
891+ * Internal wake causes immediate xHCI wake after suspend. PORT_CSC write done
892+ * at enumeration clears this wake, force one here as well for unconnected ports
893+ */
894+
895+static void xhci_disable_hub_port_wake(struct xhci_hcd *xhci,
896+ struct xhci_hub *rhub,
897+ bool do_wakeup)
887898 {
888− struct xhci_port **ports;
889− int port_index;
890899 unsigned long flags;
891900 u32 t1, t2, portsc;
901+ int i;
892902
893903 spin_lock_irqsave(&xhci->lock, flags);
894904
895− /* disable usb3 ports Wake bits */
896− port_index = xhci->usb3_rhub.num_ports;
897− ports = xhci->usb3_rhub.ports;
898− while (port_index--) {
899− t1 = readl(ports[port_index]->addr);
900− portsc = t1;
901− t1 = xhci_port_state_to_neutral(t1);
902− t2 = t1 & ~PORT_WAKE_BITS;
903− if (t1 != t2) {
904− writel(t2, ports[port_index]->addr);
905− xhci_dbg(xhci, "disable wake bits port %d-%d, portsc: 0x%x, write: 0x%x\n",
906− xhci->usb3_rhub.hcd->self.busnum,
907− port_index + 1, portsc, t2);
908− }
909− }
905+ for (i = 0; i < rhub->num_ports; i++) {
906+ portsc = readl(rhub->ports[i]->addr);
907+ t1 = xhci_port_state_to_neutral(portsc);
908+ t2 = t1;
909+
910+ /* clear wake bits if do_wake is not set */
911+ if (!do_wakeup)
912+ t2 &= ~PORT_WAKE_BITS;
913+
914+ /* Don't touch csc bit if connected or connect change is set */
915+ if (!(portsc & (PORT_CSC | PORT_CONNECT)))
916+ t2 |= PORT_CSC;
910917
911− /* disable usb2 ports Wake bits */
912− port_index = xhci->usb2_rhub.num_ports;
913− ports = xhci->usb2_rhub.ports;
914− while (port_index--) {
915− t1 = readl(ports[port_index]->addr);
916− portsc = t1;
917− t1 = xhci_port_state_to_neutral(t1);
918− t2 = t1 & ~PORT_WAKE_BITS;
919918 if (t1 != t2) {
920− writel(t2, ports[port_index]->addr);
921− xhci_dbg(xhci, "disable wake bits port %d-%d, portsc: 0x%x, write: 0x%x\n",
922− xhci->usb2_rhub.hcd->self.busnum,
923− port_index + 1, portsc, t2);
919+ writel(t2, rhub->ports[i]->addr);
920+ xhci_dbg(xhci, "config port %d-%d wake bits, portsc: 0x%x, write: 0x%x\n",
921+ rhub->hcd->self.busnum, i + 1, portsc, t2);
924922 }
925923 }
926924 spin_unlock_irqrestore(&xhci->lock, flags);
@@ -983,8 +981,8 @@ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup) · 56 unmodified lines
983981 return -EINVAL;
984982
985983 /* Clear root port wake on bits if wakeup not allowed. */
986− if (!do_wakeup)
987− xhci_disable_port_wake_on_bits(xhci);
984+ xhci_disable_hub_port_wake(xhci, &xhci->usb3_rhub, do_wakeup);
985+ xhci_disable_hub_port_wake(xhci, &xhci->usb2_rhub, do_wakeup);
988986
989987 if (!HCD_HW_ACCESSIBLE(hcd))
990988 return 0;
@@ -1088,6 +1086,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) · 97 unmodified lines
10881086 struct usb_hcd *secondary_hcd;
10891087 int retval = 0;
10901088 bool comp_timer_running = false;
1089+ bool pending_portevent = false;
10911090
10921091 if (!hcd->state)
10931092 return 0;
@@ -1226,13 +1225,22 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) · 132 unmodified lines
12261225
12271226 done:
12281227 if (retval == 0) {
1229− /* Resume root hubs only when have pending events. */
1230− if (xhci_pending_portevent(xhci)) {
1228+ /*
1229+ * Resume roothubs only if there are pending events.
1230+ * USB 3 devices resend U3 LFPS wake after a 100ms delay if
1231+ * the first wake signalling failed, give it that chance.
1232+ */
1233+ pending_portevent = xhci_pending_portevent(xhci);
1234+ if (!pending_portevent) {
1235+ msleep(120);
1236+ pending_portevent = xhci_pending_portevent(xhci);
1237+ }
1238+
1239+ if (pending_portevent) {
12311240 usb_hcd_resume_root_hub(xhci->shared_hcd);
12321241 usb_hcd_resume_root_hub(hcd);
12331242 }
12341243 }
1235−
12361244 /*
12371245 * If system is subject to the Quirk, Compliance Mode Timer needs to
12381246 * be re-initialized Always after a system resume. Ports are subject
drivers/usb/host/xhci.h+1−0
@@ -1891,6 +1891,7 @@ struct xhci_hcd { · 1890 unmodified lines
18911891 #define XHCI_SKIP_PHY_INIT BIT_ULL(37)
18921892 #define XHCI_DISABLE_SPARSE BIT_ULL(38)
18931893 #define XHCI_SG_TRB_CACHE_SIZE_QUIRK BIT_ULL(39)
1894+#define XHCI_NO_SOFT_RETRY BIT_ULL(40)
18941895
18951896 unsigned int num_active_eps;
18961897 unsigned int limit_active_eps;
drivers/usb/misc/ldusb.c+0−1
@@ -117,7 +117,6 @@ MODULE_DEVICE_TABLE(usb, ld_usb_table); · 116 unmodified lines
117117 MODULE_AUTHOR("Michael Hund <mhund@ld-didactic.de>");
118118 MODULE_DESCRIPTION("LD USB Driver");
119119 MODULE_LICENSE("GPL");
120−MODULE_SUPPORTED_DEVICE("LD USB Devices");
121120
122121 /* All interrupt in transfers are collected in a ring buffer to
123122 * avoid racing conditions and get better performance of the driver.
drivers/usb/renesas_usbhs/pipe.c+2−0
@@ -746,6 +746,8 @@ struct usbhs_pipe *usbhs_pipe_malloc(struct usbhs_priv *priv, · 745 unmodified lines
746746
747747 void usbhs_pipe_free(struct usbhs_pipe *pipe)
748748 {
749+ usbhsp_pipe_select(pipe);
750+ usbhsp_pipe_cfg_set(pipe, 0xFFFF, 0);
749751 usbhsp_put_pipe(pipe);
750752 }
751753
drivers/usb/serial/ch341.c+1−0
@@ -86,6 +86,7 @@ static const struct usb_device_id id_table[] = { · 85 unmodified lines
8686 { USB_DEVICE(0x1a86, 0x7522) },
8787 { USB_DEVICE(0x1a86, 0x7523) },
8888 { USB_DEVICE(0x4348, 0x5523) },
89+ { USB_DEVICE(0x9986, 0x7523) },
8990 { },
9091 };
9192 MODULE_DEVICE_TABLE(usb, id_table);
drivers/usb/serial/cp210x.c+3−0
@@ -145,6 +145,7 @@ static const struct usb_device_id id_table[] = { · 144 unmodified lines
145145 { USB_DEVICE(0x10C4, 0x8857) }, /* CEL EM357 ZigBee USB Stick */
146146 { USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */
147147 { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */
148+ { USB_DEVICE(0x10C4, 0x88D8) }, /* Acuity Brands nLight Air Adapter */
148149 { USB_DEVICE(0x10C4, 0x88FB) }, /* CESINEL MEDCAL STII Network Analyzer */
149150 { USB_DEVICE(0x10C4, 0x8938) }, /* CESINEL MEDCAL S II Network Analyzer */
150151 { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */
@@ -201,6 +202,8 @@ static const struct usb_device_id id_table[] = { · 50 unmodified lines
201202 { USB_DEVICE(0x1901, 0x0194) }, /* GE Healthcare Remote Alarm Box */
202203 { USB_DEVICE(0x1901, 0x0195) }, /* GE B850/B650/B450 CP2104 DP UART interface */
203204 { USB_DEVICE(0x1901, 0x0196) }, /* GE B850 CP2105 DP UART interface */
205+ { USB_DEVICE(0x1901, 0x0197) }, /* GE CS1000 Display serial interface */
206+ { USB_DEVICE(0x1901, 0x0198) }, /* GE CS1000 M.2 Key E serial interface */
204207 { USB_DEVICE(0x199B, 0xBA30) }, /* LORD WSDA-200-USB */
205208 { USB_DEVICE(0x19CF, 0x3000) }, /* Parrot NMEA GPS Flight Recorder */
206209 { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */
drivers/usb/serial/io_edgeport.c+16−10
@@ -3003,26 +3003,32 @@ static int edge_startup(struct usb_serial *serial) · 3002 unmodified lines
30033003 response = -ENODEV;
30043004 }
30053005
3006− usb_free_urb(edge_serial->interrupt_read_urb);
3007− kfree(edge_serial->interrupt_in_buffer);
3008−
3009− usb_free_urb(edge_serial->read_urb);
3010− kfree(edge_serial->bulk_in_buffer);
3011−
3012− kfree(edge_serial);
3013−
3014− return response;
3006+ goto error;
30153007 }
30163008
30173009 /* start interrupt read for this edgeport this interrupt will
30183010 * continue as long as the edgeport is connected */
30193011 response = usb_submit_urb(edge_serial->interrupt_read_urb,
30203012 GFP_KERNEL);
3021− if (response)
3013+ if (response) {
30223014 dev_err(ddev, "%s - Error %d submitting control urb\n",
30233015 __func__, response);
3016+
3017+ goto error;
3018+ }
30243019 }
30253020 return response;
3021+
3022+error:
3023+ usb_free_urb(edge_serial->interrupt_read_urb);
3024+ kfree(edge_serial->interrupt_in_buffer);
3025+
3026+ usb_free_urb(edge_serial->read_urb);
3027+ kfree(edge_serial->bulk_in_buffer);
3028+
3029+ kfree(edge_serial);
3030+
3031+ return response;
30263032 }
30273033
30283034
drivers/usb/serial/xr_serial.c+0−25
@@ -545,37 +545,13 @@ static void xr_close(struct usb_serial_port *port) · 544 unmodified lines
545545
546546 static int xr_probe(struct usb_serial *serial, const struct usb_device_id *id)
547547 {
548− struct usb_driver *driver = serial->type->usb_driver;
549− struct usb_interface *control_interface;
550− int ret;
551−
552548 /* Don't bind to control interface */
553549 if (serial->interface->cur_altsetting->desc.bInterfaceNumber == 0)
554550 return -ENODEV;
555551
556− /* But claim the control interface during data interface probe */
557− control_interface = usb_ifnum_to_if(serial->dev, 0);
558− if (!control_interface)
559− return -ENODEV;
560−
561− ret = usb_driver_claim_interface(driver, control_interface, NULL);
562− if (ret) {
563− dev_err(&serial->interface->dev, "Failed to claim control interface\n");
564− return ret;
565− }
566−
567552 return 0;
568553 }
569554
570−static void xr_disconnect(struct usb_serial *serial)
571−{
572− struct usb_driver *driver = serial->type->usb_driver;
573− struct usb_interface *control_interface;
574−
575− control_interface = usb_ifnum_to_if(serial->dev, 0);
576− usb_driver_release_interface(driver, control_interface);
577−}
578−
579555 static const struct usb_device_id id_table[] = {
580556 { USB_DEVICE(0x04e2, 0x1410) }, /* XR21V141X */
581557 { }
@@ -590,7 +566,6 @@ static struct usb_serial_driver xr_device = { · 8 unmodified lines
590566 .id_table = id_table,
591567 .num_ports = 1,
592568 .probe = xr_probe,
593− .disconnect = xr_disconnect,
594569 .open = xr_open,
595570 .close = xr_close,
596571 .break_ctl = xr_break_ctl,
drivers/usb/storage/transport.c+7−0
@@ -656,6 +656,13 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us) · 655 unmodified lines
656656 need_auto_sense = 1;
657657 }
658658
659+ /* Some devices (Kindle) require another command after SYNC CACHE */
660+ if ((us->fflags & US_FL_SENSE_AFTER_SYNC) &&
661+ srb->cmnd[0] == SYNCHRONIZE_CACHE) {
662+ usb_stor_dbg(us, "-- sense after SYNC CACHE\n");
663+ need_auto_sense = 1;
664+ }
665+
659666 /*
660667 * If we have a failure, we're going to do a REQUEST_SENSE
661668 * automatically. Note that we differentiate between a command
drivers/usb/storage/unusual_devs.h+12−0
@@ -2211,6 +2211,18 @@ UNUSUAL_DEV( 0x1908, 0x3335, 0x0200, 0x0200, · 2210 unmodified lines
22112211 USB_SC_DEVICE, USB_PR_DEVICE, NULL,
22122212 US_FL_NO_READ_DISC_INFO ),
22132213
2214+/*
2215+ * Reported by Matthias Schwarzott <zzam@gentoo.org>
2216+ * The Amazon Kindle treats SYNCHRONIZE CACHE as an indication that
2217+ * the host may be finished with it, and automatically ejects its
2218+ * emulated media unless it receives another command within one second.
2219+ */
2220+UNUSUAL_DEV( 0x1949, 0x0004, 0x0000, 0x9999,
2221+ "Amazon",
2222+ "Kindle",
2223+ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
2224+ US_FL_SENSE_AFTER_SYNC ),
2225+
22142226 /*
22152227 * Reported by Oliver Neukum <oneukum@suse.com>
22162228 * This device morphes spontaneously into another device if the access
drivers/usb/typec/tcpm/tcpm.c+9−2
@@ -942,6 +942,7 @@ static int tcpm_set_current_limit(struct tcpm_port *port, u32 max_ma, u32 mv) · 941 unmodified lines
942942
943943 port->supply_voltage = mv;
944944 port->current_limit = max_ma;
945+ power_supply_changed(port->psy);
945946
946947 if (port->tcpc->set_current_limit)
947948 ret = port->tcpc->set_current_limit(port->tcpc, max_ma, mv);
@@ -2928,6 +2929,7 @@ static int tcpm_pd_select_pdo(struct tcpm_port *port, int *sink_pdo, · 1980 unmodified lines
29282929
29292930 port->pps_data.supported = false;
29302931 port->usb_type = POWER_SUPPLY_USB_TYPE_PD;
2932+ power_supply_changed(port->psy);
29312933
29322934 /*
29332935 * Select the source PDO providing the most power which has a
@@ -2952,6 +2954,7 @@ static int tcpm_pd_select_pdo(struct tcpm_port *port, int *sink_pdo, · 18 unmodified lines
29522954 port->pps_data.supported = true;
29532955 port->usb_type =
29542956 POWER_SUPPLY_USB_TYPE_PD_PPS;
2957+ power_supply_changed(port->psy);
29552958 }
29562959 continue;
29572960 default:
@@ -3109,6 +3112,7 @@ static unsigned int tcpm_pd_select_pps_apdo(struct tcpm_port *port) · 151 unmodified lines
31093112 port->pps_data.out_volt));
31103113 port->pps_data.op_curr = min(port->pps_data.max_curr,
31113114 port->pps_data.op_curr);
3115+ power_supply_changed(port->psy);
31123116 }
31133117
31143118 return src_pdo;
@@ -3344,6 +3348,7 @@ static int tcpm_set_charge(struct tcpm_port *port, bool charge) · 229 unmodified lines
33443348 return ret;
33453349 }
33463350 port->vbus_charge = charge;
3351+ power_supply_changed(port->psy);
33473352 return 0;
33483353 }
33493354
@@ -3523,6 +3528,7 @@ static void tcpm_reset_port(struct tcpm_port *port) · 173 unmodified lines
35233528 port->try_src_count = 0;
35243529 port->try_snk_count = 0;
35253530 port->usb_type = POWER_SUPPLY_USB_TYPE_C;
3531+ power_supply_changed(port->psy);
35263532 port->nr_sink_caps = 0;
35273533 port->sink_cap_done = false;
35283534 if (port->tcpc->enable_frs)
@@ -5167,7 +5173,7 @@ static void tcpm_enable_frs_work(struct kthread_work *work) · 1638 unmodified lines
51675173 goto unlock;
51685174
51695175 /* Send when the state machine is idle */
5170− if (port->state != SNK_READY || port->vdm_state != VDM_STATE_DONE || port->send_discover)
5176+ if (port->state != SNK_READY || port->vdm_sm_running || port->send_discover)
51715177 goto resched;
51725178
51735179 port->upcoming_state = GET_SINK_CAP;
@@ -5905,7 +5911,7 @@ static int tcpm_psy_set_prop(struct power_supply *psy, · 731 unmodified lines
59055911 ret = -EINVAL;
59065912 break;
59075913 }
5908−
5914+ power_supply_changed(port->psy);
59095915 return ret;
59105916 }
59115917
@@ -6058,6 +6064,7 @@ struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc) · 146 unmodified lines
60586064 err = devm_tcpm_psy_register(port);
60596065 if (err)
60606066 goto out_role_sw_put;
6067+ power_supply_changed(port->psy);
60616068
60626069 port->typec_port = typec_register_port(port->dev, &port->typec_caps);
60636070 if (IS_ERR(port->typec_port)) {
drivers/usb/typec/tps6598x.c+0−1
@@ -64,7 +64,6 @@ enum { · 63 unmodified lines
6464 struct tps6598x_rx_identity_reg {
6565 u8 status;
6666 struct usb_pd_identity identity;
67− u32 vdo[3];
6867 } __packed;
6968
7069 /* Standard Task return codes */
drivers/usb/usbip/stub_dev.c+35−7
@@ -46,6 +46,8 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a · 45 unmodified lines
4646 int sockfd = 0;
4747 struct socket *socket;
4848 int rv;
49+ struct task_struct *tcp_rx = NULL;
50+ struct task_struct *tcp_tx = NULL;
4951
5052 if (!sdev) {
5153 dev_err(dev, "sdev is null\n");
@@ -69,23 +71,47 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a · 17 unmodified lines
6971 }
7072
7173 socket = sockfd_lookup(sockfd, &err);
72− if (!socket)
74+ if (!socket) {
75+ dev_err(dev, "failed to lookup sock");
7376 goto err;
77+ }
7478
75− sdev->ud.tcp_socket = socket;
76− sdev->ud.sockfd = sockfd;
79+ if (socket->type != SOCK_STREAM) {
80+ dev_err(dev, "Expecting SOCK_STREAM - found %d",
81+ socket->type);
82+ goto sock_err;
83+ }
7784
85+ /* unlock and create threads and get tasks */
7886 spin_unlock_irq(&sdev->ud.lock);
87+ tcp_rx = kthread_create(stub_rx_loop, &sdev->ud, "stub_rx");
88+ if (IS_ERR(tcp_rx)) {
89+ sockfd_put(socket);
90+ return -EINVAL;
91+ }
92+ tcp_tx = kthread_create(stub_tx_loop, &sdev->ud, "stub_tx");
93+ if (IS_ERR(tcp_tx)) {
94+ kthread_stop(tcp_rx);
95+ sockfd_put(socket);
96+ return -EINVAL;
97+ }
7998
80− sdev->ud.tcp_rx = kthread_get_run(stub_rx_loop, &sdev->ud,
81− "stub_rx");
82− sdev->ud.tcp_tx = kthread_get_run(stub_tx_loop, &sdev->ud,
83− "stub_tx");
99+ /* get task structs now */
100+ get_task_struct(tcp_rx);
101+ get_task_struct(tcp_tx);
84102
103+ /* lock and update sdev->ud state */
85104 spin_lock_irq(&sdev->ud.lock);
105+ sdev->ud.tcp_socket = socket;
106+ sdev->ud.sockfd = sockfd;
107+ sdev->ud.tcp_rx = tcp_rx;
108+ sdev->ud.tcp_tx = tcp_tx;
86109 sdev->ud.status = SDEV_ST_USED;
87110 spin_unlock_irq(&sdev->ud.lock);
88111
112+ wake_up_process(sdev->ud.tcp_rx);
113+ wake_up_process(sdev->ud.tcp_tx);
114+
89115 } else {
90116 dev_info(dev, "stub down\n");
91117
@@ -100,6 +126,8 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a · 8 unmodified lines
100126
101127 return count;
102128
129+sock_err:
130+ sockfd_put(socket);
103131 err:
104132 spin_unlock_irq(&sdev->ud.lock);
105133 return -EINVAL;
drivers/usb/usbip/vhci_sysfs.c+34−5
@@ -312,6 +312,8 @@ static ssize_t attach_store(struct device *dev, struct device_attribute *attr, · 311 unmodified lines
312312 struct vhci *vhci;
313313 int err;
314314 unsigned long flags;
315+ struct task_struct *tcp_rx = NULL;
316+ struct task_struct *tcp_tx = NULL;
315317
316318 /*
317319 * @rhport: port number of vhci_hcd
@@ -349,12 +351,35 @@ static ssize_t attach_store(struct device *dev, struct device_attribute *attr, · 31 unmodified lines
349351
350352 /* Extract socket from fd. */
351353 socket = sockfd_lookup(sockfd, &err);
352− if (!socket)
354+ if (!socket) {
355+ dev_err(dev, "failed to lookup sock");
353356 return -EINVAL;
357+ }
358+ if (socket->type != SOCK_STREAM) {
359+ dev_err(dev, "Expecting SOCK_STREAM - found %d",
360+ socket->type);
361+ sockfd_put(socket);
362+ return -EINVAL;
363+ }
364+
365+ /* create threads before locking */
366+ tcp_rx = kthread_create(vhci_rx_loop, &vdev->ud, "vhci_rx");
367+ if (IS_ERR(tcp_rx)) {
368+ sockfd_put(socket);
369+ return -EINVAL;
370+ }
371+ tcp_tx = kthread_create(vhci_tx_loop, &vdev->ud, "vhci_tx");
372+ if (IS_ERR(tcp_tx)) {
373+ kthread_stop(tcp_rx);
374+ sockfd_put(socket);
375+ return -EINVAL;
376+ }
354377
355− /* now need lock until setting vdev status as used */
378+ /* get task structs now */
379+ get_task_struct(tcp_rx);
380+ get_task_struct(tcp_tx);
356381
357− /* begin a lock */
382+ /* now begin lock until setting vdev status set */
358383 spin_lock_irqsave(&vhci->lock, flags);
359384 spin_lock(&vdev->ud.lock);
360385
@@ -364,6 +389,8 @@ static ssize_t attach_store(struct device *dev, struct device_attribute *attr, · 3 unmodified lines
364389 spin_unlock_irqrestore(&vhci->lock, flags);
365390
366391 sockfd_put(socket);
392+ kthread_stop_put(tcp_rx);
393+ kthread_stop_put(tcp_tx);
367394
368395 dev_err(dev, "port %d already used\n", rhport);
369396 /*
@@ -382,6 +409,8 @@ static ssize_t attach_store(struct device *dev, struct device_attribute *attr, · 12 unmodified lines
382409 vdev->speed = speed;
383410 vdev->ud.sockfd = sockfd;
384411 vdev->ud.tcp_socket = socket;
412+ vdev->ud.tcp_rx = tcp_rx;
413+ vdev->ud.tcp_tx = tcp_tx;
385414 vdev->ud.status = VDEV_ST_NOTASSIGNED;
386415 usbip_kcov_handle_init(&vdev->ud);
387416
@@ -389,8 +418,8 @@ static ssize_t attach_store(struct device *dev, struct device_attribute *attr, · 1 unmodified line
389418 spin_unlock_irqrestore(&vhci->lock, flags);
390419 /* end the lock */
391420
392− vdev->ud.tcp_rx = kthread_get_run(vhci_rx_loop, &vdev->ud, "vhci_rx");
393− vdev->ud.tcp_tx = kthread_get_run(vhci_tx_loop, &vdev->ud, "vhci_tx");
421+ wake_up_process(vdev->ud.tcp_rx);
422+ wake_up_process(vdev->ud.tcp_tx);
394423
395424 rh_port_connect(vdev, speed);
396425
drivers/usb/usbip/vudc_sysfs.c+42−7
@@ -90,8 +90,9 @@ unlock: · 89 unmodified lines
9090 }
9191 static BIN_ATTR_RO(dev_desc, sizeof(struct usb_device_descriptor));
9292
93−static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *attr,
94− const char *in, size_t count)
93+static ssize_t usbip_sockfd_store(struct device *dev,
94+ struct device_attribute *attr,
95+ const char *in, size_t count)
9596 {
9697 struct vudc *udc = (struct vudc *) dev_get_drvdata(dev);
9798 int rv;
@@ -100,6 +101,8 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a · 2 unmodified lines
100101 struct socket *socket;
101102 unsigned long flags;
102103 int ret;
104+ struct task_struct *tcp_rx = NULL;
105+ struct task_struct *tcp_tx = NULL;
103106
104107 rv = kstrtoint(in, 0, &sockfd);
105108 if (rv != 0)
@@ -138,24 +141,54 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a · 32 unmodified lines
138141 goto unlock_ud;
139142 }
140143
141− udc->ud.tcp_socket = socket;
144+ if (socket->type != SOCK_STREAM) {
145+ dev_err(dev, "Expecting SOCK_STREAM - found %d",
146+ socket->type);
147+ ret = -EINVAL;
148+ goto sock_err;
149+ }
142150
151+ /* unlock and create threads and get tasks */
143152 spin_unlock_irq(&udc->ud.lock);
144153 spin_unlock_irqrestore(&udc->lock, flags);
145154
146− udc->ud.tcp_rx = kthread_get_run(&v_rx_loop,
147− &udc->ud, "vudc_rx");
148− udc->ud.tcp_tx = kthread_get_run(&v_tx_loop,
149− &udc->ud, "vudc_tx");
155+ tcp_rx = kthread_create(&v_rx_loop, &udc->ud, "vudc_rx");
156+ if (IS_ERR(tcp_rx)) {
157+ sockfd_put(socket);
158+ return -EINVAL;
159+ }
160+ tcp_tx = kthread_create(&v_tx_loop, &udc->ud, "vudc_tx");
161+ if (IS_ERR(tcp_tx)) {
162+ kthread_stop(tcp_rx);
163+ sockfd_put(socket);
164+ return -EINVAL;
165+ }
166+
167+ /* get task structs now */
168+ get_task_struct(tcp_rx);
169+ get_task_struct(tcp_tx);
150170
171+ /* lock and update udc->ud state */
151172 spin_lock_irqsave(&udc->lock, flags);
152173 spin_lock_irq(&udc->ud.lock);
174+
175+ udc->ud.tcp_socket = socket;
176+ udc->ud.tcp_rx = tcp_rx;
177+ udc->ud.tcp_tx = tcp_tx;
153178 udc->ud.status = SDEV_ST_USED;
179+
154180 spin_unlock_irq(&udc->ud.lock);
155181
156182 ktime_get_ts64(&udc->start_time);
157183 v_start_timer(udc);
158184 udc->connected = 1;
185+
186+ spin_unlock_irqrestore(&udc->lock, flags);
187+
188+ wake_up_process(udc->ud.tcp_rx);
189+ wake_up_process(udc->ud.tcp_tx);
190+ return count;
191+
159192 } else {
160193 if (!udc->connected) {
161194 dev_err(dev, "Device not connected");
@@ -177,6 +210,8 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a · 15 unmodified lines
177210
178211 return count;
179212
213+sock_err:
214+ sockfd_put(socket);
180215 unlock_ud:
181216 spin_unlock_irq(&udc->ud.lock);
182217 unlock:
drivers/vdpa/ifcvf/ifcvf_main.c+2−3
@@ -431,8 +431,7 @@ static int ifcvf_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 430 unmodified lines
431431 }
432432
433433 adapter = vdpa_alloc_device(struct ifcvf_adapter, vdpa,
434− dev, &ifc_vdpa_ops,
435− IFCVF_MAX_QUEUE_PAIRS * 2, NULL);
434+ dev, &ifc_vdpa_ops, NULL);
436435 if (adapter == NULL) {
437436 IFCVF_ERR(pdev, "Failed to allocate vDPA structure");
438437 return -ENOMEM;
@@ -456,7 +455,7 @@ static int ifcvf_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 17 unmodified lines
456455 for (i = 0; i < IFCVF_MAX_QUEUE_PAIRS * 2; i++)
457456 vf->vring[i].irq = -EINVAL;
458457
459− ret = vdpa_register_device(&adapter->vdpa);
458+ ret = vdpa_register_device(&adapter->vdpa, IFCVF_MAX_QUEUE_PAIRS * 2);
460459 if (ret) {
461460 IFCVF_ERR(pdev, "Failed to register ifcvf to vdpa bus");
462461 goto err;
drivers/vdpa/mlx5/net/mlx5_vnet.c+2−2
@@ -1982,7 +1982,7 @@ static int mlx5v_probe(struct auxiliary_device *adev, · 1981 unmodified lines
19821982 max_vqs = min_t(u32, max_vqs, MLX5_MAX_SUPPORTED_VQS);
19831983
19841984 ndev = vdpa_alloc_device(struct mlx5_vdpa_net, mvdev.vdev, mdev->device, &mlx5_vdpa_ops,
1985− 2 * mlx5_vdpa_max_qps(max_vqs), NULL);
1985+ NULL);
19861986 if (IS_ERR(ndev))
19871987 return PTR_ERR(ndev);
19881988
@@ -2009,7 +2009,7 @@ static int mlx5v_probe(struct auxiliary_device *adev, · 20 unmodified lines
20092009 if (err)
20102010 goto err_res;
20112011
2012− err = vdpa_register_device(&mvdev->vdev);
2012+ err = vdpa_register_device(&mvdev->vdev, 2 * mlx5_vdpa_max_qps(max_vqs));
20132013 if (err)
20142014 goto err_reg;
20152015
drivers/vdpa/vdpa.c+10−8
@@ -69,7 +69,6 @@ static void vdpa_release_dev(struct device *d) · 68 unmodified lines
6969 * initialized but before registered.
7070 * @parent: the parent device
7171 * @config: the bus operations that is supported by this device
72− * @nvqs: number of virtqueues supported by this device
7372 * @size: size of the parent structure that contains private data
7473 * @name: name of the vdpa device; optional.
7574 *
@@ -81,7 +80,7 @@ static void vdpa_release_dev(struct device *d) · 5 unmodified lines
8180 */
8281 struct vdpa_device *__vdpa_alloc_device(struct device *parent,
8382 const struct vdpa_config_ops *config,
84− int nvqs, size_t size, const char *name)
83+ size_t size, const char *name)
8584 {
8685 struct vdpa_device *vdev;
8786 int err = -EINVAL;
@@ -107,7 +106,6 @@ struct vdpa_device *__vdpa_alloc_device(struct device *parent, · 19 unmodified lines
107106 vdev->index = err;
108107 vdev->config = config;
109108 vdev->features_valid = false;
110− vdev->nvqs = nvqs;
111109
112110 if (name)
113111 err = dev_set_name(&vdev->dev, "%s", name);
@@ -136,10 +134,12 @@ static int vdpa_name_match(struct device *dev, const void *data) · 22 unmodified lines
136134 return (strcmp(dev_name(&vdev->dev), data) == 0);
137135 }
138136
139−static int __vdpa_register_device(struct vdpa_device *vdev)
137+static int __vdpa_register_device(struct vdpa_device *vdev, int nvqs)
140138 {
141139 struct device *dev;
142140
141+ vdev->nvqs = nvqs;
142+
143143 lockdep_assert_held(&vdpa_dev_mutex);
144144 dev = bus_find_device(&vdpa_bus, NULL, dev_name(&vdev->dev), vdpa_name_match);
145145 if (dev) {
@@ -155,15 +155,16 @@ static int __vdpa_register_device(struct vdpa_device *vdev) · 9 unmodified lines
155155 * Caller must invoke this routine in the management device dev_add()
156156 * callback after setting up valid mgmtdev for this vdpa device.
157157 * @vdev: the vdpa device to be registered to vDPA bus
158+ * @nvqs: number of virtqueues supported by this device
158159 *
159160 * Returns an error when fail to add device to vDPA bus
160161 */
161−int _vdpa_register_device(struct vdpa_device *vdev)
162+int _vdpa_register_device(struct vdpa_device *vdev, int nvqs)
162163 {
163164 if (!vdev->mdev)
164165 return -EINVAL;
165166
166− return __vdpa_register_device(vdev);
167+ return __vdpa_register_device(vdev, nvqs);
167168 }
168169 EXPORT_SYMBOL_GPL(_vdpa_register_device);
169170
@@ -171,15 +172,16 @@ EXPORT_SYMBOL_GPL(_vdpa_register_device); · 1 unmodified line
171172 * vdpa_register_device - register a vDPA device
172173 * Callers must have a succeed call of vdpa_alloc_device() before.
173174 * @vdev: the vdpa device to be registered to vDPA bus
175+ * @nvqs: number of virtqueues supported by this device
174176 *
175177 * Returns an error when fail to add to vDPA bus
176178 */
177−int vdpa_register_device(struct vdpa_device *vdev)
179+int vdpa_register_device(struct vdpa_device *vdev, int nvqs)
178180 {
179181 int err;
180182
181183 mutex_lock(&vdpa_dev_mutex);
182− err = __vdpa_register_device(vdev);
184+ err = __vdpa_register_device(vdev, nvqs);
183185 mutex_unlock(&vdpa_dev_mutex);
184186 return err;
185187 }
drivers/vdpa/vdpa_sim/vdpa_sim.c+1−1
@@ -235,7 +235,7 @@ struct vdpasim *vdpasim_create(struct vdpasim_dev_attr *dev_attr) · 234 unmodified lines
235235 ops = &vdpasim_config_ops;
236236
237237 vdpasim = vdpa_alloc_device(struct vdpasim, vdpa, NULL, ops,
238− dev_attr->nvqs, dev_attr->name);
238+ dev_attr->name);
239239 if (!vdpasim)
240240 goto err_alloc;
241241
drivers/vdpa/vdpa_sim/vdpa_sim_net.c+2−3
@@ -110,8 +110,7 @@ out: · 109 unmodified lines
110110
111111 static void vdpasim_net_get_config(struct vdpasim *vdpasim, void *config)
112112 {
113− struct virtio_net_config *net_config =
114− (struct virtio_net_config *)config;
113+ struct virtio_net_config *net_config = config;
115114
116115 net_config->mtu = cpu_to_vdpasim16(vdpasim, 1500);
117116 net_config->status = cpu_to_vdpasim16(vdpasim, VIRTIO_NET_S_LINK_UP);
@@ -147,7 +146,7 @@ static int vdpasim_net_dev_add(struct vdpa_mgmt_dev *mdev, const char *name) · 29 unmodified lines
147146 if (IS_ERR(simdev))
148147 return PTR_ERR(simdev);
149148
150− ret = _vdpa_register_device(&simdev->vdpa);
149+ ret = _vdpa_register_device(&simdev->vdpa, VDPASIM_NET_VQ_NUM);
151150 if (ret)
152151 goto reg_err;
153152
drivers/vfio/Kconfig+2−2
@@ -21,8 +21,8 @@ config VFIO_VIRQFD · 20 unmodified lines
2121
2222 menuconfig VFIO
2323 tristate "VFIO Non-Privileged userspace driver framework"
24− depends on IOMMU_API
25− select VFIO_IOMMU_TYPE1 if (X86 || S390 || ARM || ARM64)
24+ select IOMMU_API
25+ select VFIO_IOMMU_TYPE1 if MMU && (X86 || S390 || ARM || ARM64)
2626 help
2727 VFIO provides a framework for secure userspace device drivers.
2828 See Documentation/driver-api/vfio.rst for more details.
drivers/vfio/platform/Kconfig+2−2
@@ -1,7 +1,7 @@
11 # SPDX-License-Identifier: GPL-2.0-only
22 config VFIO_PLATFORM
33 tristate "VFIO support for platform devices"
4− depends on VFIO && EVENTFD && (ARM || ARM64)
4+ depends on VFIO && EVENTFD && (ARM || ARM64 || COMPILE_TEST)
55 select VFIO_VIRQFD
66 help
77 Support for platform devices with VFIO. This is required to make
@@ -12,7 +12,7 @@ config VFIO_PLATFORM · 4 unmodified lines
1212
1313 config VFIO_AMBA
1414 tristate "VFIO support for AMBA devices"
15− depends on VFIO_PLATFORM && ARM_AMBA
15+ depends on VFIO_PLATFORM && (ARM_AMBA || COMPILE_TEST)
1616 help
1717 Support for ARM AMBA devices with VFIO. This is required to make
1818 use of ARM AMBA devices present on the system using the VFIO
drivers/vfio/vfio_iommu_type1.c+12−8
@@ -189,7 +189,7 @@ static struct vfio_dma *vfio_find_dma(struct vfio_iommu *iommu, · 188 unmodified lines
189189 }
190190
191191 static struct rb_node *vfio_find_dma_first_node(struct vfio_iommu *iommu,
192− dma_addr_t start, size_t size)
192+ dma_addr_t start, u64 size)
193193 {
194194 struct rb_node *res = NULL;
195195 struct rb_node *node = iommu->dma_list.rb_node;
@@ -785,7 +785,12 @@ static int vfio_pin_page_external(struct vfio_dma *dma, unsigned long vaddr, · 589 unmodified lines
785785 return -ENODEV;
786786
787787 ret = vaddr_get_pfns(mm, vaddr, 1, dma->prot, pfn_base, pages);
788− if (ret == 1 && do_accounting && !is_invalid_reserved_pfn(*pfn_base)) {
788+ if (ret != 1)
789+ goto out;
790+
791+ ret = 0;
792+
793+ if (do_accounting && !is_invalid_reserved_pfn(*pfn_base)) {
789794 ret = vfio_lock_acct(dma, 1, true);
790795 if (ret) {
791796 put_pfn(*pfn_base, dma->prot);
@@ -797,6 +802,7 @@ static int vfio_pin_page_external(struct vfio_dma *dma, unsigned long vaddr, · 5 unmodified lines
797802 }
798803 }
799804
805+out:
800806 mmput(mm);
801807 return ret;
802808 }
@@ -1288,7 +1294,7 @@ static int vfio_dma_do_unmap(struct vfio_iommu *iommu, · 485 unmodified lines
12881294 int ret = -EINVAL, retries = 0;
12891295 unsigned long pgshift;
12901296 dma_addr_t iova = unmap->iova;
1291− unsigned long size = unmap->size;
1297+ u64 size = unmap->size;
12921298 bool unmap_all = unmap->flags & VFIO_DMA_UNMAP_FLAG_ALL;
12931299 bool invalidate_vaddr = unmap->flags & VFIO_DMA_UNMAP_FLAG_VADDR;
12941300 struct rb_node *n, *first_n;
@@ -1304,14 +1310,12 @@ static int vfio_dma_do_unmap(struct vfio_iommu *iommu, · 9 unmodified lines
13041310 if (unmap_all) {
13051311 if (iova || size)
13061312 goto unlock;
1307− size = SIZE_MAX;
1308− } else if (!size || size & (pgsize - 1)) {
1313+ size = U64_MAX;
1314+ } else if (!size || size & (pgsize - 1) ||
1315+ iova + size - 1 < iova || size > SIZE_MAX) {
13091316 goto unlock;
13101317 }
13111318
1312− if (iova + size - 1 < iova || size > SIZE_MAX)
1313− goto unlock;
1314−
13151319 /* When dirty tracking is enabled, allow only min supported pgsize */
13161320 if ((unmap->flags & VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP) &&
13171321 (!iommu->dirty_page_tracking || (bitmap->pgsize != pgsize))) {
drivers/vhost/vdpa.c+11−9
@@ -308,8 +308,10 @@ static long vhost_vdpa_get_vring_num(struct vhost_vdpa *v, u16 __user *argp) · 307 unmodified lines
308308
309309 static void vhost_vdpa_config_put(struct vhost_vdpa *v)
310310 {
311− if (v->config_ctx)
311+ if (v->config_ctx) {
312312 eventfd_ctx_put(v->config_ctx);
313+ v->config_ctx = NULL;
314+ }
313315 }
314316
315317 static long vhost_vdpa_set_config_call(struct vhost_vdpa *v, u32 __user *argp)
@@ -329,8 +331,12 @@ static long vhost_vdpa_set_config_call(struct vhost_vdpa *v, u32 __user *argp) · 13 unmodified lines
329331 if (!IS_ERR_OR_NULL(ctx))
330332 eventfd_ctx_put(ctx);
331333
332− if (IS_ERR(v->config_ctx))
333− return PTR_ERR(v->config_ctx);
334+ if (IS_ERR(v->config_ctx)) {
335+ long ret = PTR_ERR(v->config_ctx);
336+
337+ v->config_ctx = NULL;
338+ return ret;
339+ }
334340
335341 v->vdpa->config->set_config_cb(v->vdpa, &cb);
336342
@@ -900,14 +906,10 @@ err: · 563 unmodified lines
900906
901907 static void vhost_vdpa_clean_irq(struct vhost_vdpa *v)
902908 {
903− struct vhost_virtqueue *vq;
904909 int i;
905910
906− for (i = 0; i < v->nvqs; i++) {
907− vq = &v->vqs[i];
908− if (vq->call_ctx.producer.irq)
909− irq_bypass_unregister_producer(&vq->call_ctx.producer);
910− }
911+ for (i = 0; i < v->nvqs; i++)
912+ vhost_vdpa_unsetup_vq_irq(v, i);
911913 }
912914
913915 static int vhost_vdpa_release(struct inode *inode, struct file *filep)
drivers/vhost/vhost.c+1−1
@@ -332,8 +332,8 @@ static void vhost_vq_reset(struct vhost_dev *dev, · 331 unmodified lines
332332 vq->error_ctx = NULL;
333333 vq->kick = NULL;
334334 vq->log_ctx = NULL;
335− vhost_reset_is_le(vq);
336335 vhost_disable_cross_endian(vq);
336+ vhost_reset_is_le(vq);
337337 vq->busyloop_timeout = 0;
338338 vq->umem = NULL;
339339 vq->iotlb = NULL;
drivers/video/fbdev/aty/atyfb.h+0−3
@@ -287,11 +287,8 @@ static inline void aty_st_8(int regindex, u8 val, const struct atyfb_par *par) · 286 unmodified lines
287287 #endif
288288 }
289289
290−#if defined(CONFIG_PMAC_BACKLIGHT) || defined (CONFIG_FB_ATY_GENERIC_LCD) || \
291−defined (CONFIG_FB_ATY_BACKLIGHT)
292290 extern void aty_st_lcd(int index, u32 val, const struct atyfb_par *par);
293291 extern u32 aty_ld_lcd(int index, const struct atyfb_par *par);
294−#endif
295292
296293 /*
297294 * DAC operations
drivers/video/fbdev/aty/atyfb_base.c+5−4
@@ -133,7 +133,7 @@ · 132 unmodified lines
133133 #define PRINTKE(fmt, args...) printk(KERN_ERR "atyfb: " fmt, ## args)
134134
135135 #if defined(CONFIG_PMAC_BACKLIGHT) || defined(CONFIG_FB_ATY_GENERIC_LCD) || \
136−defined(CONFIG_FB_ATY_BACKLIGHT)
136+defined(CONFIG_FB_ATY_BACKLIGHT) || defined (CONFIG_PPC_PMAC)
137137 static const u32 lt_lcd_regs[] = {
138138 CNFG_PANEL_LG,
139139 LCD_GEN_CNTL_LG,
@@ -175,8 +175,8 @@ u32 aty_ld_lcd(int index, const struct atyfb_par *par) · 35 unmodified lines
175175 return aty_ld_le32(LCD_DATA, par);
176176 }
177177 }
178−#else /* defined(CONFIG_PMAC_BACKLIGHT) || defined(CONFIG_FB_ATY_BACKLIGHT) \
179− defined(CONFIG_FB_ATY_GENERIC_LCD) */
178+#else /* defined(CONFIG_PMAC_BACKLIGHT) || defined(CONFIG_FB_ATY_BACKLIGHT) ||
179+ defined(CONFIG_FB_ATY_GENERIC_LCD) || defined(CONFIG_PPC_PMAC) */
180180 void aty_st_lcd(int index, u32 val, const struct atyfb_par *par)
181181 { }
182182
@@ -184,7 +184,8 @@ u32 aty_ld_lcd(int index, const struct atyfb_par *par) · 1 unmodified line
184184 {
185185 return 0;
186186 }
187−#endif /* defined(CONFIG_PMAC_BACKLIGHT) || defined (CONFIG_FB_ATY_GENERIC_LCD) */
187+#endif /* defined(CONFIG_PMAC_BACKLIGHT) || defined(CONFIG_FB_ATY_BACKLIGHT) ||
188+ defined (CONFIG_FB_ATY_GENERIC_LCD) || defined(CONFIG_PPC_PMAC) */
188189
189190 #ifdef CONFIG_FB_ATY_GENERIC_LCD
190191 /*
drivers/virt/acrn/hsm.c+10−1
@@ -333,7 +333,7 @@ static long acrn_dev_ioctl(struct file *filp, unsigned int cmd, · 332 unmodified lines
333333 acrn_ioreq_request_clear(vm);
334334 break;
335335 case ACRN_IOCTL_PM_GET_CPU_STATE:
336− if (copy_from_user(&cstate_cmd, (void *)ioctl_param,
336+ if (copy_from_user(&cstate_cmd, (void __user *)ioctl_param,
337337 sizeof(cstate_cmd)))
338338 return -EFAULT;
339339
@@ -404,6 +404,14 @@ fail_remove: · 64 unmodified lines
404404 }
405405 static DEVICE_ATTR_WO(remove_cpu);
406406
407+static umode_t acrn_attr_visible(struct kobject *kobj, struct attribute *a, int n)
408+{
409+ if (a == &dev_attr_remove_cpu.attr)
410+ return IS_ENABLED(CONFIG_HOTPLUG_CPU) ? a->mode : 0;
411+
412+ return a->mode;
413+}
414+
407415 static struct attribute *acrn_attrs[] = {
408416 &dev_attr_remove_cpu.attr,
409417 NULL
@@ -411,6 +419,7 @@ static struct attribute *acrn_attrs[] = { · 1 unmodified line
411419
412420 static struct attribute_group acrn_attr_group = {
413421 .attrs = acrn_attrs,
422+ .is_visible = acrn_attr_visible,
414423 };
415424
416425 static const struct attribute_group *acrn_attr_groups[] = {
drivers/virt/acrn/irqfd.c+3−3
@@ -112,7 +112,7 @@ static int acrn_irqfd_assign(struct acrn_vm *vm, struct acrn_irqfd *args) · 111 unmodified lines
112112 {
113113 struct eventfd_ctx *eventfd = NULL;
114114 struct hsm_irqfd *irqfd, *tmp;
115− unsigned int events;
115+ __poll_t events;
116116 struct fd f;
117117 int ret = 0;
118118
@@ -158,9 +158,9 @@ static int acrn_irqfd_assign(struct acrn_vm *vm, struct acrn_irqfd *args) · 39 unmodified lines
158158 mutex_unlock(&vm->irqfds_lock);
159159
160160 /* Check the pending event in this stage */
161− events = f.file->f_op->poll(f.file, &irqfd->pt);
161+ events = vfs_poll(f.file, &irqfd->pt);
162162
163− if (events & POLLIN)
163+ if (events & EPOLLIN)
164164 acrn_irqfd_inject(irqfd);
165165
166166 fdput(f);
drivers/virtio/virtio.c+2−4
@@ -141,15 +141,14 @@ void virtio_config_changed(struct virtio_device *dev) · 140 unmodified lines
141141 }
142142 EXPORT_SYMBOL_GPL(virtio_config_changed);
143143
144−void virtio_config_disable(struct virtio_device *dev)
144+static void virtio_config_disable(struct virtio_device *dev)
145145 {
146146 spin_lock_irq(&dev->config_lock);
147147 dev->config_enabled = false;
148148 spin_unlock_irq(&dev->config_lock);
149149 }
150−EXPORT_SYMBOL_GPL(virtio_config_disable);
151150
152−void virtio_config_enable(struct virtio_device *dev)
151+static void virtio_config_enable(struct virtio_device *dev)
153152 {
154153 spin_lock_irq(&dev->config_lock);
155154 dev->config_enabled = true;
@@ -158,7 +157,6 @@ void virtio_config_enable(struct virtio_device *dev) · 2 unmodified lines
158157 dev->config_change_pending = false;
159158 spin_unlock_irq(&dev->config_lock);
160159 }
161−EXPORT_SYMBOL_GPL(virtio_config_enable);
162160
163161 void virtio_add_status(struct virtio_device *dev, unsigned int status)
164162 {
drivers/virtio/virtio_mmio.c+1−2
@@ -548,8 +548,7 @@ static void virtio_mmio_release_dev(struct device *_d) · 547 unmodified lines
548548 {
549549 struct virtio_device *vdev =
550550 container_of(_d, struct virtio_device, dev);
551− struct virtio_mmio_device *vm_dev =
552− container_of(vdev, struct virtio_mmio_device, vdev);
551+ struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev);
553552 struct platform_device *pdev = vm_dev->pdev;
554553
555554 devm_kfree(&pdev->dev, vm_dev);
drivers/watchdog/cpu5wdt.c+0−1
@@ -273,7 +273,6 @@ module_exit(cpu5wdt_exit_module); · 272 unmodified lines
273273
274274 MODULE_AUTHOR("Heiko Ronsdorf <hero@ihg.uni-duisburg.de>");
275275 MODULE_DESCRIPTION("sma cpu5 watchdog driver");
276−MODULE_SUPPORTED_DEVICE("sma cpu5 watchdog");
277276 MODULE_LICENSE("GPL");
278277
279278 module_param_hw(port, int, ioport, 0);
drivers/watchdog/cpwd.c+0−1
@@ -172,7 +172,6 @@ MODULE_PARM_DESC(wd2_timeout, "Default watchdog2 timeout in 1/10secs"); · 171 unmodified lines
172172 MODULE_AUTHOR("Eric Brower <ebrower@usa.net>");
173173 MODULE_DESCRIPTION("Hardware watchdog driver for Sun Microsystems CP1400/1500");
174174 MODULE_LICENSE("GPL");
175−MODULE_SUPPORTED_DEVICE("watchdog");
176175
177176 static void cpwd_writew(u16 val, void __iomem *addr)
178177 {
drivers/watchdog/riowd.c+0−1
@@ -46,7 +46,6 @@ · 45 unmodified lines
4646
4747 MODULE_AUTHOR("David S. Miller <davem@davemloft.net>");
4848 MODULE_DESCRIPTION("Hardware watchdog driver for Sun RIO");
49−MODULE_SUPPORTED_DEVICE("watchdog");
5049 MODULE_LICENSE("GPL");
5150
5251 #define DRIVER_NAME "riowd"
drivers/xen/events/events_2l.c+15−7
@@ -47,6 +47,11 @@ static unsigned evtchn_2l_max_channels(void) · 46 unmodified lines
4747 return EVTCHN_2L_NR_CHANNELS;
4848 }
4949
50+static void evtchn_2l_remove(evtchn_port_t evtchn, unsigned int cpu)
51+{
52+ clear_bit(evtchn, BM(per_cpu(cpu_evtchn_mask, cpu)));
53+}
54+
5055 static void evtchn_2l_bind_to_cpu(evtchn_port_t evtchn, unsigned int cpu,
5156 unsigned int old_cpu)
5257 {
@@ -72,12 +77,6 @@ static bool evtchn_2l_is_pending(evtchn_port_t port) · 19 unmodified lines
7277 return sync_test_bit(port, BM(&s->evtchn_pending[0]));
7378 }
7479
75−static bool evtchn_2l_test_and_set_mask(evtchn_port_t port)
76−{
77− struct shared_info *s = HYPERVISOR_shared_info;
78− return sync_test_and_set_bit(port, BM(&s->evtchn_mask[0]));
79−}
80−
8180 static void evtchn_2l_mask(evtchn_port_t port)
8281 {
8382 struct shared_info *s = HYPERVISOR_shared_info;
@@ -355,18 +354,27 @@ static void evtchn_2l_resume(void) · 271 unmodified lines
355354 EVTCHN_2L_NR_CHANNELS/BITS_PER_EVTCHN_WORD);
356355 }
357356
357+static int evtchn_2l_percpu_deinit(unsigned int cpu)
358+{
359+ memset(per_cpu(cpu_evtchn_mask, cpu), 0, sizeof(xen_ulong_t) *
360+ EVTCHN_2L_NR_CHANNELS/BITS_PER_EVTCHN_WORD);
361+
362+ return 0;
363+}
364+
358365 static const struct evtchn_ops evtchn_ops_2l = {
359366 .max_channels = evtchn_2l_max_channels,
360367 .nr_channels = evtchn_2l_max_channels,
368+ .remove = evtchn_2l_remove,
361369 .bind_to_cpu = evtchn_2l_bind_to_cpu,
362370 .clear_pending = evtchn_2l_clear_pending,
363371 .set_pending = evtchn_2l_set_pending,
364372 .is_pending = evtchn_2l_is_pending,
365− .test_and_set_mask = evtchn_2l_test_and_set_mask,
366373 .mask = evtchn_2l_mask,
367374 .unmask = evtchn_2l_unmask,
368375 .handle_events = evtchn_2l_handle_events,
369376 .resume = evtchn_2l_resume,
377+ .percpu_deinit = evtchn_2l_percpu_deinit,
370378 };
371379
372380 void __init xen_evtchn_2l_init(void)
drivers/xen/events/events_base.c+100−30
@@ -98,13 +98,19 @@ struct irq_info { · 97 unmodified lines
9898 short refcnt;
9999 u8 spurious_cnt;
100100 u8 is_accounted;
101− enum xen_irq_type type; /* type */
101+ short type; /* type: IRQT_* */
102+ u8 mask_reason; /* Why is event channel masked */
103+#define EVT_MASK_REASON_EXPLICIT 0x01
104+#define EVT_MASK_REASON_TEMPORARY 0x02
105+#define EVT_MASK_REASON_EOI_PENDING 0x04
106+ u8 is_active; /* Is event just being handled? */
102107 unsigned irq;
103108 evtchn_port_t evtchn; /* event channel */
104109 unsigned short cpu; /* cpu bound */
105110 unsigned short eoi_cpu; /* EOI must happen on this cpu-1 */
106111 unsigned int irq_epoch; /* If eoi_cpu valid: irq_epoch of event */
107112 u64 eoi_time; /* Time in jiffies when to EOI. */
113+ spinlock_t lock;
108114
109115 union {
110116 unsigned short virq;
@@ -154,6 +160,7 @@ static DEFINE_RWLOCK(evtchn_rwlock); · 43 unmodified lines
154160 * evtchn_rwlock
155161 * IRQ-desc lock
156162 * percpu eoi_list_lock
163+ * irq_info->lock
157164 */
158165
159166 static LIST_HEAD(xen_irq_list_head);
@@ -304,6 +311,8 @@ static int xen_irq_info_common_setup(struct irq_info *info, · 144 unmodified lines
304311 info->irq = irq;
305312 info->evtchn = evtchn;
306313 info->cpu = cpu;
314+ info->mask_reason = EVT_MASK_REASON_EXPLICIT;
315+ spin_lock_init(&info->lock);
307316
308317 ret = set_evtchn_to_irq(evtchn, irq);
309318 if (ret < 0)
@@ -377,6 +386,7 @@ static int xen_irq_info_pirq_setup(unsigned irq, · 67 unmodified lines
377386 static void xen_irq_info_cleanup(struct irq_info *info)
378387 {
379388 set_evtchn_to_irq(info->evtchn, -1);
389+ xen_evtchn_port_remove(info->evtchn, info->cpu);
380390 info->evtchn = 0;
381391 channels_on_cpu_dec(info);
382392 }
@@ -458,6 +468,34 @@ unsigned int cpu_from_evtchn(evtchn_port_t evtchn) · 75 unmodified lines
458468 return ret;
459469 }
460470
471+static void do_mask(struct irq_info *info, u8 reason)
472+{
473+ unsigned long flags;
474+
475+ spin_lock_irqsave(&info->lock, flags);
476+
477+ if (!info->mask_reason)
478+ mask_evtchn(info->evtchn);
479+
480+ info->mask_reason |= reason;
481+
482+ spin_unlock_irqrestore(&info->lock, flags);
483+}
484+
485+static void do_unmask(struct irq_info *info, u8 reason)
486+{
487+ unsigned long flags;
488+
489+ spin_lock_irqsave(&info->lock, flags);
490+
491+ info->mask_reason &= ~reason;
492+
493+ if (!info->mask_reason)
494+ unmask_evtchn(info->evtchn);
495+
496+ spin_unlock_irqrestore(&info->lock, flags);
497+}
498+
461499 #ifdef CONFIG_X86
462500 static bool pirq_check_eoi_map(unsigned irq)
463501 {
@@ -604,7 +642,7 @@ static void xen_irq_lateeoi_locked(struct irq_info *info, bool spurious) · 140 unmodified lines
604642 }
605643
606644 info->eoi_time = 0;
607− unmask_evtchn(evtchn);
645+ do_unmask(info, EVT_MASK_REASON_EOI_PENDING);
608646 }
609647
610648 static void xen_irq_lateeoi_worker(struct work_struct *work)
@@ -773,6 +811,12 @@ static void xen_evtchn_close(evtchn_port_t port) · 162 unmodified lines
773811 BUG();
774812 }
775813
814+static void event_handler_exit(struct irq_info *info)
815+{
816+ smp_store_release(&info->is_active, 0);
817+ clear_evtchn(info->evtchn);
818+}
819+
776820 static void pirq_query_unmask(int irq)
777821 {
778822 struct physdev_irq_status_query irq_status;
@@ -791,14 +835,15 @@ static void pirq_query_unmask(int irq) · 12 unmodified lines
791835
792836 static void eoi_pirq(struct irq_data *data)
793837 {
794− evtchn_port_t evtchn = evtchn_from_irq(data->irq);
838+ struct irq_info *info = info_for_irq(data->irq);
839+ evtchn_port_t evtchn = info ? info->evtchn : 0;
795840 struct physdev_eoi eoi = { .irq = pirq_from_irq(data->irq) };
796841 int rc = 0;
797842
798843 if (!VALID_EVTCHN(evtchn))
799844 return;
800845
801− clear_evtchn(evtchn);
846+ event_handler_exit(info);
802847
803848 if (pirq_needs_eoi(data->irq)) {
804849 rc = HYPERVISOR_physdev_op(PHYSDEVOP_eoi, &eoi);
@@ -849,7 +894,8 @@ static unsigned int __startup_pirq(unsigned int irq) · 44 unmodified lines
849894 goto err;
850895
851896 out:
852− unmask_evtchn(evtchn);
897+ do_unmask(info, EVT_MASK_REASON_EXPLICIT);
898+
853899 eoi_pirq(irq_get_irq_data(irq));
854900
855901 return 0;
@@ -876,7 +922,7 @@ static void shutdown_pirq(struct irq_data *data) · 20 unmodified lines
876922 if (!VALID_EVTCHN(evtchn))
877923 return;
878924
879− mask_evtchn(evtchn);
925+ do_mask(info, EVT_MASK_REASON_EXPLICIT);
880926 xen_evtchn_close(evtchn);
881927 xen_irq_info_cleanup(info);
882928 }
@@ -1628,6 +1674,8 @@ void handle_irq_for_port(evtchn_port_t port, struct evtchn_loop_ctrl *ctrl) · 745 unmodified lines
16281674 }
16291675
16301676 info = info_for_irq(irq);
1677+ if (xchg_acquire(&info->is_active, 1))
1678+ return;
16311679
16321680 dev = (info->type == IRQT_EVTCHN) ? info->u.interdomain : NULL;
16331681 if (dev)
@@ -1720,10 +1768,10 @@ void rebind_evtchn_irq(evtchn_port_t evtchn, int irq) · 86 unmodified lines
17201768 }
17211769
17221770 /* Rebind an evtchn so that it gets delivered to a specific cpu */
1723−static int xen_rebind_evtchn_to_cpu(evtchn_port_t evtchn, unsigned int tcpu)
1771+static int xen_rebind_evtchn_to_cpu(struct irq_info *info, unsigned int tcpu)
17241772 {
17251773 struct evtchn_bind_vcpu bind_vcpu;
1726− int masked;
1774+ evtchn_port_t evtchn = info ? info->evtchn : 0;
17271775
17281776 if (!VALID_EVTCHN(evtchn))
17291777 return -1;
@@ -1739,7 +1787,7 @@ static int xen_rebind_evtchn_to_cpu(evtchn_port_t evtchn, unsigned int tcpu) · 9 unmodified lines
17391787 * Mask the event while changing the VCPU binding to prevent
17401788 * it being delivered on an unexpected VCPU.
17411789 */
1742− masked = test_and_set_mask(evtchn);
1790+ do_mask(info, EVT_MASK_REASON_TEMPORARY);
17431791
17441792 /*
17451793 * If this fails, it usually just indicates that we're dealing with a
@@ -1749,8 +1797,7 @@ static int xen_rebind_evtchn_to_cpu(evtchn_port_t evtchn, unsigned int tcpu) · 3 unmodified lines
17491797 if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_vcpu, &bind_vcpu) >= 0)
17501798 bind_evtchn_to_cpu(evtchn, tcpu, false);
17511799
1752− if (!masked)
1753− unmask_evtchn(evtchn);
1800+ do_unmask(info, EVT_MASK_REASON_TEMPORARY);
17541801
17551802 return 0;
17561803 }
@@ -1789,7 +1836,7 @@ static int set_affinity_irq(struct irq_data *data, const struct cpumask *dest, · 32 unmodified lines
17891836 unsigned int tcpu = select_target_cpu(dest);
17901837 int ret;
17911838
1792− ret = xen_rebind_evtchn_to_cpu(evtchn_from_irq(data->irq), tcpu);
1839+ ret = xen_rebind_evtchn_to_cpu(info_for_irq(data->irq), tcpu);
17931840 if (!ret)
17941841 irq_data_update_effective_affinity(data, cpumask_of(tcpu));
17951842
@@ -1798,28 +1845,29 @@ static int set_affinity_irq(struct irq_data *data, const struct cpumask *dest, · 2 unmodified lines
17981845
17991846 static void enable_dynirq(struct irq_data *data)
18001847 {
1801− evtchn_port_t evtchn = evtchn_from_irq(data->irq);
1848+ struct irq_info *info = info_for_irq(data->irq);
1849+ evtchn_port_t evtchn = info ? info->evtchn : 0;
18021850
18031851 if (VALID_EVTCHN(evtchn))
1804− unmask_evtchn(evtchn);
1852+ do_unmask(info, EVT_MASK_REASON_EXPLICIT);
18051853 }
18061854
18071855 static void disable_dynirq(struct irq_data *data)
18081856 {
1809− evtchn_port_t evtchn = evtchn_from_irq(data->irq);
1857+ struct irq_info *info = info_for_irq(data->irq);
1858+ evtchn_port_t evtchn = info ? info->evtchn : 0;
18101859
18111860 if (VALID_EVTCHN(evtchn))
1812− mask_evtchn(evtchn);
1861+ do_mask(info, EVT_MASK_REASON_EXPLICIT);
18131862 }
18141863
18151864 static void ack_dynirq(struct irq_data *data)
18161865 {
1817− evtchn_port_t evtchn = evtchn_from_irq(data->irq);
1866+ struct irq_info *info = info_for_irq(data->irq);
1867+ evtchn_port_t evtchn = info ? info->evtchn : 0;
18181868
1819− if (!VALID_EVTCHN(evtchn))
1820− return;
1821−
1822− clear_evtchn(evtchn);
1869+ if (VALID_EVTCHN(evtchn))
1870+ event_handler_exit(info);
18231871 }
18241872
18251873 static void mask_ack_dynirq(struct irq_data *data)
@@ -1828,18 +1876,39 @@ static void mask_ack_dynirq(struct irq_data *data) · 2 unmodified lines
18281876 ack_dynirq(data);
18291877 }
18301878
1879+static void lateeoi_ack_dynirq(struct irq_data *data)
1880+{
1881+ struct irq_info *info = info_for_irq(data->irq);
1882+ evtchn_port_t evtchn = info ? info->evtchn : 0;
1883+
1884+ if (VALID_EVTCHN(evtchn)) {
1885+ do_mask(info, EVT_MASK_REASON_EOI_PENDING);
1886+ event_handler_exit(info);
1887+ }
1888+}
1889+
1890+static void lateeoi_mask_ack_dynirq(struct irq_data *data)
1891+{
1892+ struct irq_info *info = info_for_irq(data->irq);
1893+ evtchn_port_t evtchn = info ? info->evtchn : 0;
1894+
1895+ if (VALID_EVTCHN(evtchn)) {
1896+ do_mask(info, EVT_MASK_REASON_EXPLICIT);
1897+ event_handler_exit(info);
1898+ }
1899+}
1900+
18311901 static int retrigger_dynirq(struct irq_data *data)
18321902 {
1833− evtchn_port_t evtchn = evtchn_from_irq(data->irq);
1834− int masked;
1903+ struct irq_info *info = info_for_irq(data->irq);
1904+ evtchn_port_t evtchn = info ? info->evtchn : 0;
18351905
18361906 if (!VALID_EVTCHN(evtchn))
18371907 return 0;
18381908
1839− masked = test_and_set_mask(evtchn);
1909+ do_mask(info, EVT_MASK_REASON_TEMPORARY);
18401910 set_evtchn(evtchn);
1841− if (!masked)
1842− unmask_evtchn(evtchn);
1911+ do_unmask(info, EVT_MASK_REASON_TEMPORARY);
18431912
18441913 return 1;
18451914 }
@@ -1938,10 +2007,11 @@ static void restore_cpu_ipis(unsigned int cpu) · 92 unmodified lines
19382007 /* Clear an irq's pending state, in preparation for polling on it */
19392008 void xen_clear_irq_pending(int irq)
19402009 {
1941− evtchn_port_t evtchn = evtchn_from_irq(irq);
2010+ struct irq_info *info = info_for_irq(irq);
2011+ evtchn_port_t evtchn = info ? info->evtchn : 0;
19422012
19432013 if (VALID_EVTCHN(evtchn))
1944− clear_evtchn(evtchn);
2014+ event_handler_exit(info);
19452015 }
19462016 EXPORT_SYMBOL(xen_clear_irq_pending);
19472017 void xen_set_irq_pending(int irq)
@@ -2053,8 +2123,8 @@ static struct irq_chip xen_lateeoi_chip __read_mostly = { · 105 unmodified lines
20532123 .irq_mask = disable_dynirq,
20542124 .irq_unmask = enable_dynirq,
20552125
2056− .irq_ack = mask_ack_dynirq,
2057− .irq_mask_ack = mask_ack_dynirq,
2126+ .irq_ack = lateeoi_ack_dynirq,
2127+ .irq_mask_ack = lateeoi_mask_ack_dynirq,
20582128
20592129 .irq_set_affinity = set_affinity_irq,
20602130 .irq_retrigger = retrigger_dynirq,
drivers/xen/events/events_fifo.c+0−7
@@ -209,12 +209,6 @@ static bool evtchn_fifo_is_pending(evtchn_port_t port) · 208 unmodified lines
209209 return sync_test_bit(EVTCHN_FIFO_BIT(PENDING, word), BM(word));
210210 }
211211
212−static bool evtchn_fifo_test_and_set_mask(evtchn_port_t port)
213−{
214− event_word_t *word = event_word_from_port(port);
215− return sync_test_and_set_bit(EVTCHN_FIFO_BIT(MASKED, word), BM(word));
216−}
217−
218212 static void evtchn_fifo_mask(evtchn_port_t port)
219213 {
220214 event_word_t *word = event_word_from_port(port);
@@ -423,7 +417,6 @@ static const struct evtchn_ops evtchn_ops_fifo = { · 202 unmodified lines
423417 .clear_pending = evtchn_fifo_clear_pending,
424418 .set_pending = evtchn_fifo_set_pending,
425419 .is_pending = evtchn_fifo_is_pending,
426− .test_and_set_mask = evtchn_fifo_test_and_set_mask,
427420 .mask = evtchn_fifo_mask,
428421 .unmask = evtchn_fifo_unmask,
429422 .handle_events = evtchn_fifo_handle_events,
drivers/xen/events/events_internal.h+8−6
@@ -14,13 +14,13 @@ struct evtchn_ops { · 13 unmodified lines
1414 unsigned (*nr_channels)(void);
1515
1616 int (*setup)(evtchn_port_t port);
17+ void (*remove)(evtchn_port_t port, unsigned int cpu);
1718 void (*bind_to_cpu)(evtchn_port_t evtchn, unsigned int cpu,
1819 unsigned int old_cpu);
1920
2021 void (*clear_pending)(evtchn_port_t port);
2122 void (*set_pending)(evtchn_port_t port);
2223 bool (*is_pending)(evtchn_port_t port);
23− bool (*test_and_set_mask)(evtchn_port_t port);
2424 void (*mask)(evtchn_port_t port);
2525 void (*unmask)(evtchn_port_t port);
2626
@@ -54,6 +54,13 @@ static inline int xen_evtchn_port_setup(evtchn_port_t evtchn) · 27 unmodified lines
5454 return 0;
5555 }
5656
57+static inline void xen_evtchn_port_remove(evtchn_port_t evtchn,
58+ unsigned int cpu)
59+{
60+ if (evtchn_ops->remove)
61+ evtchn_ops->remove(evtchn, cpu);
62+}
63+
5764 static inline void xen_evtchn_port_bind_to_cpu(evtchn_port_t evtchn,
5865 unsigned int cpu,
5966 unsigned int old_cpu)
@@ -76,11 +83,6 @@ static inline bool test_evtchn(evtchn_port_t port) · 16 unmodified lines
7683 return evtchn_ops->is_pending(port);
7784 }
7885
79−static inline bool test_and_set_mask(evtchn_port_t port)
80−{
81− return evtchn_ops->test_and_set_mask(port);
82−}
83−
8486 static inline void mask_evtchn(evtchn_port_t port)
8587 {
8688 return evtchn_ops->mask(port);
drivers/xen/gntdev.c+33−21
@@ -133,20 +133,26 @@ struct gntdev_grant_map *gntdev_alloc_map(struct gntdev_priv *priv, int count, · 132 unmodified lines
133133 if (NULL == add)
134134 return NULL;
135135
136− add->grants = kvcalloc(count, sizeof(add->grants[0]), GFP_KERNEL);
137− add->map_ops = kvcalloc(count, sizeof(add->map_ops[0]), GFP_KERNEL);
138− add->unmap_ops = kvcalloc(count, sizeof(add->unmap_ops[0]), GFP_KERNEL);
139− add->kmap_ops = kvcalloc(count, sizeof(add->kmap_ops[0]), GFP_KERNEL);
140− add->kunmap_ops = kvcalloc(count,
141− sizeof(add->kunmap_ops[0]), GFP_KERNEL);
136+ add->grants = kvmalloc_array(count, sizeof(add->grants[0]),
137+ GFP_KERNEL);
138+ add->map_ops = kvmalloc_array(count, sizeof(add->map_ops[0]),
139+ GFP_KERNEL);
140+ add->unmap_ops = kvmalloc_array(count, sizeof(add->unmap_ops[0]),
141+ GFP_KERNEL);
142142 add->pages = kvcalloc(count, sizeof(add->pages[0]), GFP_KERNEL);
143143 if (NULL == add->grants ||
144144 NULL == add->map_ops ||
145145 NULL == add->unmap_ops ||
146− NULL == add->kmap_ops ||
147− NULL == add->kunmap_ops ||
148146 NULL == add->pages)
149147 goto err;
148+ if (use_ptemod) {
149+ add->kmap_ops = kvmalloc_array(count, sizeof(add->kmap_ops[0]),
150+ GFP_KERNEL);
151+ add->kunmap_ops = kvmalloc_array(count, sizeof(add->kunmap_ops[0]),
152+ GFP_KERNEL);
153+ if (NULL == add->kmap_ops || NULL == add->kunmap_ops)
154+ goto err;
155+ }
150156
151157 #ifdef CONFIG_XEN_GRANT_DMA_ALLOC
152158 add->dma_flags = dma_flags;
@@ -183,10 +189,14 @@ struct gntdev_grant_map *gntdev_alloc_map(struct gntdev_priv *priv, int count, · 30 unmodified lines
183189 goto err;
184190
185191 for (i = 0; i < count; i++) {
186− add->map_ops[i].handle = -1;
187− add->unmap_ops[i].handle = -1;
188− add->kmap_ops[i].handle = -1;
189− add->kunmap_ops[i].handle = -1;
192+ add->grants[i].domid = DOMID_INVALID;
193+ add->grants[i].ref = INVALID_GRANT_REF;
194+ add->map_ops[i].handle = INVALID_GRANT_HANDLE;
195+ add->unmap_ops[i].handle = INVALID_GRANT_HANDLE;
196+ if (use_ptemod) {
197+ add->kmap_ops[i].handle = INVALID_GRANT_HANDLE;
198+ add->kunmap_ops[i].handle = INVALID_GRANT_HANDLE;
199+ }
190200 }
191201
192202 add->index = 0;
@@ -274,7 +284,7 @@ static int find_grant_ptes(pte_t *pte, unsigned long addr, void *data) · 81 unmodified lines
274284 map->grants[pgnr].ref,
275285 map->grants[pgnr].domid);
276286 gnttab_set_unmap_op(&map->unmap_ops[pgnr], pte_maddr, flags,
277− -1 /* handle */);
287+ INVALID_GRANT_HANDLE);
278288 return 0;
279289 }
280290
@@ -292,7 +302,7 @@ int gntdev_map_grant_pages(struct gntdev_grant_map *map) · 11 unmodified lines
292302
293303 if (!use_ptemod) {
294304 /* Note: it could already be mapped */
295− if (map->map_ops[0].handle != -1)
305+ if (map->map_ops[0].handle != INVALID_GRANT_HANDLE)
296306 return 0;
297307 for (i = 0; i < map->count; i++) {
298308 unsigned long addr = (unsigned long)
@@ -301,7 +311,7 @@ int gntdev_map_grant_pages(struct gntdev_grant_map *map) · 2 unmodified lines
301311 map->grants[i].ref,
302312 map->grants[i].domid);
303313 gnttab_set_unmap_op(&map->unmap_ops[i], addr,
304− map->flags, -1 /* handle */);
314+ map->flags, INVALID_GRANT_HANDLE);
305315 }
306316 } else {
307317 /*
@@ -327,13 +337,13 @@ int gntdev_map_grant_pages(struct gntdev_grant_map *map) · 19 unmodified lines
327337 map->grants[i].ref,
328338 map->grants[i].domid);
329339 gnttab_set_unmap_op(&map->kunmap_ops[i], address,
330− flags, -1);
340+ flags, INVALID_GRANT_HANDLE);
331341 }
332342 }
333343
334344 pr_debug("map %d+%d\n", map->index, map->count);
335− err = gnttab_map_refs(map->map_ops, use_ptemod ? map->kmap_ops : NULL,
336− map->pages, map->count);
345+ err = gnttab_map_refs(map->map_ops, map->kmap_ops, map->pages,
346+ map->count);
337347
338348 for (i = 0; i < map->count; i++) {
339349 if (map->map_ops[i].status == GNTST_okay)
@@ -385,7 +395,7 @@ static int __unmap_grant_pages(struct gntdev_grant_map *map, int offset, · 45 unmodified lines
385395 pr_debug("unmap handle=%d st=%d\n",
386396 map->unmap_ops[offset+i].handle,
387397 map->unmap_ops[offset+i].status);
388− map->unmap_ops[offset+i].handle = -1;
398+ map->unmap_ops[offset+i].handle = INVALID_GRANT_HANDLE;
389399 }
390400 return err;
391401 }
@@ -401,13 +411,15 @@ static int unmap_grant_pages(struct gntdev_grant_map *map, int offset, · 9 unmodified lines
401411 * already unmapped some of the grants. Only unmap valid ranges.
402412 */
403413 while (pages && !err) {
404− while (pages && map->unmap_ops[offset].handle == -1) {
414+ while (pages &&
415+ map->unmap_ops[offset].handle == INVALID_GRANT_HANDLE) {
405416 offset++;
406417 pages--;
407418 }
408419 range = 0;
409420 while (range < pages) {
410− if (map->unmap_ops[offset+range].handle == -1)
421+ if (map->unmap_ops[offset + range].handle ==
422+ INVALID_GRANT_HANDLE)
411423 break;
412424 range++;
413425 }
fs/Kconfig+1−1
@@ -203,7 +203,7 @@ config TMPFS_XATTR · 202 unmodified lines
203203
204204 config TMPFS_INODE64
205205 bool "Use 64-bit ino_t by default in tmpfs"
206− depends on TMPFS && 64BIT && !(S390 || ALPHA)
206+ depends on TMPFS && 64BIT
207207 default n
208208 help
209209 tmpfs has historically used only inode numbers as wide as an unsigned
fs/afs/dir.c+0−1
@@ -70,7 +70,6 @@ const struct inode_operations afs_dir_inode_operations = { · 69 unmodified lines
7070 .permission = afs_permission,
7171 .getattr = afs_getattr,
7272 .setattr = afs_setattr,
73− .listxattr = afs_listxattr,
7473 };
7574
7675 const struct address_space_operations afs_dir_aops = {
fs/afs/file.c+0−1
@@ -43,7 +43,6 @@ const struct inode_operations afs_file_inode_operations = { · 42 unmodified lines
4343 .getattr = afs_getattr,
4444 .setattr = afs_setattr,
4545 .permission = afs_permission,
46− .listxattr = afs_listxattr,
4746 };
4847
4948 const struct address_space_operations afs_fs_aops = {
fs/afs/fs_operation.c+5−2
@@ -181,10 +181,13 @@ void afs_wait_for_operation(struct afs_operation *op) · 180 unmodified lines
181181 if (test_bit(AFS_SERVER_FL_IS_YFS, &op->server->flags) &&
182182 op->ops->issue_yfs_rpc)
183183 op->ops->issue_yfs_rpc(op);
184− else
184+ else if (op->ops->issue_afs_rpc)
185185 op->ops->issue_afs_rpc(op);
186+ else
187+ op->ac.error = -ENOTSUPP;
186188
187− op->error = afs_wait_for_call_to_complete(op->call, &op->ac);
189+ if (op->call)
190+ op->error = afs_wait_for_call_to_complete(op->call, &op->ac);
188191 }
189192
190193 switch (op->error) {
fs/afs/inode.c+0−1
@@ -27,7 +27,6 @@ · 26 unmodified lines
2727
2828 static const struct inode_operations afs_symlink_inode_operations = {
2929 .get_link = page_get_link,
30− .listxattr = afs_listxattr,
3130 };
3231
3332 static noinline void dump_vnode(struct afs_vnode *vnode, struct afs_vnode *parent_vnode)
fs/afs/internal.h+0−1
@@ -1509,7 +1509,6 @@ extern int afs_launder_page(struct page *); · 1508 unmodified lines
15091509 * xattr.c
15101510 */
15111511 extern const struct xattr_handler *afs_xattr_handlers[];
1512−extern ssize_t afs_listxattr(struct dentry *, char *, size_t);
15131512
15141513 /*
15151514 * yfsclient.c
fs/afs/mntpt.c+0−1
@@ -32,7 +32,6 @@ const struct inode_operations afs_mntpt_inode_operations = { · 31 unmodified lines
3232 .lookup = afs_mntpt_lookup,
3333 .readlink = page_readlink,
3434 .getattr = afs_getattr,
35− .listxattr = afs_listxattr,
3635 };
3736
3837 const struct inode_operations afs_autocell_inode_operations = {
fs/afs/write.c+1−2
@@ -851,8 +851,7 @@ vm_fault_t afs_page_mkwrite(struct vm_fault *vmf) · 850 unmodified lines
851851 fscache_wait_on_page_write(vnode->cache, vmf->page);
852852 #endif
853853
854− if (PageWriteback(vmf->page) &&
855− wait_on_page_bit_killable(vmf->page, PG_writeback) < 0)
854+ if (wait_on_page_writeback_killable(vmf->page))
856855 return VM_FAULT_RETRY;
857856
858857 if (lock_page_killable(vmf->page) < 0)
fs/afs/xattr.c+7−24
@@ -11,29 +11,6 @@ · 10 unmodified lines
1111 #include <linux/xattr.h>
1212 #include "internal.h"
1313
14−static const char afs_xattr_list[] =
15− "afs.acl\0"
16− "afs.cell\0"
17− "afs.fid\0"
18− "afs.volume\0"
19− "afs.yfs.acl\0"
20− "afs.yfs.acl_inherited\0"
21− "afs.yfs.acl_num_cleaned\0"
22− "afs.yfs.vol_acl";
23−
24−/*
25− * Retrieve a list of the supported xattrs.
26− */
27−ssize_t afs_listxattr(struct dentry *dentry, char *buffer, size_t size)
28−{
29− if (size == 0)
30− return sizeof(afs_xattr_list);
31− if (size < sizeof(afs_xattr_list))
32− return -ERANGE;
33− memcpy(buffer, afs_xattr_list, sizeof(afs_xattr_list));
34− return sizeof(afs_xattr_list);
35−}
36−
3714 /*
3815 * Deal with the result of a successful fetch ACL operation.
3916 */
@@ -231,6 +208,8 @@ static int afs_xattr_get_yfs(const struct xattr_handler *handler, · 191 unmodified lines
231208 else
232209 ret = -ERANGE;
233210 }
211+ } else if (ret == -ENOTSUPP) {
212+ ret = -ENODATA;
234213 }
235214
236215 error_yacl:
@@ -256,6 +235,7 @@ static int afs_xattr_set_yfs(const struct xattr_handler *handler, · 19 unmodified lines
256235 {
257236 struct afs_operation *op;
258237 struct afs_vnode *vnode = AFS_FS_I(inode);
238+ int ret;
259239
260240 if (flags == XATTR_CREATE ||
261241 strcmp(name, "acl") != 0)
@@ -270,7 +250,10 @@ static int afs_xattr_set_yfs(const struct xattr_handler *handler, · 8 unmodified lines
270250 return afs_put_operation(op);
271251
272252 op->ops = &yfs_store_opaque_acl2_operation;
273− return afs_do_sync_operation(op);
253+ ret = afs_do_sync_operation(op);
254+ if (ret == -ENOTSUPP)
255+ ret = -ENODATA;
256+ return ret;
274257 }
275258
276259 static const struct xattr_handler afs_xattr_yfs_handler = {
fs/binfmt_misc.c+14−15
@@ -649,12 +649,24 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer, · 648 unmodified lines
649649 struct super_block *sb = file_inode(file)->i_sb;
650650 struct dentry *root = sb->s_root, *dentry;
651651 int err = 0;
652+ struct file *f = NULL;
652653
653654 e = create_entry(buffer, count);
654655
655656 if (IS_ERR(e))
656657 return PTR_ERR(e);
657658
659+ if (e->flags & MISC_FMT_OPEN_FILE) {
660+ f = open_exec(e->interpreter);
661+ if (IS_ERR(f)) {
662+ pr_notice("register: failed to install interpreter file %s\n",
663+ e->interpreter);
664+ kfree(e);
665+ return PTR_ERR(f);
666+ }
667+ e->interp_file = f;
668+ }
669+
658670 inode_lock(d_inode(root));
659671 dentry = lookup_one_len(e->name, root, strlen(e->name));
660672 err = PTR_ERR(dentry);
@@ -678,21 +690,6 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer, · 17 unmodified lines
678690 goto out2;
679691 }
680692
681− if (e->flags & MISC_FMT_OPEN_FILE) {
682− struct file *f;
683−
684− f = open_exec(e->interpreter);
685− if (IS_ERR(f)) {
686− err = PTR_ERR(f);
687− pr_notice("register: failed to install interpreter file %s\n", e->interpreter);
688− simple_release_fs(&bm_mnt, &entry_count);
689− iput(inode);
690− inode = NULL;
691− goto out2;
692− }
693− e->interp_file = f;
694− }
695−
696693 e->dentry = dget(dentry);
697694 inode->i_private = e;
698695 inode->i_fop = &bm_entry_operations;
@@ -709,6 +706,8 @@ out: · 10 unmodified lines
709706 inode_unlock(d_inode(root));
710707
711708 if (err) {
709+ if (f)
710+ filp_close(f, NULL);
712711 kfree(e);
713712 return err;
714713 }
fs/block_dev.c+13−4
@@ -118,13 +118,22 @@ int truncate_bdev_range(struct block_device *bdev, fmode_t mode, · 117 unmodified lines
118118 if (!(mode & FMODE_EXCL)) {
119119 int err = bd_prepare_to_claim(bdev, truncate_bdev_range);
120120 if (err)
121− return err;
121+ goto invalidate;
122122 }
123123
124124 truncate_inode_pages_range(bdev->bd_inode->i_mapping, lstart, lend);
125125 if (!(mode & FMODE_EXCL))
126126 bd_abort_claiming(bdev, truncate_bdev_range);
127127 return 0;
128+
129+invalidate:
130+ /*
131+ * Someone else has handle exclusively open. Try invalidating instead.
132+ * The 'end' argument is inclusive so the rounding is safe.
133+ */
134+ return invalidate_inode_pages2_range(bdev->bd_inode->i_mapping,
135+ lstart >> PAGE_SHIFT,
136+ lend >> PAGE_SHIFT);
128137 }
129138
130139 static void set_init_blocksize(struct block_device *bdev)
@@ -423,7 +432,7 @@ static ssize_t __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, · 292 unmodified lines
423432 dio->size += bio->bi_iter.bi_size;
424433 pos += bio->bi_iter.bi_size;
425434
426− nr_pages = bio_iov_vecs_to_alloc(iter, BIO_MAX_PAGES);
435+ nr_pages = bio_iov_vecs_to_alloc(iter, BIO_MAX_VECS);
427436 if (!nr_pages) {
428437 bool polled = false;
429438
@@ -491,8 +500,8 @@ blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter) · 61 unmodified lines
491500 if (!iov_iter_count(iter))
492501 return 0;
493502
494− nr_pages = bio_iov_vecs_to_alloc(iter, BIO_MAX_PAGES + 1);
495− if (is_sync_kiocb(iocb) && nr_pages <= BIO_MAX_PAGES)
503+ nr_pages = bio_iov_vecs_to_alloc(iter, BIO_MAX_VECS + 1);
504+ if (is_sync_kiocb(iocb) && nr_pages <= BIO_MAX_VECS)
496505 return __blkdev_direct_IO_simple(iocb, iter, nr_pages);
497506
498507 return __blkdev_direct_IO(iocb, iter, bio_max_segs(nr_pages));
fs/btrfs/ctree.c+2−0
@@ -1365,7 +1365,9 @@ get_old_root(struct btrfs_root *root, u64 time_seq) · 1364 unmodified lines
13651365 "failed to read tree block %llu from get_old_root",
13661366 logical);
13671367 } else {
1368+ btrfs_tree_read_lock(old);
13681369 eb = btrfs_clone_extent_buffer(old);
1370+ btrfs_tree_read_unlock(old);
13691371 free_extent_buffer(old);
13701372 }
13711373 } else if (old_root) {
fs/btrfs/extent-tree.c+22−1
@@ -3323,6 +3323,7 @@ void btrfs_free_tree_block(struct btrfs_trans_handle *trans, · 3322 unmodified lines
33233323
33243324 if (last_ref && btrfs_header_generation(buf) == trans->transid) {
33253325 struct btrfs_block_group *cache;
3326+ bool must_pin = false;
33263327
33273328 if (root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID) {
33283329 ret = check_ref_cleanup(trans, buf->start);
@@ -3340,7 +3341,27 @@ void btrfs_free_tree_block(struct btrfs_trans_handle *trans, · 11 unmodified lines
33403341 goto out;
33413342 }
33423343
3343− if (btrfs_is_zoned(fs_info)) {
3344+ /*
3345+ * If this is a leaf and there are tree mod log users, we may
3346+ * have recorded mod log operations that point to this leaf.
3347+ * So we must make sure no one reuses this leaf's extent before
3348+ * mod log operations are applied to a node, otherwise after
3349+ * rewinding a node using the mod log operations we get an
3350+ * inconsistent btree, as the leaf's extent may now be used as
3351+ * a node or leaf for another different btree.
3352+ * We are safe from races here because at this point no other
3353+ * node or root points to this extent buffer, so if after this
3354+ * check a new tree mod log user joins, it will not be able to
3355+ * find a node pointing to this leaf and record operations that
3356+ * point to this leaf.
3357+ */
3358+ if (btrfs_header_level(buf) == 0) {
3359+ read_lock(&fs_info->tree_mod_log_lock);
3360+ must_pin = !list_empty(&fs_info->tree_mod_seq_list);
3361+ read_unlock(&fs_info->tree_mod_log_lock);
3362+ }
3363+
3364+ if (must_pin || btrfs_is_zoned(fs_info)) {
33443365 btrfs_redirty_list_add(trans->transaction, buf);
33453366 pin_down_extent(trans, cache, buf->start, buf->len, 1);
33463367 btrfs_put_block_group(cache);
fs/btrfs/extent_io.c+32−3
@@ -2885,6 +2885,35 @@ static void end_page_read(struct page *page, bool uptodate, u64 start, u32 len) · 2884 unmodified lines
28852885 btrfs_subpage_end_reader(fs_info, page, start, len);
28862886 }
28872887
2888+/*
2889+ * Find extent buffer for a givne bytenr.
2890+ *
2891+ * This is for end_bio_extent_readpage(), thus we can't do any unsafe locking
2892+ * in endio context.
2893+ */
2894+static struct extent_buffer *find_extent_buffer_readpage(
2895+ struct btrfs_fs_info *fs_info, struct page *page, u64 bytenr)
2896+{
2897+ struct extent_buffer *eb;
2898+
2899+ /*
2900+ * For regular sectorsize, we can use page->private to grab extent
2901+ * buffer
2902+ */
2903+ if (fs_info->sectorsize == PAGE_SIZE) {
2904+ ASSERT(PagePrivate(page) && page->private);
2905+ return (struct extent_buffer *)page->private;
2906+ }
2907+
2908+ /* For subpage case, we need to lookup buffer radix tree */
2909+ rcu_read_lock();
2910+ eb = radix_tree_lookup(&fs_info->buffer_radix,
2911+ bytenr >> fs_info->sectorsize_bits);
2912+ rcu_read_unlock();
2913+ ASSERT(eb);
2914+ return eb;
2915+}
2916+
28882917 /*
28892918 * after a readpage IO is done, we need to:
28902919 * clear the uptodate bits on error
@@ -2996,7 +3025,7 @@ static void end_bio_extent_readpage(struct bio *bio) · 105 unmodified lines
29963025 } else {
29973026 struct extent_buffer *eb;
29983027
2999− eb = (struct extent_buffer *)page->private;
3028+ eb = find_extent_buffer_readpage(fs_info, page, start);
30003029 set_bit(EXTENT_BUFFER_READ_ERR, &eb->bflags);
30013030 eb->read_mirror = mirror;
30023031 atomic_dec(&eb->io_pages);
@@ -3020,7 +3049,7 @@ readpage_ok: · 17 unmodified lines
30203049 */
30213050 if (page->index == end_index && i_size <= end) {
30223051 u32 zero_start = max(offset_in_page(i_size),
3023− offset_in_page(end));
3052+ offset_in_page(start));
30243053
30253054 zero_user_segment(page, zero_start,
30263055 offset_in_page(end) + 1);
@@ -3059,7 +3088,7 @@ struct bio *btrfs_bio_alloc(u64 first_byte) · 32 unmodified lines
30593088 {
30603089 struct bio *bio;
30613090
3062− bio = bio_alloc_bioset(GFP_NOFS, BIO_MAX_PAGES, &btrfs_bioset);
3091+ bio = bio_alloc_bioset(GFP_NOFS, BIO_MAX_VECS, &btrfs_bioset);
30633092 bio->bi_iter.bi_sector = first_byte >> 9;
30643093 btrfs_io_bio_init(btrfs_io_bio(bio));
30653094 return bio;
fs/btrfs/inode.c+26−11
@@ -9008,7 +9008,7 @@ int __init btrfs_init_cachep(void) · 9007 unmodified lines
90089008
90099009 btrfs_free_space_bitmap_cachep = kmem_cache_create("btrfs_free_space_bitmap",
90109010 PAGE_SIZE, PAGE_SIZE,
9011− SLAB_RED_ZONE, NULL);
9011+ SLAB_MEM_SPREAD, NULL);
90129012 if (!btrfs_free_space_bitmap_cachep)
90139013 goto fail;
90149014
@@ -9877,6 +9877,7 @@ static struct btrfs_trans_handle *insert_prealloc_file_extent( · 862 unmodified lines
98779877 struct btrfs_path *path;
98789878 u64 start = ins->objectid;
98799879 u64 len = ins->offset;
9880+ int qgroup_released;
98809881 int ret;
98819882
98829883 memset(&stack_fi, 0, sizeof(stack_fi));
@@ -9889,16 +9890,16 @@ static struct btrfs_trans_handle *insert_prealloc_file_extent( · 6 unmodified lines
98899890 btrfs_set_stack_file_extent_compression(&stack_fi, BTRFS_COMPRESS_NONE);
98909891 /* Encryption and other encoding is reserved and all 0 */
98919892
9892− ret = btrfs_qgroup_release_data(inode, file_offset, len);
9893− if (ret < 0)
9894− return ERR_PTR(ret);
9893+ qgroup_released = btrfs_qgroup_release_data(inode, file_offset, len);
9894+ if (qgroup_released < 0)
9895+ return ERR_PTR(qgroup_released);
98959896
98969897 if (trans) {
98979898 ret = insert_reserved_file_extent(trans, inode,
98989899 file_offset, &stack_fi,
9899− true, ret);
9900+ true, qgroup_released);
99009901 if (ret)
9901− return ERR_PTR(ret);
9902+ goto free_qgroup;
99029903 return trans;
99039904 }
99049905
@@ -9909,21 +9910,35 @@ static struct btrfs_trans_handle *insert_prealloc_file_extent( · 4 unmodified lines
99099910 extent_info.file_offset = file_offset;
99109911 extent_info.extent_buf = (char *)&stack_fi;
99119912 extent_info.is_new_extent = true;
9912− extent_info.qgroup_reserved = ret;
9913+ extent_info.qgroup_reserved = qgroup_released;
99139914 extent_info.insertions = 0;
99149915
99159916 path = btrfs_alloc_path();
9916− if (!path)
9917− return ERR_PTR(-ENOMEM);
9917+ if (!path) {
9918+ ret = -ENOMEM;
9919+ goto free_qgroup;
9920+ }
99189921
99199922 ret = btrfs_replace_file_extents(&inode->vfs_inode, path, file_offset,
99209923 file_offset + len - 1, &extent_info,
99219924 &trans);
99229925 btrfs_free_path(path);
99239926 if (ret)
9924− return ERR_PTR(ret);
9925−
9927+ goto free_qgroup;
99269928 return trans;
9929+
9930+free_qgroup:
9931+ /*
9932+ * We have released qgroup data range at the beginning of the function,
9933+ * and normally qgroup_released bytes will be freed when committing
9934+ * transaction.
9935+ * But if we error out early, we have to free what we have released
9936+ * or we leak qgroup data reservation.
9937+ */
9938+ btrfs_qgroup_free_refroot(inode->root->fs_info,
9939+ inode->root->root_key.objectid, qgroup_released,
9940+ BTRFS_QGROUP_RSV_DATA);
9941+ return ERR_PTR(ret);
99279942 }
99289943
99299944 static int __btrfs_prealloc_file_range(struct inode *inode, int mode,
fs/btrfs/reada.c+18−17
@@ -209,7 +209,7 @@ int btree_readahead_hook(struct extent_buffer *eb, int err) · 208 unmodified lines
209209 /* find extent */
210210 spin_lock(&fs_info->reada_lock);
211211 re = radix_tree_lookup(&fs_info->reada_tree,
212− eb->start >> PAGE_SHIFT);
212+ eb->start >> fs_info->sectorsize_bits);
213213 if (re)
214214 re->refcnt++;
215215 spin_unlock(&fs_info->reada_lock);
@@ -240,7 +240,7 @@ static struct reada_zone *reada_find_zone(struct btrfs_device *dev, u64 logical, · 24 unmodified lines
240240 zone = NULL;
241241 spin_lock(&fs_info->reada_lock);
242242 ret = radix_tree_gang_lookup(&dev->reada_zones, (void **)&zone,
243− logical >> PAGE_SHIFT, 1);
243+ logical >> fs_info->sectorsize_bits, 1);
244244 if (ret == 1 && logical >= zone->start && logical <= zone->end) {
245245 kref_get(&zone->refcnt);
246246 spin_unlock(&fs_info->reada_lock);
@@ -283,13 +283,13 @@ static struct reada_zone *reada_find_zone(struct btrfs_device *dev, u64 logical, · 36 unmodified lines
283283
284284 spin_lock(&fs_info->reada_lock);
285285 ret = radix_tree_insert(&dev->reada_zones,
286− (unsigned long)(zone->end >> PAGE_SHIFT),
287− zone);
286+ (unsigned long)(zone->end >> fs_info->sectorsize_bits),
287+ zone);
288288
289289 if (ret == -EEXIST) {
290290 kfree(zone);
291291 ret = radix_tree_gang_lookup(&dev->reada_zones, (void **)&zone,
292− logical >> PAGE_SHIFT, 1);
292+ logical >> fs_info->sectorsize_bits, 1);
293293 if (ret == 1 && logical >= zone->start && logical <= zone->end)
294294 kref_get(&zone->refcnt);
295295 else
@@ -315,7 +315,7 @@ static struct reada_extent *reada_find_extent(struct btrfs_fs_info *fs_info, · 19 unmodified lines
315315 u64 length;
316316 int real_stripes;
317317 int nzones = 0;
318− unsigned long index = logical >> PAGE_SHIFT;
318+ unsigned long index = logical >> fs_info->sectorsize_bits;
319319 int dev_replace_is_ongoing;
320320 int have_zone = 0;
321321
@@ -497,7 +497,7 @@ static void reada_extent_put(struct btrfs_fs_info *fs_info, · 175 unmodified lines
497497 struct reada_extent *re)
498498 {
499499 int i;
500− unsigned long index = re->logical >> PAGE_SHIFT;
500+ unsigned long index = re->logical >> fs_info->sectorsize_bits;
501501
502502 spin_lock(&fs_info->reada_lock);
503503 if (--re->refcnt) {
@@ -538,11 +538,12 @@ static void reada_extent_put(struct btrfs_fs_info *fs_info, · 34 unmodified lines
538538 static void reada_zone_release(struct kref *kref)
539539 {
540540 struct reada_zone *zone = container_of(kref, struct reada_zone, refcnt);
541+ struct btrfs_fs_info *fs_info = zone->device->fs_info;
541542
542− lockdep_assert_held(&zone->device->fs_info->reada_lock);
543+ lockdep_assert_held(&fs_info->reada_lock);
543544
544545 radix_tree_delete(&zone->device->reada_zones,
545− zone->end >> PAGE_SHIFT);
546+ zone->end >> fs_info->sectorsize_bits);
546547
547548 kfree(zone);
548549 }
@@ -593,7 +594,7 @@ static int reada_add_block(struct reada_control *rc, u64 logical, · 44 unmodified lines
593594 static void reada_peer_zones_set_lock(struct reada_zone *zone, int lock)
594595 {
595596 int i;
596− unsigned long index = zone->end >> PAGE_SHIFT;
597+ unsigned long index = zone->end >> zone->device->fs_info->sectorsize_bits;
597598
598599 for (i = 0; i < zone->ndevs; ++i) {
599600 struct reada_zone *peer;
@@ -628,7 +629,7 @@ static int reada_pick_zone(struct btrfs_device *dev) · 28 unmodified lines
628629 (void **)&zone, index, 1);
629630 if (ret == 0)
630631 break;
631− index = (zone->end >> PAGE_SHIFT) + 1;
632+ index = (zone->end >> dev->fs_info->sectorsize_bits) + 1;
632633 if (zone->locked) {
633634 if (zone->elems > top_locked_elems) {
634635 top_locked_elems = zone->elems;
@@ -709,7 +710,7 @@ static int reada_start_machine_dev(struct btrfs_device *dev) · 74 unmodified lines
709710 * plugging to speed things up
710711 */
711712 ret = radix_tree_gang_lookup(&dev->reada_extents, (void **)&re,
712− dev->reada_next >> PAGE_SHIFT, 1);
713+ dev->reada_next >> fs_info->sectorsize_bits, 1);
713714 if (ret == 0 || re->logical > dev->reada_curr_zone->end) {
714715 ret = reada_pick_zone(dev);
715716 if (!ret) {
@@ -718,7 +719,7 @@ static int reada_start_machine_dev(struct btrfs_device *dev) · 2 unmodified lines
718719 }
719720 re = NULL;
720721 ret = radix_tree_gang_lookup(&dev->reada_extents, (void **)&re,
721− dev->reada_next >> PAGE_SHIFT, 1);
722+ dev->reada_next >> fs_info->sectorsize_bits, 1);
722723 }
723724 if (ret == 0) {
724725 spin_unlock(&fs_info->reada_lock);
@@ -885,7 +886,7 @@ static void dump_devs(struct btrfs_fs_info *fs_info, int all) · 160 unmodified lines
885886 pr_cont(" curr off %llu",
886887 device->reada_next - zone->start);
887888 pr_cont("\n");
888− index = (zone->end >> PAGE_SHIFT) + 1;
889+ index = (zone->end >> fs_info->sectorsize_bits) + 1;
889890 }
890891 cnt = 0;
891892 index = 0;
@@ -910,7 +911,7 @@ static void dump_devs(struct btrfs_fs_info *fs_info, int all) · 18 unmodified lines
910911 }
911912 }
912913 pr_cont("\n");
913− index = (re->logical >> PAGE_SHIFT) + 1;
914+ index = (re->logical >> fs_info->sectorsize_bits) + 1;
914915 if (++cnt > 15)
915916 break;
916917 }
@@ -926,7 +927,7 @@ static void dump_devs(struct btrfs_fs_info *fs_info, int all) · 9 unmodified lines
926927 if (ret == 0)
927928 break;
928929 if (!re->scheduled) {
929− index = (re->logical >> PAGE_SHIFT) + 1;
930+ index = (re->logical >> fs_info->sectorsize_bits) + 1;
930931 continue;
931932 }
932933 pr_debug("re: logical %llu size %u list empty %d scheduled %d",
@@ -942,7 +943,7 @@ static void dump_devs(struct btrfs_fs_info *fs_info, int all) · 9 unmodified lines
942943 }
943944 }
944945 pr_cont("\n");
945− index = (re->logical >> PAGE_SHIFT) + 1;
946+ index = (re->logical >> fs_info->sectorsize_bits) + 1;
946947 }
947948 spin_unlock(&fs_info->reada_lock);
948949 }
fs/btrfs/scrub.c+1−1
@@ -1428,7 +1428,7 @@ static void scrub_recheck_block_on_raid56(struct btrfs_fs_info *fs_info, · 1427 unmodified lines
14281428 if (!first_page->dev->bdev)
14291429 goto out;
14301430
1431− bio = btrfs_io_bio_alloc(BIO_MAX_PAGES);
1431+ bio = btrfs_io_bio_alloc(BIO_MAX_VECS);
14321432 bio_set_dev(bio, first_page->dev->bdev);
14331433
14341434 for (page_num = 0; page_num < sblock->page_count; page_num++) {
fs/btrfs/tree-log.c+4−4
@@ -3169,10 +3169,6 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, · 3168 unmodified lines
31693169
31703170 mutex_lock(&log_root_tree->log_mutex);
31713171
3172− index2 = log_root_tree->log_transid % 2;
3173− list_add_tail(&root_log_ctx.list, &log_root_tree->log_ctxs[index2]);
3174− root_log_ctx.log_transid = log_root_tree->log_transid;
3175−
31763172 if (btrfs_is_zoned(fs_info)) {
31773173 if (!log_root_tree->node) {
31783174 ret = btrfs_alloc_log_tree_node(trans, log_root_tree);
@@ -3183,6 +3179,10 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, · 4 unmodified lines
31833179 }
31843180 }
31853181
3182+ index2 = log_root_tree->log_transid % 2;
3183+ list_add_tail(&root_log_ctx.list, &log_root_tree->log_ctxs[index2]);
3184+ root_log_ctx.log_transid = log_root_tree->log_transid;
3185+
31863186 /*
31873187 * Now we are safe to update the log_root_tree because we're under the
31883188 * log_mutex, and we're a current writer so we're holding the commit
fs/cachefiles/bind.c+6−0
@@ -118,6 +118,12 @@ static int cachefiles_daemon_add_cache(struct cachefiles_cache *cache) · 117 unmodified lines
118118 cache->mnt = path.mnt;
119119 root = path.dentry;
120120
121+ ret = -EINVAL;
122+ if (mnt_user_ns(path.mnt) != &init_user_ns) {
123+ pr_warn("File cache on idmapped mounts not supported");
124+ goto error_unsupported;
125+ }
126+
121127 /* check parameters */
122128 ret = -EOPNOTSUPP;
123129 if (d_is_negative(root) ||
fs/cachefiles/rdwr.c+3−4
@@ -24,17 +24,16 @@ static int cachefiles_read_waiter(wait_queue_entry_t *wait, unsigned mode, · 23 unmodified lines
2424 container_of(wait, struct cachefiles_one_read, monitor);
2525 struct cachefiles_object *object;
2626 struct fscache_retrieval *op = monitor->op;
27− struct wait_bit_key *key = _key;
27+ struct wait_page_key *key = _key;
2828 struct page *page = wait->private;
2929
3030 ASSERT(key);
3131
3232 _enter("{%lu},%u,%d,{%p,%u}",
3333 monitor->netfs_page->index, mode, sync,
34− key->flags, key->bit_nr);
34+ key->page, key->bit_nr);
3535
36− if (key->flags != &page->flags ||
37− key->bit_nr != PG_locked)
36+ if (key->page != page || key->bit_nr != PG_locked)
3837 return 0;
3938
4039 _debug("--- monitor %p %lx ---", page, page->flags);
fs/cifs/cifs_debug.c+1−1
@@ -207,7 +207,7 @@ static int cifs_debug_files_proc_show(struct seq_file *m, void *v) · 206 unmodified lines
207207 from_kuid(&init_user_ns, cfile->uid),
208208 cfile->dentry);
209209 #ifdef CONFIG_CIFS_DEBUG2
210− seq_printf(m, " 0x%llx\n", cfile->fid.mid);
210+ seq_printf(m, " %llu\n", cfile->fid.mid);
211211 #else
212212 seq_printf(m, "\n");
213213 #endif /* CIFS_DEBUG2 */
fs/cifs/cifs_swn.c+1−1
@@ -248,7 +248,7 @@ nlmsg_fail: · 247 unmodified lines
248248
249249 /*
250250 * Try to find a matching registration for the tcon's server name and share name.
251− * Calls to this funciton must be protected by cifs_swnreg_idr_mutex.
251+ * Calls to this function must be protected by cifs_swnreg_idr_mutex.
252252 * TODO Try to avoid memory allocations
253253 */
254254 static struct cifs_swn_reg *cifs_find_swn_reg(struct cifs_tcon *tcon)
fs/cifs/cifsacl.c+6−3
@@ -1118,7 +1118,6 @@ static int set_chmod_dacl(struct cifs_acl *pdacl, struct cifs_acl *pndacl, · 1117 unmodified lines
11181118 /* Retain old ACEs which we can retain */
11191119 for (i = 0; i < src_num_aces; ++i) {
11201120 pntace = (struct cifs_ace *) (acl_base + size);
1121− pnntace = (struct cifs_ace *) (nacl_base + nsize);
11221121
11231122 if (!new_aces_set && (pntace->flags & INHERITED_ACE)) {
11241123 /* Place the new ACEs in between existing explicit and inherited */
@@ -1131,14 +1130,18 @@ static int set_chmod_dacl(struct cifs_acl *pdacl, struct cifs_acl *pndacl, · 6 unmodified lines
11311130 }
11321131
11331132 /* If it's any one of the ACE we're replacing, skip! */
1134− if ((compare_sids(&pntace->sid, &sid_unix_NFS_mode) == 0) ||
1133+ if (!mode_from_sid &&
1134+ ((compare_sids(&pntace->sid, &sid_unix_NFS_mode) == 0) ||
11351135 (compare_sids(&pntace->sid, pownersid) == 0) ||
11361136 (compare_sids(&pntace->sid, pgrpsid) == 0) ||
11371137 (compare_sids(&pntace->sid, &sid_everyone) == 0) ||
1138− (compare_sids(&pntace->sid, &sid_authusers) == 0)) {
1138+ (compare_sids(&pntace->sid, &sid_authusers) == 0))) {
11391139 goto next_ace;
11401140 }
11411141
1142+ /* update the pointer to the next ACE to populate*/
1143+ pnntace = (struct cifs_ace *) (nacl_base + nsize);
1144+
11421145 nsize += cifs_copy_ace(pnntace, pntace, NULL);
11431146 num_aces++;
11441147
fs/cifs/cifsfs.c+1−1
@@ -290,7 +290,7 @@ cifs_statfs(struct dentry *dentry, struct kstatfs *buf) · 289 unmodified lines
290290 rc = server->ops->queryfs(xid, tcon, cifs_sb, buf);
291291
292292 free_xid(xid);
293− return 0;
293+ return rc;
294294 }
295295
296296 static long cifs_fallocate(struct file *file, int mode, loff_t off, loff_t len)
fs/cifs/cifsglob.h+10−9
@@ -257,7 +257,7 @@ struct smb_version_operations { · 256 unmodified lines
257257 /* verify the message */
258258 int (*check_message)(char *, unsigned int, struct TCP_Server_Info *);
259259 bool (*is_oplock_break)(char *, struct TCP_Server_Info *);
260− int (*handle_cancelled_mid)(char *, struct TCP_Server_Info *);
260+ int (*handle_cancelled_mid)(struct mid_q_entry *, struct TCP_Server_Info *);
261261 void (*downgrade_oplock)(struct TCP_Server_Info *server,
262262 struct cifsInodeInfo *cinode, __u32 oplock,
263263 unsigned int epoch, bool *purge_cache);
@@ -1705,16 +1705,17 @@ static inline bool is_retryable_error(int error) · 1441 unmodified lines
17051705 #define CIFS_NO_RSP_BUF 0x040 /* no response buffer required */
17061706
17071707 /* Type of request operation */
1708−#define CIFS_ECHO_OP 0x080 /* echo request */
1709−#define CIFS_OBREAK_OP 0x0100 /* oplock break request */
1710−#define CIFS_NEG_OP 0x0200 /* negotiate request */
1708+#define CIFS_ECHO_OP 0x080 /* echo request */
1709+#define CIFS_OBREAK_OP 0x0100 /* oplock break request */
1710+#define CIFS_NEG_OP 0x0200 /* negotiate request */
1711+#define CIFS_CP_CREATE_CLOSE_OP 0x0400 /* compound create+close request */
17111712 /* Lower bitmask values are reserved by others below. */
1712−#define CIFS_SESS_OP 0x2000 /* session setup request */
1713−#define CIFS_OP_MASK 0x2380 /* mask request type */
1713+#define CIFS_SESS_OP 0x2000 /* session setup request */
1714+#define CIFS_OP_MASK 0x2780 /* mask request type */
17141715
1715−#define CIFS_HAS_CREDITS 0x0400 /* already has credits */
1716−#define CIFS_TRANSFORM_REQ 0x0800 /* transform request before sending */
1717−#define CIFS_NO_SRV_RSP 0x1000 /* there is no server response */
1716+#define CIFS_HAS_CREDITS 0x0400 /* already has credits */
1717+#define CIFS_TRANSFORM_REQ 0x0800 /* transform request before sending */
1718+#define CIFS_NO_SRV_RSP 0x1000 /* there is no server response */
17181719
17191720 /* Security Flags: indicate type of session setup needed */
17201721 #define CIFSSEC_MAY_SIGN 0x00001
fs/cifs/connect.c+7−7
@@ -741,7 +741,7 @@ static void clean_demultiplex_info(struct TCP_Server_Info *server) · 740 unmodified lines
741741 spin_lock(&GlobalMid_Lock);
742742 list_for_each_safe(tmp, tmp2, &server->pending_mid_q) {
743743 mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
744− cifs_dbg(FYI, "Clearing mid 0x%llx\n", mid_entry->mid);
744+ cifs_dbg(FYI, "Clearing mid %llu\n", mid_entry->mid);
745745 kref_get(&mid_entry->refcount);
746746 mid_entry->mid_state = MID_SHUTDOWN;
747747 list_move(&mid_entry->qhead, &dispose_list);
@@ -752,7 +752,7 @@ static void clean_demultiplex_info(struct TCP_Server_Info *server) · 4 unmodified lines
752752 /* now walk dispose list and issue callbacks */
753753 list_for_each_safe(tmp, tmp2, &dispose_list) {
754754 mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
755− cifs_dbg(FYI, "Callback mid 0x%llx\n", mid_entry->mid);
755+ cifs_dbg(FYI, "Callback mid %llu\n", mid_entry->mid);
756756 list_del_init(&mid_entry->qhead);
757757 mid_entry->callback(mid_entry);
758758 cifs_mid_q_entry_release(mid_entry);
@@ -1429,6 +1429,11 @@ smbd_connected: · 670 unmodified lines
14291429 tcp_ses->min_offload = ctx->min_offload;
14301430 tcp_ses->tcpStatus = CifsNeedNegotiate;
14311431
1432+ if ((ctx->max_credits < 20) || (ctx->max_credits > 60000))
1433+ tcp_ses->max_credits = SMB2_MAX_CREDITS_AVAILABLE;
1434+ else
1435+ tcp_ses->max_credits = ctx->max_credits;
1436+
14321437 tcp_ses->nr_targets = 1;
14331438 tcp_ses->ignore_signature = ctx->ignore_signature;
14341439 /* thread spawned, put it on the list */
@@ -2832,11 +2837,6 @@ static int mount_get_conns(struct smb3_fs_context *ctx, struct cifs_sb_info *cif · 1397 unmodified lines
28322837
28332838 *nserver = server;
28342839
2835− if ((ctx->max_credits < 20) || (ctx->max_credits > 60000))
2836− server->max_credits = SMB2_MAX_CREDITS_AVAILABLE;
2837− else
2838− server->max_credits = ctx->max_credits;
2839−
28402840 /* get a reference to a SMB session */
28412841 ses = cifs_get_smb_ses(server, ctx);
28422842 if (IS_ERR(ses)) {
fs/cifs/fs_context.c+4−2
@@ -1196,9 +1196,11 @@ static int smb3_fs_context_parse_param(struct fs_context *fc, · 1195 unmodified lines
11961196 pr_warn_once("Witness protocol support is experimental\n");
11971197 break;
11981198 case Opt_rootfs:
1199−#ifdef CONFIG_CIFS_ROOT
1200− ctx->rootfs = true;
1199+#ifndef CONFIG_CIFS_ROOT
1200+ cifs_dbg(VFS, "rootfs support requires CONFIG_CIFS_ROOT config option\n");
1201+ goto cifs_parse_mount_err;
12011202 #endif
1203+ ctx->rootfs = true;
12021204 break;
12031205 case Opt_posixpaths:
12041206 if (result.negated)
fs/cifs/inode.c+9−1
@@ -2395,7 +2395,7 @@ int cifs_getattr(struct user_namespace *mnt_userns, const struct path *path, · 2394 unmodified lines
23952395 * We need to be sure that all dirty pages are written and the server
23962396 * has actual ctime, mtime and file length.
23972397 */
2398− if ((request_mask & (STATX_CTIME | STATX_MTIME | STATX_SIZE)) &&
2398+ if ((request_mask & (STATX_CTIME | STATX_MTIME | STATX_SIZE | STATX_BLOCKS)) &&
23992399 !CIFS_CACHE_READ(CIFS_I(inode)) &&
24002400 inode->i_mapping && inode->i_mapping->nrpages != 0) {
24012401 rc = filemap_fdatawait(inode->i_mapping);
@@ -2585,6 +2585,14 @@ set_size_out: · 183 unmodified lines
25852585 if (rc == 0) {
25862586 cifsInode->server_eof = attrs->ia_size;
25872587 cifs_setsize(inode, attrs->ia_size);
2588+ /*
2589+ * i_blocks is not related to (i_size / i_blksize), but instead
2590+ * 512 byte (2**9) size is required for calculating num blocks.
2591+ * Until we can query the server for actual allocation size,
2592+ * this is best estimate we have for blocks allocated for a file
2593+ * Number of blocks must be rounded up so size 1 is not 0 blocks
2594+ */
2595+ inode->i_blocks = (512 - 1 + attrs->ia_size) >> 9;
25882596
25892597 /*
25902598 * The man page of truncate says if the size changed,
fs/cifs/sess.c+1−0
@@ -230,6 +230,7 @@ cifs_ses_add_channel(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses, · 229 unmodified lines
230230 ctx.noautotune = ses->server->noautotune;
231231 ctx.sockopt_tcp_nodelay = ses->server->tcp_nodelay;
232232 ctx.echo_interval = ses->server->echo_interval / HZ;
233+ ctx.max_credits = ses->server->max_credits;
233234
234235 /*
235236 * This will be used for encoding/decoding user/domain/pw
fs/cifs/smb2inode.c+1−0
@@ -358,6 +358,7 @@ smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon, · 357 unmodified lines
358358 if (cfile)
359359 goto after_close;
360360 /* Close */
361+ flags |= CIFS_CP_CREATE_CLOSE_OP;
361362 rqst[num_rqst].rq_iov = &vars->close_iov[0];
362363 rqst[num_rqst].rq_nvec = 1;
363364 rc = SMB2_close_init(tcon, server,
fs/cifs/smb2misc.c+5−5
@@ -767,7 +767,7 @@ smb2_cancelled_close_fid(struct work_struct *work) · 766 unmodified lines
767767 int rc;
768768
769769 if (cancelled->mid)
770− cifs_tcon_dbg(VFS, "Close unmatched open for MID:%llx\n",
770+ cifs_tcon_dbg(VFS, "Close unmatched open for MID:%llu\n",
771771 cancelled->mid);
772772 else
773773 cifs_tcon_dbg(VFS, "Close interrupted close\n");
@@ -844,14 +844,14 @@ smb2_handle_cancelled_close(struct cifs_tcon *tcon, __u64 persistent_fid, · 70 unmodified lines
844844 }
845845
846846 int
847−smb2_handle_cancelled_mid(char *buffer, struct TCP_Server_Info *server)
847+smb2_handle_cancelled_mid(struct mid_q_entry *mid, struct TCP_Server_Info *server)
848848 {
849− struct smb2_sync_hdr *sync_hdr = (struct smb2_sync_hdr *)buffer;
850− struct smb2_create_rsp *rsp = (struct smb2_create_rsp *)buffer;
849+ struct smb2_sync_hdr *sync_hdr = mid->resp_buf;
850+ struct smb2_create_rsp *rsp = mid->resp_buf;
851851 struct cifs_tcon *tcon;
852852 int rc;
853853
854− if (sync_hdr->Command != SMB2_CREATE ||
854+ if ((mid->optype & CIFS_CP_CREATE_CLOSE_OP) || sync_hdr->Command != SMB2_CREATE ||
855855 sync_hdr->Status != STATUS_SUCCESS)
856856 return 0;
857857
fs/cifs/smb2ops.c+5−5
@@ -1195,7 +1195,7 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon, · 1194 unmodified lines
11951195 struct TCP_Server_Info *server = cifs_pick_channel(ses);
11961196 __le16 *utf16_path = NULL;
11971197 int ea_name_len = strlen(ea_name);
1198− int flags = 0;
1198+ int flags = CIFS_CP_CREATE_CLOSE_OP;
11991199 int len;
12001200 struct smb_rqst rqst[3];
12011201 int resp_buftype[3];
@@ -1573,7 +1573,7 @@ smb2_ioctl_query_info(const unsigned int xid, · 371 unmodified lines
15731573 struct smb_query_info qi;
15741574 struct smb_query_info __user *pqi;
15751575 int rc = 0;
1576− int flags = 0;
1576+ int flags = CIFS_CP_CREATE_CLOSE_OP;
15771577 struct smb2_query_info_rsp *qi_rsp = NULL;
15781578 struct smb2_ioctl_rsp *io_rsp = NULL;
15791579 void *buffer = NULL;
@@ -2577,7 +2577,7 @@ smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon, · 997 unmodified lines
25772577 {
25782578 struct cifs_ses *ses = tcon->ses;
25792579 struct TCP_Server_Info *server = cifs_pick_channel(ses);
2580− int flags = 0;
2580+ int flags = CIFS_CP_CREATE_CLOSE_OP;
25812581 struct smb_rqst rqst[3];
25822582 int resp_buftype[3];
25832583 struct kvec rsp_iov[3];
@@ -2975,7 +2975,7 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon, · 391 unmodified lines
29752975 unsigned int sub_offset;
29762976 unsigned int print_len;
29772977 unsigned int print_offset;
2978− int flags = 0;
2978+ int flags = CIFS_CP_CREATE_CLOSE_OP;
29792979 struct smb_rqst rqst[3];
29802980 int resp_buftype[3];
29812981 struct kvec rsp_iov[3];
@@ -3157,7 +3157,7 @@ smb2_query_reparse_tag(const unsigned int xid, struct cifs_tcon *tcon, · 175 unmodified lines
31573157 struct cifs_open_parms oparms;
31583158 struct cifs_fid fid;
31593159 struct TCP_Server_Info *server = cifs_pick_channel(tcon->ses);
3160− int flags = 0;
3160+ int flags = CIFS_CP_CREATE_CLOSE_OP;
31613161 struct smb_rqst rqst[3];
31623162 int resp_buftype[3];
31633163 struct kvec rsp_iov[3];
fs/cifs/smb2pdu.c+2−4
@@ -4041,8 +4041,7 @@ smb2_async_readv(struct cifs_readdata *rdata) · 4040 unmodified lines
40414041 if (rdata->credits.value > 0) {
40424042 shdr->CreditCharge = cpu_to_le16(DIV_ROUND_UP(rdata->bytes,
40434043 SMB2_MAX_BUFFER_SIZE));
4044− shdr->CreditRequest =
4045− cpu_to_le16(le16_to_cpu(shdr->CreditCharge) + 1);
4044+ shdr->CreditRequest = cpu_to_le16(le16_to_cpu(shdr->CreditCharge) + 8);
40464045
40474046 rc = adjust_credits(server, &rdata->credits, rdata->bytes);
40484047 if (rc)
@@ -4348,8 +4347,7 @@ smb2_async_writev(struct cifs_writedata *wdata, · 299 unmodified lines
43484347 if (wdata->credits.value > 0) {
43494348 shdr->CreditCharge = cpu_to_le16(DIV_ROUND_UP(wdata->bytes,
43504349 SMB2_MAX_BUFFER_SIZE));
4351− shdr->CreditRequest =
4352− cpu_to_le16(le16_to_cpu(shdr->CreditCharge) + 1);
4350+ shdr->CreditRequest = cpu_to_le16(le16_to_cpu(shdr->CreditCharge) + 8);
43534351
43544352 rc = adjust_credits(server, &wdata->credits, wdata->bytes);
43554353 if (rc)
fs/cifs/smb2proto.h+1−2
@@ -246,8 +246,7 @@ extern int SMB2_oplock_break(const unsigned int xid, struct cifs_tcon *tcon, · 245 unmodified lines
246246 extern int smb2_handle_cancelled_close(struct cifs_tcon *tcon,
247247 __u64 persistent_fid,
248248 __u64 volatile_fid);
249−extern int smb2_handle_cancelled_mid(char *buffer,
250− struct TCP_Server_Info *server);
249+extern int smb2_handle_cancelled_mid(struct mid_q_entry *mid, struct TCP_Server_Info *server);
251250 void smb2_cancelled_close_fid(struct work_struct *work);
252251 extern int SMB2_QFS_info(const unsigned int xid, struct cifs_tcon *tcon,
253252 u64 persistent_file_id, u64 volatile_file_id,
fs/cifs/transport.c+8−3
@@ -101,7 +101,7 @@ static void _cifs_mid_q_entry_release(struct kref *refcount) · 100 unmodified lines
101101 if (midEntry->resp_buf && (midEntry->mid_flags & MID_WAIT_CANCELLED) &&
102102 midEntry->mid_state == MID_RESPONSE_RECEIVED &&
103103 server->ops->handle_cancelled_mid)
104− server->ops->handle_cancelled_mid(midEntry->resp_buf, server);
104+ server->ops->handle_cancelled_mid(midEntry, server);
105105
106106 midEntry->mid_state = MID_FREE;
107107 atomic_dec(&midCount);
@@ -1196,9 +1196,12 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, · 1088 unmodified lines
11961196 /*
11971197 * Compounding is never used during session establish.
11981198 */
1199− if ((ses->status == CifsNew) || (optype & CIFS_NEG_OP) || (optype & CIFS_SESS_OP))
1199+ if ((ses->status == CifsNew) || (optype & CIFS_NEG_OP) || (optype & CIFS_SESS_OP)) {
1200+ mutex_lock(&server->srv_mutex);
12001201 smb311_update_preauth_hash(ses, rqst[0].rq_iov,
12011202 rqst[0].rq_nvec);
1203+ mutex_unlock(&server->srv_mutex);
1204+ }
12021205
12031206 for (i = 0; i < num_rqst; i++) {
12041207 rc = wait_for_response(server, midQ[i]);
@@ -1207,7 +1210,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, · 2 unmodified lines
12071210 }
12081211 if (rc != 0) {
12091212 for (; i < num_rqst; i++) {
1210− cifs_server_dbg(VFS, "Cancelling wait for mid %llu cmd: %d\n",
1213+ cifs_server_dbg(FYI, "Cancelling wait for mid %llu cmd: %d\n",
12111214 midQ[i]->mid, le16_to_cpu(midQ[i]->command));
12121215 send_cancel(server, &rqst[i], midQ[i]);
12131216 spin_lock(&GlobalMid_Lock);
@@ -1266,7 +1269,9 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, · 52 unmodified lines
12661269 .iov_base = resp_iov[0].iov_base,
12671270 .iov_len = resp_iov[0].iov_len
12681271 };
1272+ mutex_lock(&server->srv_mutex);
12691273 smb311_update_preauth_hash(ses, &iov, 1);
1274+ mutex_unlock(&server->srv_mutex);
12701275 }
12711276
12721277 out:
fs/configfs/file.c+2−4
@@ -378,7 +378,7 @@ static int __configfs_open_file(struct inode *inode, struct file *file, int type · 377 unmodified lines
378378
379379 attr = to_attr(dentry);
380380 if (!attr)
381− goto out_put_item;
381+ goto out_free_buffer;
382382
383383 if (type & CONFIGFS_ITEM_BIN_ATTR) {
384384 buffer->bin_attr = to_bin_attr(dentry);
@@ -391,7 +391,7 @@ static int __configfs_open_file(struct inode *inode, struct file *file, int type · 6 unmodified lines
391391 /* Grab the module reference for this attribute if we have one */
392392 error = -ENODEV;
393393 if (!try_module_get(buffer->owner))
394− goto out_put_item;
394+ goto out_free_buffer;
395395
396396 error = -EACCES;
397397 if (!buffer->item->ci_type)
@@ -435,8 +435,6 @@ static int __configfs_open_file(struct inode *inode, struct file *file, int type · 37 unmodified lines
435435
436436 out_put_module:
437437 module_put(buffer->owner);
438−out_put_item:
439− config_item_put(buffer->item);
440438 out_free_buffer:
441439 up_read(&frag->frag_sem);
442440 kfree(buffer);
fs/crypto/bio.c+3−3
@@ -52,7 +52,7 @@ static int fscrypt_zeroout_range_inline_crypt(const struct inode *inode, · 51 unmodified lines
5252 int num_pages = 0;
5353
5454 /* This always succeeds since __GFP_DIRECT_RECLAIM is set. */
55− bio = bio_alloc(GFP_NOFS, BIO_MAX_PAGES);
55+ bio = bio_alloc(GFP_NOFS, BIO_MAX_VECS);
5656
5757 while (len) {
5858 unsigned int blocks_this_page = min(len, blocks_per_page);
@@ -74,7 +74,7 @@ static int fscrypt_zeroout_range_inline_crypt(const struct inode *inode, · 15 unmodified lines
7474 len -= blocks_this_page;
7575 lblk += blocks_this_page;
7676 pblk += blocks_this_page;
77− if (num_pages == BIO_MAX_PAGES || !len ||
77+ if (num_pages == BIO_MAX_VECS || !len ||
7878 !fscrypt_mergeable_bio(bio, inode, lblk)) {
7979 err = submit_bio_wait(bio);
8080 if (err)
@@ -126,7 +126,7 @@ int fscrypt_zeroout_range(const struct inode *inode, pgoff_t lblk, · 45 unmodified lines
126126 return fscrypt_zeroout_range_inline_crypt(inode, lblk, pblk,
127127 len);
128128
129− BUILD_BUG_ON(ARRAY_SIZE(pages) > BIO_MAX_PAGES);
129+ BUILD_BUG_ON(ARRAY_SIZE(pages) > BIO_MAX_VECS);
130130 nr_pages = min_t(unsigned int, ARRAY_SIZE(pages),
131131 (len + blocks_per_page - 1) >> blocks_per_page_bits);
132132
fs/erofs/data.c+11−17
@@ -129,6 +129,7 @@ static inline struct bio *erofs_read_raw_page(struct bio *bio, · 128 unmodified lines
129129 struct page *page,
130130 erofs_off_t *last_block,
131131 unsigned int nblocks,
132+ unsigned int *eblks,
132133 bool ra)
133134 {
134135 struct inode *const inode = mapping->host;
@@ -145,8 +146,7 @@ static inline struct bio *erofs_read_raw_page(struct bio *bio, · 10 unmodified lines
145146
146147 /* note that for readpage case, bio also equals to NULL */
147148 if (bio &&
148− /* not continuous */
149− *last_block + 1 != current_block) {
149+ (*last_block + 1 != current_block || !*eblks)) {
150150 submit_bio_retry:
151151 submit_bio(bio);
152152 bio = NULL;
@@ -216,7 +216,8 @@ submit_bio_retry: · 63 unmodified lines
216216 if (nblocks > DIV_ROUND_UP(map.m_plen, PAGE_SIZE))
217217 nblocks = DIV_ROUND_UP(map.m_plen, PAGE_SIZE);
218218
219− bio = bio_alloc(GFP_NOIO, bio_max_segs(nblocks));
219+ *eblks = bio_max_segs(nblocks);
220+ bio = bio_alloc(GFP_NOIO, *eblks);
220221
221222 bio->bi_end_io = erofs_readendio;
222223 bio_set_dev(bio, sb->s_bdev);
@@ -229,16 +230,8 @@ submit_bio_retry: · 6 unmodified lines
229230 /* out of the extent or bio is full */
230231 if (err < PAGE_SIZE)
231232 goto submit_bio_retry;
232−
233+ --*eblks;
233234 *last_block = current_block;
234−
235− /* shift in advance in case of it followed by too many gaps */
236− if (bio->bi_iter.bi_size >= bio->bi_max_vecs * PAGE_SIZE) {
237− /* err should reassign to 0 after submitting */
238− err = 0;
239− goto submit_bio_out;
240− }
241−
242235 return bio;
243236
244237 err_out:
@@ -252,7 +245,6 @@ has_updated: · 7 unmodified lines
252245
253246 /* if updated manually, continuous pages has a gap */
254247 if (bio)
255−submit_bio_out:
256248 submit_bio(bio);
257249 return err ? ERR_PTR(err) : NULL;
258250 }
@@ -264,23 +256,26 @@ submit_bio_out: · 5 unmodified lines
264256 static int erofs_raw_access_readpage(struct file *file, struct page *page)
265257 {
266258 erofs_off_t last_block;
259+ unsigned int eblks;
267260 struct bio *bio;
268261
269262 trace_erofs_readpage(page, true);
270263
271264 bio = erofs_read_raw_page(NULL, page->mapping,
272− page, &last_block, 1, false);
265+ page, &last_block, 1, &eblks, false);
273266
274267 if (IS_ERR(bio))
275268 return PTR_ERR(bio);
276269
277− DBG_BUGON(bio); /* since we have only one bio -- must be NULL */
270+ if (bio)
271+ submit_bio(bio);
278272 return 0;
279273 }
280274
281275 static void erofs_raw_access_readahead(struct readahead_control *rac)
282276 {
283277 erofs_off_t last_block;
278+ unsigned int eblks;
284279 struct bio *bio = NULL;
285280 struct page *page;
286281
@@ -291,7 +286,7 @@ static void erofs_raw_access_readahead(struct readahead_control *rac) · 4 unmodified lines
291286 prefetchw(&page->flags);
292287
293288 bio = erofs_read_raw_page(bio, rac->mapping, page, &last_block,
294− readahead_count(rac), true);
289+ readahead_count(rac), &eblks, true);
295290
296291 /* all the page errors are ignored when readahead */
297292 if (IS_ERR(bio)) {
@@ -305,7 +300,6 @@ static void erofs_raw_access_readahead(struct readahead_control *rac) · 7 unmodified lines
305300 put_page(page);
306301 }
307302
308− /* the rare case (end in gaps) */
309303 if (bio)
310304 submit_bio(bio);
311305 }
fs/erofs/zdata.c+1−1
@@ -1235,7 +1235,7 @@ submit_bio_retry: · 1234 unmodified lines
12351235 }
12361236
12371237 if (!bio) {
1238− bio = bio_alloc(GFP_NOIO, BIO_MAX_PAGES);
1238+ bio = bio_alloc(GFP_NOIO, BIO_MAX_VECS);
12391239
12401240 bio->bi_end_io = z_erofs_decompressqueue_endio;
12411241 bio_set_dev(bio, sb->s_bdev);
fs/ext4/balloc.c+26−12
@@ -626,27 +626,41 @@ int ext4_claim_free_clusters(struct ext4_sb_info *sbi, · 625 unmodified lines
626626
627627 /**
628628 * ext4_should_retry_alloc() - check if a block allocation should be retried
629− * @sb: super block
630− * @retries: number of attemps has been made
629+ * @sb: superblock
630+ * @retries: number of retry attempts made so far
631631 *
632− * ext4_should_retry_alloc() is called when ENOSPC is returned, and if
633− * it is profitable to retry the operation, this function will wait
634− * for the current or committing transaction to complete, and then
635− * return TRUE. We will only retry once.
632+ * ext4_should_retry_alloc() is called when ENOSPC is returned while
633+ * attempting to allocate blocks. If there's an indication that a pending
634+ * journal transaction might free some space and allow another attempt to
635+ * succeed, this function will wait for the current or committing transaction
636+ * to complete and then return TRUE.
636637 */
637638 int ext4_should_retry_alloc(struct super_block *sb, int *retries)
638639 {
639− if (!ext4_has_free_clusters(EXT4_SB(sb), 1, 0) ||
640− (*retries)++ > 1 ||
641− !EXT4_SB(sb)->s_journal)
640+ struct ext4_sb_info *sbi = EXT4_SB(sb);
641+
642+ if (!sbi->s_journal)
642643 return 0;
643644
644− smp_mb();
645− if (EXT4_SB(sb)->s_mb_free_pending == 0)
645+ if (++(*retries) > 3) {
646+ percpu_counter_inc(&sbi->s_sra_exceeded_retry_limit);
646647 return 0;
648+ }
647649
650+ /*
651+ * if there's no indication that blocks are about to be freed it's
652+ * possible we just missed a transaction commit that did so
653+ */
654+ smp_mb();
655+ if (sbi->s_mb_free_pending == 0)
656+ return ext4_has_free_clusters(sbi, 1, 0);
657+
658+ /*
659+ * it's possible we've just missed a transaction commit here,
660+ * so ignore the returned status
661+ */
648662 jbd_debug(1, "%s: retrying operation after ENOSPC\n", sb->s_id);
649− jbd2_journal_force_commit_nested(EXT4_SB(sb)->s_journal);
663+ (void) jbd2_journal_force_commit_nested(sbi->s_journal);
650664 return 1;
651665 }
652666
fs/ext4/ext4.h+3−0
@@ -1484,6 +1484,7 @@ struct ext4_sb_info { · 1483 unmodified lines
14841484 struct percpu_counter s_freeinodes_counter;
14851485 struct percpu_counter s_dirs_counter;
14861486 struct percpu_counter s_dirtyclusters_counter;
1487+ struct percpu_counter s_sra_exceeded_retry_limit;
14871488 struct blockgroup_lock *s_blockgroup_lock;
14881489 struct proc_dir_entry *s_proc;
14891490 struct kobject s_kobj;
@@ -2793,6 +2794,8 @@ void __ext4_fc_track_link(handle_t *handle, struct inode *inode, · 1303 unmodified lines
27932794 struct dentry *dentry);
27942795 void ext4_fc_track_unlink(handle_t *handle, struct dentry *dentry);
27952796 void ext4_fc_track_link(handle_t *handle, struct dentry *dentry);
2797+void __ext4_fc_track_create(handle_t *handle, struct inode *inode,
2798+ struct dentry *dentry);
27962799 void ext4_fc_track_create(handle_t *handle, struct dentry *dentry);
27972800 void ext4_fc_track_inode(handle_t *handle, struct inode *inode);
27982801 void ext4_fc_mark_ineligible(struct super_block *sb, int reason);
fs/ext4/extents.c+1−1
@@ -4382,7 +4382,7 @@ static int ext4_alloc_file_blocks(struct file *file, ext4_lblk_t offset, · 4381 unmodified lines
43824382 {
43834383 struct inode *inode = file_inode(file);
43844384 handle_t *handle;
4385− int ret, ret2 = 0, ret3 = 0;
4385+ int ret = 0, ret2 = 0, ret3 = 0;
43864386 int retries = 0;
43874387 int depth = 0;
43884388 struct ext4_map_blocks map;
fs/ext4/fast_commit.c+7−2
@@ -513,10 +513,10 @@ void ext4_fc_track_link(handle_t *handle, struct dentry *dentry) · 512 unmodified lines
513513 __ext4_fc_track_link(handle, d_inode(dentry), dentry);
514514 }
515515
516−void ext4_fc_track_create(handle_t *handle, struct dentry *dentry)
516+void __ext4_fc_track_create(handle_t *handle, struct inode *inode,
517+ struct dentry *dentry)
517518 {
518519 struct __track_dentry_update_args args;
519− struct inode *inode = d_inode(dentry);
520520 int ret;
521521
522522 args.dentry = dentry;
@@ -527,6 +527,11 @@ void ext4_fc_track_create(handle_t *handle, struct dentry *dentry) · 4 unmodified lines
527527 trace_ext4_fc_track_create(inode, dentry, ret);
528528 }
529529
530+void ext4_fc_track_create(handle_t *handle, struct dentry *dentry)
531+{
532+ __ext4_fc_track_create(handle, d_inode(dentry), dentry);
533+}
534+
530535 /* __track_fn for inode tracking */
531536 static int __track_inode(struct inode *inode, void *arg, bool update)
532537 {
fs/ext4/inode.c+10−8
@@ -1938,13 +1938,13 @@ static int __ext4_journalled_writepage(struct page *page, · 1937 unmodified lines
19381938 if (!ret)
19391939 ret = err;
19401940
1941− if (!ext4_has_inline_data(inode))
1942− ext4_walk_page_buffers(NULL, page_bufs, 0, len,
1943− NULL, bput_one);
19441941 ext4_set_inode_state(inode, EXT4_STATE_JDATA);
19451942 out:
19461943 unlock_page(page);
19471944 out_no_pagelock:
1945+ if (!inline_data && page_bufs)
1946+ ext4_walk_page_buffers(NULL, page_bufs, 0, len,
1947+ NULL, bput_one);
19481948 brelse(inode_bh);
19491949 return ret;
19501950 }
@@ -5026,7 +5026,7 @@ static int ext4_do_update_inode(handle_t *handle, · 3075 unmodified lines
50265026 struct ext4_inode_info *ei = EXT4_I(inode);
50275027 struct buffer_head *bh = iloc->bh;
50285028 struct super_block *sb = inode->i_sb;
5029− int err = 0, rc, block;
5029+ int err = 0, block;
50305030 int need_datasync = 0, set_large_file = 0;
50315031 uid_t i_uid;
50325032 gid_t i_gid;
@@ -5138,9 +5138,9 @@ static int ext4_do_update_inode(handle_t *handle, · 105 unmodified lines
51385138 bh->b_data);
51395139
51405140 BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata");
5141− rc = ext4_handle_dirty_metadata(handle, NULL, bh);
5142− if (!err)
5143− err = rc;
5141+ err = ext4_handle_dirty_metadata(handle, NULL, bh);
5142+ if (err)
5143+ goto out_brelse;
51445144 ext4_clear_inode_state(inode, EXT4_STATE_NEW);
51455145 if (set_large_file) {
51465146 BUFFER_TRACE(EXT4_SB(sb)->s_sbh, "get write access");
@@ -5387,8 +5387,10 @@ int ext4_setattr(struct user_namespace *mnt_userns, struct dentry *dentry, · 240 unmodified lines
53875387 inode->i_gid = attr->ia_gid;
53885388 error = ext4_mark_inode_dirty(handle, inode);
53895389 ext4_journal_stop(handle);
5390− if (unlikely(error))
5390+ if (unlikely(error)) {
5391+ ext4_fc_stop_update(inode);
53915392 return error;
5393+ }
53925394 }
53935395
53945396 if (attr->ia_valid & ATTR_SIZE) {
fs/ext4/mballoc.c+9−2
@@ -2709,8 +2709,15 @@ static int ext4_mb_init_backend(struct super_block *sb) · 2708 unmodified lines
27092709 }
27102710
27112711 if (ext4_has_feature_flex_bg(sb)) {
2712− /* a single flex group is supposed to be read by a single IO */
2713− sbi->s_mb_prefetch = min(1 << sbi->s_es->s_log_groups_per_flex,
2712+ /* a single flex group is supposed to be read by a single IO.
2713+ * 2 ^ s_log_groups_per_flex != UINT_MAX as s_mb_prefetch is
2714+ * unsigned integer, so the maximum shift is 32.
2715+ */
2716+ if (sbi->s_es->s_log_groups_per_flex >= 32) {
2717+ ext4_msg(sb, KERN_ERR, "too many log groups per flexible block group");
2718+ goto err_freesgi;
2719+ }
2720+ sbi->s_mb_prefetch = min_t(uint, 1 << sbi->s_es->s_log_groups_per_flex,
27142721 BLK_MAX_SEGMENT_SIZE >> (sb->s_blocksize_bits - 9));
27152722 sbi->s_mb_prefetch *= 8; /* 8 prefetch IOs in flight at most */
27162723 } else {
fs/ext4/namei.c+39−11
@@ -3613,6 +3613,31 @@ static int ext4_setent(handle_t *handle, struct ext4_renament *ent, · 3612 unmodified lines
36133613 return retval;
36143614 }
36153615
3616+static void ext4_resetent(handle_t *handle, struct ext4_renament *ent,
3617+ unsigned ino, unsigned file_type)
3618+{
3619+ struct ext4_renament old = *ent;
3620+ int retval = 0;
3621+
3622+ /*
3623+ * old->de could have moved from under us during make indexed dir,
3624+ * so the old->de may no longer valid and need to find it again
3625+ * before reset old inode info.
3626+ */
3627+ old.bh = ext4_find_entry(old.dir, &old.dentry->d_name, &old.de, NULL);
3628+ if (IS_ERR(old.bh))
3629+ retval = PTR_ERR(old.bh);
3630+ if (!old.bh)
3631+ retval = -ENOENT;
3632+ if (retval) {
3633+ ext4_std_error(old.dir->i_sb, retval);
3634+ return;
3635+ }
3636+
3637+ ext4_setent(handle, &old, ino, file_type);
3638+ brelse(old.bh);
3639+}
3640+
36163641 static int ext4_find_delete_entry(handle_t *handle, struct inode *dir,
36173642 const struct qstr *d_name)
36183643 {
@@ -3774,14 +3799,14 @@ static int ext4_rename(struct user_namespace *mnt_userns, struct inode *old_dir, · 155 unmodified lines
37743799 */
37753800 retval = -ENOENT;
37763801 if (!old.bh || le32_to_cpu(old.de->inode) != old.inode->i_ino)
3777− goto end_rename;
3802+ goto release_bh;
37783803
37793804 new.bh = ext4_find_entry(new.dir, &new.dentry->d_name,
37803805 &new.de, &new.inlined);
37813806 if (IS_ERR(new.bh)) {
37823807 retval = PTR_ERR(new.bh);
37833808 new.bh = NULL;
3784− goto end_rename;
3809+ goto release_bh;
37853810 }
37863811 if (new.bh) {
37873812 if (!new.inode) {
@@ -3798,15 +3823,13 @@ static int ext4_rename(struct user_namespace *mnt_userns, struct inode *old_dir, · 10 unmodified lines
37983823 handle = ext4_journal_start(old.dir, EXT4_HT_DIR, credits);
37993824 if (IS_ERR(handle)) {
38003825 retval = PTR_ERR(handle);
3801− handle = NULL;
3802− goto end_rename;
3826+ goto release_bh;
38033827 }
38043828 } else {
38053829 whiteout = ext4_whiteout_for_rename(mnt_userns, &old, credits, &handle);
38063830 if (IS_ERR(whiteout)) {
38073831 retval = PTR_ERR(whiteout);
3808− whiteout = NULL;
3809− goto end_rename;
3832+ goto release_bh;
38103833 }
38113834 }
38123835
@@ -3850,6 +3873,7 @@ static int ext4_rename(struct user_namespace *mnt_userns, struct inode *old_dir, · 37 unmodified lines
38503873 retval = ext4_mark_inode_dirty(handle, whiteout);
38513874 if (unlikely(retval))
38523875 goto end_rename;
3876+
38533877 }
38543878 if (!new.bh) {
38553879 retval = ext4_add_entry(handle, new.dentry, old.inode);
@@ -3923,6 +3947,8 @@ static int ext4_rename(struct user_namespace *mnt_userns, struct inode *old_dir, · 67 unmodified lines
39233947 ext4_fc_track_unlink(handle, new.dentry);
39243948 __ext4_fc_track_link(handle, old.inode, new.dentry);
39253949 __ext4_fc_track_unlink(handle, old.inode, old.dentry);
3950+ if (whiteout)
3951+ __ext4_fc_track_create(handle, whiteout, old.dentry);
39263952 }
39273953
39283954 if (new.inode) {
@@ -3937,19 +3963,21 @@ static int ext4_rename(struct user_namespace *mnt_userns, struct inode *old_dir, · 8 unmodified lines
39373963 end_rename:
39383964 if (whiteout) {
39393965 if (retval) {
3940− ext4_setent(handle, &old,
3941− old.inode->i_ino, old_file_type);
3966+ ext4_resetent(handle, &old,
3967+ old.inode->i_ino, old_file_type);
39423968 drop_nlink(whiteout);
3969+ ext4_orphan_add(handle, whiteout);
39433970 }
39443971 unlock_new_inode(whiteout);
3972+ ext4_journal_stop(handle);
39453973 iput(whiteout);
3946−
3974+ } else {
3975+ ext4_journal_stop(handle);
39473976 }
3977+release_bh:
39483978 brelse(old.dir_bh);
39493979 brelse(old.bh);
39503980 brelse(new.bh);
3951− if (handle)
3952− ext4_journal_stop(handle);
39533981 return retval;
39543982 }
39553983
fs/ext4/page-io.c+1−1
@@ -398,7 +398,7 @@ static void io_submit_init_bio(struct ext4_io_submit *io, · 397 unmodified lines
398398 * bio_alloc will _always_ be able to allocate a bio if
399399 * __GFP_DIRECT_RECLAIM is set, see comments for bio_alloc_bioset().
400400 */
401− bio = bio_alloc(GFP_NOIO, BIO_MAX_PAGES);
401+ bio = bio_alloc(GFP_NOIO, BIO_MAX_VECS);
402402 fscrypt_set_bio_crypt_ctx_bh(bio, bh, GFP_NOIO);
403403 bio->bi_iter.bi_sector = bh->b_blocknr * (bh->b_size >> 9);
404404 bio_set_dev(bio, bh->b_bdev);
fs/ext4/super.c+6−1
@@ -1210,6 +1210,7 @@ static void ext4_put_super(struct super_block *sb) · 1209 unmodified lines
12101210 percpu_counter_destroy(&sbi->s_freeinodes_counter);
12111211 percpu_counter_destroy(&sbi->s_dirs_counter);
12121212 percpu_counter_destroy(&sbi->s_dirtyclusters_counter);
1213+ percpu_counter_destroy(&sbi->s_sra_exceeded_retry_limit);
12131214 percpu_free_rwsem(&sbi->s_writepages_rwsem);
12141215 #ifdef CONFIG_QUOTA
12151216 for (i = 0; i < EXT4_MAXQUOTAS; i++)
@@ -5011,6 +5012,9 @@ no_journal: · 3795 unmodified lines
50115012 if (!err)
50125013 err = percpu_counter_init(&sbi->s_dirtyclusters_counter, 0,
50135014 GFP_KERNEL);
5015+ if (!err)
5016+ err = percpu_counter_init(&sbi->s_sra_exceeded_retry_limit, 0,
5017+ GFP_KERNEL);
50145018 if (!err)
50155019 err = percpu_init_rwsem(&sbi->s_writepages_rwsem);
50165020
@@ -5124,6 +5128,7 @@ failed_mount6: · 107 unmodified lines
51245128 percpu_counter_destroy(&sbi->s_freeinodes_counter);
51255129 percpu_counter_destroy(&sbi->s_dirs_counter);
51265130 percpu_counter_destroy(&sbi->s_dirtyclusters_counter);
5131+ percpu_counter_destroy(&sbi->s_sra_exceeded_retry_limit);
51275132 percpu_free_rwsem(&sbi->s_writepages_rwsem);
51285133 failed_mount5:
51295134 ext4_ext_release(sb);
@@ -5149,8 +5154,8 @@ failed_mount_wq: · 19 unmodified lines
51495154 failed_mount3a:
51505155 ext4_es_unregister_shrinker(sbi);
51515156 failed_mount3:
5152− del_timer_sync(&sbi->s_err_report);
51535157 flush_work(&sbi->s_error_work);
5158+ del_timer_sync(&sbi->s_err_report);
51545159 if (sbi->s_mmp_tsk)
51555160 kthread_stop(sbi->s_mmp_tsk);
51565161 failed_mount2:
fs/ext4/sysfs.c+7−0
@@ -24,6 +24,7 @@ typedef enum { · 23 unmodified lines
2424 attr_session_write_kbytes,
2525 attr_lifetime_write_kbytes,
2626 attr_reserved_clusters,
27+ attr_sra_exceeded_retry_limit,
2728 attr_inode_readahead,
2829 attr_trigger_test_error,
2930 attr_first_error_time,
@@ -202,6 +203,7 @@ EXT4_ATTR_FUNC(delayed_allocation_blocks, 0444); · 172 unmodified lines
202203 EXT4_ATTR_FUNC(session_write_kbytes, 0444);
203204 EXT4_ATTR_FUNC(lifetime_write_kbytes, 0444);
204205 EXT4_ATTR_FUNC(reserved_clusters, 0644);
206+EXT4_ATTR_FUNC(sra_exceeded_retry_limit, 0444);
205207
206208 EXT4_ATTR_OFFSET(inode_readahead_blks, 0644, inode_readahead,
207209 ext4_sb_info, s_inode_readahead_blks);
@@ -251,6 +253,7 @@ static struct attribute *ext4_attrs[] = { · 43 unmodified lines
251253 ATTR_LIST(session_write_kbytes),
252254 ATTR_LIST(lifetime_write_kbytes),
253255 ATTR_LIST(reserved_clusters),
256+ ATTR_LIST(sra_exceeded_retry_limit),
254257 ATTR_LIST(inode_readahead_blks),
255258 ATTR_LIST(inode_goal),
256259 ATTR_LIST(mb_stats),
@@ -374,6 +377,10 @@ static ssize_t ext4_attr_show(struct kobject *kobj, · 117 unmodified lines
374377 return snprintf(buf, PAGE_SIZE, "%llu\n",
375378 (unsigned long long)
376379 atomic64_read(&sbi->s_resv_clusters));
380+ case attr_sra_exceeded_retry_limit:
381+ return snprintf(buf, PAGE_SIZE, "%llu\n",
382+ (unsigned long long)
383+ percpu_counter_sum(&sbi->s_sra_exceeded_retry_limit));
377384 case attr_inode_readahead:
378385 case attr_pointer_ui:
379386 if (!ptr)
fs/ext4/verity.c+55−34
@@ -201,55 +201,76 @@ static int ext4_end_enable_verity(struct file *filp, const void *desc, · 200 unmodified lines
201201 struct inode *inode = file_inode(filp);
202202 const int credits = 2; /* superblock and inode for ext4_orphan_del() */
203203 handle_t *handle;
204+ struct ext4_iloc iloc;
204205 int err = 0;
205− int err2;
206206
207− if (desc != NULL) {
208− /* Succeeded; write the verity descriptor. */
209− err = ext4_write_verity_descriptor(inode, desc, desc_size,
210− merkle_tree_size);
211−
212− /* Write all pages before clearing VERITY_IN_PROGRESS. */
213− if (!err)
214− err = filemap_write_and_wait(inode->i_mapping);
215− }
207+ /*
208+ * If an error already occurred (which fs/verity/ signals by passing
209+ * desc == NULL), then only clean-up is needed.
210+ */
211+ if (desc == NULL)
212+ goto cleanup;
216213
217− /* If we failed, truncate anything we wrote past i_size. */
218− if (desc == NULL || err)
219− ext4_truncate(inode);
214+ /* Append the verity descriptor. */
215+ err = ext4_write_verity_descriptor(inode, desc, desc_size,
216+ merkle_tree_size);
217+ if (err)
218+ goto cleanup;
220219
221220 /*
222− * We must always clean up by clearing EXT4_STATE_VERITY_IN_PROGRESS and
223− * deleting the inode from the orphan list, even if something failed.
224− * If everything succeeded, we'll also set the verity bit in the same
225− * transaction.
221+ * Write all pages (both data and verity metadata). Note that this must
222+ * happen before clearing EXT4_STATE_VERITY_IN_PROGRESS; otherwise pages
223+ * beyond i_size won't be written properly. For crash consistency, this
224+ * also must happen before the verity inode flag gets persisted.
226225 */
226+ err = filemap_write_and_wait(inode->i_mapping);
227+ if (err)
228+ goto cleanup;
227229
228− ext4_clear_inode_state(inode, EXT4_STATE_VERITY_IN_PROGRESS);
230+ /*
231+ * Finally, set the verity inode flag and remove the inode from the
232+ * orphan list (in a single transaction).
233+ */
229234
230235 handle = ext4_journal_start(inode, EXT4_HT_INODE, credits);
231236 if (IS_ERR(handle)) {
232− ext4_orphan_del(NULL, inode);
233− return PTR_ERR(handle);
237+ err = PTR_ERR(handle);
238+ goto cleanup;
234239 }
235240
236− err2 = ext4_orphan_del(handle, inode);
237− if (err2)
238− goto out_stop;
241+ err = ext4_orphan_del(handle, inode);
242+ if (err)
243+ goto stop_and_cleanup;
239244
240− if (desc != NULL && !err) {
241− struct ext4_iloc iloc;
245+ err = ext4_reserve_inode_write(handle, inode, &iloc);
246+ if (err)
247+ goto stop_and_cleanup;
242248
243− err = ext4_reserve_inode_write(handle, inode, &iloc);
244− if (err)
245− goto out_stop;
246− ext4_set_inode_flag(inode, EXT4_INODE_VERITY);
247− ext4_set_inode_flags(inode, false);
248− err = ext4_mark_iloc_dirty(handle, inode, &iloc);
249− }
250−out_stop:
249+ ext4_set_inode_flag(inode, EXT4_INODE_VERITY);
250+ ext4_set_inode_flags(inode, false);
251+ err = ext4_mark_iloc_dirty(handle, inode, &iloc);
252+ if (err)
253+ goto stop_and_cleanup;
254+
255+ ext4_journal_stop(handle);
256+
257+ ext4_clear_inode_state(inode, EXT4_STATE_VERITY_IN_PROGRESS);
258+ return 0;
259+
260+stop_and_cleanup:
251261 ext4_journal_stop(handle);
252− return err ?: err2;
262+cleanup:
263+ /*
264+ * Verity failed to be enabled, so clean up by truncating any verity
265+ * metadata that was written beyond i_size (both from cache and from
266+ * disk), removing the inode from the orphan list (if it wasn't done
267+ * already), and clearing EXT4_STATE_VERITY_IN_PROGRESS.
268+ */
269+ truncate_inode_pages(inode->i_mapping, inode->i_size);
270+ ext4_truncate(inode);
271+ ext4_orphan_del(NULL, inode);
272+ ext4_clear_inode_state(inode, EXT4_STATE_VERITY_IN_PROGRESS);
273+ return err;
253274 }
254275
255276 static int ext4_get_verity_descriptor_location(struct inode *inode,
fs/ext4/xattr.c+5−1
@@ -1462,6 +1462,9 @@ ext4_xattr_inode_cache_find(struct inode *inode, const void *value, · 1461 unmodified lines
14621462 if (!ce)
14631463 return NULL;
14641464
1465+ WARN_ON_ONCE(ext4_handle_valid(journal_current_handle()) &&
1466+ !(current->flags & PF_MEMALLOC_NOFS));
1467+
14651468 ea_data = kvmalloc(value_len, GFP_KERNEL);
14661469 if (!ea_data) {
14671470 mb_cache_entry_put(ea_inode_cache, ce);
@@ -2327,6 +2330,7 @@ ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index, · 859 unmodified lines
23272330 error = -ENOSPC;
23282331 goto cleanup;
23292332 }
2333+ WARN_ON_ONCE(!(current->flags & PF_MEMALLOC_NOFS));
23302334 }
23312335
23322336 error = ext4_reserve_inode_write(handle, inode, &is.iloc);
@@ -2400,7 +2404,7 @@ retry_inode: · 67 unmodified lines
24002404 * external inode if possible.
24012405 */
24022406 if (ext4_has_feature_ea_inode(inode->i_sb) &&
2403− !i.in_inode) {
2407+ i.value_len && !i.in_inode) {
24042408 i.in_inode = 1;
24052409 goto retry_inode;
24062410 }
fs/f2fs/checkpoint.c+1−1
@@ -292,7 +292,7 @@ void f2fs_ra_meta_pages_cond(struct f2fs_sb_info *sbi, pgoff_t index) · 291 unmodified lines
292292 f2fs_put_page(page, 0);
293293
294294 if (readahead)
295− f2fs_ra_meta_pages(sbi, index, BIO_MAX_PAGES, META_POR, true);
295+ f2fs_ra_meta_pages(sbi, index, BIO_MAX_VECS, META_POR, true);
296296 }
297297
298298 static int __f2fs_write_meta_page(struct page *page,
fs/f2fs/data.c+2−2
@@ -857,7 +857,7 @@ int f2fs_merge_page_bio(struct f2fs_io_info *fio) · 856 unmodified lines
857857 f2fs_submit_merged_ipu_write(fio->sbi, &bio, NULL);
858858 alloc_new:
859859 if (!bio) {
860− bio = __bio_alloc(fio, BIO_MAX_PAGES);
860+ bio = __bio_alloc(fio, BIO_MAX_VECS);
861861 __attach_io_flag(fio);
862862 f2fs_set_bio_crypt_ctx(bio, fio->page->mapping->host,
863863 fio->page->index, fio, GFP_NOIO);
@@ -932,7 +932,7 @@ alloc_new: · 68 unmodified lines
932932 fio->retry = true;
933933 goto skip;
934934 }
935− io->bio = __bio_alloc(fio, BIO_MAX_PAGES);
935+ io->bio = __bio_alloc(fio, BIO_MAX_VECS);
936936 f2fs_set_bio_crypt_ctx(io->bio, fio->page->mapping->host,
937937 bio_page->index, fio, GFP_NOIO);
938938 io->fio = *fio;
fs/f2fs/segment.c+1−1
@@ -4381,7 +4381,7 @@ static int build_sit_entries(struct f2fs_sb_info *sbi) · 4380 unmodified lines
43814381 block_t total_node_blocks = 0;
43824382
43834383 do {
4384− readed = f2fs_ra_meta_pages(sbi, start_blk, BIO_MAX_PAGES,
4384+ readed = f2fs_ra_meta_pages(sbi, start_blk, BIO_MAX_VECS,
43854385 META_SIT, true);
43864386
43874387 start = start_blk * sit_i->sents_per_block;
fs/f2fs/segment.h+2−2
@@ -851,7 +851,7 @@ static inline int nr_pages_to_skip(struct f2fs_sb_info *sbi, int type) · 850 unmodified lines
851851 else if (type == NODE)
852852 return 8 * sbi->blocks_per_seg;
853853 else if (type == META)
854− return 8 * BIO_MAX_PAGES;
854+ return 8 * BIO_MAX_VECS;
855855 else
856856 return 0;
857857 }
@@ -868,7 +868,7 @@ static inline long nr_pages_to_write(struct f2fs_sb_info *sbi, int type, · 10 unmodified lines
868868 return 0;
869869
870870 nr_to_write = wbc->nr_to_write;
871− desired = BIO_MAX_PAGES;
871+ desired = BIO_MAX_VECS;
872872 if (type == NODE)
873873 desired <<= 1;
874874
fs/f2fs/super.c+2−2
@@ -753,9 +753,9 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount) · 752 unmodified lines
753753 case Opt_io_size_bits:
754754 if (args->from && match_int(args, &arg))
755755 return -EINVAL;
756− if (arg <= 0 || arg > __ilog2_u32(BIO_MAX_PAGES)) {
756+ if (arg <= 0 || arg > __ilog2_u32(BIO_MAX_VECS)) {
757757 f2fs_warn(sbi, "Not support %d, larger than %d",
758− 1 << arg, BIO_MAX_PAGES);
758+ 1 << arg, BIO_MAX_VECS);
759759 return -EINVAL;
760760 }
761761 F2FS_OPTION(sbi).write_io_size_bits = arg;
fs/fuse/dev.c+16−10
@@ -2229,19 +2229,21 @@ static int fuse_device_clone(struct fuse_conn *fc, struct file *new) · 2228 unmodified lines
22292229 static long fuse_dev_ioctl(struct file *file, unsigned int cmd,
22302230 unsigned long arg)
22312231 {
2232− int err = -ENOTTY;
2232+ int res;
2233+ int oldfd;
2234+ struct fuse_dev *fud = NULL;
22332235
2234− if (cmd == FUSE_DEV_IOC_CLONE) {
2235− int oldfd;
2236+ if (_IOC_TYPE(cmd) != FUSE_DEV_IOC_MAGIC)
2237+ return -ENOTTY;
22362238
2237− err = -EFAULT;
2238− if (!get_user(oldfd, (__u32 __user *) arg)) {
2239+ switch (_IOC_NR(cmd)) {
2240+ case _IOC_NR(FUSE_DEV_IOC_CLONE):
2241+ res = -EFAULT;
2242+ if (!get_user(oldfd, (__u32 __user *)arg)) {
22392243 struct file *old = fget(oldfd);
22402244
2241− err = -EINVAL;
2245+ res = -EINVAL;
22422246 if (old) {
2243− struct fuse_dev *fud = NULL;
2244−
22452247 /*
22462248 * Check against file->f_op because CUSE
22472249 * uses the same ioctl handler.
@@ -2252,14 +2254,18 @@ static long fuse_dev_ioctl(struct file *file, unsigned int cmd, · 4 unmodified lines
22522254
22532255 if (fud) {
22542256 mutex_lock(&fuse_mutex);
2255− err = fuse_device_clone(fud->fc, file);
2257+ res = fuse_device_clone(fud->fc, file);
22562258 mutex_unlock(&fuse_mutex);
22572259 }
22582260 fput(old);
22592261 }
22602262 }
2263+ break;
2264+ default:
2265+ res = -ENOTTY;
2266+ break;
22612267 }
2262− return err;
2268+ return res;
22632269 }
22642270
22652271 const struct file_operations fuse_dev_operations = {
fs/fuse/fuse_i.h+1−0
@@ -863,6 +863,7 @@ static inline u64 fuse_get_attr_version(struct fuse_conn *fc) · 862 unmodified lines
863863
864864 static inline void fuse_make_bad(struct inode *inode)
865865 {
866+ remove_inode_hash(inode);
866867 set_bit(FUSE_I_BAD, &get_fuse_inode(inode)->state);
867868 }
868869
fs/fuse/virtio_fs.c+8−1
@@ -1324,8 +1324,15 @@ static int virtio_fs_fill_super(struct super_block *sb, struct fs_context *fsc) · 1323 unmodified lines
13241324
13251325 /* virtiofs allocates and installs its own fuse devices */
13261326 ctx->fudptr = NULL;
1327− if (ctx->dax)
1327+ if (ctx->dax) {
1328+ if (!fs->dax_dev) {
1329+ err = -EINVAL;
1330+ pr_err("virtio-fs: dax can't be enabled as filesystem"
1331+ " device does not support it.\n");
1332+ goto err_free_fuse_devs;
1333+ }
13281334 ctx->dax_dev = fs->dax_dev;
1335+ }
13291336 err = fuse_fill_super_common(sb, ctx);
13301337 if (err < 0)
13311338 goto err_free_fuse_devs;
fs/gfs2/log.c+5−1
@@ -998,12 +998,16 @@ static void trans_drain(struct gfs2_trans *tr) · 997 unmodified lines
998998 while (!list_empty(head)) {
999999 bd = list_first_entry(head, struct gfs2_bufdata, bd_list);
10001000 list_del_init(&bd->bd_list);
1001+ if (!list_empty(&bd->bd_ail_st_list))
1002+ gfs2_remove_from_ail(bd);
10011003 kmem_cache_free(gfs2_bufdata_cachep, bd);
10021004 }
10031005 head = &tr->tr_databuf;
10041006 while (!list_empty(head)) {
10051007 bd = list_first_entry(head, struct gfs2_bufdata, bd_list);
10061008 list_del_init(&bd->bd_list);
1009+ if (!list_empty(&bd->bd_ail_st_list))
1010+ gfs2_remove_from_ail(bd);
10071011 kmem_cache_free(gfs2_bufdata_cachep, bd);
10081012 }
10091013 }
@@ -1032,7 +1036,7 @@ repeat: · 22 unmodified lines
10321036 * Do this check while holding the log_flush_lock to prevent new
10331037 * buffers from being added to the ail via gfs2_pin()
10341038 */
1035− if (gfs2_withdrawn(sdp))
1039+ if (gfs2_withdrawn(sdp) || !test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags))
10361040 goto out;
10371041
10381042 /* Log might have been flushed while we waited for the flush lock */
fs/gfs2/lops.c+1−1
@@ -267,7 +267,7 @@ static struct bio *gfs2_log_alloc_bio(struct gfs2_sbd *sdp, u64 blkno, · 266 unmodified lines
267267 bio_end_io_t *end_io)
268268 {
269269 struct super_block *sb = sdp->sd_vfs;
270− struct bio *bio = bio_alloc(GFP_NOIO, BIO_MAX_PAGES);
270+ struct bio *bio = bio_alloc(GFP_NOIO, BIO_MAX_VECS);
271271
272272 bio->bi_iter.bi_sector = blkno << sdp->sd_fsb2bb_shift;
273273 bio_set_dev(bio, sb->s_bdev);
fs/gfs2/ops_fstype.c+1−3
@@ -1539,9 +1539,7 @@ static int gfs2_reconfigure(struct fs_context *fc) · 1538 unmodified lines
15391539 return -EINVAL;
15401540
15411541 if (fc->sb_flags & SB_RDONLY) {
1542− error = gfs2_make_fs_ro(sdp);
1543− if (error)
1544− errorfc(fc, "unable to remount read-only");
1542+ gfs2_make_fs_ro(sdp);
15451543 } else {
15461544 error = gfs2_make_fs_rw(sdp);
15471545 if (error)
fs/gfs2/super.c+2−8
@@ -587,9 +587,8 @@ out: · 586 unmodified lines
587587 * Returns: errno
588588 */
589589
590−int gfs2_make_fs_ro(struct gfs2_sbd *sdp)
590+void gfs2_make_fs_ro(struct gfs2_sbd *sdp)
591591 {
592− int error = 0;
593592 int log_write_allowed = test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags);
594593
595594 gfs2_flush_delete_work(sdp);
@@ -624,8 +623,6 @@ int gfs2_make_fs_ro(struct gfs2_sbd *sdp) · 28 unmodified lines
624623
625624 if (!log_write_allowed)
626625 sdp->sd_vfs->s_flags |= SB_RDONLY;
627−
628− return error;
629626 }
630627
631628 /**
@@ -637,7 +634,6 @@ int gfs2_make_fs_ro(struct gfs2_sbd *sdp) · 5 unmodified lines
637634 static void gfs2_put_super(struct super_block *sb)
638635 {
639636 struct gfs2_sbd *sdp = sb->s_fs_info;
640− int error;
641637 struct gfs2_jdesc *jd;
642638
643639 /* No more recovery requests */
@@ -658,9 +654,7 @@ restart: · 14 unmodified lines
658654 spin_unlock(&sdp->sd_jindex_spin);
659655
660656 if (!sb_rdonly(sb)) {
661− error = gfs2_make_fs_ro(sdp);
662− if (error)
663− gfs2_io_error(sdp);
657+ gfs2_make_fs_ro(sdp);
664658 }
665659 WARN_ON(gfs2_withdrawing(sdp));
666660
fs/gfs2/super.h+1−1
@@ -34,7 +34,7 @@ extern int gfs2_lookup_in_master_dir(struct gfs2_sbd *sdp, char *filename, · 33 unmodified lines
3434 struct gfs2_inode **ipp);
3535
3636 extern int gfs2_make_fs_rw(struct gfs2_sbd *sdp);
37−extern int gfs2_make_fs_ro(struct gfs2_sbd *sdp);
37+extern void gfs2_make_fs_ro(struct gfs2_sbd *sdp);
3838 extern void gfs2_online_uevent(struct gfs2_sbd *sdp);
3939 extern int gfs2_statfs_init(struct gfs2_sbd *sdp);
4040 extern void gfs2_statfs_change(struct gfs2_sbd *sdp, s64 total, s64 free,
fs/gfs2/trans.c+2−0
@@ -169,6 +169,8 @@ static struct gfs2_bufdata *gfs2_alloc_bufdata(struct gfs2_glock *gl, · 168 unmodified lines
169169 bd->bd_bh = bh;
170170 bd->bd_gl = gl;
171171 INIT_LIST_HEAD(&bd->bd_list);
172+ INIT_LIST_HEAD(&bd->bd_ail_st_list);
173+ INIT_LIST_HEAD(&bd->bd_ail_gl_list);
172174 bh->b_private = bd;
173175 return bd;
174176 }
fs/gfs2/util.c+11−6
@@ -119,17 +119,22 @@ void gfs2_freeze_unlock(struct gfs2_holder *freeze_gh) · 118 unmodified lines
119119 static void signal_our_withdraw(struct gfs2_sbd *sdp)
120120 {
121121 struct gfs2_glock *live_gl = sdp->sd_live_gh.gh_gl;
122− struct inode *inode = sdp->sd_jdesc->jd_inode;
123− struct gfs2_inode *ip = GFS2_I(inode);
124− struct gfs2_glock *i_gl = ip->i_gl;
125− u64 no_formal_ino = ip->i_no_formal_ino;
122+ struct inode *inode;
123+ struct gfs2_inode *ip;
124+ struct gfs2_glock *i_gl;
125+ u64 no_formal_ino;
126126 int log_write_allowed = test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags);
127127 int ret = 0;
128128 int tries;
129129
130− if (test_bit(SDF_NORECOVERY, &sdp->sd_flags))
130+ if (test_bit(SDF_NORECOVERY, &sdp->sd_flags) || !sdp->sd_jdesc)
131131 return;
132132
133+ inode = sdp->sd_jdesc->jd_inode;
134+ ip = GFS2_I(inode);
135+ i_gl = ip->i_gl;
136+ no_formal_ino = ip->i_no_formal_ino;
137+
133138 /* Prevent any glock dq until withdraw recovery is complete */
134139 set_bit(SDF_WITHDRAW_RECOVERY, &sdp->sd_flags);
135140 /*
@@ -156,7 +161,7 @@ static void signal_our_withdraw(struct gfs2_sbd *sdp) · 20 unmodified lines
156161 ret = 0;
157162 }
158163 if (!ret)
159− ret = gfs2_make_fs_ro(sdp);
164+ gfs2_make_fs_ro(sdp);
160165 gfs2_freeze_unlock(&freeze_gh);
161166 }
162167
fs/io-wq.c+22−15
@@ -110,7 +110,6 @@ struct io_wq { · 109 unmodified lines
110110 io_wq_work_fn *do_work;
111111
112112 struct task_struct *manager;
113− struct user_struct *user;
114113
115114 struct io_wq_hash *hash;
116115
@@ -387,13 +386,16 @@ static struct io_wq_work *io_get_next_work(struct io_wqe *wqe) · 270 unmodified lines
387386 return NULL;
388387 }
389388
390−static void io_flush_signals(void)
389+static bool io_flush_signals(void)
391390 {
392391 if (unlikely(test_tsk_thread_flag(current, TIF_NOTIFY_SIGNAL))) {
392+ __set_current_state(TASK_RUNNING);
393393 if (current->task_works)
394394 task_work_run();
395395 clear_tsk_thread_flag(current, TIF_NOTIFY_SIGNAL);
396+ return true;
396397 }
398+ return false;
397399 }
398400
399401 static void io_assign_current_work(struct io_worker *worker,
@@ -489,6 +491,8 @@ static int io_wqe_worker(void *data) · 89 unmodified lines
489491 set_task_comm(current, buf);
490492
491493 while (!test_bit(IO_WQ_BIT_EXIT, &wq->state)) {
494+ long ret;
495+
492496 set_current_state(TASK_INTERRUPTIBLE);
493497 loop:
494498 raw_spin_lock_irq(&wqe->lock);
@@ -498,8 +502,10 @@ loop: · 3 unmodified lines
498502 }
499503 __io_worker_idle(wqe, worker);
500504 raw_spin_unlock_irq(&wqe->lock);
501− io_flush_signals();
502− if (schedule_timeout(WORKER_IDLE_TIMEOUT))
505+ if (io_flush_signals())
506+ continue;
507+ ret = schedule_timeout(WORKER_IDLE_TIMEOUT);
508+ if (try_to_freeze() || ret)
503509 continue;
504510 if (fatal_signal_pending(current))
505511 break;
@@ -592,7 +598,7 @@ static bool create_io_worker(struct io_wq *wq, struct io_wqe *wqe, int index) · 86 unmodified lines
592598 tsk->pf_io_worker = worker;
593599 worker->task = tsk;
594600 set_cpus_allowed_ptr(tsk, cpumask_of_node(wqe->node));
595− tsk->flags |= PF_NOFREEZE | PF_NO_SETAFFINITY;
601+ tsk->flags |= PF_NO_SETAFFINITY;
596602
597603 raw_spin_lock_irq(&wqe->lock);
598604 hlist_nulls_add_head_rcu(&worker->nulls_node, &wqe->free_list);
@@ -722,9 +728,9 @@ static int io_wq_manager(void *data) · 123 unmodified lines
722728 io_wq_for_each_worker(wq->wqes[node], io_wq_worker_wake, NULL);
723729 rcu_read_unlock();
724730
725− /* we might not ever have created any workers */
726− if (atomic_read(&wq->worker_refs))
727− wait_for_completion(&wq->worker_done);
731+ if (atomic_dec_and_test(&wq->worker_refs))
732+ complete(&wq->worker_done);
733+ wait_for_completion(&wq->worker_done);
728734
729735 spin_lock_irq(&wq->hash->wait.lock);
730736 for_each_node(node)
@@ -774,7 +780,10 @@ static int io_wq_fork_manager(struct io_wq *wq) · 43 unmodified lines
774780 if (wq->manager)
775781 return 0;
776782
777− reinit_completion(&wq->worker_done);
783+ WARN_ON_ONCE(test_bit(IO_WQ_BIT_EXIT, &wq->state));
784+
785+ init_completion(&wq->worker_done);
786+ atomic_set(&wq->worker_refs, 1);
778787 tsk = create_io_thread(io_wq_manager, wq, NUMA_NO_NODE);
779788 if (!IS_ERR(tsk)) {
780789 wq->manager = get_task_struct(tsk);
@@ -782,6 +791,9 @@ static int io_wq_fork_manager(struct io_wq *wq) · 1 unmodified line
782791 return 0;
783792 }
784793
794+ if (atomic_dec_and_test(&wq->worker_refs))
795+ complete(&wq->worker_done);
796+
785797 return PTR_ERR(tsk);
786798 }
787799
@@ -794,8 +806,7 @@ static void io_wqe_enqueue(struct io_wqe *wqe, struct io_wq_work *work) · 6 unmodified lines
794806 /* Can only happen if manager creation fails after exec */
795807 if (io_wq_fork_manager(wqe->wq) ||
796808 test_bit(IO_WQ_BIT_EXIT, &wqe->wq->state)) {
797− work->flags |= IO_WQ_WORK_CANCEL;
798− wqe->wq->do_work(work);
809+ io_run_cancel(work, wqe);
799810 return;
800811 }
801812
@@ -1018,13 +1029,9 @@ struct io_wq *io_wq_create(unsigned bounded, struct io_wq_data *data) · 216 unmodified lines
10181029 init_completion(&wq->exited);
10191030 refcount_set(&wq->refs, 1);
10201031
1021− init_completion(&wq->worker_done);
1022− atomic_set(&wq->worker_refs, 0);
1023−
10241032 ret = io_wq_fork_manager(wq);
10251033 if (!ret)
10261034 return wq;
1027−
10281035 err:
10291036 io_wq_put_hash(data->hash);
10301037 cpuhp_state_remove_instance_nocalls(io_wq_online, &wq->cpuhp_node);
fs/io-wq.h+10−2
@@ -2,7 +2,6 @@ · 1 unmodified line
22 #define INTERNAL_IO_WQ_H
33
44 #include <linux/refcount.h>
5−#include <linux/io_uring.h>
65
76 struct io_wq;
87
@@ -21,6 +20,15 @@ enum io_wq_cancel { · 12 unmodified lines
2120 IO_WQ_CANCEL_NOTFOUND, /* work not found */
2221 };
2322
23+struct io_wq_work_node {
24+ struct io_wq_work_node *next;
25+};
26+
27+struct io_wq_work_list {
28+ struct io_wq_work_node *first;
29+ struct io_wq_work_node *last;
30+};
31+
2432 static inline void wq_list_add_after(struct io_wq_work_node *node,
2533 struct io_wq_work_node *pos,
2634 struct io_wq_work_list *list)
@@ -79,8 +87,8 @@ static inline void wq_list_del(struct io_wq_work_list *list, · 52 unmodified lines
7987
8088 struct io_wq_work {
8189 struct io_wq_work_node list;
90+ const struct cred *creds;
8291 unsigned flags;
83− unsigned short personality;
8492 };
8593
8694 static inline struct io_wq_work *wq_next_work(struct io_wq_work *work)
fs/io_uring.c+551−436
@@ -258,12 +258,11 @@ enum { · 257 unmodified lines
258258
259259 struct io_sq_data {
260260 refcount_t refs;
261+ atomic_t park_pending;
261262 struct mutex lock;
262263
263264 /* ctx's that are using this sqd */
264265 struct list_head ctx_list;
265− struct list_head ctx_new_list;
266− struct mutex ctx_lock;
267266
268267 struct task_struct *thread;
269268 struct wait_queue_head wait;
@@ -271,11 +270,11 @@ struct io_sq_data { · 1 unmodified line
271270 unsigned sq_thread_idle;
272271 int sq_cpu;
273272 pid_t task_pid;
273+ pid_t task_tgid;
274274
275275 unsigned long state;
276− struct completion startup;
277− struct completion parked;
278276 struct completion exited;
277+ struct callback_head *park_task_work;
279278 };
280279
281280 #define IO_IOPOLL_BATCH 8
@@ -336,7 +335,6 @@ struct io_ring_ctx { · 54 unmodified lines
336335 unsigned int drain_next: 1;
337336 unsigned int eventfd_async: 1;
338337 unsigned int restricted: 1;
339− unsigned int sqo_exec: 1;
340338
341339 /*
342340 * Ring buffer of indices into array of io_uring_sqe, which is
@@ -380,6 +378,7 @@ struct io_ring_ctx { · 37 unmodified lines
380378 /* Only used for accounting purposes */
381379 struct mm_struct *mm_account;
382380
381+ const struct cred *sq_creds; /* cred used for __io_sq_thread() */
383382 struct io_sq_data *sq_data; /* if using sq thread polling */
384383
385384 struct wait_queue_head sqo_sq_wait;
@@ -400,15 +399,15 @@ struct io_ring_ctx { · 14 unmodified lines
400399 struct user_struct *user;
401400
402401 struct completion ref_comp;
403− struct completion sq_thread_comp;
404402
405403 #if defined(CONFIG_UNIX)
406404 struct socket *ring_sock;
407405 #endif
408406
409− struct idr io_buffer_idr;
407+ struct xarray io_buffers;
410408
411− struct idr personality_idr;
409+ struct xarray personalities;
410+ u32 pers_next;
412411
413412 struct {
414413 unsigned cached_cq_tail;
@@ -454,6 +453,23 @@ struct io_ring_ctx { · 39 unmodified lines
454453
455454 /* Keep this last, we don't need it for the fast path */
456455 struct work_struct exit_work;
456+ struct list_head tctx_list;
457+};
458+
459+struct io_uring_task {
460+ /* submission side */
461+ struct xarray xa;
462+ struct wait_queue_head wait;
463+ const struct io_ring_ctx *last;
464+ struct io_wq *io_wq;
465+ struct percpu_counter inflight;
466+ atomic_t in_idle;
467+ bool sqpoll;
468+
469+ spinlock_t task_lock;
470+ struct io_wq_work_list task_list;
471+ unsigned long task_state;
472+ struct callback_head task_work;
457473 };
458474
459475 /*
@@ -805,6 +821,12 @@ struct io_kiocb { · 345 unmodified lines
805821 struct io_wq_work work;
806822 };
807823
824+struct io_tctx_node {
825+ struct list_head ctx_node;
826+ struct task_struct *task;
827+ struct io_ring_ctx *ctx;
828+};
829+
808830 struct io_defer_entry {
809831 struct list_head list;
810832 struct io_kiocb *req;
@@ -979,6 +1001,8 @@ static const struct io_op_def io_op_defs[] = { · 168 unmodified lines
9791001 [IORING_OP_UNLINKAT] = {},
9801002 };
9811003
1004+static bool io_disarm_next(struct io_kiocb *req);
1005+static void io_uring_del_task_file(unsigned long index);
9821006 static void io_uring_try_cancel_requests(struct io_ring_ctx *ctx,
9831007 struct task_struct *task,
9841008 struct files_struct *files);
@@ -1129,9 +1153,8 @@ static struct io_ring_ctx *io_ring_ctx_alloc(struct io_uring_params *p) · 144 unmodified lines
11291153 init_waitqueue_head(&ctx->cq_wait);
11301154 INIT_LIST_HEAD(&ctx->cq_overflow_list);
11311155 init_completion(&ctx->ref_comp);
1132− init_completion(&ctx->sq_thread_comp);
1133− idr_init(&ctx->io_buffer_idr);
1134− idr_init(&ctx->personality_idr);
1156+ xa_init_flags(&ctx->io_buffers, XA_FLAGS_ALLOC1);
1157+ xa_init_flags(&ctx->personalities, XA_FLAGS_ALLOC1);
11351158 mutex_init(&ctx->uring_lock);
11361159 init_waitqueue_head(&ctx->wait);
11371160 spin_lock_init(&ctx->completion_lock);
@@ -1144,6 +1167,7 @@ static struct io_ring_ctx *io_ring_ctx_alloc(struct io_uring_params *p) · 6 unmodified lines
11441167 INIT_LIST_HEAD(&ctx->rsrc_ref_list);
11451168 INIT_DELAYED_WORK(&ctx->rsrc_put_work, io_rsrc_put_work);
11461169 init_llist_head(&ctx->rsrc_put_llist);
1170+ INIT_LIST_HEAD(&ctx->tctx_list);
11471171 INIT_LIST_HEAD(&ctx->submit_state.comp.free_list);
11481172 INIT_LIST_HEAD(&ctx->submit_state.comp.locked_free_list);
11491173 return ctx;
@@ -1183,6 +1207,9 @@ static void io_prep_async_work(struct io_kiocb *req) · 33 unmodified lines
11831207 const struct io_op_def *def = &io_op_defs[req->opcode];
11841208 struct io_ring_ctx *ctx = req->ctx;
11851209
1210+ if (!req->work.creds)
1211+ req->work.creds = get_current_cred();
1212+
11861213 if (req->flags & REQ_F_FORCE_ASYNC)
11871214 req->work.flags |= IO_WQ_WORK_CONCURRENT;
11881215
@@ -1514,15 +1541,14 @@ static void io_cqring_fill_event(struct io_kiocb *req, long res) · 325 unmodified lines
15141541 __io_cqring_fill_event(req, res, 0);
15151542 }
15161543
1517−static inline void io_req_complete_post(struct io_kiocb *req, long res,
1518− unsigned int cflags)
1544+static void io_req_complete_post(struct io_kiocb *req, long res,
1545+ unsigned int cflags)
15191546 {
15201547 struct io_ring_ctx *ctx = req->ctx;
15211548 unsigned long flags;
15221549
15231550 spin_lock_irqsave(&ctx->completion_lock, flags);
15241551 __io_cqring_fill_event(req, res, cflags);
1525− io_commit_cqring(ctx);
15261552 /*
15271553 * If we're the last reference to this request, add to our locked
15281554 * free_list cache.
@@ -1530,17 +1556,27 @@ static inline void io_req_complete_post(struct io_kiocb *req, long res, · 1 unmodified line
15301556 if (refcount_dec_and_test(&req->refs)) {
15311557 struct io_comp_state *cs = &ctx->submit_state.comp;
15321558
1559+ if (req->flags & (REQ_F_LINK | REQ_F_HARDLINK)) {
1560+ if (req->flags & (REQ_F_LINK_TIMEOUT | REQ_F_FAIL_LINK))
1561+ io_disarm_next(req);
1562+ if (req->link) {
1563+ io_req_task_queue(req->link);
1564+ req->link = NULL;
1565+ }
1566+ }
15331567 io_dismantle_req(req);
15341568 io_put_task(req->task, 1);
15351569 list_add(&req->compl.list, &cs->locked_free_list);
15361570 cs->locked_free_nr++;
1537− } else
1538− req = NULL;
1571+ } else {
1572+ if (!percpu_ref_tryget(&ctx->refs))
1573+ req = NULL;
1574+ }
1575+ io_commit_cqring(ctx);
15391576 spin_unlock_irqrestore(&ctx->completion_lock, flags);
15401577
1541− io_cqring_ev_posted(ctx);
15421578 if (req) {
1543− io_queue_next(req);
1579+ io_cqring_ev_posted(ctx);
15441580 percpu_ref_put(&ctx->refs);
15451581 }
15461582 }
@@ -1648,6 +1684,10 @@ static void io_dismantle_req(struct io_kiocb *req) · 101 unmodified lines
16481684 io_put_file(req, req->file, (req->flags & REQ_F_FIXED_FILE));
16491685 if (req->fixed_rsrc_refs)
16501686 percpu_ref_put(req->fixed_rsrc_refs);
1687+ if (req->work.creds) {
1688+ put_cred(req->work.creds);
1689+ req->work.creds = NULL;
1690+ }
16511691
16521692 if (req->flags & REQ_F_INFLIGHT) {
16531693 struct io_ring_ctx *ctx = req->ctx;
@@ -1690,15 +1730,11 @@ static inline void io_remove_next_linked(struct io_kiocb *req) · 36 unmodified lines
16901730 nxt->link = NULL;
16911731 }
16921732
1693−static void io_kill_linked_timeout(struct io_kiocb *req)
1733+static bool io_kill_linked_timeout(struct io_kiocb *req)
1734+ __must_hold(&req->ctx->completion_lock)
16941735 {
1695− struct io_ring_ctx *ctx = req->ctx;
1696− struct io_kiocb *link;
1736+ struct io_kiocb *link = req->link;
16971737 bool cancelled = false;
1698− unsigned long flags;
1699−
1700− spin_lock_irqsave(&ctx->completion_lock, flags);
1701− link = req->link;
17021738
17031739 /*
17041740 * Can happen if a linked timeout fired and link had been like
@@ -1713,50 +1749,48 @@ static void io_kill_linked_timeout(struct io_kiocb *req) · 8 unmodified lines
17131749 ret = hrtimer_try_to_cancel(&io->timer);
17141750 if (ret != -1) {
17151751 io_cqring_fill_event(link, -ECANCELED);
1716− io_commit_cqring(ctx);
1752+ io_put_req_deferred(link, 1);
17171753 cancelled = true;
17181754 }
17191755 }
17201756 req->flags &= ~REQ_F_LINK_TIMEOUT;
1721− spin_unlock_irqrestore(&ctx->completion_lock, flags);
1722−
1723− if (cancelled) {
1724− io_cqring_ev_posted(ctx);
1725− io_put_req(link);
1726− }
1757+ return cancelled;
17271758 }
17281759
1729−
17301760 static void io_fail_links(struct io_kiocb *req)
1761+ __must_hold(&req->ctx->completion_lock)
17311762 {
1732− struct io_kiocb *link, *nxt;
1733− struct io_ring_ctx *ctx = req->ctx;
1734− unsigned long flags;
1763+ struct io_kiocb *nxt, *link = req->link;
17351764
1736− spin_lock_irqsave(&ctx->completion_lock, flags);
1737− link = req->link;
17381765 req->link = NULL;
1739−
17401766 while (link) {
17411767 nxt = link->link;
17421768 link->link = NULL;
17431769
17441770 trace_io_uring_fail_link(req, link);
17451771 io_cqring_fill_event(link, -ECANCELED);
1746−
17471772 io_put_req_deferred(link, 2);
17481773 link = nxt;
17491774 }
1750− io_commit_cqring(ctx);
1751− spin_unlock_irqrestore(&ctx->completion_lock, flags);
1775+}
17521776
1753− io_cqring_ev_posted(ctx);
1777+static bool io_disarm_next(struct io_kiocb *req)
1778+ __must_hold(&req->ctx->completion_lock)
1779+{
1780+ bool posted = false;
1781+
1782+ if (likely(req->flags & REQ_F_LINK_TIMEOUT))
1783+ posted = io_kill_linked_timeout(req);
1784+ if (unlikely(req->flags & REQ_F_FAIL_LINK)) {
1785+ posted |= (req->link != NULL);
1786+ io_fail_links(req);
1787+ }
1788+ return posted;
17541789 }
17551790
17561791 static struct io_kiocb *__io_req_find_next(struct io_kiocb *req)
17571792 {
1758− if (req->flags & REQ_F_LINK_TIMEOUT)
1759− io_kill_linked_timeout(req);
1793+ struct io_kiocb *nxt;
17601794
17611795 /*
17621796 * If LINK is set, we have dependent requests in this chain. If we
@@ -1764,14 +1798,22 @@ static struct io_kiocb *__io_req_find_next(struct io_kiocb *req) · 1 unmodified line
17641798 * dependencies to the next request. In case of failure, fail the rest
17651799 * of the chain.
17661800 */
1767− if (likely(!(req->flags & REQ_F_FAIL_LINK))) {
1768− struct io_kiocb *nxt = req->link;
1801+ if (req->flags & (REQ_F_LINK_TIMEOUT | REQ_F_FAIL_LINK)) {
1802+ struct io_ring_ctx *ctx = req->ctx;
1803+ unsigned long flags;
1804+ bool posted;
17691805
1770− req->link = NULL;
1771− return nxt;
1806+ spin_lock_irqsave(&ctx->completion_lock, flags);
1807+ posted = io_disarm_next(req);
1808+ if (posted)
1809+ io_commit_cqring(req->ctx);
1810+ spin_unlock_irqrestore(&ctx->completion_lock, flags);
1811+ if (posted)
1812+ io_cqring_ev_posted(ctx);
17721813 }
1773− io_fail_links(req);
1774− return NULL;
1814+ nxt = req->link;
1815+ req->link = NULL;
1816+ return nxt;
17751817 }
17761818
17771819 static inline struct io_kiocb *io_req_find_next(struct io_kiocb *req)
@@ -1904,17 +1946,44 @@ static int io_req_task_work_add(struct io_kiocb *req) · 126 unmodified lines
19041946 return ret;
19051947 }
19061948
1907−static void io_req_task_work_add_fallback(struct io_kiocb *req,
1908− task_work_func_t cb)
1949+static bool io_run_task_work_head(struct callback_head **work_head)
1950+{
1951+ struct callback_head *work, *next;
1952+ bool executed = false;
1953+
1954+ do {
1955+ work = xchg(work_head, NULL);
1956+ if (!work)
1957+ break;
1958+
1959+ do {
1960+ next = work->next;
1961+ work->func(work);
1962+ work = next;
1963+ cond_resched();
1964+ } while (work);
1965+ executed = true;
1966+ } while (1);
1967+
1968+ return executed;
1969+}
1970+
1971+static void io_task_work_add_head(struct callback_head **work_head,
1972+ struct callback_head *task_work)
19091973 {
1910− struct io_ring_ctx *ctx = req->ctx;
19111974 struct callback_head *head;
19121975
1913− init_task_work(&req->task_work, cb);
19141976 do {
1915− head = READ_ONCE(ctx->exit_task_work);
1916− req->task_work.next = head;
1917− } while (cmpxchg(&ctx->exit_task_work, head, &req->task_work) != head);
1977+ head = READ_ONCE(*work_head);
1978+ task_work->next = head;
1979+ } while (cmpxchg(work_head, head, task_work) != head);
1980+}
1981+
1982+static void io_req_task_work_add_fallback(struct io_kiocb *req,
1983+ task_work_func_t cb)
1984+{
1985+ init_task_work(&req->task_work, cb);
1986+ io_task_work_add_head(&req->ctx->exit_task_work, &req->task_work);
19181987 }
19191988
19201989 static void __io_req_task_cancel(struct io_kiocb *req, int error)
@@ -2822,7 +2891,7 @@ static struct io_buffer *io_buffer_select(struct io_kiocb *req, size_t *len, · 901 unmodified lines
28222891
28232892 lockdep_assert_held(&req->ctx->uring_lock);
28242893
2825− head = idr_find(&req->ctx->io_buffer_idr, bgid);
2894+ head = xa_load(&req->ctx->io_buffers, bgid);
28262895 if (head) {
28272896 if (!list_empty(&head->list)) {
28282897 kbuf = list_last_entry(&head->list, struct io_buffer,
@@ -2830,7 +2899,7 @@ static struct io_buffer *io_buffer_select(struct io_kiocb *req, size_t *len, · 1 unmodified line
28302899 list_del(&kbuf->list);
28312900 } else {
28322901 kbuf = head;
2833− idr_remove(&req->ctx->io_buffer_idr, bgid);
2902+ xa_erase(&req->ctx->io_buffers, bgid);
28342903 }
28352904 if (*len > kbuf->len)
28362905 *len = kbuf->len;
@@ -3871,7 +3940,7 @@ static int __io_remove_buffers(struct io_ring_ctx *ctx, struct io_buffer *buf, · 1034 unmodified lines
38713940 }
38723941 i++;
38733942 kfree(buf);
3874− idr_remove(&ctx->io_buffer_idr, bgid);
3943+ xa_erase(&ctx->io_buffers, bgid);
38753944
38763945 return i;
38773946 }
@@ -3889,7 +3958,7 @@ static int io_remove_buffers(struct io_kiocb *req, unsigned int issue_flags) · 11 unmodified lines
38893958 lockdep_assert_held(&ctx->uring_lock);
38903959
38913960 ret = -ENOENT;
3892− head = idr_find(&ctx->io_buffer_idr, p->bgid);
3961+ head = xa_load(&ctx->io_buffers, p->bgid);
38933962 if (head)
38943963 ret = __io_remove_buffers(ctx, head, p->bgid, p->nbufs);
38953964 if (ret < 0)
@@ -3972,21 +4041,14 @@ static int io_provide_buffers(struct io_kiocb *req, unsigned int issue_flags) · 76 unmodified lines
39724041
39734042 lockdep_assert_held(&ctx->uring_lock);
39744043
3975− list = head = idr_find(&ctx->io_buffer_idr, p->bgid);
4044+ list = head = xa_load(&ctx->io_buffers, p->bgid);
39764045
39774046 ret = io_add_buffers(p, &head);
3978− if (ret < 0)
3979− goto out;
3980−
3981− if (!list) {
3982− ret = idr_alloc(&ctx->io_buffer_idr, head, p->bgid, p->bgid + 1,
3983− GFP_KERNEL);
3984− if (ret < 0) {
4047+ if (ret >= 0 && !list) {
4048+ ret = xa_insert(&ctx->io_buffers, p->bgid, head, GFP_KERNEL);
4049+ if (ret < 0)
39854050 __io_remove_buffers(ctx, head, p->bgid, -1U);
3986− goto out;
3987− }
39884051 }
3989−out:
39904052 if (ret < 0)
39914053 req_set_fail_links(req);
39924054
@@ -4324,6 +4386,7 @@ static int io_sendmsg(struct io_kiocb *req, unsigned int issue_flags) · 331 unmodified lines
43244386 struct io_async_msghdr iomsg, *kmsg;
43254387 struct socket *sock;
43264388 unsigned flags;
4389+ int min_ret = 0;
43274390 int ret;
43284391
43294392 sock = sock_from_file(req->file);
@@ -4338,12 +4401,15 @@ static int io_sendmsg(struct io_kiocb *req, unsigned int issue_flags) · 8 unmodified lines
43384401 kmsg = &iomsg;
43394402 }
43404403
4341− flags = req->sr_msg.msg_flags;
4404+ flags = req->sr_msg.msg_flags | MSG_NOSIGNAL;
43424405 if (flags & MSG_DONTWAIT)
43434406 req->flags |= REQ_F_NOWAIT;
43444407 else if (issue_flags & IO_URING_F_NONBLOCK)
43454408 flags |= MSG_DONTWAIT;
43464409
4410+ if (flags & MSG_WAITALL)
4411+ min_ret = iov_iter_count(&kmsg->msg.msg_iter);
4412+
43474413 ret = __sys_sendmsg_sock(sock, &kmsg->msg, flags);
43484414 if ((issue_flags & IO_URING_F_NONBLOCK) && ret == -EAGAIN)
43494415 return io_setup_async_msg(req, kmsg);
@@ -4354,7 +4420,7 @@ static int io_sendmsg(struct io_kiocb *req, unsigned int issue_flags) · 4 unmodified lines
43544420 if (kmsg->free_iov)
43554421 kfree(kmsg->free_iov);
43564422 req->flags &= ~REQ_F_NEED_CLEANUP;
4357− if (ret < 0)
4423+ if (ret < min_ret)
43584424 req_set_fail_links(req);
43594425 __io_req_complete(req, issue_flags, ret, 0);
43604426 return 0;
@@ -4367,6 +4433,7 @@ static int io_send(struct io_kiocb *req, unsigned int issue_flags) · 6 unmodified lines
43674433 struct iovec iov;
43684434 struct socket *sock;
43694435 unsigned flags;
4436+ int min_ret = 0;
43704437 int ret;
43714438
43724439 sock = sock_from_file(req->file);
@@ -4382,12 +4449,15 @@ static int io_send(struct io_kiocb *req, unsigned int issue_flags) · 9 unmodified lines
43824449 msg.msg_controllen = 0;
43834450 msg.msg_namelen = 0;
43844451
4385− flags = req->sr_msg.msg_flags;
4452+ flags = req->sr_msg.msg_flags | MSG_NOSIGNAL;
43864453 if (flags & MSG_DONTWAIT)
43874454 req->flags |= REQ_F_NOWAIT;
43884455 else if (issue_flags & IO_URING_F_NONBLOCK)
43894456 flags |= MSG_DONTWAIT;
43904457
4458+ if (flags & MSG_WAITALL)
4459+ min_ret = iov_iter_count(&msg.msg_iter);
4460+
43914461 msg.msg_flags = flags;
43924462 ret = sock_sendmsg(sock, &msg);
43934463 if ((issue_flags & IO_URING_F_NONBLOCK) && ret == -EAGAIN)
@@ -4395,7 +4465,7 @@ static int io_send(struct io_kiocb *req, unsigned int issue_flags) · 1 unmodified line
43954465 if (ret == -ERESTARTSYS)
43964466 ret = -EINTR;
43974467
4398− if (ret < 0)
4468+ if (ret < min_ret)
43994469 req_set_fail_links(req);
44004470 __io_req_complete(req, issue_flags, ret, 0);
44014471 return 0;
@@ -4547,6 +4617,7 @@ static int io_recvmsg(struct io_kiocb *req, unsigned int issue_flags) · 145 unmodified lines
45474617 struct socket *sock;
45484618 struct io_buffer *kbuf;
45494619 unsigned flags;
4620+ int min_ret = 0;
45504621 int ret, cflags = 0;
45514622 bool force_nonblock = issue_flags & IO_URING_F_NONBLOCK;
45524623
@@ -4572,12 +4643,15 @@ static int io_recvmsg(struct io_kiocb *req, unsigned int issue_flags) · 19 unmodified lines
45724643 1, req->sr_msg.len);
45734644 }
45744645
4575− flags = req->sr_msg.msg_flags;
4646+ flags = req->sr_msg.msg_flags | MSG_NOSIGNAL;
45764647 if (flags & MSG_DONTWAIT)
45774648 req->flags |= REQ_F_NOWAIT;
45784649 else if (force_nonblock)
45794650 flags |= MSG_DONTWAIT;
45804651
4652+ if (flags & MSG_WAITALL)
4653+ min_ret = iov_iter_count(&kmsg->msg.msg_iter);
4654+
45814655 ret = __sys_recvmsg_sock(sock, &kmsg->msg, req->sr_msg.umsg,
45824656 kmsg->uaddr, flags);
45834657 if (force_nonblock && ret == -EAGAIN)
@@ -4591,7 +4665,7 @@ static int io_recvmsg(struct io_kiocb *req, unsigned int issue_flags) · 7 unmodified lines
45914665 if (kmsg->free_iov)
45924666 kfree(kmsg->free_iov);
45934667 req->flags &= ~REQ_F_NEED_CLEANUP;
4594− if (ret < 0)
4668+ if (ret < min_ret || ((flags & MSG_WAITALL) && (kmsg->msg.msg_flags & (MSG_TRUNC | MSG_CTRUNC))))
45954669 req_set_fail_links(req);
45964670 __io_req_complete(req, issue_flags, ret, cflags);
45974671 return 0;
@@ -4606,6 +4680,7 @@ static int io_recv(struct io_kiocb *req, unsigned int issue_flags) · 8 unmodified lines
46064680 struct socket *sock;
46074681 struct iovec iov;
46084682 unsigned flags;
4683+ int min_ret = 0;
46094684 int ret, cflags = 0;
46104685 bool force_nonblock = issue_flags & IO_URING_F_NONBLOCK;
46114686
@@ -4631,12 +4706,15 @@ static int io_recv(struct io_kiocb *req, unsigned int issue_flags) · 19 unmodified lines
46314706 msg.msg_iocb = NULL;
46324707 msg.msg_flags = 0;
46334708
4634− flags = req->sr_msg.msg_flags;
4709+ flags = req->sr_msg.msg_flags | MSG_NOSIGNAL;
46354710 if (flags & MSG_DONTWAIT)
46364711 req->flags |= REQ_F_NOWAIT;
46374712 else if (force_nonblock)
46384713 flags |= MSG_DONTWAIT;
46394714
4715+ if (flags & MSG_WAITALL)
4716+ min_ret = iov_iter_count(&msg.msg_iter);
4717+
46404718 ret = sock_recvmsg(sock, &msg, flags);
46414719 if (force_nonblock && ret == -EAGAIN)
46424720 return -EAGAIN;
@@ -4645,7 +4723,7 @@ static int io_recv(struct io_kiocb *req, unsigned int issue_flags) · 2 unmodified lines
46454723 out_free:
46464724 if (req->flags & REQ_F_BUFFER_SELECTED)
46474725 cflags = io_put_recv_kbuf(req);
4648− if (ret < 0)
4726+ if (ret < min_ret || ((flags & MSG_WAITALL) && (msg.msg_flags & (MSG_TRUNC | MSG_CTRUNC))))
46494727 req_set_fail_links(req);
46504728 __io_req_complete(req, issue_flags, ret, cflags);
46514729 return 0;
@@ -5559,22 +5637,30 @@ add: · 907 unmodified lines
55595637 return 0;
55605638 }
55615639
5640+struct io_cancel_data {
5641+ struct io_ring_ctx *ctx;
5642+ u64 user_data;
5643+};
5644+
55625645 static bool io_cancel_cb(struct io_wq_work *work, void *data)
55635646 {
55645647 struct io_kiocb *req = container_of(work, struct io_kiocb, work);
5648+ struct io_cancel_data *cd = data;
55655649
5566− return req->user_data == (unsigned long) data;
5650+ return req->ctx == cd->ctx && req->user_data == cd->user_data;
55675651 }
55685652
5569−static int io_async_cancel_one(struct io_uring_task *tctx, void *sqe_addr)
5653+static int io_async_cancel_one(struct io_uring_task *tctx, u64 user_data,
5654+ struct io_ring_ctx *ctx)
55705655 {
5656+ struct io_cancel_data data = { .ctx = ctx, .user_data = user_data, };
55715657 enum io_wq_cancel cancel_ret;
55725658 int ret = 0;
55735659
5574− if (!tctx->io_wq)
5660+ if (!tctx || !tctx->io_wq)
55755661 return -ENOENT;
55765662
5577− cancel_ret = io_wq_cancel_cb(tctx->io_wq, io_cancel_cb, sqe_addr, false);
5663+ cancel_ret = io_wq_cancel_cb(tctx->io_wq, io_cancel_cb, &data, false);
55785664 switch (cancel_ret) {
55795665 case IO_WQ_CANCEL_OK:
55805666 ret = 0;
@@ -5597,8 +5683,7 @@ static void io_async_find_and_cancel(struct io_ring_ctx *ctx, · 16 unmodified lines
55975683 unsigned long flags;
55985684 int ret;
55995685
5600− ret = io_async_cancel_one(req->task->io_uring,
5601− (void *) (unsigned long) sqe_addr);
5686+ ret = io_async_cancel_one(req->task->io_uring, sqe_addr, ctx);
56025687 if (ret != -ENOENT) {
56035688 spin_lock_irqsave(&ctx->completion_lock, flags);
56045689 goto done;
@@ -5639,8 +5724,47 @@ static int io_async_cancel_prep(struct io_kiocb *req, · 34 unmodified lines
56395724 static int io_async_cancel(struct io_kiocb *req, unsigned int issue_flags)
56405725 {
56415726 struct io_ring_ctx *ctx = req->ctx;
5727+ u64 sqe_addr = req->cancel.addr;
5728+ struct io_tctx_node *node;
5729+ int ret;
56425730
5643− io_async_find_and_cancel(ctx, req, req->cancel.addr, 0);
5731+ /* tasks should wait for their io-wq threads, so safe w/o sync */
5732+ ret = io_async_cancel_one(req->task->io_uring, sqe_addr, ctx);
5733+ spin_lock_irq(&ctx->completion_lock);
5734+ if (ret != -ENOENT)
5735+ goto done;
5736+ ret = io_timeout_cancel(ctx, sqe_addr);
5737+ if (ret != -ENOENT)
5738+ goto done;
5739+ ret = io_poll_cancel(ctx, sqe_addr);
5740+ if (ret != -ENOENT)
5741+ goto done;
5742+ spin_unlock_irq(&ctx->completion_lock);
5743+
5744+ /* slow path, try all io-wq's */
5745+ io_ring_submit_lock(ctx, !(issue_flags & IO_URING_F_NONBLOCK));
5746+ ret = -ENOENT;
5747+ list_for_each_entry(node, &ctx->tctx_list, ctx_node) {
5748+ struct io_uring_task *tctx = node->task->io_uring;
5749+
5750+ if (!tctx || !tctx->io_wq)
5751+ continue;
5752+ ret = io_async_cancel_one(tctx, req->cancel.addr, ctx);
5753+ if (ret != -ENOENT)
5754+ break;
5755+ }
5756+ io_ring_submit_unlock(ctx, !(issue_flags & IO_URING_F_NONBLOCK));
5757+
5758+ spin_lock_irq(&ctx->completion_lock);
5759+done:
5760+ io_cqring_fill_event(req, ret);
5761+ io_commit_cqring(ctx);
5762+ spin_unlock_irq(&ctx->completion_lock);
5763+ io_cqring_ev_posted(ctx);
5764+
5765+ if (ret < 0)
5766+ req_set_fail_links(req);
5767+ io_put_req(req);
56445768 return 0;
56455769 }
56465770
@@ -5916,18 +6040,8 @@ static int io_issue_sqe(struct io_kiocb *req, unsigned int issue_flags) · 269 unmodified lines
59166040 const struct cred *creds = NULL;
59176041 int ret;
59186042
5919− if (req->work.personality) {
5920− const struct cred *new_creds;
5921−
5922− if (!(issue_flags & IO_URING_F_NONBLOCK))
5923− mutex_lock(&ctx->uring_lock);
5924− new_creds = idr_find(&ctx->personality_idr, req->work.personality);
5925− if (!(issue_flags & IO_URING_F_NONBLOCK))
5926− mutex_unlock(&ctx->uring_lock);
5927− if (!new_creds)
5928− return -EINVAL;
5929− creds = override_creds(new_creds);
5930− }
6043+ if (req->work.creds && req->work.creds != current_cred())
6044+ creds = override_creds(req->work.creds);
59316045
59326046 switch (req->opcode) {
59336047 case IORING_OP_NOP:
@@ -6147,7 +6261,6 @@ static enum hrtimer_restart io_link_timeout_fn(struct hrtimer *timer) · 213 unmodified lines
61476261 spin_unlock_irqrestore(&ctx->completion_lock, flags);
61486262
61496263 if (prev) {
6150− req_set_fail_links(prev);
61516264 io_async_find_and_cancel(ctx, req, prev->user_data, -ETIME);
61526265 io_put_req_deferred(prev, 1);
61536266 } else {
@@ -6291,7 +6404,7 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req, · 137 unmodified lines
62916404 {
62926405 struct io_submit_state *state;
62936406 unsigned int sqe_flags;
6294− int ret = 0;
6407+ int personality, ret = 0;
62956408
62966409 req->opcode = READ_ONCE(sqe->opcode);
62976410 /* same numerical values with corresponding REQ_F_*, safe to copy */
@@ -6306,6 +6419,9 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req, · 8 unmodified lines
63066419 refcount_set(&req->refs, 2);
63076420 req->task = current;
63086421 req->result = 0;
6422+ req->work.list.next = NULL;
6423+ req->work.creds = NULL;
6424+ req->work.flags = 0;
63096425
63106426 /* enforce forwards compatibility on users */
63116427 if (unlikely(sqe_flags & ~SQE_VALID_FLAGS)) {
@@ -6323,9 +6439,13 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req, · 11 unmodified lines
63236439 !io_op_defs[req->opcode].buffer_select)
63246440 return -EOPNOTSUPP;
63256441
6326− req->work.list.next = NULL;
6327− req->work.flags = 0;
6328− req->work.personality = READ_ONCE(sqe->personality);
6442+ personality = READ_ONCE(sqe->personality);
6443+ if (personality) {
6444+ req->work.creds = xa_load(&ctx->personalities, personality);
6445+ if (!req->work.creds)
6446+ return -EINVAL;
6447+ get_cred(req->work.creds);
6448+ }
63296449 state = &ctx->submit_state;
63306450
63316451 /*
@@ -6587,7 +6707,8 @@ static int __io_sq_thread(struct io_ring_ctx *ctx, bool cap_entries) · 255 unmodified lines
65876707 if (!list_empty(&ctx->iopoll_list))
65886708 io_do_iopoll(ctx, &nr_events, 0);
65896709
6590− if (to_submit && likely(!percpu_ref_is_dying(&ctx->refs)))
6710+ if (to_submit && likely(!percpu_ref_is_dying(&ctx->refs)) &&
6711+ !(ctx->flags & IORING_SETUP_R_DISABLED))
65916712 ret = io_submit_sqes(ctx, to_submit);
65926713 mutex_unlock(&ctx->uring_lock);
65936714 }
@@ -6611,58 +6732,6 @@ static void io_sqd_update_thread_idle(struct io_sq_data *sqd) · 17 unmodified lines
66116732 sqd->sq_thread_idle = sq_thread_idle;
66126733 }
66136734
6614−static void io_sqd_init_new(struct io_sq_data *sqd)
6615−{
6616− struct io_ring_ctx *ctx;
6617−
6618− while (!list_empty(&sqd->ctx_new_list)) {
6619− ctx = list_first_entry(&sqd->ctx_new_list, struct io_ring_ctx, sqd_list);
6620− list_move_tail(&ctx->sqd_list, &sqd->ctx_list);
6621− complete(&ctx->sq_thread_comp);
6622− }
6623−
6624− io_sqd_update_thread_idle(sqd);
6625−}
6626−
6627−static bool io_sq_thread_should_stop(struct io_sq_data *sqd)
6628−{
6629− return test_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state);
6630−}
6631−
6632−static bool io_sq_thread_should_park(struct io_sq_data *sqd)
6633−{
6634− return test_bit(IO_SQ_THREAD_SHOULD_PARK, &sqd->state);
6635−}
6636−
6637−static void io_sq_thread_parkme(struct io_sq_data *sqd)
6638−{
6639− for (;;) {
6640− /*
6641− * TASK_PARKED is a special state; we must serialize against
6642− * possible pending wakeups to avoid store-store collisions on
6643− * task->state.
6644− *
6645− * Such a collision might possibly result in the task state
6646− * changin from TASK_PARKED and us failing the
6647− * wait_task_inactive() in kthread_park().
6648− */
6649− set_special_state(TASK_PARKED);
6650− if (!test_bit(IO_SQ_THREAD_SHOULD_PARK, &sqd->state))
6651− break;
6652−
6653− /*
6654− * Thread is going to call schedule(), do not preempt it,
6655− * or the caller of kthread_park() may spend more time in
6656− * wait_task_inactive().
6657− */
6658− preempt_disable();
6659− complete(&sqd->parked);
6660− schedule_preempt_disabled();
6661− preempt_enable();
6662− }
6663− __set_current_state(TASK_RUNNING);
6664−}
6665−
66666735 static int io_sq_thread(void *data)
66676736 {
66686737 struct io_sq_data *sqd = data;
@@ -6681,31 +6750,32 @@ static int io_sq_thread(void *data) · 12 unmodified lines
66816750 set_cpus_allowed_ptr(current, cpu_online_mask);
66826751 current->flags |= PF_NO_SETAFFINITY;
66836752
6684− wait_for_completion(&sqd->startup);
6685−
6686− while (!io_sq_thread_should_stop(sqd)) {
6753+ mutex_lock(&sqd->lock);
6754+ while (!test_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state)) {
66876755 int ret;
66886756 bool cap_entries, sqt_spin, needs_sched;
66896757
6690− /*
6691− * Any changes to the sqd lists are synchronized through the
6692− * thread parking. This synchronizes the thread vs users,
6693− * the users are synchronized on the sqd->ctx_lock.
6694− */
6695− if (io_sq_thread_should_park(sqd)) {
6696− io_sq_thread_parkme(sqd);
6697− continue;
6698− }
6699− if (unlikely(!list_empty(&sqd->ctx_new_list))) {
6700− io_sqd_init_new(sqd);
6758+ if (test_bit(IO_SQ_THREAD_SHOULD_PARK, &sqd->state)) {
6759+ mutex_unlock(&sqd->lock);
6760+ cond_resched();
6761+ mutex_lock(&sqd->lock);
6762+ io_run_task_work();
6763+ io_run_task_work_head(&sqd->park_task_work);
67016764 timeout = jiffies + sqd->sq_thread_idle;
6765+ continue;
67026766 }
67036767 if (fatal_signal_pending(current))
67046768 break;
67056769 sqt_spin = false;
67066770 cap_entries = !list_is_singular(&sqd->ctx_list);
67076771 list_for_each_entry(ctx, &sqd->ctx_list, sqd_list) {
6772+ const struct cred *creds = NULL;
6773+
6774+ if (ctx->sq_creds != current_cred())
6775+ creds = override_creds(ctx->sq_creds);
67086776 ret = __io_sq_thread(ctx, cap_entries);
6777+ if (creds)
6778+ revert_creds(creds);
67096779 if (!sqt_spin && (ret > 0 || !list_empty(&ctx->iopoll_list)))
67106780 sqt_spin = true;
67116781 }
@@ -6732,45 +6802,33 @@ static int io_sq_thread(void *data) · 20 unmodified lines
67326802 }
67336803 }
67346804
6735− if (needs_sched && !io_sq_thread_should_park(sqd)) {
6805+ if (needs_sched && !test_bit(IO_SQ_THREAD_SHOULD_PARK, &sqd->state)) {
67366806 list_for_each_entry(ctx, &sqd->ctx_list, sqd_list)
67376807 io_ring_set_wakeup_flag(ctx);
67386808
6809+ mutex_unlock(&sqd->lock);
67396810 schedule();
67406811 try_to_freeze();
6812+ mutex_lock(&sqd->lock);
67416813 list_for_each_entry(ctx, &sqd->ctx_list, sqd_list)
67426814 io_ring_clear_wakeup_flag(ctx);
67436815 }
67446816
67456817 finish_wait(&sqd->wait, &wait);
6818+ io_run_task_work_head(&sqd->park_task_work);
67466819 timeout = jiffies + sqd->sq_thread_idle;
67476820 }
67486821
67496822 list_for_each_entry(ctx, &sqd->ctx_list, sqd_list)
67506823 io_uring_cancel_sqpoll(ctx);
6751−
6752− io_run_task_work();
6753−
6754− /*
6755− * Ensure that we park properly if racing with someone trying to park
6756− * while we're exiting. If we fail to grab the lock, check park and
6757− * park if necessary. The ordering with the park bit and the lock
6758− * ensures that we catch this reliably.
6759− */
6760− if (!mutex_trylock(&sqd->lock)) {
6761− if (io_sq_thread_should_park(sqd))
6762− io_sq_thread_parkme(sqd);
6763− mutex_lock(&sqd->lock);
6764− }
6765−
67666824 sqd->thread = NULL;
6767− list_for_each_entry(ctx, &sqd->ctx_list, sqd_list) {
6768− ctx->sqo_exec = 1;
6825+ list_for_each_entry(ctx, &sqd->ctx_list, sqd_list)
67696826 io_ring_set_wakeup_flag(ctx);
6770− }
6827+ mutex_unlock(&sqd->lock);
67716828
6829+ io_run_task_work();
6830+ io_run_task_work_head(&sqd->park_task_work);
67726831 complete(&sqd->exited);
6773− mutex_unlock(&sqd->lock);
67746832 do_exit(0);
67756833 }
67766834
@@ -7071,47 +7129,47 @@ static int io_sqe_files_unregister(struct io_ring_ctx *ctx) · 294 unmodified lines
70717129 static void io_sq_thread_unpark(struct io_sq_data *sqd)
70727130 __releases(&sqd->lock)
70737131 {
7074− if (sqd->thread == current)
7075− return;
7132+ WARN_ON_ONCE(sqd->thread == current);
7133+
7134+ /*
7135+ * Do the dance but not conditional clear_bit() because it'd race with
7136+ * other threads incrementing park_pending and setting the bit.
7137+ */
70767138 clear_bit(IO_SQ_THREAD_SHOULD_PARK, &sqd->state);
7077− if (sqd->thread)
7078− wake_up_state(sqd->thread, TASK_PARKED);
7139+ if (atomic_dec_return(&sqd->park_pending))
7140+ set_bit(IO_SQ_THREAD_SHOULD_PARK, &sqd->state);
70797141 mutex_unlock(&sqd->lock);
70807142 }
70817143
70827144 static void io_sq_thread_park(struct io_sq_data *sqd)
70837145 __acquires(&sqd->lock)
70847146 {
7085− if (sqd->thread == current)
7086− return;
7147+ WARN_ON_ONCE(sqd->thread == current);
7148+
7149+ atomic_inc(&sqd->park_pending);
70877150 set_bit(IO_SQ_THREAD_SHOULD_PARK, &sqd->state);
70887151 mutex_lock(&sqd->lock);
7089− if (sqd->thread) {
7152+ if (sqd->thread)
70907153 wake_up_process(sqd->thread);
7091− wait_for_completion(&sqd->parked);
7092− }
70937154 }
70947155
70957156 static void io_sq_thread_stop(struct io_sq_data *sqd)
70967157 {
7097− if (test_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state))
7098− return;
7158+ WARN_ON_ONCE(sqd->thread == current);
7159+
70997160 mutex_lock(&sqd->lock);
7100− if (sqd->thread) {
7101− set_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state);
7102− WARN_ON_ONCE(test_bit(IO_SQ_THREAD_SHOULD_PARK, &sqd->state));
7161+ set_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state);
7162+ if (sqd->thread)
71037163 wake_up_process(sqd->thread);
7104− mutex_unlock(&sqd->lock);
7105− wait_for_completion(&sqd->exited);
7106− WARN_ON_ONCE(sqd->thread);
7107− } else {
7108− mutex_unlock(&sqd->lock);
7109− }
7164+ mutex_unlock(&sqd->lock);
7165+ wait_for_completion(&sqd->exited);
71107166 }
71117167
71127168 static void io_put_sq_data(struct io_sq_data *sqd)
71137169 {
71147170 if (refcount_dec_and_test(&sqd->refs)) {
7171+ WARN_ON_ONCE(atomic_read(&sqd->park_pending));
7172+
71157173 io_sq_thread_stop(sqd);
71167174 kfree(sqd);
71177175 }
@@ -7122,22 +7180,15 @@ static void io_sq_thread_finish(struct io_ring_ctx *ctx) · 4 unmodified lines
71227180 struct io_sq_data *sqd = ctx->sq_data;
71237181
71247182 if (sqd) {
7125− complete(&sqd->startup);
7126− if (sqd->thread) {
7127− wait_for_completion(&ctx->sq_thread_comp);
7128− io_sq_thread_park(sqd);
7129− }
7130−
7131− mutex_lock(&sqd->ctx_lock);
7132− list_del(&ctx->sqd_list);
7183+ io_sq_thread_park(sqd);
7184+ list_del_init(&ctx->sqd_list);
71337185 io_sqd_update_thread_idle(sqd);
7134− mutex_unlock(&sqd->ctx_lock);
7135−
7136− if (sqd->thread)
7137− io_sq_thread_unpark(sqd);
7186+ io_sq_thread_unpark(sqd);
71387187
71397188 io_put_sq_data(sqd);
71407189 ctx->sq_data = NULL;
7190+ if (ctx->sq_creds)
7191+ put_cred(ctx->sq_creds);
71417192 }
71427193 }
71437194
@@ -7161,31 +7212,42 @@ static struct io_sq_data *io_attach_sq_data(struct io_uring_params *p) · 17 unmodified lines
71617212 fdput(f);
71627213 return ERR_PTR(-EINVAL);
71637214 }
7215+ if (sqd->task_tgid != current->tgid) {
7216+ fdput(f);
7217+ return ERR_PTR(-EPERM);
7218+ }
71647219
71657220 refcount_inc(&sqd->refs);
71667221 fdput(f);
71677222 return sqd;
71687223 }
71697224
7170−static struct io_sq_data *io_get_sq_data(struct io_uring_params *p)
7225+static struct io_sq_data *io_get_sq_data(struct io_uring_params *p,
7226+ bool *attached)
71717227 {
71727228 struct io_sq_data *sqd;
71737229
7174− if (p->flags & IORING_SETUP_ATTACH_WQ)
7175− return io_attach_sq_data(p);
7230+ *attached = false;
7231+ if (p->flags & IORING_SETUP_ATTACH_WQ) {
7232+ sqd = io_attach_sq_data(p);
7233+ if (!IS_ERR(sqd)) {
7234+ *attached = true;
7235+ return sqd;
7236+ }
7237+ /* fall through for EPERM case, setup new sqd/task */
7238+ if (PTR_ERR(sqd) != -EPERM)
7239+ return sqd;
7240+ }
71767241
71777242 sqd = kzalloc(sizeof(*sqd), GFP_KERNEL);
71787243 if (!sqd)
71797244 return ERR_PTR(-ENOMEM);
71807245
7246+ atomic_set(&sqd->park_pending, 0);
71817247 refcount_set(&sqd->refs, 1);
71827248 INIT_LIST_HEAD(&sqd->ctx_list);
7183− INIT_LIST_HEAD(&sqd->ctx_new_list);
7184− mutex_init(&sqd->ctx_lock);
71857249 mutex_init(&sqd->lock);
71867250 init_waitqueue_head(&sqd->wait);
7187− init_completion(&sqd->startup);
7188− init_completion(&sqd->parked);
71897251 init_completion(&sqd->exited);
71907252 return sqd;
71917253 }
@@ -7802,7 +7864,6 @@ static int io_uring_alloc_task_context(struct task_struct *task, · 610 unmodified lines
78027864 init_waitqueue_head(&tctx->wait);
78037865 tctx->last = NULL;
78047866 atomic_set(&tctx->in_idle, 0);
7805− tctx->sqpoll = false;
78067867 task->io_uring = tctx;
78077868 spin_lock_init(&tctx->task_lock);
78087869 INIT_WQ_LIST(&tctx->task_list);
@@ -7823,26 +7884,6 @@ void __io_uring_free(struct task_struct *tsk) · 14 unmodified lines
78237884 tsk->io_uring = NULL;
78247885 }
78257886
7826−static int io_sq_thread_fork(struct io_sq_data *sqd, struct io_ring_ctx *ctx)
7827−{
7828− struct task_struct *tsk;
7829− int ret;
7830−
7831− clear_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state);
7832− reinit_completion(&sqd->parked);
7833− ctx->sqo_exec = 0;
7834− sqd->task_pid = current->pid;
7835− tsk = create_io_thread(io_sq_thread, sqd, NUMA_NO_NODE);
7836− if (IS_ERR(tsk))
7837− return PTR_ERR(tsk);
7838− ret = io_uring_alloc_task_context(tsk, ctx);
7839− if (ret)
7840− set_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state);
7841− sqd->thread = tsk;
7842− wake_up_new_task(tsk);
7843− return ret;
7844−}
7845−
78467887 static int io_sq_offload_create(struct io_ring_ctx *ctx,
78477888 struct io_uring_params *p)
78487889 {
@@ -7865,29 +7906,36 @@ static int io_sq_offload_create(struct io_ring_ctx *ctx, · 16 unmodified lines
78657906 if (ctx->flags & IORING_SETUP_SQPOLL) {
78667907 struct task_struct *tsk;
78677908 struct io_sq_data *sqd;
7909+ bool attached;
78687910
78697911 ret = -EPERM;
78707912 if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_NICE))
78717913 goto err;
78727914
7873− sqd = io_get_sq_data(p);
7915+ sqd = io_get_sq_data(p, &attached);
78747916 if (IS_ERR(sqd)) {
78757917 ret = PTR_ERR(sqd);
78767918 goto err;
78777919 }
78787920
7921+ ctx->sq_creds = get_current_cred();
78797922 ctx->sq_data = sqd;
7880− io_sq_thread_park(sqd);
7881− mutex_lock(&sqd->ctx_lock);
7882− list_add(&ctx->sqd_list, &sqd->ctx_new_list);
7883− mutex_unlock(&sqd->ctx_lock);
7884− io_sq_thread_unpark(sqd);
7885−
78867923 ctx->sq_thread_idle = msecs_to_jiffies(p->sq_thread_idle);
78877924 if (!ctx->sq_thread_idle)
78887925 ctx->sq_thread_idle = HZ;
78897926
7890− if (sqd->thread)
7927+ ret = 0;
7928+ io_sq_thread_park(sqd);
7929+ list_add(&ctx->sqd_list, &sqd->ctx_list);
7930+ io_sqd_update_thread_idle(sqd);
7931+ /* don't attach to a dying SQPOLL thread, would be racy */
7932+ if (attached && !sqd->thread)
7933+ ret = -ENXIO;
7934+ io_sq_thread_unpark(sqd);
7935+
7936+ if (ret < 0)
7937+ goto err;
7938+ if (attached)
78917939 return 0;
78927940
78937941 if (p->flags & IORING_SETUP_SQ_AFF) {
@@ -7895,9 +7943,9 @@ static int io_sq_offload_create(struct io_ring_ctx *ctx, · 1 unmodified line
78957943
78967944 ret = -EINVAL;
78977945 if (cpu >= nr_cpu_ids)
7898− goto err;
7946+ goto err_sqpoll;
78997947 if (!cpu_online(cpu))
7900− goto err;
7948+ goto err_sqpoll;
79017949
79027950 sqd->sq_cpu = cpu;
79037951 } else {
@@ -7905,15 +7953,15 @@ static int io_sq_offload_create(struct io_ring_ctx *ctx, · 1 unmodified line
79057953 }
79067954
79077955 sqd->task_pid = current->pid;
7956+ sqd->task_tgid = current->tgid;
79087957 tsk = create_io_thread(io_sq_thread, sqd, NUMA_NO_NODE);
79097958 if (IS_ERR(tsk)) {
79107959 ret = PTR_ERR(tsk);
7911− goto err;
7960+ goto err_sqpoll;
79127961 }
7913− ret = io_uring_alloc_task_context(tsk, ctx);
7914− if (ret)
7915− set_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state);
7962+
79167963 sqd->thread = tsk;
7964+ ret = io_uring_alloc_task_context(tsk, ctx);
79177965 wake_up_new_task(tsk);
79187966 if (ret)
79197967 goto err;
@@ -7927,15 +7975,9 @@ static int io_sq_offload_create(struct io_ring_ctx *ctx, · 7 unmodified lines
79277975 err:
79287976 io_sq_thread_finish(ctx);
79297977 return ret;
7930−}
7931−
7932−static void io_sq_offload_start(struct io_ring_ctx *ctx)
7933−{
7934− struct io_sq_data *sqd = ctx->sq_data;
7935−
7936− ctx->flags &= ~IORING_SETUP_R_DISABLED;
7937− if (ctx->flags & IORING_SETUP_SQPOLL)
7938− complete(&sqd->startup);
7978+err_sqpoll:
7979+ complete(&ctx->sq_data->exited);
7980+ goto err;
79397981 }
79407982
79417983 static inline void __io_unaccount_mem(struct user_struct *user,
@@ -8345,19 +8387,13 @@ static int io_eventfd_unregister(struct io_ring_ctx *ctx) · 403 unmodified lines
83458387 return -ENXIO;
83468388 }
83478389
8348−static int __io_destroy_buffers(int id, void *p, void *data)
8349−{
8350− struct io_ring_ctx *ctx = data;
8351− struct io_buffer *buf = p;
8352−
8353− __io_remove_buffers(ctx, buf, id, -1U);
8354− return 0;
8355−}
8356−
83578390 static void io_destroy_buffers(struct io_ring_ctx *ctx)
83588391 {
8359− idr_for_each(&ctx->io_buffer_idr, __io_destroy_buffers, ctx);
8360− idr_destroy(&ctx->io_buffer_idr);
8392+ struct io_buffer *buf;
8393+ unsigned long index;
8394+
8395+ xa_for_each(&ctx->io_buffers, index, buf)
8396+ __io_remove_buffers(ctx, buf, index, -1U);
83618397 }
83628398
83638399 static void io_req_cache_free(struct list_head *list, struct task_struct *tsk)
@@ -8399,11 +8435,13 @@ static void io_ring_ctx_free(struct io_ring_ctx *ctx) · 35 unmodified lines
83998435 {
84008436 /*
84018437 * Some may use context even when all refs and requests have been put,
8402− * and they are free to do so while still holding uring_lock, see
8403− * __io_req_task_submit(). Wait for them to finish.
8438+ * and they are free to do so while still holding uring_lock or
8439+ * completion_lock, see __io_req_task_submit(). Wait for them to finish.
84048440 */
84058441 mutex_lock(&ctx->uring_lock);
84068442 mutex_unlock(&ctx->uring_lock);
8443+ spin_lock_irq(&ctx->completion_lock);
8444+ spin_unlock_irq(&ctx->completion_lock);
84078445
84088446 io_sq_thread_finish(ctx);
84098447 io_sqe_buffers_unregister(ctx);
@@ -8418,7 +8456,6 @@ static void io_ring_ctx_free(struct io_ring_ctx *ctx) · 8 unmodified lines
84188456 mutex_unlock(&ctx->uring_lock);
84198457 io_eventfd_unregister(ctx);
84208458 io_destroy_buffers(ctx);
8421− idr_destroy(&ctx->personality_idr);
84228459
84238460 #if defined(CONFIG_UNIX)
84248461 if (ctx->ring_sock) {
@@ -8483,7 +8520,7 @@ static int io_unregister_personality(struct io_ring_ctx *ctx, unsigned id) · 58 unmodified lines
84838520 {
84848521 const struct cred *creds;
84858522
8486− creds = idr_remove(&ctx->personality_idr, id);
8523+ creds = xa_erase(&ctx->personalities, id);
84878524 if (creds) {
84888525 put_cred(creds);
84898526 return 0;
@@ -8492,40 +8529,39 @@ static int io_unregister_personality(struct io_ring_ctx *ctx, unsigned id) · 2 unmodified lines
84928529 return -EINVAL;
84938530 }
84948531
8495−static int io_remove_personalities(int id, void *p, void *data)
8532+static inline bool io_run_ctx_fallback(struct io_ring_ctx *ctx)
84968533 {
8497− struct io_ring_ctx *ctx = data;
8498−
8499− io_unregister_personality(ctx, id);
8500− return 0;
8534+ return io_run_task_work_head(&ctx->exit_task_work);
85018535 }
85028536
8503−static bool io_run_ctx_fallback(struct io_ring_ctx *ctx)
8504−{
8505− struct callback_head *work, *next;
8506− bool executed = false;
8507−
8508− do {
8509− work = xchg(&ctx->exit_task_work, NULL);
8510− if (!work)
8511− break;
8537+struct io_tctx_exit {
8538+ struct callback_head task_work;
8539+ struct completion completion;
8540+ struct io_ring_ctx *ctx;
8541+};
85128542
8513− do {
8514− next = work->next;
8515− work->func(work);
8516− work = next;
8517− cond_resched();
8518− } while (work);
8519− executed = true;
8520− } while (1);
8543+static void io_tctx_exit_cb(struct callback_head *cb)
8544+{
8545+ struct io_uring_task *tctx = current->io_uring;
8546+ struct io_tctx_exit *work;
85218547
8522− return executed;
8548+ work = container_of(cb, struct io_tctx_exit, task_work);
8549+ /*
8550+ * When @in_idle, we're in cancellation and it's racy to remove the
8551+ * node. It'll be removed by the end of cancellation, just ignore it.
8552+ */
8553+ if (!atomic_read(&tctx->in_idle))
8554+ io_uring_del_task_file((unsigned long)work->ctx);
8555+ complete(&work->completion);
85238556 }
85248557
85258558 static void io_ring_exit_work(struct work_struct *work)
85268559 {
8527− struct io_ring_ctx *ctx = container_of(work, struct io_ring_ctx,
8528− exit_work);
8560+ struct io_ring_ctx *ctx = container_of(work, struct io_ring_ctx, exit_work);
8561+ unsigned long timeout = jiffies + HZ * 60 * 5;
8562+ struct io_tctx_exit exit;
8563+ struct io_tctx_node *node;
8564+ int ret;
85298565
85308566 /*
85318567 * If we're doing polled IO and end up having requests being
@@ -8535,21 +8571,57 @@ static void io_ring_exit_work(struct work_struct *work) · 3 unmodified lines
85358571 */
85368572 do {
85378573 io_uring_try_cancel_requests(ctx, NULL, NULL);
8574+
8575+ WARN_ON_ONCE(time_after(jiffies, timeout));
85388576 } while (!wait_for_completion_timeout(&ctx->ref_comp, HZ/20));
8577+
8578+ mutex_lock(&ctx->uring_lock);
8579+ while (!list_empty(&ctx->tctx_list)) {
8580+ WARN_ON_ONCE(time_after(jiffies, timeout));
8581+
8582+ node = list_first_entry(&ctx->tctx_list, struct io_tctx_node,
8583+ ctx_node);
8584+ exit.ctx = ctx;
8585+ init_completion(&exit.completion);
8586+ init_task_work(&exit.task_work, io_tctx_exit_cb);
8587+ ret = task_work_add(node->task, &exit.task_work, TWA_SIGNAL);
8588+ if (WARN_ON_ONCE(ret))
8589+ continue;
8590+ wake_up_process(node->task);
8591+
8592+ mutex_unlock(&ctx->uring_lock);
8593+ wait_for_completion(&exit.completion);
8594+ cond_resched();
8595+ mutex_lock(&ctx->uring_lock);
8596+ }
8597+ mutex_unlock(&ctx->uring_lock);
8598+
85398599 io_ring_ctx_free(ctx);
85408600 }
85418601
85428602 static void io_ring_ctx_wait_and_kill(struct io_ring_ctx *ctx)
85438603 {
8604+ unsigned long index;
8605+ struct creds *creds;
8606+
85448607 mutex_lock(&ctx->uring_lock);
85458608 percpu_ref_kill(&ctx->refs);
85468609 /* if force is set, the ring is going away. always drop after that */
85478610 ctx->cq_overflow_flushed = 1;
85488611 if (ctx->rings)
85498612 __io_cqring_overflow_flush(ctx, true, NULL, NULL);
8550− idr_for_each(&ctx->personality_idr, io_remove_personalities, ctx);
8613+ xa_for_each(&ctx->personalities, index, creds)
8614+ io_unregister_personality(ctx, index);
85518615 mutex_unlock(&ctx->uring_lock);
85528616
8617+ /* prevent SQPOLL from submitting new requests */
8618+ if (ctx->sq_data) {
8619+ io_sq_thread_park(ctx->sq_data);
8620+ list_del_init(&ctx->sqd_list);
8621+ io_sqd_update_thread_idle(ctx->sq_data);
8622+ io_sq_thread_unpark(ctx->sq_data);
8623+ }
8624+
85538625 io_kill_timeouts(ctx, NULL, NULL);
85548626 io_poll_remove_all(ctx, NULL, NULL);
85558627
@@ -8600,11 +8672,11 @@ static bool io_cancel_task_cb(struct io_wq_work *work, void *data) · 44 unmodified lines
86008672 return ret;
86018673 }
86028674
8603−static void io_cancel_defer_files(struct io_ring_ctx *ctx,
8675+static bool io_cancel_defer_files(struct io_ring_ctx *ctx,
86048676 struct task_struct *task,
86058677 struct files_struct *files)
86068678 {
8607− struct io_defer_entry *de = NULL;
8679+ struct io_defer_entry *de;
86088680 LIST_HEAD(list);
86098681
86108682 spin_lock_irq(&ctx->completion_lock);
@@ -8615,6 +8687,8 @@ static void io_cancel_defer_files(struct io_ring_ctx *ctx, · 4 unmodified lines
86158687 }
86168688 }
86178689 spin_unlock_irq(&ctx->completion_lock);
8690+ if (list_empty(&list))
8691+ return false;
86188692
86198693 while (!list_empty(&list)) {
86208694 de = list_first_entry(&list, struct io_defer_entry, list);
@@ -8624,6 +8698,38 @@ static void io_cancel_defer_files(struct io_ring_ctx *ctx, · 3 unmodified lines
86248698 io_req_complete(de->req, -ECANCELED);
86258699 kfree(de);
86268700 }
8701+ return true;
8702+}
8703+
8704+static bool io_cancel_ctx_cb(struct io_wq_work *work, void *data)
8705+{
8706+ struct io_kiocb *req = container_of(work, struct io_kiocb, work);
8707+
8708+ return req->ctx == data;
8709+}
8710+
8711+static bool io_uring_try_cancel_iowq(struct io_ring_ctx *ctx)
8712+{
8713+ struct io_tctx_node *node;
8714+ enum io_wq_cancel cret;
8715+ bool ret = false;
8716+
8717+ mutex_lock(&ctx->uring_lock);
8718+ list_for_each_entry(node, &ctx->tctx_list, ctx_node) {
8719+ struct io_uring_task *tctx = node->task->io_uring;
8720+
8721+ /*
8722+ * io_wq will stay alive while we hold uring_lock, because it's
8723+ * killed after ctx nodes, which requires to take the lock.
8724+ */
8725+ if (!tctx || !tctx->io_wq)
8726+ continue;
8727+ cret = io_wq_cancel_cb(tctx->io_wq, io_cancel_ctx_cb, ctx, true);
8728+ ret |= (cret != IO_WQ_CANCEL_NOTFOUND);
8729+ }
8730+ mutex_unlock(&ctx->uring_lock);
8731+
8732+ return ret;
86278733 }
86288734
86298735 static void io_uring_try_cancel_requests(struct io_ring_ctx *ctx,
@@ -8631,27 +8737,34 @@ static void io_uring_try_cancel_requests(struct io_ring_ctx *ctx, · 1 unmodified line
86318737 struct files_struct *files)
86328738 {
86338739 struct io_task_cancel cancel = { .task = task, .files = files, };
8634− struct task_struct *tctx_task = task ?: current;
8635− struct io_uring_task *tctx = tctx_task->io_uring;
8740+ struct io_uring_task *tctx = task ? task->io_uring : NULL;
86368741
86378742 while (1) {
86388743 enum io_wq_cancel cret;
86398744 bool ret = false;
86408745
8641− if (tctx && tctx->io_wq) {
8746+ if (!task) {
8747+ ret |= io_uring_try_cancel_iowq(ctx);
8748+ } else if (tctx && tctx->io_wq) {
8749+ /*
8750+ * Cancels requests of all rings, not only @ctx, but
8751+ * it's fine as the task is in exit/exec.
8752+ */
86428753 cret = io_wq_cancel_cb(tctx->io_wq, io_cancel_task_cb,
86438754 &cancel, true);
86448755 ret |= (cret != IO_WQ_CANCEL_NOTFOUND);
86458756 }
86468757
86478758 /* SQPOLL thread does its own polling */
8648− if (!(ctx->flags & IORING_SETUP_SQPOLL) && !files) {
8759+ if ((!(ctx->flags & IORING_SETUP_SQPOLL) && !files) ||
8760+ (ctx->sq_data && ctx->sq_data->thread == current)) {
86498761 while (!list_empty_careful(&ctx->iopoll_list)) {
86508762 io_iopoll_try_reap_events(ctx);
86518763 ret = true;
86528764 }
86538765 }
86548766
8767+ ret |= io_cancel_defer_files(ctx, task, files);
86558768 ret |= io_poll_remove_all(ctx, task, files);
86568769 ret |= io_kill_timeouts(ctx, task, files);
86578770 ret |= io_run_task_work();
@@ -8691,58 +8804,21 @@ static void io_uring_cancel_files(struct io_ring_ctx *ctx, · 33 unmodified lines
86918804
86928805 io_uring_try_cancel_requests(ctx, task, files);
86938806
8694− if (ctx->sq_data)
8695− io_sq_thread_unpark(ctx->sq_data);
86968807 prepare_to_wait(&task->io_uring->wait, &wait,
86978808 TASK_UNINTERRUPTIBLE);
86988809 if (inflight == io_uring_count_inflight(ctx, task, files))
86998810 schedule();
87008811 finish_wait(&task->io_uring->wait, &wait);
8701− if (ctx->sq_data)
8702− io_sq_thread_park(ctx->sq_data);
8703− }
8704−}
8705−
8706−/*
8707− * We need to iteratively cancel requests, in case a request has dependent
8708− * hard links. These persist even for failure of cancelations, hence keep
8709− * looping until none are found.
8710− */
8711−static void io_uring_cancel_task_requests(struct io_ring_ctx *ctx,
8712− struct files_struct *files)
8713−{
8714− struct task_struct *task = current;
8715−
8716− if ((ctx->flags & IORING_SETUP_SQPOLL) && ctx->sq_data) {
8717− /* never started, nothing to cancel */
8718− if (ctx->flags & IORING_SETUP_R_DISABLED) {
8719− io_sq_offload_start(ctx);
8720− return;
8721− }
8722− io_sq_thread_park(ctx->sq_data);
8723− task = ctx->sq_data->thread;
8724− if (task)
8725− atomic_inc(&task->io_uring->in_idle);
87268812 }
8727−
8728− io_cancel_defer_files(ctx, task, files);
8729−
8730− io_uring_cancel_files(ctx, task, files);
8731− if (!files)
8732− io_uring_try_cancel_requests(ctx, task, NULL);
8733−
8734− if (task)
8735− atomic_dec(&task->io_uring->in_idle);
8736− if (ctx->sq_data)
8737− io_sq_thread_unpark(ctx->sq_data);
87388813 }
87398814
87408815 /*
87418816 * Note that this task has used io_uring. We use it for cancelation purposes.
87428817 */
8743−static int io_uring_add_task_file(struct io_ring_ctx *ctx, struct file *file)
8818+static int io_uring_add_task_file(struct io_ring_ctx *ctx)
87448819 {
87458820 struct io_uring_task *tctx = current->io_uring;
8821+ struct io_tctx_node *node;
87468822 int ret;
87478823
87488824 if (unlikely(!tctx)) {
@@ -8751,102 +8827,151 @@ static int io_uring_add_task_file(struct io_ring_ctx *ctx, struct file *file) · 2 unmodified lines
87518827 return ret;
87528828 tctx = current->io_uring;
87538829 }
8754− if (tctx->last != file) {
8755− void *old = xa_load(&tctx->xa, (unsigned long)file);
8830+ if (tctx->last != ctx) {
8831+ void *old = xa_load(&tctx->xa, (unsigned long)ctx);
87568832
87578833 if (!old) {
8758− get_file(file);
8759− ret = xa_err(xa_store(&tctx->xa, (unsigned long)file,
8760− file, GFP_KERNEL));
8834+ node = kmalloc(sizeof(*node), GFP_KERNEL);
8835+ if (!node)
8836+ return -ENOMEM;
8837+ node->ctx = ctx;
8838+ node->task = current;
8839+
8840+ ret = xa_err(xa_store(&tctx->xa, (unsigned long)ctx,
8841+ node, GFP_KERNEL));
87618842 if (ret) {
8762− fput(file);
8843+ kfree(node);
87638844 return ret;
87648845 }
8846+
8847+ mutex_lock(&ctx->uring_lock);
8848+ list_add(&node->ctx_node, &ctx->tctx_list);
8849+ mutex_unlock(&ctx->uring_lock);
87658850 }
8766− tctx->last = file;
8851+ tctx->last = ctx;
87678852 }
8768−
8769− /*
8770− * This is race safe in that the task itself is doing this, hence it
8771− * cannot be going through the exit/cancel paths at the same time.
8772− * This cannot be modified while exit/cancel is running.
8773− */
8774− if (!tctx->sqpoll && (ctx->flags & IORING_SETUP_SQPOLL))
8775− tctx->sqpoll = true;
8776−
87778853 return 0;
87788854 }
87798855
87808856 /*
87818857 * Remove this io_uring_file -> task mapping.
87828858 */
8783−static void io_uring_del_task_file(struct file *file)
8859+static void io_uring_del_task_file(unsigned long index)
87848860 {
87858861 struct io_uring_task *tctx = current->io_uring;
8862+ struct io_tctx_node *node;
8863+
8864+ if (!tctx)
8865+ return;
8866+ node = xa_erase(&tctx->xa, index);
8867+ if (!node)
8868+ return;
8869+
8870+ WARN_ON_ONCE(current != node->task);
8871+ WARN_ON_ONCE(list_empty(&node->ctx_node));
8872+
8873+ mutex_lock(&node->ctx->uring_lock);
8874+ list_del(&node->ctx_node);
8875+ mutex_unlock(&node->ctx->uring_lock);
87868876
8787− if (tctx->last == file)
8877+ if (tctx->last == node->ctx)
87888878 tctx->last = NULL;
8789− file = xa_erase(&tctx->xa, (unsigned long)file);
8790− if (file)
8791− fput(file);
8879+ kfree(node);
87928880 }
87938881
87948882 static void io_uring_clean_tctx(struct io_uring_task *tctx)
87958883 {
8796− struct file *file;
8884+ struct io_tctx_node *node;
87978885 unsigned long index;
87988886
8799− xa_for_each(&tctx->xa, index, file)
8800− io_uring_del_task_file(file);
8887+ xa_for_each(&tctx->xa, index, node)
8888+ io_uring_del_task_file(index);
88018889 if (tctx->io_wq) {
88028890 io_wq_put_and_exit(tctx->io_wq);
88038891 tctx->io_wq = NULL;
88048892 }
88058893 }
88068894
8895+static s64 tctx_inflight(struct io_uring_task *tctx)
8896+{
8897+ return percpu_counter_sum(&tctx->inflight);
8898+}
8899+
8900+static void io_sqpoll_cancel_cb(struct callback_head *cb)
8901+{
8902+ struct io_tctx_exit *work = container_of(cb, struct io_tctx_exit, task_work);
8903+ struct io_ring_ctx *ctx = work->ctx;
8904+ struct io_sq_data *sqd = ctx->sq_data;
8905+
8906+ if (sqd->thread)
8907+ io_uring_cancel_sqpoll(ctx);
8908+ complete(&work->completion);
8909+}
8910+
8911+static void io_sqpoll_cancel_sync(struct io_ring_ctx *ctx)
8912+{
8913+ struct io_sq_data *sqd = ctx->sq_data;
8914+ struct io_tctx_exit work = { .ctx = ctx, };
8915+ struct task_struct *task;
8916+
8917+ io_sq_thread_park(sqd);
8918+ list_del_init(&ctx->sqd_list);
8919+ io_sqd_update_thread_idle(sqd);
8920+ task = sqd->thread;
8921+ if (task) {
8922+ init_completion(&work.completion);
8923+ init_task_work(&work.task_work, io_sqpoll_cancel_cb);
8924+ io_task_work_add_head(&sqd->park_task_work, &work.task_work);
8925+ wake_up_process(task);
8926+ }
8927+ io_sq_thread_unpark(sqd);
8928+
8929+ if (task)
8930+ wait_for_completion(&work.completion);
8931+}
8932+
88078933 void __io_uring_files_cancel(struct files_struct *files)
88088934 {
88098935 struct io_uring_task *tctx = current->io_uring;
8810− struct file *file;
8936+ struct io_tctx_node *node;
88118937 unsigned long index;
88128938
88138939 /* make sure overflow events are dropped */
88148940 atomic_inc(&tctx->in_idle);
8815− xa_for_each(&tctx->xa, index, file)
8816− io_uring_cancel_task_requests(file->private_data, files);
8941+ xa_for_each(&tctx->xa, index, node) {
8942+ struct io_ring_ctx *ctx = node->ctx;
8943+
8944+ if (ctx->sq_data) {
8945+ io_sqpoll_cancel_sync(ctx);
8946+ continue;
8947+ }
8948+ io_uring_cancel_files(ctx, current, files);
8949+ if (!files)
8950+ io_uring_try_cancel_requests(ctx, current, NULL);
8951+ }
88178952 atomic_dec(&tctx->in_idle);
88188953
88198954 if (files)
88208955 io_uring_clean_tctx(tctx);
88218956 }
88228957
8823−static s64 tctx_inflight(struct io_uring_task *tctx)
8824−{
8825− return percpu_counter_sum(&tctx->inflight);
8826−}
8827−
8958+/* should only be called by SQPOLL task */
88288959 static void io_uring_cancel_sqpoll(struct io_ring_ctx *ctx)
88298960 {
88308961 struct io_sq_data *sqd = ctx->sq_data;
8831− struct io_uring_task *tctx;
8962+ struct io_uring_task *tctx = current->io_uring;
88328963 s64 inflight;
88338964 DEFINE_WAIT(wait);
88348965
8835− if (!sqd)
8836− return;
8837− io_sq_thread_park(sqd);
8838− if (!sqd->thread || !sqd->thread->io_uring) {
8839− io_sq_thread_unpark(sqd);
8840− return;
8841− }
8842− tctx = ctx->sq_data->thread->io_uring;
8966+ WARN_ON_ONCE(!sqd || ctx->sq_data->thread != current);
8967+
88438968 atomic_inc(&tctx->in_idle);
88448969 do {
88458970 /* read completions before cancelations */
88468971 inflight = tctx_inflight(tctx);
88478972 if (!inflight)
88488973 break;
8849− io_uring_cancel_task_requests(ctx, NULL);
8974+ io_uring_try_cancel_requests(ctx, current, NULL);
88508975
88518976 prepare_to_wait(&tctx->wait, &wait, TASK_UNINTERRUPTIBLE);
88528977 /*
@@ -8859,7 +8984,6 @@ static void io_uring_cancel_sqpoll(struct io_ring_ctx *ctx) · 6 unmodified lines
88598984 finish_wait(&tctx->wait, &wait);
88608985 } while (1);
88618986 atomic_dec(&tctx->in_idle);
8862− io_sq_thread_unpark(sqd);
88638987 }
88648988
88658989 /*
@@ -8874,15 +8998,6 @@ void __io_uring_task_cancel(void) · 8 unmodified lines
88748998
88758999 /* make sure overflow events are dropped */
88769000 atomic_inc(&tctx->in_idle);
8877−
8878− if (tctx->sqpoll) {
8879− struct file *file;
8880− unsigned long index;
8881−
8882− xa_for_each(&tctx->xa, index, file)
8883− io_uring_cancel_sqpoll(file->private_data);
8884− }
8885−
88869001 do {
88879002 /* read completions before cancelations */
88889003 inflight = tctx_inflight(tctx);
@@ -8981,7 +9096,6 @@ static unsigned long io_uring_nommu_get_unmapped_area(struct file *file, · 92 unmodified lines
89819096
89829097 static int io_sqpoll_wait_sq(struct io_ring_ctx *ctx)
89839098 {
8984− int ret = 0;
89859099 DEFINE_WAIT(wait);
89869100
89879101 do {
@@ -8995,7 +9109,7 @@ static int io_sqpoll_wait_sq(struct io_ring_ctx *ctx) · 7 unmodified lines
89959109 } while (!signal_pending(current));
89969110
89979111 finish_wait(&ctx->sqo_sq_wait, &wait);
8998− return ret;
9112+ return 0;
89999113 }
90009114
90019115 static int io_get_ext_arg(unsigned flags, const void __user *argp, size_t *argsz,
@@ -9069,13 +9183,10 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit, · 67 unmodified lines
90699183 if (ctx->flags & IORING_SETUP_SQPOLL) {
90709184 io_cqring_overflow_flush(ctx, false, NULL, NULL);
90719185
9072− if (unlikely(ctx->sqo_exec)) {
9073− ret = io_sq_thread_fork(ctx->sq_data, ctx);
9074− if (ret)
9075− goto out;
9076− ctx->sqo_exec = 0;
9077− }
90789186 ret = -EOWNERDEAD;
9187+ if (unlikely(ctx->sq_data->thread == NULL)) {
9188+ goto out;
9189+ }
90799190 if (flags & IORING_ENTER_SQ_WAKEUP)
90809191 wake_up(&ctx->sq_data->wait);
90819192 if (flags & IORING_ENTER_SQ_WAIT) {
@@ -9085,7 +9196,7 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit, · 3 unmodified lines
90859196 }
90869197 submitted = to_submit;
90879198 } else if (to_submit) {
9088− ret = io_uring_add_task_file(ctx, f.file);
9199+ ret = io_uring_add_task_file(ctx);
90899200 if (unlikely(ret))
90909201 goto out;
90919202 mutex_lock(&ctx->uring_lock);
@@ -9127,10 +9238,9 @@ out_fput: · 35 unmodified lines
91279238 }
91289239
91299240 #ifdef CONFIG_PROC_FS
9130−static int io_uring_show_cred(int id, void *p, void *data)
9241+static int io_uring_show_cred(struct seq_file *m, unsigned int id,
9242+ const struct cred *cred)
91319243 {
9132− const struct cred *cred = p;
9133− struct seq_file *m = data;
91349244 struct user_namespace *uns = seq_user_ns(m);
91359245 struct group_info *gi;
91369246 kernel_cap_t cap;
@@ -9198,9 +9308,13 @@ static void __io_uring_show_fdinfo(struct io_ring_ctx *ctx, struct seq_file *m) · 61 unmodified lines
91989308 seq_printf(m, "%5u: 0x%llx/%u\n", i, buf->ubuf,
91999309 (unsigned int) buf->len);
92009310 }
9201− if (has_lock && !idr_is_empty(&ctx->personality_idr)) {
9311+ if (has_lock && !xa_empty(&ctx->personalities)) {
9312+ unsigned long index;
9313+ const struct cred *cred;
9314+
92029315 seq_printf(m, "Personalities:\n");
9203− idr_for_each(&ctx->personality_idr, io_uring_show_cred, m);
9316+ xa_for_each(&ctx->personalities, index, cred)
9317+ io_uring_show_cred(m, index, cred);
92049318 }
92059319 seq_printf(m, "PollList:\n");
92069320 spin_lock_irq(&ctx->completion_lock);
@@ -9294,7 +9408,7 @@ static int io_uring_install_fd(struct io_ring_ctx *ctx, struct file *file) · 87 unmodified lines
92949408 if (fd < 0)
92959409 return fd;
92969410
9297− ret = io_uring_add_task_file(ctx, file);
9411+ ret = io_uring_add_task_file(ctx);
92989412 if (ret) {
92999413 put_unused_fd(fd);
93009414 return ret;
@@ -9402,9 +9516,6 @@ static int io_uring_create(unsigned entries, struct io_uring_params *p, · 101 unmodified lines
94029516 if (ret)
94039517 goto err;
94049518
9405− if (!(p->flags & IORING_SETUP_R_DISABLED))
9406− io_sq_offload_start(ctx);
9407−
94089519 memset(&p->sq_off, 0, sizeof(p->sq_off));
94099520 p->sq_off.head = offsetof(struct io_rings, sq.head);
94109521 p->sq_off.tail = offsetof(struct io_rings, sq.tail);
@@ -9532,14 +9643,16 @@ out: · 121 unmodified lines
95329643 static int io_register_personality(struct io_ring_ctx *ctx)
95339644 {
95349645 const struct cred *creds;
9646+ u32 id;
95359647 int ret;
95369648
95379649 creds = get_current_cred();
95389650
9539− ret = idr_alloc_cyclic(&ctx->personality_idr, (void *) creds, 1,
9540− USHRT_MAX, GFP_KERNEL);
9541− if (ret < 0)
9542− put_cred(creds);
9651+ ret = xa_alloc_cyclic(&ctx->personalities, &id, (void *)creds,
9652+ XA_LIMIT(0, USHRT_MAX), &ctx->pers_next, GFP_KERNEL);
9653+ if (!ret)
9654+ return id;
9655+ put_cred(creds);
95439656 return ret;
95449657 }
95459658
@@ -9621,7 +9734,9 @@ static int io_register_enable_rings(struct io_ring_ctx *ctx) · 75 unmodified lines
96219734 if (ctx->restrictions.registered)
96229735 ctx->restricted = 1;
96239736
9624− io_sq_offload_start(ctx);
9737+ ctx->flags &= ~IORING_SETUP_R_DISABLED;
9738+ if (ctx->sq_data && wq_has_sleeper(&ctx->sq_data->wait))
9739+ wake_up(&ctx->sq_data->wait);
96259740 return 0;
96269741 }
96279742
fs/iomap/buffered-io.c+2−2
@@ -1221,7 +1221,7 @@ iomap_alloc_ioend(struct inode *inode, struct iomap_writepage_ctx *wpc, · 1220 unmodified lines
12211221 struct iomap_ioend *ioend;
12221222 struct bio *bio;
12231223
1224− bio = bio_alloc_bioset(GFP_NOFS, BIO_MAX_PAGES, &iomap_ioend_bioset);
1224+ bio = bio_alloc_bioset(GFP_NOFS, BIO_MAX_VECS, &iomap_ioend_bioset);
12251225 bio_set_dev(bio, wpc->iomap.bdev);
12261226 bio->bi_iter.bi_sector = sector;
12271227 bio->bi_opf = REQ_OP_WRITE | wbc_to_write_flags(wbc);
@@ -1252,7 +1252,7 @@ iomap_chain_bio(struct bio *prev) · 24 unmodified lines
12521252 {
12531253 struct bio *new;
12541254
1255− new = bio_alloc(GFP_NOFS, BIO_MAX_PAGES);
1255+ new = bio_alloc(GFP_NOFS, BIO_MAX_VECS);
12561256 bio_copy_dev(new, prev);/* also copies over blkcg information */
12571257 new->bi_iter.bi_sector = bio_end_sector(prev);
12581258 new->bi_opf = prev->bi_opf;
fs/iomap/direct-io.c+2−2
@@ -296,7 +296,7 @@ iomap_dio_bio_actor(struct inode *inode, loff_t pos, loff_t length, · 295 unmodified lines
296296 */
297297 bio_opf = iomap_dio_bio_opflags(dio, iomap, use_fua);
298298
299− nr_pages = bio_iov_vecs_to_alloc(dio->submit.iter, BIO_MAX_PAGES);
299+ nr_pages = bio_iov_vecs_to_alloc(dio->submit.iter, BIO_MAX_VECS);
300300 do {
301301 size_t n;
302302 if (dio->error) {
@@ -338,7 +338,7 @@ iomap_dio_bio_actor(struct inode *inode, loff_t pos, loff_t length, · 35 unmodified lines
338338 copied += n;
339339
340340 nr_pages = bio_iov_vecs_to_alloc(dio->submit.iter,
341− BIO_MAX_PAGES);
341+ BIO_MAX_VECS);
342342 iomap_dio_submit_bio(dio, iomap, bio, pos);
343343 pos += n;
344344 } while (nr_pages);
fs/iomap/swapfile.c+10−0
@@ -170,6 +170,16 @@ int iomap_swapfile_activate(struct swap_info_struct *sis, · 169 unmodified lines
170170 return ret;
171171 }
172172
173+ /*
174+ * If this swapfile doesn't contain even a single page-aligned
175+ * contiguous range of blocks, reject this useless swapfile to
176+ * prevent confusion later on.
177+ */
178+ if (isi.nr_pages == 0) {
179+ pr_warn("swapon: Cannot find a single usable page in file.\n");
180+ return -EINVAL;
181+ }
182+
173183 *pagespan = 1 + isi.highest_ppage - isi.lowest_ppage;
174184 sis->max = isi.nr_pages;
175185 sis->pages = isi.nr_pages - 1;
fs/locks.c+0−3
@@ -1808,9 +1808,6 @@ check_conflicting_open(struct file *filp, const long arg, int flags) · 1807 unmodified lines
18081808
18091809 if (flags & FL_LAYOUT)
18101810 return 0;
1811− if (flags & FL_DELEG)
1812− /* We leave these checks to the caller. */
1813− return 0;
18141811
18151812 if (arg == F_RDLCK)
18161813 return inode_is_open_for_write(inode) ? -EAGAIN : 0;
fs/mpage.c+1−1
@@ -616,7 +616,7 @@ alloc_new: · 615 unmodified lines
616616 goto out;
617617 }
618618 bio = mpage_alloc(bdev, blocks[0] << (blkbits - 9),
619− BIO_MAX_PAGES, GFP_NOFS|__GFP_HIGH);
619+ BIO_MAX_VECS, GFP_NOFS|__GFP_HIGH);
620620 if (bio == NULL)
621621 goto confused;
622622
fs/nfs/Kconfig+1−1
@@ -127,7 +127,7 @@ config PNFS_BLOCK · 126 unmodified lines
127127 config PNFS_FLEXFILE_LAYOUT
128128 tristate
129129 depends on NFS_V4_1 && NFS_V3
130− default m
130+ default NFS_V4
131131
132132 config NFS_V4_1_IMPLEMENTATION_ID_DOMAIN
133133 string "NFSv4.1 Implementation ID Domain"
fs/nfs/dir.c+33−25
@@ -81,8 +81,9 @@ static struct nfs_open_dir_context *alloc_nfs_open_dir_context(struct inode *dir · 80 unmodified lines
8181 spin_lock(&dir->i_lock);
8282 if (list_empty(&nfsi->open_files) &&
8383 (nfsi->cache_validity & NFS_INO_DATA_INVAL_DEFER))
84− nfsi->cache_validity |= NFS_INO_INVALID_DATA |
85− NFS_INO_REVAL_FORCED;
84+ nfs_set_cache_invalid(dir,
85+ NFS_INO_INVALID_DATA |
86+ NFS_INO_REVAL_FORCED);
8687 list_add(&ctx->list, &nfsi->open_files);
8788 spin_unlock(&dir->i_lock);
8889 return ctx;
@@ -1401,6 +1402,13 @@ out_force: · 1312 unmodified lines
14011402 goto out;
14021403 }
14031404
1405+static void nfs_mark_dir_for_revalidate(struct inode *inode)
1406+{
1407+ spin_lock(&inode->i_lock);
1408+ nfs_set_cache_invalid(inode, NFS_INO_REVAL_PAGECACHE);
1409+ spin_unlock(&inode->i_lock);
1410+}
1411+
14041412 /*
14051413 * We judge how long we want to trust negative
14061414 * dentries by looking at the parent inode mtime.
@@ -1435,19 +1443,14 @@ nfs_lookup_revalidate_done(struct inode *dir, struct dentry *dentry, · 28 unmodified lines
14351443 __func__, dentry);
14361444 return 1;
14371445 case 0:
1438− nfs_mark_for_revalidate(dir);
1439− if (inode && S_ISDIR(inode->i_mode)) {
1440− /* Purge readdir caches. */
1441− nfs_zap_caches(inode);
1442− /*
1443− * We can't d_drop the root of a disconnected tree:
1444− * its d_hash is on the s_anon list and d_drop() would hide
1445− * it from shrink_dcache_for_unmount(), leading to busy
1446− * inodes on unmount and further oopses.
1447− */
1448− if (IS_ROOT(dentry))
1449− return 1;
1450− }
1446+ /*
1447+ * We can't d_drop the root of a disconnected tree:
1448+ * its d_hash is on the s_anon list and d_drop() would hide
1449+ * it from shrink_dcache_for_unmount(), leading to busy
1450+ * inodes on unmount and further oopses.
1451+ */
1452+ if (inode && IS_ROOT(dentry))
1453+ return 1;
14511454 dfprintk(LOOKUPCACHE, "NFS: %s(%pd2) is invalid\n",
14521455 __func__, dentry);
14531456 return 0;
@@ -1525,6 +1528,13 @@ out: · 71 unmodified lines
15251528 nfs_free_fattr(fattr);
15261529 nfs_free_fhandle(fhandle);
15271530 nfs4_label_free(label);
1531+
1532+ /*
1533+ * If the lookup failed despite the dentry change attribute being
1534+ * a match, then we should revalidate the directory cache.
1535+ */
1536+ if (!ret && nfs_verify_change_attribute(dir, dentry->d_time))
1537+ nfs_mark_dir_for_revalidate(dir);
15281538 return nfs_lookup_revalidate_done(dir, dentry, inode, ret);
15291539 }
15301540
@@ -1567,7 +1577,7 @@ nfs_do_lookup_revalidate(struct inode *dir, struct dentry *dentry, · 36 unmodified lines
15671577 error = nfs_lookup_verify_inode(inode, flags);
15681578 if (error) {
15691579 if (error == -ESTALE)
1570− nfs_zap_caches(dir);
1580+ nfs_mark_dir_for_revalidate(dir);
15711581 goto out_bad;
15721582 }
15731583 nfs_advise_use_readdirplus(dir);
@@ -1691,10 +1701,9 @@ static void nfs_drop_nlink(struct inode *inode) · 117 unmodified lines
16911701 if (inode->i_nlink > 0)
16921702 drop_nlink(inode);
16931703 NFS_I(inode)->attr_gencount = nfs_inc_attr_generation_counter();
1694− NFS_I(inode)->cache_validity |= NFS_INO_INVALID_CHANGE
1695− | NFS_INO_INVALID_CTIME
1696− | NFS_INO_INVALID_OTHER
1697− | NFS_INO_REVAL_FORCED;
1704+ nfs_set_cache_invalid(
1705+ inode, NFS_INO_INVALID_CHANGE | NFS_INO_INVALID_CTIME |
1706+ NFS_INO_INVALID_OTHER | NFS_INO_REVAL_FORCED);
16981707 spin_unlock(&inode->i_lock);
16991708 }
17001709
@@ -1706,7 +1715,7 @@ static void nfs_dentry_iput(struct dentry *dentry, struct inode *inode) · 5 unmodified lines
17061715 {
17071716 if (S_ISDIR(inode->i_mode))
17081717 /* drop any readdir cache as it could easily be old */
1709− NFS_I(inode)->cache_validity |= NFS_INO_INVALID_DATA;
1718+ nfs_set_cache_invalid(inode, NFS_INO_INVALID_DATA);
17101719
17111720 if (dentry->d_flags & DCACHE_NFSFS_RENAMED) {
17121721 nfs_complete_unlink(dentry, inode);
@@ -2064,7 +2073,6 @@ out: · 351 unmodified lines
20642073 dput(parent);
20652074 return d;
20662075 out_error:
2067− nfs_mark_for_revalidate(dir);
20682076 d = ERR_PTR(error);
20692077 goto out;
20702078 }
@@ -2473,9 +2481,9 @@ int nfs_rename(struct user_namespace *mnt_userns, struct inode *old_dir, · 402 unmodified lines
24732481 if (error == 0) {
24742482 spin_lock(&old_inode->i_lock);
24752483 NFS_I(old_inode)->attr_gencount = nfs_inc_attr_generation_counter();
2476− NFS_I(old_inode)->cache_validity |= NFS_INO_INVALID_CHANGE
2477− | NFS_INO_INVALID_CTIME
2478− | NFS_INO_REVAL_FORCED;
2484+ nfs_set_cache_invalid(old_inode, NFS_INO_INVALID_CHANGE |
2485+ NFS_INO_INVALID_CTIME |
2486+ NFS_INO_REVAL_FORCED);
24792487 spin_unlock(&old_inode->i_lock);
24802488 }
24812489 out:
fs/nfs/inode.c+4−3
@@ -207,7 +207,7 @@ static bool nfs_has_xattr_cache(const struct nfs_inode *nfsi) · 206 unmodified lines
207207 }
208208 #endif
209209
210−static void nfs_set_cache_invalid(struct inode *inode, unsigned long flags)
210+void nfs_set_cache_invalid(struct inode *inode, unsigned long flags)
211211 {
212212 struct nfs_inode *nfsi = NFS_I(inode);
213213 bool have_delegation = NFS_PROTO(inode)->have_delegation(inode, FMODE_READ);
@@ -229,6 +229,7 @@ static void nfs_set_cache_invalid(struct inode *inode, unsigned long flags) · 15 unmodified lines
229229 if (flags & NFS_INO_INVALID_DATA)
230230 nfs_fscache_invalidate(inode);
231231 }
232+EXPORT_SYMBOL_GPL(nfs_set_cache_invalid);
232233
233234 /*
234235 * Invalidate the local caches
@@ -1067,8 +1068,8 @@ void nfs_inode_attach_open_context(struct nfs_open_context *ctx) · 832 unmodified lines
10671068 spin_lock(&inode->i_lock);
10681069 if (list_empty(&nfsi->open_files) &&
10691070 (nfsi->cache_validity & NFS_INO_DATA_INVAL_DEFER))
1070− nfsi->cache_validity |= NFS_INO_INVALID_DATA |
1071− NFS_INO_REVAL_FORCED;
1071+ nfs_set_cache_invalid(inode, NFS_INO_INVALID_DATA |
1072+ NFS_INO_REVAL_FORCED);
10721073 list_add_tail_rcu(&ctx->list, &nfsi->open_files);
10731074 spin_unlock(&inode->i_lock);
10741075 }
fs/nfs/internal.h+2−1
@@ -411,7 +411,8 @@ extern int nfs_write_inode(struct inode *, struct writeback_control *); · 410 unmodified lines
411411 extern int nfs_drop_inode(struct inode *);
412412 extern void nfs_clear_inode(struct inode *);
413413 extern void nfs_evict_inode(struct inode *);
414−void nfs_zap_acl_cache(struct inode *inode);
414+extern void nfs_zap_acl_cache(struct inode *inode);
415+extern void nfs_set_cache_invalid(struct inode *inode, unsigned long flags);
415416 extern bool nfs_check_cache_invalid(struct inode *, unsigned long);
416417 extern int nfs_wait_bit_killable(struct wait_bit_key *key, int mode);
417418 extern int nfs_wait_atomic_killable(atomic_t *p, unsigned int mode);
fs/nfs/nfs3xdr.c+2−1
@@ -36,6 +36,7 @@ · 35 unmodified lines
3636 #define NFS3_pagepad_sz (1) /* Page padding */
3737 #define NFS3_fhandle_sz (1+16)
3838 #define NFS3_fh_sz (NFS3_fhandle_sz) /* shorthand */
39+#define NFS3_post_op_fh_sz (1+NFS3_fh_sz)
3940 #define NFS3_sattr_sz (15)
4041 #define NFS3_filename_sz (1+(NFS3_MAXNAMLEN>>2))
4142 #define NFS3_path_sz (1+(NFS3_MAXPATHLEN>>2))
@@ -73,7 +74,7 @@ · 31 unmodified lines
7374 #define NFS3_readlinkres_sz (1+NFS3_post_op_attr_sz+1+NFS3_pagepad_sz)
7475 #define NFS3_readres_sz (1+NFS3_post_op_attr_sz+3+NFS3_pagepad_sz)
7576 #define NFS3_writeres_sz (1+NFS3_wcc_data_sz+4)
76−#define NFS3_createres_sz (1+NFS3_fh_sz+NFS3_post_op_attr_sz+NFS3_wcc_data_sz)
77+#define NFS3_createres_sz (1+NFS3_post_op_fh_sz+NFS3_post_op_attr_sz+NFS3_wcc_data_sz)
7778 #define NFS3_renameres_sz (1+(2 * NFS3_wcc_data_sz))
7879 #define NFS3_linkres_sz (1+NFS3_post_op_attr_sz+NFS3_wcc_data_sz)
7980 #define NFS3_readdirres_sz (1+NFS3_post_op_attr_sz+2+NFS3_pagepad_sz)
fs/nfs/nfs42proc.c+7−5
@@ -357,13 +357,15 @@ static ssize_t _nfs42_proc_copy(struct file *src, · 356 unmodified lines
357357 truncate_pagecache_range(dst_inode, pos_dst,
358358 pos_dst + res->write_res.count);
359359 spin_lock(&dst_inode->i_lock);
360− NFS_I(dst_inode)->cache_validity |= (NFS_INO_REVAL_PAGECACHE |
361− NFS_INO_REVAL_FORCED | NFS_INO_INVALID_SIZE |
362− NFS_INO_INVALID_ATTR | NFS_INO_INVALID_DATA);
360+ nfs_set_cache_invalid(
361+ dst_inode, NFS_INO_REVAL_PAGECACHE | NFS_INO_REVAL_FORCED |
362+ NFS_INO_INVALID_SIZE | NFS_INO_INVALID_ATTR |
363+ NFS_INO_INVALID_DATA);
363364 spin_unlock(&dst_inode->i_lock);
364365 spin_lock(&src_inode->i_lock);
365− NFS_I(src_inode)->cache_validity |= (NFS_INO_REVAL_PAGECACHE |
366− NFS_INO_REVAL_FORCED | NFS_INO_INVALID_ATIME);
366+ nfs_set_cache_invalid(src_inode, NFS_INO_REVAL_PAGECACHE |
367+ NFS_INO_REVAL_FORCED |
368+ NFS_INO_INVALID_ATIME);
367369 spin_unlock(&src_inode->i_lock);
368370 status = res->write_res.count;
369371 out:
fs/nfs/nfs4proc.c+16−17
@@ -1169,14 +1169,14 @@ int nfs4_call_sync(struct rpc_clnt *clnt, · 1168 unmodified lines
11691169 static void
11701170 nfs4_inc_nlink_locked(struct inode *inode)
11711171 {
1172− NFS_I(inode)->cache_validity |= NFS_INO_INVALID_OTHER;
1172+ nfs_set_cache_invalid(inode, NFS_INO_INVALID_OTHER);
11731173 inc_nlink(inode);
11741174 }
11751175
11761176 static void
11771177 nfs4_dec_nlink_locked(struct inode *inode)
11781178 {
1179− NFS_I(inode)->cache_validity |= NFS_INO_INVALID_OTHER;
1179+ nfs_set_cache_invalid(inode, NFS_INO_INVALID_OTHER);
11801180 drop_nlink(inode);
11811181 }
11821182
@@ -1187,35 +1187,31 @@ nfs4_update_changeattr_locked(struct inode *inode, · 4 unmodified lines
11871187 {
11881188 struct nfs_inode *nfsi = NFS_I(inode);
11891189
1190− nfsi->cache_validity |= NFS_INO_INVALID_CTIME
1191− | NFS_INO_INVALID_MTIME
1192− | cache_validity;
1190+ cache_validity |= NFS_INO_INVALID_CTIME | NFS_INO_INVALID_MTIME;
11931191
11941192 if (cinfo->atomic && cinfo->before == inode_peek_iversion_raw(inode)) {
11951193 nfsi->cache_validity &= ~NFS_INO_REVAL_PAGECACHE;
11961194 nfsi->attrtimeo_timestamp = jiffies;
11971195 } else {
11981196 if (S_ISDIR(inode->i_mode)) {
1199− nfsi->cache_validity |= NFS_INO_INVALID_DATA;
1197+ cache_validity |= NFS_INO_INVALID_DATA;
12001198 nfs_force_lookup_revalidate(inode);
12011199 } else {
12021200 if (!NFS_PROTO(inode)->have_delegation(inode,
12031201 FMODE_READ))
1204− nfsi->cache_validity |= NFS_INO_REVAL_PAGECACHE;
1202+ cache_validity |= NFS_INO_REVAL_PAGECACHE;
12051203 }
12061204
12071205 if (cinfo->before != inode_peek_iversion_raw(inode))
1208− nfsi->cache_validity |= NFS_INO_INVALID_ACCESS |
1209− NFS_INO_INVALID_ACL |
1210− NFS_INO_INVALID_XATTR;
1206+ cache_validity |= NFS_INO_INVALID_ACCESS |
1207+ NFS_INO_INVALID_ACL |
1208+ NFS_INO_INVALID_XATTR;
12111209 }
12121210 inode_set_iversion_raw(inode, cinfo->after);
12131211 nfsi->read_cache_jiffies = timestamp;
12141212 nfsi->attr_gencount = nfs_inc_attr_generation_counter();
1213+ nfs_set_cache_invalid(inode, cache_validity);
12151214 nfsi->cache_validity &= ~NFS_INO_INVALID_CHANGE;
1216−
1217− if (nfsi->cache_validity & NFS_INO_INVALID_DATA)
1218− nfs_fscache_invalidate(inode);
12191215 }
12201216
12211217 void
@@ -5893,6 +5889,9 @@ static int __nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t bufl · 4671 unmodified lines
58935889 unsigned int npages = DIV_ROUND_UP(buflen, PAGE_SIZE);
58945890 int ret, i;
58955891
5892+ /* You can't remove system.nfs4_acl: */
5893+ if (buflen == 0)
5894+ return -EINVAL;
58965895 if (!nfs4_server_supports_acls(server))
58975896 return -EOPNOTSUPP;
58985897 if (npages > ARRAY_SIZE(pages))
@@ -5915,9 +5914,9 @@ static int __nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t bufl · 16 unmodified lines
59155914 * so mark the attribute cache invalid.
59165915 */
59175916 spin_lock(&inode->i_lock);
5918− NFS_I(inode)->cache_validity |= NFS_INO_INVALID_CHANGE
5919− | NFS_INO_INVALID_CTIME
5920− | NFS_INO_REVAL_FORCED;
5917+ nfs_set_cache_invalid(inode, NFS_INO_INVALID_CHANGE |
5918+ NFS_INO_INVALID_CTIME |
5919+ NFS_INO_REVAL_FORCED);
59215920 spin_unlock(&inode->i_lock);
59225921 nfs_access_zap_cache(inode);
59235922 nfs_zap_acl_cache(inode);
@@ -5969,7 +5968,7 @@ static int _nfs4_get_security_label(struct inode *inode, void *buf, · 45 unmodified lines
59695968 return ret;
59705969 if (!(fattr.valid & NFS_ATTR_FATTR_V4_SECURITY_LABEL))
59715970 return -ENOENT;
5972− return 0;
5971+ return label.len;
59735972 }
59745973
59755974 static int nfs4_get_security_label(struct inode *inode, void *buf,
fs/nfs/unlink.c+3−3
@@ -500,9 +500,9 @@ nfs_sillyrename(struct inode *dir, struct dentry *dentry) · 499 unmodified lines
500500 nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
501501 spin_lock(&inode->i_lock);
502502 NFS_I(inode)->attr_gencount = nfs_inc_attr_generation_counter();
503− NFS_I(inode)->cache_validity |= NFS_INO_INVALID_CHANGE
504− | NFS_INO_INVALID_CTIME
505− | NFS_INO_REVAL_FORCED;
503+ nfs_set_cache_invalid(inode, NFS_INO_INVALID_CHANGE |
504+ NFS_INO_INVALID_CTIME |
505+ NFS_INO_REVAL_FORCED);
506506 spin_unlock(&inode->i_lock);
507507 d_move(dentry, sdentry);
508508 break;
fs/nfs/write.c+4−4
@@ -303,9 +303,9 @@ static void nfs_set_pageerror(struct address_space *mapping) · 302 unmodified lines
303303 nfs_zap_mapping(mapping->host, mapping);
304304 /* Force file size revalidation */
305305 spin_lock(&inode->i_lock);
306− NFS_I(inode)->cache_validity |= NFS_INO_REVAL_FORCED |
307− NFS_INO_REVAL_PAGECACHE |
308− NFS_INO_INVALID_SIZE;
306+ nfs_set_cache_invalid(inode, NFS_INO_REVAL_FORCED |
307+ NFS_INO_REVAL_PAGECACHE |
308+ NFS_INO_INVALID_SIZE);
309309 spin_unlock(&inode->i_lock);
310310 }
311311
@@ -1604,7 +1604,7 @@ static int nfs_writeback_done(struct rpc_task *task, · 1292 unmodified lines
16041604 /* Deal with the suid/sgid bit corner case */
16051605 if (nfs_should_remove_suid(inode)) {
16061606 spin_lock(&inode->i_lock);
1607− NFS_I(inode)->cache_validity |= NFS_INO_INVALID_OTHER;
1607+ nfs_set_cache_invalid(inode, NFS_INO_INVALID_OTHER);
16081608 spin_unlock(&inode->i_lock);
16091609 }
16101610 return 0;
fs/nfsd/Kconfig+1−0
@@ -73,6 +73,7 @@ config NFSD_V4 · 72 unmodified lines
7373 select NFSD_V3
7474 select FS_POSIX_ACL
7575 select SUNRPC_GSS
76+ select CRYPTO
7677 select CRYPTO_MD5
7778 select CRYPTO_SHA256
7879 select GRACE_PERIOD
fs/nfsd/filecache.c+2−0
@@ -898,6 +898,8 @@ nfsd_file_find_locked(struct inode *inode, unsigned int may_flags, · 897 unmodified lines
898898 continue;
899899 if (!nfsd_match_cred(nf->nf_cred, current_cred()))
900900 continue;
901+ if (!test_bit(NFSD_FILE_HASHED, &nf->nf_flags))
902+ continue;
901903 if (nfsd_file_get(nf) != NULL)
902904 return nf;
903905 }
fs/nfsd/nfs4callback.c+1−0
@@ -1189,6 +1189,7 @@ static void nfsd4_cb_done(struct rpc_task *task, void *calldata) · 1188 unmodified lines
11891189 switch (task->tk_status) {
11901190 case -EIO:
11911191 case -ETIMEDOUT:
1192+ case -EACCES:
11921193 nfsd4_mark_cb_down(clp, task->tk_status);
11931194 }
11941195 break;
fs/nfsd/nfs4proc.c+1−1
@@ -1302,7 +1302,7 @@ nfsd4_cleanup_inter_ssc(struct vfsmount *ss_mnt, struct nfsd_file *src, · 1301 unmodified lines
13021302 struct nfsd_file *dst)
13031303 {
13041304 nfs42_ssc_close(src->nf_file);
1305− /* 'src' is freed by nfsd4_do_async_copy */
1305+ fput(src->nf_file);
13061306 nfsd_file_put(dst);
13071307 mntput(ss_mnt);
13081308 }
fs/nfsd/nfs4state.c+15−40
@@ -4940,31 +4940,6 @@ static struct file_lock *nfs4_alloc_init_lease(struct nfs4_delegation *dp, · 4939 unmodified lines
49404940 return fl;
49414941 }
49424942
4943−static int nfsd4_check_conflicting_opens(struct nfs4_client *clp,
4944− struct nfs4_file *fp)
4945−{
4946− struct nfs4_clnt_odstate *co;
4947− struct file *f = fp->fi_deleg_file->nf_file;
4948− struct inode *ino = locks_inode(f);
4949− int writes = atomic_read(&ino->i_writecount);
4950−
4951− if (fp->fi_fds[O_WRONLY])
4952− writes--;
4953− if (fp->fi_fds[O_RDWR])
4954− writes--;
4955− if (writes > 0)
4956− return -EAGAIN;
4957− spin_lock(&fp->fi_lock);
4958− list_for_each_entry(co, &fp->fi_clnt_odstate, co_perfile) {
4959− if (co->co_client != clp) {
4960− spin_unlock(&fp->fi_lock);
4961− return -EAGAIN;
4962− }
4963− }
4964− spin_unlock(&fp->fi_lock);
4965− return 0;
4966−}
4967−
49684943 static struct nfs4_delegation *
49694944 nfs4_set_delegation(struct nfs4_client *clp, struct svc_fh *fh,
49704945 struct nfs4_file *fp, struct nfs4_clnt_odstate *odstate)
@@ -4984,12 +4959,9 @@ nfs4_set_delegation(struct nfs4_client *clp, struct svc_fh *fh, · 13 unmodified lines
49844959
49854960 nf = find_readable_file(fp);
49864961 if (!nf) {
4987− /*
4988− * We probably could attempt another open and get a read
4989− * delegation, but for now, don't bother until the
4990− * client actually sends us one.
4991− */
4992− return ERR_PTR(-EAGAIN);
4962+ /* We should always have a readable file here */
4963+ WARN_ON_ONCE(1);
4964+ return ERR_PTR(-EBADF);
49934965 }
49944966 spin_lock(&state_lock);
49954967 spin_lock(&fp->fi_lock);
@@ -5019,19 +4991,11 @@ nfs4_set_delegation(struct nfs4_client *clp, struct svc_fh *fh, · 23 unmodified lines
50194991 if (!fl)
50204992 goto out_clnt_odstate;
50214993
5022− status = nfsd4_check_conflicting_opens(clp, fp);
5023− if (status) {
5024− locks_free_lock(fl);
5025− goto out_clnt_odstate;
5026− }
50274994 status = vfs_setlease(fp->fi_deleg_file->nf_file, fl->fl_type, &fl, NULL);
50284995 if (fl)
50294996 locks_free_lock(fl);
50304997 if (status)
50314998 goto out_clnt_odstate;
5032− status = nfsd4_check_conflicting_opens(clp, fp);
5033− if (status)
5034− goto out_clnt_odstate;
50354999
50365000 spin_lock(&state_lock);
50375001 spin_lock(&fp->fi_lock);
@@ -5113,6 +5077,17 @@ nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open, · 75 unmodified lines
51135077 goto out_no_deleg;
51145078 if (!cb_up || !(oo->oo_flags & NFS4_OO_CONFIRMED))
51155079 goto out_no_deleg;
5080+ /*
5081+ * Also, if the file was opened for write or
5082+ * create, there's a good chance the client's
5083+ * about to write to it, resulting in an
5084+ * immediate recall (since we don't support
5085+ * write delegations):
5086+ */
5087+ if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE)
5088+ goto out_no_deleg;
5089+ if (open->op_create == NFS4_OPEN_CREATE)
5090+ goto out_no_deleg;
51165091 break;
51175092 default:
51185093 goto out_no_deleg;
@@ -5389,7 +5364,7 @@ nfs4_laundromat(struct nfsd_net *nn) · 270 unmodified lines
53895364 idr_for_each_entry(&nn->s2s_cp_stateids, cps_t, i) {
53905365 cps = container_of(cps_t, struct nfs4_cpntf_state, cp_stateid);
53915366 if (cps->cp_stateid.sc_type == NFS4_COPYNOTIFY_STID &&
5392− cps->cpntf_time > cutoff)
5367+ cps->cpntf_time < cutoff)
53935368 _free_cpntf_state_locked(nn, cps);
53945369 }
53955370 spin_unlock(&nn->s2s_cp_lock);
fs/nilfs2/segbuf.c+1−1
@@ -399,7 +399,7 @@ static void nilfs_segbuf_prepare_write(struct nilfs_segment_buffer *segbuf, · 398 unmodified lines
399399 {
400400 wi->bio = NULL;
401401 wi->rest_blocks = segbuf->sb_sum.nblocks;
402− wi->max_pages = BIO_MAX_PAGES;
402+ wi->max_pages = BIO_MAX_VECS;
403403 wi->nr_vecs = min(wi->max_pages, wi->rest_blocks);
404404 wi->start = wi->end = 0;
405405 wi->blocknr = segbuf->sb_pseg_start;
fs/pnode.h+1−1
@@ -12,7 +12,7 @@ · 11 unmodified lines
1212
1313 #define IS_MNT_SHARED(m) ((m)->mnt.mnt_flags & MNT_SHARED)
1414 #define IS_MNT_SLAVE(m) ((m)->mnt_master)
15−#define IS_MNT_NEW(m) (!(m)->mnt_ns)
15+#define IS_MNT_NEW(m) (!(m)->mnt_ns || is_anon_ns((m)->mnt_ns))
1616 #define CLEAR_MNT_SHARED(m) ((m)->mnt.mnt_flags &= ~MNT_SHARED)
1717 #define IS_MNT_UNBINDABLE(m) ((m)->mnt.mnt_flags & MNT_UNBINDABLE)
1818 #define IS_MNT_MARKED(m) ((m)->mnt.mnt_flags & MNT_MARKED)
fs/proc/task_mmu.c+0−2
@@ -1036,8 +1036,6 @@ struct clear_refs_private { · 1035 unmodified lines
10361036
10371037 #ifdef CONFIG_MEM_SOFT_DIRTY
10381038
1039−#define is_cow_mapping(flags) (((flags) & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE)
1040−
10411039 static inline bool pte_is_pinned(struct vm_area_struct *vma, unsigned long addr, pte_t pte)
10421040 {
10431041 struct page *page;
fs/select.c+4−6
@@ -1055,10 +1055,9 @@ static long do_restart_poll(struct restart_block *restart_block) · 1054 unmodified lines
10551055
10561056 ret = do_sys_poll(ufds, nfds, to);
10571057
1058− if (ret == -ERESTARTNOHAND) {
1059− restart_block->fn = do_restart_poll;
1060− ret = -ERESTART_RESTARTBLOCK;
1061− }
1058+ if (ret == -ERESTARTNOHAND)
1059+ ret = set_restart_fn(restart_block, do_restart_poll);
1060+
10621061 return ret;
10631062 }
10641063
@@ -1080,7 +1079,6 @@ SYSCALL_DEFINE3(poll, struct pollfd __user *, ufds, unsigned int, nfds, · 15 unmodified lines
10801079 struct restart_block *restart_block;
10811080
10821081 restart_block = &current->restart_block;
1083− restart_block->fn = do_restart_poll;
10841082 restart_block->poll.ufds = ufds;
10851083 restart_block->poll.nfds = nfds;
10861084
@@ -1091,7 +1089,7 @@ SYSCALL_DEFINE3(poll, struct pollfd __user *, ufds, unsigned int, nfds, · 4 unmodified lines
10911089 } else
10921090 restart_block->poll.has_timeout = 0;
10931091
1094− ret = -ERESTART_RESTARTBLOCK;
1092+ ret = set_restart_fn(restart_block, do_restart_poll);
10951093 }
10961094 return ret;
10971095 }
fs/squashfs/block.c+1−1
@@ -87,7 +87,7 @@ static int squashfs_bio_read(struct super_block *sb, u64 index, int length, · 86 unmodified lines
8787 int error, i;
8888 struct bio *bio;
8989
90− if (page_count <= BIO_MAX_PAGES)
90+ if (page_count <= BIO_MAX_VECS)
9191 bio = bio_alloc(GFP_NOIO, page_count);
9292 else
9393 bio = bio_kmalloc(GFP_NOIO, page_count);
fs/squashfs/export.c+6−2
@@ -152,14 +152,18 @@ __le64 *squashfs_read_inode_lookup_table(struct super_block *sb, · 151 unmodified lines
152152 start = le64_to_cpu(table[n]);
153153 end = le64_to_cpu(table[n + 1]);
154154
155− if (start >= end || (end - start) > SQUASHFS_METADATA_SIZE) {
155+ if (start >= end
156+ || (end - start) >
157+ (SQUASHFS_METADATA_SIZE + SQUASHFS_BLOCK_OFFSET)) {
156158 kfree(table);
157159 return ERR_PTR(-EINVAL);
158160 }
159161 }
160162
161163 start = le64_to_cpu(table[indexes - 1]);
162− if (start >= lookup_table_start || (lookup_table_start - start) > SQUASHFS_METADATA_SIZE) {
164+ if (start >= lookup_table_start ||
165+ (lookup_table_start - start) >
166+ (SQUASHFS_METADATA_SIZE + SQUASHFS_BLOCK_OFFSET)) {
163167 kfree(table);
164168 return ERR_PTR(-EINVAL);
165169 }
fs/squashfs/id.c+4−2
@@ -97,14 +97,16 @@ __le64 *squashfs_read_id_index_table(struct super_block *sb, · 96 unmodified lines
9797 start = le64_to_cpu(table[n]);
9898 end = le64_to_cpu(table[n + 1]);
9999
100− if (start >= end || (end - start) > SQUASHFS_METADATA_SIZE) {
100+ if (start >= end || (end - start) >
101+ (SQUASHFS_METADATA_SIZE + SQUASHFS_BLOCK_OFFSET)) {
101102 kfree(table);
102103 return ERR_PTR(-EINVAL);
103104 }
104105 }
105106
106107 start = le64_to_cpu(table[indexes - 1]);
107− if (start >= id_table_start || (id_table_start - start) > SQUASHFS_METADATA_SIZE) {
108+ if (start >= id_table_start || (id_table_start - start) >
109+ (SQUASHFS_METADATA_SIZE + SQUASHFS_BLOCK_OFFSET)) {
108110 kfree(table);
109111 return ERR_PTR(-EINVAL);
110112 }
fs/squashfs/squashfs_fs.h+1−0
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717
1818 /* size of metadata (inode and directory) blocks */
1919 #define SQUASHFS_METADATA_SIZE 8192
20+#define SQUASHFS_BLOCK_OFFSET 2
2021
2122 /* default size of block device I/O */
2223 #ifdef CONFIG_SQUASHFS_4K_DEVBLK_SIZE
fs/squashfs/xattr_id.c+4−2
@@ -109,14 +109,16 @@ __le64 *squashfs_read_xattr_id_table(struct super_block *sb, u64 table_start, · 108 unmodified lines
109109 start = le64_to_cpu(table[n]);
110110 end = le64_to_cpu(table[n + 1]);
111111
112− if (start >= end || (end - start) > SQUASHFS_METADATA_SIZE) {
112+ if (start >= end || (end - start) >
113+ (SQUASHFS_METADATA_SIZE + SQUASHFS_BLOCK_OFFSET)) {
113114 kfree(table);
114115 return ERR_PTR(-EINVAL);
115116 }
116117 }
117118
118119 start = le64_to_cpu(table[indexes - 1]);
119− if (start >= table_start || (table_start - start) > SQUASHFS_METADATA_SIZE) {
120+ if (start >= table_start || (table_start - start) >
121+ (SQUASHFS_METADATA_SIZE + SQUASHFS_BLOCK_OFFSET)) {
120122 kfree(table);
121123 return ERR_PTR(-EINVAL);
122124 }
fs/xfs/xfs_inode.c+8−6
@@ -1007,9 +1007,10 @@ xfs_create( · 1006 unmodified lines
10071007 /*
10081008 * Make sure that we have allocated dquot(s) on disk.
10091009 */
1010− error = xfs_qm_vop_dqalloc(dp, current_fsuid(), current_fsgid(), prid,
1011− XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT,
1012− &udqp, &gdqp, &pdqp);
1010+ error = xfs_qm_vop_dqalloc(dp, fsuid_into_mnt(mnt_userns),
1011+ fsgid_into_mnt(mnt_userns), prid,
1012+ XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT,
1013+ &udqp, &gdqp, &pdqp);
10131014 if (error)
10141015 return error;
10151016
@@ -1157,9 +1158,10 @@ xfs_create_tmpfile( · 141 unmodified lines
11571158 /*
11581159 * Make sure that we have allocated dquot(s) on disk.
11591160 */
1160− error = xfs_qm_vop_dqalloc(dp, current_fsuid(), current_fsgid(), prid,
1161− XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT,
1162− &udqp, &gdqp, &pdqp);
1161+ error = xfs_qm_vop_dqalloc(dp, fsuid_into_mnt(mnt_userns),
1162+ fsgid_into_mnt(mnt_userns), prid,
1163+ XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT,
1164+ &udqp, &gdqp, &pdqp);
11631165 if (error)
11641166 return error;
11651167
fs/xfs/xfs_itable.c+6−0
@@ -168,6 +168,12 @@ xfs_bulkstat_one( · 167 unmodified lines
168168 };
169169 int error;
170170
171+ if (breq->mnt_userns != &init_user_ns) {
172+ xfs_warn_ratelimited(breq->mp,
173+ "bulkstat not supported inside of idmapped mounts.");
174+ return -EINVAL;
175+ }
176+
171177 ASSERT(breq->icount == 1);
172178
173179 bc.buf = kmem_zalloc(sizeof(struct xfs_bulkstat),
fs/xfs/xfs_mount.c+44−46
@@ -634,6 +634,47 @@ xfs_check_summary_counts( · 633 unmodified lines
634634 return xfs_initialize_perag_data(mp, mp->m_sb.sb_agcount);
635635 }
636636
637+/*
638+ * Flush and reclaim dirty inodes in preparation for unmount. Inodes and
639+ * internal inode structures can be sitting in the CIL and AIL at this point,
640+ * so we need to unpin them, write them back and/or reclaim them before unmount
641+ * can proceed.
642+ *
643+ * An inode cluster that has been freed can have its buffer still pinned in
644+ * memory because the transaction is still sitting in a iclog. The stale inodes
645+ * on that buffer will be pinned to the buffer until the transaction hits the
646+ * disk and the callbacks run. Pushing the AIL will skip the stale inodes and
647+ * may never see the pinned buffer, so nothing will push out the iclog and
648+ * unpin the buffer.
649+ *
650+ * Hence we need to force the log to unpin everything first. However, log
651+ * forces don't wait for the discards they issue to complete, so we have to
652+ * explicitly wait for them to complete here as well.
653+ *
654+ * Then we can tell the world we are unmounting so that error handling knows
655+ * that the filesystem is going away and we should error out anything that we
656+ * have been retrying in the background. This will prevent never-ending
657+ * retries in AIL pushing from hanging the unmount.
658+ *
659+ * Finally, we can push the AIL to clean all the remaining dirty objects, then
660+ * reclaim the remaining inodes that are still in memory at this point in time.
661+ */
662+static void
663+xfs_unmount_flush_inodes(
664+ struct xfs_mount *mp)
665+{
666+ xfs_log_force(mp, XFS_LOG_SYNC);
667+ xfs_extent_busy_wait_all(mp);
668+ flush_workqueue(xfs_discard_wq);
669+
670+ mp->m_flags |= XFS_MOUNT_UNMOUNTING;
671+
672+ xfs_ail_push_all_sync(mp->m_ail);
673+ cancel_delayed_work_sync(&mp->m_reclaim_work);
674+ xfs_reclaim_inodes(mp);
675+ xfs_health_unmount(mp);
676+}
677+
637678 /*
638679 * This function does the following on an initial mount of a file system:
639680 * - reads the superblock from disk and init the mount struct
@@ -1008,7 +1049,7 @@ xfs_mountfs( · 368 unmodified lines
10081049 /* Clean out dquots that might be in memory after quotacheck. */
10091050 xfs_qm_unmount(mp);
10101051 /*
1011− * Cancel all delayed reclaim work and reclaim the inodes directly.
1052+ * Flush all inode reclamation work and flush the log.

65 more lines aren’t shown here.

fs/xfs/xfs_symlink.c+2−1

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

fs/zonefs/super.c+88−15

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

include/drm/ttm/ttm_bo_api.h+4−2

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

include/kvm/arm_pmu.h+7−2

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

include/linux/amba/bus.h+11−0

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

include/linux/bio.h+2−2

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

include/linux/bpf.h+25−8

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

include/linux/compiler-clang.h+6−0

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

include/linux/compiler-version.h+14−0

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

include/linux/cpu.h+3−0

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

include/linux/efi.h+4−2

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

include/linux/hugetlb_cgroup.h+13−2

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

include/linux/if_macvlan.h+2−1

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

include/linux/io_uring.h+0−25

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

include/linux/irqdomain.h+0−4

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

include/linux/kconfig.h+0−2

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

include/linux/memblock.h+2−2

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

include/linux/memcontrol.h+2−4

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

include/linux/mlx5/qp.h+7−0

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

include/linux/mm.h+36−3

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

include/linux/mm_types.h+1−0

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

include/linux/mmu_notifier.h+5−5

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

include/linux/module.h+0−3

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

include/linux/netdevice.h+2−0

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

include/linux/netfilter/x_tables.h+2−5

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

include/linux/pagemap.h+1−1

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

include/linux/perf_event.h+2−0

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

include/linux/pgtable.h+4−0

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

include/linux/property.h+1−1

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

include/linux/regulator/pca9450.h+3−0

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

include/linux/restart_block.h+1−0

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

include/linux/sched/mm.h+2−1

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

include/linux/seqlock.h+1−4

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

include/linux/skbuff.h+1−0

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

include/linux/stop_machine.h+6−5

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

include/linux/sunrpc/svc_rdma.h+0−1

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

include/linux/thread_info.h+13−0

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

include/linux/u64_stats_sync.h+4−3

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

include/linux/usb.h+2−0

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

include/linux/usb_usual.h+2−0

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

include/linux/usermode_driver.h+1−0

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

include/linux/vdpa.h+5−5

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

include/linux/virtio.h+0−2

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

include/linux/ww_mutex.h+3−2

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

include/media/rc-map.h+7−0

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

include/net/dst.h+11−0

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

include/net/inet_connection_sock.h+1−1

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

include/net/netfilter/nf_tables.h+3−0

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

include/net/nexthop.h+24−0

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

include/net/red.h+10−2

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

include/net/rtnetlink.h+2−0

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

include/net/sock.h+1−1

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

include/trace/events/workqueue.h+3−3

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

include/uapi/linux/bpf.h+11−5

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

include/uapi/linux/fuse.h+2−1

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

include/uapi/linux/psample.h+1−4

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

include/xen/grant_table.h+7−0

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

include/xen/xenbus.h+0−1

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

init/Kconfig+5−6

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

kernel/bpf/bpf_inode_storage.c+1−1

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

kernel/bpf/bpf_struct_ops.c+1−1

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

kernel/bpf/core.c+2−2

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

kernel/bpf/preload/bpf_preload_kern.c+15−4

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

kernel/bpf/syscall.c+5−0

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

kernel/bpf/trampoline.c+168−50

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

kernel/bpf/verifier.c+25−12

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

kernel/events/core.c+38−4

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

kernel/fork.c+8−0

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

kernel/freezer.c+1−1

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

kernel/futex.c+1−2

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

kernel/gcov/clang.c+69−0

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

kernel/irq/irq_sim.c+2−2

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

kernel/irq/irqdomain.c+4−5

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

kernel/irq/manage.c+4−0

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

kernel/jump_label.c+8−0

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

kernel/locking/mutex.c+14−11

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

kernel/reboot.c+0−2

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

kernel/sched/core.c+62−64

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

kernel/sched/membarrier.c+1−3

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

kernel/signal.c+5−1

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

kernel/static_call.c+27−20

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

kernel/sys.c+1−1

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

kernel/time/alarmtimer.c+1−1

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

kernel/time/hrtimer.c+40−22

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

kernel/time/posix-cpu-timers.c+1−1

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

kernel/trace/ftrace.c+38−5

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

kernel/usermode_driver.c+15−6

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

lib/Kconfig.kasan+1−0

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

lib/math/div64.c+1−0

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

mm/highmem.c+14−7

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

mm/huge_memory.c+3−7

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

mm/hugetlb.c+128−36

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

mm/hugetlb_cgroup.c+8−2

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

mm/internal.h+0−5

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

mm/kfence/core.c+9−0

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

mm/kfence/report.c+18−12

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

mm/kmemleak.c+2−1

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

mm/madvise.c+12−1

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

mm/memcontrol.c+6−9

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

mm/memory.c+9−7

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

mm/memory_hotplug.c+1−1

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

mm/mmu_notifier.c+23−0

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

mm/page-writeback.c+16−0

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

mm/page_alloc.c+82−85

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

mm/slab.c+1−1

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

mm/slub.c+1−1

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

mm/z3fold.c+15−1

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

net/batman-adv/main.c+0−1

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

net/bridge/br_switchdev.c+2−0

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

net/can/isotp.c+8−10

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

net/core/dev.c+31−2

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

net/core/drop_monitor.c+23−0

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

net/core/dst.c+42−17

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

net/core/filter.c+10−2

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

net/core/flow_dissector.c+1−1

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

net/core/sock.c+28−16

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

net/dccp/ipv6.c+5−0

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

net/dsa/dsa2.c+7−4

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

net/ipv4/inet_connection_sock.c+5−2

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

net/ipv4/ipconfig.c+8−6

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

net/ipv4/netfilter/arp_tables.c+8−8

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

net/ipv4/netfilter/ip_tables.c+8−8

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

net/ipv4/route.c+8−37

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

net/ipv4/tcp_minisocks.c+5−2

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

net/ipv6/ip6_fib.c+1−1

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

net/ipv6/ip6_input.c+0−10

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

net/ipv6/netfilter/ip6_tables.c+8−8

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

net/ipv6/route.c+9−27

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

net/ipv6/tcp_ipv6.c+5−0

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

net/mac80211/aead_api.c+3−2

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

net/mac80211/aes_gmac.c+3−2

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

net/mac80211/cfg.c+2−2

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

net/mac80211/ibss.c+2−0

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

net/mac80211/main.c+12−1

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

net/mac80211/mlme.c+1−1

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

net/mac80211/rc80211_minstrel_ht.c+0−2

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

net/mac80211/util.c+1−1

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

net/mptcp/options.c+14−10

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

net/mptcp/protocol.c+2−2

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

net/mptcp/subflow.c+5−0

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

net/netfilter/nf_conntrack_netlink.c+1−0

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

net/netfilter/nf_conntrack_proto_gre.c+0−3

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

net/netfilter/nf_flow_table_core.c+1−1

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

net/netfilter/nf_tables_api.c+21−1

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

net/netfilter/x_tables.c+34−15

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

net/openvswitch/conntrack.c+5−3

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

net/openvswitch/conntrack.h+4−2

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

net/openvswitch/flow.c+3−1

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

net/qrtr/qrtr.c+5−0

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

net/sched/act_ct.c+4−2

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

net/sched/cls_api.c+1−0

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

net/sched/cls_flower.c+1−1

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

net/sched/sch_choke.c+4−3

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

net/sched/sch_gred.c+1−1

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

net/sched/sch_htb.c+13−6

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

net/sched/sch_red.c+5−2

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

net/sched/sch_sfq.c+1−1

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

net/sctp/output.c+0−7

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

net/sctp/outqueue.c+7−0

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

net/sunrpc/auth_gss/svcauth_gss.c+7−4

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

net/sunrpc/sched.c+4−1

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

net/sunrpc/svc.c+4−2

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

net/sunrpc/svc_xprt.c+2−2

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

net/sunrpc/xprtrdma/svc_rdma_backchannel.c+3−3

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

net/sunrpc/xprtrdma/svc_rdma_recvfrom.c+39−43

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

net/tipc/node.c+8−3

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

net/vmw_vsock/af_vsock.c+1−0

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

net/wireless/nl80211.c+8−4

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

scripts/Makefile.lib+2−2

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

scripts/dummy-tools/gcc+16−2

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

scripts/gcc-plugins/Makefile+1−0

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

scripts/ld-version.sh+14−8

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

security/commoncap.c+1−11

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

security/selinux/include/security.h+11−4

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

security/selinux/selinuxfs.c+9−13

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

security/selinux/ss/services.c+39−24

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

sound/drivers/aloop.c+0−1

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

sound/drivers/dummy.c+0−1

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

sound/drivers/mtpav.c+0−1

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

sound/drivers/mts64.c+0−1

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

sound/drivers/pcsp/pcsp.c+0−1

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

sound/drivers/portman2x4.c+0−1

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

sound/drivers/serial-u16550.c+0−1

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

sound/drivers/virmidi.c+0−1

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

sound/firewire/dice/dice-stream.c+2−3

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

sound/hda/intel-nhlt.c+5−0

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

sound/isa/ad1816a/ad1816a.c+0−7

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

sound/isa/ad1848/ad1848.c+0−3

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

sound/isa/als100.c+0−11

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

sound/isa/azt2320.c+0−5

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

sound/isa/cmi8330.c+0−1

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

sound/isa/cs423x/cs4231.c+0−1

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

sound/isa/cs423x/cs4236.c+0−34

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

sound/isa/es1688/es1688.c+0−5

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

sound/isa/es18xx.c+1−9

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

sound/isa/gus/gusclassic.c+0−1

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

sound/isa/gus/gusextreme.c+0−1

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

sound/isa/gus/gusmax.c+0−1

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

sound/isa/gus/interwave.c+0−6

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

sound/isa/opl3sa2.c+0−5

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

sound/isa/opti9xx/miro.c+0−3

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

sound/isa/opti9xx/opti92x-ad1848.c+0−6

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

sound/isa/sb/jazz16.c+0−3

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

sound/isa/sb/sb16.c+0−8

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

sound/isa/sb/sb8.c+0−1

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

sound/isa/sc6000.c+0−3

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

sound/isa/wavefront/wavefront.c+0−1

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

sound/mips/sgio2audio.c+0−1

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

sound/pci/ad1889.c+0−1

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

sound/pci/ali5451/ali5451.c+0−1

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

sound/pci/als300.c+0−1

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

sound/pci/als4000.c+0−1

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

sound/pci/atiixp.c+0−1

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

sound/pci/atiixp_modem.c+0−1

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

sound/pci/au88x0/au88x0.c+0−2

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

sound/pci/azt3328.c+0−1

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

sound/pci/bt87x.c+0−2

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

sound/pci/ca0106/ca0106_main.c+0−1

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

sound/pci/cmipci.c+0−4

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

sound/pci/cs4281.c+0−1

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

sound/pci/cs46xx/cs46xx.c+0−7

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

sound/pci/cs5535audio/cs5535audio.c+0−1

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

sound/pci/ctxfi/xfi.c+0−1

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

sound/pci/echoaudio/echoaudio.c+0−1

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

sound/pci/emu10k1/emu10k1.c+0−2

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

sound/pci/emu10k1/emu10k1x.c+0−1

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

sound/pci/ens1370.c+0−8

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

sound/pci/es1938.c+0−4

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

sound/pci/es1968.c+0−4

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

sound/pci/fm801.c+0−2

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

sound/pci/hda/hda_bind.c+4−0

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

sound/pci/hda/hda_controller.c+0−7

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

sound/pci/hda/hda_generic.c+1−1

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

sound/pci/hda/hda_intel.c+2−34

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

sound/pci/hda/patch_ca0132.c+1−0

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

sound/pci/hda/patch_conexant.c+45−17

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

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

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

sound/pci/hda/patch_realtek.c+16−0

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

sound/pci/ice1712/ice1712.c+0−6

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

sound/pci/ice1712/ice1724.c+0−19

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

sound/pci/intel8x0.c+0−23

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

sound/pci/intel8x0m.c+0−15

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

sound/pci/korg1212/korg1212.c+0−1

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

sound/pci/lola/lola.c+0−1

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

sound/pci/lx6464es/lx6464es.c+0−2

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

sound/pci/maestro3.c+0−5

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

sound/pci/mixart/mixart.c+0−1

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

sound/pci/nm256/nm256.c+0−2

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

sound/pci/oxygen/oxygen.c+0−3

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

sound/pci/oxygen/se6x.c+0−1

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

sound/pci/oxygen/virtuoso.c+0−1

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

sound/pci/pcxhr/pcxhr.c+0−1

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

sound/pci/riptide/riptide.c+0−1

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

sound/pci/rme32.c+0−1

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

sound/pci/rme96.c+0−5

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

sound/pci/rme9652/hdsp.c+0−3

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

sound/pci/rme9652/hdspm.c+0−1

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

sound/pci/rme9652/rme9652.c+0−2

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

sound/pci/sis7019.c+0−1

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

sound/pci/sonicvibes.c+0−1

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

sound/pci/trident/trident.c+0−12

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

sound/pci/via82xx.c+0−1

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

sound/pci/via82xx_modem.c+0−1

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

sound/pci/vx222/vx222.c+0−1

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

sound/pci/ymfpci/ymfpci.c+0−6

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

sound/pcmcia/pdaudiocf/pdaudiocf.c+0−1

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

sound/pcmcia/vx/vxpocket.c+0−4

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

sound/ppc/powermac.c+0−1

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

sound/sh/aica.c+0−1

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

sound/sh/sh_dac_audio.c+0−1

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

sound/soc/codecs/Kconfig+0−5

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

sound/soc/codecs/ak4458.c+1−0

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

sound/soc/codecs/ak5558.c+1−0

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

sound/soc/codecs/cs42l42.c+34−78

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

sound/soc/codecs/cs42l42.h+7−6

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

sound/soc/codecs/es8316.c+2−7

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

sound/soc/codecs/lpass-rx-macro.c+1−1

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

sound/soc/codecs/lpass-va-macro.c+13−15

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

sound/soc/codecs/lpass-wsa-macro.c+11−9

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

sound/soc/codecs/rt1015.c+2−0

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

sound/soc/codecs/rt5640.c+2−2

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

sound/soc/codecs/rt5651.c+2−2

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

sound/soc/codecs/rt5659.c+5−0

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

sound/soc/codecs/rt5670.c+96−14

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

sound/soc/codecs/rt5670.h+5−4

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

sound/soc/codecs/rt711.c+8−0

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

sound/soc/codecs/sgtl5000.c+1−1

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

sound/soc/codecs/sirf-audio-codec.h+0−124

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

sound/soc/codecs/wcd934x.c+6−0

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

sound/soc/fsl/fsl_ssi.c+4−2

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

sound/soc/generic/simple-card-utils.c+7−6

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

sound/soc/intel/boards/bytcr_rt5640.c+1−1

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

sound/soc/mediatek/mt8192/mt8192-dai-tdm.c+3−1

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

sound/soc/mediatek/mt8192/mt8192-reg.h+5−3

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

sound/soc/qcom/lpass-cpu.c+1−1

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

sound/soc/qcom/sdm845.c+3−3

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

sound/soc/soc-core.c+4−0

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

sound/soc/sof/intel/hda-dsp.c+1−1

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

sound/soc/sof/intel/hda.c+1−0

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

sound/sparc/amd7930.c+0−1

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

sound/sparc/cs4231.c+0−1

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

sound/sparc/dbri.c+0−1

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

sound/usb/6fire/chip.c+0−1

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

sound/usb/caiaq/device.c+0−14

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

sound/usb/card.c+6−2

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

sound/usb/hiface/chip.c+0−17

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

sound/usb/misc/ua101.c+0−1

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

sound/usb/mixer_quirks.c+2−2

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

sound/usb/quirks.c+10−1

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

sound/usb/usbaudio.h+1−0

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

sound/usb/usx2y/usbusx2y.c+0−1

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

sound/x86/intel_hdmi_audio.c+0−1

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

sound/xen/xen_snd_front.c+0−1

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

tools/lib/bpf/Makefile+1−1

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

tools/lib/bpf/btf_dump.c+1−1

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

tools/lib/bpf/libbpf.c+2−1

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

tools/lib/bpf/netlink.c+1−1

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

tools/objtool/check.c+3−0

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

tools/testing/kunit/configs/broken_on_uml.config+2−0

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

tools/testing/kunit/kunit_config.py+1−1

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

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

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

tools/testing/selftests/arm64/fp/sve-test.S+17−5

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

tools/testing/selftests/bpf/prog_tests/check_mtu.c+4−0

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

tools/testing/selftests/bpf/prog_tests/fexit_sleep.c+82−0

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

tools/testing/selftests/bpf/progs/btf_dump_test_case_syntax.c+8−0

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

tools/testing/selftests/bpf/progs/fexit_sleep.c+31−0

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

tools/testing/selftests/bpf/progs/test_check_mtu.c+92−0

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

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

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

tools/testing/selftests/bpf/verifier/bounds_deduction.c+19−8

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

tools/testing/selftests/bpf/verifier/map_ptr.c+4−0

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

tools/testing/selftests/bpf/verifier/unpriv.c+14−1

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

tools/testing/selftests/bpf/verifier/value_ptr_arith.c+22−1

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

tools/testing/selftests/kvm/.gitignore+3−0

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

tools/testing/selftests/kvm/Makefile+3−0

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

tools/testing/selftests/kvm/include/kvm_util.h+2−0

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

tools/testing/selftests/kvm/lib/kvm_util.c+6−1

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

tools/testing/selftests/kvm/lib/kvm_util_internal.h+0−2

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

tools/testing/selftests/kvm/x86_64/get_msr_index_features.c+134−0

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

tools/testing/selftests/kvm/x86_64/hyperv_clock.c+260−0

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

tools/testing/selftests/kvm/x86_64/set_boot_cpu_id.c+166−0

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

tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh+1−1

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

tools/testing/selftests/net/mptcp/mptcp_join.sh+20−10

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

tools/testing/selftests/net/reuseaddr_ports_exhausted.c+16−16

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

tools/testing/selftests/vm/Makefile+2−2

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

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

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

Repository code

Go to file
t