History

Merge tag 'v5.1-rc6' into for-5.2/block

Pull in v5.1-rc6 to resolve two conflicts. One is in BFQ, in just a comment, and is trivial. The other one is a conflict due to a later fix in the bio multi-page work, and needs a bit more care. * tag 'v5.1-rc6': (770 commits) Linux 5.1-rc6 block: make sure that bvec length can't be overflow block: kill all_q_node in request_queue x86/cpu/intel: Lower the "ENERGY_PERF_BIAS: Set to normal" message's log priority coredump: fix race condition between mmget_not_zero()/get_task_mm() and core dumping mm/kmemleak.c: fix unused-function warning init: initialize jump labels before command line option parsing kernel/watchdog_hld.c: hard lockup message should end with a newline kcov: improve CONFIG_ARCH_HAS_KCOV help text mm: fix inactive list balancing between NUMA nodes and cgroups mm/hotplug: treat CMA pages as unmovable proc: fixup proc-pid-vm test proc: fix map_files test on F29 mm/vmstat.c: fix /proc/vmstat format for CONFIG_DEBUG_TLBFLUSH=y CONFIG_SMP=n mm/memory_hotplug: do not unlock after failing to take the device_hotplug_lock mm: swapoff: shmem_unuse() stop eviction without igrab() mm: swapoff: take notice of completion sooner mm: swapoff: remove too limiting SWAP_UNUSE_MAX_TRIES mm: swapoff: shmem_find_swap_entries() filter out other types slab: store tagged freelist for off-slab slabmgmt ...

Jens Axboe committed 7 years ago

Commit 5c61ee22 parents cdf3e3d 085b775777 files · +8118 −4465Browse files

Unified · Split

777 files
  1. .clang-format +24 −0
  2. .mailmap +2 −0
  3. Documentation/accounting/psi.txt +6 −6
  4. Documentation/bpf/btf.rst +4 −4
  5. Documentation/devicetree/bindings/arm/cpus.yaml +1 −1
  6. Documentation/devicetree/bindings/hwmon/adc128d818.txt +2 −2
  7. Documentation/lzo.txt +5 −3
  8. Documentation/media/uapi/rc/rc-tables.rst +2 −2
  9. Documentation/networking/bpf_flow_dissector.rst +126 −0
  10. Documentation/networking/index.rst +1 −0
  11. Documentation/networking/rxrpc.txt +9 −7
  12. MAINTAINERS +22 −9
  13. Makefile +1 −1
  14. arch/arc/include/asm/syscall.h +3 −4
  15. arch/arm/boot/dts/am335x-evm.dts +22 −4
  16. arch/arm/boot/dts/am335x-evmsk.dts +22 −4
  17. arch/arm/boot/dts/am33xx-l4.dtsi +2 −2
  18. arch/arm/boot/dts/rk3288-tinker.dtsi +2 −1
  19. arch/arm/boot/dts/rk3288-veyron.dtsi +0 −2
  20. arch/arm/boot/dts/rk3288.dtsi +9 −11
  21. arch/arm/boot/dts/sama5d2-pinfunc.h +1 −1
  22. arch/arm/boot/dts/ste-nomadik-nhk15.dts +4 −5
  23. arch/arm/include/asm/syscall.h +8 −39
  24. arch/arm/mach-at91/pm.c +4 −2
  25. arch/arm/mach-iop13xx/setup.c +4 −4
  26. arch/arm/mach-iop13xx/tpmi.c +5 −5
  27. arch/arm/mach-milbeaut/platsmp.c +4 −0
  28. arch/arm/mach-omap1/board-ams-delta.c +2 −0
  29. arch/arm/mach-omap2/display.c +3 −1
  30. arch/arm/plat-iop/adma.c +3 −3
  31. arch/arm/plat-orion/common.c +2 −2
  32. arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi +3 −0
  33. arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts +2 −2
  34. arch/arm64/boot/dts/rockchip/rk3328-rock64.dts +1 −2
  35. arch/arm64/boot/dts/rockchip/rk3328.dtsi +29 −29
  36. arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dts +1 −0
  37. arch/arm64/include/asm/futex.h +7 −7
  38. arch/arm64/include/asm/module.h +5 −0
  39. arch/arm64/include/asm/syscall.h +8 −38
  40. arch/arm64/kernel/ftrace.c +1 −2
  41. arch/arm64/kernel/sdei.c +6 −0
  42. arch/arm64/kernel/traps.c +9 −6
  43. arch/c6x/include/asm/syscall.h +14 −65
  44. arch/csky/include/asm/syscall.h +8 −18
  45. arch/h8300/include/asm/syscall.h +7 −27
  46. arch/hexagon/include/asm/syscall.h +1 −3
  47. arch/ia64/include/asm/syscall.h +3 −10
  48. arch/ia64/kernel/ptrace.c +3 −4
  49. arch/microblaze/include/asm/syscall.h +6 −2
  50. arch/mips/configs/generic/board-ocelot.config +8 −0
  51. arch/mips/include/asm/syscall.h +2 −1
  52. arch/mips/kernel/kgdb.c +2 −1
  53. arch/mips/kernel/ptrace.c +1 −1
  54. arch/mips/sgi-ip27/ip27-irq.c +1 −2
  55. arch/nds32/include/asm/syscall.h +11 −51
  56. arch/nios2/include/asm/syscall.h +14 −70
  57. arch/openrisc/include/asm/syscall.h +4 −8
  58. arch/parisc/include/asm/ptrace.h +3 −2
  59. arch/parisc/include/asm/syscall.h +8 −22
  60. arch/parisc/kernel/process.c +0 −6
  61. arch/parisc/kernel/setup.c +3 −0
  62. arch/powerpc/include/asm/mmu.h +1 −1
  63. arch/powerpc/include/asm/syscall.h +5 −10
  64. arch/powerpc/kernel/exceptions-64s.S +12 −0
  65. arch/powerpc/kernel/head_32.S +0 −8
  66. arch/powerpc/kernel/kvm.c +7 −0
  67. arch/powerpc/kernel/vdso32/gettimeofday.S +1 −1
  68. arch/riscv/configs/rv32_defconfig +84 −0
  69. arch/riscv/include/asm/fixmap.h +1 −1
  70. arch/riscv/include/asm/syscall.h +6 −18
  71. arch/riscv/include/asm/uaccess.h +1 −1
  72. arch/riscv/kernel/Makefile +0 −3
  73. arch/riscv/kernel/module.c +1 −1
  74. arch/riscv/kernel/setup.c +0 −8
  75. arch/riscv/mm/Makefile +6 −0
  76. arch/riscv/mm/init.c +36 −0
  77. arch/s390/boot/mem_detect.c +1 −1
  78. arch/s390/include/asm/syscall.h +10 −18
  79. arch/s390/kernel/fpu.c +1 −1
  80. arch/s390/kernel/vtime.c +4 −4
  81. arch/sh/boards/of-generic.c +2 −2
  82. arch/sh/include/asm/syscall_32.h +12 −35
  83. arch/sh/include/asm/syscall_64.h +2 −6
  84. arch/sparc/include/asm/syscall.h +5 −6
  85. arch/sparc/kernel/pci_sun4v.c +11 −9
  86. arch/um/include/asm/syscall-generic.h +12 −66
  87. arch/x86/Kconfig +1 −1
  88. arch/x86/crypto/poly1305-avx2-x86_64.S +10 −4
  89. arch/x86/crypto/poly1305-sse2-x86_64.S +14 −8
  90. arch/x86/events/amd/core.c +161 −14
  91. arch/x86/events/core.c +3 −10
  92. arch/x86/events/intel/core.c +8 −2
  93. arch/x86/events/perf_event.h +19 −19
  94. arch/x86/include/asm/bitops.h +18 −23
  95. arch/x86/include/asm/kvm_emulate.h +3 −1
  96. arch/x86/include/asm/kvm_host.h +10 −7
  97. arch/x86/include/asm/syscall.h +33 −109
  98. arch/x86/include/asm/xen/hypercall.h +3 −0
  99. arch/x86/include/uapi/asm/vmx.h +1 −0
  100. arch/x86/kernel/cpu/bugs.c +3 −3
  101. arch/x86/kernel/cpu/intel.c +2 −2
  102. arch/x86/kernel/cpu/resctrl/rdtgroup.c +5 −4
  103. arch/x86/kernel/kprobes/core.c +46 −2
  104. arch/x86/kernel/process.c +6 −2
  105. arch/x86/kernel/reboot.c +21 −0
  106. arch/x86/kernel/vmlinux.lds.S +1 −1
  107. arch/x86/kvm/emulate.c +102 −89
  108. arch/x86/kvm/lapic.c +3 −1
  109. arch/x86/kvm/mmu.c +7 −8
  110. arch/x86/kvm/mmu.h +1 −1
  111. arch/x86/kvm/pmu.c +4 −0
  112. arch/x86/kvm/svm.c +47 −32
  113. arch/x86/kvm/trace.h +2 −2
  114. arch/x86/kvm/vmx/nested.c +81 −40
  115. arch/x86/kvm/vmx/vmx.c +31 −4
  116. arch/x86/kvm/vmx/vmx.h +2 −0
  117. arch/x86/kvm/x86.c +31 −33
  118. arch/x86/kvm/x86.h +2 −0
  119. arch/x86/mm/dump_pagetables.c +2 −1
  120. arch/x86/mm/ioremap.c +1 −1
  121. arch/x86/mm/kaslr.c +1 −1
  122. arch/x86/mm/tlb.c +1 −1
  123. arch/xtensa/include/asm/processor.h +12 −9
  124. arch/xtensa/include/asm/syscall.h +6 −27
  125. arch/xtensa/kernel/entry.S +6 −0
  126. arch/xtensa/kernel/stacktrace.c +5 −1
  127. arch/xtensa/mm/mmu.c +1 −1
  128. block/bfq-iosched.c +14 −9
  129. block/bfq-iosched.h +1 −1
  130. block/bfq-wf2q.c +15 −2
  131. block/bio.c +4 −1
  132. block/blk-core.c +1 −3
  133. block/blk-mq-sched.c +5 −3
  134. block/blk-mq.c +77 −61
  135. block/blk-mq.h +2 −4
  136. crypto/testmgr.h +43 −1
  137. drivers/acpi/acpica/evgpe.c +5 −1
  138. drivers/acpi/acpica/nsobject.c +4 −0
  139. drivers/acpi/nfit/core.c +6 −6
  140. drivers/acpi/nfit/intel.c +4 −6
  141. drivers/base/memory.c +1 −1
  142. drivers/block/null_blk_main.c +5 −0
  143. drivers/block/paride/pcd.c +13 −1
  144. drivers/block/paride/pf.c +11 −1
  145. drivers/block/virtio_blk.c +2 −0
  146. drivers/block/xsysace.c +2 −0
  147. drivers/bluetooth/btusb.c +1 −1
  148. drivers/char/Kconfig +1 −1
  149. drivers/char/ipmi/ipmi_dmi.c +0 −1
  150. drivers/char/ipmi/ipmi_msghandler.c +17 −2
  151. drivers/char/ipmi/ipmi_si_hardcode.c +2 −0
  152. drivers/char/tpm/eventlog/tpm2.c +2 −2
  153. drivers/char/tpm/tpm-dev-common.c +8 −1
  154. drivers/char/tpm/tpm-interface.c +6 −8
  155. drivers/clk/at91/clk-programmable.c +43 −14
  156. drivers/clk/at91/pmc.h +2 −0
  157. drivers/clk/at91/sama5d2.c +9 −1
  158. drivers/clk/imx/clk-pll14xx.c +1 −1
  159. drivers/clk/mediatek/clk-gate.c +1 −2
  160. drivers/clk/meson/clk-pll.c +1 −1
  161. drivers/clk/meson/g12a.c +3 −3
  162. drivers/clk/meson/gxbb.c +2 −0
  163. drivers/clk/meson/vid-pll-div.c +2 −2
  164. drivers/clk/x86/clk-pmc-atom.c +11 −3
  165. drivers/clocksource/Kconfig +1 −0
  166. drivers/clocksource/arm_arch_timer.c +1 −4
  167. drivers/clocksource/timer-oxnas-rps.c +1 −1
  168. drivers/clocksource/timer-ti-dm.c +0 −28
  169. drivers/cpufreq/intel_pstate.c +4 −1
  170. drivers/crypto/caam/caamhash.c +6 −7
  171. drivers/extcon/Kconfig +1 −1
  172. drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +15 −4
  173. drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +3 −0
  174. drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 −2
  175. drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +1 −0
  176. drivers/gpu/drm/amd/amdkfd/kfd_device.c +1 −0
  177. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 −0
  178. drivers/gpu/drm/amd/display/dc/core/dc.c +19 −0
  179. drivers/gpu/drm/amd/display/dc/core/dc_link.c +6 −0
  180. drivers/gpu/drm/amd/display/dc/dc.h +3 −0
  181. drivers/gpu/drm/amd/display/dc/dce/dce_aux.c +6 −3
  182. drivers/gpu/drm/amd/display/dc/dce/dce_aux.h +3 −3
  183. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c +2 −21
  184. drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +18 −2
  185. drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h +1 −0
  186. drivers/gpu/drm/amd/powerplay/inc/smu11_driver_if.h +3 −2
  187. drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +30 −4
  188. drivers/gpu/drm/drm_atomic_helper.c +2 −3
  189. drivers/gpu/drm/i915/gvt/display.c +1 −1
  190. drivers/gpu/drm/i915/gvt/dmabuf.c +6 −7
  191. drivers/gpu/drm/i915/gvt/gtt.c +10 −4
  192. drivers/gpu/drm/i915/gvt/kvmgt.c +3 −3
  193. drivers/gpu/drm/i915/gvt/scheduler.c +3 −2
  194. drivers/gpu/drm/i915/i915_debugfs.c +4 −1
  195. drivers/gpu/drm/i915/icl_dsi.c +27 −21
  196. drivers/gpu/drm/i915/intel_ddi.c +11 −12
  197. drivers/gpu/drm/i915/intel_display.c +1 −5
  198. drivers/gpu/drm/i915/intel_dp.c +10 −59
  199. drivers/gpu/drm/i915/intel_drv.h +6 −4
  200. drivers/gpu/drm/i915/vlv_dsi.c +24 −0
  201. drivers/gpu/drm/mediatek/mtk_dpi.c +3 −5
  202. drivers/gpu/drm/mediatek/mtk_drm_drv.c +7 −0
  203. drivers/gpu/drm/mediatek/mtk_drm_gem.c +46 −0
  204. drivers/gpu/drm/mediatek/mtk_drm_gem.h +3 −0
  205. drivers/gpu/drm/mediatek/mtk_hdmi.c +1 −1
  206. drivers/gpu/drm/mediatek/mtk_hdmi_phy.c +5 −30
  207. drivers/gpu/drm/mediatek/mtk_hdmi_phy.h +1 −4
  208. drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c +43 −6
  209. drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c +23 −0
  210. drivers/gpu/drm/omapdrm/dss/hdmi4_cec.c +19 −7
  211. drivers/gpu/drm/omapdrm/dss/hdmi4_core.c +1 −1
  212. drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c +7 −2
  213. drivers/gpu/drm/sun4i/sun8i_tcon_top.c +3 −2
  214. drivers/gpu/drm/tegra/hdmi.c +9 −3
  215. drivers/gpu/drm/ttm/ttm_bo.c +3 −1
  216. drivers/gpu/drm/ttm/ttm_page_alloc.c +7 −6
  217. drivers/gpu/drm/udl/udl_drv.c +1 −0
  218. drivers/gpu/drm/udl/udl_drv.h +1 −0
  219. drivers/gpu/drm/udl/udl_main.c +7 −1
  220. drivers/gpu/host1x/hw/channel_hw.c +5 −1
  221. drivers/hid/Kconfig +1 −0
  222. drivers/hid/hid-core.c +3 −3
  223. drivers/hid/hid-debug.c +5 −0
  224. drivers/hid/hid-ids.h +1 −0
  225. drivers/hid/hid-input.c +17 −1
  226. drivers/hid/hid-logitech-hidpp.c +10 −3
  227. drivers/hid/hid-quirks.c +7 −4
  228. drivers/hid/hid-steam.c +19 −7
  229. drivers/hid/hid-uclogic-params.c +0 −4
  230. drivers/hid/i2c-hid/i2c-hid-core.c +2 −0
  231. drivers/hwmon/Kconfig +1 −0
  232. drivers/hwmon/ntc_thermistor.c +1 −1
  233. drivers/hwmon/occ/common.c +4 −2
  234. drivers/i2c/busses/i2c-imx.c +3 −1
  235. drivers/i3c/master.c +2 −3
  236. drivers/i3c/master/dw-i3c-master.c +1 −1
  237. drivers/iio/accel/kxcjk-1013.c +2 −0
  238. drivers/iio/adc/ad_sigma_delta.c +1 −0
  239. drivers/iio/adc/at91_adc.c +17 −11
  240. drivers/iio/adc/xilinx-xadc-core.c +2 −1
  241. drivers/iio/chemical/Kconfig +14 −0
  242. drivers/iio/chemical/bme680.h +2 −4
  243. drivers/iio/chemical/bme680_core.c +45 −9
  244. drivers/iio/chemical/bme680_i2c.c +0 −21
  245. drivers/iio/chemical/bme680_spi.c +78 −37
  246. drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c +4 −3
  247. drivers/iio/dac/mcp4725.c +1 −0
  248. drivers/iio/gyro/bmg160_core.c +3 −3
  249. drivers/iio/gyro/mpu3050-core.c +5 −3
  250. drivers/iio/industrialio-buffer.c +2 −3
  251. drivers/iio/industrialio-core.c +2 −2
  252. drivers/infiniband/core/uverbs_main.c +3 −0
  253. drivers/infiniband/hw/hfi1/chip.c +19 −7
  254. drivers/infiniband/hw/hfi1/qp.c +3 −1
  255. drivers/infiniband/hw/hfi1/rc.c +2 −2
  256. drivers/infiniband/hw/hfi1/tid_rdma.c +8 −23
  257. drivers/infiniband/hw/hns/hns_roce_hem.c +4 −2
  258. drivers/infiniband/hw/hns/hns_roce_mr.c +2 −2
  259. drivers/infiniband/hw/hns/hns_roce_qp.c +0 −3
  260. drivers/infiniband/hw/mlx5/odp.c +2 −1
  261. drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c +2 −0
  262. drivers/input/keyboard/snvs_pwrkey.c +3 −3
  263. drivers/input/mouse/elan_i2c_core.c +25 −0
  264. drivers/iommu/amd_iommu_init.c +1 −1
  265. drivers/irqchip/irq-ls1x.c +1 −0
  266. drivers/isdn/mISDN/socket.c +2 −2
  267. drivers/lightnvm/pblk-read.c +28 −22
  268. drivers/md/dm-core.h +1 −0
  269. drivers/md/dm-init.c +1 −1
  270. drivers/md/dm-integrity.c +7 −9
  271. drivers/md/dm-rq.c +7 −4
  272. drivers/md/dm-table.c +39 −0
  273. drivers/md/dm.c +17 −13
  274. drivers/mfd/Kconfig +1 −1
  275. drivers/mfd/sprd-sc27xx-spi.c +21 −21
  276. drivers/mfd/twl-core.c +23 −0
  277. drivers/misc/fastrpc.c +6 −1
  278. drivers/misc/habanalabs/goya/goya.c +4 −5
  279. drivers/mmc/host/alcor.c +13 −21
  280. drivers/mmc/host/sdhci-omap.c +38 −0
  281. drivers/mtd/chips/cfi_cmdset_0002.c +5 −1
  282. drivers/net/bonding/bond_main.c +5 −1
  283. drivers/net/bonding/bond_sysfs_slave.c +3 −1
  284. drivers/net/dsa/mv88e6xxx/port.c +16 −8
  285. drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c +1 −1
  286. drivers/net/ethernet/broadcom/bnxt/bnxt.c +13 −3
  287. drivers/net/ethernet/broadcom/tg3.c +4 −4
  288. drivers/net/ethernet/broadcom/tg3.h +2 −2
  289. drivers/net/ethernet/cadence/macb_main.c +3 −1
  290. drivers/net/ethernet/cavium/thunder/nicvf_main.c +32 −10
  291. drivers/net/ethernet/cavium/thunder/nicvf_queues.c +14 −16
  292. drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c +8 −1
  293. drivers/net/ethernet/freescale/fec_main.c +21 −9
  294. drivers/net/ethernet/hisilicon/hns/hnae.c +3 −1
  295. drivers/net/ethernet/hisilicon/hns/hnae.h +1 −1
  296. drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c +1 −1
  297. drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h +2 −2
  298. drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c +33 −20
  299. drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h +2 −0
  300. drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c +1 −1
  301. drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c +3 −3
  302. drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.h +2 −2
  303. drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c +2 −2
  304. drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h +6 −6
  305. drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c +1 −1
  306. drivers/net/ethernet/hisilicon/hns/hns_enet.c +5 −7
  307. drivers/net/ethernet/hisilicon/hns3/hns3pf/Makefile +1 −1
  308. drivers/net/ethernet/hisilicon/hns3/hns3vf/Makefile +1 −1
  309. drivers/net/ethernet/hisilicon/hns_mdio.c +7 −11
  310. drivers/net/ethernet/ibm/ibmvnic.c +28 −9
  311. drivers/net/ethernet/intel/fm10k/fm10k_main.c +2 −0
  312. drivers/net/ethernet/intel/i40e/i40e.h +2 −14
  313. drivers/net/ethernet/intel/i40e/i40e_ethtool.c +1 −2
  314. drivers/net/ethernet/intel/i40e/i40e_main.c +28 −0
  315. drivers/net/ethernet/intel/i40e/i40e_ptp.c +3 −2
  316. drivers/net/ethernet/intel/i40e/i40e_xsk.c +3 −0
  317. drivers/net/ethernet/intel/igb/e1000_defines.h +2 −0
  318. drivers/net/ethernet/intel/igb/igb_main.c +8 −49
  319. drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c +9 −7
  320. drivers/net/ethernet/mellanox/mlx5/core/en.h +1 −0
  321. drivers/net/ethernet/mellanox/mlx5/core/en/port.c +0 −3
  322. drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c +22 −17
  323. drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c +8 −3
  324. drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c +4 −0
  325. drivers/net/ethernet/mellanox/mlx5/core/en_common.c +11 −2
  326. drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +36 −19
  327. drivers/net/ethernet/mellanox/mlx5/core/en_main.c +16 −5
  328. drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +75 −19
  329. drivers/net/ethernet/mellanox/mlx5/core/en_stats.c +6 −0
  330. drivers/net/ethernet/mellanox/mlx5/core/en_stats.h +4 −0
  331. drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +68 −14
  332. drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +5 −4
  333. drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +1 −0
  334. drivers/net/ethernet/mellanox/mlx5/core/fpga/tls.c +24 −29
  335. drivers/net/ethernet/mellanox/mlx5/core/main.c +0 −20
  336. drivers/net/ethernet/mellanox/mlxsw/core.c +3 −3
  337. drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c +11 −8
  338. drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +1 −1
  339. drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +1 −1
  340. drivers/net/ethernet/mscc/ocelot.c +15 −9
  341. drivers/net/ethernet/neterion/vxge/vxge-config.c +1 −0
  342. drivers/net/ethernet/netronome/nfp/flower/action.c +1 −2
  343. drivers/net/ethernet/netronome/nfp/flower/cmsg.h +1 −2
  344. drivers/net/ethernet/netronome/nfp/flower/match.c +13 −14
  345. drivers/net/ethernet/netronome/nfp/nfp_net_repr.c +2 −2
  346. drivers/net/ethernet/qlogic/qed/qed.h +5 −2
  347. drivers/net/ethernet/qlogic/qed/qed_dev.c +34 −51
  348. drivers/net/ethernet/qlogic/qed/qed_int.c +63 −20
  349. drivers/net/ethernet/qlogic/qed/qed_int.h +2 −2
  350. drivers/net/ethernet/qlogic/qed/qed_main.c +1 −1
  351. drivers/net/ethernet/qlogic/qed/qed_sriov.c +1 −1
  352. drivers/net/ethernet/qlogic/qede/qede_ptp.c +3 −4
  353. drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +1 −1
  354. drivers/net/ethernet/realtek/r8169.c +7 −1
  355. drivers/net/ethernet/stmicro/stmmac/descs_com.h +14 −8
  356. drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c +1 −1
  357. drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c +1 −1
  358. drivers/net/ethernet/stmicro/stmmac/enh_desc.c +16 −6
  359. drivers/net/ethernet/stmicro/stmmac/hwif.h +1 −1
  360. drivers/net/ethernet/stmicro/stmmac/norm_desc.c +7 −5
  361. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +19 −15
  362. drivers/net/hyperv/hyperv_net.h +1 −0
  363. drivers/net/hyperv/netvsc.c +4 −2
  364. drivers/net/hyperv/netvsc_drv.c +26 −6
  365. drivers/net/team/team.c +26 −0
  366. drivers/net/usb/qmi_wwan.c +1 −0
  367. drivers/net/vrf.c +7 −2
  368. drivers/net/wireless/ath/ath10k/htt_rx.c +1 −1
  369. drivers/net/wireless/ath/ath10k/mac.c +2 −2
  370. drivers/net/wireless/ath/ath9k/xmit.c +4 −1
  371. drivers/net/wireless/intel/iwlwifi/cfg/22000.c +22 −8
  372. drivers/net/wireless/intel/iwlwifi/fw/dbg.c +8 −26
  373. drivers/net/wireless/intel/iwlwifi/fw/init.c +0 −1
  374. drivers/net/wireless/intel/iwlwifi/iwl-config.h +2 −1
  375. drivers/net/wireless/intel/iwlwifi/iwl-csr.h +1 −0
  376. drivers/net/wireless/intel/iwlwifi/iwl-trans.h +6 −6
  377. drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +22 −49
  378. drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +0 −1
  379. drivers/net/wireless/intel/iwlwifi/mvm/sta.c +4 −39
  380. drivers/net/wireless/intel/iwlwifi/mvm/sta.h +2 −5
  381. drivers/net/wireless/intel/iwlwifi/pcie/drv.c +7 −6
  382. drivers/net/wireless/intel/iwlwifi/pcie/internal.h +1 −1
  383. drivers/net/wireless/intel/iwlwifi/pcie/trans.c +8 −3
  384. drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c +1 −1
  385. drivers/net/wireless/intel/iwlwifi/pcie/tx.c +1 −1
  386. drivers/net/wireless/mac80211_hwsim.c +15 −4
  387. drivers/net/wireless/mediatek/mt76/mt7603/init.c +2 −0
  388. drivers/net/wireless/mediatek/mt76/mt7603/mac.c +14 −39
  389. drivers/net/wireless/mediatek/mt76/mt7603/main.c +4 −4
  390. drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h +1 −1
  391. drivers/net/wireless/mediatek/mt76/mt76x02_mac.c +8 −6
  392. drivers/net/wireless/ralink/rt2x00/rt2x00.h +0 −1
  393. drivers/net/wireless/ralink/rt2x00/rt2x00mac.c +0 −10
  394. drivers/net/wireless/ralink/rt2x00/rt2x00queue.c +9 −6
  395. drivers/nvdimm/btt_devs.c +13 −5
  396. drivers/nvdimm/namespace_devs.c +4 −1
  397. drivers/nvdimm/pmem.c +4 −4
  398. drivers/nvdimm/security.c +73 −45
  399. drivers/nvme/host/core.c +1 −1
  400. drivers/nvme/host/fc.c +15 −5
  401. drivers/nvme/target/admin-cmd.c +5 −0
  402. drivers/nvme/target/discovery.c +45 −23
  403. drivers/nvme/target/nvmet.h +1 −0
  404. drivers/parisc/iosapic.c +5 −1
  405. drivers/pci/hotplug/pciehp_ctrl.c +4 −0
  406. drivers/pci/quirks.c +2 −0
  407. drivers/platform/x86/pmc_atom.c +21 −0
  408. drivers/power/supply/goldfish_battery.c +1 −1
  409. drivers/reset/reset-meson-audio-arb.c +1 −0
  410. drivers/rtc/Kconfig +2 −2
  411. drivers/rtc/rtc-cros-ec.c +2 −2
  412. drivers/rtc/rtc-da9063.c +7 −0
  413. drivers/rtc/rtc-sh.c +1 −1
  414. drivers/s390/block/dasd_eckd.c +3 −3
  415. drivers/s390/char/con3270.c +1 −1
  416. drivers/s390/char/fs3270.c +2 −1
  417. drivers/s390/char/raw3270.c +2 −1
  418. drivers/s390/char/raw3270.h +3 −1
  419. drivers/s390/char/tty3270.c +2 −1
  420. drivers/s390/crypto/ap_queue.c +1 −1
  421. drivers/s390/crypto/pkey_api.c +2 −1
  422. drivers/scsi/aic7xxx/aic7770_osm.c +1 −0
  423. drivers/scsi/aic7xxx/aic7xxx.h +1 −0
  424. drivers/scsi/aic7xxx/aic7xxx_osm.c +4 −6
  425. drivers/scsi/aic7xxx/aic7xxx_osm_pci.c +1 −0
  426. drivers/scsi/csiostor/csio_scsi.c +4 −1
  427. drivers/scsi/libfc/fc_rport.c +0 −1
  428. drivers/scsi/lpfc/lpfc_scsi.c +3 −4
  429. drivers/scsi/qedi/qedi_main.c +2 −5
  430. drivers/scsi/scsi_devinfo.c +1 −0
  431. drivers/scsi/scsi_dh.c +1 −0
  432. drivers/scsi/scsi_lib.c +5 −1
  433. drivers/scsi/storvsc_drv.c +12 −3
  434. drivers/scsi/virtio_scsi.c +1 −0
  435. drivers/staging/comedi/drivers/ni_usb6501.c +4 −6
  436. drivers/staging/comedi/drivers/vmk80xx.c +3 −5
  437. drivers/staging/erofs/data.c +1 −1
  438. drivers/staging/iio/adc/ad7192.c +4 −4
  439. drivers/staging/iio/meter/ade7854.c +1 −1
  440. drivers/staging/most/core.c +1 −1
  441. drivers/tty/serial/sc16is7xx.c +3 −1
  442. drivers/tty/serial/sh-sci.c +4 −2
  443. drivers/tty/vt/vt.c +2 −1
  444. drivers/vfio/pci/vfio_pci.c +2 −2
  445. drivers/vfio/vfio_iommu_spapr_tce.c +1 −1
  446. drivers/vfio/vfio_iommu_type1.c +14 −0
  447. drivers/vhost/vhost.c +5 −1
  448. drivers/virtio/virtio_pci_common.c +5 −3
  449. drivers/virtio/virtio_ring.c +2 −0
  450. drivers/xen/privcmd-buf.c +1 −2
  451. drivers/xen/xenbus/xenbus_dev_frontend.c +1 −3
  452. fs/afs/callback.c +1 −2
  453. fs/afs/cmservice.c +1 −1
  454. fs/afs/inode.c +1 −3
  455. fs/afs/internal.h +1 −3
  456. fs/afs/rxrpc.c +22 −8
  457. fs/afs/server.c +0 −1
  458. fs/afs/write.c +1 −0
  459. fs/aio.c +150 −188
  460. fs/block_dev.c +4 −4
  461. fs/btrfs/ioctl.c +10 −0
  462. fs/btrfs/props.c +4 −4
  463. fs/cifs/cifsfs.c +2 −0
  464. fs/cifs/cifsglob.h +10 −0
  465. fs/cifs/connect.c +29 −1
  466. fs/cifs/file.c +25 −5
  467. fs/cifs/misc.c +23 −2
  468. fs/cifs/smb2file.c +4 −2
  469. fs/cifs/smb2misc.c +3 −3
  470. fs/cifs/smb2ops.c +44 −26
  471. fs/cifs/smb2pdu.c +40 −20
  472. fs/cifs/smb2proto.h +3 −2
  473. fs/dax.c +15 −0
  474. fs/debugfs/inode.c +9 −4
  475. fs/fuse/dev.c +6 −6
  476. fs/hugetlbfs/inode.c +14 −6
  477. fs/io_uring.c +35 −11
  478. fs/jffs2/readinode.c +0 −5
  479. fs/jffs2/super.c +4 −1
  480. fs/nfs/nfs42proc.c +0 −3
  481. fs/nfs/nfs4file.c +3 −1
  482. fs/nfs/nfs4xdr.c +2 −2
  483. fs/nfs/super.c +2 −1
  484. fs/open.c +18 −0
  485. fs/pipe.c +2 −2
  486. fs/proc/base.c +9 −8
  487. fs/proc/task_mmu.c +18 −0
  488. fs/read_write.c +3 −2
  489. fs/splice.c +10 −2
  490. fs/ubifs/super.c +1 −3
  491. fs/userfaultfd.c +9 −0
  492. include/asm-generic/syscall.h +5 −16
  493. include/drm/drm_modeset_helper_vtables.h +4 −0
  494. include/dt-bindings/clock/sifive-fu540-prci.h +18 −0
  495. include/dt-bindings/reset/amlogic,meson-g12a-reset.h +4 −1
  496. include/keys/trusted.h +1 −1
  497. include/linux/bio.h +12 −8
  498. include/linux/bitrev.h +23 −23
  499. include/linux/blk-mq.h +1 −0
  500. include/linux/blkdev.h +0 −1
  501. include/linux/bvec.h +18 −6
  502. include/linux/efi.h +6 −1
  503. include/linux/elevator.h +1 −0
  504. include/linux/fs.h +4 −0
  505. include/linux/kernel.h +2 −2
  506. include/linux/kprobes.h +1 −0
  507. include/linux/kvm_host.h +6 −4
  508. include/linux/memcontrol.h +4 −1
  509. include/linux/mii.h +1 −1
  510. include/linux/mlx5/driver.h +2 −0
  511. include/linux/mm.h +14 −1
  512. include/linux/mm_types.h +1 −1
  513. include/linux/netdevice.h +3 −0
  514. include/linux/nvme.h +7 −2
  515. include/linux/pipe_fs_i.h +6 −4
  516. include/linux/platform_data/x86/clk-pmc-atom.h +3 −0
  517. include/linux/ptrace.h +8 −3
  518. include/linux/sched/mm.h +21 −0
  519. include/linux/shmem_fs.h +1 −0
  520. include/linux/string.h +3 −0
  521. include/linux/sunrpc/sched.h +0 −8
  522. include/linux/virtio_ring.h +1 −1
  523. include/net/af_rxrpc.h +3 −1
  524. include/net/cfg80211.h +5 −0
  525. include/net/ip.h +1 −1
  526. include/net/mac80211.h +34 −29
  527. include/net/net_namespace.h +1 −0
  528. include/net/netns/hash.h +2 −8
  529. include/net/netrom.h +1 −1
  530. include/net/nfc/nci_core.h +1 −1
  531. include/net/sch_generic.h +37 −7
  532. include/net/sock.h +0 −6
  533. include/net/tls.h +3 −1
  534. include/sound/soc.h +9 −2
  535. include/trace/events/syscalls.h +1 −1
  536. include/uapi/linux/ethtool.h +1 −1
  537. include/uapi/linux/input-event-codes.h +4 −2
  538. include/uapi/sound/asound.h +1 −0
  539. init/main.c +2 −2
  540. kernel/bpf/cpumap.c +10 −3
  541. kernel/bpf/inode.c +18 −14
  542. kernel/bpf/verifier.c +3 −2
  543. kernel/dma/debug.c +1 −1
  544. kernel/events/core.c +64 −25
  545. kernel/events/ring_buffer.c +17 −20
  546. kernel/irq/chip.c +4 −0
  547. kernel/irq/irqdesc.c +1 −0
  548. kernel/kprobes.c +2 −4
  549. kernel/locking/lockdep.c +8 −12
  550. kernel/sched/deadline.c +1 −2
  551. kernel/sched/fair.c +28 −3
  552. kernel/seccomp.c +1 −1
  553. kernel/signal.c +5 −10
  554. kernel/sysctl.c +2 −1
  555. kernel/time/alarmtimer.c +1 −1
  556. kernel/time/sched_clock.c +2 −2
  557. kernel/time/tick-common.c +2 −0
  558. kernel/time/timekeeping.h +7 −0
  559. kernel/trace/ftrace.c +5 −1
  560. kernel/trace/trace.c +5 −1
  561. kernel/trace/trace_syscalls.c +6 −3
  562. kernel/watchdog_hld.c +2 −1
  563. lib/Kconfig.debug +3 −3
  564. lib/iov_iter.c +4 −0
  565. lib/lzo/lzo1x_compress.c +6 −3
  566. lib/lzo/lzo1x_decompress_safe.c +1 −3
  567. lib/string.c +20 −0
  568. lib/syscall.c +25 −32
  569. mm/compaction.c +18 −11
  570. mm/gup.c +36 −12
  571. mm/huge_memory.c +36 −0
  572. mm/hugetlb.c +13 −0
  573. mm/kmemleak.c +13 −5
  574. mm/memcontrol.c +18 −2
  575. mm/mmap.c +6 −1
  576. mm/page_alloc.c +18 −12
  577. mm/percpu.c +4 −4
  578. mm/shmem.c +27 −31
  579. mm/slab.c +2 −2
  580. mm/swapfile.c +17 −15
  581. mm/util.c +1 −1
  582. mm/vmscan.c +9 −20
  583. mm/vmstat.c +0 −5
  584. net/8021q/vlan_dev.c +15 −11
  585. net/atm/lec.c +5 −1
  586. net/batman-adv/bat_v_elp.c +4 −2
  587. net/batman-adv/bridge_loop_avoidance.c +13 −3
  588. net/batman-adv/sysfs.c +5 −2
  589. net/batman-adv/translation-table.c +24 −8
  590. net/bluetooth/sco.c +2 −2
  591. net/bridge/br_input.c +14 −9
  592. net/bridge/br_multicast.c +6 −1
  593. net/bridge/br_netlink.c +1 −1
  594. net/core/datagram.c +1 −1
  595. net/core/dev.c +18 −2
  596. net/core/ethtool.c +30 −16
  597. net/core/failover.c +3 −3
  598. net/core/filter.c +5 −13
  599. net/core/flow_dissector.c +3 −1
  600. net/core/net-sysfs.c +5 −9
  601. net/core/net_namespace.c +1 −0
  602. net/core/ptp_classifier.c +4 −3
  603. net/core/rtnetlink.c +1 −1
  604. net/core/skbuff.c +10 −2
  605. net/core/sock.c +2 −2
  606. net/dccp/feat.c +6 −1
  607. net/dsa/tag_qca.c +10 −0
  608. net/ipv4/fou.c +3 −1
  609. net/ipv4/ip_gre.c +10 −5
  610. net/ipv4/ip_input.c +3 −4
  611. net/ipv4/ip_options.c +2 −2
  612. net/ipv4/route.c +15 −1
  613. net/ipv4/tcp_dctcp.c +35 −46
  614. net/ipv4/tcp_input.c +5 −5
  615. net/ipv4/tcp_ipv4.c +2 −1
  616. net/ipv6/ila/ila_xlat.c +1 −0
  617. net/ipv6/ip6_gre.c +13 −7
  618. net/ipv6/ip6_output.c +3 −1
  619. net/ipv6/ip6_tunnel.c +2 −2
  620. net/ipv6/route.c +4 −0
  621. net/ipv6/sit.c +4 −0
  622. net/ipv6/udp.c +2 −0
  623. net/kcm/kcmsock.c +8 −8
  624. net/llc/af_llc.c +1 −2
  625. net/mac80211/driver-ops.h +3 −0
  626. net/mac80211/key.c +4 −5
  627. net/mac80211/mesh_pathtbl.c +1 −1
  628. net/mac80211/rx.c +9 −1
  629. net/mac80211/trace_msg.h +6 −1
  630. net/mac80211/tx.c +23 −30
  631. net/netlink/af_netlink.c +2 −1
  632. net/netrom/af_netrom.c +54 −22
  633. net/netrom/nr_loopback.c +1 −1
  634. net/netrom/nr_route.c +1 −1
  635. net/netrom/sysctl_net_netrom.c +4 −1
  636. net/nfc/nci/hci.c +8 −0
  637. net/openvswitch/flow_netlink.c +2 −2
  638. net/rds/af_rds.c +3 −0
  639. net/rds/bind.c +2 −0
  640. net/rds/tcp.c +1 −1
  641. net/rxrpc/af_rxrpc.c +11 −6
  642. net/rxrpc/ar-internal.h +1 −0
  643. net/rxrpc/conn_event.c +7 −4
  644. net/rxrpc/input.c +12 −6
  645. net/rxrpc/peer_event.c +5 −0
  646. net/rxrpc/sendmsg.c +12 −9
  647. net/sched/act_sample.c +8 −2
  648. net/sched/cls_matchall.c +5 −0
  649. net/sched/sch_cake.c +12 −1
  650. net/sched/sch_cbq.c +4 −6
  651. net/sched/sch_drr.c +4 −12
  652. net/sched/sch_hfsc.c +5 −14
  653. net/sched/sch_htb.c +6 −16
  654. net/sched/sch_mq.c +1 −1
  655. net/sched/sch_mqprio.c +1 −2
  656. net/sched/sch_multiq.c +4 −6
  657. net/sched/sch_prio.c +3 −7
  658. net/sched/sch_qfq.c +2 −12
  659. net/sched/sch_red.c +1 −2
  660. net/sched/sch_sfb.c +1 −2
  661. net/sched/sch_taprio.c +1 −1
  662. net/sched/sch_tbf.c +1 −2
  663. net/sctp/protocol.c +1 −0
  664. net/sctp/socket.c +2 −1
  665. net/smc/af_smc.c +39 −19
  666. net/smc/smc_close.c +21 −4
  667. net/smc/smc_close.h +1 −0
  668. net/smc/smc_ism.c +5 −0
  669. net/smc/smc_pnet.c +2 −1
  670. net/strparser/strparser.c +5 −7
  671. net/sunrpc/clnt.c +13 −39
  672. net/sunrpc/xprtrdma/verbs.c +1 −1
  673. net/tipc/link.c +2 −0
  674. net/tipc/name_table.c +2 −1
  675. net/tipc/netlink_compat.c +20 −4
  676. net/tipc/sysctl.c +6 −2
  677. net/tls/tls_device.c +11 −1
  678. net/tls/tls_main.c +24 −0
  679. net/tls/tls_sw.c +3 −14
  680. net/wireless/nl80211.c +12 −6
  681. net/wireless/reg.c +39 −0
  682. net/wireless/scan.c +1 −2
  683. net/wireless/util.c +4 −2
  684. scripts/atomic/gen-atomics.sh +1 −1
  685. scripts/coccinelle/api/stream_open.cocci +363 −0
  686. security/apparmor/lsm.c +48 −1
  687. security/device_cgroup.c +1 −1
  688. security/keys/trusted.c +25 −7
  689. sound/core/info.c +10 −2
  690. sound/core/init.c +9 −9
  691. sound/core/seq/seq_clientmgr.c +3 −3
  692. sound/hda/ext/hdac_ext_bus.c +0 −1
  693. sound/hda/hdac_bus.c +1 −0
  694. sound/hda/hdac_component.c +5 −1
  695. sound/pci/hda/hda_codec.c +1 −0
  696. sound/pci/hda/hda_intel.c +4 −0
  697. sound/pci/hda/patch_realtek.c +57 −21
  698. sound/soc/codecs/Kconfig +1 −0
  699. sound/soc/codecs/ab8500-codec.c +1 −0
  700. sound/soc/codecs/cs35l35.c +11 −0
  701. sound/soc/codecs/cs4270.c +1 −0
  702. sound/soc/codecs/hdac_hda.c +39 −14
  703. sound/soc/codecs/hdac_hda.h +1 −0
  704. sound/soc/codecs/hdmi-codec.c +59 −62
  705. sound/soc/codecs/nau8810.c +2 −2
  706. sound/soc/codecs/nau8824.c +38 −8
  707. sound/soc/codecs/rt5682.c +25 −31
  708. sound/soc/codecs/tlv320aic32x4-i2c.c +2 −2
  709. sound/soc/codecs/tlv320aic32x4-spi.c +2 −2
  710. sound/soc/codecs/tlv320aic32x4.c +2 −0
  711. sound/soc/codecs/tlv320aic3x.c +3 −1
  712. sound/soc/codecs/wm_adsp.c +33 −7
  713. sound/soc/codecs/wm_adsp.h +1 −0
  714. sound/soc/fsl/fsl_asrc.c +14 −0
  715. sound/soc/fsl/fsl_esai.c +37 −10
  716. sound/soc/generic/audio-graph-card.c +8 −3
  717. sound/soc/generic/simple-card.c +9 −3
  718. sound/soc/intel/atom/sst-mfld-platform-pcm.c +8 −0
  719. sound/soc/intel/boards/cht_bsw_max98090_ti.c +41 −6
  720. sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c +1 −1
  721. sound/soc/intel/skylake/skl-messages.c +1 −0
  722. sound/soc/intel/skylake/skl-pcm.c +22 −6
  723. sound/soc/mediatek/common/mtk-btcvsd.c +68 −1
  724. sound/soc/mediatek/mt8183/mt8183-afe-clk.c +4 −0
  725. sound/soc/rockchip/rockchip_pdm.c +3 −1
  726. sound/soc/samsung/i2s.c +6 −4
  727. sound/soc/samsung/odroid.c +2 −2
  728. sound/soc/sh/rcar/core.c +2 −0
  729. sound/soc/sh/rcar/rsnd.h +5 −0
  730. sound/soc/sh/rcar/src.c +7 −14
  731. sound/soc/soc-core.c +4 −2
  732. sound/soc/soc-dapm.c +11 −0
  733. sound/soc/soc-pcm.c +55 −11
  734. sound/soc/soc-topology.c +4 −3
  735. sound/soc/stm/stm32_adfsdm.c +34 −4
  736. sound/soc/stm/stm32_i2s.c +1 −2
  737. sound/soc/stm/stm32_sai.c +5 −3
  738. sound/soc/stm/stm32_sai_sub.c +86 −28
  739. sound/xen/xen_snd_front_alsa.c +1 −1
  740. tools/include/uapi/sound/asound.h +1 −0
  741. tools/io_uring/io_uring-bench.c +4 −28
  742. tools/lib/bpf/Makefile +4 −3
  743. tools/lib/bpf/btf.c +3 −0
  744. tools/lib/traceevent/event-parse.c +1 −1
  745. tools/objtool/check.c +1 −0
  746. tools/perf/builtin-stat.c +1 −0
  747. tools/perf/builtin-top.c +1 −0
  748. tools/perf/scripts/python/export-to-sqlite.py +1 −1
  749. tools/perf/util/env.c +6 −2
  750. tools/perf/util/evlist.c +9 −5
  751. tools/perf/util/evsel.c +6 −6
  752. tools/perf/util/header.c +13 −9
  753. tools/perf/util/map.c +17 −3
  754. tools/perf/util/map.h +3 −1
  755. tools/power/x86/turbostat/turbostat.c +219 −58
  756. tools/testing/nvdimm/test/nfit.c +13 −4
  757. tools/testing/selftests/bpf/prog_tests/flow_dissector.c +68 −0
  758. tools/testing/selftests/bpf/progs/bpf_flow.c +7 −12
  759. tools/testing/selftests/bpf/test_btf.c +47 −0
  760. tools/testing/selftests/bpf/verifier/calls.c +38 −0
  761. tools/testing/selftests/drivers/net/mlxsw/rtnetlink.sh +20 −0
  762. tools/testing/selftests/kvm/Makefile +8 −1
  763. tools/testing/selftests/kvm/include/x86_64/processor.h +27 −0
  764. tools/testing/selftests/kvm/lib/kvm_util.c +5 −0
  765. tools/testing/selftests/kvm/lib/x86_64/processor.c +14 −6
  766. tools/testing/selftests/kvm/x86_64/evmcs_test.c +3 −2
  767. tools/testing/selftests/kvm/x86_64/smm_test.c +157 −0
  768. tools/testing/selftests/kvm/x86_64/state_test.c +1 −14
  769. tools/testing/selftests/net/fib_tests.sh +40 −54
  770. tools/testing/selftests/proc/proc-pid-vm.c +2 −2
  771. tools/testing/selftests/proc/proc-self-map-files-002.c +10 −10
  772. tools/testing/selftests/tc-testing/tc-tests/actions/sample.json +24 −0
  773. tools/testing/selftests/tc-testing/tc-tests/filters/tests.json +20 −0
  774. tools/testing/selftests/tpm2/tpm2.py +3 −2
  775. tools/testing/selftests/tpm2/tpm2_tests.py +63 −0
  776. virt/kvm/irqchip.c +3 −2
  777. virt/kvm/kvm_main.c +4 −2
.clang-format+24−0
@@ -78,6 +78,8 @@ ForEachMacros: · 77 unmodified lines
7878 - 'ata_qc_for_each_with_internal'
7979 - 'ax25_for_each'
8080 - 'ax25_uid_for_each'
81+ - '__bio_for_each_bvec'
82+ - 'bio_for_each_bvec'
8183 - 'bio_for_each_integrity_vec'
8284 - '__bio_for_each_segment'
8385 - 'bio_for_each_segment'
@@ -118,10 +120,12 @@ ForEachMacros: · 34 unmodified lines
118120 - 'drm_for_each_legacy_plane'
119121 - 'drm_for_each_plane'
120122 - 'drm_for_each_plane_mask'
123+ - 'drm_for_each_privobj'
121124 - 'drm_mm_for_each_hole'
122125 - 'drm_mm_for_each_node'
123126 - 'drm_mm_for_each_node_in_range'
124127 - 'drm_mm_for_each_node_safe'
128+ - 'flow_action_for_each'
125129 - 'for_each_active_drhd_unit'
126130 - 'for_each_active_iommu'
127131 - 'for_each_available_child_of_node'
@@ -158,6 +162,9 @@ ForEachMacros: · 30 unmodified lines
158162 - 'for_each_dss_dev'
159163 - 'for_each_efi_memory_desc'
160164 - 'for_each_efi_memory_desc_in_map'
165+ - 'for_each_element'
166+ - 'for_each_element_extid'
167+ - 'for_each_element_id'
161168 - 'for_each_endpoint_of_node'
162169 - 'for_each_evictable_lru'
163170 - 'for_each_fib6_node_rt_rcu'
@@ -195,6 +202,7 @@ ForEachMacros: · 31 unmodified lines
195202 - 'for_each_net_rcu'
196203 - 'for_each_new_connector_in_state'
197204 - 'for_each_new_crtc_in_state'
205+ - 'for_each_new_mst_mgr_in_state'
198206 - 'for_each_new_plane_in_state'
199207 - 'for_each_new_private_obj_in_state'
200208 - 'for_each_node'
@@ -210,8 +218,10 @@ ForEachMacros: · 9 unmodified lines
210218 - 'for_each_of_pci_range'
211219 - 'for_each_old_connector_in_state'
212220 - 'for_each_old_crtc_in_state'
221+ - 'for_each_old_mst_mgr_in_state'
213222 - 'for_each_oldnew_connector_in_state'
214223 - 'for_each_oldnew_crtc_in_state'
224+ - 'for_each_oldnew_mst_mgr_in_state'
215225 - 'for_each_oldnew_plane_in_state'
216226 - 'for_each_oldnew_plane_in_state_reverse'
217227 - 'for_each_oldnew_private_obj_in_state'
@@ -243,6 +253,9 @@ ForEachMacros: · 25 unmodified lines
243253 - 'for_each_sg_dma_page'
244254 - 'for_each_sg_page'
245255 - 'for_each_sibling_event'
256+ - 'for_each_subelement'
257+ - 'for_each_subelement_extid'
258+ - 'for_each_subelement_id'
246259 - '__for_each_thread'
247260 - 'for_each_thread'
248261 - 'for_each_zone'
@@ -252,6 +265,8 @@ ForEachMacros: · 3 unmodified lines
252265 - 'fwnode_for_each_child_node'
253266 - 'fwnode_graph_for_each_endpoint'
254267 - 'gadget_for_each_ep'
268+ - 'genradix_for_each'
269+ - 'genradix_for_each_from'
255270 - 'hash_for_each'
256271 - 'hash_for_each_possible'
257272 - 'hash_for_each_possible_rcu'
@@ -293,7 +308,11 @@ ForEachMacros: · 35 unmodified lines
293308 - 'key_for_each'
294309 - 'key_for_each_safe'
295310 - 'klp_for_each_func'
311+ - 'klp_for_each_func_safe'
312+ - 'klp_for_each_func_static'
296313 - 'klp_for_each_object'
314+ - 'klp_for_each_object_safe'
315+ - 'klp_for_each_object_static'
297316 - 'kvm_for_each_memslot'
298317 - 'kvm_for_each_vcpu'
299318 - 'list_for_each'
@@ -324,6 +343,8 @@ ForEachMacros: · 24 unmodified lines
324343 - 'media_device_for_each_intf'
325344 - 'media_device_for_each_link'
326345 - 'media_device_for_each_pad'
346+ - 'mp_bvec_for_each_page'
347+ - 'mp_bvec_for_each_segment'
327348 - 'nanddev_io_for_each_page'
328349 - 'netdev_for_each_lower_dev'
329350 - 'netdev_for_each_lower_private'
@@ -375,6 +396,7 @@ ForEachMacros: · 45 unmodified lines
375396 - 'rht_for_each_rcu'
376397 - 'rht_for_each_rcu_continue'
377398 - '__rq_for_each_bio'
399+ - 'rq_for_each_bvec'
378400 - 'rq_for_each_segment'
379401 - 'scsi_for_each_prot_sg'
380402 - 'scsi_for_each_sg'
@@ -410,6 +432,8 @@ ForEachMacros: · 29 unmodified lines
410432 - 'v4l2_m2m_for_each_src_buf_safe'
411433 - 'virtio_device_for_each_vq'
412434 - 'xa_for_each'
435+ - 'xa_for_each_marked'
436+ - 'xa_for_each_start'
413437 - 'xas_for_each'
414438 - 'xas_for_each_conflict'
415439 - 'xas_for_each_marked'
.mailmap+2−0
@@ -156,6 +156,8 @@ Morten Welinder <welinder@darter.rentec.com> · 155 unmodified lines
156156 Morten Welinder <welinder@troll.com>
157157 Mythri P K <mythripk@ti.com>
158158 Nguyen Anh Quynh <aquynh@gmail.com>
159+Nicolas Pitre <nico@fluxnic.net> <nicolas.pitre@linaro.org>
160+Nicolas Pitre <nico@fluxnic.net> <nico@linaro.org>
159161 Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
160162 Patrick Mochel <mochel@digitalimplant.org>
161163 Paul Burton <paul.burton@mips.com> <paul.burton@imgtec.com>
Documentation/accounting/psi.txt+6−6
@@ -56,12 +56,12 @@ situation from a state where some tasks are stalled but the CPU is · 55 unmodified lines
5656 still doing productive work. As such, time spent in this subset of the
5757 stall state is tracked separately and exported in the "full" averages.
5858
59−The ratios are tracked as recent trends over ten, sixty, and three
60−hundred second windows, which gives insight into short term events as
61−well as medium and long term trends. The total absolute stall time is
62−tracked and exported as well, to allow detection of latency spikes
63−which wouldn't necessarily make a dent in the time averages, or to
64−average trends over custom time frames.
59+The ratios (in %) are tracked as recent trends over ten, sixty, and
60+three hundred second windows, which gives insight into short term events
61+as well as medium and long term trends. The total absolute stall time
62+(in us) is tracked and exported as well, to allow detection of latency
63+spikes which wouldn't necessarily make a dent in the time averages,
64+or to average trends over custom time frames.
6565
6666 Cgroup2 interface
6767 =================
Documentation/bpf/btf.rst+4−4
@@ -148,16 +148,16 @@ The ``btf_type.size * 8`` must be equal to or greater than ``BTF_INT_BITS()`` · 147 unmodified lines
148148 for the type. The maximum value of ``BTF_INT_BITS()`` is 128.
149149
150150 The ``BTF_INT_OFFSET()`` specifies the starting bit offset to calculate values
151−for this int. For example, a bitfield struct member has: * btf member bit
152−offset 100 from the start of the structure, * btf member pointing to an int
153−type, * the int type has ``BTF_INT_OFFSET() = 2`` and ``BTF_INT_BITS() = 4``
151+for this int. For example, a bitfield struct member has:
152+ * btf member bit offset 100 from the start of the structure,
153+ * btf member pointing to an int type,
154+ * the int type has ``BTF_INT_OFFSET() = 2`` and ``BTF_INT_BITS() = 4``
154155
155156 Then in the struct memory layout, this member will occupy ``4`` bits starting
156157 from bits ``100 + 2 = 102``.
157158
158159 Alternatively, the bitfield struct member can be the following to access the
159160 same bits as the above:
160−
161161 * btf member bit offset 102,
162162 * btf member pointing to an int type,
163163 * the int type has ``BTF_INT_OFFSET() = 0`` and ``BTF_INT_BITS() = 4``
Documentation/devicetree/bindings/arm/cpus.yaml+1−1
@@ -228,7 +228,7 @@ patternProperties: · 227 unmodified lines
228228 - renesas,r9a06g032-smp
229229 - rockchip,rk3036-smp
230230 - rockchip,rk3066-smp
231− - socionext,milbeaut-m10v-smp
231+ - socionext,milbeaut-m10v-smp
232232 - ste,dbx500-smp
233233
234234 cpu-release-addr:
Documentation/devicetree/bindings/hwmon/adc128d818.txt+2−2
@@ -26,7 +26,7 @@ Required node properties: · 25 unmodified lines
2626
2727 Optional node properties:
2828
29− - ti,mode: Operation mode (see above).
29+ - ti,mode: Operation mode (u8) (see above).
3030
3131
3232 Example (operation mode 2):
@@ -34,5 +34,5 @@ Example (operation mode 2): · 1 unmodified line
3434 adc128d818@1d {
3535 compatible = "ti,adc128d818";
3636 reg = <0x1d>;
37− ti,mode = <2>;
37+ ti,mode = /bits/ 8 <2>;
3838 };
Documentation/lzo.txt+5−3
@@ -102,9 +102,11 @@ Byte sequences · 101 unmodified lines
102102 dictionary which is empty, and that it will always be
103103 invalid at this place.
104104
105− 17 : bitstream version. If the first byte is 17, the next byte
106− gives the bitstream version (version 1 only). If the first byte
107− is not 17, the bitstream version is 0.
105+ 17 : bitstream version. If the first byte is 17, and compressed
106+ stream length is at least 5 bytes (length of shortest possible
107+ versioned bitstream), the next byte gives the bitstream version
108+ (version 1 only).
109+ Otherwise, the bitstream version is 0.
108110
109111 18..21 : copy 0..3 literals
110112 state = (byte - 17) = 0..3 [ copy <state> literals ]
Documentation/media/uapi/rc/rc-tables.rst+2−2
@@ -623,7 +623,7 @@ the remote via /dev/input/event devices. · 622 unmodified lines
623623
624624 - .. row 78
625625
626− - ``KEY_SCREEN``
626+ - ``KEY_ASPECT_RATIO``
627627
628628 - Select screen aspect ratio
629629
@@ -631,7 +631,7 @@ the remote via /dev/input/event devices. · 1 unmodified line
631631
632632 - .. row 79
633633
634− - ``KEY_ZOOM``
634+ - ``KEY_FULL_SCREEN``
635635
636636 - Put device into zoom/full screen mode
637637
Documentation/networking/bpf_flow_dissector.rst+126−0
@@ -0,0 +1,126 @@
1+.. SPDX-License-Identifier: GPL-2.0
2+
3+==================
4+BPF Flow Dissector
5+==================
6+
7+Overview
8+========
9+
10+Flow dissector is a routine that parses metadata out of the packets. It's
11+used in the various places in the networking subsystem (RFS, flow hash, etc).
12+
13+BPF flow dissector is an attempt to reimplement C-based flow dissector logic
14+in BPF to gain all the benefits of BPF verifier (namely, limits on the
15+number of instructions and tail calls).
16+
17+API
18+===
19+
20+BPF flow dissector programs operate on an ``__sk_buff``. However, only the
21+limited set of fields is allowed: ``data``, ``data_end`` and ``flow_keys``.
22+``flow_keys`` is ``struct bpf_flow_keys`` and contains flow dissector input
23+and output arguments.
24+
25+The inputs are:
26+ * ``nhoff`` - initial offset of the networking header
27+ * ``thoff`` - initial offset of the transport header, initialized to nhoff
28+ * ``n_proto`` - L3 protocol type, parsed out of L2 header
29+
30+Flow dissector BPF program should fill out the rest of the ``struct
31+bpf_flow_keys`` fields. Input arguments ``nhoff/thoff/n_proto`` should be
32+also adjusted accordingly.
33+
34+The return code of the BPF program is either BPF_OK to indicate successful
35+dissection, or BPF_DROP to indicate parsing error.
36+
37+__sk_buff->data
38+===============
39+
40+In the VLAN-less case, this is what the initial state of the BPF flow
41+dissector looks like::
42+
43+ +------+------+------------+-----------+
44+ | DMAC | SMAC | ETHER_TYPE | L3_HEADER |
45+ +------+------+------------+-----------+
46+ ^
47+ |
48+ +-- flow dissector starts here
49+
50+
51+.. code:: c
52+
53+ skb->data + flow_keys->nhoff point to the first byte of L3_HEADER
54+ flow_keys->thoff = nhoff
55+ flow_keys->n_proto = ETHER_TYPE
56+
57+In case of VLAN, flow dissector can be called with the two different states.
58+
59+Pre-VLAN parsing::
60+
61+ +------+------+------+-----+-----------+-----------+
62+ | DMAC | SMAC | TPID | TCI |ETHER_TYPE | L3_HEADER |
63+ +------+------+------+-----+-----------+-----------+
64+ ^
65+ |
66+ +-- flow dissector starts here
67+
68+.. code:: c
69+
70+ skb->data + flow_keys->nhoff point the to first byte of TCI
71+ flow_keys->thoff = nhoff
72+ flow_keys->n_proto = TPID
73+
74+Please note that TPID can be 802.1AD and, hence, BPF program would
75+have to parse VLAN information twice for double tagged packets.
76+
77+
78+Post-VLAN parsing::
79+
80+ +------+------+------+-----+-----------+-----------+
81+ | DMAC | SMAC | TPID | TCI |ETHER_TYPE | L3_HEADER |
82+ +------+------+------+-----+-----------+-----------+
83+ ^
84+ |
85+ +-- flow dissector starts here
86+
87+.. code:: c
88+
89+ skb->data + flow_keys->nhoff point the to first byte of L3_HEADER
90+ flow_keys->thoff = nhoff
91+ flow_keys->n_proto = ETHER_TYPE
92+
93+In this case VLAN information has been processed before the flow dissector
94+and BPF flow dissector is not required to handle it.
95+
96+
97+The takeaway here is as follows: BPF flow dissector program can be called with
98+the optional VLAN header and should gracefully handle both cases: when single
99+or double VLAN is present and when it is not present. The same program
100+can be called for both cases and would have to be written carefully to
101+handle both cases.
102+
103+
104+Reference Implementation
105+========================
106+
107+See ``tools/testing/selftests/bpf/progs/bpf_flow.c`` for the reference
108+implementation and ``tools/testing/selftests/bpf/flow_dissector_load.[hc]``
109+for the loader. bpftool can be used to load BPF flow dissector program as well.
110+
111+The reference implementation is organized as follows:
112+ * ``jmp_table`` map that contains sub-programs for each supported L3 protocol
113+ * ``_dissect`` routine - entry point; it does input ``n_proto`` parsing and
114+ does ``bpf_tail_call`` to the appropriate L3 handler
115+
116+Since BPF at this point doesn't support looping (or any jumping back),
117+jmp_table is used instead to handle multiple levels of encapsulation (and
118+IPv6 options).
119+
120+
121+Current Limitations
122+===================
123+BPF flow dissector doesn't support exporting all the metadata that in-kernel
124+C-based implementation can export. Notable example is single VLAN (802.1Q)
125+and double VLAN (802.1AD) tags. Please refer to the ``struct bpf_flow_keys``
126+for a set of information that's currently can be exported from the BPF context.
Documentation/networking/index.rst+1−0
@@ -9,6 +9,7 @@ Contents: · 8 unmodified lines
99 netdev-FAQ
1010 af_xdp
1111 batman-adv
12+ bpf_flow_dissector
1213 can
1314 can_ucan_protocol
1415 device_drivers/freescale/dpaa2/index
Documentation/networking/rxrpc.txt+9−7
@@ -1009,16 +1009,18 @@ The kernel interface functions are as follows: · 1008 unmodified lines
10091009
10101010 (*) Check call still alive.
10111011
1012− u32 rxrpc_kernel_check_life(struct socket *sock,
1013− struct rxrpc_call *call);
1012+ bool rxrpc_kernel_check_life(struct socket *sock,
1013+ struct rxrpc_call *call,
1014+ u32 *_life);
10141015 void rxrpc_kernel_probe_life(struct socket *sock,
10151016 struct rxrpc_call *call);
10161017
1017− The first function returns a number that is updated when ACKs are received
1018− from the peer (notably including PING RESPONSE ACKs which we can elicit by
1019− sending PING ACKs to see if the call still exists on the server). The
1020− caller should compare the numbers of two calls to see if the call is still
1021− alive after waiting for a suitable interval.
1018+ The first function passes back in *_life a number that is updated when
1019+ ACKs are received from the peer (notably including PING RESPONSE ACKs
1020+ which we can elicit by sending PING ACKs to see if the call still exists
1021+ on the server). The caller should compare the numbers of two calls to see
1022+ if the call is still alive after waiting for a suitable interval. It also
1023+ returns true as long as the call hasn't yet reached the completed state.
10221024
10231025 This allows the caller to work out if the server is still contactable and
10241026 if the call is still alive on the server while waiting for the server to
MAINTAINERS+22−9
@@ -1893,14 +1893,15 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git · 1892 unmodified lines
18931893 ARM/NUVOTON NPCM ARCHITECTURE
18941894 M: Avi Fishman <avifishman70@gmail.com>
18951895 M: Tomer Maimon <tmaimon77@gmail.com>
1896+M: Tali Perry <tali.perry1@gmail.com>
18961897 R: Patrick Venture <venture@google.com>
18971898 R: Nancy Yuen <yuenn@google.com>
1898−R: Brendan Higgins <brendanhiggins@google.com>
1899+R: Benjamin Fair <benjaminfair@google.com>
18991900 L: openbmc@lists.ozlabs.org (moderated for non-subscribers)
19001901 S: Supported
19011902 F: arch/arm/mach-npcm/
19021903 F: arch/arm/boot/dts/nuvoton-npcm*
1903−F: include/dt-bindings/clock/nuvoton,npcm7xx-clks.h
1904+F: include/dt-bindings/clock/nuvoton,npcm7xx-clock.h
19041905 F: drivers/*/*npcm*
19051906 F: Documentation/devicetree/bindings/*/*npcm*
19061907 F: Documentation/devicetree/bindings/*/*/*npcm*
@@ -4129,7 +4130,7 @@ F: drivers/cpuidle/* · 2222 unmodified lines
41294130 F: include/linux/cpuidle.h
41304131
41314132 CRAMFS FILESYSTEM
4132−M: Nicolas Pitre <nico@linaro.org>
4133+M: Nicolas Pitre <nico@fluxnic.net>
41334134 S: Maintained
41344135 F: Documentation/filesystems/cramfs.txt
41354136 F: fs/cramfs/
@@ -5833,7 +5834,7 @@ L: netdev@vger.kernel.org · 1697 unmodified lines
58335834 S: Maintained
58345835 F: Documentation/ABI/testing/sysfs-bus-mdio
58355836 F: Documentation/devicetree/bindings/net/mdio*
5836−F: Documentation/networking/phy.txt
5837+F: Documentation/networking/phy.rst
58375838 F: drivers/net/phy/
58385839 F: drivers/of/of_mdio.c
58395840 F: drivers/of/of_net.c
@@ -7332,7 +7333,6 @@ F: Documentation/devicetree/bindings/i3c/ · 1492 unmodified lines
73327333 F: Documentation/driver-api/i3c
73337334 F: drivers/i3c/
73347335 F: include/linux/i3c/
7335−F: include/dt-bindings/i3c/
73367336
73377337 I3C DRIVER FOR SYNOPSYS DESIGNWARE
73387338 M: Vitor Soares <vitor.soares@synopsys.com>
@@ -7515,7 +7515,7 @@ F: include/net/mac802154.h · 176 unmodified lines
75157515 F: include/net/af_ieee802154.h
75167516 F: include/net/cfg802154.h
75177517 F: include/net/ieee802154_netdev.h
7518−F: Documentation/networking/ieee802154.txt
7518+F: Documentation/networking/ieee802154.rst
75197519
75207520 IFE PROTOCOL
75217521 M: Yotam Gigi <yotam.gi@gmail.com>
@@ -10144,7 +10144,7 @@ F: drivers/spi/spi-at91-usart.c · 2622 unmodified lines
1014410144 F: Documentation/devicetree/bindings/mfd/atmel-usart.txt
1014510145
1014610146 MICROCHIP KSZ SERIES ETHERNET SWITCH DRIVER
10147−M: Woojung Huh <Woojung.Huh@microchip.com>
10147+M: Woojung Huh <woojung.huh@microchip.com>
1014810148 M: Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>
1014910149 L: netdev@vger.kernel.org
1015010150 S: Maintained
@@ -13981,7 +13981,7 @@ F: drivers/media/rc/serial_ir.c · 3830 unmodified lines
1398113981 SFC NETWORK DRIVER
1398213982 M: Solarflare linux maintainers <linux-net-drivers@solarflare.com>
1398313983 M: Edward Cree <ecree@solarflare.com>
13984−M: Bert Kenward <bkenward@solarflare.com>
13984+M: Martin Habets <mhabets@solarflare.com>
1398513985 L: netdev@vger.kernel.org
1398613986 S: Supported
1398713987 F: drivers/net/ethernet/sfc/
@@ -16508,7 +16508,7 @@ F: drivers/char/virtio_console.c · 2520 unmodified lines
1650816508 F: include/linux/virtio_console.h
1650916509 F: include/uapi/linux/virtio_console.h
1651016510
16511−VIRTIO CORE, NET AND BLOCK DRIVERS
16511+VIRTIO CORE AND NET DRIVERS
1651216512 M: "Michael S. Tsirkin" <mst@redhat.com>
1651316513 M: Jason Wang <jasowang@redhat.com>
1651416514 L: virtualization@lists.linux-foundation.org
@@ -16523,6 +16523,19 @@ F: include/uapi/linux/virtio_*.h · 8 unmodified lines
1652316523 F: drivers/crypto/virtio/
1652416524 F: mm/balloon_compaction.c
1652516525
16526+VIRTIO BLOCK AND SCSI DRIVERS
16527+M: "Michael S. Tsirkin" <mst@redhat.com>
16528+M: Jason Wang <jasowang@redhat.com>
16529+R: Paolo Bonzini <pbonzini@redhat.com>
16530+R: Stefan Hajnoczi <stefanha@redhat.com>
16531+L: virtualization@lists.linux-foundation.org
16532+S: Maintained
16533+F: drivers/block/virtio_blk.c
16534+F: drivers/scsi/virtio_scsi.c
16535+F: include/uapi/linux/virtio_blk.h
16536+F: include/uapi/linux/virtio_scsi.h
16537+F: drivers/vhost/scsi.c
16538+
1652616539 VIRTIO CRYPTO DRIVER
1652716540 M: Gonglei <arei.gonglei@huawei.com>
1652816541 L: virtualization@lists.linux-foundation.org
Makefile+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 VERSION = 5
33 PATCHLEVEL = 1
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc3
5+EXTRAVERSION = -rc6
66 NAME = Shy Crocodile
77
88 # *DOCUMENTATION*
arch/arc/include/asm/syscall.h+3−4
@@ -55,12 +55,11 @@ syscall_set_return_value(struct task_struct *task, struct pt_regs *regs, · 54 unmodified lines
5555 */
5656 static inline void
5757 syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
58− unsigned int i, unsigned int n, unsigned long *args)
58+ unsigned long *args)
5959 {
6060 unsigned long *inside_ptregs = &(regs->r0);
61− inside_ptregs -= i;
62−
63− BUG_ON((i + n) > 6);
61+ unsigned int n = 6;
62+ unsigned int i = 0;
6463
6564 while (n--) {
6665 args[i++] = (*inside_ptregs);
arch/arm/boot/dts/am335x-evm.dts+22−4
@@ -57,6 +57,24 @@ · 56 unmodified lines
5757 enable-active-high;
5858 };
5959
60+ /* TPS79501 */
61+ v1_8d_reg: fixedregulator-v1_8d {
62+ compatible = "regulator-fixed";
63+ regulator-name = "v1_8d";
64+ vin-supply = <&vbat>;
65+ regulator-min-microvolt = <1800000>;
66+ regulator-max-microvolt = <1800000>;
67+ };
68+
69+ /* TPS79501 */
70+ v3_3d_reg: fixedregulator-v3_3d {
71+ compatible = "regulator-fixed";
72+ regulator-name = "v3_3d";
73+ vin-supply = <&vbat>;
74+ regulator-min-microvolt = <3300000>;
75+ regulator-max-microvolt = <3300000>;
76+ };
77+
6078 matrix_keypad: matrix_keypad0 {
6179 compatible = "gpio-matrix-keypad";
6280 debounce-delay-ms = <5>;
@@ -499,10 +517,10 @@ · 436 unmodified lines
499517 status = "okay";
500518
501519 /* Regulators */
502− AVDD-supply = <&vaux2_reg>;
503− IOVDD-supply = <&vaux2_reg>;
504− DRVDD-supply = <&vaux2_reg>;
505− DVDD-supply = <&vbat>;
520+ AVDD-supply = <&v3_3d_reg>;
521+ IOVDD-supply = <&v3_3d_reg>;
522+ DRVDD-supply = <&v3_3d_reg>;
523+ DVDD-supply = <&v1_8d_reg>;
506524 };
507525 };
508526
arch/arm/boot/dts/am335x-evmsk.dts+22−4
@@ -73,6 +73,24 @@ · 72 unmodified lines
7373 enable-active-high;
7474 };
7575
76+ /* TPS79518 */
77+ v1_8d_reg: fixedregulator-v1_8d {
78+ compatible = "regulator-fixed";
79+ regulator-name = "v1_8d";
80+ vin-supply = <&vbat>;
81+ regulator-min-microvolt = <1800000>;
82+ regulator-max-microvolt = <1800000>;
83+ };
84+
85+ /* TPS78633 */
86+ v3_3d_reg: fixedregulator-v3_3d {
87+ compatible = "regulator-fixed";
88+ regulator-name = "v3_3d";
89+ vin-supply = <&vbat>;
90+ regulator-min-microvolt = <3300000>;
91+ regulator-max-microvolt = <3300000>;
92+ };
93+
7694 leds {
7795 pinctrl-names = "default";
7896 pinctrl-0 = <&user_leds_s0>;
@@ -501,10 +519,10 @@ · 422 unmodified lines
501519 status = "okay";
502520
503521 /* Regulators */
504− AVDD-supply = <&vaux2_reg>;
505− IOVDD-supply = <&vaux2_reg>;
506− DRVDD-supply = <&vaux2_reg>;
507− DVDD-supply = <&vbat>;
522+ AVDD-supply = <&v3_3d_reg>;
523+ IOVDD-supply = <&v3_3d_reg>;
524+ DRVDD-supply = <&v3_3d_reg>;
525+ DVDD-supply = <&v1_8d_reg>;
508526 };
509527 };
510528
arch/arm/boot/dts/am33xx-l4.dtsi+2−2
@@ -1762,7 +1762,7 @@ · 1761 unmodified lines
17621762 reg = <0xcc000 0x4>;
17631763 reg-names = "rev";
17641764 /* Domains (P, C): per_pwrdm, l4ls_clkdm */
1765− clocks = <&l4ls_clkctrl AM3_D_CAN0_CLKCTRL 0>;
1765+ clocks = <&l4ls_clkctrl AM3_L4LS_D_CAN0_CLKCTRL 0>;
17661766 clock-names = "fck";
17671767 #address-cells = <1>;
17681768 #size-cells = <1>;
@@ -1785,7 +1785,7 @@ · 16 unmodified lines
17851785 reg = <0xd0000 0x4>;
17861786 reg-names = "rev";
17871787 /* Domains (P, C): per_pwrdm, l4ls_clkdm */
1788− clocks = <&l4ls_clkctrl AM3_D_CAN1_CLKCTRL 0>;
1788+ clocks = <&l4ls_clkctrl AM3_L4LS_D_CAN1_CLKCTRL 0>;
17891789 clock-names = "fck";
17901790 #address-cells = <1>;
17911791 #size-cells = <1>;
arch/arm/boot/dts/rk3288-tinker.dtsi+2−1
@@ -254,6 +254,7 @@ · 253 unmodified lines
254254 };
255255
256256 vccio_sd: LDO_REG5 {
257+ regulator-boot-on;
257258 regulator-min-microvolt = <1800000>;
258259 regulator-max-microvolt = <3300000>;
259260 regulator-name = "vccio_sd";
@@ -430,7 +431,7 @@ · 170 unmodified lines
430431 bus-width = <4>;
431432 cap-mmc-highspeed;
432433 cap-sd-highspeed;
433− card-detect-delay = <200>;
434+ broken-cd;
434435 disable-wp; /* wp not hooked up */
435436 pinctrl-names = "default";
436437 pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
arch/arm/boot/dts/rk3288-veyron.dtsi+0−2
@@ -25,8 +25,6 @@ · 24 unmodified lines
2525
2626 gpio_keys: gpio-keys {
2727 compatible = "gpio-keys";
28− #address-cells = <1>;
29− #size-cells = <0>;
3028
3129 pinctrl-names = "default";
3230 pinctrl-0 = <&pwr_key_l>;
arch/arm/boot/dts/rk3288.dtsi+9−11
@@ -70,7 +70,7 @@ · 69 unmodified lines
7070 compatible = "arm,cortex-a12";
7171 reg = <0x501>;
7272 resets = <&cru SRST_CORE1>;
73− operating-points = <&cpu_opp_table>;
73+ operating-points-v2 = <&cpu_opp_table>;
7474 #cooling-cells = <2>; /* min followed by max */
7575 clock-latency = <40000>;
7676 clocks = <&cru ARMCLK>;
@@ -80,7 +80,7 @@ · 3 unmodified lines
8080 compatible = "arm,cortex-a12";
8181 reg = <0x502>;
8282 resets = <&cru SRST_CORE2>;
83− operating-points = <&cpu_opp_table>;
83+ operating-points-v2 = <&cpu_opp_table>;
8484 #cooling-cells = <2>; /* min followed by max */
8585 clock-latency = <40000>;
8686 clocks = <&cru ARMCLK>;
@@ -90,7 +90,7 @@ · 3 unmodified lines
9090 compatible = "arm,cortex-a12";
9191 reg = <0x503>;
9292 resets = <&cru SRST_CORE3>;
93− operating-points = <&cpu_opp_table>;
93+ operating-points-v2 = <&cpu_opp_table>;
9494 #cooling-cells = <2>; /* min followed by max */
9595 clock-latency = <40000>;
9696 clocks = <&cru ARMCLK>;
@@ -1119,8 +1119,6 @@ · 1022 unmodified lines
11191119 clock-names = "ref", "pclk";
11201120 power-domains = <&power RK3288_PD_VIO>;
11211121 rockchip,grf = <&grf>;
1122− #address-cells = <1>;
1123− #size-cells = <0>;
11241122 status = "disabled";
11251123
11261124 ports {
@@ -1282,27 +1280,27 @@ · 155 unmodified lines
12821280 gpu_opp_table: gpu-opp-table {
12831281 compatible = "operating-points-v2";
12841282
1285− opp@100000000 {
1283+ opp-100000000 {
12861284 opp-hz = /bits/ 64 <100000000>;
12871285 opp-microvolt = <950000>;
12881286 };
1289− opp@200000000 {
1287+ opp-200000000 {
12901288 opp-hz = /bits/ 64 <200000000>;
12911289 opp-microvolt = <950000>;
12921290 };
1293− opp@300000000 {
1291+ opp-300000000 {
12941292 opp-hz = /bits/ 64 <300000000>;
12951293 opp-microvolt = <1000000>;
12961294 };
1297− opp@400000000 {
1295+ opp-400000000 {
12981296 opp-hz = /bits/ 64 <400000000>;
12991297 opp-microvolt = <1100000>;
13001298 };
1301− opp@500000000 {
1299+ opp-500000000 {
13021300 opp-hz = /bits/ 64 <500000000>;
13031301 opp-microvolt = <1200000>;
13041302 };
1305− opp@600000000 {
1303+ opp-600000000 {
13061304 opp-hz = /bits/ 64 <600000000>;
13071305 opp-microvolt = <1250000>;
13081306 };
arch/arm/boot/dts/sama5d2-pinfunc.h+1−1
@@ -518,7 +518,7 @@ · 517 unmodified lines
518518 #define PIN_PC9__GPIO PINMUX_PIN(PIN_PC9, 0, 0)
519519 #define PIN_PC9__FIQ PINMUX_PIN(PIN_PC9, 1, 3)
520520 #define PIN_PC9__GTSUCOMP PINMUX_PIN(PIN_PC9, 2, 1)
521−#define PIN_PC9__ISC_D0 PINMUX_PIN(PIN_PC9, 2, 1)
521+#define PIN_PC9__ISC_D0 PINMUX_PIN(PIN_PC9, 3, 1)
522522 #define PIN_PC9__TIOA4 PINMUX_PIN(PIN_PC9, 4, 2)
523523 #define PIN_PC10 74
524524 #define PIN_PC10__GPIO PINMUX_PIN(PIN_PC10, 0, 0)
arch/arm/boot/dts/ste-nomadik-nhk15.dts+4−5
@@ -213,13 +213,12 @@ · 212 unmodified lines
213213 gpio-sck = <&gpio0 5 GPIO_ACTIVE_HIGH>;
214214 gpio-mosi = <&gpio0 4 GPIO_ACTIVE_HIGH>;
215215 /*
216− * This chipselect is active high. Just setting the flags
217− * to GPIO_ACTIVE_HIGH is not enough for the SPI DT bindings,
218− * it will be ignored, only the special "spi-cs-high" flag
219− * really counts.
216+ * It's not actually active high, but the frameworks assume
217+ * the polarity of the passed-in GPIO is "normal" (active
218+ * high) then actively drives the line low to select the
219+ * chip.
220220 */
221221 cs-gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>;
222− spi-cs-high;
223222 num-chipselects = <1>;
224223
225224 /*
arch/arm/include/asm/syscall.h+8−39
@@ -55,53 +55,22 @@ static inline void syscall_set_return_value(struct task_struct *task, · 54 unmodified lines
5555
5656 static inline void syscall_get_arguments(struct task_struct *task,
5757 struct pt_regs *regs,
58− unsigned int i, unsigned int n,
5958 unsigned long *args)
6059 {
61− if (n == 0)
62− return;
63−
64− if (i + n > SYSCALL_MAX_ARGS) {
65− unsigned long *args_bad = args + SYSCALL_MAX_ARGS - i;
66− unsigned int n_bad = n + i - SYSCALL_MAX_ARGS;
67− pr_warn("%s called with max args %d, handling only %d\n",
68− __func__, i + n, SYSCALL_MAX_ARGS);
69− memset(args_bad, 0, n_bad * sizeof(args[0]));
70− n = SYSCALL_MAX_ARGS - i;
71− }
72−
73− if (i == 0) {
74− args[0] = regs->ARM_ORIG_r0;
75− args++;
76− i++;
77− n--;
78− }
79−
80− memcpy(args, &regs->ARM_r0 + i, n * sizeof(args[0]));
60+ args[0] = regs->ARM_ORIG_r0;
61+ args++;
62+
63+ memcpy(args, &regs->ARM_r0 + 1, 5 * sizeof(args[0]));
8164 }
8265
8366 static inline void syscall_set_arguments(struct task_struct *task,
8467 struct pt_regs *regs,
85− unsigned int i, unsigned int n,
8668 const unsigned long *args)
8769 {
88− if (n == 0)
89− return;
90−
91− if (i + n > SYSCALL_MAX_ARGS) {
92− pr_warn("%s called with max args %d, handling only %d\n",
93− __func__, i + n, SYSCALL_MAX_ARGS);
94− n = SYSCALL_MAX_ARGS - i;
95− }
96−
97− if (i == 0) {
98− regs->ARM_ORIG_r0 = args[0];
99− args++;
100− i++;
101− n--;
102− }
103−
104− memcpy(&regs->ARM_r0 + i, args, n * sizeof(args[0]));
70+ regs->ARM_ORIG_r0 = args[0];
71+ args++;
72+
73+ memcpy(&regs->ARM_r0 + 1, args, 5 * sizeof(args[0]));
10574 }
10675
10776 static inline int syscall_get_arch(void)
arch/arm/mach-at91/pm.c+4−2
@@ -591,13 +591,13 @@ static int __init at91_pm_backup_init(void) · 590 unmodified lines
591591
592592 np = of_find_compatible_node(NULL, NULL, "atmel,sama5d2-securam");
593593 if (!np)
594− goto securam_fail;
594+ goto securam_fail_no_ref_dev;
595595
596596 pdev = of_find_device_by_node(np);
597597 of_node_put(np);
598598 if (!pdev) {
599599 pr_warn("%s: failed to find securam device!\n", __func__);
600− goto securam_fail;
600+ goto securam_fail_no_ref_dev;
601601 }
602602
603603 sram_pool = gen_pool_get(&pdev->dev, NULL);
@@ -620,6 +620,8 @@ static int __init at91_pm_backup_init(void) · 16 unmodified lines
620620 return 0;
621621
622622 securam_fail:
623+ put_device(&pdev->dev);
624+securam_fail_no_ref_dev:
623625 iounmap(pm_data.sfrbu);
624626 pm_data.sfrbu = NULL;
625627 return ret;
arch/arm/mach-iop13xx/setup.c+4−4
@@ -300,7 +300,7 @@ static struct resource iop13xx_adma_2_resources[] = { · 299 unmodified lines
300300 }
301301 };
302302
303−static u64 iop13xx_adma_dmamask = DMA_BIT_MASK(64);
303+static u64 iop13xx_adma_dmamask = DMA_BIT_MASK(32);
304304 static struct iop_adma_platform_data iop13xx_adma_0_data = {
305305 .hw_id = 0,
306306 .pool_size = PAGE_SIZE,
@@ -324,7 +324,7 @@ static struct platform_device iop13xx_adma_0_channel = { · 17 unmodified lines
324324 .resource = iop13xx_adma_0_resources,
325325 .dev = {
326326 .dma_mask = &iop13xx_adma_dmamask,
327− .coherent_dma_mask = DMA_BIT_MASK(64),
327+ .coherent_dma_mask = DMA_BIT_MASK(32),
328328 .platform_data = (void *) &iop13xx_adma_0_data,
329329 },
330330 };
@@ -336,7 +336,7 @@ static struct platform_device iop13xx_adma_1_channel = { · 5 unmodified lines
336336 .resource = iop13xx_adma_1_resources,
337337 .dev = {
338338 .dma_mask = &iop13xx_adma_dmamask,
339− .coherent_dma_mask = DMA_BIT_MASK(64),
339+ .coherent_dma_mask = DMA_BIT_MASK(32),
340340 .platform_data = (void *) &iop13xx_adma_1_data,
341341 },
342342 };
@@ -348,7 +348,7 @@ static struct platform_device iop13xx_adma_2_channel = { · 5 unmodified lines
348348 .resource = iop13xx_adma_2_resources,
349349 .dev = {
350350 .dma_mask = &iop13xx_adma_dmamask,
351− .coherent_dma_mask = DMA_BIT_MASK(64),
351+ .coherent_dma_mask = DMA_BIT_MASK(32),
352352 .platform_data = (void *) &iop13xx_adma_2_data,
353353 },
354354 };
arch/arm/mach-iop13xx/tpmi.c+5−5
@@ -152,7 +152,7 @@ static struct resource iop13xx_tpmi_3_resources[] = { · 151 unmodified lines
152152 }
153153 };
154154
155−u64 iop13xx_tpmi_mask = DMA_BIT_MASK(64);
155+u64 iop13xx_tpmi_mask = DMA_BIT_MASK(32);
156156 static struct platform_device iop13xx_tpmi_0_device = {
157157 .name = "iop-tpmi",
158158 .id = 0,
@@ -160,7 +160,7 @@ static struct platform_device iop13xx_tpmi_0_device = { · 1 unmodified line
160160 .resource = iop13xx_tpmi_0_resources,
161161 .dev = {
162162 .dma_mask = &iop13xx_tpmi_mask,
163− .coherent_dma_mask = DMA_BIT_MASK(64),
163+ .coherent_dma_mask = DMA_BIT_MASK(32),
164164 },
165165 };
166166
@@ -171,7 +171,7 @@ static struct platform_device iop13xx_tpmi_1_device = { · 4 unmodified lines
171171 .resource = iop13xx_tpmi_1_resources,
172172 .dev = {
173173 .dma_mask = &iop13xx_tpmi_mask,
174− .coherent_dma_mask = DMA_BIT_MASK(64),
174+ .coherent_dma_mask = DMA_BIT_MASK(32),
175175 },
176176 };
177177
@@ -182,7 +182,7 @@ static struct platform_device iop13xx_tpmi_2_device = { · 4 unmodified lines
182182 .resource = iop13xx_tpmi_2_resources,
183183 .dev = {
184184 .dma_mask = &iop13xx_tpmi_mask,
185− .coherent_dma_mask = DMA_BIT_MASK(64),
185+ .coherent_dma_mask = DMA_BIT_MASK(32),
186186 },
187187 };
188188
@@ -193,7 +193,7 @@ static struct platform_device iop13xx_tpmi_3_device = { · 4 unmodified lines
193193 .resource = iop13xx_tpmi_3_resources,
194194 .dev = {
195195 .dma_mask = &iop13xx_tpmi_mask,
196− .coherent_dma_mask = DMA_BIT_MASK(64),
196+ .coherent_dma_mask = DMA_BIT_MASK(32),
197197 },
198198 };
199199
arch/arm/mach-milbeaut/platsmp.c+4−0
@@ -65,6 +65,7 @@ static void m10v_smp_init(unsigned int max_cpus) · 64 unmodified lines
6565 writel(KERNEL_UNBOOT_FLAG, m10v_smp_base + cpu * 4);
6666 }
6767
68+#ifdef CONFIG_HOTPLUG_CPU
6869 static void m10v_cpu_die(unsigned int l_cpu)
6970 {
7071 gic_cpu_if_down(0);
@@ -83,12 +84,15 @@ static int m10v_cpu_kill(unsigned int l_cpu) · 12 unmodified lines
8384
8485 return 1;
8586 }
87+#endif
8688
8789 static struct smp_operations m10v_smp_ops __initdata = {
8890 .smp_prepare_cpus = m10v_smp_init,
8991 .smp_boot_secondary = m10v_boot_secondary,
92+#ifdef CONFIG_HOTPLUG_CPU
9093 .cpu_die = m10v_cpu_die,
9194 .cpu_kill = m10v_cpu_kill,
95+#endif
9296 };
9397 CPU_METHOD_OF_DECLARE(m10v_smp, "socionext,milbeaut-m10v-smp", &m10v_smp_ops);
9498
arch/arm/mach-omap1/board-ams-delta.c+2−0
@@ -182,6 +182,7 @@ static struct resource latch1_resources[] = { · 181 unmodified lines
182182
183183 static struct bgpio_pdata latch1_pdata = {
184184 .label = LATCH1_LABEL,
185+ .base = -1,
185186 .ngpio = LATCH1_NGPIO,
186187 };
187188
@@ -219,6 +220,7 @@ static struct resource latch2_resources[] = { · 31 unmodified lines
219220
220221 static struct bgpio_pdata latch2_pdata = {
221222 .label = LATCH2_LABEL,
223+ .base = -1,
222224 .ngpio = LATCH2_NGPIO,
223225 };
224226
arch/arm/mach-omap2/display.c+3−1
@@ -250,8 +250,10 @@ static int __init omapdss_init_of(void) · 249 unmodified lines
250250 if (!node)
251251 return 0;
252252
253− if (!of_device_is_available(node))
253+ if (!of_device_is_available(node)) {
254+ of_node_put(node);
254255 return 0;
256+ }
255257
256258 pdev = of_find_device_by_node(node);
257259
arch/arm/plat-iop/adma.c+3−3
@@ -143,7 +143,7 @@ struct platform_device iop3xx_dma_0_channel = { · 142 unmodified lines
143143 .resource = iop3xx_dma_0_resources,
144144 .dev = {
145145 .dma_mask = &iop3xx_adma_dmamask,
146− .coherent_dma_mask = DMA_BIT_MASK(64),
146+ .coherent_dma_mask = DMA_BIT_MASK(32),
147147 .platform_data = (void *) &iop3xx_dma_0_data,
148148 },
149149 };
@@ -155,7 +155,7 @@ struct platform_device iop3xx_dma_1_channel = { · 5 unmodified lines
155155 .resource = iop3xx_dma_1_resources,
156156 .dev = {
157157 .dma_mask = &iop3xx_adma_dmamask,
158− .coherent_dma_mask = DMA_BIT_MASK(64),
158+ .coherent_dma_mask = DMA_BIT_MASK(32),
159159 .platform_data = (void *) &iop3xx_dma_1_data,
160160 },
161161 };
@@ -167,7 +167,7 @@ struct platform_device iop3xx_aau_channel = { · 5 unmodified lines
167167 .resource = iop3xx_aau_resources,
168168 .dev = {
169169 .dma_mask = &iop3xx_adma_dmamask,
170− .coherent_dma_mask = DMA_BIT_MASK(64),
170+ .coherent_dma_mask = DMA_BIT_MASK(32),
171171 .platform_data = (void *) &iop3xx_aau_data,
172172 },
173173 };
arch/arm/plat-orion/common.c+2−2
@@ -622,7 +622,7 @@ static struct platform_device orion_xor0_shared = { · 621 unmodified lines
622622 .resource = orion_xor0_shared_resources,
623623 .dev = {
624624 .dma_mask = &orion_xor_dmamask,
625− .coherent_dma_mask = DMA_BIT_MASK(64),
625+ .coherent_dma_mask = DMA_BIT_MASK(32),
626626 .platform_data = &orion_xor0_pdata,
627627 },
628628 };
@@ -683,7 +683,7 @@ static struct platform_device orion_xor1_shared = { · 54 unmodified lines
683683 .resource = orion_xor1_shared_resources,
684684 .dev = {
685685 .dma_mask = &orion_xor_dmamask,
686− .coherent_dma_mask = DMA_BIT_MASK(64),
686+ .coherent_dma_mask = DMA_BIT_MASK(32),
687687 .platform_data = &orion_xor1_pdata,
688688 },
689689 };
arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi+3−0
@@ -162,6 +162,7 @@ · 161 unmodified lines
162162 rx-fifo-depth = <16384>;
163163 snps,multicast-filter-bins = <256>;
164164 iommus = <&smmu 1>;
165+ altr,sysmgr-syscon = <&sysmgr 0x44 0>;
165166 status = "disabled";
166167 };
167168
@@ -179,6 +180,7 @@ · 11 unmodified lines
179180 rx-fifo-depth = <16384>;
180181 snps,multicast-filter-bins = <256>;
181182 iommus = <&smmu 2>;
183+ altr,sysmgr-syscon = <&sysmgr 0x48 0>;
182184 status = "disabled";
183185 };
184186
@@ -196,6 +198,7 @@ · 11 unmodified lines
196198 rx-fifo-depth = <16384>;
197199 snps,multicast-filter-bins = <256>;
198200 iommus = <&smmu 3>;
201+ altr,sysmgr-syscon = <&sysmgr 0x4c 0>;
199202 status = "disabled";
200203 };
201204
arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts+2−2
@@ -108,8 +108,8 @@ · 107 unmodified lines
108108 snps,reset-gpio = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>;
109109 snps,reset-active-low;
110110 snps,reset-delays-us = <0 10000 50000>;
111− tx_delay = <0x25>;
112− rx_delay = <0x11>;
111+ tx_delay = <0x24>;
112+ rx_delay = <0x18>;
113113 status = "okay";
114114 };
115115
arch/arm64/boot/dts/rockchip/rk3328-rock64.dts+1−2
@@ -46,8 +46,7 @@ · 45 unmodified lines
4646
4747 vcc_host1_5v: vcc_otg_5v: vcc-host1-5v-regulator {
4848 compatible = "regulator-fixed";
49− enable-active-high;
50− gpio = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>;
49+ gpio = <&gpio0 RK_PA2 GPIO_ACTIVE_LOW>;
5150 pinctrl-names = "default";
5251 pinctrl-0 = <&usb20_host_drv>;
5352 regulator-name = "vcc_host1_5v";
arch/arm64/boot/dts/rockchip/rk3328.dtsi+29−29
@@ -1445,11 +1445,11 @@ · 1444 unmodified lines
14451445
14461446 sdmmc0 {
14471447 sdmmc0_clk: sdmmc0-clk {
1448− rockchip,pins = <1 RK_PA6 1 &pcfg_pull_none_4ma>;
1448+ rockchip,pins = <1 RK_PA6 1 &pcfg_pull_none_8ma>;
14491449 };
14501450
14511451 sdmmc0_cmd: sdmmc0-cmd {
1452− rockchip,pins = <1 RK_PA4 1 &pcfg_pull_up_4ma>;
1452+ rockchip,pins = <1 RK_PA4 1 &pcfg_pull_up_8ma>;
14531453 };
14541454
14551455 sdmmc0_dectn: sdmmc0-dectn {
@@ -1461,14 +1461,14 @@ · 5 unmodified lines
14611461 };
14621462
14631463 sdmmc0_bus1: sdmmc0-bus1 {
1464− rockchip,pins = <1 RK_PA0 1 &pcfg_pull_up_4ma>;
1464+ rockchip,pins = <1 RK_PA0 1 &pcfg_pull_up_8ma>;
14651465 };
14661466
14671467 sdmmc0_bus4: sdmmc0-bus4 {
1468− rockchip,pins = <1 RK_PA0 1 &pcfg_pull_up_4ma>,
1469− <1 RK_PA1 1 &pcfg_pull_up_4ma>,
1470− <1 RK_PA2 1 &pcfg_pull_up_4ma>,
1471− <1 RK_PA3 1 &pcfg_pull_up_4ma>;
1468+ rockchip,pins = <1 RK_PA0 1 &pcfg_pull_up_8ma>,
1469+ <1 RK_PA1 1 &pcfg_pull_up_8ma>,
1470+ <1 RK_PA2 1 &pcfg_pull_up_8ma>,
1471+ <1 RK_PA3 1 &pcfg_pull_up_8ma>;
14721472 };
14731473
14741474 sdmmc0_gpio: sdmmc0-gpio {
@@ -1642,50 +1642,50 @@ · 167 unmodified lines
16421642 rgmiim1_pins: rgmiim1-pins {
16431643 rockchip,pins =
16441644 /* mac_txclk */
1645− <1 RK_PB4 2 &pcfg_pull_none_12ma>,
1645+ <1 RK_PB4 2 &pcfg_pull_none_8ma>,
16461646 /* mac_rxclk */
1647− <1 RK_PB5 2 &pcfg_pull_none_2ma>,
1647+ <1 RK_PB5 2 &pcfg_pull_none_4ma>,
16481648 /* mac_mdio */
1649− <1 RK_PC3 2 &pcfg_pull_none_2ma>,
1649+ <1 RK_PC3 2 &pcfg_pull_none_4ma>,
16501650 /* mac_txen */
1651− <1 RK_PD1 2 &pcfg_pull_none_12ma>,
1651+ <1 RK_PD1 2 &pcfg_pull_none_8ma>,
16521652 /* mac_clk */
1653− <1 RK_PC5 2 &pcfg_pull_none_2ma>,
1653+ <1 RK_PC5 2 &pcfg_pull_none_4ma>,
16541654 /* mac_rxdv */
1655− <1 RK_PC6 2 &pcfg_pull_none_2ma>,
1655+ <1 RK_PC6 2 &pcfg_pull_none_4ma>,
16561656 /* mac_mdc */
1657− <1 RK_PC7 2 &pcfg_pull_none_2ma>,
1657+ <1 RK_PC7 2 &pcfg_pull_none_4ma>,
16581658 /* mac_rxd1 */
1659− <1 RK_PB2 2 &pcfg_pull_none_2ma>,
1659+ <1 RK_PB2 2 &pcfg_pull_none_4ma>,
16601660 /* mac_rxd0 */
1661− <1 RK_PB3 2 &pcfg_pull_none_2ma>,
1661+ <1 RK_PB3 2 &pcfg_pull_none_4ma>,
16621662 /* mac_txd1 */
1663− <1 RK_PB0 2 &pcfg_pull_none_12ma>,
1663+ <1 RK_PB0 2 &pcfg_pull_none_8ma>,
16641664 /* mac_txd0 */
1665− <1 RK_PB1 2 &pcfg_pull_none_12ma>,
1665+ <1 RK_PB1 2 &pcfg_pull_none_8ma>,
16661666 /* mac_rxd3 */
1667− <1 RK_PB6 2 &pcfg_pull_none_2ma>,
1667+ <1 RK_PB6 2 &pcfg_pull_none_4ma>,
16681668 /* mac_rxd2 */
1669− <1 RK_PB7 2 &pcfg_pull_none_2ma>,
1669+ <1 RK_PB7 2 &pcfg_pull_none_4ma>,
16701670 /* mac_txd3 */
1671− <1 RK_PC0 2 &pcfg_pull_none_12ma>,
1671+ <1 RK_PC0 2 &pcfg_pull_none_8ma>,
16721672 /* mac_txd2 */
1673− <1 RK_PC1 2 &pcfg_pull_none_12ma>,
1673+ <1 RK_PC1 2 &pcfg_pull_none_8ma>,
16741674
16751675 /* mac_txclk */
1676− <0 RK_PB0 1 &pcfg_pull_none>,
1676+ <0 RK_PB0 1 &pcfg_pull_none_8ma>,
16771677 /* mac_txen */
1678− <0 RK_PB4 1 &pcfg_pull_none>,
1678+ <0 RK_PB4 1 &pcfg_pull_none_8ma>,
16791679 /* mac_clk */
1680− <0 RK_PD0 1 &pcfg_pull_none>,
1680+ <0 RK_PD0 1 &pcfg_pull_none_4ma>,
16811681 /* mac_txd1 */
1682− <0 RK_PC0 1 &pcfg_pull_none>,
1682+ <0 RK_PC0 1 &pcfg_pull_none_8ma>,
16831683 /* mac_txd0 */
1684− <0 RK_PC1 1 &pcfg_pull_none>,
1684+ <0 RK_PC1 1 &pcfg_pull_none_8ma>,
16851685 /* mac_txd3 */
1686− <0 RK_PC7 1 &pcfg_pull_none>,
1686+ <0 RK_PC7 1 &pcfg_pull_none_8ma>,
16871687 /* mac_txd2 */
1688− <0 RK_PC6 1 &pcfg_pull_none>;
1688+ <0 RK_PC6 1 &pcfg_pull_none_8ma>;
16891689 };
16901690
16911691 rmiim1_pins: rmiim1-pins {
arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dts+1−0
@@ -158,6 +158,7 @@ · 157 unmodified lines
158158 };
159159
160160 &hdmi {
161+ ddc-i2c-bus = <&i2c3>;
161162 pinctrl-names = "default";
162163 pinctrl-0 = <&hdmi_cec>;
163164 status = "okay";
arch/arm64/include/asm/futex.h+7−7
@@ -30,8 +30,8 @@ do { \ · 29 unmodified lines
3030 " prfm pstl1strm, %2\n" \
3131 "1: ldxr %w1, %2\n" \
3232 insn "\n" \
33−"2: stlxr %w3, %w0, %2\n" \
34−" cbnz %w3, 1b\n" \
33+"2: stlxr %w0, %w3, %2\n" \
34+" cbnz %w0, 1b\n" \
3535 " dmb ish\n" \
3636 "3:\n" \
3737 " .pushsection .fixup,\"ax\"\n" \
@@ -57,23 +57,23 @@ arch_futex_atomic_op_inuser(int op, int oparg, int *oval, u32 __user *_uaddr) · 19 unmodified lines
5757
5858 switch (op) {
5959 case FUTEX_OP_SET:
60− __futex_atomic_op("mov %w0, %w4",
60+ __futex_atomic_op("mov %w3, %w4",
6161 ret, oldval, uaddr, tmp, oparg);
6262 break;
6363 case FUTEX_OP_ADD:
64− __futex_atomic_op("add %w0, %w1, %w4",
64+ __futex_atomic_op("add %w3, %w1, %w4",
6565 ret, oldval, uaddr, tmp, oparg);
6666 break;
6767 case FUTEX_OP_OR:
68− __futex_atomic_op("orr %w0, %w1, %w4",
68+ __futex_atomic_op("orr %w3, %w1, %w4",
6969 ret, oldval, uaddr, tmp, oparg);
7070 break;
7171 case FUTEX_OP_ANDN:
72− __futex_atomic_op("and %w0, %w1, %w4",
72+ __futex_atomic_op("and %w3, %w1, %w4",
7373 ret, oldval, uaddr, tmp, ~oparg);
7474 break;
7575 case FUTEX_OP_XOR:
76− __futex_atomic_op("eor %w0, %w1, %w4",
76+ __futex_atomic_op("eor %w3, %w1, %w4",
7777 ret, oldval, uaddr, tmp, oparg);
7878 break;
7979 default:
arch/arm64/include/asm/module.h+5−0
@@ -73,4 +73,9 @@ static inline bool is_forbidden_offset_for_adrp(void *place) · 72 unmodified lines
7373 struct plt_entry get_plt_entry(u64 dst, void *pc);
7474 bool plt_entries_equal(const struct plt_entry *a, const struct plt_entry *b);
7575
76+static inline bool plt_entry_is_initialized(const struct plt_entry *e)
77+{
78+ return e->adrp || e->add || e->br;
79+}
80+
7681 #endif /* __ASM_MODULE_H */
arch/arm64/include/asm/syscall.h+8−38
@@ -65,52 +65,22 @@ static inline void syscall_set_return_value(struct task_struct *task, · 64 unmodified lines
6565
6666 static inline void syscall_get_arguments(struct task_struct *task,
6767 struct pt_regs *regs,
68− unsigned int i, unsigned int n,
6968 unsigned long *args)
7069 {
71− if (n == 0)
72− return;
73−
74− if (i + n > SYSCALL_MAX_ARGS) {
75− unsigned long *args_bad = args + SYSCALL_MAX_ARGS - i;
76− unsigned int n_bad = n + i - SYSCALL_MAX_ARGS;
77− pr_warning("%s called with max args %d, handling only %d\n",
78− __func__, i + n, SYSCALL_MAX_ARGS);
79− memset(args_bad, 0, n_bad * sizeof(args[0]));
80− }
81−
82− if (i == 0) {
83− args[0] = regs->orig_x0;
84− args++;
85− i++;
86− n--;
87− }
88−
89− memcpy(args, &regs->regs[i], n * sizeof(args[0]));
70+ args[0] = regs->orig_x0;
71+ args++;
72+
73+ memcpy(args, &regs->regs[1], 5 * sizeof(args[0]));
9074 }
9175
9276 static inline void syscall_set_arguments(struct task_struct *task,
9377 struct pt_regs *regs,
94− unsigned int i, unsigned int n,
9578 const unsigned long *args)
9679 {
97− if (n == 0)
98− return;
99−
100− if (i + n > SYSCALL_MAX_ARGS) {
101− pr_warning("%s called with max args %d, handling only %d\n",
102− __func__, i + n, SYSCALL_MAX_ARGS);
103− n = SYSCALL_MAX_ARGS - i;
104− }
105−
106− if (i == 0) {
107− regs->orig_x0 = args[0];
108− args++;
109− i++;
110− n--;
111− }
112−
113− memcpy(&regs->regs[i], args, n * sizeof(args[0]));
80+ regs->orig_x0 = args[0];
81+ args++;
82+
83+ memcpy(&regs->regs[1], args, 5 * sizeof(args[0]));
11484 }
11585
11686 /*
arch/arm64/kernel/ftrace.c+1−2
@@ -107,8 +107,7 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) · 106 unmodified lines
107107 trampoline = get_plt_entry(addr, mod->arch.ftrace_trampoline);
108108 if (!plt_entries_equal(mod->arch.ftrace_trampoline,
109109 &trampoline)) {
110− if (!plt_entries_equal(mod->arch.ftrace_trampoline,
111− &(struct plt_entry){})) {
110+ if (plt_entry_is_initialized(mod->arch.ftrace_trampoline)) {
112111 pr_err("ftrace: far branches to multiple entry points unsupported inside a single module\n");
113112 return -EINVAL;
114113 }
arch/arm64/kernel/sdei.c+6−0
@@ -94,6 +94,9 @@ static bool on_sdei_normal_stack(unsigned long sp, struct stack_info *info) · 93 unmodified lines
9494 unsigned long low = (unsigned long)raw_cpu_read(sdei_stack_normal_ptr);
9595 unsigned long high = low + SDEI_STACK_SIZE;
9696
97+ if (!low)
98+ return false;
99+
97100 if (sp < low || sp >= high)
98101 return false;
99102
@@ -111,6 +114,9 @@ static bool on_sdei_critical_stack(unsigned long sp, struct stack_info *info) · 11 unmodified lines
111114 unsigned long low = (unsigned long)raw_cpu_read(sdei_stack_critical_ptr);
112115 unsigned long high = low + SDEI_STACK_SIZE;
113116
117+ if (!low)
118+ return false;
119+
114120 if (sp < low || sp >= high)
115121 return false;
116122
arch/arm64/kernel/traps.c+9−6
@@ -102,10 +102,16 @@ static void dump_instr(const char *lvl, struct pt_regs *regs) · 101 unmodified lines
102102 void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
103103 {
104104 struct stackframe frame;
105− int skip;
105+ int skip = 0;
106106
107107 pr_debug("%s(regs = %p tsk = %p)\n", __func__, regs, tsk);
108108
109+ if (regs) {
110+ if (user_mode(regs))
111+ return;
112+ skip = 1;
113+ }
114+
109115 if (!tsk)
110116 tsk = current;
111117
@@ -126,7 +132,6 @@ void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk) · 14 unmodified lines
126132 frame.graph = 0;
127133 #endif
128134
129− skip = !!regs;
130135 printk("Call trace:\n");
131136 do {
132137 /* skip until specified stack frame */
@@ -176,15 +181,13 @@ static int __die(const char *str, int err, struct pt_regs *regs) · 43 unmodified lines
176181 return ret;
177182
178183 print_modules();
179− __show_regs(regs);
180184 pr_emerg("Process %.*s (pid: %d, stack limit = 0x%p)\n",
181185 TASK_COMM_LEN, tsk->comm, task_pid_nr(tsk),
182186 end_of_stack(tsk));
187+ show_regs(regs);
183188
184− if (!user_mode(regs)) {
185− dump_backtrace(regs, tsk);
189+ if (!user_mode(regs))
186190 dump_instr(KERN_EMERG, regs);
187− }
188191
189192 return ret;
190193 }
arch/c6x/include/asm/syscall.h+14−65
@@ -46,78 +46,27 @@ static inline void syscall_set_return_value(struct task_struct *task, · 45 unmodified lines
4646 }
4747
4848 static inline void syscall_get_arguments(struct task_struct *task,
49− struct pt_regs *regs, unsigned int i,
50− unsigned int n, unsigned long *args)
49+ struct pt_regs *regs,
50+ unsigned long *args)
5151 {
52− switch (i) {
53− case 0:
54− if (!n--)
55− break;
56− *args++ = regs->a4;
57− case 1:
58− if (!n--)
59− break;
60− *args++ = regs->b4;
61− case 2:
62− if (!n--)
63− break;
64− *args++ = regs->a6;
65− case 3:
66− if (!n--)
67− break;
68− *args++ = regs->b6;
69− case 4:
70− if (!n--)
71− break;
72− *args++ = regs->a8;
73− case 5:
74− if (!n--)
75− break;
76− *args++ = regs->b8;
77− case 6:
78− if (!n--)
79− break;
80− default:
81− BUG();
82− }
52+ *args++ = regs->a4;
53+ *args++ = regs->b4;
54+ *args++ = regs->a6;
55+ *args++ = regs->b6;
56+ *args++ = regs->a8;
57+ *args = regs->b8;
8358 }
8459
8560 static inline void syscall_set_arguments(struct task_struct *task,
8661 struct pt_regs *regs,
87− unsigned int i, unsigned int n,
8862 const unsigned long *args)
8963 {
90− switch (i) {
91− case 0:
92− if (!n--)
93− break;
94− regs->a4 = *args++;
95− case 1:
96− if (!n--)
97− break;
98− regs->b4 = *args++;
99− case 2:
100− if (!n--)
101− break;
102− regs->a6 = *args++;
103− case 3:
104− if (!n--)
105− break;
106− regs->b6 = *args++;
107− case 4:
108− if (!n--)
109− break;
110− regs->a8 = *args++;
111− case 5:
112− if (!n--)
113− break;
114− regs->a9 = *args++;
115− case 6:
116− if (!n)
117− break;
118− default:
119− BUG();
120− }
64+ regs->a4 = *args++;
65+ regs->b4 = *args++;
66+ regs->a6 = *args++;
67+ regs->b6 = *args++;
68+ regs->a8 = *args++;
69+ regs->a9 = *args;
12170 }
12271
12372 #endif /* __ASM_C6X_SYSCALLS_H */
arch/csky/include/asm/syscall.h+8−18
@@ -43,30 +43,20 @@ syscall_set_return_value(struct task_struct *task, struct pt_regs *regs, · 42 unmodified lines
4343
4444 static inline void
4545 syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
46− unsigned int i, unsigned int n, unsigned long *args)
46+ unsigned long *args)
4747 {
48− BUG_ON(i + n > 6);
49− if (i == 0) {
50− args[0] = regs->orig_a0;
51− args++;
52− i++;
53− n--;
54− }
55− memcpy(args, &regs->a1 + i * sizeof(regs->a1), n * sizeof(args[0]));
48+ args[0] = regs->orig_a0;
49+ args++;
50+ memcpy(args, &regs->a1, 5 * sizeof(args[0]));
5651 }
5752
5853 static inline void
5954 syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
60− unsigned int i, unsigned int n, const unsigned long *args)
55+ const unsigned long *args)
6156 {
62− BUG_ON(i + n > 6);
63− if (i == 0) {
64− regs->orig_a0 = args[0];
65− args++;
66− i++;
67− n--;
68− }
69− memcpy(&regs->a1 + i * sizeof(regs->a1), args, n * sizeof(regs->a0));
57+ regs->orig_a0 = args[0];
58+ args++;
59+ memcpy(&regs->a1, args, 5 * sizeof(regs->a1));
7060 }
7161
7262 static inline int
arch/h8300/include/asm/syscall.h+7−27
@@ -17,34 +17,14 @@ syscall_get_nr(struct task_struct *task, struct pt_regs *regs) · 16 unmodified lines
1717
1818 static inline void
1919 syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
20− unsigned int i, unsigned int n, unsigned long *args)
20+ unsigned long *args)
2121 {
22− BUG_ON(i + n > 6);
23−
24− while (n > 0) {
25− switch (i) {
26− case 0:
27− *args++ = regs->er1;
28− break;
29− case 1:
30− *args++ = regs->er2;
31− break;
32− case 2:
33− *args++ = regs->er3;
34− break;
35− case 3:
36− *args++ = regs->er4;
37− break;
38− case 4:
39− *args++ = regs->er5;
40− break;
41− case 5:
42− *args++ = regs->er6;
43− break;
44− }
45− i++;
46− n--;
47− }
22+ *args++ = regs->er1;
23+ *args++ = regs->er2;
24+ *args++ = regs->er3;
25+ *args++ = regs->er4;
26+ *args++ = regs->er5;
27+ *args = regs->er6;
4828 }
4929
5030
arch/hexagon/include/asm/syscall.h+1−3
@@ -37,10 +37,8 @@ static inline long syscall_get_nr(struct task_struct *task, · 36 unmodified lines
3737
3838 static inline void syscall_get_arguments(struct task_struct *task,
3939 struct pt_regs *regs,
40− unsigned int i, unsigned int n,
4140 unsigned long *args)
4241 {
43− BUG_ON(i + n > 6);
44− memcpy(args, &(&regs->r00)[i], n * sizeof(args[0]));
42+ memcpy(args, &(&regs->r00)[0], 6 * sizeof(args[0]));
4543 }
4644 #endif
arch/ia64/include/asm/syscall.h+3−10
@@ -59,26 +59,19 @@ static inline void syscall_set_return_value(struct task_struct *task, · 58 unmodified lines
5959 }
6060
6161 extern void ia64_syscall_get_set_arguments(struct task_struct *task,
62− struct pt_regs *regs, unsigned int i, unsigned int n,
63− unsigned long *args, int rw);
62+ struct pt_regs *regs, unsigned long *args, int rw);
6463 static inline void syscall_get_arguments(struct task_struct *task,
6564 struct pt_regs *regs,
66− unsigned int i, unsigned int n,
6765 unsigned long *args)
6866 {
69− BUG_ON(i + n > 6);
70−
71− ia64_syscall_get_set_arguments(task, regs, i, n, args, 0);
67+ ia64_syscall_get_set_arguments(task, regs, args, 0);
7268 }
7369
7470 static inline void syscall_set_arguments(struct task_struct *task,
7571 struct pt_regs *regs,
76− unsigned int i, unsigned int n,
7772 unsigned long *args)
7873 {
79− BUG_ON(i + n > 6);
80−
81− ia64_syscall_get_set_arguments(task, regs, i, n, args, 1);
74+ ia64_syscall_get_set_arguments(task, regs, args, 1);
8275 }
8376
8477 static inline int syscall_get_arch(void)
arch/ia64/kernel/ptrace.c+3−4
@@ -2179,12 +2179,11 @@ static void syscall_get_set_args_cb(struct unw_frame_info *info, void *data) · 2178 unmodified lines
21792179 }
21802180
21812181 void ia64_syscall_get_set_arguments(struct task_struct *task,
2182− struct pt_regs *regs, unsigned int i, unsigned int n,
2183− unsigned long *args, int rw)
2182+ struct pt_regs *regs, unsigned long *args, int rw)
21842183 {
21852184 struct syscall_get_set_args data = {
2186− .i = i,
2187− .n = n,
2185+ .i = 0,
2186+ .n = 6,
21882187 .args = args,
21892188 .regs = regs,
21902189 .rw = rw,
arch/microblaze/include/asm/syscall.h+6−2
@@ -82,18 +82,22 @@ static inline void microblaze_set_syscall_arg(struct pt_regs *regs, · 81 unmodified lines
8282
8383 static inline void syscall_get_arguments(struct task_struct *task,
8484 struct pt_regs *regs,
85− unsigned int i, unsigned int n,
8685 unsigned long *args)
8786 {
87+ unsigned int i = 0;
88+ unsigned int n = 6;
89+
8890 while (n--)
8991 *args++ = microblaze_get_syscall_arg(regs, i++);
9092 }
9193
9294 static inline void syscall_set_arguments(struct task_struct *task,
9395 struct pt_regs *regs,
94− unsigned int i, unsigned int n,
9596 const unsigned long *args)
9697 {
98+ unsigned int i = 0;
99+ unsigned int n = 6;
100+
97101 while (n--)
98102 microblaze_set_syscall_arg(regs, i++, *args++);
99103 }
arch/mips/configs/generic/board-ocelot.config+8−0
@@ -1,6 +1,10 @@
11 # require CONFIG_CPU_MIPS32_R2=y
22
33 CONFIG_LEGACY_BOARD_OCELOT=y
4+CONFIG_FIT_IMAGE_FDT_OCELOT=y
5+
6+CONFIG_BRIDGE=y
7+CONFIG_GENERIC_PHY=y
48
59 CONFIG_MTD=y
610 CONFIG_MTD_CMDLINE_PARTS=y
@@ -19,6 +23,8 @@ CONFIG_SERIAL_8250_CONSOLE=y · 12 unmodified lines
1923 CONFIG_SERIAL_OF_PLATFORM=y
2024
2125 CONFIG_NETDEVICES=y
26+CONFIG_NET_SWITCHDEV=y
27+CONFIG_NET_DSA=y
2228 CONFIG_MSCC_OCELOT_SWITCH=y
2329 CONFIG_MSCC_OCELOT_SWITCH_OCELOT=y
2430 CONFIG_MDIO_MSCC_MIIM=y
@@ -35,6 +41,8 @@ CONFIG_SPI_DESIGNWARE=y · 10 unmodified lines
3541 CONFIG_SPI_DW_MMIO=y
3642 CONFIG_SPI_SPIDEV=y
3743
44+CONFIG_PINCTRL_OCELOT=y
45+
3846 CONFIG_GPIO_SYSFS=y
3947
4048 CONFIG_POWER_RESET=y
arch/mips/include/asm/syscall.h+2−1
@@ -116,9 +116,10 @@ static inline void syscall_set_return_value(struct task_struct *task, · 115 unmodified lines
116116
117117 static inline void syscall_get_arguments(struct task_struct *task,
118118 struct pt_regs *regs,
119− unsigned int i, unsigned int n,
120119 unsigned long *args)
121120 {
121+ unsigned int i = 0;
122+ unsigned int n = 6;
122123 int ret;
123124
124125 /* O32 ABI syscall() */
arch/mips/kernel/kgdb.c+2−1
@@ -33,6 +33,7 @@ · 32 unmodified lines
3333 #include <asm/processor.h>
3434 #include <asm/sigcontext.h>
3535 #include <linux/uaccess.h>
36+#include <asm/irq_regs.h>
3637
3738 static struct hard_trap_info {
3839 unsigned char tt; /* Trap type code for MIPS R3xxx and R4xxx */
@@ -214,7 +215,7 @@ void kgdb_call_nmi_hook(void *ignored) · 175 unmodified lines
214215 old_fs = get_fs();
215216 set_fs(KERNEL_DS);
216217
217− kgdb_nmicallback(raw_smp_processor_id(), NULL);
218+ kgdb_nmicallback(raw_smp_processor_id(), get_irq_regs());
218219
219220 set_fs(old_fs);
220221 }
arch/mips/kernel/ptrace.c+1−1
@@ -1419,7 +1419,7 @@ asmlinkage long syscall_trace_enter(struct pt_regs *regs, long syscall) · 1418 unmodified lines
14191419
14201420 sd.nr = syscall;
14211421 sd.arch = syscall_get_arch();
1422− syscall_get_arguments(current, regs, 0, 6, args);
1422+ syscall_get_arguments(current, regs, args);
14231423 for (i = 0; i < 6; i++)
14241424 sd.args[i] = args[i];
14251425 sd.instruction_pointer = KSTK_EIP(current);
arch/mips/sgi-ip27/ip27-irq.c+1−2
@@ -118,7 +118,6 @@ static void shutdown_bridge_irq(struct irq_data *d) · 117 unmodified lines
118118 {
119119 struct hub_irq_data *hd = irq_data_get_irq_chip_data(d);
120120 struct bridge_controller *bc;
121− int pin = hd->pin;
122121
123122 if (!hd)
124123 return;
@@ -126,7 +125,7 @@ static void shutdown_bridge_irq(struct irq_data *d) · 1 unmodified line
126125 disable_hub_irq(d);
127126
128127 bc = hd->bc;
129− bridge_clr(bc, b_int_enable, (1 << pin));
128+ bridge_clr(bc, b_int_enable, (1 << hd->pin));
130129 bridge_read(bc, b_wid_tflush);
131130 }
132131
arch/nds32/include/asm/syscall.h+11−51
@@ -108,81 +108,41 @@ void syscall_set_return_value(struct task_struct *task, struct pt_regs *regs, · 107 unmodified lines
108108 * syscall_get_arguments - extract system call parameter values
109109 * @task: task of interest, must be blocked
110110 * @regs: task_pt_regs() of @task
111− * @i: argument index [0,5]
112− * @n: number of arguments; n+i must be [1,6].
113111 * @args: array filled with argument values
114112 *
115− * Fetches @n arguments to the system call starting with the @i'th argument
116− * (from 0 through 5). Argument @i is stored in @args[0], and so on.
117− * An arch inline version is probably optimal when @i and @n are constants.
113+ * Fetches 6 arguments to the system call (from 0 through 5). The first
114+ * argument is stored in @args[0], and so on.
118115 *
119116 * It's only valid to call this when @task is stopped for tracing on
120117 * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
121− * It's invalid to call this with @i + @n > 6; we only support system calls
122− * taking up to 6 arguments.
123118 */
124119 #define SYSCALL_MAX_ARGS 6
125120 void syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
126− unsigned int i, unsigned int n, unsigned long *args)
121+ unsigned long *args)
127122 {
128− if (n == 0)
129− return;
130− if (i + n > SYSCALL_MAX_ARGS) {
131− unsigned long *args_bad = args + SYSCALL_MAX_ARGS - i;
132− unsigned int n_bad = n + i - SYSCALL_MAX_ARGS;
133− pr_warning("%s called with max args %d, handling only %d\n",
134− __func__, i + n, SYSCALL_MAX_ARGS);
135− memset(args_bad, 0, n_bad * sizeof(args[0]));
136− memset(args_bad, 0, n_bad * sizeof(args[0]));
137− }
138−
139− if (i == 0) {
140− args[0] = regs->orig_r0;
141− args++;
142− i++;
143− n--;
144− }
145−
146− memcpy(args, &regs->uregs[0] + i, n * sizeof(args[0]));
123+ args[0] = regs->orig_r0;
124+ args++;
125+ memcpy(args, &regs->uregs[0] + 1, 5 * sizeof(args[0]));
147126 }
148127
149128 /**
150129 * syscall_set_arguments - change system call parameter value
151130 * @task: task of interest, must be in system call entry tracing
152131 * @regs: task_pt_regs() of @task
153− * @i: argument index [0,5]
154− * @n: number of arguments; n+i must be [1,6].
155132 * @args: array of argument values to store
156133 *
157− * Changes @n arguments to the system call starting with the @i'th argument.
158− * Argument @i gets value @args[0], and so on.
159− * An arch inline version is probably optimal when @i and @n are constants.
134+ * Changes 6 arguments to the system call. The first argument gets value
135+ * @args[0], and so on.
160136 *
161137 * It's only valid to call this when @task is stopped for tracing on
162138 * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
163− * It's invalid to call this with @i + @n > 6; we only support system calls
164− * taking up to 6 arguments.
165139 */
166140 void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
167− unsigned int i, unsigned int n,
168141 const unsigned long *args)
169142 {
170− if (n == 0)
171− return;
172−
173− if (i + n > SYSCALL_MAX_ARGS) {
174− pr_warn("%s called with max args %d, handling only %d\n",
175− __func__, i + n, SYSCALL_MAX_ARGS);
176− n = SYSCALL_MAX_ARGS - i;
177− }
178−
179− if (i == 0) {
180− regs->orig_r0 = args[0];
181− args++;
182− i++;
183− n--;
184− }
143+ regs->orig_r0 = args[0];
144+ args++;
185145
186− memcpy(&regs->uregs[0] + i, args, n * sizeof(args[0]));
146+ memcpy(&regs->uregs[0] + 1, args, 5 * sizeof(args[0]));
187147 }
188148 #endif /* _ASM_NDS32_SYSCALL_H */
arch/nios2/include/asm/syscall.h+14−70
@@ -58,81 +58,25 @@ static inline void syscall_set_return_value(struct task_struct *task, · 57 unmodified lines
5858 }
5959
6060 static inline void syscall_get_arguments(struct task_struct *task,
61− struct pt_regs *regs, unsigned int i, unsigned int n,
62− unsigned long *args)
61+ struct pt_regs *regs, unsigned long *args)
6362 {
64− BUG_ON(i + n > 6);
65−
66− switch (i) {
67− case 0:
68− if (!n--)
69− break;
70− *args++ = regs->r4;
71− case 1:
72− if (!n--)
73− break;
74− *args++ = regs->r5;
75− case 2:
76− if (!n--)
77− break;
78− *args++ = regs->r6;
79− case 3:
80− if (!n--)
81− break;
82− *args++ = regs->r7;
83− case 4:
84− if (!n--)
85− break;
86− *args++ = regs->r8;
87− case 5:
88− if (!n--)
89− break;
90− *args++ = regs->r9;
91− case 6:
92− if (!n--)
93− break;
94− default:
95− BUG();
96− }
63+ *args++ = regs->r4;
64+ *args++ = regs->r5;
65+ *args++ = regs->r6;
66+ *args++ = regs->r7;
67+ *args++ = regs->r8;
68+ *args = regs->r9;
9769 }
9870
9971 static inline void syscall_set_arguments(struct task_struct *task,
100− struct pt_regs *regs, unsigned int i, unsigned int n,
101− const unsigned long *args)
72+ struct pt_regs *regs, const unsigned long *args)
10273 {
103− BUG_ON(i + n > 6);
104−
105− switch (i) {
106− case 0:
107− if (!n--)
108− break;
109− regs->r4 = *args++;
110− case 1:
111− if (!n--)
112− break;
113− regs->r5 = *args++;
114− case 2:
115− if (!n--)
116− break;
117− regs->r6 = *args++;
118− case 3:
119− if (!n--)
120− break;
121− regs->r7 = *args++;
122− case 4:
123− if (!n--)
124− break;
125− regs->r8 = *args++;
126− case 5:
127− if (!n--)
128− break;
129− regs->r9 = *args++;
130− case 6:
131− if (!n)
132− break;
133− default:
134− BUG();
135− }
74+ regs->r4 = *args++;
75+ regs->r5 = *args++;
76+ regs->r6 = *args++;
77+ regs->r7 = *args++;
78+ regs->r8 = *args++;
79+ regs->r9 = *args;
13680 }
13781
13882 #endif
arch/openrisc/include/asm/syscall.h+4−8
@@ -56,20 +56,16 @@ syscall_set_return_value(struct task_struct *task, struct pt_regs *regs, · 55 unmodified lines
5656
5757 static inline void
5858 syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
59− unsigned int i, unsigned int n, unsigned long *args)
59+ unsigned long *args)
6060 {
61− BUG_ON(i + n > 6);
62−
63− memcpy(args, &regs->gpr[3 + i], n * sizeof(args[0]));
61+ memcpy(args, &regs->gpr[3], 6 * sizeof(args[0]));
6462 }
6563
6664 static inline void
6765 syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
68− unsigned int i, unsigned int n, const unsigned long *args)
66+ const unsigned long *args)
6967 {
70− BUG_ON(i + n > 6);
71−
72− memcpy(&regs->gpr[3 + i], args, n * sizeof(args[0]));
68+ memcpy(&regs->gpr[3], args, 6 * sizeof(args[0]));
7369 }
7470
7571 static inline int syscall_get_arch(void)
arch/parisc/include/asm/ptrace.h+3−2
@@ -22,13 +22,14 @@ unsigned long profile_pc(struct pt_regs *); · 21 unmodified lines
2222
2323 static inline unsigned long regs_return_value(struct pt_regs *regs)
2424 {
25− return regs->gr[20];
25+ return regs->gr[28];
2626 }
2727
2828 static inline void instruction_pointer_set(struct pt_regs *regs,
2929 unsigned long val)
3030 {
31− regs->iaoq[0] = val;
31+ regs->iaoq[0] = val;
32+ regs->iaoq[1] = val + 4;
3233 }
3334
3435 /* Query offset/name of register from its name/offset */
arch/parisc/include/asm/syscall.h+8−22
@@ -18,29 +18,15 @@ static inline long syscall_get_nr(struct task_struct *tsk, · 17 unmodified lines
1818 }
1919
2020 static inline void syscall_get_arguments(struct task_struct *tsk,
21− struct pt_regs *regs, unsigned int i,
22− unsigned int n, unsigned long *args)
21+ struct pt_regs *regs,
22+ unsigned long *args)
2323 {
24− BUG_ON(i);
25−
26− switch (n) {
27− case 6:
28− args[5] = regs->gr[21];
29− case 5:
30− args[4] = regs->gr[22];
31− case 4:
32− args[3] = regs->gr[23];
33− case 3:
34− args[2] = regs->gr[24];
35− case 2:
36− args[1] = regs->gr[25];
37− case 1:
38− args[0] = regs->gr[26];
39− case 0:
40− break;
41− default:
42− BUG();
43− }
24+ args[5] = regs->gr[21];
25+ args[4] = regs->gr[22];
26+ args[3] = regs->gr[23];
27+ args[2] = regs->gr[24];
28+ args[1] = regs->gr[25];
29+ args[0] = regs->gr[26];
4430 }
4531
4632 static inline long syscall_get_return_value(struct task_struct *task,
arch/parisc/kernel/process.c+0−6
@@ -210,12 +210,6 @@ void __cpuidle arch_cpu_idle(void) · 209 unmodified lines
210210
211211 static int __init parisc_idle_init(void)
212212 {
213− const char *marker;
214−
215− /* check QEMU/SeaBIOS marker in PAGE0 */
216− marker = (char *) &PAGE0->pad0;
217− running_on_qemu = (memcmp(marker, "SeaBIOS", 8) == 0);
218−
219213 if (!running_on_qemu)
220214 cpu_idle_poll_ctrl(1);
221215
arch/parisc/kernel/setup.c+3−0
@@ -397,6 +397,9 @@ void __init start_parisc(void) · 396 unmodified lines
397397 int ret, cpunum;
398398 struct pdc_coproc_cfg coproc_cfg;
399399
400+ /* check QEMU/SeaBIOS marker in PAGE0 */
401+ running_on_qemu = (memcmp(&PAGE0->pad0, "SeaBIOS", 8) == 0);
402+
400403 cpunum = smp_processor_id();
401404
402405 init_cpu_topology();
arch/powerpc/include/asm/mmu.h+1−1
@@ -352,7 +352,7 @@ static inline bool strict_kernel_rwx_enabled(void) · 351 unmodified lines
352352 #if defined(CONFIG_SPARSEMEM_VMEMMAP) && defined(CONFIG_SPARSEMEM_EXTREME) && \
353353 defined (CONFIG_PPC_64K_PAGES)
354354 #define MAX_PHYSMEM_BITS 51
355−#elif defined(CONFIG_SPARSEMEM)
355+#elif defined(CONFIG_PPC64)
356356 #define MAX_PHYSMEM_BITS 46
357357 #endif
358358
arch/powerpc/include/asm/syscall.h+5−10
@@ -65,22 +65,20 @@ static inline void syscall_set_return_value(struct task_struct *task, · 64 unmodified lines
6565
6666 static inline void syscall_get_arguments(struct task_struct *task,
6767 struct pt_regs *regs,
68− unsigned int i, unsigned int n,
6968 unsigned long *args)
7069 {
7170 unsigned long val, mask = -1UL;
72−
73− BUG_ON(i + n > 6);
71+ unsigned int n = 6;
7472
7573 #ifdef CONFIG_COMPAT
7674 if (test_tsk_thread_flag(task, TIF_32BIT))
7775 mask = 0xffffffff;
7876 #endif
7977 while (n--) {
80− if (n == 0 && i == 0)
78+ if (n == 0)
8179 val = regs->orig_gpr3;
8280 else
83− val = regs->gpr[3 + i + n];
81+ val = regs->gpr[3 + n];
8482
8583 args[n] = val & mask;
8684 }
@@ -88,15 +86,12 @@ static inline void syscall_get_arguments(struct task_struct *task, · 1 unmodified line
8886
8987 static inline void syscall_set_arguments(struct task_struct *task,
9088 struct pt_regs *regs,
91− unsigned int i, unsigned int n,
9289 const unsigned long *args)
9390 {
94− BUG_ON(i + n > 6);
95− memcpy(&regs->gpr[3 + i], args, n * sizeof(args[0]));
91+ memcpy(&regs->gpr[3], args, 6 * sizeof(args[0]));
9692
9793 /* Also copy the first argument into orig_gpr3 */
98− if (i == 0 && n > 0)
99− regs->orig_gpr3 = args[0];
94+ regs->orig_gpr3 = args[0];
10095 }
10196
10297 static inline int syscall_get_arch(void)
arch/powerpc/kernel/exceptions-64s.S+12−0
@@ -656,11 +656,17 @@ EXC_COMMON_BEGIN(data_access_slb_common) · 655 unmodified lines
656656 ld r4,PACA_EXSLB+EX_DAR(r13)
657657 std r4,_DAR(r1)
658658 addi r3,r1,STACK_FRAME_OVERHEAD
659+BEGIN_MMU_FTR_SECTION
660+ /* HPT case, do SLB fault */
659661 bl do_slb_fault
660662 cmpdi r3,0
661663 bne- 1f
662664 b fast_exception_return
663665 1: /* Error case */
666+MMU_FTR_SECTION_ELSE
667+ /* Radix case, access is outside page table range */
668+ li r3,-EFAULT
669+ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_TYPE_RADIX)
664670 std r3,RESULT(r1)
665671 bl save_nvgprs
666672 RECONCILE_IRQ_STATE(r10, r11)
@@ -705,11 +711,17 @@ EXC_COMMON_BEGIN(instruction_access_slb_common) · 38 unmodified lines
705711 EXCEPTION_PROLOG_COMMON(0x480, PACA_EXSLB)
706712 ld r4,_NIP(r1)
707713 addi r3,r1,STACK_FRAME_OVERHEAD
714+BEGIN_MMU_FTR_SECTION
715+ /* HPT case, do SLB fault */
708716 bl do_slb_fault
709717 cmpdi r3,0
710718 bne- 1f
711719 b fast_exception_return
712720 1: /* Error case */
721+MMU_FTR_SECTION_ELSE
722+ /* Radix case, access is outside page table range */
723+ li r3,-EFAULT
724+ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_TYPE_RADIX)
713725 std r3,RESULT(r1)
714726 bl save_nvgprs
715727 RECONCILE_IRQ_STATE(r10, r11)
arch/powerpc/kernel/head_32.S+0−8
@@ -851,10 +851,6 @@ __secondary_start: · 850 unmodified lines
851851 tophys(r4,r2)
852852 addi r4,r4,THREAD /* phys address of our thread_struct */
853853 mtspr SPRN_SPRG_THREAD,r4
854−#ifdef CONFIG_PPC_RTAS
855− li r3,0
856− stw r3, RTAS_SP(r4) /* 0 => not in RTAS */
857−#endif
858854 lis r4, (swapper_pg_dir - PAGE_OFFSET)@h
859855 ori r4, r4, (swapper_pg_dir - PAGE_OFFSET)@l
860856 mtspr SPRN_SPRG_PGDIR, r4
@@ -941,10 +937,6 @@ start_here: · 80 unmodified lines
941937 tophys(r4,r2)
942938 addi r4,r4,THREAD /* init task's THREAD */
943939 mtspr SPRN_SPRG_THREAD,r4
944−#ifdef CONFIG_PPC_RTAS
945− li r3,0
946− stw r3, RTAS_SP(r4) /* 0 => not in RTAS */
947−#endif
948940 lis r4, (swapper_pg_dir - PAGE_OFFSET)@h
949941 ori r4, r4, (swapper_pg_dir - PAGE_OFFSET)@l
950942 mtspr SPRN_SPRG_PGDIR, r4
arch/powerpc/kernel/kvm.c+7−0
@@ -22,6 +22,7 @@ · 21 unmodified lines
2222 #include <linux/kvm_host.h>
2323 #include <linux/init.h>
2424 #include <linux/export.h>
25+#include <linux/kmemleak.h>
2526 #include <linux/kvm_para.h>
2627 #include <linux/slab.h>
2728 #include <linux/of.h>
@@ -712,6 +713,12 @@ static void kvm_use_magic_page(void) · 684 unmodified lines
712713
713714 static __init void kvm_free_tmp(void)
714715 {
716+ /*
717+ * Inform kmemleak about the hole in the .bss section since the
718+ * corresponding pages will be unmapped with DEBUG_PAGEALLOC=y.
719+ */
720+ kmemleak_free_part(&kvm_tmp[kvm_tmp_index],
721+ ARRAY_SIZE(kvm_tmp) - kvm_tmp_index);
715722 free_reserved_area(&kvm_tmp[kvm_tmp_index],
716723 &kvm_tmp[ARRAY_SIZE(kvm_tmp)], -1, NULL);
717724 }
arch/powerpc/kernel/vdso32/gettimeofday.S+1−1
@@ -98,7 +98,7 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime) · 97 unmodified lines
9898 * can be used, r7 contains NSEC_PER_SEC.
9999 */
100100
101− lwz r5,WTOM_CLOCK_SEC(r9)
101+ lwz r5,(WTOM_CLOCK_SEC+LOPART)(r9)
102102 lwz r6,WTOM_CLOCK_NSEC(r9)
103103
104104 /* We now have our offset in r5,r6. We create a fake dependency
arch/riscv/configs/rv32_defconfig+84−0
@@ -0,0 +1,84 @@
1+CONFIG_SYSVIPC=y
2+CONFIG_POSIX_MQUEUE=y
3+CONFIG_IKCONFIG=y
4+CONFIG_IKCONFIG_PROC=y
5+CONFIG_CGROUPS=y
6+CONFIG_CGROUP_SCHED=y
7+CONFIG_CFS_BANDWIDTH=y
8+CONFIG_CGROUP_BPF=y
9+CONFIG_NAMESPACES=y
10+CONFIG_USER_NS=y
11+CONFIG_CHECKPOINT_RESTORE=y
12+CONFIG_BLK_DEV_INITRD=y
13+CONFIG_EXPERT=y
14+CONFIG_BPF_SYSCALL=y
15+CONFIG_ARCH_RV32I=y
16+CONFIG_SMP=y
17+CONFIG_MODULES=y
18+CONFIG_MODULE_UNLOAD=y
19+CONFIG_NET=y
20+CONFIG_PACKET=y
21+CONFIG_UNIX=y
22+CONFIG_INET=y
23+CONFIG_IP_MULTICAST=y
24+CONFIG_IP_ADVANCED_ROUTER=y
25+CONFIG_IP_PNP=y
26+CONFIG_IP_PNP_DHCP=y
27+CONFIG_IP_PNP_BOOTP=y
28+CONFIG_IP_PNP_RARP=y
29+CONFIG_NETLINK_DIAG=y
30+CONFIG_PCI=y
31+CONFIG_PCIEPORTBUS=y
32+CONFIG_PCI_HOST_GENERIC=y
33+CONFIG_PCIE_XILINX=y
34+CONFIG_DEVTMPFS=y
35+CONFIG_BLK_DEV_LOOP=y
36+CONFIG_VIRTIO_BLK=y
37+CONFIG_BLK_DEV_SD=y
38+CONFIG_BLK_DEV_SR=y
39+CONFIG_ATA=y
40+CONFIG_SATA_AHCI=y
41+CONFIG_SATA_AHCI_PLATFORM=y
42+CONFIG_NETDEVICES=y
43+CONFIG_VIRTIO_NET=y
44+CONFIG_MACB=y
45+CONFIG_E1000E=y
46+CONFIG_R8169=y
47+CONFIG_MICROSEMI_PHY=y
48+CONFIG_INPUT_MOUSEDEV=y
49+CONFIG_SERIAL_8250=y
50+CONFIG_SERIAL_8250_CONSOLE=y
51+CONFIG_SERIAL_OF_PLATFORM=y
52+CONFIG_SERIAL_EARLYCON_RISCV_SBI=y
53+CONFIG_HVC_RISCV_SBI=y
54+# CONFIG_PTP_1588_CLOCK is not set
55+CONFIG_DRM=y
56+CONFIG_DRM_RADEON=y
57+CONFIG_FRAMEBUFFER_CONSOLE=y
58+CONFIG_USB=y
59+CONFIG_USB_XHCI_HCD=y
60+CONFIG_USB_XHCI_PLATFORM=y
61+CONFIG_USB_EHCI_HCD=y
62+CONFIG_USB_EHCI_HCD_PLATFORM=y
63+CONFIG_USB_OHCI_HCD=y
64+CONFIG_USB_OHCI_HCD_PLATFORM=y
65+CONFIG_USB_STORAGE=y
66+CONFIG_USB_UAS=y
67+CONFIG_VIRTIO_MMIO=y
68+CONFIG_SIFIVE_PLIC=y
69+CONFIG_EXT4_FS=y
70+CONFIG_EXT4_FS_POSIX_ACL=y
71+CONFIG_AUTOFS4_FS=y
72+CONFIG_MSDOS_FS=y
73+CONFIG_VFAT_FS=y
74+CONFIG_TMPFS=y
75+CONFIG_TMPFS_POSIX_ACL=y
76+CONFIG_NFS_FS=y
77+CONFIG_NFS_V4=y
78+CONFIG_NFS_V4_1=y
79+CONFIG_NFS_V4_2=y
80+CONFIG_ROOT_NFS=y
81+CONFIG_CRYPTO_USER_API_HASH=y
82+CONFIG_CRYPTO_DEV_VIRTIO=y
83+CONFIG_PRINTK_TIME=y
84+# CONFIG_RCU_TRACE is not set
arch/riscv/include/asm/fixmap.h+1−1
@@ -26,7 +26,7 @@ enum fixed_addresses { · 25 unmodified lines
2626 };
2727
2828 #define FIXADDR_SIZE (__end_of_fixed_addresses * PAGE_SIZE)
29−#define FIXADDR_TOP (PAGE_OFFSET)
29+#define FIXADDR_TOP (VMALLOC_START)
3030 #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
3131
3232 #define FIXMAP_PAGE_IO PAGE_KERNEL
arch/riscv/include/asm/syscall.h+6−18
@@ -72,32 +72,20 @@ static inline void syscall_set_return_value(struct task_struct *task, · 71 unmodified lines
7272
7373 static inline void syscall_get_arguments(struct task_struct *task,
7474 struct pt_regs *regs,
75− unsigned int i, unsigned int n,
7675 unsigned long *args)
7776 {
78− BUG_ON(i + n > 6);
79− if (i == 0) {
80− args[0] = regs->orig_a0;
81− args++;
82− i++;
83− n--;
84− }
85− memcpy(args, &regs->a1 + i * sizeof(regs->a1), n * sizeof(args[0]));
77+ args[0] = regs->orig_a0;
78+ args++;
79+ memcpy(args, &regs->a1, 5 * sizeof(args[0]));
8680 }
8781
8882 static inline void syscall_set_arguments(struct task_struct *task,
8983 struct pt_regs *regs,
90− unsigned int i, unsigned int n,
9184 const unsigned long *args)
9285 {
93− BUG_ON(i + n > 6);
94− if (i == 0) {
95− regs->orig_a0 = args[0];
96− args++;
97− i++;
98− n--;
99− }
100− memcpy(&regs->a1 + i * sizeof(regs->a1), args, n * sizeof(regs->a0));
86+ regs->orig_a0 = args[0];
87+ args++;
88+ memcpy(&regs->a1, args, 5 * sizeof(regs->a1));
10189 }
10290
10391 static inline int syscall_get_arch(void)
arch/riscv/include/asm/uaccess.h+1−1
@@ -300,7 +300,7 @@ do { \ · 299 unmodified lines
300300 " .balign 4\n" \
301301 "4:\n" \
302302 " li %0, %6\n" \
303− " jump 2b, %1\n" \
303+ " jump 3b, %1\n" \
304304 " .previous\n" \
305305 " .section __ex_table,\"a\"\n" \
306306 " .balign " RISCV_SZPTR "\n" \
arch/riscv/kernel/Makefile+0−3
@@ -4,7 +4,6 @@ · 3 unmodified lines
44
55 ifdef CONFIG_FTRACE
66 CFLAGS_REMOVE_ftrace.o = -pg
7−CFLAGS_REMOVE_setup.o = -pg
87 endif
98
109 extra-y += head.o
@@ -29,8 +28,6 @@ obj-y += vdso.o · 18 unmodified lines
2928 obj-y += cacheinfo.o
3029 obj-y += vdso/
3130
32−CFLAGS_setup.o := -mcmodel=medany
33−
3431 obj-$(CONFIG_FPU) += fpu.o
3532 obj-$(CONFIG_SMP) += smpboot.o
3633 obj-$(CONFIG_SMP) += smp.o
arch/riscv/kernel/module.c+1−1
@@ -141,7 +141,7 @@ static int apply_r_riscv_hi20_rela(struct module *me, u32 *location, · 140 unmodified lines
141141 {
142142 s32 hi20;
143143
144− if (IS_ENABLED(CMODEL_MEDLOW)) {
144+ if (IS_ENABLED(CONFIG_CMODEL_MEDLOW)) {
145145 pr_err(
146146 "%s: target %016llx can not be addressed by the 32-bit offset from PC = %p\n",
147147 me->name, (long long)v, location);
arch/riscv/kernel/setup.c+0−8
@@ -48,14 +48,6 @@ struct screen_info screen_info = { · 47 unmodified lines
4848 };
4949 #endif
5050
51−unsigned long va_pa_offset;
52−EXPORT_SYMBOL(va_pa_offset);
53−unsigned long pfn_base;
54−EXPORT_SYMBOL(pfn_base);
55−
56−unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)] __page_aligned_bss;
57−EXPORT_SYMBOL(empty_zero_page);
58−
5951 /* The lucky hart to first increment this variable will boot the other cores */
6052 atomic_t hart_lottery;
6153 unsigned long boot_cpu_hartid;
arch/riscv/mm/Makefile+6−0
@@ -1,3 +1,9 @@
1+
2+CFLAGS_init.o := -mcmodel=medany
3+ifdef CONFIG_FTRACE
4+CFLAGS_REMOVE_init.o = -pg
5+endif
6+
17 obj-y += init.o
28 obj-y += fault.o
39 obj-y += extable.o
arch/riscv/mm/init.c+36−0
@@ -25,6 +25,10 @@ · 24 unmodified lines
2525 #include <asm/pgtable.h>
2626 #include <asm/io.h>
2727
28+unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]
29+ __page_aligned_bss;
30+EXPORT_SYMBOL(empty_zero_page);
31+
2832 static void __init zone_sizes_init(void)
2933 {
3034 unsigned long max_zone_pfns[MAX_NR_ZONES] = { 0, };
@@ -117,6 +121,14 @@ void __init setup_bootmem(void) · 86 unmodified lines
117121 */
118122 memblock_reserve(reg->base, vmlinux_end - reg->base);
119123 mem_size = min(reg->size, (phys_addr_t)-PAGE_OFFSET);
124+
125+ /*
126+ * Remove memblock from the end of usable area to the
127+ * end of region
128+ */
129+ if (reg->base + mem_size < end)
130+ memblock_remove(reg->base + mem_size,
131+ end - reg->base - mem_size);
120132 }
121133 }
122134 BUG_ON(mem_size == 0);
@@ -143,6 +155,11 @@ void __init setup_bootmem(void) · 20 unmodified lines
143155 }
144156 }
145157
158+unsigned long va_pa_offset;
159+EXPORT_SYMBOL(va_pa_offset);
160+unsigned long pfn_base;
161+EXPORT_SYMBOL(pfn_base);
162+
146163 pgd_t swapper_pg_dir[PTRS_PER_PGD] __page_aligned_bss;
147164 pgd_t trampoline_pg_dir[PTRS_PER_PGD] __initdata __aligned(PAGE_SIZE);
148165
@@ -172,6 +189,25 @@ void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t prot) · 23 unmodified lines
172189 }
173190 }
174191
192+/*
193+ * setup_vm() is called from head.S with MMU-off.
194+ *
195+ * Following requirements should be honoured for setup_vm() to work
196+ * correctly:
197+ * 1) It should use PC-relative addressing for accessing kernel symbols.
198+ * To achieve this we always use GCC cmodel=medany.
199+ * 2) The compiler instrumentation for FTRACE will not work for setup_vm()
200+ * so disable compiler instrumentation when FTRACE is enabled.
201+ *
202+ * Currently, the above requirements are honoured by using custom CFLAGS
203+ * for init.o in mm/Makefile.
204+ */
205+
206+#ifndef __riscv_cmodel_medany
207+#error "setup_vm() is called from head.S before relocate so it should "
208+ "not use absolute addressing."
209+#endif
210+
175211 asmlinkage void __init setup_vm(void)
176212 {
177213 extern char _start;
arch/s390/boot/mem_detect.c+1−1
@@ -25,7 +25,7 @@ static void *mem_detect_alloc_extended(void) · 24 unmodified lines
2525 {
2626 unsigned long offset = ALIGN(mem_safe_offset(), sizeof(u64));
2727
28− if (IS_ENABLED(BLK_DEV_INITRD) && INITRD_START && INITRD_SIZE &&
28+ if (IS_ENABLED(CONFIG_BLK_DEV_INITRD) && INITRD_START && INITRD_SIZE &&
2929 INITRD_START < offset + ENTRIES_EXTENDED_MAX)
3030 offset = ALIGN(INITRD_START + INITRD_SIZE, sizeof(u64));
3131
arch/s390/include/asm/syscall.h+10−18
@@ -56,40 +56,32 @@ static inline void syscall_set_return_value(struct task_struct *task, · 55 unmodified lines
5656
5757 static inline void syscall_get_arguments(struct task_struct *task,
5858 struct pt_regs *regs,
59− unsigned int i, unsigned int n,
6059 unsigned long *args)
6160 {
6261 unsigned long mask = -1UL;
62+ unsigned int n = 6;
6363
64− /*
65− * No arguments for this syscall, there's nothing to do.
66− */
67− if (!n)
68− return;
69−
70− BUG_ON(i + n > 6);
7164 #ifdef CONFIG_COMPAT
7265 if (test_tsk_thread_flag(task, TIF_31BIT))
7366 mask = 0xffffffff;
7467 #endif
7568 while (n-- > 0)
76− if (i + n > 0)
77− args[n] = regs->gprs[2 + i + n] & mask;
78− if (i == 0)
79− args[0] = regs->orig_gpr2 & mask;
69+ if (n > 0)
70+ args[n] = regs->gprs[2 + n] & mask;
71+
72+ args[0] = regs->orig_gpr2 & mask;
8073 }
8174
8275 static inline void syscall_set_arguments(struct task_struct *task,
8376 struct pt_regs *regs,
84− unsigned int i, unsigned int n,
8577 const unsigned long *args)
8678 {
87− BUG_ON(i + n > 6);
79+ unsigned int n = 6;
80+
8881 while (n-- > 0)
89− if (i + n > 0)
90− regs->gprs[2 + i + n] = args[n];
91− if (i == 0)
92− regs->orig_gpr2 = args[0];
82+ if (n > 0)
83+ regs->gprs[2 + n] = args[n];
84+ regs->orig_gpr2 = args[0];
9385 }
9486
9587 static inline int syscall_get_arch(void)
arch/s390/kernel/fpu.c+1−1
@@ -23,7 +23,7 @@ void __kernel_fpu_begin(struct kernel_fpu *state, u32 flags) · 22 unmodified lines
2323
2424 if (flags & KERNEL_FPC)
2525 /* Save floating point control */
26− asm volatile("stfpc %0" : "=m" (state->fpc));
26+ asm volatile("stfpc %0" : "=Q" (state->fpc));
2727
2828 if (!MACHINE_HAS_VX) {
2929 if (flags & KERNEL_VXR_V0V7) {
arch/s390/kernel/vtime.c+4−4
@@ -37,7 +37,7 @@ static inline u64 get_vtimer(void) · 36 unmodified lines
3737 {
3838 u64 timer;
3939
40− asm volatile("stpt %0" : "=m" (timer));
40+ asm volatile("stpt %0" : "=Q" (timer));
4141 return timer;
4242 }
4343
@@ -48,7 +48,7 @@ static inline void set_vtimer(u64 expires) · 4 unmodified lines
4848 asm volatile(
4949 " stpt %0\n" /* Store current cpu timer value */
5050 " spt %1" /* Set new value imm. afterwards */
51− : "=m" (timer) : "m" (expires));
51+ : "=Q" (timer) : "Q" (expires));
5252 S390_lowcore.system_timer += S390_lowcore.last_update_timer - timer;
5353 S390_lowcore.last_update_timer = expires;
5454 }
@@ -135,8 +135,8 @@ static int do_account_vtime(struct task_struct *tsk) · 80 unmodified lines
135135 #else
136136 " stck %1" /* Store current tod clock value */
137137 #endif
138− : "=m" (S390_lowcore.last_update_timer),
139− "=m" (S390_lowcore.last_update_clock));
138+ : "=Q" (S390_lowcore.last_update_timer),
139+ "=Q" (S390_lowcore.last_update_clock));
140140 clock = S390_lowcore.last_update_clock - clock;
141141 timer -= S390_lowcore.last_update_timer;
142142
arch/sh/boards/of-generic.c+2−2
@@ -164,10 +164,10 @@ static struct sh_machine_vector __initmv sh_of_generic_mv = { · 163 unmodified lines
164164
165165 struct sh_clk_ops;
166166
167−void __init arch_init_clk_ops(struct sh_clk_ops **ops, int idx)
167+void __init __weak arch_init_clk_ops(struct sh_clk_ops **ops, int idx)
168168 {
169169 }
170170
171−void __init plat_irq_setup(void)
171+void __init __weak plat_irq_setup(void)
172172 {
173173 }
arch/sh/include/asm/syscall_32.h+12−35
@@ -48,51 +48,28 @@ static inline void syscall_set_return_value(struct task_struct *task, · 47 unmodified lines
4848
4949 static inline void syscall_get_arguments(struct task_struct *task,
5050 struct pt_regs *regs,
51− unsigned int i, unsigned int n,
5251 unsigned long *args)
5352 {
54− /*
55− * Do this simply for now. If we need to start supporting
56− * fetching arguments from arbitrary indices, this will need some
57− * extra logic. Presently there are no in-tree users that depend
58− * on this behaviour.
59− */
60− BUG_ON(i);
6153
6254 /* Argument pattern is: R4, R5, R6, R7, R0, R1 */
63− switch (n) {
64− case 6: args[5] = regs->regs[1];
65− case 5: args[4] = regs->regs[0];
66− case 4: args[3] = regs->regs[7];
67− case 3: args[2] = regs->regs[6];
68− case 2: args[1] = regs->regs[5];
69− case 1: args[0] = regs->regs[4];
70− case 0:
71− break;
72− default:
73− BUG();
74− }
55+ args[5] = regs->regs[1];
56+ args[4] = regs->regs[0];
57+ args[3] = regs->regs[7];
58+ args[2] = regs->regs[6];
59+ args[1] = regs->regs[5];
60+ args[0] = regs->regs[4];
7561 }
7662
7763 static inline void syscall_set_arguments(struct task_struct *task,
7864 struct pt_regs *regs,
79− unsigned int i, unsigned int n,
8065 const unsigned long *args)
8166 {
82− /* Same note as above applies */
83− BUG_ON(i);
84−
85− switch (n) {
86− case 6: regs->regs[1] = args[5];
87− case 5: regs->regs[0] = args[4];
88− case 4: regs->regs[7] = args[3];
89− case 3: regs->regs[6] = args[2];
90− case 2: regs->regs[5] = args[1];
91− case 1: regs->regs[4] = args[0];
92− break;
93− default:
94− BUG();
95− }
67+ regs->regs[1] = args[5];
68+ regs->regs[0] = args[4];
69+ regs->regs[7] = args[3];
70+ regs->regs[6] = args[2];
71+ regs->regs[5] = args[1];
72+ regs->regs[4] = args[0];
9673 }
9774
9875 static inline int syscall_get_arch(void)
arch/sh/include/asm/syscall_64.h+2−6
@@ -47,20 +47,16 @@ static inline void syscall_set_return_value(struct task_struct *task, · 46 unmodified lines
4747
4848 static inline void syscall_get_arguments(struct task_struct *task,
4949 struct pt_regs *regs,
50− unsigned int i, unsigned int n,
5150 unsigned long *args)
5251 {
53− BUG_ON(i + n > 6);
54− memcpy(args, &regs->regs[2 + i], n * sizeof(args[0]));
52+ memcpy(args, &regs->regs[2], 6 * sizeof(args[0]));
5553 }
5654
5755 static inline void syscall_set_arguments(struct task_struct *task,
5856 struct pt_regs *regs,
59− unsigned int i, unsigned int n,
6057 const unsigned long *args)
6158 {
62− BUG_ON(i + n > 6);
63− memcpy(&regs->regs[2 + i], args, n * sizeof(args[0]));
59+ memcpy(&regs->regs[2], args, 6 * sizeof(args[0]));
6460 }
6561
6662 static inline int syscall_get_arch(void)
arch/sparc/include/asm/syscall.h+5−6
@@ -96,11 +96,11 @@ static inline void syscall_set_return_value(struct task_struct *task, · 95 unmodified lines
9696
9797 static inline void syscall_get_arguments(struct task_struct *task,
9898 struct pt_regs *regs,
99− unsigned int i, unsigned int n,
10099 unsigned long *args)
101100 {
102101 int zero_extend = 0;
103102 unsigned int j;
103+ unsigned int n = 6;
104104
105105 #ifdef CONFIG_SPARC64
106106 if (test_tsk_thread_flag(task, TIF_32BIT))
@@ -108,7 +108,7 @@ static inline void syscall_get_arguments(struct task_struct *task, · 1 unmodified line
108108 #endif
109109
110110 for (j = 0; j < n; j++) {
111− unsigned long val = regs->u_regs[UREG_I0 + i + j];
111+ unsigned long val = regs->u_regs[UREG_I0 + j];
112112
113113 if (zero_extend)
114114 args[j] = (u32) val;
@@ -119,13 +119,12 @@ static inline void syscall_get_arguments(struct task_struct *task, · 4 unmodified lines
119119
120120 static inline void syscall_set_arguments(struct task_struct *task,
121121 struct pt_regs *regs,
122− unsigned int i, unsigned int n,
123122 const unsigned long *args)
124123 {
125− unsigned int j;
124+ unsigned int i;
126125
127− for (j = 0; j < n; j++)
128− regs->u_regs[UREG_I0 + i + j] = args[j];
126+ for (i = 0; i < 6; i++)
127+ regs->u_regs[UREG_I0 + i] = args[i];
129128 }
130129
131130 static inline int syscall_get_arch(void)
arch/sparc/kernel/pci_sun4v.c+11−9
@@ -73,6 +73,11 @@ static inline void iommu_batch_start(struct device *dev, unsigned long prot, uns · 72 unmodified lines
7373 p->npages = 0;
7474 }
7575
76+static inline bool iommu_use_atu(struct iommu *iommu, u64 mask)
77+{
78+ return iommu->atu && mask > DMA_BIT_MASK(32);
79+}
80+
7681 /* Interrupts must be disabled. */
7782 static long iommu_batch_flush(struct iommu_batch *p, u64 mask)
7883 {
@@ -92,7 +97,7 @@ static long iommu_batch_flush(struct iommu_batch *p, u64 mask) · 13 unmodified lines
9297 prot &= (HV_PCI_MAP_ATTR_READ | HV_PCI_MAP_ATTR_WRITE);
9398
9499 while (npages != 0) {
95− if (mask <= DMA_BIT_MASK(32) || !pbm->iommu->atu) {
100+ if (!iommu_use_atu(pbm->iommu, mask)) {
96101 num = pci_sun4v_iommu_map(devhandle,
97102 HV_PCI_TSBID(0, entry),
98103 npages,
@@ -179,7 +184,6 @@ static void *dma_4v_alloc_coherent(struct device *dev, size_t size, · 80 unmodified lines
179184 unsigned long flags, order, first_page, npages, n;
180185 unsigned long prot = 0;
181186 struct iommu *iommu;
182− struct atu *atu;
183187 struct iommu_map_table *tbl;
184188 struct page *page;
185189 void *ret;
@@ -205,13 +209,11 @@ static void *dma_4v_alloc_coherent(struct device *dev, size_t size, · 19 unmodified lines
205209 memset((char *)first_page, 0, PAGE_SIZE << order);
206210
207211 iommu = dev->archdata.iommu;
208− atu = iommu->atu;
209−
210212 mask = dev->coherent_dma_mask;
211− if (mask <= DMA_BIT_MASK(32) || !atu)
213+ if (!iommu_use_atu(iommu, mask))
212214 tbl = &iommu->tbl;
213215 else
214− tbl = &atu->tbl;
216+ tbl = &iommu->atu->tbl;
215217
216218 entry = iommu_tbl_range_alloc(dev, tbl, npages, NULL,
217219 (unsigned long)(-1), 0);
@@ -333,7 +335,7 @@ static void dma_4v_free_coherent(struct device *dev, size_t size, void *cpu, · 115 unmodified lines
333335 atu = iommu->atu;
334336 devhandle = pbm->devhandle;
335337
336− if (dvma <= DMA_BIT_MASK(32)) {
338+ if (!iommu_use_atu(iommu, dvma)) {
337339 tbl = &iommu->tbl;
338340 iotsb_num = 0; /* we don't care for legacy iommu */
339341 } else {
@@ -374,7 +376,7 @@ static dma_addr_t dma_4v_map_page(struct device *dev, struct page *page, · 34 unmodified lines
374376 npages >>= IO_PAGE_SHIFT;
375377
376378 mask = *dev->dma_mask;
377− if (mask <= DMA_BIT_MASK(32))
379+ if (!iommu_use_atu(iommu, mask))
378380 tbl = &iommu->tbl;
379381 else
380382 tbl = &atu->tbl;
@@ -510,7 +512,7 @@ static int dma_4v_map_sg(struct device *dev, struct scatterlist *sglist, · 129 unmodified lines
510512 IO_PAGE_SIZE) >> IO_PAGE_SHIFT;
511513
512514 mask = *dev->dma_mask;
513− if (mask <= DMA_BIT_MASK(32))
515+ if (!iommu_use_atu(iommu, mask))
514516 tbl = &iommu->tbl;
515517 else
516518 tbl = &atu->tbl;
arch/um/include/asm/syscall-generic.h+12−66
@@ -53,84 +53,30 @@ static inline void syscall_set_return_value(struct task_struct *task, · 52 unmodified lines
5353
5454 static inline void syscall_get_arguments(struct task_struct *task,
5555 struct pt_regs *regs,
56− unsigned int i, unsigned int n,
5756 unsigned long *args)
5857 {
5958 const struct uml_pt_regs *r = &regs->regs;
6059
61− switch (i) {
62− case 0:
63− if (!n--)
64− break;
65− *args++ = UPT_SYSCALL_ARG1(r);
66− case 1:
67− if (!n--)
68− break;
69− *args++ = UPT_SYSCALL_ARG2(r);
70− case 2:
71− if (!n--)
72− break;
73− *args++ = UPT_SYSCALL_ARG3(r);
74− case 3:
75− if (!n--)
76− break;
77− *args++ = UPT_SYSCALL_ARG4(r);
78− case 4:
79− if (!n--)
80− break;
81− *args++ = UPT_SYSCALL_ARG5(r);
82− case 5:
83− if (!n--)
84− break;
85− *args++ = UPT_SYSCALL_ARG6(r);
86− case 6:
87− if (!n--)
88− break;
89− default:
90− BUG();
91− break;
92− }
60+ *args++ = UPT_SYSCALL_ARG1(r);
61+ *args++ = UPT_SYSCALL_ARG2(r);
62+ *args++ = UPT_SYSCALL_ARG3(r);
63+ *args++ = UPT_SYSCALL_ARG4(r);
64+ *args++ = UPT_SYSCALL_ARG5(r);
65+ *args = UPT_SYSCALL_ARG6(r);
9366 }
9467
9568 static inline void syscall_set_arguments(struct task_struct *task,
9669 struct pt_regs *regs,
97− unsigned int i, unsigned int n,
9870 const unsigned long *args)
9971 {
10072 struct uml_pt_regs *r = &regs->regs;
10173
102− switch (i) {
103− case 0:
104− if (!n--)
105− break;
106− UPT_SYSCALL_ARG1(r) = *args++;
107− case 1:
108− if (!n--)
109− break;
110− UPT_SYSCALL_ARG2(r) = *args++;
111− case 2:
112− if (!n--)
113− break;
114− UPT_SYSCALL_ARG3(r) = *args++;
115− case 3:
116− if (!n--)
117− break;
118− UPT_SYSCALL_ARG4(r) = *args++;
119− case 4:
120− if (!n--)
121− break;
122− UPT_SYSCALL_ARG5(r) = *args++;
123− case 5:
124− if (!n--)
125− break;
126− UPT_SYSCALL_ARG6(r) = *args++;
127− case 6:
128− if (!n--)
129− break;
130− default:
131− BUG();
132− break;
133− }
74+ UPT_SYSCALL_ARG1(r) = *args++;
75+ UPT_SYSCALL_ARG2(r) = *args++;
76+ UPT_SYSCALL_ARG3(r) = *args++;
77+ UPT_SYSCALL_ARG4(r) = *args++;
78+ UPT_SYSCALL_ARG5(r) = *args++;
79+ UPT_SYSCALL_ARG6(r) = *args;
13480 }
13581
13682 /* See arch/x86/um/asm/syscall.h for syscall_get_arch() definition. */
arch/x86/Kconfig+1−1
@@ -1499,7 +1499,7 @@ config X86_CPA_STATISTICS · 1498 unmodified lines
14991499 depends on DEBUG_FS
15001500 ---help---
15011501 Expose statistics about the Change Page Attribute mechanims, which
1502− helps to determine the effectivness of preserving large and huge
1502+ helps to determine the effectiveness of preserving large and huge
15031503 page mappings when mapping protections are changed.
15041504
15051505 config ARCH_HAS_MEM_ENCRYPT
arch/x86/crypto/poly1305-avx2-x86_64.S+10−4
@@ -323,6 +323,12 @@ ENTRY(poly1305_4block_avx2) · 322 unmodified lines
323323 vpaddq t2,t1,t1
324324 vmovq t1x,d4
325325
326+ # Now do a partial reduction mod (2^130)-5, carrying h0 -> h1 -> h2 ->
327+ # h3 -> h4 -> h0 -> h1 to get h0,h2,h3,h4 < 2^26 and h1 < 2^26 + a small
328+ # amount. Careful: we must not assume the carry bits 'd0 >> 26',
329+ # 'd1 >> 26', 'd2 >> 26', 'd3 >> 26', and '(d4 >> 26) * 5' fit in 32-bit
330+ # integers. It's true in a single-block implementation, but not here.
331+
326332 # d1 += d0 >> 26
327333 mov d0,%rax
328334 shr $26,%rax
@@ -361,16 +367,16 @@ ENTRY(poly1305_4block_avx2) · 32 unmodified lines
361367 # h0 += (d4 >> 26) * 5
362368 mov d4,%rax
363369 shr $26,%rax
364− lea (%eax,%eax,4),%eax
365− add %eax,%ebx
370+ lea (%rax,%rax,4),%rax
371+ add %rax,%rbx
366372 # h4 = d4 & 0x3ffffff
367373 mov d4,%rax
368374 and $0x3ffffff,%eax
369375 mov %eax,h4
370376
371377 # h1 += h0 >> 26
372− mov %ebx,%eax
373− shr $26,%eax
378+ mov %rbx,%rax
379+ shr $26,%rax
374380 add %eax,h1
375381 # h0 = h0 & 0x3ffffff
376382 andl $0x3ffffff,%ebx
arch/x86/crypto/poly1305-sse2-x86_64.S+14−8
@@ -253,16 +253,16 @@ ENTRY(poly1305_block_sse2) · 252 unmodified lines
253253 # h0 += (d4 >> 26) * 5
254254 mov d4,%rax
255255 shr $26,%rax
256− lea (%eax,%eax,4),%eax
257− add %eax,%ebx
256+ lea (%rax,%rax,4),%rax
257+ add %rax,%rbx
258258 # h4 = d4 & 0x3ffffff
259259 mov d4,%rax
260260 and $0x3ffffff,%eax
261261 mov %eax,h4
262262
263263 # h1 += h0 >> 26
264− mov %ebx,%eax
265− shr $26,%eax
264+ mov %rbx,%rax
265+ shr $26,%rax
266266 add %eax,h1
267267 # h0 = h0 & 0x3ffffff
268268 andl $0x3ffffff,%ebx
@@ -524,6 +524,12 @@ ENTRY(poly1305_2block_sse2) · 255 unmodified lines
524524 paddq t2,t1
525525 movq t1,d4
526526
527+ # Now do a partial reduction mod (2^130)-5, carrying h0 -> h1 -> h2 ->
528+ # h3 -> h4 -> h0 -> h1 to get h0,h2,h3,h4 < 2^26 and h1 < 2^26 + a small
529+ # amount. Careful: we must not assume the carry bits 'd0 >> 26',
530+ # 'd1 >> 26', 'd2 >> 26', 'd3 >> 26', and '(d4 >> 26) * 5' fit in 32-bit
531+ # integers. It's true in a single-block implementation, but not here.
532+
527533 # d1 += d0 >> 26
528534 mov d0,%rax
529535 shr $26,%rax
@@ -562,16 +568,16 @@ ENTRY(poly1305_2block_sse2) · 32 unmodified lines
562568 # h0 += (d4 >> 26) * 5
563569 mov d4,%rax
564570 shr $26,%rax
565− lea (%eax,%eax,4),%eax
566− add %eax,%ebx
571+ lea (%rax,%rax,4),%rax
572+ add %rax,%rbx
567573 # h4 = d4 & 0x3ffffff
568574 mov d4,%rax
569575 and $0x3ffffff,%eax
570576 mov %eax,h4
571577
572578 # h1 += h0 >> 26
573− mov %ebx,%eax
574− shr $26,%eax
579+ mov %rbx,%rax
580+ shr $26,%rax
575581 add %eax,h1
576582 # h0 = h0 & 0x3ffffff
577583 andl $0x3ffffff,%ebx
arch/x86/events/amd/core.c+161−14
@@ -3,10 +3,14 @@ · 2 unmodified lines
33 #include <linux/types.h>
44 #include <linux/init.h>
55 #include <linux/slab.h>
6+#include <linux/delay.h>
67 #include <asm/apicdef.h>
8+#include <asm/nmi.h>
79
810 #include "../perf_event.h"
911
12+static DEFINE_PER_CPU(unsigned int, perf_nmi_counter);
13+
1014 static __initconst const u64 amd_hw_cache_event_ids
1115 [PERF_COUNT_HW_CACHE_MAX]
1216 [PERF_COUNT_HW_CACHE_OP_MAX]
@@ -113,22 +117,39 @@ static __initconst const u64 amd_hw_cache_event_ids · 100 unmodified lines
113117 };
114118
115119 /*
116− * AMD Performance Monitor K7 and later.
120+ * AMD Performance Monitor K7 and later, up to and including Family 16h:
117121 */
118122 static const u64 amd_perfmon_event_map[PERF_COUNT_HW_MAX] =
119123 {
120− [PERF_COUNT_HW_CPU_CYCLES] = 0x0076,
121− [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0,
122− [PERF_COUNT_HW_CACHE_REFERENCES] = 0x077d,
123− [PERF_COUNT_HW_CACHE_MISSES] = 0x077e,
124− [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c2,
125− [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c3,
126− [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x00d0, /* "Decoder empty" event */
127− [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = 0x00d1, /* "Dispatch stalls" event */
124+ [PERF_COUNT_HW_CPU_CYCLES] = 0x0076,
125+ [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0,
126+ [PERF_COUNT_HW_CACHE_REFERENCES] = 0x077d,
127+ [PERF_COUNT_HW_CACHE_MISSES] = 0x077e,
128+ [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c2,
129+ [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c3,
130+ [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x00d0, /* "Decoder empty" event */
131+ [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = 0x00d1, /* "Dispatch stalls" event */
132+};
133+
134+/*
135+ * AMD Performance Monitor Family 17h and later:
136+ */
137+static const u64 amd_f17h_perfmon_event_map[PERF_COUNT_HW_MAX] =
138+{
139+ [PERF_COUNT_HW_CPU_CYCLES] = 0x0076,
140+ [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0,
141+ [PERF_COUNT_HW_CACHE_REFERENCES] = 0xff60,
142+ [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c2,
143+ [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c3,
144+ [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x0287,
145+ [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = 0x0187,
128146 };
129147
130148 static u64 amd_pmu_event_map(int hw_event)
131149 {
150+ if (boot_cpu_data.x86 >= 0x17)
151+ return amd_f17h_perfmon_event_map[hw_event];
152+
132153 return amd_perfmon_event_map[hw_event];
133154 }
134155
@@ -429,6 +450,132 @@ static void amd_pmu_cpu_dead(int cpu) · 294 unmodified lines
429450 }
430451 }
431452
453+/*
454+ * When a PMC counter overflows, an NMI is used to process the event and
455+ * reset the counter. NMI latency can result in the counter being updated
456+ * before the NMI can run, which can result in what appear to be spurious
457+ * NMIs. This function is intended to wait for the NMI to run and reset
458+ * the counter to avoid possible unhandled NMI messages.
459+ */
460+#define OVERFLOW_WAIT_COUNT 50
461+
462+static void amd_pmu_wait_on_overflow(int idx)
463+{
464+ unsigned int i;
465+ u64 counter;
466+
467+ /*
468+ * Wait for the counter to be reset if it has overflowed. This loop
469+ * should exit very, very quickly, but just in case, don't wait
470+ * forever...
471+ */
472+ for (i = 0; i < OVERFLOW_WAIT_COUNT; i++) {
473+ rdmsrl(x86_pmu_event_addr(idx), counter);
474+ if (counter & (1ULL << (x86_pmu.cntval_bits - 1)))
475+ break;
476+
477+ /* Might be in IRQ context, so can't sleep */
478+ udelay(1);
479+ }
480+}
481+
482+static void amd_pmu_disable_all(void)
483+{
484+ struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
485+ int idx;
486+
487+ x86_pmu_disable_all();
488+
489+ /*
490+ * This shouldn't be called from NMI context, but add a safeguard here
491+ * to return, since if we're in NMI context we can't wait for an NMI
492+ * to reset an overflowed counter value.
493+ */
494+ if (in_nmi())
495+ return;
496+
497+ /*
498+ * Check each counter for overflow and wait for it to be reset by the
499+ * NMI if it has overflowed. This relies on the fact that all active
500+ * counters are always enabled when this function is caled and
501+ * ARCH_PERFMON_EVENTSEL_INT is always set.
502+ */
503+ for (idx = 0; idx < x86_pmu.num_counters; idx++) {
504+ if (!test_bit(idx, cpuc->active_mask))
505+ continue;
506+
507+ amd_pmu_wait_on_overflow(idx);
508+ }
509+}
510+
511+static void amd_pmu_disable_event(struct perf_event *event)
512+{
513+ x86_pmu_disable_event(event);
514+
515+ /*
516+ * This can be called from NMI context (via x86_pmu_stop). The counter
517+ * may have overflowed, but either way, we'll never see it get reset
518+ * by the NMI if we're already in the NMI. And the NMI latency support
519+ * below will take care of any pending NMI that might have been
520+ * generated by the overflow.
521+ */
522+ if (in_nmi())
523+ return;
524+
525+ amd_pmu_wait_on_overflow(event->hw.idx);
526+}
527+
528+/*
529+ * Because of NMI latency, if multiple PMC counters are active or other sources
530+ * of NMIs are received, the perf NMI handler can handle one or more overflowed
531+ * PMC counters outside of the NMI associated with the PMC overflow. If the NMI
532+ * doesn't arrive at the LAPIC in time to become a pending NMI, then the kernel
533+ * back-to-back NMI support won't be active. This PMC handler needs to take into
534+ * account that this can occur, otherwise this could result in unknown NMI
535+ * messages being issued. Examples of this is PMC overflow while in the NMI
536+ * handler when multiple PMCs are active or PMC overflow while handling some
537+ * other source of an NMI.
538+ *
539+ * Attempt to mitigate this by using the number of active PMCs to determine
540+ * whether to return NMI_HANDLED if the perf NMI handler did not handle/reset
541+ * any PMCs. The per-CPU perf_nmi_counter variable is set to a minimum of the
542+ * number of active PMCs or 2. The value of 2 is used in case an NMI does not
543+ * arrive at the LAPIC in time to be collapsed into an already pending NMI.
544+ */
545+static int amd_pmu_handle_irq(struct pt_regs *regs)
546+{
547+ struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
548+ int active, handled;
549+
550+ /*
551+ * Obtain the active count before calling x86_pmu_handle_irq() since
552+ * it is possible that x86_pmu_handle_irq() may make a counter
553+ * inactive (through x86_pmu_stop).
554+ */
555+ active = __bitmap_weight(cpuc->active_mask, X86_PMC_IDX_MAX);
556+
557+ /* Process any counter overflows */
558+ handled = x86_pmu_handle_irq(regs);
559+
560+ /*
561+ * If a counter was handled, record the number of possible remaining
562+ * NMIs that can occur.
563+ */
564+ if (handled) {
565+ this_cpu_write(perf_nmi_counter,
566+ min_t(unsigned int, 2, active));
567+
568+ return handled;
569+ }
570+
571+ if (!this_cpu_read(perf_nmi_counter))
572+ return NMI_DONE;
573+
574+ this_cpu_dec(perf_nmi_counter);
575+
576+ return NMI_HANDLED;
577+}
578+
432579 static struct event_constraint *
433580 amd_get_event_constraints(struct cpu_hw_events *cpuc, int idx,
434581 struct perf_event *event)
@@ -621,11 +768,11 @@ static ssize_t amd_event_sysfs_show(char *page, u64 config) · 186 unmodified lines
621768
622769 static __initconst const struct x86_pmu amd_pmu = {
623770 .name = "AMD",
624− .handle_irq = x86_pmu_handle_irq,
625− .disable_all = x86_pmu_disable_all,
771+ .handle_irq = amd_pmu_handle_irq,
772+ .disable_all = amd_pmu_disable_all,
626773 .enable_all = x86_pmu_enable_all,
627774 .enable = x86_pmu_enable_event,
628− .disable = x86_pmu_disable_event,
775+ .disable = amd_pmu_disable_event,
629776 .hw_config = amd_pmu_hw_config,
630777 .schedule_events = x86_schedule_events,
631778 .eventsel = MSR_K7_EVNTSEL0,
@@ -732,7 +879,7 @@ void amd_pmu_enable_virt(void) · 100 unmodified lines
732879 cpuc->perf_ctr_virt_mask = 0;
733880
734881 /* Reload all events */
735− x86_pmu_disable_all();
882+ amd_pmu_disable_all();
736883 x86_pmu_enable_all(0);
737884 }
738885 EXPORT_SYMBOL_GPL(amd_pmu_enable_virt);
@@ -750,7 +897,7 @@ void amd_pmu_disable_virt(void) · 11 unmodified lines
750897 cpuc->perf_ctr_virt_mask = AMD64_EVENTSEL_HOSTONLY;
751898
752899 /* Reload all events */
753− x86_pmu_disable_all();
900+ amd_pmu_disable_all();
754901 x86_pmu_enable_all(0);
755902 }
756903 EXPORT_SYMBOL_GPL(amd_pmu_disable_virt);
arch/x86/events/core.c+3−10
@@ -1349,8 +1349,9 @@ void x86_pmu_stop(struct perf_event *event, int flags) · 1348 unmodified lines
13491349 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
13501350 struct hw_perf_event *hwc = &event->hw;
13511351
1352− if (__test_and_clear_bit(hwc->idx, cpuc->active_mask)) {
1352+ if (test_bit(hwc->idx, cpuc->active_mask)) {
13531353 x86_pmu.disable(event);
1354+ __clear_bit(hwc->idx, cpuc->active_mask);
13541355 cpuc->events[hwc->idx] = NULL;
13551356 WARN_ON_ONCE(hwc->state & PERF_HES_STOPPED);
13561357 hwc->state |= PERF_HES_STOPPED;
@@ -1447,16 +1448,8 @@ int x86_pmu_handle_irq(struct pt_regs *regs) · 90 unmodified lines
14471448 apic_write(APIC_LVTPC, APIC_DM_NMI);
14481449
14491450 for (idx = 0; idx < x86_pmu.num_counters; idx++) {
1450− if (!test_bit(idx, cpuc->active_mask)) {
1451− /*
1452− * Though we deactivated the counter some cpus
1453− * might still deliver spurious interrupts still
1454− * in flight. Catch them:
1455− */
1456− if (__test_and_clear_bit(idx, cpuc->running))
1457− handled++;
1451+ if (!test_bit(idx, cpuc->active_mask))
14581452 continue;
1459− }
14601453
14611454 event = cpuc->events[idx];
14621455
arch/x86/events/intel/core.c+8−2
@@ -3131,7 +3131,7 @@ static unsigned long intel_pmu_large_pebs_flags(struct perf_event *event) · 3130 unmodified lines
31313131 flags &= ~PERF_SAMPLE_TIME;
31323132 if (!event->attr.exclude_kernel)
31333133 flags &= ~PERF_SAMPLE_REGS_USER;
3134− if (event->attr.sample_regs_user & ~PEBS_REGS)
3134+ if (event->attr.sample_regs_user & ~PEBS_GP_REGS)
31353135 flags &= ~(PERF_SAMPLE_REGS_USER | PERF_SAMPLE_REGS_INTR);
31363136 return flags;
31373137 }
@@ -3185,7 +3185,7 @@ static int intel_pmu_hw_config(struct perf_event *event) · 47 unmodified lines
31853185 return ret;
31863186
31873187 if (event->attr.precise_ip) {
3188− if (!event->attr.freq) {
3188+ if (!(event->attr.freq || event->attr.wakeup_events)) {
31893189 event->hw.flags |= PERF_X86_EVENT_AUTO_RELOAD;
31903190 if (!(event->attr.sample_type &
31913191 ~intel_pmu_large_pebs_flags(event)))
@@ -3575,6 +3575,12 @@ static void intel_pmu_cpu_starting(int cpu) · 383 unmodified lines
35753575
35763576 cpuc->lbr_sel = NULL;
35773577
3578+ if (x86_pmu.flags & PMU_FL_TFA) {
3579+ WARN_ON_ONCE(cpuc->tfa_shadow);
3580+ cpuc->tfa_shadow = ~0ULL;
3581+ intel_set_tfa(cpuc, false);
3582+ }
3583+
35783584 if (x86_pmu.version > 1)
35793585 flip_smm_bit(&x86_pmu.attr_freeze_on_smi);
35803586
arch/x86/events/perf_event.h+19−19
@@ -96,25 +96,25 @@ struct amd_nb { · 95 unmodified lines
9696 PERF_SAMPLE_REGS_INTR | PERF_SAMPLE_REGS_USER | \
9797 PERF_SAMPLE_PERIOD)
9898
99−#define PEBS_REGS \
100− (PERF_REG_X86_AX | \
101− PERF_REG_X86_BX | \
102− PERF_REG_X86_CX | \
103− PERF_REG_X86_DX | \
104− PERF_REG_X86_DI | \
105− PERF_REG_X86_SI | \
106− PERF_REG_X86_SP | \
107− PERF_REG_X86_BP | \
108− PERF_REG_X86_IP | \
109− PERF_REG_X86_FLAGS | \
110− PERF_REG_X86_R8 | \
111− PERF_REG_X86_R9 | \
112− PERF_REG_X86_R10 | \
113− PERF_REG_X86_R11 | \
114− PERF_REG_X86_R12 | \
115− PERF_REG_X86_R13 | \
116− PERF_REG_X86_R14 | \
117− PERF_REG_X86_R15)
99+#define PEBS_GP_REGS \
100+ ((1ULL << PERF_REG_X86_AX) | \
101+ (1ULL << PERF_REG_X86_BX) | \
102+ (1ULL << PERF_REG_X86_CX) | \
103+ (1ULL << PERF_REG_X86_DX) | \
104+ (1ULL << PERF_REG_X86_DI) | \
105+ (1ULL << PERF_REG_X86_SI) | \
106+ (1ULL << PERF_REG_X86_SP) | \
107+ (1ULL << PERF_REG_X86_BP) | \
108+ (1ULL << PERF_REG_X86_IP) | \
109+ (1ULL << PERF_REG_X86_FLAGS) | \
110+ (1ULL << PERF_REG_X86_R8) | \
111+ (1ULL << PERF_REG_X86_R9) | \
112+ (1ULL << PERF_REG_X86_R10) | \
113+ (1ULL << PERF_REG_X86_R11) | \
114+ (1ULL << PERF_REG_X86_R12) | \
115+ (1ULL << PERF_REG_X86_R13) | \
116+ (1ULL << PERF_REG_X86_R14) | \
117+ (1ULL << PERF_REG_X86_R15))
118118
119119 /*
120120 * Per register state.
arch/x86/include/asm/bitops.h+18−23
@@ -36,16 +36,17 @@ · 35 unmodified lines
3636 * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1).
3737 */
3838
39−#define BITOP_ADDR(x) "+m" (*(volatile long *) (x))
39+#define RLONG_ADDR(x) "m" (*(volatile long *) (x))
40+#define WBYTE_ADDR(x) "+m" (*(volatile char *) (x))
4041
41−#define ADDR BITOP_ADDR(addr)
42+#define ADDR RLONG_ADDR(addr)
4243
4344 /*
4445 * We do the locked ops that don't return the old value as
4546 * a mask operation on a byte.
4647 */
4748 #define IS_IMMEDIATE(nr) (__builtin_constant_p(nr))
48−#define CONST_MASK_ADDR(nr, addr) BITOP_ADDR((void *)(addr) + ((nr)>>3))
49+#define CONST_MASK_ADDR(nr, addr) WBYTE_ADDR((void *)(addr) + ((nr)>>3))
4950 #define CONST_MASK(nr) (1 << ((nr) & 7))
5051
5152 /**
@@ -73,7 +74,7 @@ set_bit(long nr, volatile unsigned long *addr) · 21 unmodified lines
7374 : "memory");
7475 } else {
7576 asm volatile(LOCK_PREFIX __ASM_SIZE(bts) " %1,%0"
76− : BITOP_ADDR(addr) : "Ir" (nr) : "memory");
77+ : : RLONG_ADDR(addr), "Ir" (nr) : "memory");
7778 }
7879 }
7980
@@ -88,7 +89,7 @@ set_bit(long nr, volatile unsigned long *addr) · 8 unmodified lines
8889 */
8990 static __always_inline void __set_bit(long nr, volatile unsigned long *addr)
9091 {
91− asm volatile(__ASM_SIZE(bts) " %1,%0" : ADDR : "Ir" (nr) : "memory");
92+ asm volatile(__ASM_SIZE(bts) " %1,%0" : : ADDR, "Ir" (nr) : "memory");
9293 }
9394
9495 /**
@@ -110,8 +111,7 @@ clear_bit(long nr, volatile unsigned long *addr) · 15 unmodified lines
110111 : "iq" ((u8)~CONST_MASK(nr)));
111112 } else {
112113 asm volatile(LOCK_PREFIX __ASM_SIZE(btr) " %1,%0"
113− : BITOP_ADDR(addr)
114− : "Ir" (nr));
114+ : : RLONG_ADDR(addr), "Ir" (nr) : "memory");
115115 }
116116 }
117117
@@ -131,7 +131,7 @@ static __always_inline void clear_bit_unlock(long nr, volatile unsigned long *ad · 13 unmodified lines
131131
132132 static __always_inline void __clear_bit(long nr, volatile unsigned long *addr)
133133 {
134− asm volatile(__ASM_SIZE(btr) " %1,%0" : ADDR : "Ir" (nr));
134+ asm volatile(__ASM_SIZE(btr) " %1,%0" : : ADDR, "Ir" (nr) : "memory");
135135 }
136136
137137 static __always_inline bool clear_bit_unlock_is_negative_byte(long nr, volatile unsigned long *addr)
@@ -139,7 +139,7 @@ static __always_inline bool clear_bit_unlock_is_negative_byte(long nr, volatile · 1 unmodified line
139139 bool negative;
140140 asm volatile(LOCK_PREFIX "andb %2,%1"
141141 CC_SET(s)
142− : CC_OUT(s) (negative), ADDR
142+ : CC_OUT(s) (negative), WBYTE_ADDR(addr)
143143 : "ir" ((char) ~(1 << nr)) : "memory");
144144 return negative;
145145 }
@@ -155,13 +155,9 @@ static __always_inline bool clear_bit_unlock_is_negative_byte(long nr, volatile · 9 unmodified lines
155155 * __clear_bit() is non-atomic and implies release semantics before the memory
156156 * operation. It can be used for an unlock if no other CPUs can concurrently
157157 * modify other bits in the word.
158− *
159− * No memory barrier is required here, because x86 cannot reorder stores past
160− * older loads. Same principle as spin_unlock.
161158 */
162159 static __always_inline void __clear_bit_unlock(long nr, volatile unsigned long *addr)
163160 {
164− barrier();
165161 __clear_bit(nr, addr);
166162 }
167163
@@ -176,7 +172,7 @@ static __always_inline void __clear_bit_unlock(long nr, volatile unsigned long * · 8 unmodified lines
176172 */
177173 static __always_inline void __change_bit(long nr, volatile unsigned long *addr)
178174 {
179− asm volatile(__ASM_SIZE(btc) " %1,%0" : ADDR : "Ir" (nr));
175+ asm volatile(__ASM_SIZE(btc) " %1,%0" : : ADDR, "Ir" (nr) : "memory");
180176 }
181177
182178 /**
@@ -196,8 +192,7 @@ static __always_inline void change_bit(long nr, volatile unsigned long *addr) · 13 unmodified lines
196192 : "iq" ((u8)CONST_MASK(nr)));
197193 } else {
198194 asm volatile(LOCK_PREFIX __ASM_SIZE(btc) " %1,%0"
199− : BITOP_ADDR(addr)
200− : "Ir" (nr));
195+ : : RLONG_ADDR(addr), "Ir" (nr) : "memory");
201196 }
202197 }
203198
@@ -242,8 +237,8 @@ static __always_inline bool __test_and_set_bit(long nr, volatile unsigned long * · 38 unmodified lines
242237
243238 asm(__ASM_SIZE(bts) " %2,%1"
244239 CC_SET(c)
245− : CC_OUT(c) (oldbit), ADDR
246− : "Ir" (nr));
240+ : CC_OUT(c) (oldbit)
241+ : ADDR, "Ir" (nr) : "memory");
247242 return oldbit;
248243 }
249244
@@ -282,8 +277,8 @@ static __always_inline bool __test_and_clear_bit(long nr, volatile unsigned long · 32 unmodified lines
282277
283278 asm volatile(__ASM_SIZE(btr) " %2,%1"
284279 CC_SET(c)
285− : CC_OUT(c) (oldbit), ADDR
286− : "Ir" (nr));
280+ : CC_OUT(c) (oldbit)
281+ : ADDR, "Ir" (nr) : "memory");
287282 return oldbit;
288283 }
289284
@@ -294,8 +289,8 @@ static __always_inline bool __test_and_change_bit(long nr, volatile unsigned lon · 4 unmodified lines
294289
295290 asm volatile(__ASM_SIZE(btc) " %2,%1"
296291 CC_SET(c)
297− : CC_OUT(c) (oldbit), ADDR
298− : "Ir" (nr) : "memory");
292+ : CC_OUT(c) (oldbit)
293+ : ADDR, "Ir" (nr) : "memory");
299294
300295 return oldbit;
301296 }
@@ -326,7 +321,7 @@ static __always_inline bool variable_test_bit(long nr, volatile const unsigned l · 24 unmodified lines
326321 asm volatile(__ASM_SIZE(bt) " %2,%1"
327322 CC_SET(c)
328323 : CC_OUT(c) (oldbit)
329− : "m" (*(unsigned long *)addr), "Ir" (nr));
324+ : "m" (*(unsigned long *)addr), "Ir" (nr) : "memory");
330325
331326 return oldbit;
332327 }
arch/x86/include/asm/kvm_emulate.h+3−1
@@ -226,7 +226,9 @@ struct x86_emulate_ops { · 225 unmodified lines
226226
227227 unsigned (*get_hflags)(struct x86_emulate_ctxt *ctxt);
228228 void (*set_hflags)(struct x86_emulate_ctxt *ctxt, unsigned hflags);
229− int (*pre_leave_smm)(struct x86_emulate_ctxt *ctxt, u64 smbase);
229+ int (*pre_leave_smm)(struct x86_emulate_ctxt *ctxt,
230+ const char *smstate);
231+ void (*post_leave_smm)(struct x86_emulate_ctxt *ctxt);
230232
231233 };
232234
arch/x86/include/asm/kvm_host.h+10−7
@@ -126,7 +126,7 @@ static inline gfn_t gfn_to_index(gfn_t gfn, gfn_t base_gfn, int level) · 125 unmodified lines
126126 }
127127
128128 #define KVM_PERMILLE_MMU_PAGES 20
129−#define KVM_MIN_ALLOC_MMU_PAGES 64
129+#define KVM_MIN_ALLOC_MMU_PAGES 64UL
130130 #define KVM_MMU_HASH_SHIFT 12
131131 #define KVM_NUM_MMU_PAGES (1 << KVM_MMU_HASH_SHIFT)
132132 #define KVM_MIN_FREE_MMU_PAGES 5
@@ -844,9 +844,9 @@ enum kvm_irqchip_mode { · 711 unmodified lines
844844 };
845845
846846 struct kvm_arch {
847− unsigned int n_used_mmu_pages;
848− unsigned int n_requested_mmu_pages;
849− unsigned int n_max_mmu_pages;
847+ unsigned long n_used_mmu_pages;
848+ unsigned long n_requested_mmu_pages;
849+ unsigned long n_max_mmu_pages;
850850 unsigned int indirect_shadow_pages;
851851 struct hlist_head mmu_page_hash[KVM_NUM_MMU_PAGES];
852852 /*
@@ -1182,7 +1182,7 @@ struct kvm_x86_ops { · 329 unmodified lines
11821182
11831183 int (*smi_allowed)(struct kvm_vcpu *vcpu);
11841184 int (*pre_enter_smm)(struct kvm_vcpu *vcpu, char *smstate);
1185− int (*pre_leave_smm)(struct kvm_vcpu *vcpu, u64 smbase);
1185+ int (*pre_leave_smm)(struct kvm_vcpu *vcpu, const char *smstate);
11861186 int (*enable_smi_window)(struct kvm_vcpu *vcpu);
11871187
11881188 int (*mem_enc_op)(struct kvm *kvm, void __user *argp);
@@ -1256,8 +1256,8 @@ void kvm_mmu_clear_dirty_pt_masked(struct kvm *kvm, · 67 unmodified lines
12561256 gfn_t gfn_offset, unsigned long mask);
12571257 void kvm_mmu_zap_all(struct kvm *kvm);
12581258 void kvm_mmu_invalidate_mmio_sptes(struct kvm *kvm, u64 gen);
1259−unsigned int kvm_mmu_calculate_default_mmu_pages(struct kvm *kvm);
1260−void kvm_mmu_change_mmu_pages(struct kvm *kvm, unsigned int kvm_nr_mmu_pages);
1259+unsigned long kvm_mmu_calculate_default_mmu_pages(struct kvm *kvm);
1260+void kvm_mmu_change_mmu_pages(struct kvm *kvm, unsigned long kvm_nr_mmu_pages);
12611261
12621262 int load_pdptrs(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, unsigned long cr3);
12631263 bool pdptrs_changed(struct kvm_vcpu *vcpu);
@@ -1592,4 +1592,7 @@ static inline int kvm_cpu_get_apicid(int mps_cpu) · 328 unmodified lines
15921592 #define put_smstate(type, buf, offset, val) \
15931593 *(type *)((buf) + (offset) - 0x7e00) = val
15941594
1595+#define GET_SMSTATE(type, buf, offset) \
1596+ (*(type *)((buf) + (offset) - 0x7e00))
1597+
15951598 #endif /* _ASM_X86_KVM_HOST_H */
arch/x86/include/asm/syscall.h+33−109
@@ -91,11 +91,9 @@ static inline void syscall_set_return_value(struct task_struct *task, · 90 unmodified lines
9191
9292 static inline void syscall_get_arguments(struct task_struct *task,
9393 struct pt_regs *regs,
94− unsigned int i, unsigned int n,
9594 unsigned long *args)
9695 {
97− BUG_ON(i + n > 6);
98− memcpy(args, &regs->bx + i, n * sizeof(args[0]));
96+ memcpy(args, &regs->bx, 6 * sizeof(args[0]));
9997 }
10098
10199 static inline void syscall_set_arguments(struct task_struct *task,
@@ -116,124 +114,50 @@ static inline int syscall_get_arch(void) · 14 unmodified lines
116114
117115 static inline void syscall_get_arguments(struct task_struct *task,
118116 struct pt_regs *regs,
119− unsigned int i, unsigned int n,
120117 unsigned long *args)
121118 {
122119 # ifdef CONFIG_IA32_EMULATION
123− if (task->thread_info.status & TS_COMPAT)
124− switch (i) {
125− case 0:
126− if (!n--) break;
127− *args++ = regs->bx;
128− case 1:
129− if (!n--) break;
130− *args++ = regs->cx;
131− case 2:
132− if (!n--) break;
133− *args++ = regs->dx;
134− case 3:
135− if (!n--) break;
136− *args++ = regs->si;
137− case 4:
138− if (!n--) break;
139− *args++ = regs->di;
140− case 5:
141− if (!n--) break;
142− *args++ = regs->bp;
143− case 6:
144− if (!n--) break;
145− default:
146− BUG();
147− break;
148− }
149− else
120+ if (task->thread_info.status & TS_COMPAT) {
121+ *args++ = regs->bx;
122+ *args++ = regs->cx;
123+ *args++ = regs->dx;
124+ *args++ = regs->si;
125+ *args++ = regs->di;
126+ *args = regs->bp;
127+ } else
150128 # endif
151− switch (i) {
152− case 0:
153− if (!n--) break;
154− *args++ = regs->di;
155− case 1:
156− if (!n--) break;
157− *args++ = regs->si;
158− case 2:
159− if (!n--) break;
160− *args++ = regs->dx;
161− case 3:
162− if (!n--) break;
163− *args++ = regs->r10;
164− case 4:
165− if (!n--) break;
166− *args++ = regs->r8;
167− case 5:
168− if (!n--) break;
169− *args++ = regs->r9;
170− case 6:
171− if (!n--) break;
172− default:
173− BUG();
174− break;
175− }
129+ {
130+ *args++ = regs->di;
131+ *args++ = regs->si;
132+ *args++ = regs->dx;
133+ *args++ = regs->r10;
134+ *args++ = regs->r8;
135+ *args = regs->r9;
136+ }
176137 }
177138
178139 static inline void syscall_set_arguments(struct task_struct *task,
179140 struct pt_regs *regs,
180− unsigned int i, unsigned int n,
181141 const unsigned long *args)
182142 {
183143 # ifdef CONFIG_IA32_EMULATION
184− if (task->thread_info.status & TS_COMPAT)
185− switch (i) {
186− case 0:
187− if (!n--) break;
188− regs->bx = *args++;
189− case 1:
190− if (!n--) break;
191− regs->cx = *args++;
192− case 2:
193− if (!n--) break;
194− regs->dx = *args++;
195− case 3:
196− if (!n--) break;
197− regs->si = *args++;
198− case 4:
199− if (!n--) break;
200− regs->di = *args++;
201− case 5:
202− if (!n--) break;
203− regs->bp = *args++;
204− case 6:
205− if (!n--) break;
206− default:
207− BUG();
208− break;
209− }
210− else
144+ if (task->thread_info.status & TS_COMPAT) {
145+ regs->bx = *args++;
146+ regs->cx = *args++;
147+ regs->dx = *args++;
148+ regs->si = *args++;
149+ regs->di = *args++;
150+ regs->bp = *args;
151+ } else
211152 # endif
212− switch (i) {
213− case 0:
214− if (!n--) break;
215− regs->di = *args++;
216− case 1:
217− if (!n--) break;
218− regs->si = *args++;
219− case 2:
220− if (!n--) break;
221− regs->dx = *args++;
222− case 3:
223− if (!n--) break;
224− regs->r10 = *args++;
225− case 4:
226− if (!n--) break;
227− regs->r8 = *args++;
228− case 5:
229− if (!n--) break;
230− regs->r9 = *args++;
231− case 6:
232− if (!n--) break;
233− default:
234− BUG();
235− break;
236− }
153+ {
154+ regs->di = *args++;
155+ regs->si = *args++;
156+ regs->dx = *args++;
157+ regs->r10 = *args++;
158+ regs->r8 = *args++;
159+ regs->r9 = *args;
160+ }
237161 }
238162
239163 static inline int syscall_get_arch(void)
arch/x86/include/asm/xen/hypercall.h+3−0
@@ -206,6 +206,9 @@ xen_single_call(unsigned int call, · 205 unmodified lines
206206 __HYPERCALL_DECLS;
207207 __HYPERCALL_5ARG(a1, a2, a3, a4, a5);
208208
209+ if (call >= PAGE_SIZE / sizeof(hypercall_page[0]))
210+ return -EINVAL;
211+
209212 asm volatile(CALL_NOSPEC
210213 : __HYPERCALL_5PARAM
211214 : [thunk_target] "a" (&hypercall_page[call])
arch/x86/include/uapi/asm/vmx.h+1−0
@@ -146,6 +146,7 @@ · 145 unmodified lines
146146
147147 #define VMX_ABORT_SAVE_GUEST_MSR_FAIL 1
148148 #define VMX_ABORT_LOAD_HOST_PDPTE_FAIL 2
149+#define VMX_ABORT_VMCS_CORRUPTED 3
149150 #define VMX_ABORT_LOAD_HOST_MSR_FAIL 4
150151
151152 #endif /* _UAPIVMX_H */
arch/x86/kernel/cpu/bugs.c+3−3
@@ -275,7 +275,7 @@ static const struct { · 274 unmodified lines
275275 const char *option;
276276 enum spectre_v2_user_cmd cmd;
277277 bool secure;
278−} v2_user_options[] __initdata = {
278+} v2_user_options[] __initconst = {
279279 { "auto", SPECTRE_V2_USER_CMD_AUTO, false },
280280 { "off", SPECTRE_V2_USER_CMD_NONE, false },
281281 { "on", SPECTRE_V2_USER_CMD_FORCE, true },
@@ -419,7 +419,7 @@ static const struct { · 137 unmodified lines
419419 const char *option;
420420 enum spectre_v2_mitigation_cmd cmd;
421421 bool secure;
422−} mitigation_options[] __initdata = {
422+} mitigation_options[] __initconst = {
423423 { "off", SPECTRE_V2_CMD_NONE, false },
424424 { "on", SPECTRE_V2_CMD_FORCE, true },
425425 { "retpoline", SPECTRE_V2_CMD_RETPOLINE, false },
@@ -658,7 +658,7 @@ static const char * const ssb_strings[] = { · 232 unmodified lines
658658 static const struct {
659659 const char *option;
660660 enum ssb_mitigation_cmd cmd;
661−} ssb_mitigation_options[] __initdata = {
661+} ssb_mitigation_options[] __initconst = {
662662 { "auto", SPEC_STORE_BYPASS_CMD_AUTO }, /* Platform decides */
663663 { "on", SPEC_STORE_BYPASS_CMD_ON }, /* Disable Speculative Store Bypass */
664664 { "off", SPEC_STORE_BYPASS_CMD_NONE }, /* Don't touch Speculative Store Bypass */
arch/x86/kernel/cpu/intel.c+2−2
@@ -611,8 +611,8 @@ static void init_intel_energy_perf(struct cpuinfo_x86 *c) · 610 unmodified lines
611611 if ((epb & 0xF) != ENERGY_PERF_BIAS_PERFORMANCE)
612612 return;
613613
614− pr_warn_once("ENERGY_PERF_BIAS: Set to 'normal', was 'performance'\n");
615− pr_warn_once("ENERGY_PERF_BIAS: View and update with x86_energy_perf_policy(8)\n");
614+ pr_info_once("ENERGY_PERF_BIAS: Set to 'normal', was 'performance'\n");
615+ pr_info_once("ENERGY_PERF_BIAS: View and update with x86_energy_perf_policy(8)\n");
616616 epb = (epb & ~0xF) | ENERGY_PERF_BIAS_NORMAL;
617617 wrmsrl(MSR_IA32_ENERGY_PERF_BIAS, epb);
618618 }
arch/x86/kernel/cpu/resctrl/rdtgroup.c+5−4
@@ -2039,14 +2039,14 @@ out: · 2038 unmodified lines
20392039 enum rdt_param {
20402040 Opt_cdp,
20412041 Opt_cdpl2,
2042− Opt_mba_mpbs,
2042+ Opt_mba_mbps,
20432043 nr__rdt_params
20442044 };
20452045
20462046 static const struct fs_parameter_spec rdt_param_specs[] = {
20472047 fsparam_flag("cdp", Opt_cdp),
20482048 fsparam_flag("cdpl2", Opt_cdpl2),
2049− fsparam_flag("mba_mpbs", Opt_mba_mpbs),
2049+ fsparam_flag("mba_MBps", Opt_mba_mbps),
20502050 {}
20512051 };
20522052
@@ -2072,7 +2072,7 @@ static int rdt_parse_param(struct fs_context *fc, struct fs_parameter *param) · 19 unmodified lines
20722072 case Opt_cdpl2:
20732073 ctx->enable_cdpl2 = true;
20742074 return 0;
2075− case Opt_mba_mpbs:
2075+ case Opt_mba_mbps:
20762076 if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
20772077 return -EINVAL;
20782078 ctx->enable_mba_mbps = true;
@@ -2610,9 +2610,10 @@ static int rdtgroup_init_alloc(struct rdtgroup *rdtgrp) · 531 unmodified lines
26102610 rdt_last_cmd_puts("Failed to initialize allocations\n");
26112611 return ret;
26122612 }
2613− rdtgrp->mode = RDT_MODE_SHAREABLE;
26142613 }
26152614
2615+ rdtgrp->mode = RDT_MODE_SHAREABLE;
2616+
26162617 return 0;
26172618 }
26182619
arch/x86/kernel/kprobes/core.c+46−2
@@ -569,6 +569,7 @@ void arch_prepare_kretprobe(struct kretprobe_instance *ri, struct pt_regs *regs) · 568 unmodified lines
569569 unsigned long *sara = stack_addr(regs);
570570
571571 ri->ret_addr = (kprobe_opcode_t *) *sara;
572+ ri->fp = sara;
572573
573574 /* Replace the return addr with trampoline addr */
574575 *sara = (unsigned long) &kretprobe_trampoline;
@@ -748,26 +749,48 @@ asm( · 173 unmodified lines
748749 NOKPROBE_SYMBOL(kretprobe_trampoline);
749750 STACK_FRAME_NON_STANDARD(kretprobe_trampoline);
750751
752+static struct kprobe kretprobe_kprobe = {
753+ .addr = (void *)kretprobe_trampoline,
754+};
755+
751756 /*
752757 * Called from kretprobe_trampoline
753758 */
754759 static __used void *trampoline_handler(struct pt_regs *regs)
755760 {
761+ struct kprobe_ctlblk *kcb;
756762 struct kretprobe_instance *ri = NULL;
757763 struct hlist_head *head, empty_rp;
758764 struct hlist_node *tmp;
759765 unsigned long flags, orig_ret_address = 0;
760766 unsigned long trampoline_address = (unsigned long)&kretprobe_trampoline;
761767 kprobe_opcode_t *correct_ret_addr = NULL;
768+ void *frame_pointer;
769+ bool skipped = false;
770+
771+ preempt_disable();
772+
773+ /*
774+ * Set a dummy kprobe for avoiding kretprobe recursion.
775+ * Since kretprobe never run in kprobe handler, kprobe must not
776+ * be running at this point.
777+ */
778+ kcb = get_kprobe_ctlblk();
779+ __this_cpu_write(current_kprobe, &kretprobe_kprobe);
780+ kcb->kprobe_status = KPROBE_HIT_ACTIVE;
762781
763782 INIT_HLIST_HEAD(&empty_rp);
764783 kretprobe_hash_lock(current, &head, &flags);
765784 /* fixup registers */
766785 #ifdef CONFIG_X86_64
767786 regs->cs = __KERNEL_CS;
787+ /* On x86-64, we use pt_regs->sp for return address holder. */
788+ frame_pointer = &regs->sp;
768789 #else
769790 regs->cs = __KERNEL_CS | get_kernel_rpl();
770791 regs->gs = 0;
792+ /* On x86-32, we use pt_regs->flags for return address holder. */
793+ frame_pointer = &regs->flags;
771794 #endif
772795 regs->ip = trampoline_address;
773796 regs->orig_ax = ~0UL;
@@ -789,8 +812,25 @@ static __used void *trampoline_handler(struct pt_regs *regs) · 15 unmodified lines
789812 if (ri->task != current)
790813 /* another task is sharing our hash bucket */
791814 continue;
815+ /*
816+ * Return probes must be pushed on this hash list correct
817+ * order (same as return order) so that it can be poped
818+ * correctly. However, if we find it is pushed it incorrect
819+ * order, this means we find a function which should not be
820+ * probed, because the wrong order entry is pushed on the
821+ * path of processing other kretprobe itself.
822+ */
823+ if (ri->fp != frame_pointer) {
824+ if (!skipped)
825+ pr_warn("kretprobe is stacked incorrectly. Trying to fixup.\n");
826+ skipped = true;
827+ continue;
828+ }
792829
793830 orig_ret_address = (unsigned long)ri->ret_addr;
831+ if (skipped)
832+ pr_warn("%ps must be blacklisted because of incorrect kretprobe order\n",
833+ ri->rp->kp.addr);
794834
795835 if (orig_ret_address != trampoline_address)
796836 /*
@@ -808,14 +848,15 @@ static __used void *trampoline_handler(struct pt_regs *regs) · 11 unmodified lines
808848 if (ri->task != current)
809849 /* another task is sharing our hash bucket */
810850 continue;
851+ if (ri->fp != frame_pointer)
852+ continue;
811853
812854 orig_ret_address = (unsigned long)ri->ret_addr;
813855 if (ri->rp && ri->rp->handler) {
814856 __this_cpu_write(current_kprobe, &ri->rp->kp);
815− get_kprobe_ctlblk()->kprobe_status = KPROBE_HIT_ACTIVE;
816857 ri->ret_addr = correct_ret_addr;
817858 ri->rp->handler(ri, regs);
818− __this_cpu_write(current_kprobe, NULL);
859+ __this_cpu_write(current_kprobe, &kretprobe_kprobe);
819860 }
820861
821862 recycle_rp_inst(ri, &empty_rp);
@@ -831,6 +872,9 @@ static __used void *trampoline_handler(struct pt_regs *regs) · 9 unmodified lines
831872
832873 kretprobe_hash_unlock(current, &flags);
833874
875+ __this_cpu_write(current_kprobe, NULL);
876+ preempt_enable();
877+
834878 hlist_for_each_entry_safe(ri, tmp, &empty_rp, hlist) {
835879 hlist_del(&ri->hlist);
836880 kfree(ri);
arch/x86/kernel/process.c+6−2
@@ -426,6 +426,8 @@ static __always_inline void __speculation_ctrl_update(unsigned long tifp, · 425 unmodified lines
426426 u64 msr = x86_spec_ctrl_base;
427427 bool updmsr = false;
428428
429+ lockdep_assert_irqs_disabled();
430+
429431 /*
430432 * If TIF_SSBD is different, select the proper mitigation
431433 * method. Note that if SSBD mitigation is disabled or permanentely
@@ -477,10 +479,12 @@ static unsigned long speculation_ctrl_update_tif(struct task_struct *tsk) · 45 unmodified lines
477479
478480 void speculation_ctrl_update(unsigned long tif)
479481 {
482+ unsigned long flags;
483+
480484 /* Forced update. Make sure all relevant TIF flags are different */
481− preempt_disable();
485+ local_irq_save(flags);
482486 __speculation_ctrl_update(~tif, tif);
483− preempt_enable();
487+ local_irq_restore(flags);
484488 }
485489
486490 /* Called from seccomp/prctl update */
arch/x86/kernel/reboot.c+21−0
@@ -81,6 +81,19 @@ static int __init set_bios_reboot(const struct dmi_system_id *d) · 80 unmodified lines
8181 return 0;
8282 }
8383
84+/*
85+ * Some machines don't handle the default ACPI reboot method and
86+ * require the EFI reboot method:
87+ */
88+static int __init set_efi_reboot(const struct dmi_system_id *d)
89+{
90+ if (reboot_type != BOOT_EFI && !efi_runtime_disabled()) {
91+ reboot_type = BOOT_EFI;
92+ pr_info("%s series board detected. Selecting EFI-method for reboot.\n", d->ident);
93+ }
94+ return 0;
95+}
96+
8497 void __noreturn machine_real_restart(unsigned int type)
8598 {
8699 local_irq_disable();
@@ -166,6 +179,14 @@ static const struct dmi_system_id reboot_dmi_table[] __initconst = { · 79 unmodified lines
166179 DMI_MATCH(DMI_PRODUCT_NAME, "AOA110"),
167180 },
168181 },
182+ { /* Handle reboot issue on Acer TravelMate X514-51T */
183+ .callback = set_efi_reboot,
184+ .ident = "Acer TravelMate X514-51T",
185+ .matches = {
186+ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
187+ DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate X514-51T"),
188+ },
189+ },
169190
170191 /* Apple */
171192 { /* Handle problems with rebooting on Apple MacBook5 */
arch/x86/kernel/vmlinux.lds.S+1−1
@@ -362,7 +362,7 @@ SECTIONS · 361 unmodified lines
362362 .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
363363 __bss_start = .;
364364 *(.bss..page_aligned)
365− *(.bss)
365+ *(BSS_MAIN)
366366 BSS_DECRYPTED
367367 . = ALIGN(PAGE_SIZE);
368368 __bss_stop = .;
arch/x86/kvm/emulate.c+102−89
@@ -2331,24 +2331,18 @@ static int em_lseg(struct x86_emulate_ctxt *ctxt) · 2330 unmodified lines
23312331
23322332 static int emulator_has_longmode(struct x86_emulate_ctxt *ctxt)
23332333 {
2334+#ifdef CONFIG_X86_64
23342335 u32 eax, ebx, ecx, edx;
23352336
23362337 eax = 0x80000001;
23372338 ecx = 0;
23382339 ctxt->ops->get_cpuid(ctxt, &eax, &ebx, &ecx, &edx, false);
23392340 return edx & bit(X86_FEATURE_LM);
2341+#else
2342+ return false;
2343+#endif
23402344 }
23412345
2342−#define GET_SMSTATE(type, smbase, offset) \
2343− ({ \
2344− type __val; \
2345− int r = ctxt->ops->read_phys(ctxt, smbase + offset, &__val, \
2346− sizeof(__val)); \
2347− if (r != X86EMUL_CONTINUE) \
2348− return X86EMUL_UNHANDLEABLE; \
2349− __val; \
2350− })
2351−
23522346 static void rsm_set_desc_flags(struct desc_struct *desc, u32 flags)
23532347 {
23542348 desc->g = (flags >> 23) & 1;
@@ -2361,27 +2355,30 @@ static void rsm_set_desc_flags(struct desc_struct *desc, u32 flags) · 6 unmodified lines
23612355 desc->type = (flags >> 8) & 15;
23622356 }
23632357
2364−static int rsm_load_seg_32(struct x86_emulate_ctxt *ctxt, u64 smbase, int n)
2358+static int rsm_load_seg_32(struct x86_emulate_ctxt *ctxt, const char *smstate,
2359+ int n)
23652360 {
23662361 struct desc_struct desc;
23672362 int offset;
23682363 u16 selector;
23692364
2370− selector = GET_SMSTATE(u32, smbase, 0x7fa8 + n * 4);
2365+ selector = GET_SMSTATE(u32, smstate, 0x7fa8 + n * 4);
23712366
23722367 if (n < 3)
23732368 offset = 0x7f84 + n * 12;
23742369 else
23752370 offset = 0x7f2c + (n - 3) * 12;
23762371
2377− set_desc_base(&desc, GET_SMSTATE(u32, smbase, offset + 8));
2378− set_desc_limit(&desc, GET_SMSTATE(u32, smbase, offset + 4));
2379− rsm_set_desc_flags(&desc, GET_SMSTATE(u32, smbase, offset));
2372+ set_desc_base(&desc, GET_SMSTATE(u32, smstate, offset + 8));
2373+ set_desc_limit(&desc, GET_SMSTATE(u32, smstate, offset + 4));
2374+ rsm_set_desc_flags(&desc, GET_SMSTATE(u32, smstate, offset));
23802375 ctxt->ops->set_segment(ctxt, selector, &desc, 0, n);
23812376 return X86EMUL_CONTINUE;
23822377 }
23832378
2384−static int rsm_load_seg_64(struct x86_emulate_ctxt *ctxt, u64 smbase, int n)
2379+#ifdef CONFIG_X86_64
2380+static int rsm_load_seg_64(struct x86_emulate_ctxt *ctxt, const char *smstate,
2381+ int n)
23852382 {
23862383 struct desc_struct desc;
23872384 int offset;
@@ -2390,15 +2387,16 @@ static int rsm_load_seg_64(struct x86_emulate_ctxt *ctxt, u64 smbase, int n) · 2 unmodified lines
23902387
23912388 offset = 0x7e00 + n * 16;
23922389
2393− selector = GET_SMSTATE(u16, smbase, offset);
2394− rsm_set_desc_flags(&desc, GET_SMSTATE(u16, smbase, offset + 2) << 8);
2395− set_desc_limit(&desc, GET_SMSTATE(u32, smbase, offset + 4));
2396− set_desc_base(&desc, GET_SMSTATE(u32, smbase, offset + 8));
2397− base3 = GET_SMSTATE(u32, smbase, offset + 12);
2390+ selector = GET_SMSTATE(u16, smstate, offset);
2391+ rsm_set_desc_flags(&desc, GET_SMSTATE(u16, smstate, offset + 2) << 8);
2392+ set_desc_limit(&desc, GET_SMSTATE(u32, smstate, offset + 4));
2393+ set_desc_base(&desc, GET_SMSTATE(u32, smstate, offset + 8));
2394+ base3 = GET_SMSTATE(u32, smstate, offset + 12);
23982395
23992396 ctxt->ops->set_segment(ctxt, selector, &desc, base3, n);
24002397 return X86EMUL_CONTINUE;
24012398 }
2399+#endif
24022400
24032401 static int rsm_enter_protected_mode(struct x86_emulate_ctxt *ctxt,
24042402 u64 cr0, u64 cr3, u64 cr4)
@@ -2445,7 +2443,8 @@ static int rsm_enter_protected_mode(struct x86_emulate_ctxt *ctxt, · 40 unmodified lines
24452443 return X86EMUL_CONTINUE;
24462444 }
24472445
2448−static int rsm_load_state_32(struct x86_emulate_ctxt *ctxt, u64 smbase)
2446+static int rsm_load_state_32(struct x86_emulate_ctxt *ctxt,
2447+ const char *smstate)
24492448 {
24502449 struct desc_struct desc;
24512450 struct desc_ptr dt;
@@ -2453,53 +2452,55 @@ static int rsm_load_state_32(struct x86_emulate_ctxt *ctxt, u64 smbase) · 1 unmodified line
24532452 u32 val, cr0, cr3, cr4;
24542453 int i;
24552454
2456− cr0 = GET_SMSTATE(u32, smbase, 0x7ffc);
2457− cr3 = GET_SMSTATE(u32, smbase, 0x7ff8);
2458− ctxt->eflags = GET_SMSTATE(u32, smbase, 0x7ff4) | X86_EFLAGS_FIXED;
2459− ctxt->_eip = GET_SMSTATE(u32, smbase, 0x7ff0);
2455+ cr0 = GET_SMSTATE(u32, smstate, 0x7ffc);
2456+ cr3 = GET_SMSTATE(u32, smstate, 0x7ff8);
2457+ ctxt->eflags = GET_SMSTATE(u32, smstate, 0x7ff4) | X86_EFLAGS_FIXED;
2458+ ctxt->_eip = GET_SMSTATE(u32, smstate, 0x7ff0);
24602459
24612460 for (i = 0; i < 8; i++)
2462− *reg_write(ctxt, i) = GET_SMSTATE(u32, smbase, 0x7fd0 + i * 4);
2461+ *reg_write(ctxt, i) = GET_SMSTATE(u32, smstate, 0x7fd0 + i * 4);
24632462
2464− val = GET_SMSTATE(u32, smbase, 0x7fcc);
2463+ val = GET_SMSTATE(u32, smstate, 0x7fcc);
24652464 ctxt->ops->set_dr(ctxt, 6, (val & DR6_VOLATILE) | DR6_FIXED_1);
2466− val = GET_SMSTATE(u32, smbase, 0x7fc8);
2465+ val = GET_SMSTATE(u32, smstate, 0x7fc8);
24672466 ctxt->ops->set_dr(ctxt, 7, (val & DR7_VOLATILE) | DR7_FIXED_1);
24682467
2469− selector = GET_SMSTATE(u32, smbase, 0x7fc4);
2470− set_desc_base(&desc, GET_SMSTATE(u32, smbase, 0x7f64));
2471− set_desc_limit(&desc, GET_SMSTATE(u32, smbase, 0x7f60));
2472− rsm_set_desc_flags(&desc, GET_SMSTATE(u32, smbase, 0x7f5c));
2468+ selector = GET_SMSTATE(u32, smstate, 0x7fc4);
2469+ set_desc_base(&desc, GET_SMSTATE(u32, smstate, 0x7f64));
2470+ set_desc_limit(&desc, GET_SMSTATE(u32, smstate, 0x7f60));
2471+ rsm_set_desc_flags(&desc, GET_SMSTATE(u32, smstate, 0x7f5c));
24732472 ctxt->ops->set_segment(ctxt, selector, &desc, 0, VCPU_SREG_TR);
24742473
2475− selector = GET_SMSTATE(u32, smbase, 0x7fc0);
2476− set_desc_base(&desc, GET_SMSTATE(u32, smbase, 0x7f80));
2477− set_desc_limit(&desc, GET_SMSTATE(u32, smbase, 0x7f7c));
2478− rsm_set_desc_flags(&desc, GET_SMSTATE(u32, smbase, 0x7f78));
2474+ selector = GET_SMSTATE(u32, smstate, 0x7fc0);
2475+ set_desc_base(&desc, GET_SMSTATE(u32, smstate, 0x7f80));
2476+ set_desc_limit(&desc, GET_SMSTATE(u32, smstate, 0x7f7c));
2477+ rsm_set_desc_flags(&desc, GET_SMSTATE(u32, smstate, 0x7f78));
24792478 ctxt->ops->set_segment(ctxt, selector, &desc, 0, VCPU_SREG_LDTR);
24802479
2481− dt.address = GET_SMSTATE(u32, smbase, 0x7f74);
2482− dt.size = GET_SMSTATE(u32, smbase, 0x7f70);
2480+ dt.address = GET_SMSTATE(u32, smstate, 0x7f74);
2481+ dt.size = GET_SMSTATE(u32, smstate, 0x7f70);
24832482 ctxt->ops->set_gdt(ctxt, &dt);
24842483
2485− dt.address = GET_SMSTATE(u32, smbase, 0x7f58);
2486− dt.size = GET_SMSTATE(u32, smbase, 0x7f54);
2484+ dt.address = GET_SMSTATE(u32, smstate, 0x7f58);
2485+ dt.size = GET_SMSTATE(u32, smstate, 0x7f54);
24872486 ctxt->ops->set_idt(ctxt, &dt);
24882487
24892488 for (i = 0; i < 6; i++) {
2490− int r = rsm_load_seg_32(ctxt, smbase, i);
2489+ int r = rsm_load_seg_32(ctxt, smstate, i);
24912490 if (r != X86EMUL_CONTINUE)
24922491 return r;
24932492 }
24942493
2495− cr4 = GET_SMSTATE(u32, smbase, 0x7f14);
2494+ cr4 = GET_SMSTATE(u32, smstate, 0x7f14);
24962495
2497− ctxt->ops->set_smbase(ctxt, GET_SMSTATE(u32, smbase, 0x7ef8));
2496+ ctxt->ops->set_smbase(ctxt, GET_SMSTATE(u32, smstate, 0x7ef8));
24982497
24992498 return rsm_enter_protected_mode(ctxt, cr0, cr3, cr4);
25002499 }
25012500
2502−static int rsm_load_state_64(struct x86_emulate_ctxt *ctxt, u64 smbase)
2501+#ifdef CONFIG_X86_64
2502+static int rsm_load_state_64(struct x86_emulate_ctxt *ctxt,
2503+ const char *smstate)
25032504 {
25042505 struct desc_struct desc;
25052506 struct desc_ptr dt;
@@ -2509,43 +2510,43 @@ static int rsm_load_state_64(struct x86_emulate_ctxt *ctxt, u64 smbase) · 3 unmodified lines
25092510 int i, r;
25102511
25112512 for (i = 0; i < 16; i++)
2512− *reg_write(ctxt, i) = GET_SMSTATE(u64, smbase, 0x7ff8 - i * 8);
2513+ *reg_write(ctxt, i) = GET_SMSTATE(u64, smstate, 0x7ff8 - i * 8);
25132514
2514− ctxt->_eip = GET_SMSTATE(u64, smbase, 0x7f78);
2515− ctxt->eflags = GET_SMSTATE(u32, smbase, 0x7f70) | X86_EFLAGS_FIXED;
2515+ ctxt->_eip = GET_SMSTATE(u64, smstate, 0x7f78);
2516+ ctxt->eflags = GET_SMSTATE(u32, smstate, 0x7f70) | X86_EFLAGS_FIXED;
25162517
2517− val = GET_SMSTATE(u32, smbase, 0x7f68);
2518+ val = GET_SMSTATE(u32, smstate, 0x7f68);
25182519 ctxt->ops->set_dr(ctxt, 6, (val & DR6_VOLATILE) | DR6_FIXED_1);
2519− val = GET_SMSTATE(u32, smbase, 0x7f60);
2520+ val = GET_SMSTATE(u32, smstate, 0x7f60);
25202521 ctxt->ops->set_dr(ctxt, 7, (val & DR7_VOLATILE) | DR7_FIXED_1);
25212522
2522− cr0 = GET_SMSTATE(u64, smbase, 0x7f58);
2523− cr3 = GET_SMSTATE(u64, smbase, 0x7f50);
2524− cr4 = GET_SMSTATE(u64, smbase, 0x7f48);
2525− ctxt->ops->set_smbase(ctxt, GET_SMSTATE(u32, smbase, 0x7f00));
2526− val = GET_SMSTATE(u64, smbase, 0x7ed0);
2523+ cr0 = GET_SMSTATE(u64, smstate, 0x7f58);
2524+ cr3 = GET_SMSTATE(u64, smstate, 0x7f50);
2525+ cr4 = GET_SMSTATE(u64, smstate, 0x7f48);
2526+ ctxt->ops->set_smbase(ctxt, GET_SMSTATE(u32, smstate, 0x7f00));
2527+ val = GET_SMSTATE(u64, smstate, 0x7ed0);
25272528 ctxt->ops->set_msr(ctxt, MSR_EFER, val & ~EFER_LMA);
25282529
2529− selector = GET_SMSTATE(u32, smbase, 0x7e90);
2530− rsm_set_desc_flags(&desc, GET_SMSTATE(u32, smbase, 0x7e92) << 8);
2531− set_desc_limit(&desc, GET_SMSTATE(u32, smbase, 0x7e94));
2532− set_desc_base(&desc, GET_SMSTATE(u32, smbase, 0x7e98));
2533− base3 = GET_SMSTATE(u32, smbase, 0x7e9c);
2530+ selector = GET_SMSTATE(u32, smstate, 0x7e90);
2531+ rsm_set_desc_flags(&desc, GET_SMSTATE(u32, smstate, 0x7e92) << 8);
2532+ set_desc_limit(&desc, GET_SMSTATE(u32, smstate, 0x7e94));
2533+ set_desc_base(&desc, GET_SMSTATE(u32, smstate, 0x7e98));
2534+ base3 = GET_SMSTATE(u32, smstate, 0x7e9c);
25342535 ctxt->ops->set_segment(ctxt, selector, &desc, base3, VCPU_SREG_TR);
25352536
2536− dt.size = GET_SMSTATE(u32, smbase, 0x7e84);
2537− dt.address = GET_SMSTATE(u64, smbase, 0x7e88);
2537+ dt.size = GET_SMSTATE(u32, smstate, 0x7e84);
2538+ dt.address = GET_SMSTATE(u64, smstate, 0x7e88);
25382539 ctxt->ops->set_idt(ctxt, &dt);
25392540
2540− selector = GET_SMSTATE(u32, smbase, 0x7e70);
2541− rsm_set_desc_flags(&desc, GET_SMSTATE(u32, smbase, 0x7e72) << 8);
2542− set_desc_limit(&desc, GET_SMSTATE(u32, smbase, 0x7e74));
2543− set_desc_base(&desc, GET_SMSTATE(u32, smbase, 0x7e78));
2544− base3 = GET_SMSTATE(u32, smbase, 0x7e7c);
2541+ selector = GET_SMSTATE(u32, smstate, 0x7e70);
2542+ rsm_set_desc_flags(&desc, GET_SMSTATE(u32, smstate, 0x7e72) << 8);
2543+ set_desc_limit(&desc, GET_SMSTATE(u32, smstate, 0x7e74));
2544+ set_desc_base(&desc, GET_SMSTATE(u32, smstate, 0x7e78));
2545+ base3 = GET_SMSTATE(u32, smstate, 0x7e7c);
25452546 ctxt->ops->set_segment(ctxt, selector, &desc, base3, VCPU_SREG_LDTR);
25462547
2547− dt.size = GET_SMSTATE(u32, smbase, 0x7e64);
2548− dt.address = GET_SMSTATE(u64, smbase, 0x7e68);
2548+ dt.size = GET_SMSTATE(u32, smstate, 0x7e64);
2549+ dt.address = GET_SMSTATE(u64, smstate, 0x7e68);
25492550 ctxt->ops->set_gdt(ctxt, &dt);
25502551
25512552 r = rsm_enter_protected_mode(ctxt, cr0, cr3, cr4);
@@ -2553,37 +2554,49 @@ static int rsm_load_state_64(struct x86_emulate_ctxt *ctxt, u64 smbase) · 1 unmodified line
25532554 return r;
25542555
25552556 for (i = 0; i < 6; i++) {
2556− r = rsm_load_seg_64(ctxt, smbase, i);
2557+ r = rsm_load_seg_64(ctxt, smstate, i);
25572558 if (r != X86EMUL_CONTINUE)
25582559 return r;
25592560 }
25602561
25612562 return X86EMUL_CONTINUE;
25622563 }
2564+#endif
25632565
25642566 static int em_rsm(struct x86_emulate_ctxt *ctxt)
25652567 {
25662568 unsigned long cr0, cr4, efer;
2569+ char buf[512];
25672570 u64 smbase;
25682571 int ret;
25692572
25702573 if ((ctxt->ops->get_hflags(ctxt) & X86EMUL_SMM_MASK) == 0)
25712574 return emulate_ud(ctxt);
25722575
2576+ smbase = ctxt->ops->get_smbase(ctxt);
2577+
2578+ ret = ctxt->ops->read_phys(ctxt, smbase + 0xfe00, buf, sizeof(buf));
2579+ if (ret != X86EMUL_CONTINUE)
2580+ return X86EMUL_UNHANDLEABLE;
2581+
2582+ if ((ctxt->ops->get_hflags(ctxt) & X86EMUL_SMM_INSIDE_NMI_MASK) == 0)
2583+ ctxt->ops->set_nmi_mask(ctxt, false);
2584+
2585+ ctxt->ops->set_hflags(ctxt, ctxt->ops->get_hflags(ctxt) &
2586+ ~(X86EMUL_SMM_INSIDE_NMI_MASK | X86EMUL_SMM_MASK));
2587+
25732588 /*
25742589 * Get back to real mode, to prepare a safe state in which to load
25752590 * CR0/CR3/CR4/EFER. It's all a bit more complicated if the vCPU
25762591 * supports long mode.
25772592 */
2578− cr4 = ctxt->ops->get_cr(ctxt, 4);
25792593 if (emulator_has_longmode(ctxt)) {
25802594 struct desc_struct cs_desc;
25812595
25822596 /* Zero CR4.PCIDE before CR0.PG. */
2583− if (cr4 & X86_CR4_PCIDE) {
2597+ cr4 = ctxt->ops->get_cr(ctxt, 4);
2598+ if (cr4 & X86_CR4_PCIDE)
25842599 ctxt->ops->set_cr(ctxt, 4, cr4 & ~X86_CR4_PCIDE);
2585− cr4 &= ~X86_CR4_PCIDE;
2586− }
25872600
25882601 /* A 32-bit code segment is required to clear EFER.LMA. */
25892602 memset(&cs_desc, 0, sizeof(cs_desc));
@@ -2597,39 +2610,39 @@ static int em_rsm(struct x86_emulate_ctxt *ctxt) · 7 unmodified lines
25972610 if (cr0 & X86_CR0_PE)
25982611 ctxt->ops->set_cr(ctxt, 0, cr0 & ~(X86_CR0_PG | X86_CR0_PE));
25992612
2600− /* Now clear CR4.PAE (which must be done before clearing EFER.LME). */
2601− if (cr4 & X86_CR4_PAE)
2602− ctxt->ops->set_cr(ctxt, 4, cr4 & ~X86_CR4_PAE);
2603−
2604− /* And finally go back to 32-bit mode. */
2605− efer = 0;
2606− ctxt->ops->set_msr(ctxt, MSR_EFER, efer);
2613+ if (emulator_has_longmode(ctxt)) {
2614+ /* Clear CR4.PAE before clearing EFER.LME. */
2615+ cr4 = ctxt->ops->get_cr(ctxt, 4);
2616+ if (cr4 & X86_CR4_PAE)
2617+ ctxt->ops->set_cr(ctxt, 4, cr4 & ~X86_CR4_PAE);
26072618
2608− smbase = ctxt->ops->get_smbase(ctxt);
2619+ /* And finally go back to 32-bit mode. */
2620+ efer = 0;
2621+ ctxt->ops->set_msr(ctxt, MSR_EFER, efer);
2622+ }
26092623
26102624 /*
26112625 * Give pre_leave_smm() a chance to make ISA-specific changes to the
26122626 * vCPU state (e.g. enter guest mode) before loading state from the SMM
26132627 * state-save area.
26142628 */
2615− if (ctxt->ops->pre_leave_smm(ctxt, smbase))
2629+ if (ctxt->ops->pre_leave_smm(ctxt, buf))
26162630 return X86EMUL_UNHANDLEABLE;
26172631
2632+#ifdef CONFIG_X86_64
26182633 if (emulator_has_longmode(ctxt))
2619− ret = rsm_load_state_64(ctxt, smbase + 0x8000);
2634+ ret = rsm_load_state_64(ctxt, buf);
26202635 else
2621− ret = rsm_load_state_32(ctxt, smbase + 0x8000);
2636+#endif
2637+ ret = rsm_load_state_32(ctxt, buf);
26222638
26232639 if (ret != X86EMUL_CONTINUE) {
26242640 /* FIXME: should triple fault */
26252641 return X86EMUL_UNHANDLEABLE;
26262642 }
26272643
2628− if ((ctxt->ops->get_hflags(ctxt) & X86EMUL_SMM_INSIDE_NMI_MASK) == 0)
2629− ctxt->ops->set_nmi_mask(ctxt, false);
2644+ ctxt->ops->post_leave_smm(ctxt);
26302645
2631− ctxt->ops->set_hflags(ctxt, ctxt->ops->get_hflags(ctxt) &
2632− ~(X86EMUL_SMM_INSIDE_NMI_MASK | X86EMUL_SMM_MASK));
26332646 return X86EMUL_CONTINUE;
26342647 }
26352648
arch/x86/kvm/lapic.c+3−1
@@ -138,6 +138,7 @@ static inline bool kvm_apic_map_get_logical_dest(struct kvm_apic_map *map, · 137 unmodified lines
138138 if (offset <= max_apic_id) {
139139 u8 cluster_size = min(max_apic_id - offset + 1, 16U);
140140
141+ offset = array_index_nospec(offset, map->max_apic_id + 1);
141142 *cluster = &map->phys_map[offset];
142143 *mask = dest_id & (0xffff >> (16 - cluster_size));
143144 } else {
@@ -901,7 +902,8 @@ static inline bool kvm_apic_map_get_dest_lapic(struct kvm *kvm, · 757 unmodified lines
901902 if (irq->dest_id > map->max_apic_id) {
902903 *bitmap = 0;
903904 } else {
904− *dst = &map->phys_map[irq->dest_id];
905+ u32 dest_id = array_index_nospec(irq->dest_id, map->max_apic_id + 1);
906+ *dst = &map->phys_map[dest_id];
905907 *bitmap = 1;
906908 }
907909 return true;
arch/x86/kvm/mmu.c+7−8
@@ -2007,7 +2007,7 @@ static int is_empty_shadow_page(u64 *spt) · 2006 unmodified lines
20072007 * aggregate version in order to make the slab shrinker
20082008 * faster
20092009 */
2010−static inline void kvm_mod_used_mmu_pages(struct kvm *kvm, int nr)
2010+static inline void kvm_mod_used_mmu_pages(struct kvm *kvm, unsigned long nr)
20112011 {
20122012 kvm->arch.n_used_mmu_pages += nr;
20132013 percpu_counter_add(&kvm_total_used_mmu_pages, nr);
@@ -2238,7 +2238,7 @@ static bool kvm_mmu_remote_flush_or_zap(struct kvm *kvm, · 224 unmodified lines
22382238 struct list_head *invalid_list,
22392239 bool remote_flush)
22402240 {
2241− if (!remote_flush && !list_empty(invalid_list))
2241+ if (!remote_flush && list_empty(invalid_list))
22422242 return false;
22432243
22442244 if (!list_empty(invalid_list))
@@ -2763,7 +2763,7 @@ static bool prepare_zap_oldest_mmu_page(struct kvm *kvm, · 518 unmodified lines
27632763 * Changing the number of mmu pages allocated to the vm
27642764 * Note: if goal_nr_mmu_pages is too small, you will get dead lock
27652765 */
2766−void kvm_mmu_change_mmu_pages(struct kvm *kvm, unsigned int goal_nr_mmu_pages)
2766+void kvm_mmu_change_mmu_pages(struct kvm *kvm, unsigned long goal_nr_mmu_pages)
27672767 {
27682768 LIST_HEAD(invalid_list);
27692769
@@ -6031,10 +6031,10 @@ out: · 3261 unmodified lines
60316031 /*
60326032 * Calculate mmu pages needed for kvm.
60336033 */
6034−unsigned int kvm_mmu_calculate_default_mmu_pages(struct kvm *kvm)
6034+unsigned long kvm_mmu_calculate_default_mmu_pages(struct kvm *kvm)
60356035 {
6036− unsigned int nr_mmu_pages;
6037− unsigned int nr_pages = 0;
6036+ unsigned long nr_mmu_pages;
6037+ unsigned long nr_pages = 0;
60386038 struct kvm_memslots *slots;
60396039 struct kvm_memory_slot *memslot;
60406040 int i;
@@ -6047,8 +6047,7 @@ unsigned int kvm_mmu_calculate_default_mmu_pages(struct kvm *kvm) · 6 unmodified lines
60476047 }
60486048
60496049 nr_mmu_pages = nr_pages * KVM_PERMILLE_MMU_PAGES / 1000;
6050− nr_mmu_pages = max(nr_mmu_pages,
6051− (unsigned int) KVM_MIN_ALLOC_MMU_PAGES);
6050+ nr_mmu_pages = max(nr_mmu_pages, KVM_MIN_ALLOC_MMU_PAGES);
60526051
60536052 return nr_mmu_pages;
60546053 }
arch/x86/kvm/mmu.h+1−1
@@ -64,7 +64,7 @@ bool kvm_can_do_async_pf(struct kvm_vcpu *vcpu); · 63 unmodified lines
6464 int kvm_handle_page_fault(struct kvm_vcpu *vcpu, u64 error_code,
6565 u64 fault_address, char *insn, int insn_len);
6666
67−static inline unsigned int kvm_mmu_available_pages(struct kvm *kvm)
67+static inline unsigned long kvm_mmu_available_pages(struct kvm *kvm)
6868 {
6969 if (kvm->arch.n_max_mmu_pages > kvm->arch.n_used_mmu_pages)
7070 return kvm->arch.n_max_mmu_pages -
arch/x86/kvm/pmu.c+4−0
@@ -281,9 +281,13 @@ static int kvm_pmu_rdpmc_vmware(struct kvm_vcpu *vcpu, unsigned idx, u64 *data) · 280 unmodified lines
281281 int kvm_pmu_rdpmc(struct kvm_vcpu *vcpu, unsigned idx, u64 *data)
282282 {
283283 bool fast_mode = idx & (1u << 31);
284+ struct kvm_pmu *pmu = vcpu_to_pmu(vcpu);
284285 struct kvm_pmc *pmc;
285286 u64 ctr_val;
286287
288+ if (!pmu->version)
289+ return 1;
290+
287291 if (is_vmware_backdoor_pmc(idx))
288292 return kvm_pmu_rdpmc_vmware(vcpu, idx, data);
289293
arch/x86/kvm/svm.c+47−32
@@ -262,6 +262,7 @@ struct amd_svm_iommu_ir { · 261 unmodified lines
262262 };
263263
264264 #define AVIC_LOGICAL_ID_ENTRY_GUEST_PHYSICAL_ID_MASK (0xFF)
265+#define AVIC_LOGICAL_ID_ENTRY_VALID_BIT 31
265266 #define AVIC_LOGICAL_ID_ENTRY_VALID_MASK (1 << 31)
266267
267268 #define AVIC_PHYSICAL_ID_ENTRY_HOST_PHYSICAL_ID_MASK (0xFFULL)
@@ -2692,6 +2693,7 @@ static int npf_interception(struct vcpu_svm *svm) · 2424 unmodified lines
26922693 static int db_interception(struct vcpu_svm *svm)
26932694 {
26942695 struct kvm_run *kvm_run = svm->vcpu.run;
2696+ struct kvm_vcpu *vcpu = &svm->vcpu;
26952697
26962698 if (!(svm->vcpu.guest_debug &
26972699 (KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP)) &&
@@ -2702,6 +2704,8 @@ static int db_interception(struct vcpu_svm *svm) · 4 unmodified lines
27022704
27032705 if (svm->nmi_singlestep) {
27042706 disable_nmi_singlestep(svm);
2707+ /* Make sure we check for pending NMIs upon entry */
2708+ kvm_make_request(KVM_REQ_EVENT, vcpu);
27052709 }
27062710
27072711 if (svm->vcpu.guest_debug &
@@ -4517,14 +4521,25 @@ static int avic_incomplete_ipi_interception(struct vcpu_svm *svm) · 1809 unmodified lines
45174521 kvm_lapic_reg_write(apic, APIC_ICR, icrl);
45184522 break;
45194523 case AVIC_IPI_FAILURE_TARGET_NOT_RUNNING: {
4524+ int i;
4525+ struct kvm_vcpu *vcpu;
4526+ struct kvm *kvm = svm->vcpu.kvm;
45204527 struct kvm_lapic *apic = svm->vcpu.arch.apic;
45214528
45224529 /*
4523− * Update ICR high and low, then emulate sending IPI,
4524− * which is handled when writing APIC_ICR.
4530+ * At this point, we expect that the AVIC HW has already
4531+ * set the appropriate IRR bits on the valid target
4532+ * vcpus. So, we just need to kick the appropriate vcpu.
45254533 */
4526− kvm_lapic_reg_write(apic, APIC_ICR2, icrh);
4527− kvm_lapic_reg_write(apic, APIC_ICR, icrl);
4534+ kvm_for_each_vcpu(i, vcpu, kvm) {
4535+ bool m = kvm_apic_match_dest(vcpu, apic,
4536+ icrl & KVM_APIC_SHORT_MASK,
4537+ GET_APIC_DEST_FIELD(icrh),
4538+ icrl & KVM_APIC_DEST_MASK);
4539+
4540+ if (m && !avic_vcpu_is_running(vcpu))
4541+ kvm_vcpu_wake_up(vcpu);
4542+ }
45284543 break;
45294544 }
45304545 case AVIC_IPI_FAILURE_INVALID_TARGET:
@@ -4596,7 +4611,7 @@ static void avic_invalidate_logical_id_entry(struct kvm_vcpu *vcpu) · 65 unmodified lines
45964611 u32 *entry = avic_get_logical_id_entry(vcpu, svm->ldr_reg, flat);
45974612
45984613 if (entry)
4599− WRITE_ONCE(*entry, (u32) ~AVIC_LOGICAL_ID_ENTRY_VALID_MASK);
4614+ clear_bit(AVIC_LOGICAL_ID_ENTRY_VALID_BIT, (unsigned long *)entry);
46004615 }
46014616
46024617 static int avic_handle_ldr_update(struct kvm_vcpu *vcpu)
@@ -5621,6 +5636,7 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) · 1018 unmodified lines
56215636 svm->vmcb->save.cr2 = vcpu->arch.cr2;
56225637
56235638 clgi();
5639+ kvm_load_guest_xcr0(vcpu);
56245640
56255641 /*
56265642 * If this vCPU has touched SPEC_CTRL, restore the guest's value if
@@ -5766,6 +5782,7 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) · 139 unmodified lines
57665782 if (unlikely(svm->vmcb->control.exit_code == SVM_EXIT_NMI))
57675783 kvm_before_interrupt(&svm->vcpu);
57685784
5785+ kvm_put_guest_xcr0(vcpu);
57695786 stgi();
57705787
57715788 /* Any pending NMI will happen here */
@@ -6215,32 +6232,24 @@ static int svm_pre_enter_smm(struct kvm_vcpu *vcpu, char *smstate) · 443 unmodified lines
62156232 return 0;
62166233 }
62176234
6218−static int svm_pre_leave_smm(struct kvm_vcpu *vcpu, u64 smbase)
6235+static int svm_pre_leave_smm(struct kvm_vcpu *vcpu, const char *smstate)
62196236 {
62206237 struct vcpu_svm *svm = to_svm(vcpu);
62216238 struct vmcb *nested_vmcb;
62226239 struct page *page;
6223− struct {
6224− u64 guest;
6225− u64 vmcb;
6226− } svm_state_save;
6227− int ret;
6240+ u64 guest;
6241+ u64 vmcb;
62286242
6229− ret = kvm_vcpu_read_guest(vcpu, smbase + 0xfed8, &svm_state_save,
6230− sizeof(svm_state_save));
6231− if (ret)
6232− return ret;
6243+ guest = GET_SMSTATE(u64, smstate, 0x7ed8);
6244+ vmcb = GET_SMSTATE(u64, smstate, 0x7ee0);
62336245
6234− if (svm_state_save.guest) {
6235− vcpu->arch.hflags &= ~HF_SMM_MASK;
6236− nested_vmcb = nested_svm_map(svm, svm_state_save.vmcb, &page);
6237− if (nested_vmcb)
6238− enter_svm_guest_mode(svm, svm_state_save.vmcb, nested_vmcb, page);
6239− else
6240− ret = 1;
6241− vcpu->arch.hflags |= HF_SMM_MASK;
6246+ if (guest) {
6247+ nested_vmcb = nested_svm_map(svm, vmcb, &page);
6248+ if (!nested_vmcb)
6249+ return 1;
6250+ enter_svm_guest_mode(svm, vmcb, nested_vmcb, page);
62426251 }
6243− return ret;
6252+ return 0;
62446253 }
62456254
62466255 static int enable_smi_window(struct kvm_vcpu *vcpu)
@@ -6422,11 +6431,11 @@ e_free: · 175 unmodified lines
64226431 return ret;
64236432 }
64246433
6425−static int get_num_contig_pages(int idx, struct page **inpages,
6426− unsigned long npages)
6434+static unsigned long get_num_contig_pages(unsigned long idx,
6435+ struct page **inpages, unsigned long npages)
64276436 {
64286437 unsigned long paddr, next_paddr;
6429− int i = idx + 1, pages = 1;
6438+ unsigned long i = idx + 1, pages = 1;
64306439
64316440 /* find the number of contiguous pages starting from idx */
64326441 paddr = __sme_page_pa(inpages[idx]);
@@ -6445,12 +6454,12 @@ static int get_num_contig_pages(int idx, struct page **inpages, · 12 unmodified lines
64456454
64466455 static int sev_launch_update_data(struct kvm *kvm, struct kvm_sev_cmd *argp)
64476456 {
6448− unsigned long vaddr, vaddr_end, next_vaddr, npages, size;
6457+ unsigned long vaddr, vaddr_end, next_vaddr, npages, pages, size, i;
64496458 struct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info;
64506459 struct kvm_sev_launch_update_data params;
64516460 struct sev_data_launch_update_data *data;
64526461 struct page **inpages;
6453− int i, ret, pages;
6462+ int ret;
64546463
64556464 if (!sev_guest(kvm))
64566465 return -ENOTTY;
@@ -6799,7 +6808,8 @@ static int sev_dbg_crypt(struct kvm *kvm, struct kvm_sev_cmd *argp, bool dec) · 342 unmodified lines
67996808 struct page **src_p, **dst_p;
68006809 struct kvm_sev_dbg debug;
68016810 unsigned long n;
6802− int ret, size;
6811+ unsigned int size;
6812+ int ret;
68036813
68046814 if (!sev_guest(kvm))
68056815 return -ENOTTY;
@@ -6807,6 +6817,11 @@ static int sev_dbg_crypt(struct kvm *kvm, struct kvm_sev_cmd *argp, bool dec) · 1 unmodified line
68076817 if (copy_from_user(&debug, (void __user *)(uintptr_t)argp->data, sizeof(debug)))
68086818 return -EFAULT;
68096819
6820+ if (!debug.len || debug.src_uaddr + debug.len < debug.src_uaddr)
6821+ return -EINVAL;
6822+ if (!debug.dst_uaddr)
6823+ return -EINVAL;
6824+
68106825 vaddr = debug.src_uaddr;
68116826 size = debug.len;
68126827 vaddr_end = vaddr + size;
@@ -6857,8 +6872,8 @@ static int sev_dbg_crypt(struct kvm *kvm, struct kvm_sev_cmd *argp, bool dec) · 44 unmodified lines
68576872 dst_vaddr,
68586873 len, &argp->error);
68596874
6860− sev_unpin_memory(kvm, src_p, 1);
6861− sev_unpin_memory(kvm, dst_p, 1);
6875+ sev_unpin_memory(kvm, src_p, n);
6876+ sev_unpin_memory(kvm, dst_p, n);
68626877
68636878 if (ret)
68646879 goto err;
arch/x86/kvm/trace.h+2−2
@@ -438,13 +438,13 @@ TRACE_EVENT(kvm_apic_ipi, · 437 unmodified lines
438438 );
439439
440440 TRACE_EVENT(kvm_apic_accept_irq,
441− TP_PROTO(__u32 apicid, __u16 dm, __u8 tm, __u8 vec),
441+ TP_PROTO(__u32 apicid, __u16 dm, __u16 tm, __u8 vec),
442442 TP_ARGS(apicid, dm, tm, vec),
443443
444444 TP_STRUCT__entry(
445445 __field( __u32, apicid )
446446 __field( __u16, dm )
447− __field( __u8, tm )
447+ __field( __u16, tm )
448448 __field( __u8, vec )
449449 ),
450450
arch/x86/kvm/vmx/nested.c+81−40
@@ -500,6 +500,17 @@ static void nested_vmx_disable_intercept_for_msr(unsigned long *msr_bitmap_l1, · 499 unmodified lines
500500 }
501501 }
502502
503+static inline void enable_x2apic_msr_intercepts(unsigned long *msr_bitmap) {
504+ int msr;
505+
506+ for (msr = 0x800; msr <= 0x8ff; msr += BITS_PER_LONG) {
507+ unsigned word = msr / BITS_PER_LONG;
508+
509+ msr_bitmap[word] = ~0;
510+ msr_bitmap[word + (0x800 / sizeof(long))] = ~0;
511+ }
512+}
513+
503514 /*
504515 * Merge L0's and L1's MSR bitmap, return false to indicate that
505516 * we do not use the hardware.
@@ -541,39 +552,44 @@ static inline bool nested_vmx_prepare_msr_bitmap(struct kvm_vcpu *vcpu, · 35 unmodified lines
541552 return false;
542553
543554 msr_bitmap_l1 = (unsigned long *)kmap(page);
544− if (nested_cpu_has_apic_reg_virt(vmcs12)) {
545− /*
546− * L0 need not intercept reads for MSRs between 0x800 and 0x8ff, it
547− * just lets the processor take the value from the virtual-APIC page;
548− * take those 256 bits directly from the L1 bitmap.
549− */
550− for (msr = 0x800; msr <= 0x8ff; msr += BITS_PER_LONG) {
551− unsigned word = msr / BITS_PER_LONG;
552− msr_bitmap_l0[word] = msr_bitmap_l1[word];
553− msr_bitmap_l0[word + (0x800 / sizeof(long))] = ~0;
554− }
555− } else {
556− for (msr = 0x800; msr <= 0x8ff; msr += BITS_PER_LONG) {
557− unsigned word = msr / BITS_PER_LONG;
558− msr_bitmap_l0[word] = ~0;
559− msr_bitmap_l0[word + (0x800 / sizeof(long))] = ~0;
560− }
561− }
562555
563− nested_vmx_disable_intercept_for_msr(
564− msr_bitmap_l1, msr_bitmap_l0,
565− X2APIC_MSR(APIC_TASKPRI),
566− MSR_TYPE_W);
556+ /*
557+ * To keep the control flow simple, pay eight 8-byte writes (sixteen
558+ * 4-byte writes on 32-bit systems) up front to enable intercepts for
559+ * the x2APIC MSR range and selectively disable them below.
560+ */
561+ enable_x2apic_msr_intercepts(msr_bitmap_l0);
562+
563+ if (nested_cpu_has_virt_x2apic_mode(vmcs12)) {
564+ if (nested_cpu_has_apic_reg_virt(vmcs12)) {
565+ /*
566+ * L0 need not intercept reads for MSRs between 0x800
567+ * and 0x8ff, it just lets the processor take the value
568+ * from the virtual-APIC page; take those 256 bits
569+ * directly from the L1 bitmap.
570+ */
571+ for (msr = 0x800; msr <= 0x8ff; msr += BITS_PER_LONG) {
572+ unsigned word = msr / BITS_PER_LONG;
573+
574+ msr_bitmap_l0[word] = msr_bitmap_l1[word];
575+ }
576+ }
567577
568− if (nested_cpu_has_vid(vmcs12)) {
569− nested_vmx_disable_intercept_for_msr(
570− msr_bitmap_l1, msr_bitmap_l0,
571− X2APIC_MSR(APIC_EOI),
572− MSR_TYPE_W);
573578 nested_vmx_disable_intercept_for_msr(
574579 msr_bitmap_l1, msr_bitmap_l0,
575− X2APIC_MSR(APIC_SELF_IPI),
576− MSR_TYPE_W);
580+ X2APIC_MSR(APIC_TASKPRI),
581+ MSR_TYPE_R | MSR_TYPE_W);
582+
583+ if (nested_cpu_has_vid(vmcs12)) {
584+ nested_vmx_disable_intercept_for_msr(
585+ msr_bitmap_l1, msr_bitmap_l0,
586+ X2APIC_MSR(APIC_EOI),
587+ MSR_TYPE_W);
588+ nested_vmx_disable_intercept_for_msr(
589+ msr_bitmap_l1, msr_bitmap_l0,
590+ X2APIC_MSR(APIC_SELF_IPI),
591+ MSR_TYPE_W);
592+ }
577593 }
578594
579595 if (spec_ctrl)
@@ -2857,20 +2873,27 @@ static void nested_get_vmcs12_pages(struct kvm_vcpu *vcpu) · 2277 unmodified lines
28572873 /*
28582874 * If translation failed, VM entry will fail because
28592875 * prepare_vmcs02 set VIRTUAL_APIC_PAGE_ADDR to -1ull.
2860− * Failing the vm entry is _not_ what the processor
2861− * does but it's basically the only possibility we
2862− * have. We could still enter the guest if CR8 load
2863− * exits are enabled, CR8 store exits are enabled, and
2864− * virtualize APIC access is disabled; in this case
2865− * the processor would never use the TPR shadow and we
2866− * could simply clear the bit from the execution
2867− * control. But such a configuration is useless, so
2868− * let's keep the code simple.
28692876 */
28702877 if (!is_error_page(page)) {
28712878 vmx->nested.virtual_apic_page = page;
28722879 hpa = page_to_phys(vmx->nested.virtual_apic_page);
28732880 vmcs_write64(VIRTUAL_APIC_PAGE_ADDR, hpa);
2881+ } else if (nested_cpu_has(vmcs12, CPU_BASED_CR8_LOAD_EXITING) &&
2882+ nested_cpu_has(vmcs12, CPU_BASED_CR8_STORE_EXITING) &&
2883+ !nested_cpu_has2(vmcs12, SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES)) {
2884+ /*
2885+ * The processor will never use the TPR shadow, simply
2886+ * clear the bit from the execution control. Such a
2887+ * configuration is useless, but it happens in tests.
2888+ * For any other configuration, failing the vm entry is
2889+ * _not_ what the processor does but it's basically the
2890+ * only possibility we have.
2891+ */
2892+ vmcs_clear_bits(CPU_BASED_VM_EXEC_CONTROL,
2893+ CPU_BASED_TPR_SHADOW);
2894+ } else {
2895+ printk("bad virtual-APIC page address\n");
2896+ dump_vmcs();
28742897 }
28752898 }
28762899
@@ -3773,8 +3796,18 @@ static void nested_vmx_restore_host_state(struct kvm_vcpu *vcpu) · 896 unmodified lines
37733796 vmx_set_cr4(vcpu, vmcs_readl(CR4_READ_SHADOW));
37743797
37753798 nested_ept_uninit_mmu_context(vcpu);
3776− vcpu->arch.cr3 = vmcs_readl(GUEST_CR3);
3777− __set_bit(VCPU_EXREG_CR3, (ulong *)&vcpu->arch.regs_avail);
3799+
3800+ /*
3801+ * This is only valid if EPT is in use, otherwise the vmcs01 GUEST_CR3
3802+ * points to shadow pages! Fortunately we only get here after a WARN_ON
3803+ * if EPT is disabled, so a VMabort is perfectly fine.
3804+ */
3805+ if (enable_ept) {
3806+ vcpu->arch.cr3 = vmcs_readl(GUEST_CR3);
3807+ __set_bit(VCPU_EXREG_CR3, (ulong *)&vcpu->arch.regs_avail);
3808+ } else {
3809+ nested_vmx_abort(vcpu, VMX_ABORT_VMCS_CORRUPTED);
3810+ }
37783811
37793812 /*
37803813 * Use ept_save_pdptrs(vcpu) to load the MMU's cached PDPTRs
@@ -5722,6 +5755,14 @@ __init int nested_vmx_hardware_setup(int (*exit_handlers[])(struct kvm_vcpu *)) · 1941 unmodified lines
57225755 {
57235756 int i;
57245757
5758+ /*
5759+ * Without EPT it is not possible to restore L1's CR3 and PDPTR on
5760+ * VMfail, because they are not available in vmcs01. Just always
5761+ * use hardware checks.
5762+ */
5763+ if (!enable_ept)
5764+ nested_early_check = 1;
5765+
57255766 if (!cpu_has_vmx_shadow_vmcs())
57265767 enable_shadow_vmcs = 0;
57275768 if (enable_shadow_vmcs) {
arch/x86/kvm/vmx/vmx.c+31−4
@@ -5603,7 +5603,7 @@ static void vmx_dump_dtsel(char *name, uint32_t limit) · 5602 unmodified lines
56035603 vmcs_readl(limit + GUEST_GDTR_BASE - GUEST_GDTR_LIMIT));
56045604 }
56055605
5606−static void dump_vmcs(void)
5606+void dump_vmcs(void)
56075607 {
56085608 u32 vmentry_ctl = vmcs_read32(VM_ENTRY_CONTROLS);
56095609 u32 vmexit_ctl = vmcs_read32(VM_EXIT_CONTROLS);
@@ -6410,6 +6410,8 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu) · 800 unmodified lines
64106410 if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP)
64116411 vmx_set_interrupt_shadow(vcpu, 0);
64126412
6413+ kvm_load_guest_xcr0(vcpu);
6414+
64136415 if (static_cpu_has(X86_FEATURE_PKU) &&
64146416 kvm_read_cr4_bits(vcpu, X86_CR4_PKE) &&
64156417 vcpu->arch.pkru != vmx->host_pkru)
@@ -6506,6 +6508,8 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu) · 90 unmodified lines
65066508 __write_pkru(vmx->host_pkru);
65076509 }
65086510
6511+ kvm_put_guest_xcr0(vcpu);
6512+
65096513 vmx->nested.nested_run_pending = 0;
65106514 vmx->idt_vectoring_info = 0;
65116515
@@ -6852,6 +6856,30 @@ static void nested_vmx_entry_exit_ctls_update(struct kvm_vcpu *vcpu) · 340 unmodified lines
68526856 }
68536857 }
68546858
6859+static bool guest_cpuid_has_pmu(struct kvm_vcpu *vcpu)
6860+{
6861+ struct kvm_cpuid_entry2 *entry;
6862+ union cpuid10_eax eax;
6863+
6864+ entry = kvm_find_cpuid_entry(vcpu, 0xa, 0);
6865+ if (!entry)
6866+ return false;
6867+
6868+ eax.full = entry->eax;
6869+ return (eax.split.version_id > 0);
6870+}
6871+
6872+static void nested_vmx_procbased_ctls_update(struct kvm_vcpu *vcpu)
6873+{
6874+ struct vcpu_vmx *vmx = to_vmx(vcpu);
6875+ bool pmu_enabled = guest_cpuid_has_pmu(vcpu);
6876+
6877+ if (pmu_enabled)
6878+ vmx->nested.msrs.procbased_ctls_high |= CPU_BASED_RDPMC_EXITING;
6879+ else
6880+ vmx->nested.msrs.procbased_ctls_high &= ~CPU_BASED_RDPMC_EXITING;
6881+}
6882+
68556883 static void update_intel_pt_cfg(struct kvm_vcpu *vcpu)
68566884 {
68576885 struct vcpu_vmx *vmx = to_vmx(vcpu);
@@ -6940,6 +6968,7 @@ static void vmx_cpuid_update(struct kvm_vcpu *vcpu) · 82 unmodified lines
69406968 if (nested_vmx_allowed(vcpu)) {
69416969 nested_vmx_cr_fixed1_bits_update(vcpu);
69426970 nested_vmx_entry_exit_ctls_update(vcpu);
6971+ nested_vmx_procbased_ctls_update(vcpu);
69436972 }
69446973
69456974 if (boot_cpu_has(X86_FEATURE_INTEL_PT) &&
@@ -7369,7 +7398,7 @@ static int vmx_pre_enter_smm(struct kvm_vcpu *vcpu, char *smstate) · 423 unmodified lines
73697398 return 0;
73707399 }
73717400
7372−static int vmx_pre_leave_smm(struct kvm_vcpu *vcpu, u64 smbase)
7401+static int vmx_pre_leave_smm(struct kvm_vcpu *vcpu, const char *smstate)
73737402 {
73747403 struct vcpu_vmx *vmx = to_vmx(vcpu);
73757404 int ret;
@@ -7380,9 +7409,7 @@ static int vmx_pre_leave_smm(struct kvm_vcpu *vcpu, u64 smbase) · 4 unmodified lines
73807409 }
73817410
73827411 if (vmx->nested.smm.guest_mode) {
7383− vcpu->arch.hflags &= ~HF_SMM_MASK;
73847412 ret = nested_vmx_enter_non_root_mode(vcpu, false);
7385− vcpu->arch.hflags |= HF_SMM_MASK;
73867413 if (ret)
73877414 return ret;
73887415
arch/x86/kvm/vmx/vmx.h+2−0
@@ -517,4 +517,6 @@ static inline void decache_tsc_multiplier(struct vcpu_vmx *vmx) · 516 unmodified lines
517517 vmcs_write64(TSC_MULTIPLIER, vmx->current_tsc_ratio);
518518 }
519519
520+void dump_vmcs(void);
521+
520522 #endif /* __KVM_X86_VMX_H */
arch/x86/kvm/x86.c+31−33
@@ -800,7 +800,7 @@ void kvm_lmsw(struct kvm_vcpu *vcpu, unsigned long msw) · 799 unmodified lines
800800 }
801801 EXPORT_SYMBOL_GPL(kvm_lmsw);
802802
803−static void kvm_load_guest_xcr0(struct kvm_vcpu *vcpu)
803+void kvm_load_guest_xcr0(struct kvm_vcpu *vcpu)
804804 {
805805 if (kvm_read_cr4_bits(vcpu, X86_CR4_OSXSAVE) &&
806806 !vcpu->guest_xcr0_loaded) {
@@ -810,8 +810,9 @@ static void kvm_load_guest_xcr0(struct kvm_vcpu *vcpu) · 3 unmodified lines
810810 vcpu->guest_xcr0_loaded = 1;
811811 }
812812 }
813+EXPORT_SYMBOL_GPL(kvm_load_guest_xcr0);
813814
814−static void kvm_put_guest_xcr0(struct kvm_vcpu *vcpu)
815+void kvm_put_guest_xcr0(struct kvm_vcpu *vcpu)
815816 {
816817 if (vcpu->guest_xcr0_loaded) {
817818 if (vcpu->arch.xcr0 != host_xcr0)
@@ -819,6 +820,7 @@ static void kvm_put_guest_xcr0(struct kvm_vcpu *vcpu) · 1 unmodified line
819820 vcpu->guest_xcr0_loaded = 0;
820821 }
821822 }
823+EXPORT_SYMBOL_GPL(kvm_put_guest_xcr0);
822824
823825 static int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr)
824826 {
@@ -3093,7 +3095,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) · 2268 unmodified lines
30933095 break;
30943096 case KVM_CAP_NESTED_STATE:
30953097 r = kvm_x86_ops->get_nested_state ?
3096− kvm_x86_ops->get_nested_state(NULL, 0, 0) : 0;
3098+ kvm_x86_ops->get_nested_state(NULL, NULL, 0) : 0;
30973099 break;
30983100 default:
30993101 break;
@@ -3528,7 +3530,7 @@ static void kvm_vcpu_ioctl_x86_get_vcpu_events(struct kvm_vcpu *vcpu, · 428 unmodified lines
35283530 memset(&events->reserved, 0, sizeof(events->reserved));
35293531 }
35303532
3531−static void kvm_set_hflags(struct kvm_vcpu *vcpu, unsigned emul_flags);
3533+static void kvm_smm_changed(struct kvm_vcpu *vcpu);
35323534
35333535 static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu,
35343536 struct kvm_vcpu_events *events)
@@ -3588,12 +3590,13 @@ static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu, · 53 unmodified lines
35883590 vcpu->arch.apic->sipi_vector = events->sipi_vector;
35893591
35903592 if (events->flags & KVM_VCPUEVENT_VALID_SMM) {
3591− u32 hflags = vcpu->arch.hflags;
3592− if (events->smi.smm)
3593− hflags |= HF_SMM_MASK;
3594− else
3595− hflags &= ~HF_SMM_MASK;
3596− kvm_set_hflags(vcpu, hflags);
3593+ if (!!(vcpu->arch.hflags & HF_SMM_MASK) != events->smi.smm) {
3594+ if (events->smi.smm)
3595+ vcpu->arch.hflags |= HF_SMM_MASK;
3596+ else
3597+ vcpu->arch.hflags &= ~HF_SMM_MASK;
3598+ kvm_smm_changed(vcpu);
3599+ }
35973600
35983601 vcpu->arch.smi_pending = events->smi.pending;
35993602
@@ -4270,7 +4273,7 @@ static int kvm_vm_ioctl_set_identity_map_addr(struct kvm *kvm, · 670 unmodified lines
42704273 }
42714274
42724275 static int kvm_vm_ioctl_set_nr_mmu_pages(struct kvm *kvm,
4273− u32 kvm_nr_mmu_pages)
4276+ unsigned long kvm_nr_mmu_pages)
42744277 {
42754278 if (kvm_nr_mmu_pages < KVM_MIN_ALLOC_MMU_PAGES)
42764279 return -EINVAL;
@@ -4284,7 +4287,7 @@ static int kvm_vm_ioctl_set_nr_mmu_pages(struct kvm *kvm, · 7 unmodified lines
42844287 return 0;
42854288 }
42864289
4287−static int kvm_vm_ioctl_get_nr_mmu_pages(struct kvm *kvm)
4290+static unsigned long kvm_vm_ioctl_get_nr_mmu_pages(struct kvm *kvm)
42884291 {
42894292 return kvm->arch.n_max_mmu_pages;
42904293 }
@@ -5958,12 +5961,18 @@ static unsigned emulator_get_hflags(struct x86_emulate_ctxt *ctxt) · 1667 unmodified lines
59585961
59595962 static void emulator_set_hflags(struct x86_emulate_ctxt *ctxt, unsigned emul_flags)
59605963 {
5961− kvm_set_hflags(emul_to_vcpu(ctxt), emul_flags);
5964+ emul_to_vcpu(ctxt)->arch.hflags = emul_flags;
5965+}
5966+
5967+static int emulator_pre_leave_smm(struct x86_emulate_ctxt *ctxt,
5968+ const char *smstate)
5969+{
5970+ return kvm_x86_ops->pre_leave_smm(emul_to_vcpu(ctxt), smstate);
59625971 }
59635972
5964−static int emulator_pre_leave_smm(struct x86_emulate_ctxt *ctxt, u64 smbase)
5973+static void emulator_post_leave_smm(struct x86_emulate_ctxt *ctxt)
59655974 {
5966− return kvm_x86_ops->pre_leave_smm(emul_to_vcpu(ctxt), smbase);
5975+ kvm_smm_changed(emul_to_vcpu(ctxt));
59675976 }
59685977
59695978 static const struct x86_emulate_ops emulate_ops = {
@@ -6006,6 +6015,7 @@ static const struct x86_emulate_ops emulate_ops = { · 36 unmodified lines
60066015 .get_hflags = emulator_get_hflags,
60076016 .set_hflags = emulator_set_hflags,
60086017 .pre_leave_smm = emulator_pre_leave_smm,
6018+ .post_leave_smm = emulator_post_leave_smm,
60096019 };
60106020
60116021 static void toggle_interruptibility(struct kvm_vcpu *vcpu, u32 mask)
@@ -6247,16 +6257,6 @@ static void kvm_smm_changed(struct kvm_vcpu *vcpu) · 235 unmodified lines
62476257 kvm_mmu_reset_context(vcpu);
62486258 }
62496259
6250−static void kvm_set_hflags(struct kvm_vcpu *vcpu, unsigned emul_flags)
6251−{
6252− unsigned changed = vcpu->arch.hflags ^ emul_flags;
6253−
6254− vcpu->arch.hflags = emul_flags;
6255−
6256− if (changed & HF_SMM_MASK)
6257− kvm_smm_changed(vcpu);
6258−}
6259−
62606260 static int kvm_vcpu_check_hw_bp(unsigned long addr, u32 type, u32 dr7,
62616261 unsigned long *db)
62626262 {
@@ -7441,9 +7441,9 @@ static void enter_smm_save_state_32(struct kvm_vcpu *vcpu, char *buf) · 1178 unmodified lines
74417441 put_smstate(u32, buf, 0x7ef8, vcpu->arch.smbase);
74427442 }
74437443
7444+#ifdef CONFIG_X86_64
74447445 static void enter_smm_save_state_64(struct kvm_vcpu *vcpu, char *buf)
74457446 {
7446−#ifdef CONFIG_X86_64
74477447 struct desc_ptr dt;
74487448 struct kvm_segment seg;
74497449 unsigned long val;
@@ -7493,10 +7493,8 @@ static void enter_smm_save_state_64(struct kvm_vcpu *vcpu, char *buf) · 43 unmodified lines
74937493
74947494 for (i = 0; i < 6; i++)
74957495 enter_smm_save_seg_64(vcpu, buf, i);
7496−#else
7497− WARN_ON_ONCE(1);
7498−#endif
74997496 }
7497+#endif
75007498
75017499 static void enter_smm(struct kvm_vcpu *vcpu)
75027500 {
@@ -7507,9 +7505,11 @@ static void enter_smm(struct kvm_vcpu *vcpu) · 4 unmodified lines
75077505
75087506 trace_kvm_enter_smm(vcpu->vcpu_id, vcpu->arch.smbase, true);
75097507 memset(buf, 0, 512);
7508+#ifdef CONFIG_X86_64
75107509 if (guest_cpuid_has(vcpu, X86_FEATURE_LM))
75117510 enter_smm_save_state_64(vcpu, buf);
75127511 else
7512+#endif
75137513 enter_smm_save_state_32(vcpu, buf);
75147514
75157515 /*
@@ -7567,8 +7567,10 @@ static void enter_smm(struct kvm_vcpu *vcpu) · 51 unmodified lines
75677567 kvm_set_segment(vcpu, &ds, VCPU_SREG_GS);
75687568 kvm_set_segment(vcpu, &ds, VCPU_SREG_SS);
75697569
7570+#ifdef CONFIG_X86_64
75707571 if (guest_cpuid_has(vcpu, X86_FEATURE_LM))
75717572 kvm_x86_ops->set_efer(vcpu, 0);
7573+#endif
75727574
75737575 kvm_update_cpuid(vcpu);
75747576 kvm_mmu_reset_context(vcpu);
@@ -7865,8 +7867,6 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) · 290 unmodified lines
78657867 goto cancel_injection;
78667868 }
78677869
7868− kvm_load_guest_xcr0(vcpu);
7869−
78707870 if (req_immediate_exit) {
78717871 kvm_make_request(KVM_REQ_EVENT, vcpu);
78727872 kvm_x86_ops->request_immediate_exit(vcpu);
@@ -7919,8 +7919,6 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) · 46 unmodified lines
79197919 vcpu->mode = OUTSIDE_GUEST_MODE;
79207920 smp_wmb();
79217921
7922− kvm_put_guest_xcr0(vcpu);
7923−
79247922 kvm_before_interrupt(vcpu);
79257923 kvm_x86_ops->handle_external_intr(vcpu);
79267924 kvm_after_interrupt(vcpu);
arch/x86/kvm/x86.h+2−0
@@ -347,4 +347,6 @@ static inline void kvm_after_interrupt(struct kvm_vcpu *vcpu) · 346 unmodified lines
347347 __this_cpu_write(current_vcpu, NULL);
348348 }
349349
350+void kvm_load_guest_xcr0(struct kvm_vcpu *vcpu);
351+void kvm_put_guest_xcr0(struct kvm_vcpu *vcpu);
350352 #endif
arch/x86/mm/dump_pagetables.c+2−1
@@ -259,7 +259,8 @@ static void note_wx(struct pg_state *st) · 258 unmodified lines
259259 #endif
260260 /* Account the WX pages */
261261 st->wx_pages += npages;
262− WARN_ONCE(1, "x86/mm: Found insecure W+X mapping at address %pS\n",
262+ WARN_ONCE(__supported_pte_mask & _PAGE_NX,
263+ "x86/mm: Found insecure W+X mapping at address %pS\n",
263264 (void *)st->start_address);
264265 }
265266
arch/x86/mm/ioremap.c+1−1
@@ -825,7 +825,7 @@ void __init __early_set_fixmap(enum fixed_addresses idx, · 824 unmodified lines
825825 pte = early_ioremap_pte(addr);
826826
827827 /* Sanitize 'prot' against any unsupported bits: */
828− pgprot_val(flags) &= __default_kernel_pte_mask;
828+ pgprot_val(flags) &= __supported_pte_mask;
829829
830830 if (pgprot_val(flags))
831831 set_pte(pte, pfn_pte(phys >> PAGE_SHIFT, flags));
arch/x86/mm/kaslr.c+1−1
@@ -94,7 +94,7 @@ void __init kernel_randomize_memory(void) · 93 unmodified lines
9494 if (!kaslr_memory_enabled())
9595 return;
9696
97− kaslr_regions[0].size_tb = 1 << (__PHYSICAL_MASK_SHIFT - TB_SHIFT);
97+ kaslr_regions[0].size_tb = 1 << (MAX_PHYSMEM_BITS - TB_SHIFT);
9898 kaslr_regions[1].size_tb = VMALLOC_SIZE_TB;
9999
100100 /*
arch/x86/mm/tlb.c+1−1
@@ -728,7 +728,7 @@ void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start, · 727 unmodified lines
728728 {
729729 int cpu;
730730
731− struct flush_tlb_info info __aligned(SMP_CACHE_BYTES) = {
731+ struct flush_tlb_info info = {
732732 .mm = mm,
733733 .stride_shift = stride_shift,
734734 .freed_tables = freed_tables,
arch/xtensa/include/asm/processor.h+12−9
@@ -187,15 +187,18 @@ struct thread_struct { · 186 unmodified lines
187187
188188 /* Clearing a0 terminates the backtrace. */
189189 #define start_thread(regs, new_pc, new_sp) \
190− memset(regs, 0, sizeof(*regs)); \
191− regs->pc = new_pc; \
192− regs->ps = USER_PS_VALUE; \
193− regs->areg[1] = new_sp; \
194− regs->areg[0] = 0; \
195− regs->wmask = 1; \
196− regs->depc = 0; \
197− regs->windowbase = 0; \
198− regs->windowstart = 1;
190+ do { \
191+ memset((regs), 0, sizeof(*(regs))); \
192+ (regs)->pc = (new_pc); \
193+ (regs)->ps = USER_PS_VALUE; \
194+ (regs)->areg[1] = (new_sp); \
195+ (regs)->areg[0] = 0; \
196+ (regs)->wmask = 1; \
197+ (regs)->depc = 0; \
198+ (regs)->windowbase = 0; \
199+ (regs)->windowstart = 1; \
200+ (regs)->syscall = NO_SYSCALL; \
201+ } while (0)
199202
200203 /* Forward declaration */
201204 struct task_struct;
arch/xtensa/include/asm/syscall.h+6−27
@@ -59,45 +59,24 @@ static inline void syscall_set_return_value(struct task_struct *task, · 58 unmodified lines
5959
6060 static inline void syscall_get_arguments(struct task_struct *task,
6161 struct pt_regs *regs,
62− unsigned int i, unsigned int n,
6362 unsigned long *args)
6463 {
6564 static const unsigned int reg[] = XTENSA_SYSCALL_ARGUMENT_REGS;
66− unsigned int j;
65+ unsigned int i;
6766
68− if (n == 0)
69− return;
70−
71− WARN_ON_ONCE(i + n > SYSCALL_MAX_ARGS);
72−
73− for (j = 0; j < n; ++j) {
74− if (i + j < SYSCALL_MAX_ARGS)
75− args[j] = regs->areg[reg[i + j]];
76− else
77− args[j] = 0;
78− }
67+ for (i = 0; i < 6; ++i)
68+ args[i] = regs->areg[reg[i]];
7969 }
8070
8171 static inline void syscall_set_arguments(struct task_struct *task,
8272 struct pt_regs *regs,
83− unsigned int i, unsigned int n,
8473 const unsigned long *args)
8574 {
8675 static const unsigned int reg[] = XTENSA_SYSCALL_ARGUMENT_REGS;
87− unsigned int j;
88−
89− if (n == 0)
90− return;
91−
92− if (WARN_ON_ONCE(i + n > SYSCALL_MAX_ARGS)) {
93− if (i < SYSCALL_MAX_ARGS)
94− n = SYSCALL_MAX_ARGS - i;
95− else
96− return;
97− }
76+ unsigned int i;
9877
99− for (j = 0; j < n; ++j)
100− regs->areg[reg[i + j]] = args[j];
78+ for (i = 0; i < 6; ++i)
79+ regs->areg[reg[i]] = args[i];
10180 }
10281
10382 asmlinkage long xtensa_rt_sigreturn(struct pt_regs*);
arch/xtensa/kernel/entry.S+6−0
@@ -1860,6 +1860,8 @@ ENTRY(system_call) · 1859 unmodified lines
18601860 l32i a7, a2, PT_SYSCALL
18611861
18621862 1:
1863+ s32i a7, a1, 4
1864+
18631865 /* syscall = sys_call_table[syscall_nr] */
18641866
18651867 movi a4, sys_call_table
@@ -1893,8 +1895,12 @@ ENTRY(system_call) · 27 unmodified lines
18931895 retw
18941896
18951897 1:
1898+ l32i a4, a1, 4
1899+ l32i a3, a2, PT_SYSCALL
1900+ s32i a4, a2, PT_SYSCALL
18961901 mov a6, a2
18971902 call4 do_syscall_trace_leave
1903+ s32i a3, a2, PT_SYSCALL
18981904 retw
18991905
19001906 ENDPROC(system_call)
arch/xtensa/kernel/stacktrace.c+5−1
@@ -253,10 +253,14 @@ static int return_address_cb(struct stackframe *frame, void *data) · 252 unmodified lines
253253 return 1;
254254 }
255255
256+/*
257+ * level == 0 is for the return address from the caller of this function,
258+ * not from this function itself.
259+ */
256260 unsigned long return_address(unsigned level)
257261 {
258262 struct return_addr_data r = {
259− .skip = level + 1,
263+ .skip = level,
260264 };
261265 walk_stackframe(stack_pointer(NULL), return_address_cb, &r);
262266 return r.addr;
arch/xtensa/mm/mmu.c+1−1
@@ -33,7 +33,7 @@ static void * __init init_pmd(unsigned long vaddr, unsigned long n_pages) · 32 unmodified lines
3333
3434 pte = memblock_alloc_low(n_pages * sizeof(pte_t), PAGE_SIZE);
3535 if (!pte)
36− panic("%s: Failed to allocate %zu bytes align=%lx\n",
36+ panic("%s: Failed to allocate %lu bytes align=%lx\n",
3737 __func__, n_pages * sizeof(pte_t), PAGE_SIZE);
3838
3939 for (i = 0; i < n_pages; ++i)
block/bfq-iosched.c+14−9
@@ -3054,7 +3054,7 @@ static void bfq_dispatch_remove(struct request_queue *q, struct request *rq) · 3053 unmodified lines
30543054 bfq_remove_request(q, rq);
30553055 }
30563056
3057−static void __bfq_bfqq_expire(struct bfq_data *bfqd, struct bfq_queue *bfqq)
3057+static bool __bfq_bfqq_expire(struct bfq_data *bfqd, struct bfq_queue *bfqq)
30583058 {
30593059 /*
30603060 * If this bfqq is shared between multiple processes, check
@@ -3089,9 +3089,11 @@ static void __bfq_bfqq_expire(struct bfq_data *bfqd, struct bfq_queue *bfqq) · 28 unmodified lines
30893089 /*
30903090 * All in-service entities must have been properly deactivated
30913091 * or requeued before executing the next function, which
3092− * resets all in-service entities as no more in service.
3092+ * resets all in-service entities as no more in service. This
3093+ * may cause bfqq to be freed. If this happens, the next
3094+ * function returns true.
30933095 */
3094− __bfq_bfqd_reset_in_service(bfqd);
3096+ return __bfq_bfqd_reset_in_service(bfqd);
30953097 }
30963098
30973099 /**
@@ -3489,7 +3491,6 @@ void bfq_bfqq_expire(struct bfq_data *bfqd, · 391 unmodified lines
34893491 bool slow;
34903492 unsigned long delta = 0;
34913493 struct bfq_entity *entity = &bfqq->entity;
3492− int ref;
34933494
34943495 /*
34953496 * Check whether the process is slow (see bfq_bfqq_is_slow).
@@ -3582,10 +3583,8 @@ void bfq_bfqq_expire(struct bfq_data *bfqd, · 86 unmodified lines
35823583 * reason.
35833584 */
35843585 __bfq_bfqq_recalc_budget(bfqd, bfqq, reason);
3585− ref = bfqq->ref;
3586− __bfq_bfqq_expire(bfqd, bfqq);
3587−
3588− if (ref == 1) /* bfqq is gone, no more actions on it */
3586+ if (__bfq_bfqq_expire(bfqd, bfqq))
3587+ /* bfqq is gone, no more actions on it */
35893588 return;
35903589
35913590 /* mark bfqq as waiting a request only if a bic still points to it */
@@ -5894,7 +5893,7 @@ static unsigned int bfq_update_depths(struct bfq_data *bfqd, · 2302 unmodified lines
58945893 return min_shallow;
58955894 }
58965895
5897−static int bfq_init_hctx(struct blk_mq_hw_ctx *hctx, unsigned int index)
5896+static void bfq_depth_updated(struct blk_mq_hw_ctx *hctx)
58985897 {
58995898 struct bfq_data *bfqd = hctx->queue->elevator->elevator_data;
59005899 struct blk_mq_tags *tags = hctx->sched_tags;
@@ -5902,6 +5901,11 @@ static int bfq_init_hctx(struct blk_mq_hw_ctx *hctx, unsigned int index) · 1 unmodified line
59025901
59035902 min_shallow = bfq_update_depths(bfqd, &tags->bitmap_tags);
59045903 sbitmap_queue_min_shallow_depth(&tags->bitmap_tags, min_shallow);
5904+}
5905+
5906+static int bfq_init_hctx(struct blk_mq_hw_ctx *hctx, unsigned int index)
5907+{
5908+ bfq_depth_updated(hctx);
59055909 return 0;
59065910 }
59075911
@@ -6325,6 +6329,7 @@ static struct elevator_type iosched_bfq_mq = { · 417 unmodified lines
63256329 .requests_merged = bfq_requests_merged,
63266330 .request_merged = bfq_request_merged,
63276331 .has_work = bfq_has_work,
6332+ .depth_updated = bfq_depth_updated,
63286333 .init_hctx = bfq_init_hctx,
63296334 .init_sched = bfq_init_queue,
63306335 .exit_sched = bfq_exit_queue,
block/bfq-iosched.h+1−1
@@ -1014,7 +1014,7 @@ bool __bfq_deactivate_entity(struct bfq_entity *entity, · 1013 unmodified lines
10141014 bool ins_into_idle_tree);
10151015 bool next_queue_may_preempt(struct bfq_data *bfqd);
10161016 struct bfq_queue *bfq_get_next_queue(struct bfq_data *bfqd);
1017−void __bfq_bfqd_reset_in_service(struct bfq_data *bfqd);
1017+bool __bfq_bfqd_reset_in_service(struct bfq_data *bfqd);
10181018 void bfq_deactivate_bfqq(struct bfq_data *bfqd, struct bfq_queue *bfqq,
10191019 bool ins_into_idle_tree, bool expiration);
10201020 void bfq_activate_bfqq(struct bfq_data *bfqd, struct bfq_queue *bfqq);
block/bfq-wf2q.c+15−2
@@ -1605,7 +1605,8 @@ struct bfq_queue *bfq_get_next_queue(struct bfq_data *bfqd) · 1604 unmodified lines
16051605 return bfqq;
16061606 }
16071607
1608−void __bfq_bfqd_reset_in_service(struct bfq_data *bfqd)
1608+/* returns true if the in-service queue gets freed */
1609+bool __bfq_bfqd_reset_in_service(struct bfq_data *bfqd)
16091610 {
16101611 struct bfq_queue *in_serv_bfqq = bfqd->in_service_queue;
16111612 struct bfq_entity *in_serv_entity = &in_serv_bfqq->entity;
@@ -1629,8 +1630,20 @@ void __bfq_bfqd_reset_in_service(struct bfq_data *bfqd) · 17 unmodified lines
16291630 * service tree either, then release the service reference to
16301631 * the queue it represents (taken with bfq_get_entity).
16311632 */
1632− if (!in_serv_entity->on_st)
1633+ if (!in_serv_entity->on_st) {
1634+ /*
1635+ * If no process is referencing in_serv_bfqq any
1636+ * longer, then the service reference may be the only
1637+ * reference to the queue. If this is the case, then
1638+ * bfqq gets freed here.
1639+ */
1640+ int ref = in_serv_bfqq->ref;
16331641 bfq_put_queue(in_serv_bfqq);
1642+ if (ref == 1)
1643+ return true;
1644+ }
1645+
1646+ return false;
16341647 }
16351648
16361649 void bfq_deactivate_bfqq(struct bfq_data *bfqd, struct bfq_queue *bfqq,
block/bio.c+4−1
@@ -1333,8 +1333,11 @@ struct bio *bio_copy_user_iov(struct request_queue *q, · 1332 unmodified lines
13331333 }
13341334 }
13351335
1336− if (bio_add_pc_page(q, bio, page, bytes, offset) < bytes)
1336+ if (bio_add_pc_page(q, bio, page, bytes, offset) < bytes) {
1337+ if (!map_data)
1338+ __free_page(page);
13371339 break;
1340+ }
13381341
13391342 len -= bytes;
13401343 offset = 0;
block/blk-core.c+1−3
@@ -1245,8 +1245,6 @@ static int blk_cloned_rq_check_limits(struct request_queue *q, · 1244 unmodified lines
12451245 */
12461246 blk_status_t blk_insert_cloned_request(struct request_queue *q, struct request *rq)
12471247 {
1248− blk_qc_t unused;
1249−
12501248 if (blk_cloned_rq_check_limits(q, rq))
12511249 return BLK_STS_IOERR;
12521250
@@ -1262,7 +1260,7 @@ blk_status_t blk_insert_cloned_request(struct request_queue *q, struct request * · 9 unmodified lines
12621260 * bypass a potential scheduler on the bottom device for
12631261 * insert.
12641262 */
1265− return blk_mq_try_issue_directly(rq->mq_hctx, rq, &unused, true, true);
1263+ return blk_mq_request_issue_directly(rq, true);
12661264 }
12671265 EXPORT_SYMBOL_GPL(blk_insert_cloned_request);
12681266
block/blk-mq-sched.c+5−3
@@ -423,10 +423,12 @@ void blk_mq_sched_insert_requests(struct blk_mq_hw_ctx *hctx, · 422 unmodified lines
423423 * busy in case of 'none' scheduler, and this way may save
424424 * us one extra enqueue & dequeue to sw queue.
425425 */
426− if (!hctx->dispatch_busy && !e && !run_queue_async)
426+ if (!hctx->dispatch_busy && !e && !run_queue_async) {
427427 blk_mq_try_issue_list_directly(hctx, list);
428− else
429− blk_mq_insert_requests(hctx, ctx, list);
428+ if (list_empty(list))
429+ return;
430+ }
431+ blk_mq_insert_requests(hctx, ctx, list);
430432 }
431433
432434 blk_mq_run_hw_queue(hctx, run_queue_async);
block/blk-mq.c+77−61
@@ -654,6 +654,13 @@ bool blk_mq_complete_request(struct request *rq) · 653 unmodified lines
654654 }
655655 EXPORT_SYMBOL(blk_mq_complete_request);
656656
657+void blk_mq_complete_request_sync(struct request *rq)
658+{
659+ WRITE_ONCE(rq->state, MQ_RQ_COMPLETE);
660+ rq->q->mq_ops->complete(rq);
661+}
662+EXPORT_SYMBOL_GPL(blk_mq_complete_request_sync);
663+
657664 int blk_mq_request_started(struct request *rq)
658665 {
659666 return blk_mq_rq_state(rq) != MQ_RQ_IDLE;
@@ -1711,11 +1718,12 @@ void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule) · 1051 unmodified lines
17111718 unsigned int depth;
17121719
17131720 list_splice_init(&plug->mq_list, &list);
1714− plug->rq_count = 0;
17151721
17161722 if (plug->rq_count > 2 && plug->multiple_queues)
17171723 list_sort(NULL, &list, plug_rq_cmp);
17181724
1725+ plug->rq_count = 0;
1726+
17191727 this_q = NULL;
17201728 this_hctx = NULL;
17211729 this_ctx = NULL;
@@ -1800,74 +1808,76 @@ static blk_status_t __blk_mq_issue_directly(struct blk_mq_hw_ctx *hctx, · 78 unmodified lines
18001808 return ret;
18011809 }
18021810
1803−blk_status_t blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx,
1811+static blk_status_t __blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx,
18041812 struct request *rq,
18051813 blk_qc_t *cookie,
1806− bool bypass, bool last)
1814+ bool bypass_insert, bool last)
18071815 {
18081816 struct request_queue *q = rq->q;
18091817 bool run_queue = true;
1810− blk_status_t ret = BLK_STS_RESOURCE;
1811− int srcu_idx;
1812− bool force = false;
18131818
1814− hctx_lock(hctx, &srcu_idx);
18151819 /*
1816− * hctx_lock is needed before checking quiesced flag.
1820+ * RCU or SRCU read lock is needed before checking quiesced flag.
18171821 *
1818− * When queue is stopped or quiesced, ignore 'bypass', insert
1819− * and return BLK_STS_OK to caller, and avoid driver to try to
1820− * dispatch again.
1822+ * When queue is stopped or quiesced, ignore 'bypass_insert' from
1823+ * blk_mq_request_issue_directly(), and return BLK_STS_OK to caller,
1824+ * and avoid driver to try to dispatch again.
18211825 */
1822− if (unlikely(blk_mq_hctx_stopped(hctx) || blk_queue_quiesced(q))) {
1826+ if (blk_mq_hctx_stopped(hctx) || blk_queue_quiesced(q)) {
18231827 run_queue = false;
1824− bypass = false;
1825− goto out_unlock;
1828+ bypass_insert = false;
1829+ goto insert;
18261830 }
18271831
1828− if (unlikely(q->elevator && !bypass))
1829− goto out_unlock;
1832+ if (q->elevator && !bypass_insert)
1833+ goto insert;
18301834
18311835 if (!blk_mq_get_dispatch_budget(hctx))
1832− goto out_unlock;
1836+ goto insert;
18331837
18341838 if (!blk_mq_get_driver_tag(rq)) {
18351839 blk_mq_put_dispatch_budget(hctx);
1836− goto out_unlock;
1840+ goto insert;
18371841 }
18381842
1839− /*
1840− * Always add a request that has been through
1841− *.queue_rq() to the hardware dispatch list.
1842− */
1843− force = true;
1844− ret = __blk_mq_issue_directly(hctx, rq, cookie, last);
1845−out_unlock:
1843+ return __blk_mq_issue_directly(hctx, rq, cookie, last);
1844+insert:
1845+ if (bypass_insert)
1846+ return BLK_STS_RESOURCE;
1847+
1848+ blk_mq_request_bypass_insert(rq, run_queue);
1849+ return BLK_STS_OK;
1850+}
1851+
1852+static void blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx,
1853+ struct request *rq, blk_qc_t *cookie)
1854+{
1855+ blk_status_t ret;
1856+ int srcu_idx;
1857+
1858+ might_sleep_if(hctx->flags & BLK_MQ_F_BLOCKING);
1859+
1860+ hctx_lock(hctx, &srcu_idx);
1861+
1862+ ret = __blk_mq_try_issue_directly(hctx, rq, cookie, false, true);
1863+ if (ret == BLK_STS_RESOURCE || ret == BLK_STS_DEV_RESOURCE)
1864+ blk_mq_request_bypass_insert(rq, true);
1865+ else if (ret != BLK_STS_OK)
1866+ blk_mq_end_request(rq, ret);
1867+
1868+ hctx_unlock(hctx, srcu_idx);
1869+}
1870+
1871+blk_status_t blk_mq_request_issue_directly(struct request *rq, bool last)
1872+{
1873+ blk_status_t ret;
1874+ int srcu_idx;
1875+ blk_qc_t unused_cookie;
1876+ struct blk_mq_hw_ctx *hctx = rq->mq_hctx;
1877+
1878+ hctx_lock(hctx, &srcu_idx);
1879+ ret = __blk_mq_try_issue_directly(hctx, rq, &unused_cookie, true, last);
18461880 hctx_unlock(hctx, srcu_idx);
1847− switch (ret) {
1848− case BLK_STS_OK:
1849− break;
1850− case BLK_STS_DEV_RESOURCE:
1851− case BLK_STS_RESOURCE:
1852− if (force) {
1853− blk_mq_request_bypass_insert(rq, run_queue);
1854− /*
1855− * We have to return BLK_STS_OK for the DM
1856− * to avoid livelock. Otherwise, we return
1857− * the real result to indicate whether the
1858− * request is direct-issued successfully.
1859− */
1860− ret = bypass ? BLK_STS_OK : ret;
1861− } else if (!bypass) {
1862− blk_mq_sched_insert_request(rq, false,
1863− run_queue, false);
1864− }
1865− break;
1866− default:
1867− if (!bypass)
1868− blk_mq_end_request(rq, ret);
1869− break;
1870− }
18711881
18721882 return ret;
18731883 }
@@ -1875,20 +1885,22 @@ out_unlock: · 1 unmodified line
18751885 void blk_mq_try_issue_list_directly(struct blk_mq_hw_ctx *hctx,
18761886 struct list_head *list)
18771887 {
1878− blk_qc_t unused;
1879− blk_status_t ret = BLK_STS_OK;
1880−
18811888 while (!list_empty(list)) {
1889+ blk_status_t ret;
18821890 struct request *rq = list_first_entry(list, struct request,
18831891 queuelist);
18841892
18851893 list_del_init(&rq->queuelist);
1886− if (ret == BLK_STS_OK)
1887− ret = blk_mq_try_issue_directly(hctx, rq, &unused,
1888− false,
1894+ ret = blk_mq_request_issue_directly(rq, list_empty(list));
1895+ if (ret != BLK_STS_OK) {
1896+ if (ret == BLK_STS_RESOURCE ||
1897+ ret == BLK_STS_DEV_RESOURCE) {
1898+ blk_mq_request_bypass_insert(rq,
18891899 list_empty(list));
1890− else
1891− blk_mq_sched_insert_request(rq, false, true, false);
1900+ break;
1901+ }
1902+ blk_mq_end_request(rq, ret);
1903+ }
18921904 }
18931905
18941906 /*
@@ -1896,7 +1908,7 @@ void blk_mq_try_issue_list_directly(struct blk_mq_hw_ctx *hctx, · 1 unmodified line
18961908 * the driver there was more coming, but that turned out to
18971909 * be a lie.
18981910 */
1899− if (ret != BLK_STS_OK && hctx->queue->mq_ops->commit_rqs)
1911+ if (!list_empty(list) && hctx->queue->mq_ops->commit_rqs)
19001912 hctx->queue->mq_ops->commit_rqs(hctx);
19011913 }
19021914
@@ -2003,19 +2015,21 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) · 100 unmodified lines
20032015 plug->rq_count--;
20042016 }
20052017 blk_add_rq_to_plug(plug, rq);
2018+ trace_block_plug(q);
20062019
20072020 blk_mq_put_ctx(data.ctx);
20082021
20092022 if (same_queue_rq) {
20102023 data.hctx = same_queue_rq->mq_hctx;
2024+ trace_block_unplug(q, 1, true);
20112025 blk_mq_try_issue_directly(data.hctx, same_queue_rq,
2012− &cookie, false, true);
2026+ &cookie);
20132027 }
20142028 } else if ((q->nr_hw_queues > 1 && is_sync) || (!q->elevator &&
20152029 !data.hctx->dispatch_busy)) {
20162030 blk_mq_put_ctx(data.ctx);
20172031 blk_mq_bio_to_request(rq, bio);
2018− blk_mq_try_issue_directly(data.hctx, rq, &cookie, false, true);
2032+ blk_mq_try_issue_directly(data.hctx, rq, &cookie);
20192033 } else {
20202034 blk_mq_put_ctx(data.ctx);
20212035 blk_mq_bio_to_request(rq, bio);
@@ -2332,7 +2346,7 @@ static int blk_mq_init_hctx(struct request_queue *q, · 310 unmodified lines
23322346 return 0;
23332347
23342348 free_fq:
2335− kfree(hctx->fq);
2349+ blk_free_flush_queue(hctx->fq);
23362350 exit_hctx:
23372351 if (set->ops->exit_hctx)
23382352 set->ops->exit_hctx(hctx, hctx_idx);
@@ -3121,6 +3135,8 @@ int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr) · 782 unmodified lines
31213135 }
31223136 if (ret)
31233137 break;
3138+ if (q->elevator && q->elevator->type->ops.depth_updated)
3139+ q->elevator->type->ops.depth_updated(hctx);
31243140 }
31253141
31263142 if (!ret)
block/blk-mq.h+2−4
@@ -70,10 +70,8 @@ void blk_mq_request_bypass_insert(struct request *rq, bool run_queue); · 69 unmodified lines
7070 void blk_mq_insert_requests(struct blk_mq_hw_ctx *hctx, struct blk_mq_ctx *ctx,
7171 struct list_head *list);
7272
73−blk_status_t blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx,
74− struct request *rq,
75− blk_qc_t *cookie,
76− bool bypass, bool last);
73+/* Used by blk_insert_cloned_request() to issue request directly */
74+blk_status_t blk_mq_request_issue_directly(struct request *rq, bool last);
7775 void blk_mq_try_issue_list_directly(struct blk_mq_hw_ctx *hctx,
7876 struct list_head *list);
7977
crypto/testmgr.h+43−1
@@ -5634,7 +5634,49 @@ static const struct hash_testvec poly1305_tv_template[] = { · 5633 unmodified lines
56345634 .psize = 80,
56355635 .digest = "\x13\x00\x00\x00\x00\x00\x00\x00"
56365636 "\x00\x00\x00\x00\x00\x00\x00\x00",
5637− },
5637+ }, { /* Regression test for overflow in AVX2 implementation */
5638+ .plaintext = "\xff\xff\xff\xff\xff\xff\xff\xff"
5639+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5640+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5641+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5642+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5643+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5644+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5645+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5646+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5647+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5648+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5649+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5650+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5651+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5652+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5653+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5654+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5655+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5656+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5657+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5658+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5659+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5660+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5661+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5662+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5663+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5664+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5665+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5666+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5667+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5668+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5669+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5670+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5671+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5672+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5673+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5674+ "\xff\xff\xff\xff\xff\xff\xff\xff"
5675+ "\xff\xff\xff\xff",
5676+ .psize = 300,
5677+ .digest = "\xfb\x5e\x96\xd8\x61\xd5\xc7\xc8"
5678+ "\x78\xe5\x87\xcc\x2d\x5a\x22\xe1",
5679+ }
56385680 };
56395681
56405682 /* NHPoly1305 test vectors from https://github.com/google/adiantum */
drivers/acpi/acpica/evgpe.c+5−1
@@ -81,8 +81,12 @@ acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info) · 80 unmodified lines
8181
8282 ACPI_FUNCTION_TRACE(ev_enable_gpe);
8383
84− /* Enable the requested GPE */
84+ /* Clear the GPE status */
85+ status = acpi_hw_clear_gpe(gpe_event_info);
86+ if (ACPI_FAILURE(status))
87+ return_ACPI_STATUS(status);
8588
89+ /* Enable the requested GPE */
8690 status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_ENABLE);
8791 return_ACPI_STATUS(status);
8892 }
drivers/acpi/acpica/nsobject.c+4−0
@@ -186,6 +186,10 @@ void acpi_ns_detach_object(struct acpi_namespace_node *node) · 185 unmodified lines
186186 }
187187 }
188188
189+ if (obj_desc->common.type == ACPI_TYPE_REGION) {
190+ acpi_ut_remove_address_range(obj_desc->region.space_id, node);
191+ }
192+
189193 /* Clear the Node entry in all cases */
190194
191195 node->object = NULL;
drivers/acpi/nfit/core.c+6−6
@@ -567,6 +567,12 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm, · 566 unmodified lines
567567 goto out;
568568 }
569569
570+ dev_dbg(dev, "%s cmd: %s output length: %d\n", dimm_name,
571+ cmd_name, out_obj->buffer.length);
572+ print_hex_dump_debug(cmd_name, DUMP_PREFIX_OFFSET, 4, 4,
573+ out_obj->buffer.pointer,
574+ min_t(u32, 128, out_obj->buffer.length), true);
575+
570576 if (call_pkg) {
571577 call_pkg->nd_fw_size = out_obj->buffer.length;
572578 memcpy(call_pkg->nd_payload + call_pkg->nd_size_in,
@@ -585,12 +591,6 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm, · 12 unmodified lines
585591 return 0;
586592 }
587593
588− dev_dbg(dev, "%s cmd: %s output length: %d\n", dimm_name,
589− cmd_name, out_obj->buffer.length);
590− print_hex_dump_debug(cmd_name, DUMP_PREFIX_OFFSET, 4, 4,
591− out_obj->buffer.pointer,
592− min_t(u32, 128, out_obj->buffer.length), true);
593−
594594 for (i = 0, offset = 0; i < desc->out_num; i++) {
595595 u32 out_size = nd_cmd_out_size(nvdimm, cmd, desc, i, buf,
596596 (u32 *) out_obj->buffer.pointer,
drivers/acpi/nfit/intel.c+4−6
@@ -122,9 +122,8 @@ static int intel_security_change_key(struct nvdimm *nvdimm, · 121 unmodified lines
122122 if (!test_bit(cmd, &nfit_mem->dsm_mask))
123123 return -ENOTTY;
124124
125− if (old_data)
126− memcpy(nd_cmd.cmd.old_pass, old_data->data,
127− sizeof(nd_cmd.cmd.old_pass));
125+ memcpy(nd_cmd.cmd.old_pass, old_data->data,
126+ sizeof(nd_cmd.cmd.old_pass));
128127 memcpy(nd_cmd.cmd.new_pass, new_data->data,
129128 sizeof(nd_cmd.cmd.new_pass));
130129 rc = nvdimm_ctl(nvdimm, ND_CMD_CALL, &nd_cmd, sizeof(nd_cmd), NULL);
@@ -336,9 +335,8 @@ static int __maybe_unused intel_security_overwrite(struct nvdimm *nvdimm, · 205 unmodified lines
336335
337336 /* flush all cache before we erase DIMM */
338337 nvdimm_invalidate_cache();
339− if (nkey)
340− memcpy(nd_cmd.cmd.passphrase, nkey->data,
341− sizeof(nd_cmd.cmd.passphrase));
338+ memcpy(nd_cmd.cmd.passphrase, nkey->data,
339+ sizeof(nd_cmd.cmd.passphrase));
342340 rc = nvdimm_ctl(nvdimm, ND_CMD_CALL, &nd_cmd, sizeof(nd_cmd), NULL);
343341 if (rc < 0)
344342 return rc;
drivers/base/memory.c+1−1
@@ -506,7 +506,7 @@ static ssize_t probe_store(struct device *dev, struct device_attribute *attr, · 505 unmodified lines
506506
507507 ret = lock_device_hotplug_sysfs();
508508 if (ret)
509− goto out;
509+ return ret;
510510
511511 nid = memory_add_physaddr_to_nid(phys_addr);
512512 ret = __add_memory(nid, phys_addr,
drivers/block/null_blk_main.c+5−0
@@ -1748,6 +1748,11 @@ static int __init null_init(void) · 1747 unmodified lines
17481748 return -EINVAL;
17491749 }
17501750
1751+ if (g_home_node != NUMA_NO_NODE && g_home_node >= nr_online_nodes) {
1752+ pr_err("null_blk: invalid home_node value\n");
1753+ g_home_node = NUMA_NO_NODE;
1754+ }
1755+
17511756 if (g_queue_mode == NULL_Q_RQ) {
17521757 pr_err("null_blk: legacy IO path no longer available\n");
17531758 return -EINVAL;
drivers/block/paride/pcd.c+13−1
@@ -314,6 +314,7 @@ static void pcd_init_units(void) · 313 unmodified lines
314314 disk->queue = blk_mq_init_sq_queue(&cd->tag_set, &pcd_mq_ops,
315315 1, BLK_MQ_F_SHOULD_MERGE);
316316 if (IS_ERR(disk->queue)) {
317+ put_disk(disk);
317318 disk->queue = NULL;
318319 continue;
319320 }
@@ -751,6 +752,8 @@ static int pcd_detect(void) · 431 unmodified lines
751752
752753 printk("%s: No CD-ROM drive found\n", name);
753754 for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) {
755+ if (!cd->disk)
756+ continue;
754757 blk_cleanup_queue(cd->disk->queue);
755758 cd->disk->queue = NULL;
756759 blk_mq_free_tag_set(&cd->tag_set);
@@ -1011,8 +1014,14 @@ static int __init pcd_init(void) · 254 unmodified lines
10111014 pcd_probe_capabilities();
10121015
10131016 if (register_blkdev(major, name)) {
1014− for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++)
1017+ for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) {
1018+ if (!cd->disk)
1019+ continue;
1020+
1021+ blk_cleanup_queue(cd->disk->queue);
1022+ blk_mq_free_tag_set(&cd->tag_set);
10151023 put_disk(cd->disk);
1024+ }
10161025 return -EBUSY;
10171026 }
10181027
@@ -1033,6 +1042,9 @@ static void __exit pcd_exit(void) · 14 unmodified lines
10331042 int unit;
10341043
10351044 for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) {
1045+ if (!cd->disk)
1046+ continue;
1047+
10361048 if (cd->present) {
10371049 del_gendisk(cd->disk);
10381050 pi_release(cd->pi);
drivers/block/paride/pf.c+11−1
@@ -763,6 +763,8 @@ static int pf_detect(void) · 762 unmodified lines
763763
764764 printk("%s: No ATAPI disk detected\n", name);
765765 for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) {
766+ if (!pf->disk)
767+ continue;
766768 blk_cleanup_queue(pf->disk->queue);
767769 pf->disk->queue = NULL;
768770 blk_mq_free_tag_set(&pf->tag_set);
@@ -1030,8 +1032,13 @@ static int __init pf_init(void) · 261 unmodified lines
10301032 pf_busy = 0;
10311033
10321034 if (register_blkdev(major, name)) {
1033− for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++)
1035+ for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) {
1036+ if (!pf->disk)
1037+ continue;
1038+ blk_cleanup_queue(pf->disk->queue);
1039+ blk_mq_free_tag_set(&pf->tag_set);
10341040 put_disk(pf->disk);
1041+ }
10351042 return -EBUSY;
10361043 }
10371044
@@ -1052,6 +1059,9 @@ static void __exit pf_exit(void) · 14 unmodified lines
10521059 int unit;
10531060 unregister_blkdev(major, name);
10541061 for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) {
1062+ if (!pf->disk)
1063+ continue;
1064+
10551065 if (pf->present)
10561066 del_gendisk(pf->disk);
10571067
drivers/block/virtio_blk.c+2−0
@@ -513,6 +513,8 @@ static int init_vq(struct virtio_blk *vblk) · 512 unmodified lines
513513 if (err)
514514 num_vqs = 1;
515515
516+ num_vqs = min_t(unsigned int, nr_cpu_ids, num_vqs);
517+
516518 vblk->vqs = kmalloc_array(num_vqs, sizeof(*vblk->vqs), GFP_KERNEL);
517519 if (!vblk->vqs)
518520 return -ENOMEM;
drivers/block/xsysace.c+2−0
@@ -1091,6 +1091,8 @@ static int ace_setup(struct ace_device *ace) · 1090 unmodified lines
10911091 return 0;
10921092
10931093 err_read:
1094+ /* prevent double queue cleanup */
1095+ ace->gd->queue = NULL;
10941096 put_disk(ace->gd);
10951097 err_alloc_disk:
10961098 blk_cleanup_queue(ace->queue);
drivers/bluetooth/btusb.c+1−1
@@ -2942,6 +2942,7 @@ static int btusb_config_oob_wake(struct hci_dev *hdev) · 2941 unmodified lines
29422942 return 0;
29432943 }
29442944
2945+ irq_set_status_flags(irq, IRQ_NOAUTOEN);
29452946 ret = devm_request_irq(&hdev->dev, irq, btusb_oob_wake_handler,
29462947 0, "OOB Wake-on-BT", data);
29472948 if (ret) {
@@ -2956,7 +2957,6 @@ static int btusb_config_oob_wake(struct hci_dev *hdev) · 8 unmodified lines
29562957 }
29572958
29582959 data->oob_wake_irq = irq;
2959− disable_irq(irq);
29602960 bt_dev_info(hdev, "OOB Wake-on-BT configured at IRQ %u", irq);
29612961 return 0;
29622962 }
drivers/char/Kconfig+1−1
@@ -348,7 +348,7 @@ config XILINX_HWICAP · 347 unmodified lines
348348
349349 config R3964
350350 tristate "Siemens R3964 line discipline"
351− depends on TTY
351+ depends on TTY && BROKEN
352352 ---help---
353353 This driver allows synchronous communication with devices using the
354354 Siemens R3964 packet protocol. Unless you are dealing with special
drivers/char/ipmi/ipmi_dmi.c+0−1
@@ -66,7 +66,6 @@ static void __init dmi_add_platform_ipmi(unsigned long base_addr, · 65 unmodified lines
6666 return;
6767 }
6868
69− memset(&p, 0, sizeof(p));
7069 p.addr = base_addr;
7170 p.space = space;
7271 p.regspacing = offset;
drivers/char/ipmi/ipmi_msghandler.c+17−2
@@ -214,6 +214,9 @@ struct ipmi_user { · 213 unmodified lines
214214
215215 /* Does this interface receive IPMI events? */
216216 bool gets_events;
217+
218+ /* Free must run in process context for RCU cleanup. */
219+ struct work_struct remove_work;
217220 };
218221
219222 static struct ipmi_user *acquire_ipmi_user(struct ipmi_user *user, int *index)
@@ -1157,6 +1160,15 @@ static int intf_err_seq(struct ipmi_smi *intf, · 937 unmodified lines
11571160 return rv;
11581161 }
11591162
1163+static void free_user_work(struct work_struct *work)
1164+{
1165+ struct ipmi_user *user = container_of(work, struct ipmi_user,
1166+ remove_work);
1167+
1168+ cleanup_srcu_struct(&user->release_barrier);
1169+ kfree(user);
1170+}
1171+
11601172 int ipmi_create_user(unsigned int if_num,
11611173 const struct ipmi_user_hndl *handler,
11621174 void *handler_data,
@@ -1200,6 +1212,8 @@ int ipmi_create_user(unsigned int if_num, · 37 unmodified lines
12001212 goto out_kfree;
12011213
12021214 found:
1215+ INIT_WORK(&new_user->remove_work, free_user_work);
1216+
12031217 rv = init_srcu_struct(&new_user->release_barrier);
12041218 if (rv)
12051219 goto out_kfree;
@@ -1260,8 +1274,9 @@ EXPORT_SYMBOL(ipmi_get_smi_info); · 54 unmodified lines
12601274 static void free_user(struct kref *ref)
12611275 {
12621276 struct ipmi_user *user = container_of(ref, struct ipmi_user, refcount);
1263− cleanup_srcu_struct(&user->release_barrier);
1264− kfree(user);
1277+
1278+ /* SRCU cleanup must happen in task context. */
1279+ schedule_work(&user->remove_work);
12651280 }
12661281
12671282 static void _ipmi_destroy_user(struct ipmi_user *user)
drivers/char/ipmi/ipmi_si_hardcode.c+2−0
@@ -118,6 +118,8 @@ void __init ipmi_hardcode_init(void) · 117 unmodified lines
118118 char *str;
119119 char *si_type[SI_MAX_PARMS];
120120
121+ memset(si_type, 0, sizeof(si_type));
122+
121123 /* Parse out the si_type string into its components. */
122124 str = si_type_str;
123125 if (*str != '\0') {
drivers/char/tpm/eventlog/tpm2.c+2−2
@@ -37,8 +37,8 @@ · 36 unmodified lines
3737 *
3838 * Returns size of the event. If it is an invalid event, returns 0.
3939 */
40−static int calc_tpm2_event_size(struct tcg_pcr_event2_head *event,
41− struct tcg_pcr_event *event_header)
40+static size_t calc_tpm2_event_size(struct tcg_pcr_event2_head *event,
41+ struct tcg_pcr_event *event_header)
4242 {
4343 struct tcg_efi_specid_event_head *efispecid;
4444 struct tcg_event_field *event_field;
drivers/char/tpm/tpm-dev-common.c+8−1
@@ -233,12 +233,19 @@ __poll_t tpm_common_poll(struct file *file, poll_table *wait) · 232 unmodified lines
233233 __poll_t mask = 0;
234234
235235 poll_wait(file, &priv->async_wait, wait);
236+ mutex_lock(&priv->buffer_mutex);
236237
237− if (!priv->response_read || priv->response_length)
238+ /*
239+ * The response_length indicates if there is still response
240+ * (or part of it) to be consumed. Partial reads decrease it
241+ * by the number of bytes read, and write resets it the zero.
242+ */
243+ if (priv->response_length)
238244 mask = EPOLLIN | EPOLLRDNORM;
239245 else
240246 mask = EPOLLOUT | EPOLLWRNORM;
241247
248+ mutex_unlock(&priv->buffer_mutex);
242249 return mask;
243250 }
244251
drivers/char/tpm/tpm-interface.c+6−8
@@ -402,15 +402,13 @@ int tpm_pm_suspend(struct device *dev) · 401 unmodified lines
402402 if (chip->flags & TPM_CHIP_FLAG_ALWAYS_POWERED)
403403 return 0;
404404
405− if (chip->flags & TPM_CHIP_FLAG_TPM2) {
406− mutex_lock(&chip->tpm_mutex);
407− if (!tpm_chip_start(chip)) {
405+ if (!tpm_chip_start(chip)) {
406+ if (chip->flags & TPM_CHIP_FLAG_TPM2)
408407 tpm2_shutdown(chip, TPM2_SU_STATE);
409− tpm_chip_stop(chip);
410− }
411− mutex_unlock(&chip->tpm_mutex);
412− } else {
413− rc = tpm1_pm_suspend(chip, tpm_suspend_pcr);
408+ else
409+ rc = tpm1_pm_suspend(chip, tpm_suspend_pcr);
410+
411+ tpm_chip_stop(chip);
414412 }
415413
416414 return rc;
drivers/clk/at91/clk-programmable.c+43−14
@@ -20,8 +20,7 @@ · 19 unmodified lines
2020 #define PROG_ID_MAX 7
2121
2222 #define PROG_STATUS_MASK(id) (1 << ((id) + 8))
23−#define PROG_PRES_MASK 0x7
24−#define PROG_PRES(layout, pckr) ((pckr >> layout->pres_shift) & PROG_PRES_MASK)
23+#define PROG_PRES(layout, pckr) ((pckr >> layout->pres_shift) & layout->pres_mask)
2524 #define PROG_MAX_RM9200_CSS 3
2625
2726 struct clk_programmable {
@@ -37,20 +36,29 @@ static unsigned long clk_programmable_recalc_rate(struct clk_hw *hw, · 9 unmodified lines
3736 unsigned long parent_rate)
3837 {
3938 struct clk_programmable *prog = to_clk_programmable(hw);
39+ const struct clk_programmable_layout *layout = prog->layout;
4040 unsigned int pckr;
41+ unsigned long rate;
4142
4243 regmap_read(prog->regmap, AT91_PMC_PCKR(prog->id), &pckr);
4344
44− return parent_rate >> PROG_PRES(prog->layout, pckr);
45+ if (layout->is_pres_direct)
46+ rate = parent_rate / (PROG_PRES(layout, pckr) + 1);
47+ else
48+ rate = parent_rate >> PROG_PRES(layout, pckr);
49+
50+ return rate;
4551 }
4652
4753 static int clk_programmable_determine_rate(struct clk_hw *hw,
4854 struct clk_rate_request *req)
4955 {
56+ struct clk_programmable *prog = to_clk_programmable(hw);
57+ const struct clk_programmable_layout *layout = prog->layout;
5058 struct clk_hw *parent;
5159 long best_rate = -EINVAL;
5260 unsigned long parent_rate;
53− unsigned long tmp_rate;
61+ unsigned long tmp_rate = 0;
5462 int shift;
5563 int i;
5664
@@ -60,10 +68,18 @@ static int clk_programmable_determine_rate(struct clk_hw *hw, · 3 unmodified lines
6068 continue;
6169
6270 parent_rate = clk_hw_get_rate(parent);
63− for (shift = 0; shift < PROG_PRES_MASK; shift++) {
64− tmp_rate = parent_rate >> shift;
65− if (tmp_rate <= req->rate)
66− break;
71+ if (layout->is_pres_direct) {
72+ for (shift = 0; shift <= layout->pres_mask; shift++) {
73+ tmp_rate = parent_rate / (shift + 1);
74+ if (tmp_rate <= req->rate)
75+ break;
76+ }
77+ } else {
78+ for (shift = 0; shift < layout->pres_mask; shift++) {
79+ tmp_rate = parent_rate >> shift;
80+ if (tmp_rate <= req->rate)
81+ break;
82+ }
6783 }
6884
6985 if (tmp_rate > req->rate)
@@ -137,16 +153,23 @@ static int clk_programmable_set_rate(struct clk_hw *hw, unsigned long rate, · 67 unmodified lines
137153 if (!div)
138154 return -EINVAL;
139155
140− shift = fls(div) - 1;
156+ if (layout->is_pres_direct) {
157+ shift = div - 1;
141158
142− if (div != (1 << shift))
143− return -EINVAL;
159+ if (shift > layout->pres_mask)
160+ return -EINVAL;
161+ } else {
162+ shift = fls(div) - 1;
144163
145− if (shift >= PROG_PRES_MASK)
146− return -EINVAL;
164+ if (div != (1 << shift))
165+ return -EINVAL;
166+
167+ if (shift >= layout->pres_mask)
168+ return -EINVAL;
169+ }
147170
148171 regmap_update_bits(prog->regmap, AT91_PMC_PCKR(prog->id),
149− PROG_PRES_MASK << layout->pres_shift,
172+ layout->pres_mask << layout->pres_shift,
150173 shift << layout->pres_shift);
151174
152175 return 0;
@@ -202,19 +225,25 @@ at91_clk_register_programmable(struct regmap *regmap, · 49 unmodified lines
202225 }
203226
204227 const struct clk_programmable_layout at91rm9200_programmable_layout = {
228+ .pres_mask = 0x7,
205229 .pres_shift = 2,
206230 .css_mask = 0x3,
207231 .have_slck_mck = 0,
232+ .is_pres_direct = 0,
208233 };
209234
210235 const struct clk_programmable_layout at91sam9g45_programmable_layout = {
236+ .pres_mask = 0x7,
211237 .pres_shift = 2,
212238 .css_mask = 0x3,
213239 .have_slck_mck = 1,
240+ .is_pres_direct = 0,
214241 };
215242
216243 const struct clk_programmable_layout at91sam9x5_programmable_layout = {
244+ .pres_mask = 0x7,
217245 .pres_shift = 4,
218246 .css_mask = 0x7,
219247 .have_slck_mck = 0,
248+ .is_pres_direct = 0,
220249 };
drivers/clk/at91/pmc.h+2−0
@@ -71,9 +71,11 @@ struct clk_pll_characteristics { · 70 unmodified lines
7171 };
7272
7373 struct clk_programmable_layout {
74+ u8 pres_mask;
7475 u8 pres_shift;
7576 u8 css_mask;
7677 u8 have_slck_mck;
78+ u8 is_pres_direct;
7779 };
7880
7981 extern const struct clk_programmable_layout at91rm9200_programmable_layout;
drivers/clk/at91/sama5d2.c+9−1
@@ -125,6 +125,14 @@ static const struct { · 124 unmodified lines
125125 .pll = true },
126126 };
127127
128+static const struct clk_programmable_layout sama5d2_programmable_layout = {
129+ .pres_mask = 0xff,
130+ .pres_shift = 4,
131+ .css_mask = 0x7,
132+ .have_slck_mck = 0,
133+ .is_pres_direct = 1,
134+};
135+
128136 static void __init sama5d2_pmc_setup(struct device_node *np)
129137 {
130138 struct clk_range range = CLK_RANGE(0, 0);
@@ -249,7 +257,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np) · 118 unmodified lines
249257
250258 hw = at91_clk_register_programmable(regmap, name,
251259 parent_names, 6, i,
252− &at91sam9x5_programmable_layout);
260+ &sama5d2_programmable_layout);
253261 if (IS_ERR(hw))
254262 goto err_free;
255263 }
drivers/clk/imx/clk-pll14xx.c+1−1
@@ -362,7 +362,7 @@ struct clk *imx_clk_pll14xx(const char *name, const char *parent_name, · 361 unmodified lines
362362
363363 switch (pll_clk->type) {
364364 case PLL_1416X:
365− if (!pll->rate_table)
365+ if (!pll_clk->rate_table)
366366 init.ops = &clk_pll1416x_min_ops;
367367 else
368368 init.ops = &clk_pll1416x_ops;
drivers/clk/mediatek/clk-gate.c+1−2
@@ -169,11 +169,10 @@ struct clk *mtk_clk_register_gate( · 168 unmodified lines
169169 return ERR_PTR(-ENOMEM);
170170
171171 init.name = name;
172− init.flags = CLK_SET_RATE_PARENT;
172+ init.flags = flags | CLK_SET_RATE_PARENT;
173173 init.parent_names = parent_name ? &parent_name : NULL;
174174 init.num_parents = parent_name ? 1 : 0;
175175 init.ops = ops;
176− init.flags = flags;
177176
178177 cg->regmap = regmap;
179178 cg->set_ofs = set_ofs;
drivers/clk/meson/clk-pll.c+1−1
@@ -120,7 +120,7 @@ static bool meson_clk_pll_is_better(unsigned long rate, · 119 unmodified lines
120120 return true;
121121 } else {
122122 /* Round down */
123− if (now < rate && best < now)
123+ if (now <= rate && best < now)
124124 return true;
125125 }
126126
drivers/clk/meson/g12a.c+3−3
@@ -960,14 +960,14 @@ static struct clk_regmap g12a_sd_emmc_c_clk0 = { · 959 unmodified lines
960960 /* VPU Clock */
961961
962962 static const char * const g12a_vpu_parent_names[] = {
963− "fclk_div4", "fclk_div3", "fclk_div5", "fclk_div7",
963+ "fclk_div3", "fclk_div4", "fclk_div5", "fclk_div7",
964964 "mpll1", "vid_pll", "hifi_pll", "gp0_pll",
965965 };
966966
967967 static struct clk_regmap g12a_vpu_0_sel = {
968968 .data = &(struct clk_regmap_mux_data){
969969 .offset = HHI_VPU_CLK_CNTL,
970− .mask = 0x3,
970+ .mask = 0x7,
971971 .shift = 9,
972972 },
973973 .hw.init = &(struct clk_init_data){
@@ -1011,7 +1011,7 @@ static struct clk_regmap g12a_vpu_0 = { · 37 unmodified lines
10111011 static struct clk_regmap g12a_vpu_1_sel = {
10121012 .data = &(struct clk_regmap_mux_data){
10131013 .offset = HHI_VPU_CLK_CNTL,
1014− .mask = 0x3,
1014+ .mask = 0x7,
10151015 .shift = 25,
10161016 },
10171017 .hw.init = &(struct clk_init_data){
drivers/clk/meson/gxbb.c+2−0
@@ -2216,6 +2216,7 @@ static struct clk_regmap gxbb_vdec_1_div = { · 2215 unmodified lines
22162216 .offset = HHI_VDEC_CLK_CNTL,
22172217 .shift = 0,
22182218 .width = 7,
2219+ .flags = CLK_DIVIDER_ROUND_CLOSEST,
22192220 },
22202221 .hw.init = &(struct clk_init_data){
22212222 .name = "vdec_1_div",
@@ -2261,6 +2262,7 @@ static struct clk_regmap gxbb_vdec_hevc_div = { · 39 unmodified lines
22612262 .offset = HHI_VDEC2_CLK_CNTL,
22622263 .shift = 16,
22632264 .width = 7,
2265+ .flags = CLK_DIVIDER_ROUND_CLOSEST,
22642266 },
22652267 .hw.init = &(struct clk_init_data){
22662268 .name = "vdec_hevc_div",
drivers/clk/meson/vid-pll-div.c+2−2
@@ -82,8 +82,8 @@ static unsigned long meson_vid_pll_div_recalc_rate(struct clk_hw *hw, · 81 unmodified lines
8282 div = _get_table_val(meson_parm_read(clk->map, &pll_div->val),
8383 meson_parm_read(clk->map, &pll_div->sel));
8484 if (!div || !div->divider) {
85− pr_info("%s: Invalid config value for vid_pll_div\n", __func__);
86− return parent_rate;
85+ pr_debug("%s: Invalid config value for vid_pll_div\n", __func__);
86+ return 0;
8787 }
8888
8989 return DIV_ROUND_UP_ULL(parent_rate * div->multiplier, div->divider);
drivers/clk/x86/clk-pmc-atom.c+11−3
@@ -165,7 +165,7 @@ static const struct clk_ops plt_clk_ops = { · 164 unmodified lines
165165 };
166166
167167 static struct clk_plt *plt_clk_register(struct platform_device *pdev, int id,
168− void __iomem *base,
168+ const struct pmc_clk_data *pmc_data,
169169 const char **parent_names,
170170 int num_parents)
171171 {
@@ -184,9 +184,17 @@ static struct clk_plt *plt_clk_register(struct platform_device *pdev, int id, · 12 unmodified lines
184184 init.num_parents = num_parents;
185185
186186 pclk->hw.init = &init;
187− pclk->reg = base + PMC_CLK_CTL_OFFSET + id * PMC_CLK_CTL_SIZE;
187+ pclk->reg = pmc_data->base + PMC_CLK_CTL_OFFSET + id * PMC_CLK_CTL_SIZE;
188188 spin_lock_init(&pclk->lock);
189189
190+ /*
191+ * On some systems, the pmc_plt_clocks already enabled by the
192+ * firmware are being marked as critical to avoid them being
193+ * gated by the clock framework.
194+ */
195+ if (pmc_data->critical && plt_clk_is_enabled(&pclk->hw))
196+ init.flags |= CLK_IS_CRITICAL;
197+
190198 ret = devm_clk_hw_register(&pdev->dev, &pclk->hw);
191199 if (ret) {
192200 pclk = ERR_PTR(ret);
@@ -332,7 +340,7 @@ static int plt_clk_probe(struct platform_device *pdev) · 139 unmodified lines
332340 return PTR_ERR(parent_names);
333341
334342 for (i = 0; i < PMC_CLK_NUM; i++) {
335− data->clks[i] = plt_clk_register(pdev, i, pmc_data->base,
343+ data->clks[i] = plt_clk_register(pdev, i, pmc_data,
336344 parent_names, data->nparents);
337345 if (IS_ERR(data->clks[i])) {
338346 err = PTR_ERR(data->clks[i]);
drivers/clocksource/Kconfig+1−0
@@ -145,6 +145,7 @@ config VT8500_TIMER · 144 unmodified lines
145145 config NPCM7XX_TIMER
146146 bool "NPCM7xx timer driver" if COMPILE_TEST
147147 depends on HAS_IOMEM
148+ select TIMER_OF
148149 select CLKSRC_MMIO
149150 help
150151 Enable 24-bit TIMER0 and TIMER1 counters in the NPCM7xx architecture,
drivers/clocksource/arm_arch_timer.c+1−4
@@ -9,7 +9,7 @@ · 8 unmodified lines
99 * published by the Free Software Foundation.
1010 */
1111
12−#define pr_fmt(fmt) "arm_arch_timer: " fmt
12+#define pr_fmt(fmt) "arch_timer: " fmt
1313
1414 #include <linux/init.h>
1515 #include <linux/kernel.h>
@@ -33,9 +33,6 @@ · 17 unmodified lines
3333
3434 #include <clocksource/arm_arch_timer.h>
3535
36−#undef pr_fmt
37−#define pr_fmt(fmt) "arch_timer: " fmt
38−
3936 #define CNTTIDR 0x08
4037 #define CNTTIDR_VIRT(n) (BIT(1) << ((n) * 4))
4138
drivers/clocksource/timer-oxnas-rps.c+1−1
@@ -296,4 +296,4 @@ err_alloc: · 295 unmodified lines
296296 TIMER_OF_DECLARE(ox810se_rps,
297297 "oxsemi,ox810se-rps-timer", oxnas_rps_timer_init);
298298 TIMER_OF_DECLARE(ox820_rps,
299− "oxsemi,ox820se-rps-timer", oxnas_rps_timer_init);
299+ "oxsemi,ox820-rps-timer", oxnas_rps_timer_init);
drivers/clocksource/timer-ti-dm.c+0−28
@@ -585,34 +585,6 @@ static int omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload, · 584 unmodified lines
585585 return 0;
586586 }
587587
588−/* Optimized set_load which removes costly spin wait in timer_start */
589−static int omap_dm_timer_set_load_start(struct omap_dm_timer *timer,
590− int autoreload, unsigned int load)
591−{
592− u32 l;
593−
594− if (unlikely(!timer))
595− return -EINVAL;
596−
597− omap_dm_timer_enable(timer);
598−
599− l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
600− if (autoreload) {
601− l |= OMAP_TIMER_CTRL_AR;
602− omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG, load);
603− } else {
604− l &= ~OMAP_TIMER_CTRL_AR;
605− }
606− l |= OMAP_TIMER_CTRL_ST;
607−
608− __omap_dm_timer_load_start(timer, l, load, timer->posted);
609−
610− /* Save the context */
611− timer->context.tclr = l;
612− timer->context.tldr = load;
613− timer->context.tcrr = load;
614− return 0;
615−}
616588 static int omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable,
617589 unsigned int match)
618590 {
drivers/cpufreq/intel_pstate.c+4−1
@@ -2596,6 +2596,9 @@ static int __init intel_pstate_init(void) · 2595 unmodified lines
25962596 const struct x86_cpu_id *id;
25972597 int rc;
25982598
2599+ if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
2600+ return -ENODEV;
2601+
25992602 if (no_load)
26002603 return -ENODEV;
26012604
@@ -2611,7 +2614,7 @@ static int __init intel_pstate_init(void) · 9 unmodified lines
26112614 } else {
26122615 id = x86_match_cpu(intel_pstate_cpu_ids);
26132616 if (!id) {
2614− pr_info("CPU ID not supported\n");
2617+ pr_info("CPU model not supported\n");
26152618 return -ENODEV;
26162619 }
26172620
drivers/crypto/caam/caamhash.c+6−7
@@ -865,19 +865,18 @@ static int ahash_update_ctx(struct ahash_request *req) · 864 unmodified lines
865865 if (ret)
866866 goto unmap_ctx;
867867
868− if (mapped_nents) {
868+ if (mapped_nents)
869869 sg_to_sec4_sg_last(req->src, mapped_nents,
870870 edesc->sec4_sg + sec4_sg_src_index,
871871 0);
872− if (*next_buflen)
873− scatterwalk_map_and_copy(next_buf, req->src,
874− to_hash - *buflen,
875− *next_buflen, 0);
876− } else {
872+ else
877873 sg_to_sec4_set_last(edesc->sec4_sg + sec4_sg_src_index -
878874 1);
879− }
880875
876+ if (*next_buflen)
877+ scatterwalk_map_and_copy(next_buf, req->src,
878+ to_hash - *buflen,
879+ *next_buflen, 0);
881880 desc = edesc->hw_desc;
882881
883882 edesc->sec4_sg_dma = dma_map_single(jrdev, edesc->sec4_sg,
drivers/extcon/Kconfig+1−1
@@ -116,7 +116,7 @@ config EXTCON_PALMAS · 115 unmodified lines
116116
117117 config EXTCON_PTN5150
118118 tristate "NXP PTN5150 CC LOGIC USB EXTCON support"
119− depends on I2C && GPIOLIB || COMPILE_TEST
119+ depends on I2C && (GPIOLIB || COMPILE_TEST)
120120 select REGMAP_I2C
121121 help
122122 Say Y here to enable support for USB peripheral and USB host
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c+15−4
@@ -3165,6 +3165,7 @@ static int amdgpu_device_recover_vram(struct amdgpu_device *adev) · 3164 unmodified lines
31653165
31663166 /* No need to recover an evicted BO */
31673167 if (shadow->tbo.mem.mem_type != TTM_PL_TT ||
3168+ shadow->tbo.mem.start == AMDGPU_BO_INVALID_OFFSET ||
31683169 shadow->parent->tbo.mem.mem_type != TTM_PL_VRAM)
31693170 continue;
31703171
@@ -3173,11 +3174,16 @@ static int amdgpu_device_recover_vram(struct amdgpu_device *adev) · 2 unmodified lines
31733174 break;
31743175
31753176 if (fence) {
3176− r = dma_fence_wait_timeout(fence, false, tmo);
3177+ tmo = dma_fence_wait_timeout(fence, false, tmo);
31773178 dma_fence_put(fence);
31783179 fence = next;
3179− if (r <= 0)
3180+ if (tmo == 0) {
3181+ r = -ETIMEDOUT;
31803182 break;
3183+ } else if (tmo < 0) {
3184+ r = tmo;
3185+ break;
3186+ }
31813187 } else {
31823188 fence = next;
31833189 }
@@ -3188,8 +3194,8 @@ static int amdgpu_device_recover_vram(struct amdgpu_device *adev) · 4 unmodified lines
31883194 tmo = dma_fence_wait_timeout(fence, false, tmo);
31893195 dma_fence_put(fence);
31903196
3191− if (r <= 0 || tmo <= 0) {
3192− DRM_ERROR("recover vram bo from shadow failed\n");
3197+ if (r < 0 || tmo <= 0) {
3198+ DRM_ERROR("recover vram bo from shadow failed, r is %ld, tmo is %ld\n", r, tmo);
31933199 return -EIO;
31943200 }
31953201
@@ -3625,6 +3631,7 @@ static void amdgpu_device_get_min_pci_speed_width(struct amdgpu_device *adev, · 429 unmodified lines
36253631 struct pci_dev *pdev = adev->pdev;
36263632 enum pci_bus_speed cur_speed;
36273633 enum pcie_link_width cur_width;
3634+ u32 ret = 1;
36283635
36293636 *speed = PCI_SPEED_UNKNOWN;
36303637 *width = PCIE_LNK_WIDTH_UNKNOWN;
@@ -3632,6 +3639,10 @@ static void amdgpu_device_get_min_pci_speed_width(struct amdgpu_device *adev, · 1 unmodified line
36323639 while (pdev) {
36333640 cur_speed = pcie_get_speed_cap(pdev);
36343641 cur_width = pcie_get_width_cap(pdev);
3642+ ret = pcie_bandwidth_available(adev->pdev, NULL,
3643+ NULL, &cur_width);
3644+ if (!ret)
3645+ cur_width = PCIE_LNK_WIDTH_RESRV;
36353646
36363647 if (cur_speed != PCI_SPEED_UNKNOWN) {
36373648 if (*speed == PCI_SPEED_UNKNOWN)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c+3−0
@@ -35,6 +35,7 @@ · 34 unmodified lines
3535 #include "amdgpu_trace.h"
3636
3737 #define AMDGPU_IB_TEST_TIMEOUT msecs_to_jiffies(1000)
38+#define AMDGPU_IB_TEST_GFX_XGMI_TIMEOUT msecs_to_jiffies(2000)
3839
3940 /*
4041 * IB
@@ -344,6 +345,8 @@ int amdgpu_ib_ring_tests(struct amdgpu_device *adev) · 303 unmodified lines
344345 * cost waiting for it coming back under RUNTIME only
345346 */
346347 tmo_gfx = 8 * AMDGPU_IB_TEST_TIMEOUT;
348+ } else if (adev->gmc.xgmi.hive_id) {
349+ tmo_gfx = AMDGPU_IB_TEST_GFX_XGMI_TIMEOUT;
347350 }
348351
349352 for (i = 0; i < adev->num_rings; ++i) {
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c+0−2
@@ -2405,8 +2405,6 @@ static int gfx_v9_0_rlc_resume(struct amdgpu_device *adev) · 2404 unmodified lines
24052405 /* disable CG */
24062406 WREG32_SOC15(GC, 0, mmRLC_CGCG_CGLS_CTRL, 0);
24072407
2408− adev->gfx.rlc.funcs->reset(adev);
2409−
24102408 gfx_v9_0_init_pg(adev);
24112409
24122410 if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP) {
drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c+1−0
@@ -182,6 +182,7 @@ static void mmhub_v1_0_init_cache_regs(struct amdgpu_device *adev) · 181 unmodified lines
182182 tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3,
183183 L2_CACHE_BIGK_FRAGMENT_SIZE, 6);
184184 }
185+ WREG32_SOC15(MMHUB, 0, mmVM_L2_CNTL3, tmp);
185186
186187 tmp = mmVM_L2_CNTL4_DEFAULT;
187188 tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, VMC_TAP_PDE_REQUEST_PHYSICAL, 0);
drivers/gpu/drm/amd/amdkfd/kfd_device.c+1−0
@@ -320,6 +320,7 @@ static const struct kfd_deviceid supported_devices[] = { · 319 unmodified lines
320320 { 0x9876, &carrizo_device_info }, /* Carrizo */
321321 { 0x9877, &carrizo_device_info }, /* Carrizo */
322322 { 0x15DD, &raven_device_info }, /* Raven */
323+ { 0x15D8, &raven_device_info }, /* Raven */
323324 #endif
324325 { 0x67A0, &hawaii_device_info }, /* Hawaii */
325326 { 0x67A1, &hawaii_device_info }, /* Hawaii */
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c+1−0
@@ -4533,6 +4533,7 @@ static void handle_cursor_update(struct drm_plane *plane, · 4532 unmodified lines
45334533 amdgpu_crtc->cursor_width = plane->state->crtc_w;
45344534 amdgpu_crtc->cursor_height = plane->state->crtc_h;
45354535
4536+ memset(&attributes, 0, sizeof(attributes));
45364537 attributes.address.high_part = upper_32_bits(address);
45374538 attributes.address.low_part = lower_32_bits(address);
45384539 attributes.width = plane->state->crtc_w;
drivers/gpu/drm/amd/display/dc/core/dc.c+19−0
@@ -1377,6 +1377,11 @@ static enum surface_update_type det_surface_update(const struct dc *dc, · 1376 unmodified lines
13771377 return UPDATE_TYPE_FULL;
13781378 }
13791379
1380+ if (u->surface->force_full_update) {
1381+ update_flags->bits.full_update = 1;
1382+ return UPDATE_TYPE_FULL;
1383+ }
1384+
13801385 type = get_plane_info_update_type(u);
13811386 elevate_update_type(&overall_type, type);
13821387
@@ -1802,6 +1807,14 @@ void dc_commit_updates_for_stream(struct dc *dc, · 419 unmodified lines
18021807 }
18031808
18041809 dc_resource_state_copy_construct(state, context);
1810+
1811+ for (i = 0; i < dc->res_pool->pipe_count; i++) {
1812+ struct pipe_ctx *new_pipe = &context->res_ctx.pipe_ctx[i];
1813+ struct pipe_ctx *old_pipe = &dc->current_state->res_ctx.pipe_ctx[i];
1814+
1815+ if (new_pipe->plane_state && new_pipe->plane_state != old_pipe->plane_state)
1816+ new_pipe->plane_state->force_full_update = true;
1817+ }
18051818 }
18061819
18071820
@@ -1838,6 +1851,12 @@ void dc_commit_updates_for_stream(struct dc *dc, · 30 unmodified lines
18381851 dc->current_state = context;
18391852 dc_release_state(old);
18401853
1854+ for (i = 0; i < dc->res_pool->pipe_count; i++) {
1855+ struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
1856+
1857+ if (pipe_ctx->plane_state && pipe_ctx->stream == stream)
1858+ pipe_ctx->plane_state->force_full_update = false;
1859+ }
18411860 }
18421861 /*let's use current_state to update watermark etc*/
18431862 if (update_type >= UPDATE_TYPE_FULL)
drivers/gpu/drm/amd/display/dc/core/dc_link.c+6−0
@@ -2660,12 +2660,18 @@ void core_link_enable_stream( · 2659 unmodified lines
26602660 void core_link_disable_stream(struct pipe_ctx *pipe_ctx, int option)
26612661 {
26622662 struct dc *core_dc = pipe_ctx->stream->ctx->dc;
2663+ struct dc_stream_state *stream = pipe_ctx->stream;
26632664
26642665 core_dc->hwss.blank_stream(pipe_ctx);
26652666
26662667 if (pipe_ctx->stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST)
26672668 deallocate_mst_payload(pipe_ctx);
26682669
2670+ if (dc_is_hdmi_signal(pipe_ctx->stream->signal))
2671+ dal_ddc_service_write_scdc_data(
2672+ stream->link->ddc, 0,
2673+ stream->timing.flags.LTE_340MCSC_SCRAMBLE);
2674+
26692675 core_dc->hwss.disable_stream(pipe_ctx, option);
26702676
26712677 disable_link(pipe_ctx->stream->link, pipe_ctx->stream->signal);
drivers/gpu/drm/amd/display/dc/dc.h+3−0
@@ -503,6 +503,9 @@ struct dc_plane_state { · 502 unmodified lines
503503 struct dc_plane_status status;
504504 struct dc_context *ctx;
505505
506+ /* HACK: Workaround for forcing full reprogramming under some conditions */
507+ bool force_full_update;
508+
506509 /* private to dc_surface.c */
507510 enum dc_irq_source irq_source;
508511 struct kref refcount;
drivers/gpu/drm/amd/display/dc/dce/dce_aux.c+6−3
@@ -190,6 +190,12 @@ static void submit_channel_request( · 189 unmodified lines
190190 1,
191191 0);
192192 }
193+
194+ REG_UPDATE(AUX_INTERRUPT_CONTROL, AUX_SW_DONE_ACK, 1);
195+
196+ REG_WAIT(AUX_SW_STATUS, AUX_SW_DONE, 0,
197+ 10, aux110->timeout_period/10);
198+
193199 /* set the delay and the number of bytes to write */
194200
195201 /* The length include
@@ -242,9 +248,6 @@ static void submit_channel_request( · 46 unmodified lines
242248 }
243249 }
244250
245− REG_UPDATE(AUX_INTERRUPT_CONTROL, AUX_SW_DONE_ACK, 1);
246− REG_WAIT(AUX_SW_STATUS, AUX_SW_DONE, 0,
247− 10, aux110->timeout_period/10);
248251 REG_UPDATE(AUX_SW_CONTROL, AUX_SW_GO, 1);
249252 }
250253
drivers/gpu/drm/amd/display/dc/dce/dce_aux.h+3−3
@@ -71,11 +71,11 @@ enum { /* This is the timeout as defined in DP 1.2a, · 70 unmodified lines
7171 * at most within ~240usec. That means,
7272 * increasing this timeout will not affect normal operation,
7373 * and we'll timeout after
74− * SW_AUX_TIMEOUT_PERIOD_MULTIPLIER * AUX_TIMEOUT_PERIOD = 1600usec.
74+ * SW_AUX_TIMEOUT_PERIOD_MULTIPLIER * AUX_TIMEOUT_PERIOD = 2400usec.
7575 * This timeout is especially important for
76− * resume from S3 and CTS.
76+ * converters, resume from S3, and CTS.
7777 */
78− SW_AUX_TIMEOUT_PERIOD_MULTIPLIER = 4
78+ SW_AUX_TIMEOUT_PERIOD_MULTIPLIER = 6
7979 };
8080
8181 struct dce_aux {
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c+2−21
@@ -1150,28 +1150,9 @@ void hubp1_cursor_set_position( · 1149 unmodified lines
11501150 REG_UPDATE(CURSOR_CONTROL,
11511151 CURSOR_ENABLE, cur_en);
11521152
1153− //account for cases where we see negative offset relative to overlay plane
1154− if (src_x_offset < 0 && src_y_offset < 0) {
1155− REG_SET_2(CURSOR_POSITION, 0,
1156− CURSOR_X_POSITION, 0,
1157− CURSOR_Y_POSITION, 0);
1158− x_hotspot -= src_x_offset;
1159− y_hotspot -= src_y_offset;
1160− } else if (src_x_offset < 0) {
1161− REG_SET_2(CURSOR_POSITION, 0,
1162− CURSOR_X_POSITION, 0,
1163− CURSOR_Y_POSITION, pos->y);
1164− x_hotspot -= src_x_offset;
1165− } else if (src_y_offset < 0) {
1166− REG_SET_2(CURSOR_POSITION, 0,
1153+ REG_SET_2(CURSOR_POSITION, 0,
11671154 CURSOR_X_POSITION, pos->x,
1168− CURSOR_Y_POSITION, 0);
1169− y_hotspot -= src_y_offset;
1170− } else {
1171− REG_SET_2(CURSOR_POSITION, 0,
1172− CURSOR_X_POSITION, pos->x,
1173− CURSOR_Y_POSITION, pos->y);
1174− }
1155+ CURSOR_Y_POSITION, pos->y);
11751156
11761157 REG_SET_2(CURSOR_HOT_SPOT, 0,
11771158 CURSOR_HOT_SPOT_X, x_hotspot,
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c+18−2
@@ -91,6 +91,12 @@ static void vega20_set_default_registry_data(struct pp_hwmgr *hwmgr) · 90 unmodified lines
9191 * MP0CLK DS
9292 */
9393 data->registry_data.disallowed_features = 0xE0041C00;
94+ /* ECC feature should be disabled on old SMUs */
95+ smum_send_msg_to_smc(hwmgr, PPSMC_MSG_GetSmuVersion);
96+ hwmgr->smu_version = smum_get_argument(hwmgr);
97+ if (hwmgr->smu_version < 0x282100)
98+ data->registry_data.disallowed_features |= FEATURE_ECC_MASK;
99+
94100 data->registry_data.od_state_in_dc_support = 0;
95101 data->registry_data.thermal_support = 1;
96102 data->registry_data.skip_baco_hardware = 0;
@@ -357,6 +363,7 @@ static void vega20_init_dpm_defaults(struct pp_hwmgr *hwmgr) · 260 unmodified lines
357363 data->smu_features[GNLD_DS_MP1CLK].smu_feature_id = FEATURE_DS_MP1CLK_BIT;
358364 data->smu_features[GNLD_DS_MP0CLK].smu_feature_id = FEATURE_DS_MP0CLK_BIT;
359365 data->smu_features[GNLD_XGMI].smu_feature_id = FEATURE_XGMI_BIT;
366+ data->smu_features[GNLD_ECC].smu_feature_id = FEATURE_ECC_BIT;
360367
361368 for (i = 0; i < GNLD_FEATURES_MAX; i++) {
362369 data->smu_features[i].smu_feature_bitmap =
@@ -3020,7 +3027,8 @@ static int vega20_get_ppfeature_status(struct pp_hwmgr *hwmgr, char *buf) · 2657 unmodified lines
30203027 "FCLK_DS",
30213028 "MP1CLK_DS",
30223029 "MP0CLK_DS",
3023− "XGMI"};
3030+ "XGMI",
3031+ "ECC"};
30243032 static const char *output_title[] = {
30253033 "FEATURES",
30263034 "BITMASK",
@@ -3462,6 +3470,7 @@ static int vega20_apply_clocks_adjust_rules(struct pp_hwmgr *hwmgr) · 435 unmodified lines
34623470 struct vega20_single_dpm_table *dpm_table;
34633471 bool vblank_too_short = false;
34643472 bool disable_mclk_switching;
3473+ bool disable_fclk_switching;
34653474 uint32_t i, latency;
34663475
34673476 disable_mclk_switching = ((1 < hwmgr->display_config->num_display) &&
@@ -3537,13 +3546,20 @@ static int vega20_apply_clocks_adjust_rules(struct pp_hwmgr *hwmgr) · 69 unmodified lines
35373546 if (hwmgr->display_config->nb_pstate_switch_disable)
35383547 dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[dpm_table->count - 1].value;
35393548
3549+ if ((disable_mclk_switching &&
3550+ (dpm_table->dpm_state.hard_min_level == dpm_table->dpm_levels[dpm_table->count - 1].value)) ||
3551+ hwmgr->display_config->min_mem_set_clock / 100 >= dpm_table->dpm_levels[dpm_table->count - 1].value)
3552+ disable_fclk_switching = true;
3553+ else
3554+ disable_fclk_switching = false;
3555+
35403556 /* fclk */
35413557 dpm_table = &(data->dpm_table.fclk_table);
35423558 dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[0].value;
35433559 dpm_table->dpm_state.soft_max_level = VG20_CLOCK_MAX_DEFAULT;
35443560 dpm_table->dpm_state.hard_min_level = dpm_table->dpm_levels[0].value;
35453561 dpm_table->dpm_state.hard_max_level = VG20_CLOCK_MAX_DEFAULT;
3546− if (hwmgr->display_config->nb_pstate_switch_disable)
3562+ if (hwmgr->display_config->nb_pstate_switch_disable || disable_fclk_switching)
35473563 dpm_table->dpm_state.soft_min_level = dpm_table->dpm_levels[dpm_table->count - 1].value;
35483564
35493565 /* vclk */
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.h+1−0
@@ -80,6 +80,7 @@ enum { · 79 unmodified lines
8080 GNLD_DS_MP1CLK,
8181 GNLD_DS_MP0CLK,
8282 GNLD_XGMI,
83+ GNLD_ECC,
8384
8485 GNLD_FEATURES_MAX
8586 };
drivers/gpu/drm/amd/powerplay/inc/smu11_driver_if.h+3−2
@@ -99,7 +99,7 @@ · 98 unmodified lines
9999 #define FEATURE_DS_MP1CLK_BIT 30
100100 #define FEATURE_DS_MP0CLK_BIT 31
101101 #define FEATURE_XGMI_BIT 32
102−#define FEATURE_SPARE_33_BIT 33
102+#define FEATURE_ECC_BIT 33
103103 #define FEATURE_SPARE_34_BIT 34
104104 #define FEATURE_SPARE_35_BIT 35
105105 #define FEATURE_SPARE_36_BIT 36
@@ -165,7 +165,8 @@ · 59 unmodified lines
165165 #define FEATURE_DS_FCLK_MASK (1 << FEATURE_DS_FCLK_BIT )
166166 #define FEATURE_DS_MP1CLK_MASK (1 << FEATURE_DS_MP1CLK_BIT )
167167 #define FEATURE_DS_MP0CLK_MASK (1 << FEATURE_DS_MP0CLK_BIT )
168−#define FEATURE_XGMI_MASK (1 << FEATURE_XGMI_BIT )
168+#define FEATURE_XGMI_MASK (1ULL << FEATURE_XGMI_BIT )
169+#define FEATURE_ECC_MASK (1ULL << FEATURE_ECC_BIT )
169170
170171 #define DPM_OVERRIDE_DISABLE_SOCCLK_PID 0x00000001
171172 #define DPM_OVERRIDE_DISABLE_UCLK_PID 0x00000002
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c+30−4
@@ -1037,6 +1037,31 @@ void dw_hdmi_phy_i2c_write(struct dw_hdmi *hdmi, unsigned short data, · 1036 unmodified lines
10371037 }
10381038 EXPORT_SYMBOL_GPL(dw_hdmi_phy_i2c_write);
10391039
1040+/* Filter out invalid setups to avoid configuring SCDC and scrambling */
1041+static bool dw_hdmi_support_scdc(struct dw_hdmi *hdmi)
1042+{
1043+ struct drm_display_info *display = &hdmi->connector.display_info;
1044+
1045+ /* Completely disable SCDC support for older controllers */
1046+ if (hdmi->version < 0x200a)
1047+ return false;
1048+
1049+ /* Disable if SCDC is not supported, or if an HF-VSDB block is absent */
1050+ if (!display->hdmi.scdc.supported ||
1051+ !display->hdmi.scdc.scrambling.supported)
1052+ return false;
1053+
1054+ /*
1055+ * Disable if display only support low TMDS rates and scrambling
1056+ * for low rates is not supported either
1057+ */
1058+ if (!display->hdmi.scdc.scrambling.low_rates &&
1059+ display->max_tmds_clock <= 340000)
1060+ return false;
1061+
1062+ return true;
1063+}
1064+
10401065 /*
10411066 * HDMI2.0 Specifies the following procedure for High TMDS Bit Rates:
10421067 * - The Source shall suspend transmission of the TMDS clock and data
@@ -1055,7 +1080,7 @@ void dw_hdmi_set_high_tmds_clock_ratio(struct dw_hdmi *hdmi) · 12 unmodified lines
10551080 unsigned long mtmdsclock = hdmi->hdmi_data.video_mode.mtmdsclock;
10561081
10571082 /* Control for TMDS Bit Period/TMDS Clock-Period Ratio */
1058− if (hdmi->connector.display_info.hdmi.scdc.supported) {
1083+ if (dw_hdmi_support_scdc(hdmi)) {
10591084 if (mtmdsclock > HDMI14_MAX_TMDSCLK)
10601085 drm_scdc_set_high_tmds_clock_ratio(hdmi->ddc, 1);
10611086 else
@@ -1579,8 +1604,9 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi, · 517 unmodified lines
15791604
15801605 /* Set up HDMI_FC_INVIDCONF */
15811606 inv_val = (hdmi->hdmi_data.hdcp_enable ||
1582− vmode->mtmdsclock > HDMI14_MAX_TMDSCLK ||
1583− hdmi_info->scdc.scrambling.low_rates ?
1607+ (dw_hdmi_support_scdc(hdmi) &&
1608+ (vmode->mtmdsclock > HDMI14_MAX_TMDSCLK ||
1609+ hdmi_info->scdc.scrambling.low_rates)) ?
15841610 HDMI_FC_INVIDCONF_HDCP_KEEPOUT_ACTIVE :
15851611 HDMI_FC_INVIDCONF_HDCP_KEEPOUT_INACTIVE);
15861612
@@ -1646,7 +1672,7 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi, · 59 unmodified lines
16461672 }
16471673
16481674 /* Scrambling Control */
1649− if (hdmi_info->scdc.supported) {
1675+ if (dw_hdmi_support_scdc(hdmi)) {
16501676 if (vmode->mtmdsclock > HDMI14_MAX_TMDSCLK ||
16511677 hdmi_info->scdc.scrambling.low_rates) {
16521678 /*
drivers/gpu/drm/drm_atomic_helper.c+2−3
@@ -1034,7 +1034,7 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state) · 1033 unmodified lines
10341034 funcs->atomic_disable(crtc, old_crtc_state);
10351035 else if (funcs->disable)
10361036 funcs->disable(crtc);
1037− else
1037+ else if (funcs->dpms)
10381038 funcs->dpms(crtc, DRM_MODE_DPMS_OFF);
10391039
10401040 if (!(dev->irq_enabled && dev->num_crtcs))
@@ -1277,10 +1277,9 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, · 236 unmodified lines
12771277 if (new_crtc_state->enable) {
12781278 DRM_DEBUG_ATOMIC("enabling [CRTC:%d:%s]\n",
12791279 crtc->base.id, crtc->name);
1280−
12811280 if (funcs->atomic_enable)
12821281 funcs->atomic_enable(crtc, old_crtc_state);
1283− else
1282+ else if (funcs->commit)
12841283 funcs->commit(crtc);
12851284 }
12861285 }
drivers/gpu/drm/i915/gvt/display.c+1−1
@@ -448,7 +448,7 @@ void intel_gvt_emulate_vblank(struct intel_gvt *gvt) · 447 unmodified lines
448448 /**
449449 * intel_vgpu_emulate_hotplug - trigger hotplug event for vGPU
450450 * @vgpu: a vGPU
451− * @conncted: link state
451+ * @connected: link state
452452 *
453453 * This function is used to trigger hotplug interrupt for vGPU
454454 *
drivers/gpu/drm/i915/gvt/dmabuf.c+6−7
@@ -209,7 +209,7 @@ static int vgpu_get_plane_info(struct drm_device *dev, · 208 unmodified lines
209209 struct drm_i915_private *dev_priv = to_i915(dev);
210210 struct intel_vgpu_primary_plane_format p;
211211 struct intel_vgpu_cursor_plane_format c;
212− int ret;
212+ int ret, tile_height = 1;
213213
214214 if (plane_id == DRM_PLANE_TYPE_PRIMARY) {
215215 ret = intel_vgpu_decode_primary_plane(vgpu, &p);
@@ -228,19 +228,19 @@ static int vgpu_get_plane_info(struct drm_device *dev, · 12 unmodified lines
228228 break;
229229 case PLANE_CTL_TILED_X:
230230 info->drm_format_mod = I915_FORMAT_MOD_X_TILED;
231+ tile_height = 8;
231232 break;
232233 case PLANE_CTL_TILED_Y:
233234 info->drm_format_mod = I915_FORMAT_MOD_Y_TILED;
235+ tile_height = 32;
234236 break;
235237 case PLANE_CTL_TILED_YF:
236238 info->drm_format_mod = I915_FORMAT_MOD_Yf_TILED;
239+ tile_height = 32;
237240 break;
238241 default:
239242 gvt_vgpu_err("invalid tiling mode: %x\n", p.tiled);
240243 }
241−
242− info->size = (((p.stride * p.height * p.bpp) / 8) +
243− (PAGE_SIZE - 1)) >> PAGE_SHIFT;
244244 } else if (plane_id == DRM_PLANE_TYPE_CURSOR) {
245245 ret = intel_vgpu_decode_cursor_plane(vgpu, &c);
246246 if (ret)
@@ -262,14 +262,13 @@ static int vgpu_get_plane_info(struct drm_device *dev, · 15 unmodified lines
262262 info->x_hot = UINT_MAX;
263263 info->y_hot = UINT_MAX;
264264 }
265−
266− info->size = (((info->stride * c.height * c.bpp) / 8)
267− + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
268265 } else {
269266 gvt_vgpu_err("invalid plane id:%d\n", plane_id);
270267 return -EINVAL;
271268 }
272269
270+ info->size = (info->stride * roundup(info->height, tile_height)
271+ + PAGE_SIZE - 1) >> PAGE_SHIFT;
273272 if (info->size == 0) {
274273 gvt_vgpu_err("fb size is zero\n");
275274 return -EINVAL;
drivers/gpu/drm/i915/gvt/gtt.c+10−4
@@ -750,14 +750,20 @@ static void ppgtt_free_spt(struct intel_vgpu_ppgtt_spt *spt) · 749 unmodified lines
750750
751751 static void ppgtt_free_all_spt(struct intel_vgpu *vgpu)
752752 {
753− struct intel_vgpu_ppgtt_spt *spt;
753+ struct intel_vgpu_ppgtt_spt *spt, *spn;
754754 struct radix_tree_iter iter;
755− void **slot;
755+ LIST_HEAD(all_spt);
756+ void __rcu **slot;
756757
758+ rcu_read_lock();
757759 radix_tree_for_each_slot(slot, &vgpu->gtt.spt_tree, &iter, 0) {
758760 spt = radix_tree_deref_slot(slot);
759− ppgtt_free_spt(spt);
761+ list_move(&spt->post_shadow_list, &all_spt);
760762 }
763+ rcu_read_unlock();
764+
765+ list_for_each_entry_safe(spt, spn, &all_spt, post_shadow_list)
766+ ppgtt_free_spt(spt);
761767 }
762768
763769 static int ppgtt_handle_guest_write_page_table_bytes(
@@ -1946,7 +1952,7 @@ void _intel_vgpu_mm_release(struct kref *mm_ref) · 1182 unmodified lines
19461952 */
19471953 void intel_vgpu_unpin_mm(struct intel_vgpu_mm *mm)
19481954 {
1949− atomic_dec(&mm->pincount);
1955+ atomic_dec_if_positive(&mm->pincount);
19501956 }
19511957
19521958 /**
drivers/gpu/drm/i915/gvt/kvmgt.c+3−3
@@ -905,7 +905,7 @@ static inline bool intel_vgpu_in_aperture(struct intel_vgpu *vgpu, u64 off) · 904 unmodified lines
905905 static int intel_vgpu_aperture_rw(struct intel_vgpu *vgpu, u64 off,
906906 void *buf, unsigned long count, bool is_write)
907907 {
908− void *aperture_va;
908+ void __iomem *aperture_va;
909909
910910 if (!intel_vgpu_in_aperture(vgpu, off) ||
911911 !intel_vgpu_in_aperture(vgpu, off + count)) {
@@ -920,9 +920,9 @@ static int intel_vgpu_aperture_rw(struct intel_vgpu *vgpu, u64 off, · 8 unmodified lines
920920 return -EIO;
921921
922922 if (is_write)
923− memcpy(aperture_va + offset_in_page(off), buf, count);
923+ memcpy_toio(aperture_va + offset_in_page(off), buf, count);
924924 else
925− memcpy(buf, aperture_va + offset_in_page(off), count);
925+ memcpy_fromio(buf, aperture_va + offset_in_page(off), count);
926926
927927 io_mapping_unmap(aperture_va);
928928
drivers/gpu/drm/i915/gvt/scheduler.c+3−2
@@ -1486,8 +1486,9 @@ intel_vgpu_create_workload(struct intel_vgpu *vgpu, int ring_id, · 1485 unmodified lines
14861486 intel_runtime_pm_put_unchecked(dev_priv);
14871487 }
14881488
1489− if (ret && (vgpu_is_vm_unhealthy(ret))) {
1490− enter_failsafe_mode(vgpu, GVT_FAILSAFE_GUEST_ERR);
1489+ if (ret) {
1490+ if (vgpu_is_vm_unhealthy(ret))
1491+ enter_failsafe_mode(vgpu, GVT_FAILSAFE_GUEST_ERR);
14911492 intel_vgpu_destroy_workload(workload);
14921493 return ERR_PTR(ret);
14931494 }
drivers/gpu/drm/i915/i915_debugfs.c+4−1
@@ -4830,7 +4830,10 @@ static int i915_dsc_fec_support_show(struct seq_file *m, void *data) · 4829 unmodified lines
48304830 ret = drm_modeset_lock(&dev->mode_config.connection_mutex,
48314831 &ctx);
48324832 if (ret) {
4833− ret = -EINTR;
4833+ if (ret == -EDEADLK && !drm_modeset_backoff(&ctx)) {
4834+ try_again = true;
4835+ continue;
4836+ }
48344837 break;
48354838 }
48364839 crtc = connector->state->crtc;
drivers/gpu/drm/i915/icl_dsi.c+27−21
@@ -323,6 +323,21 @@ static void gen11_dsi_program_esc_clk_div(struct intel_encoder *encoder) · 322 unmodified lines
323323 }
324324 }
325325
326+static void get_dsi_io_power_domains(struct drm_i915_private *dev_priv,
327+ struct intel_dsi *intel_dsi)
328+{
329+ enum port port;
330+
331+ for_each_dsi_port(port, intel_dsi->ports) {
332+ WARN_ON(intel_dsi->io_wakeref[port]);
333+ intel_dsi->io_wakeref[port] =
334+ intel_display_power_get(dev_priv,
335+ port == PORT_A ?
336+ POWER_DOMAIN_PORT_DDI_A_IO :
337+ POWER_DOMAIN_PORT_DDI_B_IO);
338+ }
339+}
340+
326341 static void gen11_dsi_enable_io_power(struct intel_encoder *encoder)
327342 {
328343 struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
@@ -336,13 +351,7 @@ static void gen11_dsi_enable_io_power(struct intel_encoder *encoder) · 7 unmodified lines
336351 I915_WRITE(ICL_DSI_IO_MODECTL(port), tmp);
337352 }
338353
339− for_each_dsi_port(port, intel_dsi->ports) {
340− intel_dsi->io_wakeref[port] =
341− intel_display_power_get(dev_priv,
342− port == PORT_A ?
343− POWER_DOMAIN_PORT_DDI_A_IO :
344− POWER_DOMAIN_PORT_DDI_B_IO);
345− }
354+ get_dsi_io_power_domains(dev_priv, intel_dsi);
346355 }
347356
348357 static void gen11_dsi_power_up_lanes(struct intel_encoder *encoder)
@@ -589,6 +598,12 @@ static void gen11_dsi_map_pll(struct intel_encoder *encoder, · 240 unmodified lines
589598 val |= DPCLKA_CFGCR0_DDI_CLK_SEL(pll->info->id, port);
590599 }
591600 I915_WRITE(DPCLKA_CFGCR0_ICL, val);
601+
602+ for_each_dsi_port(port, intel_dsi->ports) {
603+ val &= ~DPCLKA_CFGCR0_DDI_CLK_OFF(port);
604+ }
605+ I915_WRITE(DPCLKA_CFGCR0_ICL, val);
606+
592607 POSTING_READ(DPCLKA_CFGCR0_ICL);
593608
594609 mutex_unlock(&dev_priv->dpll_lock);
@@ -1117,7 +1132,7 @@ static void gen11_dsi_disable_port(struct intel_encoder *encoder) · 522 unmodified lines
11171132 DRM_ERROR("DDI port:%c buffer not idle\n",
11181133 port_name(port));
11191134 }
1120− gen11_dsi_ungate_clocks(encoder);
1135+ gen11_dsi_gate_clocks(encoder);
11211136 }
11221137
11231138 static void gen11_dsi_disable_io_power(struct intel_encoder *encoder)
@@ -1218,20 +1233,11 @@ static int gen11_dsi_compute_config(struct intel_encoder *encoder, · 94 unmodified lines
12181233 return 0;
12191234 }
12201235
1221−static u64 gen11_dsi_get_power_domains(struct intel_encoder *encoder,
1222− struct intel_crtc_state *crtc_state)
1236+static void gen11_dsi_get_power_domains(struct intel_encoder *encoder,
1237+ struct intel_crtc_state *crtc_state)
12231238 {
1224− struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
1225− u64 domains = 0;
1226− enum port port;
1227−
1228− for_each_dsi_port(port, intel_dsi->ports)
1229− if (port == PORT_A)
1230− domains |= BIT_ULL(POWER_DOMAIN_PORT_DDI_A_IO);
1231− else
1232− domains |= BIT_ULL(POWER_DOMAIN_PORT_DDI_B_IO);
1233−
1234− return domains;
1239+ get_dsi_io_power_domains(to_i915(encoder->base.dev),
1240+ enc_to_intel_dsi(&encoder->base));
12351241 }
12361242
12371243 static bool gen11_dsi_get_hw_state(struct intel_encoder *encoder,
drivers/gpu/drm/i915/intel_ddi.c+11−12
@@ -2075,12 +2075,11 @@ intel_ddi_main_link_aux_domain(struct intel_digital_port *dig_port) · 2074 unmodified lines
20752075 intel_aux_power_domain(dig_port);
20762076 }
20772077
2078−static u64 intel_ddi_get_power_domains(struct intel_encoder *encoder,
2079− struct intel_crtc_state *crtc_state)
2078+static void intel_ddi_get_power_domains(struct intel_encoder *encoder,
2079+ struct intel_crtc_state *crtc_state)
20802080 {
20812081 struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
20822082 struct intel_digital_port *dig_port;
2083− u64 domains;
20842083
20852084 /*
20862085 * TODO: Add support for MST encoders. Atm, the following should never
@@ -2088,10 +2087,10 @@ static u64 intel_ddi_get_power_domains(struct intel_encoder *encoder, · 1 unmodified line
20882087 * hook.
20892088 */
20902089 if (WARN_ON(intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DP_MST)))
2091− return 0;
2090+ return;
20922091
20932092 dig_port = enc_to_dig_port(&encoder->base);
2094− domains = BIT_ULL(dig_port->ddi_io_power_domain);
2093+ intel_display_power_get(dev_priv, dig_port->ddi_io_power_domain);
20952094
20962095 /*
20972096 * AUX power is only needed for (e)DP mode, and for HDMI mode on TC
@@ -2099,15 +2098,15 @@ static u64 intel_ddi_get_power_domains(struct intel_encoder *encoder, · 1 unmodified line
20992098 */
21002099 if (intel_crtc_has_dp_encoder(crtc_state) ||
21012100 intel_port_is_tc(dev_priv, encoder->port))
2102− domains |= BIT_ULL(intel_ddi_main_link_aux_domain(dig_port));
2101+ intel_display_power_get(dev_priv,
2102+ intel_ddi_main_link_aux_domain(dig_port));
21032103
21042104 /*
21052105 * VDSC power is needed when DSC is enabled
21062106 */
21072107 if (crtc_state->dsc_params.compression_enable)
2108− domains |= BIT_ULL(intel_dsc_power_domain(crtc_state));
2109−
2110− return domains;
2108+ intel_display_power_get(dev_priv,
2109+ intel_dsc_power_domain(crtc_state));
21112110 }
21122111
21132112 void intel_ddi_enable_pipe_clock(const struct intel_crtc_state *crtc_state)
@@ -2825,10 +2824,10 @@ void icl_sanitize_encoder_pll_mapping(struct intel_encoder *encoder) · 711 unmodified lines
28252824 return;
28262825 }
28272826 /*
2828− * DSI ports should have their DDI clock ungated when disabled
2829− * and gated when enabled.
2827+ * For DSI we keep the ddi clocks gated
2828+ * except during enable/disable sequence.
28302829 */
2831− ddi_clk_needed = !encoder->base.crtc;
2830+ ddi_clk_needed = false;
28322831 }
28332832
28342833 val = I915_READ(DPCLKA_CFGCR0_ICL);
drivers/gpu/drm/i915/intel_display.c+1−5
@@ -15986,8 +15986,6 @@ get_encoder_power_domains(struct drm_i915_private *dev_priv) · 15985 unmodified lines
1598615986 struct intel_encoder *encoder;
1598715987
1598815988 for_each_intel_encoder(&dev_priv->drm, encoder) {
15989− u64 get_domains;
15990− enum intel_display_power_domain domain;
1599115989 struct intel_crtc_state *crtc_state;
1599215990
1599315991 if (!encoder->get_power_domains)
@@ -16001,9 +15999,7 @@ get_encoder_power_domains(struct drm_i915_private *dev_priv) · 7 unmodified lines
1600115999 continue;
1600216000
1600316001 crtc_state = to_intel_crtc_state(encoder->base.crtc->state);
16004− get_domains = encoder->get_power_domains(encoder, crtc_state);
16005− for_each_power_domain(domain, get_domains)
16006− intel_display_power_get(dev_priv, domain);
16002+ encoder->get_power_domains(encoder, crtc_state);
1600716003 }
1600816004 }
1600916005
drivers/gpu/drm/i915/intel_dp.c+10−59
@@ -1859,42 +1859,6 @@ intel_dp_compute_link_config_wide(struct intel_dp *intel_dp, · 1858 unmodified lines
18591859 return -EINVAL;
18601860 }
18611861
1862−/* Optimize link config in order: max bpp, min lanes, min clock */
1863−static int
1864−intel_dp_compute_link_config_fast(struct intel_dp *intel_dp,
1865− struct intel_crtc_state *pipe_config,
1866− const struct link_config_limits *limits)
1867−{
1868− struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
1869− int bpp, clock, lane_count;
1870− int mode_rate, link_clock, link_avail;
1871−
1872− for (bpp = limits->max_bpp; bpp >= limits->min_bpp; bpp -= 2 * 3) {
1873− mode_rate = intel_dp_link_required(adjusted_mode->crtc_clock,
1874− bpp);
1875−
1876− for (lane_count = limits->min_lane_count;
1877− lane_count <= limits->max_lane_count;
1878− lane_count <<= 1) {
1879− for (clock = limits->min_clock; clock <= limits->max_clock; clock++) {
1880− link_clock = intel_dp->common_rates[clock];
1881− link_avail = intel_dp_max_data_rate(link_clock,
1882− lane_count);
1883−
1884− if (mode_rate <= link_avail) {
1885− pipe_config->lane_count = lane_count;
1886− pipe_config->pipe_bpp = bpp;
1887− pipe_config->port_clock = link_clock;
1888−
1889− return 0;
1890− }
1891− }
1892− }
1893− }
1894−
1895− return -EINVAL;
1896−}
1897−
18981862 static int intel_dp_dsc_compute_bpp(struct intel_dp *intel_dp, u8 dsc_max_bpc)
18991863 {
19001864 int i, num_bpc;
@@ -2031,15 +1995,13 @@ intel_dp_compute_link_config(struct intel_encoder *encoder, · 130 unmodified lines
20311995 limits.min_bpp = 6 * 3;
20321996 limits.max_bpp = intel_dp_compute_bpp(intel_dp, pipe_config);
20331997
2034− if (intel_dp_is_edp(intel_dp) && intel_dp->edp_dpcd[0] < DP_EDP_14) {
1998+ if (intel_dp_is_edp(intel_dp)) {
20351999 /*
20362000 * Use the maximum clock and number of lanes the eDP panel
2037− * advertizes being capable of. The eDP 1.3 and earlier panels
2038− * are generally designed to support only a single clock and
2039− * lane configuration, and typically these values correspond to
2040− * the native resolution of the panel. With eDP 1.4 rate select
2041− * and DSC, this is decreasingly the case, and we need to be
2042− * able to select less than maximum link config.
2001+ * advertizes being capable of. The panels are generally
2002+ * designed to support only a single clock and lane
2003+ * configuration, and typically these values correspond to the
2004+ * native resolution of the panel.
20432005 */
20442006 limits.min_lane_count = limits.max_lane_count;
20452007 limits.min_clock = limits.max_clock;
@@ -2053,22 +2015,11 @@ intel_dp_compute_link_config(struct intel_encoder *encoder, · 7 unmodified lines
20532015 intel_dp->common_rates[limits.max_clock],
20542016 limits.max_bpp, adjusted_mode->crtc_clock);
20552017
2056− if (intel_dp_is_edp(intel_dp))
2057− /*
2058− * Optimize for fast and narrow. eDP 1.3 section 3.3 and eDP 1.4
2059− * section A.1: "It is recommended that the minimum number of
2060− * lanes be used, using the minimum link rate allowed for that
2061− * lane configuration."
2062− *
2063− * Note that we use the max clock and lane count for eDP 1.3 and
2064− * earlier, and fast vs. wide is irrelevant.
2065− */
2066− ret = intel_dp_compute_link_config_fast(intel_dp, pipe_config,
2067− &limits);
2068− else
2069− /* Optimize for slow and wide. */
2070− ret = intel_dp_compute_link_config_wide(intel_dp, pipe_config,
2071− &limits);
2018+ /*
2019+ * Optimize for slow and wide. This is the place to add alternative
2020+ * optimization policy.
2021+ */
2022+ ret = intel_dp_compute_link_config_wide(intel_dp, pipe_config, &limits);
20722023
20732024 /* enable compression if the mode doesn't fit available BW */
20742025 DRM_DEBUG_KMS("Force DSC en = %d\n", intel_dp->force_dsc_en);
drivers/gpu/drm/i915/intel_drv.h+6−4
@@ -270,10 +270,12 @@ struct intel_encoder { · 269 unmodified lines
270270 * be set correctly before calling this function. */
271271 void (*get_config)(struct intel_encoder *,
272272 struct intel_crtc_state *pipe_config);
273− /* Returns a mask of power domains that need to be referenced as part
274− * of the hardware state readout code. */
275− u64 (*get_power_domains)(struct intel_encoder *encoder,
276− struct intel_crtc_state *crtc_state);
273+ /*
274+ * Acquires the power domains needed for an active encoder during
275+ * hardware state readout.
276+ */
277+ void (*get_power_domains)(struct intel_encoder *encoder,
278+ struct intel_crtc_state *crtc_state);
277279 /*
278280 * Called during system suspend after all pending requests for the
279281 * encoder are flushed (for example for DP AUX transactions) and
drivers/gpu/drm/i915/vlv_dsi.c+24−0
@@ -256,6 +256,28 @@ static void band_gap_reset(struct drm_i915_private *dev_priv) · 255 unmodified lines
256256 mutex_unlock(&dev_priv->sb_lock);
257257 }
258258
259+static int bdw_get_pipemisc_bpp(struct intel_crtc *crtc)
260+{
261+ struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
262+ u32 tmp;
263+
264+ tmp = I915_READ(PIPEMISC(crtc->pipe));
265+
266+ switch (tmp & PIPEMISC_DITHER_BPC_MASK) {
267+ case PIPEMISC_DITHER_6_BPC:
268+ return 18;
269+ case PIPEMISC_DITHER_8_BPC:
270+ return 24;
271+ case PIPEMISC_DITHER_10_BPC:
272+ return 30;
273+ case PIPEMISC_DITHER_12_BPC:
274+ return 36;
275+ default:
276+ MISSING_CASE(tmp);
277+ return 0;
278+ }
279+}
280+
259281 static int intel_dsi_compute_config(struct intel_encoder *encoder,
260282 struct intel_crtc_state *pipe_config,
261283 struct drm_connector_state *conn_state)
@@ -1071,6 +1093,8 @@ static void bxt_dsi_get_pipe_config(struct intel_encoder *encoder, · 809 unmodified lines
10711093 bpp = mipi_dsi_pixel_format_to_bpp(
10721094 pixel_format_from_register_bits(fmt));
10731095
1096+ pipe_config->pipe_bpp = bdw_get_pipemisc_bpp(crtc);
1097+
10741098 /* Enable Frame time stamo based scanline reporting */
10751099 adjusted_mode->private_flags |=
10761100 I915_MODE_FLAG_GET_SCANLINE_FROM_TIMESTAMP;
drivers/gpu/drm/mediatek/mtk_dpi.c+3−5
@@ -662,13 +662,11 @@ static unsigned int mt8173_calculate_factor(int clock) · 661 unmodified lines
662662 static unsigned int mt2701_calculate_factor(int clock)
663663 {
664664 if (clock <= 64000)
665− return 16;
666− else if (clock <= 128000)
667− return 8;
668− else if (clock <= 256000)
669665 return 4;
670− else
666+ else if (clock <= 128000)
671667 return 2;
668+ else
669+ return 1;
672670 }
673671
674672 static const struct mtk_dpi_conf mt8173_conf = {
drivers/gpu/drm/mediatek/mtk_drm_drv.c+7−0
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515 #include <drm/drmP.h>
1616 #include <drm/drm_atomic.h>
1717 #include <drm/drm_atomic_helper.h>
18+#include <drm/drm_fb_helper.h>
1819 #include <drm/drm_gem.h>
1920 #include <drm/drm_gem_cma_helper.h>
2021 #include <drm/drm_of.h>
@@ -341,6 +342,8 @@ static struct drm_driver mtk_drm_driver = { · 320 unmodified lines
341342 .gem_prime_get_sg_table = mtk_gem_prime_get_sg_table,
342343 .gem_prime_import_sg_table = mtk_gem_prime_import_sg_table,
343344 .gem_prime_mmap = mtk_drm_gem_mmap_buf,
345+ .gem_prime_vmap = mtk_drm_gem_prime_vmap,
346+ .gem_prime_vunmap = mtk_drm_gem_prime_vunmap,
344347 .fops = &mtk_drm_fops,
345348
346349 .name = DRIVER_NAME,
@@ -376,6 +379,10 @@ static int mtk_drm_bind(struct device *dev) · 29 unmodified lines
376379 if (ret < 0)
377380 goto err_deinit;
378381
382+ ret = drm_fbdev_generic_setup(drm, 32);
383+ if (ret)
384+ DRM_ERROR("Failed to initialize fbdev: %d\n", ret);
385+
379386 return 0;
380387
381388 err_deinit:
drivers/gpu/drm/mediatek/mtk_drm_gem.c+46−0
@@ -241,3 +241,49 @@ err_gem_free: · 240 unmodified lines
241241 kfree(mtk_gem);
242242 return ERR_PTR(ret);
243243 }
244+
245+void *mtk_drm_gem_prime_vmap(struct drm_gem_object *obj)
246+{
247+ struct mtk_drm_gem_obj *mtk_gem = to_mtk_gem_obj(obj);
248+ struct sg_table *sgt;
249+ struct sg_page_iter iter;
250+ unsigned int npages;
251+ unsigned int i = 0;
252+
253+ if (mtk_gem->kvaddr)
254+ return mtk_gem->kvaddr;
255+
256+ sgt = mtk_gem_prime_get_sg_table(obj);
257+ if (IS_ERR(sgt))
258+ return NULL;
259+
260+ npages = obj->size >> PAGE_SHIFT;
261+ mtk_gem->pages = kcalloc(npages, sizeof(*mtk_gem->pages), GFP_KERNEL);
262+ if (!mtk_gem->pages)
263+ goto out;
264+
265+ for_each_sg_page(sgt->sgl, &iter, sgt->orig_nents, 0) {
266+ mtk_gem->pages[i++] = sg_page_iter_page(&iter);
267+ if (i > npages)
268+ break;
269+ }
270+ mtk_gem->kvaddr = vmap(mtk_gem->pages, npages, VM_MAP,
271+ pgprot_writecombine(PAGE_KERNEL));
272+
273+out:
274+ kfree((void *)sgt);
275+
276+ return mtk_gem->kvaddr;
277+}
278+
279+void mtk_drm_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr)
280+{
281+ struct mtk_drm_gem_obj *mtk_gem = to_mtk_gem_obj(obj);
282+
283+ if (!mtk_gem->pages)
284+ return;
285+
286+ vunmap(vaddr);
287+ mtk_gem->kvaddr = 0;
288+ kfree((void *)mtk_gem->pages);
289+}
drivers/gpu/drm/mediatek/mtk_drm_gem.h+3−0
@@ -37,6 +37,7 @@ struct mtk_drm_gem_obj { · 36 unmodified lines
3737 dma_addr_t dma_addr;
3838 unsigned long dma_attrs;
3939 struct sg_table *sg;
40+ struct page **pages;
4041 };
4142
4243 #define to_mtk_gem_obj(x) container_of(x, struct mtk_drm_gem_obj, base)
@@ -52,5 +53,7 @@ int mtk_drm_gem_mmap_buf(struct drm_gem_object *obj, · 9 unmodified lines
5253 struct sg_table *mtk_gem_prime_get_sg_table(struct drm_gem_object *obj);
5354 struct drm_gem_object *mtk_gem_prime_import_sg_table(struct drm_device *dev,
5455 struct dma_buf_attachment *attach, struct sg_table *sg);
56+void *mtk_drm_gem_prime_vmap(struct drm_gem_object *obj);
57+void mtk_drm_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr);
5558
5659 #endif
drivers/gpu/drm/mediatek/mtk_hdmi.c+1−1
@@ -1480,7 +1480,6 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi, · 1479 unmodified lines
14801480 if (IS_ERR(regmap))
14811481 ret = PTR_ERR(regmap);
14821482 if (ret) {
1483− ret = PTR_ERR(regmap);
14841483 dev_err(dev,
14851484 "Failed to get system configuration registers: %d\n",
14861485 ret);
@@ -1516,6 +1515,7 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi, · 29 unmodified lines
15161515 of_node_put(remote);
15171516
15181517 hdmi->ddc_adpt = of_find_i2c_adapter_by_node(i2c_np);
1518+ of_node_put(i2c_np);
15191519 if (!hdmi->ddc_adpt) {
15201520 dev_err(dev, "Failed to get ddc i2c adapter by node\n");
15211521 return -EINVAL;
drivers/gpu/drm/mediatek/mtk_hdmi_phy.c+5−30
@@ -15,28 +15,6 @@ static const struct phy_ops mtk_hdmi_phy_dev_ops = { · 14 unmodified lines
1515 .owner = THIS_MODULE,
1616 };
1717
18−long mtk_hdmi_pll_round_rate(struct clk_hw *hw, unsigned long rate,
19− unsigned long *parent_rate)
20−{
21− struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw);
22−
23− hdmi_phy->pll_rate = rate;
24− if (rate <= 74250000)
25− *parent_rate = rate;
26− else
27− *parent_rate = rate / 2;
28−
29− return rate;
30−}
31−
32−unsigned long mtk_hdmi_pll_recalc_rate(struct clk_hw *hw,
33− unsigned long parent_rate)
34−{
35− struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw);
36−
37− return hdmi_phy->pll_rate;
38−}
39−
4018 void mtk_hdmi_phy_clear_bits(struct mtk_hdmi_phy *hdmi_phy, u32 offset,
4119 u32 bits)
4220 {
@@ -110,13 +88,11 @@ mtk_hdmi_phy_dev_get_ops(const struct mtk_hdmi_phy *hdmi_phy) · 67 unmodified lines
11088 return NULL;
11189 }
11290
113−static void mtk_hdmi_phy_clk_get_ops(struct mtk_hdmi_phy *hdmi_phy,
114− const struct clk_ops **ops)
91+static void mtk_hdmi_phy_clk_get_data(struct mtk_hdmi_phy *hdmi_phy,
92+ struct clk_init_data *clk_init)
11593 {
116− if (hdmi_phy && hdmi_phy->conf && hdmi_phy->conf->hdmi_phy_clk_ops)
117− *ops = hdmi_phy->conf->hdmi_phy_clk_ops;
118− else
119− dev_err(hdmi_phy->dev, "Failed to get clk ops of phy\n");
94+ clk_init->flags = hdmi_phy->conf->flags;
95+ clk_init->ops = hdmi_phy->conf->hdmi_phy_clk_ops;
12096 }
12197
12298 static int mtk_hdmi_phy_probe(struct platform_device *pdev)
@@ -129,7 +105,6 @@ static int mtk_hdmi_phy_probe(struct platform_device *pdev) · 6 unmodified lines
129105 struct clk_init_data clk_init = {
130106 .num_parents = 1,
131107 .parent_names = (const char * const *)&ref_clk_name,
132− .flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_GATE,
133108 };
134109
135110 struct phy *phy;
@@ -167,7 +142,7 @@ static int mtk_hdmi_phy_probe(struct platform_device *pdev) · 31 unmodified lines
167142 hdmi_phy->dev = dev;
168143 hdmi_phy->conf =
169144 (struct mtk_hdmi_phy_conf *)of_device_get_match_data(dev);
170− mtk_hdmi_phy_clk_get_ops(hdmi_phy, &clk_init.ops);
145+ mtk_hdmi_phy_clk_get_data(hdmi_phy, &clk_init);
171146 hdmi_phy->pll_hw.init = &clk_init;
172147 hdmi_phy->pll = devm_clk_register(dev, &hdmi_phy->pll_hw);
173148 if (IS_ERR(hdmi_phy->pll)) {
drivers/gpu/drm/mediatek/mtk_hdmi_phy.h+1−4
@@ -21,6 +21,7 @@ struct mtk_hdmi_phy; · 20 unmodified lines
2121
2222 struct mtk_hdmi_phy_conf {
2323 bool tz_disabled;
24+ unsigned long flags;
2425 const struct clk_ops *hdmi_phy_clk_ops;
2526 void (*hdmi_phy_enable_tmds)(struct mtk_hdmi_phy *hdmi_phy);
2627 void (*hdmi_phy_disable_tmds)(struct mtk_hdmi_phy *hdmi_phy);
@@ -48,10 +49,6 @@ void mtk_hdmi_phy_set_bits(struct mtk_hdmi_phy *hdmi_phy, u32 offset, · 21 unmodified lines
4849 void mtk_hdmi_phy_mask(struct mtk_hdmi_phy *hdmi_phy, u32 offset,
4950 u32 val, u32 mask);
5051 struct mtk_hdmi_phy *to_mtk_hdmi_phy(struct clk_hw *hw);
51−long mtk_hdmi_pll_round_rate(struct clk_hw *hw, unsigned long rate,
52− unsigned long *parent_rate);
53−unsigned long mtk_hdmi_pll_recalc_rate(struct clk_hw *hw,
54− unsigned long parent_rate);
5552
5653 extern struct platform_driver mtk_hdmi_phy_driver;
5754 extern struct mtk_hdmi_phy_conf mtk_hdmi_phy_8173_conf;
drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c+43−6
@@ -79,7 +79,6 @@ static int mtk_hdmi_pll_prepare(struct clk_hw *hw) · 78 unmodified lines
7979 mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_SLDO_MASK);
8080 usleep_range(80, 100);
8181 mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON2, RG_HDMITX_MBIAS_LPF_EN);
82− mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON2, RG_HDMITX_EN_TX_POSDIV);
8382 mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_SER_MASK);
8483 mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_PRED_MASK);
8584 mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_DRV_MASK);
@@ -94,7 +93,6 @@ static void mtk_hdmi_pll_unprepare(struct clk_hw *hw) · 8 unmodified lines
9493 mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_DRV_MASK);
9594 mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_PRED_MASK);
9695 mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_SER_MASK);
97− mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON2, RG_HDMITX_EN_TX_POSDIV);
9896 mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON2, RG_HDMITX_MBIAS_LPF_EN);
9997 usleep_range(80, 100);
10098 mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_SLDO_MASK);
@@ -108,6 +106,12 @@ static void mtk_hdmi_pll_unprepare(struct clk_hw *hw) · 7 unmodified lines
108106 usleep_range(80, 100);
109107 }
110108
109+static long mtk_hdmi_pll_round_rate(struct clk_hw *hw, unsigned long rate,
110+ unsigned long *parent_rate)
111+{
112+ return rate;
113+}
114+
111115 static int mtk_hdmi_pll_set_rate(struct clk_hw *hw, unsigned long rate,
112116 unsigned long parent_rate)
113117 {
@@ -116,13 +120,14 @@ static int mtk_hdmi_pll_set_rate(struct clk_hw *hw, unsigned long rate, · 2 unmodified lines
116120
117121 if (rate <= 64000000)
118122 pos_div = 3;
119− else if (rate <= 12800000)
120− pos_div = 1;
123+ else if (rate <= 128000000)
124+ pos_div = 2;
121125 else
122126 pos_div = 1;
123127
124128 mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON6, RG_HTPLL_PREDIV_MASK);
125129 mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON6, RG_HTPLL_POSDIV_MASK);
130+ mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON2, RG_HDMITX_EN_TX_POSDIV);
126131 mtk_hdmi_phy_mask(hdmi_phy, HDMI_CON6, (0x1 << RG_HTPLL_IC),
127132 RG_HTPLL_IC_MASK);
128133 mtk_hdmi_phy_mask(hdmi_phy, HDMI_CON6, (0x1 << RG_HTPLL_IR),
@@ -154,6 +159,39 @@ static int mtk_hdmi_pll_set_rate(struct clk_hw *hw, unsigned long rate, · 25 unmodified lines
154159 return 0;
155160 }
156161
162+static unsigned long mtk_hdmi_pll_recalc_rate(struct clk_hw *hw,
163+ unsigned long parent_rate)
164+{
165+ struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw);
166+ unsigned long out_rate, val;
167+
168+ val = (readl(hdmi_phy->regs + HDMI_CON6)
169+ & RG_HTPLL_PREDIV_MASK) >> RG_HTPLL_PREDIV;
170+ switch (val) {
171+ case 0x00:
172+ out_rate = parent_rate;
173+ break;
174+ case 0x01:
175+ out_rate = parent_rate / 2;
176+ break;
177+ default:
178+ out_rate = parent_rate / 4;
179+ break;
180+ }
181+
182+ val = (readl(hdmi_phy->regs + HDMI_CON6)
183+ & RG_HTPLL_FBKDIV_MASK) >> RG_HTPLL_FBKDIV;
184+ out_rate *= (val + 1) * 2;
185+ val = (readl(hdmi_phy->regs + HDMI_CON2)
186+ & RG_HDMITX_TX_POSDIV_MASK);
187+ out_rate >>= (val >> RG_HDMITX_TX_POSDIV);
188+
189+ if (readl(hdmi_phy->regs + HDMI_CON2) & RG_HDMITX_EN_TX_POSDIV)
190+ out_rate /= 5;
191+
192+ return out_rate;
193+}
194+
157195 static const struct clk_ops mtk_hdmi_phy_pll_ops = {
158196 .prepare = mtk_hdmi_pll_prepare,
159197 .unprepare = mtk_hdmi_pll_unprepare,
@@ -174,7 +212,6 @@ static void mtk_hdmi_phy_enable_tmds(struct mtk_hdmi_phy *hdmi_phy) · 14 unmodified lines
174212 mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_SLDO_MASK);
175213 usleep_range(80, 100);
176214 mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON2, RG_HDMITX_MBIAS_LPF_EN);
177− mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON2, RG_HDMITX_EN_TX_POSDIV);
178215 mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_SER_MASK);
179216 mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_PRED_MASK);
180217 mtk_hdmi_phy_set_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_DRV_MASK);
@@ -186,7 +223,6 @@ static void mtk_hdmi_phy_disable_tmds(struct mtk_hdmi_phy *hdmi_phy) · 5 unmodified lines
186223 mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_DRV_MASK);
187224 mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_PRED_MASK);
188225 mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_SER_MASK);
189− mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON2, RG_HDMITX_EN_TX_POSDIV);
190226 mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON2, RG_HDMITX_MBIAS_LPF_EN);
191227 usleep_range(80, 100);
192228 mtk_hdmi_phy_clear_bits(hdmi_phy, HDMI_CON0, RG_HDMITX_EN_SLDO_MASK);
@@ -202,6 +238,7 @@ static void mtk_hdmi_phy_disable_tmds(struct mtk_hdmi_phy *hdmi_phy) · 9 unmodified lines
202238
203239 struct mtk_hdmi_phy_conf mtk_hdmi_phy_2701_conf = {
204240 .tz_disabled = true,
241+ .flags = CLK_SET_RATE_GATE,
205242 .hdmi_phy_clk_ops = &mtk_hdmi_phy_pll_ops,
206243 .hdmi_phy_enable_tmds = mtk_hdmi_phy_enable_tmds,
207244 .hdmi_phy_disable_tmds = mtk_hdmi_phy_disable_tmds,
drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c+23−0
@@ -199,6 +199,20 @@ static void mtk_hdmi_pll_unprepare(struct clk_hw *hw) · 198 unmodified lines
199199 usleep_range(100, 150);
200200 }
201201
202+static long mtk_hdmi_pll_round_rate(struct clk_hw *hw, unsigned long rate,
203+ unsigned long *parent_rate)
204+{
205+ struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw);
206+
207+ hdmi_phy->pll_rate = rate;
208+ if (rate <= 74250000)
209+ *parent_rate = rate;
210+ else
211+ *parent_rate = rate / 2;
212+
213+ return rate;
214+}
215+
202216 static int mtk_hdmi_pll_set_rate(struct clk_hw *hw, unsigned long rate,
203217 unsigned long parent_rate)
204218 {
@@ -285,6 +299,14 @@ static int mtk_hdmi_pll_set_rate(struct clk_hw *hw, unsigned long rate, · 80 unmodified lines
285299 return 0;
286300 }
287301
302+static unsigned long mtk_hdmi_pll_recalc_rate(struct clk_hw *hw,
303+ unsigned long parent_rate)
304+{
305+ struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw);
306+
307+ return hdmi_phy->pll_rate;
308+}
309+
288310 static const struct clk_ops mtk_hdmi_phy_pll_ops = {
289311 .prepare = mtk_hdmi_pll_prepare,
290312 .unprepare = mtk_hdmi_pll_unprepare,
@@ -309,6 +331,7 @@ static void mtk_hdmi_phy_disable_tmds(struct mtk_hdmi_phy *hdmi_phy) · 18 unmodified lines
309331 }
310332
311333 struct mtk_hdmi_phy_conf mtk_hdmi_phy_8173_conf = {
334+ .flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_GATE,
312335 .hdmi_phy_clk_ops = &mtk_hdmi_phy_pll_ops,
313336 .hdmi_phy_enable_tmds = mtk_hdmi_phy_enable_tmds,
314337 .hdmi_phy_disable_tmds = mtk_hdmi_phy_disable_tmds,
drivers/gpu/drm/omapdrm/dss/hdmi4_cec.c+19−7
@@ -175,6 +175,7 @@ static int hdmi_cec_adap_enable(struct cec_adapter *adap, bool enable) · 174 unmodified lines
175175 REG_FLD_MOD(core->base, HDMI_CORE_SYS_INTR_UNMASK4, 0, 3, 3);
176176 hdmi_wp_clear_irqenable(core->wp, HDMI_IRQ_CORE);
177177 hdmi_wp_set_irqstatus(core->wp, HDMI_IRQ_CORE);
178+ REG_FLD_MOD(core->wp->base, HDMI_WP_CLK, 0, 5, 0);
178179 hdmi4_core_disable(core);
179180 return 0;
180181 }
@@ -182,16 +183,24 @@ static int hdmi_cec_adap_enable(struct cec_adapter *adap, bool enable) · 1 unmodified line
182183 if (err)
183184 return err;
184185
186+ /*
187+ * Initialize CEC clock divider: CEC needs 2MHz clock hence
188+ * set the divider to 24 to get 48/24=2MHz clock
189+ */
190+ REG_FLD_MOD(core->wp->base, HDMI_WP_CLK, 0x18, 5, 0);
191+
185192 /* Clear TX FIFO */
186193 if (!hdmi_cec_clear_tx_fifo(adap)) {
187194 pr_err("cec-%s: could not clear TX FIFO\n", adap->name);
188− return -EIO;
195+ err = -EIO;
196+ goto err_disable_clk;
189197 }
190198
191199 /* Clear RX FIFO */
192200 if (!hdmi_cec_clear_rx_fifo(adap)) {
193201 pr_err("cec-%s: could not clear RX FIFO\n", adap->name);
194− return -EIO;
202+ err = -EIO;
203+ goto err_disable_clk;
195204 }
196205
197206 /* Clear CEC interrupts */
@@ -236,6 +245,12 @@ static int hdmi_cec_adap_enable(struct cec_adapter *adap, bool enable) · 38 unmodified lines
236245 hdmi_write_reg(core->base, HDMI_CEC_INT_STATUS_1, temp);
237246 }
238247 return 0;
248+
249+err_disable_clk:
250+ REG_FLD_MOD(core->wp->base, HDMI_WP_CLK, 0, 5, 0);
251+ hdmi4_core_disable(core);
252+
253+ return err;
239254 }
240255
241256 static int hdmi_cec_adap_log_addr(struct cec_adapter *adap, u8 log_addr)
@@ -333,11 +348,8 @@ int hdmi4_cec_init(struct platform_device *pdev, struct hdmi_core_data *core, · 91 unmodified lines
333348 return ret;
334349 core->wp = wp;
335350
336− /*
337− * Initialize CEC clock divider: CEC needs 2MHz clock hence
338− * set the devider to 24 to get 48/24=2MHz clock
339− */
340− REG_FLD_MOD(core->wp->base, HDMI_WP_CLK, 0x18, 5, 0);
351+ /* Disable clock initially, hdmi_cec_adap_enable() manages it */
352+ REG_FLD_MOD(core->wp->base, HDMI_WP_CLK, 0, 5, 0);
341353
342354 ret = cec_register_adapter(core->adap, &pdev->dev);
343355 if (ret < 0) {
drivers/gpu/drm/omapdrm/dss/hdmi4_core.c+1−1
@@ -708,7 +708,7 @@ int hdmi4_audio_config(struct hdmi_core_data *core, struct hdmi_wp_data *wp, · 707 unmodified lines
708708 else
709709 acore.i2s_cfg.justification = HDMI_AUDIO_JUSTIFY_RIGHT;
710710 /*
711− * The I2S input word length is twice the lenght given in the IEC-60958
711+ * The I2S input word length is twice the length given in the IEC-60958
712712 * status word. If the word size is greater than
713713 * 20 bits, increment by one.
714714 */
drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c+7−2
@@ -48,8 +48,13 @@ static enum drm_mode_status · 47 unmodified lines
4848 sun8i_dw_hdmi_mode_valid_h6(struct drm_connector *connector,
4949 const struct drm_display_mode *mode)
5050 {
51− /* This is max for HDMI 2.0b (4K@60Hz) */
52− if (mode->clock > 594000)
51+ /*
52+ * Controller support maximum of 594 MHz, which correlates to
53+ * 4K@60Hz 4:4:4 or RGB. However, for frequencies greater than
54+ * 340 MHz scrambling has to be enabled. Because scrambling is
55+ * not yet implemented, just limit to 340 MHz for now.
56+ */
57+ if (mode->clock > 340000)
5358 return MODE_CLOCK_HIGH;
5459
5560 return MODE_OK;
drivers/gpu/drm/sun4i/sun8i_tcon_top.c+3−2
@@ -227,7 +227,7 @@ static int sun8i_tcon_top_bind(struct device *dev, struct device *master, · 226 unmodified lines
227227
228228 err_unregister_gates:
229229 for (i = 0; i < CLK_NUM; i++)
230− if (clk_data->hws[i])
230+ if (!IS_ERR_OR_NULL(clk_data->hws[i]))
231231 clk_hw_unregister_gate(clk_data->hws[i]);
232232 clk_disable_unprepare(tcon_top->bus);
233233 err_assert_reset:
@@ -245,7 +245,8 @@ static void sun8i_tcon_top_unbind(struct device *dev, struct device *master, · 11 unmodified lines
245245
246246 of_clk_del_provider(dev->of_node);
247247 for (i = 0; i < CLK_NUM; i++)
248− clk_hw_unregister_gate(clk_data->hws[i]);
248+ if (clk_data->hws[i])
249+ clk_hw_unregister_gate(clk_data->hws[i]);
249250
250251 clk_disable_unprepare(tcon_top->bus);
251252 reset_control_assert(tcon_top->rst);
drivers/gpu/drm/tegra/hdmi.c+9−3
@@ -1260,9 +1260,15 @@ static void tegra_hdmi_encoder_enable(struct drm_encoder *encoder) · 1259 unmodified lines
12601260
12611261 hdmi->dvi = !tegra_output_is_hdmi(output);
12621262 if (!hdmi->dvi) {
1263− err = tegra_hdmi_setup_audio(hdmi);
1264− if (err < 0)
1265− hdmi->dvi = true;
1263+ /*
1264+ * Make sure that the audio format has been configured before
1265+ * enabling audio, otherwise we may try to divide by zero.
1266+ */
1267+ if (hdmi->format.sample_rate > 0) {
1268+ err = tegra_hdmi_setup_audio(hdmi);
1269+ if (err < 0)
1270+ hdmi->dvi = true;
1271+ }
12661272 }
12671273
12681274 if (hdmi->config->has_hda)
drivers/gpu/drm/ttm/ttm_bo.c+3−1
@@ -876,8 +876,10 @@ static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo, · 875 unmodified lines
876876 reservation_object_add_shared_fence(bo->resv, fence);
877877
878878 ret = reservation_object_reserve_shared(bo->resv, 1);
879− if (unlikely(ret))
879+ if (unlikely(ret)) {
880+ dma_fence_put(fence);
880881 return ret;
882+ }
881883
882884 dma_fence_put(bo->moving);
883885 bo->moving = fence;
drivers/gpu/drm/ttm/ttm_page_alloc.c+7−6
@@ -730,9 +730,10 @@ static void ttm_put_pages(struct page **pages, unsigned npages, int flags, · 729 unmodified lines
730730 }
731731
732732 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
733− if (!(flags & TTM_PAGE_FLAG_DMA32)) {
734− for (j = 0; j < HPAGE_PMD_NR; ++j)
735− if (p++ != pages[i + j])
733+ if (!(flags & TTM_PAGE_FLAG_DMA32) &&
734+ (npages - i) >= HPAGE_PMD_NR) {
735+ for (j = 1; j < HPAGE_PMD_NR; ++j)
736+ if (++p != pages[i + j])
736737 break;
737738
738739 if (j == HPAGE_PMD_NR)
@@ -759,15 +760,15 @@ static void ttm_put_pages(struct page **pages, unsigned npages, int flags, · 20 unmodified lines
759760 unsigned max_size, n2free;
760761
761762 spin_lock_irqsave(&huge->lock, irq_flags);
762− while (i < npages) {
763+ while ((npages - i) >= HPAGE_PMD_NR) {
763764 struct page *p = pages[i];
764765 unsigned j;
765766
766767 if (!p)
767768 break;
768769
769− for (j = 0; j < HPAGE_PMD_NR; ++j)
770− if (p++ != pages[i + j])
770+ for (j = 1; j < HPAGE_PMD_NR; ++j)
771+ if (++p != pages[i + j])
771772 break;
772773
773774 if (j != HPAGE_PMD_NR)
drivers/gpu/drm/udl/udl_drv.c+1−0
@@ -52,6 +52,7 @@ static struct drm_driver driver = { · 51 unmodified lines
5252 .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME,
5353 .load = udl_driver_load,
5454 .unload = udl_driver_unload,
55+ .release = udl_driver_release,
5556
5657 /* gem hooks */
5758 .gem_free_object_unlocked = udl_gem_free_object,
drivers/gpu/drm/udl/udl_drv.h+1−0
@@ -104,6 +104,7 @@ void udl_urb_completion(struct urb *urb); · 103 unmodified lines
104104
105105 int udl_driver_load(struct drm_device *dev, unsigned long flags);
106106 void udl_driver_unload(struct drm_device *dev);
107+void udl_driver_release(struct drm_device *dev);
107108
108109 int udl_fbdev_init(struct drm_device *dev);
109110 void udl_fbdev_cleanup(struct drm_device *dev);
drivers/gpu/drm/udl/udl_main.c+7−1
@@ -379,6 +379,12 @@ void udl_driver_unload(struct drm_device *dev) · 378 unmodified lines
379379 udl_free_urb_list(dev);
380380
381381 udl_fbdev_cleanup(dev);
382− udl_modeset_cleanup(dev);
383382 kfree(udl);
384383 }
384+
385+void udl_driver_release(struct drm_device *dev)
386+{
387+ udl_modeset_cleanup(dev);
388+ drm_dev_fini(dev);
389+ kfree(dev);
390+}
drivers/gpu/host1x/hw/channel_hw.c+5−1
@@ -115,8 +115,12 @@ static inline void synchronize_syncpt_base(struct host1x_job *job) · 114 unmodified lines
115115 static void host1x_channel_set_streamid(struct host1x_channel *channel)
116116 {
117117 #if HOST1X_HW >= 6
118+ u32 sid = 0x7f;
119+#ifdef CONFIG_IOMMU_API
118120 struct iommu_fwspec *spec = dev_iommu_fwspec_get(channel->dev->parent);
119− u32 sid = spec ? spec->ids[0] & 0xffff : 0x7f;
121+ if (spec)
122+ sid = spec->ids[0] & 0xffff;
123+#endif
120124
121125 host1x_ch_writel(channel, sid, HOST1X_CHANNEL_SMMU_STREAMID);
122126 #endif
drivers/hid/Kconfig+1−0
@@ -150,6 +150,7 @@ config HID_ASUS · 149 unmodified lines
150150 tristate "Asus"
151151 depends on LEDS_CLASS
152152 depends on ASUS_WMI || ASUS_WMI=n
153+ select POWER_SUPPLY
153154 ---help---
154155 Support for Asus notebook built-in keyboard and touchpad via i2c, and
155156 the Asus Republic of Gamers laptop keyboard special keys.
drivers/hid/hid-core.c+3−3
@@ -1301,10 +1301,10 @@ static u32 __extract(u8 *report, unsigned offset, int n) · 1300 unmodified lines
13011301 u32 hid_field_extract(const struct hid_device *hid, u8 *report,
13021302 unsigned offset, unsigned n)
13031303 {
1304− if (n > 32) {
1305− hid_warn(hid, "hid_field_extract() called with n (%d) > 32! (%s)\n",
1304+ if (n > 256) {
1305+ hid_warn(hid, "hid_field_extract() called with n (%d) > 256! (%s)\n",
13061306 n, current->comm);
1307− n = 32;
1307+ n = 256;
13081308 }
13091309
13101310 return __extract(report, offset, n);
drivers/hid/hid-debug.c+5−0
@@ -1060,10 +1060,15 @@ static int hid_debug_rdesc_show(struct seq_file *f, void *p) · 1059 unmodified lines
10601060 seq_printf(f, "\n\n");
10611061
10621062 /* dump parsed data and input mappings */
1063+ if (down_interruptible(&hdev->driver_input_lock))
1064+ return 0;
1065+
10631066 hid_dump_device(hdev, f);
10641067 seq_printf(f, "\n");
10651068 hid_dump_input_mapping(hdev, f);
10661069
1070+ up(&hdev->driver_input_lock);
1071+
10671072 return 0;
10681073 }
10691074
drivers/hid/hid-ids.h+1−0
@@ -1083,6 +1083,7 @@ · 1082 unmodified lines
10831083 #define USB_DEVICE_ID_SYNAPTICS_HD 0x0ac3
10841084 #define USB_DEVICE_ID_SYNAPTICS_QUAD_HD 0x1ac3
10851085 #define USB_DEVICE_ID_SYNAPTICS_TP_V103 0x5710
1086+#define I2C_DEVICE_ID_SYNAPTICS_7E7E 0x7e7e
10861087
10871088 #define USB_VENDOR_ID_TEXAS_INSTRUMENTS 0x2047
10881089 #define USB_DEVICE_ID_TEXAS_INSTRUMENTS_LENOVO_YOGA 0x0855
drivers/hid/hid-input.c+17−1
@@ -680,6 +680,14 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel · 679 unmodified lines
680680 break;
681681 }
682682
683+ if ((usage->hid & 0xf0) == 0xb0) { /* SC - Display */
684+ switch (usage->hid & 0xf) {
685+ case 0x05: map_key_clear(KEY_SWITCHVIDEOMODE); break;
686+ default: goto ignore;
687+ }
688+ break;
689+ }
690+
683691 /*
684692 * Some lazy vendors declare 255 usages for System Control,
685693 * leading to the creation of ABS_X|Y axis and too many others.
@@ -902,7 +910,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel · 216 unmodified lines
902910 case 0x06a: map_key_clear(KEY_GREEN); break;
903911 case 0x06b: map_key_clear(KEY_BLUE); break;
904912 case 0x06c: map_key_clear(KEY_YELLOW); break;
905− case 0x06d: map_key_clear(KEY_ZOOM); break;
913+ case 0x06d: map_key_clear(KEY_ASPECT_RATIO); break;
906914
907915 case 0x06f: map_key_clear(KEY_BRIGHTNESSUP); break;
908916 case 0x070: map_key_clear(KEY_BRIGHTNESSDOWN); break;
@@ -911,6 +919,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel · 2 unmodified lines
911919 case 0x074: map_key_clear(KEY_BRIGHTNESS_MAX); break;
912920 case 0x075: map_key_clear(KEY_BRIGHTNESS_AUTO); break;
913921
922+ case 0x079: map_key_clear(KEY_KBDILLUMUP); break;
923+ case 0x07a: map_key_clear(KEY_KBDILLUMDOWN); break;
924+ case 0x07c: map_key_clear(KEY_KBDILLUMTOGGLE); break;
925+
914926 case 0x082: map_key_clear(KEY_VIDEO_NEXT); break;
915927 case 0x083: map_key_clear(KEY_LAST); break;
916928 case 0x084: map_key_clear(KEY_ENTER); break;
@@ -998,6 +1010,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel · 81 unmodified lines
9981010 case 0x1b8: map_key_clear(KEY_VIDEO); break;
9991011 case 0x1bc: map_key_clear(KEY_MESSENGER); break;
10001012 case 0x1bd: map_key_clear(KEY_INFO); break;
1013+ case 0x1cb: map_key_clear(KEY_ASSISTANT); break;
10011014 case 0x201: map_key_clear(KEY_NEW); break;
10021015 case 0x202: map_key_clear(KEY_OPEN); break;
10031016 case 0x203: map_key_clear(KEY_CLOSE); break;
@@ -1021,6 +1034,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel · 17 unmodified lines
10211034 case 0x22d: map_key_clear(KEY_ZOOMIN); break;
10221035 case 0x22e: map_key_clear(KEY_ZOOMOUT); break;
10231036 case 0x22f: map_key_clear(KEY_ZOOMRESET); break;
1037+ case 0x232: map_key_clear(KEY_FULL_SCREEN); break;
10241038 case 0x233: map_key_clear(KEY_SCROLLUP); break;
10251039 case 0x234: map_key_clear(KEY_SCROLLDOWN); break;
10261040 case 0x238: /* AC Pan */
@@ -1044,6 +1058,8 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel · 17 unmodified lines
10441058 case 0x2cb: map_key_clear(KEY_KBDINPUTASSIST_ACCEPT); break;
10451059 case 0x2cc: map_key_clear(KEY_KBDINPUTASSIST_CANCEL); break;
10461060
1061+ case 0x29f: map_key_clear(KEY_SCALE); break;
1062+
10471063 default: map_key_clear(KEY_UNKNOWN);
10481064 }
10491065 break;
drivers/hid/hid-logitech-hidpp.c+10−3
@@ -2111,6 +2111,13 @@ static int hidpp_ff_init(struct hidpp_device *hidpp, u8 feature_index) · 2110 unmodified lines
21112111 kfree(data);
21122112 return -ENOMEM;
21132113 }
2114+ data->wq = create_singlethread_workqueue("hidpp-ff-sendqueue");
2115+ if (!data->wq) {
2116+ kfree(data->effect_ids);
2117+ kfree(data);
2118+ return -ENOMEM;
2119+ }
2120+
21142121 data->hidpp = hidpp;
21152122 data->feature_index = feature_index;
21162123 data->version = version;
@@ -2155,7 +2162,6 @@ static int hidpp_ff_init(struct hidpp_device *hidpp, u8 feature_index) · 38 unmodified lines
21552162 /* ignore boost value at response.fap.params[2] */
21562163
21572164 /* init the hardware command queue */
2158− data->wq = create_singlethread_workqueue("hidpp-ff-sendqueue");
21592165 atomic_set(&data->workqueue_size, 0);
21602166
21612167 /* initialize with zero autocenter to get wheel in usable state */
@@ -2608,8 +2614,9 @@ static int m560_raw_event(struct hid_device *hdev, u8 *data, int size) · 446 unmodified lines
26082614 input_report_rel(mydata->input, REL_Y, v);
26092615
26102616 v = hid_snto32(data[6], 8);
2611− hidpp_scroll_counter_handle_scroll(
2612− &hidpp->vertical_wheel_counter, v);
2617+ if (v != 0)
2618+ hidpp_scroll_counter_handle_scroll(
2619+ &hidpp->vertical_wheel_counter, v);
26132620
26142621 input_sync(mydata->input);
26152622 }
drivers/hid/hid-quirks.c+7−4
@@ -715,7 +715,6 @@ static const struct hid_device_id hid_ignore_list[] = { · 714 unmodified lines
715715 { HID_USB_DEVICE(USB_VENDOR_ID_DEALEXTREAME, USB_DEVICE_ID_DEALEXTREAME_RADIO_SI4701) },
716716 { HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EARTHMATE) },
717717 { HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EM_LT20) },
718− { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, 0x0400) },
719718 { HID_USB_DEVICE(USB_VENDOR_ID_ESSENTIAL_REALITY, USB_DEVICE_ID_ESSENTIAL_REALITY_P5) },
720719 { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC5UH) },
721720 { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC4UM) },
@@ -855,7 +854,7 @@ static const struct hid_device_id hid_ignore_list[] = { · 133 unmodified lines
855854 { }
856855 };
857856
858−/**
857+/*
859858 * hid_mouse_ignore_list - mouse devices which should not be handled by the hid layer
860859 *
861860 * There are composite devices for which we want to ignore only a certain
@@ -996,6 +995,10 @@ bool hid_ignore(struct hid_device *hdev) · 134 unmodified lines
996995 if (hdev->product == 0x0401 &&
997996 strncmp(hdev->name, "ELAN0800", 8) != 0)
998997 return true;
998+ /* Same with product id 0x0400 */
999+ if (hdev->product == 0x0400 &&
1000+ strncmp(hdev->name, "QTEC0001", 8) != 0)
1001+ return true;
9991002 break;
10001003 }
10011004
@@ -1042,7 +1045,7 @@ static struct hid_device_id *hid_exists_dquirk(const struct hid_device *hdev) · 40 unmodified lines
10421045 }
10431046
10441047 if (bl_entry != NULL)
1045− dbg_hid("Found dynamic quirk 0x%lx for HID device 0x%hx:0x%hx\n",
1048+ dbg_hid("Found dynamic quirk 0x%lx for HID device 0x%04x:0x%04x\n",
10461049 bl_entry->driver_data, bl_entry->vendor,
10471050 bl_entry->product);
10481051
@@ -1209,7 +1212,7 @@ static unsigned long hid_gets_squirk(const struct hid_device *hdev) · 160 unmodified lines
12091212 quirks |= bl_entry->driver_data;
12101213
12111214 if (quirks)
1212− dbg_hid("Found squirk 0x%lx for HID device 0x%hx:0x%hx\n",
1215+ dbg_hid("Found squirk 0x%lx for HID device 0x%04x:0x%04x\n",
12131216 quirks, hdev->vendor, hdev->product);
12141217 return quirks;
12151218 }
drivers/hid/hid-steam.c+19−7
@@ -499,6 +499,7 @@ static void steam_battery_unregister(struct steam_device *steam) · 498 unmodified lines
499499 static int steam_register(struct steam_device *steam)
500500 {
501501 int ret;
502+ bool client_opened;
502503
503504 /*
504505 * This function can be called several times in a row with the
@@ -511,9 +512,11 @@ static int steam_register(struct steam_device *steam) · 6 unmodified lines
511512 * Unlikely, but getting the serial could fail, and it is not so
512513 * important, so make up a serial number and go on.
513514 */
515+ mutex_lock(&steam->mutex);
514516 if (steam_get_serial(steam) < 0)
515517 strlcpy(steam->serial_no, "XXXXXXXXXX",
516518 sizeof(steam->serial_no));
519+ mutex_unlock(&steam->mutex);
517520
518521 hid_info(steam->hdev, "Steam Controller '%s' connected",
519522 steam->serial_no);
@@ -528,13 +531,15 @@ static int steam_register(struct steam_device *steam) · 8 unmodified lines
528531 }
529532
530533 mutex_lock(&steam->mutex);
531− if (!steam->client_opened) {
534+ client_opened = steam->client_opened;
535+ if (!client_opened)
532536 steam_set_lizard_mode(steam, lizard_mode);
537+ mutex_unlock(&steam->mutex);
538+
539+ if (!client_opened)
533540 ret = steam_input_register(steam);
534− } else {
541+ else
535542 ret = 0;
536− }
537− mutex_unlock(&steam->mutex);
538543
539544 return ret;
540545 }
@@ -630,14 +635,21 @@ static void steam_client_ll_close(struct hid_device *hdev) · 89 unmodified lines
630635 {
631636 struct steam_device *steam = hdev->driver_data;
632637
638+ unsigned long flags;
639+ bool connected;
640+
641+ spin_lock_irqsave(&steam->lock, flags);
642+ connected = steam->connected;
643+ spin_unlock_irqrestore(&steam->lock, flags);
644+
633645 mutex_lock(&steam->mutex);
634646 steam->client_opened = false;
647+ if (connected)
648+ steam_set_lizard_mode(steam, lizard_mode);
635649 mutex_unlock(&steam->mutex);
636650
637− if (steam->connected) {
638− steam_set_lizard_mode(steam, lizard_mode);
651+ if (connected)
639652 steam_input_register(steam);
640− }
641653 }
642654
643655 static int steam_client_ll_raw_request(struct hid_device *hdev,
drivers/hid/hid-uclogic-params.c+0−4
@@ -735,10 +735,6 @@ static int uclogic_params_huion_init(struct uclogic_params *params, · 734 unmodified lines
735735 goto cleanup;
736736 }
737737 rc = usb_string(udev, 201, ver_ptr, ver_len);
738− if (ver_ptr == NULL) {
739− rc = -ENOMEM;
740− goto cleanup;
741− }
742738 if (rc == -EPIPE) {
743739 *ver_ptr = '\0';
744740 } else if (rc < 0) {
drivers/hid/i2c-hid/i2c-hid-core.c+2−0
@@ -184,6 +184,8 @@ static const struct i2c_hid_quirks { · 183 unmodified lines
184184 I2C_HID_QUIRK_NO_RUNTIME_PM },
185185 { USB_VENDOR_ID_ELAN, HID_ANY_ID,
186186 I2C_HID_QUIRK_BOGUS_IRQ },
187+ { USB_VENDOR_ID_SYNAPTICS, I2C_DEVICE_ID_SYNAPTICS_7E7E,
188+ I2C_HID_QUIRK_NO_RUNTIME_PM },
187189 { 0, 0 }
188190 };
189191
drivers/hwmon/Kconfig+1−0
@@ -1759,6 +1759,7 @@ config SENSORS_VT8231 · 1758 unmodified lines
17591759 config SENSORS_W83773G
17601760 tristate "Nuvoton W83773G"
17611761 depends on I2C
1762+ select REGMAP_I2C
17621763 help
17631764 If you say yes here you get support for the Nuvoton W83773G hardware
17641765 monitoring chip.
drivers/hwmon/ntc_thermistor.c+1−1
@@ -640,7 +640,7 @@ static const struct hwmon_channel_info ntc_chip = { · 639 unmodified lines
640640 };
641641
642642 static const u32 ntc_temp_config[] = {
643− HWMON_T_INPUT, HWMON_T_TYPE,
643+ HWMON_T_INPUT | HWMON_T_TYPE,
644644 0
645645 };
646646
drivers/hwmon/occ/common.c+4−2
@@ -890,6 +890,8 @@ static int occ_setup_sensor_attrs(struct occ *occ) · 889 unmodified lines
890890 s++;
891891 }
892892 }
893+
894+ s = (sensors->power.num_sensors * 4) + 1;
893895 } else {
894896 for (i = 0; i < sensors->power.num_sensors; ++i) {
895897 s = i + 1;
@@ -918,11 +920,11 @@ static int occ_setup_sensor_attrs(struct occ *occ) · 22 unmodified lines
918920 show_power, NULL, 3, i);
919921 attr++;
920922 }
921− }
922923
923− if (sensors->caps.num_sensors >= 1) {
924924 s = sensors->power.num_sensors + 1;
925+ }
925926
927+ if (sensors->caps.num_sensors >= 1) {
926928 snprintf(attr->name, sizeof(attr->name), "power%d_label", s);
927929 attr->sensor = OCC_INIT_ATTR(attr->name, 0444, show_caps, NULL,
928930 0, 0);
drivers/i2c/busses/i2c-imx.c+3−1
@@ -1169,11 +1169,13 @@ static int i2c_imx_probe(struct platform_device *pdev) · 1168 unmodified lines
11691169 /* Init DMA config if supported */
11701170 ret = i2c_imx_dma_request(i2c_imx, phy_addr);
11711171 if (ret < 0)
1172− goto clk_notifier_unregister;
1172+ goto del_adapter;
11731173
11741174 dev_info(&i2c_imx->adapter.dev, "IMX I2C adapter registered\n");
11751175 return 0; /* Return OK */
11761176
1177+del_adapter:
1178+ i2c_del_adapter(&i2c_imx->adapter);
11771179 clk_notifier_unregister:
11781180 clk_notifier_unregister(i2c_imx->clk, &i2c_imx->clk_change_nb);
11791181 rpm_disable:
drivers/i3c/master.c+2−3
@@ -1980,7 +1980,6 @@ of_i3c_master_add_i3c_boardinfo(struct i3c_master_controller *master, · 1979 unmodified lines
19801980 {
19811981 struct i3c_dev_boardinfo *boardinfo;
19821982 struct device *dev = &master->dev;
1983− struct i3c_device_info info = { };
19841983 enum i3c_addr_slot_status addrstatus;
19851984 u32 init_dyn_addr = 0;
19861985
@@ -2012,8 +2011,8 @@ of_i3c_master_add_i3c_boardinfo(struct i3c_master_controller *master, · 25 unmodified lines
20122011
20132012 boardinfo->pid = ((u64)reg[1] << 32) | reg[2];
20142013
2015− if ((info.pid & GENMASK_ULL(63, 48)) ||
2016− I3C_PID_RND_LOWER_32BITS(info.pid))
2014+ if ((boardinfo->pid & GENMASK_ULL(63, 48)) ||
2015+ I3C_PID_RND_LOWER_32BITS(boardinfo->pid))
20172016 return -EINVAL;
20182017
20192018 boardinfo->init_dyn_addr = init_dyn_addr;
drivers/i3c/master/dw-i3c-master.c+1−1
@@ -300,7 +300,7 @@ to_dw_i3c_master(struct i3c_master_controller *master) · 299 unmodified lines
300300
301301 static void dw_i3c_master_disable(struct dw_i3c_master *master)
302302 {
303− writel(readl(master->regs + DEVICE_CTRL) & DEV_CTRL_ENABLE,
303+ writel(readl(master->regs + DEVICE_CTRL) & ~DEV_CTRL_ENABLE,
304304 master->regs + DEVICE_CTRL);
305305 }
306306
drivers/iio/accel/kxcjk-1013.c+2−0
@@ -1437,6 +1437,8 @@ static int kxcjk1013_resume(struct device *dev) · 1436 unmodified lines
14371437
14381438 mutex_lock(&data->mutex);
14391439 ret = kxcjk1013_set_mode(data, OPERATION);
1440+ if (ret == 0)
1441+ ret = kxcjk1013_set_range(data, data->range);
14401442 mutex_unlock(&data->mutex);
14411443
14421444 return ret;
drivers/iio/adc/ad_sigma_delta.c+1−0
@@ -121,6 +121,7 @@ static int ad_sd_read_reg_raw(struct ad_sigma_delta *sigma_delta, · 120 unmodified lines
121121 if (sigma_delta->info->has_registers) {
122122 data[0] = reg << sigma_delta->info->addr_shift;
123123 data[0] |= sigma_delta->info->read_mask;
124+ data[0] |= sigma_delta->comm;
124125 spi_message_add_tail(&t[0], &m);
125126 }
126127 spi_message_add_tail(&t[1], &m);
drivers/iio/adc/at91_adc.c+17−11
@@ -704,23 +704,29 @@ static int at91_adc_read_raw(struct iio_dev *idev, · 703 unmodified lines
704704 ret = wait_event_interruptible_timeout(st->wq_data_avail,
705705 st->done,
706706 msecs_to_jiffies(1000));
707− if (ret == 0)
708− ret = -ETIMEDOUT;
709− if (ret < 0) {
710− mutex_unlock(&st->lock);
711− return ret;
712− }
713−
714− *val = st->last_value;
715707
708+ /* Disable interrupts, regardless if adc conversion was
709+ * successful or not
710+ */
716711 at91_adc_writel(st, AT91_ADC_CHDR,
717712 AT91_ADC_CH(chan->channel));
718713 at91_adc_writel(st, AT91_ADC_IDR, BIT(chan->channel));
719714
720− st->last_value = 0;
721− st->done = false;
715+ if (ret > 0) {
716+ /* a valid conversion took place */
717+ *val = st->last_value;
718+ st->last_value = 0;
719+ st->done = false;
720+ ret = IIO_VAL_INT;
721+ } else if (ret == 0) {
722+ /* conversion timeout */
723+ dev_err(&idev->dev, "ADC Channel %d timeout.\n",
724+ chan->channel);
725+ ret = -ETIMEDOUT;
726+ }
727+
722728 mutex_unlock(&st->lock);
723− return IIO_VAL_INT;
729+ return ret;
724730
725731 case IIO_CHAN_INFO_SCALE:
726732 *val = st->vref_mv;
drivers/iio/adc/xilinx-xadc-core.c+2−1
@@ -1292,6 +1292,7 @@ static int xadc_probe(struct platform_device *pdev) · 1291 unmodified lines
12921292
12931293 err_free_irq:
12941294 free_irq(xadc->irq, indio_dev);
1295+ cancel_delayed_work_sync(&xadc->zynq_unmask_work);
12951296 err_clk_disable_unprepare:
12961297 clk_disable_unprepare(xadc->clk);
12971298 err_free_samplerate_trigger:
@@ -1321,8 +1322,8 @@ static int xadc_remove(struct platform_device *pdev) · 23 unmodified lines
13211322 iio_triggered_buffer_cleanup(indio_dev);
13221323 }
13231324 free_irq(xadc->irq, indio_dev);
1325+ cancel_delayed_work_sync(&xadc->zynq_unmask_work);
13241326 clk_disable_unprepare(xadc->clk);
1325− cancel_delayed_work(&xadc->zynq_unmask_work);
13261327 kfree(xadc->data);
13271328 kfree(indio_dev->channels);
13281329
drivers/iio/chemical/Kconfig+14−0
@@ -64,6 +64,7 @@ config IAQCORE · 63 unmodified lines
6464 config PMS7003
6565 tristate "Plantower PMS7003 particulate matter sensor"
6666 depends on SERIAL_DEV_BUS
67+ select IIO_TRIGGERED_BUFFER
6768 help
6869 Say Y here to build support for the Plantower PMS7003 particulate
6970 matter sensor.
@@ -71,6 +72,19 @@ config PMS7003 · 1 unmodified line
7172 To compile this driver as a module, choose M here: the module will
7273 be called pms7003.
7374
75+config SENSIRION_SGP30
76+ tristate "Sensirion SGPxx gas sensors"
77+ depends on I2C
78+ select CRC8
79+ help
80+ Say Y here to build I2C interface support for the following
81+ Sensirion SGP gas sensors:
82+ * SGP30 gas sensor
83+ * SGPC3 low power gas sensor
84+
85+ To compile this driver as module, choose M here: the
86+ module will be called sgp30.
87+
7488 config SPS30
7589 tristate "SPS30 particulate matter sensor"
7690 depends on I2C
drivers/iio/chemical/bme680.h+2−4
@@ -2,11 +2,9 @@ · 1 unmodified line
22 #ifndef BME680_H_
33 #define BME680_H_
44
5−#define BME680_REG_CHIP_I2C_ID 0xD0
6−#define BME680_REG_CHIP_SPI_ID 0x50
5+#define BME680_REG_CHIP_ID 0xD0
76 #define BME680_CHIP_ID_VAL 0x61
8−#define BME680_REG_SOFT_RESET_I2C 0xE0
9−#define BME680_REG_SOFT_RESET_SPI 0x60
7+#define BME680_REG_SOFT_RESET 0xE0
108 #define BME680_CMD_SOFTRESET 0xB6
119 #define BME680_REG_STATUS 0x73
1210 #define BME680_SPI_MEM_PAGE_BIT BIT(4)
drivers/iio/chemical/bme680_core.c+45−9
@@ -63,9 +63,23 @@ struct bme680_data { · 62 unmodified lines
6363 s32 t_fine;
6464 };
6565
66+static const struct regmap_range bme680_volatile_ranges[] = {
67+ regmap_reg_range(BME680_REG_MEAS_STAT_0, BME680_REG_GAS_R_LSB),
68+ regmap_reg_range(BME680_REG_STATUS, BME680_REG_STATUS),
69+ regmap_reg_range(BME680_T2_LSB_REG, BME680_GH3_REG),
70+};
71+
72+static const struct regmap_access_table bme680_volatile_table = {
73+ .yes_ranges = bme680_volatile_ranges,
74+ .n_yes_ranges = ARRAY_SIZE(bme680_volatile_ranges),
75+};
76+
6677 const struct regmap_config bme680_regmap_config = {
6778 .reg_bits = 8,
6879 .val_bits = 8,
80+ .max_register = 0xef,
81+ .volatile_table = &bme680_volatile_table,
82+ .cache_type = REGCACHE_RBTREE,
6983 };
7084 EXPORT_SYMBOL(bme680_regmap_config);
7185
@@ -316,6 +330,10 @@ static s16 bme680_compensate_temp(struct bme680_data *data, · 244 unmodified lines
316330 s64 var1, var2, var3;
317331 s16 calc_temp;
318332
333+ /* If the calibration is invalid, attempt to reload it */
334+ if (!calib->par_t2)
335+ bme680_read_calib(data, calib);
336+
319337 var1 = (adc_temp >> 3) - (calib->par_t1 << 1);
320338 var2 = (var1 * calib->par_t2) >> 11;
321339 var3 = ((var1 >> 1) * (var1 >> 1)) >> 12;
@@ -583,8 +601,7 @@ static int bme680_gas_config(struct bme680_data *data) · 261 unmodified lines
583601 return ret;
584602 }
585603
586−static int bme680_read_temp(struct bme680_data *data,
587− int *val, int *val2)
604+static int bme680_read_temp(struct bme680_data *data, int *val)
588605 {
589606 struct device *dev = regmap_get_device(data->regmap);
590607 int ret;
@@ -617,10 +634,9 @@ static int bme680_read_temp(struct bme680_data *data, · 26 unmodified lines
617634 * compensate_press/compensate_humid to get compensated
618635 * pressure/humidity readings.
619636 */
620− if (val && val2) {
621− *val = comp_temp;
622− *val2 = 100;
623− return IIO_VAL_FRACTIONAL;
637+ if (val) {
638+ *val = comp_temp * 10; /* Centidegrees to millidegrees */
639+ return IIO_VAL_INT;
624640 }
625641
626642 return ret;
@@ -635,7 +651,7 @@ static int bme680_read_press(struct bme680_data *data, · 8 unmodified lines
635651 s32 adc_press;
636652
637653 /* Read and compensate temperature to get a reading of t_fine */
638− ret = bme680_read_temp(data, NULL, NULL);
654+ ret = bme680_read_temp(data, NULL);
639655 if (ret < 0)
640656 return ret;
641657
@@ -668,7 +684,7 @@ static int bme680_read_humid(struct bme680_data *data, · 26 unmodified lines
668684 u32 comp_humidity;
669685
670686 /* Read and compensate temperature to get a reading of t_fine */
671− ret = bme680_read_temp(data, NULL, NULL);
687+ ret = bme680_read_temp(data, NULL);
672688 if (ret < 0)
673689 return ret;
674690
@@ -761,7 +777,7 @@ static int bme680_read_raw(struct iio_dev *indio_dev, · 86 unmodified lines
761777 case IIO_CHAN_INFO_PROCESSED:
762778 switch (chan->type) {
763779 case IIO_TEMP:
764− return bme680_read_temp(data, val, val2);
780+ return bme680_read_temp(data, val);
765781 case IIO_PRESSURE:
766782 return bme680_read_press(data, val, val2);
767783 case IIO_HUMIDITYRELATIVE:
@@ -867,8 +883,28 @@ int bme680_core_probe(struct device *dev, struct regmap *regmap, · 99 unmodified lines
867883 {
868884 struct iio_dev *indio_dev;
869885 struct bme680_data *data;
886+ unsigned int val;
870887 int ret;
871888
889+ ret = regmap_write(regmap, BME680_REG_SOFT_RESET,
890+ BME680_CMD_SOFTRESET);
891+ if (ret < 0) {
892+ dev_err(dev, "Failed to reset chip\n");
893+ return ret;
894+ }
895+
896+ ret = regmap_read(regmap, BME680_REG_CHIP_ID, &val);
897+ if (ret < 0) {
898+ dev_err(dev, "Error reading chip ID\n");
899+ return ret;
900+ }
901+
902+ if (val != BME680_CHIP_ID_VAL) {
903+ dev_err(dev, "Wrong chip ID, got %x expected %x\n",
904+ val, BME680_CHIP_ID_VAL);
905+ return -ENODEV;
906+ }
907+
872908 indio_dev = devm_iio_device_alloc(dev, sizeof(*data));
873909 if (!indio_dev)
874910 return -ENOMEM;
drivers/iio/chemical/bme680_i2c.c+0−21
@@ -23,8 +23,6 @@ static int bme680_i2c_probe(struct i2c_client *client, · 22 unmodified lines
2323 {
2424 struct regmap *regmap;
2525 const char *name = NULL;
26− unsigned int val;
27− int ret;
2826
2927 regmap = devm_regmap_init_i2c(client, &bme680_regmap_config);
3028 if (IS_ERR(regmap)) {
@@ -33,25 +31,6 @@ static int bme680_i2c_probe(struct i2c_client *client, · 2 unmodified lines
3331 return PTR_ERR(regmap);
3432 }
3533
36− ret = regmap_write(regmap, BME680_REG_SOFT_RESET_I2C,
37− BME680_CMD_SOFTRESET);
38− if (ret < 0) {
39− dev_err(&client->dev, "Failed to reset chip\n");
40− return ret;
41− }
42−
43− ret = regmap_read(regmap, BME680_REG_CHIP_I2C_ID, &val);
44− if (ret < 0) {
45− dev_err(&client->dev, "Error reading I2C chip ID\n");
46− return ret;
47− }
48−
49− if (val != BME680_CHIP_ID_VAL) {
50− dev_err(&client->dev, "Wrong chip ID, got %x expected %x\n",
51− val, BME680_CHIP_ID_VAL);
52− return -ENODEV;
53− }
54−
5534 if (id)
5635 name = id->name;
5736
drivers/iio/chemical/bme680_spi.c+78−37
@@ -12,28 +12,93 @@ · 11 unmodified lines
1212
1313 #include "bme680.h"
1414
15+struct bme680_spi_bus_context {
16+ struct spi_device *spi;
17+ u8 current_page;
18+};
19+
20+/*
21+ * In SPI mode there are only 7 address bits, a "page" register determines
22+ * which part of the 8-bit range is active. This function looks at the address
23+ * and writes the page selection bit if needed
24+ */
25+static int bme680_regmap_spi_select_page(
26+ struct bme680_spi_bus_context *ctx, u8 reg)
27+{
28+ struct spi_device *spi = ctx->spi;
29+ int ret;
30+ u8 buf[2];
31+ u8 page = (reg & 0x80) ? 0 : 1; /* Page "1" is low range */
32+
33+ if (page == ctx->current_page)
34+ return 0;
35+
36+ /*
37+ * Data sheet claims we're only allowed to change bit 4, so we must do
38+ * a read-modify-write on each and every page select
39+ */
40+ buf[0] = BME680_REG_STATUS;
41+ ret = spi_write_then_read(spi, buf, 1, buf + 1, 1);
42+ if (ret < 0) {
43+ dev_err(&spi->dev, "failed to set page %u\n", page);
44+ return ret;
45+ }
46+
47+ buf[0] = BME680_REG_STATUS;
48+ if (page)
49+ buf[1] |= BME680_SPI_MEM_PAGE_BIT;
50+ else
51+ buf[1] &= ~BME680_SPI_MEM_PAGE_BIT;
52+
53+ ret = spi_write(spi, buf, 2);
54+ if (ret < 0) {
55+ dev_err(&spi->dev, "failed to set page %u\n", page);
56+ return ret;
57+ }
58+
59+ ctx->current_page = page;
60+
61+ return 0;
62+}
63+
1564 static int bme680_regmap_spi_write(void *context, const void *data,
1665 size_t count)
1766 {
18− struct spi_device *spi = context;
67+ struct bme680_spi_bus_context *ctx = context;
68+ struct spi_device *spi = ctx->spi;
69+ int ret;
1970 u8 buf[2];
2071
2172 memcpy(buf, data, 2);
73+
74+ ret = bme680_regmap_spi_select_page(ctx, buf[0]);
75+ if (ret)
76+ return ret;
77+
2278 /*
2379 * The SPI register address (= full register address without bit 7)
2480 * and the write command (bit7 = RW = '0')
2581 */
2682 buf[0] &= ~0x80;
2783
28− return spi_write_then_read(spi, buf, 2, NULL, 0);
84+ return spi_write(spi, buf, 2);
2985 }
3086
3187 static int bme680_regmap_spi_read(void *context, const void *reg,
3288 size_t reg_size, void *val, size_t val_size)
3389 {
34− struct spi_device *spi = context;
90+ struct bme680_spi_bus_context *ctx = context;
91+ struct spi_device *spi = ctx->spi;
92+ int ret;
93+ u8 addr = *(const u8 *)reg;
94+
95+ ret = bme680_regmap_spi_select_page(ctx, addr);
96+ if (ret)
97+ return ret;
3598
36− return spi_write_then_read(spi, reg, reg_size, val, val_size);
99+ addr |= 0x80; /* bit7 = RW = '1' */
100+
101+ return spi_write_then_read(spi, &addr, 1, val, val_size);
37102 }
38103
39104 static struct regmap_bus bme680_regmap_bus = {
@@ -46,8 +111,8 @@ static struct regmap_bus bme680_regmap_bus = { · 6 unmodified lines
46111 static int bme680_spi_probe(struct spi_device *spi)
47112 {
48113 const struct spi_device_id *id = spi_get_device_id(spi);
114+ struct bme680_spi_bus_context *bus_context;
49115 struct regmap *regmap;
50− unsigned int val;
51116 int ret;
52117
53118 spi->bits_per_word = 8;
@@ -57,45 +122,21 @@ static int bme680_spi_probe(struct spi_device *spi) · 3 unmodified lines
57122 return ret;
58123 }
59124
125+ bus_context = devm_kzalloc(&spi->dev, sizeof(*bus_context), GFP_KERNEL);
126+ if (!bus_context)
127+ return -ENOMEM;
128+
129+ bus_context->spi = spi;
130+ bus_context->current_page = 0xff; /* Undefined on warm boot */
131+
60132 regmap = devm_regmap_init(&spi->dev, &bme680_regmap_bus,
61− &spi->dev, &bme680_regmap_config);
133+ bus_context, &bme680_regmap_config);
62134 if (IS_ERR(regmap)) {
63135 dev_err(&spi->dev, "Failed to register spi regmap %d\n",
64136 (int)PTR_ERR(regmap));
65137 return PTR_ERR(regmap);
66138 }
67139
68− ret = regmap_write(regmap, BME680_REG_SOFT_RESET_SPI,
69− BME680_CMD_SOFTRESET);
70− if (ret < 0) {
71− dev_err(&spi->dev, "Failed to reset chip\n");
72− return ret;
73− }
74−
75− /* after power-on reset, Page 0(0x80-0xFF) of spi_mem_page is active */
76− ret = regmap_read(regmap, BME680_REG_CHIP_SPI_ID, &val);
77− if (ret < 0) {
78− dev_err(&spi->dev, "Error reading SPI chip ID\n");
79− return ret;
80− }
81−
82− if (val != BME680_CHIP_ID_VAL) {
83− dev_err(&spi->dev, "Wrong chip ID, got %x expected %x\n",
84− val, BME680_CHIP_ID_VAL);
85− return -ENODEV;
86− }
87− /*
88− * select Page 1 of spi_mem_page to enable access to
89− * to registers from address 0x00 to 0x7F.
90− */
91− ret = regmap_write_bits(regmap, BME680_REG_STATUS,
92− BME680_SPI_MEM_PAGE_BIT,
93− BME680_SPI_MEM_PAGE_1_VAL);
94− if (ret < 0) {
95− dev_err(&spi->dev, "failed to set page 1 of spi_mem_page\n");
96− return ret;
97− }
98−
99140 return bme680_core_probe(&spi->dev, regmap, id->name);
100141 }
101142
drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c+4−3
@@ -103,9 +103,10 @@ static int cros_ec_sensors_read(struct iio_dev *indio_dev, · 102 unmodified lines
103103 * Do not use IIO_DEGREE_TO_RAD to avoid precision
104104 * loss. Round to the nearest integer.
105105 */
106− *val = div_s64(val64 * 314159 + 9000000ULL, 1000);
107− *val2 = 18000 << (CROS_EC_SENSOR_BITS - 1);
108− ret = IIO_VAL_FRACTIONAL;
106+ *val = 0;
107+ *val2 = div_s64(val64 * 3141592653ULL,
108+ 180 << (CROS_EC_SENSOR_BITS - 1));
109+ ret = IIO_VAL_INT_PLUS_NANO;
109110 break;
110111 case MOTIONSENSE_TYPE_MAG:
111112 /*
drivers/iio/dac/mcp4725.c+1−0
@@ -92,6 +92,7 @@ static ssize_t mcp4725_store_eeprom(struct device *dev, · 91 unmodified lines
9292
9393 inoutbuf[0] = 0x60; /* write EEPROM */
9494 inoutbuf[0] |= data->ref_mode << 3;
95+ inoutbuf[0] |= data->powerdown ? ((data->powerdown_mode + 1) << 1) : 0;
9596 inoutbuf[1] = data->dac_value >> 4;
9697 inoutbuf[2] = (data->dac_value & 0xf) << 4;
9798
drivers/iio/gyro/bmg160_core.c+3−3
@@ -582,11 +582,10 @@ static int bmg160_read_raw(struct iio_dev *indio_dev, · 581 unmodified lines
582582 case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY:
583583 return bmg160_get_filter(data, val);
584584 case IIO_CHAN_INFO_SCALE:
585− *val = 0;
586585 switch (chan->type) {
587586 case IIO_TEMP:
588− *val2 = 500000;
589− return IIO_VAL_INT_PLUS_MICRO;
587+ *val = 500;
588+ return IIO_VAL_INT;
590589 case IIO_ANGL_VEL:
591590 {
592591 int i;
@@ -594,6 +593,7 @@ static int bmg160_read_raw(struct iio_dev *indio_dev, · 1 unmodified line
594593 for (i = 0; i < ARRAY_SIZE(bmg160_scale_table); ++i) {
595594 if (bmg160_scale_table[i].dps_range ==
596595 data->dps_range) {
596+ *val = 0;
597597 *val2 = bmg160_scale_table[i].scale;
598598 return IIO_VAL_INT_PLUS_MICRO;
599599 }
drivers/iio/gyro/mpu3050-core.c+5−3
@@ -29,7 +29,8 @@ · 28 unmodified lines
2929
3030 #include "mpu3050.h"
3131
32−#define MPU3050_CHIP_ID 0x69
32+#define MPU3050_CHIP_ID 0x68
33+#define MPU3050_CHIP_ID_MASK 0x7E
3334
3435 /*
3536 * Register map: anything suffixed *_H is a big-endian high byte and always
@@ -1176,8 +1177,9 @@ int mpu3050_common_probe(struct device *dev, · 1140 unmodified lines
11761177 goto err_power_down;
11771178 }
11781179
1179− if (val != MPU3050_CHIP_ID) {
1180− dev_err(dev, "unsupported chip id %02x\n", (u8)val);
1180+ if ((val & MPU3050_CHIP_ID_MASK) != MPU3050_CHIP_ID) {
1181+ dev_err(dev, "unsupported chip id %02x\n",
1182+ (u8)(val & MPU3050_CHIP_ID_MASK));
11811183 ret = -ENODEV;
11821184 goto err_power_down;
11831185 }
drivers/iio/industrialio-buffer.c+2−3
@@ -320,9 +320,8 @@ static int iio_scan_mask_set(struct iio_dev *indio_dev, · 319 unmodified lines
320320 const unsigned long *mask;
321321 unsigned long *trialmask;
322322
323− trialmask = kmalloc_array(BITS_TO_LONGS(indio_dev->masklength),
324− sizeof(*trialmask),
325− GFP_KERNEL);
323+ trialmask = kcalloc(BITS_TO_LONGS(indio_dev->masklength),
324+ sizeof(*trialmask), GFP_KERNEL);
326325 if (trialmask == NULL)
327326 return -ENOMEM;
328327 if (!indio_dev->masklength) {
drivers/iio/industrialio-core.c+2−2
@@ -1743,10 +1743,10 @@ EXPORT_SYMBOL(__iio_device_register); · 1742 unmodified lines
17431743 **/
17441744 void iio_device_unregister(struct iio_dev *indio_dev)
17451745 {
1746− mutex_lock(&indio_dev->info_exist_lock);
1747−
17481746 cdev_device_del(&indio_dev->chrdev, &indio_dev->dev);
17491747
1748+ mutex_lock(&indio_dev->info_exist_lock);
1749+
17501750 iio_device_unregister_debugfs(indio_dev);
17511751
17521752 iio_disable_all_buffers(indio_dev);
drivers/infiniband/core/uverbs_main.c+3−0
@@ -993,6 +993,8 @@ void uverbs_user_mmap_disassociate(struct ib_uverbs_file *ufile) · 992 unmodified lines
993993 * will only be one mm, so no big deal.
994994 */
995995 down_write(&mm->mmap_sem);
996+ if (!mmget_still_valid(mm))
997+ goto skip_mm;
996998 mutex_lock(&ufile->umap_lock);
997999 list_for_each_entry_safe (priv, next_priv, &ufile->umaps,
9981000 list) {
@@ -1007,6 +1009,7 @@ void uverbs_user_mmap_disassociate(struct ib_uverbs_file *ufile) · 8 unmodified lines
10071009 vma->vm_flags &= ~(VM_SHARED | VM_MAYSHARE);
10081010 }
10091011 mutex_unlock(&ufile->umap_lock);
1012+ skip_mm:
10101013 up_write(&mm->mmap_sem);
10111014 mmput(mm);
10121015 }
drivers/infiniband/hw/hfi1/chip.c+19−7
@@ -13232,7 +13232,7 @@ static int set_up_context_variables(struct hfi1_devdata *dd) · 13231 unmodified lines
1323213232 int total_contexts;
1323313233 int ret;
1323413234 unsigned ngroups;
13235− int qos_rmt_count;
13235+ int rmt_count;
1323613236 int user_rmt_reduced;
1323713237 u32 n_usr_ctxts;
1323813238 u32 send_contexts = chip_send_contexts(dd);
@@ -13294,10 +13294,20 @@ static int set_up_context_variables(struct hfi1_devdata *dd) · 55 unmodified lines
1329413294 n_usr_ctxts = rcv_contexts - total_contexts;
1329513295 }
1329613296
13297− /* each user context requires an entry in the RMT */
13298− qos_rmt_count = qos_rmt_entries(dd, NULL, NULL);
13299− if (qos_rmt_count + n_usr_ctxts > NUM_MAP_ENTRIES) {
13300− user_rmt_reduced = NUM_MAP_ENTRIES - qos_rmt_count;
13297+ /*
13298+ * The RMT entries are currently allocated as shown below:
13299+ * 1. QOS (0 to 128 entries);
13300+ * 2. FECN for PSM (num_user_contexts + num_vnic_contexts);
13301+ * 3. VNIC (num_vnic_contexts).
13302+ * It should be noted that PSM FECN oversubscribe num_vnic_contexts
13303+ * entries of RMT because both VNIC and PSM could allocate any receive
13304+ * context between dd->first_dyn_alloc_text and dd->num_rcv_contexts,
13305+ * and PSM FECN must reserve an RMT entry for each possible PSM receive
13306+ * context.
13307+ */
13308+ rmt_count = qos_rmt_entries(dd, NULL, NULL) + (num_vnic_contexts * 2);
13309+ if (rmt_count + n_usr_ctxts > NUM_MAP_ENTRIES) {
13310+ user_rmt_reduced = NUM_MAP_ENTRIES - rmt_count;
1330113311 dd_dev_err(dd,
1330213312 "RMT size is reducing the number of user receive contexts from %u to %d\n",
1330313313 n_usr_ctxts,
@@ -14285,9 +14295,11 @@ static void init_user_fecn_handling(struct hfi1_devdata *dd, · 981 unmodified lines
1428514295 u64 reg;
1428614296 int i, idx, regoff, regidx;
1428714297 u8 offset;
14298+ u32 total_cnt;
1428814299
1428914300 /* there needs to be enough room in the map table */
14290− if (rmt->used + dd->num_user_contexts >= NUM_MAP_ENTRIES) {
14301+ total_cnt = dd->num_rcv_contexts - dd->first_dyn_alloc_ctxt;
14302+ if (rmt->used + total_cnt >= NUM_MAP_ENTRIES) {
1429114303 dd_dev_err(dd, "User FECN handling disabled - too many user contexts allocated\n");
1429214304 return;
1429314305 }
@@ -14341,7 +14353,7 @@ static void init_user_fecn_handling(struct hfi1_devdata *dd, · 47 unmodified lines
1434114353 /* add rule 1 */
1434214354 add_rsm_rule(dd, RSM_INS_FECN, &rrd);
1434314355
14344− rmt->used += dd->num_user_contexts;
14356+ rmt->used += total_cnt;
1434514357 }
1434614358
1434714359 /* Initialize RSM for VNIC */
drivers/infiniband/hw/hfi1/qp.c+3−1
@@ -898,7 +898,9 @@ void notify_error_qp(struct rvt_qp *qp) · 897 unmodified lines
898898 if (!list_empty(&priv->s_iowait.list) &&
899899 !(qp->s_flags & RVT_S_BUSY) &&
900900 !(priv->s_flags & RVT_S_BUSY)) {
901− qp->s_flags &= ~RVT_S_ANY_WAIT_IO;
901+ qp->s_flags &= ~HFI1_S_ANY_WAIT_IO;
902+ iowait_clear_flag(&priv->s_iowait, IOWAIT_PENDING_IB);
903+ iowait_clear_flag(&priv->s_iowait, IOWAIT_PENDING_TID);
902904 list_del_init(&priv->s_iowait.list);
903905 priv->s_iowait.lock = NULL;
904906 rvt_put_qp(qp);
drivers/infiniband/hw/hfi1/rc.c+2−2
@@ -3088,7 +3088,7 @@ send_last: · 3087 unmodified lines
30883088 update_ack_queue(qp, next);
30893089 }
30903090 e = &qp->s_ack_queue[qp->r_head_ack_queue];
3091− if (e->opcode == OP(RDMA_READ_REQUEST) && e->rdma_sge.mr) {
3091+ if (e->rdma_sge.mr) {
30923092 rvt_put_mr(e->rdma_sge.mr);
30933093 e->rdma_sge.mr = NULL;
30943094 }
@@ -3166,7 +3166,7 @@ send_last: · 71 unmodified lines
31663166 update_ack_queue(qp, next);
31673167 }
31683168 e = &qp->s_ack_queue[qp->r_head_ack_queue];
3169− if (e->opcode == OP(RDMA_READ_REQUEST) && e->rdma_sge.mr) {
3169+ if (e->rdma_sge.mr) {
31703170 rvt_put_mr(e->rdma_sge.mr);
31713171 e->rdma_sge.mr = NULL;
31723172 }
drivers/infiniband/hw/hfi1/tid_rdma.c+8−23
@@ -5017,24 +5017,14 @@ int hfi1_make_tid_rdma_pkt(struct rvt_qp *qp, struct hfi1_pkt_state *ps) · 5016 unmodified lines
50175017 make_tid_rdma_ack(qp, ohdr, ps))
50185018 return 1;
50195019
5020− if (!(ib_rvt_state_ops[qp->state] & RVT_PROCESS_SEND_OK)) {
5021− if (!(ib_rvt_state_ops[qp->state] & RVT_FLUSH_SEND))
5022− goto bail;
5023− /* We are in the error state, flush the work request. */
5024− if (qp->s_last == READ_ONCE(qp->s_head))
5025− goto bail;
5026− /* If DMAs are in progress, we can't flush immediately. */
5027− if (iowait_sdma_pending(&priv->s_iowait)) {
5028− qp->s_flags |= RVT_S_WAIT_DMA;
5029− goto bail;
5030− }
5031− clear_ahg(qp);
5032− wqe = rvt_get_swqe_ptr(qp, qp->s_last);
5033− hfi1_trdma_send_complete(qp, wqe, qp->s_last != qp->s_acked ?
5034− IB_WC_SUCCESS : IB_WC_WR_FLUSH_ERR);
5035− /* will get called again */
5036− goto done_free_tx;
5037− }
5020+ /*
5021+ * Bail out if we can't send data.
5022+ * Be reminded that this check must been done after the call to
5023+ * make_tid_rdma_ack() because the responding QP could be in
5024+ * RTR state where it can send TID RDMA ACK, not TID RDMA WRITE DATA.
5025+ */
5026+ if (!(ib_rvt_state_ops[qp->state] & RVT_PROCESS_SEND_OK))
5027+ goto bail;
50385028
50395029 if (priv->s_flags & RVT_S_WAIT_ACK)
50405030 goto bail;
@@ -5144,11 +5134,6 @@ int hfi1_make_tid_rdma_pkt(struct rvt_qp *qp, struct hfi1_pkt_state *ps) · 103 unmodified lines
51445134 hfi1_make_ruc_header(qp, ohdr, (opcode << 24), bth1, bth2,
51455135 middle, ps);
51465136 return 1;
5147−done_free_tx:
5148− hfi1_put_txreq(ps->s_txreq);
5149− ps->s_txreq = NULL;
5150− return 1;
5151−
51525137 bail:
51535138 hfi1_put_txreq(ps->s_txreq);
51545139 bail_no_tx:
drivers/infiniband/hw/hns/hns_roce_hem.c+4−2
@@ -792,6 +792,8 @@ void *hns_roce_table_find(struct hns_roce_dev *hr_dev, · 791 unmodified lines
792792 idx_offset = (obj & (table->num_obj - 1)) % obj_per_chunk;
793793 dma_offset = offset = idx_offset * table->obj_size;
794794 } else {
795+ u32 seg_size = 64; /* 8 bytes per BA and 8 BA per segment */
796+
795797 hns_roce_calc_hem_mhop(hr_dev, table, &mhop_obj, &mhop);
796798 /* mtt mhop */
797799 i = mhop.l0_idx;
@@ -803,8 +805,8 @@ void *hns_roce_table_find(struct hns_roce_dev *hr_dev, · 5 unmodified lines
803805 hem_idx = i;
804806
805807 hem = table->hem[hem_idx];
806− dma_offset = offset = (obj & (table->num_obj - 1)) *
807− table->obj_size % mhop.bt_chunk_size;
808+ dma_offset = offset = (obj & (table->num_obj - 1)) * seg_size %
809+ mhop.bt_chunk_size;
808810 if (mhop.hop_num == 2)
809811 dma_offset = offset = 0;
810812 }
drivers/infiniband/hw/hns/hns_roce_mr.c+2−2
@@ -746,7 +746,6 @@ static int hns_roce_write_mtt_chunk(struct hns_roce_dev *hr_dev, · 745 unmodified lines
746746 struct hns_roce_hem_table *table;
747747 dma_addr_t dma_handle;
748748 __le64 *mtts;
749− u32 s = start_index * sizeof(u64);
750749 u32 bt_page_size;
751750 u32 i;
752751
@@ -780,7 +779,8 @@ static int hns_roce_write_mtt_chunk(struct hns_roce_dev *hr_dev, · 27 unmodified lines
780779 return -EINVAL;
781780
782781 mtts = hns_roce_table_find(hr_dev, table,
783− mtt->first_seg + s / hr_dev->caps.mtt_entry_sz,
782+ mtt->first_seg +
783+ start_index / HNS_ROCE_MTT_ENTRY_PER_SEG,
784784 &dma_handle);
785785 if (!mtts)
786786 return -ENOMEM;
drivers/infiniband/hw/hns/hns_roce_qp.c+0−3
@@ -274,9 +274,6 @@ void hns_roce_qp_free(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp) · 273 unmodified lines
274274 wait_for_completion(&hr_qp->free);
275275
276276 if ((hr_qp->ibqp.qp_type) != IB_QPT_GSI) {
277− if (hr_dev->caps.sccc_entry_sz)
278− hns_roce_table_put(hr_dev, &qp_table->sccc_table,
279− hr_qp->qpn);
280277 if (hr_dev->caps.trrl_entry_sz)
281278 hns_roce_table_put(hr_dev, &qp_table->trrl_table,
282279 hr_qp->qpn);
drivers/infiniband/hw/mlx5/odp.c+2−1
@@ -585,7 +585,7 @@ static int pagefault_mr(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr, · 584 unmodified lines
585585 struct ib_umem_odp *odp_mr = to_ib_umem_odp(mr->umem);
586586 bool downgrade = flags & MLX5_PF_FLAGS_DOWNGRADE;
587587 bool prefetch = flags & MLX5_PF_FLAGS_PREFETCH;
588− u64 access_mask = ODP_READ_ALLOWED_BIT;
588+ u64 access_mask;
589589 u64 start_idx, page_mask;
590590 struct ib_umem_odp *odp;
591591 size_t size;
@@ -607,6 +607,7 @@ next_mr: · 15 unmodified lines
607607 page_shift = mr->umem->page_shift;
608608 page_mask = ~(BIT(page_shift) - 1);
609609 start_idx = (io_virt - (mr->mmkey.iova & page_mask)) >> page_shift;
610+ access_mask = ODP_READ_ALLOWED_BIT;
610611
611612 if (prefetch && !downgrade && !mr->umem->writable) {
612613 /* prefetch with write-access must
drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c+2−0
@@ -1131,6 +1131,8 @@ static void pvrdma_pci_remove(struct pci_dev *pdev) · 1130 unmodified lines
11311131 pvrdma_page_dir_cleanup(dev, &dev->cq_pdir);
11321132 pvrdma_page_dir_cleanup(dev, &dev->async_pdir);
11331133 pvrdma_free_slots(dev);
1134+ dma_free_coherent(&pdev->dev, sizeof(*dev->dsr), dev->dsr,
1135+ dev->dsrbase);
11341136
11351137 iounmap(dev->regs);
11361138 kfree(dev->sgid_tbl);
drivers/input/keyboard/snvs_pwrkey.c+3−3
@@ -148,6 +148,9 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev) · 147 unmodified lines
148148 return error;
149149 }
150150
151+ pdata->input = input;
152+ platform_set_drvdata(pdev, pdata);
153+
151154 error = devm_request_irq(&pdev->dev, pdata->irq,
152155 imx_snvs_pwrkey_interrupt,
153156 0, pdev->name, pdev);
@@ -163,9 +166,6 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev) · 9 unmodified lines
163166 return error;
164167 }
165168
166− pdata->input = input;
167− platform_set_drvdata(pdev, pdata);
168−
169169 device_init_wakeup(&pdev->dev, pdata->wakeup);
170170
171171 return 0;
drivers/input/mouse/elan_i2c_core.c+25−0
@@ -1339,21 +1339,46 @@ static const struct acpi_device_id elan_acpi_id[] = { · 1338 unmodified lines
13391339 { "ELAN0600", 0 },
13401340 { "ELAN0601", 0 },
13411341 { "ELAN0602", 0 },
1342+ { "ELAN0603", 0 },
1343+ { "ELAN0604", 0 },
13421344 { "ELAN0605", 0 },
1345+ { "ELAN0606", 0 },
1346+ { "ELAN0607", 0 },
13431347 { "ELAN0608", 0 },
13441348 { "ELAN0609", 0 },
13451349 { "ELAN060B", 0 },
13461350 { "ELAN060C", 0 },
1351+ { "ELAN060F", 0 },
1352+ { "ELAN0610", 0 },
13471353 { "ELAN0611", 0 },
13481354 { "ELAN0612", 0 },
1355+ { "ELAN0615", 0 },
1356+ { "ELAN0616", 0 },
13491357 { "ELAN0617", 0 },
13501358 { "ELAN0618", 0 },
1359+ { "ELAN0619", 0 },
1360+ { "ELAN061A", 0 },
1361+ { "ELAN061B", 0 },
13511362 { "ELAN061C", 0 },
13521363 { "ELAN061D", 0 },
13531364 { "ELAN061E", 0 },
1365+ { "ELAN061F", 0 },
13541366 { "ELAN0620", 0 },
13551367 { "ELAN0621", 0 },
13561368 { "ELAN0622", 0 },
1369+ { "ELAN0623", 0 },
1370+ { "ELAN0624", 0 },
1371+ { "ELAN0625", 0 },
1372+ { "ELAN0626", 0 },
1373+ { "ELAN0627", 0 },
1374+ { "ELAN0628", 0 },
1375+ { "ELAN0629", 0 },
1376+ { "ELAN062A", 0 },
1377+ { "ELAN062B", 0 },
1378+ { "ELAN062C", 0 },
1379+ { "ELAN062D", 0 },
1380+ { "ELAN0631", 0 },
1381+ { "ELAN0632", 0 },
13571382 { "ELAN1000", 0 },
13581383 { }
13591384 };
drivers/iommu/amd_iommu_init.c+1−1
@@ -359,7 +359,7 @@ static void iommu_write_l2(struct amd_iommu *iommu, u8 address, u32 val) · 358 unmodified lines
359359 static void iommu_set_exclusion_range(struct amd_iommu *iommu)
360360 {
361361 u64 start = iommu->exclusion_start & PAGE_MASK;
362− u64 limit = (start + iommu->exclusion_length) & PAGE_MASK;
362+ u64 limit = (start + iommu->exclusion_length - 1) & PAGE_MASK;
363363 u64 entry;
364364
365365 if (!iommu->exclusion_start)
drivers/irqchip/irq-ls1x.c+1−0
@@ -130,6 +130,7 @@ static int __init ls1x_intc_of_init(struct device_node *node, · 129 unmodified lines
130130 NULL);
131131 if (!priv->domain) {
132132 pr_err("ls1x-irq: cannot add IRQ domain\n");
133+ err = -ENOMEM;
133134 goto out_iounmap;
134135 }
135136
drivers/isdn/mISDN/socket.c+2−2
@@ -710,10 +710,10 @@ base_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_len) · 709 unmodified lines
710710 struct sock *sk = sock->sk;
711711 int err = 0;
712712
713− if (!maddr || maddr->family != AF_ISDN)
713+ if (addr_len < sizeof(struct sockaddr_mISDN))
714714 return -EINVAL;
715715
716− if (addr_len < sizeof(struct sockaddr_mISDN))
716+ if (!maddr || maddr->family != AF_ISDN)
717717 return -EINVAL;
718718
719719 lock_sock(sk);
drivers/lightnvm/pblk-read.c+28−22
@@ -231,14 +231,14 @@ static void pblk_end_partial_read(struct nvm_rq *rqd) · 230 unmodified lines
231231 struct pblk_sec_meta *meta;
232232 struct bio *new_bio = rqd->bio;
233233 struct bio *bio = pr_ctx->orig_bio;
234− struct bio_vec src_bv, dst_bv;
235234 void *meta_list = rqd->meta_list;
236− int bio_init_idx = pr_ctx->bio_init_idx;
237235 unsigned long *read_bitmap = pr_ctx->bitmap;
236+ struct bvec_iter orig_iter = BVEC_ITER_ALL_INIT;
237+ struct bvec_iter new_iter = BVEC_ITER_ALL_INIT;
238238 int nr_secs = pr_ctx->orig_nr_secs;
239239 int nr_holes = nr_secs - bitmap_weight(read_bitmap, nr_secs);
240240 void *src_p, *dst_p;
241− int hole, i;
241+ int bit, i;
242242
243243 if (unlikely(nr_holes == 1)) {
244244 struct ppa_addr ppa;
@@ -257,33 +257,39 @@ static void pblk_end_partial_read(struct nvm_rq *rqd) · 12 unmodified lines
257257
258258 /* Fill the holes in the original bio */
259259 i = 0;
260− hole = find_first_zero_bit(read_bitmap, nr_secs);
261− do {
262− struct pblk_line *line;
260+ for (bit = 0; bit < nr_secs; bit++) {
261+ if (!test_bit(bit, read_bitmap)) {
262+ struct bio_vec dst_bv, src_bv;
263+ struct pblk_line *line;
263264
264− line = pblk_ppa_to_line(pblk, rqd->ppa_list[i]);
265− kref_put(&line->ref, pblk_line_put);
265+ line = pblk_ppa_to_line(pblk, rqd->ppa_list[i]);
266+ kref_put(&line->ref, pblk_line_put);
266267
267− meta = pblk_get_meta(pblk, meta_list, hole);
268− meta->lba = cpu_to_le64(pr_ctx->lba_list_media[i]);
268+ meta = pblk_get_meta(pblk, meta_list, bit);
269+ meta->lba = cpu_to_le64(pr_ctx->lba_list_media[i]);
269270
270− src_bv = new_bio->bi_io_vec[i++];
271− dst_bv = bio->bi_io_vec[bio_init_idx + hole];
271+ dst_bv = bio_iter_iovec(bio, orig_iter);
272+ src_bv = bio_iter_iovec(new_bio, new_iter);
272273
273− src_p = kmap_atomic(src_bv.bv_page);
274− dst_p = kmap_atomic(dst_bv.bv_page);
274+ src_p = kmap_atomic(src_bv.bv_page);
275+ dst_p = kmap_atomic(dst_bv.bv_page);
275276
276− memcpy(dst_p + dst_bv.bv_offset,
277− src_p + src_bv.bv_offset,
278− PBLK_EXPOSED_PAGE_SIZE);
277+ memcpy(dst_p + dst_bv.bv_offset,
278+ src_p + src_bv.bv_offset,
279+ PBLK_EXPOSED_PAGE_SIZE);
279280
280− kunmap_atomic(src_p);
281− kunmap_atomic(dst_p);
281+ kunmap_atomic(src_p);
282+ kunmap_atomic(dst_p);
282283
283− mempool_free(src_bv.bv_page, &pblk->page_bio_pool);
284+ flush_dcache_page(dst_bv.bv_page);
285+ mempool_free(src_bv.bv_page, &pblk->page_bio_pool);
284286
285− hole = find_next_zero_bit(read_bitmap, nr_secs, hole + 1);
286− } while (hole < nr_secs);
287+ bio_advance_iter(new_bio, &new_iter,
288+ PBLK_EXPOSED_PAGE_SIZE);
289+ i++;
290+ }
291+ bio_advance_iter(bio, &orig_iter, PBLK_EXPOSED_PAGE_SIZE);
292+ }
287293
288294 bio_put(new_bio);
289295 kfree(pr_ctx);
drivers/md/dm-core.h+1−0
@@ -115,6 +115,7 @@ struct mapped_device { · 114 unmodified lines
115115 struct srcu_struct io_barrier;
116116 };
117117
118+void disable_discard(struct mapped_device *md);
118119 void disable_write_same(struct mapped_device *md);
119120 void disable_write_zeroes(struct mapped_device *md);
120121
drivers/md/dm-init.c+1−1
@@ -36,7 +36,7 @@ struct dm_device { · 35 unmodified lines
3636 struct list_head list;
3737 };
3838
39−const char *dm_allowed_targets[] __initconst = {
39+const char * const dm_allowed_targets[] __initconst = {
4040 "crypt",
4141 "delay",
4242 "linear",
drivers/md/dm-integrity.c+7−9
@@ -909,7 +909,7 @@ static void copy_from_journal(struct dm_integrity_c *ic, unsigned section, unsig · 908 unmodified lines
909909 static bool ranges_overlap(struct dm_integrity_range *range1, struct dm_integrity_range *range2)
910910 {
911911 return range1->logical_sector < range2->logical_sector + range2->n_sectors &&
912− range2->logical_sector + range2->n_sectors > range2->logical_sector;
912+ range1->logical_sector + range1->n_sectors > range2->logical_sector;
913913 }
914914
915915 static bool add_new_range(struct dm_integrity_c *ic, struct dm_integrity_range *new_range, bool check_waiting)
@@ -955,8 +955,6 @@ static void remove_range_unlocked(struct dm_integrity_c *ic, struct dm_integrity · 39 unmodified lines
955955 struct dm_integrity_range *last_range =
956956 list_first_entry(&ic->wait_list, struct dm_integrity_range, wait_entry);
957957 struct task_struct *last_range_task;
958− if (!ranges_overlap(range, last_range))
959− break;
960958 last_range_task = last_range->task;
961959 list_del(&last_range->wait_entry);
962960 if (!add_new_range(ic, last_range, false)) {
@@ -3181,7 +3179,7 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv) · 2218 unmodified lines
31813179 journal_watermark = val;
31823180 else if (sscanf(opt_string, "commit_time:%u%c", &val, &dummy) == 1)
31833181 sync_msec = val;
3184− else if (!memcmp(opt_string, "meta_device:", strlen("meta_device:"))) {
3182+ else if (!strncmp(opt_string, "meta_device:", strlen("meta_device:"))) {
31853183 if (ic->meta_dev) {
31863184 dm_put_device(ti, ic->meta_dev);
31873185 ic->meta_dev = NULL;
@@ -3200,17 +3198,17 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv) · 12 unmodified lines
32003198 goto bad;
32013199 }
32023200 ic->sectors_per_block = val >> SECTOR_SHIFT;
3203− } else if (!memcmp(opt_string, "internal_hash:", strlen("internal_hash:"))) {
3201+ } else if (!strncmp(opt_string, "internal_hash:", strlen("internal_hash:"))) {
32043202 r = get_alg_and_key(opt_string, &ic->internal_hash_alg, &ti->error,
32053203 "Invalid internal_hash argument");
32063204 if (r)
32073205 goto bad;
3208− } else if (!memcmp(opt_string, "journal_crypt:", strlen("journal_crypt:"))) {
3206+ } else if (!strncmp(opt_string, "journal_crypt:", strlen("journal_crypt:"))) {
32093207 r = get_alg_and_key(opt_string, &ic->journal_crypt_alg, &ti->error,
32103208 "Invalid journal_crypt argument");
32113209 if (r)
32123210 goto bad;
3213− } else if (!memcmp(opt_string, "journal_mac:", strlen("journal_mac:"))) {
3211+ } else if (!strncmp(opt_string, "journal_mac:", strlen("journal_mac:"))) {
32143212 r = get_alg_and_key(opt_string, &ic->journal_mac_alg, &ti->error,
32153213 "Invalid journal_mac argument");
32163214 if (r)
@@ -3612,7 +3610,7 @@ static struct target_type integrity_target = { · 395 unmodified lines
36123610 .io_hints = dm_integrity_io_hints,
36133611 };
36143612
3615−int __init dm_integrity_init(void)
3613+static int __init dm_integrity_init(void)
36163614 {
36173615 int r;
36183616
@@ -3631,7 +3629,7 @@ int __init dm_integrity_init(void) · 12 unmodified lines
36313629 return r;
36323630 }
36333631
3634−void dm_integrity_exit(void)
3632+static void __exit dm_integrity_exit(void)
36353633 {
36363634 dm_unregister_target(&integrity_target);
36373635 kmem_cache_destroy(journal_io_cache);
drivers/md/dm-rq.c+7−4
@@ -222,11 +222,14 @@ static void dm_done(struct request *clone, blk_status_t error, bool mapped) · 221 unmodified lines
222222 }
223223
224224 if (unlikely(error == BLK_STS_TARGET)) {
225− if (req_op(clone) == REQ_OP_WRITE_SAME &&
226− !clone->q->limits.max_write_same_sectors)
225+ if (req_op(clone) == REQ_OP_DISCARD &&
226+ !clone->q->limits.max_discard_sectors)
227+ disable_discard(tio->md);
228+ else if (req_op(clone) == REQ_OP_WRITE_SAME &&
229+ !clone->q->limits.max_write_same_sectors)
227230 disable_write_same(tio->md);
228− if (req_op(clone) == REQ_OP_WRITE_ZEROES &&
229− !clone->q->limits.max_write_zeroes_sectors)
231+ else if (req_op(clone) == REQ_OP_WRITE_ZEROES &&
232+ !clone->q->limits.max_write_zeroes_sectors)
230233 disable_write_zeroes(tio->md);
231234 }
232235
drivers/md/dm-table.c+39−0
@@ -1844,6 +1844,36 @@ static bool dm_table_supports_secure_erase(struct dm_table *t) · 1843 unmodified lines
18441844 return true;
18451845 }
18461846
1847+static int device_requires_stable_pages(struct dm_target *ti,
1848+ struct dm_dev *dev, sector_t start,
1849+ sector_t len, void *data)
1850+{
1851+ struct request_queue *q = bdev_get_queue(dev->bdev);
1852+
1853+ return q && bdi_cap_stable_pages_required(q->backing_dev_info);
1854+}
1855+
1856+/*
1857+ * If any underlying device requires stable pages, a table must require
1858+ * them as well. Only targets that support iterate_devices are considered:
1859+ * don't want error, zero, etc to require stable pages.
1860+ */
1861+static bool dm_table_requires_stable_pages(struct dm_table *t)
1862+{
1863+ struct dm_target *ti;
1864+ unsigned i;
1865+
1866+ for (i = 0; i < dm_table_get_num_targets(t); i++) {
1867+ ti = dm_table_get_target(t, i);
1868+
1869+ if (ti->type->iterate_devices &&
1870+ ti->type->iterate_devices(ti, device_requires_stable_pages, NULL))
1871+ return true;
1872+ }
1873+
1874+ return false;
1875+}
1876+
18471877 void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
18481878 struct queue_limits *limits)
18491879 {
@@ -1896,6 +1926,15 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, · 46 unmodified lines
18961926
18971927 dm_table_verify_integrity(t);
18981928
1929+ /*
1930+ * Some devices don't use blk_integrity but still want stable pages
1931+ * because they do their own checksumming.
1932+ */
1933+ if (dm_table_requires_stable_pages(t))
1934+ q->backing_dev_info->capabilities |= BDI_CAP_STABLE_WRITES;
1935+ else
1936+ q->backing_dev_info->capabilities &= ~BDI_CAP_STABLE_WRITES;
1937+
18991938 /*
19001939 * Determine whether or not this queue's I/O timings contribute
19011940 * to the entropy pool, Only request-based targets use this.
drivers/md/dm.c+17−13
@@ -945,6 +945,15 @@ static void dec_pending(struct dm_io *io, blk_status_t error) · 944 unmodified lines
945945 }
946946 }
947947
948+void disable_discard(struct mapped_device *md)
949+{
950+ struct queue_limits *limits = dm_get_queue_limits(md);
951+
952+ /* device doesn't really support DISCARD, disable it */
953+ limits->max_discard_sectors = 0;
954+ blk_queue_flag_clear(QUEUE_FLAG_DISCARD, md->queue);
955+}
956+
948957 void disable_write_same(struct mapped_device *md)
949958 {
950959 struct queue_limits *limits = dm_get_queue_limits(md);
@@ -970,11 +979,14 @@ static void clone_endio(struct bio *bio) · 19 unmodified lines
970979 dm_endio_fn endio = tio->ti->type->end_io;
971980
972981 if (unlikely(error == BLK_STS_TARGET) && md->type != DM_TYPE_NVME_BIO_BASED) {
973− if (bio_op(bio) == REQ_OP_WRITE_SAME &&
974− !bio->bi_disk->queue->limits.max_write_same_sectors)
982+ if (bio_op(bio) == REQ_OP_DISCARD &&
983+ !bio->bi_disk->queue->limits.max_discard_sectors)
984+ disable_discard(md);
985+ else if (bio_op(bio) == REQ_OP_WRITE_SAME &&
986+ !bio->bi_disk->queue->limits.max_write_same_sectors)
975987 disable_write_same(md);
976− if (bio_op(bio) == REQ_OP_WRITE_ZEROES &&
977− !bio->bi_disk->queue->limits.max_write_zeroes_sectors)
988+ else if (bio_op(bio) == REQ_OP_WRITE_ZEROES &&
989+ !bio->bi_disk->queue->limits.max_write_zeroes_sectors)
978990 disable_write_zeroes(md);
979991 }
980992
@@ -1042,15 +1054,7 @@ int dm_set_target_max_io_len(struct dm_target *ti, sector_t len) · 61 unmodified lines
10421054 return -EINVAL;
10431055 }
10441056
1045− /*
1046− * BIO based queue uses its own splitting. When multipage bvecs
1047− * is switched on, size of the incoming bio may be too big to
1048− * be handled in some targets, such as crypt.
1049− *
1050− * When these targets are ready for the big bio, we can remove
1051− * the limit.
1052− */
1053− ti->max_io_len = min_t(uint32_t, len, BIO_MAX_PAGES * PAGE_SIZE);
1057+ ti->max_io_len = (uint32_t) len;
10541058
10551059 return 0;
10561060 }
drivers/mfd/Kconfig+1−1
@@ -1246,7 +1246,7 @@ config MFD_STA2X11 · 1245 unmodified lines
12461246
12471247 config MFD_SUN6I_PRCM
12481248 bool "Allwinner A31 PRCM controller"
1249− depends on ARCH_SUNXI
1249+ depends on ARCH_SUNXI || COMPILE_TEST
12501250 select MFD_CORE
12511251 help
12521252 Support for the PRCM (Power/Reset/Clock Management) unit available
drivers/mfd/sprd-sc27xx-spi.c+21−21
@@ -53,67 +53,67 @@ static const struct sprd_pmic_data sc2731_data = { · 52 unmodified lines
5353 static const struct mfd_cell sprd_pmic_devs[] = {
5454 {
5555 .name = "sc27xx-wdt",
56− .of_compatible = "sprd,sc27xx-wdt",
56+ .of_compatible = "sprd,sc2731-wdt",
5757 }, {
5858 .name = "sc27xx-rtc",
59− .of_compatible = "sprd,sc27xx-rtc",
59+ .of_compatible = "sprd,sc2731-rtc",
6060 }, {
6161 .name = "sc27xx-charger",
62− .of_compatible = "sprd,sc27xx-charger",
62+ .of_compatible = "sprd,sc2731-charger",
6363 }, {
6464 .name = "sc27xx-chg-timer",
65− .of_compatible = "sprd,sc27xx-chg-timer",
65+ .of_compatible = "sprd,sc2731-chg-timer",
6666 }, {
6767 .name = "sc27xx-fast-chg",
68− .of_compatible = "sprd,sc27xx-fast-chg",
68+ .of_compatible = "sprd,sc2731-fast-chg",
6969 }, {
7070 .name = "sc27xx-chg-wdt",
71− .of_compatible = "sprd,sc27xx-chg-wdt",
71+ .of_compatible = "sprd,sc2731-chg-wdt",
7272 }, {
7373 .name = "sc27xx-typec",
74− .of_compatible = "sprd,sc27xx-typec",
74+ .of_compatible = "sprd,sc2731-typec",
7575 }, {
7676 .name = "sc27xx-flash",
77− .of_compatible = "sprd,sc27xx-flash",
77+ .of_compatible = "sprd,sc2731-flash",
7878 }, {
7979 .name = "sc27xx-eic",
80− .of_compatible = "sprd,sc27xx-eic",
80+ .of_compatible = "sprd,sc2731-eic",
8181 }, {
8282 .name = "sc27xx-efuse",
83− .of_compatible = "sprd,sc27xx-efuse",
83+ .of_compatible = "sprd,sc2731-efuse",
8484 }, {
8585 .name = "sc27xx-thermal",
86− .of_compatible = "sprd,sc27xx-thermal",
86+ .of_compatible = "sprd,sc2731-thermal",
8787 }, {
8888 .name = "sc27xx-adc",
89− .of_compatible = "sprd,sc27xx-adc",
89+ .of_compatible = "sprd,sc2731-adc",
9090 }, {
9191 .name = "sc27xx-audio-codec",
92− .of_compatible = "sprd,sc27xx-audio-codec",
92+ .of_compatible = "sprd,sc2731-audio-codec",
9393 }, {
9494 .name = "sc27xx-regulator",
95− .of_compatible = "sprd,sc27xx-regulator",
95+ .of_compatible = "sprd,sc2731-regulator",
9696 }, {
9797 .name = "sc27xx-vibrator",
98− .of_compatible = "sprd,sc27xx-vibrator",
98+ .of_compatible = "sprd,sc2731-vibrator",
9999 }, {
100100 .name = "sc27xx-keypad-led",
101− .of_compatible = "sprd,sc27xx-keypad-led",
101+ .of_compatible = "sprd,sc2731-keypad-led",
102102 }, {
103103 .name = "sc27xx-bltc",
104− .of_compatible = "sprd,sc27xx-bltc",
104+ .of_compatible = "sprd,sc2731-bltc",
105105 }, {
106106 .name = "sc27xx-fgu",
107− .of_compatible = "sprd,sc27xx-fgu",
107+ .of_compatible = "sprd,sc2731-fgu",
108108 }, {
109109 .name = "sc27xx-7sreset",
110− .of_compatible = "sprd,sc27xx-7sreset",
110+ .of_compatible = "sprd,sc2731-7sreset",
111111 }, {
112112 .name = "sc27xx-poweroff",
113− .of_compatible = "sprd,sc27xx-poweroff",
113+ .of_compatible = "sprd,sc2731-poweroff",
114114 }, {
115115 .name = "sc27xx-syscon",
116− .of_compatible = "sprd,sc27xx-syscon",
116+ .of_compatible = "sprd,sc2731-syscon",
117117 },
118118 };
119119
drivers/mfd/twl-core.c+23−0
@@ -1245,6 +1245,28 @@ free: · 1244 unmodified lines
12451245 return status;
12461246 }
12471247
1248+static int __maybe_unused twl_suspend(struct device *dev)
1249+{
1250+ struct i2c_client *client = to_i2c_client(dev);
1251+
1252+ if (client->irq)
1253+ disable_irq(client->irq);
1254+
1255+ return 0;
1256+}
1257+
1258+static int __maybe_unused twl_resume(struct device *dev)
1259+{
1260+ struct i2c_client *client = to_i2c_client(dev);
1261+
1262+ if (client->irq)
1263+ enable_irq(client->irq);
1264+
1265+ return 0;
1266+}
1267+
1268+static SIMPLE_DEV_PM_OPS(twl_dev_pm_ops, twl_suspend, twl_resume);
1269+
12481270 static const struct i2c_device_id twl_ids[] = {
12491271 { "twl4030", TWL4030_VAUX2 }, /* "Triton 2" */
12501272 { "twl5030", 0 }, /* T2 updated */
@@ -1262,6 +1284,7 @@ static const struct i2c_device_id twl_ids[] = { · 11 unmodified lines
12621284 /* One Client Driver , 4 Clients */
12631285 static struct i2c_driver twl_driver = {
12641286 .driver.name = DRIVER_NAME,
1287+ .driver.pm = &twl_dev_pm_ops,
12651288 .id_table = twl_ids,
12661289 .probe = twl_probe,
12671290 .remove = twl_remove,
drivers/misc/fastrpc.c+6−1
@@ -1184,6 +1184,7 @@ static int fastrpc_cb_probe(struct platform_device *pdev) · 1183 unmodified lines
11841184 struct fastrpc_session_ctx *sess;
11851185 struct device *dev = &pdev->dev;
11861186 int i, sessions = 0;
1187+ int rc;
11871188
11881189 cctx = dev_get_drvdata(dev->parent);
11891190 if (!cctx)
@@ -1213,7 +1214,11 @@ static int fastrpc_cb_probe(struct platform_device *pdev) · 23 unmodified lines
12131214 }
12141215 cctx->sesscount++;
12151216 spin_unlock(&cctx->lock);
1216− dma_set_mask(dev, DMA_BIT_MASK(32));
1217+ rc = dma_set_mask(dev, DMA_BIT_MASK(32));
1218+ if (rc) {
1219+ dev_err(dev, "32-bit DMA enable failed\n");
1220+ return rc;
1221+ }
12171222
12181223 return 0;
12191224 }
drivers/misc/habanalabs/goya/goya.c+4−5
@@ -1688,12 +1688,11 @@ static void goya_init_golden_registers(struct hl_device *hdev) · 1687 unmodified lines
16881688
16891689 /*
16901690 * Workaround for H2 #HW-23 bug
1691− * Set DMA max outstanding read requests to 240 on DMA CH 1. Set it
1692− * to 16 on KMD DMA
1693− * We need to limit only these DMAs because the user can only read
1691+ * Set DMA max outstanding read requests to 240 on DMA CH 1.
1692+ * This limitation is still large enough to not affect Gen4 bandwidth.
1693+ * We need to only limit that DMA channel because the user can only read
16941694 * from Host using DMA CH 1
16951695 */
1696− WREG32(mmDMA_CH_0_CFG0, 0x0fff0010);
16971696 WREG32(mmDMA_CH_1_CFG0, 0x0fff00F0);
16981697
16991698 goya->hw_cap_initialized |= HW_CAP_GOLDEN;
@@ -3693,7 +3692,7 @@ static int goya_validate_dma_pkt_mmu(struct hl_device *hdev, · 1993 unmodified lines
36933692 * WA for HW-23.
36943693 * We can't allow user to read from Host using QMANs other than 1.
36953694 */
3696− if (parser->hw_queue_id > GOYA_QUEUE_ID_DMA_1 &&
3695+ if (parser->hw_queue_id != GOYA_QUEUE_ID_DMA_1 &&
36973696 hl_mem_area_inside_range(le64_to_cpu(user_dma_pkt->src_addr),
36983697 le32_to_cpu(user_dma_pkt->tsize),
36993698 hdev->asic_prop.va_space_host_start_address,
drivers/mmc/host/alcor.c+13−21
@@ -48,7 +48,6 @@ struct alcor_sdmmc_host { · 47 unmodified lines
4848 struct mmc_command *cmd;
4949 struct mmc_data *data;
5050 unsigned int dma_on:1;
51− unsigned int early_data:1;
5251
5352 struct mutex cmd_mutex;
5453
@@ -144,8 +143,7 @@ static void alcor_data_set_dma(struct alcor_sdmmc_host *host) · 89 unmodified lines
144143 host->sg_count--;
145144 }
146145
147−static void alcor_trigger_data_transfer(struct alcor_sdmmc_host *host,
148− bool early)
146+static void alcor_trigger_data_transfer(struct alcor_sdmmc_host *host)
149147 {
150148 struct alcor_pci_priv *priv = host->alcor_pci;
151149 struct mmc_data *data = host->data;
@@ -155,13 +153,6 @@ static void alcor_trigger_data_transfer(struct alcor_sdmmc_host *host, · 3 unmodified lines
155153 ctrl |= AU6601_DATA_WRITE;
156154
157155 if (data->host_cookie == COOKIE_MAPPED) {
158− if (host->early_data) {
159− host->early_data = false;
160− return;
161− }
162−
163− host->early_data = early;
164−
165156 alcor_data_set_dma(host);
166157 ctrl |= AU6601_DATA_DMA_MODE;
167158 host->dma_on = 1;
@@ -231,6 +222,7 @@ static void alcor_prepare_sg_miter(struct alcor_sdmmc_host *host) · 63 unmodified lines
231222 static void alcor_prepare_data(struct alcor_sdmmc_host *host,
232223 struct mmc_command *cmd)
233224 {
225+ struct alcor_pci_priv *priv = host->alcor_pci;
234226 struct mmc_data *data = cmd->data;
235227
236228 if (!data)
@@ -248,7 +240,7 @@ static void alcor_prepare_data(struct alcor_sdmmc_host *host, · 11 unmodified lines
248240 if (data->host_cookie != COOKIE_MAPPED)
249241 alcor_prepare_sg_miter(host);
250242
251− alcor_trigger_data_transfer(host, true);
243+ alcor_write8(priv, 0, AU6601_DATA_XFER_CTRL);
252244 }
253245
254246 static void alcor_send_cmd(struct alcor_sdmmc_host *host,
@@ -435,7 +427,7 @@ static int alcor_cmd_irq_done(struct alcor_sdmmc_host *host, u32 intmask) · 180 unmodified lines
435427 if (!host->data)
436428 return false;
437429
438− alcor_trigger_data_transfer(host, false);
430+ alcor_trigger_data_transfer(host);
439431 host->cmd = NULL;
440432 return true;
441433 }
@@ -456,7 +448,7 @@ static void alcor_cmd_irq_thread(struct alcor_sdmmc_host *host, u32 intmask) · 14 unmodified lines
456448 if (!host->data)
457449 alcor_request_complete(host, 1);
458450 else
459− alcor_trigger_data_transfer(host, false);
451+ alcor_trigger_data_transfer(host);
460452 host->cmd = NULL;
461453 }
462454
@@ -487,15 +479,9 @@ static int alcor_data_irq_done(struct alcor_sdmmc_host *host, u32 intmask) · 24 unmodified lines
487479 break;
488480 case AU6601_INT_READ_BUF_RDY:
489481 alcor_trf_block_pio(host, true);
490− if (!host->blocks)
491− break;
492− alcor_trigger_data_transfer(host, false);
493482 return 1;
494483 case AU6601_INT_WRITE_BUF_RDY:
495484 alcor_trf_block_pio(host, false);
496− if (!host->blocks)
497− break;
498− alcor_trigger_data_transfer(host, false);
499485 return 1;
500486 case AU6601_INT_DMA_END:
501487 if (!host->sg_count)
@@ -508,8 +494,14 @@ static int alcor_data_irq_done(struct alcor_sdmmc_host *host, u32 intmask) · 6 unmodified lines
508494 break;
509495 }
510496
511− if (intmask & AU6601_INT_DATA_END)
512− return 0;
497+ if (intmask & AU6601_INT_DATA_END) {
498+ if (!host->dma_on && host->blocks) {
499+ alcor_trigger_data_transfer(host);
500+ return 1;
501+ } else {
502+ return 0;
503+ }
504+ }
513505
514506 return 1;
515507 }
drivers/mmc/host/sdhci-omap.c+38−0
@@ -797,6 +797,43 @@ void sdhci_omap_reset(struct sdhci_host *host, u8 mask) · 796 unmodified lines
797797 sdhci_reset(host, mask);
798798 }
799799
800+#define CMD_ERR_MASK (SDHCI_INT_CRC | SDHCI_INT_END_BIT | SDHCI_INT_INDEX |\
801+ SDHCI_INT_TIMEOUT)
802+#define CMD_MASK (CMD_ERR_MASK | SDHCI_INT_RESPONSE)
803+
804+static u32 sdhci_omap_irq(struct sdhci_host *host, u32 intmask)
805+{
806+ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
807+ struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host);
808+
809+ if (omap_host->is_tuning && host->cmd && !host->data_early &&
810+ (intmask & CMD_ERR_MASK)) {
811+
812+ /*
813+ * Since we are not resetting data lines during tuning
814+ * operation, data error or data complete interrupts
815+ * might still arrive. Mark this request as a failure
816+ * but still wait for the data interrupt
817+ */
818+ if (intmask & SDHCI_INT_TIMEOUT)
819+ host->cmd->error = -ETIMEDOUT;
820+ else
821+ host->cmd->error = -EILSEQ;
822+
823+ host->cmd = NULL;
824+
825+ /*
826+ * Sometimes command error interrupts and command complete
827+ * interrupt will arrive together. Clear all command related
828+ * interrupts here.
829+ */
830+ sdhci_writel(host, intmask & CMD_MASK, SDHCI_INT_STATUS);
831+ intmask &= ~CMD_MASK;
832+ }
833+
834+ return intmask;
835+}
836+
800837 static struct sdhci_ops sdhci_omap_ops = {
801838 .set_clock = sdhci_omap_set_clock,
802839 .set_power = sdhci_omap_set_power,
@@ -807,6 +844,7 @@ static struct sdhci_ops sdhci_omap_ops = { · 4 unmodified lines
807844 .platform_send_init_74_clocks = sdhci_omap_init_74_clocks,
808845 .reset = sdhci_omap_reset,
809846 .set_uhs_signaling = sdhci_omap_set_uhs_signaling,
847+ .irq = sdhci_omap_irq,
810848 };
811849
812850 static int sdhci_omap_set_capabilities(struct sdhci_omap_host *omap_host)
drivers/mtd/chips/cfi_cmdset_0002.c+5−1
@@ -1876,7 +1876,11 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, · 1875 unmodified lines
18761876 continue;
18771877 }
18781878
1879− if (time_after(jiffies, timeo) && !chip_ready(map, adr))
1879+ /*
1880+ * We check "time_after" and "!chip_good" before checking "chip_good" to avoid
1881+ * the failure due to scheduling.
1882+ */
1883+ if (time_after(jiffies, timeo) && !chip_good(map, adr, datum))
18801884 break;
18811885
18821886 if (chip_good(map, adr, datum)) {
drivers/net/bonding/bond_main.c+5−1
@@ -3213,8 +3213,12 @@ static int bond_netdev_event(struct notifier_block *this, · 3212 unmodified lines
32133213 return NOTIFY_DONE;
32143214
32153215 if (event_dev->flags & IFF_MASTER) {
3216+ int ret;
3217+
32163218 netdev_dbg(event_dev, "IFF_MASTER\n");
3217− return bond_master_netdev_event(event, event_dev);
3219+ ret = bond_master_netdev_event(event, event_dev);
3220+ if (ret != NOTIFY_DONE)
3221+ return ret;
32183222 }
32193223
32203224 if (event_dev->flags & IFF_SLAVE) {
drivers/net/bonding/bond_sysfs_slave.c+3−1
@@ -55,7 +55,9 @@ static SLAVE_ATTR_RO(link_failure_count); · 54 unmodified lines
5555
5656 static ssize_t perm_hwaddr_show(struct slave *slave, char *buf)
5757 {
58− return sprintf(buf, "%pM\n", slave->perm_hwaddr);
58+ return sprintf(buf, "%*phC\n",
59+ slave->dev->addr_len,
60+ slave->perm_hwaddr);
5961 }
6062 static SLAVE_ATTR_RO(perm_hwaddr);
6163
drivers/net/dsa/mv88e6xxx/port.c+16−8
@@ -427,18 +427,22 @@ int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port, · 426 unmodified lines
427427 return 0;
428428
429429 lane = mv88e6390x_serdes_get_lane(chip, port);
430− if (lane < 0)
430+ if (lane < 0 && lane != -ENODEV)
431431 return lane;
432432
433− if (chip->ports[port].serdes_irq) {
434− err = mv88e6390_serdes_irq_disable(chip, port, lane);
433+ if (lane >= 0) {
434+ if (chip->ports[port].serdes_irq) {
435+ err = mv88e6390_serdes_irq_disable(chip, port, lane);
436+ if (err)
437+ return err;
438+ }
439+
440+ err = mv88e6390x_serdes_power(chip, port, false);
435441 if (err)
436442 return err;
437443 }
438444
439− err = mv88e6390x_serdes_power(chip, port, false);
440− if (err)
441− return err;
445+ chip->ports[port].cmode = 0;
442446
443447 if (cmode) {
444448 err = mv88e6xxx_port_read(chip, port, MV88E6XXX_PORT_STS, &reg);
@@ -452,6 +456,12 @@ int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port, · 7 unmodified lines
452456 if (err)
453457 return err;
454458
459+ chip->ports[port].cmode = cmode;
460+
461+ lane = mv88e6390x_serdes_get_lane(chip, port);
462+ if (lane < 0)
463+ return lane;
464+
455465 err = mv88e6390x_serdes_power(chip, port, true);
456466 if (err)
457467 return err;
@@ -463,8 +473,6 @@ int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port, · 5 unmodified lines
463473 }
464474 }
465475
466− chip->ports[port].cmode = cmode;
467−
468476 return 0;
469477 }
470478
drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c+1−1
@@ -957,7 +957,7 @@ int bnx2x_vfpf_update_vlan(struct bnx2x *bp, u16 vid, u8 vf_qid, bool add) · 956 unmodified lines
957957 bnx2x_sample_bulletin(bp);
958958
959959 if (bp->shadow_bulletin.content.valid_bitmap & 1 << VLAN_VALID) {
960− BNX2X_ERR("Hypervisor will dicline the request, avoiding\n");
960+ BNX2X_ERR("Hypervisor will decline the request, avoiding\n");
961961 rc = -EINVAL;
962962 goto out;
963963 }
drivers/net/ethernet/broadcom/bnxt/bnxt.c+13−3
@@ -1133,6 +1133,8 @@ static void bnxt_tpa_start(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, · 1132 unmodified lines
11331133 tpa_info = &rxr->rx_tpa[agg_id];
11341134
11351135 if (unlikely(cons != rxr->rx_next_cons)) {
1136+ netdev_warn(bp->dev, "TPA cons %x != expected cons %x\n",
1137+ cons, rxr->rx_next_cons);
11361138 bnxt_sched_reset(bp, rxr);
11371139 return;
11381140 }
@@ -1585,15 +1587,17 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, · 446 unmodified lines
15851587 }
15861588
15871589 cons = rxcmp->rx_cmp_opaque;
1588− rx_buf = &rxr->rx_buf_ring[cons];
1589− data = rx_buf->data;
1590− data_ptr = rx_buf->data_ptr;
15911590 if (unlikely(cons != rxr->rx_next_cons)) {
15921591 int rc1 = bnxt_discard_rx(bp, cpr, raw_cons, rxcmp);
15931592
1593+ netdev_warn(bp->dev, "RX cons %x != expected cons %x\n",
1594+ cons, rxr->rx_next_cons);
15941595 bnxt_sched_reset(bp, rxr);
15951596 return rc1;
15961597 }
1598+ rx_buf = &rxr->rx_buf_ring[cons];
1599+ data = rx_buf->data;
1600+ data_ptr = rx_buf->data_ptr;
15971601 prefetch(data_ptr);
15981602
15991603 misc = le32_to_cpu(rxcmp->rx_cmp_misc_v1);
@@ -1610,11 +1614,17 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, · 10 unmodified lines
16101614
16111615 rx_buf->data = NULL;
16121616 if (rxcmp1->rx_cmp_cfa_code_errors_v2 & RX_CMP_L2_ERRORS) {
1617+ u32 rx_err = le32_to_cpu(rxcmp1->rx_cmp_cfa_code_errors_v2);
1618+
16131619 bnxt_reuse_rx_data(rxr, cons, data);
16141620 if (agg_bufs)
16151621 bnxt_reuse_rx_agg_bufs(cpr, cp_cons, agg_bufs);
16161622
16171623 rc = -EIO;
1624+ if (rx_err & RX_CMPL_ERRORS_BUFFER_ERROR_MASK) {
1625+ netdev_warn(bp->dev, "RX buffer error %x\n", rx_err);
1626+ bnxt_sched_reset(bp, rxr);
1627+ }
16181628 goto next_rx;
16191629 }
16201630
drivers/net/ethernet/broadcom/tg3.c+4−4
@@ -4283,7 +4283,7 @@ static void tg3_power_down(struct tg3 *tp) · 4282 unmodified lines
42834283 pci_set_power_state(tp->pdev, PCI_D3hot);
42844284 }
42854285
4286−static void tg3_aux_stat_to_speed_duplex(struct tg3 *tp, u32 val, u16 *speed, u8 *duplex)
4286+static void tg3_aux_stat_to_speed_duplex(struct tg3 *tp, u32 val, u32 *speed, u8 *duplex)
42874287 {
42884288 switch (val & MII_TG3_AUX_STAT_SPDMASK) {
42894289 case MII_TG3_AUX_STAT_10HALF:
@@ -4787,7 +4787,7 @@ static int tg3_setup_copper_phy(struct tg3 *tp, bool force_reset) · 497 unmodified lines
47874787 bool current_link_up;
47884788 u32 bmsr, val;
47894789 u32 lcl_adv, rmt_adv;
4790− u16 current_speed;
4790+ u32 current_speed;
47914791 u8 current_duplex;
47924792 int i, err;
47934793
@@ -5719,7 +5719,7 @@ out: · 925 unmodified lines
57195719 static int tg3_setup_fiber_phy(struct tg3 *tp, bool force_reset)
57205720 {
57215721 u32 orig_pause_cfg;
5722− u16 orig_active_speed;
5722+ u32 orig_active_speed;
57235723 u8 orig_active_duplex;
57245724 u32 mac_status;
57255725 bool current_link_up;
@@ -5823,7 +5823,7 @@ static int tg3_setup_fiber_mii_phy(struct tg3 *tp, bool force_reset) · 97 unmodified lines
58235823 {
58245824 int err = 0;
58255825 u32 bmsr, bmcr;
5826− u16 current_speed = SPEED_UNKNOWN;
5826+ u32 current_speed = SPEED_UNKNOWN;
58275827 u8 current_duplex = DUPLEX_UNKNOWN;
58285828 bool current_link_up = false;
58295829 u32 local_adv, remote_adv, sgsr;
drivers/net/ethernet/broadcom/tg3.h+2−2
@@ -2873,7 +2873,7 @@ struct tg3_tx_ring_info { · 2872 unmodified lines
28732873 struct tg3_link_config {
28742874 /* Describes what we're trying to get. */
28752875 u32 advertising;
2876− u16 speed;
2876+ u32 speed;
28772877 u8 duplex;
28782878 u8 autoneg;
28792879 u8 flowctrl;
@@ -2882,7 +2882,7 @@ struct tg3_link_config { · 2 unmodified lines
28822882 u8 active_flowctrl;
28832883
28842884 u8 active_duplex;
2885− u16 active_speed;
2885+ u32 active_speed;
28862886 u32 rmt_adv;
28872887 };
28882888
drivers/net/ethernet/cadence/macb_main.c+3−1
@@ -898,7 +898,9 @@ static void macb_tx_interrupt(struct macb_queue *queue) · 897 unmodified lines
898898
899899 /* First, update TX stats if needed */
900900 if (skb) {
901− if (gem_ptp_do_txstamp(queue, skb, desc) == 0) {
901+ if (unlikely(skb_shinfo(skb)->tx_flags &
902+ SKBTX_HW_TSTAMP) &&
903+ gem_ptp_do_txstamp(queue, skb, desc) == 0) {
902904 /* skb now belongs to timestamp buffer
903905 * and will be removed later
904906 */
drivers/net/ethernet/cavium/thunder/nicvf_main.c+32−10
@@ -32,6 +32,13 @@ · 31 unmodified lines
3232 #define DRV_NAME "nicvf"
3333 #define DRV_VERSION "1.0"
3434
35+/* NOTE: Packets bigger than 1530 are split across multiple pages and XDP needs
36+ * the buffer to be contiguous. Allow XDP to be set up only if we don't exceed
37+ * this value, keeping headroom for the 14 byte Ethernet header and two
38+ * VLAN tags (for QinQ)
39+ */
40+#define MAX_XDP_MTU (1530 - ETH_HLEN - VLAN_HLEN * 2)
41+
3542 /* Supported devices */
3643 static const struct pci_device_id nicvf_id_table[] = {
3744 { PCI_DEVICE_SUB(PCI_VENDOR_ID_CAVIUM,
@@ -1328,10 +1335,11 @@ int nicvf_stop(struct net_device *netdev) · 1290 unmodified lines
13281335 struct nicvf_cq_poll *cq_poll = NULL;
13291336 union nic_mbx mbx = {};
13301337
1331− cancel_delayed_work_sync(&nic->link_change_work);
1332−
13331338 /* wait till all queued set_rx_mode tasks completes */
1334− drain_workqueue(nic->nicvf_rx_mode_wq);
1339+ if (nic->nicvf_rx_mode_wq) {
1340+ cancel_delayed_work_sync(&nic->link_change_work);
1341+ drain_workqueue(nic->nicvf_rx_mode_wq);
1342+ }
13351343
13361344 mbx.msg.msg = NIC_MBOX_MSG_SHUTDOWN;
13371345 nicvf_send_msg_to_pf(nic, &mbx);
@@ -1452,7 +1460,8 @@ int nicvf_open(struct net_device *netdev) · 114 unmodified lines
14521460 struct nicvf_cq_poll *cq_poll = NULL;
14531461
14541462 /* wait till all queued set_rx_mode tasks completes if any */
1455− drain_workqueue(nic->nicvf_rx_mode_wq);
1463+ if (nic->nicvf_rx_mode_wq)
1464+ drain_workqueue(nic->nicvf_rx_mode_wq);
14561465
14571466 netif_carrier_off(netdev);
14581467
@@ -1550,10 +1559,12 @@ int nicvf_open(struct net_device *netdev) · 91 unmodified lines
15501559 /* Send VF config done msg to PF */
15511560 nicvf_send_cfg_done(nic);
15521561
1553− INIT_DELAYED_WORK(&nic->link_change_work,
1554− nicvf_link_status_check_task);
1555− queue_delayed_work(nic->nicvf_rx_mode_wq,
1556− &nic->link_change_work, 0);
1562+ if (nic->nicvf_rx_mode_wq) {
1563+ INIT_DELAYED_WORK(&nic->link_change_work,
1564+ nicvf_link_status_check_task);
1565+ queue_delayed_work(nic->nicvf_rx_mode_wq,
1566+ &nic->link_change_work, 0);
1567+ }
15571568
15581569 return 0;
15591570 cleanup:
@@ -1578,6 +1589,15 @@ static int nicvf_change_mtu(struct net_device *netdev, int new_mtu) · 18 unmodified lines
15781589 struct nicvf *nic = netdev_priv(netdev);
15791590 int orig_mtu = netdev->mtu;
15801591
1592+ /* For now just support only the usual MTU sized frames,
1593+ * plus some headroom for VLAN, QinQ.
1594+ */
1595+ if (nic->xdp_prog && new_mtu > MAX_XDP_MTU) {
1596+ netdev_warn(netdev, "Jumbo frames not yet supported with XDP, current MTU %d.\n",
1597+ netdev->mtu);
1598+ return -EINVAL;
1599+ }
1600+
15811601 netdev->mtu = new_mtu;
15821602
15831603 if (!netif_running(netdev))
@@ -1826,8 +1846,10 @@ static int nicvf_xdp_setup(struct nicvf *nic, struct bpf_prog *prog) · 242 unmodified lines
18261846 bool bpf_attached = false;
18271847 int ret = 0;
18281848
1829− /* For now just support only the usual MTU sized frames */
1830− if (prog && (dev->mtu > 1500)) {
1849+ /* For now just support only the usual MTU sized frames,
1850+ * plus some headroom for VLAN, QinQ.
1851+ */
1852+ if (prog && dev->mtu > MAX_XDP_MTU) {
18311853 netdev_warn(dev, "Jumbo frames not yet supported with XDP, current MTU %d.\n",
18321854 dev->mtu);
18331855 return -EOPNOTSUPP;
drivers/net/ethernet/cavium/thunder/nicvf_queues.c+14−16
@@ -105,20 +105,19 @@ static inline struct pgcache *nicvf_alloc_page(struct nicvf *nic, · 104 unmodified lines
105105 /* Check if page can be recycled */
106106 if (page) {
107107 ref_count = page_ref_count(page);
108− /* Check if this page has been used once i.e 'put_page'
109− * called after packet transmission i.e internal ref_count
110− * and page's ref_count are equal i.e page can be recycled.
108+ /* This page can be recycled if internal ref_count and page's
109+ * ref_count are equal, indicating that the page has been used
110+ * once for packet transmission. For non-XDP mode, internal
111+ * ref_count is always '1'.
111112 */
112− if (rbdr->is_xdp && (ref_count == pgcache->ref_count))
113− pgcache->ref_count--;
114− else
115− page = NULL;
116−
117− /* In non-XDP mode, page's ref_count needs to be '1' for it
118− * to be recycled.
119− */
120− if (!rbdr->is_xdp && (ref_count != 1))
113+ if (rbdr->is_xdp) {
114+ if (ref_count == pgcache->ref_count)
115+ pgcache->ref_count--;
116+ else
117+ page = NULL;
118+ } else if (ref_count != 1) {
121119 page = NULL;
120+ }
122121 }
123122
124123 if (!page) {
@@ -365,11 +364,10 @@ static void nicvf_free_rbdr(struct nicvf *nic, struct rbdr *rbdr) · 240 unmodified lines
365364 while (head < rbdr->pgcnt) {
366365 pgcache = &rbdr->pgcache[head];
367366 if (pgcache->page && page_ref_count(pgcache->page) != 0) {
368− if (!rbdr->is_xdp) {
369− put_page(pgcache->page);
370− continue;
367+ if (rbdr->is_xdp) {
368+ page_ref_sub(pgcache->page,
369+ pgcache->ref_count - 1);
371370 }
372− page_ref_sub(pgcache->page, pgcache->ref_count - 1);
373371 put_page(pgcache->page);
374372 }
375373 head++;
drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c+8−1
@@ -354,7 +354,10 @@ static struct cxgbi_ppm_pool *ppm_alloc_cpu_pool(unsigned int *total, · 353 unmodified lines
354354 ppmax = max;
355355
356356 /* pool size must be multiple of unsigned long */
357− bmap = BITS_TO_LONGS(ppmax);
357+ bmap = ppmax / BITS_PER_TYPE(unsigned long);
358+ if (!bmap)
359+ return NULL;
360+
358361 ppmax = (bmap * sizeof(unsigned long)) << 3;
359362
360363 alloc_sz = sizeof(*pools) + sizeof(unsigned long) * bmap;
@@ -402,6 +405,10 @@ int cxgbi_ppm_init(void **ppm_pp, struct net_device *ndev, · 41 unmodified lines
402405 if (reserve_factor) {
403406 ppmax_pool = ppmax / reserve_factor;
404407 pool = ppm_alloc_cpu_pool(&ppmax_pool, &pool_index_max);
408+ if (!pool) {
409+ ppmax_pool = 0;
410+ reserve_factor = 0;
411+ }
405412
406413 pr_debug("%s: ppmax %u, cpu total %u, per cpu %u.\n",
407414 ndev->name, ppmax, ppmax_pool, pool_index_max);
drivers/net/ethernet/freescale/fec_main.c+21−9
@@ -1840,13 +1840,9 @@ static int fec_enet_clk_enable(struct net_device *ndev, bool enable) · 1839 unmodified lines
18401840 int ret;
18411841
18421842 if (enable) {
1843− ret = clk_prepare_enable(fep->clk_ahb);
1844− if (ret)
1845− return ret;
1846−
18471843 ret = clk_prepare_enable(fep->clk_enet_out);
18481844 if (ret)
1849− goto failed_clk_enet_out;
1845+ return ret;
18501846
18511847 if (fep->clk_ptp) {
18521848 mutex_lock(&fep->ptp_clk_mutex);
@@ -1866,7 +1862,6 @@ static int fec_enet_clk_enable(struct net_device *ndev, bool enable) · 13 unmodified lines
18661862
18671863 phy_reset_after_clk_enable(ndev->phydev);
18681864 } else {
1869− clk_disable_unprepare(fep->clk_ahb);
18701865 clk_disable_unprepare(fep->clk_enet_out);
18711866 if (fep->clk_ptp) {
18721867 mutex_lock(&fep->ptp_clk_mutex);
@@ -1885,8 +1880,6 @@ failed_clk_ref: · 12 unmodified lines
18851880 failed_clk_ptp:
18861881 if (fep->clk_enet_out)
18871882 clk_disable_unprepare(fep->clk_enet_out);
1888−failed_clk_enet_out:
1889− clk_disable_unprepare(fep->clk_ahb);
18901883
18911884 return ret;
18921885 }
@@ -3470,6 +3463,9 @@ fec_probe(struct platform_device *pdev) · 1577 unmodified lines
34703463 ret = clk_prepare_enable(fep->clk_ipg);
34713464 if (ret)
34723465 goto failed_clk_ipg;
3466+ ret = clk_prepare_enable(fep->clk_ahb);
3467+ if (ret)
3468+ goto failed_clk_ahb;
34733469
34743470 fep->reg_phy = devm_regulator_get_optional(&pdev->dev, "phy");
34753471 if (!IS_ERR(fep->reg_phy)) {
@@ -3563,6 +3559,9 @@ failed_reset: · 87 unmodified lines
35633559 pm_runtime_put(&pdev->dev);
35643560 pm_runtime_disable(&pdev->dev);
35653561 failed_regulator:
3562+ clk_disable_unprepare(fep->clk_ahb);
3563+failed_clk_ahb:
3564+ clk_disable_unprepare(fep->clk_ipg);
35663565 failed_clk_ipg:
35673566 fec_enet_clk_enable(ndev, false);
35683567 failed_clk:
@@ -3686,6 +3685,7 @@ static int __maybe_unused fec_runtime_suspend(struct device *dev) · 117 unmodified lines
36863685 struct net_device *ndev = dev_get_drvdata(dev);
36873686 struct fec_enet_private *fep = netdev_priv(ndev);
36883687
3688+ clk_disable_unprepare(fep->clk_ahb);
36893689 clk_disable_unprepare(fep->clk_ipg);
36903690
36913691 return 0;
@@ -3695,8 +3695,20 @@ static int __maybe_unused fec_runtime_resume(struct device *dev) · 3 unmodified lines
36953695 {
36963696 struct net_device *ndev = dev_get_drvdata(dev);
36973697 struct fec_enet_private *fep = netdev_priv(ndev);
3698+ int ret;
36983699
3699− return clk_prepare_enable(fep->clk_ipg);
3700+ ret = clk_prepare_enable(fep->clk_ahb);
3701+ if (ret)
3702+ return ret;
3703+ ret = clk_prepare_enable(fep->clk_ipg);
3704+ if (ret)
3705+ goto failed_clk_ipg;
3706+
3707+ return 0;
3708+
3709+failed_clk_ipg:
3710+ clk_disable_unprepare(fep->clk_ahb);
3711+ return ret;
37003712 }
37013713
37023714 static const struct dev_pm_ops fec_pm_ops = {
drivers/net/ethernet/hisilicon/hns/hnae.c+3−1
@@ -150,7 +150,6 @@ out_buffer_fail: · 149 unmodified lines
150150 /* free desc along with its attached buffer */
151151 static void hnae_free_desc(struct hnae_ring *ring)
152152 {
153− hnae_free_buffers(ring);
154153 dma_unmap_single(ring_to_dev(ring), ring->desc_dma_addr,
155154 ring->desc_num * sizeof(ring->desc[0]),
156155 ring_to_dma_dir(ring));
@@ -183,6 +182,9 @@ static int hnae_alloc_desc(struct hnae_ring *ring) · 26 unmodified lines
183182 /* fini ring, also free the buffer for the ring */
184183 static void hnae_fini_ring(struct hnae_ring *ring)
185184 {
185+ if (is_rx_ring(ring))
186+ hnae_free_buffers(ring);
187+
186188 hnae_free_desc(ring);
187189 kfree(ring->desc_cb);
188190 ring->desc_cb = NULL;
drivers/net/ethernet/hisilicon/hns/hnae.h+1−1
@@ -357,7 +357,7 @@ struct hnae_buf_ops { · 356 unmodified lines
357357 };
358358
359359 struct hnae_queue {
360− void __iomem *io_base;
360+ u8 __iomem *io_base;
361361 phys_addr_t phy_base;
362362 struct hnae_ae_dev *dev; /* the device who use this queue */
363363 struct hnae_ring rx_ring ____cacheline_internodealigned_in_smp;
drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c+1−1
@@ -370,7 +370,7 @@ int hns_mac_clr_multicast(struct hns_mac_cb *mac_cb, int vfn) · 369 unmodified lines
370370 static void hns_mac_param_get(struct mac_params *param,
371371 struct hns_mac_cb *mac_cb)
372372 {
373− param->vaddr = (void *)mac_cb->vaddr;
373+ param->vaddr = mac_cb->vaddr;
374374 param->mac_mode = hns_get_enet_interface(mac_cb);
375375 ether_addr_copy(param->addr, mac_cb->addr_entry_idx[0].addr);
376376 param->mac_id = mac_cb->mac_id;
drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h+2−2
@@ -187,7 +187,7 @@ struct mac_statistics { · 186 unmodified lines
187187 /*mac para struct ,mac get param from nic or dsaf when initialize*/
188188 struct mac_params {
189189 char addr[ETH_ALEN];
190− void *vaddr; /*virtual address*/
190+ u8 __iomem *vaddr; /*virtual address*/
191191 struct device *dev;
192192 u8 mac_id;
193193 /**< Ethernet operation mode (MAC-PHY interface and speed) */
@@ -402,7 +402,7 @@ struct mac_driver { · 208 unmodified lines
402402 enum mac_mode mac_mode;
403403 u8 mac_id;
404404 struct hns_mac_cb *mac_cb;
405− void __iomem *io_base;
405+ u8 __iomem *io_base;
406406 unsigned int mac_en_flg;/*you'd better don't enable mac twice*/
407407 unsigned int virt_dev_num;
408408 struct device *dev;
drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c+33−20
@@ -1602,8 +1602,6 @@ static void hns_dsaf_set_mac_key( · 1601 unmodified lines
16021602 DSAF_TBL_TCAM_KEY_VLAN_S, vlan_id);
16031603 dsaf_set_field(mac_key->low.bits.port_vlan, DSAF_TBL_TCAM_KEY_PORT_M,
16041604 DSAF_TBL_TCAM_KEY_PORT_S, port);
1605−
1606− mac_key->low.bits.port_vlan = le16_to_cpu(mac_key->low.bits.port_vlan);
16071605 }
16081606
16091607 /**
@@ -1663,8 +1661,8 @@ int hns_dsaf_set_mac_uc_entry( · 53 unmodified lines
16631661 /* default config dvc to 0 */
16641662 mac_data.tbl_ucast_dvc = 0;
16651663 mac_data.tbl_ucast_out_port = mac_entry->port_num;
1666− tcam_data.tbl_tcam_data_high = cpu_to_le32(mac_key.high.val);
1667− tcam_data.tbl_tcam_data_low = cpu_to_le32(mac_key.low.val);
1664+ tcam_data.tbl_tcam_data_high = mac_key.high.val;
1665+ tcam_data.tbl_tcam_data_low = mac_key.low.val;
16681666
16691667 hns_dsaf_tcam_uc_cfg(dsaf_dev, entry_index, &tcam_data, &mac_data);
16701668
@@ -1786,9 +1784,6 @@ int hns_dsaf_add_mac_mc_port(struct dsaf_device *dsaf_dev, · 115 unmodified lines
17861784 0xff,
17871785 mc_mask);
17881786
1789− mask_key.high.val = le32_to_cpu(mask_key.high.val);
1790− mask_key.low.val = le32_to_cpu(mask_key.low.val);
1791−
17921787 pmask_key = (struct dsaf_tbl_tcam_data *)(&mask_key);
17931788 }
17941789
@@ -1840,8 +1835,8 @@ int hns_dsaf_add_mac_mc_port(struct dsaf_device *dsaf_dev, · 45 unmodified lines
18401835 dsaf_dev->ae_dev.name, mac_key.high.val,
18411836 mac_key.low.val, entry_index);
18421837
1843− tcam_data.tbl_tcam_data_high = cpu_to_le32(mac_key.high.val);
1844− tcam_data.tbl_tcam_data_low = cpu_to_le32(mac_key.low.val);
1838+ tcam_data.tbl_tcam_data_high = mac_key.high.val;
1839+ tcam_data.tbl_tcam_data_low = mac_key.low.val;
18451840
18461841 /* config mc entry with mask */
18471842 hns_dsaf_tcam_mc_cfg(dsaf_dev, entry_index, &tcam_data,
@@ -1956,9 +1951,6 @@ int hns_dsaf_del_mac_mc_port(struct dsaf_device *dsaf_dev, · 108 unmodified lines
19561951 /* config key mask */
19571952 hns_dsaf_set_mac_key(dsaf_dev, &mask_key, 0x00, 0xff, mc_mask);
19581953
1959− mask_key.high.val = le32_to_cpu(mask_key.high.val);
1960− mask_key.low.val = le32_to_cpu(mask_key.low.val);
1961−
19621954 pmask_key = (struct dsaf_tbl_tcam_data *)(&mask_key);
19631955 }
19641956
@@ -2012,8 +2004,8 @@ int hns_dsaf_del_mac_mc_port(struct dsaf_device *dsaf_dev, · 47 unmodified lines
20122004 soft_mac_entry += entry_index;
20132005 soft_mac_entry->index = DSAF_INVALID_ENTRY_IDX;
20142006 } else { /* not zero, just del port, update */
2015− tcam_data.tbl_tcam_data_high = cpu_to_le32(mac_key.high.val);
2016− tcam_data.tbl_tcam_data_low = cpu_to_le32(mac_key.low.val);
2007+ tcam_data.tbl_tcam_data_high = mac_key.high.val;
2008+ tcam_data.tbl_tcam_data_low = mac_key.low.val;
20172009
20182010 hns_dsaf_tcam_mc_cfg(dsaf_dev, entry_index,
20192011 &tcam_data,
@@ -2750,6 +2742,17 @@ int hns_dsaf_get_regs_count(void) · 730 unmodified lines
27502742 return DSAF_DUMP_REGS_NUM;
27512743 }
27522744
2745+static int hns_dsaf_get_port_id(u8 port)
2746+{
2747+ if (port < DSAF_SERVICE_NW_NUM)
2748+ return port;
2749+
2750+ if (port >= DSAF_BASE_INNER_PORT_NUM)
2751+ return port - DSAF_BASE_INNER_PORT_NUM + DSAF_SERVICE_NW_NUM;
2752+
2753+ return -EINVAL;
2754+}
2755+
27532756 static void set_promisc_tcam_enable(struct dsaf_device *dsaf_dev, u32 port)
27542757 {
27552758 struct dsaf_tbl_tcam_ucast_cfg tbl_tcam_ucast = {0, 1, 0, 0, 0x80};
@@ -2815,23 +2818,33 @@ static void set_promisc_tcam_enable(struct dsaf_device *dsaf_dev, u32 port) · 59 unmodified lines
28152818 memset(&temp_key, 0x0, sizeof(temp_key));
28162819 mask_entry.addr[0] = 0x01;
28172820 hns_dsaf_set_mac_key(dsaf_dev, &mask_key, mask_entry.in_vlan_id,
2818− port, mask_entry.addr);
2821+ 0xf, mask_entry.addr);
28192822 tbl_tcam_mcast.tbl_mcast_item_vld = 1;
28202823 tbl_tcam_mcast.tbl_mcast_old_en = 0;
28212824
2822− if (port < DSAF_SERVICE_NW_NUM) {
2823− mskid = port;
2824− } else if (port >= DSAF_BASE_INNER_PORT_NUM) {
2825− mskid = port - DSAF_BASE_INNER_PORT_NUM + DSAF_SERVICE_NW_NUM;
2826− } else {
2825+ /* set MAC port to handle multicast */
2826+ mskid = hns_dsaf_get_port_id(port);
2827+ if (mskid == -EINVAL) {
28272828 dev_err(dsaf_dev->dev, "%s,pnum(%d)error,key(%#x:%#x)\n",
28282829 dsaf_dev->ae_dev.name, port,
28292830 mask_key.high.val, mask_key.low.val);
28302831 return;
28312832 }
2833+ dsaf_set_bit(tbl_tcam_mcast.tbl_mcast_port_msk[mskid / 32],
2834+ mskid % 32, 1);
28322835
2836+ /* set pool bit map to handle multicast */
2837+ mskid = hns_dsaf_get_port_id(port_num);
2838+ if (mskid == -EINVAL) {
2839+ dev_err(dsaf_dev->dev,
2840+ "%s, pool bit map pnum(%d)error,key(%#x:%#x)\n",
2841+ dsaf_dev->ae_dev.name, port_num,
2842+ mask_key.high.val, mask_key.low.val);
2843+ return;
2844+ }
28332845 dsaf_set_bit(tbl_tcam_mcast.tbl_mcast_port_msk[mskid / 32],
28342846 mskid % 32, 1);
2847+
28352848 memcpy(&temp_key, &mask_key, sizeof(mask_key));
28362849 hns_dsaf_tcam_mc_cfg_vague(dsaf_dev, entry_index, &tbl_tcam_data_mc,
28372850 (struct dsaf_tbl_tcam_data *)(&mask_key),
drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h+2−0
@@ -467,4 +467,6 @@ int hns_dsaf_clr_mac_mc_port(struct dsaf_device *dsaf_dev, · 466 unmodified lines
467467 u8 mac_id, u8 port_num);
468468 int hns_dsaf_wait_pkt_clean(struct dsaf_device *dsaf_dev, int port);
469469
470+int hns_dsaf_roce_reset(struct fwnode_handle *dsaf_fwnode, bool dereset);
471+
470472 #endif /* __HNS_DSAF_MAIN_H__ */
drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c+1−1
@@ -670,7 +670,7 @@ static int hns_mac_config_sds_loopback(struct hns_mac_cb *mac_cb, bool en) · 669 unmodified lines
670670 dsaf_set_field(origin, 1ull << 10, 10, en);
671671 dsaf_write_syscon(mac_cb->serdes_ctrl, reg_offset, origin);
672672 } else {
673− u8 *base_addr = (u8 *)mac_cb->serdes_vaddr +
673+ u8 __iomem *base_addr = mac_cb->serdes_vaddr +
674674 (mac_cb->mac_id <= 3 ? 0x00280000 : 0x00200000);
675675 dsaf_set_reg_field(base_addr, reg_offset, 1ull << 10, 10, en);
676676 }
drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c+3−3
@@ -61,7 +61,7 @@ void hns_ppe_set_indir_table(struct hns_ppe_cb *ppe_cb, · 60 unmodified lines
6161 }
6262 }
6363
64−static void __iomem *
64+static u8 __iomem *
6565 hns_ppe_common_get_ioaddr(struct ppe_common_cb *ppe_common)
6666 {
6767 return ppe_common->dsaf_dev->ppe_base + PPE_COMMON_REG_OFFSET;
@@ -111,8 +111,8 @@ hns_ppe_common_free_cfg(struct dsaf_device *dsaf_dev, u32 comm_index) · 43 unmodified lines
111111 dsaf_dev->ppe_common[comm_index] = NULL;
112112 }
113113
114−static void __iomem *hns_ppe_get_iobase(struct ppe_common_cb *ppe_common,
115− int ppe_idx)
114+static u8 __iomem *hns_ppe_get_iobase(struct ppe_common_cb *ppe_common,
115+ int ppe_idx)
116116 {
117117 return ppe_common->dsaf_dev->ppe_base + ppe_idx * PPE_REG_OFFSET;
118118 }
drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.h+2−2
@@ -80,7 +80,7 @@ struct hns_ppe_cb { · 79 unmodified lines
8080 struct hns_ppe_hw_stats hw_stats;
8181
8282 u8 index; /* index in a ppe common device */
83− void __iomem *io_base;
83+ u8 __iomem *io_base;
8484 int virq;
8585 u32 rss_indir_table[HNS_PPEV2_RSS_IND_TBL_SIZE]; /*shadow indir tab */
8686 u32 rss_key[HNS_PPEV2_RSS_KEY_NUM]; /* rss hash key */
@@ -89,7 +89,7 @@ struct hns_ppe_cb { · 2 unmodified lines
8989 struct ppe_common_cb {
9090 struct device *dev;
9191 struct dsaf_device *dsaf_dev;
92− void __iomem *io_base;
92+ u8 __iomem *io_base;
9393
9494 enum ppe_common_mode ppe_mode;
9595
drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c+2−2
@@ -458,7 +458,7 @@ static void hns_rcb_ring_get_cfg(struct hnae_queue *q, int ring_type) · 457 unmodified lines
458458 mdnum_ppkt = HNS_RCB_RING_MAX_BD_PER_PKT;
459459 } else {
460460 ring = &q->tx_ring;
461− ring->io_base = (u8 __iomem *)ring_pair_cb->q.io_base +
461+ ring->io_base = ring_pair_cb->q.io_base +
462462 HNS_RCB_TX_REG_OFFSET;
463463 irq_idx = HNS_RCB_IRQ_IDX_TX;
464464 mdnum_ppkt = is_ver1 ? HNS_RCB_RING_MAX_TXBD_PER_PKT :
@@ -764,7 +764,7 @@ static int hns_rcb_get_ring_num(struct dsaf_device *dsaf_dev) · 299 unmodified lines
764764 }
765765 }
766766
767−static void __iomem *hns_rcb_common_get_vaddr(struct rcb_common_cb *rcb_common)
767+static u8 __iomem *hns_rcb_common_get_vaddr(struct rcb_common_cb *rcb_common)
768768 {
769769 struct dsaf_device *dsaf_dev = rcb_common->dsaf_dev;
770770
drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h+6−6
@@ -1018,7 +1018,7 @@ · 1017 unmodified lines
10181018 #define XGMAC_PAUSE_CTL_RSP_MODE_B 2
10191019 #define XGMAC_PAUSE_CTL_TX_XOFF_B 3
10201020
1021−static inline void dsaf_write_reg(void __iomem *base, u32 reg, u32 value)
1021+static inline void dsaf_write_reg(u8 __iomem *base, u32 reg, u32 value)
10221022 {
10231023 writel(value, base + reg);
10241024 }
@@ -1053,7 +1053,7 @@ static inline int dsaf_read_syscon(struct regmap *base, u32 reg, u32 *val) · 28 unmodified lines
10531053 #define dsaf_set_bit(origin, shift, val) \
10541054 dsaf_set_field((origin), (1ull << (shift)), (shift), (val))
10551055
1056−static inline void dsaf_set_reg_field(void __iomem *base, u32 reg, u32 mask,
1056+static inline void dsaf_set_reg_field(u8 __iomem *base, u32 reg, u32 mask,
10571057 u32 shift, u32 val)
10581058 {
10591059 u32 origin = dsaf_read_reg(base, reg);
@@ -1073,7 +1073,7 @@ static inline void dsaf_set_reg_field(void __iomem *base, u32 reg, u32 mask, · 13 unmodified lines
10731073 #define dsaf_get_bit(origin, shift) \
10741074 dsaf_get_field((origin), (1ull << (shift)), (shift))
10751075
1076−static inline u32 dsaf_get_reg_field(void __iomem *base, u32 reg, u32 mask,
1076+static inline u32 dsaf_get_reg_field(u8 __iomem *base, u32 reg, u32 mask,
10771077 u32 shift)
10781078 {
10791079 u32 origin;
@@ -1089,11 +1089,11 @@ static inline u32 dsaf_get_reg_field(void __iomem *base, u32 reg, u32 mask, · 9 unmodified lines
10891089 dsaf_get_reg_field((dev)->io_base, (reg), (1ull << (bit)), (bit))
10901090
10911091 #define dsaf_write_b(addr, data)\
1092− writeb((data), (__iomem unsigned char *)(addr))
1092+ writeb((data), (__iomem u8 *)(addr))
10931093 #define dsaf_read_b(addr)\
1094− readb((__iomem unsigned char *)(addr))
1094+ readb((__iomem u8 *)(addr))
10951095
10961096 #define hns_mac_reg_read64(drv, offset) \
1097− readq((__iomem void *)(((u8 *)(drv)->io_base + 0xc00 + (offset))))
1097+ readq((__iomem void *)(((drv)->io_base + 0xc00 + (offset))))
10981098
10991099 #endif /* _DSAF_REG_H */
drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c+1−1
@@ -129,7 +129,7 @@ static void hns_xgmac_lf_rf_control_init(struct mac_driver *mac_drv) · 128 unmodified lines
129129 dsaf_set_bit(val, XGMAC_UNIDIR_EN_B, 0);
130130 dsaf_set_bit(val, XGMAC_RF_TX_EN_B, 1);
131131 dsaf_set_field(val, XGMAC_LF_RF_INSERT_M, XGMAC_LF_RF_INSERT_S, 0);
132− dsaf_write_reg(mac_drv, XGMAC_MAC_TX_LF_RF_CONTROL_REG, val);
132+ dsaf_write_dev(mac_drv, XGMAC_MAC_TX_LF_RF_CONTROL_REG, val);
133133 }
134134
135135 /**
drivers/net/ethernet/hisilicon/hns/hns_enet.c+5−7
@@ -29,9 +29,6 @@ · 28 unmodified lines
2929
3030 #define SERVICE_TIMER_HZ (1 * HZ)
3131
32−#define NIC_TX_CLEAN_MAX_NUM 256
33−#define NIC_RX_CLEAN_MAX_NUM 64
34−
3532 #define RCB_IRQ_NOT_INITED 0
3633 #define RCB_IRQ_INITED 1
3734 #define HNS_BUFFER_SIZE_2048 2048
@@ -376,8 +373,6 @@ netdev_tx_t hns_nic_net_xmit_hw(struct net_device *ndev, · 338 unmodified lines
376373 wmb(); /* commit all data before submit */
377374 assert(skb->queue_mapping < priv->ae_handle->q_num);
378375 hnae_queue_xmit(priv->ae_handle->qs[skb->queue_mapping], buf_num);
379− ring->stats.tx_pkts++;
380− ring->stats.tx_bytes += skb->len;
381376
382377 return NETDEV_TX_OK;
383378
@@ -999,6 +994,9 @@ static int hns_nic_tx_poll_one(struct hns_nic_ring_data *ring_data, · 615 unmodified lines
999994 /* issue prefetch for next Tx descriptor */
1000995 prefetch(&ring->desc_cb[ring->next_to_clean]);
1001996 }
997+ /* update tx ring statistics. */
998+ ring->stats.tx_pkts += pkts;
999+ ring->stats.tx_bytes += bytes;
10021000
10031001 NETIF_TX_UNLOCK(ring);
10041002
@@ -2152,7 +2150,7 @@ static int hns_nic_init_ring_data(struct hns_nic_priv *priv) · 1147 unmodified lines
21522150 hns_nic_tx_fini_pro_v2;
21532151
21542152 netif_napi_add(priv->netdev, &rd->napi,
2155− hns_nic_common_poll, NIC_TX_CLEAN_MAX_NUM);
2153+ hns_nic_common_poll, NAPI_POLL_WEIGHT);
21562154 rd->ring->irq_init_flag = RCB_IRQ_NOT_INITED;
21572155 }
21582156 for (i = h->q_num; i < h->q_num * 2; i++) {
@@ -2165,7 +2163,7 @@ static int hns_nic_init_ring_data(struct hns_nic_priv *priv) · 6 unmodified lines
21652163 hns_nic_rx_fini_pro_v2;
21662164
21672165 netif_napi_add(priv->netdev, &rd->napi,
2168− hns_nic_common_poll, NIC_RX_CLEAN_MAX_NUM);
2166+ hns_nic_common_poll, NAPI_POLL_WEIGHT);
21692167 rd->ring->irq_init_flag = RCB_IRQ_NOT_INITED;
21702168 }
21712169
drivers/net/ethernet/hisilicon/hns3/hns3pf/Makefile+1−1
@@ -3,7 +3,7 @@ · 2 unmodified lines
33 # Makefile for the HISILICON network device drivers.
44 #
55
6−ccflags-y := -Idrivers/net/ethernet/hisilicon/hns3
6+ccflags-y := -I $(srctree)/drivers/net/ethernet/hisilicon/hns3
77
88 obj-$(CONFIG_HNS3_HCLGE) += hclge.o
99 hclge-objs = hclge_main.o hclge_cmd.o hclge_mdio.o hclge_tm.o hclge_mbx.o hclge_err.o hclge_debugfs.o
drivers/net/ethernet/hisilicon/hns3/hns3vf/Makefile+1−1
@@ -3,7 +3,7 @@ · 2 unmodified lines
33 # Makefile for the HISILICON network device drivers.
44 #
55
6−ccflags-y := -Idrivers/net/ethernet/hisilicon/hns3
6+ccflags-y := -I $(srctree)/drivers/net/ethernet/hisilicon/hns3
77
88 obj-$(CONFIG_HNS3_HCLGEVF) += hclgevf.o
99 hclgevf-objs = hclgevf_main.o hclgevf_cmd.o hclgevf_mbx.o
drivers/net/ethernet/hisilicon/hns_mdio.c+7−11
@@ -39,7 +39,7 @@ struct hns_mdio_sc_reg { · 38 unmodified lines
3939 };
4040
4141 struct hns_mdio_device {
42− void *vbase; /* mdio reg base address */
42+ u8 __iomem *vbase; /* mdio reg base address */
4343 struct regmap *subctrl_vbase;
4444 struct hns_mdio_sc_reg sc_reg;
4545 };
@@ -96,21 +96,17 @@ enum mdio_c45_op_seq { · 50 unmodified lines
9696 #define MDIO_SC_CLK_ST 0x531C
9797 #define MDIO_SC_RESET_ST 0x5A1C
9898
99−static void mdio_write_reg(void *base, u32 reg, u32 value)
99+static void mdio_write_reg(u8 __iomem *base, u32 reg, u32 value)
100100 {
101− u8 __iomem *reg_addr = (u8 __iomem *)base;
102−
103− writel_relaxed(value, reg_addr + reg);
101+ writel_relaxed(value, base + reg);
104102 }
105103
106104 #define MDIO_WRITE_REG(a, reg, value) \
107105 mdio_write_reg((a)->vbase, (reg), (value))
108106
109−static u32 mdio_read_reg(void *base, u32 reg)
107+static u32 mdio_read_reg(u8 __iomem *base, u32 reg)
110108 {
111− u8 __iomem *reg_addr = (u8 __iomem *)base;
112−
113− return readl_relaxed(reg_addr + reg);
109+ return readl_relaxed(base + reg);
114110 }
115111
116112 #define mdio_set_field(origin, mask, shift, val) \
@@ -121,7 +117,7 @@ static u32 mdio_read_reg(void *base, u32 reg) · 4 unmodified lines
121117
122118 #define mdio_get_field(origin, mask, shift) (((origin) >> (shift)) & (mask))
123119
124−static void mdio_set_reg_field(void *base, u32 reg, u32 mask, u32 shift,
120+static void mdio_set_reg_field(u8 __iomem *base, u32 reg, u32 mask, u32 shift,
125121 u32 val)
126122 {
127123 u32 origin = mdio_read_reg(base, reg);
@@ -133,7 +129,7 @@ static void mdio_set_reg_field(void *base, u32 reg, u32 mask, u32 shift, · 5 unmodified lines
133129 #define MDIO_SET_REG_FIELD(dev, reg, mask, shift, val) \
134130 mdio_set_reg_field((dev)->vbase, (reg), (mask), (shift), (val))
135131
136−static u32 mdio_get_reg_field(void *base, u32 reg, u32 mask, u32 shift)
132+static u32 mdio_get_reg_field(u8 __iomem *base, u32 reg, u32 mask, u32 shift)
137133 {
138134 u32 origin;
139135
drivers/net/ethernet/ibm/ibmvnic.c+28−9
@@ -1885,6 +1885,7 @@ static int do_hard_reset(struct ibmvnic_adapter *adapter, · 1884 unmodified lines
18851885 */
18861886 adapter->state = VNIC_PROBED;
18871887
1888+ reinit_completion(&adapter->init_done);
18881889 rc = init_crq_queue(adapter);
18891890 if (rc) {
18901891 netdev_err(adapter->netdev,
@@ -3761,6 +3762,7 @@ static void handle_query_ip_offload_rsp(struct ibmvnic_adapter *adapter) · 1870 unmodified lines
37613762 {
37623763 struct device *dev = &adapter->vdev->dev;
37633764 struct ibmvnic_query_ip_offload_buffer *buf = &adapter->ip_offload_buf;
3765+ netdev_features_t old_hw_features = 0;
37643766 union ibmvnic_crq crq;
37653767 int i;
37663768
@@ -3836,24 +3838,41 @@ static void handle_query_ip_offload_rsp(struct ibmvnic_adapter *adapter) · 69 unmodified lines
38363838 adapter->ip_offload_ctrl.large_rx_ipv4 = 0;
38373839 adapter->ip_offload_ctrl.large_rx_ipv6 = 0;
38383840
3839− adapter->netdev->features = NETIF_F_SG | NETIF_F_GSO;
3841+ if (adapter->state != VNIC_PROBING) {
3842+ old_hw_features = adapter->netdev->hw_features;
3843+ adapter->netdev->hw_features = 0;
3844+ }
3845+
3846+ adapter->netdev->hw_features = NETIF_F_SG | NETIF_F_GSO | NETIF_F_GRO;
38403847
38413848 if (buf->tcp_ipv4_chksum || buf->udp_ipv4_chksum)
3842− adapter->netdev->features |= NETIF_F_IP_CSUM;
3849+ adapter->netdev->hw_features |= NETIF_F_IP_CSUM;
38433850
38443851 if (buf->tcp_ipv6_chksum || buf->udp_ipv6_chksum)
3845− adapter->netdev->features |= NETIF_F_IPV6_CSUM;
3852+ adapter->netdev->hw_features |= NETIF_F_IPV6_CSUM;
38463853
38473854 if ((adapter->netdev->features &
38483855 (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM)))
3849− adapter->netdev->features |= NETIF_F_RXCSUM;
3856+ adapter->netdev->hw_features |= NETIF_F_RXCSUM;
38503857
38513858 if (buf->large_tx_ipv4)
3852− adapter->netdev->features |= NETIF_F_TSO;
3859+ adapter->netdev->hw_features |= NETIF_F_TSO;
38533860 if (buf->large_tx_ipv6)
3854− adapter->netdev->features |= NETIF_F_TSO6;
3861+ adapter->netdev->hw_features |= NETIF_F_TSO6;
3862+
3863+ if (adapter->state == VNIC_PROBING) {
3864+ adapter->netdev->features |= adapter->netdev->hw_features;
3865+ } else if (old_hw_features != adapter->netdev->hw_features) {
3866+ netdev_features_t tmp = 0;
38553867
3856− adapter->netdev->hw_features |= adapter->netdev->features;
3868+ /* disable features no longer supported */
3869+ adapter->netdev->features &= adapter->netdev->hw_features;
3870+ /* turn on features now supported if previously enabled */
3871+ tmp = (old_hw_features ^ adapter->netdev->hw_features) &
3872+ adapter->netdev->hw_features;
3873+ adapter->netdev->features |=
3874+ tmp & adapter->netdev->wanted_features;
3875+ }
38573876
38583877 memset(&crq, 0, sizeof(crq));
38593878 crq.control_ip_offload.first = IBMVNIC_CRQ_CMD;
@@ -4625,7 +4644,7 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter *adapter) · 765 unmodified lines
46254644 old_num_rx_queues = adapter->req_rx_queues;
46264645 old_num_tx_queues = adapter->req_tx_queues;
46274646
4628− init_completion(&adapter->init_done);
4647+ reinit_completion(&adapter->init_done);
46294648 adapter->init_done_rc = 0;
46304649 ibmvnic_send_crq_init(adapter);
46314650 if (!wait_for_completion_timeout(&adapter->init_done, timeout)) {
@@ -4680,7 +4699,6 @@ static int ibmvnic_init(struct ibmvnic_adapter *adapter) · 48 unmodified lines
46804699
46814700 adapter->from_passive_init = false;
46824701
4683− init_completion(&adapter->init_done);
46844702 adapter->init_done_rc = 0;
46854703 ibmvnic_send_crq_init(adapter);
46864704 if (!wait_for_completion_timeout(&adapter->init_done, timeout)) {
@@ -4759,6 +4777,7 @@ static int ibmvnic_probe(struct vio_dev *dev, const struct vio_device_id *id) · 72 unmodified lines
47594777 INIT_WORK(&adapter->ibmvnic_reset, __ibmvnic_reset);
47604778 INIT_LIST_HEAD(&adapter->rwi_list);
47614779 spin_lock_init(&adapter->rwi_lock);
4780+ init_completion(&adapter->init_done);
47624781 adapter->resetting = false;
47634782
47644783 adapter->mac_change_pending = false;
drivers/net/ethernet/intel/fm10k/fm10k_main.c+2−0
@@ -41,6 +41,8 @@ static int __init fm10k_init_module(void) · 40 unmodified lines
4141 /* create driver workqueue */
4242 fm10k_workqueue = alloc_workqueue("%s", WQ_MEM_RECLAIM, 0,
4343 fm10k_driver_name);
44+ if (!fm10k_workqueue)
45+ return -ENOMEM;
4446
4547 fm10k_dbg_init();
4648
drivers/net/ethernet/intel/i40e/i40e.h+2−14
@@ -790,6 +790,8 @@ struct i40e_vsi { · 789 unmodified lines
790790
791791 /* VSI specific handlers */
792792 irqreturn_t (*irq_handler)(int irq, void *data);
793+
794+ unsigned long *af_xdp_zc_qps; /* tracks AF_XDP ZC enabled qps */
793795 } ____cacheline_internodealigned_in_smp;
794796
795797 struct i40e_netdev_priv {
@@ -1096,20 +1098,6 @@ static inline bool i40e_enabled_xdp_vsi(struct i40e_vsi *vsi) · 300 unmodified lines
10961098 return !!vsi->xdp_prog;
10971099 }
10981100
1099−static inline struct xdp_umem *i40e_xsk_umem(struct i40e_ring *ring)
1100−{
1101− bool xdp_on = i40e_enabled_xdp_vsi(ring->vsi);
1102− int qid = ring->queue_index;
1103−
1104− if (ring_is_xdp(ring))
1105− qid -= ring->vsi->alloc_queue_pairs;
1106−
1107− if (!xdp_on)
1108− return NULL;
1109−
1110− return xdp_get_umem_from_qid(ring->vsi->netdev, qid);
1111−}
1112−
11131101 int i40e_create_queue_channel(struct i40e_vsi *vsi, struct i40e_channel *ch);
11141102 int i40e_set_bw_limit(struct i40e_vsi *vsi, u16 seid, u64 max_tx_rate);
11151103 int i40e_add_del_cloud_filter(struct i40e_vsi *vsi,
drivers/net/ethernet/intel/i40e/i40e_ethtool.c+1−2
@@ -2573,8 +2573,7 @@ static int i40e_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) · 2572 unmodified lines
25732573 return -EOPNOTSUPP;
25742574
25752575 /* only magic packet is supported */
2576− if (wol->wolopts && (wol->wolopts != WAKE_MAGIC)
2577− | (wol->wolopts != WAKE_FILTER))
2576+ if (wol->wolopts & ~WAKE_MAGIC)
25782577 return -EOPNOTSUPP;
25792578
25802579 /* is this a new value? */
drivers/net/ethernet/intel/i40e/i40e_main.c+28−0
@@ -3063,6 +3063,26 @@ static void i40e_config_xps_tx_ring(struct i40e_ring *ring) · 3062 unmodified lines
30633063 ring->queue_index);
30643064 }
30653065
3066+/**
3067+ * i40e_xsk_umem - Retrieve the AF_XDP ZC if XDP and ZC is enabled
3068+ * @ring: The Tx or Rx ring
3069+ *
3070+ * Returns the UMEM or NULL.
3071+ **/
3072+static struct xdp_umem *i40e_xsk_umem(struct i40e_ring *ring)
3073+{
3074+ bool xdp_on = i40e_enabled_xdp_vsi(ring->vsi);
3075+ int qid = ring->queue_index;
3076+
3077+ if (ring_is_xdp(ring))
3078+ qid -= ring->vsi->alloc_queue_pairs;
3079+
3080+ if (!xdp_on || !test_bit(qid, ring->vsi->af_xdp_zc_qps))
3081+ return NULL;
3082+
3083+ return xdp_get_umem_from_qid(ring->vsi->netdev, qid);
3084+}
3085+
30663086 /**
30673087 * i40e_configure_tx_ring - Configure a transmit ring context and rest
30683088 * @ring: The Tx ring to configure
@@ -10064,6 +10084,12 @@ static int i40e_vsi_mem_alloc(struct i40e_pf *pf, enum i40e_vsi_type type) · 6995 unmodified lines
1006410084 hash_init(vsi->mac_filter_hash);
1006510085 vsi->irqs_ready = false;
1006610086
10087+ if (type == I40E_VSI_MAIN) {
10088+ vsi->af_xdp_zc_qps = bitmap_zalloc(pf->num_lan_qps, GFP_KERNEL);
10089+ if (!vsi->af_xdp_zc_qps)
10090+ goto err_rings;
10091+ }
10092+
1006710093 ret = i40e_set_num_rings_in_vsi(vsi);
1006810094 if (ret)
1006910095 goto err_rings;
@@ -10082,6 +10108,7 @@ static int i40e_vsi_mem_alloc(struct i40e_pf *pf, enum i40e_vsi_type type) · 12 unmodified lines
1008210108 goto unlock_pf;
1008310109
1008410110 err_rings:
10111+ bitmap_free(vsi->af_xdp_zc_qps);
1008510112 pf->next_vsi = i - 1;
1008610113 kfree(vsi);
1008710114 unlock_pf:
@@ -10162,6 +10189,7 @@ static int i40e_vsi_clear(struct i40e_vsi *vsi) · 74 unmodified lines
1016210189 i40e_put_lump(pf->qp_pile, vsi->base_queue, vsi->idx);
1016310190 i40e_put_lump(pf->irq_pile, vsi->base_vector, vsi->idx);
1016410191
10192+ bitmap_free(vsi->af_xdp_zc_qps);
1016510193 i40e_vsi_free_arrays(vsi, true);
1016610194 i40e_clear_rss_config_user(vsi);
1016710195
drivers/net/ethernet/intel/i40e/i40e_ptp.c+3−2
@@ -146,12 +146,13 @@ static int i40e_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb) · 145 unmodified lines
146146 static int i40e_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
147147 {
148148 struct i40e_pf *pf = container_of(ptp, struct i40e_pf, ptp_caps);
149− struct timespec64 now;
149+ struct timespec64 now, then;
150150
151+ then = ns_to_timespec64(delta);
151152 mutex_lock(&pf->tmreg_lock);
152153
153154 i40e_ptp_read(pf, &now, NULL);
154− timespec64_add_ns(&now, delta);
155+ now = timespec64_add(now, then);
155156 i40e_ptp_write(pf, (const struct timespec64 *)&now);
156157
157158 mutex_unlock(&pf->tmreg_lock);
drivers/net/ethernet/intel/i40e/i40e_xsk.c+3−0
@@ -102,6 +102,8 @@ static int i40e_xsk_umem_enable(struct i40e_vsi *vsi, struct xdp_umem *umem, · 101 unmodified lines
102102 if (err)
103103 return err;
104104
105+ set_bit(qid, vsi->af_xdp_zc_qps);
106+
105107 if_running = netif_running(vsi->netdev) && i40e_enabled_xdp_vsi(vsi);
106108
107109 if (if_running) {
@@ -148,6 +150,7 @@ static int i40e_xsk_umem_disable(struct i40e_vsi *vsi, u16 qid) · 40 unmodified lines
148150 return err;
149151 }
150152
153+ clear_bit(qid, vsi->af_xdp_zc_qps);
151154 i40e_xsk_umem_dma_unmap(vsi, umem);
152155
153156 if (if_running) {
drivers/net/ethernet/intel/igb/e1000_defines.h+2−0
@@ -194,6 +194,8 @@ · 193 unmodified lines
194194 /* enable link status from external LINK_0 and LINK_1 pins */
195195 #define E1000_CTRL_SWDPIN0 0x00040000 /* SWDPIN 0 value */
196196 #define E1000_CTRL_SWDPIN1 0x00080000 /* SWDPIN 1 value */
197+#define E1000_CTRL_ADVD3WUC 0x00100000 /* D3 WUC */
198+#define E1000_CTRL_EN_PHY_PWR_MGMT 0x00200000 /* PHY PM enable */
197199 #define E1000_CTRL_SDP0_DIR 0x00400000 /* SDP0 Data direction */
198200 #define E1000_CTRL_SDP1_DIR 0x00800000 /* SDP1 Data direction */
199201 #define E1000_CTRL_RST 0x04000000 /* Global reset */
drivers/net/ethernet/intel/igb/igb_main.c+8−49
@@ -8740,9 +8740,7 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake, · 8739 unmodified lines
87408740 struct e1000_hw *hw = &adapter->hw;
87418741 u32 ctrl, rctl, status;
87428742 u32 wufc = runtime ? E1000_WUFC_LNKC : adapter->wol;
8743−#ifdef CONFIG_PM
8744− int retval = 0;
8745−#endif
8743+ bool wake;
87468744
87478745 rtnl_lock();
87488746 netif_device_detach(netdev);
@@ -8755,14 +8753,6 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake, · 6 unmodified lines
87558753 igb_clear_interrupt_scheme(adapter);
87568754 rtnl_unlock();
87578755
8758−#ifdef CONFIG_PM
8759− if (!runtime) {
8760− retval = pci_save_state(pdev);
8761− if (retval)
8762− return retval;
8763− }
8764−#endif
8765−
87668756 status = rd32(E1000_STATUS);
87678757 if (status & E1000_STATUS_LU)
87688758 wufc &= ~E1000_WUFC_LNKC;
@@ -8779,10 +8769,6 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake, · 10 unmodified lines
87798769 }
87808770
87818771 ctrl = rd32(E1000_CTRL);
8782− /* advertise wake from D3Cold */
8783− #define E1000_CTRL_ADVD3WUC 0x00100000
8784− /* phy power management enable */
8785− #define E1000_CTRL_EN_PHY_PWR_MGMT 0x00200000
87868772 ctrl |= E1000_CTRL_ADVD3WUC;
87878773 wr32(E1000_CTRL, ctrl);
87888774
@@ -8796,12 +8782,15 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake, · 7 unmodified lines
87968782 wr32(E1000_WUFC, 0);
87978783 }
87988784
8799− *enable_wake = wufc || adapter->en_mng_pt;
8800− if (!*enable_wake)
8785+ wake = wufc || adapter->en_mng_pt;
8786+ if (!wake)
88018787 igb_power_down_link(adapter);
88028788 else
88038789 igb_power_up_link(adapter);
88048790
8791+ if (enable_wake)
8792+ *enable_wake = wake;
8793+
88058794 /* Release control of h/w to f/w. If f/w is AMT enabled, this
88068795 * would have already happened in close and is redundant.
88078796 */
@@ -8844,22 +8833,7 @@ static void igb_deliver_wake_packet(struct net_device *netdev) · 36 unmodified lines
88448833
88458834 static int __maybe_unused igb_suspend(struct device *dev)
88468835 {
8847− int retval;
8848− bool wake;
8849− struct pci_dev *pdev = to_pci_dev(dev);
8850−
8851− retval = __igb_shutdown(pdev, &wake, 0);
8852− if (retval)
8853− return retval;
8854−
8855− if (wake) {
8856− pci_prepare_to_sleep(pdev);
8857− } else {
8858− pci_wake_from_d3(pdev, false);
8859− pci_set_power_state(pdev, PCI_D3hot);
8860− }
8861−
8862− return 0;
8836+ return __igb_shutdown(to_pci_dev(dev), NULL, 0);
88638837 }
88648838
88658839 static int __maybe_unused igb_resume(struct device *dev)
@@ -8930,22 +8904,7 @@ static int __maybe_unused igb_runtime_idle(struct device *dev) · 64 unmodified lines
89308904
89318905 static int __maybe_unused igb_runtime_suspend(struct device *dev)
89328906 {
8933− struct pci_dev *pdev = to_pci_dev(dev);
8934− int retval;
8935− bool wake;
8936−
8937− retval = __igb_shutdown(pdev, &wake, 1);
8938− if (retval)
8939− return retval;
8940−
8941− if (wake) {
8942− pci_prepare_to_sleep(pdev);
8943− } else {
8944− pci_wake_from_d3(pdev, false);
8945− pci_set_power_state(pdev, PCI_D3hot);
8946− }
8947−
8948− return 0;
8907+ return __igb_shutdown(to_pci_dev(dev), NULL, 1);
89498908 }
89508909
89518910 static int __maybe_unused igb_runtime_resume(struct device *dev)
drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c+9−7
@@ -905,13 +905,12 @@ s32 ixgbe_mii_bus_init(struct ixgbe_hw *hw) · 904 unmodified lines
905905 struct pci_dev *pdev = adapter->pdev;
906906 struct device *dev = &adapter->netdev->dev;
907907 struct mii_bus *bus;
908+ int err = -ENODEV;
908909
909− adapter->mii_bus = devm_mdiobus_alloc(dev);
910− if (!adapter->mii_bus)
910+ bus = devm_mdiobus_alloc(dev);
911+ if (!bus)
911912 return -ENOMEM;
912913
913− bus = adapter->mii_bus;
914−
915914 switch (hw->device_id) {
916915 /* C3000 SoCs */
917916 case IXGBE_DEV_ID_X550EM_A_KR:
@@ -949,12 +948,15 @@ s32 ixgbe_mii_bus_init(struct ixgbe_hw *hw) · 31 unmodified lines
949948 */
950949 hw->phy.mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_SUPPORTS_C22;
951950
952− return mdiobus_register(bus);
951+ err = mdiobus_register(bus);
952+ if (!err) {
953+ adapter->mii_bus = bus;
954+ return 0;
955+ }
953956
954957 ixgbe_no_mii_bus:
955958 devm_mdiobus_free(dev, bus);
956− adapter->mii_bus = NULL;
957− return -ENODEV;
959+ return err;
958960 }
959961
960962 /**
drivers/net/ethernet/mellanox/mlx5/core/en.h+1−0
@@ -858,6 +858,7 @@ void mlx5e_close_channels(struct mlx5e_channels *chs); · 857 unmodified lines
858858 * switching channels
859859 */
860860 typedef int (*mlx5e_fp_hw_modify)(struct mlx5e_priv *priv);
861+int mlx5e_safe_reopen_channels(struct mlx5e_priv *priv);
861862 int mlx5e_safe_switch_channels(struct mlx5e_priv *priv,
862863 struct mlx5e_channels *new_chs,
863864 mlx5e_fp_hw_modify hw_modify);
drivers/net/ethernet/mellanox/mlx5/core/en/port.c+0−3
@@ -96,9 +96,6 @@ int mlx5_port_query_eth_proto(struct mlx5_core_dev *dev, u8 port, bool ext, · 95 unmodified lines
9696 if (!eproto)
9797 return -EINVAL;
9898
99− if (ext != MLX5_CAP_PCAM_FEATURE(dev, ptys_extended_ethernet))
100− return -EOPNOTSUPP;
101−
10299 err = mlx5_query_port_ptys(dev, out, sizeof(out), MLX5_PTYS_EN, port);
103100 if (err)
104101 return err;
drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c+22−17
@@ -122,7 +122,9 @@ out: · 121 unmodified lines
122122 return err;
123123 }
124124
125−/* xoff = ((301+2.16 * len [m]) * speed [Gbps] + 2.72 MTU [B]) */
125+/* xoff = ((301+2.16 * len [m]) * speed [Gbps] + 2.72 MTU [B])
126+ * minimum speed value is 40Gbps
127+ */
126128 static u32 calculate_xoff(struct mlx5e_priv *priv, unsigned int mtu)
127129 {
128130 u32 speed;
@@ -130,10 +132,9 @@ static u32 calculate_xoff(struct mlx5e_priv *priv, unsigned int mtu) · 1 unmodified line
130132 int err;
131133
132134 err = mlx5e_port_linkspeed(priv->mdev, &speed);
133− if (err) {
134− mlx5_core_warn(priv->mdev, "cannot get port speed\n");
135− return 0;
136− }
135+ if (err)
136+ speed = SPEED_40000;
137+ speed = max_t(u32, speed, SPEED_40000);
137138
138139 xoff = (301 + 216 * priv->dcbx.cable_len / 100) * speed / 1000 + 272 * mtu / 100;
139140
@@ -142,7 +143,7 @@ static u32 calculate_xoff(struct mlx5e_priv *priv, unsigned int mtu) · 2 unmodified lines
142143 }
143144
144145 static int update_xoff_threshold(struct mlx5e_port_buffer *port_buffer,
145− u32 xoff, unsigned int mtu)
146+ u32 xoff, unsigned int max_mtu)
146147 {
147148 int i;
148149
@@ -154,11 +155,12 @@ static int update_xoff_threshold(struct mlx5e_port_buffer *port_buffer, · 5 unmodified lines
154155 }
155156
156157 if (port_buffer->buffer[i].size <
157− (xoff + mtu + (1 << MLX5E_BUFFER_CELL_SHIFT)))
158+ (xoff + max_mtu + (1 << MLX5E_BUFFER_CELL_SHIFT)))
158159 return -ENOMEM;
159160
160161 port_buffer->buffer[i].xoff = port_buffer->buffer[i].size - xoff;
161− port_buffer->buffer[i].xon = port_buffer->buffer[i].xoff - mtu;
162+ port_buffer->buffer[i].xon =
163+ port_buffer->buffer[i].xoff - max_mtu;
162164 }
163165
164166 return 0;
@@ -166,7 +168,7 @@ static int update_xoff_threshold(struct mlx5e_port_buffer *port_buffer, · 1 unmodified line
166168
167169 /**
168170 * update_buffer_lossy()
169− * mtu: device's MTU
171+ * max_mtu: netdev's max_mtu
170172 * pfc_en: <input> current pfc configuration
171173 * buffer: <input> current prio to buffer mapping
172174 * xoff: <input> xoff value
@@ -183,7 +185,7 @@ static int update_xoff_threshold(struct mlx5e_port_buffer *port_buffer, · 10 unmodified lines
183185 * Return 0 if no error.
184186 * Set change to true if buffer configuration is modified.
185187 */
186−static int update_buffer_lossy(unsigned int mtu,
188+static int update_buffer_lossy(unsigned int max_mtu,
187189 u8 pfc_en, u8 *buffer, u32 xoff,
188190 struct mlx5e_port_buffer *port_buffer,
189191 bool *change)
@@ -220,7 +222,7 @@ static int update_buffer_lossy(unsigned int mtu, · 30 unmodified lines
220222 }
221223
222224 if (changed) {
223− err = update_xoff_threshold(port_buffer, xoff, mtu);
225+ err = update_xoff_threshold(port_buffer, xoff, max_mtu);
224226 if (err)
225227 return err;
226228
@@ -230,6 +232,7 @@ static int update_buffer_lossy(unsigned int mtu, · 3 unmodified lines
230232 return 0;
231233 }
232234
235+#define MINIMUM_MAX_MTU 9216
233236 int mlx5e_port_manual_buffer_config(struct mlx5e_priv *priv,
234237 u32 change, unsigned int mtu,
235238 struct ieee_pfc *pfc,
@@ -241,12 +244,14 @@ int mlx5e_port_manual_buffer_config(struct mlx5e_priv *priv, · 5 unmodified lines
241244 bool update_prio2buffer = false;
242245 u8 buffer[MLX5E_MAX_PRIORITY];
243246 bool update_buffer = false;
247+ unsigned int max_mtu;
244248 u32 total_used = 0;
245249 u8 curr_pfc_en;
246250 int err;
247251 int i;
248252
249253 mlx5e_dbg(HW, priv, "%s: change=%x\n", __func__, change);
254+ max_mtu = max_t(unsigned int, priv->netdev->max_mtu, MINIMUM_MAX_MTU);
250255
251256 err = mlx5e_port_query_buffer(priv, &port_buffer);
252257 if (err)
@@ -254,7 +259,7 @@ int mlx5e_port_manual_buffer_config(struct mlx5e_priv *priv, · 1 unmodified line
254259
255260 if (change & MLX5E_PORT_BUFFER_CABLE_LEN) {
256261 update_buffer = true;
257− err = update_xoff_threshold(&port_buffer, xoff, mtu);
262+ err = update_xoff_threshold(&port_buffer, xoff, max_mtu);
258263 if (err)
259264 return err;
260265 }
@@ -264,7 +269,7 @@ int mlx5e_port_manual_buffer_config(struct mlx5e_priv *priv, · 3 unmodified lines
264269 if (err)
265270 return err;
266271
267− err = update_buffer_lossy(mtu, pfc->pfc_en, buffer, xoff,
272+ err = update_buffer_lossy(max_mtu, pfc->pfc_en, buffer, xoff,
268273 &port_buffer, &update_buffer);
269274 if (err)
270275 return err;
@@ -276,8 +281,8 @@ int mlx5e_port_manual_buffer_config(struct mlx5e_priv *priv, · 5 unmodified lines
276281 if (err)
277282 return err;
278283
279− err = update_buffer_lossy(mtu, curr_pfc_en, prio2buffer, xoff,
280− &port_buffer, &update_buffer);
284+ err = update_buffer_lossy(max_mtu, curr_pfc_en, prio2buffer,
285+ xoff, &port_buffer, &update_buffer);
281286 if (err)
282287 return err;
283288 }
@@ -301,7 +306,7 @@ int mlx5e_port_manual_buffer_config(struct mlx5e_priv *priv, · 17 unmodified lines
301306 return -EINVAL;
302307
303308 update_buffer = true;
304− err = update_xoff_threshold(&port_buffer, xoff, mtu);
309+ err = update_xoff_threshold(&port_buffer, xoff, max_mtu);
305310 if (err)
306311 return err;
307312 }
@@ -309,7 +314,7 @@ int mlx5e_port_manual_buffer_config(struct mlx5e_priv *priv, · 1 unmodified line
309314 /* Need to update buffer configuration if xoff value is changed */
310315 if (!update_buffer && xoff != priv->dcbx.xoff) {
311316 update_buffer = true;
312− err = update_xoff_threshold(&port_buffer, xoff, mtu);
317+ err = update_xoff_threshold(&port_buffer, xoff, max_mtu);
313318 if (err)
314319 return err;
315320 }
drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c+8−3
@@ -186,12 +186,17 @@ static int mlx5e_tx_reporter_recover_from_ctx(struct mlx5e_tx_err_ctx *err_ctx) · 185 unmodified lines
186186
187187 static int mlx5e_tx_reporter_recover_all(struct mlx5e_priv *priv)
188188 {
189− int err;
189+ int err = 0;
190190
191191 rtnl_lock();
192192 mutex_lock(&priv->state_lock);
193− mlx5e_close_locked(priv->netdev);
194− err = mlx5e_open_locked(priv->netdev);
193+
194+ if (!test_bit(MLX5E_STATE_OPENED, &priv->state))
195+ goto out;
196+
197+ err = mlx5e_safe_reopen_channels(priv);
198+
199+out:
195200 mutex_unlock(&priv->state_lock);
196201 rtnl_unlock();
197202
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c+4−0
@@ -39,6 +39,10 @@ static int get_route_and_out_devs(struct mlx5e_priv *priv, · 38 unmodified lines
3939 return -EOPNOTSUPP;
4040 }
4141
42+ if (!(mlx5e_eswitch_rep(*out_dev) &&
43+ mlx5e_is_uplink_rep(netdev_priv(*out_dev))))
44+ return -EOPNOTSUPP;
45+
4246 return 0;
4347 }
4448
drivers/net/ethernet/mellanox/mlx5/core/en_common.c+11−2
@@ -45,7 +45,9 @@ int mlx5e_create_tir(struct mlx5_core_dev *mdev, · 44 unmodified lines
4545 if (err)
4646 return err;
4747
48+ mutex_lock(&mdev->mlx5e_res.td.list_lock);
4849 list_add(&tir->list, &mdev->mlx5e_res.td.tirs_list);
50+ mutex_unlock(&mdev->mlx5e_res.td.list_lock);
4951
5052 return 0;
5153 }
@@ -53,8 +55,10 @@ int mlx5e_create_tir(struct mlx5_core_dev *mdev, · 1 unmodified line
5355 void mlx5e_destroy_tir(struct mlx5_core_dev *mdev,
5456 struct mlx5e_tir *tir)
5557 {
58+ mutex_lock(&mdev->mlx5e_res.td.list_lock);
5659 mlx5_core_destroy_tir(mdev, tir->tirn);
5760 list_del(&tir->list);
61+ mutex_unlock(&mdev->mlx5e_res.td.list_lock);
5862 }
5963
6064 static int mlx5e_create_mkey(struct mlx5_core_dev *mdev, u32 pdn,
@@ -114,6 +118,7 @@ int mlx5e_create_mdev_resources(struct mlx5_core_dev *mdev) · 53 unmodified lines
114118 }
115119
116120 INIT_LIST_HEAD(&mdev->mlx5e_res.td.tirs_list);
121+ mutex_init(&mdev->mlx5e_res.td.list_lock);
117122
118123 return 0;
119124
@@ -141,15 +146,17 @@ int mlx5e_refresh_tirs(struct mlx5e_priv *priv, bool enable_uc_lb) · 21 unmodified lines
141146 {
142147 struct mlx5_core_dev *mdev = priv->mdev;
143148 struct mlx5e_tir *tir;
144− int err = -ENOMEM;
149+ int err = 0;
145150 u32 tirn = 0;
146151 int inlen;
147152 void *in;
148153
149154 inlen = MLX5_ST_SZ_BYTES(modify_tir_in);
150155 in = kvzalloc(inlen, GFP_KERNEL);
151− if (!in)
156+ if (!in) {
157+ err = -ENOMEM;
152158 goto out;
159+ }
153160
154161 if (enable_uc_lb)
155162 MLX5_SET(modify_tir_in, in, ctx.self_lb_block,
@@ -157,6 +164,7 @@ int mlx5e_refresh_tirs(struct mlx5e_priv *priv, bool enable_uc_lb) · 1 unmodified line
157164
158165 MLX5_SET(modify_tir_in, in, bitmask.self_lb_en, 1);
159166
167+ mutex_lock(&mdev->mlx5e_res.td.list_lock);
160168 list_for_each_entry(tir, &mdev->mlx5e_res.td.tirs_list, list) {
161169 tirn = tir->tirn;
162170 err = mlx5_core_modify_tir(mdev, tirn, in, inlen);
@@ -168,6 +176,7 @@ out: · 5 unmodified lines
168176 kvfree(in);
169177 if (err)
170178 netdev_err(priv->netdev, "refresh tir(0x%x) failed, %d\n", tirn, err);
179+ mutex_unlock(&mdev->mlx5e_res.td.list_lock);
171180
172181 return err;
173182 }
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c+36−19
@@ -603,16 +603,18 @@ static void ptys2ethtool_supported_link(struct mlx5_core_dev *mdev, · 602 unmodified lines
603603 __ETHTOOL_LINK_MODE_MASK_NBITS);
604604 }
605605
606−static void ptys2ethtool_adver_link(struct mlx5_core_dev *mdev,
607− unsigned long *advertising_modes,
608− u32 eth_proto_cap)
606+static void ptys2ethtool_adver_link(unsigned long *advertising_modes,
607+ u32 eth_proto_cap, bool ext)
609608 {
610609 unsigned long proto_cap = eth_proto_cap;
611610 struct ptys2ethtool_config *table;
612611 u32 max_size;
613612 int proto;
614613
615− mlx5e_ethtool_get_speed_arr(mdev, &table, &max_size);
614+ table = ext ? ptys2ext_ethtool_table : ptys2legacy_ethtool_table;
615+ max_size = ext ? ARRAY_SIZE(ptys2ext_ethtool_table) :
616+ ARRAY_SIZE(ptys2legacy_ethtool_table);
617+
616618 for_each_set_bit(proto, &proto_cap, max_size)
617619 bitmap_or(advertising_modes, advertising_modes,
618620 table[proto].advertised,
@@ -794,12 +796,12 @@ static void get_supported(struct mlx5_core_dev *mdev, u32 eth_proto_cap, · 175 unmodified lines
794796 ethtool_link_ksettings_add_link_mode(link_ksettings, supported, Pause);
795797 }
796798
797−static void get_advertising(struct mlx5_core_dev *mdev, u32 eth_proto_cap,
798− u8 tx_pause, u8 rx_pause,
799− struct ethtool_link_ksettings *link_ksettings)
799+static void get_advertising(u32 eth_proto_cap, u8 tx_pause, u8 rx_pause,
800+ struct ethtool_link_ksettings *link_ksettings,
801+ bool ext)
800802 {
801803 unsigned long *advertising = link_ksettings->link_modes.advertising;
802− ptys2ethtool_adver_link(mdev, advertising, eth_proto_cap);
804+ ptys2ethtool_adver_link(advertising, eth_proto_cap, ext);
803805
804806 if (rx_pause)
805807 ethtool_link_ksettings_add_link_mode(link_ksettings, advertising, Pause);
@@ -854,8 +856,9 @@ static void get_lp_advertising(struct mlx5_core_dev *mdev, u32 eth_proto_lp, · 48 unmodified lines
854856 struct ethtool_link_ksettings *link_ksettings)
855857 {
856858 unsigned long *lp_advertising = link_ksettings->link_modes.lp_advertising;
859+ bool ext = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet);
857860
858− ptys2ethtool_adver_link(mdev, lp_advertising, eth_proto_lp);
861+ ptys2ethtool_adver_link(lp_advertising, eth_proto_lp, ext);
859862 }
860863
861864 int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv,
@@ -872,6 +875,7 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv, · 10 unmodified lines
872875 u8 an_disable_admin;
873876 u8 an_status;
874877 u8 connector_type;
878+ bool admin_ext;
875879 bool ext;
876880 int err;
877881
@@ -886,6 +890,19 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv, · 8 unmodified lines
886890 eth_proto_capability);
887891 eth_proto_admin = MLX5_GET_ETH_PROTO(ptys_reg, out, ext,
888892 eth_proto_admin);
893+ /* Fields: eth_proto_admin and ext_eth_proto_admin are
894+ * mutually exclusive. Hence try reading legacy advertising
895+ * when extended advertising is zero.
896+ * admin_ext indicates how eth_proto_admin should be
897+ * interpreted
898+ */
899+ admin_ext = ext;
900+ if (ext && !eth_proto_admin) {
901+ eth_proto_admin = MLX5_GET_ETH_PROTO(ptys_reg, out, false,
902+ eth_proto_admin);
903+ admin_ext = false;
904+ }
905+
889906 eth_proto_oper = MLX5_GET_ETH_PROTO(ptys_reg, out, ext,
890907 eth_proto_oper);
891908 eth_proto_lp = MLX5_GET(ptys_reg, out, eth_proto_lp_advertise);
@@ -899,7 +916,8 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv, · 7 unmodified lines
899916 ethtool_link_ksettings_zero_link_mode(link_ksettings, advertising);
900917
901918 get_supported(mdev, eth_proto_cap, link_ksettings);
902− get_advertising(mdev, eth_proto_admin, tx_pause, rx_pause, link_ksettings);
919+ get_advertising(eth_proto_admin, tx_pause, rx_pause, link_ksettings,
920+ admin_ext);
903921 get_speed_duplex(priv->netdev, eth_proto_oper, link_ksettings);
904922
905923 eth_proto_oper = eth_proto_oper ? eth_proto_oper : eth_proto_cap;
@@ -997,19 +1015,17 @@ int mlx5e_ethtool_set_link_ksettings(struct mlx5e_priv *priv, · 91 unmodified lines
9971015
9981016 #define MLX5E_PTYS_EXT ((1ULL << ETHTOOL_LINK_MODE_50000baseKR_Full_BIT) - 1)
9991017
1000− ext_requested = (link_ksettings->link_modes.advertising[0] >
1001− MLX5E_PTYS_EXT);
1018+ ext_requested = !!(link_ksettings->link_modes.advertising[0] >
1019+ MLX5E_PTYS_EXT ||
1020+ link_ksettings->link_modes.advertising[1]);
10021021 ext_supported = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet);
1003−
1004− /*when ptys_extended_ethernet is set legacy link modes are deprecated */
1005− if (ext_requested != ext_supported)
1006− return -EPROTONOSUPPORT;
1022+ ext_requested &= ext_supported;
10071023
10081024 speed = link_ksettings->base.speed;
10091025 ethtool2ptys_adver_func = ext_requested ?
10101026 mlx5e_ethtool2ptys_ext_adver_link :
10111027 mlx5e_ethtool2ptys_adver_link;
1012− err = mlx5_port_query_eth_proto(mdev, 1, ext_supported, &eproto);
1028+ err = mlx5_port_query_eth_proto(mdev, 1, ext_requested, &eproto);
10131029 if (err) {
10141030 netdev_err(priv->netdev, "%s: query port eth proto failed: %d\n",
10151031 __func__, err);
@@ -1037,7 +1053,7 @@ int mlx5e_ethtool_set_link_ksettings(struct mlx5e_priv *priv, · 21 unmodified lines
10371053 if (!an_changes && link_modes == eproto.admin)
10381054 goto out;
10391055
1040− mlx5_port_set_eth_ptys(mdev, an_disable, link_modes, ext_supported);
1056+ mlx5_port_set_eth_ptys(mdev, an_disable, link_modes, ext_requested);
10411057 mlx5_toggle_port_link(mdev);
10421058
10431059 out:
@@ -1752,7 +1768,8 @@ static int set_pflag_rx_no_csum_complete(struct net_device *netdev, bool enable) · 708 unmodified lines
17521768 struct mlx5e_channel *c;
17531769 int i;
17541770
1755− if (!test_bit(MLX5E_STATE_OPENED, &priv->state))
1771+ if (!test_bit(MLX5E_STATE_OPENED, &priv->state) ||
1772+ priv->channels.params.xdp_prog)
17561773 return 0;
17571774
17581775 for (i = 0; i < channels->num; i++) {
drivers/net/ethernet/mellanox/mlx5/core/en_main.c+16−5
@@ -951,7 +951,11 @@ static int mlx5e_open_rq(struct mlx5e_channel *c, · 950 unmodified lines
951951 if (params->rx_dim_enabled)
952952 __set_bit(MLX5E_RQ_STATE_AM, &c->rq.state);
953953
954− if (MLX5E_GET_PFLAG(params, MLX5E_PFLAG_RX_NO_CSUM_COMPLETE))
954+ /* We disable csum_complete when XDP is enabled since
955+ * XDP programs might manipulate packets which will render
956+ * skb->checksum incorrect.
957+ */
958+ if (MLX5E_GET_PFLAG(params, MLX5E_PFLAG_RX_NO_CSUM_COMPLETE) || c->xdp)
955959 __set_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &c->rq.state);
956960
957961 return 0;
@@ -2937,6 +2941,14 @@ int mlx5e_safe_switch_channels(struct mlx5e_priv *priv, · 1979 unmodified lines
29372941 return 0;
29382942 }
29392943
2944+int mlx5e_safe_reopen_channels(struct mlx5e_priv *priv)
2945+{
2946+ struct mlx5e_channels new_channels = {};
2947+
2948+ new_channels.params = priv->channels.params;
2949+ return mlx5e_safe_switch_channels(priv, &new_channels, NULL);
2950+}
2951+
29402952 void mlx5e_timestamp_init(struct mlx5e_priv *priv)
29412953 {
29422954 priv->tstamp.tx_type = HWTSTAMP_TX_OFF;
@@ -4161,11 +4173,10 @@ static void mlx5e_tx_timeout_work(struct work_struct *work) · 1218 unmodified lines
41614173 if (!report_failed)
41624174 goto unlock;
41634175
4164− mlx5e_close_locked(priv->netdev);
4165− err = mlx5e_open_locked(priv->netdev);
4176+ err = mlx5e_safe_reopen_channels(priv);
41664177 if (err)
41674178 netdev_err(priv->netdev,
4168− "mlx5e_open_locked failed recovering from a tx_timeout, err(%d).\n",
4179+ "mlx5e_safe_reopen_channels failed recovering from a tx_timeout, err(%d).\n",
41694180 err);
41704181
41714182 unlock:
@@ -4553,7 +4564,7 @@ void mlx5e_build_rss_params(struct mlx5e_rss_params *rss_params, · 381 unmodified lines
45534564 {
45544565 enum mlx5e_traffic_types tt;
45554566
4556− rss_params->hfunc = ETH_RSS_HASH_XOR;
4567+ rss_params->hfunc = ETH_RSS_HASH_TOP;
45574568 netdev_rss_key_fill(rss_params->toeplitz_hash_key,
45584569 sizeof(rss_params->toeplitz_hash_key));
45594570 mlx5e_build_default_indir_rqt(rss_params->indirection_rqt,
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c+75−19
@@ -692,7 +692,14 @@ static inline bool is_last_ethertype_ip(struct sk_buff *skb, int *network_depth, · 691 unmodified lines
692692 {
693693 *proto = ((struct ethhdr *)skb->data)->h_proto;
694694 *proto = __vlan_get_protocol(skb, *proto, network_depth);
695− return (*proto == htons(ETH_P_IP) || *proto == htons(ETH_P_IPV6));
695+
696+ if (*proto == htons(ETH_P_IP))
697+ return pskb_may_pull(skb, *network_depth + sizeof(struct iphdr));
698+
699+ if (*proto == htons(ETH_P_IPV6))
700+ return pskb_may_pull(skb, *network_depth + sizeof(struct ipv6hdr));
701+
702+ return false;
696703 }
697704
698705 static inline void mlx5e_enable_ecn(struct mlx5e_rq *rq, struct sk_buff *skb)
@@ -712,17 +719,6 @@ static inline void mlx5e_enable_ecn(struct mlx5e_rq *rq, struct sk_buff *skb) · 13 unmodified lines
712719 rq->stats->ecn_mark += !!rc;
713720 }
714721
715−static u32 mlx5e_get_fcs(const struct sk_buff *skb)
716−{
717− const void *fcs_bytes;
718− u32 _fcs_bytes;
719−
720− fcs_bytes = skb_header_pointer(skb, skb->len - ETH_FCS_LEN,
721− ETH_FCS_LEN, &_fcs_bytes);
722−
723− return __get_unaligned_cpu32(fcs_bytes);
724−}
725−
726722 static u8 get_ip_proto(struct sk_buff *skb, int network_depth, __be16 proto)
727723 {
728724 void *ip_p = skb->data + network_depth;
@@ -733,6 +729,68 @@ static u8 get_ip_proto(struct sk_buff *skb, int network_depth, __be16 proto) · 4 unmodified lines
733729
734730 #define short_frame(size) ((size) <= ETH_ZLEN + ETH_FCS_LEN)
735731
732+#define MAX_PADDING 8
733+
734+static void
735+tail_padding_csum_slow(struct sk_buff *skb, int offset, int len,
736+ struct mlx5e_rq_stats *stats)
737+{
738+ stats->csum_complete_tail_slow++;
739+ skb->csum = csum_block_add(skb->csum,
740+ skb_checksum(skb, offset, len, 0),
741+ offset);
742+}
743+
744+static void
745+tail_padding_csum(struct sk_buff *skb, int offset,
746+ struct mlx5e_rq_stats *stats)
747+{
748+ u8 tail_padding[MAX_PADDING];
749+ int len = skb->len - offset;
750+ void *tail;
751+
752+ if (unlikely(len > MAX_PADDING)) {
753+ tail_padding_csum_slow(skb, offset, len, stats);
754+ return;
755+ }
756+
757+ tail = skb_header_pointer(skb, offset, len, tail_padding);
758+ if (unlikely(!tail)) {
759+ tail_padding_csum_slow(skb, offset, len, stats);
760+ return;
761+ }
762+
763+ stats->csum_complete_tail++;
764+ skb->csum = csum_block_add(skb->csum, csum_partial(tail, len, 0), offset);
765+}
766+
767+static void
768+mlx5e_skb_padding_csum(struct sk_buff *skb, int network_depth, __be16 proto,
769+ struct mlx5e_rq_stats *stats)
770+{
771+ struct ipv6hdr *ip6;
772+ struct iphdr *ip4;
773+ int pkt_len;
774+
775+ switch (proto) {
776+ case htons(ETH_P_IP):
777+ ip4 = (struct iphdr *)(skb->data + network_depth);
778+ pkt_len = network_depth + ntohs(ip4->tot_len);
779+ break;
780+ case htons(ETH_P_IPV6):
781+ ip6 = (struct ipv6hdr *)(skb->data + network_depth);
782+ pkt_len = network_depth + sizeof(*ip6) + ntohs(ip6->payload_len);
783+ break;
784+ default:
785+ return;
786+ }
787+
788+ if (likely(pkt_len >= skb->len))
789+ return;
790+
791+ tail_padding_csum(skb, pkt_len, stats);
792+}
793+
736794 static inline void mlx5e_handle_csum(struct net_device *netdev,
737795 struct mlx5_cqe64 *cqe,
738796 struct mlx5e_rq *rq,
@@ -752,7 +810,8 @@ static inline void mlx5e_handle_csum(struct net_device *netdev, · 13 unmodified lines
752810 return;
753811 }
754812
755− if (unlikely(test_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &rq->state)))
813+ /* True when explicitly set via priv flag, or XDP prog is loaded */
814+ if (test_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &rq->state))
756815 goto csum_unnecessary;
757816
758817 /* CQE csum doesn't cover padding octets in short ethernet
@@ -780,18 +839,15 @@ static inline void mlx5e_handle_csum(struct net_device *netdev, · 21 unmodified lines
780839 skb->csum = csum_partial(skb->data + ETH_HLEN,
781840 network_depth - ETH_HLEN,
782841 skb->csum);
783− if (unlikely(netdev->features & NETIF_F_RXFCS))
784− skb->csum = csum_block_add(skb->csum,
785− (__force __wsum)mlx5e_get_fcs(skb),
786− skb->len - ETH_FCS_LEN);
842+
843+ mlx5e_skb_padding_csum(skb, network_depth, proto, stats);
787844 stats->csum_complete++;
788845 return;
789846 }
790847
791848 csum_unnecessary:
792849 if (likely((cqe->hds_ip_ext & CQE_L3_OK) &&
793− ((cqe->hds_ip_ext & CQE_L4_OK) ||
794− (get_cqe_l4_hdr_type(cqe) == CQE_L4_HDR_TYPE_NONE)))) {
850+ (cqe->hds_ip_ext & CQE_L4_OK))) {
795851 skb->ip_summed = CHECKSUM_UNNECESSARY;
796852 if (cqe_is_tunneled(cqe)) {
797853 skb->csum_level = 1;
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c+6−0
@@ -59,6 +59,8 @@ static const struct counter_desc sw_stats_desc[] = { · 58 unmodified lines
5959 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_unnecessary) },
6060 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_none) },
6161 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_complete) },
62+ { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_complete_tail) },
63+ { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_complete_tail_slow) },
6264 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_unnecessary_inner) },
6365 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_drop) },
6466 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_redirect) },
@@ -151,6 +153,8 @@ static void mlx5e_grp_sw_update_stats(struct mlx5e_priv *priv) · 86 unmodified lines
151153 s->rx_removed_vlan_packets += rq_stats->removed_vlan_packets;
152154 s->rx_csum_none += rq_stats->csum_none;
153155 s->rx_csum_complete += rq_stats->csum_complete;
156+ s->rx_csum_complete_tail += rq_stats->csum_complete_tail;
157+ s->rx_csum_complete_tail_slow += rq_stats->csum_complete_tail_slow;
154158 s->rx_csum_unnecessary += rq_stats->csum_unnecessary;
155159 s->rx_csum_unnecessary_inner += rq_stats->csum_unnecessary_inner;
156160 s->rx_xdp_drop += rq_stats->xdp_drop;
@@ -1190,6 +1194,8 @@ static const struct counter_desc rq_stats_desc[] = { · 1033 unmodified lines
11901194 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, packets) },
11911195 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, bytes) },
11921196 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_complete) },
1197+ { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_complete_tail) },
1198+ { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_complete_tail_slow) },
11931199 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_unnecessary) },
11941200 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_unnecessary_inner) },
11951201 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_none) },
drivers/net/ethernet/mellanox/mlx5/core/en_stats.h+4−0
@@ -71,6 +71,8 @@ struct mlx5e_sw_stats { · 70 unmodified lines
7171 u64 rx_csum_unnecessary;
7272 u64 rx_csum_none;
7373 u64 rx_csum_complete;
74+ u64 rx_csum_complete_tail;
75+ u64 rx_csum_complete_tail_slow;
7476 u64 rx_csum_unnecessary_inner;
7577 u64 rx_xdp_drop;
7678 u64 rx_xdp_redirect;
@@ -181,6 +183,8 @@ struct mlx5e_rq_stats { · 104 unmodified lines
181183 u64 packets;
182184 u64 bytes;
183185 u64 csum_complete;
186+ u64 csum_complete_tail;
187+ u64 csum_complete_tail_slow;
184188 u64 csum_unnecessary;
185189 u64 csum_unnecessary_inner;
186190 u64 csum_none;
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c+68−14
@@ -2158,6 +2158,52 @@ static bool csum_offload_supported(struct mlx5e_priv *priv, · 2157 unmodified lines
21582158 return true;
21592159 }
21602160
2161+struct ip_ttl_word {
2162+ __u8 ttl;
2163+ __u8 protocol;
2164+ __sum16 check;
2165+};
2166+
2167+struct ipv6_hoplimit_word {
2168+ __be16 payload_len;
2169+ __u8 nexthdr;
2170+ __u8 hop_limit;
2171+};
2172+
2173+static bool is_action_keys_supported(const struct flow_action_entry *act)
2174+{
2175+ u32 mask, offset;
2176+ u8 htype;
2177+
2178+ htype = act->mangle.htype;
2179+ offset = act->mangle.offset;
2180+ mask = ~act->mangle.mask;
2181+ /* For IPv4 & IPv6 header check 4 byte word,
2182+ * to determine that modified fields
2183+ * are NOT ttl & hop_limit only.
2184+ */
2185+ if (htype == FLOW_ACT_MANGLE_HDR_TYPE_IP4) {
2186+ struct ip_ttl_word *ttl_word =
2187+ (struct ip_ttl_word *)&mask;
2188+
2189+ if (offset != offsetof(struct iphdr, ttl) ||
2190+ ttl_word->protocol ||
2191+ ttl_word->check) {
2192+ return true;
2193+ }
2194+ } else if (htype == FLOW_ACT_MANGLE_HDR_TYPE_IP6) {
2195+ struct ipv6_hoplimit_word *hoplimit_word =
2196+ (struct ipv6_hoplimit_word *)&mask;
2197+
2198+ if (offset != offsetof(struct ipv6hdr, payload_len) ||
2199+ hoplimit_word->payload_len ||
2200+ hoplimit_word->nexthdr) {
2201+ return true;
2202+ }
2203+ }
2204+ return false;
2205+}
2206+
21612207 static bool modify_header_match_supported(struct mlx5_flow_spec *spec,
21622208 struct flow_action *flow_action,
21632209 u32 actions,
@@ -2165,9 +2211,9 @@ static bool modify_header_match_supported(struct mlx5_flow_spec *spec, · 1 unmodified line
21652211 {
21662212 const struct flow_action_entry *act;
21672213 bool modify_ip_header;
2168− u8 htype, ip_proto;
21692214 void *headers_v;
21702215 u16 ethertype;
2216+ u8 ip_proto;
21712217 int i;
21722218
21732219 if (actions & MLX5_FLOW_CONTEXT_ACTION_DECAP)
@@ -2187,9 +2233,7 @@ static bool modify_header_match_supported(struct mlx5_flow_spec *spec, · 13 unmodified lines
21872233 act->id != FLOW_ACTION_ADD)
21882234 continue;
21892235
2190− htype = act->mangle.htype;
2191− if (htype == FLOW_ACT_MANGLE_HDR_TYPE_IP4 ||
2192− htype == FLOW_ACT_MANGLE_HDR_TYPE_IP6) {
2236+ if (is_action_keys_supported(act)) {
21932237 modify_ip_header = true;
21942238 break;
21952239 }
@@ -2340,15 +2384,22 @@ static int parse_tc_nic_actions(struct mlx5e_priv *priv, · 144 unmodified lines
23402384 return 0;
23412385 }
23422386
2343−static inline int cmp_encap_info(struct ip_tunnel_key *a,
2344− struct ip_tunnel_key *b)
2387+struct encap_key {
2388+ struct ip_tunnel_key *ip_tun_key;
2389+ int tunnel_type;
2390+};
2391+
2392+static inline int cmp_encap_info(struct encap_key *a,
2393+ struct encap_key *b)
23452394 {
2346− return memcmp(a, b, sizeof(*a));
2395+ return memcmp(a->ip_tun_key, b->ip_tun_key, sizeof(*a->ip_tun_key)) ||
2396+ a->tunnel_type != b->tunnel_type;
23472397 }
23482398
2349−static inline int hash_encap_info(struct ip_tunnel_key *key)
2399+static inline int hash_encap_info(struct encap_key *key)
23502400 {
2351− return jhash(key, sizeof(*key), 0);
2401+ return jhash(key->ip_tun_key, sizeof(*key->ip_tun_key),
2402+ key->tunnel_type);
23522403 }
23532404
23542405
@@ -2379,7 +2430,7 @@ static int mlx5e_attach_encap(struct mlx5e_priv *priv, · 24 unmodified lines
23792430 struct mlx5_esw_flow_attr *attr = flow->esw_attr;
23802431 struct mlx5e_tc_flow_parse_attr *parse_attr;
23812432 struct ip_tunnel_info *tun_info;
2382− struct ip_tunnel_key *key;
2433+ struct encap_key key, e_key;
23832434 struct mlx5e_encap_entry *e;
23842435 unsigned short family;
23852436 uintptr_t hash_key;
@@ -2389,13 +2440,16 @@ static int mlx5e_attach_encap(struct mlx5e_priv *priv, · 3 unmodified lines
23892440 parse_attr = attr->parse_attr;
23902441 tun_info = &parse_attr->tun_info[out_index];
23912442 family = ip_tunnel_info_af(tun_info);
2392− key = &tun_info->key;
2443+ key.ip_tun_key = &tun_info->key;
2444+ key.tunnel_type = mlx5e_tc_tun_get_type(mirred_dev);
23932445
2394− hash_key = hash_encap_info(key);
2446+ hash_key = hash_encap_info(&key);
23952447
23962448 hash_for_each_possible_rcu(esw->offloads.encap_tbl, e,
23972449 encap_hlist, hash_key) {
2398− if (!cmp_encap_info(&e->tun_info.key, key)) {
2450+ e_key.ip_tun_key = &e->tun_info.key;
2451+ e_key.tunnel_type = e->tunnel_type;
2452+ if (!cmp_encap_info(&e_key, &key)) {
23992453 found = true;
24002454 break;
24012455 }
@@ -2657,7 +2711,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, · 255 unmodified lines
26572711
26582712 if (hdrs[TCA_PEDIT_KEY_EX_CMD_SET].pedits ||
26592713 hdrs[TCA_PEDIT_KEY_EX_CMD_ADD].pedits) {
2660− err = alloc_tc_pedit_action(priv, MLX5_FLOW_NAMESPACE_KERNEL,
2714+ err = alloc_tc_pedit_action(priv, MLX5_FLOW_NAMESPACE_FDB,
26612715 parse_attr, hdrs, extack);
26622716 if (err)
26632717 return err;
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c+5−4
@@ -105,8 +105,7 @@ static int arm_vport_context_events_cmd(struct mlx5_core_dev *dev, u16 vport, · 104 unmodified lines
105105 opcode, MLX5_CMD_OP_MODIFY_NIC_VPORT_CONTEXT);
106106 MLX5_SET(modify_nic_vport_context_in, in, field_select.change_event, 1);
107107 MLX5_SET(modify_nic_vport_context_in, in, vport_number, vport);
108− if (vport)
109− MLX5_SET(modify_nic_vport_context_in, in, other_vport, 1);
108+ MLX5_SET(modify_nic_vport_context_in, in, other_vport, 1);
110109 nic_vport_ctx = MLX5_ADDR_OF(modify_nic_vport_context_in,
111110 in, nic_vport_context);
112111
@@ -134,8 +133,7 @@ static int modify_esw_vport_context_cmd(struct mlx5_core_dev *dev, u16 vport, · 21 unmodified lines
134133 MLX5_SET(modify_esw_vport_context_in, in, opcode,
135134 MLX5_CMD_OP_MODIFY_ESW_VPORT_CONTEXT);
136135 MLX5_SET(modify_esw_vport_context_in, in, vport_number, vport);
137− if (vport)
138− MLX5_SET(modify_esw_vport_context_in, in, other_vport, 1);
136+ MLX5_SET(modify_esw_vport_context_in, in, other_vport, 1);
139137 return mlx5_cmd_exec(dev, in, inlen, out, sizeof(out));
140138 }
141139
@@ -431,6 +429,8 @@ static int esw_create_legacy_table(struct mlx5_eswitch *esw) · 289 unmodified lines
431429 {
432430 int err;
433431
432+ memset(&esw->fdb_table.legacy, 0, sizeof(struct legacy_fdb));
433+
434434 err = esw_create_legacy_vepa_table(esw);
435435 if (err)
436436 return err;
@@ -2157,6 +2157,7 @@ static int _mlx5_eswitch_set_vepa_locked(struct mlx5_eswitch *esw, · 1720 unmodified lines
21572157
21582158 /* Star rule to forward all traffic to uplink vport */
21592159 memset(spec, 0, sizeof(*spec));
2160+ memset(&dest, 0, sizeof(dest));
21602161 dest.type = MLX5_FLOW_DESTINATION_TYPE_VPORT;
21612162 dest.vport.num = MLX5_VPORT_UPLINK;
21622163 flow_act.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c+1−0
@@ -1611,6 +1611,7 @@ static int esw_offloads_steering_init(struct mlx5_eswitch *esw, int nvports) · 1610 unmodified lines
16111611 {
16121612 int err;
16131613
1614+ memset(&esw->fdb_table.offloads, 0, sizeof(struct offloads_fdb));
16141615 mutex_init(&esw->fdb_table.offloads.fdb_prio_lock);
16151616
16161617 err = esw_create_offloads_fdb_tables(esw, nvports);
drivers/net/ethernet/mellanox/mlx5/core/fpga/tls.c+24−29
@@ -148,14 +148,16 @@ static int mlx5_fpga_tls_alloc_swid(struct idr *idr, spinlock_t *idr_spinlock, · 147 unmodified lines
148148 return ret;
149149 }
150150
151−static void mlx5_fpga_tls_release_swid(struct idr *idr,
152− spinlock_t *idr_spinlock, u32 swid)
151+static void *mlx5_fpga_tls_release_swid(struct idr *idr,
152+ spinlock_t *idr_spinlock, u32 swid)
153153 {
154154 unsigned long flags;
155+ void *ptr;
155156
156157 spin_lock_irqsave(idr_spinlock, flags);
157− idr_remove(idr, swid);
158+ ptr = idr_remove(idr, swid);
158159 spin_unlock_irqrestore(idr_spinlock, flags);
160+ return ptr;
159161 }
160162
161163 static void mlx_tls_kfree_complete(struct mlx5_fpga_conn *conn,
@@ -165,20 +167,12 @@ static void mlx_tls_kfree_complete(struct mlx5_fpga_conn *conn, · 3 unmodified lines
165167 kfree(buf);
166168 }
167169
168−struct mlx5_teardown_stream_context {
169− struct mlx5_fpga_tls_command_context cmd;
170− u32 swid;
171−};
172−
173170 static void
174171 mlx5_fpga_tls_teardown_completion(struct mlx5_fpga_conn *conn,
175172 struct mlx5_fpga_device *fdev,
176173 struct mlx5_fpga_tls_command_context *cmd,
177174 struct mlx5_fpga_dma_buf *resp)
178175 {
179− struct mlx5_teardown_stream_context *ctx =
180− container_of(cmd, struct mlx5_teardown_stream_context, cmd);
181−
182176 if (resp) {
183177 u32 syndrome = MLX5_GET(tls_resp, resp->sg[0].data, syndrome);
184178
@@ -186,14 +180,6 @@ mlx5_fpga_tls_teardown_completion(struct mlx5_fpga_conn *conn, · 1 unmodified line
186180 mlx5_fpga_err(fdev,
187181 "Teardown stream failed with syndrome = %d",
188182 syndrome);
189− else if (MLX5_GET(tls_cmd, cmd->buf.sg[0].data, direction_sx))
190− mlx5_fpga_tls_release_swid(&fdev->tls->tx_idr,
191− &fdev->tls->tx_idr_spinlock,
192− ctx->swid);
193− else
194− mlx5_fpga_tls_release_swid(&fdev->tls->rx_idr,
195− &fdev->tls->rx_idr_spinlock,
196− ctx->swid);
197183 }
198184 mlx5_fpga_tls_put_command_ctx(cmd);
199185 }
@@ -225,8 +211,14 @@ int mlx5_fpga_tls_resync_rx(struct mlx5_core_dev *mdev, u32 handle, u32 seq, · 25 unmodified lines
225211
226212 rcu_read_lock();
227213 flow = idr_find(&mdev->fpga->tls->rx_idr, ntohl(handle));
228− rcu_read_unlock();
214+ if (unlikely(!flow)) {
215+ rcu_read_unlock();
216+ WARN_ONCE(1, "Received NULL pointer for handle\n");
217+ kfree(buf);
218+ return -EINVAL;
219+ }
229220 mlx5_fpga_tls_flow_to_cmd(flow, cmd);
221+ rcu_read_unlock();
230222
231223 MLX5_SET(tls_cmd, cmd, swid, ntohl(handle));
232224 MLX5_SET64(tls_cmd, cmd, tls_rcd_sn, be64_to_cpu(rcd_sn));
@@ -238,6 +230,8 @@ int mlx5_fpga_tls_resync_rx(struct mlx5_core_dev *mdev, u32 handle, u32 seq, · 5 unmodified lines
238230 buf->complete = mlx_tls_kfree_complete;
239231
240232 ret = mlx5_fpga_sbu_conn_sendmsg(mdev->fpga->tls->conn, buf);
233+ if (ret < 0)
234+ kfree(buf);
241235
242236 return ret;
243237 }
@@ -245,7 +239,7 @@ int mlx5_fpga_tls_resync_rx(struct mlx5_core_dev *mdev, u32 handle, u32 seq, · 1 unmodified line
245239 static void mlx5_fpga_tls_send_teardown_cmd(struct mlx5_core_dev *mdev,
246240 void *flow, u32 swid, gfp_t flags)
247241 {
248− struct mlx5_teardown_stream_context *ctx;
242+ struct mlx5_fpga_tls_command_context *ctx;
249243 struct mlx5_fpga_dma_buf *buf;
250244 void *cmd;
251245
@@ -253,7 +247,7 @@ static void mlx5_fpga_tls_send_teardown_cmd(struct mlx5_core_dev *mdev, · 1 unmodified line
253247 if (!ctx)
254248 return;
255249
256− buf = &ctx->cmd.buf;
250+ buf = &ctx->buf;
257251 cmd = (ctx + 1);
258252 MLX5_SET(tls_cmd, cmd, command_type, CMD_TEARDOWN_STREAM);
259253 MLX5_SET(tls_cmd, cmd, swid, swid);
@@ -264,8 +258,7 @@ static void mlx5_fpga_tls_send_teardown_cmd(struct mlx5_core_dev *mdev, · 4 unmodified lines
264258 buf->sg[0].data = cmd;
265259 buf->sg[0].size = MLX5_TLS_COMMAND_SIZE;
266260
267− ctx->swid = swid;
268− mlx5_fpga_tls_cmd_send(mdev->fpga, &ctx->cmd,
261+ mlx5_fpga_tls_cmd_send(mdev->fpga, ctx,
269262 mlx5_fpga_tls_teardown_completion);
270263 }
271264
@@ -275,13 +268,14 @@ void mlx5_fpga_tls_del_flow(struct mlx5_core_dev *mdev, u32 swid, · 3 unmodified lines
275268 struct mlx5_fpga_tls *tls = mdev->fpga->tls;
276269 void *flow;
277270
278− rcu_read_lock();
279271 if (direction_sx)
280− flow = idr_find(&tls->tx_idr, swid);
272+ flow = mlx5_fpga_tls_release_swid(&tls->tx_idr,
273+ &tls->tx_idr_spinlock,
274+ swid);
281275 else
282− flow = idr_find(&tls->rx_idr, swid);
283−
284− rcu_read_unlock();
276+ flow = mlx5_fpga_tls_release_swid(&tls->rx_idr,
277+ &tls->rx_idr_spinlock,
278+ swid);
285279
286280 if (!flow) {
287281 mlx5_fpga_err(mdev->fpga, "No flow information for swid %u\n",
@@ -289,6 +283,7 @@ void mlx5_fpga_tls_del_flow(struct mlx5_core_dev *mdev, u32 swid, · 1 unmodified line
289283 return;
290284 }
291285
286+ synchronize_rcu(); /* before kfree(flow) */
292287 mlx5_fpga_tls_send_teardown_cmd(mdev, flow, swid, flags);
293288 }
294289
drivers/net/ethernet/mellanox/mlx5/core/main.c+0−20
@@ -164,26 +164,6 @@ static struct mlx5_profile profile[] = { · 163 unmodified lines
164164 .size = 8,
165165 .limit = 4
166166 },
167− .mr_cache[16] = {
168− .size = 8,
169− .limit = 4
170− },
171− .mr_cache[17] = {
172− .size = 8,
173− .limit = 4
174− },
175− .mr_cache[18] = {
176− .size = 8,
177− .limit = 4
178− },
179− .mr_cache[19] = {
180− .size = 4,
181− .limit = 2
182− },
183− .mr_cache[20] = {
184− .size = 4,
185− .limit = 2
186− },
187167 },
188168 };
189169
drivers/net/ethernet/mellanox/mlxsw/core.c+3−3
@@ -568,7 +568,7 @@ static int mlxsw_emad_init(struct mlxsw_core *mlxsw_core) · 567 unmodified lines
568568 if (!(mlxsw_core->bus->features & MLXSW_BUS_F_TXRX))
569569 return 0;
570570
571− emad_wq = alloc_workqueue("mlxsw_core_emad", WQ_MEM_RECLAIM, 0);
571+ emad_wq = alloc_workqueue("mlxsw_core_emad", 0, 0);
572572 if (!emad_wq)
573573 return -ENOMEM;
574574 mlxsw_core->emad_wq = emad_wq;
@@ -1958,10 +1958,10 @@ static int __init mlxsw_core_module_init(void) · 1383 unmodified lines
19581958 {
19591959 int err;
19601960
1961− mlxsw_wq = alloc_workqueue(mlxsw_core_driver_name, WQ_MEM_RECLAIM, 0);
1961+ mlxsw_wq = alloc_workqueue(mlxsw_core_driver_name, 0, 0);
19621962 if (!mlxsw_wq)
19631963 return -ENOMEM;
1964− mlxsw_owq = alloc_ordered_workqueue("%s_ordered", WQ_MEM_RECLAIM,
1964+ mlxsw_owq = alloc_ordered_workqueue("%s_ordered", 0,
19651965 mlxsw_core_driver_name);
19661966 if (!mlxsw_owq) {
19671967 err = -ENOMEM;
drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c+11−8
@@ -70,6 +70,7 @@ static const struct mlxsw_sp_sb_pool_des mlxsw_sp2_sb_pool_dess[] = { · 69 unmodified lines
7070 {MLXSW_REG_SBXX_DIR_EGRESS, 1},
7171 {MLXSW_REG_SBXX_DIR_EGRESS, 2},
7272 {MLXSW_REG_SBXX_DIR_EGRESS, 3},
73+ {MLXSW_REG_SBXX_DIR_EGRESS, 15},
7374 };
7475
7576 #define MLXSW_SP_SB_ING_TC_COUNT 8
@@ -428,6 +429,7 @@ static const struct mlxsw_sp_sb_pr mlxsw_sp2_sb_prs[] = { · 352 unmodified lines
428429 MLXSW_SP_SB_PR(MLXSW_REG_SBPR_MODE_STATIC, 0),
429430 MLXSW_SP_SB_PR(MLXSW_REG_SBPR_MODE_STATIC, 0),
430431 MLXSW_SP_SB_PR(MLXSW_REG_SBPR_MODE_STATIC, 0),
432+ MLXSW_SP_SB_PR(MLXSW_REG_SBPR_MODE_STATIC, MLXSW_SP_SB_INFI),
431433 };
432434
433435 static int mlxsw_sp_sb_prs_init(struct mlxsw_sp *mlxsw_sp,
@@ -517,14 +519,14 @@ static const struct mlxsw_sp_sb_cm mlxsw_sp2_sb_cms_egress[] = { · 83 unmodified lines
517519 MLXSW_SP_SB_CM(0, 7, 4),
518520 MLXSW_SP_SB_CM(0, 7, 4),
519521 MLXSW_SP_SB_CM(0, 7, 4),
520− MLXSW_SP_SB_CM(0, 7, 4),
521− MLXSW_SP_SB_CM(0, 7, 4),
522− MLXSW_SP_SB_CM(0, 7, 4),
523− MLXSW_SP_SB_CM(0, 7, 4),
524− MLXSW_SP_SB_CM(0, 7, 4),
525− MLXSW_SP_SB_CM(0, 7, 4),
526− MLXSW_SP_SB_CM(0, 7, 4),
527− MLXSW_SP_SB_CM(0, 7, 4),
522+ MLXSW_SP_SB_CM(0, MLXSW_SP_SB_INFI, 8),
523+ MLXSW_SP_SB_CM(0, MLXSW_SP_SB_INFI, 8),
524+ MLXSW_SP_SB_CM(0, MLXSW_SP_SB_INFI, 8),
525+ MLXSW_SP_SB_CM(0, MLXSW_SP_SB_INFI, 8),
526+ MLXSW_SP_SB_CM(0, MLXSW_SP_SB_INFI, 8),
527+ MLXSW_SP_SB_CM(0, MLXSW_SP_SB_INFI, 8),
528+ MLXSW_SP_SB_CM(0, MLXSW_SP_SB_INFI, 8),
529+ MLXSW_SP_SB_CM(0, MLXSW_SP_SB_INFI, 8),
528530 MLXSW_SP_SB_CM(1, 0xff, 4),
529531 };
530532
@@ -671,6 +673,7 @@ static const struct mlxsw_sp_sb_pm mlxsw_sp2_sb_pms[] = { · 140 unmodified lines
671673 MLXSW_SP_SB_PM(0, 0),
672674 MLXSW_SP_SB_PM(0, 0),
673675 MLXSW_SP_SB_PM(0, 0),
676+ MLXSW_SP_SB_PM(10000, 90000),
674677 };
675678
676679 static int mlxsw_sp_port_sb_pms_init(struct mlxsw_sp_port *mlxsw_sp_port)
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c+1−1
@@ -6781,7 +6781,7 @@ static int mlxsw_sp_router_port_check_rif_addr(struct mlxsw_sp *mlxsw_sp, · 6780 unmodified lines
67816781 /* A RIF is not created for macvlan netdevs. Their MAC is used to
67826782 * populate the FDB
67836783 */
6784− if (netif_is_macvlan(dev))
6784+ if (netif_is_macvlan(dev) || netif_is_l3_master(dev))
67856785 return 0;
67866786
67876787 for (i = 0; i < MLXSW_CORE_RES_GET(mlxsw_sp->core, MAX_RIFS); i++) {
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c+1−1
@@ -1630,7 +1630,7 @@ static int mlxsw_sp_port_mdb_add(struct mlxsw_sp_port *mlxsw_sp_port, · 1629 unmodified lines
16301630 u16 fid_index;
16311631 int err = 0;
16321632
1633− if (switchdev_trans_ph_prepare(trans))
1633+ if (switchdev_trans_ph_commit(trans))
16341634 return 0;
16351635
16361636 bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp->bridge, orig_dev);
drivers/net/ethernet/mscc/ocelot.c+15−9
@@ -613,7 +613,7 @@ static int ocelot_mact_mc_add(struct ocelot_port *port, · 612 unmodified lines
613613 struct netdev_hw_addr *hw_addr)
614614 {
615615 struct ocelot *ocelot = port->ocelot;
616− struct netdev_hw_addr *ha = kzalloc(sizeof(*ha), GFP_KERNEL);
616+ struct netdev_hw_addr *ha = kzalloc(sizeof(*ha), GFP_ATOMIC);
617617
618618 if (!ha)
619619 return -ENOMEM;
@@ -959,10 +959,8 @@ static void ocelot_get_strings(struct net_device *netdev, u32 sset, u8 *data) · 339 unmodified lines
959959 ETH_GSTRING_LEN);
960960 }
961961
962−static void ocelot_check_stats(struct work_struct *work)
962+static void ocelot_update_stats(struct ocelot *ocelot)
963963 {
964− struct delayed_work *del_work = to_delayed_work(work);
965− struct ocelot *ocelot = container_of(del_work, struct ocelot, stats_work);
966964 int i, j;
967965
968966 mutex_lock(&ocelot->stats_lock);
@@ -986,11 +984,19 @@ static void ocelot_check_stats(struct work_struct *work) · 17 unmodified lines
986984 }
987985 }
988986
989− cancel_delayed_work(&ocelot->stats_work);
987+ mutex_unlock(&ocelot->stats_lock);
988+}
989+
990+static void ocelot_check_stats_work(struct work_struct *work)
991+{
992+ struct delayed_work *del_work = to_delayed_work(work);
993+ struct ocelot *ocelot = container_of(del_work, struct ocelot,
994+ stats_work);
995+
996+ ocelot_update_stats(ocelot);
997+
990998 queue_delayed_work(ocelot->stats_queue, &ocelot->stats_work,
991999 OCELOT_STATS_CHECK_DELAY);
992−
993− mutex_unlock(&ocelot->stats_lock);
9941000 }
9951001
9961002 static void ocelot_get_ethtool_stats(struct net_device *dev,
@@ -1001,7 +1007,7 @@ static void ocelot_get_ethtool_stats(struct net_device *dev, · 4 unmodified lines
10011007 int i;
10021008
10031009 /* check and update now */
1004− ocelot_check_stats(&ocelot->stats_work.work);
1010+ ocelot_update_stats(ocelot);
10051011
10061012 /* Copy all counters */
10071013 for (i = 0; i < ocelot->num_stats; i++)
@@ -1809,7 +1815,7 @@ int ocelot_init(struct ocelot *ocelot) · 801 unmodified lines
18091815 ANA_CPUQ_8021_CFG_CPUQ_BPDU_VAL(6),
18101816 ANA_CPUQ_8021_CFG, i);
18111817
1812− INIT_DELAYED_WORK(&ocelot->stats_work, ocelot_check_stats);
1818+ INIT_DELAYED_WORK(&ocelot->stats_work, ocelot_check_stats_work);
18131819 queue_delayed_work(ocelot->stats_queue, &ocelot->stats_work,
18141820 OCELOT_STATS_CHECK_DELAY);
18151821 return 0;
drivers/net/ethernet/neterion/vxge/vxge-config.c+1−0
@@ -2366,6 +2366,7 @@ static void *__vxge_hw_blockpool_malloc(struct __vxge_hw_device *devh, u32 size, · 2365 unmodified lines
23662366 dma_object->addr))) {
23672367 vxge_os_dma_free(devh->pdev, memblock,
23682368 &dma_object->acc_handle);
2369+ memblock = NULL;
23692370 goto exit;
23702371 }
23712372
drivers/net/ethernet/netronome/nfp/flower/action.c+1−2
@@ -48,8 +48,7 @@ nfp_fl_push_vlan(struct nfp_fl_push_vlan *push_vlan, · 47 unmodified lines
4848
4949 tmp_push_vlan_tci =
5050 FIELD_PREP(NFP_FL_PUSH_VLAN_PRIO, act->vlan.prio) |
51− FIELD_PREP(NFP_FL_PUSH_VLAN_VID, act->vlan.vid) |
52− NFP_FL_PUSH_VLAN_CFI;
51+ FIELD_PREP(NFP_FL_PUSH_VLAN_VID, act->vlan.vid);
5352 push_vlan->vlan_tci = cpu_to_be16(tmp_push_vlan_tci);
5453 }
5554
drivers/net/ethernet/netronome/nfp/flower/cmsg.h+1−2
@@ -26,7 +26,7 @@ · 25 unmodified lines
2626 #define NFP_FLOWER_LAYER2_GENEVE_OP BIT(6)
2727
2828 #define NFP_FLOWER_MASK_VLAN_PRIO GENMASK(15, 13)
29−#define NFP_FLOWER_MASK_VLAN_CFI BIT(12)
29+#define NFP_FLOWER_MASK_VLAN_PRESENT BIT(12)
3030 #define NFP_FLOWER_MASK_VLAN_VID GENMASK(11, 0)
3131
3232 #define NFP_FLOWER_MASK_MPLS_LB GENMASK(31, 12)
@@ -82,7 +82,6 @@ · 49 unmodified lines
8282 #define NFP_FL_OUT_FLAGS_TYPE_IDX GENMASK(2, 0)
8383
8484 #define NFP_FL_PUSH_VLAN_PRIO GENMASK(15, 13)
85−#define NFP_FL_PUSH_VLAN_CFI BIT(12)
8685 #define NFP_FL_PUSH_VLAN_VID GENMASK(11, 0)
8786
8887 #define IPV6_FLOW_LABEL_MASK cpu_to_be32(0x000fffff)
drivers/net/ethernet/netronome/nfp/flower/match.c+13−14
@@ -30,20 +30,19 @@ nfp_flower_compile_meta_tci(struct nfp_flower_meta_tci *ext, · 29 unmodified lines
3030
3131 flow_rule_match_vlan(rule, &match);
3232 /* Populate the tci field. */
33− if (match.key->vlan_id || match.key->vlan_priority) {
34− tmp_tci = FIELD_PREP(NFP_FLOWER_MASK_VLAN_PRIO,
35− match.key->vlan_priority) |
36− FIELD_PREP(NFP_FLOWER_MASK_VLAN_VID,
37− match.key->vlan_id) |
38− NFP_FLOWER_MASK_VLAN_CFI;
39− ext->tci = cpu_to_be16(tmp_tci);
40− tmp_tci = FIELD_PREP(NFP_FLOWER_MASK_VLAN_PRIO,
41− match.mask->vlan_priority) |
42− FIELD_PREP(NFP_FLOWER_MASK_VLAN_VID,
43− match.mask->vlan_id) |
44− NFP_FLOWER_MASK_VLAN_CFI;
45− msk->tci = cpu_to_be16(tmp_tci);
46− }
33+ tmp_tci = NFP_FLOWER_MASK_VLAN_PRESENT;
34+ tmp_tci |= FIELD_PREP(NFP_FLOWER_MASK_VLAN_PRIO,
35+ match.key->vlan_priority) |
36+ FIELD_PREP(NFP_FLOWER_MASK_VLAN_VID,
37+ match.key->vlan_id);
38+ ext->tci = cpu_to_be16(tmp_tci);
39+
40+ tmp_tci = NFP_FLOWER_MASK_VLAN_PRESENT;
41+ tmp_tci |= FIELD_PREP(NFP_FLOWER_MASK_VLAN_PRIO,
42+ match.mask->vlan_priority) |
43+ FIELD_PREP(NFP_FLOWER_MASK_VLAN_VID,
44+ match.mask->vlan_id);
45+ msk->tci = cpu_to_be16(tmp_tci);
4746 }
4847 }
4948
drivers/net/ethernet/netronome/nfp/nfp_net_repr.c+2−2
@@ -195,7 +195,7 @@ static netdev_tx_t nfp_repr_xmit(struct sk_buff *skb, struct net_device *netdev) · 194 unmodified lines
195195 ret = dev_queue_xmit(skb);
196196 nfp_repr_inc_tx_stats(netdev, len, ret);
197197
198− return ret;
198+ return NETDEV_TX_OK;
199199 }
200200
201201 static int nfp_repr_stop(struct net_device *netdev)
@@ -383,7 +383,7 @@ int nfp_repr_init(struct nfp_app *app, struct net_device *netdev, · 181 unmodified lines
383383 netdev->features &= ~(NETIF_F_TSO | NETIF_F_TSO6);
384384 netdev->gso_max_segs = NFP_NET_LSO_MAX_SEGS;
385385
386− netdev->priv_flags |= IFF_NO_QUEUE;
386+ netdev->priv_flags |= IFF_NO_QUEUE | IFF_DISABLE_NETPOLL;
387387 netdev->features |= NETIF_F_LLTX;
388388
389389 if (nfp_app_has_tc(app)) {
drivers/net/ethernet/qlogic/qed/qed.h+5−2
@@ -431,12 +431,16 @@ struct qed_qm_info { · 430 unmodified lines
431431 u8 num_pf_rls;
432432 };
433433
434+#define QED_OVERFLOW_BIT 1
435+
434436 struct qed_db_recovery_info {
435437 struct list_head list;
436438
437439 /* Lock to protect the doorbell recovery mechanism list */
438440 spinlock_t lock;
441+ bool dorq_attn;
439442 u32 db_recovery_counter;
443+ unsigned long overflow;
440444 };
441445
442446 struct storm_stats {
@@ -920,8 +924,7 @@ u16 qed_get_cm_pq_idx_llt_mtc(struct qed_hwfn *p_hwfn, u8 tc); · 477 unmodified lines
920924
921925 /* doorbell recovery mechanism */
922926 void qed_db_recovery_dp(struct qed_hwfn *p_hwfn);
923−void qed_db_recovery_execute(struct qed_hwfn *p_hwfn,
924− enum qed_db_rec_exec db_exec);
927+void qed_db_recovery_execute(struct qed_hwfn *p_hwfn);
925928 bool qed_edpm_enabled(struct qed_hwfn *p_hwfn);
926929
927930 /* Other Linux specific common definitions */
drivers/net/ethernet/qlogic/qed/qed_dev.c+34−51
@@ -102,11 +102,15 @@ static void qed_db_recovery_dp_entry(struct qed_hwfn *p_hwfn, · 101 unmodified lines
102102
103103 /* Doorbell address sanity (address within doorbell bar range) */
104104 static bool qed_db_rec_sanity(struct qed_dev *cdev,
105− void __iomem *db_addr, void *db_data)
105+ void __iomem *db_addr,
106+ enum qed_db_rec_width db_width,
107+ void *db_data)
106108 {
109+ u32 width = (db_width == DB_REC_WIDTH_32B) ? 32 : 64;
110+
107111 /* Make sure doorbell address is within the doorbell bar */
108112 if (db_addr < cdev->doorbells ||
109− (u8 __iomem *)db_addr >
113+ (u8 __iomem *)db_addr + width >
110114 (u8 __iomem *)cdev->doorbells + cdev->db_size) {
111115 WARN(true,
112116 "Illegal doorbell address: %p. Legal range for doorbell addresses is [%p..%p]\n",
@@ -159,7 +163,7 @@ int qed_db_recovery_add(struct qed_dev *cdev, · 46 unmodified lines
159163 }
160164
161165 /* Sanitize doorbell address */
162− if (!qed_db_rec_sanity(cdev, db_addr, db_data))
166+ if (!qed_db_rec_sanity(cdev, db_addr, db_width, db_data))
163167 return -EINVAL;
164168
165169 /* Obtain hwfn from doorbell address */
@@ -205,10 +209,6 @@ int qed_db_recovery_del(struct qed_dev *cdev, · 39 unmodified lines
205209 return 0;
206210 }
207211
208− /* Sanitize doorbell address */
209− if (!qed_db_rec_sanity(cdev, db_addr, db_data))
210− return -EINVAL;
211−
212212 /* Obtain hwfn from doorbell address */
213213 p_hwfn = qed_db_rec_find_hwfn(cdev, db_addr);
214214
@@ -300,31 +300,24 @@ void qed_db_recovery_dp(struct qed_hwfn *p_hwfn) · 85 unmodified lines
300300
301301 /* Ring the doorbell of a single doorbell recovery entry */
302302 static void qed_db_recovery_ring(struct qed_hwfn *p_hwfn,
303− struct qed_db_recovery_entry *db_entry,
304− enum qed_db_rec_exec db_exec)
305−{
306− if (db_exec != DB_REC_ONCE) {
307− /* Print according to width */
308− if (db_entry->db_width == DB_REC_WIDTH_32B) {
309− DP_VERBOSE(p_hwfn, QED_MSG_SPQ,
310− "%s doorbell address %p data %x\n",
311− db_exec == DB_REC_DRY_RUN ?
312− "would have rung" : "ringing",
313− db_entry->db_addr,
314− *(u32 *)db_entry->db_data);
315− } else {
316− DP_VERBOSE(p_hwfn, QED_MSG_SPQ,
317− "%s doorbell address %p data %llx\n",
318− db_exec == DB_REC_DRY_RUN ?
319− "would have rung" : "ringing",
320− db_entry->db_addr,
321− *(u64 *)(db_entry->db_data));
322− }
303+ struct qed_db_recovery_entry *db_entry)
304+{
305+ /* Print according to width */
306+ if (db_entry->db_width == DB_REC_WIDTH_32B) {
307+ DP_VERBOSE(p_hwfn, QED_MSG_SPQ,
308+ "ringing doorbell address %p data %x\n",
309+ db_entry->db_addr,
310+ *(u32 *)db_entry->db_data);
311+ } else {
312+ DP_VERBOSE(p_hwfn, QED_MSG_SPQ,
313+ "ringing doorbell address %p data %llx\n",
314+ db_entry->db_addr,
315+ *(u64 *)(db_entry->db_data));
323316 }
324317
325318 /* Sanity */
326319 if (!qed_db_rec_sanity(p_hwfn->cdev, db_entry->db_addr,
327− db_entry->db_data))
320+ db_entry->db_width, db_entry->db_data))
328321 return;
329322
330323 /* Flush the write combined buffer. Since there are multiple doorbelling
@@ -334,14 +327,12 @@ static void qed_db_recovery_ring(struct qed_hwfn *p_hwfn, · 3 unmodified lines
334327 wmb();
335328
336329 /* Ring the doorbell */
337− if (db_exec == DB_REC_REAL_DEAL || db_exec == DB_REC_ONCE) {
338− if (db_entry->db_width == DB_REC_WIDTH_32B)
339− DIRECT_REG_WR(db_entry->db_addr,
340− *(u32 *)(db_entry->db_data));
341− else
342− DIRECT_REG_WR64(db_entry->db_addr,
343− *(u64 *)(db_entry->db_data));
344− }
330+ if (db_entry->db_width == DB_REC_WIDTH_32B)
331+ DIRECT_REG_WR(db_entry->db_addr,
332+ *(u32 *)(db_entry->db_data));
333+ else
334+ DIRECT_REG_WR64(db_entry->db_addr,
335+ *(u64 *)(db_entry->db_data));
345336
346337 /* Flush the write combined buffer. Next doorbell may come from a
347338 * different entity to the same address...
@@ -350,29 +341,21 @@ static void qed_db_recovery_ring(struct qed_hwfn *p_hwfn, · 2 unmodified lines
350341 }
351342
352343 /* Traverse the doorbell recovery entry list and ring all the doorbells */
353−void qed_db_recovery_execute(struct qed_hwfn *p_hwfn,
354− enum qed_db_rec_exec db_exec)
344+void qed_db_recovery_execute(struct qed_hwfn *p_hwfn)
355345 {
356346 struct qed_db_recovery_entry *db_entry = NULL;
357347
358− if (db_exec != DB_REC_ONCE) {
359− DP_NOTICE(p_hwfn,
360− "Executing doorbell recovery. Counter was %d\n",
361− p_hwfn->db_recovery_info.db_recovery_counter);
348+ DP_NOTICE(p_hwfn, "Executing doorbell recovery. Counter was %d\n",
349+ p_hwfn->db_recovery_info.db_recovery_counter);
362350
363− /* Track amount of times recovery was executed */
364− p_hwfn->db_recovery_info.db_recovery_counter++;
365− }
351+ /* Track amount of times recovery was executed */
352+ p_hwfn->db_recovery_info.db_recovery_counter++;
366353
367354 /* Protect the list */
368355 spin_lock_bh(&p_hwfn->db_recovery_info.lock);
369356 list_for_each_entry(db_entry,
370− &p_hwfn->db_recovery_info.list, list_entry) {
371− qed_db_recovery_ring(p_hwfn, db_entry, db_exec);
372− if (db_exec == DB_REC_ONCE)
373− break;
374− }
375−
357+ &p_hwfn->db_recovery_info.list, list_entry)
358+ qed_db_recovery_ring(p_hwfn, db_entry);
376359 spin_unlock_bh(&p_hwfn->db_recovery_info.lock);
377360 }
378361
drivers/net/ethernet/qlogic/qed/qed_int.c+63−20
@@ -378,6 +378,9 @@ static int qed_db_rec_flush_queue(struct qed_hwfn *p_hwfn, · 377 unmodified lines
378378 u32 count = QED_DB_REC_COUNT;
379379 u32 usage = 1;
380380
381+ /* Flush any pending (e)dpms as they may never arrive */
382+ qed_wr(p_hwfn, p_ptt, DORQ_REG_DPM_FORCE_ABORT, 0x1);
383+
381384 /* wait for usage to zero or count to run out. This is necessary since
382385 * EDPM doorbell transactions can take multiple 64b cycles, and as such
383386 * can "split" over the pci. Possibly, the doorbell drop can happen with
@@ -406,51 +409,74 @@ static int qed_db_rec_flush_queue(struct qed_hwfn *p_hwfn, · 22 unmodified lines
406409
407410 int qed_db_rec_handler(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
408411 {
409− u32 overflow;
412+ u32 attn_ovfl, cur_ovfl;
410413 int rc;
411414
412− overflow = qed_rd(p_hwfn, p_ptt, DORQ_REG_PF_OVFL_STICKY);
413− DP_NOTICE(p_hwfn, "PF Overflow sticky 0x%x\n", overflow);
414− if (!overflow) {
415− qed_db_recovery_execute(p_hwfn, DB_REC_ONCE);
415+ attn_ovfl = test_and_clear_bit(QED_OVERFLOW_BIT,
416+ &p_hwfn->db_recovery_info.overflow);
417+ cur_ovfl = qed_rd(p_hwfn, p_ptt, DORQ_REG_PF_OVFL_STICKY);
418+ if (!cur_ovfl && !attn_ovfl)
416419 return 0;
417− }
418420
419− if (qed_edpm_enabled(p_hwfn)) {
421+ DP_NOTICE(p_hwfn, "PF Overflow sticky: attn %u current %u\n",
422+ attn_ovfl, cur_ovfl);
423+
424+ if (cur_ovfl && !p_hwfn->db_bar_no_edpm) {
420425 rc = qed_db_rec_flush_queue(p_hwfn, p_ptt);
421426 if (rc)
422427 return rc;
423428 }
424429
425− /* Flush any pending (e)dpm as they may never arrive */
426− qed_wr(p_hwfn, p_ptt, DORQ_REG_DPM_FORCE_ABORT, 0x1);
427−
428430 /* Release overflow sticky indication (stop silently dropping everything) */
429431 qed_wr(p_hwfn, p_ptt, DORQ_REG_PF_OVFL_STICKY, 0x0);
430432
431433 /* Repeat all last doorbells (doorbell drop recovery) */
432− qed_db_recovery_execute(p_hwfn, DB_REC_REAL_DEAL);
434+ qed_db_recovery_execute(p_hwfn);
433435
434436 return 0;
435437 }
436438
437−static int qed_dorq_attn_cb(struct qed_hwfn *p_hwfn)
439+static void qed_dorq_attn_overflow(struct qed_hwfn *p_hwfn)
438440 {
439− u32 int_sts, first_drop_reason, details, address, all_drops_reason;
440441 struct qed_ptt *p_ptt = p_hwfn->p_dpc_ptt;
442+ u32 overflow;
441443 int rc;
442444
443− int_sts = qed_rd(p_hwfn, p_ptt, DORQ_REG_INT_STS);
444− DP_NOTICE(p_hwfn->cdev, "DORQ attention. int_sts was %x\n", int_sts);
445+ overflow = qed_rd(p_hwfn, p_ptt, DORQ_REG_PF_OVFL_STICKY);
446+ if (!overflow)
447+ goto out;
448+
449+ /* Run PF doorbell recovery in next periodic handler */
450+ set_bit(QED_OVERFLOW_BIT, &p_hwfn->db_recovery_info.overflow);
451+
452+ if (!p_hwfn->db_bar_no_edpm) {
453+ rc = qed_db_rec_flush_queue(p_hwfn, p_ptt);
454+ if (rc)
455+ goto out;
456+ }
457+
458+ qed_wr(p_hwfn, p_ptt, DORQ_REG_PF_OVFL_STICKY, 0x0);
459+out:
460+ /* Schedule the handler even if overflow was not detected */
461+ qed_periodic_db_rec_start(p_hwfn);
462+}
463+
464+static int qed_dorq_attn_int_sts(struct qed_hwfn *p_hwfn)
465+{
466+ u32 int_sts, first_drop_reason, details, address, all_drops_reason;
467+ struct qed_ptt *p_ptt = p_hwfn->p_dpc_ptt;
445468
446469 /* int_sts may be zero since all PFs were interrupted for doorbell
447470 * overflow but another one already handled it. Can abort here. If
448471 * This PF also requires overflow recovery we will be interrupted again.
449472 * The masked almost full indication may also be set. Ignoring.
450473 */
474+ int_sts = qed_rd(p_hwfn, p_ptt, DORQ_REG_INT_STS);
451475 if (!(int_sts & ~DORQ_REG_INT_STS_DORQ_FIFO_AFULL))
452476 return 0;
453477
478+ DP_NOTICE(p_hwfn->cdev, "DORQ attention. int_sts was %x\n", int_sts);
479+
454480 /* check if db_drop or overflow happened */
455481 if (int_sts & (DORQ_REG_INT_STS_DB_DROP |
456482 DORQ_REG_INT_STS_DORQ_FIFO_OVFL_ERR)) {
@@ -477,11 +503,6 @@ static int qed_dorq_attn_cb(struct qed_hwfn *p_hwfn) · 20 unmodified lines
477503 GET_FIELD(details, QED_DORQ_ATTENTION_SIZE) * 4,
478504 first_drop_reason, all_drops_reason);
479505
480− rc = qed_db_rec_handler(p_hwfn, p_ptt);
481− qed_periodic_db_rec_start(p_hwfn);
482− if (rc)
483− return rc;
484−
485506 /* Clear the doorbell drop details and prepare for next drop */
486507 qed_wr(p_hwfn, p_ptt, DORQ_REG_DB_DROP_DETAILS_REL, 0);
487508
@@ -507,6 +528,25 @@ static int qed_dorq_attn_cb(struct qed_hwfn *p_hwfn) · 19 unmodified lines
507528 return -EINVAL;
508529 }
509530
531+static int qed_dorq_attn_cb(struct qed_hwfn *p_hwfn)
532+{
533+ p_hwfn->db_recovery_info.dorq_attn = true;
534+ qed_dorq_attn_overflow(p_hwfn);
535+
536+ return qed_dorq_attn_int_sts(p_hwfn);
537+}
538+
539+static void qed_dorq_attn_handler(struct qed_hwfn *p_hwfn)
540+{
541+ if (p_hwfn->db_recovery_info.dorq_attn)
542+ goto out;
543+
544+ /* Call DORQ callback if the attention was missed */
545+ qed_dorq_attn_cb(p_hwfn);
546+out:
547+ p_hwfn->db_recovery_info.dorq_attn = false;
548+}
549+
510550 /* Instead of major changes to the data-structure, we have a some 'special'
511551 * identifiers for sources that changed meaning between adapters.
512552 */
@@ -1080,6 +1120,9 @@ static int qed_int_deassertion(struct qed_hwfn *p_hwfn, · 567 unmodified lines
10801120 }
10811121 }
10821122
1123+ /* Handle missed DORQ attention */
1124+ qed_dorq_attn_handler(p_hwfn);
1125+
10831126 /* Clear IGU indication for the deasserted bits */
10841127 DIRECT_REG_WR((u8 __iomem *)p_hwfn->regview +
10851128 GTT_BAR0_MAP_REG_IGU_CMD +
drivers/net/ethernet/qlogic/qed/qed_int.h+2−2
@@ -192,8 +192,8 @@ void qed_int_disable_post_isr_release(struct qed_dev *cdev); · 191 unmodified lines
192192
193193 /**
194194 * @brief - Doorbell Recovery handler.
195− * Run DB_REAL_DEAL doorbell recovery in case of PF overflow
196− * (and flush DORQ if needed), otherwise run DB_REC_ONCE.
195+ * Run doorbell recovery in case of PF overflow (and flush DORQ if
196+ * needed).
197197 *
198198 * @param p_hwfn
199199 * @param p_ptt
drivers/net/ethernet/qlogic/qed/qed_main.c+1−1
@@ -970,7 +970,7 @@ static void qed_update_pf_params(struct qed_dev *cdev, · 969 unmodified lines
970970 }
971971 }
972972
973−#define QED_PERIODIC_DB_REC_COUNT 100
973+#define QED_PERIODIC_DB_REC_COUNT 10
974974 #define QED_PERIODIC_DB_REC_INTERVAL_MS 100
975975 #define QED_PERIODIC_DB_REC_INTERVAL \
976976 msecs_to_jiffies(QED_PERIODIC_DB_REC_INTERVAL_MS)
drivers/net/ethernet/qlogic/qed/qed_sriov.c+1−1
@@ -1591,7 +1591,7 @@ static void qed_iov_vf_mbx_acquire(struct qed_hwfn *p_hwfn, · 1590 unmodified lines
15911591 p_vfdev->eth_fp_hsi_minor = ETH_HSI_VER_NO_PKT_LEN_TUNN;
15921592 } else {
15931593 DP_INFO(p_hwfn,
1594− "VF[%d] needs fastpath HSI %02x.%02x, which is incompatible with loaded FW's faspath HSI %02x.%02x\n",
1594+ "VF[%d] needs fastpath HSI %02x.%02x, which is incompatible with loaded FW's fastpath HSI %02x.%02x\n",
15951595 vf->abs_vf_id,
15961596 req->vfdev_info.eth_fp_hsi_major,
15971597 req->vfdev_info.eth_fp_hsi_minor,
drivers/net/ethernet/qlogic/qede/qede_ptp.c+3−4
@@ -490,18 +490,17 @@ int qede_ptp_enable(struct qede_dev *edev, bool init_tc) · 489 unmodified lines
490490
491491 ptp->clock = ptp_clock_register(&ptp->clock_info, &edev->pdev->dev);
492492 if (IS_ERR(ptp->clock)) {
493− rc = -EINVAL;
494493 DP_ERR(edev, "PTP clock registration failed\n");
494+ qede_ptp_disable(edev);
495+ rc = -EINVAL;
495496 goto err2;
496497 }
497498
498499 return 0;
499500
500−err2:
501− qede_ptp_disable(edev);
502− ptp->clock = NULL;
503501 err1:
504502 kfree(ptp);
503+err2:
505504 edev->ptp = NULL;
506505
507506 return rc;
drivers/net/ethernet/qlogic/qlcnic/qlcnic.h+1−1
@@ -497,7 +497,7 @@ struct qlcnic_hardware_context { · 496 unmodified lines
497497 u16 board_type;
498498 u16 supported_type;
499499
500− u16 link_speed;
500+ u32 link_speed;
501501 u16 link_duplex;
502502 u16 link_autoneg;
503503 u16 module_type;
drivers/net/ethernet/realtek/r8169.c+7−1
@@ -28,6 +28,7 @@ · 27 unmodified lines
2828 #include <linux/pm_runtime.h>
2929 #include <linux/firmware.h>
3030 #include <linux/prefetch.h>
31+#include <linux/pci-aspm.h>
3132 #include <linux/ipv6.h>
3233 #include <net/ip6_checksum.h>
3334
@@ -5460,7 +5461,7 @@ static void rtl_hw_start_8168(struct rtl8169_private *tp) · 5426 unmodified lines
54605461 tp->cp_cmd |= PktCntrDisable | INTT_1;
54615462 RTL_W16(tp, CPlusCmd, tp->cp_cmd);
54625463
5463− RTL_W16(tp, IntrMitigate, 0x5151);
5464+ RTL_W16(tp, IntrMitigate, 0x5100);
54645465
54655466 /* Work around for RxFIFO overflow. */
54665467 if (tp->mac_version == RTL_GIGA_MAC_VER_11) {
@@ -7352,6 +7353,11 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 1885 unmodified lines
73527353 if (rc)
73537354 return rc;
73547355
7356+ /* Disable ASPM completely as that cause random device stop working
7357+ * problems as well as full system hangs for some PCIe devices users.
7358+ */
7359+ pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1);
7360+
73557361 /* enable device (incl. PCI PM wakeup and hotplug setup) */
73567362 rc = pcim_enable_device(pdev);
73577363 if (rc < 0) {
drivers/net/ethernet/stmicro/stmmac/descs_com.h+14−8
@@ -29,11 +29,13 @@ · 28 unmodified lines
2929 /* Specific functions used for Ring mode */
3030
3131 /* Enhanced descriptors */
32−static inline void ehn_desc_rx_set_on_ring(struct dma_desc *p, int end)
32+static inline void ehn_desc_rx_set_on_ring(struct dma_desc *p, int end,
33+ int bfsize)
3334 {
34− p->des1 |= cpu_to_le32((BUF_SIZE_8KiB
35− << ERDES1_BUFFER2_SIZE_SHIFT)
36− & ERDES1_BUFFER2_SIZE_MASK);
35+ if (bfsize == BUF_SIZE_16KiB)
36+ p->des1 |= cpu_to_le32((BUF_SIZE_8KiB
37+ << ERDES1_BUFFER2_SIZE_SHIFT)
38+ & ERDES1_BUFFER2_SIZE_MASK);
3739
3840 if (end)
3941 p->des1 |= cpu_to_le32(ERDES1_END_RING);
@@ -59,11 +61,15 @@ static inline void enh_set_tx_desc_len_on_ring(struct dma_desc *p, int len) · 19 unmodified lines
5961 }
6062
6163 /* Normal descriptors */
62−static inline void ndesc_rx_set_on_ring(struct dma_desc *p, int end)
64+static inline void ndesc_rx_set_on_ring(struct dma_desc *p, int end, int bfsize)
6365 {
64− p->des1 |= cpu_to_le32(((BUF_SIZE_2KiB - 1)
65− << RDES1_BUFFER2_SIZE_SHIFT)
66− & RDES1_BUFFER2_SIZE_MASK);
66+ if (bfsize >= BUF_SIZE_2KiB) {
67+ int bfsize2;
68+
69+ bfsize2 = min(bfsize - BUF_SIZE_2KiB + 1, BUF_SIZE_2KiB - 1);
70+ p->des1 |= cpu_to_le32((bfsize2 << RDES1_BUFFER2_SIZE_SHIFT)
71+ & RDES1_BUFFER2_SIZE_MASK);
72+ }
6773
6874 if (end)
6975 p->des1 |= cpu_to_le32(RDES1_END_RING);
drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c+1−1
@@ -296,7 +296,7 @@ exit: · 295 unmodified lines
296296 }
297297
298298 static void dwmac4_rd_init_rx_desc(struct dma_desc *p, int disable_rx_ic,
299− int mode, int end)
299+ int mode, int end, int bfsize)
300300 {
301301 dwmac4_set_rx_owner(p, disable_rx_ic);
302302 }
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c+1−1
@@ -123,7 +123,7 @@ static int dwxgmac2_get_rx_timestamp_status(void *desc, void *next_desc, · 122 unmodified lines
123123 }
124124
125125 static void dwxgmac2_init_rx_desc(struct dma_desc *p, int disable_rx_ic,
126− int mode, int end)
126+ int mode, int end, int bfsize)
127127 {
128128 dwxgmac2_set_rx_owner(p, disable_rx_ic);
129129 }
drivers/net/ethernet/stmicro/stmmac/enh_desc.c+16−6
@@ -201,6 +201,11 @@ static int enh_desc_get_rx_status(void *data, struct stmmac_extra_stats *x, · 200 unmodified lines
201201 if (unlikely(rdes0 & RDES0_OWN))
202202 return dma_own;
203203
204+ if (unlikely(!(rdes0 & RDES0_LAST_DESCRIPTOR))) {
205+ stats->rx_length_errors++;
206+ return discard_frame;
207+ }
208+
204209 if (unlikely(rdes0 & RDES0_ERROR_SUMMARY)) {
205210 if (unlikely(rdes0 & RDES0_DESCRIPTOR_ERROR)) {
206211 x->rx_desc++;
@@ -231,9 +236,10 @@ static int enh_desc_get_rx_status(void *data, struct stmmac_extra_stats *x, · 24 unmodified lines
231236 * It doesn't match with the information reported into the databook.
232237 * At any rate, we need to understand if the CSUM hw computation is ok
233238 * and report this info to the upper layers. */
234− ret = enh_desc_coe_rdes0(!!(rdes0 & RDES0_IPC_CSUM_ERROR),
235− !!(rdes0 & RDES0_FRAME_TYPE),
236− !!(rdes0 & ERDES0_RX_MAC_ADDR));
239+ if (likely(ret == good_frame))
240+ ret = enh_desc_coe_rdes0(!!(rdes0 & RDES0_IPC_CSUM_ERROR),
241+ !!(rdes0 & RDES0_FRAME_TYPE),
242+ !!(rdes0 & ERDES0_RX_MAC_ADDR));
237243
238244 if (unlikely(rdes0 & RDES0_DRIBBLING))
239245 x->dribbling_bit++;
@@ -259,15 +265,19 @@ static int enh_desc_get_rx_status(void *data, struct stmmac_extra_stats *x, · 19 unmodified lines
259265 }
260266
261267 static void enh_desc_init_rx_desc(struct dma_desc *p, int disable_rx_ic,
262− int mode, int end)
268+ int mode, int end, int bfsize)
263269 {
270+ int bfsize1;
271+
264272 p->des0 |= cpu_to_le32(RDES0_OWN);
265− p->des1 |= cpu_to_le32(BUF_SIZE_8KiB & ERDES1_BUFFER1_SIZE_MASK);
273+
274+ bfsize1 = min(bfsize, BUF_SIZE_8KiB);
275+ p->des1 |= cpu_to_le32(bfsize1 & ERDES1_BUFFER1_SIZE_MASK);
266276
267277 if (mode == STMMAC_CHAIN_MODE)
268278 ehn_desc_rx_set_on_chain(p);
269279 else
270− ehn_desc_rx_set_on_ring(p, end);
280+ ehn_desc_rx_set_on_ring(p, end, bfsize);
271281
272282 if (disable_rx_ic)
273283 p->des1 |= cpu_to_le32(ERDES1_DISABLE_IC);
drivers/net/ethernet/stmicro/stmmac/hwif.h+1−1
@@ -33,7 +33,7 @@ struct dma_extended_desc; · 32 unmodified lines
3333 struct stmmac_desc_ops {
3434 /* DMA RX descriptor ring initialization */
3535 void (*init_rx_desc)(struct dma_desc *p, int disable_rx_ic, int mode,
36− int end);
36+ int end, int bfsize);
3737 /* DMA TX descriptor ring initialization */
3838 void (*init_tx_desc)(struct dma_desc *p, int mode, int end);
3939 /* Invoked by the xmit function to prepare the tx descriptor */
drivers/net/ethernet/stmicro/stmmac/norm_desc.c+7−5
@@ -91,8 +91,6 @@ static int ndesc_get_rx_status(void *data, struct stmmac_extra_stats *x, · 90 unmodified lines
9191 return dma_own;
9292
9393 if (unlikely(!(rdes0 & RDES0_LAST_DESCRIPTOR))) {
94− pr_warn("%s: Oversized frame spanned multiple buffers\n",
95− __func__);
9694 stats->rx_length_errors++;
9795 return discard_frame;
9896 }
@@ -135,15 +133,19 @@ static int ndesc_get_rx_status(void *data, struct stmmac_extra_stats *x, · 36 unmodified lines
135133 }
136134
137135 static void ndesc_init_rx_desc(struct dma_desc *p, int disable_rx_ic, int mode,
138− int end)
136+ int end, int bfsize)
139137 {
138+ int bfsize1;
139+
140140 p->des0 |= cpu_to_le32(RDES0_OWN);
141− p->des1 |= cpu_to_le32((BUF_SIZE_2KiB - 1) & RDES1_BUFFER1_SIZE_MASK);
141+
142+ bfsize1 = min(bfsize, BUF_SIZE_2KiB - 1);
143+ p->des1 |= cpu_to_le32(bfsize & RDES1_BUFFER1_SIZE_MASK);
142144
143145 if (mode == STMMAC_CHAIN_MODE)
144146 ndesc_rx_set_on_chain(p, end);
145147 else
146− ndesc_rx_set_on_ring(p, end);
148+ ndesc_rx_set_on_ring(p, end, bfsize);
147149
148150 if (disable_rx_ic)
149151 p->des1 |= cpu_to_le32(RDES1_DISABLE_IC);
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+19−15
@@ -1136,11 +1136,13 @@ static void stmmac_clear_rx_descriptors(struct stmmac_priv *priv, u32 queue) · 1135 unmodified lines
11361136 if (priv->extend_desc)
11371137 stmmac_init_rx_desc(priv, &rx_q->dma_erx[i].basic,
11381138 priv->use_riwt, priv->mode,
1139− (i == DMA_RX_SIZE - 1));
1139+ (i == DMA_RX_SIZE - 1),
1140+ priv->dma_buf_sz);
11401141 else
11411142 stmmac_init_rx_desc(priv, &rx_q->dma_rx[i],
11421143 priv->use_riwt, priv->mode,
1143− (i == DMA_RX_SIZE - 1));
1144+ (i == DMA_RX_SIZE - 1),
1145+ priv->dma_buf_sz);
11441146 }
11451147
11461148 /**
@@ -3352,9 +3354,8 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) · 2205 unmodified lines
33523354 {
33533355 struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
33543356 struct stmmac_channel *ch = &priv->channel[queue];
3355− unsigned int entry = rx_q->cur_rx;
3357+ unsigned int next_entry = rx_q->cur_rx;
33563358 int coe = priv->hw->rx_csum;
3357− unsigned int next_entry;
33583359 unsigned int count = 0;
33593360 bool xmac;
33603361
@@ -3372,10 +3373,12 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) · 11 unmodified lines
33723373 stmmac_display_ring(priv, rx_head, DMA_RX_SIZE, true);
33733374 }
33743375 while (count < limit) {
3375− int status;
3376+ int entry, status;
33763377 struct dma_desc *p;
33773378 struct dma_desc *np;
33783379
3380+ entry = next_entry;
3381+
33793382 if (priv->extend_desc)
33803383 p = (struct dma_desc *)(rx_q->dma_erx + entry);
33813384 else
@@ -3431,11 +3434,12 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) · 49 unmodified lines
34313434 * ignored
34323435 */
34333436 if (frame_len > priv->dma_buf_sz) {
3434− netdev_err(priv->dev,
3435− "len %d larger than size (%d)\n",
3436− frame_len, priv->dma_buf_sz);
3437+ if (net_ratelimit())
3438+ netdev_err(priv->dev,
3439+ "len %d larger than size (%d)\n",
3440+ frame_len, priv->dma_buf_sz);
34373441 priv->dev->stats.rx_length_errors++;
3438− break;
3442+ continue;
34393443 }
34403444
34413445 /* ACS is set; GMAC core strips PAD/FCS for IEEE 802.3
@@ -3470,7 +3474,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) · 28 unmodified lines
34703474 dev_warn(priv->device,
34713475 "packet dropped\n");
34723476 priv->dev->stats.rx_dropped++;
3473− break;
3477+ continue;
34743478 }
34753479
34763480 dma_sync_single_for_cpu(priv->device,
@@ -3490,11 +3494,12 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) · 13 unmodified lines
34903494 } else {
34913495 skb = rx_q->rx_skbuff[entry];
34923496 if (unlikely(!skb)) {
3493− netdev_err(priv->dev,
3494− "%s: Inconsistent Rx chain\n",
3495− priv->dev->name);
3497+ if (net_ratelimit())
3498+ netdev_err(priv->dev,
3499+ "%s: Inconsistent Rx chain\n",
3500+ priv->dev->name);
34963501 priv->dev->stats.rx_dropped++;
3497− break;
3502+ continue;
34983503 }
34993504 prefetch(skb->data - NET_IP_ALIGN);
35003505 rx_q->rx_skbuff[entry] = NULL;
@@ -3529,7 +3534,6 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) · 28 unmodified lines
35293534 priv->dev->stats.rx_packets++;
35303535 priv->dev->stats.rx_bytes += frame_len;
35313536 }
3532− entry = next_entry;
35333537 }
35343538
35353539 stmmac_rx_refill(priv, queue);
drivers/net/hyperv/hyperv_net.h+1−0
@@ -987,6 +987,7 @@ struct netvsc_device { · 986 unmodified lines
987987
988988 wait_queue_head_t wait_drain;
989989 bool destroy;
990+ bool tx_disable; /* if true, do not wake up queue again */
990991
991992 /* Receive buffer allocated by us but manages by NetVSP */
992993 void *recv_buf;
drivers/net/hyperv/netvsc.c+4−2
@@ -110,6 +110,7 @@ static struct netvsc_device *alloc_net_device(void) · 109 unmodified lines
110110
111111 init_waitqueue_head(&net_device->wait_drain);
112112 net_device->destroy = false;
113+ net_device->tx_disable = false;
113114
114115 net_device->max_pkt = RNDIS_MAX_PKT_DEFAULT;
115116 net_device->pkt_align = RNDIS_PKT_ALIGN_DEFAULT;
@@ -719,7 +720,7 @@ static void netvsc_send_tx_complete(struct net_device *ndev, · 603 unmodified lines
719720 } else {
720721 struct netdev_queue *txq = netdev_get_tx_queue(ndev, q_idx);
721722
722− if (netif_tx_queue_stopped(txq) &&
723+ if (netif_tx_queue_stopped(txq) && !net_device->tx_disable &&
723724 (hv_get_avail_to_write_percent(&channel->outbound) >
724725 RING_AVAIL_PERCENT_HIWATER || queue_sends < 1)) {
725726 netif_tx_wake_queue(txq);
@@ -874,7 +875,8 @@ static inline int netvsc_send_pkt( · 148 unmodified lines
874875 } else if (ret == -EAGAIN) {
875876 netif_tx_stop_queue(txq);
876877 ndev_ctx->eth_stats.stop_queue++;
877− if (atomic_read(&nvchan->queue_sends) < 1) {
878+ if (atomic_read(&nvchan->queue_sends) < 1 &&
879+ !net_device->tx_disable) {
878880 netif_tx_wake_queue(txq);
879881 ndev_ctx->eth_stats.wake_queue++;
880882 ret = -ENOSPC;
drivers/net/hyperv/netvsc_drv.c+26−6
@@ -109,6 +109,15 @@ static void netvsc_set_rx_mode(struct net_device *net) · 108 unmodified lines
109109 rcu_read_unlock();
110110 }
111111
112+static void netvsc_tx_enable(struct netvsc_device *nvscdev,
113+ struct net_device *ndev)
114+{
115+ nvscdev->tx_disable = false;
116+ virt_wmb(); /* ensure queue wake up mechanism is on */
117+
118+ netif_tx_wake_all_queues(ndev);
119+}
120+
112121 static int netvsc_open(struct net_device *net)
113122 {
114123 struct net_device_context *ndev_ctx = netdev_priv(net);
@@ -129,7 +138,7 @@ static int netvsc_open(struct net_device *net) · 14 unmodified lines
129138 rdev = nvdev->extension;
130139 if (!rdev->link_state) {
131140 netif_carrier_on(net);
132− netif_tx_wake_all_queues(net);
141+ netvsc_tx_enable(nvdev, net);
133142 }
134143
135144 if (vf_netdev) {
@@ -184,6 +193,17 @@ static int netvsc_wait_until_empty(struct netvsc_device *nvdev) · 48 unmodified lines
184193 }
185194 }
186195
196+static void netvsc_tx_disable(struct netvsc_device *nvscdev,
197+ struct net_device *ndev)
198+{
199+ if (nvscdev) {
200+ nvscdev->tx_disable = true;
201+ virt_wmb(); /* ensure txq will not wake up after stop */
202+ }
203+
204+ netif_tx_disable(ndev);
205+}
206+
187207 static int netvsc_close(struct net_device *net)
188208 {
189209 struct net_device_context *net_device_ctx = netdev_priv(net);
@@ -192,7 +212,7 @@ static int netvsc_close(struct net_device *net) · 2 unmodified lines
192212 struct netvsc_device *nvdev = rtnl_dereference(net_device_ctx->nvdev);
193213 int ret;
194214
195− netif_tx_disable(net);
215+ netvsc_tx_disable(nvdev, net);
196216
197217 /* No need to close rndis filter if it is removed already */
198218 if (!nvdev)
@@ -920,7 +940,7 @@ static int netvsc_detach(struct net_device *ndev, · 721 unmodified lines
920940
921941 /* If device was up (receiving) then shutdown */
922942 if (netif_running(ndev)) {
923− netif_tx_disable(ndev);
943+ netvsc_tx_disable(nvdev, ndev);
924944
925945 ret = rndis_filter_close(nvdev);
926946 if (ret) {
@@ -1908,7 +1928,7 @@ static void netvsc_link_change(struct work_struct *w) · 981 unmodified lines
19081928 if (rdev->link_state) {
19091929 rdev->link_state = false;
19101930 netif_carrier_on(net);
1911− netif_tx_wake_all_queues(net);
1931+ netvsc_tx_enable(net_device, net);
19121932 } else {
19131933 notify = true;
19141934 }
@@ -1918,7 +1938,7 @@ static void netvsc_link_change(struct work_struct *w) · 3 unmodified lines
19181938 if (!rdev->link_state) {
19191939 rdev->link_state = true;
19201940 netif_carrier_off(net);
1921− netif_tx_stop_all_queues(net);
1941+ netvsc_tx_disable(net_device, net);
19221942 }
19231943 kfree(event);
19241944 break;
@@ -1927,7 +1947,7 @@ static void netvsc_link_change(struct work_struct *w) · 2 unmodified lines
19271947 if (!rdev->link_state) {
19281948 rdev->link_state = true;
19291949 netif_carrier_off(net);
1930− netif_tx_stop_all_queues(net);
1950+ netvsc_tx_disable(net_device, net);
19311951 event->event = RNDIS_STATUS_MEDIA_CONNECT;
19321952 spin_lock_irqsave(&ndev_ctx->lock, flags);
19331953 list_add(&event->list, &ndev_ctx->reconfig_events);
drivers/net/team/team.c+26−0
@@ -1246,6 +1246,23 @@ static int team_port_add(struct team *team, struct net_device *port_dev, · 1245 unmodified lines
12461246 goto err_option_port_add;
12471247 }
12481248
1249+ /* set promiscuity level to new slave */
1250+ if (dev->flags & IFF_PROMISC) {
1251+ err = dev_set_promiscuity(port_dev, 1);
1252+ if (err)
1253+ goto err_set_slave_promisc;
1254+ }
1255+
1256+ /* set allmulti level to new slave */
1257+ if (dev->flags & IFF_ALLMULTI) {
1258+ err = dev_set_allmulti(port_dev, 1);
1259+ if (err) {
1260+ if (dev->flags & IFF_PROMISC)
1261+ dev_set_promiscuity(port_dev, -1);
1262+ goto err_set_slave_promisc;
1263+ }
1264+ }
1265+
12491266 netif_addr_lock_bh(dev);
12501267 dev_uc_sync_multiple(port_dev, dev);
12511268 dev_mc_sync_multiple(port_dev, dev);
@@ -1262,6 +1279,9 @@ static int team_port_add(struct team *team, struct net_device *port_dev, · 10 unmodified lines
12621279
12631280 return 0;
12641281
1282+err_set_slave_promisc:
1283+ __team_option_inst_del_port(team, port);
1284+
12651285 err_option_port_add:
12661286 team_upper_dev_unlink(team, port);
12671287
@@ -1307,6 +1327,12 @@ static int team_port_del(struct team *team, struct net_device *port_dev) · 39 unmodified lines
13071327
13081328 team_port_disable(team, port);
13091329 list_del_rcu(&port->list);
1330+
1331+ if (dev->flags & IFF_PROMISC)
1332+ dev_set_promiscuity(port_dev, -1);
1333+ if (dev->flags & IFF_ALLMULTI)
1334+ dev_set_allmulti(port_dev, -1);
1335+
13101336 team_upper_dev_unlink(team, port);
13111337 netdev_rx_handler_unregister(port_dev);
13121338 team_port_disable_netpoll(port);
drivers/net/usb/qmi_wwan.c+1−0
@@ -1203,6 +1203,7 @@ static const struct usb_device_id products[] = { · 1202 unmodified lines
12031203 {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */
12041204 {QMI_FIXED_INTF(0x2001, 0x7e19, 4)}, /* D-Link DWM-221 B1 */
12051205 {QMI_FIXED_INTF(0x2001, 0x7e35, 4)}, /* D-Link DWM-222 */
1206+ {QMI_FIXED_INTF(0x2020, 0x2031, 4)}, /* Olicard 600 */
12061207 {QMI_FIXED_INTF(0x2020, 0x2033, 4)}, /* BroadMobi BM806U */
12071208 {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */
12081209 {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */
drivers/net/vrf.c+7−2
@@ -1273,9 +1273,14 @@ static void vrf_setup(struct net_device *dev) · 1272 unmodified lines
12731273
12741274 /* default to no qdisc; user can add if desired */
12751275 dev->priv_flags |= IFF_NO_QUEUE;
1276+ dev->priv_flags |= IFF_NO_RX_HANDLER;
12761277
1277− dev->min_mtu = 0;
1278− dev->max_mtu = 0;
1278+ /* VRF devices do not care about MTU, but if the MTU is set
1279+ * too low then the ipv4 and ipv6 protocols are disabled
1280+ * which breaks networking.
1281+ */
1282+ dev->min_mtu = IPV6_MIN_MTU;
1283+ dev->max_mtu = ETH_MAX_MTU;
12791284 }
12801285
12811286 static int vrf_validate(struct nlattr *tb[], struct nlattr *data[],
drivers/net/wireless/ath/ath10k/htt_rx.c+1−1
@@ -2728,7 +2728,7 @@ static void ath10k_htt_rx_tx_fetch_ind(struct ath10k *ar, struct sk_buff *skb) · 2727 unmodified lines
27282728 num_msdus++;
27292729 num_bytes += ret;
27302730 }
2731− ieee80211_return_txq(hw, txq);
2731+ ieee80211_return_txq(hw, txq, false);
27322732 ieee80211_txq_schedule_end(hw, txq->ac);
27332733
27342734 record->num_msdus = cpu_to_le16(num_msdus);
drivers/net/wireless/ath/ath10k/mac.c+2−2
@@ -4089,7 +4089,7 @@ static int ath10k_mac_schedule_txq(struct ieee80211_hw *hw, u32 ac) · 4088 unmodified lines
40894089 if (ret < 0)
40904090 break;
40914091 }
4092− ieee80211_return_txq(hw, txq);
4092+ ieee80211_return_txq(hw, txq, false);
40934093 ath10k_htt_tx_txq_update(hw, txq);
40944094 if (ret == -EBUSY)
40954095 break;
@@ -4374,7 +4374,7 @@ static void ath10k_mac_op_wake_tx_queue(struct ieee80211_hw *hw, · 278 unmodified lines
43744374 if (ret < 0)
43754375 break;
43764376 }
4377− ieee80211_return_txq(hw, txq);
4377+ ieee80211_return_txq(hw, txq, false);
43784378 ath10k_htt_tx_txq_update(hw, txq);
43794379 out:
43804380 ieee80211_txq_schedule_end(hw, ac);
drivers/net/wireless/ath/ath9k/xmit.c+4−1
@@ -1938,12 +1938,15 @@ void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq) · 1937 unmodified lines
19381938 goto out;
19391939
19401940 while ((queue = ieee80211_next_txq(hw, txq->mac80211_qnum))) {
1941+ bool force;
1942+
19411943 tid = (struct ath_atx_tid *)queue->drv_priv;
19421944
19431945 ret = ath_tx_sched_aggr(sc, txq, tid);
19441946 ath_dbg(common, QUEUE, "ath_tx_sched_aggr returned %d\n", ret);
19451947
1946− ieee80211_return_txq(hw, queue);
1948+ force = !skb_queue_empty(&tid->retry_q);
1949+ ieee80211_return_txq(hw, queue, force);
19471950 }
19481951
19491952 out:
drivers/net/wireless/intel/iwlwifi/cfg/22000.c+22−8
@@ -82,6 +82,7 @@ · 81 unmodified lines
8282 #define IWL_22000_HR_A0_FW_PRE "iwlwifi-QuQnj-a0-hr-a0-"
8383 #define IWL_22000_SU_Z0_FW_PRE "iwlwifi-su-z0-"
8484 #define IWL_QU_B_JF_B_FW_PRE "iwlwifi-Qu-b0-jf-b0-"
85+#define IWL_QUZ_A_HR_B_FW_PRE "iwlwifi-QuZ-a0-hr-b0-"
8586 #define IWL_QNJ_B_JF_B_FW_PRE "iwlwifi-QuQnj-b0-jf-b0-"
8687 #define IWL_CC_A_FW_PRE "iwlwifi-cc-a0-"
8788 #define IWL_22000_SO_A_JF_B_FW_PRE "iwlwifi-so-a0-jf-b0-"
@@ -105,8 +106,8 @@ · 17 unmodified lines
105106 IWL_22000_HR_A0_FW_PRE __stringify(api) ".ucode"
106107 #define IWL_22000_SU_Z0_MODULE_FIRMWARE(api) \
107108 IWL_22000_SU_Z0_FW_PRE __stringify(api) ".ucode"
108−#define IWL_QU_B_JF_B_MODULE_FIRMWARE(api) \
109− IWL_QU_B_JF_B_FW_PRE __stringify(api) ".ucode"
109+#define IWL_QUZ_A_HR_B_MODULE_FIRMWARE(api) \
110+ IWL_QUZ_A_HR_B_FW_PRE __stringify(api) ".ucode"
110111 #define IWL_QU_B_JF_B_MODULE_FIRMWARE(api) \
111112 IWL_QU_B_JF_B_FW_PRE __stringify(api) ".ucode"
112113 #define IWL_QNJ_B_JF_B_MODULE_FIRMWARE(api) \
@@ -235,8 +236,20 @@ const struct iwl_cfg iwl_ax101_cfg_qu_hr = { · 122 unmodified lines
235236 .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
236237 };
237238
238−const struct iwl_cfg iwl22260_2ax_cfg = {
239− .name = "Intel(R) Wireless-AX 22260",
239+const struct iwl_cfg iwl_ax101_cfg_quz_hr = {
240+ .name = "Intel(R) Wi-Fi 6 AX101",
241+ .fw_name_pre = IWL_QUZ_A_HR_B_FW_PRE,
242+ IWL_DEVICE_22500,
243+ /*
244+ * This device doesn't support receiving BlockAck with a large bitmap
245+ * so we need to restrict the size of transmitted aggregation to the
246+ * HT size; mac80211 would otherwise pick the HE max (256) by default.
247+ */
248+ .max_tx_agg_size = IEEE80211_MAX_AMPDU_BUF_HT,
249+};
250+
251+const struct iwl_cfg iwl_ax200_cfg_cc = {
252+ .name = "Intel(R) Wi-Fi 6 AX200 160MHz",
240253 .fw_name_pre = IWL_CC_A_FW_PRE,
241254 IWL_DEVICE_22500,
242255 /*
@@ -249,7 +262,7 @@ const struct iwl_cfg iwl22260_2ax_cfg = { · 6 unmodified lines
249262 };
250263
251264 const struct iwl_cfg killer1650x_2ax_cfg = {
252− .name = "Killer(R) Wireless-AX 1650x Wireless Network Adapter (200NGW)",
265+ .name = "Killer(R) Wi-Fi 6 AX1650x 160MHz Wireless Network Adapter (200NGW)",
253266 .fw_name_pre = IWL_CC_A_FW_PRE,
254267 IWL_DEVICE_22500,
255268 /*
@@ -262,7 +275,7 @@ const struct iwl_cfg killer1650x_2ax_cfg = { · 6 unmodified lines
262275 };
263276
264277 const struct iwl_cfg killer1650w_2ax_cfg = {
265− .name = "Killer(R) Wireless-AX 1650w Wireless Network Adapter (200D2W)",
278+ .name = "Killer(R) Wi-Fi 6 AX1650w 160MHz Wireless Network Adapter (200D2W)",
266279 .fw_name_pre = IWL_CC_A_FW_PRE,
267280 IWL_DEVICE_22500,
268281 /*
@@ -328,7 +341,7 @@ const struct iwl_cfg killer1550s_2ac_cfg_qu_b0_jf_b0 = { · 59 unmodified lines
328341 };
329342
330343 const struct iwl_cfg killer1650s_2ax_cfg_qu_b0_hr_b0 = {
331− .name = "Killer(R) Wireless-AX 1650i Wireless Network Adapter (22560NGW)",
344+ .name = "Killer(R) Wi-Fi 6 AX1650i 160MHz Wireless Network Adapter (201NGW)",
332345 .fw_name_pre = IWL_22000_QU_B_HR_B_FW_PRE,
333346 IWL_DEVICE_22500,
334347 /*
@@ -340,7 +353,7 @@ const struct iwl_cfg killer1650s_2ax_cfg_qu_b0_hr_b0 = { · 5 unmodified lines
340353 };
341354
342355 const struct iwl_cfg killer1650i_2ax_cfg_qu_b0_hr_b0 = {
343− .name = "Killer(R) Wireless-AX 1650s Wireless Network Adapter (22560D2W)",
356+ .name = "Killer(R) Wi-Fi 6 AX1650s 160MHz Wireless Network Adapter (201D2W)",
344357 .fw_name_pre = IWL_22000_QU_B_HR_B_FW_PRE,
345358 IWL_DEVICE_22500,
346359 /*
@@ -444,6 +457,7 @@ MODULE_FIRMWARE(IWL_22000_HR_B_QNJ_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX)); · 97 unmodified lines
444457 MODULE_FIRMWARE(IWL_22000_HR_A0_QNJ_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
445458 MODULE_FIRMWARE(IWL_22000_SU_Z0_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
446459 MODULE_FIRMWARE(IWL_QU_B_JF_B_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
460+MODULE_FIRMWARE(IWL_QUZ_A_HR_B_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
447461 MODULE_FIRMWARE(IWL_QNJ_B_JF_B_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
448462 MODULE_FIRMWARE(IWL_CC_A_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
449463 MODULE_FIRMWARE(IWL_22000_SO_A_JF_B_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));
drivers/net/wireless/intel/iwlwifi/fw/dbg.c+8−26
@@ -1614,6 +1614,7 @@ iwl_dump_ini_mem(struct iwl_fw_runtime *fwrt, · 1613 unmodified lines
16141614 if (!range) {
16151615 IWL_ERR(fwrt, "Failed to fill region header: id=%d, type=%d\n",
16161616 le32_to_cpu(reg->region_id), type);
1617+ memset(*data, 0, le32_to_cpu((*data)->len));
16171618 return;
16181619 }
16191620
@@ -1623,6 +1624,7 @@ iwl_dump_ini_mem(struct iwl_fw_runtime *fwrt, · 3 unmodified lines
16231624 if (range_size < 0) {
16241625 IWL_ERR(fwrt, "Failed to dump region: id=%d, type=%d\n",
16251626 le32_to_cpu(reg->region_id), type);
1627+ memset(*data, 0, le32_to_cpu((*data)->len));
16261628 return;
16271629 }
16281630 range = range + range_size;
@@ -1807,12 +1809,12 @@ _iwl_fw_error_ini_dump(struct iwl_fw_runtime *fwrt, · 178 unmodified lines
18071809
18081810 trigger = fwrt->dump.active_trigs[id].trig;
18091811
1810− size = sizeof(*dump_file);
1811− size += iwl_fw_ini_get_trigger_len(fwrt, trigger);
1812−
1812+ size = iwl_fw_ini_get_trigger_len(fwrt, trigger);
18131813 if (!size)
18141814 return NULL;
18151815
1816+ size += sizeof(*dump_file);
1817+
18161818 dump_file = vzalloc(size);
18171819 if (!dump_file)
18181820 return NULL;
@@ -1942,14 +1944,10 @@ int iwl_fw_dbg_error_collect(struct iwl_fw_runtime *fwrt, · 123 unmodified lines
19421944 iwl_dump_error_desc->len = 0;
19431945
19441946 ret = iwl_fw_dbg_collect_desc(fwrt, iwl_dump_error_desc, false, 0);
1945− if (ret) {
1947+ if (ret)
19461948 kfree(iwl_dump_error_desc);
1947− } else {
1948− set_bit(STATUS_FW_WAIT_DUMP, &fwrt->trans->status);
1949−
1950− /* trigger nmi to halt the fw */
1951− iwl_force_nmi(fwrt->trans);
1952− }
1949+ else
1950+ iwl_trans_sync_nmi(fwrt->trans);
19531951
19541952 return ret;
19551953 }
@@ -2489,22 +2487,6 @@ IWL_EXPORT_SYMBOL(iwl_fw_dbg_apply_point); · 533 unmodified lines
24892487
24902488 void iwl_fwrt_stop_device(struct iwl_fw_runtime *fwrt)
24912489 {
2492− /* if the wait event timeout elapses instead of wake up then
2493− * the driver did not receive NMI interrupt and can not assume the FW
2494− * is halted
2495− */
2496− int ret = wait_event_timeout(fwrt->trans->fw_halt_waitq,
2497− !test_bit(STATUS_FW_WAIT_DUMP,
2498− &fwrt->trans->status),
2499− msecs_to_jiffies(2000));
2500− if (!ret) {
2501− /* failed to receive NMI interrupt, assuming the FW is stuck */
2502− set_bit(STATUS_FW_ERROR, &fwrt->trans->status);
2503−
2504− clear_bit(STATUS_FW_WAIT_DUMP, &fwrt->trans->status);
2505− }
2506−
2507− /* Assuming the op mode mutex is held at this point */
25082490 iwl_fw_dbg_collect_sync(fwrt);
25092491
25102492 iwl_trans_stop_device(fwrt->trans);
drivers/net/wireless/intel/iwlwifi/fw/init.c+0−1
@@ -76,7 +76,6 @@ void iwl_fw_runtime_init(struct iwl_fw_runtime *fwrt, struct iwl_trans *trans, · 75 unmodified lines
7676 fwrt->ops_ctx = ops_ctx;
7777 INIT_DELAYED_WORK(&fwrt->dump.wk, iwl_fw_error_dump_wk);
7878 iwl_fwrt_dbgfs_register(fwrt, dbgfs_dir);
79− init_waitqueue_head(&fwrt->trans->fw_halt_waitq);
8079 }
8180 IWL_EXPORT_SYMBOL(iwl_fw_runtime_init);
8281
drivers/net/wireless/intel/iwlwifi/iwl-config.h+2−1
@@ -549,8 +549,9 @@ extern const struct iwl_cfg iwl22000_2ac_cfg_hr; · 548 unmodified lines
549549 extern const struct iwl_cfg iwl22000_2ac_cfg_hr_cdb;
550550 extern const struct iwl_cfg iwl22000_2ac_cfg_jf;
551551 extern const struct iwl_cfg iwl_ax101_cfg_qu_hr;
552+extern const struct iwl_cfg iwl_ax101_cfg_quz_hr;
552553 extern const struct iwl_cfg iwl22000_2ax_cfg_hr;
553−extern const struct iwl_cfg iwl22260_2ax_cfg;
554+extern const struct iwl_cfg iwl_ax200_cfg_cc;
554555 extern const struct iwl_cfg killer1650s_2ax_cfg_qu_b0_hr_b0;
555556 extern const struct iwl_cfg killer1650i_2ax_cfg_qu_b0_hr_b0;
556557 extern const struct iwl_cfg killer1650x_2ax_cfg;
drivers/net/wireless/intel/iwlwifi/iwl-csr.h+1−0
@@ -327,6 +327,7 @@ enum { · 326 unmodified lines
327327 #define CSR_HW_REV_TYPE_NONE (0x00001F0)
328328 #define CSR_HW_REV_TYPE_QNJ (0x0000360)
329329 #define CSR_HW_REV_TYPE_QNJ_B0 (0x0000364)
330+#define CSR_HW_REV_TYPE_QUZ (0x0000354)
330331 #define CSR_HW_REV_TYPE_HR_CDB (0x0000340)
331332 #define CSR_HW_REV_TYPE_SO (0x0000370)
332333 #define CSR_HW_REV_TYPE_TY (0x0000420)
drivers/net/wireless/intel/iwlwifi/iwl-trans.h+6−6
@@ -338,7 +338,6 @@ enum iwl_d3_status { · 337 unmodified lines
338338 * are sent
339339 * @STATUS_TRANS_IDLE: the trans is idle - general commands are not to be sent
340340 * @STATUS_TRANS_DEAD: trans is dead - avoid any read/write operation
341− * @STATUS_FW_WAIT_DUMP: if set, wait until cleared before collecting dump
342341 */
343342 enum iwl_trans_status {
344343 STATUS_SYNC_HCMD_ACTIVE,
@@ -351,7 +350,6 @@ enum iwl_trans_status { · 6 unmodified lines
351350 STATUS_TRANS_GOING_IDLE,
352351 STATUS_TRANS_IDLE,
353352 STATUS_TRANS_DEAD,
354− STATUS_FW_WAIT_DUMP,
355353 };
356354
357355 static inline int
@@ -618,6 +616,7 @@ struct iwl_trans_ops { · 260 unmodified lines
618616 struct iwl_trans_dump_data *(*dump_data)(struct iwl_trans *trans,
619617 u32 dump_mask);
620618 void (*debugfs_cleanup)(struct iwl_trans *trans);
619+ void (*sync_nmi)(struct iwl_trans *trans);
621620 };
622621
623622 /**
@@ -831,7 +830,6 @@ struct iwl_trans { · 207 unmodified lines
831830 u32 lmac_error_event_table[2];
832831 u32 umac_error_event_table;
833832 unsigned int error_event_table_tlv_status;
834− wait_queue_head_t fw_halt_waitq;
835833
836834 /* pointer to trans specific struct */
837835 /*Ensure that this pointer will always be aligned to sizeof pointer */
@@ -1239,10 +1237,12 @@ static inline void iwl_trans_fw_error(struct iwl_trans *trans) · 401 unmodified lines
12391237 /* prevent double restarts due to the same erroneous FW */
12401238 if (!test_and_set_bit(STATUS_FW_ERROR, &trans->status))
12411239 iwl_op_mode_nic_error(trans->op_mode);
1240+}
12421241
1243− if (test_and_clear_bit(STATUS_FW_WAIT_DUMP, &trans->status))
1244− wake_up(&trans->fw_halt_waitq);
1245−
1242+static inline void iwl_trans_sync_nmi(struct iwl_trans *trans)
1243+{
1244+ if (trans->ops->sync_nmi)
1245+ trans->ops->sync_nmi(trans);
12461246 }
12471247
12481248 /*****************************************************
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c+22−49
@@ -2714,9 +2714,6 @@ static void iwl_mvm_stop_ap_ibss(struct ieee80211_hw *hw, · 2713 unmodified lines
27142714
27152715 iwl_mvm_mac_ctxt_remove(mvm, vif);
27162716
2717− kfree(mvmvif->ap_wep_key);
2718− mvmvif->ap_wep_key = NULL;
2719−
27202717 mutex_unlock(&mvm->mutex);
27212718 }
27222719
@@ -3183,24 +3180,7 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw, · 460 unmodified lines
31833180 ret = iwl_mvm_update_sta(mvm, vif, sta);
31843181 } else if (old_state == IEEE80211_STA_ASSOC &&
31853182 new_state == IEEE80211_STA_AUTHORIZED) {
3186− /* if wep is used, need to set the key for the station now */
3187− if (vif->type == NL80211_IFTYPE_AP && mvmvif->ap_wep_key) {
3188− mvm_sta->wep_key =
3189− kmemdup(mvmvif->ap_wep_key,
3190− sizeof(*mvmvif->ap_wep_key) +
3191− mvmvif->ap_wep_key->keylen,
3192− GFP_KERNEL);
3193− if (!mvm_sta->wep_key) {
3194− ret = -ENOMEM;
3195− goto out_unlock;
3196− }
3197−
3198− ret = iwl_mvm_set_sta_key(mvm, vif, sta,
3199− mvm_sta->wep_key,
3200− STA_KEY_IDX_INVALID);
3201− } else {
3202− ret = 0;
3203− }
3183+ ret = 0;
32043184
32053185 /* we don't support TDLS during DCM */
32063186 if (iwl_mvm_phy_ctx_count(mvm) > 1)
@@ -3242,17 +3222,6 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw, · 35 unmodified lines
32423222 NL80211_TDLS_DISABLE_LINK);
32433223 }
32443224
3245− /* Remove STA key if this is an AP using WEP */
3246− if (vif->type == NL80211_IFTYPE_AP && mvmvif->ap_wep_key) {
3247− int rm_ret = iwl_mvm_remove_sta_key(mvm, vif, sta,
3248− mvm_sta->wep_key);
3249−
3250− if (!ret)
3251− ret = rm_ret;
3252− kfree(mvm_sta->wep_key);
3253− mvm_sta->wep_key = NULL;
3254− }
3255−
32563225 if (unlikely(ret &&
32573226 test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED,
32583227 &mvm->status)))
@@ -3289,6 +3258,13 @@ static void iwl_mvm_sta_rc_update(struct ieee80211_hw *hw, · 30 unmodified lines
32893258 struct ieee80211_sta *sta, u32 changed)
32903259 {
32913260 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
3261+ struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
3262+
3263+ if (changed & (IEEE80211_RC_BW_CHANGED |
3264+ IEEE80211_RC_SUPP_RATES_CHANGED |
3265+ IEEE80211_RC_NSS_CHANGED))
3266+ iwl_mvm_rs_rate_init(mvm, sta, mvmvif->phy_ctxt->channel->band,
3267+ true);
32923268
32933269 if (vif->type == NL80211_IFTYPE_STATION &&
32943270 changed & IEEE80211_RC_NSS_CHANGED)
@@ -3439,20 +3415,12 @@ static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, · 144 unmodified lines
34393415 break;
34403416 case WLAN_CIPHER_SUITE_WEP40:
34413417 case WLAN_CIPHER_SUITE_WEP104:
3442− if (vif->type == NL80211_IFTYPE_AP) {
3443− struct iwl_mvm_vif *mvmvif =
3444− iwl_mvm_vif_from_mac80211(vif);
3445−
3446− mvmvif->ap_wep_key = kmemdup(key,
3447− sizeof(*key) + key->keylen,
3448− GFP_KERNEL);
3449− if (!mvmvif->ap_wep_key)
3450− return -ENOMEM;
3451− }
3452−
3453− if (vif->type != NL80211_IFTYPE_STATION)
3454− return 0;
3455− break;
3418+ if (vif->type == NL80211_IFTYPE_STATION)
3419+ break;
3420+ if (iwl_mvm_has_new_tx_api(mvm))
3421+ return -EOPNOTSUPP;
3422+ /* support HW crypto on TX */
3423+ return 0;
34563424 default:
34573425 /* currently FW supports only one optional cipher scheme */
34583426 if (hw->n_cipher_schemes &&
@@ -3540,12 +3508,17 @@ static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, · 81 unmodified lines
35403508 ret = iwl_mvm_set_sta_key(mvm, vif, sta, key, key_offset);
35413509 if (ret) {
35423510 IWL_WARN(mvm, "set key failed\n");
3511+ key->hw_key_idx = STA_KEY_IDX_INVALID;
35433512 /*
35443513 * can't add key for RX, but we don't need it
3545− * in the device for TX so still return 0
3514+ * in the device for TX so still return 0,
3515+ * unless we have new TX API where we cannot
3516+ * put key material into the TX_CMD
35463517 */
3547− key->hw_key_idx = STA_KEY_IDX_INVALID;
3548− ret = 0;
3518+ if (iwl_mvm_has_new_tx_api(mvm))
3519+ ret = -EOPNOTSUPP;
3520+ else
3521+ ret = 0;
35493522 }
35503523
35513524 break;
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h+0−1
@@ -498,7 +498,6 @@ struct iwl_mvm_vif { · 497 unmodified lines
498498 netdev_features_t features;
499499
500500 struct iwl_probe_resp_data __rcu *probe_resp_data;
501− struct ieee80211_key_conf *ap_wep_key;
502501 };
503502
504503 static inline struct iwl_mvm_vif *
drivers/net/wireless/intel/iwlwifi/mvm/sta.c+4−39
@@ -8,7 +8,7 @@ · 7 unmodified lines
88 * Copyright(c) 2012 - 2015 Intel Corporation. All rights reserved.
99 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
1010 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
11− * Copyright(c) 2018 Intel Corporation
11+ * Copyright(c) 2018 - 2019 Intel Corporation
1212 *
1313 * This program is free software; you can redistribute it and/or modify
1414 * it under the terms of version 2 of the GNU General Public License as
@@ -31,7 +31,7 @@ · 16 unmodified lines
3131 * Copyright(c) 2012 - 2015 Intel Corporation. All rights reserved.
3232 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
3333 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
34− * Copyright(c) 2018 Intel Corporation
34+ * Copyright(c) 2018 - 2019 Intel Corporation
3535 * All rights reserved.
3636 *
3737 * Redistribution and use in source and binary forms, with or without
@@ -1399,7 +1399,9 @@ void iwl_mvm_add_new_dqa_stream_wk(struct work_struct *wk) · 1361 unmodified lines
13991399
14001400 iwl_mvm_sta_alloc_queue(mvm, txq->sta, txq->ac, tid);
14011401 list_del_init(&mvmtxq->list);
1402+ local_bh_disable();
14021403 iwl_mvm_mac_itxq_xmit(mvm->hw, txq);
1404+ local_bh_enable();
14031405 }
14041406
14051407 mutex_unlock(&mvm->mutex);
@@ -2333,21 +2335,6 @@ int iwl_mvm_add_mcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) · 927 unmodified lines
23332335 iwl_mvm_enable_txq(mvm, NULL, mvmvif->cab_queue, 0, &cfg,
23342336 timeout);
23352337
2336− if (mvmvif->ap_wep_key) {
2337− u8 key_offset = iwl_mvm_set_fw_key_idx(mvm);
2338−
2339− __set_bit(key_offset, mvm->fw_key_table);
2340−
2341− if (key_offset == STA_KEY_IDX_INVALID)
2342− return -ENOSPC;
2343−
2344− ret = iwl_mvm_send_sta_key(mvm, mvmvif->mcast_sta.sta_id,
2345− mvmvif->ap_wep_key, true, 0, NULL, 0,
2346− key_offset, 0);
2347− if (ret)
2348− return ret;
2349− }
2350−
23512338 return 0;
23522339 }
23532340
@@ -2419,28 +2406,6 @@ int iwl_mvm_rm_mcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) · 65 unmodified lines
24192406
24202407 iwl_mvm_disable_txq(mvm, NULL, mvmvif->cab_queue, 0, 0);
24212408
2422− if (mvmvif->ap_wep_key) {
2423− int i;
2424−
2425− if (!__test_and_clear_bit(mvmvif->ap_wep_key->hw_key_idx,
2426− mvm->fw_key_table)) {
2427− IWL_ERR(mvm, "offset %d not used in fw key table.\n",
2428− mvmvif->ap_wep_key->hw_key_idx);
2429− return -ENOENT;
2430− }
2431−
2432− /* track which key was deleted last */
2433− for (i = 0; i < STA_KEY_MAX_NUM; i++) {
2434− if (mvm->fw_key_deleted[i] < U8_MAX)
2435− mvm->fw_key_deleted[i]++;
2436− }
2437− mvm->fw_key_deleted[mvmvif->ap_wep_key->hw_key_idx] = 0;
2438− ret = __iwl_mvm_remove_sta_key(mvm, mvmvif->mcast_sta.sta_id,
2439− mvmvif->ap_wep_key, true);
2440− if (ret)
2441− return ret;
2442− }
2443−
24442409 ret = iwl_mvm_rm_sta_common(mvm, mvmvif->mcast_sta.sta_id);
24452410 if (ret)
24462411 IWL_WARN(mvm, "Failed sending remove station\n");
drivers/net/wireless/intel/iwlwifi/mvm/sta.h+2−5
@@ -8,7 +8,7 @@ · 7 unmodified lines
88 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
99 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
1010 * Copyright(c) 2015 - 2016 Intel Deutschland GmbH
11− * Copyright(c) 2018 Intel Corporation
11+ * Copyright(c) 2018 - 2019 Intel Corporation
1212 *
1313 * This program is free software; you can redistribute it and/or modify
1414 * it under the terms of version 2 of the GNU General Public License as
@@ -31,7 +31,7 @@ · 16 unmodified lines
3131 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
3232 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
3333 * Copyright(c) 2015 - 2016 Intel Deutschland GmbH
34− * Copyright(c) 2018 Intel Corporation
34+ * Copyright(c) 2018 - 2019 Intel Corporation
3535 * All rights reserved.
3636 *
3737 * Redistribution and use in source and binary forms, with or without
@@ -394,7 +394,6 @@ struct iwl_mvm_rxq_dup_data { · 356 unmodified lines
394394 * the BA window. To be used for UAPSD only.
395395 * @ptk_pn: per-queue PTK PN data structures
396396 * @dup_data: per queue duplicate packet detection data
397− * @wep_key: used in AP mode. Is a duplicate of the WEP key.
398397 * @deferred_traffic_tid_map: indication bitmap of deferred traffic per-TID
399398 * @tx_ant: the index of the antenna to use for data tx to this station. Only
400399 * used during connection establishment (e.g. for the 4 way handshake
@@ -426,8 +425,6 @@ struct iwl_mvm_sta { · 25 unmodified lines
426425 struct iwl_mvm_key_pn __rcu *ptk_pn[4];
427426 struct iwl_mvm_rxq_dup_data *dup_data;
428427
429− struct ieee80211_key_conf *wep_key;
430−
431428 u8 reserved_queue;
432429
433430 /* Temporary, until the new TLC will control the Tx protection */
drivers/net/wireless/intel/iwlwifi/pcie/drv.c+7−6
@@ -953,14 +953,15 @@ static const struct pci_device_id iwl_hw_card_ids[] = { · 952 unmodified lines
953953 {IWL_PCI_DEVICE(0xA0F0, 0x1652, killer1650i_2ax_cfg_qu_b0_hr_b0)},
954954 {IWL_PCI_DEVICE(0xA0F0, 0x4070, iwl_ax101_cfg_qu_hr)},
955955
956− {IWL_PCI_DEVICE(0x2723, 0x0080, iwl22260_2ax_cfg)},
957− {IWL_PCI_DEVICE(0x2723, 0x0084, iwl22260_2ax_cfg)},
958− {IWL_PCI_DEVICE(0x2723, 0x0088, iwl22260_2ax_cfg)},
959− {IWL_PCI_DEVICE(0x2723, 0x008C, iwl22260_2ax_cfg)},
956+ {IWL_PCI_DEVICE(0x2723, 0x0080, iwl_ax200_cfg_cc)},
957+ {IWL_PCI_DEVICE(0x2723, 0x0084, iwl_ax200_cfg_cc)},
958+ {IWL_PCI_DEVICE(0x2723, 0x0088, iwl_ax200_cfg_cc)},
959+ {IWL_PCI_DEVICE(0x2723, 0x008C, iwl_ax200_cfg_cc)},
960960 {IWL_PCI_DEVICE(0x2723, 0x1653, killer1650w_2ax_cfg)},
961961 {IWL_PCI_DEVICE(0x2723, 0x1654, killer1650x_2ax_cfg)},
962− {IWL_PCI_DEVICE(0x2723, 0x4080, iwl22260_2ax_cfg)},
963− {IWL_PCI_DEVICE(0x2723, 0x4088, iwl22260_2ax_cfg)},
962+ {IWL_PCI_DEVICE(0x2723, 0x2080, iwl_ax200_cfg_cc)},
963+ {IWL_PCI_DEVICE(0x2723, 0x4080, iwl_ax200_cfg_cc)},
964+ {IWL_PCI_DEVICE(0x2723, 0x4088, iwl_ax200_cfg_cc)},
964965
965966 {IWL_PCI_DEVICE(0x1a56, 0x1653, killer1650w_2ax_cfg)},
966967 {IWL_PCI_DEVICE(0x1a56, 0x1654, killer1650x_2ax_cfg)},
drivers/net/wireless/intel/iwlwifi/pcie/internal.h+1−1
@@ -1043,7 +1043,7 @@ static inline bool iwl_pcie_dbg_on(struct iwl_trans *trans) · 1042 unmodified lines
10431043
10441044 void iwl_trans_pcie_rf_kill(struct iwl_trans *trans, bool state);
10451045 void iwl_trans_pcie_dump_regs(struct iwl_trans *trans);
1046−void iwl_trans_sync_nmi(struct iwl_trans *trans);
1046+void iwl_trans_pcie_sync_nmi(struct iwl_trans *trans);
10471047
10481048 #ifdef CONFIG_IWLWIFI_DEBUGFS
10491049 int iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans);
drivers/net/wireless/intel/iwlwifi/pcie/trans.c+8−3
@@ -3318,7 +3318,8 @@ static void iwl_trans_pcie_resume(struct iwl_trans *trans) · 3317 unmodified lines
33183318 .unref = iwl_trans_pcie_unref, \
33193319 .dump_data = iwl_trans_pcie_dump_data, \
33203320 .d3_suspend = iwl_trans_pcie_d3_suspend, \
3321− .d3_resume = iwl_trans_pcie_d3_resume
3321+ .d3_resume = iwl_trans_pcie_d3_resume, \
3322+ .sync_nmi = iwl_trans_pcie_sync_nmi
33223323
33233324 #ifdef CONFIG_PM_SLEEP
33243325 #define IWL_TRANS_PM_OPS \
@@ -3542,6 +3543,10 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, · 217 unmodified lines
35423543 }
35433544 } else if (cfg == &iwl_ax101_cfg_qu_hr) {
35443545 if (CSR_HW_RF_ID_TYPE_CHIP_ID(trans->hw_rf_id) ==
3546+ CSR_HW_RF_ID_TYPE_CHIP_ID(CSR_HW_RF_ID_TYPE_HR) &&
3547+ trans->hw_rev == CSR_HW_REV_TYPE_QNJ_B0) {
3548+ trans->cfg = &iwl22000_2ax_cfg_qnj_hr_b0;
3549+ } else if (CSR_HW_RF_ID_TYPE_CHIP_ID(trans->hw_rf_id) ==
35453550 CSR_HW_RF_ID_TYPE_CHIP_ID(CSR_HW_RF_ID_TYPE_HR)) {
35463551 trans->cfg = &iwl_ax101_cfg_qu_hr;
35473552 } else if (CSR_HW_RF_ID_TYPE_CHIP_ID(trans->hw_rf_id) ==
@@ -3560,7 +3565,7 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, · 12 unmodified lines
35603565 }
35613566 } else if (CSR_HW_RF_ID_TYPE_CHIP_ID(trans->hw_rf_id) ==
35623567 CSR_HW_RF_ID_TYPE_CHIP_ID(CSR_HW_RF_ID_TYPE_HR) &&
3563− (trans->cfg != &iwl22260_2ax_cfg ||
3568+ (trans->cfg != &iwl_ax200_cfg_cc ||
35643569 trans->hw_rev == CSR_HW_REV_TYPE_QNJ_B0)) {
35653570 u32 hw_status;
35663571
@@ -3637,7 +3642,7 @@ out_no_pci: · 70 unmodified lines
36373642 return ERR_PTR(ret);
36383643 }
36393644
3640−void iwl_trans_sync_nmi(struct iwl_trans *trans)
3645+void iwl_trans_pcie_sync_nmi(struct iwl_trans *trans)
36413646 {
36423647 unsigned long timeout = jiffies + IWL_TRANS_NMI_TIMEOUT;
36433648
drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c+1−1
@@ -965,7 +965,7 @@ static int iwl_pcie_gen2_send_hcmd_sync(struct iwl_trans *trans, · 964 unmodified lines
965965 cmd_str);
966966 ret = -ETIMEDOUT;
967967
968− iwl_trans_sync_nmi(trans);
968+ iwl_trans_pcie_sync_nmi(trans);
969969 goto cancel;
970970 }
971971
drivers/net/wireless/intel/iwlwifi/pcie/tx.c+1−1
@@ -1960,7 +1960,7 @@ static int iwl_pcie_send_hcmd_sync(struct iwl_trans *trans, · 1959 unmodified lines
19601960 iwl_get_cmd_string(trans, cmd->id));
19611961 ret = -ETIMEDOUT;
19621962
1963− iwl_trans_sync_nmi(trans);
1963+ iwl_trans_pcie_sync_nmi(trans);
19641964 goto cancel;
19651965 }
19661966
drivers/net/wireless/mac80211_hwsim.c+15−4
@@ -2644,7 +2644,7 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, · 2643 unmodified lines
26442644 enum nl80211_band band;
26452645 const struct ieee80211_ops *ops = &mac80211_hwsim_ops;
26462646 struct net *net;
2647− int idx;
2647+ int idx, i;
26482648 int n_limits = 0;
26492649
26502650 if (WARN_ON(param->channels > 1 && !param->use_chanctx))
@@ -2768,12 +2768,23 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, · 117 unmodified lines
27682768 goto failed_hw;
27692769 }
27702770
2771+ data->if_combination.max_interfaces = 0;
2772+ for (i = 0; i < n_limits; i++)
2773+ data->if_combination.max_interfaces +=
2774+ data->if_limits[i].max;
2775+
27712776 data->if_combination.n_limits = n_limits;
2772− data->if_combination.max_interfaces = 2048;
27732777 data->if_combination.limits = data->if_limits;
27742778
2775− hw->wiphy->iface_combinations = &data->if_combination;
2776− hw->wiphy->n_iface_combinations = 1;
2779+ /*
2780+ * If we actually were asked to support combinations,
2781+ * advertise them - if there's only a single thing like
2782+ * only IBSS then don't advertise it as combinations.
2783+ */
2784+ if (data->if_combination.max_interfaces > 1) {
2785+ hw->wiphy->iface_combinations = &data->if_combination;
2786+ hw->wiphy->n_iface_combinations = 1;
2787+ }
27772788
27782789 if (param->ciphers) {
27792790 memcpy(data->ciphers, param->ciphers,
drivers/net/wireless/mediatek/mt76/mt7603/init.c+2−0
@@ -510,6 +510,8 @@ int mt7603_register_device(struct mt7603_dev *dev) · 509 unmodified lines
510510 bus_ops->rmw = mt7603_rmw;
511511 dev->mt76.bus = bus_ops;
512512
513+ spin_lock_init(&dev->ps_lock);
514+
513515 INIT_DELAYED_WORK(&dev->mac_work, mt7603_mac_work);
514516 tasklet_init(&dev->pre_tbtt_tasklet, mt7603_pre_tbtt_tasklet,
515517 (unsigned long)dev);
drivers/net/wireless/mediatek/mt76/mt7603/mac.c+14−39
@@ -343,7 +343,7 @@ void mt7603_mac_rx_ba_reset(struct mt7603_dev *dev, void *addr, u8 tid) · 342 unmodified lines
343343 MT_BA_CONTROL_1_RESET));
344344 }
345345
346−void mt7603_mac_tx_ba_reset(struct mt7603_dev *dev, int wcid, int tid, int ssn,
346+void mt7603_mac_tx_ba_reset(struct mt7603_dev *dev, int wcid, int tid,
347347 int ba_size)
348348 {
349349 u32 addr = mt7603_wtbl2_addr(wcid);
@@ -358,43 +358,6 @@ void mt7603_mac_tx_ba_reset(struct mt7603_dev *dev, int wcid, int tid, int ssn, · 8 unmodified lines
358358 mt76_clear(dev, addr + (15 * 4), tid_mask);
359359 return;
360360 }
361− mt76_poll(dev, MT_WTBL_UPDATE, MT_WTBL_UPDATE_BUSY, 0, 5000);
362−
363− mt7603_mac_stop(dev);
364− switch (tid) {
365− case 0:
366− mt76_rmw_field(dev, addr + (2 * 4), MT_WTBL2_W2_TID0_SN, ssn);
367− break;
368− case 1:
369− mt76_rmw_field(dev, addr + (2 * 4), MT_WTBL2_W2_TID1_SN, ssn);
370− break;
371− case 2:
372− mt76_rmw_field(dev, addr + (2 * 4), MT_WTBL2_W2_TID2_SN_LO,
373− ssn);
374− mt76_rmw_field(dev, addr + (3 * 4), MT_WTBL2_W3_TID2_SN_HI,
375− ssn >> 8);
376− break;
377− case 3:
378− mt76_rmw_field(dev, addr + (3 * 4), MT_WTBL2_W3_TID3_SN, ssn);
379− break;
380− case 4:
381− mt76_rmw_field(dev, addr + (3 * 4), MT_WTBL2_W3_TID4_SN, ssn);
382− break;
383− case 5:
384− mt76_rmw_field(dev, addr + (3 * 4), MT_WTBL2_W3_TID5_SN_LO,
385− ssn);
386− mt76_rmw_field(dev, addr + (4 * 4), MT_WTBL2_W4_TID5_SN_HI,
387− ssn >> 4);
388− break;
389− case 6:
390− mt76_rmw_field(dev, addr + (4 * 4), MT_WTBL2_W4_TID6_SN, ssn);
391− break;
392− case 7:
393− mt76_rmw_field(dev, addr + (4 * 4), MT_WTBL2_W4_TID7_SN, ssn);
394− break;
395− }
396− mt7603_wtbl_update(dev, wcid, MT_WTBL_UPDATE_WTBL2);
397− mt7603_mac_start(dev);
398361
399362 for (i = 7; i > 0; i--) {
400363 if (ba_size >= MT_AGG_SIZE_LIMIT(i))
@@ -827,6 +790,7 @@ mt7603_mac_write_txwi(struct mt7603_dev *dev, __le32 *txwi, · 426 unmodified lines
827790 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
828791 struct ieee80211_tx_rate *rate = &info->control.rates[0];
829792 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
793+ struct ieee80211_bar *bar = (struct ieee80211_bar *)skb->data;
830794 struct ieee80211_vif *vif = info->control.vif;
831795 struct mt7603_vif *mvif;
832796 int wlan_idx;
@@ -834,6 +798,7 @@ mt7603_mac_write_txwi(struct mt7603_dev *dev, __le32 *txwi, · 1 unmodified line
834798 int tx_count = 8;
835799 u8 frame_type, frame_subtype;
836800 u16 fc = le16_to_cpu(hdr->frame_control);
801+ u16 seqno = 0;
837802 u8 vif_idx = 0;
838803 u32 val;
839804 u8 bw;
@@ -919,7 +884,17 @@ mt7603_mac_write_txwi(struct mt7603_dev *dev, __le32 *txwi, · 79 unmodified lines
919884 tx_count = 0x1f;
920885
921886 val = FIELD_PREP(MT_TXD3_REM_TX_COUNT, tx_count) |
922− FIELD_PREP(MT_TXD3_SEQ, le16_to_cpu(hdr->seq_ctrl));
887+ MT_TXD3_SN_VALID;
888+
889+ if (ieee80211_is_data_qos(hdr->frame_control))
890+ seqno = le16_to_cpu(hdr->seq_ctrl);
891+ else if (ieee80211_is_back_req(hdr->frame_control))
892+ seqno = le16_to_cpu(bar->start_seq_num);
893+ else
894+ val &= ~MT_TXD3_SN_VALID;
895+
896+ val |= FIELD_PREP(MT_TXD3_SEQ, seqno >> 4);
897+
923898 txwi[3] = cpu_to_le32(val);
924899
925900 if (key) {
drivers/net/wireless/mediatek/mt76/mt7603/main.c+4−4
@@ -372,7 +372,7 @@ mt7603_sta_ps(struct mt76_dev *mdev, struct ieee80211_sta *sta, bool ps) · 371 unmodified lines
372372 struct mt7603_sta *msta = (struct mt7603_sta *)sta->drv_priv;
373373 struct sk_buff_head list;
374374
375− mt76_stop_tx_queues(&dev->mt76, sta, false);
375+ mt76_stop_tx_queues(&dev->mt76, sta, true);
376376 mt7603_wtbl_set_ps(dev, msta, ps);
377377 if (ps)
378378 return;
@@ -584,13 +584,13 @@ mt7603_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, · 205 unmodified lines
584584 case IEEE80211_AMPDU_TX_OPERATIONAL:
585585 mtxq->aggr = true;
586586 mtxq->send_bar = false;
587− mt7603_mac_tx_ba_reset(dev, msta->wcid.idx, tid, *ssn, ba_size);
587+ mt7603_mac_tx_ba_reset(dev, msta->wcid.idx, tid, ba_size);
588588 break;
589589 case IEEE80211_AMPDU_TX_STOP_FLUSH:
590590 case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT:
591591 mtxq->aggr = false;
592592 ieee80211_send_bar(vif, sta->addr, tid, mtxq->agg_ssn);
593− mt7603_mac_tx_ba_reset(dev, msta->wcid.idx, tid, *ssn, -1);
593+ mt7603_mac_tx_ba_reset(dev, msta->wcid.idx, tid, -1);
594594 break;
595595 case IEEE80211_AMPDU_TX_START:
596596 mtxq->agg_ssn = *ssn << 4;
@@ -598,7 +598,7 @@ mt7603_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, · 1 unmodified line
598598 break;
599599 case IEEE80211_AMPDU_TX_STOP_CONT:
600600 mtxq->aggr = false;
601− mt7603_mac_tx_ba_reset(dev, msta->wcid.idx, tid, *ssn, -1);
601+ mt7603_mac_tx_ba_reset(dev, msta->wcid.idx, tid, -1);
602602 ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
603603 break;
604604 }
drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h+1−1
@@ -200,7 +200,7 @@ void mt7603_beacon_set_timer(struct mt7603_dev *dev, int idx, int intval); · 199 unmodified lines
200200 int mt7603_mac_fill_rx(struct mt7603_dev *dev, struct sk_buff *skb);
201201 void mt7603_mac_add_txs(struct mt7603_dev *dev, void *data);
202202 void mt7603_mac_rx_ba_reset(struct mt7603_dev *dev, void *addr, u8 tid);
203−void mt7603_mac_tx_ba_reset(struct mt7603_dev *dev, int wcid, int tid, int ssn,
203+void mt7603_mac_tx_ba_reset(struct mt7603_dev *dev, int wcid, int tid,
204204 int ba_size);
205205
206206 void mt7603_pse_client_reset(struct mt7603_dev *dev);
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c+8−6
@@ -466,7 +466,6 @@ void mt76x02_send_tx_status(struct mt76x02_dev *dev, · 465 unmodified lines
466466 return;
467467
468468 rcu_read_lock();
469− mt76_tx_status_lock(mdev, &list);
470469
471470 if (stat->wcid < ARRAY_SIZE(dev->mt76.wcid))
472471 wcid = rcu_dereference(dev->mt76.wcid[stat->wcid]);
@@ -479,6 +478,8 @@ void mt76x02_send_tx_status(struct mt76x02_dev *dev, · 6 unmodified lines
479478 drv_priv);
480479 }
481480
481+ mt76_tx_status_lock(mdev, &list);
482+
482483 if (wcid) {
483484 if (stat->pktid >= MT_PACKET_ID_FIRST)
484485 status.skb = mt76_tx_status_skb_get(mdev, wcid,
@@ -498,7 +499,9 @@ void mt76x02_send_tx_status(struct mt76x02_dev *dev, · 13 unmodified lines
498499 if (*update == 0 && stat_val == stat_cache &&
499500 stat->wcid == msta->status.wcid && msta->n_frames < 32) {
500501 msta->n_frames++;
501− goto out;
502+ mt76_tx_status_unlock(mdev, &list);
503+ rcu_read_unlock();
504+ return;
502505 }
503506
504507 mt76x02_mac_fill_tx_status(dev, status.info, &msta->status,
@@ -514,11 +517,10 @@ void mt76x02_send_tx_status(struct mt76x02_dev *dev, · 9 unmodified lines
514517
515518 if (status.skb)
516519 mt76_tx_status_skb_done(mdev, status.skb, &list);
517− else
518− ieee80211_tx_status_ext(mt76_hw(dev), &status);
519−
520−out:
521520 mt76_tx_status_unlock(mdev, &list);
521+
522+ if (!status.skb)
523+ ieee80211_tx_status_ext(mt76_hw(dev), &status);
522524 rcu_read_unlock();
523525 }
524526
drivers/net/wireless/ralink/rt2x00/rt2x00.h+0−1
@@ -673,7 +673,6 @@ enum rt2x00_state_flags { · 672 unmodified lines
673673 CONFIG_CHANNEL_HT40,
674674 CONFIG_POWERSAVING,
675675 CONFIG_HT_DISABLED,
676− CONFIG_QOS_DISABLED,
677676 CONFIG_MONITORING,
678677
679678 /*
drivers/net/wireless/ralink/rt2x00/rt2x00mac.c+0−10
@@ -642,18 +642,8 @@ void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw, · 641 unmodified lines
642642 rt2x00dev->intf_associated--;
643643
644644 rt2x00leds_led_assoc(rt2x00dev, !!rt2x00dev->intf_associated);
645−
646− clear_bit(CONFIG_QOS_DISABLED, &rt2x00dev->flags);
647645 }
648646
649− /*
650− * Check for access point which do not support 802.11e . We have to
651− * generate data frames sequence number in S/W for such AP, because
652− * of H/W bug.
653− */
654− if (changes & BSS_CHANGED_QOS && !bss_conf->qos)
655− set_bit(CONFIG_QOS_DISABLED, &rt2x00dev->flags);
656−
657647 /*
658648 * When the erp information has changed, we should perform
659649 * additional configuration steps. For all other changes we are done.
drivers/net/wireless/ralink/rt2x00/rt2x00queue.c+9−6
@@ -201,15 +201,18 @@ static void rt2x00queue_create_tx_descriptor_seq(struct rt2x00_dev *rt2x00dev, · 200 unmodified lines
201201 if (!rt2x00_has_cap_flag(rt2x00dev, REQUIRE_SW_SEQNO)) {
202202 /*
203203 * rt2800 has a H/W (or F/W) bug, device incorrectly increase
204− * seqno on retransmited data (non-QOS) frames. To workaround
205− * the problem let's generate seqno in software if QOS is
206− * disabled.
204+ * seqno on retransmitted data (non-QOS) and management frames.
205+ * To workaround the problem let's generate seqno in software.
206+ * Except for beacons which are transmitted periodically by H/W
207+ * hence hardware has to assign seqno for them.
207208 */
208− if (test_bit(CONFIG_QOS_DISABLED, &rt2x00dev->flags))
209− __clear_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags);
210− else
209+ if (ieee80211_is_beacon(hdr->frame_control)) {
210+ __set_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags);
211211 /* H/W will generate sequence number */
212212 return;
213+ }
214+
215+ __clear_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags);
213216 }
214217
215218 /*
drivers/nvdimm/btt_devs.c+13−5
@@ -198,14 +198,15 @@ static struct device *__nd_btt_create(struct nd_region *nd_region, · 197 unmodified lines
198198 return NULL;
199199
200200 nd_btt->id = ida_simple_get(&nd_region->btt_ida, 0, 0, GFP_KERNEL);
201− if (nd_btt->id < 0) {
202− kfree(nd_btt);
203− return NULL;
204− }
201+ if (nd_btt->id < 0)
202+ goto out_nd_btt;
205203
206204 nd_btt->lbasize = lbasize;
207− if (uuid)
205+ if (uuid) {
208206 uuid = kmemdup(uuid, 16, GFP_KERNEL);
207+ if (!uuid)
208+ goto out_put_id;
209+ }
209210 nd_btt->uuid = uuid;
210211 dev = &nd_btt->dev;
211212 dev_set_name(dev, "btt%d.%d", nd_region->id, nd_btt->id);
@@ -220,6 +221,13 @@ static struct device *__nd_btt_create(struct nd_region *nd_region, · 8 unmodified lines
220221 return NULL;
221222 }
222223 return dev;
224+
225+out_put_id:
226+ ida_simple_remove(&nd_region->btt_ida, nd_btt->id);
227+
228+out_nd_btt:
229+ kfree(nd_btt);
230+ return NULL;
223231 }
224232
225233 struct device *nd_btt_create(struct nd_region *nd_region)
drivers/nvdimm/namespace_devs.c+4−1
@@ -2249,9 +2249,12 @@ static struct device *create_namespace_blk(struct nd_region *nd_region, · 2248 unmodified lines
22492249 if (!nsblk->uuid)
22502250 goto blk_err;
22512251 memcpy(name, nd_label->name, NSLABEL_NAME_LEN);
2252− if (name[0])
2252+ if (name[0]) {
22532253 nsblk->alt_name = kmemdup(name, NSLABEL_NAME_LEN,
22542254 GFP_KERNEL);
2255+ if (!nsblk->alt_name)
2256+ goto blk_err;
2257+ }
22552258 res = nsblk_add_resource(nd_region, ndd, nsblk,
22562259 __le64_to_cpu(nd_label->dpa));
22572260 if (!res)
drivers/nvdimm/pmem.c+4−4
@@ -113,13 +113,13 @@ static void write_pmem(void *pmem_addr, struct page *page, · 112 unmodified lines
113113
114114 while (len) {
115115 mem = kmap_atomic(page);
116− chunk = min_t(unsigned int, len, PAGE_SIZE);
116+ chunk = min_t(unsigned int, len, PAGE_SIZE - off);
117117 memcpy_flushcache(pmem_addr, mem + off, chunk);
118118 kunmap_atomic(mem);
119119 len -= chunk;
120120 off = 0;
121121 page++;
122− pmem_addr += PAGE_SIZE;
122+ pmem_addr += chunk;
123123 }
124124 }
125125
@@ -132,7 +132,7 @@ static blk_status_t read_pmem(struct page *page, unsigned int off, · 6 unmodified lines
132132
133133 while (len) {
134134 mem = kmap_atomic(page);
135− chunk = min_t(unsigned int, len, PAGE_SIZE);
135+ chunk = min_t(unsigned int, len, PAGE_SIZE - off);
136136 rem = memcpy_mcsafe(mem + off, pmem_addr, chunk);
137137 kunmap_atomic(mem);
138138 if (rem)
@@ -140,7 +140,7 @@ static blk_status_t read_pmem(struct page *page, unsigned int off, · 1 unmodified line
140140 len -= chunk;
141141 off = 0;
142142 page++;
143− pmem_addr += PAGE_SIZE;
143+ pmem_addr += chunk;
144144 }
145145 return BLK_STS_OK;
146146 }
drivers/nvdimm/security.c+73−45
@@ -22,6 +22,8 @@ static bool key_revalidate = true; · 21 unmodified lines
2222 module_param(key_revalidate, bool, 0444);
2323 MODULE_PARM_DESC(key_revalidate, "Require key validation at init.");
2424
25+static const char zero_key[NVDIMM_PASSPHRASE_LEN];
26+
2527 static void *key_data(struct key *key)
2628 {
2729 struct encrypted_key_payload *epayload = dereference_key_locked(key);
@@ -75,6 +77,16 @@ static struct key *nvdimm_request_key(struct nvdimm *nvdimm) · 47 unmodified lines
7577 return key;
7678 }
7779
80+static const void *nvdimm_get_key_payload(struct nvdimm *nvdimm,
81+ struct key **key)
82+{
83+ *key = nvdimm_request_key(nvdimm);
84+ if (!*key)
85+ return zero_key;
86+
87+ return key_data(*key);
88+}
89+
7890 static struct key *nvdimm_lookup_user_key(struct nvdimm *nvdimm,
7991 key_serial_t id, int subclass)
8092 {
@@ -105,36 +117,57 @@ static struct key *nvdimm_lookup_user_key(struct nvdimm *nvdimm, · 24 unmodified lines
105117 return key;
106118 }
107119
108−static struct key *nvdimm_key_revalidate(struct nvdimm *nvdimm)
120+static const void *nvdimm_get_user_key_payload(struct nvdimm *nvdimm,
121+ key_serial_t id, int subclass, struct key **key)
122+{
123+ *key = NULL;
124+ if (id == 0) {
125+ if (subclass == NVDIMM_BASE_KEY)
126+ return zero_key;
127+ else
128+ return NULL;
129+ }
130+
131+ *key = nvdimm_lookup_user_key(nvdimm, id, subclass);
132+ if (!*key)
133+ return NULL;
134+
135+ return key_data(*key);
136+}
137+
138+
139+static int nvdimm_key_revalidate(struct nvdimm *nvdimm)
109140 {
110141 struct key *key;
111142 int rc;
143+ const void *data;
112144
113145 if (!nvdimm->sec.ops->change_key)
114− return NULL;
146+ return -EOPNOTSUPP;
115147
116− key = nvdimm_request_key(nvdimm);
117− if (!key)
118− return NULL;
148+ data = nvdimm_get_key_payload(nvdimm, &key);
119149
120150 /*
121151 * Send the same key to the hardware as new and old key to
122152 * verify that the key is good.
123153 */
124− rc = nvdimm->sec.ops->change_key(nvdimm, key_data(key),
125− key_data(key), NVDIMM_USER);
154+ rc = nvdimm->sec.ops->change_key(nvdimm, data, data, NVDIMM_USER);
126155 if (rc < 0) {
127156 nvdimm_put_key(key);
128− key = NULL;
157+ return rc;
129158 }
130− return key;
159+
160+ nvdimm_put_key(key);
161+ nvdimm->sec.state = nvdimm_security_state(nvdimm, NVDIMM_USER);
162+ return 0;
131163 }
132164
133165 static int __nvdimm_security_unlock(struct nvdimm *nvdimm)
134166 {
135167 struct device *dev = &nvdimm->dev;
136168 struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(dev);
137− struct key *key = NULL;
169+ struct key *key;
170+ const void *data;
138171 int rc;
139172
140173 /* The bus lock should be held at the top level of the call stack */
@@ -160,16 +193,11 @@ static int __nvdimm_security_unlock(struct nvdimm *nvdimm) · 19 unmodified lines
160193 if (!key_revalidate)
161194 return 0;
162195
163− key = nvdimm_key_revalidate(nvdimm);
164− if (!key)
165− return nvdimm_security_freeze(nvdimm);
196+ return nvdimm_key_revalidate(nvdimm);
166197 } else
167− key = nvdimm_request_key(nvdimm);
198+ data = nvdimm_get_key_payload(nvdimm, &key);
168199
169− if (!key)
170− return -ENOKEY;
171−
172− rc = nvdimm->sec.ops->unlock(nvdimm, key_data(key));
200+ rc = nvdimm->sec.ops->unlock(nvdimm, data);
173201 dev_dbg(dev, "key: %d unlock: %s\n", key_serial(key),
174202 rc == 0 ? "success" : "fail");
175203
@@ -195,6 +223,7 @@ int nvdimm_security_disable(struct nvdimm *nvdimm, unsigned int keyid) · 19 unmodified lines
195223 struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(dev);
196224 struct key *key;
197225 int rc;
226+ const void *data;
198227
199228 /* The bus lock should be held at the top level of the call stack */
200229 lockdep_assert_held(&nvdimm_bus->reconfig_mutex);
@@ -214,11 +243,12 @@ int nvdimm_security_disable(struct nvdimm *nvdimm, unsigned int keyid) · 13 unmodified lines
214243 return -EBUSY;
215244 }
216245
217− key = nvdimm_lookup_user_key(nvdimm, keyid, NVDIMM_BASE_KEY);
218− if (!key)
246+ data = nvdimm_get_user_key_payload(nvdimm, keyid,
247+ NVDIMM_BASE_KEY, &key);
248+ if (!data)
219249 return -ENOKEY;
220250
221− rc = nvdimm->sec.ops->disable(nvdimm, key_data(key));
251+ rc = nvdimm->sec.ops->disable(nvdimm, data);
222252 dev_dbg(dev, "key: %d disable: %s\n", key_serial(key),
223253 rc == 0 ? "success" : "fail");
224254
@@ -235,6 +265,7 @@ int nvdimm_security_update(struct nvdimm *nvdimm, unsigned int keyid, · 10 unmodified lines
235265 struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(dev);
236266 struct key *key, *newkey;
237267 int rc;
268+ const void *data, *newdata;
238269
239270 /* The bus lock should be held at the top level of the call stack */
240271 lockdep_assert_held(&nvdimm_bus->reconfig_mutex);
@@ -249,22 +280,19 @@ int nvdimm_security_update(struct nvdimm *nvdimm, unsigned int keyid, · 8 unmodified lines
249280 return -EIO;
250281 }
251282
252− if (keyid == 0)
253− key = NULL;
254− else {
255− key = nvdimm_lookup_user_key(nvdimm, keyid, NVDIMM_BASE_KEY);
256− if (!key)
257− return -ENOKEY;
258− }
283+ data = nvdimm_get_user_key_payload(nvdimm, keyid,
284+ NVDIMM_BASE_KEY, &key);
285+ if (!data)
286+ return -ENOKEY;
259287
260− newkey = nvdimm_lookup_user_key(nvdimm, new_keyid, NVDIMM_NEW_KEY);
261− if (!newkey) {
288+ newdata = nvdimm_get_user_key_payload(nvdimm, new_keyid,
289+ NVDIMM_NEW_KEY, &newkey);
290+ if (!newdata) {
262291 nvdimm_put_key(key);
263292 return -ENOKEY;
264293 }
265294
266− rc = nvdimm->sec.ops->change_key(nvdimm, key ? key_data(key) : NULL,
267− key_data(newkey), pass_type);
295+ rc = nvdimm->sec.ops->change_key(nvdimm, data, newdata, pass_type);
268296 dev_dbg(dev, "key: %d %d update%s: %s\n",
269297 key_serial(key), key_serial(newkey),
270298 pass_type == NVDIMM_MASTER ? "(master)" : "(user)",
@@ -286,8 +314,9 @@ int nvdimm_security_erase(struct nvdimm *nvdimm, unsigned int keyid, · 15 unmodified lines
286314 {
287315 struct device *dev = &nvdimm->dev;
288316 struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(dev);
289− struct key *key;
317+ struct key *key = NULL;
290318 int rc;
319+ const void *data;
291320
292321 /* The bus lock should be held at the top level of the call stack */
293322 lockdep_assert_held(&nvdimm_bus->reconfig_mutex);
@@ -319,11 +348,12 @@ int nvdimm_security_erase(struct nvdimm *nvdimm, unsigned int keyid, · 25 unmodified lines
319348 return -EOPNOTSUPP;
320349 }
321350
322− key = nvdimm_lookup_user_key(nvdimm, keyid, NVDIMM_BASE_KEY);
323− if (!key)
351+ data = nvdimm_get_user_key_payload(nvdimm, keyid,
352+ NVDIMM_BASE_KEY, &key);
353+ if (!data)
324354 return -ENOKEY;
325355
326− rc = nvdimm->sec.ops->erase(nvdimm, key_data(key), pass_type);
356+ rc = nvdimm->sec.ops->erase(nvdimm, data, pass_type);
327357 dev_dbg(dev, "key: %d erase%s: %s\n", key_serial(key),
328358 pass_type == NVDIMM_MASTER ? "(master)" : "(user)",
329359 rc == 0 ? "success" : "fail");
@@ -337,8 +367,9 @@ int nvdimm_security_overwrite(struct nvdimm *nvdimm, unsigned int keyid) · 7 unmodified lines
337367 {
338368 struct device *dev = &nvdimm->dev;
339369 struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(dev);
340− struct key *key;
370+ struct key *key = NULL;
341371 int rc;
372+ const void *data;
342373
343374 /* The bus lock should be held at the top level of the call stack */
344375 lockdep_assert_held(&nvdimm_bus->reconfig_mutex);
@@ -368,15 +399,12 @@ int nvdimm_security_overwrite(struct nvdimm *nvdimm, unsigned int keyid) · 23 unmodified lines
368399 return -EBUSY;
369400 }
370401
371− if (keyid == 0)
372− key = NULL;
373− else {
374− key = nvdimm_lookup_user_key(nvdimm, keyid, NVDIMM_BASE_KEY);
375− if (!key)
376− return -ENOKEY;
377− }
402+ data = nvdimm_get_user_key_payload(nvdimm, keyid,
403+ NVDIMM_BASE_KEY, &key);
404+ if (!data)
405+ return -ENOKEY;
378406
379− rc = nvdimm->sec.ops->overwrite(nvdimm, key ? key_data(key) : NULL);
407+ rc = nvdimm->sec.ops->overwrite(nvdimm, data);
380408 dev_dbg(dev, "key: %d overwrite submission: %s\n", key_serial(key),
381409 rc == 0 ? "success" : "fail");
382410
drivers/nvme/host/core.c+1−1
@@ -288,7 +288,7 @@ bool nvme_cancel_request(struct request *req, void *data, bool reserved) · 287 unmodified lines
288288 "Cancelling I/O %d", req->tag);
289289
290290 nvme_req(req)->status = NVME_SC_ABORT_REQ;
291− blk_mq_complete_request(req);
291+ blk_mq_complete_request_sync(req);
292292 return true;
293293 }
294294 EXPORT_SYMBOL_GPL(nvme_cancel_request);
drivers/nvme/host/fc.c+15−5
@@ -1845,7 +1845,7 @@ nvme_fc_init_queue(struct nvme_fc_ctrl *ctrl, int idx) · 1844 unmodified lines
18451845 memset(queue, 0, sizeof(*queue));
18461846 queue->ctrl = ctrl;
18471847 queue->qnum = idx;
1848− atomic_set(&queue->csn, 1);
1848+ atomic_set(&queue->csn, 0);
18491849 queue->dev = ctrl->dev;
18501850
18511851 if (idx > 0)
@@ -1887,7 +1887,7 @@ nvme_fc_free_queue(struct nvme_fc_queue *queue) · 35 unmodified lines
18871887 */
18881888
18891889 queue->connection_id = 0;
1890− atomic_set(&queue->csn, 1);
1890+ atomic_set(&queue->csn, 0);
18911891 }
18921892
18931893 static void
@@ -2183,7 +2183,6 @@ nvme_fc_start_fcp_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue, · 289 unmodified lines
21832183 {
21842184 struct nvme_fc_cmd_iu *cmdiu = &op->cmd_iu;
21852185 struct nvme_command *sqe = &cmdiu->sqe;
2186− u32 csn;
21872186 int ret, opstate;
21882187
21892188 /*
@@ -2198,8 +2197,6 @@ nvme_fc_start_fcp_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue, · 8 unmodified lines
21982197
21992198 /* format the FC-NVME CMD IU and fcp_req */
22002199 cmdiu->connection_id = cpu_to_be64(queue->connection_id);
2201− csn = atomic_inc_return(&queue->csn);
2202− cmdiu->csn = cpu_to_be32(csn);
22032200 cmdiu->data_len = cpu_to_be32(data_len);
22042201 switch (io_dir) {
22052202 case NVMEFC_FCP_WRITE:
@@ -2257,11 +2254,24 @@ nvme_fc_start_fcp_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue, · 51 unmodified lines
22572254 if (!(op->flags & FCOP_FLAGS_AEN))
22582255 blk_mq_start_request(op->rq);
22592256
2257+ cmdiu->csn = cpu_to_be32(atomic_inc_return(&queue->csn));
22602258 ret = ctrl->lport->ops->fcp_io(&ctrl->lport->localport,
22612259 &ctrl->rport->remoteport,
22622260 queue->lldd_handle, &op->fcp_req);
22632261
22642262 if (ret) {
2263+ /*
2264+ * If the lld fails to send the command is there an issue with
2265+ * the csn value? If the command that fails is the Connect,
2266+ * no - as the connection won't be live. If it is a command
2267+ * post-connect, it's possible a gap in csn may be created.
2268+ * Does this matter? As Linux initiators don't send fused
2269+ * commands, no. The gap would exist, but as there's nothing
2270+ * that depends on csn order to be delivered on the target
2271+ * side, it shouldn't hurt. It would be difficult for a
2272+ * target to even detect the csn gap as it has no idea when the
2273+ * cmd with the csn was supposed to arrive.
2274+ */
22652275 opstate = atomic_xchg(&op->state, FCPOP_STATE_COMPLETE);
22662276 __nvme_fc_fcpop_chk_teardowns(ctrl, op, opstate);
22672277
drivers/nvme/target/admin-cmd.c+5−0
@@ -24,6 +24,11 @@ u32 nvmet_get_log_page_len(struct nvme_command *cmd) · 23 unmodified lines
2424 return len;
2525 }
2626
27+u64 nvmet_get_log_page_offset(struct nvme_command *cmd)
28+{
29+ return le64_to_cpu(cmd->get_log_page.lpo);
30+}
31+
2732 static void nvmet_execute_get_log_page_noop(struct nvmet_req *req)
2833 {
2934 nvmet_req_complete(req, nvmet_zero_sgl(req, 0, req->data_len));
drivers/nvme/target/discovery.c+45−23
@@ -131,54 +131,76 @@ static void nvmet_set_disc_traddr(struct nvmet_req *req, struct nvmet_port *port · 130 unmodified lines
131131 memcpy(traddr, port->disc_addr.traddr, NVMF_TRADDR_SIZE);
132132 }
133133
134+static size_t discovery_log_entries(struct nvmet_req *req)
135+{
136+ struct nvmet_ctrl *ctrl = req->sq->ctrl;
137+ struct nvmet_subsys_link *p;
138+ struct nvmet_port *r;
139+ size_t entries = 0;
140+
141+ list_for_each_entry(p, &req->port->subsystems, entry) {
142+ if (!nvmet_host_allowed(p->subsys, ctrl->hostnqn))
143+ continue;
144+ entries++;
145+ }
146+ list_for_each_entry(r, &req->port->referrals, entry)
147+ entries++;
148+ return entries;
149+}
150+
134151 static void nvmet_execute_get_disc_log_page(struct nvmet_req *req)
135152 {
136153 const int entry_size = sizeof(struct nvmf_disc_rsp_page_entry);
137154 struct nvmet_ctrl *ctrl = req->sq->ctrl;
138155 struct nvmf_disc_rsp_page_hdr *hdr;
156+ u64 offset = nvmet_get_log_page_offset(req->cmd);
139157 size_t data_len = nvmet_get_log_page_len(req->cmd);
140− size_t alloc_len = max(data_len, sizeof(*hdr));
141− int residual_len = data_len - sizeof(*hdr);
158+ size_t alloc_len;
142159 struct nvmet_subsys_link *p;
143160 struct nvmet_port *r;
144161 u32 numrec = 0;
145162 u16 status = 0;
163+ void *buffer;
164+
165+ /* Spec requires dword aligned offsets */
166+ if (offset & 0x3) {
167+ status = NVME_SC_INVALID_FIELD | NVME_SC_DNR;
168+ goto out;
169+ }
146170
147171 /*
148172 * Make sure we're passing at least a buffer of response header size.
149173 * If host provided data len is less than the header size, only the
150174 * number of bytes requested by host will be sent to host.
151175 */
152− hdr = kzalloc(alloc_len, GFP_KERNEL);
153− if (!hdr) {
176+ down_read(&nvmet_config_sem);
177+ alloc_len = sizeof(*hdr) + entry_size * discovery_log_entries(req);
178+ buffer = kzalloc(alloc_len, GFP_KERNEL);
179+ if (!buffer) {
180+ up_read(&nvmet_config_sem);
154181 status = NVME_SC_INTERNAL;
155182 goto out;
156183 }
157184
158− down_read(&nvmet_config_sem);
185+ hdr = buffer;
159186 list_for_each_entry(p, &req->port->subsystems, entry) {
187+ char traddr[NVMF_TRADDR_SIZE];
188+
160189 if (!nvmet_host_allowed(p->subsys, ctrl->hostnqn))
161190 continue;
162− if (residual_len >= entry_size) {
163− char traddr[NVMF_TRADDR_SIZE];
164−
165− nvmet_set_disc_traddr(req, req->port, traddr);
166− nvmet_format_discovery_entry(hdr, req->port,
167− p->subsys->subsysnqn, traddr,
168− NVME_NQN_NVME, numrec);
169− residual_len -= entry_size;
170− }
191+
192+ nvmet_set_disc_traddr(req, req->port, traddr);
193+ nvmet_format_discovery_entry(hdr, req->port,
194+ p->subsys->subsysnqn, traddr,
195+ NVME_NQN_NVME, numrec);
171196 numrec++;
172197 }
173198
174199 list_for_each_entry(r, &req->port->referrals, entry) {
175− if (residual_len >= entry_size) {
176− nvmet_format_discovery_entry(hdr, r,
177− NVME_DISC_SUBSYS_NAME,
178− r->disc_addr.traddr,
179− NVME_NQN_DISC, numrec);
180− residual_len -= entry_size;
181− }
200+ nvmet_format_discovery_entry(hdr, r,
201+ NVME_DISC_SUBSYS_NAME,
202+ r->disc_addr.traddr,
203+ NVME_NQN_DISC, numrec);
182204 numrec++;
183205 }
184206
@@ -190,8 +212,8 @@ static void nvmet_execute_get_disc_log_page(struct nvmet_req *req) · 5 unmodified lines
190212
191213 up_read(&nvmet_config_sem);
192214
193− status = nvmet_copy_to_sgl(req, 0, hdr, data_len);
194− kfree(hdr);
215+ status = nvmet_copy_to_sgl(req, 0, buffer + offset, data_len);
216+ kfree(buffer);
195217 out:
196218 nvmet_req_complete(req, status);
197219 }
drivers/nvme/target/nvmet.h+1−0
@@ -428,6 +428,7 @@ u16 nvmet_copy_from_sgl(struct nvmet_req *req, off_t off, void *buf, · 427 unmodified lines
428428 u16 nvmet_zero_sgl(struct nvmet_req *req, off_t off, size_t len);
429429
430430 u32 nvmet_get_log_page_len(struct nvme_command *cmd);
431+u64 nvmet_get_log_page_offset(struct nvme_command *cmd);
431432
432433 extern struct list_head *nvmet_ports;
433434 void nvmet_port_disc_changed(struct nvmet_port *port,
drivers/parisc/iosapic.c+5−1
@@ -157,8 +157,12 @@ · 156 unmodified lines
157157 #define DBG_IRT(x...)
158158 #endif
159159
160+#ifdef CONFIG_64BIT
161+#define COMPARE_IRTE_ADDR(irte, hpa) ((irte)->dest_iosapic_addr == (hpa))
162+#else
160163 #define COMPARE_IRTE_ADDR(irte, hpa) \
161− ((irte)->dest_iosapic_addr == F_EXTEND(hpa))
164+ ((irte)->dest_iosapic_addr == ((hpa) | 0xffffffff00000000ULL))
165+#endif
162166
163167 #define IOSAPIC_REG_SELECT 0x00
164168 #define IOSAPIC_REG_WINDOW 0x10
drivers/pci/hotplug/pciehp_ctrl.c+4−0
@@ -115,6 +115,10 @@ static void remove_board(struct controller *ctrl, bool safe_removal) · 114 unmodified lines
115115 * removed from the slot/adapter.
116116 */
117117 msleep(1000);
118+
119+ /* Ignore link or presence changes caused by power off */
120+ atomic_and(~(PCI_EXP_SLTSTA_DLLSC | PCI_EXP_SLTSTA_PDC),
121+ &ctrl->pending_events);
118122 }
119123
120124 /* turn off Green LED */
drivers/pci/quirks.c+2−0
@@ -3877,6 +3877,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9128, · 3876 unmodified lines
38773877 /* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c14 */
38783878 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9130,
38793879 quirk_dma_func1_alias);
3880+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9170,
3881+ quirk_dma_func1_alias);
38803882 /* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c47 + c57 */
38813883 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9172,
38823884 quirk_dma_func1_alias);
drivers/platform/x86/pmc_atom.c+21−0
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717
1818 #include <linux/debugfs.h>
1919 #include <linux/device.h>
20+#include <linux/dmi.h>
2021 #include <linux/init.h>
2122 #include <linux/io.h>
2223 #include <linux/platform_data/x86/clk-pmc-atom.h>
@@ -391,11 +392,27 @@ static int pmc_dbgfs_register(struct pmc_dev *pmc) · 368 unmodified lines
391392 }
392393 #endif /* CONFIG_DEBUG_FS */
393394
395+/*
396+ * Some systems need one or more of their pmc_plt_clks to be
397+ * marked as critical.
398+ */
399+static const struct dmi_system_id critclk_systems[] = {
400+ {
401+ .ident = "MPL CEC1x",
402+ .matches = {
403+ DMI_MATCH(DMI_SYS_VENDOR, "MPL AG"),
404+ DMI_MATCH(DMI_PRODUCT_NAME, "CEC10 Family"),
405+ },
406+ },
407+ { /*sentinel*/ }
408+};
409+
394410 static int pmc_setup_clks(struct pci_dev *pdev, void __iomem *pmc_regmap,
395411 const struct pmc_data *pmc_data)
396412 {
397413 struct platform_device *clkdev;
398414 struct pmc_clk_data *clk_data;
415+ const struct dmi_system_id *d = dmi_first_match(critclk_systems);
399416
400417 clk_data = kzalloc(sizeof(*clk_data), GFP_KERNEL);
401418 if (!clk_data)
@@ -403,6 +420,10 @@ static int pmc_setup_clks(struct pci_dev *pdev, void __iomem *pmc_regmap, · 1 unmodified line
403420
404421 clk_data->base = pmc_regmap; /* offset is added by client */
405422 clk_data->clks = pmc_data->clks;
423+ if (d) {
424+ clk_data->critical = true;
425+ pr_info("%s critclks quirk enabled\n", d->ident);
426+ }
406427
407428 clkdev = platform_device_register_data(&pdev->dev, "clk-pmc-atom",
408429 PLATFORM_DEVID_NONE,
drivers/power/supply/goldfish_battery.c+1−1
@@ -1,4 +1,4 @@
1−// SPDX-License-Identifier: GPL
1+// SPDX-License-Identifier: GPL-2.0
22 /*
33 * Power supply driver for the goldfish emulator
44 *
drivers/reset/reset-meson-audio-arb.c+1−0
@@ -130,6 +130,7 @@ static int meson_audio_arb_probe(struct platform_device *pdev) · 129 unmodified lines
130130 arb->rstc.nr_resets = ARRAY_SIZE(axg_audio_arb_reset_bits);
131131 arb->rstc.ops = &meson_audio_arb_rstc_ops;
132132 arb->rstc.of_node = dev->of_node;
133+ arb->rstc.owner = THIS_MODULE;
133134
134135 /*
135136 * Enable general :
drivers/rtc/Kconfig+2−2
@@ -667,9 +667,9 @@ config RTC_DRV_S5M · 666 unmodified lines
667667 will be called rtc-s5m.
668668
669669 config RTC_DRV_SD3078
670− tristate "ZXW Crystal SD3078"
670+ tristate "ZXW Shenzhen whwave SD3078"
671671 help
672− If you say yes here you get support for the ZXW Crystal
672+ If you say yes here you get support for the ZXW Shenzhen whwave
673673 SD3078 RTC chips.
674674
675675 This driver can also be built as a module. If so, the module
drivers/rtc/rtc-cros-ec.c+2−2
@@ -298,7 +298,7 @@ static int cros_ec_rtc_suspend(struct device *dev) · 297 unmodified lines
298298 struct cros_ec_rtc *cros_ec_rtc = dev_get_drvdata(&pdev->dev);
299299
300300 if (device_may_wakeup(dev))
301− enable_irq_wake(cros_ec_rtc->cros_ec->irq);
301+ return enable_irq_wake(cros_ec_rtc->cros_ec->irq);
302302
303303 return 0;
304304 }
@@ -309,7 +309,7 @@ static int cros_ec_rtc_resume(struct device *dev) · 4 unmodified lines
309309 struct cros_ec_rtc *cros_ec_rtc = dev_get_drvdata(&pdev->dev);
310310
311311 if (device_may_wakeup(dev))
312− disable_irq_wake(cros_ec_rtc->cros_ec->irq);
312+ return disable_irq_wake(cros_ec_rtc->cros_ec->irq);
313313
314314 return 0;
315315 }
drivers/rtc/rtc-da9063.c+7−0
@@ -480,6 +480,13 @@ static int da9063_rtc_probe(struct platform_device *pdev) · 479 unmodified lines
480480 da9063_data_to_tm(data, &rtc->alarm_time, rtc);
481481 rtc->rtc_sync = false;
482482
483+ /*
484+ * TODO: some models have alarms on a minute boundary but still support
485+ * real hardware interrupts. Add this once the core supports it.
486+ */
487+ if (config->rtc_data_start != RTC_SEC)
488+ rtc->rtc_dev->uie_unsupported = 1;
489+
483490 irq_alarm = platform_get_irq_byname(pdev, "ALARM");
484491 ret = devm_request_threaded_irq(&pdev->dev, irq_alarm, NULL,
485492 da9063_alarm_event,
drivers/rtc/rtc-sh.c+1−1
@@ -374,7 +374,7 @@ static int sh_rtc_set_time(struct device *dev, struct rtc_time *tm) · 373 unmodified lines
374374 static inline int sh_rtc_read_alarm_value(struct sh_rtc *rtc, int reg_off)
375375 {
376376 unsigned int byte;
377− int value = 0xff; /* return 0xff for ignored values */
377+ int value = -1; /* return -1 for ignored values */
378378
379379 byte = readb(rtc->regbase + reg_off);
380380 if (byte & AR_ENB) {
drivers/s390/block/dasd_eckd.c+3−3
@@ -2004,14 +2004,14 @@ static int dasd_eckd_end_analysis(struct dasd_block *block) · 2003 unmodified lines
20042004 blk_per_trk = recs_per_track(&private->rdc_data, 0, block->bp_block);
20052005
20062006 raw:
2007− block->blocks = (private->real_cyl *
2007+ block->blocks = ((unsigned long) private->real_cyl *
20082008 private->rdc_data.trk_per_cyl *
20092009 blk_per_trk);
20102010
20112011 dev_info(&device->cdev->dev,
2012− "DASD with %d KB/block, %d KB total size, %d KB/track, "
2012+ "DASD with %u KB/block, %lu KB total size, %u KB/track, "
20132013 "%s\n", (block->bp_block >> 10),
2014− ((private->real_cyl *
2014+ (((unsigned long) private->real_cyl *
20152015 private->rdc_data.trk_per_cyl *
20162016 blk_per_trk * (block->bp_block >> 9)) >> 1),
20172017 ((blk_per_trk * block->bp_block) >> 10),
drivers/s390/char/con3270.c+1−1
@@ -629,7 +629,7 @@ con3270_init(void) · 628 unmodified lines
629629 (void (*)(unsigned long)) con3270_read_tasklet,
630630 (unsigned long) condev->read);
631631
632− raw3270_add_view(&condev->view, &con3270_fn, 1);
632+ raw3270_add_view(&condev->view, &con3270_fn, 1, RAW3270_VIEW_LOCK_IRQ);
633633
634634 INIT_LIST_HEAD(&condev->freemem);
635635 for (i = 0; i < CON3270_STRING_PAGES; i++) {
drivers/s390/char/fs3270.c+2−1
@@ -463,7 +463,8 @@ fs3270_open(struct inode *inode, struct file *filp) · 462 unmodified lines
463463
464464 init_waitqueue_head(&fp->wait);
465465 fp->fs_pid = get_pid(task_pid(current));
466− rc = raw3270_add_view(&fp->view, &fs3270_fn, minor);
466+ rc = raw3270_add_view(&fp->view, &fs3270_fn, minor,
467+ RAW3270_VIEW_LOCK_BH);
467468 if (rc) {
468469 fs3270_free_view(&fp->view);
469470 goto out;
drivers/s390/char/raw3270.c+2−1
@@ -920,7 +920,7 @@ raw3270_deactivate_view(struct raw3270_view *view) · 919 unmodified lines
920920 * Add view to device with minor "minor".
921921 */
922922 int
923−raw3270_add_view(struct raw3270_view *view, struct raw3270_fn *fn, int minor)
923+raw3270_add_view(struct raw3270_view *view, struct raw3270_fn *fn, int minor, int subclass)
924924 {
925925 unsigned long flags;
926926 struct raw3270 *rp;
@@ -942,6 +942,7 @@ raw3270_add_view(struct raw3270_view *view, struct raw3270_fn *fn, int minor) · 15 unmodified lines
942942 view->cols = rp->cols;
943943 view->ascebc = rp->ascebc;
944944 spin_lock_init(&view->lock);
945+ lockdep_set_subclass(&view->lock, subclass);
945946 list_add(&view->list, &rp->view_list);
946947 rc = 0;
947948 spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags);
drivers/s390/char/raw3270.h+3−1
@@ -150,6 +150,8 @@ struct raw3270_fn { · 149 unmodified lines
150150 struct raw3270_view {
151151 struct list_head list;
152152 spinlock_t lock;
153+#define RAW3270_VIEW_LOCK_IRQ 0
154+#define RAW3270_VIEW_LOCK_BH 1
153155 atomic_t ref_count;
154156 struct raw3270 *dev;
155157 struct raw3270_fn *fn;
@@ -158,7 +160,7 @@ struct raw3270_view { · 2 unmodified lines
158160 unsigned char *ascebc; /* ascii -> ebcdic table */
159161 };
160162
161−int raw3270_add_view(struct raw3270_view *, struct raw3270_fn *, int);
163+int raw3270_add_view(struct raw3270_view *, struct raw3270_fn *, int, int);
162164 int raw3270_activate_view(struct raw3270_view *);
163165 void raw3270_del_view(struct raw3270_view *);
164166 void raw3270_deactivate_view(struct raw3270_view *);
drivers/s390/char/tty3270.c+2−1
@@ -980,7 +980,8 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty) · 979 unmodified lines
980980 return PTR_ERR(tp);
981981
982982 rc = raw3270_add_view(&tp->view, &tty3270_fn,
983− tty->index + RAW3270_FIRSTMINOR);
983+ tty->index + RAW3270_FIRSTMINOR,
984+ RAW3270_VIEW_LOCK_BH);
984985 if (rc) {
985986 tty3270_free_view(tp);
986987 return rc;
drivers/s390/crypto/ap_queue.c+1−1
@@ -751,8 +751,8 @@ void ap_queue_prepare_remove(struct ap_queue *aq) · 750 unmodified lines
751751 __ap_flush_queue(aq);
752752 /* set REMOVE state to prevent new messages are queued in */
753753 aq->state = AP_STATE_REMOVE;
754− del_timer_sync(&aq->timeout);
755754 spin_unlock_bh(&aq->lock);
755+ del_timer_sync(&aq->timeout);
756756 }
757757
758758 void ap_queue_remove(struct ap_queue *aq)
drivers/s390/crypto/pkey_api.c+2−1
@@ -51,7 +51,8 @@ static debug_info_t *debug_info; · 50 unmodified lines
5151
5252 static void __init pkey_debug_init(void)
5353 {
54− debug_info = debug_register("pkey", 1, 1, 4 * sizeof(long));
54+ /* 5 arguments per dbf entry (including the format string ptr) */
55+ debug_info = debug_register("pkey", 1, 1, 5 * sizeof(long));
5556 debug_register_view(debug_info, &debug_sprintf_view);
5657 debug_set_level(debug_info, 3);
5758 }
drivers/scsi/aic7xxx/aic7770_osm.c+1−0
@@ -91,6 +91,7 @@ aic7770_probe(struct device *dev) · 90 unmodified lines
9191 ahc = ahc_alloc(&aic7xxx_driver_template, name);
9292 if (ahc == NULL)
9393 return (ENOMEM);
94+ ahc->dev = dev;
9495 error = aic7770_config(ahc, aic7770_ident_table + edev->id.driver_data,
9596 eisaBase);
9697 if (error != 0) {
drivers/scsi/aic7xxx/aic7xxx.h+1−0
@@ -943,6 +943,7 @@ struct ahc_softc { · 942 unmodified lines
943943 * Platform specific device information.
944944 */
945945 ahc_dev_softc_t dev_softc;
946+ struct device *dev;
946947
947948 /*
948949 * Bus specific device information.
drivers/scsi/aic7xxx/aic7xxx_osm.c+4−6
@@ -860,8 +860,8 @@ int · 859 unmodified lines
860860 ahc_dmamem_alloc(struct ahc_softc *ahc, bus_dma_tag_t dmat, void** vaddr,
861861 int flags, bus_dmamap_t *mapp)
862862 {
863− *vaddr = pci_alloc_consistent(ahc->dev_softc,
864− dmat->maxsize, mapp);
863+ /* XXX: check if we really need the GFP_ATOMIC and unwind this mess! */
864+ *vaddr = dma_alloc_coherent(ahc->dev, dmat->maxsize, mapp, GFP_ATOMIC);
865865 if (*vaddr == NULL)
866866 return ENOMEM;
867867 return 0;
@@ -871,8 +871,7 @@ void · 3 unmodified lines
871871 ahc_dmamem_free(struct ahc_softc *ahc, bus_dma_tag_t dmat,
872872 void* vaddr, bus_dmamap_t map)
873873 {
874− pci_free_consistent(ahc->dev_softc, dmat->maxsize,
875− vaddr, map);
874+ dma_free_coherent(ahc->dev, dmat->maxsize, vaddr, map);
876875 }
877876
878877 int
@@ -1123,8 +1122,7 @@ ahc_linux_register_host(struct ahc_softc *ahc, struct scsi_host_template *templa · 244 unmodified lines
11231122
11241123 host->transportt = ahc_linux_transport_template;
11251124
1126− retval = scsi_add_host(host,
1127− (ahc->dev_softc ? &ahc->dev_softc->dev : NULL));
1125+ retval = scsi_add_host(host, ahc->dev);
11281126 if (retval) {
11291127 printk(KERN_WARNING "aic7xxx: scsi_add_host failed\n");
11301128 scsi_host_put(host);
drivers/scsi/aic7xxx/aic7xxx_osm_pci.c+1−0
@@ -250,6 +250,7 @@ ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 249 unmodified lines
250250 }
251251 }
252252 ahc->dev_softc = pci;
253+ ahc->dev = &pci->dev;
253254 error = ahc_pci_config(ahc, entry);
254255 if (error != 0) {
255256 ahc_free(ahc);
drivers/scsi/csiostor/csio_scsi.c+4−1
@@ -1713,8 +1713,11 @@ csio_scsi_err_handler(struct csio_hw *hw, struct csio_ioreq *req) · 1712 unmodified lines
17131713 }
17141714
17151715 out:
1716− if (req->nsge > 0)
1716+ if (req->nsge > 0) {
17171717 scsi_dma_unmap(cmnd);
1718+ if (req->dcopy && (host_status == DID_OK))
1719+ host_status = csio_scsi_copy_to_sgl(hw, req);
1720+ }
17181721
17191722 cmnd->result = (((host_status) << 16) | scsi_status);
17201723 cmnd->scsi_done(cmnd);
drivers/scsi/libfc/fc_rport.c+0−1
@@ -2162,7 +2162,6 @@ static void fc_rport_recv_logo_req(struct fc_lport *lport, struct fc_frame *fp) · 2161 unmodified lines
21622162 FC_RPORT_DBG(rdata, "Received LOGO request while in state %s\n",
21632163 fc_rport_state(rdata));
21642164
2165− rdata->flags &= ~FC_RP_STARTED;
21662165 fc_rport_enter_delete(rdata, RPORT_EV_STOP);
21672166 mutex_unlock(&rdata->rp_mutex);
21682167 kref_put(&rdata->kref, fc_rport_destroy);
drivers/scsi/lpfc/lpfc_scsi.c+3−4
@@ -3878,10 +3878,9 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, · 3877 unmodified lines
38783878 * wake up the thread.
38793879 */
38803880 spin_lock(&lpfc_cmd->buf_lock);
3881− if (unlikely(lpfc_cmd->cur_iocbq.iocb_flag & LPFC_DRIVER_ABORTED)) {
3882− lpfc_cmd->cur_iocbq.iocb_flag &= ~LPFC_DRIVER_ABORTED;
3883− if (lpfc_cmd->waitq)
3884− wake_up(lpfc_cmd->waitq);
3881+ lpfc_cmd->cur_iocbq.iocb_flag &= ~LPFC_DRIVER_ABORTED;
3882+ if (lpfc_cmd->waitq) {
3883+ wake_up(lpfc_cmd->waitq);
38853884 lpfc_cmd->waitq = NULL;
38863885 }
38873886 spin_unlock(&lpfc_cmd->buf_lock);
drivers/scsi/qedi/qedi_main.c+2−5
@@ -1392,10 +1392,8 @@ static void qedi_free_nvm_iscsi_cfg(struct qedi_ctx *qedi) · 1391 unmodified lines
13921392
13931393 static int qedi_alloc_nvm_iscsi_cfg(struct qedi_ctx *qedi)
13941394 {
1395− struct qedi_nvm_iscsi_image nvm_image;
1396−
13971395 qedi->iscsi_image = dma_alloc_coherent(&qedi->pdev->dev,
1398− sizeof(nvm_image),
1396+ sizeof(struct qedi_nvm_iscsi_image),
13991397 &qedi->nvm_buf_dma, GFP_KERNEL);
14001398 if (!qedi->iscsi_image) {
14011399 QEDI_ERR(&qedi->dbg_ctx, "Could not allocate NVM BUF.\n");
@@ -2236,14 +2234,13 @@ static void qedi_boot_release(void *data) · 834 unmodified lines
22362234 static int qedi_get_boot_info(struct qedi_ctx *qedi)
22372235 {
22382236 int ret = 1;
2239− struct qedi_nvm_iscsi_image nvm_image;
22402237
22412238 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
22422239 "Get NVM iSCSI CFG image\n");
22432240 ret = qedi_ops->common->nvm_get_image(qedi->cdev,
22442241 QED_NVM_IMAGE_ISCSI_CFG,
22452242 (char *)qedi->iscsi_image,
2246− sizeof(nvm_image));
2243+ sizeof(struct qedi_nvm_iscsi_image));
22472244 if (ret)
22482245 QEDI_ERR(&qedi->dbg_ctx,
22492246 "Could not get NVM image. ret = %d\n", ret);
drivers/scsi/scsi_devinfo.c+1−0
@@ -238,6 +238,7 @@ static struct { · 237 unmodified lines
238238 {"NETAPP", "Universal Xport", "*", BLIST_NO_ULD_ATTACH},
239239 {"LSI", "Universal Xport", "*", BLIST_NO_ULD_ATTACH},
240240 {"ENGENIO", "Universal Xport", "*", BLIST_NO_ULD_ATTACH},
241+ {"LENOVO", "Universal Xport", "*", BLIST_NO_ULD_ATTACH},
241242 {"SMSC", "USB 2 HS-CF", NULL, BLIST_SPARSELUN | BLIST_INQUIRY_36},
242243 {"SONY", "CD-ROM CDU-8001", NULL, BLIST_BORKEN},
243244 {"SONY", "TSL", NULL, BLIST_FORCELUN}, /* DDS3 & DDS4 autoloaders */
drivers/scsi/scsi_dh.c+1−0
@@ -75,6 +75,7 @@ static const struct scsi_dh_blist scsi_dh_blist[] = { · 74 unmodified lines
7575 {"NETAPP", "INF-01-00", "rdac", },
7676 {"LSI", "INF-01-00", "rdac", },
7777 {"ENGENIO", "INF-01-00", "rdac", },
78+ {"LENOVO", "DE_Series", "rdac", },
7879 {NULL, NULL, NULL },
7980 };
8081
drivers/scsi/scsi_lib.c+5−1
@@ -1706,8 +1706,12 @@ out_put_budget: · 1705 unmodified lines
17061706 ret = BLK_STS_DEV_RESOURCE;
17071707 break;
17081708 default:
1709+ if (unlikely(!scsi_device_online(sdev)))
1710+ scsi_req(req)->result = DID_NO_CONNECT << 16;
1711+ else
1712+ scsi_req(req)->result = DID_ERROR << 16;
17091713 /*
1710− * Make sure to release all allocated ressources when
1714+ * Make sure to release all allocated resources when
17111715 * we hit an error, as we will never see this command
17121716 * again.
17131717 */
drivers/scsi/storvsc_drv.c+12−3
@@ -385,7 +385,7 @@ enum storvsc_request_type { · 384 unmodified lines
385385 * This is the end of Protocol specific defines.
386386 */
387387
388−static int storvsc_ringbuffer_size = (256 * PAGE_SIZE);
388+static int storvsc_ringbuffer_size = (128 * 1024);
389389 static u32 max_outstanding_req_per_channel;
390390
391391 static int storvsc_vcpus_per_sub_channel = 4;
@@ -668,13 +668,22 @@ static void handle_multichannel_storage(struct hv_device *device, int max_chns) · 276 unmodified lines
668668 {
669669 struct device *dev = &device->device;
670670 struct storvsc_device *stor_device;
671− int num_cpus = num_online_cpus();
672671 int num_sc;
673672 struct storvsc_cmd_request *request;
674673 struct vstor_packet *vstor_packet;
675674 int ret, t;
676675
677− num_sc = ((max_chns > num_cpus) ? num_cpus : max_chns);
676+ /*
677+ * If the number of CPUs is artificially restricted, such as
678+ * with maxcpus=1 on the kernel boot line, Hyper-V could offer
679+ * sub-channels >= the number of CPUs. These sub-channels
680+ * should not be created. The primary channel is already created
681+ * and assigned to one CPU, so check against # CPUs - 1.
682+ */
683+ num_sc = min((int)(num_online_cpus() - 1), max_chns);
684+ if (!num_sc)
685+ return;
686+
678687 stor_device = get_out_stor_device(device);
679688 if (!stor_device)
680689 return;
drivers/scsi/virtio_scsi.c+1−0
@@ -793,6 +793,7 @@ static int virtscsi_probe(struct virtio_device *vdev) · 792 unmodified lines
793793
794794 /* We need to know how many queues before we allocate. */
795795 num_queues = virtscsi_config_get(vdev, num_queues) ? : 1;
796+ num_queues = min_t(unsigned int, nr_cpu_ids, num_queues);
796797
797798 num_targets = virtscsi_config_get(vdev, max_target) + 1;
798799
drivers/staging/comedi/drivers/ni_usb6501.c+4−6
@@ -463,10 +463,8 @@ static int ni6501_alloc_usb_buffers(struct comedi_device *dev) · 462 unmodified lines
463463
464464 size = usb_endpoint_maxp(devpriv->ep_tx);
465465 devpriv->usb_tx_buf = kzalloc(size, GFP_KERNEL);
466− if (!devpriv->usb_tx_buf) {
467− kfree(devpriv->usb_rx_buf);
466+ if (!devpriv->usb_tx_buf)
468467 return -ENOMEM;
469− }
470468
471469 return 0;
472470 }
@@ -518,6 +516,9 @@ static int ni6501_auto_attach(struct comedi_device *dev, · 45 unmodified lines
518516 if (!devpriv)
519517 return -ENOMEM;
520518
519+ mutex_init(&devpriv->mut);
520+ usb_set_intfdata(intf, devpriv);
521+
521522 ret = ni6501_find_endpoints(dev);
522523 if (ret)
523524 return ret;
@@ -526,9 +527,6 @@ static int ni6501_auto_attach(struct comedi_device *dev, · 2 unmodified lines
526527 if (ret)
527528 return ret;
528529
529− mutex_init(&devpriv->mut);
530− usb_set_intfdata(intf, devpriv);
531−
532530 ret = comedi_alloc_subdevices(dev, 2);
533531 if (ret)
534532 return ret;
drivers/staging/comedi/drivers/vmk80xx.c+3−5
@@ -682,10 +682,8 @@ static int vmk80xx_alloc_usb_buffers(struct comedi_device *dev) · 681 unmodified lines
682682
683683 size = usb_endpoint_maxp(devpriv->ep_tx);
684684 devpriv->usb_tx_buf = kzalloc(size, GFP_KERNEL);
685− if (!devpriv->usb_tx_buf) {
686− kfree(devpriv->usb_rx_buf);
685+ if (!devpriv->usb_tx_buf)
687686 return -ENOMEM;
688− }
689687
690688 return 0;
691689 }
@@ -800,6 +798,8 @@ static int vmk80xx_auto_attach(struct comedi_device *dev, · 108 unmodified lines
800798
801799 devpriv->model = board->model;
802800
801+ sema_init(&devpriv->limit_sem, 8);
802+
803803 ret = vmk80xx_find_usb_endpoints(dev);
804804 if (ret)
805805 return ret;
@@ -808,8 +808,6 @@ static int vmk80xx_auto_attach(struct comedi_device *dev, · 2 unmodified lines
808808 if (ret)
809809 return ret;
810810
811− sema_init(&devpriv->limit_sem, 8);
812−
813811 usb_set_intfdata(intf, devpriv);
814812
815813 if (devpriv->model == VMK8055_MODEL)
drivers/staging/erofs/data.c+1−1
@@ -298,7 +298,7 @@ submit_bio_retry: · 297 unmodified lines
298298 *last_block = current_block;
299299
300300 /* shift in advance in case of it followed by too many gaps */
301− if (unlikely(bio->bi_vcnt >= bio->bi_max_vecs)) {
301+ if (bio->bi_iter.bi_size >= bio->bi_max_vecs * PAGE_SIZE) {
302302 /* err should reassign to 0 after submitting */
303303 err = 0;
304304 goto submit_bio_out;
drivers/staging/iio/adc/ad7192.c+4−4
@@ -109,10 +109,10 @@ · 108 unmodified lines
109109 #define AD7192_CH_AIN3 BIT(6) /* AIN3 - AINCOM */
110110 #define AD7192_CH_AIN4 BIT(7) /* AIN4 - AINCOM */
111111
112−#define AD7193_CH_AIN1P_AIN2M 0x000 /* AIN1(+) - AIN2(-) */
113−#define AD7193_CH_AIN3P_AIN4M 0x001 /* AIN3(+) - AIN4(-) */
114−#define AD7193_CH_AIN5P_AIN6M 0x002 /* AIN5(+) - AIN6(-) */
115−#define AD7193_CH_AIN7P_AIN8M 0x004 /* AIN7(+) - AIN8(-) */
112+#define AD7193_CH_AIN1P_AIN2M 0x001 /* AIN1(+) - AIN2(-) */
113+#define AD7193_CH_AIN3P_AIN4M 0x002 /* AIN3(+) - AIN4(-) */
114+#define AD7193_CH_AIN5P_AIN6M 0x004 /* AIN5(+) - AIN6(-) */
115+#define AD7193_CH_AIN7P_AIN8M 0x008 /* AIN7(+) - AIN8(-) */
116116 #define AD7193_CH_TEMP 0x100 /* Temp senseor */
117117 #define AD7193_CH_AIN2P_AIN2M 0x200 /* AIN2(+) - AIN2(-) */
118118 #define AD7193_CH_AIN1 0x401 /* AIN1 - AINCOM */
drivers/staging/iio/meter/ade7854.c+1−1
@@ -269,7 +269,7 @@ static IIO_DEV_ATTR_VPEAK(0644, · 268 unmodified lines
269269 static IIO_DEV_ATTR_IPEAK(0644,
270270 ade7854_read_32bit,
271271 ade7854_write_32bit,
272− ADE7854_VPEAK);
272+ ADE7854_IPEAK);
273273 static IIO_DEV_ATTR_APHCAL(0644,
274274 ade7854_read_16bit,
275275 ade7854_write_16bit,
drivers/staging/most/core.c+1−1
@@ -1431,7 +1431,7 @@ int most_register_interface(struct most_interface *iface) · 1430 unmodified lines
14311431
14321432 INIT_LIST_HEAD(&iface->p->channel_list);
14331433 iface->p->dev_id = id;
1434− snprintf(iface->p->name, STRING_SIZE, "mdev%d", id);
1434+ strcpy(iface->p->name, iface->description);
14351435 iface->dev.init_name = iface->p->name;
14361436 iface->dev.bus = &mc.bus;
14371437 iface->dev.parent = &mc.dev;
drivers/tty/serial/sc16is7xx.c+3−1
@@ -1520,11 +1520,13 @@ static int __init sc16is7xx_init(void) · 1519 unmodified lines
15201520 #endif
15211521 return ret;
15221522
1523+#ifdef CONFIG_SERIAL_SC16IS7XX_SPI
15231524 err_spi:
1525+#endif
15241526 #ifdef CONFIG_SERIAL_SC16IS7XX_I2C
15251527 i2c_del_driver(&sc16is7xx_i2c_uart_driver);
1526−#endif
15271528 err_i2c:
1529+#endif
15281530 uart_unregister_driver(&sc16is7xx_uart);
15291531 return ret;
15301532 }
drivers/tty/serial/sh-sci.c+4−2
@@ -2512,14 +2512,16 @@ done: · 2511 unmodified lines
25122512 * center of the last stop bit in sampling clocks.
25132513 */
25142514 int last_stop = bits * 2 - 1;
2515− int deviation = min_err * srr * last_stop / 2 / baud;
2515+ int deviation = DIV_ROUND_CLOSEST(min_err * last_stop *
2516+ (int)(srr + 1),
2517+ 2 * (int)baud);
25162518
25172519 if (abs(deviation) >= 2) {
25182520 /* At least two sampling clocks off at the
25192521 * last stop bit; we can increase the error
25202522 * margin by shifting the sampling point.
25212523 */
2522− int shift = min(-8, max(7, deviation / 2));
2524+ int shift = clamp(deviation / 2, -8, 7);
25232525
25242526 hssrr |= (shift << HSCIF_SRHP_SHIFT) &
25252527 HSCIF_SRHP_MASK;
drivers/tty/vt/vt.c+2−1
@@ -1520,7 +1520,8 @@ static void csi_J(struct vc_data *vc, int vpar) · 1519 unmodified lines
15201520 return;
15211521 }
15221522 scr_memsetw(start, vc->vc_video_erase_char, 2 * count);
1523− update_region(vc, (unsigned long) start, count);
1523+ if (con_should_update(vc))
1524+ do_update_region(vc, (unsigned long) start, count);
15241525 vc->vc_need_wrap = 0;
15251526 }
15261527
drivers/vfio/pci/vfio_pci.c+2−2
@@ -1661,11 +1661,11 @@ static void __init vfio_pci_fill_ids(void) · 1660 unmodified lines
16611661 rc = pci_add_dynid(&vfio_pci_driver, vendor, device,
16621662 subvendor, subdevice, class, class_mask, 0);
16631663 if (rc)
1664− pr_warn("failed to add dynamic id [%04hx:%04hx[%04hx:%04hx]] class %#08x/%08x (%d)\n",
1664+ pr_warn("failed to add dynamic id [%04x:%04x[%04x:%04x]] class %#08x/%08x (%d)\n",
16651665 vendor, device, subvendor, subdevice,
16661666 class, class_mask, rc);
16671667 else
1668− pr_info("add [%04hx:%04hx[%04hx:%04hx]] class %#08x/%08x\n",
1668+ pr_info("add [%04x:%04x[%04x:%04x]] class %#08x/%08x\n",
16691669 vendor, device, subvendor, subdevice,
16701670 class, class_mask);
16711671 }
drivers/vfio/vfio_iommu_spapr_tce.c+1−1
@@ -1398,7 +1398,7 @@ unlock_exit: · 1397 unmodified lines
13981398 mutex_unlock(&container->lock);
13991399 }
14001400
1401−const struct vfio_iommu_driver_ops tce_iommu_driver_ops = {
1401+static const struct vfio_iommu_driver_ops tce_iommu_driver_ops = {
14021402 .name = "iommu-vfio-powerpc",
14031403 .owner = THIS_MODULE,
14041404 .open = tce_iommu_open,
drivers/vfio/vfio_iommu_type1.c+14−0
@@ -58,12 +58,18 @@ module_param_named(disable_hugepages, · 57 unmodified lines
5858 MODULE_PARM_DESC(disable_hugepages,
5959 "Disable VFIO IOMMU support for IOMMU hugepages.");
6060
61+static unsigned int dma_entry_limit __read_mostly = U16_MAX;
62+module_param_named(dma_entry_limit, dma_entry_limit, uint, 0644);
63+MODULE_PARM_DESC(dma_entry_limit,
64+ "Maximum number of user DMA mappings per container (65535).");
65+
6166 struct vfio_iommu {
6267 struct list_head domain_list;
6368 struct vfio_domain *external_domain; /* domain for external user */
6469 struct mutex lock;
6570 struct rb_root dma_list;
6671 struct blocking_notifier_head notifier;
72+ unsigned int dma_avail;
6773 bool v2;
6874 bool nesting;
6975 };
@@ -836,6 +842,7 @@ static void vfio_remove_dma(struct vfio_iommu *iommu, struct vfio_dma *dma) · 766 unmodified lines
836842 vfio_unlink_dma(iommu, dma);
837843 put_task_struct(dma->task);
838844 kfree(dma);
845+ iommu->dma_avail++;
839846 }
840847
841848 static unsigned long vfio_pgsize_bitmap(struct vfio_iommu *iommu)
@@ -1081,12 +1088,18 @@ static int vfio_dma_do_map(struct vfio_iommu *iommu, · 239 unmodified lines
10811088 goto out_unlock;
10821089 }
10831090
1091+ if (!iommu->dma_avail) {
1092+ ret = -ENOSPC;
1093+ goto out_unlock;
1094+ }
1095+
10841096 dma = kzalloc(sizeof(*dma), GFP_KERNEL);
10851097 if (!dma) {
10861098 ret = -ENOMEM;
10871099 goto out_unlock;
10881100 }
10891101
1102+ iommu->dma_avail--;
10901103 dma->iova = iova;
10911104 dma->vaddr = vaddr;
10921105 dma->prot = prot;
@@ -1583,6 +1596,7 @@ static void *vfio_iommu_type1_open(unsigned long arg) · 490 unmodified lines
15831596
15841597 INIT_LIST_HEAD(&iommu->domain_list);
15851598 iommu->dma_list = RB_ROOT;
1599+ iommu->dma_avail = dma_entry_limit;
15861600 mutex_init(&iommu->lock);
15871601 BLOCKING_INIT_NOTIFIER_HEAD(&iommu->notifier);
15881602
drivers/vhost/vhost.c+5−1
@@ -911,8 +911,12 @@ static int vhost_new_umem_range(struct vhost_umem *umem, · 910 unmodified lines
911911 u64 start, u64 size, u64 end,
912912 u64 userspace_addr, int perm)
913913 {
914− struct vhost_umem_node *tmp, *node = kmalloc(sizeof(*node), GFP_ATOMIC);
914+ struct vhost_umem_node *tmp, *node;
915915
916+ if (!size)
917+ return -EFAULT;
918+
919+ node = kmalloc(sizeof(*node), GFP_ATOMIC);
916920 if (!node)
917921 return -ENOMEM;
918922
drivers/virtio/virtio_pci_common.c+5−3
@@ -255,9 +255,11 @@ void vp_del_vqs(struct virtio_device *vdev) · 254 unmodified lines
255255 for (i = 0; i < vp_dev->msix_used_vectors; ++i)
256256 free_irq(pci_irq_vector(vp_dev->pci_dev, i), vp_dev);
257257
258− for (i = 0; i < vp_dev->msix_vectors; i++)
259− if (vp_dev->msix_affinity_masks[i])
260− free_cpumask_var(vp_dev->msix_affinity_masks[i]);
258+ if (vp_dev->msix_affinity_masks) {
259+ for (i = 0; i < vp_dev->msix_vectors; i++)
260+ if (vp_dev->msix_affinity_masks[i])
261+ free_cpumask_var(vp_dev->msix_affinity_masks[i]);
262+ }
261263
262264 if (vp_dev->msix_enabled) {
263265 /* Disable the vector used for configuration */
drivers/virtio/virtio_ring.c+2−0
@@ -882,6 +882,8 @@ static struct virtqueue *vring_create_virtqueue_split( · 881 unmodified lines
882882 GFP_KERNEL|__GFP_NOWARN|__GFP_ZERO);
883883 if (queue)
884884 break;
885+ if (!may_reduce_num)
886+ return NULL;
885887 }
886888
887889 if (!num)
drivers/xen/privcmd-buf.c+1−2
@@ -140,8 +140,7 @@ static int privcmd_buf_mmap(struct file *file, struct vm_area_struct *vma) · 139 unmodified lines
140140 if (!(vma->vm_flags & VM_SHARED))
141141 return -EINVAL;
142142
143− vma_priv = kzalloc(sizeof(*vma_priv) + count * sizeof(void *),
144− GFP_KERNEL);
143+ vma_priv = kzalloc(struct_size(vma_priv, pages, count), GFP_KERNEL);
145144 if (!vma_priv)
146145 return -ENOMEM;
147146
drivers/xen/xenbus/xenbus_dev_frontend.c+1−3
@@ -622,9 +622,7 @@ static int xenbus_file_open(struct inode *inode, struct file *filp) · 621 unmodified lines
622622 if (xen_store_evtchn == 0)
623623 return -ENOENT;
624624
625− nonseekable_open(inode, filp);
626−
627− filp->f_mode &= ~FMODE_ATOMIC_POS; /* cdev-style semantics */
625+ stream_open(inode, filp);
628626
629627 u = kzalloc(sizeof(*u), GFP_KERNEL);
630628 if (u == NULL)
fs/afs/callback.c+1−2
@@ -203,8 +203,7 @@ void afs_put_cb_interest(struct afs_net *net, struct afs_cb_interest *cbi) · 202 unmodified lines
203203 */
204204 void afs_init_callback_state(struct afs_server *server)
205205 {
206− if (!test_and_clear_bit(AFS_SERVER_FL_NEW, &server->flags))
207− server->cb_s_break++;
206+ server->cb_s_break++;
208207 }
209208
210209 /*
fs/afs/cmservice.c+1−1
@@ -34,7 +34,7 @@ static void SRXAFSCB_TellMeAboutYourself(struct work_struct *); · 33 unmodified lines
3434 static int afs_deliver_yfs_cb_callback(struct afs_call *);
3535
3636 #define CM_NAME(name) \
37− const char afs_SRXCB##name##_name[] __tracepoint_string = \
37+ char afs_SRXCB##name##_name[] __tracepoint_string = \
3838 "CB." #name
3939
4040 /*
fs/afs/inode.c+1−3
@@ -216,9 +216,7 @@ struct inode *afs_iget_pseudo_dir(struct super_block *sb, bool root) · 215 unmodified lines
216216 set_nlink(inode, 2);
217217 inode->i_uid = GLOBAL_ROOT_UID;
218218 inode->i_gid = GLOBAL_ROOT_GID;
219− inode->i_ctime.tv_sec = get_seconds();
220− inode->i_ctime.tv_nsec = 0;
221− inode->i_atime = inode->i_mtime = inode->i_ctime;
219+ inode->i_ctime = inode->i_atime = inode->i_mtime = current_time(inode);
222220 inode->i_blocks = 0;
223221 inode_set_iversion_raw(inode, 0);
224222 inode->i_generation = 0;
fs/afs/internal.h+1−3
@@ -474,7 +474,6 @@ struct afs_server { · 473 unmodified lines
474474 time64_t put_time; /* Time at which last put */
475475 time64_t update_at; /* Time at which to next update the record */
476476 unsigned long flags;
477−#define AFS_SERVER_FL_NEW 0 /* New server, don't inc cb_s_break */
478477 #define AFS_SERVER_FL_NOT_READY 1 /* The record is not ready for use */
479478 #define AFS_SERVER_FL_NOT_FOUND 2 /* VL server says no such server */
480479 #define AFS_SERVER_FL_VL_FAIL 3 /* Failed to access VL server */
@@ -827,7 +826,7 @@ static inline struct afs_cb_interest *afs_get_cb_interest(struct afs_cb_interest · 346 unmodified lines
827826
828827 static inline unsigned int afs_calc_vnode_cb_break(struct afs_vnode *vnode)
829828 {
830− return vnode->cb_break + vnode->cb_s_break + vnode->cb_v_break;
829+ return vnode->cb_break + vnode->cb_v_break;
831830 }
832831
833832 static inline bool afs_cb_is_broken(unsigned int cb_break,
@@ -835,7 +834,6 @@ static inline bool afs_cb_is_broken(unsigned int cb_break, · 1 unmodified line
835834 const struct afs_cb_interest *cbi)
836835 {
837836 return !cbi || cb_break != (vnode->cb_break +
838− cbi->server->cb_s_break +
839837 vnode->volume->cb_v_break);
840838 }
841839
fs/afs/rxrpc.c+22−8
@@ -572,13 +572,17 @@ static void afs_deliver_to_call(struct afs_call *call) · 571 unmodified lines
572572 case -ENODATA:
573573 case -EBADMSG:
574574 case -EMSGSIZE:
575− default:
576575 abort_code = RXGEN_CC_UNMARSHAL;
577576 if (state != AFS_CALL_CL_AWAIT_REPLY)
578577 abort_code = RXGEN_SS_UNMARSHAL;
579578 rxrpc_kernel_abort_call(call->net->socket, call->rxcall,
580579 abort_code, ret, "KUM");
581580 goto local_abort;
581+ default:
582+ abort_code = RX_USER_ABORT;
583+ rxrpc_kernel_abort_call(call->net->socket, call->rxcall,
584+ abort_code, ret, "KER");
585+ goto local_abort;
582586 }
583587 }
584588
@@ -610,6 +614,7 @@ static long afs_wait_for_call_to_complete(struct afs_call *call, · 25 unmodified lines
610614 bool stalled = false;
611615 u64 rtt;
612616 u32 life, last_life;
617+ bool rxrpc_complete = false;
613618
614619 DECLARE_WAITQUEUE(myself, current);
615620
@@ -621,7 +626,7 @@ static long afs_wait_for_call_to_complete(struct afs_call *call, · 5 unmodified lines
621626 rtt2 = 2;
622627
623628 timeout = rtt2;
624− last_life = rxrpc_kernel_check_life(call->net->socket, call->rxcall);
629+ rxrpc_kernel_check_life(call->net->socket, call->rxcall, &last_life);
625630
626631 add_wait_queue(&call->waitq, &myself);
627632 for (;;) {
@@ -639,7 +644,12 @@ static long afs_wait_for_call_to_complete(struct afs_call *call, · 11 unmodified lines
639644 if (afs_check_call_state(call, AFS_CALL_COMPLETE))
640645 break;
641646
642− life = rxrpc_kernel_check_life(call->net->socket, call->rxcall);
647+ if (!rxrpc_kernel_check_life(call->net->socket, call->rxcall, &life)) {
648+ /* rxrpc terminated the call. */
649+ rxrpc_complete = true;
650+ break;
651+ }
652+
643653 if (timeout == 0 &&
644654 life == last_life && signal_pending(current)) {
645655 if (stalled)
@@ -663,12 +673,16 @@ static long afs_wait_for_call_to_complete(struct afs_call *call, · 17 unmodified lines
663673 remove_wait_queue(&call->waitq, &myself);
664674 __set_current_state(TASK_RUNNING);
665675
666− /* Kill off the call if it's still live. */
667676 if (!afs_check_call_state(call, AFS_CALL_COMPLETE)) {
668− _debug("call interrupted");
669− if (rxrpc_kernel_abort_call(call->net->socket, call->rxcall,
670− RX_USER_ABORT, -EINTR, "KWI"))
671− afs_set_call_complete(call, -EINTR, 0);
677+ if (rxrpc_complete) {
678+ afs_set_call_complete(call, call->error, call->abort_code);
679+ } else {
680+ /* Kill off the call if it's still live. */
681+ _debug("call interrupted");
682+ if (rxrpc_kernel_abort_call(call->net->socket, call->rxcall,
683+ RX_USER_ABORT, -EINTR, "KWI"))
684+ afs_set_call_complete(call, -EINTR, 0);
685+ }
672686 }
673687
674688 spin_lock_bh(&call->state_lock);
fs/afs/server.c+0−1
@@ -226,7 +226,6 @@ static struct afs_server *afs_alloc_server(struct afs_net *net, · 225 unmodified lines
226226 RCU_INIT_POINTER(server->addresses, alist);
227227 server->addr_version = alist->version;
228228 server->uuid = *uuid;
229− server->flags = (1UL << AFS_SERVER_FL_NEW);
230229 server->update_at = ktime_get_real_seconds() + afs_server_update_delay;
231230 rwlock_init(&server->fs_lock);
232231 INIT_HLIST_HEAD(&server->cb_volumes);
fs/afs/write.c+1−0
@@ -264,6 +264,7 @@ static void afs_kill_pages(struct address_space *mapping, · 263 unmodified lines
264264 first = page->index + 1;
265265 lock_page(page);
266266 generic_error_remove_page(mapping, page);
267+ unlock_page(page);
267268 }
268269
269270 __pagevec_release(&pv);
fs/aio.c+150−188
@@ -181,7 +181,7 @@ struct poll_iocb { · 180 unmodified lines
181181 struct file *file;
182182 struct wait_queue_head *head;
183183 __poll_t events;
184− bool woken;
184+ bool done;
185185 bool cancelled;
186186 struct wait_queue_entry wait;
187187 struct work_struct work;
@@ -204,8 +204,7 @@ struct aio_kiocb { · 16 unmodified lines
204204 struct kioctx *ki_ctx;
205205 kiocb_cancel_fn *ki_cancel;
206206
207− struct iocb __user *ki_user_iocb; /* user's aiocb */
208− __u64 ki_user_data; /* user's data for completion */
207+ struct io_event ki_res;
209208
210209 struct list_head ki_list; /* the aio core uses this
211210 * for cancellation */
@@ -1022,6 +1021,9 @@ static bool get_reqs_available(struct kioctx *ctx) · 810 unmodified lines
10221021 /* aio_get_req
10231022 * Allocate a slot for an aio request.
10241023 * Returns NULL if no requests are free.
1024+ *
1025+ * The refcount is initialized to 2 - one for the async op completion,
1026+ * one for the synchronous code that does this.
10251027 */
10261028 static inline struct aio_kiocb *aio_get_req(struct kioctx *ctx)
10271029 {
@@ -1031,10 +1033,15 @@ static inline struct aio_kiocb *aio_get_req(struct kioctx *ctx) · 3 unmodified lines
10311033 if (unlikely(!req))
10321034 return NULL;
10331035
1036+ if (unlikely(!get_reqs_available(ctx))) {
1037+ kmem_cache_free(kiocb_cachep, req);
1038+ return NULL;
1039+ }
1040+
10341041 percpu_ref_get(&ctx->reqs);
10351042 req->ki_ctx = ctx;
10361043 INIT_LIST_HEAD(&req->ki_list);
1037− refcount_set(&req->ki_refcnt, 0);
1044+ refcount_set(&req->ki_refcnt, 2);
10381045 req->ki_eventfd = NULL;
10391046 return req;
10401047 }
@@ -1067,30 +1074,20 @@ out: · 26 unmodified lines
10671074 return ret;
10681075 }
10691076
1070−static inline void iocb_put(struct aio_kiocb *iocb)
1071−{
1072− if (refcount_read(&iocb->ki_refcnt) == 0 ||
1073− refcount_dec_and_test(&iocb->ki_refcnt)) {
1074− if (iocb->ki_filp)
1075− fput(iocb->ki_filp);
1076− percpu_ref_put(&iocb->ki_ctx->reqs);
1077− kmem_cache_free(kiocb_cachep, iocb);
1078− }
1079−}
1080−
1081−static void aio_fill_event(struct io_event *ev, struct aio_kiocb *iocb,
1082− long res, long res2)
1077+static inline void iocb_destroy(struct aio_kiocb *iocb)
10831078 {
1084− ev->obj = (u64)(unsigned long)iocb->ki_user_iocb;
1085− ev->data = iocb->ki_user_data;
1086− ev->res = res;
1087− ev->res2 = res2;
1079+ if (iocb->ki_eventfd)
1080+ eventfd_ctx_put(iocb->ki_eventfd);
1081+ if (iocb->ki_filp)
1082+ fput(iocb->ki_filp);
1083+ percpu_ref_put(&iocb->ki_ctx->reqs);
1084+ kmem_cache_free(kiocb_cachep, iocb);
10881085 }
10891086
10901087 /* aio_complete
10911088 * Called when the io request on the given iocb is complete.
10921089 */
1093−static void aio_complete(struct aio_kiocb *iocb, long res, long res2)
1090+static void aio_complete(struct aio_kiocb *iocb)
10941091 {
10951092 struct kioctx *ctx = iocb->ki_ctx;
10961093 struct aio_ring *ring;
@@ -1114,14 +1111,14 @@ static void aio_complete(struct aio_kiocb *iocb, long res, long res2) · 17 unmodified lines
11141111 ev_page = kmap_atomic(ctx->ring_pages[pos / AIO_EVENTS_PER_PAGE]);
11151112 event = ev_page + pos % AIO_EVENTS_PER_PAGE;
11161113
1117− aio_fill_event(event, iocb, res, res2);
1114+ *event = iocb->ki_res;
11181115
11191116 kunmap_atomic(ev_page);
11201117 flush_dcache_page(ctx->ring_pages[pos / AIO_EVENTS_PER_PAGE]);
11211118
1122− pr_debug("%p[%u]: %p: %p %Lx %lx %lx\n",
1123− ctx, tail, iocb, iocb->ki_user_iocb, iocb->ki_user_data,
1124− res, res2);
1119+ pr_debug("%p[%u]: %p: %p %Lx %Lx %Lx\n", ctx, tail, iocb,
1120+ (void __user *)(unsigned long)iocb->ki_res.obj,
1121+ iocb->ki_res.data, iocb->ki_res.res, iocb->ki_res.res2);
11251122
11261123 /* after flagging the request as done, we
11271124 * must never even look at it again
@@ -1148,10 +1145,8 @@ static void aio_complete(struct aio_kiocb *iocb, long res, long res2) · 20 unmodified lines
11481145 * eventfd. The eventfd_signal() function is safe to be called
11491146 * from IRQ context.
11501147 */
1151− if (iocb->ki_eventfd) {
1148+ if (iocb->ki_eventfd)
11521149 eventfd_signal(iocb->ki_eventfd, 1);
1153− eventfd_ctx_put(iocb->ki_eventfd);
1154− }
11551150
11561151 /*
11571152 * We have to order our ring_info tail store above and test
@@ -1163,7 +1158,14 @@ static void aio_complete(struct aio_kiocb *iocb, long res, long res2) · 5 unmodified lines
11631158
11641159 if (waitqueue_active(&ctx->wait))
11651160 wake_up(&ctx->wait);
1166− iocb_put(iocb);
1161+}
1162+
1163+static inline void iocb_put(struct aio_kiocb *iocb)
1164+{
1165+ if (refcount_dec_and_test(&iocb->ki_refcnt)) {
1166+ aio_complete(iocb);
1167+ iocb_destroy(iocb);
1168+ }
11671169 }
11681170
11691171 /* aio_read_events_ring
@@ -1437,7 +1439,9 @@ static void aio_complete_rw(struct kiocb *kiocb, long res, long res2) · 267 unmodified lines
14371439 file_end_write(kiocb->ki_filp);
14381440 }
14391441
1440− aio_complete(iocb, res, res2);
1442+ iocb->ki_res.res = res;
1443+ iocb->ki_res.res2 = res2;
1444+ iocb_put(iocb);
14411445 }
14421446
14431447 static int aio_prep_rw(struct kiocb *req, const struct iocb *iocb)
@@ -1514,13 +1518,13 @@ static inline void aio_rw_done(struct kiocb *req, ssize_t ret) · 70 unmodified lines
15141518 }
15151519 }
15161520
1517−static ssize_t aio_read(struct kiocb *req, const struct iocb *iocb,
1521+static int aio_read(struct kiocb *req, const struct iocb *iocb,
15181522 bool vectored, bool compat)
15191523 {
15201524 struct iovec inline_vecs[UIO_FASTIOV], *iovec = inline_vecs;
15211525 struct iov_iter iter;
15221526 struct file *file;
1523− ssize_t ret;
1527+ int ret;
15241528
15251529 ret = aio_prep_rw(req, iocb);
15261530 if (ret)
@@ -1542,13 +1546,13 @@ static ssize_t aio_read(struct kiocb *req, const struct iocb *iocb, · 15 unmodified lines
15421546 return ret;
15431547 }
15441548
1545−static ssize_t aio_write(struct kiocb *req, const struct iocb *iocb,
1549+static int aio_write(struct kiocb *req, const struct iocb *iocb,
15461550 bool vectored, bool compat)
15471551 {
15481552 struct iovec inline_vecs[UIO_FASTIOV], *iovec = inline_vecs;
15491553 struct iov_iter iter;
15501554 struct file *file;
1551− ssize_t ret;
1555+ int ret;
15521556
15531557 ret = aio_prep_rw(req, iocb);
15541558 if (ret)
@@ -1585,11 +1589,10 @@ static ssize_t aio_write(struct kiocb *req, const struct iocb *iocb, · 30 unmodified lines
15851589
15861590 static void aio_fsync_work(struct work_struct *work)
15871591 {
1588− struct fsync_iocb *req = container_of(work, struct fsync_iocb, work);
1589− int ret;
1592+ struct aio_kiocb *iocb = container_of(work, struct aio_kiocb, fsync.work);
15901593
1591− ret = vfs_fsync(req->file, req->datasync);
1592− aio_complete(container_of(req, struct aio_kiocb, fsync), ret, 0);
1594+ iocb->ki_res.res = vfs_fsync(iocb->fsync.file, iocb->fsync.datasync);
1595+ iocb_put(iocb);
15931596 }
15941597
15951598 static int aio_fsync(struct fsync_iocb *req, const struct iocb *iocb,
@@ -1608,11 +1611,6 @@ static int aio_fsync(struct fsync_iocb *req, const struct iocb *iocb, · 12 unmodified lines
16081611 return 0;
16091612 }
16101613
1611−static inline void aio_poll_complete(struct aio_kiocb *iocb, __poll_t mask)
1612−{
1613− aio_complete(iocb, mangle_poll(mask), 0);
1614−}
1615−
16161614 static void aio_poll_complete_work(struct work_struct *work)
16171615 {
16181616 struct poll_iocb *req = container_of(work, struct poll_iocb, work);
@@ -1638,9 +1636,11 @@ static void aio_poll_complete_work(struct work_struct *work) · 19 unmodified lines
16381636 return;
16391637 }
16401638 list_del_init(&iocb->ki_list);
1639+ iocb->ki_res.res = mangle_poll(mask);
1640+ req->done = true;
16411641 spin_unlock_irq(&ctx->ctx_lock);
16421642
1643− aio_poll_complete(iocb, mask);
1643+ iocb_put(iocb);
16441644 }
16451645
16461646 /* assumes we are called with irqs disabled */
@@ -1668,31 +1668,27 @@ static int aio_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync, · 21 unmodified lines
16681668 __poll_t mask = key_to_poll(key);
16691669 unsigned long flags;
16701670
1671− req->woken = true;
1672−
16731671 /* for instances that support it check for an event match first: */
1674− if (mask) {
1675− if (!(mask & req->events))
1676− return 0;
1672+ if (mask && !(mask & req->events))
1673+ return 0;
1674+
1675+ list_del_init(&req->wait.entry);
16771676
1677+ if (mask && spin_trylock_irqsave(&iocb->ki_ctx->ctx_lock, flags)) {
16781678 /*
16791679 * Try to complete the iocb inline if we can. Use
16801680 * irqsave/irqrestore because not all filesystems (e.g. fuse)
16811681 * call this function with IRQs disabled and because IRQs
16821682 * have to be disabled before ctx_lock is obtained.
16831683 */
1684− if (spin_trylock_irqsave(&iocb->ki_ctx->ctx_lock, flags)) {
1685− list_del(&iocb->ki_list);
1686− spin_unlock_irqrestore(&iocb->ki_ctx->ctx_lock, flags);
1687−
1688− list_del_init(&req->wait.entry);
1689− aio_poll_complete(iocb, mask);
1690− return 1;
1691− }
1684+ list_del(&iocb->ki_list);
1685+ iocb->ki_res.res = mangle_poll(mask);
1686+ req->done = true;
1687+ spin_unlock_irqrestore(&iocb->ki_ctx->ctx_lock, flags);
1688+ iocb_put(iocb);
1689+ } else {
1690+ schedule_work(&req->work);
16921691 }
1693−
1694− list_del_init(&req->wait.entry);
1695− schedule_work(&req->work);
16961692 return 1;
16971693 }
16981694
@@ -1719,11 +1715,12 @@ aio_poll_queue_proc(struct file *file, struct wait_queue_head *head, · 20 unmodified lines
17191715 add_wait_queue(head, &pt->iocb->poll.wait);
17201716 }
17211717
1722−static ssize_t aio_poll(struct aio_kiocb *aiocb, const struct iocb *iocb)
1718+static int aio_poll(struct aio_kiocb *aiocb, const struct iocb *iocb)
17231719 {
17241720 struct kioctx *ctx = aiocb->ki_ctx;
17251721 struct poll_iocb *req = &aiocb->poll;
17261722 struct aio_poll_table apt;
1723+ bool cancel = false;
17271724 __poll_t mask;
17281725
17291726 /* reject any unknown events outside the normal event mask. */
@@ -1737,7 +1734,7 @@ static ssize_t aio_poll(struct aio_kiocb *aiocb, const struct iocb *iocb) · 7 unmodified lines
17371734 req->events = demangle_poll(iocb->aio_buf) | EPOLLERR | EPOLLHUP;
17381735
17391736 req->head = NULL;
1740− req->woken = false;
1737+ req->done = false;
17411738 req->cancelled = false;
17421739
17431740 apt.pt._qproc = aio_poll_queue_proc;
@@ -1749,156 +1746,135 @@ static ssize_t aio_poll(struct aio_kiocb *aiocb, const struct iocb *iocb) · 5 unmodified lines
17491746 INIT_LIST_HEAD(&req->wait.entry);
17501747 init_waitqueue_func_entry(&req->wait, aio_poll_wake);
17511748
1752− /* one for removal from waitqueue, one for this function */
1753− refcount_set(&aiocb->ki_refcnt, 2);
1754−
17551749 mask = vfs_poll(req->file, &apt.pt) & req->events;
1756− if (unlikely(!req->head)) {
1757− /* we did not manage to set up a waitqueue, done */
1758− goto out;
1759− }
1760−
17611750 spin_lock_irq(&ctx->ctx_lock);
1762− spin_lock(&req->head->lock);
1763− if (req->woken) {
1764− /* wake_up context handles the rest */
1765− mask = 0;
1751+ if (likely(req->head)) {
1752+ spin_lock(&req->head->lock);
1753+ if (unlikely(list_empty(&req->wait.entry))) {
1754+ if (apt.error)
1755+ cancel = true;
1756+ apt.error = 0;
1757+ mask = 0;
1758+ }
1759+ if (mask || apt.error) {
1760+ list_del_init(&req->wait.entry);
1761+ } else if (cancel) {
1762+ WRITE_ONCE(req->cancelled, true);
1763+ } else if (!req->done) { /* actually waiting for an event */
1764+ list_add_tail(&aiocb->ki_list, &ctx->active_reqs);
1765+ aiocb->ki_cancel = aio_poll_cancel;
1766+ }
1767+ spin_unlock(&req->head->lock);
1768+ }
1769+ if (mask) { /* no async, we'd stolen it */
1770+ aiocb->ki_res.res = mangle_poll(mask);
17661771 apt.error = 0;
1767− } else if (mask || apt.error) {
1768− /* if we get an error or a mask we are done */
1769− WARN_ON_ONCE(list_empty(&req->wait.entry));
1770− list_del_init(&req->wait.entry);
1771− } else {
1772− /* actually waiting for an event */
1773− list_add_tail(&aiocb->ki_list, &ctx->active_reqs);
1774− aiocb->ki_cancel = aio_poll_cancel;
17751772 }
1776− spin_unlock(&req->head->lock);
17771773 spin_unlock_irq(&ctx->ctx_lock);
1778−
1779−out:
1780− if (unlikely(apt.error))
1781− return apt.error;
1782−
17831774 if (mask)
1784− aio_poll_complete(aiocb, mask);
1785− iocb_put(aiocb);
1786− return 0;
1775+ iocb_put(aiocb);
1776+ return apt.error;
17871777 }
17881778
17891779 static int __io_submit_one(struct kioctx *ctx, const struct iocb *iocb,
1790− struct iocb __user *user_iocb, bool compat)
1780+ struct iocb __user *user_iocb, struct aio_kiocb *req,
1781+ bool compat)
17911782 {
1792− struct aio_kiocb *req;
1793− ssize_t ret;
1794−
1795− /* enforce forwards compatibility on users */
1796− if (unlikely(iocb->aio_reserved2)) {
1797− pr_debug("EINVAL: reserve field set\n");
1798− return -EINVAL;
1799− }
1800−
1801− /* prevent overflows */
1802− if (unlikely(
1803− (iocb->aio_buf != (unsigned long)iocb->aio_buf) ||
1804− (iocb->aio_nbytes != (size_t)iocb->aio_nbytes) ||
1805− ((ssize_t)iocb->aio_nbytes < 0)
1806− )) {
1807− pr_debug("EINVAL: overflow check\n");
1808− return -EINVAL;
1809− }
1810−
1811− if (!get_reqs_available(ctx))
1812− return -EAGAIN;
1813−
1814− ret = -EAGAIN;
1815− req = aio_get_req(ctx);
1816− if (unlikely(!req))
1817− goto out_put_reqs_available;
1818−
18191783 req->ki_filp = fget(iocb->aio_fildes);
1820− ret = -EBADF;
18211784 if (unlikely(!req->ki_filp))
1822− goto out_put_req;
1785+ return -EBADF;
18231786
18241787 if (iocb->aio_flags & IOCB_FLAG_RESFD) {
1788+ struct eventfd_ctx *eventfd;
18251789 /*
18261790 * If the IOCB_FLAG_RESFD flag of aio_flags is set, get an
18271791 * instance of the file* now. The file descriptor must be
18281792 * an eventfd() fd, and will be signaled for each completed
18291793 * event using the eventfd_signal() function.
18301794 */
1831− req->ki_eventfd = eventfd_ctx_fdget((int) iocb->aio_resfd);
1832− if (IS_ERR(req->ki_eventfd)) {
1833− ret = PTR_ERR(req->ki_eventfd);
1834− req->ki_eventfd = NULL;
1835− goto out_put_req;
1836− }
1795+ eventfd = eventfd_ctx_fdget(iocb->aio_resfd);
1796+ if (IS_ERR(eventfd))
1797+ return PTR_ERR(eventfd);
1798+
1799+ req->ki_eventfd = eventfd;
18371800 }
18381801
1839− ret = put_user(KIOCB_KEY, &user_iocb->aio_key);
1840− if (unlikely(ret)) {
1802+ if (unlikely(put_user(KIOCB_KEY, &user_iocb->aio_key))) {
18411803 pr_debug("EFAULT: aio_key\n");
1842− goto out_put_req;
1804+ return -EFAULT;
18431805 }
18441806
1845− req->ki_user_iocb = user_iocb;
1846− req->ki_user_data = iocb->aio_data;
1807+ req->ki_res.obj = (u64)(unsigned long)user_iocb;
1808+ req->ki_res.data = iocb->aio_data;
1809+ req->ki_res.res = 0;
1810+ req->ki_res.res2 = 0;
18471811
18481812 switch (iocb->aio_lio_opcode) {
18491813 case IOCB_CMD_PREAD:
1850− ret = aio_read(&req->rw, iocb, false, compat);
1851− break;
1814+ return aio_read(&req->rw, iocb, false, compat);
18521815 case IOCB_CMD_PWRITE:
1853− ret = aio_write(&req->rw, iocb, false, compat);
1854− break;
1816+ return aio_write(&req->rw, iocb, false, compat);
18551817 case IOCB_CMD_PREADV:
1856− ret = aio_read(&req->rw, iocb, true, compat);
1857− break;
1818+ return aio_read(&req->rw, iocb, true, compat);
18581819 case IOCB_CMD_PWRITEV:
1859− ret = aio_write(&req->rw, iocb, true, compat);
1860− break;
1820+ return aio_write(&req->rw, iocb, true, compat);
18611821 case IOCB_CMD_FSYNC:
1862− ret = aio_fsync(&req->fsync, iocb, false);
1863− break;
1822+ return aio_fsync(&req->fsync, iocb, false);
18641823 case IOCB_CMD_FDSYNC:
1865− ret = aio_fsync(&req->fsync, iocb, true);
1866− break;
1824+ return aio_fsync(&req->fsync, iocb, true);
18671825 case IOCB_CMD_POLL:
1868− ret = aio_poll(req, iocb);
1869− break;
1826+ return aio_poll(req, iocb);
18701827 default:
18711828 pr_debug("invalid aio operation %d\n", iocb->aio_lio_opcode);
1872− ret = -EINVAL;
1873− break;
1829+ return -EINVAL;
18741830 }
1875−
1876− /*
1877− * If ret is 0, we'd either done aio_complete() ourselves or have
1878− * arranged for that to be done asynchronously. Anything non-zero
1879− * means that we need to destroy req ourselves.
1880− */
1881− if (ret)
1882− goto out_put_req;
1883− return 0;
1884−out_put_req:
1885− if (req->ki_eventfd)
1886− eventfd_ctx_put(req->ki_eventfd);
1887− iocb_put(req);
1888−out_put_reqs_available:
1889− put_reqs_available(ctx, 1);
1890− return ret;
18911831 }
18921832
18931833 static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
18941834 bool compat)
18951835 {
1836+ struct aio_kiocb *req;
18961837 struct iocb iocb;
1838+ int err;
18971839
18981840 if (unlikely(copy_from_user(&iocb, user_iocb, sizeof(iocb))))
18991841 return -EFAULT;
19001842
1901− return __io_submit_one(ctx, &iocb, user_iocb, compat);
1843+ /* enforce forwards compatibility on users */
1844+ if (unlikely(iocb.aio_reserved2)) {
1845+ pr_debug("EINVAL: reserve field set\n");
1846+ return -EINVAL;
1847+ }
1848+
1849+ /* prevent overflows */
1850+ if (unlikely(
1851+ (iocb.aio_buf != (unsigned long)iocb.aio_buf) ||
1852+ (iocb.aio_nbytes != (size_t)iocb.aio_nbytes) ||
1853+ ((ssize_t)iocb.aio_nbytes < 0)
1854+ )) {
1855+ pr_debug("EINVAL: overflow check\n");
1856+ return -EINVAL;
1857+ }
1858+
1859+ req = aio_get_req(ctx);
1860+ if (unlikely(!req))
1861+ return -EAGAIN;
1862+
1863+ err = __io_submit_one(ctx, &iocb, user_iocb, req, compat);
1864+
1865+ /* Done with the synchronous reference */
1866+ iocb_put(req);
1867+
1868+ /*
1869+ * If err is 0, we'd either done aio_complete() ourselves or have
1870+ * arranged for that to be done asynchronously. Anything non-zero
1871+ * means that we need to destroy req ourselves.
1872+ */
1873+ if (unlikely(err)) {
1874+ iocb_destroy(req);
1875+ put_reqs_available(ctx, 1);
1876+ }
1877+ return err;
19021878 }
19031879
19041880 /* sys_io_submit:
@@ -1997,24 +1973,6 @@ COMPAT_SYSCALL_DEFINE3(io_submit, compat_aio_context_t, ctx_id, · 92 unmodified lines
19971973 }
19981974 #endif
19991975
2000−/* lookup_kiocb
2001− * Finds a given iocb for cancellation.
2002− */
2003−static struct aio_kiocb *
2004−lookup_kiocb(struct kioctx *ctx, struct iocb __user *iocb)
2005−{
2006− struct aio_kiocb *kiocb;
2007−
2008− assert_spin_locked(&ctx->ctx_lock);
2009−
2010− /* TODO: use a hash or array, this sucks. */
2011− list_for_each_entry(kiocb, &ctx->active_reqs, ki_list) {
2012− if (kiocb->ki_user_iocb == iocb)
2013− return kiocb;
2014− }
2015− return NULL;
2016−}
2017−
20181976 /* sys_io_cancel:
20191977 * Attempts to cancel an iocb previously passed to io_submit. If
20201978 * the operation is successfully cancelled, the resulting event is
@@ -2032,6 +1990,7 @@ SYSCALL_DEFINE3(io_cancel, aio_context_t, ctx_id, struct iocb __user *, iocb, · 11 unmodified lines
20321990 struct aio_kiocb *kiocb;
20331991 int ret = -EINVAL;
20341992 u32 key;
1993+ u64 obj = (u64)(unsigned long)iocb;
20351994
20361995 if (unlikely(get_user(key, &iocb->aio_key)))
20371996 return -EFAULT;
@@ -2043,10 +2002,13 @@ SYSCALL_DEFINE3(io_cancel, aio_context_t, ctx_id, struct iocb __user *, iocb, · 5 unmodified lines
20432002 return -EINVAL;
20442003
20452004 spin_lock_irq(&ctx->ctx_lock);
2046− kiocb = lookup_kiocb(ctx, iocb);
2047− if (kiocb) {
2048− ret = kiocb->ki_cancel(&kiocb->rw);
2049− list_del_init(&kiocb->ki_list);
2005+ /* TODO: use a hash or array, this sucks. */
2006+ list_for_each_entry(kiocb, &ctx->active_reqs, ki_list) {
2007+ if (kiocb->ki_res.obj == obj) {
2008+ ret = kiocb->ki_cancel(&kiocb->rw);
2009+ list_del_init(&kiocb->ki_list);
2010+ break;
2011+ }
20502012 }
20512013 spin_unlock_irq(&ctx->ctx_lock);
20522014
fs/block_dev.c+4−4
@@ -307,10 +307,10 @@ static void blkdev_bio_end_io(struct bio *bio) · 306 unmodified lines
307307 struct blkdev_dio *dio = bio->bi_private;
308308 bool should_dirty = dio->should_dirty;
309309
310− if (dio->multi_bio && !atomic_dec_and_test(&dio->ref)) {
311− if (bio->bi_status && !dio->bio.bi_status)
312− dio->bio.bi_status = bio->bi_status;
313− } else {
310+ if (bio->bi_status && !dio->bio.bi_status)
311+ dio->bio.bi_status = bio->bi_status;
312+
313+ if (!dio->multi_bio || atomic_dec_and_test(&dio->ref)) {
314314 if (!dio->is_sync) {
315315 struct kiocb *iocb = dio->iocb;
316316 ssize_t ret;
fs/btrfs/ioctl.c+10−0
@@ -501,6 +501,16 @@ static noinline int btrfs_ioctl_fitrim(struct file *file, void __user *arg) · 500 unmodified lines
501501 if (!capable(CAP_SYS_ADMIN))
502502 return -EPERM;
503503
504+ /*
505+ * If the fs is mounted with nologreplay, which requires it to be
506+ * mounted in RO mode as well, we can not allow discard on free space
507+ * inside block groups, because log trees refer to extents that are not
508+ * pinned in a block group's free space cache (pinning the extents is
509+ * precisely the first phase of replaying a log tree).
510+ */
511+ if (btrfs_test_opt(fs_info, NOLOGREPLAY))
512+ return -EROFS;
513+
504514 rcu_read_lock();
505515 list_for_each_entry_rcu(device, &fs_info->fs_devices->devices,
506516 dev_list) {
fs/btrfs/props.c+4−4
@@ -366,11 +366,11 @@ int btrfs_subvol_inherit_props(struct btrfs_trans_handle *trans, · 365 unmodified lines
366366
367367 static int prop_compression_validate(const char *value, size_t len)
368368 {
369− if (!strncmp("lzo", value, len))
369+ if (!strncmp("lzo", value, 3))
370370 return 0;
371− else if (!strncmp("zlib", value, len))
371+ else if (!strncmp("zlib", value, 4))
372372 return 0;
373− else if (!strncmp("zstd", value, len))
373+ else if (!strncmp("zstd", value, 4))
374374 return 0;
375375
376376 return -EINVAL;
@@ -396,7 +396,7 @@ static int prop_compression_apply(struct inode *inode, · 19 unmodified lines
396396 btrfs_set_fs_incompat(fs_info, COMPRESS_LZO);
397397 } else if (!strncmp("zlib", value, 4)) {
398398 type = BTRFS_COMPRESS_ZLIB;
399− } else if (!strncmp("zstd", value, len)) {
399+ } else if (!strncmp("zstd", value, 4)) {
400400 type = BTRFS_COMPRESS_ZSTD;
401401 btrfs_set_fs_incompat(fs_info, COMPRESS_ZSTD);
402402 } else {
fs/cifs/cifsfs.c+2−0
@@ -559,6 +559,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root) · 558 unmodified lines
559559 tcon->ses->server->echo_interval / HZ);
560560 if (tcon->snapshot_time)
561561 seq_printf(s, ",snapshot=%llu", tcon->snapshot_time);
562+ if (tcon->handle_timeout)
563+ seq_printf(s, ",handletimeout=%u", tcon->handle_timeout);
562564 /* convert actimeo and display it in seconds */
563565 seq_printf(s, ",actimeo=%lu", cifs_sb->actimeo / HZ);
564566
fs/cifs/cifsglob.h+10−0
@@ -59,6 +59,12 @@ · 58 unmodified lines
5959 */
6060 #define CIFS_MAX_ACTIMEO (1 << 30)
6161
62+/*
63+ * Max persistent and resilient handle timeout (milliseconds).
64+ * Windows durable max was 960000 (16 minutes)
65+ */
66+#define SMB3_MAX_HANDLE_TIMEOUT 960000
67+
6268 /*
6369 * MAX_REQ is the maximum number of requests that WE will send
6470 * on one socket concurrently.
@@ -586,6 +592,7 @@ struct smb_vol { · 521 unmodified lines
586592 struct nls_table *local_nls;
587593 unsigned int echo_interval; /* echo interval in secs */
588594 __u64 snapshot_time; /* needed for timewarp tokens */
595+ __u32 handle_timeout; /* persistent and durable handle timeout in ms */
589596 unsigned int max_credits; /* smb3 max_credits 10 < credits < 60000 */
590597 };
591598
@@ -1058,6 +1065,7 @@ struct cifs_tcon { · 466 unmodified lines
10581065 __u32 vol_serial_number;
10591066 __le64 vol_create_time;
10601067 __u64 snapshot_time; /* for timewarp tokens - timestamp of snapshot */
1068+ __u32 handle_timeout; /* persistent and durable handle timeout in ms */
10611069 __u32 ss_flags; /* sector size flags */
10621070 __u32 perf_sector_size; /* best sector size for perf */
10631071 __u32 max_chunks;
@@ -1325,6 +1333,7 @@ cifsFileInfo_get_locked(struct cifsFileInfo *cifs_file) · 261 unmodified lines
13251333 }
13261334
13271335 struct cifsFileInfo *cifsFileInfo_get(struct cifsFileInfo *cifs_file);
1336+void _cifsFileInfo_put(struct cifsFileInfo *cifs_file, bool wait_oplock_hdlr);
13281337 void cifsFileInfo_put(struct cifsFileInfo *cifs_file);
13291338
13301339 #define CIFS_CACHE_READ_FLG 1
@@ -1847,6 +1856,7 @@ GLOBAL_EXTERN spinlock_t gidsidlock; · 516 unmodified lines
18471856 #endif /* CONFIG_CIFS_ACL */
18481857
18491858 void cifs_oplock_break(struct work_struct *work);
1859+void cifs_queue_oplock_break(struct cifsFileInfo *cfile);
18501860
18511861 extern const struct slow_work_ops cifs_oplock_break_ops;
18521862 extern struct workqueue_struct *cifsiod_wq;
fs/cifs/connect.c+29−1
@@ -103,7 +103,7 @@ enum { · 102 unmodified lines
103103 Opt_cruid, Opt_gid, Opt_file_mode,
104104 Opt_dirmode, Opt_port,
105105 Opt_blocksize, Opt_rsize, Opt_wsize, Opt_actimeo,
106− Opt_echo_interval, Opt_max_credits,
106+ Opt_echo_interval, Opt_max_credits, Opt_handletimeout,
107107 Opt_snapshot,
108108
109109 /* Mount options which take string value */
@@ -208,6 +208,7 @@ static const match_table_t cifs_mount_option_tokens = { · 98 unmodified lines
208208 { Opt_rsize, "rsize=%s" },
209209 { Opt_wsize, "wsize=%s" },
210210 { Opt_actimeo, "actimeo=%s" },
211+ { Opt_handletimeout, "handletimeout=%s" },
211212 { Opt_echo_interval, "echo_interval=%s" },
212213 { Opt_max_credits, "max_credits=%s" },
213214 { Opt_snapshot, "snapshot=%s" },
@@ -1619,6 +1620,9 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, · 1405 unmodified lines
16191620
16201621 vol->actimeo = CIFS_DEF_ACTIMEO;
16211622
1623+ /* Most clients set timeout to 0, allows server to use its default */
1624+ vol->handle_timeout = 0; /* See MS-SMB2 spec section 2.2.14.2.12 */
1625+
16221626 /* offer SMB2.1 and later (SMB3 etc). Secure and widely accepted */
16231627 vol->ops = &smb30_operations;
16241628 vol->vals = &smbdefault_values;
@@ -2017,6 +2021,18 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, · 392 unmodified lines
20172021 goto cifs_parse_mount_err;
20182022 }
20192023 break;
2024+ case Opt_handletimeout:
2025+ if (get_option_ul(args, &option)) {
2026+ cifs_dbg(VFS, "%s: Invalid handletimeout value\n",
2027+ __func__);
2028+ goto cifs_parse_mount_err;
2029+ }
2030+ vol->handle_timeout = option;
2031+ if (vol->handle_timeout > SMB3_MAX_HANDLE_TIMEOUT) {
2032+ cifs_dbg(VFS, "Invalid handle cache timeout, longer than 16 minutes\n");
2033+ goto cifs_parse_mount_err;
2034+ }
2035+ break;
20202036 case Opt_echo_interval:
20212037 if (get_option_ul(args, &option)) {
20222038 cifs_dbg(VFS, "%s: Invalid echo interval value\n",
@@ -3183,6 +3199,8 @@ static int match_tcon(struct cifs_tcon *tcon, struct smb_vol *volume_info) · 1160 unmodified lines
31833199 return 0;
31843200 if (tcon->snapshot_time != volume_info->snapshot_time)
31853201 return 0;
3202+ if (tcon->handle_timeout != volume_info->handle_timeout)
3203+ return 0;
31863204 return 1;
31873205 }
31883206
@@ -3297,6 +3315,16 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb_vol *volume_info) · 108 unmodified lines
32973315 tcon->snapshot_time = volume_info->snapshot_time;
32983316 }
32993317
3318+ if (volume_info->handle_timeout) {
3319+ if (ses->server->vals->protocol_id == 0) {
3320+ cifs_dbg(VFS,
3321+ "Use SMB2.1 or later for handle timeout option\n");
3322+ rc = -EOPNOTSUPP;
3323+ goto out_fail;
3324+ } else
3325+ tcon->handle_timeout = volume_info->handle_timeout;
3326+ }
3327+
33003328 tcon->ses = ses;
33013329 if (volume_info->password) {
33023330 tcon->password = kstrdup(volume_info->password, GFP_KERNEL);
fs/cifs/file.c+25−5
@@ -360,12 +360,30 @@ cifsFileInfo_get(struct cifsFileInfo *cifs_file) · 359 unmodified lines
360360 return cifs_file;
361361 }
362362
363−/*
364− * Release a reference on the file private data. This may involve closing
365− * the filehandle out on the server. Must be called without holding
366− * tcon->open_file_lock and cifs_file->file_info_lock.
363+/**
364+ * cifsFileInfo_put - release a reference of file priv data
365+ *
366+ * Always potentially wait for oplock handler. See _cifsFileInfo_put().
367367 */
368368 void cifsFileInfo_put(struct cifsFileInfo *cifs_file)
369+{
370+ _cifsFileInfo_put(cifs_file, true);
371+}
372+
373+/**
374+ * _cifsFileInfo_put - release a reference of file priv data
375+ *
376+ * This may involve closing the filehandle @cifs_file out on the
377+ * server. Must be called without holding tcon->open_file_lock and
378+ * cifs_file->file_info_lock.
379+ *
380+ * If @wait_for_oplock_handler is true and we are releasing the last
381+ * reference, wait for any running oplock break handler of the file
382+ * and cancel any pending one. If calling this function from the
383+ * oplock break handler, you need to pass false.
384+ *
385+ */
386+void _cifsFileInfo_put(struct cifsFileInfo *cifs_file, bool wait_oplock_handler)
369387 {
370388 struct inode *inode = d_inode(cifs_file->dentry);
371389 struct cifs_tcon *tcon = tlink_tcon(cifs_file->tlink);
@@ -414,7 +432,8 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file) · 42 unmodified lines
414432
415433 spin_unlock(&tcon->open_file_lock);
416434
417− oplock_break_cancelled = cancel_work_sync(&cifs_file->oplock_break);
435+ oplock_break_cancelled = wait_oplock_handler ?
436+ cancel_work_sync(&cifs_file->oplock_break) : false;
418437
419438 if (!tcon->need_reconnect && !cifs_file->invalidHandle) {
420439 struct TCP_Server_Info *server = tcon->ses->server;
@@ -4603,6 +4622,7 @@ void cifs_oplock_break(struct work_struct *work) · 4182 unmodified lines
46034622 cinode);
46044623 cifs_dbg(FYI, "Oplock release rc = %d\n", rc);
46054624 }
4625+ _cifsFileInfo_put(cfile, false /* do not wait for ourself */);
46064626 cifs_done_oplock_break(cinode);
46074627 }
46084628
fs/cifs/misc.c+23−2
@@ -501,8 +501,7 @@ is_valid_oplock_break(char *buffer, struct TCP_Server_Info *srv) · 500 unmodified lines
501501 CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2,
502502 &pCifsInode->flags);
503503
504− queue_work(cifsoplockd_wq,
505− &netfile->oplock_break);
504+ cifs_queue_oplock_break(netfile);
506505 netfile->oplock_break_cancelled = false;
507506
508507 spin_unlock(&tcon->open_file_lock);
@@ -607,6 +606,28 @@ void cifs_put_writer(struct cifsInodeInfo *cinode) · 98 unmodified lines
607606 spin_unlock(&cinode->writers_lock);
608607 }
609608
609+/**
610+ * cifs_queue_oplock_break - queue the oplock break handler for cfile
611+ *
612+ * This function is called from the demultiplex thread when it
613+ * receives an oplock break for @cfile.
614+ *
615+ * Assumes the tcon->open_file_lock is held.
616+ * Assumes cfile->file_info_lock is NOT held.
617+ */
618+void cifs_queue_oplock_break(struct cifsFileInfo *cfile)
619+{
620+ /*
621+ * Bump the handle refcount now while we hold the
622+ * open_file_lock to enforce the validity of it for the oplock
623+ * break handler. The matching put is done at the end of the
624+ * handler.
625+ */
626+ cifsFileInfo_get(cfile);
627+
628+ queue_work(cifsoplockd_wq, &cfile->oplock_break);
629+}
630+
610631 void cifs_done_oplock_break(struct cifsInodeInfo *cinode)
611632 {
612633 clear_bit(CIFS_INODE_PENDING_OPLOCK_BREAK, &cinode->flags);
fs/cifs/smb2file.c+4−2
@@ -68,13 +68,15 @@ smb2_open_file(const unsigned int xid, struct cifs_open_parms *oparms, · 67 unmodified lines
6868
6969
7070 if (oparms->tcon->use_resilient) {
71− nr_ioctl_req.Timeout = 0; /* use server default (120 seconds) */
71+ /* default timeout is 0, servers pick default (120 seconds) */
72+ nr_ioctl_req.Timeout =
73+ cpu_to_le32(oparms->tcon->handle_timeout);
7274 nr_ioctl_req.Reserved = 0;
7375 rc = SMB2_ioctl(xid, oparms->tcon, fid->persistent_fid,
7476 fid->volatile_fid, FSCTL_LMR_REQUEST_RESILIENCY,
7577 true /* is_fsctl */,
7678 (char *)&nr_ioctl_req, sizeof(nr_ioctl_req),
77− NULL, NULL /* no return info */);
79+ CIFSMaxBufSize, NULL, NULL /* no return info */);
7880 if (rc == -EOPNOTSUPP) {
7981 cifs_dbg(VFS,
8082 "resiliency not supported by server, disabling\n");
fs/cifs/smb2misc.c+3−3
@@ -555,7 +555,7 @@ smb2_tcon_has_lease(struct cifs_tcon *tcon, struct smb2_lease_break *rsp, · 554 unmodified lines
555555 clear_bit(CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2,
556556 &cinode->flags);
557557
558− queue_work(cifsoplockd_wq, &cfile->oplock_break);
558+ cifs_queue_oplock_break(cfile);
559559 kfree(lw);
560560 return true;
561561 }
@@ -712,8 +712,8 @@ smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server) · 150 unmodified lines
712712 CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2,
713713 &cinode->flags);
714714 spin_unlock(&cfile->file_info_lock);
715− queue_work(cifsoplockd_wq,
716− &cfile->oplock_break);
715+
716+ cifs_queue_oplock_break(cfile);
717717
718718 spin_unlock(&tcon->open_file_lock);
719719 spin_unlock(&cifs_tcp_ses_lock);
fs/cifs/smb2ops.c+44−26
@@ -581,7 +581,7 @@ SMB3_request_interfaces(const unsigned int xid, struct cifs_tcon *tcon) · 580 unmodified lines
581581 rc = SMB2_ioctl(xid, tcon, NO_FILE_ID, NO_FILE_ID,
582582 FSCTL_QUERY_NETWORK_INTERFACE_INFO, true /* is_fsctl */,
583583 NULL /* no data input */, 0 /* no data input */,
584− (char **)&out_buf, &ret_data_len);
584+ CIFSMaxBufSize, (char **)&out_buf, &ret_data_len);
585585 if (rc == -EOPNOTSUPP) {
586586 cifs_dbg(FYI,
587587 "server does not support query network interfaces\n");
@@ -717,32 +717,28 @@ int open_shroot(unsigned int xid, struct cifs_tcon *tcon, struct cifs_fid *pfid) · 129 unmodified lines
717717 oparms.fid->mid = le64_to_cpu(o_rsp->sync_hdr.MessageId);
718718 #endif /* CIFS_DEBUG2 */
719719
720− if (o_rsp->OplockLevel == SMB2_OPLOCK_LEVEL_LEASE)
721− oplock = smb2_parse_lease_state(server, o_rsp,
722− &oparms.fid->epoch,
723− oparms.fid->lease_key);
724− else
725− goto oshr_exit;
726−
727−
728720 memcpy(tcon->crfid.fid, pfid, sizeof(struct cifs_fid));
729721 tcon->crfid.tcon = tcon;
730722 tcon->crfid.is_valid = true;
731723 kref_init(&tcon->crfid.refcount);
732− kref_get(&tcon->crfid.refcount);
733724
725+ if (o_rsp->OplockLevel == SMB2_OPLOCK_LEVEL_LEASE) {
726+ kref_get(&tcon->crfid.refcount);
727+ oplock = smb2_parse_lease_state(server, o_rsp,
728+ &oparms.fid->epoch,
729+ oparms.fid->lease_key);
730+ } else
731+ goto oshr_exit;
734732
735733 qi_rsp = (struct smb2_query_info_rsp *)rsp_iov[1].iov_base;
736734 if (le32_to_cpu(qi_rsp->OutputBufferLength) < sizeof(struct smb2_file_all_info))
737735 goto oshr_exit;
738− rc = smb2_validate_and_copy_iov(
736+ if (!smb2_validate_and_copy_iov(
739737 le16_to_cpu(qi_rsp->OutputBufferOffset),
740738 sizeof(struct smb2_file_all_info),
741739 &rsp_iov[1], sizeof(struct smb2_file_all_info),
742− (char *)&tcon->crfid.file_all_info);
743− if (rc)
744− goto oshr_exit;
745− tcon->crfid.file_all_info_is_valid = 1;
740+ (char *)&tcon->crfid.file_all_info))
741+ tcon->crfid.file_all_info_is_valid = 1;
746742
747743 oshr_exit:
748744 mutex_unlock(&tcon->crfid.fid_mutex);
@@ -1299,7 +1295,7 @@ SMB2_request_res_key(const unsigned int xid, struct cifs_tcon *tcon, · 550 unmodified lines
12991295
13001296 rc = SMB2_ioctl(xid, tcon, persistent_fid, volatile_fid,
13011297 FSCTL_SRV_REQUEST_RESUME_KEY, true /* is_fsctl */,
1302− NULL, 0 /* no input */,
1298+ NULL, 0 /* no input */, CIFSMaxBufSize,
13031299 (char **)&res_key, &ret_data_len);
13041300
13051301 if (rc) {
@@ -1404,7 +1400,7 @@ smb2_ioctl_query_info(const unsigned int xid, · 98 unmodified lines
14041400 rc = SMB2_ioctl_init(tcon, &rqst[1],
14051401 COMPOUND_FID, COMPOUND_FID,
14061402 qi.info_type, true, NULL,
1407− 0);
1403+ 0, CIFSMaxBufSize);
14081404 }
14091405 } else if (qi.flags == PASSTHRU_QUERY_INFO) {
14101406 memset(&qi_iov, 0, sizeof(qi_iov));
@@ -1532,8 +1528,8 @@ smb2_copychunk_range(const unsigned int xid, · 121 unmodified lines
15321528 rc = SMB2_ioctl(xid, tcon, trgtfile->fid.persistent_fid,
15331529 trgtfile->fid.volatile_fid, FSCTL_SRV_COPYCHUNK_WRITE,
15341530 true /* is_fsctl */, (char *)pcchunk,
1535− sizeof(struct copychunk_ioctl), (char **)&retbuf,
1536− &ret_data_len);
1531+ sizeof(struct copychunk_ioctl), CIFSMaxBufSize,
1532+ (char **)&retbuf, &ret_data_len);
15371533 if (rc == 0) {
15381534 if (ret_data_len !=
15391535 sizeof(struct copychunk_ioctl_rsp)) {
@@ -1693,7 +1689,7 @@ static bool smb2_set_sparse(const unsigned int xid, struct cifs_tcon *tcon, · 153 unmodified lines
16931689 rc = SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid,
16941690 cfile->fid.volatile_fid, FSCTL_SET_SPARSE,
16951691 true /* is_fctl */,
1696− &setsparse, 1, NULL, NULL);
1692+ &setsparse, 1, CIFSMaxBufSize, NULL, NULL);
16971693 if (rc) {
16981694 tcon->broken_sparse_sup = true;
16991695 cifs_dbg(FYI, "set sparse rc = %d\n", rc);
@@ -1766,7 +1762,7 @@ smb2_duplicate_extents(const unsigned int xid, · 66 unmodified lines
17661762 true /* is_fsctl */,
17671763 (char *)&dup_ext_buf,
17681764 sizeof(struct duplicate_extents_to_file),
1769− NULL,
1765+ CIFSMaxBufSize, NULL,
17701766 &ret_data_len);
17711767
17721768 if (ret_data_len > 0)
@@ -1801,7 +1797,7 @@ smb3_set_integrity(const unsigned int xid, struct cifs_tcon *tcon, · 28 unmodified lines
18011797 true /* is_fsctl */,
18021798 (char *)&integr_info,
18031799 sizeof(struct fsctl_set_integrity_information_req),
1804− NULL,
1800+ CIFSMaxBufSize, NULL,
18051801 &ret_data_len);
18061802
18071803 }
@@ -1809,6 +1805,8 @@ smb3_set_integrity(const unsigned int xid, struct cifs_tcon *tcon, · 1 unmodified line
18091805 /* GMT Token is @GMT-YYYY.MM.DD-HH.MM.SS Unicode which is 48 bytes + null */
18101806 #define GMT_TOKEN_SIZE 50
18111807
1808+#define MIN_SNAPSHOT_ARRAY_SIZE 16 /* See MS-SMB2 section 3.3.5.15.1 */
1809+
18121810 /*
18131811 * Input buffer contains (empty) struct smb_snapshot array with size filled in
18141812 * For output see struct SRV_SNAPSHOT_ARRAY in MS-SMB2 section 2.2.32.2
@@ -1820,13 +1818,29 @@ smb3_enum_snapshots(const unsigned int xid, struct cifs_tcon *tcon, · 5 unmodified lines
18201818 char *retbuf = NULL;
18211819 unsigned int ret_data_len = 0;
18221820 int rc;
1821+ u32 max_response_size;
18231822 struct smb_snapshot_array snapshot_in;
18241823
1824+ if (get_user(ret_data_len, (unsigned int __user *)ioc_buf))
1825+ return -EFAULT;
1826+
1827+ /*
1828+ * Note that for snapshot queries that servers like Azure expect that
1829+ * the first query be minimal size (and just used to get the number/size
1830+ * of previous versions) so response size must be specified as EXACTLY
1831+ * sizeof(struct snapshot_array) which is 16 when rounded up to multiple
1832+ * of eight bytes.
1833+ */
1834+ if (ret_data_len == 0)
1835+ max_response_size = MIN_SNAPSHOT_ARRAY_SIZE;
1836+ else
1837+ max_response_size = CIFSMaxBufSize;
1838+
18251839 rc = SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid,
18261840 cfile->fid.volatile_fid,
18271841 FSCTL_SRV_ENUMERATE_SNAPSHOTS,
18281842 true /* is_fsctl */,
1829− NULL, 0 /* no input data */,
1843+ NULL, 0 /* no input data */, max_response_size,
18301844 (char **)&retbuf,
18311845 &ret_data_len);
18321846 cifs_dbg(FYI, "enum snaphots ioctl returned %d and ret buflen is %d\n",
@@ -2304,7 +2318,7 @@ smb2_get_dfs_refer(const unsigned int xid, struct cifs_ses *ses, · 471 unmodified lines
23042318 rc = SMB2_ioctl(xid, tcon, NO_FILE_ID, NO_FILE_ID,
23052319 FSCTL_DFS_GET_REFERRALS,
23062320 true /* is_fsctl */,
2307− (char *)dfs_req, dfs_req_size,
2321+ (char *)dfs_req, dfs_req_size, CIFSMaxBufSize,
23082322 (char **)&dfs_rsp, &dfs_rsp_size);
23092323 } while (rc == -EAGAIN);
23102324
@@ -2375,6 +2389,8 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon, · 64 unmodified lines
23752389
23762390 rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, &err_iov,
23772391 &resp_buftype);
2392+ if (!rc)
2393+ SMB2_close(xid, tcon, fid.persistent_fid, fid.volatile_fid);
23782394 if (!rc || !err_iov.iov_base) {
23792395 rc = -ENOENT;
23802396 goto free_path;
@@ -2658,7 +2674,8 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon, · 277 unmodified lines
26582674 rc = SMB2_ioctl_init(tcon, &rqst[num++], cfile->fid.persistent_fid,
26592675 cfile->fid.volatile_fid, FSCTL_SET_ZERO_DATA,
26602676 true /* is_fctl */, (char *)&fsctl_buf,
2661− sizeof(struct file_zero_data_information));
2677+ sizeof(struct file_zero_data_information),
2678+ CIFSMaxBufSize);
26622679 if (rc)
26632680 goto zero_range_exit;
26642681
@@ -2735,7 +2752,8 @@ static long smb3_punch_hole(struct file *file, struct cifs_tcon *tcon, · 70 unmodified lines
27352752 rc = SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid,
27362753 cfile->fid.volatile_fid, FSCTL_SET_ZERO_DATA,
27372754 true /* is_fctl */, (char *)&fsctl_buf,
2738− sizeof(struct file_zero_data_information), NULL, NULL);
2755+ sizeof(struct file_zero_data_information),
2756+ CIFSMaxBufSize, NULL, NULL);
27392757 free_xid(xid);
27402758 return rc;
27412759 }
fs/cifs/smb2pdu.c+40−20
@@ -832,8 +832,11 @@ SMB2_negotiate(const unsigned int xid, struct cifs_ses *ses) · 831 unmodified lines
832832 } else if (rsp->DialectRevision == cpu_to_le16(SMB21_PROT_ID)) {
833833 /* ops set to 3.0 by default for default so update */
834834 ses->server->ops = &smb21_operations;
835− } else if (rsp->DialectRevision == cpu_to_le16(SMB311_PROT_ID))
835+ ses->server->vals = &smb21_values;
836+ } else if (rsp->DialectRevision == cpu_to_le16(SMB311_PROT_ID)) {
836837 ses->server->ops = &smb311_operations;
838+ ses->server->vals = &smb311_values;
839+ }
837840 } else if (le16_to_cpu(rsp->DialectRevision) !=
838841 ses->server->vals->protocol_id) {
839842 /* if requested single dialect ensure returned dialect matched */
@@ -1002,7 +1005,8 @@ int smb3_validate_negotiate(const unsigned int xid, struct cifs_tcon *tcon) · 162 unmodified lines
10021005
10031006 rc = SMB2_ioctl(xid, tcon, NO_FILE_ID, NO_FILE_ID,
10041007 FSCTL_VALIDATE_NEGOTIATE_INFO, true /* is_fsctl */,
1005− (char *)pneg_inbuf, inbuflen, (char **)&pneg_rsp, &rsplen);
1008+ (char *)pneg_inbuf, inbuflen, CIFSMaxBufSize,
1009+ (char **)&pneg_rsp, &rsplen);
10061010 if (rc == -EOPNOTSUPP) {
10071011 /*
10081012 * Old Windows versions or Netapp SMB server can return
@@ -1858,8 +1862,9 @@ add_lease_context(struct TCP_Server_Info *server, struct kvec *iov, · 849 unmodified lines
18581862 }
18591863
18601864 static struct create_durable_v2 *
1861−create_durable_v2_buf(struct cifs_fid *pfid)
1865+create_durable_v2_buf(struct cifs_open_parms *oparms)
18621866 {
1867+ struct cifs_fid *pfid = oparms->fid;
18631868 struct create_durable_v2 *buf;
18641869
18651870 buf = kzalloc(sizeof(struct create_durable_v2), GFP_KERNEL);
@@ -1873,7 +1878,14 @@ create_durable_v2_buf(struct cifs_fid *pfid) · 7 unmodified lines
18731878 (struct create_durable_v2, Name));
18741879 buf->ccontext.NameLength = cpu_to_le16(4);
18751880
1876− buf->dcontext.Timeout = 0; /* Should this be configurable by workload */
1881+ /*
1882+ * NB: Handle timeout defaults to 0, which allows server to choose
1883+ * (most servers default to 120 seconds) and most clients default to 0.
1884+ * This can be overridden at mount ("handletimeout=") if the user wants
1885+ * a different persistent (or resilient) handle timeout for all opens
1886+ * opens on a particular SMB3 mount.
1887+ */
1888+ buf->dcontext.Timeout = cpu_to_le32(oparms->tcon->handle_timeout);
18771889 buf->dcontext.Flags = cpu_to_le32(SMB2_DHANDLE_FLAG_PERSISTENT);
18781890 generate_random_uuid(buf->dcontext.CreateGuid);
18791891 memcpy(pfid->create_guid, buf->dcontext.CreateGuid, 16);
@@ -1926,7 +1938,7 @@ add_durable_v2_context(struct kvec *iov, unsigned int *num_iovec, · 46 unmodified lines
19261938 struct smb2_create_req *req = iov[0].iov_base;
19271939 unsigned int num = *num_iovec;
19281940
1929− iov[num].iov_base = create_durable_v2_buf(oparms->fid);
1941+ iov[num].iov_base = create_durable_v2_buf(oparms);
19301942 if (iov[num].iov_base == NULL)
19311943 return -ENOMEM;
19321944 iov[num].iov_len = sizeof(struct create_durable_v2);
@@ -2478,7 +2490,8 @@ creat_exit: · 545 unmodified lines
24782490 int
24792491 SMB2_ioctl_init(struct cifs_tcon *tcon, struct smb_rqst *rqst,
24802492 u64 persistent_fid, u64 volatile_fid, u32 opcode,
2481− bool is_fsctl, char *in_data, u32 indatalen)
2493+ bool is_fsctl, char *in_data, u32 indatalen,
2494+ __u32 max_response_size)
24822495 {
24832496 struct smb2_ioctl_req *req;
24842497 struct kvec *iov = rqst->rq_iov;
@@ -2520,16 +2533,21 @@ SMB2_ioctl_init(struct cifs_tcon *tcon, struct smb_rqst *rqst, · 35 unmodified lines
25202533 req->OutputCount = 0; /* MBZ */
25212534
25222535 /*
2523− * Could increase MaxOutputResponse, but that would require more
2524− * than one credit. Windows typically sets this smaller, but for some
2536+ * In most cases max_response_size is set to 16K (CIFSMaxBufSize)
2537+ * We Could increase default MaxOutputResponse, but that could require
2538+ * more credits. Windows typically sets this smaller, but for some
25252539 * ioctls it may be useful to allow server to send more. No point
25262540 * limiting what the server can send as long as fits in one credit
2527− * Unfortunately - we can not handle more than CIFS_MAX_MSG_SIZE
2528− * (by default, note that it can be overridden to make max larger)
2529− * in responses (except for read responses which can be bigger.
2530− * We may want to bump this limit up
2541+ * We can not handle more than CIFS_MAX_BUF_SIZE yet but may want
2542+ * to increase this limit up in the future.
2543+ * Note that for snapshot queries that servers like Azure expect that
2544+ * the first query be minimal size (and just used to get the number/size
2545+ * of previous versions) so response size must be specified as EXACTLY
2546+ * sizeof(struct snapshot_array) which is 16 when rounded up to multiple
2547+ * of eight bytes. Currently that is the only case where we set max
2548+ * response size smaller.
25312549 */
2532− req->MaxOutputResponse = cpu_to_le32(CIFSMaxBufSize);
2550+ req->MaxOutputResponse = cpu_to_le32(max_response_size);
25332551
25342552 if (is_fsctl)
25352553 req->Flags = cpu_to_le32(SMB2_0_IOCTL_IS_FSCTL);
@@ -2550,13 +2568,14 @@ SMB2_ioctl_free(struct smb_rqst *rqst) · 14 unmodified lines
25502568 cifs_small_buf_release(rqst->rq_iov[0].iov_base); /* request */
25512569 }
25522570
2571+
25532572 /*
25542573 * SMB2 IOCTL is used for both IOCTLs and FSCTLs
25552574 */
25562575 int
25572576 SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
25582577 u64 volatile_fid, u32 opcode, bool is_fsctl,
2559− char *in_data, u32 indatalen,
2578+ char *in_data, u32 indatalen, u32 max_out_data_len,
25602579 char **out_data, u32 *plen /* returned data len */)
25612580 {
25622581 struct smb_rqst rqst;
@@ -2593,8 +2612,8 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, · 30 unmodified lines
25932612 rqst.rq_iov = iov;
25942613 rqst.rq_nvec = SMB2_IOCTL_IOV_SIZE;
25952614
2596− rc = SMB2_ioctl_init(tcon, &rqst, persistent_fid, volatile_fid,
2597− opcode, is_fsctl, in_data, indatalen);
2615+ rc = SMB2_ioctl_init(tcon, &rqst, persistent_fid, volatile_fid, opcode,
2616+ is_fsctl, in_data, indatalen, max_out_data_len);
25982617 if (rc)
25992618 goto ioctl_exit;
26002619
@@ -2672,7 +2691,8 @@ SMB2_set_compression(const unsigned int xid, struct cifs_tcon *tcon, · 71 unmodified lines
26722691 rc = SMB2_ioctl(xid, tcon, persistent_fid, volatile_fid,
26732692 FSCTL_SET_COMPRESSION, true /* is_fsctl */,
26742693 (char *)&fsctl_input /* data input */,
2675− 2 /* in data len */, &ret_data /* out data */, NULL);
2694+ 2 /* in data len */, CIFSMaxBufSize /* max out data */,
2695+ &ret_data /* out data */, NULL);
26762696
26772697 cifs_dbg(FYI, "set compression rc %d\n", rc);
26782698
@@ -3431,8 +3451,6 @@ SMB2_read(const unsigned int xid, struct cifs_io_parms *io_parms, · 752 unmodified lines
34313451 rqst.rq_nvec = 1;
34323452
34333453 rc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, &rsp_iov);
3434− cifs_small_buf_release(req);
3435−
34363454 rsp = (struct smb2_read_rsp *)rsp_iov.iov_base;
34373455
34383456 if (rc) {
@@ -3454,6 +3472,8 @@ SMB2_read(const unsigned int xid, struct cifs_io_parms *io_parms, · 15 unmodified lines
34543472 io_parms->tcon->tid, ses->Suid,
34553473 io_parms->offset, io_parms->length);
34563474
3475+ cifs_small_buf_release(req);
3476+
34573477 *nbytes = le32_to_cpu(rsp->DataLength);
34583478 if ((*nbytes > CIFS_MAX_MSGSIZE) ||
34593479 (*nbytes > io_parms->length)) {
@@ -3752,7 +3772,6 @@ SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms, · 292 unmodified lines
37523772
37533773 rc = cifs_send_recv(xid, io_parms->tcon->ses, &rqst,
37543774 &resp_buftype, flags, &rsp_iov);
3755− cifs_small_buf_release(req);
37563775 rsp = (struct smb2_write_rsp *)rsp_iov.iov_base;
37573776
37583777 if (rc) {
@@ -3770,6 +3789,7 @@ SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms, · 11 unmodified lines
37703789 io_parms->offset, *nbytes);
37713790 }
37723791
3792+ cifs_small_buf_release(req);
37733793 free_rsp_buf(resp_buftype, rsp);
37743794 return rc;
37753795 }
fs/cifs/smb2proto.h+3−2
@@ -142,11 +142,12 @@ extern int SMB2_open_init(struct cifs_tcon *tcon, struct smb_rqst *rqst, · 141 unmodified lines
142142 extern void SMB2_open_free(struct smb_rqst *rqst);
143143 extern int SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon,
144144 u64 persistent_fid, u64 volatile_fid, u32 opcode,
145− bool is_fsctl, char *in_data, u32 indatalen,
145+ bool is_fsctl, char *in_data, u32 indatalen, u32 maxoutlen,
146146 char **out_data, u32 *plen /* returned data len */);
147147 extern int SMB2_ioctl_init(struct cifs_tcon *tcon, struct smb_rqst *rqst,
148148 u64 persistent_fid, u64 volatile_fid, u32 opcode,
149− bool is_fsctl, char *in_data, u32 indatalen);
149+ bool is_fsctl, char *in_data, u32 indatalen,
150+ __u32 max_response_size);
150151 extern void SMB2_ioctl_free(struct smb_rqst *rqst);
151152 extern int SMB2_close(const unsigned int xid, struct cifs_tcon *tcon,
152153 u64 persistent_file_id, u64 volatile_file_id);
fs/dax.c+15−0
@@ -33,6 +33,7 @@ · 32 unmodified lines
3333 #include <linux/sizes.h>
3434 #include <linux/mmu_notifier.h>
3535 #include <linux/iomap.h>
36+#include <asm/pgalloc.h>
3637 #include "internal.h"
3738
3839 #define CREATE_TRACE_POINTS
@@ -1407,7 +1408,9 @@ static vm_fault_t dax_pmd_load_hole(struct xa_state *xas, struct vm_fault *vmf, · 1368 unmodified lines
14071408 {
14081409 struct address_space *mapping = vmf->vma->vm_file->f_mapping;
14091410 unsigned long pmd_addr = vmf->address & PMD_MASK;
1411+ struct vm_area_struct *vma = vmf->vma;
14101412 struct inode *inode = mapping->host;
1413+ pgtable_t pgtable = NULL;
14111414 struct page *zero_page;
14121415 spinlock_t *ptl;
14131416 pmd_t pmd_entry;
@@ -1422,12 +1425,22 @@ static vm_fault_t dax_pmd_load_hole(struct xa_state *xas, struct vm_fault *vmf, · 8 unmodified lines
14221425 *entry = dax_insert_entry(xas, mapping, vmf, *entry, pfn,
14231426 DAX_PMD | DAX_ZERO_PAGE, false);
14241427
1428+ if (arch_needs_pgtable_deposit()) {
1429+ pgtable = pte_alloc_one(vma->vm_mm);
1430+ if (!pgtable)
1431+ return VM_FAULT_OOM;
1432+ }
1433+
14251434 ptl = pmd_lock(vmf->vma->vm_mm, vmf->pmd);
14261435 if (!pmd_none(*(vmf->pmd))) {
14271436 spin_unlock(ptl);
14281437 goto fallback;
14291438 }
14301439
1440+ if (pgtable) {
1441+ pgtable_trans_huge_deposit(vma->vm_mm, vmf->pmd, pgtable);
1442+ mm_inc_nr_ptes(vma->vm_mm);
1443+ }
14311444 pmd_entry = mk_pmd(zero_page, vmf->vma->vm_page_prot);
14321445 pmd_entry = pmd_mkhuge(pmd_entry);
14331446 set_pmd_at(vmf->vma->vm_mm, pmd_addr, vmf->pmd, pmd_entry);
@@ -1436,6 +1449,8 @@ static vm_fault_t dax_pmd_load_hole(struct xa_state *xas, struct vm_fault *vmf, · 2 unmodified lines
14361449 return VM_FAULT_NOPAGE;
14371450
14381451 fallback:
1452+ if (pgtable)
1453+ pte_free(vma->vm_mm, pgtable);
14391454 trace_dax_pmd_load_hole_fallback(inode, vmf, zero_page, *entry);
14401455 return VM_FAULT_FALLBACK;
14411456 }
fs/debugfs/inode.c+9−4
@@ -163,19 +163,24 @@ static int debugfs_show_options(struct seq_file *m, struct dentry *root) · 162 unmodified lines
163163 return 0;
164164 }
165165
166−static void debugfs_evict_inode(struct inode *inode)
166+static void debugfs_i_callback(struct rcu_head *head)
167167 {
168− truncate_inode_pages_final(&inode->i_data);
169− clear_inode(inode);
168+ struct inode *inode = container_of(head, struct inode, i_rcu);
170169 if (S_ISLNK(inode->i_mode))
171170 kfree(inode->i_link);
171+ free_inode_nonrcu(inode);
172+}
173+
174+static void debugfs_destroy_inode(struct inode *inode)
175+{
176+ call_rcu(&inode->i_rcu, debugfs_i_callback);
172177 }
173178
174179 static const struct super_operations debugfs_super_operations = {
175180 .statfs = simple_statfs,
176181 .remount_fs = debugfs_remount,
177182 .show_options = debugfs_show_options,
178− .evict_inode = debugfs_evict_inode,
183+ .destroy_inode = debugfs_destroy_inode,
179184 };
180185
181186 static void debugfs_release_dentry(struct dentry *dentry)
fs/fuse/dev.c+6−6
@@ -2056,10 +2056,8 @@ static ssize_t fuse_dev_splice_write(struct pipe_inode_info *pipe, · 2055 unmodified lines
20562056 rem += pipe->bufs[(pipe->curbuf + idx) & (pipe->buffers - 1)].len;
20572057
20582058 ret = -EINVAL;
2059− if (rem < len) {
2060− pipe_unlock(pipe);
2061− goto out;
2062− }
2059+ if (rem < len)
2060+ goto out_free;
20632061
20642062 rem = len;
20652063 while (rem) {
@@ -2077,7 +2075,9 @@ static ssize_t fuse_dev_splice_write(struct pipe_inode_info *pipe, · 11 unmodified lines
20772075 pipe->curbuf = (pipe->curbuf + 1) & (pipe->buffers - 1);
20782076 pipe->nrbufs--;
20792077 } else {
2080− pipe_buf_get(pipe, ibuf);
2078+ if (!pipe_buf_get(pipe, ibuf))
2079+ goto out_free;
2080+
20812081 *obuf = *ibuf;
20822082 obuf->flags &= ~PIPE_BUF_FLAG_GIFT;
20832083 obuf->len = rem;
@@ -2100,11 +2100,11 @@ static ssize_t fuse_dev_splice_write(struct pipe_inode_info *pipe, · 16 unmodified lines
21002100 ret = fuse_dev_do_write(fud, &cs, len);
21012101
21022102 pipe_lock(pipe);
2103+out_free:
21032104 for (idx = 0; idx < nbuf; idx++)
21042105 pipe_buf_release(pipe, &bufs[idx]);
21052106 pipe_unlock(pipe);
21062107
2107−out:
21082108 kvfree(bufs);
21092109 return ret;
21102110 }
fs/hugetlbfs/inode.c+14−6
@@ -755,11 +755,17 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, · 754 unmodified lines
755755 umode_t mode, dev_t dev)
756756 {
757757 struct inode *inode;
758− struct resv_map *resv_map;
758+ struct resv_map *resv_map = NULL;
759759
760− resv_map = resv_map_alloc();
761− if (!resv_map)
762− return NULL;
760+ /*
761+ * Reserve maps are only needed for inodes that can have associated
762+ * page allocations.
763+ */
764+ if (S_ISREG(mode) || S_ISLNK(mode)) {
765+ resv_map = resv_map_alloc();
766+ if (!resv_map)
767+ return NULL;
768+ }
763769
764770 inode = new_inode(sb);
765771 if (inode) {
@@ -794,8 +800,10 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, · 28 unmodified lines
794800 break;
795801 }
796802 lockdep_annotate_inode_mutex_key(inode);
797− } else
798− kref_put(&resv_map->refs, resv_map_release);
803+ } else {
804+ if (resv_map)
805+ kref_put(&resv_map->refs, resv_map_release);
806+ }
799807
800808 return inode;
801809 }
fs/io_uring.c+35−11
@@ -338,7 +338,7 @@ static struct io_uring_cqe *io_get_cqring(struct io_ring_ctx *ctx) · 337 unmodified lines
338338 tail = ctx->cached_cq_tail;
339339 /* See comment at the top of the file */
340340 smp_rmb();
341− if (tail + 1 == READ_ONCE(ring->r.head))
341+ if (tail - READ_ONCE(ring->r.head) == ring->ring_entries)
342342 return NULL;
343343
344344 ctx->cached_cq_tail++;
@@ -682,11 +682,9 @@ static void io_iopoll_req_issued(struct io_kiocb *req) · 337 unmodified lines
682682 list_add_tail(&req->list, &ctx->poll_list);
683683 }
684684
685−static void io_file_put(struct io_submit_state *state, struct file *file)
685+static void io_file_put(struct io_submit_state *state)
686686 {
687− if (!state) {
688− fput(file);
689− } else if (state->file) {
687+ if (state->file) {
690688 int diff = state->has_refs - state->used_refs;
691689
692690 if (diff)
@@ -711,7 +709,7 @@ static struct file *io_file_get(struct io_submit_state *state, int fd) · 18 unmodified lines
711709 state->ios_left--;
712710 return state->file;
713711 }
714− io_file_put(state, NULL);
712+ io_file_put(state);
715713 }
716714 state->file = fget_many(fd, state->ios_left);
717715 if (!state->file)
@@ -1671,7 +1669,7 @@ out: · 953 unmodified lines
16711669 static void io_submit_state_end(struct io_submit_state *state)
16721670 {
16731671 blk_finish_plug(&state->plug);
1674− io_file_put(state, NULL);
1672+ io_file_put(state);
16751673 if (state->free_reqs)
16761674 kmem_cache_free_bulk(req_cachep, state->free_reqs,
16771675 &state->reqs[state->cur_req]);
@@ -1920,6 +1918,10 @@ static int io_sq_thread(void *data) · 242 unmodified lines
19201918 unuse_mm(cur_mm);
19211919 mmput(cur_mm);
19221920 }
1921+
1922+ if (kthread_should_park())
1923+ kthread_parkme();
1924+
19231925 return 0;
19241926 }
19251927
@@ -2054,6 +2056,7 @@ static void io_sq_thread_stop(struct io_ring_ctx *ctx) · 128 unmodified lines
20542056 if (ctx->sqo_thread) {
20552057 ctx->sqo_stop = 1;
20562058 mb();
2059+ kthread_park(ctx->sqo_thread);
20572060 kthread_stop(ctx->sqo_thread);
20582061 ctx->sqo_thread = NULL;
20592062 }
@@ -2215,6 +2218,7 @@ static int io_sqe_files_register(struct io_ring_ctx *ctx, void __user *arg, · 155 unmodified lines
22152218 fput(ctx->user_files[i]);
22162219
22172220 kfree(ctx->user_files);
2221+ ctx->user_files = NULL;
22182222 ctx->nr_user_files = 0;
22192223 return ret;
22202224 }
@@ -2235,19 +2239,27 @@ static int io_sq_offload_start(struct io_ring_ctx *ctx, · 14 unmodified lines
22352239 mmgrab(current->mm);
22362240 ctx->sqo_mm = current->mm;
22372241
2238− ctx->sq_thread_idle = msecs_to_jiffies(p->sq_thread_idle);
2239− if (!ctx->sq_thread_idle)
2240− ctx->sq_thread_idle = HZ;
2241−
22422242 ret = -EINVAL;
22432243 if (!cpu_possible(p->sq_thread_cpu))
22442244 goto err;
22452245
22462246 if (ctx->flags & IORING_SETUP_SQPOLL) {
2247+ ret = -EPERM;
2248+ if (!capable(CAP_SYS_ADMIN))
2249+ goto err;
2250+
2251+ ctx->sq_thread_idle = msecs_to_jiffies(p->sq_thread_idle);
2252+ if (!ctx->sq_thread_idle)
2253+ ctx->sq_thread_idle = HZ;
2254+
22472255 if (p->flags & IORING_SETUP_SQ_AFF) {
22482256 int cpu;
22492257
22502258 cpu = array_index_nospec(p->sq_thread_cpu, NR_CPUS);
2259+ ret = -EINVAL;
2260+ if (!cpu_possible(p->sq_thread_cpu))
2261+ goto err;
2262+
22512263 ctx->sqo_thread = kthread_create_on_cpu(io_sq_thread,
22522264 ctx, cpu,
22532265 "io_uring-sq");
@@ -2917,11 +2929,23 @@ SYSCALL_DEFINE2(io_uring_setup, u32, entries, · 663 unmodified lines
29172929
29182930 static int __io_uring_register(struct io_ring_ctx *ctx, unsigned opcode,
29192931 void __user *arg, unsigned nr_args)
2932+ __releases(ctx->uring_lock)
2933+ __acquires(ctx->uring_lock)
29202934 {
29212935 int ret;
29222936
29232937 percpu_ref_kill(&ctx->refs);
2938+
2939+ /*
2940+ * Drop uring mutex before waiting for references to exit. If another
2941+ * thread is currently inside io_uring_enter() it might need to grab
2942+ * the uring_lock to make progress. If we hold it here across the drain
2943+ * wait, then we can deadlock. It's safe to drop the mutex here, since
2944+ * no new references will come in after we've killed the percpu ref.
2945+ */
2946+ mutex_unlock(&ctx->uring_lock);
29242947 wait_for_completion(&ctx->ctx_done);
2948+ mutex_lock(&ctx->uring_lock);
29252949
29262950 switch (opcode) {
29272951 case IORING_REGISTER_BUFFERS:
fs/jffs2/readinode.c+0−5
@@ -1414,11 +1414,6 @@ void jffs2_do_clear_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f) · 1413 unmodified lines
14141414
14151415 jffs2_kill_fragtree(&f->fragtree, deleted?c:NULL);
14161416
1417− if (f->target) {
1418− kfree(f->target);
1419− f->target = NULL;
1420− }
1421−
14221417 fds = f->dents;
14231418 while(fds) {
14241419 fd = fds;
fs/jffs2/super.c+4−1
@@ -47,7 +47,10 @@ static struct inode *jffs2_alloc_inode(struct super_block *sb) · 46 unmodified lines
4747 static void jffs2_i_callback(struct rcu_head *head)
4848 {
4949 struct inode *inode = container_of(head, struct inode, i_rcu);
50− kmem_cache_free(jffs2_inode_cachep, JFFS2_INODE_INFO(inode));
50+ struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
51+
52+ kfree(f->target);
53+ kmem_cache_free(jffs2_inode_cachep, f);
5154 }
5255
5356 static void jffs2_destroy_inode(struct inode *inode)
fs/nfs/nfs42proc.c+0−3
@@ -329,9 +329,6 @@ ssize_t nfs42_proc_copy(struct file *src, loff_t pos_src, · 328 unmodified lines
329329 };
330330 ssize_t err, err2;
331331
332− if (!nfs_server_capable(file_inode(dst), NFS_CAP_COPY))
333− return -EOPNOTSUPP;
334−
335332 src_lock = nfs_get_lock_context(nfs_file_open_context(src));
336333 if (IS_ERR(src_lock))
337334 return PTR_ERR(src_lock);
fs/nfs/nfs4file.c+3−1
@@ -133,8 +133,10 @@ static ssize_t nfs4_copy_file_range(struct file *file_in, loff_t pos_in, · 132 unmodified lines
133133 struct file *file_out, loff_t pos_out,
134134 size_t count, unsigned int flags)
135135 {
136+ if (!nfs_server_capable(file_inode(file_out), NFS_CAP_COPY))
137+ return -EOPNOTSUPP;
136138 if (file_inode(file_in) == file_inode(file_out))
137− return -EINVAL;
139+ return -EOPNOTSUPP;
138140 return nfs42_proc_copy(file_in, pos_in, file_out, pos_out, count);
139141 }
140142
fs/nfs/nfs4xdr.c+2−2
@@ -2589,7 +2589,7 @@ static void nfs4_xdr_enc_getacl(struct rpc_rqst *req, struct xdr_stream *xdr, · 2588 unmodified lines
25892589 ARRAY_SIZE(nfs4_acl_bitmap), &hdr);
25902590
25912591 rpc_prepare_reply_pages(req, args->acl_pages, 0,
2592− args->acl_len, replen);
2592+ args->acl_len, replen + 1);
25932593 encode_nops(&hdr);
25942594 }
25952595
@@ -2811,7 +2811,7 @@ static void nfs4_xdr_enc_fs_locations(struct rpc_rqst *req, · 215 unmodified lines
28112811 }
28122812
28132813 rpc_prepare_reply_pages(req, (struct page **)&args->page, 0,
2814− PAGE_SIZE, replen);
2814+ PAGE_SIZE, replen + 1);
28152815 encode_nops(&hdr);
28162816 }
28172817
fs/nfs/super.c+2−1
@@ -2041,7 +2041,8 @@ static int nfs23_validate_mount_data(void *options, · 2040 unmodified lines
20412041 memcpy(sap, &data->addr, sizeof(data->addr));
20422042 args->nfs_server.addrlen = sizeof(data->addr);
20432043 args->nfs_server.port = ntohs(data->addr.sin_port);
2044− if (!nfs_verify_server_address(sap))
2044+ if (sap->sa_family != AF_INET ||
2045+ !nfs_verify_server_address(sap))
20452046 goto out_no_address;
20462047
20472048 if (!(data->flags & NFS_MOUNT_TCP))
fs/open.c+18−0
@@ -1215,3 +1215,21 @@ int nonseekable_open(struct inode *inode, struct file *filp) · 1214 unmodified lines
12151215 }
12161216
12171217 EXPORT_SYMBOL(nonseekable_open);
1218+
1219+/*
1220+ * stream_open is used by subsystems that want stream-like file descriptors.
1221+ * Such file descriptors are not seekable and don't have notion of position
1222+ * (file.f_pos is always 0). Contrary to file descriptors of other regular
1223+ * files, .read() and .write() can run simultaneously.
1224+ *
1225+ * stream_open never fails and is marked to return int so that it could be
1226+ * directly used as file_operations.open .
1227+ */
1228+int stream_open(struct inode *inode, struct file *filp)
1229+{
1230+ filp->f_mode &= ~(FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE | FMODE_ATOMIC_POS);
1231+ filp->f_mode |= FMODE_STREAM;
1232+ return 0;
1233+}
1234+
1235+EXPORT_SYMBOL(stream_open);
fs/pipe.c+2−2
@@ -188,9 +188,9 @@ EXPORT_SYMBOL(generic_pipe_buf_steal); · 187 unmodified lines
188188 * in the tee() system call, when we duplicate the buffers in one
189189 * pipe into another.
190190 */
191−void generic_pipe_buf_get(struct pipe_inode_info *pipe, struct pipe_buffer *buf)
191+bool generic_pipe_buf_get(struct pipe_inode_info *pipe, struct pipe_buffer *buf)
192192 {
193− get_page(buf->page);
193+ return try_get_page(buf->page);
194194 }
195195 EXPORT_SYMBOL(generic_pipe_buf_get);
196196
fs/proc/base.c+9−8
@@ -616,24 +616,25 @@ static int proc_pid_limits(struct seq_file *m, struct pid_namespace *ns, · 615 unmodified lines
616616 static int proc_pid_syscall(struct seq_file *m, struct pid_namespace *ns,
617617 struct pid *pid, struct task_struct *task)
618618 {
619− long nr;
620− unsigned long args[6], sp, pc;
619+ struct syscall_info info;
620+ u64 *args = &info.data.args[0];
621621 int res;
622622
623623 res = lock_trace(task);
624624 if (res)
625625 return res;
626626
627− if (task_current_syscall(task, &nr, args, 6, &sp, &pc))
627+ if (task_current_syscall(task, &info))
628628 seq_puts(m, "running\n");
629− else if (nr < 0)
630− seq_printf(m, "%ld 0x%lx 0x%lx\n", nr, sp, pc);
629+ else if (info.data.nr < 0)
630+ seq_printf(m, "%d 0x%llx 0x%llx\n",
631+ info.data.nr, info.sp, info.data.instruction_pointer);
631632 else
632633 seq_printf(m,
633− "%ld 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n",
634− nr,
634+ "%d 0x%llx 0x%llx 0x%llx 0x%llx 0x%llx 0x%llx 0x%llx 0x%llx\n",
635+ info.data.nr,
635636 args[0], args[1], args[2], args[3], args[4], args[5],
636− sp, pc);
637+ info.sp, info.data.instruction_pointer);
637638 unlock_trace(task);
638639
639640 return 0;
fs/proc/task_mmu.c+18−0
@@ -1143,6 +1143,24 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf, · 1142 unmodified lines
11431143 count = -EINTR;
11441144 goto out_mm;
11451145 }
1146+ /*
1147+ * Avoid to modify vma->vm_flags
1148+ * without locked ops while the
1149+ * coredump reads the vm_flags.
1150+ */
1151+ if (!mmget_still_valid(mm)) {
1152+ /*
1153+ * Silently return "count"
1154+ * like if get_task_mm()
1155+ * failed. FIXME: should this
1156+ * function have returned
1157+ * -ESRCH if get_task_mm()
1158+ * failed like if
1159+ * get_proc_task() fails?
1160+ */
1161+ up_write(&mm->mmap_sem);
1162+ goto out_mm;
1163+ }
11461164 for (vma = mm->mmap; vma; vma = vma->vm_next) {
11471165 vma->vm_flags &= ~VM_SOFTDIRTY;
11481166 vma_set_page_prot(vma);
fs/read_write.c+3−2
@@ -560,12 +560,13 @@ ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_ · 559 unmodified lines
560560
561561 static inline loff_t file_pos_read(struct file *file)
562562 {
563− return file->f_pos;
563+ return file->f_mode & FMODE_STREAM ? 0 : file->f_pos;
564564 }
565565
566566 static inline void file_pos_write(struct file *file, loff_t pos)
567567 {
568− file->f_pos = pos;
568+ if ((file->f_mode & FMODE_STREAM) == 0)
569+ file->f_pos = pos;
569570 }
570571
571572 ssize_t ksys_read(unsigned int fd, char __user *buf, size_t count)
fs/splice.c+10−2
@@ -1593,7 +1593,11 @@ retry: · 1592 unmodified lines
15931593 * Get a reference to this pipe buffer,
15941594 * so we can copy the contents over.
15951595 */
1596− pipe_buf_get(ipipe, ibuf);
1596+ if (!pipe_buf_get(ipipe, ibuf)) {
1597+ if (ret == 0)
1598+ ret = -EFAULT;
1599+ break;
1600+ }
15971601 *obuf = *ibuf;
15981602
15991603 /*
@@ -1667,7 +1671,11 @@ static int link_pipe(struct pipe_inode_info *ipipe, · 67 unmodified lines
16671671 * Get a reference to this pipe buffer,
16681672 * so we can copy the contents over.
16691673 */
1670− pipe_buf_get(ipipe, ibuf);
1674+ if (!pipe_buf_get(ipipe, ibuf)) {
1675+ if (ret == 0)
1676+ ret = -EFAULT;
1677+ break;
1678+ }
16711679
16721680 obuf = opipe->bufs + nbuf;
16731681 *obuf = *ibuf;
fs/ubifs/super.c+1−3
@@ -276,14 +276,12 @@ static void ubifs_i_callback(struct rcu_head *head) · 275 unmodified lines
276276 {
277277 struct inode *inode = container_of(head, struct inode, i_rcu);
278278 struct ubifs_inode *ui = ubifs_inode(inode);
279+ kfree(ui->data);
279280 kmem_cache_free(ubifs_inode_slab, ui);
280281 }
281282
282283 static void ubifs_destroy_inode(struct inode *inode)
283284 {
284− struct ubifs_inode *ui = ubifs_inode(inode);
285−
286− kfree(ui->data);
287285 call_rcu(&inode->i_rcu, ubifs_i_callback);
288286 }
289287
fs/userfaultfd.c+9−0
@@ -629,6 +629,8 @@ static void userfaultfd_event_wait_completion(struct userfaultfd_ctx *ctx, · 628 unmodified lines
629629
630630 /* the various vma->vm_userfaultfd_ctx still points to it */
631631 down_write(&mm->mmap_sem);
632+ /* no task can run (and in turn coredump) yet */
633+ VM_WARN_ON(!mmget_still_valid(mm));
632634 for (vma = mm->mmap; vma; vma = vma->vm_next)
633635 if (vma->vm_userfaultfd_ctx.ctx == release_new_ctx) {
634636 vma->vm_userfaultfd_ctx = NULL_VM_UFFD_CTX;
@@ -883,6 +885,8 @@ static int userfaultfd_release(struct inode *inode, struct file *file) · 248 unmodified lines
883885 * taking the mmap_sem for writing.
884886 */
885887 down_write(&mm->mmap_sem);
888+ if (!mmget_still_valid(mm))
889+ goto skip_mm;
886890 prev = NULL;
887891 for (vma = mm->mmap; vma; vma = vma->vm_next) {
888892 cond_resched();
@@ -905,6 +909,7 @@ static int userfaultfd_release(struct inode *inode, struct file *file) · 16 unmodified lines
905909 vma->vm_flags = new_flags;
906910 vma->vm_userfaultfd_ctx = NULL_VM_UFFD_CTX;
907911 }
912+skip_mm:
908913 up_write(&mm->mmap_sem);
909914 mmput(mm);
910915 wakeup:
@@ -1333,6 +1338,8 @@ static int userfaultfd_register(struct userfaultfd_ctx *ctx, · 422 unmodified lines
13331338 goto out;
13341339
13351340 down_write(&mm->mmap_sem);
1341+ if (!mmget_still_valid(mm))
1342+ goto out_unlock;
13361343 vma = find_vma_prev(mm, start, &prev);
13371344 if (!vma)
13381345 goto out_unlock;
@@ -1520,6 +1527,8 @@ static int userfaultfd_unregister(struct userfaultfd_ctx *ctx, · 181 unmodified lines
15201527 goto out;
15211528
15221529 down_write(&mm->mmap_sem);
1530+ if (!mmget_still_valid(mm))
1531+ goto out_unlock;
15231532 vma = find_vma_prev(mm, start, &prev);
15241533 if (!vma)
15251534 goto out_unlock;
include/asm-generic/syscall.h+5−16
@@ -105,41 +105,30 @@ void syscall_set_return_value(struct task_struct *task, struct pt_regs *regs, · 104 unmodified lines
105105 * syscall_get_arguments - extract system call parameter values
106106 * @task: task of interest, must be blocked
107107 * @regs: task_pt_regs() of @task
108− * @i: argument index [0,5]
109− * @n: number of arguments; n+i must be [1,6].
110108 * @args: array filled with argument values
111109 *
112− * Fetches @n arguments to the system call starting with the @i'th argument
113− * (from 0 through 5). Argument @i is stored in @args[0], and so on.
114− * An arch inline version is probably optimal when @i and @n are constants.
110+ * Fetches 6 arguments to the system call. First argument is stored in
111+* @args[0], and so on.
115112 *
116113 * It's only valid to call this when @task is stopped for tracing on
117114 * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
118− * It's invalid to call this with @i + @n > 6; we only support system calls
119− * taking up to 6 arguments.
120115 */
121116 void syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
122− unsigned int i, unsigned int n, unsigned long *args);
117+ unsigned long *args);
123118
124119 /**
125120 * syscall_set_arguments - change system call parameter value
126121 * @task: task of interest, must be in system call entry tracing
127122 * @regs: task_pt_regs() of @task
128− * @i: argument index [0,5]
129− * @n: number of arguments; n+i must be [1,6].
130123 * @args: array of argument values to store
131124 *
132− * Changes @n arguments to the system call starting with the @i'th argument.
133− * Argument @i gets value @args[0], and so on.
134− * An arch inline version is probably optimal when @i and @n are constants.
125+ * Changes 6 arguments to the system call.
126+ * The first argument gets value @args[0], and so on.
135127 *
136128 * It's only valid to call this when @task is stopped for tracing on
137129 * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
138− * It's invalid to call this with @i + @n > 6; we only support system calls
139− * taking up to 6 arguments.
140130 */
141131 void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
142− unsigned int i, unsigned int n,
143132 const unsigned long *args);
144133
145134 /**
include/drm/drm_modeset_helper_vtables.h+4−0
@@ -418,6 +418,8 @@ struct drm_crtc_helper_funcs { · 417 unmodified lines
418418 * Drivers can use the @old_crtc_state input parameter if the operations
419419 * needed to enable the CRTC don't depend solely on the new state but
420420 * also on the transition between the old state and the new state.
421+ *
422+ * This function is optional.
421423 */
422424 void (*atomic_enable)(struct drm_crtc *crtc,
423425 struct drm_crtc_state *old_crtc_state);
@@ -441,6 +443,8 @@ struct drm_crtc_helper_funcs { · 17 unmodified lines
441443 * parameter @old_crtc_state which could be used to access the old
442444 * state. Atomic drivers should consider to use this one instead
443445 * of @disable.
446+ *
447+ * This function is optional.
444448 */
445449 void (*atomic_disable)(struct drm_crtc *crtc,
446450 struct drm_crtc_state *old_crtc_state);
include/dt-bindings/clock/sifive-fu540-prci.h+18−0
@@ -0,0 +1,18 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+/*
3+ * Copyright (C) 2018-2019 SiFive, Inc.
4+ * Wesley Terpstra
5+ * Paul Walmsley
6+ */
7+
8+#ifndef __DT_BINDINGS_CLOCK_SIFIVE_FU540_PRCI_H
9+#define __DT_BINDINGS_CLOCK_SIFIVE_FU540_PRCI_H
10+
11+/* Clock indexes for use by Device Tree data and the PRCI driver */
12+
13+#define PRCI_CLK_COREPLL 0
14+#define PRCI_CLK_DDRPLL 1
15+#define PRCI_CLK_GEMGXLPLL 2
16+#define PRCI_CLK_TLCLK 3
17+
18+#endif
include/dt-bindings/reset/amlogic,meson-g12a-reset.h+4−1
@@ -51,7 +51,10 @@ · 50 unmodified lines
5151 #define RESET_SD_EMMC_A 44
5252 #define RESET_SD_EMMC_B 45
5353 #define RESET_SD_EMMC_C 46
54−/* 47-60 */
54+/* 47 */
55+#define RESET_USB_PHY20 48
56+#define RESET_USB_PHY21 49
57+/* 50-60 */
5558 #define RESET_AUDIO_CODEC 61
5659 /* 62-63 */
5760 /* RESET2 */
include/keys/trusted.h+1−1
@@ -38,7 +38,7 @@ enum { · 37 unmodified lines
3838
3939 int TSS_authhmac(unsigned char *digest, const unsigned char *key,
4040 unsigned int keylen, unsigned char *h1,
41− unsigned char *h2, unsigned char h3, ...);
41+ unsigned char *h2, unsigned int h3, ...);
4242 int TSS_checkhmac1(unsigned char *buffer,
4343 const uint32_t command,
4444 const unsigned char *ononce,
include/linux/bio.h+12−8
@@ -120,19 +120,23 @@ static inline bool bio_full(struct bio *bio) · 119 unmodified lines
120120 return bio->bi_vcnt >= bio->bi_max_vecs;
121121 }
122122
123−#define mp_bvec_for_each_segment(bv, bvl, i, iter_all) \
124− for (bv = bvec_init_iter_all(&iter_all); \
125− (iter_all.done < (bvl)->bv_len) && \
126− (mp_bvec_next_segment((bvl), &iter_all), 1); \
127− iter_all.done += bv->bv_len, i += 1)
123+static inline bool bio_next_segment(const struct bio *bio,
124+ struct bvec_iter_all *iter)
125+{
126+ if (iter->idx >= bio->bi_vcnt)
127+ return false;
128+
129+ bvec_advance(&bio->bi_io_vec[iter->idx], iter);
130+ return true;
131+}
128132
129133 /*
130134 * drivers should _never_ use the all version - the bio may have been split
131135 * before it got to the driver and the driver won't own all of it
132136 */
133−#define bio_for_each_segment_all(bvl, bio, i, iter_all) \
134− for (i = 0, iter_all.idx = 0; iter_all.idx < (bio)->bi_vcnt; iter_all.idx++) \
135− mp_bvec_for_each_segment(bvl, &((bio)->bi_io_vec[iter_all.idx]), i, iter_all)
137+#define bio_for_each_segment_all(bvl, bio, i, iter) \
138+ for (i = 0, bvl = bvec_init_iter_all(&iter); \
139+ bio_next_segment((bio), &iter); i++)
136140
137141 static inline void bio_advance_iter(struct bio *bio, struct bvec_iter *iter,
138142 unsigned bytes)
include/linux/bitrev.h+23−23
@@ -34,41 +34,41 @@ static inline u32 __bitrev32(u32 x) · 33 unmodified lines
3434
3535 #define __constant_bitrev32(x) \
3636 ({ \
37− u32 __x = x; \
38− __x = (__x >> 16) | (__x << 16); \
39− __x = ((__x & (u32)0xFF00FF00UL) >> 8) | ((__x & (u32)0x00FF00FFUL) << 8); \
40− __x = ((__x & (u32)0xF0F0F0F0UL) >> 4) | ((__x & (u32)0x0F0F0F0FUL) << 4); \
41− __x = ((__x & (u32)0xCCCCCCCCUL) >> 2) | ((__x & (u32)0x33333333UL) << 2); \
42− __x = ((__x & (u32)0xAAAAAAAAUL) >> 1) | ((__x & (u32)0x55555555UL) << 1); \
43− __x; \
37+ u32 ___x = x; \
38+ ___x = (___x >> 16) | (___x << 16); \
39+ ___x = ((___x & (u32)0xFF00FF00UL) >> 8) | ((___x & (u32)0x00FF00FFUL) << 8); \
40+ ___x = ((___x & (u32)0xF0F0F0F0UL) >> 4) | ((___x & (u32)0x0F0F0F0FUL) << 4); \
41+ ___x = ((___x & (u32)0xCCCCCCCCUL) >> 2) | ((___x & (u32)0x33333333UL) << 2); \
42+ ___x = ((___x & (u32)0xAAAAAAAAUL) >> 1) | ((___x & (u32)0x55555555UL) << 1); \
43+ ___x; \
4444 })
4545
4646 #define __constant_bitrev16(x) \
4747 ({ \
48− u16 __x = x; \
49− __x = (__x >> 8) | (__x << 8); \
50− __x = ((__x & (u16)0xF0F0U) >> 4) | ((__x & (u16)0x0F0FU) << 4); \
51− __x = ((__x & (u16)0xCCCCU) >> 2) | ((__x & (u16)0x3333U) << 2); \
52− __x = ((__x & (u16)0xAAAAU) >> 1) | ((__x & (u16)0x5555U) << 1); \
53− __x; \
48+ u16 ___x = x; \
49+ ___x = (___x >> 8) | (___x << 8); \
50+ ___x = ((___x & (u16)0xF0F0U) >> 4) | ((___x & (u16)0x0F0FU) << 4); \
51+ ___x = ((___x & (u16)0xCCCCU) >> 2) | ((___x & (u16)0x3333U) << 2); \
52+ ___x = ((___x & (u16)0xAAAAU) >> 1) | ((___x & (u16)0x5555U) << 1); \
53+ ___x; \
5454 })
5555
5656 #define __constant_bitrev8x4(x) \
5757 ({ \
58− u32 __x = x; \
59− __x = ((__x & (u32)0xF0F0F0F0UL) >> 4) | ((__x & (u32)0x0F0F0F0FUL) << 4); \
60− __x = ((__x & (u32)0xCCCCCCCCUL) >> 2) | ((__x & (u32)0x33333333UL) << 2); \
61− __x = ((__x & (u32)0xAAAAAAAAUL) >> 1) | ((__x & (u32)0x55555555UL) << 1); \
62− __x; \
58+ u32 ___x = x; \
59+ ___x = ((___x & (u32)0xF0F0F0F0UL) >> 4) | ((___x & (u32)0x0F0F0F0FUL) << 4); \
60+ ___x = ((___x & (u32)0xCCCCCCCCUL) >> 2) | ((___x & (u32)0x33333333UL) << 2); \
61+ ___x = ((___x & (u32)0xAAAAAAAAUL) >> 1) | ((___x & (u32)0x55555555UL) << 1); \
62+ ___x; \
6363 })
6464
6565 #define __constant_bitrev8(x) \
6666 ({ \
67− u8 __x = x; \
68− __x = (__x >> 4) | (__x << 4); \
69− __x = ((__x & (u8)0xCCU) >> 2) | ((__x & (u8)0x33U) << 2); \
70− __x = ((__x & (u8)0xAAU) >> 1) | ((__x & (u8)0x55U) << 1); \
71− __x; \
67+ u8 ___x = x; \
68+ ___x = (___x >> 4) | (___x << 4); \
69+ ___x = ((___x & (u8)0xCCU) >> 2) | ((___x & (u8)0x33U) << 2); \
70+ ___x = ((___x & (u8)0xAAU) >> 1) | ((___x & (u8)0x55U) << 1); \
71+ ___x; \
7272 })
7373
7474 #define bitrev32(x) \
include/linux/blk-mq.h+1−0
@@ -302,6 +302,7 @@ void blk_mq_requeue_request(struct request *rq, bool kick_requeue_list); · 301 unmodified lines
302302 void blk_mq_kick_requeue_list(struct request_queue *q);
303303 void blk_mq_delay_kick_requeue_list(struct request_queue *q, unsigned long msecs);
304304 bool blk_mq_complete_request(struct request *rq);
305+void blk_mq_complete_request_sync(struct request *rq);
305306 bool blk_mq_bio_list_merge(struct request_queue *q, struct list_head *list,
306307 struct bio *bio);
307308 bool blk_mq_queue_stopped(struct request_queue *q);
include/linux/blkdev.h+0−1
@@ -548,7 +548,6 @@ struct request_queue { · 547 unmodified lines
548548 struct rcu_head rcu_head;
549549 wait_queue_head_t mq_freeze_wq;
550550 struct percpu_ref q_usage_counter;
551− struct list_head all_q_node;
552551
553552 struct blk_mq_tag_set *tag_set;
554553 struct list_head tag_set_list;
include/linux/bvec.h+18−6
@@ -140,26 +140,38 @@ static inline bool bvec_iter_advance(const struct bio_vec *bv, · 139 unmodified lines
140140
141141 static inline struct bio_vec *bvec_init_iter_all(struct bvec_iter_all *iter_all)
142142 {
143− iter_all->bv.bv_page = NULL;
144143 iter_all->done = 0;
144+ iter_all->idx = 0;
145145
146146 return &iter_all->bv;
147147 }
148148
149−static inline void mp_bvec_next_segment(const struct bio_vec *bvec,
150− struct bvec_iter_all *iter_all)
149+static inline struct page *bvec_nth_page(struct page *page, int idx)
150+{
151+ return idx == 0 ? page : nth_page(page, idx);
152+}
153+
154+static inline void bvec_advance(const struct bio_vec *bvec,
155+ struct bvec_iter_all *iter_all)
151156 {
152157 struct bio_vec *bv = &iter_all->bv;
153158
154− if (bv->bv_page) {
159+ if (iter_all->done) {
155160 bv->bv_page++;
156161 bv->bv_offset = 0;
157162 } else {
158− bv->bv_page = bvec->bv_page;
159− bv->bv_offset = bvec->bv_offset;
163+ bv->bv_page = bvec_nth_page(bvec->bv_page, bvec->bv_offset /
164+ PAGE_SIZE);
165+ bv->bv_offset = bvec->bv_offset & ~PAGE_MASK;
160166 }
161167 bv->bv_len = min_t(unsigned int, PAGE_SIZE - bv->bv_offset,
162168 bvec->bv_len - iter_all->done);
169+ iter_all->done += bv->bv_len;
170+
171+ if (iter_all->done == bvec->bv_len) {
172+ iter_all->idx++;
173+ iter_all->done = 0;
174+ }
163175 }
164176
165177 /*
include/linux/efi.h+6−1
@@ -1611,7 +1611,12 @@ efi_status_t efi_setup_gop(efi_system_table_t *sys_table_arg, · 1610 unmodified lines
16111611 struct screen_info *si, efi_guid_t *proto,
16121612 unsigned long size);
16131613
1614−bool efi_runtime_disabled(void);
1614+#ifdef CONFIG_EFI
1615+extern bool efi_runtime_disabled(void);
1616+#else
1617+static inline bool efi_runtime_disabled(void) { return true; }
1618+#endif
1619+
16151620 extern void efi_call_virt_check_flags(unsigned long flags, const char *call);
16161621 extern unsigned long efi_call_virt_save_flags(void);
16171622
include/linux/elevator.h+1−0
@@ -31,6 +31,7 @@ struct elevator_mq_ops { · 30 unmodified lines
3131 void (*exit_sched)(struct elevator_queue *);
3232 int (*init_hctx)(struct blk_mq_hw_ctx *, unsigned int);
3333 void (*exit_hctx)(struct blk_mq_hw_ctx *, unsigned int);
34+ void (*depth_updated)(struct blk_mq_hw_ctx *);
3435
3536 bool (*allow_merge)(struct request_queue *, struct request *, struct bio *);
3637 bool (*bio_merge)(struct blk_mq_hw_ctx *, struct bio *);
include/linux/fs.h+4−0
@@ -158,6 +158,9 @@ typedef int (dio_iodone_t)(struct kiocb *iocb, loff_t offset, · 157 unmodified lines
158158 #define FMODE_OPENED ((__force fmode_t)0x80000)
159159 #define FMODE_CREATED ((__force fmode_t)0x100000)
160160
161+/* File is stream-like */
162+#define FMODE_STREAM ((__force fmode_t)0x200000)
163+
161164 /* File was opened by fanotify and shouldn't generate fanotify events */
162165 #define FMODE_NONOTIFY ((__force fmode_t)0x4000000)
163166
@@ -3074,6 +3077,7 @@ extern loff_t no_seek_end_llseek_size(struct file *, loff_t, int, loff_t); · 2910 unmodified lines
30743077 extern loff_t no_seek_end_llseek(struct file *, loff_t, int);
30753078 extern int generic_file_open(struct inode * inode, struct file * filp);
30763079 extern int nonseekable_open(struct inode * inode, struct file * filp);
3080+extern int stream_open(struct inode * inode, struct file * filp);
30773081
30783082 #ifdef CONFIG_BLOCK
30793083 typedef void (dio_submit_t)(struct bio *bio, struct inode *inode,
include/linux/kernel.h+2−2
@@ -48,8 +48,8 @@ · 47 unmodified lines
4848
4949 #define u64_to_user_ptr(x) ( \
5050 { \
51− typecheck(u64, x); \
52− (void __user *)(uintptr_t)x; \
51+ typecheck(u64, (x)); \
52+ (void __user *)(uintptr_t)(x); \
5353 } \
5454 )
5555
include/linux/kprobes.h+1−0
@@ -173,6 +173,7 @@ struct kretprobe_instance { · 172 unmodified lines
173173 struct kretprobe *rp;
174174 kprobe_opcode_t *ret_addr;
175175 struct task_struct *task;
176+ void *fp;
176177 char data[0];
177178 };
178179
include/linux/kvm_host.h+6−4
@@ -28,6 +28,7 @@ · 27 unmodified lines
2828 #include <linux/irqbypass.h>
2929 #include <linux/swait.h>
3030 #include <linux/refcount.h>
31+#include <linux/nospec.h>
3132 #include <asm/signal.h>
3233
3334 #include <linux/kvm.h>
@@ -513,10 +514,10 @@ static inline struct kvm_io_bus *kvm_get_bus(struct kvm *kvm, enum kvm_bus idx) · 479 unmodified lines
513514
514515 static inline struct kvm_vcpu *kvm_get_vcpu(struct kvm *kvm, int i)
515516 {
516− /* Pairs with smp_wmb() in kvm_vm_ioctl_create_vcpu, in case
517− * the caller has read kvm->online_vcpus before (as is the case
518− * for kvm_for_each_vcpu, for example).
519− */
517+ int num_vcpus = atomic_read(&kvm->online_vcpus);
518+ i = array_index_nospec(i, num_vcpus);
519+
520+ /* Pairs with smp_wmb() in kvm_vm_ioctl_create_vcpu. */
520521 smp_rmb();
521522 return kvm->vcpus[i];
522523 }
@@ -600,6 +601,7 @@ void kvm_put_kvm(struct kvm *kvm); · 77 unmodified lines
600601
601602 static inline struct kvm_memslots *__kvm_memslots(struct kvm *kvm, int as_id)
602603 {
604+ as_id = array_index_nospec(as_id, KVM_ADDRESS_SPACE_NUM);
603605 return srcu_dereference_check(kvm->memslots[as_id], &kvm->srcu,
604606 lockdep_is_held(&kvm->slots_lock) ||
605607 !refcount_read(&kvm->users_count));
include/linux/memcontrol.h+4−1
@@ -566,7 +566,10 @@ struct mem_cgroup *lock_page_memcg(struct page *page); · 565 unmodified lines
566566 void __unlock_page_memcg(struct mem_cgroup *memcg);
567567 void unlock_page_memcg(struct page *page);
568568
569−/* idx can be of type enum memcg_stat_item or node_stat_item */
569+/*
570+ * idx can be of type enum memcg_stat_item or node_stat_item.
571+ * Keep in sync with memcg_exact_page_state().
572+ */
570573 static inline unsigned long memcg_page_state(struct mem_cgroup *memcg,
571574 int idx)
572575 {
include/linux/mii.h+1−1
@@ -469,7 +469,7 @@ static inline u32 linkmode_adv_to_lcl_adv_t(unsigned long *advertising) · 468 unmodified lines
469469 if (linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT,
470470 advertising))
471471 lcl_adv |= ADVERTISE_PAUSE_CAP;
472− if (linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT,
472+ if (linkmode_test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT,
473473 advertising))
474474 lcl_adv |= ADVERTISE_PAUSE_ASYM;
475475
include/linux/mlx5/driver.h+2−0
@@ -594,6 +594,8 @@ enum mlx5_pagefault_type_flags { · 593 unmodified lines
594594 };
595595
596596 struct mlx5_td {
597+ /* protects tirs list changes while tirs refresh */
598+ struct mutex list_lock;
597599 struct list_head tirs_list;
598600 u32 tdn;
599601 };
include/linux/mm.h+14−1
@@ -966,6 +966,10 @@ static inline bool is_pci_p2pdma_page(const struct page *page) · 965 unmodified lines
966966 }
967967 #endif /* CONFIG_DEV_PAGEMAP_OPS */
968968
969+/* 127: arbitrary random number, small enough to assemble well */
970+#define page_ref_zero_or_close_to_overflow(page) \
971+ ((unsigned int) page_ref_count(page) + 127u <= 127u)
972+
969973 static inline void get_page(struct page *page)
970974 {
971975 page = compound_head(page);
@@ -973,8 +977,17 @@ static inline void get_page(struct page *page) · 1 unmodified line
973977 * Getting a normal page or the head of a compound page
974978 * requires to already have an elevated page->_refcount.
975979 */
976− VM_BUG_ON_PAGE(page_ref_count(page) <= 0, page);
980+ VM_BUG_ON_PAGE(page_ref_zero_or_close_to_overflow(page), page);
981+ page_ref_inc(page);
982+}
983+
984+static inline __must_check bool try_get_page(struct page *page)
985+{
986+ page = compound_head(page);
987+ if (WARN_ON_ONCE(page_ref_count(page) <= 0))
988+ return false;
977989 page_ref_inc(page);
990+ return true;
978991 }
979992
980993 static inline void put_page(struct page *page)
include/linux/mm_types.h+1−1
@@ -671,7 +671,7 @@ enum vm_fault_reason { · 670 unmodified lines
671671
672672 /* Encode hstate index for a hwpoisoned large page */
673673 #define VM_FAULT_SET_HINDEX(x) ((__force vm_fault_t)((x) << 16))
674−#define VM_FAULT_GET_HINDEX(x) (((x) >> 16) & 0xf)
674+#define VM_FAULT_GET_HINDEX(x) (((__force unsigned int)(x) >> 16) & 0xf)
675675
676676 #define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS | \
677677 VM_FAULT_SIGSEGV | VM_FAULT_HWPOISON | \
include/linux/netdevice.h+3−0
@@ -1500,6 +1500,7 @@ struct net_device_ops { · 1499 unmodified lines
15001500 * @IFF_FAILOVER: device is a failover master device
15011501 * @IFF_FAILOVER_SLAVE: device is lower dev of a failover master device
15021502 * @IFF_L3MDEV_RX_HANDLER: only invoke the rx handler of L3 master device
1503+ * @IFF_LIVE_RENAME_OK: rename is allowed while device is up and running
15031504 */
15041505 enum netdev_priv_flags {
15051506 IFF_802_1Q_VLAN = 1<<0,
@@ -1532,6 +1533,7 @@ enum netdev_priv_flags { · 26 unmodified lines
15321533 IFF_FAILOVER = 1<<27,
15331534 IFF_FAILOVER_SLAVE = 1<<28,
15341535 IFF_L3MDEV_RX_HANDLER = 1<<29,
1536+ IFF_LIVE_RENAME_OK = 1<<30,
15351537 };
15361538
15371539 #define IFF_802_1Q_VLAN IFF_802_1Q_VLAN
@@ -1563,6 +1565,7 @@ enum netdev_priv_flags { · 25 unmodified lines
15631565 #define IFF_FAILOVER IFF_FAILOVER
15641566 #define IFF_FAILOVER_SLAVE IFF_FAILOVER_SLAVE
15651567 #define IFF_L3MDEV_RX_HANDLER IFF_L3MDEV_RX_HANDLER
1568+#define IFF_LIVE_RENAME_OK IFF_LIVE_RENAME_OK
15661569
15671570 /**
15681571 * struct net_device - The DEVICE structure.
include/linux/nvme.h+7−2
@@ -967,8 +967,13 @@ struct nvme_get_log_page_command { · 966 unmodified lines
967967 __le16 numdl;
968968 __le16 numdu;
969969 __u16 rsvd11;
970− __le32 lpol;
971− __le32 lpou;
970+ union {
971+ struct {
972+ __le32 lpol;
973+ __le32 lpou;
974+ };
975+ __le64 lpo;
976+ };
972977 __u32 rsvd14[2];
973978 };
974979
include/linux/pipe_fs_i.h+6−4
@@ -101,18 +101,20 @@ struct pipe_buf_operations { · 100 unmodified lines
101101 /*
102102 * Get a reference to the pipe buffer.
103103 */
104− void (*get)(struct pipe_inode_info *, struct pipe_buffer *);
104+ bool (*get)(struct pipe_inode_info *, struct pipe_buffer *);
105105 };
106106
107107 /**
108108 * pipe_buf_get - get a reference to a pipe_buffer
109109 * @pipe: the pipe that the buffer belongs to
110110 * @buf: the buffer to get a reference to
111+ *
112+ * Return: %true if the reference was successfully obtained.
111113 */
112−static inline void pipe_buf_get(struct pipe_inode_info *pipe,
114+static inline __must_check bool pipe_buf_get(struct pipe_inode_info *pipe,
113115 struct pipe_buffer *buf)
114116 {
115− buf->ops->get(pipe, buf);
117+ return buf->ops->get(pipe, buf);
116118 }
117119
118120 /**
@@ -171,7 +173,7 @@ struct pipe_inode_info *alloc_pipe_info(void); · 52 unmodified lines
171173 void free_pipe_info(struct pipe_inode_info *);
172174
173175 /* Generic pipe buffer ops functions */
174−void generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *);
176+bool generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *);
175177 int generic_pipe_buf_confirm(struct pipe_inode_info *, struct pipe_buffer *);
176178 int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *);
177179 void generic_pipe_buf_release(struct pipe_inode_info *, struct pipe_buffer *);
include/linux/platform_data/x86/clk-pmc-atom.h+3−0
@@ -35,10 +35,13 @@ struct pmc_clk { · 34 unmodified lines
3535 *
3636 * @base: PMC clock register base offset
3737 * @clks: pointer to set of registered clocks, typically 0..5
38+ * @critical: flag to indicate if firmware enabled pmc_plt_clks
39+ * should be marked as critial or not
3840 */
3941 struct pmc_clk_data {
4042 void __iomem *base;
4143 const struct pmc_clk *clks;
44+ bool critical;
4245 };
4346
4447 #endif /* __PLATFORM_DATA_X86_CLK_PMC_ATOM_H */
include/linux/ptrace.h+8−3
@@ -9,6 +9,13 @@ · 8 unmodified lines
99 #include <linux/bug.h> /* For BUG_ON. */
1010 #include <linux/pid_namespace.h> /* For task_active_pid_ns. */
1111 #include <uapi/linux/ptrace.h>
12+#include <linux/seccomp.h>
13+
14+/* Add sp to seccomp_data, as seccomp is user API, we don't want to modify it */
15+struct syscall_info {
16+ __u64 sp;
17+ struct seccomp_data data;
18+};
1219
1320 extern int ptrace_access_vm(struct task_struct *tsk, unsigned long addr,
1421 void *buf, int len, unsigned int gup_flags);
@@ -407,9 +414,7 @@ static inline void user_single_step_report(struct pt_regs *regs) · 392 unmodified lines
407414 #define current_user_stack_pointer() user_stack_pointer(current_pt_regs())
408415 #endif
409416
410−extern int task_current_syscall(struct task_struct *target, long *callno,
411− unsigned long args[6], unsigned int maxargs,
412− unsigned long *sp, unsigned long *pc);
417+extern int task_current_syscall(struct task_struct *target, struct syscall_info *info);
413418
414419 extern void sigaction_compat_abi(struct k_sigaction *act, struct k_sigaction *oact);
415420 #endif
include/linux/sched/mm.h+21−0
@@ -49,6 +49,27 @@ static inline void mmdrop(struct mm_struct *mm) · 48 unmodified lines
4949 __mmdrop(mm);
5050 }
5151
52+/*
53+ * This has to be called after a get_task_mm()/mmget_not_zero()
54+ * followed by taking the mmap_sem for writing before modifying the
55+ * vmas or anything the coredump pretends not to change from under it.
56+ *
57+ * NOTE: find_extend_vma() called from GUP context is the only place
58+ * that can modify the "mm" (notably the vm_start/end) under mmap_sem
59+ * for reading and outside the context of the process, so it is also
60+ * the only case that holds the mmap_sem for reading that must call
61+ * this function. Generally if the mmap_sem is hold for reading
62+ * there's no need of this check after get_task_mm()/mmget_not_zero().
63+ *
64+ * This function can be obsoleted and the check can be removed, after
65+ * the coredump code will hold the mmap_sem for writing before
66+ * invoking the ->core_dump methods.
67+ */
68+static inline bool mmget_still_valid(struct mm_struct *mm)
69+{
70+ return likely(!mm->core_state);
71+}
72+
5273 /**
5374 * mmget() - Pin the address space associated with a &struct mm_struct.
5475 * @mm: The address space to pin.
include/linux/shmem_fs.h+1−0
@@ -21,6 +21,7 @@ struct shmem_inode_info { · 20 unmodified lines
2121 struct list_head swaplist; /* chain of maybes on swap */
2222 struct shared_policy policy; /* NUMA memory alloc policy */
2323 struct simple_xattrs xattrs; /* list of xattrs */
24+ atomic_t stop_eviction; /* hold when working on inode */
2425 struct inode vfs_inode;
2526 };
2627
include/linux/string.h+3−0
@@ -150,6 +150,9 @@ extern void * memscan(void *,int,__kernel_size_t); · 149 unmodified lines
150150 #ifndef __HAVE_ARCH_MEMCMP
151151 extern int memcmp(const void *,const void *,__kernel_size_t);
152152 #endif
153+#ifndef __HAVE_ARCH_BCMP
154+extern int bcmp(const void *,const void *,__kernel_size_t);
155+#endif
153156 #ifndef __HAVE_ARCH_MEMCHR
154157 extern void * memchr(const void *,int,__kernel_size_t);
155158 #endif
include/linux/sunrpc/sched.h+0−8
@@ -304,12 +304,4 @@ rpc_clnt_swap_deactivate(struct rpc_clnt *clnt) · 303 unmodified lines
304304 }
305305 #endif /* CONFIG_SUNRPC_SWAP */
306306
307−static inline bool
308−rpc_task_need_resched(const struct rpc_task *task)
309−{
310− if (RPC_IS_QUEUED(task) || task->tk_callback)
311− return true;
312− return false;
313−}
314−
315307 #endif /* _LINUX_SUNRPC_SCHED_H_ */
include/linux/virtio_ring.h+1−1
@@ -63,7 +63,7 @@ struct virtqueue; · 62 unmodified lines
6363 /*
6464 * Creates a virtqueue and allocates the descriptor ring. If
6565 * may_reduce_num is set, then this may allocate a smaller ring than
66− * expected. The caller should query virtqueue_get_ring_size to learn
66+ * expected. The caller should query virtqueue_get_vring_size to learn
6767 * the actual size of the ring.
6868 */
6969 struct virtqueue *vring_create_virtqueue(unsigned int index,
include/net/af_rxrpc.h+3−1
@@ -61,10 +61,12 @@ int rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t, · 60 unmodified lines
6161 rxrpc_user_attach_call_t, unsigned long, gfp_t,
6262 unsigned int);
6363 void rxrpc_kernel_set_tx_length(struct socket *, struct rxrpc_call *, s64);
64−u32 rxrpc_kernel_check_life(const struct socket *, const struct rxrpc_call *);
64+bool rxrpc_kernel_check_life(const struct socket *, const struct rxrpc_call *,
65+ u32 *);
6566 void rxrpc_kernel_probe_life(struct socket *, struct rxrpc_call *);
6667 u32 rxrpc_kernel_get_epoch(struct socket *, struct rxrpc_call *);
6768 bool rxrpc_kernel_get_reply_time(struct socket *, struct rxrpc_call *,
6869 ktime_t *);
70+bool rxrpc_kernel_call_is_complete(struct rxrpc_call *);
6971
7072 #endif /* _NET_RXRPC_H */
include/net/cfg80211.h+5−0
@@ -7183,6 +7183,11 @@ void cfg80211_pmsr_complete(struct wireless_dev *wdev, · 7182 unmodified lines
71837183 #define wiphy_info(wiphy, format, args...) \
71847184 dev_info(&(wiphy)->dev, format, ##args)
71857185
7186+#define wiphy_err_ratelimited(wiphy, format, args...) \
7187+ dev_err_ratelimited(&(wiphy)->dev, format, ##args)
7188+#define wiphy_warn_ratelimited(wiphy, format, args...) \
7189+ dev_warn_ratelimited(&(wiphy)->dev, format, ##args)
7190+
71867191 #define wiphy_debug(wiphy, format, args...) \
71877192 wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
71887193
include/net/ip.h+1−1
@@ -677,7 +677,7 @@ int ip_options_get_from_user(struct net *net, struct ip_options_rcu **optp, · 676 unmodified lines
677677 unsigned char __user *data, int optlen);
678678 void ip_options_undo(struct ip_options *opt);
679679 void ip_forward_options(struct sk_buff *skb);
680−int ip_options_rcv_srr(struct sk_buff *skb);
680+int ip_options_rcv_srr(struct sk_buff *skb, struct net_device *dev);
681681
682682 /*
683683 * Functions provided by ip_sockglue.c
include/net/mac80211.h+34−29
@@ -6231,8 +6231,6 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw, · 6230 unmodified lines
62316231 * @hw: pointer as obtained from ieee80211_alloc_hw()
62326232 * @ac: AC number to return packets from.
62336233 *
6234− * Should only be called between calls to ieee80211_txq_schedule_start()
6235− * and ieee80211_txq_schedule_end().
62366234 * Returns the next txq if successful, %NULL if no queue is eligible. If a txq
62376235 * is returned, it should be returned with ieee80211_return_txq() after the
62386236 * driver has finished scheduling it.
@@ -6240,51 +6238,58 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw, · 1 unmodified line
62406238 struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac);
62416239
62426240 /**
6243− * ieee80211_return_txq - return a TXQ previously acquired by ieee80211_next_txq()
6244− *
6245− * @hw: pointer as obtained from ieee80211_alloc_hw()
6246− * @txq: pointer obtained from station or virtual interface
6247− *
6248− * Should only be called between calls to ieee80211_txq_schedule_start()
6249− * and ieee80211_txq_schedule_end().
6250− */
6251−void ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq);
6252−
6253−/**
6254− * ieee80211_txq_schedule_start - acquire locks for safe scheduling of an AC
6241+ * ieee80211_txq_schedule_start - start new scheduling round for TXQs
62556242 *
62566243 * @hw: pointer as obtained from ieee80211_alloc_hw()
62576244 * @ac: AC number to acquire locks for
62586245 *
6259− * Acquire locks needed to schedule TXQs from the given AC. Should be called
6260− * before ieee80211_next_txq() or ieee80211_return_txq().
6246+ * Should be called before ieee80211_next_txq() or ieee80211_return_txq().
6247+ * The driver must not call multiple TXQ scheduling rounds concurrently.
62616248 */
6262−void ieee80211_txq_schedule_start(struct ieee80211_hw *hw, u8 ac)
6263− __acquires(txq_lock);
6249+void ieee80211_txq_schedule_start(struct ieee80211_hw *hw, u8 ac);
6250+
6251+/* (deprecated) */
6252+static inline void ieee80211_txq_schedule_end(struct ieee80211_hw *hw, u8 ac)
6253+{
6254+}
6255+
6256+void __ieee80211_schedule_txq(struct ieee80211_hw *hw,
6257+ struct ieee80211_txq *txq, bool force);
62646258
62656259 /**
6266− * ieee80211_txq_schedule_end - release locks for safe scheduling of an AC
6260+ * ieee80211_schedule_txq - schedule a TXQ for transmission
62676261 *
62686262 * @hw: pointer as obtained from ieee80211_alloc_hw()
6269− * @ac: AC number to acquire locks for
6263+ * @txq: pointer obtained from station or virtual interface
62706264 *
6271− * Release locks previously acquired by ieee80211_txq_schedule_end().
6265+ * Schedules a TXQ for transmission if it is not already scheduled,
6266+ * even if mac80211 does not have any packets buffered.
6267+ *
6268+ * The driver may call this function if it has buffered packets for
6269+ * this TXQ internally.
62726270 */
6273−void ieee80211_txq_schedule_end(struct ieee80211_hw *hw, u8 ac)
6274− __releases(txq_lock);
6271+static inline void
6272+ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
6273+{
6274+ __ieee80211_schedule_txq(hw, txq, true);
6275+}
62756276
62766277 /**
6277− * ieee80211_schedule_txq - schedule a TXQ for transmission
6278+ * ieee80211_return_txq - return a TXQ previously acquired by ieee80211_next_txq()
62786279 *
62796280 * @hw: pointer as obtained from ieee80211_alloc_hw()
62806281 * @txq: pointer obtained from station or virtual interface
6282+ * @force: schedule txq even if mac80211 does not have any buffered packets.
62816283 *
6282− * Schedules a TXQ for transmission if it is not already scheduled. Takes a
6283− * lock, which means it must *not* be called between
6284− * ieee80211_txq_schedule_start() and ieee80211_txq_schedule_end()
6284+ * The driver may set force=true if it has buffered packets for this TXQ
6285+ * internally.
62856286 */
6286−void ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
6287− __acquires(txq_lock) __releases(txq_lock);
6287+static inline void
6288+ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq,
6289+ bool force)
6290+{
6291+ __ieee80211_schedule_txq(hw, txq, force);
6292+}
62886293
62896294 /**
62906295 * ieee80211_txq_may_transmit - check whether TXQ is allowed to transmit
include/net/net_namespace.h+1−0
@@ -59,6 +59,7 @@ struct net { · 58 unmodified lines
5959 */
6060 spinlock_t rules_mod_lock;
6161
62+ u32 hash_mix;
6263 atomic64_t cookie_gen;
6364
6465 struct list_head list; /* list of network namespaces */
include/net/netns/hash.h+2−8
@@ -2,16 +2,10 @@ · 1 unmodified line
22 #ifndef __NET_NS_HASH_H__
33 #define __NET_NS_HASH_H__
44
5−#include <asm/cache.h>
6−
7−struct net;
5+#include <net/net_namespace.h>
86
97 static inline u32 net_hash_mix(const struct net *net)
108 {
11−#ifdef CONFIG_NET_NS
12− return (u32)(((unsigned long)net) >> ilog2(sizeof(*net)));
13−#else
14− return 0;
15−#endif
9+ return net->hash_mix;
1610 }
1711 #endif
include/net/netrom.h+1−1
@@ -266,7 +266,7 @@ void nr_stop_idletimer(struct sock *); · 265 unmodified lines
266266 int nr_t1timer_running(struct sock *);
267267
268268 /* sysctl_net_netrom.c */
269−void nr_register_sysctl(void);
269+int nr_register_sysctl(void);
270270 void nr_unregister_sysctl(void);
271271
272272 #endif
include/net/nfc/nci_core.h+1−1
@@ -166,7 +166,7 @@ struct nci_conn_info { · 165 unmodified lines
166166 * According to specification 102 622 chapter 4.4 Pipes,
167167 * the pipe identifier is 7 bits long.
168168 */
169−#define NCI_HCI_MAX_PIPES 127
169+#define NCI_HCI_MAX_PIPES 128
170170
171171 struct nci_hci_gate {
172172 u8 gate;
include/net/sch_generic.h+37−7
@@ -923,6 +923,41 @@ static inline void qdisc_qstats_overlimit(struct Qdisc *sch) · 922 unmodified lines
923923 sch->qstats.overlimits++;
924924 }
925925
926+static inline int qdisc_qstats_copy(struct gnet_dump *d, struct Qdisc *sch)
927+{
928+ __u32 qlen = qdisc_qlen_sum(sch);
929+
930+ return gnet_stats_copy_queue(d, sch->cpu_qstats, &sch->qstats, qlen);
931+}
932+
933+static inline void qdisc_qstats_qlen_backlog(struct Qdisc *sch, __u32 *qlen,
934+ __u32 *backlog)
935+{
936+ struct gnet_stats_queue qstats = { 0 };
937+ __u32 len = qdisc_qlen_sum(sch);
938+
939+ __gnet_stats_copy_queue(&qstats, sch->cpu_qstats, &sch->qstats, len);
940+ *qlen = qstats.qlen;
941+ *backlog = qstats.backlog;
942+}
943+
944+static inline void qdisc_tree_flush_backlog(struct Qdisc *sch)
945+{
946+ __u32 qlen, backlog;
947+
948+ qdisc_qstats_qlen_backlog(sch, &qlen, &backlog);
949+ qdisc_tree_reduce_backlog(sch, qlen, backlog);
950+}
951+
952+static inline void qdisc_purge_queue(struct Qdisc *sch)
953+{
954+ __u32 qlen, backlog;
955+
956+ qdisc_qstats_qlen_backlog(sch, &qlen, &backlog);
957+ qdisc_reset(sch);
958+ qdisc_tree_reduce_backlog(sch, qlen, backlog);
959+}
960+
926961 static inline void qdisc_skb_head_init(struct qdisc_skb_head *qh)
927962 {
928963 qh->head = NULL;
@@ -1106,13 +1141,8 @@ static inline struct Qdisc *qdisc_replace(struct Qdisc *sch, struct Qdisc *new, · 177 unmodified lines
11061141 sch_tree_lock(sch);
11071142 old = *pold;
11081143 *pold = new;
1109− if (old != NULL) {
1110− unsigned int qlen = old->q.qlen;
1111− unsigned int backlog = old->qstats.backlog;
1112−
1113− qdisc_reset(old);
1114− qdisc_tree_reduce_backlog(old, qlen, backlog);
1115− }
1144+ if (old != NULL)
1145+ qdisc_tree_flush_backlog(old);
11161146 sch_tree_unlock(sch);
11171147
11181148 return old;
include/net/sock.h+0−6
@@ -2084,12 +2084,6 @@ static inline bool skwq_has_sleeper(struct socket_wq *wq) · 2083 unmodified lines
20842084 * @p: poll_table
20852085 *
20862086 * See the comments in the wq_has_sleeper function.
2087− *
2088− * Do not derive sock from filp->private_data here. An SMC socket establishes
2089− * an internal TCP socket that is used in the fallback case. All socket
2090− * operations on the SMC socket are then forwarded to the TCP socket. In case of
2091− * poll, the filp->private_data pointer references the SMC socket because the
2092− * TCP socket has no file assigned.
20932087 */
20942088 static inline void sock_poll_wait(struct file *filp, struct socket *sock,
20952089 poll_table *p)
include/net/tls.h+3−1
@@ -307,6 +307,7 @@ int tls_device_sendmsg(struct sock *sk, struct msghdr *msg, size_t size); · 306 unmodified lines
307307 int tls_device_sendpage(struct sock *sk, struct page *page,
308308 int offset, size_t size, int flags);
309309 void tls_device_sk_destruct(struct sock *sk);
310+void tls_device_free_resources_tx(struct sock *sk);
310311 void tls_device_init(void);
311312 void tls_device_cleanup(void);
312313 int tls_tx_records(struct sock *sk, int flags);
@@ -330,6 +331,7 @@ int tls_push_sg(struct sock *sk, struct tls_context *ctx, · 17 unmodified lines
330331 int flags);
331332 int tls_push_partial_record(struct sock *sk, struct tls_context *ctx,
332333 int flags);
334+bool tls_free_partial_record(struct sock *sk, struct tls_context *ctx);
333335
334336 static inline struct tls_msg *tls_msg(struct sk_buff *skb)
335337 {
@@ -379,7 +381,7 @@ tls_validate_xmit_skb(struct sock *sk, struct net_device *dev, · 43 unmodified lines
379381 static inline bool tls_is_sk_tx_device_offloaded(struct sock *sk)
380382 {
381383 #ifdef CONFIG_SOCK_VALIDATE_XMIT
382− return sk_fullsock(sk) &
384+ return sk_fullsock(sk) &&
383385 (smp_load_acquire(&sk->sk_validate_xmit_skb) ==
384386 &tls_validate_xmit_skb);
385387 #else
include/sound/soc.h+9−2
@@ -802,8 +802,13 @@ struct snd_soc_component_driver { · 801 unmodified lines
802802 int probe_order;
803803 int remove_order;
804804
805− /* signal if the module handling the component cannot be removed */
806− unsigned int ignore_module_refcount:1;
805+ /*
806+ * signal if the module handling the component should not be removed
807+ * if a pcm is open. Setting this would prevent the module
808+ * refcount being incremented in probe() but allow it be incremented
809+ * when a pcm is opened and decremented when it is closed.
810+ */
811+ unsigned int module_get_upon_open:1;
807812
808813 /* bits */
809814 unsigned int idle_bias_on:1;
@@ -1083,6 +1088,8 @@ struct snd_soc_card { · 273 unmodified lines
10831088 struct mutex mutex;
10841089 struct mutex dapm_mutex;
10851090
1091+ spinlock_t dpcm_lock;
1092+
10861093 bool instantiated;
10871094 bool topology_shortname_created;
10881095
include/trace/events/syscalls.h+1−1
@@ -28,7 +28,7 @@ TRACE_EVENT_FN(sys_enter, · 27 unmodified lines
2828
2929 TP_fast_assign(
3030 __entry->id = id;
31− syscall_get_arguments(current, regs, 0, 6, __entry->args);
31+ syscall_get_arguments(current, regs, __entry->args);
3232 ),
3333
3434 TP_printk("NR %ld (%lx, %lx, %lx, %lx, %lx, %lx)",
include/uapi/linux/ethtool.h+1−1
@@ -1591,7 +1591,7 @@ enum ethtool_link_mode_bit_indices { · 1590 unmodified lines
15911591
15921592 static inline int ethtool_validate_speed(__u32 speed)
15931593 {
1594− return speed <= INT_MAX || speed == SPEED_UNKNOWN;
1594+ return speed <= INT_MAX || speed == (__u32)SPEED_UNKNOWN;
15951595 }
15961596
15971597 /* Duplex, half or full. */
include/uapi/linux/input-event-codes.h+4−2
@@ -439,10 +439,12 @@ · 438 unmodified lines
439439 #define KEY_TITLE 0x171
440440 #define KEY_SUBTITLE 0x172
441441 #define KEY_ANGLE 0x173
442−#define KEY_ZOOM 0x174
442+#define KEY_FULL_SCREEN 0x174 /* AC View Toggle */
443+#define KEY_ZOOM KEY_FULL_SCREEN
443444 #define KEY_MODE 0x175
444445 #define KEY_KEYBOARD 0x176
445−#define KEY_SCREEN 0x177
446+#define KEY_ASPECT_RATIO 0x177 /* HUTRR37: Aspect */
447+#define KEY_SCREEN KEY_ASPECT_RATIO
446448 #define KEY_PC 0x178 /* Media Select Computer */
447449 #define KEY_TV 0x179 /* Media Select TV */
448450 #define KEY_TV2 0x17a /* Media Select Cable */
include/uapi/sound/asound.h+1−0
@@ -32,6 +32,7 @@ · 31 unmodified lines
3232
3333 #ifndef __KERNEL__
3434 #include <stdlib.h>
35+#include <time.h>
3536 #endif
3637
3738 /*
init/main.c+2−2
@@ -582,6 +582,8 @@ asmlinkage __visible void __init start_kernel(void) · 581 unmodified lines
582582 page_alloc_init();
583583
584584 pr_notice("Kernel command line: %s\n", boot_command_line);
585+ /* parameters may set static keys */
586+ jump_label_init();
585587 parse_early_param();
586588 after_dashes = parse_args("Booting kernel",
587589 static_command_line, __start___param,
@@ -591,8 +593,6 @@ asmlinkage __visible void __init start_kernel(void) · 3 unmodified lines
591593 parse_args("Setting init args", after_dashes, NULL, 0, -1, -1,
592594 NULL, set_init_arg);
593595
594− jump_label_init();
595−
596596 /*
597597 * These use large bootmem allocations and must precede
598598 * kmem_cache_init()
kernel/bpf/cpumap.c+10−3
@@ -162,10 +162,14 @@ static void cpu_map_kthread_stop(struct work_struct *work) · 161 unmodified lines
162162 static struct sk_buff *cpu_map_build_skb(struct bpf_cpu_map_entry *rcpu,
163163 struct xdp_frame *xdpf)
164164 {
165+ unsigned int hard_start_headroom;
165166 unsigned int frame_size;
166167 void *pkt_data_start;
167168 struct sk_buff *skb;
168169
170+ /* Part of headroom was reserved to xdpf */
171+ hard_start_headroom = sizeof(struct xdp_frame) + xdpf->headroom;
172+
169173 /* build_skb need to place skb_shared_info after SKB end, and
170174 * also want to know the memory "truesize". Thus, need to
171175 * know the memory frame size backing xdp_buff.
@@ -183,15 +187,15 @@ static struct sk_buff *cpu_map_build_skb(struct bpf_cpu_map_entry *rcpu, · 11 unmodified lines
183187 * is not at a fixed memory location, with mixed length
184188 * packets, which is bad for cache-line hotness.
185189 */
186− frame_size = SKB_DATA_ALIGN(xdpf->len + xdpf->headroom) +
190+ frame_size = SKB_DATA_ALIGN(xdpf->len + hard_start_headroom) +
187191 SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
188192
189− pkt_data_start = xdpf->data - xdpf->headroom;
193+ pkt_data_start = xdpf->data - hard_start_headroom;
190194 skb = build_skb(pkt_data_start, frame_size);
191195 if (!skb)
192196 return NULL;
193197
194− skb_reserve(skb, xdpf->headroom);
198+ skb_reserve(skb, hard_start_headroom);
195199 __skb_put(skb, xdpf->len);
196200 if (xdpf->metasize)
197201 skb_metadata_set(skb, xdpf->metasize);
@@ -205,6 +209,9 @@ static struct sk_buff *cpu_map_build_skb(struct bpf_cpu_map_entry *rcpu, · 7 unmodified lines
205209 * - RX ring dev queue index (skb_record_rx_queue)
206210 */
207211
212+ /* Allow SKB to reuse area used by xdp_frame */
213+ xdp_scrub_frame(xdpf);
214+
208215 return skb;
209216 }
210217
kernel/bpf/inode.c+18−14
@@ -554,19 +554,6 @@ struct bpf_prog *bpf_prog_get_type_path(const char *name, enum bpf_prog_type typ · 553 unmodified lines
554554 }
555555 EXPORT_SYMBOL(bpf_prog_get_type_path);
556556
557−static void bpf_evict_inode(struct inode *inode)
558−{
559− enum bpf_type type;
560−
561− truncate_inode_pages_final(&inode->i_data);
562− clear_inode(inode);
563−
564− if (S_ISLNK(inode->i_mode))
565− kfree(inode->i_link);
566− if (!bpf_inode_type(inode, &type))
567− bpf_any_put(inode->i_private, type);
568−}
569−
570557 /*
571558 * Display the mount options in /proc/mounts.
572559 */
@@ -579,11 +566,28 @@ static int bpf_show_options(struct seq_file *m, struct dentry *root) · 6 unmodified lines
579566 return 0;
580567 }
581568
569+static void bpf_destroy_inode_deferred(struct rcu_head *head)
570+{
571+ struct inode *inode = container_of(head, struct inode, i_rcu);
572+ enum bpf_type type;
573+
574+ if (S_ISLNK(inode->i_mode))
575+ kfree(inode->i_link);
576+ if (!bpf_inode_type(inode, &type))
577+ bpf_any_put(inode->i_private, type);
578+ free_inode_nonrcu(inode);
579+}
580+
581+static void bpf_destroy_inode(struct inode *inode)
582+{
583+ call_rcu(&inode->i_rcu, bpf_destroy_inode_deferred);
584+}
585+
582586 static const struct super_operations bpf_super_ops = {
583587 .statfs = simple_statfs,
584588 .drop_inode = generic_delete_inode,
585589 .show_options = bpf_show_options,
586− .evict_inode = bpf_evict_inode,
590+ .destroy_inode = bpf_destroy_inode,
587591 };
588592
589593 enum {
kernel/bpf/verifier.c+3−2
@@ -1897,8 +1897,9 @@ continue_func: · 1896 unmodified lines
18971897 }
18981898 frame++;
18991899 if (frame >= MAX_CALL_FRAMES) {
1900− WARN_ONCE(1, "verifier bug. Call stack is too deep\n");
1901− return -EFAULT;
1900+ verbose(env, "the call stack of %d frames is too deep !\n",
1901+ frame);
1902+ return -E2BIG;
19021903 }
19031904 goto process_func;
19041905 }
kernel/dma/debug.c+1−1
@@ -706,7 +706,7 @@ static struct dma_debug_entry *dma_entry_alloc(void) · 705 unmodified lines
706706 #ifdef CONFIG_STACKTRACE
707707 entry->stacktrace.max_entries = DMA_DEBUG_STACKTRACE_ENTRIES;
708708 entry->stacktrace.entries = entry->st_entries;
709− entry->stacktrace.skip = 2;
709+ entry->stacktrace.skip = 1;
710710 save_stack_trace(&entry->stacktrace);
711711 #endif
712712
kernel/events/core.c+64−25
@@ -2009,8 +2009,8 @@ event_sched_out(struct perf_event *event, · 2008 unmodified lines
20092009 event->pmu->del(event, 0);
20102010 event->oncpu = -1;
20112011
2012− if (event->pending_disable) {
2013− event->pending_disable = 0;
2012+ if (READ_ONCE(event->pending_disable) >= 0) {
2013+ WRITE_ONCE(event->pending_disable, -1);
20142014 state = PERF_EVENT_STATE_OFF;
20152015 }
20162016 perf_event_set_state(event, state);
@@ -2198,7 +2198,8 @@ EXPORT_SYMBOL_GPL(perf_event_disable); · 181 unmodified lines
21982198
21992199 void perf_event_disable_inatomic(struct perf_event *event)
22002200 {
2201− event->pending_disable = 1;
2201+ WRITE_ONCE(event->pending_disable, smp_processor_id());
2202+ /* can fail, see perf_pending_event_disable() */
22022203 irq_work_queue(&event->pending);
22032204 }
22042205
@@ -5810,10 +5811,45 @@ void perf_event_wakeup(struct perf_event *event) · 3605 unmodified lines
58105811 }
58115812 }
58125813
5814+static void perf_pending_event_disable(struct perf_event *event)
5815+{
5816+ int cpu = READ_ONCE(event->pending_disable);
5817+
5818+ if (cpu < 0)
5819+ return;
5820+
5821+ if (cpu == smp_processor_id()) {
5822+ WRITE_ONCE(event->pending_disable, -1);
5823+ perf_event_disable_local(event);
5824+ return;
5825+ }
5826+
5827+ /*
5828+ * CPU-A CPU-B
5829+ *
5830+ * perf_event_disable_inatomic()
5831+ * @pending_disable = CPU-A;
5832+ * irq_work_queue();
5833+ *
5834+ * sched-out
5835+ * @pending_disable = -1;
5836+ *
5837+ * sched-in
5838+ * perf_event_disable_inatomic()
5839+ * @pending_disable = CPU-B;
5840+ * irq_work_queue(); // FAILS
5841+ *
5842+ * irq_work_run()
5843+ * perf_pending_event()
5844+ *
5845+ * But the event runs on CPU-B and wants disabling there.
5846+ */
5847+ irq_work_queue_on(&event->pending, cpu);
5848+}
5849+
58135850 static void perf_pending_event(struct irq_work *entry)
58145851 {
5815− struct perf_event *event = container_of(entry,
5816− struct perf_event, pending);
5852+ struct perf_event *event = container_of(entry, struct perf_event, pending);
58175853 int rctx;
58185854
58195855 rctx = perf_swevent_get_recursion_context();
@@ -5822,10 +5858,7 @@ static void perf_pending_event(struct irq_work *entry) · 2 unmodified lines
58225858 * and we won't recurse 'further'.
58235859 */
58245860
5825− if (event->pending_disable) {
5826− event->pending_disable = 0;
5827− perf_event_disable_local(event);
5828− }
5861+ perf_pending_event_disable(event);
58295862
58305863 if (event->pending_wakeup) {
58315864 event->pending_wakeup = 0;
@@ -9044,26 +9077,29 @@ static void perf_event_addr_filters_apply(struct perf_event *event) · 3212 unmodified lines
90449077 if (task == TASK_TOMBSTONE)
90459078 return;
90469079
9047− if (!ifh->nr_file_filters)
9048− return;
9049−
9050− mm = get_task_mm(event->ctx->task);
9051− if (!mm)
9052− goto restart;
9080+ if (ifh->nr_file_filters) {
9081+ mm = get_task_mm(event->ctx->task);
9082+ if (!mm)
9083+ goto restart;
90539084
9054− down_read(&mm->mmap_sem);
9085+ down_read(&mm->mmap_sem);
9086+ }
90559087
90569088 raw_spin_lock_irqsave(&ifh->lock, flags);
90579089 list_for_each_entry(filter, &ifh->list, entry) {
9058− event->addr_filter_ranges[count].start = 0;
9059− event->addr_filter_ranges[count].size = 0;
9090+ if (filter->path.dentry) {
9091+ /*
9092+ * Adjust base offset if the filter is associated to a
9093+ * binary that needs to be mapped:
9094+ */
9095+ event->addr_filter_ranges[count].start = 0;
9096+ event->addr_filter_ranges[count].size = 0;
90609097
9061− /*
9062− * Adjust base offset if the filter is associated to a binary
9063− * that needs to be mapped:
9064− */
9065− if (filter->path.dentry)
90669098 perf_addr_filter_apply(filter, mm, &event->addr_filter_ranges[count]);
9099+ } else {
9100+ event->addr_filter_ranges[count].start = filter->offset;
9101+ event->addr_filter_ranges[count].size = filter->size;
9102+ }
90679103
90689104 count++;
90699105 }
@@ -9071,9 +9107,11 @@ static void perf_event_addr_filters_apply(struct perf_event *event) · 1 unmodified line
90719107 event->addr_filters_gen++;
90729108 raw_spin_unlock_irqrestore(&ifh->lock, flags);
90739109
9074− up_read(&mm->mmap_sem);
9110+ if (ifh->nr_file_filters) {
9111+ up_read(&mm->mmap_sem);
90759112
9076− mmput(mm);
9113+ mmput(mm);
9114+ }
90779115
90789116 restart:
90799117 perf_event_stop(event, 1);
@@ -10236,6 +10274,7 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu, · 1156 unmodified lines
1023610274
1023710275
1023810276 init_waitqueue_head(&event->waitq);
10277+ event->pending_disable = -1;
1023910278 init_irq_work(&event->pending, perf_pending_event);
1024010279
1024110280 mutex_init(&event->mmap_mutex);
kernel/events/ring_buffer.c+17−20
@@ -392,7 +392,7 @@ void *perf_aux_output_begin(struct perf_output_handle *handle, · 391 unmodified lines
392392 * store that will be enabled on successful return
393393 */
394394 if (!handle->size) { /* A, matches D */
395− event->pending_disable = 1;
395+ event->pending_disable = smp_processor_id();
396396 perf_output_wakeup(handle);
397397 local_set(&rb->aux_nest, 0);
398398 goto err_put;
@@ -455,24 +455,21 @@ void perf_aux_output_end(struct perf_output_handle *handle, unsigned long size) · 56 unmodified lines
455455 rb->aux_head += size;
456456 }
457457
458− if (size || handle->aux_flags) {
459− /*
460− * Only send RECORD_AUX if we have something useful to communicate
461− *
462− * Note: the OVERWRITE records by themselves are not considered
463− * useful, as they don't communicate any *new* information,
464− * aside from the short-lived offset, that becomes history at
465− * the next event sched-in and therefore isn't useful.
466− * The userspace that needs to copy out AUX data in overwrite
467− * mode should know to use user_page::aux_head for the actual
468− * offset. So, from now on we don't output AUX records that
469− * have *only* OVERWRITE flag set.
470− */
471−
472− if (handle->aux_flags & ~(u64)PERF_AUX_FLAG_OVERWRITE)
473− perf_event_aux_event(handle->event, aux_head, size,
474− handle->aux_flags);
475− }
458+ /*
459+ * Only send RECORD_AUX if we have something useful to communicate
460+ *
461+ * Note: the OVERWRITE records by themselves are not considered
462+ * useful, as they don't communicate any *new* information,
463+ * aside from the short-lived offset, that becomes history at
464+ * the next event sched-in and therefore isn't useful.
465+ * The userspace that needs to copy out AUX data in overwrite
466+ * mode should know to use user_page::aux_head for the actual
467+ * offset. So, from now on we don't output AUX records that
468+ * have *only* OVERWRITE flag set.
469+ */
470+ if (size || (handle->aux_flags & ~(u64)PERF_AUX_FLAG_OVERWRITE))
471+ perf_event_aux_event(handle->event, aux_head, size,
472+ handle->aux_flags);
476473
477474 rb->user_page->aux_head = rb->aux_head;
478475 if (rb_need_aux_wakeup(rb))
@@ -480,7 +477,7 @@ void perf_aux_output_end(struct perf_output_handle *handle, unsigned long size) · 1 unmodified line
480477
481478 if (wakeup) {
482479 if (handle->aux_flags & PERF_AUX_FLAG_TRUNCATED)
483− handle->event->pending_disable = 1;
480+ handle->event->pending_disable = smp_processor_id();
484481 perf_output_wakeup(handle);
485482 }
486483
kernel/irq/chip.c+4−0
@@ -1449,6 +1449,10 @@ int irq_chip_set_vcpu_affinity_parent(struct irq_data *data, void *vcpu_info) · 1448 unmodified lines
14491449 int irq_chip_set_wake_parent(struct irq_data *data, unsigned int on)
14501450 {
14511451 data = data->parent_data;
1452+
1453+ if (data->chip->flags & IRQCHIP_SKIP_SET_WAKE)
1454+ return 0;
1455+
14521456 if (data->chip->irq_set_wake)
14531457 return data->chip->irq_set_wake(data, on);
14541458
kernel/irq/irqdesc.c+1−0
@@ -558,6 +558,7 @@ int __init early_irq_init(void) · 557 unmodified lines
558558 alloc_masks(&desc[i], node);
559559 raw_spin_lock_init(&desc[i].lock);
560560 lockdep_set_class(&desc[i].lock, &irq_desc_lock_class);
561+ mutex_init(&desc[i].request_mutex);
561562 desc_set_defaults(i, &desc[i], node, NULL, NULL);
562563 }
563564 return arch_early_irq_init();
kernel/kprobes.c+2−4
@@ -709,7 +709,6 @@ static void unoptimize_kprobe(struct kprobe *p, bool force) · 708 unmodified lines
709709 static int reuse_unused_kprobe(struct kprobe *ap)
710710 {
711711 struct optimized_kprobe *op;
712− int ret;
713712
714713 /*
715714 * Unused kprobe MUST be on the way of delayed unoptimizing (means
@@ -720,9 +719,8 @@ static int reuse_unused_kprobe(struct kprobe *ap) · 4 unmodified lines
720719 /* Enable the probe again */
721720 ap->flags &= ~KPROBE_FLAG_DISABLED;
722721 /* Optimize it again (remove from op->list) */
723− ret = kprobe_optready(ap);
724− if (ret)
725− return ret;
722+ if (!kprobe_optready(ap))
723+ return -EINVAL;
726724
727725 optimize_kprobe(ap);
728726 return 0;
kernel/locking/lockdep.c+8−12
@@ -4689,8 +4689,8 @@ static void free_zapped_rcu(struct rcu_head *ch) · 4688 unmodified lines
46894689 return;
46904690
46914691 raw_local_irq_save(flags);
4692− if (!graph_lock())
4693− goto out_irq;
4692+ arch_spin_lock(&lockdep_lock);
4693+ current->lockdep_recursion = 1;
46944694
46954695 /* closed head */
46964696 pf = delayed_free.pf + (delayed_free.index ^ 1);
@@ -4702,8 +4702,8 @@ static void free_zapped_rcu(struct rcu_head *ch) · 5 unmodified lines
47024702 */
47034703 call_rcu_zapped(delayed_free.pf + delayed_free.index);
47044704
4705− graph_unlock();
4706−out_irq:
4705+ current->lockdep_recursion = 0;
4706+ arch_spin_unlock(&lockdep_lock);
47074707 raw_local_irq_restore(flags);
47084708 }
47094709
@@ -4744,21 +4744,17 @@ static void lockdep_free_key_range_reg(void *start, unsigned long size) · 34 unmodified lines
47444744 {
47454745 struct pending_free *pf;
47464746 unsigned long flags;
4747− int locked;
47484747
47494748 init_data_structures_once();
47504749
47514750 raw_local_irq_save(flags);
4752− locked = graph_lock();
4753− if (!locked)
4754− goto out_irq;
4755−
4751+ arch_spin_lock(&lockdep_lock);
4752+ current->lockdep_recursion = 1;
47564753 pf = get_pending_free();
47574754 __lockdep_free_key_range(pf, start, size);
47584755 call_rcu_zapped(pf);
4759−
4760− graph_unlock();
4761−out_irq:
4756+ current->lockdep_recursion = 0;
4757+ arch_spin_unlock(&lockdep_lock);
47624758 raw_local_irq_restore(flags);
47634759
47644760 /*
kernel/sched/deadline.c+1−2
@@ -252,7 +252,6 @@ static void task_non_contending(struct task_struct *p) · 251 unmodified lines
252252 if (dl_entity_is_special(dl_se))
253253 return;
254254
255− WARN_ON(hrtimer_active(&dl_se->inactive_timer));
256255 WARN_ON(dl_se->dl_non_contending);
257256
258257 zerolag_time = dl_se->deadline -
@@ -269,7 +268,7 @@ static void task_non_contending(struct task_struct *p) · 10 unmodified lines
269268 * If the "0-lag time" already passed, decrease the active
270269 * utilization now, instead of starting a timer
271270 */
272− if (zerolag_time < 0) {
271+ if ((zerolag_time < 0) || hrtimer_active(&dl_se->inactive_timer)) {
273272 if (dl_task(p))
274273 sub_running_bw(dl_se, dl_rq);
275274 if (!dl_task(p) || p->state == TASK_DEAD) {
kernel/sched/fair.c+28−3
@@ -4885,6 +4885,8 @@ static enum hrtimer_restart sched_cfs_slack_timer(struct hrtimer *timer) · 4884 unmodified lines
48854885 return HRTIMER_NORESTART;
48864886 }
48874887
4888+extern const u64 max_cfs_quota_period;
4889+
48884890 static enum hrtimer_restart sched_cfs_period_timer(struct hrtimer *timer)
48894891 {
48904892 struct cfs_bandwidth *cfs_b =
@@ -4892,6 +4894,7 @@ static enum hrtimer_restart sched_cfs_period_timer(struct hrtimer *timer) · 1 unmodified line
48924894 unsigned long flags;
48934895 int overrun;
48944896 int idle = 0;
4897+ int count = 0;
48954898
48964899 raw_spin_lock_irqsave(&cfs_b->lock, flags);
48974900 for (;;) {
@@ -4899,6 +4902,28 @@ static enum hrtimer_restart sched_cfs_period_timer(struct hrtimer *timer) · 1 unmodified line
48994902 if (!overrun)
49004903 break;
49014904
4905+ if (++count > 3) {
4906+ u64 new, old = ktime_to_ns(cfs_b->period);
4907+
4908+ new = (old * 147) / 128; /* ~115% */
4909+ new = min(new, max_cfs_quota_period);
4910+
4911+ cfs_b->period = ns_to_ktime(new);
4912+
4913+ /* since max is 1s, this is limited to 1e9^2, which fits in u64 */
4914+ cfs_b->quota *= new;
4915+ cfs_b->quota = div64_u64(cfs_b->quota, old);
4916+
4917+ pr_warn_ratelimited(
4918+ "cfs_period_timer[cpu%d]: period too short, scaling up (new cfs_period_us %lld, cfs_quota_us = %lld)\n",
4919+ smp_processor_id(),
4920+ div_u64(new, NSEC_PER_USEC),
4921+ div_u64(cfs_b->quota, NSEC_PER_USEC));
4922+
4923+ /* reset count so we don't come right back in here */
4924+ count = 0;
4925+ }
4926+
49024927 idle = do_sched_cfs_period_timer(cfs_b, overrun, flags);
49034928 }
49044929 if (idle)
@@ -7784,10 +7809,10 @@ static void update_cfs_rq_h_load(struct cfs_rq *cfs_rq) · 2879 unmodified lines
77847809 if (cfs_rq->last_h_load_update == now)
77857810 return;
77867811
7787− cfs_rq->h_load_next = NULL;
7812+ WRITE_ONCE(cfs_rq->h_load_next, NULL);
77887813 for_each_sched_entity(se) {
77897814 cfs_rq = cfs_rq_of(se);
7790− cfs_rq->h_load_next = se;
7815+ WRITE_ONCE(cfs_rq->h_load_next, se);
77917816 if (cfs_rq->last_h_load_update == now)
77927817 break;
77937818 }
@@ -7797,7 +7822,7 @@ static void update_cfs_rq_h_load(struct cfs_rq *cfs_rq) · 3 unmodified lines
77977822 cfs_rq->last_h_load_update = now;
77987823 }
77997824
7800− while ((se = cfs_rq->h_load_next) != NULL) {
7825+ while ((se = READ_ONCE(cfs_rq->h_load_next)) != NULL) {
78017826 load = cfs_rq->h_load;
78027827 load = div64_ul(load * se->avg.load_avg,
78037828 cfs_rq_load_avg(cfs_rq) + 1);
kernel/seccomp.c+1−1
@@ -149,7 +149,7 @@ static void populate_seccomp_data(struct seccomp_data *sd) · 148 unmodified lines
149149
150150 sd->nr = syscall_get_nr(task, regs);
151151 sd->arch = syscall_get_arch();
152− syscall_get_arguments(task, regs, 0, 6, args);
152+ syscall_get_arguments(task, regs, args);
153153 sd->args[0] = args[0];
154154 sd->args[1] = args[1];
155155 sd->args[2] = args[2];
kernel/signal.c+5−10
@@ -3581,7 +3581,7 @@ SYSCALL_DEFINE4(pidfd_send_signal, int, pidfd, int, sig, · 3580 unmodified lines
35813581 if (flags)
35823582 return -EINVAL;
35833583
3584− f = fdget_raw(pidfd);
3584+ f = fdget(pidfd);
35853585 if (!f.file)
35863586 return -EBADF;
35873587
@@ -3605,16 +3605,11 @@ SYSCALL_DEFINE4(pidfd_send_signal, int, pidfd, int, sig, · 17 unmodified lines
36053605 if (unlikely(sig != kinfo.si_signo))
36063606 goto err;
36073607
3608+ /* Only allow sending arbitrary signals to yourself. */
3609+ ret = -EPERM;
36083610 if ((task_pid(current) != pid) &&
3609− (kinfo.si_code >= 0 || kinfo.si_code == SI_TKILL)) {
3610− /* Only allow sending arbitrary signals to yourself. */
3611− ret = -EPERM;
3612− if (kinfo.si_code != SI_USER)
3613− goto err;
3614−
3615− /* Turn this into a regular kill signal. */
3616− prepare_kill_siginfo(sig, &kinfo);
3617− }
3611+ (kinfo.si_code >= 0 || kinfo.si_code == SI_TKILL))
3612+ goto err;
36183613 } else {
36193614 prepare_kill_siginfo(sig, &kinfo);
36203615 }
kernel/sysctl.c+2−1
@@ -128,6 +128,7 @@ static int zero; · 127 unmodified lines
128128 static int __maybe_unused one = 1;
129129 static int __maybe_unused two = 2;
130130 static int __maybe_unused four = 4;
131+static unsigned long zero_ul;
131132 static unsigned long one_ul = 1;
132133 static unsigned long long_max = LONG_MAX;
133134 static int one_hundred = 100;
@@ -1750,7 +1751,7 @@ static struct ctl_table fs_table[] = { · 1616 unmodified lines
17501751 .maxlen = sizeof(files_stat.max_files),
17511752 .mode = 0644,
17521753 .proc_handler = proc_doulongvec_minmax,
1753− .extra1 = &zero,
1754+ .extra1 = &zero_ul,
17541755 .extra2 = &long_max,
17551756 },
17561757 {
kernel/time/alarmtimer.c+1−1
@@ -594,7 +594,7 @@ static ktime_t alarm_timer_remaining(struct k_itimer *timr, ktime_t now) · 593 unmodified lines
594594 {
595595 struct alarm *alarm = &timr->it.alarm.alarmtimer;
596596
597− return ktime_sub(now, alarm->node.expires);
597+ return ktime_sub(alarm->node.expires, now);
598598 }
599599
600600 /**
kernel/time/sched_clock.c+2−2
@@ -272,7 +272,7 @@ static u64 notrace suspended_sched_clock_read(void) · 271 unmodified lines
272272 return cd.read_data[seq & 1].epoch_cyc;
273273 }
274274
275−static int sched_clock_suspend(void)
275+int sched_clock_suspend(void)
276276 {
277277 struct clock_read_data *rd = &cd.read_data[0];
278278
@@ -283,7 +283,7 @@ static int sched_clock_suspend(void) · 4 unmodified lines
283283 return 0;
284284 }
285285
286−static void sched_clock_resume(void)
286+void sched_clock_resume(void)
287287 {
288288 struct clock_read_data *rd = &cd.read_data[0];
289289
kernel/time/tick-common.c+2−0
@@ -487,6 +487,7 @@ void tick_freeze(void) · 486 unmodified lines
487487 trace_suspend_resume(TPS("timekeeping_freeze"),
488488 smp_processor_id(), true);
489489 system_state = SYSTEM_SUSPEND;
490+ sched_clock_suspend();
490491 timekeeping_suspend();
491492 } else {
492493 tick_suspend_local();
@@ -510,6 +511,7 @@ void tick_unfreeze(void) · 17 unmodified lines
510511
511512 if (tick_freeze_depth == num_online_cpus()) {
512513 timekeeping_resume();
514+ sched_clock_resume();
513515 system_state = SYSTEM_RUNNING;
514516 trace_suspend_resume(TPS("timekeeping_freeze"),
515517 smp_processor_id(), false);
kernel/time/timekeeping.h+7−0
@@ -14,6 +14,13 @@ extern u64 timekeeping_max_deferment(void); · 13 unmodified lines
1414 extern void timekeeping_warp_clock(void);
1515 extern int timekeeping_suspend(void);
1616 extern void timekeeping_resume(void);
17+#ifdef CONFIG_GENERIC_SCHED_CLOCK
18+extern int sched_clock_suspend(void);
19+extern void sched_clock_resume(void);
20+#else
21+static inline int sched_clock_suspend(void) { return 0; }
22+static inline void sched_clock_resume(void) { }
23+#endif
1724
1825 extern void do_timer(unsigned long ticks);
1926 extern void update_wall_time(void);
kernel/trace/ftrace.c+5−1
@@ -33,6 +33,7 @@ · 32 unmodified lines
3333 #include <linux/list.h>
3434 #include <linux/hash.h>
3535 #include <linux/rcupdate.h>
36+#include <linux/kprobes.h>
3637
3738 #include <trace/events/sched.h>
3839
@@ -6246,7 +6247,7 @@ void ftrace_reset_array_ops(struct trace_array *tr) · 6207 unmodified lines
62466247 tr->ops->func = ftrace_stub;
62476248 }
62486249
6249−static inline void
6250+static nokprobe_inline void
62506251 __ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip,
62516252 struct ftrace_ops *ignored, struct pt_regs *regs)
62526253 {
@@ -6306,11 +6307,13 @@ static void ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip, · 53 unmodified lines
63066307 {
63076308 __ftrace_ops_list_func(ip, parent_ip, NULL, regs);
63086309 }
6310+NOKPROBE_SYMBOL(ftrace_ops_list_func);
63096311 #else
63106312 static void ftrace_ops_no_ops(unsigned long ip, unsigned long parent_ip)
63116313 {
63126314 __ftrace_ops_list_func(ip, parent_ip, NULL, NULL);
63136315 }
6316+NOKPROBE_SYMBOL(ftrace_ops_no_ops);
63146317 #endif
63156318
63166319 /*
@@ -6337,6 +6340,7 @@ static void ftrace_ops_assist_func(unsigned long ip, unsigned long parent_ip, · 20 unmodified lines
63376340 preempt_enable_notrace();
63386341 trace_clear_recursion(bit);
63396342 }
6343+NOKPROBE_SYMBOL(ftrace_ops_assist_func);
63406344
63416345 /**
63426346 * ftrace_ops_get_func - get the function a trampoline should call
kernel/trace/trace.c+5−1
@@ -7041,12 +7041,16 @@ static void buffer_pipe_buf_release(struct pipe_inode_info *pipe, · 7040 unmodified lines
70417041 buf->private = 0;
70427042 }
70437043
7044−static void buffer_pipe_buf_get(struct pipe_inode_info *pipe,
7044+static bool buffer_pipe_buf_get(struct pipe_inode_info *pipe,
70457045 struct pipe_buffer *buf)
70467046 {
70477047 struct buffer_ref *ref = (struct buffer_ref *)buf->private;
70487048
7049+ if (ref->ref > INT_MAX/2)
7050+ return false;
7051+
70497052 ref->ref++;
7053+ return true;
70507054 }
70517055
70527056 /* Pipe buffer operations for a buffer. */
kernel/trace/trace_syscalls.c+6−3
@@ -314,6 +314,7 @@ static void ftrace_syscall_enter(void *data, struct pt_regs *regs, long id) · 313 unmodified lines
314314 struct ring_buffer_event *event;
315315 struct ring_buffer *buffer;
316316 unsigned long irq_flags;
317+ unsigned long args[6];
317318 int pc;
318319 int syscall_nr;
319320 int size;
@@ -347,7 +348,8 @@ static void ftrace_syscall_enter(void *data, struct pt_regs *regs, long id) · 27 unmodified lines
347348
348349 entry = ring_buffer_event_data(event);
349350 entry->nr = syscall_nr;
350− syscall_get_arguments(current, regs, 0, sys_data->nb_args, entry->args);
351+ syscall_get_arguments(current, regs, args);
352+ memcpy(entry->args, args, sizeof(unsigned long) * sys_data->nb_args);
351353
352354 event_trigger_unlock_commit(trace_file, buffer, event, entry,
353355 irq_flags, pc);
@@ -583,6 +585,7 @@ static void perf_syscall_enter(void *ignore, struct pt_regs *regs, long id) · 229 unmodified lines
583585 struct syscall_metadata *sys_data;
584586 struct syscall_trace_enter *rec;
585587 struct hlist_head *head;
588+ unsigned long args[6];
586589 bool valid_prog_array;
587590 int syscall_nr;
588591 int rctx;
@@ -613,8 +616,8 @@ static void perf_syscall_enter(void *ignore, struct pt_regs *regs, long id) · 24 unmodified lines
613616 return;
614617
615618 rec->nr = syscall_nr;
616− syscall_get_arguments(current, regs, 0, sys_data->nb_args,
617− (unsigned long *)&rec->args);
619+ syscall_get_arguments(current, regs, args);
620+ memcpy(&rec->args, args, sizeof(unsigned long) * sys_data->nb_args);
618621
619622 if ((valid_prog_array &&
620623 !perf_call_bpf_enter(sys_data->enter_event, regs, sys_data, rec)) ||
kernel/watchdog_hld.c+2−1
@@ -135,7 +135,8 @@ static void watchdog_overflow_callback(struct perf_event *event, · 134 unmodified lines
135135 if (__this_cpu_read(hard_watchdog_warn) == true)
136136 return;
137137
138− pr_emerg("Watchdog detected hard LOCKUP on cpu %d", this_cpu);
138+ pr_emerg("Watchdog detected hard LOCKUP on cpu %d\n",
139+ this_cpu);
139140 print_modules();
140141 print_irqtrace_events(current);
141142 if (regs)
lib/Kconfig.debug+3−3
@@ -753,9 +753,9 @@ endmenu # "Memory Debugging" · 752 unmodified lines
753753 config ARCH_HAS_KCOV
754754 bool
755755 help
756− KCOV does not have any arch-specific code, but currently it is enabled
757− only for x86_64. KCOV requires testing on other archs, and most likely
758− disabling of instrumentation for some early boot code.
756+ An architecture should select this when it can successfully
757+ build and run with CONFIG_KCOV. This typically requires
758+ disabling instrumentation for some early boot code.
759759
760760 config CC_HAS_SANCOV_TRACE_PC
761761 def_bool $(cc-option,-fsanitize-coverage=trace-pc)
lib/iov_iter.c+4−0
@@ -1528,6 +1528,7 @@ EXPORT_SYMBOL(csum_and_copy_to_iter); · 1527 unmodified lines
15281528 size_t hash_and_copy_to_iter(const void *addr, size_t bytes, void *hashp,
15291529 struct iov_iter *i)
15301530 {
1531+#ifdef CONFIG_CRYPTO
15311532 struct ahash_request *hash = hashp;
15321533 struct scatterlist sg;
15331534 size_t copied;
@@ -1537,6 +1538,9 @@ size_t hash_and_copy_to_iter(const void *addr, size_t bytes, void *hashp, · 3 unmodified lines
15371538 ahash_request_set_crypt(hash, &sg, NULL, copied);
15381539 crypto_ahash_update(hash);
15391540 return copied;
1541+#else
1542+ return 0;
1543+#endif
15401544 }
15411545 EXPORT_SYMBOL(hash_and_copy_to_iter);
15421546
lib/lzo/lzo1x_compress.c+6−3
@@ -291,13 +291,14 @@ int lzogeneric1x_1_compress(const unsigned char *in, size_t in_len, · 290 unmodified lines
291291 {
292292 const unsigned char *ip = in;
293293 unsigned char *op = out;
294+ unsigned char *data_start;
294295 size_t l = in_len;
295296 size_t t = 0;
296297 signed char state_offset = -2;
297298 unsigned int m4_max_offset;
298299
299− // LZO v0 will never write 17 as first byte,
300− // so this is used to version the bitstream
300+ // LZO v0 will never write 17 as first byte (except for zero-length
301+ // input), so this is used to version the bitstream
301302 if (bitstream_version > 0) {
302303 *op++ = 17;
303304 *op++ = bitstream_version;
@@ -306,6 +307,8 @@ int lzogeneric1x_1_compress(const unsigned char *in, size_t in_len, · 2 unmodified lines
306307 m4_max_offset = M4_MAX_OFFSET_V0;
307308 }
308309
310+ data_start = op;
311+
309312 while (l > 20) {
310313 size_t ll = l <= (m4_max_offset + 1) ? l : (m4_max_offset + 1);
311314 uintptr_t ll_end = (uintptr_t) ip + ll;
@@ -324,7 +327,7 @@ int lzogeneric1x_1_compress(const unsigned char *in, size_t in_len, · 12 unmodified lines
324327 if (t > 0) {
325328 const unsigned char *ii = in + in_len - t;
326329
327− if (op == out && t <= 238) {
330+ if (op == data_start && t <= 238) {
328331 *op++ = (17 + t);
329332 } else if (t <= 3) {
330333 op[state_offset] |= t;
lib/lzo/lzo1x_decompress_safe.c+1−3
@@ -54,11 +54,9 @@ int lzo1x_decompress_safe(const unsigned char *in, size_t in_len, · 53 unmodified lines
5454 if (unlikely(in_len < 3))
5555 goto input_overrun;
5656
57− if (likely(*ip == 17)) {
57+ if (likely(in_len >= 5) && likely(*ip == 17)) {
5858 bitstream_version = ip[1];
5959 ip += 2;
60− if (unlikely(in_len < 5))
61− goto input_overrun;
6260 } else {
6361 bitstream_version = 0;
6462 }
lib/string.c+20−0
@@ -866,6 +866,26 @@ __visible int memcmp(const void *cs, const void *ct, size_t count) · 865 unmodified lines
866866 EXPORT_SYMBOL(memcmp);
867867 #endif
868868
869+#ifndef __HAVE_ARCH_BCMP
870+/**
871+ * bcmp - returns 0 if and only if the buffers have identical contents.
872+ * @a: pointer to first buffer.
873+ * @b: pointer to second buffer.
874+ * @len: size of buffers.
875+ *
876+ * The sign or magnitude of a non-zero return value has no particular
877+ * meaning, and architectures may implement their own more efficient bcmp(). So
878+ * while this particular implementation is a simple (tail) call to memcmp, do
879+ * not rely on anything but whether the return value is zero or non-zero.
880+ */
881+#undef bcmp
882+int bcmp(const void *a, const void *b, size_t len)
883+{
884+ return memcmp(a, b, len);
885+}
886+EXPORT_SYMBOL(bcmp);
887+#endif
888+
869889 #ifndef __HAVE_ARCH_MEMSCAN
870890 /**
871891 * memscan - Find a character in an area of memory.
lib/syscall.c+25−32
@@ -5,16 +5,14 @@ · 4 unmodified lines
55 #include <linux/export.h>
66 #include <asm/syscall.h>
77
8−static int collect_syscall(struct task_struct *target, long *callno,
9− unsigned long args[6], unsigned int maxargs,
10− unsigned long *sp, unsigned long *pc)
8+static int collect_syscall(struct task_struct *target, struct syscall_info *info)
119 {
1210 struct pt_regs *regs;
1311
1412 if (!try_get_task_stack(target)) {
1513 /* Task has no stack, so the task isn't in a syscall. */
16− *sp = *pc = 0;
17− *callno = -1;
14+ memset(info, 0, sizeof(*info));
15+ info->data.nr = -1;
1816 return 0;
1917 }
2018
@@ -24,12 +22,13 @@ static int collect_syscall(struct task_struct *target, long *callno, · 3 unmodified lines
2422 return -EAGAIN;
2523 }
2624
27− *sp = user_stack_pointer(regs);
28− *pc = instruction_pointer(regs);
25+ info->sp = user_stack_pointer(regs);
26+ info->data.instruction_pointer = instruction_pointer(regs);
2927
30− *callno = syscall_get_nr(target, regs);
31− if (*callno != -1L && maxargs > 0)
32− syscall_get_arguments(target, regs, 0, maxargs, args);
28+ info->data.nr = syscall_get_nr(target, regs);
29+ if (info->data.nr != -1L)
30+ syscall_get_arguments(target, regs,
31+ (unsigned long *)&info->data.args[0]);
3332
3433 put_task_stack(target);
3534 return 0;
@@ -38,41 +37,35 @@ static int collect_syscall(struct task_struct *target, long *callno, · 2 unmodified lines
3837 /**
3938 * task_current_syscall - Discover what a blocked task is doing.
4039 * @target: thread to examine
41− * @callno: filled with system call number or -1
42− * @args: filled with @maxargs system call arguments
43− * @maxargs: number of elements in @args to fill
44− * @sp: filled with user stack pointer
45− * @pc: filled with user PC
40+ * @info: structure with the following fields:
41+ * .sp - filled with user stack pointer
42+ * .data.nr - filled with system call number or -1
43+ * .data.args - filled with @maxargs system call arguments
44+ * .data.instruction_pointer - filled with user PC
4645 *
47− * If @target is blocked in a system call, returns zero with *@callno
48− * set to the the call's number and @args filled in with its arguments.
49− * Registers not used for system call arguments may not be available and
50− * it is not kosher to use &struct user_regset calls while the system
46+ * If @target is blocked in a system call, returns zero with @info.data.nr
47+ * set to the the call's number and @info.data.args filled in with its
48+ * arguments. Registers not used for system call arguments may not be available
49+ * and it is not kosher to use &struct user_regset calls while the system
5150 * call is still in progress. Note we may get this result if @target
5251 * has finished its system call but not yet returned to user mode, such
5352 * as when it's stopped for signal handling or syscall exit tracing.
5453 *
5554 * If @target is blocked in the kernel during a fault or exception,
56− * returns zero with *@callno set to -1 and does not fill in @args.
57− * If so, it's now safe to examine @target using &struct user_regset
58− * get() calls as long as we're sure @target won't return to user mode.
55+ * returns zero with *@info.data.nr set to -1 and does not fill in
56+ * @info.data.args. If so, it's now safe to examine @target using
57+ * &struct user_regset get() calls as long as we're sure @target won't return
58+ * to user mode.
5959 *
6060 * Returns -%EAGAIN if @target does not remain blocked.
61− *
62− * Returns -%EINVAL if @maxargs is too large (maximum is six).
6361 */
64−int task_current_syscall(struct task_struct *target, long *callno,
65− unsigned long args[6], unsigned int maxargs,
66− unsigned long *sp, unsigned long *pc)
62+int task_current_syscall(struct task_struct *target, struct syscall_info *info)
6763 {
6864 long state;
6965 unsigned long ncsw;
7066
71− if (unlikely(maxargs > 6))
72− return -EINVAL;
73−
7467 if (target == current)
75− return collect_syscall(target, callno, args, maxargs, sp, pc);
68+ return collect_syscall(target, info);
7669
7770 state = target->state;
7871 if (unlikely(!state))
@@ -80,7 +73,7 @@ int task_current_syscall(struct task_struct *target, long *callno, · 1 unmodified line
8073
8174 ncsw = wait_task_inactive(target, state);
8275 if (unlikely(!ncsw) ||
83− unlikely(collect_syscall(target, callno, args, maxargs, sp, pc)) ||
76+ unlikely(collect_syscall(target, info)) ||
8477 unlikely(wait_task_inactive(target, state) != ncsw))
8578 return -EAGAIN;
8679
mm/compaction.c+18−11
@@ -242,6 +242,7 @@ __reset_isolation_pfn(struct zone *zone, unsigned long pfn, bool check_source, · 241 unmodified lines
242242 bool check_target)
243243 {
244244 struct page *page = pfn_to_online_page(pfn);
245+ struct page *block_page;
245246 struct page *end_page;
246247 unsigned long block_pfn;
247248
@@ -267,20 +268,26 @@ __reset_isolation_pfn(struct zone *zone, unsigned long pfn, bool check_source, · 19 unmodified lines
267268 get_pageblock_migratetype(page) != MIGRATE_MOVABLE)
268269 return false;
269270
271+ /* Ensure the start of the pageblock or zone is online and valid */
272+ block_pfn = pageblock_start_pfn(pfn);
273+ block_page = pfn_to_online_page(max(block_pfn, zone->zone_start_pfn));
274+ if (block_page) {
275+ page = block_page;
276+ pfn = block_pfn;
277+ }
278+
279+ /* Ensure the end of the pageblock or zone is online and valid */
280+ block_pfn += pageblock_nr_pages;
281+ block_pfn = min(block_pfn, zone_end_pfn(zone) - 1);
282+ end_page = pfn_to_online_page(block_pfn);
283+ if (!end_page)
284+ return false;
285+
270286 /*
271287 * Only clear the hint if a sample indicates there is either a
272288 * free page or an LRU page in the block. One or other condition
273289 * is necessary for the block to be a migration source/target.
274290 */
275− block_pfn = pageblock_start_pfn(pfn);
276− pfn = max(block_pfn, zone->zone_start_pfn);
277− page = pfn_to_page(pfn);
278− if (zone != page_zone(page))
279− return false;
280− pfn = block_pfn + pageblock_nr_pages;
281− pfn = min(pfn, zone_end_pfn(zone));
282− end_page = pfn_to_page(pfn);
283−
284291 do {
285292 if (pfn_valid_within(pfn)) {
286293 if (check_source && PageLRU(page)) {
@@ -309,7 +316,7 @@ __reset_isolation_pfn(struct zone *zone, unsigned long pfn, bool check_source, · 22 unmodified lines
309316 static void __reset_isolation_suitable(struct zone *zone)
310317 {
311318 unsigned long migrate_pfn = zone->zone_start_pfn;
312− unsigned long free_pfn = zone_end_pfn(zone);
319+ unsigned long free_pfn = zone_end_pfn(zone) - 1;
313320 unsigned long reset_migrate = free_pfn;
314321 unsigned long reset_free = migrate_pfn;
315322 bool source_set = false;
@@ -1363,7 +1370,7 @@ fast_isolate_freepages(struct compact_control *cc) · 1047 unmodified lines
13631370 count_compact_events(COMPACTISOLATED, nr_isolated);
13641371 } else {
13651372 /* If isolation fails, abort the search */
1366− order = -1;
1373+ order = cc->search_order + 1;
13671374 page = NULL;
13681375 }
13691376 }
mm/gup.c+36−12
@@ -160,8 +160,12 @@ retry: · 159 unmodified lines
160160 goto retry;
161161 }
162162
163− if (flags & FOLL_GET)
164− get_page(page);
163+ if (flags & FOLL_GET) {
164+ if (unlikely(!try_get_page(page))) {
165+ page = ERR_PTR(-ENOMEM);
166+ goto out;
167+ }
168+ }
165169 if (flags & FOLL_TOUCH) {
166170 if ((flags & FOLL_WRITE) &&
167171 !pte_dirty(pte) && !PageDirty(page))
@@ -298,7 +302,10 @@ retry_locked: · 130 unmodified lines
298302 if (pmd_trans_unstable(pmd))
299303 ret = -EBUSY;
300304 } else {
301− get_page(page);
305+ if (unlikely(!try_get_page(page))) {
306+ spin_unlock(ptl);
307+ return ERR_PTR(-ENOMEM);
308+ }
302309 spin_unlock(ptl);
303310 lock_page(page);
304311 ret = split_huge_page(page);
@@ -500,7 +507,10 @@ static int get_gate_page(struct mm_struct *mm, unsigned long address, · 195 unmodified lines
500507 if (is_device_public_page(*page))
501508 goto unmap;
502509 }
503− get_page(*page);
510+ if (unlikely(!try_get_page(*page))) {
511+ ret = -ENOMEM;
512+ goto unmap;
513+ }
504514 out:
505515 ret = 0;
506516 unmap:
@@ -1545,6 +1555,20 @@ static void undo_dev_pagemap(int *nr, int nr_start, struct page **pages) · 1038 unmodified lines
15451555 }
15461556 }
15471557
1558+/*
1559+ * Return the compund head page with ref appropriately incremented,
1560+ * or NULL if that failed.
1561+ */
1562+static inline struct page *try_get_compound_head(struct page *page, int refs)
1563+{
1564+ struct page *head = compound_head(page);
1565+ if (WARN_ON_ONCE(page_ref_count(head) < 0))
1566+ return NULL;
1567+ if (unlikely(!page_cache_add_speculative(head, refs)))
1568+ return NULL;
1569+ return head;
1570+}
1571+
15481572 #ifdef CONFIG_ARCH_HAS_PTE_SPECIAL
15491573 static int gup_pte_range(pmd_t pmd, unsigned long addr, unsigned long end,
15501574 int write, struct page **pages, int *nr)
@@ -1579,9 +1603,9 @@ static int gup_pte_range(pmd_t pmd, unsigned long addr, unsigned long end, · 28 unmodified lines
15791603
15801604 VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
15811605 page = pte_page(pte);
1582− head = compound_head(page);
15831606
1584− if (!page_cache_get_speculative(head))
1607+ head = try_get_compound_head(page, 1);
1608+ if (!head)
15851609 goto pte_unmap;
15861610
15871611 if (unlikely(pte_val(pte) != pte_val(*ptep))) {
@@ -1720,8 +1744,8 @@ static int gup_huge_pmd(pmd_t orig, pmd_t *pmdp, unsigned long addr, · 132 unmodified lines
17201744 refs++;
17211745 } while (addr += PAGE_SIZE, addr != end);
17221746
1723− head = compound_head(pmd_page(orig));
1724− if (!page_cache_add_speculative(head, refs)) {
1747+ head = try_get_compound_head(pmd_page(orig), refs);
1748+ if (!head) {
17251749 *nr -= refs;
17261750 return 0;
17271751 }
@@ -1758,8 +1782,8 @@ static int gup_huge_pud(pud_t orig, pud_t *pudp, unsigned long addr, · 30 unmodified lines
17581782 refs++;
17591783 } while (addr += PAGE_SIZE, addr != end);
17601784
1761− head = compound_head(pud_page(orig));
1762− if (!page_cache_add_speculative(head, refs)) {
1785+ head = try_get_compound_head(pud_page(orig), refs);
1786+ if (!head) {
17631787 *nr -= refs;
17641788 return 0;
17651789 }
@@ -1795,8 +1819,8 @@ static int gup_huge_pgd(pgd_t orig, pgd_t *pgdp, unsigned long addr, · 29 unmodified lines
17951819 refs++;
17961820 } while (addr += PAGE_SIZE, addr != end);
17971821
1798− head = compound_head(pgd_page(orig));
1799− if (!page_cache_add_speculative(head, refs)) {
1822+ head = try_get_compound_head(pgd_page(orig), refs);
1823+ if (!head) {
18001824 *nr -= refs;
18011825 return 0;
18021826 }
mm/huge_memory.c+36−0
@@ -755,6 +755,21 @@ static void insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr, · 754 unmodified lines
755755 spinlock_t *ptl;
756756
757757 ptl = pmd_lock(mm, pmd);
758+ if (!pmd_none(*pmd)) {
759+ if (write) {
760+ if (pmd_pfn(*pmd) != pfn_t_to_pfn(pfn)) {
761+ WARN_ON_ONCE(!is_huge_zero_pmd(*pmd));
762+ goto out_unlock;
763+ }
764+ entry = pmd_mkyoung(*pmd);
765+ entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma);
766+ if (pmdp_set_access_flags(vma, addr, pmd, entry, 1))
767+ update_mmu_cache_pmd(vma, addr, pmd);
768+ }
769+
770+ goto out_unlock;
771+ }
772+
758773 entry = pmd_mkhuge(pfn_t_pmd(pfn, prot));
759774 if (pfn_t_devmap(pfn))
760775 entry = pmd_mkdevmap(entry);
@@ -766,11 +781,16 @@ static void insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr, · 5 unmodified lines
766781 if (pgtable) {
767782 pgtable_trans_huge_deposit(mm, pmd, pgtable);
768783 mm_inc_nr_ptes(mm);
784+ pgtable = NULL;
769785 }
770786
771787 set_pmd_at(mm, addr, pmd, entry);
772788 update_mmu_cache_pmd(vma, addr, pmd);
789+
790+out_unlock:
773791 spin_unlock(ptl);
792+ if (pgtable)
793+ pte_free(mm, pgtable);
774794 }
775795
776796 vm_fault_t vmf_insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr,
@@ -821,6 +841,20 @@ static void insert_pfn_pud(struct vm_area_struct *vma, unsigned long addr, · 44 unmodified lines
821841 spinlock_t *ptl;
822842
823843 ptl = pud_lock(mm, pud);
844+ if (!pud_none(*pud)) {
845+ if (write) {
846+ if (pud_pfn(*pud) != pfn_t_to_pfn(pfn)) {
847+ WARN_ON_ONCE(!is_huge_zero_pud(*pud));
848+ goto out_unlock;
849+ }
850+ entry = pud_mkyoung(*pud);
851+ entry = maybe_pud_mkwrite(pud_mkdirty(entry), vma);
852+ if (pudp_set_access_flags(vma, addr, pud, entry, 1))
853+ update_mmu_cache_pud(vma, addr, pud);
854+ }
855+ goto out_unlock;
856+ }
857+
824858 entry = pud_mkhuge(pfn_t_pud(pfn, prot));
825859 if (pfn_t_devmap(pfn))
826860 entry = pud_mkdevmap(entry);
@@ -830,6 +864,8 @@ static void insert_pfn_pud(struct vm_area_struct *vma, unsigned long addr, · 3 unmodified lines
830864 }
831865 set_pud_at(mm, addr, pud, entry);
832866 update_mmu_cache_pud(vma, addr, pud);
867+
868+out_unlock:
833869 spin_unlock(ptl);
834870 }
835871
mm/hugetlb.c+13−0
@@ -4299,6 +4299,19 @@ long follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma, · 4298 unmodified lines
42994299
43004300 pfn_offset = (vaddr & ~huge_page_mask(h)) >> PAGE_SHIFT;
43014301 page = pte_page(huge_ptep_get(pte));
4302+
4303+ /*
4304+ * Instead of doing 'try_get_page()' below in the same_page
4305+ * loop, just check the count once here.
4306+ */
4307+ if (unlikely(page_count(page) <= 0)) {
4308+ if (pages) {
4309+ spin_unlock(ptl);
4310+ remainder = 0;
4311+ err = -ENOMEM;
4312+ break;
4313+ }
4314+ }
43024315 same_page:
43034316 if (pages) {
43044317 pages[i] = mem_map_offset(page, pfn_offset);
mm/kmemleak.c+13−5
@@ -1401,6 +1401,7 @@ static void scan_block(void *_start, void *_end, · 1400 unmodified lines
14011401 /*
14021402 * Scan a large memory block in MAX_SCAN_SIZE chunks to reduce the latency.
14031403 */
1404+#ifdef CONFIG_SMP
14041405 static void scan_large_block(void *start, void *end)
14051406 {
14061407 void *next;
@@ -1412,6 +1413,7 @@ static void scan_large_block(void *start, void *end) · 5 unmodified lines
14121413 cond_resched();
14131414 }
14141415 }
1416+#endif
14151417
14161418 /*
14171419 * Scan a memory block corresponding to a kmemleak_object. A condition is
@@ -1529,11 +1531,6 @@ static void kmemleak_scan(void) · 111 unmodified lines
15291531 }
15301532 rcu_read_unlock();
15311533
1532− /* data/bss scanning */
1533− scan_large_block(_sdata, _edata);
1534− scan_large_block(__bss_start, __bss_stop);
1535− scan_large_block(__start_ro_after_init, __end_ro_after_init);
1536−
15371534 #ifdef CONFIG_SMP
15381535 /* per-cpu sections scanning */
15391536 for_each_possible_cpu(i)
@@ -2071,6 +2068,17 @@ void __init kmemleak_init(void) · 531 unmodified lines
20712068 }
20722069 local_irq_restore(flags);
20732070
2071+ /* register the data/bss sections */
2072+ create_object((unsigned long)_sdata, _edata - _sdata,
2073+ KMEMLEAK_GREY, GFP_ATOMIC);
2074+ create_object((unsigned long)__bss_start, __bss_stop - __bss_start,
2075+ KMEMLEAK_GREY, GFP_ATOMIC);
2076+ /* only register .data..ro_after_init if not within .data */
2077+ if (__start_ro_after_init < _sdata || __end_ro_after_init > _edata)
2078+ create_object((unsigned long)__start_ro_after_init,
2079+ __end_ro_after_init - __start_ro_after_init,
2080+ KMEMLEAK_GREY, GFP_ATOMIC);
2081+
20742082 /*
20752083 * This is the point where tracking allocations is safe. Automatic
20762084 * scanning is started during the late initcall. Add the early logged
mm/memcontrol.c+18−2
@@ -3882,6 +3882,22 @@ struct wb_domain *mem_cgroup_wb_domain(struct bdi_writeback *wb) · 3881 unmodified lines
38823882 return &memcg->cgwb_domain;
38833883 }
38843884
3885+/*
3886+ * idx can be of type enum memcg_stat_item or node_stat_item.
3887+ * Keep in sync with memcg_exact_page().
3888+ */
3889+static unsigned long memcg_exact_page_state(struct mem_cgroup *memcg, int idx)
3890+{
3891+ long x = atomic_long_read(&memcg->stat[idx]);
3892+ int cpu;
3893+
3894+ for_each_online_cpu(cpu)
3895+ x += per_cpu_ptr(memcg->stat_cpu, cpu)->count[idx];
3896+ if (x < 0)
3897+ x = 0;
3898+ return x;
3899+}
3900+
38853901 /**
38863902 * mem_cgroup_wb_stats - retrieve writeback related stats from its memcg
38873903 * @wb: bdi_writeback in question
@@ -3907,10 +3923,10 @@ void mem_cgroup_wb_stats(struct bdi_writeback *wb, unsigned long *pfilepages, · 19 unmodified lines
39073923 struct mem_cgroup *memcg = mem_cgroup_from_css(wb->memcg_css);
39083924 struct mem_cgroup *parent;
39093925
3910− *pdirty = memcg_page_state(memcg, NR_FILE_DIRTY);
3926+ *pdirty = memcg_exact_page_state(memcg, NR_FILE_DIRTY);
39113927
39123928 /* this should eventually include NR_UNSTABLE_NFS */
3913− *pwriteback = memcg_page_state(memcg, NR_WRITEBACK);
3929+ *pwriteback = memcg_exact_page_state(memcg, NR_WRITEBACK);
39143930 *pfilepages = mem_cgroup_nr_lru_pages(memcg, (1 << LRU_INACTIVE_FILE) |
39153931 (1 << LRU_ACTIVE_FILE));
39163932 *pheadroom = PAGE_COUNTER_MAX;
mm/mmap.c+6−1
@@ -45,6 +45,7 @@ · 44 unmodified lines
4545 #include <linux/moduleparam.h>
4646 #include <linux/pkeys.h>
4747 #include <linux/oom.h>
48+#include <linux/sched/mm.h>
4849
4950 #include <linux/uaccess.h>
5051 #include <asm/cacheflush.h>
@@ -2525,7 +2526,8 @@ find_extend_vma(struct mm_struct *mm, unsigned long addr) · 2474 unmodified lines
25252526 vma = find_vma_prev(mm, addr, &prev);
25262527 if (vma && (vma->vm_start <= addr))
25272528 return vma;
2528− if (!prev || expand_stack(prev, addr))
2529+ /* don't alter vm_end if the coredump is running */
2530+ if (!prev || !mmget_still_valid(mm) || expand_stack(prev, addr))
25292531 return NULL;
25302532 if (prev->vm_flags & VM_LOCKED)
25312533 populate_vma_page_range(prev, addr, prev->vm_end, NULL);
@@ -2551,6 +2553,9 @@ find_extend_vma(struct mm_struct *mm, unsigned long addr) · 19 unmodified lines
25512553 return vma;
25522554 if (!(vma->vm_flags & VM_GROWSDOWN))
25532555 return NULL;
2556+ /* don't alter vm_start if the coredump is running */
2557+ if (!mmget_still_valid(mm))
2558+ return NULL;
25542559 start = vma->vm_start;
25552560 if (expand_stack(vma, addr))
25562561 return NULL;
mm/page_alloc.c+18−12
@@ -8005,7 +8005,10 @@ void *__init alloc_large_system_hash(const char *tablename, · 8004 unmodified lines
80058005 bool has_unmovable_pages(struct zone *zone, struct page *page, int count,
80068006 int migratetype, int flags)
80078007 {
8008− unsigned long pfn, iter, found;
8008+ unsigned long found;
8009+ unsigned long iter = 0;
8010+ unsigned long pfn = page_to_pfn(page);
8011+ const char *reason = "unmovable page";
80098012
80108013 /*
80118014 * TODO we could make this much more efficient by not checking every
@@ -8015,17 +8018,20 @@ bool has_unmovable_pages(struct zone *zone, struct page *page, int count, · 3 unmodified lines
80158018 * can still lead to having bootmem allocations in zone_movable.
80168019 */
80178020
8018− /*
8019− * CMA allocations (alloc_contig_range) really need to mark isolate
8020− * CMA pageblocks even when they are not movable in fact so consider
8021− * them movable here.
8022− */
8023− if (is_migrate_cma(migratetype) &&
8024− is_migrate_cma(get_pageblock_migratetype(page)))
8025− return false;
8021+ if (is_migrate_cma_page(page)) {
8022+ /*
8023+ * CMA allocations (alloc_contig_range) really need to mark
8024+ * isolate CMA pageblocks even when they are not movable in fact
8025+ * so consider them movable here.
8026+ */
8027+ if (is_migrate_cma(migratetype))
8028+ return false;
8029+
8030+ reason = "CMA page";
8031+ goto unmovable;
8032+ }
80268033
8027− pfn = page_to_pfn(page);
8028− for (found = 0, iter = 0; iter < pageblock_nr_pages; iter++) {
8034+ for (found = 0; iter < pageblock_nr_pages; iter++) {
80298035 unsigned long check = pfn + iter;
80308036
80318037 if (!pfn_valid_within(check))
@@ -8105,7 +8111,7 @@ bool has_unmovable_pages(struct zone *zone, struct page *page, int count, · 73 unmodified lines
81058111 unmovable:
81068112 WARN_ON_ONCE(zone_idx(zone) == ZONE_MOVABLE);
81078113 if (flags & REPORT_FAILURE)
8108− dump_page(pfn_to_page(pfn+iter), "unmovable page");
8114+ dump_page(pfn_to_page(pfn + iter), reason);
81098115 return true;
81108116 }
81118117
mm/percpu.c+4−4
@@ -2567,8 +2567,8 @@ int __init pcpu_embed_first_chunk(size_t reserved_size, size_t dyn_size, · 2566 unmodified lines
25672567 ai->groups[group].base_offset = areas[group] - base;
25682568 }
25692569
2570− pr_info("Embedded %zu pages/cpu @%p s%zu r%zu d%zu u%zu\n",
2571− PFN_DOWN(size_sum), base, ai->static_size, ai->reserved_size,
2570+ pr_info("Embedded %zu pages/cpu s%zu r%zu d%zu u%zu\n",
2571+ PFN_DOWN(size_sum), ai->static_size, ai->reserved_size,
25722572 ai->dyn_size, ai->unit_size);
25732573
25742574 rc = pcpu_setup_first_chunk(ai, base);
@@ -2692,8 +2692,8 @@ int __init pcpu_page_first_chunk(size_t reserved_size, · 117 unmodified lines
26922692 }
26932693
26942694 /* we're ready, commit */
2695− pr_info("%d %s pages/cpu @%p s%zu r%zu d%zu\n",
2696− unit_pages, psize_str, vm.addr, ai->static_size,
2695+ pr_info("%d %s pages/cpu s%zu r%zu d%zu\n",
2696+ unit_pages, psize_str, ai->static_size,
26972697 ai->reserved_size, ai->dyn_size);
26982698
26992699 rc = pcpu_setup_first_chunk(ai, vm.addr);
mm/shmem.c+27−31
@@ -1081,9 +1081,14 @@ static void shmem_evict_inode(struct inode *inode) · 1080 unmodified lines
10811081 }
10821082 spin_unlock(&sbinfo->shrinklist_lock);
10831083 }
1084− if (!list_empty(&info->swaplist)) {
1084+ while (!list_empty(&info->swaplist)) {
1085+ /* Wait while shmem_unuse() is scanning this inode... */
1086+ wait_var_event(&info->stop_eviction,
1087+ !atomic_read(&info->stop_eviction));
10851088 mutex_lock(&shmem_swaplist_mutex);
1086− list_del_init(&info->swaplist);
1089+ /* ...but beware of the race if we peeked too early */
1090+ if (!atomic_read(&info->stop_eviction))
1091+ list_del_init(&info->swaplist);
10871092 mutex_unlock(&shmem_swaplist_mutex);
10881093 }
10891094 }
@@ -1099,10 +1104,11 @@ extern struct swap_info_struct *swap_info[]; · 9 unmodified lines
10991104 static int shmem_find_swap_entries(struct address_space *mapping,
11001105 pgoff_t start, unsigned int nr_entries,
11011106 struct page **entries, pgoff_t *indices,
1102− bool frontswap)
1107+ unsigned int type, bool frontswap)
11031108 {
11041109 XA_STATE(xas, &mapping->i_pages, start);
11051110 struct page *page;
1111+ swp_entry_t entry;
11061112 unsigned int ret = 0;
11071113
11081114 if (!nr_entries)
@@ -1116,13 +1122,12 @@ static int shmem_find_swap_entries(struct address_space *mapping, · 7 unmodified lines
11161122 if (!xa_is_value(page))
11171123 continue;
11181124
1119− if (frontswap) {
1120− swp_entry_t entry = radix_to_swp_entry(page);
1121−
1122− if (!frontswap_test(swap_info[swp_type(entry)],
1123− swp_offset(entry)))
1124− continue;
1125− }
1125+ entry = radix_to_swp_entry(page);
1126+ if (swp_type(entry) != type)
1127+ continue;
1128+ if (frontswap &&
1129+ !frontswap_test(swap_info[type], swp_offset(entry)))
1130+ continue;
11261131
11271132 indices[ret] = xas.xa_index;
11281133 entries[ret] = page;
@@ -1194,7 +1199,7 @@ static int shmem_unuse_inode(struct inode *inode, unsigned int type, · 65 unmodified lines
11941199
11951200 pvec.nr = shmem_find_swap_entries(mapping, start, nr_entries,
11961201 pvec.pages, indices,
1197− frontswap);
1202+ type, frontswap);
11981203 if (pvec.nr == 0) {
11991204 ret = 0;
12001205 break;
@@ -1227,36 +1232,27 @@ int shmem_unuse(unsigned int type, bool frontswap, · 26 unmodified lines
12271232 unsigned long *fs_pages_to_unuse)
12281233 {
12291234 struct shmem_inode_info *info, *next;
1230− struct inode *inode;
1231− struct inode *prev_inode = NULL;
12321235 int error = 0;
12331236
12341237 if (list_empty(&shmem_swaplist))
12351238 return 0;
12361239
12371240 mutex_lock(&shmem_swaplist_mutex);
1238−
1239− /*
1240− * The extra refcount on the inode is necessary to safely dereference
1241− * p->next after re-acquiring the lock. New shmem inodes with swap
1242− * get added to the end of the list and we will scan them all.
1243− */
12441241 list_for_each_entry_safe(info, next, &shmem_swaplist, swaplist) {
12451242 if (!info->swapped) {
12461243 list_del_init(&info->swaplist);
12471244 continue;
12481245 }
1249−
1250− inode = igrab(&info->vfs_inode);
1251− if (!inode)
1252− continue;
1253−
1246+ /*
1247+ * Drop the swaplist mutex while searching the inode for swap;
1248+ * but before doing so, make sure shmem_evict_inode() will not
1249+ * remove placeholder inode from swaplist, nor let it be freed
1250+ * (igrab() would protect from unlink, but not from unmount).
1251+ */
1252+ atomic_inc(&info->stop_eviction);
12541253 mutex_unlock(&shmem_swaplist_mutex);
1255− if (prev_inode)
1256− iput(prev_inode);
1257− prev_inode = inode;
12581254
1259− error = shmem_unuse_inode(inode, type, frontswap,
1255+ error = shmem_unuse_inode(&info->vfs_inode, type, frontswap,
12601256 fs_pages_to_unuse);
12611257 cond_resched();
12621258
@@ -1264,14 +1260,13 @@ int shmem_unuse(unsigned int type, bool frontswap, · 1 unmodified line
12641260 next = list_next_entry(info, swaplist);
12651261 if (!info->swapped)
12661262 list_del_init(&info->swaplist);
1263+ if (atomic_dec_and_test(&info->stop_eviction))
1264+ wake_up_var(&info->stop_eviction);
12671265 if (error)
12681266 break;
12691267 }
12701268 mutex_unlock(&shmem_swaplist_mutex);
12711269
1272− if (prev_inode)
1273− iput(prev_inode);
1274−
12751270 return error;
12761271 }
12771272
@@ -2238,6 +2233,7 @@ static struct inode *shmem_get_inode(struct super_block *sb, const struct inode · 960 unmodified lines
22382233 info = SHMEM_I(inode);
22392234 memset(info, 0, (char *)inode - (char *)info);
22402235 spin_lock_init(&info->lock);
2236+ atomic_set(&info->stop_eviction, 0);
22412237 info->seals = F_SEAL_SEAL;
22422238 info->flags = flags & VM_NORESERVE;
22432239 INIT_LIST_HEAD(&info->shrinklist);
mm/slab.c+2−2
@@ -2374,7 +2374,6 @@ static void *alloc_slabmgmt(struct kmem_cache *cachep, · 2373 unmodified lines
23742374 /* Slab management obj is off-slab. */
23752375 freelist = kmem_cache_alloc_node(cachep->freelist_cache,
23762376 local_flags, nodeid);
2377− freelist = kasan_reset_tag(freelist);
23782377 if (!freelist)
23792378 return NULL;
23802379 } else {
@@ -4308,7 +4307,8 @@ static void show_symbol(struct seq_file *m, unsigned long address) · 1927 unmodified lines
43084307
43094308 static int leaks_show(struct seq_file *m, void *p)
43104309 {
4311− struct kmem_cache *cachep = list_entry(p, struct kmem_cache, list);
4310+ struct kmem_cache *cachep = list_entry(p, struct kmem_cache,
4311+ root_caches_node);
43124312 struct page *page;
43134313 struct kmem_cache_node *n;
43144314 const char *name;
mm/swapfile.c+17−15
@@ -2023,7 +2023,6 @@ static unsigned int find_next_to_unuse(struct swap_info_struct *si, · 2022 unmodified lines
20232023 * If the boolean frontswap is true, only unuse pages_to_unuse pages;
20242024 * pages_to_unuse==0 means all pages; ignored if frontswap is false
20252025 */
2026−#define SWAP_UNUSE_MAX_TRIES 3
20272026 int try_to_unuse(unsigned int type, bool frontswap,
20282027 unsigned long pages_to_unuse)
20292028 {
@@ -2035,7 +2034,6 @@ int try_to_unuse(unsigned int type, bool frontswap, · 5 unmodified lines
20352034 struct page *page;
20362035 swp_entry_t entry;
20372036 unsigned int i;
2038− int retries = 0;
20392037
20402038 if (!si->inuse_pages)
20412039 return 0;
@@ -2053,11 +2051,9 @@ retry: · 11 unmodified lines
20532051
20542052 spin_lock(&mmlist_lock);
20552053 p = &init_mm.mmlist;
2056− while ((p = p->next) != &init_mm.mmlist) {
2057− if (signal_pending(current)) {
2058− retval = -EINTR;
2059− break;
2060− }
2054+ while (si->inuse_pages &&
2055+ !signal_pending(current) &&
2056+ (p = p->next) != &init_mm.mmlist) {
20612057
20622058 mm = list_entry(p, struct mm_struct, mmlist);
20632059 if (!mmget_not_zero(mm))
@@ -2084,7 +2080,9 @@ retry: · 20 unmodified lines
20842080 mmput(prev_mm);
20852081
20862082 i = 0;
2087− while ((i = find_next_to_unuse(si, i, frontswap)) != 0) {
2083+ while (si->inuse_pages &&
2084+ !signal_pending(current) &&
2085+ (i = find_next_to_unuse(si, i, frontswap)) != 0) {
20882086
20892087 entry = swp_entry(type, i);
20902088 page = find_get_page(swap_address_space(entry), i);
@@ -2117,14 +2115,18 @@ retry: · 26 unmodified lines
21172115 * If yes, we would need to do retry the unuse logic again.
21182116 * Under global memory pressure, swap entries can be reinserted back
21192117 * into process space after the mmlist loop above passes over them.
2120− * Its not worth continuosuly retrying to unuse the swap in this case.
2121− * So we try SWAP_UNUSE_MAX_TRIES times.
2118+ *
2119+ * Limit the number of retries? No: when mmget_not_zero() above fails,
2120+ * that mm is likely to be freeing swap from exit_mmap(), which proceeds
2121+ * at its own independent pace; and even shmem_writepage() could have
2122+ * been preempted after get_swap_page(), temporarily hiding that swap.
2123+ * It's easy and robust (though cpu-intensive) just to keep retrying.
21222124 */
2123− if (++retries >= SWAP_UNUSE_MAX_TRIES)
2124− retval = -EBUSY;
2125− else if (si->inuse_pages)
2126− goto retry;
2127−
2125+ if (si->inuse_pages) {
2126+ if (!signal_pending(current))
2127+ goto retry;
2128+ retval = -EINTR;
2129+ }
21282130 out:
21292131 return (retval == FRONTSWAP_PAGES_UNUSED) ? 0 : retval;
21302132 }
mm/util.c+1−1
@@ -204,7 +204,7 @@ EXPORT_SYMBOL(vmemdup_user); · 203 unmodified lines
204204 * @s: The string to duplicate
205205 * @n: Maximum number of bytes to copy, including the trailing NUL.
206206 *
207− * Return: newly allocated copy of @s or %NULL in case of error
207+ * Return: newly allocated copy of @s or an ERR_PTR() in case of error
208208 */
209209 char *strndup_user(const char __user *s, long n)
210210 {
mm/vmscan.c+9−20
@@ -2176,7 +2176,6 @@ static void shrink_active_list(unsigned long nr_to_scan, · 2175 unmodified lines
21762176 * 10TB 320 32GB
21772177 */
21782178 static bool inactive_list_is_low(struct lruvec *lruvec, bool file,
2179− struct mem_cgroup *memcg,
21802179 struct scan_control *sc, bool actual_reclaim)
21812180 {
21822181 enum lru_list active_lru = file * LRU_FILE + LRU_ACTIVE;
@@ -2197,16 +2196,12 @@ static bool inactive_list_is_low(struct lruvec *lruvec, bool file, · 14 unmodified lines
21972196 inactive = lruvec_lru_size(lruvec, inactive_lru, sc->reclaim_idx);
21982197 active = lruvec_lru_size(lruvec, active_lru, sc->reclaim_idx);
21992198
2200− if (memcg)
2201− refaults = memcg_page_state(memcg, WORKINGSET_ACTIVATE);
2202− else
2203− refaults = node_page_state(pgdat, WORKINGSET_ACTIVATE);
2204−
22052199 /*
22062200 * When refaults are being observed, it means a new workingset
22072201 * is being established. Disable active list protection to get
22082202 * rid of the stale workingset quickly.
22092203 */
2204+ refaults = lruvec_page_state(lruvec, WORKINGSET_ACTIVATE);
22102205 if (file && actual_reclaim && lruvec->refaults != refaults) {
22112206 inactive_ratio = 0;
22122207 } else {
@@ -2227,12 +2222,10 @@ static bool inactive_list_is_low(struct lruvec *lruvec, bool file, · 14 unmodified lines
22272222 }
22282223
22292224 static unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan,
2230− struct lruvec *lruvec, struct mem_cgroup *memcg,
2231− struct scan_control *sc)
2225+ struct lruvec *lruvec, struct scan_control *sc)
22322226 {
22332227 if (is_active_lru(lru)) {
2234− if (inactive_list_is_low(lruvec, is_file_lru(lru),
2235− memcg, sc, true))
2228+ if (inactive_list_is_low(lruvec, is_file_lru(lru), sc, true))
22362229 shrink_active_list(nr_to_scan, lruvec, sc, lru);
22372230 return 0;
22382231 }
@@ -2332,7 +2325,7 @@ static void get_scan_count(struct lruvec *lruvec, struct mem_cgroup *memcg, · 93 unmodified lines
23322325 * anonymous pages on the LRU in eligible zones.
23332326 * Otherwise, the small LRU gets thrashed.
23342327 */
2335− if (!inactive_list_is_low(lruvec, false, memcg, sc, false) &&
2328+ if (!inactive_list_is_low(lruvec, false, sc, false) &&
23362329 lruvec_lru_size(lruvec, LRU_INACTIVE_ANON, sc->reclaim_idx)
23372330 >> sc->priority) {
23382331 scan_balance = SCAN_ANON;
@@ -2350,7 +2343,7 @@ static void get_scan_count(struct lruvec *lruvec, struct mem_cgroup *memcg, · 11 unmodified lines
23502343 * lruvec even if it has plenty of old anonymous pages unless the
23512344 * system is under heavy pressure.
23522345 */
2353− if (!inactive_list_is_low(lruvec, true, memcg, sc, false) &&
2346+ if (!inactive_list_is_low(lruvec, true, sc, false) &&
23542347 lruvec_lru_size(lruvec, LRU_INACTIVE_FILE, sc->reclaim_idx) >> sc->priority) {
23552348 scan_balance = SCAN_FILE;
23562349 goto out;
@@ -2503,7 +2496,7 @@ static void shrink_node_memcg(struct pglist_data *pgdat, struct mem_cgroup *memc · 146 unmodified lines
25032496 nr[lru] -= nr_to_scan;
25042497
25052498 nr_reclaimed += shrink_list(lru, nr_to_scan,
2506− lruvec, memcg, sc);
2499+ lruvec, sc);
25072500 }
25082501 }
25092502
@@ -2570,7 +2563,7 @@ static void shrink_node_memcg(struct pglist_data *pgdat, struct mem_cgroup *memc · 60 unmodified lines
25702563 * Even if we did not try to evict anon pages at all, we want to
25712564 * rebalance the anon lru active/inactive ratio.
25722565 */
2573− if (inactive_list_is_low(lruvec, false, memcg, sc, true))
2566+ if (inactive_list_is_low(lruvec, false, sc, true))
25742567 shrink_active_list(SWAP_CLUSTER_MAX, lruvec,
25752568 sc, LRU_ACTIVE_ANON);
25762569 }
@@ -2969,12 +2962,8 @@ static void snapshot_refaults(struct mem_cgroup *root_memcg, pg_data_t *pgdat) · 392 unmodified lines
29692962 unsigned long refaults;
29702963 struct lruvec *lruvec;
29712964
2972− if (memcg)
2973− refaults = memcg_page_state(memcg, WORKINGSET_ACTIVATE);
2974− else
2975− refaults = node_page_state(pgdat, WORKINGSET_ACTIVATE);
2976−
29772965 lruvec = mem_cgroup_lruvec(pgdat, memcg);
2966+ refaults = lruvec_page_state(lruvec, WORKINGSET_ACTIVATE);
29782967 lruvec->refaults = refaults;
29792968 } while ((memcg = mem_cgroup_iter(root_memcg, memcg, NULL)));
29802969 }
@@ -3339,7 +3328,7 @@ static void age_active_anon(struct pglist_data *pgdat, · 358 unmodified lines
33393328 do {
33403329 struct lruvec *lruvec = mem_cgroup_lruvec(pgdat, memcg);
33413330
3342− if (inactive_list_is_low(lruvec, false, memcg, sc, true))
3331+ if (inactive_list_is_low(lruvec, false, sc, true))
33433332 shrink_active_list(SWAP_CLUSTER_MAX, lruvec,
33443333 sc, LRU_ACTIVE_ANON);
33453334
mm/vmstat.c+0−5
@@ -1274,13 +1274,8 @@ const char * const vmstat_text[] = { · 1273 unmodified lines
12741274 #endif
12751275 #endif /* CONFIG_MEMORY_BALLOON */
12761276 #ifdef CONFIG_DEBUG_TLBFLUSH
1277−#ifdef CONFIG_SMP
12781277 "nr_tlb_remote_flush",
12791278 "nr_tlb_remote_flush_received",
1280−#else
1281− "", /* nr_tlb_remote_flush */
1282− "", /* nr_tlb_remote_flush_received */
1283−#endif /* CONFIG_SMP */
12841279 "nr_tlb_local_flush_all",
12851280 "nr_tlb_local_flush_one",
12861281 #endif /* CONFIG_DEBUG_TLBFLUSH */
net/8021q/vlan_dev.c+15−11
@@ -443,27 +443,29 @@ static int vlan_dev_fcoe_disable(struct net_device *dev) · 442 unmodified lines
443443 return rc;
444444 }
445445
446−static int vlan_dev_fcoe_get_wwn(struct net_device *dev, u64 *wwn, int type)
446+static int vlan_dev_fcoe_ddp_target(struct net_device *dev, u16 xid,
447+ struct scatterlist *sgl, unsigned int sgc)
447448 {
448449 struct net_device *real_dev = vlan_dev_priv(dev)->real_dev;
449450 const struct net_device_ops *ops = real_dev->netdev_ops;
450− int rc = -EINVAL;
451+ int rc = 0;
452+
453+ if (ops->ndo_fcoe_ddp_target)
454+ rc = ops->ndo_fcoe_ddp_target(real_dev, xid, sgl, sgc);
451455
452− if (ops->ndo_fcoe_get_wwn)
453− rc = ops->ndo_fcoe_get_wwn(real_dev, wwn, type);
454456 return rc;
455457 }
458+#endif
456459
457−static int vlan_dev_fcoe_ddp_target(struct net_device *dev, u16 xid,
458− struct scatterlist *sgl, unsigned int sgc)
460+#ifdef NETDEV_FCOE_WWNN
461+static int vlan_dev_fcoe_get_wwn(struct net_device *dev, u64 *wwn, int type)
459462 {
460463 struct net_device *real_dev = vlan_dev_priv(dev)->real_dev;
461464 const struct net_device_ops *ops = real_dev->netdev_ops;
462− int rc = 0;
463−
464− if (ops->ndo_fcoe_ddp_target)
465− rc = ops->ndo_fcoe_ddp_target(real_dev, xid, sgl, sgc);
465+ int rc = -EINVAL;
466466
467+ if (ops->ndo_fcoe_get_wwn)
468+ rc = ops->ndo_fcoe_get_wwn(real_dev, wwn, type);
467469 return rc;
468470 }
469471 #endif
@@ -794,9 +796,11 @@ static const struct net_device_ops vlan_netdev_ops = { · 324 unmodified lines
794796 .ndo_fcoe_ddp_done = vlan_dev_fcoe_ddp_done,
795797 .ndo_fcoe_enable = vlan_dev_fcoe_enable,
796798 .ndo_fcoe_disable = vlan_dev_fcoe_disable,
797− .ndo_fcoe_get_wwn = vlan_dev_fcoe_get_wwn,
798799 .ndo_fcoe_ddp_target = vlan_dev_fcoe_ddp_target,
799800 #endif
801+#ifdef NETDEV_FCOE_WWNN
802+ .ndo_fcoe_get_wwn = vlan_dev_fcoe_get_wwn,
803+#endif
800804 #ifdef CONFIG_NET_POLL_CONTROLLER
801805 .ndo_poll_controller = vlan_dev_poll_controller,
802806 .ndo_netpoll_setup = vlan_dev_netpoll_setup,
net/atm/lec.c+5−1
@@ -710,7 +710,10 @@ static int lec_vcc_attach(struct atm_vcc *vcc, void __user *arg) · 709 unmodified lines
710710
711711 static int lec_mcast_attach(struct atm_vcc *vcc, int arg)
712712 {
713− if (arg < 0 || arg >= MAX_LEC_ITF || !dev_lec[arg])
713+ if (arg < 0 || arg >= MAX_LEC_ITF)
714+ return -EINVAL;
715+ arg = array_index_nospec(arg, MAX_LEC_ITF);
716+ if (!dev_lec[arg])
714717 return -EINVAL;
715718 vcc->proto_data = dev_lec[arg];
716719 return lec_mcast_make(netdev_priv(dev_lec[arg]), vcc);
@@ -728,6 +731,7 @@ static int lecd_attach(struct atm_vcc *vcc, int arg) · 11 unmodified lines
728731 i = arg;
729732 if (arg >= MAX_LEC_ITF)
730733 return -EINVAL;
734+ i = array_index_nospec(arg, MAX_LEC_ITF);
731735 if (!dev_lec[i]) {
732736 int size;
733737
net/batman-adv/bat_v_elp.c+4−2
@@ -104,8 +104,10 @@ static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh) · 103 unmodified lines
104104
105105 ret = cfg80211_get_station(real_netdev, neigh->addr, &sinfo);
106106
107− /* free the TID stats immediately */
108− cfg80211_sinfo_release_content(&sinfo);
107+ if (!ret) {
108+ /* free the TID stats immediately */
109+ cfg80211_sinfo_release_content(&sinfo);
110+ }
109111
110112 dev_put(real_netdev);
111113 if (ret == -ENOENT) {
net/batman-adv/bridge_loop_avoidance.c+13−3
@@ -803,6 +803,8 @@ static void batadv_bla_del_claim(struct batadv_priv *bat_priv, · 802 unmodified lines
803803 const u8 *mac, const unsigned short vid)
804804 {
805805 struct batadv_bla_claim search_claim, *claim;
806+ struct batadv_bla_claim *claim_removed_entry;
807+ struct hlist_node *claim_removed_node;
806808
807809 ether_addr_copy(search_claim.addr, mac);
808810 search_claim.vid = vid;
@@ -813,10 +815,18 @@ static void batadv_bla_del_claim(struct batadv_priv *bat_priv, · 4 unmodified lines
813815 batadv_dbg(BATADV_DBG_BLA, bat_priv, "%s(): %pM, vid %d\n", __func__,
814816 mac, batadv_print_vid(vid));
815817
816− batadv_hash_remove(bat_priv->bla.claim_hash, batadv_compare_claim,
817− batadv_choose_claim, claim);
818− batadv_claim_put(claim); /* reference from the hash is gone */
818+ claim_removed_node = batadv_hash_remove(bat_priv->bla.claim_hash,
819+ batadv_compare_claim,
820+ batadv_choose_claim, claim);
821+ if (!claim_removed_node)
822+ goto free_claim;
819823
824+ /* reference from the hash is gone */
825+ claim_removed_entry = hlist_entry(claim_removed_node,
826+ struct batadv_bla_claim, hash_entry);
827+ batadv_claim_put(claim_removed_entry);
828+
829+free_claim:
820830 /* don't need the reference from hash_find() anymore */
821831 batadv_claim_put(claim);
822832 }
net/batman-adv/sysfs.c+5−2
@@ -1116,9 +1116,9 @@ static ssize_t batadv_store_throughput_override(struct kobject *kobj, · 1115 unmodified lines
11161116 struct attribute *attr,
11171117 char *buff, size_t count)
11181118 {
1119− struct batadv_priv *bat_priv = batadv_kobj_to_batpriv(kobj);
11201119 struct net_device *net_dev = batadv_kobj_to_netdev(kobj);
11211120 struct batadv_hard_iface *hard_iface;
1121+ struct batadv_priv *bat_priv;
11221122 u32 tp_override;
11231123 u32 old_tp_override;
11241124 bool ret;
@@ -1147,7 +1147,10 @@ static ssize_t batadv_store_throughput_override(struct kobject *kobj, · 22 unmodified lines
11471147
11481148 atomic_set(&hard_iface->bat_v.throughput_override, tp_override);
11491149
1150− batadv_netlink_notify_hardif(bat_priv, hard_iface);
1150+ if (hard_iface->soft_iface) {
1151+ bat_priv = netdev_priv(hard_iface->soft_iface);
1152+ batadv_netlink_notify_hardif(bat_priv, hard_iface);
1153+ }
11511154
11521155 out:
11531156 batadv_hardif_put(hard_iface);
net/batman-adv/translation-table.c+24−8
@@ -616,14 +616,26 @@ static void batadv_tt_global_free(struct batadv_priv *bat_priv, · 615 unmodified lines
616616 struct batadv_tt_global_entry *tt_global,
617617 const char *message)
618618 {
619+ struct batadv_tt_global_entry *tt_removed_entry;
620+ struct hlist_node *tt_removed_node;
621+
619622 batadv_dbg(BATADV_DBG_TT, bat_priv,
620623 "Deleting global tt entry %pM (vid: %d): %s\n",
621624 tt_global->common.addr,
622625 batadv_print_vid(tt_global->common.vid), message);
623626
624− batadv_hash_remove(bat_priv->tt.global_hash, batadv_compare_tt,
625− batadv_choose_tt, &tt_global->common);
626− batadv_tt_global_entry_put(tt_global);
627+ tt_removed_node = batadv_hash_remove(bat_priv->tt.global_hash,
628+ batadv_compare_tt,
629+ batadv_choose_tt,
630+ &tt_global->common);
631+ if (!tt_removed_node)
632+ return;
633+
634+ /* drop reference of remove hash entry */
635+ tt_removed_entry = hlist_entry(tt_removed_node,
636+ struct batadv_tt_global_entry,
637+ common.hash_entry);
638+ batadv_tt_global_entry_put(tt_removed_entry);
627639 }
628640
629641 /**
@@ -1337,9 +1349,10 @@ u16 batadv_tt_local_remove(struct batadv_priv *bat_priv, const u8 *addr, · 707 unmodified lines
13371349 unsigned short vid, const char *message,
13381350 bool roaming)
13391351 {
1352+ struct batadv_tt_local_entry *tt_removed_entry;
13401353 struct batadv_tt_local_entry *tt_local_entry;
13411354 u16 flags, curr_flags = BATADV_NO_FLAGS;
1342− void *tt_entry_exists;
1355+ struct hlist_node *tt_removed_node;
13431356
13441357 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid);
13451358 if (!tt_local_entry)
@@ -1368,15 +1381,18 @@ u16 batadv_tt_local_remove(struct batadv_priv *bat_priv, const u8 *addr, · 22 unmodified lines
13681381 */
13691382 batadv_tt_local_event(bat_priv, tt_local_entry, BATADV_TT_CLIENT_DEL);
13701383
1371− tt_entry_exists = batadv_hash_remove(bat_priv->tt.local_hash,
1384+ tt_removed_node = batadv_hash_remove(bat_priv->tt.local_hash,
13721385 batadv_compare_tt,
13731386 batadv_choose_tt,
13741387 &tt_local_entry->common);
1375− if (!tt_entry_exists)
1388+ if (!tt_removed_node)
13761389 goto out;
13771390
1378− /* extra call to free the local tt entry */
1379− batadv_tt_local_entry_put(tt_local_entry);
1391+ /* drop reference of remove hash entry */
1392+ tt_removed_entry = hlist_entry(tt_removed_node,
1393+ struct batadv_tt_local_entry,
1394+ common.hash_entry);
1395+ batadv_tt_local_entry_put(tt_removed_entry);
13801396
13811397 out:
13821398 if (tt_local_entry)
net/bluetooth/sco.c+2−2
@@ -523,12 +523,12 @@ static int sco_sock_bind(struct socket *sock, struct sockaddr *addr, · 522 unmodified lines
523523 struct sock *sk = sock->sk;
524524 int err = 0;
525525
526− BT_DBG("sk %p %pMR", sk, &sa->sco_bdaddr);
527−
528526 if (!addr || addr_len < sizeof(struct sockaddr_sco) ||
529527 addr->sa_family != AF_BLUETOOTH)
530528 return -EINVAL;
531529
530+ BT_DBG("sk %p %pMR", sk, &sa->sco_bdaddr);
531+
532532 lock_sock(sk);
533533
534534 if (sk->sk_state != BT_OPEN) {
net/bridge/br_input.c+14−9
@@ -197,13 +197,10 @@ static void __br_handle_local_finish(struct sk_buff *skb) · 196 unmodified lines
197197 /* note: already called with rcu_read_lock */
198198 static int br_handle_local_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
199199 {
200− struct net_bridge_port *p = br_port_get_rcu(skb->dev);
201−
202200 __br_handle_local_finish(skb);
203201
204− BR_INPUT_SKB_CB(skb)->brdev = p->br->dev;
205− br_pass_frame_up(skb);
206− return 0;
202+ /* return 1 to signal the okfn() was called so it's ok to use the skb */
203+ return 1;
207204 }
208205
209206 /*
@@ -280,10 +277,18 @@ rx_handler_result_t br_handle_frame(struct sk_buff **pskb) · 70 unmodified lines
280277 goto forward;
281278 }
282279
283− /* Deliver packet to local host only */
284− NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_IN, dev_net(skb->dev),
285− NULL, skb, skb->dev, NULL, br_handle_local_finish);
286− return RX_HANDLER_CONSUMED;
280+ /* The else clause should be hit when nf_hook():
281+ * - returns < 0 (drop/error)
282+ * - returns = 0 (stolen/nf_queue)
283+ * Thus return 1 from the okfn() to signal the skb is ok to pass
284+ */
285+ if (NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_IN,
286+ dev_net(skb->dev), NULL, skb, skb->dev, NULL,
287+ br_handle_local_finish) == 1) {
288+ return RX_HANDLER_PASS;
289+ } else {
290+ return RX_HANDLER_CONSUMED;
291+ }
287292 }
288293
289294 forward:
net/bridge/br_multicast.c+6−1
@@ -601,6 +601,7 @@ static int br_ip4_multicast_add_group(struct net_bridge *br, · 600 unmodified lines
601601 if (ipv4_is_local_multicast(group))
602602 return 0;
603603
604+ memset(&br_group, 0, sizeof(br_group));
604605 br_group.u.ip4 = group;
605606 br_group.proto = htons(ETH_P_IP);
606607 br_group.vid = vid;
@@ -1497,6 +1498,7 @@ static void br_ip4_multicast_leave_group(struct net_bridge *br, · 890 unmodified lines
14971498
14981499 own_query = port ? &port->ip4_own_query : &br->ip4_own_query;
14991500
1501+ memset(&br_group, 0, sizeof(br_group));
15001502 br_group.u.ip4 = group;
15011503 br_group.proto = htons(ETH_P_IP);
15021504 br_group.vid = vid;
@@ -1520,6 +1522,7 @@ static void br_ip6_multicast_leave_group(struct net_bridge *br, · 17 unmodified lines
15201522
15211523 own_query = port ? &port->ip6_own_query : &br->ip6_own_query;
15221524
1525+ memset(&br_group, 0, sizeof(br_group));
15231526 br_group.u.ip6 = *group;
15241527 br_group.proto = htons(ETH_P_IPV6);
15251528 br_group.vid = vid;
@@ -2028,7 +2031,8 @@ static void br_multicast_start_querier(struct net_bridge *br, · 502 unmodified lines
20282031
20292032 __br_multicast_open(br, query);
20302033
2031− list_for_each_entry(port, &br->port_list, list) {
2034+ rcu_read_lock();
2035+ list_for_each_entry_rcu(port, &br->port_list, list) {
20322036 if (port->state == BR_STATE_DISABLED ||
20332037 port->state == BR_STATE_BLOCKING)
20342038 continue;
@@ -2040,6 +2044,7 @@ static void br_multicast_start_querier(struct net_bridge *br, · 5 unmodified lines
20402044 br_multicast_enable(&port->ip6_own_query);
20412045 #endif
20422046 }
2047+ rcu_read_unlock();
20432048 }
20442049
20452050 int br_multicast_toggle(struct net_bridge *br, unsigned long val)
net/bridge/br_netlink.c+1−1
@@ -1441,7 +1441,7 @@ static int br_fill_info(struct sk_buff *skb, const struct net_device *brdev) · 1440 unmodified lines
14411441 nla_put_u8(skb, IFLA_BR_VLAN_STATS_ENABLED,
14421442 br_opt_get(br, BROPT_VLAN_STATS_ENABLED)) ||
14431443 nla_put_u8(skb, IFLA_BR_VLAN_STATS_PER_PORT,
1444− br_opt_get(br, IFLA_BR_VLAN_STATS_PER_PORT)))
1444+ br_opt_get(br, BROPT_VLAN_STATS_PER_PORT)))
14451445 return -EMSGSIZE;
14461446 #endif
14471447 #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
net/core/datagram.c+1−1
@@ -279,7 +279,7 @@ struct sk_buff *__skb_try_recv_datagram(struct sock *sk, unsigned int flags, · 278 unmodified lines
279279 break;
280280
281281 sk_busy_loop(sk, flags & MSG_DONTWAIT);
282− } while (!skb_queue_empty(&sk->sk_receive_queue));
282+ } while (sk->sk_receive_queue.prev != *last);
283283
284284 error = -EAGAIN;
285285
net/core/dev.c+18−2
@@ -1184,7 +1184,21 @@ int dev_change_name(struct net_device *dev, const char *newname) · 1183 unmodified lines
11841184 BUG_ON(!dev_net(dev));
11851185
11861186 net = dev_net(dev);
1187− if (dev->flags & IFF_UP)
1187+
1188+ /* Some auto-enslaved devices e.g. failover slaves are
1189+ * special, as userspace might rename the device after
1190+ * the interface had been brought up and running since
1191+ * the point kernel initiated auto-enslavement. Allow
1192+ * live name change even when these slave devices are
1193+ * up and running.
1194+ *
1195+ * Typically, users of these auto-enslaving devices
1196+ * don't actually care about slave name change, as
1197+ * they are supposed to operate on master interface
1198+ * directly.
1199+ */
1200+ if (dev->flags & IFF_UP &&
1201+ likely(!(dev->priv_flags & IFF_LIVE_RENAME_OK)))
11881202 return -EBUSY;
11891203
11901204 write_seqcount_begin(&devnet_rename_seq);
@@ -5014,8 +5028,10 @@ static inline void __netif_receive_skb_list_ptype(struct list_head *head, · 3823 unmodified lines
50145028 if (pt_prev->list_func != NULL)
50155029 pt_prev->list_func(head, pt_prev, orig_dev);
50165030 else
5017− list_for_each_entry_safe(skb, next, head, list)
5031+ list_for_each_entry_safe(skb, next, head, list) {
5032+ skb_list_del_init(skb);
50185033 pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
5034+ }
50195035 }
50205036
50215037 static void __netif_receive_skb_list_core(struct list_head *head, bool pfmemalloc)
net/core/ethtool.c+30−16
@@ -1797,11 +1797,16 @@ static int ethtool_get_strings(struct net_device *dev, void __user *useraddr) · 1796 unmodified lines
17971797 WARN_ON_ONCE(!ret);
17981798
17991799 gstrings.len = ret;
1800− data = vzalloc(array_size(gstrings.len, ETH_GSTRING_LEN));
1801− if (gstrings.len && !data)
1802− return -ENOMEM;
18031800
1804− __ethtool_get_strings(dev, gstrings.string_set, data);
1801+ if (gstrings.len) {
1802+ data = vzalloc(array_size(gstrings.len, ETH_GSTRING_LEN));
1803+ if (!data)
1804+ return -ENOMEM;
1805+
1806+ __ethtool_get_strings(dev, gstrings.string_set, data);
1807+ } else {
1808+ data = NULL;
1809+ }
18051810
18061811 ret = -EFAULT;
18071812 if (copy_to_user(useraddr, &gstrings, sizeof(gstrings)))
@@ -1897,11 +1902,15 @@ static int ethtool_get_stats(struct net_device *dev, void __user *useraddr) · 89 unmodified lines
18971902 return -EFAULT;
18981903
18991904 stats.n_stats = n_stats;
1900− data = vzalloc(array_size(n_stats, sizeof(u64)));
1901− if (n_stats && !data)
1902− return -ENOMEM;
19031905
1904− ops->get_ethtool_stats(dev, &stats, data);
1906+ if (n_stats) {
1907+ data = vzalloc(array_size(n_stats, sizeof(u64)));
1908+ if (!data)
1909+ return -ENOMEM;
1910+ ops->get_ethtool_stats(dev, &stats, data);
1911+ } else {
1912+ data = NULL;
1913+ }
19051914
19061915 ret = -EFAULT;
19071916 if (copy_to_user(useraddr, &stats, sizeof(stats)))
@@ -1941,16 +1950,21 @@ static int ethtool_get_phy_stats(struct net_device *dev, void __user *useraddr) · 33 unmodified lines
19411950 return -EFAULT;
19421951
19431952 stats.n_stats = n_stats;
1944− data = vzalloc(array_size(n_stats, sizeof(u64)));
1945− if (n_stats && !data)
1946− return -ENOMEM;
19471953
1948− if (dev->phydev && !ops->get_ethtool_phy_stats) {
1949− ret = phy_ethtool_get_stats(dev->phydev, &stats, data);
1950− if (ret < 0)
1951− return ret;
1954+ if (n_stats) {
1955+ data = vzalloc(array_size(n_stats, sizeof(u64)));
1956+ if (!data)
1957+ return -ENOMEM;
1958+
1959+ if (dev->phydev && !ops->get_ethtool_phy_stats) {
1960+ ret = phy_ethtool_get_stats(dev->phydev, &stats, data);
1961+ if (ret < 0)
1962+ goto out;
1963+ } else {
1964+ ops->get_ethtool_phy_stats(dev, &stats, data);
1965+ }
19521966 } else {
1953− ops->get_ethtool_phy_stats(dev, &stats, data);
1967+ data = NULL;
19541968 }
19551969
19561970 ret = -EFAULT;
net/core/failover.c+3−3
@@ -80,14 +80,14 @@ static int failover_slave_register(struct net_device *slave_dev) · 79 unmodified lines
8080 goto err_upper_link;
8181 }
8282
83− slave_dev->priv_flags |= IFF_FAILOVER_SLAVE;
83+ slave_dev->priv_flags |= (IFF_FAILOVER_SLAVE | IFF_LIVE_RENAME_OK);

20 more lines aren’t shown here.

net/core/filter.c+5−13

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

net/core/flow_dissector.c+3−1

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

net/core/net-sysfs.c+5−9

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

net/core/net_namespace.c+1−0

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

net/core/ptp_classifier.c+4−3

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

net/core/rtnetlink.c+1−1

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

net/core/skbuff.c+10−2

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

net/core/sock.c+2−2

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

net/dccp/feat.c+6−1

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

net/dsa/tag_qca.c+10−0

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

net/ipv4/fou.c+3−1

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

net/ipv4/ip_gre.c+10−5

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

net/ipv4/ip_input.c+3−4

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

net/ipv4/ip_options.c+2−2

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

net/ipv4/route.c+15−1

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

net/ipv4/tcp_dctcp.c+35−46

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

net/ipv4/tcp_input.c+5−5

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

net/ipv4/tcp_ipv4.c+2−1

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

net/ipv6/ila/ila_xlat.c+1−0

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

net/ipv6/ip6_gre.c+13−7

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

net/ipv6/ip6_output.c+3−1

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

net/ipv6/ip6_tunnel.c+2−2

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

net/ipv6/route.c+4−0

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

net/ipv6/sit.c+4−0

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

net/ipv6/udp.c+2−0

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

net/kcm/kcmsock.c+8−8

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

net/llc/af_llc.c+1−2

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

net/mac80211/driver-ops.h+3−0

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

net/mac80211/key.c+4−5

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

net/mac80211/mesh_pathtbl.c+1−1

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

net/mac80211/rx.c+9−1

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

net/mac80211/trace_msg.h+6−1

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

net/mac80211/tx.c+23−30

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

net/netlink/af_netlink.c+2−1

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

net/netrom/af_netrom.c+54−22

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

net/netrom/nr_loopback.c+1−1

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

net/netrom/nr_route.c+1−1

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

net/netrom/sysctl_net_netrom.c+4−1

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

net/nfc/nci/hci.c+8−0

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

net/openvswitch/flow_netlink.c+2−2

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

net/rds/af_rds.c+3−0

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

net/rds/bind.c+2−0

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

net/rds/tcp.c+1−1

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

net/rxrpc/af_rxrpc.c+11−6

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

net/rxrpc/ar-internal.h+1−0

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

net/rxrpc/conn_event.c+7−4

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

net/rxrpc/input.c+12−6

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

net/rxrpc/peer_event.c+5−0

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

net/rxrpc/sendmsg.c+12−9

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

net/sched/act_sample.c+8−2

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

net/sched/cls_matchall.c+5−0

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

net/sched/sch_cake.c+12−1

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

net/sched/sch_cbq.c+4−6

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

net/sched/sch_drr.c+4−12

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

net/sched/sch_hfsc.c+5−14

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

net/sched/sch_htb.c+6−16

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

net/sched/sch_mq.c+1−1

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

net/sched/sch_mqprio.c+1−2

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

net/sched/sch_multiq.c+4−6

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

net/sched/sch_prio.c+3−7

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

net/sched/sch_qfq.c+2−12

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

net/sched/sch_red.c+1−2

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

net/sched/sch_sfb.c+1−2

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

net/sched/sch_taprio.c+1−1

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

net/sched/sch_tbf.c+1−2

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

net/sctp/protocol.c+1−0

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

net/sctp/socket.c+2−1

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

net/smc/af_smc.c+39−19

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

net/smc/smc_close.c+21−4

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

net/smc/smc_close.h+1−0

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

net/smc/smc_ism.c+5−0

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

net/smc/smc_pnet.c+2−1

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

net/strparser/strparser.c+5−7

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

net/sunrpc/clnt.c+13−39

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

net/sunrpc/xprtrdma/verbs.c+1−1

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

net/tipc/link.c+2−0

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

net/tipc/name_table.c+2−1

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

net/tipc/netlink_compat.c+20−4

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

net/tipc/sysctl.c+6−2

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

net/tls/tls_device.c+11−1

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

net/tls/tls_main.c+24−0

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

net/tls/tls_sw.c+3−14

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

net/wireless/nl80211.c+12−6

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

net/wireless/reg.c+39−0

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

net/wireless/scan.c+1−2

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

net/wireless/util.c+4−2

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

scripts/atomic/gen-atomics.sh+1−1

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

scripts/coccinelle/api/stream_open.cocci+363−0

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

security/apparmor/lsm.c+48−1

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

security/device_cgroup.c+1−1

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

security/keys/trusted.c+25−7

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

sound/core/info.c+10−2

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

sound/core/init.c+9−9

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

sound/core/seq/seq_clientmgr.c+3−3

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

sound/hda/ext/hdac_ext_bus.c+0−1

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

sound/hda/hdac_bus.c+1−0

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

sound/hda/hdac_component.c+5−1

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

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

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

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

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

sound/pci/hda/patch_realtek.c+57−21

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

sound/soc/codecs/Kconfig+1−0

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

sound/soc/codecs/ab8500-codec.c+1−0

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

sound/soc/codecs/cs35l35.c+11−0

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

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

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

sound/soc/codecs/hdac_hda.c+39−14

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

sound/soc/codecs/hdac_hda.h+1−0

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

sound/soc/codecs/hdmi-codec.c+59−62

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

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

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

sound/soc/codecs/nau8824.c+38−8

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

sound/soc/codecs/rt5682.c+25−31

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

sound/soc/codecs/tlv320aic32x4-i2c.c+2−2

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

sound/soc/codecs/tlv320aic32x4-spi.c+2−2

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

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

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

sound/soc/codecs/tlv320aic3x.c+3−1

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

sound/soc/codecs/wm_adsp.c+33−7

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

sound/soc/codecs/wm_adsp.h+1−0

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

sound/soc/fsl/fsl_asrc.c+14−0

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

sound/soc/fsl/fsl_esai.c+37−10

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

sound/soc/generic/audio-graph-card.c+8−3

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

sound/soc/generic/simple-card.c+9−3

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

sound/soc/intel/atom/sst-mfld-platform-pcm.c+8−0

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

sound/soc/intel/boards/cht_bsw_max98090_ti.c+41−6

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

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

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

sound/soc/intel/skylake/skl-messages.c+1−0

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

sound/soc/intel/skylake/skl-pcm.c+22−6

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

sound/soc/mediatek/common/mtk-btcvsd.c+68−1

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

sound/soc/mediatek/mt8183/mt8183-afe-clk.c+4−0

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

sound/soc/rockchip/rockchip_pdm.c+3−1

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

sound/soc/samsung/i2s.c+6−4

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

sound/soc/samsung/odroid.c+2−2

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

sound/soc/sh/rcar/core.c+2−0

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

sound/soc/sh/rcar/rsnd.h+5−0

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

sound/soc/sh/rcar/src.c+7−14

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

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

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

sound/soc/soc-dapm.c+11−0

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

sound/soc/soc-pcm.c+55−11

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

sound/soc/soc-topology.c+4−3

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

sound/soc/stm/stm32_adfsdm.c+34−4

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

sound/soc/stm/stm32_i2s.c+1−2

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

sound/soc/stm/stm32_sai.c+5−3

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

sound/soc/stm/stm32_sai_sub.c+86−28

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

sound/xen/xen_snd_front_alsa.c+1−1

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

tools/include/uapi/sound/asound.h+1−0

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

tools/io_uring/io_uring-bench.c+4−28

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

tools/lib/bpf/Makefile+4−3

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

tools/lib/bpf/btf.c+3−0

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

tools/lib/traceevent/event-parse.c+1−1

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

tools/objtool/check.c+1−0

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

tools/perf/builtin-stat.c+1−0

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

tools/perf/builtin-top.c+1−0

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

tools/perf/scripts/python/export-to-sqlite.py+1−1

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

tools/perf/util/env.c+6−2

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

tools/perf/util/evlist.c+9−5

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

tools/perf/util/evsel.c+6−6

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

tools/perf/util/header.c+13−9

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

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

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

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

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

tools/power/x86/turbostat/turbostat.c+219−58

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

tools/testing/nvdimm/test/nfit.c+13−4

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

tools/testing/selftests/bpf/prog_tests/flow_dissector.c+68−0

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

tools/testing/selftests/bpf/progs/bpf_flow.c+7−12

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

tools/testing/selftests/bpf/test_btf.c+47−0

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

tools/testing/selftests/bpf/verifier/calls.c+38−0

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

tools/testing/selftests/drivers/net/mlxsw/rtnetlink.sh+20−0

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

tools/testing/selftests/kvm/Makefile+8−1

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

tools/testing/selftests/kvm/include/x86_64/processor.h+27−0

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

tools/testing/selftests/kvm/lib/kvm_util.c+5−0

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

tools/testing/selftests/kvm/lib/x86_64/processor.c+14−6

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

tools/testing/selftests/kvm/x86_64/evmcs_test.c+3−2

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

tools/testing/selftests/kvm/x86_64/smm_test.c+157−0

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

tools/testing/selftests/kvm/x86_64/state_test.c+1−14

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

tools/testing/selftests/net/fib_tests.sh+40−54

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

tools/testing/selftests/proc/proc-pid-vm.c+2−2

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

tools/testing/selftests/proc/proc-self-map-files-002.c+10−10

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

tools/testing/selftests/tc-testing/tc-tests/actions/sample.json+24−0

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

tools/testing/selftests/tc-testing/tc-tests/filters/tests.json+20−0

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

tools/testing/selftests/tpm2/tpm2.py+3−2

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

tools/testing/selftests/tpm2/tpm2_tests.py+63−0

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

virt/kvm/irqchip.c+3−2

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

virt/kvm/kvm_main.c+4−2

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