History

Merge 5.6-rc7 into char-misc-next

We need the char/misc driver fixes in here as well.

Greg Kroah-Hartman committed 6 years ago

Commit baca54d2 parents 217fb36 16fbf79414 files · +3487 −1503Browse files

Unified · Split

414 files
  1. .clang-format +21 −4
  2. Documentation/arm64/silicon-errata.rst +2 −0
  3. Documentation/devicetree/bindings/net/fsl-fman.txt +7 −0
  4. Documentation/filesystems/porting.rst +8 −0
  5. Documentation/kbuild/kbuild.rst +1 −1
  6. Documentation/kbuild/kconfig-macro-language.rst +1 −1
  7. Documentation/kbuild/makefiles.rst +3 −3
  8. Documentation/kbuild/modules.rst +2 −2
  9. Documentation/networking/devlink/devlink-region.rst +0 −3
  10. Documentation/networking/net_failover.rst +3 −3
  11. Documentation/networking/rds.txt +1 −1
  12. MAINTAINERS +2 −4
  13. Makefile +2 −2
  14. arch/arc/Kconfig +2 −2
  15. arch/arc/configs/nps_defconfig +0 −2
  16. arch/arc/configs/nsimosci_defconfig +0 −2
  17. arch/arc/configs/nsimosci_hs_defconfig +0 −2
  18. arch/arc/configs/nsimosci_hs_smp_defconfig +0 −2
  19. arch/arc/include/asm/fpu.h +2 −0
  20. arch/arc/include/asm/linkage.h +2 −0
  21. arch/arc/kernel/setup.c +1 −1
  22. arch/arc/kernel/troubleshoot.c +12 −15
  23. arch/arm/Makefile +3 −1
  24. arch/arm/boot/compressed/Makefile +2 −2
  25. arch/arm/kernel/vdso.c +2 −0
  26. arch/arm/lib/copy_from_user.S +1 −1
  27. arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi +2 −0
  28. arch/arm64/include/asm/mmu.h +1 −3
  29. arch/arm64/include/asm/pgtable-prot.h +4 −2
  30. arch/arm64/include/asm/unistd.h +1 −1
  31. arch/arm64/kernel/smp.c +20 −5
  32. arch/mips/boot/dts/ingenic/ci20.dts +28 −16
  33. arch/mips/kernel/setup.c +2 −1
  34. arch/powerpc/kvm/book3s_pr.c +1 −0
  35. arch/powerpc/kvm/powerpc.c +0 −2
  36. arch/powerpc/mm/kasan/kasan_init_32.c +2 −7
  37. arch/s390/kvm/kvm-s390.c +17 −1
  38. arch/x86/Makefile +3 −2
  39. arch/x86/crypto/Makefile +6 −1
  40. arch/x86/events/amd/uncore.c +7 −10
  41. arch/x86/include/asm/kvm_emulate.h +0 −1
  42. arch/x86/kernel/apic/vector.c +8 −6
  43. arch/x86/kernel/cpu/mce/intel.c +5 −4
  44. arch/x86/kernel/cpu/mce/therm_throt.c +7 −2
  45. arch/x86/kvm/Kconfig +1 −1
  46. arch/x86/kvm/emulate.c +1 −0
  47. arch/x86/kvm/ioapic.c +5 −2
  48. arch/x86/kvm/svm.c +2 −1
  49. arch/x86/kvm/vmx/nested.c +3 −2
  50. arch/x86/kvm/vmx/vmx.c +14 −2
  51. arch/x86/kvm/x86.c +5 −3
  52. arch/x86/mm/fault.c +24 −2
  53. arch/x86/mm/ioremap.c +18 −0
  54. block/blk-iocost.c +1 −1
  55. block/blk-mq-sched.c +22 −0
  56. block/genhd.c +36 −0
  57. drivers/acpi/apei/ghes.c +1 −1
  58. drivers/android/binderfs.c +1 −0
  59. drivers/atm/nicstar.c +1 −1
  60. drivers/auxdisplay/Kconfig +8 −8
  61. drivers/auxdisplay/charlcd.c +1 −1
  62. drivers/auxdisplay/img-ascii-lcd.c +1 −3
  63. drivers/base/platform.c +6 −19
  64. drivers/block/virtio_blk.c +12 −5
  65. drivers/char/ipmi/ipmi_si_platform.c +2 −2
  66. drivers/clk/clk.c +2 −2
  67. drivers/clk/qcom/dispcc-sc7180.c +0 −19
  68. drivers/clk/qcom/videocc-sc7180.c +1 −1
  69. drivers/firmware/efi/efivars.c +23 −9
  70. drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +3 −3
  71. drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 −0
  72. drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c +1 −1
  73. drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c +1 −1
  74. drivers/gpu/drm/amd/amdgpu/soc15.c +23 −2
  75. drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +1 −1
  76. drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +1 −1
  77. drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +1 −1
  78. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +15 −3
  79. drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +11 −0
  80. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_init.c +0 −1
  81. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +114 −0
  82. drivers/gpu/drm/amd/display/dc/dcn21/dcn21_init.c +0 −1
  83. drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +5 −2
  84. drivers/gpu/drm/amd/powerplay/navi10_ppt.c +13 −9
  85. drivers/gpu/drm/amd/powerplay/renoir_ppt.c +3 −2
  86. drivers/gpu/drm/arm/display/komeda/komeda_drv.c +2 −2
  87. drivers/gpu/drm/bochs/bochs_hw.c +2 −4
  88. drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +26 −20
  89. drivers/gpu/drm/drm_dp_mst_topology.c +126 −58
  90. drivers/gpu/drm/drm_lease.c +2 −1
  91. drivers/gpu/drm/exynos/exynos5433_drm_decon.c +3 −2
  92. drivers/gpu/drm/exynos/exynos7_drm_decon.c +3 −2
  93. drivers/gpu/drm/exynos/exynos_drm_dma.c +19 −9
  94. drivers/gpu/drm/exynos/exynos_drm_drv.h +4 −2
  95. drivers/gpu/drm/exynos/exynos_drm_fimc.c +3 −2
  96. drivers/gpu/drm/exynos/exynos_drm_fimd.c +3 −2
  97. drivers/gpu/drm/exynos/exynos_drm_g2d.c +3 −2
  98. drivers/gpu/drm/exynos/exynos_drm_gsc.c +3 −2
  99. drivers/gpu/drm/exynos/exynos_drm_rotator.c +3 −2
  100. drivers/gpu/drm/exynos/exynos_drm_scaler.c +4 −2
  101. drivers/gpu/drm/exynos/exynos_mixer.c +5 −2
  102. drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +2 −1
  103. drivers/gpu/drm/i915/gt/intel_lrc.c +30 −51
  104. drivers/gpu/drm/i915/gt/intel_timeline.c +6 −2
  105. drivers/gpu/drm/i915/gt/intel_workarounds.c +22 −3
  106. drivers/gpu/drm/i915/gvt/display.c +2 −1
  107. drivers/gpu/drm/i915/gvt/opregion.c +2 −3
  108. drivers/gpu/drm/i915/gvt/vgpu.c +9 −3
  109. drivers/gpu/drm/i915/i915_request.c +20 −8
  110. drivers/gpu/drm/i915/i915_request.h +2 −0
  111. drivers/gpu/drm/i915/i915_utils.h +5 −0
  112. drivers/hid/hid-google-hammer.c +2 −0
  113. drivers/hid/hid-ids.h +2 −0
  114. drivers/hid/hid-picolcd_fb.c +2 −2
  115. drivers/hid/hid-quirks.c +1 −0
  116. drivers/hid/hid-sensor-custom.c +3 −3
  117. drivers/hwtracing/intel_th/msu.c +7 −6
  118. drivers/hwtracing/intel_th/pci.c +5 −0
  119. drivers/hwtracing/stm/p_sys-t.c +3 −3
  120. drivers/i2c/busses/i2c-designware-pcidrv.c +1 −0
  121. drivers/i2c/busses/i2c-gpio.c +1 −1
  122. drivers/i2c/busses/i2c-i801.c +12 −33
  123. drivers/i2c/i2c-core-acpi.c +9 −1
  124. drivers/iio/accel/adxl372.c +1 −0
  125. drivers/iio/accel/st_accel_i2c.c +1 −1
  126. drivers/iio/adc/at91-sama5d2_adc.c +15 −0
  127. drivers/iio/adc/stm32-dfsdm-adc.c +10 −33
  128. drivers/iio/chemical/Kconfig +2 −0
  129. drivers/iio/light/vcnl4000.c +8 −7
  130. drivers/iio/magnetometer/ak8974.c +1 −1
  131. drivers/iio/proximity/ping.c +1 −1
  132. drivers/iio/trigger/stm32-timer-trigger.c +9 −2
  133. drivers/iommu/amd_iommu.c +2 −2
  134. drivers/iommu/dma-iommu.c +8 −8
  135. drivers/iommu/dmar.c +17 −7
  136. drivers/iommu/intel-iommu-debugfs.c +35 −16
  137. drivers/iommu/intel-iommu.c +19 −9
  138. drivers/iommu/io-pgtable-arm.c +2 −2
  139. drivers/irqchip/irq-gic-v3.c +29 −1
  140. drivers/macintosh/windfarm_ad7417_sensor.c +7 −0
  141. drivers/macintosh/windfarm_fcu_controls.c +7 −0
  142. drivers/macintosh/windfarm_lm75_sensor.c +15 −1
  143. drivers/macintosh/windfarm_lm87_sensor.c +7 −0
  144. drivers/macintosh/windfarm_max6690_sensor.c +7 −0
  145. drivers/macintosh/windfarm_smu_sat.c +7 −0
  146. drivers/misc/cardreader/rts5227.c +1 −1
  147. drivers/misc/cardreader/rts5249.c +2 −0
  148. drivers/misc/cardreader/rts5260.c +1 −1
  149. drivers/misc/cardreader/rts5261.c +1 −1
  150. drivers/misc/eeprom/at24.c +2 −1
  151. drivers/mmc/core/core.c +4 −1
  152. drivers/mmc/core/mmc.c +5 −2
  153. drivers/mmc/core/mmc_ops.c +4 −2
  154. drivers/mmc/host/rtsx_pci_sdmmc.c +8 −5
  155. drivers/mmc/host/sdhci-acpi.c +82 −2
  156. drivers/mmc/host/sdhci-cadence.c +16 −2
  157. drivers/mmc/host/sdhci-msm.c +1 −1
  158. drivers/mmc/host/sdhci-of-at91.c +6 −2
  159. drivers/mmc/host/sdhci-omap.c +3 −0
  160. drivers/mmc/host/sdhci-pci-gli.c +17 −0
  161. drivers/mmc/host/sdhci-tegra.c +3 −0
  162. drivers/net/bonding/bond_alb.c +10 −10
  163. drivers/net/can/dev.c +1 −0
  164. drivers/net/dsa/mv88e6xxx/chip.c +2 −0
  165. drivers/net/dsa/mv88e6xxx/global2.c +7 −1
  166. drivers/net/dsa/sja1105/sja1105_main.c +2 −1
  167. drivers/net/ethernet/broadcom/bcmsysport.c +1 −1
  168. drivers/net/ethernet/broadcom/bnxt/bnxt.c +2 −2
  169. drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +11 −13
  170. drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +27 −22
  171. drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +108 −6
  172. drivers/net/ethernet/freescale/fec_main.c +3 −3
  173. drivers/net/ethernet/freescale/fman/Kconfig +28 −0
  174. drivers/net/ethernet/freescale/fman/fman.c +18 −0
  175. drivers/net/ethernet/freescale/fman/fman.h +5 −0
  176. drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h +1 −0
  177. drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +1 −1
  178. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +42 −5
  179. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c +1 −0
  180. drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +3 −0
  181. drivers/net/ethernet/ibm/ibmvnic.c +22 −2
  182. drivers/net/ethernet/ibm/ibmvnic.h +5 −1
  183. drivers/net/ethernet/marvell/mvmdio.c +3 −3
  184. drivers/net/ethernet/mscc/ocelot.c +17 −11
  185. drivers/net/ethernet/pensando/ionic/ionic_lif.c +4 −4
  186. drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c +1 −1
  187. drivers/net/ethernet/sfc/ef10.c +17 −15
  188. drivers/net/ethernet/sfc/efx.h +1 −0
  189. drivers/net/ethernet/sfc/efx_channels.c +1 −0
  190. drivers/net/ethernet/sfc/net_driver.h +0 −3
  191. drivers/net/ethernet/sfc/tx.c +38 −0
  192. drivers/net/ethernet/sfc/tx_common.c +16 −13
  193. drivers/net/ethernet/sfc/tx_common.h +6 −0
  194. drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c +2 −1
  195. drivers/net/ipvlan/ipvlan_core.c +11 −8
  196. drivers/net/ipvlan/ipvlan_main.c +1 −4
  197. drivers/net/macsec.c +20 −5
  198. drivers/net/macvlan.c +2 −0
  199. drivers/net/phy/bcm63xx.c +1 −0
  200. drivers/net/phy/phy.c +2 −1
  201. drivers/net/phy/phy_device.c +5 −1
  202. drivers/net/phy/phylink.c +7 −1
  203. drivers/net/slip/slhc.c +10 −4
  204. drivers/net/team/team.c +2 −0
  205. drivers/net/usb/r8152.c +8 −0
  206. drivers/net/veth.c +1 −1
  207. drivers/net/wireless/intel/iwlwifi/mvm/nvm.c +2 −1
  208. drivers/net/wireless/mediatek/mt76/dma.c +6 −3
  209. drivers/nvme/host/rdma.c +5 −3
  210. drivers/nvme/target/tcp.c +9 −3
  211. drivers/of/of_mdio.c +1 −0
  212. drivers/pinctrl/cirrus/pinctrl-madera-core.c +13 −0
  213. drivers/pinctrl/core.c +0 −1
  214. drivers/pinctrl/freescale/pinctrl-scu.c +2 −2
  215. drivers/pinctrl/meson/pinctrl-meson-gxl.c +2 −2
  216. drivers/pinctrl/pinctrl-falcon.c +1 −1
  217. drivers/pinctrl/qcom/pinctrl-msm.c +1 −2
  218. drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c +1 −1
  219. drivers/rtc/Kconfig +1 −0
  220. drivers/s390/block/dasd.c +24 −3
  221. drivers/s390/block/dasd_eckd.c +156 −7
  222. drivers/s390/block/dasd_int.h +13 −2
  223. drivers/s390/net/qeth_core.h +2 −2
  224. drivers/s390/net/qeth_core_main.c +118 −58
  225. drivers/s390/net/qeth_core_sys.c +4 −5
  226. drivers/s390/net/qeth_l2_main.c +1 −0
  227. drivers/s390/net/qeth_l3_main.c +1 −0
  228. drivers/s390/net/qeth_l3_sys.c +4 −5
  229. drivers/scsi/ipr.c +2 −1
  230. drivers/scsi/ipr.h +1 −0
  231. drivers/scsi/ufs/ufshcd.c +14 −7
  232. drivers/slimbus/qcom-ngd-ctrl.c +3 −0
  233. drivers/staging/greybus/tools/loopback_test.c +11 −10
  234. drivers/staging/rtl8188eu/os_dep/usb_intf.c +1 −0
  235. drivers/staging/speakup/main.c +1 −1
  236. drivers/staging/wfx/hif_tx.c +8 −7
  237. drivers/staging/wfx/hif_tx.h +1 −1
  238. drivers/staging/wfx/hif_tx_mib.h +10 −5
  239. drivers/staging/wfx/sta.c +15 −10
  240. drivers/thunderbolt/switch.c +1 −1
  241. drivers/tty/tty_io.c +6 −8
  242. drivers/usb/chipidea/udc.c +4 −3
  243. drivers/usb/class/cdc-acm.c +21 −13
  244. drivers/usb/core/quirks.c +6 −0
  245. drivers/usb/host/xhci-pci.c +2 −1
  246. drivers/usb/host/xhci-plat.c +1 −0
  247. drivers/usb/host/xhci-trace.h +6 −17
  248. drivers/usb/serial/option.c +2 −0
  249. drivers/usb/serial/pl2303.c +1 −0
  250. drivers/usb/serial/pl2303.h +1 −0
  251. drivers/usb/typec/ucsi/displayport.c +11 −1
  252. drivers/virtio/virtio_balloon.c +1 −1
  253. drivers/virtio/virtio_ring.c +2 −2
  254. drivers/watchdog/iTCO_vendor.h +2 −0
  255. drivers/watchdog/iTCO_vendor_support.c +9 −7
  256. drivers/watchdog/iTCO_wdt.c +16 −12
  257. fs/afs/addr_list.c +1 −1
  258. fs/afs/internal.h +1 −1
  259. fs/btrfs/block-group.c +2 −2
  260. fs/btrfs/inode.c +4 −0
  261. fs/cifs/dir.c +0 −1
  262. fs/cifs/file.c +2 −1
  263. fs/cifs/inode.c +1 −1
  264. fs/cifs/smb2ops.c +3 −1
  265. fs/crypto/keysetup.c +9 −0
  266. fs/eventpoll.c +4 −4
  267. fs/file.c +6 −1
  268. fs/fuse/dev.c +3 −3
  269. fs/fuse/fuse_i.h +2 −0
  270. fs/gfs2/inode.c +1 −1
  271. fs/inode.c +1 −0
  272. fs/io_uring.c +29 −18
  273. fs/locks.c +48 −6
  274. fs/nfs/client.c +1 −0
  275. fs/nfs/fs_context.c +9 −0
  276. fs/nfs/fscache.c +2 −0
  277. fs/nfs/namespace.c +1 −1
  278. fs/nfs/nfs4client.c +0 −1
  279. fs/open.c +0 −3
  280. fs/overlayfs/Kconfig +1 −0
  281. fs/overlayfs/file.c +6 −0
  282. fs/overlayfs/overlayfs.h +6 −1
  283. fs/overlayfs/super.c +8 −1
  284. fs/overlayfs/util.c +2 −2
  285. include/crypto/curve25519.h +4 −2
  286. include/drm/drm_dp_mst_helper.h +2 −2
  287. include/dt-bindings/clock/imx8mn-clock.h +2 −2
  288. include/linux/cgroup.h +1 −0
  289. include/linux/dmar.h +9 −5
  290. include/linux/file.h +1 −0
  291. include/linux/fs.h +1 −0
  292. include/linux/futex.h +10 −7
  293. include/linux/genhd.h +1 −12
  294. include/linux/inet_diag.h +12 −6
  295. include/linux/intel-iommu.h +2 −0
  296. include/linux/mmc/host.h +1 −0
  297. include/linux/of_clk.h +4 −4
  298. include/linux/page-flags.h +1 −1
  299. include/linux/phy.h +3 −0
  300. include/linux/platform_device.h +1 −1
  301. include/linux/rhashtable.h +1 −1
  302. include/linux/socket.h +2 −1
  303. include/linux/vmalloc.h +3 −2
  304. include/linux/workqueue.h +16 −0
  305. include/net/fib_rules.h +1 −0
  306. include/soc/mscc/ocelot_dev.h +1 −1
  307. include/uapi/linux/in.h +2 −0
  308. init/Kconfig +1 −2
  309. kernel/cgroup/cgroup-v1.c +2 −1
  310. kernel/cgroup/cgroup.c +30 −13
  311. kernel/futex.c +55 −38
  312. kernel/notifier.c +1 −1
  313. kernel/pid.c +10 −0
  314. kernel/sys.c +2 −0
  315. kernel/trace/ftrace.c +2 −0
  316. kernel/workqueue.c +8 −6
  317. mm/madvise.c +9 −3
  318. mm/memcontrol.c +68 −49
  319. mm/mmu_notifier.c +18 −9
  320. mm/nommu.c +7 −3
  321. mm/slub.c +30 −11
  322. mm/sparse.c +6 −2
  323. mm/vmalloc.c +7 −4
  324. net/batman-adv/bat_iv_ogm.c +4 −0
  325. net/caif/caif_dev.c +2 −1
  326. net/core/devlink.c +21 −12
  327. net/core/netclassid_cgroup.c +37 −10
  328. net/core/sock.c +4 −1
  329. net/dsa/dsa_priv.h +2 −0
  330. net/dsa/port.c +35 −9
  331. net/dsa/slave.c +2 −6
  332. net/ieee802154/nl_policy.c +6 −0
  333. net/ipv4/gre_demux.c +10 −2
  334. net/ipv4/inet_connection_sock.c +20 −0
  335. net/ipv4/inet_diag.c +20 −24
  336. net/ipv4/raw_diag.c +3 −2
  337. net/ipv4/udp_diag.c +3 −2
  338. net/ipv6/addrconf.c +40 −11
  339. net/ipv6/seg6_iptunnel.c +1 −1
  340. net/ipv6/seg6_local.c +1 −1
  341. net/mac80211/mesh_hwmp.c +2 −1
  342. net/mptcp/options.c +17 −2
  343. net/netfilter/nf_conntrack_standalone.c +1 −1
  344. net/netfilter/nf_synproxy_core.c +1 −1
  345. net/netfilter/nf_tables_api.c +14 −8
  346. net/netfilter/nfnetlink_cthelper.c +2 −0
  347. net/netfilter/nft_chain_nat.c +1 −0
  348. net/netfilter/nft_payload.c +1 −0
  349. net/netfilter/nft_tunnel.c +2 −0
  350. net/netfilter/x_tables.c +3 −3
  351. net/netfilter/xt_recent.c +1 −1
  352. net/netlink/af_netlink.c +1 −1
  353. net/nfc/hci/core.c +16 −3
  354. net/nfc/netlink.c +4 −0
  355. net/openvswitch/datapath.c +1 −0
  356. net/packet/af_packet.c +7 −6
  357. net/sched/sch_fq.c +1 −0
  358. net/sched/sch_taprio.c +10 −3
  359. net/sctp/diag.c +2 −6
  360. net/smc/smc_ib.c +1 −0
  361. net/socket.c +5 −3
  362. net/tipc/netlink.c +1 −0
  363. net/wireless/nl80211.c +5 −0
  364. scripts/Kconfig.include +7 −0
  365. scripts/Makefile.extrawarn +1 −0
  366. scripts/export_report.pl +1 −1
  367. scripts/kallsyms.c +4 −4
  368. scripts/mod/modpost.c +14 −13
  369. sound/core/oss/pcm_plugin.c +10 −2
  370. sound/core/seq/oss/seq_oss_midi.c +1 −0
  371. sound/core/seq/seq_virmidi.c +1 −0
  372. sound/pci/hda/patch_realtek.c +25 −0
  373. sound/usb/line6/driver.c +1 −1
  374. sound/usb/line6/midibuf.c +1 −1
  375. tools/include/uapi/asm/errno.h +7 −7
  376. tools/perf/arch/arm64/util/arm-spe.c +10 −10
  377. tools/perf/arch/arm64/util/perf_regs.c +1 −1
  378. tools/perf/arch/powerpc/util/perf_regs.c +2 −2
  379. tools/perf/arch/x86/util/auxtrace.c +7 −7
  380. tools/perf/arch/x86/util/event.c +6 −6
  381. tools/perf/arch/x86/util/header.c +2 −2
  382. tools/perf/arch/x86/util/intel-bts.c +12 −12
  383. tools/perf/arch/x86/util/intel-pt.c +15 −15
  384. tools/perf/arch/x86/util/machine.c +3 −3
  385. tools/perf/arch/x86/util/perf_regs.c +4 −4
  386. tools/perf/arch/x86/util/pmu.c +3 −3
  387. tools/perf/bench/bench.h +4 −0
  388. tools/perf/bench/epoll-ctl.c +4 −4
  389. tools/perf/bench/epoll-wait.c +6 −6
  390. tools/perf/bench/futex-hash.c +7 −6
  391. tools/perf/bench/futex-lock-pi.c +6 −6
  392. tools/perf/bench/futex-requeue.c +1 −0
  393. tools/perf/bench/futex-wake-parallel.c +1 −0
  394. tools/perf/bench/futex-wake.c +3 −2
  395. tools/perf/builtin-diff.c +2 −1
  396. tools/perf/builtin-top.c +3 −1
  397. tools/perf/pmu-events/jevents.c +9 −6
  398. tools/perf/tests/bp_account.c +1 −1
  399. tools/perf/util/block-info.c +2 −1
  400. tools/perf/util/env.c +2 −2
  401. tools/perf/util/map.c +1 −1
  402. tools/perf/util/parse-events.c +2 −8
  403. tools/perf/util/symbol.c +6 −7
  404. tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c +1 −1
  405. tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c +1 −1
  406. tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c +2 −0
  407. tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h +1 −1
  408. tools/power/x86/turbostat/Makefile +1 −1
  409. tools/power/x86/turbostat/turbostat.c +113 −29
  410. tools/testing/ktest/ktest.pl +8 −8
  411. tools/testing/ktest/sample.conf +11 −11
  412. tools/testing/selftests/net/fib_tests.sh +31 −3
  413. tools/testing/selftests/tc-testing/config +1 −0
  414. usr/Kconfig +11 −11
.clang-format+21−4
@@ -86,6 +86,8 @@ ForEachMacros: · 85 unmodified lines
8686 - 'bio_for_each_segment_all'
8787 - 'bio_list_for_each'
8888 - 'bip_for_each_vec'
89+ - 'bitmap_for_each_clear_region'
90+ - 'bitmap_for_each_set_region'
8991 - 'blkg_for_each_descendant_post'
9092 - 'blkg_for_each_descendant_pre'
9193 - 'blk_queue_for_each_rl'
@@ -115,6 +117,7 @@ ForEachMacros: · 23 unmodified lines
115117 - 'drm_client_for_each_connector_iter'
116118 - 'drm_client_for_each_modeset'
117119 - 'drm_connector_for_each_possible_encoder'
120+ - 'drm_for_each_bridge_in_chain'
118121 - 'drm_for_each_connector_iter'
119122 - 'drm_for_each_crtc'
120123 - 'drm_for_each_encoder'
@@ -136,9 +139,10 @@ ForEachMacros: · 15 unmodified lines
136139 - 'for_each_bio'
137140 - 'for_each_board_func_rsrc'
138141 - 'for_each_bvec'
142+ - 'for_each_card_auxs'
143+ - 'for_each_card_auxs_safe'
139144 - 'for_each_card_components'
140− - 'for_each_card_links'
141− - 'for_each_card_links_safe'
145+ - 'for_each_card_pre_auxs'
142146 - 'for_each_card_prelinks'
143147 - 'for_each_card_rtds'
144148 - 'for_each_card_rtds_safe'
@@ -166,6 +170,7 @@ ForEachMacros: · 21 unmodified lines
166170 - 'for_each_dpcm_fe'
167171 - 'for_each_drhd_unit'
168172 - 'for_each_dss_dev'
173+ - 'for_each_efi_handle'
169174 - 'for_each_efi_memory_desc'
170175 - 'for_each_efi_memory_desc_in_map'
171176 - 'for_each_element'
@@ -190,6 +195,7 @@ ForEachMacros: · 18 unmodified lines
190195 - 'for_each_lru'
191196 - 'for_each_matching_node'
192197 - 'for_each_matching_node_and_match'
198+ - 'for_each_member'
193199 - 'for_each_memblock'
194200 - 'for_each_memblock_type'
195201 - 'for_each_memcg_cache_index'
@@ -200,9 +206,11 @@ ForEachMacros: · 4 unmodified lines
200206 - 'for_each_msi_entry'
201207 - 'for_each_msi_entry_safe'
202208 - 'for_each_net'
209+ - 'for_each_net_continue_reverse'
203210 - 'for_each_netdev'
204211 - 'for_each_netdev_continue'
205212 - 'for_each_netdev_continue_rcu'
213+ - 'for_each_netdev_continue_reverse'
206214 - 'for_each_netdev_feature'
207215 - 'for_each_netdev_in_bond_rcu'
208216 - 'for_each_netdev_rcu'
@@ -254,10 +262,10 @@ ForEachMacros: · 45 unmodified lines
254262 - 'for_each_reserved_mem_region'
255263 - 'for_each_rtd_codec_dai'
256264 - 'for_each_rtd_codec_dai_rollback'
257− - 'for_each_rtdcom'
258− - 'for_each_rtdcom_safe'
265+ - 'for_each_rtd_components'
259266 - 'for_each_set_bit'
260267 - 'for_each_set_bit_from'
268+ - 'for_each_set_clump8'
261269 - 'for_each_sg'
262270 - 'for_each_sg_dma_page'
263271 - 'for_each_sg_page'
@@ -267,6 +275,7 @@ ForEachMacros: · 3 unmodified lines
267275 - 'for_each_subelement_id'
268276 - '__for_each_thread'
269277 - 'for_each_thread'
278+ - 'for_each_wakeup_source'
270279 - 'for_each_zone'
271280 - 'for_each_zone_zonelist'
272281 - 'for_each_zone_zonelist_nodemask'
@@ -330,6 +339,7 @@ ForEachMacros: · 57 unmodified lines
330339 - 'list_for_each'
331340 - 'list_for_each_codec'
332341 - 'list_for_each_codec_safe'
342+ - 'list_for_each_continue'
333343 - 'list_for_each_entry'
334344 - 'list_for_each_entry_continue'
335345 - 'list_for_each_entry_continue_rcu'
@@ -351,6 +361,7 @@ ForEachMacros: · 15 unmodified lines
351361 - 'llist_for_each_entry'
352362 - 'llist_for_each_entry_safe'
353363 - 'llist_for_each_safe'
364+ - 'mci_for_each_dimm'
354365 - 'media_device_for_each_entity'
355366 - 'media_device_for_each_intf'
356367 - 'media_device_for_each_link'
@@ -444,10 +455,16 @@ ForEachMacros: · 87 unmodified lines
444455 - 'virtio_device_for_each_vq'
445456 - 'xa_for_each'
446457 - 'xa_for_each_marked'
458+ - 'xa_for_each_range'
447459 - 'xa_for_each_start'
448460 - 'xas_for_each'
449461 - 'xas_for_each_conflict'
450462 - 'xas_for_each_marked'
463+ - 'xbc_array_for_each_value'
464+ - 'xbc_for_each_key_value'
465+ - 'xbc_node_for_each_array_value'
466+ - 'xbc_node_for_each_child'
467+ - 'xbc_node_for_each_key_value'
451468 - 'zorro_for_each_dev'
452469
453470 #IncludeBlocks: Preserve # Unknown to clang-format-5.0
Documentation/arm64/silicon-errata.rst+2−0
@@ -110,6 +110,8 @@ stable kernels. · 109 unmodified lines
110110 +----------------+-----------------+-----------------+-----------------------------+
111111 | Cavium | ThunderX GICv3 | #23154 | CAVIUM_ERRATUM_23154 |
112112 +----------------+-----------------+-----------------+-----------------------------+
113+| Cavium | ThunderX GICv3 | #38539 | N/A |
114++----------------+-----------------+-----------------+-----------------------------+
113115 | Cavium | ThunderX Core | #27456 | CAVIUM_ERRATUM_27456 |
114116 +----------------+-----------------+-----------------+-----------------------------+
115117 | Cavium | ThunderX Core | #30115 | CAVIUM_ERRATUM_30115 |
Documentation/devicetree/bindings/net/fsl-fman.txt+7−0
@@ -110,6 +110,13 @@ PROPERTIES · 109 unmodified lines
110110 Usage: required
111111 Definition: See soc/fsl/qman.txt and soc/fsl/bman.txt
112112
113+- fsl,erratum-a050385
114+ Usage: optional
115+ Value type: boolean
116+ Definition: A boolean property. Indicates the presence of the
117+ erratum A050385 which indicates that DMA transactions that are
118+ split can result in a FMan lock.
119+
113120 =============================================================================
114121 FMan MURAM Node
115122
Documentation/filesystems/porting.rst+8−0
@@ -850,3 +850,11 @@ business doing so. · 849 unmodified lines
850850 d_alloc_pseudo() is internal-only; uses outside of alloc_file_pseudo() are
851851 very suspect (and won't work in modules). Such uses are very likely to
852852 be misspelled d_alloc_anon().
853+
854+---
855+
856+**mandatory**
857+
858+[should've been added in 2016] stale comment in finish_open() nonwithstanding,
859+failure exits in ->atomic_open() instances should *NOT* fput() the file,
860+no matter what. Everything is handled by the caller.
Documentation/kbuild/kbuild.rst+1−1
@@ -237,7 +237,7 @@ This is solely useful to speed up test compiles. · 236 unmodified lines
237237 KBUILD_EXTRA_SYMBOLS
238238 --------------------
239239 For modules that use symbols from other modules.
240−See more details in modules.txt.
240+See more details in modules.rst.
241241
242242 ALLSOURCE_ARCHS
243243 ---------------
Documentation/kbuild/kconfig-macro-language.rst+1−1
@@ -44,7 +44,7 @@ intermediate:: · 43 unmodified lines
4444 def_bool y
4545
4646 Then, Kconfig moves onto the evaluation stage to resolve inter-symbol
47−dependency as explained in kconfig-language.txt.
47+dependency as explained in kconfig-language.rst.
4848
4949
5050 Variables
Documentation/kbuild/makefiles.rst+3−3
@@ -924,7 +924,7 @@ When kbuild executes, the following steps are followed (roughly): · 923 unmodified lines
924924 $(KBUILD_AFLAGS_MODULE) is used to add arch-specific options that
925925 are used for assembler.
926926
927− From commandline AFLAGS_MODULE shall be used (see kbuild.txt).
927+ From commandline AFLAGS_MODULE shall be used (see kbuild.rst).
928928
929929 KBUILD_CFLAGS_KERNEL
930930 $(CC) options specific for built-in
@@ -937,7 +937,7 @@ When kbuild executes, the following steps are followed (roughly): · 6 unmodified lines
937937
938938 $(KBUILD_CFLAGS_MODULE) is used to add arch-specific options that
939939 are used for $(CC).
940− From commandline CFLAGS_MODULE shall be used (see kbuild.txt).
940+ From commandline CFLAGS_MODULE shall be used (see kbuild.rst).
941941
942942 KBUILD_LDFLAGS_MODULE
943943 Options for $(LD) when linking modules
@@ -945,7 +945,7 @@ When kbuild executes, the following steps are followed (roughly): · 1 unmodified line
945945 $(KBUILD_LDFLAGS_MODULE) is used to add arch-specific options
946946 used when linking modules. This is often a linker script.
947947
948− From commandline LDFLAGS_MODULE shall be used (see kbuild.txt).
948+ From commandline LDFLAGS_MODULE shall be used (see kbuild.rst).
949949
950950 KBUILD_LDS
951951
Documentation/kbuild/modules.rst+2−2
@@ -470,9 +470,9 @@ build. · 469 unmodified lines
470470
471471 The syntax of the Module.symvers file is::
472472
473− <CRC> <Symbol> <Namespace> <Module> <Export Type>
473+ <CRC> <Symbol> <Module> <Export Type> <Namespace>
474474
475− 0xe1cc2a05 usb_stor_suspend USB_STORAGE drivers/usb/storage/usb-storage EXPORT_SYMBOL_GPL
475+ 0xe1cc2a05 usb_stor_suspend drivers/usb/storage/usb-storage EXPORT_SYMBOL_GPL USB_STORAGE
476476
477477 The fields are separated by tabs and values may be empty (e.g.
478478 if no namespace is defined for an exported symbol).
Documentation/networking/devlink/devlink-region.rst+0−3
@@ -40,9 +40,6 @@ example usage · 39 unmodified lines
4040 # Delete a snapshot using:
4141 $ devlink region del pci/0000:00:05.0/cr-space snapshot 1
4242
43− # Trigger (request) a snapshot be taken:
44− $ devlink region trigger pci/0000:00:05.0/cr-space
45−
4643 # Dump a snapshot:
4744 $ devlink region dump pci/0000:00:05.0/fw-health snapshot 1
4845 0000000000000000 0014 95dc 0014 9514 0035 1670 0034 db30
Documentation/networking/net_failover.rst+3−3
@@ -8,9 +8,9 @@ Overview · 7 unmodified lines
88 ========
99
1010 The net_failover driver provides an automated failover mechanism via APIs
11−to create and destroy a failover master netdev and mananges a primary and
11+to create and destroy a failover master netdev and manages a primary and
1212 standby slave netdevs that get registered via the generic failover
13−infrastructrure.
13+infrastructure.
1414
1515 The failover netdev acts a master device and controls 2 slave devices. The
1616 original paravirtual interface is registered as 'standby' slave netdev and
@@ -29,7 +29,7 @@ virtio-net accelerated datapath: STANDBY mode · 12 unmodified lines
2929 =============================================
3030
3131 net_failover enables hypervisor controlled accelerated datapath to virtio-net
32−enabled VMs in a transparent manner with no/minimal guest userspace chanages.
32+enabled VMs in a transparent manner with no/minimal guest userspace changes.
3333
3434 To support this, the hypervisor needs to enable VIRTIO_NET_F_STANDBY
3535 feature on the virtio-net interface and assign the same MAC address to both
Documentation/networking/rds.txt+1−1
@@ -159,7 +159,7 @@ Socket Interface · 158 unmodified lines
159159 set SO_RDS_TRANSPORT on a socket for which the transport has
160160 been previously attached explicitly (by SO_RDS_TRANSPORT) or
161161 implicitly (via bind(2)) will return an error of EOPNOTSUPP.
162− An attempt to set SO_RDS_TRANSPPORT to RDS_TRANS_NONE will
162+ An attempt to set SO_RDS_TRANSPORT to RDS_TRANS_NONE will
163163 always return EINVAL.
164164
165165 RDMA for RDS
MAINTAINERS+2−4
@@ -4076,7 +4076,6 @@ F: drivers/scsi/snic/ · 4075 unmodified lines
40764076 CISCO VIC ETHERNET NIC DRIVER
40774077 M: Christian Benvenuti <benve@cisco.com>
40784078 M: Govindarajulu Varadarajan <_govind@gmx.com>
4079−M: Parvi Kaustubhi <pkaustub@cisco.com>
40804079 S: Supported
40814080 F: drivers/net/ethernet/cisco/enic/
40824081
@@ -4575,7 +4574,7 @@ F: drivers/infiniband/hw/cxgb4/ · 492 unmodified lines
45754574 F: include/uapi/rdma/cxgb4-abi.h
45764575
45774576 CXGB4VF ETHERNET DRIVER (CXGB4VF)
4578−M: Casey Leedom <leedom@chelsio.com>
4577+M: Vishal Kulkarni <vishal@gmail.com>
45794578 L: netdev@vger.kernel.org
45804579 W: http://www.chelsio.com
45814580 S: Supported
@@ -6201,7 +6200,6 @@ S: Supported · 1619 unmodified lines
62016200 F: drivers/scsi/be2iscsi/
62026201
62036202 Emulex 10Gbps NIC BE2, BE3-R, Lancer, Skyhawk-R DRIVER (be2net)
6204−M: Sathya Perla <sathya.perla@broadcom.com>
62056203 M: Ajit Khaparde <ajit.khaparde@broadcom.com>
62066204 M: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
62076205 M: Somnath Kotur <somnath.kotur@broadcom.com>
@@ -11132,7 +11130,7 @@ M: Thomas Bogendoerfer <tsbogend@alpha.franken.de> · 4924 unmodified lines
1113211130 L: linux-mips@vger.kernel.org
1113311131 W: http://www.linux-mips.org/
1113411132 T: git git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux.git
11135−Q: http://patchwork.linux-mips.org/project/linux-mips/list/
11133+Q: https://patchwork.kernel.org/project/linux-mips/list/
1113611134 S: Maintained
1113711135 F: Documentation/devicetree/bindings/mips/
1113811136 F: Documentation/mips/
Makefile+2−2
@@ -2,7 +2,7 @@ · 1 unmodified line
22 VERSION = 5
33 PATCHLEVEL = 6
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc5
5+EXTRAVERSION = -rc7
66 NAME = Kleptomaniac Octopus
77
88 # *DOCUMENTATION*
@@ -1804,7 +1804,7 @@ existing-targets := $(wildcard $(sort $(targets))) · 1795 unmodified lines
18041804
18051805 -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
18061806
1807−endif # config-targets
1807+endif # config-build
18081808 endif # mixed-build
18091809 endif # need-sub-make
18101810
arch/arc/Kconfig+2−2
@@ -154,7 +154,7 @@ config ARC_CPU_HS · 153 unmodified lines
154154 help
155155 Support for ARC HS38x Cores based on ARCv2 ISA
156156 The notable features are:
157− - SMP configurations of upto 4 core with coherency
157+ - SMP configurations of up to 4 cores with coherency
158158 - Optional L2 Cache and IO-Coherency
159159 - Revised Interrupt Architecture (multiple priorites, reg banks,
160160 auto stack switch, auto regfile save/restore)
@@ -192,7 +192,7 @@ config ARC_SMP_HALT_ON_RESET · 31 unmodified lines
192192 help
193193 In SMP configuration cores can be configured as Halt-on-reset
194194 or they could all start at same time. For Halt-on-reset, non
195− masters are parked until Master kicks them so they can start of
195+ masters are parked until Master kicks them so they can start off
196196 at designated entry point. For other case, all jump to common
197197 entry point and spin wait for Master's signal.
198198
arch/arc/configs/nps_defconfig+0−2
@@ -21,8 +21,6 @@ CONFIG_MODULES=y · 20 unmodified lines
2121 CONFIG_MODULE_FORCE_LOAD=y
2222 CONFIG_MODULE_UNLOAD=y
2323 # CONFIG_BLK_DEV_BSG is not set
24−# CONFIG_IOSCHED_DEADLINE is not set
25−# CONFIG_IOSCHED_CFQ is not set
2624 CONFIG_ARC_PLAT_EZNPS=y
2725 CONFIG_SMP=y
2826 CONFIG_NR_CPUS=4096
arch/arc/configs/nsimosci_defconfig+0−2
@@ -20,8 +20,6 @@ CONFIG_ISA_ARCOMPACT=y · 19 unmodified lines
2020 CONFIG_KPROBES=y
2121 CONFIG_MODULES=y
2222 # CONFIG_BLK_DEV_BSG is not set
23−# CONFIG_IOSCHED_DEADLINE is not set
24−# CONFIG_IOSCHED_CFQ is not set
2523 CONFIG_ARC_BUILTIN_DTB_NAME="nsimosci"
2624 # CONFIG_COMPACTION is not set
2725 CONFIG_NET=y
arch/arc/configs/nsimosci_hs_defconfig+0−2
@@ -19,8 +19,6 @@ CONFIG_PERF_EVENTS=y · 18 unmodified lines
1919 CONFIG_KPROBES=y
2020 CONFIG_MODULES=y
2121 # CONFIG_BLK_DEV_BSG is not set
22−# CONFIG_IOSCHED_DEADLINE is not set
23−# CONFIG_IOSCHED_CFQ is not set
2422 CONFIG_ISA_ARCV2=y
2523 CONFIG_ARC_BUILTIN_DTB_NAME="nsimosci_hs"
2624 # CONFIG_COMPACTION is not set
arch/arc/configs/nsimosci_hs_smp_defconfig+0−2
@@ -14,8 +14,6 @@ CONFIG_PERF_EVENTS=y · 13 unmodified lines
1414 CONFIG_KPROBES=y
1515 CONFIG_MODULES=y
1616 # CONFIG_BLK_DEV_BSG is not set
17−# CONFIG_IOSCHED_DEADLINE is not set
18−# CONFIG_IOSCHED_CFQ is not set
1917 CONFIG_ISA_ARCV2=y
2018 CONFIG_SMP=y
2119 # CONFIG_ARC_TIMERS_64BIT is not set
arch/arc/include/asm/fpu.h+2−0
@@ -43,6 +43,8 @@ extern void fpu_init_task(struct pt_regs *regs); · 42 unmodified lines
4343
4444 #endif /* !CONFIG_ISA_ARCOMPACT */
4545
46+struct task_struct;
47+
4648 extern void fpu_save_restore(struct task_struct *p, struct task_struct *n);
4749
4850 #else /* !CONFIG_ARC_FPU_SAVE_RESTORE */
arch/arc/include/asm/linkage.h+2−0
@@ -29,6 +29,8 @@ · 28 unmodified lines
2929 .endm
3030
3131 #define ASM_NL ` /* use '`' to mark new line in macro */
32+#define __ALIGN .align 4
33+#define __ALIGN_STR __stringify(__ALIGN)
3234
3335 /* annotation for data we want in DCCM - if enabled in .config */
3436 .macro ARCFP_DATA nm
arch/arc/kernel/setup.c+1−1
@@ -8,11 +8,11 @@ · 7 unmodified lines
88 #include <linux/delay.h>
99 #include <linux/root_dev.h>
1010 #include <linux/clk.h>
11−#include <linux/clk-provider.h>
1211 #include <linux/clocksource.h>
1312 #include <linux/console.h>
1413 #include <linux/module.h>
1514 #include <linux/cpu.h>
15+#include <linux/of_clk.h>
1616 #include <linux/of_fdt.h>
1717 #include <linux/of.h>
1818 #include <linux/cache.h>
arch/arc/kernel/troubleshoot.c+12−15
@@ -104,8 +104,7 @@ static void show_faulting_vma(unsigned long address) · 103 unmodified lines
104104 if (IS_ERR(nm))
105105 nm = "?";
106106 }
107− pr_info(" @off 0x%lx in [%s]\n"
108− " VMA: 0x%08lx to 0x%08lx\n",
107+ pr_info(" @off 0x%lx in [%s] VMA: 0x%08lx to 0x%08lx\n",
109108 vma->vm_start < TASK_UNMAPPED_BASE ?
110109 address : address - vma->vm_start,
111110 nm, vma->vm_start, vma->vm_end);
@@ -120,8 +119,6 @@ static void show_ecr_verbose(struct pt_regs *regs) · 8 unmodified lines
120119 unsigned int vec, cause_code;
121120 unsigned long address;
122121
123− pr_info("\n[ECR ]: 0x%08lx => ", regs->event);
124−
125122 /* For Data fault, this is data address not instruction addr */
126123 address = current->thread.fault_address;
127124
@@ -130,10 +127,10 @@ static void show_ecr_verbose(struct pt_regs *regs) · 2 unmodified lines
130127
131128 /* For DTLB Miss or ProtV, display the memory involved too */
132129 if (vec == ECR_V_DTLB_MISS) {
133− pr_cont("Invalid %s @ 0x%08lx by insn @ 0x%08lx\n",
130+ pr_cont("Invalid %s @ 0x%08lx by insn @ %pS\n",
134131 (cause_code == 0x01) ? "Read" :
135132 ((cause_code == 0x02) ? "Write" : "EX"),
136− address, regs->ret);
133+ address, (void *)regs->ret);
137134 } else if (vec == ECR_V_ITLB_MISS) {
138135 pr_cont("Insn could not be fetched\n");
139136 } else if (vec == ECR_V_MACH_CHK) {
@@ -191,31 +188,31 @@ void show_regs(struct pt_regs *regs) · 51 unmodified lines
191188
192189 show_ecr_verbose(regs);
193190
194− pr_info("[EFA ]: 0x%08lx\n[BLINK ]: %pS\n[ERET ]: %pS\n",
195− current->thread.fault_address,
196− (void *)regs->blink, (void *)regs->ret);
197−
198191 if (user_mode(regs))
199192 show_faulting_vma(regs->ret); /* faulting code, not data */
200193
201− pr_info("[STAT32]: 0x%08lx", regs->status32);
194+ pr_info("ECR: 0x%08lx EFA: 0x%08lx ERET: 0x%08lx\n",
195+ regs->event, current->thread.fault_address, regs->ret);
196+
197+ pr_info("STAT32: 0x%08lx", regs->status32);
202198
203199 #define STS_BIT(r, bit) r->status32 & STATUS_##bit##_MASK ? #bit" " : ""
204200
205201 #ifdef CONFIG_ISA_ARCOMPACT
206− pr_cont(" : %2s%2s%2s%2s%2s%2s%2s\n",
202+ pr_cont(" [%2s%2s%2s%2s%2s%2s%2s]",
207203 (regs->status32 & STATUS_U_MASK) ? "U " : "K ",
208204 STS_BIT(regs, DE), STS_BIT(regs, AE),
209205 STS_BIT(regs, A2), STS_BIT(regs, A1),
210206 STS_BIT(regs, E2), STS_BIT(regs, E1));
211207 #else
212− pr_cont(" : %2s%2s%2s%2s\n",
208+ pr_cont(" [%2s%2s%2s%2s]",
213209 STS_BIT(regs, IE),
214210 (regs->status32 & STATUS_U_MASK) ? "U " : "K ",
215211 STS_BIT(regs, DE), STS_BIT(regs, AE));
216212 #endif
217− pr_info("BTA: 0x%08lx\t SP: 0x%08lx\t FP: 0x%08lx\n",
218− regs->bta, regs->sp, regs->fp);
213+ pr_cont(" BTA: 0x%08lx\n", regs->bta);
214+ pr_info("BLK: %pS\n SP: 0x%08lx FP: 0x%08lx\n",
215+ (void *)regs->blink, regs->sp, regs->fp);
219216 pr_info("LPS: 0x%08lx\tLPE: 0x%08lx\tLPC: 0x%08lx\n",
220217 regs->lp_start, regs->lp_end, regs->lp_count);
221218
arch/arm/Makefile+3−1
@@ -307,13 +307,15 @@ endif · 306 unmodified lines
307307 ifeq ($(CONFIG_STACKPROTECTOR_PER_TASK),y)
308308 prepare: stack_protector_prepare
309309 stack_protector_prepare: prepare0
310− $(eval KBUILD_CFLAGS += \
310+ $(eval SSP_PLUGIN_CFLAGS := \
311311 -fplugin-arg-arm_ssp_per_task_plugin-tso=$(shell \
312312 awk '{if ($$2 == "THREAD_SZ_ORDER") print $$3;}'\
313313 include/generated/asm-offsets.h) \
314314 -fplugin-arg-arm_ssp_per_task_plugin-offset=$(shell \
315315 awk '{if ($$2 == "TI_STACK_CANARY") print $$3;}'\
316316 include/generated/asm-offsets.h))
317+ $(eval KBUILD_CFLAGS += $(SSP_PLUGIN_CFLAGS))
318+ $(eval GCC_PLUGINS_CFLAGS += $(SSP_PLUGIN_CFLAGS))
317319 endif
318320
319321 all: $(notdir $(KBUILD_IMAGE))
arch/arm/boot/compressed/Makefile+2−2
@@ -101,7 +101,6 @@ clean-files += piggy_data lib1funcs.S ashldi3.S bswapsdi2.S \ · 100 unmodified lines
101101 $(libfdt) $(libfdt_hdrs) hyp-stub.S
102102
103103 KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
104−KBUILD_CFLAGS += $(DISABLE_ARM_SSP_PER_TASK_PLUGIN)
105104
106105 ifeq ($(CONFIG_FUNCTION_TRACER),y)
107106 ORIG_CFLAGS := $(KBUILD_CFLAGS)
@@ -117,7 +116,8 @@ CFLAGS_fdt_ro.o := $(nossp-flags-y) · 9 unmodified lines
117116 CFLAGS_fdt_rw.o := $(nossp-flags-y)
118117 CFLAGS_fdt_wip.o := $(nossp-flags-y)
119118
120−ccflags-y := -fpic $(call cc-option,-mno-single-pic-base,) -fno-builtin -I$(obj)
119+ccflags-y := -fpic $(call cc-option,-mno-single-pic-base,) -fno-builtin \
120+ -I$(obj) $(DISABLE_ARM_SSP_PER_TASK_PLUGIN)
121121 asflags-y := -DZIMAGE
122122
123123 # Supply kernel BSS size to the decompressor via a linker symbol.
arch/arm/kernel/vdso.c+2−0
@@ -94,6 +94,8 @@ static bool __init cntvct_functional(void) · 93 unmodified lines
9494 * this.
9595 */
9696 np = of_find_compatible_node(NULL, NULL, "arm,armv7-timer");
97+ if (!np)
98+ np = of_find_compatible_node(NULL, NULL, "arm,armv8-timer");
9799 if (!np)
98100 goto out_put;
99101
arch/arm/lib/copy_from_user.S+1−1
@@ -118,7 +118,7 @@ ENTRY(arm_copy_from_user) · 117 unmodified lines
118118
119119 ENDPROC(arm_copy_from_user)
120120
121− .pushsection .fixup,"ax"
121+ .pushsection .text.fixup,"ax"
122122 .align 0
123123 copy_abort_preamble
124124 ldmfd sp!, {r1, r2, r3}
arch/arm64/boot/dts/freescale/fsl-ls1043-post.dtsi+2−0
@@ -20,6 +20,8 @@ · 19 unmodified lines
2020 };
2121
2222 &fman0 {
23+ fsl,erratum-a050385;
24+
2325 /* these aliases provide the FMan ports mapping */
2426 enet0: ethernet@e0000 {
2527 };
arch/arm64/include/asm/mmu.h+1−3
@@ -29,11 +29,9 @@ typedef struct { · 28 unmodified lines
2929 */
3030 #define ASID(mm) ((mm)->context.id.counter & 0xffff)
3131
32−extern bool arm64_use_ng_mappings;
33−
3432 static inline bool arm64_kernel_unmapped_at_el0(void)
3533 {
36− return arm64_use_ng_mappings;
34+ return cpus_have_const_cap(ARM64_UNMAP_KERNEL_AT_EL0);
3735 }
3836
3937 typedef void (*bp_hardening_cb_t)(void);
arch/arm64/include/asm/pgtable-prot.h+4−2
@@ -23,11 +23,13 @@ · 22 unmodified lines
2323
2424 #include <asm/pgtable-types.h>
2525
26+extern bool arm64_use_ng_mappings;
27+
2628 #define _PROT_DEFAULT (PTE_TYPE_PAGE | PTE_AF | PTE_SHARED)
2729 #define _PROT_SECT_DEFAULT (PMD_TYPE_SECT | PMD_SECT_AF | PMD_SECT_S)
2830
29−#define PTE_MAYBE_NG (arm64_kernel_unmapped_at_el0() ? PTE_NG : 0)
30−#define PMD_MAYBE_NG (arm64_kernel_unmapped_at_el0() ? PMD_SECT_NG : 0)
31+#define PTE_MAYBE_NG (arm64_use_ng_mappings ? PTE_NG : 0)
32+#define PMD_MAYBE_NG (arm64_use_ng_mappings ? PMD_SECT_NG : 0)
3133
3234 #define PROT_DEFAULT (_PROT_DEFAULT | PTE_MAYBE_NG)
3335 #define PROT_SECT_DEFAULT (_PROT_SECT_DEFAULT | PMD_MAYBE_NG)
arch/arm64/include/asm/unistd.h+1−1
@@ -25,8 +25,8 @@ · 24 unmodified lines
2525 #define __NR_compat_gettimeofday 78
2626 #define __NR_compat_sigreturn 119
2727 #define __NR_compat_rt_sigreturn 173
28−#define __NR_compat_clock_getres 247
2928 #define __NR_compat_clock_gettime 263
29+#define __NR_compat_clock_getres 264
3030 #define __NR_compat_clock_gettime64 403
3131 #define __NR_compat_clock_getres_time64 406
3232
arch/arm64/kernel/smp.c+20−5
@@ -958,11 +958,22 @@ void tick_broadcast(const struct cpumask *mask) · 957 unmodified lines
958958 }
959959 #endif
960960
961+/*
962+ * The number of CPUs online, not counting this CPU (which may not be
963+ * fully online and so not counted in num_online_cpus()).
964+ */
965+static inline unsigned int num_other_online_cpus(void)
966+{
967+ unsigned int this_cpu_online = cpu_online(smp_processor_id());
968+
969+ return num_online_cpus() - this_cpu_online;
970+}
971+
961972 void smp_send_stop(void)
962973 {
963974 unsigned long timeout;
964975
965− if (num_online_cpus() > 1) {
976+ if (num_other_online_cpus()) {
966977 cpumask_t mask;
967978
968979 cpumask_copy(&mask, cpu_online_mask);
@@ -975,10 +986,10 @@ void smp_send_stop(void) · 6 unmodified lines
975986
976987 /* Wait up to one second for other CPUs to stop */
977988 timeout = USEC_PER_SEC;
978− while (num_online_cpus() > 1 && timeout--)
989+ while (num_other_online_cpus() && timeout--)
979990 udelay(1);
980991
981− if (num_online_cpus() > 1)
992+ if (num_other_online_cpus())
982993 pr_warn("SMP: failed to stop secondary CPUs %*pbl\n",
983994 cpumask_pr_args(cpu_online_mask));
984995
@@ -1001,7 +1012,11 @@ void crash_smp_send_stop(void) · 16 unmodified lines
10011012
10021013 cpus_stopped = 1;
10031014
1004− if (num_online_cpus() == 1) {
1015+ /*
1016+ * If this cpu is the only one alive at this point in time, online or
1017+ * not, there are no stop messages to be sent around, so just back out.
1018+ */
1019+ if (num_other_online_cpus() == 0) {
10051020 sdei_mask_local_cpu();
10061021 return;
10071022 }
@@ -1009,7 +1024,7 @@ void crash_smp_send_stop(void) · 1 unmodified line
10091024 cpumask_copy(&mask, cpu_online_mask);
10101025 cpumask_clear_cpu(smp_processor_id(), &mask);
10111026
1012− atomic_set(&waiting_for_crash_ipi, num_online_cpus() - 1);
1027+ atomic_set(&waiting_for_crash_ipi, num_other_online_cpus());
10131028
10141029 pr_crit("SMP: stopping secondary CPUs\n");
10151030 smp_cross_call(&mask, IPI_CPU_CRASH_STOP);
arch/mips/boot/dts/ingenic/ci20.dts+28−16
@@ -4,6 +4,8 @@ · 3 unmodified lines
44 #include "jz4780.dtsi"
55 #include <dt-bindings/clock/ingenic,tcu.h>
66 #include <dt-bindings/gpio/gpio.h>
7+#include <dt-bindings/interrupt-controller/irq.h>
8+#include <dt-bindings/regulator/active-semi,8865-regulator.h>
79
810 / {
911 compatible = "img,ci20", "ingenic,jz4780";
@@ -163,63 +165,71 @@ · 153 unmodified lines
163165
164166 regulators {
165167 vddcore: SUDCDC1 {
166− regulator-name = "VDDCORE";
168+ regulator-name = "DCDC_REG1";
167169 regulator-min-microvolt = <1100000>;
168170 regulator-max-microvolt = <1100000>;
169171 regulator-always-on;
170172 };
171173 vddmem: SUDCDC2 {
172− regulator-name = "VDDMEM";
174+ regulator-name = "DCDC_REG2";
173175 regulator-min-microvolt = <1500000>;
174176 regulator-max-microvolt = <1500000>;
175177 regulator-always-on;
176178 };
177179 vcc_33: SUDCDC3 {
178− regulator-name = "VCC33";
180+ regulator-name = "DCDC_REG3";
179181 regulator-min-microvolt = <3300000>;
180182 regulator-max-microvolt = <3300000>;
181183 regulator-always-on;
182184 };
183185 vcc_50: SUDCDC4 {
184− regulator-name = "VCC50";
186+ regulator-name = "SUDCDC_REG4";
185187 regulator-min-microvolt = <5000000>;
186188 regulator-max-microvolt = <5000000>;
187189 regulator-always-on;
188190 };
189191 vcc_25: LDO_REG5 {
190− regulator-name = "VCC25";
192+ regulator-name = "LDO_REG5";
191193 regulator-min-microvolt = <2500000>;
192194 regulator-max-microvolt = <2500000>;
193195 regulator-always-on;
194196 };
195197 wifi_io: LDO_REG6 {
196− regulator-name = "WIFIIO";
198+ regulator-name = "LDO_REG6";
197199 regulator-min-microvolt = <2500000>;
198200 regulator-max-microvolt = <2500000>;
199201 regulator-always-on;
200202 };
201203 vcc_28: LDO_REG7 {
202− regulator-name = "VCC28";
204+ regulator-name = "LDO_REG7";
203205 regulator-min-microvolt = <2800000>;
204206 regulator-max-microvolt = <2800000>;
205207 regulator-always-on;
206208 };
207209 vcc_15: LDO_REG8 {
208− regulator-name = "VCC15";
210+ regulator-name = "LDO_REG8";
209211 regulator-min-microvolt = <1500000>;
210212 regulator-max-microvolt = <1500000>;
211213 regulator-always-on;
212214 };
213− vcc_18: LDO_REG9 {
214− regulator-name = "VCC18";
215− regulator-min-microvolt = <1800000>;
216− regulator-max-microvolt = <1800000>;
215+ vrtc_18: LDO_REG9 {
216+ regulator-name = "LDO_REG9";
217+ /* Despite the datasheet stating 3.3V
218+ * for REG9 and the driver expecting that,
219+ * REG9 outputs 1.8V.
220+ * Likely the CI20 uses a proprietary
221+ * factory programmed chip variant.
222+ * Since this is a simple on/off LDO the
223+ * exact values do not matter.
224+ */
225+ regulator-min-microvolt = <3300000>;
226+ regulator-max-microvolt = <3300000>;
217227 regulator-always-on;
218228 };
219229 vcc_11: LDO_REG10 {
220− regulator-name = "VCC11";
221− regulator-min-microvolt = <1100000>;
222− regulator-max-microvolt = <1100000>;
230+ regulator-name = "LDO_REG10";
231+ regulator-min-microvolt = <1200000>;
232+ regulator-max-microvolt = <1200000>;
223233 regulator-always-on;
224234 };
225235 };
@@ -261,7 +271,9 @@ · 35 unmodified lines
261271 rtc@51 {
262272 compatible = "nxp,pcf8563";
263273 reg = <0x51>;
264− interrupts = <110>;
274+
275+ interrupt-parent = <&gpf>;
276+ interrupts = <30 IRQ_TYPE_LEVEL_LOW>;
265277 };
266278 };
267279
arch/mips/kernel/setup.c+2−1
@@ -605,7 +605,8 @@ static void __init bootcmdline_init(char **cmdline_p) · 604 unmodified lines
605605 * If we're configured to take boot arguments from DT, look for those
606606 * now.
607607 */
608− if (IS_ENABLED(CONFIG_MIPS_CMDLINE_FROM_DTB))
608+ if (IS_ENABLED(CONFIG_MIPS_CMDLINE_FROM_DTB) ||
609+ IS_ENABLED(CONFIG_MIPS_CMDLINE_DTB_EXTEND))
609610 of_scan_flat_dt(bootcmdline_scan_chosen, &dt_bootargs);
610611 #endif
611612
arch/powerpc/kvm/book3s_pr.c+1−0
@@ -1817,6 +1817,7 @@ static void kvmppc_core_vcpu_free_pr(struct kvm_vcpu *vcpu) · 1816 unmodified lines
18171817 {
18181818 struct kvmppc_vcpu_book3s *vcpu_book3s = to_book3s(vcpu);
18191819
1820+ kvmppc_mmu_destroy_pr(vcpu);
18201821 free_page((unsigned long)vcpu->arch.shared & PAGE_MASK);
18211822 #ifdef CONFIG_KVM_BOOK3S_32_HANDLER
18221823 kfree(vcpu->arch.shadow_vcpu);
arch/powerpc/kvm/powerpc.c+0−2
@@ -759,7 +759,6 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu) · 758 unmodified lines
759759 return 0;
760760
761761 out_vcpu_uninit:
762− kvmppc_mmu_destroy(vcpu);
763762 kvmppc_subarch_vcpu_uninit(vcpu);
764763 return err;
765764 }
@@ -792,7 +791,6 @@ void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu) · 26 unmodified lines
792791
793792 kvmppc_core_vcpu_free(vcpu);
794793
795− kvmppc_mmu_destroy(vcpu);
796794 kvmppc_subarch_vcpu_uninit(vcpu);
797795 }
798796
arch/powerpc/mm/kasan/kasan_init_32.c+2−7
@@ -120,12 +120,6 @@ static void __init kasan_unmap_early_shadow_vmalloc(void) · 119 unmodified lines
120120 unsigned long k_cur;
121121 phys_addr_t pa = __pa(kasan_early_shadow_page);
122122
123− if (!early_mmu_has_feature(MMU_FTR_HPTE_TABLE)) {
124− int ret = kasan_init_shadow_page_tables(k_start, k_end);
125−
126− if (ret)
127− panic("kasan: kasan_init_shadow_page_tables() failed");
128− }
129123 for (k_cur = k_start & PAGE_MASK; k_cur < k_end; k_cur += PAGE_SIZE) {
130124 pmd_t *pmd = pmd_offset(pud_offset(pgd_offset_k(k_cur), k_cur), k_cur);
131125 pte_t *ptep = pte_offset_kernel(pmd, k_cur);
@@ -143,7 +137,8 @@ void __init kasan_mmu_init(void) · 11 unmodified lines
143137 int ret;
144138 struct memblock_region *reg;
145139
146− if (early_mmu_has_feature(MMU_FTR_HPTE_TABLE)) {
140+ if (early_mmu_has_feature(MMU_FTR_HPTE_TABLE) ||
141+ IS_ENABLED(CONFIG_KASAN_VMALLOC)) {
147142 ret = kasan_init_shadow_page_tables(KASAN_SHADOW_START, KASAN_SHADOW_END);
148143
149144 if (ret)
arch/s390/kvm/kvm-s390.c+17−1
@@ -3268,7 +3268,10 @@ static void kvm_arch_vcpu_ioctl_initial_reset(struct kvm_vcpu *vcpu) · 3267 unmodified lines
32683268 /* Initial reset is a superset of the normal reset */
32693269 kvm_arch_vcpu_ioctl_normal_reset(vcpu);
32703270
3271− /* this equals initial cpu reset in pop, but we don't switch to ESA */
3271+ /*
3272+ * This equals initial cpu reset in pop, but we don't switch to ESA.
3273+ * We do not only reset the internal data, but also ...
3274+ */
32723275 vcpu->arch.sie_block->gpsw.mask = 0;
32733276 vcpu->arch.sie_block->gpsw.addr = 0;
32743277 kvm_s390_set_prefix(vcpu, 0);
@@ -3278,6 +3281,19 @@ static void kvm_arch_vcpu_ioctl_initial_reset(struct kvm_vcpu *vcpu) · 3 unmodified lines
32783281 memset(vcpu->arch.sie_block->gcr, 0, sizeof(vcpu->arch.sie_block->gcr));
32793282 vcpu->arch.sie_block->gcr[0] = CR0_INITIAL_MASK;
32803283 vcpu->arch.sie_block->gcr[14] = CR14_INITIAL_MASK;
3284+
3285+ /* ... the data in sync regs */
3286+ memset(vcpu->run->s.regs.crs, 0, sizeof(vcpu->run->s.regs.crs));
3287+ vcpu->run->s.regs.ckc = 0;
3288+ vcpu->run->s.regs.crs[0] = CR0_INITIAL_MASK;
3289+ vcpu->run->s.regs.crs[14] = CR14_INITIAL_MASK;
3290+ vcpu->run->psw_addr = 0;
3291+ vcpu->run->psw_mask = 0;
3292+ vcpu->run->s.regs.todpr = 0;
3293+ vcpu->run->s.regs.cputm = 0;
3294+ vcpu->run->s.regs.ckc = 0;
3295+ vcpu->run->s.regs.pp = 0;
3296+ vcpu->run->s.regs.gbea = 1;
32813297 vcpu->run->s.regs.fpc = 0;
32823298 vcpu->arch.sie_block->gbea = 1;
32833299 vcpu->arch.sie_block->pp = 0;
arch/x86/Makefile+3−2
@@ -194,9 +194,10 @@ avx2_instr :=$(call as-instr,vpbroadcastb %xmm0$(comma)%ymm1,-DCONFIG_AS_AVX2=1) · 193 unmodified lines
194194 avx512_instr :=$(call as-instr,vpmovm2b %k1$(comma)%zmm5,-DCONFIG_AS_AVX512=1)
195195 sha1_ni_instr :=$(call as-instr,sha1msg1 %xmm0$(comma)%xmm1,-DCONFIG_AS_SHA1_NI=1)
196196 sha256_ni_instr :=$(call as-instr,sha256msg1 %xmm0$(comma)%xmm1,-DCONFIG_AS_SHA256_NI=1)
197+adx_instr := $(call as-instr,adox %r10$(comma)%r10,-DCONFIG_AS_ADX=1)
197198
198−KBUILD_AFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr) $(avx2_instr) $(avx512_instr) $(sha1_ni_instr) $(sha256_ni_instr)
199−KBUILD_CFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr) $(avx2_instr) $(avx512_instr) $(sha1_ni_instr) $(sha256_ni_instr)
199+KBUILD_AFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr) $(avx2_instr) $(avx512_instr) $(sha1_ni_instr) $(sha256_ni_instr) $(adx_instr)
200+KBUILD_CFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr) $(avx2_instr) $(avx512_instr) $(sha1_ni_instr) $(sha256_ni_instr) $(adx_instr)
200201
201202 KBUILD_LDFLAGS := -m elf_$(UTS_MACHINE)
202203
arch/x86/crypto/Makefile+6−1
@@ -11,6 +11,7 @@ avx2_supported := $(call as-instr,vpgatherdd %ymm0$(comma)(%eax$(comma)%ymm1\ · 10 unmodified lines
1111 avx512_supported :=$(call as-instr,vpmovm2b %k1$(comma)%zmm5,yes,no)
1212 sha1_ni_supported :=$(call as-instr,sha1msg1 %xmm0$(comma)%xmm1,yes,no)
1313 sha256_ni_supported :=$(call as-instr,sha256msg1 %xmm0$(comma)%xmm1,yes,no)
14+adx_supported := $(call as-instr,adox %r10$(comma)%r10,yes,no)
1415
1516 obj-$(CONFIG_CRYPTO_GLUE_HELPER_X86) += glue_helper.o
1617
@@ -39,7 +40,11 @@ obj-$(CONFIG_CRYPTO_AEGIS128_AESNI_SSE2) += aegis128-aesni.o · 22 unmodified lines
3940
4041 obj-$(CONFIG_CRYPTO_NHPOLY1305_SSE2) += nhpoly1305-sse2.o
4142 obj-$(CONFIG_CRYPTO_NHPOLY1305_AVX2) += nhpoly1305-avx2.o
42−obj-$(CONFIG_CRYPTO_CURVE25519_X86) += curve25519-x86_64.o
43+
44+# These modules require the assembler to support ADX.
45+ifeq ($(adx_supported),yes)
46+ obj-$(CONFIG_CRYPTO_CURVE25519_X86) += curve25519-x86_64.o
47+endif
4348
4449 # These modules require assembler to support AVX.
4550 ifeq ($(avx_supported),yes)
arch/x86/events/amd/uncore.c+7−10
@@ -190,15 +190,12 @@ static int amd_uncore_event_init(struct perf_event *event) · 189 unmodified lines
190190
191191 /*
192192 * NB and Last level cache counters (MSRs) are shared across all cores
193− * that share the same NB / Last level cache. Interrupts can be directed
194− * to a single target core, however, event counts generated by processes
195− * running on other cores cannot be masked out. So we do not support
196− * sampling and per-thread events.
193+ * that share the same NB / Last level cache. On family 16h and below,
194+ * Interrupts can be directed to a single target core, however, event
195+ * counts generated by processes running on other cores cannot be masked
196+ * out. So we do not support sampling and per-thread events via
197+ * CAP_NO_INTERRUPT, and we do not enable counter overflow interrupts:
197198 */
198− if (is_sampling_event(event) || event->attach_state & PERF_ATTACH_TASK)
199− return -EINVAL;
200−
201− /* and we do not enable counter overflow interrupts */
202199 hwc->config = event->attr.config & AMD64_RAW_EVENT_MASK_NB;
203200 hwc->idx = -1;
204201
@@ -306,7 +303,7 @@ static struct pmu amd_nb_pmu = { · 101 unmodified lines
306303 .start = amd_uncore_start,
307304 .stop = amd_uncore_stop,
308305 .read = amd_uncore_read,
309− .capabilities = PERF_PMU_CAP_NO_EXCLUDE,
306+ .capabilities = PERF_PMU_CAP_NO_EXCLUDE | PERF_PMU_CAP_NO_INTERRUPT,
310307 };
311308
312309 static struct pmu amd_llc_pmu = {
@@ -317,7 +314,7 @@ static struct pmu amd_llc_pmu = { · 4 unmodified lines
317314 .start = amd_uncore_start,
318315 .stop = amd_uncore_stop,
319316 .read = amd_uncore_read,
320− .capabilities = PERF_PMU_CAP_NO_EXCLUDE,
317+ .capabilities = PERF_PMU_CAP_NO_EXCLUDE | PERF_PMU_CAP_NO_INTERRUPT,
321318 };
322319
323320 static struct amd_uncore *amd_uncore_alloc(unsigned int cpu)
arch/x86/include/asm/kvm_emulate.h+0−1
@@ -360,7 +360,6 @@ struct x86_emulate_ctxt { · 359 unmodified lines
360360 u64 d;
361361 unsigned long _eip;
362362 struct operand memop;
363− /* Fields above regs are cleared together. */
364363 unsigned long _regs[NR_VCPU_REGS];
365364 struct operand *memopp;
366365 struct fetch_cache fetch;
arch/x86/kernel/apic/vector.c+8−6
@@ -838,13 +838,15 @@ static void free_moved_vector(struct apic_chip_data *apicd) · 837 unmodified lines
838838 bool managed = apicd->is_managed;
839839
840840 /*
841− * This should never happen. Managed interrupts are not
842− * migrated except on CPU down, which does not involve the
843− * cleanup vector. But try to keep the accounting correct
844− * nevertheless.
841+ * Managed interrupts are usually not migrated away
842+ * from an online CPU, but CPU isolation 'managed_irq'
843+ * can make that happen.
844+ * 1) Activation does not take the isolation into account
845+ * to keep the code simple
846+ * 2) Migration away from an isolated CPU can happen when
847+ * a non-isolated CPU which is in the calculated
848+ * affinity mask comes online.
845849 */
846− WARN_ON_ONCE(managed);
847−
848850 trace_vector_free_moved(apicd->irq, cpu, vector, managed);
849851 irq_matrix_free(vector_matrix, cpu, vector, managed);
850852 per_cpu(vector_irq, cpu)[vector] = VECTOR_UNUSED;
arch/x86/kernel/cpu/mce/intel.c+5−4
@@ -493,17 +493,18 @@ static void intel_ppin_init(struct cpuinfo_x86 *c) · 492 unmodified lines
493493 return;
494494
495495 if ((val & 3UL) == 1UL) {
496− /* PPIN available but disabled: */
496+ /* PPIN locked in disabled mode */
497497 return;
498498 }
499499
500− /* If PPIN is disabled, but not locked, try to enable: */
501− if (!(val & 3UL)) {
500+ /* If PPIN is disabled, try to enable */
501+ if (!(val & 2UL)) {
502502 wrmsrl_safe(MSR_PPIN_CTL, val | 2UL);
503503 rdmsrl_safe(MSR_PPIN_CTL, &val);
504504 }
505505
506− if ((val & 3UL) == 2UL)
506+ /* Is the enable bit set? */
507+ if (val & 2UL)
507508 set_cpu_cap(c, X86_FEATURE_INTEL_PPIN);
508509 }
509510 }
arch/x86/kernel/cpu/mce/therm_throt.c+7−2
@@ -486,9 +486,14 @@ static int thermal_throttle_offline(unsigned int cpu) · 485 unmodified lines
486486 {
487487 struct thermal_state *state = &per_cpu(thermal_state, cpu);
488488 struct device *dev = get_cpu_device(cpu);
489+ u32 l;
490+
491+ /* Mask the thermal vector before draining evtl. pending work */
492+ l = apic_read(APIC_LVTTHMR);
493+ apic_write(APIC_LVTTHMR, l | APIC_LVT_MASKED);
489494
490− cancel_delayed_work(&state->package_throttle.therm_work);
491− cancel_delayed_work(&state->core_throttle.therm_work);
495+ cancel_delayed_work_sync(&state->package_throttle.therm_work);
496+ cancel_delayed_work_sync(&state->core_throttle.therm_work);
492497
493498 state->package_throttle.rate_control_active = false;
494499 state->core_throttle.rate_control_active = false;
arch/x86/kvm/Kconfig+1−1
@@ -68,7 +68,7 @@ config KVM_WERROR · 67 unmodified lines
6868 depends on (X86_64 && !KASAN) || !COMPILE_TEST
6969 depends on EXPERT
7070 help
71− Add -Werror to the build flags for (and only for) i915.ko.
71+ Add -Werror to the build flags for KVM.
7272
7373 If in doubt, say "N".
7474
arch/x86/kvm/emulate.c+1−0
@@ -5173,6 +5173,7 @@ int x86_decode_insn(struct x86_emulate_ctxt *ctxt, void *insn, int insn_len) · 5172 unmodified lines
51735173 ctxt->fetch.ptr = ctxt->fetch.data;
51745174 ctxt->fetch.end = ctxt->fetch.data + insn_len;
51755175 ctxt->opcode_len = 1;
5176+ ctxt->intercept = x86_intercept_none;
51765177 if (insn_len > 0)
51775178 memcpy(ctxt->fetch.data, insn, insn_len);
51785179 else {
arch/x86/kvm/ioapic.c+5−2
@@ -378,12 +378,15 @@ static void ioapic_write_indirect(struct kvm_ioapic *ioapic, u32 val) · 377 unmodified lines
378378 if (e->fields.delivery_mode == APIC_DM_FIXED) {
379379 struct kvm_lapic_irq irq;
380380
381− irq.shorthand = APIC_DEST_NOSHORT;
382381 irq.vector = e->fields.vector;
383382 irq.delivery_mode = e->fields.delivery_mode << 8;
384− irq.dest_id = e->fields.dest_id;
385383 irq.dest_mode =
386384 kvm_lapic_irq_dest_mode(!!e->fields.dest_mode);
385+ irq.level = false;
386+ irq.trig_mode = e->fields.trig_mode;
387+ irq.shorthand = APIC_DEST_NOSHORT;
388+ irq.dest_id = e->fields.dest_id;
389+ irq.msi_redir_hint = false;
387390 bitmap_zero(&vcpu_bitmap, 16);
388391 kvm_bitmap_or_dest_vcpus(ioapic->kvm, &irq,
389392 &vcpu_bitmap);
arch/x86/kvm/svm.c+2−1
@@ -6312,7 +6312,8 @@ static void svm_handle_exit_irqoff(struct kvm_vcpu *vcpu, · 6311 unmodified lines
63126312 enum exit_fastpath_completion *exit_fastpath)
63136313 {
63146314 if (!is_guest_mode(vcpu) &&
6315− to_svm(vcpu)->vmcb->control.exit_code == EXIT_REASON_MSR_WRITE)
6315+ to_svm(vcpu)->vmcb->control.exit_code == SVM_EXIT_MSR &&
6316+ to_svm(vcpu)->vmcb->control.exit_info_1)
63166317 *exit_fastpath = handle_fastpath_set_msr_irqoff(vcpu);
63176318 }
63186319
arch/x86/kvm/vmx/nested.c+3−2
@@ -224,7 +224,7 @@ static inline void nested_release_evmcs(struct kvm_vcpu *vcpu) · 223 unmodified lines
224224 return;
225225
226226 kvm_vcpu_unmap(vcpu, &vmx->nested.hv_evmcs_map, true);
227− vmx->nested.hv_evmcs_vmptr = -1ull;
227+ vmx->nested.hv_evmcs_vmptr = 0;
228228 vmx->nested.hv_evmcs = NULL;
229229 }
230230
@@ -1923,7 +1923,8 @@ static int nested_vmx_handle_enlightened_vmptrld(struct kvm_vcpu *vcpu, · 1692 unmodified lines
19231923 if (!nested_enlightened_vmentry(vcpu, &evmcs_gpa))
19241924 return 1;
19251925
1926− if (unlikely(evmcs_gpa != vmx->nested.hv_evmcs_vmptr)) {
1926+ if (unlikely(!vmx->nested.hv_evmcs ||
1927+ evmcs_gpa != vmx->nested.hv_evmcs_vmptr)) {
19271928 if (!vmx->nested.hv_evmcs)
19281929 vmx->nested.current_vmptr = -1ull;
19291930
arch/x86/kvm/vmx/vmx.c+14−2
@@ -2338,6 +2338,17 @@ static void hardware_disable(void) · 2337 unmodified lines
23382338 kvm_cpu_vmxoff();
23392339 }
23402340
2341+/*
2342+ * There is no X86_FEATURE for SGX yet, but anyway we need to query CPUID
2343+ * directly instead of going through cpu_has(), to ensure KVM is trapping
2344+ * ENCLS whenever it's supported in hardware. It does not matter whether
2345+ * the host OS supports or has enabled SGX.
2346+ */
2347+static bool cpu_has_sgx(void)
2348+{
2349+ return cpuid_eax(0) >= 0x12 && (cpuid_eax(0x12) & BIT(0));
2350+}
2351+
23412352 static __init int adjust_vmx_controls(u32 ctl_min, u32 ctl_opt,
23422353 u32 msr, u32 *result)
23432354 {
@@ -2418,8 +2429,9 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf, · 74 unmodified lines
24182429 SECONDARY_EXEC_ENABLE_USR_WAIT_PAUSE |
24192430 SECONDARY_EXEC_PT_USE_GPA |
24202431 SECONDARY_EXEC_PT_CONCEAL_VMX |
2421− SECONDARY_EXEC_ENABLE_VMFUNC |
2422− SECONDARY_EXEC_ENCLS_EXITING;
2432+ SECONDARY_EXEC_ENABLE_VMFUNC;
2433+ if (cpu_has_sgx())
2434+ opt2 |= SECONDARY_EXEC_ENCLS_EXITING;
24232435 if (adjust_vmx_controls(min2, opt2,
24242436 MSR_IA32_VMX_PROCBASED_CTLS2,
24252437 &_cpu_based_2nd_exec_control) < 0)
arch/x86/kvm/x86.c+5−3
@@ -7195,10 +7195,12 @@ static void kvm_timer_init(void) · 7194 unmodified lines
71957195
71967196 cpu = get_cpu();
71977197 policy = cpufreq_cpu_get(cpu);
7198− if (policy && policy->cpuinfo.max_freq)
7199− max_tsc_khz = policy->cpuinfo.max_freq;
7198+ if (policy) {
7199+ if (policy->cpuinfo.max_freq)
7200+ max_tsc_khz = policy->cpuinfo.max_freq;
7201+ cpufreq_cpu_put(policy);
7202+ }
72007203 put_cpu();
7201− cpufreq_cpu_put(policy);
72027204 #endif
72037205 cpufreq_register_notifier(&kvmclock_cpufreq_notifier_block,
72047206 CPUFREQ_TRANSITION_NOTIFIER);
arch/x86/mm/fault.c+24−2
@@ -190,7 +190,7 @@ static inline pmd_t *vmalloc_sync_one(pgd_t *pgd, unsigned long address) · 189 unmodified lines
190190 return pmd_k;
191191 }
192192
193−void vmalloc_sync_all(void)
193+static void vmalloc_sync(void)
194194 {
195195 unsigned long address;
196196
@@ -217,6 +217,16 @@ void vmalloc_sync_all(void) · 20 unmodified lines
217217 }
218218 }
219219
220+void vmalloc_sync_mappings(void)
221+{
222+ vmalloc_sync();
223+}
224+
225+void vmalloc_sync_unmappings(void)
226+{
227+ vmalloc_sync();
228+}
229+
220230 /*
221231 * 32-bit:
222232 *
@@ -319,11 +329,23 @@ out: · 96 unmodified lines
319329
320330 #else /* CONFIG_X86_64: */
321331
322−void vmalloc_sync_all(void)
332+void vmalloc_sync_mappings(void)
323333 {
334+ /*
335+ * 64-bit mappings might allocate new p4d/pud pages
336+ * that need to be propagated to all tasks' PGDs.
337+ */
324338 sync_global_pgds(VMALLOC_START & PGDIR_MASK, VMALLOC_END);
325339 }
326340
341+void vmalloc_sync_unmappings(void)
342+{
343+ /*
344+ * Unmappings never allocate or free p4d/pud pages.
345+ * No work is required here.
346+ */
347+}
348+
327349 /*
328350 * 64-bit:
329351 *
arch/x86/mm/ioremap.c+18−0
@@ -106,6 +106,19 @@ static unsigned int __ioremap_check_encrypted(struct resource *res) · 105 unmodified lines
106106 return 0;
107107 }
108108
109+/*
110+ * The EFI runtime services data area is not covered by walk_mem_res(), but must
111+ * be mapped encrypted when SEV is active.
112+ */
113+static void __ioremap_check_other(resource_size_t addr, struct ioremap_desc *desc)
114+{
115+ if (!sev_active())
116+ return;
117+
118+ if (efi_mem_type(addr) == EFI_RUNTIME_SERVICES_DATA)
119+ desc->flags |= IORES_MAP_ENCRYPTED;
120+}
121+
109122 static int __ioremap_collect_map_flags(struct resource *res, void *arg)
110123 {
111124 struct ioremap_desc *desc = arg;
@@ -124,6 +137,9 @@ static int __ioremap_collect_map_flags(struct resource *res, void *arg) · 12 unmodified lines
124137 * To avoid multiple resource walks, this function walks resources marked as
125138 * IORESOURCE_MEM and IORESOURCE_BUSY and looking for system RAM and/or a
126139 * resource described not as IORES_DESC_NONE (e.g. IORES_DESC_ACPI_TABLES).
140+ *
141+ * After that, deal with misc other ranges in __ioremap_check_other() which do
142+ * not fall into the above category.
127143 */
128144 static void __ioremap_check_mem(resource_size_t addr, unsigned long size,
129145 struct ioremap_desc *desc)
@@ -135,6 +151,8 @@ static void __ioremap_check_mem(resource_size_t addr, unsigned long size, · 5 unmodified lines
135151 memset(desc, 0, sizeof(struct ioremap_desc));
136152
137153 walk_mem_res(start, end, desc, __ioremap_collect_map_flags);
154+
155+ __ioremap_check_other(addr, desc);
138156 }
139157
140158 /*
block/blk-iocost.c+1−1
@@ -1318,7 +1318,7 @@ static bool iocg_is_idle(struct ioc_gq *iocg) · 1317 unmodified lines
13181318 return false;
13191319
13201320 /* is something in flight? */
1321− if (atomic64_read(&iocg->done_vtime) < atomic64_read(&iocg->vtime))
1321+ if (atomic64_read(&iocg->done_vtime) != atomic64_read(&iocg->vtime))
13221322 return false;
13231323
13241324 return true;
block/blk-mq-sched.c+22−0
@@ -398,6 +398,28 @@ void blk_mq_sched_insert_request(struct request *rq, bool at_head, · 397 unmodified lines
398398 WARN_ON(e && (rq->tag != -1));
399399
400400 if (blk_mq_sched_bypass_insert(hctx, !!e, rq)) {
401+ /*
402+ * Firstly normal IO request is inserted to scheduler queue or
403+ * sw queue, meantime we add flush request to dispatch queue(
404+ * hctx->dispatch) directly and there is at most one in-flight
405+ * flush request for each hw queue, so it doesn't matter to add
406+ * flush request to tail or front of the dispatch queue.
407+ *
408+ * Secondly in case of NCQ, flush request belongs to non-NCQ
409+ * command, and queueing it will fail when there is any
410+ * in-flight normal IO request(NCQ command). When adding flush
411+ * rq to the front of hctx->dispatch, it is easier to introduce
412+ * extra time to flush rq's latency because of S_SCHED_RESTART
413+ * compared with adding to the tail of dispatch queue, then
414+ * chance of flush merge is increased, and less flush requests
415+ * will be issued to controller. It is observed that ~10% time
416+ * is saved in blktests block/004 on disk attached to AHCI/NCQ
417+ * drive when adding flush rq to the front of hctx->dispatch.
418+ *
419+ * Simply queue flush rq to the front of hctx->dispatch so that
420+ * intensive flush workloads can benefit in case of NCQ HW.
421+ */
422+ at_head = (rq->rq_flags & RQF_FLUSH_SEQ) ? true : at_head;
401423 blk_mq_request_bypass_insert(rq, at_head, false);
402424 goto run;
403425 }
block/genhd.c+36−0
@@ -301,6 +301,42 @@ struct hd_struct *disk_map_sector_rcu(struct gendisk *disk, sector_t sector) · 300 unmodified lines
301301 }
302302 EXPORT_SYMBOL_GPL(disk_map_sector_rcu);
303303
304+/**
305+ * disk_has_partitions
306+ * @disk: gendisk of interest
307+ *
308+ * Walk through the partition table and check if valid partition exists.
309+ *
310+ * CONTEXT:
311+ * Don't care.
312+ *
313+ * RETURNS:
314+ * True if the gendisk has at least one valid non-zero size partition.
315+ * Otherwise false.
316+ */
317+bool disk_has_partitions(struct gendisk *disk)
318+{
319+ struct disk_part_tbl *ptbl;
320+ int i;
321+ bool ret = false;
322+
323+ rcu_read_lock();
324+ ptbl = rcu_dereference(disk->part_tbl);
325+
326+ /* Iterate partitions skipping the whole device at index 0 */
327+ for (i = 1; i < ptbl->len; i++) {
328+ if (rcu_dereference(ptbl->part[i])) {
329+ ret = true;
330+ break;
331+ }
332+ }
333+
334+ rcu_read_unlock();
335+
336+ return ret;
337+}
338+EXPORT_SYMBOL_GPL(disk_has_partitions);
339+
304340 /*
305341 * Can be deleted altogether. Later.
306342 *
drivers/acpi/apei/ghes.c+1−1
@@ -171,7 +171,7 @@ int ghes_estatus_pool_init(int num_ghes) · 170 unmodified lines
171171 * New allocation must be visible in all pgd before it can be found by
172172 * an NMI allocating from the pool.
173173 */
174− vmalloc_sync_all();
174+ vmalloc_sync_mappings();
175175
176176 rc = gen_pool_add(ghes_estatus_pool, addr, PAGE_ALIGN(len), -1);
177177 if (rc)
drivers/android/binderfs.c+1−0
@@ -439,6 +439,7 @@ static int binderfs_binder_ctl_create(struct super_block *sb) · 438 unmodified lines
439439 inode->i_uid = info->root_uid;
440440 inode->i_gid = info->root_gid;
441441
442+ refcount_set(&device->ref, 1);
442443 device->binderfs_inode = inode;
443444 device->miscdev.minor = minor;
444445
drivers/atm/nicstar.c+1−1
@@ -91,7 +91,7 @@ · 90 unmodified lines
9191 #ifdef GENERAL_DEBUG
9292 #define PRINTK(args...) printk(args)
9393 #else
94−#define PRINTK(args...)
94+#define PRINTK(args...) do {} while (0)
9595 #endif /* GENERAL_DEBUG */
9696
9797 #ifdef EXTRA_DEBUG
drivers/auxdisplay/Kconfig+8−8
@@ -111,7 +111,7 @@ config CFAG12864B · 110 unmodified lines
111111 If unsure, say N.
112112
113113 config CFAG12864B_RATE
114− int "Refresh rate (hertz)"
114+ int "Refresh rate (hertz)"
115115 depends on CFAG12864B
116116 default "20"
117117 ---help---
@@ -329,7 +329,7 @@ config PANEL_LCD_PROTO · 211 unmodified lines
329329
330330 config PANEL_LCD_PIN_E
331331 depends on PANEL_PROFILE="0" && PANEL_LCD="1" && PANEL_LCD_PROTO="0"
332− int "Parallel port pin number & polarity connected to the LCD E signal (-17...17) "
332+ int "Parallel port pin number & polarity connected to the LCD E signal (-17...17) "
333333 range -17 17
334334 default 14
335335 ---help---
@@ -344,7 +344,7 @@ config PANEL_LCD_PIN_E · 8 unmodified lines
344344
345345 config PANEL_LCD_PIN_RS
346346 depends on PANEL_PROFILE="0" && PANEL_LCD="1" && PANEL_LCD_PROTO="0"
347− int "Parallel port pin number & polarity connected to the LCD RS signal (-17...17) "
347+ int "Parallel port pin number & polarity connected to the LCD RS signal (-17...17) "
348348 range -17 17
349349 default 17
350350 ---help---
@@ -359,7 +359,7 @@ config PANEL_LCD_PIN_RS · 8 unmodified lines
359359
360360 config PANEL_LCD_PIN_RW
361361 depends on PANEL_PROFILE="0" && PANEL_LCD="1" && PANEL_LCD_PROTO="0"
362− int "Parallel port pin number & polarity connected to the LCD RW signal (-17...17) "
362+ int "Parallel port pin number & polarity connected to the LCD RW signal (-17...17) "
363363 range -17 17
364364 default 16
365365 ---help---
@@ -374,7 +374,7 @@ config PANEL_LCD_PIN_RW · 8 unmodified lines
374374
375375 config PANEL_LCD_PIN_SCL
376376 depends on PANEL_PROFILE="0" && PANEL_LCD="1" && PANEL_LCD_PROTO!="0"
377− int "Parallel port pin number & polarity connected to the LCD SCL signal (-17...17) "
377+ int "Parallel port pin number & polarity connected to the LCD SCL signal (-17...17) "
378378 range -17 17
379379 default 1
380380 ---help---
@@ -389,7 +389,7 @@ config PANEL_LCD_PIN_SCL · 8 unmodified lines
389389
390390 config PANEL_LCD_PIN_SDA
391391 depends on PANEL_PROFILE="0" && PANEL_LCD="1" && PANEL_LCD_PROTO!="0"
392− int "Parallel port pin number & polarity connected to the LCD SDA signal (-17...17) "
392+ int "Parallel port pin number & polarity connected to the LCD SDA signal (-17...17) "
393393 range -17 17
394394 default 2
395395 ---help---
@@ -404,12 +404,12 @@ config PANEL_LCD_PIN_SDA · 8 unmodified lines
404404
405405 config PANEL_LCD_PIN_BL
406406 depends on PANEL_PROFILE="0" && PANEL_LCD="1"
407− int "Parallel port pin number & polarity connected to the LCD backlight signal (-17...17) "
407+ int "Parallel port pin number & polarity connected to the LCD backlight signal (-17...17) "
408408 range -17 17
409409 default 0
410410 ---help---
411411 This describes the number of the parallel port pin to which the LCD 'BL' signal
412− has been connected. It can be :
412+ has been connected. It can be :
413413
414414 0 : no connection (eg: connected to ground)
415415 1..17 : directly connected to any of these pins on the DB25 plug
drivers/auxdisplay/charlcd.c+1−1
@@ -86,7 +86,7 @@ struct charlcd_priv { · 85 unmodified lines
8686 int len;
8787 } esc_seq;
8888
89− unsigned long long drvdata[0];
89+ unsigned long long drvdata[];
9090 };
9191
9292 #define charlcd_to_priv(p) container_of(p, struct charlcd_priv, lcd)
drivers/auxdisplay/img-ascii-lcd.c+1−3
@@ -356,7 +356,6 @@ static int img_ascii_lcd_probe(struct platform_device *pdev) · 355 unmodified lines
356356 const struct of_device_id *match;
357357 const struct img_ascii_lcd_config *cfg;
358358 struct img_ascii_lcd_ctx *ctx;
359− struct resource *res;
360359 int err;
361360
362361 match = of_match_device(img_ascii_lcd_matches, &pdev->dev);
@@ -378,8 +377,7 @@ static int img_ascii_lcd_probe(struct platform_device *pdev) · 15 unmodified lines
378377 &ctx->offset))
379378 return -EINVAL;
380379 } else {
381− res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
382− ctx->base = devm_ioremap_resource(&pdev->dev, res);
380+ ctx->base = devm_platform_ioremap_resource(pdev, 0);
383381 if (IS_ERR(ctx->base))
384382 return PTR_ERR(ctx->base);
385383 }
drivers/base/platform.c+6−19
@@ -363,10 +363,10 @@ static void setup_pdev_dma_masks(struct platform_device *pdev) · 362 unmodified lines
363363 {
364364 if (!pdev->dev.coherent_dma_mask)
365365 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
366− if (!pdev->dma_mask)
367− pdev->dma_mask = DMA_BIT_MASK(32);
368− if (!pdev->dev.dma_mask)
369− pdev->dev.dma_mask = &pdev->dma_mask;
366+ if (!pdev->dev.dma_mask) {
367+ pdev->platform_dma_mask = DMA_BIT_MASK(32);
368+ pdev->dev.dma_mask = &pdev->platform_dma_mask;
369+ }
370370 };
371371
372372 /**
@@ -662,20 +662,8 @@ struct platform_device *platform_device_register_full( · 289 unmodified lines
662662 pdev->dev.of_node_reused = pdevinfo->of_node_reused;
663663
664664 if (pdevinfo->dma_mask) {
665− /*
666− * This memory isn't freed when the device is put,
667− * I don't have a nice idea for that though. Conceptually
668− * dma_mask in struct device should not be a pointer.
669− * See http://thread.gmane.org/gmane.linux.kernel.pci/9081
670− */
671− pdev->dev.dma_mask =
672− kmalloc(sizeof(*pdev->dev.dma_mask), GFP_KERNEL);
673− if (!pdev->dev.dma_mask)
674− goto err;
675−
676− kmemleak_ignore(pdev->dev.dma_mask);
677−
678− *pdev->dev.dma_mask = pdevinfo->dma_mask;
665+ pdev->platform_dma_mask = pdevinfo->dma_mask;
666+ pdev->dev.dma_mask = &pdev->platform_dma_mask;
679667 pdev->dev.coherent_dma_mask = pdevinfo->dma_mask;
680668 }
681669
@@ -700,7 +688,6 @@ struct platform_device *platform_device_register_full( · 18 unmodified lines
700688 if (ret) {
701689 err:
702690 ACPI_COMPANION_SET(&pdev->dev, NULL);
703− kfree(pdev->dev.dma_mask);
704691 platform_device_put(pdev);
705692 return ERR_PTR(ret);
706693 }
drivers/block/virtio_blk.c+12−5
@@ -245,13 +245,20 @@ static blk_status_t virtio_queue_rq(struct blk_mq_hw_ctx *hctx, · 244 unmodified lines
245245 err = virtblk_add_req(vblk->vqs[qid].vq, vbr, vbr->sg, num);
246246 if (err) {
247247 virtqueue_kick(vblk->vqs[qid].vq);
248− blk_mq_stop_hw_queue(hctx);
248+ /* Don't stop the queue if -ENOMEM: we may have failed to
249+ * bounce the buffer due to global resource outage.
250+ */
251+ if (err == -ENOSPC)
252+ blk_mq_stop_hw_queue(hctx);
249253 spin_unlock_irqrestore(&vblk->vqs[qid].lock, flags);
250− /* Out of mem doesn't actually happen, since we fall back
251− * to direct descriptors */
252− if (err == -ENOMEM || err == -ENOSPC)
254+ switch (err) {
255+ case -ENOSPC:
253256 return BLK_STS_DEV_RESOURCE;
254− return BLK_STS_IOERR;
257+ case -ENOMEM:
258+ return BLK_STS_RESOURCE;
259+ default:
260+ return BLK_STS_IOERR;
261+ }
255262 }
256263
257264 if (bd->last && virtqueue_kick_prepare(vblk->vqs[qid].vq))
drivers/char/ipmi/ipmi_si_platform.c+2−2
@@ -194,7 +194,7 @@ static int platform_ipmi_probe(struct platform_device *pdev) · 193 unmodified lines
194194 else
195195 io.slave_addr = slave_addr;
196196
197− io.irq = platform_get_irq(pdev, 0);
197+ io.irq = platform_get_irq_optional(pdev, 0);
198198 if (io.irq > 0)
199199 io.irq_setup = ipmi_std_irq_setup;
200200 else
@@ -378,7 +378,7 @@ static int acpi_ipmi_probe(struct platform_device *pdev) · 177 unmodified lines
378378 io.irq = tmp;
379379 io.irq_setup = acpi_gpe_irq_setup;
380380 } else {
381− int irq = platform_get_irq(pdev, 0);
381+ int irq = platform_get_irq_optional(pdev, 0);
382382
383383 if (irq > 0) {
384384 io.irq = irq;
drivers/clk/clk.c+2−2
@@ -4713,7 +4713,7 @@ EXPORT_SYMBOL(of_clk_get_by_name); · 4712 unmodified lines
47134713 *
47144714 * Returns: The number of clocks that are possible parents of this node
47154715 */
4716−unsigned int of_clk_get_parent_count(struct device_node *np)
4716+unsigned int of_clk_get_parent_count(const struct device_node *np)
47174717 {
47184718 int count;
47194719
@@ -4725,7 +4725,7 @@ unsigned int of_clk_get_parent_count(struct device_node *np) · 5 unmodified lines
47254725 }
47264726 EXPORT_SYMBOL_GPL(of_clk_get_parent_count);
47274727
4728−const char *of_clk_get_parent_name(struct device_node *np, int index)
4728+const char *of_clk_get_parent_name(const struct device_node *np, int index)
47294729 {
47304730 struct of_phandle_args clkspec;
47314731 struct property *prop;
drivers/clk/qcom/dispcc-sc7180.c+0−19
@@ -592,24 +592,6 @@ static struct clk_branch disp_cc_mdss_rot_clk = { · 591 unmodified lines
592592 },
593593 };
594594
595−static struct clk_branch disp_cc_mdss_rscc_ahb_clk = {
596− .halt_reg = 0x400c,
597− .halt_check = BRANCH_HALT,
598− .clkr = {
599− .enable_reg = 0x400c,
600− .enable_mask = BIT(0),
601− .hw.init = &(struct clk_init_data){
602− .name = "disp_cc_mdss_rscc_ahb_clk",
603− .parent_data = &(const struct clk_parent_data){
604− .hw = &disp_cc_mdss_ahb_clk_src.clkr.hw,
605− },
606− .num_parents = 1,
607− .flags = CLK_IS_CRITICAL | CLK_SET_RATE_PARENT,
608− .ops = &clk_branch2_ops,
609− },
610− },
611−};
612−
613595 static struct clk_branch disp_cc_mdss_rscc_vsync_clk = {
614596 .halt_reg = 0x4008,
615597 .halt_check = BRANCH_HALT,
@@ -687,7 +669,6 @@ static struct clk_regmap *disp_cc_sc7180_clocks[] = { · 71 unmodified lines
687669 [DISP_CC_MDSS_PCLK0_CLK_SRC] = &disp_cc_mdss_pclk0_clk_src.clkr,
688670 [DISP_CC_MDSS_ROT_CLK] = &disp_cc_mdss_rot_clk.clkr,
689671 [DISP_CC_MDSS_ROT_CLK_SRC] = &disp_cc_mdss_rot_clk_src.clkr,
690− [DISP_CC_MDSS_RSCC_AHB_CLK] = &disp_cc_mdss_rscc_ahb_clk.clkr,
691672 [DISP_CC_MDSS_RSCC_VSYNC_CLK] = &disp_cc_mdss_rscc_vsync_clk.clkr,
692673 [DISP_CC_MDSS_VSYNC_CLK] = &disp_cc_mdss_vsync_clk.clkr,
693674 [DISP_CC_MDSS_VSYNC_CLK_SRC] = &disp_cc_mdss_vsync_clk_src.clkr,
drivers/clk/qcom/videocc-sc7180.c+1−1
@@ -97,7 +97,7 @@ static struct clk_branch video_cc_vcodec0_axi_clk = { · 96 unmodified lines
9797
9898 static struct clk_branch video_cc_vcodec0_core_clk = {
9999 .halt_reg = 0x890,
100− .halt_check = BRANCH_HALT,
100+ .halt_check = BRANCH_HALT_VOTED,
101101 .clkr = {
102102 .enable_reg = 0x890,
103103 .enable_mask = BIT(0),
drivers/firmware/efi/efivars.c+23−9
@@ -83,13 +83,16 @@ static ssize_t · 82 unmodified lines
8383 efivar_attr_read(struct efivar_entry *entry, char *buf)
8484 {
8585 struct efi_variable *var = &entry->var;
86+ unsigned long size = sizeof(var->Data);
8687 char *str = buf;
88+ int ret;
8789
8890 if (!entry || !buf)
8991 return -EINVAL;
9092
91− var->DataSize = 1024;
92− if (efivar_entry_get(entry, &var->Attributes, &var->DataSize, var->Data))
93+ ret = efivar_entry_get(entry, &var->Attributes, &size, var->Data);
94+ var->DataSize = size;
95+ if (ret)
9396 return -EIO;
9497
9598 if (var->Attributes & EFI_VARIABLE_NON_VOLATILE)
@@ -116,13 +119,16 @@ static ssize_t · 20 unmodified lines
116119 efivar_size_read(struct efivar_entry *entry, char *buf)
117120 {
118121 struct efi_variable *var = &entry->var;
122+ unsigned long size = sizeof(var->Data);
119123 char *str = buf;
124+ int ret;
120125
121126 if (!entry || !buf)
122127 return -EINVAL;
123128
124− var->DataSize = 1024;
125− if (efivar_entry_get(entry, &var->Attributes, &var->DataSize, var->Data))
129+ ret = efivar_entry_get(entry, &var->Attributes, &size, var->Data);
130+ var->DataSize = size;
131+ if (ret)
126132 return -EIO;
127133
128134 str += sprintf(str, "0x%lx\n", var->DataSize);
@@ -133,12 +139,15 @@ static ssize_t · 4 unmodified lines
133139 efivar_data_read(struct efivar_entry *entry, char *buf)
134140 {
135141 struct efi_variable *var = &entry->var;
142+ unsigned long size = sizeof(var->Data);
143+ int ret;
136144
137145 if (!entry || !buf)
138146 return -EINVAL;
139147
140− var->DataSize = 1024;
141− if (efivar_entry_get(entry, &var->Attributes, &var->DataSize, var->Data))
148+ ret = efivar_entry_get(entry, &var->Attributes, &size, var->Data);
149+ var->DataSize = size;
150+ if (ret)
142151 return -EIO;
143152
144153 memcpy(buf, var->Data, var->DataSize);
@@ -199,6 +208,9 @@ efivar_store_raw(struct efivar_entry *entry, const char *buf, size_t count) · 54 unmodified lines
199208 u8 *data;
200209 int err;
201210
211+ if (!entry || !buf)
212+ return -EINVAL;
213+
202214 if (in_compat_syscall()) {
203215 struct compat_efi_variable *compat;
204216
@@ -250,14 +262,16 @@ efivar_show_raw(struct efivar_entry *entry, char *buf) · 45 unmodified lines
250262 {
251263 struct efi_variable *var = &entry->var;
252264 struct compat_efi_variable *compat;
265+ unsigned long datasize = sizeof(var->Data);
253266 size_t size;
267+ int ret;
254268
255269 if (!entry || !buf)
256270 return 0;
257271
258− var->DataSize = 1024;
259− if (efivar_entry_get(entry, &entry->var.Attributes,
260− &entry->var.DataSize, entry->var.Data))
272+ ret = efivar_entry_get(entry, &var->Attributes, &datasize, var->Data);
273+ var->DataSize = datasize;
274+ if (ret)
261275 return -EIO;
262276
263277 if (in_compat_syscall()) {
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c+3−3
@@ -781,11 +781,11 @@ static ssize_t amdgpu_debugfs_gpr_read(struct file *f, char __user *buf, · 780 unmodified lines
781781 ssize_t result = 0;
782782 uint32_t offset, se, sh, cu, wave, simd, thread, bank, *data;
783783
784− if (size & 3 || *pos & 3)
784+ if (size > 4096 || size & 3 || *pos & 3)
785785 return -EINVAL;
786786
787787 /* decode offset */
788− offset = *pos & GENMASK_ULL(11, 0);
788+ offset = (*pos & GENMASK_ULL(11, 0)) >> 2;
789789 se = (*pos & GENMASK_ULL(19, 12)) >> 12;
790790 sh = (*pos & GENMASK_ULL(27, 20)) >> 20;
791791 cu = (*pos & GENMASK_ULL(35, 28)) >> 28;
@@ -823,7 +823,7 @@ static ssize_t amdgpu_debugfs_gpr_read(struct file *f, char __user *buf, · 31 unmodified lines
823823 while (size) {
824824 uint32_t value;
825825
826− value = data[offset++];
826+ value = data[result >> 2];
827827 r = put_user(value, (uint32_t *)buf);
828828 if (r) {
829829 result = r;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c+4−0
@@ -3913,6 +3913,8 @@ static int amdgpu_do_asic_reset(struct amdgpu_hive_info *hive, · 3912 unmodified lines
39133913 if (r)
39143914 goto out;
39153915
3916+ amdgpu_fbdev_set_suspend(tmp_adev, 0);
3917+
39163918 /* must succeed. */
39173919 amdgpu_ras_resume(tmp_adev);
39183920
@@ -4086,6 +4088,8 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev, · 167 unmodified lines
40864088 */
40874089 amdgpu_unregister_gpu_instance(tmp_adev);
40884090
4091+ amdgpu_fbdev_set_suspend(adev, 1);
4092+
40894093 /* disable ras on ALL IPs */
40904094 if (!(in_ras_intr && !use_baco) &&
40914095 amdgpu_device_ip_need_full_reset(tmp_adev))
drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c+1−1
@@ -693,7 +693,7 @@ static int jpeg_v2_0_set_clockgating_state(void *handle, · 692 unmodified lines
693693 bool enable = (state == AMD_CG_STATE_GATE);
694694
695695 if (enable) {
696− if (jpeg_v2_0_is_idle(handle))
696+ if (!jpeg_v2_0_is_idle(handle))
697697 return -EBUSY;
698698 jpeg_v2_0_enable_clock_gating(adev);
699699 } else {
drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c+1−1
@@ -477,7 +477,7 @@ static int jpeg_v2_5_set_clockgating_state(void *handle, · 476 unmodified lines
477477 continue;
478478
479479 if (enable) {
480− if (jpeg_v2_5_is_idle(handle))
480+ if (!jpeg_v2_5_is_idle(handle))
481481 return -EBUSY;
482482 jpeg_v2_5_enable_clock_gating(adev, i);
483483 } else {
drivers/gpu/drm/amd/amdgpu/soc15.c+23−2
@@ -89,6 +89,13 @@ · 88 unmodified lines
8989 #define HDP_MEM_POWER_CTRL__RC_MEM_POWER_CTRL_EN_MASK 0x00010000L
9090 #define HDP_MEM_POWER_CTRL__RC_MEM_POWER_LS_EN_MASK 0x00020000L
9191 #define mmHDP_MEM_POWER_CTRL_BASE_IDX 0
92+
93+/* for Vega20/arcturus regiter offset change */
94+#define mmROM_INDEX_VG20 0x00e4
95+#define mmROM_INDEX_VG20_BASE_IDX 0
96+#define mmROM_DATA_VG20 0x00e5
97+#define mmROM_DATA_VG20_BASE_IDX 0
98+
9299 /*
93100 * Indirect registers accessor
94101 */
@@ -309,6 +316,8 @@ static bool soc15_read_bios_from_rom(struct amdgpu_device *adev, · 214 unmodified lines
309316 {
310317 u32 *dw_ptr;
311318 u32 i, length_dw;
319+ uint32_t rom_index_offset;
320+ uint32_t rom_data_offset;
312321
313322 if (bios == NULL)
314323 return false;
@@ -321,11 +330,23 @@ static bool soc15_read_bios_from_rom(struct amdgpu_device *adev, · 6 unmodified lines
321330 dw_ptr = (u32 *)bios;
322331 length_dw = ALIGN(length_bytes, 4) / 4;
323332
333+ switch (adev->asic_type) {
334+ case CHIP_VEGA20:
335+ case CHIP_ARCTURUS:
336+ rom_index_offset = SOC15_REG_OFFSET(SMUIO, 0, mmROM_INDEX_VG20);
337+ rom_data_offset = SOC15_REG_OFFSET(SMUIO, 0, mmROM_DATA_VG20);
338+ break;
339+ default:
340+ rom_index_offset = SOC15_REG_OFFSET(SMUIO, 0, mmROM_INDEX);
341+ rom_data_offset = SOC15_REG_OFFSET(SMUIO, 0, mmROM_DATA);
342+ break;
343+ }
344+
324345 /* set rom index to 0 */
325− WREG32(SOC15_REG_OFFSET(SMUIO, 0, mmROM_INDEX), 0);
346+ WREG32(rom_index_offset, 0);
326347 /* read out the rom data */
327348 for (i = 0; i < length_dw; i++)
328− dw_ptr[i] = RREG32(SOC15_REG_OFFSET(SMUIO, 0, mmROM_DATA));
349+ dw_ptr[i] = RREG32(rom_data_offset);
329350
330351 return true;
331352 }
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c+1−1
@@ -1352,7 +1352,7 @@ static int vcn_v1_0_set_clockgating_state(void *handle, · 1351 unmodified lines
13521352
13531353 if (enable) {
13541354 /* wait for STATUS to clear */
1355− if (vcn_v1_0_is_idle(handle))
1355+ if (!vcn_v1_0_is_idle(handle))
13561356 return -EBUSY;
13571357 vcn_v1_0_enable_clock_gating(adev);
13581358 } else {
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c+1−1
@@ -1217,7 +1217,7 @@ static int vcn_v2_0_set_clockgating_state(void *handle, · 1216 unmodified lines
12171217
12181218 if (enable) {
12191219 /* wait for STATUS to clear */
1220− if (vcn_v2_0_is_idle(handle))
1220+ if (!vcn_v2_0_is_idle(handle))
12211221 return -EBUSY;
12221222 vcn_v2_0_enable_clock_gating(adev);
12231223 } else {
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c+1−1
@@ -1672,7 +1672,7 @@ static int vcn_v2_5_set_clockgating_state(void *handle, · 1671 unmodified lines
16721672 return 0;
16731673
16741674 if (enable) {
1675− if (vcn_v2_5_is_idle(handle))
1675+ if (!vcn_v2_5_is_idle(handle))
16761676 return -EBUSY;
16771677 vcn_v2_5_enable_clock_gating(adev);
16781678 } else {
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c+15−3
@@ -522,8 +522,9 @@ static void dm_dcn_crtc_high_irq(void *interrupt_params) · 521 unmodified lines
522522
523523 acrtc_state = to_dm_crtc_state(acrtc->base.state);
524524
525− DRM_DEBUG_DRIVER("crtc:%d, vupdate-vrr:%d\n", acrtc->crtc_id,
526− amdgpu_dm_vrr_active(acrtc_state));
525+ DRM_DEBUG_DRIVER("crtc:%d, vupdate-vrr:%d, planes:%d\n", acrtc->crtc_id,
526+ amdgpu_dm_vrr_active(acrtc_state),
527+ acrtc_state->active_planes);
527528
528529 amdgpu_dm_crtc_handle_crc_irq(&acrtc->base);
529530 drm_crtc_handle_vblank(&acrtc->base);
@@ -543,7 +544,18 @@ static void dm_dcn_crtc_high_irq(void *interrupt_params) · 13 unmodified lines
543544 &acrtc_state->vrr_params.adjust);
544545 }
545546
546− if (acrtc->pflip_status == AMDGPU_FLIP_SUBMITTED) {
547+ /*
548+ * If there aren't any active_planes then DCH HUBP may be clock-gated.
549+ * In that case, pageflip completion interrupts won't fire and pageflip
550+ * completion events won't get delivered. Prevent this by sending
551+ * pending pageflip events from here if a flip is still pending.
552+ *
553+ * If any planes are enabled, use dm_pflip_high_irq() instead, to
554+ * avoid race conditions between flip programming and completion,
555+ * which could cause too early flip completion events.
556+ */
557+ if (acrtc->pflip_status == AMDGPU_FLIP_SUBMITTED &&
558+ acrtc_state->active_planes == 0) {
547559 if (acrtc->event) {
548560 drm_crtc_send_vblank_event(&acrtc->base, acrtc->event);
549561 acrtc->event = NULL;
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c+11−0
@@ -3401,6 +3401,17 @@ static bool retrieve_link_cap(struct dc_link *link) · 3400 unmodified lines
34013401 sink_id.ieee_device_id,
34023402 sizeof(sink_id.ieee_device_id));
34033403
3404+ /* Quirk Apple MBP 2017 15" Retina panel: Wrong DP_MAX_LINK_RATE */
3405+ {
3406+ uint8_t str_mbp_2017[] = { 101, 68, 21, 101, 98, 97 };
3407+
3408+ if ((link->dpcd_caps.sink_dev_id == 0x0010fa) &&
3409+ !memcmp(link->dpcd_caps.sink_dev_id_str, str_mbp_2017,
3410+ sizeof(str_mbp_2017))) {
3411+ link->reported_link_cap.link_rate = 0x0c;
3412+ }
3413+ }
3414+
34043415 core_link_read_dpcd(
34053416 link,
34063417 DP_SINK_HW_REVISION_START,
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_init.c+0−1
@@ -108,7 +108,6 @@ static const struct hwseq_private_funcs dcn20_private_funcs = { · 107 unmodified lines
108108 .enable_power_gating_plane = dcn20_enable_power_gating_plane,
109109 .dpp_pg_control = dcn20_dpp_pg_control,
110110 .hubp_pg_control = dcn20_hubp_pg_control,
111− .dsc_pg_control = NULL,
112111 .update_odm = dcn20_update_odm,
113112 .dsc_pg_control = dcn20_dsc_pg_control,
114113 .get_surface_visual_confirm_color = dcn10_get_surface_visual_confirm_color,
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c+114−0
@@ -335,6 +335,117 @@ struct _vcs_dpi_soc_bounding_box_st dcn2_0_soc = { · 334 unmodified lines
335335 .use_urgent_burst_bw = 0
336336 };
337337
338+struct _vcs_dpi_soc_bounding_box_st dcn2_0_nv14_soc = {
339+ .clock_limits = {
340+ {
341+ .state = 0,
342+ .dcfclk_mhz = 560.0,
343+ .fabricclk_mhz = 560.0,
344+ .dispclk_mhz = 513.0,
345+ .dppclk_mhz = 513.0,
346+ .phyclk_mhz = 540.0,
347+ .socclk_mhz = 560.0,
348+ .dscclk_mhz = 171.0,
349+ .dram_speed_mts = 8960.0,
350+ },
351+ {
352+ .state = 1,
353+ .dcfclk_mhz = 694.0,
354+ .fabricclk_mhz = 694.0,
355+ .dispclk_mhz = 642.0,
356+ .dppclk_mhz = 642.0,
357+ .phyclk_mhz = 600.0,
358+ .socclk_mhz = 694.0,
359+ .dscclk_mhz = 214.0,
360+ .dram_speed_mts = 11104.0,
361+ },
362+ {
363+ .state = 2,
364+ .dcfclk_mhz = 875.0,
365+ .fabricclk_mhz = 875.0,
366+ .dispclk_mhz = 734.0,
367+ .dppclk_mhz = 734.0,
368+ .phyclk_mhz = 810.0,
369+ .socclk_mhz = 875.0,
370+ .dscclk_mhz = 245.0,
371+ .dram_speed_mts = 14000.0,
372+ },
373+ {
374+ .state = 3,
375+ .dcfclk_mhz = 1000.0,
376+ .fabricclk_mhz = 1000.0,
377+ .dispclk_mhz = 1100.0,
378+ .dppclk_mhz = 1100.0,
379+ .phyclk_mhz = 810.0,
380+ .socclk_mhz = 1000.0,
381+ .dscclk_mhz = 367.0,
382+ .dram_speed_mts = 16000.0,
383+ },
384+ {
385+ .state = 4,
386+ .dcfclk_mhz = 1200.0,
387+ .fabricclk_mhz = 1200.0,
388+ .dispclk_mhz = 1284.0,
389+ .dppclk_mhz = 1284.0,
390+ .phyclk_mhz = 810.0,
391+ .socclk_mhz = 1200.0,
392+ .dscclk_mhz = 428.0,
393+ .dram_speed_mts = 16000.0,
394+ },
395+ /*Extra state, no dispclk ramping*/
396+ {
397+ .state = 5,
398+ .dcfclk_mhz = 1200.0,
399+ .fabricclk_mhz = 1200.0,
400+ .dispclk_mhz = 1284.0,
401+ .dppclk_mhz = 1284.0,
402+ .phyclk_mhz = 810.0,
403+ .socclk_mhz = 1200.0,
404+ .dscclk_mhz = 428.0,
405+ .dram_speed_mts = 16000.0,
406+ },
407+ },
408+ .num_states = 5,
409+ .sr_exit_time_us = 8.6,
410+ .sr_enter_plus_exit_time_us = 10.9,
411+ .urgent_latency_us = 4.0,
412+ .urgent_latency_pixel_data_only_us = 4.0,
413+ .urgent_latency_pixel_mixed_with_vm_data_us = 4.0,
414+ .urgent_latency_vm_data_only_us = 4.0,
415+ .urgent_out_of_order_return_per_channel_pixel_only_bytes = 4096,
416+ .urgent_out_of_order_return_per_channel_pixel_and_vm_bytes = 4096,
417+ .urgent_out_of_order_return_per_channel_vm_only_bytes = 4096,
418+ .pct_ideal_dram_sdp_bw_after_urgent_pixel_only = 40.0,
419+ .pct_ideal_dram_sdp_bw_after_urgent_pixel_and_vm = 40.0,
420+ .pct_ideal_dram_sdp_bw_after_urgent_vm_only = 40.0,
421+ .max_avg_sdp_bw_use_normal_percent = 40.0,
422+ .max_avg_dram_bw_use_normal_percent = 40.0,
423+ .writeback_latency_us = 12.0,
424+ .ideal_dram_bw_after_urgent_percent = 40.0,
425+ .max_request_size_bytes = 256,
426+ .dram_channel_width_bytes = 2,
427+ .fabric_datapath_to_dcn_data_return_bytes = 64,
428+ .dcn_downspread_percent = 0.5,
429+ .downspread_percent = 0.38,
430+ .dram_page_open_time_ns = 50.0,
431+ .dram_rw_turnaround_time_ns = 17.5,
432+ .dram_return_buffer_per_channel_bytes = 8192,
433+ .round_trip_ping_latency_dcfclk_cycles = 131,
434+ .urgent_out_of_order_return_per_channel_bytes = 256,
435+ .channel_interleave_bytes = 256,
436+ .num_banks = 8,
437+ .num_chans = 8,
438+ .vmm_page_size_bytes = 4096,
439+ .dram_clock_change_latency_us = 404.0,
440+ .dummy_pstate_latency_us = 5.0,
441+ .writeback_dram_clock_change_latency_us = 23.0,
442+ .return_bus_width_bytes = 64,
443+ .dispclk_dppclk_vco_speed_mhz = 3850,
444+ .xfc_bus_transport_time_us = 20,
445+ .xfc_xbuf_latency_tolerance_us = 4,
446+ .use_urgent_burst_bw = 0
447+};
448+
338449 struct _vcs_dpi_soc_bounding_box_st dcn2_0_nv12_soc = { 0 };
339450
340451 #ifndef mmDP0_DP_DPHY_INTERNAL_CTRL
@@ -3291,6 +3402,9 @@ void dcn20_patch_bounding_box(struct dc *dc, struct _vcs_dpi_soc_bounding_box_st · 2950 unmodified lines
32913402 static struct _vcs_dpi_soc_bounding_box_st *get_asic_rev_soc_bb(
32923403 uint32_t hw_internal_rev)
32933404 {
3405+ if (ASICREV_IS_NAVI14_M(hw_internal_rev))
3406+ return &dcn2_0_nv14_soc;
3407+
32943408 if (ASICREV_IS_NAVI12_P(hw_internal_rev))
32953409 return &dcn2_0_nv12_soc;
32963410
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_init.c+0−1
@@ -116,7 +116,6 @@ static const struct hwseq_private_funcs dcn21_private_funcs = { · 115 unmodified lines
116116 .enable_power_gating_plane = dcn20_enable_power_gating_plane,
117117 .dpp_pg_control = dcn20_dpp_pg_control,
118118 .hubp_pg_control = dcn20_hubp_pg_control,
119− .dsc_pg_control = NULL,
120119 .update_odm = dcn20_update_odm,
121120 .dsc_pg_control = dcn20_dsc_pg_control,
122121 .get_surface_visual_confirm_color = dcn10_get_surface_visual_confirm_color,
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c+5−2
@@ -2006,8 +2006,11 @@ int smu_set_watermarks_for_clock_ranges(struct smu_context *smu, · 2005 unmodified lines
20062006 smu_feature_is_enabled(smu, SMU_FEATURE_DPM_DCEFCLK_BIT) &&
20072007 smu_feature_is_enabled(smu, SMU_FEATURE_DPM_SOCCLK_BIT)) {
20082008 smu_set_watermarks_table(smu, table, clock_ranges);
2009− smu->watermarks_bitmap |= WATERMARKS_EXIST;
2010− smu->watermarks_bitmap &= ~WATERMARKS_LOADED;
2009+
2010+ if (!(smu->watermarks_bitmap & WATERMARKS_EXIST)) {
2011+ smu->watermarks_bitmap |= WATERMARKS_EXIST;
2012+ smu->watermarks_bitmap &= ~WATERMARKS_LOADED;
2013+ }
20112014 }
20122015
20132016 mutex_unlock(&smu->mutex);
drivers/gpu/drm/amd/powerplay/navi10_ppt.c+13−9
@@ -1062,15 +1062,6 @@ static int navi10_display_config_changed(struct smu_context *smu) · 1061 unmodified lines
10621062 {
10631063 int ret = 0;
10641064
1065− if ((smu->watermarks_bitmap & WATERMARKS_EXIST) &&
1066− !(smu->watermarks_bitmap & WATERMARKS_LOADED)) {
1067− ret = smu_write_watermarks_table(smu);
1068− if (ret)
1069− return ret;
1070−
1071− smu->watermarks_bitmap |= WATERMARKS_LOADED;
1072− }
1073−
10741065 if ((smu->watermarks_bitmap & WATERMARKS_EXIST) &&
10751066 smu_feature_is_supported(smu, SMU_FEATURE_DPM_DCEFCLK_BIT) &&
10761067 smu_feature_is_supported(smu, SMU_FEATURE_DPM_SOCCLK_BIT)) {
@@ -1493,6 +1484,7 @@ static int navi10_set_watermarks_table(struct smu_context *smu, · 416 unmodified lines
14931484 *clock_ranges)
14941485 {
14951486 int i;
1487+ int ret = 0;
14961488 Watermarks_t *table = watermarks;
14971489
14981490 if (!table || !clock_ranges)
@@ -1544,6 +1536,18 @@ static int navi10_set_watermarks_table(struct smu_context *smu, · 45 unmodified lines
15441536 clock_ranges->wm_mcif_clocks_ranges[i].wm_set_id;
15451537 }
15461538
1539+ smu->watermarks_bitmap |= WATERMARKS_EXIST;
1540+
1541+ /* pass data to smu controller */
1542+ if (!(smu->watermarks_bitmap & WATERMARKS_LOADED)) {
1543+ ret = smu_write_watermarks_table(smu);
1544+ if (ret) {
1545+ pr_err("Failed to update WMTABLE!");
1546+ return ret;
1547+ }
1548+ smu->watermarks_bitmap |= WATERMARKS_LOADED;
1549+ }
1550+
15471551 return 0;
15481552 }
15491553
drivers/gpu/drm/amd/powerplay/renoir_ppt.c+3−2
@@ -806,9 +806,10 @@ static int renoir_set_watermarks_table( · 805 unmodified lines
806806 clock_ranges->wm_mcif_clocks_ranges[i].wm_set_id;
807807 }
808808
809+ smu->watermarks_bitmap |= WATERMARKS_EXIST;
810+
809811 /* pass data to smu controller */
810− if ((smu->watermarks_bitmap & WATERMARKS_EXIST) &&
811− !(smu->watermarks_bitmap & WATERMARKS_LOADED)) {
812+ if (!(smu->watermarks_bitmap & WATERMARKS_LOADED)) {
812813 ret = smu_write_watermarks_table(smu);
813814 if (ret) {
814815 pr_err("Failed to update WMTABLE!");
drivers/gpu/drm/arm/display/komeda/komeda_drv.c+2−2
@@ -146,14 +146,14 @@ static const struct of_device_id komeda_of_match[] = { · 145 unmodified lines
146146
147147 MODULE_DEVICE_TABLE(of, komeda_of_match);
148148
149−static int komeda_rt_pm_suspend(struct device *dev)
149+static int __maybe_unused komeda_rt_pm_suspend(struct device *dev)
150150 {
151151 struct komeda_drv *mdrv = dev_get_drvdata(dev);
152152
153153 return komeda_dev_suspend(mdrv->mdev);
154154 }
155155
156−static int komeda_rt_pm_resume(struct device *dev)
156+static int __maybe_unused komeda_rt_pm_resume(struct device *dev)
157157 {
158158 struct komeda_drv *mdrv = dev_get_drvdata(dev);
159159
drivers/gpu/drm/bochs/bochs_hw.c+2−4
@@ -156,10 +156,8 @@ int bochs_hw_init(struct drm_device *dev) · 155 unmodified lines
156156 size = min(size, mem);
157157 }
158158
159− if (pci_request_region(pdev, 0, "bochs-drm") != 0) {
160− DRM_ERROR("Cannot request framebuffer\n");
161− return -EBUSY;
162− }
159+ if (pci_request_region(pdev, 0, "bochs-drm") != 0)
160+ DRM_WARN("Cannot request framebuffer, boot fb still active?\n");
163161
164162 bochs->fb_map = ioremap(addr, size);
165163 if (bochs->fb_map == NULL) {
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c+26−20
@@ -1624,28 +1624,34 @@ static void hdmi_config_AVI(struct dw_hdmi *hdmi, struct drm_display_mode *mode) · 1623 unmodified lines
16241624 frame.colorspace = HDMI_COLORSPACE_RGB;
16251625
16261626 /* Set up colorimetry */
1627− switch (hdmi->hdmi_data.enc_out_encoding) {
1628− case V4L2_YCBCR_ENC_601:
1629− if (hdmi->hdmi_data.enc_in_encoding == V4L2_YCBCR_ENC_XV601)
1630− frame.colorimetry = HDMI_COLORIMETRY_EXTENDED;
1631− else
1627+ if (!hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_out_bus_format)) {
1628+ switch (hdmi->hdmi_data.enc_out_encoding) {
1629+ case V4L2_YCBCR_ENC_601:
1630+ if (hdmi->hdmi_data.enc_in_encoding == V4L2_YCBCR_ENC_XV601)
1631+ frame.colorimetry = HDMI_COLORIMETRY_EXTENDED;
1632+ else
1633+ frame.colorimetry = HDMI_COLORIMETRY_ITU_601;
1634+ frame.extended_colorimetry =
1635+ HDMI_EXTENDED_COLORIMETRY_XV_YCC_601;
1636+ break;
1637+ case V4L2_YCBCR_ENC_709:
1638+ if (hdmi->hdmi_data.enc_in_encoding == V4L2_YCBCR_ENC_XV709)
1639+ frame.colorimetry = HDMI_COLORIMETRY_EXTENDED;
1640+ else
1641+ frame.colorimetry = HDMI_COLORIMETRY_ITU_709;
1642+ frame.extended_colorimetry =
1643+ HDMI_EXTENDED_COLORIMETRY_XV_YCC_709;
1644+ break;
1645+ default: /* Carries no data */
16321646 frame.colorimetry = HDMI_COLORIMETRY_ITU_601;
1647+ frame.extended_colorimetry =
1648+ HDMI_EXTENDED_COLORIMETRY_XV_YCC_601;
1649+ break;
1650+ }
1651+ } else {
1652+ frame.colorimetry = HDMI_COLORIMETRY_NONE;
16331653 frame.extended_colorimetry =
1634− HDMI_EXTENDED_COLORIMETRY_XV_YCC_601;
1635− break;
1636− case V4L2_YCBCR_ENC_709:
1637− if (hdmi->hdmi_data.enc_in_encoding == V4L2_YCBCR_ENC_XV709)
1638− frame.colorimetry = HDMI_COLORIMETRY_EXTENDED;
1639− else
1640− frame.colorimetry = HDMI_COLORIMETRY_ITU_709;
1641− frame.extended_colorimetry =
1642− HDMI_EXTENDED_COLORIMETRY_XV_YCC_709;
1643− break;
1644− default: /* Carries no data */
1645− frame.colorimetry = HDMI_COLORIMETRY_ITU_601;
1646− frame.extended_colorimetry =
1647− HDMI_EXTENDED_COLORIMETRY_XV_YCC_601;
1648− break;
1654+ HDMI_EXTENDED_COLORIMETRY_XV_YCC_601;
16491655 }
16501656
16511657 frame.scan_mode = HDMI_SCAN_MODE_NONE;
drivers/gpu/drm/drm_dp_mst_topology.c+126−58
@@ -1935,7 +1935,7 @@ static u8 drm_dp_calculate_rad(struct drm_dp_mst_port *port, · 1934 unmodified lines
19351935 return parent_lct + 1;
19361936 }
19371937
1938−static bool drm_dp_mst_is_dp_mst_end_device(u8 pdt, bool mcs)
1938+static bool drm_dp_mst_is_end_device(u8 pdt, bool mcs)
19391939 {
19401940 switch (pdt) {
19411941 case DP_PEER_DEVICE_DP_LEGACY_CONV:
@@ -1965,13 +1965,13 @@ drm_dp_port_set_pdt(struct drm_dp_mst_port *port, u8 new_pdt, · 23 unmodified lines
19651965
19661966 /* Teardown the old pdt, if there is one */
19671967 if (port->pdt != DP_PEER_DEVICE_NONE) {
1968− if (drm_dp_mst_is_dp_mst_end_device(port->pdt, port->mcs)) {
1968+ if (drm_dp_mst_is_end_device(port->pdt, port->mcs)) {
19691969 /*
19701970 * If the new PDT would also have an i2c bus,
19711971 * don't bother with reregistering it
19721972 */
19731973 if (new_pdt != DP_PEER_DEVICE_NONE &&
1974− drm_dp_mst_is_dp_mst_end_device(new_pdt, new_mcs)) {
1974+ drm_dp_mst_is_end_device(new_pdt, new_mcs)) {
19751975 port->pdt = new_pdt;
19761976 port->mcs = new_mcs;
19771977 return 0;
@@ -1991,7 +1991,7 @@ drm_dp_port_set_pdt(struct drm_dp_mst_port *port, u8 new_pdt, · 13 unmodified lines
19911991 port->mcs = new_mcs;
19921992
19931993 if (port->pdt != DP_PEER_DEVICE_NONE) {
1994− if (drm_dp_mst_is_dp_mst_end_device(port->pdt, port->mcs)) {
1994+ if (drm_dp_mst_is_end_device(port->pdt, port->mcs)) {
19951995 /* add i2c over sideband */
19961996 ret = drm_dp_mst_register_i2c_bus(&port->aux);
19971997 } else {
@@ -2172,7 +2172,7 @@ drm_dp_mst_port_add_connector(struct drm_dp_mst_branch *mstb, · 174 unmodified lines
21722172 }
21732173
21742174 if (port->pdt != DP_PEER_DEVICE_NONE &&
2175− drm_dp_mst_is_dp_mst_end_device(port->pdt, port->mcs)) {
2175+ drm_dp_mst_is_end_device(port->pdt, port->mcs)) {
21762176 port->cached_edid = drm_get_edid(port->connector,
21772177 &port->aux.ddc);
21782178 drm_connector_set_tile_property(port->connector);
@@ -2302,14 +2302,18 @@ drm_dp_mst_handle_link_address_port(struct drm_dp_mst_branch *mstb, · 123 unmodified lines
23022302 mutex_unlock(&mgr->lock);
23032303 }
23042304
2305− if (old_ddps != port->ddps) {
2306− if (port->ddps) {
2307− if (!port->input) {
2308− drm_dp_send_enum_path_resources(mgr, mstb,
2309− port);
2310− }
2305+ /*
2306+ * Reprobe PBN caps on both hotplug, and when re-probing the link
2307+ * for our parent mstb
2308+ */
2309+ if (old_ddps != port->ddps || !created) {
2310+ if (port->ddps && !port->input) {
2311+ ret = drm_dp_send_enum_path_resources(mgr, mstb,
2312+ port);
2313+ if (ret == 1)
2314+ changed = true;
23112315 } else {
2312− port->available_pbn = 0;
2316+ port->full_pbn = 0;
23132317 }
23142318 }
23152319
@@ -2401,11 +2405,10 @@ drm_dp_mst_handle_conn_stat(struct drm_dp_mst_branch *mstb, · 85 unmodified lines
24012405 port->ddps = conn_stat->displayport_device_plug_status;
24022406
24032407 if (old_ddps != port->ddps) {
2404− if (port->ddps) {
2405− dowork = true;
2406− } else {
2407− port->available_pbn = 0;
2408− }
2408+ if (port->ddps && !port->input)
2409+ drm_dp_send_enum_path_resources(mgr, mstb, port);
2410+ else
2411+ port->full_pbn = 0;
24092412 }
24102413
24112414 new_pdt = port->input ? DP_PEER_DEVICE_NONE : conn_stat->peer_device_type;
@@ -2556,13 +2559,6 @@ static int drm_dp_check_and_send_link_address(struct drm_dp_mst_topology_mgr *mg · 144 unmodified lines
25562559 if (port->input || !port->ddps)
25572560 continue;
25582561
2559− if (!port->available_pbn) {
2560− drm_modeset_lock(&mgr->base.lock, NULL);
2561− drm_dp_send_enum_path_resources(mgr, mstb, port);
2562− drm_modeset_unlock(&mgr->base.lock);
2563− changed = true;
2564− }
2565−
25662562 if (port->mstb)
25672563 mstb_child = drm_dp_mst_topology_get_mstb_validated(
25682564 mgr, port->mstb);
@@ -2990,6 +2986,7 @@ drm_dp_send_enum_path_resources(struct drm_dp_mst_topology_mgr *mgr, · 421 unmodified lines
29902986
29912987 ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
29922988 if (ret > 0) {
2989+ ret = 0;
29932990 path_res = &txmsg->reply.u.path_resources;
29942991
29952992 if (txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK) {
@@ -3002,14 +2999,22 @@ drm_dp_send_enum_path_resources(struct drm_dp_mst_topology_mgr *mgr, · 6 unmodified lines
30022999 path_res->port_number,
30033000 path_res->full_payload_bw_number,
30043001 path_res->avail_payload_bw_number);
3005− port->available_pbn =
3006− path_res->avail_payload_bw_number;
3002+
3003+ /*
3004+ * If something changed, make sure we send a
3005+ * hotplug
3006+ */
3007+ if (port->full_pbn != path_res->full_payload_bw_number ||
3008+ port->fec_capable != path_res->fec_capable)
3009+ ret = 1;
3010+
3011+ port->full_pbn = path_res->full_payload_bw_number;
30073012 port->fec_capable = path_res->fec_capable;
30083013 }
30093014 }
30103015
30113016 kfree(txmsg);
3012− return 0;
3017+ return ret;
30133018 }
30143019
30153020 static struct drm_dp_mst_port *drm_dp_get_last_connected_port_to_mstb(struct drm_dp_mst_branch *mstb)
@@ -3596,13 +3601,9 @@ drm_dp_mst_topology_mgr_invalidate_mstb(struct drm_dp_mst_branch *mstb) · 580 unmodified lines
35963601 /* The link address will need to be re-sent on resume */
35973602 mstb->link_address_sent = false;
35983603
3599− list_for_each_entry(port, &mstb->ports, next) {
3600− /* The PBN for each port will also need to be re-probed */
3601− port->available_pbn = 0;
3602−
3604+ list_for_each_entry(port, &mstb->ports, next)
36033605 if (port->mstb)
36043606 drm_dp_mst_topology_mgr_invalidate_mstb(port->mstb);
3605− }
36063607 }
36073608
36083609 /**
@@ -4829,41 +4830,102 @@ static bool drm_dp_mst_port_downstream_of_branch(struct drm_dp_mst_port *port, · 1220 unmodified lines
48294830 return false;
48304831 }
48314832
4832−static inline
4833−int drm_dp_mst_atomic_check_bw_limit(struct drm_dp_mst_branch *branch,
4834− struct drm_dp_mst_topology_state *mst_state)
4833+static int
4834+drm_dp_mst_atomic_check_port_bw_limit(struct drm_dp_mst_port *port,
4835+ struct drm_dp_mst_topology_state *state);
4836+
4837+static int
4838+drm_dp_mst_atomic_check_mstb_bw_limit(struct drm_dp_mst_branch *mstb,
4839+ struct drm_dp_mst_topology_state *state)
48354840 {
4836− struct drm_dp_mst_port *port;
48374841 struct drm_dp_vcpi_allocation *vcpi;
4838− int pbn_limit = 0, pbn_used = 0;
4842+ struct drm_dp_mst_port *port;
4843+ int pbn_used = 0, ret;
4844+ bool found = false;
48394845
4840− list_for_each_entry(port, &branch->ports, next) {
4841− if (port->mstb)
4842− if (drm_dp_mst_atomic_check_bw_limit(port->mstb, mst_state))
4843− return -ENOSPC;
4846+ /* Check that we have at least one port in our state that's downstream
4847+ * of this branch, otherwise we can skip this branch
4848+ */
4849+ list_for_each_entry(vcpi, &state->vcpis, next) {
4850+ if (!vcpi->pbn ||
4851+ !drm_dp_mst_port_downstream_of_branch(vcpi->port, mstb))
4852+ continue;
48444853
4845− if (port->available_pbn > 0)
4846− pbn_limit = port->available_pbn;
4854+ found = true;
4855+ break;
48474856 }
4848− DRM_DEBUG_ATOMIC("[MST BRANCH:%p] branch has %d PBN available\n",
4849− branch, pbn_limit);
4857+ if (!found)
4858+ return 0;
48504859
4851− list_for_each_entry(vcpi, &mst_state->vcpis, next) {
4852− if (!vcpi->pbn)
4853− continue;
4860+ if (mstb->port_parent)
4861+ DRM_DEBUG_ATOMIC("[MSTB:%p] [MST PORT:%p] Checking bandwidth limits on [MSTB:%p]\n",
4862+ mstb->port_parent->parent, mstb->port_parent,
4863+ mstb);
4864+ else
4865+ DRM_DEBUG_ATOMIC("[MSTB:%p] Checking bandwidth limits\n",
4866+ mstb);
4867+
4868+ list_for_each_entry(port, &mstb->ports, next) {
4869+ ret = drm_dp_mst_atomic_check_port_bw_limit(port, state);
4870+ if (ret < 0)
4871+ return ret;
48544872
4855− if (drm_dp_mst_port_downstream_of_branch(vcpi->port, branch))
4856− pbn_used += vcpi->pbn;
4873+ pbn_used += ret;
48574874 }
4858− DRM_DEBUG_ATOMIC("[MST BRANCH:%p] branch used %d PBN\n",
4859− branch, pbn_used);
48604875
4861− if (pbn_used > pbn_limit) {
4862− DRM_DEBUG_ATOMIC("[MST BRANCH:%p] No available bandwidth\n",
4863− branch);
4876+ return pbn_used;
4877+}
4878+
4879+static int
4880+drm_dp_mst_atomic_check_port_bw_limit(struct drm_dp_mst_port *port,
4881+ struct drm_dp_mst_topology_state *state)
4882+{
4883+ struct drm_dp_vcpi_allocation *vcpi;
4884+ int pbn_used = 0;
4885+
4886+ if (port->pdt == DP_PEER_DEVICE_NONE)
4887+ return 0;
4888+
4889+ if (drm_dp_mst_is_end_device(port->pdt, port->mcs)) {
4890+ bool found = false;
4891+
4892+ list_for_each_entry(vcpi, &state->vcpis, next) {
4893+ if (vcpi->port != port)
4894+ continue;
4895+ if (!vcpi->pbn)
4896+ return 0;
4897+
4898+ found = true;
4899+ break;
4900+ }
4901+ if (!found)
4902+ return 0;
4903+
4904+ /* This should never happen, as it means we tried to
4905+ * set a mode before querying the full_pbn
4906+ */
4907+ if (WARN_ON(!port->full_pbn))
4908+ return -EINVAL;
4909+
4910+ pbn_used = vcpi->pbn;
4911+ } else {
4912+ pbn_used = drm_dp_mst_atomic_check_mstb_bw_limit(port->mstb,
4913+ state);
4914+ if (pbn_used <= 0)
4915+ return pbn_used;
4916+ }
4917+
4918+ if (pbn_used > port->full_pbn) {
4919+ DRM_DEBUG_ATOMIC("[MSTB:%p] [MST PORT:%p] required PBN of %d exceeds port limit of %d\n",
4920+ port->parent, port, pbn_used,
4921+ port->full_pbn);
48644922 return -ENOSPC;
48654923 }
4866− return 0;
4924+
4925+ DRM_DEBUG_ATOMIC("[MSTB:%p] [MST PORT:%p] uses %d out of %d PBN\n",
4926+ port->parent, port, pbn_used, port->full_pbn);
4927+
4928+ return pbn_used;
48674929 }
48684930
48694931 static inline int
@@ -5061,9 +5123,15 @@ int drm_dp_mst_atomic_check(struct drm_atomic_state *state) · 191 unmodified lines
50615123 ret = drm_dp_mst_atomic_check_vcpi_alloc_limit(mgr, mst_state);
50625124 if (ret)
50635125 break;
5064− ret = drm_dp_mst_atomic_check_bw_limit(mgr->mst_primary, mst_state);
5065− if (ret)
5126+
5127+ mutex_lock(&mgr->lock);
5128+ ret = drm_dp_mst_atomic_check_mstb_bw_limit(mgr->mst_primary,
5129+ mst_state);
5130+ mutex_unlock(&mgr->lock);
5131+ if (ret < 0)
50665132 break;
5133+ else
5134+ ret = 0;
50675135 }
50685136
50695137 return ret;
drivers/gpu/drm/drm_lease.c+2−1
@@ -542,10 +542,12 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev, · 541 unmodified lines
542542 }
543543
544544 DRM_DEBUG_LEASE("Creating lease\n");
545+ /* lessee will take the ownership of leases */
545546 lessee = drm_lease_create(lessor, &leases);
546547
547548 if (IS_ERR(lessee)) {
548549 ret = PTR_ERR(lessee);
550+ idr_destroy(&leases);
549551 goto out_leases;
550552 }
551553
@@ -580,7 +582,6 @@ out_lessee: · 28 unmodified lines
580582
581583 out_leases:
582584 put_unused_fd(fd);
583− idr_destroy(&leases);
584585
585586 DRM_DEBUG_LEASE("drm_mode_create_lease_ioctl failed: %d\n", ret);
586587 return ret;
drivers/gpu/drm/exynos/exynos5433_drm_decon.c+3−2
@@ -55,6 +55,7 @@ static const char * const decon_clks_name[] = { · 54 unmodified lines
5555 struct decon_context {
5656 struct device *dev;
5757 struct drm_device *drm_dev;
58+ void *dma_priv;
5859 struct exynos_drm_crtc *crtc;
5960 struct exynos_drm_plane planes[WINDOWS_NR];
6061 struct exynos_drm_plane_config configs[WINDOWS_NR];
@@ -644,7 +645,7 @@ static int decon_bind(struct device *dev, struct device *master, void *data) · 583 unmodified lines
644645
645646 decon_clear_channels(ctx->crtc);
646647
647− return exynos_drm_register_dma(drm_dev, dev);
648+ return exynos_drm_register_dma(drm_dev, dev, &ctx->dma_priv);
648649 }
649650
650651 static void decon_unbind(struct device *dev, struct device *master, void *data)
@@ -654,7 +655,7 @@ static void decon_unbind(struct device *dev, struct device *master, void *data) · 3 unmodified lines
654655 decon_atomic_disable(ctx->crtc);
655656
656657 /* detach this sub driver from iommu mapping if supported. */
657− exynos_drm_unregister_dma(ctx->drm_dev, ctx->dev);
658+ exynos_drm_unregister_dma(ctx->drm_dev, ctx->dev, &ctx->dma_priv);
658659 }
659660
660661 static const struct component_ops decon_component_ops = {
drivers/gpu/drm/exynos/exynos7_drm_decon.c+3−2
@@ -40,6 +40,7 @@ · 39 unmodified lines
4040 struct decon_context {
4141 struct device *dev;
4242 struct drm_device *drm_dev;
43+ void *dma_priv;
4344 struct exynos_drm_crtc *crtc;
4445 struct exynos_drm_plane planes[WINDOWS_NR];
4546 struct exynos_drm_plane_config configs[WINDOWS_NR];
@@ -127,13 +128,13 @@ static int decon_ctx_initialize(struct decon_context *ctx, · 81 unmodified lines
127128
128129 decon_clear_channels(ctx->crtc);
129130
130− return exynos_drm_register_dma(drm_dev, ctx->dev);
131+ return exynos_drm_register_dma(drm_dev, ctx->dev, &ctx->dma_priv);
131132 }
132133
133134 static void decon_ctx_remove(struct decon_context *ctx)
134135 {
135136 /* detach this sub driver from iommu mapping if supported. */
136− exynos_drm_unregister_dma(ctx->drm_dev, ctx->dev);
137+ exynos_drm_unregister_dma(ctx->drm_dev, ctx->dev, &ctx->dma_priv);
137138 }
138139
139140 static u32 decon_calc_clkdiv(struct decon_context *ctx,
drivers/gpu/drm/exynos/exynos_drm_dma.c+19−9
@@ -58,7 +58,7 @@ static inline void clear_dma_max_seg_size(struct device *dev) · 57 unmodified lines
5858 * mapping.
5959 */
6060 static int drm_iommu_attach_device(struct drm_device *drm_dev,
61− struct device *subdrv_dev)
61+ struct device *subdrv_dev, void **dma_priv)
6262 {
6363 struct exynos_drm_private *priv = drm_dev->dev_private;
6464 int ret;
@@ -74,7 +74,14 @@ static int drm_iommu_attach_device(struct drm_device *drm_dev, · 9 unmodified lines
7474 return ret;
7575
7676 if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)) {
77− if (to_dma_iommu_mapping(subdrv_dev))
77+ /*
78+ * Keep the original DMA mapping of the sub-device and
79+ * restore it on Exynos DRM detach, otherwise the DMA
80+ * framework considers it as IOMMU-less during the next
81+ * probe (in case of deferred probe or modular build)
82+ */
83+ *dma_priv = to_dma_iommu_mapping(subdrv_dev);
84+ if (*dma_priv)
7885 arm_iommu_detach_device(subdrv_dev);
7986
8087 ret = arm_iommu_attach_device(subdrv_dev, priv->mapping);
@@ -98,19 +105,21 @@ static int drm_iommu_attach_device(struct drm_device *drm_dev, · 17 unmodified lines
98105 * mapping
99106 */
100107 static void drm_iommu_detach_device(struct drm_device *drm_dev,
101− struct device *subdrv_dev)
108+ struct device *subdrv_dev, void **dma_priv)
102109 {
103110 struct exynos_drm_private *priv = drm_dev->dev_private;
104111
105− if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU))
112+ if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)) {
106113 arm_iommu_detach_device(subdrv_dev);
107− else if (IS_ENABLED(CONFIG_IOMMU_DMA))
114+ arm_iommu_attach_device(subdrv_dev, *dma_priv);
115+ } else if (IS_ENABLED(CONFIG_IOMMU_DMA))
108116 iommu_detach_device(priv->mapping, subdrv_dev);
109117
110118 clear_dma_max_seg_size(subdrv_dev);
111119 }
112120
113−int exynos_drm_register_dma(struct drm_device *drm, struct device *dev)
121+int exynos_drm_register_dma(struct drm_device *drm, struct device *dev,
122+ void **dma_priv)
114123 {
115124 struct exynos_drm_private *priv = drm->dev_private;
116125
@@ -137,13 +146,14 @@ int exynos_drm_register_dma(struct drm_device *drm, struct device *dev) · 20 unmodified lines
137146 priv->mapping = mapping;
138147 }
139148
140− return drm_iommu_attach_device(drm, dev);
149+ return drm_iommu_attach_device(drm, dev, dma_priv);
141150 }
142151
143−void exynos_drm_unregister_dma(struct drm_device *drm, struct device *dev)
152+void exynos_drm_unregister_dma(struct drm_device *drm, struct device *dev,
153+ void **dma_priv)
144154 {
145155 if (IS_ENABLED(CONFIG_EXYNOS_IOMMU))
146− drm_iommu_detach_device(drm, dev);
156+ drm_iommu_detach_device(drm, dev, dma_priv);
147157 }
148158
149159 void exynos_drm_cleanup_dma(struct drm_device *drm)
drivers/gpu/drm/exynos/exynos_drm_drv.h+4−2
@@ -223,8 +223,10 @@ static inline bool is_drm_iommu_supported(struct drm_device *drm_dev) · 222 unmodified lines
223223 return priv->mapping ? true : false;
224224 }
225225
226−int exynos_drm_register_dma(struct drm_device *drm, struct device *dev);
227−void exynos_drm_unregister_dma(struct drm_device *drm, struct device *dev);
226+int exynos_drm_register_dma(struct drm_device *drm, struct device *dev,
227+ void **dma_priv);
228+void exynos_drm_unregister_dma(struct drm_device *drm, struct device *dev,
229+ void **dma_priv);
228230 void exynos_drm_cleanup_dma(struct drm_device *drm);
229231
230232 #ifdef CONFIG_DRM_EXYNOS_DPI
drivers/gpu/drm/exynos/exynos_drm_fimc.c+3−2
@@ -97,6 +97,7 @@ struct fimc_scaler { · 96 unmodified lines
9797 struct fimc_context {
9898 struct exynos_drm_ipp ipp;
9999 struct drm_device *drm_dev;
100+ void *dma_priv;
100101 struct device *dev;
101102 struct exynos_drm_ipp_task *task;
102103 struct exynos_drm_ipp_formats *formats;
@@ -1133,7 +1134,7 @@ static int fimc_bind(struct device *dev, struct device *master, void *data) · 1030 unmodified lines
11331134
11341135 ctx->drm_dev = drm_dev;
11351136 ipp->drm_dev = drm_dev;
1136− exynos_drm_register_dma(drm_dev, dev);
1137+ exynos_drm_register_dma(drm_dev, dev, &ctx->dma_priv);
11371138
11381139 exynos_drm_ipp_register(dev, ipp, &ipp_funcs,
11391140 DRM_EXYNOS_IPP_CAP_CROP | DRM_EXYNOS_IPP_CAP_ROTATE |
@@ -1153,7 +1154,7 @@ static void fimc_unbind(struct device *dev, struct device *master, · 13 unmodified lines
11531154 struct exynos_drm_ipp *ipp = &ctx->ipp;
11541155
11551156 exynos_drm_ipp_unregister(dev, ipp);
1156− exynos_drm_unregister_dma(drm_dev, dev);
1157+ exynos_drm_unregister_dma(drm_dev, dev, &ctx->dma_priv);
11571158 }
11581159
11591160 static const struct component_ops fimc_component_ops = {
drivers/gpu/drm/exynos/exynos_drm_fimd.c+3−2
@@ -167,6 +167,7 @@ static struct fimd_driver_data exynos5420_fimd_driver_data = { · 166 unmodified lines
167167 struct fimd_context {
168168 struct device *dev;
169169 struct drm_device *drm_dev;
170+ void *dma_priv;
170171 struct exynos_drm_crtc *crtc;
171172 struct exynos_drm_plane planes[WINDOWS_NR];
172173 struct exynos_drm_plane_config configs[WINDOWS_NR];
@@ -1090,7 +1091,7 @@ static int fimd_bind(struct device *dev, struct device *master, void *data) · 917 unmodified lines
10901091 if (is_drm_iommu_supported(drm_dev))
10911092 fimd_clear_channels(ctx->crtc);
10921093
1093− return exynos_drm_register_dma(drm_dev, dev);
1094+ return exynos_drm_register_dma(drm_dev, dev, &ctx->dma_priv);
10941095 }
10951096
10961097 static void fimd_unbind(struct device *dev, struct device *master,
@@ -1100,7 +1101,7 @@ static void fimd_unbind(struct device *dev, struct device *master, · 3 unmodified lines
11001101
11011102 fimd_atomic_disable(ctx->crtc);
11021103
1103− exynos_drm_unregister_dma(ctx->drm_dev, ctx->dev);
1104+ exynos_drm_unregister_dma(ctx->drm_dev, ctx->dev, &ctx->dma_priv);
11041105
11051106 if (ctx->encoder)
11061107 exynos_dpi_remove(ctx->encoder);
drivers/gpu/drm/exynos/exynos_drm_g2d.c+3−2
@@ -232,6 +232,7 @@ struct g2d_runqueue_node { · 231 unmodified lines
232232
233233 struct g2d_data {
234234 struct device *dev;
235+ void *dma_priv;
235236 struct clk *gate_clk;
236237 void __iomem *regs;
237238 int irq;
@@ -1409,7 +1410,7 @@ static int g2d_bind(struct device *dev, struct device *master, void *data) · 1171 unmodified lines
14091410 return ret;
14101411 }
14111412
1412− ret = exynos_drm_register_dma(drm_dev, dev);
1413+ ret = exynos_drm_register_dma(drm_dev, dev, &g2d->dma_priv);
14131414 if (ret < 0) {
14141415 dev_err(dev, "failed to enable iommu.\n");
14151416 g2d_fini_cmdlist(g2d);
@@ -1434,7 +1435,7 @@ static void g2d_unbind(struct device *dev, struct device *master, void *data) · 18 unmodified lines
14341435 priv->g2d_dev = NULL;
14351436
14361437 cancel_work_sync(&g2d->runqueue_work);
1437− exynos_drm_unregister_dma(g2d->drm_dev, dev);
1438+ exynos_drm_unregister_dma(g2d->drm_dev, dev, &g2d->dma_priv);
14381439 }
14391440
14401441 static const struct component_ops g2d_component_ops = {
drivers/gpu/drm/exynos/exynos_drm_gsc.c+3−2
@@ -97,6 +97,7 @@ struct gsc_scaler { · 96 unmodified lines
9797 struct gsc_context {
9898 struct exynos_drm_ipp ipp;
9999 struct drm_device *drm_dev;
100+ void *dma_priv;
100101 struct device *dev;
101102 struct exynos_drm_ipp_task *task;
102103 struct exynos_drm_ipp_formats *formats;
@@ -1169,7 +1170,7 @@ static int gsc_bind(struct device *dev, struct device *master, void *data) · 1066 unmodified lines
11691170
11701171 ctx->drm_dev = drm_dev;
11711172 ctx->drm_dev = drm_dev;
1172− exynos_drm_register_dma(drm_dev, dev);
1173+ exynos_drm_register_dma(drm_dev, dev, &ctx->dma_priv);
11731174
11741175 exynos_drm_ipp_register(dev, ipp, &ipp_funcs,
11751176 DRM_EXYNOS_IPP_CAP_CROP | DRM_EXYNOS_IPP_CAP_ROTATE |
@@ -1189,7 +1190,7 @@ static void gsc_unbind(struct device *dev, struct device *master, · 13 unmodified lines
11891190 struct exynos_drm_ipp *ipp = &ctx->ipp;
11901191
11911192 exynos_drm_ipp_unregister(dev, ipp);
1192− exynos_drm_unregister_dma(drm_dev, dev);
1193+ exynos_drm_unregister_dma(drm_dev, dev, &ctx->dma_priv);
11931194 }
11941195
11951196 static const struct component_ops gsc_component_ops = {
drivers/gpu/drm/exynos/exynos_drm_rotator.c+3−2
@@ -56,6 +56,7 @@ struct rot_variant { · 55 unmodified lines
5656 struct rot_context {
5757 struct exynos_drm_ipp ipp;
5858 struct drm_device *drm_dev;
59+ void *dma_priv;
5960 struct device *dev;
6061 void __iomem *regs;
6162 struct clk *clock;
@@ -243,7 +244,7 @@ static int rotator_bind(struct device *dev, struct device *master, void *data) · 181 unmodified lines
243244
244245 rot->drm_dev = drm_dev;
245246 ipp->drm_dev = drm_dev;
246− exynos_drm_register_dma(drm_dev, dev);
247+ exynos_drm_register_dma(drm_dev, dev, &rot->dma_priv);
247248
248249 exynos_drm_ipp_register(dev, ipp, &ipp_funcs,
249250 DRM_EXYNOS_IPP_CAP_CROP | DRM_EXYNOS_IPP_CAP_ROTATE,
@@ -261,7 +262,7 @@ static void rotator_unbind(struct device *dev, struct device *master, · 11 unmodified lines
261262 struct exynos_drm_ipp *ipp = &rot->ipp;
262263
263264 exynos_drm_ipp_unregister(dev, ipp);
264− exynos_drm_unregister_dma(rot->drm_dev, rot->dev);
265+ exynos_drm_unregister_dma(rot->drm_dev, rot->dev, &rot->dma_priv);
265266 }
266267
267268 static const struct component_ops rotator_component_ops = {
drivers/gpu/drm/exynos/exynos_drm_scaler.c+4−2
@@ -39,6 +39,7 @@ struct scaler_data { · 38 unmodified lines
3939 struct scaler_context {
4040 struct exynos_drm_ipp ipp;
4141 struct drm_device *drm_dev;
42+ void *dma_priv;
4243 struct device *dev;
4344 void __iomem *regs;
4445 struct clk *clock[SCALER_MAX_CLK];
@@ -450,7 +451,7 @@ static int scaler_bind(struct device *dev, struct device *master, void *data) · 405 unmodified lines
450451
451452 scaler->drm_dev = drm_dev;
452453 ipp->drm_dev = drm_dev;
453− exynos_drm_register_dma(drm_dev, dev);
454+ exynos_drm_register_dma(drm_dev, dev, &scaler->dma_priv);
454455
455456 exynos_drm_ipp_register(dev, ipp, &ipp_funcs,
456457 DRM_EXYNOS_IPP_CAP_CROP | DRM_EXYNOS_IPP_CAP_ROTATE |
@@ -470,7 +471,8 @@ static void scaler_unbind(struct device *dev, struct device *master, · 13 unmodified lines
470471 struct exynos_drm_ipp *ipp = &scaler->ipp;
471472
472473 exynos_drm_ipp_unregister(dev, ipp);
473− exynos_drm_unregister_dma(scaler->drm_dev, scaler->dev);
474+ exynos_drm_unregister_dma(scaler->drm_dev, scaler->dev,
475+ &scaler->dma_priv);
474476 }
475477
476478 static const struct component_ops scaler_component_ops = {
drivers/gpu/drm/exynos/exynos_mixer.c+5−2
@@ -94,6 +94,7 @@ struct mixer_context { · 93 unmodified lines
9494 struct platform_device *pdev;
9595 struct device *dev;
9696 struct drm_device *drm_dev;
97+ void *dma_priv;
9798 struct exynos_drm_crtc *crtc;
9899 struct exynos_drm_plane planes[MIXER_WIN_NR];
99100 unsigned long flags;
@@ -894,12 +895,14 @@ static int mixer_initialize(struct mixer_context *mixer_ctx, · 794 unmodified lines
894895 }
895896 }
896897
897− return exynos_drm_register_dma(drm_dev, mixer_ctx->dev);
898+ return exynos_drm_register_dma(drm_dev, mixer_ctx->dev,
899+ &mixer_ctx->dma_priv);
898900 }
899901
900902 static void mixer_ctx_remove(struct mixer_context *mixer_ctx)
901903 {
902− exynos_drm_unregister_dma(mixer_ctx->drm_dev, mixer_ctx->dev);
904+ exynos_drm_unregister_dma(mixer_ctx->drm_dev, mixer_ctx->dev,
905+ &mixer_ctx->dma_priv);
903906 }
904907
905908 static int mixer_enable_vblank(struct exynos_drm_crtc *crtc)
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c+2−1
@@ -423,7 +423,8 @@ eb_validate_vma(struct i915_execbuffer *eb, · 422 unmodified lines
423423 if (unlikely(entry->flags & eb->invalid_flags))
424424 return -EINVAL;
425425
426− if (unlikely(entry->alignment && !is_power_of_2(entry->alignment)))
426+ if (unlikely(entry->alignment &&
427+ !is_power_of_2_u64(entry->alignment)))
427428 return -EINVAL;
428429
429430 /*
drivers/gpu/drm/i915/gt/intel_lrc.c+30−51
@@ -1600,17 +1600,6 @@ static void virtual_xfer_breadcrumbs(struct virtual_engine *ve, · 1599 unmodified lines
16001600 spin_unlock(&old->breadcrumbs.irq_lock);
16011601 }
16021602
1603−static struct i915_request *
1604−last_active(const struct intel_engine_execlists *execlists)
1605−{
1606− struct i915_request * const *last = READ_ONCE(execlists->active);
1607−
1608− while (*last && i915_request_completed(*last))
1609− last++;
1610−
1611− return *last;
1612−}
1613−
16141603 #define for_each_waiter(p__, rq__) \
16151604 list_for_each_entry_lockless(p__, \
16161605 &(rq__)->sched.waiters_list, \
@@ -1679,11 +1668,9 @@ need_timeslice(struct intel_engine_cs *engine, const struct i915_request *rq) · 62 unmodified lines
16791668 if (!intel_engine_has_timeslices(engine))
16801669 return false;
16811670
1682− if (list_is_last(&rq->sched.link, &engine->active.requests))
1683− return false;
1684−
1685− hint = max(rq_prio(list_next_entry(rq, sched.link)),
1686− engine->execlists.queue_priority_hint);
1671+ hint = engine->execlists.queue_priority_hint;
1672+ if (!list_is_last(&rq->sched.link, &engine->active.requests))
1673+ hint = max(hint, rq_prio(list_next_entry(rq, sched.link)));
16871674
16881675 return hint >= effective_prio(rq);
16891676 }
@@ -1725,16 +1712,26 @@ static void set_timeslice(struct intel_engine_cs *engine) · 35 unmodified lines
17251712 set_timer_ms(&engine->execlists.timer, active_timeslice(engine));
17261713 }
17271714
1715+static void start_timeslice(struct intel_engine_cs *engine)
1716+{
1717+ struct intel_engine_execlists *execlists = &engine->execlists;
1718+
1719+ execlists->switch_priority_hint = execlists->queue_priority_hint;
1720+
1721+ if (timer_pending(&execlists->timer))
1722+ return;
1723+
1724+ set_timer_ms(&execlists->timer, timeslice(engine));
1725+}
1726+
17281727 static void record_preemption(struct intel_engine_execlists *execlists)
17291728 {
17301729 (void)I915_SELFTEST_ONLY(execlists->preempt_hang.count++);
17311730 }
17321731
1733−static unsigned long active_preempt_timeout(struct intel_engine_cs *engine)
1732+static unsigned long active_preempt_timeout(struct intel_engine_cs *engine,
1733+ const struct i915_request *rq)
17341734 {
1735− struct i915_request *rq;
1736−
1737− rq = last_active(&engine->execlists);
17381735 if (!rq)
17391736 return 0;
17401737
@@ -1745,13 +1742,14 @@ static unsigned long active_preempt_timeout(struct intel_engine_cs *engine) · 4 unmodified lines
17451742 return READ_ONCE(engine->props.preempt_timeout_ms);
17461743 }
17471744
1748−static void set_preempt_timeout(struct intel_engine_cs *engine)
1745+static void set_preempt_timeout(struct intel_engine_cs *engine,
1746+ const struct i915_request *rq)
17491747 {
17501748 if (!intel_engine_has_preempt_reset(engine))
17511749 return;
17521750
17531751 set_timer_ms(&engine->execlists.preempt,
1754− active_preempt_timeout(engine));
1752+ active_preempt_timeout(engine, rq));
17551753 }
17561754
17571755 static inline void clear_ports(struct i915_request **ports, int count)
@@ -1764,6 +1762,7 @@ static void execlists_dequeue(struct intel_engine_cs *engine) · 6 unmodified lines
17641762 struct intel_engine_execlists * const execlists = &engine->execlists;
17651763 struct i915_request **port = execlists->pending;
17661764 struct i915_request ** const last_port = port + execlists->port_mask;
1765+ struct i915_request * const *active;
17671766 struct i915_request *last;
17681767 struct rb_node *rb;
17691768 bool submit = false;
@@ -1818,7 +1817,10 @@ static void execlists_dequeue(struct intel_engine_cs *engine) · 48 unmodified lines
18181817 * i.e. we will retrigger preemption following the ack in case
18191818 * of trouble.
18201819 */
1821− last = last_active(execlists);
1820+ active = READ_ONCE(execlists->active);
1821+ while ((last = *active) && i915_request_completed(last))
1822+ active++;
1823+
18221824 if (last) {
18231825 if (need_preempt(engine, last, rb)) {
18241826 ENGINE_TRACE(engine,
@@ -1888,11 +1890,7 @@ static void execlists_dequeue(struct intel_engine_cs *engine) · 63 unmodified lines
18881890 * Even if ELSP[1] is occupied and not worthy
18891891 * of timeslices, our queue might be.
18901892 */
1891− if (!execlists->timer.expires &&
1892− need_timeslice(engine, last))
1893− set_timer_ms(&execlists->timer,
1894− timeslice(engine));
1895−
1893+ start_timeslice(engine);
18961894 return;
18971895 }
18981896 }
@@ -1927,7 +1925,8 @@ static void execlists_dequeue(struct intel_engine_cs *engine) · 28 unmodified lines
19271925
19281926 if (last && !can_merge_rq(last, rq)) {
19291927 spin_unlock(&ve->base.active.lock);
1930− return; /* leave this for another */
1928+ start_timeslice(engine);
1929+ return; /* leave this for another sibling */
19311930 }
19321931
19331932 ENGINE_TRACE(engine,
@@ -2103,7 +2102,7 @@ done: · 169 unmodified lines
21032102 * Skip if we ended up with exactly the same set of requests,
21042103 * e.g. trying to timeslice a pair of ordered contexts
21052104 */
2106− if (!memcmp(execlists->active, execlists->pending,
2105+ if (!memcmp(active, execlists->pending,
21072106 (port - execlists->pending + 1) * sizeof(*port))) {
21082107 do
21092108 execlists_schedule_out(fetch_and_zero(port));
@@ -2114,7 +2113,7 @@ done: · 4 unmodified lines
21142113 clear_ports(port + 1, last_port - port);
21152114
21162115 execlists_submit_ports(engine);
2117− set_preempt_timeout(engine);
2116+ set_preempt_timeout(engine, *active);
21182117 } else {
21192118 skip_submit:
21202119 ring_set_paused(engine, 0);
@@ -4001,26 +4000,6 @@ static int gen12_emit_flush_render(struct i915_request *request, · 1880 unmodified lines
40014000
40024001 *cs++ = preparser_disable(false);
40034002 intel_ring_advance(request, cs);
4004−
4005− /*
4006− * Wa_1604544889:tgl
4007− */
4008− if (IS_TGL_REVID(request->i915, TGL_REVID_A0, TGL_REVID_A0)) {
4009− flags = 0;
4010− flags |= PIPE_CONTROL_CS_STALL;
4011− flags |= PIPE_CONTROL_HDC_PIPELINE_FLUSH;
4012−
4013− flags |= PIPE_CONTROL_STORE_DATA_INDEX;
4014− flags |= PIPE_CONTROL_QW_WRITE;
4015−
4016− cs = intel_ring_begin(request, 6);
4017− if (IS_ERR(cs))
4018− return PTR_ERR(cs);
4019−
4020− cs = gen8_emit_pipe_control(cs, flags,
4021− LRC_PPHWSP_SCRATCH_ADDR);
4022− intel_ring_advance(request, cs);
4023− }
40244003 }
40254004
40264005 return 0;
drivers/gpu/drm/i915/gt/intel_timeline.c+6−2
@@ -192,11 +192,15 @@ static void cacheline_release(struct intel_timeline_cacheline *cl) · 191 unmodified lines
192192
193193 static void cacheline_free(struct intel_timeline_cacheline *cl)
194194 {
195+ if (!i915_active_acquire_if_busy(&cl->active)) {
196+ __idle_cacheline_free(cl);
197+ return;
198+ }
199+
195200 GEM_BUG_ON(ptr_test_bit(cl->vaddr, CACHELINE_FREE));
196201 cl->vaddr = ptr_set_bit(cl->vaddr, CACHELINE_FREE);
197202
198− if (i915_active_is_idle(&cl->active))
199− __idle_cacheline_free(cl);
203+ i915_active_release(&cl->active);
200204 }
201205
202206 int intel_timeline_init(struct intel_timeline *timeline,
drivers/gpu/drm/i915/gt/intel_workarounds.c+22−3
@@ -1529,15 +1529,34 @@ err_obj: · 1528 unmodified lines
15291529 return ERR_PTR(err);
15301530 }
15311531
1532+static const struct {
1533+ u32 start;
1534+ u32 end;
1535+} mcr_ranges_gen8[] = {
1536+ { .start = 0x5500, .end = 0x55ff },
1537+ { .start = 0x7000, .end = 0x7fff },
1538+ { .start = 0x9400, .end = 0x97ff },
1539+ { .start = 0xb000, .end = 0xb3ff },
1540+ { .start = 0xe000, .end = 0xe7ff },
1541+ {},
1542+};
1543+
15321544 static bool mcr_range(struct drm_i915_private *i915, u32 offset)
15331545 {
1546+ int i;
1547+
1548+ if (INTEL_GEN(i915) < 8)
1549+ return false;
1550+
15341551 /*
1535− * Registers in this range are affected by the MCR selector
1552+ * Registers in these ranges are affected by the MCR selector
15361553 * which only controls CPU initiated MMIO. Routing does not
15371554 * work for CS access so we cannot verify them on this path.
15381555 */
1539− if (INTEL_GEN(i915) >= 8 && (offset >= 0xb000 && offset <= 0xb4ff))
1540− return true;
1556+ for (i = 0; mcr_ranges_gen8[i].start; i++)
1557+ if (offset >= mcr_ranges_gen8[i].start &&
1558+ offset <= mcr_ranges_gen8[i].end)
1559+ return true;
15411560
15421561 return false;
15431562 }
drivers/gpu/drm/i915/gvt/display.c+2−1
@@ -457,7 +457,8 @@ void intel_vgpu_emulate_hotplug(struct intel_vgpu *vgpu, bool connected) · 456 unmodified lines
457457 struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv;
458458
459459 /* TODO: add more platforms support */
460− if (IS_SKYLAKE(dev_priv) || IS_KABYLAKE(dev_priv)) {
460+ if (IS_SKYLAKE(dev_priv) || IS_KABYLAKE(dev_priv) ||
461+ IS_COFFEELAKE(dev_priv)) {
461462 if (connected) {
462463 vgpu_vreg_t(vgpu, SFUSE_STRAP) |=
463464 SFUSE_STRAP_DDID_DETECTED;
drivers/gpu/drm/i915/gvt/opregion.c+2−3
@@ -147,15 +147,14 @@ static void virt_vbt_generation(struct vbt *v) · 146 unmodified lines
147147 /* there's features depending on version! */
148148 v->header.version = 155;
149149 v->header.header_size = sizeof(v->header);
150− v->header.vbt_size = sizeof(struct vbt) - sizeof(v->header);
150+ v->header.vbt_size = sizeof(struct vbt);
151151 v->header.bdb_offset = offsetof(struct vbt, bdb_header);
152152
153153 strcpy(&v->bdb_header.signature[0], "BIOS_DATA_BLOCK");
154154 v->bdb_header.version = 186; /* child_dev_size = 33 */
155155 v->bdb_header.header_size = sizeof(v->bdb_header);
156156
157− v->bdb_header.bdb_size = sizeof(struct vbt) - sizeof(struct vbt_header)
158− - sizeof(struct bdb_header);
157+ v->bdb_header.bdb_size = sizeof(struct vbt) - sizeof(struct vbt_header);
159158
160159 /* general features */
161160 v->general_features_header.id = BDB_GENERAL_FEATURES;
drivers/gpu/drm/i915/gvt/vgpu.c+9−3
@@ -272,10 +272,17 @@ void intel_gvt_destroy_vgpu(struct intel_vgpu *vgpu) · 271 unmodified lines
272272 {
273273 struct intel_gvt *gvt = vgpu->gvt;
274274
275− mutex_lock(&vgpu->vgpu_lock);
276−
277275 WARN(vgpu->active, "vGPU is still active!\n");
278276
277+ /*
278+ * remove idr first so later clean can judge if need to stop
279+ * service if no active vgpu.
280+ */
281+ mutex_lock(&gvt->lock);
282+ idr_remove(&gvt->vgpu_idr, vgpu->id);
283+ mutex_unlock(&gvt->lock);
284+
285+ mutex_lock(&vgpu->vgpu_lock);
279286 intel_gvt_debugfs_remove_vgpu(vgpu);
280287 intel_vgpu_clean_sched_policy(vgpu);
281288 intel_vgpu_clean_submission(vgpu);
@@ -290,7 +297,6 @@ void intel_gvt_destroy_vgpu(struct intel_vgpu *vgpu) · 8 unmodified lines
290297 mutex_unlock(&vgpu->vgpu_lock);
291298
292299 mutex_lock(&gvt->lock);
293− idr_remove(&gvt->vgpu_idr, vgpu->id);
294300 if (idr_is_empty(&gvt->vgpu_idr))
295301 intel_gvt_clean_irq(gvt);
296302 intel_gvt_update_vgpu_types(gvt);
drivers/gpu/drm/i915/i915_request.c+20−8
@@ -527,19 +527,31 @@ submit_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state) · 526 unmodified lines
527527 return NOTIFY_DONE;
528528 }
529529
530+static void irq_semaphore_cb(struct irq_work *wrk)
531+{
532+ struct i915_request *rq =
533+ container_of(wrk, typeof(*rq), semaphore_work);
534+
535+ i915_schedule_bump_priority(rq, I915_PRIORITY_NOSEMAPHORE);
536+ i915_request_put(rq);
537+}
538+
530539 static int __i915_sw_fence_call
531540 semaphore_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state)
532541 {
533− struct i915_request *request =
534− container_of(fence, typeof(*request), semaphore);
542+ struct i915_request *rq = container_of(fence, typeof(*rq), semaphore);
535543
536544 switch (state) {
537545 case FENCE_COMPLETE:
538− i915_schedule_bump_priority(request, I915_PRIORITY_NOSEMAPHORE);
546+ if (!(READ_ONCE(rq->sched.attr.priority) & I915_PRIORITY_NOSEMAPHORE)) {
547+ i915_request_get(rq);
548+ init_irq_work(&rq->semaphore_work, irq_semaphore_cb);
549+ irq_work_queue(&rq->semaphore_work);
550+ }
539551 break;
540552
541553 case FENCE_FREE:
542− i915_request_put(request);
554+ i915_request_put(rq);
543555 break;
544556 }
545557
@@ -776,8 +788,8 @@ i915_request_await_start(struct i915_request *rq, struct i915_request *signal) · 230 unmodified lines
776788 struct dma_fence *fence;
777789 int err;
778790
779− GEM_BUG_ON(i915_request_timeline(rq) ==
780− rcu_access_pointer(signal->timeline));
791+ if (i915_request_timeline(rq) == rcu_access_pointer(signal->timeline))
792+ return 0;
781793
782794 if (i915_request_started(signal))
783795 return 0;
@@ -821,7 +833,7 @@ i915_request_await_start(struct i915_request *rq, struct i915_request *signal) · 37 unmodified lines
821833 return 0;
822834
823835 err = 0;
824− if (intel_timeline_sync_is_later(i915_request_timeline(rq), fence))
836+ if (!intel_timeline_sync_is_later(i915_request_timeline(rq), fence))
825837 err = i915_sw_fence_await_dma_fence(&rq->submit,
826838 fence, 0,
827839 I915_FENCE_GFP);
@@ -1318,9 +1330,9 @@ void __i915_request_queue(struct i915_request *rq, · 490 unmodified lines
13181330 * decide whether to preempt the entire chain so that it is ready to
13191331 * run at the earliest possible convenience.
13201332 */
1321− i915_sw_fence_commit(&rq->semaphore);
13221333 if (attr && rq->engine->schedule)
13231334 rq->engine->schedule(rq, attr);
1335+ i915_sw_fence_commit(&rq->semaphore);
13241336 i915_sw_fence_commit(&rq->submit);
13251337 }
13261338
drivers/gpu/drm/i915/i915_request.h+2−0
@@ -26,6 +26,7 @@ · 25 unmodified lines
2626 #define I915_REQUEST_H
2727
2828 #include <linux/dma-fence.h>
29+#include <linux/irq_work.h>
2930 #include <linux/lockdep.h>
3031
3132 #include "gem/i915_gem_context_types.h"
@@ -208,6 +209,7 @@ struct i915_request { · 176 unmodified lines
208209 };
209210 struct list_head execute_cb;
210211 struct i915_sw_fence semaphore;
212+ struct irq_work semaphore_work;
211213
212214 /*
213215 * A list of everyone we wait upon, and everyone who waits upon us.
drivers/gpu/drm/i915/i915_utils.h+5−0
@@ -234,6 +234,11 @@ static inline u64 ptr_to_u64(const void *ptr) · 233 unmodified lines
234234 __idx; \
235235 })
236236
237+static inline bool is_power_of_2_u64(u64 n)
238+{
239+ return (n != 0 && ((n & (n - 1)) == 0));
240+}
241+
237242 static inline void __list_del_many(struct list_head *head,
238243 struct list_head *first)
239244 {
drivers/hid/hid-google-hammer.c+2−0
@@ -532,6 +532,8 @@ static const struct hid_device_id hammer_devices[] = { · 531 unmodified lines
532532 USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_MAGNEMITE) },
533533 { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
534534 USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_MASTERBALL) },
535+ { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
536+ USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_MOONBALL) },
535537 { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
536538 USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_STAFF) },
537539 { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
drivers/hid/hid-ids.h+2−0
@@ -478,6 +478,7 @@ · 477 unmodified lines
478478 #define USB_DEVICE_ID_GOOGLE_WHISKERS 0x5030
479479 #define USB_DEVICE_ID_GOOGLE_MASTERBALL 0x503c
480480 #define USB_DEVICE_ID_GOOGLE_MAGNEMITE 0x503d
481+#define USB_DEVICE_ID_GOOGLE_MOONBALL 0x5044
481482
482483 #define USB_VENDOR_ID_GOTOP 0x08f2
483484 #define USB_DEVICE_ID_SUPER_Q2 0x007f
@@ -726,6 +727,7 @@ · 242 unmodified lines
726727 #define USB_DEVICE_ID_LENOVO_X1_COVER 0x6085
727728 #define USB_DEVICE_ID_LENOVO_X1_TAB 0x60a3
728729 #define USB_DEVICE_ID_LENOVO_X1_TAB3 0x60b5
730+#define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_608D 0x608d
729731
730732 #define USB_VENDOR_ID_LG 0x1fd2
731733 #define USB_DEVICE_ID_LG_MULTITOUCH 0x0064
drivers/hid/hid-picolcd_fb.c+2−2
@@ -458,9 +458,9 @@ static ssize_t picolcd_fb_update_rate_show(struct device *dev, · 457 unmodified lines
458458 if (ret >= PAGE_SIZE)
459459 break;
460460 else if (i == fb_update_rate)
461− ret += snprintf(buf+ret, PAGE_SIZE-ret, "[%u] ", i);
461+ ret += scnprintf(buf+ret, PAGE_SIZE-ret, "[%u] ", i);
462462 else
463− ret += snprintf(buf+ret, PAGE_SIZE-ret, "%u ", i);
463+ ret += scnprintf(buf+ret, PAGE_SIZE-ret, "%u ", i);
464464 if (ret > 0)
465465 buf[min(ret, (size_t)PAGE_SIZE)-1] = '\n';
466466 return ret;
drivers/hid/hid-quirks.c+1−0
@@ -103,6 +103,7 @@ static const struct hid_device_id hid_quirks[] = { · 102 unmodified lines
103103 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_PENSKETCH_M912), HID_QUIRK_MULTI_INPUT },
104104 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M406XE), HID_QUIRK_MULTI_INPUT },
105105 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_PIXART_USB_OPTICAL_MOUSE_ID2), HID_QUIRK_ALWAYS_POLL },
106+ { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_608D), HID_QUIRK_ALWAYS_POLL },
106107 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_C007), HID_QUIRK_ALWAYS_POLL },
107108 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_C077), HID_QUIRK_ALWAYS_POLL },
108109 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KEYBOARD_G710_PLUS), HID_QUIRK_NOGET },
drivers/hid/hid-sensor-custom.c+3−3
@@ -313,7 +313,7 @@ static ssize_t show_value(struct device *dev, struct device_attribute *attr, · 312 unmodified lines
313313
314314 while (i < ret) {
315315 if (i + attribute->size > ret) {
316− len += snprintf(&buf[len],
316+ len += scnprintf(&buf[len],
317317 PAGE_SIZE - len,
318318 "%d ", values[i]);
319319 break;
@@ -336,10 +336,10 @@ static ssize_t show_value(struct device *dev, struct device_attribute *attr, · 16 unmodified lines
336336 ++i;
337337 break;
338338 }
339− len += snprintf(&buf[len], PAGE_SIZE - len,
339+ len += scnprintf(&buf[len], PAGE_SIZE - len,
340340 "%lld ", value);
341341 }
342− len += snprintf(&buf[len], PAGE_SIZE - len, "\n");
342+ len += scnprintf(&buf[len], PAGE_SIZE - len, "\n");
343343
344344 return len;
345345 } else if (input)
drivers/hwtracing/intel_th/msu.c+7−6
@@ -719,9 +719,6 @@ static int msc_win_set_lockout(struct msc_window *win, · 718 unmodified lines
719719
720720 if (old != expect) {
721721 ret = -EINVAL;
722− dev_warn_ratelimited(msc_dev(win->msc),
723− "expected lockout state %d, got %d\n",
724− expect, old);
725722 goto unlock;
726723 }
727724
@@ -742,6 +739,10 @@ unlock: · 14 unmodified lines
742739 /* from intel_th_msc_window_unlock(), don't warn if not locked */
743740 if (expect == WIN_LOCKED && old == new)
744741 return 0;
742+
743+ dev_warn_ratelimited(msc_dev(win->msc),
744+ "expected lockout state %d, got %d\n",
745+ expect, old);
745746 }
746747
747748 return ret;
@@ -761,7 +762,7 @@ static int msc_configure(struct msc *msc) · 13 unmodified lines
761762 lockdep_assert_held(&msc->buf_mutex);
762763
763764 if (msc->mode > MSC_MODE_MULTI)
764− return -ENOTSUPP;
765+ return -EINVAL;
765766
766767 if (msc->mode == MSC_MODE_MULTI) {
767768 if (msc_win_set_lockout(msc->cur_win, WIN_READY, WIN_INUSE))
@@ -1295,7 +1296,7 @@ static int msc_buffer_alloc(struct msc *msc, unsigned long *nr_pages, · 527 unmodified lines
12951296 } else if (msc->mode == MSC_MODE_MULTI) {
12961297 ret = msc_buffer_multi_alloc(msc, nr_pages, nr_wins);
12971298 } else {
1298− ret = -ENOTSUPP;
1299+ ret = -EINVAL;
12991300 }
13001301
13011302 if (!ret) {
@@ -1531,7 +1532,7 @@ static ssize_t intel_th_msc_read(struct file *file, char __user *buf, · 229 unmodified lines
15311532 if (ret >= 0)
15321533 *ppos = iter->offset;
15331534 } else {
1534− ret = -ENOTSUPP;
1535+ ret = -EINVAL;
15351536 }
15361537
15371538 put_count:
drivers/hwtracing/intel_th/pci.c+5−0
@@ -238,6 +238,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = { · 237 unmodified lines
238238 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4da6),
239239 .driver_data = (kernel_ulong_t)&intel_th_2x,
240240 },
241+ {
242+ /* Elkhart Lake CPU */
243+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4529),
244+ .driver_data = (kernel_ulong_t)&intel_th_2x,
245+ },
241246 {
242247 /* Elkhart Lake */
243248 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4b26),
drivers/hwtracing/stm/p_sys-t.c+3−3
@@ -238,7 +238,7 @@ static struct configfs_attribute *sys_t_policy_attrs[] = { · 237 unmodified lines
238238 static inline bool sys_t_need_ts(struct sys_t_output *op)
239239 {
240240 if (op->node.ts_interval &&
241− time_after(op->ts_jiffies + op->node.ts_interval, jiffies)) {
241+ time_after(jiffies, op->ts_jiffies + op->node.ts_interval)) {
242242 op->ts_jiffies = jiffies;
243243
244244 return true;
@@ -250,8 +250,8 @@ static inline bool sys_t_need_ts(struct sys_t_output *op) · 5 unmodified lines
250250 static bool sys_t_need_clock_sync(struct sys_t_output *op)
251251 {
252252 if (op->node.clocksync_interval &&
253− time_after(op->clocksync_jiffies + op->node.clocksync_interval,
254− jiffies)) {
253+ time_after(jiffies,
254+ op->clocksync_jiffies + op->node.clocksync_interval)) {
255255 op->clocksync_jiffies = jiffies;
256256
257257 return true;
drivers/i2c/busses/i2c-designware-pcidrv.c+1−0
@@ -313,6 +313,7 @@ static void i2c_dw_pci_remove(struct pci_dev *pdev) · 312 unmodified lines
313313 pm_runtime_get_noresume(&pdev->dev);
314314
315315 i2c_del_adapter(&dev->adapter);
316+ devm_free_irq(&pdev->dev, dev->irq, dev);
316317 pci_free_irq_vectors(pdev);
317318 }
318319
drivers/i2c/busses/i2c-gpio.c+1−1
@@ -348,7 +348,7 @@ static struct gpio_desc *i2c_gpio_get_desc(struct device *dev, · 347 unmodified lines
348348 if (ret == -ENOENT)
349349 retdesc = ERR_PTR(-EPROBE_DEFER);
350350
351− if (ret != -EPROBE_DEFER)
351+ if (PTR_ERR(retdesc) != -EPROBE_DEFER)
352352 dev_err(dev, "error trying to get descriptor: %d\n", ret);
353353
354354 return retdesc;
drivers/i2c/busses/i2c-i801.c+12−33
@@ -132,11 +132,6 @@ · 131 unmodified lines
132132 #define TCOBASE 0x050
133133 #define TCOCTL 0x054
134134
135−#define ACPIBASE 0x040
136−#define ACPIBASE_SMI_OFF 0x030
137−#define ACPICTRL 0x044
138−#define ACPICTRL_EN 0x080
139−
140135 #define SBREG_BAR 0x10
141136 #define SBREG_SMBCTRL 0xc6000c
142137 #define SBREG_SMBCTRL_DNV 0xcf000c
@@ -1553,7 +1548,7 @@ i801_add_tco_spt(struct i801_priv *priv, struct pci_dev *pci_dev, · 1410 unmodified lines
15531548 pci_bus_write_config_byte(pci_dev->bus, devfn, 0xe1, hidden);
15541549 spin_unlock(&p2sb_spinlock);
15551550
1556− res = &tco_res[ICH_RES_MEM_OFF];
1551+ res = &tco_res[1];
15571552 if (pci_dev->device == PCI_DEVICE_ID_INTEL_DNV_SMBUS)
15581553 res->start = (resource_size_t)base64_addr + SBREG_SMBCTRL_DNV;
15591554 else
@@ -1563,7 +1558,7 @@ i801_add_tco_spt(struct i801_priv *priv, struct pci_dev *pci_dev, · 3 unmodified lines
15631558 res->flags = IORESOURCE_MEM;
15641559
15651560 return platform_device_register_resndata(&pci_dev->dev, "iTCO_wdt", -1,
1566− tco_res, 3, &spt_tco_platform_data,
1561+ tco_res, 2, &spt_tco_platform_data,
15671562 sizeof(spt_tco_platform_data));
15681563 }
15691564
@@ -1576,17 +1571,16 @@ static struct platform_device * · 6 unmodified lines
15761571 i801_add_tco_cnl(struct i801_priv *priv, struct pci_dev *pci_dev,
15771572 struct resource *tco_res)
15781573 {
1579− return platform_device_register_resndata(&pci_dev->dev, "iTCO_wdt", -1,
1580− tco_res, 2, &cnl_tco_platform_data,
1581− sizeof(cnl_tco_platform_data));
1574+ return platform_device_register_resndata(&pci_dev->dev,
1575+ "iTCO_wdt", -1, tco_res, 1, &cnl_tco_platform_data,
1576+ sizeof(cnl_tco_platform_data));
15821577 }
15831578
15841579 static void i801_add_tco(struct i801_priv *priv)
15851580 {
1586− u32 base_addr, tco_base, tco_ctl, ctrl_val;
15871581 struct pci_dev *pci_dev = priv->pci_dev;
1588− struct resource tco_res[3], *res;
1589− unsigned int devfn;
1582+ struct resource tco_res[2], *res;
1583+ u32 tco_base, tco_ctl;
15901584
15911585 /* If we have ACPI based watchdog use that instead */
15921586 if (acpi_has_watchdog())
@@ -1601,30 +1595,15 @@ static void i801_add_tco(struct i801_priv *priv) · 8 unmodified lines
16011595 return;
16021596
16031597 memset(tco_res, 0, sizeof(tco_res));
1604−
1605− res = &tco_res[ICH_RES_IO_TCO];
1606− res->start = tco_base & ~1;
1607− res->end = res->start + 32 - 1;
1608− res->flags = IORESOURCE_IO;
1609−
16101598 /*
1611− * Power Management registers.
1599+ * Always populate the main iTCO IO resource here. The second entry
1600+ * for NO_REBOOT MMIO is filled by the SPT specific function.
16121601 */
1613− devfn = PCI_DEVFN(PCI_SLOT(pci_dev->devfn), 2);
1614− pci_bus_read_config_dword(pci_dev->bus, devfn, ACPIBASE, &base_addr);
1615−
1616− res = &tco_res[ICH_RES_IO_SMI];
1617− res->start = (base_addr & ~1) + ACPIBASE_SMI_OFF;
1618− res->end = res->start + 3;
1602+ res = &tco_res[0];
1603+ res->start = tco_base & ~1;
1604+ res->end = res->start + 32 - 1;
16191605 res->flags = IORESOURCE_IO;
16201606
1621− /*
1622− * Enable the ACPI I/O space.
1623− */
1624− pci_bus_read_config_dword(pci_dev->bus, devfn, ACPICTRL, &ctrl_val);
1625− ctrl_val |= ACPICTRL_EN;
1626− pci_bus_write_config_dword(pci_dev->bus, devfn, ACPICTRL, ctrl_val);
1627−
16281607 if (priv->features & FEATURE_TCO_CNL)
16291608 priv->tco_pdev = i801_add_tco_cnl(priv, pci_dev, tco_res);
16301609 else
drivers/i2c/i2c-core-acpi.c+9−1
@@ -394,9 +394,17 @@ EXPORT_SYMBOL_GPL(i2c_acpi_find_adapter_by_handle); · 393 unmodified lines
394394 static struct i2c_client *i2c_acpi_find_client_by_adev(struct acpi_device *adev)
395395 {
396396 struct device *dev;
397+ struct i2c_client *client;
397398
398399 dev = bus_find_device_by_acpi_dev(&i2c_bus_type, adev);
399− return dev ? i2c_verify_client(dev) : NULL;
400+ if (!dev)
401+ return NULL;
402+
403+ client = i2c_verify_client(dev);
404+ if (!client)
405+ put_device(dev);
406+
407+ return client;
400408 }
401409
402410 static int i2c_acpi_notify(struct notifier_block *nb, unsigned long value,
drivers/iio/accel/adxl372.c+1−0
@@ -237,6 +237,7 @@ static const struct adxl372_axis_lookup adxl372_axis_lookup_table[] = { · 236 unmodified lines
237237 .realbits = 12, \
238238 .storagebits = 16, \
239239 .shift = 4, \
240+ .endianness = IIO_BE, \
240241 }, \
241242 }
242243
drivers/iio/accel/st_accel_i2c.c+1−1
@@ -110,7 +110,7 @@ MODULE_DEVICE_TABLE(of, st_accel_of_match); · 109 unmodified lines
110110
111111 #ifdef CONFIG_ACPI
112112 static const struct acpi_device_id st_accel_acpi_match[] = {
113− {"SMO8840", (kernel_ulong_t)LNG2DM_ACCEL_DEV_NAME},
113+ {"SMO8840", (kernel_ulong_t)LIS2DH12_ACCEL_DEV_NAME},
114114 {"SMO8A90", (kernel_ulong_t)LNG2DM_ACCEL_DEV_NAME},
115115 { },
116116 };
drivers/iio/adc/at91-sama5d2_adc.c+15−0
@@ -723,6 +723,7 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state) · 722 unmodified lines
723723
724724 for_each_set_bit(bit, indio->active_scan_mask, indio->num_channels) {
725725 struct iio_chan_spec const *chan = at91_adc_chan_get(indio, bit);
726+ u32 cor;
726727
727728 if (!chan)
728729 continue;
@@ -731,6 +732,20 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state) · 2 unmodified lines
731732 chan->type == IIO_PRESSURE)
732733 continue;
733734
735+ if (state) {
736+ cor = at91_adc_readl(st, AT91_SAMA5D2_COR);
737+
738+ if (chan->differential)
739+ cor |= (BIT(chan->channel) |
740+ BIT(chan->channel2)) <<
741+ AT91_SAMA5D2_COR_DIFF_OFFSET;
742+ else
743+ cor &= ~(BIT(chan->channel) <<
744+ AT91_SAMA5D2_COR_DIFF_OFFSET);
745+
746+ at91_adc_writel(st, AT91_SAMA5D2_COR, cor);
747+ }
748+
734749 if (state) {
735750 at91_adc_writel(st, AT91_SAMA5D2_CHER,
736751 BIT(chan->channel));
drivers/iio/adc/stm32-dfsdm-adc.c+10−33
@@ -842,31 +842,6 @@ static inline void stm32_dfsdm_process_data(struct stm32_dfsdm_adc *adc, · 841 unmodified lines
842842 }
843843 }
844844
845−static irqreturn_t stm32_dfsdm_adc_trigger_handler(int irq, void *p)
846−{
847− struct iio_poll_func *pf = p;
848− struct iio_dev *indio_dev = pf->indio_dev;
849− struct stm32_dfsdm_adc *adc = iio_priv(indio_dev);
850− int available = stm32_dfsdm_adc_dma_residue(adc);
851−
852− while (available >= indio_dev->scan_bytes) {
853− s32 *buffer = (s32 *)&adc->rx_buf[adc->bufi];
854−
855− stm32_dfsdm_process_data(adc, buffer);
856−
857− iio_push_to_buffers_with_timestamp(indio_dev, buffer,
858− pf->timestamp);
859− available -= indio_dev->scan_bytes;
860− adc->bufi += indio_dev->scan_bytes;
861− if (adc->bufi >= adc->buf_sz)
862− adc->bufi = 0;
863− }
864−
865− iio_trigger_notify_done(indio_dev->trig);
866−
867− return IRQ_HANDLED;
868−}
869−
870845 static void stm32_dfsdm_dma_buffer_done(void *data)
871846 {
872847 struct iio_dev *indio_dev = data;
@@ -874,11 +849,6 @@ static void stm32_dfsdm_dma_buffer_done(void *data) · 1 unmodified line
874849 int available = stm32_dfsdm_adc_dma_residue(adc);
875850 size_t old_pos;
876851
877− if (indio_dev->currentmode & INDIO_BUFFER_TRIGGERED) {
878− iio_trigger_poll_chained(indio_dev->trig);
879− return;
880− }
881−
882852 /*
883853 * FIXME: In Kernel interface does not support cyclic DMA buffer,and
884854 * offers only an interface to push data samples per samples.
@@ -906,7 +876,15 @@ static void stm32_dfsdm_dma_buffer_done(void *data) · 21 unmodified lines
906876 adc->bufi = 0;
907877 old_pos = 0;
908878 }
909− /* regular iio buffer without trigger */
879+ /*
880+ * In DMA mode the trigger services of IIO are not used
881+ * (e.g. no call to iio_trigger_poll).
882+ * Calling irq handler associated to the hardware trigger is not
883+ * relevant as the conversions have already been done. Data
884+ * transfers are performed directly in DMA callback instead.
885+ * This implementation avoids to call trigger irq handler that
886+ * may sleep, in an atomic context (DMA irq handler context).
887+ */
910888 if (adc->dev_data->type == DFSDM_IIO)
911889 iio_push_to_buffers(indio_dev, buffer);
912890 }
@@ -1536,8 +1514,7 @@ static int stm32_dfsdm_adc_init(struct iio_dev *indio_dev) · 623 unmodified lines
15361514 }
15371515
15381516 ret = iio_triggered_buffer_setup(indio_dev,
1539− &iio_pollfunc_store_time,
1540− &stm32_dfsdm_adc_trigger_handler,
1517+ &iio_pollfunc_store_time, NULL,
15411518 &stm32_dfsdm_buffer_setup_ops);
15421519 if (ret) {
15431520 stm32_dfsdm_dma_release(indio_dev);
drivers/iio/chemical/Kconfig+2−0
@@ -91,6 +91,8 @@ config SPS30 · 90 unmodified lines
9191 tristate "SPS30 particulate matter sensor"
9292 depends on I2C
9393 select CRC8
94+ select IIO_BUFFER
95+ select IIO_TRIGGERED_BUFFER
9496 help
9597 Say Y here to build support for the Sensirion SPS30 particulate
9698 matter sensor.
drivers/iio/light/vcnl4000.c+8−7
@@ -167,16 +167,17 @@ static int vcnl4200_init(struct vcnl4000_data *data) · 166 unmodified lines
167167 data->vcnl4200_ps.reg = VCNL4200_PS_DATA;
168168 switch (id) {
169169 case VCNL4200_PROD_ID:
170− /* Integration time is 50ms, but the experiments */
171− /* show 54ms in total. */
172− data->vcnl4200_al.sampling_rate = ktime_set(0, 54000 * 1000);
173− data->vcnl4200_ps.sampling_rate = ktime_set(0, 4200 * 1000);
170+ /* Default wait time is 50ms, add 20% tolerance. */
171+ data->vcnl4200_al.sampling_rate = ktime_set(0, 60000 * 1000);
172+ /* Default wait time is 4.8ms, add 20% tolerance. */
173+ data->vcnl4200_ps.sampling_rate = ktime_set(0, 5760 * 1000);
174174 data->al_scale = 24000;
175175 break;
176176 case VCNL4040_PROD_ID:
177− /* Integration time is 80ms, add 10ms. */
178− data->vcnl4200_al.sampling_rate = ktime_set(0, 100000 * 1000);
179− data->vcnl4200_ps.sampling_rate = ktime_set(0, 100000 * 1000);
177+ /* Default wait time is 80ms, add 20% tolerance. */
178+ data->vcnl4200_al.sampling_rate = ktime_set(0, 96000 * 1000);
179+ /* Default wait time is 5ms, add 20% tolerance. */
180+ data->vcnl4200_ps.sampling_rate = ktime_set(0, 6000 * 1000);
180181 data->al_scale = 120000;
181182 break;
182183 }
drivers/iio/magnetometer/ak8974.c+1−1
@@ -564,7 +564,7 @@ static int ak8974_read_raw(struct iio_dev *indio_dev, · 563 unmodified lines
564564 * We read all axes and discard all but one, for optimized
565565 * reading, use the triggered buffer.
566566 */
567− *val = le16_to_cpu(hw_values[chan->address]);
567+ *val = (s16)le16_to_cpu(hw_values[chan->address]);
568568
569569 ret = IIO_VAL_INT;
570570 }
drivers/iio/proximity/ping.c+1−1
@@ -269,7 +269,7 @@ static const struct iio_chan_spec ping_chan_spec[] = { · 268 unmodified lines
269269
270270 static const struct of_device_id of_ping_match[] = {
271271 { .compatible = "parallax,ping", .data = &pa_ping_cfg},
272− { .compatible = "parallax,laserping", .data = &pa_ping_cfg},
272+ { .compatible = "parallax,laserping", .data = &pa_laser_ping_cfg},
273273 {},
274274 };
275275
drivers/iio/trigger/stm32-timer-trigger.c+9−2
@@ -161,7 +161,8 @@ static int stm32_timer_start(struct stm32_timer_trigger *priv, · 160 unmodified lines
161161 return 0;
162162 }
163163
164−static void stm32_timer_stop(struct stm32_timer_trigger *priv)
164+static void stm32_timer_stop(struct stm32_timer_trigger *priv,
165+ struct iio_trigger *trig)
165166 {
166167 u32 ccer, cr1;
167168
@@ -179,6 +180,12 @@ static void stm32_timer_stop(struct stm32_timer_trigger *priv) · 11 unmodified lines
179180 regmap_write(priv->regmap, TIM_PSC, 0);
180181 regmap_write(priv->regmap, TIM_ARR, 0);
181182
183+ /* Force disable master mode */
184+ if (stm32_timer_is_trgo2_name(trig->name))
185+ regmap_update_bits(priv->regmap, TIM_CR2, TIM_CR2_MMS2, 0);
186+ else
187+ regmap_update_bits(priv->regmap, TIM_CR2, TIM_CR2_MMS, 0);
188+
182189 /* Make sure that registers are updated */
183190 regmap_update_bits(priv->regmap, TIM_EGR, TIM_EGR_UG, TIM_EGR_UG);
184191 }
@@ -197,7 +204,7 @@ static ssize_t stm32_tt_store_frequency(struct device *dev, · 12 unmodified lines
197204 return ret;
198205
199206 if (freq == 0) {
200− stm32_timer_stop(priv);
207+ stm32_timer_stop(priv, trig);
201208 } else {
202209 ret = stm32_timer_start(priv, trig, freq);
203210 if (ret)
drivers/iommu/amd_iommu.c+2−2
@@ -3826,7 +3826,7 @@ int amd_iommu_activate_guest_mode(void *data) · 3825 unmodified lines
38263826 entry->lo.fields_vapic.ga_tag = ir_data->ga_tag;
38273827
38283828 return modify_irte_ga(ir_data->irq_2_irte.devid,
3829− ir_data->irq_2_irte.index, entry, NULL);
3829+ ir_data->irq_2_irte.index, entry, ir_data);
38303830 }
38313831 EXPORT_SYMBOL(amd_iommu_activate_guest_mode);
38323832
@@ -3852,7 +3852,7 @@ int amd_iommu_deactivate_guest_mode(void *data) · 19 unmodified lines
38523852 APICID_TO_IRTE_DEST_HI(cfg->dest_apicid);
38533853
38543854 return modify_irte_ga(ir_data->irq_2_irte.devid,
3855− ir_data->irq_2_irte.index, entry, NULL);
3855+ ir_data->irq_2_irte.index, entry, ir_data);
38563856 }
38573857 EXPORT_SYMBOL(amd_iommu_deactivate_guest_mode);
38583858
drivers/iommu/dma-iommu.c+8−8
@@ -177,15 +177,15 @@ static int cookie_init_hw_msi_region(struct iommu_dma_cookie *cookie, · 176 unmodified lines
177177 start -= iova_offset(iovad, start);
178178 num_pages = iova_align(iovad, end - start) >> iova_shift(iovad);
179179
180− msi_page = kcalloc(num_pages, sizeof(*msi_page), GFP_KERNEL);
181− if (!msi_page)
182− return -ENOMEM;
183−
184180 for (i = 0; i < num_pages; i++) {
185− msi_page[i].phys = start;
186− msi_page[i].iova = start;
187− INIT_LIST_HEAD(&msi_page[i].list);
188− list_add(&msi_page[i].list, &cookie->msi_page_list);
181+ msi_page = kmalloc(sizeof(*msi_page), GFP_KERNEL);
182+ if (!msi_page)
183+ return -ENOMEM;
184+
185+ msi_page->phys = start;
186+ msi_page->iova = start;
187+ INIT_LIST_HEAD(&msi_page->list);
188+ list_add(&msi_page->list, &cookie->msi_page_list);
189189 start += iovad->granule;
190190 }
191191
drivers/iommu/dmar.c+17−7
@@ -28,6 +28,7 @@ · 27 unmodified lines
2828 #include <linux/slab.h>
2929 #include <linux/iommu.h>
3030 #include <linux/numa.h>
31+#include <linux/limits.h>
3132 #include <asm/irq_remapping.h>
3233 #include <asm/iommu_table.h>
3334
@@ -128,6 +129,13 @@ dmar_alloc_pci_notify_info(struct pci_dev *dev, unsigned long event) · 94 unmodified lines
128129
129130 BUG_ON(dev->is_virtfn);
130131
132+ /*
133+ * Ignore devices that have a domain number higher than what can
134+ * be looked up in DMAR, e.g. VMD subdevices with domain 0x10000
135+ */
136+ if (pci_domain_nr(dev->bus) > U16_MAX)
137+ return NULL;
138+
131139 /* Only generate path[] for device addition event */
132140 if (event == BUS_NOTIFY_ADD_DEVICE)
133141 for (tmp = dev; tmp; tmp = tmp->bus->self)
@@ -363,7 +371,8 @@ dmar_find_dmaru(struct acpi_dmar_hardware_unit *drhd) · 229 unmodified lines
363371 {
364372 struct dmar_drhd_unit *dmaru;
365373
366− list_for_each_entry_rcu(dmaru, &dmar_drhd_units, list)
374+ list_for_each_entry_rcu(dmaru, &dmar_drhd_units, list,
375+ dmar_rcu_check())
367376 if (dmaru->segment == drhd->segment &&
368377 dmaru->reg_base_addr == drhd->address)
369378 return dmaru;
@@ -440,12 +449,13 @@ static int __init dmar_parse_one_andd(struct acpi_dmar_header *header, · 70 unmodified lines
440449
441450 /* Check for NUL termination within the designated length */
442451 if (strnlen(andd->device_name, header->length - 8) == header->length - 8) {
443− WARN_TAINT(1, TAINT_FIRMWARE_WORKAROUND,
452+ pr_warn(FW_BUG
444453 "Your BIOS is broken; ANDD object name is not NUL-terminated\n"
445454 "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
446455 dmi_get_system_info(DMI_BIOS_VENDOR),
447456 dmi_get_system_info(DMI_BIOS_VERSION),
448457 dmi_get_system_info(DMI_PRODUCT_VERSION));
458+ add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
449459 return -EINVAL;
450460 }
451461 pr_info("ANDD device: %x name: %s\n", andd->device_number,
@@ -471,14 +481,14 @@ static int dmar_parse_one_rhsa(struct acpi_dmar_header *header, void *arg) · 19 unmodified lines
471481 return 0;
472482 }
473483 }
474− WARN_TAINT(
475− 1, TAINT_FIRMWARE_WORKAROUND,
484+ pr_warn(FW_BUG
476485 "Your BIOS is broken; RHSA refers to non-existent DMAR unit at %llx\n"
477486 "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
478− drhd->reg_base_addr,
487+ rhsa->base_address,
479488 dmi_get_system_info(DMI_BIOS_VENDOR),
480489 dmi_get_system_info(DMI_BIOS_VERSION),
481490 dmi_get_system_info(DMI_PRODUCT_VERSION));
491+ add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
482492
483493 return 0;
484494 }
@@ -827,14 +837,14 @@ int __init dmar_table_init(void) · 342 unmodified lines
827837
828838 static void warn_invalid_dmar(u64 addr, const char *message)
829839 {
830− WARN_TAINT_ONCE(
831− 1, TAINT_FIRMWARE_WORKAROUND,
840+ pr_warn_once(FW_BUG
832841 "Your BIOS is broken; DMAR reported at address %llx%s!\n"
833842 "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
834843 addr, message,
835844 dmi_get_system_info(DMI_BIOS_VENDOR),
836845 dmi_get_system_info(DMI_BIOS_VERSION),
837846 dmi_get_system_info(DMI_PRODUCT_VERSION));
847+ add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
838848 }
839849
840850 static int __ref
drivers/iommu/intel-iommu-debugfs.c+35−16
@@ -33,38 +33,42 @@ struct iommu_regset { · 32 unmodified lines
3333
3434 #define IOMMU_REGSET_ENTRY(_reg_) \
3535 { DMAR_##_reg_##_REG, __stringify(_reg_) }
36−static const struct iommu_regset iommu_regs[] = {
36+
37+static const struct iommu_regset iommu_regs_32[] = {
3738 IOMMU_REGSET_ENTRY(VER),
38− IOMMU_REGSET_ENTRY(CAP),
39− IOMMU_REGSET_ENTRY(ECAP),
4039 IOMMU_REGSET_ENTRY(GCMD),
4140 IOMMU_REGSET_ENTRY(GSTS),
42− IOMMU_REGSET_ENTRY(RTADDR),
43− IOMMU_REGSET_ENTRY(CCMD),
4441 IOMMU_REGSET_ENTRY(FSTS),
4542 IOMMU_REGSET_ENTRY(FECTL),
4643 IOMMU_REGSET_ENTRY(FEDATA),
4744 IOMMU_REGSET_ENTRY(FEADDR),
4845 IOMMU_REGSET_ENTRY(FEUADDR),
49− IOMMU_REGSET_ENTRY(AFLOG),
5046 IOMMU_REGSET_ENTRY(PMEN),
5147 IOMMU_REGSET_ENTRY(PLMBASE),
5248 IOMMU_REGSET_ENTRY(PLMLIMIT),
49+ IOMMU_REGSET_ENTRY(ICS),
50+ IOMMU_REGSET_ENTRY(PRS),
51+ IOMMU_REGSET_ENTRY(PECTL),
52+ IOMMU_REGSET_ENTRY(PEDATA),
53+ IOMMU_REGSET_ENTRY(PEADDR),
54+ IOMMU_REGSET_ENTRY(PEUADDR),
55+};
56+
57+static const struct iommu_regset iommu_regs_64[] = {
58+ IOMMU_REGSET_ENTRY(CAP),
59+ IOMMU_REGSET_ENTRY(ECAP),
60+ IOMMU_REGSET_ENTRY(RTADDR),
61+ IOMMU_REGSET_ENTRY(CCMD),
62+ IOMMU_REGSET_ENTRY(AFLOG),
5363 IOMMU_REGSET_ENTRY(PHMBASE),
5464 IOMMU_REGSET_ENTRY(PHMLIMIT),
5565 IOMMU_REGSET_ENTRY(IQH),
5666 IOMMU_REGSET_ENTRY(IQT),
5767 IOMMU_REGSET_ENTRY(IQA),
58− IOMMU_REGSET_ENTRY(ICS),
5968 IOMMU_REGSET_ENTRY(IRTA),
6069 IOMMU_REGSET_ENTRY(PQH),
6170 IOMMU_REGSET_ENTRY(PQT),
6271 IOMMU_REGSET_ENTRY(PQA),
63− IOMMU_REGSET_ENTRY(PRS),
64− IOMMU_REGSET_ENTRY(PECTL),
65− IOMMU_REGSET_ENTRY(PEDATA),
66− IOMMU_REGSET_ENTRY(PEADDR),
67− IOMMU_REGSET_ENTRY(PEUADDR),
6872 IOMMU_REGSET_ENTRY(MTRRCAP),
6973 IOMMU_REGSET_ENTRY(MTRRDEF),
7074 IOMMU_REGSET_ENTRY(MTRR_FIX64K_00000),
@@ -127,10 +131,16 @@ static int iommu_regset_show(struct seq_file *m, void *unused) · 56 unmodified lines
127131 * by adding the offset to the pointer (virtual address).
128132 */
129133 raw_spin_lock_irqsave(&iommu->register_lock, flag);
130− for (i = 0 ; i < ARRAY_SIZE(iommu_regs); i++) {
131− value = dmar_readq(iommu->reg + iommu_regs[i].offset);
134+ for (i = 0 ; i < ARRAY_SIZE(iommu_regs_32); i++) {
135+ value = dmar_readl(iommu->reg + iommu_regs_32[i].offset);
136+ seq_printf(m, "%-16s\t0x%02x\t\t0x%016llx\n",
137+ iommu_regs_32[i].regs, iommu_regs_32[i].offset,
138+ value);
139+ }
140+ for (i = 0 ; i < ARRAY_SIZE(iommu_regs_64); i++) {
141+ value = dmar_readq(iommu->reg + iommu_regs_64[i].offset);
132142 seq_printf(m, "%-16s\t0x%02x\t\t0x%016llx\n",
133− iommu_regs[i].regs, iommu_regs[i].offset,
143+ iommu_regs_64[i].regs, iommu_regs_64[i].offset,
134144 value);
135145 }
136146 raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
@@ -272,9 +282,16 @@ static int dmar_translation_struct_show(struct seq_file *m, void *unused) · 135 unmodified lines
272282 {
273283 struct dmar_drhd_unit *drhd;
274284 struct intel_iommu *iommu;
285+ u32 sts;
275286
276287 rcu_read_lock();
277288 for_each_active_iommu(iommu, drhd) {
289+ sts = dmar_readl(iommu->reg + DMAR_GSTS_REG);
290+ if (!(sts & DMA_GSTS_TES)) {
291+ seq_printf(m, "DMA Remapping is not enabled on %s\n",
292+ iommu->name);
293+ continue;
294+ }
278295 root_tbl_walk(m, iommu);
279296 seq_putc(m, '\n');
280297 }
@@ -415,6 +432,7 @@ static int ir_translation_struct_show(struct seq_file *m, void *unused) · 134 unmodified lines
415432 struct dmar_drhd_unit *drhd;
416433 struct intel_iommu *iommu;
417434 u64 irta;
435+ u32 sts;
418436
419437 rcu_read_lock();
420438 for_each_active_iommu(iommu, drhd) {
@@ -424,7 +442,8 @@ static int ir_translation_struct_show(struct seq_file *m, void *unused) · 3 unmodified lines
424442 seq_printf(m, "Remapped Interrupt supported on IOMMU: %s\n",
425443 iommu->name);
426444
427− if (iommu->ir_table) {
445+ sts = dmar_readl(iommu->reg + DMAR_GSTS_REG);
446+ if (iommu->ir_table && (sts & DMA_GSTS_IRES)) {
428447 irta = virt_to_phys(iommu->ir_table->base);
429448 seq_printf(m, " IR table address:%llx\n", irta);
430449 ir_tbl_remap_entry_show(m, iommu);
drivers/iommu/intel-iommu.c+19−9
@@ -4261,10 +4261,11 @@ static void quirk_ioat_snb_local_iommu(struct pci_dev *pdev) · 4260 unmodified lines
42614261
42624262 /* we know that the this iommu should be at offset 0xa000 from vtbar */
42634263 drhd = dmar_find_matched_drhd_unit(pdev);
4264− if (WARN_TAINT_ONCE(!drhd || drhd->reg_base_addr - vtbar != 0xa000,
4265− TAINT_FIRMWARE_WORKAROUND,
4266− "BIOS assigned incorrect VT-d unit for Intel(R) QuickData Technology device\n"))
4264+ if (!drhd || drhd->reg_base_addr - vtbar != 0xa000) {
4265+ pr_warn_once(FW_BUG "BIOS assigned incorrect VT-d unit for Intel(R) QuickData Technology device\n");
4266+ add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
42674267 pdev->dev.archdata.iommu = DUMMY_DEVICE_DOMAIN_INFO;
4268+ }
42684269 }
42694270 DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_SNB, quirk_ioat_snb_local_iommu);
42704271
@@ -4460,14 +4461,16 @@ int __init dmar_parse_one_rmrr(struct acpi_dmar_header *header, void *arg) · 189 unmodified lines
44604461 struct dmar_rmrr_unit *rmrru;
44614462
44624463 rmrr = (struct acpi_dmar_reserved_memory *)header;
4463− if (rmrr_sanity_check(rmrr))
4464− WARN_TAINT(1, TAINT_FIRMWARE_WORKAROUND,
4464+ if (rmrr_sanity_check(rmrr)) {
4465+ pr_warn(FW_BUG
44654466 "Your BIOS is broken; bad RMRR [%#018Lx-%#018Lx]\n"
44664467 "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
44674468 rmrr->base_address, rmrr->end_address,
44684469 dmi_get_system_info(DMI_BIOS_VENDOR),
44694470 dmi_get_system_info(DMI_BIOS_VERSION),
44704471 dmi_get_system_info(DMI_PRODUCT_VERSION));
4472+ add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
4473+ }
44714474
44724475 rmrru = kzalloc(sizeof(*rmrru), GFP_KERNEL);
44734476 if (!rmrru)
@@ -5130,6 +5133,9 @@ int __init intel_iommu_init(void) · 656 unmodified lines
51305133
51315134 down_write(&dmar_global_lock);
51325135
5136+ if (!no_iommu)
5137+ intel_iommu_debugfs_init();
5138+
51335139 if (no_iommu || dmar_disabled) {
51345140 /*
51355141 * We exit the function here to ensure IOMMU's remapping and
@@ -5193,6 +5199,7 @@ int __init intel_iommu_init(void) · 57 unmodified lines
51935199
51945200 init_iommu_pm_ops();
51955201
5202+ down_read(&dmar_global_lock);
51965203 for_each_active_iommu(iommu, drhd) {
51975204 iommu_device_sysfs_add(&iommu->iommu, NULL,
51985205 intel_iommu_groups,
@@ -5200,6 +5207,7 @@ int __init intel_iommu_init(void) · 1 unmodified line
52005207 iommu_device_set_ops(&iommu->iommu, &intel_iommu_ops);
52015208 iommu_device_register(&iommu->iommu);
52025209 }
5210+ up_read(&dmar_global_lock);
52035211
52045212 bus_set_iommu(&pci_bus_type, &intel_iommu_ops);
52055213 if (si_domain && !hw_pass_through)
@@ -5210,7 +5218,6 @@ int __init intel_iommu_init(void) · 4 unmodified lines
52105218 down_read(&dmar_global_lock);
52115219 if (probe_acpi_namespace_devices())
52125220 pr_warn("ACPI name space devices didn't probe correctly\n");
5213− up_read(&dmar_global_lock);
52145221
52155222 /* Finally, we enable the DMA remapping hardware. */
52165223 for_each_iommu(iommu, drhd) {
@@ -5219,10 +5226,11 @@ int __init intel_iommu_init(void) · 2 unmodified lines
52195226
52205227 iommu_disable_protect_mem_regions(iommu);
52215228 }
5229+ up_read(&dmar_global_lock);
5230+
52225231 pr_info("Intel(R) Virtualization Technology for Directed I/O\n");
52235232
52245233 intel_iommu_enabled = 1;
5225− intel_iommu_debugfs_init();
52265234
52275235 return 0;
52285236
@@ -5700,8 +5708,10 @@ static phys_addr_t intel_iommu_iova_to_phys(struct iommu_domain *domain, · 471 unmodified lines
57005708 u64 phys = 0;
57015709
57025710 pte = pfn_to_dma_pte(dmar_domain, iova >> VTD_PAGE_SHIFT, &level);
5703− if (pte)
5704− phys = dma_pte_addr(pte);
5711+ if (pte && dma_pte_present(pte))
5712+ phys = dma_pte_addr(pte) +
5713+ (iova & (BIT_MASK(level_to_offset_bits(level) +
5714+ VTD_PAGE_SHIFT) - 1));
57055715
57065716 return phys;
57075717 }
drivers/iommu/io-pgtable-arm.c+2−2
@@ -468,7 +468,7 @@ static int arm_lpae_map(struct io_pgtable_ops *ops, unsigned long iova, · 467 unmodified lines
468468 arm_lpae_iopte *ptep = data->pgd;
469469 int ret, lvl = data->start_level;
470470 arm_lpae_iopte prot;
471− long iaext = (long)iova >> cfg->ias;
471+ long iaext = (s64)iova >> cfg->ias;
472472
473473 /* If no access, then nothing to do */
474474 if (!(iommu_prot & (IOMMU_READ | IOMMU_WRITE)))
@@ -645,7 +645,7 @@ static size_t arm_lpae_unmap(struct io_pgtable_ops *ops, unsigned long iova, · 170 unmodified lines
645645 struct arm_lpae_io_pgtable *data = io_pgtable_ops_to_data(ops);
646646 struct io_pgtable_cfg *cfg = &data->iop.cfg;
647647 arm_lpae_iopte *ptep = data->pgd;
648− long iaext = (long)iova >> cfg->ias;
648+ long iaext = (s64)iova >> cfg->ias;
649649
650650 if (WARN_ON(!size || (size & cfg->pgsize_bitmap) != size))
651651 return 0;
drivers/irqchip/irq-gic-v3.c+29−1
@@ -34,6 +34,7 @@ · 33 unmodified lines
3434 #define GICD_INT_NMI_PRI (GICD_INT_DEF_PRI & ~0x80)
3535
3636 #define FLAGS_WORKAROUND_GICR_WAKER_MSM8996 (1ULL << 0)
37+#define FLAGS_WORKAROUND_CAVIUM_ERRATUM_38539 (1ULL << 1)
3738
3839 struct redist_region {
3940 void __iomem *redist_base;
@@ -1464,6 +1465,15 @@ static bool gic_enable_quirk_msm8996(void *data) · 1424 unmodified lines
14641465 return true;
14651466 }
14661467
1468+static bool gic_enable_quirk_cavium_38539(void *data)
1469+{
1470+ struct gic_chip_data *d = data;
1471+
1472+ d->flags |= FLAGS_WORKAROUND_CAVIUM_ERRATUM_38539;
1473+
1474+ return true;
1475+}
1476+
14671477 static bool gic_enable_quirk_hip06_07(void *data)
14681478 {
14691479 struct gic_chip_data *d = data;
@@ -1502,6 +1512,19 @@ static const struct gic_quirk gic_quirks[] = { · 32 unmodified lines
15021512 .mask = 0xffffffff,
15031513 .init = gic_enable_quirk_hip06_07,
15041514 },
1515+ {
1516+ /*
1517+ * Reserved register accesses generate a Synchronous
1518+ * External Abort. This erratum applies to:
1519+ * - ThunderX: CN88xx
1520+ * - OCTEON TX: CN83xx, CN81xx
1521+ * - OCTEON TX2: CN93xx, CN96xx, CN98xx, CNF95xx*
1522+ */
1523+ .desc = "GICv3: Cavium erratum 38539",
1524+ .iidr = 0xa000034c,
1525+ .mask = 0xe8f00fff,
1526+ .init = gic_enable_quirk_cavium_38539,
1527+ },
15051528 {
15061529 }
15071530 };
@@ -1577,7 +1600,12 @@ static int __init gic_init_bases(void __iomem *dist_base, · 69 unmodified lines
15771600 pr_info("%d SPIs implemented\n", GIC_LINE_NR - 32);
15781601 pr_info("%d Extended SPIs implemented\n", GIC_ESPI_NR);
15791602
1580− gic_data.rdists.gicd_typer2 = readl_relaxed(gic_data.dist_base + GICD_TYPER2);
1603+ /*
1604+ * ThunderX1 explodes on reading GICD_TYPER2, in violation of the
1605+ * architecture spec (which says that reserved registers are RES0).
1606+ */
1607+ if (!(gic_data.flags & FLAGS_WORKAROUND_CAVIUM_ERRATUM_38539))
1608+ gic_data.rdists.gicd_typer2 = readl_relaxed(gic_data.dist_base + GICD_TYPER2);
15811609
15821610 gic_data.domain = irq_domain_create_tree(handle, &gic_irq_domain_ops,
15831611 &gic_data);
drivers/macintosh/windfarm_ad7417_sensor.c+7−0
@@ -312,9 +312,16 @@ static const struct i2c_device_id wf_ad7417_id[] = { · 311 unmodified lines
312312 };
313313 MODULE_DEVICE_TABLE(i2c, wf_ad7417_id);
314314
315+static const struct of_device_id wf_ad7417_of_id[] = {
316+ { .compatible = "ad7417", },
317+ { }
318+};
319+MODULE_DEVICE_TABLE(of, wf_ad7417_of_id);
320+
315321 static struct i2c_driver wf_ad7417_driver = {
316322 .driver = {
317323 .name = "wf_ad7417",
324+ .of_match_table = wf_ad7417_of_id,
318325 },
319326 .probe = wf_ad7417_probe,
320327 .remove = wf_ad7417_remove,
drivers/macintosh/windfarm_fcu_controls.c+7−0
@@ -580,9 +580,16 @@ static const struct i2c_device_id wf_fcu_id[] = { · 579 unmodified lines
580580 };
581581 MODULE_DEVICE_TABLE(i2c, wf_fcu_id);
582582
583+static const struct of_device_id wf_fcu_of_id[] = {
584+ { .compatible = "fcu", },
585+ { }
586+};
587+MODULE_DEVICE_TABLE(of, wf_fcu_of_id);
588+
583589 static struct i2c_driver wf_fcu_driver = {
584590 .driver = {
585591 .name = "wf_fcu",
592+ .of_match_table = wf_fcu_of_id,
586593 },
587594 .probe = wf_fcu_probe,
588595 .remove = wf_fcu_remove,
drivers/macintosh/windfarm_lm75_sensor.c+15−1
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414 #include <linux/init.h>
1515 #include <linux/wait.h>
1616 #include <linux/i2c.h>
17+#include <linux/of_device.h>
1718 #include <asm/prom.h>
1819 #include <asm/machdep.h>
1920 #include <asm/io.h>
@@ -91,9 +92,14 @@ static int wf_lm75_probe(struct i2c_client *client, · 71 unmodified lines
9192 const struct i2c_device_id *id)
9293 {
9394 struct wf_lm75_sensor *lm;
94− int rc, ds1775 = id->driver_data;
95+ int rc, ds1775;
9596 const char *name, *loc;
9697
98+ if (id)
99+ ds1775 = id->driver_data;
100+ else
101+ ds1775 = !!of_device_get_match_data(&client->dev);
102+
97103 DBG("wf_lm75: creating %s device at address 0x%02x\n",
98104 ds1775 ? "ds1775" : "lm75", client->addr);
99105
@@ -164,9 +170,17 @@ static const struct i2c_device_id wf_lm75_id[] = { · 64 unmodified lines
164170 };
165171 MODULE_DEVICE_TABLE(i2c, wf_lm75_id);
166172
173+static const struct of_device_id wf_lm75_of_id[] = {
174+ { .compatible = "lm75", .data = (void *)0},
175+ { .compatible = "ds1775", .data = (void *)1 },
176+ { }
177+};
178+MODULE_DEVICE_TABLE(of, wf_lm75_of_id);
179+
167180 static struct i2c_driver wf_lm75_driver = {
168181 .driver = {
169182 .name = "wf_lm75",
183+ .of_match_table = wf_lm75_of_id,
170184 },
171185 .probe = wf_lm75_probe,
172186 .remove = wf_lm75_remove,
drivers/macintosh/windfarm_lm87_sensor.c+7−0
@@ -166,9 +166,16 @@ static const struct i2c_device_id wf_lm87_id[] = { · 165 unmodified lines
166166 };
167167 MODULE_DEVICE_TABLE(i2c, wf_lm87_id);
168168
169+static const struct of_device_id wf_lm87_of_id[] = {
170+ { .compatible = "lm87cimt", },
171+ { }
172+};
173+MODULE_DEVICE_TABLE(of, wf_lm87_of_id);
174+
169175 static struct i2c_driver wf_lm87_driver = {
170176 .driver = {
171177 .name = "wf_lm87",
178+ .of_match_table = wf_lm87_of_id,
172179 },
173180 .probe = wf_lm87_probe,
174181 .remove = wf_lm87_remove,
drivers/macintosh/windfarm_max6690_sensor.c+7−0
@@ -120,9 +120,16 @@ static const struct i2c_device_id wf_max6690_id[] = { · 119 unmodified lines
120120 };
121121 MODULE_DEVICE_TABLE(i2c, wf_max6690_id);
122122
123+static const struct of_device_id wf_max6690_of_id[] = {
124+ { .compatible = "max6690", },
125+ { }
126+};
127+MODULE_DEVICE_TABLE(of, wf_max6690_of_id);
128+
123129 static struct i2c_driver wf_max6690_driver = {
124130 .driver = {
125131 .name = "wf_max6690",
132+ .of_match_table = wf_max6690_of_id,
126133 },
127134 .probe = wf_max6690_probe,
128135 .remove = wf_max6690_remove,
drivers/macintosh/windfarm_smu_sat.c+7−0
@@ -341,9 +341,16 @@ static const struct i2c_device_id wf_sat_id[] = { · 340 unmodified lines
341341 };
342342 MODULE_DEVICE_TABLE(i2c, wf_sat_id);
343343
344+static const struct of_device_id wf_sat_of_id[] = {
345+ { .compatible = "smu-sat", },
346+ { }
347+};
348+MODULE_DEVICE_TABLE(of, wf_sat_of_id);
349+
344350 static struct i2c_driver wf_sat_driver = {
345351 .driver = {
346352 .name = "wf_smu_sat",
353+ .of_match_table = wf_sat_of_id,
347354 },
348355 .probe = wf_sat_probe,
349356 .remove = wf_sat_remove,
drivers/misc/cardreader/rts5227.c+1−1
@@ -394,7 +394,7 @@ static const struct pcr_ops rts522a_pcr_ops = { · 393 unmodified lines
394394 void rts522a_init_params(struct rtsx_pcr *pcr)
395395 {
396396 rts5227_init_params(pcr);
397−
397+ pcr->tx_initial_phase = SET_CLOCK_PHASE(20, 20, 11);
398398 pcr->reg_pm_ctrl3 = RTS522A_PM_CTRL3;
399399
400400 pcr->option.ocp_en = 1;
drivers/misc/cardreader/rts5249.c+2−0
@@ -618,6 +618,7 @@ static const struct pcr_ops rts524a_pcr_ops = { · 617 unmodified lines
618618 void rts524a_init_params(struct rtsx_pcr *pcr)
619619 {
620620 rts5249_init_params(pcr);
621+ pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 29, 11);
621622 pcr->option.ltr_l1off_sspwrgate = LTR_L1OFF_SSPWRGATE_5250_DEF;
622623 pcr->option.ltr_l1off_snooze_sspwrgate =
623624 LTR_L1OFF_SNOOZE_SSPWRGATE_5250_DEF;
@@ -733,6 +734,7 @@ static const struct pcr_ops rts525a_pcr_ops = { · 109 unmodified lines
733734 void rts525a_init_params(struct rtsx_pcr *pcr)
734735 {
735736 rts5249_init_params(pcr);
737+ pcr->tx_initial_phase = SET_CLOCK_PHASE(25, 29, 11);
736738 pcr->option.ltr_l1off_sspwrgate = LTR_L1OFF_SSPWRGATE_5250_DEF;
737739 pcr->option.ltr_l1off_snooze_sspwrgate =
738740 LTR_L1OFF_SNOOZE_SSPWRGATE_5250_DEF;
drivers/misc/cardreader/rts5260.c+1−1
@@ -662,7 +662,7 @@ void rts5260_init_params(struct rtsx_pcr *pcr) · 661 unmodified lines
662662 pcr->sd30_drive_sel_1v8 = CFG_DRIVER_TYPE_B;
663663 pcr->sd30_drive_sel_3v3 = CFG_DRIVER_TYPE_B;
664664 pcr->aspm_en = ASPM_L1_EN;
665− pcr->tx_initial_phase = SET_CLOCK_PHASE(1, 29, 16);
665+ pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 29, 11);
666666 pcr->rx_initial_phase = SET_CLOCK_PHASE(24, 6, 5);
667667
668668 pcr->ic_version = rts5260_get_ic_version(pcr);
drivers/misc/cardreader/rts5261.c+1−1
@@ -764,7 +764,7 @@ void rts5261_init_params(struct rtsx_pcr *pcr) · 763 unmodified lines
764764 pcr->sd30_drive_sel_1v8 = CFG_DRIVER_TYPE_B;
765765 pcr->sd30_drive_sel_3v3 = CFG_DRIVER_TYPE_B;
766766 pcr->aspm_en = ASPM_L1_EN;
767− pcr->tx_initial_phase = SET_CLOCK_PHASE(20, 27, 16);
767+ pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 27, 11);
768768 pcr->rx_initial_phase = SET_CLOCK_PHASE(24, 6, 5);
769769
770770 pcr->ic_version = rts5261_get_ic_version(pcr);
drivers/misc/eeprom/at24.c+2−1
@@ -712,13 +712,14 @@ static int at24_probe(struct i2c_client *client) · 711 unmodified lines
712712 * chip is functional.
713713 */
714714 err = at24_read(at24, 0, &test_byte, 1);
715− pm_runtime_idle(dev);
716715 if (err) {
717716 pm_runtime_disable(dev);
718717 regulator_disable(at24->vcc_reg);
719718 return -ENODEV;
720719 }
721720
721+ pm_runtime_idle(dev);
722+
722723 if (writable)
723724 dev_info(dev, "%u byte %s EEPROM, writable, %u bytes/write\n",
724725 byte_len, client->name, at24->write_max);
drivers/mmc/core/core.c+4−1
@@ -1732,8 +1732,11 @@ static int mmc_do_erase(struct mmc_card *card, unsigned int from, · 1731 unmodified lines
17321732 * the erase operation does not exceed the max_busy_timeout, we should
17331733 * use R1B response. Or we need to prevent the host from doing hw busy
17341734 * detection, which is done by converting to a R1 response instead.
1735+ * Note, some hosts requires R1B, which also means they are on their own
1736+ * when it comes to deal with the busy timeout.
17351737 */
1736− if (card->host->max_busy_timeout &&
1738+ if (!(card->host->caps & MMC_CAP_NEED_RSP_BUSY) &&
1739+ card->host->max_busy_timeout &&
17371740 busy_timeout > card->host->max_busy_timeout) {
17381741 cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC;
17391742 } else {
drivers/mmc/core/mmc.c+5−2
@@ -1910,9 +1910,12 @@ static int mmc_sleep(struct mmc_host *host) · 1909 unmodified lines
19101910 * If the max_busy_timeout of the host is specified, validate it against
19111911 * the sleep cmd timeout. A failure means we need to prevent the host
19121912 * from doing hw busy detection, which is done by converting to a R1
1913− * response instead of a R1B.
1913+ * response instead of a R1B. Note, some hosts requires R1B, which also
1914+ * means they are on their own when it comes to deal with the busy
1915+ * timeout.
19141916 */
1915− if (host->max_busy_timeout && (timeout_ms > host->max_busy_timeout)) {
1917+ if (!(host->caps & MMC_CAP_NEED_RSP_BUSY) && host->max_busy_timeout &&
1918+ (timeout_ms > host->max_busy_timeout)) {
19161919 cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
19171920 } else {
19181921 cmd.flags = MMC_RSP_R1B | MMC_CMD_AC;
drivers/mmc/core/mmc_ops.c+4−2
@@ -542,9 +542,11 @@ int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value, · 541 unmodified lines
542542 * If the max_busy_timeout of the host is specified, make sure it's
543543 * enough to fit the used timeout_ms. In case it's not, let's instruct
544544 * the host to avoid HW busy detection, by converting to a R1 response
545− * instead of a R1B.
545+ * instead of a R1B. Note, some hosts requires R1B, which also means
546+ * they are on their own when it comes to deal with the busy timeout.
546547 */
547− if (host->max_busy_timeout && (timeout_ms > host->max_busy_timeout))
548+ if (!(host->caps & MMC_CAP_NEED_RSP_BUSY) && host->max_busy_timeout &&
549+ (timeout_ms > host->max_busy_timeout))
548550 use_r1b_resp = false;
549551
550552 cmd.opcode = MMC_SWITCH;
drivers/mmc/host/rtsx_pci_sdmmc.c+8−5
@@ -606,19 +606,22 @@ static int sd_change_phase(struct realtek_pci_sdmmc *host, · 605 unmodified lines
606606 u8 sample_point, bool rx)
607607 {
608608 struct rtsx_pcr *pcr = host->pcr;
609−
609+ u16 SD_VP_CTL = 0;
610610 dev_dbg(sdmmc_dev(host), "%s(%s): sample_point = %d\n",
611611 __func__, rx ? "RX" : "TX", sample_point);
612612
613613 rtsx_pci_write_register(pcr, CLK_CTL, CHANGE_CLK, CHANGE_CLK);
614− if (rx)
614+ if (rx) {
615+ SD_VP_CTL = SD_VPRX_CTL;
615616 rtsx_pci_write_register(pcr, SD_VPRX_CTL,
616617 PHASE_SELECT_MASK, sample_point);
617− else
618+ } else {
619+ SD_VP_CTL = SD_VPTX_CTL;
618620 rtsx_pci_write_register(pcr, SD_VPTX_CTL,
619621 PHASE_SELECT_MASK, sample_point);
620− rtsx_pci_write_register(pcr, SD_VPCLK0_CTL, PHASE_NOT_RESET, 0);
621− rtsx_pci_write_register(pcr, SD_VPCLK0_CTL, PHASE_NOT_RESET,
622+ }
623+ rtsx_pci_write_register(pcr, SD_VP_CTL, PHASE_NOT_RESET, 0);
624+ rtsx_pci_write_register(pcr, SD_VP_CTL, PHASE_NOT_RESET,
622625 PHASE_NOT_RESET);
623626 rtsx_pci_write_register(pcr, CLK_CTL, CHANGE_CLK, 0);
624627 rtsx_pci_write_register(pcr, SD_CFG1, SD_ASYNC_FIFO_NOT_RST, 0);
drivers/mmc/host/sdhci-acpi.c+82−2
@@ -23,6 +23,7 @@ · 22 unmodified lines
2323 #include <linux/pm.h>
2424 #include <linux/pm_runtime.h>
2525 #include <linux/delay.h>
26+#include <linux/dmi.h>
2627
2728 #include <linux/mmc/host.h>
2829 #include <linux/mmc/pm.h>
@@ -72,9 +73,16 @@ struct sdhci_acpi_host { · 43 unmodified lines
7273 const struct sdhci_acpi_slot *slot;
7374 struct platform_device *pdev;
7475 bool use_runtime_pm;
76+ bool is_intel;
77+ bool reset_signal_volt_on_suspend;
7578 unsigned long private[0] ____cacheline_aligned;
7679 };
7780
81+enum {
82+ DMI_QUIRK_RESET_SD_SIGNAL_VOLT_ON_SUSP = BIT(0),
83+ DMI_QUIRK_SD_NO_WRITE_PROTECT = BIT(1),
84+};
85+
7886 static inline void *sdhci_acpi_priv(struct sdhci_acpi_host *c)
7987 {
8088 return (void *)c->private;
@@ -391,6 +399,8 @@ static int intel_probe_slot(struct platform_device *pdev, struct acpi_device *ad · 310 unmodified lines
391399 host->mmc_host_ops.start_signal_voltage_switch =
392400 intel_start_signal_voltage_switch;
393401
402+ c->is_intel = true;
403+
394404 return 0;
395405 }
396406
@@ -647,6 +657,36 @@ static const struct acpi_device_id sdhci_acpi_ids[] = { · 250 unmodified lines
647657 };
648658 MODULE_DEVICE_TABLE(acpi, sdhci_acpi_ids);
649659
660+static const struct dmi_system_id sdhci_acpi_quirks[] = {
661+ {
662+ /*
663+ * The Lenovo Miix 320-10ICR has a bug in the _PS0 method of
664+ * the SHC1 ACPI device, this bug causes it to reprogram the
665+ * wrong LDO (DLDO3) to 1.8V if 1.8V modes are used and the
666+ * card is (runtime) suspended + resumed. DLDO3 is used for
667+ * the LCD and setting it to 1.8V causes the LCD to go black.
668+ */
669+ .matches = {
670+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
671+ DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"),
672+ },
673+ .driver_data = (void *)DMI_QUIRK_RESET_SD_SIGNAL_VOLT_ON_SUSP,
674+ },
675+ {
676+ /*
677+ * The Acer Aspire Switch 10 (SW5-012) microSD slot always
678+ * reports the card being write-protected even though microSD
679+ * cards do not have a write-protect switch at all.
680+ */
681+ .matches = {
682+ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
683+ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire SW5-012"),
684+ },
685+ .driver_data = (void *)DMI_QUIRK_SD_NO_WRITE_PROTECT,
686+ },
687+ {} /* Terminating entry */
688+};
689+
650690 static const struct sdhci_acpi_slot *sdhci_acpi_get_slot(struct acpi_device *adev)
651691 {
652692 const struct sdhci_acpi_uid_slot *u;
@@ -663,17 +703,23 @@ static int sdhci_acpi_probe(struct platform_device *pdev) · 10 unmodified lines
663703 struct device *dev = &pdev->dev;
664704 const struct sdhci_acpi_slot *slot;
665705 struct acpi_device *device, *child;
706+ const struct dmi_system_id *id;
666707 struct sdhci_acpi_host *c;
667708 struct sdhci_host *host;
668709 struct resource *iomem;
669710 resource_size_t len;
670711 size_t priv_size;
712+ int quirks = 0;
671713 int err;
672714
673715 device = ACPI_COMPANION(dev);
674716 if (!device)
675717 return -ENODEV;
676718
719+ id = dmi_first_match(sdhci_acpi_quirks);
720+ if (id)
721+ quirks = (long)id->driver_data;
722+
677723 slot = sdhci_acpi_get_slot(device);
678724
679725 /* Power on the SDHCI controller and its children */
@@ -759,6 +805,12 @@ static int sdhci_acpi_probe(struct platform_device *pdev) · 79 unmodified lines
759805 dev_warn(dev, "failed to setup card detect gpio\n");
760806 c->use_runtime_pm = false;
761807 }
808+
809+ if (quirks & DMI_QUIRK_RESET_SD_SIGNAL_VOLT_ON_SUSP)
810+ c->reset_signal_volt_on_suspend = true;
811+
812+ if (quirks & DMI_QUIRK_SD_NO_WRITE_PROTECT)
813+ host->mmc->caps2 |= MMC_CAP2_NO_WRITE_PROTECT;
762814 }
763815
764816 err = sdhci_setup_host(host);
@@ -823,17 +875,39 @@ static int sdhci_acpi_remove(struct platform_device *pdev) · 58 unmodified lines
823875 return 0;
824876 }
825877
878+static void __maybe_unused sdhci_acpi_reset_signal_voltage_if_needed(
879+ struct device *dev)
880+{
881+ struct sdhci_acpi_host *c = dev_get_drvdata(dev);
882+ struct sdhci_host *host = c->host;
883+
884+ if (c->is_intel && c->reset_signal_volt_on_suspend &&
885+ host->mmc->ios.signal_voltage != MMC_SIGNAL_VOLTAGE_330) {
886+ struct intel_host *intel_host = sdhci_acpi_priv(c);
887+ unsigned int fn = INTEL_DSM_V33_SWITCH;
888+ u32 result = 0;
889+
890+ intel_dsm(intel_host, dev, fn, &result);
891+ }
892+}
893+
826894 #ifdef CONFIG_PM_SLEEP
827895
828896 static int sdhci_acpi_suspend(struct device *dev)
829897 {
830898 struct sdhci_acpi_host *c = dev_get_drvdata(dev);
831899 struct sdhci_host *host = c->host;
900+ int ret;
832901
833902 if (host->tuning_mode != SDHCI_TUNING_MODE_3)
834903 mmc_retune_needed(host->mmc);
835904
836− return sdhci_suspend_host(host);
905+ ret = sdhci_suspend_host(host);
906+ if (ret)
907+ return ret;
908+
909+ sdhci_acpi_reset_signal_voltage_if_needed(dev);
910+ return 0;
837911 }
838912
839913 static int sdhci_acpi_resume(struct device *dev)
@@ -853,11 +927,17 @@ static int sdhci_acpi_runtime_suspend(struct device *dev) · 13 unmodified lines
853927 {
854928 struct sdhci_acpi_host *c = dev_get_drvdata(dev);
855929 struct sdhci_host *host = c->host;
930+ int ret;
856931
857932 if (host->tuning_mode != SDHCI_TUNING_MODE_3)
858933 mmc_retune_needed(host->mmc);
859934
860− return sdhci_runtime_suspend_host(host);
935+ ret = sdhci_runtime_suspend_host(host);
936+ if (ret)
937+ return ret;
938+
939+ sdhci_acpi_reset_signal_voltage_if_needed(dev);
940+ return 0;
861941 }
862942
863943 static int sdhci_acpi_runtime_resume(struct device *dev)
drivers/mmc/host/sdhci-cadence.c+16−2
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111 #include <linux/mmc/host.h>
1212 #include <linux/mmc/mmc.h>
1313 #include <linux/of.h>
14+#include <linux/of_device.h>
1415
1516 #include "sdhci-pltfm.h"
1617
@@ -235,6 +236,11 @@ static const struct sdhci_ops sdhci_cdns_ops = { · 218 unmodified lines
235236 .set_uhs_signaling = sdhci_cdns_set_uhs_signaling,
236237 };
237238
239+static const struct sdhci_pltfm_data sdhci_cdns_uniphier_pltfm_data = {
240+ .ops = &sdhci_cdns_ops,
241+ .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
242+};
243+
238244 static const struct sdhci_pltfm_data sdhci_cdns_pltfm_data = {
239245 .ops = &sdhci_cdns_ops,
240246 };
@@ -334,6 +340,7 @@ static void sdhci_cdns_hs400_enhanced_strobe(struct mmc_host *mmc, · 93 unmodified lines
334340 static int sdhci_cdns_probe(struct platform_device *pdev)
335341 {
336342 struct sdhci_host *host;
343+ const struct sdhci_pltfm_data *data;
337344 struct sdhci_pltfm_host *pltfm_host;
338345 struct sdhci_cdns_priv *priv;
339346 struct clk *clk;
@@ -350,8 +357,12 @@ static int sdhci_cdns_probe(struct platform_device *pdev) · 10 unmodified lines
350357 if (ret)
351358 return ret;
352359
360+ data = of_device_get_match_data(dev);
361+ if (!data)
362+ data = &sdhci_cdns_pltfm_data;
363+
353364 nr_phy_params = sdhci_cdns_phy_param_count(dev->of_node);
354− host = sdhci_pltfm_init(pdev, &sdhci_cdns_pltfm_data,
365+ host = sdhci_pltfm_init(pdev, data,
355366 struct_size(priv, phy_params, nr_phy_params));
356367 if (IS_ERR(host)) {
357368 ret = PTR_ERR(host);
@@ -431,7 +442,10 @@ static const struct dev_pm_ops sdhci_cdns_pm_ops = { · 73 unmodified lines
431442 };
432443
433444 static const struct of_device_id sdhci_cdns_match[] = {
434− { .compatible = "socionext,uniphier-sd4hc" },
445+ {
446+ .compatible = "socionext,uniphier-sd4hc",
447+ .data = &sdhci_cdns_uniphier_pltfm_data,
448+ },
435449 { .compatible = "cdns,sd4hc" },
436450 { /* sentinel */ }
437451 };
drivers/mmc/host/sdhci-msm.c+1−1
@@ -1590,7 +1590,7 @@ static u32 sdhci_msm_cqe_irq(struct sdhci_host *host, u32 intmask) · 1589 unmodified lines
15901590 return 0;
15911591 }
15921592
1593−void sdhci_msm_cqe_disable(struct mmc_host *mmc, bool recovery)
1593+static void sdhci_msm_cqe_disable(struct mmc_host *mmc, bool recovery)
15941594 {
15951595 struct sdhci_host *host = mmc_priv(mmc);
15961596 unsigned long flags;
drivers/mmc/host/sdhci-of-at91.c+6−2
@@ -132,7 +132,8 @@ static void sdhci_at91_reset(struct sdhci_host *host, u8 mask) · 131 unmodified lines
132132
133133 sdhci_reset(host, mask);
134134
135− if (host->mmc->caps & MMC_CAP_NONREMOVABLE)
135+ if ((host->mmc->caps & MMC_CAP_NONREMOVABLE)
136+ || mmc_gpio_get_cd(host->mmc) >= 0)
136137 sdhci_at91_set_force_card_detect(host);
137138
138139 if (priv->cal_always_on && (mask & SDHCI_RESET_ALL))
@@ -427,8 +428,11 @@ static int sdhci_at91_probe(struct platform_device *pdev) · 288 unmodified lines
427428 * detection procedure using the SDMCC_CD signal is bypassed.
428429 * This bit is reset when a software reset for all command is performed
429430 * so we need to implement our own reset function to set back this bit.
431+ *
432+ * WA: SAMA5D2 doesn't drive CMD if using CD GPIO line.
430433 */
431− if (host->mmc->caps & MMC_CAP_NONREMOVABLE)
434+ if ((host->mmc->caps & MMC_CAP_NONREMOVABLE)
435+ || mmc_gpio_get_cd(host->mmc) >= 0)
432436 sdhci_at91_set_force_card_detect(host);
433437
434438 pm_runtime_put_autosuspend(&pdev->dev);
drivers/mmc/host/sdhci-omap.c+3−0
@@ -1192,6 +1192,9 @@ static int sdhci_omap_probe(struct platform_device *pdev) · 1191 unmodified lines
11921192 if (of_find_property(dev->of_node, "dmas", NULL))
11931193 sdhci_switch_external_dma(host, true);
11941194
1195+ /* R1B responses is required to properly manage HW busy detection. */
1196+ mmc->caps |= MMC_CAP_NEED_RSP_BUSY;
1197+
11951198 ret = sdhci_setup_host(host);
11961199 if (ret)
11971200 goto err_put_sync;
drivers/mmc/host/sdhci-pci-gli.c+17−0
@@ -262,10 +262,26 @@ static int gl9750_execute_tuning(struct sdhci_host *host, u32 opcode) · 261 unmodified lines
262262 return 0;
263263 }
264264
265+static void gli_pcie_enable_msi(struct sdhci_pci_slot *slot)
266+{
267+ int ret;
268+
269+ ret = pci_alloc_irq_vectors(slot->chip->pdev, 1, 1,
270+ PCI_IRQ_MSI | PCI_IRQ_MSIX);
271+ if (ret < 0) {
272+ pr_warn("%s: enable PCI MSI failed, error=%d\n",
273+ mmc_hostname(slot->host->mmc), ret);
274+ return;
275+ }
276+
277+ slot->host->irq = pci_irq_vector(slot->chip->pdev, 0);
278+}
279+
265280 static int gli_probe_slot_gl9750(struct sdhci_pci_slot *slot)
266281 {
267282 struct sdhci_host *host = slot->host;
268283
284+ gli_pcie_enable_msi(slot);
269285 slot->host->mmc->caps2 |= MMC_CAP2_NO_SDIO;
270286 sdhci_enable_v4_mode(host);
271287
@@ -276,6 +292,7 @@ static int gli_probe_slot_gl9755(struct sdhci_pci_slot *slot) · 4 unmodified lines
276292 {
277293 struct sdhci_host *host = slot->host;
278294
295+ gli_pcie_enable_msi(slot);
279296 slot->host->mmc->caps2 |= MMC_CAP2_NO_SDIO;
280297 sdhci_enable_v4_mode(host);
281298
drivers/mmc/host/sdhci-tegra.c+3−0
@@ -1552,6 +1552,9 @@ static int sdhci_tegra_probe(struct platform_device *pdev) · 1551 unmodified lines
15521552 if (tegra_host->soc_data->nvquirks & NVQUIRK_ENABLE_DDR50)
15531553 host->mmc->caps |= MMC_CAP_1_8V_DDR;
15541554
1555+ /* R1B responses is required to properly manage HW busy detection. */
1556+ host->mmc->caps |= MMC_CAP_NEED_RSP_BUSY;
1557+
15551558 tegra_sdhci_parse_dt(host);
15561559
15571560 tegra_host->power_gpio = devm_gpiod_get_optional(&pdev->dev, "power",
drivers/net/bonding/bond_alb.c+10−10
@@ -50,11 +50,6 @@ struct arp_pkt { · 49 unmodified lines
5050 };
5151 #pragma pack()
5252
53−static inline struct arp_pkt *arp_pkt(const struct sk_buff *skb)
54−{
55− return (struct arp_pkt *)skb_network_header(skb);
56−}
57−
5853 /* Forward declaration */
5954 static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[],
6055 bool strict_match);
@@ -553,10 +548,11 @@ static void rlb_req_update_subnet_clients(struct bonding *bond, __be32 src_ip) · 492 unmodified lines
553548 spin_unlock(&bond->mode_lock);
554549 }
555550
556−static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bond)
551+static struct slave *rlb_choose_channel(struct sk_buff *skb,
552+ struct bonding *bond,
553+ const struct arp_pkt *arp)
557554 {
558555 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
559− struct arp_pkt *arp = arp_pkt(skb);
560556 struct slave *assigned_slave, *curr_active_slave;
561557 struct rlb_client_info *client_info;
562558 u32 hash_index = 0;
@@ -653,8 +649,12 @@ static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bon · 90 unmodified lines
653649 */
654650 static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond)
655651 {
656− struct arp_pkt *arp = arp_pkt(skb);
657652 struct slave *tx_slave = NULL;
653+ struct arp_pkt *arp;
654+
655+ if (!pskb_network_may_pull(skb, sizeof(*arp)))
656+ return NULL;
657+ arp = (struct arp_pkt *)skb_network_header(skb);
658658
659659 /* Don't modify or load balance ARPs that do not originate locally
660660 * (e.g.,arrive via a bridge).
@@ -664,7 +664,7 @@ static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond) · 3 unmodified lines
664664
665665 if (arp->op_code == htons(ARPOP_REPLY)) {
666666 /* the arp must be sent on the selected rx channel */
667− tx_slave = rlb_choose_channel(skb, bond);
667+ tx_slave = rlb_choose_channel(skb, bond, arp);
668668 if (tx_slave)
669669 bond_hw_addr_copy(arp->mac_src, tx_slave->dev->dev_addr,
670670 tx_slave->dev->addr_len);
@@ -676,7 +676,7 @@ static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond) · 5 unmodified lines
676676 * When the arp reply is received the entry will be updated
677677 * with the correct unicast address of the client.
678678 */
679− tx_slave = rlb_choose_channel(skb, bond);
679+ tx_slave = rlb_choose_channel(skb, bond, arp);
680680
681681 /* The ARP reply packets must be delayed so that
682682 * they can cancel out the influence of the ARP request.
drivers/net/can/dev.c+1−0
@@ -883,6 +883,7 @@ static const struct nla_policy can_policy[IFLA_CAN_MAX + 1] = { · 882 unmodified lines
883883 = { .len = sizeof(struct can_bittiming) },
884884 [IFLA_CAN_DATA_BITTIMING_CONST]
885885 = { .len = sizeof(struct can_bittiming_const) },
886+ [IFLA_CAN_TERMINATION] = { .type = NLA_U16 },
886887 };
887888
888889 static int can_validate(struct nlattr *tb[], struct nlattr *data[],
drivers/net/dsa/mv88e6xxx/chip.c+2−0
@@ -2769,6 +2769,8 @@ static u64 mv88e6xxx_devlink_atu_bin_get(struct mv88e6xxx_chip *chip, · 2768 unmodified lines
27692769 goto unlock;
27702770 }
27712771
2772+ occupancy &= MV88E6XXX_G2_ATU_STATS_MASK;
2773+
27722774 unlock:
27732775 mv88e6xxx_reg_unlock(chip);
27742776
drivers/net/dsa/mv88e6xxx/global2.c+7−1
@@ -1099,6 +1099,13 @@ int mv88e6xxx_g2_irq_setup(struct mv88e6xxx_chip *chip) · 1098 unmodified lines
10991099 {
11001100 int err, irq, virq;
11011101
1102+ chip->g2_irq.masked = ~0;
1103+ mv88e6xxx_reg_lock(chip);
1104+ err = mv88e6xxx_g2_int_mask(chip, ~chip->g2_irq.masked);
1105+ mv88e6xxx_reg_unlock(chip);
1106+ if (err)
1107+ return err;
1108+
11021109 chip->g2_irq.domain = irq_domain_add_simple(
11031110 chip->dev->of_node, 16, 0, &mv88e6xxx_g2_irq_domain_ops, chip);
11041111 if (!chip->g2_irq.domain)
@@ -1108,7 +1115,6 @@ int mv88e6xxx_g2_irq_setup(struct mv88e6xxx_chip *chip) · 3 unmodified lines
11081115 irq_create_mapping(chip->g2_irq.domain, irq);
11091116
11101117 chip->g2_irq.chip = mv88e6xxx_g2_irq_chip;
1111− chip->g2_irq.masked = ~0;
11121118
11131119 chip->device_irq = irq_find_mapping(chip->g1_irq.domain,
11141120 MV88E6XXX_G1_STS_IRQ_DEVICE);
drivers/net/dsa/sja1105/sja1105_main.c+2−1
@@ -1741,7 +1741,8 @@ static void sja1105_teardown(struct dsa_switch *ds) · 1740 unmodified lines
17411741 if (!dsa_is_user_port(ds, port))
17421742 continue;
17431743
1744− kthread_destroy_worker(sp->xmit_worker);
1744+ if (sp->xmit_worker)
1745+ kthread_destroy_worker(sp->xmit_worker);
17451746 }
17461747
17471748 sja1105_tas_teardown(ds);
drivers/net/ethernet/broadcom/bcmsysport.c+1−1
@@ -2135,7 +2135,7 @@ static int bcm_sysport_rule_set(struct bcm_sysport_priv *priv, · 2134 unmodified lines
21352135 return -ENOSPC;
21362136
21372137 index = find_first_zero_bit(priv->filters, RXCHK_BRCM_TAG_MAX);
2138− if (index > RXCHK_BRCM_TAG_MAX)
2138+ if (index >= RXCHK_BRCM_TAG_MAX)
21392139 return -ENOSPC;
21402140
21412141 /* Location is the classification ID, and index is the position
drivers/net/ethernet/broadcom/bnxt/bnxt.c+2−2
@@ -10982,13 +10982,13 @@ static int bnxt_change_mtu(struct net_device *dev, int new_mtu) · 10981 unmodified lines
1098210982 struct bnxt *bp = netdev_priv(dev);
1098310983
1098410984 if (netif_running(dev))
10985− bnxt_close_nic(bp, false, false);
10985+ bnxt_close_nic(bp, true, false);
1098610986
1098710987 dev->mtu = new_mtu;
1098810988 bnxt_set_ring_params(bp);
1098910989
1099010990 if (netif_running(dev))
10991− return bnxt_open_nic(bp, false, false);
10991+ return bnxt_open_nic(bp, true, false);
1099210992
1099310993 return 0;
1099410994 }
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c+11−13
@@ -2007,8 +2007,8 @@ int bnxt_flash_package_from_file(struct net_device *dev, const char *filename, · 2006 unmodified lines
20072007 struct hwrm_nvm_install_update_output *resp = bp->hwrm_cmd_resp_addr;
20082008 struct hwrm_nvm_install_update_input install = {0};
20092009 const struct firmware *fw;
2010− int rc, hwrm_err = 0;
20112010 u32 item_len;
2011+ int rc = 0;
20122012 u16 index;
20132013
20142014 bnxt_hwrm_fw_set_time(bp);
@@ -2052,15 +2052,14 @@ int bnxt_flash_package_from_file(struct net_device *dev, const char *filename, · 37 unmodified lines
20522052 memcpy(kmem, fw->data, fw->size);
20532053 modify.host_src_addr = cpu_to_le64(dma_handle);
20542054
2055− hwrm_err = hwrm_send_message(bp, &modify,
2056− sizeof(modify),
2057− FLASH_PACKAGE_TIMEOUT);
2055+ rc = hwrm_send_message(bp, &modify, sizeof(modify),
2056+ FLASH_PACKAGE_TIMEOUT);
20582057 dma_free_coherent(&bp->pdev->dev, fw->size, kmem,
20592058 dma_handle);
20602059 }
20612060 }
20622061 release_firmware(fw);
2063− if (rc || hwrm_err)
2062+ if (rc)
20642063 goto err_exit;
20652064
20662065 if ((install_type & 0xffff) == 0)
@@ -2069,20 +2068,19 @@ int bnxt_flash_package_from_file(struct net_device *dev, const char *filename, · 2 unmodified lines
20692068 install.install_type = cpu_to_le32(install_type);
20702069
20712070 mutex_lock(&bp->hwrm_cmd_lock);
2072− hwrm_err = _hwrm_send_message(bp, &install, sizeof(install),
2073− INSTALL_PACKAGE_TIMEOUT);
2074− if (hwrm_err) {
2071+ rc = _hwrm_send_message(bp, &install, sizeof(install),
2072+ INSTALL_PACKAGE_TIMEOUT);
2073+ if (rc) {
20752074 u8 error_code = ((struct hwrm_err_output *)resp)->cmd_err;
20762075
20772076 if (resp->error_code && error_code ==
20782077 NVM_INSTALL_UPDATE_CMD_ERR_CODE_FRAG_ERR) {
20792078 install.flags |= cpu_to_le16(
20802079 NVM_INSTALL_UPDATE_REQ_FLAGS_ALLOWED_TO_DEFRAG);
2081− hwrm_err = _hwrm_send_message(bp, &install,
2082− sizeof(install),
2083− INSTALL_PACKAGE_TIMEOUT);
2080+ rc = _hwrm_send_message(bp, &install, sizeof(install),
2081+ INSTALL_PACKAGE_TIMEOUT);
20842082 }
2085− if (hwrm_err)
2083+ if (rc)
20862084 goto flash_pkg_exit;
20872085 }
20882086
@@ -2094,7 +2092,7 @@ int bnxt_flash_package_from_file(struct net_device *dev, const char *filename, · 5 unmodified lines
20942092 flash_pkg_exit:
20952093 mutex_unlock(&bp->hwrm_cmd_lock);
20962094 err_exit:
2097− if (hwrm_err == -EACCES)
2095+ if (rc == -EACCES)
20982096 bnxt_print_admin_err(bp);
20992097 return rc;
21002098 }
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c+27−22
@@ -5381,12 +5381,11 @@ static inline bool is_x_10g_port(const struct link_config *lc) · 5380 unmodified lines
53815381 static int cfg_queues(struct adapter *adap)
53825382 {
53835383 u32 avail_qsets, avail_eth_qsets, avail_uld_qsets;
5384+ u32 i, n10g = 0, qidx = 0, n1g = 0;
5385+ u32 ncpus = num_online_cpus();
53845386 u32 niqflint, neq, num_ulds;
53855387 struct sge *s = &adap->sge;
5386− u32 i, n10g = 0, qidx = 0;
5387−#ifndef CONFIG_CHELSIO_T4_DCB
5388− int q10g = 0;
5389−#endif
5388+ u32 q10g = 0, q1g;
53905389
53915390 /* Reduce memory usage in kdump environment, disable all offload. */
53925391 if (is_kdump_kernel() || (is_uld(adap) && t4_uld_mem_alloc(adap))) {
@@ -5424,44 +5423,50 @@ static int cfg_queues(struct adapter *adap) · 31 unmodified lines
54245423 n10g += is_x_10g_port(&adap2pinfo(adap, i)->link_cfg);
54255424
54265425 avail_eth_qsets = min_t(u32, avail_qsets, MAX_ETH_QSETS);
5426+
5427+ /* We default to 1 queue per non-10G port and up to # of cores queues
5428+ * per 10G port.
5429+ */
5430+ if (n10g)
5431+ q10g = (avail_eth_qsets - (adap->params.nports - n10g)) / n10g;
5432+
5433+ n1g = adap->params.nports - n10g;
54275434 #ifdef CONFIG_CHELSIO_T4_DCB
54285435 /* For Data Center Bridging support we need to be able to support up
54295436 * to 8 Traffic Priorities; each of which will be assigned to its
54305437 * own TX Queue in order to prevent Head-Of-Line Blocking.
54315438 */
5439+ q1g = 8;
54325440 if (adap->params.nports * 8 > avail_eth_qsets) {
54335441 dev_err(adap->pdev_dev, "DCB avail_eth_qsets=%d < %d!\n",
54345442 avail_eth_qsets, adap->params.nports * 8);
54355443 return -ENOMEM;
54365444 }
54375445
5438− for_each_port(adap, i) {
5439− struct port_info *pi = adap2pinfo(adap, i);
5446+ if (adap->params.nports * ncpus < avail_eth_qsets)
5447+ q10g = max(8U, ncpus);
5448+ else
5449+ q10g = max(8U, q10g);
54405450
5441− pi->first_qset = qidx;
5442− pi->nqsets = is_kdump_kernel() ? 1 : 8;
5443− qidx += pi->nqsets;
5444− }
5445−#else /* !CONFIG_CHELSIO_T4_DCB */
5446− /* We default to 1 queue per non-10G port and up to # of cores queues
5447− * per 10G port.
5448− */
5449− if (n10g)
5450− q10g = (avail_eth_qsets - (adap->params.nports - n10g)) / n10g;
5451− if (q10g > netif_get_num_default_rss_queues())
5452− q10g = netif_get_num_default_rss_queues();
5451+ while ((q10g * n10g) > (avail_eth_qsets - n1g * q1g))
5452+ q10g--;
54535453
5454− if (is_kdump_kernel())
5454+#else /* !CONFIG_CHELSIO_T4_DCB */
5455+ q1g = 1;
5456+ q10g = min(q10g, ncpus);
5457+#endif /* !CONFIG_CHELSIO_T4_DCB */
5458+ if (is_kdump_kernel()) {
54555459 q10g = 1;
5460+ q1g = 1;
5461+ }
54565462
54575463 for_each_port(adap, i) {
54585464 struct port_info *pi = adap2pinfo(adap, i);
54595465
54605466 pi->first_qset = qidx;
5461− pi->nqsets = is_x_10g_port(&pi->link_cfg) ? q10g : 1;
5467+ pi->nqsets = is_x_10g_port(&pi->link_cfg) ? q10g : q1g;
54625468 qidx += pi->nqsets;
54635469 }
5464−#endif /* !CONFIG_CHELSIO_T4_DCB */
54655470
54665471 s->ethqsets = qidx;
54675472 s->max_ethqsets = qidx; /* MSI-X may lower it later */
@@ -5473,7 +5478,7 @@ static int cfg_queues(struct adapter *adap) · 5 unmodified lines
54735478 * capped by the number of available cores.
54745479 */
54755480 num_ulds = adap->num_uld + adap->num_ofld_uld;
5476− i = min_t(u32, MAX_OFLD_QSETS, num_online_cpus());
5481+ i = min_t(u32, MAX_OFLD_QSETS, ncpus);
54775482 avail_uld_qsets = roundup(i, adap->params.nports);
54785483 if (avail_qsets < num_ulds * adap->params.nports) {
54795484 adap->params.offload = 0;
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c+108−6
@@ -1,4 +1,5 @@
11 /* Copyright 2008 - 2016 Freescale Semiconductor Inc.
2+ * Copyright 2020 NXP
23 *
34 * Redistribution and use in source and binary forms, with or without
45 * modification, are permitted provided that the following conditions are met:
@@ -123,7 +124,22 @@ MODULE_PARM_DESC(tx_timeout, "The Tx timeout in ms"); · 118 unmodified lines
123124 #define FSL_QMAN_MAX_OAL 127
124125
125126 /* Default alignment for start of data in an Rx FD */
127+#ifdef CONFIG_DPAA_ERRATUM_A050385
128+/* aligning data start to 64 avoids DMA transaction splits, unless the buffer
129+ * is crossing a 4k page boundary
130+ */
131+#define DPAA_FD_DATA_ALIGNMENT (fman_has_errata_a050385() ? 64 : 16)
132+/* aligning to 256 avoids DMA transaction splits caused by 4k page boundary
133+ * crossings; also, all SG fragments except the last must have a size multiple
134+ * of 256 to avoid DMA transaction splits
135+ */
136+#define DPAA_A050385_ALIGN 256
137+#define DPAA_FD_RX_DATA_ALIGNMENT (fman_has_errata_a050385() ? \
138+ DPAA_A050385_ALIGN : 16)
139+#else
126140 #define DPAA_FD_DATA_ALIGNMENT 16
141+#define DPAA_FD_RX_DATA_ALIGNMENT DPAA_FD_DATA_ALIGNMENT
142+#endif
127143
128144 /* The DPAA requires 256 bytes reserved and mapped for the SGT */
129145 #define DPAA_SGT_SIZE 256
@@ -158,8 +174,13 @@ MODULE_PARM_DESC(tx_timeout, "The Tx timeout in ms"); · 28 unmodified lines
158174 #define DPAA_PARSE_RESULTS_SIZE sizeof(struct fman_prs_result)
159175 #define DPAA_TIME_STAMP_SIZE 8
160176 #define DPAA_HASH_RESULTS_SIZE 8
177+#ifdef CONFIG_DPAA_ERRATUM_A050385
178+#define DPAA_RX_PRIV_DATA_SIZE (DPAA_A050385_ALIGN - (DPAA_PARSE_RESULTS_SIZE\
179+ + DPAA_TIME_STAMP_SIZE + DPAA_HASH_RESULTS_SIZE))
180+#else
161181 #define DPAA_RX_PRIV_DATA_SIZE (u16)(DPAA_TX_PRIV_DATA_SIZE + \
162182 dpaa_rx_extra_headroom)
183+#endif
163184
164185 #define DPAA_ETH_PCD_RXQ_NUM 128
165186
@@ -180,7 +201,12 @@ static struct dpaa_bp *dpaa_bp_array[BM_MAX_NUM_OF_POOLS]; · 14 unmodified lines
180201
181202 #define DPAA_BP_RAW_SIZE 4096
182203
204+#ifdef CONFIG_DPAA_ERRATUM_A050385
205+#define dpaa_bp_size(raw_size) (SKB_WITH_OVERHEAD(raw_size) & \
206+ ~(DPAA_A050385_ALIGN - 1))
207+#else
183208 #define dpaa_bp_size(raw_size) SKB_WITH_OVERHEAD(raw_size)
209+#endif
184210
185211 static int dpaa_max_frm;
186212
@@ -1192,7 +1218,7 @@ static int dpaa_eth_init_rx_port(struct fman_port *port, struct dpaa_bp *bp, · 1005 unmodified lines
11921218 buf_prefix_content.pass_prs_result = true;
11931219 buf_prefix_content.pass_hash_result = true;
11941220 buf_prefix_content.pass_time_stamp = true;
1195− buf_prefix_content.data_align = DPAA_FD_DATA_ALIGNMENT;
1221+ buf_prefix_content.data_align = DPAA_FD_RX_DATA_ALIGNMENT;
11961222
11971223 rx_p = &params.specific_params.rx_params;
11981224 rx_p->err_fqid = errq->fqid;
@@ -1662,6 +1688,8 @@ static u8 rx_csum_offload(const struct dpaa_priv *priv, const struct qm_fd *fd) · 463 unmodified lines
16621688 return CHECKSUM_NONE;
16631689 }
16641690
1691+#define PTR_IS_ALIGNED(x, a) (IS_ALIGNED((unsigned long)(x), (a)))
1692+
16651693 /* Build a linear skb around the received buffer.
16661694 * We are guaranteed there is enough room at the end of the data buffer to
16671695 * accommodate the shared info area of the skb.
@@ -1733,8 +1761,7 @@ static struct sk_buff *sg_fd_to_skb(const struct dpaa_priv *priv, · 65 unmodified lines
17331761
17341762 sg_addr = qm_sg_addr(&sgt[i]);
17351763 sg_vaddr = phys_to_virt(sg_addr);
1736− WARN_ON(!IS_ALIGNED((unsigned long)sg_vaddr,
1737− SMP_CACHE_BYTES));
1764+ WARN_ON(!PTR_IS_ALIGNED(sg_vaddr, SMP_CACHE_BYTES));
17381765
17391766 dma_unmap_page(priv->rx_dma_dev, sg_addr,
17401767 DPAA_BP_RAW_SIZE, DMA_FROM_DEVICE);
@@ -2022,6 +2049,75 @@ static inline int dpaa_xmit(struct dpaa_priv *priv, · 281 unmodified lines
20222049 return 0;
20232050 }
20242051
2052+#ifdef CONFIG_DPAA_ERRATUM_A050385
2053+int dpaa_a050385_wa(struct net_device *net_dev, struct sk_buff **s)
2054+{
2055+ struct dpaa_priv *priv = netdev_priv(net_dev);
2056+ struct sk_buff *new_skb, *skb = *s;
2057+ unsigned char *start, i;
2058+
2059+ /* check linear buffer alignment */
2060+ if (!PTR_IS_ALIGNED(skb->data, DPAA_A050385_ALIGN))
2061+ goto workaround;
2062+
2063+ /* linear buffers just need to have an aligned start */
2064+ if (!skb_is_nonlinear(skb))
2065+ return 0;
2066+
2067+ /* linear data size for nonlinear skbs needs to be aligned */
2068+ if (!IS_ALIGNED(skb_headlen(skb), DPAA_A050385_ALIGN))
2069+ goto workaround;
2070+
2071+ for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
2072+ skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
2073+
2074+ /* all fragments need to have aligned start addresses */
2075+ if (!IS_ALIGNED(skb_frag_off(frag), DPAA_A050385_ALIGN))
2076+ goto workaround;
2077+
2078+ /* all but last fragment need to have aligned sizes */
2079+ if (!IS_ALIGNED(skb_frag_size(frag), DPAA_A050385_ALIGN) &&
2080+ (i < skb_shinfo(skb)->nr_frags - 1))
2081+ goto workaround;
2082+ }
2083+
2084+ return 0;
2085+
2086+workaround:
2087+ /* copy all the skb content into a new linear buffer */
2088+ new_skb = netdev_alloc_skb(net_dev, skb->len + DPAA_A050385_ALIGN - 1 +
2089+ priv->tx_headroom);
2090+ if (!new_skb)
2091+ return -ENOMEM;
2092+
2093+ /* NET_SKB_PAD bytes already reserved, adding up to tx_headroom */
2094+ skb_reserve(new_skb, priv->tx_headroom - NET_SKB_PAD);
2095+
2096+ /* Workaround for DPAA_A050385 requires data start to be aligned */
2097+ start = PTR_ALIGN(new_skb->data, DPAA_A050385_ALIGN);
2098+ if (start - new_skb->data != 0)
2099+ skb_reserve(new_skb, start - new_skb->data);
2100+
2101+ skb_put(new_skb, skb->len);
2102+ skb_copy_bits(skb, 0, new_skb->data, skb->len);
2103+ skb_copy_header(new_skb, skb);
2104+ new_skb->dev = skb->dev;
2105+
2106+ /* We move the headroom when we align it so we have to reset the
2107+ * network and transport header offsets relative to the new data
2108+ * pointer. The checksum offload relies on these offsets.
2109+ */
2110+ skb_set_network_header(new_skb, skb_network_offset(skb));
2111+ skb_set_transport_header(new_skb, skb_transport_offset(skb));
2112+
2113+ /* TODO: does timestamping need the result in the old skb? */
2114+ dev_kfree_skb(skb);
2115+ *s = new_skb;
2116+
2117+ return 0;
2118+}
2119+#endif
2120+
20252121 static netdev_tx_t
20262122 dpaa_start_xmit(struct sk_buff *skb, struct net_device *net_dev)
20272123 {
@@ -2068,6 +2164,14 @@ dpaa_start_xmit(struct sk_buff *skb, struct net_device *net_dev) · 40 unmodified lines
20682164 nonlinear = skb_is_nonlinear(skb);
20692165 }
20702166
2167+#ifdef CONFIG_DPAA_ERRATUM_A050385
2168+ if (unlikely(fman_has_errata_a050385())) {
2169+ if (dpaa_a050385_wa(net_dev, &skb))
2170+ goto enomem;
2171+ nonlinear = skb_is_nonlinear(skb);
2172+ }
2173+#endif
2174+
20712175 if (nonlinear) {
20722176 /* Just create a S/G fd based on the skb */
20732177 err = skb_to_sg_fd(priv, skb, &fd);
@@ -2741,9 +2845,7 @@ static inline u16 dpaa_get_headroom(struct dpaa_buffer_layout *bl) · 667 unmodified lines
27412845 headroom = (u16)(bl->priv_data_size + DPAA_PARSE_RESULTS_SIZE +
27422846 DPAA_TIME_STAMP_SIZE + DPAA_HASH_RESULTS_SIZE);
27432847
2744− return DPAA_FD_DATA_ALIGNMENT ? ALIGN(headroom,
2745− DPAA_FD_DATA_ALIGNMENT) :
2746− headroom;
2848+ return ALIGN(headroom, DPAA_FD_DATA_ALIGNMENT);
27472849 }
27482850
27492851 static int dpaa_eth_probe(struct platform_device *pdev)
drivers/net/ethernet/freescale/fec_main.c+3−3
@@ -2529,15 +2529,15 @@ fec_enet_set_coalesce(struct net_device *ndev, struct ethtool_coalesce *ec) · 2528 unmodified lines
25292529 return -EINVAL;
25302530 }
25312531
2532− cycle = fec_enet_us_to_itr_clock(ndev, fep->rx_time_itr);
2532+ cycle = fec_enet_us_to_itr_clock(ndev, ec->rx_coalesce_usecs);
25332533 if (cycle > 0xFFFF) {
25342534 dev_err(dev, "Rx coalesced usec exceed hardware limitation\n");
25352535 return -EINVAL;
25362536 }
25372537
2538− cycle = fec_enet_us_to_itr_clock(ndev, fep->tx_time_itr);
2538+ cycle = fec_enet_us_to_itr_clock(ndev, ec->tx_coalesce_usecs);
25392539 if (cycle > 0xFFFF) {
2540− dev_err(dev, "Rx coalesced usec exceed hardware limitation\n");
2540+ dev_err(dev, "Tx coalesced usec exceed hardware limitation\n");
25412541 return -EINVAL;
25422542 }
25432543
drivers/net/ethernet/freescale/fman/Kconfig+28−0
@@ -8,3 +8,31 @@ config FSL_FMAN · 7 unmodified lines
88 help
99 Freescale Data-Path Acceleration Architecture Frame Manager
1010 (FMan) support
11+
12+config DPAA_ERRATUM_A050385
13+ bool
14+ depends on ARM64 && FSL_DPAA
15+ default y
16+ help
17+ DPAA FMan erratum A050385 software workaround implementation:
18+ align buffers, data start, SG fragment length to avoid FMan DMA
19+ splits.
20+ FMAN DMA read or writes under heavy traffic load may cause FMAN
21+ internal resource leak thus stopping further packet processing.
22+ The FMAN internal queue can overflow when FMAN splits single
23+ read or write transactions into multiple smaller transactions
24+ such that more than 17 AXI transactions are in flight from FMAN
25+ to interconnect. When the FMAN internal queue overflows, it can
26+ stall further packet processing. The issue can occur with any
27+ one of the following three conditions:
28+ 1. FMAN AXI transaction crosses 4K address boundary (Errata
29+ A010022)
30+ 2. FMAN DMA address for an AXI transaction is not 16 byte
31+ aligned, i.e. the last 4 bits of an address are non-zero
32+ 3. Scatter Gather (SG) frames have more than one SG buffer in
33+ the SG list and any one of the buffers, except the last
34+ buffer in the SG list has data size that is not a multiple
35+ of 16 bytes, i.e., other than 16, 32, 48, 64, etc.
36+ With any one of the above three conditions present, there is
37+ likelihood of stalled FMAN packet processing, especially under
38+ stress with multiple ports injecting line-rate traffic.
drivers/net/ethernet/freescale/fman/fman.c+18−0
@@ -1,5 +1,6 @@
11 /*
22 * Copyright 2008-2015 Freescale Semiconductor Inc.
3+ * Copyright 2020 NXP
34 *
45 * Redistribution and use in source and binary forms, with or without
56 * modification, are permitted provided that the following conditions are met:
@@ -566,6 +567,10 @@ struct fman_cfg { · 560 unmodified lines
566567 u32 qmi_def_tnums_thresh;
567568 };
568569
570+#ifdef CONFIG_DPAA_ERRATUM_A050385
571+static bool fman_has_err_a050385;
572+#endif
573+
569574 static irqreturn_t fman_exceptions(struct fman *fman,
570575 enum fman_exceptions exception)
571576 {
@@ -2518,6 +2523,14 @@ struct fman *fman_bind(struct device *fm_dev) · 1946 unmodified lines
25182523 }
25192524 EXPORT_SYMBOL(fman_bind);
25202525
2526+#ifdef CONFIG_DPAA_ERRATUM_A050385
2527+bool fman_has_errata_a050385(void)
2528+{
2529+ return fman_has_err_a050385;
2530+}
2531+EXPORT_SYMBOL(fman_has_errata_a050385);
2532+#endif
2533+
25212534 static irqreturn_t fman_err_irq(int irq, void *handle)
25222535 {
25232536 struct fman *fman = (struct fman *)handle;
@@ -2845,6 +2858,11 @@ static struct fman *read_dts_node(struct platform_device *of_dev) · 321 unmodified lines
28452858 goto fman_free;
28462859 }
28472860
2861+#ifdef CONFIG_DPAA_ERRATUM_A050385
2862+ fman_has_err_a050385 =
2863+ of_property_read_bool(fm_node, "fsl,erratum-a050385");
2864+#endif
2865+
28482866 return fman;
28492867
28502868 fman_node_put:
drivers/net/ethernet/freescale/fman/fman.h+5−0
@@ -1,5 +1,6 @@
11 /*
22 * Copyright 2008-2015 Freescale Semiconductor Inc.
3+ * Copyright 2020 NXP
34 *
45 * Redistribution and use in source and binary forms, with or without
56 * modification, are permitted provided that the following conditions are met:
@@ -398,6 +399,10 @@ u16 fman_get_max_frm(void); · 392 unmodified lines
398399
399400 int fman_get_rx_extra_headroom(void);
400401
402+#ifdef CONFIG_DPAA_ERRATUM_A050385
403+bool fman_has_errata_a050385(void);
404+#endif
405+
401406 struct fman *fman_bind(struct device *dev);
402407
403408 #endif /* __FM_H */
drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h+1−0
@@ -46,6 +46,7 @@ enum HCLGE_MBX_OPCODE { · 45 unmodified lines
4646 HCLGE_MBX_PUSH_VLAN_INFO, /* (PF -> VF) push port base vlan */
4747 HCLGE_MBX_GET_MEDIA_TYPE, /* (VF -> PF) get media type */
4848 HCLGE_MBX_PUSH_PROMISC_INFO, /* (PF -> VF) push vf promisc info */
49+ HCLGE_MBX_VF_UNINIT, /* (VF -> PF) vf is unintializing */
4950
5051 HCLGE_MBX_GET_VF_FLR_STATUS = 200, /* (M7 -> PF) get vf flr status */
5152 HCLGE_MBX_PUSH_LINK_STATUS, /* (M7 -> PF) get port link status */
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c+1−1
@@ -1711,7 +1711,7 @@ static int hns3_setup_tc(struct net_device *netdev, void *type_data) · 1710 unmodified lines
17111711 netif_dbg(h, drv, netdev, "setup tc: num_tc=%u\n", tc);
17121712
17131713 return (kinfo->dcb_ops && kinfo->dcb_ops->setup_tc) ?
1714− kinfo->dcb_ops->setup_tc(h, tc, prio_tc) : -EOPNOTSUPP;
1714+ kinfo->dcb_ops->setup_tc(h, tc ? tc : 1, prio_tc) : -EOPNOTSUPP;
17151715 }
17161716
17171717 static int hns3_nic_setup_tc(struct net_device *dev, enum tc_setup_type type,
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c+42−5
@@ -2446,10 +2446,12 @@ static int hclge_cfg_mac_speed_dup_hw(struct hclge_dev *hdev, int speed, · 2445 unmodified lines
24462446
24472447 int hclge_cfg_mac_speed_dup(struct hclge_dev *hdev, int speed, u8 duplex)
24482448 {
2449+ struct hclge_mac *mac = &hdev->hw.mac;
24492450 int ret;
24502451
24512452 duplex = hclge_check_speed_dup(duplex, speed);
2452− if (hdev->hw.mac.speed == speed && hdev->hw.mac.duplex == duplex)
2453+ if (!mac->support_autoneg && mac->speed == speed &&
2454+ mac->duplex == duplex)
24532455 return 0;
24542456
24552457 ret = hclge_cfg_mac_speed_dup_hw(hdev, speed, duplex);
@@ -7743,16 +7745,27 @@ static int hclge_set_vlan_filter_ctrl(struct hclge_dev *hdev, u8 vlan_type, · 5287 unmodified lines
77437745 struct hclge_desc desc;
77447746 int ret;
77457747
7746− hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_VLAN_FILTER_CTRL, false);
7747−
7748+ /* read current vlan filter parameter */
7749+ hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_VLAN_FILTER_CTRL, true);
77487750 req = (struct hclge_vlan_filter_ctrl_cmd *)desc.data;
77497751 req->vlan_type = vlan_type;
7750− req->vlan_fe = filter_en ? fe_type : 0;
77517752 req->vf_id = vf_id;
77527753
7754+ ret = hclge_cmd_send(&hdev->hw, &desc, 1);
7755+ if (ret) {
7756+ dev_err(&hdev->pdev->dev,
7757+ "failed to get vlan filter config, ret = %d.\n", ret);
7758+ return ret;
7759+ }
7760+
7761+ /* modify and write new config parameter */
7762+ hclge_cmd_reuse_desc(&desc, false);
7763+ req->vlan_fe = filter_en ?
7764+ (req->vlan_fe | fe_type) : (req->vlan_fe & ~fe_type);
7765+
77537766 ret = hclge_cmd_send(&hdev->hw, &desc, 1);
77547767 if (ret)
7755− dev_err(&hdev->pdev->dev, "set vlan filter fail, ret =%d.\n",
7768+ dev_err(&hdev->pdev->dev, "failed to set vlan filter, ret = %d.\n",
77567769 ret);
77577770
77587771 return ret;
@@ -8270,6 +8283,7 @@ void hclge_rm_vport_all_vlan_table(struct hclge_vport *vport, bool is_del_list) · 511 unmodified lines
82708283 kfree(vlan);
82718284 }
82728285 }
8286+ clear_bit(vport->vport_id, hdev->vf_vlan_full);
82738287 }
82748288
82758289 void hclge_uninit_vport_vlan_table(struct hclge_dev *hdev)
@@ -8486,6 +8500,28 @@ static int hclge_set_vf_vlan_filter(struct hnae3_handle *handle, int vfid, · 210 unmodified lines
84868500 }
84878501 }
84888502
8503+static void hclge_clear_vf_vlan(struct hclge_dev *hdev)
8504+{
8505+ struct hclge_vlan_info *vlan_info;
8506+ struct hclge_vport *vport;
8507+ int ret;
8508+ int vf;
8509+
8510+ /* clear port base vlan for all vf */
8511+ for (vf = HCLGE_VF_VPORT_START_NUM; vf < hdev->num_alloc_vport; vf++) {
8512+ vport = &hdev->vport[vf];
8513+ vlan_info = &vport->port_base_vlan_cfg.vlan_info;
8514+
8515+ ret = hclge_set_vlan_filter_hw(hdev, htons(ETH_P_8021Q),
8516+ vport->vport_id,
8517+ vlan_info->vlan_tag, true);
8518+ if (ret)
8519+ dev_err(&hdev->pdev->dev,
8520+ "failed to clear vf vlan for vf%d, ret = %d\n",
8521+ vf - HCLGE_VF_VPORT_START_NUM, ret);
8522+ }
8523+}
8524+
84898525 int hclge_set_vlan_filter(struct hnae3_handle *handle, __be16 proto,
84908526 u16 vlan_id, bool is_kill)
84918527 {
@@ -9895,6 +9931,7 @@ static void hclge_uninit_ae_dev(struct hnae3_ae_dev *ae_dev) · 1403 unmodified lines
98959931 struct hclge_mac *mac = &hdev->hw.mac;
98969932
98979933 hclge_reset_vf_rate(hdev);
9934+ hclge_clear_vf_vlan(hdev);
98989935 hclge_misc_affinity_teardown(hdev);
98999936 hclge_state_uninit(hdev);
99009937
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c+1−0
@@ -799,6 +799,7 @@ void hclge_mbx_handler(struct hclge_dev *hdev) · 798 unmodified lines
799799 hclge_get_link_mode(vport, req);
800800 break;
801801 case HCLGE_MBX_GET_VF_FLR_STATUS:
802+ case HCLGE_MBX_VF_UNINIT:
802803 hclge_rm_vport_all_mac_table(vport, true,
803804 HCLGE_MAC_ADDR_UC);
804805 hclge_rm_vport_all_mac_table(vport, true,
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c+3−0
@@ -2803,6 +2803,9 @@ static void hclgevf_uninit_hdev(struct hclgevf_dev *hdev) · 2802 unmodified lines
28032803 {
28042804 hclgevf_state_uninit(hdev);
28052805
2806+ hclgevf_send_mbx_msg(hdev, HCLGE_MBX_VF_UNINIT, 0, NULL, 0,
2807+ false, NULL, 0);
2808+
28062809 if (test_bit(HCLGEVF_STATE_IRQ_INITED, &hdev->state)) {
28072810 hclgevf_misc_irq_uninit(hdev);
28082811 hclgevf_uninit_msi(hdev);
drivers/net/ethernet/ibm/ibmvnic.c+22−2
@@ -2142,6 +2142,8 @@ static void __ibmvnic_reset(struct work_struct *work) · 2141 unmodified lines
21422142 {
21432143 struct ibmvnic_rwi *rwi;
21442144 struct ibmvnic_adapter *adapter;
2145+ bool saved_state = false;
2146+ unsigned long flags;
21452147 u32 reset_state;
21462148 int rc = 0;
21472149
@@ -2153,17 +2155,25 @@ static void __ibmvnic_reset(struct work_struct *work) · 5 unmodified lines
21532155 return;
21542156 }
21552157
2156− reset_state = adapter->state;
2157−
21582158 rwi = get_next_rwi(adapter);
21592159 while (rwi) {
2160+ spin_lock_irqsave(&adapter->state_lock, flags);
2161+
21602162 if (adapter->state == VNIC_REMOVING ||
21612163 adapter->state == VNIC_REMOVED) {
2164+ spin_unlock_irqrestore(&adapter->state_lock, flags);
21622165 kfree(rwi);
21632166 rc = EBUSY;
21642167 break;
21652168 }
21662169
2170+ if (!saved_state) {
2171+ reset_state = adapter->state;
2172+ adapter->state = VNIC_RESETTING;
2173+ saved_state = true;
2174+ }
2175+ spin_unlock_irqrestore(&adapter->state_lock, flags);
2176+
21672177 if (rwi->reset_reason == VNIC_RESET_CHANGE_PARAM) {
21682178 /* CHANGE_PARAM requestor holds rtnl_lock */
21692179 rc = do_change_param_reset(adapter, rwi, reset_state);
@@ -5091,6 +5101,7 @@ static int ibmvnic_probe(struct vio_dev *dev, const struct vio_device_id *id) · 2921 unmodified lines
50915101 __ibmvnic_delayed_reset);
50925102 INIT_LIST_HEAD(&adapter->rwi_list);
50935103 spin_lock_init(&adapter->rwi_lock);
5104+ spin_lock_init(&adapter->state_lock);
50945105 mutex_init(&adapter->fw_lock);
50955106 init_completion(&adapter->init_done);
50965107 init_completion(&adapter->fw_done);
@@ -5163,8 +5174,17 @@ static int ibmvnic_remove(struct vio_dev *dev) · 66 unmodified lines
51635174 {
51645175 struct net_device *netdev = dev_get_drvdata(&dev->dev);
51655176 struct ibmvnic_adapter *adapter = netdev_priv(netdev);
5177+ unsigned long flags;
5178+
5179+ spin_lock_irqsave(&adapter->state_lock, flags);
5180+ if (adapter->state == VNIC_RESETTING) {
5181+ spin_unlock_irqrestore(&adapter->state_lock, flags);
5182+ return -EBUSY;
5183+ }
51665184
51675185 adapter->state = VNIC_REMOVING;
5186+ spin_unlock_irqrestore(&adapter->state_lock, flags);
5187+
51685188 rtnl_lock();
51695189 unregister_netdevice(netdev);
51705190
drivers/net/ethernet/ibm/ibmvnic.h+5−1
@@ -941,7 +941,8 @@ enum vnic_state {VNIC_PROBING = 1, · 940 unmodified lines
941941 VNIC_CLOSING,
942942 VNIC_CLOSED,
943943 VNIC_REMOVING,
944− VNIC_REMOVED};
944+ VNIC_REMOVED,
945+ VNIC_RESETTING};
945946
946947 enum ibmvnic_reset_reason {VNIC_RESET_FAILOVER = 1,
947948 VNIC_RESET_MOBILITY,
@@ -1090,4 +1091,7 @@ struct ibmvnic_adapter { · 142 unmodified lines
10901091
10911092 struct ibmvnic_tunables desired;
10921093 struct ibmvnic_tunables fallback;
1094+
1095+ /* Used for serializatin of state field */
1096+ spinlock_t state_lock;
10931097 };
drivers/net/ethernet/marvell/mvmdio.c+3−3
@@ -347,7 +347,7 @@ static int orion_mdio_probe(struct platform_device *pdev) · 346 unmodified lines
347347 }
348348
349349
350− dev->err_interrupt = platform_get_irq(pdev, 0);
350+ dev->err_interrupt = platform_get_irq_optional(pdev, 0);
351351 if (dev->err_interrupt > 0 &&
352352 resource_size(r) < MVMDIO_ERR_INT_MASK + 4) {
353353 dev_err(&pdev->dev,
@@ -364,8 +364,8 @@ static int orion_mdio_probe(struct platform_device *pdev) · 10 unmodified lines
364364 writel(MVMDIO_ERR_INT_SMI_DONE,
365365 dev->regs + MVMDIO_ERR_INT_MASK);
366366
367− } else if (dev->err_interrupt == -EPROBE_DEFER) {
368− ret = -EPROBE_DEFER;
367+ } else if (dev->err_interrupt < 0) {
368+ ret = dev->err_interrupt;
369369 goto out_mdio;
370370 }
371371
drivers/net/ethernet/mscc/ocelot.c+17−11
@@ -2176,24 +2176,29 @@ static int ocelot_init_timestamp(struct ocelot *ocelot) · 2175 unmodified lines
21762176 return 0;
21772177 }
21782178
2179−static void ocelot_port_set_mtu(struct ocelot *ocelot, int port, size_t mtu)
2179+/* Configure the maximum SDU (L2 payload) on RX to the value specified in @sdu.
2180+ * The length of VLAN tags is accounted for automatically via DEV_MAC_TAGS_CFG.
2181+ */
2182+static void ocelot_port_set_maxlen(struct ocelot *ocelot, int port, size_t sdu)
21802183 {
21812184 struct ocelot_port *ocelot_port = ocelot->ports[port];
2185+ int maxlen = sdu + ETH_HLEN + ETH_FCS_LEN;
21822186 int atop_wm;
21832187
2184− ocelot_port_writel(ocelot_port, mtu, DEV_MAC_MAXLEN_CFG);
2188+ ocelot_port_writel(ocelot_port, maxlen, DEV_MAC_MAXLEN_CFG);
21852189
21862190 /* Set Pause WM hysteresis
2187− * 152 = 6 * mtu / OCELOT_BUFFER_CELL_SZ
2188− * 101 = 4 * mtu / OCELOT_BUFFER_CELL_SZ
2191+ * 152 = 6 * maxlen / OCELOT_BUFFER_CELL_SZ
2192+ * 101 = 4 * maxlen / OCELOT_BUFFER_CELL_SZ
21892193 */
21902194 ocelot_write_rix(ocelot, SYS_PAUSE_CFG_PAUSE_ENA |
21912195 SYS_PAUSE_CFG_PAUSE_STOP(101) |
21922196 SYS_PAUSE_CFG_PAUSE_START(152), SYS_PAUSE_CFG, port);
21932197
21942198 /* Tail dropping watermark */
2195− atop_wm = (ocelot->shared_queue_sz - 9 * mtu) / OCELOT_BUFFER_CELL_SZ;
2196− ocelot_write_rix(ocelot, ocelot_wm_enc(9 * mtu),
2199+ atop_wm = (ocelot->shared_queue_sz - 9 * maxlen) /
2200+ OCELOT_BUFFER_CELL_SZ;
2201+ ocelot_write_rix(ocelot, ocelot_wm_enc(9 * maxlen),
21972202 SYS_ATOP, port);
21982203 ocelot_write(ocelot, ocelot_wm_enc(atop_wm), SYS_ATOP_TOT_CFG);
21992204 }
@@ -2222,9 +2227,10 @@ void ocelot_init_port(struct ocelot *ocelot, int port) · 22 unmodified lines
22222227 DEV_MAC_HDX_CFG);
22232228
22242229 /* Set Max Length and maximum tags allowed */
2225− ocelot_port_set_mtu(ocelot, port, VLAN_ETH_FRAME_LEN);
2230+ ocelot_port_set_maxlen(ocelot, port, ETH_DATA_LEN);
22262231 ocelot_port_writel(ocelot_port, DEV_MAC_TAGS_CFG_TAG_ID(ETH_P_8021AD) |
22272232 DEV_MAC_TAGS_CFG_VLAN_AWR_ENA |
2233+ DEV_MAC_TAGS_CFG_VLAN_DBL_AWR_ENA |
22282234 DEV_MAC_TAGS_CFG_VLAN_LEN_AWR_ENA,
22292235 DEV_MAC_TAGS_CFG);
22302236
@@ -2310,18 +2316,18 @@ void ocelot_set_cpu_port(struct ocelot *ocelot, int cpu, · 79 unmodified lines
23102316 * Only one port can be an NPI at the same time.
23112317 */
23122318 if (cpu < ocelot->num_phys_ports) {
2313− int mtu = VLAN_ETH_FRAME_LEN + OCELOT_TAG_LEN;
2319+ int sdu = ETH_DATA_LEN + OCELOT_TAG_LEN;
23142320
23152321 ocelot_write(ocelot, QSYS_EXT_CPU_CFG_EXT_CPUQ_MSK_M |
23162322 QSYS_EXT_CPU_CFG_EXT_CPU_PORT(cpu),
23172323 QSYS_EXT_CPU_CFG);
23182324
23192325 if (injection == OCELOT_TAG_PREFIX_SHORT)
2320− mtu += OCELOT_SHORT_PREFIX_LEN;
2326+ sdu += OCELOT_SHORT_PREFIX_LEN;
23212327 else if (injection == OCELOT_TAG_PREFIX_LONG)
2322− mtu += OCELOT_LONG_PREFIX_LEN;
2328+ sdu += OCELOT_LONG_PREFIX_LEN;
23232329
2324− ocelot_port_set_mtu(ocelot, cpu, mtu);
2330+ ocelot_port_set_maxlen(ocelot, cpu, sdu);
23252331 }
23262332
23272333 /* CPU port Injection/Extraction configuration */
drivers/net/ethernet/pensando/ionic/ionic_lif.c+4−4
@@ -1688,7 +1688,7 @@ static int ionic_set_vf_mac(struct net_device *netdev, int vf, u8 *mac) · 1687 unmodified lines
16881688 if (!(is_zero_ether_addr(mac) || is_valid_ether_addr(mac)))
16891689 return -EINVAL;
16901690
1691− down_read(&ionic->vf_op_lock);
1691+ down_write(&ionic->vf_op_lock);
16921692
16931693 if (vf >= pci_num_vf(ionic->pdev) || !ionic->vfs) {
16941694 ret = -EINVAL;
@@ -1698,7 +1698,7 @@ static int ionic_set_vf_mac(struct net_device *netdev, int vf, u8 *mac) · 3 unmodified lines
16981698 ether_addr_copy(ionic->vfs[vf].macaddr, mac);
16991699 }
17001700
1701− up_read(&ionic->vf_op_lock);
1701+ up_write(&ionic->vf_op_lock);
17021702 return ret;
17031703 }
17041704
@@ -1719,7 +1719,7 @@ static int ionic_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, · 14 unmodified lines
17191719 if (proto != htons(ETH_P_8021Q))
17201720 return -EPROTONOSUPPORT;
17211721
1722− down_read(&ionic->vf_op_lock);
1722+ down_write(&ionic->vf_op_lock);
17231723
17241724 if (vf >= pci_num_vf(ionic->pdev) || !ionic->vfs) {
17251725 ret = -EINVAL;
@@ -1730,7 +1730,7 @@ static int ionic_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, · 4 unmodified lines
17301730 ionic->vfs[vf].vlanid = vlan;
17311731 }
17321732
1733− up_read(&ionic->vf_op_lock);
1733+ up_write(&ionic->vf_op_lock);
17341734 return ret;
17351735 }
17361736
drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c+1−1
@@ -2277,7 +2277,7 @@ static int __init sxgbe_cmdline_opt(char *str) · 2276 unmodified lines
22772277 if (!str || !*str)
22782278 return -EINVAL;
22792279 while ((opt = strsep(&str, ",")) != NULL) {
2280− if (!strncmp(opt, "eee_timer:", 6)) {
2280+ if (!strncmp(opt, "eee_timer:", 10)) {
22812281 if (kstrtoint(opt + 10, 0, &eee_timer))
22822282 goto err;
22832283 }
drivers/net/ethernet/sfc/ef10.c+17−15
@@ -2853,11 +2853,24 @@ efx_ef10_handle_tx_event(struct efx_channel *channel, efx_qword_t *event) · 2852 unmodified lines
28532853 }
28542854
28552855 /* Transmit timestamps are only available for 8XXX series. They result
2856− * in three events per packet. These occur in order, and are:
2857− * - the normal completion event
2856+ * in up to three events per packet. These occur in order, and are:
2857+ * - the normal completion event (may be omitted)
28582858 * - the low part of the timestamp
28592859 * - the high part of the timestamp
28602860 *
2861+ * It's possible for multiple completion events to appear before the
2862+ * corresponding timestamps. So we can for example get:
2863+ * COMP N
2864+ * COMP N+1
2865+ * TS_LO N
2866+ * TS_HI N
2867+ * TS_LO N+1
2868+ * TS_HI N+1
2869+ *
2870+ * In addition it's also possible for the adjacent completions to be
2871+ * merged, so we may not see COMP N above. As such, the completion
2872+ * events are not very useful here.
2873+ *
28612874 * Each part of the timestamp is itself split across two 16 bit
28622875 * fields in the event.
28632876 */
@@ -2865,17 +2878,7 @@ efx_ef10_handle_tx_event(struct efx_channel *channel, efx_qword_t *event) · 1 unmodified line
28652878
28662879 switch (tx_ev_type) {
28672880 case TX_TIMESTAMP_EVENT_TX_EV_COMPLETION:
2868− /* In case of Queue flush or FLR, we might have received
2869− * the previous TX completion event but not the Timestamp
2870− * events.
2871− */
2872− if (tx_queue->completed_desc_ptr != tx_queue->ptr_mask)
2873− efx_xmit_done(tx_queue, tx_queue->completed_desc_ptr);
2874−
2875− tx_ev_desc_ptr = EFX_QWORD_FIELD(*event,
2876− ESF_DZ_TX_DESCR_INDX);
2877− tx_queue->completed_desc_ptr =
2878− tx_ev_desc_ptr & tx_queue->ptr_mask;
2881+ /* Ignore this event - see above. */
28792882 break;
28802883
28812884 case TX_TIMESTAMP_EVENT_TX_EV_TSTAMP_LO:
@@ -2887,8 +2890,7 @@ efx_ef10_handle_tx_event(struct efx_channel *channel, efx_qword_t *event) · 5 unmodified lines
28872890 ts_part = efx_ef10_extract_event_ts(event);
28882891 tx_queue->completed_timestamp_major = ts_part;
28892892
2890− efx_xmit_done(tx_queue, tx_queue->completed_desc_ptr);
2891− tx_queue->completed_desc_ptr = tx_queue->ptr_mask;
2893+ efx_xmit_done_single(tx_queue);
28922894 break;
28932895
28942896 default:
drivers/net/ethernet/sfc/efx.h+1−0
@@ -20,6 +20,7 @@ netdev_tx_t efx_hard_start_xmit(struct sk_buff *skb, · 19 unmodified lines
2020 struct net_device *net_dev);
2121 netdev_tx_t efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb);
2222 void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index);
23+void efx_xmit_done_single(struct efx_tx_queue *tx_queue);
2324 int efx_setup_tc(struct net_device *net_dev, enum tc_setup_type type,
2425 void *type_data);
2526 extern unsigned int efx_piobuf_size;
drivers/net/ethernet/sfc/efx_channels.c+1−0
@@ -583,6 +583,7 @@ struct efx_channel *efx_copy_channel(const struct efx_channel *old_channel) · 582 unmodified lines
583583 if (tx_queue->channel)
584584 tx_queue->channel = channel;
585585 tx_queue->buffer = NULL;
586+ tx_queue->cb_page = NULL;
586587 memset(&tx_queue->txd, 0, sizeof(tx_queue->txd));
587588 }
588589
drivers/net/ethernet/sfc/net_driver.h+0−3
@@ -208,8 +208,6 @@ struct efx_tx_buffer { · 207 unmodified lines
208208 * avoid cache-line ping-pong between the xmit path and the
209209 * completion path.
210210 * @merge_events: Number of TX merged completion events
211− * @completed_desc_ptr: Most recent completed pointer - only used with
212− * timestamping.
213211 * @completed_timestamp_major: Top part of the most recent tx timestamp.
214212 * @completed_timestamp_minor: Low part of the most recent tx timestamp.
215213 * @insert_count: Current insert pointer
@@ -269,7 +267,6 @@ struct efx_tx_queue { · 53 unmodified lines
269267 unsigned int merge_events;
270268 unsigned int bytes_compl;
271269 unsigned int pkts_compl;
272− unsigned int completed_desc_ptr;
273270 u32 completed_timestamp_major;
274271 u32 completed_timestamp_minor;
275272
drivers/net/ethernet/sfc/tx.c+38−0
@@ -535,6 +535,44 @@ netdev_tx_t efx_hard_start_xmit(struct sk_buff *skb, · 534 unmodified lines
535535 return efx_enqueue_skb(tx_queue, skb);
536536 }
537537
538+void efx_xmit_done_single(struct efx_tx_queue *tx_queue)
539+{
540+ unsigned int pkts_compl = 0, bytes_compl = 0;
541+ unsigned int read_ptr;
542+ bool finished = false;
543+
544+ read_ptr = tx_queue->read_count & tx_queue->ptr_mask;
545+
546+ while (!finished) {
547+ struct efx_tx_buffer *buffer = &tx_queue->buffer[read_ptr];
548+
549+ if (!efx_tx_buffer_in_use(buffer)) {
550+ struct efx_nic *efx = tx_queue->efx;
551+
552+ netif_err(efx, hw, efx->net_dev,
553+ "TX queue %d spurious single TX completion\n",
554+ tx_queue->queue);
555+ efx_schedule_reset(efx, RESET_TYPE_TX_SKIP);
556+ return;
557+ }
558+
559+ /* Need to check the flag before dequeueing. */
560+ if (buffer->flags & EFX_TX_BUF_SKB)
561+ finished = true;
562+ efx_dequeue_buffer(tx_queue, buffer, &pkts_compl, &bytes_compl);
563+
564+ ++tx_queue->read_count;
565+ read_ptr = tx_queue->read_count & tx_queue->ptr_mask;
566+ }
567+
568+ tx_queue->pkts_compl += pkts_compl;
569+ tx_queue->bytes_compl += bytes_compl;
570+
571+ EFX_WARN_ON_PARANOID(pkts_compl != 1);
572+
573+ efx_xmit_done_check_empty(tx_queue);
574+}
575+
538576 void efx_init_tx_queue_core_txq(struct efx_tx_queue *tx_queue)
539577 {
540578 struct efx_nic *efx = tx_queue->efx;
drivers/net/ethernet/sfc/tx_common.c+16−13
@@ -80,7 +80,6 @@ void efx_init_tx_queue(struct efx_tx_queue *tx_queue) · 79 unmodified lines
8080 tx_queue->xmit_more_available = false;
8181 tx_queue->timestamping = (efx_ptp_use_mac_tx_timestamps(efx) &&
8282 tx_queue->channel == efx_ptp_channel(efx));
83− tx_queue->completed_desc_ptr = tx_queue->ptr_mask;
8483 tx_queue->completed_timestamp_major = 0;
8584 tx_queue->completed_timestamp_minor = 0;
8685
@@ -210,10 +209,9 @@ static void efx_dequeue_buffers(struct efx_tx_queue *tx_queue, · 123 unmodified lines
210209 while (read_ptr != stop_index) {
211210 struct efx_tx_buffer *buffer = &tx_queue->buffer[read_ptr];
212211
213− if (!(buffer->flags & EFX_TX_BUF_OPTION) &&
214− unlikely(buffer->len == 0)) {
212+ if (!efx_tx_buffer_in_use(buffer)) {
215213 netif_err(efx, tx_err, efx->net_dev,
216− "TX queue %d spurious TX completion id %x\n",
214+ "TX queue %d spurious TX completion id %d\n",
217215 tx_queue->queue, read_ptr);
218216 efx_schedule_reset(efx, RESET_TYPE_TX_SKIP);
219217 return;
@@ -226,6 +224,19 @@ static void efx_dequeue_buffers(struct efx_tx_queue *tx_queue, · 6 unmodified lines
226224 }
227225 }
228226
227+void efx_xmit_done_check_empty(struct efx_tx_queue *tx_queue)
228+{
229+ if ((int)(tx_queue->read_count - tx_queue->old_write_count) >= 0) {
230+ tx_queue->old_write_count = READ_ONCE(tx_queue->write_count);
231+ if (tx_queue->read_count == tx_queue->old_write_count) {
232+ /* Ensure that read_count is flushed. */
233+ smp_mb();
234+ tx_queue->empty_read_count =
235+ tx_queue->read_count | EFX_EMPTY_COUNT_VALID;
236+ }
237+ }
238+}
239+
229240 void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index)
230241 {
231242 unsigned int fill_level, pkts_compl = 0, bytes_compl = 0;
@@ -256,15 +267,7 @@ void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index) · 24 unmodified lines
256267 netif_tx_wake_queue(tx_queue->core_txq);
257268 }
258269
259− /* Check whether the hardware queue is now empty */
260− if ((int)(tx_queue->read_count - tx_queue->old_write_count) >= 0) {
261− tx_queue->old_write_count = READ_ONCE(tx_queue->write_count);
262− if (tx_queue->read_count == tx_queue->old_write_count) {
263− smp_mb();
264− tx_queue->empty_read_count =
265− tx_queue->read_count | EFX_EMPTY_COUNT_VALID;
266− }
267− }
270+ efx_xmit_done_check_empty(tx_queue);
268271 }
269272
270273 /* Remove buffers put into a tx_queue for the current packet.
drivers/net/ethernet/sfc/tx_common.h+6−0
@@ -21,6 +21,12 @@ void efx_dequeue_buffer(struct efx_tx_queue *tx_queue, · 20 unmodified lines
2121 unsigned int *pkts_compl,
2222 unsigned int *bytes_compl);
2323
24+static inline bool efx_tx_buffer_in_use(struct efx_tx_buffer *buffer)
25+{
26+ return buffer->len || (buffer->flags & EFX_TX_BUF_OPTION);
27+}
28+
29+void efx_xmit_done_check_empty(struct efx_tx_queue *tx_queue);
2430 void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index);
2531
2632 void efx_enqueue_unwind(struct efx_tx_queue *tx_queue,
drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c+2−1
@@ -24,6 +24,7 @@ · 23 unmodified lines
2424 static void dwmac1000_core_init(struct mac_device_info *hw,
2525 struct net_device *dev)
2626 {
27+ struct stmmac_priv *priv = netdev_priv(dev);
2728 void __iomem *ioaddr = hw->pcsr;
2829 u32 value = readl(ioaddr + GMAC_CONTROL);
2930 int mtu = dev->mtu;
@@ -35,7 +36,7 @@ static void dwmac1000_core_init(struct mac_device_info *hw, · 5 unmodified lines
3536 * Broadcom tags can look like invalid LLC/SNAP packets and cause the
3637 * hardware to truncate packets on reception.
3738 */
38− if (netdev_uses_dsa(dev))
39+ if (netdev_uses_dsa(dev) || !priv->plat->enh_desc)
3940 value &= ~GMAC_CONTROL_ACS;
4041
4142 if (mtu > 1500)
drivers/net/ipvlan/ipvlan_core.c+11−8
@@ -293,6 +293,7 @@ void ipvlan_process_multicast(struct work_struct *work) · 292 unmodified lines
293293 }
294294 if (dev)
295295 dev_put(dev);
296+ cond_resched();
296297 }
297298 }
298299
@@ -498,19 +499,21 @@ static int ipvlan_process_outbound(struct sk_buff *skb) · 199 unmodified lines
498499 struct ethhdr *ethh = eth_hdr(skb);
499500 int ret = NET_XMIT_DROP;
500501
501− /* In this mode we dont care about multicast and broadcast traffic */
502− if (is_multicast_ether_addr(ethh->h_dest)) {
503− pr_debug_ratelimited("Dropped {multi|broad}cast of type=[%x]\n",
504− ntohs(skb->protocol));
505− kfree_skb(skb);
506− goto out;
507− }
508−
509502 /* The ipvlan is a pseudo-L2 device, so the packets that we receive
510503 * will have L2; which need to discarded and processed further
511504 * in the net-ns of the main-device.
512505 */
513506 if (skb_mac_header_was_set(skb)) {
507+ /* In this mode we dont care about
508+ * multicast and broadcast traffic */
509+ if (is_multicast_ether_addr(ethh->h_dest)) {
510+ pr_debug_ratelimited(
511+ "Dropped {multi|broad}cast of type=[%x]\n",
512+ ntohs(skb->protocol));
513+ kfree_skb(skb);
514+ goto out;
515+ }
516+
514517 skb_pull(skb, sizeof(*ethh));
515518 skb->mac_header = (typeof(skb->mac_header))~0U;
516519 skb_reset_network_header(skb);
drivers/net/ipvlan/ipvlan_main.c+1−4
@@ -164,7 +164,6 @@ static void ipvlan_uninit(struct net_device *dev) · 163 unmodified lines
164164 static int ipvlan_open(struct net_device *dev)
165165 {
166166 struct ipvl_dev *ipvlan = netdev_priv(dev);
167− struct net_device *phy_dev = ipvlan->phy_dev;
168167 struct ipvl_addr *addr;
169168
170169 if (ipvlan->port->mode == IPVLAN_MODE_L3 ||
@@ -178,7 +177,7 @@ static int ipvlan_open(struct net_device *dev) · 7 unmodified lines
178177 ipvlan_ht_addr_add(ipvlan, addr);
179178 rcu_read_unlock();
180179
181− return dev_uc_add(phy_dev, phy_dev->dev_addr);
180+ return 0;
182181 }
183182
184183 static int ipvlan_stop(struct net_device *dev)
@@ -190,8 +189,6 @@ static int ipvlan_stop(struct net_device *dev) · 5 unmodified lines
190189 dev_uc_unsync(phy_dev, dev);
191190 dev_mc_unsync(phy_dev, dev);
192191
193− dev_uc_del(phy_dev, phy_dev->dev_addr);
194−
195192 rcu_read_lock();
196193 list_for_each_entry_rcu(addr, &ipvlan->addrs, anode)
197194 ipvlan_ht_addr_del(addr);
drivers/net/macsec.c+20−5
@@ -424,6 +424,11 @@ static struct macsec_eth_header *macsec_ethhdr(struct sk_buff *skb) · 423 unmodified lines
424424 return (struct macsec_eth_header *)skb_mac_header(skb);
425425 }
426426
427+static sci_t dev_to_sci(struct net_device *dev, __be16 port)
428+{
429+ return make_sci(dev->dev_addr, port);
430+}
431+
427432 static void __macsec_pn_wrapped(struct macsec_secy *secy,
428433 struct macsec_tx_sa *tx_sa)
429434 {
@@ -3268,6 +3273,20 @@ static int macsec_set_mac_address(struct net_device *dev, void *p) · 2838 unmodified lines
32683273
32693274 out:
32703275 ether_addr_copy(dev->dev_addr, addr->sa_data);
3276+ macsec->secy.sci = dev_to_sci(dev, MACSEC_PORT_ES);
3277+
3278+ /* If h/w offloading is available, propagate to the device */
3279+ if (macsec_is_offloaded(macsec)) {
3280+ const struct macsec_ops *ops;
3281+ struct macsec_context ctx;
3282+
3283+ ops = macsec_get_ops(macsec, &ctx);
3284+ if (ops) {
3285+ ctx.secy = &macsec->secy;
3286+ macsec_offload(ops->mdo_upd_secy, &ctx);
3287+ }
3288+ }
3289+
32713290 return 0;
32723291 }
32733292
@@ -3342,6 +3361,7 @@ static const struct device_type macsec_type = { · 68 unmodified lines
33423361
33433362 static const struct nla_policy macsec_rtnl_policy[IFLA_MACSEC_MAX + 1] = {
33443363 [IFLA_MACSEC_SCI] = { .type = NLA_U64 },
3364+ [IFLA_MACSEC_PORT] = { .type = NLA_U16 },
33453365 [IFLA_MACSEC_ICV_LEN] = { .type = NLA_U8 },
33463366 [IFLA_MACSEC_CIPHER_SUITE] = { .type = NLA_U64 },
33473367 [IFLA_MACSEC_WINDOW] = { .type = NLA_U32 },
@@ -3592,11 +3612,6 @@ static bool sci_exists(struct net_device *dev, sci_t sci) · 244 unmodified lines
35923612 return false;
35933613 }
35943614
3595−static sci_t dev_to_sci(struct net_device *dev, __be16 port)
3596−{
3597− return make_sci(dev->dev_addr, port);
3598−}
3599−
36003615 static int macsec_add_dev(struct net_device *dev, sci_t sci, u8 icv_len)
36013616 {
36023617 struct macsec_dev *macsec = macsec_priv(dev);
drivers/net/macvlan.c+2−0
@@ -334,6 +334,8 @@ static void macvlan_process_broadcast(struct work_struct *w) · 333 unmodified lines
334334 if (src)
335335 dev_put(src->dev);
336336 consume_skb(skb);
337+
338+ cond_resched();
337339 }
338340 }
339341
drivers/net/phy/bcm63xx.c+1−0
@@ -73,6 +73,7 @@ static struct phy_driver bcm63xx_driver[] = { · 72 unmodified lines
7373 /* same phy as above, with just a different OUI */
7474 .phy_id = 0x002bdc00,
7575 .phy_id_mask = 0xfffffc00,
76+ .name = "Broadcom BCM63XX (2)",
7677 /* PHY_BASIC_FEATURES */
7778 .flags = PHY_IS_INTERNAL,
7879 .config_init = bcm63xx_config_init,
drivers/net/phy/phy.c+2−1
@@ -727,7 +727,8 @@ static irqreturn_t phy_interrupt(int irq, void *phy_dat) · 726 unmodified lines
727727 phy_trigger_machine(phydev);
728728 }
729729
730− if (phy_clear_interrupt(phydev))
730+ /* did_interrupt() may have cleared the interrupt already */
731+ if (!phydev->drv->did_interrupt && phy_clear_interrupt(phydev))
731732 goto phy_err;
732733 return IRQ_HANDLED;
733734
drivers/net/phy/phy_device.c+5−1
@@ -286,6 +286,8 @@ static int mdio_bus_phy_suspend(struct device *dev) · 285 unmodified lines
286286 if (!mdio_bus_phy_may_suspend(phydev))
287287 return 0;
288288
289+ phydev->suspended_by_mdio_bus = 1;
290+
289291 return phy_suspend(phydev);
290292 }
291293
@@ -294,9 +296,11 @@ static int mdio_bus_phy_resume(struct device *dev) · 2 unmodified lines
294296 struct phy_device *phydev = to_phy_device(dev);
295297 int ret;
296298
297− if (!mdio_bus_phy_may_suspend(phydev))
299+ if (!phydev->suspended_by_mdio_bus)
298300 goto no_resume;
299301
302+ phydev->suspended_by_mdio_bus = 0;
303+
300304 ret = phy_resume(phydev);
301305 if (ret < 0)
302306 return ret;
drivers/net/phy/phylink.c+7−1
@@ -761,8 +761,14 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy, · 760 unmodified lines
761761 config.interface = interface;
762762
763763 ret = phylink_validate(pl, supported, &config);
764− if (ret)
764+ if (ret) {
765+ phylink_warn(pl, "validation of %s with support %*pb and advertisement %*pb failed: %d\n",
766+ phy_modes(config.interface),
767+ __ETHTOOL_LINK_MODE_MASK_NBITS, phy->supported,
768+ __ETHTOOL_LINK_MODE_MASK_NBITS, config.advertising,
769+ ret);
765770 return ret;
771+ }
766772
767773 phy->phylink = pl;
768774 phy->phy_link_change = phylink_phy_change;
drivers/net/slip/slhc.c+10−4
@@ -232,7 +232,7 @@ slhc_compress(struct slcompress *comp, unsigned char *icp, int isize, · 231 unmodified lines
232232 struct cstate *cs = lcs->next;
233233 unsigned long deltaS, deltaA;
234234 short changes = 0;
235− int hlen;
235+ int nlen, hlen;
236236 unsigned char new_seq[16];
237237 unsigned char *cp = new_seq;
238238 struct iphdr *ip;
@@ -248,6 +248,8 @@ slhc_compress(struct slcompress *comp, unsigned char *icp, int isize, · 9 unmodified lines
248248 return isize;
249249
250250 ip = (struct iphdr *) icp;
251+ if (ip->version != 4 || ip->ihl < 5)
252+ return isize;
251253
252254 /* Bail if this packet isn't TCP, or is an IP fragment */
253255 if (ip->protocol != IPPROTO_TCP || (ntohs(ip->frag_off) & 0x3fff)) {
@@ -258,10 +260,14 @@ slhc_compress(struct slcompress *comp, unsigned char *icp, int isize, · 4 unmodified lines
258260 comp->sls_o_tcp++;
259261 return isize;
260262 }
261− /* Extract TCP header */
263+ nlen = ip->ihl * 4;
264+ if (isize < nlen + sizeof(*th))
265+ return isize;
262266
263− th = (struct tcphdr *)(((unsigned char *)ip) + ip->ihl*4);
264− hlen = ip->ihl*4 + th->doff*4;
267+ th = (struct tcphdr *)(icp + nlen);
268+ if (th->doff < sizeof(struct tcphdr) / 4)
269+ return isize;
270+ hlen = nlen + th->doff * 4;
265271
266272 /* Bail if the TCP packet isn't `compressible' (i.e., ACK isn't set or
267273 * some other control bit is set). Also uncompressible if
drivers/net/team/team.c+2−0
@@ -2240,6 +2240,8 @@ team_nl_option_policy[TEAM_ATTR_OPTION_MAX + 1] = { · 2239 unmodified lines
22402240 [TEAM_ATTR_OPTION_CHANGED] = { .type = NLA_FLAG },
22412241 [TEAM_ATTR_OPTION_TYPE] = { .type = NLA_U8 },
22422242 [TEAM_ATTR_OPTION_DATA] = { .type = NLA_BINARY },
2243+ [TEAM_ATTR_OPTION_PORT_IFINDEX] = { .type = NLA_U32 },
2244+ [TEAM_ATTR_OPTION_ARRAY_INDEX] = { .type = NLA_U32 },
22432245 };
22442246
22452247 static int team_nl_cmd_noop(struct sk_buff *skb, struct genl_info *info)
drivers/net/usb/r8152.c+8−0
@@ -3221,6 +3221,8 @@ static u16 r8153_phy_status(struct r8152 *tp, u16 desired) · 3220 unmodified lines
32213221 }
32223222
32233223 msleep(20);
3224+ if (test_bit(RTL8152_UNPLUG, &tp->flags))
3225+ break;
32243226 }
32253227
32263228 return data;
@@ -5402,7 +5404,10 @@ static void r8153_init(struct r8152 *tp) · 2175 unmodified lines
54025404 if (ocp_read_word(tp, MCU_TYPE_PLA, PLA_BOOT_CTRL) &
54035405 AUTOLOAD_DONE)
54045406 break;
5407+
54055408 msleep(20);
5409+ if (test_bit(RTL8152_UNPLUG, &tp->flags))
5410+ break;
54065411 }
54075412
54085413 data = r8153_phy_status(tp, 0);
@@ -5539,7 +5544,10 @@ static void r8153b_init(struct r8152 *tp) · 130 unmodified lines
55395544 if (ocp_read_word(tp, MCU_TYPE_PLA, PLA_BOOT_CTRL) &
55405545 AUTOLOAD_DONE)
55415546 break;
5547+
55425548 msleep(20);
5549+ if (test_bit(RTL8152_UNPLUG, &tp->flags))
5550+ break;
55435551 }
55445552
55455553 data = r8153_phy_status(tp, 0);
drivers/net/veth.c+1−1
@@ -328,7 +328,7 @@ static void veth_get_stats64(struct net_device *dev, · 327 unmodified lines
328328 rcu_read_lock();
329329 peer = rcu_dereference(priv->peer);
330330 if (peer) {
331− tot->rx_dropped += veth_stats_tx(peer, &packets, &bytes);
331+ veth_stats_tx(peer, &packets, &bytes);
332332 tot->rx_bytes += bytes;
333333 tot->rx_packets += packets;
334334
drivers/net/wireless/intel/iwlwifi/mvm/nvm.c+2−1
@@ -308,7 +308,8 @@ iwl_parse_nvm_sections(struct iwl_mvm *mvm) · 307 unmodified lines
308308 }
309309
310310 /* PHY_SKU section is mandatory in B0 */
311− if (!mvm->nvm_sections[NVM_SECTION_TYPE_PHY_SKU].data) {
311+ if (mvm->trans->cfg->nvm_type == IWL_NVM_EXT &&
312+ !mvm->nvm_sections[NVM_SECTION_TYPE_PHY_SKU].data) {
312313 IWL_ERR(mvm,
313314 "Can't parse phy_sku in B0, empty sections\n");
314315 return NULL;
drivers/net/wireless/mediatek/mt76/dma.c+6−3
@@ -447,10 +447,13 @@ mt76_add_fragment(struct mt76_dev *dev, struct mt76_queue *q, void *data, · 446 unmodified lines
447447 struct page *page = virt_to_head_page(data);
448448 int offset = data - page_address(page);
449449 struct sk_buff *skb = q->rx_head;
450+ struct skb_shared_info *shinfo = skb_shinfo(skb);
450451
451− offset += q->buf_offset;
452− skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page, offset, len,
453− q->buf_size);
452+ if (shinfo->nr_frags < ARRAY_SIZE(shinfo->frags)) {
453+ offset += q->buf_offset;
454+ skb_add_rx_frag(skb, shinfo->nr_frags, page, offset, len,
455+ q->buf_size);
456+ }
454457
455458 if (more)
456459 return;
drivers/nvme/host/rdma.c+5−3
@@ -850,9 +850,11 @@ out_free_tagset: · 849 unmodified lines
850850 if (new)
851851 blk_mq_free_tag_set(ctrl->ctrl.admin_tagset);
852852 out_free_async_qe:
853− nvme_rdma_free_qe(ctrl->device->dev, &ctrl->async_event_sqe,
854− sizeof(struct nvme_command), DMA_TO_DEVICE);
855− ctrl->async_event_sqe.data = NULL;
853+ if (ctrl->async_event_sqe.data) {
854+ nvme_rdma_free_qe(ctrl->device->dev, &ctrl->async_event_sqe,
855+ sizeof(struct nvme_command), DMA_TO_DEVICE);
856+ ctrl->async_event_sqe.data = NULL;
857+ }
856858 out_free_queue:
857859 nvme_rdma_free_queue(&ctrl->queues[0]);
858860 return error;
drivers/nvme/target/tcp.c+9−3
@@ -515,7 +515,7 @@ static int nvmet_try_send_data_pdu(struct nvmet_tcp_cmd *cmd) · 514 unmodified lines
515515 return 1;
516516 }
517517
518−static int nvmet_try_send_data(struct nvmet_tcp_cmd *cmd)
518+static int nvmet_try_send_data(struct nvmet_tcp_cmd *cmd, bool last_in_batch)
519519 {
520520 struct nvmet_tcp_queue *queue = cmd->queue;
521521 int ret;
@@ -523,9 +523,15 @@ static int nvmet_try_send_data(struct nvmet_tcp_cmd *cmd) · 1 unmodified line
523523 while (cmd->cur_sg) {
524524 struct page *page = sg_page(cmd->cur_sg);
525525 u32 left = cmd->cur_sg->length - cmd->offset;
526+ int flags = MSG_DONTWAIT;
527+
528+ if ((!last_in_batch && cmd->queue->send_list_len) ||
529+ cmd->wbytes_done + left < cmd->req.transfer_len ||
530+ queue->data_digest || !queue->nvme_sq.sqhd_disabled)
531+ flags |= MSG_MORE;
526532
527533 ret = kernel_sendpage(cmd->queue->sock, page, cmd->offset,
528− left, MSG_DONTWAIT | MSG_MORE);
534+ left, flags);
529535 if (ret <= 0)
530536 return ret;
531537
@@ -660,7 +666,7 @@ static int nvmet_tcp_try_send_one(struct nvmet_tcp_queue *queue, · 128 unmodified lines
660666 }
661667
662668 if (cmd->state == NVMET_TCP_SEND_DATA) {
663− ret = nvmet_try_send_data(cmd);
669+ ret = nvmet_try_send_data(cmd, last_in_batch);
664670 if (ret <= 0)
665671 goto done_send;
666672 }
drivers/of/of_mdio.c+1−0
@@ -306,6 +306,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) · 305 unmodified lines
306306 rc = of_mdiobus_register_phy(mdio, child, addr);
307307 if (rc && rc != -ENODEV)
308308 goto unregister;
309+ break;
309310 }
310311 }
311312 }
drivers/pinctrl/cirrus/pinctrl-madera-core.c+13−0
@@ -1073,13 +1073,26 @@ static int madera_pin_probe(struct platform_device *pdev) · 1072 unmodified lines
10731073 return ret;
10741074 }
10751075
1076+ platform_set_drvdata(pdev, priv);
1077+
10761078 dev_dbg(priv->dev, "pinctrl probed ok\n");
10771079
10781080 return 0;
10791081 }
10801082
1083+static int madera_pin_remove(struct platform_device *pdev)
1084+{
1085+ struct madera_pin_private *priv = platform_get_drvdata(pdev);
1086+
1087+ if (priv->madera->pdata.gpio_configs)
1088+ pinctrl_unregister_mappings(priv->madera->pdata.gpio_configs);
1089+
1090+ return 0;
1091+}
1092+
10811093 static struct platform_driver madera_pin_driver = {
10821094 .probe = madera_pin_probe,
1095+ .remove = madera_pin_remove,
10831096 .driver = {
10841097 .name = "madera-pinctrl",
10851098 },
drivers/pinctrl/core.c+0−1
@@ -2021,7 +2021,6 @@ static int pinctrl_claim_hogs(struct pinctrl_dev *pctldev) · 2020 unmodified lines
20212021 return PTR_ERR(pctldev->p);
20222022 }
20232023
2024− kref_get(&pctldev->p->users);
20252024 pctldev->hog_default =
20262025 pinctrl_lookup_state(pctldev->p, PINCTRL_STATE_DEFAULT);
20272026 if (IS_ERR(pctldev->hog_default)) {
drivers/pinctrl/freescale/pinctrl-scu.c+2−2
@@ -23,12 +23,12 @@ struct imx_sc_msg_req_pad_set { · 22 unmodified lines
2323 struct imx_sc_rpc_msg hdr;
2424 u32 val;
2525 u16 pad;
26−} __packed;
26+} __packed __aligned(4);
2727
2828 struct imx_sc_msg_req_pad_get {
2929 struct imx_sc_rpc_msg hdr;
3030 u16 pad;
31−} __packed;
31+} __packed __aligned(4);
3232
3333 struct imx_sc_msg_resp_pad_get {
3434 struct imx_sc_rpc_msg hdr;
drivers/pinctrl/meson/pinctrl-meson-gxl.c+2−2
@@ -147,8 +147,8 @@ static const unsigned int sdio_d0_pins[] = { GPIOX_0 }; · 146 unmodified lines
147147 static const unsigned int sdio_d1_pins[] = { GPIOX_1 };
148148 static const unsigned int sdio_d2_pins[] = { GPIOX_2 };
149149 static const unsigned int sdio_d3_pins[] = { GPIOX_3 };
150−static const unsigned int sdio_cmd_pins[] = { GPIOX_4 };
151−static const unsigned int sdio_clk_pins[] = { GPIOX_5 };
150+static const unsigned int sdio_clk_pins[] = { GPIOX_4 };
151+static const unsigned int sdio_cmd_pins[] = { GPIOX_5 };
152152 static const unsigned int sdio_irq_pins[] = { GPIOX_7 };
153153
154154 static const unsigned int nand_ce0_pins[] = { BOOT_8 };
drivers/pinctrl/pinctrl-falcon.c+1−1
@@ -451,7 +451,7 @@ static int pinctrl_falcon_probe(struct platform_device *pdev) · 450 unmodified lines
451451 falcon_info.clk[*bank] = clk_get(&ppdev->dev, NULL);
452452 if (IS_ERR(falcon_info.clk[*bank])) {
453453 dev_err(&ppdev->dev, "failed to get clock\n");
454− of_node_put(np)
454+ of_node_put(np);
455455 return PTR_ERR(falcon_info.clk[*bank]);
456456 }
457457 falcon_info.membase[*bank] = devm_ioremap_resource(&pdev->dev,
drivers/pinctrl/qcom/pinctrl-msm.c+1−2
@@ -1104,7 +1104,6 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl) · 1103 unmodified lines
11041104 pctrl->irq_chip.irq_mask = msm_gpio_irq_mask;
11051105 pctrl->irq_chip.irq_unmask = msm_gpio_irq_unmask;
11061106 pctrl->irq_chip.irq_ack = msm_gpio_irq_ack;
1107− pctrl->irq_chip.irq_eoi = irq_chip_eoi_parent;
11081107 pctrl->irq_chip.irq_set_type = msm_gpio_irq_set_type;
11091108 pctrl->irq_chip.irq_set_wake = msm_gpio_irq_set_wake;
11101109 pctrl->irq_chip.irq_request_resources = msm_gpio_irq_reqres;
@@ -1118,7 +1117,7 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl) · 7 unmodified lines
11181117 if (!chip->irq.parent_domain)
11191118 return -EPROBE_DEFER;
11201119 chip->irq.child_to_parent_hwirq = msm_gpio_wakeirq;
1121−
1120+ pctrl->irq_chip.irq_eoi = irq_chip_eoi_parent;
11221121 /*
11231122 * Let's skip handling the GPIOs, if the parent irqchip
11241123 * is handling the direct connect IRQ of the GPIO.
drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c+1−1
@@ -794,7 +794,7 @@ static int pm8xxx_gpio_probe(struct platform_device *pdev) · 793 unmodified lines
794794 girq->fwnode = of_node_to_fwnode(pctrl->dev->of_node);
795795 girq->parent_domain = parent_domain;
796796 girq->child_to_parent_hwirq = pm8xxx_child_to_parent_hwirq;
797− girq->populate_parent_alloc_arg = gpiochip_populate_parent_fwspec_fourcell;
797+ girq->populate_parent_alloc_arg = gpiochip_populate_parent_fwspec_twocell;
798798 girq->child_offset_to_irq = pm8xxx_child_offset_to_irq;
799799 girq->child_irq_domain_ops.translate = pm8xxx_domain_translate;
800800
drivers/rtc/Kconfig+1−0
@@ -327,6 +327,7 @@ config RTC_DRV_MAX6900 · 326 unmodified lines
327327 config RTC_DRV_MAX8907
328328 tristate "Maxim MAX8907"
329329 depends on MFD_MAX8907 || COMPILE_TEST
330+ select REGMAP_IRQ
330331 help
331332 If you say yes here you will get support for the
332333 RTC of Maxim MAX8907 PMIC.
drivers/s390/block/dasd.c+24−3
@@ -178,6 +178,8 @@ struct dasd_block *dasd_alloc_block(void) · 177 unmodified lines
178178 (unsigned long) block);
179179 INIT_LIST_HEAD(&block->ccw_queue);
180180 spin_lock_init(&block->queue_lock);
181+ INIT_LIST_HEAD(&block->format_list);
182+ spin_lock_init(&block->format_lock);
181183 timer_setup(&block->timer, dasd_block_timeout, 0);
182184 spin_lock_init(&block->profile.lock);
183185
@@ -1779,20 +1781,26 @@ void dasd_int_handler(struct ccw_device *cdev, unsigned long intparm, · 1595 unmodified lines
17791781
17801782 if (dasd_ese_needs_format(cqr->block, irb)) {
17811783 if (rq_data_dir((struct request *)cqr->callback_data) == READ) {
1782− device->discipline->ese_read(cqr);
1784+ device->discipline->ese_read(cqr, irb);
17831785 cqr->status = DASD_CQR_SUCCESS;
17841786 cqr->stopclk = now;
17851787 dasd_device_clear_timer(device);
17861788 dasd_schedule_device_bh(device);
17871789 return;
17881790 }
1789− fcqr = device->discipline->ese_format(device, cqr);
1791+ fcqr = device->discipline->ese_format(device, cqr, irb);
17901792 if (IS_ERR(fcqr)) {
1793+ if (PTR_ERR(fcqr) == -EINVAL) {
1794+ cqr->status = DASD_CQR_ERROR;
1795+ return;
1796+ }
17911797 /*
17921798 * If we can't format now, let the request go
17931799 * one extra round. Maybe we can format later.
17941800 */
17951801 cqr->status = DASD_CQR_QUEUED;
1802+ dasd_schedule_device_bh(device);
1803+ return;
17961804 } else {
17971805 fcqr->status = DASD_CQR_QUEUED;
17981806 cqr->status = DASD_CQR_QUEUED;
@@ -2748,11 +2756,13 @@ static void __dasd_cleanup_cqr(struct dasd_ccw_req *cqr) · 949 unmodified lines
27482756 {
27492757 struct request *req;
27502758 blk_status_t error = BLK_STS_OK;
2759+ unsigned int proc_bytes;
27512760 int status;
27522761
27532762 req = (struct request *) cqr->callback_data;
27542763 dasd_profile_end(cqr->block, cqr, req);
27552764
2765+ proc_bytes = cqr->proc_bytes;
27562766 status = cqr->block->base->discipline->free_cp(cqr, req);
27572767 if (status < 0)
27582768 error = errno_to_blk_status(status);
@@ -2783,7 +2793,18 @@ static void __dasd_cleanup_cqr(struct dasd_ccw_req *cqr) · 24 unmodified lines
27832793 blk_mq_end_request(req, error);
27842794 blk_mq_run_hw_queues(req->q, true);
27852795 } else {
2786− blk_mq_complete_request(req);
2796+ /*
2797+ * Partial completed requests can happen with ESE devices.
2798+ * During read we might have gotten a NRF error and have to
2799+ * complete a request partially.
2800+ */
2801+ if (proc_bytes) {
2802+ blk_update_request(req, BLK_STS_OK,
2803+ blk_rq_bytes(req) - proc_bytes);
2804+ blk_mq_requeue_request(req, true);
2805+ } else {
2806+ blk_mq_complete_request(req);
2807+ }
27872808 }
27882809 }
27892810
drivers/s390/block/dasd_eckd.c+156−7
@@ -207,6 +207,45 @@ static void set_ch_t(struct ch_t *geo, __u32 cyl, __u8 head) · 206 unmodified lines
207207 geo->head |= head;
208208 }
209209
210+/*
211+ * calculate failing track from sense data depending if
212+ * it is an EAV device or not
213+ */
214+static int dasd_eckd_track_from_irb(struct irb *irb, struct dasd_device *device,
215+ sector_t *track)
216+{
217+ struct dasd_eckd_private *private = device->private;
218+ u8 *sense = NULL;
219+ u32 cyl;
220+ u8 head;
221+
222+ sense = dasd_get_sense(irb);
223+ if (!sense) {
224+ DBF_DEV_EVENT(DBF_WARNING, device, "%s",
225+ "ESE error no sense data\n");
226+ return -EINVAL;
227+ }
228+ if (!(sense[27] & DASD_SENSE_BIT_2)) {
229+ DBF_DEV_EVENT(DBF_WARNING, device, "%s",
230+ "ESE error no valid track data\n");
231+ return -EINVAL;
232+ }
233+
234+ if (sense[27] & DASD_SENSE_BIT_3) {
235+ /* enhanced addressing */
236+ cyl = sense[30] << 20;
237+ cyl |= (sense[31] & 0xF0) << 12;
238+ cyl |= sense[28] << 8;
239+ cyl |= sense[29];
240+ } else {
241+ cyl = sense[29] << 8;
242+ cyl |= sense[30];
243+ }
244+ head = sense[31] & 0x0F;
245+ *track = cyl * private->rdc_data.trk_per_cyl + head;
246+ return 0;
247+}
248+
210249 static int set_timestamp(struct ccw1 *ccw, struct DE_eckd_data *data,
211250 struct dasd_device *device)
212251 {
@@ -2986,6 +3025,37 @@ static int dasd_eckd_format_device(struct dasd_device *base, · 2773 unmodified lines
29863025 0, NULL);
29873026 }
29883027
3028+static bool test_and_set_format_track(struct dasd_format_entry *to_format,
3029+ struct dasd_block *block)
3030+{
3031+ struct dasd_format_entry *format;
3032+ unsigned long flags;
3033+ bool rc = false;
3034+
3035+ spin_lock_irqsave(&block->format_lock, flags);
3036+ list_for_each_entry(format, &block->format_list, list) {
3037+ if (format->track == to_format->track) {
3038+ rc = true;
3039+ goto out;
3040+ }
3041+ }
3042+ list_add_tail(&to_format->list, &block->format_list);
3043+
3044+out:
3045+ spin_unlock_irqrestore(&block->format_lock, flags);
3046+ return rc;
3047+}
3048+
3049+static void clear_format_track(struct dasd_format_entry *format,
3050+ struct dasd_block *block)
3051+{
3052+ unsigned long flags;
3053+
3054+ spin_lock_irqsave(&block->format_lock, flags);
3055+ list_del_init(&format->list);
3056+ spin_unlock_irqrestore(&block->format_lock, flags);
3057+}
3058+
29893059 /*
29903060 * Callback function to free ESE format requests.
29913061 */
@@ -2993,15 +3063,19 @@ static void dasd_eckd_ese_format_cb(struct dasd_ccw_req *cqr, void *data) · 1 unmodified line
29933063 {
29943064 struct dasd_device *device = cqr->startdev;
29953065 struct dasd_eckd_private *private = device->private;
3066+ struct dasd_format_entry *format = data;
29963067
3068+ clear_format_track(format, cqr->basedev->block);
29973069 private->count--;
29983070 dasd_ffree_request(cqr, device);
29993071 }
30003072
30013073 static struct dasd_ccw_req *
3002−dasd_eckd_ese_format(struct dasd_device *startdev, struct dasd_ccw_req *cqr)
3074+dasd_eckd_ese_format(struct dasd_device *startdev, struct dasd_ccw_req *cqr,
3075+ struct irb *irb)
30033076 {
30043077 struct dasd_eckd_private *private;
3078+ struct dasd_format_entry *format;
30053079 struct format_data_t fdata;
30063080 unsigned int recs_per_trk;
30073081 struct dasd_ccw_req *fcqr;
@@ -3011,23 +3085,39 @@ dasd_eckd_ese_format(struct dasd_device *startdev, struct dasd_ccw_req *cqr) · 3 unmodified lines
30113085 struct request *req;
30123086 sector_t first_trk;
30133087 sector_t last_trk;
3088+ sector_t curr_trk;
30143089 int rc;
30153090
30163091 req = cqr->callback_data;
3017− base = cqr->block->base;
3092+ block = cqr->block;
3093+ base = block->base;
30183094 private = base->private;
3019− block = base->block;
30203095 blksize = block->bp_block;
30213096 recs_per_trk = recs_per_track(&private->rdc_data, 0, blksize);
3097+ format = &startdev->format_entry;
30223098
30233099 first_trk = blk_rq_pos(req) >> block->s2b_shift;
30243100 sector_div(first_trk, recs_per_trk);
30253101 last_trk =
30263102 (blk_rq_pos(req) + blk_rq_sectors(req) - 1) >> block->s2b_shift;
30273103 sector_div(last_trk, recs_per_trk);
3104+ rc = dasd_eckd_track_from_irb(irb, base, &curr_trk);
3105+ if (rc)
3106+ return ERR_PTR(rc);
30283107
3029− fdata.start_unit = first_trk;
3030− fdata.stop_unit = last_trk;
3108+ if (curr_trk < first_trk || curr_trk > last_trk) {
3109+ DBF_DEV_EVENT(DBF_WARNING, startdev,
3110+ "ESE error track %llu not within range %llu - %llu\n",
3111+ curr_trk, first_trk, last_trk);
3112+ return ERR_PTR(-EINVAL);
3113+ }
3114+ format->track = curr_trk;
3115+ /* test if track is already in formatting by another thread */
3116+ if (test_and_set_format_track(format, block))
3117+ return ERR_PTR(-EEXIST);
3118+
3119+ fdata.start_unit = curr_trk;
3120+ fdata.stop_unit = curr_trk;
30313121 fdata.blksize = blksize;
30323122 fdata.intensity = private->uses_cdl ? DASD_FMT_INT_COMPAT : 0;
30333123
@@ -3044,6 +3134,7 @@ dasd_eckd_ese_format(struct dasd_device *startdev, struct dasd_ccw_req *cqr) · 10 unmodified lines
30443134 return fcqr;
30453135
30463136 fcqr->callback = dasd_eckd_ese_format_cb;
3137+ fcqr->callback_data = (void *) format;
30473138
30483139 return fcqr;
30493140 }
@@ -3051,29 +3142,87 @@ dasd_eckd_ese_format(struct dasd_device *startdev, struct dasd_ccw_req *cqr) · 1 unmodified line
30513142 /*
30523143 * When data is read from an unformatted area of an ESE volume, this function
30533144 * returns zeroed data and thereby mimics a read of zero data.
3145+ *
3146+ * The first unformatted track is the one that got the NRF error, the address is
3147+ * encoded in the sense data.
3148+ *
3149+ * All tracks before have returned valid data and should not be touched.
3150+ * All tracks after the unformatted track might be formatted or not. This is
3151+ * currently not known, remember the processed data and return the remainder of
3152+ * the request to the blocklayer in __dasd_cleanup_cqr().
30543153 */
3055−static void dasd_eckd_ese_read(struct dasd_ccw_req *cqr)
3154+static int dasd_eckd_ese_read(struct dasd_ccw_req *cqr, struct irb *irb)
30563155 {
3156+ struct dasd_eckd_private *private;
3157+ sector_t first_trk, last_trk;
3158+ sector_t first_blk, last_blk;
30573159 unsigned int blksize, off;
3160+ unsigned int recs_per_trk;
30583161 struct dasd_device *base;
30593162 struct req_iterator iter;
3163+ struct dasd_block *block;
3164+ unsigned int skip_block;
3165+ unsigned int blk_count;
30603166 struct request *req;
30613167 struct bio_vec bv;
3168+ sector_t curr_trk;
3169+ sector_t end_blk;
30623170 char *dst;
3171+ int rc;
30633172
30643173 req = (struct request *) cqr->callback_data;
30653174 base = cqr->block->base;
30663175 blksize = base->block->bp_block;
3176+ block = cqr->block;
3177+ private = base->private;
3178+ skip_block = 0;
3179+ blk_count = 0;
3180+
3181+ recs_per_trk = recs_per_track(&private->rdc_data, 0, blksize);
3182+ first_trk = first_blk = blk_rq_pos(req) >> block->s2b_shift;
3183+ sector_div(first_trk, recs_per_trk);
3184+ last_trk = last_blk =
3185+ (blk_rq_pos(req) + blk_rq_sectors(req) - 1) >> block->s2b_shift;
3186+ sector_div(last_trk, recs_per_trk);
3187+ rc = dasd_eckd_track_from_irb(irb, base, &curr_trk);
3188+ if (rc)
3189+ return rc;
3190+
3191+ /* sanity check if the current track from sense data is valid */
3192+ if (curr_trk < first_trk || curr_trk > last_trk) {
3193+ DBF_DEV_EVENT(DBF_WARNING, base,
3194+ "ESE error track %llu not within range %llu - %llu\n",
3195+ curr_trk, first_trk, last_trk);
3196+ return -EINVAL;
3197+ }
3198+
3199+ /*
3200+ * if not the first track got the NRF error we have to skip over valid
3201+ * blocks
3202+ */
3203+ if (curr_trk != first_trk)
3204+ skip_block = curr_trk * recs_per_trk - first_blk;
3205+
3206+ /* we have no information beyond the current track */
3207+ end_blk = (curr_trk + 1) * recs_per_trk;
30673208
30683209 rq_for_each_segment(bv, req, iter) {
30693210 dst = page_address(bv.bv_page) + bv.bv_offset;
30703211 for (off = 0; off < bv.bv_len; off += blksize) {
3071− if (dst && rq_data_dir(req) == READ) {
3212+ if (first_blk + blk_count >= end_blk) {
3213+ cqr->proc_bytes = blk_count * blksize;
3214+ return 0;
3215+ }
3216+ if (dst && !skip_block) {
30723217 dst += off;
30733218 memset(dst, 0, blksize);
3219+ } else {
3220+ skip_block--;
30743221 }
3222+ blk_count++;
30753223 }
30763224 }
3225+ return 0;
30773226 }
30783227
30793228 /*
drivers/s390/block/dasd_int.h+13−2
@@ -187,6 +187,7 @@ struct dasd_ccw_req { · 186 unmodified lines
187187
188188 void (*callback)(struct dasd_ccw_req *, void *data);
189189 void *callback_data;
190+ unsigned int proc_bytes; /* bytes for partial completion */
190191 };
191192
192193 /*
@@ -387,8 +388,9 @@ struct dasd_discipline { · 194 unmodified lines
387388 int (*ext_pool_warn_thrshld)(struct dasd_device *);
388389 int (*ext_pool_oos)(struct dasd_device *);
389390 int (*ext_pool_exhaust)(struct dasd_device *, struct dasd_ccw_req *);
390− struct dasd_ccw_req *(*ese_format)(struct dasd_device *, struct dasd_ccw_req *);
391− void (*ese_read)(struct dasd_ccw_req *);
391+ struct dasd_ccw_req *(*ese_format)(struct dasd_device *,
392+ struct dasd_ccw_req *, struct irb *);
393+ int (*ese_read)(struct dasd_ccw_req *, struct irb *);
392394 };
393395
394396 extern struct dasd_discipline *dasd_diag_discipline_pointer;
@@ -474,6 +476,11 @@ struct dasd_profile { · 79 unmodified lines
474476 spinlock_t lock;
475477 };
476478
479+struct dasd_format_entry {
480+ struct list_head list;
481+ sector_t track;
482+};
483+
477484 struct dasd_device {
478485 /* Block device stuff. */
479486 struct dasd_block *block;
@@ -539,6 +546,7 @@ struct dasd_device { · 59 unmodified lines
539546 struct dentry *debugfs_dentry;
540547 struct dentry *hosts_dentry;
541548 struct dasd_profile profile;
549+ struct dasd_format_entry format_entry;
542550 };
543551
544552 struct dasd_block {
@@ -564,6 +572,9 @@ struct dasd_block { · 19 unmodified lines
564572
565573 struct dentry *debugfs_dentry;
566574 struct dasd_profile profile;
575+
576+ struct list_head format_list;
577+ spinlock_t format_lock;
567578 };
568579
569580 struct dasd_attention_data {
drivers/s390/net/qeth_core.h+2−2
@@ -369,7 +369,7 @@ enum qeth_qdio_info_states { · 368 unmodified lines
369369 struct qeth_buffer_pool_entry {
370370 struct list_head list;
371371 struct list_head init_list;
372− void *elements[QDIO_MAX_ELEMENTS_PER_BUFFER];
372+ struct page *elements[QDIO_MAX_ELEMENTS_PER_BUFFER];
373373 };
374374
375375 struct qeth_qdio_buffer_pool {
@@ -983,7 +983,7 @@ extern const struct attribute_group qeth_device_blkt_group; · 607 unmodified lines
983983 extern const struct device_type qeth_generic_devtype;
984984
985985 const char *qeth_get_cardname_short(struct qeth_card *);
986−int qeth_realloc_buffer_pool(struct qeth_card *, int);
986+int qeth_resize_buffer_pool(struct qeth_card *card, unsigned int count);
987987 int qeth_core_load_discipline(struct qeth_card *, enum qeth_discipline_id);
988988 void qeth_core_free_discipline(struct qeth_card *);
989989
drivers/s390/net/qeth_core_main.c+118−58
@@ -65,7 +65,6 @@ static struct lock_class_key qdio_out_skb_queue_key; · 64 unmodified lines
6565 static void qeth_issue_next_read_cb(struct qeth_card *card,
6666 struct qeth_cmd_buffer *iob,
6767 unsigned int data_length);
68−static void qeth_free_buffer_pool(struct qeth_card *);
6968 static int qeth_qdio_establish(struct qeth_card *);
7069 static void qeth_free_qdio_queues(struct qeth_card *card);
7170 static void qeth_notify_skbs(struct qeth_qdio_out_q *queue,
@@ -212,49 +211,121 @@ void qeth_clear_working_pool_list(struct qeth_card *card) · 140 unmodified lines
212211 }
213212 EXPORT_SYMBOL_GPL(qeth_clear_working_pool_list);
214213
214+static void qeth_free_pool_entry(struct qeth_buffer_pool_entry *entry)
215+{
216+ unsigned int i;
217+
218+ for (i = 0; i < ARRAY_SIZE(entry->elements); i++) {
219+ if (entry->elements[i])
220+ __free_page(entry->elements[i]);
221+ }
222+
223+ kfree(entry);
224+}
225+
226+static void qeth_free_buffer_pool(struct qeth_card *card)
227+{
228+ struct qeth_buffer_pool_entry *entry, *tmp;
229+
230+ list_for_each_entry_safe(entry, tmp, &card->qdio.init_pool.entry_list,
231+ init_list) {
232+ list_del(&entry->init_list);
233+ qeth_free_pool_entry(entry);
234+ }
235+}
236+
237+static struct qeth_buffer_pool_entry *qeth_alloc_pool_entry(unsigned int pages)
238+{
239+ struct qeth_buffer_pool_entry *entry;
240+ unsigned int i;
241+
242+ entry = kzalloc(sizeof(*entry), GFP_KERNEL);
243+ if (!entry)
244+ return NULL;
245+
246+ for (i = 0; i < pages; i++) {
247+ entry->elements[i] = alloc_page(GFP_KERNEL);
248+
249+ if (!entry->elements[i]) {
250+ qeth_free_pool_entry(entry);
251+ return NULL;
252+ }
253+ }
254+
255+ return entry;
256+}
257+
215258 static int qeth_alloc_buffer_pool(struct qeth_card *card)
216259 {
217− struct qeth_buffer_pool_entry *pool_entry;
218− void *ptr;
219− int i, j;
260+ unsigned int buf_elements = QETH_MAX_BUFFER_ELEMENTS(card);
261+ unsigned int i;
220262
221263 QETH_CARD_TEXT(card, 5, "alocpool");
222264 for (i = 0; i < card->qdio.init_pool.buf_count; ++i) {
223− pool_entry = kzalloc(sizeof(*pool_entry), GFP_KERNEL);
224− if (!pool_entry) {
265+ struct qeth_buffer_pool_entry *entry;
266+
267+ entry = qeth_alloc_pool_entry(buf_elements);
268+ if (!entry) {
225269 qeth_free_buffer_pool(card);
226270 return -ENOMEM;
227271 }
228− for (j = 0; j < QETH_MAX_BUFFER_ELEMENTS(card); ++j) {
229− ptr = (void *) __get_free_page(GFP_KERNEL);
230− if (!ptr) {
231− while (j > 0)
232− free_page((unsigned long)
233− pool_entry->elements[--j]);
234− kfree(pool_entry);
235− qeth_free_buffer_pool(card);
236− return -ENOMEM;
237− }
238− pool_entry->elements[j] = ptr;
239− }
240− list_add(&pool_entry->init_list,
241− &card->qdio.init_pool.entry_list);
272+
273+ list_add(&entry->init_list, &card->qdio.init_pool.entry_list);
242274 }
243275 return 0;
244276 }
245277
246−int qeth_realloc_buffer_pool(struct qeth_card *card, int bufcnt)
278+int qeth_resize_buffer_pool(struct qeth_card *card, unsigned int count)
247279 {
280+ unsigned int buf_elements = QETH_MAX_BUFFER_ELEMENTS(card);
281+ struct qeth_qdio_buffer_pool *pool = &card->qdio.init_pool;
282+ struct qeth_buffer_pool_entry *entry, *tmp;
283+ int delta = count - pool->buf_count;
284+ LIST_HEAD(entries);
285+
248286 QETH_CARD_TEXT(card, 2, "realcbp");
249287
250− /* TODO: steel/add buffers from/to a running card's buffer pool (?) */
251− qeth_clear_working_pool_list(card);
252− qeth_free_buffer_pool(card);
253− card->qdio.in_buf_pool.buf_count = bufcnt;
254− card->qdio.init_pool.buf_count = bufcnt;
255− return qeth_alloc_buffer_pool(card);
288+ /* Defer until queue is allocated: */
289+ if (!card->qdio.in_q)
290+ goto out;
291+
292+ /* Remove entries from the pool: */
293+ while (delta < 0) {
294+ entry = list_first_entry(&pool->entry_list,
295+ struct qeth_buffer_pool_entry,
296+ init_list);
297+ list_del(&entry->init_list);
298+ qeth_free_pool_entry(entry);
299+
300+ delta++;
301+ }
302+
303+ /* Allocate additional entries: */
304+ while (delta > 0) {
305+ entry = qeth_alloc_pool_entry(buf_elements);
306+ if (!entry) {
307+ list_for_each_entry_safe(entry, tmp, &entries,
308+ init_list) {
309+ list_del(&entry->init_list);
310+ qeth_free_pool_entry(entry);
311+ }
312+
313+ return -ENOMEM;
314+ }
315+
316+ list_add(&entry->init_list, &entries);
317+
318+ delta--;
319+ }
320+
321+ list_splice(&entries, &pool->entry_list);
322+
323+out:
324+ card->qdio.in_buf_pool.buf_count = count;
325+ pool->buf_count = count;
326+ return 0;
256327 }
257−EXPORT_SYMBOL_GPL(qeth_realloc_buffer_pool);
328+EXPORT_SYMBOL_GPL(qeth_resize_buffer_pool);
258329
259330 static void qeth_free_qdio_queue(struct qeth_qdio_q *q)
260331 {
@@ -1170,19 +1241,6 @@ void qeth_drain_output_queues(struct qeth_card *card) · 909 unmodified lines
11701241 }
11711242 EXPORT_SYMBOL_GPL(qeth_drain_output_queues);
11721243
1173−static void qeth_free_buffer_pool(struct qeth_card *card)
1174−{
1175− struct qeth_buffer_pool_entry *pool_entry, *tmp;
1176− int i = 0;
1177− list_for_each_entry_safe(pool_entry, tmp,
1178− &card->qdio.init_pool.entry_list, init_list){
1179− for (i = 0; i < QETH_MAX_BUFFER_ELEMENTS(card); ++i)
1180− free_page((unsigned long)pool_entry->elements[i]);
1181− list_del(&pool_entry->init_list);
1182− kfree(pool_entry);
1183− }
1184−}
1185−
11861244 static int qeth_osa_set_output_queues(struct qeth_card *card, bool single)
11871245 {
11881246 unsigned int count = single ? 1 : card->dev->num_tx_queues;
@@ -1204,7 +1262,6 @@ static int qeth_osa_set_output_queues(struct qeth_card *card, bool single) · 15 unmodified lines
12041262 if (count == 1)
12051263 dev_info(&card->gdev->dev, "Priority Queueing not supported\n");
12061264
1207− card->qdio.default_out_queue = single ? 0 : QETH_DEFAULT_QUEUE;
12081265 card->qdio.no_out_queues = count;
12091266 return 0;
12101267 }
@@ -2393,7 +2450,6 @@ static void qeth_free_qdio_queues(struct qeth_card *card) · 1182 unmodified lines
23932450 return;
23942451
23952452 qeth_free_cq(card);
2396− cancel_delayed_work_sync(&card->buffer_reclaim_work);
23972453 for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; ++j) {
23982454 if (card->qdio.in_q->bufs[j].rx_skb)
23992455 dev_kfree_skb_any(card->qdio.in_q->bufs[j].rx_skb);
@@ -2575,7 +2631,6 @@ static struct qeth_buffer_pool_entry *qeth_find_free_buffer_pool_entry( · 175 unmodified lines
25752631 struct list_head *plh;
25762632 struct qeth_buffer_pool_entry *entry;
25772633 int i, free;
2578− struct page *page;
25792634
25802635 if (list_empty(&card->qdio.in_buf_pool.entry_list))
25812636 return NULL;
@@ -2584,7 +2639,7 @@ static struct qeth_buffer_pool_entry *qeth_find_free_buffer_pool_entry( · 2 unmodified lines
25842639 entry = list_entry(plh, struct qeth_buffer_pool_entry, list);
25852640 free = 1;
25862641 for (i = 0; i < QETH_MAX_BUFFER_ELEMENTS(card); ++i) {
2587− if (page_count(virt_to_page(entry->elements[i])) > 1) {
2642+ if (page_count(entry->elements[i]) > 1) {
25882643 free = 0;
25892644 break;
25902645 }
@@ -2599,15 +2654,15 @@ static struct qeth_buffer_pool_entry *qeth_find_free_buffer_pool_entry( · 8 unmodified lines
25992654 entry = list_entry(card->qdio.in_buf_pool.entry_list.next,
26002655 struct qeth_buffer_pool_entry, list);
26012656 for (i = 0; i < QETH_MAX_BUFFER_ELEMENTS(card); ++i) {
2602− if (page_count(virt_to_page(entry->elements[i])) > 1) {
2603− page = alloc_page(GFP_ATOMIC);
2604− if (!page) {
2657+ if (page_count(entry->elements[i]) > 1) {
2658+ struct page *page = alloc_page(GFP_ATOMIC);
2659+
2660+ if (!page)
26052661 return NULL;
2606− } else {
2607− free_page((unsigned long)entry->elements[i]);
2608− entry->elements[i] = page_address(page);
2609− QETH_CARD_STAT_INC(card, rx_sg_alloc_page);
2610− }
2662+
2663+ __free_page(entry->elements[i]);
2664+ entry->elements[i] = page;
2665+ QETH_CARD_STAT_INC(card, rx_sg_alloc_page);
26112666 }
26122667 }
26132668 list_del_init(&entry->list);
@@ -2625,12 +2680,12 @@ static int qeth_init_input_buffer(struct qeth_card *card, · 11 unmodified lines
26252680 ETH_HLEN +
26262681 sizeof(struct ipv6hdr));
26272682 if (!buf->rx_skb)
2628− return 1;
2683+ return -ENOMEM;
26292684 }
26302685
26312686 pool_entry = qeth_find_free_buffer_pool_entry(card);
26322687 if (!pool_entry)
2633− return 1;
2688+ return -ENOBUFS;
26342689
26352690 /*
26362691 * since the buffer is accessed only from the input_tasklet
@@ -2643,7 +2698,7 @@ static int qeth_init_input_buffer(struct qeth_card *card, · 6 unmodified lines
26432698 for (i = 0; i < QETH_MAX_BUFFER_ELEMENTS(card); ++i) {
26442699 buf->buffer->element[i].length = PAGE_SIZE;
26452700 buf->buffer->element[i].addr =
2646− virt_to_phys(pool_entry->elements[i]);
2701+ page_to_phys(pool_entry->elements[i]);
26472702 if (i == QETH_MAX_BUFFER_ELEMENTS(card) - 1)
26482703 buf->buffer->element[i].eflags = SBAL_EFLAGS_LAST_ENTRY;
26492704 else
@@ -2675,10 +2730,15 @@ static int qeth_init_qdio_queues(struct qeth_card *card) · 25 unmodified lines
26752730 /* inbound queue */
26762731 qdio_reset_buffers(card->qdio.in_q->qdio_bufs, QDIO_MAX_BUFFERS_PER_Q);
26772732 memset(&card->rx, 0, sizeof(struct qeth_rx));
2733+
26782734 qeth_initialize_working_pool_list(card);
26792735 /*give only as many buffers to hardware as we have buffer pool entries*/
2680− for (i = 0; i < card->qdio.in_buf_pool.buf_count - 1; ++i)
2681− qeth_init_input_buffer(card, &card->qdio.in_q->bufs[i]);
2736+ for (i = 0; i < card->qdio.in_buf_pool.buf_count - 1; i++) {
2737+ rc = qeth_init_input_buffer(card, &card->qdio.in_q->bufs[i]);
2738+ if (rc)
2739+ return rc;
2740+ }
2741+
26822742 card->qdio.in_q->next_buf_to_init =
26832743 card->qdio.in_buf_pool.buf_count - 1;
26842744 rc = do_QDIO(CARD_DDEV(card), QDIO_FLAG_SYNC_INPUT, 0, 0,
drivers/s390/net/qeth_core_sys.c+4−5
@@ -247,8 +247,8 @@ static ssize_t qeth_dev_bufcnt_store(struct device *dev, · 246 unmodified lines
247247 struct device_attribute *attr, const char *buf, size_t count)
248248 {
249249 struct qeth_card *card = dev_get_drvdata(dev);
250+ unsigned int cnt;
250251 char *tmp;
251− int cnt, old_cnt;
252252 int rc = 0;
253253
254254 mutex_lock(&card->conf_mutex);
@@ -257,13 +257,12 @@ static ssize_t qeth_dev_bufcnt_store(struct device *dev, · 2 unmodified lines
257257 goto out;
258258 }
259259
260− old_cnt = card->qdio.in_buf_pool.buf_count;
261260 cnt = simple_strtoul(buf, &tmp, 10);
262261 cnt = (cnt < QETH_IN_BUF_COUNT_MIN) ? QETH_IN_BUF_COUNT_MIN :
263262 ((cnt > QETH_IN_BUF_COUNT_MAX) ? QETH_IN_BUF_COUNT_MAX : cnt);
264− if (old_cnt != cnt) {
265− rc = qeth_realloc_buffer_pool(card, cnt);
266− }
263+
264+ rc = qeth_resize_buffer_pool(card, cnt);
265+
267266 out:
268267 mutex_unlock(&card->conf_mutex);
269268 return rc ? rc : count;
drivers/s390/net/qeth_l2_main.c+1−0
@@ -284,6 +284,7 @@ static void qeth_l2_stop_card(struct qeth_card *card) · 283 unmodified lines
284284 if (card->state == CARD_STATE_SOFTSETUP) {
285285 qeth_clear_ipacmd_list(card);
286286 qeth_drain_output_queues(card);
287+ cancel_delayed_work_sync(&card->buffer_reclaim_work);
287288 card->state = CARD_STATE_DOWN;
288289 }
289290
drivers/s390/net/qeth_l3_main.c+1−0
@@ -1178,6 +1178,7 @@ static void qeth_l3_stop_card(struct qeth_card *card) · 1177 unmodified lines
11781178 qeth_l3_clear_ip_htable(card, 1);
11791179 qeth_clear_ipacmd_list(card);
11801180 qeth_drain_output_queues(card);
1181+ cancel_delayed_work_sync(&card->buffer_reclaim_work);
11811182 card->state = CARD_STATE_DOWN;
11821183 }
11831184
drivers/s390/net/qeth_l3_sys.c+4−5
@@ -206,12 +206,11 @@ static ssize_t qeth_l3_dev_sniffer_store(struct device *dev, · 205 unmodified lines
206206 qdio_get_ssqd_desc(CARD_DDEV(card), &card->ssqd);
207207 if (card->ssqd.qdioac2 & CHSC_AC2_SNIFFER_AVAILABLE) {
208208 card->options.sniffer = i;
209− if (card->qdio.init_pool.buf_count !=
210− QETH_IN_BUF_COUNT_MAX)
211− qeth_realloc_buffer_pool(card,
212− QETH_IN_BUF_COUNT_MAX);
213− } else
209+ qeth_resize_buffer_pool(card, QETH_IN_BUF_COUNT_MAX);
210+ } else {
214211 rc = -EPERM;
212+ }
213+
215214 break;
216215 default:
217216 rc = -EINVAL;
drivers/scsi/ipr.c+2−1
@@ -9950,6 +9950,7 @@ static void ipr_init_ioa_cfg(struct ipr_ioa_cfg *ioa_cfg, · 9949 unmodified lines
99509950 ioa_cfg->max_devs_supported = ipr_max_devs;
99519951
99529952 if (ioa_cfg->sis64) {
9953+ host->max_channel = IPR_MAX_SIS64_BUSES;
99539954 host->max_id = IPR_MAX_SIS64_TARGETS_PER_BUS;
99549955 host->max_lun = IPR_MAX_SIS64_LUNS_PER_TARGET;
99559956 if (ipr_max_devs > IPR_MAX_SIS64_DEVS)
@@ -9958,6 +9959,7 @@ static void ipr_init_ioa_cfg(struct ipr_ioa_cfg *ioa_cfg, · 2 unmodified lines
99589959 + ((sizeof(struct ipr_config_table_entry64)
99599960 * ioa_cfg->max_devs_supported)));
99609961 } else {
9962+ host->max_channel = IPR_VSET_BUS;
99619963 host->max_id = IPR_MAX_NUM_TARGETS_PER_BUS;
99629964 host->max_lun = IPR_MAX_NUM_LUNS_PER_TARGET;
99639965 if (ipr_max_devs > IPR_MAX_PHYSICAL_DEVS)
@@ -9967,7 +9969,6 @@ static void ipr_init_ioa_cfg(struct ipr_ioa_cfg *ioa_cfg, · 3 unmodified lines
99679969 * ioa_cfg->max_devs_supported)));
99689970 }
99699971
9970− host->max_channel = IPR_VSET_BUS;
99719972 host->unique_id = host->host_no;
99729973 host->max_cmd_len = IPR_MAX_CDB_LEN;
99739974 host->can_queue = ioa_cfg->max_cmds;
drivers/scsi/ipr.h+1−0
@@ -1300,6 +1300,7 @@ struct ipr_resource_entry { · 1299 unmodified lines
13001300 #define IPR_ARRAY_VIRTUAL_BUS 0x1
13011301 #define IPR_VSET_VIRTUAL_BUS 0x2
13021302 #define IPR_IOAFP_VIRTUAL_BUS 0x3
1303+#define IPR_MAX_SIS64_BUSES 0x4
13031304
13041305 #define IPR_GET_RES_PHYS_LOC(res) \
13051306 (((res)->bus << 24) | ((res)->target << 8) | (res)->lun)
drivers/scsi/ufs/ufshcd.c+14−7
@@ -3884,18 +3884,25 @@ EXPORT_SYMBOL_GPL(ufshcd_uic_hibern8_exit); · 3883 unmodified lines
38843884 void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit)
38853885 {
38863886 unsigned long flags;
3887+ bool update = false;
38873888
3888− if (!(hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT))
3889+ if (!ufshcd_is_auto_hibern8_supported(hba))
38893890 return;
38903891
38913892 spin_lock_irqsave(hba->host->host_lock, flags);
3892− if (hba->ahit == ahit)
3893− goto out_unlock;
3894− hba->ahit = ahit;
3895− if (!pm_runtime_suspended(hba->dev))
3896− ufshcd_writel(hba, hba->ahit, REG_AUTO_HIBERNATE_IDLE_TIMER);
3897−out_unlock:
3893+ if (hba->ahit != ahit) {
3894+ hba->ahit = ahit;
3895+ update = true;
3896+ }
38983897 spin_unlock_irqrestore(hba->host->host_lock, flags);
3898+
3899+ if (update && !pm_runtime_suspended(hba->dev)) {
3900+ pm_runtime_get_sync(hba->dev);
3901+ ufshcd_hold(hba, false);
3902+ ufshcd_auto_hibern8_enable(hba);
3903+ ufshcd_release(hba);
3904+ pm_runtime_put(hba->dev);
3905+ }
38993906 }
39003907 EXPORT_SYMBOL_GPL(ufshcd_auto_hibern8_update);
39013908
drivers/slimbus/qcom-ngd-ctrl.c+3−0
@@ -1320,6 +1320,9 @@ static const struct of_device_id qcom_slim_ngd_dt_match[] = { · 1319 unmodified lines
13201320 {
13211321 .compatible = "qcom,slim-ngd-v1.5.0",
13221322 .data = &ngd_v1_5_offset_info,
1323+ },{
1324+ .compatible = "qcom,slim-ngd-v2.1.0",
1325+ .data = &ngd_v1_5_offset_info,
13231326 },
13241327 {}
13251328 };
drivers/staging/greybus/tools/loopback_test.c+11−10
@@ -19,6 +19,7 @@ · 18 unmodified lines
1919 #include <signal.h>
2020
2121 #define MAX_NUM_DEVICES 10
22+#define MAX_SYSFS_PREFIX 0x80
2223 #define MAX_SYSFS_PATH 0x200
2324 #define CSV_MAX_LINE 0x1000
2425 #define SYSFS_MAX_INT 0x20
@@ -67,7 +68,7 @@ struct loopback_results { · 42 unmodified lines
6768 };
6869
6970 struct loopback_device {
70− char name[MAX_SYSFS_PATH];
71+ char name[MAX_STR_LEN];
7172 char sysfs_entry[MAX_SYSFS_PATH];
7273 char debugfs_entry[MAX_SYSFS_PATH];
7374 struct loopback_results results;
@@ -93,8 +94,8 @@ struct loopback_test { · 19 unmodified lines
9394 int stop_all;
9495 int poll_count;
9596 char test_name[MAX_STR_LEN];
96− char sysfs_prefix[MAX_SYSFS_PATH];
97− char debugfs_prefix[MAX_SYSFS_PATH];
97+ char sysfs_prefix[MAX_SYSFS_PREFIX];
98+ char debugfs_prefix[MAX_SYSFS_PREFIX];
9899 struct timespec poll_timeout;
99100 struct loopback_device devices[MAX_NUM_DEVICES];
100101 struct loopback_results aggregate_results;
@@ -637,7 +638,7 @@ baddir: · 536 unmodified lines
637638 static int open_poll_files(struct loopback_test *t)
638639 {
639640 struct loopback_device *dev;
640− char buf[MAX_STR_LEN];
641+ char buf[MAX_SYSFS_PATH + MAX_STR_LEN];
641642 char dummy;
642643 int fds_idx = 0;
643644 int i;
@@ -655,7 +656,7 @@ static int open_poll_files(struct loopback_test *t) · 11 unmodified lines
655656 goto err;
656657 }
657658 read(t->fds[fds_idx].fd, &dummy, 1);
658− t->fds[fds_idx].events = EPOLLERR|EPOLLPRI;
659+ t->fds[fds_idx].events = POLLERR | POLLPRI;
659660 t->fds[fds_idx].revents = 0;
660661 fds_idx++;
661662 }
@@ -748,7 +749,7 @@ static int wait_for_complete(struct loopback_test *t) · 86 unmodified lines
748749 }
749750
750751 for (i = 0; i < t->poll_count; i++) {
751− if (t->fds[i].revents & EPOLLPRI) {
752+ if (t->fds[i].revents & POLLPRI) {
752753 /* Dummy read to clear the event */
753754 read(t->fds[i].fd, &dummy, 1);
754755 number_of_events++;
@@ -907,10 +908,10 @@ int main(int argc, char *argv[]) · 152 unmodified lines
907908 t.iteration_max = atoi(optarg);
908909 break;
909910 case 'S':
910− snprintf(t.sysfs_prefix, MAX_SYSFS_PATH, "%s", optarg);
911+ snprintf(t.sysfs_prefix, MAX_SYSFS_PREFIX, "%s", optarg);
911912 break;
912913 case 'D':
913− snprintf(t.debugfs_prefix, MAX_SYSFS_PATH, "%s", optarg);
914+ snprintf(t.debugfs_prefix, MAX_SYSFS_PREFIX, "%s", optarg);
914915 break;
915916 case 'm':
916917 t.mask = atol(optarg);
@@ -961,10 +962,10 @@ int main(int argc, char *argv[]) · 44 unmodified lines
961962 }
962963
963964 if (!strcmp(t.sysfs_prefix, ""))
964− snprintf(t.sysfs_prefix, MAX_SYSFS_PATH, "%s", sysfs_prefix);
965+ snprintf(t.sysfs_prefix, MAX_SYSFS_PREFIX, "%s", sysfs_prefix);
965966
966967 if (!strcmp(t.debugfs_prefix, ""))
967− snprintf(t.debugfs_prefix, MAX_SYSFS_PATH, "%s", debugfs_prefix);
968+ snprintf(t.debugfs_prefix, MAX_SYSFS_PREFIX, "%s", debugfs_prefix);
968969
969970 ret = find_loopback_devices(&t);
970971 if (ret)
drivers/staging/rtl8188eu/os_dep/usb_intf.c+1−0
@@ -38,6 +38,7 @@ static const struct usb_device_id rtw_usb_id_tbl[] = { · 37 unmodified lines
3838 {USB_DEVICE(0x2001, 0x331B)}, /* D-Link DWA-121 rev B1 */
3939 {USB_DEVICE(0x2357, 0x010c)}, /* TP-Link TL-WN722N v2 */
4040 {USB_DEVICE(0x2357, 0x0111)}, /* TP-Link TL-WN727N v5.21 */
41+ {USB_DEVICE(0x2C4E, 0x0102)}, /* MERCUSYS MW150US v2 */
4142 {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */
4243 {USB_DEVICE(USB_VENDER_ID_REALTEK, 0xffef)}, /* Rosewill RNX-N150NUB */
4344 {} /* Terminating entry */
drivers/staging/speakup/main.c+1−1
@@ -561,7 +561,7 @@ static u_long get_word(struct vc_data *vc) · 560 unmodified lines
561561 return 0;
562562 } else if (tmpx < vc->vc_cols - 2 &&
563563 (ch == SPACE || ch == 0 || (ch < 0x100 && IS_WDLM(ch))) &&
564− get_char(vc, (u_short *)&tmp_pos + 1, &temp) > SPACE) {
564+ get_char(vc, (u_short *)tmp_pos + 1, &temp) > SPACE) {
565565 tmp_pos += 2;
566566 tmpx++;
567567 } else {
drivers/staging/wfx/hif_tx.c+8−7
@@ -140,6 +140,7 @@ int hif_shutdown(struct wfx_dev *wdev) · 139 unmodified lines
140140 else
141141 control_reg_write(wdev, 0);
142142 mutex_unlock(&wdev->hif_cmd.lock);
143+ mutex_unlock(&wdev->hif_cmd.key_renew_lock);
143144 kfree(hif);
144145 return ret;
145146 }
@@ -289,7 +290,7 @@ int hif_stop_scan(struct wfx_vif *wvif) · 143 unmodified lines
289290 }
290291
291292 int hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf,
292− const struct ieee80211_channel *channel, const u8 *ssidie)
293+ struct ieee80211_channel *channel, const u8 *ssid, int ssidlen)
293294 {
294295 int ret;
295296 struct hif_msg *hif;
@@ -307,9 +308,9 @@ int hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, · 11 unmodified lines
307308 body->basic_rate_set =
308309 cpu_to_le32(wfx_rate_mask_to_hw(wvif->wdev, conf->basic_rates));
309310 memcpy(body->bssid, conf->bssid, sizeof(body->bssid));
310− if (!conf->ibss_joined && ssidie) {
311− body->ssid_length = cpu_to_le32(ssidie[1]);
312− memcpy(body->ssid, &ssidie[2], ssidie[1]);
311+ if (!conf->ibss_joined && ssid) {
312+ body->ssid_length = cpu_to_le32(ssidlen);
313+ memcpy(body->ssid, ssid, ssidlen);
313314 }
314315 wfx_fill_header(hif, wvif->id, HIF_REQ_ID_JOIN, sizeof(*body));
315316 ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false);
@@ -427,9 +428,9 @@ int hif_start(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, · 111 unmodified lines
427428 struct hif_msg *hif;
428429 struct hif_req_start *body = wfx_alloc_hif(sizeof(*body), &hif);
429430
430− body->dtim_period = conf->dtim_period,
431− body->short_preamble = conf->use_short_preamble,
432− body->channel_number = cpu_to_le16(channel->hw_value),
431+ body->dtim_period = conf->dtim_period;
432+ body->short_preamble = conf->use_short_preamble;
433+ body->channel_number = cpu_to_le16(channel->hw_value);
433434 body->beacon_interval = cpu_to_le32(conf->beacon_int);
434435 body->basic_rate_set =
435436 cpu_to_le32(wfx_rate_mask_to_hw(wvif->wdev, conf->basic_rates));
drivers/staging/wfx/hif_tx.h+1−1
@@ -46,7 +46,7 @@ int hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req80211, · 45 unmodified lines
4646 int chan_start, int chan_num);
4747 int hif_stop_scan(struct wfx_vif *wvif);
4848 int hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf,
49− const struct ieee80211_channel *channel, const u8 *ssidie);
49+ struct ieee80211_channel *channel, const u8 *ssid, int ssidlen);
5050 int hif_set_pm(struct wfx_vif *wvif, bool ps, int dynamic_ps_timeout);
5151 int hif_set_bss_params(struct wfx_vif *wvif,
5252 const struct hif_req_set_bss_params *arg);
drivers/staging/wfx/hif_tx_mib.h+10−5
@@ -191,10 +191,10 @@ static inline int hif_set_block_ack_policy(struct wfx_vif *wvif, · 190 unmodified lines
191191 }
192192
193193 static inline int hif_set_association_mode(struct wfx_vif *wvif,
194− struct ieee80211_bss_conf *info,
195− struct ieee80211_sta_ht_cap *ht_cap)
194+ struct ieee80211_bss_conf *info)
196195 {
197196 int basic_rates = wfx_rate_mask_to_hw(wvif->wdev, info->basic_rates);
197+ struct ieee80211_sta *sta = NULL;
198198 struct hif_mib_set_association_mode val = {
199199 .preambtype_use = 1,
200200 .mode = 1,
@@ -204,12 +204,17 @@ static inline int hif_set_association_mode(struct wfx_vif *wvif, · 3 unmodified lines
204204 .basic_rate_set = cpu_to_le32(basic_rates)
205205 };
206206
207+ rcu_read_lock(); // protect sta
208+ if (info->bssid && !info->ibss_joined)
209+ sta = ieee80211_find_sta(wvif->vif, info->bssid);
210+
207211 // FIXME: it is strange to not retrieve all information from bss_info
208− if (ht_cap && ht_cap->ht_supported) {
209− val.mpdu_start_spacing = ht_cap->ampdu_density;
212+ if (sta && sta->ht_cap.ht_supported) {
213+ val.mpdu_start_spacing = sta->ht_cap.ampdu_density;
210214 if (!(info->ht_operation_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT))
211− val.greenfield = !!(ht_cap->cap & IEEE80211_HT_CAP_GRN_FLD);
215+ val.greenfield = !!(sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD);
212216 }
217+ rcu_read_unlock();
213218
214219 return hif_write_mib(wvif->wdev, wvif->id,
215220 HIF_MIB_ID_SET_ASSOCIATION_MODE, &val, sizeof(val));
drivers/staging/wfx/sta.c+15−10
@@ -491,9 +491,11 @@ static void wfx_set_mfp(struct wfx_vif *wvif, · 490 unmodified lines
491491 static void wfx_do_join(struct wfx_vif *wvif)
492492 {
493493 int ret;
494− const u8 *ssidie;
495494 struct ieee80211_bss_conf *conf = &wvif->vif->bss_conf;
496495 struct cfg80211_bss *bss = NULL;
496+ u8 ssid[IEEE80211_MAX_SSID_LEN];
497+ const u8 *ssidie = NULL;
498+ int ssidlen = 0;
497499
498500 wfx_tx_lock_flush(wvif->wdev);
499501
@@ -514,11 +516,14 @@ static void wfx_do_join(struct wfx_vif *wvif) · 14 unmodified lines
514516 if (!wvif->beacon_int)
515517 wvif->beacon_int = 1;
516518
517− rcu_read_lock();
519+ rcu_read_lock(); // protect ssidie
518520 if (!conf->ibss_joined)
519521 ssidie = ieee80211_bss_get_ie(bss, WLAN_EID_SSID);
520− else
521− ssidie = NULL;
522+ if (ssidie) {
523+ ssidlen = ssidie[1];
524+ memcpy(ssid, &ssidie[2], ssidie[1]);
525+ }
526+ rcu_read_unlock();
522527
523528 wfx_tx_flush(wvif->wdev);
524529
@@ -527,10 +532,8 @@ static void wfx_do_join(struct wfx_vif *wvif) · 2 unmodified lines
527532
528533 wfx_set_mfp(wvif, bss);
529534
530− /* Perform actual join */
531535 wvif->wdev->tx_burst_idx = -1;
532− ret = hif_join(wvif, conf, wvif->channel, ssidie);
533− rcu_read_unlock();
536+ ret = hif_join(wvif, conf, wvif->channel, ssid, ssidlen);
534537 if (ret) {
535538 ieee80211_connection_loss(wvif->vif);
536539 wvif->join_complete_status = -1;
@@ -605,7 +608,9 @@ int wfx_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, · 68 unmodified lines
605608 int i;
606609
607610 for (i = 0; i < ARRAY_SIZE(sta_priv->buffered); i++)
608− WARN(sta_priv->buffered[i], "release station while Tx is in progress");
611+ if (sta_priv->buffered[i])
612+ dev_warn(wvif->wdev->dev, "release station while %d pending frame on queue %d",
613+ sta_priv->buffered[i], i);
609614 // FIXME: see note in wfx_sta_add()
610615 if (vif->type == NL80211_IFTYPE_STATION)
611616 return 0;
@@ -689,6 +694,7 @@ static void wfx_join_finalize(struct wfx_vif *wvif, · 77 unmodified lines
689694 wfx_rate_mask_to_hw(wvif->wdev, sta->supp_rates[wvif->channel->band]);
690695 else
691696 wvif->bss_params.operational_rate_set = -1;
697+ rcu_read_unlock();
692698 if (sta &&
693699 info->ht_operation_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT)
694700 hif_dual_cts_protection(wvif, true);
@@ -701,8 +707,7 @@ static void wfx_join_finalize(struct wfx_vif *wvif, · 6 unmodified lines
701707 wvif->bss_params.beacon_lost_count = 20;
702708 wvif->bss_params.aid = info->aid;
703709
704− hif_set_association_mode(wvif, info, sta ? &sta->ht_cap : NULL);
705− rcu_read_unlock();
710+ hif_set_association_mode(wvif, info);
706711
707712 if (!info->ibss_joined) {
708713 hif_keep_alive_period(wvif, 30 /* sec */);
drivers/thunderbolt/switch.c+1−1
@@ -954,7 +954,7 @@ static bool tb_port_is_width_supported(struct tb_port *port, int width) · 953 unmodified lines
954954 ret = tb_port_read(port, &phy, TB_CFG_PORT,
955955 port->cap_phy + LANE_ADP_CS_0, 1);
956956 if (ret)
957− return ret;
957+ return false;
958958
959959 widths = (phy & LANE_ADP_CS_0_SUPPORTED_WIDTH_MASK) >>
960960 LANE_ADP_CS_0_SUPPORTED_WIDTH_SHIFT;
drivers/tty/tty_io.c+6−8
@@ -1589,9 +1589,7 @@ void tty_kclose(struct tty_struct *tty) · 1588 unmodified lines
15891589 tty_debug_hangup(tty, "freeing structure\n");
15901590 /*
15911591 * The release_tty function takes care of the details of clearing
1592− * the slots and preserving the termios structure. The tty_unlock_pair
1593− * should be safe as we keep a kref while the tty is locked (so the
1594− * unlock never unlocks a freed tty).
1592+ * the slots and preserving the termios structure.
15951593 */
15961594 mutex_lock(&tty_mutex);
15971595 tty_port_set_kopened(tty->port, 0);
@@ -1621,9 +1619,7 @@ void tty_release_struct(struct tty_struct *tty, int idx) · 23 unmodified lines
16211619 tty_debug_hangup(tty, "freeing structure\n");
16221620 /*
16231621 * The release_tty function takes care of the details of clearing
1624− * the slots and preserving the termios structure. The tty_unlock_pair
1625− * should be safe as we keep a kref while the tty is locked (so the
1626− * unlock never unlocks a freed tty).
1622+ * the slots and preserving the termios structure.
16271623 */
16281624 mutex_lock(&tty_mutex);
16291625 release_tty(tty, idx);
@@ -2734,9 +2730,11 @@ static int compat_tty_tiocgserial(struct tty_struct *tty, · 1104 unmodified lines
27342730 struct serial_struct32 v32;
27352731 struct serial_struct v;
27362732 int err;
2737− memset(&v, 0, sizeof(struct serial_struct));
27382733
2739− if (!tty->ops->set_serial)
2734+ memset(&v, 0, sizeof(v));
2735+ memset(&v32, 0, sizeof(v32));
2736+
2737+ if (!tty->ops->get_serial)
27402738 return -ENOTTY;
27412739 err = tty->ops->get_serial(tty, &v);
27422740 if (!err) {
drivers/usb/chipidea/udc.c+4−3
@@ -1530,18 +1530,19 @@ static const struct usb_ep_ops usb_ep_ops = { · 1529 unmodified lines
15301530 static void ci_hdrc_gadget_connect(struct usb_gadget *_gadget, int is_active)
15311531 {
15321532 struct ci_hdrc *ci = container_of(_gadget, struct ci_hdrc, gadget);
1533− unsigned long flags;
15341533
15351534 if (is_active) {
15361535 pm_runtime_get_sync(&_gadget->dev);
15371536 hw_device_reset(ci);
1538− spin_lock_irqsave(&ci->lock, flags);
1537+ spin_lock_irq(&ci->lock);
15391538 if (ci->driver) {
15401539 hw_device_state(ci, ci->ep0out->qh.dma);
15411540 usb_gadget_set_state(_gadget, USB_STATE_POWERED);
1541+ spin_unlock_irq(&ci->lock);
15421542 usb_udc_vbus_handler(_gadget, true);
1543+ } else {
1544+ spin_unlock_irq(&ci->lock);
15431545 }
1544− spin_unlock_irqrestore(&ci->lock, flags);
15451546 } else {
15461547 usb_udc_vbus_handler(_gadget, false);
15471548 if (ci->driver)
drivers/usb/class/cdc-acm.c+21−13
@@ -896,10 +896,10 @@ static int get_serial_info(struct tty_struct *tty, struct serial_struct *ss) · 895 unmodified lines
896896
897897 ss->xmit_fifo_size = acm->writesize;
898898 ss->baud_base = le32_to_cpu(acm->line.dwDTERate);
899− ss->close_delay = acm->port.close_delay / 10;
899+ ss->close_delay = jiffies_to_msecs(acm->port.close_delay) / 10;
900900 ss->closing_wait = acm->port.closing_wait == ASYNC_CLOSING_WAIT_NONE ?
901901 ASYNC_CLOSING_WAIT_NONE :
902− acm->port.closing_wait / 10;
902+ jiffies_to_msecs(acm->port.closing_wait) / 10;
903903 return 0;
904904 }
905905
@@ -907,24 +907,32 @@ static int set_serial_info(struct tty_struct *tty, struct serial_struct *ss) · 1 unmodified line
907907 {
908908 struct acm *acm = tty->driver_data;
909909 unsigned int closing_wait, close_delay;
910+ unsigned int old_closing_wait, old_close_delay;
910911 int retval = 0;
911912
912− close_delay = ss->close_delay * 10;
913+ close_delay = msecs_to_jiffies(ss->close_delay * 10);
913914 closing_wait = ss->closing_wait == ASYNC_CLOSING_WAIT_NONE ?
914− ASYNC_CLOSING_WAIT_NONE : ss->closing_wait * 10;
915+ ASYNC_CLOSING_WAIT_NONE :
916+ msecs_to_jiffies(ss->closing_wait * 10);
917+
918+ /* we must redo the rounding here, so that the values match */
919+ old_close_delay = jiffies_to_msecs(acm->port.close_delay) / 10;
920+ old_closing_wait = acm->port.closing_wait == ASYNC_CLOSING_WAIT_NONE ?
921+ ASYNC_CLOSING_WAIT_NONE :
922+ jiffies_to_msecs(acm->port.closing_wait) / 10;
915923
916924 mutex_lock(&acm->port.mutex);
917925
918− if (!capable(CAP_SYS_ADMIN)) {
919− if ((close_delay != acm->port.close_delay) ||
920− (closing_wait != acm->port.closing_wait))
926+ if ((ss->close_delay != old_close_delay) ||
927+ (ss->closing_wait != old_closing_wait)) {
928+ if (!capable(CAP_SYS_ADMIN))
921929 retval = -EPERM;
922− else
923− retval = -EOPNOTSUPP;
924− } else {
925− acm->port.close_delay = close_delay;
926− acm->port.closing_wait = closing_wait;
927− }
930+ else {
931+ acm->port.close_delay = close_delay;
932+ acm->port.closing_wait = closing_wait;
933+ }
934+ } else
935+ retval = -EOPNOTSUPP;
928936
929937 mutex_unlock(&acm->port.mutex);
930938 return retval;
drivers/usb/core/quirks.c+6−0
@@ -378,6 +378,12 @@ static const struct usb_device_id usb_quirk_list[] = { · 377 unmodified lines
378378 { USB_DEVICE(0x0b05, 0x17e0), .driver_info =
379379 USB_QUIRK_IGNORE_REMOTE_WAKEUP },
380380
381+ /* Realtek hub in Dell WD19 (Type-C) */
382+ { USB_DEVICE(0x0bda, 0x0487), .driver_info = USB_QUIRK_NO_LPM },
383+
384+ /* Generic RTL8153 based ethernet adapters */
385+ { USB_DEVICE(0x0bda, 0x8153), .driver_info = USB_QUIRK_NO_LPM },
386+
381387 /* Action Semiconductor flash disk */
382388 { USB_DEVICE(0x10d6, 0x2200), .driver_info =
383389 USB_QUIRK_STRING_FETCH_255 },
drivers/usb/host/xhci-pci.c+2−1
@@ -136,7 +136,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) · 135 unmodified lines
136136 xhci->quirks |= XHCI_AMD_PLL_FIX;
137137
138138 if (pdev->vendor == PCI_VENDOR_ID_AMD &&
139− (pdev->device == 0x15e0 ||
139+ (pdev->device == 0x145c ||
140+ pdev->device == 0x15e0 ||
140141 pdev->device == 0x15e1 ||
141142 pdev->device == 0x43bb))
142143 xhci->quirks |= XHCI_SUSPEND_DELAY;
drivers/usb/host/xhci-plat.c+1−0
@@ -445,6 +445,7 @@ MODULE_DEVICE_TABLE(acpi, usb_xhci_acpi_match); · 444 unmodified lines
445445 static struct platform_driver usb_xhci_driver = {
446446 .probe = xhci_plat_probe,
447447 .remove = xhci_plat_remove,
448+ .shutdown = usb_hcd_platform_shutdown,
448449 .driver = {
449450 .name = "xhci-hcd",
450451 .pm = &xhci_plat_pm_ops,
drivers/usb/host/xhci-trace.h+6−17
@@ -289,23 +289,12 @@ DECLARE_EVENT_CLASS(xhci_log_urb, · 288 unmodified lines
289289 ),
290290 TP_printk("ep%d%s-%s: urb %p pipe %u slot %d length %d/%d sgs %d/%d stream %d flags %08x",
291291 __entry->epnum, __entry->dir_in ? "in" : "out",
292− ({ char *s;
293− switch (__entry->type) {
294− case USB_ENDPOINT_XFER_INT:
295− s = "intr";
296− break;
297− case USB_ENDPOINT_XFER_CONTROL:
298− s = "control";
299− break;
300− case USB_ENDPOINT_XFER_BULK:
301− s = "bulk";
302− break;
303− case USB_ENDPOINT_XFER_ISOC:
304− s = "isoc";
305− break;
306− default:
307− s = "UNKNOWN";
308− } s; }), __entry->urb, __entry->pipe, __entry->slot_id,
292+ __print_symbolic(__entry->type,
293+ { USB_ENDPOINT_XFER_INT, "intr" },
294+ { USB_ENDPOINT_XFER_CONTROL, "control" },
295+ { USB_ENDPOINT_XFER_BULK, "bulk" },
296+ { USB_ENDPOINT_XFER_ISOC, "isoc" }),
297+ __entry->urb, __entry->pipe, __entry->slot_id,
309298 __entry->actual, __entry->length, __entry->num_mapped_sgs,
310299 __entry->num_sgs, __entry->stream, __entry->flags
311300 )
drivers/usb/serial/option.c+2−0
@@ -1183,6 +1183,8 @@ static const struct usb_device_id option_ids[] = { · 1182 unmodified lines
11831183 .driver_info = NCTRL(0) },
11841184 { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x110a, 0xff), /* Telit ME910G1 */
11851185 .driver_info = NCTRL(0) | RSVD(3) },
1186+ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x110b, 0xff), /* Telit ME910G1 (ECM) */
1187+ .driver_info = NCTRL(0) },
11861188 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910),
11871189 .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
11881190 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4),
drivers/usb/serial/pl2303.c+1−0
@@ -99,6 +99,7 @@ static const struct usb_device_id id_table[] = { · 98 unmodified lines
9999 { USB_DEVICE(SUPERIAL_VENDOR_ID, SUPERIAL_PRODUCT_ID) },
100100 { USB_DEVICE(HP_VENDOR_ID, HP_LD220_PRODUCT_ID) },
101101 { USB_DEVICE(HP_VENDOR_ID, HP_LD220TA_PRODUCT_ID) },
102+ { USB_DEVICE(HP_VENDOR_ID, HP_LD381_PRODUCT_ID) },
102103 { USB_DEVICE(HP_VENDOR_ID, HP_LD960_PRODUCT_ID) },
103104 { USB_DEVICE(HP_VENDOR_ID, HP_LD960TA_PRODUCT_ID) },
104105 { USB_DEVICE(HP_VENDOR_ID, HP_LCM220_PRODUCT_ID) },
drivers/usb/serial/pl2303.h+1−0
@@ -130,6 +130,7 @@ · 129 unmodified lines
130130 #define HP_LM920_PRODUCT_ID 0x026b
131131 #define HP_TD620_PRODUCT_ID 0x0956
132132 #define HP_LD960_PRODUCT_ID 0x0b39
133+#define HP_LD381_PRODUCT_ID 0x0f7f
133134 #define HP_LCM220_PRODUCT_ID 0x3139
134135 #define HP_LCM960_PRODUCT_ID 0x3239
135136 #define HP_LD220_PRODUCT_ID 0x3524
drivers/usb/typec/ucsi/displayport.c+11−1
@@ -271,6 +271,9 @@ void ucsi_displayport_remove_partner(struct typec_altmode *alt) · 270 unmodified lines
271271 return;
272272
273273 dp = typec_altmode_get_drvdata(alt);
274+ if (!dp)
275+ return;
276+
274277 dp->data.conf = 0;
275278 dp->data.status = 0;
276279 dp->initialized = false;
@@ -285,6 +288,8 @@ struct typec_altmode *ucsi_register_displayport(struct ucsi_connector *con, · 8 unmodified lines
285288 struct typec_altmode *alt;
286289 struct ucsi_dp *dp;
287290
291+ mutex_lock(&con->lock);
292+
288293 /* We can't rely on the firmware with the capabilities. */
289294 desc->vdo |= DP_CAP_DP_SIGNALING | DP_CAP_RECEPTACLE;
290295
@@ -293,12 +298,15 @@ struct typec_altmode *ucsi_register_displayport(struct ucsi_connector *con, · 2 unmodified lines
293298 desc->vdo |= all_assignments << 16;
294299
295300 alt = typec_port_register_altmode(con->port, desc);
296− if (IS_ERR(alt))
301+ if (IS_ERR(alt)) {
302+ mutex_unlock(&con->lock);
297303 return alt;
304+ }
298305
299306 dp = devm_kzalloc(&alt->dev, sizeof(*dp), GFP_KERNEL);
300307 if (!dp) {
301308 typec_unregister_altmode(alt);
309+ mutex_unlock(&con->lock);
302310 return ERR_PTR(-ENOMEM);
303311 }
304312
@@ -311,5 +319,7 @@ struct typec_altmode *ucsi_register_displayport(struct ucsi_connector *con, · 6 unmodified lines
311319 alt->ops = &ucsi_displayport_ops;
312320 typec_altmode_set_drvdata(alt, dp);
313321
322+ mutex_unlock(&con->lock);
323+
314324 return alt;
315325 }
drivers/virtio/virtio_balloon.c+1−1
@@ -959,8 +959,8 @@ out_iput: · 958 unmodified lines
959959 iput(vb->vb_dev_info.inode);
960960 out_kern_unmount:
961961 kern_unmount(balloon_mnt);
962−#endif
963962 out_del_vqs:
963+#endif
964964 vdev->config->del_vqs(vdev);
965965 out_free_vb:
966966 kfree(vb);
drivers/virtio/virtio_ring.c+2−2
@@ -2203,10 +2203,10 @@ void vring_del_virtqueue(struct virtqueue *_vq) · 2202 unmodified lines
22032203 vq->split.queue_size_in_bytes,
22042204 vq->split.vring.desc,
22052205 vq->split.queue_dma_addr);
2206−
2207− kfree(vq->split.desc_state);
22082206 }
22092207 }
2208+ if (!vq->packed_ring)
2209+ kfree(vq->split.desc_state);
22102210 list_del(&_vq->list);
22112211 kfree(vq);
22122212 }
drivers/watchdog/iTCO_vendor.h+2−0
@@ -1,10 +1,12 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
22 /* iTCO Vendor Specific Support hooks */
33 #ifdef CONFIG_ITCO_VENDOR_SUPPORT
4+extern int iTCO_vendorsupport;
45 extern void iTCO_vendor_pre_start(struct resource *, unsigned int);
56 extern void iTCO_vendor_pre_stop(struct resource *);
67 extern int iTCO_vendor_check_noreboot_on(void);
78 #else
9+#define iTCO_vendorsupport 0
810 #define iTCO_vendor_pre_start(acpibase, heartbeat) {}
911 #define iTCO_vendor_pre_stop(acpibase) {}
1012 #define iTCO_vendor_check_noreboot_on() 1
drivers/watchdog/iTCO_vendor_support.c+9−7
@@ -39,8 +39,10 @@ · 38 unmodified lines
3939 /* Broken BIOS */
4040 #define BROKEN_BIOS 911
4141
42−static int vendorsupport;
43−module_param(vendorsupport, int, 0);
42+int iTCO_vendorsupport;
43+EXPORT_SYMBOL(iTCO_vendorsupport);
44+
45+module_param_named(vendorsupport, iTCO_vendorsupport, int, 0);
4446 MODULE_PARM_DESC(vendorsupport, "iTCO vendor specific support mode, default="
4547 "0 (none), 1=SuperMicro Pent3, 911=Broken SMI BIOS");
4648
@@ -152,7 +154,7 @@ static void broken_bios_stop(struct resource *smires) · 105 unmodified lines
152154 void iTCO_vendor_pre_start(struct resource *smires,
153155 unsigned int heartbeat)
154156 {
155− switch (vendorsupport) {
157+ switch (iTCO_vendorsupport) {
156158 case SUPERMICRO_OLD_BOARD:
157159 supermicro_old_pre_start(smires);
158160 break;
@@ -165,7 +167,7 @@ EXPORT_SYMBOL(iTCO_vendor_pre_start); · 6 unmodified lines
165167
166168 void iTCO_vendor_pre_stop(struct resource *smires)
167169 {
168− switch (vendorsupport) {
170+ switch (iTCO_vendorsupport) {
169171 case SUPERMICRO_OLD_BOARD:
170172 supermicro_old_pre_stop(smires);
171173 break;
@@ -178,7 +180,7 @@ EXPORT_SYMBOL(iTCO_vendor_pre_stop); · 6 unmodified lines
178180
179181 int iTCO_vendor_check_noreboot_on(void)
180182 {
181− switch (vendorsupport) {
183+ switch (iTCO_vendorsupport) {
182184 case SUPERMICRO_OLD_BOARD:
183185 return 0;
184186 default:
@@ -189,13 +191,13 @@ EXPORT_SYMBOL(iTCO_vendor_check_noreboot_on); · 4 unmodified lines
189191
190192 static int __init iTCO_vendor_init_module(void)
191193 {
192− if (vendorsupport == SUPERMICRO_NEW_BOARD) {
194+ if (iTCO_vendorsupport == SUPERMICRO_NEW_BOARD) {
193195 pr_warn("Option vendorsupport=%d is no longer supported, "
194196 "please use the w83627hf_wdt driver instead\n",
195197 SUPERMICRO_NEW_BOARD);
196198 return -EINVAL;
197199 }
198− pr_info("vendor-support=%d\n", vendorsupport);
200+ pr_info("vendor-support=%d\n", iTCO_vendorsupport);
199201 return 0;
200202 }
201203
drivers/watchdog/iTCO_wdt.c+16−12
@@ -459,13 +459,25 @@ static int iTCO_wdt_probe(struct platform_device *pdev) · 458 unmodified lines
459459 if (!p->tco_res)
460460 return -ENODEV;
461461
462− p->smi_res = platform_get_resource(pdev, IORESOURCE_IO, ICH_RES_IO_SMI);
463− if (!p->smi_res)
464− return -ENODEV;
465−
466462 p->iTCO_version = pdata->version;
467463 p->pci_dev = to_pci_dev(dev->parent);
468464
465+ p->smi_res = platform_get_resource(pdev, IORESOURCE_IO, ICH_RES_IO_SMI);
466+ if (p->smi_res) {
467+ /* The TCO logic uses the TCO_EN bit in the SMI_EN register */
468+ if (!devm_request_region(dev, p->smi_res->start,
469+ resource_size(p->smi_res),
470+ pdev->name)) {
471+ pr_err("I/O address 0x%04llx already in use, device disabled\n",
472+ (u64)SMI_EN(p));
473+ return -EBUSY;
474+ }
475+ } else if (iTCO_vendorsupport ||
476+ turn_SMI_watchdog_clear_off >= p->iTCO_version) {
477+ pr_err("SMI I/O resource is missing\n");
478+ return -ENODEV;
479+ }
480+
469481 iTCO_wdt_no_reboot_bit_setup(p, pdata);
470482
471483 /*
@@ -492,14 +504,6 @@ static int iTCO_wdt_probe(struct platform_device *pdev) · 20 unmodified lines
492504 /* Set the NO_REBOOT bit to prevent later reboots, just for sure */
493505 p->update_no_reboot_bit(p->no_reboot_priv, true);
494506
495− /* The TCO logic uses the TCO_EN bit in the SMI_EN register */
496− if (!devm_request_region(dev, p->smi_res->start,
497− resource_size(p->smi_res),
498− pdev->name)) {
499− pr_err("I/O address 0x%04llx already in use, device disabled\n",
500− (u64)SMI_EN(p));
501− return -EBUSY;
502− }
503507 if (turn_SMI_watchdog_clear_off >= p->iTCO_version) {
504508 /*
505509 * Bit 13: TCO_EN -> 0
fs/afs/addr_list.c+1−1
@@ -19,7 +19,7 @@ · 18 unmodified lines
1919 void afs_put_addrlist(struct afs_addr_list *alist)
2020 {
2121 if (alist && refcount_dec_and_test(&alist->usage))
22− call_rcu(&alist->rcu, (rcu_callback_t)kfree);
22+ kfree_rcu(alist, rcu);
2323 }
2424
2525 /*
fs/afs/internal.h+1−1
@@ -81,7 +81,7 @@ enum afs_call_state { · 80 unmodified lines
8181 * List of server addresses.
8282 */
8383 struct afs_addr_list {
84− struct rcu_head rcu; /* Must be first */
84+ struct rcu_head rcu;
8585 refcount_t usage;
8686 u32 version; /* Version */
8787 unsigned char max_addrs;
fs/btrfs/block-group.c+2−2
@@ -856,9 +856,9 @@ static void clear_incompat_bg_bits(struct btrfs_fs_info *fs_info, u64 flags) · 855 unmodified lines
856856 found_raid1c34 = true;
857857 up_read(&sinfo->groups_sem);
858858 }
859− if (found_raid56)
859+ if (!found_raid56)
860860 btrfs_clear_fs_incompat(fs_info, RAID56);
861− if (found_raid1c34)
861+ if (!found_raid1c34)
862862 btrfs_clear_fs_incompat(fs_info, RAID1C34);
863863 }
864864 }
fs/btrfs/inode.c+4−0
@@ -9496,6 +9496,10 @@ out_fail: · 9495 unmodified lines
94969496 ret = btrfs_sync_log(trans, BTRFS_I(old_inode)->root, &ctx);
94979497 if (ret)
94989498 commit_transaction = true;
9499+ } else if (sync_log) {
9500+ mutex_lock(&root->log_mutex);
9501+ list_del(&ctx.list);
9502+ mutex_unlock(&root->log_mutex);
94999503 }
95009504 if (commit_transaction) {
95019505 ret = btrfs_commit_transaction(trans);
fs/cifs/dir.c+0−1
@@ -555,7 +555,6 @@ cifs_atomic_open(struct inode *inode, struct dentry *direntry, · 554 unmodified lines
555555 if (server->ops->close)
556556 server->ops->close(xid, tcon, &fid);
557557 cifs_del_pending_open(&open);
558− fput(file);
559558 rc = -ENOMEM;
560559 }
561560
fs/cifs/file.c+2−1
@@ -1169,7 +1169,8 @@ try_again: · 1168 unmodified lines
11691169 rc = posix_lock_file(file, flock, NULL);
11701170 up_write(&cinode->lock_sem);
11711171 if (rc == FILE_LOCK_DEFERRED) {
1172− rc = wait_event_interruptible(flock->fl_wait, !flock->fl_blocker);
1172+ rc = wait_event_interruptible(flock->fl_wait,
1173+ list_empty(&flock->fl_blocked_member));
11731174 if (!rc)
11741175 goto try_again;
11751176 locks_delete_block(flock);
fs/cifs/inode.c+1−1
@@ -2191,7 +2191,7 @@ int cifs_getattr(const struct path *path, struct kstat *stat, · 2190 unmodified lines
21912191 if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID))
21922192 stat->gid = current_fsgid();
21932193 }
2194− return rc;
2194+ return 0;
21952195 }
21962196
21972197 int cifs_fiemap(struct inode *inode, struct fiemap_extent_info *fei, u64 start,
fs/cifs/smb2ops.c+3−1
@@ -2222,6 +2222,8 @@ smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon, · 2221 unmodified lines
22222222 goto qdf_free;
22232223 }
22242224
2225+ atomic_inc(&tcon->num_remote_opens);
2226+
22252227 qd_rsp = (struct smb2_query_directory_rsp *)rsp_iov[1].iov_base;
22262228 if (qd_rsp->sync_hdr.Status == STATUS_NO_MORE_FILES) {
22272229 trace_smb3_query_dir_done(xid, fid->persistent_fid,
@@ -3417,7 +3419,7 @@ static int smb3_fiemap(struct cifs_tcon *tcon, · 1189 unmodified lines
34173419 if (rc)
34183420 goto out;
34193421
3420− if (out_data_len < sizeof(struct file_allocated_range_buffer)) {
3422+ if (out_data_len && out_data_len < sizeof(struct file_allocated_range_buffer)) {
34213423 rc = -EINVAL;
34223424 goto out;
34233425 }
fs/crypto/keysetup.c+9−0
@@ -538,6 +538,15 @@ int fscrypt_drop_inode(struct inode *inode) · 537 unmodified lines
538538 return 0;
539539 mk = ci->ci_master_key->payload.data[0];
540540
541+ /*
542+ * With proper, non-racy use of FS_IOC_REMOVE_ENCRYPTION_KEY, all inodes
543+ * protected by the key were cleaned by sync_filesystem(). But if
544+ * userspace is still using the files, inodes can be dirtied between
545+ * then and now. We mustn't lose any writes, so skip dirty inodes here.
546+ */
547+ if (inode->i_state & I_DIRTY_ALL)
548+ return 0;
549+
541550 /*
542551 * Note: since we aren't holding ->mk_secret_sem, the result here can
543552 * immediately become outdated. But there's no correctness problem with
fs/eventpoll.c+4−4
@@ -1854,9 +1854,9 @@ fetch_events: · 1853 unmodified lines
18541854 waiter = true;
18551855 init_waitqueue_entry(&wait, current);
18561856
1857− spin_lock_irq(&ep->wq.lock);
1857+ write_lock_irq(&ep->lock);
18581858 __add_wait_queue_exclusive(&ep->wq, &wait);
1859− spin_unlock_irq(&ep->wq.lock);
1859+ write_unlock_irq(&ep->lock);
18601860 }
18611861
18621862 for (;;) {
@@ -1904,9 +1904,9 @@ send_events: · 41 unmodified lines
19041904 goto fetch_events;
19051905
19061906 if (waiter) {
1907− spin_lock_irq(&ep->wq.lock);
1907+ write_lock_irq(&ep->lock);
19081908 __remove_wait_queue(&ep->wq, &wait);
1909− spin_unlock_irq(&ep->wq.lock);
1909+ write_unlock_irq(&ep->lock);
19101910 }
19111911
19121912 return res;
fs/file.c+6−1
@@ -540,9 +540,14 @@ static int alloc_fd(unsigned start, unsigned flags) · 539 unmodified lines
540540 return __alloc_fd(current->files, start, rlimit(RLIMIT_NOFILE), flags);
541541 }
542542
543+int __get_unused_fd_flags(unsigned flags, unsigned long nofile)
544+{
545+ return __alloc_fd(current->files, 0, nofile, flags);
546+}
547+
543548 int get_unused_fd_flags(unsigned flags)
544549 {
545− return __alloc_fd(current->files, 0, rlimit(RLIMIT_NOFILE), flags);
550+ return __get_unused_fd_flags(flags, rlimit(RLIMIT_NOFILE));
546551 }
547552 EXPORT_SYMBOL(get_unused_fd_flags);
548553
fs/fuse/dev.c+3−3
@@ -276,12 +276,10 @@ static void flush_bg_queue(struct fuse_conn *fc) · 275 unmodified lines
276276 void fuse_request_end(struct fuse_conn *fc, struct fuse_req *req)
277277 {
278278 struct fuse_iqueue *fiq = &fc->iq;
279− bool async;
280279
281280 if (test_and_set_bit(FR_FINISHED, &req->flags))
282281 goto put_request;
283282
284− async = req->args->end;
285283 /*
286284 * test_and_set_bit() implies smp_mb() between bit
287285 * changing and below intr_entry check. Pairs with
@@ -324,7 +322,7 @@ void fuse_request_end(struct fuse_conn *fc, struct fuse_req *req) · 36 unmodified lines
324322 wake_up(&req->waitq);
325323 }
326324
327− if (async)
325+ if (test_bit(FR_ASYNC, &req->flags))
328326 req->args->end(fc, req->args, req->out.h.error);
329327 put_request:
330328 fuse_put_request(fc, req);
@@ -471,6 +469,8 @@ static void fuse_args_to_req(struct fuse_req *req, struct fuse_args *args) · 140 unmodified lines
471469 req->in.h.opcode = args->opcode;
472470 req->in.h.nodeid = args->nodeid;
473471 req->args = args;
472+ if (args->end)
473+ __set_bit(FR_ASYNC, &req->flags);
474474 }
475475
476476 ssize_t fuse_simple_request(struct fuse_conn *fc, struct fuse_args *args)
fs/fuse/fuse_i.h+2−0
@@ -301,6 +301,7 @@ struct fuse_io_priv { · 300 unmodified lines
301301 * FR_SENT: request is in userspace, waiting for an answer
302302 * FR_FINISHED: request is finished
303303 * FR_PRIVATE: request is on private list
304+ * FR_ASYNC: request is asynchronous
304305 */
305306 enum fuse_req_flag {
306307 FR_ISREPLY,
@@ -314,6 +315,7 @@ enum fuse_req_flag { · 7 unmodified lines
314315 FR_SENT,
315316 FR_FINISHED,
316317 FR_PRIVATE,
318+ FR_ASYNC,
317319 };
318320
319321 /**
fs/gfs2/inode.c+1−1
@@ -1248,7 +1248,7 @@ static int gfs2_atomic_open(struct inode *dir, struct dentry *dentry, · 1247 unmodified lines
12481248 if (!(file->f_mode & FMODE_OPENED))
12491249 return finish_no_open(file, d);
12501250 dput(d);
1251− return 0;
1251+ return excl && (flags & O_CREAT) ? -EEXIST : 0;
12521252 }
12531253
12541254 BUG_ON(d != NULL);
fs/inode.c+1−0
@@ -138,6 +138,7 @@ int inode_init_always(struct super_block *sb, struct inode *inode) · 137 unmodified lines
138138 inode->i_sb = sb;
139139 inode->i_blkbits = sb->s_blocksize_bits;
140140 inode->i_flags = 0;
141+ atomic64_set(&inode->i_sequence, 0);
141142 atomic_set(&inode->i_count, 1);
142143 inode->i_op = &empty_iops;
143144 inode->i_fop = &no_open_fops;
fs/io_uring.c+29−18
@@ -191,7 +191,6 @@ struct fixed_file_data { · 190 unmodified lines
191191 struct llist_head put_llist;
192192 struct work_struct ref_work;
193193 struct completion done;
194− struct rcu_head rcu;
195194 };
196195
197196 struct io_ring_ctx {
@@ -344,6 +343,7 @@ struct io_accept { · 146 unmodified lines
344343 struct sockaddr __user *addr;
345344 int __user *addr_len;
346345 int flags;
346+ unsigned long nofile;
347347 };
348348
349349 struct io_sync {
@@ -398,6 +398,7 @@ struct io_open { · 48 unmodified lines
398398 struct filename *filename;
399399 struct statx __user *buffer;
400400 struct open_how how;
401+ unsigned long nofile;
401402 };
402403
403404 struct io_files_update {
@@ -2578,6 +2579,7 @@ static int io_openat_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) · 2174 unmodified lines
25782579 return ret;
25792580 }
25802581
2582+ req->open.nofile = rlimit(RLIMIT_NOFILE);
25812583 req->flags |= REQ_F_NEED_CLEANUP;
25822584 return 0;
25832585 }
@@ -2619,6 +2621,7 @@ static int io_openat2_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) · 35 unmodified lines
26192621 return ret;
26202622 }
26212623
2624+ req->open.nofile = rlimit(RLIMIT_NOFILE);
26222625 req->flags |= REQ_F_NEED_CLEANUP;
26232626 return 0;
26242627 }
@@ -2637,7 +2640,7 @@ static int io_openat2(struct io_kiocb *req, struct io_kiocb **nxt, · 12 unmodified lines
26372640 if (ret)
26382641 goto err;
26392642
2640− ret = get_unused_fd_flags(req->open.how.flags);
2643+ ret = __get_unused_fd_flags(req->open.how.flags, req->open.nofile);
26412644 if (ret < 0)
26422645 goto err;
26432646
@@ -3322,6 +3325,7 @@ static int io_accept_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) · 678 unmodified lines
33223325 accept->addr = u64_to_user_ptr(READ_ONCE(sqe->addr));
33233326 accept->addr_len = u64_to_user_ptr(READ_ONCE(sqe->addr2));
33243327 accept->flags = READ_ONCE(sqe->accept_flags);
3328+ accept->nofile = rlimit(RLIMIT_NOFILE);
33253329 return 0;
33263330 #else
33273331 return -EOPNOTSUPP;
@@ -3338,7 +3342,8 @@ static int __io_accept(struct io_kiocb *req, struct io_kiocb **nxt, · 10 unmodified lines
33383342
33393343 file_flags = force_nonblock ? O_NONBLOCK : 0;
33403344 ret = __sys_accept4_file(req->file, file_flags, accept->addr,
3341− accept->addr_len, accept->flags);
3345+ accept->addr_len, accept->flags,
3346+ accept->nofile);
33423347 if (ret == -EAGAIN && force_nonblock)
33433348 return -EAGAIN;
33443349 if (ret == -ERESTARTSYS)
@@ -4132,6 +4137,9 @@ static int io_req_defer_prep(struct io_kiocb *req, · 787 unmodified lines
41324137 {
41334138 ssize_t ret = 0;
41344139
4140+ if (!sqe)
4141+ return 0;
4142+
41354143 if (io_op_defs[req->opcode].file_table) {
41364144 ret = io_grab_files(req);
41374145 if (unlikely(ret))
@@ -4908,6 +4916,11 @@ err_req: · 770 unmodified lines
49084916 if (sqe_flags & (IOSQE_IO_LINK|IOSQE_IO_HARDLINK)) {
49094917 req->flags |= REQ_F_LINK;
49104918 INIT_LIST_HEAD(&req->link_list);
4919+
4920+ if (io_alloc_async_ctx(req)) {
4921+ ret = -EAGAIN;
4922+ goto err_req;
4923+ }
49114924 ret = io_req_defer_prep(req, sqe);
49124925 if (ret)
49134926 req->flags |= REQ_F_FAIL_LINK;
@@ -5331,24 +5344,21 @@ static void io_file_ref_kill(struct percpu_ref *ref) · 417 unmodified lines
53315344 complete(&data->done);
53325345 }
53335346
5334−static void __io_file_ref_exit_and_free(struct rcu_head *rcu)
5347+static void io_file_ref_exit_and_free(struct work_struct *work)
53355348 {
5336− struct fixed_file_data *data = container_of(rcu, struct fixed_file_data,
5337− rcu);
5338− percpu_ref_exit(&data->refs);
5339− kfree(data);
5340−}
5349+ struct fixed_file_data *data;
5350+
5351+ data = container_of(work, struct fixed_file_data, ref_work);
53415352
5342−static void io_file_ref_exit_and_free(struct rcu_head *rcu)
5343−{
53445353 /*
5345− * We need to order our exit+free call against the potentially
5346− * existing call_rcu() for switching to atomic. One way to do that
5347− * is to have this rcu callback queue the final put and free, as we
5348− * could otherwise have a pre-existing atomic switch complete _after_
5349− * the free callback we queued.
5354+ * Ensure any percpu-ref atomic switch callback has run, it could have
5355+ * been in progress when the files were being unregistered. Once
5356+ * that's done, we can safely exit and free the ref and containing
5357+ * data structure.
53505358 */
5351− call_rcu(rcu, __io_file_ref_exit_and_free);
5359+ rcu_barrier();
5360+ percpu_ref_exit(&data->refs);
5361+ kfree(data);
53525362 }
53535363
53545364 static int io_sqe_files_unregister(struct io_ring_ctx *ctx)
@@ -5369,7 +5379,8 @@ static int io_sqe_files_unregister(struct io_ring_ctx *ctx) · 14 unmodified lines
53695379 for (i = 0; i < nr_tables; i++)
53705380 kfree(data->table[i].files);
53715381 kfree(data->table);
5372− call_rcu(&data->rcu, io_file_ref_exit_and_free);
5382+ INIT_WORK(&data->ref_work, io_file_ref_exit_and_free);
5383+ queue_work(system_wq, &data->ref_work);
53735384 ctx->file_data = NULL;
53745385 ctx->nr_user_files = 0;
53755386 return 0;
fs/locks.c+48−6
@@ -725,7 +725,6 @@ static void __locks_delete_block(struct file_lock *waiter) · 724 unmodified lines
725725 {
726726 locks_delete_global_blocked(waiter);
727727 list_del_init(&waiter->fl_blocked_member);
728− waiter->fl_blocker = NULL;
729728 }
730729
731730 static void __locks_wake_up_blocks(struct file_lock *blocker)
@@ -740,6 +739,13 @@ static void __locks_wake_up_blocks(struct file_lock *blocker) · 8 unmodified lines
740739 waiter->fl_lmops->lm_notify(waiter);
741740 else
742741 wake_up(&waiter->fl_wait);
742+
743+ /*
744+ * The setting of fl_blocker to NULL marks the "done"
745+ * point in deleting a block. Paired with acquire at the top
746+ * of locks_delete_block().
747+ */
748+ smp_store_release(&waiter->fl_blocker, NULL);
743749 }
744750 }
745751
@@ -753,11 +759,42 @@ int locks_delete_block(struct file_lock *waiter) · 7 unmodified lines
753759 {
754760 int status = -ENOENT;
755761
762+ /*
763+ * If fl_blocker is NULL, it won't be set again as this thread "owns"
764+ * the lock and is the only one that might try to claim the lock.
765+ *
766+ * We use acquire/release to manage fl_blocker so that we can
767+ * optimize away taking the blocked_lock_lock in many cases.
768+ *
769+ * The smp_load_acquire guarantees two things:
770+ *
771+ * 1/ that fl_blocked_requests can be tested locklessly. If something
772+ * was recently added to that list it must have been in a locked region
773+ * *before* the locked region when fl_blocker was set to NULL.
774+ *
775+ * 2/ that no other thread is accessing 'waiter', so it is safe to free
776+ * it. __locks_wake_up_blocks is careful not to touch waiter after
777+ * fl_blocker is released.
778+ *
779+ * If a lockless check of fl_blocker shows it to be NULL, we know that
780+ * no new locks can be inserted into its fl_blocked_requests list, and
781+ * can avoid doing anything further if the list is empty.
782+ */
783+ if (!smp_load_acquire(&waiter->fl_blocker) &&
784+ list_empty(&waiter->fl_blocked_requests))
785+ return status;
786+
756787 spin_lock(&blocked_lock_lock);
757788 if (waiter->fl_blocker)
758789 status = 0;
759790 __locks_wake_up_blocks(waiter);
760791 __locks_delete_block(waiter);
792+
793+ /*
794+ * The setting of fl_blocker to NULL marks the "done" point in deleting
795+ * a block. Paired with acquire at the top of this function.
796+ */
797+ smp_store_release(&waiter->fl_blocker, NULL);
761798 spin_unlock(&blocked_lock_lock);
762799 return status;
763800 }
@@ -1350,7 +1387,8 @@ static int posix_lock_inode_wait(struct inode *inode, struct file_lock *fl) · 586 unmodified lines
13501387 error = posix_lock_inode(inode, fl, NULL);
13511388 if (error != FILE_LOCK_DEFERRED)
13521389 break;
1353− error = wait_event_interruptible(fl->fl_wait, !fl->fl_blocker);
1390+ error = wait_event_interruptible(fl->fl_wait,
1391+ list_empty(&fl->fl_blocked_member));
13541392 if (error)
13551393 break;
13561394 }
@@ -1435,7 +1473,8 @@ int locks_mandatory_area(struct inode *inode, struct file *filp, loff_t start, · 78 unmodified lines
14351473 error = posix_lock_inode(inode, &fl, NULL);
14361474 if (error != FILE_LOCK_DEFERRED)
14371475 break;
1438− error = wait_event_interruptible(fl.fl_wait, !fl.fl_blocker);
1476+ error = wait_event_interruptible(fl.fl_wait,
1477+ list_empty(&fl.fl_blocked_member));
14391478 if (!error) {
14401479 /*
14411480 * If we've been sleeping someone might have
@@ -1638,7 +1677,8 @@ restart: · 196 unmodified lines
16381677
16391678 locks_dispose_list(&dispose);
16401679 error = wait_event_interruptible_timeout(new_fl->fl_wait,
1641− !new_fl->fl_blocker, break_time);
1680+ list_empty(&new_fl->fl_blocked_member),
1681+ break_time);
16421682
16431683 percpu_down_read(&file_rwsem);
16441684 spin_lock(&ctx->flc_lock);
@@ -2122,7 +2162,8 @@ static int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl) · 477 unmodified lines
21222162 error = flock_lock_inode(inode, fl);
21232163 if (error != FILE_LOCK_DEFERRED)
21242164 break;
2125− error = wait_event_interruptible(fl->fl_wait, !fl->fl_blocker);
2165+ error = wait_event_interruptible(fl->fl_wait,
2166+ list_empty(&fl->fl_blocked_member));
21262167 if (error)
21272168 break;
21282169 }
@@ -2399,7 +2440,8 @@ static int do_lock_file_wait(struct file *filp, unsigned int cmd, · 270 unmodified lines
23992440 error = vfs_lock_file(filp, cmd, fl, NULL);
24002441 if (error != FILE_LOCK_DEFERRED)
24012442 break;
2402− error = wait_event_interruptible(fl->fl_wait, !fl->fl_blocker);
2443+ error = wait_event_interruptible(fl->fl_wait,
2444+ list_empty(&fl->fl_blocked_member));
24032445 if (error)
24042446 break;
24052447 }
fs/nfs/client.c+1−0
@@ -153,6 +153,7 @@ struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_init) · 152 unmodified lines
153153 if ((clp = kzalloc(sizeof(*clp), GFP_KERNEL)) == NULL)
154154 goto error_0;
155155
156+ clp->cl_minorversion = cl_init->minorversion;
156157 clp->cl_nfs_mod = cl_init->nfs_mod;
157158 if (!try_module_get(clp->cl_nfs_mod->owner))
158159 goto error_dealloc;
fs/nfs/fs_context.c+9−0
@@ -832,6 +832,8 @@ static int nfs_parse_source(struct fs_context *fc, · 831 unmodified lines
832832 if (len > maxnamlen)
833833 goto out_hostname;
834834
835+ kfree(ctx->nfs_server.hostname);
836+
835837 /* N.B. caller will free nfs_server.hostname in all cases */
836838 ctx->nfs_server.hostname = kmemdup_nul(dev_name, len, GFP_KERNEL);
837839 if (!ctx->nfs_server.hostname)
@@ -1240,6 +1242,13 @@ static int nfs_fs_context_validate(struct fs_context *fc) · 402 unmodified lines
12401242 }
12411243 ctx->nfs_mod = nfs_mod;
12421244 }
1245+
1246+ /* Ensure the filesystem context has the correct fs_type */
1247+ if (fc->fs_type != ctx->nfs_mod->nfs_fs) {
1248+ module_put(fc->fs_type->owner);
1249+ __module_get(ctx->nfs_mod->nfs_fs->owner);
1250+ fc->fs_type = ctx->nfs_mod->nfs_fs;
1251+ }
12431252 return 0;
12441253
12451254 out_no_device_name:
fs/nfs/fscache.c+2−0
@@ -31,6 +31,7 @@ static DEFINE_SPINLOCK(nfs_fscache_keys_lock); · 30 unmodified lines
3131 struct nfs_server_key {
3232 struct {
3333 uint16_t nfsversion; /* NFS protocol version */
34+ uint32_t minorversion; /* NFSv4 minor version */
3435 uint16_t family; /* address family */
3536 __be16 port; /* IP port */
3637 } hdr;
@@ -55,6 +56,7 @@ void nfs_fscache_get_client_cookie(struct nfs_client *clp) · 18 unmodified lines
5556
5657 memset(&key, 0, sizeof(key));
5758 key.hdr.nfsversion = clp->rpc_ops->version;
59+ key.hdr.minorversion = clp->cl_minorversion;
5860 key.hdr.family = clp->cl_addr.ss_family;
5961
6062 switch (clp->cl_addr.ss_family) {
fs/nfs/namespace.c+1−1
@@ -153,7 +153,7 @@ struct vfsmount *nfs_d_automount(struct path *path) · 152 unmodified lines
153153 /* Open a new filesystem context, transferring parameters from the
154154 * parent superblock, including the network namespace.
155155 */
156− fc = fs_context_for_submount(&nfs_fs_type, path->dentry);
156+ fc = fs_context_for_submount(path->mnt->mnt_sb->s_type, path->dentry);
157157 if (IS_ERR(fc))
158158 return ERR_CAST(fc);
159159
fs/nfs/nfs4client.c+0−1
@@ -216,7 +216,6 @@ struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *cl_init) · 215 unmodified lines
216216 INIT_LIST_HEAD(&clp->cl_ds_clients);
217217 rpc_init_wait_queue(&clp->cl_rpcwaitq, "NFS client");
218218 clp->cl_state = 1 << NFS4CLNT_LEASE_EXPIRED;
219− clp->cl_minorversion = cl_init->minorversion;
220219 clp->cl_mvops = nfs_v4_minor_ops[cl_init->minorversion];
221220 clp->cl_mig_gen = 1;
222221 #if IS_ENABLED(CONFIG_NFS_V4_1)
fs/open.c+0−3
@@ -860,9 +860,6 @@ cleanup_file: · 859 unmodified lines
860860 * the return value of d_splice_alias(), then the caller needs to perform dput()
861861 * on it after finish_open().
862862 *
863− * On successful return @file is a fully instantiated open file. After this, if
864− * an error occurs in ->atomic_open(), it needs to clean up with fput().
865− *
866863 * Returns zero on success or -errno if the open failed.
867864 */
868865 int finish_open(struct file *file, struct dentry *dentry,
fs/overlayfs/Kconfig+1−0
@@ -93,6 +93,7 @@ config OVERLAY_FS_XINO_AUTO · 92 unmodified lines
9393 bool "Overlayfs: auto enable inode number mapping"
9494 default n
9595 depends on OVERLAY_FS
96+ depends on 64BIT
9697 help
9798 If this config option is enabled then overlay filesystems will use
9899 unused high bits in undelying filesystem inode numbers to map all
fs/overlayfs/file.c+6−0
@@ -244,6 +244,9 @@ static void ovl_aio_cleanup_handler(struct ovl_aio_req *aio_req) · 243 unmodified lines
244244 if (iocb->ki_flags & IOCB_WRITE) {
245245 struct inode *inode = file_inode(orig_iocb->ki_filp);
246246
247+ /* Actually acquired in ovl_write_iter() */
248+ __sb_writers_acquired(file_inode(iocb->ki_filp)->i_sb,
249+ SB_FREEZE_WRITE);
247250 file_end_write(iocb->ki_filp);
248251 ovl_copyattr(ovl_inode_real(inode), inode);
249252 }
@@ -346,6 +349,9 @@ static ssize_t ovl_write_iter(struct kiocb *iocb, struct iov_iter *iter) · 96 unmodified lines
346349 goto out;
347350
348351 file_start_write(real.file);
352+ /* Pacify lockdep, same trick as done in aio_write() */
353+ __sb_writers_release(file_inode(real.file)->i_sb,
354+ SB_FREEZE_WRITE);
349355 aio_req->fd = real;
350356 real.flags = 0;
351357 aio_req->orig_iocb = iocb;
fs/overlayfs/overlayfs.h+6−1
@@ -318,7 +318,12 @@ static inline unsigned int ovl_xino_bits(struct super_block *sb) · 317 unmodified lines
318318 return ovl_same_dev(sb) ? OVL_FS(sb)->xino_mode : 0;
319319 }
320320
321−static inline int ovl_inode_lock(struct inode *inode)
321+static inline void ovl_inode_lock(struct inode *inode)
322+{
323+ mutex_lock(&OVL_I(inode)->lock);
324+}
325+
326+static inline int ovl_inode_lock_interruptible(struct inode *inode)
322327 {
323328 return mutex_lock_interruptible(&OVL_I(inode)->lock);
324329 }
fs/overlayfs/super.c+8−1
@@ -1411,6 +1411,8 @@ static int ovl_get_layers(struct super_block *sb, struct ovl_fs *ofs, · 1410 unmodified lines
14111411 if (ofs->config.xino == OVL_XINO_ON)
14121412 pr_info("\"xino=on\" is useless with all layers on same fs, ignore.\n");
14131413 ofs->xino_mode = 0;
1414+ } else if (ofs->config.xino == OVL_XINO_OFF) {
1415+ ofs->xino_mode = -1;
14141416 } else if (ofs->config.xino == OVL_XINO_ON && ofs->xino_mode < 0) {
14151417 /*
14161418 * This is a roundup of number of bits needed for encoding
@@ -1623,8 +1625,13 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) · 206 unmodified lines
16231625 sb->s_stack_depth = 0;
16241626 sb->s_maxbytes = MAX_LFS_FILESIZE;
16251627 /* Assume underlaying fs uses 32bit inodes unless proven otherwise */
1626− if (ofs->config.xino != OVL_XINO_OFF)
1628+ if (ofs->config.xino != OVL_XINO_OFF) {
16271629 ofs->xino_mode = BITS_PER_LONG - 32;
1630+ if (!ofs->xino_mode) {
1631+ pr_warn("xino not supported on 32bit kernel, falling back to xino=off.\n");
1632+ ofs->config.xino = OVL_XINO_OFF;
1633+ }
1634+ }
16281635
16291636 /* alloc/destroy_inode needed for setting up traps in inode cache */
16301637 sb->s_op = &ovl_super_operations;
fs/overlayfs/util.c+2−2
@@ -509,7 +509,7 @@ int ovl_copy_up_start(struct dentry *dentry, int flags) · 508 unmodified lines
509509 struct inode *inode = d_inode(dentry);
510510 int err;
511511
512− err = ovl_inode_lock(inode);
512+ err = ovl_inode_lock_interruptible(inode);
513513 if (!err && ovl_already_copied_up_locked(dentry, flags)) {
514514 err = 1; /* Already copied up */
515515 ovl_inode_unlock(inode);
@@ -764,7 +764,7 @@ int ovl_nlink_start(struct dentry *dentry) · 248 unmodified lines
764764 return err;
765765 }
766766
767− err = ovl_inode_lock(inode);
767+ err = ovl_inode_lock_interruptible(inode);
768768 if (err)
769769 return err;
770770
include/crypto/curve25519.h+4−2
@@ -33,7 +33,8 @@ bool __must_check curve25519(u8 mypublic[CURVE25519_KEY_SIZE], · 32 unmodified lines
3333 const u8 secret[CURVE25519_KEY_SIZE],
3434 const u8 basepoint[CURVE25519_KEY_SIZE])
3535 {
36− if (IS_ENABLED(CONFIG_CRYPTO_ARCH_HAVE_LIB_CURVE25519))
36+ if (IS_ENABLED(CONFIG_CRYPTO_ARCH_HAVE_LIB_CURVE25519) &&
37+ (!IS_ENABLED(CONFIG_CRYPTO_CURVE25519_X86) || IS_ENABLED(CONFIG_AS_ADX)))
3738 curve25519_arch(mypublic, secret, basepoint);
3839 else
3940 curve25519_generic(mypublic, secret, basepoint);
@@ -49,7 +50,8 @@ __must_check curve25519_generate_public(u8 pub[CURVE25519_KEY_SIZE], · 9 unmodified lines
4950 CURVE25519_KEY_SIZE)))
5051 return false;
5152
52− if (IS_ENABLED(CONFIG_CRYPTO_ARCH_HAVE_LIB_CURVE25519))
53+ if (IS_ENABLED(CONFIG_CRYPTO_ARCH_HAVE_LIB_CURVE25519) &&
54+ (!IS_ENABLED(CONFIG_CRYPTO_CURVE25519_X86) || IS_ENABLED(CONFIG_AS_ADX)))
5355 curve25519_base_arch(pub, secret);
5456 else
5557 curve25519_generic(pub, secret, curve25519_base_point);
include/drm/drm_dp_mst_helper.h+2−2
@@ -81,7 +81,7 @@ struct drm_dp_vcpi { · 80 unmodified lines
8181 * &drm_dp_mst_topology_mgr.base.lock.
8282 * @num_sdp_stream_sinks: Number of stream sinks. Protected by
8383 * &drm_dp_mst_topology_mgr.base.lock.
84− * @available_pbn: Available bandwidth for this port. Protected by
84+ * @full_pbn: Max possible bandwidth for this port. Protected by
8585 * &drm_dp_mst_topology_mgr.base.lock.
8686 * @next: link to next port on this branch device
8787 * @aux: i2c aux transport to talk to device connected to this port, protected
@@ -126,7 +126,7 @@ struct drm_dp_mst_port { · 38 unmodified lines
126126 u8 dpcd_rev;
127127 u8 num_sdp_streams;
128128 u8 num_sdp_stream_sinks;
129− uint16_t available_pbn;
129+ uint16_t full_pbn;
130130 struct list_head next;
131131 /**
132132 * @mstb: the branch device connected to this port, if there is one.
include/dt-bindings/clock/imx8mn-clock.h+2−2
@@ -122,8 +122,8 @@ · 121 unmodified lines
122122 #define IMX8MN_CLK_I2C1 105
123123 #define IMX8MN_CLK_I2C2 106
124124 #define IMX8MN_CLK_I2C3 107
125−#define IMX8MN_CLK_I2C4 118
126−#define IMX8MN_CLK_UART1 119
125+#define IMX8MN_CLK_I2C4 108
126+#define IMX8MN_CLK_UART1 109
127127 #define IMX8MN_CLK_UART2 110
128128 #define IMX8MN_CLK_UART3 111
129129 #define IMX8MN_CLK_UART4 112
include/linux/cgroup.h+1−0
@@ -62,6 +62,7 @@ struct css_task_iter { · 61 unmodified lines
6262 struct list_head *mg_tasks_head;
6363 struct list_head *dying_tasks_head;
6464
65+ struct list_head *cur_tasks_head;
6566 struct css_set *cur_cset;
6667 struct css_set *cur_dcset;
6768 struct task_struct *cur_task;
include/linux/dmar.h+9−5
@@ -69,19 +69,23 @@ struct dmar_pci_notify_info { · 68 unmodified lines
6969 extern struct rw_semaphore dmar_global_lock;
7070 extern struct list_head dmar_drhd_units;
7171
72−#define for_each_drhd_unit(drhd) \
73− list_for_each_entry_rcu(drhd, &dmar_drhd_units, list)
72+#define for_each_drhd_unit(drhd) \
73+ list_for_each_entry_rcu(drhd, &dmar_drhd_units, list, \
74+ dmar_rcu_check())
7475
7576 #define for_each_active_drhd_unit(drhd) \
76− list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) \
77+ list_for_each_entry_rcu(drhd, &dmar_drhd_units, list, \
78+ dmar_rcu_check()) \
7779 if (drhd->ignored) {} else
7880
7981 #define for_each_active_iommu(i, drhd) \
80− list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) \
82+ list_for_each_entry_rcu(drhd, &dmar_drhd_units, list, \
83+ dmar_rcu_check()) \
8184 if (i=drhd->iommu, drhd->ignored) {} else
8285
8386 #define for_each_iommu(i, drhd) \
84− list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) \
87+ list_for_each_entry_rcu(drhd, &dmar_drhd_units, list, \
88+ dmar_rcu_check()) \
8589 if (i=drhd->iommu, 0) {} else
8690
8791 static inline bool dmar_rcu_check(void)
include/linux/file.h+1−0
@@ -85,6 +85,7 @@ extern int f_dupfd(unsigned int from, struct file *file, unsigned flags); · 84 unmodified lines
8585 extern int replace_fd(unsigned fd, struct file *file, unsigned flags);
8686 extern void set_close_on_exec(unsigned int fd, int flag);
8787 extern bool get_close_on_exec(unsigned int fd);
88+extern int __get_unused_fd_flags(unsigned flags, unsigned long nofile);
8889 extern int get_unused_fd_flags(unsigned flags);
8990 extern void put_unused_fd(unsigned int fd);
9091
include/linux/fs.h+1−0
@@ -698,6 +698,7 @@ struct inode { · 697 unmodified lines
698698 struct rcu_head i_rcu;
699699 };
700700 atomic64_t i_version;
701+ atomic64_t i_sequence; /* see futex */
701702 atomic_t i_count;
702703 atomic_t i_dio_count;
703704 atomic_t i_writecount;
include/linux/futex.h+10−7
@@ -31,23 +31,26 @@ struct task_struct; · 30 unmodified lines
3131
3232 union futex_key {
3333 struct {
34+ u64 i_seq;
3435 unsigned long pgoff;
35− struct inode *inode;
36− int offset;
36+ unsigned int offset;
3737 } shared;
3838 struct {
39+ union {
40+ struct mm_struct *mm;
41+ u64 __tmp;
42+ };
3943 unsigned long address;
40− struct mm_struct *mm;
41− int offset;
44+ unsigned int offset;
4245 } private;
4346 struct {
47+ u64 ptr;
4448 unsigned long word;
45− void *ptr;
46− int offset;
49+ unsigned int offset;
4750 } both;
4851 };
4952
50−#define FUTEX_KEY_INIT (union futex_key) { .both = { .ptr = NULL } }
53+#define FUTEX_KEY_INIT (union futex_key) { .both = { .ptr = 0ULL } }
5154
5255 #ifdef CONFIG_FUTEX
5356 enum {
include/linux/genhd.h+1−12
@@ -245,18 +245,6 @@ static inline bool disk_part_scan_enabled(struct gendisk *disk) · 244 unmodified lines
245245 !(disk->flags & GENHD_FL_NO_PART_SCAN);
246246 }
247247
248−static inline bool disk_has_partitions(struct gendisk *disk)
249−{
250− bool ret = false;
251−
252− rcu_read_lock();
253− if (rcu_dereference(disk->part_tbl)->len > 1)
254− ret = true;
255− rcu_read_unlock();
256−
257− return ret;
258−}
259−
260248 static inline dev_t disk_devt(struct gendisk *disk)
261249 {
262250 return MKDEV(disk->major, disk->first_minor);
@@ -298,6 +286,7 @@ extern void disk_part_iter_exit(struct disk_part_iter *piter); · 35 unmodified lines
298286
299287 extern struct hd_struct *disk_map_sector_rcu(struct gendisk *disk,
300288 sector_t sector);
289+bool disk_has_partitions(struct gendisk *disk);
301290
302291 /*
303292 * Macros to operate on percpu disk statistics:
include/linux/inet_diag.h+12−6
@@ -2,15 +2,10 @@ · 1 unmodified line
22 #ifndef _INET_DIAG_H_
33 #define _INET_DIAG_H_ 1
44
5+#include <net/netlink.h>
56 #include <uapi/linux/inet_diag.h>
67
7−struct net;
8−struct sock;
98 struct inet_hashinfo;
10−struct nlattr;
11−struct nlmsghdr;
12−struct sk_buff;
13−struct netlink_callback;
149
1510 struct inet_diag_handler {
1611 void (*dump)(struct sk_buff *skb,
@@ -62,6 +57,17 @@ int inet_diag_bc_sk(const struct nlattr *_bc, struct sock *sk); · 45 unmodified lines
6257
6358 void inet_diag_msg_common_fill(struct inet_diag_msg *r, struct sock *sk);
6459
60+static inline size_t inet_diag_msg_attrs_size(void)
61+{
62+ return nla_total_size(1) /* INET_DIAG_SHUTDOWN */
63+ + nla_total_size(1) /* INET_DIAG_TOS */
64+#if IS_ENABLED(CONFIG_IPV6)
65+ + nla_total_size(1) /* INET_DIAG_TCLASS */
66+ + nla_total_size(1) /* INET_DIAG_SKV6ONLY */
67+#endif
68+ + nla_total_size(4) /* INET_DIAG_MARK */
69+ + nla_total_size(4); /* INET_DIAG_CLASS_ID */
70+}
6571 int inet_diag_msg_attrs_fill(struct sock *sk, struct sk_buff *skb,
6672 struct inet_diag_msg *r, int ext,
6773 struct user_namespace *user_ns, bool net_admin);
include/linux/intel-iommu.h+2−0
@@ -123,6 +123,8 @@ · 122 unmodified lines
123123
124124 #define dmar_readq(a) readq(a)
125125 #define dmar_writeq(a,v) writeq(v,a)
126+#define dmar_readl(a) readl(a)
127+#define dmar_writel(a, v) writel(v, a)
126128
127129 #define DMAR_VER_MAJOR(v) (((v) & 0xf0) >> 4)
128130 #define DMAR_VER_MINOR(v) ((v) & 0x0f)
include/linux/mmc/host.h+1−0
@@ -333,6 +333,7 @@ struct mmc_host { · 332 unmodified lines
333333 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 | \
334334 MMC_CAP_UHS_DDR50)
335335 #define MMC_CAP_SYNC_RUNTIME_PM (1 << 21) /* Synced runtime PM suspends. */
336+#define MMC_CAP_NEED_RSP_BUSY (1 << 22) /* Commands with R1B can't use R1. */
336337 #define MMC_CAP_DRIVER_TYPE_A (1 << 23) /* Host supports Driver Type A */
337338 #define MMC_CAP_DRIVER_TYPE_C (1 << 24) /* Host supports Driver Type C */
338339 #define MMC_CAP_DRIVER_TYPE_D (1 << 25) /* Host supports Driver Type D */
include/linux/of_clk.h+4−4
@@ -11,17 +11,17 @@ struct of_device_id; · 10 unmodified lines
1111
1212 #if defined(CONFIG_COMMON_CLK) && defined(CONFIG_OF)
1313
14−unsigned int of_clk_get_parent_count(struct device_node *np);
15−const char *of_clk_get_parent_name(struct device_node *np, int index);
14+unsigned int of_clk_get_parent_count(const struct device_node *np);
15+const char *of_clk_get_parent_name(const struct device_node *np, int index);
1616 void of_clk_init(const struct of_device_id *matches);
1717
1818 #else /* !CONFIG_COMMON_CLK || !CONFIG_OF */
1919
20−static inline unsigned int of_clk_get_parent_count(struct device_node *np)
20+static inline unsigned int of_clk_get_parent_count(const struct device_node *np)
2121 {
2222 return 0;
2323 }
24−static inline const char *of_clk_get_parent_name(struct device_node *np,
24+static inline const char *of_clk_get_parent_name(const struct device_node *np,
2525 int index)
2626 {
2727 return NULL;
include/linux/page-flags.h+1−1
@@ -311,7 +311,7 @@ static inline int TestClearPage##uname(struct page *page) { return 0; } · 310 unmodified lines
311311
312312 __PAGEFLAG(Locked, locked, PF_NO_TAIL)
313313 PAGEFLAG(Waiters, waiters, PF_ONLY_HEAD) __CLEARPAGEFLAG(Waiters, waiters, PF_ONLY_HEAD)
314−PAGEFLAG(Error, error, PF_NO_COMPOUND) TESTCLEARFLAG(Error, error, PF_NO_COMPOUND)
314+PAGEFLAG(Error, error, PF_NO_TAIL) TESTCLEARFLAG(Error, error, PF_NO_TAIL)
315315 PAGEFLAG(Referenced, referenced, PF_HEAD)
316316 TESTCLEARFLAG(Referenced, referenced, PF_HEAD)
317317 __SETPAGEFLAG(Referenced, referenced, PF_HEAD)
include/linux/phy.h+3−0
@@ -357,6 +357,7 @@ struct macsec_ops; · 356 unmodified lines
357357 * is_gigabit_capable: Set to true if PHY supports 1000Mbps
358358 * has_fixups: Set to true if this phy has fixups/quirks.
359359 * suspended: Set to true if this phy has been suspended successfully.
360+ * suspended_by_mdio_bus: Set to true if this phy was suspended by MDIO bus.
360361 * sysfs_links: Internal boolean tracking sysfs symbolic links setup/removal.
361362 * loopback_enabled: Set true if this phy has been loopbacked successfully.
362363 * state: state of the PHY for management purposes
@@ -396,6 +397,7 @@ struct phy_device { · 33 unmodified lines
396397 unsigned is_gigabit_capable:1;
397398 unsigned has_fixups:1;
398399 unsigned suspended:1;
400+ unsigned suspended_by_mdio_bus:1;
399401 unsigned sysfs_links:1;
400402 unsigned loopback_enabled:1;
401403
@@ -557,6 +559,7 @@ struct phy_driver { · 155 unmodified lines
557559 /*
558560 * Checks if the PHY generated an interrupt.
559561 * For multi-PHY devices with shared PHY interrupt pin
562+ * Set interrupt bits have to be cleared.
560563 */
561564 int (*did_interrupt)(struct phy_device *phydev);
562565
include/linux/platform_device.h+1−1
@@ -24,7 +24,7 @@ struct platform_device { · 23 unmodified lines
2424 int id;
2525 bool id_auto;
2626 struct device dev;
27− u64 dma_mask;
27+ u64 platform_dma_mask;
2828 u32 num_resources;
2929 struct resource *resource;
3030
include/linux/rhashtable.h+1−1
@@ -972,9 +972,9 @@ static inline int rhashtable_lookup_insert_key( · 971 unmodified lines
972972 /**
973973 * rhashtable_lookup_get_insert_key - lookup and insert object into hash table
974974 * @ht: hash table
975+ * @key: key
975976 * @obj: pointer to hash head inside object
976977 * @params: hash table parameters
977− * @data: pointer to element data already in hashes
978978 *
979979 * Just like rhashtable_lookup_insert_key(), but this function returns the
980980 * object if it exists, NULL if it does not and the insertion was successful,
include/linux/socket.h+2−1
@@ -401,7 +401,8 @@ extern int __sys_sendto(int fd, void __user *buff, size_t len, · 400 unmodified lines
401401 int addr_len);
402402 extern int __sys_accept4_file(struct file *file, unsigned file_flags,
403403 struct sockaddr __user *upeer_sockaddr,
404− int __user *upeer_addrlen, int flags);
404+ int __user *upeer_addrlen, int flags,
405+ unsigned long nofile);
405406 extern int __sys_accept4(int fd, struct sockaddr __user *upeer_sockaddr,
406407 int __user *upeer_addrlen, int flags);
407408 extern int __sys_socket(int family, int type, int protocol);
include/linux/vmalloc.h+3−2
@@ -141,8 +141,9 @@ extern int remap_vmalloc_range_partial(struct vm_area_struct *vma, · 140 unmodified lines
141141
142142 extern int remap_vmalloc_range(struct vm_area_struct *vma, void *addr,
143143 unsigned long pgoff);
144−void vmalloc_sync_all(void);
145−
144+void vmalloc_sync_mappings(void);
145+void vmalloc_sync_unmappings(void);
146+
146147 /*
147148 * Lowlevel-APIs (not for driver use!)
148149 */
include/linux/workqueue.h+16−0
@@ -487,6 +487,19 @@ extern void wq_worker_comm(char *buf, size_t size, struct task_struct *task); · 486 unmodified lines
487487 *
488488 * We queue the work to the CPU on which it was submitted, but if the CPU dies
489489 * it can be processed by another CPU.
490+ *
491+ * Memory-ordering properties: If it returns %true, guarantees that all stores
492+ * preceding the call to queue_work() in the program order will be visible from
493+ * the CPU which will execute @work by the time such work executes, e.g.,
494+ *
495+ * { x is initially 0 }
496+ *
497+ * CPU0 CPU1
498+ *
499+ * WRITE_ONCE(x, 1); [ @work is being executed ]
500+ * r0 = queue_work(wq, work); r1 = READ_ONCE(x);
501+ *
502+ * Forbids: r0 == true && r1 == 0
490503 */
491504 static inline bool queue_work(struct workqueue_struct *wq,
492505 struct work_struct *work)
@@ -546,6 +559,9 @@ static inline bool schedule_work_on(int cpu, struct work_struct *work) · 53 unmodified lines
546559 * This puts a job in the kernel-global workqueue if it was not already
547560 * queued and leaves it in the same position on the kernel-global
548561 * workqueue otherwise.
562+ *
563+ * Shares the same memory-ordering properties of queue_work(), cf. the
564+ * DocBook header of queue_work().
549565 */
550566 static inline bool schedule_work(struct work_struct *work)
551567 {
include/net/fib_rules.h+1−0
@@ -108,6 +108,7 @@ struct fib_rule_notifier_info { · 107 unmodified lines
108108 [FRA_OIFNAME] = { .type = NLA_STRING, .len = IFNAMSIZ - 1 }, \
109109 [FRA_PRIORITY] = { .type = NLA_U32 }, \
110110 [FRA_FWMARK] = { .type = NLA_U32 }, \
111+ [FRA_TUN_ID] = { .type = NLA_U64 }, \
111112 [FRA_FWMASK] = { .type = NLA_U32 }, \
112113 [FRA_TABLE] = { .type = NLA_U32 }, \
113114 [FRA_SUPPRESS_PREFIXLEN] = { .type = NLA_U32 }, \
include/soc/mscc/ocelot_dev.h+1−1
@@ -74,7 +74,7 @@ · 73 unmodified lines
7474 #define DEV_MAC_TAGS_CFG_TAG_ID_M GENMASK(31, 16)
7575 #define DEV_MAC_TAGS_CFG_TAG_ID_X(x) (((x) & GENMASK(31, 16)) >> 16)
7676 #define DEV_MAC_TAGS_CFG_VLAN_LEN_AWR_ENA BIT(2)
77−#define DEV_MAC_TAGS_CFG_PB_ENA BIT(1)
77+#define DEV_MAC_TAGS_CFG_VLAN_DBL_AWR_ENA BIT(1)
7878 #define DEV_MAC_TAGS_CFG_VLAN_AWR_ENA BIT(0)
7979
8080 #define DEV_MAC_ADV_CHK_CFG 0x2c
include/uapi/linux/in.h+2−0
@@ -74,6 +74,8 @@ enum { · 73 unmodified lines
7474 #define IPPROTO_UDPLITE IPPROTO_UDPLITE
7575 IPPROTO_MPLS = 137, /* MPLS in IP (RFC 4023) */
7676 #define IPPROTO_MPLS IPPROTO_MPLS
77+ IPPROTO_ETHERNET = 143, /* Ethernet-within-IPv6 Encapsulation */
78+#define IPPROTO_ETHERNET IPPROTO_ETHERNET
7779 IPPROTO_RAW = 255, /* Raw IP packets */
7880 #define IPPROTO_RAW IPPROTO_RAW
7981 IPPROTO_MPTCP = 262, /* Multipath TCP connection */
init/Kconfig+1−2
@@ -767,8 +767,7 @@ config ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH · 766 unmodified lines
767767 bool
768768
769769 config CC_HAS_INT128
770− def_bool y
771− depends on !$(cc-option,-D__SIZEOF_INT128__=0)
770+ def_bool !$(cc-option,$(m64-flag) -D__SIZEOF_INT128__=0) && 64BIT
772771
773772 #
774773 # For architectures that know their GCC __int128 support is sound
kernel/cgroup/cgroup-v1.c+2−1
@@ -471,6 +471,7 @@ static void *cgroup_pidlist_next(struct seq_file *s, void *v, loff_t *pos) · 470 unmodified lines
471471 */
472472 p++;
473473 if (p >= end) {
474+ (*pos)++;
474475 return NULL;
475476 } else {
476477 *pos = *p;
@@ -782,7 +783,7 @@ void cgroup1_release_agent(struct work_struct *work) · 305 unmodified lines
782783
783784 pathbuf = kmalloc(PATH_MAX, GFP_KERNEL);
784785 agentbuf = kstrdup(cgrp->root->release_agent_path, GFP_KERNEL);
785− if (!pathbuf || !agentbuf)
786+ if (!pathbuf || !agentbuf || !strlen(agentbuf))
786787 goto out;
787788
788789 spin_lock_irq(&css_set_lock);
kernel/cgroup/cgroup.c+30−13
@@ -3542,21 +3542,21 @@ static int cpu_stat_show(struct seq_file *seq, void *v) · 3541 unmodified lines
35423542 static int cgroup_io_pressure_show(struct seq_file *seq, void *v)
35433543 {
35443544 struct cgroup *cgrp = seq_css(seq)->cgroup;
3545− struct psi_group *psi = cgroup_id(cgrp) == 1 ? &psi_system : &cgrp->psi;
3545+ struct psi_group *psi = cgroup_ino(cgrp) == 1 ? &psi_system : &cgrp->psi;
35463546
35473547 return psi_show(seq, psi, PSI_IO);
35483548 }
35493549 static int cgroup_memory_pressure_show(struct seq_file *seq, void *v)
35503550 {
35513551 struct cgroup *cgrp = seq_css(seq)->cgroup;
3552− struct psi_group *psi = cgroup_id(cgrp) == 1 ? &psi_system : &cgrp->psi;
3552+ struct psi_group *psi = cgroup_ino(cgrp) == 1 ? &psi_system : &cgrp->psi;
35533553
35543554 return psi_show(seq, psi, PSI_MEM);
35553555 }
35563556 static int cgroup_cpu_pressure_show(struct seq_file *seq, void *v)
35573557 {
35583558 struct cgroup *cgrp = seq_css(seq)->cgroup;
3559− struct psi_group *psi = cgroup_id(cgrp) == 1 ? &psi_system : &cgrp->psi;
3559+ struct psi_group *psi = cgroup_ino(cgrp) == 1 ? &psi_system : &cgrp->psi;
35603560
35613561 return psi_show(seq, psi, PSI_CPU);
35623562 }
@@ -4400,12 +4400,16 @@ static void css_task_iter_advance_css_set(struct css_task_iter *it) · 837 unmodified lines
44004400 }
44014401 } while (!css_set_populated(cset) && list_empty(&cset->dying_tasks));
44024402
4403− if (!list_empty(&cset->tasks))
4403+ if (!list_empty(&cset->tasks)) {
44044404 it->task_pos = cset->tasks.next;
4405− else if (!list_empty(&cset->mg_tasks))
4405+ it->cur_tasks_head = &cset->tasks;
4406+ } else if (!list_empty(&cset->mg_tasks)) {
44064407 it->task_pos = cset->mg_tasks.next;
4407− else
4408+ it->cur_tasks_head = &cset->mg_tasks;
4409+ } else {
44084410 it->task_pos = cset->dying_tasks.next;
4411+ it->cur_tasks_head = &cset->dying_tasks;
4412+ }
44094413
44104414 it->tasks_head = &cset->tasks;
44114415 it->mg_tasks_head = &cset->mg_tasks;
@@ -4463,10 +4467,14 @@ repeat: · 51 unmodified lines
44634467 else
44644468 it->task_pos = it->task_pos->next;
44654469
4466− if (it->task_pos == it->tasks_head)
4470+ if (it->task_pos == it->tasks_head) {
44674471 it->task_pos = it->mg_tasks_head->next;
4468− if (it->task_pos == it->mg_tasks_head)
4472+ it->cur_tasks_head = it->mg_tasks_head;
4473+ }
4474+ if (it->task_pos == it->mg_tasks_head) {
44694475 it->task_pos = it->dying_tasks_head->next;
4476+ it->cur_tasks_head = it->dying_tasks_head;
4477+ }
44704478 if (it->task_pos == it->dying_tasks_head)
44714479 css_task_iter_advance_css_set(it);
44724480 } else {
@@ -4485,11 +4493,12 @@ repeat: · 12 unmodified lines
44854493 goto repeat;
44864494
44874495 /* and dying leaders w/o live member threads */
4488− if (!atomic_read(&task->signal->live))
4496+ if (it->cur_tasks_head == it->dying_tasks_head &&
4497+ !atomic_read(&task->signal->live))
44894498 goto repeat;
44904499 } else {
44914500 /* skip all dying ones */
4492− if (task->flags & PF_EXITING)
4501+ if (it->cur_tasks_head == it->dying_tasks_head)
44934502 goto repeat;
44944503 }
44954504 }
@@ -4595,6 +4604,9 @@ static void *cgroup_procs_next(struct seq_file *s, void *v, loff_t *pos) · 99 unmodified lines
45954604 struct kernfs_open_file *of = s->private;
45964605 struct css_task_iter *it = of->priv;
45974606
4607+ if (pos)
4608+ (*pos)++;
4609+
45984610 return css_task_iter_next(it);
45994611 }
46004612
@@ -4610,7 +4622,7 @@ static void *__cgroup_procs_start(struct seq_file *s, loff_t *pos, · 9 unmodified lines
46104622 * from position 0, so we can simply keep iterating on !0 *pos.
46114623 */
46124624 if (!it) {
4613− if (WARN_ON_ONCE((*pos)++))
4625+ if (WARN_ON_ONCE((*pos)))
46144626 return ERR_PTR(-EINVAL);
46154627
46164628 it = kzalloc(sizeof(*it), GFP_KERNEL);
@@ -4618,10 +4630,11 @@ static void *__cgroup_procs_start(struct seq_file *s, loff_t *pos, · 1 unmodified line
46184630 return ERR_PTR(-ENOMEM);
46194631 of->priv = it;
46204632 css_task_iter_start(&cgrp->self, iter_flags, it);
4621− } else if (!(*pos)++) {
4633+ } else if (!(*pos)) {
46224634 css_task_iter_end(it);
46234635 css_task_iter_start(&cgrp->self, iter_flags, it);
4624− }
4636+ } else
4637+ return it->cur_task;
46254638
46264639 return cgroup_procs_next(s, NULL, NULL);
46274640 }
@@ -6258,6 +6271,10 @@ void cgroup_sk_alloc(struct sock_cgroup_data *skcd) · 1630 unmodified lines
62586271 return;
62596272 }
62606273
6274+ /* Don't associate the sock with unrelated interrupted task's cgroup. */
6275+ if (in_interrupt())
6276+ return;
6277+
62616278 rcu_read_lock();
62626279
62636280 while (true) {
kernel/futex.c+55−38
@@ -385,9 +385,9 @@ static inline int hb_waiters_pending(struct futex_hash_bucket *hb) · 384 unmodified lines
385385 */
386386 static struct futex_hash_bucket *hash_futex(union futex_key *key)
387387 {
388− u32 hash = jhash2((u32*)&key->both.word,
389− (sizeof(key->both.word)+sizeof(key->both.ptr))/4,
388+ u32 hash = jhash2((u32 *)key, offsetof(typeof(*key), both.offset) / 4,
390389 key->both.offset);
390+
391391 return &futex_queues[hash & (futex_hashsize - 1)];
392392 }
393393
@@ -429,7 +429,7 @@ static void get_futex_key_refs(union futex_key *key) · 35 unmodified lines
429429
430430 switch (key->both.offset & (FUT_OFF_INODE|FUT_OFF_MMSHARED)) {
431431 case FUT_OFF_INODE:
432− ihold(key->shared.inode); /* implies smp_mb(); (B) */
432+ smp_mb(); /* explicit smp_mb(); (B) */
433433 break;
434434 case FUT_OFF_MMSHARED:
435435 futex_get_mm(key); /* implies smp_mb(); (B) */
@@ -463,7 +463,6 @@ static void drop_futex_key_refs(union futex_key *key) · 27 unmodified lines
463463
464464 switch (key->both.offset & (FUT_OFF_INODE|FUT_OFF_MMSHARED)) {
465465 case FUT_OFF_INODE:
466− iput(key->shared.inode);
467466 break;
468467 case FUT_OFF_MMSHARED:
469468 mmdrop(key->private.mm);
@@ -505,6 +504,46 @@ futex_setup_timer(ktime_t *time, struct hrtimer_sleeper *timeout, · 35 unmodified lines
505504 return timeout;
506505 }
507506
507+/*
508+ * Generate a machine wide unique identifier for this inode.
509+ *
510+ * This relies on u64 not wrapping in the life-time of the machine; which with
511+ * 1ns resolution means almost 585 years.
512+ *
513+ * This further relies on the fact that a well formed program will not unmap
514+ * the file while it has a (shared) futex waiting on it. This mapping will have
515+ * a file reference which pins the mount and inode.
516+ *
517+ * If for some reason an inode gets evicted and read back in again, it will get
518+ * a new sequence number and will _NOT_ match, even though it is the exact same
519+ * file.
520+ *
521+ * It is important that match_futex() will never have a false-positive, esp.
522+ * for PI futexes that can mess up the state. The above argues that false-negatives
523+ * are only possible for malformed programs.
524+ */
525+static u64 get_inode_sequence_number(struct inode *inode)
526+{
527+ static atomic64_t i_seq;
528+ u64 old;
529+
530+ /* Does the inode already have a sequence number? */
531+ old = atomic64_read(&inode->i_sequence);
532+ if (likely(old))
533+ return old;
534+
535+ for (;;) {
536+ u64 new = atomic64_add_return(1, &i_seq);
537+ if (WARN_ON_ONCE(!new))
538+ continue;
539+
540+ old = atomic64_cmpxchg_relaxed(&inode->i_sequence, 0, new);
541+ if (old)
542+ return old;
543+ return new;
544+ }
545+}
546+
508547 /**
509548 * get_futex_key() - Get parameters which are the keys for a futex
510549 * @uaddr: virtual address of the futex
@@ -517,9 +556,15 @@ futex_setup_timer(ktime_t *time, struct hrtimer_sleeper *timeout, · 6 unmodified lines
517556 *
518557 * The key words are stored in @key on success.
519558 *
520− * For shared mappings, it's (page->index, file_inode(vma->vm_file),
521− * offset_within_page). For private mappings, it's (uaddr, current->mm).
522− * We can usually work out the index without swapping in the page.
559+ * For shared mappings (when @fshared), the key is:
560+ * ( inode->i_sequence, page->index, offset_within_page )
561+ * [ also see get_inode_sequence_number() ]
562+ *
563+ * For private mappings (or when !@fshared), the key is:
564+ * ( current->mm, address, 0 )
565+ *
566+ * This allows (cross process, where applicable) identification of the futex
567+ * without keeping the page pinned for the duration of the FUTEX_WAIT.
523568 *
524569 * lock_page() might sleep, the caller should not hold a spinlock.
525570 */
@@ -659,8 +704,6 @@ again: · 133 unmodified lines
659704 key->private.mm = mm;
660705 key->private.address = address;
661706
662− get_futex_key_refs(key); /* implies smp_mb(); (B) */
663−
664707 } else {
665708 struct inode *inode;
666709
@@ -692,40 +735,14 @@ again: · 25 unmodified lines
692735 goto again;
693736 }
694737
695− /*
696− * Take a reference unless it is about to be freed. Previously
697− * this reference was taken by ihold under the page lock
698− * pinning the inode in place so i_lock was unnecessary. The
699− * only way for this check to fail is if the inode was
700− * truncated in parallel which is almost certainly an
701− * application bug. In such a case, just retry.
702− *
703− * We are not calling into get_futex_key_refs() in file-backed
704− * cases, therefore a successful atomic_inc return below will
705− * guarantee that get_futex_key() will still imply smp_mb(); (B).
706− */
707− if (!atomic_inc_not_zero(&inode->i_count)) {
708− rcu_read_unlock();
709− put_page(page);
710−
711− goto again;
712− }
713−
714− /* Should be impossible but lets be paranoid for now */
715− if (WARN_ON_ONCE(inode->i_mapping != mapping)) {
716− err = -EFAULT;
717− rcu_read_unlock();
718− iput(inode);
719−
720− goto out;
721− }
722−
723738 key->both.offset |= FUT_OFF_INODE; /* inode-based key */
724− key->shared.inode = inode;
739+ key->shared.i_seq = get_inode_sequence_number(inode);
725740 key->shared.pgoff = basepage_index(tail);
726741 rcu_read_unlock();
727742 }
728743
744+ get_futex_key_refs(key); /* implies smp_mb(); (B) */
745+
729746 out:
730747 put_page(page);
731748 return err;
kernel/notifier.c+1−1
@@ -519,7 +519,7 @@ NOKPROBE_SYMBOL(notify_die); · 518 unmodified lines
519519
520520 int register_die_notifier(struct notifier_block *nb)
521521 {
522− vmalloc_sync_all();
522+ vmalloc_sync_mappings();
523523 return atomic_notifier_chain_register(&die_chain, nb);
524524 }
525525 EXPORT_SYMBOL_GPL(register_die_notifier);
kernel/pid.c+10−0
@@ -247,6 +247,16 @@ struct pid *alloc_pid(struct pid_namespace *ns, pid_t *set_tid, · 246 unmodified lines
247247 tmp = tmp->parent;
248248 }
249249
250+ /*
251+ * ENOMEM is not the most obvious choice especially for the case
252+ * where the child subreaper has already exited and the pid
253+ * namespace denies the creation of any new processes. But ENOMEM
254+ * is what we have exposed to userspace for a long time and it is
255+ * documented behavior for pid namespaces. So we can't easily
256+ * change it even if there were an error code better suited.
257+ */
258+ retval = -ENOMEM;
259+
250260 if (unlikely(is_child_reaper(pid))) {
251261 if (pid_ns_prepare_proc(ns))
252262 goto out_free;
kernel/sys.c+2−0
@@ -47,6 +47,7 @@ · 46 unmodified lines
4747 #include <linux/syscalls.h>
4848 #include <linux/kprobes.h>
4949 #include <linux/user_namespace.h>
50+#include <linux/time_namespace.h>
5051 #include <linux/binfmts.h>
5152
5253 #include <linux/sched.h>
@@ -2546,6 +2547,7 @@ static int do_sysinfo(struct sysinfo *info) · 2493 unmodified lines
25462547 memset(info, 0, sizeof(struct sysinfo));
25472548
25482549 ktime_get_boottime_ts64(&tp);
2550+ timens_add_boottime(&tp);
25492551 info->uptime = tp.tv_sec + (tp.tv_nsec ? 1 : 0);
25502552
25512553 get_avenrun(info->loads, 0, SI_LOAD_SHIFT - FSHIFT);
kernel/trace/ftrace.c+2−0
@@ -1547,6 +1547,8 @@ static struct dyn_ftrace *lookup_rec(unsigned long start, unsigned long end) · 1546 unmodified lines
15471547 rec = bsearch(&key, pg->records, pg->index,
15481548 sizeof(struct dyn_ftrace),
15491549 ftrace_cmp_recs);
1550+ if (rec)
1551+ break;
15501552 }
15511553 return rec;
15521554 }
kernel/workqueue.c+8−6
@@ -1411,14 +1411,16 @@ static void __queue_work(int cpu, struct workqueue_struct *wq, · 1410 unmodified lines
14111411 return;
14121412 rcu_read_lock();
14131413 retry:
1414− if (req_cpu == WORK_CPU_UNBOUND)
1415− cpu = wq_select_unbound_cpu(raw_smp_processor_id());
1416−
14171414 /* pwq which will be used unless @work is executing elsewhere */
1418− if (!(wq->flags & WQ_UNBOUND))
1419− pwq = per_cpu_ptr(wq->cpu_pwqs, cpu);
1420− else
1415+ if (wq->flags & WQ_UNBOUND) {
1416+ if (req_cpu == WORK_CPU_UNBOUND)
1417+ cpu = wq_select_unbound_cpu(raw_smp_processor_id());
14211418 pwq = unbound_pwq_by_node(wq, cpu_to_node(cpu));
1419+ } else {
1420+ if (req_cpu == WORK_CPU_UNBOUND)
1421+ cpu = raw_smp_processor_id();
1422+ pwq = per_cpu_ptr(wq->cpu_pwqs, cpu);
1423+ }
14221424
14231425 /*
14241426 * If @work was previously on a different pool, it might still be
mm/madvise.c+9−3
@@ -335,12 +335,14 @@ static int madvise_cold_or_pageout_pte_range(pmd_t *pmd, · 334 unmodified lines
335335 }
336336
337337 page = pmd_page(orig_pmd);
338+
339+ /* Do not interfere with other mappings of this page */
340+ if (page_mapcount(page) != 1)
341+ goto huge_unlock;
342+
338343 if (next - addr != HPAGE_PMD_SIZE) {
339344 int err;
340345
341− if (page_mapcount(page) != 1)
342− goto huge_unlock;
343−
344346 get_page(page);
345347 spin_unlock(ptl);
346348 lock_page(page);
@@ -426,6 +428,10 @@ regular_page: · 79 unmodified lines
426428 continue;
427429 }
428430
431+ /* Do not interfere with other mappings of this page */
432+ if (page_mapcount(page) != 1)
433+ continue;
434+
429435 VM_BUG_ON_PAGE(PageTransCompound(page), page);
430436
431437 if (pte_young(ptent)) {
mm/memcontrol.c+68−49
@@ -2297,28 +2297,41 @@ static void high_work_func(struct work_struct *work) · 2296 unmodified lines
22972297 #define MEMCG_DELAY_SCALING_SHIFT 14
22982298
22992299 /*
2300− * Scheduled by try_charge() to be executed from the userland return path
2301− * and reclaims memory over the high limit.
2300+ * Get the number of jiffies that we should penalise a mischievous cgroup which
2301+ * is exceeding its memory.high by checking both it and its ancestors.
23022302 */
2303−void mem_cgroup_handle_over_high(void)
2303+static unsigned long calculate_high_delay(struct mem_cgroup *memcg,
2304+ unsigned int nr_pages)
23042305 {
2305− unsigned long usage, high, clamped_high;
2306− unsigned long pflags;
2307− unsigned long penalty_jiffies, overage;
2308− unsigned int nr_pages = current->memcg_nr_pages_over_high;
2309− struct mem_cgroup *memcg;
2306+ unsigned long penalty_jiffies;
2307+ u64 max_overage = 0;
23102308
2311− if (likely(!nr_pages))
2312− return;
2309+ do {
2310+ unsigned long usage, high;
2311+ u64 overage;
23132312
2314− memcg = get_mem_cgroup_from_mm(current->mm);
2315− reclaim_high(memcg, nr_pages, GFP_KERNEL);
2316− current->memcg_nr_pages_over_high = 0;
2313+ usage = page_counter_read(&memcg->memory);
2314+ high = READ_ONCE(memcg->high);
2315+
2316+ /*
2317+ * Prevent division by 0 in overage calculation by acting as if
2318+ * it was a threshold of 1 page
2319+ */
2320+ high = max(high, 1UL);
2321+
2322+ overage = usage - high;
2323+ overage <<= MEMCG_DELAY_PRECISION_SHIFT;
2324+ overage = div64_u64(overage, high);
2325+
2326+ if (overage > max_overage)
2327+ max_overage = overage;
2328+ } while ((memcg = parent_mem_cgroup(memcg)) &&
2329+ !mem_cgroup_is_root(memcg));
2330+
2331+ if (!max_overage)
2332+ return 0;
23172333
23182334 /*
2319− * memory.high is breached and reclaim is unable to keep up. Throttle
2320− * allocators proactively to slow down excessive growth.
2321− *
23222335 * We use overage compared to memory.high to calculate the number of
23232336 * jiffies to sleep (penalty_jiffies). Ideally this value should be
23242337 * fairly lenient on small overages, and increasingly harsh when the
@@ -2326,24 +2339,9 @@ void mem_cgroup_handle_over_high(void) · 1 unmodified line
23262339 * its crazy behaviour, so we exponentially increase the delay based on
23272340 * overage amount.
23282341 */
2329−
2330− usage = page_counter_read(&memcg->memory);
2331− high = READ_ONCE(memcg->high);
2332−
2333− if (usage <= high)
2334− goto out;
2335−
2336− /*
2337− * Prevent division by 0 in overage calculation by acting as if it was a
2338− * threshold of 1 page
2339− */
2340− clamped_high = max(high, 1UL);
2341−
2342− overage = div_u64((u64)(usage - high) << MEMCG_DELAY_PRECISION_SHIFT,
2343− clamped_high);
2344−
2345− penalty_jiffies = ((u64)overage * overage * HZ)
2346− >> (MEMCG_DELAY_PRECISION_SHIFT + MEMCG_DELAY_SCALING_SHIFT);
2342+ penalty_jiffies = max_overage * max_overage * HZ;
2343+ penalty_jiffies >>= MEMCG_DELAY_PRECISION_SHIFT;
2344+ penalty_jiffies >>= MEMCG_DELAY_SCALING_SHIFT;
23472345
23482346 /*
23492347 * Factor in the task's own contribution to the overage, such that four
@@ -2360,7 +2358,32 @@ void mem_cgroup_handle_over_high(void) · 10 unmodified lines
23602358 * application moving forwards and also permit diagnostics, albeit
23612359 * extremely slowly.
23622360 */
2363− penalty_jiffies = min(penalty_jiffies, MEMCG_MAX_HIGH_DELAY_JIFFIES);
2361+ return min(penalty_jiffies, MEMCG_MAX_HIGH_DELAY_JIFFIES);
2362+}
2363+
2364+/*
2365+ * Scheduled by try_charge() to be executed from the userland return path
2366+ * and reclaims memory over the high limit.
2367+ */
2368+void mem_cgroup_handle_over_high(void)
2369+{
2370+ unsigned long penalty_jiffies;
2371+ unsigned long pflags;
2372+ unsigned int nr_pages = current->memcg_nr_pages_over_high;
2373+ struct mem_cgroup *memcg;
2374+
2375+ if (likely(!nr_pages))
2376+ return;
2377+
2378+ memcg = get_mem_cgroup_from_mm(current->mm);
2379+ reclaim_high(memcg, nr_pages, GFP_KERNEL);
2380+ current->memcg_nr_pages_over_high = 0;
2381+
2382+ /*
2383+ * memory.high is breached and reclaim is unable to keep up. Throttle
2384+ * allocators proactively to slow down excessive growth.
2385+ */
2386+ penalty_jiffies = calculate_high_delay(memcg, nr_pages);
23642387
23652388 /*
23662389 * Don't sleep if the amount of jiffies this memcg owes us is so low
@@ -4027,7 +4050,7 @@ static void __mem_cgroup_usage_unregister_event(struct mem_cgroup *memcg, · 1660 unmodified lines
40274050 struct mem_cgroup_thresholds *thresholds;
40284051 struct mem_cgroup_threshold_ary *new;
40294052 unsigned long usage;
4030− int i, j, size;
4053+ int i, j, size, entries;
40314054
40324055 mutex_lock(&memcg->thresholds_lock);
40334056
@@ -4047,14 +4070,20 @@ static void __mem_cgroup_usage_unregister_event(struct mem_cgroup *memcg, · 13 unmodified lines
40474070 __mem_cgroup_threshold(memcg, type == _MEMSWAP);
40484071
40494072 /* Calculate new number of threshold */
4050− size = 0;
4073+ size = entries = 0;
40514074 for (i = 0; i < thresholds->primary->size; i++) {
40524075 if (thresholds->primary->entries[i].eventfd != eventfd)
40534076 size++;
4077+ else
4078+ entries++;
40544079 }
40554080
40564081 new = thresholds->spare;
40574082
4083+ /* If no items related to eventfd have been cleared, nothing to do */
4084+ if (!entries)
4085+ goto unlock;
4086+
40584087 /* Set thresholds array to NULL if we don't have thresholds */
40594088 if (!size) {
40604089 kfree(new);
@@ -6682,19 +6711,9 @@ void mem_cgroup_sk_alloc(struct sock *sk) · 2621 unmodified lines
66826711 if (!mem_cgroup_sockets_enabled)
66836712 return;
66846713
6685− /*
6686− * Socket cloning can throw us here with sk_memcg already
6687− * filled. It won't however, necessarily happen from
6688− * process context. So the test for root memcg given
6689− * the current task's memcg won't help us in this case.
6690− *
6691− * Respecting the original socket's memcg is a better
6692− * decision in this case.
6693− */
6694− if (sk->sk_memcg) {
6695− css_get(&sk->sk_memcg->css);
6714+ /* Do not associate the sock with unrelated interrupted task's memcg. */
6715+ if (in_interrupt())
66966716 return;
6697− }
66986717
66996718 rcu_read_lock();
67006719 memcg = mem_cgroup_from_task(current);
mm/mmu_notifier.c+18−9
@@ -307,7 +307,8 @@ static void mn_hlist_release(struct mmu_notifier_subscriptions *subscriptions, · 306 unmodified lines
307307 * ->release returns.
308308 */
309309 id = srcu_read_lock(&srcu);
310− hlist_for_each_entry_rcu(subscription, &subscriptions->list, hlist)
310+ hlist_for_each_entry_rcu(subscription, &subscriptions->list, hlist,
311+ srcu_read_lock_held(&srcu))
311312 /*
312313 * If ->release runs before mmu_notifier_unregister it must be
313314 * handled, as it's the only way for the driver to flush all
@@ -370,7 +371,8 @@ int __mmu_notifier_clear_flush_young(struct mm_struct *mm, · 56 unmodified lines
370371
371372 id = srcu_read_lock(&srcu);
372373 hlist_for_each_entry_rcu(subscription,
373− &mm->notifier_subscriptions->list, hlist) {
374+ &mm->notifier_subscriptions->list, hlist,
375+ srcu_read_lock_held(&srcu)) {
374376 if (subscription->ops->clear_flush_young)
375377 young |= subscription->ops->clear_flush_young(
376378 subscription, mm, start, end);
@@ -389,7 +391,8 @@ int __mmu_notifier_clear_young(struct mm_struct *mm, · 12 unmodified lines
389391
390392 id = srcu_read_lock(&srcu);
391393 hlist_for_each_entry_rcu(subscription,
392− &mm->notifier_subscriptions->list, hlist) {
394+ &mm->notifier_subscriptions->list, hlist,
395+ srcu_read_lock_held(&srcu)) {
393396 if (subscription->ops->clear_young)
394397 young |= subscription->ops->clear_young(subscription,
395398 mm, start, end);
@@ -407,7 +410,8 @@ int __mmu_notifier_test_young(struct mm_struct *mm, · 11 unmodified lines
407410
408411 id = srcu_read_lock(&srcu);
409412 hlist_for_each_entry_rcu(subscription,
410− &mm->notifier_subscriptions->list, hlist) {
413+ &mm->notifier_subscriptions->list, hlist,
414+ srcu_read_lock_held(&srcu)) {
411415 if (subscription->ops->test_young) {
412416 young = subscription->ops->test_young(subscription, mm,
413417 address);
@@ -428,7 +432,8 @@ void __mmu_notifier_change_pte(struct mm_struct *mm, unsigned long address, · 14 unmodified lines
428432
429433 id = srcu_read_lock(&srcu);
430434 hlist_for_each_entry_rcu(subscription,
431− &mm->notifier_subscriptions->list, hlist) {
435+ &mm->notifier_subscriptions->list, hlist,
436+ srcu_read_lock_held(&srcu)) {
432437 if (subscription->ops->change_pte)
433438 subscription->ops->change_pte(subscription, mm, address,
434439 pte);
@@ -476,7 +481,8 @@ static int mn_hlist_invalidate_range_start( · 41 unmodified lines
476481 int id;
477482
478483 id = srcu_read_lock(&srcu);
479− hlist_for_each_entry_rcu(subscription, &subscriptions->list, hlist) {
484+ hlist_for_each_entry_rcu(subscription, &subscriptions->list, hlist,
485+ srcu_read_lock_held(&srcu)) {
480486 const struct mmu_notifier_ops *ops = subscription->ops;
481487
482488 if (ops->invalidate_range_start) {
@@ -528,7 +534,8 @@ mn_hlist_invalidate_end(struct mmu_notifier_subscriptions *subscriptions, · 45 unmodified lines
528534 int id;
529535
530536 id = srcu_read_lock(&srcu);
531− hlist_for_each_entry_rcu(subscription, &subscriptions->list, hlist) {
537+ hlist_for_each_entry_rcu(subscription, &subscriptions->list, hlist,
538+ srcu_read_lock_held(&srcu)) {
532539 /*
533540 * Call invalidate_range here too to avoid the need for the
534541 * subsystem of having to register an invalidate_range_end
@@ -582,7 +589,8 @@ void __mmu_notifier_invalidate_range(struct mm_struct *mm, · 47 unmodified lines
582589
583590 id = srcu_read_lock(&srcu);
584591 hlist_for_each_entry_rcu(subscription,
585− &mm->notifier_subscriptions->list, hlist) {
592+ &mm->notifier_subscriptions->list, hlist,
593+ srcu_read_lock_held(&srcu)) {
586594 if (subscription->ops->invalidate_range)
587595 subscription->ops->invalidate_range(subscription, mm,
588596 start, end);
@@ -714,7 +722,8 @@ find_get_mmu_notifier(struct mm_struct *mm, const struct mmu_notifier_ops *ops) · 125 unmodified lines
714722
715723 spin_lock(&mm->notifier_subscriptions->lock);
716724 hlist_for_each_entry_rcu(subscription,
717− &mm->notifier_subscriptions->list, hlist) {
725+ &mm->notifier_subscriptions->list, hlist,
726+ lockdep_is_held(&mm->notifier_subscriptions->lock)) {
718727 if (subscription->ops != ops)
719728 continue;
720729
mm/nommu.c+7−3
@@ -370,10 +370,14 @@ void vm_unmap_aliases(void) · 369 unmodified lines
370370 EXPORT_SYMBOL_GPL(vm_unmap_aliases);
371371
372372 /*
373− * Implement a stub for vmalloc_sync_all() if the architecture chose not to
374− * have one.
373+ * Implement a stub for vmalloc_sync_[un]mapping() if the architecture
374+ * chose not to have one.
375375 */
376−void __weak vmalloc_sync_all(void)
376+void __weak vmalloc_sync_mappings(void)
377+{
378+}
379+
380+void __weak vmalloc_sync_unmappings(void)
377381 {
378382 }
379383
mm/slub.c+30−11
@@ -1973,8 +1973,6 @@ static void *get_partial(struct kmem_cache *s, gfp_t flags, int node, · 1972 unmodified lines
19731973
19741974 if (node == NUMA_NO_NODE)
19751975 searchnode = numa_mem_id();
1976− else if (!node_present_pages(node))
1977− searchnode = node_to_mem_node(node);
19781976
19791977 object = get_partial_node(s, get_node(s, searchnode), c, flags);
19801978 if (object || node != NUMA_NO_NODE)
@@ -2563,17 +2561,27 @@ static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node, · 582 unmodified lines
25632561 struct page *page;
25642562
25652563 page = c->page;
2566− if (!page)
2564+ if (!page) {
2565+ /*
2566+ * if the node is not online or has no normal memory, just
2567+ * ignore the node constraint
2568+ */
2569+ if (unlikely(node != NUMA_NO_NODE &&
2570+ !node_state(node, N_NORMAL_MEMORY)))
2571+ node = NUMA_NO_NODE;
25672572 goto new_slab;
2573+ }
25682574 redo:
25692575
25702576 if (unlikely(!node_match(page, node))) {
2571− int searchnode = node;
2572−
2573− if (node != NUMA_NO_NODE && !node_present_pages(node))
2574− searchnode = node_to_mem_node(node);
2575−
2576− if (unlikely(!node_match(page, searchnode))) {
2577+ /*
2578+ * same as above but node_match() being false already
2579+ * implies node != NUMA_NO_NODE
2580+ */
2581+ if (!node_state(node, N_NORMAL_MEMORY)) {
2582+ node = NUMA_NO_NODE;
2583+ goto redo;
2584+ } else {
25772585 stat(s, ALLOC_NODE_MISMATCH);
25782586 deactivate_slab(s, page, c->freelist, c);
25792587 goto new_slab;
@@ -2997,11 +3005,13 @@ redo: · 417 unmodified lines
29973005 barrier();
29983006
29993007 if (likely(page == c->page)) {
3000− set_freepointer(s, tail_obj, c->freelist);
3008+ void **freelist = READ_ONCE(c->freelist);
3009+
3010+ set_freepointer(s, tail_obj, freelist);
30013011
30023012 if (unlikely(!this_cpu_cmpxchg_double(
30033013 s->cpu_slab->freelist, s->cpu_slab->tid,
3004− c->freelist, tid,
3014+ freelist, tid,
30053015 head, next_tid(tid)))) {
30063016
30073017 note_cmpxchg_failure("slab_free", s, tid);
@@ -3174,6 +3184,15 @@ int kmem_cache_alloc_bulk(struct kmem_cache *s, gfp_t flags, size_t size, · 166 unmodified lines
31743184 void *object = c->freelist;
31753185
31763186 if (unlikely(!object)) {
3187+ /*
3188+ * We may have removed an object from c->freelist using
3189+ * the fastpath in the previous iteration; in that case,
3190+ * c->tid has not been bumped yet.
3191+ * Since ___slab_alloc() may reenable interrupts while
3192+ * allocating memory, we should bump c->tid now.
3193+ */
3194+ c->tid = next_tid(c->tid);
3195+
31773196 /*
31783197 * Invoking slow path likely have side-effect
31793198 * of re-populating per CPU c->freelist
mm/sparse.c+6−2
@@ -734,6 +734,7 @@ static void section_deactivate(unsigned long pfn, unsigned long nr_pages, · 733 unmodified lines
734734 struct mem_section *ms = __pfn_to_section(pfn);
735735 bool section_is_early = early_section(ms);
736736 struct page *memmap = NULL;
737+ bool empty;
737738 unsigned long *subsection_map = ms->usage
738739 ? &ms->usage->subsection_map[0] : NULL;
739740
@@ -764,7 +765,8 @@ static void section_deactivate(unsigned long pfn, unsigned long nr_pages, · 24 unmodified lines
764765 * For 2/ and 3/ the SPARSEMEM_VMEMMAP={y,n} cases are unified
765766 */
766767 bitmap_xor(subsection_map, map, subsection_map, SUBSECTIONS_PER_SECTION);
767− if (bitmap_empty(subsection_map, SUBSECTIONS_PER_SECTION)) {
768+ empty = bitmap_empty(subsection_map, SUBSECTIONS_PER_SECTION);
769+ if (empty) {
768770 unsigned long section_nr = pfn_to_section_nr(pfn);
769771
770772 /*
@@ -779,13 +781,15 @@ static void section_deactivate(unsigned long pfn, unsigned long nr_pages, · 8 unmodified lines
779781 ms->usage = NULL;
780782 }
781783 memmap = sparse_decode_mem_map(ms->section_mem_map, section_nr);
782− ms->section_mem_map = (unsigned long)NULL;
783784 }
784785
785786 if (section_is_early && memmap)
786787 free_map_bootmem(memmap);
787788 else
788789 depopulate_section_memmap(pfn, nr_pages, altmap);
790+
791+ if (empty)
792+ ms->section_mem_map = (unsigned long)NULL;
789793 }
790794
791795 static struct page * __meminit section_activate(int nid, unsigned long pfn,
mm/vmalloc.c+7−4
@@ -1295,7 +1295,7 @@ static bool __purge_vmap_area_lazy(unsigned long start, unsigned long end) · 1294 unmodified lines
12951295 * First make sure the mappings are removed from all page-tables
12961296 * before they are freed.
12971297 */
1298− vmalloc_sync_all();
1298+ vmalloc_sync_unmappings();
12991299
13001300 /*
13011301 * TODO: to calculate a flush range without looping.
@@ -3128,16 +3128,19 @@ int remap_vmalloc_range(struct vm_area_struct *vma, void *addr, · 1826 unmodified lines
31283128 EXPORT_SYMBOL(remap_vmalloc_range);
31293129
31303130 /*
3131− * Implement a stub for vmalloc_sync_all() if the architecture chose not to
3132− * have one.
3131+ * Implement stubs for vmalloc_sync_[un]mappings () if the architecture chose
3132+ * not to have one.
31333133 *
31343134 * The purpose of this function is to make sure the vmalloc area
31353135 * mappings are identical in all page-tables in the system.
31363136 */
3137−void __weak vmalloc_sync_all(void)
3137+void __weak vmalloc_sync_mappings(void)
31383138 {
31393139 }
31403140
3141+void __weak vmalloc_sync_unmappings(void)
3142+{
3143+}
31413144
31423145 static int f(pte_t *pte, unsigned long addr, void *data)
31433146 {
net/batman-adv/bat_iv_ogm.c+4−0
@@ -789,6 +789,10 @@ static void batadv_iv_ogm_schedule_buff(struct batadv_hard_iface *hard_iface) · 788 unmodified lines
789789
790790 lockdep_assert_held(&hard_iface->bat_iv.ogm_buff_mutex);
791791
792+ /* interface already disabled by batadv_iv_ogm_iface_disable */
793+ if (!*ogm_buff)
794+ return;
795+
792796 /* the interface gets activated here to avoid race conditions between
793797 * the moment of activating the interface in
794798 * hardif_activate_interface() where the originator mac is set and
net/caif/caif_dev.c+2−1
@@ -112,7 +112,8 @@ static struct caif_device_entry *caif_get(struct net_device *dev) · 111 unmodified lines
112112 caif_device_list(dev_net(dev));
113113 struct caif_device_entry *caifd;
114114
115− list_for_each_entry_rcu(caifd, &caifdevs->list, list) {
115+ list_for_each_entry_rcu(caifd, &caifdevs->list, list,
116+ lockdep_rtnl_is_held()) {
116117 if (caifd->netdev == dev)
117118 return caifd;
118119 }
net/core/devlink.c+21−12
@@ -3352,34 +3352,41 @@ devlink_param_value_get_from_info(const struct devlink_param *param, · 3351 unmodified lines
33523352 struct genl_info *info,
33533353 union devlink_param_value *value)
33543354 {
3355+ struct nlattr *param_data;
33553356 int len;
33563357
3357− if (param->type != DEVLINK_PARAM_TYPE_BOOL &&
3358− !info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA])
3358+ param_data = info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA];
3359+
3360+ if (param->type != DEVLINK_PARAM_TYPE_BOOL && !param_data)
33593361 return -EINVAL;
33603362
33613363 switch (param->type) {
33623364 case DEVLINK_PARAM_TYPE_U8:
3363− value->vu8 = nla_get_u8(info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA]);
3365+ if (nla_len(param_data) != sizeof(u8))
3366+ return -EINVAL;
3367+ value->vu8 = nla_get_u8(param_data);
33643368 break;
33653369 case DEVLINK_PARAM_TYPE_U16:
3366− value->vu16 = nla_get_u16(info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA]);
3370+ if (nla_len(param_data) != sizeof(u16))
3371+ return -EINVAL;
3372+ value->vu16 = nla_get_u16(param_data);
33673373 break;
33683374 case DEVLINK_PARAM_TYPE_U32:
3369− value->vu32 = nla_get_u32(info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA]);
3375+ if (nla_len(param_data) != sizeof(u32))
3376+ return -EINVAL;
3377+ value->vu32 = nla_get_u32(param_data);
33703378 break;
33713379 case DEVLINK_PARAM_TYPE_STRING:
3372− len = strnlen(nla_data(info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA]),
3373− nla_len(info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA]));
3374− if (len == nla_len(info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA]) ||
3380+ len = strnlen(nla_data(param_data), nla_len(param_data));
3381+ if (len == nla_len(param_data) ||
33753382 len >= __DEVLINK_PARAM_MAX_STRING_VALUE)
33763383 return -EINVAL;
3377− strcpy(value->vstr,
3378− nla_data(info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA]));
3384+ strcpy(value->vstr, nla_data(param_data));
33793385 break;
33803386 case DEVLINK_PARAM_TYPE_BOOL:
3381− value->vbool = info->attrs[DEVLINK_ATTR_PARAM_VALUE_DATA] ?
3382− true : false;
3387+ if (param_data && nla_len(param_data))
3388+ return -EINVAL;
3389+ value->vbool = nla_get_flag(param_data);
33833390 break;
33843391 }
33853392 return 0;
@@ -5951,6 +5958,8 @@ static const struct nla_policy devlink_nl_policy[DEVLINK_ATTR_MAX + 1] = { · 2565 unmodified lines
59515958 [DEVLINK_ATTR_PARAM_VALUE_CMODE] = { .type = NLA_U8 },
59525959 [DEVLINK_ATTR_REGION_NAME] = { .type = NLA_NUL_STRING },
59535960 [DEVLINK_ATTR_REGION_SNAPSHOT_ID] = { .type = NLA_U32 },
5961+ [DEVLINK_ATTR_REGION_CHUNK_ADDR] = { .type = NLA_U64 },
5962+ [DEVLINK_ATTR_REGION_CHUNK_LEN] = { .type = NLA_U64 },
59545963 [DEVLINK_ATTR_HEALTH_REPORTER_NAME] = { .type = NLA_NUL_STRING },
59555964 [DEVLINK_ATTR_HEALTH_REPORTER_GRACEFUL_PERIOD] = { .type = NLA_U64 },
59565965 [DEVLINK_ATTR_HEALTH_REPORTER_AUTO_RECOVER] = { .type = NLA_U8 },
net/core/netclassid_cgroup.c+37−10
@@ -53,30 +53,60 @@ static void cgrp_css_free(struct cgroup_subsys_state *css) · 52 unmodified lines
5353 kfree(css_cls_state(css));
5454 }
5555
56+/*
57+ * To avoid freezing of sockets creation for tasks with big number of threads
58+ * and opened sockets lets release file_lock every 1000 iterated descriptors.
59+ * New sockets will already have been created with new classid.
60+ */
61+
62+struct update_classid_context {
63+ u32 classid;
64+ unsigned int batch;
65+};
66+
67+#define UPDATE_CLASSID_BATCH 1000
68+
5669 static int update_classid_sock(const void *v, struct file *file, unsigned n)
5770 {
5871 int err;
72+ struct update_classid_context *ctx = (void *)v;
5973 struct socket *sock = sock_from_file(file, &err);
6074
6175 if (sock) {
6276 spin_lock(&cgroup_sk_update_lock);
63− sock_cgroup_set_classid(&sock->sk->sk_cgrp_data,
64− (unsigned long)v);
77+ sock_cgroup_set_classid(&sock->sk->sk_cgrp_data, ctx->classid);
6578 spin_unlock(&cgroup_sk_update_lock);
6679 }
80+ if (--ctx->batch == 0) {
81+ ctx->batch = UPDATE_CLASSID_BATCH;
82+ return n + 1;
83+ }
6784 return 0;
6885 }
6986
87+static void update_classid_task(struct task_struct *p, u32 classid)
88+{
89+ struct update_classid_context ctx = {
90+ .classid = classid,
91+ .batch = UPDATE_CLASSID_BATCH
92+ };
93+ unsigned int fd = 0;
94+
95+ do {
96+ task_lock(p);
97+ fd = iterate_fd(p->files, fd, update_classid_sock, &ctx);
98+ task_unlock(p);
99+ cond_resched();
100+ } while (fd);
101+}
102+
70103 static void cgrp_attach(struct cgroup_taskset *tset)
71104 {
72105 struct cgroup_subsys_state *css;
73106 struct task_struct *p;
74107
75108 cgroup_taskset_for_each(p, css, tset) {
76− task_lock(p);
77− iterate_fd(p->files, 0, update_classid_sock,
78− (void *)(unsigned long)css_cls_state(css)->classid);
79− task_unlock(p);
109+ update_classid_task(p, css_cls_state(css)->classid);
80110 }
81111 }
82112
@@ -98,10 +128,7 @@ static int write_classid(struct cgroup_subsys_state *css, struct cftype *cft, · 15 unmodified lines
98128
99129 css_task_iter_start(css, 0, &it);
100130 while ((p = css_task_iter_next(&it))) {
101− task_lock(p);
102− iterate_fd(p->files, 0, update_classid_sock,
103− (void *)(unsigned long)cs->classid);
104− task_unlock(p);
131+ update_classid_task(p, cs->classid);
105132 cond_resched();
106133 }
107134 css_task_iter_end(&it);
net/core/sock.c+4−1
@@ -1830,7 +1830,10 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority) · 1829 unmodified lines
18301830 atomic_set(&newsk->sk_zckey, 0);
18311831
18321832 sock_reset_flag(newsk, SOCK_DONE);
1833− mem_cgroup_sk_alloc(newsk);
1833+
1834+ /* sk->sk_memcg will be populated at accept() time */
1835+ newsk->sk_memcg = NULL;
1836+
18341837 cgroup_sk_alloc(&newsk->sk_cgrp_data);
18351838
18361839 rcu_read_lock();
net/dsa/dsa_priv.h+2−0
@@ -117,7 +117,9 @@ static inline struct net_device *dsa_master_find_slave(struct net_device *dev, · 116 unmodified lines
117117 /* port.c */
118118 int dsa_port_set_state(struct dsa_port *dp, u8 state,
119119 struct switchdev_trans *trans);
120+int dsa_port_enable_rt(struct dsa_port *dp, struct phy_device *phy);
120121 int dsa_port_enable(struct dsa_port *dp, struct phy_device *phy);
122+void dsa_port_disable_rt(struct dsa_port *dp);
121123 void dsa_port_disable(struct dsa_port *dp);
122124 int dsa_port_bridge_join(struct dsa_port *dp, struct net_device *br);
123125 void dsa_port_bridge_leave(struct dsa_port *dp, struct net_device *br);
net/dsa/port.c+35−9
@@ -63,7 +63,7 @@ static void dsa_port_set_state_now(struct dsa_port *dp, u8 state) · 62 unmodified lines
6363 pr_err("DSA: failed to set STP state %u (%d)\n", state, err);
6464 }
6565
66−int dsa_port_enable(struct dsa_port *dp, struct phy_device *phy)
66+int dsa_port_enable_rt(struct dsa_port *dp, struct phy_device *phy)
6767 {
6868 struct dsa_switch *ds = dp->ds;
6969 int port = dp->index;
@@ -78,14 +78,31 @@ int dsa_port_enable(struct dsa_port *dp, struct phy_device *phy) · 8 unmodified lines
7878 if (!dp->bridge_dev)
7979 dsa_port_set_state_now(dp, BR_STATE_FORWARDING);
8080
81+ if (dp->pl)
82+ phylink_start(dp->pl);
83+
8184 return 0;
8285 }
8386
84−void dsa_port_disable(struct dsa_port *dp)
87+int dsa_port_enable(struct dsa_port *dp, struct phy_device *phy)
88+{
89+ int err;
90+
91+ rtnl_lock();
92+ err = dsa_port_enable_rt(dp, phy);
93+ rtnl_unlock();
94+
95+ return err;
96+}
97+
98+void dsa_port_disable_rt(struct dsa_port *dp)
8599 {
86100 struct dsa_switch *ds = dp->ds;
87101 int port = dp->index;
88102
103+ if (dp->pl)
104+ phylink_stop(dp->pl);
105+
89106 if (!dp->bridge_dev)
90107 dsa_port_set_state_now(dp, BR_STATE_DISABLED);
91108
@@ -93,6 +110,13 @@ void dsa_port_disable(struct dsa_port *dp) · 1 unmodified line
93110 ds->ops->port_disable(ds, port);
94111 }
95112
113+void dsa_port_disable(struct dsa_port *dp)
114+{
115+ rtnl_lock();
116+ dsa_port_disable_rt(dp);
117+ rtnl_unlock();
118+}
119+
96120 int dsa_port_bridge_join(struct dsa_port *dp, struct net_device *br)
97121 {
98122 struct dsa_notifier_bridge_info info = {
@@ -614,10 +638,6 @@ static int dsa_port_phylink_register(struct dsa_port *dp) · 515 unmodified lines
614638 goto err_phy_connect;
615639 }
616640
617− rtnl_lock();
618− phylink_start(dp->pl);
619− rtnl_unlock();
620−
621641 return 0;
622642
623643 err_phy_connect:
@@ -628,9 +648,14 @@ err_phy_connect: · 4 unmodified lines
628648 int dsa_port_link_register_of(struct dsa_port *dp)
629649 {
630650 struct dsa_switch *ds = dp->ds;
651+ struct device_node *phy_np;
631652
632− if (!ds->ops->adjust_link)
633− return dsa_port_phylink_register(dp);
653+ if (!ds->ops->adjust_link) {
654+ phy_np = of_parse_phandle(dp->dn, "phy-handle", 0);
655+ if (of_phy_is_fixed_link(dp->dn) || phy_np)
656+ return dsa_port_phylink_register(dp);
657+ return 0;
658+ }
634659
635660 dev_warn(ds->dev,
636661 "Using legacy PHYLIB callbacks. Please migrate to PHYLINK!\n");
@@ -645,11 +670,12 @@ void dsa_port_link_unregister_of(struct dsa_port *dp) · 8 unmodified lines
645670 {
646671 struct dsa_switch *ds = dp->ds;
647672
648− if (!ds->ops->adjust_link) {
673+ if (!ds->ops->adjust_link && dp->pl) {
649674 rtnl_lock();
650675 phylink_disconnect_phy(dp->pl);
651676 rtnl_unlock();
652677 phylink_destroy(dp->pl);
678+ dp->pl = NULL;
653679 return;
654680 }
655681
net/dsa/slave.c+2−6
@@ -88,12 +88,10 @@ static int dsa_slave_open(struct net_device *dev) · 87 unmodified lines
8888 goto clear_allmulti;
8989 }
9090
91− err = dsa_port_enable(dp, dev->phydev);
91+ err = dsa_port_enable_rt(dp, dev->phydev);
9292 if (err)
9393 goto clear_promisc;
9494
95− phylink_start(dp->pl);
96−
9795 return 0;
9896
9997 clear_promisc:
@@ -114,9 +112,7 @@ static int dsa_slave_close(struct net_device *dev) · 14 unmodified lines
114112 struct net_device *master = dsa_slave_to_master(dev);
115113 struct dsa_port *dp = dsa_slave_to_port(dev);
116114
117− phylink_stop(dp->pl);
118−
119− dsa_port_disable(dp);
115+ dsa_port_disable_rt(dp);
120116
121117 dev_mc_unsync(master, dev);
122118 dev_uc_unsync(master, dev);
net/ieee802154/nl_policy.c+6−0
@@ -21,7 +21,13 @@ const struct nla_policy ieee802154_policy[IEEE802154_ATTR_MAX + 1] = { · 20 unmodified lines
2121 [IEEE802154_ATTR_HW_ADDR] = { .type = NLA_HW_ADDR, },
2222 [IEEE802154_ATTR_PAN_ID] = { .type = NLA_U16, },
2323 [IEEE802154_ATTR_CHANNEL] = { .type = NLA_U8, },
24+ [IEEE802154_ATTR_BCN_ORD] = { .type = NLA_U8, },
25+ [IEEE802154_ATTR_SF_ORD] = { .type = NLA_U8, },
26+ [IEEE802154_ATTR_PAN_COORD] = { .type = NLA_U8, },
27+ [IEEE802154_ATTR_BAT_EXT] = { .type = NLA_U8, },
28+ [IEEE802154_ATTR_COORD_REALIGN] = { .type = NLA_U8, },
2429 [IEEE802154_ATTR_PAGE] = { .type = NLA_U8, },
30+ [IEEE802154_ATTR_DEV_TYPE] = { .type = NLA_U8, },
2531 [IEEE802154_ATTR_COORD_SHORT_ADDR] = { .type = NLA_U16, },
2632 [IEEE802154_ATTR_COORD_HW_ADDR] = { .type = NLA_HW_ADDR, },
2733 [IEEE802154_ATTR_COORD_PAN_ID] = { .type = NLA_U16, },
net/ipv4/gre_demux.c+10−2
@@ -56,7 +56,9 @@ int gre_del_protocol(const struct gre_protocol *proto, u8 version) · 55 unmodified lines
5656 }
5757 EXPORT_SYMBOL_GPL(gre_del_protocol);
5858
59−/* Fills in tpi and returns header length to be pulled. */
59+/* Fills in tpi and returns header length to be pulled.
60+ * Note that caller must use pskb_may_pull() before pulling GRE header.
61+ */
6062 int gre_parse_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
6163 bool *csum_err, __be16 proto, int nhs)
6264 {
@@ -110,8 +112,14 @@ int gre_parse_header(struct sk_buff *skb, struct tnl_ptk_info *tpi, · 47 unmodified lines
110112 * - When dealing with WCCPv2, Skip extra 4 bytes in GRE header
111113 */
112114 if (greh->flags == 0 && tpi->proto == htons(ETH_P_WCCP)) {
115+ u8 _val, *val;
116+
117+ val = skb_header_pointer(skb, nhs + hdr_len,
118+ sizeof(_val), &_val);
119+ if (!val)
120+ return -EINVAL;
113121 tpi->proto = proto;
114− if ((*(u8 *)options & 0xF0) != 0x40)
122+ if ((*val & 0xF0) != 0x40)
115123 hdr_len += 4;
116124 }
117125 tpi->hdr_len = hdr_len;
net/ipv4/inet_connection_sock.c+20−0
@@ -482,8 +482,28 @@ struct sock *inet_csk_accept(struct sock *sk, int flags, int *err, bool kern) · 481 unmodified lines
482482 }
483483 spin_unlock_bh(&queue->fastopenq.lock);
484484 }
485+
485486 out:
486487 release_sock(sk);
488+ if (newsk && mem_cgroup_sockets_enabled) {
489+ int amt;
490+
491+ /* atomically get the memory usage, set and charge the
492+ * newsk->sk_memcg.
493+ */
494+ lock_sock(newsk);
495+
496+ /* The socket has not been accepted yet, no need to look at
497+ * newsk->sk_wmem_queued.
498+ */
499+ amt = sk_mem_pages(newsk->sk_forward_alloc +
500+ atomic_read(&newsk->sk_rmem_alloc));
501+ mem_cgroup_sk_alloc(newsk);
502+ if (newsk->sk_memcg && amt)
503+ mem_cgroup_charge_skmem(newsk->sk_memcg, amt);
504+
505+ release_sock(newsk);
506+ }
487507 if (req)
488508 reqsk_put(req);
489509 return newsk;
net/ipv4/inet_diag.c+20−24
@@ -100,13 +100,9 @@ static size_t inet_sk_attr_size(struct sock *sk, · 99 unmodified lines
100100 aux = handler->idiag_get_aux_size(sk, net_admin);
101101
102102 return nla_total_size(sizeof(struct tcp_info))
103− + nla_total_size(1) /* INET_DIAG_SHUTDOWN */
104− + nla_total_size(1) /* INET_DIAG_TOS */
105− + nla_total_size(1) /* INET_DIAG_TCLASS */
106− + nla_total_size(4) /* INET_DIAG_MARK */
107− + nla_total_size(4) /* INET_DIAG_CLASS_ID */
108− + nla_total_size(sizeof(struct inet_diag_meminfo))
109103 + nla_total_size(sizeof(struct inet_diag_msg))
104+ + inet_diag_msg_attrs_size()
105+ + nla_total_size(sizeof(struct inet_diag_meminfo))
110106 + nla_total_size(SK_MEMINFO_VARS * sizeof(u32))
111107 + nla_total_size(TCP_CA_NAME_MAX)
112108 + nla_total_size(sizeof(struct tcpvegas_info))
@@ -147,6 +143,24 @@ int inet_diag_msg_attrs_fill(struct sock *sk, struct sk_buff *skb, · 34 unmodified lines
147143 if (net_admin && nla_put_u32(skb, INET_DIAG_MARK, sk->sk_mark))
148144 goto errout;
149145
146+ if (ext & (1 << (INET_DIAG_CLASS_ID - 1)) ||
147+ ext & (1 << (INET_DIAG_TCLASS - 1))) {
148+ u32 classid = 0;
149+
150+#ifdef CONFIG_SOCK_CGROUP_DATA
151+ classid = sock_cgroup_classid(&sk->sk_cgrp_data);
152+#endif
153+ /* Fallback to socket priority if class id isn't set.
154+ * Classful qdiscs use it as direct reference to class.
155+ * For cgroup2 classid is always zero.
156+ */
157+ if (!classid)
158+ classid = sk->sk_priority;
159+
160+ if (nla_put_u32(skb, INET_DIAG_CLASS_ID, classid))
161+ goto errout;
162+ }
163+
150164 r->idiag_uid = from_kuid_munged(user_ns, sock_i_uid(sk));
151165 r->idiag_inode = sock_i_ino(sk);
152166
@@ -284,24 +298,6 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, · 131 unmodified lines
284298 goto errout;
285299 }
286300
287− if (ext & (1 << (INET_DIAG_CLASS_ID - 1)) ||
288− ext & (1 << (INET_DIAG_TCLASS - 1))) {
289− u32 classid = 0;
290−
291−#ifdef CONFIG_SOCK_CGROUP_DATA
292− classid = sock_cgroup_classid(&sk->sk_cgrp_data);
293−#endif
294− /* Fallback to socket priority if class id isn't set.
295− * Classful qdiscs use it as direct reference to class.
296− * For cgroup2 classid is always zero.
297− */
298− if (!classid)
299− classid = sk->sk_priority;
300−
301− if (nla_put_u32(skb, INET_DIAG_CLASS_ID, classid))
302− goto errout;
303− }
304−
305301 out:
306302 nlmsg_end(skb, nlh);
307303 return 0;
net/ipv4/raw_diag.c+3−2
@@ -100,8 +100,9 @@ static int raw_diag_dump_one(struct sk_buff *in_skb, · 99 unmodified lines
100100 if (IS_ERR(sk))
101101 return PTR_ERR(sk);
102102
103− rep = nlmsg_new(sizeof(struct inet_diag_msg) +
104− sizeof(struct inet_diag_meminfo) + 64,
103+ rep = nlmsg_new(nla_total_size(sizeof(struct inet_diag_msg)) +
104+ inet_diag_msg_attrs_size() +
105+ nla_total_size(sizeof(struct inet_diag_meminfo)) + 64,
105106 GFP_KERNEL);
106107 if (!rep) {
107108 sock_put(sk);
net/ipv4/udp_diag.c+3−2
@@ -64,8 +64,9 @@ static int udp_dump_one(struct udp_table *tbl, struct sk_buff *in_skb, · 63 unmodified lines
6464 goto out;
6565
6666 err = -ENOMEM;
67− rep = nlmsg_new(sizeof(struct inet_diag_msg) +
68− sizeof(struct inet_diag_meminfo) + 64,
67+ rep = nlmsg_new(nla_total_size(sizeof(struct inet_diag_msg)) +
68+ inet_diag_msg_attrs_size() +
69+ nla_total_size(sizeof(struct inet_diag_meminfo)) + 64,
6970 GFP_KERNEL);
7071 if (!rep)
7172 goto out;
net/ipv6/addrconf.c+40−11
@@ -1226,11 +1226,13 @@ check_cleanup_prefix_route(struct inet6_ifaddr *ifp, unsigned long *expires) · 1225 unmodified lines
12261226 }
12271227
12281228 static void
1229−cleanup_prefix_route(struct inet6_ifaddr *ifp, unsigned long expires, bool del_rt)
1229+cleanup_prefix_route(struct inet6_ifaddr *ifp, unsigned long expires,
1230+ bool del_rt, bool del_peer)
12301231 {
12311232 struct fib6_info *f6i;
12321233
1233− f6i = addrconf_get_prefix_route(&ifp->addr, ifp->prefix_len,
1234+ f6i = addrconf_get_prefix_route(del_peer ? &ifp->peer_addr : &ifp->addr,
1235+ ifp->prefix_len,
12341236 ifp->idev->dev, 0, RTF_DEFAULT, true);
12351237 if (f6i) {
12361238 if (del_rt)
@@ -1293,7 +1295,7 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp) · 56 unmodified lines
12931295
12941296 if (action != CLEANUP_PREFIX_RT_NOP) {
12951297 cleanup_prefix_route(ifp, expires,
1296− action == CLEANUP_PREFIX_RT_DEL);
1298+ action == CLEANUP_PREFIX_RT_DEL, false);
12971299 }
12981300
12991301 /* clean up prefsrc entries */
@@ -3345,6 +3347,10 @@ static void addrconf_dev_config(struct net_device *dev) · 2045 unmodified lines
33453347 (dev->type != ARPHRD_NONE) &&
33463348 (dev->type != ARPHRD_RAWIP)) {
33473349 /* Alas, we support only Ethernet autoconfiguration. */
3350+ idev = __in6_dev_get(dev);
3351+ if (!IS_ERR_OR_NULL(idev) && dev->flags & IFF_UP &&
3352+ dev->flags & IFF_MULTICAST)
3353+ ipv6_mc_up(idev);
33483354 return;
33493355 }
33503356
@@ -4586,12 +4592,14 @@ inet6_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, · 1235 unmodified lines
45864592 }
45874593
45884594 static int modify_prefix_route(struct inet6_ifaddr *ifp,
4589− unsigned long expires, u32 flags)
4595+ unsigned long expires, u32 flags,
4596+ bool modify_peer)
45904597 {
45914598 struct fib6_info *f6i;
45924599 u32 prio;
45934600
4594− f6i = addrconf_get_prefix_route(&ifp->addr, ifp->prefix_len,
4601+ f6i = addrconf_get_prefix_route(modify_peer ? &ifp->peer_addr : &ifp->addr,
4602+ ifp->prefix_len,
45954603 ifp->idev->dev, 0, RTF_DEFAULT, true);
45964604 if (!f6i)
45974605 return -ENOENT;
@@ -4602,7 +4610,8 @@ static int modify_prefix_route(struct inet6_ifaddr *ifp, · 4 unmodified lines
46024610 ip6_del_rt(dev_net(ifp->idev->dev), f6i);
46034611
46044612 /* add new one */
4605− addrconf_prefix_route(&ifp->addr, ifp->prefix_len,
4613+ addrconf_prefix_route(modify_peer ? &ifp->peer_addr : &ifp->addr,
4614+ ifp->prefix_len,
46064615 ifp->rt_priority, ifp->idev->dev,
46074616 expires, flags, GFP_KERNEL);
46084617 } else {
@@ -4624,6 +4633,7 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, struct ifa6_config *cfg) · 15 unmodified lines
46244633 unsigned long timeout;
46254634 bool was_managetempaddr;
46264635 bool had_prefixroute;
4636+ bool new_peer = false;
46274637
46284638 ASSERT_RTNL();
46294639
@@ -4655,6 +4665,13 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, struct ifa6_config *cfg) · 25 unmodified lines
46554665 cfg->preferred_lft = timeout;
46564666 }
46574667
4668+ if (cfg->peer_pfx &&
4669+ memcmp(&ifp->peer_addr, cfg->peer_pfx, sizeof(struct in6_addr))) {
4670+ if (!ipv6_addr_any(&ifp->peer_addr))
4671+ cleanup_prefix_route(ifp, expires, true, true);
4672+ new_peer = true;
4673+ }
4674+
46584675 spin_lock_bh(&ifp->lock);
46594676 was_managetempaddr = ifp->flags & IFA_F_MANAGETEMPADDR;
46604677 had_prefixroute = ifp->flags & IFA_F_PERMANENT &&
@@ -4670,6 +4687,9 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, struct ifa6_config *cfg) · 9 unmodified lines
46704687 if (cfg->rt_priority && cfg->rt_priority != ifp->rt_priority)
46714688 ifp->rt_priority = cfg->rt_priority;
46724689
4690+ if (new_peer)
4691+ ifp->peer_addr = *cfg->peer_pfx;
4692+
46734693 spin_unlock_bh(&ifp->lock);
46744694 if (!(ifp->flags&IFA_F_TENTATIVE))
46754695 ipv6_ifa_notify(0, ifp);
@@ -4678,7 +4698,7 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, struct ifa6_config *cfg) · 2 unmodified lines
46784698 int rc = -ENOENT;
46794699
46804700 if (had_prefixroute)
4681− rc = modify_prefix_route(ifp, expires, flags);
4701+ rc = modify_prefix_route(ifp, expires, flags, false);
46824702
46834703 /* prefix route could have been deleted; if so restore it */
46844704 if (rc == -ENOENT) {
@@ -4686,6 +4706,15 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, struct ifa6_config *cfg) · 1 unmodified line
46864706 ifp->rt_priority, ifp->idev->dev,
46874707 expires, flags, GFP_KERNEL);
46884708 }
4709+
4710+ if (had_prefixroute && !ipv6_addr_any(&ifp->peer_addr))
4711+ rc = modify_prefix_route(ifp, expires, flags, true);
4712+
4713+ if (rc == -ENOENT && !ipv6_addr_any(&ifp->peer_addr)) {
4714+ addrconf_prefix_route(&ifp->peer_addr, ifp->prefix_len,
4715+ ifp->rt_priority, ifp->idev->dev,
4716+ expires, flags, GFP_KERNEL);
4717+ }
46894718 } else if (had_prefixroute) {
46904719 enum cleanup_prefix_rt_t action;
46914720 unsigned long rt_expires;
@@ -4696,7 +4725,7 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, struct ifa6_config *cfg) · 4 unmodified lines
46964725
46974726 if (action != CLEANUP_PREFIX_RT_NOP) {
46984727 cleanup_prefix_route(ifp, rt_expires,
4699− action == CLEANUP_PREFIX_RT_DEL);
4728+ action == CLEANUP_PREFIX_RT_DEL, false);
47004729 }
47014730 }
47024731
@@ -5983,9 +6012,9 @@ static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp) · 1280 unmodified lines
59836012 if (ifp->idev->cnf.forwarding)
59846013 addrconf_join_anycast(ifp);
59856014 if (!ipv6_addr_any(&ifp->peer_addr))
5986− addrconf_prefix_route(&ifp->peer_addr, 128, 0,
5987− ifp->idev->dev, 0, 0,
5988− GFP_ATOMIC);
6015+ addrconf_prefix_route(&ifp->peer_addr, 128,
6016+ ifp->rt_priority, ifp->idev->dev,
6017+ 0, 0, GFP_ATOMIC);
59896018 break;
59906019 case RTM_DELADDR:
59916020 if (ifp->idev->cnf.forwarding)
net/ipv6/seg6_iptunnel.c+1−1
@@ -268,7 +268,7 @@ static int seg6_do_srh(struct sk_buff *skb) · 267 unmodified lines
268268 skb_mac_header_rebuild(skb);
269269 skb_push(skb, skb->mac_len);
270270
271− err = seg6_do_srh_encap(skb, tinfo->srh, NEXTHDR_NONE);
271+ err = seg6_do_srh_encap(skb, tinfo->srh, IPPROTO_ETHERNET);
272272 if (err)
273273 return err;
274274
net/ipv6/seg6_local.c+1−1
@@ -282,7 +282,7 @@ static int input_action_end_dx2(struct sk_buff *skb, · 281 unmodified lines
282282 struct net_device *odev;
283283 struct ethhdr *eth;
284284
285− if (!decap_and_validate(skb, NEXTHDR_NONE))
285+ if (!decap_and_validate(skb, IPPROTO_ETHERNET))
286286 goto drop;
287287
288288 if (!pskb_may_pull(skb, ETH_HLEN))
net/mac80211/mesh_hwmp.c+2−1
@@ -1152,7 +1152,8 @@ int mesh_nexthop_resolve(struct ieee80211_sub_if_data *sdata, · 1151 unmodified lines
11521152 }
11531153 }
11541154
1155− if (!(mpath->flags & MESH_PATH_RESOLVING))
1155+ if (!(mpath->flags & MESH_PATH_RESOLVING) &&
1156+ mesh_path_sel_is_hwmp(sdata))
11561157 mesh_queue_preq(mpath, PREQ_Q_F_START);
11571158
11581159 if (skb_queue_len(&mpath->frame_queue) >= MESH_FRAME_QUEUE_LEN)
net/mptcp/options.c+17−2
@@ -334,6 +334,8 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb, · 333 unmodified lines
334334 struct mptcp_sock *msk;
335335 unsigned int ack_size;
336336 bool ret = false;
337+ bool can_ack;
338+ u64 ack_seq;
337339 u8 tcp_fin;
338340
339341 if (skb) {
@@ -360,9 +362,22 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb, · 20 unmodified lines
360362 ret = true;
361363 }
362364
365+ /* passive sockets msk will set the 'can_ack' after accept(), even
366+ * if the first subflow may have the already the remote key handy
367+ */
368+ can_ack = true;
363369 opts->ext_copy.use_ack = 0;
364370 msk = mptcp_sk(subflow->conn);
365− if (!msk || !READ_ONCE(msk->can_ack)) {
371+ if (likely(msk && READ_ONCE(msk->can_ack))) {
372+ ack_seq = msk->ack_seq;
373+ } else if (subflow->can_ack) {
374+ mptcp_crypto_key_sha(subflow->remote_key, NULL, &ack_seq);
375+ ack_seq++;
376+ } else {
377+ can_ack = false;
378+ }
379+
380+ if (unlikely(!can_ack)) {
366381 *size = ALIGN(dss_size, 4);
367382 return ret;
368383 }
@@ -375,7 +390,7 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb, · 6 unmodified lines
375390
376391 dss_size += ack_size;
377392
378− opts->ext_copy.data_ack = msk->ack_seq;
393+ opts->ext_copy.data_ack = ack_seq;
379394 opts->ext_copy.ack64 = 1;
380395 opts->ext_copy.use_ack = 1;
381396
net/netfilter/nf_conntrack_standalone.c+1−1
@@ -411,7 +411,7 @@ static void *ct_cpu_seq_next(struct seq_file *seq, void *v, loff_t *pos) · 410 unmodified lines
411411 *pos = cpu + 1;
412412 return per_cpu_ptr(net->ct.stat, cpu);
413413 }
414−
414+ (*pos)++;
415415 return NULL;
416416 }
417417
net/netfilter/nf_synproxy_core.c+1−1
@@ -267,7 +267,7 @@ static void *synproxy_cpu_seq_next(struct seq_file *seq, void *v, loff_t *pos) · 266 unmodified lines
267267 *pos = cpu + 1;
268268 return per_cpu_ptr(snet->stats, cpu);
269269 }
270−
270+ (*pos)++;
271271 return NULL;
272272 }
273273
net/netfilter/nf_tables_api.c+14−8
@@ -1405,6 +1405,11 @@ static int nf_tables_fill_chain_info(struct sk_buff *skb, struct net *net, · 1404 unmodified lines
14051405 lockdep_commit_lock_is_held(net));
14061406 if (nft_dump_stats(skb, stats))
14071407 goto nla_put_failure;
1408+
1409+ if ((chain->flags & NFT_CHAIN_HW_OFFLOAD) &&
1410+ nla_put_be32(skb, NFTA_CHAIN_FLAGS,
1411+ htonl(NFT_CHAIN_HW_OFFLOAD)))
1412+ goto nla_put_failure;
14081413 }
14091414
14101415 if (nla_put_be32(skb, NFTA_CHAIN_USE, htonl(chain->use)))
@@ -6300,8 +6305,13 @@ static int nf_tables_newflowtable(struct net *net, struct sock *nlsk, · 4889 unmodified lines
63006305 goto err4;
63016306
63026307 err = nft_register_flowtable_net_hooks(ctx.net, table, flowtable);
6303− if (err < 0)
6308+ if (err < 0) {
6309+ list_for_each_entry_safe(hook, next, &flowtable->hook_list, list) {
6310+ list_del_rcu(&hook->list);
6311+ kfree_rcu(hook, rcu);
6312+ }
63046313 goto err4;
6314+ }
63056315
63066316 err = nft_trans_flowtable_add(&ctx, NFT_MSG_NEWFLOWTABLE, flowtable);
63076317 if (err < 0)
@@ -7378,13 +7388,8 @@ static void nf_tables_module_autoload(struct net *net) · 1070 unmodified lines
73787388 list_splice_init(&net->nft.module_list, &module_list);
73797389 mutex_unlock(&net->nft.commit_mutex);
73807390 list_for_each_entry_safe(req, next, &module_list, list) {
7381− if (req->done) {
7382− list_del(&req->list);
7383− kfree(req);
7384− } else {
7385− request_module("%s", req->module);
7386− req->done = true;
7387− }
7391+ request_module("%s", req->module);
7392+ req->done = true;
73887393 }
73897394 mutex_lock(&net->nft.commit_mutex);
73907395 list_splice(&module_list, &net->nft.module_list);
@@ -8167,6 +8172,7 @@ static void __net_exit nf_tables_exit_net(struct net *net) · 776 unmodified lines
81678172 __nft_release_tables(net);
81688173 mutex_unlock(&net->nft.commit_mutex);
81698174 WARN_ON_ONCE(!list_empty(&net->nft.tables));
8175+ WARN_ON_ONCE(!list_empty(&net->nft.module_list));
81708176 }
81718177
81728178 static struct pernet_operations nf_tables_net_ops = {
net/netfilter/nfnetlink_cthelper.c+2−0
@@ -742,6 +742,8 @@ static const struct nla_policy nfnl_cthelper_policy[NFCTH_MAX+1] = { · 741 unmodified lines
742742 [NFCTH_NAME] = { .type = NLA_NUL_STRING,
743743 .len = NF_CT_HELPER_NAME_LEN-1 },
744744 [NFCTH_QUEUE_NUM] = { .type = NLA_U32, },
745+ [NFCTH_PRIV_DATA_LEN] = { .type = NLA_U32, },
746+ [NFCTH_STATUS] = { .type = NLA_U32, },
745747 };
746748
747749 static const struct nfnl_callback nfnl_cthelper_cb[NFNL_MSG_CTHELPER_MAX] = {
net/netfilter/nft_chain_nat.c+1−0
@@ -89,6 +89,7 @@ static const struct nft_chain_type nft_chain_nat_inet = { · 88 unmodified lines
8989 .name = "nat",
9090 .type = NFT_CHAIN_T_NAT,
9191 .family = NFPROTO_INET,
92+ .owner = THIS_MODULE,
9293 .hook_mask = (1 << NF_INET_PRE_ROUTING) |
9394 (1 << NF_INET_LOCAL_IN) |
9495 (1 << NF_INET_LOCAL_OUT) |
net/netfilter/nft_payload.c+1−0
@@ -129,6 +129,7 @@ static const struct nla_policy nft_payload_policy[NFTA_PAYLOAD_MAX + 1] = { · 128 unmodified lines
129129 [NFTA_PAYLOAD_LEN] = { .type = NLA_U32 },
130130 [NFTA_PAYLOAD_CSUM_TYPE] = { .type = NLA_U32 },
131131 [NFTA_PAYLOAD_CSUM_OFFSET] = { .type = NLA_U32 },
132+ [NFTA_PAYLOAD_CSUM_FLAGS] = { .type = NLA_U32 },
132133 };
133134
134135 static int nft_payload_init(const struct nft_ctx *ctx,
net/netfilter/nft_tunnel.c+2−0
@@ -339,6 +339,8 @@ static const struct nla_policy nft_tunnel_key_policy[NFTA_TUNNEL_KEY_MAX + 1] = · 338 unmodified lines
339339 [NFTA_TUNNEL_KEY_FLAGS] = { .type = NLA_U32, },
340340 [NFTA_TUNNEL_KEY_TOS] = { .type = NLA_U8, },
341341 [NFTA_TUNNEL_KEY_TTL] = { .type = NLA_U8, },
342+ [NFTA_TUNNEL_KEY_SPORT] = { .type = NLA_U16, },
343+ [NFTA_TUNNEL_KEY_DPORT] = { .type = NLA_U16, },
342344 [NFTA_TUNNEL_KEY_OPTS] = { .type = NLA_NESTED, },
343345 };
344346
net/netfilter/x_tables.c+3−3
@@ -1551,6 +1551,9 @@ static void *xt_mttg_seq_next(struct seq_file *seq, void *v, loff_t *ppos, · 1550 unmodified lines
15511551 uint8_t nfproto = (unsigned long)PDE_DATA(file_inode(seq->file));
15521552 struct nf_mttg_trav *trav = seq->private;
15531553
1554+ if (ppos != NULL)
1555+ ++(*ppos);
1556+
15541557 switch (trav->class) {
15551558 case MTTG_TRAV_INIT:
15561559 trav->class = MTTG_TRAV_NFP_UNSPEC;
@@ -1576,9 +1579,6 @@ static void *xt_mttg_seq_next(struct seq_file *seq, void *v, loff_t *ppos, · 19 unmodified lines
15761579 default:
15771580 return NULL;
15781581 }
1579−
1580− if (ppos != NULL)
1581− ++*ppos;
15821582 return trav;
15831583 }
15841584
net/netfilter/xt_recent.c+1−1
@@ -492,12 +492,12 @@ static void *recent_seq_next(struct seq_file *seq, void *v, loff_t *pos) · 491 unmodified lines
492492 const struct recent_entry *e = v;
493493 const struct list_head *head = e->list.next;
494494
495+ (*pos)++;
495496 while (head == &t->iphash[st->bucket]) {
496497 if (++st->bucket >= ip_list_hash_size)
497498 return NULL;
498499 head = t->iphash[st->bucket].next;
499500 }
500− (*pos)++;
501501 return list_entry(head, struct recent_entry, list);
502502 }
503503
net/netlink/af_netlink.c+1−1
@@ -2434,7 +2434,7 @@ void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err, · 2433 unmodified lines
24342434 in_skb->len))
24352435 WARN_ON(nla_put_u32(skb, NLMSGERR_ATTR_OFFS,
24362436 (u8 *)extack->bad_attr -
2437− in_skb->data));
2437+ (u8 *)nlh));
24382438 } else {
24392439 if (extack->cookie_len)
24402440 WARN_ON(nla_put(skb, NLMSGERR_ATTR_COOKIE,
net/nfc/hci/core.c+16−3
@@ -181,13 +181,20 @@ exit: · 180 unmodified lines
181181 void nfc_hci_cmd_received(struct nfc_hci_dev *hdev, u8 pipe, u8 cmd,
182182 struct sk_buff *skb)
183183 {
184− u8 gate = hdev->pipes[pipe].gate;
185184 u8 status = NFC_HCI_ANY_OK;
186185 struct hci_create_pipe_resp *create_info;
187186 struct hci_delete_pipe_noti *delete_info;
188187 struct hci_all_pipe_cleared_noti *cleared_info;
188+ u8 gate;
189189
190− pr_debug("from gate %x pipe %x cmd %x\n", gate, pipe, cmd);
190+ pr_debug("from pipe %x cmd %x\n", pipe, cmd);
191+
192+ if (pipe >= NFC_HCI_MAX_PIPES) {
193+ status = NFC_HCI_ANY_E_NOK;
194+ goto exit;
195+ }
196+
197+ gate = hdev->pipes[pipe].gate;
191198
192199 switch (cmd) {
193200 case NFC_HCI_ADM_NOTIFY_PIPE_CREATED:
@@ -375,8 +382,14 @@ void nfc_hci_event_received(struct nfc_hci_dev *hdev, u8 pipe, u8 event, · 181 unmodified lines
375382 struct sk_buff *skb)
376383 {
377384 int r = 0;
378− u8 gate = hdev->pipes[pipe].gate;
385+ u8 gate;
386+
387+ if (pipe >= NFC_HCI_MAX_PIPES) {
388+ pr_err("Discarded event %x to invalid pipe %x\n", event, pipe);
389+ goto exit;
390+ }
379391
392+ gate = hdev->pipes[pipe].gate;
380393 if (gate == NFC_HCI_INVALID_GATE) {
381394 pr_err("Discarded event %x to unopened pipe %x\n", event, pipe);
382395 goto exit;
net/nfc/netlink.c+4−0
@@ -32,6 +32,7 @@ static const struct nla_policy nfc_genl_policy[NFC_ATTR_MAX + 1] = { · 31 unmodified lines
3232 [NFC_ATTR_DEVICE_NAME] = { .type = NLA_STRING,
3333 .len = NFC_DEVICE_NAME_MAXSIZE },
3434 [NFC_ATTR_PROTOCOLS] = { .type = NLA_U32 },
35+ [NFC_ATTR_TARGET_INDEX] = { .type = NLA_U32 },
3536 [NFC_ATTR_COMM_MODE] = { .type = NLA_U8 },
3637 [NFC_ATTR_RF_MODE] = { .type = NLA_U8 },
3738 [NFC_ATTR_DEVICE_POWERED] = { .type = NLA_U8 },
@@ -43,7 +44,10 @@ static const struct nla_policy nfc_genl_policy[NFC_ATTR_MAX + 1] = { · 5 unmodified lines
4344 [NFC_ATTR_LLC_SDP] = { .type = NLA_NESTED },
4445 [NFC_ATTR_FIRMWARE_NAME] = { .type = NLA_STRING,
4546 .len = NFC_FIRMWARE_NAME_MAXSIZE },
47+ [NFC_ATTR_SE_INDEX] = { .type = NLA_U32 },
4648 [NFC_ATTR_SE_APDU] = { .type = NLA_BINARY },
49+ [NFC_ATTR_VENDOR_ID] = { .type = NLA_U32 },
50+ [NFC_ATTR_VENDOR_SUBCMD] = { .type = NLA_U32 },
4751 [NFC_ATTR_VENDOR_DATA] = { .type = NLA_BINARY },
4852
4953 };
net/openvswitch/datapath.c+1−0
@@ -645,6 +645,7 @@ static const struct nla_policy packet_policy[OVS_PACKET_ATTR_MAX + 1] = { · 644 unmodified lines
645645 [OVS_PACKET_ATTR_ACTIONS] = { .type = NLA_NESTED },
646646 [OVS_PACKET_ATTR_PROBE] = { .type = NLA_FLAG },
647647 [OVS_PACKET_ATTR_MRU] = { .type = NLA_U16 },
648+ [OVS_PACKET_ATTR_HASH] = { .type = NLA_U64 },
648649 };
649650
650651 static const struct genl_ops dp_packet_genl_ops[] = {
net/packet/af_packet.c+7−6
@@ -2274,6 +2274,13 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, · 2273 unmodified lines
22742274 TP_STATUS_KERNEL, (macoff+snaplen));
22752275 if (!h.raw)
22762276 goto drop_n_account;
2277+
2278+ if (do_vnet &&
2279+ virtio_net_hdr_from_skb(skb, h.raw + macoff -
2280+ sizeof(struct virtio_net_hdr),
2281+ vio_le(), true, 0))
2282+ goto drop_n_account;
2283+
22772284 if (po->tp_version <= TPACKET_V2) {
22782285 packet_increment_rx_head(po, &po->rx_ring);
22792286 /*
@@ -2286,12 +2293,6 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, · 6 unmodified lines
22862293 status |= TP_STATUS_LOSING;
22872294 }
22882295
2289− if (do_vnet &&
2290− virtio_net_hdr_from_skb(skb, h.raw + macoff -
2291− sizeof(struct virtio_net_hdr),
2292− vio_le(), true, 0))
2293− goto drop_n_account;
2294−
22952296 po->stats.stats1.tp_packets++;
22962297 if (copy_skb) {
22972298 status |= TP_STATUS_COPY;
net/sched/sch_fq.c+1−0
@@ -744,6 +744,7 @@ static const struct nla_policy fq_policy[TCA_FQ_MAX + 1] = { · 743 unmodified lines
744744 [TCA_FQ_FLOW_MAX_RATE] = { .type = NLA_U32 },
745745 [TCA_FQ_BUCKETS_LOG] = { .type = NLA_U32 },
746746 [TCA_FQ_FLOW_REFILL_DELAY] = { .type = NLA_U32 },
747+ [TCA_FQ_ORPHAN_MASK] = { .type = NLA_U32 },
747748 [TCA_FQ_LOW_RATE_THRESHOLD] = { .type = NLA_U32 },
748749 [TCA_FQ_CE_THRESHOLD] = { .type = NLA_U32 },
749750 };
net/sched/sch_taprio.c+10−3
@@ -564,8 +564,10 @@ static struct sk_buff *taprio_dequeue_soft(struct Qdisc *sch) · 563 unmodified lines
564564 prio = skb->priority;
565565 tc = netdev_get_prio_tc_map(dev, prio);
566566
567− if (!(gate_mask & BIT(tc)))
567+ if (!(gate_mask & BIT(tc))) {
568+ skb = NULL;
568569 continue;
570+ }
569571
570572 len = qdisc_pkt_len(skb);
571573 guard = ktime_add_ns(taprio_get_time(q),
@@ -575,13 +577,17 @@ static struct sk_buff *taprio_dequeue_soft(struct Qdisc *sch) · 3 unmodified lines
575577 * guard band ...
576578 */
577579 if (gate_mask != TAPRIO_ALL_GATES_OPEN &&
578− ktime_after(guard, entry->close_time))
580+ ktime_after(guard, entry->close_time)) {
581+ skb = NULL;
579582 continue;
583+ }
580584
581585 /* ... and no budget. */
582586 if (gate_mask != TAPRIO_ALL_GATES_OPEN &&
583− atomic_sub_return(len, &entry->budget) < 0)
587+ atomic_sub_return(len, &entry->budget) < 0) {
588+ skb = NULL;
584589 continue;
590+ }
585591
586592 skb = child->ops->dequeue(child);
587593 if (unlikely(!skb))
@@ -768,6 +774,7 @@ static const struct nla_policy taprio_policy[TCA_TAPRIO_ATTR_MAX + 1] = { · 180 unmodified lines
768774 [TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME] = { .type = NLA_S64 },
769775 [TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME_EXTENSION] = { .type = NLA_S64 },
770776 [TCA_TAPRIO_ATTR_FLAGS] = { .type = NLA_U32 },
777+ [TCA_TAPRIO_ATTR_TXTIME_DELAY] = { .type = NLA_U32 },
771778 };
772779
773780 static int fill_sched_entry(struct nlattr **tb, struct sched_entry *entry,
net/sctp/diag.c+2−6
@@ -237,15 +237,11 @@ static size_t inet_assoc_attr_size(struct sctp_association *asoc) · 236 unmodified lines
237237 addrcnt++;
238238
239239 return nla_total_size(sizeof(struct sctp_info))
240− + nla_total_size(1) /* INET_DIAG_SHUTDOWN */
241− + nla_total_size(1) /* INET_DIAG_TOS */
242− + nla_total_size(1) /* INET_DIAG_TCLASS */
243− + nla_total_size(4) /* INET_DIAG_MARK */
244− + nla_total_size(4) /* INET_DIAG_CLASS_ID */
245240 + nla_total_size(addrlen * asoc->peer.transport_count)
246241 + nla_total_size(addrlen * addrcnt)
247− + nla_total_size(sizeof(struct inet_diag_meminfo))
248242 + nla_total_size(sizeof(struct inet_diag_msg))
243+ + inet_diag_msg_attrs_size()
244+ + nla_total_size(sizeof(struct inet_diag_meminfo))
249245 + 64;
250246 }
251247
net/smc/smc_ib.c+1−0
@@ -582,6 +582,7 @@ static void smc_ib_remove_dev(struct ib_device *ibdev, void *client_data) · 581 unmodified lines
582582 smc_smcr_terminate_all(smcibdev);
583583 smc_ib_cleanup_per_ibdev(smcibdev);
584584 ib_unregister_event_handler(&smcibdev->event_handler);
585+ cancel_work_sync(&smcibdev->port_event_work);
585586 kfree(smcibdev);
586587 }
587588
net/socket.c+5−3
@@ -1707,7 +1707,8 @@ SYSCALL_DEFINE2(listen, int, fd, int, backlog) · 1706 unmodified lines
17071707
17081708 int __sys_accept4_file(struct file *file, unsigned file_flags,
17091709 struct sockaddr __user *upeer_sockaddr,
1710− int __user *upeer_addrlen, int flags)
1710+ int __user *upeer_addrlen, int flags,
1711+ unsigned long nofile)
17111712 {
17121713 struct socket *sock, *newsock;
17131714 struct file *newfile;
@@ -1738,7 +1739,7 @@ int __sys_accept4_file(struct file *file, unsigned file_flags, · 24 unmodified lines
17381739 */
17391740 __module_get(newsock->ops->owner);
17401741
1741− newfd = get_unused_fd_flags(flags);
1742+ newfd = __get_unused_fd_flags(flags, nofile);
17421743 if (unlikely(newfd < 0)) {
17431744 err = newfd;
17441745 sock_release(newsock);
@@ -1807,7 +1808,8 @@ int __sys_accept4(int fd, struct sockaddr __user *upeer_sockaddr, · 62 unmodified lines
18071808 f = fdget(fd);
18081809 if (f.file) {
18091810 ret = __sys_accept4_file(f.file, 0, upeer_sockaddr,
1810− upeer_addrlen, flags);
1811+ upeer_addrlen, flags,
1812+ rlimit(RLIMIT_NOFILE));
18111813 if (f.flags)
18121814 fput(f.file);
18131815 }
net/tipc/netlink.c+1−0
@@ -116,6 +116,7 @@ const struct nla_policy tipc_nl_prop_policy[TIPC_NLA_PROP_MAX + 1] = { · 115 unmodified lines
116116 [TIPC_NLA_PROP_PRIO] = { .type = NLA_U32 },
117117 [TIPC_NLA_PROP_TOL] = { .type = NLA_U32 },
118118 [TIPC_NLA_PROP_WIN] = { .type = NLA_U32 },
119+ [TIPC_NLA_PROP_MTU] = { .type = NLA_U32 },
119120 [TIPC_NLA_PROP_BROADCAST] = { .type = NLA_U32 },
120121 [TIPC_NLA_PROP_BROADCAST_RATIO] = { .type = NLA_U32 }
121122 };
net/wireless/nl80211.c+5−0
@@ -470,6 +470,8 @@ const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { · 469 unmodified lines
470470 [NL80211_ATTR_WOWLAN_TRIGGERS] = { .type = NLA_NESTED },
471471 [NL80211_ATTR_STA_PLINK_STATE] =
472472 NLA_POLICY_MAX(NLA_U8, NUM_NL80211_PLINK_STATES - 1),
473+ [NL80211_ATTR_MEASUREMENT_DURATION] = { .type = NLA_U16 },
474+ [NL80211_ATTR_MEASUREMENT_DURATION_MANDATORY] = { .type = NLA_FLAG },
473475 [NL80211_ATTR_MESH_PEER_AID] =
474476 NLA_POLICY_RANGE(NLA_U16, 1, IEEE80211_MAX_AID),
475477 [NL80211_ATTR_SCHED_SCAN_INTERVAL] = { .type = NLA_U32 },
@@ -531,6 +533,8 @@ const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { · 55 unmodified lines
531533 [NL80211_ATTR_MDID] = { .type = NLA_U16 },
532534 [NL80211_ATTR_IE_RIC] = { .type = NLA_BINARY,
533535 .len = IEEE80211_MAX_DATA_LEN },
536+ [NL80211_ATTR_CRIT_PROT_ID] = { .type = NLA_U16 },
537+ [NL80211_ATTR_MAX_CRIT_PROT_DURATION] = { .type = NLA_U16 },
534538 [NL80211_ATTR_PEER_AID] =
535539 NLA_POLICY_RANGE(NLA_U16, 1, IEEE80211_MAX_AID),
536540 [NL80211_ATTR_CH_SWITCH_COUNT] = { .type = NLA_U32 },
@@ -561,6 +565,7 @@ const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { · 24 unmodified lines
561565 NLA_POLICY_MAX(NLA_U8, IEEE80211_NUM_UPS - 1),
562566 [NL80211_ATTR_ADMITTED_TIME] = { .type = NLA_U16 },
563567 [NL80211_ATTR_SMPS_MODE] = { .type = NLA_U8 },
568+ [NL80211_ATTR_OPER_CLASS] = { .type = NLA_U8 },
564569 [NL80211_ATTR_MAC_MASK] = {
565570 .type = NLA_EXACT_LEN_WARN,
566571 .len = ETH_ALEN
scripts/Kconfig.include+7−0
@@ -44,3 +44,10 @@ $(error-if,$(success, $(LD) -v | grep -q gold), gold linker '$(LD)' not supporte · 43 unmodified lines
4444
4545 # gcc version including patch level
4646 gcc-version := $(shell,$(srctree)/scripts/gcc-version.sh $(CC))
47+
48+# machine bit flags
49+# $(m32-flag): -m32 if the compiler supports it, or an empty string otherwise.
50+# $(m64-flag): -m64 if the compiler supports it, or an empty string otherwise.
51+cc-option-bit = $(if-success,$(CC) -Werror $(1) -E -x c /dev/null -o /dev/null,$(1))
52+m32-flag := $(cc-option-bit,-m32)
53+m64-flag := $(cc-option-bit,-m64)
scripts/Makefile.extrawarn+1−0
@@ -48,6 +48,7 @@ KBUILD_CFLAGS += -Wno-initializer-overrides · 47 unmodified lines
4848 KBUILD_CFLAGS += -Wno-format
4949 KBUILD_CFLAGS += -Wno-sign-compare
5050 KBUILD_CFLAGS += -Wno-format-zero-length
51+KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast)
5152 endif
5253
5354 endif
scripts/export_report.pl+1−1
@@ -94,7 +94,7 @@ if (defined $opt{'o'}) { · 93 unmodified lines
9494 #
9595 while ( <$module_symvers> ) {
9696 chomp;
97− my (undef, $symbol, $namespace, $module, $gpl) = split('\t');
97+ my (undef, $symbol, $module, $gpl, $namespace) = split('\t');
9898 $SYMBOL { $symbol } = [ $module , "0" , $symbol, $gpl];
9999 }
100100 close($module_symvers);
scripts/kallsyms.c+4−4
@@ -195,13 +195,13 @@ static struct sym_entry *read_symbol(FILE *in) · 194 unmodified lines
195195 return NULL;
196196 }
197197
198− if (is_ignored_symbol(name, type))
199− return NULL;
200−
201− /* Ignore most absolute/undefined (?) symbols. */
202198 if (strcmp(name, "_text") == 0)
203199 _text = addr;
204200
201+ /* Ignore most absolute/undefined (?) symbols. */
202+ if (is_ignored_symbol(name, type))
203+ return NULL;
204+
205205 check_symbol_range(name, addr, text_ranges, ARRAY_SIZE(text_ranges));
206206 check_symbol_range(name, addr, &percpu_range, 1);
207207
scripts/mod/modpost.c+14−13
@@ -308,7 +308,8 @@ static const char *sec_name(struct elf_info *elf, int secindex) · 307 unmodified lines
308308
309309 static void *sym_get_data(const struct elf_info *info, const Elf_Sym *sym)
310310 {
311− Elf_Shdr *sechdr = &info->sechdrs[sym->st_shndx];
311+ unsigned int secindex = get_secindex(info, sym);
312+ Elf_Shdr *sechdr = &info->sechdrs[secindex];
312313 unsigned long offset;
313314
314315 offset = sym->st_value;
@@ -2427,7 +2428,7 @@ static void write_if_changed(struct buffer *b, const char *fname) · 2112 unmodified lines
24272428 }
24282429
24292430 /* parse Module.symvers file. line format:
2430− * 0x12345678<tab>symbol<tab>module[[<tab>export]<tab>something]
2431+ * 0x12345678<tab>symbol<tab>module<tab>export<tab>namespace
24312432 **/
24322433 static void read_dump(const char *fname, unsigned int kernel)
24332434 {
@@ -2440,7 +2441,7 @@ static void read_dump(const char *fname, unsigned int kernel) · 6 unmodified lines
24402441 return;
24412442
24422443 while ((line = get_next_line(&pos, file, size))) {
2443− char *symname, *namespace, *modname, *d, *export, *end;
2444+ char *symname, *namespace, *modname, *d, *export;
24442445 unsigned int crc;
24452446 struct module *mod;
24462447 struct symbol *s;
@@ -2448,16 +2449,16 @@ static void read_dump(const char *fname, unsigned int kernel) · 1 unmodified line
24482449 if (!(symname = strchr(line, '\t')))
24492450 goto fail;
24502451 *symname++ = '\0';
2451− if (!(namespace = strchr(symname, '\t')))
2452− goto fail;
2453− *namespace++ = '\0';
2454− if (!(modname = strchr(namespace, '\t')))
2452+ if (!(modname = strchr(symname, '\t')))
24552453 goto fail;
24562454 *modname++ = '\0';
2457− if ((export = strchr(modname, '\t')) != NULL)
2458− *export++ = '\0';
2459− if (export && ((end = strchr(export, '\t')) != NULL))
2460− *end = '\0';
2455+ if (!(export = strchr(modname, '\t')))
2456+ goto fail;
2457+ *export++ = '\0';
2458+ if (!(namespace = strchr(export, '\t')))
2459+ goto fail;
2460+ *namespace++ = '\0';
2461+
24612462 crc = strtoul(line, &d, 16);
24622463 if (*symname == '\0' || *modname == '\0' || *d != '\0')
24632464 goto fail;
@@ -2508,9 +2509,9 @@ static void write_dump(const char *fname) · 44 unmodified lines
25082509 namespace = symbol->namespace;
25092510 buf_printf(&buf, "0x%08x\t%s\t%s\t%s\t%s\n",
25102511 symbol->crc, symbol->name,
2511− namespace ? namespace : "",
25122512 symbol->module->name,
2513− export_str(symbol->export));
2513+ export_str(symbol->export),
2514+ namespace ? namespace : "");
25142515 }
25152516 symbol = symbol->next;
25162517 }
sound/core/oss/pcm_plugin.c+10−2
@@ -111,7 +111,7 @@ int snd_pcm_plug_alloc(struct snd_pcm_substream *plug, snd_pcm_uframes_t frames) · 110 unmodified lines
111111 while (plugin->next) {
112112 if (plugin->dst_frames)
113113 frames = plugin->dst_frames(plugin, frames);
114− if (snd_BUG_ON((snd_pcm_sframes_t)frames <= 0))
114+ if ((snd_pcm_sframes_t)frames <= 0)
115115 return -ENXIO;
116116 plugin = plugin->next;
117117 err = snd_pcm_plugin_alloc(plugin, frames);
@@ -123,7 +123,7 @@ int snd_pcm_plug_alloc(struct snd_pcm_substream *plug, snd_pcm_uframes_t frames) · 5 unmodified lines
123123 while (plugin->prev) {
124124 if (plugin->src_frames)
125125 frames = plugin->src_frames(plugin, frames);
126− if (snd_BUG_ON((snd_pcm_sframes_t)frames <= 0))
126+ if ((snd_pcm_sframes_t)frames <= 0)
127127 return -ENXIO;
128128 plugin = plugin->prev;
129129 err = snd_pcm_plugin_alloc(plugin, frames);
@@ -209,6 +209,8 @@ snd_pcm_sframes_t snd_pcm_plug_client_size(struct snd_pcm_substream *plug, snd_p · 79 unmodified lines
209209 if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
210210 plugin = snd_pcm_plug_last(plug);
211211 while (plugin && drv_frames > 0) {
212+ if (drv_frames > plugin->buf_frames)
213+ drv_frames = plugin->buf_frames;
212214 plugin_prev = plugin->prev;
213215 if (plugin->src_frames)
214216 drv_frames = plugin->src_frames(plugin, drv_frames);
@@ -220,6 +222,8 @@ snd_pcm_sframes_t snd_pcm_plug_client_size(struct snd_pcm_substream *plug, snd_p · 5 unmodified lines
220222 plugin_next = plugin->next;
221223 if (plugin->dst_frames)
222224 drv_frames = plugin->dst_frames(plugin, drv_frames);
225+ if (drv_frames > plugin->buf_frames)
226+ drv_frames = plugin->buf_frames;
223227 plugin = plugin_next;
224228 }
225229 } else
@@ -248,11 +252,15 @@ snd_pcm_sframes_t snd_pcm_plug_slave_size(struct snd_pcm_substream *plug, snd_pc · 22 unmodified lines
248252 if (frames < 0)
249253 return frames;
250254 }
255+ if (frames > plugin->buf_frames)
256+ frames = plugin->buf_frames;
251257 plugin = plugin_next;
252258 }
253259 } else if (stream == SNDRV_PCM_STREAM_CAPTURE) {
254260 plugin = snd_pcm_plug_last(plug);
255261 while (plugin) {
262+ if (frames > plugin->buf_frames)
263+ frames = plugin->buf_frames;
256264 plugin_prev = plugin->prev;
257265 if (plugin->src_frames) {
258266 frames = plugin->src_frames(plugin, frames);
sound/core/seq/oss/seq_oss_midi.c+1−0
@@ -602,6 +602,7 @@ send_midi_event(struct seq_oss_devinfo *dp, struct snd_seq_event *ev, struct seq · 601 unmodified lines
602602 len = snd_seq_oss_timer_start(dp->timer);
603603 if (ev->type == SNDRV_SEQ_EVENT_SYSEX) {
604604 snd_seq_oss_readq_sysex(dp->readq, mdev->seq_device, ev);
605+ snd_midi_event_reset_decode(mdev->coder);
605606 } else {
606607 len = snd_midi_event_decode(mdev->coder, msg, sizeof(msg), ev);
607608 if (len > 0)
sound/core/seq/seq_virmidi.c+1−0
@@ -81,6 +81,7 @@ static int snd_virmidi_dev_receive_event(struct snd_virmidi_dev *rdev, · 80 unmodified lines
8181 if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARIABLE)
8282 continue;
8383 snd_seq_dump_var_event(ev, (snd_seq_dump_func_t)snd_rawmidi_receive, vmidi->substream);
84+ snd_midi_event_reset_decode(vmidi->parser);
8485 } else {
8586 len = snd_midi_event_decode(vmidi->parser, msg, sizeof(msg), ev);
8687 if (len > 0)
sound/pci/hda/patch_realtek.c+25−0
@@ -8051,6 +8051,8 @@ static int patch_alc269(struct hda_codec *codec) · 8050 unmodified lines
80518051 spec->gen.mixer_nid = 0;
80528052 break;
80538053 case 0x10ec0225:
8054+ codec->power_save_node = 1;
8055+ /* fall through */
80548056 case 0x10ec0295:
80558057 case 0x10ec0299:
80568058 spec->codec_variant = ALC269_TYPE_ALC225;
@@ -8610,6 +8612,8 @@ enum { · 553 unmodified lines
86108612 ALC669_FIXUP_ACER_ASPIRE_ETHOS,
86118613 ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
86128614 ALC671_FIXUP_HP_HEADSET_MIC2,
8615+ ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
8616+ ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
86138617 };
86148618
86158619 static const struct hda_fixup alc662_fixups[] = {
@@ -8955,6 +8959,25 @@ static const struct hda_fixup alc662_fixups[] = { · 339 unmodified lines
89558959 .type = HDA_FIXUP_FUNC,
89568960 .v.func = alc671_fixup_hp_headset_mic2,
89578961 },
8962+ [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
8963+ .type = HDA_FIXUP_PINS,
8964+ .v.pins = (const struct hda_pintbl[]) {
8965+ { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
8966+ { }
8967+ },
8968+ .chained = true,
8969+ .chain_id = ALC662_FIXUP_USI_FUNC
8970+ },
8971+ [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
8972+ .type = HDA_FIXUP_PINS,
8973+ .v.pins = (const struct hda_pintbl[]) {
8974+ { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
8975+ { 0x1b, 0x0221144f },
8976+ { }
8977+ },
8978+ .chained = true,
8979+ .chain_id = ALC662_FIXUP_USI_FUNC
8980+ },
89588981 };
89598982
89608983 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
@@ -8966,6 +8989,8 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { · 5 unmodified lines
89668989 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
89678990 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
89688991 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
8992+ SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
8993+ SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
89698994 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
89708995 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
89718996 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
sound/usb/line6/driver.c+1−1
@@ -305,7 +305,7 @@ static void line6_data_received(struct urb *urb) · 304 unmodified lines
305305 line6_midibuf_read(mb, line6->buffer_message,
306306 LINE6_MIDI_MESSAGE_MAXLEN);
307307
308− if (done == 0)
308+ if (done <= 0)
309309 break;
310310
311311 line6->message_length = done;
sound/usb/line6/midibuf.c+1−1
@@ -159,7 +159,7 @@ int line6_midibuf_read(struct midi_buffer *this, unsigned char *data, · 158 unmodified lines
159159 int midi_length_prev =
160160 midibuf_message_length(this->command_prev);
161161
162− if (midi_length_prev > 0) {
162+ if (midi_length_prev > 1) {
163163 midi_length = midi_length_prev - 1;
164164 repeat = 1;
165165 } else
tools/include/uapi/asm/errno.h+7−7
@@ -1,18 +1,18 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
22 #if defined(__i386__) || defined(__x86_64__)
3−#include "../../arch/x86/include/uapi/asm/errno.h"
3+#include "../../../arch/x86/include/uapi/asm/errno.h"
44 #elif defined(__powerpc__)
5−#include "../../arch/powerpc/include/uapi/asm/errno.h"
5+#include "../../../arch/powerpc/include/uapi/asm/errno.h"
66 #elif defined(__sparc__)
7−#include "../../arch/sparc/include/uapi/asm/errno.h"
7+#include "../../../arch/sparc/include/uapi/asm/errno.h"
88 #elif defined(__alpha__)
9−#include "../../arch/alpha/include/uapi/asm/errno.h"
9+#include "../../../arch/alpha/include/uapi/asm/errno.h"
1010 #elif defined(__mips__)
11−#include "../../arch/mips/include/uapi/asm/errno.h"
11+#include "../../../arch/mips/include/uapi/asm/errno.h"
1212 #elif defined(__ia64__)
13−#include "../../arch/ia64/include/uapi/asm/errno.h"
13+#include "../../../arch/ia64/include/uapi/asm/errno.h"
1414 #elif defined(__xtensa__)
15−#include "../../arch/xtensa/include/uapi/asm/errno.h"
15+#include "../../../arch/xtensa/include/uapi/asm/errno.h"
1616 #else
1717 #include <asm-generic/errno.h>
1818 #endif
tools/perf/arch/arm64/util/arm-spe.c+10−10
@@ -11,17 +11,17 @@ · 10 unmodified lines
1111 #include <linux/zalloc.h>
1212 #include <time.h>
1313
14−#include "../../util/cpumap.h"
15−#include "../../util/event.h"
16−#include "../../util/evsel.h"
17−#include "../../util/evlist.h"
18−#include "../../util/session.h"
14+#include "../../../util/cpumap.h"
15+#include "../../../util/event.h"
16+#include "../../../util/evsel.h"
17+#include "../../../util/evlist.h"
18+#include "../../../util/session.h"
1919 #include <internal/lib.h> // page_size
20−#include "../../util/pmu.h"
21−#include "../../util/debug.h"
22−#include "../../util/auxtrace.h"
23−#include "../../util/record.h"
24−#include "../../util/arm-spe.h"
20+#include "../../../util/pmu.h"
21+#include "../../../util/debug.h"
22+#include "../../../util/auxtrace.h"
23+#include "../../../util/record.h"
24+#include "../../../util/arm-spe.h"
2525
2626 #define KiB(x) ((x) * 1024)
2727 #define MiB(x) ((x) * 1024 * 1024)
tools/perf/arch/arm64/util/perf_regs.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: GPL-2.0
2−#include "../../util/perf_regs.h"
2+#include "../../../util/perf_regs.h"
33
44 const struct sample_reg sample_reg_masks[] = {
55 SMPL_REG_END
tools/perf/arch/powerpc/util/perf_regs.c+2−2
@@ -4,8 +4,8 @@ · 3 unmodified lines
44 #include <regex.h>
55 #include <linux/zalloc.h>
66
7−#include "../../util/perf_regs.h"
8−#include "../../util/debug.h"
7+#include "../../../util/perf_regs.h"
8+#include "../../../util/debug.h"
99
1010 #include <linux/kernel.h>
1111
tools/perf/arch/x86/util/auxtrace.c+7−7
@@ -7,13 +7,13 @@ · 6 unmodified lines
77 #include <errno.h>
88 #include <stdbool.h>
99
10−#include "../../util/header.h"
11−#include "../../util/debug.h"
12−#include "../../util/pmu.h"
13−#include "../../util/auxtrace.h"
14−#include "../../util/intel-pt.h"
15−#include "../../util/intel-bts.h"
16−#include "../../util/evlist.h"
10+#include "../../../util/header.h"
11+#include "../../../util/debug.h"
12+#include "../../../util/pmu.h"
13+#include "../../../util/auxtrace.h"
14+#include "../../../util/intel-pt.h"
15+#include "../../../util/intel-bts.h"
16+#include "../../../util/evlist.h"
1717
1818 static
1919 struct auxtrace_record *auxtrace_record__init_intel(struct evlist *evlist,
tools/perf/arch/x86/util/event.c+6−6
@@ -3,12 +3,12 @@ · 2 unmodified lines
33 #include <linux/string.h>
44 #include <linux/zalloc.h>
55
6−#include "../../util/event.h"
7−#include "../../util/synthetic-events.h"
8−#include "../../util/machine.h"
9−#include "../../util/tool.h"
10−#include "../../util/map.h"
11−#include "../../util/debug.h"
6+#include "../../../util/event.h"
7+#include "../../../util/synthetic-events.h"
8+#include "../../../util/machine.h"
9+#include "../../../util/tool.h"
10+#include "../../../util/map.h"
11+#include "../../../util/debug.h"
1212
1313 #if defined(__x86_64__)
1414
tools/perf/arch/x86/util/header.c+2−2
@@ -7,8 +7,8 @@ · 6 unmodified lines
77 #include <string.h>
88 #include <regex.h>
99
10−#include "../../util/debug.h"
11−#include "../../util/header.h"
10+#include "../../../util/debug.h"
11+#include "../../../util/header.h"
1212
1313 static inline void
1414 cpuid(unsigned int op, unsigned int *a, unsigned int *b, unsigned int *c,
tools/perf/arch/x86/util/intel-bts.c+12−12
@@ -11,18 +11,18 @@ · 10 unmodified lines
1111 #include <linux/log2.h>
1212 #include <linux/zalloc.h>
1313
14−#include "../../util/cpumap.h"
15−#include "../../util/event.h"
16−#include "../../util/evsel.h"
17−#include "../../util/evlist.h"
18−#include "../../util/mmap.h"
19−#include "../../util/session.h"
20−#include "../../util/pmu.h"
21−#include "../../util/debug.h"
22−#include "../../util/record.h"
23−#include "../../util/tsc.h"
24−#include "../../util/auxtrace.h"
25−#include "../../util/intel-bts.h"
14+#include "../../../util/cpumap.h"
15+#include "../../../util/event.h"
16+#include "../../../util/evsel.h"
17+#include "../../../util/evlist.h"
18+#include "../../../util/mmap.h"
19+#include "../../../util/session.h"
20+#include "../../../util/pmu.h"
21+#include "../../../util/debug.h"
22+#include "../../../util/record.h"
23+#include "../../../util/tsc.h"
24+#include "../../../util/auxtrace.h"
25+#include "../../../util/intel-bts.h"
2626 #include <internal/lib.h> // page_size
2727
2828 #define KiB(x) ((x) * 1024)
tools/perf/arch/x86/util/intel-pt.c+15−15
@@ -13,23 +13,23 @@ · 12 unmodified lines
1313 #include <linux/zalloc.h>
1414 #include <cpuid.h>
1515
16−#include "../../util/session.h"
17−#include "../../util/event.h"
18−#include "../../util/evlist.h"
19−#include "../../util/evsel.h"
20−#include "../../util/evsel_config.h"
21−#include "../../util/cpumap.h"
22−#include "../../util/mmap.h"
16+#include "../../../util/session.h"
17+#include "../../../util/event.h"
18+#include "../../../util/evlist.h"
19+#include "../../../util/evsel.h"
20+#include "../../../util/evsel_config.h"
21+#include "../../../util/cpumap.h"
22+#include "../../../util/mmap.h"
2323 #include <subcmd/parse-options.h>
24−#include "../../util/parse-events.h"
25−#include "../../util/pmu.h"
26−#include "../../util/debug.h"
27−#include "../../util/auxtrace.h"
28−#include "../../util/record.h"
29−#include "../../util/target.h"
30−#include "../../util/tsc.h"
24+#include "../../../util/parse-events.h"
25+#include "../../../util/pmu.h"
26+#include "../../../util/debug.h"
27+#include "../../../util/auxtrace.h"
28+#include "../../../util/record.h"
29+#include "../../../util/target.h"
30+#include "../../../util/tsc.h"
3131 #include <internal/lib.h> // page_size
32−#include "../../util/intel-pt.h"
32+#include "../../../util/intel-pt.h"
3333
3434 #define KiB(x) ((x) * 1024)
3535 #define MiB(x) ((x) * 1024 * 1024)
tools/perf/arch/x86/util/machine.c+3−3
@@ -5,9 +5,9 @@ · 4 unmodified lines
55 #include <stdlib.h>
66
77 #include <internal/lib.h> // page_size
8−#include "../../util/machine.h"
9−#include "../../util/map.h"
10−#include "../../util/symbol.h"
8+#include "../../../util/machine.h"
9+#include "../../../util/map.h"
10+#include "../../../util/symbol.h"
1111 #include <linux/ctype.h>
1212
1313 #include <symbol/kallsyms.h>
tools/perf/arch/x86/util/perf_regs.c+4−4
@@ -5,10 +5,10 @@ · 4 unmodified lines
55 #include <linux/kernel.h>
66 #include <linux/zalloc.h>
77
8−#include "../../perf-sys.h"
9−#include "../../util/perf_regs.h"
10−#include "../../util/debug.h"
11−#include "../../util/event.h"
8+#include "../../../perf-sys.h"
9+#include "../../../util/perf_regs.h"
10+#include "../../../util/debug.h"
11+#include "../../../util/event.h"
1212
1313 const struct sample_reg sample_reg_masks[] = {
1414 SMPL_REG(AX, PERF_REG_X86_AX),
tools/perf/arch/x86/util/pmu.c+3−3
@@ -4,9 +4,9 @@ · 3 unmodified lines
44 #include <linux/stddef.h>
55 #include <linux/perf_event.h>
66
7−#include "../../util/intel-pt.h"
8−#include "../../util/intel-bts.h"
9−#include "../../util/pmu.h"
7+#include "../../../util/intel-pt.h"
8+#include "../../../util/intel-bts.h"
9+#include "../../../util/pmu.h"
1010
1111 struct perf_event_attr *perf_pmu__get_default_config(struct perf_pmu *pmu __maybe_unused)
1212 {
tools/perf/bench/bench.h+4−0
@@ -2,6 +2,10 @@ · 1 unmodified line
22 #ifndef BENCH_H
33 #define BENCH_H
44
5+#include <sys/time.h>
6+
7+extern struct timeval bench__start, bench__end, bench__runtime;
8+
59 /*
610 * The madvise transparent hugepage constants were added in glibc
711 * 2.13. For compatibility with older versions of glibc, define these
tools/perf/bench/epoll-ctl.c+4−4
@@ -35,7 +35,6 @@ · 34 unmodified lines
3535
3636 static unsigned int nthreads = 0;
3737 static unsigned int nsecs = 8;
38−struct timeval start, end, runtime;
3938 static bool done, __verbose, randomize;
4039
4140 /*
@@ -94,8 +93,8 @@ static void toggle_done(int sig __maybe_unused, · 52 unmodified lines
9493 {
9594 /* inform all threads that we're done for the day */
9695 done = true;
97− gettimeofday(&end, NULL);
98− timersub(&end, &start, &runtime);
96+ gettimeofday(&bench__end, NULL);
97+ timersub(&bench__end, &bench__start, &bench__runtime);
9998 }
10099
101100 static void nest_epollfd(void)
@@ -313,6 +312,7 @@ int bench_epoll_ctl(int argc, const char **argv) · 211 unmodified lines
313312 exit(EXIT_FAILURE);
314313 }
315314
315+ memset(&act, 0, sizeof(act));
316316 sigfillset(&act.sa_mask);
317317 act.sa_sigaction = toggle_done;
318318 sigaction(SIGINT, &act, NULL);
@@ -361,7 +361,7 @@ int bench_epoll_ctl(int argc, const char **argv) · 42 unmodified lines
361361
362362 threads_starting = nthreads;
363363
364− gettimeofday(&start, NULL);
364+ gettimeofday(&bench__start, NULL);
365365
366366 do_threads(worker, cpu);
367367
tools/perf/bench/epoll-wait.c+6−6
@@ -90,7 +90,6 @@ · 89 unmodified lines
9090
9191 static unsigned int nthreads = 0;
9292 static unsigned int nsecs = 8;
93−struct timeval start, end, runtime;
9493 static bool wdone, done, __verbose, randomize, nonblocking;
9594
9695 /*
@@ -276,8 +275,8 @@ static void toggle_done(int sig __maybe_unused, · 179 unmodified lines
276275 {
277276 /* inform all threads that we're done for the day */
278277 done = true;
279− gettimeofday(&end, NULL);
280− timersub(&end, &start, &runtime);
278+ gettimeofday(&bench__end, NULL);
279+ timersub(&bench__end, &bench__start, &bench__runtime);
281280 }
282281
283282 static void print_summary(void)
@@ -287,7 +286,7 @@ static void print_summary(void) · 3 unmodified lines
287286
288287 printf("\nAveraged %ld operations/sec (+- %.2f%%), total secs = %d\n",
289288 avg, rel_stddev_stats(stddev, avg),
290− (int) runtime.tv_sec);
289+ (int)bench__runtime.tv_sec);
291290 }
292291
293292 static int do_threads(struct worker *worker, struct perf_cpu_map *cpu)
@@ -427,6 +426,7 @@ int bench_epoll_wait(int argc, const char **argv) · 133 unmodified lines
427426 exit(EXIT_FAILURE);
428427 }
429428
429+ memset(&act, 0, sizeof(act));
430430 sigfillset(&act.sa_mask);
431431 act.sa_sigaction = toggle_done;
432432 sigaction(SIGINT, &act, NULL);
@@ -479,7 +479,7 @@ int bench_epoll_wait(int argc, const char **argv) · 46 unmodified lines
479479
480480 threads_starting = nthreads;
481481
482− gettimeofday(&start, NULL);
482+ gettimeofday(&bench__start, NULL);
483483
484484 do_threads(worker, cpu);
485485
@@ -519,7 +519,7 @@ int bench_epoll_wait(int argc, const char **argv) · 33 unmodified lines
519519 qsort(worker, nthreads, sizeof(struct worker), cmpworker);
520520
521521 for (i = 0; i < nthreads; i++) {
522− unsigned long t = worker[i].ops/runtime.tv_sec;
522+ unsigned long t = worker[i].ops / bench__runtime.tv_sec;
523523
524524 update_stats(&throughput_stats, t);
525525
tools/perf/bench/futex-hash.c+7−6
@@ -37,7 +37,7 @@ static unsigned int nfutexes = 1024; · 36 unmodified lines
3737 static bool fshared = false, done = false, silent = false;
3838 static int futex_flag = 0;
3939
40−struct timeval start, end, runtime;
40+struct timeval bench__start, bench__end, bench__runtime;
4141 static pthread_mutex_t thread_lock;
4242 static unsigned int threads_starting;
4343 static struct stats throughput_stats;
@@ -103,8 +103,8 @@ static void toggle_done(int sig __maybe_unused, · 59 unmodified lines
103103 {
104104 /* inform all threads that we're done for the day */
105105 done = true;
106− gettimeofday(&end, NULL);
107− timersub(&end, &start, &runtime);
106+ gettimeofday(&bench__end, NULL);
107+ timersub(&bench__end, &bench__start, &bench__runtime);
108108 }
109109
110110 static void print_summary(void)
@@ -114,7 +114,7 @@ static void print_summary(void) · 3 unmodified lines
114114
115115 printf("%sAveraged %ld operations/sec (+- %.2f%%), total secs = %d\n",
116116 !silent ? "\n" : "", avg, rel_stddev_stats(stddev, avg),
117− (int) runtime.tv_sec);
117+ (int)bench__runtime.tv_sec);
118118 }
119119
120120 int bench_futex_hash(int argc, const char **argv)
@@ -137,6 +137,7 @@ int bench_futex_hash(int argc, const char **argv) · 16 unmodified lines
137137 if (!cpu)
138138 goto errmem;
139139
140+ memset(&act, 0, sizeof(act));
140141 sigfillset(&act.sa_mask);
141142 act.sa_sigaction = toggle_done;
142143 sigaction(SIGINT, &act, NULL);
@@ -161,7 +162,7 @@ int bench_futex_hash(int argc, const char **argv) · 18 unmodified lines
161162
162163 threads_starting = nthreads;
163164 pthread_attr_init(&thread_attr);
164− gettimeofday(&start, NULL);
165+ gettimeofday(&bench__start, NULL);
165166 for (i = 0; i < nthreads; i++) {
166167 worker[i].tid = i;
167168 worker[i].futex = calloc(nfutexes, sizeof(*worker[i].futex));
@@ -204,7 +205,7 @@ int bench_futex_hash(int argc, const char **argv) · 36 unmodified lines
204205 pthread_mutex_destroy(&thread_lock);
205206
206207 for (i = 0; i < nthreads; i++) {
207− unsigned long t = worker[i].ops/runtime.tv_sec;
208+ unsigned long t = worker[i].ops / bench__runtime.tv_sec;
208209 update_stats(&throughput_stats, t);
209210 if (!silent) {
210211 if (nfutexes == 1)
tools/perf/bench/futex-lock-pi.c+6−6
@@ -37,7 +37,6 @@ static bool silent = false, multi = false; · 36 unmodified lines
3737 static bool done = false, fshared = false;
3838 static unsigned int nthreads = 0;
3939 static int futex_flag = 0;
40−struct timeval start, end, runtime;
4140 static pthread_mutex_t thread_lock;
4241 static unsigned int threads_starting;
4342 static struct stats throughput_stats;
@@ -64,7 +63,7 @@ static void print_summary(void) · 20 unmodified lines
6463
6564 printf("%sAveraged %ld operations/sec (+- %.2f%%), total secs = %d\n",
6665 !silent ? "\n" : "", avg, rel_stddev_stats(stddev, avg),
67− (int) runtime.tv_sec);
66+ (int)bench__runtime.tv_sec);
6867 }
6968
7069 static void toggle_done(int sig __maybe_unused,
@@ -73,8 +72,8 @@ static void toggle_done(int sig __maybe_unused, · 2 unmodified lines
7372 {
7473 /* inform all threads that we're done for the day */
7574 done = true;
76− gettimeofday(&end, NULL);
77− timersub(&end, &start, &runtime);
75+ gettimeofday(&bench__end, NULL);
76+ timersub(&bench__end, &bench__start, &bench__runtime);
7877 }
7978
8079 static void *workerfn(void *arg)
@@ -161,6 +160,7 @@ int bench_futex_lock_pi(int argc, const char **argv) · 80 unmodified lines
161160 if (!cpu)
162161 err(EXIT_FAILURE, "calloc");
163162
163+ memset(&act, 0, sizeof(act));
164164 sigfillset(&act.sa_mask);
165165 act.sa_sigaction = toggle_done;
166166 sigaction(SIGINT, &act, NULL);
@@ -185,7 +185,7 @@ int bench_futex_lock_pi(int argc, const char **argv) · 18 unmodified lines
185185
186186 threads_starting = nthreads;
187187 pthread_attr_init(&thread_attr);
188− gettimeofday(&start, NULL);
188+ gettimeofday(&bench__start, NULL);
189189
190190 create_threads(worker, thread_attr, cpu);
191191 pthread_attr_destroy(&thread_attr);
@@ -211,7 +211,7 @@ int bench_futex_lock_pi(int argc, const char **argv) · 19 unmodified lines
211211 pthread_mutex_destroy(&thread_lock);
212212
213213 for (i = 0; i < nthreads; i++) {
214− unsigned long t = worker[i].ops/runtime.tv_sec;
214+ unsigned long t = worker[i].ops / bench__runtime.tv_sec;
215215
216216 update_stats(&throughput_stats, t);
217217 if (!silent)
tools/perf/bench/futex-requeue.c+1−0
@@ -128,6 +128,7 @@ int bench_futex_requeue(int argc, const char **argv) · 127 unmodified lines
128128 if (!cpu)
129129 err(EXIT_FAILURE, "cpu_map__new");
130130
131+ memset(&act, 0, sizeof(act));
131132 sigfillset(&act.sa_mask);
132133 act.sa_sigaction = toggle_done;
133134 sigaction(SIGINT, &act, NULL);
tools/perf/bench/futex-wake-parallel.c+1−0
@@ -234,6 +234,7 @@ int bench_futex_wake_parallel(int argc, const char **argv) · 233 unmodified lines
234234 exit(EXIT_FAILURE);
235235 }
236236
237+ memset(&act, 0, sizeof(act));
237238 sigfillset(&act.sa_mask);
238239 act.sa_sigaction = toggle_done;
239240 sigaction(SIGINT, &act, NULL);
tools/perf/bench/futex-wake.c+3−2
@@ -43,7 +43,7 @@ static bool done = false, silent = false, fshared = false; · 42 unmodified lines
4343 static pthread_mutex_t thread_lock;
4444 static pthread_cond_t thread_parent, thread_worker;
4545 static struct stats waketime_stats, wakeup_stats;
46−static unsigned int ncpus, threads_starting, nthreads = 0;
46+static unsigned int threads_starting, nthreads = 0;
4747 static int futex_flag = 0;
4848
4949 static const struct option options[] = {
@@ -136,12 +136,13 @@ int bench_futex_wake(int argc, const char **argv) · 86 unmodified lines
136136 if (!cpu)
137137 err(EXIT_FAILURE, "calloc");
138138
139+ memset(&act, 0, sizeof(act));
139140 sigfillset(&act.sa_mask);
140141 act.sa_sigaction = toggle_done;
141142 sigaction(SIGINT, &act, NULL);
142143
143144 if (!nthreads)
144− nthreads = ncpus;
145+ nthreads = cpu->nr;
145146
146147 worker = calloc(nthreads, sizeof(*worker));
147148 if (!worker)
tools/perf/builtin-diff.c+2−1
@@ -1312,7 +1312,8 @@ static int cycles_printf(struct hist_entry *he, struct hist_entry *pair, · 1311 unmodified lines
13121312 end_line = map__srcline(he->ms.map, bi->sym->start + bi->end,
13131313 he->ms.sym);
13141314
1315− if ((start_line != SRCLINE_UNKNOWN) && (end_line != SRCLINE_UNKNOWN)) {
1315+ if ((strncmp(start_line, SRCLINE_UNKNOWN, strlen(SRCLINE_UNKNOWN)) != 0) &&
1316+ (strncmp(end_line, SRCLINE_UNKNOWN, strlen(SRCLINE_UNKNOWN)) != 0)) {
13161317 scnprintf(buf, sizeof(buf), "[%s -> %s] %4ld",
13171318 start_line, end_line, block_he->diff.cycles);
13181319 } else {
tools/perf/builtin-top.c+3−1
@@ -684,7 +684,9 @@ repeat: · 683 unmodified lines
684684 delay_msecs = top->delay_secs * MSEC_PER_SEC;
685685 set_term_quiet_input(&save);
686686 /* trash return*/
687− getc(stdin);
687+ clearerr(stdin);
688+ if (poll(&stdin_poll, 1, 0) > 0)
689+ getc(stdin);
688690
689691 while (!done) {
690692 perf_top__print_sym_table(top);
tools/perf/pmu-events/jevents.c+9−6
@@ -1082,10 +1082,9 @@ static int process_one_file(const char *fpath, const struct stat *sb, · 1081 unmodified lines
10821082 */
10831083 int main(int argc, char *argv[])
10841084 {
1085− int rc;
1085+ int rc, ret = 0;
10861086 int maxfds;
10871087 char ldirname[PATH_MAX];
1088−
10891088 const char *arch;
10901089 const char *output_file;
10911090 const char *start_dirname;
@@ -1156,7 +1155,8 @@ int main(int argc, char *argv[]) · 64 unmodified lines
11561155 /* Make build fail */
11571156 fclose(eventsfp);
11581157 free_arch_std_events();
1159− return 1;
1158+ ret = 1;
1159+ goto out_free_mapfile;
11601160 } else if (rc) {
11611161 goto empty_map;
11621162 }
@@ -1174,14 +1174,17 @@ int main(int argc, char *argv[]) · 11 unmodified lines
11741174 /* Make build fail */
11751175 fclose(eventsfp);
11761176 free_arch_std_events();
1177− return 1;
1177+ ret = 1;
11781178 }
11791179
1180− return 0;
1180+
1181+ goto out_free_mapfile;
11811182
11821183 empty_map:
11831184 fclose(eventsfp);
11841185 create_empty_mapping(output_file);
11851186 free_arch_std_events();
1186− return 0;
1187+out_free_mapfile:
1188+ free(mapfile);
1189+ return ret;
11871190 }
tools/perf/tests/bp_account.c+1−1
@@ -19,7 +19,7 @@ · 18 unmodified lines
1919 #include "../perf-sys.h"
2020 #include "cloexec.h"
2121
22−volatile long the_var;
22+static volatile long the_var;
2323
2424 static noinline int test_function(void)
2525 {
tools/perf/util/block-info.c+2−1
@@ -295,7 +295,8 @@ static int block_range_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, · 294 unmodified lines
295295 end_line = map__srcline(he->ms.map, bi->sym->start + bi->end,
296296 he->ms.sym);
297297
298− if ((start_line != SRCLINE_UNKNOWN) && (end_line != SRCLINE_UNKNOWN)) {
298+ if ((strncmp(start_line, SRCLINE_UNKNOWN, strlen(SRCLINE_UNKNOWN)) != 0) &&
299+ (strncmp(end_line, SRCLINE_UNKNOWN, strlen(SRCLINE_UNKNOWN)) != 0)) {
299300 scnprintf(buf, sizeof(buf), "[%s -> %s]",
300301 start_line, end_line);
301302 } else {
tools/perf/util/env.c+2−2
@@ -343,11 +343,11 @@ static const char *normalize_arch(char *arch) · 342 unmodified lines
343343
344344 const char *perf_env__arch(struct perf_env *env)
345345 {
346− struct utsname uts;
347346 char *arch_name;
348347
349348 if (!env || !env->arch) { /* Assume local operation */
350− if (uname(&uts) < 0)
349+ static struct utsname uts = { .machine[0] = '\0', };
350+ if (uts.machine[0] == '\0' && uname(&uts) < 0)
351351 return NULL;
352352 arch_name = uts.machine;
353353 } else
tools/perf/util/map.c+1−1
@@ -431,7 +431,7 @@ int map__fprintf_srcline(struct map *map, u64 addr, const char *prefix, · 430 unmodified lines
431431
432432 if (map && map->dso) {
433433 char *srcline = map__srcline(map, addr, NULL);
434− if (srcline != SRCLINE_UNKNOWN)
434+ if (strncmp(srcline, SRCLINE_UNKNOWN, strlen(SRCLINE_UNKNOWN)) != 0)
435435 ret = fprintf(fp, "%s%s", prefix, srcline);
436436 free_srcline(srcline);
437437 }
tools/perf/util/parse-events.c+2−8
@@ -257,21 +257,15 @@ struct tracepoint_path *tracepoint_id_to_path(u64 config) · 256 unmodified lines
257257 path = zalloc(sizeof(*path));
258258 if (!path)
259259 return NULL;
260− path->system = malloc(MAX_EVENT_LENGTH);
261− if (!path->system) {
260+ if (asprintf(&path->system, "%.*s", MAX_EVENT_LENGTH, sys_dirent->d_name) < 0) {
262261 free(path);
263262 return NULL;
264263 }
265− path->name = malloc(MAX_EVENT_LENGTH);
266− if (!path->name) {
264+ if (asprintf(&path->name, "%.*s", MAX_EVENT_LENGTH, evt_dirent->d_name) < 0) {
267265 zfree(&path->system);
268266 free(path);
269267 return NULL;
270268 }
271− strncpy(path->system, sys_dirent->d_name,
272− MAX_EVENT_LENGTH);
273− strncpy(path->name, evt_dirent->d_name,
274− MAX_EVENT_LENGTH);
275269 return path;
276270 }
277271 }
tools/perf/util/symbol.c+6−7
@@ -1622,7 +1622,12 @@ int dso__load(struct dso *dso, struct map *map) · 1621 unmodified lines
16221622 goto out;
16231623 }
16241624
1625− if (dso->kernel) {
1625+ kmod = dso->symtab_type == DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE ||
1626+ dso->symtab_type == DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP ||
1627+ dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE ||
1628+ dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE_COMP;
1629+
1630+ if (dso->kernel && !kmod) {
16261631 if (dso->kernel == DSO_TYPE_KERNEL)
16271632 ret = dso__load_kernel_sym(dso, map);
16281633 else if (dso->kernel == DSO_TYPE_GUEST_KERNEL)
@@ -1650,12 +1655,6 @@ int dso__load(struct dso *dso, struct map *map) · 21 unmodified lines
16501655 if (!name)
16511656 goto out;
16521657
1653− kmod = dso->symtab_type == DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE ||
1654− dso->symtab_type == DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP ||
1655− dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE ||
1656− dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE_COMP;
1657−
1658−
16591658 /*
16601659 * Read the build id if possible. This is required for
16611660 * DSO_BINARY_TYPE__BUILDID_DEBUGINFO to work
tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c+1−1
@@ -82,7 +82,7 @@ static struct pci_access *pci_acc; · 81 unmodified lines
8282 static struct pci_dev *amd_fam14h_pci_dev;
8383 static int nbp1_entered;
8484
85−struct timespec start_time;
85+static struct timespec start_time;
8686 static unsigned long long timediff;
8787
8888 #ifdef DEBUG
tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c+1−1
@@ -19,7 +19,7 @@ struct cpuidle_monitor cpuidle_sysfs_monitor; · 18 unmodified lines
1919
2020 static unsigned long long **previous_count;
2121 static unsigned long long **current_count;
22−struct timespec start_time;
22+static struct timespec start_time;
2323 static unsigned long long timediff;
2424
2525 static int cpuidle_get_count_percent(unsigned int id, double *percent,
tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c+2−0
@@ -27,6 +27,8 @@ struct cpuidle_monitor *all_monitors[] = { · 26 unmodified lines
2727 0
2828 };
2929
30+int cpu_count;
31+
3032 static struct cpuidle_monitor *monitors[MONITORS_MAX];
3133 static unsigned int avail_monitors;
3234
tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h+1−1
@@ -25,7 +25,7 @@ · 24 unmodified lines
2525 #endif
2626 #define CSTATE_DESC_LEN 60
2727
28−int cpu_count;
28+extern int cpu_count;
2929
3030 /* Hard to define the right names ...: */
3131 enum power_range_e {
tools/power/x86/turbostat/Makefile+1−1
@@ -16,7 +16,7 @@ override CFLAGS += -D_FORTIFY_SOURCE=2 · 15 unmodified lines
1616
1717 %: %.c
1818 @mkdir -p $(BUILD_OUTPUT)
19− $(CC) $(CFLAGS) $< -o $(BUILD_OUTPUT)/$@ $(LDFLAGS)
19+ $(CC) $(CFLAGS) $< -o $(BUILD_OUTPUT)/$@ $(LDFLAGS) -lcap
2020
2121 .PHONY : clean
2222 clean :
tools/power/x86/turbostat/turbostat.c+113−29
@@ -30,7 +30,7 @@ · 29 unmodified lines
3030 #include <sched.h>
3131 #include <time.h>
3232 #include <cpuid.h>
33−#include <linux/capability.h>
33+#include <sys/capability.h>
3434 #include <errno.h>
3535 #include <math.h>
3636
@@ -304,6 +304,10 @@ int *irqs_per_cpu; /* indexed by cpu_num */ · 267 unmodified lines
304304
305305 void setup_all_buffers(void);
306306
307+char *sys_lpi_file;
308+char *sys_lpi_file_sysfs = "/sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us";
309+char *sys_lpi_file_debugfs = "/sys/kernel/debug/pmc_core/slp_s0_residency_usec";
310+
307311 int cpu_is_not_present(int cpu)
308312 {
309313 return !CPU_ISSET_S(cpu, cpu_present_setsize, cpu_present_set);
@@ -2916,8 +2920,6 @@ int snapshot_gfx_mhz(void) · 2606 unmodified lines
29162920 *
29172921 * record snapshot of
29182922 * /sys/devices/system/cpu/cpuidle/low_power_idle_cpu_residency_us
2919− *
2920− * return 1 if config change requires a restart, else return 0
29212923 */
29222924 int snapshot_cpu_lpi_us(void)
29232925 {
@@ -2941,17 +2943,14 @@ int snapshot_cpu_lpi_us(void) · 17 unmodified lines
29412943 /*
29422944 * snapshot_sys_lpi()
29432945 *
2944− * record snapshot of
2945− * /sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us
2946− *
2947− * return 1 if config change requires a restart, else return 0
2946+ * record snapshot of sys_lpi_file
29482947 */
29492948 int snapshot_sys_lpi_us(void)
29502949 {
29512950 FILE *fp;
29522951 int retval;
29532952
2954− fp = fopen_or_die("/sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us", "r");
2953+ fp = fopen_or_die(sys_lpi_file, "r");
29552954
29562955 retval = fscanf(fp, "%lld", &cpuidle_cur_sys_lpi_us);
29572956 if (retval != 1) {
@@ -3151,28 +3150,42 @@ void check_dev_msr() · 193 unmodified lines
31513150 err(-5, "no /dev/cpu/0/msr, Try \"# modprobe msr\" ");
31523151 }
31533152
3154−void check_permissions()
3153+/*
3154+ * check for CAP_SYS_RAWIO
3155+ * return 0 on success
3156+ * return 1 on fail
3157+ */
3158+int check_for_cap_sys_rawio(void)
31553159 {
3156− struct __user_cap_header_struct cap_header_data;
3157− cap_user_header_t cap_header = &cap_header_data;
3158− struct __user_cap_data_struct cap_data_data;
3159− cap_user_data_t cap_data = &cap_data_data;
3160− extern int capget(cap_user_header_t hdrp, cap_user_data_t datap);
3161− int do_exit = 0;
3162− char pathname[32];
3160+ cap_t caps;
3161+ cap_flag_value_t cap_flag_value;
31633162
3164− /* check for CAP_SYS_RAWIO */
3165− cap_header->pid = getpid();
3166− cap_header->version = _LINUX_CAPABILITY_VERSION;
3167− if (capget(cap_header, cap_data) < 0)
3168− err(-6, "capget(2) failed");
3163+ caps = cap_get_proc();
3164+ if (caps == NULL)
3165+ err(-6, "cap_get_proc\n");
31693166
3170− if ((cap_data->effective & (1 << CAP_SYS_RAWIO)) == 0) {
3171− do_exit++;
3167+ if (cap_get_flag(caps, CAP_SYS_RAWIO, CAP_EFFECTIVE, &cap_flag_value))
3168+ err(-6, "cap_get\n");
3169+
3170+ if (cap_flag_value != CAP_SET) {
31723171 warnx("capget(CAP_SYS_RAWIO) failed,"
31733172 " try \"# setcap cap_sys_rawio=ep %s\"", progname);
3173+ return 1;
31743174 }
31753175
3176+ if (cap_free(caps) == -1)
3177+ err(-6, "cap_free\n");
3178+
3179+ return 0;
3180+}
3181+void check_permissions(void)
3182+{
3183+ int do_exit = 0;
3184+ char pathname[32];
3185+
3186+ /* check for CAP_SYS_RAWIO */
3187+ do_exit += check_for_cap_sys_rawio();
3188+
31763189 /* test file permissions */
31773190 sprintf(pathname, "/dev/cpu/%d/msr", base_cpu);
31783191 if (euidaccess(pathname, R_OK)) {
@@ -3265,6 +3278,7 @@ int probe_nhm_msrs(unsigned int family, unsigned int model) · 86 unmodified lines
32653278 case INTEL_FAM6_ATOM_GOLDMONT: /* BXT */
32663279 case INTEL_FAM6_ATOM_GOLDMONT_PLUS:
32673280 case INTEL_FAM6_ATOM_GOLDMONT_D: /* DNV */
3281+ case INTEL_FAM6_ATOM_TREMONT: /* EHL */
32683282 pkg_cstate_limits = glm_pkg_cstate_limits;
32693283 break;
32703284 default:
@@ -3336,6 +3350,17 @@ int is_skx(unsigned int family, unsigned int model) · 65 unmodified lines
33363350 }
33373351 return 0;
33383352 }
3353+int is_ehl(unsigned int family, unsigned int model)
3354+{
3355+ if (!genuine_intel)
3356+ return 0;
3357+
3358+ switch (model) {
3359+ case INTEL_FAM6_ATOM_TREMONT:
3360+ return 1;
3361+ }
3362+ return 0;
3363+}
33393364
33403365 int has_turbo_ratio_limit(unsigned int family, unsigned int model)
33413366 {
@@ -3478,6 +3503,23 @@ dump_cstate_pstate_config_info(unsigned int family, unsigned int model) · 136 unmodified lines
34783503 dump_nhm_cst_cfg();
34793504 }
34803505
3506+static void dump_sysfs_file(char *path)
3507+{
3508+ FILE *input;
3509+ char cpuidle_buf[64];
3510+
3511+ input = fopen(path, "r");
3512+ if (input == NULL) {
3513+ if (debug)
3514+ fprintf(outf, "NSFOD %s\n", path);
3515+ return;
3516+ }
3517+ if (!fgets(cpuidle_buf, sizeof(cpuidle_buf), input))
3518+ err(1, "%s: failed to read file", path);
3519+ fclose(input);
3520+
3521+ fprintf(outf, "%s: %s", strrchr(path, '/') + 1, cpuidle_buf);
3522+}
34813523 static void
34823524 dump_sysfs_cstate_config(void)
34833525 {
@@ -3491,6 +3533,15 @@ dump_sysfs_cstate_config(void) · 7 unmodified lines
34913533 if (!DO_BIC(BIC_sysfs))
34923534 return;
34933535
3536+ if (access("/sys/devices/system/cpu/cpuidle", R_OK)) {
3537+ fprintf(outf, "cpuidle not loaded\n");
3538+ return;
3539+ }
3540+
3541+ dump_sysfs_file("/sys/devices/system/cpu/cpuidle/current_driver");
3542+ dump_sysfs_file("/sys/devices/system/cpu/cpuidle/current_governor");
3543+ dump_sysfs_file("/sys/devices/system/cpu/cpuidle/current_governor_ro");
3544+
34943545 for (state = 0; state < 10; ++state) {
34953546
34963547 sprintf(path, "/sys/devices/system/cpu/cpu%d/cpuidle/state%d/name",
@@ -3894,6 +3945,20 @@ void rapl_probe_intel(unsigned int family, unsigned int model) · 397 unmodified lines
38943945 else
38953946 BIC_PRESENT(BIC_PkgWatt);
38963947 break;
3948+ case INTEL_FAM6_ATOM_TREMONT: /* EHL */
3949+ do_rapl = RAPL_PKG | RAPL_CORES | RAPL_CORE_POLICY | RAPL_DRAM | RAPL_DRAM_PERF_STATUS | RAPL_PKG_PERF_STATUS | RAPL_GFX | RAPL_PKG_POWER_INFO;
3950+ if (rapl_joules) {
3951+ BIC_PRESENT(BIC_Pkg_J);
3952+ BIC_PRESENT(BIC_Cor_J);
3953+ BIC_PRESENT(BIC_RAM_J);
3954+ BIC_PRESENT(BIC_GFX_J);
3955+ } else {
3956+ BIC_PRESENT(BIC_PkgWatt);
3957+ BIC_PRESENT(BIC_CorWatt);
3958+ BIC_PRESENT(BIC_RAMWatt);
3959+ BIC_PRESENT(BIC_GFXWatt);
3960+ }
3961+ break;
38973962 case INTEL_FAM6_SKYLAKE_L: /* SKL */
38983963 case INTEL_FAM6_CANNONLAKE_L: /* CNL */
38993964 do_rapl = RAPL_PKG | RAPL_CORES | RAPL_CORE_POLICY | RAPL_DRAM | RAPL_DRAM_PERF_STATUS | RAPL_PKG_PERF_STATUS | RAPL_GFX | RAPL_PKG_POWER_INFO;
@@ -4295,6 +4360,7 @@ int has_snb_msrs(unsigned int family, unsigned int model) · 395 unmodified lines
42954360 case INTEL_FAM6_ATOM_GOLDMONT: /* BXT */
42964361 case INTEL_FAM6_ATOM_GOLDMONT_PLUS:
42974362 case INTEL_FAM6_ATOM_GOLDMONT_D: /* DNV */
4363+ case INTEL_FAM6_ATOM_TREMONT: /* EHL */
42984364 return 1;
42994365 }
43004366 return 0;
@@ -4324,6 +4390,7 @@ int has_c8910_msrs(unsigned int family, unsigned int model) · 23 unmodified lines
43244390 case INTEL_FAM6_CANNONLAKE_L: /* CNL */
43254391 case INTEL_FAM6_ATOM_GOLDMONT: /* BXT */
43264392 case INTEL_FAM6_ATOM_GOLDMONT_PLUS:
4393+ case INTEL_FAM6_ATOM_TREMONT: /* EHL */
43274394 return 1;
43284395 }
43294396 return 0;
@@ -4610,14 +4677,24 @@ unsigned int intel_model_duplicates(unsigned int model) · 280 unmodified lines
46104677 case INTEL_FAM6_SKYLAKE:
46114678 case INTEL_FAM6_KABYLAKE_L:
46124679 case INTEL_FAM6_KABYLAKE:
4680+ case INTEL_FAM6_COMETLAKE_L:
4681+ case INTEL_FAM6_COMETLAKE:
46134682 return INTEL_FAM6_SKYLAKE_L;
46144683
46154684 case INTEL_FAM6_ICELAKE_L:
46164685 case INTEL_FAM6_ICELAKE_NNPI:
4686+ case INTEL_FAM6_TIGERLAKE_L:
4687+ case INTEL_FAM6_TIGERLAKE:
46174688 return INTEL_FAM6_CANNONLAKE_L;
46184689
46194690 case INTEL_FAM6_ATOM_TREMONT_D:
46204691 return INTEL_FAM6_ATOM_GOLDMONT_D;
4692+
4693+ case INTEL_FAM6_ATOM_TREMONT_L:
4694+ return INTEL_FAM6_ATOM_TREMONT;
4695+
4696+ case INTEL_FAM6_ICELAKE_X:
4697+ return INTEL_FAM6_SKYLAKE_X;
46214698 }
46224699 return model;
46234700 }
@@ -4872,7 +4949,8 @@ void process_cpuid() · 248 unmodified lines
48724949 do_slm_cstates = is_slm(family, model);
48734950 do_knl_cstates = is_knl(family, model);
48744951
4875− if (do_slm_cstates || do_knl_cstates || is_cnl(family, model))
4952+ if (do_slm_cstates || do_knl_cstates || is_cnl(family, model) ||
4953+ is_ehl(family, model))
48764954 BIC_NOT_PRESENT(BIC_CPU_c3);
48774955
48784956 if (!quiet)
@@ -4907,10 +4985,16 @@ void process_cpuid() · 28 unmodified lines
49074985 else
49084986 BIC_NOT_PRESENT(BIC_CPU_LPI);
49094987
4910− if (!access("/sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us", R_OK))
4988+ if (!access(sys_lpi_file_sysfs, R_OK)) {
4989+ sys_lpi_file = sys_lpi_file_sysfs;
49114990 BIC_PRESENT(BIC_SYS_LPI);
4912− else
4991+ } else if (!access(sys_lpi_file_debugfs, R_OK)) {
4992+ sys_lpi_file = sys_lpi_file_debugfs;
4993+ BIC_PRESENT(BIC_SYS_LPI);
4994+ } else {
4995+ sys_lpi_file_sysfs = NULL;
49134996 BIC_NOT_PRESENT(BIC_SYS_LPI);
4997+ }
49144998
49154999 if (!quiet)
49165000 decode_misc_feature_control();
@@ -5306,7 +5390,7 @@ int get_and_dump_counters(void) · 389 unmodified lines
53065390 }
53075391
53085392 void print_version() {
5309− fprintf(outf, "turbostat version 19.08.31"
5393+ fprintf(outf, "turbostat version 20.03.20"
53105394 " - Len Brown <lenb@kernel.org>\n");
53115395 }
53125396
@@ -5323,9 +5407,9 @@ int add_counter(unsigned int msr_num, char *path, char *name, · 10 unmodified lines
53235407 }
53245408
53255409 msrp->msr_num = msr_num;
5326− strncpy(msrp->name, name, NAME_BYTES);
5410+ strncpy(msrp->name, name, NAME_BYTES - 1);
53275411 if (path)
5328− strncpy(msrp->path, path, PATH_BYTES);
5412+ strncpy(msrp->path, path, PATH_BYTES - 1);
53295413 msrp->width = width;
53305414 msrp->type = type;
53315415 msrp->format = format;
tools/testing/ktest/ktest.pl+8−8
@@ -30,7 +30,7 @@ my %default = ( · 29 unmodified lines
3030 "EMAIL_WHEN_STARTED" => 0,
3131 "NUM_TESTS" => 1,
3232 "TEST_TYPE" => "build",
33− "BUILD_TYPE" => "randconfig",
33+ "BUILD_TYPE" => "oldconfig",
3434 "MAKE_CMD" => "make",
3535 "CLOSE_CONSOLE_SIGNAL" => "INT",
3636 "TIMEOUT" => 120,
@@ -1030,7 +1030,7 @@ sub __read_config { · 993 unmodified lines
10301030 }
10311031
10321032 if (!$skip && $rest !~ /^\s*$/) {
1033− die "$name: $.: Gargbage found after $type\n$_";
1033+ die "$name: $.: Garbage found after $type\n$_";
10341034 }
10351035
10361036 if ($skip && $type eq "TEST_START") {
@@ -1063,7 +1063,7 @@ sub __read_config { · 26 unmodified lines
10631063 }
10641064
10651065 if ($rest !~ /^\s*$/) {
1066− die "$name: $.: Gargbage found after DEFAULTS\n$_";
1066+ die "$name: $.: Garbage found after DEFAULTS\n$_";
10671067 }
10681068
10691069 } elsif (/^\s*INCLUDE\s+(\S+)/) {
@@ -1154,7 +1154,7 @@ sub __read_config { · 84 unmodified lines
11541154 # on of these sections that have SKIP defined.
11551155 # The save variable can be
11561156 # defined multiple times and the new one simply overrides
1157− # the prevous one.
1157+ # the previous one.
11581158 set_variable($lvalue, $rvalue);
11591159
11601160 } else {
@@ -1234,7 +1234,7 @@ sub read_config { · 73 unmodified lines
12341234 foreach my $option (keys %not_used) {
12351235 print "$option\n";
12361236 }
1237− print "Set IGRNORE_UNUSED = 1 to have ktest ignore unused variables\n";
1237+ print "Set IGNORE_UNUSED = 1 to have ktest ignore unused variables\n";
12381238 if (!read_yn "Do you want to continue?") {
12391239 exit -1;
12401240 }
@@ -1345,7 +1345,7 @@ sub eval_option { · 104 unmodified lines
13451345 # Check for recursive evaluations.
13461346 # 100 deep should be more than enough.
13471347 if ($r++ > 100) {
1348− die "Over 100 evaluations accurred with $option\n" .
1348+ die "Over 100 evaluations occurred with $option\n" .
13491349 "Check for recursive variables\n";
13501350 }
13511351 $prev = $option;
@@ -1383,7 +1383,7 @@ sub reboot { · 31 unmodified lines
13831383
13841384 } else {
13851385 # Make sure everything has been written to disk
1386− run_ssh("sync");
1386+ run_ssh("sync", 10);
13871387
13881388 if (defined($time)) {
13891389 start_monitor;
@@ -1461,7 +1461,7 @@ sub get_test_name() { · 71 unmodified lines
14611461
14621462 sub dodie {
14631463
1464− # avoid recusion
1464+ # avoid recursion
14651465 return if ($in_die);
14661466 $in_die = 1;
14671467
tools/testing/ktest/sample.conf+11−11
@@ -10,7 +10,7 @@ · 9 unmodified lines
1010 #
1111
1212 # Options set in the beginning of the file are considered to be
13−# default options. These options can be overriden by test specific
13+# default options. These options can be overridden by test specific
1414 # options, with the following exceptions:
1515 #
1616 # LOG_FILE
@@ -204,7 +204,7 @@ · 187 unmodified lines
204204 #
205205 # This config file can also contain "config variables".
206206 # These are assigned with ":=" instead of the ktest option
207−# assigment "=".
207+# assignment "=".
208208 #
209209 # The difference between ktest options and config variables
210210 # is that config variables can be used multiple times,
@@ -263,7 +263,7 @@ · 52 unmodified lines
263263 #### Using options in other options ####
264264 #
265265 # Options that are defined in the config file may also be used
266−# by other options. All options are evaulated at time of
266+# by other options. All options are evaluated at time of
267267 # use (except that config variables are evaluated at config
268268 # processing time).
269269 #
@@ -505,7 +505,7 @@ · 235 unmodified lines
505505 #TEST = ssh user@machine /root/run_test
506506
507507 # The build type is any make config type or special command
508−# (default randconfig)
508+# (default oldconfig)
509509 # nobuild - skip the clean and build step
510510 # useconfig:/path/to/config - use the given config and run
511511 # oldconfig on it.
@@ -707,7 +707,7 @@ · 195 unmodified lines
707707
708708 # Line to define a successful boot up in console output.
709709 # This is what the line contains, not the entire line. If you need
710−# the entire line to match, then use regural expression syntax like:
710+# the entire line to match, then use regular expression syntax like:
711711 # (do not add any quotes around it)
712712 #
713713 # SUCCESS_LINE = ^MyBox Login:$
@@ -839,7 +839,7 @@ · 125 unmodified lines
839839 # (ignored if POWEROFF_ON_SUCCESS is set)
840840 #REBOOT_ON_SUCCESS = 1
841841
842−# In case there are isses with rebooting, you can specify this
842+# In case there are issues with rebooting, you can specify this
843843 # to always powercycle after this amount of time after calling
844844 # reboot.
845845 # Note, POWERCYCLE_AFTER_REBOOT = 0 does NOT disable it. It just
@@ -848,7 +848,7 @@ · 2 unmodified lines
848848 # (default undefined)
849849 #POWERCYCLE_AFTER_REBOOT = 5
850850
851−# In case there's isses with halting, you can specify this
851+# In case there's issues with halting, you can specify this
852852 # to always poweroff after this amount of time after calling
853853 # halt.
854854 # Note, POWEROFF_AFTER_HALT = 0 does NOT disable it. It just
@@ -972,7 +972,7 @@ · 117 unmodified lines
972972 #
973973 # PATCHCHECK_START is required and is the first patch to
974974 # test (the SHA1 of the commit). You may also specify anything
975−# that git checkout allows (branch name, tage, HEAD~3).
975+# that git checkout allows (branch name, tag, HEAD~3).
976976 #
977977 # PATCHCHECK_END is the last patch to check (default HEAD)
978978 #
@@ -994,7 +994,7 @@ · 15 unmodified lines
994994 # IGNORE_WARNINGS is set for the given commit's sha1
995995 #
996996 # IGNORE_WARNINGS can be used to disable the failure of patchcheck
997−# on a particuler commit (SHA1). You can add more than one commit
997+# on a particular commit (SHA1). You can add more than one commit
998998 # by adding a list of SHA1s that are space delimited.
999999 #
10001000 # If BUILD_NOCLEAN is set, then make mrproper will not be run on
@@ -1093,7 +1093,7 @@ · 92 unmodified lines
10931093 # whatever reason. (Can't reboot, want to inspect each iteration)
10941094 # Doing a BISECT_MANUAL will have the test wait for you to
10951095 # tell it if the test passed or failed after each iteration.
1096−# This is basicall the same as running git bisect yourself
1096+# This is basically the same as running git bisect yourself
10971097 # but ktest will rebuild and install the kernel for you.
10981098 #
10991099 # BISECT_CHECK = 1 (optional, default 0)
@@ -1239,7 +1239,7 @@ · 139 unmodified lines
12391239 #
12401240 # CONFIG_BISECT_EXEC (optional)
12411241 # The config bisect is a separate program that comes with ktest.pl.
1242−# By befault, it will look for:
1242+# By default, it will look for:
12431243 # `pwd`/config-bisect.pl # the location ktest.pl was executed from.
12441244 # If it does not find it there, it will look for:
12451245 # `dirname <ktest.pl>`/config-bisect.pl # The directory that holds ktest.pl
tools/testing/selftests/net/fib_tests.sh+31−3
@@ -1041,6 +1041,27 @@ ipv6_addr_metric_test() · 1040 unmodified lines
10411041 fi
10421042 log_test $rc 0 "Prefix route with metric on link up"
10431043
1044+ # verify peer metric added correctly
1045+ set -e
1046+ run_cmd "$IP -6 addr flush dev dummy2"
1047+ run_cmd "$IP -6 addr add dev dummy2 2001:db8:104::1 peer 2001:db8:104::2 metric 260"
1048+ set +e
1049+
1050+ check_route6 "2001:db8:104::1 dev dummy2 proto kernel metric 260"
1051+ log_test $? 0 "Set metric with peer route on local side"
1052+ log_test $? 0 "User specified metric on local address"
1053+ check_route6 "2001:db8:104::2 dev dummy2 proto kernel metric 260"
1054+ log_test $? 0 "Set metric with peer route on peer side"
1055+
1056+ set -e
1057+ run_cmd "$IP -6 addr change dev dummy2 2001:db8:104::1 peer 2001:db8:104::3 metric 261"
1058+ set +e
1059+
1060+ check_route6 "2001:db8:104::1 dev dummy2 proto kernel metric 261"
1061+ log_test $? 0 "Modify metric and peer address on local side"
1062+ check_route6 "2001:db8:104::3 dev dummy2 proto kernel metric 261"
1063+ log_test $? 0 "Modify metric and peer address on peer side"
1064+
10441065 $IP li del dummy1
10451066 $IP li del dummy2
10461067 cleanup
@@ -1457,13 +1478,20 @@ ipv4_addr_metric_test() · 410 unmodified lines
14571478
14581479 run_cmd "$IP addr flush dev dummy2"
14591480 run_cmd "$IP addr add dev dummy2 172.16.104.1/32 peer 172.16.104.2 metric 260"
1460− run_cmd "$IP addr change dev dummy2 172.16.104.1/32 peer 172.16.104.2 metric 261"
14611481 rc=$?
14621482 if [ $rc -eq 0 ]; then
1463− check_route "172.16.104.2 dev dummy2 proto kernel scope link src 172.16.104.1 metric 261"
1483+ check_route "172.16.104.2 dev dummy2 proto kernel scope link src 172.16.104.1 metric 260"
1484+ rc=$?
1485+ fi
1486+ log_test $rc 0 "Set metric of address with peer route"
1487+
1488+ run_cmd "$IP addr change dev dummy2 172.16.104.1/32 peer 172.16.104.3 metric 261"
1489+ rc=$?
1490+ if [ $rc -eq 0 ]; then
1491+ check_route "172.16.104.3 dev dummy2 proto kernel scope link src 172.16.104.1 metric 261"
14641492 rc=$?
14651493 fi
1466− log_test $rc 0 "Modify metric of address with peer route"
1494+ log_test $rc 0 "Modify metric and peer address for peer route"
14671495
14681496 $IP li del dummy1
14691497 $IP li del dummy2
tools/testing/selftests/tc-testing/config+1−0
@@ -57,3 +57,4 @@ CONFIG_NET_IFE_SKBMARK=m · 56 unmodified lines
5757 CONFIG_NET_IFE_SKBPRIO=m
5858 CONFIG_NET_IFE_SKBTCINDEX=m
5959 CONFIG_NET_SCH_FIFO=y
60+CONFIG_NET_SCH_ETS=m
usr/Kconfig+11−11
@@ -124,17 +124,6 @@ choice · 123 unmodified lines
124124
125125 If in doubt, select 'None'
126126
127−config INITRAMFS_COMPRESSION_NONE
128− bool "None"
129− help
130− Do not compress the built-in initramfs at all. This may sound wasteful
131− in space, but, you should be aware that the built-in initramfs will be
132− compressed at a later stage anyways along with the rest of the kernel,
133− on those architectures that support this. However, not compressing the
134− initramfs may lead to slightly higher memory consumption during a
135− short time at boot, while both the cpio image and the unpacked
136− filesystem image will be present in memory simultaneously
137−
138127 config INITRAMFS_COMPRESSION_GZIP
139128 bool "Gzip"
140129 depends on RD_GZIP
@@ -207,4 +196,15 @@ config INITRAMFS_COMPRESSION_LZ4 · 66 unmodified lines
207196 If you choose this, keep in mind that most distros don't provide lz4
208197 by default which could cause a build failure.
209198
199+config INITRAMFS_COMPRESSION_NONE
200+ bool "None"
201+ help
202+ Do not compress the built-in initramfs at all. This may sound wasteful
203+ in space, but, you should be aware that the built-in initramfs will be
204+ compressed at a later stage anyways along with the rest of the kernel,
205+ on those architectures that support this. However, not compressing the
206+ initramfs may lead to slightly higher memory consumption during a
207+ short time at boot, while both the cpio image and the unpacked
208+ filesystem image will be present in memory simultaneously
209+
210210 endchoice